Commit graph

3293 commits

Author SHA1 Message Date
Wangfei 9e0c133a24 libs: encoder: h264: support ICQ/QVBR bitrate control mode
ICQ is Intelligent Constant Quality. It will use the initial QP
vaule of icq-quality-factor to adjust QP at MB level intelligently
to improve subjective quality.

QVBR is Quality defined VBR. It will use qvbr-quality-factor to
adjust QP for each MB to get enough quality picture without waste
of bits.
2019-08-05 11:01:19 +08:00
Wangfei f5c9d86f9c libs: Let GST_VAAPI_RATECONTROL_MASK return unsigned int
The value return from GST_VAAPI_RATECONTROL_MASK will be used by
GST_VAAPI_POPCOUNT32 as its inpput. GST_VAAPI_POPCOUNT32 can only
deal with unsigned int. Otherwise there may be an error of out of
range of integer if we define few more rate-control mode.
2019-08-05 10:51:24 +08:00
Víctor Manuel Jáquez Leal 14ea838512 vaapidecodebin: set queue's max size buffers to 1
Otherwise the queue will swallow all the available decoder's surfaces
reaching a dead-lock.

This setting might impact the bin's peformance, but it's a trade-off.
2019-07-26 12:43:17 +02:00
Víctor Manuel Jáquez Leal 1fa172f032 vaapidecodebin: set properties default values 2019-07-26 12:40:01 +02:00
Víctor Manuel Jáquez Leal ec9a2a4b4e vaapidecode: don't error if can't push buffers downtream
When the code path goes to push buffers downstream when no surface
available in decoder context, and it fails the code bails out with a
fatal error.

That behavior is wrong, since it shouldn't be fatal. The use case is
when the video stream is disabled.

This patch just ignores the errors in this situation and demotes the
level of a log message.
2019-07-26 12:40:01 +02:00
Wangfei 8b8dfb127a libs: encoder: h264,h265: add new property "max-qp"
Add new property "max-qp" to allow set the maximum quantisation
parameter values.
2019-07-24 17:07:28 +00:00
Wangfei daab4c80a3 libs: encoder: vp9: add low power mode encode
By now, this feature only support by media-driver on Ice Lake
platform, more information you can reference:
https://github.com/intel/media-driver
2019-07-16 17:58:33 +00:00
U. Artie Eoff 4e4ca03bc1 vaapipostproc: update PAR when rotating
When rotating, swap pixel-aspect-ratio during
negotiation.

Fixes #181
2019-07-15 15:33:15 -07:00
U. Artie Eoff f1aa0cc5e0 vaapipostproc: add rotation support
Adds vpp rotation support to vaapipostproc.  Uses
property video-direction. Default is identity (no
rotation).

Closes #104
2019-07-09 12:26:46 -07:00
Wangfei e592f6b415 libs: encoder: h265: pass diff_cu_qp_delta_depth flag to driver
Intel media-driver requires enablement of diff_cu_qp_delta_depth when
cu_qp_delta_enabled_flag enabled.

Fixes: #177
2019-07-07 16:46:25 +02:00
Wangfei b8739a89b0 libs: encoder: Add MB ratecontrol mode to get its string 2019-07-05 16:56:12 +00:00
Wangfei 66d6754fce libs: encoder: refine guard of bitrate control mode
Remove useless guard of all bitrate control mode's guard except MB
which is define in VA-API version 0.39.1.
2019-07-05 16:56:12 +00:00
Jan Schmidt 1e36478b0f h264: Update for parse_vui_params parameter removal.
Update calls to the h264 parser lib for removal of the
parse_vui_params parameter.
2019-07-04 16:52:18 -04:00
Wang Zhanjun 958ea067cb libs: dec: vp9: do not use display size as decoded size
If display size is smaller than current frame size, then the crop size
will be set as display size, which either crashes the pipeline or the
output MD5 does not match. Rather it should use the actual decoded size.

