This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit a337e8ddaa095a3cf82564272ec518cced09641e Author: Ramiro Polla <[email protected]> AuthorDate: Tue Nov 10 16:41:25 2026 +0100 Commit: Ramiro Polla <[email protected]> CommitDate: Wed Nov 11 16:01:48 2026 +0000 avcodec/x86/cabac: share the get_cabac refill between x86-64 and x86-32 Both versions of get_cabac now use the same tzcnt refill, so define it only once. Its norm_off and tables parameters are no longer used, so remove them. The generated code is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Ramiro Polla <[email protected]> --- libavcodec/x86/cabac.h | 43 +++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/libavcodec/x86/cabac.h b/libavcodec/x86/cabac.h index 810a1b0525..0282e76397 100644 --- a/libavcodec/x86/cabac.h +++ b/libavcodec/x86/cabac.h @@ -37,6 +37,21 @@ #if HAVE_INLINE_ASM +/* + * refill shift = tzcnt(low) - 16 + * low is never 0 here, so this also works on CPUs without BMI1, which + * execute tzcnt as bsf. + */ +#define BRANCHLESS_GET_CABAC_REFILL(low, tmp) \ + "movzwl (%%"FF_REG_c") , "tmp" \n\t"\ + "tzcnt "low" , %%ecx \n\t"\ + "bswap "tmp" \n\t"\ + "shr $15 , "tmp" \n\t"\ + "sub $16 , %%ecx \n\t"\ + "sub $0xFFFF , "tmp" \n\t"\ + "shl %%cl , "tmp" \n\t"\ + "add "tmp" , "low" \n\t" + #ifndef UNCHECKED_BITSTREAM_READER #define UNCHECKED_BITSTREAM_READER !CONFIG_SAFE_BITSTREAM_READER #endif @@ -54,21 +69,6 @@ #define CABAC_TMP_DECL int cabac_t1, cabac_t2; #define CABAC_TMP_OPERANDS , [cabac_t1]"=&r"(cabac_t1), [cabac_t2]"=&r"(cabac_t2) -/* - * refill shift = tzcnt(low) - 16 - * low is never 0 here, so this also works on CPUs without BMI1, which - * execute tzcnt as bsf. - */ -#define BRANCHLESS_GET_CABAC_REFILL(low, tmp, norm_off, tables) \ - "movzwl (%%"FF_REG_c") , "tmp" \n\t"\ - "tzcnt "low" , %%ecx \n\t"\ - "bswap "tmp" \n\t"\ - "shr $15 , "tmp" \n\t"\ - "sub $16 , %%ecx \n\t"\ - "sub $0xFFFF , "tmp" \n\t"\ - "shl %%cl , "tmp" \n\t"\ - "add "tmp" , "low" \n\t" - #define BRANCHLESS_GET_CABAC(ret, retq, statep, low, lowword, range, rangeq, tmp, tmpbyte, t1, t1q, t2, byte, end, norm_off, lps_off, mlps_off, tables) \ "movzbl "statep" , "ret" \n\t"\ "mov "low" , "t1" \n\t"\ @@ -101,7 +101,7 @@ END_CHECK(end)\ "add"FF_OPSIZE" $2 , "byte" \n\t"\ "1: \n\t"\ - BRANCHLESS_GET_CABAC_REFILL(low, tmp, norm_off, tables) \ + BRANCHLESS_GET_CABAC_REFILL(low, tmp) \ "2: \n\t" #else /* ARCH_X86_64 */ @@ -142,15 +142,6 @@ #define BRANCHLESS_GET_CABAC_RENORM(range, rangeq, norm_off, tables) \ "movzbl "MANGLE(ff_h264_cabac_tables)"+"norm_off"("range"), %%ecx \n\t" #endif /* __LZCNT__ */ -#define BRANCHLESS_GET_CABAC_REFILL(low, tmp, norm_off, tables) \ - "movzwl (%%"FF_REG_c") , "tmp" \n\t"\ - "tzcnt "low" , %%ecx \n\t"\ - "bswap "tmp" \n\t"\ - "shr $15 , "tmp" \n\t"\ - "sub $16 , %%ecx \n\t"\ - "sub $0xFFFF , "tmp" \n\t"\ - "shl %%cl , "tmp" \n\t"\ - "add "tmp" , "low" \n\t" #define BRANCHLESS_GET_CABAC(ret, retq, statep, low, lowword, range, rangeq, tmp, tmpbyte, t1, t1q, t2, byte, end, norm_off, lps_off, mlps_off, tables) \ "movzbl "statep" , "ret" \n\t"\ @@ -170,7 +161,7 @@ END_CHECK(end)\ "add"FF_OPSIZE" $2 , "byte" \n\t"\ "1: \n\t"\ - BRANCHLESS_GET_CABAC_REFILL(low, tmp, norm_off, tables) \ + BRANCHLESS_GET_CABAC_REFILL(low, tmp) \ "2: \n\t" #endif /* ARCH_X86_64 */ -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
