mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 784329 - Part 6: Add color conversion function for OMX_TI_COLOR_FormatYUV420PackedSemiPlanar. r=doublec
This commit is contained in:
parent
034100b25c
commit
6c88a91bf1
@ -140,6 +140,7 @@ class OmxDecoder {
|
||||
void ToVideoFrame_CbYCrY(VideoFrame *aFrame, int64_t aTimeUs, void *aData, size_t aSize, bool aKeyFrame);
|
||||
void ToVideoFrame_YUV420SemiPlanar(VideoFrame *aFrame, int64_t aTimeUs, void *aData, size_t aSize, bool aKeyFrame);
|
||||
void ToVideoFrame_YVU420SemiPlanar(VideoFrame *aFrame, int64_t aTimeUs, void *aData, size_t aSize, bool aKeyFrame);
|
||||
void ToVideoFrame_YUV420PackedSemiPlanar(VideoFrame *aFrame, int64_t aTimeUs, void *aData, size_t aSize, bool aKeyFrame);
|
||||
void ToVideoFrame_YVU420PackedSemiPlanar32m4ka(VideoFrame *aFrame, int64_t aTimeUs, void *aData, size_t aSize, bool aKeyFrame);
|
||||
bool ToVideoFrame(VideoFrame *aFrame, int64_t aTimeUs, void *aData, size_t aSize, bool aKeyFrame);
|
||||
bool ToAudioFrame(AudioFrame *aFrame, int64_t aTimeUs, void *aData, size_t aDataOffset, size_t aSize,
|
||||
@ -524,6 +525,16 @@ void OmxDecoder::ToVideoFrame_YVU420SemiPlanar(VideoFrame *aFrame, int64_t aTime
|
||||
aFrame->Cr.mOffset = 0;
|
||||
}
|
||||
|
||||
void OmxDecoder::ToVideoFrame_YUV420PackedSemiPlanar(VideoFrame *aFrame, int64_t aTimeUs, void *aData, size_t aSize, bool aKeyFrame) {
|
||||
void *y = aData;
|
||||
void *uv = static_cast<uint8_t *>(y) + mVideoStride * (mVideoSliceHeight - mVideoCropTop/2);
|
||||
aFrame->Set(aTimeUs, aKeyFrame,
|
||||
aData, aSize, mVideoStride, mVideoSliceHeight, mVideoRotation,
|
||||
y, mVideoStride, mVideoWidth, mVideoHeight, 0, 0,
|
||||
uv, mVideoStride, mVideoWidth/2, mVideoHeight/2, 0, 1,
|
||||
uv, mVideoStride, mVideoWidth/2, mVideoHeight/2, 1, 1);
|
||||
}
|
||||
|
||||
void OmxDecoder::ToVideoFrame_YVU420PackedSemiPlanar32m4ka(VideoFrame *aFrame, int64_t aTimeUs, void *aData, size_t aSize, bool aKeyFrame) {
|
||||
size_t roundedSliceHeight = (mVideoSliceHeight + 31) & ~31;
|
||||
size_t roundedStride = (mVideoStride + 31) & ~31;
|
||||
@ -553,6 +564,9 @@ bool OmxDecoder::ToVideoFrame(VideoFrame *aFrame, int64_t aTimeUs, void *aData,
|
||||
case OMX_QCOM_COLOR_FormatYVU420PackedSemiPlanar32m4ka: // e.g. Otoro
|
||||
ToVideoFrame_YVU420PackedSemiPlanar32m4ka(aFrame, aTimeUs, aData, aSize, aKeyFrame);
|
||||
break;
|
||||
case OMX_TI_COLOR_FormatYUV420PackedSemiPlanar: // e.g. Galaxy Nexus
|
||||
ToVideoFrame_YUV420PackedSemiPlanar(aFrame, aTimeUs, aData, aSize, aKeyFrame);
|
||||
break;
|
||||
default:
|
||||
LOG("Unknown video color format: %#x", mVideoColorFormat);
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user