Commit graph

445 commits

Author SHA1 Message Date
Javier Jardón
dba174906a libs: declare _get_type() functions as const.
Declaring a function as const enables better optimization of calls
to the function.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-07-19 15:19:17 +02:00
Javier Jardón
30024b3f8e libs: use g_clear_object() wherever applicable.
This is a preferred thread-safe version. Also add an inline version of
g_clear_object() if compiling with glib < 2.28.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-07-19 15:19:17 +02:00
Javier Jardón
c415868f26 libs: use generic g_cclosure_marshal_VOID__VOID().
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-07-19 15:19:16 +02:00
Gwenole Beauchesne
27c8269b43 glibcompat: drop explicit check for g_list_free_full(). 2012-07-19 14:29:33 +02:00
Gwenole Beauchesne
fbb9a5e1c0 jpeg: fix make dist. 2012-07-19 13:57:05 +02:00
Gwenole Beauchesne
1139908487 jpeg: update to match latest parser API. 2012-07-17 18:02:16 +02:00
Gwenole Beauchesne
8f93bbc937 codecparsers: jpeg: tweak parser API.
... to allow for more consistent parsing API among various codec parsers.
In particular, drop use of GList.
2012-07-17 18:02:16 +02:00
Gwenole Beauchesne
06be1afea6 jpeg: fix build with VA-API < 0.32.0. 2012-06-26 15:18:53 +02:00
Gwenole Beauchesne
a9bd8400db Fix build with recent GStreamer stack. 2012-06-26 10:57:34 +02:00
Gwenole Beauchesne
4e1a354340 jpeg: update to current VA/JPEG decoding API. 2012-06-26 10:57:34 +02:00
Gwenole Beauchesne
326a229636 codecparsers: jpeg: track valid quantization and Huffman tables.
Add valid flag to GstJpegQuantTable and GstJpegHuffmanTable so that
to determine whether a table actually changed since the last user
synchronization point. That way, this makes it possible for some
hardware accelerated decoding solution to upload only those tables
that changed.
2012-06-21 16:06:47 +02:00
Wind Yuan
e61f4c4445 codecparsers: jpeg: use U_READ_UINT*() wherever possible.
Use GstByteReader *_unchecked() variants as much as possible.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-06-21 15:30:54 +02:00
Wind Yuan
90e6532fd3 jpeg: add new GstJpegHuffmanTables structure.
Add new GstJpegHuffmanTables helper structure to hold all possible
AC/DC Huffman tables available to all components.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-06-21 15:30:54 +02:00
Wind Yuan
4c5cc7eff9 jpeg: make gst_jpeg_parse() support multiple scans.
gst_jpeg_parse() now gathers all scans available in the supplied
buffer. A scan comprises of the scan header and any entropy-coded
segments or restart marker following it. The size and offset to
the associated data (ECS + RST segments) are append to a new
GstJpegScanOffsetSize structure.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-06-21 15:30:53 +02:00
Wind Yuan
53cbdcc1e6 jpeg: update to match latest parser API.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-05-15 18:25:03 +02:00
Gwenole Beauchesne
0cf06cdbcb jpeg: simplify and optimize parser API. 2012-05-15 16:08:44 +02:00
Wind Yuan
0fe727ba77 mpeg: fix picture used to determine backward_reference_vop_coding_type.
Complete fix brought by bf9f77b1af
but Gwenole did not apply all the bits.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-05-11 11:20:45 +02:00
Wind Yuan
c40c05dc45 mpeg4: map Simple_Scalable profile to Advanced_Simple profile.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-05-10 11:52:06 +02:00
Wind Yuan
96437a7a16 mpeg4: handle skipped frames (vop_hdr->coded = 0).
Gracefully skip non VOP coded frames.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-05-10 11:52:06 +02:00
Wind Yuan
1632b40982 mpeg4: fix timestamp issues on too fast playback.
Improve generation of presentation timestamps to be less sensitive
to input stream errors. In practise, GOP is also a synchronization
point for PTS calculation.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-05-10 11:38:06 +02:00
Gwenole Beauchesne
449606efc5 Fix build without JPEG decoder. 2012-04-16 10:02:29 +02:00
Wind Yuan
bf9f77b1af mpeg4: fix VOP coding type of backward reference pictures.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-04-12 11:48:24 +02:00
Wind Yuan
60b5c2da97 mpeg4: fix handling of temporal reference distances.
TRD and TRB fields are not large enough to hold the difference of PTS
expressed with nanosecond resolution. So, compute them from the original
VOP info.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-04-12 11:44:16 +02:00
Gwenole Beauchesne
687b482895 dpb: mpeg2: cosmetics.
Define MAX_MPEG2_REFERENCES to 2 and avoid magic numbers all around.
2012-04-12 11:00:22 +02:00
Wind Yuan
75e8a7d6f8 Add initial JPEG decoder.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-04-11 19:38:12 +02:00
Wind Yuan
c350a0809d codecparsers: add JPEG parser.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-04-11 19:38:12 +02:00
Gwenole Beauchesne
49b1dca2d3 mpeg2: fix calculation of macroblock_offset.
Fix decoding of streams with extra slice() information before the first
macroblock(). e.g. this fixes sony-ct3.bs from conformance test.
2012-04-02 18:42:12 +02:00
Gwenole Beauchesne
2d36f6199e mpeg2: fix interpolation of GOP TSN from new PTS.
New GOP TSN base could be mis-calculated. In particular, this fixes
decoding of uruseiyatsura.vob from <http://samples.mplayerhq.hu/>.
2012-04-02 18:09:21 +02:00
Gwenole Beauchesne
9c8b85b3c7 mpeg2: fix decoding of high profile streams.
Allow MPEG-2 High profile streams only if the HW supports that profile
or no High profile specific bits are used, and thus Main profile could
be used instead. i.e. chroma_format is 4:2:0, intra_dc_precision is not
set to 11 and no sequence_scalable_extension() was parsed.
2012-04-02 16:12:32 +02:00
Gwenole Beauchesne
d9c57a236d Fix a few documentation issues. 2012-04-02 13:06:15 +02:00
Gwenole Beauchesne
5975def8ab mpeg2: allocate dummy picture for first field based I-frame.
In P-pictures, prediction shall be made from the two most recently
decoded reference fields. However, when the first I-frame is a field,
the next field of the current picture could be a P-picture but only a
single field was decoded so far. In this case, create a dummy picture
with POC = -1 that will be used as reference.

