NDI in node looks almost done
This commit is contained in:
@@ -90,4 +90,28 @@ inline void fill_frame(uint8_t* buf, int width, int height, uint32_t stride)
|
||||
}
|
||||
}
|
||||
|
||||
inline void UYVYtoV210(uint8_t* src_buf, uint8_t* dst_buf, int width, int height, uint32_t src_stride, uint32_t dst_stride)
|
||||
{
|
||||
const uint8_t* src = src_buf;
|
||||
uint8_t* dst = dst_buf;
|
||||
const int blocks = width / 6;
|
||||
|
||||
for (int y = 0; y < height; y++) {
|
||||
for (int b = 0; b < blocks; b++) {
|
||||
const uint8_t* mp = src + b * 12; // 3 macropixels = 12 bytes
|
||||
// mp[0]=U0, mp[1]=Y0, mp[2]=V0, mp[3]=Y1
|
||||
// mp[4]=U1, mp[5]=Y2, mp[6]=V1, mp[7]=Y3
|
||||
// mp[8]=U2, mp[9]=Y4, mp[10]=V2, mp[11]=Y5
|
||||
|
||||
dmf::v210::pack_block(dst + b * 16,
|
||||
{0, (uint16_t)(mp[0]<<2), (uint16_t)(mp[2]<<2)}, (uint16_t)(mp[1]<<2), (uint16_t)(mp[3]<<2),
|
||||
{0, (uint16_t)(mp[4]<<2), (uint16_t)(mp[6]<<2)}, (uint16_t)(mp[5]<<2), (uint16_t)(mp[7]<<2),
|
||||
{0, (uint16_t)(mp[8]<<2), (uint16_t)(mp[10]<<2)}, (uint16_t)(mp[9]<<2), (uint16_t)(mp[11]<<2)
|
||||
);
|
||||
}
|
||||
src += src_stride;
|
||||
dst += dst_stride;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace dmf::v210
|
||||
|
||||
Reference in New Issue
Block a user