Commit graph

1165 commits

Author SHA1 Message Date
Sreerenj Balachandran
ac92e6d5bc decoder: h265: Fix indentation 2015-09-04 22:00:36 +03:00
Jan Schmidt
b0194a1dc5 multiview: initial attempt at stereo/multiview support
Add support for marking caps and buffers for multiview or
stereoscopic output.

https://bugzilla.gnome.org/show_bug.cgi?id=750835
2015-08-31 17:51:56 +02:00
Víctor Manuel Jáquez Leal
cc63452d72 decoder: hevc: remove unused functions
Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=754250
2015-08-31 13:13:24 +02:00
Sreerenj Balachandran
11716efdd3 decoder: hevc: Fix the scaling list scan order
The default scan order of scaling lists are up-right-diagonal
as per hevc specification. Use the newly implemented
uprightdiagonal_to_raster conversion codecparser APIs to
get the the scaling_list values in raster order, which is
what the VA intel driver requires.
2015-08-26 07:25:03 +03:00
Sreerenj Balachandran
279c49e8f2 decoder: hevc: sync with the codecparser changes
The Tile Scanning Conversion process (spec 6-3 and 6-4) is implemented
in codecparsers now. Remove the duplication from gstvaapidecoder_h265
2015-08-26 07:20:09 +03:00
Víctor Manuel Jáquez Leal
5fd4c8dffe wayland: rename is_cancelled to sync_failed
Since commit 065a18a3, the semantics of the variable is_cancelled did not make
sense. This commit renames this variable to sync_failed.
2015-08-24 19:24:07 +02:00
Olivier Crete
a83057cdb1 wayland: Don't return GST_FLOW_ERROR on flushing
Setting the sink to flushing causes gst_vaapi_window_wayland_sync() to
return FALSE which makes gst_vaapi_window_wayland_render() return
FALSE which ends up posting an ERROR message in
gst_vaapisink_show_frame_unlocked(). Solution is to just return TRUE
in the EBUSY case.

https://bugzilla.gnome.org/show_bug.cgi?id=753598
2015-08-24 19:23:54 +02:00
Víctor Manuel Jáquez Leal
ceb70c3ca6 surface pool config based on video info
First added the function gst_vaapi_video_format_get_best_native(), which
returns the best native format that matches a particular chroma type:

YUV 4:2:0 -> NV12, YUV 4:2:2 -> YUY2, YUV 4:0:0 -> Y800

RGB32 chroma and encoded format map to NV12 too.

That format is used to configure, initially, the surface's pool for the
allocator.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=744042
2015-08-13 17:20:19 +02:00
Victor Jaquez
002ac0ba9e gstvaapiencoder: validate chroma according to the VA's RT format
Before, only YUV420 color space where supported. With this patch, the
encoder is queried to know the supported formats and admits YUV422
color space if its available.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=744042
2015-08-13 17:20:19 +02:00
Sreerenj Balachandran
53a0e78948 decoder: hevc: Add calculation of WpOffsetHalfRangeC
This is necessary for finding ChromaOffsetL0/ChromaOffsetL1
prediction weight table values with out using any hard coding.

Fixme: We don't have parser API for sps_range_extension, so
assumed zero value for high_precision_offsets_enabled_flag.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-08-13 05:07:52 +03:00
Sreerenj Balachandran
1f287dc71c decoder: hevc: Fix ChromaOffsetL0/ChromaOffsetL1 calculation
Based on ITU-T rec H265(4/2015): 7-56

This was a wrong equation in rec H265 (4/2013): 7-44...

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-08-13 04:09:44 +03:00
Sreerenj Balachandran
6669000580 decoder: hevc: Fix default value assignment of pred_weight_table 2015-08-13 04:08:03 +03:00
Sreerenj Balachandran
8939674a36 decoder: hevc: Fix the value assigning for delta_chroma_log2_weight_denom
Assign only if ChromaArrayType != 0..

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-08-13 03:48:43 +03:00
Sreerenj Balachandran
f7ce9a33d5 decoder: hevc: Add SEI parsing
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-08-10 05:50:50 +03:00
Sreerenj Balachandran
95b8ca0cda decoder: hevc: Workaround to recognize wrongly encoded main profile streams
HACK: This is a work-around to identify some main profile streams having wrong profile_idc.
There are some wrongly encoded main profile streams(eg: ENTP_C_LG_3.bin) which doesn't
have any of the profile_idc values mentioned in Annex-A, instead general_profile_idc
has been set as zero and having general_profile_compatibility_flag[general_profile_idc]
is TRUE. Assuming them as MAIN profile for now.

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-08-07 08:43:44 +03:00
Sreerenj Balachandran
696b446f09 decoder: hevc: Fix decoding of stream when it has temporal sublayers
We are calculating the dpb size based on max_dec_pic_buffering.
But if there are more than one temporal sublayers, we are supposed
to use the max_dec_pic_buffering[max_sub_layers_minus] for dpb
size calculation (Assuming HighestTid as max_sub_layers_minus).

