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