Commit graph

88 commits

Author SHA1 Message Date
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
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
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 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
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
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
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 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
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 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