
Brooktree
27
F
UNCTIONAL
D
ESCRIPTION
Video Scaling, Cropping, and Temporal Decimation
L848A_A
Bt848/848A/849A
Single-Chip Video Capture for PCI
The Vertical Scaling Ratio Register (VSCALE)
is programmed with the ver-
tical scaling ratio. It defines the number of vertical lines output by the Bt848. The
following formula should be used to determine the value to be entered into this
13-bit register. The loaded value is a two’s-complement, negative value.
For example, to scale PAL/SECAM input to square pixel QCIF, the total number of
vertical lines is 156:
Note that only the 13 least significant bits of the VSCALE value are used; the five
LSBs of VSCALE_HI and the 8-bit VSCALE_LO register form the 13-bit VS-
CALE register. The three MSBs of VSCALE_HI are used to control other func-
tions. The user must take care not to alter the values of the three most significant
bits when writing a vertical scaling value. The following C-code fragment illus-
trates changing the vertical scaling value:
#define BYTE unsigned char
#define WORD unsigned int
#define VSCALE_HI 0x13
#define VSCALE_LO 0x14
BYTE ReadFromBt848( BYTE regAddress );
void WriteToBt848( BYTE regAddress, BYTE regValue );
void SetBt848VScaling( WORD VSCALE )
{
BYTE oldVscaleMSByte, newVscaleMSByte;
/* get existing VscaleMSByte value from */
/* Bt848 VSCALE_HI register */
oldVscaleMSByte = ReadFromBt848( VSCALE_HI );
/* create a new VscaleMSByte, preserving top 3 bits */
newVscaleMSByte = (oldVscaleMSByte & 0xE0) | (VSCALE >> 8);
/* send the new VscaleMSByte to the VSCALE_HI reg */
WriteToBt848( VSCALE_HI, newVscaleMSByte );
/* send the new VscaleLSByte to the VSCALE_LO reg */
WriteToBt848( VSCALE_LO, (BYTE) VSCALE );
}
If your target machine has sufficient memory to statically store the scaling val-
ues locally, the READ operation can be eliminated.
VSCALE = ( 0x10000 – { [ ( scaling_ratio ) – 1] * 512 } ) & 0x1FFF
VSCALE = ( 0x10000 – { [ ( 4/1 ) –1 ] * 512 } ) & 0x1FFF
= 0x1A00
where:
&
= bitwise AND
= bitwise OR
>>
= bit shift, MSB to LSB
|