Commit graph

853 commits

Author SHA1 Message Date
Gwenole Beauchesne
1dd89800b0 decoder: h264: fix decoding of BA3_SVA_C.264.
Conformance test Base_Ext_Main_profiles/BA3_SVA_C.264 complys with
extended profile specifications. However, the SPS header has the
constraint_set1_flag syntax element set to 1. This means that, if
a Main profile compliant decoder is available, then it should be
able to decode this stream.

This changes makes it possible to fall-back from Extended profile
to Main profile if constraint_set1_flag is set to 1.

https://bugzilla.gnome.org/show_bug.cgi?id=720190
2013-12-10 15:22:40 +01:00
Gwenole Beauchesne
416ab33e34 utils: h264: add more profiles.
Add extended profile (A.2.3), high 4:2:2 profile (A.2.6), high 4:2:2
profiles (A.2.7, A.2.10), scalable profiles (G.10.1.1, G.10.1.2) and
multiview profiles (H.10.1.1, H.10.1.2).

Document "Constrained Baseline" and "High 10" profiles.
2013-12-10 15:22:40 +01:00
Wind Yuan
009e4522bf decoder: h264: add support for constrained baseline profile.
Recognize streams marked as conforming to the "Constrained Baseline
Profile". If VA driver supports that as is, fine. Otherwise, fallback
to baseline, main or high profile.

Constrained Baseline Profile conveys coding tools that are common
to baseline profile and main profile.

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

[Added fallbacks to main and high profiles]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-12-09 13:11:56 +01:00
Gwenole Beauchesne
bd5ae1b220 decoder: h264: fix decoding of scaling lists.
The GStreamer codecparser layer now parses the scaling lists in zigzag
scan order, as expected, so that to match the original bitstream layout
and specification. However, further convert the scaling lists into
raster scan order to fit the existing practice in most VA drivers.

https://bugzilla.gnome.org/show_bug.cgi?id=706406
2013-12-09 12:46:45 +01:00
Gwenole Beauchesne
e2f137f149 utils: add helpers for H.264 levels.
- gst_vaapi_utils_h264_get_level():
  Returns GstVaapiLevelH264 from H.264 level_idc value
- gst_vaapi_utils_h264_get_level_idc():
  Returns H.264 level_idc value from GstVaapiLevelH264
- gst_vaapi_utils_h264_get_level_limits():
  Returns level limits as specified in Table A-1 of the H.264 standard
- gst_vaapi_utils_h264_get_level_limits_table():
  Returns the Table A-1 specification
2013-12-06 19:26:15 +01:00
Gwenole Beauchesne
7f1f879e28 utils: add new H.264 profiles.
Add "Constrained Baseline Profile" and "High 10 Profile" definitions
and helper functiions.
2013-12-06 19:25:22 +01:00
Gwenole Beauchesne
47dee4db96 utils: add new H.264 helper functions.
* Profiles:
- gst_vaapi_utils_h264_get_profile():
  Returns GstVaapiProfile from H.264 profile_idc value
- gst_vaapi_utils_h264_get_profile_idc():
  Returns H.264 profile_idc value from GstVaapiProfile

* Chroma formats:
- gst_vaapi_utils_h264_get_chroma_type():
  Returns GstVaapiChromaType from H.264 chroma_format_idc value
- gst_vaapi_utils_h264_get_chroma_format_idc():
  Returns H.264 chroma_format_idc value from GstVaapiChromaType
2013-12-06 19:25:21 +01:00
Matthieu Bouron
44ead80f5f Fix missing files in distribution tarball.
https://bugzilla.gnome.org/show_bug.cgi?id=719776

[Additional fixes and clean-ups]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-12-06 14:16:28 +01:00
Gwenole Beauchesne
2940a74ea4 encoder: fix computation of max coded buffer size (again).
The previous fix was only valid to express the maximum size of the
macroblock layer, i.e. without any headers. Now, also account for
the slice headers and top picture header, but also any other header
we might stuff into the VA coded buffer, e.g. sequence headers.
2013-12-05 18:13:54 +01:00
Gwenole Beauchesne
b864d1f71a encoder: fix computation of max coded buffer size.
Fix coded buffer size for each codec. A generic issue was that the
number of macroblocks was incorrectly computed. The second issue was
specific to MPEG-2 were the max number of bits per macroblock, and
as defined by the standard, was incorrectly mapped to the (lower)
H.264 requirement. i.e. 4608 bits vs. 3200 bits limit.
2013-12-04 19:14:38 +01:00
Gwenole Beauchesne
fd9c855f14 encoder: simplify VA context initialization process.
Change get_context_info() into a set_context_info() function that
initializes common defaults into the base class, thus allowing the
subclasses to specialize the context info further on.

