mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-12-03 13:44:05 +00:00
Refactoring: intra.h renaming.
This commit is contained in:
parent
bdab04976d
commit
de447ee18b
|
@ -1155,10 +1155,10 @@ void encode_coding_tree(encoder_control* encoder,uint16_t xCtb,uint16_t yCtb, ui
|
|||
|
||||
int16_t rec[(LCU_WIDTH*2+8)*(LCU_WIDTH*2+8)];
|
||||
int16_t *recShift = &rec[(LCU_WIDTH>>(depth))*2+8+1];
|
||||
intra_buildReferenceBorder(encoder->in.cur_pic, xCtb, yCtb,(LCU_WIDTH>>(depth))*2+8, rec, (LCU_WIDTH>>(depth))*2+8, 0);
|
||||
intra_build_reference_border(encoder->in.cur_pic, xCtb, yCtb,(LCU_WIDTH>>(depth))*2+8, rec, (LCU_WIDTH>>(depth))*2+8, 0);
|
||||
cur_CU->intra.mode = (int8_t)intra_prediction(encoder->in.cur_pic->y_data,encoder->in.width,recShift,(LCU_WIDTH>>(depth))*2+8,xCtb*(LCU_WIDTH>>(MAX_DEPTH)),yCtb*(LCU_WIDTH>>(MAX_DEPTH)),width,pred,width,&cur_CU->intra.cost);
|
||||
intraPredMode = cur_CU->intra.mode;
|
||||
intra_setBlockMode(encoder->in.cur_pic,xCtb, yCtb, depth, intraPredMode);
|
||||
intra_set_block_mode(encoder->in.cur_pic,xCtb, yCtb, depth, intraPredMode);
|
||||
|
||||
#if ENABLE_PCM == 1
|
||||
/* Code must start after variable initialization */
|
||||
|
@ -1173,7 +1173,7 @@ void encode_coding_tree(encoder_control* encoder,uint16_t xCtb,uint16_t yCtb, ui
|
|||
5 EP bins with the full predmode
|
||||
TODO: split to a function
|
||||
*/
|
||||
intra_getDirLumaPredictor(encoder->in.cur_pic, xCtb, yCtb, depth, intraPreds);
|
||||
intra_get_dir_luma_predictor(encoder->in.cur_pic, xCtb, yCtb, depth, intraPreds);
|
||||
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
|
@ -1440,21 +1440,21 @@ void encode_transform_tree(encoder_control* encoder,transform_info* ti,uint8_t d
|
|||
uint32_t ac_sum = 0;
|
||||
|
||||
/* Build reconstructed block to use in prediction with extrapolated borders */
|
||||
intra_buildReferenceBorder(encoder->in.cur_pic, ti->x_ctb, ti->y_ctb,(LCU_WIDTH>>(depth))*2+8, rec, (LCU_WIDTH>>(depth))*2+8, 0);
|
||||
intra_build_reference_border(encoder->in.cur_pic, ti->x_ctb, ti->y_ctb,(LCU_WIDTH>>(depth))*2+8, rec, (LCU_WIDTH>>(depth))*2+8, 0);
|
||||
intra_recon(recShift,(LCU_WIDTH>>(depth))*2+8,ti->x_ctb*(LCU_WIDTH>>(MAX_DEPTH)),ti->y_ctb*(LCU_WIDTH>>(MAX_DEPTH)),width,pred,pred_stride,ti->intra_pred_mode,0);
|
||||
|
||||
/* Filter DC-prediction */
|
||||
if(ti->intra_pred_mode == 1 && width < 32)
|
||||
{
|
||||
intra_DCPredFiltering(recShift,(LCU_WIDTH>>(depth))*2+8,pred,width,LCU_WIDTH>>depth,LCU_WIDTH>>depth);
|
||||
intra_dc_pred_filtering(recShift,(LCU_WIDTH>>(depth))*2+8,pred,width,LCU_WIDTH>>depth,LCU_WIDTH>>depth);
|
||||
}
|
||||
if(ti->intra_pred_mode_chroma != 36 && ti->intra_pred_mode_chroma == ti->intra_pred_mode)
|
||||
{
|
||||
ti->intra_pred_mode_chroma = 36;
|
||||
}
|
||||
intra_buildReferenceBorder(encoder->in.cur_pic, ti->x_ctb, ti->y_ctb,(LCU_WIDTH>>(depth+1))*2+8, rec, (LCU_WIDTH>>(depth+1))*2+8, 1);
|
||||
intra_build_reference_border(encoder->in.cur_pic, ti->x_ctb, ti->y_ctb,(LCU_WIDTH>>(depth+1))*2+8, rec, (LCU_WIDTH>>(depth+1))*2+8, 1);
|
||||
intra_recon(recShiftU,(LCU_WIDTH>>(depth+1))*2+8,ti->x_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)),ti->y_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)),width>>1,predU,pred_stride>>1,ti->intra_pred_mode_chroma!=36?ti->intra_pred_mode_chroma:ti->intra_pred_mode,1);
|
||||
intra_buildReferenceBorder(encoder->in.cur_pic, ti->x_ctb, ti->y_ctb,(LCU_WIDTH>>(depth+1))*2+8, rec, (LCU_WIDTH>>(depth+1))*2+8, 2);
|
||||
intra_build_reference_border(encoder->in.cur_pic, ti->x_ctb, ti->y_ctb,(LCU_WIDTH>>(depth+1))*2+8, rec, (LCU_WIDTH>>(depth+1))*2+8, 2);
|
||||
intra_recon(recShiftU,(LCU_WIDTH>>(depth+1))*2+8,ti->x_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)),ti->y_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)),width>>1,predV,pred_stride>>1,ti->intra_pred_mode_chroma!=36?ti->intra_pred_mode_chroma:ti->intra_pred_mode,1);
|
||||
|
||||
/* This affects reconstruction, do after that */
|
||||
|
|
30
src/intra.c
30
src/intra.c
|
@ -33,7 +33,7 @@ const uint8_t intraHorVerDistThres[5] = {0,7,1,0,0};
|
|||
\param mode mode to set
|
||||
\returns Void
|
||||
*/
|
||||
void intra_setBlockMode(picture* pic,uint32_t xCtb, uint32_t yCtb, uint8_t depth, uint8_t mode)
|
||||
void intra_set_block_mode(picture* pic,uint32_t xCtb, uint32_t yCtb, uint8_t depth, uint8_t mode)
|
||||
{
|
||||
uint32_t x,y,d;
|
||||
/* Width in smallest CU */
|
||||
|
@ -62,7 +62,7 @@ void intra_setBlockMode(picture* pic,uint32_t xCtb, uint32_t yCtb, uint8_t depth
|
|||
\param depth current CU depth
|
||||
\returns mode if it's present, otherwise -1
|
||||
*/
|
||||
int8_t intra_getBlockMode(picture* pic,uint32_t xCtb, uint32_t yCtb, uint8_t depth)
|
||||
int8_t intra_get_block_mode(picture* pic,uint32_t xCtb, uint32_t yCtb, uint8_t depth)
|
||||
{
|
||||
//Width in smallest CU
|
||||
int width_in_SCU = pic->width_in_lcu<<MAX_DEPTH;
|
||||
|
@ -82,7 +82,7 @@ int8_t intra_getBlockMode(picture* pic,uint32_t xCtb, uint32_t yCtb, uint8_t dep
|
|||
\param width block width
|
||||
\returns DC prediction
|
||||
*/
|
||||
int16_t intra_getDCPred(int16_t* pic, uint16_t picwidth,uint32_t xpos, uint32_t ypos, uint8_t width)
|
||||
int16_t intra_get_dc_pred(int16_t* pic, uint16_t picwidth,uint32_t xpos, uint32_t ypos, uint8_t width)
|
||||
{
|
||||
int32_t i, iSum = 0;
|
||||
int16_t pDcVal = 1<<(g_bitdepth-1);
|
||||
|
@ -111,7 +111,7 @@ int16_t intra_getDCPred(int16_t* pic, uint16_t picwidth,uint32_t xpos, uint32_t
|
|||
\param preds output buffer for 3 predictions
|
||||
\returns (predictions are found)?1:0
|
||||
*/
|
||||
int8_t intra_getDirLumaPredictor(picture* pic,uint32_t xCtb, uint32_t yCtb, uint8_t depth, int8_t* preds)
|
||||
int8_t intra_get_dir_luma_predictor(picture* pic,uint32_t xCtb, uint32_t yCtb, uint8_t depth, int8_t* preds)
|
||||
{
|
||||
int32_t iLeftIntraDir = 1; //DC_IDX
|
||||
int32_t iAboveIntraDir = 1; //DC_IDX
|
||||
|
@ -285,7 +285,7 @@ int16_t intra_prediction(uint8_t* orig,int32_t origstride,int16_t* rec,int32_t r
|
|||
|
||||
|
||||
/* Test DC */
|
||||
x = intra_getDCPred(rec, recstride, xpos, ypos, width);
|
||||
x = intra_get_dc_pred(rec, recstride, xpos, ypos, width);
|
||||
for(i = 0; i < (int32_t)(width*width); i++)
|
||||
{
|
||||
pred[i] = x;
|
||||
|
@ -298,7 +298,7 @@ int16_t intra_prediction(uint8_t* orig,int32_t origstride,int16_t* rec,int32_t r
|
|||
int distance = MIN(abs(i-26),abs(i-10));
|
||||
if(distance <= threshold)
|
||||
{
|
||||
intra_getAngularPred(rec,recstride,pred, width,width,width,i, xpos?1:0, ypos?1:0, filter);
|
||||
intra_get_angular_pred(rec,recstride,pred, width,width,width,i, xpos?1:0, ypos?1:0, filter);
|
||||
CHECK_FOR_BEST(i,0);
|
||||
}
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ int16_t intra_prediction(uint8_t* orig,int32_t origstride,int16_t* rec,int32_t r
|
|||
/**** FROM THIS POINT FORWARD, USING FILTERED PREDICTION *****/
|
||||
|
||||
/* Test planar */
|
||||
intra_getPlanarPred(recFiltered, recstride, xpos, ypos, width, pred, width);
|
||||
intra_get_planar_pred(recFiltered, recstride, xpos, ypos, width, pred, width);
|
||||
CHECK_FOR_BEST(0,0);
|
||||
|
||||
/* Test directional predictions */
|
||||
|
@ -320,7 +320,7 @@ int16_t intra_prediction(uint8_t* orig,int32_t origstride,int16_t* rec,int32_t r
|
|||
int distance = MIN(abs(i-26),abs(i-10));
|
||||
if(distance > threshold)
|
||||
{
|
||||
intra_getAngularPred(recFiltered,recstride,pred, width,width,width,i, xpos?1:0, ypos?1:0, filter);
|
||||
intra_get_angular_pred(recFiltered,recstride,pred, width,width,width,i, xpos?1:0, ypos?1:0, filter);
|
||||
CHECK_FOR_BEST(i,0);
|
||||
}
|
||||
}
|
||||
|
@ -355,12 +355,12 @@ void intra_recon(int16_t* rec,uint32_t recstride, uint32_t xpos, uint32_t ypos,u
|
|||
/* planar */
|
||||
if(mode == 0)
|
||||
{
|
||||
intra_getPlanarPred(rec, recstride, xpos, ypos, width, pred, width);
|
||||
intra_get_planar_pred(rec, recstride, xpos, ypos, width, pred, width);
|
||||
}
|
||||
/* DC */
|
||||
else if(mode == 1)
|
||||
{
|
||||
i = intra_getDCPred(rec, recstride, xpos, ypos, width);
|
||||
i = intra_get_dc_pred(rec, recstride, xpos, ypos, width);
|
||||
for(y = 0; y < (int32_t)width; y++)
|
||||
{
|
||||
for(x = 0; x < (int32_t)width; x++)
|
||||
|
@ -373,7 +373,7 @@ void intra_recon(int16_t* rec,uint32_t recstride, uint32_t xpos, uint32_t ypos,u
|
|||
/* directional predictions */
|
||||
else
|
||||
{
|
||||
intra_getAngularPred(rec, recstride,pred, width,width,width,mode, xpos?1:0, ypos?1:0, filter);
|
||||
intra_get_angular_pred(rec, recstride,pred, width,width,width,mode, xpos?1:0, ypos?1:0, filter);
|
||||
}
|
||||
|
||||
COPY_PRED_TO_DST();
|
||||
|
@ -389,7 +389,7 @@ void intra_recon(int16_t* rec,uint32_t recstride, uint32_t xpos, uint32_t ypos,u
|
|||
|
||||
|
||||
*/
|
||||
void intra_buildReferenceBorder(picture* pic, int32_t xCtb, int32_t yCtb,int16_t outwidth, int16_t* dst, int32_t dststride, int8_t chroma)
|
||||
void intra_build_reference_border(picture* pic, int32_t xCtb, int32_t yCtb,int16_t outwidth, int16_t* dst, int32_t dststride, int8_t chroma)
|
||||
{
|
||||
int32_t leftColumn; /*!< left column iterator */
|
||||
int16_t val; /*!< variable to store extrapolated value */
|
||||
|
@ -497,7 +497,7 @@ void intra_buildReferenceBorder(picture* pic, int32_t xCtb, int32_t yCtb,int16_t
|
|||
const int32_t angTable[9] = {0, 2, 5, 9, 13, 17, 21, 26, 32};
|
||||
const int32_t invAngTable[9] = {0, 4096, 1638, 910, 630, 482, 390, 315, 256}; // (256 * 32) / Angle
|
||||
|
||||
void intra_getAngularPred(int16_t* pSrc, int32_t srcStride, int16_t* rpDst, int32_t dstStride, int32_t width, int32_t height, int32_t dirMode, int8_t leftAvail,int8_t topAvail, int8_t filter)
|
||||
void intra_get_angular_pred(int16_t* pSrc, int32_t srcStride, int16_t* rpDst, int32_t dstStride, int32_t width, int32_t height, int32_t dirMode, int8_t leftAvail,int8_t topAvail, int8_t filter)
|
||||
{
|
||||
int32_t k,l;
|
||||
int32_t blkSize = width;
|
||||
|
@ -639,7 +639,7 @@ void intra_getAngularPred(int16_t* pSrc, int32_t srcStride, int16_t* rpDst, int3
|
|||
|
||||
|
||||
|
||||
void intra_DCPredFiltering(int16_t* pSrc, int32_t iSrcStride, int16_t* rpDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight )
|
||||
void intra_dc_pred_filtering(int16_t* pSrc, int32_t iSrcStride, int16_t* rpDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight )
|
||||
{
|
||||
int16_t* pDst = rpDst;
|
||||
int32_t x, y, iDstStride2, iSrcStride2;
|
||||
|
@ -670,7 +670,7 @@ void intra_DCPredFiltering(int16_t* pSrc, int32_t iSrcStride, int16_t* rpDst, in
|
|||
|
||||
This function derives the prediction samples for planar mode (intra coding).
|
||||
*/
|
||||
void intra_getPlanarPred(int16_t* src,int32_t srcstride, uint32_t xpos, uint32_t ypos,uint32_t width, int16_t* dst,int32_t dststride)
|
||||
void intra_get_planar_pred(int16_t* src,int32_t srcstride, uint32_t xpos, uint32_t ypos,uint32_t width, int16_t* dst,int32_t dststride)
|
||||
{
|
||||
int16_t pDcVal = 1<<(g_bitdepth-1);
|
||||
int32_t k, l, bottomLeft, topRight;
|
||||
|
|
22
src/intra.h
22
src/intra.h
|
@ -18,23 +18,23 @@
|
|||
#include "picture.h"
|
||||
|
||||
|
||||
void intra_setBlockMode(picture* pic,uint32_t xCtb, uint32_t yCtb, uint8_t depth, uint8_t mode);
|
||||
int8_t intra_getBlockMode(picture* pic,uint32_t xCtb, uint32_t yCtb, uint8_t depth);
|
||||
void intra_set_block_mode(picture* pic,uint32_t x_ctb, uint32_t y_ctb, uint8_t depth, uint8_t mode);
|
||||
int8_t intra_get_block_mode(picture* pic, uint32_t x_ctb, uint32_t y_ctb, uint8_t depth);
|
||||
|
||||
int8_t intra_getDirLumaPredictor(picture* pic,uint32_t xCtb, uint32_t yCtb, uint8_t depth, int8_t* preds);
|
||||
void intra_DCPredFiltering(int16_t* pSrc, int32_t iSrcStride, int16_t* rpDst, int32_t iDstStride, int32_t iWidth, int32_t iHeight );
|
||||
int8_t intra_get_dir_luma_predictor(picture* pic,uint32_t x_ctb, uint32_t y_ctb, uint8_t depth, int8_t* preds);
|
||||
void intra_dc_pred_filtering(int16_t* src, int32_t src_stride, int16_t* dst, int32_t dst_stride, int32_t width, int32_t height );
|
||||
|
||||
void intra_buildReferenceBorder(picture* pic, int32_t xCtb, int32_t yCtb,int16_t outwidth, int16_t* dst, int32_t dststride, int8_t chroma);
|
||||
void intra_filter(int16_t* ref, int32_t stride,int32_t width, int8_t mode);
|
||||
void intra_build_reference_border(picture* pic, int32_t x_ctb, int32_t y_ctb, int16_t out_width, int16_t* dst, int32_t dst_stride, int8_t chroma);
|
||||
void intra_filter(int16_t* ref, int32_t stride, int32_t width, int8_t mode);
|
||||
|
||||
/* Predictions */
|
||||
int16_t intra_prediction(uint8_t* orig,int32_t origstride,int16_t* rec,int32_t recstride, uint32_t xpos, uint32_t ypos,uint32_t width, int16_t* dst,int32_t dststride, uint32_t *sad);
|
||||
int16_t intra_prediction(uint8_t* orig, int32_t orig_stride, int16_t* rec, int32_t rec_stride, uint32_t x_pos, uint32_t ypos, uint32_t width, int16_t* dst, int32_t dst_stride, uint32_t *sad);
|
||||
|
||||
int16_t intra_getDCPred(int16_t* pic, uint16_t picwidth,uint32_t xpos, uint32_t ypos, uint8_t width);
|
||||
void intra_getPlanarPred(int16_t* src,int32_t srcstride, uint32_t xpos, uint32_t ypos,uint32_t width, int16_t* dst,int32_t dststride);
|
||||
void intra_getAngularPred(int16_t* pSrc, int32_t srcStride, int16_t* rpDst, int32_t dstStride, int32_t width, int32_t height, int32_t dirMode, int8_t leftAvail,int8_t topAvail, int8_t filter);
|
||||
int16_t intra_get_dc_pred(int16_t* pic, uint16_t pic_width, uint32_t x_pos, uint32_t y_pos, uint8_t width);
|
||||
void intra_get_planar_pred(int16_t* src,int32_t srcstride, uint32_t xpos, uint32_t ypos,uint32_t width, int16_t* dst,int32_t dststride);
|
||||
void intra_get_angular_pred(int16_t* src, int32_t src_stride, int16_t* p_dst, int32_t dst_stride, int32_t width, int32_t height, int32_t dir_mode, int8_t left_avail,int8_t top_avail, int8_t filter);
|
||||
|
||||
void intra_recon(int16_t* rec,uint32_t recstride, uint32_t xpos, uint32_t ypos,uint32_t width, int16_t* dst,int32_t dststride, int8_t mode, int8_t chroma);
|
||||
void intra_recon(int16_t* rec, uint32_t rec_stride, uint32_t x_pos, uint32_t y_pos, uint32_t width, int16_t* dst, int32_t dst_stride, int8_t mode, int8_t chroma);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -294,7 +294,7 @@ uint32_t search_best_mode(encoder_control* encoder,uint16_t xCtb,uint16_t yCtb,
|
|||
{
|
||||
/* Set split to 0 and mode to intra.mode */
|
||||
picture_setBlockSplit(encoder->in.cur_pic,xCtb,yCtb,depth,0);
|
||||
intra_setBlockMode(encoder->in.cur_pic,xCtb,yCtb,depth,cur_CU->intra.mode);
|
||||
intra_set_block_mode(encoder->in.cur_pic,xCtb,yCtb,depth,cur_CU->intra.mode);
|
||||
bestCost = bestIntraCost;
|
||||
}
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ uint32_t search_best_mode(encoder_control* encoder,uint16_t xCtb,uint16_t yCtb,
|
|||
{
|
||||
/* Set split to 0 and mode to intra.mode */
|
||||
picture_setBlockSplit(encoder->in.cur_pic,xCtb,yCtb,depth,0);
|
||||
intra_setBlockMode(encoder->in.cur_pic,xCtb,yCtb,depth,cur_CU->intra.mode);
|
||||
intra_set_block_mode(encoder->in.cur_pic,xCtb,yCtb,depth,cur_CU->intra.mode);
|
||||
bestCost = bestIntraCost;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue