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

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
480480
481481 t = T(1084); // g
482482 B(1, 1) += t;
483−
484− w->block_last_index[0] = FFMAX(w->block_last_index[0], 7 * 8);
485483 break;
486484 case 1:
487485 B(0, 1) -= T(6269);
488486 B(0, 3) -= T(708);
489487 B(0, 5) -= T(172);
490488 B(0, 7) -= T(73);
491−
492− w->block_last_index[0] = FFMAX(w->block_last_index[0], 7 * 8);
493489 break;
494490 case 2:
495491 B(1, 0) -= T(6269);
496492 B(3, 0) -= T(708);
497493 B(5, 0) -= T(172);
498494 B(7, 0) -= T(73);
499−
500− w->block_last_index[0] = FFMAX(w->block_last_index[0], 7);
501495 break;
502496 }
503497 #undef B
@@ -599,10 +593,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma) · 95 unmodified lines
599593
600594 w->block[0][scantable[pos]] = level;
601595 } while (!final);
602−
603− w->block_last_index[0] = pos;
604596 } else { // DC only
605− w->block_last_index[0] = 0;
606597 if (w->flat_dc && ((unsigned) (dc_level + 1)) < 3) { // [-1; 1]
607598 int32_t divide_quant = !chroma ? w->divide_quant_dc_luma
608599 : w->divide_quant_dc_chroma;
@@ -633,7 +624,6 @@ static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma) · 24 unmodified lines
633624 * -> 01'10' 10'10' 00'00' 00'01' 01'11' 11'00 => 0x6A017C */
634625 direction = (0x6A017C >> (w->orient * 2)) & 3;
635626 if (direction != 3) {
636− // modify block_last[]
637627 x8_ac_compensation(w, direction, w->block[0][0]);
638628 }
639629 }
@@ -689,7 +679,6 @@ static void x8_init_block_index(IntraX8Context *w, AVFrame *frame) · 49 unmodified lines
689679 av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
690680 IntraX8Context *w,
691681 int16_t (*block)[64],
692− int block_last_index[12],
693682 int mb_width, int mb_height)
694683 {
695684 static AVOnce init_static_once = AV_ONCE_INIT;
@@ -698,7 +687,6 @@ av_cold int ff_intrax8_common_init(AVCodecContext *avctx, · 2 unmodified lines
698687 w->mb_width = mb_width;
699688 w->mb_height = mb_height;
700689 w->block = block;
701− w->block_last_index = block_last_index;
702690
703691 // two rows, 2 blocks per cannon mb
704692 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
3838 WMV2DSPContext wdsp;
3939 uint8_t idct_permutation[64];
4040 AVCodecContext *avctx;
41− int *block_last_index; ///< last nonzero coefficient in block
4241 int16_t (*block)[64];
4342
4443 // set by the caller codec
@@ -77,7 +76,6 @@ typedef struct IntraX8Context { · 32 unmodified lines
7776 * @param avctx pointer to AVCodecContext
7877 * @param w pointer to IntraX8Context
7978 * @param block pointer to block array
80− * @param block_last_index pointer to index array
8179 * @param mb_width macroblock width
8280 * @param mb_height macroblock height
8381 * @return 0 on success, a negative AVERROR value on error
@@ -85,7 +83,6 @@ typedef struct IntraX8Context { · 1 unmodified line
8583 int ff_intrax8_common_init(AVCodecContext *avctx,
8684 IntraX8Context *w,
8785 int16_t (*block)[64],
88− int block_last_index[12],
8986 int mb_width, int mb_height);
9087
9188 /**
libavcodec/vc1dec.c+1−2
@@ -422,8 +422,7 @@ static av_cold int vc1_decode_init_alloc_tables(VC1Context *v) · 421 unmodified lines
422422 return AVERROR(ENOMEM);
423423 }
424424
425− ret = ff_intrax8_common_init(s->avctx, &v->x8,
426− s->block, s->block_last_index,
425+ ret = ff_intrax8_common_init(s->avctx, &v->x8, s->block,
427426 s->mb_width, s->mb_height);
428427 if (ret < 0)
429428 return ret;
libavcodec/wmv2dec.c+1−2
@@ -575,8 +575,7 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx) · 574 unmodified lines
575575
576576 decode_ext_header(w);
577577
578− return ff_intrax8_common_init(avctx, &w->x8,
579− w->s.block, w->s.block_last_index,
578+ return ff_intrax8_common_init(avctx, &w->x8, w->s.block,
580579 w->s.mb_width, w->s.mb_height);
581580 }
582581

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