typo fixes
[mplayer/greg.git] / libmpcodecs / vf_scale.c
blob6dd093251ab22f538f665c575f5858d1839691a2
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"
14 #include "libvo/fastmemcpy.h"
15 #include "postproc/swscale.h"
16 #include "vf_scale.h"
18 #include "m_option.h"
19 #include "m_struct.h"
21 static struct vf_priv_s {
22 int w,h;
23 int v_chr_drop;
24 double param[2];
25 unsigned int fmt;
26 struct SwsContext *ctx;
27 struct SwsContext *ctx2; //for interlaced slices only
28 unsigned char* palette;
29 int interlaced;
30 int noup;
31 int query_format_cache[64];
32 } vf_priv_dflt = {
33 -1,-1,
35 {SWS_PARAM_DEFAULT, SWS_PARAM_DEFAULT},
37 NULL,
38 NULL,
39 NULL
42 extern int opt_screen_size_x;
43 extern int opt_screen_size_y;
44 extern float screen_size_xy;
46 //===========================================================================//
48 void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, SwsFilter **dstFilterParam);
50 static unsigned int outfmt_list[]={
51 // YUV:
52 IMGFMT_444P,
53 IMGFMT_422P,
54 IMGFMT_YV12,
55 IMGFMT_I420,
56 IMGFMT_IYUV,
57 IMGFMT_YVU9,
58 IMGFMT_IF09,
59 IMGFMT_411P,
60 IMGFMT_NV12,
61 IMGFMT_NV21,
62 IMGFMT_YUY2,
63 IMGFMT_UYVY,
64 // RGB and grayscale (Y8 and Y800):
65 IMGFMT_BGR32,
66 IMGFMT_RGB32,
67 IMGFMT_BGR24,
68 IMGFMT_RGB24,
69 IMGFMT_BGR16,
70 IMGFMT_RGB16,
71 IMGFMT_BGR15,
72 IMGFMT_RGB15,
73 IMGFMT_Y800,
74 IMGFMT_Y8,
75 IMGFMT_BGR8,
76 IMGFMT_RGB8,
77 IMGFMT_BGR4,
78 IMGFMT_RGB4,
79 IMGFMT_BG4B,
80 IMGFMT_RG4B,
81 IMGFMT_BGR1,
82 IMGFMT_RGB1,
86 static unsigned int find_best_out(vf_instance_t *vf){
87 unsigned int best=0;
88 int i;
90 // find the best outfmt:
91 for(i=0; i<sizeof(outfmt_list)/sizeof(int)-1; i++){
92 const int format= outfmt_list[i];
93 int ret= vf->priv->query_format_cache[i]-1;
94 if(ret == -1){
95 ret= vf_next_query_format(vf, outfmt_list[i]);
96 vf->priv->query_format_cache[i]= ret+1;
99 mp_msg(MSGT_VFILTER,MSGL_DBG2,"scale: query(%s) -> %d\n",vo_format_name(format),ret&3);
100 if(ret&VFCAP_CSP_SUPPORTED_BY_HW){
101 best=format; // no conversion -> bingo!
102 break;
104 if(ret&VFCAP_CSP_SUPPORTED && !best)
105 best=format; // best with conversion
107 return best;
110 static int config(struct vf_instance_s* vf,
111 int width, int height, int d_width, int d_height,
112 unsigned int flags, unsigned int outfmt){
113 unsigned int best=find_best_out(vf);
114 int vo_flags;
115 int int_sws_flags=0;
116 int round_w=0, round_h=0;
117 SwsFilter *srcFilter, *dstFilter;
119 if(!best){
120 mp_msg(MSGT_VFILTER,MSGL_WARN,"SwScale: no supported outfmt found :(\n");
121 return 0;
124 vo_flags=vf->next->query_format(vf->next,best);
126 // scaling to dwidth*d_height, if all these TRUE:
127 // - option -zoom
128 // - no other sw/hw up/down scaling avail.
129 // - we're after postproc
130 // - user didn't set w:h
131 if(!(vo_flags&VFCAP_POSTPROC) && (flags&4) &&
132 vf->priv->w<0 && vf->priv->h<0){ // -zoom
133 int x=(vo_flags&VFCAP_SWSCALE) ? 0 : 1;
134 if(d_width<width || d_height<height){
135 // downscale!
136 if(vo_flags&VFCAP_HWSCALE_DOWN) x=0;
137 } else {
138 // upscale:
139 if(vo_flags&VFCAP_HWSCALE_UP) x=0;
141 if(x){
142 // user wants sw scaling! (-zoom)
143 vf->priv->w=d_width;
144 vf->priv->h=d_height;
148 if(vf->priv->noup){
149 if((vf->priv->w > width) + (vf->priv->h > height) >= vf->priv->noup){
150 vf->priv->w= width;
151 vf->priv->h= height;
155 if (vf->priv->w <= -8) {
156 vf->priv->w += 8;
157 round_w = 1;
159 if (vf->priv->h <= -8) {
160 vf->priv->h += 8;
161 round_h = 1;
164 if (vf->priv->w < -3 || vf->priv->h < -3 ||
165 (vf->priv->w < -1 && vf->priv->h < -1)) {
166 // TODO: establish a direct connection to the user's brain
167 // and find out what the heck he thinks MPlayer should do
168 // with this nonsense.
169 mp_msg(MSGT_VFILTER, MSGL_ERR, "SwScale: EUSERBROKEN Check your parameters, they make no sense!\n");
170 return 0;
173 if (vf->priv->w == -1)
174 vf->priv->w = width;
175 if (vf->priv->w == 0)
176 vf->priv->w = d_width;
178 if (vf->priv->h == -1)
179 vf->priv->h = height;
180 if (vf->priv->h == 0)
181 vf->priv->h = d_height;
183 if (vf->priv->w == -3)
184 vf->priv->w = vf->priv->h * width / height;
185 if (vf->priv->w == -2)
186 vf->priv->w = vf->priv->h * d_width / d_height;
188 if (vf->priv->h == -3)
189 vf->priv->h = vf->priv->w * height / width;
190 if (vf->priv->h == -2)
191 vf->priv->h = vf->priv->w * d_height / d_width;
193 if (round_w)
194 vf->priv->w = ((vf->priv->w + 8) / 16) * 16;
195 if (round_h)
196 vf->priv->h = ((vf->priv->h + 8) / 16) * 16;
198 // calculate the missing parameters:
199 switch(best) {
200 case IMGFMT_YV12: /* YV12 needs w & h rounded to 2 */
201 case IMGFMT_I420:
202 case IMGFMT_IYUV:
203 case IMGFMT_NV12:
204 case IMGFMT_NV21:
205 vf->priv->h = (vf->priv->h + 1) & ~1;
206 case IMGFMT_YUY2: /* YUY2 needs w rounded to 2 */
207 case IMGFMT_UYVY:
208 vf->priv->w = (vf->priv->w + 1) & ~1;
211 mp_msg(MSGT_VFILTER,MSGL_DBG2,"SwScale: scaling %dx%d %s to %dx%d %s \n",
212 width,height,vo_format_name(outfmt),
213 vf->priv->w,vf->priv->h,vo_format_name(best));
215 // free old ctx:
216 if(vf->priv->ctx) sws_freeContext(vf->priv->ctx);
217 if(vf->priv->ctx2)sws_freeContext(vf->priv->ctx2);
219 // new swscaler:
220 sws_getFlagsAndFilterFromCmdLine(&int_sws_flags, &srcFilter, &dstFilter);
221 int_sws_flags|= vf->priv->v_chr_drop << SWS_SRC_V_CHR_DROP_SHIFT;
222 vf->priv->ctx=sws_getContext(width, height >> vf->priv->interlaced,
223 outfmt,
224 vf->priv->w, vf->priv->h >> vf->priv->interlaced,
225 best,
226 int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param);
227 if(vf->priv->interlaced){
228 vf->priv->ctx2=sws_getContext(width, height >> 1,
229 outfmt,
230 vf->priv->w, vf->priv->h >> 1,
231 best,
232 int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param);
234 if(!vf->priv->ctx){
235 // error...
236 mp_msg(MSGT_VFILTER,MSGL_WARN,"Couldn't init SwScaler for this setup\n");
237 return 0;
239 vf->priv->fmt=best;
241 if(vf->priv->palette){
242 free(vf->priv->palette);
243 vf->priv->palette=NULL;
245 switch(best){
246 case IMGFMT_BGR8: {
247 /* set 332 palette for 8 bpp */
248 int i;
249 vf->priv->palette=malloc(4*256);
250 for(i=0; i<256; i++){
251 vf->priv->palette[4*i+0]=4*(i&3)*21;
252 vf->priv->palette[4*i+1]=4*((i>>2)&7)*9;
253 vf->priv->palette[4*i+2]=4*((i>>5)&7)*9;
255 break; }
256 case IMGFMT_BGR4:
257 case IMGFMT_BG4B: {
258 int i;
259 vf->priv->palette=malloc(4*16);
260 for(i=0; i<16; i++){
261 vf->priv->palette[4*i+0]=4*(i&1)*63;
262 vf->priv->palette[4*i+1]=4*((i>>1)&3)*21;
263 vf->priv->palette[4*i+2]=4*((i>>3)&1)*63;
265 break; }
268 if(!opt_screen_size_x && !opt_screen_size_y && !(screen_size_xy >= 0.001)){
269 // Compute new d_width and d_height, preserving aspect
270 // while ensuring that both are >= output size in pixels.
271 if (vf->priv->h * d_width > vf->priv->w * d_height) {
272 d_width = vf->priv->h * d_width / d_height;
273 d_height = vf->priv->h;
274 } else {
275 d_height = vf->priv->w * d_height / d_width;
276 d_width = vf->priv->w;
278 //d_width=d_width*vf->priv->w/width;
279 //d_height=d_height*vf->priv->h/height;
281 return vf_next_config(vf,vf->priv->w,vf->priv->h,d_width,d_height,flags,best);
284 static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){
285 // printf("start_slice called! flag=%d\n",mpi->flags&MP_IMGFLAG_DRAW_CALLBACK);
286 if(!(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)) return; // shouldn't happen
287 // they want slices!!! allocate the buffer.
288 mpi->priv=vf->dmpi=vf_get_image(vf->next,vf->priv->fmt,
289 // mpi->type, mpi->flags & (~MP_IMGFLAG_DRAW_CALLBACK),
290 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
291 vf->priv->w, vf->priv->h);
294 static void scale(struct SwsContext *sws1, struct SwsContext *sws2, uint8_t *src[3], int src_stride[3], int y, int h,
295 uint8_t *dst[3], int dst_stride[3], int interlaced){
296 if(interlaced){
297 int i;
298 uint8_t *src2[3]={src[0], src[1], src[2]};
299 uint8_t *dst2[3]={dst[0], dst[1], dst[2]};
300 int src_stride2[3]={2*src_stride[0], 2*src_stride[1], 2*src_stride[2]};
301 int dst_stride2[3]={2*dst_stride[0], 2*dst_stride[1], 2*dst_stride[2]};
303 sws_scale_ordered(sws1, src2, src_stride2, y>>1, h>>1, dst2, dst_stride2);
304 for(i=0; i<3; i++){
305 src2[i] += src_stride[i];
306 dst2[i] += dst_stride[i];
308 sws_scale_ordered(sws2, src2, src_stride2, y>>1, h>>1, dst2, dst_stride2);
309 }else{
310 sws_scale_ordered(sws1, src, src_stride, y, h, dst, dst_stride);
314 static void draw_slice(struct vf_instance_s* vf,
315 unsigned char** src, int* stride, int w,int h, int x, int y){
316 mp_image_t *dmpi=vf->dmpi;
317 if(!dmpi){
318 mp_msg(MSGT_VFILTER,MSGL_FATAL,"vf_scale: draw_slice() called with dmpi=NULL (no get_image??)\n");
319 return;
321 // printf("vf_scale::draw_slice() y=%d h=%d\n",y,h);
322 scale(vf->priv->ctx, vf->priv->ctx2, src, stride, y, h, dmpi->planes, dmpi->stride, vf->priv->interlaced);
325 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
326 mp_image_t *dmpi=mpi->priv;
328 // printf("vf_scale::put_image(): processing whole frame! dmpi=%p flag=%d\n",
329 // dmpi, (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK));
331 if(!(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK && dmpi)){
333 // hope we'll get DR buffer:
334 dmpi=vf_get_image(vf->next,vf->priv->fmt,
335 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
336 vf->priv->w, vf->priv->h);
338 scale(vf->priv->ctx, vf->priv->ctx, mpi->planes,mpi->stride,0,mpi->h,dmpi->planes,dmpi->stride, vf->priv->interlaced);
341 if(vf->priv->w==mpi->w && vf->priv->h==mpi->h){
342 // just conversion, no scaling -> keep postprocessing data
343 // this way we can apply pp filter to non-yv12 source using scaler
344 vf_clone_mpi_attributes(dmpi, mpi);
347 if(vf->priv->palette) dmpi->planes[1]=vf->priv->palette; // export palette!
349 return vf_next_put_image(vf,dmpi, pts);
352 static int control(struct vf_instance_s* vf, int request, void* data){
353 int *table;
354 int *inv_table;
355 int r;
356 int brightness, contrast, saturation, srcRange, dstRange;
357 vf_equalizer_t *eq;
359 if(vf->priv->ctx)
360 switch(request){
361 case VFCTRL_GET_EQUALIZER:
362 r= sws_getColorspaceDetails(vf->priv->ctx, &inv_table, &srcRange, &table, &dstRange, &brightness, &contrast, &saturation);
363 if(r<0) break;
365 eq = data;
366 if (!strcmp(eq->item,"brightness")) {
367 eq->value = ((brightness*100) + (1<<15))>>16;
369 else if (!strcmp(eq->item,"contrast")) {
370 eq->value = (((contrast *100) + (1<<15))>>16) - 100;
372 else if (!strcmp(eq->item,"saturation")) {
373 eq->value = (((saturation*100) + (1<<15))>>16) - 100;
375 else
376 break;
377 return CONTROL_TRUE;
378 case VFCTRL_SET_EQUALIZER:
379 r= sws_getColorspaceDetails(vf->priv->ctx, &inv_table, &srcRange, &table, &dstRange, &brightness, &contrast, &saturation);
380 if(r<0) break;
381 //printf("set %f %f %f\n", brightness/(float)(1<<16), contrast/(float)(1<<16), saturation/(float)(1<<16));
382 eq = data;
384 if (!strcmp(eq->item,"brightness")) {
385 brightness = (( eq->value <<16) + 50)/100;
387 else if (!strcmp(eq->item,"contrast")) {
388 contrast = (((eq->value+100)<<16) + 50)/100;
390 else if (!strcmp(eq->item,"saturation")) {
391 saturation = (((eq->value+100)<<16) + 50)/100;
393 else
394 break;
396 r= sws_setColorspaceDetails(vf->priv->ctx, inv_table, srcRange, table, dstRange, brightness, contrast, saturation);
397 if(r<0) break;
398 if(vf->priv->ctx2){
399 r= sws_setColorspaceDetails(vf->priv->ctx2, inv_table, srcRange, table, dstRange, brightness, contrast, saturation);
400 if(r<0) break;
403 return CONTROL_TRUE;
404 default:
405 break;
408 return vf_next_control(vf,request,data);
411 //===========================================================================//
413 // supported Input formats: YV12, I420, IYUV, YUY2, UYVY, BGR32, BGR24, BGR16, BGR15, RGB32, RGB24, Y8, Y800
415 static int query_format(struct vf_instance_s* vf, unsigned int fmt){
416 switch(fmt){
417 case IMGFMT_YV12:
418 case IMGFMT_I420:
419 case IMGFMT_IYUV:
420 case IMGFMT_UYVY:
421 case IMGFMT_YUY2:
422 case IMGFMT_BGR32:
423 case IMGFMT_BGR24:
424 case IMGFMT_BGR16:
425 case IMGFMT_BGR15:
426 case IMGFMT_RGB32:
427 case IMGFMT_RGB24:
428 case IMGFMT_Y800:
429 case IMGFMT_Y8:
430 case IMGFMT_YVU9:
431 case IMGFMT_IF09:
432 case IMGFMT_444P:
433 case IMGFMT_422P:
434 case IMGFMT_411P:
436 unsigned int best=find_best_out(vf);
437 int flags;
438 if(!best) return 0; // no matching out-fmt
439 flags=vf_next_query_format(vf,best);
440 if(!(flags&(VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW))) return 0; // huh?
441 if(fmt!=best) flags&=~VFCAP_CSP_SUPPORTED_BY_HW;
442 // do not allow scaling, if we are before the PP fliter!
443 if(!(flags&VFCAP_POSTPROC)) flags|=VFCAP_SWSCALE;
444 return flags;
447 return 0; // nomatching in-fmt
450 static void uninit(struct vf_instance_s *vf){
451 if(vf->priv->ctx) sws_freeContext(vf->priv->ctx);
452 if(vf->priv->ctx2) sws_freeContext(vf->priv->ctx2);
453 if(vf->priv->palette) free(vf->priv->palette);
454 free(vf->priv);
457 static int open(vf_instance_t *vf, char* args){
458 vf->config=config;
459 vf->start_slice=start_slice;
460 vf->draw_slice=draw_slice;
461 vf->put_image=put_image;
462 vf->query_format=query_format;
463 vf->control= control;
464 vf->uninit=uninit;
465 if(!vf->priv) {
466 vf->priv=malloc(sizeof(struct vf_priv_s));
467 // TODO: parse args ->
468 vf->priv->ctx=NULL;
469 vf->priv->ctx2=NULL;
470 vf->priv->w=
471 vf->priv->h=-1;
472 vf->priv->v_chr_drop=0;
473 vf->priv->param[0]=
474 vf->priv->param[1]=SWS_PARAM_DEFAULT;
475 vf->priv->palette=NULL;
476 } // if(!vf->priv)
477 if(args) sscanf(args, "%d:%d:%d:%lf:%lf",
478 &vf->priv->w,
479 &vf->priv->h,
480 &vf->priv->v_chr_drop,
481 &vf->priv->param[0],
482 &vf->priv->param[1]);
483 mp_msg(MSGT_VFILTER,MSGL_V,"SwScale params: %d x %d (-1=no scaling)\n",
484 vf->priv->w,
485 vf->priv->h);
487 return 1;
490 //global sws_flags from the command line
491 int sws_flags=2;
493 //global srcFilter
494 static SwsFilter *src_filter= NULL;
496 float sws_lum_gblur= 0.0;
497 float sws_chr_gblur= 0.0;
498 int sws_chr_vshift= 0;
499 int sws_chr_hshift= 0;
500 float sws_chr_sharpen= 0.0;
501 float sws_lum_sharpen= 0.0;
503 int get_sws_cpuflags(void){
504 return
505 (gCpuCaps.hasMMX ? SWS_CPU_CAPS_MMX : 0)
506 | (gCpuCaps.hasMMX2 ? SWS_CPU_CAPS_MMX2 : 0)
507 | (gCpuCaps.has3DNow ? SWS_CPU_CAPS_3DNOW : 0)
508 | (gCpuCaps.hasAltiVec ? SWS_CPU_CAPS_ALTIVEC : 0);
511 void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, SwsFilter **dstFilterParam)
513 static int firstTime=1;
514 *flags=0;
516 #ifdef ARCH_X86
517 if(gCpuCaps.hasMMX)
518 asm volatile("emms\n\t"::: "memory"); //FIXME this shouldnt be required but it IS (even for non mmx versions)
519 #endif
520 if(firstTime)
522 firstTime=0;
523 *flags= SWS_PRINT_INFO;
525 else if( mp_msg_test(MSGT_VFILTER,MSGL_DBG2) ) *flags= SWS_PRINT_INFO;
527 if(src_filter) sws_freeFilter(src_filter);
529 src_filter= sws_getDefaultFilter(
530 sws_lum_gblur, sws_chr_gblur,
531 sws_lum_sharpen, sws_chr_sharpen,
532 sws_chr_hshift, sws_chr_vshift, verbose>1);
534 switch(sws_flags)
536 case 0: *flags|= SWS_FAST_BILINEAR; break;
537 case 1: *flags|= SWS_BILINEAR; break;
538 case 2: *flags|= SWS_BICUBIC; break;
539 case 3: *flags|= SWS_X; break;
540 case 4: *flags|= SWS_POINT; break;
541 case 5: *flags|= SWS_AREA; break;
542 case 6: *flags|= SWS_BICUBLIN; break;
543 case 7: *flags|= SWS_GAUSS; break;
544 case 8: *flags|= SWS_SINC; break;
545 case 9: *flags|= SWS_LANCZOS; break;
546 case 10:*flags|= SWS_SPLINE; break;
547 default:*flags|= SWS_BILINEAR; break;
550 *srcFilterParam= src_filter;
551 *dstFilterParam= NULL;
554 // will use sws_flags & src_filter (from cmd line)
555 struct SwsContext *sws_getContextFromCmdLine(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat)
557 int flags;
558 SwsFilter *dstFilterParam, *srcFilterParam;
559 sws_getFlagsAndFilterFromCmdLine(&flags, &srcFilterParam, &dstFilterParam);
561 return sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags | get_sws_cpuflags(), srcFilterParam, dstFilterParam, NULL);
564 /// An example of presets usage
565 static struct size_preset {
566 char* name;
567 int w, h;
568 } vf_size_presets_defs[] = {
569 // TODO add more 'standard' resolutions
570 { "qntsc", 352, 240 },
571 { "qpal", 352, 288 },
572 { "ntsc", 720, 480 },
573 { "pal", 720, 576 },
574 { "sntsc", 640, 480 },
575 { "spal", 768, 576 },
576 { NULL, 0, 0}
579 #define ST_OFF(f) M_ST_OFF(struct size_preset,f)
580 static m_option_t vf_size_preset_fields[] = {
581 {"w", ST_OFF(w), CONF_TYPE_INT, M_OPT_MIN,1 ,0, NULL},
582 {"h", ST_OFF(h), CONF_TYPE_INT, M_OPT_MIN,1 ,0, NULL},
583 { NULL, NULL, 0, 0, 0, 0, NULL }
586 static m_struct_t vf_size_preset = {
587 "scale_size_preset",
588 sizeof(struct size_preset),
589 NULL,
590 vf_size_preset_fields
593 static m_struct_t vf_opts;
594 static m_obj_presets_t size_preset = {
595 &vf_size_preset, // Input struct desc
596 &vf_opts, // Output struct desc
597 vf_size_presets_defs, // The list of presets
598 ST_OFF(name) // At wich offset is the name field in the preset struct
601 /// Now the options
602 #undef ST_OFF
603 #define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
604 static m_option_t vf_opts_fields[] = {
605 {"w", ST_OFF(w), CONF_TYPE_INT, M_OPT_MIN,-11,0, NULL},
606 {"h", ST_OFF(h), CONF_TYPE_INT, M_OPT_MIN,-11,0, NULL},
607 {"interlaced", ST_OFF(interlaced), CONF_TYPE_INT, M_OPT_RANGE, 0, 1, NULL},
608 {"chr-drop", ST_OFF(v_chr_drop), CONF_TYPE_INT, M_OPT_RANGE, 0, 3, NULL},
609 {"param" , ST_OFF(param[0]), CONF_TYPE_DOUBLE, M_OPT_RANGE, 0.0, 100.0, NULL},
610 {"param2", ST_OFF(param[1]), CONF_TYPE_DOUBLE, M_OPT_RANGE, 0.0, 100.0, NULL},
611 // Note that here the 2 field is NULL (ie 0)
612 // As we want this option to act on the option struct itself
613 {"presize", 0, CONF_TYPE_OBJ_PRESETS, 0, 0, 0, &size_preset},
614 {"noup", ST_OFF(noup), CONF_TYPE_INT, M_OPT_RANGE, 0, 1, NULL},
615 { NULL, NULL, 0, 0, 0, 0, NULL }
618 static m_struct_t vf_opts = {
619 "scale",
620 sizeof(struct vf_priv_s),
621 &vf_priv_dflt,
622 vf_opts_fields
625 vf_info_t vf_info_scale = {
626 "software scaling",
627 "scale",
628 "A'rpi",
630 open,
631 &vf_opts
634 //===========================================================================//