Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] tw5864: crop picture width to 704

Previously, width of 720 was used, but it gives 16-pixel wide black bar
at right side of encoded picture.

Signed-off-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

authored by

Andrey Utkin and committed by
Mauro Carvalho Chehab
6dfcd296 e546b1ef

+19 -2
+8
drivers/media/pci/tw5864/tw5864-reg.h
··· 1879 1879 #define TW5864_INDIR_IN_PIC_HEIGHT(channel) (0x201 + 4 * channel) 1880 1880 #define TW5864_INDIR_OUT_PIC_WIDTH(channel) (0x202 + 4 * channel) 1881 1881 #define TW5864_INDIR_OUT_PIC_HEIGHT(channel) (0x203 + 4 * channel) 1882 + 1883 + /* Some registers skipped */ 1884 + 1885 + #define TW5864_INDIR_CROP_ETC 0x260 1886 + /* Define controls in register TW5864_INDIR_CROP_ETC */ 1887 + /* Enable cropping from 720 to 704 */ 1888 + #define TW5864_INDIR_CROP_ETC_CROP_EN 0x4 1889 + 1882 1890 /* 1883 1891 * Interrupt status register from the front-end. Write "1" to each bit to clear 1884 1892 * the interrupt
+11 -2
drivers/media/pci/tw5864/tw5864-video.c
··· 330 330 tw_indir_writeb(TW5864_INDIR_OUT_PIC_WIDTH(nr), input->width / 4); 331 331 tw_indir_writeb(TW5864_INDIR_OUT_PIC_HEIGHT(nr), input->height / 4); 332 332 333 + /* 334 + * Crop width from 720 to 704. 335 + * Above register settings need value 720 involved. 336 + */ 337 + input->width = 704; 338 + tw_indir_writeb(TW5864_INDIR_CROP_ETC, 339 + tw_indir_readb(TW5864_INDIR_CROP_ETC) | 340 + TW5864_INDIR_CROP_ETC_CROP_EN); 341 + 333 342 tw_writel(TW5864_DSP_PIC_MAX_MB, 334 343 ((input->width / 16) << 8) | (input->height / 16)); 335 344 ··· 541 532 { 542 533 struct tw5864_input *input = video_drvdata(file); 543 534 544 - f->fmt.pix.width = 720; 535 + f->fmt.pix.width = 704; 545 536 switch (input->std) { 546 537 default: 547 538 WARN_ON_ONCE(1); ··· 747 738 return -EINVAL; 748 739 749 740 fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE; 750 - fsize->discrete.width = 720; 741 + fsize->discrete.width = 704; 751 742 fsize->discrete.height = input->std == STD_NTSC ? 480 : 576; 752 743 753 744 return 0;