diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-08-25 05:27:12 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2022-08-25 05:27:12 +0000 |
commit | 904afc3dbd074da28bbf0fd5e24ab16a7ff6bf5a (patch) | |
tree | 15aef77304ef3e40b08903057392d8ddef43520e | |
parent | 4821a06b487197cbd947a3d4a5e78e8f3a7cabc0 (diff) | |
parent | 85d91c948c959b69223078ea087d6765de9c15c6 (diff) | |
download | qemu-snap-temp-L29100000956122087.tar.gz |
Merge "Merge cherrypicks of [2195315] into emu-32-release." into emu-32-releasesnap-temp-L29100000956122087
4 files changed, 20 insertions, 44 deletions
diff --git a/android/android-emu/android/emulation/MediaH264DecoderGeneric.cpp b/android/android-emu/android/emulation/MediaH264DecoderGeneric.cpp index 2b63d10519..2ec9e57ffc 100644 --- a/android/android-emu/android/emulation/MediaH264DecoderGeneric.cpp +++ b/android/android-emu/android/emulation/MediaH264DecoderGeneric.cpp @@ -361,26 +361,12 @@ void MediaH264DecoderGeneric::getImage(void* ptr) { } // update color aspects - if (pFrame->color.range != 0) { - if (3 - pFrame->color.range != mMetadata.range) { - mMetadata.range = 3 - pFrame->color.range; - H264_DPRINT("1 updated %s %d range %d primaries %d transfer %d\n", - __func__, __LINE__, (int)(mMetadata.range), - (int)(mMetadata.primaries), (int)(mMetadata.transfer)); + if (mMetadataPtr && pFrame->color.range != 0) { + if (3 - pFrame->color.range != mMetadataPtr->range) { + mMetadataPtr->range = 3 - pFrame->color.range; } } - if (pFrame->color.primaries != 2 && - pFrame->color.primaries != mMetadata.primaries) { - mMetadata.primaries = pFrame->color.primaries; - H264_DPRINT("2 updated %s %d range %d primaries %d transfer %d\n", - __func__, __LINE__, (int)(mMetadata.range), - (int)(mMetadata.primaries), (int)(mMetadata.transfer)); - } - - H264_DPRINT("3 %s %d my final range %d primaries %d transfer %d\n", - __func__, __LINE__, (int)(mMetadata.range), - (int)(mMetadata.primaries), (int)(mMetadata.transfer)); bool needToCopyToGuest = true; if (mParser.version() == 200) { if (mUseGpuTexture && pFrame->texture[0] > 0 && @@ -393,14 +379,14 @@ void MediaH264DecoderGeneric::getImage(void* ptr) { mRenderer.renderToHostColorBufferWithTextures( param.hostColorBufferId, pFrame->width, pFrame->height, TextureFrame{pFrame->texture[0], pFrame->texture[1]}, - &mMetadata); + mMetadataPtr.get()); } else { H264_DPRINT( "calling rendering to host side color buffer with id %d", param.hostColorBufferId); mRenderer.renderToHostColorBuffer(param.hostColorBufferId, pFrame->width, pFrame->height, - pFrame->data.data(), &mMetadata); + pFrame->data.data(), mMetadataPtr.get()); } needToCopyToGuest = false; } @@ -448,10 +434,11 @@ void MediaH264DecoderGeneric::sendMetadata(void* ptr) { return; } - std::swap(mMetadata, param); + mMetadataPtr.reset(new MetadataParam(param)); + H264_DPRINT("%s %d range %d primaries %d transfer %d\n", __func__, __LINE__, - (int)(mMetadata.range), (int)(mMetadata.primaries), - (int)(mMetadata.transfer)); + (int)(mMetadataPtr->range), (int)(mMetadataPtr->primaries), + (int)(mMetadataPtr->transfer)); } void MediaH264DecoderGeneric::save(base::Stream* stream) const { diff --git a/android/android-emu/android/emulation/MediaH264DecoderGeneric.h b/android/android-emu/android/emulation/MediaH264DecoderGeneric.h index 05d9dea7a2..0624e307da 100644 --- a/android/android-emu/android/emulation/MediaH264DecoderGeneric.h +++ b/android/android-emu/android/emulation/MediaH264DecoderGeneric.h @@ -81,7 +81,7 @@ private: // color aspects related private: // default is 601, limited range, sRGB - MetadataParam mMetadata = {1, 4, 2, 3}; + std::unique_ptr<MetadataParam> mMetadataPtr; private: std::unique_ptr<MediaSnapshotHelper> mSnapshotHelper; diff --git a/android/android-emu/android/emulation/MediaHevcDecoderGeneric.cpp b/android/android-emu/android/emulation/MediaHevcDecoderGeneric.cpp index 04daeb1e98..405df4a47d 100644 --- a/android/android-emu/android/emulation/MediaHevcDecoderGeneric.cpp +++ b/android/android-emu/android/emulation/MediaHevcDecoderGeneric.cpp @@ -380,10 +380,11 @@ void MediaHevcDecoderGeneric::sendMetadata(void* ptr) { return; } - std::swap(mMetadata, param); + mMetadataPtr.reset(new MetadataParam(param)); + HEVC_DPRINT("hevc %s %d range %d primaries %d transfer %d\n", __func__, - __LINE__, (int)(mMetadata.range), (int)(mMetadata.primaries), - (int)(mMetadata.transfer)); + __LINE__, (int)(mMetadataPtr->range), (int)(mMetadataPtr->primaries), + (int)(mMetadataPtr->transfer)); } void MediaHevcDecoderGeneric::getImage(void* ptr) { @@ -413,24 +414,12 @@ void MediaHevcDecoderGeneric::getImage(void* ptr) { } // update color aspects - if (pFrame->color.range != 0) { - if (3 - pFrame->color.range != mMetadata.range) { - mMetadata.range = 3 - pFrame->color.range; - HEVC_DPRINT( - "hevc updated %s %d range %d primaries %d transfer %d\n", - __func__, __LINE__, (int)(mMetadata.range), - (int)(mMetadata.primaries), (int)(mMetadata.transfer)); + if (mMetadataPtr && pFrame->color.range != 0) { + if (3 - pFrame->color.range != mMetadataPtr->range) { + mMetadataPtr->range = 3 - pFrame->color.range; } } - if (pFrame->color.primaries != 2 && - pFrame->color.primaries != mMetadata.primaries) { - mMetadata.primaries = pFrame->color.primaries; - HEVC_DPRINT("hevc updated %s %d range %d primaries %d transfer %d\n", - __func__, __LINE__, (int)(mMetadata.range), - (int)(mMetadata.primaries), (int)(mMetadata.transfer)); - } - bool needToCopyToGuest = true; if (mParser.version() >= 200) { if (mUseGpuTexture && pFrame->texture[0] > 0 && @@ -443,14 +432,14 @@ void MediaHevcDecoderGeneric::getImage(void* ptr) { mRenderer.renderToHostColorBufferWithTextures( param.hostColorBufferId, pFrame->width, pFrame->height, TextureFrame{pFrame->texture[0], pFrame->texture[1]}, - &mMetadata); + mMetadataPtr.get()); } else { HEVC_DPRINT( "calling rendering to host side color buffer with id %d", param.hostColorBufferId); mRenderer.renderToHostColorBuffer(param.hostColorBufferId, pFrame->width, pFrame->height, - pFrame->data.data(), &mMetadata); + pFrame->data.data(), mMetadataPtr.get()); } needToCopyToGuest = false; } diff --git a/android/android-emu/android/emulation/MediaHevcDecoderGeneric.h b/android/android-emu/android/emulation/MediaHevcDecoderGeneric.h index 29f93cd066..2f19d4cdfc 100644 --- a/android/android-emu/android/emulation/MediaHevcDecoderGeneric.h +++ b/android/android-emu/android/emulation/MediaHevcDecoderGeneric.h @@ -81,7 +81,7 @@ private: // color aspects related private: // default is 601, limited range, sRGB - MetadataParam mMetadata = {1, 4, 2, 3}; + std::unique_ptr<MetadataParam> mMetadataPtr; private: std::unique_ptr<MediaSnapshotHelper> mSnapshotHelper; |