comparison libvo/vo_vdpau.c @ 29026:17e9f67f086b

Simplify vdpau deinterlacing code and fix timing for deint=2.
author cehoyos
date Wed, 25 Mar 2009 23:32:27 +0000
parents b04ff8b244bb
children d865fa57c316
comparison
equal deleted inserted replaced
29025:22d4bb6bf629 29026:17e9f67f086b
222 static void video_to_output_surface(void) 222 static void video_to_output_surface(void)
223 { 223 {
224 VdpTime dummy; 224 VdpTime dummy;
225 VdpStatus vdp_st; 225 VdpStatus vdp_st;
226 int i; 226 int i;
227 if (vid_surface_num < 0 || deint_surfaces[0] == VDP_INVALID_HANDLE) 227 if (vid_surface_num < 0)
228 return; 228 return;
229
230 if (deint < 2 || deint_surfaces[0] == VDP_INVALID_HANDLE)
231 push_deint_surface(surface_render[vid_surface_num].surface);
229 232
230 for (i = 0; i <= !!(deint > 1); i++) { 233 for (i = 0; i <= !!(deint > 1); i++) {
231 int field = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME; 234 int field = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME;
232 VdpOutputSurface output_surface; 235 VdpOutputSurface output_surface;
233 if (i) { 236 if (i) {
234 draw_eosd(); 237 draw_eosd();
235 draw_osd(); 238 draw_osd();
236 flip_page(); 239 flip_page();
237 push_deint_surface(surface_render[vid_surface_num].surface);
238 } 240 }
239 if (deint) 241 if (deint)
240 field = (top_field_first == i) ^ (deint > 2) ? 242 field = (top_field_first == i) ^ (deint > 1) ?
241 VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD: 243 VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD:
242 VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD; 244 VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD;
243 output_surface = output_surfaces[surface_num]; 245 output_surface = output_surfaces[surface_num];
244 vdp_st = vdp_presentation_queue_block_until_surface_idle(vdp_flip_queue, 246 vdp_st = vdp_presentation_queue_block_until_surface_idle(vdp_flip_queue,
245 output_surface, 247 output_surface,
252 1, &surface_render[vid_surface_num].surface, 254 1, &surface_render[vid_surface_num].surface,
253 &src_rect_vid, 255 &src_rect_vid,
254 output_surface, 256 output_surface,
255 NULL, &out_rect_vid, 0, NULL); 257 NULL, &out_rect_vid, 0, NULL);
256 CHECK_ST_WARNING("Error when calling vdp_video_mixer_render") 258 CHECK_ST_WARNING("Error when calling vdp_video_mixer_render")
259 push_deint_surface(surface_render[vid_surface_num].surface);
257 } 260 }
258 } 261 }
259 262
260 static void resize(void) 263 static void resize(void)
261 { 264 {
889 mpi->stride); // pitch 892 mpi->stride); // pitch
890 CHECK_ST_ERROR("Error when calling vdp_video_surface_put_bits_y_cb_cr") 893 CHECK_ST_ERROR("Error when calling vdp_video_surface_put_bits_y_cb_cr")
891 } 894 }
892 top_field_first = !!(mpi->fields & MP_IMGFIELD_TOP_FIRST); 895 top_field_first = !!(mpi->fields & MP_IMGFIELD_TOP_FIRST);
893 896
894 if (deint < 3)
895 deint_surfaces[0] = surface_render[vid_surface_num].surface;
896 video_to_output_surface(); 897 video_to_output_surface();
897 push_deint_surface(surface_render[vid_surface_num].surface);
898 return VO_TRUE; 898 return VO_TRUE;
899 } 899 }
900 900
901 static uint32_t get_image(mp_image_t *mpi) 901 static uint32_t get_image(mp_image_t *mpi)
902 { 902 {
1043 mp_msg(MSGT_VO, MSGL_FATAL, help_msg); 1043 mp_msg(MSGT_VO, MSGL_FATAL, help_msg);
1044 return -1; 1044 return -1;
1045 } 1045 }
1046 if (deint) 1046 if (deint)
1047 deint_type = deint; 1047 deint_type = deint;
1048 if (deint > 2) 1048 if (deint > 1)
1049 deint_buffer_past_frames = 1; 1049 deint_buffer_past_frames = 1;
1050 1050
1051 vdpau_lib_handle = dlopen(vdpaulibrary, RTLD_LAZY); 1051 vdpau_lib_handle = dlopen(vdpaulibrary, RTLD_LAZY);
1052 if (!vdpau_lib_handle) { 1052 if (!vdpau_lib_handle) {
1053 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Could not open dynamic library %s\n", 1053 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Could not open dynamic library %s\n",