Move decode_significance_x86() and decode_significance_8x8_x86() to
i386-specific file from cabac.h.
New file is h264-oriented and only included from h264.c
Resolves compilation when configured with --disable-optimizations due to
decode_significance_8x8_x86 using last_coeff_flag_offset_8x8, which is
only defined in h264.c
Originally committed as revision 12846 to svn://svn.ffmpeg.org/ffmpeg/trunk
| ... | ... |
@@ -685,116 +685,6 @@ static av_always_inline int get_cabac_bypass_sign(CABACContext *c, int val){
|
| 685 | 685 |
#endif |
| 686 | 686 |
} |
| 687 | 687 |
|
| 688 |
-//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!) |
|
| 689 |
-//FIXME use some macros to avoid duplicatin get_cabac (cannot be done yet as that would make optimization work hard) |
|
| 690 |
-#if defined(ARCH_X86) && defined(HAVE_7REGS) && defined(HAVE_EBX_AVAILABLE) && !defined(BROKEN_RELOCATIONS) |
|
| 691 |
-static int decode_significance_x86(CABACContext *c, int max_coeff, uint8_t *significant_coeff_ctx_base, int *index){
|
|
| 692 |
- void *end= significant_coeff_ctx_base + max_coeff - 1; |
|
| 693 |
- int minusstart= -(int)significant_coeff_ctx_base; |
|
| 694 |
- int minusindex= 4-(int)index; |
|
| 695 |
- int coeff_count; |
|
| 696 |
- asm volatile( |
|
| 697 |
- "movl "RANGE "(%3), %%esi \n\t" |
|
| 698 |
- "movl "LOW "(%3), %%ebx \n\t" |
|
| 699 |
- |
|
| 700 |
- "2: \n\t" |
|
| 701 |
- |
|
| 702 |
- BRANCHLESS_GET_CABAC("%%edx", "%3", "(%1)", "%%ebx", "%%bx", "%%esi", "%%eax", "%%al")
|
|
| 703 |
- |
|
| 704 |
- "test $1, %%edx \n\t" |
|
| 705 |
- " jz 3f \n\t" |
|
| 706 |
- |
|
| 707 |
- BRANCHLESS_GET_CABAC("%%edx", "%3", "61(%1)", "%%ebx", "%%bx", "%%esi", "%%eax", "%%al")
|
|
| 708 |
- |
|
| 709 |
- "mov %2, %%"REG_a" \n\t" |
|
| 710 |
- "movl %4, %%ecx \n\t" |
|
| 711 |
- "add %1, %%"REG_c" \n\t" |
|
| 712 |
- "movl %%ecx, (%%"REG_a") \n\t" |
|
| 713 |
- |
|
| 714 |
- "test $1, %%edx \n\t" |
|
| 715 |
- " jnz 4f \n\t" |
|
| 716 |
- |
|
| 717 |
- "add $4, %%"REG_a" \n\t" |
|
| 718 |
- "mov %%"REG_a", %2 \n\t" |
|
| 719 |
- |
|
| 720 |
- "3: \n\t" |
|
| 721 |
- "add $1, %1 \n\t" |
|
| 722 |
- "cmp %5, %1 \n\t" |
|
| 723 |
- " jb 2b \n\t" |
|
| 724 |
- "mov %2, %%"REG_a" \n\t" |
|
| 725 |
- "movl %4, %%ecx \n\t" |
|
| 726 |
- "add %1, %%"REG_c" \n\t" |
|
| 727 |
- "movl %%ecx, (%%"REG_a") \n\t" |
|
| 728 |
- "4: \n\t" |
|
| 729 |
- "add %6, %%eax \n\t" |
|
| 730 |
- "shr $2, %%eax \n\t" |
|
| 731 |
- |
|
| 732 |
- "movl %%esi, "RANGE "(%3) \n\t" |
|
| 733 |
- "movl %%ebx, "LOW "(%3) \n\t" |
|
| 734 |
- :"=&a"(coeff_count), "+r"(significant_coeff_ctx_base), "+m"(index) |
|
| 735 |
- :"r"(c), "m"(minusstart), "m"(end), "m"(minusindex) |
|
| 736 |
- : "%"REG_c, "%ebx", "%edx", "%esi", "memory" |
|
| 737 |
- ); |
|
| 738 |
- return coeff_count; |
|
| 739 |
-} |
|
| 740 |
- |
|
| 741 |
-static int decode_significance_8x8_x86(CABACContext *c, uint8_t *significant_coeff_ctx_base, int *index, const uint8_t *sig_off){
|
|
| 742 |
- int minusindex= 4-(int)index; |
|
| 743 |
- int coeff_count; |
|
| 744 |
- long last=0; |
|
| 745 |
- asm volatile( |
|
| 746 |
- "movl "RANGE "(%3), %%esi \n\t" |
|
| 747 |
- "movl "LOW "(%3), %%ebx \n\t" |
|
| 748 |
- |
|
| 749 |
- "mov %1, %%"REG_D" \n\t" |
|
| 750 |
- "2: \n\t" |
|
| 751 |
- |
|
| 752 |
- "mov %6, %%"REG_a" \n\t" |
|
| 753 |
- "movzbl (%%"REG_a", %%"REG_D"), %%edi \n\t" |
|
| 754 |
- "add %5, %%"REG_D" \n\t" |
|
| 755 |
- |
|
| 756 |
- BRANCHLESS_GET_CABAC("%%edx", "%3", "(%%"REG_D")", "%%ebx", "%%bx", "%%esi", "%%eax", "%%al")
|
|
| 757 |
- |
|
| 758 |
- "mov %1, %%edi \n\t" |
|
| 759 |
- "test $1, %%edx \n\t" |
|
| 760 |
- " jz 3f \n\t" |
|
| 761 |
- |
|
| 762 |
- "movzbl "MANGLE(last_coeff_flag_offset_8x8)"(%%edi), %%edi\n\t" |
|
| 763 |
- "add %5, %%"REG_D" \n\t" |
|
| 764 |
- |
|
| 765 |
- BRANCHLESS_GET_CABAC("%%edx", "%3", "15(%%"REG_D")", "%%ebx", "%%bx", "%%esi", "%%eax", "%%al")
|
|
| 766 |
- |
|
| 767 |
- "mov %2, %%"REG_a" \n\t" |
|
| 768 |
- "mov %1, %%edi \n\t" |
|
| 769 |
- "movl %%edi, (%%"REG_a") \n\t" |
|
| 770 |
- |
|
| 771 |
- "test $1, %%edx \n\t" |
|
| 772 |
- " jnz 4f \n\t" |
|
| 773 |
- |
|
| 774 |
- "add $4, %%"REG_a" \n\t" |
|
| 775 |
- "mov %%"REG_a", %2 \n\t" |
|
| 776 |
- |
|
| 777 |
- "3: \n\t" |
|
| 778 |
- "addl $1, %%edi \n\t" |
|
| 779 |
- "mov %%edi, %1 \n\t" |
|
| 780 |
- "cmpl $63, %%edi \n\t" |
|
| 781 |
- " jb 2b \n\t" |
|
| 782 |
- "mov %2, %%"REG_a" \n\t" |
|
| 783 |
- "movl %%edi, (%%"REG_a") \n\t" |
|
| 784 |
- "4: \n\t" |
|
| 785 |
- "addl %4, %%eax \n\t" |
|
| 786 |
- "shr $2, %%eax \n\t" |
|
| 787 |
- |
|
| 788 |
- "movl %%esi, "RANGE "(%3) \n\t" |
|
| 789 |
- "movl %%ebx, "LOW "(%3) \n\t" |
|
| 790 |
- :"=&a"(coeff_count),"+m"(last), "+m"(index) |
|
| 791 |
- :"r"(c), "m"(minusindex), "m"(significant_coeff_ctx_base), "m"(sig_off) |
|
| 792 |
- : "%"REG_c, "%ebx", "%edx", "%esi", "%"REG_D, "memory" |
|
| 793 |
- ); |
|
| 794 |
- return coeff_count; |
|
| 795 |
-} |
|
| 796 |
-#endif /* defined(ARCH_X86) && && defined(HAVE_7REGS) && defined(HAVE_EBX_AVAILABLE) && !defined(BROKEN_RELOCATIONS) */ |
|
| 797 |
- |
|
| 798 | 688 |
/** |
| 799 | 689 |
* |
| 800 | 690 |
* @return the number of bytes read or 0 if no end |
| 41 | 44 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,144 @@ |
| 0 |
+/* |
|
| 1 |
+ * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder |
|
| 2 |
+ * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> |
|
| 3 |
+ * |
|
| 4 |
+ * This file is part of FFmpeg. |
|
| 5 |
+ * |
|
| 6 |
+ * FFmpeg is free software; you can redistribute it and/or |
|
| 7 |
+ * modify it under the terms of the GNU Lesser General Public |
|
| 8 |
+ * License as published by the Free Software Foundation; either |
|
| 9 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
| 10 |
+ * |
|
| 11 |
+ * FFmpeg is distributed in the hope that it will be useful, |
|
| 12 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 13 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
| 14 |
+ * Lesser General Public License for more details. |
|
| 15 |
+ * |
|
| 16 |
+ * You should have received a copy of the GNU Lesser General Public |
|
| 17 |
+ * License along with FFmpeg; if not, write to the Free Software |
|
| 18 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
| 19 |
+ */ |
|
| 20 |
+ |
|
| 21 |
+/** |
|
| 22 |
+ * @file h264_i386.h |
|
| 23 |
+ * H.264 / AVC / MPEG4 part10 codec. |
|
| 24 |
+ * non-MMX i386-specific optimizations for H.264 |
|
| 25 |
+ * @author Michael Niedermayer <michaelni@gmx.at> |
|
| 26 |
+ */ |
|
| 27 |
+ |
|
| 28 |
+#ifndef FFMPEG_H264_I386_H |
|
| 29 |
+#define FFMPEG_H264_I386_H |
|
| 30 |
+ |
|
| 31 |
+ |
|
| 32 |
+#include "cabac.h" |
|
| 33 |
+ |
|
| 34 |
+//FIXME use some macros to avoid duplicatin get_cabac (cannot be done yet as that would make optimization work hard) |
|
| 35 |
+#if defined(ARCH_X86) && defined(HAVE_7REGS) && defined(HAVE_EBX_AVAILABLE) && !defined(BROKEN_RELOCATIONS) |
|
| 36 |
+static int decode_significance_x86(CABACContext *c, int max_coeff, uint8_t *significant_coeff_ctx_base, int *index){
|
|
| 37 |
+ void *end= significant_coeff_ctx_base + max_coeff - 1; |
|
| 38 |
+ int minusstart= -(int)significant_coeff_ctx_base; |
|
| 39 |
+ int minusindex= 4-(int)index; |
|
| 40 |
+ int coeff_count; |
|
| 41 |
+ asm volatile( |
|
| 42 |
+ "movl "RANGE "(%3), %%esi \n\t" |
|
| 43 |
+ "movl "LOW "(%3), %%ebx \n\t" |
|
| 44 |
+ |
|
| 45 |
+ "2: \n\t" |
|
| 46 |
+ |
|
| 47 |
+ BRANCHLESS_GET_CABAC("%%edx", "%3", "(%1)", "%%ebx", "%%bx", "%%esi", "%%eax", "%%al")
|
|
| 48 |
+ |
|
| 49 |
+ "test $1, %%edx \n\t" |
|
| 50 |
+ " jz 3f \n\t" |
|
| 51 |
+ |
|
| 52 |
+ BRANCHLESS_GET_CABAC("%%edx", "%3", "61(%1)", "%%ebx", "%%bx", "%%esi", "%%eax", "%%al")
|
|
| 53 |
+ |
|
| 54 |
+ "mov %2, %%"REG_a" \n\t" |
|
| 55 |
+ "movl %4, %%ecx \n\t" |
|
| 56 |
+ "add %1, %%"REG_c" \n\t" |
|
| 57 |
+ "movl %%ecx, (%%"REG_a") \n\t" |
|
| 58 |
+ |
|
| 59 |
+ "test $1, %%edx \n\t" |
|
| 60 |
+ " jnz 4f \n\t" |
|
| 61 |
+ |
|
| 62 |
+ "add $4, %%"REG_a" \n\t" |
|
| 63 |
+ "mov %%"REG_a", %2 \n\t" |
|
| 64 |
+ |
|
| 65 |
+ "3: \n\t" |
|
| 66 |
+ "add $1, %1 \n\t" |
|
| 67 |
+ "cmp %5, %1 \n\t" |
|
| 68 |
+ " jb 2b \n\t" |
|
| 69 |
+ "mov %2, %%"REG_a" \n\t" |
|
| 70 |
+ "movl %4, %%ecx \n\t" |
|
| 71 |
+ "add %1, %%"REG_c" \n\t" |
|
| 72 |
+ "movl %%ecx, (%%"REG_a") \n\t" |
|
| 73 |
+ "4: \n\t" |
|
| 74 |
+ "add %6, %%eax \n\t" |
|
| 75 |
+ "shr $2, %%eax \n\t" |
|
| 76 |
+ |
|
| 77 |
+ "movl %%esi, "RANGE "(%3) \n\t" |
|
| 78 |
+ "movl %%ebx, "LOW "(%3) \n\t" |
|
| 79 |
+ :"=&a"(coeff_count), "+r"(significant_coeff_ctx_base), "+m"(index) |
|
| 80 |
+ :"r"(c), "m"(minusstart), "m"(end), "m"(minusindex) |
|
| 81 |
+ : "%"REG_c, "%ebx", "%edx", "%esi", "memory" |
|
| 82 |
+ ); |
|
| 83 |
+ return coeff_count; |
|
| 84 |
+} |
|
| 85 |
+ |
|
| 86 |
+static int decode_significance_8x8_x86(CABACContext *c, uint8_t *significant_coeff_ctx_base, int *index, const uint8_t *sig_off){
|
|
| 87 |
+ int minusindex= 4-(int)index; |
|
| 88 |
+ int coeff_count; |
|
| 89 |
+ long last=0; |
|
| 90 |
+ asm volatile( |
|
| 91 |
+ "movl "RANGE "(%3), %%esi \n\t" |
|
| 92 |
+ "movl "LOW "(%3), %%ebx \n\t" |
|
| 93 |
+ |
|
| 94 |
+ "mov %1, %%"REG_D" \n\t" |
|
| 95 |
+ "2: \n\t" |
|
| 96 |
+ |
|
| 97 |
+ "mov %6, %%"REG_a" \n\t" |
|
| 98 |
+ "movzbl (%%"REG_a", %%"REG_D"), %%edi \n\t" |
|
| 99 |
+ "add %5, %%"REG_D" \n\t" |
|
| 100 |
+ |
|
| 101 |
+ BRANCHLESS_GET_CABAC("%%edx", "%3", "(%%"REG_D")", "%%ebx", "%%bx", "%%esi", "%%eax", "%%al")
|
|
| 102 |
+ |
|
| 103 |
+ "mov %1, %%edi \n\t" |
|
| 104 |
+ "test $1, %%edx \n\t" |
|
| 105 |
+ " jz 3f \n\t" |
|
| 106 |
+ |
|
| 107 |
+ "movzbl "MANGLE(last_coeff_flag_offset_8x8)"(%%edi), %%edi\n\t" |
|
| 108 |
+ "add %5, %%"REG_D" \n\t" |
|
| 109 |
+ |
|
| 110 |
+ BRANCHLESS_GET_CABAC("%%edx", "%3", "15(%%"REG_D")", "%%ebx", "%%bx", "%%esi", "%%eax", "%%al")
|
|
| 111 |
+ |
|
| 112 |
+ "mov %2, %%"REG_a" \n\t" |
|
| 113 |
+ "mov %1, %%edi \n\t" |
|
| 114 |
+ "movl %%edi, (%%"REG_a") \n\t" |
|
| 115 |
+ |
|
| 116 |
+ "test $1, %%edx \n\t" |
|
| 117 |
+ " jnz 4f \n\t" |
|
| 118 |
+ |
|
| 119 |
+ "add $4, %%"REG_a" \n\t" |
|
| 120 |
+ "mov %%"REG_a", %2 \n\t" |
|
| 121 |
+ |
|
| 122 |
+ "3: \n\t" |
|
| 123 |
+ "addl $1, %%edi \n\t" |
|
| 124 |
+ "mov %%edi, %1 \n\t" |
|
| 125 |
+ "cmpl $63, %%edi \n\t" |
|
| 126 |
+ " jb 2b \n\t" |
|
| 127 |
+ "mov %2, %%"REG_a" \n\t" |
|
| 128 |
+ "movl %%edi, (%%"REG_a") \n\t" |
|
| 129 |
+ "4: \n\t" |
|
| 130 |
+ "addl %4, %%eax \n\t" |
|
| 131 |
+ "shr $2, %%eax \n\t" |
|
| 132 |
+ |
|
| 133 |
+ "movl %%esi, "RANGE "(%3) \n\t" |
|
| 134 |
+ "movl %%ebx, "LOW "(%3) \n\t" |
|
| 135 |
+ :"=&a"(coeff_count),"+m"(last), "+m"(index) |
|
| 136 |
+ :"r"(c), "m"(minusindex), "m"(significant_coeff_ctx_base), "m"(sig_off) |
|
| 137 |
+ : "%"REG_c, "%ebx", "%edx", "%esi", "%"REG_D, "memory" |
|
| 138 |
+ ); |
|
| 139 |
+ return coeff_count; |
|
| 140 |
+} |
|
| 141 |
+#endif /* defined(ARCH_X86) && && defined(HAVE_7REGS) && defined(HAVE_EBX_AVAILABLE) && !defined(BROKEN_RELOCATIONS) */ |
|
| 142 |
+ |
|
| 143 |
+#endif /* FFMPEG_H264_I386_H */ |