Functions | |
| static void | rv34_gen_vlc (const uint8_t *bits, int size, VLC *vlc, const uint8_t *insyms) |
| static av_cold void | rv34_init_tables () |
| static void rv34_gen_vlc | ( | const uint8_t * | bits, | |
| int | size, | |||
| VLC * | vlc, | |||
| const uint8_t * | insyms | |||
| ) | [static] |
Generate VLC from codeword lengths.
| bits | codeword lengths (zeroes are accepted) | |
| size | length of input data | |
| insyms | symbols for input codes (NULL for default ones) |
Definition at line 69 of file rv34.c.
References FFMAX, FFMIN, init_vlc_sparse(), and INIT_VLC_USE_STATIC.
Referenced by rv34_init_tables().
00070 { 00071 int i; 00072 int counts[17] = {0}, codes[17]; 00073 uint16_t cw[size], syms[size]; 00074 uint8_t bits2[size]; 00075 int maxbits = 0, realsize = 0; 00076 00077 for(i = 0; i < size; i++){ 00078 if(bits[i]){ 00079 bits2[realsize] = bits[i]; 00080 syms[realsize] = insyms ? insyms[i] : i; 00081 realsize++; 00082 maxbits = FFMAX(maxbits, bits[i]); 00083 counts[bits[i]]++; 00084 } 00085 } 00086 00087 codes[0] = 0; 00088 for(i = 0; i < 16; i++) 00089 codes[i+1] = (codes[i] + counts[i]) << 1; 00090 for(i = 0; i < realsize; i++) 00091 cw[i] = codes[bits2[i]]++; 00092 00093 init_vlc_sparse(vlc, FFMIN(maxbits, 9), realsize, 00094 bits2, 1, 1, 00095 cw, 2, 2, 00096 syms, 2, 2, INIT_VLC_USE_STATIC); 00097 }
| static av_cold void rv34_init_tables | ( | ) | [static] |
Initialize all tables.
Definition at line 102 of file rv34.c.
References CBP_VLC_SIZE, CBPPAT_VLC_SIZE, COEFF_VLC_SIZE, FIRSTBLK_VLC_SIZE, inter_vlcs, intra_vlcs, NULL, NUM_INTER_TABLES, NUM_INTRA_TABLES, OTHERBLK_VLC_SIZE, rv34_cbp_code, rv34_gen_vlc(), rv34_inter_cbp, rv34_inter_cbppat, rv34_inter_coeff, rv34_intra_coeff, rv34_table_inter_firstpat, rv34_table_inter_secondpat, rv34_table_inter_thirdpat, rv34_table_intra_cbp, rv34_table_intra_cbppat, rv34_table_intra_firstpat, rv34_table_intra_secondpat, and rv34_table_intra_thirdpat.
Referenced by ff_rv34_decode_init().
00103 { 00104 int i, j, k; 00105 00106 for(i = 0; i < NUM_INTRA_TABLES; i++){ 00107 for(j = 0; j < 2; j++){ 00108 rv34_gen_vlc(rv34_table_intra_cbppat [i][j], CBPPAT_VLC_SIZE, &intra_vlcs[i].cbppattern[j], NULL); 00109 rv34_gen_vlc(rv34_table_intra_secondpat[i][j], OTHERBLK_VLC_SIZE, &intra_vlcs[i].second_pattern[j], NULL); 00110 rv34_gen_vlc(rv34_table_intra_thirdpat [i][j], OTHERBLK_VLC_SIZE, &intra_vlcs[i].third_pattern[j], NULL); 00111 for(k = 0; k < 4; k++) 00112 rv34_gen_vlc(rv34_table_intra_cbp[i][j+k*2], CBP_VLC_SIZE, &intra_vlcs[i].cbp[j][k], rv34_cbp_code); 00113 } 00114 for(j = 0; j < 4; j++) 00115 rv34_gen_vlc(rv34_table_intra_firstpat[i][j], FIRSTBLK_VLC_SIZE, &intra_vlcs[i].first_pattern[j], NULL); 00116 rv34_gen_vlc(rv34_intra_coeff[i], COEFF_VLC_SIZE, &intra_vlcs[i].coefficient, NULL); 00117 } 00118 00119 for(i = 0; i < NUM_INTER_TABLES; i++){ 00120 rv34_gen_vlc(rv34_inter_cbppat[i], CBPPAT_VLC_SIZE, &inter_vlcs[i].cbppattern[0], NULL); 00121 for(j = 0; j < 4; j++) 00122 rv34_gen_vlc(rv34_inter_cbp[i][j], CBP_VLC_SIZE, &inter_vlcs[i].cbp[0][j], rv34_cbp_code); 00123 for(j = 0; j < 2; j++){ 00124 rv34_gen_vlc(rv34_table_inter_firstpat [i][j], FIRSTBLK_VLC_SIZE, &inter_vlcs[i].first_pattern[j], NULL); 00125 rv34_gen_vlc(rv34_table_inter_secondpat[i][j], OTHERBLK_VLC_SIZE, &inter_vlcs[i].second_pattern[j], NULL); 00126 rv34_gen_vlc(rv34_table_inter_thirdpat [i][j], OTHERBLK_VLC_SIZE, &inter_vlcs[i].third_pattern[j], NULL); 00127 } 00128 rv34_gen_vlc(rv34_inter_coeff[i], COEFF_VLC_SIZE, &inter_vlcs[i].coefficient, NULL); 00129 } 00130 }
1.5.1