From dbf0881415b713cfb4e3c9d1b0bbf3e43ff95aca Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 1 Oct 2020 15:19:01 +0200 Subject: [PATCH 1/3] first video filter will add padding to input if has width or height with odd numbers --- pype/plugins/global/publish/extract_review.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pype/plugins/global/publish/extract_review.py b/pype/plugins/global/publish/extract_review.py index 0bae1b2ddc..db81adfcf7 100644 --- a/pype/plugins/global/publish/extract_review.py +++ b/pype/plugins/global/publish/extract_review.py @@ -633,6 +633,26 @@ class ExtractReview(pyblish.api.InstancePlugin): input_width = int(input_data["width"]) input_height = int(input_data["height"]) + # Make sure input width and height is not an odd number + input_width_is_odd = bool(input_width % 2 != 0) + inputh_height_is_odd = bool(input_height % 2 != 0) + if input_width_is_odd or inputh_height_is_odd: + # Add padding to input and make sure this filter is at first place + filters.append("pad=width=ceil(iw/2)*2:height=ceil(ih/2)*2") + + # Change input width or height as first filter will change them + if input_width_is_odd: + self.log.info(( + "Converting input width from odd to even number. {} -> {}" + ).format(input_width, input_width + 1)) + input_width += 1 + + if inputh_height_is_odd: + self.log.info(( + "Converting input height from odd to even number. {} -> {}" + ).format(input_height, input_height + 1)) + input_height += 1 + self.log.debug("pixel_aspect: `{}`".format(pixel_aspect)) self.log.debug("input_width: `{}`".format(input_width)) self.log.debug("input_height: `{}`".format(input_height)) From 70780cbc5309e1191375ccdbaf577a981d6bd30e Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 1 Oct 2020 15:19:41 +0200 Subject: [PATCH 2/3] also make sure output width or height does not contain odd numbers --- pype/plugins/global/publish/extract_review.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pype/plugins/global/publish/extract_review.py b/pype/plugins/global/publish/extract_review.py index db81adfcf7..3febff0f16 100644 --- a/pype/plugins/global/publish/extract_review.py +++ b/pype/plugins/global/publish/extract_review.py @@ -674,6 +674,22 @@ class ExtractReview(pyblish.api.InstancePlugin): output_width = int(output_width) output_height = int(output_height) + # Make sure output width and height is not an odd number + # When this can happen: + # - if output definition has set width and height with odd number + # - `instance.data` contain width and height with odd numbeer + if output_width % 2 != 0: + self.log.warning(( + "Converting output width from odd to even number. {} -> {}" + ).format(output_width, output_width + 1)) + output_width += 1 + + if output_height % 2 != 0: + self.log.warning(( + "Converting output height from odd to even number. {} -> {}" + ).format(output_height, output_height + 1)) + output_height += 1 + self.log.debug( "Output resolution is {}x{}".format(output_width, output_height) ) From 2c6797e63a3cdeebfb047f16ef531c298aed6bbf Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 1 Oct 2020 17:11:06 +0200 Subject: [PATCH 3/3] fixed typo --- pype/plugins/global/publish/extract_review.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pype/plugins/global/publish/extract_review.py b/pype/plugins/global/publish/extract_review.py index 3febff0f16..318c843b80 100644 --- a/pype/plugins/global/publish/extract_review.py +++ b/pype/plugins/global/publish/extract_review.py @@ -635,8 +635,8 @@ class ExtractReview(pyblish.api.InstancePlugin): # Make sure input width and height is not an odd number input_width_is_odd = bool(input_width % 2 != 0) - inputh_height_is_odd = bool(input_height % 2 != 0) - if input_width_is_odd or inputh_height_is_odd: + input_height_is_odd = bool(input_height % 2 != 0) + if input_width_is_odd or input_height_is_odd: # Add padding to input and make sure this filter is at first place filters.append("pad=width=ceil(iw/2)*2:height=ceil(ih/2)*2") @@ -647,7 +647,7 @@ class ExtractReview(pyblish.api.InstancePlugin): ).format(input_width, input_width + 1)) input_width += 1 - if inputh_height_is_odd: + if input_height_is_odd: self.log.info(( "Converting input height from odd to even number. {} -> {}" ).format(input_height, input_height + 1))