Skip to content

Commit

Permalink
avcodec/vvc/cabac: remove vvc_refill2
Browse files Browse the repository at this point in the history
See ffvvc#178

Signed-off-by: Wu Jianhua <[email protected]>
  • Loading branch information
QSXW committed Aug 8, 2024
1 parent fd5a4ec commit f2efe39
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
2 changes: 1 addition & 1 deletion libavcodec/cabac_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static inline void renorm_cabac_decoder_once(CABACContext *c){
}
#endif

#ifndef get_cabac_inline
#if !defined(get_cabac_inline) || !defined(refill2)
static void refill2(CABACContext *c){
int i;
unsigned x;
Expand Down
28 changes: 1 addition & 27 deletions libavcodec/vvc/cabac.c
Original file line number Diff line number Diff line change
Expand Up @@ -856,32 +856,6 @@ int ff_vvc_cabac_init(VVCLocalContext *lc,
return ret;
}

//fixme
static void vvc_refill2(CABACContext* c) {
int i;
unsigned x;
#if !HAVE_FAST_CLZ
x = c->low ^ (c->low - 1);
i = 7 - ff_h264_norm_shift[x >> (CABAC_BITS - 1)];
#else
i = ff_ctz(c->low) - CABAC_BITS;
#endif

x = -CABAC_MASK;

#if CABAC_BITS == 16
x += (c->bytestream[0] << 9) + (c->bytestream[1] << 1);
#else
x += c->bytestream[0] << 1;
#endif

c->low += x << i;
#if !UNCHECKED_BITSTREAM_READER
if (c->bytestream < c->bytestream_end)
#endif
c->bytestream += CABAC_BITS / 8;
}

static int inline vvc_get_cabac(CABACContext *c, VVCCabacState* base, const int ctx)
{
VVCCabacState *s = base + ctx;
Expand All @@ -904,7 +878,7 @@ static int inline vvc_get_cabac(CABACContext *c, VVCCabacState* base, const int
c->low <<= lps_mask;

if (!(c->low & CABAC_MASK))
vvc_refill2(c);
refill2(c);
s->state[0] = s->state[0] - (s->state[0] >> s->shift[0]) + (1023 * bit >> s->shift[0]);
s->state[1] = s->state[1] - (s->state[1] >> s->shift[1]) + (16383 * bit >> s->shift[1]);
return bit;
Expand Down

0 comments on commit f2efe39

Please sign in to comment.