Commit graph

108 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
620dc30d0f video-converter: don't do dither when set to NONE 2015-01-28 17:29:45 +01: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
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
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