The set_context_info() hook is also the location where additional
context specific data could be initialized. At this point, we are
guaranteed to have valid video resolution size and framerate. i.e.
gst_vaapi_encoder_set_format() was called beforehand.
2013-12-04 19:14:38 +01:00
Wind Yuan
fdddf83c71 encoder: fix mpeg2 compilation error.
https://bugzilla.gnome.org/show_bug.cgi?id=719746

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-12-04 19:14:38 +01:00
Gwenole Beauchesne
2f5e5f0784 encoder: clean-ups and document public APIs.
Clean public APIs up so that to better align with the decoder APIs.
Most importantly, gst_vaapi_encoder_get_buffer() is changed to only
return the VA coded buffer proxy. Also provide useful documentation
for the public APIs.
2013-12-04 19:14:38 +01:00
Gwenole Beauchesne
26726b18fc encoder: avoid extra allocations of GstVaapiEncoderSyncPic objects.
Kill GstVaapiEncoderSyncPic objects that are internally and temporarily
allocated. Rather, associate a GstVaapiEncPicture to a coded buffer
through GstVaapiCodedBufferProxy user-data facility.

Besides, use a GAsyncQueue to maintain a thread-safe queue object of
coded buffers.

Partial fix for the following report:
https://bugzilla.gnome.org/show_bug.cgi?id=719530
2013-12-04 19:14:38 +01:00
Gwenole Beauchesne
038149b69b encoder: refactor status codes.
Drop obsolete or unused status codes. Align some status codes with the
decoder counterparts.
2013-12-04 19:14:38 +01:00
Gwenole Beauchesne
8ecc35ecf2 encoder: fix subclassing process.
Fix the GstVaapiEncoderClass parent class type. Make sure to validate
subclass hooks as early as possible, i.e. in gst_vaapi_encoder_init(),
thus avoiding useless run-time checks. Also simplify the subclass
initialization process to be less error prone.
2013-12-04 19:14:38 +01:00
Gwenole Beauchesne
0fb7c60508 encoder: rework GstVaapiCodedBuffer and related proxy.
Refactor the GstVaapiCodedBuffer APIs so that to more clearly separate
public and private interfaces. Besides, the map/unmap APIs should not
be exposed as is but appropriate accessors should be provided instead.

* GstVaapiCodedBuffer: VA coded buffer abstraction
- gst_vaapi_coded_buffer_get_size(): get coded buffer size.
- gst_vaapi_coded_buffer_copy_into(): copy coded buffer into GstBuffer

* GstVaapiCodedBufferPool: pool of VA coded buffer objects
- gst_vaapi_coded_buffer_pool_new(): create a pool of coded buffers of
  the specified max size, and bound to the supplied encoder

* GstVaapiCodedBufferProxy: pool-allocated VA coded buffer object proxy
- gst_vaapi_coded_buffer_proxy_new_from_pool(): create coded buf from pool
- gst_vaapi_coded_buffer_proxy_get_buffer(): get underlying coded buffer
- gst_vaapi_coded_buffer_proxy_get_buffer_size(): get coded buffer size

Rationale: more optimized transfer functions might be provided in the
future, thus rendering the map/unmap mechanism obsolete or sub-optimal.

https://bugzilla.gnome.org/show_bug.cgi?id=719775
2013-12-04 19:14:38 +01:00
Gwenole Beauchesne
9ab6037847 plugins: use G_PARAM_STATIC_STRINGS.
This avoids a few string copies during initialization.
2013-11-28 17:35:44 +01:00
Gwenole Beauchesne
5e245ae2c2 surfaceproxy: add copy function.
Add gst_vaapi_surface_proxy_copy() function that creates a new surface
proxy with the same information from the parent proxy, except that the
user-defined destroy notify function is not copied over.

