annotate libmpcodecs/vd_svq1.c @ 6506:f0788e0f7475

SVQ1 added
author arpi
date Sat, 22 Jun 2002 23:09:40 +0000
parents
children 762d3cf8da36
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6506
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
1 #include <stdio.h>
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
2 #include <stdlib.h>
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
3
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
4 #include "config.h"
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
5 #include "mp_msg.h"
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
6
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
7 #include "vd_internal.h"
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
8
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
9 static vd_info_t info = {
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
10 "SVQ1 (Sorenson v1) Video decoder",
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
11 "svq1",
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
12 VFM_SVQ1,
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
13 "A'rpi",
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
14 "XINE team",
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
15 "native codec"
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
16 };
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
17
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
18 LIBVD_EXTERN(svq1)
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
19
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
20 #include "native/svq1.h"
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
21
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
22 // to set/get/query special features/parameters
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
23 static int control(sh_video_t *sh,int cmd,void* arg,...){
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
24 return CONTROL_UNKNOWN;
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
25 }
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
26
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
27 // init driver
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
28 static int init(sh_video_t *sh){
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
29 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YVU9)) return 0;
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
30
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
31 sh->context=malloc(sizeof(svq1_t));
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
32 memset(sh->context,0,sizeof(svq1_t));
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
33
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
34 return 1;
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
35 }
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
36
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
37 // uninit driver
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
38 static void uninit(sh_video_t *sh){
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
39 svq1_free(sh->context);
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
40 sh->context=NULL;
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
41 }
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
42
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
43 // decode a frame
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
44 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
45 mp_image_t* mpi;
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
46 svq1_t* svq1=sh->context;
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
47 int ret;
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
48
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
49 if(len<=0) return NULL; // skipped frame
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
50
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
51 ret=svq1_decode_frame(svq1,data);
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
52
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
53 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE,
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
54 sh->disp_w, sh->disp_h);
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
55 if(!mpi) return NULL;
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
56
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
57 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"SVQ1: ret=%d wh=%dx%d p=%p \n",ret,svq1->width,svq1->height,svq1->current);
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
58
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
59 mpi->planes[0]=svq1->base[0];
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
60 mpi->planes[1]=svq1->base[1];
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
61 mpi->planes[2]=svq1->base[2];
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
62 mpi->stride[0]=svq1->luma_width;
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
63 mpi->stride[1]=mpi->stride[2]=svq1->chroma_width;
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
64
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
65 return mpi;
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
66 }
f0788e0f7475 SVQ1 added
arpi
parents:
diff changeset
67