[FFmpeg-cvslog] cabac_functions: Allow more functions to be overridden
John Cox
git at videolan.org
Fri Jan 22 04:38:54 CET 2016
ffmpeg | branch: master | John Cox <jc at kynesim.co.uk> | Wed Jan 20 17:59:30 2016 +0000| [74105fc9a3c4e37aea3d1ba3e132398f9fb0b944] | committer: Michael Niedermayer
cabac_functions: Allow more functions to be overridden
Allow more of the cabac functions to be overridden and avoid generating any
code for unwanted refill functions.
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=74105fc9a3c4e37aea3d1ba3e132398f9fb0b944
---
libavcodec/cabac_functions.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/libavcodec/cabac_functions.h b/libavcodec/cabac_functions.h
index 42841c7..cbb186b 100644
--- a/libavcodec/cabac_functions.h
+++ b/libavcodec/cabac_functions.h
@@ -51,6 +51,7 @@ static const uint8_t * const ff_h264_lps_range = ff_h264_cabac_tables + H264_LPS
static const uint8_t * const ff_h264_mlps_state = ff_h264_cabac_tables + H264_MLPS_STATE_OFFSET;
static const uint8_t * const ff_h264_last_coeff_flag_offset_8x8 = ff_h264_cabac_tables + H264_LAST_COEFF_FLAG_OFFSET_8x8_OFFSET;
+#if !defined(get_cabac_bypass) || !defined(get_cabac_terminate)
static void refill(CABACContext *c){
#if CABAC_BITS == 16
c->low+= (c->bytestream[0]<<9) + (c->bytestream[1]<<1);
@@ -63,7 +64,9 @@ static void refill(CABACContext *c){
#endif
c->bytestream += CABAC_BITS / 8;
}
+#endif
+#ifndef get_cabac_terminate
static inline void renorm_cabac_decoder_once(CABACContext *c){
int shift= (uint32_t)(c->range - 0x100)>>31;
c->range<<= shift;
@@ -71,6 +74,7 @@ static inline void renorm_cabac_decoder_once(CABACContext *c){
if(!(c->low & CABAC_MASK))
refill(c);
}
+#endif
#ifndef get_cabac_inline
static void refill2(CABACContext *c){
@@ -97,7 +101,9 @@ static void refill2(CABACContext *c){
#endif
c->bytestream += CABAC_BITS/8;
}
+#endif
+#ifndef get_cabac_inline
static av_always_inline int get_cabac_inline(CABACContext *c, uint8_t * const state){
int s = *state;
int RangeLPS= ff_h264_lps_range[2*(c->range&0xC0) + s];
@@ -169,6 +175,7 @@ static av_always_inline int get_cabac_bypass_sign(CABACContext *c, int val){
*
* @return the number of bytes read or 0 if no end
*/
+#ifndef get_cabac_terminate
static int av_unused get_cabac_terminate(CABACContext *c){
c->range -= 2;
if(c->low < c->range<<(CABAC_BITS+1)){
@@ -178,11 +185,13 @@ static int av_unused get_cabac_terminate(CABACContext *c){
return c->bytestream - c->bytestream_start;
}
}
+#endif
/**
* Skip @p n bytes and reset the decoder.
* @return the address of the first skipped byte or NULL if there's less than @p n bytes left
*/
+#ifndef skip_bytes
static av_unused const uint8_t* skip_bytes(CABACContext *c, int n) {
const uint8_t *ptr = c->bytestream;
@@ -199,5 +208,6 @@ static av_unused const uint8_t* skip_bytes(CABACContext *c, int n) {
return ptr;
}
+#endif
#endif /* AVCODEC_CABAC_FUNCTIONS_H */
More information about the ffmpeg-cvslog
mailing list