efficiently downscaling subsampled video to full resolution chroma

Douglas Bagnall douglas at halo.gen.nz
Sat Aug 5 02:48:25 UTC 2017


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


More information about the gstreamer-devel mailing list