Message ID | HE1PR0301MB2154DAFA785C6401B510D3708F299@HE1PR0301MB2154.eurprd03.prod.outlook.com |
---|---|
State | Accepted |
Commit | 044daa7c450b132f4f5cdecb738089b3dd7db3f7 |
Headers | show |
Series | [FFmpeg-devel,01/39] avcodec/audiotoolboxenc: Remove AV_CODEC_CAP_DR1 | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
On Fri, May 21, 2021 at 2:18 AM Andreas Rheinhardt <andreas.rheinhardt@outlook.com> wrote: > > Here the packet size is known before allocating the packet because > the encoder provides said information (and works with internal buffers > itself), so one can use this information to avoid the implicit use of > another intermediate buffer for the packet data; and by switching to > ff_get_encode_buffer() one can also allow user-supplied buffers. > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> > --- > libavcodec/libaomenc.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > lgtm
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c index fcf75e835d..779714fdaa 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -36,6 +36,7 @@ #include "av1.h" #include "avcodec.h" +#include "encode.h" #include "internal.h" #include "packet_internal.h" #include "profiles.h" @@ -970,7 +971,7 @@ static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame, { AOMContext *ctx = avctx->priv_data; int av_unused pict_type; - int ret = ff_alloc_packet2(avctx, pkt, cx_frame->sz, 0); + int ret = ff_get_encode_buffer(avctx, pkt, cx_frame->sz, 0); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet of size %"SIZE_SPECIFIER".\n", cx_frame->sz); @@ -1344,11 +1345,12 @@ AVCodec ff_libaom_av1_encoder = { .long_name = NULL_IF_CONFIG_SMALL("libaom AV1"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_AV1, + .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | + AV_CODEC_CAP_OTHER_THREADS, .priv_data_size = sizeof(AOMContext), .init = av1_init, .encode2 = aom_encode, .close = aom_free, - .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS, .caps_internal = FF_CODEC_CAP_AUTO_THREADS, .profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles), .priv_class = &class_aom,
Here the packet size is known before allocating the packet because the encoder provides said information (and works with internal buffers itself), so one can use this information to avoid the implicit use of another intermediate buffer for the packet data; and by switching to ff_get_encode_buffer() one can also allow user-supplied buffers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/libaomenc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)