From 429e9454964dadd4875285216217be2ff461a1f2 Mon Sep 17 00:00:00 2001 From: Marko Viitanen Date: Tue, 14 Jun 2022 14:31:57 +0300 Subject: [PATCH] Round width and height to next 8 pixels instead of 4 * New macro CONF_WINDOW_PAD_IN_PIXELS --- src/encmain.c | 4 ++-- src/encoder.c | 9 +++++---- src/global.h | 4 ++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/encmain.c b/src/encmain.c index 4678a1e5..2dde1d27 100644 --- a/src/encmain.c +++ b/src/encmain.c @@ -91,8 +91,8 @@ static FILE* open_output_file(const char* filename) } static unsigned get_padding(unsigned width_or_height){ - if (width_or_height % CU_MIN_SIZE_PIXELS){ - return CU_MIN_SIZE_PIXELS - (width_or_height % CU_MIN_SIZE_PIXELS); + if (width_or_height % CONF_WINDOW_PAD_IN_PIXELS) { + return CONF_WINDOW_PAD_IN_PIXELS - (width_or_height % CONF_WINDOW_PAD_IN_PIXELS); }else{ return 0; } diff --git a/src/encoder.c b/src/encoder.c index 86259ad9..529b7ce9 100644 --- a/src/encoder.c +++ b/src/encoder.c @@ -709,12 +709,13 @@ void uvg_encoder_control_input_init(encoder_control_t * const encoder, // pixels to the dimensions, so that they are. These extra pixels will be // compressed along with the real ones but they will be cropped out before // rendering. - if (encoder->in.width % CU_MIN_SIZE_PIXELS) { - encoder->in.width += CU_MIN_SIZE_PIXELS - (width % CU_MIN_SIZE_PIXELS); + // Changed to 8 pixel interval for VVC + if (encoder->in.width % CONF_WINDOW_PAD_IN_PIXELS) { + encoder->in.width += CONF_WINDOW_PAD_IN_PIXELS - (width % CONF_WINDOW_PAD_IN_PIXELS); } - if (encoder->in.height % CU_MIN_SIZE_PIXELS) { - encoder->in.height += CU_MIN_SIZE_PIXELS - (height % CU_MIN_SIZE_PIXELS); + if (encoder->in.height % CONF_WINDOW_PAD_IN_PIXELS) { + encoder->in.height += CONF_WINDOW_PAD_IN_PIXELS - (height % CONF_WINDOW_PAD_IN_PIXELS); } encoder->in.height_in_lcu = encoder->in.height / LCU_WIDTH; diff --git a/src/global.h b/src/global.h index 444cdfac..1f90997d 100644 --- a/src/global.h +++ b/src/global.h @@ -175,6 +175,10 @@ typedef int16_t mv_t; //! pow(2, MIN_SIZE) #define CU_MIN_SIZE_PIXELS (1 << MIN_SIZE) + +//! Round frame size up to this interval (8 pixels) +#define CONF_WINDOW_PAD_IN_PIXELS ((1 << MIN_SIZE)<<1) + //! spec: CtbSizeY #define LCU_WIDTH (1 << (MIN_SIZE + MAX_DEPTH)) //! spec: CtbWidthC and CtbHeightC