You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/mpegvideo_enc: Move default_mv_penalty to h261enc.c
MPEG-1/2 and the H.263-based encoders overwrite the default later and SpeedHQ and MJPEG-based encoders are intra-only and don't need a mv_penalty table at all. So only H.261 uses this table. Also add a comment to explain why it exists and is non-const. Reviewed-by: Ramiro Polla <ramiro.polla@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -46,6 +46,10 @@ static struct VLCLUT {
|
|||||||
uint16_t code;
|
uint16_t code;
|
||||||
} vlc_lut[H261_MAX_RUN + 1][32 /* 0..2 * H261_MAX_LEN are used */];
|
} vlc_lut[H261_MAX_RUN + 1][32 /* 0..2 * H261_MAX_LEN are used */];
|
||||||
|
|
||||||
|
// Not const despite never being initialized because doing so would
|
||||||
|
// put it into .rodata instead of .bss and bloat the binary.
|
||||||
|
// mv_penalty exists so that the motion estimation code can avoid branches.
|
||||||
|
static uint8_t mv_penalty[MAX_FCODE + 1][MAX_DMV * 2 + 1];
|
||||||
static uint8_t uni_h261_rl_len [64 * 128];
|
static uint8_t uni_h261_rl_len [64 * 128];
|
||||||
static uint8_t uni_h261_rl_len_last[64 * 128];
|
static uint8_t uni_h261_rl_len_last[64 * 128];
|
||||||
static uint8_t h261_mv_codes[64][2];
|
static uint8_t h261_mv_codes[64][2];
|
||||||
@ -370,6 +374,8 @@ av_cold int ff_h261_encode_init(MpegEncContext *s)
|
|||||||
s->max_qcoeff = 127;
|
s->max_qcoeff = 127;
|
||||||
s->ac_esc_length = H261_ESC_LEN;
|
s->ac_esc_length = H261_ESC_LEN;
|
||||||
|
|
||||||
|
s->me.mv_penalty = mv_penalty;
|
||||||
|
|
||||||
s->intra_ac_vlc_length = s->inter_ac_vlc_length = uni_h261_rl_len;
|
s->intra_ac_vlc_length = s->inter_ac_vlc_length = uni_h261_rl_len;
|
||||||
s->intra_ac_vlc_last_length = s->inter_ac_vlc_last_length = uni_h261_rl_len_last;
|
s->intra_ac_vlc_last_length = s->inter_ac_vlc_last_length = uni_h261_rl_len_last;
|
||||||
ff_thread_once(&init_static_once, h261_encode_init_static);
|
ff_thread_once(&init_static_once, h261_encode_init_static);
|
||||||
|
@ -93,7 +93,6 @@ static int dct_quantize_c(MpegEncContext *s,
|
|||||||
int qscale, int *overflow);
|
int qscale, int *overflow);
|
||||||
static int dct_quantize_trellis_c(MpegEncContext *s, int16_t *block, int n, int qscale, int *overflow);
|
static int dct_quantize_trellis_c(MpegEncContext *s, int16_t *block, int n, int qscale, int *overflow);
|
||||||
|
|
||||||
static uint8_t default_mv_penalty[MAX_FCODE + 1][MAX_DMV * 2 + 1];
|
|
||||||
static uint8_t default_fcode_tab[MAX_MV * 2 + 1];
|
static uint8_t default_fcode_tab[MAX_MV * 2 + 1];
|
||||||
|
|
||||||
static const AVOption mpv_generic_options[] = {
|
static const AVOption mpv_generic_options[] = {
|
||||||
@ -287,7 +286,6 @@ static void mpv_encode_defaults(MpegEncContext *s)
|
|||||||
|
|
||||||
ff_thread_once(&init_static_once, mpv_encode_init_static);
|
ff_thread_once(&init_static_once, mpv_encode_init_static);
|
||||||
|
|
||||||
s->me.mv_penalty = default_mv_penalty;
|
|
||||||
s->fcode_tab = default_fcode_tab;
|
s->fcode_tab = default_fcode_tab;
|
||||||
|
|
||||||
s->input_picture_number = 0;
|
s->input_picture_number = 0;
|
||||||
|
Reference in New Issue
Block a user