This patch removes the cropping set. For rendering we can use aspect
ratio to set display size.

Fixes #175

Signed-off-by: Wang Zhanjun <zhanjunx.wang@intel.com>
Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
2019-06-28 18:42:42 +02:00
Víctor Manuel Jáquez Leal abc2545c60 Update README 2019-06-28 17:28:02 +02:00
He Junyan 9b0f041ded libs: dec: h265: Consider chroma_bit_depth to choose chrome type
For some main-10 stream, sometime the luma is 8 bits while chrome is more
than 8 bits, which cause using the wrong NV12 surface as the render target
and decoding error.

Fix #176
2019-06-28 16:49:51 +02:00
Wangfei e4bec306b6 vaapidecode: set initial decode format according surface chroma type
For surfaces with different chroma type, it is prefer to initialize
a format which chroma type should be same with surface chroma type
instead of using fixed NV12.
2019-06-26 10:36:56 +00:00
Wangfei 67ed67515b libs: decoder: jpeg: add support 400/411/422/444 chroma type
When create vaapi surface, it is better to use the chroma type get
from jpeg file instead of using fixed 420 format. And the correct
chroma type can be determined by horizontal_factor/vertical_factor
flags that get from jpegparse.
2019-06-26 10:36:56 +00:00
He Junyan 3b5c7aa688 libs: dec: h265: Fix profile_idc mapping.
The old mapping values return by gst_vaapi_utils_h265_get_profile_idc is
wrong, though GST_H265_PROFILE_IDC_MAIN and GST_H265_PROFILE_IDC_MAIN_10
happened to be the correct value.

We only support Annex A profile_idc (1-4).
2019-06-25 17:41:24 +02:00
U. Artie Eoff a6dfb6e5be plugins: remove last negotiated video info if caps are same
If the allocation caps and negotiated caps are the same,
then ensure any previously negotiated video info is also
removed.  This can occur when multi-resolution video
decoding returns to it's original resolution.

