X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=test%2Ftest.cc;h=7136b038d99bbb9c28bc1a8569cdb0f6b226e72f;hb=59c4edb69ba926d3790198cd2b62dc601944a632;hp=a12d79916463f7eb23589ef2e76b472d2e4a537f;hpb=4673b12dcf6340862f9f4f72fc6dca8553130b55;p=dcpomatic.git diff --git a/test/test.cc b/test/test.cc index a12d79916..7136b038d 100644 --- a/test/test.cc +++ b/test/test.cc @@ -369,6 +369,8 @@ rms_error (boost::filesystem::path ref, boost::filesystem::path check) FFmpegImageProxy check_proxy (check); auto check_image = check_proxy.image(Image::Alignment::COMPACT).image; + BOOST_REQUIRE_EQUAL (ref_image->planes(), check_image->planes()); + BOOST_REQUIRE_EQUAL (ref_image->pixel_format(), check_image->pixel_format()); auto const format = ref_image->pixel_format(); @@ -417,6 +419,19 @@ rms_error (boost::filesystem::path ref, boost::filesystem::path check) } break; } + case AV_PIX_FMT_YUVJ420P: + { + for (int c = 0; c < ref_image->planes(); ++c) { + for (int y = 0; y < height / ref_image->vertical_factor(c); ++y) { + auto p = ref_image->data()[c] + y * ref_image->stride()[c]; + auto q = check_image->data()[c] + y * check_image->stride()[c]; + for (int x = 0; x < ref_image->line_size()[c]; ++x) { + sum_square += pow((*p++ - *q++), 2); + } + } + } + break; + } default: BOOST_REQUIRE_MESSAGE (false, "unrecognised pixel format " << format); } @@ -699,7 +714,7 @@ png_flush (png_structp) static void -png_error_fn (png_structp png_ptr, char const * message) +png_error_fn (png_structp, char const * message) { throw EncodeError (String::compose("Error during PNG write: %1", message)); }