Commit graph

1681 commits

Author SHA1 Message Date
Wangfei
b9a6dcd7f2 libs: h265dec: remove limitation of get iq matrix
According hevc spec, scaling_list_data is not related
to chroma_format_idc.
2019-08-16 11:44:00 +08:00
He Junyan
e96a435756 libs: videopool: fix undocumented behavior and counting
gst_vaapi_video_pool_reserve_unlocked() hit an undocumented behavoir
because it locks twice the same mutex.

Also, n had different meanings in the current code: as an increase
value and as a new total of allocated surfaces.

This patche removes the undocumented behavoir (usually a deadlock) and
fixes the meaning of n as the new total of allocated surfaces.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2019-08-15 16:08:24 +00:00
He Junyan
5939bf4d81 libs: utils: Add missing entries for string_of_VAEntrypoint. 2019-08-15 17:33:13 +02:00
He Junyan
0afc813123 libs: encoder: Consider vp9 profiles based on input format.
Only support GST_VAAPI_PROFILE_VP9_0 and GST_VAAPI_PROFILE_VP9_2 now.

Fix: #184
2019-08-15 14:54:29 +00:00
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
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
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
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
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
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
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
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
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
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
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
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
Víctor Manuel Jáquez Leal
029bb3e504 libs: encoder: h264,h265: guard VA version for max_qp property
This patch fixes a regression from commit 5b1fe9c6.

max_qp, in rate control configuration, appeared in libva release
2.1 (API 1.1), thus it is required to guard the VA API version.

Fixes: #150
2019-04-15 19:38:01 +02:00
He Junyan
c048594370 libs: Add RGB565 image format support. 2019-04-15 15:24:10 +00:00
He Junyan
3c86fd12cb libs: utils: avoid macro evaluation when stringify
string_of_va_chroma_format() gets a wrong string format description.
For example, the YUV420_10BPP get a string of 0x00000100 as output.

It's because VA_RT_FORMAT_xxx values are macro definitions. And
STRINGIFY(VA_RT_FORMAT_xxx) will expand to its real value
0x00000XXX.

To avoid the macro evaluation, it is changed to show only the color
format without VA_RT_FORMAT_ prefix.
2019-04-15 15:36:28 +02:00
Víctor Manuel Jáquez Leal
7c0ec687cd libs: utils: use glib's macros
Don't reinvent the wheel.
2019-04-15 15:36:28 +02:00
U. Artie Eoff
39e2fe11ed libs: encoder: h265: fill tier in va seq param buf
Now that tier is calculated in commit 58e74f9440 (!68),
ensure we fill in the general_tier_flag in the
VAEncSequenceParameterBufferHEVC.
2019-04-11 08:07:27 +00:00
He Junyan
58e74f9440 libs: encoder: h265: Recognize the correct level and tier.
The current manner can not recognize the correct level and always
set the tier to main. Need to add frame rate check to recognize
levels such as 4.1, 6.2, etc. We also add a logic to check main
and high tier based on bitrate.

Fixes: #145
2019-04-10 15:28:46 +00:00
He Junyan
5b1fe9c68a libs: encoder: h264,h265: Set max_qp if min_qp is non-zero.
media-driver currently fails to set a correct value of max_qp when
min_qp is different to zero, in CBR and VBR mode, generating full
quality frames, thus unexpected huge output.

This patch sets max_qp to an arbitrary value to avoid this output
temporary.

Fixes: #144
2019-04-10 14:59:23 +02:00
Víctor Manuel Jáquez Leal
d4bc0cb6da libs: encoder: h264,h265: initial and minimal QP can be zero
Currently the minimal value for either min_qp and init_qp are 1,
but VA documentation specifiy that zero is also valid and means
to ignore the quantiser.

The default value is not changed though to avoid behaivor changes
to users.
2019-04-09 13:14:18 +02:00
He Junyan
539c39fbe1 libs: encoder: h264_fei: Use gst_param_spec_array for view-ids
GValueArray is deprecated. Use GstValueArray instead.
2019-04-01 13:08:27 +08:00
Víctor Manuel Jáquez Leal
7dc77ebf60 libs: encoder: h264: simplify the view-ids setting 2019-03-29 18:29:51 +01:00
He Junyan
6404bd399d libs: encoder: h264: Use gst_param_spec_array for view-ids
GValueArray is deprecated. Use GstValueArray instead.

gst_param_spec_array can be deserialized from command line using:

vaapih264enc view-ids="<(uint)40,(uint)100>" num-views=2

While the g_param_spec_value_array() can not, and always get
error: "gst_value_deserialize_g_value_array: unimplemented"

Also fixed an out-of-range bug.
2019-03-29 18:18:03 +01:00
He Junyan
6669a7fc57 libs: Change the parameter setting order when encode picture.
The order in gst_vaapi_enc_picture_encode when encoding one
picture is not very correct. The misc parameters are set before
the picture parameters. Some of the misc parameters such as
ROI may change the current picture parameters. But the later
setting of picture parameter will re-init all picture related
parameters and clear the previous setting. The right order
should be picture parameter first and then misc parameters.

Signed-off-by: He Junyan <junyan.he@hotmail.com>
2019-03-29 13:33:41 +08:00
Wangfei
871aecb0d4 libs: decoder: jpeg: support dynamic resolution change decode.
Add size_changed flag to watch out resolution. if change, reset
jpeg decoder's context.
2019-03-28 10:29:57 +00:00