History

avcodec/intrax8: Stop setting write-only block_last_index

These values are only used by the mpegvideo unquantize functions, yet these are not active when intrax is in use. Furthermore, given that ff_intrax8_decode_picture() decodes multiple macroblocks in a given call, it makes no sense to return any value (that was in practice the maximum of the indices of all the macroblocks decoded).

Andreas Rheinhardt committed 1 year ago

Commit 461b86f1 parent 1a564c14 files · +2 −19Browse files

Showing the changes to libavcodec (4 of 4 files). Show all

Unified · Split

4 files
  1. libavcodec/intrax8.c +0 −12
  2. libavcodec/intrax8.h +0 −3
  3. libavcodec/vc1dec.c +1 −2
  4. libavcodec/wmv2dec.c +1 −2
libavcodec/intrax8.c+0−12
@@ -480,24 +480,18 @@ static void x8_ac_compensation(IntraX8Context *const w, const int direction, · 479 unmodified lines
480 480
481 t = T(1084); // g481 t = T(1084); // g
482 B(1, 1) += t;482 B(1, 1) += t;
483
484 w->block_last_index[0] = FFMAX(w->block_last_index[0], 7 * 8);
485 break;483 break;
486 case 1:484 case 1:
487 B(0, 1) -= T(6269);485 B(0, 1) -= T(6269);
488 B(0, 3) -= T(708);486 B(0, 3) -= T(708);
489 B(0, 5) -= T(172);487 B(0, 5) -= T(172);
490 B(0, 7) -= T(73);488 B(0, 7) -= T(73);
491
492 w->block_last_index[0] = FFMAX(w->block_last_index[0], 7 * 8);
493 break;489 break;
494 case 2:490 case 2:
495 B(1, 0) -= T(6269);491 B(1, 0) -= T(6269);
496 B(3, 0) -= T(708);492 B(3, 0) -= T(708);
497 B(5, 0) -= T(172);493 B(5, 0) -= T(172);
498 B(7, 0) -= T(73);494 B(7, 0) -= T(73);
499
500 w->block_last_index[0] = FFMAX(w->block_last_index[0], 7);
501 break;495 break;
502 }496 }
503#undef B497#undef B
@@ -599,10 +593,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma) · 95 unmodified lines
599 593
600 w->block[0][scantable[pos]] = level;594 w->block[0][scantable[pos]] = level;
601 } while (!final);595 } while (!final);
602
603 w->block_last_index[0] = pos;
604 } else { // DC only596 } else { // DC only
605 w->block_last_index[0] = 0;
606 if (w->flat_dc && ((unsigned) (dc_level + 1)) < 3) { // [-1; 1]597 if (w->flat_dc && ((unsigned) (dc_level + 1)) < 3) { // [-1; 1]
607 int32_t divide_quant = !chroma ? w->divide_quant_dc_luma598 int32_t divide_quant = !chroma ? w->divide_quant_dc_luma
608 : w->divide_quant_dc_chroma;599 : w->divide_quant_dc_chroma;
@@ -633,7 +624,6 @@ static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma) · 24 unmodified lines
633 * -> 01'10' 10'10' 00'00' 00'01' 01'11' 11'00 => 0x6A017C */624 * -> 01'10' 10'10' 00'00' 00'01' 01'11' 11'00 => 0x6A017C */
634 direction = (0x6A017C >> (w->orient * 2)) & 3;625 direction = (0x6A017C >> (w->orient * 2)) & 3;
635 if (direction != 3) {626 if (direction != 3) {
636 // modify block_last[]
637 x8_ac_compensation(w, direction, w->block[0][0]);627 x8_ac_compensation(w, direction, w->block[0][0]);
638 }628 }
639 }629 }
@@ -689,7 +679,6 @@ static void x8_init_block_index(IntraX8Context *w, AVFrame *frame) · 49 unmodified lines
689av_cold int ff_intrax8_common_init(AVCodecContext *avctx,679av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
690 IntraX8Context *w,680 IntraX8Context *w,
691 int16_t (*block)[64],681 int16_t (*block)[64],
692 int block_last_index[12],
693 int mb_width, int mb_height)682 int mb_width, int mb_height)
694{683{
695 static AVOnce init_static_once = AV_ONCE_INIT;684 static AVOnce init_static_once = AV_ONCE_INIT;
@@ -698,7 +687,6 @@ av_cold int ff_intrax8_common_init(AVCodecContext *avctx, · 2 unmodified lines
698 w->mb_width = mb_width;687 w->mb_width = mb_width;
699 w->mb_height = mb_height;688 w->mb_height = mb_height;
700 w->block = block;689 w->block = block;
701 w->block_last_index = block_last_index;
702 690
703 // two rows, 2 blocks per cannon mb691 // two rows, 2 blocks per cannon mb
704 w->prediction_table = av_mallocz(w->mb_width * 2 * 2);692 w->prediction_table = av_mallocz(w->mb_width * 2 * 2);
libavcodec/intrax8.h+0−3
@@ -38,7 +38,6 @@ typedef struct IntraX8Context { · 37 unmodified lines
38 WMV2DSPContext wdsp;38 WMV2DSPContext wdsp;
39 uint8_t idct_permutation[64];39 uint8_t idct_permutation[64];
40 AVCodecContext *avctx;40 AVCodecContext *avctx;
41 int *block_last_index; ///< last nonzero coefficient in block
42 int16_t (*block)[64];41 int16_t (*block)[64];
43 42
44 // set by the caller codec43 // set by the caller codec
@@ -77,7 +76,6 @@ typedef struct IntraX8Context { · 32 unmodified lines
77 * @param avctx pointer to AVCodecContext76 * @param avctx pointer to AVCodecContext
78 * @param w pointer to IntraX8Context77 * @param w pointer to IntraX8Context
79 * @param block pointer to block array78 * @param block pointer to block array
80 * @param block_last_index pointer to index array
81 * @param mb_width macroblock width79 * @param mb_width macroblock width
82 * @param mb_height macroblock height80 * @param mb_height macroblock height
83 * @return 0 on success, a negative AVERROR value on error81 * @return 0 on success, a negative AVERROR value on error
@@ -85,7 +83,6 @@ typedef struct IntraX8Context { · 1 unmodified line
85int ff_intrax8_common_init(AVCodecContext *avctx,83int ff_intrax8_common_init(AVCodecContext *avctx,
86 IntraX8Context *w,84 IntraX8Context *w,
87 int16_t (*block)[64],85 int16_t (*block)[64],
88 int block_last_index[12],
89 int mb_width, int mb_height);86 int mb_width, int mb_height);
90 87
91/**88/**
libavcodec/vc1dec.c+1−2
@@ -422,8 +422,7 @@ static av_cold int vc1_decode_init_alloc_tables(VC1Context *v) · 421 unmodified lines
422 return AVERROR(ENOMEM);422 return AVERROR(ENOMEM);
423 }423 }
424 424
425 ret = ff_intrax8_common_init(s->avctx, &v->x8,425 ret = ff_intrax8_common_init(s->avctx, &v->x8, s->block,
426 s->block, s->block_last_index,
427 s->mb_width, s->mb_height);426 s->mb_width, s->mb_height);
428 if (ret < 0)427 if (ret < 0)
429 return ret;428 return ret;
libavcodec/wmv2dec.c+1−2
@@ -575,8 +575,7 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx) · 574 unmodified lines
575 575
576 decode_ext_header(w);576 decode_ext_header(w);
577 577
578 return ff_intrax8_common_init(avctx, &w->x8,578 return ff_intrax8_common_init(avctx, &w->x8, w->s.block,
579 w->s.block, w->s.block_last_index,
580 w->s.mb_width, w->s.mb_height);579 w->s.mb_width, w->s.mb_height);
581}580}
582 581

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t