* [FFmpeg-devel] [PATCH 1/6] avcodec/mpegvideodata: Make DC scale tables smaller @ 2022-10-28 14:48 Andreas Rheinhardt 2022-10-28 14:49 ` [FFmpeg-devel] [PATCH 2/6] avcodec/mpegvideodata: Join mpeg1/2 dc scale tables Andreas Rheinhardt ` (5 more replies) 0 siblings, 6 replies; 7+ messages in thread From: Andreas Rheinhardt @ 2022-10-28 14:48 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Andreas Rheinhardt These tables are only accessed in ff_set_qscale() which only accesses values 1..31 as well as in encode_picture() in mpegvideo_enc.c, accessing the value with index 8. So make these tables smaller. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/mpegvideodata.c | 32 ++++---------------------------- libavcodec/mpegvideodata.h | 2 +- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/libavcodec/mpegvideodata.c b/libavcodec/mpegvideodata.c index da0638e052..b98e90cf43 100644 --- a/libavcodec/mpegvideodata.c +++ b/libavcodec/mpegvideodata.c @@ -30,46 +30,22 @@ const uint8_t ff_mpeg2_non_linear_qscale[32] = { 56, 64, 72, 80, 88, 96, 104, 112, }; -const uint8_t ff_mpeg1_dc_scale_table[128] = { - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, +const uint8_t ff_mpeg1_dc_scale_table[32] = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; -static const uint8_t mpeg2_dc_scale_table1[128] = { - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +static const uint8_t mpeg2_dc_scale_table1[32] = { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, }; -static const uint8_t mpeg2_dc_scale_table2[128] = { - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +static const uint8_t mpeg2_dc_scale_table2[32] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, }; -static const uint8_t mpeg2_dc_scale_table3[128] = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +static const uint8_t mpeg2_dc_scale_table3[32] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; diff --git a/libavcodec/mpegvideodata.h b/libavcodec/mpegvideodata.h index 14f4806d66..cf783ef31c 100644 --- a/libavcodec/mpegvideodata.h +++ b/libavcodec/mpegvideodata.h @@ -25,7 +25,7 @@ extern const uint8_t ff_alternate_horizontal_scan[64]; extern const uint8_t ff_alternate_vertical_scan[64]; -extern const uint8_t ff_mpeg1_dc_scale_table[128]; +extern const uint8_t ff_mpeg1_dc_scale_table[32]; extern const uint8_t * const ff_mpeg2_dc_scale_table[4]; extern const uint8_t ff_mpeg2_non_linear_qscale[32]; -- 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] 7+ messages in thread
* [FFmpeg-devel] [PATCH 2/6] avcodec/mpegvideodata: Join mpeg1/2 dc scale tables 2022-10-28 14:48 [FFmpeg-devel] [PATCH 1/6] avcodec/mpegvideodata: Make DC scale tables smaller Andreas Rheinhardt @ 2022-10-28 14:49 ` Andreas Rheinhardt 2022-10-28 14:49 ` [FFmpeg-devel] [PATCH 3/6] avcodec/mpegvideodata: Mark tables as hidden Andreas Rheinhardt ` (4 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: Andreas Rheinhardt @ 2022-10-28 14:49 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Andreas Rheinhardt Avoids relocations. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/mpeg12enc.c | 2 +- libavcodec/mpegvideo_enc.c | 4 ++-- libavcodec/mpegvideodata.c | 26 +++++++++----------------- libavcodec/mpegvideodata.h | 4 ++-- libavcodec/speedhqenc.c | 2 +- 5 files changed, 15 insertions(+), 23 deletions(-) diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 2db1d93d0e..3ad1cd84a1 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -1148,7 +1148,7 @@ av_cold void ff_mpeg1_encode_init(MpegEncContext *s) static AVOnce init_static_once = AV_ONCE_INIT; s->y_dc_scale_table = - s->c_dc_scale_table = ff_mpeg2_dc_scale_table[s->intra_dc_precision]; + s->c_dc_scale_table = ff_mpeg12_dc_scale_table[s->intra_dc_precision]; s->me.mv_penalty = mv_penalty; s->fcode_tab = fcode_tab; diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index ce363a585d..46be4aad26 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -3736,9 +3736,9 @@ static int encode_picture(MpegEncContext *s, int picture_number) s-> intra_matrix[j] = av_clip_uint8(( luma_matrix[i] * s->qscale) >> 3); } s->y_dc_scale_table= - s->c_dc_scale_table= ff_mpeg2_dc_scale_table[s->intra_dc_precision]; + s->c_dc_scale_table = ff_mpeg12_dc_scale_table[s->intra_dc_precision]; s->chroma_intra_matrix[0] = - s->intra_matrix[0] = ff_mpeg2_dc_scale_table[s->intra_dc_precision][8]; + s->intra_matrix[0] = ff_mpeg12_dc_scale_table[s->intra_dc_precision][8]; ff_convert_matrix(s, s->q_intra_matrix, s->q_intra_matrix16, s->intra_matrix, s->intra_quant_bias, 8, 8, 1); ff_convert_matrix(s, s->q_chroma_intra_matrix, s->q_chroma_intra_matrix16, diff --git a/libavcodec/mpegvideodata.c b/libavcodec/mpegvideodata.c index b98e90cf43..68ad84276e 100644 --- a/libavcodec/mpegvideodata.c +++ b/libavcodec/mpegvideodata.c @@ -30,31 +30,23 @@ const uint8_t ff_mpeg2_non_linear_qscale[32] = { 56, 64, 72, 80, 88, 96, 104, 112, }; -const uint8_t ff_mpeg1_dc_scale_table[32] = { +const uint8_t ff_mpeg12_dc_scale_table[4][32] = { +{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, -}; - -static const uint8_t mpeg2_dc_scale_table1[32] = { +}, +{ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, -}; - -static const uint8_t mpeg2_dc_scale_table2[32] = { +}, +{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -}; - -static const uint8_t mpeg2_dc_scale_table3[32] = { +}, +{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -}; - -const uint8_t *const ff_mpeg2_dc_scale_table[4] = { - ff_mpeg1_dc_scale_table, - mpeg2_dc_scale_table1, - mpeg2_dc_scale_table2, - mpeg2_dc_scale_table3, +}, }; const uint8_t ff_alternate_horizontal_scan[64] = { diff --git a/libavcodec/mpegvideodata.h b/libavcodec/mpegvideodata.h index cf783ef31c..7264b434ae 100644 --- a/libavcodec/mpegvideodata.h +++ b/libavcodec/mpegvideodata.h @@ -25,8 +25,8 @@ extern const uint8_t ff_alternate_horizontal_scan[64]; extern const uint8_t ff_alternate_vertical_scan[64]; -extern const uint8_t ff_mpeg1_dc_scale_table[32]; -extern const uint8_t * const ff_mpeg2_dc_scale_table[4]; +extern const uint8_t ff_mpeg12_dc_scale_table[4][32]; +static const uint8_t *const ff_mpeg1_dc_scale_table = ff_mpeg12_dc_scale_table[0]; extern const uint8_t ff_mpeg2_non_linear_qscale[32]; diff --git a/libavcodec/speedhqenc.c b/libavcodec/speedhqenc.c index 65e66afae4..7269e345d3 100644 --- a/libavcodec/speedhqenc.c +++ b/libavcodec/speedhqenc.c @@ -115,7 +115,7 @@ av_cold int ff_speedhq_encode_init(MpegEncContext *s) s->intra_chroma_ac_vlc_last_length = uni_speedhq_ac_vlc_len; s->y_dc_scale_table = - s->c_dc_scale_table = ff_mpeg2_dc_scale_table[3]; + s->c_dc_scale_table = ff_mpeg12_dc_scale_table[3]; switch (s->avctx->pix_fmt) { case AV_PIX_FMT_YUV420P: -- 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] 7+ messages in thread
* [FFmpeg-devel] [PATCH 3/6] avcodec/mpegvideodata: Mark tables as hidden 2022-10-28 14:48 [FFmpeg-devel] [PATCH 1/6] avcodec/mpegvideodata: Make DC scale tables smaller Andreas Rheinhardt 2022-10-28 14:49 ` [FFmpeg-devel] [PATCH 2/6] avcodec/mpegvideodata: Join mpeg1/2 dc scale tables Andreas Rheinhardt @ 2022-10-28 14:49 ` Andreas Rheinhardt 2022-10-28 14:49 ` [FFmpeg-devel] [PATCH 4/6] avcodec/flvdec, intelh263dec: Remove redundant assignments Andreas Rheinhardt ` (3 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: Andreas Rheinhardt @ 2022-10-28 14:49 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Andreas Rheinhardt This e.g. allows compilers to bake the offset implied by using ff_mpeg12_dc_scale_table[3] (as the SpeedHQ encoder does) into the general offset; for certain arches this is also necessary in order to avoid building suboptimal code. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/mpegvideodata.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/mpegvideodata.h b/libavcodec/mpegvideodata.h index 7264b434ae..42c9d6c293 100644 --- a/libavcodec/mpegvideodata.h +++ b/libavcodec/mpegvideodata.h @@ -21,6 +21,9 @@ #include <stdint.h> +#include "libavutil/attributes_internal.h" + +FF_VISIBILITY_PUSH_HIDDEN /* encoding scans */ extern const uint8_t ff_alternate_horizontal_scan[64]; extern const uint8_t ff_alternate_vertical_scan[64]; @@ -31,5 +34,6 @@ static const uint8_t *const ff_mpeg1_dc_scale_table = ff_mpeg12_dc_scale_table[0 extern const uint8_t ff_mpeg2_non_linear_qscale[32]; extern const uint8_t ff_default_chroma_qscale_table[32]; +FF_VISIBILITY_POP_HIDDEN #endif /* AVCODEC_MPEGVIDEODATA_H */ -- 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] 7+ messages in thread
* [FFmpeg-devel] [PATCH 4/6] avcodec/flvdec, intelh263dec: Remove redundant assignments 2022-10-28 14:48 [FFmpeg-devel] [PATCH 1/6] avcodec/mpegvideodata: Make DC scale tables smaller Andreas Rheinhardt 2022-10-28 14:49 ` [FFmpeg-devel] [PATCH 2/6] avcodec/mpegvideodata: Join mpeg1/2 dc scale tables Andreas Rheinhardt 2022-10-28 14:49 ` [FFmpeg-devel] [PATCH 3/6] avcodec/mpegvideodata: Mark tables as hidden Andreas Rheinhardt @ 2022-10-28 14:49 ` Andreas Rheinhardt 2022-10-28 14:49 ` [FFmpeg-devel] [PATCH 5/6] avcodec/rv34: Remove always-true/false checks Andreas Rheinhardt ` (2 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: Andreas Rheinhardt @ 2022-10-28 14:49 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Andreas Rheinhardt ff_mpeg1_dc_scale_table is the default value for [yc]_dc_scale_table (as set by ff_mpv_common_defaults()). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/flvdec.c | 2 -- libavcodec/intelh263dec.c | 3 --- 2 files changed, 5 deletions(-) diff --git a/libavcodec/flvdec.c b/libavcodec/flvdec.c index 87c5e923ea..09fefd3d1c 100644 --- a/libavcodec/flvdec.c +++ b/libavcodec/flvdec.c @@ -108,8 +108,6 @@ int ff_flv_decode_picture_header(MpegEncContext *s) s->h263_flv - 1, s->qscale, s->picture_number); } - s->y_dc_scale_table = s->c_dc_scale_table = ff_mpeg1_dc_scale_table; - return 0; } diff --git a/libavcodec/intelh263dec.c b/libavcodec/intelh263dec.c index 453b93f16c..2c216b00a6 100644 --- a/libavcodec/intelh263dec.c +++ b/libavcodec/intelh263dec.c @@ -122,9 +122,6 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s) return AVERROR_INVALIDDATA; s->f_code = 1; - s->y_dc_scale_table= - s->c_dc_scale_table= ff_mpeg1_dc_scale_table; - ff_h263_show_pict_info(s); 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] 7+ messages in thread
* [FFmpeg-devel] [PATCH 5/6] avcodec/rv34: Remove always-true/false checks 2022-10-28 14:48 [FFmpeg-devel] [PATCH 1/6] avcodec/mpegvideodata: Make DC scale tables smaller Andreas Rheinhardt ` (2 preceding siblings ...) 2022-10-28 14:49 ` [FFmpeg-devel] [PATCH 4/6] avcodec/flvdec, intelh263dec: Remove redundant assignments Andreas Rheinhardt @ 2022-10-28 14:49 ` Andreas Rheinhardt 2022-10-28 14:49 ` [FFmpeg-devel] [PATCH 6/6] avcodec/vc1data: Mark tables as hidden Andreas Rheinhardt 2022-10-30 11:13 ` [FFmpeg-devel] [PATCH 1/6] avcodec/mpegvideodata: Make DC scale tables smaller Andreas Rheinhardt 5 siblings, 0 replies; 7+ messages in thread From: Andreas Rheinhardt @ 2022-10-28 14:49 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Andreas Rheinhardt low_delay is always zero for rv34. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/rv34.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index acf77d103d..be188edc47 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -1568,7 +1568,7 @@ static int finish_frame(AVCodecContext *avctx, AVFrame *pict) if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) ff_thread_report_progress(&s->current_picture_ptr->tf, INT_MAX, 0); - if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { + if (s->pict_type == AV_PICTURE_TYPE_B) { if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0) return ret; ff_print_debug_info(s, s->current_picture_ptr, pict); @@ -1613,7 +1613,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, /* no supplementary picture */ if (buf_size == 0) { /* special case for last picture */ - if (s->low_delay==0 && s->next_picture_ptr) { + if (s->next_picture_ptr) { if ((ret = av_frame_ref(pict, s->next_picture_ptr->f)) < 0) return ret; s->next_picture_ptr = 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] 7+ messages in thread
* [FFmpeg-devel] [PATCH 6/6] avcodec/vc1data: Mark tables as hidden 2022-10-28 14:48 [FFmpeg-devel] [PATCH 1/6] avcodec/mpegvideodata: Make DC scale tables smaller Andreas Rheinhardt ` (3 preceding siblings ...) 2022-10-28 14:49 ` [FFmpeg-devel] [PATCH 5/6] avcodec/rv34: Remove always-true/false checks Andreas Rheinhardt @ 2022-10-28 14:49 ` Andreas Rheinhardt 2022-10-30 11:13 ` [FFmpeg-devel] [PATCH 1/6] avcodec/mpegvideodata: Make DC scale tables smaller Andreas Rheinhardt 5 siblings, 0 replies; 7+ messages in thread From: Andreas Rheinhardt @ 2022-10-28 14:49 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Andreas Rheinhardt This e.g. allows compilers to bake the offset implied by using ff_vc1_b_field_mvpred_scales[3] into the general offset; for certain arches this is also necessary in order to avoid building suboptimal code. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/vc1data.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/vc1data.h b/libavcodec/vc1data.h index 90dd8baf61..3512dc169b 100644 --- a/libavcodec/vc1data.h +++ b/libavcodec/vc1data.h @@ -30,10 +30,12 @@ #include <stdint.h> +#include "libavutil/attributes_internal.h" #include "libavutil/rational.h" #include "vlc.h" +FF_VISIBILITY_PUSH_HIDDEN /** Table for conversion between TTBLK and TTMB */ extern const int ff_vc1_ttblk_to_tt[3][8]; @@ -204,5 +206,6 @@ extern const uint16_t ff_vc1_b_field_mvpred_scales[7][4]; #define AC_MODES 8 extern const int ff_vc1_ac_sizes[AC_MODES]; +FF_VISIBILITY_POP_HIDDEN #endif /* AVCODEC_VC1DATA_H */ -- 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] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/6] avcodec/mpegvideodata: Make DC scale tables smaller 2022-10-28 14:48 [FFmpeg-devel] [PATCH 1/6] avcodec/mpegvideodata: Make DC scale tables smaller Andreas Rheinhardt ` (4 preceding siblings ...) 2022-10-28 14:49 ` [FFmpeg-devel] [PATCH 6/6] avcodec/vc1data: Mark tables as hidden Andreas Rheinhardt @ 2022-10-30 11:13 ` Andreas Rheinhardt 5 siblings, 0 replies; 7+ messages in thread From: Andreas Rheinhardt @ 2022-10-30 11:13 UTC (permalink / raw) To: ffmpeg-devel Andreas Rheinhardt: > These tables are only accessed in ff_set_qscale() > which only accesses values 1..31 as well as in > encode_picture() in mpegvideo_enc.c, accessing > the value with index 8. So make these tables smaller. > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> > --- > libavcodec/mpegvideodata.c | 32 ++++---------------------------- > libavcodec/mpegvideodata.h | 2 +- > 2 files changed, 5 insertions(+), 29 deletions(-) > > diff --git a/libavcodec/mpegvideodata.c b/libavcodec/mpegvideodata.c > index da0638e052..b98e90cf43 100644 > --- a/libavcodec/mpegvideodata.c > +++ b/libavcodec/mpegvideodata.c > @@ -30,46 +30,22 @@ const uint8_t ff_mpeg2_non_linear_qscale[32] = { > 56, 64, 72, 80, 88, 96, 104, 112, > }; > > -const uint8_t ff_mpeg1_dc_scale_table[128] = { > - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, > - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, > - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, > - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, > - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, > - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, > +const uint8_t ff_mpeg1_dc_scale_table[32] = { > 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, > 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, > }; > > -static const uint8_t mpeg2_dc_scale_table1[128] = { > - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, > - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, > - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, > - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, > - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, > - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, > +static const uint8_t mpeg2_dc_scale_table1[32] = { > 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, > 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, > }; > > -static const uint8_t mpeg2_dc_scale_table2[128] = { > - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, > - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, > - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, > - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, > - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, > - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, > +static const uint8_t mpeg2_dc_scale_table2[32] = { > 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, > 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, > }; > > -static const uint8_t mpeg2_dc_scale_table3[128] = { > - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > +static const uint8_t mpeg2_dc_scale_table3[32] = { > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > }; > diff --git a/libavcodec/mpegvideodata.h b/libavcodec/mpegvideodata.h > index 14f4806d66..cf783ef31c 100644 > --- a/libavcodec/mpegvideodata.h > +++ b/libavcodec/mpegvideodata.h > @@ -25,7 +25,7 @@ > extern const uint8_t ff_alternate_horizontal_scan[64]; > extern const uint8_t ff_alternate_vertical_scan[64]; > > -extern const uint8_t ff_mpeg1_dc_scale_table[128]; > +extern const uint8_t ff_mpeg1_dc_scale_table[32]; > extern const uint8_t * const ff_mpeg2_dc_scale_table[4]; > > extern const uint8_t ff_mpeg2_non_linear_qscale[32]; 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] 7+ messages in thread
end of thread, other threads:[~2022-10-30 11:13 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-10-28 14:48 [FFmpeg-devel] [PATCH 1/6] avcodec/mpegvideodata: Make DC scale tables smaller Andreas Rheinhardt 2022-10-28 14:49 ` [FFmpeg-devel] [PATCH 2/6] avcodec/mpegvideodata: Join mpeg1/2 dc scale tables Andreas Rheinhardt 2022-10-28 14:49 ` [FFmpeg-devel] [PATCH 3/6] avcodec/mpegvideodata: Mark tables as hidden Andreas Rheinhardt 2022-10-28 14:49 ` [FFmpeg-devel] [PATCH 4/6] avcodec/flvdec, intelh263dec: Remove redundant assignments Andreas Rheinhardt 2022-10-28 14:49 ` [FFmpeg-devel] [PATCH 5/6] avcodec/rv34: Remove always-true/false checks Andreas Rheinhardt 2022-10-28 14:49 ` [FFmpeg-devel] [PATCH 6/6] avcodec/vc1data: Mark tables as hidden Andreas Rheinhardt 2022-10-30 11:13 ` [FFmpeg-devel] [PATCH 1/6] avcodec/mpegvideodata: Make DC scale tables smaller Andreas Rheinhardt
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