glActiveTexture(GL_TEXTURE0 + *sampler_num);
check_error();
- if (texture_num == 0) {
+ if (texture_num == 0 && (pbo != 0 || pixel_data != NULL)) {
// Translate the input format to OpenGL's enums.
GLint internal_format;
GLenum format;
expect_equal(expected_data, out_data, 4, size);
}
+TEST(FlatInput, NoData) {
+ const int width = 2;
+ const int height = 4;
+
+ float out_data[width * height];
+
+ EffectChainTester tester(NULL, width, height);
+
+ ImageFormat format;
+ format.color_space = COLORSPACE_sRGB;
+ format.gamma_curve = GAMMA_LINEAR;
+
+ FlatInput *input = new FlatInput(format, FORMAT_GRAYSCALE, GL_FLOAT, width, height);
+ tester.get_chain()->add_input(input);
+
+ tester.run(out_data, GL_RED, COLORSPACE_sRGB, GAMMA_LINEAR);
+
+ // Don't care what the output was, just that it does not crash.
+}
+
} // namespace movit
glActiveTexture(GL_TEXTURE0 + *sampler_num + channel);
check_error();
- if (texture_num[channel] == 0) {
+ if (texture_num[channel] == 0 && (pbos[channel] != 0 || pixel_data[channel] != NULL)) {
GLenum format, internal_format;
if (channel == 1 && ycbcr_input_splitting == YCBCR_INPUT_SPLIT_Y_AND_CBCR) {
format = GL_RG;
EXPECT_NEAR(128.0, offset[2] * 255.0, 1e-3);
}
+TEST(YCbCrInputTest, NoData) {
+ const int width = 1;
+ const int height = 5;
+
+ float out_data[4 * width * height];
+
+ EffectChainTester tester(NULL, width, height);
+
+ ImageFormat format;
+ format.color_space = COLORSPACE_sRGB;
+ format.gamma_curve = GAMMA_sRGB;
+
+ YCbCrFormat ycbcr_format;
+ ycbcr_format.luma_coefficients = YCBCR_REC_601;
+ ycbcr_format.full_range = false;
+ ycbcr_format.num_levels = 256;
+ ycbcr_format.chroma_subsampling_x = 1;
+ ycbcr_format.chroma_subsampling_y = 1;
+ ycbcr_format.cb_x_position = 0.5f;
+ ycbcr_format.cb_y_position = 0.5f;
+ ycbcr_format.cr_x_position = 0.5f;
+ ycbcr_format.cr_y_position = 0.5f;
+
+ YCbCrInput *input = new YCbCrInput(format, ycbcr_format, width, height);
+ tester.get_chain()->add_input(input);
+
+ tester.run(out_data, GL_RGBA, COLORSPACE_sRGB, GAMMA_sRGB);
+
+ // Don't care what the output was, just that it does not crash.
+}
+
} // namespace movit