The underlying VA surface is pushed back to the video pool only when
the last reference to the parent surface proxy is released.
2013-11-28 17:32:18 +01:00
Gwenole Beauchesne
30f382fcdf vaapiencode: optimize _handle_frame() to avoid extra allocation.
Optimize gst_vaapiencode_handle_frame() to avoid extra memory allocation,
and in particular the GstVaapiEncObjUserData object. i.e. directly use
the VA surface proxy from the source buffer. This also makes the user
data attached to the GstVideoCodecFrame more consistent between both
the decoder and encoder plug-in elements.
2013-11-28 17:32:18 +01:00
Gwenole Beauchesne
bc020c05f9 vaapiencode: add initial support for GStreamer 0.10. 2013-11-27 17:23:56 +01:00
Gwenole Beauchesne
e9e988fc71 libs: add more GstBuffer compat glue for GStreamer 0.10.
Add gst_buffer_new_allocate() and gst_buffer_fill() implementations.
Fix gst_buffer_new_wrapped_full() implementation to handle the destroy
notify function.
2013-11-27 17:23:56 +01:00
Gwenole Beauchesne
f82deaf10c libs: always use built-in videoutils for GStreamer 0.10.
GStreamer 0.10.36 is the latest and ultimate version to be released
from the GStreamer 0.10 branch. i.e. no further releases are to be
made. So, we can safely enable the built-in videoutils replacement
now that they are in sync with the 0.10 branch.
2013-11-27 17:23:56 +01:00
Matthieu Bouron
76174922bc Fix build with GStreamer >= 1.3.
http://bugzilla.gnome.org/show_bug.cgi?id=715183

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-11-27 15:08:40 +01:00
XuGuangxin
d753c2226a encoder: add mpeg2 encoder.
Add initial support for MPEG-2 encoding. I/P/B frames are supported.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-11-24 16:52:05 +01:00
Wind Yuan
652245fb87 encoder: add h264 encoder.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-11-24 16:52:05 +01:00
Wind Yuan
8174a35737 Add initial infrastructure for video encoding.
Add initial API for video encoding: only basic interfaces and small
encoder objects are implemented so far.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-11-24 16:52:05 +01:00
Wind Yuan
99947d0592 libs: add generic bitstream writer.
GstBitWriter provides a bit writer that can write any number of bits
to a pre-allocated memory buffer. Helper functions are also provided
to write any number of bits from 8, 16, 32 and 64 bit variables.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-11-24 16:52:05 +01:00
Wind Yuan
02e174c8bc libs: add support for rate-control to GstVaapiContext.
Extend GstVaapiContextInfo structure to hold the desired rate control
mode for encoding purposes. For decoding purposes, this field is not
used and it is initialized to GST_VAAPI_RATECONTROL_NONE.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-11-24 16:45:35 +01:00
Wind Yuan
082fb3f1b4 libs: add rate-control attributes.
Add GstVaapiRateControl types and GType values in view to supporting
rate controls for encoding. This is meant to be used for instance in
GstVaapiContext.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-11-24 16:45:31 +01:00
Ross Burton
bc8a87d8bb build: link libgstvaapi-wayland against videoutils.
This library is using symbols that don't exist in GStreamer 0.10 so
it needs to link to built-in implementation (libgstvaapi-videoutils).

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

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-11-22 11:23:03 +01:00
Gwenole Beauchesne
922a04b734 vaapostproc: fix memory leaks.
Destroy VPP output surface pool on exit. Also avoid a possible crash
in double-free situation caused by insufficiently reference counted
array of formats returned during initialization.
2013-11-22 11:15:57 +01:00
Gwenole Beauchesne
c516311a1a legal: update copyright notice dates. 2013-11-22 06:39:20 +01:00
Gwenole Beauchesne
15519ebe3d legal: add per-file authorship information.
Credit original authors on a per-file basis as we cannot expect people
to know all country-specific rules, or bother browsing through the git
history.
2013-11-22 06:39:15 +01:00
Gwenole Beauchesne
dc48509bad decoder: don't include obsolete headers.
The <gst/vaapi/gstvaapicontext.h> header was removed from the public
set of APIs. So, don't make public headers (gstvaapidecoder.h) depend
on private files.
2013-11-21 23:17:59 +01:00
Halley Zhao
5a9e169504 filter: add helper to specify references for deinterlacing.
Add gst_vaapi_fitler_set_deinterlacing_references() API to submit the
list of surfaces used for forward or backward reference in advanced
deinterlacing mode, e.g. Motion-Adaptive, Motion-Compensated.

