Mercurial > libavcodec.hg
comparison cabac.h @ 4112:29f5edb4430a libavcodec
Add ARCH_X86_32 as a new define for 32 bit x86 architectures and change
the semantics of ARCH_X86 to mean both 32 and 64 bits.
author | diego |
---|---|
date | Wed, 01 Nov 2006 17:01:33 +0000 |
parents | 8b1819f82c4a |
children | 4ce3923d5806 |
comparison
equal
deleted
inserted
replaced
4111:bfc1532904eb | 4112:29f5edb4430a |
---|---|
377 #else | 377 #else |
378 #define BYTESTART "12" | 378 #define BYTESTART "12" |
379 #define BYTE "16" | 379 #define BYTE "16" |
380 #define BYTEEND "20" | 380 #define BYTEEND "20" |
381 #endif | 381 #endif |
382 #if defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) | 382 #if defined(ARCH_X86_32) && !(defined(PIC) && defined(__GNUC__)) |
383 int bit; | 383 int bit; |
384 | 384 |
385 #ifndef BRANCHLESS_CABAC_DECODER | 385 #ifndef BRANCHLESS_CABAC_DECODER |
386 asm volatile( | 386 asm volatile( |
387 "movzbl (%1), %0 \n\t" | 387 "movzbl (%1), %0 \n\t" |
533 :"r"(state), "r"(c) | 533 :"r"(state), "r"(c) |
534 : "%"REG_c, "%ebx", "%edx", "%esi", "memory" | 534 : "%"REG_c, "%ebx", "%edx", "%esi", "memory" |
535 ); | 535 ); |
536 bit&=1; | 536 bit&=1; |
537 #endif /* BRANCHLESS_CABAC_DECODER */ | 537 #endif /* BRANCHLESS_CABAC_DECODER */ |
538 #else /* defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) */ | 538 #else /* defined(ARCH_X86_32) && !(defined(PIC) && defined(__GNUC__)) */ |
539 int s = *state; | 539 int s = *state; |
540 int RangeLPS= ff_h264_lps_range[2*(c->range&0xC0) + s]; | 540 int RangeLPS= ff_h264_lps_range[2*(c->range&0xC0) + s]; |
541 int bit, lps_mask attribute_unused; | 541 int bit, lps_mask attribute_unused; |
542 | 542 |
543 c->range -= RangeLPS; | 543 c->range -= RangeLPS; |
572 c->range<<= lps_mask; | 572 c->range<<= lps_mask; |
573 c->low <<= lps_mask; | 573 c->low <<= lps_mask; |
574 if(!(c->low & CABAC_MASK)) | 574 if(!(c->low & CABAC_MASK)) |
575 refill2(c); | 575 refill2(c); |
576 #endif /* BRANCHLESS_CABAC_DECODER */ | 576 #endif /* BRANCHLESS_CABAC_DECODER */ |
577 #endif /* defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) */ | 577 #endif /* defined(ARCH_X86_32) && !(defined(PIC) && defined(__GNUC__)) */ |
578 return bit; | 578 return bit; |
579 } | 579 } |
580 | 580 |
581 static int __attribute((noinline)) get_cabac_noinline(CABACContext *c, uint8_t * const state){ | 581 static int __attribute((noinline)) get_cabac_noinline(CABACContext *c, uint8_t * const state){ |
582 return get_cabac_inline(c,state); | 582 return get_cabac_inline(c,state); |
681 #endif | 681 #endif |
682 } | 682 } |
683 | 683 |
684 //FIXME the x86 code from this file should be moved into i386/h264 or cabac something.c/h (note ill kill you if you move my code away from under my fingers before iam finished with it!) | 684 //FIXME the x86 code from this file should be moved into i386/h264 or cabac something.c/h (note ill kill you if you move my code away from under my fingers before iam finished with it!) |
685 //FIXME use some macros to avoid duplicatin get_cabac (cant be done yet as that would make optimization work hard) | 685 //FIXME use some macros to avoid duplicatin get_cabac (cant be done yet as that would make optimization work hard) |
686 #if defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) | 686 #if defined(ARCH_X86_32) && !(defined(PIC) && defined(__GNUC__)) |
687 static int decode_significance_x86(CABACContext *c, int max_coeff, uint8_t *significant_coeff_ctx_base, int *index){ | 687 static int decode_significance_x86(CABACContext *c, int max_coeff, uint8_t *significant_coeff_ctx_base, int *index){ |
688 void *end= significant_coeff_ctx_base + max_coeff - 1; | 688 void *end= significant_coeff_ctx_base + max_coeff - 1; |
689 int minusstart= -(int)significant_coeff_ctx_base; | 689 int minusstart= -(int)significant_coeff_ctx_base; |
690 int minusindex= 4-(int)index; | 690 int minusindex= 4-(int)index; |
691 int coeff_count; | 691 int coeff_count; |
787 :"r"(c), "m"(minusindex), "m"(significant_coeff_ctx_base), "m"(sig_off)\ | 787 :"r"(c), "m"(minusindex), "m"(significant_coeff_ctx_base), "m"(sig_off)\ |
788 : "%"REG_c, "%ebx", "%edx", "%esi", "%"REG_D, "memory"\ | 788 : "%"REG_c, "%ebx", "%edx", "%esi", "%"REG_D, "memory"\ |
789 ); | 789 ); |
790 return coeff_count; | 790 return coeff_count; |
791 } | 791 } |
792 #endif /* defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) */ | 792 #endif /* defined(ARCH_X86_32) && !(defined(PIC) && defined(__GNUC__)) */ |
793 | 793 |
794 /** | 794 /** |
795 * | 795 * |
796 * @return the number of bytes read or 0 if no end | 796 * @return the number of bytes read or 0 if no end |
797 */ | 797 */ |