Commit graph

1231 commits

Author SHA1 Message Date
Gwenole Beauchesne
c094fe3038 tests: add simple decoder application.
Add simple decoder application to show off decoding capabilities from
raw bitstreams, for debugging or performance evaluation purposes.
2013-01-17 19:03:41 +01:00
Gwenole Beauchesne
b22bade310 tests: add codec helper utils.
Add helper functions to determine the codec type from a specific file
or utility functions to convert from codec type to GstCaps or from
codec name to codec type.
2013-01-17 19:03:21 +01:00
Gwenole Beauchesne
ea3905fa14 tests: allow fullscreen mode.
Add new --fullscreen|-f option to create new windows in fullscreen mode.
2013-01-17 19:03:21 +01:00
Gwenole Beauchesne
319f87f142 h264: implement GstVaapiDecoder::flush() as a DPB flush. 2013-01-17 18:40:36 +01:00
Gwenole Beauchesne
34162f5001 h264: handle end-of-stream NALU.
Handle <end-of-stream> NAL unit to actually flush any pending picture
from the DPB.
2013-01-17 18:40:36 +01:00
Gwenole Beauchesne
236e8833d1 vaapidecode: handle EOS events.
Flush all decoded frames to downstream when EOS is received. This is
performed by implementing GstVideoDecoder::finish() hook.
2013-01-17 18:40:36 +01:00
Gwenole Beauchesne
cbcdc3bfae vaapidecode: split gvd_handle_frame() into decode/push frames.
Split GstVideoDecoder::handle_frame() implementation into two functions:
(i) one for decoding the provided GstVideoCodecFrame and (ii) another one
for purging all decoded frames and submit them downstream.
2013-01-17 18:39:22 +01:00
Gwenole Beauchesne
60acedb56e decoder: add GstVaapiDecoder::flush() hook. 2013-01-17 18:39:22 +01:00
Gwenole Beauchesne
e4e3a58bc0 decoder: fix check for end-of-stream in raw API mode.
Make sure to immediately return GST_VAAPI_DECODER_STATUS_END_OF_STREAM
if the end-of-stream was already reached at the previous iteration.
2013-01-17 18:39:22 +01:00
Gwenole Beauchesne
cc347cb41e decoder: make decode_step() return once the frame is decoded.
Make sure we always have a free surface left to use for decoding the
current frame. This means that decode_step() has to return once a frame
gets decoded. If the current adapter contains more buffers with valid
frames, they will get parsed and decoded on subsequent iterations.
2013-01-17 18:39:22 +01:00
Gwenole Beauchesne
9485b17fd7 codecparsers: update to gst-vaapi-branch commit b47983a.
8840c2d h264: zero-initialize SPS VUI parameters
2013-01-17 15:47:17 +01:00
Gwenole Beauchesne
e13bca4609 Bump version for development. 2013-01-15 09:21:36 +01:00
Gwenole Beauchesne
154fa7baf6 0.5.0. 2013-01-15 09:21:08 +01:00
Gwenole Beauchesne
059e032103 docs: expose new interfaces. 2013-01-14 12:58:41 +01:00
Gwenole Beauchesne
74b25cabb4 NEWS: updates. 2013-01-14 12:58:20 +01:00
Gwenole Beauchesne
9372f14f94 dpb: cosmetics (clean-ups). 2013-01-14 10:58:49 +01:00
Gwenole Beauchesne
e44d8ee6e3 dpb: port to GstVaapiMiniObject. 2013-01-14 10:46:50 +01:00
Gwenole Beauchesne
6f4e01258d dpb: drop GstVaapiDpb2 interface, keep only one class.
Keep only one DPB interface and rename gst_vaapi_dpb2_get_references()
to gst_vaapi_dpb_get_neighbours() so that to retrieve pictures in DPB
around the specified picture POC.
2013-01-14 10:21:53 +01:00
Sreerenj Balachandran
eafdd771ae dpb: rename GstVaapiDpbMpeg2 to GstVaapiDpb2.
Move GstVaapiDpbMpeg2 API to a more generic version that could also be
useful to other decoders that require 2 reference pictures, e.g. VC-1.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-01-14 10:11:21 +01:00
Gwenole Beauchesne
86af31e426 Bump version for pre-release. 2013-01-11 16:04:30 +01:00
Gwenole Beauchesne
eefe1eca32 NEWS: updates. 2013-01-11 15:57:09 +01:00
Holger Kaelberer
082a56599b overlay: fix build without advanced GstVideoOverlayFormatFlags.
Check for global-alpha support in GstVideoOverlayComposition API.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-01-11 15:47:46 +01:00
Gwenole Beauchesne
bfc4e6e4f6 tests: add support for global-alpha subpictures.
Add --global-alpha option to test-subpicture.
2013-01-11 15:47:45 +01:00
Gwenole Beauchesne
cbf2f27168 tests: use GstVideoOverlayComposition API for subpicture test. 2013-01-11 15:42:44 +01:00
Gwenole Beauchesne
886f6d9f11 tests: use common decoder helpers for subpicture test.
Use common decoder helpers for subpicture test, thus allowing to decode
sample images in an alternate format.
2013-01-11 15:32:17 +01:00
Gwenole Beauchesne
d9111eeaf5 tests: add decoder helpers. 2013-01-11 15:32:17 +01:00
Gwenole Beauchesne
7e1a8eabfe overlay: fix ordering of composition layers.
Make sure to maintain the association order of composition layers when
GstVideoOverlayRectangle objects are kept around (cached).
2013-01-11 15:32:17 +01:00
Holger Kaelberer
2ecb955626 overlay: fix support for global-alpha.
Fix support for global-alpha subpictures. The previous changes brought
the ability to check for GstVideoOverlayRectangle changes by comparing
the underlying pixel buffer pointers. If sequence number and pixel data
did not change, then this is an indication that only the global-alpha
value changed. Now, try to update the underlying VA subpicture global-alpha
value.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-01-11 15:29:12 +01:00
Gwenole Beauchesne
e6390d6e5f overlay: detect render-rect changes.
Don't re-upload VA subpicture if only the render rectangle changed.
Rather deassociate the subpicture and re-associate it with the new
render rectangle.
2013-01-11 15:29:12 +01:00
Gwenole Beauchesne
e876d9a581 overlay: fix check for pixels buffer change.
A GstVideoOverlayRectangle is created whenever the underlying pixels data
change. However, when global-alpha is supported, it is possible to re-use
the same GstVideoOverlayRectangle but with a change to the global-alpha
value. This process causes a change of sequence number, so we can no longer
check for that.

