Commit Graph

13 Commits

Author SHA1 Message Date
Zhong Li e62f625163 lavf/qsvvpp: add P010 output format support
Signed-off-by: Zhong Li <zhong.li@intel.com>
2019-06-10 13:48:41 +08:00
Zhong Li ef56c28b25 lavf/qsvvpp: add extra_hw_frames support
extra_hw_frames is needed for some cases.
(eg: qsv decoding + qsv vpp + qsv look_ahead encoding, transcoding
 failed if no extra_hw_frames supported:
 ffmpeg -hwaccel qsv -c:v h264_qsv -i bbb_sunflower_1080p_30fps_normal_2000frames.mp4 \
-vf vpp_qsv=w=1280:h=720:extra_hw_frames=100 -v verbose  -c:v h264_qsv \
-look_ahead 1 -look_ahead_depth 100 out1.mp4
)

Signed-off-by: Zhong Li <zhong.li@intel.com>
2019-06-10 13:48:06 +08:00
Linjie Fu 6895b350c3 lavf/qsvvpp: avoid the double-free when working in sys memory mode
Currently, picref will be freed by calling av_frame_free(&picref) in
submit_frame() in qsvvpp.c when working in system memory mode,and normally it
is freed in filter_frame() in vf_vpp_qsv.c when working in other modes.

Double free happens when working in system memory mode, remove to
fix the memory issue.

Reproduce:
ffmpeg -init_hw_device qsv=foo -filter_hw_device foo -f rawvideo -pix_fmt nv12 -s:v 852x480 \
-i 852x480.nv12 -vf 'vpp_qsv=w=500:h=400' -f rawvideo -pix_fmt nv12 qsv.nv12

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Zhong Li <zhong.li@intel.com>
2019-05-30 09:33:21 +08:00
Zhong Li a5e1cb9e96 lavu/hwcontext_qsv: Add support for AV_PIX_FMT_BGRA.
RGB32(AV_PIX_FMT_BGRA on intel platforms) format may be used as overlay with alpha blending.
So add AV_PIX_FMT_BGRA format support.

One example of alpha blending overlay: ffmpeg -hwaccel qsv -c:v h264_qsv -i BA1_Sony_D.jsv
-filter_complex 'movie=lena-rgba.png,hwupload=extra_hw_frames=16[a];[0:v][a]overlay_qsv=x=10:y=10'
-c:v h264_qsv -y out.mp4

Rename RGB32 to be BGRA to make it clearer as Mark Thompson's suggestion.

V2: Add P010 format support else will introduce HEVC 10bit encoding regression.
    Thanks for LinJie's discovery.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Verified-by: Fu, Linjie <linjie.fu@intel.com>
2018-10-11 13:26:59 +08:00
James Almer 185aa5e896 Merge commit 'e05e5920a4e1f1f15cc8a7c843159d519f6ec18e'
* commit 'e05e5920a4e1f1f15cc8a7c843159d519f6ec18e':
  qsv: Error out if getting session handle failed in avfilter

Merged-by: James Almer <jamrial@gmail.com>
2018-09-11 13:41:07 -03:00
Zhong Li e05e5920a4 qsv: Error out if getting session handle failed in avfilter
Solve some issues found by an automated code scansion.
Suppress the complain "variables 'handle' is used but maybe
uninitialized".

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2018-08-23 08:22:34 +02:00
Ruiling Song d865783b6c lavf/qsv: clone the frame which may be managed by framework
For filters based on framesync, the input frame was managed
by framesync, so we should not directly keep and destroy it,
instead we make a clone of it here, or else double-free will occur.
But for other filters not based on framesync, we still need to
free the input frame inside filter_frame.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
2018-04-21 19:00:43 +01:00
James Almer f790410b6b Merge commit 'cca5e4f040971db6de0bfe6968f00c021d8a9c42'
* commit 'cca5e4f040971db6de0bfe6968f00c021d8a9c42':
  qsv: adding Multi Frame Encode support

Merged-by: James Almer <jamrial@gmail.com>
2018-04-13 20:34:23 -03:00
Maxym Dmytrychenko cca5e4f040 qsv: adding Multi Frame Encode support
Starting from API 1.25 helps to improve performance of the simultaneous
encode, 1:N scenario, like:

./avconv  -y -hwaccel qsv -c:v h264_qsv -r 30000/1001 -i
~/bbb_sunflower_1080p_60fps_normal.mp4  -vframes 600 -an \
    -filter_complex "split=2[s1][s2]; [s1]scale_qsv=1280:720[o1];
[s2]scale_qsv=960:540[o2]" \
    -map [o1] -c:v h264_qsv -b:v 3200k -minrate 3200k -maxrate 3200k -f
rawvideo /tmp/3200a.264 \
    -map [o2] -c:v h264_qsv -b:v 1750k -minrate 1750k -maxrate 1750k -f
rawvideo /tmp/1750a.264

Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
2018-04-08 20:47:59 +02:00
James Almer 1a24d4f020 Merge commit 'ea25ccd1b2a980df8d43cc1f86a23e3c094090a6'
* commit 'ea25ccd1b2a980df8d43cc1f86a23e3c094090a6':
  qsv: Join the derived session to the parent

Merged-by: James Almer <jamrial@gmail.com>
2017-11-11 15:24:08 -03:00
James Almer 4391d6cb81 Merge commit 'a5a6ac1a123a927e5bed984ed757a29b7ff87dab'
* commit 'a5a6ac1a123a927e5bed984ed757a29b7ff87dab':
  libavfilter/overlay_qsv: Add QSV overlay vpp filter
  libavfilter/vf_vpp: Add common filters of the qsv vpp

Merged-by: James Almer <jamrial@gmail.com>
2017-11-11 15:07:06 -03:00
Luca Barbato ea25ccd1b2 qsv: Join the derived session to the parent
Should improve the performance on multiple transcoding from a single
source.
2017-09-27 12:27:34 +00:00
Huang, Zhengxu a5a6ac1a12 libavfilter/overlay_qsv: Add QSV overlay vpp filter
The filter supports two inputs and (implicitly) scaling the second input
during composition, unlike the software overlay.

The code has been separated into common interface and qsv overlay
implementation. The common part mainly creates the qsv session and
manages the surface which is nearly the same for all qsv filters.
So the qsvvpp.c/qsvvpp.h API can be used by other QSV vpp filters
to reduce code redundancy.

Usage:
 -hwaccel qsv -c:v mpeg2_qsv -r 25 -i in.m2v -hwaccel qsv -c:v h264_qsv
 -i in.h264 -filter_complex
 "overlay_qsv=eof_action=repeat:x=(W-w)/2:y=(H-h)/2"  -b 2M -maxrate 3M
 -c:v h264_qsv -y out.h264

Two inputs should have different sizes otherwise one will be completely
covered or you need to scale the second input as follows:
  -hwaccel qsv -c:v mpeg2_qsv -r 25 -i in.m2v -hwaccel qsv -c:v h264_qsv
  -i in.h264 -filter_complex
  "overlay_qsv=w=720:h=576:x=(W-w)/2:y=(H-h)/2" -b 2M -maxrate 3M -c:v
  h264_qsv -y out.h264

  Signed-off-by: ChaoX A Liu <chaox.a.liu@gmail.com>
  Signed-off-by: Zhengxu Huang <zhengxu.maxwell@gmail.com>
  Signed-off-by: Andrew Zhang <huazh407@gmail.com>
  Change-Id: I5c381febb0af6e2f9622c54ba00490ab99d48297
  Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
2017-09-17 19:59:06 +02:00