Commit graph

1235 commits

Author SHA1 Message Date
Thiago Santos befafccf35 video: add missing part of documentation text 2015-04-17 14:17:44 -03:00
Sebastian Dröge 6539d1da29 videodecoder: Break instead of return if default negotiation on GAP events fails
Otherwise we're going to leak the event.
2015-04-11 19:52:50 +02:00
Sebastian Dröge f268f2be92 videodecoder: Try to invent default caps instead of setting none at all when getting a GAP event before CAPS
Otherwise we would forward the GAP event without ever providing any caps,
which then would make decodebin expose a srcpad without any caps set. That's
confusing for applications and can lead to all kinds of interesting bugs.

Instead do the same as already is done in GstAudioDecoder, and try to invent
caps based on the sinkpad caps and the caps allowed by downstream and the
srcpad template caps.

https://bugzilla.gnome.org/show_bug.cgi?id=747190
2015-04-08 20:49:39 -07:00
Sebastian Dröge 0c72d0acdf {audio,video}decoder: Forward SEGMENT_DONE events immediately and drain decoders
Otherwise we're going to wait with draining until the next data comes, which
is a bit suboptimal and might take a long time... or maybe never happens.
2015-04-06 19:20:51 -07:00
Vincent Penquerc'h 2954813b86 audio,video: use gst_segment_is_equal instead of memcmp
memcmp will blindly compare the reserved fields, as well as any
padding the compiler may choose to sprinkle in GstSegment.

Fixes valgrind complaints in unit tests, as well as some found via
https://bugzilla.gnome.org/show_bug.cgi?id=738216
2015-04-03 12:09:41 +01:00
Edward Hervey 3eb35c77cc introspection: Don't use g-ir-scanner cache at compile time
It pollutes user directories and we don't need to cache it

https://bugzilla.gnome.org/show_bug.cgi?id=747095
2015-03-31 11:21:43 +02:00
Song Bing 992101f82a videoencoder: Keep sticky events around when doing a soft reset
The current code will first discard all frames, and then tries to copy
all sticky events from the (now discarded) frames. Let's change the order.

https://bugzilla.gnome.org/show_bug.cgi?id=746865
2015-03-27 09:46:28 +01:00
Wim Taymans 9f0b9eeb58 video-convert: fix clamping for 16 bits alpha mult 2015-03-19 13:31:21 +01:00
Tim-Philipp Müller 5d456c7adc video-frame: fix height/width assertions
As commit 274984e8 states:
When doing CROP META it is expected that the width and/or height
in the GstVideoMeta is bigger or equal to the caps negotiated size.

https://bugzilla.gnome.org/show_bug.cgi?id=741030
2015-03-18 20:40:42 +00:00
Nicolas Dufresne 274984e83b video-frame: Relax width/height assertion
When doing CROP META it is exepcted that the width and/or height in the
GstVideoMeta is bigger or equal to the caps negotiated size.
2015-03-13 10:30:43 +00:00
Nicolas Dufresne c5824f1b43 videopool: Choose the biggest buffer size
We should respect what has been negotiated.
2015-03-13 10:29:00 +00:00
Jan Schmidt 3d60fb654b docs: Add new video functions and objects. Cleanup a little.
Add GstVideoChroma, GstVideoDither, GstVideoScaler and friends to the docs.

Remove and clean up a few obsolete/deleted refs and typos
2015-03-13 01:08:25 +11:00
Wim Taymans 3cd2eb5847 video-converter: fix border handling of YUY2 and friends
Don't draw the border in groups of 4 pixels for YUY2 but instead in
groups of 2 with alternating U and V. This avoids a crash on odd width
borders.
2015-03-11 09:48:20 +01:00
Wim Taymans 757669481c video-converter: force yuv conversion for border
Make sure we always do yuv conversion for the border.
2015-03-11 09:47:23 +01:00
Wim Taymans dd5fa311a1 video-format: fix A422 subsampling description 2015-03-10 17:29:51 +01:00
Wim Taymans 0d333d8d44 video-converter: add table based matrix8 implementation
Based on patch from Mozzhuhin Andrey <nopscmn at gmail.com>

Add a table based matrix8 multiplication implementation. The algorithm
does not do any clipping so we need to make sure we never call this on
input that might need to be clipped. In general, this algorithm is
2 times faster than the orc optimized one and would be chosen for all
RGB -> YUV conversions and some YUV->YUV and RGB->RGB conversions.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=732186
2015-03-10 15:22:17 +01:00
Sebastian Dröge 06fd6f2f63 video: Add support for 10 bit planar AYUV formats 2015-03-10 10:31:28 +01:00
Wim Taymans 62ff9b8bca video-info: validate parsed colorimetry
Validate the parsed colorimetry and reset to defaults when we get RGB
with a matrix or YUV without a matrix.
2015-03-09 16:28:02 +01:00
Wim Taymans 6ee67a8aa1 video-converter: detect identity matrix
Do nothing if we have an identity matrix conversion.
2015-03-09 16:02:17 +01:00
Wim Taymans cf572ae2cb video-info: use default colorimetry on error
When we fail to parse the colorimetry property, fall back to the default
colorimetry for the format and dimension instead of leaving things
undefined.
2015-03-09 16:02:17 +01:00
Luis de Bethencourt fedc1dba1a videoencoder: unused value
Value set in ret is immediately overwritten in the next line outside of the if
block. Run reset but don't store return.

CID #1226470
2015-03-09 11:25:47 +00:00
Wim Taymans 8296cdbfd5 video-converter: only convert to/from rgb when needed
Only use the YUV->RGB matrix when we have YUV as input and only use the
matrix when we need to make YUV output.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=745780
2015-03-09 12:16:56 +01:00
Mark Nauwelaerts f134072c66 videodecoder: only return EOS upon clipping if applicable
See also https://bugzilla.gnome.org/show_bug.cgi?id=709224
2015-03-07 20:12:23 +01:00
Sebastian Dröge 13a93575e1 video: Update orc generated C files 2015-03-07 16:49:07 +01:00
Wim Taymans 7b6278b7e4 video-converter: add transfer full annotation for config 2015-03-06 12:54:56 +01:00
Ravi Kiran K N 6bd458abc1 video-converter: correct right-border location for YUY2, YVYU, UYVY
Remove 'r_border /= 2' in convert_fill_border(). It doesn't
take the right border to correct location.