Still, if sequence numbers did not change, then there was no change in
global-alpha either. So, we need a way to compare the underlying GstBuffer
pointers. There is no API to retrieve the original pixels buffer from
a GstVideoOverlayRectangle. So, we use the following heuristics:

1. Use gst_video_overlay_rectangle_get_pixels_unscaled_argb() with the same
   format flags from which the GstVideoOverlayRectangle was created. This
   will work if there was no prior consumer of the GstVideoOverlayRectangle
   with alternate (non-"native") format flags.

2. In overlay_rectangle_has_changed_pixels(), we have to use the same
   gst_video_overlay_rectangle_get_pixels_unscaled_argb() function but
   with flags that match the subpicture. This is needed to cope with
   platforms that don't support global-alpha in HW, so the gst-video
   layer takes care of that and fixes this up with a possibly new
   GstBuffer, and hence pixels data (or) in-place by caching the current
   global-alpha value applied. So we have to determine the rectangle
   was previously used, based on what previous flags were used to
   retrieve the ARGB pixels buffer.
2013-01-11 15:29:12 +01:00
Gwenole Beauchesne
a14d259060 overlay: optimize cache at the GstVideoOverlayRectangle level.
We previously assumed that an overlay composition changed if the number
of overlay rectangles in there actually changed, or that the rectangle
was updated, and thus its seqnum was also updated.

Now, we can cope with cases where the GstVideoOverlayComposition grew
by one or a few more overlay rectangles, and the initial overlay rectangles
are kept as is.
2013-01-11 15:29:11 +01:00
Gwenole Beauchesne
ad6cdc0b52 overlay: simplify caching of GstVideoOverlayComposition objects.
Create the GPtrArray once in the _init() function and destroy it only
in the _finalize() function. Then use overlay_clear() to remove all
subpicture associations for intermediate updates, don't recreate the
GPtrArray.

