Mercurial > mplayer.hg
annotate libmpcodecs/vf_tinterlace.c @ 18889:e60c8c7399d2
get_path as const, patch by Stefan Huehner, stefan AT huehner-org
author | reynaldo |
---|---|
date | Mon, 03 Jul 2006 23:27:37 +0000 |
parents | d1c6b9abbc73 |
children | a124f3abc1ec |
rev | line source |
---|---|
10571
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
1 /* |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
2 Copyright (C) 2003 Michael Zucchi <notzed@ximian.com> |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
3 |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
4 This program is free software; you can redistribute it and/or modify |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
5 it under the terms of the GNU General Public License as published by |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
6 the Free Software Foundation; either version 2 of the License, or |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
7 (at your option) any later version. |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
8 |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
9 This program is distributed in the hope that it will be useful, |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
12 GNU General Public License for more details. |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
13 |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
14 You should have received a copy of the GNU General Public License |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
15 along with this program; if not, write to the Free Software |
17367
401b440a6d76
Update licensing information: The FSF changed postal address.
diego
parents:
17012
diff
changeset
|
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
10571
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
17 */ |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
18 |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
19 #include <stdio.h> |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
20 #include <stdlib.h> |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
21 #include <string.h> |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
22 |
17012 | 23 #include "config.h" |
24 #include "mp_msg.h" | |
10571
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
25 |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
26 #include "img_format.h" |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
27 #include "mp_image.h" |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
28 #include "vf.h" |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
29 |
17012 | 30 #include "libvo/fastmemcpy.h" |
10571
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
31 |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
32 struct vf_priv_s { |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
33 int mode; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
34 int frame; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
35 mp_image_t *dmpi; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
36 }; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
37 |
18055 | 38 // Copied verbatim from vf_telecine.c: |
39 static inline void *my_memcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride) | |
40 { | |
41 int i; | |
42 void *retval=dst; | |
43 | |
44 for(i=0; i<height; i++) | |
45 { | |
46 memcpy(dst, src, bytesPerLine); | |
47 src+= srcStride; | |
48 dst+= dstStride; | |
49 } | |
50 | |
51 return retval; | |
52 } | |
53 | |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17367
diff
changeset
|
54 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts) |
10571
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
55 { |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
56 int ret = 0; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
57 mp_image_t *dmpi; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
58 |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
59 switch (vf->priv->mode) { |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
60 case 0: |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
61 dmpi = vf->priv->dmpi; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
62 if (dmpi == NULL) { |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
63 dmpi = vf_get_image(vf->next, mpi->imgfmt, |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
64 MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | |
16137
23b7f5476b61
we do not read from dmpi, so it doesn't have to be readable
reimar
parents:
10571
diff
changeset
|
65 MP_IMGFLAG_PRESERVE, |
10571
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
66 mpi->width, mpi->height*2); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
67 |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
68 vf->priv->dmpi = dmpi; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
69 |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
70 memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
71 dmpi->stride[0]*2, mpi->stride[0]); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
72 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
73 memcpy_pic(dmpi->planes[1], mpi->planes[1], |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
74 mpi->chroma_width, mpi->chroma_height, |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
75 dmpi->stride[1]*2, mpi->stride[1]); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
76 memcpy_pic(dmpi->planes[2], mpi->planes[2], |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
77 mpi->chroma_width, mpi->chroma_height, |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
78 dmpi->stride[2]*2, mpi->stride[2]); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
79 } |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
80 } else { |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
81 vf->priv->dmpi = NULL; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
82 |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
83 memcpy_pic(dmpi->planes[0]+dmpi->stride[0], mpi->planes[0], mpi->w, mpi->h, |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
84 dmpi->stride[0]*2, mpi->stride[0]); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
85 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
86 memcpy_pic(dmpi->planes[1]+dmpi->stride[1], mpi->planes[1], |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
87 mpi->chroma_width, mpi->chroma_height, |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
88 dmpi->stride[1]*2, mpi->stride[1]); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
89 memcpy_pic(dmpi->planes[2]+dmpi->stride[2], mpi->planes[2], |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
90 mpi->chroma_width, mpi->chroma_height, |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
91 dmpi->stride[2]*2, mpi->stride[2]); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
92 } |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17367
diff
changeset
|
93 ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); |
10571
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
94 } |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
95 break; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
96 case 1: |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
97 if (vf->priv->frame & 1) |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17367
diff
changeset
|
98 ret = vf_next_put_image(vf, mpi, MP_NOPTS_VALUE); |
10571
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
99 break; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
100 case 2: |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
101 if ((vf->priv->frame & 1) == 0) |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17367
diff
changeset
|
102 ret = vf_next_put_image(vf, mpi, MP_NOPTS_VALUE); |
10571
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
103 break; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
104 case 3: |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
105 dmpi = vf_get_image(vf->next, mpi->imgfmt, |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
106 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
107 mpi->width, mpi->height*2); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
108 /* fixme, just clear alternate lines */ |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
109 vf_mpi_clear(dmpi, 0, 0, dmpi->w, dmpi->h); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
110 if ((vf->priv->frame & 1) == 0) { |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
111 memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
112 dmpi->stride[0]*2, mpi->stride[0]); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
113 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
114 memcpy_pic(dmpi->planes[1], mpi->planes[1], |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
115 mpi->chroma_width, mpi->chroma_height, |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
116 dmpi->stride[1]*2, mpi->stride[1]); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
117 memcpy_pic(dmpi->planes[2], mpi->planes[2], |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
118 mpi->chroma_width, mpi->chroma_height, |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
119 dmpi->stride[2]*2, mpi->stride[2]); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
120 } |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
121 } else { |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
122 memcpy_pic(dmpi->planes[0]+dmpi->stride[0], mpi->planes[0], mpi->w, mpi->h, |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
123 dmpi->stride[0]*2, mpi->stride[0]); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
124 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
125 memcpy_pic(dmpi->planes[1]+dmpi->stride[1], mpi->planes[1], |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
126 mpi->chroma_width, mpi->chroma_height, |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
127 dmpi->stride[1]*2, mpi->stride[1]); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
128 memcpy_pic(dmpi->planes[2]+dmpi->stride[2], mpi->planes[2], |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
129 mpi->chroma_width, mpi->chroma_height, |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
130 dmpi->stride[2]*2, mpi->stride[2]); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
131 } |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
132 } |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17367
diff
changeset
|
133 ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); |
10571
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
134 break; |
18055 | 135 case 4: |
136 // Interleave even lines (only) from Frame 'i' with odd | |
137 // lines (only) from Frame 'i+1', halving the Frame | |
138 // rate and preserving image height. | |
139 | |
140 dmpi = vf->priv->dmpi; | |
141 | |
142 // @@ Need help: Should I set dmpi->fields to indicate | |
143 // that the (new) frame will be interlaced!? E.g. ... | |
144 // dmpi->fields |= MP_IMGFIELD_INTERLACED; | |
145 // dmpi->fields |= MP_IMGFIELD_TOP_FIRST; | |
146 // etc. | |
147 | |
148 if (dmpi == NULL) { | |
149 dmpi = vf_get_image(vf->next, mpi->imgfmt, | |
150 MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | | |
151 MP_IMGFLAG_PRESERVE, | |
152 mpi->width, mpi->height); | |
153 | |
154 vf->priv->dmpi = dmpi; | |
155 | |
156 my_memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h/2, | |
157 dmpi->stride[0]*2, mpi->stride[0]*2); | |
158 if (mpi->flags & MP_IMGFLAG_PLANAR) { | |
159 my_memcpy_pic(dmpi->planes[1], mpi->planes[1], | |
160 mpi->chroma_width, mpi->chroma_height/2, | |
161 dmpi->stride[1]*2, mpi->stride[1]*2); | |
162 my_memcpy_pic(dmpi->planes[2], mpi->planes[2], | |
163 mpi->chroma_width, mpi->chroma_height/2, | |
164 dmpi->stride[2]*2, mpi->stride[2]*2); | |
165 } | |
166 } else { | |
167 vf->priv->dmpi = NULL; | |
168 | |
169 my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0], | |
170 mpi->planes[0]+mpi->stride[0], | |
171 mpi->w, mpi->h/2, | |
172 dmpi->stride[0]*2, mpi->stride[0]*2); | |
173 if (mpi->flags & MP_IMGFLAG_PLANAR) { | |
174 my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1], | |
175 mpi->planes[1]+mpi->stride[1], | |
176 mpi->chroma_width, mpi->chroma_height/2, | |
177 dmpi->stride[1]*2, mpi->stride[1]*2); | |
178 my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2], | |
179 mpi->planes[2]+mpi->stride[2], | |
180 mpi->chroma_width, mpi->chroma_height/2, | |
181 dmpi->stride[2]*2, mpi->stride[2]*2); | |
182 } | |
183 ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); | |
184 } | |
185 break; | |
10571
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
186 } |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
187 |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
188 vf->priv->frame++; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
189 |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
190 return ret; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
191 } |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
192 |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
193 static int query_format(struct vf_instance_s* vf, unsigned int fmt) |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
194 { |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
195 /* FIXME - figure out which other formats work */ |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
196 switch (fmt) { |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
197 case IMGFMT_YV12: |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
198 case IMGFMT_IYUV: |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
199 case IMGFMT_I420: |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
200 return vf_next_query_format(vf, fmt); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
201 } |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
202 return 0; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
203 } |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
204 |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
205 static int config(struct vf_instance_s* vf, |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
206 int width, int height, int d_width, int d_height, |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
207 unsigned int flags, unsigned int outfmt) |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
208 { |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
209 switch (vf->priv->mode) { |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
210 case 0: |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
211 case 3: |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
212 return vf_next_config(vf,width,height*2,d_width,d_height*2,flags,outfmt); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
213 case 1: /* odd frames */ |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
214 case 2: /* even frames */ |
18055 | 215 case 4: /* alternate frame (height-preserving) interlacing */ |
10571
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
216 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
217 } |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
218 return 0; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
219 } |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
220 |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
221 static void uninit(struct vf_instance_s* vf) |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
222 { |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
223 free(vf->priv); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
224 } |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
225 |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
226 static int open(vf_instance_t *vf, char* args) |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
227 { |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
228 struct vf_priv_s *p; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
229 vf->config = config; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
230 vf->put_image = put_image; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
231 vf->query_format = query_format; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
232 vf->uninit = uninit; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
233 vf->default_reqs = VFCAP_ACCEPT_STRIDE; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
234 vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
235 vf->priv->mode = 0; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
236 if (args) |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
237 sscanf(args, "%d", &vf->priv->mode); |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
238 vf->priv->frame = 0; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
239 return 1; |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
240 } |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
241 |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
242 vf_info_t vf_info_tinterlace = { |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
243 "temporal field interlacing", |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
244 "tinterlace", |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
245 "Michael Zucchi", |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
246 "", |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
247 open, |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
248 NULL |
07cfe1e1a2c9
'tinterlace' filter (partial inverse of tfields) by Not Zed <notzed@ximian.com> (with minor fixes for current cvs by me)
alex
parents:
diff
changeset
|
249 }; |