summaryrefslogtreecommitdiff
path: root/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c
Commit message (Collapse)AuthorAgeFilesLines
* mpeg2: fix PTS cache for GOP start.Gwenole Beauchesne2015-05-271-1/+6
| | | | | | | | | If the GOP temporal sequence number (TSN) is interpolated from a valid PTS, then we need to compensate that PTS corresponding to the start of GOP with the next picture to be decoded, which shall be an I-frame, based on its sequence number. https://bugzilla.gnome.org/show_bug.cgi?id=748676
* mpeg2: avoid crash when seeking with debug logsVíctor Manuel Jáquez Leal2015-05-271-2/+2
| | | | | Move down the debug message when the state of the decoder is verified so the slice header is not NULL.
* mpeg2: Avoid crashes and warnings on re-opened decoder after a seekJan Schmidt2015-05-271-1/+7
| | | | | Reset state and add some checks for safe state to avoid a crash and a warning after the decoder is destroyed/recreated during a seek.
* vaapidecode: Tell the base class about released frames on closeOlivier Crete2015-04-201-1/+2
| | | | | | | The base class needs to be informed about frames that were still queued in the decoder on release, otherwise they are leaked. https://bugzilla.gnome.org/show_bug.cgi?id=747999
* decoder: cast GST_VAAPI_DECODER_STATUS_DROP_FRAMEVíctor Manuel Jáquez Leal2015-04-081-1/+1
| | | | | | | Since GST_VAAPI_DECODER_STATUS_DROP_FRAME is not part of the enum GstVaapiDecoderStatus, we need to cast it to avoid compiler complains. https://bugzilla.gnome.org/show_bug.cgi?id=747312
* decoder: mpeg2: respect any input PTS provided for a frame.Jan Schmidt2014-07-041-1/+4
| | | | | | | | | | | | The timestamp generator in gstvaapidecoder_mpeg2.c always interpolated frame timestamps within a GOP, even when it's been fed input PTS for every frame. That leads to incorrect output timestamps in some situations - for example live playback where input timestamps have been scaled based on arrival time from the network and don't exactly match the framerate. https://bugzilla.gnome.org/show_bug.cgi?id=732719
* decoder: default to YUV 4:2:0 VA surfaces.Gwenole Beauchesne2014-04-251-0/+1
| | | | | Cope with context changes to support non-YUV 4:2:0 VA surfaces. Still, make sure all codecs use YUV 4:2:0 output format for now, by default.
* legal: add per-file authorship information.Gwenole Beauchesne2013-11-221-0/+1
| | | | | | 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.
* mpeg2: disable video cropping as picture_display_extension() is missing.Gwenole Beauchesne2013-08-261-9/+26
| | | | | | | | | | | | | Disable video cropping in MPEG-2 codec because it is partially implemented and actually because nobody implements it that way, and the standard spec does not specify the display process either anyway. Most notably, there are two possible use cases for sequence_display_extension() horizontal_display_size & vertical_display_size: (i) guesstimating the pixel-aspect-ratio, or (ii) implement some kind of span & scan process in conjunction with picture_display_extension() information. https://bugzilla.gnome.org/show_bug.cgi?id=704848
* mpeg2: don't output dummy pictures.0.5.5Gwenole Beauchesne2013-07-151-0/+1
| | | | | | Mark dummy pictures as output already so that we don't try to submit them to the upper layer since this is purely internal / temporary picture for helping the decoder.
* mpeg2: add support for video cropping.Sreerenj Balachandran2013-07-081-0/+11
| | | | | | | | If the stream has a sequence_display_extenion, then attach the display_horizontal/display_vertical dimension as the cropping rectangle width/height to the GstVaapiPicture. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
* mpeg2: reset quantization matrices on new sequence headers.Zhong Cong2013-07-051-0/+1
| | | | | | | | The MPEG-2 standard specifies (6.3.7) that all quantisation matrices shall be reset to their default values when a Sequence_Header() is decoded. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
* mpeg2: cope with latest codecparser changes.Gwenole Beauchesne2013-07-051-176/+69
| | | | | Fix build with newer MPEG-2 codecparser where GstMpegVideoPacket are used in individual header parsers. Also use the new slice parsing API.
* libs: use GstVaapiMiniObject for video decoders.Gwenole Beauchesne2013-05-071-97/+80
| | | | | | | Port GstVaapiDecoder and GstVaapiDecoder{MPEG2,MPEG4,JPEG,H264,VC1} to GstVaapiMiniObject. Add gst_vaapi_decoder_set_codec_state_changed_func() helper function to let the user add a callback to a function triggered whenever the codec state (e.g. caps) changes.
* libs: refine GstVaapiMiniObject.Gwenole Beauchesne2013-05-071-0/+1
| | | | | | | | | | Drop support for user-defined data since this capability was not used so far and GstVaapiMiniObject represents the smallest reference counted object type. Add missing GST_VAAPI_MINI_OBJECT_CLASS() helper macro. Besides, since GstVaapiMiniObject is a libgstvaapi internal object, it is also possible to further simplify the layout of the object. i.e. merge GstVaapiMiniObjectBase into GstVaapiMiniObject.
* decoder: fix unpaired GstBuffer map/unmaps.Gwenole Beauchesne2013-04-101-0/+2
| | | | This possibly fixes a few memory leaks along the way.
* Add initial support for GStreamer 1.0.Sreerenj Balachandran2013-04-101-3/+15
| | | | | | | | | This integrates support for GStreamer API >= 1.0 only in the libgstvaapi core decoding library. The changes are kept rather minimal here so that the library retains as little dependency as possible on core GStreamer functionality. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
* decoder: sanitize uses of codec frame input buffer (cosmetics).Gwenole Beauchesne2013-03-211-5/+6
| | | | | Alias GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer to a simple "buffer" variable.
* mpeg2: fix decoding of 4K videos.Gwenole Beauchesne2013-01-301-2/+3
| | | | Account for slice_vertical_position_extension when vertical_size > 2800.
* mpeg2: fix decoding of sequence_end().Gwenole Beauchesne2013-01-301-5/+0
| | | | | | | There shall be only one place to call decode_current_picture(), and this is in the end_frame() hook. The EOS unit is processed after end_frame() so this means we cannot have a valid picture to decode/output at this point.
* mpeg2: improve robustness when packets are missing.Gwenole Beauchesne2013-01-301-16/+78
| | | | | | 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 sequence or picture headers.
* mpeg2: implement GstVaapiDecoder::flush() as a DPB flush.Sreerenj Balachandran2013-01-291-0/+12
|
* legal: fix year for some copyright notices (2013).Gwenole Beauchesne2013-01-291-1/+1
|
* legal: fix year for some copyright notices (2012).Gwenole Beauchesne2013-01-291-1/+1
|
* dpb: port to GstVaapiMiniObject.Gwenole Beauchesne2013-01-141-4/+1
|
* dpb: drop GstVaapiDpb2 interface, keep only one class.Gwenole Beauchesne2013-01-141-2/+2
| | | | | | 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.
* dpb: rename GstVaapiDpbMpeg2 to GstVaapiDpb2.Sreerenj Balachandran2013-01-141-2/+2
| | | | | | | 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>
* mpeg2: optimize scan for the end of the frame.Gwenole Beauchesne2013-01-091-3/+14
| | | | | | | 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.
* mpeg2: optimize scan for start codes.Gwenole Beauchesne2013-01-091-29/+44
| | | | | | | | | | | | | | | | 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.
* mpeg2: drop useless gst_adapter_peek().Gwenole Beauchesne2013-01-081-5/+0
| | | | | Drop useless gst_adapter_peek() since the returned buffer was not used and this could incur superfluous memcpy().
* mpeg2: cosmetics: move parse_slice() down.Gwenole Beauchesne2013-01-071-61/+61
|
* mpeg2: avoid too many allocations of parser info objects.Gwenole Beauchesne2013-01-071-137/+219
| | | | | | 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.
* decoder: refactor decoder unit API.Gwenole Beauchesne2013-01-071-6/+2
| | | | | | 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.
* mpeg2: introduce parser info instead of MPEG-2 specific decoder unit.Gwenole Beauchesne2013-01-071-113/+139
| | | | | Use a new GstVaapiParserInfoMpeg2 data structure instead of deriving from GstVaapiDecoderUnit for MPEG-2 specific parser information.
* mpeg2: don't create sub-buffer for slice data.Gwenole Beauchesne2013-01-031-11/+3
| | | | | | | Avoid creating a GstBuffer for slice data. Rather, directly use the codec frame input buffer data. This is possible because the codec frame is valid until end_frame() where we submit the VA buffers for decoding. Anyway, the slice data buffer is copied into the VA buffer when it is created.
* mpeg2: minor clean-ups.Gwenole Beauchesne2013-01-031-108/+103
| | | | | Drop explicit initialization of most fields that are implicitly set to zero. Remove some useless checks for NULL pointers.
* mpeg2: optimize scan for the second start code.Gwenole Beauchesne2013-01-031-6/+17
| | | | | Optimize scan for the second start code, on the next parse() call so that to avoid scanning again earlier bytes where we didn't find any start code.
* mpeg2: use sequence_display_extension() to compute PAR.Gwenole Beauchesne2013-01-031-10/+12
| | | | | Also compute pixel-aspect-ratio from sequence_display_extension(), should it exist in the bitstream.
* mpeg2: handle sequence_display_extension().Gwenole Beauchesne2013-01-031-0/+36
|
* mpeg2: implement {start,end}_frame() hooks.Gwenole Beauchesne2013-01-031-152/+188
| | | | | | | Implement GstVaapiDecoder.start_frame() and end_frame() semantics so that to create new VA context earlier and submit VA pictures to the HW for decoding as soon as possible. i.e. don't wait for the next frame to start decoding the previous one.
* mpeg2: parse slice() header earlier.Gwenole Beauchesne2013-01-031-50/+78
| | | | | | Parse slice() header and first macroblock position earlier in _parse() function instead of waiting for the _decode() stage. This doesn't change anything but readability.
* mpeg2: add codec specific decoder unit.Gwenole Beauchesne2013-01-031-127/+239
| | | | | | | Introduce new GstVaapiDecoderUnitMpeg2 object, which holds the standard GstMpegVideoPacket and additional parsed header info. Besides, we now parse as early as in the _parse() function so that to avoid un-necessary creation of sub-buffers in _decode() for video packets that are not slices.
* mpeg2: initial port to new GstVaapiDecoder API.Gwenole Beauchesne2012-12-181-75/+115
|
* mpeg2: fix PAR calculation from commit bd11bae.Sreerenj Balachandran2012-11-151-5/+9
| | | | | | | | | | | | Invoke gst_mpeg_video_finalise_mpeg2_sequence_header() to get the correct PAR values. While doing so, require a newer version of the bitstream parser library. Note: it may be necessary to also parse the Sequence_Display_Extension() header. Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com> Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
* mpeg2: use pixel-aspec-ratio information from bitstream parser.Simon Farnsworth2012-10-111-0/+6
| | | | | Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk> Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
* mpeg2: add decode_packet() helper function.Gwenole Beauchesne2012-10-101-76/+87
| | | | | | Split decode_buffer() into the core infrastructure that determines the packets contained in the adapter and the actual function that decodes the packet data.
* mpeg2: fix end-of-stream conditions (flush).Gwenole Beauchesne2012-10-091-6/+14
| | | | | Decode pending data in the adapter prior to processing the actual code for end-of-stream. Initial code from Feng Yuan.
* mpeg2: fix memory leak of empty packets.Gwenole Beauchesne2012-10-091-12/+1
| | | | | | | | | | Fix memory leakage of empty packets, i.e. packets that only contain the start code prefix. In particular, free empty user-data packets. Besides, the codec parser will already fail gracefully if the packet to parse does not have the minimum required size. So, we can also completely drop the block of code that used to handle packets of size 4 (including the start code).
* mpeg2: fix return value for "no-data" conditions.Gwenole Beauchesne2012-10-091-9/+30
| | | | | | | Fix return value when the second scan for start code fails. This means there is not enough data to determine the full extents of the current packet and the function shall return GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA in this case, instead of GST_VAAPI_DECODER_STATUS_SUCCESS.
* decoder: cope with new GstVaapiContextInfo based API.Gwenole Beauchesne2012-09-101-4/+9
| | | | Update decoders to report the maximum number of reference frames to use.