Make GstVaapiOverlayRectangle a reference counted object. Also make
sure that overlay_rectangle_new() actually creates and associates the
VA subpicture.
2013-01-11 15:28:25 +01:00
Holger Kaelberer
2d2334afed overlay: add support for global-alpha.
Handle global-alpha from GstVideoOverlayComposition API. Likewise,
the same code path could also work for premultiplied-alpha but this
was not tested.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-01-11 14:23:08 +01:00
Holger Kaelberer
1cd4a8fc04 subpicture: add support for global-alpha.
Add the necessary helpers in GstVaapiDisplay to determine whether subpictures
with global alpha are supported or not. Also add accessors in GstVaapiSubpicture
to address this feature.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-01-11 14:23:06 +01:00
Gwenole Beauchesne
1307a5b4ef subpicture: add premultiplied-alpha and global-alpha feature flags.
Add premultiplied-alpha and global-alpha feature flags, along with converters
between VA-API and gstreamer-vaapi definitions. Another round of helpers is
also necessary for GstVideoOverlayComposition API.
2013-01-11 14:17:30 +01:00
Gwenole Beauchesne
fc1f9a64e4 display: allow image/subpicture formats with additional flags.
Introduce new GstVaapiFormatInfo to store the actual GstVaapiImageFormat
and any additional flags needed. Currently, all flags are set to zero.
2013-01-11 14:17:30 +01:00
Gwenole Beauchesne
d4a8e39656 libs: fix build of submodule wrappers.
Make sure to build codecparsers/ and videoutils/ sources against the
newly generated headers when out-of-source builds are used.
2013-01-11 14:16:16 +01:00
Gwenole Beauchesne
20a3709de3 configure: fix checks for packages installed in non-standard roots. 2013-01-11 14:16:16 +01:00
Gwenole Beauchesne
591b637cfc decoder: fix mini object implementation on 64-bit systems.
Use GPOINTER_TO_SIZE() instead of GPOINTER_TO_UINT() while manipulating
pointers. The latter is meant to be 32-bit only, not uintptr_t like size.
Only a gsize can hold all bits of a pointer.

Thanks to Ouping Zhang for spotting this error.
2013-01-10 10:14:42 +01:00
Gwenole Beauchesne
0ecb3a627b mpeg2: optimize scan for the end of the frame.
Heuristic: if the second start-code is available, check whether that
one marks the start of a new frame because e.g. this is a sequence
or picture header. This doesn't save much, since we already cache the
results.
2013-01-09 16:05:39 +01:00
Gwenole Beauchesne
3bc6078f32 mpeg2: optimize scan for start codes.
Accelerate scan for start codes by skipping up to 3 bytes per iteration.
A start code prefix is defined by the following bytes: 00 00 01. Thus,
for any group of 3 bytes (xx yy zz), we have the following possible cases:

  1. If zz != 1, this cannot be a start code, then skip 3 bytes;
  2. If yy != 0, this cannot be a start code, then skip 2 bytes;
  3. If xx != 0 or zz != 1, this cannot be a start code, then skip 1 byte;
  4. xx == 00, yy == 00, zz == 1, we have match!

This algorithm requires to peek bytes from the adapter. This increases the
amount of bytes copied to a temporary buffer, but this process is much faster
than scanning for all the bytes and using shift/masks. So, overall, this is
a win.
2013-01-09 16:05:18 +01:00
Gwenole Beauchesne
0180ef635c mpeg2: drop useless gst_adapter_peek().
Drop useless gst_adapter_peek() since the returned buffer was not used
and this could incur superfluous memcpy().
2013-01-08 16:41:44 +01:00
Gwenole Beauchesne
4a69e395cd mpeg2: cosmetics: move parse_slice() down. 2013-01-07 16:12:42 +01:00
Gwenole Beauchesne
6dd8eab023 mpeg2: avoid too many allocations of parser info objects.
Move parsing back to decoding step, but keep functions separate for now.
This is needed for future optimizations that may introduce some meta data
for parsed info attached to codec frames.
2013-01-07 16:12:42 +01:00
Gwenole Beauchesne
8c403c2d98 decoder: decoder units are no longer dynamically allocated objects. 2013-01-07 14:11:39 +01:00
Gwenole Beauchesne
a486d1af66 decoder: optimize pre-allocation of decoder units.
Optimize pre-allocation of decoder units, thus avoiding un-necessary
memory reallocations. The heuristic used is that we could have around
one slice unit per macroblock line.
2013-01-07 14:11:39 +01:00
Gwenole Beauchesne
4fd99cc989 decoder: use an array of units instead of a single-linked list.
Use a GArray to hold decoder units in a frame, instead of a single-linked
list. This makes 'append' calls faster, but not that much. At least, this
makes things clearer.
2013-01-07 14:10:13 +01:00
Gwenole Beauchesne
2c449e42ca decoder: refactor decoder unit API.
Allocate decoder unit earlier in the main parse() function and don't
delegate this task to derived classes. The ultimate purpose is to get
rid of dynamic allocation of decoder units.
2013-01-07 14:10:13 +01:00
Gwenole Beauchesne
78e9a78de8 mpeg2: introduce parser info instead of MPEG-2 specific decoder unit.
Use a new GstVaapiParserInfoMpeg2 data structure instead of deriving
from GstVaapiDecoderUnit for MPEG-2 specific parser information.
2013-01-07 14:10:09 +01:00
Gwenole Beauchesne
8d2b7241fc h264: introduce parser info instead of H.264 specific decoder unit.
Use a new GstVaapiParserInfoH264 data structure instead of deriving
from GstVaapiDecoderUnit for H.264 specific parser information.
2013-01-07 10:48:57 +01:00