Commit Graph

157 Commits

Author SHA1 Message Date
Benoit Fouet
543fceba9c apng: move shared header from avformat to avcodec.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-02 15:52:31 +01:00
Benoit Fouet
ebf2052a61 avcodec/pngdec: apng: fix output buffer filling when no blending is needed.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-28 17:55:18 +01:00
Benoit Fouet
af8804ac86 avcodec/pngdec: allow for some code path optimizations.
Use 'if (CONFIG_APNG_DECODER)' where needed, so that the compiler can
optimize out some portion of code.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-28 15:51:31 +01:00
Benoit Fouet
aff50ae1d1 avcodec/pngdec: do not blend on transparent black
There is no need to memset the zlib output buffer, as there is no
blending happening there. Instead, do not blend when the dispose
operation is set to 'background' (tranparent black).

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-28 15:51:23 +01:00
Benoit Fouet
cfd83a8af6 avcodec/pngdec: add support for 'over' blend operation for 'none' dispose operation.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-28 01:58:01 +01:00
Benoit Fouet
7dfee8d697 avcodec/pngdec: split P frames handling to a separate function.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-28 01:57:52 +01:00
Michael Niedermayer
9a53707e86 avcodec/pngdec: Fix paeth prediction with small images
Fixes out of array read
Fixes: asan_heap-oob_20b0a06_1962_cov_1907976991_delete_node_small.png
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-26 17:01:26 +01:00
Michael Niedermayer
79ceaf827b avcodec/pngdec: Check IHDR/IDAT order
Fixes out of array access
Fixes: asan_heap-oob_20a6c26_2690_cov_3434532168_mail.png
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-26 16:00:01 +01:00
Benoit Fouet
33acebd3cc avcodec/pngdec: add APNG support.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-21 17:13:56 +01:00
Benoit Fouet
00df32f6a9 avcodec/pngdec: split frame decoding in its own function.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-14 17:20:43 +01:00
Benoit Fouet
8cab24df07 avcodec/pngdec: create a function to handle small (<=4) bits per pixel values.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-14 17:13:08 +01:00
Benoit Fouet
24ca2ffad8 avcodec/pngdec: use else if instead of if for small bpp handling.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-14 17:12:39 +01:00
Benoit Fouet
c25b6ae8a2 avcodec/pngdec: fix some indentation/whitespaces
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-14 16:59:03 +01:00
Benoit Fouet
6499e63f7b avcodec/pngdec: create a function to decode tRNS chunk.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-14 16:58:37 +01:00
Benoit Fouet
4f313a50ee avcodec/pngdec: create a function to decode PLTE chunk.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-14 16:17:00 +01:00
Benoit Fouet
b35fa04152 avcodec/pngdec: create a function to decode IDAT chunk.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-14 16:16:47 +01:00
Benoit Fouet
3f1eaf590c avcodec/pngdec: create a function to decode pHYs chunk.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-14 15:58:35 +01:00
Benoit Fouet
1523d1484d avcodec/pngdec: create a function to decode IHDR chunk.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-14 15:58:02 +01:00
Benoit Fouet
98abb98cb1 avcodec/pngdec: rename decode_frame to decode_frame_png
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-14 15:35:12 +01:00
Michael Niedermayer
e830902934 avcodec/pngdec: Calculate MPNG bytewidth more defensively
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 18:06:33 +02:00
Michael Niedermayer
3e2b745020 avcodec/pngdec: Check bits per pixel before setting monoblack pixel format
Fixes out of array accesses
Fixes: asan_heap-oob_14dbfcf_4_asan_heap-oob_1ce5767_179_add_method_small.png

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 17:37:15 +02:00
Michael Niedermayer
a6153bde3d avcodec/pngdec: print the actual number of bytes left in the error case
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-11 16:47:01 +02:00
Michael Niedermayer
59412e3a07 Merge commit 'e64f0bf2d2b1347ec9461f0e82852a62e8c6ffbe'
* commit 'e64f0bf2d2b1347ec9461f0e82852a62e8c6ffbe':
  png: support reading gray+alpha at 16 bits

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-04 22:38:12 +02:00
Michael Niedermayer
4c8bc6fdee Merge commit 'e96c3b81cadd0ba84d43b1f3a54980df3785d9a5'
* commit 'e96c3b81cadd0ba84d43b1f3a54980df3785d9a5':
  avutil: rename AV_PIX_FMT_Y400A to AV_PIX_FMT_YA8

