summaryrefslogtreecommitdiff
path: root/libavcodec/libopenh264enc.c
Commit message (Collapse)AuthorAgeFilesLines
* lavc: deprecate AVCodecContext.ticks_per_frameAnton Khirnov2023-05-151-1/+7
| | | | | | | | For encoding, this field is entirely redundant with AVCodecContext.framerate. For decoding, this field is entirely redundant with AV_CODEC_PROP_FIELDS.
* lavc/libkvazaar,libopenh264enc: drop redundant checksAnton Khirnov2023-05-151-5/+0
| | | | The same check is present in encode_preinit_video().
* lavc/libopenh264: refine the codeJun Zhao2023-04-221-2/+3
| | | | | | refine the code Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* lavc/libopenh264: Support full range videos in transcodingJun Zhao2023-04-221-1/+4
| | | | | | | Support full range videos when transcoding, enabled the YUVJ420P to avoid auto scale from YUVJ420P to YUV420P Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avcodec: remove FF_API_OPENH264_CABACJames Almer2023-02-091-6/+0
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: remove FF_API_OPENH264_SLICE_MODEJames Almer2023-02-091-16/+0
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* lavc: support AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE in all no-delay encodersAnton Khirnov2023-01-291-1/+2
| | | | Including fake-delay encoders marked with FF_CODEC_CAP_EOF_FLUSH.
* avcodec/codec_internal: Add macro to set AVCodec.long_nameAndreas Rheinhardt2022-09-031-1/+1
| | | | | | | | It reduces typing: Before this patch, there were 105 codecs whose long_name-definition exceeded the 80 char line length limit. Now there are only nine of them. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Make init-threadsafety the defaultAndreas Rheinhardt2022-07-181-1/+1
| | | | | | | | | | | and remove FF_CODEC_CAP_INIT_THREADSAFE All our native codecs are already init-threadsafe (only wrappers for external libraries and hwaccels are typically not marked as init-threadsafe yet), so it is only natural for this to also be the default state. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/openh264: return (DE|EN)CODER_NOT_FOUND if version check failsAndreas Schneider2022-07-081-1/+1
| | | | | | | | A cosmetic change only, it basically just changes the user facing error message to clients that interpret the errors to something that makes sense. Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/codec_internal: Use union for FFCodec decode/encode callbacksAndreas Rheinhardt2022-04-051-1/+1
| | | | | | | | | | | This is possible, because every given FFCodec has to implement exactly one of these. Doing so decreases sizeof(FFCodec) and therefore decreases the size of the binary. Notice that in case of position-independent code the decrease is in .data.rel.ro, so that this translates to decreased memory consumption. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Rename AVCodecDefault->FFCodecDefaultAndreas Rheinhardt2022-03-211-1/+1
| | | | | | | This structure is no longer declared in a public header, so using an FF-prefix is more appropriate. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Add FFCodec, hide internal part of AVCodecAndreas Rheinhardt2022-03-211-9/+9
| | | | | | | | | | | | | | | | Up until now, codec.h contains both public and private parts of AVCodec. This exposes the internals of AVCodec to users and leads them into the temptation of actually using them and forces us to forward-declare structures and types that users can't use at all. This commit changes this by adding a new structure FFCodec to codec_internal.h that extends AVCodec, i.e. contains the public AVCodec as first member; the private fields of AVCodec are moved to this structure, leaving codec.h clean. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Move FF_CODEC_CAP_* to a new header codec_internal.hAndreas Rheinhardt2022-03-211-0/+1
| | | | | | | | | | Also move FF_CODEC_TAGS_END as well as struct AVCodecDefault. This reduces the amount of files that have to include internal.h (which comes with quite a lot of indirect inclusions), as e.g. most encoders don't need it. It is furthemore in preparation for moving the private part of AVCodec out of the public codec.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/libopenh264enc: set iEntropyCodingModeFlag by coder optionLimin Wang2022-01-141-7/+7
| | | | | | | | | | | | | | | For high/main profile, user can choose to use cavlc by specify "-coder cavlc", for default, it'll will use cabac, if it's baseline, we'll use cavlc by specs anyway. ffmpeg -y -f lavfi -i testsrc -c:v libopenh264 -profile:v main -coder cavlc -frames:v 1 -bsf trace_headers -f null - before the patch: entropy_coding_mode_flag 0 = 1 after the patch: entropy_coding_mode_flag 0 = 0 Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/libopenh264enc: make the profile configuablable correctlyLimin Wang2022-01-141-3/+3
| | | | | | | | | due to the limitations set in d3a7bdd4ac54349aea9150a234478635d50ebd87, you weren't able to use main profile with OpenH264 1.8, or high profile with older versions Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/libopenh264enc: support for colorspace and range informationLimin Wang2022-01-141-0/+22
| | | | | Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/libopenh264enc: Allow user-supplied buffersAndreas Rheinhardt2021-05-231-4/+4
| | | | | | | | Here the packet size is known before allocating the packet, so that supporting user-supplied buffers is trivial. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Constify AVCodecsAndreas Rheinhardt2021-04-271-1/+1
| | | | | | | | | | 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>
* avcodec: Remove deprecated coder type optionsAndreas Rheinhardt2021-04-271-10/+0
| | | | | | | Deprecated in be00ec832c519427cd92218abac77dafdc1d5487. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* lavc: rename AV_CODEC_CAP_AUTO_THREADS->AV_CODEC_CAP_OTHER_THREADSAnton Khirnov2021-03-161-1/+1
| | | | | | | | | | This cap is currently used to mark multithreading-capable codecs that wrap external libraries with their own multithreading code. The name is highly confusing for our API users, since libavcodec ALWAYS handles thread_count=0 (see commit message in previous commit). Therefore rename the cap and update its documentation to make its meaning clear. The old name is kept deprecated until next+1 major bump.
* lavc: replace internal use of AV_CODEC_CAP_AUTO_THREADS with an internal capAnton Khirnov2021-03-161-1/+2
| | | | | | | | | | | | | | | | AV_CODEC_CAP_AUTO_THREADS was originally added in b4d44a45f9a to mark codecs that spawn threads internally and are able to select an optimal threads count by themselves (all such codecs are wrappers around external libraries). It is used by lavc generic code to check whether it should handle thread_count=0 itself or pass the zero directly to the codec implementation. Within this meaning, it is clearly supposed to be an internal cap rather than a public one, since from the viewpoint of a libavcodec user, lavc ALWAYS handles thread_count=0. Whether it happens in the generic code or within the codec internals is not a meaningful difference for the caller. External aspects of this flag will be dealt with in the following commit.
* lavc/libopenh264enc: use framerate if availableJun Zhao2020-08-051-1/+10
| | | | | | | | | | Respecting the framerate in the libopenh264enc codec context. Both the libx264 and libx265 encoders already contain similar logic to first check the framerate before falling back to the timebase. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* lavc/libopenh264enc: Add coder option to replace cabacLinjie Fu2020-05-131-13/+27
| | | | | | | | | | | | | | | | | Set DEPRECATED flag to option cabac, replace with coder. The priority logic is: 1. s->coder; then 2. avctx->coder_type; then 3. s->cabac. Change the default option to -1 and allow the default cabac to be determined by profile. Add FF_API_OPENH264_CABAC macro for cabac to remove this option after LIBAVCODEC_VERSION_MAJOR = 59. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Linjie Fu <linjie.fu@intel.com>
* lavc/libopenh264enc: Allow specifying the profile through AVCodecContextLinjie Fu2020-05-131-0/+15
| | | | | | | | | | | | | | And determine the profile with following priority: 1. s->profile; then 2. avctx->profile; then 3. s->cabac; then 4. a default profile. This seems more natural in case user somehow sets both avctx->profile and s->profile. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Linjie Fu <linjie.fu@intel.com>
* lavc/libopenh264enc: Rewrite profile handlingLinjie Fu2020-05-131-4/+40
| | | | | | | | | | | | Support the profiles "constrained_baseline" and "high" for libopenh264 version >= 1.8, support "constrained_baseline" and "main" for earlier version. If option not supported with current version, convert to constrained baseline with a warning for users. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Linjie Fu <linjie.fu@intel.com>
* lavc/libopenh264enc: set slice_mode option to deprecatedLinjie Fu2020-04-291-2/+5
| | | | | | | | | | | | | | | "slice mode" option seems to be unnecessary since it could be determined by -slices/max_nal_size. default: SM_FIXEDSLCNUM_SLICE mode with cpu-number slices. -slices N: SM_FIXEDSLCNUM_SLICE mode with N slices. -max_nal_size: SM_SIZELIMITED_SLICE mode with limited size slices. Add FF_API_OPENH264_SLICE_MODE macro to remove this option after LIBAVCODEC_VERSION_MAJOR = 59. Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* lavc/libopenh264enc: prompt slice number changing inside libopenh264Linjie Fu2020-04-291-0/+2
| | | | | | | | | | Libopenh264enc would set the slice according to the number of cpu cores if uiSliceNum equals to 0 (auto) in SM_FIXEDSLCNUM_SLICE mode. Prompt a warning for user to catch this. Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* lavc/libopenh264enc: add bit rate control select supportLinjie Fu2020-04-291-1/+14
| | | | | | | | | | | | | | | | | RC_BITRATE_MODE: set BITS_EXCEEDED to iCurrentBitsLevel and allows QP adjust in RcCalculatePictureQp(). RC_BUFFERBASED_MODE: use buffer status to adjust the video quality. RC_TIMESTAMP_MODE: bit rate control based on timestamp, introduced in release 1.4. Default to use RC_QUALITY_MODE. Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* lavc/libopenh264enc: add default gop size and bit rateLinjie Fu2020-04-291-2/+7
| | | | | | | | | | | | | | | It would be 200kbps bitrate with gop size = 12 by default which generated too many IDR frames in rather low bit rate. The quality would be poor. Set these default values to -1 to check whether it's specified by user explicitly. Use 2Mbps bitrate as nvenc sugguested, and leave gop size untouched in libopenh264. Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* lavc/libopenh264enc: Add qmin/qmax supportLinjie Fu2020-04-291-0/+11
| | | | | | | | | | | | | | Clip iMinQp/iMaxQp to (1, 51) for user specified qp range. If not set, leave iMinQp/iMaxQp untouched and use the values (0, 51) initialized in FillDefault(), and the QP range would be adjusted to the defaults inside libopenh264 library according to the iUsageType, (12, 42) for iUsageType == CAMERA_VIDEO_REAL_TIME which is default. <https://github.com/cisco/openh264/blob/master/codec/encoder/core/src/encoder_ext.cpp#L375> Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* lavc/libopenh264enc: fix the if-else coding styleLinjie Fu2020-04-101-3/+2
| | | | | Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avcodec/libopenh264enc: fix class_nameTobias Rapp2018-11-131-1/+1
| | | | | | | Reverts some accidental change in commit e621b1ca646a2f268797adc3194b694a852548d2. Reviewed-by: Jan Ekström <jeebjp@gmail.com> Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
* libopenh264enc: Handle sample_aspect_ratioValery Kot2018-11-051-0/+41
|
* avcodec/openh264enc.c: generate IDR frame in response to I frame pict_typeValery Kot2018-04-051-0/+4
| | | | Signed-off-by: Valery Kot <valery.kot@gmail.com>
* avcodec: add metadata to identify wrappers and hardware decoderswm42017-12-141-0/+1
| | | | | | | | | | | | | | | | | | | | | Explicitly identify decoder/encoder wrappers with a common name. This saves API users from guessing by the name suffix. For example, they don't have to guess that "h264_qsv" is the h264 QSV implementation, and instead they can just check the AVCodec .codec and .wrapper_name fields. Explicitly mark AVCodec entries that are hardware decoders or most likely hardware decoders with new AV_CODEC_CAPs. The purpose is allowing API users listing hardware decoders in a more generic way. The proposed AVCodecHWConfig does not provide this information fully, because it's concerned with decoder configuration, not information about the fact whether the hardware is used or not. AV_CODEC_CAP_HYBRID exists specifically for QSV, which can have software implementations in case the hardware is not capable. Based on a patch by Philip Langdale <philipl@overt.org>. Merges Libav commit 47687a2f8aca3f65b6fdd117b1cb66a7409a7fd1.
* Merge commit '97cfe1d8bd1968143e2ba9aa46ebe9504a835e24'James Almer2017-11-011-1/+4
|\ | | | | | | | | | | | | * commit '97cfe1d8bd1968143e2ba9aa46ebe9504a835e24': Convert all AVClass struct declarations to designated initializers. Merged-by: James Almer <jamrial@gmail.com>
| * Convert all AVClass struct declarations to designated initializers.Diego Biurrun2017-06-121-1/+4
| |
* | Merge commit '800d91d348c89fc8ca3fbec7696ab1ec8787acc6'James Almer2017-03-311-2/+2
|\ \ | |/ | | | | | | | | | | * commit '800d91d348c89fc8ca3fbec7696ab1ec8787acc6': Drop pointless void* casts Merged-by: James Almer <jamrial@gmail.com>
| * Drop pointless void* castsDiego Biurrun2016-11-131-2/+2
| |
* | Merge commit '7a76371437f9562c3414f985523f883489e3936a'Hendrik Leppkes2016-11-181-19/+8
|\ \ | |/ | | | | | | | | | | * commit '7a76371437f9562c3414f985523f883489e3936a': libopenh264enc: Simplify init by setting FF_CODEC_CAP_INIT_CLEANUP Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * libopenh264enc: Simplify init by setting FF_CODEC_CAP_INIT_CLEANUPMartin Storsjö2016-07-151-19/+8
| | | | | | | | | | | | Also set FF_CODEC_CAP_INIT_THREADSAFE while adding internal capabilities. Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit '2d097c16b833c532ac974a7f1fd05c0a1f3b7675'Hendrik Leppkes2016-11-181-0/+2
|\ \ | |/ | | | | | | | | | | * commit '2d097c16b833c532ac974a7f1fd05c0a1f3b7675': libopenh264enc: Return a more sensible error code in some init failure paths Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * libopenh264enc: Return a more sensible error code in some init failure pathsMartin Storsjö2016-07-151-0/+2
| | | | | | | | | | | | Previously they returned the default AVERROR_UNKNOWN. Signed-off-by: Martin Storsjö <martin@martin.st>
| * libopenh264: Support building with the 1.6 releaseMartin Storsjö2016-07-091-2/+24
| | | | | | | | Signed-off-by: Martin Storsjö <martin@martin.st>
| * Add an OpenH264 decoder wrapperMartin Storsjö2016-06-281-41/+7
| | | | | | | | | | | | | | | | While it is less featureful (and slower) than the built-in H264 decoder, one could potentially want to use it to take advantage of the cisco patent license offer. Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit '31aa5335c390c83a6c3ea955b155067c36c4a2c4'Hendrik Leppkes2016-10-071-2/+4
|\ \ | |/ | | | | | | | | | | * commit '31aa5335c390c83a6c3ea955b155067c36c4a2c4': libopenh264enc: Fix inconsistent whitespace Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * libopenh264enc: Fix inconsistent whitespaceMartin Storsjö2016-06-241-2/+4
| | | | | | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* | libopenh264: Support building with the 1.6 releaseMartin Storsjö2016-07-271-2/+24
| | | | | | | | | | | | | | | | | | This fixes trac issue #5417. This is cherry-picked from libav commit d825b1a5306576dcd0553b7d0d24a3a46ad92864. Signed-off-by: Martin Storsjö <martin@martin.st>
* | Add an OpenH264 decoder wrapperMartin Storsjö2016-07-271-41/+7
| | | | | | | | | | | | | | | | This is cherrypicked from libav, from commits 82b7525173f20702a8cbc26ebedbf4b69b8fecec and d0b1e6049b06eeeeca146ece4d2f199c5dba1565. Signed-off-by: Martin Storsjö <martin@martin.st>