Some VA drivers would error out if P-pictures don't have a forward
reference picture. This is true in general but not in this very specific
initial case.
2012-04-02 11:36:56 +02:00
Gwenole Beauchesne
99932049e4 mpeg2: fix simple to main profile fallback.
Allow fallback from simple to main profile when the HW decoder does
not support the former profile and that no sequence_header_extension()
is available to point out this.
2012-04-02 11:36:56 +02:00
Wind Yuan
b33dd69300 mpeg4: improve error checking while decoding packets.
decode_picture() could return an error when an MPEG-4 profile is not
supported for example. In this case, the underlying VA context is not
allocated and no other proper action can be taken. Likewise on exit
from decode_slice().

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-03-30 17:23:38 +02:00
Gwenole Beauchesne
75538bbc9b decoder: use POC to maintain the DPB.
Introduce a POC field in GstVaapiPicture so that to store simpler sequential
numbers. A signed 32-bit integer should be enough for 1 year of continuous
video streaming at 60 Hz.

Use this new POC value to maintain the DPB, instead of 64-bit timestamps.
This also aligns with H.264 that will be migrated to GstVaapiDpb infrastructure.
2012-03-30 17:08:37 +02:00
Gwenole Beauchesne
d51bb87482 mpeg2: rework generation of presentation timestamps.
Always prefer PTS from the demuxer layer for GOP times. If this is invalid,
i.e. demuxer could not determine the PTS or the generated PTS is lower than
max PTS from past pictures, then try to fix it up based on the duration of
a frame.

