📄 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 << 24;
}
/**
* 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 << 24;
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -