diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2009-04-21 04:42:27 +0000 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2009-04-21 04:42:27 +0000 |
commit | 547b6a4cc7bec023c992df9aadd480f1efb4f4df (patch) | |
tree | 2c8db095f96a279a4de862a1ca1689a3342a760a /libavcodec/rv34.c | |
parent | de1275d5e89b1988ffffa82fb37874d1bef6d771 (diff) | |
download | ffmpeg-streaming-547b6a4cc7bec023c992df9aadd480f1efb4f4df.zip ffmpeg-streaming-547b6a4cc7bec023c992df9aadd480f1efb4f4df.tar.gz |
Make RV3/4 VLC tables use new static initialization method
Originally committed as revision 18637 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/rv34.c')
-rw-r--r-- | libavcodec/rv34.c | 64 |
1 files changed, 47 insertions, 17 deletions
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index 0e83f77..8a1788b 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -61,14 +61,39 @@ static RV34VLC intra_vlcs[NUM_INTRA_TABLES], inter_vlcs[NUM_INTER_TABLES]; * @{ */ +static const int table_offs[] = { + 0, 1818, 3622, 4144, 4698, 5234, 5804, 5868, 5900, 5932, + 5996, 6252, 6316, 6348, 6380, 7674, 8944, 10274, 11668, 12250, + 14060, 15846, 16372, 16962, 17512, 18148, 18180, 18212, 18244, 18308, + 18564, 18628, 18660, 18692, 20036, 21314, 22648, 23968, 24614, 26384, + 28190, 28736, 29366, 29938, 30608, 30640, 30672, 30704, 30768, 31024, + 31088, 31120, 31184, 32570, 33898, 35236, 36644, 37286, 39020, 40802, + 41368, 42052, 42692, 43348, 43380, 43412, 43444, 43476, 43604, 43668, + 43700, 43732, 45100, 46430, 47778, 49160, 49802, 51550, 53340, 53972, + 54648, 55348, 55994, 56122, 56154, 56186, 56218, 56346, 56410, 56442, + 56474, 57878, 59290, 60636, 62036, 62682, 64460, 64524, 64588, 64716, + 64844, 66076, 67466, 67978, 68542, 69064, 69648, 70296, 72010, 72074, + 72138, 72202, 72330, 73572, 74936, 75454, 76030, 76566, 77176, 77822, + 79582, 79646, 79678, 79742, 79870, 81180, 82536, 83064, 83672, 84242, + 84934, 85576, 87384, 87448, 87480, 87544, 87672, 88982, 90340, 90902, + 91598, 92182, 92846, 93488, 95246, 95278, 95310, 95374, 95502, 96878, + 98266, 98848, 99542, 100234, 100884, 101524, 103320, 103352, 103384, 103416, + 103480, 104874, 106222, 106910, 107584, 108258, 108902, 109544, 111366, 111398, + 111430, 111462, 111494, 112878, 114320, 114988, 115660, 116310, 116950, 117592 +}; + +static const VLC_TYPE table_data[117592][2]; + /** * Generate VLC from codeword lengths. * @param bits codeword lengths (zeroes are accepted) * @param size length of input data * @param vlc output VLC * @param insyms symbols for input codes (NULL for default ones) + * @param num VLC table number (for static initialization) */ -static void rv34_gen_vlc(const uint8_t *bits, int size, VLC *vlc, const uint8_t *insyms) +static void rv34_gen_vlc(const uint8_t *bits, int size, VLC *vlc, const uint8_t *insyms, + const int num) { int i; int counts[17] = {0}, codes[17]; @@ -92,10 +117,12 @@ static void rv34_gen_vlc(const uint8_t *bits, int size, VLC *vlc, const uint8_t for(i = 0; i < realsize; i++) cw[i] = codes[bits2[i]]++; + vlc->table = &table_data[table_offs[num]]; + vlc->table_allocated = table_offs[num + 1] - table_offs[num]; init_vlc_sparse(vlc, FFMIN(maxbits, 9), realsize, bits2, 1, 1, cw, 2, 2, - syms, 2, 2, INIT_VLC_USE_STATIC); + syms, 2, 2, INIT_VLC_USE_NEW_STATIC); } /** @@ -107,27 +134,30 @@ static av_cold void rv34_init_tables(void) for(i = 0; i < NUM_INTRA_TABLES; i++){ for(j = 0; j < 2; j++){ - rv34_gen_vlc(rv34_table_intra_cbppat [i][j], CBPPAT_VLC_SIZE, &intra_vlcs[i].cbppattern[j], NULL); - rv34_gen_vlc(rv34_table_intra_secondpat[i][j], OTHERBLK_VLC_SIZE, &intra_vlcs[i].second_pattern[j], NULL); - rv34_gen_vlc(rv34_table_intra_thirdpat [i][j], OTHERBLK_VLC_SIZE, &intra_vlcs[i].third_pattern[j], NULL); - for(k = 0; k < 4; k++) - rv34_gen_vlc(rv34_table_intra_cbp[i][j+k*2], CBP_VLC_SIZE, &intra_vlcs[i].cbp[j][k], rv34_cbp_code); + rv34_gen_vlc(rv34_table_intra_cbppat [i][j], CBPPAT_VLC_SIZE, &intra_vlcs[i].cbppattern[j], NULL, 19*i + 0 + j); + rv34_gen_vlc(rv34_table_intra_secondpat[i][j], OTHERBLK_VLC_SIZE, &intra_vlcs[i].second_pattern[j], NULL, 19*i + 2 + j); + rv34_gen_vlc(rv34_table_intra_thirdpat [i][j], OTHERBLK_VLC_SIZE, &intra_vlcs[i].third_pattern[j], NULL, 19*i + 4 + j); + for(k = 0; k < 4; k++){ + rv34_gen_vlc(rv34_table_intra_cbp[i][j+k*2], CBP_VLC_SIZE, &intra_vlcs[i].cbp[j][k], rv34_cbp_code, 19*i + 6 + j*4 + k); + } } - for(j = 0; j < 4; j++) - rv34_gen_vlc(rv34_table_intra_firstpat[i][j], FIRSTBLK_VLC_SIZE, &intra_vlcs[i].first_pattern[j], NULL); - rv34_gen_vlc(rv34_intra_coeff[i], COEFF_VLC_SIZE, &intra_vlcs[i].coefficient, NULL); + for(j = 0; j < 4; j++){ + rv34_gen_vlc(rv34_table_intra_firstpat[i][j], FIRSTBLK_VLC_SIZE, &intra_vlcs[i].first_pattern[j], NULL, 19*i + 14 + j); + } + rv34_gen_vlc(rv34_intra_coeff[i], COEFF_VLC_SIZE, &intra_vlcs[i].coefficient, NULL, 19*i + 18); } for(i = 0; i < NUM_INTER_TABLES; i++){ - rv34_gen_vlc(rv34_inter_cbppat[i], CBPPAT_VLC_SIZE, &inter_vlcs[i].cbppattern[0], NULL); - for(j = 0; j < 4; j++) - rv34_gen_vlc(rv34_inter_cbp[i][j], CBP_VLC_SIZE, &inter_vlcs[i].cbp[0][j], rv34_cbp_code); + rv34_gen_vlc(rv34_inter_cbppat[i], CBPPAT_VLC_SIZE, &inter_vlcs[i].cbppattern[0], NULL, i*12 + 95); + for(j = 0; j < 4; j++){ + rv34_gen_vlc(rv34_inter_cbp[i][j], CBP_VLC_SIZE, &inter_vlcs[i].cbp[0][j], rv34_cbp_code, i*12 + 96 + j); + } for(j = 0; j < 2; j++){ - rv34_gen_vlc(rv34_table_inter_firstpat [i][j], FIRSTBLK_VLC_SIZE, &inter_vlcs[i].first_pattern[j], NULL); - rv34_gen_vlc(rv34_table_inter_secondpat[i][j], OTHERBLK_VLC_SIZE, &inter_vlcs[i].second_pattern[j], NULL); - rv34_gen_vlc(rv34_table_inter_thirdpat [i][j], OTHERBLK_VLC_SIZE, &inter_vlcs[i].third_pattern[j], NULL); + rv34_gen_vlc(rv34_table_inter_firstpat [i][j], FIRSTBLK_VLC_SIZE, &inter_vlcs[i].first_pattern[j], NULL, i*12 + 100 + j); + rv34_gen_vlc(rv34_table_inter_secondpat[i][j], OTHERBLK_VLC_SIZE, &inter_vlcs[i].second_pattern[j], NULL, i*12 + 102 + j); + rv34_gen_vlc(rv34_table_inter_thirdpat [i][j], OTHERBLK_VLC_SIZE, &inter_vlcs[i].third_pattern[j], NULL, i*12 + 104 + j); } - rv34_gen_vlc(rv34_inter_coeff[i], COEFF_VLC_SIZE, &inter_vlcs[i].coefficient, NULL); + rv34_gen_vlc(rv34_inter_coeff[i], COEFF_VLC_SIZE, &inter_vlcs[i].coefficient, NULL, i*12 + 106); } } |