@@ -344,6 +344,11 @@ static void finalize_movit_chain(mlt_service leaf_service, mlt_frame frame, mlt_
344344 YCBCR_OUTPUT_INTERLEAVED ,
345345 GL_UNSIGNED_SHORT );
346346 chain->effect_chain ->set_dither_bits (16 );
347+ } else if (format == mlt_image_rgba64) {
348+ output_format.color_space = COLORSPACE_sRGB;
349+ output_format.gamma_curve = getOutputGamma (properties);
350+ chain->effect_chain ->add_output (output_format, OUTPUT_ALPHA_FORMAT_POSTMULTIPLIED );
351+ chain->effect_chain ->set_dither_bits (16 );
347352 } else {
348353 output_format.color_space = COLORSPACE_sRGB;
349354 output_format.gamma_curve = getOutputGamma (properties);
@@ -480,22 +485,36 @@ static int movit_render(EffectChain *chain,
480485 }
481486
482487 GlslManager *glsl = GlslManager::get_instance ();
483- int error;
484- if (output_format == mlt_image_opengl_texture) {
488+ int error = 0 ;
489+
490+ switch (output_format) {
491+ case mlt_image_opengl_texture:
485492 error = glsl->render_frame_texture (chain, frame, width, height, image);
486- } else if (output_format == mlt_image_yuv444p10 || output_format == mlt_image_yuv420p10) {
493+ break ;
494+
495+ case mlt_image_yuv444p10:
496+ case mlt_image_yuv420p10:
487497 error = glsl->render_frame_ycbcr (chain, frame, width, height, image);
488498 if (!error && output_format != mlt_image_yuv444p10) {
489499 *format = mlt_image_yuv444p10;
490500 error = convert_on_cpu (frame, image, format, output_format);
491501 }
492- } else {
502+ break ;
503+
504+ case mlt_image_rgba64:
505+ error = glsl->render_frame_rgba64 (chain, frame, width, height, image);
506+ break ;
507+
508+ default :
509+ // Covers mlt_image_rgba and all other fallbacks.
493510 error = glsl->render_frame_rgba (chain, frame, width, height, image);
494511 if (!error && output_format != mlt_image_rgba) {
495512 *format = mlt_image_rgba;
496513 error = convert_on_cpu (frame, image, format, output_format);
497514 }
515+ break ;
498516 }
517+
499518 return error;
500519}
501520
@@ -513,42 +532,61 @@ static MltInput *create_input(mlt_properties properties,
513532 }
514533
515534 MltInput *input = new MltInput (format);
516- if (format == mlt_image_rgba) {
535+
536+ switch (format) {
537+ case mlt_image_rgba:
538+ case mlt_image_rgba64:
517539 // TODO: Get the color space if available.
518540 input->useFlatInput (FORMAT_RGBA_POSTMULTIPLIED_ALPHA , width, height);
519- } else if (format == mlt_image_rgb) {
541+ break ;
542+
543+ case mlt_image_rgb:
520544 // TODO: Get the color space if available.
521545 input->useFlatInput (FORMAT_RGB , width, height);
522- } else if (format == mlt_image_yuv420p) {
546+ break ;
547+
548+ case mlt_image_yuv420p: {
523549 ImageFormat image_format = {};
524550 YCbCrFormat ycbcr_format = {};
525551 get_format_from_properties (properties, &image_format, &ycbcr_format);
526552 ycbcr_format.chroma_subsampling_x = ycbcr_format.chroma_subsampling_y = 2 ;
527553 input->useYCbCrInput (image_format, ycbcr_format, width, height);
528- } else if (format == mlt_image_yuv422) {
554+ } break ;
555+
556+ case mlt_image_yuv422: {
529557 ImageFormat image_format = {};
530558 YCbCrFormat ycbcr_format = {};
531559 get_format_from_properties (properties, &image_format, &ycbcr_format);
532560 ycbcr_format.chroma_subsampling_x = 2 ;
533561 ycbcr_format.chroma_subsampling_y = 1 ;
534562 input->useYCbCrInput (image_format, ycbcr_format, width, height);
535- } else if (format == mlt_image_yuv420p10) {
563+ } break ;
564+
565+ case mlt_image_yuv420p10: {
536566 ImageFormat image_format = {};
537567 YCbCrFormat ycbcr_format = {};
538568 get_format_from_properties (properties, &image_format, &ycbcr_format);
539569 ycbcr_format.chroma_subsampling_x = 2 ;
540570 ycbcr_format.chroma_subsampling_y = 2 ;
541571 ycbcr_format.num_levels = 1024 ;
542572 input->useYCbCrInput (image_format, ycbcr_format, width, height);
543- } else if (format == mlt_image_yuv444p10) {
573+ } break ;
574+
575+ case mlt_image_yuv444p10: {
544576 ImageFormat image_format = {};
545577 YCbCrFormat ycbcr_format = {};
546578 get_format_from_properties (properties, &image_format, &ycbcr_format);
547579 ycbcr_format.chroma_subsampling_x = 1 ;
548580 ycbcr_format.chroma_subsampling_y = 1 ;
549581 ycbcr_format.num_levels = 1024 ;
550582 input->useYCbCrInput (image_format, ycbcr_format, width, height);
583+ } break ;
584+
585+ default :
586+ // Leave input configured with its default for unsupported/other formats.
587+ break ;
551588 }
589+
552590 return input;
553591}
554592
@@ -613,7 +651,7 @@ static int convert_image(mlt_frame frame,
613651 // If we're at the beginning of a series of Movit effects, store the input
614652 // sent into the chain.
615653 if (output_format == mlt_image_movit) {
616- if (*format != mlt_image_rgba && mlt_frame_get_alpha (frame)) {
654+ if (*format != mlt_image_rgba && *format != mlt_image_rgba64 && mlt_frame_get_alpha (frame)) {
617655 if (!convert_on_cpu (frame, image, format, mlt_image_rgba)) {
618656 *format = mlt_image_rgba;
619657 }
0 commit comments