refactored videoin to NodeBase
This commit is contained in:
@@ -170,4 +170,39 @@ inline void UYVYtoV210(uint8_t* src_buf, uint8_t* dst_buf, int width, int height
|
||||
}
|
||||
}
|
||||
|
||||
inline void YUV422P10toV210(const uint16_t* y, const uint16_t* u, const uint16_t* v,
|
||||
uint8_t* dst, int width, int height,
|
||||
int y_stride, int u_stride, int v_stride, // bytes between rows
|
||||
uint32_t dst_stride)
|
||||
{
|
||||
for (int row = 0; row < height; row++) {
|
||||
const uint16_t* y_row = reinterpret_cast<const uint16_t*>(
|
||||
reinterpret_cast<const uint8_t*>(y) + row * y_stride
|
||||
);
|
||||
const uint16_t* u_row = reinterpret_cast<const uint16_t*>(
|
||||
reinterpret_cast<const uint8_t*>(u) + row * u_stride
|
||||
);
|
||||
const uint16_t* v_row = reinterpret_cast<const uint16_t*>(
|
||||
reinterpret_cast<const uint8_t*>(v) + row * v_stride
|
||||
);
|
||||
|
||||
uint8_t* dst_row = dst + static_cast<ptrdiff_t>(row) * dst_stride;
|
||||
const int blocks = width / 6;
|
||||
|
||||
for (int b = 0; b < blocks; b++) {
|
||||
int x = b * 6;
|
||||
const uint16_t cb0 = u_row[x/2], cb1 = u_row[x/2+1], cb2 = u_row[x/2+2];
|
||||
const uint16_t cr0 = v_row[x/2], cr1 = v_row[x/2+1], cr2 = v_row[x/2+2];
|
||||
const uint16_t y0 = y_row[x], y1 = y_row[x+1], y2 = y_row[x+2];
|
||||
const uint16_t y3 = y_row[x+3], y4 = y_row[x+4], y5 = y_row[x+5];
|
||||
|
||||
auto* w = reinterpret_cast<uint32_t*>(dst_row + b * 16);
|
||||
w[0] = (cb0 & 0x3FFu) | ((y0 & 0x3FFu) << 10) | ((cr0 & 0x3FFu) << 20);
|
||||
w[1] = (y1 & 0x3FFu) | ((cb1 & 0x3FFu) << 10) | ((y2 & 0x3FFu) << 20);
|
||||
w[2] = (cr1 & 0x3FFu) | ((y3 & 0x3FFu) << 10) | ((cb2 & 0x3FFu) << 20);
|
||||
w[3] = (y4 & 0x3FFu) | ((cr2 & 0x3FFu) << 10) | ((y5 & 0x3FFu) << 20);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace dmf::v210
|
||||
|
||||
Reference in New Issue
Block a user