Commit graph

2807 commits

Author SHA1 Message Date
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
bd0209228b vaapivideobufferpool: remove allocation_vinfo private attribute
There is no need to keep this attribute internally since it is
already managed by the allocator.

https://bugzilla.gnome.org/show_bug.cgi?id=783599
2017-06-12 18:41:14 +02:00
Víctor Manuel Jáquez Leal
60158c3d6b vaapivideobufferpool: refactor set_config()
Refactor the set_config() virtual method considering a cleaner
approach to allocator instanciation, if it it not set or if it is
not valid for the pool.

https://bugzilla.gnome.org/show_bug.cgi?id=783599
2017-06-12 18:41:14 +02:00
Víctor Manuel Jáquez Leal
7a20692364 plugins: distinguish allocation and negotiation caps
The vaapi video decoders might have different allocation caps from
the negotiation caps, thus the GstVideoMeta shall use the negotiation
caps, not the allocation caps.

This was done before reusing gst_allocator_get_vaapi_video_info(),
storing there the negotiation caps if they differ from the allocation
ones, but this strategy felt short when the allocator had to be reset
in the vaapi buffer pool, since we need both.

This patch adds gst_allocator_set_vaapi_negotiated_video_info() and
gst_allocator_get_vaapi_negotiated_video_info() to store the
negotiated video info in the allocator, and distinguish it from
the allocation video info.

https://bugzilla.gnome.org/show_bug.cgi?id=783599
2017-06-12 18:41:14 +02:00
Víctor Manuel Jáquez Leal
36cf510ce8 vaapivideomemory: rename qdata quarks and ids
Also the parameter names were renamed to reflect their origin
and purpose.

https://bugzilla.gnome.org/show_bug.cgi?id=783599
2017-06-09 17:10:35 +02:00
Víctor Manuel Jáquez Leal
45faeb25e8 vaapivideobufferpool: rename local variables
Renamed local video info structure names in set_config() vitual
method. The purpose of their renaming is to clarify the origin
of those structures, whether come from passed caps parameter
(new_allocation_vinfo) or from the configured allocator
(allocator_vinfo).

https://bugzilla.gnome.org/show_bug.cgi?id=783599
2017-06-09 17:10:34 +02:00
Víctor Manuel Jáquez Leal
dce7a6f46b vaapivideobufferpool: rename video info structures
Renamed private GstVideoInfo structure video_info to allocation_vinfo
and alloc_info to negotiated_vinfo.

The purpose of these renaming is to clarify the origin and purpose of
these private variables:

video_info (now allocation_vinfo) comes from the bufferpool
configuration. It describes the physical video resolution to be
allocated by the allocator, which may be different from the
negotiated one.

alloc_info (now vmeta_vinfo) comes from the negotiated caps in
the pipeline. It represents how the frame is going to be mapped
using the video meta.

In Intel's VA-API backend, the allocation_vinfo resolution is
bigger than the negotiated_info.

https://bugzilla.gnome.org/show_bug.cgi?id=783599
2017-06-09 17:10:34 +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
Víctor Manuel Jáquez Leal
f133c3d67e tests: elements: vaapisink: handle nav events
The test app can now handle navigation events to rotate the
display.
2017-05-12 18:46:50 +02:00
Víctor Manuel Jáquez Leal
b02a25cd7f tests: elements: clean up vaapisink test
- Use gst_element_send_event() instead of gst_pad_push_event()
- don't zero App structure
- check for pipeline parsing error
- only get vaapisink for property set
2017-05-12 18:38:58 +02:00
Hyunjun Ko
5ab5113f6f vaapisink: keep handle_events flag except that if user want to set
When state of vaapisink is changed from PLAYING to NULL, the handle_events
flag is set to FALSE, and never recovered, and then event thread is never
going to run.

So we should allow to set the flag only when users try it.

https://bugzilla.gnome.org/show_bug.cgi?id=782543
2017-05-12 16:23:49 +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
Víctor Manuel Jáquez Leal
b3c374e22f plugins: remove par from caps negotiation
https://bugzilla.gnome.org/show_bug.cgi?id=781759
2017-05-12 13:47:57 +02:00
Hyunjun Ko
eb17b711b6 tests: elements: add an example for ROI
This implements a pipleint to recognize difference between ROI and non-ROI.
See comments in this code in detail.

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
8f1b88dac0 vaapiencode: handle custom event GstVaapiEncoderRegionOfInterest
Handles new custom event GstVaapiEncoderRegionOfInterest
to enable/disable a ROI region.

Writes a way to use new event to document.

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
c21345c478 tests: simple-encoder: add an option to set ROI
$ simple-encoder -r inputfile.y4m

And you'll got an output file in H264 with two regions of interest.

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
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
Víctor Manuel Jáquez Leal
3ec7996d75 libs: encoder: fix a comment 2017-05-12 11:12:56 +02:00
Víctor Manuel Jáquez Leal
4269adf791 libs: encoder: guard quality level configuration
The quality level appeared in VA-API 0.36. So let's guard its
usage.
2017-05-11 12:23:28 +02:00
Sreerenj Balachandran
4f343f82e3 encoders: add quality level tuning
This patch adds the handling of VAEncMiscParameterTypeQualityLevel,
in gstreamer-vaapi encoders:

  The encoding quality could be set through this structure, if the
  implementation supports multiple quality levels. The quality level set
  through this structure is persistent over the entire coded sequence, or
  until a new structure is being sent. The quality level range can be queried
  through the VAConfigAttribEncQualityRange attribute. A lower value means
  higher quality, and a value of 1 represents the highest quality. The quality
  level setting is used as a trade-off between quality and speed/power
  consumption, with higher quality corresponds to lower speed and higher power
  consumption.

The quality level is set by the element's parameter "quality-level" with a
hard-coded range of 1 to 8.

Later, when the encoder is configured in run time, just before start
processing, the quality level is scaled to the codec range. If
VAConfigAttribEncQualityRange is not available in the used VA backend, then
the quality level is set to zero, which means "disabled".

All the available codecs now process this parameter if it is available.

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

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2017-05-11 11:51:56 +02:00
Sebastian Dröge
10eb6efb30 Back to development 2017-05-04 18:59:31 +03:00
Sebastian Dröge
14ed473dbd Release 1.12.0 2017-05-04 15:46:03 +03:00
Víctor Manuel Jáquez Leal
c45d448a15 Revert "vaapidecodebin: fix element's classification"
This reverts commit 8cbe03599a.
2017-05-04 11:49:33 +02:00
Scott D Phillips
33888bf534 build: Require libva < 0.99.0
libva >= 0.99.0 is not currently supported by gstreamer-vaapi, so
fail to configure instead of failing late in the build.

This libva is bundled in msdk[1] and it is ahead in time with
respect the official and open source libva[2]. GStreamer-VAAPI
only supports the latter for now.

1. https://software.intel.com/en-us/media-sdk/download
2. https://github.com/01org/libva/

https://bugzilla.gnome.org/show_bug.cgi?id=781866
2017-05-02 17:03:30 +02:00
Victor Toso
8cbe03599a vaapidecodebin: fix element's classification
This bin should have similar classification as decodebin which is
"Generic/Bin/Decoder" otherwise it will appear wrongly as video
decoder.

Signed-off-by: Victor Toso <victortoso@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=782063
2017-05-02 16:14:49 +02:00