Message ID | 20200829055218.32261-1-oddstone@gmail.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,1/2] avcodec/hevcdec: fix stat_coeff save/load for persistent_rice_adaptation_enabled_flag | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
Hi Mickaël & all, any suggestions? On Sat, Aug 29, 2020 at 1:52 PM Xu Guangxin <oddstone@gmail.com> wrote: > It's required by 9.3.1. following clips have this feature: > > WPP_HIGH_TP_444_8BIT_RExt_Apple_2.bit > Bitdepth_A_RExt_Sony_1.bin > Bitdepth_B_RExt_Sony_1.bin > EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_10BIT_RExt_Sony_1.bit > EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_12BIT_RExt_Sony_1.bit > EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_8BIT_RExt_Sony_1.bit > EXTPREC_MAIN_444_16_INTRA_10BIT_RExt_Sony_1.bit > EXTPREC_MAIN_444_16_INTRA_12BIT_RExt_Sony_1.bit > EXTPREC_MAIN_444_16_INTRA_8BIT_RExt_Sony_1.bit > WPP_AND_TILE_10Bit422Test_HIGH_TP_444_10BIT_RExt_Apple_2.bit > WPP_AND_TILE_AND_CABAC_BYPASS_ALIGN_0_HIGH_TP_444_14BIT_RExt_Apple_2.bit > WPP_AND_TILE_AND_CABAC_BYPASS_ALIGN_1_HIGH_TP_444_14BIT_RExt_Apple_2.bit > WPP_AND_TILE_HIGH_TP_444_8BIT_RExt_Apple_2.bit > > you can download them from: > > https://www.itu.int/wftp3/av-arch/jctvc-site/bitstream_exchange/draft_conformance/RExt/ > > Signed-off-by: Xu Guangxin <oddstone@gmail.com> > --- > libavcodec/hevc_cabac.c | 6 ++++++ > libavcodec/hevcdec.h | 4 +++- > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c > index 3dc0987dad..635b4edef3 100644 > --- a/libavcodec/hevc_cabac.c > +++ b/libavcodec/hevc_cabac.c > @@ -454,12 +454,18 @@ void ff_hevc_save_states(HEVCContext *s, int > ctb_addr_ts) > (s->ps.sps->ctb_width == 2 && > ctb_addr_ts % s->ps.sps->ctb_width == 0))) { > memcpy(s->cabac_state, s->HEVClc->cabac_state, HEVC_CONTEXTS); > + if (s->ps.sps->persistent_rice_adaptation_enabled_flag) { > + memcpy(s->stat_coeff, s->HEVClc->stat_coeff, > HEVC_STAT_COEFFS); > + } > } > } > > static void load_states(HEVCContext *s) > { > memcpy(s->HEVClc->cabac_state, s->cabac_state, HEVC_CONTEXTS); > + if (s->ps.sps->persistent_rice_adaptation_enabled_flag) { > + memcpy(s->HEVClc->stat_coeff, s->stat_coeff, HEVC_STAT_COEFFS); > + } > } > > static int cabac_reinit(HEVCLocalContext *lc) > diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h > index 39c5c7f89f..d41aed4556 100644 > --- a/libavcodec/hevcdec.h > +++ b/libavcodec/hevcdec.h > @@ -53,6 +53,7 @@ > #define DEFAULT_INTRA_TC_OFFSET 2 > > #define HEVC_CONTEXTS 199 > +#define HEVC_STAT_COEFFS 4 > > #define MRG_MAX_NUM_CANDS 5 > > @@ -424,7 +425,7 @@ typedef struct HEVCFrame { > typedef struct HEVCLocalContext { > uint8_t cabac_state[HEVC_CONTEXTS]; > > - uint8_t stat_coeff[4]; > + uint8_t stat_coeff[HEVC_STAT_COEFFS]; > > uint8_t first_qp_group; > > @@ -480,6 +481,7 @@ typedef struct HEVCContext { > int height; > > uint8_t *cabac_state; > + uint8_t stat_coeff[HEVC_STAT_COEFFS]; > > /** 1 if the independent slice segment header was successfully parsed > */ > uint8_t slice_initialized; > -- > 2.17.1 > >
Le mer. 9 sept. 2020 à 07:51, Guangxin Xu <oddstone@gmail.com> a écrit : > Hi Mickaël & all, > any suggestions? The patch is almost good, though I would have hoped to link at a relevant part of the specs and TableStatCoeff* beyong just "9.3". Though as I suspected, there is probably something missing. Maybe around sync across (tile) threads? You can check for yourself by running it like: make fate-hevc-conformance-WPP_HIGH_TP_444_8BIT_RExt_Apple_2 THREADS=12 THREAD_TYPE=slice Sure enough, the MD5 becomes random: -0, 0, 0, 1, 1179648, 0x78e55a69 -0, 1, 1, 1, 1179648, 0x5babb3cb -0, 2, 2, 1, 1179648, 0x65935648 +0, 0, 0, 1, 1179648, 0xa9a4a727 +0, 1, 1, 1, 1179648, 0xf4bfd32d +0, 2, 2, 1, 1179648, 0x4f28807a
diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c index 3dc0987dad..635b4edef3 100644 --- a/libavcodec/hevc_cabac.c +++ b/libavcodec/hevc_cabac.c @@ -454,12 +454,18 @@ void ff_hevc_save_states(HEVCContext *s, int ctb_addr_ts) (s->ps.sps->ctb_width == 2 && ctb_addr_ts % s->ps.sps->ctb_width == 0))) { memcpy(s->cabac_state, s->HEVClc->cabac_state, HEVC_CONTEXTS); + if (s->ps.sps->persistent_rice_adaptation_enabled_flag) { + memcpy(s->stat_coeff, s->HEVClc->stat_coeff, HEVC_STAT_COEFFS); + } } } static void load_states(HEVCContext *s) { memcpy(s->HEVClc->cabac_state, s->cabac_state, HEVC_CONTEXTS); + if (s->ps.sps->persistent_rice_adaptation_enabled_flag) { + memcpy(s->HEVClc->stat_coeff, s->stat_coeff, HEVC_STAT_COEFFS); + } } static int cabac_reinit(HEVCLocalContext *lc) diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index 39c5c7f89f..d41aed4556 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -53,6 +53,7 @@ #define DEFAULT_INTRA_TC_OFFSET 2 #define HEVC_CONTEXTS 199 +#define HEVC_STAT_COEFFS 4 #define MRG_MAX_NUM_CANDS 5 @@ -424,7 +425,7 @@ typedef struct HEVCFrame { typedef struct HEVCLocalContext { uint8_t cabac_state[HEVC_CONTEXTS]; - uint8_t stat_coeff[4]; + uint8_t stat_coeff[HEVC_STAT_COEFFS]; uint8_t first_qp_group; @@ -480,6 +481,7 @@ typedef struct HEVCContext { int height; uint8_t *cabac_state; + uint8_t stat_coeff[HEVC_STAT_COEFFS]; /** 1 if the independent slice segment header was successfully parsed */ uint8_t slice_initialized;
It's required by 9.3.1. following clips have this feature: WPP_HIGH_TP_444_8BIT_RExt_Apple_2.bit Bitdepth_A_RExt_Sony_1.bin Bitdepth_B_RExt_Sony_1.bin EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_10BIT_RExt_Sony_1.bit EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_12BIT_RExt_Sony_1.bit EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_8BIT_RExt_Sony_1.bit EXTPREC_MAIN_444_16_INTRA_10BIT_RExt_Sony_1.bit EXTPREC_MAIN_444_16_INTRA_12BIT_RExt_Sony_1.bit EXTPREC_MAIN_444_16_INTRA_8BIT_RExt_Sony_1.bit WPP_AND_TILE_10Bit422Test_HIGH_TP_444_10BIT_RExt_Apple_2.bit WPP_AND_TILE_AND_CABAC_BYPASS_ALIGN_0_HIGH_TP_444_14BIT_RExt_Apple_2.bit WPP_AND_TILE_AND_CABAC_BYPASS_ALIGN_1_HIGH_TP_444_14BIT_RExt_Apple_2.bit WPP_AND_TILE_HIGH_TP_444_8BIT_RExt_Apple_2.bit you can download them from: https://www.itu.int/wftp3/av-arch/jctvc-site/bitstream_exchange/draft_conformance/RExt/ Signed-off-by: Xu Guangxin <oddstone@gmail.com> --- libavcodec/hevc_cabac.c | 6 ++++++ libavcodec/hevcdec.h | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-)