aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-12-20 12:59:29 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-12-20 12:59:41 +0100
commitbf00132a14b9c0c017404f2a36b9e9213b29e2cd (patch)
treed06a369dbd45b5e8a1035d2da84a7d215132bb85
parentede5946b709513b84e12c6afd6f963e9304214f5 (diff)
parentda4f5d9d77882bee568266d764b95b51f81b7871 (diff)
downloadffmpeg-bf00132a14b9c0c017404f2a36b9e9213b29e2cd.tar.gz
Merge commit 'da4f5d9d77882bee568266d764b95b51f81b7871' into release/2.2
* commit 'da4f5d9d77882bee568266d764b95b51f81b7871': mjpegdec: check for pixel format changes Conflicts: libavcodec/mjpegdec.c See: 5c378d6a6df8243f06c87962b873bd563e58cd39 See: a2f680c7bc7642c687aeb4e14d00ac74833c7a09 Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/mjpegdec.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index a811b51412..a867d06376 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -240,8 +240,8 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
{
int len, nb_components, i, width, height, bits, pix_fmt_id, ret;
- int h_count[MAX_COMPONENTS];
- int v_count[MAX_COMPONENTS];
+ int h_count[MAX_COMPONENTS] = { 0 };
+ int v_count[MAX_COMPONENTS] = { 0 };
s->cur_scan = 0;
s->upscale_h = s->upscale_v = 0;
@@ -249,7 +249,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
/* XXX: verify len field validity */
len = get_bits(&s->gb, 16);
s->avctx->bits_per_raw_sample =
- bits = get_bits(&s->gb, 8);
+ bits = get_bits(&s->gb, 8);
if (s->pegasus_rct)
bits = 9;
@@ -292,8 +292,6 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
s->nb_components = nb_components;
s->h_max = 1;
s->v_max = 1;
- memset(h_count, 0, sizeof(h_count));
- memset(v_count, 0, sizeof(v_count));
for (i = 0; i < nb_components; i++) {
/* component id */
s->component_id[i] = get_bits(&s->gb, 8) - 1;
@@ -328,10 +326,9 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
/* if different size, realloc/alloc picture */
- if ( width != s->width || height != s->height
- || bits != s->bits
- || memcmp(s->h_count, h_count, sizeof(h_count))
- || memcmp(s->v_count, v_count, sizeof(v_count))) {
+ if (width != s->width || height != s->height || bits != s->bits ||
+ memcmp(s->h_count, h_count, sizeof(h_count)) ||
+ memcmp(s->v_count, v_count, sizeof(v_count))) {
s->width = width;
s->height = height;