CONFIG_NEW_REF_SIGNALING: Incorrect checks for valid reference frames

How was the issue detected?

HDR Nova AV2 Verification

What version / commit were you testing with?

32f9c7ba

What steps will reproduce the problem?

We are trying to draft specification text for CONFIG_NEW_REF_SIGNALING, but have found a bug in the AVM reference implementation.

In decode_frame.c:read_uncompressed_header the reference frames are checked via:

     for (int i = 0; i < INTER_REFS_PER_FRAME; ++i) {
        const RefCntBuffer *const ref_buf = get_ref_frame_buf(cm, i);
        if (!ref_buf) continue;
        struct scale_factors *const ref_scale_factors =
            get_ref_scale_factors(cm, i);
        av1_setup_scale_factors_for_frame(
            ref_scale_factors, ref_buf->buf.y_crop_width,
            ref_buf->buf.y_crop_height, cm->width, cm->height);
        if ((!av1_is_valid_scale(ref_scale_factors)))
          aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
                             "Reference frame has invalid dimensions");
      }

This loop checks all 7 possible references. However, with CONFIG_NEW_REF_SIGNALING the number of references is variable (and given by cm->ref_frames_info.num_total_refs) so this code can incorrectly report errors for valid bitstreams.

Fix

Change the loop to replace the end condition i < INTER_REFS_PER_FRAME with i < cm->ref_frames_info.num_total_refs.