From 5a8939698932bcd8a34574c9472af8901fa80729 Mon Sep 17 00:00:00 2001 From: Stefan Gehrer Date: Wed, 25 Jun 2008 11:33:49 +0000 Subject: [PATCH] remove duplicate tables Originally committed as revision 13959 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/mjpeg.c | 4 +-- libavcodec/mjpeg.h | 3 +- libavcodec/mjpegdec.c | 4 +-- libavcodec/mjpegenc.c | 8 ++--- libavcodec/msmpeg4.c | 2 +- libavcodec/msmpeg4data.c | 4 --- libavcodec/msmpeg4data.h | 1 - libavcodec/vc1.c | 20 ++++++------ libavcodec/vc1data.c | 69 ---------------------------------------- libavcodec/vc1data.h | 6 ---- 10 files changed, 19 insertions(+), 102 deletions(-) diff --git a/libavcodec/mjpeg.c b/libavcodec/mjpeg.c index 08ffb95a7c..11a84bafcb 100644 --- a/libavcodec/mjpeg.c +++ b/libavcodec/mjpeg.c @@ -64,13 +64,11 @@ const unsigned char std_chrominance_quant_tbl[64] = { /* IMPORTANT: these are only valid for 8-bit data precision! */ const uint8_t ff_mjpeg_bits_dc_luminance[17] = { /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; -const uint8_t ff_mjpeg_val_dc_luminance[] = +const uint8_t ff_mjpeg_val_dc[12] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; const uint8_t ff_mjpeg_bits_dc_chrominance[17] = { /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; -const uint8_t ff_mjpeg_val_dc_chrominance[] = -{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; const uint8_t ff_mjpeg_bits_ac_luminance[17] = { /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d }; diff --git a/libavcodec/mjpeg.h b/libavcodec/mjpeg.h index 1916fd0cfc..028f8c0d3f 100644 --- a/libavcodec/mjpeg.h +++ b/libavcodec/mjpeg.h @@ -138,10 +138,9 @@ static inline void put_marker(PutBitContext *p, int code) } extern const uint8_t ff_mjpeg_bits_dc_luminance[]; -extern const uint8_t ff_mjpeg_val_dc_luminance[]; +extern const uint8_t ff_mjpeg_val_dc[]; extern const uint8_t ff_mjpeg_bits_dc_chrominance[]; -extern const uint8_t ff_mjpeg_val_dc_chrominance[]; extern const uint8_t ff_mjpeg_bits_ac_luminance[]; extern const uint8_t ff_mjpeg_val_ac_luminance[]; diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 7e6b0d587a..06394f566b 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -64,9 +64,9 @@ static int build_vlc(VLC *vlc, const uint8_t *bits_table, const uint8_t *val_tab static void build_basic_mjpeg_vlc(MJpegDecodeContext * s) { build_vlc(&s->vlcs[0][0], ff_mjpeg_bits_dc_luminance, - ff_mjpeg_val_dc_luminance, 12, 0, 0); + ff_mjpeg_val_dc, 12, 0, 0); build_vlc(&s->vlcs[0][1], ff_mjpeg_bits_dc_chrominance, - ff_mjpeg_val_dc_chrominance, 12, 0, 0); + ff_mjpeg_val_dc, 12, 0, 0); build_vlc(&s->vlcs[1][0], ff_mjpeg_bits_ac_luminance, ff_mjpeg_val_ac_luminance, 251, 0, 1); build_vlc(&s->vlcs[1][1], ff_mjpeg_bits_ac_chrominance, diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c index d5fe08d8c1..5ef6db5ac3 100644 --- a/libavcodec/mjpegenc.c +++ b/libavcodec/mjpegenc.c @@ -59,11 +59,11 @@ av_cold int ff_mjpeg_encode_init(MpegEncContext *s) ff_mjpeg_build_huffman_codes(m->huff_size_dc_luminance, m->huff_code_dc_luminance, ff_mjpeg_bits_dc_luminance, - ff_mjpeg_val_dc_luminance); + ff_mjpeg_val_dc); ff_mjpeg_build_huffman_codes(m->huff_size_dc_chrominance, m->huff_code_dc_chrominance, ff_mjpeg_bits_dc_chrominance, - ff_mjpeg_val_dc_chrominance); + ff_mjpeg_val_dc); ff_mjpeg_build_huffman_codes(m->huff_size_ac_luminance, m->huff_code_ac_luminance, ff_mjpeg_bits_ac_luminance, @@ -139,9 +139,9 @@ static void jpeg_table_header(MpegEncContext *s) put_bits(p, 16, 0); /* patched later */ size = 2; size += put_huffman_table(s, 0, 0, ff_mjpeg_bits_dc_luminance, - ff_mjpeg_val_dc_luminance); + ff_mjpeg_val_dc); size += put_huffman_table(s, 0, 1, ff_mjpeg_bits_dc_chrominance, - ff_mjpeg_val_dc_chrominance); + ff_mjpeg_val_dc); size += put_huffman_table(s, 1, 0, ff_mjpeg_bits_ac_luminance, ff_mjpeg_val_ac_luminance); diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index efe5344a11..214ebb4b93 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -98,7 +98,7 @@ static void common_init(MpegEncContext * s) case 3: if(s->workaround_bugs){ s->y_dc_scale_table= old_ff_y_dc_scale_table; - s->c_dc_scale_table= old_ff_c_dc_scale_table; + s->c_dc_scale_table= wmv1_c_dc_scale_table; } else{ s->y_dc_scale_table= ff_mpeg4_y_dc_scale_table; s->c_dc_scale_table= ff_mpeg4_c_dc_scale_table; diff --git a/libavcodec/msmpeg4data.c b/libavcodec/msmpeg4data.c index 8ad462c03e..c0bb953bc5 100644 --- a/libavcodec/msmpeg4data.c +++ b/libavcodec/msmpeg4data.c @@ -1823,10 +1823,6 @@ const uint8_t old_ff_y_dc_scale_table[32]={ // 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 0, 8, 8, 8, 8,10,12,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39 }; -const uint8_t old_ff_c_dc_scale_table[32]={ -// 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 - 0, 8, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,22 -}; const uint8_t wmv1_scantable[WMV1_SCANTABLE_COUNT][64]={ { diff --git a/libavcodec/msmpeg4data.h b/libavcodec/msmpeg4data.h index 6293917695..0234027288 100644 --- a/libavcodec/msmpeg4data.h +++ b/libavcodec/msmpeg4data.h @@ -76,7 +76,6 @@ extern RLTable rl_table[NB_RL_TABLES]; extern const uint8_t wmv1_y_dc_scale_table[32]; extern const uint8_t wmv1_c_dc_scale_table[32]; extern const uint8_t old_ff_y_dc_scale_table[32]; -extern const uint8_t old_ff_c_dc_scale_table[32]; extern MVTable mv_tables[2]; diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index 3975d0400e..f1a7232879 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -783,8 +783,8 @@ static int decode_sequence_header(AVCodecContext *avctx, GetBitContext *gb) } else { - v->zz_8x4 = ff_vc1_simple_progressive_8x4_zz; - v->zz_4x8 = ff_vc1_simple_progressive_4x8_zz; + v->zz_8x4 = wmv2_scantableA; + v->zz_4x8 = wmv2_scantableB; v->res_sm = get_bits(gb, 2); //reserved if (v->res_sm) { @@ -2398,11 +2398,11 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded if(v->s.ac_pred) { if(!dc_pred_dir) - zz_table = ff_vc1_horizontal_zz; + zz_table = wmv1_scantable[2]; else - zz_table = ff_vc1_vertical_zz; + zz_table = wmv1_scantable[3]; } else - zz_table = ff_vc1_normal_zz; + zz_table = wmv1_scantable[1]; ac_val = s->ac_val[0][0] + s->block_index[n] * 16; ac_val2 = ac_val; @@ -2581,11 +2581,11 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c if(v->s.ac_pred) { if(!dc_pred_dir) - zz_table = ff_vc1_horizontal_zz; + zz_table = wmv1_scantable[2]; else - zz_table = ff_vc1_vertical_zz; + zz_table = wmv1_scantable[3]; } else - zz_table = ff_vc1_normal_zz; + zz_table = wmv1_scantable[1]; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); @@ -2786,7 +2786,7 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c const int8_t *zz_table; int k; - zz_table = ff_vc1_simple_progressive_8x8_zz; + zz_table = wmv1_scantable[0]; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); @@ -2928,7 +2928,7 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan i += skip; if(i > 63) break; - idx = ff_vc1_simple_progressive_8x8_zz[i++]; + idx = wmv1_scantable[0][i++]; block[idx] = value * scale; if(!v->pquantizer) block[idx] += (block[idx] < 0) ? -mquant : mquant; diff --git a/libavcodec/vc1data.c b/libavcodec/vc1data.c index cf89502d3b..db5c5c74f4 100644 --- a/libavcodec/vc1data.c +++ b/libavcodec/vc1data.c @@ -562,75 +562,6 @@ const uint8_t ff_vc1_mv_diff_bits[4][73] = { /* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */ -/* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */ -const int8_t ff_vc1_normal_zz[64] = { - 0, 8, 1, 2, 9, 16, 24, 17, - 10, 3, 4, 11, 18, 25, 32, 40, - 33, 48, 26, 19, 12, 5, 6, 13, - 20, 27, 34, 41, 56, 49, 57, 42, - 35, 28, 21, 14, 7, 15, 22, 29, - 36, 43, 50, 58, 51, 59, 44, 37, - 30, 23, 31, 38, 45, 52, 60, 53, - 61, 46, 39, 47, 54, 62, 55, 63 -}; - -const int8_t ff_vc1_horizontal_zz [64] = /* Table 227 */ -{ - 0, 1, 8, 2, 3, 9, 16, 24, - 17, 10, 4, 5, 11, 18, 25, 32, - 40, 48, 33, 26, 19, 12, 6, 7, - 13, 20, 27, 34, 41, 56, 49, 57, - 42, 35, 28, 21, 14, 15, 22, 29, - 36, 43, 50, 58, 51, 44, 37, 30, - 23, 31, 38, 45, 52, 59, 60, 53, - 46, 39, 47, 54, 61, 62, 55, 63 -}; - -const int8_t ff_vc1_vertical_zz [64] = /* Table 228 */ -{ - 0, 8, 16, 1, 24, 32, 40, 9, - 2, 3, 10, 17, 25, 48, 56, 41, - 33, 26, 18, 11, 4, 5, 12, 19, - 27, 34, 49, 57, 50, 42, 35, 28, - 20, 13, 6, 7, 14, 21, 29, 36, - 43, 51, 58, 59, 52, 44, 37, 30, - 22, 15, 23, 31, 38, 45, 60, 53, - 46, 39, 47, 54, 61, 62, 55, 63 -}; - -const int8_t ff_vc1_simple_progressive_8x8_zz [64] = -/* Table 229 */ -{ - 0, 8, 1, 2, 9, 16, 24, 17, - 10, 3, 4, 11, 18, 25, 32, 40, - 48, 56, 41, 33, 26, 19, 12, 5, - 6, 13, 20, 27, 34, 49, 57, 58, - 50, 42, 35, 28, 21, 14, 7, 15, - 22, 29, 36, 43, 51, 59, 60, 52, - 44, 37, 30, 23, 31, 38, 45, 53, - 61, 62, 54, 46, 39, 47, 55, 63 -}; - -const int8_t ff_vc1_simple_progressive_8x4_zz [32] = /* Table 230 */ -{ - 0, 1, 2, 8, 3, 9, 10, 16, - 4, 11, 17, 24, 18, 12, 5, 19, - 25, 13, 20, 26, 27, 6, 21, 28, - 14, 22, 29, 7, 30, 15, 23, 31 -}; - -const int8_t ff_vc1_simple_progressive_4x8_zz [32] = /* Table 231 */ -{ - 0, 8, 1, 16, - 9, 24, 17, 2, - 32, 10, 25, 40, - 18, 48, 33, 26, - 56, 41, 34, 3, - 49, 57, 11, 42, - 19, 50, 27, 58, - 35, 43, 51, 59 -}; - /* Table 232 */ const int8_t ff_vc1_simple_progressive_4x4_zz [16] = { diff --git a/libavcodec/vc1data.h b/libavcodec/vc1data.h index 0c8b1fa8af..98ffe574f5 100644 --- a/libavcodec/vc1data.h +++ b/libavcodec/vc1data.h @@ -143,12 +143,6 @@ extern const uint8_t ff_vc1_mv_diff_bits[4][73]; /* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */ /* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */ -extern const int8_t ff_vc1_normal_zz[64]; -extern const int8_t ff_vc1_horizontal_zz [64]; -extern const int8_t ff_vc1_vertical_zz [64]; -extern const int8_t ff_vc1_simple_progressive_8x8_zz [64]; -extern const int8_t ff_vc1_simple_progressive_8x4_zz [32]; -extern const int8_t ff_vc1_simple_progressive_4x8_zz [32]; extern const int8_t ff_vc1_simple_progressive_4x4_zz [16]; extern const int8_t ff_vc1_adv_progressive_8x4_zz [32]; extern const int8_t ff_vc1_adv_progressive_4x8_zz [32];