The list of surfaces used as deinterlacing references shall be live
until the next call to gst_vaapi_filter_process().

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-11-21 23:08:02 +01:00
Gwenole Beauchesne
06c7fde8e0 filter: fix semantics of deinterlacing flags.
Fix deinterlacing flags to make more sense. The TFF (top-field-first)
flag is meant to specify the organization of reference frames used in
advanced deinterlacing modes. Introduce the more explicit flag TOPFIELD
to specify that the top-field of the supplied input surface is to be
used for deinterlacing. Conversely, if not set, this means that the
bottom field of the supplied input surface will be used instead.
2013-11-21 23:08:02 +01:00
Gwenole Beauchesne
152ffb52d2 filter: add helpers to check for supported/active operation.
Add a couple of helper functions:
- gst_vaapi_filter_has_operation(): checks whether the VA driver
  advertises support for the supplied operation ;
- gst_vaapi_filter_use_operation(): checks whether the supplied
  operation was already enabled to its non-default value.
2013-11-21 23:08:02 +01:00
Gwenole Beauchesne
a1189301c9 libs: fix GstVaapiSurfaceProxy destroy notify call site.
The user-defined destroy notify function is meant to be called only when
the surface proxy was fully released, i.e. once it actually released the
VA surface back to the underlying pool.
2013-11-21 11:08:23 +01:00
XuGuangxin
f9ee8703cf libs: make GstVaapiVideoPool thread-safe.
https://bugzilla.gnome.org/show_bug.cgi?id=707108

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-11-21 11:08:23 +01:00
XuGuangxin
f9d0d6e272 libs: robustify decoder objects and surface proxy initialization.
Fix GstVaapiPicture, GstVaapiSlice and GstVaapiSurfaceProxy initialization
sequences to have the expected default values set beforehand in case of an
error raising up further during creation. i.e. make it possible to cleanly
destroy those partially initialized objects.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-11-21 11:08:23 +01:00
Gwenole Beauchesne
f6f24bfc55 vaapipostproc: rework plug-in element.
Rewrite the vaapipostproc plug-in element so that it derives from
GstBaseTransform, thus simplifying the caps negotiation process.
2013-10-09 18:30:06 +02:00
Gwenole Beauchesne
b242c5874b filter: fix memory leak of VPP operations.
Fix ensure_operations() to release the VPP operations array if non
NULL, prior to returning to the caller. The former function was also
renamed to a more meaningful get_operations() since the caller owns
the returned array that needs to be released.
2013-10-01 18:41:29 +02:00
Zhao Halley
e05e65e349 filter: fix first-time operation lookup.
Fix first-time operation lookup through find_operation() if the set
of supported operations was not initially determined through the
gst_vaapi_filter_get_operations() helper function.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-10-01 18:41:29 +02:00
Zhao Halley
3e4d8d27b3 filter: fix colorbalance related subtypes.
Fix intiialization of GstVaapiFilterOpData for colorbalance related
operations. In particular, fill in the va_subtype field accordingly.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-10-01 18:41:29 +02:00
Víctor Manuel Jáquez Leal
94b554e7a2 filter: fix VA-API 0.34.0 symbol guards.
VASurfaceAttrib and VAProcFilterParameterBufferType are symbols
that need to be guarded for libva 0.34 and 0.33, respectively.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-10-01 18:41:29 +02:00
Gwenole Beauchesne
c171b007ff jpeg: fix calculation of MCU count.
Fix calculation of MCU count for image sizes that are not a multiple
of 8 pixels in either dimension, but also for non-common sampling
factors like 4:2:2 in non-interleaved mode.
2013-09-23 19:17:17 +02:00
Gwenole Beauchesne
5444ab44d2 jpeg: add support for multiscan images.
Add support for images with multiple scans per frame. The Huffman table
can be updated before SOS, and thus possibly requiring multiple uploads
of Huffman tables to the VA driver. So, the latter must be able to cope
with multiple VA buffers of type 'huffman-table' and with the correct
sequential order.
2013-09-23 17:38:07 +02:00
Gwenole Beauchesne
fd51db279a jpeg: improve robustness when packets are missing.
Improve robustness when some expected packets where not received yet
or that were not correctly decoded. For example, don't try to decode
a picture if there was no valid frame headers.
2013-09-23 17:25:51 +02:00
Gwenole Beauchesne
22fef09443 jpeg: minor clean-ups.
Improve debugging and error messages. Rename a few variables to fit the
existing naming conventions. Change some fatal asserts to non-fatal
error codes.
2013-09-20 18:32:12 +02:00