Commit b9e4140065 for aom
commit b9e41400658aa5aa5421dea206af8654812d0ed0
Author: Ram Mohan M <ram.mohan@ittiam.com>
Date: Mon May 11 16:05:03 2026 +0530
Simplify screen content decision
- Removed unused computes during screen content decision process
- Cleaned up documentation
Change-Id: I55eec04f25e9c756a2c97dc83140b518fafc6c78
diff --git a/aom/aom_encoder.h b/aom/aom_encoder.h
index 2e7f6bbe73..fa5117a3e9 100644
--- a/aom/aom_encoder.h
+++ b/aom/aom_encoder.h
@@ -473,13 +473,13 @@ typedef struct aom_codec_enc_cfg {
/*!\brief Bit-depth of the input source
*
- * This value identifies the actual bit-depth of the input source in bits.
- * Note that the frames passed as input to the encoder must match codec
- * bit-depth. If there is a mismatch between source bit-depth and codec
- * bit-depth, then the application is required to upshift the frame to the
- * codec bit-depth before passing it for encoding. Additionally, this variable
- * is used by the library to compute quality metrics at source bit-depth. So,
- * source bit-depth must not exceed codec bit-depth.
+ * This value identifies the actual bit-depth of the input source in bits. It
+ * must not exceed codec bit-depth. Note that the frames passed as input to
+ * the encoder must match codec bit-depth. So, if there is a mismatch between
+ * source bit-depth and codec bit-depth, the application is required to
+ * upshift the frame to the codec bit-depth before passing it for encoding.
+ * This is only used for computing quality metrics relative to the actual
+ * input source and has no effect on the encoder's output.
*/
unsigned int g_input_bit_depth;
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 5978f22284..55c7e913bb 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -768,7 +768,7 @@ typedef struct {
typedef struct {
// Indicates the framerate of the input video.
double init_framerate;
- // Indicates the actual bit-depth of the input video.
+ // Indicates the actual bit-depth of the input source.
unsigned int input_bit_depth;
// Indicates the maximum number of frames to be encoded.
unsigned int limit;
diff --git a/av1/encoder/encoder_utils.c b/av1/encoder/encoder_utils.c
index 9655c0395d..fecb939da9 100644
--- a/av1/encoder/encoder_utils.c
+++ b/av1/encoder/encoder_utils.c
@@ -1146,10 +1146,13 @@ static void screen_content_tools_determination(
#endif
#if CONFIG_AV1_HIGHBITDEPTH
- const uint32_t in_bit_depth = cpi->oxcf.input_cfg.input_bit_depth;
const uint32_t bit_depth = cpi->td.mb.e_mbd.bd;
+ // The decision to enable screen content tools is based on PSNR evaluated only
+ // at the stream bit-depth. Hence, PSNR computation against the actual input
+ // source is skipped by passing the codec bit-depth instead of the source
+ // bit-depth in the final arg.
aom_calc_highbd_psnr(cpi->source, &cpi->common.cur_frame->buf, &psnr[pass],
- bit_depth, in_bit_depth);
+ bit_depth, bit_depth);
#else
aom_calc_psnr(cpi->source, &cpi->common.cur_frame->buf, &psnr[pass]);
#endif