1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-09-05 07:48:07 +02:00
Commit Graph

73 Commits

Author SHA1 Message Date
Andreas Rheinhardt
1ea3650823 Replace all occurences of av_mallocz_array() by av_calloc()
They do the same.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-20 01:03:52 +02:00
Andreas Rheinhardt
a247ac640d avcodec: Constify AVCodecs
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>
2021-04-27 10:43:15 -03:00
Michael Niedermayer
da8c86dd8b avcodec/cfhd: Keep track of which subbands have been read
This avoids use of uninitialized data
also several checks are inside the band reading code
so it is important that it is run at least once

Fixes: out of array accesses
Fixes: 28209/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5684714694377472
Fixes: 32124/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5425980681355264
Fixes: 30519/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-4558757155700736

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-04-03 19:27:21 +02:00
Michael Niedermayer
3b88c88fa1 avcodec/cfhd: Require valid setup before Lowpass coefficients, BandHeader and BandSecondPass
Previously the code skipped all security checks when these where encountered but prior data was incorrect.
Also replace an always true condition by an assert

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-04-03 19:27:21 +02:00
Michael Niedermayer
20473a93d2 avcodec/cfhd: Check transform_type consistently
Fixes: out of array accesses
Fixes: 29754/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-6333598414274560
Fixes: 30519/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-6298424511168512
Fixes: 30739/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5011292836462592

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-04-03 19:27:21 +02:00
Michael Niedermayer
cd3ab3a09b avcodec/cfhd: Fix negative shift in cfhd_decode()
Fixes: left shift of negative value -1
Fixes: 30714/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-4867823371419648

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-14 23:29:51 +01:00
Michael Niedermayer
386faeda5f avcodec/cfhd: check peak.offset
Fixes: signed integer overflow: -2147483648 - 4 cannot be represented in type 'int'
Fixes: 26907/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5746202330267648

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-01-29 19:36:46 +01:00
Paul B Mahol
f975cf7cc0 avcodec/cfhd: only increase s->level if transform is supported 2021-01-17 13:40:15 +01:00
Paul B Mahol
676689cc7c avcodec/cfhd: properly handle midstream size changes for transform type 2 2020-12-25 13:28:39 +01:00
Paul B Mahol
aed8f40d45 avcodec/cfhd: check that lowpass_height is >= 3 when used in vertical filter
Also check for out of buffer access.
Also return early when encountering fatal error.
2020-09-23 23:04:36 +02:00
Michael Niedermayer
659658d08b avcodec/cfhd: Check transform type
Fixes: out of array access
Fixes: 24823/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-4855119863349248

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-30 16:18:37 +02:00
Michael Niedermayer
2359656da2 avcodec/cfhd: Replace a few literal numbers by named constants
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-30 16:18:37 +02:00
Andreas Rheinhardt
5c923ce668 avcodec/cfhd: Remove unused-but-set variable
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-28 00:43:28 +02:00
Paul B Mahol
389cc142fb avcodec/cfhd: add x86 SIMD
Overall speed changes for 1920x1080, yuv422p10le, 60fps from: 0.19x to 0.343x
2020-08-26 21:13:38 +02:00
Paul B Mahol
9f702fc8f4 avcodec: extend CFHD description 2020-08-14 10:52:28 +02:00
Paul B Mahol
4ad77086b9 avcodec/cfhd: improve SampleIndex tag output
This tag is used for jumping to different channels in bitstream.
2020-08-09 18:47:30 +02:00
Paul B Mahol
17d1454a5f avcodec/cfhd: log version tags too 2020-08-09 18:47:29 +02:00
Paul B Mahol
fc3546bece avcodec/cfhd: read prescale table tag
Currently unused. Remove prescale shift tag as it
is not part of this codec.
2020-08-09 18:47:29 +02:00
Paul B Mahol
3ff7171a85 avcodec/cfhd: use init_get_bits8() 2020-08-09 18:47:29 +02:00
Paul B Mahol
25d07e1394 avcodec/cfhd: reindent 2020-08-09 18:47:28 +02:00
Paul B Mahol
8c7ea0c344 avcodec/cfhd: check if band encoding is valid
Also simplify lossless check as value of 5 for band encoding
always specify lossless mode.
2020-08-09 18:47:28 +02:00
Paul B Mahol
1006a21512 avcodec/cfhd: add 3d transform support
Based on Gagandeep Singh patch.
2020-08-08 12:03:43 +02:00
Paul B Mahol
1c6a010e3b avcodec/cfhd: remove some unused or only write items 2020-08-08 12:03:43 +02:00
Paul B Mahol
6ce4338943 avcodec/cfhd: fix overflow in multiplication in LUT calculation 2020-08-04 08:22:51 +02:00
Paul B Mahol
acaed62ad1 avcodec/cfhd: correct 71 tag usage
It stores input format and never codebook.
2020-08-03 22:45:17 +02:00
Paul B Mahol
05e58ce4e2 avcodec/cfhd: use LUT for 9 and 18 codebook decompanding
Also fix codebook 9 decompanding, fixing artifact with codebook 9
samples. Reused Gagandeep Singh patch.
2020-08-03 22:22:07 +02:00
Paul B Mahol
533d6030ca avcodec/cfhd: set correct bits_per_raw_sample 2020-08-02 09:33:24 +02:00
Paul B Mahol
e2b455f933 avcodec/cfhd: add more tag names 2020-08-02 09:33:24 +02:00
Paul B Mahol
4e27817629 avcodec: add CFHD encoder 2020-08-02 09:33:24 +02:00
Paul B Mahol
131d2a3e1c avcodec/cfhd: improve decompanding quality with reference implementation 2020-08-02 09:31:54 +02:00
Paul B Mahol
f7e35c8163 avcodec/cfhd: fix non-aligned to 8 height decoding 2020-08-02 09:31:54 +02:00
Paul B Mahol
fabbb680d4 avcodec/cfhd: move if/else out of loop in inverse transform 2020-08-02 09:31:54 +02:00
Kieran Kunhya
ec33f7793e cfhd: Add tag names 2020-07-04 16:27:24 +01:00
Anton Khirnov
1f4cf92cfb pthread_frame: merge the functionality for normal decoder init and init_thread_copy
The current design, where
- proper init is called for the first per-thread context
- first thread's private data is copied into private data for all the
  other threads