https://bugzilla.gnome.org/show_bug.cgi?id=745719
2015-03-06 12:27:18 +01:00
Wim Taymans 31a3e6c9f1 video-converter: avoid scaler when size is unchanged 2015-03-05 09:52:18 +01:00
Wim Taymans 6602861d00 video-scaler: add horizontal 2tap u16 orc function
Add slightly faster u16 horizontal resampler orc function.
2015-03-04 16:45:35 +01:00
Wim Taymans e0a192d3dd video-converter: don't reuse the input line when adding borders
When we need to add borders, we need a writable input line, so
don't reuse the source memory directly.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=745207
2015-03-04 12:29:45 +01:00
Wim Taymans 4643d34a7a video-converter: avoid making scalers for outsize == 0 2015-03-02 16:42:23 +01:00
Wim Taymans b2a7ac2766 video-converter: v-resample enough pixels
When we are using the fast linear resampler, use the ->inc to calculate
the first and last pixel we need so that we can do vertical resampling
on the right amount of pixels.
2015-03-02 16:33:09 +01:00
Wim Taymans 0062dadc35 video-orc: fix unpack functions for RGB/RGB15 on BE
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=745337
2015-03-02 15:07:34 +01:00
Wim Taymans d1a9eacb75 video-format: more fixes for big endian 2015-03-02 13:27:23 +01:00
Wim Taymans 569ca5770c video-format: add big-endian versions of RGB/BGR 15/16 pack/unpack
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=745337
2015-03-02 12:27:24 +01:00
Luis de Bethencourt 7175417f7e video-converter: remove check for below zero for unsigned int
CLAMP checks both if value is '< 0' and '> max'. Value will never be a negative
number since it in an unsigned integer. Removing that check and only checking
if it is bigger than max and setting it appropriately.

CID #1271606
2015-02-26 14:48:51 +00:00
Wim Taymans 621292e754 video-converter: we can use the scaler without scalers to copy 2015-02-25 17:00:34 +01:00
Wim Taymans e1715f7728 video-converter: only make a scaler when we are scaling
Only make a scaler when we are actually doing any scaling. Without
scalers, the scale function will simply do a copy.
2015-02-25 16:50:02 +01:00
Wim Taymans 330fb44a6f video-scaler: add support for copy
When no scalers are given, simply do a copy of the requested area.
2015-02-25 16:49:20 +01:00
Wim Taymans 3046935e03 video-converter: activate scaler fastpath depending on method
Only activate the scaler fastpath for x2 up and downscale when the
scaler method is respectively nearest and linear because that is what
those fastpaths really implement.
2015-02-25 16:15:52 +01:00
Wim Taymans 9e8799924b video-scaler: add scaler optimization
If we are vertically downscaling, it is better to first downscale and
then do the horizontal scaling in most cases.
2015-02-25 15:33:26 +01:00
Wim Taymans 4d8c277656 video-scaler: remove unused case 2015-02-25 15:32:57 +01:00
Wim Taymans 495873298c video-converter: don't overwrite border alpha
Let border alpha and image alpha be independent.
2015-02-25 11:39:20 +01:00
Wim Taymans c4f071546d video-converter: use 1.0 as default alpha 2015-02-24 17:33:57 +01:00
Wim Taymans 5077a5e3af video-converter: add alpha handling
Add support for alpha. Make it possible to copy, set and multiply the
alpha value of a frame during conversion.
Set the border alpha to 0xff by default.
Go over some of the fastpaths and add alpha handling.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=745006
2015-02-24 17:29:18 +01:00
Wim Taymans 5744b7995c video-converter: fix chroma subsampling
Also adjust the output line number with the offset.
2015-02-24 17:29:18 +01:00
Wim Taymans cb5ec197da video-converter: disable fastpath when scaling and gamma
Disable the fastpath when scaling and doing gamma remap.
2015-02-24 17:29:18 +01:00
Wim Taymans bf916a244d video-converter: don't do gamma on alpha channel
The alpha channel is not supposed to be gamma encoded.
2015-02-24 17:29:18 +01:00
Tim-Philipp Müller 0b0c667e57 video-converter: minor docs fix 2015-02-24 12:38:10 +00:00
Jan Schmidt af26201429 videodecoder: Add drain() vfunc
drain() is a new vfunc which does what finish() does, while
explicitly requiring the decoder be able to continue processing
data afterward.

https://bugzilla.gnome.org/show_bug.cgi?id=734617
2015-02-24 01:36:44 +11:00
Mark Nauwelaerts ccee86a7dd Revert "videodecoder: drain current segment upon new one to ensure correct flow return"
This reverts commit cc1b4eaf9e.

See https://bugzilla.gnome.org/show_bug.cgi?id=734617
2015-02-22 16:59:08 +01:00
Mark Nauwelaerts cc1b4eaf9e videodecoder: drain current segment upon new one to ensure correct flow return
See also https://bugzilla.gnome.org/show_bug.cgi?id=709224
2015-02-22 13:23:44 +01:00
Thiago Santos 7e39a51a50 audio: video: fix a few GI annotations
transfer-full -> transfer full
@Since -> Since
2015-02-19 15:51:42 -03:00
Wim Taymans 1caf1ae1fd video-orc: update with new methods 2015-02-12 12:08:16 +01:00
Wim Taymans 45e408735c video-format: add orc function for RGB15/16 unpack 2015-02-12 11:39:33 +01:00
Sebastian Dröge 8547594727 Improve and fix LATENCY query handling
This now follows the design docs everywhere, especially the maximum latency
handling.

