#include "lib/job.h"
#include "lib/job_manager.h"
#include "lib/log_entry.h"
+#include "lib/make_dcp.h"
#include "lib/ratio.h"
#include "lib/signal_manager.h"
#include "lib/util.h"
}
-void
+static void
setup_test_config ()
{
- Config::instance()->set_master_encoding_threads (boost::thread::hardware_concurrency());
+ Config::instance()->set_master_encoding_threads (boost::thread::hardware_concurrency() / 2);
Config::instance()->set_server_encoding_threads (1);
Config::instance()->set_server_port_base (61921);
Config::instance()->set_default_container (Ratio::from_id ("185"));
{
public:
/* No wakes in tests: we call ui_idle ourselves */
- void wake_ui ()
+ void wake_ui () override
{
}
double
rms_error (boost::filesystem::path ref, boost::filesystem::path check)
{
- FFmpegImageProxy ref_proxy (ref, VideoRange::FULL);
- auto ref_image = ref_proxy.image().image;
- FFmpegImageProxy check_proxy (check, VideoRange::FULL);
- auto check_image = check_proxy.image().image;
+ FFmpegImageProxy ref_proxy (ref);
+ auto ref_image = ref_proxy.image(Image::Alignment::COMPACT).image;
+ 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());
- AVPixelFormat const format = ref_image->pixel_format();
+ auto const format = ref_image->pixel_format();
BOOST_REQUIRE (ref_image->size() == check_image->size());
int const width = ref_image->size().width;
}
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);
}
static void
-png_error_fn (png_structp png_ptr, char const * message)
+png_error_fn (png_structp, char const * message)
{
- reinterpret_cast<Image*>(png_get_error_ptr(png_ptr))->png_error (message);
+ throw EncodeError (String::compose("Error during PNG write: %1", message));
}
make_and_verify_dcp (shared_ptr<Film> film, vector<dcp::VerificationNote::Code> ignore)
{
film->write_metadata ();
- film->make_dcp ();
+ make_dcp (film, TranscodeJob::ChangedBehaviour::IGNORE);
BOOST_REQUIRE (!wait_for_jobs());
auto notes = dcp::verify ({film->dir(film->dcp_name())}, &stage, &progress, TestPaths::xsd());
bool ok = true;
void
check_int_close (int a, int b, int d)
{
- BOOST_CHECK (std::abs(a - b) < d);
+ BOOST_CHECK_MESSAGE (std::abs(a - b) < d, a << " differs from " << b << " by more than " << d);
}
check_int_close (a.first, b.first, d);
check_int_close (a.second, b.second, d);
}
+
+
+ConfigRestorer::~ConfigRestorer()
+{
+ setup_test_config();
+}
+