Mercurial > mplayer.hg
annotate libmpeg2/libmpeg-0.4.0.diff @ 13020:3380d4a65b15
Patch updated for latest changes to libmpeg2.
| author | diego |
|---|---|
| date | Sat, 14 Aug 2004 15:50:50 +0000 |
| parents | 69a86525f49e |
| children | 456a348bd973 |
| rev | line source |
|---|---|
|
13019
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
1 diff -ur libmpeg2/cpu_accel.c libmpeg2/cpu_accel.c |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
2 --- libmpeg2/cpu_accel.c 2003-10-06 04:31:52.000000000 +0200 |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
3 +++ libmpeg2/cpu_accel.c 2004-02-18 13:48:26.000000000 +0100 |
| 13020 | 4 @@ -108,7 +108,7 @@ |
| 5 } | |
| 6 #endif /* ARCH_X86 */ | |
| 7 | |
| 8 -#if defined(ARCH_PPC) || defined(ARCH_SPARC) | |
| 9 +#if defined(ARCH_PPC) || (defined(ARCH_SPARC) && defined(HAVE_VIS)) | |
| 10 #include <signal.h> | |
| 11 #include <setjmp.h> | |
| 12 | |
| 12937 | 13 @@ -195,6 +195,7 @@ |
| 14 #ifdef ARCH_ALPHA | |
| 15 static inline uint32_t arch_accel (void) | |
| 16 { | |
| 17 +#ifdef CAN_COMPILE_ALPHA_MVI | |
| 18 uint64_t no_mvi; | |
| 19 | |
| 20 asm volatile ("amask %1, %0" | |
| 21 @@ -202,6 +203,9 @@ | |
| 22 : "rI" (256)); /* AMASK_MVI */ | |
| 23 return no_mvi ? MPEG2_ACCEL_ALPHA : (MPEG2_ACCEL_ALPHA | | |
| 24 MPEG2_ACCEL_ALPHA_MVI); | |
| 25 +#else | |
| 26 + return MPEG2_ACCEL_ALPHA; | |
| 27 +#endif | |
| 28 } | |
| 29 #endif /* ARCH_ALPHA */ | |
| 30 #endif /* ACCEL_DETECT */ | |
|
13019
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
31 diff -ur libmpeg2/cpu_state.c libmpeg2/cpu_state.c |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
32 --- libmpeg2/cpu_state.c 2003-08-21 10:00:49.000000000 +0200 |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
33 +++ libmpeg2/cpu_state.c 2004-02-18 13:48:29.000000000 +0100 |
| 12937 | 34 @@ -120,7 +120,7 @@ |
| 35 mpeg2_cpu_state_restore = state_restore_mmx; | |
| 36 } | |
| 37 #endif | |
| 38 -#ifdef ARCH_PPC | |
| 39 +#if defined(ARCH_PPC) && defined(HAVE_ALTIVEC) | |
| 40 if (accel & MPEG2_ACCEL_PPC_ALTIVEC) { | |
| 41 mpeg2_cpu_state_save = state_save_altivec; | |
| 42 mpeg2_cpu_state_restore = state_restore_altivec; | |
|
13019
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
43 diff -ur libmpeg2/decode.c libmpeg2/decode.c |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
44 --- libmpeg2/decode.c 2003-12-22 12:59:34.000000000 +0100 |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
45 +++ libmpeg2/decode.c 2004-02-18 14:19:01.000000000 +0100 |
| 12937 | 46 @@ -351,6 +351,15 @@ |
| 47 fbuf->buf[1] = buf[1]; | |
| 48 fbuf->buf[2] = buf[2]; | |
| 49 fbuf->id = id; | |
| 50 + // HACK! FIXME! At first I frame, copy pointers to prediction frame too! | |
| 51 + if (mpeg2dec->custom_fbuf && !mpeg2dec->fbuf[1]->buf[0]){ | |
| 52 + mpeg2dec->fbuf[1]->buf[0]=buf[0]; | |
| 53 + mpeg2dec->fbuf[1]->buf[1]=buf[1]; | |
| 54 + mpeg2dec->fbuf[1]->buf[2]=buf[2]; | |
| 55 + mpeg2dec->fbuf[1]->id=NULL; | |
| 56 + } | |
| 57 +// printf("libmpeg2: FBUF 0:%p 1:%p 2:%p\n", | |
| 58 +// mpeg2dec->fbuf[0]->buf[0],mpeg2dec->fbuf[1]->buf[0],mpeg2dec->fbuf[2]->buf[0]); | |
| 59 } | |
| 60 | |
| 61 void mpeg2_custom_fbuf (mpeg2dec_t * mpeg2dec, int custom_fbuf) | |
|
13019
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
62 diff -ur libmpeg2/header.c libmpeg2/header.c |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
63 --- libmpeg2/header.c 2003-12-22 12:24:02.000000000 +0100 |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
64 +++ libmpeg2/header.c 2004-08-02 18:07:50.000000000 +0200 |
| 12937 | 65 @@ -100,6 +100,9 @@ |
| 66 mpeg2dec->decoder.convert = NULL; | |
| 67 mpeg2dec->decoder.convert_id = NULL; | |
| 68 mpeg2dec->picture = mpeg2dec->pictures; | |
| 69 + memset(&mpeg2dec->fbuf_alloc[0].fbuf, 0, sizeof(mpeg2_fbuf_t)); | |
| 70 + memset(&mpeg2dec->fbuf_alloc[1].fbuf, 0, sizeof(mpeg2_fbuf_t)); | |
| 71 + memset(&mpeg2dec->fbuf_alloc[2].fbuf, 0, sizeof(mpeg2_fbuf_t)); | |
| 72 mpeg2dec->fbuf[0] = &mpeg2dec->fbuf_alloc[0].fbuf; | |
| 73 mpeg2dec->fbuf[1] = &mpeg2dec->fbuf_alloc[1].fbuf; | |
| 74 mpeg2dec->fbuf[2] = &mpeg2dec->fbuf_alloc[2].fbuf; | |
| 75 @@ -551,6 +554,7 @@ | |
| 76 if (!(mpeg2dec->sequence.flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE)) { | |
| 77 picture->nb_fields = (buffer[3] & 2) ? 3 : 2; | |
| 78 flags |= (buffer[3] & 128) ? PIC_FLAG_TOP_FIELD_FIRST : 0; | |
| 79 + flags |= (buffer[3] & 2) ? PIC_FLAG_REPEAT_FIRST_FIELD : 0; | |
| 80 } else | |
| 81 picture->nb_fields = (buffer[3]&2) ? ((buffer[3]&128) ? 6 : 4) : 2; | |
| 82 break; | |
| 83 @@ -799,6 +803,7 @@ | |
| 84 mpeg2dec->scaled[index] = mpeg2dec->q_scale_type; | |
| 85 for (i = 0; i < 32; i++) { | |
| 86 k = mpeg2dec->q_scale_type ? non_linear_scale[i] : (i << 1); | |
| 87 + decoder->quantizer_scale = k; | |
| 88 for (j = 0; j < 64; j++) | |
| 89 decoder->quantizer_prescale[index][i][j] = | |
| 90 k * mpeg2dec->quantizer_matrix[index][j]; | |
|
13019
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
91 diff -ur libmpeg2/idct_alpha.c libmpeg2/idct_alpha.c |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
92 --- libmpeg2/idct_alpha.c 2003-09-19 11:26:42.000000000 +0200 |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
93 +++ libmpeg2/idct_alpha.c 2004-02-18 13:48:29.000000000 +0100 |
| 12937 | 94 @@ -59,7 +59,7 @@ |
| 95 } while (0) | |
| 96 #endif | |
| 97 | |
| 98 -static void inline idct_row (int16_t * const block) | |
| 99 +static inline void idct_row (int16_t * const block) | |
| 100 { | |
| 101 uint64_t l, r; | |
| 102 int_fast32_t d0, d1, d2, d3; | |
| 103 @@ -116,7 +116,7 @@ | |
| 104 block[7] = (a0 - b0) >> 12; | |
| 105 } | |
| 106 | |
| 107 -static void inline idct_col (int16_t * const block) | |
| 108 +static inline void idct_col (int16_t * const block) | |
| 109 { | |
| 110 int_fast32_t d0, d1, d2, d3; | |
| 111 int_fast32_t a0, a1, a2, a3, b0, b1, b2, b3; | |
| 112 @@ -157,6 +157,7 @@ | |
| 113 block[8*7] = (a0 - b0) >> 17; | |
| 114 } | |
| 115 | |
| 116 +#ifdef CAN_COMPILE_ALPHA_MVI | |
| 117 void mpeg2_idct_copy_mvi (int16_t * block, uint8_t * dest, const int stride) | |
| 118 { | |
| 119 uint64_t clampmask; | |
| 120 @@ -289,6 +290,7 @@ | |
| 121 stq (p7, dest + 7 * stride); | |
| 122 } | |
| 123 } | |
| 124 +#endif | |
| 125 | |
| 126 void mpeg2_idct_copy_alpha (int16_t * block, uint8_t * dest, const int stride) | |
| 127 { | |
|
13019
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
128 diff -ur libmpeg2/idct.c libmpeg2/idct.c |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
129 --- libmpeg2/idct.c 2003-09-19 11:26:42.000000000 +0200 |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
130 +++ libmpeg2/idct.c 2004-02-18 14:30:15.000000000 +0100 |
| 12937 | 131 @@ -66,7 +66,7 @@ |
| 132 } while (0) | |
| 133 #endif | |
| 134 | |
| 135 -static void inline idct_row (int16_t * const block) | |
| 136 +static inline void idct_row (int16_t * const block) | |
| 137 { | |
| 138 int d0, d1, d2, d3; | |
| 139 int a0, a1, a2, a3, b0, b1, b2, b3; | |
| 140 @@ -119,7 +119,7 @@ | |
| 141 block[7] = (a0 - b0) >> 12; | |
| 142 } | |
| 143 | |
| 144 -static void inline idct_col (int16_t * const block) | |
| 145 +static inline void idct_col (int16_t * const block) | |
| 146 { | |
| 147 int d0, d1, d2, d3; | |
| 148 int a0, a1, a2, a3, b0, b1, b2, b3; | |
| 149 @@ -254,11 +254,14 @@ | |
| 150 } else | |
| 151 #endif | |
| 152 #ifdef ARCH_ALPHA | |
| 153 +#ifdef CAN_COMPILE_ALPHA_MVI | |
| 154 if (accel & MPEG2_ACCEL_ALPHA_MVI) { | |
| 155 mpeg2_idct_copy = mpeg2_idct_copy_mvi; | |
| 156 mpeg2_idct_add = mpeg2_idct_add_mvi; | |
| 157 mpeg2_idct_alpha_init (); | |
| 158 - } else if (accel & MPEG2_ACCEL_ALPHA) { | |
| 159 + } else | |
| 160 +#endif | |
| 161 + if (accel & MPEG2_ACCEL_ALPHA) { | |
| 162 int i; | |
| 163 | |
| 164 mpeg2_idct_copy = mpeg2_idct_copy_alpha; | |
|
13019
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
165 diff -ur libmpeg2/motion_comp.c libmpeg2/motion_comp.c |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
166 --- libmpeg2/motion_comp.c 2003-10-06 04:31:52.000000000 +0200 |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
167 +++ libmpeg2/motion_comp.c 2004-02-18 13:48:37.000000000 +0100 |
| 13020 | 168 @@ -43,20 +43,24 @@ |
| 12937 | 169 else |
| 170 #endif | |
| 171 #ifdef ARCH_PPC | |
| 172 +#ifdef HAVE_ALTIVEC | |
| 173 if (accel & MPEG2_ACCEL_PPC_ALTIVEC) | |
| 174 mpeg2_mc = mpeg2_mc_altivec; | |
| 175 else | |
| 176 #endif | |
| 177 +#endif | |
| 178 #ifdef ARCH_ALPHA | |
| 179 if (accel & MPEG2_ACCEL_ALPHA) | |
| 180 mpeg2_mc = mpeg2_mc_alpha; | |
| 13020 | 181 else |
| 182 #endif | |
| 183 #ifdef ARCH_SPARC | |
| 184 +#ifdef HAVE_VIS | |
| 185 if (accel & MPEG2_ACCEL_SPARC_VIS) | |
| 186 mpeg2_mc = mpeg2_mc_vis; | |
| 187 else | |
| 188 #endif | |
| 189 +#endif | |
| 190 mpeg2_mc = mpeg2_mc_c; | |
| 191 } | |
| 192 | |
|
13019
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
193 diff -ur libmpeg2/mpeg2_internal.h libmpeg2/mpeg2_internal.h |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
194 --- libmpeg2/mpeg2_internal.h 2003-12-22 12:24:02.000000000 +0100 |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
195 +++ libmpeg2/mpeg2_internal.h 2004-08-02 18:09:17.000000000 +0200 |
| 12937 | 196 @@ -144,6 +144,11 @@ |
| 197 int second_field; | |
| 198 | |
| 199 int mpeg1; | |
| 200 + | |
| 201 + /* for MPlayer: */ | |
| 202 + int quantizer_scale; | |
| 203 + char* quant_store; | |
| 204 + int quant_stride; | |
| 205 }; | |
| 206 | |
| 207 typedef struct { | |
|
13019
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
208 diff -ur libmpeg2/slice.c libmpeg2/slice.c |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
209 --- libmpeg2/slice.c 2003-12-22 12:24:02.000000000 +0100 |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
210 +++ libmpeg2/slice.c 2004-08-02 18:07:50.000000000 +0200 |
| 12937 | 211 @@ -1564,6 +1564,9 @@ |
| 212 | |
| 213 #define NEXT_MACROBLOCK \ | |
| 214 do { \ | |
| 215 + if(decoder->quant_store) \ | |
| 216 + decoder->quant_store[decoder->quant_stride*(decoder->v_offset>>4) \ | |
| 217 + +(decoder->offset>>4)] = decoder->quantizer_scale; \ | |
| 218 decoder->offset += 16; \ | |
| 219 if (decoder->offset == decoder->width) { \ | |
| 220 do { /* just so we can use the break statement */ \ | |
|
13019
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
221 diff -ur include/mpeg2.h include/mpeg2.h |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
222 --- include/mpeg2.h 2003-12-22 13:13:35.000000000 +0100 |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
223 +++ include/mpeg2.h 2004-02-18 13:50:13.000000000 +0100 |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
224 @@ -82,6 +82,7 @@ |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
225 #define PIC_FLAG_COMPOSITE_DISPLAY 32 |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
226 #define PIC_FLAG_SKIP 64 |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
227 #define PIC_FLAG_TAGS 128 |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
228 +#define PIC_FLAG_REPEAT_FIRST_FIELD 256 |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
229 #define PIC_MASK_COMPOSITE_DISPLAY 0xfffff000 |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
230 |
|
69a86525f49e
Change patch structure so it applies cleanly to libmpeg2 sources.
diego
parents:
12937
diff
changeset
|
231 typedef struct mpeg2_picture_s { |
