annotate libmpcodecs/vf_pp.c @ 30391:2a33c1c37e6b

Rename isRGB() and isBGR() as their meaning is confusing.
author michael
date Tue, 26 Jan 2010 07:40:14 +0000
parents 0f1b5b68af32
children bbb6ebec87a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
1 #include <stdio.h>
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
2 #include <stdlib.h>
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
3 #include <string.h>
7946
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
4 #include <inttypes.h>
7963
0a5d69e6f2a2 cleanup
michael
parents: 7961
diff changeset
5 #include <errno.h>
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
6
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16471
diff changeset
7 #include "config.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16471
diff changeset
8 #include "mp_msg.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16471
diff changeset
9 #include "cpudetect.h"
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
10
28594
df67d03dde3b Convert HAVE_MALLOC_H into a 0/1 definition, fixes the warning:
diego
parents: 28327
diff changeset
11 #if HAVE_MALLOC_H
8123
9fc45fe0d444 *HUGE* set of compiler warning fixes, unused variables removal
arpi
parents: 8040
diff changeset
12 #include <malloc.h>
9fc45fe0d444 *HUGE* set of compiler warning fixes, unused variables removal
arpi
parents: 8040
diff changeset
13 #endif
9fc45fe0d444 *HUGE* set of compiler warning fixes, unused variables removal
arpi
parents: 8040
diff changeset
14
5607
1972c3475d93 mp_image.h and img_format.h moved to libmpcodecs
arpi
parents: 5565
diff changeset
15 #include "img_format.h"
1972c3475d93 mp_image.h and img_format.h moved to libmpcodecs
arpi
parents: 5565
diff changeset
16 #include "mp_image.h"
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
17 #include "vf.h"
28327
c39a1fd7d45c Fix compilation after DECLARE_ASM_CONST/DECLARE_ALIGNED moving within FFmpeg.
diego
parents: 27341
diff changeset
18 #include "libavutil/internal.h"
18557
b7746166426c libpostproc is not a subdirectory of libavcodec anymore.
diego
parents: 17906
diff changeset
19 #include "libpostproc/postprocess.h"
26068
bfada3b4c366 10l: Revert nonsense commit.
diego
parents: 26066
diff changeset
20
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26069
diff changeset
21 #ifdef CONFIG_LIBPOSTPROC_A
26069
1318e956c092 FFmpeg now uses different (unified) #include paths.
diego
parents: 26068
diff changeset
22 #define EMU_OLD
26068
bfada3b4c366 10l: Revert nonsense commit.
diego
parents: 26066
diff changeset
23 #include "libpostproc/postprocess_internal.h"
bfada3b4c366 10l: Revert nonsense commit.
diego
parents: 26066
diff changeset
24 #endif
8038
fe30880576dc cleanup
michael
parents: 7985
diff changeset
25
28327
c39a1fd7d45c Fix compilation after DECLARE_ASM_CONST/DECLARE_ALIGNED moving within FFmpeg.
diego
parents: 27341
diff changeset
26 #undef malloc
c39a1fd7d45c Fix compilation after DECLARE_ASM_CONST/DECLARE_ALIGNED moving within FFmpeg.
diego
parents: 27341
diff changeset
27
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
28 struct vf_priv_s {
7946
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
29 int pp;
8040
5241f95b5ec4 cleanup
michael
parents: 8038
diff changeset
30 pp_mode_t *ppMode[PP_QUALITY_MAX+1];
7946
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
31 void *context;
5565
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5519
diff changeset
32 unsigned int outfmt;
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
33 };
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
34
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
35 //===========================================================================//
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
36
5565
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5519
diff changeset
37 static int config(struct vf_instance_s* vf,
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5519
diff changeset
38 int width, int height, int d_width, int d_height,
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5519
diff changeset
39 unsigned int voflags, unsigned int outfmt){
8805
e547ce712577 YUV 411/422/444 support for pp
michael
parents: 8736
diff changeset
40 int flags=
7985
1ab37da5b1da per context cpuCaps (idea by kabi)
michael
parents: 7972
diff changeset
41 (gCpuCaps.hasMMX ? PP_CPU_CAPS_MMX : 0)
1ab37da5b1da per context cpuCaps (idea by kabi)
michael
parents: 7972
diff changeset
42 | (gCpuCaps.hasMMX2 ? PP_CPU_CAPS_MMX2 : 0)
8805
e547ce712577 YUV 411/422/444 support for pp
michael
parents: 8736
diff changeset
43 | (gCpuCaps.has3DNow ? PP_CPU_CAPS_3DNOW : 0);
e547ce712577 YUV 411/422/444 support for pp
michael
parents: 8736
diff changeset
44
e547ce712577 YUV 411/422/444 support for pp
michael
parents: 8736
diff changeset
45 switch(outfmt){
e547ce712577 YUV 411/422/444 support for pp
michael
parents: 8736
diff changeset
46 case IMGFMT_444P: flags|= PP_FORMAT_444; break;
e547ce712577 YUV 411/422/444 support for pp
michael
parents: 8736
diff changeset
47 case IMGFMT_422P: flags|= PP_FORMAT_422; break;
e547ce712577 YUV 411/422/444 support for pp
michael
parents: 8736
diff changeset
48 case IMGFMT_411P: flags|= PP_FORMAT_411; break;
e547ce712577 YUV 411/422/444 support for pp
michael
parents: 8736
diff changeset
49 default: flags|= PP_FORMAT_420; break;
e547ce712577 YUV 411/422/444 support for pp
michael
parents: 8736
diff changeset
50 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28594
diff changeset
51
8805
e547ce712577 YUV 411/422/444 support for pp
michael
parents: 8736
diff changeset
52 if(vf->priv->context) pp_free_context(vf->priv->context);
e547ce712577 YUV 411/422/444 support for pp
michael
parents: 8736
diff changeset
53 vf->priv->context= pp_get_context(width, height, flags);
7946
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
54
9528
565015128767 10l (pp cant convert formats) fixes segfault
michael
parents: 9426
diff changeset
55 return vf_next_config(vf,width,height,d_width,d_height,voflags,outfmt);
5565
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5519
diff changeset
56 }
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5519
diff changeset
57
7949
0aedfdc5d6ef fixing segfault
michael
parents: 7946
diff changeset
58 static void uninit(struct vf_instance_s* vf){
8038
fe30880576dc cleanup
michael
parents: 7985
diff changeset
59 int i;
8040
5241f95b5ec4 cleanup
michael
parents: 8038
diff changeset
60 for(i=0; i<=PP_QUALITY_MAX; i++){
8038
fe30880576dc cleanup
michael
parents: 7985
diff changeset
61 if(vf->priv->ppMode[i])
fe30880576dc cleanup
michael
parents: 7985
diff changeset
62 pp_free_mode(vf->priv->ppMode[i]);
fe30880576dc cleanup
michael
parents: 7985
diff changeset
63 }
7961
78e0f2776da7 cosmetics ;)
michael
parents: 7960
diff changeset
64 if(vf->priv->context) pp_free_context(vf->priv->context);
7949
0aedfdc5d6ef fixing segfault
michael
parents: 7946
diff changeset
65 }
0aedfdc5d6ef fixing segfault
michael
parents: 7946
diff changeset
66
5518
04a40454bdbb accept only 4:2:0 planar yuv formats
arpi
parents: 5514
diff changeset
67 static int query_format(struct vf_instance_s* vf, unsigned int fmt){
04a40454bdbb accept only 4:2:0 planar yuv formats
arpi
parents: 5514
diff changeset
68 switch(fmt){
04a40454bdbb accept only 4:2:0 planar yuv formats
arpi
parents: 5514
diff changeset
69 case IMGFMT_YV12:
04a40454bdbb accept only 4:2:0 planar yuv formats
arpi
parents: 5514
diff changeset
70 case IMGFMT_I420:
04a40454bdbb accept only 4:2:0 planar yuv formats
arpi
parents: 5514
diff changeset
71 case IMGFMT_IYUV:
8805
e547ce712577 YUV 411/422/444 support for pp
michael
parents: 8736
diff changeset
72 case IMGFMT_444P:
e547ce712577 YUV 411/422/444 support for pp
michael
parents: 8736
diff changeset
73 case IMGFMT_422P:
e547ce712577 YUV 411/422/444 support for pp
michael
parents: 8736
diff changeset
74 case IMGFMT_411P:
e547ce712577 YUV 411/422/444 support for pp
michael
parents: 8736
diff changeset
75 return vf_next_query_format(vf,fmt);
5518
04a40454bdbb accept only 4:2:0 planar yuv formats
arpi
parents: 5514
diff changeset
76 }
04a40454bdbb accept only 4:2:0 planar yuv formats
arpi
parents: 5514
diff changeset
77 return 0;
04a40454bdbb accept only 4:2:0 planar yuv formats
arpi
parents: 5514
diff changeset
78 }
04a40454bdbb accept only 4:2:0 planar yuv formats
arpi
parents: 5514
diff changeset
79
5519
868c13f78f08 vf control codes added, autoq support
arpi
parents: 5518
diff changeset
80 static int control(struct vf_instance_s* vf, int request, void* data){
868c13f78f08 vf control codes added, autoq support
arpi
parents: 5518
diff changeset
81 switch(request){
868c13f78f08 vf control codes added, autoq support
arpi
parents: 5518
diff changeset
82 case VFCTRL_QUERY_MAX_PP_LEVEL:
8040
5241f95b5ec4 cleanup
michael
parents: 8038
diff changeset
83 return PP_QUALITY_MAX;
5519
868c13f78f08 vf control codes added, autoq support
arpi
parents: 5518
diff changeset
84 case VFCTRL_SET_PP_LEVEL:
7946
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
85 vf->priv->pp= *((unsigned int*)data);
5519
868c13f78f08 vf control codes added, autoq support
arpi
parents: 5518
diff changeset
86 return CONTROL_TRUE;
868c13f78f08 vf control codes added, autoq support
arpi
parents: 5518
diff changeset
87 }
868c13f78f08 vf control codes added, autoq support
arpi
parents: 5518
diff changeset
88 return vf_next_control(vf,request,data);
868c13f78f08 vf control codes added, autoq support
arpi
parents: 5518
diff changeset
89 }
868c13f78f08 vf control codes added, autoq support
arpi
parents: 5518
diff changeset
90
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
91 static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
92 if(vf->priv->pp&0xFFFF) return; // non-local filters enabled
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28594
diff changeset
93 if((mpi->type==MP_IMGTYPE_IPB || vf->priv->pp) &&
5513
73696051e3ce mpeg+pp0 fixed
arpi
parents: 5512
diff changeset
94 mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
5565
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5519
diff changeset
95 if(!(mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE) && mpi->imgfmt!=vf->priv->outfmt)
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5519
diff changeset
96 return; // colorspace differ
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
97 // ok, we can do pp in-place (or pp disabled):
10141
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9931
diff changeset
98 vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
16018
bdf1b4ecb906 use stored dimensions instead of visible one when (vf_)get_image is called
iive
parents: 15965
diff changeset
99 mpi->type, mpi->flags | MP_IMGFLAG_READABLE, mpi->width, mpi->height);
10141
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9931
diff changeset
100 mpi->planes[0]=vf->dmpi->planes[0];
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9931
diff changeset
101 mpi->stride[0]=vf->dmpi->stride[0];
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9931
diff changeset
102 mpi->width=vf->dmpi->width;
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
103 if(mpi->flags&MP_IMGFLAG_PLANAR){
10141
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9931
diff changeset
104 mpi->planes[1]=vf->dmpi->planes[1];
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9931
diff changeset
105 mpi->planes[2]=vf->dmpi->planes[2];
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9931
diff changeset
106 mpi->stride[1]=vf->dmpi->stride[1];
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9931
diff changeset
107 mpi->stride[2]=vf->dmpi->stride[2];
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
108 }
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
109 mpi->flags|=MP_IMGFLAG_DIRECT;
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
110 }
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
111
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17463
diff changeset
112 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
113 if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
114 // no DR, so get a new image! hope we'll get DR buffer:
10141
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9931
diff changeset
115 vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
16471
9f516ed86916 pp_postprocess reads from target image, so request a readable one.
reimar
parents: 16018
diff changeset
116 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE |
9f516ed86916 pp_postprocess reads from target image, so request a readable one.
reimar
parents: 16018
diff changeset
117 MP_IMGFLAG_PREFER_ALIGNED_STRIDE | MP_IMGFLAG_READABLE,
6875
255b150a75a5 - some reorder/cleanup of mp_image flags
arpi
parents: 5607
diff changeset
118 // MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
255b150a75a5 - some reorder/cleanup of mp_image flags
arpi
parents: 5607
diff changeset
119 // mpi->w,mpi->h);
16018
bdf1b4ecb906 use stored dimensions instead of visible one when (vf_)get_image is called
iive
parents: 15965
diff changeset
120 (mpi->width+7)&(~7),(mpi->height+7)&(~7));
10141
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9931
diff changeset
121 vf->dmpi->w=mpi->w; vf->dmpi->h=mpi->h; // display w;h
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
122 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28594
diff changeset
123
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
124 if(vf->priv->pp || !(mpi->flags&MP_IMGFLAG_DIRECT)){
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
125 // do the postprocessing! (or copy if no DR)
7961
78e0f2776da7 cosmetics ;)
michael
parents: 7960
diff changeset
126 pp_postprocess(mpi->planes ,mpi->stride,
10141
7d6a854a5fe5 cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents: 9931
diff changeset
127 vf->dmpi->planes,vf->dmpi->stride,
6875
255b150a75a5 - some reorder/cleanup of mp_image flags
arpi
parents: 5607
diff changeset
128 (mpi->w+7)&(~7),mpi->h,
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
129 mpi->qscale, mpi->qstride,
8038
fe30880576dc cleanup
michael
parents: 7985
diff changeset
130 vf->priv->ppMode[ vf->priv->pp ], vf->priv->context,
9931
c4f7ffafb559 support old libavcodec
michael
parents: 9925
diff changeset
131 #ifdef PP_PICT_TYPE_QP2
9925
420640a0f6d0 passing qscale_type around so the pp code can fix the mpeg2 <<1 thing
michael
parents: 9593
diff changeset
132 mpi->pict_type | (mpi->qscale_type ? PP_PICT_TYPE_QP2 : 0));
9931
c4f7ffafb559 support old libavcodec
michael
parents: 9925
diff changeset
133 #else
c4f7ffafb559 support old libavcodec
michael
parents: 9925
diff changeset
134 mpi->pict_type);
c4f7ffafb559 support old libavcodec
michael
parents: 9925
diff changeset
135 #endif
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
136 }
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17463
diff changeset
137 return vf_next_put_image(vf,vf->dmpi, pts);
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
138 }
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
139
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
140 //===========================================================================//
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
141
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
142 extern int divx_quality;
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
143
5565
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5519
diff changeset
144 static unsigned int fmt_list[]={
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5519
diff changeset
145 IMGFMT_YV12,
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5519
diff changeset
146 IMGFMT_I420,
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5519
diff changeset
147 IMGFMT_IYUV,
8805
e547ce712577 YUV 411/422/444 support for pp
michael
parents: 8736
diff changeset
148 IMGFMT_444P,
e547ce712577 YUV 411/422/444 support for pp
michael
parents: 8736
diff changeset
149 IMGFMT_422P,
e547ce712577 YUV 411/422/444 support for pp
michael
parents: 8736
diff changeset
150 IMGFMT_411P,
7127
1e47c2e7aa8e mostly compiler warning fixes, some small bugfix
arpi
parents: 6875
diff changeset
151 0
5565
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5519
diff changeset
152 };
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5519
diff changeset
153
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
154 static int open(vf_instance_t *vf, char* args){
7946
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
155 char *endptr, *name;
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
156 int i;
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
157 int hex_mode=0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28594
diff changeset
158
5518
04a40454bdbb accept only 4:2:0 planar yuv formats
arpi
parents: 5514
diff changeset
159 vf->query_format=query_format;
5519
868c13f78f08 vf control codes added, autoq support
arpi
parents: 5518
diff changeset
160 vf->control=control;
5565
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5519
diff changeset
161 vf->config=config;
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
162 vf->get_image=get_image;
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
163 vf->put_image=put_image;
7949
0aedfdc5d6ef fixing segfault
michael
parents: 7946
diff changeset
164 vf->uninit=uninit;
5565
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5519
diff changeset
165 vf->default_caps=VFCAP_ACCEPT_STRIDE|VFCAP_POSTPROC;
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
166 vf->priv=malloc(sizeof(struct vf_priv_s));
7949
0aedfdc5d6ef fixing segfault
michael
parents: 7946
diff changeset
167 vf->priv->context=NULL;
5565
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5519
diff changeset
168
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5519
diff changeset
169 // check csp:
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5519
diff changeset
170 vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_YV12);
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5519
diff changeset
171 if(!vf->priv->outfmt) return 0; // no csp match :(
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28594
diff changeset
172
5514
127f2a84e933 accept -pp value from args
arpi
parents: 5513
diff changeset
173 if(args){
7946
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
174 hex_mode= strtol(args, &endptr, 0);
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
175 if(*endptr){
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
176 name= args;
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
177 }else
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
178 name= NULL;
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
179 }else{
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
180 name="de";
5514
127f2a84e933 accept -pp value from args
arpi
parents: 5513
diff changeset
181 }
7972
6d1103afba1c cleanly passing the cpuCaps
michael
parents: 7963
diff changeset
182
8038
fe30880576dc cleanup
michael
parents: 7985
diff changeset
183 #ifdef EMU_OLD
7946
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
184 if(name){
8038
fe30880576dc cleanup
michael
parents: 7985
diff changeset
185 #endif
8040
5241f95b5ec4 cleanup
michael
parents: 8038
diff changeset
186 for(i=0; i<=PP_QUALITY_MAX; i++){
7961
78e0f2776da7 cosmetics ;)
michael
parents: 7960
diff changeset
187 vf->priv->ppMode[i]= pp_get_mode_by_name_and_quality(name, i);
8038
fe30880576dc cleanup
michael
parents: 7985
diff changeset
188 if(vf->priv->ppMode[i]==NULL) return -1;
7946
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
189 }
8038
fe30880576dc cleanup
michael
parents: 7985
diff changeset
190 #ifdef EMU_OLD
7946
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
191 }else{
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
192 /* hex mode for compatibility */
8040
5241f95b5ec4 cleanup
michael
parents: 8038
diff changeset
193 for(i=0; i<=PP_QUALITY_MAX; i++){
8038
fe30880576dc cleanup
michael
parents: 7985
diff changeset
194 PPMode *ppMode;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28594
diff changeset
195
8038
fe30880576dc cleanup
michael
parents: 7985
diff changeset
196 ppMode= (PPMode*)memalign(8, sizeof(PPMode));
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28594
diff changeset
197
8038
fe30880576dc cleanup
michael
parents: 7985
diff changeset
198 ppMode->lumMode= hex_mode;
fe30880576dc cleanup
michael
parents: 7985
diff changeset
199 ppMode->chromMode= ((hex_mode&0xFF)>>4) | (hex_mode&0xFFFFFF00);
fe30880576dc cleanup
michael
parents: 7985
diff changeset
200 ppMode->maxTmpNoise[0]= 700;
fe30880576dc cleanup
michael
parents: 7985
diff changeset
201 ppMode->maxTmpNoise[1]= 1500;
fe30880576dc cleanup
michael
parents: 7985
diff changeset
202 ppMode->maxTmpNoise[2]= 3000;
fe30880576dc cleanup
michael
parents: 7985
diff changeset
203 ppMode->maxAllowedY= 234;
fe30880576dc cleanup
michael
parents: 7985
diff changeset
204 ppMode->minAllowedY= 16;
fe30880576dc cleanup
michael
parents: 7985
diff changeset
205 ppMode->baseDcDiff= 256/4;
fe30880576dc cleanup
michael
parents: 7985
diff changeset
206 ppMode->flatnessThreshold=40;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28594
diff changeset
207
7946
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
208 vf->priv->ppMode[i]= ppMode;
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
209 }
f483ab704252 postprocessing cleanup:
michael
parents: 7368
diff changeset
210 }
8038
fe30880576dc cleanup
michael
parents: 7985
diff changeset
211 #endif
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28594
diff changeset
212
10756
e40dee59f3ba remove read/revert hack
alex
parents: 10141
diff changeset
213 vf->priv->pp=PP_QUALITY_MAX;
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
214 return 1;
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
215 }
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
216
25221
00fff9a3b735 Make all vf_info_t structs const
reimar
parents: 18557
diff changeset
217 const vf_info_t vf_info_pp = {
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
218 "postprocessing",
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
219 "pp",
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
220 "A'rpi",
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
221 "",
9593
e9a2af584986 Add the new -vf option wich is the same as vop in reverse order.
albeu
parents: 9528
diff changeset
222 open,
e9a2af584986 Add the new -vf option wich is the same as vop in reverse order.
albeu
parents: 9528
diff changeset
223 NULL
5512
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
224 };
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
225
4ccfa77d8e86 postprocessing filter (fixme: -pp 0)
arpi
parents:
diff changeset
226 //===========================================================================//
9426
c9dcb67e9638 moving postprocess code to libavcodec
michael
parents: 8805
diff changeset
227