summaryrefslogtreecommitdiff
path: root/libavcodec/j2kenc.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec/j2kenc: Add YA8 and YA16 supportMichael Niedermayer2023-04-141-1/+1
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/j2kenc: Add alpha supportMichael Niedermayer2023-04-021-10/+17
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/j2kenc: support threadsMichael Niedermayer2023-04-021-1/+2
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/j2kenc: More complete list of supported pixel formatsMichael Niedermayer2023-04-021-4/+9
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/j2kenc: Planar RGB supportMichael Niedermayer2023-04-021-3/+11
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/j2kenc: Replace RGB24 special case by generic testMichael Niedermayer2023-04-021-1/+2
| | | | | | This fixes RGB48 with libavcodec as decoder Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/j2kenc: Replace BGR48 / GRAY16 test by test for number of bitsMichael Niedermayer2023-04-021-1/+1
| | | | | | | BGR48 is not supported and this was probably meant to be RGB48 so this fixes RGB48 a bit Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/j2kenc: simplify pixel format setupMichael Niedermayer2023-04-021-10/+4
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/j2kenc: Add AV_PIX_FMT_YUV440PMichael Niedermayer2023-04-021-1/+1
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/j2kenc: Fix funky bpno errors on decodingMichael Niedermayer2023-04-021-2/+1
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/j2kenc: remove misleading pred valueMichael Niedermayer2023-04-021-1/+1
| | | | | | This field is only checked for being 0 or not and not zero means 5/3 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/j2kenc: fix 5/3 DWT identiferMichael Niedermayer2023-04-021-1/+1
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc: support AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE in all no-delay encodersAnton Khirnov2023-01-291-1/+1
| | | | Including fake-delay encoders marked with FF_CODEC_CAP_EOF_FLUSH.
* avcodec/codec_internal: Add macro to set AVCodec.long_nameAndreas Rheinhardt2022-09-031-1/+1
| | | | | | | | It reduces typing: Before this patch, there were 105 codecs whose long_name-definition exceeded the 80 char line length limit. Now there are only nine of them. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Make ff_alloc_packet() based encoders accept user buffersAndreas Rheinhardt2022-08-271-0/+1
| | | | | | | | | | | | | | | | | | Up until now, these encoders received non-refcounted packets (whose data was owned by the corresponding AVCodecContext) from ff_alloc_packet(); these packets were made refcounted lateron by av_packet_make_refcounted() generically. This commit makes these encoders accept user-supplied buffers by replacing av_packet_make_refcounted() with an equivalent function that is based upon get_encode_buffer(). (I am pretty certain that one can also set the flag for mpegvideo- based encoders, but I want to double-check this later. What is certain is that it reallocates the buffer owned by the AVCodecContext which should maybe be moved to encode.c, so that proresenc_kostya.c and ttaenc.c can make use of it, too.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Constify frame->data pointers for encoders where possibleAndreas Rheinhardt2022-08-051-6/+6
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Make init-threadsafety the defaultAndreas Rheinhardt2022-07-181-1/+1
| | | | | | | | | | | and remove FF_CODEC_CAP_INIT_THREADSAFE All our native codecs are already init-threadsafe (only wrappers for external libraries and hwaccels are typically not marked as init-threadsafe yet), so it is only natural for this to also be the default state. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/j2kenc: Remove unused-but-set variableAndreas Rheinhardt2022-07-031-2/+0
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Use union for FFCodec decode/encode callbacksAndreas Rheinhardt2022-04-051-1/+1
| | | | | | | | | | | This is possible, because every given FFCodec has to implement exactly one of these. Doing so decreases sizeof(FFCodec) and therefore decreases the size of the binary. Notice that in case of position-independent code the decrease is in .data.rel.ro, so that this translates to decreased memory consumption. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Add FFCodec, hide internal part of AVCodecAndreas Rheinhardt2022-03-211-7/+7
| | | | | | | | | | | | | | | | Up until now, codec.h contains both public and private parts of AVCodec. This exposes the internals of AVCodec to users and leads them into the temptation of actually using them and forces us to forward-declare structures and types that users can't use at all. This commit changes this by adding a new structure FFCodec to codec_internal.h that extends AVCodec, i.e. contains the public AVCodec as first member; the private fields of AVCodec are moved to this structure, leaving codec.h clean. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Move FF_CODEC_CAP_* to a new header codec_internal.hAndreas Rheinhardt2022-03-211-1/+1
| | | | | | | | | | Also move FF_CODEC_TAGS_END as well as struct AVCodecDefault. This reduces the amount of files that have to include internal.h (which comes with quite a lot of indirect inclusions), as e.g. most encoders don't need it. It is furthemore in preparation for moving the private part of AVCodec out of the public codec.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* libavcodec: Split version.hMartin Storsjö2022-03-161-0/+1
| | | | | | | | | | | | | | This avoids including version.h in all source files, avoiding unnecessary rebuilds when the version number is bumped. Only version_major.h is included by the main header, which defines availability of e.g. FF_API_* macros, and which is bumped much less often. This isn't done for libavutil/version.h, because that header needs to be included essentially everywhere due to LIBAVUTIL_VERSION_INT being used wherever an AVClass is constructed. Signed-off-by: Martin Storsjö <martin@martin.st>
* all: Remove unused-but-set variablesAndreas Rheinhardt2021-12-031-2/+0
| | | | | | Newer versions of Clang detect this and emit warnings for it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/encoders: Remove redundant setting of AV_PKT_FLAG_KEYAndreas Rheinhardt2021-09-281-1/+0
| | | | | | | It is now set generically for all those encoders whose corresponding AVCodecDescriptor has the AV_CODEC_PROP_INTRA_ONLY. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/j2kenc: Fix AV_OPT_TYPE_CONST offsetsAndreas Rheinhardt2021-09-261-5/+5
| | | | | | They are supposed to be zero. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Replace all occurences of av_mallocz_array() by av_calloc()Andreas Rheinhardt2021-09-201-2/+2
| | | | | | | They do the same. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/j2kenc: Check for av_strtok() failureMichael Niedermayer2021-07-031-1/+1
| | | | | | Fixes: CID1466601 Dereference null return value Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/encode: Always use intermediate buffer in ff_alloc_packet2()Andreas Rheinhardt2021-06-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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/j2kenc: Make encoder init-threadsafeAndreas Rheinhardt2021-05-121-3/+5
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mqc: Hardcode tables to save spaceAndreas Rheinhardt2021-05-121-1/+0
| | | | | | | | | | | | | | | | | | mqc currently initializes three arrays at runtime; each of them has 2 * 47 elements, one is uint16_t, two are uint8_t, so that their combined size is 8 * 47. The source data for these initializations is contained in an array of 47 elements of size six. Said array is only used in order to initialize the other arrays, so the savings are just 2 * 47B. Yet this is dwarfed by the size of the code for performing the initializations: It is 109B (GCC 10.2, x64, -O3 albeit in an av_cold function); this does not even include the size of the code in the callers. So just hardcode these tables. This also fixes a data race, because the encoder always initialized these tables during init, although they might already be used at the same time by already running encoder/decoder instances. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Constify AVCodecsAndreas Rheinhardt2021-04-271-1/+1
| | | | | | | | | | 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 private options from AVCodecContextAndreas Rheinhardt2021-04-271-7/+0
| | | | | | | | | 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/j2kenc: Fix leaks on init failureAndreas Rheinhardt2020-09-191-5/+10
| | | | | | | | | | The JPEG2000 encoder did not clean up after itself on error. This commit fixes this by modifying the cleanup function to be able to handle only partially allocated structures and by setting the FF_CODEC_CAP_INIT_CLEANUP flag. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* libavcodec/jpeg2000: fix tag tree resetGautam Ramakrishnan2020-08-301-2/+2
| | | | | | | | | | The implementation of the tag tree did not set the correct reset value for the encoder. This lead to inefficent tag tree being encoded. This patch fixes the implementation of the ff_tag_tree_zero() function. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavcodec/j2kenc: Support for multiple layersGautam Ramakrishnan2020-08-301-69/+403
| | | | | | | | | | | This patch allows setting a compression ratio and to set multiple layers. The user has to input a compression ratio for each layer. The per layer compression ration can be set as follows: -layer_rates "r1,r2,...rn" for to create 'n' layers. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavcodec/j2kenc: Fix tag tree codingGautam Ramakrishnan2020-08-301-16/+25
| | | | | | | | | | The implementation of tag tree encoding was incorrect. However, this error was not visible as the current j2k encoder encodes only 1 layer. This patch fixes tag tree coding for JPEG2000 such tag tree coding would work for multi layer encoding. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavcodec/j2kenc: Support for all Progression ordersGautam Ramakrishnan2020-08-091-1/+222
| | | | | | | | | This patch allows for selecting the progression order in the j2k encoder. However, all components and resolution levels will use the same progression order and will not feature the use of progression order change markers. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavcodec/j2kenc: Allow Encoder to use SOP and EPH markersGautam Ramakrishnan2020-08-061-6/+22
| | | | | | | | This patch allows the encoder to use SOP and EPH markers. This would be useful as these markers provide better error detection mechanisms. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavcodec/j2kenc: Encoding up to 16 bitsGautam Ramakrishnan2020-07-301-42/+57
| | | | | | | This patch allows the JPEG2000 encoder to encode images to up to 16 bits. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/j2kenc: Fix undefined shifts of negative numbersAndreas Rheinhardt2020-01-211-5/+5
| | | | | | | | | | | Also add parentheses to some lines to make the operator precedence clearer. This affected the FATE-tests vsynth*-jpeg2000 and vsynth*-jpeg2000-97 (where * ranges over { 1, 2, 3, _lena }) as well as ticket #7983. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/j2kenc: Support AV_PIX_FMT_PAL8.Carl Eugen Hoyos2018-05-251-4/+36
|
* avcodec/jpeg2000: Only allocate Jpeg2000Pass for the encoderMichael Niedermayer2017-12-011-1/+3
| | | | | | | | | Reduces memory needed. Fixes: OOM Fixes: 4427/clusterfuzz-testcase-minimized-5106919271301120 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/j2kenc: Fix out of array access in encode_cblk()Michael Niedermayer2017-12-011-1/+2
| | | | | | | Fixes: 4427/clusterfuzz-testcase-minimized-5106919271301120 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/j2kenc: Only allocate cblk.data onceMichael Niedermayer2017-11-241-1/+2
| | | | | | | Fixes: memleak Found-by: <jamrial> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/jpeg2000: Dynamically allocate codeblock dataMichael Niedermayer2017-11-221-2/+6
| | | | | | | | | | | Fixes: OOM Fixes: 3541/clusterfuzz-testcase-minimized-6469958596820992 Adds support for decoding codeblock data larger than 8kb Reduces decoder memory consumption Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec: remove remaining uses of avcodec_get_chroma_sub_sampleMartin Vignali2017-11-061-2/+5
| | | | | | Replace them with av_pix_fmt_get_chroma_sub_sample. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/j2kenc: Add attribution to OpenJPEG project:Aaron Boxer2016-04-011-0/+38
| | | | | | http://ghostscript.com/~tor/gs-browse/gs/openjpeg/libopenjpeg/t1.c Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit '2862b63783b5556f7f3fb2d097629bc6879f833a'Derek Buitenhuis2016-02-031-1/+12
| | | | | | | * commit '2862b63783b5556f7f3fb2d097629bc6879f833a': lavc: Move prediction_method to codec private options Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* lavc/j2kenc: Remove experimental flag.Carl Eugen Hoyos2015-09-041-1/+0
| | | | The encoder produces valid and - if requested - lossless files.
* Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'Michael Niedermayer2015-07-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>