summaryrefslogtreecommitdiff
path: root/libavcodec/smvjpegdec.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: remove unnecessary calls to ff_init_buffer_info()James Almer2018-02-14
| | | | | | | | And remove the function altogether while at it. It's a duplicate of another. Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/smvjpegdec: return the packet size instead of 0Michael Niedermayer2016-12-15
| | | | | | | | Most decoders return the amount of data used. This is more consistent Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* smvjpegdec: make sure cur_frame is not negativeAndreas Cadhalpun2016-11-12
| | | | | | | This fixes a heap-buffer-overflow detected by AddressSanitizer. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* avutil: Rename FF_CEIL_COMPAT to AV_CEIL_COMPATDerek Buitenhuis2016-01-27
| | | | | | | | | | 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/smvjpegdec: assert that the pixel format that has been set by our ↵Michael Niedermayer2015-06-13
| | | | | | | | | decoder is valid If we do check av_pix_fmt_desc_get() then we should fail and not continue with an invalid pix_fmt Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avcodec/smvjpegdec: check avcodec_decode_video2() return codeMichael Niedermayer2015-05-15
| | | | | | Fixes CID1271810 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavc/smvjpegdec: Avoid null dereference and return meaningful error codesHimangi Saraogi2015-04-01
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* Replace PixelFormats which sneaked in over time or where forgotten by ↵Michael Niedermayer2015-03-18
| | | | | | AVPixelFormats Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavc/smvjpegdec: fix mem leak in case of init failureLukasz Marek2014-11-24
| | | | Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
* avcodec/smvjpegdec: Dont ignore avcodec_close() return codeMichael Niedermayer2014-05-20
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avcodec: remove no longer needed ff_codec_close_recursive()Michael Niedermayer2014-05-20
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avcodec: replace uses of deprecated avcodec_set_dimensions()Michael Niedermayer2014-05-09
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* cosmetics: group remaining .name and .long_name.Clément Bœsch2013-10-04
| | | | See b2bed9325.
* replace some deprecated definesPaul B Mahol2013-07-06
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* smvjpeg: use refcounted frames to avoid mem leaksHendrik Leppkes2013-06-22
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* smvjpeg: remove redundant frame init codeHendrik Leppkes2013-06-21
| | | | | | | avctx->coded_frame is not used for decoders anymore, and av_frame_alloc does all the frame initialization required. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* smvjpegdec: No frame at all is an errorMichael Niedermayer2013-06-08
| | | | | | This fixes a infinite loop Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avcodec/smvjpegdec: copy palette tooMichael Niedermayer2013-06-08
| | | | | | | Fixes out of array access Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* Merge remote-tracking branch 'cehoyos/master'Michael Niedermayer2013-06-07
|\ | | | | | | | | | | | | * cehoyos/master: Do not offer smvjpeg lowres capabilities, the decoder does not support it. Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * Do not offer smvjpeg lowres capabilities, the decoder does not support it.Carl Eugen Hoyos2013-06-07
| | | | | | | | Reviewed-by: Ash Hughes
* | avcodec/smvjpegdec: check that frames_per_jpeg cleanly divides heightMichael Niedermayer2013-06-07
|/ | | | | | | | | Fixes out of array access If some valid files fail this check then please open a ticket and ping me and the smvjpegdec maintainer. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* smvjpegdec: only extract picture when a picture has been decoded.Michael Niedermayer2013-06-07
| | | | | | | Fixes null pointer dereference Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* libavcodec/smvjpegdec: pass flags / idct algo into jpeg avctxMichael Niedermayer2013-05-30
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* smvjpegdec: use av_pix_fmt_desc_get() avoid direct table accessMichael Niedermayer2013-05-22
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* Support playing SMV files.Ash Hughes2013-05-22
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>