FFmpeg/libavcodec/x86
Andreas Rheinhardt a064d34a32 avcodec/mpegvideoenc: Add MPVEncContext
Many of the fields of MpegEncContext (which is also used by decoders)
are actually only used by encoders. Therefore this commit adds
a new encoder-only structure and moves all of the encoder-only
fields to it except for those which require more explicit
synchronisation between the main slice context and the other
slice contexts. This synchronisation is currently mainly provided
by ff_update_thread_context() which simply copies most of
the main slice context over the other slice contexts. Fields
which are moved to the new MPVEncContext no longer participate
in this (which is desired, because it is horrible and for the
fields b) below wasteful) which means that some fields can only
be moved when explicit synchronisation code is added in later commits.

More explicitly, this commit moves the following fields:
a) Fields not copied by ff_update_duplicate_context():
dct_error_sum and dct_count; the former does not need synchronisation,
the latter is synchronised in merge_context_after_encode().
b) Fields which do not change after initialisation (these fields
could also be put into MPVMainEncContext at the cost of
an indirection to access them): lambda_table, adaptive_quant,
{luma,chroma}_elim_threshold, new_pic, fdsp, mpvencdsp, pdsp,
{p,b_forw,b_back,b_bidir_forw,b_bidir_back,b_direct,b_field}_mv_table,
[pb]_field_select_table, mb_{type,var,mean}, mc_mb_var, {min,max}_qcoeff,
{inter,intra}_quant_bias, ac_esc_length, the *_vlc_length fields,
the q_{intra,inter,chroma_intra}_matrix{,16}, dct_offset, mb_info,
mjpeg_ctx, rtp_mode, rtp_payload_size, encode_mb, all function
pointers, mpv_flags, quantizer_noise_shaping,
frame_reconstruction_bitfield, error_rate and intra_penalty.
c) Fields which are already (re)set explicitly: The PutBitContexts
pb, tex_pb, pb2; dquant, skipdct, encoding_error, the statistics
fields {mv,i_tex,p_tex,misc,last}_bits and i_count; last_mv_dir,
esc_pos (reset when writing the header).
d) Fields which are only used by encoders not supporting slice
threading for which synchronisation doesn't matter: esc3_level_length
and the remaining mb_info fields.
e) coded_score: This field is only really used when FF_MPV_FLAG_CBP_RD
is set (which implies trellis) and even then it is only used for
non-intra blocks. For these blocks dct_quantize_trellis_c() either
sets coded_score[n] or returns a last_non_zero value of -1
in which case coded_score will be reset in encode_mb_internal().
Therefore no old values are ever used.

