Commit graph

835 commits

Author SHA1 Message Date
Guillaume Desmottes
503db0f1af omxvideodec: fix OMX flags on header buffer
The header (SPS/PPS) buffer should have the CODECONFIG flag

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-omx/-/merge_requests/49>
2021-07-09 15:15:12 +02:00
Guillaume Desmottes
006e0636fd omxvideodec: allow to start decoder on HEADER buffer
If the headers are sent in their own buffer
it won't have the SYNC_FRAME flag but we still
do want to start decoding rather than dropping it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-omx/-/merge_requests/49>
2021-07-09 15:13:36 +02:00
Nicolas Dufresne
aa99c5387f omxh26xdec: videodecoder support subframe
Use of subframe API from videodecoder base class.
This subframe allows to decode subframe instead of
waiting for a whole frame.
The subframe uses the same frame over the whole
subframe passing process and will wait
for a signal to know the last subframe.
In this implementation it will use
GST_VIDEO_BUFFER_FLAG_MARKER as the
end of batch of subframes.

This implement subframe mode negotation for the Zynq based on caps
negotation. This mode can be combined with low-latency mode, in order to
reach the lowest possible latency (assuming the stream is within the
low-latency constraints for the HW).

... ! video/x-h264,alignment=nal ! omxh264dec ! ...

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-omx/-/merge_requests/49>
2021-07-09 15:13:27 +02:00
Guillaume Desmottes
9192ad0eeb omxvideodec: support interlace-mode=interleaved input
interlace-mode=alternate is a special case of interlace-mode=interleaved
where the fields are split using two different buffers.

The Zynq decoder always produces alternate content and we
used to assume that upstream will set interlace-mode=alternate in its
caps as well.
This is no longer the case as h265parse is now setting
alternate-mode=interleaved on alternate content to not break compat with
elements not supporting alternate.
As a result the decoder now accept both 'interleaved' and 'alternate' on
its input and ensures that its ouput has interlace-mode=alternate.

Needed to fix https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/825

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-omx/-/merge_requests/72>
2020-10-05 12:38:18 +02:00
Dylan Yip
fbdcf190ea omx: Add latest OMX_ALG_Index's to omx_index_type_to_str
Add following indexes to omx_index_type_to_str:
OMX_ALG_IndexParamVideoAccessUnitDelimiter
OMX_ALG_IndexParamVideoBufferingPeriodSEI
OMX_ALG_IndexParamVideoPictureTimingSEI
OMX_ALG_IndexParamVideoRecoveryPointSEI
OMX_ALG_IndexParamVideoMasteringDisplayColourVolumeSEI
OMX_ALG_IndexParamVideoContentLightLevelSEI
OMX_ALG_IndexConfigVideoRegionOfInterestByValue
OMX_ALG_IndexConfigVideoColorPrimaries
2020-05-21 14:52:01 +02:00
Stéphane Cerveau
cd5414db5a zynq: change API to use public 2020.01 from vcu-omx-il
This new release 2020.01 fixes an API typo
Change to OMX_ALG_IndexConfigVideoHighDynamicRangeSEI
instead of OMX_ALG_IndexConfigVideoHighDynamicRangeSEIs
among others.
2020-05-21 14:52:01 +02:00
Guillaume Desmottes
3459726095 omxvideoenc: factor out gst_omx_video_enc_allocate_out_buffers()
No semantic change.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-omx/-/merge_requests/66>
2020-05-20 16:11:34 +02:00
Guillaume Desmottes
d3c2a7c8d1 omxvideoenc: remove unsupported formats from caps template
Our encoder implementation actually supports a small subset of the
formats supported by the decoder. Those are the formats for which we
have a copy path in gst_omx_video_enc_fill_buffer() and which are not
filtered out in filter_supported_formats().
2020-04-10 11:53:23 +02:00
Guillaume Desmottes
8530407ebe video: remove BGR from supported format
It's not supported by either decoder or encoder and is even not listed in
gst_omx_video_get_format_from_omx() so it can't work.
2020-04-10 11:37:58 +02:00
Guillaume Desmottes
d5e278e362 omxvideoenc: add GRAY8 support
It's supported by Zynq encoder and was already in the sink caps
template.
2020-04-10 11:30:29 +02:00
Guillaume Desmottes
2a620d5bbd omxvideoenc: factor out gst_omx_video_enc_copy_plane()
No semantic change, I'm going to use it to copy GRAY8 buffers which is
actually a single plane 8-bits format.
2020-04-10 11:30:29 +02:00
Guillaume Desmottes
5e6090056d omxvideoenc: use gst_video_meta_get_plane_height() to compute slice height
This new API saves us from doing manual computation and actually work
with single planar formats, such as GRAY8.
2020-04-10 11:30:29 +02:00
Stéphane Cerveau
84e9906076 omxh26xenc: fix coverity with frame test
Coverity was complaining with:
Null pointer dereferences  (REVERSE_INULL) Null-checking "frame"
suggests that it may be null, but it has already been
dereferenced on all paths leading to the check.

