diff options
author | Diego Biurrun <diego@biurrun.de> | 2012-08-26 09:19:33 +0200 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2012-08-26 14:03:55 +0200 |
commit | ef07ac1e126b95ad7e1b56504c19b59901265c3e (patch) | |
tree | 1cd3c01ba9fa9350d10e4f55eeb6664769292bce /libavcodec/cavs.c | |
parent | 09bd0ea94ea432807a0b0ee25c3f7da9e4155bfe (diff) | |
download | ffmpeg-ef07ac1e126b95ad7e1b56504c19b59901265c3e.tar.gz |
cavs: Move data tables used in only one place to that file
Diffstat (limited to 'libavcodec/cavs.c')
-rw-r--r-- | libavcodec/cavs.c | 68 |
1 files changed, 49 insertions, 19 deletions
diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c index 42922e08dd..c3eebfabbb 100644 --- a/libavcodec/cavs.c +++ b/libavcodec/cavs.c @@ -32,6 +32,36 @@ #include "cavs.h" #include "cavsdata.h" +static const uint8_t alpha_tab[64] = { + 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, + 4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 18, 20, + 22, 24, 26, 28, 30, 33, 33, 35, 35, 36, 37, 37, 39, 39, 42, 44, + 46, 48, 50, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64 +}; + +static const uint8_t beta_tab[64] = { + 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, + 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, + 6, 7, 7, 7, 8, 8, 8, 9, 9, 10, 10, 11, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 23, 24, 24, 25, 25, 26, 27 +}; + +static const uint8_t tc_tab[64] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, + 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, + 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9 +}; + +/** mark block as unavailable, i.e. out of picture + or not yet decoded */ +static const cavs_vector un_mv = { 0, 0, 1, NOT_AVAIL }; + +static const int8_t left_modifier_l[8] = { 0, -1, 6, -1, -1, 7, 6, 7 }; +static const int8_t top_modifier_l[8] = { -1, 1, 5, -1, -1, 5, 7, 7 }; +static const int8_t left_modifier_c[7] = { 5, -1, 2, -1, 6, 5, 6 }; +static const int8_t top_modifier_c[7] = { 4, 1, -1, -1, 4, 6, 6 }; + /***************************************************************************** * * in-loop deblocking filter @@ -307,14 +337,14 @@ void ff_cavs_modify_mb_i(AVSContext *h, int *pred_mode_uv) { /* modify pred modes according to availability of neighbour samples */ if(!(h->flags & A_AVAIL)) { - modify_pred(ff_left_modifier_l, &h->pred_mode_Y[4] ); - modify_pred(ff_left_modifier_l, &h->pred_mode_Y[7] ); - modify_pred(ff_left_modifier_c, pred_mode_uv ); + modify_pred(left_modifier_l, &h->pred_mode_Y[4]); + modify_pred(left_modifier_l, &h->pred_mode_Y[7]); + modify_pred(left_modifier_c, pred_mode_uv); } if(!(h->flags & B_AVAIL)) { - modify_pred(ff_top_modifier_l, &h->pred_mode_Y[4] ); - modify_pred(ff_top_modifier_l, &h->pred_mode_Y[5] ); - modify_pred(ff_top_modifier_c, pred_mode_uv ); + modify_pred(top_modifier_l, &h->pred_mode_Y[4]); + modify_pred(top_modifier_l, &h->pred_mode_Y[5]); + modify_pred(top_modifier_c, pred_mode_uv); } } @@ -496,7 +526,7 @@ void ff_cavs_mv(AVSContext *h, enum cavs_mv_loc nP, enum cavs_mv_loc nC, ((mvA->ref == NOT_AVAIL) || (mvB->ref == NOT_AVAIL) || ((mvA->x | mvA->y | mvA->ref) == 0) || ((mvB->x | mvB->y | mvB->ref) == 0) )) { - mvP2 = &ff_cavs_un_mv; + mvP2 = &un_mv; /* if there is only one suitable candidate, take it */ } else if((mvA->ref >= 0) && (mvB->ref < 0) && (mvC->ref < 0)) { mvP2= mvA; @@ -545,10 +575,10 @@ void ff_cavs_init_mb(AVSContext *h) { h->pred_mode_Y[2] = h->top_pred_Y[h->mbx*2+1]; /* clear top predictors if MB B is not available */ if(!(h->flags & B_AVAIL)) { - h->mv[MV_FWD_B2] = ff_cavs_un_mv; - h->mv[MV_FWD_B3] = ff_cavs_un_mv; - h->mv[MV_BWD_B2] = ff_cavs_un_mv; - h->mv[MV_BWD_B3] = ff_cavs_un_mv; + h->mv[MV_FWD_B2] = un_mv; + h->mv[MV_FWD_B3] = un_mv; + h->mv[MV_BWD_B2] = un_mv; + h->mv[MV_BWD_B3] = un_mv; h->pred_mode_Y[1] = h->pred_mode_Y[2] = NOT_AVAIL; h->flags &= ~(C_AVAIL|D_AVAIL); } else if(h->mbx) { @@ -558,13 +588,13 @@ void ff_cavs_init_mb(AVSContext *h) { h->flags &= ~C_AVAIL; /* clear top-right predictors if MB C is not available */ if(!(h->flags & C_AVAIL)) { - h->mv[MV_FWD_C2] = ff_cavs_un_mv; - h->mv[MV_BWD_C2] = ff_cavs_un_mv; + h->mv[MV_FWD_C2] = un_mv; + h->mv[MV_BWD_C2] = un_mv; } /* clear top-left predictors if MB D is not available */ if(!(h->flags & D_AVAIL)) { - h->mv[MV_FWD_D3] = ff_cavs_un_mv; - h->mv[MV_BWD_D3] = ff_cavs_un_mv; + h->mv[MV_FWD_D3] = un_mv; + h->mv[MV_BWD_D3] = un_mv; } } @@ -597,7 +627,7 @@ int ff_cavs_next_mb(AVSContext *h) { h->pred_mode_Y[3] = h->pred_mode_Y[6] = NOT_AVAIL; /* clear left mv predictors */ for(i=0;i<=20;i+=4) - h->mv[i] = ff_cavs_un_mv; + h->mv[i] = un_mv; h->mbx = 0; h->mby++; /* re-calculate sample pointers */ @@ -622,7 +652,7 @@ void ff_cavs_init_pic(AVSContext *h) { /* clear some predictors */ for(i=0;i<=20;i+=4) - h->mv[i] = ff_cavs_un_mv; + h->mv[i] = un_mv; h->mv[MV_BWD_X0] = ff_cavs_dir_mv; set_mvs(&h->mv[MV_BWD_X0], BLK_16X16); h->mv[MV_FWD_X0] = ff_cavs_dir_mv; @@ -693,8 +723,8 @@ av_cold int ff_cavs_init(AVCodecContext *avctx) { h->intra_pred_c[ INTRA_C_LP_LEFT] = intra_pred_lp_left; h->intra_pred_c[ INTRA_C_LP_TOP] = intra_pred_lp_top; h->intra_pred_c[ INTRA_C_DC_128] = intra_pred_dc_128; - h->mv[ 7] = ff_cavs_un_mv; - h->mv[19] = ff_cavs_un_mv; + h->mv[ 7] = un_mv; + h->mv[19] = un_mv; return 0; } |