1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-07-26 14:14:54 +02:00
Commit Graph

379 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
Andreas Rheinhardt
2a623bacc8 avcodec/svq3: Free array of frames in a loop
Avoids code duplication

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-26 21:15:33 +02:00
Andreas Rheinhardt
ef02cf8290 avcodec/svq3: Remove unused function parameter
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-26 21:15:33 +02:00
Andreas Rheinhardt
bcf707639e avcodec/svq3: Don't copy watermarked frame data twice
The SVQ3 decoder modifies the input bitstream at two places.
One of them is only reached when the file is watermarked.
Therefore commit 2264c11081
made a copy of all the frame data in this case.

But there is a second possibility for modifying the frame and
therefore Libav commit 1098f5c049
made the decoder always copy the data. This of course makes
the additional copy for watermarked frames redundant, but it hasn't
been removed. This commit does so.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-23 13:51:18 +01:00
Andreas Rheinhardt
3ab1a890e8 avcodec/svq3: Use av_fast_padded_malloc() instead of av_fast_malloc()
It takes care of zeroing padding (which has been forgotten here).
Also rename the size variable to indicate that this is not the size
of the current slice.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-23 13:51:18 +01:00
Anton Khirnov
e15371061d lavu/mem: move the DECLARE_ALIGNED macro family to mem_internal on next+1 bump
They are not properly namespaced and not intended for public use.
2021-01-01 14:14:57 +01:00
Andreas Rheinhardt
ef6c52f3c5 avcodec/svq3: Avoid overhead of AVBuffer API
Up until now, the SVQ3 decoder allocated several refcounted buffers,
despite no sharing/refcounting happening at all: Their refcount never
exceeds one and they are treated like ordinary buffers (with the
exception that the pointer used to access them is in the middle of the
allocated buffer, but this does not warrant using the AVBuffer API at
all). Given that using the AVBuffer API incurs overhead, it is no longer
used at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-17 00:09:08 +02:00
Andreas Rheinhardt
30620956ff avcodec/svq3: Remove unused buffer
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-17 00:09:08 +02:00
Andreas Rheinhardt
64a64d47c0 avcodec/svq3: Fix memleaks upon allocation error
Commit b2361cfb94738298a6c4037cc348fe5015efb841e made all of the
error paths in svq3_decode_init() call svq3_decode_end(); yet several
new error paths that were added later (in merges from Libav) returned
directly without cleaning up properly. This commit fixes the resulting
potential memleaks by setting the FF_CODEC_CAP_INIT_CLEANUP flag. This
also allows to simplify freeing by returning directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-17 00:09:08 +02:00
Andreas Rheinhardt
96061c5a4f avcodec/svq3: Fix segfault on allocation error, avoid allocations
The very first thing the SVQ3 decoder currently does is allocating several
SVQ3Frames, a structure which contains members that need to be freed on
their own. If one of these allocations fails, the decoder calls its own
close function to not leak the already allocated SVQ3Frames. Yet said
function presumes that the SVQ3Frames have been successfully allocated
as there is no check before freeing the members that need to be freed.

This commit fixes this by making these frames part of the SVQ3Context,
thereby avoiding the allocations altogether. Notice that the pointers
to the frames have been retained in order to allow to just swap them as
the code already does.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-17 00:09:08 +02:00
Michael Niedermayer
b4a4aadfaf libavcodec/svq: Remove ff_svq1_packet_checksum()
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-02-19 22:37:30 +01:00
Michael Niedermayer
7b114d7687 avcodec/svq3: Use ff_set_dimension()
Fixes: OOM
Fixes: 15410/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SVQ3_fuzzer-5659464805384192

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-07-08 09:38:03 +02:00
Nikolas Bowe
5aeb3b0080 lavc/svq3: Fix regression decoding some files.
Fixes some SVQ3 encoded files which fail to decode correctly after 6d6faa2a2d.
These files exhibit lots of artifacts and logs show "Media key encryption is not implemented".
However they decode without artifacts before 6d6faa2a2d.
The attatched patch allows these files to successfully decode, but also reject media key files.

Tested on the files in #6094 and http://samples.mplayerhq.hu/V-codecs/SVQ3/Vertical400kbit.sorenson3.mov

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-08-03 02:10:14 +02:00
Carl Eugen Hoyos
55bdee7b07 lavc/svq3: Do not write into memory defined as const.
Fixes a warning on ppc:
libavcodec/svq3.c:1055:21: warning: passing argument 1 of ‘av_write_bswap32’ discards 'const' qualifier from pointer target type
2018-01-21 22:35:48 +01:00
James Almer
cb222d7322 Merge commit 'b2788fe9347c02b1355574f3d28d60bfe1250ea7'
* commit 'b2788fe9347c02b1355574f3d28d60bfe1250ea7':
  svq3: fix the slice size check

