1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-08-10 19:35:05 +02:00
Commit Graph

208 Commits

Author SHA1 Message Date
Andreas Cadhalpun
e0c6b32046 apngdec: use side data to pass extradata to the decoder
Fixes remuxing apng streams coming from the apng demuxer.
This is a regression since 940b8908b9.

Found-by: James Almer <jamrial@gmail.com>
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-01 18:49:28 +01:00
Clément Bœsch
8ef57a0d61 Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'
* commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb':
  cosmetics: Fix spelling mistakes

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 21:55:34 +02:00
Vittorio Giovara
41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +02:00
Michael Niedermayer
d433623fba avcodec/pngdec: Fix alpha detection with skip_frame
Fixes Ticket4816

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-09 01:10:58 +02:00
James Almer
1bb3b90db8 avcodec/pngdec: use av_mod_uintp2
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-01-29 19:58:41 -03:00
Michael Niedermayer
a62178be80 avcodec/pngdec: Replace assert by request for sample for unsupported TRNS cases
Fixes assertion failure
Fixes: 7f646252a30ee28b583aac1f82e7985e/signal_sigabrt_7ffff6ae7cc9_7353_62fc077bf2f454d39e188c69807193a6.png

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-16 18:48:02 +01:00
Matthieu Bouron
0cdc77f104 lavc/pngdec: set FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM capability 2015-11-15 10:13:24 +01:00
Andreas Cadhalpun
3e8e1a660e apng: use correct size for output buffer
The buffer needs s->bpp bytes, at maximum currently 10.
Assert that s->bpp is not larger.

This fixes a stack buffer overflow.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-11-07 13:15:14 +01:00
Hendrik Leppkes
1fc13a6269 Merge commit '1720791e36f9cc24c05efea5bb275ab52156ce50'
* commit '1720791e36f9cc24c05efea5bb275ab52156ce50':
  png: read and write stereo3d frame side data information

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-02 11:50:35 +01:00
Kirill Gavrilov
1720791e36 png: read and write stereo3d frame side data information
Use optional sTER chunk defining side-by-side stereo pair
within "Extensions to the PNG 1.2 Specification", version 1.3.0.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-10-30 12:46:56 +01:00
Matthieu Bouron
cbe2dfa4e5 lavc/pngdec: honor skip_frame option 2015-10-29 12:04:06 +01:00
Kirill Gavrilov
bea931c2eb avcodec/png: read and write stereo3d frame side data information
Use optional sTER chunk defining side-by-side stereo pair
within "Extensions to the PNG 1.2 Specification", version 1.3.0.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-28 12:59:43 +01:00
Michael Niedermayer
98b8bf12bc avcodec/pngdec: Use av_malloc_array()
Suggested-by: ubitux
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-11 16:39:41 +02:00
Michael Niedermayer
47c5a3058e avcodec/pngdec: Alloc buffer after blend_op check in handle_p_frame_apng()
Avoids memleak on error
Fixes CID1322342

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-11 13:09:56 +02:00
Michael Niedermayer
1e7e4f13f9 avcodec/pngdec: Check blend_op.
Fixes CID1322359, CID1322358

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-11 03:46:44 +02:00
Ganesh Ajjanagadde
2cbaa078d1 avcodec: use HAVE_THREADS header guards to silence -Wunused-function
When compiled with --disable-pthreads, e.g
http://fate.ffmpeg.org/report.cgi?time=20150917015044&slot=alpha-debian-qemu-gcc-4.7,
a bunch of -Wunused-functions are reported due to missing header guards
around threading related functions.
This patch should silence such warnings.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-10-04 12:47:34 -04:00
Michael Niedermayer
9e9d731b51 avcodec/pngdec: mark previous_picture as done on end of decode_frame_common()
Fixes deadlock with threads

Found-by: Paul B Mahol
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-01 01:11:45 +02:00
Paul B Mahol
1d0487f77f avcodec/pngdec: reset has_trns after every decode_frame_png()
Fixes #4887.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-09-28 20:54:09 +02:00
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