Removes some fields from data structs.
There are some fields that are just caching some calculus for buffer
size. The calculus were moved to the places it were needed and the now
unused fields were removed.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
{
int errCode, prev_alt = dev->alt;
int i;
{
int errCode, prev_alt = dev->alt;
int i;
- unsigned int min_pkt_size = dev->bytesperline + 4;
+ unsigned int min_pkt_size = dev->width * 2 + 4;
/* When image size is bigger than a certain value,
the frame size should be increased, otherwise, only
green screen will be received.
*/
/* When image size is bigger than a certain value,
the frame size should be increased, otherwise, only
green screen will be received.
*/
- if (dev->frame_size > 720*240*2)
+ if (dev->width * 2 * dev->height > 720 * 240 * 2)
min_pkt_size *= 2;
for (i = 0; i < dev->num_alt; i++) {
min_pkt_size *= 2;
for (i = 0; i < dev->num_alt; i++) {
{
void *fieldstart, *startwrite, *startread;
int linesdone, currlinedone, offset, lencopy, remain;
{
void *fieldstart, *startwrite, *startread;
int linesdone, currlinedone, offset, lencopy, remain;
-
- if (dev->frame_size != buf->vb.size) {
- em28xx_errdev("size %i and buf.length %lu are different!\n",
- dev->frame_size, buf->vb.size);
- return;
- }
+ int bytesperline = dev->width << 1;
if (dma_q->pos + len > buf->vb.size)
len = buf->vb.size - dma_q->pos;
if (dma_q->pos + len > buf->vb.size)
len = buf->vb.size - dma_q->pos;
if (buf->top_field)
fieldstart = outp;
else
if (buf->top_field)
fieldstart = outp;
else
- fieldstart = outp + dev->bytesperline;
+ fieldstart = outp + bytesperline;
- linesdone = dma_q->pos / dev->bytesperline;
- currlinedone = dma_q->pos % dev->bytesperline;
- offset = linesdone * dev->bytesperline * 2 + currlinedone;
+ linesdone = dma_q->pos / bytesperline;
+ currlinedone = dma_q->pos % bytesperline;
+ offset = linesdone * bytesperline * 2 + currlinedone;
startwrite = fieldstart + offset;
startwrite = fieldstart + offset;
- lencopy = dev->bytesperline - currlinedone;
+ lencopy = bytesperline - currlinedone;
lencopy = lencopy > remain ? remain : lencopy;
if ((char *)startwrite + lencopy > (char *)outp + buf->vb.size) {
lencopy = lencopy > remain ? remain : lencopy;
if ((char *)startwrite + lencopy > (char *)outp + buf->vb.size) {
remain -= lencopy;
while (remain > 0) {
remain -= lencopy;
while (remain > 0) {
- startwrite += lencopy + dev->bytesperline;
+ startwrite += lencopy + bytesperline;
- if (dev->bytesperline > remain)
+ if (bytesperline > remain)
- lencopy = dev->bytesperline;
+ lencopy = bytesperline;
if ((char *)startwrite + lencopy > (char *)outp + buf->vb.size) {
em28xx_isocdbg("Overflow of %zi bytes past buffer end (2)\n",
if ((char *)startwrite + lencopy > (char *)outp + buf->vb.size) {
em28xx_isocdbg("Overflow of %zi bytes past buffer end (2)\n",
struct em28xx_dmaqueue *vidq = &dev->vidq;
int rc = 0, urb_init = 0;
struct em28xx_dmaqueue *vidq = &dev->vidq;
int rc = 0, urb_init = 0;
- /* BUG_ON(NULL == fh->fmt); */
-
/* FIXME: It assumes depth = 16 */
/* The only currently supported format is 16 bits/pixel */
buf->vb.size = 16 * dev->width * dev->height >> 3;
/* FIXME: It assumes depth = 16 */
/* The only currently supported format is 16 bits/pixel */
buf->vb.size = 16 * dev->width * dev->height >> 3;
if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size)
return -EINVAL;
if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size)
return -EINVAL;
buf->vb.width = dev->width;
buf->vb.height = dev->height;
buf->vb.field = field;
buf->vb.width = dev->width;
buf->vb.height = dev->height;
buf->vb.field = field;
f->fmt.pix.width = dev->width;
f->fmt.pix.height = dev->height;
f->fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
f->fmt.pix.width = dev->width;
f->fmt.pix.height = dev->height;
f->fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
- f->fmt.pix.bytesperline = dev->bytesperline;
- f->fmt.pix.sizeimage = dev->frame_size;
+ f->fmt.pix.bytesperline = dev->width * 2;
+ f->fmt.pix.sizeimage = f->fmt.pix.bytesperline * dev->height;
f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
/* FIXME: TOP? NONE? BOTTOM? ALTENATE? */
f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
/* FIXME: TOP? NONE? BOTTOM? ALTENATE? */
/* set new image size */
dev->width = f->fmt.pix.width;
dev->height = f->fmt.pix.height;
/* set new image size */
dev->width = f->fmt.pix.width;
dev->height = f->fmt.pix.height;
- dev->frame_size = dev->width * dev->height * 2;
- dev->field_size = dev->frame_size >> 1;
- dev->bytesperline = dev->width * 2;
get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale);
em28xx_set_alternate(dev);
get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale);
em28xx_set_alternate(dev);
/* set new image size */
dev->width = f.fmt.pix.width;
dev->height = f.fmt.pix.height;
/* set new image size */
dev->width = f.fmt.pix.width;
dev->height = f.fmt.pix.height;
- dev->frame_size = dev->width * dev->height * 2;
- dev->field_size = dev->frame_size >> 1;
- dev->bytesperline = dev->width * 2;
get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale);
em28xx_resolution_set(dev);
get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale);
em28xx_resolution_set(dev);
if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->users == 0) {
dev->width = norm_maxw(dev);
dev->height = norm_maxh(dev);
if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->users == 0) {
dev->width = norm_maxw(dev);
dev->height = norm_maxh(dev);
- dev->frame_size = dev->width * dev->height * 2;
- dev->field_size = dev->frame_size >> 1; /*both_fileds ? dev->frame_size>>1 : dev->frame_size; */
- dev->bytesperline = dev->width * 2;
dev->hscale = 0;
dev->vscale = 0;
dev->hscale = 0;
dev->vscale = 0;
dev->width = maxw;
dev->height = maxh;
dev->interlaced = EM28XX_INTERLACED_DEFAULT;
dev->width = maxw;
dev->height = maxh;
dev->interlaced = EM28XX_INTERLACED_DEFAULT;
- dev->field_size = dev->width * dev->height;
- dev->frame_size =
- dev->interlaced ? dev->field_size << 1 : dev->field_size;
- dev->bytesperline = dev->width * 2;
dev->hscale = 0;
dev->vscale = 0;
dev->ctl_input = 2;
dev->hscale = 0;
dev->vscale = 0;
dev->ctl_input = 2;
/* common v4l buffer stuff -- must be first */
struct videobuf_buffer vb;
/* common v4l buffer stuff -- must be first */
struct videobuf_buffer vb;
- struct em28xx_fmt *fmt;
-
struct list_head frame;
int top_field;
int receiving;
struct list_head frame;
int top_field;
int receiving;
/* frame properties */
int width; /* current frame width */
int height; /* current frame height */
/* frame properties */
int width; /* current frame width */
int height; /* current frame height */
- int frame_size; /* current frame size */
- int field_size; /* current field size */
- int bytesperline;
int hscale; /* horizontal scale factor (see datasheet) */
int vscale; /* vertical scale factor (see datasheet) */
int interlaced; /* 1=interlace fileds, 0=just top fileds */
int hscale; /* horizontal scale factor (see datasheet) */
int vscale; /* vertical scale factor (see datasheet) */
int interlaced; /* 1=interlace fileds, 0=just top fileds */
unsigned int stream_on:1; /* Locks streams */
int radio;
unsigned int stream_on:1; /* Locks streams */
int radio;
- unsigned int width, height;
struct videobuf_queue vb_vidq;
struct videobuf_queue vb_vidq;
- struct em28xx_fmt *fmt;
enum v4l2_buf_type type;
};
enum v4l2_buf_type type;
};