summaryrefslogtreecommitdiff
path: root/libavcodec/rawdec.c
Commit message (Collapse)AuthorAge
* avutil/pixdesc: deprecate AV_PIX_FMT_FLAG_PSEUDOPALwm42018-04-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: do not use AVFrame accessorMuhammad Faiz2017-04-23
| | | | | Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* Merge commit '549d0bdca53af7a6e0c612ab4b03baecf3a5878f'James Almer2017-04-22
|\ | | | | | | | | | | | | | | | | | | * commit '549d0bdca53af7a6e0c612ab4b03baecf3a5878f': decode: be more explicit about storing the last packet properties Also copy pkt->size in extract_packet_props(), as it's needed for AVFrame.pkt_size Merged-by: James Almer <jamrial@gmail.com>
* | avcodec/rawdec: check for side data before checking its sizeJames Almer2016-11-04
| | | | | | | | | | | | | | Fixes valgrind warnings about usage of uninitialized values. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* | avcodec/rawdec: Check side data size before useMichael Niedermayer2016-10-31
| | | | | | | | | | | | Fixes out of array read Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/rawdec: Fix bits_per_coded_sample checksMichael Niedermayer2016-08-19
| | | | | | | | | | | | | | | | Fixes assertion failure Fixes: 9eb9cf5b8c26dd0fa7107ed0348dcc1f/signal_sigabrt_7ffff6ae7c37_8926_4609a5c3f071d555d2d557625f9687b1.swf Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc/raw: Support QT b64a ARGB64 rawvideo.Carl Eugen Hoyos2016-08-13
| | | | | | | | | | Decoder based on a patch by v0lt, v0lt rambler ru Fixes ticket #5657.
* | avcodec/rawdec: Fix palette handling with changing palettesMichael Niedermayer2016-08-08
| | | | | | | | | | | | | | | | Fixes out of array access Fixes: poc.swf Found-by: 连一汉 <lianyihan@360.cn> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc/rawdec: Align AV_PIX_FMT_RGB24 correctlyMats Peterson2016-02-22
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc/rawdec: Remove monowhite switching code for 1 bpp AVI without a paletteMats Peterson2016-02-21
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc/rawdec: Retrieve nut palette from packetsMats Peterson2016-02-16
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/rawdec: Print stride and packet size at debug levelMats Peterson2016-02-13
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/rawdec: Fix nut pal8 testMats Peterson2016-02-13
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/rawdec: Initialize default mono palette only for ↵Mats Peterson2016-02-13
| | | | | | | | | | | | bits_per_coded_sample == 1 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc/rawdec: Use 16-byte line alignment for B1W0 and B0W1 video in nutMats Peterson2016-02-05
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/rawdec: Switch to monowhite if there is no palette & bpp=1Michael Niedermayer2016-01-31
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc/rawdec: Use 16-byte line alignment for AV_PIX_FMT_MONOWHITEMats Peterson2016-01-25
| | | | | | | | | | | | | | | | The line alignment for 1 bpp raw AV_PIX_FMT_MONOWHITE video (currently used for AVI) was previously 4 bytes, which generated alignment warning messages, not only for odd-width files. The alignment is now 16 bytes. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/rawdec: Check height and packet sizeMichael Niedermayer2016-01-25
| | | | | | | | | | | | Avoids potential division by 0 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc/rawdec: Use 16-byte line alignment for 1, 2, 4 and 8 bppMats Peterson2016-01-25
| | | | | | | | | | | | | | | | This patch aligns the lines of 1 bpp depth for QuickTime, and 2, 4 and 8 bpp depths for AVI and QuickTime, on 16-byte boundaries. At the same time, the packet row stride is properly catered for. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/rawdec: initialize palette for monoMats Peterson2016-01-25
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc/rawdec: Use AV_PIX_FMT_PAL8 for 1-bit raw QuickTime videoMats Peterson2016-01-18
| | | | | | | | | | | | | | | | | | | | | | Match the use of AV_PIX_FMT_PAL8 for 1-bit QuickTime Animation in lavc/qtrle. To reiterate, 1-bit video is not necessary black & white in QuickTime, merely bi-level. The two colors can be any color. The palette, either included in the sample description, or the default Macintosh palette (black & white for 1-bit video) will be set in lavf/qtpalette. See the QuickTime File Format Specification for details. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | rawdec: only exempt BIT0 with need_copy from buffer sanity checkAndreas Cadhalpun2015-12-20
| | | | | | | | | | | | | | | | Otherwise the too small buffer is directly used in the frame, causing segmentation faults, when trying to use the frame. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* | avcodec: use AV_OPT_TYPE_BOOL in a bunch of placesClément Bœsch2015-12-04
| |
* | Merge commit 'ef3a3519c10620c4206738595bf03fc0bed71802'Hendrik Leppkes2015-10-22
|\| | | | | | | | | | | | | * commit 'ef3a3519c10620c4206738595bf03fc0bed71802': rawdec: Replace avpicture functions with imgutils Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * rawdec: Replace avpicture functions with imgutilsLuca Barbato2015-10-21
| | | | | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | Merge commit 'def97856de6021965db86c25a732d78689bd6bb0'Michael Niedermayer2015-07-27
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* | avcodec/rawdec: Check the return code of avpicture_get_size()Michael Niedermayer2014-11-26
| | | | | | | | | | | | | | Fixes out of array access Fixes: asan_heap-oob_22388d0_3435_cov_3297128910_small_roll5_FlashCine1.cine Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/rawdec: Support CODEC_CAP_PARAM_CHANGEMichael Niedermayer2014-09-02
| | | | | | | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | libavcodec/rawdec: remove old ff_find_pix_fmt() functionJames Almer2014-08-07
| | | | | | | | | | | | | | It's been dead code for more than a year Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit 'c67b449bebbe0b35c73b203683e77a0a649bc765'Michael Niedermayer2014-06-23
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'c67b449bebbe0b35c73b203683e77a0a649bc765': dsputil: Split bswap*_buf() off into a separate context Conflicts: configure libavcodec/4xm.c libavcodec/ac3dec.c libavcodec/ac3dec.h libavcodec/apedec.c libavcodec/eamad.c libavcodec/flacenc.c libavcodec/fraps.c libavcodec/huffyuv.c libavcodec/huffyuvdec.c libavcodec/motionpixels.c libavcodec/truemotion2.c libavcodec/x86/Makefile libavcodec/x86/dsputil_init.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
* | Warn if rawvideo and an unreadable pix_fmt are written.Carl Eugen Hoyos2014-04-11
| | | | | | | | | | | | Print an error if a combination of rawvideo and an unusual pix_fmt that will be impossible to decode are written to avi or mov. Fixes ticket #3545.
* | Cosmetics: Remove an outdated comment from lavc/rawdec.c.Carl Eugen Hoyos2014-04-10
| | | | | | | | The missing swscale feature was implemented in 2011.
* | Merge commit 'b6a09ef700786b4e1e871dfa0f5c386ea43bbd0a'Michael Niedermayer2014-04-09
|\| | | | | | | | | | | | | | | * commit 'b6a09ef700786b4e1e871dfa0f5c386ea43bbd0a': rawvideo: Support decoding YVYU422 FourCC See: ab7d6cb8f770c3b88a8139d1182fcc934062f891 Merged-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '4a0f6651434c6f213d830140f575b4ec7858519f'Michael Niedermayer2014-03-24
|\| | | | | | | | | | | | | | | | | | | | | | | * commit '4a0f6651434c6f213d830140f575b4ec7858519f': libavcodec: when decoding, copy replaygain side data to decoded frames Conflicts: libavcodec/internal.h libavcodec/rawdec.c libavcodec/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * libavcodec: when decoding, copy replaygain side data to decoded framesAnton Khirnov2014-03-24
| |
* | Move avpriv_find_pix_fmt() to utils.cMichael Niedermayer2014-03-23
| | | | | | | | | | | | Fixes build with --disable-everything Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/rawdec: decode 16-bit aligned and packed 'raw' pixel formats where ↵Peter Ross2014-03-16
| | | | | | | | | | | | | | | | | | | | | | bits_per_coded_sample < 16 The bit packing method is communicted via codec_tag: BIT[0] big-endian packing BIT[16] 16-bit little endian packing BIT[32] 32-bit little-endian packing Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Revert "Allow stream-copying grayscale mov files."Carl Eugen Hoyos2014-03-11
| | | | | | | | | | | | | | | | | | | | | | This reverts commit 691dec62011fe9993809fbc793126b40cac0c584. The commit did not fix ticket #3215, it was fixed one commit earlier. The revert may break other use-cases but they should be fixed differently, the offending commit introduced too many problems. Fixes ticket #3377. Fixes ticket #3378.
* | libavcodec/rawdec: avoid memcpy when performing 16-bit samples shiftPeter Ross2014-02-26
| | | | | | | | | | Signed-off-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/rawdec: for 16-bit pix fmts, shift pixels when bits_per_coded_sample ↵Peter Ross2014-02-23
| | | | | | | | | | | | | | < 16 Signed-off-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Allow stream-copying grayscale mov files.Carl Eugen Hoyos2013-12-24
| | | | | | | | | | | | | | This reverts 0de2157f / r12272. Fixes ticket #3215. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit 'da6506c607eda585ba4b15430cf3c9a2ce09c3a9'Michael Niedermayer2013-11-04
|\| | | | | | | | | | | | | | | | | | | | | | | * commit 'da6506c607eda585ba4b15430cf3c9a2ce09c3a9': lavc: move AVCodecContext.pkt to AVCodecInternal Conflicts: libavcodec/internal.h libavcodec/rawdec.c libavcodec/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavc: move AVCodecContext.pkt to AVCodecInternalAnton Khirnov2013-11-04
| | | | | | | | It's a private field, not meant to be accessed from outside lavc.
* | Merge commit 'b2bed9325dbd6be0da1d91ffed3f513c40274fd2'Michael Niedermayer2013-10-04
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * cosmetics: Group .name and .long_name together in codec/format declarationsDiego Biurrun2013-10-03
| |
* | avcodec/rawdec: Fix 2bpp and 4bpp rawvideo in movCarl Eugen Hoyos2013-07-04
| | | | | | | | | | | | | | | | Restores carefully the old behaviour (and does not break decoding avi samples). Fixes Ticket2536 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Rename "AVClass class" as "AVClass component_class".Carl Eugen Hoyos2013-06-30
| | | | | | | | The aix header math.h defines "extern int class()" for C.
* | rawdec: allocate a buffer in the appropriate size in the copy case.Hendrik Leppkes2013-06-16
| | | | | | | | | | | | | | Otherwise the created buffer can be smaller than buf_size, which results in buffer overreads if the original image has extra padding on every line. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2013-05-15
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: pixdesc: rename PIX_FMT_* flags to AV_PIX_FMT_FLAG_* Conflicts: doc/APIchanges libavcodec/avpicture.c libavcodec/ffv1dec.c libavcodec/ffv1enc.c libavcodec/imgconvert.c libavcodec/tiffenc.c libavfilter/vf_pixdesctest.c libavfilter/vf_scale.c libavutil/imgutils.c libavutil/pixdesc.c libavutil/version.h libswscale/swscale_internal.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * pixdesc: rename PIX_FMT_* flags to AV_PIX_FMT_FLAG_*Anton Khirnov2013-05-15
| |