Mercurial > mplayer.hg
annotate libmpcodecs/vf_mirror.c @ 7579:24860f7c716f
change i18n to autodetect
author | pontscho |
---|---|
date | Wed, 02 Oct 2002 09:24:34 +0000 |
parents | a894e99c1e51 |
children | 30f7df2d1bed |
rev | line source |
---|---|
5763 | 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 static void mirror(unsigned char* dst,unsigned char* src,int dststride,int srcstride,int w,int h,int bpp){ | |
5772 | 18 int y; |
19 for(y=0;y<h;y++){ | |
20 int x; | |
5763 | 21 switch(bpp){ |
22 case 1: | |
5772 | 23 for(x=0;x<w;x++) dst[x]=src[w-x-1]; |
5763 | 24 break; |
25 case 2: | |
5772 | 26 for(x=0;x<w;x++) *((short*)(dst+x*2))=*((short*)(src+(w-x-1)*2)); |
5763 | 27 break; |
28 case 3: | |
5772 | 29 for(x=0;x<w;x++){ |
30 dst[x*3+0]=src[0+(w-x-1)*3]; | |
31 dst[x*3+1]=src[1+(w-x-1)*3]; | |
32 dst[x*3+2]=src[2+(w-x-1)*3]; | |
5763 | 33 } |
34 break; | |
35 case 4: | |
5772 | 36 for(x=0;x<w;x++) *((int*)(dst+x*4))=*((int*)(src+(w-x-1)*4)); |
5763 | 37 } |
5772 | 38 src+=srcstride; |
5763 | 39 dst+=dststride; |
40 } | |
41 } | |
42 | |
43 //===========================================================================// | |
44 | |
7368 | 45 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){ |
5763 | 46 mp_image_t *dmpi; |
47 | |
48 // hope we'll get DR buffer: | |
49 dmpi=vf_get_image(vf->next,mpi->imgfmt, | |
50 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, | |
51 mpi->w, mpi->h); | |
52 | |
53 if(mpi->flags&MP_IMGFLAG_PLANAR){ | |
54 mirror(dmpi->planes[0],mpi->planes[0], | |
55 dmpi->stride[0],mpi->stride[0], | |
56 dmpi->w,dmpi->h,1); | |
57 mirror(dmpi->planes[1],mpi->planes[1], | |
58 dmpi->stride[1],mpi->stride[1], | |
6539
79b536a37e40
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
5772
diff
changeset
|
59 dmpi->w>>mpi->chroma_x_shift,dmpi->h>>mpi->chroma_y_shift,1); |
5763 | 60 mirror(dmpi->planes[2],mpi->planes[2], |
61 dmpi->stride[2],mpi->stride[2], | |
6539
79b536a37e40
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
5772
diff
changeset
|
62 dmpi->w>>mpi->chroma_x_shift,dmpi->h>>mpi->chroma_y_shift,1); |
5763 | 63 } else { |
64 mirror(dmpi->planes[0],mpi->planes[0], | |
65 dmpi->stride[0],mpi->stride[0], | |
66 dmpi->w,dmpi->h,dmpi->bpp>>3); | |
67 } | |
68 | |
7368 | 69 return vf_next_put_image(vf,dmpi); |
5763 | 70 } |
71 | |
72 //===========================================================================// | |
73 | |
74 static int open(vf_instance_t *vf, char* args){ | |
75 //vf->config=config; | |
76 vf->put_image=put_image; | |
77 return 1; | |
78 } | |
79 | |
80 vf_info_t vf_info_mirror = { | |
5772 | 81 "horizontal mirror", |
5763 | 82 "mirror", |
83 "Eyck", | |
84 "", | |
85 open | |
86 }; | |
87 | |
88 //===========================================================================// |