aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/x86/h264_i386.h
diff options
context:
space:
mode:
authorRoland Scheidegger <rscheidegger_lists@hispeed.ch>2012-04-27 22:12:19 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-04-28 20:02:27 +0200
commit7f668cd2b5f13afa0de9f593948ce2f703ab5aaa (patch)
tree4755bc3a5668cf24d7c83db139ebab1baa529e64 /libavcodec/x86/h264_i386.h
parente52b96187b5451d44ec9bbbb4b6151aebac8b559 (diff)
downloadffmpeg-7f668cd2b5f13afa0de9f593948ce2f703ab5aaa.tar.gz
h264: use one table instead of several for cabac functions
The reason is this is easier for PIC code (in particular on darwin...). Keep the old names as pointers (static in cabac_functions.h so gcc knows these are just immediate offsets) so the c code can nicely stay the same (alternatively could use offsets directly in the functions needing the tables). This should produce the same code as before with non-pic and better code (confirmed) with pic. The assembly uses the new table but still won't work for PIC case. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/x86/h264_i386.h')
-rw-r--r--libavcodec/x86/h264_i386.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/libavcodec/x86/h264_i386.h b/libavcodec/x86/h264_i386.h
index 6aa2d073e3..d2787087cf 100644
--- a/libavcodec/x86/h264_i386.h
+++ b/libavcodec/x86/h264_i386.h
@@ -45,12 +45,13 @@ static int decode_significance_x86(CABACContext *c, int max_coeff,
int minusindex= 4-(intptr_t)index;
int bit;
x86_reg coeff_count;
+
__asm__ volatile(
"3: \n\t"
BRANCHLESS_GET_CABAC("%4", "(%1)", "%3", "%w3",
"%5", "%k0", "%b0",
- "%a11(%6)", "%a12(%6)")
+ "%a11(%6)", "%a12(%6)", "%a13", "%a14", "%a15")
"test $1, %4 \n\t"
" jz 4f \n\t"
@@ -58,7 +59,7 @@ static int decode_significance_x86(CABACContext *c, int max_coeff,
BRANCHLESS_GET_CABAC("%4", "(%1)", "%3", "%w3",
"%5", "%k0", "%b0",
- "%a11(%6)", "%a12(%6)")
+ "%a11(%6)", "%a12(%6)", "%a13", "%a14", "%a15")
"sub %10, %1 \n\t"
"mov %2, %0 \n\t"
@@ -86,7 +87,10 @@ static int decode_significance_x86(CABACContext *c, int max_coeff,
"+&r"(c->low), "=&r"(bit), "+&r"(c->range)
: "r"(c), "m"(minusstart), "m"(end), "m"(minusindex), "m"(last_off),
"i"(offsetof(CABACContext, bytestream)),
- "i"(offsetof(CABACContext, bytestream_end))
+ "i"(offsetof(CABACContext, bytestream_end)),
+ "i"(H264_NORM_SHIFT_OFFSET),
+ "i"(H264_LPS_RANGE_OFFSET),
+ "i"(H264_MLPS_STATE_OFFSET)
: "%"REG_c, "memory"
);
return coeff_count;
@@ -100,6 +104,7 @@ static int decode_significance_8x8_x86(CABACContext *c,
x86_reg coeff_count;
x86_reg last=0;
x86_reg state;
+
__asm__ volatile(
"mov %1, %6 \n\t"
"3: \n\t"
@@ -110,18 +115,19 @@ static int decode_significance_8x8_x86(CABACContext *c,
BRANCHLESS_GET_CABAC("%4", "(%6)", "%3", "%w3",
"%5", "%k0", "%b0",
- "%a12(%7)", "%a13(%7)")
+ "%a12(%7)", "%a13(%7)", "%a14", "%a15", "%a16")
"mov %1, %k6 \n\t"
"test $1, %4 \n\t"
" jz 4f \n\t"
- "movzbl "MANGLE(last_coeff_flag_offset_8x8)"(%k6), %k6\n\t"
+ "movzbl "MANGLE(ff_h264_cabac_tables)"+%a17(%k6), %k6\n\t"
+
"add %11, %6 \n\t"
BRANCHLESS_GET_CABAC("%4", "(%6)", "%3", "%w3",
"%5", "%k0", "%b0",
- "%a12(%7)", "%a13(%7)")
+ "%a12(%7)", "%a13(%7)", "%a14", "%a15", "%a16")
"mov %2, %0 \n\t"
"mov %1, %k6 \n\t"
@@ -147,7 +153,11 @@ static int decode_significance_8x8_x86(CABACContext *c,
: "r"(c), "m"(minusindex), "m"(significant_coeff_ctx_base),
"m"(sig_off), "m"(last_coeff_ctx_base),
"i"(offsetof(CABACContext, bytestream)),
- "i"(offsetof(CABACContext, bytestream_end))
+ "i"(offsetof(CABACContext, bytestream_end)),
+ "i"(H264_NORM_SHIFT_OFFSET),
+ "i"(H264_LPS_RANGE_OFFSET),
+ "i"(H264_MLPS_STATE_OFFSET),
+ "i"(H264_LAST_COEFF_FLAG_OFFSET_8x8_OFFSET)
: "%"REG_c, "memory"
);
return coeff_count;