1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-08-09 02:45:45 +02:00
Commit Graph

190 Commits

Author SHA1 Message Date
Donny Yang
51d4bca5a4 avcodec/pngdec: fully support the tRNS chunk
Signed-off-by: Donny Yang <work@kota.moe>
2015-08-31 09:52:46 +00:00
Hendrik Leppkes
00b5c19661 Merge commit '4fee11ab05fc8569ef35c0ce86a60375c903eefb'
* commit '4fee11ab05fc8569ef35c0ce86a60375c903eefb':
  png: Be more informative regarding signature errors

Conflicts:
	libavcodec/pngdec.c

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-08-05 12:10:08 +02:00
Luca Barbato
4fee11ab05 png: Be more informative regarding signature errors
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-08-02 14:31:09 +02:00
Michael Niedermayer
444e9874a7 Merge commit 'def97856de6021965db86c25a732d78689bd6bb0'
* commit 'def97856de6021965db86c25a732d78689bd6bb0':
  lavc: AV-prefix all codec capabilities

Conflicts:
	cmdutils.c
	ffmpeg.c
	ffplay.c
	libavcodec/8svx.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.c
	libavcodec/adpcm.c
	libavcodec/alac.c
	libavcodec/atrac3plusdec.c
	libavcodec/bink.c
	libavcodec/dnxhddec.c
	libavcodec/dvdec.c
	libavcodec/dvenc.c
	libavcodec/ffv1dec.c
	libavcodec/ffv1enc.c
	libavcodec/fic.c
	libavcodec/flacdec.c
	libavcodec/flacenc.c
	libavcodec/flvdec.c
	libavcodec/fraps.c
	libavcodec/frwu.c
	libavcodec/gifdec.c
	libavcodec/h261dec.c
	libavcodec/hevc.c
	libavcodec/iff.c
	libavcodec/imc.c
	libavcodec/libopenjpegdec.c
	libavcodec/libvo-aacenc.c
	libavcodec/libvorbisenc.c
	libavcodec/libvpxdec.c
	libavcodec/libvpxenc.c
	libavcodec/libx264.c
	libavcodec/mjpegbdec.c
	libavcodec/mjpegdec.c
	libavcodec/mpegaudiodec_float.c
	libavcodec/msmpeg4dec.c
	libavcodec/mxpegdec.c
	libavcodec/nvenc_h264.c
	libavcodec/nvenc_hevc.c
	libavcodec/pngdec.c
	libavcodec/qpeg.c
	libavcodec/ra288.c
	libavcodec/rv10.c
	libavcodec/s302m.c
	libavcodec/sp5xdec.c
	libavcodec/takdec.c
	libavcodec/tiff.c
	libavcodec/tta.c
	libavcodec/utils.c
	libavcodec/v210dec.c
	libavcodec/vp6.c
	libavcodec/vp9.c
	libavcodec/wavpack.c
	libavcodec/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 22:50:18 +02:00
Vittorio Giovara
def97856de lavc: AV-prefix all codec capabilities
Express bitfields more simply.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:58 +01:00
Donny Yang
a906e86a8d apng: Fix decoding images with the PREVIOUS dispose op 2015-07-22 16:42:24 +00:00
Donny Yang
0030613d69 avcodec/apngdec: Fix typos in decoder causing incorrect results
Signed-off-by: Donny Yang <work@kota.moe>
2015-07-20 13:46:50 +00:00
Michael Niedermayer
b54ac8403b avcodec/pngdec: Check values before updating context in decode_fctl_chunk()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-29 22:32:02 +02:00
Michael Niedermayer
f1ffa01dd3 avcodec/pngdec: Copy IHDR & plte state from last thread
Previously these chunks where parsed again for each frame with threads
but not without leading to a different path and the potential for
inconsistencies

This also removes a related special case from decode_ihdr_chunk()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-29 22:16:58 +02:00
Michael Niedermayer
a1736926e9 avcodec/pngdec: Require a IHDR chunk before fctl
This is required by the APNG spec

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-29 21:57:12 +02:00
Michael Niedermayer
47f4e2d896 avcodec/pngdec: Only allow one IHDR chunk
Multiple IHDR chunks are forbidden in PNG
Fixes inconsistency and out of array accesses

Fixes: asan_heap-oob_4d5c5a_1738_cov_2638287726_c-m2-8f2b481b7fd9bd745e620b7c01a18df2.png

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-29 21:30:57 +02:00
Donny Yang
130a6c04a4 avcodec/apng: Add partial support for blending with PAL8 pixel format
Currently restricted to blending pixels that only contain either
0 or 255 in their alpha components

Signed-off-by: Donny Yang <work@kota.moe>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-08 16:27:57 +02:00
Donny Yang
33292c07fe avcodec/apng: Add support for blending with GRAY8A pixel format
Signed-off-by: Donny Yang <work@kota.moe>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-08 16:18:34 +02:00
Donny Yang
0ab1c46fe0 avcodec/apng: Add blending support for non-alpha pixel formats
Signed-off-by: Donny Yang <work@kota.moe>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-08 15:44:22 +02:00
Donny Yang
ed09bb3782 avcodec/apng: Dispose previous frame properly
The spec specifies the dispose operation as how the current (i.e., currently
being rendered) frame should be disposed when the next frame is blended onto it

This is contrary to ffmpeg's current behaviour of interpreting the dispose
operation as how the previous (i.e., already rendered) frame should be disposed

This patch fixes ffmpeg's behaviour to match those of the spec, which involved
a rewrite of the blending function