- a "fixup" function is called for all the other threads to e.g.
  allocate dynamically allocated data
is very fragile and hard to follow, so it is abandoned. Instead, the
same init function is used to init each per-thread context. Where
necessary, AVCodecInternal.is_copy can be used to differentiate between
the first thread and the other ones (e.g. for decoding the extradata
just once).
2020-04-10 15:24:54 +02:00
Michael Niedermayer
9fac243744 avcodec/cfhd: Check that cropped size is smaller than full
Fixes: signed integer overflow: 57342 * 120830 cannot be represented in type 'int'
Fixes: 16426/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5758744817827840

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
2019-09-16 00:53:18 +02:00
Michael Niedermayer
58e084bd2c avcodec/cfhd: Check destination space for bayer before writing
Fixes: out of array write
Fixes: 16105/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5690817309573120
Fixes: 16119/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5099050675732480
Fixes: 16135/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5705501601431552

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-05 17:54:24 +02:00
Michael Niedermayer
fe2e1cfc19 avcodec/cfhd: Fix linesize type
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-08-05 17:54:24 +02:00
Paul B Mahol
630ea6b07f avcodec/cfhd: add bayer support 2019-07-29 15:35:16 +01:00
Paul B Mahol
2edb262759 avcodec/cfhd: add back alpha processing removed in 9cefb9e7ec
Fixes #7886.
2019-06-28 20:10:43 +02:00
Michael Niedermayer
77429b4217 avcodec/cfhd: Use the actual count instead of the expected in peak_table()
Fixes: out of array access (no testcase)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-08-20 02:32:41 +02:00
Michael Niedermayer
2c1613ac94 avcodec/cfhd: Move peak_table() and difference_coding() calls after the existing coefficient count check
Fixes: out of array access
Fixes: 9509/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5283250636324864
Fixes: 9572/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-4920757409808384
Fixes: 9596/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5114917580439552
Fixes: 9640/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-6247840698335232
Fixes: 9659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-6079554987753472

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-08-20 02:32:41 +02:00
Michael Niedermayer
4a657acaef avcodec/cfhd: Use bytestream2 for peaks
This fixes out of array accesses
No testcase known

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-07-18 13:59:25 +02:00
Michael Niedermayer
7334985ffa libavcodec/cfhd: Fix signed overflow in shift
Fixes: 8695/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-4906172426485760

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-07-15 19:42:25 +02:00
Gagandeep Singh
9cefb9e7ec lavc/cfhd: interlaced frame decoding added
ticket #5522 output of given samples significantly improved
2018-05-27 15:16:45 +01:00
Clément Bœsch
6876a63368 lavc/cfhd: use AV_CEIL_RSHIFT instead of deprecated FF_CEIL_RSHIFT 2018-05-08 12:47:38 +02:00
Gagandeep Singh
673604e0e3 lavc/cfhd: fix distortion of lowest 8 lines when height is not multiple of 16
Also update fate reference. Fixes ticket #6675.
2018-04-03 18:20:30 +02:00
Gagandeep Singh
c64c97b972 lavc/cfhd: add alpha decompanding in rgba12
Alpha decompanding curve added to post process the decoded alpha channel.
Fixes ticket #6265.
2018-03-22 19:27:22 +01:00
James Almer
d2917501c2 avcodec/cfhd: support cropped height tag
Ported from libav. Authored by one of the following:

Anton Khirnov <anton@khirnov.net>
Diego Biurrun <diego@biurrun.de>
Vittorio Giovara <vittorio.giovara@gmail.com>

Reviewed-by: kierank
Signed-off-by: James Almer <jamrial@gmail.com>
2017-10-18 11:01:17 -03:00
James Almer
6007f7d466 Merge commit '5f794aa1653aa04c1da7397e9ccacad947fadf5f'
* commit '5f794aa1653aa04c1da7397e9ccacad947fadf5f':
  Add Cineform HD Decoder

See 3485332bf9.

Some cosmetics are merged. The refactoring is not merged at the
request of Kieran Kunhya.

Merged-by: James Almer <jamrial@gmail.com>
2017-10-17 20:28:59 -03:00
Vodyannikov Aleksandr
47c9365724 avcodec/cfhd: Fix decoding regression due to height check
Fixes: Ticket6546

Regression since: 54aaadf648

Reviewed-by: Muhammad Faiz <mfcc64@gmail.com>
Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-07-23 14:58:29 +02:00