Commit graph

1433 commits

Author SHA1 Message Date
Tomas Rataj
c181308904 libs: display: when appending formats change pointers to indexes
Thus, it fixes an invalid read when YV12 or I420 are not supported by
the driver.

https://bugzilla.gnome.org/show_bug.cgi?id=785085
2017-08-01 16:23:22 +02:00
Sreerenj Balachandran
aa3543929b libs: encoder: h264: Add uncompliant mode reducing coded buffer size
Added a new property "compliance-mode", which default is the normal
strict compliant mode.

The second mode, "restrict-buf-alloc", is to limit the coded buffer
allocation size to improve performance in some specific Intel
platforms (there is asignificant performance improvement in parallel
encodings). Under this new mode, we use the MinCR field in A.3.1 for
pre-calculating the coded-buffer size.

https://bugzilla.gnome.org/show_bug.cgi?id=784590
2017-08-01 14:37:44 +02:00
Sreerenj Balachandran
f775bbfe07 libs: utils_h264: Extend LevelLimit table with MinCR field
Add MinCR(Minimum Compression Ratio) field to GstVaapiH264LevelLimits
based on Annex A.3

https://bugzilla.gnome.org/show_bug.cgi?id=784590
2017-08-01 14:32:30 +02:00
Víctor Manuel Jáquez Leal
777bba473e libs: utils: libva 1.0 changed the logging
The logging mechanism in libva has changed it's functions
signatures. This patch updates that for libva versions >= 1.0

https://bugzilla.gnome.org/show_bug.cgi?id=784398
2017-07-31 18:17:06 +02:00
Víctor Manuel Jáquez Leal
e0e0a47476 libs: decoder: h264: libva 1.0 deprecated baseline
libva 1.0 deprecated H.264 baseline profile and FMO support
(commit b4f332b3).

https://bugzilla.gnome.org/show_bug.cgi?id=784398
2017-07-31 18:17:06 +02:00
Víctor Manuel Jáquez Leal
8a7354380c build: meson: remove gstvaapidisplaycache.c
This is a missing bit of commit ec3e10f6
2017-07-26 20:32:09 +02:00
Hyunjun Ko
d78e094fd4 libs: display: x11: add gst_vaapi_display_x11_new_with_va_display()
Implements new API function so that users could create GstVaapiDisplay
with their own VADisplay within a native display as backend.

https://bugzilla.gnome.org/show_bug.cgi?id=766704
2017-07-18 18:50:39 +02:00
Hyunjun Ko
356212214b libs: display: pass display info when foreign display
When creating a GstVaapiDisplay using a foreign VADisplay, and render
with that display, it also requires native display of the backend.

https://bugzilla.gnome.org/show_bug.cgi?id=766704
2017-07-18 18:43:06 +02:00
Víctor Manuel Jáquez Leal
ec3e10f666 libs: display: remove cache
Remove a bunch of code that handles the VADisplay cache, since the
context sharing should be doing this correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=747946
2017-07-18 18:20:21 +02:00
Víctor Manuel Jáquez Leal
a9c13a0934 libs: encoder: vp9: array terminated in zeros
There is a crash when setting ref-pic-mode since the #GEnumValue
array is not terminated with a structured with all memvers being
zero.

https://bugzilla.gnome.org/show_bug.cgi?id=785032
2017-07-17 18:59:13 +02:00
Matt Staples
66d26da39f libs: decoder: h264: push frames as soon as possible
Push frames downstream as soon as possible instead of waiting until
they are ejected from the DPB.

This patch makes the decoder not comply with the H.264 specification,
but it is required for some video cameras.

https://bugzilla.gnome.org/show_bug.cgi?id=762509

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2017-07-10 19:30:46 +02:00
Víctor Manuel Jáquez Leal
28d1d048a6 libs: decoder: h264: add getter/setter for low latency mode
https://bugzilla.gnome.org/show_bug.cgi?id=783588
2017-07-07 19:32:11 +02:00
Hyunjun Ko
6ebf7b10ae libs: encoder: h264: submit sps in case of IDR picture
If the picture is IDR, also submit a SPS header.

This means when frame number reaches to keyframe-period or an force
key unit event arrives, we insert SPS/PPS again.

https://bugzilla.gnome.org/show_bug.cgi?id=776712
2017-07-04 14:25:39 +02:00
Hyunjun Ko
465d5868d9 libs: encoder: h264: set the frame as IDR if forced key unit
GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME() is a flag usually used to manage
the `frame-lost` event in the case of streaming, such as RTP.

