Merge 7ff8451dc8
into 8609e5fae5
This commit is contained in:
commit
084f23eccc
|
@ -442,8 +442,9 @@ absl::Status ScaleImageCalculator::ValidateImageFormats() const {
|
||||||
RET_CHECK(output_format_ == ImageFormat::SRGB ||
|
RET_CHECK(output_format_ == ImageFormat::SRGB ||
|
||||||
output_format_ == ImageFormat::SRGBA ||
|
output_format_ == ImageFormat::SRGBA ||
|
||||||
(input_format_ == output_format_ &&
|
(input_format_ == output_format_ &&
|
||||||
output_format_ == ImageFormat::YCBCR420P))
|
output_format_ == ImageFormat::YCBCR420P) || output_format_ == ImageFormat::SRGBA || output_format_ == ImageFormat::SBGRA || output_format_ == ImageFormat::GRAY8)
|
||||||
<< "Outputting YCbCr420P images from SRGB input is not yet supported";
|
<< "Outputting YCbCr420P images from SRGB input is not yet supported";
|
||||||
|
|
||||||
RET_CHECK(input_format_ == output_format_ ||
|
RET_CHECK(input_format_ == output_format_ ||
|
||||||
(input_format_ == ImageFormat::YCBCR420P &&
|
(input_format_ == ImageFormat::YCBCR420P &&
|
||||||
output_format_ == ImageFormat::SRGB) ||
|
output_format_ == ImageFormat::SRGB) ||
|
||||||
|
@ -705,9 +706,18 @@ absl::Status ScaleImageCalculator::Process(CalculatorContext* cc) {
|
||||||
} else {
|
} else {
|
||||||
// Upscale. If upscaling is disallowed, output_width_ and output_height_ are
|
// Upscale. If upscaling is disallowed, output_width_ and output_height_ are
|
||||||
// the same as the input/crop width and height.
|
// the same as the input/crop width and height.
|
||||||
|
if(output_format_ == ImageFormat::SRGB || output_format_ == ImageFormat::YCBCR420P) {
|
||||||
image_frame_util::RescaleImageFrame(
|
image_frame_util::RescaleImageFrame(
|
||||||
*image_frame, output_width_, output_height_, alignment_boundary_,
|
*image_frame, output_width_, output_height_, alignment_boundary_,
|
||||||
interpolation_algorithm_, output_frame.get());
|
interpolation_algorithm_, output_frame.get());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
cv::Mat input_mat = ::upipe::formats::MatView(image_frame);
|
||||||
|
output_frame->Reset(image_frame->Format(), output_width_, output_height_,
|
||||||
|
alignment_boundary_);
|
||||||
|
cv::Mat output_mat = ::upipe::formats::MatView(output_frame.get());
|
||||||
|
cv::resize(input_mat, output_mat, cv::Size(output_width_, output_height_), 0.0, 0.0, interpolation_algorithm_);
|
||||||
|
}
|
||||||
if (interpolation_algorithm_ != -1) {
|
if (interpolation_algorithm_ != -1) {
|
||||||
cc->GetCounter("Upscales")->Increment();
|
cc->GetCounter("Upscales")->Increment();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user