NDI cap, disp.: mark some conversions form optimization

This commit is contained in:
Martin Pulec
2022-05-24 14:24:47 +02:00
parent d893d4ce75
commit f37352abfc
2 changed files with 8 additions and 4 deletions

View File

@@ -363,7 +363,8 @@ static void convert_BGRA_RGBA(struct video_frame *out, const uint8_t *data, int
auto *out_p = reinterpret_cast<uint32_t *>(out->tiles[0].data) + field_idx * out->tiles[0].width;
for (unsigned int i = 0; i < out->tiles[0].height; i += total_fields) {
const auto *in_p = reinterpret_cast<const uint32_t *>(data + i * in_stride);
for (unsigned int j = 0; j < out->tiles[0].width; j++) {
unsigned int width = out->tiles[0].width;
OPTIMIZED_FOR (unsigned int j = 0; j < width; j++) {
uint32_t argb = *in_p++;
*out_p++ = (argb & 0xFF000000U) | ((argb & 0xFFU) << 16U) | (argb & 0xFF00U) | ((argb & 0xFF0000U) >> 16U);
}
@@ -377,7 +378,8 @@ static void convert_P216_Y216(struct video_frame *out, const uint8_t *data, [[ma
const auto *in_cb_cr = reinterpret_cast<const uint16_t *>(data) + out->tiles[0].width * out->tiles[0].height;
auto *out_p = reinterpret_cast<uint16_t *>(out->tiles[0].data) + 2 * field_idx * out->tiles[0].width;
for (unsigned int i = 0; i < out->tiles[0].height; i += total_fields) {
for (unsigned int j = 0; j < out->tiles[0].width; j += 2) {
unsigned int width = out->tiles[0].width;
OPTIMIZED_FOR (unsigned int j = 0; j < (width + 1) / 2; j += 1) {
*out_p++ = *in_y++;
*out_p++ = *in_cb_cr++;
*out_p++ = *in_y++;

View File

@@ -258,7 +258,8 @@ static void ndi_disp_convert_Y216_to_P216(const struct video_frame *f, char *out
uint16_t *out_cb_cr = (uint16_t *)(void *) out + f->tiles[0].width * f->tiles[0].height;
for (unsigned int i = 0; i < f->tiles[0].height; ++i) {
for (unsigned int j = 0; j < f->tiles[0].width; j += 2) {
unsigned int width = f->tiles[0].width;
OPTIMIZED_FOR (unsigned int j = 0; j < (width + 1) / 2; j += 1) {
*out_y++ = *in++;
*out_cb_cr++ = *in++;
*out_y++ = *in++;
@@ -276,7 +277,8 @@ static void ndi_disp_convert_Y416_to_P216(const struct video_frame *f, char *out
uint16_t *out_cb_cr = (uint16_t *)(void *) out + f->tiles[0].width * f->tiles[0].height;
for (unsigned int i = 0; i < f->tiles[0].height; ++i) {
OPTIMIZED_FOR (unsigned int j = 0; j < f->tiles[0].width; j += 2) {
unsigned int width = f->tiles[0].width;
OPTIMIZED_FOR (unsigned int j = 0; j < (width + 1) / 2; j += 1) {
*out_y++ = in[1];
*out_cb_cr++ = (in[2] + in[6]) / 2;
*out_y++ = in[5];