summaryrefslogtreecommitdiff
path: root/libavcodec
Commit message (Collapse)AuthorAge
* lavc/vaapi_encode: add tile slice encoding supportLinjie Fu2020-07-20
| | | | | | | | | | | | | | | | | | Add functions to initialize tile slice structure and make tile slice: - vaapi_encode_init_tile_slice_structure - vaapi_encode_make_tile_slice Tile slice is not allowed to cross the boundary of a tile due to the constraints of media-driver. Currently adding support for one slice per tile. N x N tile encoding is supposed to be supported with the the capability of ARBITRARY_MACROBLOCKS slice structures. N X 1 tile encoding should also work in ARBITRARY_ROWS slice structure. Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
* lavc/vaapi_encode: wrap slice codes into row slice functionsLinjie Fu2020-07-20
| | | | | | | | Wrap current whole-row slice codes into following functions: - vaapi_encode_make_row_slice() - vaapi_encode_init_row_slice_structure() Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
* lavc/sgienc: Fix default 16bit encoding.Carl Eugen Hoyos2020-07-19
| | | | Broken since 7c56b879
* avcodec/mips: fix type mismatch in h264dsp_msa.cShiyou Yin2020-07-19
| | | | | | gcc warning: assignment from incompatible pointer type. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/put_bits: Make bit buffers 64-bitSteinar H. Gunderson2020-07-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change BitBuf into uint64_t on 64-bit x86. This means we need to flush the buffer less often, which is a significant speed win. All other platforms, including all 32-bit ones, are unchanged. Output bitstream is the same. All API constraints are kept in place, e.g., you still cannot put_bits() more than 31 bits at a time. This is so that codecs cannot accidentally become 64-bit-only or similar. Benchmarking on transcoding to various formats shows consistently positive results: dnxhd 25.60 fps -> 26.26 fps ( +2.6%) dvvideo 24.88 fps -> 25.17 fps ( +1.2%) ffv1 14.32 fps -> 14.58 fps ( +1.8%) huffyuv 58.75 fps -> 63.27 fps ( +7.7%) jpegls 6.22 fps -> 6.34 fps ( +1.8%) magicyuv 57.10 fps -> 63.29 fps (+10.8%) mjpeg 48.65 fps -> 49.01 fps ( +0.7%) mpeg1video 76.41 fps -> 77.01 fps ( +0.8%) mpeg2video 75.99 fps -> 77.43 fps ( +1.9%) mpeg4 80.66 fps -> 81.37 fps ( +0.9%) prores 12.35 fps -> 12.88 fps ( +4.3%) prores_ks 16.20 fps -> 16.80 fps ( +3.7%) rv20 62.80 fps -> 62.99 fps ( +0.3%) utvideo 68.41 fps -> 76.32 fps (+11.6%) Note that this includes video decoding and all other encoding work, such as DCTs. If you isolate the actual bit-writing routines, it is likely to be much more. Benchmark details: Transcoding the first 30 seconds of Big Buck Bunny in 1080p, Haswell 2.1 GHz, GCC 8.3, generally quantizer locked to 5.0. (Exceptions: DNxHD needs fixed bitrate, and JPEG-LS is so slow that I only took the first 10 seconds, not 30.) All runs were done ten times and single-threaded, top and bottom two results discarded to get rid of outliers, arithmetic mean between the remaining six. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/put_bits: Parametrize bit buffer typeSteinar H. Gunderson2020-07-19
| | | | | | | | | | Preparatory patch for making the bit buffer different size on different platforms; make a typedef and make all the hardcoded sizes into expressions deriving from this size. No functional change; generated assembler is near-identical. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavcodec/jpeg2000dec: Support for Parameterless MarkersGautam Ramakrishnan2020-07-19
| | | | | | | | | The JPEG2000 standard reserves marker values 0xFF30 to 0xFF3F to be used as parameterless markers. This patch adds support to decode codestream with such markers. This allows decoding of p0_02.j2k. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/vaapi_encode: add EQUAL_MULTI_ROWS support for slice structureLinjie Fu2020-07-19
| | | | | | | | | | | | | | | | | | VA_ENC_SLICE_STRUCTURE_EQUAL_MULTI_ROWS is added to in the latest libva (1.8.0) which matches the hardware behaviour: /** \brief Driver supports any number of rows per slice but they must * be the same for all slices except for the last one, which must be * equal or smaller to the previous slices. */ And VA_ENC_SLICE_STRUCTURE_EQUAL_ROWS is kind of deprecated for iHD since it's somehow introduced in [1] which is misleading from what we actually handles. [1]<https://github.com/intel/libva/commit/0e6d5441f19bdc674b4da3169d614d10fd644778> Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
* avcodec/libaomenc: use pix_fmt descriptors where usefulJames Almer2020-07-17
| | | | | Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: James Almer <jamrial@gmail.com>
* libaomenc: enable 8, 10 and 12 bit RGB encodingLynne2020-07-17
| | | | | | | RGB pixel formats are one occasion where by pixel format we mean pixel format, primaries, transfer characteristic, and matrix coeffs, so we have to manually set them as they're set to unspecified by default, despite there only being a single possible combination.
* avcodec/libx264: call x264_param_cleanup() if availableJames Almer2020-07-17
| | | | | | | The documentation states it should be used to free any memory allocated by x264_param_parse(). Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/libx264: check for param allocation failure error codeJames Almer2020-07-17
| | | | | | And return the proper AVERROR value. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/libx264: use a function to parse x264optsJames Almer2020-07-17
| | | | | | This is needed for the following patch. Signed-off-by: James Almer <jamrial@gmail.com>
* Revert "avcodec/cbs_av1: keep separate reference frame state for reading and ↵James Almer2020-07-16
| | | | | | | | writing" This reverts commit 4e2bef6a82b356772a5919c51c9be1530268bd79. It's no longer needed now that all the bsfs use separate contexts for reading and writing.
* avcodec/av1_frame_merge_bsf: Use separate contexts for reading/writingJames Almer2020-07-16
| | | | | | Based on code from 235a5734e0 Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/av1_metadata_bsf: Use separate contexts for reading/writingJames Almer2020-07-16
| | | | | | Based on code from 235a5734e0 Signed-off-by: James Almer <jamrial@gmail.com>
* libavcodec/jpeg2000 Fix RPCL Progression order checkGautam Ramakrishnan2020-07-16
| | | | | | | The RPCL progression order check was incomplete. This patch completes the check. Tested on p1_07.j2k. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/v4l2_m2m_dec: remove redundant packet and fix double freeAndriy Gelman2020-07-16
| | | | | | | | | | | | | | | | | | v4l2_receive_frame() uses two packets s->buf_pkt and avpkt. If avpkt cannot be enqueued, the packet is buffered in s->buf_pkt and enqueued in the next call. Currently the ownership transfer between the two packets is not properly handled. A double free occurs if ff_v4l2_context_enqueue_packet() returns EAGAIN and v4l2_try_start returns EINVAL. In fact, having two AVPackets is not needed and everything can be handled by s->buf_pkt. This commit removes the local avpkt from v4l2_receive_frame(), meaning that the ownership transfer doesn't need to be handled and the double free is fixed. Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* libavcodec/jpeg2000 Fix PCRL Progression Order checkGautam Ramakrishnan2020-07-16
| | | | | | | The PCRL progression checks were incomplete. This patch modifes completes the check. Tested on p1_05.j2k. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* API: add AV_PKT_DATA_S12M_TIMECODE to AVPacketSideDataTypeLimin Wang2020-07-15
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* libavcodec/jpeg2000dec : Prevent overriding SOP marker bitGautam Ramakrishnan2020-07-14
| | | | | | | | Currently, the COC marker overrides the SOP marker bit. However, only the COD marker may set this value. This patch fixes this bug. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* x86/h264_deblock: fix warning about trailing empty parameterJames Almer2020-07-12
| | | | | | Fixes part of ticket #8771 Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/tiff: Check input space in dng_decode_jpeg()Michael Niedermayer2020-07-10
| | | | | | | | Fixes: out of array read Fixes: 24034/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5111884337119232 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/mjpeg_parser: Adjust size rejection thresholdMichael Niedermayer2020-07-10
| | | | | | | Fixes: 86987846-429c8d80-c197-11ea-916b-bb4738e09687.jpg Fixes: Regression since ec3d8a0e6945fe015d16cd98a1e7dbb4be815c15 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/cbs_jpeg: Fix uninitialized end index in cbs_jpeg_split_fragment()Michael Niedermayer2020-07-10
| | | | | | | | Fixes: Out of array read Fixes: 24043/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5084566275751936.fuzz Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/hevcdec: Add VDPAU to list of supported formatsManojGuptaBonda2020-07-09
| | | | | | | | | | | | | | Added VDPAU to list of supported formats for HEVC10 and 12 bit formats also added 42010 bit to surface_parameters and new VDP chroma formats to VDPAUPixFmtMaps Add HEVC 420 10/12 Bit and 444 10/12 Bit support for VDPAU YUV444P10 is defined as the 444 surface with 10bit valid data in LSBs but H/w returns Data in MSBs Hence if we map output as YUV444p16 it is filtering out the LSB to convert to p10 format. Signed-off-by: Philip Langdale <philipl@overt.org>
* lavc/vdpau_hevc: add function to find exact vdp_profile for REXTManojGuptaBonda2020-07-09
| | | | | | | | | | | Add vdpau_parse_rext_profile and use profile constraint flags to determine the exact vdp_profile for HEVC_REXT. If profile mismatch is allowed, select Main profile by default. Add build object in Makefile for h265_profile_level dependency. Signed-off-by: Philip Langdale <philipl@overt.org>
* avcodec/mpeg12dec: add timecode metadataLimin Wang2020-07-09
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/h264_slice: add timecode metadataLimin Wang2020-07-09
| | | | | | | | Please test with below command: ./ffplay -vf drawtext="fontfile=/Library/Fonts/Arial.ttf:text=\\'%{metadata\\:timecode}\\'" \ ../fate-suite/h264/crew_cif_timecode-2.h264 Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/h264_slice: replace cur->f with out for better readabilityLimin Wang2020-07-09
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/hevcdec: add timecode metadataLimin Wang2020-07-09
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/libaomenc: fix build w/libaom v1.0.0James Zern2020-07-08
| | | | | | | | broken since: aa5c6f382b avcodec/libaomenc: Add command-line options to control the use of partition tools Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: James Zern <jzern@google.com>
* avcodec/dvbsubdec: CosmeticsLimin Wang2020-07-08
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/dvbsubdec: prefer to use variable instead of type for sizeofLimin Wang2020-07-08
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/dvbsubdec: simplify code by using OFFSET() macroLimin Wang2020-07-08
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/apedec: Fix undefined integer overflow with 24bitMichael Niedermayer2020-07-07
| | | | | | | | Fixes: signed integer overflow: 8683744 * 256 cannot be represented in type 'int' Fixes: 23527/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5679885932822528 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/loco: Fix integer overflow with large values from loco_get_rice()Michael Niedermayer2020-07-07
| | | | | | | | Fixes: signed integer overflow: 155 + 2147483647 cannot be represented in type 'int' Fixes: 23421/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LOCO_fuzzer-5652849097965568 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* pthread_frame: change the criterium for updating thread contextsAnton Khirnov2020-07-07
| | | | | | | | | | | Currently the next thread's context is updated from the previous one's if the codec descriptor is not marked as intra-only. That is not entirely correct, since that property does not necessarily imply anything about how a specific decoder implementation behaves. Instead, use the presence of the update_thread_context() callback to decide whether an update should be performed. Fixes races in CFHD, should cause no behaviour change in any other decoders.
* codec_desc: drop the INTRA_ONLY property from TAKAnton Khirnov2020-07-07
| | | | It has key frames and non-key frames, so it is not intra-only.
* avcodec/h26[45]_metadata_bsf: Use separate contexts for reading/writingAndreas Rheinhardt2020-07-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, both bsfs used the same CodedBitstreamContext for reading and writing; as a consequence, the state of the writer's context at the beginning of writing a fragment is exactly the state of the reader after having read the fragment; in particular, the writer might not have encountered one of its active parameter sets yet. This is not nice and may lead to invalid output even when the input is completely spec-compliant: Think of an access unit containing a primary coded picture referencing a PPS with id id (that is known from an earlier access unit/from extradata), then a new version of the PPS with id id and then a redundant coded picture that is also referencing the PPS with id id. This is spec-compliant, as the standard allows to overwrite a PPS with a different PPS in between coded pictures and not only at the beginning of an access unit. In this scenario, the reader would read the primary coded picture with the old PPS and the redundant coded picture with the new PPS (as it should); yet the writer would write both with the new PPS as extradata which might lead to errors or to invalid data being output without any error (e.g. if the two PPS differed in redundant_pic_cnt_present_flag). The above scenario does not directly translate to HEVC as long as one restricts oneself to input with nuh_layer_id == 0 only (as cbs_h265 does: it currently strips away any NAL unit with nuh_layer_id > 0 when decomposing); if one doesn't the same issue as above can happen. If one also allowed input packets to contain more than one access unit, issues like the above can happen even without redundant coded pictures/multiple layers. Therefore this commit uses separate contexts for reader and writer. Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/cbs: Remove unused function parametersAndreas Rheinhardt2020-07-07
| | | | | | | | Several cbs-functions had an unused CodedBitstreamContext parameter. This commit removes these. Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* Speedhq: Decode field 2 correctlyJean-Baptiste Kempf2020-07-06
| | | | This is similar to field 1 (effd2e72)
* avcodec/h264: support sps/pps AV_PKT_DATA_NEW_EXTRADATAOliver Woodman2020-07-06
| | | | | | | | | | | Commit 601c238854 added support for AV_PKT_DATA_NEW_EXTRADATA, but only for avcC extradata. This commit adds support for sps/pps extradata as well. This makes support consistent for passing new extradata consistent with the types of extradata that can be passed when initializing the decoder. Signed-off-by: Oliver Woodman <ollywoodman@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* libavcodec/jpeg2000dec.c: Enable image offsetsGautam Ramakrishnan2020-07-06
| | | | | | This patch enables support for image offsets. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavcodec/jpeg2000dec: Enhance pix fmt selectionGautam Ramakrishnan2020-07-06
| | | | | | | This patch assigns default pix format values when a match does not take place. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tiff: Check frame parameters before blit for DNGMichael Niedermayer2020-07-05
| | | | | | | | Fixes: out of array access Fixes: 23888/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-6021365974171648.fuzz Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/mjpegdec: Limit bayer to single plane outputting formatMichael Niedermayer2020-07-05
| | | | | | | This reduces the number of paths reachable with DNG and should improve security Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/pnmdec: Fix misaligned readsMichael Niedermayer2020-07-05
| | | | | Found-by: "Steinar H. Gunderson" <steinar+ffmpeg@gunderson.no> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/qsvenc_hevc: add qmax/qmin support for HEVC encodingLinjie Fu2020-07-05
| | | | | | | | | | | | Add qmax/qmin support for HEVC software bitrate control(SWBRC). Limitations: - RateControlMethod != MFX_RATECONTROL_CQP - with EXTBRC ON Signed-off-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com> Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Zhong Li <zhongli_dev@126.com>
* avcodec/h264_metadata_bsf: Fix invalid av_freepAndreas Rheinhardt2020-07-04
| | | | | | | This bug was introduced in 3c8a2a1180f03ca6b299ebc27eef21ae86635ca0. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>