diff options
author | Michael Hunold <devnull@localhost> | 2003-08-26 09:25:08 +0000 |
---|---|---|
committer | Michael Hunold <devnull@localhost> | 2003-08-26 09:25:08 +0000 |
commit | f9098729fedb671ccb394a117b93b52c8dab2d37 (patch) | |
tree | 8d2b08bdb646cb252ce1bb33985a98ef0bff0aa4 | |
parent | ebb1fa049891f78de96b0828ace7e984489bddf5 (diff) | |
download | mediapointer-dvb-s2-f9098729fedb671ccb394a117b93b52c8dab2d37.tar.gz mediapointer-dvb-s2-f9098729fedb671ccb394a117b93b52c8dab2d37.tar.bz2 |
Fix bytesperline-calculation for
V4L2_FIELD_ALTERNATE vs. V4L2_FIELD_INTERLACED captures
-rw-r--r-- | linux/drivers/media/common/saa7146_core.c | 3 | ||||
-rw-r--r-- | linux/drivers/media/common/saa7146_video.c | 26 |
2 files changed, 14 insertions, 15 deletions
diff --git a/linux/drivers/media/common/saa7146_core.c b/linux/drivers/media/common/saa7146_core.c index b44ef24f4..574b785be 100644 --- a/linux/drivers/media/common/saa7146_core.c +++ b/linux/drivers/media/common/saa7146_core.c @@ -172,7 +172,8 @@ void saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *p /* ptr = pt->cpu; - for(i=0;i<60;i++) { + printk("offset: %d\n",pt->offset); + for(i=0;i<5;i++) { printk("ptr1 %d: 0x%08x\n",i,ptr[i]); } */ diff --git a/linux/drivers/media/common/saa7146_video.c b/linux/drivers/media/common/saa7146_video.c index af13891b9..e0bf38f16 100644 --- a/linux/drivers/media/common/saa7146_video.c +++ b/linux/drivers/media/common/saa7146_video.c @@ -169,7 +169,8 @@ static int try_fmt(struct saa7146_fh *fh, struct v4l2_format *f) struct saa7146_format *fmt; enum v4l2_field field; int maxw, maxh; - + int calc_bpl; + DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n",dev,fh)); fmt = format_by_fourcc(dev,f->fmt.pix.pixelformat); @@ -212,19 +213,16 @@ static int try_fmt(struct saa7146_fh *fh, struct v4l2_format *f) if (f->fmt.pix.height > maxh) f->fmt.pix.height = maxh; - if (f->fmt.pix.bytesperline == 0) { - f->fmt.pix.sizeimage = (f->fmt.pix.width * f->fmt.pix.height * fmt->depth)/8; - } else { - DEB_D(("bytesperline: %d\n",f->fmt.pix.bytesperline)); - if (f->fmt.pix.bytesperline < (f->fmt.pix.width * fmt->depth)/8) - f->fmt.pix.bytesperline = f->fmt.pix.width; - DEB_D(("bytesperline: %d\n",f->fmt.pix.bytesperline)); - if (f->fmt.pix.bytesperline > (2*PAGE_SIZE* fmt->depth)/8) - f->fmt.pix.bytesperline = f->fmt.pix.width; - f->fmt.pix.sizeimage = (f->fmt.pix.width * f->fmt.pix.bytesperline); - } - - DEB_D(("bytesperline: %d\n",f->fmt.pix.bytesperline)); + calc_bpl = (f->fmt.pix.width * fmt->depth)/8; + + if (f->fmt.pix.bytesperline < calc_bpl) + f->fmt.pix.bytesperline = calc_bpl; + + if (f->fmt.pix.bytesperline > (2*PAGE_SIZE * fmt->depth)/8) /* arbitrary constraint */ + f->fmt.pix.bytesperline = calc_bpl; + + f->fmt.pix.sizeimage = f->fmt.pix.bytesperline * f->fmt.pix.height; + DEB_D(("w:%d, h:%d, bytesperline:%d, sizeimage:%d\n",f->fmt.pix.width,f->fmt.pix.height,f->fmt.pix.bytesperline,f->fmt.pix.sizeimage)); return 0; } |