Add somewhat empirical support for YUVJ42{0,2,4}P pixels.
authorCarl Hetherington <cth@carlh.net>
Thu, 13 Jun 2013 20:24:56 +0000 (21:24 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 13 Jun 2013 20:24:56 +0000 (21:24 +0100)
src/lib/image.cc
test/make_black_test.cc
test/test.cc

index bd527e91ef5c3fcc2961b605e9fc3dfb50b28ed9..f28652d4e2cdac846773df4e202e69902d0c67cf 100644 (file)
@@ -273,11 +273,11 @@ void
 Image::make_black ()
 {
        /* U/V black value for 8-bit colour */
-       static uint8_t const eight_bit_uv = (1 << 7) - 1;
+       static uint8_t const eight_bit_uv =     (1 << 7) - 1;
        /* U/V black value for 9-bit colour */
-       static uint16_t const nine_bit_uv = (1 << 8) - 1;
+       static uint16_t const nine_bit_uv =     (1 << 8) - 1;
        /* U/V black value for 10-bit colour */
-       static uint16_t const ten_bit_uv =  (1 << 9) - 1;
+       static uint16_t const ten_bit_uv =      (1 << 9) - 1;
        /* U/V black value for 16-bit colour */
        static uint16_t const sixteen_bit_uv =  (1 << 15) - 1;
        
@@ -290,6 +290,14 @@ Image::make_black ()
                memset (data()[2], eight_bit_uv, lines(2) * stride()[2]);
                break;
 
+       case PIX_FMT_YUVJ420P:
+       case PIX_FMT_YUVJ422P:
+       case PIX_FMT_YUVJ444P:
+               memset (data()[0], 0, lines(0) * stride()[0]);
+               memset (data()[1], eight_bit_uv + 1, lines(1) * stride()[1]);
+               memset (data()[2], eight_bit_uv + 1, lines(2) * stride()[2]);
+               break;
+
        case PIX_FMT_YUV422P9LE:
        case PIX_FMT_YUV444P9LE:
                yuv_16_black (nine_bit_uv);
index 3c0b979ffff675d02b8f9d461b1e9d7810067572..714621762bbf435e01838c7fabf07cd51fc5d67d 100644 (file)
@@ -35,6 +35,9 @@ BOOST_AUTO_TEST_CASE (make_black_test)
        pix_fmts.push_back (AV_PIX_FMT_YUV444P10LE);
        pix_fmts.push_back (AV_PIX_FMT_YUV444P10BE);
        pix_fmts.push_back (AV_PIX_FMT_UYVY422);
+       pix_fmts.push_back (AV_PIX_FMT_YUVJ420P);
+       pix_fmts.push_back (AV_PIX_FMT_YUVJ422P);
+       pix_fmts.push_back (AV_PIX_FMT_YUVJ444P);
 
        int N = 0;
        for (list<AVPixelFormat>::const_iterator i = pix_fmts.begin(); i != pix_fmts.end(); ++i) {
@@ -46,6 +49,9 @@ BOOST_AUTO_TEST_CASE (make_black_test)
                for (int y = 0; y < bar->size().height; ++y) {
                        uint8_t* q = p;
                        for (int x = 0; x < bar->line_size()[0]; ++x) {
+                               if (*q != 0) {
+                                       std::cerr << "x=" << x << ", (x%3)=" << (x%3) << "\n";
+                               }
                                BOOST_CHECK_EQUAL (*q++, 0);
                        }
                        p += bar->stride()[0];
index 91c876412f74b15af3f6f37eea5fc932cb7d1293..65b1f9056d8ec8cf76bdb32190c278e781681a26 100644 (file)
@@ -62,6 +62,8 @@ struct TestConfig
                Config::instance()->set_servers (vector<ServerDescription*> ());
                Config::instance()->set_server_port (61920);
                Config::instance()->set_default_dci_metadata (DCIMetadata ());
+               Config::instance()->set_default_format (static_cast<Format*> (0));
+               Config::instance()->set_default_dcp_content_type (static_cast<DCPContentType*> (0));
        }
 };
 
@@ -101,3 +103,4 @@ new_test_film (string name)
 #include "job_test.cc"
 #include "client_server_test.cc"
 #include "image_test.cc"
+