The frame == NULL has been removed as 'frame' is actively used
in the code above without any change of dereferencing and setting
its value to NULL before the test.

CID: 1461287
2020-04-08 16:54:24 +02:00
Stéphane Cerveau
7d5175a80f gstomxvideoenc: fix subframe output_buffer
Using more than 1 subframes was failing with
frame->output_buffer = NULL
2020-03-19 16:24:44 +01:00
Guillaume Desmottes
c2ddd4c710 omxvideodec: add support of alternate interlace mode on zynq 2020-02-27 04:05:48 +00:00
Guillaume Desmottes
1c3f39c4d7 omxvideoenc: add support of alternate interlace mode on zynq
It's only supported by the Zynq HEVC encoder for now.
2020-02-27 04:05:48 +00:00
Guillaume Desmottes
3c45c8ecbe omx: add alternate flags to buffer_flags_map
Zynq specific flags used to tag top/bottom fields in alternate mode.
2020-02-27 04:05:48 +00:00
Guillaume Desmottes
e616094a53 omxvideo(enc): use GST_VIDEO_INFO_FIELD_RATE_N()
Does not change anything for now but will be needed when we'll support
interlace-mode=alternate as the field rate will be twice the frame rate.

Made the code safe from division by 0 while I was on it.
2020-02-27 04:05:48 +00:00
Guillaume Desmottes
f14f5d9f70 omxvideo{enc,dec}: use GST_VIDEO_INFO_FIELD_HEIGHT()
Does not change anything for now but will be needed when we'll support
interlace-mode=alternate as the fields will have half the frame height.
2020-02-27 04:05:48 +00:00
Guillaume Desmottes
27c1aa544e omx: don't log error when failing to load conf file with generic target
The generic target is meant to only test building gst-omx. It doesn't
provide any configuration file and so is not supposed to register any
element.
I'm not aware of any user building gst-omx with this target and
providing their own conf file to actually register elements. But best to
not break this use case anyway so let's just downgrade the log message.

Fix GST_ERROR in the 'check fedora' CI job.
2020-02-25 10:51:39 +05:30
Stéphane Cerveau
74812122d4 omxvideoenc: fix warning
Fix warning test when OMX_BUFFERFLAG_ENDOFFRAME
is not set.
2020-01-16 10:09:23 +01:00
Varunkumar Allagadapa
f35f312634 omxvideoenc: Add look-ahead property to ZYNQ_USCALE_PLUS encoder
This patch adds look-ahead property to encoder

The value indicates look ahead size in frames,
the number of frames processed ahead of second pass encoding.
Dual pass encoding is disabled if look-ahead
value is less than 2.
2020-01-09 11:44:55 +01:00
Varunkumar Allagadapa
bfd8306ef6 omxvideoenc: Add long-term-ref support to ZYNQ_USCALE_PLUS encoder
Custom API that upstream elements can use to notify encoders about
marking longterm ref. pictures or using longterm ref. pictures in
encoding process.

This patch adds below properties:

long-term-ref: Enable/Disable dynamically marking long-term
reference pictures in encoding process

long-term-freq: Periodicity of long-term reference picture
marking in encoding process.

If a picture is marked as long-term reference picture then it remains
in the DPB list for ever unless it overrides with new long-term pitcure with
same index. Encoder can use this long-term picture as refence for
encoding.

This feature is mostly useful to avoid visual artifacts propagation in streaming use cases
when packet loss happens. Instead of requesting for IDR, client can request for use long-term
reference picture for encoding.
2020-01-09 11:44:55 +01:00
Guillaume Desmottes
72844211f7 omx: remove useless double negations
flush and port->flushing are both gboolean.
2020-01-07 05:48:41 +00:00
Guillaume Desmottes
5f212c159b omxh265enc: handle CODECCONFIG buffers
Exact same code as omxh264enc.
2019-12-22 05:43:40 +00:00
Guillaume Desmottes
4c9b8052c7 omxh264enc: send codec data downstream
We are operating in stream-format=byte-stream so the codec data buffer
is meant to be part of the buffer flow.

The base class will push it when a key frame is requested (as we stored
it with gst_video_encoder_set_headers()) but we still have to push it
right away as part of the normal buffer flow.

Also set the HEADER flag on this buffer.
2019-12-22 05:43:40 +00:00
Guillaume Desmottes
bb0d9add24 omxh264enc: no need to check if codeconfig has startcode
We currently only support stream-format=byte-stream so there is no point
re-checking for it when handling CODECCONFIG buffer.
2019-12-22 05:43:40 +00:00
Nicolas Dufresne
d6d2a5b194 omxh26xenc: Negotiate subframe mode
We now negotiate subframe mode through the caps. To enabled subframe
mode, the caps need to specify alignment=nal:

  ... ! omxh264enc ! video/x-h264,alignment=nal ! ...
  ... ! omxh265enc ! video/x-h265,alignment=nal ! ...
