00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00029 #ifndef AVCODEC_X86_H264_I386_H
00030 #define AVCODEC_X86_H264_I386_H
00031
00032 #include "libavcodec/cabac.h"
00033
00034
00035
00036 #if ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE && !defined(BROKEN_RELOCATIONS)
00037 static int decode_significance_x86(CABACContext *c, int max_coeff,
00038 uint8_t *significant_coeff_ctx_base,
00039 int *index){
00040 void *end= significant_coeff_ctx_base + max_coeff - 1;
00041 int minusstart= -(int)significant_coeff_ctx_base;
00042 int minusindex= 4-(int)index;
00043 int coeff_count;
00044 __asm__ volatile(
00045 "movl "RANGE "(%3), %%esi \n\t"
00046 "movl "LOW "(%3), %%ebx \n\t"
00047
00048 "2: \n\t"
00049
00050 BRANCHLESS_GET_CABAC("%%edx", "%3", "(%1)", "%%ebx",
00051 "%%bx", "%%esi", "%%eax", "%%al")
00052
00053 "test $1, %%edx \n\t"
00054 " jz 3f \n\t"
00055
00056 BRANCHLESS_GET_CABAC("%%edx", "%3", "61(%1)", "%%ebx",
00057 "%%bx", "%%esi", "%%eax", "%%al")
00058
00059 "mov %2, %%"REG_a" \n\t"
00060 "movl %4, %%ecx \n\t"
00061 "add %1, %%"REG_c" \n\t"
00062 "movl %%ecx, (%%"REG_a") \n\t"
00063
00064 "test $1, %%edx \n\t"
00065 " jnz 4f \n\t"
00066
00067 "add $4, %%"REG_a" \n\t"
00068 "mov %%"REG_a", %2 \n\t"
00069
00070 "3: \n\t"
00071 "add $1, %1 \n\t"
00072 "cmp %5, %1 \n\t"
00073 " jb 2b \n\t"
00074 "mov %2, %%"REG_a" \n\t"
00075 "movl %4, %%ecx \n\t"
00076 "add %1, %%"REG_c" \n\t"
00077 "movl %%ecx, (%%"REG_a") \n\t"
00078 "4: \n\t"
00079 "add %6, %%eax \n\t"
00080 "shr $2, %%eax \n\t"
00081
00082 "movl %%esi, "RANGE "(%3) \n\t"
00083 "movl %%ebx, "LOW "(%3) \n\t"
00084 :"=&a"(coeff_count), "+r"(significant_coeff_ctx_base), "+m"(index)
00085 :"r"(c), "m"(minusstart), "m"(end), "m"(minusindex)
00086 : "%"REG_c, "%ebx", "%edx", "%esi", "memory"
00087 );
00088 return coeff_count;
00089 }
00090
00091 static int decode_significance_8x8_x86(CABACContext *c,
00092 uint8_t *significant_coeff_ctx_base,
00093 int *index, const uint8_t *sig_off){
00094 int minusindex= 4-(int)index;
00095 int coeff_count;
00096 x86_reg last=0;
00097 __asm__ volatile(
00098 "movl "RANGE "(%3), %%esi \n\t"
00099 "movl "LOW "(%3), %%ebx \n\t"
00100
00101 "mov %1, %%"REG_D" \n\t"
00102 "2: \n\t"
00103
00104 "mov %6, %%"REG_a" \n\t"
00105 "movzbl (%%"REG_a", %%"REG_D"), %%edi \n\t"
00106 "add %5, %%"REG_D" \n\t"
00107
00108 BRANCHLESS_GET_CABAC("%%edx", "%3", "(%%"REG_D")", "%%ebx",
00109 "%%bx", "%%esi", "%%eax", "%%al")
00110
00111 "mov %1, %%edi \n\t"
00112 "test $1, %%edx \n\t"
00113 " jz 3f \n\t"
00114
00115 "movzbl "MANGLE(last_coeff_flag_offset_8x8)"(%%edi), %%edi\n\t"
00116 "add %5, %%"REG_D" \n\t"
00117
00118 BRANCHLESS_GET_CABAC("%%edx", "%3", "15(%%"REG_D")", "%%ebx",
00119 "%%bx", "%%esi", "%%eax", "%%al")
00120
00121 "mov %2, %%"REG_a" \n\t"
00122 "mov %1, %%edi \n\t"
00123 "movl %%edi, (%%"REG_a") \n\t"
00124
00125 "test $1, %%edx \n\t"
00126 " jnz 4f \n\t"
00127
00128 "add $4, %%"REG_a" \n\t"
00129 "mov %%"REG_a", %2 \n\t"
00130
00131 "3: \n\t"
00132 "addl $1, %%edi \n\t"
00133 "mov %%edi, %1 \n\t"
00134 "cmpl $63, %%edi \n\t"
00135 " jb 2b \n\t"
00136 "mov %2, %%"REG_a" \n\t"
00137 "movl %%edi, (%%"REG_a") \n\t"
00138 "4: \n\t"
00139 "addl %4, %%eax \n\t"
00140 "shr $2, %%eax \n\t"
00141
00142 "movl %%esi, "RANGE "(%3) \n\t"
00143 "movl %%ebx, "LOW "(%3) \n\t"
00144 :"=&a"(coeff_count),"+m"(last), "+m"(index)
00145 :"r"(c), "m"(minusindex), "m"(significant_coeff_ctx_base), "m"(sig_off)
00146 : "%"REG_c, "%ebx", "%edx", "%esi", "%"REG_D, "memory"
00147 );
00148 return coeff_count;
00149 }
00150 #endif
00151
00152
00153 #endif