Signed-off-by: Donny Yang <work@kota.moe>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-08 15:32:49 +02:00
Donny Yang
7495e728f5 avcodec/apng: Remove blending support for AV_PIX_FMT_ARGB
ARGB is not a supported PNG pixel format

Signed-off-by: Donny Yang <work@kota.moe>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-03 01:42:57 +02:00
Michael Niedermayer
f230451b7a Merge commit 'b9f7a677083647d85e583d6d7384938766a293d7'
* commit 'b9f7a677083647d85e583d6d7384938766a293d7':
  png: Set the color range as full range

Conflicts:
	libavcodec/pngdec.c

See: 72e7553125
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-10 22:42:56 +02:00
wm4
b9f7a67708 png: Set the color range as full range
The format uses full range for the gray formats.

CC: libav-stable@libav.org
2015-05-09 15:55:50 +02:00
wm4
72e7553125 pngdec: set correct range
AV_PIX_FMT_GRAY8/16 are considered YUV formats, and the color_range is
not set - so the API user will have to assume limitted range. (Unless
the API user adds a special-case for the PNG decoder.)

Just export the correct range - full range.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-08 00:44:06 +02:00
Andreas Cadhalpun
372aa0777a pngdec: don't use AV_PIX_FMT_MONOBLACK for apng
AV_PIX_FMT_MONOBLACK has the AV_PIX_FMT_FLAG_BITSTREAM flag, i.e.
linesize can be smaller than width.

Since x_offset is only check against the width, this can lead to
x_offset * bpp >= image_linesize.

In this case ptr could be set to a position outside the image_buf in
png_handle_row, leading to memory corruption and thus crashes.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-03 21:50:09 +02:00
Andreas Cadhalpun
8f760be4d3 pngdec: return correct error code from decode_frame_common
During the loop ret can get changed. Since it is not set on all failure
paths, decode_frame_common can return 0 even though an error occurred.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-03 20:28:35 +02:00
Andreas Cadhalpun
287dbb0771 pngdec: check s->last_picture.f->data[0] before using it
This check was removed in commit 08aec6f6, but
s->last_picture.f->data[0] is still used in handle_p_frame_apng
unconditionally.

This fixes a segmentation fault.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-03 17:24:28 +02:00
Michael Niedermayer
8f7b022c8c Merge commit '6a85dfc830f51f1f5c2d36d4182d265c1ea3ba25'
* commit '6a85dfc830f51f1f5c2d36d4182d265c1ea3ba25':
  lavc: Replace av_dlog and tprintf with internal macros

Conflicts:
	libavcodec/aacdec.c
	libavcodec/audio_frame_queue.c
	libavcodec/bitstream.c
	libavcodec/dcadec.c
	libavcodec/dnxhddec.c
	libavcodec/dvbsubdec.c
	libavcodec/dvdec.c
	libavcodec/dvdsubdec.c
	libavcodec/get_bits.h
	libavcodec/gifdec.c
	libavcodec/h264.h
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_loopfilter.c
	libavcodec/h264_refs.c
	libavcodec/imc.c
	libavcodec/interplayvideo.c
	libavcodec/jpeglsdec.c
	libavcodec/libopencore-amr.c
	libavcodec/mjpegdec.c
	libavcodec/mpeg12dec.c
	libavcodec/mpegvideo_enc.c
	libavcodec/mpegvideo_parser.c
	libavcodec/pngdec.c
	libavcodec/ratecontrol.c
	libavcodec/rv10.c
	libavcodec/svq1dec.c
	libavcodec/vqavideo.c
	libavcodec/wmadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-20 04:10:10 +02:00
Vittorio Giovara
6a85dfc830 lavc: Replace av_dlog and tprintf with internal macros 2015-04-19 12:41:59 +01:00
Michael Niedermayer
cd960c8a4f Merge commit '1e763454322f7fbc7799f6009bf2e11d7a3b9821'
* commit '1e763454322f7fbc7799f6009bf2e11d7a3b9821':
  png: improve signature check

Conflicts:
	libavcodec/pngdec.c

See: 8a08503b78
See: 0a3589bf2f
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-15 02:54:04 +01:00
Vittorio Giovara
1e76345432 png: improve signature check
Return proper error code, print an error message and add missing
parentheses.
2015-01-14 17:10:19 +01:00
Michael Niedermayer
82a60de3b7 avcodec/pngdec: handle 4 more bytes with SIMD for RGB64 in paeth prediction
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-08 18:24:58 +01:00
Michael Niedermayer
ed9be7dd47 avcodec/x86/pngdsp: fix off by 1 error
This fixes artifacts in the last pixel of rows with some widths and pixel formats

Found-by: Dominique Leroux <Dominique.Leroux@autodesk.com>
Tested-by: Dominique Leroux <Dominique.Leroux@autodesk.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-08 18:24:40 +01:00
Benoit Fouet
4fa2758c79 avcodec/pngdec: check av_image_get_linesize return value
Fixes CID 1257012

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-08 04:58:00 +01:00
Benoit Fouet
0f6931f4b6 avcodec/pngdec: use memcpy instead of byte loops for P frames.
Rely on the way memcpy is optimized for one's system instead of looping
on a byte buffer for buffer copies to handle P frames.

Tested-by: Christophe Gisquet <christophe.gisquet@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 17:01:04 +01:00
Benoit Fouet
1d69ab9d1c avcodec/pngdec: fix indentation in handle_row()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 00:31:11 +01:00
Benoit Fouet
6e9b060e4f avcodec/pngdec: fix mem leak in init()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 00:30:54 +01:00
Benoit Fouet
08aec6f68e libavcodec/pngdec: support 'previous' dispose operation for APNG.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 00:30:38 +01:00
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