aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/snowdec.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-09-25 18:21:55 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-09-28 00:17:47 +0200
commit418332e01ce99d43f218504e4e4e1b4ea89c9a49 (patch)
tree53db7aa3c53bdfecde26b54e2d9c2154386c53c7 /libavcodec/snowdec.c
parent0228e27dedc66c98e5b25dee0f95e664a185bbf1 (diff)
downloadffmpeg-418332e01ce99d43f218504e4e4e1b4ea89c9a49.tar.gz
avcodec/snow: Split ff_snow_get_buffer()
The part of said function that is common to both encoder and decoder is negligible since c954cf1e1b766a0d1992d5be0a8be0055a8e1a6a and more than offset by the costs of "Am I an encoder?" checks. So move allocating the frames to the encoder and decoder directly. Also rename ff_snow_frame_start() to ff_snow_frames_prepare(), because a frame without a buffer has not been properly started. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/snowdec.c')
-rw-r--r--libavcodec/snowdec.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/snowdec.c b/libavcodec/snowdec.c
index e014d5087f..489c09324e 100644
--- a/libavcodec/snowdec.c
+++ b/libavcodec/snowdec.c
@@ -24,6 +24,7 @@
#include "libavutil/opt.h"
#include "avcodec.h"
#include "codec_internal.h"
+#include "decode.h"
#include "snow_dwt.h"
#include "snow.h"
@@ -475,7 +476,13 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
ff_snow_alloc_blocks(s);
- if((res = ff_snow_frame_start(s)) < 0)
+ if ((res = ff_snow_frames_prepare(s)) < 0)
+ return res;
+
+ s->current_picture->width = s->avctx->width;
+ s->current_picture->height = s->avctx->height;
+ res = ff_get_buffer(s->avctx, s->current_picture, AV_GET_BUFFER_FLAG_REF);
+ if (res < 0)
return res;
s->current_picture->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;