How To Enable/Disable Double Buffer; How To Scale Input Video (Before Acquiring Into Frame Buffer) - DIGITAL-LOGIC MICROSPACE PCC-P5 Technical User's Manual

Table of Contents

Advertisement

DIGITAL-LOGIC AG
PCCP5 Manual V2.3

4.11.8 How to enable/disable double buffer

CHIPS 6555x supports double buffering for the video capture and playback. Double buffering needs more memory but it
minimizes the tearing effect generated by fast changing pictures. We assume that there is enough memory to accommo-
date both buffers and that the buffer address is programmed in (MR06, MR07, MR08, MR09, MR0A, MR0B). The fol-
lowing code sets/resets double buffering.
void SetDoubleBuffer(BOOL double_buffer)
{ // double_buffer = 1 to enable double buffer
int mr04,mr20;
WritePortUchar(ulMrAddr, MR_VIN_CTRL_3);
mr04 = ReadPortUshort(ulMrAddr); // Read current value
mr04 &= ~((VIC3_DB_VLOCK+VIC3_ENABLE_DB) << 8); // assume no double buffer
if(interlaced) mr04 |= ((VIC3_DB_VLOCK+VIC3_ENABLE_DB) << 8);
WritePortUshort(ulMrAddr, mr04); // write new value
//
// Enable double buffer for video playback which locked with the input VSync.
//
WritePortUchar(ulMrAddr, MR_VDP_CTRL_3);
mr20 = ReadPortUshort(ulMrAddr); // Read current value
mr20 &= ~((VDC3_DB_VLOVK+VDC3_DB_TRIGGER) << 8); // assume no double buffer
if(interlaced) mr20 |= ((VDC3_DB_VLOVK+VDC3_DB_TRIGGER) << 8);
WritePortUshort(ulMrAddr, mr20); // write new value

4.11.9 How to scale input video (before acquiring into frame buffer)

CHIPS 6555x can scale down the video before capturing into the off-screen buffer.
//-------------------------------------------------------------------------
// SetVideoInputScale() : Sets video input scaling factors. Video input scaling
// factor depends on aquisition rectangle and frame buffer rectangle (source
// rectangle).
//
// Enter:
// wCrop = crop rectangle width
// hCrp = crop rectangle height
// wCap = Capture buffer width
// hCap = Capture buffer height
// Exit :
// Nothing
//-------------------------------------------------------------------------
void SetVideoInputScale(int wCrop, int hCrop, int wCap, int hCap)
{
UINT mr03,scale_x,scale_y;
WritePortUchar(ulMrAddr, MR_VIN_CTRL_2);
mr03 = ReadPortUshort(ulMrAddr);
mr03 &= ~((VIC2_SCALE_X | VIC2_SCALE_Y) << 8); // assume no scaling
if(wCrop > wCap)
{ // horizontal input scaling needed
scale_x = (int)(((DWORD)wCap*VIN_SCALE_X_MAX) / (DWORD)wCrop);
WritePortUshort(ulMrAddr, (scale_x << 8) | MR_VIN_SCALE_X);
mr03 |= (VIC2_SCALE_X << 8); // enable input scaling
}
if(hCrop > hCap)
{ // vertical input scaling needed
scale_y = (int)(((DWORD)hCap*VIN_SCALE_Y_MAX) / (DWORD)hCrop);
WritePortUshort(ulMrAddr, (scale_y << 8) | MR_VIN_SCALE_Y);
mr03 |= (VIC2_SCALE_Y << 8); // enable input scaling
}
WritePortUshort(ulMrAddr, mr03); // set scale factors
78

Advertisement

Table of Contents
loading

Table of Contents