-rw-r--r-- | noncore/multimedia/opieplayer2/nullvideo.c | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/yuv2rgb.c | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c index a49f9d3..095f206 100644 --- a/noncore/multimedia/opieplayer2/nullvideo.c +++ b/noncore/multimedia/opieplayer2/nullvideo.c | |||
@@ -70,96 +70,98 @@ struct null_driver_s { | |||
70 | int depth, bpp, bytes_per_pixel; | 70 | int depth, bpp, bytes_per_pixel; |
71 | int yuv2rgb_mode; | 71 | int yuv2rgb_mode; |
72 | int yuv2rgb_swap; | 72 | int yuv2rgb_swap; |
73 | int yuv2rgb_gamma; | 73 | int yuv2rgb_gamma; |
74 | uint8_t *yuv2rgb_cmap; | 74 | uint8_t *yuv2rgb_cmap; |
75 | yuv2rgb_factory_t *yuv2rgb_factory; | 75 | yuv2rgb_factory_t *yuv2rgb_factory; |
76 | 76 | ||
77 | vo_overlay_t *overlay; | 77 | vo_overlay_t *overlay; |
78 | vo_scale_t sc; | 78 | vo_scale_t sc; |
79 | 79 | ||
80 | int gui_width; | 80 | int gui_width; |
81 | int gui_height; | 81 | int gui_height; |
82 | int gui_changed; | 82 | int gui_changed; |
83 | 83 | ||
84 | double display_ratio; | 84 | double display_ratio; |
85 | void* caller; | 85 | void* caller; |
86 | display_xine_frame_t frameDis; | 86 | display_xine_frame_t frameDis; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | typedef struct opie_frame_s opie_frame_t; | 89 | typedef struct opie_frame_s opie_frame_t; |
90 | struct opie_frame_s { | 90 | struct opie_frame_s { |
91 | vo_frame_t frame; | 91 | vo_frame_t frame; |
92 | 92 | ||
93 | int format; | 93 | int format; |
94 | int flags; | 94 | int flags; |
95 | 95 | ||
96 | vo_scale_t sc; | 96 | vo_scale_t sc; |
97 | 97 | ||
98 | uint8_t *chunk[3]; | 98 | uint8_t *chunk[3]; |
99 | 99 | ||
100 | uint8_t *data; /* rgb */ | 100 | uint8_t *data; /* rgb */ |
101 | int bytes_per_line; | 101 | int bytes_per_line; |
102 | 102 | ||
103 | yuv2rgb_t *yuv2rgb; | 103 | yuv2rgb_t *yuv2rgb; |
104 | uint8_t *rgb_dst; | 104 | uint8_t *rgb_dst; |
105 | int yuv_stride; | 105 | int yuv_stride; |
106 | int stripe_height, stripe_inc; | 106 | int stripe_height, stripe_inc; |
107 | 107 | ||
108 | null_driver_t *output; | 108 | null_driver_t *output; |
109 | }; | 109 | }; |
110 | 110 | ||
111 | static uint32_t null_get_capabilities( vo_driver_t *self ){ | 111 | static uint32_t null_get_capabilities( vo_driver_t *self ){ |
112 | null_driver_t* this = (null_driver_t*)self; | 112 | null_driver_t* this = (null_driver_t*)self; |
113 | return this->m_capabilities; | 113 | return this->m_capabilities; |
114 | } | 114 | } |
115 | 115 | ||
116 | static void null_frame_copy (vo_frame_t *vo_img, uint8_t **src) { | 116 | static void null_frame_copy (vo_frame_t *vo_img, uint8_t **src) { |
117 | opie_frame_t *frame = (opie_frame_t *) vo_img ; | 117 | opie_frame_t *frame = (opie_frame_t *) vo_img ; |
118 | |||
119 | vo_img->copy_called = 1; | ||
118 | 120 | ||
119 | if (!frame->output->m_show_video) { | 121 | if (!frame->output->m_show_video) { |
120 | /* printf("nullvideo: no video\n"); */ | 122 | /* printf("nullvideo: no video\n"); */ |
121 | return; | 123 | return; |
122 | } | 124 | } |
123 | 125 | ||
124 | if (frame->format == XINE_IMGFMT_YV12) { | 126 | if (frame->format == XINE_IMGFMT_YV12) { |
125 | frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst, | 127 | frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst, |
126 | src[0], src[1], src[2]); | 128 | src[0], src[1], src[2]); |
127 | } else { | 129 | } else { |
128 | 130 | ||
129 | frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst, | 131 | frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst, |
130 | src[0]); | 132 | src[0]); |
131 | } | 133 | } |
132 | 134 | ||
133 | frame->rgb_dst += frame->stripe_inc; | 135 | frame->rgb_dst += frame->stripe_inc; |
134 | } | 136 | } |
135 | 137 | ||
136 | static void null_frame_field (vo_frame_t *vo_img, int which_field) { | 138 | static void null_frame_field (vo_frame_t *vo_img, int which_field) { |
137 | 139 | ||
138 | opie_frame_t *frame = (opie_frame_t *) vo_img ; | 140 | opie_frame_t *frame = (opie_frame_t *) vo_img ; |
139 | 141 | ||
140 | switch (which_field) { | 142 | switch (which_field) { |
141 | case VO_TOP_FIELD: | 143 | case VO_TOP_FIELD: |
142 | frame->rgb_dst = (uint8_t *)frame->data; | 144 | frame->rgb_dst = (uint8_t *)frame->data; |
143 | frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; | 145 | frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; |
144 | break; | 146 | break; |
145 | case VO_BOTTOM_FIELD: | 147 | case VO_BOTTOM_FIELD: |
146 | frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; | 148 | frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; |
147 | frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; | 149 | frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; |
148 | break; | 150 | break; |
149 | case VO_BOTH_FIELDS: | 151 | case VO_BOTH_FIELDS: |
150 | frame->rgb_dst = (uint8_t *)frame->data; | 152 | frame->rgb_dst = (uint8_t *)frame->data; |
151 | break; | 153 | break; |
152 | } | 154 | } |
153 | } | 155 | } |
154 | 156 | ||
155 | 157 | ||
156 | /* take care of the frame*/ | 158 | /* take care of the frame*/ |
157 | static void null_frame_dispose( vo_frame_t* vo_img){ | 159 | static void null_frame_dispose( vo_frame_t* vo_img){ |
158 | opie_frame_t* frame = (opie_frame_t*)vo_img; | 160 | opie_frame_t* frame = (opie_frame_t*)vo_img; |
159 | 161 | ||
160 | if (frame->data) | 162 | if (frame->data) |
161 | free( frame->data ); | 163 | free( frame->data ); |
162 | free (frame); | 164 | free (frame); |
163 | } | 165 | } |
164 | 166 | ||
165 | /* end take care of frames*/ | 167 | /* end take care of frames*/ |
diff --git a/noncore/multimedia/opieplayer2/yuv2rgb.c b/noncore/multimedia/opieplayer2/yuv2rgb.c index e8e86e6..8e34052 100644 --- a/noncore/multimedia/opieplayer2/yuv2rgb.c +++ b/noncore/multimedia/opieplayer2/yuv2rgb.c | |||
@@ -1162,101 +1162,101 @@ static void scale_line_1_2 (uint8_t *source, uint8_t *dest, | |||
1162 | 1162 | ||
1163 | if ((width += 4) <= 0) goto done; | 1163 | if ((width += 4) <= 0) goto done; |
1164 | *dest++ = source[0]; | 1164 | *dest++ = source[0]; |
1165 | if (--width <= 0) goto done; | 1165 | if (--width <= 0) goto done; |
1166 | *dest++ = (source[0] + source[1]) >> 1; | 1166 | *dest++ = (source[0] + source[1]) >> 1; |
1167 | if (--width <= 0) goto done; | 1167 | if (--width <= 0) goto done; |
1168 | *dest++ = source[1]; | 1168 | *dest++ = source[1]; |
1169 | done: | 1169 | done: |
1170 | 1170 | ||
1171 | xine_profiler_stop_count(prof_scale_line); | 1171 | xine_profiler_stop_count(prof_scale_line); |
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | 1174 | ||
1175 | /* | 1175 | /* |
1176 | * Scale line with no horizontal scaling. For NTSC mpeg2 dvd input in | 1176 | * Scale line with no horizontal scaling. For NTSC mpeg2 dvd input in |
1177 | * 4:3 output format (720x480 -> 720x540) | 1177 | * 4:3 output format (720x480 -> 720x540) |
1178 | */ | 1178 | */ |
1179 | static void scale_line_1_1 (uint8_t *source, uint8_t *dest, | 1179 | static void scale_line_1_1 (uint8_t *source, uint8_t *dest, |
1180 | int width, int step) { | 1180 | int width, int step) { |
1181 | 1181 | ||
1182 | xine_profiler_start_count(prof_scale_line); | 1182 | xine_profiler_start_count(prof_scale_line); |
1183 | xine_fast_memcpy(dest, source, width); | 1183 | xine_fast_memcpy(dest, source, width); |
1184 | xine_profiler_stop_count(prof_scale_line); | 1184 | xine_profiler_stop_count(prof_scale_line); |
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | 1187 | ||
1188 | static scale_line_func_t find_scale_line_func(int step) { | 1188 | static scale_line_func_t find_scale_line_func(int step) { |
1189 | static struct { | 1189 | static struct { |
1190 | int src_step; | 1190 | int src_step; |
1191 | int dest_step; | 1191 | int dest_step; |
1192 | scale_line_func_tfunc; | 1192 | scale_line_func_tfunc; |
1193 | char *desc; | 1193 | char *desc; |
1194 | } scale_line[] = { | 1194 | } scale_line[] = { |
1195 | { 15, 16, scale_line_15_16, "dvd 4:3(pal)" }, | 1195 | { 15, 16, scale_line_15_16, "dvd 4:3(pal)" }, |
1196 | { 45, 64, scale_line_45_64, "dvd 16:9(pal), fullscreen(1024x768)" }, | 1196 | { 45, 64, scale_line_45_64, "dvd 16:9(pal), fullscreen(1024x768)" }, |
1197 | { 9, 16, scale_line_9_16, "dvd fullscreen(1280x1024)" }, | 1197 | { 9, 16, scale_line_9_16, "dvd fullscreen(1280x1024)" }, |
1198 | { 45, 53, scale_line_45_53, "dvd 16:9(ntsc)" }, | 1198 | { 45, 53, scale_line_45_53, "dvd 16:9(ntsc)" }, |
1199 | { 11, 12, scale_line_11_12, "vcd 4:3(pal)" }, | 1199 | { 11, 12, scale_line_11_12, "vcd 4:3(pal)" }, |
1200 | { 11, 24, scale_line_11_24, "vcd 4:3(pal) 2*zoom" }, | 1200 | { 11, 24, scale_line_11_24, "vcd 4:3(pal) 2*zoom" }, |
1201 | { 5, 8, scale_line_5_8, "svcd 4:3(pal)" }, | 1201 | { 5, 8, scale_line_5_8, "svcd 4:3(pal)" }, |
1202 | { 3, 4, scale_line_3_4, "svcd 4:3(ntsc)" }, | 1202 | { 3, 4, scale_line_3_4, "svcd 4:3(ntsc)" }, |
1203 | { 1, 2, scale_line_1_2, "2*zoom" }, | 1203 | { 1, 2, scale_line_1_2, "2*zoom" }, |
1204 | { 1, 1, scale_line_1_1, "non-scaled" }, | 1204 | { 1, 1, scale_line_1_1, "non-scaled" }, |
1205 | }; | 1205 | }; |
1206 | int i; | 1206 | int i; |
1207 | 1207 | ||
1208 | for (i = 0; i < sizeof(scale_line)/sizeof(scale_line[0]); i++) { | 1208 | for (i = 0; i < sizeof(scale_line)/sizeof(scale_line[0]); i++) { |
1209 | if (step == scale_line[i].src_step*32768/scale_line[i].dest_step) { | 1209 | if (step == scale_line[i].src_step*32768/scale_line[i].dest_step) { |
1210 | printf("yuv2rgb: using %s optimized scale_line\n", scale_line[i].desc); | 1210 | //printf("yuv2rgb: using %s optimized scale_line\n", scale_line[i].desc); |
1211 | return scale_line[i].func; | 1211 | return scale_line[i].func; |
1212 | } | 1212 | } |
1213 | } | 1213 | } |
1214 | printf("yuv2rgb: using generic scale_line with interpolation\n"); | 1214 | //printf("yuv2rgb: using generic scale_line with interpolation\n"); |
1215 | return scale_line_gen; | 1215 | return scale_line_gen; |
1216 | 1216 | ||
1217 | } | 1217 | } |
1218 | 1218 | ||
1219 | 1219 | ||
1220 | static void scale_line_2 (uint8_t *source, uint8_t *dest, | 1220 | static void scale_line_2 (uint8_t *source, uint8_t *dest, |
1221 | int width, int step) { | 1221 | int width, int step) { |
1222 | int p1; | 1222 | int p1; |
1223 | int p2; | 1223 | int p2; |
1224 | int dx; | 1224 | int dx; |
1225 | 1225 | ||
1226 | p1 = *source; source+=2; | 1226 | p1 = *source; source+=2; |
1227 | p2 = *source; source+=2; | 1227 | p2 = *source; source+=2; |
1228 | dx = 0; | 1228 | dx = 0; |
1229 | 1229 | ||
1230 | while (width) { | 1230 | while (width) { |
1231 | 1231 | ||
1232 | *dest = (p1 * (32768 - dx) + p2 * dx) / 32768; | 1232 | *dest = (p1 * (32768 - dx) + p2 * dx) / 32768; |
1233 | 1233 | ||
1234 | dx += step; | 1234 | dx += step; |
1235 | while (dx > 32768) { | 1235 | while (dx > 32768) { |
1236 | dx -= 32768; | 1236 | dx -= 32768; |
1237 | p1 = p2; | 1237 | p1 = p2; |
1238 | p2 = *source; | 1238 | p2 = *source; |
1239 | source+=2; | 1239 | source+=2; |
1240 | } | 1240 | } |
1241 | 1241 | ||
1242 | dest ++; | 1242 | dest ++; |
1243 | width --; | 1243 | width --; |
1244 | } | 1244 | } |
1245 | } | 1245 | } |
1246 | 1246 | ||
1247 | static void scale_line_4 (uint8_t *source, uint8_t *dest, | 1247 | static void scale_line_4 (uint8_t *source, uint8_t *dest, |
1248 | int width, int step) { | 1248 | int width, int step) { |
1249 | int p1; | 1249 | int p1; |
1250 | int p2; | 1250 | int p2; |
1251 | int dx; | 1251 | int dx; |
1252 | 1252 | ||
1253 | p1 = *source; source+=4; | 1253 | p1 = *source; source+=4; |
1254 | p2 = *source; source+=4; | 1254 | p2 = *source; source+=4; |
1255 | dx = 0; | 1255 | dx = 0; |
1256 | 1256 | ||
1257 | while (width) { | 1257 | while (width) { |
1258 | 1258 | ||
1259 | *dest = (p1 * (32768 - dx) + p2 * dx) / 32768; | 1259 | *dest = (p1 * (32768 - dx) + p2 * dx) / 32768; |
1260 | 1260 | ||
1261 | dx += step; | 1261 | dx += step; |
1262 | while (dx > 32768) { | 1262 | while (dx > 32768) { |