-
- switch ( *format )
- {
- case mlt_image_yuv422:
- bpp = 2;
- break;
- case mlt_image_rgb24:
- bpp = 3;
- break;
- case mlt_image_rgb24a:
- case mlt_image_opengl:
- bpp = 4;
- break;
- default:
- // XXX: we only know how to resize packed formats
- return 1;
- }
-
- // Provides a manual override for misreported field order
- if ( mlt_properties_get( properties, "meta.top_field_first" ) )
- mlt_properties_set_int( properties, "top_field_first", mlt_properties_get_int( properties, "meta.top_field_first" ) );
-
- // Correct field order if needed
- if ( mlt_properties_get_int( properties, "top_field_first" ) == 1 &&
- mlt_properties_get( properties, "progressive" ) &&
- mlt_properties_get_int( properties, "progressive" ) == 0 )
- {
- // Get the input image, width and height
- int size = owidth * oheight * bpp;
- uint8_t *ptr = *image + owidth * bpp;
- memmove( ptr, *image, size - owidth * bpp );
-
- // Set the normalised field order
- mlt_properties_set_int( properties, "top_field_first", 0 );
- mlt_properties_set_int( properties, "meta.top_field_first", 0 );
- }
-
- if ( !strcmp( op, "affine" ) )
- {
- // TODO: Determine where this is needed and find a different way
- // *image = mlt_frame_rescale_image( this, *width, *height, bpp );
- }
- else if ( strcmp( op, "none" ) != 0 )
- {
- *image = frame_resize_image( this, *width, *height, bpp );
- }
- else
- {
- *width = owidth;
- *height = oheight;
- }
+ mlt_image_format_size( *format, owidth, oheight, &bpp );
+ *image = frame_resize_image( frame, *width, *height, bpp );