Added predInfo coding comments and a template for future use

This commit is contained in:
Marko Viitanen 2013-02-28 17:31:14 +02:00
parent eba43088b2
commit cecbd1585b
2 changed files with 70 additions and 31 deletions

View file

@ -272,6 +272,7 @@ void encode_one_frame(encoder_control* encoder)
} }
else if(encoder->frame < 10) else if(encoder->frame < 10)
{ {
/*
cabac_start(&cabac); cabac_start(&cabac);
encoder->in.cur_pic.type = 0; encoder->in.cur_pic.type = 0;
encode_slice_header(encoder); encode_slice_header(encoder);
@ -282,6 +283,7 @@ void encode_one_frame(encoder_control* encoder)
bitstream_flush(encoder->stream); bitstream_flush(encoder->stream);
nal_write(encoder->output, encoder->stream->buffer, encoder->stream->buffer_pos, 0, 0, encoder->frame); nal_write(encoder->output, encoder->stream->buffer, encoder->stream->buffer_pos, 0, 0, encoder->frame);
bitstream_clear_buffer(encoder->stream); bitstream_clear_buffer(encoder->stream);
*/
/* /*
encoder->in.cur_pic.type = 0; encoder->in.cur_pic.type = 0;
encode_slice_header(encoder); encode_slice_header(encoder);
@ -683,7 +685,7 @@ void encode_coding_tree(encoder_control* encoder,uint16_t xCtb,uint16_t yCtb, ui
} }
} }
if(/*border_x && border_y)//*/yCtb == 20 && (xCtb >= 20 && xCtb <= 40)) if(/*border_x && border_y)//*/(yCtb >= 10 && yCtb <= 20) && (xCtb >= 20 && xCtb <= 60))
{ {
cur_CU->type = CU_INTRA; cur_CU->type = CU_INTRA;
} }
@ -750,26 +752,54 @@ void encode_coding_tree(encoder_control* encoder,uint16_t xCtb,uint16_t yCtb, ui
else if(cur_CU->type == CU_INTRA) else if(cur_CU->type == CU_INTRA)
{ {
static int predMode = 0; static int predMode = 0;
uint8_t intraPredMode = 10;
uint8_t intraPredModeChroma = 36; //Chroma derived from luma
cabac_encodeBinTrm(&cabac, 0); /* IPCMFlag == 0 */ cabac_encodeBinTrm(&cabac, 0); /* IPCMFlag == 0 */
cabac.ctx = &g_IntraModeSCModel;
CABAC_BIN(&cabac,0,"IntraPred");
/* /*
PREDINFO CODING
If intra prediction mode is found from the predictors,
it can be signaled with two EP's. Otherwise we can send
5 EP bins with the full predmode
Int preds[3] = {-1, -1, -1}; Int preds[3] = {-1, -1, -1};
Int predNum = pcCU->getIntraDirLumaPredictor(absPartIdx+partOffset*j, preds); Int predNum = pcCU->getIntraDirLumaPredictor(absPartIdx+partOffset*j, preds);
*/ */
CABAC_BINS_EP(&cabac, 10, 5, "intraPredMode"); //ToDo: apply predictors
// mpmPred[part] == is_in_predictors(preds);
//For each part {
cabac.ctx = &g_IntraModeSCModel;
CABAC_BIN(&cabac,0/*mpmPred[part]*/,"IntraPred");
//} End for each part
/*Skeleton structure for intrapredmode signaling */
//For each part {
//IF mpmPred[part] { //If found from predictors, we can simplify signaling
// intraPredMode = mpmPred[part];
// CABAC_BIN_EP(&cabac, (intraPredMode==0)?0:1, "intraPredMode");
// if(intraPredMode!=0)
// CABAC_BIN_EP(&cabac, (intraPredMode==1)?0:1, "intraPredMode");
// } else { //Else we signal the full predmode
CABAC_BINS_EP(&cabac, intraPredMode, 5, "intraPredMode");
//predMode++; //predMode++;
//predMode = predMode % 10; //predMode = predMode % 10;
//}
//} End for each part
if(encoder->in.video_format != FORMAT_400) if(encoder->in.video_format != FORMAT_400)
{ {
cabac.ctx = &g_ChromaPredSCModel[0]; cabac.ctx = &g_ChromaPredSCModel[0];
CABAC_BIN(&cabac,1,"IntraPredChroma"); CABAC_BIN(&cabac,((intraPredModeChroma!=36)?1:0),"IntraPredChroma");
if(intraPredModeChroma!=36)
CABAC_BINS_EP(&cabac, 1, 2, "intraPredModeChroma"); {
//ToDo: allowedChromaDir
CABAC_BINS_EP(&cabac, intraPredModeChroma, 2, "intraPredModeChroma");
} }
}
/*
END OF PREDINFO CODING
*/
/* Coeff */ /* Coeff */
/* Transform tree */ /* Transform tree */
@ -784,7 +814,7 @@ void encode_coding_tree(encoder_control* encoder,uint16_t xCtb,uint16_t yCtb, ui
/* /*
Quant and transform here... Quant and transform here...
*/ */
//CbY = 1; /* Let's pretend we have luma coefficients */ CbY = 1; /* Let's pretend we have luma coefficients */
/* Signal if chroma data is present */ /* Signal if chroma data is present */
if(encoder->in.video_format != FORMAT_400) if(encoder->in.video_format != FORMAT_400)
@ -903,6 +933,9 @@ void encode_coding_tree(encoder_control* encoder,uint16_t xCtb,uint16_t yCtb, ui
} }
/* Code last_coeff_x and last_coeff_y */ /* Code last_coeff_x and last_coeff_y */
#ifdef _DEBUG
printf("lastSignificantXY: %i, %i\r\n",last_coeff_x,last_coeff_y);
#endif
encode_lastSignificantXY(encoder,last_coeff_x, last_coeff_y, width, width, type, 0); encode_lastSignificantXY(encoder,last_coeff_x, last_coeff_y, width, width, type, 0);
iScanPosSig = scanPosLast; iScanPosSig = scanPosLast;

View file

@ -416,20 +416,26 @@ void transform2d(int16_t *block,int16_t *coeff, int8_t blockSize, int8_t uiMode)
} }
else*/ else*/
if(blockSize == 8) switch(blockSize)
{
case 8:
{ {
partialButterfly8( block, tmp, shift_1st, blockSize ); partialButterfly8( block, tmp, shift_1st, blockSize );
partialButterfly8( tmp, coeff, shift_2nd, blockSize ); partialButterfly8( tmp, coeff, shift_2nd, blockSize );
break;
} }
else if(blockSize == 16) case 16:
{ {
partialButterfly16( block, tmp, shift_1st, blockSize ); partialButterfly16( block, tmp, shift_1st, blockSize );
partialButterfly16( tmp, coeff, shift_2nd, blockSize ); partialButterfly16( tmp, coeff, shift_2nd, blockSize );
break;
} }
else if(blockSize == 32) case 32:
{ {
partialButterfly32( block, tmp, shift_1st, blockSize ); partialButterfly32( block, tmp, shift_1st, blockSize );
partialButterfly32( tmp, coeff, shift_2nd, blockSize ); partialButterfly32( tmp, coeff, shift_2nd, blockSize );
break;
}
} }
} }