Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dirty fix for #3404 #4456

Merged
merged 3 commits into from Oct 21, 2015
Merged

Conversation

like-a-bause
Copy link

new setFromAlignedPixels gets taken when PixelFormat == OF_PIXELS_I420.

@arturoc
Copy link
Member

arturoc commented Oct 20, 2015

thanks, can you add a check for the format and number of samples, something like:

switch(pixelFormat){
case OF_PIXELS_I420:
if(samples.size() != 3){
    ofLogError("ofPixels") << "number of planes for I420 should be 3";
}
...
break;
default:
    ofLogError("ofPixels") << "setFromAlignedPixels with planes strides: pixel format not supported yet";
break;
}

also if we could have an option to send anything without planes to the simpler setFromAligned liek:

case OF_PIXELS_RGB:
case OF_PIXELS_RGBA:
case OF_PIXELS_GRAY:
case OF_PIXELS_GRAY_ALPHA:
    setFromAlignedPixels(pixels,w,h,pixelFormat,strides[0]);

int channels = channelsFromPixelFormat(_pixelFormat);
if(channels==0) return;

if(width*channels==strides[0]){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't make much sense for I420 since it doesn't have channels. something like:

if(width==strides[0] && width/2==strides[1] && width/2==strides[2])

would be a better check

@like-a-bause
Copy link
Author

i added the stride size checks. Should the format and number checks go into ofPixels::setFromAlignedPixels or ofGstUtils::process_sample? How do I get samples.size()? Or do you mean strides.size() ?

@like-a-bause
Copy link
Author

Ok i assume you meant strides.size() != 3
implemented that.

@arturoc
Copy link
Member

arturoc commented Oct 21, 2015

yeah sorry i meant strides, looks great now thanks! i'll let the tests run and then merge it

arturoc added a commit that referenced this pull request Oct 21, 2015
@arturoc arturoc merged commit ceba3f7 into openframeworks:master Oct 21, 2015
@arturoc
Copy link
Member

arturoc commented Oct 21, 2015

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants