#include "compose.hpp"
#include "dcpomatic_assert.h"
#include "dcpomatic_socket.h"
+#include "enum_indexed_vector.h"
#include "exceptions.h"
#include "image.h"
#include "maths_util.h"
}
DCPOMATIC_ASSERT (yuv_to_rgb < dcp::YUVToRGB::COUNT);
- int const lut[static_cast<int>(dcp::YUVToRGB::COUNT)] = {
- SWS_CS_ITU601,
- SWS_CS_ITU709
- };
+ EnumIndexedVector<int, dcp::YUVToRGB> lut;
+ lut[dcp::YUVToRGB::REC601] = SWS_CS_ITU601;
+ lut[dcp::YUVToRGB::REC709] = SWS_CS_ITU709;
+ lut[dcp::YUVToRGB::REC2020] = SWS_CS_BT2020;
/* The 3rd parameter here is:
0 -> source range MPEG (i.e. "video", 16-235)
*/
sws_setColorspaceDetails (
scale_context,
- sws_getCoefficients (lut[static_cast<int>(yuv_to_rgb)]), video_range == VideoRange::VIDEO ? 0 : 1,
- sws_getCoefficients (lut[static_cast<int>(yuv_to_rgb)]), out_video_range == VideoRange::VIDEO ? 0 : 1,
+ sws_getCoefficients(lut[yuv_to_rgb]), video_range == VideoRange::VIDEO ? 0 : 1,
+ sws_getCoefficients(lut[yuv_to_rgb]), out_video_range == VideoRange::VIDEO ? 0 : 1,
0, 1 << 16, 1 << 16
);
* 2. When we are scaling to certain sizes and placing the result into a larger
* black frame.
*
- * Clear out the left hand side of the image to take care of that.
+ * Clear out the sides of the image to take care of those cases.
*/
- out->make_part_black (corner.x + inter_size.width, (out_size.width - inter_size.width) / 2);
+ auto const pad = (out_size.width - inter_size.width) / 2;
+ out->make_part_black(0, pad);
+ out->make_part_black(corner.x + inter_size.width, pad);
if (
video_range == VideoRange::VIDEO &&
/** @param out_size Size to scale to.
* @param yuv_to_rgb YUVToRGB transform transform to use, if required.
* @param out_format Output pixel format.
- * @param out_aligment Output alignment.
+ * @param out_alignment Output alignment.
* @param fast Try to be fast at the possible expense of quality; at present this means using
* fast bilinear rather than bicubic scaling.
*/
);
DCPOMATIC_ASSERT (yuv_to_rgb < dcp::YUVToRGB::COUNT);
- int const lut[static_cast<int>(dcp::YUVToRGB::COUNT)] = {
- SWS_CS_ITU601,
- SWS_CS_ITU709
- };
+ EnumIndexedVector<int, dcp::YUVToRGB> lut;
+ lut[dcp::YUVToRGB::REC601] = SWS_CS_ITU601;
+ lut[dcp::YUVToRGB::REC709] = SWS_CS_ITU709;
+ lut[dcp::YUVToRGB::REC2020] = SWS_CS_BT2020;
/* The 3rd parameter here is:
0 -> source range MPEG (i.e. "video", 16-235)
*/
sws_setColorspaceDetails (
scale_context,
- sws_getCoefficients (lut[static_cast<int>(yuv_to_rgb)]), 0,
- sws_getCoefficients (lut[static_cast<int>(yuv_to_rgb)]), 0,
+ sws_getCoefficients(lut[yuv_to_rgb]), 0,
+ sws_getCoefficients(lut[yuv_to_rgb]), 0,
0, 1 << 16, 1 << 16
);
}
break;
}
+ case AV_PIX_FMT_YUV444P10LE:
+ {
+ y_part();
+ for (int i = 1; i < 3; ++i) {
+ auto p = reinterpret_cast<int16_t*>(data()[i]);
+ int const h = sample_size(i).height;
+ for (int y = 0; y < h; ++y) {
+ for (int x = start; x < (start + width); ++x) {
+ p[x] = ten_bit_uv;
+ }
+ p += stride()[i] / 2;
+ }
+ }
+ break;
+ }
default:
throw PixelFormatError ("make_part_black()", _pixel_format);
}