Unified · Split
| @@ -390,7 +390,7 @@ static av_cold int mjpeg_encode_close(AVCodecContext *avctx) · 389 unmodified lines | |||
| 390 | * @param table_id Which Huffman table the code belongs to. | 390 | * @param table_id Which Huffman table the code belongs to. |
| 391 | * @param code The encoded exponent of the coefficients and the run-bits. | 391 | * @param code The encoded exponent of the coefficients and the run-bits. |
| 392 | */ | 392 | */ |
| 393 | static inline void ff_mjpeg_encode_code(MJpegContext *s, uint8_t table_id, int code) | 393 | static inline void mjpeg_encode_code(MJpegContext *s, uint8_t table_id, int code) |
| 394 | { | 394 | { |
| 395 | MJpegHuffmanCode *c = &s->huff_buffer[s->huff_ncode++]; | 395 | MJpegHuffmanCode *c = &s->huff_buffer[s->huff_ncode++]; |
| 396 | c->table_id = table_id; | 396 | c->table_id = table_id; |
| @@ -405,13 +405,13 @@ static inline void ff_mjpeg_encode_code(MJpegContext *s, uint8_t table_id, int c · 8 unmodified lines | |||
| 405 | * @param val The coefficient. | 405 | * @param val The coefficient. |
| 406 | * @param run The run-bits. | 406 | * @param run The run-bits. |
| 407 | */ | 407 | */ |
| 408 | static void ff_mjpeg_encode_coef(MJpegContext *s, uint8_t table_id, int val, int run) | 408 | static void mjpeg_encode_coef(MJpegContext *s, uint8_t table_id, int val, int run) |
| 409 | { | 409 | { |
| 410 | int mant, code; | 410 | int mant, code; |
| 411 | 411 | ||
| 412 | if (val == 0) { | 412 | if (val == 0) { |
| 413 | av_assert0(run == 0); | 413 | av_assert0(run == 0); |
| 414 | ff_mjpeg_encode_code(s, table_id, 0); | 414 | mjpeg_encode_code(s, table_id, 0); |
| 415 | } else { | 415 | } else { |
| 416 | mant = val; | 416 | mant = val; |
| 417 | if (val < 0) { | 417 | if (val < 0) { |
| @@ -422,7 +422,7 @@ static void ff_mjpeg_encode_coef(MJpegContext *s, uint8_t table_id, int val, int · 4 unmodified lines | |||
| 422 | code = (run << 4) | (av_log2_16bit(val) + 1); | 422 | code = (run << 4) | (av_log2_16bit(val) + 1); |
| 423 | 423 | ||
| 424 | s->huff_buffer[s->huff_ncode].mant = mant; | 424 | s->huff_buffer[s->huff_ncode].mant = mant; |
| 425 | ff_mjpeg_encode_code(s, table_id, code); | 425 | mjpeg_encode_code(s, table_id, code); |
| 426 | } | 426 | } |
| 427 | } | 427 | } |
| 428 | 428 | ||
| @@ -445,7 +445,7 @@ static void record_block(MpegEncContext *s, int16_t *block, int n) · 16 unmodified lines | |||
| 445 | dc = block[0]; /* overflow is impossible */ | 445 | dc = block[0]; /* overflow is impossible */ |
| 446 | val = dc - s->last_dc[component]; | 446 | val = dc - s->last_dc[component]; |
| 447 | 447 | ||
| 448 | ff_mjpeg_encode_coef(m, table_id, val, 0); | 448 | mjpeg_encode_coef(m, table_id, val, 0); |
| 449 | 449 | ||
| 450 | s->last_dc[component] = dc; | 450 | s->last_dc[component] = dc; |
| 451 | 451 | ||
| @@ -463,17 +463,17 @@ static void record_block(MpegEncContext *s, int16_t *block, int n) · 11 unmodified lines | |||
| 463 | run++; | 463 | run++; |
| 464 | } else { | 464 | } else { |
| 465 | while (run >= 16) { | 465 | while (run >= 16) { |
| 466 | ff_mjpeg_encode_code(m, table_id, 0xf0); | 466 | mjpeg_encode_code(m, table_id, 0xf0); |
| 467 | run -= 16; | 467 | run -= 16; |
| 468 | } | 468 | } |
| 469 | ff_mjpeg_encode_coef(m, table_id, val, run); | 469 | mjpeg_encode_coef(m, table_id, val, run); |
| 470 | run = 0; | 470 | run = 0; |
| 471 | } | 471 | } |
| 472 | } | 472 | } |
| 473 | 473 | ||
| 474 | /* output EOB only if not already 64 values */ | 474 | /* output EOB only if not already 64 values */ |
| 475 | if (last_index < 63 || run != 0) | 475 | if (last_index < 63 || run != 0) |
| 476 | ff_mjpeg_encode_code(m, table_id, 0); | 476 | mjpeg_encode_code(m, table_id, 0); |
| 477 | } | 477 | } |
| 478 | 478 | ||
| 479 | static void encode_block(MpegEncContext *s, int16_t *block, int n) | 479 | static void encode_block(MpegEncContext *s, int16_t *block, int n) |