chromeos / cros-codecs

BSD 3-Clause "New" or "Revised" License
30 stars 11 forks source link

[Fluster] H.264 extended profile not listed in VAAPI (BA3_SVA_C failure) #7

Closed Gnurou closed 1 year ago

Gnurou commented 1 year ago

Fluster's JVT-AVC_V1::BA3_SVA_C test vector requires the extended profile, which we don't support yet:

cargo run --example ccdec -- BA3_SVA_C.264
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
     Running `target/debug/examples/ccdec BA3_SVA_C.264`
thread 'main' panicked at 'backend error: Invalid profile_idc 88', /usr/local/google/home/acourbot/Work/cros-codecs/src/utils.rs:234:27
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This profile is not listed in the VAProfile enum: https://github.com/intel/libva/blob/master/va/va.h#L502

Should we substitute another profile for it? The table on this post seems to suggest some features are exclusive to the extended profile, so there is no obvious candidate...

dwlsalmeida commented 1 year ago

Briefly looking at GStreamer, they map that to VAProfileH264Main, i.e.:

    case GST_H264_PROFILE_EXTENDED:
      if (sps->constraint_set1_flag) {  /* A.2.2 (main profile) */
        profiles[i++] = VAProfileH264Main;
      }
      break;

As that code has been in production for quite a while, I think it is safe to do the same here.

Gnurou commented 1 year ago

Thanks, with this I could pass the test! The check on constraint_set1_flag triggers on SP1_BT_A and sp2_bt_b, but without it the decoded result is incorrect. FFmpeg also cannot decode these correctly (we actually get the same MD5 if we ignore the flag).