Sample streams: TSCL_A_VIDYO_5.bin, TSCL_B_VIDYO_4.bin

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-08-06 04:01:24 +03:00
Sreerenj Balachandran
cb8b2af5f0 decoder: hevc: Fix the decoding of dependent slice segment
Decoding process for reference picture list construction needs to be
invoked only for P and B slice and the value for slice_type of dependent slice
segment should be taken from the previous independent slice segment header
of the same pic.

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-08-05 05:23:20 +03:00
Víctor Manuel Jáquez Leal
1e8610fc95 gstvaapicontext: fix the JPEG encoder attribs value
When we query for the VAConfigAttribEncJPEG, we get a value which packs the
VAConfigAttribValEncJPEG structure, but we did not assign it. This patch
assigns the returned value to the attribute.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=744042
2015-08-04 19:42:48 +02:00
Victor Jaquez
351496a304 gstvaapiencoder: framerate 0/1 is valid too
Framerate 0/1 is valid, and it is particularly useful for picture
encoding, such as jpeg. This patch makes the encoder to admit that
framerate.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=744042
2015-08-04 19:41:51 +02:00
Sreerenj Balachandran
47b78b7547 decoder: jpeg: Align with new API/ABI changes in codecparser
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-07-22 09:38:42 +03:00
Gwenole Beauchesne
52adebe779 decoder: h264: track previous reference frames.
Improve closure of gaps in frame_num by strictly following and trying
to fill them with previous reference frames. So, they are now tracked
thus avoiding insertion of dummy ("greenish") frames.
2015-07-20 15:25:46 +02:00
Gwenole Beauchesne
06147100f2 decoder: h264: fix integration of second field into the DPB.
If the new picture to be added to the DPB is not a first field, then
it shall be the second field of the previous picture that was added
before.

This removes the need for dpb_find_picture() now that we track the
immediately preceding decoded picture, in decode order.
2015-07-20 15:25:46 +02:00
Gwenole Beauchesne
d4ccae8398 decoder: h264: fix closure of "other-field" gap.
When a dummy "other-field" is inserted, it is assumed to inherit the
reference flags from the first field, and the sliding window decoded
reference picture marking process is also executed so that corrupted
frames are moved out as early as possible.

While doing so, we also try to output frames that now contain a single
valid field picture, prior to inserting any other picture into the DPB.
Note: this may be superfluous currently based on the fact that dpb_add()
combines the two most recent pairable fields, but this process would be
further simplified later on.
2015-07-20 15:25:46 +02:00
Gwenole Beauchesne
80a7ab0959 decoder: h264: track corrupted frames.
Mark the picture as "corrupted" if it is reconstructed from corrupted
references or if those references are fake, e.g. resulting from lost
frames.

This is useful for notifying the upper layer, or downstream elements,
that the decoded frame may contain artefacts.

https://bugzilla.gnome.org/show_bug.cgi?id=703921
2015-07-20 15:25:46 +02:00
Gwenole Beauchesne
939bdb08a5 decoder: add initial infrastructure for marking corrupted output.
Add initial infrastructure in core codec library and vaapidecode to mark
corrupted frames as such. A corrupted frame is such a frame that was
reconstructed from invalid references for instance.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-07-20 15:25:46 +02:00
Víctor Manuel Jáquez Leal
1b76561d95 vaapidecoder: no wmv profiles gstreamer 1.4/1.2
This patch fix the auto-plugging problem in gstreamer 1.2 and gstreamer 1.4

Right now there is not a primary ranked parser for vc1 and the demuxers
delivers caps without specifying the profile. This situation is not an issue
for avdec_vc1 but for vaapidecode it is, which refuses to negotiate without a
explicit profile defined in the negotiated caps.

