Hi all.
I am developing a video player using libav* to play streams from different
video cameras.
One of its tasks is a digital zoom. Only part of the image is zoomed,
player's window doesn't change.
To do it, I crop top and left part of a picture with av_picture_crop() and
copy/convert the rest to the DirectDraw surface using sws_scale().
Everything works perfect, when I display a color picture, possible formats
are PIX_FMT_YUV420P or PIX_FMT_YUV422P.
The problem is that when the source video has format PIX_FMT_GRAY8, the
resulting picture has linesize[] = {2560, 0, 0, 0} and displayed
incorrectly.
I use the code, similar to the following. The initialization is, of course,
more complicated, I've reduced it to simple assignments.
scale_w = 581;
scale_h = 237;
pic_crp.linesize = {581,0,0,0};
m_pixfmt = PIX_FMT_GRAY8;
m_dst_format = PIX_FMT_BGRA;
pic_dst pointers are assigned to the DDraw surface.
m_img_convert_ctx = sws_getCachedContext(m_img_convert_ctx,
scale_w,scale_h,(PixelFormat)m_pixfmt,
m_wnd_width, m_wnd_height,
m_dst_format,
SWS_FAST_BILINEAR, 0, 0, 0);
if (m_img_convert_ctx){
sws_scale(m_img_convert_ctx, pic_crp.data, pic_crp.linesize,
0, scale_h, pic_dst.data, pic_dst.linesize);
}
I also tried using Direct3D - the result is the same. Color picture is
perfectly displayed and zoomed, grayscale one - not.
Is it a bug in sws, or should I do something additionally in case of
grayscale picture?
--
View this message in context:
http://old.nabble.com/Problem-with-sws_scale.-tp26524987p26524987.html
Sent from the libav-users mailing list archive at Nabble.com.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user