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