summaryrefslogtreecommitdiffstats
path: root/libavcodec/ffv1enc_template.c
Commit message (Collapse)AuthorAgeFilesLines
* all: fix whitespace/new-line issuesTimo Rothenpieler2025-08-031-1/+0
|
* avcodec/ffv1enc: Use dummies to avoid UB pointer arithmeticAndreas Rheinhardt2025-07-031-1/+4
| | | | | | | | | Fixes the following FATE-tests when run under Clang-UBSan: ffmpeg-loopback-decoding, lavf-mxf_ffv1, vsynth{1,2,3,_lena}-ffv1-v{0,2}, vsynth1-ffv{1,2,3,_lena}, vsynth{1,2,3,_lena}-ffv1-v3-yuv{420p,422p10,444p16} Signed-off-by: Andreas Rheinhardt <[email protected]>
* avcodec/ffv1enc_template: Fix remaining space checkMichael Niedermayer2025-05-301-9/+15
| | | | | | | | Fixes: Assertion sc->slice_coding_mode == 0 failed at libavcodec/ffv1enc.c:1667 Fixes: 408838118/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-6493138204295168 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <[email protected]>
* avcodec/ffv1: Store slices*planes with the minimum bits needed after remapMichael Niedermayer2025-04-071-4/+8
| | | | | | | | | | This also means that if a plane*slice has only 1 color nothing is stored after the remap table This also corrects the RCT offset to the exact value after remap not a fixed 65536 Signed-off-by: Michael Niedermayer <[email protected]>
* avcodec/ffv1: Only allocate fltmap* and bitmap when neededMichael Niedermayer2025-04-041-1/+2
| | | | | | This reduces memory requirements Signed-off-by: Michael Niedermayer <[email protected]>
* avcodec/ffv1: Fix remap orderingMichael Niedermayer2025-03-241-6/+6
| | | | | Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <[email protected]>
* avcodec/ffv1enc_template: Be a bit more verbose on errorMichael Niedermayer2025-03-111-2/+2
| | | | Signed-off-by: Michael Niedermayer <[email protected]>
* avcodec/ffv1: Fix remap and float with golomb riceMichael Niedermayer2025-03-111-52/+34
| | | | | | Sponsored-by: Sovereign Tech Fund Reviewed-by: Lynne <[email protected]> Signed-off-by: Michael Niedermayer <[email protected]>
* avcodec/ffv1enc: Fix slice coding mode 1 with rgb framesMichael Niedermayer2025-03-111-2/+1
| | | | | Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <[email protected]>
* avcodec/ffv1: Use dual run coder for fltmapMichael Niedermayer2025-03-081-3/+14
| | | | | | | | | | | This improves compression by 0.1% overall and 44% for the changed table I tried several other things but so far this is the best compromise between complexity and compression This can also be extended to 32 and 64bit floats Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <[email protected]>
* avcodec/ffv1: Store remap flag per sliceMichael Niedermayer2025-03-081-2/+2
| | | | | | | | | This allows switching it on conditionally and also for non float, it may improve compression for RGB data that was paletted or other synthetic images Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <[email protected]>
* avcodec/ffv1: flip half of float16 and Compactify floatsMichael Niedermayer2025-03-081-0/+49
| | | | | | | | | | | | | | | | | | | | | | | float16 (and more so float32) have many odd values half the values are negative, many are larger than "1.0" and many values are very close to 0. Storing the 16bits as is, looses compression because of the mixture of dense and sparse regions and also many completely unused ones. This simply remaps the 65536 values so no unused values remain This improves compression by about 1.5% for the ACES_OT_VWG_SampleFrames testset (this testset contains all kind of funny values including many images with negative rgb values) The space needed for the map is insignificant compared to the compression gained This patch also flips half the float range as it can be done using the same table. Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <[email protected]>
* lavc/ffv1enc: stop using per-slice FFV1ContextAnton Khirnov2024-08-011-14/+15
| | | | | All remaining accesses to them are for fields that have the same value in the main encoder context.
* lavc/ffv1enc: store per-slice rc_stat(2?) in FFV1SliceContextAnton Khirnov2024-08-011-2/+2
| | | | | Instead of the per-slice FFV1Context, which will be removed in future commits.
* lavc/ffv1: move RangeCoder to per-slice contextAnton Khirnov2024-08-011-1/+1
|
* lavc/ffv1: move FFV1Context.plane to per-slice contextAnton Khirnov2024-08-011-1/+1
|
* lavc/ffv1: always use the main context values of acAnton Khirnov2024-08-011-5/+7
| | | | It cannot change between slices.
* lavc/ffv1: move FFV1Context.slice_{coding_mode,rct_.y_coef} to per-slice contextAnton Khirnov2024-08-011-5/+5
|
* lavc/ffv1: always use the main context values of plane_count/transparencyAnton Khirnov2024-08-011-1/+1
| | | | They cannot change between slices.
* lavc/ffv1: drop redundant PlaneContext.quant_tableAnton Khirnov2024-08-011-5/+8
| | | | It is a copy of FFV1Context.quant_tables[quant_table_index].
* lavc/ffv1enc: move bit writer to per-slice contextAnton Khirnov2024-08-011-7/+7
|
* lavc/ffv1: move run_index to the per-slice contextAnton Khirnov2024-08-011-8/+8
|
* lavc/ffv1: move sample_buffer to the per-slice contextAnton Khirnov2024-08-011-4/+5
|
* avcodec/ffv1: Move ffv1_template.c inclusion to dec/enc templatesAndreas Rheinhardt2022-10-201-0/+2
| | | | | | | | | | | | | | | | | | | Both the FFV1 decoder and encoder use a template of their own to generate code multiple times. They also use a common template, used by both decoder and encoder templates which is currently instantiated in ffv1.h (and therefore also in ffv1.c, which doesn't need it at all). All these templates have the prerequisite that two macros are defined, namely RENAME() and TYPE. The codec-specific templates call the functions generated via the common template via the RENAME() macro and therefore the macros used for the common template must coincide with the macros used for the codec-specific templates. But then it is better to not instantiate the common template in ffv1.h, but in the codec specific templates. Signed-off-by: Andreas Rheinhardt <[email protected]>
* avcodec: Remove cumbersome way of checking for amount of bytes leftAndreas Rheinhardt2021-03-301-1/+1
| | | | | | | | | | | | | Several encoders used code like the following to check for the amount of bytes left in a PutBitContext: pb->buf_end - pb->buf - (put_bits_count(pb) >> 3) Besides the fact that using the pointers directly might pose a maintainence burden in the future this also leads to suboptimal code: The above code reads all three pointers (buf, buf_ptr and buf_end), but touching buf is unnecessary and switching to put_bytes_left() automatically fixes this. Signed-off-by: Andreas Rheinhardt <[email protected]>
* avcodec/ffv1: Support for GBRAP10 and GBRAP12Jérôme Martinez2018-02-151-1/+1
| | | | Signed-off-by: Michael Niedermayer <[email protected]>
* avcodec/ffv1: Support for RGBA64 and GBRAP16Jérôme Martinez2018-02-061-4/+10
| | | | Signed-off-by: Michael Niedermayer <[email protected]>
* avcodec/ffv1enc: Add RGB48 supportMichael Niedermayer2016-08-161-0/+6
| | | | Signed-off-by: Michael Niedermayer <[email protected]>
* avcodec/ffv1: Fix rgb plane ordering in experimental planar RGBMichael Niedermayer2016-08-161-0/+4
| | | | Signed-off-by: Michael Niedermayer <[email protected]>
* avcodec/ffv1: template functions to allow data types different from int16_tMichael Niedermayer2016-08-081-0/+186
This is required for >= 16bit RGB support I tried it without templates but its too much duplicated code Signed-off-by: Michael Niedermayer <[email protected]>