History

avcodec/codec_internal: Remove FF_CODEC_CAP_ALLOCATE_PROGRESS

Before commit f025b8e110b36c1cdb4fb56c4cd57aeca1767b5b, every frame-threaded decoder used ThreadFrames, even when they did not have any inter-frame dependencies at all. In order to distinguish those decoders that need the AVBuffer for progress communication from those that do not (to avoid the allocation for the latter), the former decoders were marked with the FF_CODEC_CAP_ALLOCATE_PROGRESS internal codec cap. Yet distinguishing these two can be done in a more natural way: Don't use ThreadFrames when not needed and split ff_thread_get_buffer() into a core function that calls the user's get_buffer2 callback and a wrapper around it that also allocates the progress AVBuffer. This has been done in 02220b88fc38ef9dd4f2d519f5d3e4151258b60c and since that commit the ALLOCATE_PROGRESS cap was nearly redundant. The only exception was WebP and VP8. WebP can contain VP8 and uses the VP8 decoder directly (i.e. they share the same AVCodecContext). Both decoders are frame-threaded and VP8 has inter-frame dependencies (in general, not in valid WebP) and therefore the ALLOCATE_PROGRESS cap. In order to avoid allocating progress in case of a frame-threaded WebP decoder the cap and the check for the cap has been kept in place. Yet now the VP8 decoder has been switched to use ProgressFrames and therefore there is just no reason any more for this check and the cap. This commit therefore removes both. Also change the value of FF_CODEC_CAP_USES_PROGRESSFRAMES to leave no gaps.

Andreas Rheinhardt committed 3 years ago

Commit 2b46ae61 parent d7374ac11 files · +18 −36Browse files

Showing the changes to libavcodec/tests (1 of 11 files). Show all

Unified · Split

libavcodec/tests/avcodec.c+0−5
@@ -142,7 +142,6 @@ int main(void){ · 141 unmodified lines
142 }142 }
143 }143 }
144 if (codec2->caps_internal & (FF_CODEC_CAP_USES_PROGRESSFRAMES |144 if (codec2->caps_internal & (FF_CODEC_CAP_USES_PROGRESSFRAMES |
145 FF_CODEC_CAP_ALLOCATE_PROGRESS |
146 FF_CODEC_CAP_SETS_PKT_DTS |145 FF_CODEC_CAP_SETS_PKT_DTS |
147 FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM |146 FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM |
148 FF_CODEC_CAP_EXPORTS_CROPPING |147 FF_CODEC_CAP_EXPORTS_CROPPING |
@@ -172,10 +171,6 @@ int main(void){ · 23 unmodified lines
172 AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE |171 AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE |
173 AV_CODEC_CAP_ENCODER_FLUSH))172 AV_CODEC_CAP_ENCODER_FLUSH))
174 ERR("Decoder %s has encoder-only capabilities\n");173 ERR("Decoder %s has encoder-only capabilities\n");
175 if (codec2->caps_internal & FF_CODEC_CAP_ALLOCATE_PROGRESS &&
176 !(codec->capabilities & AV_CODEC_CAP_FRAME_THREADS))
177 ERR("Decoder %s wants allocated progress without supporting"
178 "frame threads\n");
179 if (codec2->cb_type != FF_CODEC_CB_TYPE_DECODE &&174 if (codec2->cb_type != FF_CODEC_CB_TYPE_DECODE &&
180 codec2->caps_internal & FF_CODEC_CAP_SETS_PKT_DTS)175 codec2->caps_internal & FF_CODEC_CAP_SETS_PKT_DTS)
181 ERR("Decoder %s is marked as setting pkt_dts when it doesn't have"176 ERR("Decoder %s is marked as setting pkt_dts when it doesn't have"

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t