annotate libmpcodecs/vf_rectangle.c @ 35659:321934456307

Remove confusing comment. At least IceWM nicely shows the size of the video as window size that way, and with width/height it would show 0/0 as window size which is neither natural nor preferable.
author ib
date Tue, 15 Jan 2013 18:27:22 +0000
parents 7af3e6f901fd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30421
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
1 /*
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
2 * This file is part of MPlayer.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
3 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
5 * it under the terms of the GNU General Public License as published by
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
7 * (at your option) any later version.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
8 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
12 * GNU General Public License for more details.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
13 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
14 * You should have received a copy of the GNU General Public License along
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
17 */
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
18
6820
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
19 #include <stdio.h>
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
20 #include <stdlib.h>
6887
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
21 #include <string.h>
6820
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
22 #include "mp_image.h"
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 11261
diff changeset
23 #include "mp_msg.h"
6820
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
24 #include "vf.h"
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
25
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 11261
diff changeset
26 #include "libvo/fastmemcpy.h"
21401
4a5045cd7c0c Cleanup and fix rectangle size calculation, caused crashes with e.g.
reimar
parents: 17906
diff changeset
27 #include "libavutil/common.h"
7127
1e47c2e7aa8e mostly compiler warning fixes, some small bugfix
arpi
parents: 6887
diff changeset
28
6820
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
29 struct vf_priv_s {
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
30 int x, y, w, h;
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
31 };
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
32
6887
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
33 static int
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
34 config(struct vf_instance *vf,
6887
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
35 int width, int height, int d_width, int d_height,
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
36 unsigned int flags, unsigned int outfmt)
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
37 {
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
38 if (vf->priv->w < 0 || width < vf->priv->w)
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
39 vf->priv->w = width;
6887
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
40 if (vf->priv->h < 0 || height < vf->priv->h)
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
41 vf->priv->h = height;
6887
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
42 if (vf->priv->x < 0)
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
43 vf->priv->x = (width - vf->priv->w) / 2;
6887
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
44 if (vf->priv->y < 0)
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
45 vf->priv->y = (height - vf->priv->h) / 2;
6887
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
46 if (vf->priv->w + vf->priv->x > width
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
47 || vf->priv->h + vf->priv->y > height) {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
48 mp_msg(MSGT_VFILTER,MSGL_WARN,"rectangle: bad position/width/height - rectangle area is out of the original!\n");
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
49 return 0;
6887
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
50 }
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
51 return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt);
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
52 }
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
53
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
54 static int
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
55 control(struct vf_instance *vf, int request, void *data)
6887
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
56 {
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
57 const int *const tmp = data;
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
58 switch(request){
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
59 case VFCTRL_CHANGE_RECTANGLE:
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
60 switch (tmp[0]){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
61 case 0:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
62 vf->priv->w += tmp[1];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
63 return 1;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
64 break;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
65 case 1:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
66 vf->priv->h += tmp[1];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
67 return 1;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
68 break;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
69 case 2:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
70 vf->priv->x += tmp[1];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
71 return 1;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
72 break;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
73 case 3:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
74 vf->priv->y += tmp[1];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
75 return 1;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
76 break;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
77 default:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
78 mp_msg(MSGT_VFILTER,MSGL_FATAL,"Unknown param %d \n", tmp[0]);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
79 return 0;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
80 }
6887
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
81 }
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
82 return vf_next_control(vf, request, data);
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
83 return 0;
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
84 }
7368
a894e99c1e51 changing return type of put_image void->int
arpi
parents: 7127
diff changeset
85 static int
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
86 put_image(struct vf_instance *vf, mp_image_t* mpi, double pts){
6820
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
87 mp_image_t* dmpi;
8737
8fd62b14cbc0 better image/plane copy
arpi
parents: 7739
diff changeset
88 unsigned int bpp = mpi->bpp / 8;
21401
4a5045cd7c0c Cleanup and fix rectangle size calculation, caused crashes with e.g.
reimar
parents: 17906
diff changeset
89 int x, y, w, h;
6887
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
90 dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_TEMP,
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
91 MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
92 mpi->w, mpi->h);
8737
8fd62b14cbc0 better image/plane copy
arpi
parents: 7739
diff changeset
93
8fd62b14cbc0 better image/plane copy
arpi
parents: 7739
diff changeset
94 memcpy_pic(dmpi->planes[0],mpi->planes[0],mpi->w*bpp, mpi->h,
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
95 dmpi->stride[0],mpi->stride[0]);
8737
8fd62b14cbc0 better image/plane copy
arpi
parents: 7739
diff changeset
96 if(mpi->flags&MP_IMGFLAG_PLANAR && mpi->flags&MP_IMGFLAG_YUV){
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
97 memcpy_pic(dmpi->planes[1],mpi->planes[1],
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
98 mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
99 dmpi->stride[1],mpi->stride[1]);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
100 memcpy_pic(dmpi->planes[2],mpi->planes[2],
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
101 mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
102 dmpi->stride[2],mpi->stride[2]);
8737
8fd62b14cbc0 better image/plane copy
arpi
parents: 7739
diff changeset
103 }
6820
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
104
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
105 /* Draw the rectangle */
6887
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
106
11261
835822ce4bb1 -vop ---> -vf
diego
parents: 9593
diff changeset
107 mp_msg(MSGT_VFILTER,MSGL_INFO, "rectangle: -vf rectangle=%d:%d:%d:%d \n", vf->priv->w, vf->priv->h, vf->priv->x, vf->priv->y);
6887
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
108
21401
4a5045cd7c0c Cleanup and fix rectangle size calculation, caused crashes with e.g.
reimar
parents: 17906
diff changeset
109 x = FFMIN(vf->priv->x, dmpi->width);
4a5045cd7c0c Cleanup and fix rectangle size calculation, caused crashes with e.g.
reimar
parents: 17906
diff changeset
110 x = FFMAX(x, 0);
4a5045cd7c0c Cleanup and fix rectangle size calculation, caused crashes with e.g.
reimar
parents: 17906
diff changeset
111
4a5045cd7c0c Cleanup and fix rectangle size calculation, caused crashes with e.g.
reimar
parents: 17906
diff changeset
112 w = vf->priv->x + vf->priv->w - 1 - x;
4a5045cd7c0c Cleanup and fix rectangle size calculation, caused crashes with e.g.
reimar
parents: 17906
diff changeset
113 w = FFMIN(w, dmpi->width - x);
4a5045cd7c0c Cleanup and fix rectangle size calculation, caused crashes with e.g.
reimar
parents: 17906
diff changeset
114 w = FFMAX(w, 0);
4a5045cd7c0c Cleanup and fix rectangle size calculation, caused crashes with e.g.
reimar
parents: 17906
diff changeset
115
4a5045cd7c0c Cleanup and fix rectangle size calculation, caused crashes with e.g.
reimar
parents: 17906
diff changeset
116 y = FFMIN(vf->priv->y, dmpi->height);
4a5045cd7c0c Cleanup and fix rectangle size calculation, caused crashes with e.g.
reimar
parents: 17906
diff changeset
117 y = FFMAX(y, 0);
4a5045cd7c0c Cleanup and fix rectangle size calculation, caused crashes with e.g.
reimar
parents: 17906
diff changeset
118
4a5045cd7c0c Cleanup and fix rectangle size calculation, caused crashes with e.g.
reimar
parents: 17906
diff changeset
119 h = vf->priv->y + vf->priv->h - 1 - y;
4a5045cd7c0c Cleanup and fix rectangle size calculation, caused crashes with e.g.
reimar
parents: 17906
diff changeset
120 h = FFMIN(h, dmpi->height - y);
4a5045cd7c0c Cleanup and fix rectangle size calculation, caused crashes with e.g.
reimar
parents: 17906
diff changeset
121 h = FFMAX(h, 0);
6887
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
122
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
123 if (0 <= vf->priv->y && vf->priv->y <= dmpi->height) {
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
124 unsigned char *p = dmpi->planes[0] + y * dmpi->stride[0] + x * bpp;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
125 unsigned int count = w * bpp;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
126 while (count--)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
127 p[count] = 0xff - p[count];
6887
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
128 }
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
129 if (h != 1 && vf->priv->y + vf->priv->h - 1 <= mpi->height) {
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
130 unsigned char *p = dmpi->planes[0] + (vf->priv->y + vf->priv->h - 1) * dmpi->stride[0] + x * bpp;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
131 unsigned int count = w * bpp;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
132 while (count--)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
133 p[count] = 0xff - p[count];
6887
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
134 }
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
135 if (0 <= vf->priv->x && vf->priv->x <= dmpi->width) {
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
136 unsigned char *p = dmpi->planes[0] + y * dmpi->stride[0] + x * bpp;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
137 unsigned int count = h;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
138 while (count--) {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
139 unsigned int i = bpp;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
140 while (i--)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
141 p[i] = 0xff - p[i];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
142 p += dmpi->stride[0];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
143 }
6820
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
144 }
6887
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
145 if (w != 1 && vf->priv->x + vf->priv->w - 1 <= mpi->width) {
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
146 unsigned char *p = dmpi->planes[0] + y * dmpi->stride[0] + (vf->priv->x + vf->priv->w - 1) * bpp;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
147 unsigned int count = h;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
148 while (count--) {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
149 unsigned int i = bpp;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
150 while (i--)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
151 p[i] = 0xff - p[i];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
152 p += dmpi->stride[0];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
153 }
6820
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
154 }
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17012
diff changeset
155 return vf_next_put_image(vf, dmpi, pts);
6820
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
156 }
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
157
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
158 static int
30638
a7b908875c14 Rename open() vf initialization function to vf_open().
diego
parents: 30421
diff changeset
159 vf_open(vf_instance_t *vf, char *args) {
6887
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
160 vf->config = config;
66427e850216 Add the control VFCTRL_CHANGE_RECTANGLE
kmkaplan
parents: 6820
diff changeset
161 vf->control = control;
6820
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
162 vf->put_image = put_image;
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
163 vf->priv = malloc(sizeof(struct vf_priv_s));
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
164 vf->priv->x = -1;
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
165 vf->priv->y = -1;
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
166 vf->priv->w = -1;
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
167 vf->priv->h = -1;
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
168 if (args)
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
169 sscanf(args, "%d:%d:%d:%d",
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
170 &vf->priv->w, &vf->priv->h, &vf->priv->x, &vf->priv->y);
6820
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
171 return 1;
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
172 }
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
173
25221
00fff9a3b735 Make all vf_info_t structs const
reimar
parents: 21401
diff changeset
174 const vf_info_t vf_info_rectangle = {
6820
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
175 "draw rectangle",
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
176 "rectangle",
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
177 "Kim Minh Kaplan",
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
178 "",
30638
a7b908875c14 Rename open() vf initialization function to vf_open().
diego
parents: 30421
diff changeset
179 vf_open,
9593
e9a2af584986 Add the new -vf option wich is the same as vop in reverse order.
albeu
parents: 8737
diff changeset
180 NULL
6820
a99c7700e4f1 New plugin to test crop parameters. Arguments are the same as for the
kmkaplan
parents:
diff changeset
181 };