Merged-by: James Almer <jamrial@gmail.com>
2017-10-03 20:28:51 -03:00
Michael Niedermayer
2c933c5168 avcodec/svq3: Fix overflow in svq3_add_idct_c()
Fixes: runtime error: signed integer overflow: 2147392585 + 524288 cannot be represented in type 'int'
Fixes: 3348/clusterfuzz-testcase-minimized-4809500517203968

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-09-22 12:19:07 +02:00
Michael Niedermayer
a6eb006ad4 avcodec/svq3: Fix runtime error: left shift of negative value -6
Fixes: 1604/clusterfuzz-testcase-minimized-5312060206350336

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-16 02:23:18 +02:00
Michael Niedermayer
86b1b0d33d avcodec/svq3: Fix runtime error: signed integer overflow: 169 * 12717677 cannot be represented in type 'int'
Fixes: 1556/clusterfuzz-testcase-minimized-5027865978470400

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-13 23:17:18 +02:00
Michael Niedermayer
ae6fd1790f avcodec/svq3: Fix multiple runtime error: signed integer overflow: -237341 * 24552 cannot be represented in type 'int'
Fixes: 1429/clusterfuzz-testcase-minimized-5959951610544128

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-10 01:27:15 +02:00
Michael Niedermayer
669419939c avcodec/svq3: Fix multiple runtime error: signed integer overflow: 44161 * 61694 cannot be represented in type 'int'
Fixes: 1382/clusterfuzz-testcase-minimized-6013445293998080

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-07 04:11:21 +02:00
Michael Niedermayer
48b3117844 avcodec/svq3: Reject dx/dy beyond 16bit
The code does use 16bit sized arrays later so larger deltas would not work

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-03 11:57:34 +02:00
Michael Niedermayer
382b4fc9b5 avcodec/svq3: Increase offsets to prevent integer overflows
Fixes: 1280/clusterfuzz-testcase-minimized-6102353767825408

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-03 11:57:34 +02:00
Carl Eugen Hoyos
1e298e7724 lavc/svq3: Remove an unused function. 2017-02-27 13:10:41 +01:00
Anton Khirnov
b2788fe934 svq3: fix the slice size check
Currently it incorrectly compares bits with bytes.

Also, move the check right before where it's relevant, so that the
correct number of remaining bits is used.

CC: libav-stable@libav.org
2017-02-25 09:57:43 +01:00
Alexandra Hájková
c29da01ac9 svq3: Convert to the new bitstream reader 2017-02-02 17:06:17 +01:00
Diego Biurrun
d4c2103bd3 golomb: Convert to the new bitstream reader 2017-01-31 17:46:19 +01:00
Carl Eugen Hoyos
6d6faa2a2d lavc/svq3: Fail for media key encryption.
Tested-by: ami_stuff

Fixes a part of ticket #6094.
2017-01-24 23:40:13 +01:00
Carl Eugen Hoyos
a8cb567e55 lavc: Remove CR/LF from avpriv_request_sample() calls. 2016-12-03 15:40:26 +01:00
Diego Biurrun
13fcdfb976 svq3: Drop unused function dctcoef_get()
libavcodec/svq3.c:627:29: warning: unused function 'dctcoef_get' [-Wunused-function]
2016-11-03 15:52:12 +01:00
Michael Niedermayer
2d3099ad8e avcodec/svq3: Reintroduce slice_type
Fixes out of array read
Fixes: 1642cd3962249d6aaf0eec2836023fb6/signal_sigsegv_2557a72_2995_04efaf2ff57a052f609a3b4a2ea4e622.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-08 22:16:35 +02:00
Michael Niedermayer
2624695484 avcodec/svq3: fix slice size check
Fixes out of array read
Fixes: 09f46aa2175cade93e3e3932646a56a9/asan_heap-oob_4a5385_2995_498f6abfdc0248288cefe5f4b7ad316c.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-20 22:11:50 +02:00
James Almer
be63ef3c4e avcodec/vdpau: clean up vdpau_internal.h
Also don't include it on files that don't need it.

This reduces differences with libav