2019-12-22 05:43:40 +00:00
Guillaume Desmottes
de83fbd3a3 omxvideoenc: use subframe base class API
Use subframe base class support.
2019-12-22 05:43:40 +00:00
Nicolas Dufresne
bba92f64ca omx: Add helper to enable/disable/read subframe mode 2019-12-22 05:43:40 +00:00
Guillaume Desmottes
73179da17c zynq: add mapping for latest custom indexes
Fix warning when building using version 2019.2 of OMX headers.
2019-12-19 13:51:17 +05:30
Varunkumar Allagadapa
a51123eea0 omxvideoenc: update qp-mode settings
Adds load-qp-absolute and load-qp-relative qp-modes
2019-12-19 13:46:47 +05:30
Shinya Saito
847fc08824 omxvideoenc: Add stride check for input buffer extraction
Stride of input buffer may be different from
that of omx input port even if both sizes are the same.
2019-12-11 15:53:29 +09:00
Guillaume Desmottes
2939a46dd2 omxvideoenc: pass padding requirements to ALLOCATION query
By passing the expected video buffer layout, the upstream producer
may be able to produce buffers fitting those requierements allowing
gst-omx to use dynamic buffer mode rather than having to copy each input
buffer.

This is particularly useful with v4l2src as it can request the capture
driver to produce buffers with the required paddings.
2019-11-05 17:30:21 +05:30
Guillaume Desmottes
800cc4bd67 omxbufferpool: use gst_video_meta_set_alignment()
Tell buffer consumer about our paddings.

v4l2src can now uses these paddings information when trying to import
buffers to configure the v4l2 driver accordingly.
2019-11-05 17:30:21 +05:30
Guillaume Desmottes
611f37c2ae omxvideoenc: fix buffer size in debug log
Use the actual OMX buffer size rather than the info.size as OMX
may require larger buffer if the port requires some padding.
2019-11-02 14:56:53 +01:00
Tim-Philipp Müller
e8a4500d75 Remove autotools build 2019-10-14 00:58:55 +01:00
Stéphane Cerveau
a5a22f03a5 omxallocator: fix leak with a proper chaining finalize 2019-10-07 16:59:10 +00:00
Guillaume Desmottes
d0bc3ed840 omxvideoenc: revert draining on ALLOCATION and DRAIN query
My latest patch introduces some regressions which I have no time to
debug properly at the moment so just revert it for now.
2019-09-23 13:50:54 +05:30
Guillaume Desmottes
df8ba87025 omxvideoenc: let encoder base class handle ALLOCATION query
Fixing a regression introduced in my previous patch
(7c40a91c31).

The ALLOCATION query needs to be handled by GstVideoEncoder (to call
propose_allocation()) so chain up the query handling rather than early
returning.
2019-09-17 13:13:23 +05:30
Guillaume Desmottes
7c40a91c31 omxvideoenc: drain encoder on ALLOCATION and DRAIN queries
Ensure that the encoder releases all its input buffers when requested by
upstream. Encoder input buffers may be shared with downstreaming (when
using dmabuf), upstream may then request the encoder to
drain when reconfiguring before destroying its buffers.

Also drain on ALLOCATION query as we already do in kmssink as that
notify of a format change.

Fix "decoder ! encoder" pipeline when decoding a file with different
resolutions on Zynq.
2019-09-05 09:22:32 +05:30
Guillaume Desmottes
76267ec55d omx: log the number of pending buffers when port is EOS 2019-09-04 10:41:46 +00:00
Guillaume Desmottes
a7ef71dc80 omx: log when an output port is eos 2019-09-04 10:41:46 +00:00
Guillaume Desmottes
35ffd018e2 omxvideoenc: log the full input format
Make it easier to debug dynamic format changes.
2019-09-04 10:41:46 +00:00
Guillaume Desmottes
55ea6d017f omxvideodec: fix dmabuf import
When importing dmabuf, UseBuffer() has to be called with the fd as
pBuffer rather than the mapped address of the buffer.
2019-09-02 09:47:54 +05:30
Guillaume Desmottes
7cd929bc87 omxbufferpool: fix dmabuf import
When importing dmabuf from downstream, we want the allocator to be in
OTHER_POOL mode despite output_mode being DMABUF.
So check first if other_pool is set before checking for pool's
output_mode.
2019-09-02 09:47:51 +05:30
Shinya Saito
8d4d697a58 omxvideoenc: Remove unnecessary gst_video_frame_unmap() 2019-08-22 18:01:56 +09:00
Guillaume Desmottes
a160160419 omxvideodec: log supported caps by the decoder
Can be useful when debugging to check the caps supported by the decoder
before filtering.
2019-08-05 13:43:44 +05:30
Shinya Saito
d8d23bbb3e omxvideoenc: Unref frame of codec config buffer
After handling codec config, codec frame should be unreffed.
2019-07-11 19:02:20 +09:00
Guillaume Desmottes
50d50f47fb omxvideo: check difference between frame and requested ts
This has proven to be very useful when debugging to detect bugs where we
match the wrong gst frame with an output OMX buffer.
2019-06-17 09:17:14 +05:30