In case of this event, it is needed to start new GOP rather than just
produce an I-frame.

https://bugzilla.gnome.org/show_bug.cgi?id=776712
2017-07-04 14:25:39 +02:00
Sreerenj Balachandran
02a6e9a273 libs: encoder: h264: insert AU delimiter
Insert an AUD as the first NAL of each encoded frame.

Some applications require Access Unit Delimiter for decoding the
stream.

The AU delimeter insertion is done only when the aud parameter is
TRUE (by default is disabled). The reason of this it is because this
header is only available from Intel Gen9 and the VA intel driver
should be 1.8 or superior. Otherwise, the output will be corrupted.

https://bugzilla.gnome.org/show_bug.cgi?id=776712

Signed-off-by: Victor Jaquez <vjaquez@igalia.com>
2017-07-04 14:22:52 +02:00
Hyunjun Ko
9b73b31c7a libs: encoder: h264: initialize all elements of view_ids
Currently when num_views is changed by multiview-mode on sink caps, it produces
wrong MVC encoded stream since the array view_ids is not set properly according
to changed num_views.

So this patch initializes all of the array sequentially to handle this case.
Side effect is not going to happen by this patch since this array is being
handled by num_views.

https://bugzilla.gnome.org/show_bug.cgi?id=784321
2017-07-04 13:27:56 +02:00
Hyunjun Ko
5b38e7fbe2 Revert "encoder: h264: Use high profile by default"
This reverts commit 4aec5bdd72.

https://bugzilla.gnome.org/show_bug.cgi?id=757941
2017-07-03 18:48:07 +02:00
Hyunjun Ko
ca84fd211a libs: encoder: h264: set profile via capsfilter
Until now, the encoder ignored the profile in src caps and chose one
according with the given parameters. But the encoder must honor the
profile specifed in src caps.

This patch do that, and if the encoder needs to choose the profile,
it will do it by following these rules:

1\ If given parameters are not compatible with given profile, the
   encoder will bail out with an error.
2\ The encoder will choose the higher profile indicated in the
   src caps.

https://bugzilla.gnome.org/show_bug.cgi?id=757941
2017-07-03 18:38:16 +02:00
Hyunjun Ko
9397cd7d4d libs: decoder: h264: initialize active_sps/pps in reset
Since commits in https://bugzilla.gnome.org/show_bug.cgi?id=781142 landed,
they introduced regression in seek.

Formerly, once seek is done, decoder drops P-frames until I-frame arrives.
But since the commits landed, it doesn't drop P-frame and does try to
decode it continuously because active_sps is still alive. See ensure_sps function.
But there are prev_frames and prev_ref_frames reset already, then it
causes assertion.

So it's necessary to reset active_sps/pps also in reset method.

https://bugzilla.gnome.org/show_bug.cgi?id=783726
2017-06-15 13:40:27 +02:00
Víctor Manuel Jáquez Leal
3ed2023c2c libs: encoder: fix compilation with old versions of libva
There are some symbols that are not used when compiling with old
version of libva and those generates a compilation error.

Original-patch-by: Matt Staples <staples255@gmail.com>
2017-06-15 13:24:56 +02:00
Sreerenj Balachandran
595f8b7d4b libs: encoder: Fix the quality level clamping
Change the hard-coded range of quality-level from {1-8} to {1-7},
since it is the range Intel Open source driver supports.
Also perform the range clamping only if the user provided
quality-level is greater than the max-range suppored by the driver,
because there could be non-intel drivers giving lower value than
the hard-coded max value 7.

https://bugzilla.gnome.org/show_bug.cgi?id=783567
2017-06-13 16:51:52 +02:00
Víctor Manuel Jáquez Leal
eee8a78173 libs: encoder: log out the name of the profile
Instead of printing a number, it is more readable to log out, in
case of error, the name of the failing profile.
2017-06-13 13:51:01 +02:00
Hyunjun Ko
3dce250236 libs: encoder: h264: changes raw number of profile to macro name of its
Changes raw number of profile to macro name of its to improve readability.

https://bugzilla.gnome.org/show_bug.cgi?id=757941
2017-06-13 13:39:19 +02:00
Víctor Manuel Jáquez Leal
94b41c8d38 libs: encoder: set framerate if bigger than 0/1
Just set the framerate parameter if the framerate numerator and
denominator are bigger than zero.

Otherwise, in Intel Gen6 driver, a warning is raised disabling the
bitrate control.

