annotate libmpcodecs/vf_flip.c @ 10267:d953763cc555

libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>: Make sure that altivec gets enabled in libmpeg2
author arpi
date Mon, 09 Jun 2003 12:10:42 +0000
parents 7d6a854a5fe5
children 05aa13cdf92f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
1 #include <stdio.h>
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
2 #include <stdlib.h>
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
3 #include <string.h>
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
4
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
5 #include "../config.h"
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
6 #include "../mp_msg.h"
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
7
5607
1972c3475d93 mp_image.h and img_format.h moved to libmpcodecs
arpi
parents: 5565
diff changeset
8 #include "mp_image.h"
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
9 #include "vf.h"
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
10
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
11
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
12 //===========================================================================//
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
13
6137
6253fc19afb1 do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents: 5691
diff changeset
14 static int config(struct vf_instance_s* vf,
6253fc19afb1 do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents: 5691
diff changeset
15 int width, int height, int d_width, int d_height,
6253fc19afb1 do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents: 5691
diff changeset
16 unsigned int flags, unsigned int outfmt){
6253fc19afb1 do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents: 5691
diff changeset
17 flags&=~8; // remove the FLIP flag
6253fc19afb1 do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents: 5691
diff changeset
18 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
6253fc19afb1 do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents: 5691
diff changeset
19 }
6253fc19afb1 do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents: 5691
diff changeset
20
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
21 static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
22 if(mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE){
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
23 // try full DR !
10141
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
24 vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
25 mpi->type, mpi->flags, mpi->width, mpi->height);
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
26 // set up mpi as a upside-down image of dmpi:
10141
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
27 mpi->planes[0]=vf->dmpi->planes[0]+
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
28 vf->dmpi->stride[0]*(vf->dmpi->height-1);
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
29 mpi->stride[0]=-vf->dmpi->stride[0];
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
30 if(mpi->flags&MP_IMGFLAG_PLANAR){
10141
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
31 mpi->planes[1]=vf->dmpi->planes[1]+
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
32 vf->dmpi->stride[1]*((vf->dmpi->height>>mpi->chroma_y_shift)-1);
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
33 mpi->stride[1]=-vf->dmpi->stride[1];
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
34 mpi->planes[2]=vf->dmpi->planes[2]+
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
35 vf->dmpi->stride[2]*((vf->dmpi->height>>mpi->chroma_y_shift)-1);
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
36 mpi->stride[2]=-vf->dmpi->stride[2];
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
37 }
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
38 mpi->flags|=MP_IMGFLAG_DIRECT;
10141
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
39 mpi->priv=(void*)vf->dmpi;
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
40 }
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
41 }
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
42
7368
a894e99c1e51 changing return type of put_image void->int
arpi
parents: 7258
diff changeset
43 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
44 if(mpi->flags&MP_IMGFLAG_DIRECT){
7368
a894e99c1e51 changing return type of put_image void->int
arpi
parents: 7258
diff changeset
45 // we've used DR, so we're ready...
9279
12741a866acd fixed palette support
arpi
parents: 8126
diff changeset
46 if(!(mpi->flags&MP_IMGFLAG_PLANAR))
12741a866acd fixed palette support
arpi
parents: 8126
diff changeset
47 ((mp_image_t*)mpi->priv)->planes[1] = mpi->planes[1]; // passthrough rgb8 palette
8126
62d00d1c624e Fix IPB DR
albeu
parents: 7368
diff changeset
48 return vf_next_put_image(vf,(mp_image_t*)mpi->priv);
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
49 }
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
50
10141
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
51 vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
5691
arpi
parents: 5607
diff changeset
52 MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
53 mpi->width, mpi->height);
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
54
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
55 // set up mpi as a upside-down image of dmpi:
10141
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
56 vf->dmpi->planes[0]=mpi->planes[0]+
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
57 mpi->stride[0]*(mpi->height-1);
10141
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
58 vf->dmpi->stride[0]=-mpi->stride[0];
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
59 if(vf->dmpi->flags&MP_IMGFLAG_PLANAR){
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
60 vf->dmpi->planes[1]=mpi->planes[1]+
6539
79b536a37e40 better planar support, chroma subsampling support and Y8/Y800 support
alex
parents: 6137
diff changeset
61 mpi->stride[1]*((mpi->height>>mpi->chroma_y_shift)-1);
10141
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
62 vf->dmpi->stride[1]=-mpi->stride[1];
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
63 vf->dmpi->planes[2]=mpi->planes[2]+
6539
79b536a37e40 better planar support, chroma subsampling support and Y8/Y800 support
alex
parents: 6137
diff changeset
64 mpi->stride[2]*((mpi->height>>mpi->chroma_y_shift)-1);
10141
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
65 vf->dmpi->stride[2]=-mpi->stride[2];
7258
2a96fbce0848 bgr8 palette fixed
arpi
parents: 6539
diff changeset
66 } else
10141
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
67 vf->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!!
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
68
10141
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9593
diff changeset
69 return vf_next_put_image(vf,vf->dmpi);
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
70 }
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
71
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
72 //===========================================================================//
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
73
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
74 static int open(vf_instance_t *vf, char* args){
6137
6253fc19afb1 do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents: 5691
diff changeset
75 vf->config=config;
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
76 vf->get_image=get_image;
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
77 vf->put_image=put_image;
5565
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5557
diff changeset
78 vf->default_reqs=VFCAP_ACCEPT_STRIDE;
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
79 return 1;
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
80 }
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
81
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
82 vf_info_t vf_info_flip = {
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
83 "flip image upside-down",
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
84 "flip",
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
85 "A'rpi",
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
86 "",
9593
e9a2af584986 Add the new -vf option wich is the same as vop in reverse order.
albeu
parents: 9279
diff changeset
87 open,
e9a2af584986 Add the new -vf option wich is the same as vop in reverse order.
albeu
parents: 9279
diff changeset
88 NULL
5557
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
89 };
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
90
2d0b4090497f new filter: flip
arpi
parents:
diff changeset
91 //===========================================================================//