*width = 720;
if ( *height == 0 )
*height = 576;
+ if ( *width < 2 || *height < 6 )
+ return 1;
mlt_properties properties = mlt_frame_properties( this );
int iwidth = *width;
char *interps = mlt_properties_get( properties, "rescale.interp" );
int interp = PIXOPS_INTERP_BILINEAR;
- if ( strcmp( interps, "nearest" ) == 0 )
- interp = PIXOPS_INTERP_NEAREST;
- else if ( strcmp( interps, "tiles" ) == 0 )
- interp = PIXOPS_INTERP_TILES;
- else if ( strcmp( interps, "hyper" ) == 0 )
- interp = PIXOPS_INTERP_HYPER;
-
// If real_width/height exist, we want that as minimum information
if ( mlt_properties_get_int( properties, "real_width" ) )
{
}
// Let the producer know what we are actually requested to obtain
- mlt_properties_set_int( properties, "rescale_width", *width );
- mlt_properties_set_int( properties, "rescale_height", *height );
+ if ( *format == mlt_image_yuv422 && strcmp( interps, "none" ) )
+ {
+ mlt_properties_set_int( properties, "rescale_width", *width );
+ mlt_properties_set_int( properties, "rescale_height", *height );
+ }
+ else
+ {
+ // When no scaling is requested, revert the requested dimensions if possible
+ mlt_properties_set_int( properties, "rescale_width", ( iwidth / 2 ) * 2 );
+ mlt_properties_set_int( properties, "rescale_height", ( iheight / 2 ) * 2 );
+ }
// Get the image as requested
mlt_frame_get_image( this, &input, format, &iwidth, &iheight, writable );
+ // Get rescale interpretation again, in case the producer wishes to override scaling
+ interps = mlt_properties_get( properties, "rescale.interp" );
+
+ if ( strcmp( interps, "nearest" ) == 0 )
+ interp = PIXOPS_INTERP_NEAREST;
+ else if ( strcmp( interps, "tiles" ) == 0 )
+ interp = PIXOPS_INTERP_TILES;
+ else if ( strcmp( interps, "hyper" ) == 0 )
+ interp = PIXOPS_INTERP_HYPER;
+
if ( input != NULL )
{
// If width and height are correct, don't do anything
}
return this;
}
-