diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-04-06 14:43:14 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-04-10 22:37:32 +0200 |
commit | 3fe37033b982efa3e76e6dec977dc5048597937b (patch) | |
tree | b93acf726378041bf927cbac24212a010a8836ec /libavcodec/pnm_parser.c | |
parent | 1d43d72b181afd59f9719c3bc38446f206fc3c6e (diff) | |
download | ffmpeg-3fe37033b982efa3e76e6dec977dc5048597937b.tar.gz |
avcodec/pnm_parser: Factor out next/index compensation
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/pnm_parser.c')
-rw-r--r-- | libavcodec/pnm_parser.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c index 91a9edc016..95241c30b3 100644 --- a/libavcodec/pnm_parser.c +++ b/libavcodec/pnm_parser.c @@ -70,19 +70,17 @@ retry: c = *bs++; } else if (c == 'P') { next = bs - pnmctx.bytestream_start + skip - 1; - if (pnmctx.bytestream_start != buf + skip) - next -= pc->index; break; } } } else { next = pnmctx.bytestream - pnmctx.bytestream_start + skip + av_image_get_buffer_size(avctx->pix_fmt, avctx->width, avctx->height, 1); - if (pnmctx.bytestream_start != buf + skip) - next -= pc->index; - if (next > buf_size) - next = END_NOT_FOUND; } + if (next != END_NOT_FOUND && pnmctx.bytestream_start != buf + skip) + next -= pc->index; + if (next > buf_size) + next = END_NOT_FOUND; if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { *poutbuf = NULL; |