ffmpeg/libavcodec/riscv
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 Fix the tail handling in R-V V sad 2025-01-25 09:37:45 +02:00
vvc Fix the tail handling in R-V V sad 2025-01-25 09:37:45 +02:00
aacencdsp_init.c lavc/riscv: depend on RVB and simplify accordingly 2024-08-05 21:16:26 +03:00
aacencdsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
aacpsdsp_init.c lavc/riscv: depend on RVB and simplify accordingly 2024-08-05 21:16:26 +03:00
aacpsdsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
ac3dsp_init.c lavc/ac3dsp: fix R-V HAVE_RVV scope issue 2025-01-13 23:58:54 +08:00
ac3dsp_rvb.S riscv: remove unnecessary #include's 2024-11-25 19:29:21 +02:00
ac3dsp_rvv.S riscv: remove unnecessary #include's 2024-11-25 19:29:21 +02:00
ac3dsp_rvvb.S riscv: remove unnecessary #include's 2024-11-25 19:29:21 +02:00
alacdsp_init.c lavc/riscv: depend on RVB and simplify accordingly 2024-08-05 21:16:26 +03:00
alacdsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
audiodsp_init.c lavc/riscv: depend on RVB and simplify accordingly 2024-08-05 21:16:26 +03:00
audiodsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
blockdsp_init.c lavc/riscv: use ff_rv_vlen_least() 2024-05-13 18:36:07 +03:00
blockdsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
bswapdsp_init.c lavc/bswapdsp: add RV Zvbb bswap16 and bswap32 2024-08-01 18:43:04 +03:00
bswapdsp_rvb.S riscv: remove unnecessary #include's 2024-11-25 19:29:21 +02:00
bswapdsp_rvv.S riscv: remove unnecessary #include's 2024-11-25 19:29:21 +02:00
bswapdsp_rvvb.S riscv: remove unnecessary #include's 2024-11-25 19:29:21 +02:00
cpu_common.c riscv: probe for Zbb extension at load time 2024-06-11 20:12:37 +03:00
exrdsp_init.c lavc/riscv: depend on RVB and simplify accordingly 2024-08-05 21:16:26 +03:00
exrdsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
fixed_vtype.S lavc/riscv: require B or zba explicitly 2024-07-25 18:55:48 +03:00
flacdsp_init.c lavc/riscv: depend on RVB and simplify accordingly 2024-08-05 21:16:26 +03:00
flacdsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
fmtconvert_init.c lavc/riscv: depend on RVB and simplify accordingly 2024-08-05 21:16:26 +03:00
fmtconvert_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
g722dsp_init.c lavc/riscv: use ff_rv_vlen_least() 2024-05-13 18:36:07 +03:00
g722dsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
h263dsp_init.c lavc/h263dsp: R-V V {h,v}_loop_filter 2024-05-22 19:15:39 +03:00
h263dsp_rvv.S lavc/riscv: don't set vxrm if unnecessary 2024-07-28 17:37:21 +03:00
h264_chroma_init_riscv.c lavc/riscv: depend on RVB and simplify accordingly 2024-08-05 21:16:26 +03:00
h264_mc_chroma.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
h264addpx_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
h264dsp_init.c lavc/h264dsp: R-V V intra loop filter 2024-12-17 09:00:28 +02:00
h264dsp_rvv.S lavc/h264dsp: R-V V intra loop filter 2024-12-17 09:00:28 +02:00
h264idct_rvv.S lavc/h264idct: fix compilation for RV32IMA 2024-11-25 19:29:21 +02:00
h264qpel_init.c avcodec/riscv: add h264 qpel 2024-09-28 18:35:35 +02:00
h264qpel_rvv.S avcodec/riscv: add h264 qpel 2024-09-28 18:35:35 +02:00
hevcdsp_init.c lavc/hevc: R-V V put_pixels(pow2) 2024-12-17 09:21:20 +08:00
huffyuvdsp_init.c lavc/riscv: depend on RVB and simplify accordingly 2024-08-05 21:16:26 +03:00
huffyuvdsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
idctdsp_init.c lavc/riscv: use ff_rv_vlen_least() 2024-05-13 18:36:07 +03:00
idctdsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
jpeg2000dsp_init.c lavc/riscv: depend on RVB and simplify accordingly 2024-08-05 21:16:26 +03:00
jpeg2000dsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
llauddsp_init.c lavc/riscv: depend on RVB and simplify accordingly 2024-08-05 21:16:26 +03:00
llauddsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
llviddsp_init.c
llviddsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
llvidencdsp_init.c
llvidencdsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
lpc_init.c lavc/riscv: depend on RVB and simplify accordingly 2024-08-05 21:16:26 +03:00
lpc_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
Makefile lavc/hevc: R-V V put_pixels(pow2) 2024-12-17 09:21:20 +08:00
me_cmp_init.c avcodec/mpegvideoenc: Add MPVEncContext 2025-03-26 04:08:33 +01:00
me_cmp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
mpegvideoencdsp_init.c avcodec/mpegvideoencdsp: convert stride parameters from int to ptrdiff_t 2024-09-01 13:42:30 +02:00
mpegvideoencdsp_rvv.S lavc/mpegvideoencdsp: R-V V add_8x8basis 2024-08-19 22:41:13 +03:00
opusdsp_init.c lavc/opus*: move to opus/ subdir 2024-09-02 11:56:53 +02:00
opusdsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
pixblockdsp_init.c lavc/pixblockdsp: fix compilation for RV32IMA 2024-11-25 19:29:21 +02:00
pixblockdsp_rvi.S lavc/pixblockdsp: fix compilation for RV32IMA 2024-11-25 19:29:21 +02:00
pixblockdsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
rv34dsp_init.c lavc/riscv: use ff_rv_vlen_least() 2024-05-13 18:36:07 +03:00
rv34dsp_rvv.S lavc/rv34dsp: use saturating add/sub for R-V V DC add 2024-08-01 18:43:04 +03:00
rv40dsp_init.c lavc/riscv: depend on RVB and simplify accordingly 2024-08-05 21:16:26 +03:00
rv40dsp_rvv.S lavc/rv40dsp: fix RISC-V chroma_mc 2024-12-10 11:24:45 -05:00
sbrdsp_init.c lavc/riscv: depend on RVB and simplify accordingly 2024-08-05 21:16:26 +03:00
sbrdsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
startcode_rvb.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
startcode_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
svqenc_init.c lavc/riscv: depend on RVB and simplify accordingly 2024-08-05 21:16:26 +03:00
svqenc_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
takdsp_init.c lavc/riscv: depend on RVB and simplify accordingly 2024-08-05 21:16:26 +03:00
takdsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
utvideodsp_init.c lavc/riscv: depend on RVB and simplify accordingly 2024-08-05 21:16:26 +03:00
utvideodsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
vc1dsp_init.c lavc/vc1dsp: R-V V vc1_inv_trans_4x4 2024-06-07 17:53:05 +03:00
vc1dsp_rvi.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
vc1dsp_rvv.S lavc/vc1dsp: use saturating arithmetic for RVV inv_trans_dc 2024-07-30 18:41:51 +03:00
videodsp.S lavc/videodsp: work-around LLVM-as 2024-08-02 21:24:01 +03:00
videodsp_init.c lavc/videodsp: RISC-V zicbop prefetch 2024-07-30 18:41:51 +03:00
vorbisdsp_init.c lavc/riscv: depend on RVB and simplify accordingly 2024-08-05 21:16:26 +03:00
vorbisdsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
vp7dsp_init.c lavc/riscv: depend on RVB and simplify accordingly 2024-08-05 21:16:26 +03:00
vp7dsp_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
vp8dsp.h lavc/vp8dsp: R-V put_vp8_pixels 2024-05-10 18:41:13 +03:00
vp8dsp_init.c lavc/vp8dsp: fix compilation for RV32IMA 2024-11-25 19:29:21 +02:00
vp8dsp_rvi.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
vp8dsp_rvv.S lavc/vp8dsp: fix compilation for RV32IMA 2024-11-25 19:29:21 +02:00
vp9_intra_rvv.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
vp9_mc_rvi.S lavc/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
vp9_mc_rvv.S lavc/vp9dsp: R-V V mc bilin hv 2024-08-19 22:29:20 +03:00
vp9dsp.h lavc/vp9dsp: R-V V mc bilin h v 2024-08-19 22:29:20 +03:00
vp9dsp_init.c lavc/vp9dsp: R-V V mc bilin hv 2024-08-19 22:29:20 +03:00