aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vaapi_encode.c
Commit message (Collapse)AuthorAgeFilesLines
* vaapi_encode: Add flag to mark encoders supporting only constant-qualityMark Thompson2018-10-271-1/+2
| | | | And set it for MJPEG.
* vaapi_encode: Support configurable slicesMark Thompson2018-10-271-0/+148
| | | | | | This adds common code to query driver support and set appropriate address/size information for each slice. It only supports rectangular slices for now, since that is the most common use-case.
* vaapi_encode: Clean up the packed header configurationMark Thompson2018-09-231-56/+63
| | | | | | Add a larger warning more clearly explaining the consequences of missing packed header support in the driver. Also only write the extradata if the user actually requests it via the GLOBAL_HEADER flag.
* vaapi_encode: Clean up the GOP structure configurationMark Thompson2018-09-231-27/+56
| | | | | | Choose what types of reference frames will be used based on what types are available, and make the intra-only mode explicit (GOP size one, which must be used for MJPEG).
* vaapi_encode: Add support for max QP in rate controlMark Thompson2018-09-231-0/+3
| | | | | | This was added in libva 2.1.0 (VAAPI 1.1.0). Use AVCodecContext.qmax, matching the existing behaviour for qmin, and clean up the defaults so that we only pass min/max when explicitly set.
* vaapi_encode: Clean up rate control configurationMark Thompson2018-09-231-51/+130
| | | | | | Query which modes are supported and select between VBR and CBR based on that - this removes all of the codec-specific rate control mode selection code.
* vaapi_encode: Always reapply global parameters after the sequence headerMark Thompson2018-09-231-11/+9
| | | | | | | | The codec sequence headers may contain fields which can overwrite the fine parameters given in the specific settings (e.g. a crude bitrate value vs. the max-rate / target-percentage / etc. values in VAEncMiscParameterRateControl). Always reapply all global parameters after a sequence header to avoid this causing problems.
* vaapi_encode: Clean up the encode quality configurationMark Thompson2018-09-231-33/+51
|
* vaapi_encode: Choose profiles dynamicallyMark Thompson2018-09-231-55/+221
| | | | | | | | | | | Previously there was one fixed choice for each codec (e.g. H.265 -> Main profile), and using anything else then required an explicit option from the user. This changes to selecting the profile based on the input format and the set of profiles actually supported by the driver (e.g. P010 input will choose Main 10 profile for H.265 if the driver supports it). The entrypoint and render target format are also chosen dynamically in the same way, removing those explicit selections from the per-codec code.
* vaapi_encode: Factorise out adding global parametersMark Thompson2018-08-271-16/+22
|
* vaapi_encode: Remove common priv_data and options fieldsMark Thompson2018-08-271-10/+0
| | | | | The codec-specific context now contains both the common context and the codec-specific options directly.
* vaapi_encode: Add an assert in vaapi_encode_truncate_gop()Haihao Xiang2018-05-101-2/+2
| | | | | | | | The flag of input_available must be set when pic_start is not NULL, so add an assert to ensure it is true. In addition, the assert on last_pic is unnecessary now, so remove this assert. Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* lavc/vaapi_encode: Don't return error if the underlying driver doesn't ↵Haihao Xiang2018-03-081-4/+4
| | | | | | | | | | | | support B frames The underlying driver need not support B frames - since they are enabled by default for some codecs, it is better to disable them rather than returning an error in this case. This makes the default settings usable for low-power encoding on Intel platforms. Signed-off-by: Haihao Xiang <haihao.xiang@intel.com> Signed-off-by: Mark Thompson <sw@jkqxz.net>
* Merge commit '216c44dfc17252ec0681dcb0bbeeb45a9d14eca7'Mark Thompson2018-02-211-2/+2
|\ | | | | | | | | | | | | * commit '216c44dfc17252ec0681dcb0bbeeb45a9d14eca7': vaapi_encode: Destroy output buffer pool before VA context Merged-by: Mark Thompson <sw@jkqxz.net>
| * vaapi_encode: Destroy output buffer pool before VA contextMark Thompson2018-02-201-2/+2
| | | | | | | | | | The buffers are created associated with the context, so they should be destroyed before the context is. This is enforced by the iHD driver.
* | Merge commit 'c8e135ea9225137050a6315fd9ba9c0f242c90b6'Mark Thompson2018-02-211-4/+6
|\| | | | | | | | | | | | | | | | | | | * commit 'c8e135ea9225137050a6315fd9ba9c0f242c90b6': vaapi_encode: Allocate slice structures and parameter buffers dynamically Already present as e4a6eb70f471eda36592078e8fa1bad87fc9df73, one minor fix for libav merged. Merged-by: Mark Thompson <sw@jkqxz.net>
| * vaapi_encode: Allocate slice structures and parameter buffers dynamicallyJun Zhao2018-02-201-10/+30
| | | | | | | | | | | | | | | | | | This removes the arbitrary limit on the allowed number of slices and parameter buffers. From ffmpeg commit e4a6eb70f471eda36592078e8fa1bad87fc9df73. Signed-off-by: Mark Thompson <sw@jkqxz.net>
| * vaapi: Always free parameter buffers after vaEndPicture() with libva2Mark Thompson2017-10-251-2/+2
| | | | | | | | | | | | This is an ABI change in libva2: previously the Intel driver had this behaviour and it was implemented as a driver quirk, but now it is part of the specification so all drivers must do it.
| * vaapi_encode: Move quality option to common codeMark Thompson2017-08-061-0/+35
| | | | | | | | | | | | | | | | | | Use AVCodecContext.compression_level rather than a private option, replacing the H.264-specific quality option (which stays only for compatibility). This now works with the H.265 encoder in the i965 driver, as well as the existing cases with the H.264 encoder.
| * vaapi_encode: Use gop_size consistently in RC parametersMark Thompson2017-04-261-2/+1
| | | | | | | | | | | | | | | | The non-H.26[45] codecs already use this form. Since we don't currently generate I frames for codecs which support them separately to IDR, the p_per_i variable is set to infinity by default so that it doesn't interfere with any other calculation. (All the code for I frames still exists, and it works for H.264 if set manually.)
| * vaapi_encode: Discard output buffer if picture submission failsMark Thompson2017-02-161-0/+2
| | | | | | | | | | Previously this was leaking, though it actually hit an assert making sure that the buffer had already been cleared when freeing the picture.
* | lavc/vaapi_encode: give a debug message if attrs unsupported.Jun Zhao2017-12-191-0/+2
| | | | | | | | | | | | | | | | Give a debug message when query attribute get VA_ATTRIB_NOT_SUPPORTED, it's will help to trace and debug some issue. Signed-off-by: Jun Zhao <jun.zhao@intel.com> Signed-off-by: Mark Thompson <sw@jkqxz.net>
* | vaapi: Always free parameter buffers after vaEndPicture() with libva2Mark Thompson2017-10-091-2/+2
| | | | | | | | | | | | This is an ABI change in libva2: previously the Intel driver had this behaviour and it was implemented as a driver quirk, but now it is part of the specification so all drivers must do it.
* | Merge commit 'fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3'James Almer2017-09-261-1/+1
|\| | | | | | | | | | | | | * commit 'fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3': Mark some arrays that never change as const. Merged-by: James Almer <jamrial@gmail.com>
| * Mark some arrays that never change as const.Anton Khirnov2017-02-011-1/+1
| |
| * vaapi_encode: Pass framerate parameters to driverMark Thompson2017-01-301-0/+18
| | | | | | | | | | | | | | Only do this when building for a recent VAAPI version - initial driver implementations were confused about the interpretation of the framerate field, but hopefully this will be consistent everywhere once 0.40.0 is released.
| * vaapi_encode: Support VBR modeMark Thompson2017-01-301-5/+37
| | | | | | | | | | | | This includes a backward-compatibility hack to choose CBR anyway on old drivers which have no CBR support, so that existing programs will continue to work their options now map to VBR.
| * vaapi_encode: Add MPEG-2 supportMark Thompson2017-01-291-0/+1
| |
| * vaapi_encode: Support forcing IDR frames via AVFrame.pict_typeMark Thompson2017-01-111-4/+23
| |
| * vaapi_encode: Fix GOP sizingMark Thompson2017-01-111-43/+35
| | | | | | | | | | | | This change makes the configured GOP size be respected exactly - previously the value could be exceeded slightly due to flaws in the frame type selection logic.
| * vaapi_encode: Write sequence header as extradataMark Thompson2016-10-171-0/+22
| | | | | | | | | | Only works if packed headers are supported, where we can know the output before generating the first frame.
| * vaapi_encode: Decide on GOP setup before initialising sequence parametersMark Thompson2016-10-021-6/+6
| | | | | | | | | | This was always too late; several fields related to it have been incorrectly zero since the encoder was added.
| * vaapi_encode: Sync to input surface rather than outputMark Thompson2016-09-281-3/+3
| | | | | | | | | | | | | | | | | | While outwardly bizarre, this change makes the behaviour consistent with other VAAPI encoders which sync to the encode /input/ picture in order to wait for /output/ from the encoder. It is not harmful on i965 (because synchronisation already happens in vaRenderPicture(), so it has no effect there), and it allows the encoder to work on mesa/gallium which assumes this behaviour.
| * vaapi_encode: Check packed header capabilitiesMark Thompson2016-09-281-7/+29
| | | | | | | | | | This improves behaviour with drivers which do not support packed headers, such as AMD VCE on mesa/gallium.
| * vaapi_encode: Refactor initialisationMark Thompson2016-09-281-85/+168
| | | | | | | | | | | | | | | | This allows better checking of capabilities and will make it easier to add more functionality later. It also commonises some duplicated code around rate control setup and adds more comments explaining the internals.
| * vaapi_encode: Respect driver quirks around buffer destructionMark Thompson2016-07-021-1/+21
| | | | | | | | | | No longer leaks memory when used with a driver with the "render does not destroy param buffers" quirk (i.e. Intel i965).
* | lavc/vaapi_encode: Change the slice/parameter buffers to dynamic alloc.Jun Zhao2017-08-281-12/+30
| | | | | | | | | | | | | | | | Change the slice/parameter buffers to be allocated dynamically. Signed-off-by: Wang, Yi A <yi.a.wang@intel.com> Signed-off-by: Jun Zhao <jun.zhao@intel.com> Signed-off-by: Mark Thompson <sw@jkqxz.net>
* | vaapi_encode: Move quality option to common codeMark Thompson2017-08-201-0/+35
| | | | | | | | | | | | | | | | | | | | | | Use AVCodecContext.compression_level rather than a private option, replacing the H.264-specific quality option (which stays only for compatibility). This now works with the H.265 encoder in the i965 driver, as well as the existing cases with the H.264 encoder. (cherry picked from commit 19388a7200e5d99c703271f05dba1c806720e808)
* | vaapi_encode: Use gop_size consistently in RC parametersMark Thompson2017-06-141-2/+1
| | | | | | | | | | | | | | | | | | | | The non-H.26[45] codecs already use this form. Since we don't currently generate I frames for codecs which support them separately to IDR, the p_per_i variable is set to infinity by default so that it doesn't interfere with any other calculation. (All the code for I frames still exists, and it works for H.264 if set manually.) (cherry picked from commit 6af014f4028238b4c50f1731b3369a41d65fa9c4)
* | vaapi_encode: Discard output buffer if picture submission failsMark Thompson2017-06-141-0/+2
| | | | | | | | | | | | | | Previously this was leaking, though it actually hit an assert making sure that the buffer had already been cleared when freeing the picture. (cherry picked from commit 17aeee5832b9188b570c3d3de4197e4cdc54c634)
* | lavc/vaapi_encode: fix p_per_i calculate issue.Jun Zhao2017-04-021-1/+1
| | | | | | | | | | | | | | | | | | now gop_size <= (max_b_frames + 1) * p_per_i + 1 (IDR frame), so celing p_per_i = (gop_size - 1 + max_b_frames) / (max_b_frames + 1) Signed-off-by: Jun Zhao <jun.zhao@intel.com> Signed-off-by: Leilei <leilei.shang@intel.com> Signed-off-by: Mark Thompson <sw@jkqxz.net>
* | vaapi_encode: Pass framerate parameters to driverMark Thompson2017-02-081-0/+18
| | | | | | | | | | | | | | | | | | Only do this when building for a recent VAAPI version - initial driver implementations were confused about the interpretation of the framerate field, but hopefully this will be consistent everywhere once 0.40.0 is released. (cherry picked from commit ff35aa8ca4069bf1543adeec4c28e51e4a012eee)
* | vaapi_encode: Support VBR modeMark Thompson2017-02-081-5/+37
| | | | | | | | | | | | | | | | This includes a backward-compatibility hack to choose CBR anyway on old drivers which have no CBR support, so that existing programs will continue to work their options now map to VBR. (cherry picked from commit f033ba470fbab1ff6838666d4d86411effa97b27)
* | vaapi_encode: Add MPEG-2 supportMark Thompson2017-02-081-0/+1
| | | | | | | | (cherry picked from commit ca6ae3b77a7e6600e517723b90e57527a47809de)
* | vaapi_encode: Support forcing IDR frames via AVFrame.pict_typeMark Thompson2017-02-081-4/+23
| | | | | | | | (cherry picked from commit a3c3a5eac20a51d402c332cdf5220fff40a7943f)
* | vaapi_encode: Fix GOP sizingMark Thompson2017-02-081-43/+35
| | | | | | | | | | | | | | | | This change makes the configured GOP size be respected exactly - previously the value could be exceeded slightly due to flaws in the frame type selection logic. (cherry picked from commit 37fab0661a760b2a9d727939d72e629acee1a6ef)
* | vaapi_encode: Write sequence header as extradataMark Thompson2016-12-051-0/+22
| | | | | | | | | | | | | | Only works if packed headers are supported, where we can know the output before generating the first frame. (cherry picked from commit 0cf86fabfa5820596cca2cfead63c6f8df76c3f2)
* | vaapi_encode: Decide on GOP setup before initialising sequence parametersMark Thompson2016-11-211-6/+6
| | | | | | | | | | | | | | This was always too late; several fields related to it have been incorrectly zero since the encoder was added. (cherry picked from commit 314b421dd8910ebed7a8d419a0dbea239a00044e)
* | vaapi_encode: Sync to input surface rather than outputMark Thompson2016-11-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | While outwardly bizarre, this change makes the behaviour consistent with other VAAPI encoders which sync to the encode /input/ picture in order to wait for /output/ from the encoder. It is not harmful on i965 (because synchronisation already happens in vaRenderPicture(), so it has no effect there), and it allows the encoder to work on mesa/gallium which assumes this behaviour. (cherry picked from commit 086e4b58b59ea3993107aa24d92bb962ec69667c)
* | vaapi_encode: Check packed header capabilitiesMark Thompson2016-11-211-7/+29
| | | | | | | | | | | | | | This improves behaviour with drivers which do not support packed headers, such as AMD VCE on mesa/gallium. (cherry picked from commit 892bbbcdc171ff0d08d69636a240ffb95f54243c)