This matches the function of the same name in proresenc_kostya.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -226,7 +226,7 @@ static int int_from_list_or_default(void *ctx, const char *val_name, int val, · 225 unmodified lines | |||
| 226 | return default_value; | 226 | return default_value; |
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | static void encode_codeword(PutBitContext *pb, int val, unsigned codebook) | 229 | static void encode_vlc_codeword(PutBitContext *pb, unsigned codebook, int val) |
| 230 | { | 230 | { |
| 231 | unsigned int rice_order, exp_order, switch_bits, switch_val; | 231 | unsigned int rice_order, exp_order, switch_bits, switch_val; |
| 232 | int exponent; | 232 | int exponent; |
| @@ -277,7 +277,7 @@ static void encode_dc_coeffs(PutBitContext *pb, int16_t *in, · 44 unmodified lines | |||
| 277 | 277 | ||
| 278 | prev_dc = QSCALE(qmat, 0, in[0] - 16384); | 278 | prev_dc = QSCALE(qmat, 0, in[0] - 16384); |
| 279 | code = TO_GOLOMB(prev_dc); | 279 | code = TO_GOLOMB(prev_dc); |
| 280 | encode_codeword(pb, code, FIRST_DC_CB); | 280 | encode_vlc_codeword(pb, FIRST_DC_CB, code); |
| 281 | 281 | ||
| 282 | code = 5; sign = 0; idx = 64; | 282 | code = 5; sign = 0; idx = 64; |
| 283 | for (i = 1; i < blocks_per_slice; i++, idx += 64) { | 283 | for (i = 1; i < blocks_per_slice; i++, idx += 64) { |
| @@ -286,7 +286,7 @@ static void encode_dc_coeffs(PutBitContext *pb, int16_t *in, · 2 unmodified lines | |||
| 286 | diff_sign = DIFF_SIGN(delta, sign); | 286 | diff_sign = DIFF_SIGN(delta, sign); |
| 287 | new_code = TO_GOLOMB2(get_level(delta), diff_sign); | 287 | new_code = TO_GOLOMB2(get_level(delta), diff_sign); |
| 288 | 288 | ||
| 289 | encode_codeword(pb, new_code, ff_prores_dc_codebook[FFMIN(code, 6)]); | 289 | encode_vlc_codeword(pb, ff_prores_dc_codebook[FFMIN(code, 6)], new_code); |
| 290 | 290 | ||
| 291 | code = new_code; | 291 | code = new_code; |
| 292 | sign = delta >> 31; | 292 | sign = delta >> 31; |
| @@ -306,14 +306,14 @@ static void encode_ac_coeffs(PutBitContext *pb, · 13 unmodified lines | |||
| 306 | for (j = 0; j < blocks_per_slice; j++) { | 306 | for (j = 0; j < blocks_per_slice; j++) { |
| 307 | int val = QSCALE(qmat, indp, in[(j << 6) + indp]); | 307 | int val = QSCALE(qmat, indp, in[(j << 6) + indp]); |
| 308 | if (val) { | 308 | if (val) { |
| 309 | encode_codeword(pb, run, ff_prores_run_to_cb[FFMIN(prev_run, 15)]); | 309 | encode_vlc_codeword(pb, ff_prores_run_to_cb[FFMIN(prev_run, 15)], run); |
| 310 | 310 | ||
| 311 | prev_run = run; | 311 | prev_run = run; |
| 312 | run = 0; | 312 | run = 0; |
| 313 | level = get_level(val); | 313 | level = get_level(val); |
| 314 | code = level - 1; | 314 | code = level - 1; |
| 315 | 315 | ||
| 316 | encode_codeword(pb, code, ff_prores_level_to_cb[FFMIN(prev_level, 9)]); | 316 | encode_vlc_codeword(pb, ff_prores_level_to_cb[FFMIN(prev_level, 9)], code); |
| 317 | 317 | ||
| 318 | prev_level = level; | 318 | prev_level = level; |
| 319 | 319 | ||