[MPlayer-dev-eng] [PATCH] Check filter for ACCEPT_STRIDE in vf_get_image (try 2)

John Koleszar jkoleszar at on2.com
Mon Dec 5 22:30:49 CET 2005


Here's an updated patch to correct the issue of vf_get_image returning 
images with strides in situations where the next filter in the chain 
doesn't accept them. Two examples of such filters are ve_raw and vo_sdl 
(in some cases). The premise of this patch is that filters do not have 
to accept images with strides as input, and that it is a bug to pass 
such an image to a filter that doesn't claim to support it. I view this 
as orthagonal to whether the filters should be made to accept these 
types of images.

This patch supercedes the ones I attached to the thread "raw filter 
(ve_raw.c) writing improper frame data." It is very similar to one of 
those, but I had the logic backwards before. I've tested it with several 
filter chains, and it defers changing the storage size as long as 
possible, so performance should be preserved as much as possible. Example:

$ mencoder -v -ovc raw -vf mirror,format=yuy2,mirror -o test.avi 
mobile_378_203_rle.mov
<snip>
Trying filter chain: scale mirror format mirror expand raw
<snip>
*** [scale] Allocating mp_image_t, 384x208x16bpp BGR packed, 159744 bytes
*** [mirror] Allocating mp_image_t, 384x203x16bpp YUV packed, 155904 bytes
*** [mirror] Allocating mp_image_t, 378x203x16bpp YUV packed, 153468 bytes
*** [raw] Allocating mp_image_t, 378x203x16bpp YUV packed, 153468 bytes
*** [expand] Direct Rendering mp_image_t, 378x203x16bpp YUV packed, 
153468 bytes

For what it's worth, I did look into updating the filters to support 
images with strides. It's fairly trivial in the case of ve_raw, but 
vo_sdl is more complicated. The pitch of the surface doesn't appear (to 
me) to be known at configuration time, for one thing. In any case, it 
seems like doing so would be treating the symptoms and not the disease.

Example commands that exhibit this problem:

$ mplayer -vo sdl mobile_378_203_rle.mov
$ mencoder -ovc raw -o test.avi mobile_378_203_rle.mov

A test clip is available at:
ftp://opensource:opensource@ftp.on2.com/mobile_378_203_rle.mov

I suspect other material that's not 16px aligned would exhibit this 
behavior as well, although it may have the additional restriction of 
being in an RGB colorspace. vo_sdl does appear to support strides when 
using the YUV overlay, though I haven't tested that with oddly sized 
material at this point.

Feedback?

John

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fix_img_size_vf_rev2.diff
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20051205/a916d71c/attachment.asc>


More information about the MPlayer-dev-eng mailing list