Original-patch-by: Hyunjun Ko <zzoon@igalia.com>

https://bugzilla.gnome.org/show_bug.cgi?id=783532
2017-06-08 13:21:42 +02:00
Víctor Manuel Jáquez Leal
f8afb1eea4 libs: encoder: bitrate target percentage calculation
If the rate control is set to Constant Bit Rate (CBR) the target
percentage is 100%, otherwise is 70%
2017-06-07 16:04:38 +02:00
Víctor Manuel Jáquez Leal
4b5ecca29c libs: encoder: h264,h265,mpeg2,vp8,vp9: refactor ratecontrol param
Centralize the common configuration for the Rate Control parameter,
thus can be overloaded per each specific encoder.
2017-06-07 16:04:38 +02:00
Víctor Manuel Jáquez Leal
035efded75 libs: encoder: h264,h265,mpeg2,vp8,vp9: refactor framerate param
Since the framerate VA parameter is calculated equally among all the
encoders, it is better to handle it in the base encoder class.
2017-06-07 12:43:55 +02:00
Sreerenj Balachandran
4bf8ef724b libs: encoder: vp9: Adds CBR and VBR Encoding support
https://bugzilla.gnome.org/show_bug.cgi?id=766832

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2017-06-07 12:08:10 +02:00
Hyunjun Ko
5d345b08fd libs: encoder: vp8: Adds VBR Encoding support
https://bugzilla.gnome.org/show_bug.cgi?id=778732
2017-06-07 11:24:38 +02:00
Hyunjun Ko
f68d0452be libs: encoder: h265: Adds VBR Encoding support
Enables Variable BitRate mode, which does set FrameRate and RateControl
parameters.

https://bugzilla.gnome.org/show_bug.cgi?id=778732
2017-06-07 11:24:38 +02:00
Hyunjun Ko
cbd912b89b libs: encoder: Describes more detail about the bitrate property
https://bugzilla.gnome.org/show_bug.cgi?id=778732
2017-06-07 11:24:38 +02:00
Víctor Manuel Jáquez Leal
81886682cd libs: encoder: h265: add rate control parameter
https://bugzilla.gnome.org/show_bug.cgi?id=783449
2017-06-07 11:24:38 +02:00
Víctor Manuel Jáquez Leal
d733714ef8 libs: encoder: h264,h265,mpeg2: add framerate parameter
https://bugzilla.gnome.org/show_bug.cgi?id=783449
2017-06-07 11:24:38 +02:00
Víctor Manuel Jáquez Leal
846c276e26 libs: encoder: vp8,h264,h265,mpeg2: set misc param once
Instead of recalculating the miscellaneous buffer parameters for
every buffer, it is only done once, when the encoder is configured.
And for every buffer, the same structures are just copied.

https://bugzilla.gnome.org/show_bug.cgi?id=783449
2017-06-07 11:24:38 +02:00
Víctor Manuel Jáquez Leal
acf106e1a7 libs: encoder: vp8,h264,h265,mpeg2: refactor misc parameters
This is patch pretends to decouple the assignation of the values
in the parameter structures and the VA buffer's parameters setting.

It may lead to some issues since HRD, framerate or controlrate may
not be handled by the specific encoder, but they are set in
the VA buffer's parameters.

I leave as it because this patch is just a transitional patch.

https://bugzilla.gnome.org/show_bug.cgi?id=783449
2017-06-07 11:24:38 +02:00
Víctor Manuel Jáquez Leal
daff4e9fbd libs: encoder: vp8: fix frame rate calculation
According to the VA documentation:

     The framerate is specified as a number of frames per second,
     as a fraction.  The denominator of the fraction is given in
     the top half (the high two bytes) of the framerate field, and
     the numerator is given in the bottom half (the low two bytes).

     For example, if framerate is set to (100 << 16 | 750), this is
     750 / 100, hence 7.5fps.

     If the denominator is zero (the high two bytes are both zero)
     then it takes the value one instead, so the framerate is just
     the integer in the low 2 bytes.

This patch fixes the the framerate calculation in vp8 encoder
according to this.

https://bugzilla.gnome.org/show_bug.cgi?id=783449
2017-06-07 11:24:38 +02:00
Víctor Manuel Jáquez Leal
baac8dc8a3 libs: encoder: vp8: refactor FrameRate parameter
Move frame-rate parameter from ensure_misc_params() to
ensure_contro_rate_param() since it only has meaning when the
control rate is either VBR or CBR.

