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