summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-03-09 08:05:57 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-03-09 08:05:57 +0000
commit8ea5e8c8a1ed2f461b3e389b7b75b97f056bac66 (patch)
tree121af4abeb56afce453c1437574c82493ae4793f
parentda0c6e7c231c6254360d396c9ded5654aade24d5 (diff)
parentb76f40ec647fbaf66ff3b6f7f687819e1e374c3b (diff)
downloadav-android-mainline-12.0.0_r124.tar.gz
Snap for 8278022 from b76f40ec647fbaf66ff3b6f7f687819e1e374c3b to mainline-resolv-releaseandroid-mainline-12.0.0_r124android-mainline-12.0.0_r108
Change-Id: I51eba1ce6e23c6db5c6148263fae52547aad40b6
-rw-r--r--media/codec2/components/gav1/C2SoftGav1Dec.cpp26
-rw-r--r--media/codec2/components/opus/C2SoftOpusEnc.cpp12
-rw-r--r--media/codec2/components/opus/C2SoftOpusEnc.h2
-rw-r--r--media/codec2/vndk/C2Store.cpp16
-rw-r--r--media/libstagefright/data/media_codecs_google_c2_video.xml2
-rw-r--r--media/libstagefright/data/media_codecs_sw.xml10
6 files changed, 40 insertions, 28 deletions
diff --git a/media/codec2/components/gav1/C2SoftGav1Dec.cpp b/media/codec2/components/gav1/C2SoftGav1Dec.cpp
index 386e097612..1cceaf2acc 100644
--- a/media/codec2/components/gav1/C2SoftGav1Dec.cpp
+++ b/media/codec2/components/gav1/C2SoftGav1Dec.cpp
@@ -59,8 +59,8 @@ class C2SoftGav1Dec::IntfImpl : public SimpleInterface<void>::BaseParams {
DefineParam(mSize, C2_PARAMKEY_PICTURE_SIZE)
.withDefault(new C2StreamPictureSizeInfo::output(0u, 320, 240))
.withFields({
- C2F(mSize, width).inRange(2, 4096, 2),
- C2F(mSize, height).inRange(2, 4096, 2),
+ C2F(mSize, width).inRange(2, 4096),
+ C2F(mSize, height).inRange(2, 4096),
})
.withSetter(SizeSetter)
.build());
@@ -559,23 +559,23 @@ static void copyOutputBufferToYV12Frame(uint8_t *dstY, uint8_t *dstU, uint8_t *d
if (isMonochrome) {
// Fill with neutral U/V values.
- for (size_t i = 0; i < height / 2; ++i) {
- memset(dstV, NEUTRAL_UV_VALUE, width / 2);
- memset(dstU, NEUTRAL_UV_VALUE, width / 2);
+ for (size_t i = 0; i < (height + 1) / 2; ++i) {
+ memset(dstV, NEUTRAL_UV_VALUE, (width + 1) / 2);
+ memset(dstU, NEUTRAL_UV_VALUE, (width + 1) / 2);
dstV += dstUVStride;
dstU += dstUVStride;
}
return;
}
- for (size_t i = 0; i < height / 2; ++i) {
- memcpy(dstV, srcV, width / 2);
+ for (size_t i = 0; i < (height + 1) / 2; ++i) {
+ memcpy(dstV, srcV, (width + 1) / 2);
srcV += srcVStride;
dstV += dstUVStride;
}
- for (size_t i = 0; i < height / 2; ++i) {
- memcpy(dstU, srcU, width / 2);
+ for (size_t i = 0; i < (height + 1) / 2; ++i) {
+ memcpy(dstU, srcU, (width + 1) / 2);
srcU += srcUStride;
dstU += dstUVStride;
}
@@ -796,8 +796,12 @@ bool C2SoftGav1Dec::outputBuffer(const std::shared_ptr<C2BlockPool> &pool,
}
C2MemoryUsage usage = {C2MemoryUsage::CPU_READ, C2MemoryUsage::CPU_WRITE};
- c2_status_t err = pool->fetchGraphicBlock(align(mWidth, 16), mHeight, format,
- usage, &block);
+ // We always create a graphic block that is width aligned to 16 and height
+ // aligned to 2. We set the correct "crop" value of the image in the call to
+ // createGraphicBuffer() by setting the correct image dimensions.
+ c2_status_t err = pool->fetchGraphicBlock(align(mWidth, 16),
+ align(mHeight, 2), format, usage,
+ &block);
if (err != C2_OK) {
ALOGE("fetchGraphicBlock for Output failed with status %d", err);
diff --git a/media/codec2/components/opus/C2SoftOpusEnc.cpp b/media/codec2/components/opus/C2SoftOpusEnc.cpp
index 370d33c765..cdc3be01f0 100644
--- a/media/codec2/components/opus/C2SoftOpusEnc.cpp
+++ b/media/codec2/components/opus/C2SoftOpusEnc.cpp
@@ -245,7 +245,7 @@ c2_status_t C2SoftOpusEnc::initEncoder() {
mIsFirstFrame = true;
mEncoderFlushed = false;
mBufferAvailable = false;
- mAnchorTimeStamp = 0ull;
+ mAnchorTimeStamp = 0;
mProcessedSamples = 0;
mFilledLen = 0;
mFrameDurationMs = DEFAULT_FRAME_DURATION_MS;
@@ -266,7 +266,7 @@ c2_status_t C2SoftOpusEnc::onStop() {
mIsFirstFrame = true;
mEncoderFlushed = false;
mBufferAvailable = false;
- mAnchorTimeStamp = 0ull;
+ mAnchorTimeStamp = 0;
mProcessedSamples = 0u;
mFilledLen = 0;
if (mEncoder) {
@@ -363,7 +363,7 @@ void C2SoftOpusEnc::process(const std::unique_ptr<C2Work>& work,
}
}
if (mIsFirstFrame && inSize > 0) {
- mAnchorTimeStamp = work->input.ordinal.timestamp.peekull();
+ mAnchorTimeStamp = work->input.ordinal.timestamp.peekll();
mIsFirstFrame = false;
}
@@ -386,7 +386,7 @@ void C2SoftOpusEnc::process(const std::unique_ptr<C2Work>& work,
size_t inPos = 0;
size_t processSize = 0;
mBytesEncoded = 0;
- uint64_t outTimeStamp = 0u;
+ int64_t outTimeStamp = 0;
std::shared_ptr<C2Buffer> buffer;
uint64_t inputIndex = work->input.ordinal.frameIndex.peeku();
const uint8_t* inPtr = rView.data() + inOffset;
@@ -584,7 +584,7 @@ c2_status_t C2SoftOpusEnc::drainInternal(
mOutputBlock.reset();
}
mProcessedSamples += (mNumPcmBytesPerInputFrame / sizeof(int16_t));
- uint64_t outTimeStamp =
+ int64_t outTimeStamp =
mProcessedSamples * 1000000ll / mChannelCount / mSampleRate;
outOrdinal.frameIndex = mOutIndex++;
outOrdinal.timestamp = mAnchorTimeStamp + outTimeStamp;
@@ -612,7 +612,7 @@ c2_status_t C2SoftOpusEnc::drain(uint32_t drainMode,
return C2_OMITTED;
}
mIsFirstFrame = true;
- mAnchorTimeStamp = 0ull;
+ mAnchorTimeStamp = 0;
mProcessedSamples = 0u;
return drainInternal(pool, nullptr);
}
diff --git a/media/codec2/components/opus/C2SoftOpusEnc.h b/media/codec2/components/opus/C2SoftOpusEnc.h
index 2b4d8f2320..733a6bcd21 100644
--- a/media/codec2/components/opus/C2SoftOpusEnc.h
+++ b/media/codec2/components/opus/C2SoftOpusEnc.h
@@ -67,7 +67,7 @@ private:
uint32_t mSampleRate;
uint32_t mChannelCount;
uint32_t mFrameDurationMs;
- uint64_t mAnchorTimeStamp;
+ int64_t mAnchorTimeStamp;
uint64_t mProcessedSamples;
// Codec delay in ns
uint64_t mCodecDelay;
diff --git a/media/codec2/vndk/C2Store.cpp b/media/codec2/vndk/C2Store.cpp
index 1660c381b9..dfdd84d484 100644
--- a/media/codec2/vndk/C2Store.cpp
+++ b/media/codec2/vndk/C2Store.cpp
@@ -301,13 +301,21 @@ void C2PlatformAllocatorStoreImpl::setComponentStore(std::shared_ptr<C2Component
std::lock_guard<std::mutex> lock(_mComponentStoreReadLock);
_mComponentStore = store;
}
- std::shared_ptr<C2AllocatorIon> allocator;
+ std::shared_ptr<C2AllocatorIon> ionAllocator;
{
std::lock_guard<std::mutex> lock(gIonAllocatorMutex);
- allocator = gIonAllocator.lock();
+ ionAllocator = gIonAllocator.lock();
}
- if (allocator) {
- UseComponentStoreForIonAllocator(allocator, store);
+ if (ionAllocator) {
+ UseComponentStoreForIonAllocator(ionAllocator, store);
+ }
+ std::shared_ptr<C2DmaBufAllocator> dmaAllocator;
+ {
+ std::lock_guard<std::mutex> lock(gDmaBufAllocatorMutex);
+ dmaAllocator = gDmaBufAllocator.lock();
+ }
+ if (dmaAllocator) {
+ UseComponentStoreForDmaBufAllocator(dmaAllocator, store);
}
}
diff --git a/media/libstagefright/data/media_codecs_google_c2_video.xml b/media/libstagefright/data/media_codecs_google_c2_video.xml
index 04041ebfc1..3509ef8812 100644
--- a/media/libstagefright/data/media_codecs_google_c2_video.xml
+++ b/media/libstagefright/data/media_codecs_google_c2_video.xml
@@ -79,7 +79,7 @@
</MediaCodec>
<MediaCodec name="c2.android.av1.decoder" type="video/av01">
<Limit name="size" min="96x96" max="1920x1080" />
- <Limit name="alignment" value="2x2" />
+ <Limit name="alignment" value="1x1" />
<Limit name="block-size" value="16x16" />
<Limit name="blocks-per-second" min="24" max="2073600" />
<Limit name="bitrate" range="1-120000000" />
diff --git a/media/libstagefright/data/media_codecs_sw.xml b/media/libstagefright/data/media_codecs_sw.xml
index a4e34258f5..d7e2d18146 100644
--- a/media/libstagefright/data/media_codecs_sw.xml
+++ b/media/libstagefright/data/media_codecs_sw.xml
@@ -91,11 +91,11 @@
<MediaCodec name="c2.android.mpeg4.decoder" type="video/mp4v-es">
<Alias name="OMX.google.mpeg4.decoder" />
<!-- profiles and levels: ProfileSimple : Level3 -->
- <Limit name="size" min="2x2" max="352x288" />
+ <Limit name="size" min="2x2" max="1920x1920" />
<Limit name="alignment" value="2x2" />
- <Limit name="block-size" value="16x16" />
- <Limit name="blocks-per-second" range="12-11880" />
- <Limit name="bitrate" range="1-384000" />
+ <Limit name="block-count" range="1-14400" />
+ <Limit name="blocks-per-second" range="1-432000" />
+ <Limit name="bitrate" range="1-40000000" />
<Feature name="adaptive-playback" />
</MediaCodec>
<MediaCodec name="c2.android.h263.decoder" type="video/3gpp">
@@ -184,7 +184,7 @@
</MediaCodec>
<MediaCodec name="c2.android.av1.decoder" type="video/av01" variant="!slow-cpu">
<Limit name="size" min="2x2" max="2048x2048" />
- <Limit name="alignment" value="2x2" />
+ <Limit name="alignment" value="1x1" />
<Limit name="block-size" value="16x16" />
<Limit name="block-count" range="1-16384" />
<Limit name="blocks-per-second" range="1-2073600" />