comparison libmpcodecs/vf_yvu9.c @ 6485:52563321dc78

yvu9toyv12 converter
author alex
date Fri, 21 Jun 2002 17:37:30 +0000
parents
children 11c0ddb83168
comparison
equal deleted inserted replaced
6484:c5cf988c6d6f 6485:52563321dc78
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <inttypes.h>
5
6 #include "../config.h"
7 #include "../mp_msg.h"
8
9 #include "img_format.h"
10 #include "mp_image.h"
11 #include "vf.h"
12
13 #include "../libvo/fastmemcpy.h"
14 #include "../postproc/rgb2rgb.h"
15
16 //===========================================================================//
17
18 static int config(struct vf_instance_s* vf,
19 int width, int height, int d_width, int d_height,
20 unsigned int flags, unsigned int outfmt){
21
22 if(vf_next_query_format(vf,IMGFMT_YV12)<=0){
23 printf("yv12 not supported by next filter/vo :(\n");
24 return 0;
25 }
26
27 return vf_next_config(vf,width,height,d_width,d_height,flags,IMGFMT_YV12);
28 }
29
30 static void put_image(struct vf_instance_s* vf, mp_image_t *mpi){
31 mp_image_t *dmpi;
32
33 // hope we'll get DR buffer:
34 dmpi=vf_get_image(vf->next,IMGFMT_YV12,
35 MP_IMGTYPE_TEMP, 0/*MP_IMGFLAG_ACCEPT_STRIDE*/,
36 mpi->w, mpi->h);
37
38 yvu9toyv12(mpi->planes[0],mpi->planes[1],mpi->planes[2],
39 dmpi->planes[0], dmpi->planes[1], dmpi->planes[2], mpi->w, mpi->h,
40 dmpi->stride[0], dmpi->stride[1]);
41
42 dmpi->qscale=mpi->qscale;
43 dmpi->qstride=mpi->qstride;
44
45 vf_next_put_image(vf,dmpi);
46 }
47
48 //===========================================================================//
49
50 static int query_format(struct vf_instance_s* vf, unsigned int fmt){
51 if (fmt == IMGFMT_YVU9)
52 return vf_next_query_format(vf,IMGFMT_YV12) & (~VFCAP_CSP_SUPPORTED_BY_HW);
53 return 0;
54 }
55
56 static int open(vf_instance_t *vf, char* args){
57 vf->config=config;
58 vf->put_image=put_image;
59 vf->query_format=query_format;
60 return 1;
61 }
62
63 vf_info_t vf_info_yvu9 = {
64 "fast YVU9->YV12 conversion",
65 "yvu9",
66 "alex",
67 "",
68 open
69 };
70
71 //===========================================================================//