summaryrefslogtreecommitdiff
path: root/libavcodec/ffv1dec.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec/ffv1dec: Check state transition tableMichael Niedermayer2018-06-251-2/+8
| | | | | | | | Fixes: Timeout Fixes: 8646/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-5649968353247232 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/pixdesc: deprecate AV_PIX_FMT_FLAG_PSEUDOPALwm42018-04-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PSEUDOPAL pixel formats are not paletted, but carried a palette with the intention of allowing code to treat unpaletted formats as paletted. The palette simply mapped the byte values to the resulting RGB values, making it some sort of LUT for RGB conversion. It was used for 1 byte formats only: RGB4_BYTE, BGR4_BYTE, RGB8, BGR8, GRAY8. The first 4 are awfully obscure, used only by some ancient bitmap formats. The last one, GRAY8, is more common, but its treatment is grossly incorrect. It considers full range GRAY8 only, so GRAY8 coming from typical Y video planes was not mapped to the correct RGB values. This cannot be fixed, because AVFrame.color_range can be freely changed at runtime, and there is nothing to ensure the pseudo palette is updated. Also, nothing actually used the PSEUDOPAL palette data, except xwdenc (trivially changed in the previous commit). All other code had to treat it as a special case, just to ignore or to propagate palette data. In conclusion, this was just a very strange old mechnaism that has no real justification to exist anymore (although it may have been nice and useful in the past). Now it's an artifact that makes the API harder to use: API users who allocate their own pixel data have to be aware that they need to allocate the palette, or FFmpeg will crash on them in _some_ situations. On top of this, there was no API to allocate the pseuo palette outside of av_frame_get_buffer(). This patch not only deprecates AV_PIX_FMT_FLAG_PSEUDOPAL, but also makes the pseudo palette optional. Nothing accesses it anymore, though if it's set, it's propagated. It's still allocated and initialized for compatibility with API users that rely on this feature. But new API users do not need to allocate it. This was an explicit goal of this patch. Most changes replace AV_PIX_FMT_FLAG_PSEUDOPAL with FF_PSEUDOPAL. I first tried #ifdefing all code, but it was a mess. The FF_PSEUDOPAL macro reduces the mess, and still allows defining FF_API_PSEUDOPAL to 0. Passes FATE with FF_API_PSEUDOPAL enabled and disabled. In addition, FATE passes with FF_API_PSEUDOPAL set to 1, but with allocation functions manually changed to not allocating a palette.
* avcodec/ffv1: support of more pix_fmtJérôme Martinez2018-03-101-1/+13
| | | | | | | | Without direct support of such pix_fmt, content is padded to 16-bit and it is not possible to know that the source file was with a smaller bit depth so framemd5 is different Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1: Support for GBRAP10 and GBRAP12Jérôme Martinez2018-02-151-0/+4
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1: Support for RGBA64 and GBRAP16Jérôme Martinez2018-02-061-4/+10
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1dec: Fix out of array read in slice countingMichael Niedermayer2017-10-101-1/+1
| | | | | | | Fixes: test-201710.mp4 Found-by: 连一汉 <lianyihan@360.cn> and Zhibin Hu Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1dec: Fix integer overflow in read_quant_table()Michael Niedermayer2017-09-221-1/+1
| | | | | | | | Fixes: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int' Fixes: 3361/clusterfuzz-testcase-minimized-5065842955911168 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1dec: Check for bitstream end in decode_line()Michael Niedermayer2017-08-181-3/+21
| | | | | | | | Fixes: timeout Fixes: 2971/clusterfuzz-testcase-6130678276030464 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1dec: Fix runtime error: signed integer overflow: 1550964438 + ↵Michael Niedermayer2017-05-131-1/+2
| | | | | | | | | | 1550964438 cannot be represented in type 'int' Fixes: 1559/clusterfuzz-testcase-minimized-5048096079740928 Fixes: 1560/clusterfuzz-testcase-minimized-6011037813833728 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1dec: Fix copying planes of paletted formatsMichael Niedermayer2017-05-081-1/+7
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Fix all -Wformat warnings raised by DJGPPClément Bœsch2017-03-291-1/+1
|
* Merge commit '17cb56b35672a2cd6ad7abe926e6cc772b8f4710'Clément Bœsch2017-03-191-5/+0
|\ | | | | | | | | | | | | * commit '17cb56b35672a2cd6ad7abe926e6cc772b8f4710': ffv1: Remove broken disabled cruft Merged-by: Clément Bœsch <u@pkh.me>
| * ffv1: Remove broken disabled cruftDiego Biurrun2016-08-171-5/+0
| |
| * ffv1: Report additional bitstream information in verbose modeLuca Barbato2016-06-291-0/+7
| | | | | | | | Useful to inspect samples.
| * ffv1: Error out on unsupported formatJerome Martinez2016-06-181-0/+11
| | | | | | | | Transparency is supported only by YUV and within specific bit depths.
| * lavu: add AV_CEIL_RSHIFT and use it in various placesClément Bœsch2016-01-111-2/+2
| | | | | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | lavc/ffv1: Support YUV4xxP12 and GRAY12.Carl Eugen Hoyos2016-11-201-0/+7
| |
* | avcodec/ffv1dec: Set packed_at_lsb for 16bit YUVMichael Niedermayer2016-11-181-0/+2
| | | | | | | | | | | | This avoids unneeded computations Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1dec: Support gray 10/12/16 explicitly avoid shiftsMichael Niedermayer2016-11-181-1/+12
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc/ffv1dec: Scale output for msb-packed compression to full 16bit.Carl Eugen Hoyos2016-11-171-1/+1
| | | | | | | | 2% slowdown for existing decode-line timer.
* | avcodec/ffv1: add AV_PIX_FMT_GBRP16 supportMichael Niedermayer2016-08-081-0/+12
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1: template functions to allow data types different from int16_tMichael Niedermayer2016-08-081-137/+5
| | | | | | | | | | | | | | This is required for >= 16bit RGB support I tried it without templates but its too much duplicated code Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1dec: Test extradata_size instead of extradata for better robustnessMichael Niedermayer2016-07-211-1/+1
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1dec: fix some unsupported pix_fmtJérôme Martinez2016-06-131-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When checking pix_fmt mapping, some bitstreams are mapped to an incorrect pix_fmt instead of being rejected (ENOSYS). Actually, such bitstreams are not supported (FFmpeg encoder does not produce such bitstream, such bitstream may come only from another encoder for the moment). - JPEG 2000 RCT 11/13/15/16 bit depths are mapped to a 8-bit FFmpeg pix_fmt (e.g. bgr0), which is not expected. - JPEG 2000 RCT 9/10/12/14 bit depths with alpha are mapped to a FFmpeg pix_fmt without alpha (e.g. AV_PIX_FMT_GBRP9 for 9-bit with alpha), which is not expected. The order for choosing the pix_fmt is changed to the one used by YCbCr selection (<=8 bit first). " && !f->transparency" is added to the other lines. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avutil: Rename FF_CEIL_COMPAT to AV_CEIL_COMPATDerek Buitenhuis2016-01-271-2/+2
| | | | | | | | | | | | | | | | | | | | Libav, for some reason, merged this as a public API function. This will aid in future merges. A define is left for backwards compat, just in case some person used it, since it is in a public header. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* | avcodec/ffv1dec: Support AV_PIX_FMT_YA8Michael Niedermayer2016-01-011-9/+18
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '4bb1070c154e49d35805fbcdac9c9e92f702ef96'Derek Buitenhuis2015-11-221-7/+9
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | * commit '4bb1070c154e49d35805fbcdac9c9e92f702ef96': ffv1: Explicitly name the coder type Conflicts: libavcodec/ffv1.h libavcodec/ffv1dec.c libavcodec/ffv1enc.c Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * ffv1: Explicitly name the coder typeVittorio Giovara2015-11-161-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FFv1 uses two types of coders, golomb and range with two different tables. This is exposed this in a rather convoluted way, for example mentioning to set coder type 1 while initializing the variable 'ac' to 2, because encoder does not use range coder with default table. Appropriate internal coder type values have been added and used in any check rather than using raw numbers. Initialization of avctx.coder_type in ffv1dec is removed because this field is encoder only. An unneeded validation check in the encoder is dropped too. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | avcodec/ffv1dec: Clear quant_table_count if its invalidMichael Niedermayer2015-11-141-0/+1
| | | | | | | | | | | | | | | | | | Fixes deallocation of corrupted pointer Fixes: 343dfbe142a38b521ed069dc4ea7c03b/signal_sigsegv_421427_4074_ffb11959610278cd40dbc153464aa254.avi No releases affected Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1dec: Print an error if the quant table count is invalidMichael Niedermayer2015-11-051-1/+3
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1dec: Free tables on init failureMichael Niedermayer2015-11-051-0/+1
| | | | | | | | | | | | | | | | Fixes memleak Fixes: 07ec1fc3c1cbf2d3edcd7d9b52ca156c/asan_heap-oob_13624c5_491_ecd4720a03e697ba750b235690656c8f.avi Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1dec: Check for 0 quant tablesMichael Niedermayer2015-11-051-1/+1
| | | | | | | | | | | | | | | | Fixes assertion failure Fixes: 07ec1fc3c1cbf2d3edcd7d9b52ca156c/asan_heap-oob_13624c5_491_ecd4720a03e697ba750b235690656c8f.avi Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1dec: update progress in case of broken pointer chainsMichael Niedermayer2015-10-161-0/+1
| | | | | | | | | | | | | | Fixes deadlock Fixes Ticket4932 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1dec: Clear slice coordinates if they are invalid or slice header ↵Michael Niedermayer2015-10-161-0/+1
| | | | | | | | | | | | | | | | decoding fails for other reasons Fixes Ticket4931 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec: use HAVE_THREADS header guards to silence -Wunused-functionGanesh Ajjanagadde2015-10-041-0/+4
| | | | | | | | | | | | | | | | | | | | 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>
* | avcodec/ffv1dec: Fix off by 1 error in quant_table_count checkMichael Niedermayer2015-09-261-1/+1
| | | | | | | | | | | | | | Fixes: invalid_read.nut Found-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1dec: Explicitly check read_quant_table() return valueMichael Niedermayer2015-09-261-1/+4
| | | | | | | | | | | | Forwards the error code, avoids potential integer overflow Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1dec: Fix >8bps error concealmentMichael Niedermayer2015-09-251-2/+4
| | | | | | | | | | | | | | Fixes: 03_cave_girls_h264_slc24_slicecrc1_fuzzed.avi Found-by: Dinah Handel <dinahrhandel@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/rangecoder: Check eMichael Niedermayer2015-09-251-1/+4
| | | | | | | | | | | | | | Fixes hang.nut Found-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1: seperate slice_count from max_slice_countMichael Niedermayer2015-09-241-3/+5
| | | | | | | | | | | | | | Fix segfault with too large slice_count Fixes Ticket4879 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Replace all remaining occurances of step/depth_minus1 and offset_plus1Hendrik Leppkes2015-09-081-1/+1
| |
* | avcodec/ffv1dec: Print CRCs at picture debug levelMichael Niedermayer2015-09-021-2/+8
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1dec: Check that there is enough space for the CRC in the global ↵Michael Niedermayer2015-09-021-1/+1
| | | | | | | | | | | | header Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | ffv1: Add missing ff_ prefixesTimothy Gu2015-08-221-8/+8
| |
* | Merge commit 'def97856de6021965db86c25a732d78689bd6bb0'Michael Niedermayer2015-07-271-2/+2
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * lavc: AV-prefix all codec capabilitiesVittorio Giovara2015-07-271-2/+2
| | | | | | | | | | | | Express bitfields more simply. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | avcodec/ffv1dec: Fix skip_alphaMichael Niedermayer2015-05-281-1/+2
| | | | | | | | | | | | Fixes Ticket4322 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/ffv1dec: Check chroma shift parametersMichael Niedermayer2015-05-041-0/+12
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/ffv1dec: More completely check micro_versionMichael Niedermayer2015-05-041-0/+2
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/ffv1dec: Check quant table symbols more completelyMichael Niedermayer2015-05-041-1/+1
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>