summaryrefslogtreecommitdiff
path: root/libavcodec/mjpegenc_common.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec/mjpegenc: take into account component count when writing the SOF ↵James Almer2022-11-261-1/+1
| | | | | | | | header size Fixes ticket #10069 Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/mjpegenc_common: Only pass what is used from ScanTableAndreas Rheinhardt2022-10-241-5/+5
| | | | | | | Namely ScanTable.permutated. Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mjpegenc_common: Don't flush unnecessarilyAndreas Rheinhardt2022-10-091-1/+0
| | | | | | | The PutBitContext has already been flushed a few lines above and nothing has been written to it in the meantime. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mjpegenc_common: Don't check luma/chroma matrices unnecessarilyAndreas Rheinhardt2022-10-091-8/+7
| | | | | | | | | These matrices are only used for MJPEG, not for LJPEG. So only check them for the former. This is in preparation for removing said matrices from LJPEG altogether (i.e. sending NULL matrices). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mjpegenc: support writing ICC profilesNiklas Haas2022-04-111-3/+65
| | | | | | | | | | | | | | | | This is mostly straightforward. The major complication is that, as a result of the 16-bit chunk size limitation, ICC profiles may need to be split up into multiple chunks. We also need to make sure to allocate enough extra space in the packet to fit the ICC profile, so modify both mpegvideo_enc.c and ljpegenc.c to take into account this extra overhead, failing cleanly if necessary. Also add a FATE transcode test to ensure that the ICC profile gets written (and read) correctly. Note that this ICC profile is smaller than 64 kB, so this doesn't test the APP2 chunk re-arranging code at all. Signed-off-by: Niklas Haas <git@haasn.dev>
* avcodec/mjpegenc: Fix files with slices > 1, but threads == 1Andreas Rheinhardt2022-04-011-4/+6
| | | | | | | | | | | | | | | | | In the aforementioned case mpegvideo_enc.c calls ff_mjpeg_encode_stuffing() at the end of every line which pads the output to byte-alignment and escapes it; yet it does not write the restart-markers (and also not the DRI marker when writing the header) and so the output files are broken. Fix this by writing these markers depending upon the number of slices and not the number of threads in use; this also makes the output of the encoder reproducible given a slice count and is therefore important if encoder tests that actually use -threads auto are added in the future. 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>
* avcodec/mjpegenc_common: Use AVCodecContext.codec_id directlyAndreas Rheinhardt2022-01-041-1/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mjpegenc_common: Don't call function unnecessarilyAndreas Rheinhardt2022-01-041-4/+3
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mjpegenc_common: Pass MJpegContext for writing picture headerAndreas Rheinhardt2022-01-041-19/+17
| | | | | | It is the structure that is actually used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mjpegenc: Deprecate unused prediction typeAndreas Rheinhardt2022-01-041-1/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Move MJPEG/AMV-only fields to MJpegContextAndreas Rheinhardt2022-01-041-2/+2
| | | | | | | This is possible now that MJpegContext is allocated jointly with MpegEncContext as part of the AVCodecContext's private data. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mjpegenc_common: Fix intendationAndreas Rheinhardt2022-01-041-11/+11
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mjpegenc_common: Move code for MJPEG/AMV to mjpegencAndreas Rheinhardt2022-01-041-12/+2
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mjpegenc: Avoid allocation of MJpegContextAndreas Rheinhardt2022-01-041-1/+1
| | | | | | This is possible by allocating it together with the MpegEncContext. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/jpegtables: Unavpriv MJPEG-tablesAndreas Rheinhardt2022-01-041-9/+9
| | | | | | | | | | | | | | | | There are seven MJPEG-tables, five small (1x12, 4x17) and two not small (2x162). These are all avpriv, despite this not being worthwhile due to the overhead of exporting a symbol: The total overhead for each symbol consists of two entries in .dynsym (24B each), one entry in the importing library's .rela.dyn (24B) and one in .got (8B) as well as 2x2B for symbol versions and 4B for symbol hashes in the exporting library; in addition to that, the name of the symbol is included in both exporting and importing libraries, using 2x210 bytes in this case. (The above numbers are for a x64 Elf/Linux/GNU system. Other platforms will give different numbers.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mjpegenc: Include all supported pix_fmts in mpegenc pix_fmtsAndreas Rheinhardt2021-04-101-0/+16
| | | | | | | | | | | | | | | Currently said list contains only the pixel formats that are always supported irrespective of the range and the value of strict_std_compliance. This makes the MJPEG encoder an outlier as all other codecs put all potentially supported pixel formats into said list and error out if the chosen pixel format is unsupported. This commit brings it therefore in line with the other encoders. The behaviour of fftools/ffmpeg_filter.c has been preserved. A more informed decision would be possible if colour range were available at this point, but it isn't. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Avoid intermediate bitcount for number of bytes in PutBitContextAndreas Rheinhardt2021-03-301-5/+2
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mjpegenc_common: Move stuff only used by mjpegenc.c to itAndreas Rheinhardt2021-02-231-194/+0
| | | | | | | | This allows to make ff_init_uni_ac_vlc static; ff_mjpeg_encode_picture_frame has also been made static, but it could always have been made static. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/jpegtables: Move ff_mjpeg_build_huffman_codes to mjpegenc_commonAndreas Rheinhardt2021-02-231-0/+21
| | | | | | | Since g2meet.c doesn't use it any more, only encoders use it and the place for their common code is mjpegenc_common.c. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* put_bits: make avpriv_put_string() lavc-localAnton Khirnov2020-10-281-3/+3
| | | | | It has not been used outside of libavcodec since 20f325f320c6e18ee88983870d2a1fee94257293
* lavc/mjpegenc: Fix not writing RST tag after final slice.Carl Eugen Hoyos2020-01-211-1/+1
| | | | Fixes ticket #8412.
* avcodec/mjpegenc: move ff_mjpeg_encode_picture_frame to mjpegenc_commonJames Almer2017-05-081-0/+48
| | | | Fixes compilation of ljpeg encoder if mjpeg and amv encoders are disabled
* mjpegenc_common: check for codec ID before using avctx->priv_dataRostislav Pehlivanov2017-04-081-3/+7
| | | | | | | When coding lossless jpeg the priv context will be pointing to LJpegEncContext rather than MpegEncContext, which the function expects. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* lavc/mjpegenc_common: Remove an unused variable.Carl Eugen Hoyos2017-02-101-1/+1
|
* avcodec/mjpegenc: Simplify by moving assert into ff_mjpeg_encode_huffman_close()Michael Niedermayer2017-02-101-16/+12
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/mjpegenc: Bypass the 2 pass encoding when optimal tables are not ↵Michael Niedermayer2017-02-101-5/+6
| | | | | | | | | | requested This limits the bugs, speedloss and extra memory allocation to the case when optimal tables are needed. Fixes regressions with slice multi-threading Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/mjpegenc: Remove non functional huffman reallocation and error handlingMichael Niedermayer2017-02-101-7/+0
| | | | | | | If this is wanted iam not against it but it must be designed to work with all cases like slice threads, and a single growing buffer does not work very well with slices. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* mjpegenc_common: add missing ff_ prefix to init_uni_ac_vlcRostislav Pehlivanov2017-02-091-3/+3
| | | | Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* Implement optimal huffman encoding for (M)JPEG.Jerry Jiang2017-02-081-11/+155
| | | | | | | > seems to break > make fate-vsynth1-mjpeg-444 Fixed.
* avcodec/mjpegenc_common: Store approximate aspect if exact cannot be storedMichael Niedermayer2016-03-191-2/+12
| | | | | | Fixes Ticket5244 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit '2862b63783b5556f7f3fb2d097629bc6879f833a'Derek Buitenhuis2016-02-031-2/+2
|\ | | | | | | | | | | | | * 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-211-2/+2
| | | | | | | | | | | | | | | | | | | | 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>
* | lavc/mjpegenc: Add an option to force outputting chroma matrix.Carl Eugen Hoyos2015-10-091-0/+3
| | | | | | | | RFC 2435 suggests that mjpeg over rtp uses both two tables.
* | avcodec/ljpegenc: Fix encoding RGBA LJPEGMichael Niedermayer2015-09-111-6/+22
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/mjpegenc_common: do not ignore the color_range fieldMichael Niedermayer2015-08-101-3/+4
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615'Michael Niedermayer2015-07-271-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-271-1/+1
| | | | | | | | | | | | Convert doxygen to multiline and express bitfields more simply. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | avcodec/mjpegenc_common: Use ff_mpv_reallocate_putbitbuffer()Michael Niedermayer2015-05-251-1/+11
| | | | | | | | | | | | | | Fixes assertion failure Fixes Ticket4396 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '85ca012ba680bdf942d95ab98c74f6a28f447588'Michael Niedermayer2015-05-131-1/+4
|\ \ | |/ | | | | | | | | | | | | | | | | | | * commit '85ca012ba680bdf942d95ab98c74f6a28f447588': mjpegenc: Fix JFIF header byte ordering Conflicts: libavcodec/mjpegenc_common.c See: b19313218c32fa9446d474cbddb11c0776868cd3 Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * mjpegenc: Fix JFIF header byte orderingShiina Hideaki2015-05-121-1/+4
| | | | | | | | | | | | | | | | The header had a wrong version description. Bug-Id: 808 Signed-off-by: Shiina Hideaki <shiina@yndrd.com> Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | Merge commit '4978850ca2cb1ec6908f5bc79cc592ca454d11e8'Michael Niedermayer2015-03-311-0/+1
|\ \ | |/ | | | | | | | | | | | | | | | | * commit '4978850ca2cb1ec6908f5bc79cc592ca454d11e8': build: Split JPEG-related tables off into a separate component Conflicts: configure Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * build: Split JPEG-related tables off into a separate componentDiego Biurrun2015-03-301-0/+1
| |
* | Merge commit 'e6e3dcba0c6f11bd7022e2d3b9bcb7b6a09d6c80'Michael Niedermayer2015-03-301-0/+1
|\ \ | |/ | | | | | | | | | | | | | | | | * commit 'e6e3dcba0c6f11bd7022e2d3b9bcb7b6a09d6c80': mjpeg: Move code only used in the encoder(s) to the appropriate header Conflicts: libavcodec/mjpegdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * mjpeg: Move code only used in the encoder(s) to the appropriate headerDiego Biurrun2015-03-301-0/+1
| |
* | avcodec/mjpegenc_common: Restore removed copyright statementsMichael Niedermayer2014-07-061-0/+2
| | | | | | | | | | | | | | | | | | These where removed by libav while spliting the file in adcb8392c9b185fd8a91a95fa256d15ab1432a30 See: de6d9b6404bfd1c589799142da5a95428f146edd See: 723106b279d9d78f5966f32bedfa33b88a702f69 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit 'e3fcb14347466095839c2a3c47ebecff02da891e'Michael Niedermayer2014-07-011-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'e3fcb14347466095839c2a3c47ebecff02da891e': dsputil: Split off IDCT bits into their own context Conflicts: configure libavcodec/aic.c libavcodec/arm/Makefile libavcodec/arm/dsputil_init_arm.c libavcodec/arm/dsputil_init_armv6.c libavcodec/asvdec.c libavcodec/dnxhdenc.c libavcodec/dsputil.c libavcodec/dvdec.c libavcodec/dxva2_mpeg2.c libavcodec/intrax8.c libavcodec/mdec.c libavcodec/mjpegdec.c libavcodec/mjpegenc_common.h libavcodec/mpegvideo.c libavcodec/ppc/dsputil_altivec.h libavcodec/ppc/dsputil_ppc.c libavcodec/ppc/idctdsp.c libavcodec/x86/Makefile libavcodec/x86/dsputil_init.c libavcodec/x86/dsputil_mmx.c libavcodec/x86/dsputil_x86.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * dsputil: Split off IDCT bits into their own contextDiego Biurrun2014-06-301-1/+1
| |
* | Merge commit 'adcb8392c9b185fd8a91a95fa256d15ab1432a30'Michael Niedermayer2014-07-011-35/+99
|/ | | | | | | | | | | * commit 'adcb8392c9b185fd8a91a95fa256d15ab1432a30': mjpeg: Split off bits shared by MJPEG and LJPEG encoders Conflicts: libavcodec/mjpegenc.c libavcodec/mjpegenc.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
* mjpeg: Split off bits shared by MJPEG and LJPEG encodersDiego Biurrun2014-06-301-0/+317
This obviates a dependency of the LJPEG encoder on mpegvideo.