Nonetheless, in gstreamer 1.5 it seems not to be a problem since the
negotiation admits caps subsets try outs.

This patch solves the issue ignoring the profile negotiation in the caps. For
gstreamer < 1.5 the profile string is not handled, so the auto-plugging get
done without the vc1 parser, such as happens in gstreamer 1.5.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2015-07-15 13:38:23 +02:00
Sreerenj Balachandran
86c4cdc8b6 build: Add missing CFLAGS to Makefile.am 2015-07-07 13:32:18 +03:00
Sreerenj Balachandran
9f0e054d9d gstvaapifilter: Only register STE property if it supported by corresponding VA library
Fix the regression introduced in commit eb465fb.
VAProcFilterSkinToneEnhancement is avaialbe from VA >= 0.36.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-07-03 15:07:45 +03:00
Sreerenj Balachandran
eb465fb392 gstvaapifilter: Add guard for VAProcFilterSkinToneEnhancement
VAProcFilterSkinToneEnhancement is avaialbe from VA >= 0.36.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-07-03 12:42:09 +03:00
Sreerenj Balachandran
6b88777627 encoder:h265: Fix the check for packed-header support
Use VA_ENC_PACKED_HEADER_* definition for checking.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-07-02 21:57:38 +03:00
Sreerenj Balachandran
02d8092da9 encoder:h264: Fix the check for packed-header support
Use VA_ENC_PACKED_HEADER_* definition for checking.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-07-02 21:37:56 +03:00
Sreerenj Balachandran
a260426194 encoder: h264: submit SEI buffering_period() and picture_timing() messages for CBR mode
One buffering_period() SEI message shall be present in every IDR access unit
when NalHrdBpPresentFlag is inferred to be equal to 1. This is the case when we
use a non-CQP mode, e.g. CBR. In other words, when
nal_hrd_parameters_present_flag is set to 1.

One picture_timing() SEI messages shall be present in every access unit
if CpbDpbDelaysPresentFlag is equal to 1 or pic_struct_present_flag is equal to 1

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-07-02 21:01:38 +03:00
Sreerenj Balachandran
cf9a0225c8 Fix build error for older VA-API versions
Provide guards for VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM and
VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME which are only availble from
VA >= 0.36.
2015-06-18 12:20:37 +03:00
Víctor Manuel Jáquez Leal
1ef8c10aa8 vaapipostproc: add skin tone enhancement
Added the 'skin-tone-enhancement' property to vaapostproc.

https://bugzilla.gnome.org/show_bug.cgi?id=744088
2015-06-08 18:00:05 +02:00
Sreerenj Balachandran
2a2ecbe865 encoder: jpeg: Fix the packed header generation
This is a work-around to satisfy the va-intel-driver.
Normalize the quality factor and scale QM values (only for packed header
generation) similar to what VA-Intel driver is doing . Otherwise the
generated packed headers will be wrong, since the driver itself is
scaling the QM values using the normalized quality factor.

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-06-02 08:52:53 +03:00
Gwenole Beauchesne
d2791a7844 decoder: h264: fix uninitialized variables in avcC mode.
Fix uninitialized variables when decoding SPS and PPS NAL units from
"codec-data" buffers. This is particularly important when seeking ops
are involved, and the new persistent states are used more often.

https://bugzilla.gnome.org/show_bug.cgi?id=750094
2015-06-02 11:50:56 +02:00
Sreerenj Balachandran
619058b5b7 encoder: hevc: Fix the size over-flow for encoded buffer.
The approximation of 6 times compression ratio migh not
work in all cases. Especially when enabling I frames.
Provide large enough size for coded-buffer creation.
2015-05-28 10:52:48 +03:00
Sreerenj Balachandran
4d8eaf1918 encoder: vp8: Fix the size over-flow for encoded buffer.
The approximation of 4 times compression ratio will not
work in all cases. Especially when enabling I frames.
Provide large enough size for coded-buffer creation.
2015-05-28 10:43:20 +03:00
Sreerenj Balachandran
55775c6203 encoder: hevc: fix bug in multi slice encoding.
This is a work-around for satisfying the VA-Intel driver.
The driver only support slices begin from CTU row start address.

