prepare splitting decoder-only parts into own file:

make commonly used tables global

Originally committed as revision 9532 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Stefan Gehrer 18 years ago
parent c21f308e77
commit 1503063f83
  1. 28
      libavcodec/cavs.c
  2. 9
      libavcodec/cavs.h
  3. 16
      libavcodec/cavsdata.h

@ -95,11 +95,11 @@ void ff_cavs_filter(AVSContext *h, enum mb_t mb_type) {
*((uint64_t *)bs) = 0x0202020202020202ULL; *((uint64_t *)bs) = 0x0202020202020202ULL;
else{ else{
*((uint64_t *)bs) = 0; *((uint64_t *)bs) = 0;
if(partition_flags[mb_type] & SPLITV){ if(ff_cavs_partition_flags[mb_type] & SPLITV){
bs[2] = get_bs(&h->mv[MV_FWD_X0], &h->mv[MV_FWD_X1], mb_type > P_8X8); bs[2] = get_bs(&h->mv[MV_FWD_X0], &h->mv[MV_FWD_X1], mb_type > P_8X8);
bs[3] = get_bs(&h->mv[MV_FWD_X2], &h->mv[MV_FWD_X3], mb_type > P_8X8); bs[3] = get_bs(&h->mv[MV_FWD_X2], &h->mv[MV_FWD_X3], mb_type > P_8X8);
} }
if(partition_flags[mb_type] & SPLITH){ if(ff_cavs_partition_flags[mb_type] & SPLITH){
bs[6] = get_bs(&h->mv[MV_FWD_X0], &h->mv[MV_FWD_X2], mb_type > P_8X8); bs[6] = get_bs(&h->mv[MV_FWD_X0], &h->mv[MV_FWD_X2], mb_type > P_8X8);
bs[7] = get_bs(&h->mv[MV_FWD_X1], &h->mv[MV_FWD_X3], mb_type > P_8X8); bs[7] = get_bs(&h->mv[MV_FWD_X1], &h->mv[MV_FWD_X3], mb_type > P_8X8);
} }
@ -324,7 +324,7 @@ static inline void mc_part_std(AVSContext *h,int square,int chroma_height,int de
} }
void ff_cavs_inter(AVSContext *h, enum mb_t mb_type) { void ff_cavs_inter(AVSContext *h, enum mb_t mb_type) {
if(partition_flags[mb_type] == 0){ // 16x16 if(ff_cavs_partition_flags[mb_type] == 0){ // 16x16
mc_part_std(h, 1, 8, 0, h->cy, h->cu, h->cv, 0, 0, mc_part_std(h, 1, 8, 0, h->cy, h->cu, h->cv, 0, 0,
h->s.dsp.put_cavs_qpel_pixels_tab[0], h->s.dsp.put_cavs_qpel_pixels_tab[0],
h->s.dsp.put_h264_chroma_pixels_tab[0], h->s.dsp.put_h264_chroma_pixels_tab[0],
@ -524,8 +524,8 @@ static int decode_residual_block(AVSContext *h, GetBitContext *gb,
level_buf[i] = level; level_buf[i] = level;
run_buf[i] = run; run_buf[i] = run;
} }
if(dequant(h,level_buf, run_buf, block, dequant_mul[qp], if(dequant(h,level_buf, run_buf, block, ff_cavs_dequant_mul[qp],
dequant_shift[qp], i)) ff_cavs_dequant_shift[qp], i))
return -1; return -1;
h->s.dsp.cavs_idct8_add(dst,block,stride); h->s.dsp.cavs_idct8_add(dst,block,stride);
return 0; return 0;
@ -534,11 +534,11 @@ static int decode_residual_block(AVSContext *h, GetBitContext *gb,
static inline void decode_residual_chroma(AVSContext *h) { static inline void decode_residual_chroma(AVSContext *h) {
if(h->cbp & (1<<4)) if(h->cbp & (1<<4))
decode_residual_block(h,&h->s.gb,chroma_dec,0, chroma_qp[h->qp], decode_residual_block(h,&h->s.gb,ff_cavs_chroma_dec,0,
h->cu,h->c_stride); ff_cavs_chroma_qp[h->qp],h->cu,h->c_stride);
if(h->cbp & (1<<5)) if(h->cbp & (1<<5))
decode_residual_block(h,&h->s.gb,chroma_dec,0, chroma_qp[h->qp], decode_residual_block(h,&h->s.gb,ff_cavs_chroma_dec,0,
h->cv,h->c_stride); ff_cavs_chroma_qp[h->qp],h->cv,h->c_stride);
} }
static inline int decode_residual_inter(AVSContext *h) { static inline int decode_residual_inter(AVSContext *h) {
@ -557,7 +557,7 @@ static inline int decode_residual_inter(AVSContext *h) {
h->qp = (h->qp + get_se_golomb(&h->s.gb)) & 63; h->qp = (h->qp + get_se_golomb(&h->s.gb)) & 63;
for(block=0;block<4;block++) for(block=0;block<4;block++)
if(h->cbp & (1<<block)) if(h->cbp & (1<<block))
decode_residual_block(h,&h->s.gb,inter_dec,0,h->qp, decode_residual_block(h,&h->s.gb,ff_cavs_inter_dec,0,h->qp,
h->cy + h->luma_scan[block], h->l_stride); h->cy + h->luma_scan[block], h->l_stride);
decode_residual_chroma(h); decode_residual_chroma(h);
@ -582,7 +582,7 @@ static int decode_mb_i(AVSContext *h, int cbp_code) {
/* get intra prediction modes from stream */ /* get intra prediction modes from stream */
for(block=0;block<4;block++) { for(block=0;block<4;block++) {
int nA,nB,predpred; int nA,nB,predpred;
int pos = scan3x3[block]; int pos = ff_cavs_scan3x3[block];
nA = h->pred_mode_Y[pos-1]; nA = h->pred_mode_Y[pos-1];
nB = h->pred_mode_Y[pos-3]; nB = h->pred_mode_Y[pos-3];
@ -617,10 +617,10 @@ static int decode_mb_i(AVSContext *h, int cbp_code) {
for(block=0;block<4;block++) { for(block=0;block<4;block++) {
d = h->cy + h->luma_scan[block]; d = h->cy + h->luma_scan[block];
load_intra_pred_luma(h, top, &left, block); load_intra_pred_luma(h, top, &left, block);
h->intra_pred_l[h->pred_mode_Y[scan3x3[block]]] h->intra_pred_l[h->pred_mode_Y[ff_cavs_scan3x3[block]]]
(d, top, left, h->l_stride); (d, top, left, h->l_stride);
if(h->cbp & (1<<block)) if(h->cbp & (1<<block))
decode_residual_block(h,gb,intra_dec,1,h->qp,d,h->l_stride); decode_residual_block(h,gb,ff_cavs_intra_dec,1,h->qp,d,h->l_stride);
} }
/* chroma intra prediction */ /* chroma intra prediction */
@ -752,7 +752,7 @@ static void decode_mb_b(AVSContext *h, enum mb_t mb_type) {
break; break;
default: default:
assert((mb_type > B_SYM_16X16) && (mb_type < B_8X8)); assert((mb_type > B_SYM_16X16) && (mb_type < B_8X8));
flags = partition_flags[mb_type]; flags = ff_cavs_partition_flags[mb_type];
if(mb_type & 1) { /* 16x8 macroblock types */ if(mb_type & 1) { /* 16x8 macroblock types */
if(flags & FWD0) if(flags & FWD0)
ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_TOP, BLK_16X8, 1); ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_TOP, BLK_16X8, 1);

@ -224,12 +224,21 @@ typedef struct {
DCTELEM *block; DCTELEM *block;
} AVSContext; } AVSContext;
extern const uint8_t ff_cavs_dequant_shift[64];
extern const uint16_t ff_cavs_dequant_mul[64];
extern const dec_2dvlc_t ff_cavs_intra_dec[7];
extern const dec_2dvlc_t ff_cavs_inter_dec[7];
extern const dec_2dvlc_t ff_cavs_chroma_dec[5];
extern const uint8_t ff_cavs_chroma_qp[64];
extern const uint8_t ff_cavs_scan3x3[4];
extern const uint8_t ff_cavs_partition_flags[30];
extern const int_fast8_t ff_left_modifier_l[8]; extern const int_fast8_t ff_left_modifier_l[8];
extern const int_fast8_t ff_top_modifier_l[8]; extern const int_fast8_t ff_top_modifier_l[8];
extern const int_fast8_t ff_left_modifier_c[7]; extern const int_fast8_t ff_left_modifier_c[7];
extern const int_fast8_t ff_top_modifier_c[7]; extern const int_fast8_t ff_top_modifier_c[7];
extern const vector_t ff_cavs_intra_mv; extern const vector_t ff_cavs_intra_mv;
extern const vector_t ff_cavs_un_mv; extern const vector_t ff_cavs_un_mv;
extern const vector_t ff_cavs_dir_mv;
static inline void load_intra_pred_luma(AVSContext *h, uint8_t *top, static inline void load_intra_pred_luma(AVSContext *h, uint8_t *top,
uint8_t **left, int block) { uint8_t **left, int block) {

@ -24,7 +24,7 @@
#include "cavs.h" #include "cavs.h"
static const uint8_t partition_flags[30] = { const uint8_t ff_cavs_partition_flags[30] = {
0, //I_8X8 0, //I_8X8
0, //P_SKIP 0, //P_SKIP
0, //P_16X16 0, //P_16X16
@ -57,7 +57,7 @@ static const uint8_t partition_flags[30] = {
SPLITH|SPLITV, //B_8X8 = 29 SPLITH|SPLITV, //B_8X8 = 29
}; };
static const uint8_t scan3x3[4] = {4,5,7,8}; const uint8_t ff_cavs_scan3x3[4] = {4,5,7,8};
static const uint8_t mv_scan[4] = { static const uint8_t mv_scan[4] = {
MV_FWD_X0,MV_FWD_X1, MV_FWD_X0,MV_FWD_X1,
@ -75,14 +75,14 @@ static const uint8_t cbp_tab[64][2] = {
{34,50},{50,56},{52,25},{54,22},{41,54},{56,57},{38,41},{57,38} {34,50},{50,56},{52,25},{54,22},{41,54},{56,57},{38,41},{57,38}
}; };
static const uint8_t chroma_qp[64] = { const uint8_t ff_cavs_chroma_qp[64] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,
16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
32,33,34,35,36,37,38,39,40,41,42,42,43,43,44,44, 32,33,34,35,36,37,38,39,40,41,42,42,43,43,44,44,
45,45,46,46,47,47,48,48,48,49,49,49,50,50,50,51 45,45,46,46,47,47,48,48,48,49,49,49,50,50,50,51
}; };
static const uint8_t dequant_shift[64] = { const uint8_t ff_cavs_dequant_shift[64] = {
14,14,14,14,14,14,14,14, 14,14,14,14,14,14,14,14,
13,13,13,13,13,13,13,13, 13,13,13,13,13,13,13,13,
13,12,12,12,12,12,12,12, 13,12,12,12,12,12,12,12,
@ -93,7 +93,7 @@ static const uint8_t dequant_shift[64] = {
7, 7, 7, 7, 7, 7, 7, 7 7, 7, 7, 7, 7, 7, 7, 7
}; };
static const uint16_t dequant_mul[64] = { const uint16_t ff_cavs_dequant_mul[64] = {
32768,36061,38968,42495,46341,50535,55437,60424, 32768,36061,38968,42495,46341,50535,55437,60424,
32932,35734,38968,42495,46177,50535,55109,59933, 32932,35734,38968,42495,46177,50535,55109,59933,
65535,35734,38968,42577,46341,50617,55027,60097, 65535,35734,38968,42577,46341,50617,55027,60097,
@ -117,7 +117,7 @@ const vector_t ff_cavs_intra_mv = {0,0,1,REF_INTRA};
#define EOB 0,0,0 #define EOB 0,0,0
static const dec_2dvlc_t intra_dec[7] = { const dec_2dvlc_t ff_cavs_intra_dec[7] = {
{ {
{ //level / run / table_inc { //level / run / table_inc
{ 1, 1, 1},{ -1, 1, 1},{ 1, 2, 1},{ -1, 2, 1},{ 1, 3, 1},{ -1, 3, 1}, { 1, 1, 1},{ -1, 1, 1},{ 1, 2, 1},{ -1, 2, 1},{ 1, 3, 1},{ -1, 3, 1},
@ -254,7 +254,7 @@ static const dec_2dvlc_t intra_dec[7] = {
} }
}; };
static const dec_2dvlc_t inter_dec[7] = { const dec_2dvlc_t ff_cavs_inter_dec[7] = {
{ {
{ //level / run { //level / run
{ 1, 1, 1},{ -1, 1, 1},{ 1, 2, 1},{ -1, 2, 1},{ 1, 3, 1},{ -1, 3, 1}, { 1, 1, 1},{ -1, 1, 1},{ 1, 2, 1},{ -1, 2, 1},{ 1, 3, 1},{ -1, 3, 1},
@ -391,7 +391,7 @@ static const dec_2dvlc_t inter_dec[7] = {
} }
}; };
static const dec_2dvlc_t chroma_dec[5] = { const dec_2dvlc_t ff_cavs_chroma_dec[5] = {
{ {
{ //level / run { //level / run
{ 1, 1, 1},{ -1, 1, 1},{ 1, 2, 1},{ -1, 2, 1},{ 1, 3, 1},{ -1, 3, 1}, { 1, 1, 1},{ -1, 1, 1},{ 1, 2, 1},{ -1, 2, 1},{ 1, 3, 1},{ -1, 3, 1},

Loading…
Cancel
Save