Skip to content

Commit

Permalink
NDI color test.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed Mar 14, 2024
1 parent bde6593 commit 03d21a3
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions lib/tlIO/NDIReadVideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,8 @@ namespace tl
DBG("P216");
// YCbCr color space using 4:2:2 in 16bpp.
_avInputPixelFormat = AV_PIX_FMT_YUV422P16LE;
if (options.yuvToRGBConversion)
{
_avOutputPixelFormat = AV_PIX_FMT_RGB48;
_info.pixelType = image::PixelType::RGB_U16;
}
else
{
_avOutputPixelFormat = AV_PIX_FMT_YUV422P16LE;
_info.pixelType = image::PixelType::YUV_422P_U16;
}
_avOutputPixelFormat = AV_PIX_FMT_RGB48;
_info.pixelType = image::PixelType::RGB_U16;
break;
case NDIlib_FourCC_type_PA16:
DBG("PA16");
Expand Down Expand Up @@ -119,17 +111,10 @@ namespace tl
break;
case NDIlib_FourCC_type_I420:
DBG("I420");
// @bug: this format is not supported by FFmpeg. It is YVU420P
_avInputPixelFormat = AV_PIX_FMT_YUV420P;
if (options.yuvToRGBConversion)
{
_avOutputPixelFormat = AV_PIX_FMT_RGB24;
_info.pixelType = image::PixelType::RGB_U8;
}
else
{
_avOutputPixelFormat = _avInputPixelFormat;
_info.pixelType = image::PixelType::YUV_420P_U8;
}
_avOutputPixelFormat = _avInputPixelFormat;
_info.pixelType = image::PixelType::YUV_420P_U8;
break;
default:
throw std::runtime_error("Unsupported pixel type");
Expand Down Expand Up @@ -275,6 +260,21 @@ namespace tl
{
throw std::runtime_error(string::Format("{0}: Cannot initialize sws context").arg(_fileName));
}

int in_full, out_full, brightness, contrast, saturation;
const int *inv_table, *table;

sws_getColorspaceDetails(
_swsContext, (int**)&inv_table, &in_full,
(int**)&table, &out_full, &brightness, &contrast,
&saturation);

inv_table = sws_getCoefficients(AVCOL_SPC_RGB);
table = sws_getCoefficients(AVCOL_SPC_BT709);

sws_setColorspaceDetails(
_swsContext, inv_table, in_full, table, out_full,
brightness, contrast, saturation);
}
}

Expand Down

0 comments on commit 03d21a3

Please sign in to comment.