The MotionEstContext has not been moved yet.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-26 04:08:33 +01:00
..
h26x
hevc avcodec/x86/hevc/dsp_init: Rename ff_hevc_put_hevc->ff_hevc_put 2025-03-15 02:30:56 +01:00
vvc avcodec/vvcdec: remove vvc prefix for x86 and riscv 2024-12-22 21:00:06 +08:00
aacencdsp.asm x86: aacencdsp: Fix negating signed values in aac_quantize_bands 2025-02-10 14:03:24 +02:00
aacencdsp_init.c x86/aacencdsp: add AVX version of quantize_bands 2024-06-09 12:29:49 -03:00
aacpsdsp.asm
aacpsdsp_init.c
ac3dsp.asm x86/ac3dsp: clear the upper 32 bits for input arguments where needed 2024-04-08 13:45:58 -03:00
ac3dsp_downmix.asm
ac3dsp_init.c
alacdsp.asm
alacdsp_init.c
audiodsp.asm
audiodsp_init.c
blockdsp.asm x86/blockdsp: add sse2 and avx2 versions of fill_block_tab 2024-05-08 21:13:23 -03:00
blockdsp_init.c x86/blockdsp: add sse2 and avx2 versions of fill_block_tab 2024-05-08 21:13:23 -03:00
bswapdsp.asm
bswapdsp_init.c
cabac.h
cavsdsp.c avcodec/x86/constants: Move constants only used by cavsdsp to it 2025-03-14 11:42:41 +01:00
cavsidct.asm
celt_pvq_init.c lavc/opus*: move to opus/ subdir 2024-09-02 11:56:53 +02:00
celt_pvq_search.asm libavcodec: x86: Remove an explicit include of config.asm 2024-10-04 22:57:38 +03:00
cfhddsp.asm
cfhddsp_init.c
cfhdencdsp.asm
cfhdencdsp_init.c
constants.c avcodec/x86/constants: Move constants only used by cavsdsp to it 2025-03-14 11:42:41 +01:00
constants.h avcodec/x86/constants: Move constants only used by cavsdsp to it 2025-03-14 11:42:41 +01:00
dcadsp.asm
dcadsp_init.c
dct32.asm
dirac_dwt.asm
dirac_dwt_init.c
diracdsp.asm avcodec/x86/diracdsp: migrate last remaining MMX function to SSE2 2024-11-15 13:45:52 -05:00
diracdsp_init.c avcodec/x86/diracdsp_init: remove unused macro 2024-11-15 13:46:05 -05:00
dnxhdenc.asm
dnxhdenc_init.c
exrdsp.asm
exrdsp_init.c
fdct.c
fdct.h
fdctdsp_init.c
flac_dsp_gpl.asm
flacdsp.asm x86/flacdsp: remove unused parameters to pmacsdql macro 2024-05-13 12:18:38 -03:00
flacdsp_init.c x86/flacdsp: add an SSE4 version of wasted33 2024-05-13 12:18:10 -03:00
flacencdsp_init.c
fmtconvert.asm
fmtconvert_init.c
fpel.asm
fpel.h
g722dsp.asm
g722dsp_init.c
h263_loopfilter.asm
h263dsp_init.c
h264_cabac.c
h264_chromamc.asm x86: Update x86inc.asm 2024-03-24 14:53:57 +01:00
h264_chromamc_10bit.asm
h264_deblock.asm
h264_deblock_10bit.asm
h264_idct.asm avcodec/x86/h264_idct: Fix incorrect xmm spilling on win64 2024-03-25 21:17:47 +01:00
h264_idct_10bit.asm
h264_intrapred.asm x86: Update x86inc.asm 2024-03-24 14:53:57 +01:00
h264_intrapred_10bit.asm
h264_intrapred_init.c
h264_qpel.c
h264_qpel_8bit.asm
h264_qpel_10bit.asm
h264_weight.asm x86/h264_weight: don't do arithmetic right shift of a 32bit values in 64bit registers 2024-09-01 15:43:18 -03:00
h264_weight_10bit.asm
h264chroma_init.c
h264dsp_init.c
hevcdsp.h avcodec/x86/hevc/dsp_init: Rename ff_hevc_put_hevc->ff_hevc_put 2025-03-15 02:30:56 +01:00
hpeldsp.asm
hpeldsp.h
hpeldsp_init.c
hpeldsp_rnd_template.c
huffyuvdsp.asm
huffyuvdsp_init.c
huffyuvdsp_template.asm
huffyuvencdsp.asm
huffyuvencdsp_init.c
idctdsp.asm
idctdsp.h
idctdsp_init.c
imdct36.asm
inline_asm.h
jpeg2000dsp.asm
jpeg2000dsp_init.c
lossless_audiodsp.asm
lossless_audiodsp_init.c
lossless_videodsp.asm
lossless_videodsp_init.c
lossless_videoencdsp.asm
lossless_videoencdsp_init.c
lpc.asm x86/lpc: remove HAVE_AVX2_EXTERNAL checks 2024-10-06 01:32:49 +02:00
lpc_init.c
Makefile avcodec/hevcdec: remove hevc prefix for x86 asm files 2024-12-22 21:00:06 +08:00
mathops.h
me_cmp.asm avcodec/mpegvideoenc: Add MPVEncContext 2025-03-26 04:08:33 +01:00
me_cmp_init.c avcodec/mpegvideoenc: Add MPVEncContext 2025-03-26 04:08:33 +01:00
mlpdsp.asm
mlpdsp_init.c
mpeg4videodsp.c
mpegaudiodsp.c
mpegvideo.c avcodec/mpegvideo: remove redundant workaround to recalculate last nonzero coefficient 2024-09-03 17:14:24 +02:00
mpegvideoenc.c avcodec/mpegvideoenc: Add MPVEncContext 2025-03-26 04:08:33 +01:00
mpegvideoenc_qns_template.c
mpegvideoenc_template.c avcodec/mpegvideoenc: Add MPVEncContext 2025-03-26 04:08:33 +01:00
mpegvideoencdsp.asm avcodec/mpegvideoencdsp: convert stride parameters from int to ptrdiff_t 2024-09-01 13:42:30 +02:00
mpegvideoencdsp_init.c avcodec/mpegvideoencdsp: convert stride parameters from int to ptrdiff_t 2024-09-01 13:42:30 +02:00
opusdsp.asm opusdsp: add ability to modify deemphasis constant 2024-04-27 11:12:07 +02:00
opusdsp_init.c lavc/opus*: move to opus/ subdir 2024-09-02 11:56:53 +02:00
pixblockdsp.asm
pixblockdsp_init.c
pngdsp.asm
pngdsp_init.c
proresdsp.asm
proresdsp_init.c
qpel.asm
qpeldsp.asm
qpeldsp_init.c
rnd_template.c
rv34dsp.asm
rv34dsp_init.c
rv40dsp.asm x86: Update x86inc.asm 2024-03-24 14:53:57 +01:00
rv40dsp_init.c
sbcdsp.asm
sbcdsp_init.c
sbrdsp.asm x86: Update x86inc.asm 2024-03-24 14:53:57 +01:00
sbrdsp_init.c
simple_idct.asm
simple_idct.h
simple_idct10.asm
simple_idct10_template.asm
snowdsp.c
svq1enc.asm
svq1enc_init.c
synth_filter.asm
synth_filter_init.c
takdsp.asm
takdsp_init.c
ttadsp.asm
ttadsp_init.c
ttaencdsp.asm
ttaencdsp_init.c
utvideodsp.asm
utvideodsp_init.c
v210-init.c
v210.asm
v210enc.asm
v210enc_init.c
vc1dsp.h
vc1dsp_init.c
vc1dsp_loopfilter.asm
vc1dsp_mc.asm
vc1dsp_mmx.c
videodsp.asm lavc/x86/videodsp: Drop MMX usage 2024-12-01 13:26:34 +08:00
videodsp_init.c lavc/x86/videodsp: Drop MMX usage 2024-12-01 13:26:34 +08:00
vorbisdsp.asm
vorbisdsp_init.c
vp3dsp.asm
vp3dsp_init.c avcodec/x86/vp3dsp_init: Set correct function pointer, fix crash 2024-05-02 23:38:15 +02:00
vp6dsp.asm
vp6dsp_init.c
vp8dsp.asm x86: Update x86inc.asm 2024-03-24 14:53:57 +01:00
vp8dsp_init.c
vp8dsp_loopfilter.asm
vp9dsp_init.c
vp9dsp_init.h
vp9dsp_init_10bpp.c
vp9dsp_init_12bpp.c
vp9dsp_init_16bpp.c
vp9dsp_init_16bpp_template.c
vp9intrapred.asm
vp9intrapred_16bpp.asm
vp9itxfm.asm x86: Update x86inc.asm 2024-03-24 14:53:57 +01:00
vp9itxfm_16bpp.asm x86: Update x86inc.asm 2024-03-24 14:53:57 +01:00
vp9itxfm_template.asm
vp9lpf.asm
vp9lpf_16bpp.asm
vp9mc.asm
vp9mc_16bpp.asm
vpx_arith.h
w64xmmtest.c
xvididct.asm
xvididct.h
xvididct_init.c