From f84bcfc26ca1ccd2f395bc1bf259b5b9662b468a Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 13 May 2022 13:56:11 +0200 Subject: [PATCH] Support auto-crop for YUV422P10LE. --- src/lib/guess_crop.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib/guess_crop.cc b/src/lib/guess_crop.cc index 7ee7a7286..3538f14de 100644 --- a/src/lib/guess_crop.cc +++ b/src/lib/guess_crop.cc @@ -61,6 +61,16 @@ guess_crop (shared_ptr image, double threshold) } break; } + case AV_PIX_FMT_YUV422P10LE: + { + uint16_t const* data = reinterpret_cast(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(*data) / 1024); + data += rows ? 1 : (image->stride()[0] / 2); + } + break; + } default: throw PixelFormatError("guess_crop()", image->pixel_format()); } -- 2.30.2