[FFmpeg-cvslog] cpia: move reget_buffer after header check
Stephan Hilb
git at videolan.org
Sat Sep 1 14:28:34 CEST 2012
ffmpeg | branch: master | Stephan Hilb <stephan at ecshi.net> | Sat Sep 1 10:12:33 2012 +0200| [296140ebfb7242211852f7736f72dc7f05f0c458] | committer: Stephan Hilb
cpia: move reget_buffer after header check
If the header is invalid, there is no need to get at buffer.
Do it after the header has been checked.
Suggested by Reimar Döffinger
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=296140ebfb7242211852f7736f72dc7f05f0c458
---
libavcodec/cpia.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libavcodec/cpia.c b/libavcodec/cpia.c
index c45936b..a631a05 100644
--- a/libavcodec/cpia.c
+++ b/libavcodec/cpia.c
@@ -61,12 +61,6 @@ static int cpia_decode_frame(AVCodecContext* avctx,
AVFrame* const frame = &cpia->frame;
uint8_t *y, *u, *v, *y_end, *u_end, *v_end;
- // Get buffer filled with previous frame
- if ((ret = avctx->reget_buffer(avctx, frame)) < 0) {
- av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed!\n");
- return ret;
- }
-
// Check header
if ( avpkt->size < FRAME_HEADER_SIZE
|| header[0] != MAGIC_0 || header[1] != MAGIC_1
@@ -104,6 +98,12 @@ static int cpia_decode_frame(AVCodecContext* avctx,
frame->key_frame = 0;
}
+ // Get buffer filled with previous frame
+ if ((ret = avctx->reget_buffer(avctx, frame)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed!\n");
+ return ret;
+ }
+
for ( i = 0;
i < frame->height;
More information about the ffmpeg-cvslog
mailing list