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

@ -1023,7 +1023,6 @@ void encode_transform_tree(encoder_control* encoder,transform_info* ti,uint8_t d
return; return;
} }
{ {
uint8_t CbY = 0,CbU = 0,CbV = 0; uint8_t CbY = 0,CbU = 0,CbV = 0;
int32_t coeff_fourth = ((LCU_WIDTH>>(depth))*(LCU_WIDTH>>(depth))); int32_t coeff_fourth = ((LCU_WIDTH>>(depth))*(LCU_WIDTH>>(depth)));
@ -1249,7 +1248,7 @@ void encode_transform_coeff(encoder_control* encoder,transform_info* ti,int8_t d
if(encoder->in.video_format != FORMAT_400) if(encoder->in.video_format != FORMAT_400)
{ {
/* Non-zero chroma U Tcoeffs */ /* 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); 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]; cabac.ctx = &g_QtCbfSCModelU[trDepth];
if(trDepth == 0 || ti->cb_top[1]) 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 */ /* Non-zero chroma V Tcoeffs */
/* NOTE: Using the same ctx as before */ /* 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); 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]) 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 deltaPos=0;
int32_t deltaInt; int32_t deltaInt;
int32_t deltaFract; int32_t deltaFract;
int32_t minusDeltaFract;
int32_t refMainIndex; int32_t refMainIndex;
for (k=0;k<blkSize;k++) for (k=0;k<blkSize;k++)
@ -585,13 +586,15 @@ void intra_getAngularPred(int16_t* pSrc, int32_t srcStride, int16_t* rpDst, int3
deltaInt = deltaPos >> 5; deltaInt = deltaPos >> 5;
deltaFract = deltaPos & (32 - 1); deltaFract = deltaPos & (32 - 1);
if (deltaFract) if (deltaFract)
{ {
minusDeltaFract = (32-deltaFract);
// Do linear filtering // Do linear filtering
for (l=0;l<blkSize;l++) for (l=0;l<blkSize;l++)
{ {
refMainIndex = l+deltaInt+1; 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 else