Added inter.c/.h

This commit is contained in:
Marko Viitanen 2013-04-24 10:35:27 +03:00
parent 3f009e6421
commit 003093b1ef
4 changed files with 83 additions and 10 deletions

View file

@ -730,12 +730,12 @@ void encode_coding_tree(encoder_control* encoder,uint16_t xCtb,uint16_t yCtb, ui
CABAC_BIN(&cabac, (cur_CU->type == CU_INTRA)?1:0, "PredMode");
}
/* Signal PartSize on max depth */
if(depth == MAX_DEPTH)
{
cabac.ctx = &g_PartSizeSCModel[(cur_CU->type == CU_INTRA)?0:999];
CABAC_BIN(&cabac, 1, "PartSize");
}
/* Signal PartSize on max depth */
if(depth == MAX_DEPTH)
{
cabac.ctx = &g_PartSizeSCModel[(cur_CU->type == CU_INTRA)?0:999];
CABAC_BIN(&cabac, 1, "PartSize");
}
/*end partsize*/
if(cur_CU->type == CU_INTER)
@ -1022,7 +1022,6 @@ void encode_transform_tree(encoder_control* encoder,transform_info* ti,uint8_t d
ti->idx = 3; encode_transform_tree(encoder,ti,depth+1);
return;
}
{
uint8_t CbY = 0,CbU = 0,CbV = 0;
@ -1249,7 +1248,7 @@ void encode_transform_coeff(encoder_control* encoder,transform_info* ti,int8_t d
if(encoder->in.video_format != FORMAT_400)
{
/* Non-zero chroma U Tcoeffs */
//ToDo: fix
//ToDo: fix transform split
int8_t Cb_flag = ti->cb_top[1];//(trDepth==0&&split)?ti->cb_top[1]:(ti->cb[ti->idx]&0x2);
cabac.ctx = &g_QtCbfSCModelU[trDepth];
if(trDepth == 0 || ti->cb_top[1])
@ -1258,7 +1257,7 @@ void encode_transform_coeff(encoder_control* encoder,transform_info* ti,int8_t d
}
/* Non-zero chroma V Tcoeffs */
/* NOTE: Using the same ctx as before */
//ToDo: fix
//ToDo: fix transform split
Cb_flag = ti->cb_top[2];//(trDepth==0&&split)?ti->cb_top[2]:(ti->cb[ti->idx]&0x4);
if(trDepth == 0 || ti->cb_top[2])
{

53
src/inter.c Normal file
View file

@ -0,0 +1,53 @@
/**
* HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/
/*! \file inter.c
\brief Inter functions
\author Marko Viitanen
\date 2013-04
Inter functions
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "global.h"
#include "config.h"
#include "encoder.h"
#include "picture.h"
#include "inter.h"
/*!
\brief Set block mode (and init typedata)
\param pic picture to use
\param xCtb x CU position (smallest CU)
\param yCtb y CU position (smallest CU)
\param depth current CU depth
\param mode mode to set
\returns Void
*/
void inter_setBlockMode(picture* pic,uint32_t xCtb, uint32_t yCtb, uint8_t depth, uint8_t mode)
{
uint32_t x,y,d;
/* Width in smallest CU */
int width_in_SCU = pic->width/(LCU_WIDTH>>MAX_DEPTH);
int block_SCU_width = (LCU_WIDTH>>depth)/(LCU_WIDTH>>MAX_DEPTH);
for(y = yCtb; y < yCtb+block_SCU_width; y++)
{
int CUpos = y*width_in_SCU;
for(x = xCtb; x < xCtb+block_SCU_width; x++)
{
for(d = 0; d < MAX_DEPTH+1; d++)
{
pic->CU[d][CUpos+x].depth = depth;
pic->CU[d][CUpos+x].type = CU_INTER;
pic->CU[d][CUpos+x].inter.mode = mode;
}
}
}
}

18
src/inter.h Normal file
View file

@ -0,0 +1,18 @@
/**
* HEVC Encoder
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Pervasive Computing.
*/
/*! \file inter.h
\brief Inter function headers
\author Marko Viitanen
\date 2013-04
Inter functions
*/
#ifndef __INTER_H
#define __INTER_H
void inter_setBlockMode(picture* pic,uint32_t xCtb, uint32_t yCtb, uint8_t depth, uint8_t mode);
#endif

View file

@ -577,6 +577,7 @@ void intra_getAngularPred(int16_t* pSrc, int32_t srcStride, int16_t* rpDst, int3
int32_t deltaPos=0;
int32_t deltaInt;
int32_t deltaFract;
int32_t minusDeltaFract;
int32_t refMainIndex;
for (k=0;k<blkSize;k++)
@ -584,14 +585,16 @@ void intra_getAngularPred(int16_t* pSrc, int32_t srcStride, int16_t* rpDst, int3
deltaPos += intraPredAngle;
deltaInt = deltaPos >> 5;
deltaFract = deltaPos & (32 - 1);
if (deltaFract)
{
minusDeltaFract = (32-deltaFract);
// Do linear filtering
for (l=0;l<blkSize;l++)
{
refMainIndex = l+deltaInt+1;
pDst[k*dstStride+l] = (int16_t) ( ((32-deltaFract)*refMain[refMainIndex]+deltaFract*refMain[refMainIndex+1]+16) >> 5 );
pDst[k*dstStride+l] = (int16_t) ( (minusDeltaFract*refMain[refMainIndex]+deltaFract*refMain[refMainIndex+1]+16) >> 5 );
}
}
else