* [FFmpeg-devel] [PATCH v2 02/24] avcodec/eamad: Don't use IDCTDSP-API unnecessarily
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-22 0:07 ` Peter Ross
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 03/24] avcodec/eatgq: " Andreas Rheinhardt
` (22 subsequent siblings)
23 siblings, 1 reply; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
The eamad decoder uses a custom IDCT and actually does not
use the IDCTDSP API at all. Somehow it was nevertheless
used to simply apply the identity permutation on ff_zigzag_direct.
This commit stops doing so.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
configure | 2 +-
libavcodec/eamad.c | 8 +-------
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/configure b/configure
index bb61e9a0b8..16b2084945 100755
--- a/configure
+++ b/configure
@@ -2820,7 +2820,7 @@ dxa_decoder_deps="zlib"
dxv_decoder_select="lzf texturedsp"
eac3_decoder_select="ac3_decoder"
eac3_encoder_select="ac3_encoder"
-eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
+eamad_decoder_select="aandcttables blockdsp bswapdsp"
eatgq_decoder_select="aandcttables idctdsp"
eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
exr_decoder_deps="zlib"
diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c
index 2a5aac912d..de8f488f65 100644
--- a/libavcodec/eamad.c
+++ b/libavcodec/eamad.c
@@ -39,7 +39,6 @@
#include "get_bits.h"
#include "aandcttab.h"
#include "eaidct.h"
-#include "idctdsp.h"
#include "mpeg12data.h"
#include "mpeg12vlc.h"
@@ -52,13 +51,11 @@ typedef struct MadContext {
AVCodecContext *avctx;
BlockDSPContext bdsp;
BswapDSPContext bbdsp;
- IDCTDSPContext idsp;
AVFrame *last_frame;
GetBitContext gb;
void *bitstream_buf;
unsigned int bitstream_buf_size;
DECLARE_ALIGNED(32, int16_t, block)[64];
- ScanTable scantable;
uint16_t quant_matrix[64];
int mb_x;
int mb_y;
@@ -71,9 +68,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
ff_blockdsp_init(&s->bdsp);
ff_bswapdsp_init(&s->bbdsp);
- ff_idctdsp_init(&s->idsp, avctx);
- ff_init_scantable_permutation(s->idsp.idct_permutation, FF_IDCT_PERM_NONE);
- ff_init_scantable(s->idsp.idct_permutation, &s->scantable, ff_zigzag_direct);
ff_mpeg12_init_vlcs();
s->last_frame = av_frame_alloc();
@@ -135,7 +129,7 @@ static inline int decode_block_intra(MadContext *s, int16_t * block)
{
int level, i, j, run;
RLTable *rl = &ff_rl_mpeg1;
- const uint8_t *scantable = s->scantable.permutated;
+ const uint8_t *scantable = ff_zigzag_direct;
int16_t *quant_matrix = s->quant_matrix;
block[0] = (128 + get_sbits(&s->gb, 8)) * quant_matrix[0];
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 03/24] avcodec/eatgq: Don't use IDCTDSP-API unnecessarily
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 02/24] avcodec/eamad: Don't use IDCTDSP-API unnecessarily Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 04/24] avcodec/eatqi: " Andreas Rheinhardt
` (21 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
The eatgq decoder uses a custom IDCT and actually does not
use the IDCTDSP API at all. Somehow it was nevertheless
used to simply apply the identity permutation on ff_zigzag_direct.
This commit stops doing so. It also renames perm to scantable,
because it is only the scantable as given by the spec without
any further permutation performed by us.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
configure | 2 +-
libavcodec/eatgq.c | 21 ++++++++-------------
2 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/configure b/configure
index 16b2084945..84d7be8bfe 100755
--- a/configure
+++ b/configure
@@ -2821,7 +2821,7 @@ dxv_decoder_select="lzf texturedsp"
eac3_decoder_select="ac3_decoder"
eac3_encoder_select="ac3_encoder"
eamad_decoder_select="aandcttables blockdsp bswapdsp"
-eatgq_decoder_select="aandcttables idctdsp"
+eatgq_decoder_select="aandcttables"
eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
exr_decoder_deps="zlib"
exr_encoder_deps="zlib"
diff --git a/libavcodec/eatgq.c b/libavcodec/eatgq.c
index a6c3e72f85..627615b4e8 100644
--- a/libavcodec/eatgq.c
+++ b/libavcodec/eatgq.c
@@ -39,12 +39,10 @@
#include "decode.h"
#include "eaidct.h"
#include "get_bits.h"
-#include "idctdsp.h"
typedef struct TgqContext {
AVCodecContext *avctx;
int width, height;
- ScanTable scantable;
int qtable[64];
DECLARE_ALIGNED(16, int16_t, block)[6][64];
GetByteContext gb;
@@ -53,10 +51,7 @@ typedef struct TgqContext {
static av_cold int tgq_decode_init(AVCodecContext *avctx)
{
TgqContext *s = avctx->priv_data;
- uint8_t idct_permutation[64];
s->avctx = avctx;
- ff_init_scantable_permutation(idct_permutation, FF_IDCT_PERM_NONE);
- ff_init_scantable(idct_permutation, &s->scantable, ff_zigzag_direct);
avctx->framerate = (AVRational){ 15, 1 };
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
return 0;
@@ -64,15 +59,15 @@ static av_cold int tgq_decode_init(AVCodecContext *avctx)
static void tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb)
{
- uint8_t *perm = s->scantable.permutated;
+ const uint8_t *scantable = ff_zigzag_direct;
int i, j, value;
block[0] = get_sbits(gb, 8) * s->qtable[0];
for (i = 1; i < 64;) {
switch (show_bits(gb, 3)) {
case 4:
- block[perm[i++]] = 0;
+ block[scantable[i++]] = 0;
case 0:
- block[perm[i++]] = 0;
+ block[scantable[i++]] = 0;
skip_bits(gb, 3);
break;
case 5:
@@ -80,16 +75,16 @@ static void tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb
skip_bits(gb, 2);
value = get_bits(gb, 6);
for (j = 0; j < value; j++)
- block[perm[i++]] = 0;
+ block[scantable[i++]] = 0;
break;
case 6:
skip_bits(gb, 3);
- block[perm[i]] = -s->qtable[perm[i]];
+ block[scantable[i]] = -s->qtable[scantable[i]];
i++;
break;
case 2:
skip_bits(gb, 3);
- block[perm[i]] = s->qtable[perm[i]];
+ block[scantable[i]] = s->qtable[scantable[i]];
i++;
break;
case 7: // 111b
@@ -97,9 +92,9 @@ static void tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb
skip_bits(gb, 2);
if (show_bits(gb, 6) == 0x3F) {
skip_bits(gb, 6);
- block[perm[i]] = get_sbits(gb, 8) * s->qtable[perm[i]];
+ block[scantable[i]] = get_sbits(gb, 8) * s->qtable[scantable[i]];
} else {
- block[perm[i]] = get_sbits(gb, 6) * s->qtable[perm[i]];
+ block[scantable[i]] = get_sbits(gb, 6) * s->qtable[scantable[i]];
}
i++;
break;
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 04/24] avcodec/eatqi: Don't use IDCTDSP-API unnecessarily
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 02/24] avcodec/eamad: Don't use IDCTDSP-API unnecessarily Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 03/24] avcodec/eatgq: " Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 05/24] avcodec/aic: Remove useless ScanTable Andreas Rheinhardt
` (20 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
The eatqi decoder uses a custom IDCT and actually does not
use the IDCTDSP API at all. Somehow it was nevertheless
used to simply apply the identity permutation on ff_zigzag_direct.
This commit stops doing so.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
configure | 2 +-
libavcodec/eatqi.c | 8 +-------
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/configure b/configure
index 84d7be8bfe..baaf61271f 100755
--- a/configure
+++ b/configure
@@ -2822,7 +2822,7 @@ eac3_decoder_select="ac3_decoder"
eac3_encoder_select="ac3_encoder"
eamad_decoder_select="aandcttables blockdsp bswapdsp"
eatgq_decoder_select="aandcttables"
-eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
+eatqi_decoder_select="aandcttables blockdsp bswapdsp"
exr_decoder_deps="zlib"
exr_encoder_deps="zlib"
ffv1_decoder_select="rangecoder"
diff --git a/libavcodec/eatqi.c b/libavcodec/eatqi.c
index 324e6f1ced..e4f12b3db2 100644
--- a/libavcodec/eatqi.c
+++ b/libavcodec/eatqi.c
@@ -36,7 +36,6 @@
#include "get_bits.h"
#include "aandcttab.h"
#include "eaidct.h"
-#include "idctdsp.h"
#include "mpeg12data.h"
#include "mpeg12dec.h"
@@ -45,8 +44,6 @@ typedef struct TqiContext {
GetBitContext gb;
BlockDSPContext bdsp;
BswapDSPContext bsdsp;
- IDCTDSPContext idsp;
- ScanTable intra_scantable;
void *bitstream_buf;
unsigned int bitstream_buf_size;
@@ -64,9 +61,6 @@ static av_cold int tqi_decode_init(AVCodecContext *avctx)
ff_blockdsp_init(&t->bdsp);
ff_bswapdsp_init(&t->bsdsp);
- ff_idctdsp_init(&t->idsp, avctx);
- ff_init_scantable_permutation(t->idsp.idct_permutation, FF_IDCT_PERM_NONE);
- ff_init_scantable(t->idsp.idct_permutation, &t->intra_scantable, ff_zigzag_direct);
avctx->framerate = (AVRational){ 15, 1 };
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
@@ -82,7 +76,7 @@ static int tqi_decode_mb(TqiContext *t, int16_t (*block)[64])
for (n = 0; n < 6; n++) {
int ret = ff_mpeg1_decode_block_intra(&t->gb,
t->intra_matrix,
- t->intra_scantable.permutated,
+ ff_zigzag_direct,
t->last_dc, block[n], n, 1);
if (ret < 0) {
av_log(t->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n",
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 05/24] avcodec/aic: Remove useless ScanTable
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (2 preceding siblings ...)
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 04/24] avcodec/eatqi: " Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 06/24] avcodec/imm4: " Andreas Rheinhardt
` (19 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/aic.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/libavcodec/aic.c b/libavcodec/aic.c
index 49d08f0556..7ba1c02fdd 100644
--- a/libavcodec/aic.c
+++ b/libavcodec/aic.c
@@ -143,7 +143,6 @@ typedef struct AICContext {
AVCodecContext *avctx;
AVFrame *frame;
IDCTDSPContext idsp;
- ScanTable scantable;
int num_x_slices;
int slice_width;
@@ -348,10 +347,10 @@ static int aic_decode_slice(AICContext *ctx, int mb_x, int mb_y,
for (mb = 0; mb < slice_width; mb++) {
for (blk = 0; blk < 4; blk++) {
if (!ctx->interlaced)
- recombine_block(ctx->block, ctx->scantable.permutated,
+ recombine_block(ctx->block, ctx->idsp.idct_permutation,
&base_y, &ext_y);
else
- recombine_block_il(ctx->block, ctx->scantable.permutated,
+ recombine_block_il(ctx->block, ctx->idsp.idct_permutation,
&base_y, &ext_y, blk);
unquant_block(ctx->block, ctx->quant, ctx->quant_matrix);
ctx->idsp.idct(ctx->block);
@@ -368,7 +367,7 @@ static int aic_decode_slice(AICContext *ctx, int mb_x, int mb_y,
Y += 16;
for (blk = 0; blk < 2; blk++) {
- recombine_block(ctx->block, ctx->scantable.permutated,
+ recombine_block(ctx->block, ctx->idsp.idct_permutation,
&base_c, &ext_c);
unquant_block(ctx->block, ctx->quant, ctx->quant_matrix);
ctx->idsp.idct(ctx->block);
@@ -444,7 +443,6 @@ static av_cold int aic_decode_init(AVCodecContext *avctx)
{
AICContext *ctx = avctx->priv_data;
int i;
- uint8_t scan[64];
ctx->avctx = avctx;
@@ -452,9 +450,6 @@ static av_cold int aic_decode_init(AVCodecContext *avctx)
ff_idctdsp_init(&ctx->idsp, avctx);
- for (i = 0; i < 64; i++)
- scan[i] = i;
- ff_init_scantable(ctx->idsp.idct_permutation, &ctx->scantable, scan);
for (i = 0; i < 64; i++)
ctx->quant_matrix[ctx->idsp.idct_permutation[i]] = aic_quant_matrix[i];
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 06/24] avcodec/imm4: Remove useless ScanTable
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (3 preceding siblings ...)
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 05/24] avcodec/aic: Remove useless ScanTable Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 07/24] avcodec/idctdsp: Add function to apply permutation to array Andreas Rheinhardt
` (18 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Also rename the scantable variable to idct_permutation
to better reflect what it actually is.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/imm4.c | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/libavcodec/imm4.c b/libavcodec/imm4.c
index e2aa20813a..ccec5dff43 100644
--- a/libavcodec/imm4.c
+++ b/libavcodec/imm4.c
@@ -51,9 +51,8 @@ typedef struct IMM4Context {
unsigned lo;
unsigned hi;
- ScanTable intra_scantable;
- DECLARE_ALIGNED(32, int16_t, block)[6][64];
IDCTDSPContext idsp;
+ DECLARE_ALIGNED(32, int16_t, block)[6][64];
} IMM4Context;
static const uint8_t intra_cb[] = {
@@ -129,7 +128,7 @@ static int decode_block(AVCodecContext *avctx, GetBitContext *gb,
int block, int factor, int flag, int offset, int flag2)
{
IMM4Context *s = avctx->priv_data;
- const uint8_t *scantable = s->intra_scantable.permutated;
+ const uint8_t *idct_permutation = s->idsp.idct_permutation;
int i, last, len, factor2;
for (i = !flag; i < 64; i++) {
@@ -152,17 +151,17 @@ static int decode_block(AVCodecContext *avctx, GetBitContext *gb,
i += len;
if (i >= 64)
break;
- s->block[block][scantable[i]] = offset * (factor2 < 0 ? -1 : 1) + factor * factor2;
+ s->block[block][idct_permutation[i]] = offset * (factor2 < 0 ? -1 : 1) + factor * factor2;
if (last)
break;
}
if (s->hi == 2 && flag2 && block < 4) {
if (flag)
- s->block[block][scantable[0]] *= 2;
- s->block[block][scantable[1]] *= 2;
- s->block[block][scantable[8]] *= 2;
- s->block[block][scantable[16]] *= 2;
+ s->block[block][idct_permutation[0]] *= 2;
+ s->block[block][idct_permutation[1]] *= 2;
+ s->block[block][idct_permutation[8]] *= 2;
+ s->block[block][idct_permutation[16]] *= 2;
}
return 0;
@@ -172,7 +171,7 @@ static int decode_blocks(AVCodecContext *avctx, GetBitContext *gb,
unsigned cbp, int flag, int offset, unsigned flag2)
{
IMM4Context *s = avctx->priv_data;
- const uint8_t *scantable = s->intra_scantable.permutated;
+ const uint8_t *idct_permutation = s->idsp.idct_permutation;
int ret, i;
memset(s->block, 0, sizeof(s->block));
@@ -185,7 +184,7 @@ static int decode_blocks(AVCodecContext *avctx, GetBitContext *gb,
x = 128;
x *= 8;
- s->block[i][scantable[0]] = x;
+ s->block[i][idct_permutation[0]] = x;
}
if (cbp & (1 << (5 - i))) {
@@ -495,14 +494,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
{
static AVOnce init_static_once = AV_ONCE_INIT;
IMM4Context *s = avctx->priv_data;
- uint8_t table[64];
-
- for (int i = 0; i < 64; i++)
- table[i] = i;
ff_bswapdsp_init(&s->bdsp);
ff_idctdsp_init(&s->idsp, avctx);
- ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, table);
s->prev_frame = av_frame_alloc();
if (!s->prev_frame)
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 07/24] avcodec/idctdsp: Add function to apply permutation to array
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (4 preceding siblings ...)
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 06/24] avcodec/imm4: " Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 08/24] avcodec/agm: Only keep what is used from ScanTable Andreas Rheinhardt
` (17 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
It is the part of ff_init_scantable() that is used
by all users of said function.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/idctdsp.c | 9 +++++++++
libavcodec/idctdsp.h | 2 ++
2 files changed, 11 insertions(+)
diff --git a/libavcodec/idctdsp.c b/libavcodec/idctdsp.c
index 4ee9c3aa74..50156930ed 100644
--- a/libavcodec/idctdsp.c
+++ b/libavcodec/idctdsp.c
@@ -27,6 +27,15 @@
#include "simple_idct.h"
#include "xvididct.h"
+av_cold void ff_permute_scantable(uint8_t dst[64], const uint8_t src[64],
+ const uint8_t permutation[64])
+{
+ for (int i = 0; i < 64; i++) {
+ int j = src[i];
+ dst[i] = permutation[j];
+ }
+}
+
av_cold void ff_init_scantable(const uint8_t *permutation, ScanTable *st,
const uint8_t *src_scantable)
{
diff --git a/libavcodec/idctdsp.h b/libavcodec/idctdsp.h
index 2bd9820f72..b286bc231c 100644
--- a/libavcodec/idctdsp.h
+++ b/libavcodec/idctdsp.h
@@ -43,6 +43,8 @@ enum idct_permutation_type {
FF_IDCT_PERM_SSE2,
};
+void ff_permute_scantable(uint8_t dst[64], const uint8_t src[64],
+ const uint8_t permutation[64]);
void ff_init_scantable(const uint8_t *permutation, ScanTable *st,
const uint8_t *src_scantable);
void ff_init_scantable_permutation(uint8_t *idct_permutation,
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 08/24] avcodec/agm: Only keep what is used from ScanTable
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (5 preceding siblings ...)
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 07/24] avcodec/idctdsp: Add function to apply permutation to array Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 09/24] avcodec/asvdec: " Andreas Rheinhardt
` (16 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Namely ScanTable.permutated.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/agm.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/libavcodec/agm.c b/libavcodec/agm.c
index 017aa0e1fa..374e4f4ef2 100644
--- a/libavcodec/agm.c
+++ b/libavcodec/agm.c
@@ -88,7 +88,7 @@ typedef struct AGMContext {
int luma_quant_matrix[64];
int chroma_quant_matrix[64];
- ScanTable scantable;
+ uint8_t permutated_scantable[64];
DECLARE_ALIGNED(32, int16_t, block)[64];
int16_t *wblocks;
@@ -195,7 +195,7 @@ static int read_code(GetBitContext *gb, int *oskip, int *level, int *map, int mo
static int decode_intra_blocks(AGMContext *s, GetBitContext *gb,
const int *quant_matrix, int *skip, int *dc_level)
{
- const uint8_t *scantable = s->scantable.permutated;
+ const uint8_t *scantable = s->permutated_scantable;
int level, ret, map = 0;
memset(s->wblocks, 0, s->wblocks_size);
@@ -237,7 +237,7 @@ static int decode_inter_blocks(AGMContext *s, GetBitContext *gb,
const int *quant_matrix, int *skip,
int *map)
{
- const uint8_t *scantable = s->scantable.permutated;
+ const uint8_t *scantable = s->permutated_scantable;
int level, ret;
memset(s->wblocks, 0, s->wblocks_size);
@@ -272,7 +272,7 @@ static int decode_inter_blocks(AGMContext *s, GetBitContext *gb,
static int decode_intra_block(AGMContext *s, GetBitContext *gb,
const int *quant_matrix, int *skip, int *dc_level)
{
- const uint8_t *scantable = s->scantable.permutated;
+ const uint8_t *scantable = s->permutated_scantable;
const int offset = s->plus ? 0 : 1024;
int16_t *block = s->block;
int level, ret, map = 0;
@@ -362,7 +362,7 @@ static int decode_inter_block(AGMContext *s, GetBitContext *gb,
const int *quant_matrix, int *skip,
int *map)
{
- const uint8_t *scantable = s->scantable.permutated;
+ const uint8_t *scantable = s->permutated_scantable;
int16_t *block = s->block;
int level, ret;
@@ -1249,7 +1249,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
avctx->idct_algo = FF_IDCT_SIMPLE;
ff_idctdsp_init(&s->idsp, avctx);
- ff_init_scantable(s->idsp.idct_permutation, &s->scantable, ff_zigzag_direct);
+ ff_permute_scantable(s->permutated_scantable, ff_zigzag_direct,
+ s->idsp.idct_permutation);
s->prev_frame = av_frame_alloc();
if (!s->prev_frame)
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 09/24] avcodec/asvdec: Only keep what is used from ScanTable
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (6 preceding siblings ...)
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 08/24] avcodec/agm: Only keep what is used from ScanTable Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 10/24] avcodec/dnxhddec: " Andreas Rheinhardt
` (15 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Namely ScanTable.permutated.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/asvdec.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/libavcodec/asvdec.c b/libavcodec/asvdec.c
index be89544732..699aab9f8f 100644
--- a/libavcodec/asvdec.c
+++ b/libavcodec/asvdec.c
@@ -58,7 +58,7 @@ typedef struct ASVDecContext {
BlockDSPContext bdsp;
IDCTDSPContext idsp;
- ScanTable scantable;
+ uint8_t permutated_scantable[64];
DECLARE_ALIGNED(32, int16_t, block)[6][64];
uint16_t intra_matrix[64];
uint8_t *bitstream_buffer;
@@ -141,13 +141,13 @@ static inline int asv1_decode_block(ASVDecContext *a, int16_t block[64])
}
if (ccp & 8)
- block[a->scantable.permutated[4 * i + 0]] = (asv1_get_level(&a->gb) * a->intra_matrix[4 * i + 0]) >> 4;
+ block[a->permutated_scantable[4 * i + 0]] = (asv1_get_level(&a->gb) * a->intra_matrix[4 * i + 0]) >> 4;
if (ccp & 4)
- block[a->scantable.permutated[4 * i + 1]] = (asv1_get_level(&a->gb) * a->intra_matrix[4 * i + 1]) >> 4;
+ block[a->permutated_scantable[4 * i + 1]] = (asv1_get_level(&a->gb) * a->intra_matrix[4 * i + 1]) >> 4;
if (ccp & 2)
- block[a->scantable.permutated[4 * i + 2]] = (asv1_get_level(&a->gb) * a->intra_matrix[4 * i + 2]) >> 4;
+ block[a->permutated_scantable[4 * i + 2]] = (asv1_get_level(&a->gb) * a->intra_matrix[4 * i + 2]) >> 4;
if (ccp & 1)
- block[a->scantable.permutated[4 * i + 3]] = (asv1_get_level(&a->gb) * a->intra_matrix[4 * i + 3]) >> 4;
+ block[a->permutated_scantable[4 * i + 3]] = (asv1_get_level(&a->gb) * a->intra_matrix[4 * i + 3]) >> 4;
}
}
@@ -165,11 +165,11 @@ static inline int asv2_decode_block(ASVDecContext *a, int16_t block[64])
ccp = asv2_get_vlc2(&a->gb, dc_ccp_vlc.table, DC_CCP_VLC_BITS);
if (ccp) {
if (ccp & 4)
- block[a->scantable.permutated[1]] = (asv2_get_level(&a->gb) * a->intra_matrix[1]) >> 4;
+ block[a->permutated_scantable[1]] = (asv2_get_level(&a->gb) * a->intra_matrix[1]) >> 4;
if (ccp & 2)
- block[a->scantable.permutated[2]] = (asv2_get_level(&a->gb) * a->intra_matrix[2]) >> 4;
+ block[a->permutated_scantable[2]] = (asv2_get_level(&a->gb) * a->intra_matrix[2]) >> 4;
if (ccp & 1)
- block[a->scantable.permutated[3]] = (asv2_get_level(&a->gb) * a->intra_matrix[3]) >> 4;
+ block[a->permutated_scantable[3]] = (asv2_get_level(&a->gb) * a->intra_matrix[3]) >> 4;
}
for (i = 1; i < count + 1; i++) {
@@ -177,13 +177,13 @@ static inline int asv2_decode_block(ASVDecContext *a, int16_t block[64])
if (ccp) {
if (ccp & 8)
- block[a->scantable.permutated[4 * i + 0]] = (asv2_get_level(&a->gb) * a->intra_matrix[4 * i + 0]) >> 4;
+ block[a->permutated_scantable[4 * i + 0]] = (asv2_get_level(&a->gb) * a->intra_matrix[4 * i + 0]) >> 4;
if (ccp & 4)
- block[a->scantable.permutated[4 * i + 1]] = (asv2_get_level(&a->gb) * a->intra_matrix[4 * i + 1]) >> 4;
+ block[a->permutated_scantable[4 * i + 1]] = (asv2_get_level(&a->gb) * a->intra_matrix[4 * i + 1]) >> 4;
if (ccp & 2)
- block[a->scantable.permutated[4 * i + 2]] = (asv2_get_level(&a->gb) * a->intra_matrix[4 * i + 2]) >> 4;
+ block[a->permutated_scantable[4 * i + 2]] = (asv2_get_level(&a->gb) * a->intra_matrix[4 * i + 2]) >> 4;
if (ccp & 1)
- block[a->scantable.permutated[4 * i + 3]] = (asv2_get_level(&a->gb) * a->intra_matrix[4 * i + 3]) >> 4;
+ block[a->permutated_scantable[4 * i + 3]] = (asv2_get_level(&a->gb) * a->intra_matrix[4 * i + 3]) >> 4;
}
}
@@ -311,7 +311,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
ff_asv_common_init(avctx);
ff_blockdsp_init(&a->bdsp);
ff_idctdsp_init(&a->idsp, avctx);
- ff_init_scantable(a->idsp.idct_permutation, &a->scantable, ff_asv_scantab);
+ ff_permute_scantable(a->permutated_scantable, ff_asv_scantab,
+ a->idsp.idct_permutation);
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
if (avctx->extradata_size < 1 || (inv_qscale = avctx->extradata[0]) == 0) {
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 10/24] avcodec/dnxhddec: Only keep what is used from ScanTable
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (7 preceding siblings ...)
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 09/24] avcodec/asvdec: " Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 11/24] avcodec/cavs: Only keep what is needed from IDCTDSP-API Andreas Rheinhardt
` (14 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Namely ScanTable.permutated.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/dnxhddec.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index a44f95f044..7cc4f94c7f 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -65,7 +65,7 @@ typedef struct DNXHDContext {
int cur_field; ///< current interlaced field
VLC ac_vlc, dc_vlc, run_vlc;
IDCTDSPContext idsp;
- ScanTable scantable;
+ uint8_t permutated_scantable[64];
const CIDEntry *cid_table;
int bit_depth; // 8, 10, 12 or 0 if not initialized at all.
int is_444;
@@ -275,8 +275,8 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
if (ctx->bit_depth != old_bit_depth) {
ff_blockdsp_init(&ctx->bdsp);
ff_idctdsp_init(&ctx->idsp, ctx->avctx);
- ff_init_scantable(ctx->idsp.idct_permutation, &ctx->scantable,
- ff_zigzag_direct);
+ ff_permute_scantable(ctx->permutated_scantable, ff_zigzag_direct,
+ ctx->idsp.idct_permutation);
}
// make sure profile size constraints are respected
@@ -436,7 +436,7 @@ static av_always_inline int dnxhd_decode_dct_block(const DNXHDContext *ctx,
break;
}
- j = ctx->scantable.permutated[i];
+ j = ctx->permutated_scantable[i];
level *= scale[i];
level += scale[i] >> 1;
if (level_bias < 32 || weight_matrix[i] != level_bias)
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 11/24] avcodec/cavs: Only keep what is needed from IDCTDSP-API
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (8 preceding siblings ...)
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 10/24] avcodec/dnxhddec: " Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 12/24] avcodec/g2meet: Only keep what is used from ScanTable Andreas Rheinhardt
` (13 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Namely ScanTable.permutated. The rest of the IDCTDSP-API
is unused as cavs has its own idct.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/cavs.c | 7 +++----
libavcodec/cavs.h | 9 ++++++---
libavcodec/cavsdec.c | 2 +-
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c
index 6d54e8eae5..fdd577f7fb 100644
--- a/libavcodec/cavs.c
+++ b/libavcodec/cavs.c
@@ -792,15 +792,14 @@ int ff_cavs_init_top_lines(AVSContext *h)
av_cold int ff_cavs_init(AVCodecContext *avctx)
{
AVSContext *h = avctx->priv_data;
+ uint8_t permutation[64];
ff_blockdsp_init(&h->bdsp);
ff_h264chroma_init(&h->h264chroma, 8);
- ff_idctdsp_init(&h->idsp, avctx);
ff_videodsp_init(&h->vdsp, 8);
ff_cavsdsp_init(&h->cdsp);
- ff_init_scantable_permutation(h->idsp.idct_permutation,
- h->cdsp.idct_perm);
- ff_init_scantable(h->idsp.idct_permutation, &h->scantable, ff_zigzag_direct);
+ ff_init_scantable_permutation(permutation, h->cdsp.idct_perm);
+ ff_permute_scantable(h->permutated_scantable, ff_zigzag_direct, permutation);
h->avctx = avctx;
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
diff --git a/libavcodec/cavs.h b/libavcodec/cavs.h
index cbc163fb4d..244c322b35 100644
--- a/libavcodec/cavs.h
+++ b/libavcodec/cavs.h
@@ -22,12 +22,16 @@
#ifndef AVCODEC_CAVS_H
#define AVCODEC_CAVS_H
+#include <stddef.h>
+#include <stdint.h>
+
+#include "libavutil/frame.h"
#include "libavutil/mem_internal.h"
+#include "avcodec.h"
#include "cavsdsp.h"
#include "blockdsp.h"
#include "h264chroma.h"
-#include "idctdsp.h"
#include "get_bits.h"
#include "videodsp.h"
@@ -166,7 +170,6 @@ typedef struct AVSContext {
AVCodecContext *avctx;
BlockDSPContext bdsp;
H264ChromaContext h264chroma;
- IDCTDSPContext idsp;
VideoDSPContext vdsp;
CAVSDSPContext cdsp;
GetBitContext gb;
@@ -220,7 +223,7 @@ typedef struct AVSContext {
int qp_fixed;
int pic_qp_fixed;
int cbp;
- ScanTable scantable;
+ uint8_t permutated_scantable[64];
/** intra prediction is done with un-deblocked samples
they are saved here before deblocking the MB */
diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c
index 3e8be65968..b1fa9a981d 100644
--- a/libavcodec/cavsdec.c
+++ b/libavcodec/cavsdec.c
@@ -521,7 +521,7 @@ static inline int dequant(AVSContext *h, int16_t *level_buf, uint8_t *run_buf,
{
int round = 1 << (shift - 1);
int pos = -1;
- const uint8_t *scantab = h->scantable.permutated;
+ const uint8_t *scantab = h->permutated_scantable;
/* inverse scan and dequantization */
while (--coeff_num >= 0) {
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 12/24] avcodec/g2meet: Only keep what is used from ScanTable
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (9 preceding siblings ...)
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 11/24] avcodec/cavs: Only keep what is needed from IDCTDSP-API Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 13/24] avcodec/g2meet: Pre-permute quantization tables Andreas Rheinhardt
` (12 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Namely ScanTable.permutated.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/g2meet.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c
index 4367af3dc0..1973ed0741 100644
--- a/libavcodec/g2meet.c
+++ b/libavcodec/g2meet.c
@@ -120,7 +120,7 @@ typedef struct ePICContext {
typedef struct JPGContext {
BlockDSPContext bdsp;
IDCTDSPContext idsp;
- ScanTable scantable;
+ uint8_t permutated_scantable[64];
VLC dc_vlc[2], ac_vlc[2];
int prev_dc[3];
@@ -182,8 +182,8 @@ static av_cold int jpg_init(AVCodecContext *avctx, JPGContext *c)
ff_blockdsp_init(&c->bdsp);
ff_idctdsp_init(&c->idsp, avctx);
- ff_init_scantable(c->idsp.idct_permutation, &c->scantable,
- ff_zigzag_direct);
+ ff_permute_scantable(c->permutated_scantable, ff_zigzag_direct,
+ c->idsp.idct_permutation);
return 0;
}
@@ -251,7 +251,7 @@ static int jpg_decode_block(JPGContext *c, GetBitContext *gb,
val = get_xbits(gb, nbits);
val *= qmat[ff_zigzag_direct[pos]];
- block[c->scantable.permutated[pos]] = val;
+ block[c->permutated_scantable[pos]] = val;
}
}
return 0;
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 13/24] avcodec/g2meet: Pre-permute quantization tables
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (10 preceding siblings ...)
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 12/24] avcodec/g2meet: Only keep what is used from ScanTable Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 14/24] avcodec/intrax8: Only keep what is used from ScanTable Andreas Rheinhardt
` (11 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Allows to avoid a permutation lateron.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/g2meet.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c
index 1973ed0741..761fd22fc3 100644
--- a/libavcodec/g2meet.c
+++ b/libavcodec/g2meet.c
@@ -59,22 +59,23 @@ enum Compression {
COMPR_KEMPF_J_B,
};
+/* These tables are already permuted according to ff_zigzag_direct */
static const uint8_t luma_quant[64] = {
- 8, 6, 5, 8, 12, 20, 26, 31,
- 6, 6, 7, 10, 13, 29, 30, 28,
- 7, 7, 8, 12, 20, 29, 35, 28,
- 7, 9, 11, 15, 26, 44, 40, 31,
- 9, 11, 19, 28, 34, 55, 52, 39,
- 12, 18, 28, 32, 41, 52, 57, 46,
- 25, 32, 39, 44, 52, 61, 60, 51,
- 36, 46, 48, 49, 56, 50, 52, 50
+ 8, 6, 6, 7, 6, 5, 8, 7,
+ 7, 7, 9, 9, 8, 10, 12, 20,
+ 13, 12, 11, 11, 12, 25, 18, 19,
+ 15, 20, 29, 26, 31, 30, 29, 26,
+ 28, 28, 32, 36, 46, 39, 32, 34,
+ 44, 35, 28, 28, 40, 55, 41, 44,
+ 48, 49, 52, 52, 52, 31, 39, 57,
+ 61, 56, 50, 60, 46, 51, 52, 50,
};
static const uint8_t chroma_quant[64] = {
- 9, 9, 12, 24, 50, 50, 50, 50,
- 9, 11, 13, 33, 50, 50, 50, 50,
- 12, 13, 28, 50, 50, 50, 50, 50,
- 24, 33, 50, 50, 50, 50, 50, 50,
+ 9, 9, 9, 12, 11, 12, 24, 13,
+ 13, 24, 50, 33, 28, 33, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50,
50, 50, 50, 50, 50, 50, 50, 50,
50, 50, 50, 50, 50, 50, 50, 50,
50, 50, 50, 50, 50, 50, 50, 50,
@@ -250,7 +251,7 @@ static int jpg_decode_block(JPGContext *c, GetBitContext *gb,
int nbits = val;
val = get_xbits(gb, nbits);
- val *= qmat[ff_zigzag_direct[pos]];
+ val *= qmat[pos];
block[c->permutated_scantable[pos]] = val;
}
}
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 14/24] avcodec/intrax8: Only keep what is used from ScanTable
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (11 preceding siblings ...)
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 13/24] avcodec/g2meet: Pre-permute quantization tables Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 15/24] avcodec/mdec: " Andreas Rheinhardt
` (10 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Namely ScanTable.permutated.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/intrax8.c | 15 ++++++++-------
libavcodec/intrax8.h | 3 +--
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index f88baf8daf..d6668338fb 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -25,6 +25,7 @@
#include "libavutil/thread.h"
#include "avcodec.h"
#include "get_bits.h"
+#include "idctdsp.h"
#include "msmpeg4data.h"
#include "intrax8huf.h"
#include "intrax8.h"
@@ -576,7 +577,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma)
x8_select_ac_table(w, ac_mode);
/* scantable_selector[12] = { 0, 2, 0, 1, 1, 1, 0, 2, 2, 0, 1, 2 }; <-
* -> 10'01' 00'10' 10'00' 01'01' 01'00' 10'00 => 0x928548 */
- scantable = w->scantable[(0x928548 >> (2 * w->orient)) & 3].permutated;
+ scantable = w->permutated_scantable[(0x928548 >> (2 * w->orient)) & 3];
pos = 0;
do {
n++;
@@ -714,12 +715,12 @@ av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
ff_init_scantable_permutation(w->idct_permutation,
w->wdsp.idct_perm);
- ff_init_scantable(w->idct_permutation, &w->scantable[0],
- ff_wmv1_scantable[0]);
- ff_init_scantable(w->idct_permutation, &w->scantable[1],
- ff_wmv1_scantable[2]);
- ff_init_scantable(w->idct_permutation, &w->scantable[2],
- ff_wmv1_scantable[3]);
+ ff_permute_scantable(w->permutated_scantable[0], ff_wmv1_scantable[0],
+ w->idct_permutation);
+ ff_permute_scantable(w->permutated_scantable[1], ff_wmv1_scantable[2],
+ w->idct_permutation);
+ ff_permute_scantable(w->permutated_scantable[2], ff_wmv1_scantable[3],
+ w->idct_permutation);
ff_intrax8dsp_init(&w->dsp);
ff_blockdsp_init(&w->bdsp);
diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h
index 9ef2fc3dd3..8e22361f1f 100644
--- a/libavcodec/intrax8.h
+++ b/libavcodec/intrax8.h
@@ -21,7 +21,6 @@
#include "blockdsp.h"
#include "get_bits.h"
-#include "idctdsp.h"
#include "intrax8dsp.h"
#include "wmv2dsp.h"
#include "mpegpicture.h"
@@ -35,7 +34,7 @@ typedef struct IntraX8Context {
// set by ff_intrax8_common_init
uint8_t *prediction_table; // 2 * (mb_w * 2)
- ScanTable scantable[3];
+ uint8_t permutated_scantable[3][64];
WMV2DSPContext wdsp;
uint8_t idct_permutation[64];
AVCodecContext *avctx;
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 15/24] avcodec/mdec: Only keep what is used from ScanTable
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (12 preceding siblings ...)
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 14/24] avcodec/intrax8: Only keep what is used from ScanTable Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 16/24] avcodec/mimic: " Andreas Rheinhardt
` (9 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Namely ScanTable.permutated.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mdec.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c
index f27cf84122..a1f85aa0cf 100644
--- a/libavcodec/mdec.c
+++ b/libavcodec/mdec.c
@@ -44,7 +44,7 @@ typedef struct MDECContext {
BswapDSPContext bbdsp;
IDCTDSPContext idsp;
GetBitContext gb;
- ScanTable scantable;
+ uint8_t permutated_scantable[64];
int version;
int qscale;
int last_dc[3];
@@ -64,7 +64,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n)
int level, diff, i, j, run;
int component;
RLTable *rl = &ff_rl_mpeg1;
- uint8_t * const scantable = a->scantable.permutated;
+ const uint8_t *const scantable = a->permutated_scantable;
const uint16_t *quant_matrix = a->quant_matrix;
const int qscale = a->qscale;
@@ -223,8 +223,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
ff_bswapdsp_init(&a->bbdsp);
ff_idctdsp_init(&a->idsp, avctx);
ff_mpeg12_init_vlcs();
- ff_init_scantable(a->idsp.idct_permutation, &a->scantable,
- ff_zigzag_direct);
+ ff_permute_scantable(a->permutated_scantable, ff_zigzag_direct,
+ a->idsp.idct_permutation);
avctx->pix_fmt = AV_PIX_FMT_YUVJ420P;
avctx->color_range = AVCOL_RANGE_JPEG;
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 16/24] avcodec/mimic: Only keep what is used from ScanTable
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (13 preceding siblings ...)
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 15/24] avcodec/mdec: " Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 17/24] avcodec/mjpegdec: " Andreas Rheinhardt
` (8 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Namely ScanTable.permutated.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mimic.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c
index 74eaa7d043..891471b30e 100644
--- a/libavcodec/mimic.c
+++ b/libavcodec/mimic.c
@@ -56,7 +56,7 @@ typedef struct MimicContext {
DECLARE_ALIGNED(32, int16_t, dct_block)[64];
GetBitContext gb;
- ScanTable scantable;
+ uint8_t permutated_scantable[64];
BlockDSPContext bdsp;
BswapDSPContext bbdsp;
HpelDSPContext hdsp;
@@ -137,7 +137,7 @@ static av_cold int mimic_decode_init(AVCodecContext *avctx)
ff_bswapdsp_init(&ctx->bbdsp);
ff_hpeldsp_init(&ctx->hdsp, avctx->flags);
ff_idctdsp_init(&ctx->idsp, avctx);
- ff_init_scantable(ctx->idsp.idct_permutation, &ctx->scantable, col_zag);
+ ff_permute_scantable(ctx->permutated_scantable, col_zag, ctx->idsp.idct_permutation);
for (i = 0; i < FF_ARRAY_ELEMS(ctx->frames); i++) {
ctx->frames[i].f = av_frame_alloc();
@@ -250,7 +250,7 @@ static int vlc_decode_block(MimicContext *ctx, int num_coeffs, int qscale)
else /* TODO Use >> 10 instead of / 1001 */
coeff = (coeff * qscale) / 1001;
- block[ctx->scantable.permutated[pos]] = coeff;
+ block[ctx->permutated_scantable[pos]] = coeff;
}
return 0;
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 17/24] avcodec/mjpegdec: Only keep what is used from ScanTable
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (14 preceding siblings ...)
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 16/24] avcodec/mimic: " Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 18/24] avcodec/mjpegenc_common: Only pass " Andreas Rheinhardt
` (7 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Namely ScanTable.permutated.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mjpegdec.c | 16 ++++++++--------
libavcodec/mjpegdec.h | 2 +-
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 3374ae71bd..9b7465abe7 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -115,8 +115,8 @@ static void init_idct(AVCodecContext *avctx)
MJpegDecodeContext *s = avctx->priv_data;
ff_idctdsp_init(&s->idsp, avctx);
- ff_init_scantable(s->idsp.idct_permutation, &s->scantable,
- ff_zigzag_direct);
+ ff_permute_scantable(s->permutated_scantable, ff_zigzag_direct,
+ s->idsp.idct_permutation);
}
av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
@@ -846,7 +846,7 @@ static int decode_block(MJpegDecodeContext *s, int16_t *block, int component,
av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);
return AVERROR_INVALIDDATA;
}
- j = s->scantable.permutated[i];
+ j = s->permutated_scantable[i];
block[j] = level * quant_matrix[i];
}
} while (i < 63);
@@ -909,14 +909,14 @@ static int decode_block_progressive(MJpegDecodeContext *s, int16_t *block,
if (i >= se) {
if (i == se) {
- j = s->scantable.permutated[se];
+ j = s->permutated_scantable[se];
block[j] = level * (quant_matrix[se] << Al);
break;
}
av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);
return AVERROR_INVALIDDATA;
}
- j = s->scantable.permutated[i];
+ j = s->permutated_scantable[i];
block[j] = level * (quant_matrix[i] << Al);
} else {
if (run == 0xF) {// ZRL - skip 15 coefficients
@@ -964,7 +964,7 @@ for (; ; i++) { \
} \
break; \
} \
- j = s->scantable.permutated[i]; \
+ j = s->permutated_scantable[i]; \
if (block[j]) \
REFINE_BIT(j) \
else if (run-- == 0) \
@@ -994,7 +994,7 @@ static int decode_block_refinement(MJpegDecodeContext *s, int16_t *block,
val = SHOW_UBITS(re, &s->gb, 1);
LAST_SKIP_BITS(re, &s->gb, 1);
ZERO_RUN;
- j = s->scantable.permutated[i];
+ j = s->permutated_scantable[i];
val--;
block[j] = ((quant_matrix[i] << Al) ^ val) - val;
if (i == se) {
@@ -1026,7 +1026,7 @@ static int decode_block_refinement(MJpegDecodeContext *s, int16_t *block,
}
for (; i <= last; i++) {
- j = s->scantable.permutated[i];
+ j = s->permutated_scantable[i];
if (block[j])
REFINE_BIT(j)
}
diff --git a/libavcodec/mjpegdec.h b/libavcodec/mjpegdec.h
index 648dd714e1..2cb218902c 100644
--- a/libavcodec/mjpegdec.h
+++ b/libavcodec/mjpegdec.h
@@ -118,7 +118,7 @@ typedef struct MJpegDecodeContext {
uint64_t coefs_finished[MAX_COMPONENTS]; ///< bitmask of which coefs have been completely decoded (progressive mode)
int palette_index;
int force_pal8;
- ScanTable scantable;
+ uint8_t permutated_scantable[64];
BlockDSPContext bdsp;
HpelDSPContext hdsp;
IDCTDSPContext idsp;
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 18/24] avcodec/mjpegenc_common: Only pass what is used from ScanTable
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (15 preceding siblings ...)
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 17/24] avcodec/mjpegdec: " Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 19/24] avcodec/speedhqdec: Only keep " Andreas Rheinhardt
` (6 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Namely ScanTable.permutated.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mjpegenc.c | 2 +-
libavcodec/mjpegenc_common.c | 10 +++++-----
libavcodec/mjpegenc_common.h | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index e56a466b36..eafe7130e2 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -81,7 +81,7 @@ static av_cold void init_uni_ac_vlc(const uint8_t huff_size_ac[256],
static void mjpeg_encode_picture_header(MpegEncContext *s)
{
ff_mjpeg_encode_picture_header(s->avctx, &s->pb, s->picture->f, s->mjpeg_ctx,
- &s->intra_scantable, 0,
+ s->intra_scantable.permutated, 0,
s->intra_matrix, s->chroma_intra_matrix,
s->slice_context_count > 1);
diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c
index c37c964931..6dfc4469a5 100644
--- a/libavcodec/mjpegenc_common.c
+++ b/libavcodec/mjpegenc_common.c
@@ -58,7 +58,7 @@ static int put_huffman_table(PutBitContext *p, int table_class, int table_id,
static void jpeg_table_header(AVCodecContext *avctx, PutBitContext *p,
MJpegContext *m,
- ScanTable *intra_scantable,
+ const uint8_t intra_matrix_permutation[64],
uint16_t luma_intra_matrix[64],
uint16_t chroma_intra_matrix[64],
int hsample[3], int use_slices, int matrices_differ)
@@ -76,7 +76,7 @@ static void jpeg_table_header(AVCodecContext *avctx, PutBitContext *p,
put_bits(p, 4, 0); /* 8 bit precision */
put_bits(p, 4, 0); /* table 0 */
for (int i = 0; i < 64; i++) {
- uint8_t j = intra_scantable->permutated[i];
+ uint8_t j = intra_matrix_permutation[i];
put_bits(p, 8, luma_intra_matrix[j]);
}
@@ -84,7 +84,7 @@ static void jpeg_table_header(AVCodecContext *avctx, PutBitContext *p,
put_bits(p, 4, 0); /* 8 bit precision */
put_bits(p, 4, 1); /* table 1 */
for(i=0;i<64;i++) {
- j = intra_scantable->permutated[i];
+ j = intra_matrix_permutation[i];
put_bits(p, 8, chroma_intra_matrix[j]);
}
}
@@ -275,7 +275,7 @@ void ff_mjpeg_init_hvsample(AVCodecContext *avctx, int hsample[4], int vsample[4
void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
const AVFrame *frame, struct MJpegContext *m,
- ScanTable *intra_scantable, int pred,
+ const uint8_t intra_matrix_permutation[64], int pred,
uint16_t luma_intra_matrix[64],
uint16_t chroma_intra_matrix[64],
int use_slices)
@@ -298,7 +298,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
chroma_matrix = !lossless && !!memcmp(luma_intra_matrix,
chroma_intra_matrix,
sizeof(luma_intra_matrix[0]) * 64);
- jpeg_table_header(avctx, pb, m, intra_scantable,
+ jpeg_table_header(avctx, pb, m, intra_matrix_permutation,
luma_intra_matrix, chroma_intra_matrix, hsample,
use_slices, chroma_matrix);
diff --git a/libavcodec/mjpegenc_common.h b/libavcodec/mjpegenc_common.h
index 5b13faae23..e9f0ea44a0 100644
--- a/libavcodec/mjpegenc_common.h
+++ b/libavcodec/mjpegenc_common.h
@@ -24,7 +24,6 @@
#include <stdint.h>
#include "avcodec.h"
-#include "idctdsp.h"
#include "put_bits.h"
struct MJpegContext;
@@ -33,7 +32,8 @@ int ff_mjpeg_add_icc_profile_size(AVCodecContext *avctx, const AVFrame *frame,
size_t *max_pkt_size);
void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
const AVFrame *frame, struct MJpegContext *m,
- ScanTable *intra_scantable, int pred,
+ const uint8_t intra_matrix_permutation[64],
+ int pred,
uint16_t luma_intra_matrix[64],
uint16_t chroma_intra_matrix[64],
int use_slices);
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 19/24] avcodec/speedhqdec: Only keep what is used from ScanTable
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (16 preceding siblings ...)
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 18/24] avcodec/mjpegenc_common: Only pass " Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 20/24] avcodec/wmv2dec: Remove unnecessary ScanTables Andreas Rheinhardt
` (5 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Namely ScanTable.permutated.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/speedhqdec.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libavcodec/speedhqdec.c b/libavcodec/speedhqdec.c
index acca437bd5..5378b987dc 100644
--- a/libavcodec/speedhqdec.c
+++ b/libavcodec/speedhqdec.c
@@ -53,7 +53,7 @@
typedef struct SHQContext {
BlockDSPContext bdsp;
IDCTDSPContext idsp;
- ScanTable intra_scantable;
+ uint8_t permutated_intra_scantable[64];
int quant_matrix[64];
enum { SHQ_SUBSAMPLING_420, SHQ_SUBSAMPLING_422, SHQ_SUBSAMPLING_444 }
subsampling;
@@ -137,7 +137,7 @@ static inline int decode_alpha_block(const SHQContext *s, GetBitContext *gb, uin
static inline int decode_dct_block(const SHQContext *s, GetBitContext *gb, int last_dc[4], int component, uint8_t *dest, int linesize)
{
const int *quant_matrix = s->quant_matrix;
- const uint8_t *scantable = s->intra_scantable.permutated;
+ const uint8_t *scantable = s->permutated_intra_scantable;
LOCAL_ALIGNED_32(int16_t, block, [64]);
int dc_offset;
@@ -581,7 +581,8 @@ static av_cold int speedhq_decode_init(AVCodecContext *avctx)
ff_blockdsp_init(&s->bdsp);
ff_idctdsp_init(&s->idsp, avctx);
- ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct);
+ ff_permute_scantable(s->permutated_intra_scantable, ff_zigzag_direct,
+ s->idsp.idct_permutation);
switch (avctx->codec_tag) {
case MKTAG('S', 'H', 'Q', '0'):
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 20/24] avcodec/wmv2dec: Remove unnecessary ScanTables
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (17 preceding siblings ...)
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 19/24] avcodec/speedhqdec: Only keep " Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 21/24] avcodec/idctdsp: Move ScanTable to mpegvideo Andreas Rheinhardt
` (4 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Only ScanTable.scantable is used for the abt_scantables.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/wmv2dec.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index f638b31cec..a70913134c 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -52,7 +52,6 @@ typedef struct WMV2DecContext {
int per_mb_rl_bit;
int skip_type;
- ScanTable abt_scantable[2];
DECLARE_ALIGNED(32, int16_t, abt_block2)[6][64];
} WMV2DecContext;
@@ -425,9 +424,7 @@ static inline int wmv2_decode_inter_block(WMV2DecContext *w, int16_t *block,
w->abt_type_table[n] = w->abt_type;
if (w->abt_type) {
-// const uint8_t *scantable = w->abt_scantable[w->abt_type - 1].permutated;
- const uint8_t *scantable = w->abt_scantable[w->abt_type - 1].scantable;
-// const uint8_t *scantable = w->abt_type - 1 ? w->abt_scantable[1].permutated : w->abt_scantable[0].scantable;
+ const uint8_t *scantable = w->abt_type == 1 ? ff_wmv2_scantableA : ff_wmv2_scantableB;
sub_cbp = sub_cbp_table[decode012(&s->gb)];
@@ -577,10 +574,6 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx)
return ret;
ff_wmv2_common_init(s);
- ff_init_scantable(s->idsp.idct_permutation, &w->abt_scantable[0],
- ff_wmv2_scantableA);
- ff_init_scantable(s->idsp.idct_permutation, &w->abt_scantable[1],
- ff_wmv2_scantableB);
return ff_intrax8_common_init(avctx, &w->x8,
w->s.block, w->s.block_last_index,
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 21/24] avcodec/idctdsp: Move ScanTable to mpegvideo
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (18 preceding siblings ...)
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 20/24] avcodec/wmv2dec: Remove unnecessary ScanTables Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 22/24] avcodec/eatgq: Move transient GetByteContext from context to stack Andreas Rheinhardt
` (3 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Only used there.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/idctdsp.c | 21 ---------------------
libavcodec/idctdsp.h | 11 -----------
libavcodec/mpegvideo.c | 21 +++++++++++++++++++++
libavcodec/mpegvideo.h | 11 +++++++++++
4 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/libavcodec/idctdsp.c b/libavcodec/idctdsp.c
index 50156930ed..7216afb094 100644
--- a/libavcodec/idctdsp.c
+++ b/libavcodec/idctdsp.c
@@ -36,27 +36,6 @@ av_cold void ff_permute_scantable(uint8_t dst[64], const uint8_t src[64],
}
}
-av_cold void ff_init_scantable(const uint8_t *permutation, ScanTable *st,
- const uint8_t *src_scantable)
-{
- int i, end;
-
- st->scantable = src_scantable;
-
- for (i = 0; i < 64; i++) {
- int j = src_scantable[i];
- st->permutated[i] = permutation[j];
- }
-
- end = -1;
- for (i = 0; i < 64; i++) {
- int j = st->permutated[i];
- if (j > end)
- end = j;
- st->raster_end[i] = end;
- }
-}
-
av_cold void ff_init_scantable_permutation(uint8_t *idct_permutation,
enum idct_permutation_type perm_type)
{
diff --git a/libavcodec/idctdsp.h b/libavcodec/idctdsp.h
index b286bc231c..7224463349 100644
--- a/libavcodec/idctdsp.h
+++ b/libavcodec/idctdsp.h
@@ -25,15 +25,6 @@
#include "avcodec.h"
-/**
- * Scantable.
- */
-typedef struct ScanTable {
- const uint8_t *scantable;
- uint8_t permutated[64];
- uint8_t raster_end[64];
-} ScanTable;
-
enum idct_permutation_type {
FF_IDCT_PERM_NONE,
FF_IDCT_PERM_LIBMPEG2,
@@ -45,8 +36,6 @@ enum idct_permutation_type {
void ff_permute_scantable(uint8_t dst[64], const uint8_t src[64],
const uint8_t permutation[64]);
-void ff_init_scantable(const uint8_t *permutation, ScanTable *st,
- const uint8_t *src_scantable);
void ff_init_scantable_permutation(uint8_t *idct_permutation,
enum idct_permutation_type perm_type);
int ff_init_scantable_permutation_x86(uint8_t *idct_permutation,
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index fbe9884b4c..4326f7f9a5 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -320,6 +320,27 @@ static av_cold int dct_init(MpegEncContext *s)
return 0;
}
+av_cold void ff_init_scantable(const uint8_t *permutation, ScanTable *st,
+ const uint8_t *src_scantable)
+{
+ int end;
+
+ st->scantable = src_scantable;
+
+ for (int i = 0; i < 64; i++) {
+ int j = src_scantable[i];
+ st->permutated[i] = permutation[j];
+ }
+
+ end = -1;
+ for (int i = 0; i < 64; i++) {
+ int j = st->permutated[i];
+ if (j > end)
+ end = j;
+ st->raster_end[i] = end;
+ }
+}
+
av_cold void ff_mpv_idct_init(MpegEncContext *s)
{
if (s->codec_id == AV_CODEC_ID_MPEG4)
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 237adf2388..60d2ec751e 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -55,6 +55,15 @@
#define MAX_B_FRAMES 16
+/**
+ * Scantable.
+ */
+typedef struct ScanTable {
+ const uint8_t *scantable;
+ uint8_t permutated[64];
+ uint8_t raster_end[64];
+} ScanTable;
+
/**
* MpegEncContext.
*/
@@ -576,6 +585,8 @@ int ff_update_duplicate_context(MpegEncContext *dst, const MpegEncContext *src);
void ff_set_qscale(MpegEncContext * s, int qscale);
void ff_mpv_idct_init(MpegEncContext *s);
+void ff_init_scantable(const uint8_t *permutation, ScanTable *st,
+ const uint8_t *src_scantable);
void ff_init_block_index(MpegEncContext *s);
void ff_mpv_motion(MpegEncContext *s,
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 22/24] avcodec/eatgq: Move transient GetByteContext from context to stack
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (19 preceding siblings ...)
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 21/24] avcodec/idctdsp: Move ScanTable to mpegvideo Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 23/24] avcodec/mpegvideo: Move ASM-offset warning to its proper place Andreas Rheinhardt
` (2 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/eatgq.c | 39 ++++++++++++++++++++-------------------
1 file changed, 20 insertions(+), 19 deletions(-)
diff --git a/libavcodec/eatgq.c b/libavcodec/eatgq.c
index 627615b4e8..89e9f20880 100644
--- a/libavcodec/eatgq.c
+++ b/libavcodec/eatgq.c
@@ -45,7 +45,6 @@ typedef struct TgqContext {
int width, height;
int qtable[64];
DECLARE_ALIGNED(16, int16_t, block)[6][64];
- GetByteContext gb;
} TgqContext;
static av_cold int tgq_decode_init(AVCodecContext *avctx)
@@ -147,34 +146,35 @@ static void tgq_idct_put_mb_dconly(TgqContext *s, AVFrame *frame,
}
}
-static int tgq_decode_mb(TgqContext *s, AVFrame *frame, int mb_y, int mb_x)
+static int tgq_decode_mb(TgqContext *s, GetByteContext *gbyte,
+ AVFrame *frame, int mb_y, int mb_x)
{
int mode;
int i;
int8_t dc[6];
- mode = bytestream2_get_byte(&s->gb);
+ mode = bytestream2_get_byte(gbyte);
if (mode > 12) {
GetBitContext gb;
- int ret = init_get_bits8(&gb, s->gb.buffer, FFMIN(bytestream2_get_bytes_left(&s->gb), mode));
+ int ret = init_get_bits8(&gb, gbyte->buffer, FFMIN(bytestream2_get_bytes_left(gbyte), mode));
if (ret < 0)
return ret;
for (i = 0; i < 6; i++)
tgq_decode_block(s, s->block[i], &gb);
tgq_idct_put_mb(s, s->block, frame, mb_x, mb_y);
- bytestream2_skip(&s->gb, mode);
+ bytestream2_skip(gbyte, mode);
} else {
if (mode == 3) {
- memset(dc, bytestream2_get_byte(&s->gb), 4);
- dc[4] = bytestream2_get_byte(&s->gb);
- dc[5] = bytestream2_get_byte(&s->gb);
+ memset(dc, bytestream2_get_byte(gbyte), 4);
+ dc[4] = bytestream2_get_byte(gbyte);
+ dc[5] = bytestream2_get_byte(gbyte);
} else if (mode == 6) {
- bytestream2_get_buffer(&s->gb, dc, 6);
+ bytestream2_get_buffer(gbyte, dc, 6);
} else if (mode == 12) {
for (i = 0; i < 6; i++) {
- dc[i] = bytestream2_get_byte(&s->gb);
- bytestream2_skip(&s->gb, 1);
+ dc[i] = bytestream2_get_byte(gbyte);
+ bytestream2_skip(gbyte, 1);
}
} else {
av_log(s->avctx, AV_LOG_ERROR, "unsupported mb mode %i\n", mode);
@@ -202,6 +202,7 @@ static int tgq_decode_frame(AVCodecContext *avctx, AVFrame *frame,
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
TgqContext *s = avctx->priv_data;
+ GetByteContext gbyte;
int x, y, ret;
int big_endian;
@@ -210,21 +211,21 @@ static int tgq_decode_frame(AVCodecContext *avctx, AVFrame *frame,
return AVERROR_INVALIDDATA;
}
big_endian = AV_RL32(&buf[4]) > 0x000FFFFF;
- bytestream2_init(&s->gb, buf + 8, buf_size - 8);
+ bytestream2_init(&gbyte, buf + 8, buf_size - 8);
if (big_endian) {
- s->width = bytestream2_get_be16u(&s->gb);
- s->height = bytestream2_get_be16u(&s->gb);
+ s->width = bytestream2_get_be16u(&gbyte);
+ s->height = bytestream2_get_be16u(&gbyte);
} else {
- s->width = bytestream2_get_le16u(&s->gb);
- s->height = bytestream2_get_le16u(&s->gb);
+ s->width = bytestream2_get_le16u(&gbyte);
+ s->height = bytestream2_get_le16u(&gbyte);
}
ret = ff_set_dimensions(s->avctx, s->width, s->height);
if (ret < 0)
return ret;
- tgq_calculate_qtable(s, bytestream2_get_byteu(&s->gb));
- bytestream2_skip(&s->gb, 3);
+ tgq_calculate_qtable(s, bytestream2_get_byteu(&gbyte));
+ bytestream2_skipu(&gbyte, 3);
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
@@ -233,7 +234,7 @@ static int tgq_decode_frame(AVCodecContext *avctx, AVFrame *frame,
for (y = 0; y < FFALIGN(avctx->height, 16) >> 4; y++)
for (x = 0; x < FFALIGN(avctx->width, 16) >> 4; x++)
- if (tgq_decode_mb(s, frame, y, x) < 0)
+ if (tgq_decode_mb(s, &gbyte, frame, y, x) < 0)
return AVERROR_INVALIDDATA;
*got_frame = 1;
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 23/24] avcodec/mpegvideo: Move ASM-offset warning to its proper place
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (20 preceding siblings ...)
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 22/24] avcodec/eatgq: Move transient GetByteContext from context to stack Andreas Rheinhardt
@ 2022-10-21 20:12 ` Andreas Rheinhardt
2022-10-21 20:13 ` [FFmpeg-devel] [PATCH v2 24/24] avcodec/mpegvideo: Don't use ScanTable where unnecessary Andreas Rheinhardt
2022-10-23 11:17 ` [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:12 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mpegvideo.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 60d2ec751e..6adf724dac 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -77,13 +77,14 @@ typedef struct MpegEncContext {
/* scantables */
ScanTable inter_scantable; ///< if inter == intra then intra should be used to reduce the cache usage
- ScanTable intra_scantable;
- ScanTable intra_h_scantable;
- ScanTable intra_v_scantable;
/* WARNING: changes above this line require updates to hardcoded
* offsets used in ASM. */
+ ScanTable intra_scantable;
+ ScanTable intra_h_scantable;
+ ScanTable intra_v_scantable;
+
struct AVCodecContext *avctx;
/* The following pointer is intended for codecs sharing code
* between decoder and encoder and in need of a common context to do so. */
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* [FFmpeg-devel] [PATCH v2 24/24] avcodec/mpegvideo: Don't use ScanTable where unnecessary
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (21 preceding siblings ...)
2022-10-21 20:12 ` [FFmpeg-devel] [PATCH v2 23/24] avcodec/mpegvideo: Move ASM-offset warning to its proper place Andreas Rheinhardt
@ 2022-10-21 20:13 ` Andreas Rheinhardt
2022-10-23 11:17 ` [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-21 20:13 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
For the intra_[hv]_scantables, only ScanTable.permutated
is used, so one only needs to keep that.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/ituh263dec.c | 4 ++--
libavcodec/mpeg4videodec.c | 28 ++++++++++++++++++----------
libavcodec/mpeg4videoenc.c | 4 ++--
libavcodec/mpegvideo.c | 6 ++++--
libavcodec/mpegvideo.h | 4 ++--
libavcodec/msmpeg4.c | 6 ++++--
libavcodec/msmpeg4dec.c | 4 ++--
libavcodec/wmv2.c | 8 ++++----
8 files changed, 38 insertions(+), 26 deletions(-)
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index 200de8527e..2164cd7346 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -544,9 +544,9 @@ static int h263_decode_block(MpegEncContext * s, int16_t * block,
i = 0;
if (s->ac_pred) {
if (s->h263_aic_dir)
- scan_table = s->intra_v_scantable.permutated; /* left */
+ scan_table = s->permutated_intra_v_scantable; /* left */
else
- scan_table = s->intra_h_scantable.permutated; /* top */
+ scan_table = s->permutated_intra_h_scantable; /* top */
}
} else if (s->mb_intra) {
/* DC coef */
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index c4f268c534..4ab558b46f 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -1327,9 +1327,9 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block,
}
if (s->ac_pred) {
if (dc_pred_dir == 0)
- scan_table = s->intra_v_scantable.permutated; /* left */
+ scan_table = s->permutated_intra_v_scantable; /* left */
else
- scan_table = s->intra_h_scantable.permutated; /* top */
+ scan_table = s->permutated_intra_h_scantable; /* top */
} else {
scan_table = s->intra_scantable.permutated;
}
@@ -3258,13 +3258,17 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb,
if (s->alternate_scan) {
ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_alternate_vertical_scan);
ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_alternate_vertical_scan);
- ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_vertical_scan);
- ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
+ ff_permute_scantable(s->permutated_intra_h_scantable, ff_alternate_vertical_scan,
+ s->idsp.idct_permutation);
+ ff_permute_scantable(s->permutated_intra_v_scantable, ff_alternate_vertical_scan,
+ s->idsp.idct_permutation);
} else {
ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_zigzag_direct);
ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct);
- ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan);
- ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
+ ff_permute_scantable(s->permutated_intra_h_scantable, ff_alternate_horizontal_scan,
+ s->idsp.idct_permutation);
+ ff_permute_scantable(s->permutated_intra_v_scantable, ff_alternate_vertical_scan,
+ s->idsp.idct_permutation);
}
/* Skip at this point when only parsing since the remaining
@@ -3432,13 +3436,17 @@ static int decode_studio_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
if (s->alternate_scan) {
ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_alternate_vertical_scan);
ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_alternate_vertical_scan);
- ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_vertical_scan);
- ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
+ ff_permute_scantable(s->permutated_intra_h_scantable, ff_alternate_vertical_scan,
+ s->idsp.idct_permutation);
+ ff_permute_scantable(s->permutated_intra_v_scantable, ff_alternate_vertical_scan,
+ s->idsp.idct_permutation);
} else {
ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_zigzag_direct);
ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct);
- ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan);
- ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
+ ff_permute_scantable(s->permutated_intra_h_scantable, ff_alternate_horizontal_scan,
+ s->idsp.idct_permutation);
+ ff_permute_scantable(s->permutated_intra_v_scantable, ff_alternate_vertical_scan,
+ s->idsp.idct_permutation);
}
mpeg4_load_default_matrices(s);
diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
index 8e6e35b927..77f960a262 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -175,7 +175,7 @@ static inline int decide_ac_pred(MpegEncContext *s, int16_t block[6][64],
ac_val1[i + 8] = level;
}
}
- st[n] = s->intra_h_scantable.permutated;
+ st[n] = s->permutated_intra_h_scantable;
} else {
const int xy = s->mb_x - 1 + s->mb_y * s->mb_stride;
/* left prediction */
@@ -197,7 +197,7 @@ static inline int decide_ac_pred(MpegEncContext *s, int16_t block[6][64],
ac_val1[i + 8] = block[n][s->idsp.idct_permutation[i]];
}
}
- st[n] = s->intra_v_scantable.permutated;
+ st[n] = s->permutated_intra_v_scantable;
}
for (i = 63; i > 0; i--) // FIXME optimize
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 4326f7f9a5..c436dc8001 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -357,8 +357,10 @@ av_cold void ff_mpv_idct_init(MpegEncContext *s)
ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_zigzag_direct);
ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct);
}
- ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan);
- ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
+ ff_permute_scantable(s->permutated_intra_h_scantable, ff_alternate_horizontal_scan,
+ s->idsp.idct_permutation);
+ ff_permute_scantable(s->permutated_intra_v_scantable, ff_alternate_vertical_scan,
+ s->idsp.idct_permutation);
}
static int init_duplicate_context(MpegEncContext *s)
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 6adf724dac..ccec0dd75f 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -82,8 +82,8 @@ typedef struct MpegEncContext {
* offsets used in ASM. */
ScanTable intra_scantable;
- ScanTable intra_h_scantable;
- ScanTable intra_v_scantable;
+ uint8_t permutated_intra_h_scantable[64];
+ uint8_t permutated_intra_v_scantable[64];
struct AVCodecContext *avctx;
/* The following pointer is intended for codecs sharing code
diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c
index 455436e9c4..3f5dc23130 100644
--- a/libavcodec/msmpeg4.c
+++ b/libavcodec/msmpeg4.c
@@ -150,9 +150,11 @@ av_cold void ff_msmpeg4_common_init(MpegEncContext *s)
if(s->msmpeg4_version>=4){
ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_wmv1_scantable[1]);
- ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_wmv1_scantable[2]);
- ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_wmv1_scantable[3]);
ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_wmv1_scantable[0]);
+ ff_permute_scantable(s->permutated_intra_h_scantable, ff_wmv1_scantable[2],
+ s->idsp.idct_permutation);
+ ff_permute_scantable(s->permutated_intra_v_scantable, ff_wmv1_scantable[3],
+ s->idsp.idct_permutation);
}
//Note the default tables are set in common_init in mpegvideo.c
diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c
index 05a7ed4db6..8e12e1aab2 100644
--- a/libavcodec/msmpeg4dec.c
+++ b/libavcodec/msmpeg4dec.c
@@ -687,9 +687,9 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, int16_t * block,
}
if (s->ac_pred) {
if (dc_pred_dir == 0)
- scan_table = s->intra_v_scantable.permutated; /* left */
+ scan_table = s->permutated_intra_v_scantable; /* left */
else
- scan_table = s->intra_h_scantable.permutated; /* top */
+ scan_table = s->permutated_intra_h_scantable; /* top */
} else {
scan_table = s->intra_scantable.permutated;
}
diff --git a/libavcodec/wmv2.c b/libavcodec/wmv2.c
index 07a5d14f90..543784c813 100644
--- a/libavcodec/wmv2.c
+++ b/libavcodec/wmv2.c
@@ -36,12 +36,12 @@ av_cold void ff_wmv2_common_init(MpegEncContext *s)
w->wdsp.idct_perm);
ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable,
ff_wmv1_scantable[1]);
- ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable,
- ff_wmv1_scantable[2]);
- ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable,
- ff_wmv1_scantable[3]);
ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable,
ff_wmv1_scantable[0]);
+ ff_permute_scantable(s->permutated_intra_h_scantable, ff_wmv1_scantable[2],
+ s->idsp.idct_permutation);
+ ff_permute_scantable(s->permutated_intra_v_scantable, ff_wmv1_scantable[3],
+ s->idsp.idct_permutation);
s->idsp.idct_put = w->wdsp.idct_put;
s->idsp.idct_add = w->wdsp.idct_add;
s->idsp.idct = NULL;
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it
2022-10-21 20:11 [FFmpeg-devel] [PATCH v2 01/24] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt
` (22 preceding siblings ...)
2022-10-21 20:13 ` [FFmpeg-devel] [PATCH v2 24/24] avcodec/mpegvideo: Don't use ScanTable where unnecessary Andreas Rheinhardt
@ 2022-10-23 11:17 ` Andreas Rheinhardt
23 siblings, 0 replies; 26+ messages in thread
From: Andreas Rheinhardt @ 2022-10-23 11:17 UTC (permalink / raw)
To: ffmpeg-devel
Andreas Rheinhardt:
> Currently masked by faan.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> configure | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index 431fa5bf7a..bb61e9a0b8 100755
> --- a/configure
> +++ b/configure
> @@ -2773,6 +2773,7 @@ ac3_fixed_encoder_select="ac3dsp audiodsp mdct me_cmp"
> acelp_kelvin_decoder_select="audiodsp"
> adpcm_g722_decoder_select="g722dsp"
> adpcm_g722_encoder_select="g722dsp"
> +agm_decoder_select="idctdsp"
> aic_decoder_select="golomb idctdsp"
> alac_encoder_select="lpc"
> als_decoder_select="bswapdsp mpeg4audio"
> @@ -2820,7 +2821,7 @@ dxv_decoder_select="lzf texturedsp"
> eac3_decoder_select="ac3_decoder"
> eac3_encoder_select="ac3_encoder"
> eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
> -eatgq_decoder_select="aandcttables"
> +eatgq_decoder_select="aandcttables idctdsp"
> eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
> exr_decoder_deps="zlib"
> exr_encoder_deps="zlib"
> @@ -2859,7 +2860,7 @@ huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp"
> hymt_decoder_select="huffyuv_decoder"
> iac_decoder_select="imc_decoder"
> imc_decoder_select="bswapdsp fft mdct sinewin"
> -imm4_decoder_select="bswapdsp"
> +imm4_decoder_select="bswapdsp idctdsp"
> imm5_decoder_select="h264_decoder hevc_decoder"
> indeo3_decoder_select="hpeldsp"
> indeo4_decoder_select="ividsp"
Will apply this patchset tomorrow unless there are objections.
- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 26+ messages in thread