Tested-by: Timothy Gu <timothygu99@gmail.com>
Reveiwed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-08-04 16:40:51 -03:00
Clément Bœsch
a170365ae9 Merge commit '4e2f6212483ae1b2a4043cddf0a1cb001b476abc'
* commit '4e2f6212483ae1b2a4043cddf0a1cb001b476abc':
  svq3: stop using H264Picture

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-29 11:20:55 +02:00
Clément Bœsch
15b26e88cb Merge commit '9df889a5f116c1ee78c2f239e0ba599c492431aa'
* commit '9df889a5f116c1ee78c2f239e0ba599c492431aa':
  h264: rename h264.[ch] to h264dec.[ch]

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-29 11:01:36 +02:00
Hendrik Leppkes
b20fe650ef Merge commit '4024b566d664a4b161d677554be52f32e7ad4236'
* commit '4024b566d664a4b161d677554be52f32e7ad4236':
  golomb: Give svq3_get_se_golomb()/svq3_get_ue_golomb() better names

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-06-26 15:12:48 +02:00
Clément Bœsch
8ef57a0d61 Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'
* commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb':
  cosmetics: Fix spelling mistakes

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 21:55:34 +02:00
Anton Khirnov
4e2f621248 svq3: stop using H264Picture
The SVQ3 decoder has been decoupled from the H.264 decoder, so it can
now use its own data type.
2016-06-21 11:13:08 +02:00
Anton Khirnov
9df889a5f1 h264: rename h264.[ch] to h264dec.[ch]
This is more consistent with the naming of other decoders.
2016-06-21 11:11:26 +02:00
Diego Biurrun
4024b566d6 golomb: Give svq3_get_se_golomb()/svq3_get_ue_golomb() better names 2016-05-25 16:37:43 +02:00
Vittorio Giovara
41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +02:00
Derek Buitenhuis
43b7e5aa32 Merge commit 'a4d126dc59c39bb03e5e444432d1b27af26a45b4'
* commit 'a4d126dc59c39bb03e5e444432d1b27af26a45b4':
  svq3: eliminate remaining H264Context usage.

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-03 10:52:14 +01:00
Derek Buitenhuis
2a018be10f Merge commit '7bbdae81e895a49125dba58bad01b98389966c39'
* commit '7bbdae81e895a49125dba58bad01b98389966c39':
  svq3: move block_offset to SVQ3Context

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-03 10:27:55 +01:00
Derek Buitenhuis
f32a23c849 Merge commit '1848a154a49d18c1f31f54ee75c7445dc49a7ecc'
* commit '1848a154a49d18c1f31f54ee75c7445dc49a7ecc':
  svq3: stop using H264Context.gb

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-03 10:27:24 +01:00
Derek Buitenhuis
8bba752ae9 Merge commit 'ea6ab02a174bcc11f3eaa1b840c9a4c895968690'
* commit 'ea6ab02a174bcc11f3eaa1b840c9a4c895968690':
  svq3: move the frame num variables to the SVQ3Context

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-03 10:24:33 +01:00
Derek Buitenhuis
014fb816d1 Merge commit '21b746932241246be846a133abb3c5f91b1cab85'
* commit '21b746932241246be846a133abb3c5f91b1cab85':
  svq3: eliminate H264Context.cur_pic usage

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-03 10:24:08 +01:00
Derek Buitenhuis
2d3cc682c4 Merge commit '939b388383db8d0db5b2ff483e3a197c27b79791'
* commit '939b388383db8d0db5b2ff483e3a197c27b79791':
  svq3: eliminate remaining H264SliceContext usage

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-03 10:23:23 +01:00
Derek Buitenhuis
5db920bcb6 Merge commit '5a5db90edf71ef4c60db8ad7b0ebaa9a810c2d9e'
* commit '5a5db90edf71ef4c60db8ad7b0ebaa9a810c2d9e':
  svq3: move pict_type to the SVQ3Context

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-03 10:17:34 +01:00
Derek Buitenhuis
1bfbdb8f0b Merge commit '12f13ecb2dcddfa3ee930167395370d3c6fff90c'
* commit '12f13ecb2dcddfa3ee930167395370d3c6fff90c':
  svq3: move mb strides/sizes to the SVQ3Context

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-03 10:15:54 +01:00
Derek Buitenhuis
297e2768da Merge commit 'ad9d3384de08f02967d6eb11196ee8c78e8b2dba'
* commit 'ad9d3384de08f02967d6eb11196ee8c78e8b2dba':
  svq3: move the dequant buffer to SVQ3Context

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-03 10:15:22 +01:00