For picture PTS, simply use the GOP PTS formerly computed then use TSN to
reconstruct a current time. Also now handle wrapped TSN correctly.
2012-03-30 17:08:37 +02:00
Gwenole Beauchesne
6eeb20a953 mpeg2: ignore empty user-data packets.
Fix tcela-8.bits conformance test.
2012-03-30 17:08:37 +02:00
Gwenole Beauchesne
7af40475d5 mpeg2: review and report errors accordingly.
Use GST_ERROR() to report real errors instead of hiding them into
GST_DEBUG().
2012-03-29 11:13:20 +02:00
Gwenole Beauchesne
b003a2bab2 mpeg2: fix invalid interlaced frame in progressive sequence.
Some streams, badly constructed, could have signaled an interlaced
frame while the sequence was meant to be progressive. Warn and force
frame to be progressive in this case.
2012-03-28 19:41:28 +02:00
Gwenole Beauchesne
7a9410f826 mpeg2: add support for interlaced streams.
Pictures are submitted to the HW for rendering only when both fields
are decoded or current picture is a full frame.
2012-03-28 19:40:27 +02:00
Gwenole Beauchesne
ac4fc0d36c mpeg2: add new decoded picture buffer infrastructure.
Decoded pictures are now maintained into DPB, similarly to H.264.
The same mechanism could be re-used for VC-1 and MPEG-4:2 codecs.
2012-03-28 19:36:52 +02:00
Gwenole Beauchesne
b56ac16224 decoder: add first-field flag to picture.
Add first-field (FF) flag to GstVaapiPicture, thus not requiring is_first_field
member in each decoder. Rather, when a GstVaapiPicture is created, it is considered
as the first field. Any subsequent allocated field will become the second field.
2012-03-28 19:25:49 +02:00
Gwenole Beauchesne
195a61fa02 decoder: allow pictures to be cloned for field decoding.
Add gst_vaapi_picture_new_field() function that clones a picture, while
preserving the parent picture surface. i.e. the surface proxy reference
count is increased and other fields copied as is. Besides, the picture
is reset into a "non-output" mode.
2012-03-28 18:58:27 +02:00
Gwenole Beauchesne
c27385aa8d decoder: rework picture field flags.
Add top-field-first (TFF) and interlaced flags to GstVaapiPicture so they
could be propagated to the surface proxy when it is pushed for rendering.
Besides, top and bottom fields are now expressed with picture structure flags
from GstVaapiSurfaceRenderFlags.
2012-03-28 18:24:39 +02:00
Gwenole Beauchesne
e8756ae427 decoder: add OUTPUT flag to pictures.
Allow pictures to be marked as output gst_vaapi_picture_output().
2012-03-28 17:59:19 +02:00
Gwenole Beauchesne
a7ec623279 decoder: fix semantics of SKIPPED pictures.
If GstVaapiPicture has flag SKIPPED set, this means gst_vaapi_picture_output()
will not push the underlying surface for rendering. Besides, VC-1 skipped P-frame
has nothing to do with rendering. This only means that the currently decoded
picture is just a copy of its reference picture.
2012-03-28 17:59:19 +02:00
Gwenole Beauchesne
b98d334dce vaapipostproc: get "interlaced" attribute from surface proxy.
Add new "interlaced" attribute to GstVaapiSurfaceProxy. Use this in
vaapipostproc so that to handles cases where bitstream is interlaced
but almost only frame pictures are generated. In this case, we should
not be alternating between top/bottom fields.
2012-03-28 17:59:19 +02:00
Gwenole Beauchesne
a5144358d1 videobuffer: add surface render flags.
Allow rendering flags, as a combination of GstVaapiSurfaceRenderFlags,
to be set to the video buffer. In particular, this is mostly useful for
basic deinterlacing.
2012-03-26 12:01:36 +02:00
Gwenole Beauchesne
3b67533d3d compat: add compatibility glue with VA-API 0.34+ (WIP). 2012-03-23 17:13:58 +01:00
Gwenole Beauchesne
7277f0e220 h264: skip all Filler Data NALs. 2012-03-23 17:11:18 +01:00
Wind Yuan
81ab8dad37 mpeg4: check for decoder status prior to decoding packet.
Make sure there is a VA surface free prior to decoding the current frame.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-03-22 14:44:42 +01:00