efficiently downscaling subsampled video to full resolution chroma

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

efficiently downscaling subsampled video to full resolution chroma

Douglas Bagnall-2
hi

My element wants to analyse small video frames with the luma and
chroma planes at the same resolution. The source video has subsampled
chroma.

If I scale the video first (i.e. videoscale ! videoconvert), I lose
chroma information because it goes down to half resolution before
being scaled up. If I convert the chroma first, I waste time doubling
the large chroma planes just to shrink them again.

I'm guessing I have to do the latter and just not worry about it. Is
that the case?

regards
Douglas Bagnall
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: efficiently downscaling subsampled video to full resolution chroma

Douglas Bagnall-2
On 05/08/17 12:58, Douglas Bagnall wrote:

> hi
>
> My element wants to analyse small video frames with the luma and
> chroma planes at the same resolution. The source video has subsampled
> chroma.
>
> If I scale the video first (i.e. videoscale ! videoconvert), I lose
> chroma information because it goes down to half resolution before
> being scaled up. If I convert the chroma first, I waste time doubling
> the large chroma planes just to shrink them again.

OK, I have an intermediate solution: scale down to twice the target
size, convert, then scale again.

That goes something like this (starting with 1920x1080 Y420):

gst-launch-1.0 uridecodebin uri="file://$video" ! \
               videorate ! \
               videoscale ! \
               video/x-raw,framerate=4/1,width=768,height=432 ! \
               videoconvert ! \
               videoscale ! \
               video/x-raw,format=Y444,framerate=4/1,width=384,height=216  ! \
               fakesink

which is ~3.5 times faster than the convert-first method:

gst-launch-1.0 uridecodebin uri="file://$video" ! \
               videorate ! \
               videoconvert ! \
               videoscale ! \
               video/x-raw,format=Y444,framerate=4/1,width=384,height=216  ! \
               fakesink

and ~1.5 times slower than the scale-first method that loses chroma
resolution.

cheers,
Douglas
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel