-Subproject commit 824260a0732a49b5a18f2e16e04b0373c37a3bea
+Subproject commit c245ceb9081e412bb815480481670e295ddfc71a
if (sws_ctx == nullptr || sws_last_width != frame->width || sws_last_height != frame->height) {
sws_ctx.reset(
sws_getContext(frame->width, frame->height, (AVPixelFormat)frame->format,
- width, height, AV_PIX_FMT_RGBA,
+ width, height, AV_PIX_FMT_BGRA,
SWS_BICUBIC, nullptr, nullptr, nullptr));
sws_last_width = frame->width;
sws_last_height = frame->height;
uint32_t get_current_video_mode() const override { return 0; }
std::set<bmusb::PixelFormat> get_available_pixel_formats() const override {
- return std::set<bmusb::PixelFormat>{ bmusb::PixelFormat_8BitRGBA };
+ return std::set<bmusb::PixelFormat>{ bmusb::PixelFormat_8BitBGRA };
}
void set_pixel_format(bmusb::PixelFormat pixel_format) override {
- assert(pixel_format == bmusb::PixelFormat_8BitRGBA);
+ assert(pixel_format == bmusb::PixelFormat_8BitBGRA);
}
bmusb::PixelFormat get_current_pixel_format() const override {
- return bmusb::PixelFormat_8BitRGBA;
+ return bmusb::PixelFormat_8BitBGRA;
}
std::map<uint32_t, std::string> get_available_video_inputs() const override {
case bmusb::PixelFormat_8BitYCbCr:
first = userdata->tex_y[field] == 0 || userdata->tex_cbcr[field] == 0;
break;
- case bmusb::PixelFormat_8BitRGBA:
+ case bmusb::PixelFormat_8BitBGRA:
first = userdata->tex_rgba[field] == 0;
break;
default:
check_error();
break;
}
- case bmusb::PixelFormat_8BitRGBA:
+ case bmusb::PixelFormat_8BitBGRA:
glBindTexture(GL_TEXTURE_2D, userdata->tex_rgba[field]);
check_error();
if (global_flags.can_disable_srgb_decoder) { // See the comments in tweaked_inputs.h.
- glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, nullptr);
} else {
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, nullptr);
}
check_error();
break;
bmusb::PixelFormat pixel_format;
if (card_type == CardType::FFMPEG_INPUT) {
- pixel_format = bmusb::PixelFormat_8BitRGBA;
+ pixel_format = bmusb::PixelFormat_8BitBGRA;
} else if (global_flags.ten_bit_input) {
pixel_format = PixelFormat_10BitYCbCr;
} else {
upload_texture(userdata->tex_cbcr[field], cbcr_width, video_format.height, cbcr_width * sizeof(uint16_t), interlaced_stride, GL_RG, GL_UNSIGNED_BYTE, field_cbcr_start);
break;
}
- case bmusb::PixelFormat_8BitRGBA: {
+ case bmusb::PixelFormat_8BitBGRA: {
size_t field_start = video_offset + video_format.stride * field_start_line;
- upload_texture(userdata->tex_rgba[field], video_format.width, video_format.height, video_format.stride, interlaced_stride, GL_RGBA, GL_UNSIGNED_BYTE, field_start);
+ upload_texture(userdata->tex_rgba[field], video_format.width, video_format.height, video_format.stride, interlaced_stride, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, field_start);
break;
}
default:
// For 8-bit Y'CbCr, we ask the driver to split Y' and Cb/Cr
// into separate textures. For 10-bit, the input format (v210)
// is complicated enough that we need to interpolate up to 4:4:4,
- // which we do in a compute shader ourselves. For RGBA, the data
+ // which we do in a compute shader ourselves. For BGRA, the data
// is already 4:4:4:4.
frame.interleaved = (pixel_format == bmusb::PixelFormat_8BitYCbCr);
glGenTextures(2, userdata[i].tex_444);
check_error();
break;
- case bmusb::PixelFormat_8BitRGBA:
+ case bmusb::PixelFormat_8BitBGRA:
glGenTextures(2, userdata[i].tex_rgba);
check_error();
break;
check_error();
}
break;
- case bmusb::PixelFormat_8BitRGBA:
+ case bmusb::PixelFormat_8BitBGRA:
glBindTexture(GL_TEXTURE_2D, userdata[i].tex_rgba[field]);
check_error();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
check_error();
if (field == 0) {
if (global_flags.can_disable_srgb_decoder) { // See the comments in tweaked_inputs.h.
- glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
} else {
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
}
check_error();
}
glDeleteTextures(2, ((Userdata *)frame.userdata)->tex_cbcr);
check_error();
break;
- case bmusb::PixelFormat_8BitRGBA:
+ case bmusb::PixelFormat_8BitBGRA:
glDeleteTextures(2, ((Userdata *)frame.userdata)->tex_rgba);
check_error();
break;
// doesn't care about the object anymore. (If we change this, we'd need
// to also unregister the signal connection on __gc.)
int ret = wrap_lua_object_nonowned<LiveInputWrapper>(
- L, "LiveInputWrapper", theme, chain, bmusb::PixelFormat_8BitRGBA,
+ L, "LiveInputWrapper", theme, chain, bmusb::PixelFormat_8BitBGRA,
/*override_bounce=*/false, deinterlace);
if (ret == 1) {
Theme *theme = get_theme_updata(L);
num_inputs = 1;
}
- if (pixel_format == bmusb::PixelFormat_8BitRGBA) {
+ if (pixel_format == bmusb::PixelFormat_8BitBGRA) {
for (unsigned i = 0; i < num_inputs; ++i) {
+ // We upload our textures ourselves, and Movit swaps
+ // R and B in the shader if we specify BGRA, so lie and say RGBA.
if (global_flags.can_disable_srgb_decoder) {
rgba_inputs.push_back(new sRGBSwitchingFlatInput(inout_format, FORMAT_RGBA_POSTMULTIPLIED_ALPHA, GL_UNSIGNED_BYTE, global_flags.width, global_flags.height));
} else {
ycbcr_inputs[i]->set_width(this_width);
ycbcr_inputs[i]->set_height(this_height);
break;
- case bmusb::PixelFormat_8BitRGBA:
+ case bmusb::PixelFormat_8BitBGRA:
rgba_inputs[i]->set_texture_num(userdata->tex_rgba[frame.field_number]);
rgba_inputs[i]->set_width(this_width);
rgba_inputs[i]->set_height(this_height);
// the mixer, and communicates that state over to the actual YCbCrInput.
class LiveInputWrapper {
public:
- // Note: <override_bounce> is irrelevant for PixelFormat_8BitRGBA.
+ // Note: <override_bounce> is irrelevant for PixelFormat_8BitBGRA.
LiveInputWrapper(Theme *theme, movit::EffectChain *chain, bmusb::PixelFormat pixel_format, bool override_bounce, bool deinterlace);
void connect_signal(int signal_num);
{
if (deinterlace) {
return deinterlace_effect;
- } else if (pixel_format == bmusb::PixelFormat_8BitRGBA) {
+ } else if (pixel_format == bmusb::PixelFormat_8BitBGRA) {
return rgba_inputs[0];
} else {
return ycbcr_inputs[0];