https://bugzilla.gnome.org/show_bug.cgi?id=783449
2017-06-07 11:24:38 +02:00
Víctor Manuel Jáquez Leal
fc5106bd31 libs: encoder: h264,h265,mpeg2,vp8: refactor HDR
Move the Hypothetical Reference Decoder (HRD) parameter, from
ensure_misc_params() to ensure_control_rate_params(), since it
only shall be defined when the control rate is either VBR or CBR.

https://bugzilla.gnome.org/show_bug.cgi?id=783449
2017-06-07 11:24:38 +02:00
Víctor Manuel Jáquez Leal
b538a86d4e libs: encoder: h264,vp8,mpeg2: refactor control rate
Instead of filling the control rate param in ensure_misc_params(),
this patch refactor it out, as a first step to merge the same code
for all the encoders.

https://bugzilla.gnome.org/show_bug.cgi?id=783449
2017-06-07 11:24:38 +02:00
Víctor Manuel Jáquez Leal
5c05a8b436 libs: encoder: h264, h265, mpeg2: remove assert
Remove spurious asserts for misc parameters. If they cannot be
allocated, FALSE is already returned.
2017-06-07 11:24:38 +02:00
Víctor Manuel Jáquez Leal
37b81a7b69 libs: encoder: use VA quality level structure
Instead of using a proxy to story the buffer quality level, the
encoder now uses the native VA structure, which is copied to the
dynamically allocated VAEncMiscParameterBuffer.

This approach is computationally less expensive.
2017-06-07 11:24:08 +02:00
Víctor Manuel Jáquez Leal
0e31137dec libs: standardize the FIXME comment
This is a trivial patch that makes homogeneous the FIXME tag in
comments.

For more info about these comment style:
http://wiki.c2.com/?FixmeComment
2017-06-01 16:05:50 +02:00
Hyunjun Ko
e66aaf166c libs: encoder: vp8: set quality level regardless of rate control mode
https://bugzilla.gnome.org/show_bug.cgi?id=782957
2017-05-23 11:55:03 +02:00
Víctor Manuel Jáquez Leal
ed3360bf3b libs: encoder: check for maximum number of slices
Right now, H264 and HEVC can set as a property the number of slices to
process. But each driver can set a maximum number of slices, depending
on the supported profile & entry point.

This patch verifies the current num_slices to process against the maximum
permitted by the driver and the media size.

https://bugzilla.gnome.org/show_bug.cgi?id=780955
2017-05-19 16:33:27 +02:00
Víctor Manuel Jáquez Leal
58f6e78017 libs: utils: mark functions as internals
The functions in this header are internal to the library.
2017-05-15 18:36:21 +02:00
Víctor Manuel Jáquez Leal
3c31e8292a libs: context: add missing documentation
Document the region-of-interest configuration variables.
2017-05-15 18:35:40 +02:00
Hyunjun Ko
f09f21def7 libs: window: x11: fix src rect info when using vpp
Since we started using VPP in VaapiWindowX11, we need to care about
the case that src rect and window's size are different.

So, once VPP has converted to other format, we should honor the
size of the VPP's surface as source rect. Otherwise, it is cropped
according the previous size of the source rect.

https://bugzilla.gnome.org/show_bug.cgi?id=782542
2017-05-12 16:23:38 +02:00
Hyunjun Ko
f3302a0a79 libs: encoder: h264: set ROI params during encoding
Set ROI params during encoding each frame, which are set via
gst_vaapi_encoder_add_roi ()

https://bugzilla.gnome.org/show_bug.cgi?id=768248

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2017-05-12 11:12:56 +02:00
Hyunjun Ko
7a6f690340 libs: encoder: add api gst_vaapi_encoder_add/del_roi
Implements and exposes new api gst_vaapi_encoder_add/del_roi to set ROI regions.

https://bugzilla.gnome.org/show_bug.cgi?id=768248
2017-05-12 11:12:56 +02:00
Hyunjun Ko
b41d72b7c5 libs: encoder/context: query region of interest support
Queries if the driver supports "Region of Interest" (ROI) during the config
creation.

  This attribute conveys whether the driver supports region-of-interest (ROI)
  encoding, based on user provided ROI rectangles.  The attribute value is
  partitioned into fields as defined in the VAConfigAttribValEncROI union.

  If ROI encoding is supported, the ROI information is passed to the driver
  using VAEncMiscParameterTypeROI.

https://bugzilla.gnome.org/show_bug.cgi?id=768248

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2017-05-12 11:12:56 +02:00