Multi-Slice encoding also requires a fix in va-intel-driver:
http://lists.freedesktop.org/archives/libva/2015-May/003351.html

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-05-28 05:43:49 +03:00
Gwenole Beauchesne
5abd2b90b6 decoder: h264: add initial support for loss of pictures.
Implement decoding process for gaps in frame_num (8.5.2). This
also somewhat supports unintentional loss of pictures.

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

Original-patch-by: Wind Yuan <feng.yuan@intel.com>
[fixed derivation of POC, ensured clone is valid for reference,
 actually fixed detection of gaps in FrameNum by PrevRefFrameNum]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-05-28 10:51:44 +02:00
Gwenole Beauchesne
8dd93e9c8a decoder: h264: add support for missing first field.
Try to identify missing first fields too, thus disregarding any
intermediate gaps in frames. We also assume that we keep the same
field sequence, i.e. if previous frames were in top-field-first
(TFF) order, then so are subsequent frames.

Note that insertion of dummy first fields need to operate in two
steps: (i) create the original first field that the current field
will inherit from, and (ii) submit that field into the DPB prior
to initializing the current (other) field POC values but after any
reference flag was set. i.e. copy reference flags from the child
(other field) to the parent (first field).

https://bugzilla.gnome.org/show_bug.cgi?id=745048
2015-05-28 10:51:43 +02:00
Gwenole Beauchesne
efaadfc7c0 decoder: h264: add support for missing second field.
Interlaced H.264 video frames always have two fields to decode and
display. However, in some cases, e.g. packet loss, one of the field
can be missing. This perturbs the reference picture marking process,
whereby the number of references available in DPB no longer matches
the expected value.

This patch adds initial support for missing field within a decoded
frame. The current strategy taken is to find out the nearest field,
by POC value, and with the same parity.

https://bugzilla.gnome.org/show_bug.cgi?id=745048
2015-05-28 10:51:43 +02:00
Gwenole Beauchesne
4776138d4a decoder: h264: improve tracking of "top-field-first" flag.
Try to maintain a "top-field-first" (TFF) flag, even if the H.264 standard
does not mandate it. This will be useful for tracking missing fields, and
also for more correct _split_fields() implementation for frames in the DPB.
2015-05-28 10:51:43 +02:00
Gwenole Beauchesne
b4e920843b decoder: h264: skip all pictures prior the first I-frame.
Don't try to decode pictures until the first I-frame is received within
the currently active sequence. There is no point is decoding and then
displaying frames with artifacts.
2015-05-28 10:51:43 +02:00
Gwenole Beauchesne
6229ad4f7f decoder: h264: fix processing of EOSEQ NAL.
Fix decoding of end_of_seq() NAL unit so that to not submit the current
picture for decoding again. This is pretty vintage code that dates back
before the existing of the whole decoder units machinery.

One issue that could be arising if that code was kept is that we could
have submitted a picture, and subsequently a GstVideoCodec frame, twice.
Once without the decode_only flag set, and once with that flag set. The
end result is that the GstVideoDecoder would release the codec frame
twice, thus releasing stale data.

In short, the piece of code that is removed by this patch is for once
completely obsolete for a while, and secondly error-prone in corner
cases.
2015-05-28 10:51:43 +02:00
Wind Yuan
a89a8cf1e3 decoder: add utility function to clone picture objects.
https://bugzilla.gnome.org/show_bug.cgi?id=703921

Signed-off-by: Wind Yuan <feng.yuan@intel.com>
[added cosmetic changes, fixed propagation of "one-field" flag to
 children, fixed per-codec clone modes (h264)]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-05-28 10:51:43 +02:00
Alban Browaeys
3857d5fce1 HEVC: decode: add missing va_dec_hevc header
Signed-off-by: Alban Browaeys <prahal@yahoo.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=749953
2015-05-27 23:43:16 +03:00
Gwenole Beauchesne
efc07f6bb1 mpeg2: fix PTS cache for GOP start.
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
2015-05-27 16:43:34 +02:00
Víctor Manuel Jáquez Leal
d6255be939 mpeg2: avoid crash when seeking with debug logs
Move down the debug message when the state of the decoder is verified
so the slice header is not NULL.
2015-05-27 12:03:21 +02:00
Jan Schmidt
f1a60ec6a2 mpeg2: Avoid crashes and warnings on re-opened decoder after a seek
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.
2015-05-27 12:01:06 +02:00