Fix font_id_map errors when importing DCP subtitles that have no
[dcpomatic.git] / src / lib / image.cc
index 629fc0a64c1c1e38b26976b195d017bfab578273..9aecac8347a40bbbd0e7e4ff5a7fd2f85e608908 100644 (file)
@@ -298,9 +298,11 @@ Image::crop_scale_window (
         * 2. When we are scaling to certain sizes and placing the result into a larger
         *    black frame.
         *
-        * Clear out the left hand side of the image to take care of that.
+        * Clear out the sides of the image to take care of those cases.
         */
-       out->make_part_black (corner.x + inter_size.width, (out_size.width - inter_size.width) / 2);
+       auto const pad = (out_size.width - inter_size.width) / 2;
+       out->make_part_black(0, pad);
+       out->make_part_black(corner.x + inter_size.width, pad);
 
        if (
                video_range == VideoRange::VIDEO &&
@@ -476,6 +478,21 @@ Image::make_part_black (int const start, int const width)
                }
                break;
        }
+       case AV_PIX_FMT_YUV444P10LE:
+       {
+               y_part();
+               for (int i = 1; i < 3; ++i) {
+                       auto p = reinterpret_cast<int16_t*>(data()[i]);
+                       int const h = sample_size(i).height;
+                       for (int y = 0; y < h; ++y) {
+                               for (int x = start; x < (start + width); ++x) {
+                                       p[x] = ten_bit_uv;
+                               }
+                               p += stride()[i] / 2;
+                       }
+               }
+               break;
+       }
        default:
                throw PixelFormatError ("make_part_black()", _pixel_format);
        }