summaryrefslogtreecommitdiff
path: root/libavcodec/pngenc.c
Commit message (Collapse)AuthorAge
* avcodec/pngenc: Deduplicate AVClassesAndreas Rheinhardt2021-07-08
| | | | | | | | The child_class_next API relied on different AVCodecs to use different AVClasses; yet this API has been replaced by child_class_iterate. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/encode: Always use intermediate buffer in ff_alloc_packet2()Andreas Rheinhardt2021-06-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | Up until now, ff_alloc_packet2() has a min_size parameter: It is supposed to be a lower bound on the final size of the packet to allocate. If it is not too far from the upper bound (namely, if it is at least half the upper bound), then ff_alloc_packet2() already allocates the final, already refcounted packet; if it is not, then the packet is not refcounted and its data only points to a buffer owned by the AVCodecContext (in this case, the packet will be made refcounted in encode_simple_internal() in libavcodec/encode.c). The goal of this was to avoid data copies and intermediate buffers if one has a precise lower bound. Yet those encoders for which precise lower bounds exist have recently been switched to ff_get_encode_buffer() (which automatically allocates final buffers), leaving only two encoders to actually set the min_size to something else than zero (namely aliaspixenc and hapenc). Both of these encoders use a very low lower bound that is not helpful in any nontrivial case. This commit therefore removes the min_size parameter as well as the codepath in ff_alloc_packet2() for the allocation of final buffers. Furthermore, the function has been renamed to ff_alloc_packet() and moved to encode.h alongside ff_get_encode_buffer(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pngenc: Avoid copying APNG data, allow user-supplied bufferAndreas Rheinhardt2021-05-23
| | | | | | | | | | The APNG encoder already uses internal buffers, so that the packet size is already known before allocating the packet; therefore one can avoid another (implicit) intermediate buffer by switching to ff_get_encode_buffer(), thereby also supporting user-supplied buffers. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pngenc: Remove always-true checkAndreas Rheinhardt2021-05-23
| | | | | Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pngenc: Mark encoders as init-threadsafeAndreas Rheinhardt2021-05-10
| | | | | | | Initializing zlib in the way we do here is threadsafe, see https://www.zlib.net/zlib_faq.html#faq21 Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Constify AVCodecsAndreas Rheinhardt2021-04-27
| | | | | | | | | | Given that the AVCodec.next pointer has now been removed, most of the AVCodecs are not modified at all any more and can therefore be made const (as this patch does); the only exceptions are the very few codecs for external libraries that have a init_static_data callback. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: Remove deprecated AVCodecContext.coded_frameAndreas Rheinhardt2021-04-27
| | | | | | | | | | Deprecated in 40cf1bbacc6220a0aa6bed5c331871d43f9ce370. (The currently disabled filter vf_mcdeint and vf_uspp were users of this field; they have not been changed, so that whoever wants to fix them can see the state of these filters when they were disabled.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: Remove private options from AVCodecContextAndreas Rheinhardt2021-04-27
| | | | | | | | | Several options that were too codec-specific were deprecated between 0e6c8532215790bbe560a9eea4f3cc82bb55cf92 and 0e9c4fe254073b209970df3e3cb84531bc388e99. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/pngenc: remove monowhite from apng formatsPaul B Mahol2021-02-14
| | | | | | | Monowhite pixel format is not supported, and it does not make sense to add support for it. Fixes #7989
* Stop hardcoding align=32 in av_frame_get_buffer() calls.Anton Khirnov2020-05-22
| | | | Use 0, which selects the alignment automatically.
* avcodec: deprecate Lossless and Intra Only encoder capabilitesJames Almer2020-05-21
| | | | | | | Both are codec properties and not encoder capabilities. The relevant AVCodecDescriptor.props flags exist for this purpose. Signed-off-by: James Almer <jamrial@gmail.com>
* lavc/pngenc: check malloc fail before using the pointerJun Zhao2019-05-12
| | | | | | Need to check malloc fail before using the pointer Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avcodec: stop using deprecated codec flagsJames Almer2017-03-25
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* huffyuvencdsp: move shared functions to a new lossless_videoencdsp contextJames Almer2017-01-12
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* huffyuvencdsp: move functions only used by huffyuv from lossless_videodspJames Almer2017-01-12
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* apng: use side data to pass extradata to muxerAndreas Cadhalpun2016-10-28
| | | | | | | | This fixes creating apng files, which is broken since commit 5ef19590802f000299e418143fc2301e3f43affe. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* avcodec/pngenc: check return value of av_frame_copy()Paul B Mahol2016-04-08
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/pngenc: restore image size before copying frameDmitriy2016-04-08
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* Merge commit '2862b63783b5556f7f3fb2d097629bc6879f833a'Derek Buitenhuis2016-02-03
|\ | | | | | | | | | | | | * commit '2862b63783b5556f7f3fb2d097629bc6879f833a': lavc: Move prediction_method to codec private options Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * lavc: Move prediction_method to codec private optionsVittorio Giovara2016-01-21
| | | | | | | | | | | | | | | | | | | | This options is only used by huffyuv, ffvhuv, jpegls, mjpeg, mpegvideoenc, png, utvideo. It is a very codec-specific options, so deprecate the global variant. Set proper limits to the maximum allowed values, and update utvideoenc tests to use the new option name. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
| * png: read and write stereo3d frame side data informationKirill Gavrilov2015-10-30
| | | | | | | | | | | | | | 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>
* | avcodec/pngenc: Fix mixed up linesizesMichael Niedermayer2016-01-15
| | | | | | | | | | | | | | | | Fixes out of array accesses Fixes: 0cf176e6d3ab9fe924f39738e513f547/asan_generic_4a54aa_3431_aaa28be1cb32e307a9890cad06f84fba.avi Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/pngenc: Replace memcpy by av_image_copy()Michael Niedermayer2016-01-15
| | | | | | | | | | | | | | | | Fixes out of array access Fixes: 0cf176e6d3ab9fe924f39738e513f547/asan_generic_4a54aa_3431_aaa28be1cb32e307a9890cad06f84fba.avi Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/png: read and write stereo3d frame side data informationKirill Gavrilov2015-10-28
| | | | | | | | | | | | | | 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>
* | avcodec/pngenc: Check that there is at least 1 frameMichael Niedermayer2015-10-07
| | | | | | | | | | | | | | Fixes null pointer dereference Fixes CID1322330 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/pngenc: Initialize fctl_chunk to 0Michael Niedermayer2015-10-07
| | | | | | | | | | | | | | The structure is copied around and that triggers warnings if it is uninitialized Fixes CID1322360 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | apng: Support inter-frame compressionDonny Yang2015-08-28
| | | | | | | | | | | | | | | | | | The current algorithm is just "try all the combinations, and pick the best". It's not very fast either, probably due to a lot of copying, but will do for an initial implementation. Signed-off-by: Donny Yang <work@kota.moe> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'Michael Niedermayer2015-07-27
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '059a934806d61f7af9ab3fd9f74994b838ea5eba': lavc: Consistently prefix input buffer defines Conflicts: doc/examples/decoding_encoding.c libavcodec/4xm.c libavcodec/aac_adtstoasc_bsf.c libavcodec/aacdec.c libavcodec/aacenc.c libavcodec/ac3dec.h libavcodec/asvenc.c libavcodec/avcodec.h libavcodec/avpacket.c libavcodec/dvdec.c libavcodec/ffv1enc.c libavcodec/g2meet.c libavcodec/gif.c libavcodec/h264.c libavcodec/h264_mp4toannexb_bsf.c libavcodec/huffyuvdec.c libavcodec/huffyuvenc.c libavcodec/jpeglsenc.c libavcodec/libxvid.c libavcodec/mdec.c libavcodec/motionpixels.c libavcodec/mpeg4videodec.c libavcodec/mpegvideo.c libavcodec/noise_bsf.c libavcodec/nuv.c libavcodec/nvenc.c libavcodec/options.c libavcodec/parser.c libavcodec/pngenc.c libavcodec/proresenc_kostya.c libavcodec/qsvdec.c libavcodec/svq1enc.c libavcodec/tiffenc.c libavcodec/truemotion2.c libavcodec/utils.c libavcodec/utvideoenc.c libavcodec/vc1dec.c libavcodec/wmalosslessdec.c libavformat/adxdec.c libavformat/aiffdec.c libavformat/apc.c libavformat/apetag.c libavformat/avidec.c libavformat/bink.c libavformat/cafdec.c libavformat/flvdec.c libavformat/id3v2.c libavformat/isom.c libavformat/matroskadec.c libavformat/mov.c libavformat/mpc.c libavformat/mpc8.c libavformat/mpegts.c libavformat/mvi.c libavformat/mxfdec.c libavformat/mxg.c libavformat/nutdec.c libavformat/oggdec.c libavformat/oggparsecelt.c libavformat/oggparseflac.c libavformat/oggparseopus.c libavformat/oggparsespeex.c libavformat/omadec.c libavformat/rawdec.c libavformat/riffdec.c libavformat/rl2.c libavformat/rmdec.c libavformat/rtpdec_latm.c libavformat/rtpdec_mpeg4.c libavformat/rtpdec_qdm2.c libavformat/rtpdec_svq3.c libavformat/sierravmd.c libavformat/smacker.c libavformat/smush.c libavformat/spdifenc.c libavformat/takdec.c libavformat/tta.c libavformat/utils.c libavformat/vqf.c libavformat/westwood_vqa.c libavformat/xmv.c libavformat/xwma.c libavformat/yop.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
| * lavc: Consistently prefix input buffer definesVittorio Giovara2015-07-27
| | | | | | | | 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>
* | Merge commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615'Michael Niedermayer2015-07-27
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615': lavc: AV-prefix all codec flags Conflicts: doc/examples/muxing.c ffmpeg.c ffmpeg_opt.c ffplay.c libavcodec/aacdec.c libavcodec/aacenc.c libavcodec/ac3dec.c libavcodec/ac3enc_float.c libavcodec/atrac1.c libavcodec/atrac3.c libavcodec/atrac3plusdec.c libavcodec/dcadec.c libavcodec/ffv1enc.c libavcodec/h264.c libavcodec/h264_loopfilter.c libavcodec/h264_mb.c libavcodec/imc.c libavcodec/libmp3lame.c libavcodec/libtheoraenc.c libavcodec/libtwolame.c libavcodec/libvpxenc.c libavcodec/libxavs.c libavcodec/libxvid.c libavcodec/mpeg12dec.c libavcodec/mpeg12enc.c libavcodec/mpegaudiodec_template.c libavcodec/mpegvideo.c libavcodec/mpegvideo_enc.c libavcodec/mpegvideo_motion.c libavcodec/nellymoserdec.c libavcodec/nellymoserenc.c libavcodec/nvenc.c libavcodec/on2avc.c libavcodec/options_table.h libavcodec/opus_celt.c libavcodec/pngenc.c libavcodec/ra288.c libavcodec/ratecontrol.c libavcodec/twinvq.c libavcodec/vc1_block.c libavcodec/vc1_loopfilter.c libavcodec/vc1_mc.c libavcodec/vc1dec.c libavcodec/vorbisdec.c libavcodec/vp3.c libavcodec/wma.c libavcodec/wmaprodec.c libavcodec/x86/hpeldsp_init.c libavcodec/x86/me_cmp_init.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
| * lavc: AV-prefix all codec flagsVittorio Giovara2015-07-27
| | | | | | | | | | | | Convert doxygen to multiline and express bitfields more simply. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | avcodec: Add a min size parameter to ff_alloc_packet2()Michael Niedermayer2015-07-27
| | | | | | | | | | | | | | | | This parameter can be used to inform the allocation code about how much downsizing might occur, and can be used to optimize how to allocate the packet Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '40cf1bbacc6220a0aa6bed5c331871d43f9ce370'Michael Niedermayer2015-07-21
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '40cf1bbacc6220a0aa6bed5c331871d43f9ce370': Deprecate avctx.coded_frame Conflicts: ffmpeg.c libavcodec/a64multienc.c libavcodec/asvenc.c libavcodec/cljrenc.c libavcodec/dpxenc.c libavcodec/gif.c libavcodec/mpegvideo_enc.c libavcodec/nvenc.c libavcodec/proresenc_kostya.c libavcodec/pthread_frame.c libavcodec/rawenc.c libavcodec/sunrastenc.c libavcodec/tiffenc.c libavcodec/version.h libavcodec/xbmenc.c libavcodec/xwdenc.c libavdevice/v4l2.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
| * Deprecate avctx.coded_frameVittorio Giovara2015-07-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The rationale is that coded_frame was only used to communicate key_frame, pict_type and quality to the caller, as well as a few other random fields, in a non predictable, let alone consistent way. There was agreement that there was no use case for coded_frame, as it is a full-sized AVFrame container used for just 2-3 int-sized properties, which shouldn't even belong into the AVCodecContext in the first place. The appropriate AVPacket flag can be used instead of key_frame, while quality is exported with the new AVPacketSideData quality factor. There is no replacement for the other fields as they were unreliable, mishandled or just not used at all. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | Merge commit 'd6604b29ef544793479d7fb4e05ef6622bb3e534'Michael Niedermayer2015-07-20
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'd6604b29ef544793479d7fb4e05ef6622bb3e534': Gather all coded_frame allocations and free functions to a single place Conflicts: libavcodec/a64multienc.c libavcodec/asvenc.c libavcodec/cljrenc.c libavcodec/dpxenc.c libavcodec/dvenc.c libavcodec/gif.c libavcodec/huffyuvenc.c libavcodec/jpeglsenc.c libavcodec/libopenjpegenc.c libavcodec/libtheoraenc.c libavcodec/libvpxenc.c libavcodec/mpegvideo_enc.c libavcodec/nvenc.c libavcodec/pngenc.c libavcodec/proresenc_kostya.c libavcodec/sunrastenc.c libavcodec/tiffenc.c libavcodec/utils.c libavcodec/utvideoenc.c libavcodec/v210enc.c libavcodec/v410enc.c libavcodec/xbmenc.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
| * Gather all coded_frame allocations and free functions to a single placeVittorio Giovara2015-07-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Allocating coded_frame is what most encoders do anyway, so it makes sense to always allocate and free it in a single place. Moreover a lot of encoders freed the frame with av_freep() instead of the correct API av_frame_free(). This bring uniformity to encoder behaviour and prevents applications from erroneusly accessing this field when not allocated. Additionally this helps isolating encoders that export information with coded_frame, and heavily simplifies its deprecation. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | avcodec/pngenc: don't return a value in a void functionJames Almer2015-04-02
| | | | | | | | | | | | | | Should fix compilation failures with strict compilers Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | png: Use libavutil's crc functions instead of zlib'sDonny Yang2015-04-02
| | | | | | | | | | Signed-off-by: Donny Yang <work@kota.moe> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | apng: Add a basic APNG encoderDonny Yang2015-04-02
| | | | | | | | | | Signed-off-by: Donny Yang <work@kota.moe> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/png: Clearly separate encoding header and framesDonny Yang2015-04-01
| | | | | | | | | | Signed-off-by: Donny Yang <work@kota.moe> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | png: Clear up the calculation of max packet sizeDonny Yang2015-03-31
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | png: Only init zlib onceDonny Yang2015-03-29
| | | | | | | | | | Signed-off-by: Donny Yang <work@kota.moe> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | png: Calculate pixel format information only onceDonny Yang2015-03-29
| | | | | | | | | | Signed-off-by: Donny Yang <work@kota.moe> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | png: Return slightly more meaningful error codesDonny Yang2015-03-29
| | | | | | | | | | Signed-off-by: Donny Yang <work@kota.moe> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | png: Minor whitespace change and added missing commentDonny Yang2015-03-28
| | | | | | | | | | Signed-off-by: Donny Yang <work@kota.moe> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | png: Use av_freep() instead of av_free()Donny Yang2015-03-28
| | | | | | | | | | Signed-off-by: Donny Yang <work@kota.moe> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avutil: Extract gamma determination from PNG encoder for future use. Adds ↵Kevin Wheatley2015-03-05
| | | | | | | | | | | | | | private avpriv_get_gamma_from_trc() function to libavutil. Signed-off-by: Kevin Wheatley <kevin.j.wheatley@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/pngenc: Remove outer () from macroMichael Niedermayer2015-03-04
| | | | | | | | | | | | | | | | | | The macro is implemented as a do{}while() enclosing this is () appears to be a GNU extension (6.1 Statements and Declarations in Expressions) the () is also unneeded and wrong as the macro returns no value Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/pngenc: replace round by lrint()Michael Niedermayer2015-03-02
| | | | | | | | | | | | | | Avoids passing double to AV_WB32() Suggested-by: "Ronald S. Bultje" <rsbultje@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>