Support for Image format "V4L2_PIX_FMT_JPEG"

Hello,
I am a newbie in SDL programming, I am trying to debug the ‘luvcview’ application (an simple open source video capture application) that would caputre video from a webcam and then display it on the PC screen. Although the ‘luvcview’ is able to display the video after a little bit modification of ‘luvcview’, the picture quality is not impressive. My webcam model is ‘Frontech e-cam’ as written on the camera, ‘lsusb’ tells it is ‘Microdia PC Camera (SN9C120)’, vendor-product id is: 0c45:6130. I am wondering what could be the reason of bad picture quality. One point I noticed could be the pixel format.
My camera supports only ‘BA81’ and ‘JPEG’, whereas while creating video surface we pass :
SDL_CreateYUVOverlay(videoIn->width, videoIn->height + 32, SDL_YUY2_OVERLAY, pscreen);

Here pixel format passed is different (which is SDL_YUY2_OVERLAY) than what my camera capture ( which is BA81/JPEG format). Can it be a reason of bad picture quality? If I am not wrong what should I pass for BA81/JPEG format to SDL_CreateYUVOverlay() function?

Regards,
Aveek

Hello,
I am a newbie in SDL programming, I am trying to debug the ‘luvcview’
application (an simple open source video capture application) that would
caputre video from a webcam and then display it on the PC screen. Although
the ‘luvcview’ is able to display the video after a little bit modification
of ‘luvcview’, the picture quality is not impressive. My webcam model is
’Frontech e-cam’ as written on the camera, ‘lsusb’ tells it is ‘Microdia PC
Camera (SN9C120)’, vendor-product id is: 0c45:6130. I am wondering what
could be the reason of bad picture quality. One point I noticed could
be the pixel format.
My camera supports only ‘BA81’ and ‘JPEG’, whereas while creating video
surface we pass :
SDL_CreateYUVOverlay(videoIn->width, videoIn->height +
32, SDL_YUY2_OVERLAY, pscreen);

Here pixel format passed is different (which is SDL_YUY2_OVERLAY) than what
my camera capture ( which is BA81/JPEG format). Can it be a reason of bad
picture quality? If I am not wrong what should I pass for BA81/JPEG format
to SDL_CreateYUVOverlay() function?

Regards,
Aveek

You might be able to pass off the jpeg data to SDL load image, and have that
return an RGB surface for you. Unfortunately IMG_Load* functions return a
new surface for you, rather than allowing you to pass in a surface. This
means that you will be allocating extra memory for each frame from the
camera. Probably worth using libjpeg directly for that.

Your other option is to convert from the BA81 format. The BA81 is probably
the camera native format… so that’s likely the best quality you’ll get.

cheers,On Fri, Jul 10, 2009 at 10:31 PM, Aveek Adhya wrote:

You are right, the BA81 is the camera native format and will give the best picture qualiry. I dont know what compression level the camera is using to get JPEG frames, but as it is a lossy compression technique, the image quality is getting degradated. In the ‘luvcview’ application they are ultimately converting JPEG frames to YUY2 format before rendering into the SDL surface. I would like to check the picture quality when camera captures in BA81 format. But the conversion function from BA81 to YUY2 is missing in the ‘luvcview’ application… it will eat few more days to fill the gaps.----- Original Message -----
From: Ren? Dudfield
To: A list for developers using the SDL library. (includes SDL-announce)
Sent: Monday, July 13, 2009 5:06 AM
Subject: Re: [SDL] support for Image format “V4L2_PIX_FMT_JPEG”

On Fri, Jul 10, 2009 at 10:31 PM, Aveek Adhya wrote:

Hello,
I am a newbie in SDL programming, I am trying to debug the 'luvcview' application (an simple open source video capture application) that would caputre video from a webcam and then display it on the PC screen. Although the 'luvcview' is able to display the video after a little bit modification of 'luvcview', the picture quality is not impressive. My webcam model is 'Frontech e-cam' as written on the camera, 'lsusb' tells it is 'Microdia PC Camera (SN9C120)', vendor-product id is: 0c45:6130. I am wondering what could be the reason of bad picture quality. One point I noticed could be the pixel format.
 My camera supports only 'BA81' and 'JPEG', whereas while creating video surface we pass :
SDL_CreateYUVOverlay(videoIn->width, videoIn->height + 32,     SDL_YUY2_OVERLAY, pscreen); 

Here pixel format passed is different (which is SDL_YUY2_OVERLAY) than what my camera capture ( which is BA81/JPEG format). Can it be a reason of bad picture quality? If I am not wrong what should I pass for BA81/JPEG format to SDL_CreateYUVOverlay() function?

Regards,
Aveek

You might be able to pass off the jpeg data to SDL load image, and have that return an RGB surface for you. Unfortunately IMG_Load* functions return a new surface for you, rather than allowing you to pass in a surface. This means that you will be allocating extra memory for each frame from the camera. Probably worth using libjpeg directly for that.

Your other option is to convert from the BA81 format. The BA81 is probably the camera native format… so that’s likely the best quality you’ll get.

cheers,



SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Have you looked at libv4l? http://hansdegoede.livejournal.com/

Probably has what you need in there. It’s becoming a wide spread
library, and has lots of useful goodies in it.

cu,On Mon, Jul 13, 2009 at 11:39 PM, Aveek Adhya wrote:

You are right, the BA81 is?the camera native format and will give the best
picture qualiry. I dont know?what compression?level the camera is using to
get ?JPEG frames, but as it?is a?lossy compression technique, the image
quality is getting degradated. In the ‘luvcview’ application they are
ultimately converting JPEG frames to YUY2 format before rendering into the
SDL surface. I?would like to?check the picture quality when camera captures
in BA81 format. But the conversion function from BA81 to YUY2 is missing in
the ‘luvcview’ application… it will?eat few more days to fill the gaps.

Thanks for the link … it tells a lot of stuff (in fact I couldn’t go
though it completely).
I am using v4l2 library…but I dont find any API that can convert a frame
form BA81 to YUY2 format. I got a link that talks about half way bayer
decode support in luvcview app, although its able to convert BA81 to YUY2
and display image from my webcam, the image quality is not that good. Dont
know why … need to dig more. This link is below:
http://lists-archives.org/spca50x-devs/01240-luvcview-half-working-bayer-decode-support.html> ----- Original Message -----

From: renesd@gmail.com (Rene Dudfield)
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Wednesday, July 15, 2009 6:21 AM
Subject: Re: [SDL] support for Image format “V4L2_PIX_FMT_JPEG”

On Mon, Jul 13, 2009 at 11:39 PM, Aveek Adhya wrote:

You are right, the BA81 is the camera native format and will give the best
picture qualiry. I dont know what compression level the camera is using to
get JPEG frames, but as it is a lossy compression technique, the image
quality is getting degradated. In the ‘luvcview’ application they are
ultimately converting JPEG frames to YUY2 format before rendering into the
SDL surface. I would like to check the picture quality when camera
captures
in BA81 format. But the conversion function from BA81 to YUY2 is missing
in
the ‘luvcview’ application… it will eat few more days to fill the
gaps.

Have you looked at libv4l? http://hansdegoede.livejournal.com/

Probably has what you need in there. It’s becoming a wide spread
library, and has lots of useful goodies in it.

cu,


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org