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 <stddef.h>
00033
00034 #include "libavcodec/cabac.h"
00035 #include "cabac.h"
00036
00037
00038
00039 #if HAVE_7REGS && !defined(BROKEN_RELOCATIONS)
00040 static int decode_significance_x86(CABACContext *c, int max_coeff,
00041 uint8_t *significant_coeff_ctx_base,
00042 int *index, x86_reg last_off){
00043 void *end= significant_coeff_ctx_base + max_coeff - 1;
00044 int minusstart= -(intptr_t)significant_coeff_ctx_base;
00045 int minusindex= 4-(intptr_t)index;
00046 int bit;
00047 x86_reg coeff_count;
00048 __asm__ volatile(
00049 "2: \n\t"
00050
00051 BRANCHLESS_GET_CABAC("%4", "%6", "(%1)", "%3",
00052 "%w3", "%5", "%k0", "%b0", "%a11")
00053
00054 "test $1, %4 \n\t"
00055 " jz 3f \n\t"
00056 "add %10, %1 \n\t"
00057
00058 BRANCHLESS_GET_CABAC("%4", "%6", "(%1)", "%3",
00059 "%w3", "%5", "%k0", "%b0", "%a11")
00060
00061 "sub %10, %1 \n\t"
00062 "mov %2, %0 \n\t"
00063 "movl %7, %%ecx \n\t"
00064 "add %1, %%"REG_c" \n\t"
00065 "movl %%ecx, (%0) \n\t"
00066
00067 "test $1, %4 \n\t"
00068 " jnz 4f \n\t"
00069
00070 "add"OPSIZE" $4, %2 \n\t"
00071
00072 "3: \n\t"
00073 "add $1, %1 \n\t"
00074 "cmp %8, %1 \n\t"
00075 " jb 2b \n\t"
00076 "mov %2, %0 \n\t"
00077 "movl %7, %%ecx \n\t"
00078 "add %1, %%"REG_c" \n\t"
00079 "movl %%ecx, (%0) \n\t"
00080 "4: \n\t"
00081 "add %9, %k0 \n\t"
00082 "shr $2, %k0 \n\t"
00083 :"=&q"(coeff_count), "+r"(significant_coeff_ctx_base), "+m"(index),
00084 "+&r"(c->low), "=&r"(bit), "+&r"(c->range)
00085 :"r"(c), "m"(minusstart), "m"(end), "m"(minusindex), "m"(last_off),
00086 "i"(offsetof(CABACContext, bytestream))
00087 : "%"REG_c, "memory"
00088 );
00089 return coeff_count;
00090 }
00091
00092 static int decode_significance_8x8_x86(CABACContext *c,
00093 uint8_t *significant_coeff_ctx_base,
00094 int *index, uint8_t *last_coeff_ctx_base, const uint8_t *sig_off){
00095 int minusindex= 4-(intptr_t)index;
00096 int bit;
00097 x86_reg coeff_count;
00098 x86_reg last=0;
00099 x86_reg state;
00100 __asm__ volatile(
00101 "mov %1, %6 \n\t"
00102 "2: \n\t"
00103
00104 "mov %10, %0 \n\t"
00105 "movzbl (%0, %6), %k6 \n\t"
00106 "add %9, %6 \n\t"
00107
00108 BRANCHLESS_GET_CABAC("%4", "%7", "(%6)", "%3",
00109 "%w3", "%5", "%k0", "%b0", "%a12")
00110
00111 "mov %1, %k6 \n\t"
00112 "test $1, %4 \n\t"
00113 " jz 3f \n\t"
00114
00115 "movzbl "MANGLE(last_coeff_flag_offset_8x8)"(%k6), %k6\n\t"
00116 "add %11, %6 \n\t"
00117
00118 BRANCHLESS_GET_CABAC("%4", "%7", "(%6)", "%3",
00119 "%w3", "%5", "%k0", "%b0", "%a12")
00120
00121 "mov %2, %0 \n\t"
00122 "mov %1, %k6 \n\t"
00123 "movl %k6, (%0) \n\t"
00124
00125 "test $1, %4 \n\t"
00126 " jnz 4f \n\t"
00127
00128 "add"OPSIZE" $4, %2 \n\t"
00129
00130 "3: \n\t"
00131 "addl $1, %k6 \n\t"
00132 "mov %k6, %1 \n\t"
00133 "cmpl $63, %k6 \n\t"
00134 " jb 2b \n\t"
00135 "mov %2, %0 \n\t"
00136 "movl %k6, (%0) \n\t"
00137 "4: \n\t"
00138 "addl %8, %k0 \n\t"
00139 "shr $2, %k0 \n\t"
00140 :"=&q"(coeff_count),"+m"(last), "+m"(index), "+&r"(c->low), "=&r"(bit),
00141 "+&r"(c->range), "=&r"(state)
00142 :"r"(c), "m"(minusindex), "m"(significant_coeff_ctx_base), "m"(sig_off), "m"(last_coeff_ctx_base),
00143 "i"(offsetof(CABACContext, bytestream))
00144 : "%"REG_c, "memory"
00145 );
00146 return coeff_count;
00147 }
00148 #endif
00149
00150 #endif