Fixes #170
2019-06-10 21:28:13 -07:00
U. Artie Eoff 5f41422215 vaapivideomemory: allow negotiated info to be removed
Allow NULL negotiated_vinfo to be passed into
gst_allocator_set_vaapi_negotiated_video_info to allow
any previously set info to be removed.
2019-06-10 20:39:28 -07:00
Freyr 1f5ad9c7e5 libs: encoder: vp8,vp9: reset frame_counter when input frame's format changes
When input frame's formate changes, vp{8,9} encoders don't reset their frame
counter, hence the newly created frame could become a P-frame, leading to some
major troubles (sigabrt in libdrm in case of vp9). This patch adds some frame
prediction-related reset logic to the `flush' methods of GstVaapiEncoderVP8 and
GstVaapiEncoderVP9 implementations.
2019-06-06 17:24:30 +03:00
U. Artie Eoff ed7277a1b7 libs: encoder: increase bitrate prop max value
There are many profile levels that can support
more than 102400 kbps.  Thus, increase the max
allowed bitrate property value from 102400 kbps
to 2048000 kbps (same as msdk encoder plugins).
2019-06-05 08:30:10 +00:00
He Junyan de51eb0059 libs: mpeg2 encoder: No packed header for SPS and PPS
Dislable passing down packed PPS and PPS to driver if driver does
not want it.

Fix: #168
2019-06-04 11:27:34 +00:00
Niels De Graef 8f884aa9bc meson: Bump minimal GLib version to 2.44
This means we can use some newer features and get rid of some
boilerplate code using the G_DECLARE_* macros.

As discussed on IRC, 2.44 is old enough by now to start depending on it.
2019-06-03 08:56:23 +02:00
Víctor Manuel Jáquez Leal e62b321efe libs: dec: vp9: clear parser pointer after release
Fix an use-after-release of the parser pointer in VP9 decoder.
2019-05-31 13:21:31 +02:00
Freyr666 53d86ff519 vaapiencode: Fixes deadlock in gst_vaapiencode_change_state function
This fixes a deadlock in gst_vaapiencode_change_state, which was due to
srcpad's chain function was locked waiting for available buffers. Since the
coded buffers in codedbuf_queue become available after sinkpad consume the
encoded frames, Paused -> Ready state change leads to deadlock. Coded buffers
are never consumed and marked free, hence gst_vaapiencode_handle_frame waits for
available buffers and holds the stream_lock of the srcpad.
2019-05-30 07:08:35 +00:00
Mathieu Duponchelle df3989865e doc: remove xml from comments 2019-05-29 23:08:22 +02:00
U. Artie Eoff 3ccf3f3334 vaapipostproc: add mirror support
Adds vpp mirroring support to vaapipostproc.  Use
property video-direction.  Valid values are identity,
horiz or vert.  Default is identity (no mirror).

Closes #89

v2: Use GstVideoOrientationMethod enum
v3: Don't warn for VA_MIRROR_NONE.
    Use GST_TYPE_VIDEO_ORIENTATION_METHOD type.
v4: Query VAAPI caps when setting mirror value
    instead of during per-frame processing.
v5: Return TRUE in warning cases when setting mirror value.
2019-05-29 09:06:27 +00:00
Mathieu Duponchelle 38d25c65c3 doc: fix some incorrect gtk-doc links 2019-05-29 01:41:37 +02:00
Thibault Saunier 879e1081a0 docs: Update plugin cache
Fixes https://gitlab.freedesktop.org/gstreamer/gst-docs/issues/36
2019-05-16 20:20:52 +00:00
Víctor Manuel Jáquez Leal bd549246d4 libs: surface: fix documentation format 2019-05-16 16:47:02 +02:00
Wangfei bc1ca96e67 libs: enc: h265: reset num_ref_idx_l1_active_minus1 when low delay B.
When enable low delay B, the reference list 1 will be same with
reference list 0, so need reset the num_ref_idx_l1_active_minus1
to num_ref_idx_l0_active_minus1.

Fixes: #160
2019-05-17 10:01:18 +08:00
Thibault Saunier 4fe9c0535f meson: Fix call to wrong function 2019-05-13 19:05:58 -04:00
Thibault Saunier b0f5a59760 docs: Port to hotdoc 2019-05-13 17:00:00 -04:00
He Junyan 0af3e36068 libs: encoder: not call ensure_num_slices inside g_assert
g_assert will take no effect when glib's G_DISABLE_ASSERT macro is
defined. The function inside the g_assert will take no effect and
we will fail to set the correct slice number.
2019-05-10 18:29:13 +08:00
Wangfei 47d256b24c libs: h265: dec: Add extension flags setting.
Use VAPictureParameterBufferHEVCExtension&
VASliceParameterBufferHEVCExtension to pass extension setting from
some extension profile clips which may include these information.
The hevc extension setting only supported after libva release 2.2.0
(API 1.2.0).
2019-05-09 06:27:42 +00:00
U. Artie Eoff be496a66c5 libs: encoder: add target-percentage property
Allow users to set the target-percentage for
variable rate controls.  The default value is
70 (as hard-coded prior).

v2: minimum allowed value changed from 0 to 1
v3: target-percentage unchanged if CBR used

Resolves #129
2019-05-09 06:15:35 +00:00
He Junyan b6457e4ce5 libs: encoder: Add a missing comment for DEFAULT_ROI_VALUE property. 2019-05-09 05:54:09 +00:00
He Junyan a1ae75b500 libs: encoder: Enable trellis quantization method.
The advanced trellis algorithm is supported in VA driver. We add
its support as a property named "trellis" of encoder.
It only works for H264 now, should be more in future.
2019-05-09 05:54:09 +00:00
Wangfei a4e2db4c0b libs: decoder: vp9: support 422/444 8bit/10bit chroma type.
According to the vp9 sepc, profile 1/3 support 422/440/444 chroma
type, so we need to add subsampling_x&subsampling_y to fix it.

Here is the relationship between chroma type and profile and
subsampling_x&subsampling_y according to vp9 spec:
------------------------------------------
Profile | Bit depth | Chroma subsampling |
------------------------------------------
 0      | 8         | 420                |
------------------------------------------
 1      | 8         | 422,440,444        |
------------------------------------------
 2      | 10, 12    | 420                |
------------------------------------------
 3      | 10, 12    | 422,440,444        |
------------------------------------------

-----------------------------------------------
Subsampling_x | Subsampling_y | Chroma format |
-----------------------------------------------
 0            | 0             | 444           |
-----------------------------------------------
 0            | 1             | 440           |
-----------------------------------------------
 1            | 0             | 422           |
-----------------------------------------------
 1            | 1             | 420           |
-----------------------------------------------
2019-05-08 10:08:55 +00:00
He Junyan d38f0bbb1d libs: Add packed 24 RGB format support.
Can not find a suitable chrome_type for this GST_VIDEO_FORMAT_RGB
packed 24 format. Just use GST_VAAPI_CHROMA_TYPE_RGB32 as its chrome
type. This kind of surface will just be created by new API with fourcc
and no old style chrome based creation is available.

fixes: #151
2019-05-06 19:28:43 +00:00
Wangfei 2ee518a988 vaapiencode: handle DMABuf caps feature in sink pad
Add DMABuff caps features in all encoders' sink pad.
2019-05-06 16:54:00 +02:00
Víctor Manuel Jáquez Leal 2541a33d6c libs: encoder: continue if roi meta is NULL
Coverity scan bug:

If the function actually returns a null value, a null pointer
dereference will occur.

In gst_vaapi_encoder_ensure_param_roi_regions(): Return value of
function which returns null is dereferenced without checking
2019-05-03 08:39:03 +00:00
He Junyan 9c1f3ad172 lib: decoder: vp9: Set chroma_type by VP9 bit_depth
The decoder's surface chroma type should depend on the bit depth
of VP9's parser. For 10bits VP9 stream, we need to use P10LE kind
10 bits surface as the decoder result.

Fixes #155
2019-05-03 06:57:11 +00:00
Víctor Manuel Jáquez Leal 838045b9e2 vaapipostproc: don't do any color conversion when GL_TEXTURE_UPLOAD
https://bugzilla.gnome.org/show_bug.cgi?id=748184 has resurrected
with commit 3e992d8a

Since gst_vaapi_find_preferred_caps_feature() returns a color format
from caps negotiation, different from the default one (NV12), the
postproc enables the color transformation. But when GL_TEXTURE_UPLOAD
feature is negotiated, no color transformation shall be done.

Nonetheless, with commit 3e992d8a the requested format changes
firstly, because there's no video sink yet, so ANY caps are
negotiated; but later, when there's a video sink and a caps
renegotiation, the GL_TEXTURE_UPLOAD is negotiated though the color
format conversion still ongoing. It is required to reset that
conversion.

This patch force default color format when GL_TEXTURE_UPLOAD is
selected as preferred, thus avoiding the color conversion.

Fixes: #157
2019-05-02 16:47:28 +02:00
Julien Isorce aa37f31d54 libs: surface: fix double free when dmabuf export fails
Happens if vaAcquireBufferHandle fails.
2019-05-01 17:40:32 +00:00
He Junyan a3ce4446c1 libs: h264encoder: fix a typo of GstVaapiEncoderH264PredictionType 2019-04-29 20:10:39 +08:00
Tim-Philipp Müller 0e83a2ae57 Back to development 2019-04-19 11:00:07 +01:00
Tim-Philipp Müller 2c3480796a Release 1.16.0 2019-04-19 00:38:13 +01:00