Skip to content

Commit b54a6be

Browse files
PinterfPinterf
authored andcommitted
Fix Overlay for 8 bit YV12
1 parent 0476aa9 commit b54a6be

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

avs_core/filters/overlay/444convert.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,6 @@ static void convert_yv24_chroma_to_yv12_c(BYTE *dstp8, const BYTE *srcp8, int ds
550550

551551
void Convert444ToYV12(PVideoFrame &src, PVideoFrame &dst, int pixelsize, int bits_per_pixel, IScriptEnvironment* env)
552552
{
553-
// env->MakeWritable(&dst); already writeable
554-
555553
env->BitBlt(dst->GetWritePtr(PLANAR_Y), dst->GetPitch(PLANAR_Y),
556554
src->GetReadPtr(PLANAR_Y), src->GetPitch(), dst->GetRowSize(PLANAR_Y), dst->GetHeight());
557555

avs_core/filters/overlay/overlay.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)