Hi,

this series completes the CAVS decoder for the AVS1-P16
(Guangdian/Broadcasting) profile and fixes a number of long-standing
decoder bugs, after the GDM4.2 (AVS1-P16) and RM52K (AVS1-P2)
reference decoders:

 - 4:2:2 chroma format (chroma_format=2): CBP422, 8x16 chroma MB
   geometry, second chroma intra prediction mode, doubled vertical
   chroma displacement in MC, and the corresponding deblocking
   edges. Legacy clips signalling the reserved value 0 keep being
   decoded as 4:2:0 (as FFmpeg always did); 4:0:0 and the reserved
   value 3 are rejected, and mid-stream chroma_format changes are
   refused to protect the DPB geometry.
 - slice-level weighted prediction for P and B slices (parameter
   parsing, per-MB flag, separate weighting of each direction for
   bi-prediction).
 - arithmetic entropy decoding (AEC) robustness: 32-bit
   dequantization and a 32-bit inverse transform matching the GDM
   reference (it keeps dequantized coefficients in 32-bit ints).
 - Guangdian adaptive weighting quantisation (AWQ): the weighting
   quant matrix derivation (all four models), the chroma quantizer
   offsets in residual decoding and in the loop filter.
 - frame pictures of interlaced sequences code ceil(height/16)
   rows; the never-coded bottom rows of the reference buffers are
   concealed GDM-style (exit_picture/ERROR_CONTROL).
 - bitstream handling: leading zero stuffing between the picture
   header and picture data, runs of 0x80 stuffing bytes before a
   slice start code, and no slice start probing while a skip run is
   pending (a run consumes no bits, so probing can swallow the next
   slice header and leave whole macroblock rows undecoded).
 - B picture symmetric scaling: drop the bogus 16-bit range check,
   using defined int32 wraparound for the overflowing products
   (matching the reference).
 - the DPB display queue now tracks an outputed flag per slot, so
   streams that repeat their sequence header with alternating
   low_delay (e.g. 03_Tsinghua_2_1_4.0field) no longer drop a frame.
 - IDCT: the C version clips the column results to int16 like the
   reference; the SSE2 version is rewritten with 32-bit
   intermediates and is bit-exact with the C version for the full
   int16 input range (x86-64 only; 32-bit x86 keeps the C IDCT).
   The 32-bit IDCT is exported as ff_cavs_idct8_add_int32() and
   covered by a matrix-product unit test, including out-of-int16
   coefficients.

Verification: the decoder output is bit-exact against GDM4.2/RM52K
on the full public AVS conformance corpus (165 streams: AVS1-P16
STEP1/STEP2, AVS1-P2_JZP09, and the 2009 standard set) and on 96
legacy sample clips; FATE passes (6298 tests, including the six new
ones); checkasm and the cavsdsp unit test pass; each commit builds
warning-free on its own.

The last patch adds six FATE decoder tests. Their samples
(~545 KB total, cut from the public AVS conformance dataset) need
to be uploaded to the fate-suite server:

  cavs/guangdian-aec-cif.avs       (AEC, interlaced sequence)
  cavs/guangdian-aec-field.avs     (AEC + weighting quant + field)
  cavs/jizhun-422-hisilicon.avs    (4:2:2 chroma)
  cavs/jizhun-wp-cesi.avs          (weighted prediction)
  cavs/jizhun-field-cesi.avs       (field-coded pictures)
  cavs/jizhun-lowdelay-broadcom.avs (low_delay + stuffing + ext data)

Each was verified to decode bit-exactly to the reference decoder
output of the corresponding full conformance stream. I can provide
the files by any convenient means (link, or a maintainer grabbing
them from me).

Thanks,
jianfeng

jianfeng.zheng (14):
  avcodec/cavsdec: support 4:2:2 chroma format (chroma_format=2)
  avcodec/cavsdec: implement weighted prediction for P and B slices
  avcodec/cavsdec: 32-bit dequantization and IDCT for the AEC path
  avcodec/cavsdec: support Guangdian adaptive weighting quantisation
    (AWQ)
  avcodec/cavsdsp: export the 32-bit IDCT and test it
  avcodec/cavsdec: fix frame pictures of interlaced sequences (coded
    rows)
  avcodec/cavsdec: skip zero stuffing between the picture header and
    data
  avcodec/cavsdec: drop bogus 16-bit range check on the B scaling factor
  avcodec/cavsdec: make the DPB display queue survive low_delay changes
  avcodec/cavsdsp: clip CAVS IDCT column intermediates to int16 like the
    reference
  avcodec/x86/cavsdsp: rewrite SSE2 IDCT with 32-bit intermediates
  avcodec/cavsdec: do not scan for a slice start while a skip run is
    pending
  avcodec/cavsdec: skip 0x80 stuffing bytes when probing for a slice
    start code
  fate/avs: add AVS decoder tests covering the Guangdian feature set

 libavcodec/cavs.c                       | 263 ++++++++++--
 libavcodec/cavs.h                       |  34 +-
 libavcodec/cavsdec.c                    | 519 +++++++++++++++++++++---
 libavcodec/cavsdsp.c                    | 100 ++++-
 libavcodec/cavsdsp.h                    |   2 +
 libavcodec/tests/cavsdsp.c              |  70 ++++
 libavcodec/x86/cavsdsp.c                |  30 +-
 libavcodec/x86/cavsidct.asm             | 374 +++++++++++------
 tests/Makefile                          |   1 +
 tests/fate/avs.mak                      |  41 ++
 tests/ref/fate/cavs-guangdian-aec       |   9 +
 tests/ref/fate/cavs-guangdian-aec-field |   9 +
 tests/ref/fate/cavs-jizhun-422          |   9 +
 tests/ref/fate/cavs-jizhun-field        |  12 +
 tests/ref/fate/cavs-jizhun-lowdelay     |  10 +
 tests/ref/fate/cavs-jizhun-wp           |   8 +
 16 files changed, 1260 insertions(+), 231 deletions(-)
 create mode 100644 tests/fate/avs.mak
 create mode 100644 tests/ref/fate/cavs-guangdian-aec
 create mode 100644 tests/ref/fate/cavs-guangdian-aec-field
 create mode 100644 tests/ref/fate/cavs-jizhun-422
 create mode 100644 tests/ref/fate/cavs-jizhun-field
 create mode 100644 tests/ref/fate/cavs-jizhun-lowdelay
 create mode 100644 tests/ref/fate/cavs-jizhun-wp

-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to