[mythtv-users] nonlinear 16:9 stretch?

Robert Denier rdenier at finiteinfinity.org
Mon Nov 21 17:07:40 EST 2005


On Monday 21 November 2005 03:20 pm, David wrote:
> Robert Denier wrote:
> >On Monday 21 November 2005 02:14 pm, Cory Papenfuss wrote:
[snip]

I spent a few minutes and tried to figure out a quick way to do this non 
linear stretch.  I could maybe come up with something nicer later as for as a 
function to do the stretch, but the problem is this needs to be real time, 
and if it gets too fancy it takes significant resources.

Assume input video is X horizontal pixels.  The exact number doesn't matter, 
but for simplicity 480 will be assumed here.  Assume further that you can 
divide it into 10 equally, or nearly equally wide vertical stripes.

1) For the stripe on the far left you could repeat each pixel 3 times.
2) For the next two stripe repeat each 2 times.
3) Then stripes four through seven are just a normal one:one mapping.
4) The next two stripes would be the same as (2).
5) The final stripe would be the same as (1)

In other words the pattern for repeating pixels would be... 
[3,2,2,1,1,1,1,2,2,3]

Depending on the true original horizontal pixel size one might have to adjust 
the video scaling parameters to make sure the center section has the right 
overall ratio.

The advantages to such an approach are

1) Very fast
2) Somestimes just repeating pixels makes things less blurry, but thats usualy 
not an issue.

The disadvantages
1) It is a non smooth way to stretch an image.  Something bicubic or similar 
would be cleaner, at the expense of cpu time.
2) This may look poor in practice, although I suppose one would have to try 
it.  It is just the simplest approach I could think of quickly to do this.

-Robert







More information about the mythtv-users mailing list