@@ -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;
@@ -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,
@@ -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] = {
@@ -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];
@@ -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:
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(-)