Support auto-crop for YUV422P10LE.
authorCarl Hetherington <cth@carlh.net>
Fri, 13 May 2022 11:56:11 +0000 (13:56 +0200)
committerCarl Hetherington <cth@carlh.net>
Fri, 13 May 2022 11:56:11 +0000 (13:56 +0200)
src/lib/guess_crop.cc

index 7ee7a72860c4051bf632841a8b92f4e72f1d89a6..3538f14dee4356ebec6bb52aa8e59b9862c7cb41 100644 (file)
@@ -61,6 +61,16 @@ guess_crop (shared_ptr<const Image> image, double threshold)
                        }
                        break;
                }
+               case AV_PIX_FMT_YUV422P10LE:
+               {
+                       uint16_t const* data = reinterpret_cast<uint16_t*>(image->data()[0] + (start_x * 2) + (start_y * image->stride()[0]));
+                       for (int p = 0; p < pixels; ++p) {
+                               /* Just using Y */
+                               brightest = std::max(brightest, static_cast<double>(*data) / 1024);
+                               data += rows ? 1 : (image->stride()[0] / 2);
+                       }
+                       break;
+               }
                default:
                        throw PixelFormatError("guess_crop()", image->pixel_format());
                }