Message ID | 20240308082749.20028-2-anton@khirnov.net |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,1/3] lavc/thread: move generic-layer API to avcodec_internal.h | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
Anton Khirnov: > ff_thread_get_buffer() has exactly the same semantics as > ff_get_buffer(), except it is supposed to be used in frame-threaded > decoders. Since the decoder instance knows whether frame threading is in > use, there is no point in forcing decoder implementations to use a > different function merely because they happen to support frame > threading. > --- > libavcodec/aic.c | 4 ++-- > libavcodec/alac.c | 4 ++-- > libavcodec/av1dec.c | 2 +- > libavcodec/avcodec_internal.h | 13 +++++++++++++ > libavcodec/bitpacked_dec.c | 4 ++-- > libavcodec/cfhd.c | 4 ++-- > libavcodec/cllc.c | 8 ++++---- > libavcodec/cri.c | 2 +- > libavcodec/decode.c | 13 ++++++++++++- > libavcodec/dnxhddec.c | 2 +- > libavcodec/dvdec.c | 2 +- > libavcodec/dxtory.c | 12 ++++++------ > libavcodec/dxv.c | 4 ++-- > libavcodec/exr.c | 2 +- > libavcodec/flacdec.c | 4 ++-- > libavcodec/fraps.c | 4 ++-- > libavcodec/h264_slice.c | 2 +- > libavcodec/hapdec.c | 4 ++-- > libavcodec/hdrdec.c | 2 +- > libavcodec/hevcdec.c | 2 +- > libavcodec/hqx.c | 4 ++-- > libavcodec/huffyuvdec.c | 4 ++-- > libavcodec/jpeg2000dec.c | 2 +- > libavcodec/lagarith.c | 12 ++++++------ > libavcodec/lcldec.c | 4 ++-- > libavcodec/magicyuv.c | 2 +- > libavcodec/mdec.c | 4 ++-- > libavcodec/notchlc.c | 2 +- > libavcodec/photocd.c | 2 +- > libavcodec/pixlet.c | 2 +- > libavcodec/pngdec.c | 4 ++-- > libavcodec/proresdec2.c | 2 +- > libavcodec/pthread_frame.c | 7 ++----- > libavcodec/qoidec.c | 2 +- > libavcodec/rtv1.c | 2 +- > libavcodec/sheervideo.c | 4 ++-- > libavcodec/takdec.c | 5 +++-- > libavcodec/thread.h | 10 ---------- > libavcodec/tiff.c | 2 +- > libavcodec/tta.c | 4 ++-- > libavcodec/utils.c | 5 ----- > libavcodec/utvideodec.c | 4 ++-- > libavcodec/v210dec.c | 4 ++-- > libavcodec/v410dec.c | 4 ++-- > libavcodec/vaapi_av1.c | 4 ++-- > libavcodec/vble.c | 4 ++-- > libavcodec/vmixdec.c | 2 +- > libavcodec/vvc/vvc_refs.c | 4 ++-- > libavcodec/wbmpdec.c | 2 +- > libavcodec/webp.c | 2 +- > libavcodec/ylc.c | 4 ++-- > 51 files changed, 110 insertions(+), 103 deletions(-) > -1: This adds avoidable runtime checks. - Andreas
Quoting Andreas Rheinhardt (2024-03-08 11:03:18) > Anton Khirnov: > > ff_thread_get_buffer() has exactly the same semantics as > > ff_get_buffer(), except it is supposed to be used in frame-threaded > > decoders. Since the decoder instance knows whether frame threading is in > > use, there is no point in forcing decoder implementations to use a > > different function merely because they happen to support frame > > threading. > > --- > > libavcodec/aic.c | 4 ++-- > > libavcodec/alac.c | 4 ++-- > > libavcodec/av1dec.c | 2 +- > > libavcodec/avcodec_internal.h | 13 +++++++++++++ > > libavcodec/bitpacked_dec.c | 4 ++-- > > libavcodec/cfhd.c | 4 ++-- > > libavcodec/cllc.c | 8 ++++---- > > libavcodec/cri.c | 2 +- > > libavcodec/decode.c | 13 ++++++++++++- > > libavcodec/dnxhddec.c | 2 +- > > libavcodec/dvdec.c | 2 +- > > libavcodec/dxtory.c | 12 ++++++------ > > libavcodec/dxv.c | 4 ++-- > > libavcodec/exr.c | 2 +- > > libavcodec/flacdec.c | 4 ++-- > > libavcodec/fraps.c | 4 ++-- > > libavcodec/h264_slice.c | 2 +- > > libavcodec/hapdec.c | 4 ++-- > > libavcodec/hdrdec.c | 2 +- > > libavcodec/hevcdec.c | 2 +- > > libavcodec/hqx.c | 4 ++-- > > libavcodec/huffyuvdec.c | 4 ++-- > > libavcodec/jpeg2000dec.c | 2 +- > > libavcodec/lagarith.c | 12 ++++++------ > > libavcodec/lcldec.c | 4 ++-- > > libavcodec/magicyuv.c | 2 +- > > libavcodec/mdec.c | 4 ++-- > > libavcodec/notchlc.c | 2 +- > > libavcodec/photocd.c | 2 +- > > libavcodec/pixlet.c | 2 +- > > libavcodec/pngdec.c | 4 ++-- > > libavcodec/proresdec2.c | 2 +- > > libavcodec/pthread_frame.c | 7 ++----- > > libavcodec/qoidec.c | 2 +- > > libavcodec/rtv1.c | 2 +- > > libavcodec/sheervideo.c | 4 ++-- > > libavcodec/takdec.c | 5 +++-- > > libavcodec/thread.h | 10 ---------- > > libavcodec/tiff.c | 2 +- > > libavcodec/tta.c | 4 ++-- > > libavcodec/utils.c | 5 ----- > > libavcodec/utvideodec.c | 4 ++-- > > libavcodec/v210dec.c | 4 ++-- > > libavcodec/v410dec.c | 4 ++-- > > libavcodec/vaapi_av1.c | 4 ++-- > > libavcodec/vble.c | 4 ++-- > > libavcodec/vmixdec.c | 2 +- > > libavcodec/vvc/vvc_refs.c | 4 ++-- > > libavcodec/wbmpdec.c | 2 +- > > libavcodec/webp.c | 2 +- > > libavcodec/ylc.c | 4 ++-- > > 51 files changed, 110 insertions(+), 103 deletions(-) > > > > -1: This adds avoidable runtime checks. What checks and why is that a problem?
Anton Khirnov: > Quoting Andreas Rheinhardt (2024-03-08 11:03:18) >> Anton Khirnov: >>> ff_thread_get_buffer() has exactly the same semantics as >>> ff_get_buffer(), except it is supposed to be used in frame-threaded >>> decoders. Since the decoder instance knows whether frame threading is in >>> use, there is no point in forcing decoder implementations to use a >>> different function merely because they happen to support frame >>> threading. >>> --- >>> libavcodec/aic.c | 4 ++-- >>> libavcodec/alac.c | 4 ++-- >>> libavcodec/av1dec.c | 2 +- >>> libavcodec/avcodec_internal.h | 13 +++++++++++++ >>> libavcodec/bitpacked_dec.c | 4 ++-- >>> libavcodec/cfhd.c | 4 ++-- >>> libavcodec/cllc.c | 8 ++++---- >>> libavcodec/cri.c | 2 +- >>> libavcodec/decode.c | 13 ++++++++++++- >>> libavcodec/dnxhddec.c | 2 +- >>> libavcodec/dvdec.c | 2 +- >>> libavcodec/dxtory.c | 12 ++++++------ >>> libavcodec/dxv.c | 4 ++-- >>> libavcodec/exr.c | 2 +- >>> libavcodec/flacdec.c | 4 ++-- >>> libavcodec/fraps.c | 4 ++-- >>> libavcodec/h264_slice.c | 2 +- >>> libavcodec/hapdec.c | 4 ++-- >>> libavcodec/hdrdec.c | 2 +- >>> libavcodec/hevcdec.c | 2 +- >>> libavcodec/hqx.c | 4 ++-- >>> libavcodec/huffyuvdec.c | 4 ++-- >>> libavcodec/jpeg2000dec.c | 2 +- >>> libavcodec/lagarith.c | 12 ++++++------ >>> libavcodec/lcldec.c | 4 ++-- >>> libavcodec/magicyuv.c | 2 +- >>> libavcodec/mdec.c | 4 ++-- >>> libavcodec/notchlc.c | 2 +- >>> libavcodec/photocd.c | 2 +- >>> libavcodec/pixlet.c | 2 +- >>> libavcodec/pngdec.c | 4 ++-- >>> libavcodec/proresdec2.c | 2 +- >>> libavcodec/pthread_frame.c | 7 ++----- >>> libavcodec/qoidec.c | 2 +- >>> libavcodec/rtv1.c | 2 +- >>> libavcodec/sheervideo.c | 4 ++-- >>> libavcodec/takdec.c | 5 +++-- >>> libavcodec/thread.h | 10 ---------- >>> libavcodec/tiff.c | 2 +- >>> libavcodec/tta.c | 4 ++-- >>> libavcodec/utils.c | 5 ----- >>> libavcodec/utvideodec.c | 4 ++-- >>> libavcodec/v210dec.c | 4 ++-- >>> libavcodec/v410dec.c | 4 ++-- >>> libavcodec/vaapi_av1.c | 4 ++-- >>> libavcodec/vble.c | 4 ++-- >>> libavcodec/vmixdec.c | 2 +- >>> libavcodec/vvc/vvc_refs.c | 4 ++-- >>> libavcodec/wbmpdec.c | 2 +- >>> libavcodec/webp.c | 2 +- >>> libavcodec/ylc.c | 4 ++-- >>> 51 files changed, 110 insertions(+), 103 deletions(-) >>> >> >> -1: This adds avoidable runtime checks. > > What checks and why is that a problem? > It adds a runtime check to every call to ff_get_buffer() by every decoder not supporting frame-threading (by checking whether frame-threading is currently in use). Every avoidable runtime check should always be avoided. - Andreas
Quoting Andreas Rheinhardt (2024-03-08 11:19:59) > Anton Khirnov: > > Quoting Andreas Rheinhardt (2024-03-08 11:03:18) > >> Anton Khirnov: > >>> ff_thread_get_buffer() has exactly the same semantics as > >>> ff_get_buffer(), except it is supposed to be used in frame-threaded > >>> decoders. Since the decoder instance knows whether frame threading is in > >>> use, there is no point in forcing decoder implementations to use a > >>> different function merely because they happen to support frame > >>> threading. > >>> --- > >>> libavcodec/aic.c | 4 ++-- > >>> libavcodec/alac.c | 4 ++-- > >>> libavcodec/av1dec.c | 2 +- > >>> libavcodec/avcodec_internal.h | 13 +++++++++++++ > >>> libavcodec/bitpacked_dec.c | 4 ++-- > >>> libavcodec/cfhd.c | 4 ++-- > >>> libavcodec/cllc.c | 8 ++++---- > >>> libavcodec/cri.c | 2 +- > >>> libavcodec/decode.c | 13 ++++++++++++- > >>> libavcodec/dnxhddec.c | 2 +- > >>> libavcodec/dvdec.c | 2 +- > >>> libavcodec/dxtory.c | 12 ++++++------ > >>> libavcodec/dxv.c | 4 ++-- > >>> libavcodec/exr.c | 2 +- > >>> libavcodec/flacdec.c | 4 ++-- > >>> libavcodec/fraps.c | 4 ++-- > >>> libavcodec/h264_slice.c | 2 +- > >>> libavcodec/hapdec.c | 4 ++-- > >>> libavcodec/hdrdec.c | 2 +- > >>> libavcodec/hevcdec.c | 2 +- > >>> libavcodec/hqx.c | 4 ++-- > >>> libavcodec/huffyuvdec.c | 4 ++-- > >>> libavcodec/jpeg2000dec.c | 2 +- > >>> libavcodec/lagarith.c | 12 ++++++------ > >>> libavcodec/lcldec.c | 4 ++-- > >>> libavcodec/magicyuv.c | 2 +- > >>> libavcodec/mdec.c | 4 ++-- > >>> libavcodec/notchlc.c | 2 +- > >>> libavcodec/photocd.c | 2 +- > >>> libavcodec/pixlet.c | 2 +- > >>> libavcodec/pngdec.c | 4 ++-- > >>> libavcodec/proresdec2.c | 2 +- > >>> libavcodec/pthread_frame.c | 7 ++----- > >>> libavcodec/qoidec.c | 2 +- > >>> libavcodec/rtv1.c | 2 +- > >>> libavcodec/sheervideo.c | 4 ++-- > >>> libavcodec/takdec.c | 5 +++-- > >>> libavcodec/thread.h | 10 ---------- > >>> libavcodec/tiff.c | 2 +- > >>> libavcodec/tta.c | 4 ++-- > >>> libavcodec/utils.c | 5 ----- > >>> libavcodec/utvideodec.c | 4 ++-- > >>> libavcodec/v210dec.c | 4 ++-- > >>> libavcodec/v410dec.c | 4 ++-- > >>> libavcodec/vaapi_av1.c | 4 ++-- > >>> libavcodec/vble.c | 4 ++-- > >>> libavcodec/vmixdec.c | 2 +- > >>> libavcodec/vvc/vvc_refs.c | 4 ++-- > >>> libavcodec/wbmpdec.c | 2 +- > >>> libavcodec/webp.c | 2 +- > >>> libavcodec/ylc.c | 4 ++-- > >>> 51 files changed, 110 insertions(+), 103 deletions(-) > >>> > >> > >> -1: This adds avoidable runtime checks. > > > > What checks and why is that a problem? > > > It adds a runtime check to every call to ff_get_buffer() by every > decoder not supporting frame-threading (by checking whether > frame-threading is currently in use). I cannot imagine any situation where it could have a measurable impact. > Every avoidable runtime check should always be avoided. Premature optimization is the root of all evil.
Anton Khirnov: > Quoting Andreas Rheinhardt (2024-03-08 11:19:59) >> Anton Khirnov: >>> Quoting Andreas Rheinhardt (2024-03-08 11:03:18) >>>> Anton Khirnov: >>>>> ff_thread_get_buffer() has exactly the same semantics as >>>>> ff_get_buffer(), except it is supposed to be used in frame-threaded >>>>> decoders. Since the decoder instance knows whether frame threading is in >>>>> use, there is no point in forcing decoder implementations to use a >>>>> different function merely because they happen to support frame >>>>> threading. >>>>> --- >>>>> libavcodec/aic.c | 4 ++-- >>>>> libavcodec/alac.c | 4 ++-- >>>>> libavcodec/av1dec.c | 2 +- >>>>> libavcodec/avcodec_internal.h | 13 +++++++++++++ >>>>> libavcodec/bitpacked_dec.c | 4 ++-- >>>>> libavcodec/cfhd.c | 4 ++-- >>>>> libavcodec/cllc.c | 8 ++++---- >>>>> libavcodec/cri.c | 2 +- >>>>> libavcodec/decode.c | 13 ++++++++++++- >>>>> libavcodec/dnxhddec.c | 2 +- >>>>> libavcodec/dvdec.c | 2 +- >>>>> libavcodec/dxtory.c | 12 ++++++------ >>>>> libavcodec/dxv.c | 4 ++-- >>>>> libavcodec/exr.c | 2 +- >>>>> libavcodec/flacdec.c | 4 ++-- >>>>> libavcodec/fraps.c | 4 ++-- >>>>> libavcodec/h264_slice.c | 2 +- >>>>> libavcodec/hapdec.c | 4 ++-- >>>>> libavcodec/hdrdec.c | 2 +- >>>>> libavcodec/hevcdec.c | 2 +- >>>>> libavcodec/hqx.c | 4 ++-- >>>>> libavcodec/huffyuvdec.c | 4 ++-- >>>>> libavcodec/jpeg2000dec.c | 2 +- >>>>> libavcodec/lagarith.c | 12 ++++++------ >>>>> libavcodec/lcldec.c | 4 ++-- >>>>> libavcodec/magicyuv.c | 2 +- >>>>> libavcodec/mdec.c | 4 ++-- >>>>> libavcodec/notchlc.c | 2 +- >>>>> libavcodec/photocd.c | 2 +- >>>>> libavcodec/pixlet.c | 2 +- >>>>> libavcodec/pngdec.c | 4 ++-- >>>>> libavcodec/proresdec2.c | 2 +- >>>>> libavcodec/pthread_frame.c | 7 ++----- >>>>> libavcodec/qoidec.c | 2 +- >>>>> libavcodec/rtv1.c | 2 +- >>>>> libavcodec/sheervideo.c | 4 ++-- >>>>> libavcodec/takdec.c | 5 +++-- >>>>> libavcodec/thread.h | 10 ---------- >>>>> libavcodec/tiff.c | 2 +- >>>>> libavcodec/tta.c | 4 ++-- >>>>> libavcodec/utils.c | 5 ----- >>>>> libavcodec/utvideodec.c | 4 ++-- >>>>> libavcodec/v210dec.c | 4 ++-- >>>>> libavcodec/v410dec.c | 4 ++-- >>>>> libavcodec/vaapi_av1.c | 4 ++-- >>>>> libavcodec/vble.c | 4 ++-- >>>>> libavcodec/vmixdec.c | 2 +- >>>>> libavcodec/vvc/vvc_refs.c | 4 ++-- >>>>> libavcodec/wbmpdec.c | 2 +- >>>>> libavcodec/webp.c | 2 +- >>>>> libavcodec/ylc.c | 4 ++-- >>>>> 51 files changed, 110 insertions(+), 103 deletions(-) >>>>> >>>> >>>> -1: This adds avoidable runtime checks. >>> >>> What checks and why is that a problem? >>> >> It adds a runtime check to every call to ff_get_buffer() by every >> decoder not supporting frame-threading (by checking whether >> frame-threading is currently in use). > > I cannot imagine any situation where it could have a measurable impact. > And? It is avoidable, therefore it should be avoided. >> Every avoidable runtime check should always be avoided. > > Premature optimization is the root of all evil. >
Quoting Andreas Rheinhardt (2024-03-08 11:44:12) > Anton Khirnov: > > Quoting Andreas Rheinhardt (2024-03-08 11:19:59) > >> Anton Khirnov: > >>> Quoting Andreas Rheinhardt (2024-03-08 11:03:18) > >>>> Anton Khirnov: > >>>>> ff_thread_get_buffer() has exactly the same semantics as > >>>>> ff_get_buffer(), except it is supposed to be used in frame-threaded > >>>>> decoders. Since the decoder instance knows whether frame threading is in > >>>>> use, there is no point in forcing decoder implementations to use a > >>>>> different function merely because they happen to support frame > >>>>> threading. > >>>>> --- > >>>>> libavcodec/aic.c | 4 ++-- > >>>>> libavcodec/alac.c | 4 ++-- > >>>>> libavcodec/av1dec.c | 2 +- > >>>>> libavcodec/avcodec_internal.h | 13 +++++++++++++ > >>>>> libavcodec/bitpacked_dec.c | 4 ++-- > >>>>> libavcodec/cfhd.c | 4 ++-- > >>>>> libavcodec/cllc.c | 8 ++++---- > >>>>> libavcodec/cri.c | 2 +- > >>>>> libavcodec/decode.c | 13 ++++++++++++- > >>>>> libavcodec/dnxhddec.c | 2 +- > >>>>> libavcodec/dvdec.c | 2 +- > >>>>> libavcodec/dxtory.c | 12 ++++++------ > >>>>> libavcodec/dxv.c | 4 ++-- > >>>>> libavcodec/exr.c | 2 +- > >>>>> libavcodec/flacdec.c | 4 ++-- > >>>>> libavcodec/fraps.c | 4 ++-- > >>>>> libavcodec/h264_slice.c | 2 +- > >>>>> libavcodec/hapdec.c | 4 ++-- > >>>>> libavcodec/hdrdec.c | 2 +- > >>>>> libavcodec/hevcdec.c | 2 +- > >>>>> libavcodec/hqx.c | 4 ++-- > >>>>> libavcodec/huffyuvdec.c | 4 ++-- > >>>>> libavcodec/jpeg2000dec.c | 2 +- > >>>>> libavcodec/lagarith.c | 12 ++++++------ > >>>>> libavcodec/lcldec.c | 4 ++-- > >>>>> libavcodec/magicyuv.c | 2 +- > >>>>> libavcodec/mdec.c | 4 ++-- > >>>>> libavcodec/notchlc.c | 2 +- > >>>>> libavcodec/photocd.c | 2 +- > >>>>> libavcodec/pixlet.c | 2 +- > >>>>> libavcodec/pngdec.c | 4 ++-- > >>>>> libavcodec/proresdec2.c | 2 +- > >>>>> libavcodec/pthread_frame.c | 7 ++----- > >>>>> libavcodec/qoidec.c | 2 +- > >>>>> libavcodec/rtv1.c | 2 +- > >>>>> libavcodec/sheervideo.c | 4 ++-- > >>>>> libavcodec/takdec.c | 5 +++-- > >>>>> libavcodec/thread.h | 10 ---------- > >>>>> libavcodec/tiff.c | 2 +- > >>>>> libavcodec/tta.c | 4 ++-- > >>>>> libavcodec/utils.c | 5 ----- > >>>>> libavcodec/utvideodec.c | 4 ++-- > >>>>> libavcodec/v210dec.c | 4 ++-- > >>>>> libavcodec/v410dec.c | 4 ++-- > >>>>> libavcodec/vaapi_av1.c | 4 ++-- > >>>>> libavcodec/vble.c | 4 ++-- > >>>>> libavcodec/vmixdec.c | 2 +- > >>>>> libavcodec/vvc/vvc_refs.c | 4 ++-- > >>>>> libavcodec/wbmpdec.c | 2 +- > >>>>> libavcodec/webp.c | 2 +- > >>>>> libavcodec/ylc.c | 4 ++-- > >>>>> 51 files changed, 110 insertions(+), 103 deletions(-) > >>>>> > >>>> > >>>> -1: This adds avoidable runtime checks. > >>> > >>> What checks and why is that a problem? > >>> > >> It adds a runtime check to every call to ff_get_buffer() by every > >> decoder not supporting frame-threading (by checking whether > >> frame-threading is currently in use). > > > > I cannot imagine any situation where it could have a measurable impact. > > > > And? It is avoidable, therefore it should be avoided. Why should it be avoided when it can never have any measurable impact? The maintenance cost of a more complex API is higher than the infinitesimal cost of this check.
Anton Khirnov: > Quoting Andreas Rheinhardt (2024-03-08 11:44:12) >> Anton Khirnov: >>> Quoting Andreas Rheinhardt (2024-03-08 11:19:59) >>>> Anton Khirnov: >>>>> Quoting Andreas Rheinhardt (2024-03-08 11:03:18) >>>>>> Anton Khirnov: >>>>>>> ff_thread_get_buffer() has exactly the same semantics as >>>>>>> ff_get_buffer(), except it is supposed to be used in frame-threaded >>>>>>> decoders. Since the decoder instance knows whether frame threading is in >>>>>>> use, there is no point in forcing decoder implementations to use a >>>>>>> different function merely because they happen to support frame >>>>>>> threading. >>>>>>> --- >>>>>>> libavcodec/aic.c | 4 ++-- >>>>>>> libavcodec/alac.c | 4 ++-- >>>>>>> libavcodec/av1dec.c | 2 +- >>>>>>> libavcodec/avcodec_internal.h | 13 +++++++++++++ >>>>>>> libavcodec/bitpacked_dec.c | 4 ++-- >>>>>>> libavcodec/cfhd.c | 4 ++-- >>>>>>> libavcodec/cllc.c | 8 ++++---- >>>>>>> libavcodec/cri.c | 2 +- >>>>>>> libavcodec/decode.c | 13 ++++++++++++- >>>>>>> libavcodec/dnxhddec.c | 2 +- >>>>>>> libavcodec/dvdec.c | 2 +- >>>>>>> libavcodec/dxtory.c | 12 ++++++------ >>>>>>> libavcodec/dxv.c | 4 ++-- >>>>>>> libavcodec/exr.c | 2 +- >>>>>>> libavcodec/flacdec.c | 4 ++-- >>>>>>> libavcodec/fraps.c | 4 ++-- >>>>>>> libavcodec/h264_slice.c | 2 +- >>>>>>> libavcodec/hapdec.c | 4 ++-- >>>>>>> libavcodec/hdrdec.c | 2 +- >>>>>>> libavcodec/hevcdec.c | 2 +- >>>>>>> libavcodec/hqx.c | 4 ++-- >>>>>>> libavcodec/huffyuvdec.c | 4 ++-- >>>>>>> libavcodec/jpeg2000dec.c | 2 +- >>>>>>> libavcodec/lagarith.c | 12 ++++++------ >>>>>>> libavcodec/lcldec.c | 4 ++-- >>>>>>> libavcodec/magicyuv.c | 2 +- >>>>>>> libavcodec/mdec.c | 4 ++-- >>>>>>> libavcodec/notchlc.c | 2 +- >>>>>>> libavcodec/photocd.c | 2 +- >>>>>>> libavcodec/pixlet.c | 2 +- >>>>>>> libavcodec/pngdec.c | 4 ++-- >>>>>>> libavcodec/proresdec2.c | 2 +- >>>>>>> libavcodec/pthread_frame.c | 7 ++----- >>>>>>> libavcodec/qoidec.c | 2 +- >>>>>>> libavcodec/rtv1.c | 2 +- >>>>>>> libavcodec/sheervideo.c | 4 ++-- >>>>>>> libavcodec/takdec.c | 5 +++-- >>>>>>> libavcodec/thread.h | 10 ---------- >>>>>>> libavcodec/tiff.c | 2 +- >>>>>>> libavcodec/tta.c | 4 ++-- >>>>>>> libavcodec/utils.c | 5 ----- >>>>>>> libavcodec/utvideodec.c | 4 ++-- >>>>>>> libavcodec/v210dec.c | 4 ++-- >>>>>>> libavcodec/v410dec.c | 4 ++-- >>>>>>> libavcodec/vaapi_av1.c | 4 ++-- >>>>>>> libavcodec/vble.c | 4 ++-- >>>>>>> libavcodec/vmixdec.c | 2 +- >>>>>>> libavcodec/vvc/vvc_refs.c | 4 ++-- >>>>>>> libavcodec/wbmpdec.c | 2 +- >>>>>>> libavcodec/webp.c | 2 +- >>>>>>> libavcodec/ylc.c | 4 ++-- >>>>>>> 51 files changed, 110 insertions(+), 103 deletions(-) >>>>>>> >>>>>> >>>>>> -1: This adds avoidable runtime checks. >>>>> >>>>> What checks and why is that a problem? >>>>> >>>> It adds a runtime check to every call to ff_get_buffer() by every >>>> decoder not supporting frame-threading (by checking whether >>>> frame-threading is currently in use). >>> >>> I cannot imagine any situation where it could have a measurable impact. >>> >> >> And? It is avoidable, therefore it should be avoided. > > Why should it be avoided when it can never have any measurable impact? > > The maintenance cost of a more complex API is higher than the > infinitesimal cost of this check. > What maintenance cost and complexity are you referring to? I checked and could not find a single commit where one had to fix an ff_get_buffer() to ff_thread_get_buffer() because it has been forgotten when the decoder has been declared to support frame threading. - Andreas
Andreas Rheinhardt (12024-03-08): > What maintenance cost and complexity are you referring to? I checked and > could not find a single commit where one had to fix an ff_get_buffer() > to ff_thread_get_buffer() because it has been forgotten when the decoder > has been declared to support frame threading. Welcome to the new FFmpeg, where absolute consistency, i.e. catering for hypothetical mediocre contributors, is more important than easy optimizations and new approaches. And if you do not like it, “shut up, I'm on the TC and I won't recuse”. And if you do not like that, “shut up, I'm on the CC too”. Regards,
On Fri, Mar 8, 2024 at 2:20 PM Nicolas George <george@nsup.org> wrote: > Andreas Rheinhardt (12024-03-08): > > What maintenance cost and complexity are you referring to? I checked and > > could not find a single commit where one had to fix an ff_get_buffer() > > to ff_thread_get_buffer() because it has been forgotten when the decoder > > has been declared to support frame threading. > > Welcome to the new FFmpeg, where absolute consistency, i.e. catering for > hypothetical mediocre contributors, is more important than easy > optimizations and new approaches. > > And if you do not like it, “shut up, I'm on the TC and I won't recuse”. > > And if you do not like that, “shut up, I'm on the CC too”. > Is this first time I 100% agree on something with my archenemy? > > Regards, > > -- > Nicolas George > _______________________________________________ > 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". >
On Fri, Mar 8, 2024 at 12:18 PM Andreas Rheinhardt < andreas.rheinhardt@outlook.com> wrote: > >>>>>> > >>>>>> -1: This adds avoidable runtime checks. > >>>>> > >>>>> What checks and why is that a problem? > >>>>> > >>>> It adds a runtime check to every call to ff_get_buffer() by every > >>>> decoder not supporting frame-threading (by checking whether > >>>> frame-threading is currently in use). > >>> > >>> I cannot imagine any situation where it could have a measurable impact. > >>> > >> > >> And? It is avoidable, therefore it should be avoided. > > > > Why should it be avoided when it can never have any measurable impact? > > > > The maintenance cost of a more complex API is higher than the > > infinitesimal cost of this check. > > > > What maintenance cost and complexity are you referring to? I checked and > could not find a single commit where one had to fix an ff_get_buffer() > to ff_thread_get_buffer() because it has been forgotten when the decoder > has been declared to support frame threading. > I'd wager documentation and developer complexity costs, usually a simpler API is a nice thing to have. Especially in this case, if the runtime check is minimal it doesn't make sense to keep two different APIs that do the same thing.
On Fri, Mar 8, 2024, 08:20 Nicolas George <george@nsup.org> wrote: > Andreas Rheinhardt (12024-03-08): > > What maintenance cost and complexity are you referring to? I checked and > > could not find a single commit where one had to fix an ff_get_buffer() > > to ff_thread_get_buffer() because it has been forgotten when the decoder > > has been declared to support frame threading. > > Welcome to the new FFmpeg, where absolute consistency, i.e. catering for > hypothetical mediocre contributors, is more important than easy > optimizations and new approaches. > > And if you do not like it, “shut up, I'm on the TC and I won't recuse”. > > And if you do not like that, “shut up, I'm on the CC too”. > > Regards, > > -- > Nicolas George > _______________________________________________ > 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". > Everybody can we *please* keep the responses civil/professional on the ML. -- Sean McGovern
Sean McGovern (12024-03-08):
> Everybody can we *please* keep the responses civil/professional on the ML.
Civil, certainly, provided others are civil to me.
Professional, not a chance. This is Libre Software, not a job.
On Fri, Mar 8, 2024 at 4:10 PM Sean McGovern <gseanmcg@gmail.com> wrote: > On Fri, Mar 8, 2024, 08:20 Nicolas George <george@nsup.org> wrote: > > > Andreas Rheinhardt (12024-03-08): > > > What maintenance cost and complexity are you referring to? I checked > and > > > could not find a single commit where one had to fix an ff_get_buffer() > > > to ff_thread_get_buffer() because it has been forgotten when the > decoder > > > has been declared to support frame threading. > > > > Welcome to the new FFmpeg, where absolute consistency, i.e. catering for > > hypothetical mediocre contributors, is more important than easy > > optimizations and new approaches. > > > > And if you do not like it, “shut up, I'm on the TC and I won't recuse”. > > > > And if you do not like that, “shut up, I'm on the CC too”. > > > > Regards, > > > > -- > > Nicolas George > > _______________________________________________ > > 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". > > > > Everybody can we *please* keep the responses civil/professional on the ML. > I'd just be happy with "on-topic" but it seems like people with agendas like to project on unrelated threads.
On Fri, Mar 8, 2024, 10:19 Nicolas George <george@nsup.org> wrote: > Sean McGovern (12024-03-08): > > Everybody can we *please* keep the responses civil/professional on the > ML. > > Civil, certainly, provided others are civil to me. > > Professional, not a chance. This is Libre Software, not a job. > > -- > Nicolas George > _______________________________________________ > 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". > OK, sorry that was probably overstep, I agree and retract "professional" from that statement. -- Sean McGovern
On Fri, Mar 8, 2024 at 4:21 PM Vittorio Giovara <vittorio.giovara@gmail.com> wrote: > On Fri, Mar 8, 2024 at 4:10 PM Sean McGovern <gseanmcg@gmail.com> wrote: > > > On Fri, Mar 8, 2024, 08:20 Nicolas George <george@nsup.org> wrote: > > > > > Andreas Rheinhardt (12024-03-08): > > > > What maintenance cost and complexity are you referring to? I checked > > and > > > > could not find a single commit where one had to fix an > ff_get_buffer() > > > > to ff_thread_get_buffer() because it has been forgotten when the > > decoder > > > > has been declared to support frame threading. > > > > > > Welcome to the new FFmpeg, where absolute consistency, i.e. catering > for > > > hypothetical mediocre contributors, is more important than easy > > > optimizations and new approaches. > > > > > > And if you do not like it, “shut up, I'm on the TC and I won't recuse”. > > > > > > And if you do not like that, “shut up, I'm on the CC too”. > > > > > > Regards, > > > > > > -- > > > Nicolas George > > > _______________________________________________ > > > 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". > > > > > > > Everybody can we *please* keep the responses civil/professional on the > ML. > > > > I'd just be happy with "on-topic" but it seems like people with agendas > like to project on unrelated threads. > LibAV actions speak more than words once again. > -- > Vittorio > _______________________________________________ > 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". >
On Fri, Mar 8, 2024, 10:31 Paul B Mahol <onemda@gmail.com> wrote: > On Fri, Mar 8, 2024 at 4:21 PM Vittorio Giovara < > vittorio.giovara@gmail.com> > wrote: > > > On Fri, Mar 8, 2024 at 4:10 PM Sean McGovern <gseanmcg@gmail.com> wrote: > > > > > On Fri, Mar 8, 2024, 08:20 Nicolas George <george@nsup.org> wrote: > > > > > > > Andreas Rheinhardt (12024-03-08): > > > > > What maintenance cost and complexity are you referring to? I > checked > > > and > > > > > could not find a single commit where one had to fix an > > ff_get_buffer() > > > > > to ff_thread_get_buffer() because it has been forgotten when the > > > decoder > > > > > has been declared to support frame threading. > > > > > > > > Welcome to the new FFmpeg, where absolute consistency, i.e. catering > > for > > > > hypothetical mediocre contributors, is more important than easy > > > > optimizations and new approaches. > > > > > > > > And if you do not like it, “shut up, I'm on the TC and I won't > recuse”. > > > > > > > > And if you do not like that, “shut up, I'm on the CC too”. > > > > > > > > Regards, > > > > > > > > -- > > > > Nicolas George > > > > _______________________________________________ > > > > 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". > > > > > > > > > > Everybody can we *please* keep the responses civil/professional on the > > ML. > > > > > > > I'd just be happy with "on-topic" but it seems like people with agendas > > like to project on unrelated threads. > > > > LibAV actions speak more than words once again. > > > > -- > > Vittorio > > _______________________________________________ > > 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". > > > _______________________________________________ > 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". > It is really mean-spirited to make such comments about a project that is no longer in operation. Can't we look forward instead of behind us? -- Sean McGovern
Sean McGovern (12024-03-08): > It is really mean-spirited to make such comments about a project that is no > longer in operation. Can't we look forward instead of behind us? The project libav might be dead, but the people who made it are not, not even retired, just look who signed its manifest. Quite the opposite, you can see they have in the recent years gained a lot of influence in FFmpeg, and are now in the process of having FFmpeg apply the same kind of rules and procedure and evolution ad libav. Which is not a good idea considering the killed libav with these rules and procedures and evolution.
On Fri, 8 Mar 2024 at 15:46, Nicolas George <george@nsup.org> wrote: > Sean McGovern (12024-03-08): > > It is really mean-spirited to make such comments about a project that is > no > > longer in operation. Can't we look forward instead of behind us? > > The project libav might be dead, but the people who made it are not, not > even retired, just look who signed its manifest. > > Quite the opposite, you can see they have in the recent years gained a > lot of influence in FFmpeg, and are now in the process of having FFmpeg > apply the same kind of rules and procedure and evolution ad libav. Which > is not a good idea considering the killed libav with these rules and > procedures and evolution. > Several recent contributors were in nappies during that piece of ancient history. Do you really need to bring it up incessantly and use it as your prism on every issue you disagree with? Kieran
Hi Nicolas, On Fri, Mar 8, 2024 at 10:46 AM Nicolas George <george@nsup.org> wrote: > [..] you can see they have in the recent years gained a > lot of influence in FFmpeg [..] > I hope you realize that is what reconciliation looks like. In other words: this was always the goal - from both "sides". You seem to be the only one disagreeing with this goal. Everyone else seems to like having experts from both "sides" work together with - not against - each other. Or in plainer terms: you're gonna have to get used to this new normal. This is it. Welcome to the new & better FFmpeg. I genuinely hope you like it. Ronald
Ronald S. Bultje (12024-03-08):
> I hope you realize that is what reconciliation looks like.
No, it is not. It is what a takeover disguised as reconciliation looks
like.
Kieran Kunhya (12024-03-08): > Several recent contributors were in nappies during that piece of ancient > history. Do you really need to bring it up incessantly and use it as your > prism on every issue you disagree with? Yes, it is necessary, because the same thing is happening again. “Those who cannot learn from history are doomed to repeat it.” New contributors who are not familiar with these events need to ear of them all the more.
On Fri, 8 Mar 2024 at 16:41, Nicolas George <george@nsup.org> wrote: > Kieran Kunhya (12024-03-08): > > Several recent contributors were in nappies during that piece of ancient > > history. Do you really need to bring it up incessantly and use it as your > > prism on every issue you disagree with? > > Yes, it is necessary, because the same thing is happening again. “Those > who cannot learn from history are doomed to repeat it.” New contributors > who are not familiar with these events need to ear of them all the more > New contributors are not interested in your biased history lessons. They want to write code and have a modern, well run project, not a dysfunctional mess. Kieran
Kieran Kunhya (12024-03-08): > New contributors are not interested in your biased history lessons. They > want to write code and have a modern, well run project, not a dysfunctional > mess. And we go back to the core question: does the strength of this project come from paid-for contributors maintaining each small parts of the project, or does it come from hackers who play with many parts of the code and have original ideas to try? I think the answer is obvious. Unfortunately, the first category is the majority in number. Which is why we should go back on democracy, it was a trap, and re-instate a project leader from the second category. Or just consider that the ousting of the leader was unlawful.
On Fri, 8 Mar 2024 at 16:50, Nicolas George <george@nsup.org> wrote: > Kieran Kunhya (12024-03-08): > > New contributors are not interested in your biased history lessons. They > > want to write code and have a modern, well run project, not a > dysfunctional > > mess. > > And we go back to the core question: does the strength of this project > come from paid-for contributors maintaining each small parts of the > project, or does it come from hackers who play with many parts of the > code and have original ideas to try? > > I think the answer is obvious. > > Unfortunately, the first category is the majority in number. Which is > why we should go back on democracy, it was a trap, and re-instate a > project leader from the second category. Or just consider that the > ousting of the leader was unlawful. > The world moved on. Open Source projects which are anarchy are few and far between (basically us). New contributors prefer stability over chaos. Kieran
On Fri, Mar 8, 2024 at 6:01 PM Kieran Kunhya <kierank@obe.tv> wrote: > On Fri, 8 Mar 2024 at 16:50, Nicolas George <george@nsup.org> wrote: > > > Kieran Kunhya (12024-03-08): > > > New contributors are not interested in your biased history lessons. > They > > > want to write code and have a modern, well run project, not a > > dysfunctional > > > mess. > > > > And we go back to the core question: does the strength of this project > > come from paid-for contributors maintaining each small parts of the > > project, or does it come from hackers who play with many parts of the > > code and have original ideas to try? > > > > I think the answer is obvious. > > > > Unfortunately, the first category is the majority in number. Which is > > why we should go back on democracy, it was a trap, and re-instate a > > project leader from the second category. Or just consider that the > > ousting of the leader was unlawful. > > > > The world moved on. Open Source projects which are anarchy are few and far > between (basically us). New contributors prefer stability over chaos. > What's worrisome is that old contributors who don't agree with the status quo are free to fork the project and create their own utopia, I don't understand how being in an abusive relationship with this project is any beneficial to OP or the project itself.
diff --git a/libavcodec/aic.c b/libavcodec/aic.c index f8b0f60354..b4b5089228 100644 --- a/libavcodec/aic.c +++ b/libavcodec/aic.c @@ -27,10 +27,10 @@ #include "avcodec.h" #include "bytestream.h" #include "codec_internal.h" +#include "decode.h" #include "get_bits.h" #include "golomb.h" #include "idctdsp.h" -#include "thread.h" #include "unary.h" #define AIC_HDR_SIZE 24 @@ -408,7 +408,7 @@ static int aic_decode_frame(AVCodecContext *avctx, AVFrame *frame, return ret; } - if ((ret = ff_thread_get_buffer(avctx, ctx->frame, 0)) < 0) + if ((ret = ff_get_buffer(avctx, ctx->frame, 0)) < 0) return ret; bytestream2_init(&gb, buf + AIC_HDR_SIZE, diff --git a/libavcodec/alac.c b/libavcodec/alac.c index 538d1e5984..601d95a7f9 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -53,7 +53,7 @@ #include "get_bits.h" #include "bytestream.h" #include "codec_internal.h" -#include "thread.h" +#include "decode.h" #include "unary.h" #include "mathops.h" #include "alac_data.h" @@ -274,7 +274,7 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index, if (!alac->nb_samples) { /* get output buffer */ frame->nb_samples = output_samples; - if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; } else if (output_samples != alac->nb_samples) { av_log(avctx, AV_LOG_ERROR, "sample count mismatch: %"PRIu32" != %d\n", diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index bbb5634773..98ef1e1935 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -899,7 +899,7 @@ static int av1_frame_alloc(AVCodecContext *avctx, AV1Frame *f) return ret; } - if ((ret = ff_thread_get_buffer(avctx, f->f, AV_GET_BUFFER_FLAG_REF)) < 0) + if ((ret = ff_get_buffer(avctx, f->f, AV_GET_BUFFER_FLAG_REF)) < 0) goto fail; frame = f->f; diff --git a/libavcodec/avcodec_internal.h b/libavcodec/avcodec_internal.h index e7a229dee9..48fc813a73 100644 --- a/libavcodec/avcodec_internal.h +++ b/libavcodec/avcodec_internal.h @@ -58,6 +58,19 @@ struct AVCodecInternal *ff_encode_internal_alloc(void); void ff_codec_close(struct AVCodecContext *avctx); +/** + * Wrapper around AVCodecContext.get_buffer2(), called from pthread_frame when + * frame threading is active, from the ff_get_buffer() otherwise. + */ +int ff_decode_get_buffer(struct AVCodecContext *avctx, struct AVFrame *frame, + int flags); +/** + * Wrapper around ff_decode_get_buffer() that will be called when frame + * threading is active. + */ +int ff_thread_get_buffer(struct AVCodecContext *avctx, struct AVFrame *frame, + int flags); + int ff_thread_init(struct AVCodecContext *s); void ff_thread_free(struct AVCodecContext *s); diff --git a/libavcodec/bitpacked_dec.c b/libavcodec/bitpacked_dec.c index 54c008bd86..4bd59b7d12 100644 --- a/libavcodec/bitpacked_dec.c +++ b/libavcodec/bitpacked_dec.c @@ -29,7 +29,7 @@ #include "avcodec.h" #include "codec_internal.h" #include "libavutil/imgutils.h" -#include "thread.h" +#include "decode.h" struct BitpackedContext { int (*decode)(AVCodecContext *avctx, AVFrame *frame, @@ -68,7 +68,7 @@ static int bitpacked_decode_yuv422p10(AVCodecContext *avctx, AVFrame *frame, uint16_t *y, *u, *v; int ret, i, j; - ret = ff_thread_get_buffer(avctx, frame, 0); + ret = ff_get_buffer(avctx, frame, 0); if (ret < 0) return ret; diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 42d7dcc3f6..14301b829f 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -682,7 +682,7 @@ static int cfhd_decode(AVCodecContext *avctx, AVFrame *pic, } pic->width = pic->height = 0; - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; s->coded_width = 0; @@ -692,7 +692,7 @@ static int cfhd_decode(AVCodecContext *avctx, AVFrame *pic, } else if (tag == FrameIndex && data == 1 && s->sample_type == 1 && s->frame_type == 2) { pic->width = pic->height = 0; - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; s->coded_width = 0; s->coded_height = 0; diff --git a/libavcodec/cllc.c b/libavcodec/cllc.c index 0c6ae13d08..2c5dbcf53d 100644 --- a/libavcodec/cllc.c +++ b/libavcodec/cllc.c @@ -28,7 +28,7 @@ #include "get_bits.h" #include "avcodec.h" #include "codec_internal.h" -#include "thread.h" +#include "decode.h" #define VLC_BITS 7 #define VLC_DEPTH 2 @@ -422,7 +422,7 @@ static int cllc_decode_frame(AVCodecContext *avctx, AVFrame *pic, avctx->pix_fmt = AV_PIX_FMT_YUV422P; avctx->bits_per_raw_sample = 8; - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; ret = decode_yuv_frame(ctx, &gb, pic); @@ -435,7 +435,7 @@ static int cllc_decode_frame(AVCodecContext *avctx, AVFrame *pic, avctx->pix_fmt = AV_PIX_FMT_RGB24; avctx->bits_per_raw_sample = 8; - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; ret = decode_rgb24_frame(ctx, &gb, pic); @@ -447,7 +447,7 @@ static int cllc_decode_frame(AVCodecContext *avctx, AVFrame *pic, avctx->pix_fmt = AV_PIX_FMT_ARGB; avctx->bits_per_raw_sample = 8; - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; ret = decode_argb_frame(ctx, &gb, pic); diff --git a/libavcodec/cri.c b/libavcodec/cri.c index 990e52ac99..c54fb67cec 100644 --- a/libavcodec/cri.c +++ b/libavcodec/cri.c @@ -319,7 +319,7 @@ skip: if (avctx->skip_frame >= AVDISCARD_ALL) return avpkt->size; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; avctx->bits_per_raw_sample = bps; diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 4168cf6f2d..cdbbfd8ee2 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -1565,7 +1565,7 @@ int ff_attach_decode_data(AVFrame *frame) return 0; } -int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags) +int ff_decode_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags) { const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel); int override_dimensions = 1; @@ -1637,6 +1637,17 @@ fail: return ret; } +int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags) +{ +#if HAVE_THREADS + if (avctx->active_thread_type & FF_THREAD_FRAME) + return ff_thread_get_buffer(avctx, frame, flags); +#endif + av_assert0(!(avctx->active_thread_type & FF_THREAD_FRAME)); + + return ff_decode_get_buffer(avctx, frame, flags); +} + static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags) { AVFrame *tmp; diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c index 703d0e341c..8e2bed5d83 100644 --- a/libavcodec/dnxhddec.c +++ b/libavcodec/dnxhddec.c @@ -652,7 +652,7 @@ decode_coding_unit: return ret; if (first_field) { - if ((ret = ff_thread_get_buffer(avctx, picture, 0)) < 0) + if ((ret = ff_get_buffer(avctx, picture, 0)) < 0) return ret; picture->pict_type = AV_PICTURE_TYPE_I; picture->flags |= AV_FRAME_FLAG_KEY; diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c index f66a5f1a05..d6ecdda32b 100644 --- a/libavcodec/dvdec.c +++ b/libavcodec/dvdec.c @@ -668,7 +668,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, AVFrame *frame, ff_set_sar(avctx, s->sys->sar[is16_9]); } - if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; /* Determine the codec's field order from the packet */ diff --git a/libavcodec/dxtory.c b/libavcodec/dxtory.c index f36420cdd9..2526b8e7b9 100644 --- a/libavcodec/dxtory.c +++ b/libavcodec/dxtory.c @@ -29,9 +29,9 @@ #include "avcodec.h" #include "bytestream.h" #include "codec_internal.h" +#include "decode.h" #include "get_bits.h" #include "unary.h" -#include "thread.h" static int64_t get_raw_size(enum AVPixelFormat fmt, int width, int height) { @@ -103,7 +103,7 @@ static int dxtory_decode_v1_rgb(AVCodecContext *avctx, AVFrame *pic, } avctx->pix_fmt = id; - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; do_vflip(avctx, pic, vflipped); @@ -136,7 +136,7 @@ static int dxtory_decode_v1_410(AVCodecContext *avctx, AVFrame *pic, } avctx->pix_fmt = AV_PIX_FMT_YUV410P; - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; do_vflip(avctx, pic, vflipped); @@ -231,7 +231,7 @@ static int dxtory_decode_v1_420(AVCodecContext *avctx, AVFrame *pic, } avctx->pix_fmt = AV_PIX_FMT_YUV420P; - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; do_vflip(avctx, pic, vflipped); @@ -301,7 +301,7 @@ static int dxtory_decode_v1_444(AVCodecContext *avctx, AVFrame *pic, } avctx->pix_fmt = AV_PIX_FMT_YUV444P; - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; do_vflip(avctx, pic, vflipped); @@ -452,7 +452,7 @@ static int dxtory_decode_v2(AVCodecContext *avctx, AVFrame *pic, return AVERROR_INVALIDDATA; avctx->pix_fmt = fmt; - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; do_vflip(avctx, pic, vflipped); diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c index b5553a0c86..b4043553e9 100644 --- a/libavcodec/dxv.c +++ b/libavcodec/dxv.c @@ -28,10 +28,10 @@ #include "avcodec.h" #include "bytestream.h" #include "codec_internal.h" +#include "decode.h" #include "dxv.h" #include "lzf.h" #include "texturedsp.h" -#include "thread.h" typedef struct DXVContext { TextureDSPContext texdsp; @@ -1000,7 +1000,7 @@ static int dxv_decode(AVCodecContext *avctx, AVFrame *frame, if (ret < 0) return ret; - ret = ff_thread_get_buffer(avctx, frame, 0); + ret = ff_get_buffer(avctx, frame, 0); if (ret < 0) return ret; diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 5711fbbdcd..900e090c9a 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -2151,7 +2151,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture, s->scan_lines_per_block; } - if ((ret = ff_thread_get_buffer(avctx, picture, 0)) < 0) + if ((ret = ff_get_buffer(avctx, picture, 0)) < 0) return ret; if (bytestream2_get_bytes_left(gb)/8 < nb_blocks) diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index ed2de14d0a..bbdf6eab82 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -40,12 +40,12 @@ #include "codec_internal.h" #include "get_bits.h" #include "bytestream.h" +#include "decode.h" #include "golomb.h" #include "flac.h" #include "flacdata.h" #include "flacdsp.h" #include "flac_parse.h" -#include "thread.h" #include "unary.h" @@ -776,7 +776,7 @@ static int flac_decode_frame(AVCodecContext *avctx, AVFrame *frame, /* get output buffer */ frame->nb_samples = s->blocksize; - if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; if (s->stream_info.bps == 32 && s->ch_mode > 0) { diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c index bed244e4e9..6be0eecba4 100644 --- a/libavcodec/fraps.c +++ b/libavcodec/fraps.c @@ -41,7 +41,7 @@ #include "bytestream.h" #include "bswapdsp.h" #include "codec_internal.h" -#include "thread.h" +#include "decode.h" #define FPS_TAG MKTAG('F', 'P', 'S', 'x') #define VLC_BITS 11 @@ -222,7 +222,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *f, : AVCOL_RANGE_JPEG; avctx->colorspace = version & 1 ? AVCOL_SPC_UNSPECIFIED : AVCOL_SPC_BT709; - if ((ret = ff_thread_get_buffer(avctx, f, 0)) < 0) + if ((ret = ff_get_buffer(avctx, f, 0)) < 0) return ret; switch (version) { diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index e9a404e41b..fc2c36485b 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -200,7 +200,7 @@ static int alloc_picture(H264Context *h, H264Picture *pic) pic->f_grain->format = pic->f->format; pic->f_grain->width = pic->f->width; pic->f_grain->height = pic->f->height; - ret = ff_thread_get_buffer(h->avctx, pic->f_grain, 0); + ret = ff_get_buffer(h->avctx, pic->f_grain, 0); if (ret < 0) goto fail; } diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c index 6066cb814c..9134069dcf 100644 --- a/libavcodec/hapdec.c +++ b/libavcodec/hapdec.c @@ -38,10 +38,10 @@ #include "avcodec.h" #include "bytestream.h" #include "codec_internal.h" +#include "decode.h" #include "hap.h" #include "snappy.h" #include "texturedsp.h" -#include "thread.h" static int hap_parse_decode_instructions(HapContext *ctx, int size) { @@ -271,7 +271,7 @@ static int hap_decode(AVCodecContext *avctx, AVFrame *frame, } /* Get the output frame ready to receive data */ - ret = ff_thread_get_buffer(avctx, frame, 0); + ret = ff_get_buffer(avctx, frame, 0); if (ret < 0) return ret; diff --git a/libavcodec/hdrdec.c b/libavcodec/hdrdec.c index 9b6395bb6d..04838f259b 100644 --- a/libavcodec/hdrdec.c +++ b/libavcodec/hdrdec.c @@ -134,7 +134,7 @@ static int hdr_decode_frame(AVCodecContext *avctx, AVFrame *p, if (avctx->skip_frame >= AVDISCARD_ALL) return avpkt->size; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; for (int y = 0; y < height; y++) { diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 76aa6b4588..bbc7683da6 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -2901,7 +2901,7 @@ static int hevc_frame_start(HEVCContext *s) s->ref->frame_grain->format = s->ref->frame->format; s->ref->frame_grain->width = s->ref->frame->width; s->ref->frame_grain->height = s->ref->frame->height; - if ((ret = ff_thread_get_buffer(s->avctx, s->ref->frame_grain, 0)) < 0) + if ((ret = ff_get_buffer(s->avctx, s->ref->frame_grain, 0)) < 0) goto fail; } diff --git a/libavcodec/hqx.c b/libavcodec/hqx.c index 51099aa684..8398a79349 100644 --- a/libavcodec/hqx.c +++ b/libavcodec/hqx.c @@ -26,8 +26,8 @@ #include "avcodec.h" #include "canopus.h" #include "codec_internal.h" +#include "decode.h" #include "get_bits.h" -#include "thread.h" #include "hqx.h" #include "hqxdsp.h" @@ -498,7 +498,7 @@ static int hqx_decode_frame(AVCodecContext *avctx, AVFrame *frame, return AVERROR_INVALIDDATA; } - ret = ff_thread_get_buffer(avctx, frame, 0); + ret = ff_get_buffer(avctx, frame, 0); if (ret < 0) return ret; diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index ce6d4d4c59..34f152f8ee 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -37,11 +37,11 @@ #include "avcodec.h" #include "bswapdsp.h" #include "codec_internal.h" +#include "decode.h" #include "get_bits.h" #include "huffyuv.h" #include "huffyuvdsp.h" #include "lossless_videodsp.h" -#include "thread.h" #include "libavutil/emms.h" #include "libavutil/imgutils.h" #include "libavutil/pixdesc.h" @@ -1244,7 +1244,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, s->bdsp.bswap_buf((uint32_t *) s->bitstream_buffer, (const uint32_t *) buf, buf_size / 4); - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; if (s->context) { diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index 1afc6b1e2d..6ba5954409 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -2495,7 +2495,7 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, AVFrame *picture, } /* get picture buffer */ - if ((ret = ff_thread_get_buffer(avctx, picture, 0)) < 0) + if ((ret = ff_get_buffer(avctx, picture, 0)) < 0) goto end; picture->pict_type = AV_PICTURE_TYPE_I; picture->flags |= AV_FRAME_FLAG_KEY; diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c index 75b557e518..7831106ef3 100644 --- a/libavcodec/lagarith.c +++ b/libavcodec/lagarith.c @@ -31,11 +31,11 @@ #include "avcodec.h" #include "codec_internal.h" +#include "decode.h" #include "get_bits.h" #include "mathops.h" #include "lagarithrac.h" #include "lossless_videodsp.h" -#include "thread.h" #define VLC_BITS 7 @@ -590,7 +590,7 @@ static int lag_decode_frame(AVCodecContext *avctx, AVFrame *p, planes = 4; } - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; if (frametype == FRAME_SOLID_RGBA) { @@ -614,7 +614,7 @@ static int lag_decode_frame(AVCodecContext *avctx, AVFrame *p, avctx->pix_fmt = AV_PIX_FMT_GBRAP; } - if ((ret = ff_thread_get_buffer(avctx, p,0)) < 0) + if ((ret = ff_get_buffer(avctx, p,0)) < 0) return ret; for (i = 0; i < avctx->height; i++) { @@ -635,7 +635,7 @@ static int lag_decode_frame(AVCodecContext *avctx, AVFrame *p, if (frametype == FRAME_ARITH_RGB24 || frametype == FRAME_U_RGB24) avctx->pix_fmt = AV_PIX_FMT_GBRP; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; offs[0] = offset_bv; @@ -671,7 +671,7 @@ static int lag_decode_frame(AVCodecContext *avctx, AVFrame *p, case FRAME_ARITH_YUY2: avctx->pix_fmt = AV_PIX_FMT_YUV422P; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; if (offset_ry >= buf_size || @@ -699,7 +699,7 @@ static int lag_decode_frame(AVCodecContext *avctx, AVFrame *p, case FRAME_ARITH_YV12: avctx->pix_fmt = AV_PIX_FMT_YUV420P; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; if (offset_ry >= buf_size || diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c index b4304618e4..1a52f46fc4 100644 --- a/libavcodec/lcldec.c +++ b/libavcodec/lcldec.c @@ -47,8 +47,8 @@ #include "avcodec.h" #include "bytestream.h" #include "codec_internal.h" +#include "decode.h" #include "lcl.h" -#include "thread.h" #if CONFIG_ZLIB_DECODER #include "zlib_wrapper.h" @@ -180,7 +180,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, unsigned int len = buf_size; int linesize, offset; - if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; outptr = frame->data[0]; // Output image pointer diff --git a/libavcodec/magicyuv.c b/libavcodec/magicyuv.c index 3f6348b531..06fdf9e39f 100644 --- a/libavcodec/magicyuv.c +++ b/libavcodec/magicyuv.c @@ -654,7 +654,7 @@ static int magy_decode_frame(AVCodecContext *avctx, AVFrame *p, p->pict_type = AV_PICTURE_TYPE_I; p->flags |= AV_FRAME_FLAG_KEY; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; s->buf = avpkt->data; diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c index c4904216b8..2855ae7514 100644 --- a/libavcodec/mdec.c +++ b/libavcodec/mdec.c @@ -33,10 +33,10 @@ #include "blockdsp.h" #include "bswapdsp.h" #include "codec_internal.h" +#include "decode.h" #include "idctdsp.h" #include "mpeg12data.h" #include "mpeg12dec.h" -#include "thread.h" typedef struct MDECContext { AVCodecContext *avctx; @@ -174,7 +174,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, int buf_size = avpkt->size; int ret; - if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; frame->pict_type = AV_PICTURE_TYPE_I; frame->flags |= AV_FRAME_FLAG_KEY; diff --git a/libavcodec/notchlc.c b/libavcodec/notchlc.c index 0feb0918f0..ab540362af 100644 --- a/libavcodec/notchlc.c +++ b/libavcodec/notchlc.c @@ -221,7 +221,7 @@ static int decode_blocks(AVCodecContext *avctx, AVFrame *p, return AVERROR_INVALIDDATA; s->uv_count_offset = s->y_data_offset - s->a_data_offset; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; rgb = *gb; diff --git a/libavcodec/photocd.c b/libavcodec/photocd.c index 07e8d460bd..f7d3638273 100644 --- a/libavcodec/photocd.c +++ b/libavcodec/photocd.c @@ -328,7 +328,7 @@ static int photocd_decode_frame(AVCodecContext *avctx, AVFrame *p, if (avctx->skip_frame >= AVDISCARD_ALL) return avpkt->size; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; p->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c index 6e925308b8..b015352eda 100644 --- a/libavcodec/pixlet.c +++ b/libavcodec/pixlet.c @@ -670,7 +670,7 @@ static int pixlet_decode_frame(AVCodecContext *avctx, AVFrame *p, p->flags |= AV_FRAME_FLAG_KEY; p->color_range = AVCOL_RANGE_JPEG; - ret = ff_thread_get_buffer(avctx, p, 0); + ret = ff_get_buffer(avctx, p, 0); if (ret < 0) return ret; diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index de50e6a5b6..ef342327d0 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -876,7 +876,7 @@ static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s, ff_thread_release_ext_buffer(&s->picture); if (s->dispose_op == APNG_DISPOSE_OP_PREVIOUS) { /* We only need a buffer for the current picture. */ - ret = ff_thread_get_buffer(avctx, p, 0); + ret = ff_get_buffer(avctx, p, 0); if (ret < 0) return ret; } else if (s->dispose_op == APNG_DISPOSE_OP_BACKGROUND) { @@ -886,7 +886,7 @@ static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s, AV_GET_BUFFER_FLAG_REF); if (ret < 0) return ret; - ret = ff_thread_get_buffer(avctx, p, 0); + ret = ff_get_buffer(avctx, p, 0); if (ret < 0) return ret; } else { diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c index 3a5b753430..2e7ddbfd22 100644 --- a/libavcodec/proresdec2.c +++ b/libavcodec/proresdec2.c @@ -800,7 +800,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, buf += frame_hdr_size; buf_size -= frame_hdr_size; - if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; ff_thread_finish_setup(avctx); diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index fd356bd190..dd25d99fbb 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -939,9 +939,6 @@ static int thread_get_buffer_internal(AVCodecContext *avctx, AVFrame *f, int fla PerThreadContext *p; int err; - if (!(avctx->active_thread_type & FF_THREAD_FRAME)) - return ff_get_buffer(avctx, f, flags); - p = avctx->internal->thread_ctx; if (atomic_load(&p->state) != STATE_SETTING_UP && ffcodec(avctx->codec)->update_thread_context) { @@ -950,7 +947,7 @@ static int thread_get_buffer_internal(AVCodecContext *avctx, AVFrame *f, int fla } pthread_mutex_lock(&p->parent->buffer_mutex); - err = ff_get_buffer(avctx, f, flags); + err = ff_decode_get_buffer(avctx, f, flags); pthread_mutex_unlock(&p->parent->buffer_mutex); @@ -976,7 +973,7 @@ int ff_thread_get_ext_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags) * This currently affects non-MPEG-4 mpegvideo codecs and and VP7. * The following check will always be true for them. */ if (!(avctx->active_thread_type & FF_THREAD_FRAME)) - return ff_get_buffer(avctx, f->f, flags); + return ff_decode_get_buffer(avctx, f->f, flags); if (ffcodec(avctx->codec)->caps_internal & FF_CODEC_CAP_ALLOCATE_PROGRESS) { f->progress = ff_refstruct_allocz(sizeof(*f->progress)); diff --git a/libavcodec/qoidec.c b/libavcodec/qoidec.c index 37bc2084c0..f591b2f5a4 100644 --- a/libavcodec/qoidec.c +++ b/libavcodec/qoidec.c @@ -63,7 +63,7 @@ static int qoi_decode_frame(AVCodecContext *avctx, AVFrame *p, if (avctx->skip_frame >= AVDISCARD_ALL) return avpkt->size; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; dst = p->data[0]; diff --git a/libavcodec/rtv1.c b/libavcodec/rtv1.c index 06afe9e873..79926eb65f 100644 --- a/libavcodec/rtv1.c +++ b/libavcodec/rtv1.c @@ -120,7 +120,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, avctx->width = width; avctx->height = height; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; dst = p->data[0] + p->linesize[0] * (avctx->coded_height - 1); diff --git a/libavcodec/sheervideo.c b/libavcodec/sheervideo.c index 660e2661a4..f78d826884 100644 --- a/libavcodec/sheervideo.c +++ b/libavcodec/sheervideo.c @@ -25,8 +25,8 @@ #include "libavutil/intreadwrite.h" #include "avcodec.h" #include "codec_internal.h" +#include "decode.h" #include "get_bits.h" -#include "thread.h" #include "sheervideodata.h" typedef struct SheerVideoContext { @@ -1975,7 +1975,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, p->pict_type = AV_PICTURE_TYPE_I; p->flags |= AV_FRAME_FLAG_KEY; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; if ((ret = init_get_bits8(&gb, avpkt->data + 20, avpkt->size - 20)) < 0) diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c index 5cbc2de6bd..76c03f5834 100644 --- a/libavcodec/takdec.c +++ b/libavcodec/takdec.c @@ -32,12 +32,13 @@ #define CACHED_BITSTREAM_READER !ARCH_X86_32 #define BITSTREAM_READER_LE #include "audiodsp.h" -#include "thread.h" #include "avcodec.h" #include "codec_internal.h" +#include "decode.h" #include "unary.h" #include "tak.h" #include "takdsp.h" +#include "thread.h" #define MAX_SUBFRAMES 8 ///< max number of subframes per channel #define MAX_PREDICTORS 256 @@ -742,7 +743,7 @@ static int tak_decode_frame(AVCodecContext *avctx, AVFrame *frame, : s->ti.frame_samples; frame->nb_samples = s->nb_samples; - if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; ff_thread_finish_setup(avctx); diff --git a/libavcodec/thread.h b/libavcodec/thread.h index 4272fd87d4..5a00b32619 100644 --- a/libavcodec/thread.h +++ b/libavcodec/thread.h @@ -43,16 +43,6 @@ int ff_thread_can_start_frame(AVCodecContext *avctx); */ void ff_thread_finish_setup(AVCodecContext *avctx); -/** - * Wrapper around get_buffer() for frame-multithreaded codecs. - * Call this function instead of ff_get_buffer(f). - * Cannot be called after the codec has called ff_thread_finish_setup(). - * - * @param avctx The current context. - * @param f The frame to write into. - */ -int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags); - int ff_slice_thread_execute_with_mainfunc(AVCodecContext *avctx, int (*action_func2)(AVCodecContext *c, void *arg, int jobnr, int threadnr), int (*main_func)(AVCodecContext *c), void *arg, int *ret, int job_count); diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index cb4d378753..e52b61bb33 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -1214,7 +1214,7 @@ static int init_image(TiffContext *s, AVFrame *frame) if (s->avctx->skip_frame >= AVDISCARD_ALL) return 0; - if ((ret = ff_thread_get_buffer(s->avctx, frame, 0)) < 0) + if ((ret = ff_get_buffer(s->avctx, frame, 0)) < 0) return ret; if (s->avctx->pix_fmt == AV_PIX_FMT_PAL8) { if (!create_gray_palette) diff --git a/libavcodec/tta.c b/libavcodec/tta.c index 7763ed7ffc..62b746c123 100644 --- a/libavcodec/tta.c +++ b/libavcodec/tta.c @@ -39,8 +39,8 @@ #include "ttadsp.h" #include "avcodec.h" #include "codec_internal.h" +#include "decode.h" #include "get_bits.h" -#include "thread.h" #include "unary.h" #define FORMAT_SIMPLE 1 @@ -247,7 +247,7 @@ static int tta_decode_frame(AVCodecContext *avctx, AVFrame *frame, /* get output buffer */ frame->nb_samples = framelen; - if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; // decode directly to output buffer for 24-bit sample format diff --git a/libavcodec/utils.c b/libavcodec/utils.c index e91a5d6d2e..9b230d9989 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -884,11 +884,6 @@ int ff_thread_replace_frame(ThreadFrame *dst, const ThreadFrame *src) #if !HAVE_THREADS -int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags) -{ - return ff_get_buffer(avctx, f, flags); -} - int ff_thread_get_ext_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags) { f->owner[0] = f->owner[1] = avctx; diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c index ce5d00f7af..5133bcdbb5 100644 --- a/libavcodec/utvideodec.c +++ b/libavcodec/utvideodec.c @@ -36,9 +36,9 @@ #include "bswapdsp.h" #include "bytestream.h" #include "codec_internal.h" +#include "decode.h" #include "get_bits.h" #include "lossless_videodsp.h" -#include "thread.h" #include "utvideo.h" #include "utvideodsp.h" @@ -589,7 +589,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, int ret; GetByteContext gb; - if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; /* parse plane structure to get frame flags and validate slice offsets */ diff --git a/libavcodec/v210dec.c b/libavcodec/v210dec.c index d80fb4e7c6..85f5039fa4 100644 --- a/libavcodec/v210dec.c +++ b/libavcodec/v210dec.c @@ -23,13 +23,13 @@ #include "avcodec.h" #include "codec_internal.h" +#include "decode.h" #include "v210dec.h" #include "v210dec_init.h" #include "libavutil/bswap.h" #include "libavutil/imgutils.h" #include "libavutil/internal.h" #include "libavutil/intreadwrite.h" -#include "thread.h" typedef struct ThreadData { AVFrame *frame; @@ -183,7 +183,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *pic, ff_v210dec_init(s); } - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; pic->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/v410dec.c b/libavcodec/v410dec.c index 35e4a8ae03..e4f25fab88 100644 --- a/libavcodec/v410dec.c +++ b/libavcodec/v410dec.c @@ -24,7 +24,7 @@ #include "libavutil/intreadwrite.h" #include "avcodec.h" #include "codec_internal.h" -#include "thread.h" +#include "decode.h" typedef struct ThreadData { AVFrame *frame; @@ -99,7 +99,7 @@ static int v410_decode_frame(AVCodecContext *avctx, AVFrame *pic, return AVERROR(EINVAL); } - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; pic->flags |= AV_FRAME_FLAG_KEY; diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c index 1f9a6071ba..3f3b661789 100644 --- a/libavcodec/vaapi_av1.c +++ b/libavcodec/vaapi_av1.c @@ -23,7 +23,7 @@ #include "vaapi_decode.h" #include "internal.h" #include "av1dec.h" -#include "thread.h" +#include "decode.h" typedef struct VAAPIAV1FrameRef { AVFrame *frame; @@ -127,7 +127,7 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx, if (apply_grain) { if (ctx->tmp_frame->buf[0]) av_frame_unref(ctx->tmp_frame); - err = ff_thread_get_buffer(avctx, ctx->tmp_frame, AV_GET_BUFFER_FLAG_REF); + err = ff_get_buffer(avctx, ctx->tmp_frame, AV_GET_BUFFER_FLAG_REF); if (err < 0) goto fail; pic->output_surface = ff_vaapi_get_surface_id(ctx->tmp_frame); diff --git a/libavcodec/vble.c b/libavcodec/vble.c index 7711bf1bb1..4d4f126d36 100644 --- a/libavcodec/vble.c +++ b/libavcodec/vble.c @@ -29,10 +29,10 @@ #define BITSTREAM_READER_LE #include "avcodec.h" #include "codec_internal.h" +#include "decode.h" #include "get_bits.h" #include "lossless_videodsp.h" #include "mathops.h" -#include "thread.h" typedef struct VBLEContext { AVCodecContext *avctx; @@ -131,7 +131,7 @@ static int vble_decode_frame(AVCodecContext *avctx, AVFrame *pic, } /* Allocate buffer */ - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; /* Set flags */ diff --git a/libavcodec/vmixdec.c b/libavcodec/vmixdec.c index d6b6e3557f..4fceb6d5e2 100644 --- a/libavcodec/vmixdec.c +++ b/libavcodec/vmixdec.c @@ -280,7 +280,7 @@ static int decode_frame(AVCodecContext *avctx, offset += slice_size + 4; } - ret = ff_thread_get_buffer(avctx, frame, 0); + ret = ff_get_buffer(avctx, frame, 0); if (ret < 0) return ret; diff --git a/libavcodec/vvc/vvc_refs.c b/libavcodec/vvc/vvc_refs.c index 99f2dcf3ec..de5f582006 100644 --- a/libavcodec/vvc/vvc_refs.c +++ b/libavcodec/vvc/vvc_refs.c @@ -24,7 +24,7 @@ #include "libavutil/thread.h" #include "libavcodec/refstruct.h" -#include "libavcodec/thread.h" +#include "libavcodec/decode.h" #include "vvc_refs.h" @@ -118,7 +118,7 @@ static VVCFrame *alloc_frame(VVCContext *s, VVCFrameContext *fc) if (frame->frame->buf[0]) continue; - ret = ff_thread_get_buffer(s->avctx, frame->frame, AV_GET_BUFFER_FLAG_REF); + ret = ff_get_buffer(s->avctx, frame->frame, AV_GET_BUFFER_FLAG_REF); if (ret < 0) return NULL; diff --git a/libavcodec/wbmpdec.c b/libavcodec/wbmpdec.c index 3b5753abcd..7d3a32bb13 100644 --- a/libavcodec/wbmpdec.c +++ b/libavcodec/wbmpdec.c @@ -66,7 +66,7 @@ static int wbmp_decode_frame(AVCodecContext *avctx, AVFrame *p, return ret; avctx->pix_fmt = AV_PIX_FMT_MONOBLACK; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; if (p->linesize[0] == (width + 7) / 8) diff --git a/libavcodec/webp.c b/libavcodec/webp.c index 9308ea2b69..45e7344965 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -570,7 +570,7 @@ static int decode_entropy_coded_image(WebPContext *s, enum ImageRole role, img->frame->height = h; if (role == IMAGE_ROLE_ARGB && !img->is_alpha_primary) { - ret = ff_thread_get_buffer(s->avctx, img->frame, 0); + ret = ff_get_buffer(s->avctx, img->frame, 0); } else ret = av_frame_get_buffer(img->frame, 1); if (ret < 0) diff --git a/libavcodec/ylc.c b/libavcodec/ylc.c index b03df31556..8c2503fb01 100644 --- a/libavcodec/ylc.c +++ b/libavcodec/ylc.c @@ -28,8 +28,8 @@ #include "avcodec.h" #include "bswapdsp.h" #include "codec_internal.h" +#include "decode.h" #include "get_bits.h" -#include "thread.h" #include "unary.h" typedef struct YLCContext { @@ -300,7 +300,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, if (toffset >= boffset || boffset >= avpkt->size) return AVERROR_INVALIDDATA; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; av_fast_malloc(&s->buffer, &s->buffer_size,