@@ -521,18 +521,6 @@ PVideoFrame __stdcall Overlay::GetFrame(int n, IScriptEnvironment *env) {
521521 #endif
522522#endif
523523 }
524-
525- // here img->frame is 444
526- // apply fast conversion
527- if ((pixelsize==1 ) && outputVi->Is420 ())
528- {
529- PVideoFrame outputFrame = env->NewVideoFrame (*outputVi);
530- Convert444ToYV12 (frame, outputFrame, pixelsize, bits_per_pixel, env);
531- } else if (outputVi->IsYUY2 ()) {
532- PVideoFrame outputFrame = env->NewVideoFrame (*outputVi);
533- Convert444ToYUY2 (frame, outputFrame, pixelsize, bits_per_pixel, env);
534- }
535- // all other cases return 4:4:4
536524
537525 // Cleanup
538526 if (mask) {
@@ -548,6 +536,20 @@ PVideoFrame __stdcall Overlay::GetFrame(int n, IScriptEnvironment *env) {
548536 img->free_all ();
549537 delete img;
550538 }
539+
540+ // here img->frame is 444
541+ // apply fast conversion
542+ if ((pixelsize==1 ) && outputVi->Is420 ())
543+ {
544+ PVideoFrame outputFrame = env->NewVideoFrame (*outputVi);
545+ Convert444ToYV12 (frame, outputFrame, pixelsize, bits_per_pixel, env);
546+ return outputFrame;
547+ } else if (outputVi->IsYUY2 ()) {
548+ PVideoFrame outputFrame = env->NewVideoFrame (*outputVi);
549+ Convert444ToYUY2 (frame, outputFrame, pixelsize, bits_per_pixel, env);
550+ return outputFrame;
551+ }
552+ // all other cases return 4:4:4
551553#ifndef USE_ORIG_FRAME
552554 return frameOutput;
553555#else
0 commit comments