Menu

#1 doesn't read YV12 files properly

open-accepted
None
5
2014-08-26
2010-09-02
Anonymous
No

the current version allocates and sets the length of the byte[] array returned in getFrame to be "frame->GetPitch() * frame->GetHeight()". This isn't correct for planar colorspaces with reduced color resolution (e.g. like YV12).

A simple fix for YV12 is something like this (tested and implemented):

"
// Construct the java byte array for return
int length = frame->GetPitch() * frame->GetHeight();
if ((*venv->clip)->GetVideoInfo().IsYV12())
length += (frame->GetPitch() * frame->GetHeight())/2;
"

you may want to adapt to something more generic to handle any colorspace with compressed color difference channels. You would need to know the resolutions for the Y, U, and V channels.

Discussion

  • Chris Ennis

    Chris Ennis - 2010-09-07

    I will take a look at this, but the original intent was to always convert to RGB for display in java. In fact the java code always appends a filter to convert to RGB if the format is not already RGB. The java code will also need to change to support YV12. Is there a need to get YV12 data in java for manipulation?

     
  • Chris Ennis

    Chris Ennis - 2010-09-07
    • assigned_to: nobody --> chris1ennis
    • status: open --> open-accepted
     

Log in to post a comment.