Mercurial > mplayer.hg
annotate libmpcodecs/vd_svq1.c @ 7155:66019eb62edc
"halfpack" (yuv planar 4:2:0 -> packed 4:2:2, half height) video filter
(useful for downsampling luma for low-res output devices without
losing chroma samples, when hardware downscaling is poor quality or
unavailable)
author | rfelker |
---|---|
date | Fri, 30 Aug 2002 06:16:40 +0000 |
parents | 1e47c2e7aa8e |
children | 28677d779205 |
rev | line source |
---|---|
6506 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 | |
4 #include "config.h" | |
5 #include "mp_msg.h" | |
6 | |
7 #include "vd_internal.h" | |
8 | |
9 static vd_info_t info = { | |
10 "SVQ1 (Sorenson v1) Video decoder", | |
11 "svq1", | |
12 VFM_SVQ1, | |
13 "A'rpi", | |
14 "XINE team", | |
15 "native codec" | |
16 }; | |
17 | |
18 LIBVD_EXTERN(svq1) | |
19 | |
7127 | 20 #ifdef USE_LIBAVCODEC |
21 #ifdef USE_LIBAVCODEC_SO | |
22 #include <ffmpeg/avcodec.h> | |
23 #else | |
24 #include "libavcodec/avcodec.h" | |
25 #endif | |
26 #endif | |
27 | |
6506 | 28 #include "native/svq1.h" |
29 | |
30 // to set/get/query special features/parameters | |
31 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
32 return CONTROL_UNKNOWN; | |
33 } | |
34 | |
6509 | 35 extern int avcodec_inited; |
36 | |
6506 | 37 // init driver |
38 static int init(sh_video_t *sh){ | |
6509 | 39 |
40 #ifdef USE_LIBAVCODEC | |
41 if(!avcodec_inited){ | |
42 avcodec_init(); | |
43 avcodec_register_all(); | |
44 avcodec_inited=1; | |
45 } | |
46 #endif | |
47 | |
6506 | 48 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YVU9)) return 0; |
49 | |
50 sh->context=malloc(sizeof(svq1_t)); | |
51 memset(sh->context,0,sizeof(svq1_t)); | |
52 | |
53 return 1; | |
54 } | |
55 | |
56 // uninit driver | |
57 static void uninit(sh_video_t *sh){ | |
58 svq1_free(sh->context); | |
59 sh->context=NULL; | |
60 } | |
61 | |
62 // decode a frame | |
63 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ | |
64 mp_image_t* mpi; | |
65 svq1_t* svq1=sh->context; | |
66 int ret; | |
67 | |
68 if(len<=0) return NULL; // skipped frame | |
69 | |
6511
a2086150099b
use libavcodec's get_bits() code (optional, disabled by default)
arpi
parents:
6509
diff
changeset
|
70 ret=svq1_decode_frame(svq1,data,len); |
6521 | 71 if (ret != 0) |
72 return NULL; | |
6506 | 73 |
74 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE, | |
75 sh->disp_w, sh->disp_h); | |
76 if(!mpi) return NULL; | |
77 | |
78 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"SVQ1: ret=%d wh=%dx%d p=%p \n",ret,svq1->width,svq1->height,svq1->current); | |
79 | |
80 mpi->planes[0]=svq1->base[0]; | |
81 mpi->planes[1]=svq1->base[1]; | |
82 mpi->planes[2]=svq1->base[2]; | |
83 mpi->stride[0]=svq1->luma_width; | |
84 mpi->stride[1]=mpi->stride[2]=svq1->chroma_width; | |
85 | |
86 return mpi; | |
87 } | |
88 |