mf demuxer only works with mf:// urls, so check for that.
[mplayer/glamo.git] / libmpcodecs / vf_scale.c
blob8309680c43400258e3392062bbe923249d3762ef
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <inttypes.h>
6 #include "config.h"
7 #include "mp_msg.h"
8 #include "cpudetect.h"
10 #include "img_format.h"
11 #include "mp_image.h"
12 #include "vf.h"
13 #include "fmt-conversion.h"
15 #include "libvo/fastmemcpy.h"
16 #include "libswscale/swscale.h"
17 #include "vf_scale.h"
19 #include "m_option.h"
20 #include "m_struct.h"
22 static struct vf_priv_s {
23 int w,h;
24 int v_chr_drop;
25 double param[2];
26 unsigned int fmt;
27 struct SwsContext *ctx;
28 struct SwsContext *ctx2; //for interlaced slices only
29 unsigned char* palette;
30 int interlaced;
31 int noup;
32 int accurate_rnd;
33 int query_format_cache[64];
34 } const vf_priv_dflt = {
35 -1,-1,
37 {SWS_PARAM_DEFAULT, SWS_PARAM_DEFAULT},
39 NULL,
40 NULL,
41 NULL
44 extern int opt_screen_size_x;
45 extern int opt_screen_size_y;
46 extern float screen_size_xy;
48 //===========================================================================//
50 void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, SwsFilter **dstFilterParam);
52 static unsigned int outfmt_list[]={
53 // YUV:
54 IMGFMT_444P,
55 IMGFMT_422P,
56 IMGFMT_YV12,
57 IMGFMT_I420,
58 IMGFMT_IYUV,
59 IMGFMT_YVU9,
60 IMGFMT_IF09,
61 IMGFMT_411P,
62 IMGFMT_NV12,
63 IMGFMT_NV21,
64 IMGFMT_YUY2,
65 IMGFMT_UYVY,
66 // RGB and grayscale (Y8 and Y800):
67 IMGFMT_BGR32,
68 IMGFMT_RGB32,
69 IMGFMT_BGR24,
70 IMGFMT_RGB24,
71 IMGFMT_BGR16,
72 IMGFMT_RGB16,
73 IMGFMT_BGR15,
74 IMGFMT_RGB15,
75 IMGFMT_Y800,
76 IMGFMT_Y8,
77 IMGFMT_BGR8,
78 IMGFMT_RGB8,
79 IMGFMT_BGR4,
80 IMGFMT_RGB4,
81 IMGFMT_BG4B,
82 IMGFMT_RG4B,
83 IMGFMT_BGR1,
84 IMGFMT_RGB1,
88 static unsigned int find_best_out(vf_instance_t *vf){
89 unsigned int best=0;
90 int i;
92 // find the best outfmt:
93 for(i=0; i<sizeof(outfmt_list)/sizeof(int)-1; i++){
94 const int format= outfmt_list[i];
95 int ret= vf->priv->query_format_cache[i]-1;
96 if(ret == -1){
97 ret= vf_next_query_format(vf, outfmt_list[i]);
98 vf->priv->query_format_cache[i]= ret+1;
101 mp_msg(MSGT_VFILTER,MSGL_DBG2,"scale: query(%s) -> %d\n",vo_format_name(format),ret&3);
102 if(ret&VFCAP_CSP_SUPPORTED_BY_HW){
103 best=format; // no conversion -> bingo!
104 break;
106 if(ret&VFCAP_CSP_SUPPORTED && !best)
107 best=format; // best with conversion
109 return best;
112 static int config(struct vf_instance_s* vf,
113 int width, int height, int d_width, int d_height,
114 unsigned int flags, unsigned int outfmt){
115 unsigned int best=find_best_out(vf);
116 int vo_flags;
117 int int_sws_flags=0;
118 int round_w=0, round_h=0;
119 SwsFilter *srcFilter, *dstFilter;
120 enum PixelFormat dfmt, sfmt;
122 if(!best){
123 mp_msg(MSGT_VFILTER,MSGL_WARN,"SwScale: no supported outfmt found :(\n");
124 return 0;
126 sfmt = imgfmt2pixfmt(outfmt);
127 dfmt = imgfmt2pixfmt(best);
129 vo_flags=vf->next->query_format(vf->next,best);
131 // scaling to dwidth*d_height, if all these TRUE:
132 // - option -zoom
133 // - no other sw/hw up/down scaling avail.
134 // - we're after postproc
135 // - user didn't set w:h
136 if(!(vo_flags&VFCAP_POSTPROC) && (flags&4) &&
137 vf->priv->w<0 && vf->priv->h<0){ // -zoom
138 int x=(vo_flags&VFCAP_SWSCALE) ? 0 : 1;
139 if(d_width<width || d_height<height){
140 // downscale!
141 if(vo_flags&VFCAP_HWSCALE_DOWN) x=0;
142 } else {
143 // upscale:
144 if(vo_flags&VFCAP_HWSCALE_UP) x=0;
146 if(x){
147 // user wants sw scaling! (-zoom)
148 vf->priv->w=d_width;
149 vf->priv->h=d_height;
153 if(vf->priv->noup){
154 if((vf->priv->w > width) + (vf->priv->h > height) >= vf->priv->noup){
155 vf->priv->w= width;
156 vf->priv->h= height;
160 if (vf->priv->w <= -8) {
161 vf->priv->w += 8;
162 round_w = 1;
164 if (vf->priv->h <= -8) {
165 vf->priv->h += 8;
166 round_h = 1;
169 if (vf->priv->w < -3 || vf->priv->h < -3 ||
170 (vf->priv->w < -1 && vf->priv->h < -1)) {
171 // TODO: establish a direct connection to the user's brain
172 // and find out what the heck he thinks MPlayer should do
173 // with this nonsense.
174 mp_msg(MSGT_VFILTER, MSGL_ERR, "SwScale: EUSERBROKEN Check your parameters, they make no sense!\n");
175 return 0;
178 if (vf->priv->w == -1)
179 vf->priv->w = width;
180 if (vf->priv->w == 0)
181 vf->priv->w = d_width;
183 if (vf->priv->h == -1)
184 vf->priv->h = height;
185 if (vf->priv->h == 0)
186 vf->priv->h = d_height;
188 if (vf->priv->w == -3)
189 vf->priv->w = vf->priv->h * width / height;
190 if (vf->priv->w == -2)
191 vf->priv->w = vf->priv->h * d_width / d_height;
193 if (vf->priv->h == -3)
194 vf->priv->h = vf->priv->w * height / width;
195 if (vf->priv->h == -2)
196 vf->priv->h = vf->priv->w * d_height / d_width;
198 if (round_w)
199 vf->priv->w = ((vf->priv->w + 8) / 16) * 16;
200 if (round_h)
201 vf->priv->h = ((vf->priv->h + 8) / 16) * 16;
203 // calculate the missing parameters:
204 switch(best) {
205 case IMGFMT_YV12: /* YV12 needs w & h rounded to 2 */
206 case IMGFMT_I420:
207 case IMGFMT_IYUV:
208 case IMGFMT_NV12:
209 case IMGFMT_NV21:
210 vf->priv->h = (vf->priv->h + 1) & ~1;
211 case IMGFMT_YUY2: /* YUY2 needs w rounded to 2 */
212 case IMGFMT_UYVY:
213 vf->priv->w = (vf->priv->w + 1) & ~1;
216 mp_msg(MSGT_VFILTER,MSGL_DBG2,"SwScale: scaling %dx%d %s to %dx%d %s \n",
217 width,height,vo_format_name(outfmt),
218 vf->priv->w,vf->priv->h,vo_format_name(best));
220 // free old ctx:
221 if(vf->priv->ctx) sws_freeContext(vf->priv->ctx);
222 if(vf->priv->ctx2)sws_freeContext(vf->priv->ctx2);
224 // new swscaler:
225 sws_getFlagsAndFilterFromCmdLine(&int_sws_flags, &srcFilter, &dstFilter);
226 int_sws_flags|= vf->priv->v_chr_drop << SWS_SRC_V_CHR_DROP_SHIFT;
227 int_sws_flags|= vf->priv->accurate_rnd * SWS_ACCURATE_RND;
228 vf->priv->ctx=sws_getContext(width, height >> vf->priv->interlaced,
229 sfmt,
230 vf->priv->w, vf->priv->h >> vf->priv->interlaced,
231 dfmt,
232 int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param);
233 if(vf->priv->interlaced){
234 vf->priv->ctx2=sws_getContext(width, height >> 1,
235 sfmt,
236 vf->priv->w, vf->priv->h >> 1,
237 dfmt,
238 int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param);
240 if(!vf->priv->ctx){
241 // error...
242 mp_msg(MSGT_VFILTER,MSGL_WARN,"Couldn't init SwScaler for this setup\n");
243 return 0;
245 vf->priv->fmt=best;
247 if(vf->priv->palette){
248 free(vf->priv->palette);
249 vf->priv->palette=NULL;
251 switch(best){
252 case IMGFMT_BGR8: {
253 /* set 332 palette for 8 bpp */
254 int i;
255 vf->priv->palette=malloc(4*256);
256 for(i=0; i<256; i++){
257 vf->priv->palette[4*i+0]=4*(i&3)*21;
258 vf->priv->palette[4*i+1]=4*((i>>2)&7)*9;
259 vf->priv->palette[4*i+2]=4*((i>>5)&7)*9;
261 break; }
262 case IMGFMT_BGR4:
263 case IMGFMT_BG4B: {
264 int i;
265 vf->priv->palette=malloc(4*16);
266 for(i=0; i<16; i++){
267 vf->priv->palette[4*i+0]=4*(i&1)*63;
268 vf->priv->palette[4*i+1]=4*((i>>1)&3)*21;
269 vf->priv->palette[4*i+2]=4*((i>>3)&1)*63;
271 break; }
274 if(!opt_screen_size_x && !opt_screen_size_y && !(screen_size_xy >= 0.001)){
275 // Compute new d_width and d_height, preserving aspect
276 // while ensuring that both are >= output size in pixels.
277 if (vf->priv->h * d_width > vf->priv->w * d_height) {
278 d_width = vf->priv->h * d_width / d_height;
279 d_height = vf->priv->h;
280 } else {
281 d_height = vf->priv->w * d_height / d_width;
282 d_width = vf->priv->w;
284 //d_width=d_width*vf->priv->w/width;
285 //d_height=d_height*vf->priv->h/height;
287 return vf_next_config(vf,vf->priv->w,vf->priv->h,d_width,d_height,flags,best);
290 static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){
291 // printf("start_slice called! flag=%d\n",mpi->flags&MP_IMGFLAG_DRAW_CALLBACK);
292 if(!(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)) return; // shouldn't happen
293 // they want slices!!! allocate the buffer.
294 mpi->priv=vf->dmpi=vf_get_image(vf->next,vf->priv->fmt,
295 // mpi->type, mpi->flags & (~MP_IMGFLAG_DRAW_CALLBACK),
296 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
297 vf->priv->w, vf->priv->h);
300 static void scale(struct SwsContext *sws1, struct SwsContext *sws2, uint8_t *src[3], int src_stride[3], int y, int h,
301 uint8_t *dst[3], int dst_stride[3], int interlaced){
302 if(interlaced){
303 int i;
304 uint8_t *src2[3]={src[0], src[1], src[2]};
305 uint8_t *dst2[3]={dst[0], dst[1], dst[2]};
306 int src_stride2[3]={2*src_stride[0], 2*src_stride[1], 2*src_stride[2]};
307 int dst_stride2[3]={2*dst_stride[0], 2*dst_stride[1], 2*dst_stride[2]};
309 sws_scale_ordered(sws1, src2, src_stride2, y>>1, h>>1, dst2, dst_stride2);
310 for(i=0; i<3; i++){
311 src2[i] += src_stride[i];
312 dst2[i] += dst_stride[i];
314 sws_scale_ordered(sws2, src2, src_stride2, y>>1, h>>1, dst2, dst_stride2);
315 }else{
316 sws_scale_ordered(sws1, src, src_stride, y, h, dst, dst_stride);
320 static void draw_slice(struct vf_instance_s* vf,
321 unsigned char** src, int* stride, int w,int h, int x, int y){
322 mp_image_t *dmpi=vf->dmpi;
323 if(!dmpi){
324 mp_msg(MSGT_VFILTER,MSGL_FATAL,"vf_scale: draw_slice() called with dmpi=NULL (no get_image??)\n");
325 return;
327 // printf("vf_scale::draw_slice() y=%d h=%d\n",y,h);
328 scale(vf->priv->ctx, vf->priv->ctx2, src, stride, y, h, dmpi->planes, dmpi->stride, vf->priv->interlaced);
331 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
332 mp_image_t *dmpi=mpi->priv;
334 // printf("vf_scale::put_image(): processing whole frame! dmpi=%p flag=%d\n",
335 // dmpi, (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK));
337 if(!(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK && dmpi)){
339 // hope we'll get DR buffer:
340 dmpi=vf_get_image(vf->next,vf->priv->fmt,
341 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
342 vf->priv->w, vf->priv->h);
344 scale(vf->priv->ctx, vf->priv->ctx, mpi->planes,mpi->stride,0,mpi->h,dmpi->planes,dmpi->stride, vf->priv->interlaced);
347 if(vf->priv->w==mpi->w && vf->priv->h==mpi->h){
348 // just conversion, no scaling -> keep postprocessing data
349 // this way we can apply pp filter to non-yv12 source using scaler
350 vf_clone_mpi_attributes(dmpi, mpi);
353 if(vf->priv->palette) dmpi->planes[1]=vf->priv->palette; // export palette!
355 return vf_next_put_image(vf,dmpi, pts);
358 static int control(struct vf_instance_s* vf, int request, void* data){
359 int *table;
360 int *inv_table;
361 int r;
362 int brightness, contrast, saturation, srcRange, dstRange;
363 vf_equalizer_t *eq;
365 if(vf->priv->ctx)
366 switch(request){
367 case VFCTRL_GET_EQUALIZER:
368 r= sws_getColorspaceDetails(vf->priv->ctx, &inv_table, &srcRange, &table, &dstRange, &brightness, &contrast, &saturation);
369 if(r<0) break;
371 eq = data;
372 if (!strcmp(eq->item,"brightness")) {
373 eq->value = ((brightness*100) + (1<<15))>>16;
375 else if (!strcmp(eq->item,"contrast")) {
376 eq->value = (((contrast *100) + (1<<15))>>16) - 100;
378 else if (!strcmp(eq->item,"saturation")) {
379 eq->value = (((saturation*100) + (1<<15))>>16) - 100;
381 else
382 break;
383 return CONTROL_TRUE;
384 case VFCTRL_SET_EQUALIZER:
385 r= sws_getColorspaceDetails(vf->priv->ctx, &inv_table, &srcRange, &table, &dstRange, &brightness, &contrast, &saturation);
386 if(r<0) break;
387 //printf("set %f %f %f\n", brightness/(float)(1<<16), contrast/(float)(1<<16), saturation/(float)(1<<16));
388 eq = data;
390 if (!strcmp(eq->item,"brightness")) {
391 brightness = (( eq->value <<16) + 50)/100;
393 else if (!strcmp(eq->item,"contrast")) {
394 contrast = (((eq->value+100)<<16) + 50)/100;
396 else if (!strcmp(eq->item,"saturation")) {
397 saturation = (((eq->value+100)<<16) + 50)/100;
399 else
400 break;
402 r= sws_setColorspaceDetails(vf->priv->ctx, inv_table, srcRange, table, dstRange, brightness, contrast, saturation);
403 if(r<0) break;
404 if(vf->priv->ctx2){
405 r= sws_setColorspaceDetails(vf->priv->ctx2, inv_table, srcRange, table, dstRange, brightness, contrast, saturation);
406 if(r<0) break;
409 return CONTROL_TRUE;
410 default:
411 break;
414 return vf_next_control(vf,request,data);
417 //===========================================================================//
419 // supported Input formats: YV12, I420, IYUV, YUY2, UYVY, BGR32, BGR24, BGR16, BGR15, RGB32, RGB24, Y8, Y800
421 static int query_format(struct vf_instance_s* vf, unsigned int fmt){
422 switch(fmt){
423 case IMGFMT_YV12:
424 case IMGFMT_I420:
425 case IMGFMT_IYUV:
426 case IMGFMT_UYVY:
427 case IMGFMT_YUY2:
428 case IMGFMT_BGR32:
429 case IMGFMT_BGR24:
430 case IMGFMT_BGR16:
431 case IMGFMT_BGR15:
432 case IMGFMT_RGB32:
433 case IMGFMT_RGB24:
434 case IMGFMT_Y800:
435 case IMGFMT_Y8:
436 case IMGFMT_YVU9:
437 case IMGFMT_IF09:
438 case IMGFMT_444P:
439 case IMGFMT_422P:
440 case IMGFMT_411P:
442 unsigned int best=find_best_out(vf);
443 int flags;
444 if(!best) return 0; // no matching out-fmt
445 flags=vf_next_query_format(vf,best);
446 if(!(flags&(VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW))) return 0; // huh?
447 if(fmt!=best) flags&=~VFCAP_CSP_SUPPORTED_BY_HW;
448 // do not allow scaling, if we are before the PP fliter!
449 if(!(flags&VFCAP_POSTPROC)) flags|=VFCAP_SWSCALE;
450 return flags;
453 return 0; // nomatching in-fmt
456 static void uninit(struct vf_instance_s *vf){
457 if(vf->priv->ctx) sws_freeContext(vf->priv->ctx);
458 if(vf->priv->ctx2) sws_freeContext(vf->priv->ctx2);
459 if(vf->priv->palette) free(vf->priv->palette);
460 free(vf->priv);
463 static int open(vf_instance_t *vf, char* args){
464 vf->config=config;
465 vf->start_slice=start_slice;
466 vf->draw_slice=draw_slice;
467 vf->put_image=put_image;
468 vf->query_format=query_format;
469 vf->control= control;
470 vf->uninit=uninit;
471 if(!vf->priv) {
472 vf->priv=malloc(sizeof(struct vf_priv_s));
473 // TODO: parse args ->
474 vf->priv->ctx=NULL;
475 vf->priv->ctx2=NULL;
476 vf->priv->w=
477 vf->priv->h=-1;
478 vf->priv->v_chr_drop=0;
479 vf->priv->accurate_rnd=0;
480 vf->priv->param[0]=
481 vf->priv->param[1]=SWS_PARAM_DEFAULT;
482 vf->priv->palette=NULL;
483 } // if(!vf->priv)
484 if(args) sscanf(args, "%d:%d:%d:%lf:%lf",
485 &vf->priv->w,
486 &vf->priv->h,
487 &vf->priv->v_chr_drop,
488 &vf->priv->param[0],
489 &vf->priv->param[1]);
490 mp_msg(MSGT_VFILTER,MSGL_V,"SwScale params: %d x %d (-1=no scaling)\n",
491 vf->priv->w,
492 vf->priv->h);
494 return 1;
497 //global sws_flags from the command line
498 int sws_flags=2;
500 //global srcFilter
501 static SwsFilter *src_filter= NULL;
503 float sws_lum_gblur= 0.0;
504 float sws_chr_gblur= 0.0;
505 int sws_chr_vshift= 0;
506 int sws_chr_hshift= 0;
507 float sws_chr_sharpen= 0.0;
508 float sws_lum_sharpen= 0.0;
510 int get_sws_cpuflags(void){
511 return
512 (gCpuCaps.hasMMX ? SWS_CPU_CAPS_MMX : 0)
513 | (gCpuCaps.hasMMX2 ? SWS_CPU_CAPS_MMX2 : 0)
514 | (gCpuCaps.has3DNow ? SWS_CPU_CAPS_3DNOW : 0)
515 | (gCpuCaps.hasAltiVec ? SWS_CPU_CAPS_ALTIVEC : 0);
518 void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, SwsFilter **dstFilterParam)
520 static int firstTime=1;
521 *flags=0;
523 #ifdef ARCH_X86
524 if(gCpuCaps.hasMMX)
525 asm volatile("emms\n\t"::: "memory"); //FIXME this shouldnt be required but it IS (even for non mmx versions)
526 #endif
527 if(firstTime)
529 firstTime=0;
530 *flags= SWS_PRINT_INFO;
532 else if( mp_msg_test(MSGT_VFILTER,MSGL_DBG2) ) *flags= SWS_PRINT_INFO;
534 if(src_filter) sws_freeFilter(src_filter);
536 src_filter= sws_getDefaultFilter(
537 sws_lum_gblur, sws_chr_gblur,
538 sws_lum_sharpen, sws_chr_sharpen,
539 sws_chr_hshift, sws_chr_vshift, verbose>1);
541 switch(sws_flags)
543 case 0: *flags|= SWS_FAST_BILINEAR; break;
544 case 1: *flags|= SWS_BILINEAR; break;
545 case 2: *flags|= SWS_BICUBIC; break;
546 case 3: *flags|= SWS_X; break;
547 case 4: *flags|= SWS_POINT; break;
548 case 5: *flags|= SWS_AREA; break;
549 case 6: *flags|= SWS_BICUBLIN; break;
550 case 7: *flags|= SWS_GAUSS; break;
551 case 8: *flags|= SWS_SINC; break;
552 case 9: *flags|= SWS_LANCZOS; break;
553 case 10:*flags|= SWS_SPLINE; break;
554 default:*flags|= SWS_BILINEAR; break;
557 *srcFilterParam= src_filter;
558 *dstFilterParam= NULL;
561 // will use sws_flags & src_filter (from cmd line)
562 struct SwsContext *sws_getContextFromCmdLine(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat)
564 int flags;
565 SwsFilter *dstFilterParam, *srcFilterParam;
566 enum PixelFormat dfmt, sfmt;
568 dfmt = imgfmt2pixfmt(dstFormat);
569 sfmt = imgfmt2pixfmt(srcFormat);
570 sws_getFlagsAndFilterFromCmdLine(&flags, &srcFilterParam, &dstFilterParam);
572 return sws_getContext(srcW, srcH, sfmt, dstW, dstH, dfmt, flags | get_sws_cpuflags(), srcFilterParam, dstFilterParam, NULL);
575 /// An example of presets usage
576 static struct size_preset {
577 char* name;
578 int w, h;
579 } vf_size_presets_defs[] = {
580 // TODO add more 'standard' resolutions
581 { "qntsc", 352, 240 },
582 { "qpal", 352, 288 },
583 { "ntsc", 720, 480 },
584 { "pal", 720, 576 },
585 { "sntsc", 640, 480 },
586 { "spal", 768, 576 },
587 { NULL, 0, 0}
590 #define ST_OFF(f) M_ST_OFF(struct size_preset,f)
591 static m_option_t vf_size_preset_fields[] = {
592 {"w", ST_OFF(w), CONF_TYPE_INT, M_OPT_MIN,1 ,0, NULL},
593 {"h", ST_OFF(h), CONF_TYPE_INT, M_OPT_MIN,1 ,0, NULL},
594 { NULL, NULL, 0, 0, 0, 0, NULL }
597 static m_struct_t vf_size_preset = {
598 "scale_size_preset",
599 sizeof(struct size_preset),
600 NULL,
601 vf_size_preset_fields
604 static m_struct_t vf_opts;
605 static m_obj_presets_t size_preset = {
606 &vf_size_preset, // Input struct desc
607 &vf_opts, // Output struct desc
608 vf_size_presets_defs, // The list of presets
609 ST_OFF(name) // At wich offset is the name field in the preset struct
612 /// Now the options
613 #undef ST_OFF
614 #define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
615 static m_option_t vf_opts_fields[] = {
616 {"w", ST_OFF(w), CONF_TYPE_INT, M_OPT_MIN,-11,0, NULL},
617 {"h", ST_OFF(h), CONF_TYPE_INT, M_OPT_MIN,-11,0, NULL},
618 {"interlaced", ST_OFF(interlaced), CONF_TYPE_INT, M_OPT_RANGE, 0, 1, NULL},
619 {"chr-drop", ST_OFF(v_chr_drop), CONF_TYPE_INT, M_OPT_RANGE, 0, 3, NULL},
620 {"param" , ST_OFF(param[0]), CONF_TYPE_DOUBLE, M_OPT_RANGE, 0.0, 100.0, NULL},
621 {"param2", ST_OFF(param[1]), CONF_TYPE_DOUBLE, M_OPT_RANGE, 0.0, 100.0, NULL},
622 // Note that here the 2 field is NULL (ie 0)
623 // As we want this option to act on the option struct itself
624 {"presize", 0, CONF_TYPE_OBJ_PRESETS, 0, 0, 0, &size_preset},
625 {"noup", ST_OFF(noup), CONF_TYPE_INT, M_OPT_RANGE, 0, 2, NULL},
626 {"arnd", ST_OFF(accurate_rnd), CONF_TYPE_FLAG, 0, 0, 1, NULL},
627 { NULL, NULL, 0, 0, 0, 0, NULL }
630 static m_struct_t vf_opts = {
631 "scale",
632 sizeof(struct vf_priv_s),
633 &vf_priv_dflt,
634 vf_opts_fields
637 vf_info_t vf_info_scale = {
638 "software scaling",
639 "scale",
640 "A'rpi",
642 open,
643 &vf_opts
646 //===========================================================================//