summaryrefslogtreecommitdiff
path: root/ffmpeg/libavcodec/h264_cabac.c
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2013-12-29 12:19:38 +0000
committerTim Redfern <tim@eclectronics.org>2013-12-29 12:19:38 +0000
commitf7813a5324be39d13ab536c245d15dfc602a7849 (patch)
treefad99148b88823d34a5df2f0a25881a002eb291b /ffmpeg/libavcodec/h264_cabac.c
parentb7a5a477b8ff4d4e3028b9dfb9a9df0a41463f92 (diff)
basic type mechanism working
Diffstat (limited to 'ffmpeg/libavcodec/h264_cabac.c')
-rw-r--r--ffmpeg/libavcodec/h264_cabac.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/ffmpeg/libavcodec/h264_cabac.c b/ffmpeg/libavcodec/h264_cabac.c
index 6f7224e..c0ca154 100644
--- a/ffmpeg/libavcodec/h264_cabac.c
+++ b/ffmpeg/libavcodec/h264_cabac.c
@@ -28,6 +28,7 @@
#define CABAC(h) 1
#define UNCHECKED_BITSTREAM_READER 1
+#include "libavutil/attributes.h"
#include "config.h"
#include "cabac.h"
#include "cabac_functions.h"
@@ -1683,7 +1684,6 @@ decode_cabac_residual_internal(H264Context *h, int16_t *block,
}
}
-
#define STORE_BLOCK(type) \
do { \
uint8_t *ctx = coeff_abs_level1_ctx[node_ctx] + abs_level_m1_ctx_base; \
@@ -1727,11 +1727,11 @@ decode_cabac_residual_internal(H264Context *h, int16_t *block,
} \
} while ( coeff_count );
- if (h->pixel_shift) {
- STORE_BLOCK(int32_t)
- } else {
- STORE_BLOCK(int16_t)
- }
+ if (h->pixel_shift) {
+ STORE_BLOCK(int32_t)
+ } else {
+ STORE_BLOCK(int16_t)
+ }
#ifdef CABAC_ON_STACK
h->cabac.range = cc.range ;
h->cabac.low = cc.low ;
@@ -1740,26 +1740,30 @@ decode_cabac_residual_internal(H264Context *h, int16_t *block,
}
-static void decode_cabac_residual_dc_internal(H264Context *h, int16_t *block,
- int cat, int n,
- const uint8_t *scantable,
- int max_coeff)
+static av_noinline void decode_cabac_residual_dc_internal(H264Context *h,
+ int16_t *block,
+ int cat, int n,
+ const uint8_t *scantable,
+ int max_coeff)
{
decode_cabac_residual_internal(h, block, cat, n, scantable, NULL, max_coeff, 1, 0);
}
-static void decode_cabac_residual_dc_internal_422(H264Context *h, int16_t *block,
- int cat, int n, const uint8_t *scantable,
- int max_coeff)
+static av_noinline void decode_cabac_residual_dc_internal_422(H264Context *h,
+ int16_t *block,
+ int cat, int n,
+ const uint8_t *scantable,
+ int max_coeff)
{
decode_cabac_residual_internal(h, block, cat, n, scantable, NULL, max_coeff, 1, 1);
}
-static void decode_cabac_residual_nondc_internal(H264Context *h, int16_t *block,
- int cat, int n,
- const uint8_t *scantable,
- const uint32_t *qmul,
- int max_coeff)
+static av_noinline void decode_cabac_residual_nondc_internal(H264Context *h,
+ int16_t *block,
+ int cat, int n,
+ const uint8_t *scantable,
+ const uint32_t *qmul,
+ int max_coeff)
{
decode_cabac_residual_internal(h, block, cat, n, scantable, qmul, max_coeff, 0, 0);
}
@@ -1811,7 +1815,7 @@ static av_always_inline void decode_cabac_residual_nondc(H264Context *h,
int max_coeff)
{
/* read coded block flag */
- if( (cat != 5 || CHROMA444) && get_cabac( &h->cabac, &h->cabac_state[get_cabac_cbf_ctx( h, cat, n, max_coeff, 0 ) ] ) == 0 ) {
+ if( (cat != 5 || CHROMA444(h)) && get_cabac( &h->cabac, &h->cabac_state[get_cabac_cbf_ctx( h, cat, n, max_coeff, 0 ) ] ) == 0 ) {
if( max_coeff == 64 ) {
fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, 0, 1);
} else {
@@ -2296,7 +2300,7 @@ decode_intra_mb:
/* It would be better to do this in fill_decode_caches, but we don't know
* the transform mode of the current macroblock there. */
- if (CHROMA444 && IS_8x8DCT(mb_type)){
+ if (CHROMA444(h) && IS_8x8DCT(mb_type)){
int i;
uint8_t *nnz_cache = h->non_zero_count_cache;
for (i = 0; i < 2; i++){
@@ -2361,10 +2365,10 @@ decode_intra_mb:
h->last_qscale_diff=0;
decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 0);
- if(CHROMA444){
+ if (CHROMA444(h)) {
decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 1);
decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 2);
- } else if (CHROMA422) {
+ } else if (CHROMA422(h)) {
if( cbp&0x30 ){
int c;
for (c = 0; c < 2; c++)