BlackFin处理器视频演示代码
源代码在线查看: itu-r-656.h
/**
* @file itu-r-656.h
* @author Zlatan Stanojevic
*/
#ifndef ITU_R_656_H
#define ITU_R_656_H
/**
* Flags passed to the @ref SAV and @ref EAV functions
*/
typedef enum
{
/// Flag for field 1
FIELD_1 = 0x00,
/// Flag for field 2
FIELD_2 = 0x40,
FIELD = FIELD_2,
///Vertical Blank flag
VERTICAL_BLANK = 0x20,
HORIZ_BLANK = 0x10
} ITUFlags;
static const unsigned char protection_bit_table[] =
{
0x00,
0x0d,
0x0b,
0x06,
0x07,
0x0a,
0x0c,
0x01
};
/**
* Generates four-byte SAV ( = Start of Active Video, H = 0 )
* synchronization sequence with flags and protection bits.
*
* @param flags A combination of @ref FIELD_1, @ref FIELD_2 and @ref VERTICAL_BLANK
* or'ed together.
*/
inline unsigned long SAV( unsigned long flags )
{
flags |= protection_bit_table[ flags >> 4 ];
flags |= 0x80;
return 0x000000ff | flags }
/**
* Generates four-byte EAV ( = End of Active Video, H = 1 )
* synchronization sequence with flags and protection bits.
*
* @param flags A combination of @ref FIELD_1, @ref FIELD_2 and @ref VERTICAL_BLANK
* or'ed together.
*/
inline unsigned long EAV( unsigned long flags )
{
flags |= HORIZ_BLANK;
flags |= protection_bit_table[ flags >> 4 ];
flags |= 0x80;
return 0x000000ff | flags }
#endif