Skip to content

Commit

Permalink
ImageReader: neutral gray for 32bit float chroma
Browse files Browse the repository at this point in the history
  • Loading branch information
pinterf committed Mar 28, 2018
1 parent 54444c8 commit 38b61a2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions plugins/ImageSeq/ImageReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ void ImageReader::BlankFrame(PVideoFrame & frame)
std::fill_n((uint16_t *)frame->GetWritePtr(PLANAR_A), size / 2, max); // transparent alpha
}
else if (pixelsize == 4) { // float
float half = 0.5f;
const float half = 0.5f;
std::fill_n((float *)frame->GetWritePtr(PLANAR_G), size / 4, half); // Grey frame
std::fill_n((float *)frame->GetWritePtr(PLANAR_B), size / 4, half); // Grey frame
std::fill_n((float *)frame->GetWritePtr(PLANAR_R), size / 4, half); // Grey frame
Expand Down Expand Up @@ -561,13 +561,18 @@ void ImageReader::BlankFrame(PVideoFrame & frame)
}
}
else if (pixelsize == 4) { // float
float half = 0.5f;
const float half = 0.5f;
#ifdef FLOAT_CHROMA_IS_ZERO_CENTERED
const float halfUV = 0.0f;
#else
const float halfUV = 0.5f;
#endif
std::fill_n((float *)frame->GetWritePtr(), size / 4, half); // Grey frame

if (UVpitch) {
const int UVsize = UVpitch * frame->GetHeight(PLANAR_U);
std::fill_n((float *)frame->GetWritePtr(PLANAR_U), UVsize / 4, half); // Grey frame
std::fill_n((float *)frame->GetWritePtr(PLANAR_V), UVsize / 4, half); // Grey frame
std::fill_n((float *)frame->GetWritePtr(PLANAR_U), UVsize / 4, halfUV); // Grey frame
std::fill_n((float *)frame->GetWritePtr(PLANAR_V), UVsize / 4, halfUV); // Grey frame
}
}
}
Expand Down

0 comments on commit 38b61a2

Please sign in to comment.