av1_superres_unscaled: Make it more accurate.

Handle the corner cases when frame may be unscaled even though scale
numerator and denominator don't match.

BUG=aomedia:1330

Change-Id: I59d23c7f17cd16cf33d9fbc3cc581a3e5270c967
diff --git a/av1/common/resize.c b/av1/common/resize.c
index afb91a0..8b57346 100644
--- a/av1/common/resize.c
+++ b/av1/common/resize.c
@@ -1201,9 +1201,8 @@
   }
 }
 
-// Calculates scaled dimensions given original dimensions and the scale
-// denominator. If 'scale_height' is 1, both width and height are scaled;
-// otherwise, only the width is scaled.
+// Calculates the scaled dimension given the original dimension and the scale
+// denominator.
 static void calculate_scaled_size_helper(int *dim, int denom) {
   if (denom != SCALE_NUMERATOR) {
     // Use this version if we need *dim to be even
diff --git a/av1/common/resize.h b/av1/common/resize.h
index 18a7712..b156a80 100644
--- a/av1/common/resize.h
+++ b/av1/common/resize.h
@@ -96,7 +96,10 @@
 
 // Returns 1 if a superres upscaled frame is unscaled and 0 otherwise.
 static INLINE int av1_superres_unscaled(const AV1_COMMON *cm) {
-  return (cm->superres_scale_denominator == SCALE_NUMERATOR);
+  // Note: for some corner cases (e.g. cm->width of 1), there may be no scaling
+  // required even though cm->superres_scale_denominator != SCALE_NUMERATOR.
+  // So, the following check is more accurate.
+  return (cm->width == cm->superres_upscaled_width);
 }
 #endif  // CONFIG_HORZONLY_FRAME_SUPERRES