summaryrefslogtreecommitdiff
path: root/libavcodec/vaapi_encode.c
Commit message (Collapse)AuthorAge
* lavc/vaapi_encode: Don't return error if the underlying driver doesn't ↵Haihao Xiang2018-03-08
| | | | | | | | | | | | 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-21
|\ | | | | | | | | | | | | * 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-20
| | | | | | | | | | 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-21
|\| | | | | | | | | | | | | | | | | | | * 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-20
| | | | | | | | | | | | | | | | | | 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-25
| | | | | | | | | | | | 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-06
| | | | | | | | | | | | | | | | | | 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-26
| | | | | | | | | | | | | | | | 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-16
| | | | | | | | | | 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-19
| | | | | | | | | | | | | | | | 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-09
| | | | | | | | | | | | 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-26
|\| | | | | | | | | | | | | * 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-01
| |
| * vaapi_encode: Pass framerate parameters to driverMark Thompson2017-01-30
| | | | | | | | | | | | | | 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-30
| | | | | | | | | | | | 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-29
| |
| * vaapi_encode: Support forcing IDR frames via AVFrame.pict_typeMark Thompson2017-01-11
| |
| * vaapi_encode: Fix GOP sizingMark Thompson2017-01-11
| | | | | | | | | | | | 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-17
| | | | | | | | | | 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-02
| | | | | | | | | | 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-28
| | | | | | | | | | | | | | | | | | 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-28
| | | | | | | | | | This improves behaviour with drivers which do not support packed headers, such as AMD VCE on mesa/gallium.
| * vaapi_encode: Refactor initialisationMark Thompson2016-09-28
| | | | | | | | | | | | | | | | 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-02
| | | | | | | | | | 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-28
| | | | | | | | | | | | | | | | 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-20
| | | | | | | | | | | | | | | | | | | | | | 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-14
| | | | | | | | | | | | | | | | | | | | 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-14
| | | | | | | | | | | | | | 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-02
| | | | | | | | | | | | | | | | | | 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-08
| | | | | | | | | | | | | | | | | | 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-08
| | | | | | | | | | | | | | | | 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-08
| | | | | | | | (cherry picked from commit ca6ae3b77a7e6600e517723b90e57527a47809de)
* | vaapi_encode: Support forcing IDR frames via AVFrame.pict_typeMark Thompson2017-02-08
| | | | | | | | (cherry picked from commit a3c3a5eac20a51d402c332cdf5220fff40a7943f)
* | vaapi_encode: Fix GOP sizingMark Thompson2017-02-08
| | | | | | | | | | | | | | | | 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-05
| | | | | | | | | | | | | | 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-21
| | | | | | | | | | | | | | 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-21
| | | | | | | | | | | | | | | | | | | | | | 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-21
| | | | | | | | | | | | | | This improves behaviour with drivers which do not support packed headers, such as AMD VCE on mesa/gallium. (cherry picked from commit 892bbbcdc171ff0d08d69636a240ffb95f54243c)
* | vaapi_encode: Refactor initialisationMark Thompson2016-11-21
| | | | | | | | | | | | | | | | | | | | 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. (cherry picked from commit 80a5d05108cb218e8cd2e25c6621a3bfef0a832e)
* | vaapi_encode: Respect driver quirks around buffer destructionMark Thompson2016-11-13
| | | | | | | | | | | | | | | | No longer leaks memory when used with a driver with the "render does not destroy param buffers" quirk (i.e. Intel i965). (cherry picked from commit 221ffca6314ed3ba9d38464ea50cd85251c04e74) Fixes ticket #5871.
* | Merge commit '8a62d2c28fbacd1ae20c35887a1eecba2be14371'Hendrik Leppkes2016-11-13
|\| | | | | | | | | | | | | * commit '8a62d2c28fbacd1ae20c35887a1eecba2be14371': vaapi_encode: Maintain a pool of bitstream output buffers Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * vaapi_encode: Maintain a pool of bitstream output buffersMark Thompson2016-06-26
| | | | | | | | | | | | | | | | | | Previously we would allocate a new one for every frame. This instead maintains an AVBufferPool of them to use as-needed. Also makes the maximum size of an output buffer adapt to the frame size - the fixed upper bound was a bit too easy to hit when encoding large pictures at high quality.
* | Merge commit '11b8030309ee93d79b3a6cd4b83bf00757db1598'Hendrik Leppkes2016-10-07
|\| | | | | | | | | | | | | * commit '11b8030309ee93d79b3a6cd4b83bf00757db1598': vaapi_encode: Fix fallback when input does not match any format Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * vaapi_encode: Fix fallback when input does not match any formatMark Thompson2016-06-21
| | | | | | | | Just a typo. Add a comment to make it clearer what it's doing.
* | cosmetics: fix some misspelled wordsJames Almer2016-07-17
| | | | | | | | Signed-off-by: James Almer <jamrial@gmail.com>
* | Merge commit '19d7667a81499d4357ec8e0851701e17c238e584'Clément Bœsch2016-06-29
|\| | | | | | | | | | | | | * commit '19d7667a81499d4357ec8e0851701e17c238e584': vaapi_encode: Add support for writing arbitrary additional packed headers Merged-by: Clément Bœsch <clement@stupeflix.com>
| * vaapi_encode: Add support for writing arbitrary additional packed headersMark Thompson2016-06-09
| |
* | Merge commit '2bfa067d0b636e7b2004fb0ad5a53d0d48c6de32'Hendrik Leppkes2016-06-26
|\| | | | | | | | | | | | | * commit '2bfa067d0b636e7b2004fb0ad5a53d0d48c6de32': vaapi_encode: Check config attributes before creating config Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * vaapi_encode: Check config attributes before creating configMark Thompson2016-05-27
| | | | | | | | | | | | This prevents attempts to use unsupported modes, such as low-power H.264 mode on non-Skylake targets. Also fixes a crash on invalid configuration, when trying to destroy an invalid VA config/context.
* | Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'Clément Bœsch2016-06-21
|\| | | | | | | | | | | | | * commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb': cosmetics: Fix spelling mistakes Merged-by: Clément Bœsch <u@pkh.me>