summaryrefslogtreecommitdiff
path: root/libavcodec/libvpxenc.c
Commit message (Collapse)AuthorAge
* avcodec: Add FF_CODEC_CAP_NOT_INIT_THREADSAFEAndreas Rheinhardt2022-07-18
| | | | | | | This is in preparation of switching the default init-thread-safety to a codec being init-thread-safe. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Hide stuff only used by the core decode APIAndreas Rheinhardt2022-05-12
| | | | | | | | | | | | | | | | | | | | | | The general decoding API uses bitstream filters and an AVFifo and therefore AVCodecInternal contains pointers to an AVBSFContext and to an AVFifo and lavc/internal.h includes lavc/bsf.h and lavu/fifo.h. Yet actually, only two files are supposed to use these, namely avcodec.c and (mainly) decode.c. For all the other files, it should be an opaque type that they should not touch and that they need not know anything about. This can be achieved by not including these headers and using the structs instead of the corresponding typedefs. This also forces translation units that really use the BSF and the FIFO APIs themselves to include the relevant headers directly instead of relying on indirect inclusions (up until now, even avcodec.c and decode.c relied on fifo.h to be included by internal.h). Of course, it also avoids unnecessary rebuilds when bsf.h or fifo.h change. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/libvpxenc: enable dynamic max quantizer reconfigurationDanil Chapovalov2022-04-05
| | | | Signed-off-by: James Zern <jzern@google.com>
* avcodec/codec_internal: Use union for FFCodec decode/encode callbacksAndreas Rheinhardt2022-04-05
| | | | | | | | | | | 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/libvpxenc: avoid unnecessary variable shadowingJames Almer2022-04-05
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/libvpxenc: return quantizer parameter for an encoded frameDanil Chapovalov2022-04-05
|
* avcodec/codec_internal: Rename AVCodecDefault->FFCodecDefaultAndreas Rheinhardt2022-03-21
| | | | | | | 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-21
| | | | | | | | | | | | | | | | 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-21
| | | | | | | | | | 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>
* configure: Use a separate config_components.h header for $ALL_COMPONENTSMartin Storsjö2022-03-16
| | | | | | | | This avoids unnecessary rebuilds of most source files if only the list of enabled components has changed, but not the other properties of the build, set in config.h. Signed-off-by: Martin Storsjö <martin@martin.st>
* lavc/libvpxenc: remove unneeded context variableAnton Khirnov2022-02-07
| | | | | discard_hdr10_plus is 0 IFF hdr10_plus_fifo is non-NULL, so we can test for the latter and avoid an extra variable.
* lavc/libvpxenc: switch to the new FIFO APIAnton Khirnov2022-02-07
|
* Replace all occurences of av_mallocz_array() by av_calloc()Andreas Rheinhardt2021-09-20
| | | | | | | They do the same. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/libvpxenc: Apply codec options to alpha codec contextAdam Chelminski2021-09-08
| | | | | | | | | | | | | | | | | When encoding yuva420 (alpha) frames, the vpx encoder uses a second vpx_codec_ctx to encode the alpha stream. However, codec options were only being applied to the primary encoder. This patch updates codecctl_int and codecctl_intp to also apply codec options to the alpha codec context when encoding frames with alpha. This is necessary to take advantage of libvpx speed optimizations such as 'row-mt' and 'cpu-used' when encoding videos with alpha. Without this patch, the speed optimizations are only applied to the primary stream encoding, and the overall encoding is just as slow as it would be without the options specified. Signed-off-by: Adam Chelminski <chelminski.adam@gmail.com> Signed-off-by: James Zern <jzern@google.com>
* avcodec/avcodec: Don't include cpu.hAndreas Rheinhardt2021-07-22
| | | | | | | It is not used here at all; instead, add it where it is used without including it or any of the arch-specific CPU headers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Pass HDR10+ metadata to packet side data in VP9 encoderMohammad Izadi2021-06-24
| | | | | | | | | | | | | HDR10+ metadata is stored in the bit stream for HEVC. The story is different for VP9 and cannot store the metadata in the bit stream. HDR10+ should be passed to packet side data an stored in the container (mkv) for VP9. This CL is taking HDR10+ from AVFrame side data in libvpxenc and is passing it to the AVPacket side data. Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Zern <jzern@google.com>
* lavc/libvpxenc: Show encoder config as a warning in case of failed ↵Matthieu Patou2021-06-14
| | | | | | initialization Suggested-By: ffmpeg@fb.com
* avcodec/libvpxenc: Avoid one level of indentationAndreas Rheinhardt2021-05-23
| | | | | | Reviewed-by: James Almer <jamrial@gmail.com> Reviewed-by: James Zern <jzern@google.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/libvpxenc: Avoid copying data, allow user-supplied buffersAndreas Rheinhardt2021-05-23
| | | | | | | | | | | | Here the packet size is known before allocating the packet because the encoder provides said information (and works with internal buffers itself), so one can use this information to avoid the implicit use of another intermediate buffer for the packet data; and by switching to ff_get_encode_buffer() one can also allow user-supplied buffers. Reviewed-by: James Almer <jamrial@gmail.com> Reviewed-by: James Zern <jzern@google.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Constify AVCodecsAndreas Rheinhardt2021-04-27
| | | | | | | | | | 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 AVCodecContext.coded_frameAndreas Rheinhardt2021-04-27
| | | | | | | | | | Deprecated in 40cf1bbacc6220a0aa6bed5c331871d43f9ce370. (The currently disabled filter vf_mcdeint and vf_uspp were users of this field; they have not been changed, so that whoever wants to fix them can see the state of these filters when they were disabled.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: Remove private options from AVCodecContextAndreas Rheinhardt2021-04-27
| | | | | | | | | Several options that were too codec-specific were deprecated between 0e6c8532215790bbe560a9eea4f3cc82bb55cf92 and 0e9c4fe254073b209970df3e3cb84531bc388e99. 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-16
| | | | | | | | | | 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-16
| | | | | | | | | | | | | | | | 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.
* avcodec/libvpxenc: optimize parsing vpx_svc_ref_frame_configWonkap Jang2021-02-19
| | | | | | | | Getting rid of unnecessary use of AVDictionary object in parsing vpx_svc_ref_frame_config. Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: James Zern <jzern@google.com>
* avcodec/libvpxenc: add a way to set VP9E_SET_SVC_REF_FRAME_CONFIGWonkap Jang2021-01-14
| | | | | | In order to fine-control referencing schemes in VP9 encoding, there is a need to use VP9E_SET_SVC_REF_FRAME_CONFIG method. This commit provides a way to use the API through frame metadata.
* avcodec/libvpxenc: add missing FF_API_ERROR_FRAME checkJames Almer2020-10-01
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/libvpxenc: use pix_fmt descriptors where usefulJames Zern2020-07-21
| | | | | | | | similar to: 36e51c190b avcodec/libaomenc: use pix_fmt descriptors where useful Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: James Zern <jzern@google.com>
* avcodec/internal: move packet related functions to their own headerJames Almer2020-06-02
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* libavcodec/libvpxenc: Don't free user-provided AVPacketAndreas Rheinhardt2020-05-23
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/libvpxenc: add a way to explicitly set temporal layer idWonkap Jang2020-02-11
| | | | | | | | | In order for rate control to correctly allocate bitrate to each temporal layer, correct temporal layer id has to be set to each frame. This commit provides the ability to set correct temporal layer id for each frame. Signed-off-by: James Zern <jzern@google.com>
* avcodec/libvpxenc: add VP9 temporal scalability encoding optionWonkap Jang2020-02-03
| | | | | | | | | This commit reuses the configuration options for VP8 that enables temporal scalability for VP9. It also adds a way to enable three preset temporal structures (refer to the documentation for more detail) that can be used in offline encoding. Signed-off-by: James Zern <jzern@google.com>
* avcodec/libvpxenc,cosmetics: prefer sizeof(var)James Zern2020-01-06
| | | | | Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: James Zern <jzern@google.com>
* avcodec/libvpxenc: use AV_OPT_TYPE_DICT for ts-parametersMarton Balint2020-01-01
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/libvpxenc,cosmetics: fix a typoJames Zern2019-11-08
| | | | predicition -> prediction
* avcodec/libvpxenc: only allocate alpha U/V planes on size changesMarton Balint2019-11-05
| | | | | Signed-off-by: Marton Balint <cus@passwd.hu> Signed-off-by: James Zern <jzern@google.com>
* avcodec/libvpxenc: fix alpha strideMarton Balint2019-11-05
| | | | | Signed-off-by: Marton Balint <cus@passwd.hu> Signed-off-by: James Zern <jzern@google.com>
* Change libvpxenc default to crf=32.elliottk2019-10-07
| | | | | | | | | Current default is 200kbps, which produces inconsistent results (too high for low-res, too low for hi-res). Use CRF instead, which will adapt. Affects VP9. Also have VP8 use a default bitrate of 256kbps. Signed-off-by: James Zern <jzern@google.com>
* avcodec/libvpxenc: add ROI-based encoding support for VP8/VP9Guo, Yejun2019-09-19
| | | | | | | | example command line to verify it: ./ffmpeg -i input.stream -vf addroi=0:0:iw/3:ih/3:-0.8 -c:v libvpx -b:v 2M tmp.webm Signed-off-by: Guo, Yejun <yejun.guo@intel.com> Signed-off-by: James Zern <jzern@google.com>
* lavc/libvpxenc: remove redundant condition checkJun Zhao2019-05-12
| | | | | | | Redundant condition: '!A || B' is equivalent to '!A || (A && B)' but more clearly. Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avcodec/libvpxenc: add VP8/9 sharpness config optionRene Claus2018-12-24
| | | | | | | | This commit adds configuration options to libvpxenc.c that can be used to tune the sharpness parameter for VP8 and VP9. Signed-off-by: Rene Claus <rclaus@google.com> Signed-off-by: James Zern <jzern@google.com>
* libvpxenc,cosmetics: fix { placementJames Zern2018-11-19
| | | | Signed-off-by: James Zern <jzern@google.com>
* avcodec/libvpxenc: add VP8 temporal scalability config optionsArd Oerlemans2018-11-19
| | | | | | | | | This commit adds configuration options to libvpxenc.c that can be used to enable VP8 temporal scalability. It also adds a way to programmatically set the per-frame encoding flags which can be used to control usage and updates of reference frames while encoding with temporal scalability enabled. Signed-off-by: James Zern <jzern@google.com>
* avcodec/libvpxenc: Add a maximum constraint of 16 encoder threads.Chirag Lathia2018-11-15
| | | | | Signed-off-by: Chirag Lathia <clathia@google.com> Signed-off-by: James Almer <jamrial@gmail.com>
* libvpxenc: extend auto-alt-ref rangeJames Zern2018-11-09
| | | | | | | vp9 now supports [0, 6] Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: James Zern <jzern@google.com>
* libvpxenc,vp9: add enable-tpl optionJames Zern2018-11-09
| | | | | | enables temporal dependency model Signed-off-by: James Zern <jzern@google.com>
* avcodec/libvpxenc: fix setting amount of threads used for encodingJames Almer2018-05-21
| | | | | | | | | | | | The libvpx doxy says that a value of 0 for the g_threads field is equivalent to a value of 1, whereas for avctx->thread_count it means the maximum amount of threads possible for the host system. Use av_cpu_count() to get the correct thread count when auto threads is requested. Reviewed-by: James Zern <jzern@google.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: add metadata to identify wrappers and hardware decoderswm42017-12-14
| | | | | | | | | | | | | | | | | | | | | 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.
* libvpxenc,vp9: add corpus-complexity optionJames Zern2017-11-28
| | | | | | | | | | Corpus VBR mode is a variant of standard VBR where the complexity distribution midpoint is passed in rather than calculated for a specific clip or chunk. The valid range is [0, 10000]. 0 (default) uses standard VBR. Signed-off-by: James Zern <jzern@google.com>
* libvpxenc: remove pre-1.4.0 checksJames Zern2017-11-20
| | | | | Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: James Zern <jzern@google.com>