Conflicts:
	libavcodec/libopenjpegdec.c
	libavcodec/libopenjpegenc.c
	libavcodec/raw.c
	libavutil/pixdesc.c
	libavutil/pixfmt.h
	libavutil/version.h
	libswscale/swscale_internal.h
	libswscale/swscale_unscaled.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-04 21:48:00 +02:00
Vittorio Giovara
e64f0bf2d2 png: support reading gray+alpha at 16 bits 2014-08-04 12:57:38 +01:00
Vittorio Giovara
2257165bff png: disable broken MMX/SIMD code for bpp <= 2
The decoder was producing different results when ASM was disabled.
Based on a long debug session with Kostya.
2014-08-04 12:57:38 +01:00
Vittorio Giovara
e96c3b81ca avutil: rename AV_PIX_FMT_Y400A to AV_PIX_FMT_YA8
The rationale is that you have a packed format in form
<greyscale sample> <alpha sample> <greyscale sample> <alpha sample>
and shortening greyscale to 'G' might make one thing about Greenscale instead.
An alias pixel format and color space name are provided for compatibility.
2014-08-04 12:55:08 +01:00
Michael Niedermayer
5727d387fb Merge commit '92a36a6b3338df5f5cff573a486e182005367c24'
* commit '92a36a6b3338df5f5cff573a486e182005367c24':
  pngdec: correctly indent macros

Conflicts:
	libavcodec/pngdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-01 16:48:09 +02:00
Vittorio Giovara
92a36a6b33 pngdec: correctly indent macros 2014-08-01 13:07:53 +01:00
Michael Niedermayer
c163f5e601 avcodec/pngdec: fix () in OP_* macros
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-25 19:25:10 +02:00
Michael Niedermayer
a00d4c5956 Merge commit 'c598b569fb3d1f4b6c4868fe64f6989254df5186'
* commit 'c598b569fb3d1f4b6c4868fe64f6989254df5186':
  png: K&R formatting cosmetics

Conflicts:
	libavcodec/png.c
	libavcodec/pngdec.c
	libavcodec/pngenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-17 15:29:42 +01:00
Vittorio Giovara
c598b569fb png: K&R formatting cosmetics 2014-03-16 23:29:50 +01:00
Carl Eugen Hoyos
666749f669 Decode png images without iend chunk.
Fixes ticket #3357.
2014-03-11 09:56:38 +01:00
Michael Niedermayer
cb079b1b2b avcodec/pngdec: fix signed overflow
fixes fate ftrapv failure

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-18 22:15:32 +01:00
Michael Niedermayer
ee77140afa Merge commit 'b2bed9325dbd6be0da1d91ffed3f513c40274fd2'
* commit 'b2bed9325dbd6be0da1d91ffed3f513c40274fd2':
  cosmetics: Group .name and .long_name together in codec/format declarations

Conflicts:
	libavcodec/8svx.c
	libavcodec/alac.c
	libavcodec/cljr.c
	libavcodec/dnxhddec.c
	libavcodec/dnxhdenc.c
	libavcodec/dpxenc.c
	libavcodec/dvdec.c
	libavcodec/dvdsubdec.c
	libavcodec/dvdsubenc.c
	libavcodec/ffv1dec.c
	libavcodec/flacdec.c
	libavcodec/flvdec.c
	libavcodec/fraps.c
	libavcodec/frwu.c
	libavcodec/g726.c
	libavcodec/gif.c
	libavcodec/gifdec.c
	libavcodec/h261dec.c
	libavcodec/h263dec.c
	libavcodec/iff.c
	libavcodec/imc.c
	libavcodec/libopencore-amr.c
	libavcodec/libopenjpegdec.c
	libavcodec/libopenjpegenc.c
	libavcodec/libspeexenc.c
	libavcodec/libvo-amrwbenc.c
	libavcodec/libvorbisenc.c
	libavcodec/libvpxenc.c
	libavcodec/libx264.c
	libavcodec/libxavs.c
	libavcodec/libxvid.c
	libavcodec/ljpegenc.c
	libavcodec/mjpegbdec.c
	libavcodec/mjpegdec.c
	libavcodec/mpeg12dec.c
	libavcodec/mpeg4videodec.c
	libavcodec/msmpeg4dec.c
	libavcodec/pgssubdec.c
	libavcodec/pngdec.c
	libavcodec/pngenc.c
	libavcodec/proresdec_lgpl.c
	libavcodec/proresenc_kostya.c
	libavcodec/ra144enc.c
	libavcodec/rawdec.c
	libavcodec/rv10.c
	libavcodec/sp5xdec.c
	libavcodec/takdec.c
	libavcodec/tta.c
	libavcodec/v210dec.c
	libavcodec/vp6.c
	libavcodec/wavpack.c
	libavcodec/xbmenc.c
	libavcodec/yop.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-04 12:34:23 +02:00