https://bugzilla.gnome.org/show_bug.cgi?id=744106
2015-02-11 17:53:49 +02:00
Wim Taymans cdd86d025a video-scaler: add 2d scaler
Make a convenience function that combines 2 scalers to perform a 2d
scale. This removes quite a bit of overhead in method calls when doing a
typical scale and it also can reuse a piece of unused memory in the
vertical scaler.
Use the 2d scaler in video-converter and remove the other scalers and
temp memory.
2015-02-11 13:32:25 +01:00
Wim Taymans 80249d4bea video-converter: Fix YUY2 formats and friends
Only merge scalers for selected formats.
Use nearest neighbour scaling for chroma when doing nearest neighbour
for the luma.
Also fastpath GRAY16_OE in nearest neighbour.
configure parameters correctly for packed fastpath.
2015-02-10 16:45:38 +01:00
Wim Taymans 4313970678 video-scaler: Small performance tweaks
Small performance tweaks for RGB and friends.
Add, but ifdef out, alternative nearest neighbour scaling, it is slower
than the current table based version.
Use memcpy instead of orc_memcpy because it is measurably faster.
Fix YUY2 and friends vertical scaling.
2015-02-10 16:45:38 +01:00
Sebastian Dröge 13643870bf video-scaler: Guard against (impossible) bits!=16 && bits!=8 case to fix compiler warning with clang
video-scaler.c:1331:14: error: variable 'func' is used uninitialized whenever 'if' condition is false
      [-Werror,-Wsometimes-uninitialized]
  } else if (bits == 16) {
             ^~~~~~~~~~
video-scaler.c:1348:3: note: uninitialized use occurs here
  func (scale, src_lines, dest, dest_offset, width, n_elems);
  ^~~~
video-scaler.c:1331:10: note: remove the 'if' if its condition is always true
  } else if (bits == 16) {
         ^~~~~~~~~~~~~~~~
video-scaler.c:1260:27: note: initialize the variable 'func' to silence this warning
  GstVideoScalerVFunc func;
                          ^
                           = NULL
2015-02-10 16:44:38 +01:00
Sebastian Dröge b680671374 video-converter: Use correct enum type to fix compiler warnings with clang
video-converter.c:3406:12: error: implicit conversion from enumeration type 'GstVideoFormat' to different
      enumeration type 'GstFormat' [-Werror,-Wenum-conversion]
  format = convert->fformat[plane];
         ~ ^~~~~~~~~~~~~~~~~~~~~~~
video-converter.c:3413:44: error: implicit conversion from enumeration type 'GstFormat' to different enumeration
      type 'GstVideoFormat' [-Werror,-Wenum-conversion]
    gst_video_scaler_horizontal (h_scaler, format,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~            ^~~~~~
video-converter.c:3471:12: error: implicit conversion from enumeration type 'GstVideoFormat' to different
      enumeration type 'GstFormat' [-Werror,-Wenum-conversion]
  format = convert->fformat[plane];
         ~ ^~~~~~~~~~~~~~~~~~~~~~~
video-converter.c:3487:42: error: implicit conversion from enumeration type 'GstFormat' to different enumeration
      type 'GstVideoFormat' [-Werror,-Wenum-conversion]
    gst_video_scaler_vertical (v_scaler, format, lines, d + out_x, i,
    ~~~~~~~~~~~~~~~~~~~~~~~~~            ^~~~~~
video-converter.c:3551:12: error: implicit conversion from enumeration type 'GstVideoFormat' to different
      enumeration type 'GstFormat' [-Werror,-Wenum-conversion]
  format = convert->fformat[plane];
         ~ ^~~~~~~~~~~~~~~~~~~~~~~
video-converter.c:3569:46: error: implicit conversion from enumeration type 'GstFormat' to different enumeration
      type 'GstVideoFormat' [-Werror,-Wenum-conversion]
      gst_video_scaler_horizontal (h_scaler, format,
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~            ^~~~~~
video-converter.c:3577:42: error: implicit conversion from enumeration type 'GstFormat' to different enumeration
      type 'GstVideoFormat' [-Werror,-Wenum-conversion]
    gst_video_scaler_vertical (v_scaler, format, lines, d + out_x, i,
    ~~~~~~~~~~~~~~~~~~~~~~~~~            ^~~~~~
2015-02-10 16:38:05 +01:00
Luis de Bethencourt 4fb0095898 video-converter: bits variable always set
In function gst_video_scaler_vertical() the bits variable is always
set to either 8 or 16 in every possible format. No need to initialize it.

If the format isn't valid it goes to no_func, so there is no need to
handle the case of bits not being 8 or 16.

CID #1268401
2015-02-10 15:25:04 +00:00
Wim Taymans 622fa74a07 video-converter: only enable backlog for interlaced video
Skip lines we don't need.
2015-02-10 11:15:53 +01:00
Wim Taymans c15dfc30e5 video-converter: add fastpath for NV formats 2015-02-10 09:30:44 +01:00
Wim Taymans c6fcb5575a video-format: fix pstride of NV16 and NV24 formats 2015-02-10 09:22:50 +01:00
Wim Taymans 72bb2d8637 video-converter: Add more fastpaths
Add fastpaths for all planar conversion and scaling.
Improve gray and alpha handling.
Add option to specify the chroma resampler method and set to linear as
default.
2015-02-09 17:56:37 +01:00
Wim Taymans 2566675a78 video-converter: add generic planar scaler/converter
Add code to convert and scale between any planar format and use it in
the fastpaths of some planare converters.
2015-02-09 17:55:49 +01:00
Sebastian Dröge dc8181c12e video-converter: Fix compiler warnings by using the correct enum type
video-converter.c:3645:24: error: implicit conversion from enumeration type
      'GstFormat' to different enumeration type 'GstVideoFormat'
      [-Werror,-Wenum-conversion]
    convert->fformat = fformat;
                     ~ ^~~~~~~
video-converter.c:3667:24: error: implicit conversion from enumeration type
      'GstFormat' to different enumeration type 'GstVideoFormat'
      [-Werror,-Wenum-conversion]
    convert->fformat = fformat;
                     ~ ^~~~~~~
video-converter.c:3963:50: error: implicit conversion from enumeration type
      'const GstVideoFormat' to different enumeration type 'GstFormat'
      [-Werror,-Wenum-conversion]
        if (!setup_scale (convert, transforms[i].fformat))
             ~~~~~~~~~~~           ~~~~~~~~~~~~~~^~~~~~~
2015-02-09 10:20:37 +01:00
Wim Taymans 80ca1462cd video-converter: add more scaler fastpaths 2015-02-06 13:39:04 +01:00
Wim Taymans 72076e9521 video-orc: fix loading of param
param loading ignores the x4, loading only part of the param.
2015-02-06 13:25:51 +01:00
Wim Taymans bca801492b video-converter: add border and crop to more fastpaths 2015-02-06 12:35:58 +01:00
Wim Taymans a78ae80909 video-converter: fix border for YUY2 and friends
Convert as many pixels as the max subsampling so that we convert a
complete group of pixels.
2015-02-06 12:33:18 +01:00
Ravi Kiran K N bd836e12a1 video-converter: support AYUV border
Convert the border color from ARGB to AYUV, using
colorimetry matrix when output format is YUV.

https://bugzilla.gnome.org/show_bug.cgi?id=741640
2015-02-06 11:43:49 +01:00
Wim Taymans c78bdbfecb video-converter: fix swapped border width
And also do nothing when there is no border.
2015-02-06 11:43:49 +01:00
Wim Taymans 86c96e09cc video-converter: actually draw the border in some fastpaths
Don't forget to draw the border after doing the fastpath conversion.
2015-02-06 11:43:49 +01:00
Wim Taymans 8fe9299b00 video-converter: clamp width and heigth
Clamp the width and height based on the in and out offsets.
2015-02-06 11:43:49 +01:00
Wim Taymans 7b3bff644c video-format: add unaligned fallbacks
Add fallback C implementations for when we can't call the ORC function
because of bad alignment.
2015-02-06 11:43:49 +01:00
Jan Schmidt 7d4d63be21 video: Fix simple typo in GstVideoFrameMapFlags docs 2015-02-06 04:02:48 +11:00
Wim Taymans b5aa23697c video-converter: add crop and border to some fastpaths 2015-02-05 17:49:55 +01:00
Wim Taymans 6985511fc9 video-converter: add support for borders in scale fastpath
Add support for borders and cropping in the scaler fastpaths.
2015-02-05 17:18:20 +01:00
Wim Taymans 36a50778af video-converter: disable fastpath for crop and border
Add crop and border properties to the fastpath table and only select
fastpath functions when it can handle the cropping or borders.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=744028
2015-02-05 15:03:24 +01:00
Wim Taymans 3dfbd11fc8 video-converter: add fastpath for some gray formats 2015-02-04 18:01:51 +01:00
Wim Taymans 0737316e7e video-converter: add fastpath for some more RGB formats
Add fastpath for RGB and BGR.
Add fastpath for nearest resampling for RGB15 and RGB16 formats.
2015-02-04 17:44:31 +01:00
Wim Taymans 750909abce video-converter: skip lines we don't need
Make sure to skip unused lines instead of doing a useless horizontal
resampling.
2015-02-04 16:39:48 +01:00
Luis de Bethencourt d8308d5a8f video-resampler: make sure params.envelope is initialized
In gst_video_resampler_init () if method is GST_VIDEO_RESAMPLER_METHOD_NEAREST
then params.envelope is not initialized but still used later in line 382.
Make sure this variable is initiliazed to avoid undefined behaviour.

CID #1256568
2015-02-04 11:25:54 +00:00
Sebastian Dröge aa645b11f1 video{enc,dec}oder: Don't reset latency all the time and handle max=GST_CLOCK_TIME_NONE correctly
max=NONE means that *this* element has no maximum latency. If upstream had a
maximum latency we must not override it with NONE.
2015-02-03 12:24:01 +01:00
Sebastian Dröge 4e44f37abd video-converter: Fix compiler warnings
video-converter.c:3073:48: error: implicit conversion from enumeration type 'GstFormat' to different enumeration type 'GstVideoFormat'
      [-Werror,-Wenum-conversion]
        gst_video_scaler_horizontal (h_scaler, format,
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~            ^~~~~~
video-converter.c:3081:44: error: implicit conversion from enumeration type 'GstFormat' to different enumeration type 'GstVideoFormat'
      [-Werror,-Wenum-conversion]
      gst_video_scaler_vertical (v_scaler, format, lines, d, i, out_w);
      ~~~~~~~~~~~~~~~~~~~~~~~~~            ^~~~~~
video-converter.c:3137:24: error: implicit conversion from enumeration type 'const GstVideoFormat' to different enumeration type 'GstFormat'
      [-Werror,-Wenum-conversion]
    convert->fformat = GST_VIDEO_INFO_FORMAT (in_info);
                     ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../gst-libs/gst/video/video-info.h:125:43: note: expanded from macro 'GST_VIDEO_INFO_FORMAT'
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../gst-libs/gst/video/video-format.h:361:59: note: expanded from macro 'GST_VIDEO_FORMAT_INFO_FORMAT'
                                                  ~~~~~~~~^~~~~~
video-converter.c:3157:24: error: implicit conversion from enumeration type 'GstVideoFormat' to different enumeration type 'GstFormat'
      [-Werror,-Wenum-conversion]
    convert->fformat = GST_VIDEO_FORMAT_GRAY8;
2015-01-28 17:44:57 +01:00
Sebastian Dröge 46e141067f video: Update orc files 2015-01-28 17:43:59 +01:00
Wim Taymans f29b966c79 video-converter: add fast-path scaler for some packed YUV formats
Add fast path scaling for YUY2 and other packed YUV formats. Add a new
method to merge the scalers of the Y and UV components into one scaler.
Add faster horizontal 2tap scaler.

See https://bugzilla.gnome.org/show_bug.cgi?id=741987
2015-01-28 17:32:12 +01:00
Wim Taymans ea3dcdc0da video-converter: the default is BAYER dithering 2015-01-28 17:30:14 +01:00
Wim Taymans 620dc30d0f video-converter: don't do dither when set to NONE 2015-01-28 17:29:45 +01:00
Wim Taymans e16377c0c8 video-scaler: fix taps calculation for pstride == 1
Take pstride into consideration when calculating the scaler taps.
2015-01-28 11:39:41 +01:00
Luis de Bethencourt 783204824d orc: update orc files 2015-01-27 13:39:14 +00:00
Wim Taymans e2864494fe video-converter: add fastpath for planar scaling
Add fastpaths for scaling of planar subsampled formats.

See https://bugzilla.gnome.org/show_bug.cgi?id=741987
2015-01-27 10:52:29 +01:00
Wim Taymans ba98d06767 video-scaler: add support for monochroma formats
Add support for scaling of images with pstride == 1. This can be used
to scale individual planes later.
Rework some of the scaling code to take the pstride as a parameter.
2015-01-27 10:52:29 +01:00
Wim Taymans 4ab23677a9 video-format: fix GBR unpack 2015-01-27 10:52:29 +01:00
Edward Hervey 5e69a0f898 video: Fix leaked dither object in error cases
Coverity CID : 1256564
2015-01-23 12:46:41 +01:00
Sebastian Dröge 2bd4ea6e8e Constify some static arrays everywhere 2015-01-21 09:49:47 +01:00
Alessandro Decina 5fd4e3e0b6 videoutils: keep caps features in account when building the downstream filter
See 00c2ce6 and https://bugzilla.gnome.org/show_bug.cgi?id=741263 for reference.
2015-01-15 13:59:10 +11:00
Mark Nauwelaerts 04d447a825 videoencoder: fix comment typo 2015-01-10 13:02:59 +01:00
Luis de Bethencourt 6992da94b0 video-dither: remove check for below zero for unsigned value
CLAMP checks both if value is '< 0' and '> max'. Value will never be a negative
number since it is an unsigned integer. Removing that check and only checking if
it is bigger than max and setting it appropriately.

CID 1256559
2015-01-09 15:38:09 +00:00
Luis de Bethencourt 23880ec874 video-resampler: remove check for below zero for unsigned value
CLAMP checks both if n_taps is '< 0' and '> max_taps'. n_taps will never be a
negative number because it is an unsigned integer. Removing that check and only
making sure it isn't set bigger than max.

CID 1256558
2015-01-09 15:28:06 +00:00
Sebastian Dröge 7a35321710 video: Add support for BT2020 colorspace (UHD) 2015-01-08 10:45:46 +01:00
Wim Taymans ff8129267e video-scaler: remove useless debug 2015-01-07 15:54:58 +01:00
Wim Taymans fff41f06be video-converter: add options to control chroma resampling
Add an option to disable chroma resampling.
Improve the matrix option values so that you can choose to use the input
or output matrix or disable conversion.
2015-01-07 15:52:57 +01:00
Song Bing e9c6c833c9 videopool: update video alignment after applying
Video buffer pool will update video alignment to respect stride alignment
requirement. But haven't updated it to video alignment in configure.
Which will cause user get wrong video alignment.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=741501
2014-12-22 09:25:04 -05:00
Sebastian Dröge 87d6c265a8 video{en,de}coder: Call reset() before the start() vfunc
This makes sure that the element is in the same state before start() is called
the very first time and every future call after the element was used already.

Also it ensure that we always have a clean state before start(), cleaned the
same way in every case.
2014-12-22 11:38:20 +01:00
Sebastian Dröge 098b42f36b video{en,de}coder: Reset the codec after calling the stop() vfunc
The stop() vfunc might mess with some of our fields we have just
reset, which could cause memory leaks or invalid state taken over
to later.

Also the stop() vfunc, or anything called until it from another thread,
might want to be able to use the fields that were just resetted and
become confused because of that.

In the decoder we already had a workaround for things like this happening,
this workaround is not needed anymore.
2014-12-22 11:33:14 +01:00
Thiago Santos 17a7fac1a1 video: audio: fix GI annotations for proxy caps function
Add the annotations to parameters that can be null and also for stating
the ownership of the returned caps
2014-12-17 19:15:24 -03:00
Thiago Santos 8085352fb3 videodecoder: expose getcaps virtual function
Allows subclasses to do custom caps query replies.

Also exposes the standard caps query handler so subclasses can just
extend on top of it instead of reimplementing the caps query proxying.

https://bugzilla.gnome.org/show_bug.cgi?id=741263
2014-12-17 19:15:23 -03:00
Thiago Santos 4956800549 videodecoder: accept-caps should only require fields from the template
With the new caps query results the caps returned might have extra fields
that are not required by the decoder (framerate for image decoders) and it
causes a regression making, for example, jpegdec reject caps that don't
have framerates.

The accept-caps implementation will do 2 checks:

1) Do subset check with the template caps, making sure all the required
fields that are present on the template are present on the received caps.
2) Do a intersection check with the result of a caps query, making sure
that downstream can accept the fields in the received caps.

https://bugzilla.gnome.org/show_bug.cgi?id=741263
2014-12-17 19:15:23 -03:00
Thiago Santos 00c2ce60c3 videoutils: proxy filter when doing a caps query downstream
Allows downstream to use the filter and possibly reduce caps complexity
to speed up negotiation

https://bugzilla.gnome.org/show_bug.cgi?id=741263
2014-12-17 19:15:23 -03:00
Thiago Santos f492085552 videoutils: return empty if the element has no possible allowed caps
Instead of returning the template caps and having a failure happen
later because there are no possible caps

https://bugzilla.gnome.org/show_bug.cgi?id=741263
2014-12-17 19:15:23 -03:00
Thiago Santos f24075887f videodecoder: implement caps query
Refactor the encoder's caps query proxying function to a common place
and use it in the videodecoder to proxy downstream restrictions.

The new function is private to the gstvideo lib.

https://bugzilla.gnome.org/show_bug.cgi?id=741263
2014-12-17 19:15:23 -03:00
Song Bing 8baf1ec500 videopool: update buffer size after video alignment
Update the new buffer size after alignment in the pool configuration
before calling the parent set_config. This ensures that the parent knows
about the buffer size that we will allocate and makes the size check
work in the release_buffer method.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=741420
2014-12-16 12:14:53 +01:00
Edward Hervey ff57f69134 video: Fix non-default usage of gst_video_sink_center_rect
Make sure we take into account non-0 x/y destination rectangles
2014-12-15 14:11:07 +01:00
Sebastian Dröge ee2418effd video: Update disted orc source files 2014-12-12 10:02:43 +01:00
Sebastian Dröge 3fc5791b3f Revert "video-converter: Fix compiler warning because of missing prototype of non-static function"
This reverts commit 406f32a946.

The problem was apparently that my video-orc.h was not updated and did not
include the prototype for that function. Only a "make clean" caused it to
be regenerated.
2014-12-12 10:01:36 +01:00
Sebastian Dröge 406f32a946 video-converter: Fix compiler warning because of missing prototype of non-static function
video-converter.c:838:1: error: no previous prototype for function
      '_custom_video_orc_matrix8' [-Werror,-Wmissing-prototypes]
2014-12-12 09:51:05 +01:00
Thiago Santos 2034e5c153 videodecoder: do not use fixed caps on source pad
decoders can change the caps on their source pads, so they don't
use fixed caps. Having fixed caps can cause renegotiation issues.
2014-12-11 17:35:03 -03:00
Wim Taymans 903ba19593 video-orc: make RGB pack/unpack faster
Avoid all the merging and splitting and use a pair of shifts and or
2014-12-10 16:43:34 +01:00
Jan Schmidt 6e492304dd videodecoder: Add GST_VIDEO_DECODER_CAST macro
It's used in some macros already, so let's make it exist.
2014-12-11 01:53:15 +11:00
Wim Taymans a0b8e96b77 video-converter: set bits and format after conversion
Update the current format, bits and pstride.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=741187
2014-12-06 21:05:00 +01:00
Thiago Santos 5db596495b video-converter: free dither_lines
Avoid a memory leak
2014-12-05 22:23:55 -03:00
Wim Taymans 4ffd723c95 video-converter: use custom backup function
Use the new orc feature to set a custom backup function.
2014-12-05 14:51:28 +01:00
Wim Taymans 04e9a8dcc5 video-converter: improve matrix8 function
Avoid using a constant.
Avoid doing saturated adds, results are not supposed to overflow here.
Rework the C backup function a little in preparation for custom backup
functions in ORC.

See https://bugzilla.gnome.org/show_bug.cgi?id=741015
2014-12-05 12:20:26 +01:00
Wim Taymans e2a693656b video-converter: fix chroma resampling check
Decide if we need chroma resampling by checking if we have a progressive
or interlaced chroma resampler.
2014-12-03 10:17:29 +01:00
Wim Taymans 6757296386 video-converter: only do dithering when needed
Only do dithering when one of the quantizers is > 1.
2014-12-03 10:17:29 +01:00
Wim Taymans fc1d24ec45 video-scaler: add where orc functions could go
Add the disabled orc functions in #if 0 lines for when we can enable
them.
2014-12-02 15:11:12 +01:00
Wim Taymans d03136f1ea video-converter: add dithering
Use the new dither object to perform dithering.
Add option to select dithering method.
Add option to quantize to a specific value
2014-12-02 15:10:49 +01:00
Wim Taymans dfb202a117 video-converter: add palette when needed 2014-12-02 15:10:49 +01:00
Wim Taymans 0f2be22e76 video-dither: add video dither helper object
Add a new object that implements various dithering methods.
2014-12-02 15:10:43 +01:00
Sebastian Dröge 90eb93c2ef Don't compare booleans for equality to TRUE and FALSE
TRUE is 1, but every other non-zero value is also considered true. Comparing
for equality with TRUE would only consider 1 but not the others.
2014-12-01 09:51:12 +01:00
Sebastian Dröge afcc0b3c50 video-frame: Mapping a frame with inconsistent values between GstVideoMeta and GstVideoInfo is a bug
It will cause the frame to be initialized with inconsistent values that then
later can cause crashes or any other kind of interesting and hard to debug
bugs.
2014-11-28 10:27:28 +01:00
Tim-Philipp Müller 57811331de video-blend: make use of x offset when unpacking overlay image pixels
Now that it's implemented we can use it, which is a minor
optimisation when the image to overlay gets cropped on the
left.
2014-11-27 15:29:48 +00:00
Tim-Philipp Müller 60d18149e5 video-format: sprinkle some 'restrict' keywords in pack/unpack functions
In cases where we just call orc directly this is somewhat
superfluous, but let's do it anyway for consistency. In
other cases the compiler can hopefully use this to optimise
memory access a little.
2014-11-27 15:04:12 +00:00
Wim Taymans 52d4dd1cb0 video-format: handle x offset in unpack
Add support for x offset in almost all unpack methods.
Fix naming of source and dest pixels.
Add const to source pixels.
2014-11-27 13:01:03 +01:00
Wim Taymans a3da634db6 video-format: improve unpack i420
unpack_i420 does not need extra code to handle odd widths, the orc code
already handles it fine.
2014-11-27 10:51:58 +01:00
Wim Taymans 0e3bfbd996 video-scale: combine adds when max_taps equals combine size
When the amount of pixels/lines matches the amount we can combine,
combine the adds and multiplies and do the scale as a separate
operation.
2014-11-25 17:42:07 +01:00
Wim Taymans 74e63fa660 video-scaler: combine scaling operations
Combine add and scale of multiple lines/pixels to reduce the amount of
read and writes to temporary memory.
2014-11-25 17:27:07 +01:00
Wim Taymans b1eb3b7d81 video-resampler: remove print 2014-11-25 10:36:13 +01:00
Wim Taymans 1d55bde5bb video-resampler: improve variable taps
Improve quality of variable taps on all methods by reusing the lanczos
parameters where possible.
2014-11-25 10:34:02 +01:00
Wim Taymans 721bbcad34 video-resampler: Fix lanczos parameters for variable taps
when using variable taps and when we are limiting the number of taps,
recalculate the lanczos parameters to match the clamped value.
Set the max number of taps to 128
2014-11-25 10:34:02 +01:00
Wim Taymans db304a446b video-converter: keep track of required temp lines
Make a small object to hold a pool of allocated temp lines.
Keep track of how many temp lines each conversion stage needs and use
this to allocate just enough temp lines from the temp lines object. from
the temp lines object.
2014-11-24 12:52:26 +01:00
Wim Taymans e182abcf79 video-converter: use err line in fastpath
Use the error line for temporary storage in the fastpath so that we
don't have to allocate any other temp lines.
2014-11-24 12:52:26 +01:00
Matej Knopp 9d349d8831 videoencoder: don't complain about PTS != DTS on keyframes
It is valid for streams with b-frames

https://bugzilla.gnome.org/show_bug.cgi?id=740556
2014-11-22 16:12:16 -05:00
Wim Taymans b9bee1af8c video-converter: handle mixed interlaced
When dealing with mixed interlaced, setup a scaler and chroma-resampler
for both interlaced and progressive frames and switch between them
depending on the interlace mode of the input frame.
2014-11-21 16:06:54 +01:00
Wim Taymans 0358e23baf video-converter: Cleanup options parsing
Cleanup option parsing
Add some debug
2014-11-21 16:04:11 +01:00
Wim Taymans d001b10f29 video-converter: there is no need to apply x offset to temp lines 2014-11-21 15:59:47 +01:00
Wim Taymans 1a3e8395bb video-scaler: ensure both fields have the same number of taps 2014-11-21 15:58:34 +01:00
Wim Taymans eefdba6dbd video-converter: rework the options a little
Rework the options a little to make it nicer to set defaults.
2014-11-21 11:15:04 +01:00
Wim Taymans 7b7270ecff video-resampler: add option to limits taps
Add an option to limit the number of taps to use in automatic mode. The
problem is that for lanczos, we might use more taps than what we can
handle with the current precision.
Rework the other options a little to make it nicer to set defaults.
2014-11-21 11:12:50 +01:00
Wim Taymans 6620ab9d31 video: update orc files 2014-11-20 18:20:28 +01:00
Sebastian Dröge 823f170fac video-converter: Use correct enum, GstVideoFormat instead of GstFormat 2014-11-19 14:38:03 +01:00
Wim Taymans 9647a8ca78 video-converter: fix size check
Add some debug, fix size check that decides what scaling to do first and
when to do conversion.
2014-11-19 13:25:13 +01:00
Wim Taymans 23adc12e02 video-converter: avoid primaries conversion when asked
Don't do conversion between primaries when the option is disabled.
Only do some matrix code when needed.
2014-11-19 12:55:03 +01:00
Wim Taymans f6683b8f14 video-info: add a note about subsampled formats
Add a note about gst_video_info_set_format() and interlaced formats.
2014-11-19 12:55:03 +01:00
Wim Taymans 24989b53fc video-info: handle interlaced size correctly
Refactor GstVideoInfo init, make function to set default colorimetry.
Call fill_planes after we configure the GstVideoInfo with parameters
from the caps.
The size of the chroma planes for interlaced vertically subsampled
formats needs to be rounded up to 2, we have 2 fields with each
the same anount of chroma lines.
2014-11-19 12:55:03 +01:00
Wim Taymans 8f43cc67d5 video-color: return FALSE on unparsable colorimetry 2014-11-19 12:55:02 +01:00
Wim Taymans 5c043f3d50 video-format: handle unpack interlaced subsampled formats
For interlaced vertically subsampled formats the check for even lines
needs to take into account the two fields.
2014-11-19 12:55:02 +01:00
Wim Taymans 588fdeb834 video-scaler: fix interlaced shift 2014-11-19 12:55:02 +01:00
Wim Taymans ac756ba0d9 video-converter: keep a small backlog of lines
Allow lines to jump backwards slightly, usefull for interlaced content.
2014-11-19 12:55:02 +01:00
Wim Taymans b911434716 video-chroma: Fix interlaced chroma resampling
Use the interlaced flag to select the right resampler.
2014-11-19 12:55:02 +01:00
Wim Taymans d6ed383c6f video: add some more debuging 2014-11-19 12:55:02 +01:00
Wim Taymans 7d0cef3bcb video-scaler: fix interlacing some more
Use the right phase.
Take the right lines from interlaced content.
2014-11-19 12:55:02 +01:00
Wim Taymans 73349f14b9 video-converter: fix dither method 2014-11-19 12:55:02 +01:00
Wim Taymans c116da93f1 video-converter: fix some leaks
And remove some unused fields.
2014-11-19 12:55:02 +01:00
Wim Taymans cfc173e96b video-converter: add support for gamma and primaries
Keep only 1 structure with all matrix information.
Add structure to hold gamma information.
Add more options to control gamma, primaries and color matrix handling.
Add functions to compute transformations to and from XYZ and use this
to convert between primaries.
Merge gamma into the convert to and from RGB stage.
Fix border val.
Simplify the fastpath table, remove unused fields, add some more checks.
2014-11-19 12:55:02 +01:00
Wim Taymans 7c02acc544 video-color: add method to get primaries info 2014-11-19 12:55:02 +01:00
Wim Taymans 943e1319a2 video-color: fix default 601 primaries 2014-11-19 12:55:02 +01:00
Wim Taymans d03bad7761 video-scaler: fix interlaced taps setup 2014-11-19 12:55:02 +01:00
Wim Taymans c98bc6fdc6 video-color: make sRGB colorimetry the default for RGB 2014-11-19 12:55:02 +01:00
Wim Taymans 63012a07c5 video-converter: split YUV to and from RGB conversions
Prepare for doing full gamma corrected conversion and scaling by first
splitting the conversions from and to RGB into separate steps.
split scaling in downscaling and upscaling steps to be performed before
and after conversion respectively.
2014-11-19 12:55:02 +01:00
Wim Taymans f51bed2a3b video-converter: don't convert too much
because we do conversion after downscaling we only need to convert the
smallest width.
2014-11-19 12:55:02 +01:00
Wim Taymans fc5dd035fa video-converter: add orc splat functions to draw border 2014-11-19 12:55:02 +01:00
Tim-Philipp Müller 5339e4507a video-blend: minor optimisation
Only need to run matrix on those pixels which
will actually be used.
2014-11-16 23:26:45 +00:00
Tim-Philipp Müller 9396d843d6 video-blend: fix clipping of overlay images on the left
Fix clipping of images that are partially left of the video
surface, they would get clipped on the right side instead of
the left side, because the video unpack functions currently
ignore the x offset parameter. Work around that until that
is implemented.

https://bugzilla.gnome.org/show_bug.cgi?id=739281
2014-11-16 16:44:43 +00:00
Tim-Philipp Müller 2fae23c318 video-blend: fix allocation of temp src line for wide sources
Fix allocation of temporary source line buffers for source
images that are wider than the video overlay surface.
2014-11-16 16:44:36 +00:00
Vineeth T M 9032c12e69 video-blend: fix blending of rectangles partially or fully outside of the video
In case of overlay being completely or partially outside
the video frame, the offset calculations are not right,
which resulted in the overlay not being displayed as
expected, or crashes due to invalid memory access.

When the overlay rectangle is completely outside,
we need not render the overlay at all.

For partial display of overlay rectangles, src_yoff
was not being calculated, hence it was always clipping
the bottom half of the overlay, By calculating the
src_yoff, now the overlay is clipped properly.

https://bugzilla.gnome.org/show_bug.cgi?id=739281
2014-11-16 13:55:22 +00:00
Wim Taymans 61e84bc435 video-converter: take offset into account when unpacking
When we can directly take the input line from the source frame when
unpacking, also take into account the x offset.
2014-11-12 09:57:38 +01:00
Wim Taymans bb4863111b video-converter: add some notes 2014-11-12 09:57:12 +01:00
Wim Taymans b73096ce8c video-color: add gamma encode/decode functions
Add functions to encode and decode gamma.
Add unit test to check that encode and decode are eachothers inverse
and that the limits are respected.
2014-11-11 16:11:15 +01:00
Wim Taymans c5271a2eae video-orc: update disted file
and disable one failing function
2014-11-10 12:01:48 +01:00
Wim Taymans 70cdd9195f video-orc: use faster saturating conversions
saturating conversions are generally faster.
2014-11-10 11:45:52 +01:00
Wim Taymans dcd02cd323 video-chroma: add ORC version of UP_H2_CS
It is however slower than the C version and thus disabled.
2014-11-10 11:45:52 +01:00
Wim Taymans 39662d0393 video-chroma: ORCify 2x vertical upsampling
Make an ORC version of the 2x vertical upsampling code.
Improve unit tests, test chroma up and down sampling.
memset buffer in conversion to make valgrind happy.
2014-11-07 12:13:28 +01:00
Wim Taymans 780df29cb1 video-info: use h-cosited chroma for HD video by default 2014-11-06 18:19:44 +01:00
Wim Taymans 7690d97189 video-converter: clamp lines 2014-11-06 18:19:44 +01:00
Wim Taymans 87d59ac66d video-orc: update disted files 2014-11-06 16:29:16 +01:00
Wim Taymans d35c5fd75c video-converter: ORCify 8<->16 conversion 2014-11-06 16:26:24 +01:00
Wim Taymans da6f66e550 video-converter: unpack into the destination when needed
Make sure we write into the destination line when we can propose the
dest allocator.
2014-11-06 16:26:24 +01:00
Wim Taymans d148963c7a video-converter: add more debug 2014-11-06 16:26:24 +01:00
Sebastian Dröge 860dfa93c9 video: Update disted orc files 2014-11-06 15:01:27 +01:00
Wim Taymans 21f57317bb video-chroma: optimize chroma subsampling a little
Combine multiplies in 4x filters.
Rename conversion functions to make them nicer in orc.
Add ORC versions for various downsampling algorithms
Add unit test chroma resampler
2014-11-06 13:08:42 +01:00
Wim Taymans 57b9ea8f54 video-format: update some docs and add a FIXME(2.0) 2014-11-06 10:45:13 +01:00
Wim Taymans 0f64126919 video-format: add range extension to BGR_10XE format 2014-11-06 10:45:13 +01:00
Wim Taymans cecb900704 video-format: fix pack of 4:2:0 formats
When packing 4:2:0 formats, we need to take the chroma from the even
lines, for the odd lines we only take luminance.
2014-11-06 10:45:13 +01:00
Wim Taymans 1f14077b41 video-format: fix range extension of UYVP
We need to shift the top 6 bits to the lower 6 bits
2014-11-06 10:45:13 +01:00
Wim Taymans 3f44aaf810 video-chroma: do h subsampling after v subsampling
We only need to do the horizontal subsampling on 1 line if we do it
after vertical subsampling and we also avoid doing vertical subsampling
on unused pixels.
2014-11-06 10:45:13 +01:00
Wim Taymans 7888b4f9fa video-converter: keep separate lines with border
Make separate with a border around them so that we can avoid a memcpy.
2014-11-05 11:55:22 +01:00
Wim Taymans cf970376df video-scaler: avoid memcpy when not needed 2014-11-05 11:55:22 +01:00