From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH 24/24] avcodec/mpegvideo: Don't use ScanTable where unnecessary Date: Thu, 20 Oct 2022 19:24:36 +0200 Message-ID: <AS8P250MB0744FCF99B3F9CD3872FAE168F2A9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw) In-Reply-To: <AS8P250MB0744A863420578904013459B8F2A9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> 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..2655d026cd 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->intra_v_scantable; /* left */ else - scan_table = s->intra_h_scantable.permutated; /* top */ + scan_table = s->intra_h_scantable; /* top */ } } else if (s->mb_intra) { /* DC coef */ diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index c4f268c534..6fbf4e4220 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->intra_v_scantable; /* left */ else - scan_table = s->intra_h_scantable.permutated; /* top */ + scan_table = s->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->intra_h_scantable, ff_alternate_vertical_scan, + s->idsp.idct_permutation); + ff_permute_scantable(s->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->intra_h_scantable, ff_alternate_horizontal_scan, + s->idsp.idct_permutation); + ff_permute_scantable(s->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->intra_h_scantable, ff_alternate_vertical_scan, + s->idsp.idct_permutation); + ff_permute_scantable(s->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->intra_h_scantable, ff_alternate_horizontal_scan, + s->idsp.idct_permutation); + ff_permute_scantable(s->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..bf499a2206 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->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->intra_v_scantable; } for (i = 63; i > 0; i--) // FIXME optimize diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 4326f7f9a5..cdcf06fe85 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->intra_h_scantable, ff_alternate_horizontal_scan, + s->idsp.idct_permutation); + ff_permute_scantable(s->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..7ba9af3923 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 intra_h_scantable[64]; + uint8_t 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..a0725c44fa 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->intra_h_scantable, ff_wmv1_scantable[2], + s->idsp.idct_permutation); + ff_permute_scantable(s->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..098fc55d2b 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->intra_v_scantable; /* left */ else - scan_table = s->intra_h_scantable.permutated; /* top */ + scan_table = s->intra_h_scantable; /* top */ } else { scan_table = s->intra_scantable.permutated; } diff --git a/libavcodec/wmv2.c b/libavcodec/wmv2.c index 07a5d14f90..9772035b5b 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->intra_h_scantable, ff_wmv1_scantable[2], + s->idsp.idct_permutation); + ff_permute_scantable(s->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".
next prev parent reply other threads:[~2022-10-20 17:24 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-10-20 8:31 [FFmpeg-devel] [PATCH 01/22] configure: Add idctdsp dependency to codecs that need it Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 02/22] avcodec/eamad: Don't use IDCTDSP-API unnecessarily Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 03/22] avcodec/eatgq: " Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 04/22] avcodec/eatqi: " Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 05/22] avcodec/aic: Remove useless ScanTable Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 06/22] avcodec/imm4: " Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 07/22] avcodec/idctdsp: Add function to apply permutation to array Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 08/22] avcodec/agm: Only keep what is used from ScanTable Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 09/22] avcodec/asvdec: " Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 10/22] avcodec/dnxhddec: " Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 11/22] avcodec/cavs: Only keep what is needed from IDCTDSP-API Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 12/22] avcodec/g2meet: Only keep what is used from ScanTable Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 13/22] avcodec/g2meet: Pre-permute quantization tables Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 14/22] avcodec/intrax8: Only keep what is used from ScanTable Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 15/22] avcodec/mdec: " Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 16/22] avcodec/mimic: " Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 17/22] avcodec/mjpegdec: " Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 18/22] avcodec/mjpegenc_common: Only pass " Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 19/22] avcodec/speedhq: Only keep " Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 20/22] avcodec/wmv2dec: Remove unnecessary ScanTables Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 21/22] avcodec/idctdsp: Move ScanTable to mpegvideo Andreas Rheinhardt 2022-10-20 8:45 ` [FFmpeg-devel] [PATCH 22/22] avcodec/eatgq: Move transient GetByteContext from context to stack Andreas Rheinhardt 2022-10-20 17:24 ` [FFmpeg-devel] [PATCH 23/24] avcodec/mpegvideo: Move ASM-offset warning to its proper place Andreas Rheinhardt 2022-10-20 17:24 ` Andreas Rheinhardt [this message] 2022-10-21 18:46 ` [FFmpeg-devel] [PATCH 24/24] avcodec/mpegvideo: Don't use ScanTable where unnecessary Michael Niedermayer 2022-10-21 19:00 ` Andreas Rheinhardt
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=AS8P250MB0744FCF99B3F9CD3872FAE168F2A9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \ --to=andreas.rheinhardt@outlook.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git