Commit graph

62 commits

Author SHA1 Message Date
Wim Taymans
7a02e9676f video-scaler: take number of bits into account when copying
Copy twice the amount of pixels for 16 bits formats.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=747225
2016-09-22 16:17:33 +02:00
Wim Taymans
5e752f4eda video-converter: fix interlaced scaling some more
Fix problem with the line cache where it would forget the first line in
the cache in some cases.
Keep as much backlog as we have taps. This generally works better and we
could do even better by calculating the overlap in all taps.
Allocated enough lines for the line cache.
Use only half the number of taps for the interlaced lines because we
only have half the number of lines.
The pixel shift should be relative to the new output pixel size so scale
it.
Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=767921
2016-06-22 16:21:13 +02:00
Joan Pau Beltran
abb88801e7 video: add IYU2 format
This existed in 0.10 and is needed by dc1394src.

IYU2 format is a YUV fully-sampled packed format similar to v308
but with different component order (U-Y-V instead of Y-U-V).

http://www.fourcc.org/yuv.php#IYU2

https://bugzilla.gnome.org/show_bug.cgi?id=763026#c5
2016-06-01 12:07:05 +01:00
Wim Taymans
14083178b8 video: improve logging
Add logging categories for most video objects.
Remove some useless debug lines in video-info and videotestsrc.
Add a performance debug line in the video scaler.
2015-07-15 12:47:42 +02:00
Tobias Mueller
190c7f1928 GstVideoScaler: Initialised scaling functions to get rid of compiler messages
E.g.

video-scaler.c: In function 'gst_video_scaler_horizontal':
video-scaler.c:1332:3: error: 'func' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   func (scale, src, dest, dest_offset, width, n_elems);
   ^

video-scaler.c: In function 'gst_video_scaler_vertical':
video-scaler.c:1373:3: error: 'func' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   func (scale, src_lines, dest, dest_offset, width, n_elems);
   ^

GCC's analyses seem to be correct, for the simple fact that if you pass
get_functions a known format, but no hscale or vscale, it'll return
True without having done anything.
Some callers check for the scale values to be not NULL, but then
hscale->resampler.max_taps could return 0.
A different approach to the one presented in this patch is to check
for those max_taps, too, before calling get_functions.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=752051
2015-07-07 13:06:34 +02:00
Luis de Bethencourt
6e263cc5f6 videoscaler: 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 a division of an unsigned integer (i). Removing that check
and only checking if it is bigger than max and setting it appropriately.

CID #1308950
2015-06-29 16:18:49 +01:00
Wim Taymans
f4a5277340 video-scaler: fix scaling of odd width for YUY2 formats
We need to scale groups of 4 bytes for YUY2 formats so round up to 4.
It's possible that there is no Y byte for the last pixel so make sure
we clamp correctly.
2015-06-17 16:43:03 +02:00
Nicolas Dufresne
65b7b9954a gi: Skip Scaler, Chroma, Conveter, Dither constructor
Please box these types before removing the skip mark.
2015-06-16 16:08:39 -04:00
Wim Taymans
b31c805a56 video-scaler: enforce same taps when combining scalers 2015-06-12 16:58:10 +02:00
Wim Taymans
1fbbff491a video-scaler: make sure to clamp to max width
When estimating the area that should first be vertically scaled, make
sure we clamp to the max input size or else we get invalid reads.
2015-06-12 16:58:10 +02:00
Wim Taymans
f4f3894836 video-scaler: Enforce same taps on Y and UV scalers for merged formats
Make sure we have the same number of taps for the Y and UV scalers so
that the scalers can be merged correctly.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=749764
2015-06-12 16:58:10 +02:00
Stefan Sauer
b3c136eb4f docs: a random set of trivial fixes for the library docs
Warnings down to 35, unused symbols doen to 112.
2015-05-18 21:16:41 +02:00
Stefan Sauer
b364f5576d docs: a random set of trivial fixes for the library docs
All those where super straight forward from the warnings gtkdoc prints. It kind
of makes sense to apply them before the list of warnings is >100 and people
complain that gtkdoc is noisy.
2015-05-18 20:45:45 +02:00
Aurélien Zanelli
c52adc8fcc video: add NV61 format support
https://bugzilla.gnome.org/show_bug.cgi?id=746466
2015-05-04 20:37:59 +01:00
Wim Taymans
0588c9a53f video-scaler: fix YUY2 scaling some more
Take into account the different steps between Y and UV when calculating
the line size for vertical resampling or else we might not resample
enough pixels and leave bad lines.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=747790
2015-04-21 13:31:44 +02:00
Wim Taymans
8f82ee70f9 video-scaler: scale enough pixels in YUY2 (and friends) mode
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=747790
2015-04-21 13:16:29 +02: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
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
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
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
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
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
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
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
80ca1462cd video-converter: add more scaler fastpaths 2015-02-06 13:39:04 +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
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
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
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
ff8129267e video-scaler: remove useless debug 2015-01-07 15:54:58 +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
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
1a3e8395bb video-scaler: ensure both fields have the same number of taps 2014-11-21 15:58:34 +01:00
Wim Taymans
588fdeb834 video-scaler: fix interlaced shift 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
d03bad7761 video-scaler: fix interlaced taps setup 2014-11-19 12:55:02 +01:00
Wim Taymans
cf970376df video-scaler: avoid memcpy when not needed 2014-11-05 11:55:22 +01:00
Wim Taymans
3286320297 video-scaler: fix temp line allocation
We need to allocate the templine with the amount of pixels we are going
to handle, which we only know for the vertical resampler when we are
asked to resample.
2014-11-04 17:38:11 +01:00
Wim Taymans
67a4702b19 video-scaler: fix taps in interlaced mode 2014-11-04 17:38:11 +01:00
Wim Taymans
562416bb94 video-scaler: fix phases in interlaced mode 2014-11-04 17:38:11 +01:00
Wim Taymans
bd6d2b40d1 video-scaler: add support for 16bits formats
Add scaler functions for 16 bits formats.
Rename the scaler functions so that 16bits versions don't look too
weird.
Remove old unused h_2tap functions
Fix v_ntap functions, it was using 1 tap too little.
2014-11-03 15:41:02 +01:00
Sebastian Dröge
b4ee10f616 video-scaler: Fix compiler warning
video-scaler.c:151:58: error: implicit conversion from enumeration type
      'GstVideoScalerFlags' to different enumeration type
      'GstVideoResamplerFlags' [-Werror,-Wenum-conversion]
    gst_video_resampler_init (&scale->resampler, method, flags, out_size,
    ~~~~~~~~~~~~~~~~~~~~~~~~                             ^~~~~
2014-11-03 08:12:44 +01:00
Tim-Philipp Müller
c409d134de video: fix some g-i / gtk-doc warnings 2014-11-01 14:58:13 +00:00
Wim Taymans
ceee8d5d40 video-scaler: ORCify vertical ntap function 2014-11-01 13:15:29 +01:00
Wim Taymans
45462d2ea4 video-scaler: handle 4tap interlaced 2014-11-01 13:15:29 +01:00