annotate libmpcodecs/vd_libdv.c @ 7016:44ce5a673be2

added gettimeofday-based profiling/timing little speedup of outline()
author arpi
date Thu, 15 Aug 2002 20:50:13 +0000
parents 0145bba6e201
children 28677d779205
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6927
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
1 #include <stdio.h>
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
2 #include <stdlib.h>
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
3 #include <string.h>
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
4 #include <sys/types.h>
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
5 #include <unistd.h>
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
6 #include <math.h>
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
7
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
8 #include "config.h"
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
9
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
10 #ifdef HAVE_LIBDV095
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
11
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
12 #include "img_format.h"
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
13
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
14 #include <libdv/dv.h>
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
15 #include <libdv/dv_types.h>
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
16
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
17 #include "stream.h"
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
18 #include "demuxer.h"
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
19 #include "stheader.h"
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
20
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
21 #include "vd_internal.h"
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
22
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
23 static vd_info_t info =
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
24 {
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
25 "Raw DV Video Decoder",
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
26 "libdv",
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
27 VFM_LIBDV,
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
28 "Alexander Neundorf <neundorf@kde.org>",
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
29 "http://libdv.sf.net",
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
30 ""
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
31 };
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
32
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
33 LIBVD_EXTERN(libdv)
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
34
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
35 // to set/get/query special features/parameters
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
36 static int control(sh_video_t *sh,int cmd,void* arg,...){
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
37 return CONTROL_UNKNOWN;
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
38 }
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
39
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
40 static dv_decoder_t* global_rawdv_decoder=NULL;
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
41
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
42 dv_decoder_t* init_global_rawdv_decoder()
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
43 {
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
44 if(!global_rawdv_decoder){
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
45 global_rawdv_decoder=dv_decoder_new(TRUE,TRUE,FALSE);
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
46 global_rawdv_decoder->quality=DV_QUALITY_BEST;
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
47 global_rawdv_decoder->prev_frame_decoded = 0;
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
48 }
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
49 return global_rawdv_decoder;
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
50 }
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
51
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
52 // init driver
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
53 static int init(sh_video_t *sh)
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
54 {
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
55 sh->context = (void *)init_global_rawdv_decoder();
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
56 return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2);
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
57 }
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
58
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
59 // uninit driver
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
60 static void uninit(sh_video_t *sh){
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
61 }
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
62
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
63 // decode a frame
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
64 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags)
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
65 {
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
66 mp_image_t* mpi;
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
67 dv_decoder_t *decoder=sh->context;
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
68
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
69 if(len<=0 || (flags&3)){
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
70 // fprintf(stderr,"decode() (rawdv) SKIPPED\n");
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
71 return NULL; // skipped frame
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
72 }
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
73
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
74 dv_parse_header(decoder, data);
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
75
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
76 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, sh->disp_w, sh->disp_h);
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
77
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
78 if(!mpi){ // temporary!
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
79 fprintf(stderr,"couldn't allocate image for stderr codec\n");
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
80 return NULL;
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
81 }
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
82
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
83 dv_decode_full_frame(decoder, data, e_dv_color_yuv, mpi->planes, mpi->stride);
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
84
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
85 return mpi;
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
86 }
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
87 #endif
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
88