Ticket #1073: trunk.diff
| File trunk.diff, 45.1 KB (added by , 18 years ago) |
|---|
-
libmpeg2/alloc.c
diff -u /build/mplayer/libmpeg2/alloc.c /build/libmpeg2/libmpeg2/alloc.c
old new 62 62 free (*(((void **)buf) - 1)); 63 63 } 64 64 65 void mpeg2_malloc_hooks (void * malloc (unsigned, mpeg2_alloc_t),66 int free (void *))65 void mpeg2_malloc_hooks (void * alloc_func (unsigned, mpeg2_alloc_t), 66 int free_func (void *)) 67 67 { 68 malloc_hook = malloc;69 free_hook = free ;68 malloc_hook = alloc_func; 69 free_hook = free_func; 70 70 } -
libmpeg2/cpu_accel.c
Only in /build/mplayer/libmpeg2: alpha_asm.h Only in /build/mplayer/libmpeg2: attributes.h Only in /build/libmpeg2/libmpeg2: configure.incl Only in /build/libmpeg2/libmpeg2: convert diff -u /build/mplayer/libmpeg2/cpu_accel.c /build/libmpeg2/libmpeg2/cpu_accel.c
old new 1 1 /* 2 2 * cpu_accel.c 3 * Copyright (C) 2000-200 3Michel Lespinasse <walken@zoy.org>3 * Copyright (C) 2000-2004 Michel Lespinasse <walken@zoy.org> 4 4 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> 5 5 * 6 6 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. … … 19 19 * You should have received a copy of the GNU General Public License 20 20 * along with this program; if not, write to the Free Software 21 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 *23 * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.24 * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/25 * $Id: cpu_accel.c 26315 2008-04-01 17:41:18Z diego $26 22 */ 27 23 28 24 #include "config.h" 29 #include "cpudetect.h"30 25 31 26 #include <inttypes.h> 32 27 … … 34 29 #include "attributes.h" 35 30 #include "mpeg2_internal.h" 36 31 37 #ifdef ACCEL_DETECT38 32 #if defined(ARCH_X86) || defined(ARCH_X86_64) 39 40 /* MPlayer imports libmpeg2 as decoder, which detects MMX / 3DNow! 41 * instructions via assembly. However, it is regarded as duplicated work 42 * in MPlayer, so that we enforce using MPlayer's implementation. 43 */ 44 #define USE_MPLAYER_CPUDETECT 45 46 static inline uint32_t arch_accel (void) 33 static inline uint32_t arch_accel (uint32_t accel) 47 34 { 48 #if !defined(USE_MPLAYER_CPUDETECT) 49 uint32_t eax, ebx, ecx, edx; 50 int AMD; 51 uint32_t caps; 35 if (accel & (MPEG2_ACCEL_X86_3DNOW | MPEG2_ACCEL_X86_MMXEXT)) 36 accel |= MPEG2_ACCEL_X86_MMX; 37 38 if (accel & (MPEG2_ACCEL_X86_SSE2 | MPEG2_ACCEL_X86_SSE3)) 39 accel |= MPEG2_ACCEL_X86_MMXEXT; 40 41 if (accel & (MPEG2_ACCEL_X86_SSE3)) 42 accel |= MPEG2_ACCEL_X86_SSE2; 43 44 #ifdef ACCEL_DETECT 45 if (accel & MPEG2_ACCEL_DETECT) { 46 uint32_t eax, ebx, ecx, edx; 47 int AMD; 52 48 53 49 #if defined(__x86_64__) || (!defined(PIC) && !defined(__PIC__)) 54 50 #define cpuid(op,eax,ebx,ecx,edx) \ … … 59 55 "=d" (edx) \ 60 56 : "a" (op) \ 61 57 : "cc") 62 #else /* PIC version : save ebx (not needed on x86_64) */58 #else /* PIC version : save ebx (not needed on x86_64) */ 63 59 #define cpuid(op,eax,ebx,ecx,edx) \ 64 60 __asm__ ("pushl %%ebx\n\t" \ 65 61 "cpuid\n\t" \ … … 74 70 #endif 75 71 76 72 #ifndef __x86_64__ /* x86_64 supports the cpuid op */ 77 __asm__ ("pushf\n\t"78 "pushf\n\t"79 "pop %0\n\t"80 "movl %0,%1\n\t"81 "xorl $0x200000,%0\n\t"82 "push %0\n\t"83 "popf\n\t"84 "pushf\n\t"85 "pop %0\n\t"86 "popf"87 : "=r" (eax),88 "=r" (ebx)89 :90 : "cc");73 __asm__ ("pushf\n\t" 74 "pushf\n\t" 75 "pop %0\n\t" 76 "movl %0,%1\n\t" 77 "xorl $0x200000,%0\n\t" 78 "push %0\n\t" 79 "popf\n\t" 80 "pushf\n\t" 81 "pop %0\n\t" 82 "popf" 83 : "=r" (eax), 84 "=r" (ebx) 85 : 86 : "cc"); 91 87 92 if (eax == ebx)/* no cpuid */93 return 0;88 if (eax == ebx) /* no cpuid */ 89 return accel; 94 90 #endif 95 91 96 cpuid (0x00000000, eax, ebx, ecx, edx); 97 if (!eax) /* vendor string only */ 98 return 0; 99 100 AMD = (ebx == 0x68747541) && (ecx == 0x444d4163) && (edx == 0x69746e65); 101 102 cpuid (0x00000001, eax, ebx, ecx, edx); 103 if (! (edx & 0x00800000)) /* no MMX */ 104 return 0; 105 106 caps = MPEG2_ACCEL_X86_MMX; 107 if (edx & 0x02000000) /* SSE - identical to AMD MMX extensions */ 108 caps = MPEG2_ACCEL_X86_MMX | MPEG2_ACCEL_X86_MMXEXT; 109 110 cpuid (0x80000000, eax, ebx, ecx, edx); 111 if (eax < 0x80000001) /* no extended capabilities */ 112 return caps; 113 114 cpuid (0x80000001, eax, ebx, ecx, edx); 115 116 if (edx & 0x80000000) 117 caps |= MPEG2_ACCEL_X86_3DNOW; 118 119 if (AMD && (edx & 0x00400000)) /* AMD MMX extensions */ 120 caps |= MPEG2_ACCEL_X86_MMXEXT; 121 122 return caps; 123 #else /* USE_MPLAYER_CPUDETECT: Use MPlayer's CPU capability property. */ 124 caps = 0; 125 if (gCpuCaps.hasMMX) 126 caps |= MPEG2_ACCEL_X86_MMX; 127 if (gCpuCaps.hasSSE2) 128 caps |= MPEG2_ACCEL_X86_SSE2; 129 if (gCpuCaps.hasMMX2) 130 caps |= MPEG2_ACCEL_X86_MMXEXT; 131 if (gCpuCaps.has3DNow) 132 caps |= MPEG2_ACCEL_X86_3DNOW; 92 cpuid (0x00000000, eax, ebx, ecx, edx); 93 if (!eax) /* vendor string only */ 94 return accel; 95 96 AMD = (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65); 97 98 cpuid (0x00000001, eax, ebx, ecx, edx); 99 if (! (edx & 0x00800000)) /* no MMX */ 100 return accel; 101 102 accel |= MPEG2_ACCEL_X86_MMX; 103 if (edx & 0x02000000) /* SSE - identical to AMD MMX ext. */ 104 accel |= MPEG2_ACCEL_X86_MMXEXT; 105 106 if (edx & 0x04000000) /* SSE2 */ 107 accel |= MPEG2_ACCEL_X86_SSE2; 108 109 if (ecx & 0x00000001) /* SSE3 */ 110 accel |= MPEG2_ACCEL_X86_SSE3; 111 112 cpuid (0x80000000, eax, ebx, ecx, edx); 113 if (eax < 0x80000001) /* no extended capabilities */ 114 return accel; 133 115 134 return caps;116 cpuid (0x80000001, eax, ebx, ecx, edx); 135 117 136 #endif /* USE_MPLAYER_CPUDETECT */ 118 if (edx & 0x80000000) 119 accel |= MPEG2_ACCEL_X86_3DNOW; 120 121 if (AMD && (edx & 0x00400000)) /* AMD MMX extensions */ 122 accel |= MPEG2_ACCEL_X86_MMXEXT; 123 } 124 #endif /* ACCEL_DETECT */ 125 126 return accel; 137 127 } 138 128 #endif /* ARCH_X86 || ARCH_X86_64 */ 139 129 140 #if defined(A RCH_PPC) || defined(ARCH_SPARC)130 #if defined(ACCEL_DETECT) && (defined(ARCH_PPC) || defined(ARCH_SPARC)) 141 131 #include <signal.h> 142 132 #include <setjmp.h> 143 133 … … 154 144 canjump = 0; 155 145 siglongjmp (jmpbuf, 1); 156 146 } 147 #endif /* ACCEL_DETECT && (ARCH_PPC || ARCH_SPARC) */ 157 148 158 149 #ifdef ARCH_PPC 159 static uint32_t arch_accel ( void)150 static uint32_t arch_accel (uint32_t accel) 160 151 { 161 static RETSIGTYPE (* oldsig) (int); 162 163 oldsig = signal (SIGILL, sigill_handler); 164 if (sigsetjmp (jmpbuf, 1)) { 165 signal (SIGILL, oldsig); 166 return 0; 167 } 152 #ifdef ACCEL_DETECT 153 if ((accel & (MPEG2_ACCEL_PPC_ALTIVEC | MPEG2_ACCEL_DETECT)) == 154 MPEG2_ACCEL_DETECT) { 155 static RETSIGTYPE (* oldsig) (int); 156 157 oldsig = signal (SIGILL, sigill_handler); 158 if (sigsetjmp (jmpbuf, 1)) { 159 signal (SIGILL, oldsig); 160 return accel; 161 } 168 162 169 canjump = 1;163 canjump = 1; 170 164 171 165 #if defined(__APPLE_CC__) /* apple */ 172 166 #define VAND(a,b,c) "vand v" #a ",v" #b ",v" #c "\n\t" 173 #else /* gnu */167 #else /* gnu */ 174 168 #define VAND(a,b,c) "vand " #a "," #b "," #c "\n\t" 175 169 #endif 176 asm volatile ("mtspr 256, %0\n\t"177 VAND (0, 0, 0)178 :179 : "r" (-1));170 asm volatile ("mtspr 256, %0\n\t" 171 VAND (0, 0, 0) 172 : 173 : "r" (-1)); 180 174 181 canjump = 0; 175 canjump = 0; 176 accel |= MPEG2_ACCEL_PPC_ALTIVEC; 182 177 183 signal (SIGILL, oldsig); 184 return MPEG2_ACCEL_PPC_ALTIVEC; 178 signal (SIGILL, oldsig); 179 } 180 #endif /* ACCEL_DETECT */ 181 182 return accel; 185 183 } 186 184 #endif /* ARCH_PPC */ 187 185 188 186 #ifdef ARCH_SPARC 189 static uint32_t arch_accel ( void)187 static uint32_t arch_accel (uint32_t accel) 190 188 { 191 static RETSIGTYPE (* oldsig) (int); 189 if (accel & MPEG2_ACCEL_SPARC_VIS2) 190 accel |= MPEG2_ACCEL_SPARC_VIS; 192 191 193 oldsig = signal (SIGILL, sigill_handler); 194 if (sigsetjmp (jmpbuf, 1)) { 195 signal (SIGILL, oldsig); 196 return 0; 197 } 192 #ifdef ACCEL_DETECT 193 if ((accel & (MPEG2_ACCEL_SPARC_VIS2 | MPEG2_ACCEL_DETECT)) == 194 MPEG2_ACCEL_DETECT) { 195 static RETSIGTYPE (* oldsig) (int); 198 196 199 canjump = 1; 197 oldsig = signal (SIGILL, sigill_handler); 198 if (sigsetjmp (jmpbuf, 1)) { 199 signal (SIGILL, oldsig); 200 return accel; 201 } 200 202 201 /* pdist %f0, %f0, %f0 */ 202 __asm__ __volatile__(".word\t0x81b007c0"); 203 canjump = 1; 203 204 204 canjump = 0; 205 /* pdist %f0, %f0, %f0 */ 206 __asm__ __volatile__(".word\t0x81b007c0"); 205 207 206 if (sigsetjmp (jmpbuf, 1)) { 207 signal (SIGILL, oldsig); 208 return MPEG2_ACCEL_SPARC_VIS; 209 } 208 canjump = 0; 209 accel |= MPEG2_ACCEL_SPARC_VIS; 210 210 211 canjump = 1; 211 if (sigsetjmp (jmpbuf, 1)) { 212 signal (SIGILL, oldsig); 213 return accel; 214 } 212 215 213 /* edge8n %g0, %g0, %g0 */ 214 __asm__ __volatile__(".word\t0x81b00020"); 216 canjump = 1; 215 217 216 canjump = 0; 218 /* edge8n %g0, %g0, %g0 */ 219 __asm__ __volatile__(".word\t0x81b00020"); 220 221 canjump = 0; 222 accel |= MPEG2_ACCEL_SPARC_VIS2; 217 223 218 signal (SIGILL, oldsig); 219 return MPEG2_ACCEL_SPARC_VIS | MPEG2_ACCEL_SPARC_VIS2; 224 signal (SIGILL, oldsig); 225 } 226 #endif /* ACCEL_DETECT */ 227 228 return accel; 220 229 } 221 230 #endif /* ARCH_SPARC */ 222 #endif /* ARCH_PPC || ARCH_SPARC */223 231 224 232 #ifdef ARCH_ALPHA 225 static uint32_t arch_accel (void)233 static inline uint32_t arch_accel (uint32_t accel) 226 234 { 227 uint64_t no_mvi; 235 if (accel & MPEG2_ACCEL_ALPHA_MVI) 236 accel |= MPEG2_ACCEL_ALPHA; 237 238 #ifdef ACCEL_DETECT 239 if (accel & MPEG2_ACCEL_DETECT) { 240 uint64_t no_mvi; 241 242 asm volatile ("amask %1, %0" 243 : "=r" (no_mvi) 244 : "rI" (256)); /* AMASK_MVI */ 245 accel |= no_mvi ? MPEG2_ACCEL_ALPHA : (MPEG2_ACCEL_ALPHA | 246 MPEG2_ACCEL_ALPHA_MVI); 247 } 248 #endif /* ACCEL_DETECT */ 228 249 229 asm volatile ("amask %1, %0" 230 : "=r" (no_mvi) 231 : "rI" (256)); /* AMASK_MVI */ 232 return no_mvi ? MPEG2_ACCEL_ALPHA : (MPEG2_ACCEL_ALPHA | 233 MPEG2_ACCEL_ALPHA_MVI); 250 return accel; 234 251 } 235 252 #endif /* ARCH_ALPHA */ 236 #endif /* ACCEL_DETECT */237 253 238 uint32_t mpeg2_detect_accel ( void)254 uint32_t mpeg2_detect_accel (uint32_t accel) 239 255 { 240 uint32_t accel;241 242 accel = 0;243 #ifdef ACCEL_DETECT244 256 #if defined (ARCH_X86) || defined (ARCH_X86_64) || defined (ARCH_PPC) || defined (ARCH_ALPHA) || defined (ARCH_SPARC) 245 accel = arch_accel (); 246 #endif 257 accel = arch_accel (accel); 247 258 #endif 248 259 return accel; 249 260 } -
libmpeg2/cpu_state.c
diff -u /build/mplayer/libmpeg2/cpu_state.c /build/libmpeg2/libmpeg2/cpu_state.c
old new 19 19 * You should have received a copy of the GNU General Public License 20 20 * along with this program; if not, write to the Free Software 21 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 *23 * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.24 * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/25 * $Id: cpu_state.c 26627 2008-05-01 12:45:59Z diego $26 22 */ 27 23 28 24 #include "config.h" … … 54 50 #define STVX(a,b,c) "stvx v" #a ",r" #b ",r" #c "\n\t" 55 51 #define LVX0(a,b,c) "lvx v" #a ",0,r" #c "\n\t" 56 52 #define LVX(a,b,c) "lvx v" #a ",r" #b ",r" #c "\n\t" 57 #else /* gnu */53 #else /* gnu */ 58 54 #define LI(a,b) "li " #a "," #b "\n\t" 59 55 #define STVX0(a,b,c) "stvx " #a ",0," #c "\n\t" 60 56 #define STVX(a,b,c) "stvx " #a "," #b "," #c "\n\t" -
libmpeg2/decode.c
diff -u /build/mplayer/libmpeg2/decode.c /build/libmpeg2/libmpeg2/decode.c
old new 19 19 * You should have received a copy of the GNU General Public License 20 20 * along with this program; if not, write to the Free Software 21 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 *23 * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.24 * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/25 * $Id: decode.c 21542 2006-12-09 10:34:27Z henry $26 22 */ 27 23 28 24 #include "config.h" … … 135 131 } 136 132 mpeg2dec->bytes_since_tag += skipped; 137 133 mpeg2dec->code = mpeg2dec->buf_start[-1]; 138 return (mpeg2_state_t)-1;134 return STATE_INTERNAL_NORETURN; 139 135 } 140 136 141 137 mpeg2_state_t mpeg2_seek_header (mpeg2dec_t * mpeg2dec) 142 138 { 143 while ( mpeg2dec->code != 0xb3 &&144 ((mpeg2dec->code != 0xb7 && mpeg2dec->code != 0xb8 &&145 mpeg2dec->code) || mpeg2dec->sequence.width == (unsigned)-1))139 while (!(mpeg2dec->code == 0xb3 || 140 ((mpeg2dec->code == 0xb7 || mpeg2dec->code == 0xb8 || 141 !mpeg2dec->code) && mpeg2dec->sequence.width != (unsigned)-1))) 146 142 if (seek_chunk (mpeg2dec) == STATE_BUFFER) 147 143 return STATE_BUFFER; 148 144 mpeg2dec->chunk_start = mpeg2dec->chunk_ptr = mpeg2dec->chunk_buffer; 149 145 mpeg2dec->user_data_len = 0; 150 return ( mpeg2dec->code ? mpeg2_parse_header (mpeg2dec) :151 mpeg2_header_ picture_start(mpeg2dec));146 return ((mpeg2dec->code == 0xb7) ? 147 mpeg2_header_end (mpeg2dec) : mpeg2_parse_header (mpeg2dec)); 152 148 } 153 149 154 150 #define RECEIVED(code,state) (((state) << 8) + (code)) … … 161 157 mpeg2_state_t state; 162 158 163 159 state = mpeg2dec->action (mpeg2dec); 164 if ((int)state > = 0)160 if ((int)state > (int)STATE_INTERNAL_NORETURN) 165 161 return state; 166 162 } 167 163 … … 200 196 return STATE_BUFFER; 201 197 } 202 198 199 mpeg2dec->action = mpeg2_seek_header; 203 200 switch (mpeg2dec->code) { 204 201 case 0x00: 205 mpeg2dec->action = mpeg2_header_picture_start;206 202 return mpeg2dec->state; 207 case 0xb7:208 mpeg2dec->action = mpeg2_header_end;209 break;210 203 case 0xb3: 204 case 0xb7: 211 205 case 0xb8: 212 mpeg2dec->action = mpeg2_parse_header; 213 break; 206 return (mpeg2dec->state == STATE_SLICE) ? STATE_SLICE : STATE_INVALID; 214 207 default: 215 208 mpeg2dec->action = seek_chunk; 216 209 return STATE_INVALID; 217 210 } 218 return (mpeg2dec->state == STATE_SLICE) ? STATE_SLICE : STATE_INVALID;219 211 } 220 212 221 213 mpeg2_state_t mpeg2_parse_header (mpeg2dec_t * mpeg2dec) … … 262 254 263 255 /* state transition after a sequence header */ 264 256 case RECEIVED (0x00, STATE_SEQUENCE): 265 mpeg2dec->action = mpeg2_header_picture_start;266 257 case RECEIVED (0xb8, STATE_SEQUENCE): 267 258 mpeg2_header_sequence_finalize (mpeg2dec); 268 259 break; … … 270 261 /* other legal state transitions */ 271 262 case RECEIVED (0x00, STATE_GOP): 272 263 mpeg2_header_gop_finalize (mpeg2dec); 273 mpeg2dec->action = mpeg2_header_picture_start;274 264 break; 275 265 case RECEIVED (0x01, STATE_PICTURE): 276 266 case RECEIVED (0x01, STATE_PICTURE_2ND): … … 355 345 fbuf->buf[1] = buf[1]; 356 346 fbuf->buf[2] = buf[2]; 357 347 fbuf->id = id; 358 // HACK! FIXME! At first I frame, copy pointers to prediction frame too!359 if (mpeg2dec->custom_fbuf && !mpeg2dec->fbuf[1]->buf[0]){360 mpeg2dec->fbuf[1]->buf[0]=buf[0];361 mpeg2dec->fbuf[1]->buf[1]=buf[1];362 mpeg2dec->fbuf[1]->buf[2]=buf[2];363 mpeg2dec->fbuf[1]->id=NULL;364 }365 // printf("libmpeg2: FBUF 0:%p 1:%p 2:%p\n",366 // mpeg2dec->fbuf[0]->buf[0],mpeg2dec->fbuf[1]->buf[0],mpeg2dec->fbuf[2]->buf[0]);367 348 } 368 349 369 350 void mpeg2_custom_fbuf (mpeg2dec_t * mpeg2dec, int custom_fbuf) … … 398 379 uint32_t mpeg2_accel (uint32_t accel) 399 380 { 400 381 if (!mpeg2_accels) { 401 if (accel & MPEG2_ACCEL_DETECT) 402 accel |= mpeg2_detect_accel (); 403 mpeg2_accels = accel |= MPEG2_ACCEL_DETECT; 404 mpeg2_cpu_state_init (accel); 405 mpeg2_idct_init (accel); 406 mpeg2_mc_init (accel); 382 mpeg2_accels = mpeg2_detect_accel (accel) | MPEG2_ACCEL_DETECT; 383 mpeg2_cpu_state_init (mpeg2_accels); 384 mpeg2_idct_init (mpeg2_accels); 385 mpeg2_mc_init (mpeg2_accels); 407 386 } 408 387 return mpeg2_accels & ~MPEG2_ACCEL_DETECT; 409 388 } -
libmpeg2/header.c
diff -u /build/mplayer/libmpeg2/header.c /build/libmpeg2/libmpeg2/header.c
old new 20 20 * You should have received a copy of the GNU General Public License 21 21 * along with this program; if not, write to the Free Software 22 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 *24 * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.25 * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/26 * $Id: header.c 21542 2006-12-09 10:34:27Z henry $27 23 */ 28 24 29 25 #include "config.h" … … 104 100 mpeg2dec->decoder.convert = NULL; 105 101 mpeg2dec->decoder.convert_id = NULL; 106 102 mpeg2dec->picture = mpeg2dec->pictures; 107 memset(&mpeg2dec->fbuf_alloc[0].fbuf, 0, sizeof(mpeg2_fbuf_t));108 memset(&mpeg2dec->fbuf_alloc[1].fbuf, 0, sizeof(mpeg2_fbuf_t));109 memset(&mpeg2dec->fbuf_alloc[2].fbuf, 0, sizeof(mpeg2_fbuf_t));110 103 mpeg2dec->fbuf[0] = &mpeg2dec->fbuf_alloc[0].fbuf; 111 104 mpeg2dec->fbuf[1] = &mpeg2dec->fbuf_alloc[1].fbuf; 112 105 mpeg2dec->fbuf[2] = &mpeg2dec->fbuf_alloc[2].fbuf; … … 257 250 { 258 251 uint8_t * buffer = mpeg2dec->chunk_start; 259 252 mpeg2_sequence_t * sequence = &(mpeg2dec->new_sequence); 260 uint32_t flags;261 253 262 flags = ((sequence->flags & ~SEQ_MASK_VIDEO_FORMAT) |263 ((buffer[0]<<4) & SEQ_MASK_VIDEO_FORMAT));254 sequence->flags = ((sequence->flags & ~SEQ_MASK_VIDEO_FORMAT) | 255 ((buffer[0]<<4) & SEQ_MASK_VIDEO_FORMAT)); 264 256 if (buffer[0] & 1) { 265 flags |= SEQ_FLAG_COLOUR_DESCRIPTION;257 sequence->flags |= SEQ_FLAG_COLOUR_DESCRIPTION; 266 258 sequence->colour_primaries = buffer[1]; 267 259 sequence->transfer_characteristics = buffer[2]; 268 260 sequence->matrix_coefficients = buffer[3]; … … 281 273 return 0; 282 274 } 283 275 276 static inline void simplify (unsigned int * u, unsigned int * v) 277 { 278 unsigned int a, b, tmp; 279 280 a = *u; b = *v; 281 while (a) { /* find greatest common divisor */ 282 tmp = a; a = b % tmp; b = tmp; 283 } 284 *u /= b; *v /= b; 285 } 286 284 287 static inline void finalize_sequence (mpeg2_sequence_t * sequence) 285 288 { 286 289 int width; … … 317 320 sequence->pixel_width = 64; sequence->pixel_height = 45; return; 318 321 case 6: /* 720x480 16:9 */ 319 322 sequence->pixel_width = 32; sequence->pixel_height = 27; return; 320 case 12: /* 720*480 4:3 */ 321 sequence->pixel_width = 8; sequence->pixel_height = 9; return; 323 case 8: /* BT.601 625 lines 4:3 */ 324 sequence->pixel_width = 59; sequence->pixel_height = 54; return; 325 case 12: /* BT.601 525 lines 4:3 */ 326 sequence->pixel_width = 10; sequence->pixel_height = 11; return; 322 327 default: 323 328 height = 88 * sequence->pixel_width + 1171; 324 329 width = 2000; … … 327 332 328 333 sequence->pixel_width = width; 329 334 sequence->pixel_height = height; 330 while (width) { /* find greatest common divisor */ 331 int tmp = width; 332 width = height % tmp; 333 height = tmp; 334 } 335 sequence->pixel_width /= height; 336 sequence->pixel_height /= height; 337 } 338 339 static void copy_matrix (mpeg2dec_t * mpeg2dec, int index) 340 { 341 if (memcmp (mpeg2dec->quantizer_matrix[index], 342 mpeg2dec->new_quantizer_matrix[index], 64)) { 343 memcpy (mpeg2dec->quantizer_matrix[index], 344 mpeg2dec->new_quantizer_matrix[index], 64); 345 mpeg2dec->scaled[index] = -1; 335 simplify (&sequence->pixel_width, &sequence->pixel_height); 336 } 337 338 int mpeg2_guess_aspect (const mpeg2_sequence_t * sequence, 339 unsigned int * pixel_width, 340 unsigned int * pixel_height) 341 { 342 static struct { 343 unsigned int width, height; 344 } video_modes[] = { 345 {720, 576}, /* 625 lines, 13.5 MHz (D1, DV, DVB, DVD) */ 346 {704, 576}, /* 625 lines, 13.5 MHz (1/1 D1, DVB, DVD, 4CIF) */ 347 {544, 576}, /* 625 lines, 10.125 MHz (DVB, laserdisc) */ 348 {528, 576}, /* 625 lines, 10.125 MHz (3/4 D1, DVB, laserdisc) */ 349 {480, 576}, /* 625 lines, 9 MHz (2/3 D1, DVB, SVCD) */ 350 {352, 576}, /* 625 lines, 6.75 MHz (D2, 1/2 D1, CVD, DVB, DVD) */ 351 {352, 288}, /* 625 lines, 6.75 MHz, 1 field (D4, VCD, DVB, DVD, CIF) */ 352 {176, 144}, /* 625 lines, 3.375 MHz, half field (QCIF) */ 353 {720, 486}, /* 525 lines, 13.5 MHz (D1) */ 354 {704, 486}, /* 525 lines, 13.5 MHz */ 355 {720, 480}, /* 525 lines, 13.5 MHz (DV, DSS, DVD) */ 356 {704, 480}, /* 525 lines, 13.5 MHz (1/1 D1, ATSC, DVD) */ 357 {544, 480}, /* 525 lines. 10.125 MHz (DSS, laserdisc) */ 358 {528, 480}, /* 525 lines. 10.125 MHz (3/4 D1, laserdisc) */ 359 {480, 480}, /* 525 lines, 9 MHz (2/3 D1, SVCD) */ 360 {352, 480}, /* 525 lines, 6.75 MHz (D2, 1/2 D1, CVD, DVD) */ 361 {352, 240} /* 525 lines. 6.75 MHz, 1 field (D4, VCD, DSS, DVD) */ 362 }; 363 unsigned int width, height, pix_width, pix_height, i, DAR_16_9; 364 365 *pixel_width = sequence->pixel_width; 366 *pixel_height = sequence->pixel_height; 367 width = sequence->picture_width; 368 height = sequence->picture_height; 369 for (i = 0; i < sizeof (video_modes) / sizeof (video_modes[0]); i++) 370 if (width == video_modes[i].width && height == video_modes[i].height) 371 break; 372 if (i == sizeof (video_modes) / sizeof (video_modes[0]) || 373 (sequence->pixel_width == 1 && sequence->pixel_height == 1) || 374 width != sequence->display_width || height != sequence->display_height) 375 return 0; 376 377 for (pix_height = 1; height * pix_height < 480; pix_height <<= 1); 378 height *= pix_height; 379 for (pix_width = 1; width * pix_width <= 352; pix_width <<= 1); 380 width *= pix_width; 381 382 if (! (sequence->flags & SEQ_FLAG_MPEG2)) { 383 static unsigned int mpeg1_check[2][2] = {{11, 54}, {27, 45}}; 384 DAR_16_9 = (sequence->pixel_height == 27 || 385 sequence->pixel_height == 45); 386 if (width < 704 || 387 sequence->pixel_height != mpeg1_check[DAR_16_9][height == 576]) 388 return 0; 389 } else { 390 DAR_16_9 = (3 * sequence->picture_width * sequence->pixel_width > 391 4 * sequence->picture_height * sequence->pixel_height); 392 switch (width) { 393 case 528: case 544: pix_width *= 4; pix_height *= 3; break; 394 case 480: pix_width *= 3; pix_height *= 2; break; 395 } 396 } 397 if (DAR_16_9) { 398 pix_width *= 4; pix_height *= 3; 399 } 400 if (height == 576) { 401 pix_width *= 59; pix_height *= 54; 402 } else { 403 pix_width *= 10; pix_height *= 11; 404 } 405 *pixel_width = pix_width; 406 *pixel_height = pix_height; 407 simplify (pixel_width, pixel_height); 408 return (height == 576) ? 1 : 2; 409 } 410 411 static void copy_matrix (mpeg2dec_t * mpeg2dec, int idx) 412 { 413 if (memcmp (mpeg2dec->quantizer_matrix[idx], 414 mpeg2dec->new_quantizer_matrix[idx], 64)) { 415 memcpy (mpeg2dec->quantizer_matrix[idx], 416 mpeg2dec->new_quantizer_matrix[idx], 64); 417 mpeg2dec->scaled[idx] = -1; 346 418 } 347 419 } 348 420 … … 392 464 (sequence->chroma_height == sequence->height)); 393 465 394 466 if (mpeg2dec->sequence.width != (unsigned)-1) { 395 unsigned int new_byte_rate;396 397 467 /* 398 468 * According to 6.1.1.6, repeat sequence headers should be 399 * identical to the original. However some DVDs dont respect 400 * that and have different bitrates in the repeat sequence 401 * headers. So we'll ignore that in the comparison and still 402 * consider these as repeat sequence headers. 403 * 404 * However, be careful not to alter the current sequence when 405 * returning STATE_INVALID_END. 469 * identical to the original. However some encoders do not 470 * respect that and change various fields (including bitrate 471 * and aspect ratio) in the repeat sequence headers. So we 472 * choose to be as conservative as possible and only restart 473 * the decoder if the width, height, chroma_width, 474 * chroma_height or low_delay flag are modified. 406 475 */ 407 new_byte_rate = sequence->byte_rate; 408 sequence->byte_rate = mpeg2dec->sequence.byte_rate; 409 if (memcmp (&(mpeg2dec->sequence), sequence, 410 sizeof (mpeg2_sequence_t))) { 476 if (sequence->width != mpeg2dec->sequence.width || 477 sequence->height != mpeg2dec->sequence.height || 478 sequence->chroma_width != mpeg2dec->sequence.chroma_width || 479 sequence->chroma_height != mpeg2dec->sequence.chroma_height || 480 ((sequence->flags ^ mpeg2dec->sequence.flags) & 481 SEQ_FLAG_LOW_DELAY)) { 411 482 decoder->stride_frame = sequence->width; 412 sequence->byte_rate = new_byte_rate;413 483 mpeg2_header_end (mpeg2dec); 414 484 mpeg2dec->action = invalid_end_action; 415 485 mpeg2dec->state = STATE_INVALID_END; 416 486 return; 417 487 } 418 sequence->byte_rate = new_byte_rate; 419 mpeg2dec->state = STATE_SEQUENCE_REPEATED; 488 mpeg2dec->state = (memcmp (&(mpeg2dec->sequence), sequence, 489 sizeof (mpeg2_sequence_t)) ? 490 STATE_SEQUENCE_MODIFIED : STATE_SEQUENCE_REPEATED); 420 491 } else 421 492 decoder->stride_frame = sequence->width; 422 493 mpeg2dec->sequence = *sequence; … … 468 539 } 469 540 } 470 541 471 mpeg2_state_t mpeg2_header_picture_start(mpeg2dec_t * mpeg2dec)542 int mpeg2_header_picture (mpeg2dec_t * mpeg2dec) 472 543 { 544 uint8_t * buffer = mpeg2dec->chunk_start; 473 545 mpeg2_picture_t * picture = &(mpeg2dec->new_picture); 546 mpeg2_decoder_t * decoder = &(mpeg2dec->decoder); 547 int type; 474 548 475 549 mpeg2dec->state = ((mpeg2dec->state != STATE_SLICE_1ST) ? 476 550 STATE_PICTURE : STATE_PICTURE_2ND); 477 picture->flags = 0; 551 mpeg2dec->ext_state = PIC_CODING_EXT; 552 553 picture->temporal_reference = (buffer[0] << 2) | (buffer[1] >> 6); 554 555 type = (buffer [1] >> 3) & 7; 556 if (type == PIC_FLAG_CODING_TYPE_P || type == PIC_FLAG_CODING_TYPE_B) { 557 /* forward_f_code and backward_f_code - used in mpeg1 only */ 558 decoder->f_motion.f_code[1] = (buffer[3] >> 2) & 1; 559 decoder->f_motion.f_code[0] = 560 (((buffer[3] << 1) | (buffer[4] >> 7)) & 7) - 1; 561 decoder->b_motion.f_code[1] = (buffer[4] >> 6) & 1; 562 decoder->b_motion.f_code[0] = ((buffer[4] >> 3) & 7) - 1; 563 } 564 565 picture->flags = PIC_FLAG_PROGRESSIVE_FRAME | type; 478 566 picture->tag = picture->tag2 = 0; 479 567 if (mpeg2dec->num_tags) { 480 if (mpeg2dec->bytes_since_tag >= 4) {568 if (mpeg2dec->bytes_since_tag >= mpeg2dec->chunk_ptr - buffer + 4) { 481 569 mpeg2dec->num_tags = 0; 482 570 picture->tag = mpeg2dec->tag_current; 483 571 picture->tag2 = mpeg2dec->tag2_current; 484 picture->flags = PIC_FLAG_TAGS;572 picture->flags |= PIC_FLAG_TAGS; 485 573 } else if (mpeg2dec->num_tags > 1) { 486 574 mpeg2dec->num_tags = 1; 487 575 picture->tag = mpeg2dec->tag_previous; 488 576 picture->tag2 = mpeg2dec->tag2_previous; 489 picture->flags = PIC_FLAG_TAGS;577 picture->flags |= PIC_FLAG_TAGS; 490 578 } 491 579 } 580 picture->nb_fields = 2; 492 581 picture->display_offset[0].x = picture->display_offset[1].x = 493 582 picture->display_offset[2].x = mpeg2dec->display_offset_x; 494 583 picture->display_offset[0].y = picture->display_offset[1].y = 495 584 picture->display_offset[2].y = mpeg2dec->display_offset_y; 496 return mpeg2_parse_header (mpeg2dec);497 }498 499 int mpeg2_header_picture (mpeg2dec_t * mpeg2dec)500 {501 uint8_t * buffer = mpeg2dec->chunk_start;502 mpeg2_picture_t * picture = &(mpeg2dec->new_picture);503 mpeg2_decoder_t * decoder = &(mpeg2dec->decoder);504 int type;505 506 type = (buffer [1] >> 3) & 7;507 mpeg2dec->ext_state = PIC_CODING_EXT;508 509 picture->temporal_reference = (buffer[0] << 2) | (buffer[1] >> 6);510 511 picture->flags |= type;512 513 if (type == PIC_FLAG_CODING_TYPE_P || type == PIC_FLAG_CODING_TYPE_B) {514 /* forward_f_code and backward_f_code - used in mpeg1 only */515 decoder->f_motion.f_code[1] = (buffer[3] >> 2) & 1;516 decoder->f_motion.f_code[0] =517 (((buffer[3] << 1) | (buffer[4] >> 7)) & 7) - 1;518 decoder->b_motion.f_code[1] = (buffer[4] >> 6) & 1;519 decoder->b_motion.f_code[0] = ((buffer[4] >> 3) & 7) - 1;520 }521 585 522 586 /* XXXXXX decode extra_information_picture as well */ 523 587 524 picture->nb_fields = 2; 525 526 mpeg2dec->q_scale_type = 0; 588 decoder->q_scale_type = 0; 527 589 decoder->intra_dc_precision = 7; 528 590 decoder->frame_pred_frame_dct = 1; 529 591 decoder->concealment_motion_vectors = 0; … … 570 632 decoder->top_field_first = buffer[3] >> 7; 571 633 decoder->frame_pred_frame_dct = (buffer[3] >> 6) & 1; 572 634 decoder->concealment_motion_vectors = (buffer[3] >> 5) & 1; 573 mpeg2dec->q_scale_type = buffer[3] & 16;635 decoder->q_scale_type = buffer[3] & 16; 574 636 decoder->intra_vlc_format = (buffer[3] >> 3) & 1; 575 637 decoder->scan = (buffer[3] & 4) ? mpeg2_scan_alt : mpeg2_scan_norm; 576 flags |= (buffer[4] & 0x80) ? PIC_FLAG_PROGRESSIVE_FRAME : 0; 638 if (!(buffer[4] & 0x80)) 639 flags &= ~PIC_FLAG_PROGRESSIVE_FRAME; 577 640 if (buffer[4] & 0x40) 578 641 flags |= (((buffer[4]<<26) | (buffer[5]<<18) | (buffer[6]<<10)) & 579 642 PIC_MASK_COMPOSITE_DISPLAY) | PIC_FLAG_COMPOSITE_DISPLAY; … … 794 857 return 0; 795 858 } 796 859 797 static void prescale (mpeg2dec_t * mpeg2dec, int i ndex)860 static void prescale (mpeg2dec_t * mpeg2dec, int idx) 798 861 { 799 862 static int non_linear_scale [] = { 800 863 0, 1, 2, 3, 4, 5, 6, 7, … … 805 868 int i, j, k; 806 869 mpeg2_decoder_t * decoder = &(mpeg2dec->decoder); 807 870 808 if (mpeg2dec->scaled[i ndex] != mpeg2dec->q_scale_type) {809 mpeg2dec->scaled[i ndex] = mpeg2dec->q_scale_type;871 if (mpeg2dec->scaled[idx] != decoder->q_scale_type) { 872 mpeg2dec->scaled[idx] = decoder->q_scale_type; 810 873 for (i = 0; i < 32; i++) { 811 k = mpeg2dec->q_scale_type ? non_linear_scale[i] : (i << 1); 812 decoder->quantizer_scales[i] = k; 874 k = decoder->q_scale_type ? non_linear_scale[i] : (i << 1); 813 875 for (j = 0; j < 64; j++) 814 decoder->quantizer_prescale[i ndex][i][j] =815 k * mpeg2dec->quantizer_matrix[i ndex][j];876 decoder->quantizer_prescale[idx][i][j] = 877 k * mpeg2dec->quantizer_matrix[idx][j]; 816 878 } 817 879 } 818 880 } … … 864 926 mpeg2dec->fbuf[b_type]->buf); 865 927 } 866 928 mpeg2dec->action = NULL; 867 return (mpeg2_state_t)-1;929 return STATE_INTERNAL_NORETURN; 868 930 } 869 931 870 932 static mpeg2_state_t seek_sequence (mpeg2dec_t * mpeg2dec) -
libmpeg2/idct_alpha.c
diff -u /build/mplayer/libmpeg2/idct_alpha.c /build/libmpeg2/libmpeg2/idct_alpha.c
old new 20 20 * You should have received a copy of the GNU General Public License 21 21 * along with this program; if not, write to the Free Software 22 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 *24 * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.25 * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/26 * $Id: idct_alpha.c 26051 2008-02-21 16:47:05Z diego $27 23 */ 28 24 29 25 #include "config.h" -
libmpeg2/idct_altivec.c
diff -u /build/mplayer/libmpeg2/idct_altivec.c /build/libmpeg2/libmpeg2/idct_altivec.c
old new 58 58 59 59 #if defined(__APPLE_CC__) /* apple */ 60 60 #define VEC_S16(a,b,c,d,e,f,g,h) (vector_s16_t) (a, b, c, d, e, f, g, h) 61 #else /* gnu */61 #else /* gnu */ 62 62 #define VEC_S16(a,b,c,d,e,f,g,h) {a, b, c, d, e, f, g, h} 63 63 #endif 64 64 -
libmpeg2/idct.c
diff -u /build/mplayer/libmpeg2/idct.c /build/libmpeg2/libmpeg2/idct.c
old new 19 19 * You should have received a copy of the GNU General Public License 20 20 * along with this program; if not, write to the Free Software 21 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 *23 * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.24 * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/25 * $Id: idct.c 26425 2008-04-12 22:42:00Z diego $26 22 */ 27 23 28 24 #include "config.h" -
libmpeg2/idct_mmx.c
diff -u /build/mplayer/libmpeg2/idct_mmx.c /build/libmpeg2/libmpeg2/idct_mmx.c
old new 19 19 * You should have received a copy of the GNU General Public License 20 20 * along with this program; if not, write to the Free Software 21 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 *23 * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.24 * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/25 * $Id: idct_mmx.c 26425 2008-04-12 22:42:00Z diego $26 22 */ 27 23 28 24 #include "config.h" -
libmpeg2/motion_comp_arm.c
Only in /build/mplayer/libmpeg2: libmpeg-0.4.1.diff Only in /build/libmpeg2/libmpeg2: libmpeg2.pc.in Only in /build/libmpeg2/libmpeg2: Makefile.am Only in /build/libmpeg2/libmpeg2: Makefile.in Only in /build/mplayer/libmpeg2: mmx.h diff -u /build/mplayer/libmpeg2/motion_comp_arm.c /build/libmpeg2/libmpeg2/motion_comp_arm.c
old new 16 16 * GNU General Public License for more details. 17 17 * 18 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software19 * along with mpeg2dec; if not, write to the Free Software 20 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 21 */ 22 22 … … 30 30 #include "attributes.h" 31 31 #include "mpeg2_internal.h" 32 32 33 #define avg2(a,b) ((a+b+1)>>1)33 #define avg2(a,b) ((a+b+1)>>1) 34 34 #define avg4(a,b,c,d) ((a+b+c+d+2)>>2) 35 35 36 #define predict_o(i) (ref[i])37 #define predict_x(i) (avg2 (ref[i], ref[i+1]))38 #define predict_y(i) (avg2 (ref[i], (ref+stride)[i]))36 #define predict_o(i) (ref[i]) 37 #define predict_x(i) (avg2 (ref[i], ref[i+1])) 38 #define predict_y(i) (avg2 (ref[i], (ref+stride)[i])) 39 39 #define predict_xy(i) (avg4 (ref[i], ref[i+1], \ 40 40 (ref+stride)[i], (ref+stride)[i+1])) 41 41 … … 67 67 op (predict_##xy, 15); \ 68 68 ref += stride; \ 69 69 dest += stride; \ 70 } while (--height); \70 } while (--height); \ 71 71 } \ 72 72 static void MC_##op##_##xy##_8_c (uint8_t * dest, const uint8_t * ref, \ 73 73 const int stride, int height) \ … … 83 83 op (predict_##xy, 7); \ 84 84 ref += stride; \ 85 85 dest += stride; \ 86 } while (--height); \86 } while (--height); \ 87 87 } \ 88 88 /* definitions of the actual mc functions */ 89 89 90 MC_FUNC (put,o)91 90 MC_FUNC (avg,o) 92 MC_FUNC (put,x)93 91 MC_FUNC (avg,x) 94 92 MC_FUNC (put,y) 95 93 MC_FUNC (avg,y) … … 117 115 } 118 116 119 117 extern void MC_put_o_8_arm (uint8_t * dest, const uint8_t * ref, 120 int stride, int height);118 int stride, int height); 121 119 122 120 extern void MC_put_x_8_arm (uint8_t * dest, const uint8_t * ref, 123 121 int stride, int height); -
libmpeg2/motion_comp_arm_s.S
diff -u /build/mplayer/libmpeg2/motion_comp_arm_s.S /build/libmpeg2/libmpeg2/motion_comp_arm_s.S
old new 15 15 @ GNU General Public License for more details. 16 16 @ 17 17 @ You should have received a copy of the GNU General Public License 18 @ along with this program; if not, write to the Free Software18 @ along with mpeg2dec; if not, write to the Free Software 19 19 @ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 20 21 21 22 .text 22 23 23 24 @ ---------------------------------------------------------------- -
libmpeg2/motion_comp.c
diff -u /build/mplayer/libmpeg2/motion_comp.c /build/libmpeg2/libmpeg2/motion_comp.c
old new 19 19 * You should have received a copy of the GNU General Public License 20 20 * along with this program; if not, write to the Free Software 21 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 *23 * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.24 * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/25 * $Id: motion_comp.c 26314 2008-04-01 17:31:37Z diego $26 22 */ 27 23 28 24 #include "config.h" … … 62 58 else 63 59 #endif 64 60 #ifdef ARCH_ARM 65 if (accel & MPEG2_ACCEL_ARM_IWMMXT) 66 mpeg2_mc = mpeg2_mc_iwmmxt; 67 else if (accel & MPEG2_ACCEL_ARM) 61 if (accel & MPEG2_ACCEL_ARM) { 68 62 mpeg2_mc = mpeg2_mc_arm; 69 else63 } else 70 64 #endif 71 65 mpeg2_mc = mpeg2_mc_c; 72 66 } -
libmpeg2/motion_comp_mmx.c
Only in /build/mplayer/libmpeg2: motion_comp_iwmmxt.c diff -u /build/mplayer/libmpeg2/motion_comp_mmx.c /build/libmpeg2/libmpeg2/motion_comp_mmx.c
old new 19 19 * You should have received a copy of the GNU General Public License 20 20 * along with this program; if not, write to the Free Software 21 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 *23 * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.24 * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/25 * $Id: motion_comp_mmx.c 21542 2006-12-09 10:34:27Z henry $26 22 */ 27 23 28 24 #include "config.h" -
libmpeg2/mpeg2_internal.h
Only in /build/mplayer/libmpeg2: mpeg2.h diff -u /build/mplayer/libmpeg2/mpeg2_internal.h /build/libmpeg2/libmpeg2/mpeg2_internal.h
old new 19 19 * You should have received a copy of the GNU General Public License 20 20 * along with this program; if not, write to the Free Software 21 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 *23 * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.24 * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/25 * $Id: mpeg2_internal.h 26425 2008-04-12 22:42:00Z diego $26 22 */ 27 23 24 #ifndef LIBMPEG2_MPEG2_INTERNAL_H 25 #define LIBMPEG2_MPEG2_INTERNAL_H 26 27 #define STATE_INTERNAL_NORETURN ((mpeg2_state_t)-1) 28 28 29 /* macroblock modes */ 29 30 #define MACROBLOCK_INTRA 1 30 31 #define MACROBLOCK_PATTERN 2 … … 149 150 150 151 int mpeg1; 151 152 152 int quantizer_scales[32]; 153 int quantizer_scale; 154 char* quant_store; 155 int quant_stride; 153 /* XXX: stuff due to xine shit */ 154 int8_t q_scale_type; 156 155 }; 157 156 158 157 typedef struct { … … 220 219 int16_t display_offset_x, display_offset_y; 221 220 222 221 int copy_matrix; 223 int8_t q_scale_type, scaled[4]; 222 int8_t scaled[4]; /* XXX: MOVED */ 223 //int8_t q_scale_type, scaled[4]; 224 224 uint8_t quantizer_matrix[4][64]; 225 225 uint8_t new_quantizer_matrix[4][64]; 226 227 unsigned char *pending_buffer;228 int pending_length;229 226 }; 230 227 231 228 typedef struct { … … 236 233 } cpu_state_t; 237 234 238 235 /* cpu_accel.c */ 239 uint32_t mpeg2_detect_accel ( void);236 uint32_t mpeg2_detect_accel (uint32_t accel); 240 237 241 238 /* cpu_state.c */ 242 239 void mpeg2_cpu_state_init (uint32_t accel); … … 314 311 extern mpeg2_mc_t mpeg2_mc_alpha; 315 312 extern mpeg2_mc_t mpeg2_mc_vis; 316 313 extern mpeg2_mc_t mpeg2_mc_arm; 317 extern mpeg2_mc_t mpeg2_mc_iwmmxt; 314 315 #endif /* LIBMPEG2_MPEG2_INTERNAL_H */ -
libmpeg2/slice.c
diff -u /build/mplayer/libmpeg2/slice.c /build/libmpeg2/libmpeg2/slice.c
old new 20 20 * You should have received a copy of the GNU General Public License 21 21 * along with this program; if not, write to the Free Software 22 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 *24 * Modified for use with MPlayer, see libmpeg-0.4.1.diff for the exact changes.25 * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/26 * $Id: slice.c 21941 2007-01-16 09:49:28Z henry $27 23 */ 28 24 29 25 #include "config.h" … … 146 142 147 143 quantizer_scale_code = UBITS (bit_buf, 5); 148 144 DUMPBITS (bit_buf, bits, 5); 149 decoder->quantizer_scale = decoder->quantizer_scales[quantizer_scale_code];150 145 151 146 decoder->quantizer_matrix[0] = 152 147 decoder->quantizer_prescale[0][quantizer_scale_code]; … … 450 445 break; /* illegal, check needed to avoid buffer overflow */ 451 446 } 452 447 dest[63] ^= mismatch & 16; 453 DUMPBITS (bit_buf, bits, 2); /* dump end of block code */448 DUMPBITS (bit_buf, bits, tab->len); /* dump end of block code */ 454 449 decoder->bitstream_buf = bit_buf; 455 450 decoder->bitstream_bits = bits; 456 451 decoder->bitstream_ptr = bit_ptr; … … 508 503 } else { 509 504 510 505 /* end of block. I commented out this code because if we */ 511 /* do nt exit here we will still exit at the later test :) */506 /* do not exit here we will still exit at the later test :) */ 512 507 513 508 /* if (i >= 128) break; */ /* end of block */ 514 509 … … 560 555 break; /* illegal, check needed to avoid buffer overflow */ 561 556 } 562 557 dest[63] ^= mismatch & 16; 563 DUMPBITS (bit_buf, bits, 4); /* dump end of block code */558 DUMPBITS (bit_buf, bits, tab->len); /* dump end of block code */ 564 559 decoder->bitstream_buf = bit_buf; 565 560 decoder->bitstream_bits = bits; 566 561 decoder->bitstream_ptr = bit_ptr; … … 681 676 break; /* illegal, check needed to avoid buffer overflow */ 682 677 } 683 678 dest[63] ^= mismatch & 16; 684 DUMPBITS (bit_buf, bits, 2); /* dump end of block code */679 DUMPBITS (bit_buf, bits, tab->len); /* dump end of block code */ 685 680 decoder->bitstream_buf = bit_buf; 686 681 decoder->bitstream_bits = bits; 687 682 decoder->bitstream_ptr = bit_ptr; … … 799 794 } 800 795 break; /* illegal, check needed to avoid buffer overflow */ 801 796 } 802 DUMPBITS (bit_buf, bits, 2); /* dump end of block code */797 DUMPBITS (bit_buf, bits, tab->len); /* dump end of block code */ 803 798 decoder->bitstream_buf = bit_buf; 804 799 decoder->bitstream_bits = bits; 805 800 decoder->bitstream_ptr = bit_ptr; … … 926 921 } 927 922 break; /* illegal, check needed to avoid buffer overflow */ 928 923 } 929 DUMPBITS (bit_buf, bits, 2); /* dump end of block code */924 DUMPBITS (bit_buf, bits, tab->len); /* dump end of block code */ 930 925 decoder->bitstream_buf = bit_buf; 931 926 decoder->bitstream_bits = bits; 932 927 decoder->bitstream_ptr = bit_ptr; … … 1569 1564 1570 1565 #define NEXT_MACROBLOCK \ 1571 1566 do { \ 1572 if(decoder->quant_store) { \1573 if (decoder->picture_structure == TOP_FIELD) \1574 decoder->quant_store[2*decoder->quant_stride*(decoder->v_offset>>4) \1575 +(decoder->offset>>4)] = decoder->quantizer_scale; \1576 else if (decoder->picture_structure == BOTTOM_FIELD) \1577 decoder->quant_store[2*decoder->quant_stride*(decoder->v_offset>>4) \1578 + decoder->quant_stride \1579 +(decoder->offset>>4)] = decoder->quantizer_scale; \1580 else \1581 decoder->quant_store[decoder->quant_stride*(decoder->v_offset>>4) \1582 +(decoder->offset>>4)] = decoder->quantizer_scale; \1583 } \1584 1567 decoder->offset += 16; \ 1585 1568 if (decoder->offset == decoder->width) { \ 1586 1569 do { /* just so we can use the break statement */ \ … … 1604 1587 } \ 1605 1588 } while (0) 1606 1589 1590 /** 1591 * Dummy motion decoding function, to avoid calling NULL in 1592 * case of malformed streams. 1593 */ 1607 1594 static void motion_dummy (mpeg2_decoder_t * const decoder, 1608 1595 motion_t * const motion, 1609 1596 mpeg2_mc_fct * const * const table) … … 1668 1655 if (decoder->mpeg1) { 1669 1656 decoder->motion_parser[0] = motion_zero_420; 1670 1657 decoder->motion_parser[MC_FIELD] = motion_dummy; 1671 decoder->motion_parser[MC_FRAME] = motion_mp1;1658 decoder->motion_parser[MC_FRAME] = motion_mp1; 1672 1659 decoder->motion_parser[MC_DMV] = motion_dummy; 1673 1660 decoder->motion_parser[4] = motion_reuse_420; 1674 1661 } else if (decoder->picture_structure == FRAME_PICTURE) { … … 1894 1881 1895 1882 motion_parser_t * parser; 1896 1883 1884 if ( ((macroblock_modes >> MOTION_TYPE_SHIFT) < 0) 1885 || ((macroblock_modes >> MOTION_TYPE_SHIFT) >= 1886 (int)(sizeof(decoder->motion_parser) 1887 / sizeof(decoder->motion_parser[0]))) 1888 ) { 1889 break; // Illegal ! 1890 } 1891 1897 1892 parser = 1898 1893 decoder->motion_parser[macroblock_modes >> MOTION_TYPE_SHIFT]; 1899 1894 MOTION_CALL (parser, macroblock_modes); -
libmpeg2/vlc.h
Common subdirectories: /build/mplayer/libmpeg2/.svn and /build/libmpeg2/libmpeg2/.svn Only in /build/mplayer/libmpeg2: vis.h diff -u /build/mplayer/libmpeg2/vlc.h /build/libmpeg2/libmpeg2/vlc.h
old new 21 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 22 */ 23 23 24 #ifndef LIBMPEG2_VLC_H 25 #define LIBMPEG2_VLC_H 26 24 27 #define GETWORD(bit_buf,shift,bit_ptr) \ 25 28 do { \ 26 29 bit_buf |= ((bit_ptr[0] << 8) | bit_ptr[1]) << (shift); \ … … 121 124 #define INTER MACROBLOCK_MOTION_FORWARD|MACROBLOCK_MOTION_BACKWARD 122 125 123 126 static const MBtab MB_B [] = { 124 {0, 0}, {INTRA|QUANT, 6},127 {0, 6}, {INTRA|QUANT, 6}, 125 128 {BWD|CODED|QUANT, 6}, {FWD|CODED|QUANT, 6}, 126 129 {INTER|CODED|QUANT, 5}, {INTER|CODED|QUANT, 5}, 127 130 {INTRA, 5}, {INTRA, 5}, … … 201 204 }; 202 205 203 206 static const CBPtab CBP_9 [] = { 204 {0, 0}, {0x00, 9}, {0x39, 9}, {0x36, 9},207 {0, 9}, {0x00, 9}, {0x39, 9}, {0x36, 9}, 205 208 {0x37, 9}, {0x3b, 9}, {0x3d, 9}, {0x3e, 9}, 206 209 {0x17, 8}, {0x17, 8}, {0x1b, 8}, {0x1b, 8}, 207 210 {0x1d, 8}, {0x1d, 8}, {0x1e, 8}, {0x1e, 8}, … … 289 292 }; 290 293 291 294 static const DCTtab DCT_B14_8 [] = { 292 { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6},295 { 65, 0,12}, { 65, 0,12}, { 65, 0,12}, { 65, 0,12}, 293 296 { 3, 2, 7}, { 3, 2, 7}, { 10, 1, 7}, { 10, 1, 7}, 294 297 { 1, 4, 7}, { 1, 4, 7}, { 9, 1, 7}, { 9, 1, 7}, 295 298 { 8, 1, 6}, { 8, 1, 6}, { 8, 1, 6}, { 8, 1, 6}, … … 326 329 }; 327 330 328 331 static const DCTtab DCT_B15_8 [] = { 329 { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6},332 { 65, 0,12}, { 65, 0,12}, { 65, 0,12}, { 65, 0,12}, 330 333 { 8, 1, 7}, { 8, 1, 7}, { 9, 1, 7}, { 9, 1, 7}, 331 334 { 7, 1, 7}, { 7, 1, 7}, { 3, 2, 7}, { 3, 2, 7}, 332 335 { 1, 7, 6}, { 1, 7, 6}, { 1, 7, 6}, { 1, 7, 6}, … … 427 430 { 7, 7}, { 7, 7}, { 7, 7}, { 7, 7}, 428 431 { 7, 7}, { 7, 7}, { 7, 7}, { 7, 7} 429 432 }; 433 434 #endif /* LIBMPEG2_VLC_H */