Diego Biurrun
b2bed9325d cosmetics: Group .name and .long_name together in codec/format declarations 2013-10-03 23:32:01 +02:00
Michael Niedermayer
9834874f8c Merge commit 'a81cad8f86d1feb7e4bfae29e43f3e994935a5c7'
* commit 'a81cad8f86d1feb7e4bfae29e43f3e994935a5c7':
  pngdec: Stop trying to decode once inflate returns Z_STREAM_END

Conflicts:
	libavcodec/pngdec.c

See: 65bf9a44d7
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-30 00:40:17 +02:00
Martin Storsjö
a81cad8f86 pngdec: Stop trying to decode once inflate returns Z_STREAM_END
If the input buffer contains more data after the deflate stream,
the loop previously left running infinitely, with inflate returning
Z_STREAM_END.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-29 20:01:03 +03:00
Michael Niedermayer
65bf9a44d7 avcodec/pngdec: check for stream end in png_decode_idat()
Fix infinite loop
Fix Ticket2978

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-25 02:17:36 +02:00
Paul B Mahol
7d7b4e8d5c avcodec/png: remove obsolete comments
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-09-08 15:13:33 +00:00
Michael Niedermayer
60fed98e63 avcodec/pngdec: fix last_row_size type
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-30 19:34:24 +02:00
Michael Niedermayer
7b47d7f75e avcodec/pngdec: Fix padded alloc code with threads
Fixes Ticket2903
Fixes out of array write
no releases should be affected by this

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-30 19:34:23 +02:00
Paul B Mahol
2a75459519 pngdec: do not release buffer on failure instead report full progress
Should fix heap-use-after-free as reported by Address Sanitizer.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-08-23 21:08:32 +00:00
Paul B Mahol
dd1d29bd5f pngdec: use av_fast_padded_malloc(z)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-08-23 10:29:33 +00:00
Paul B Mahol
6e643239d9 pngdec: frame multithreading support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-08-22 13:14:25 +00:00
Stefano Sabatini
0a3589bf2f lavc/pngdec: return meaningful error codes 2013-06-25 21:28:56 +02:00
Michael Niedermayer
3b58ab4c5f pngdec: dont treat mpng like png with key and non keyframes
Fixes Ticket2618

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-04 20:40:07 +02:00
Michael Niedermayer
efc08e00cc Merge commit 'b3ea76624ad1baab0b6bcc13f3f856be2f958110'
* commit 'b3ea76624ad1baab0b6bcc13f3f856be2f958110':
  vf_aspect: use the name 's' for the pointer to the private context
  Remove commented-out debug #define cruft

Conflicts:
	libavcodec/4xm.c
	libavcodec/dvdsubdec.c
	libavcodec/ituh263dec.c
	libavcodec/mpeg12.c
	libavfilter/avfilter.c
	libavfilter/vf_aspect.c
	libavfilter/vf_fieldorder.c
	libavformat/rtmpproto.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-16 09:56:43 +02:00
Diego Biurrun
2832ea26f3 Remove commented-out debug #define cruft 2013-05-16 00:23:30 +02:00
Clément Bœsch
1ec94b0f06 lavc: factorize ff_{thread_,re,}get_buffer error messages.
Coccinelle profile used:

  @@
  expression r, ctx, f, loglevel, str, flags;
  @@

  -if ((r = ff_get_buffer(ctx, f, flags)) < 0) {
  -    av_log(ctx, loglevel, str);
  -    return r;
  -}
  +if ((r = ff_get_buffer(ctx, f, flags)) < 0)
  +    return r;

  @@
  expression r, ctx, f, loglevel, str;
  @@

  -if ((r = ff_reget_buffer(ctx, f)) < 0) {
  -    av_log(ctx, loglevel, str);
  -    return r;
  -}
  +if ((r = ff_reget_buffer(ctx, f)) < 0)
  +    return r;

  @@
  expression r, ctx, f, loglevel, str, flags;
  @@

  -if ((r = ff_thread_get_buffer(ctx, f, flags)) < 0) {
  -    av_log(ctx, loglevel, str);
  -    return r;
  -}
  +if ((r = ff_thread_get_buffer(ctx, f, flags)) < 0)
  +    return r;

...along with some manual patches for the remaining ones.
2013-03-13 19:00:10 +01:00