Merge "The sonification sound is muted during a shutter sound"
diff --git a/Android.bp b/Android.bp
index 4cdb881..e4f12c8 100644
--- a/Android.bp
+++ b/Android.bp
@@ -2,7 +2,6 @@
"camera",
"drm/*",
"media/*",
- "radio",
"services/*",
"soundtrigger",
]
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 5e4d81d..793cbf4 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -78,6 +78,9 @@
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/soundfx/libbundlewrapper.so)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/soundfx/libaudiopreprocessing.so)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/libmediacodecservice.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/libstagefright_xmlparser@1.0.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/libstagefright_soft_*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/vndk/libstagefright_soft_*)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
diff --git a/camera/Android.bp b/camera/Android.bp
index c76ae50..24b3918 100644
--- a/camera/Android.bp
+++ b/camera/Android.bp
@@ -29,12 +29,7 @@
// AIDL files for camera interfaces
// The headers for these interfaces will be available to any modules that
// include libcamera_client, at the path "aidl/package/path/BnFoo.h"
- "aidl/android/hardware/ICameraService.aidl",
- "aidl/android/hardware/ICameraServiceListener.aidl",
- "aidl/android/hardware/ICameraServiceProxy.aidl",
- "aidl/android/hardware/camera2/ICameraDeviceCallbacks.aidl",
- "aidl/android/hardware/camera2/ICameraDeviceUser.aidl",
-
+ ":libcamera_client_aidl",
// Source for camera interface parcelables, and manually-written interfaces
"Camera.cpp",
@@ -81,3 +76,25 @@
],
}
+
+// AIDL interface between camera clients and the camera service.
+filegroup {
+ name: "libcamera_client_aidl",
+ srcs: [
+ "aidl/android/hardware/ICameraService.aidl",
+ "aidl/android/hardware/ICameraServiceListener.aidl",
+ "aidl/android/hardware/ICameraServiceProxy.aidl",
+ "aidl/android/hardware/camera2/ICameraDeviceCallbacks.aidl",
+ "aidl/android/hardware/camera2/ICameraDeviceUser.aidl",
+ ],
+}
+
+// Extra AIDL files that are used by framework.jar but not libcamera_client
+// because they have hand-written native implementations.
+filegroup {
+ name: "libcamera_client_framework_aidl",
+ srcs: [
+ "aidl/android/hardware/ICamera.aidl",
+ "aidl/android/hardware/ICameraClient.aidl",
+ ],
+}
diff --git a/camera/aidl/android/hardware/camera2/ICameraDeviceCallbacks.aidl b/camera/aidl/android/hardware/camera2/ICameraDeviceCallbacks.aidl
index 8308095..28252c0 100644
--- a/camera/aidl/android/hardware/camera2/ICameraDeviceCallbacks.aidl
+++ b/camera/aidl/android/hardware/camera2/ICameraDeviceCallbacks.aidl
@@ -42,7 +42,9 @@
* Repeating request encountered an error and was stopped.
*
* @param lastFrameNumber Frame number of the last frame of the streaming request.
+ * @param repeatingRequestId the ID of the repeating request being stopped
*/
- oneway void onRepeatingRequestError(in long lastFrameNumber);
+ oneway void onRepeatingRequestError(in long lastFrameNumber,
+ in int repeatingRequestId);
oneway void onRequestQueueEmpty();
}
diff --git a/camera/ndk/impl/ACameraDevice.cpp b/camera/ndk/impl/ACameraDevice.cpp
index 98571c1..907802c 100644
--- a/camera/ndk/impl/ACameraDevice.cpp
+++ b/camera/ndk/impl/ACameraDevice.cpp
@@ -1372,7 +1372,8 @@
}
binder::Status
-CameraDevice::ServiceCallback::onRepeatingRequestError(int64_t lastFrameNumber) {
+CameraDevice::ServiceCallback::onRepeatingRequestError(
+ int64_t lastFrameNumber, int32_t stoppedSequenceId) {
binder::Status ret = binder::Status::ok();
sp<CameraDevice> dev = mDevice.promote();
@@ -1383,7 +1384,9 @@
Mutex::Autolock _l(dev->mDeviceLock);
int repeatingSequenceId = dev->mRepeatingSequenceId;
- dev->mRepeatingSequenceId = REQUEST_ID_NONE;
+ if (stoppedSequenceId == repeatingSequenceId) {
+ dev->mRepeatingSequenceId = REQUEST_ID_NONE;
+ }
dev->checkRepeatingSequenceCompleteLocked(repeatingSequenceId, lastFrameNumber);
diff --git a/camera/ndk/impl/ACameraDevice.h b/camera/ndk/impl/ACameraDevice.h
index 15dd08d..6ed3881 100644
--- a/camera/ndk/impl/ACameraDevice.h
+++ b/camera/ndk/impl/ACameraDevice.h
@@ -75,7 +75,8 @@
const CaptureResultExtras& resultExtras) override;
binder::Status onPrepared(int streamId) override;
binder::Status onRequestQueueEmpty() override;
- binder::Status onRepeatingRequestError(int64_t lastFrameNumber) override;
+ binder::Status onRepeatingRequestError(int64_t lastFrameNumber,
+ int32_t stoppedSequenceId) override;
private:
const wp<CameraDevice> mDevice;
};
diff --git a/camera/ndk/impl/ACameraManager.cpp b/camera/ndk/impl/ACameraManager.cpp
index 3f64bcc..a1a8cd6 100644
--- a/camera/ndk/impl/ACameraManager.cpp
+++ b/camera/ndk/impl/ACameraManager.cpp
@@ -340,6 +340,9 @@
msg->setString(kCameraIdKey, AString(cameraId));
msg->post();
}
+ if (status == hardware::ICameraServiceListener::STATUS_NOT_PRESENT) {
+ mDeviceStatusMap.erase(cameraId);
+ }
}
} // namespace android
diff --git a/camera/ndk/include/camera/NdkCameraCaptureSession.h b/camera/ndk/include/camera/NdkCameraCaptureSession.h
index d96f538..16d227a 100644
--- a/camera/ndk/include/camera/NdkCameraCaptureSession.h
+++ b/camera/ndk/include/camera/NdkCameraCaptureSession.h
@@ -33,6 +33,7 @@
* Do not #include files that aren't part of the NDK.
*/
#include <sys/cdefs.h>
+#include <stdbool.h>
#include <android/native_window.h>
#include "NdkCameraError.h"
diff --git a/camera/ndk/include/camera/NdkCameraDevice.h b/camera/ndk/include/camera/NdkCameraDevice.h
index 6c9e85a..2c65529 100644
--- a/camera/ndk/include/camera/NdkCameraDevice.h
+++ b/camera/ndk/include/camera/NdkCameraDevice.h
@@ -153,6 +153,11 @@
} ACameraDevice_StateCallbacks;
/**
+ * For backward compatiblity.
+ */
+typedef ACameraDevice_StateCallbacks ACameraDevice_stateCallbacks;
+
+/**
* Close the connection and free this ACameraDevice synchronously. Access to the ACameraDevice
* after calling this method will cause a crash.
*
diff --git a/camera/ndk/include/camera/NdkCameraMetadata.h b/camera/ndk/include/camera/NdkCameraMetadata.h
index f2aec98..bdb1587 100644
--- a/camera/ndk/include/camera/NdkCameraMetadata.h
+++ b/camera/ndk/include/camera/NdkCameraMetadata.h
@@ -36,6 +36,7 @@
#ifndef _NDK_CAMERA_METADATA_H
#define _NDK_CAMERA_METADATA_H
+#include <stdint.h>
#include <sys/cdefs.h>
#include "NdkCameraError.h"
diff --git a/camera/tests/CameraBinderTests.cpp b/camera/tests/CameraBinderTests.cpp
index 946e3b8..51d9214 100644
--- a/camera/tests/CameraBinderTests.cpp
+++ b/camera/tests/CameraBinderTests.cpp
@@ -217,8 +217,10 @@
return binder::Status::ok();
}
- virtual binder::Status onRepeatingRequestError(int64_t lastFrameNumber) {
+ virtual binder::Status onRepeatingRequestError(
+ int64_t lastFrameNumber, int32_t stoppedSequenceId) {
(void) lastFrameNumber;
+ (void) stoppedSequenceId;
Mutex::Autolock l(mLock);
mLastStatus = REPEATING_REQUEST_ERROR;
mStatusesHit.push_back(mLastStatus);
diff --git a/cmds/screenrecord/screenrecord.cpp b/cmds/screenrecord/screenrecord.cpp
index de0167a..bc32bbe 100644
--- a/cmds/screenrecord/screenrecord.cpp
+++ b/cmds/screenrecord/screenrecord.cpp
@@ -78,7 +78,7 @@
static bool gWantFrameTime = false; // do we want times on each frame?
static uint32_t gVideoWidth = 0; // default width+height
static uint32_t gVideoHeight = 0;
-static uint32_t gBitRate = 4000000; // 4Mbps
+static uint32_t gBitRate = 20000000; // 20Mbps
static uint32_t gTimeLimitSec = kMaxTimeLimitSec;
// Set by signal handler to stop recording.
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp
index d7c2e87..d70282b 100644
--- a/cmds/stagefright/stagefright.cpp
+++ b/cmds/stagefright/stagefright.cpp
@@ -870,7 +870,9 @@
sp<IMemory> mem =
retriever->getFrameAtTime(-1,
- MediaSource::ReadOptions::SEEK_PREVIOUS_SYNC);
+ MediaSource::ReadOptions::SEEK_PREVIOUS_SYNC,
+ HAL_PIXEL_FORMAT_RGB_565,
+ false /*metaOnly*/);
if (mem != NULL) {
failed = false;
diff --git a/drm/libmediadrm/Android.bp b/drm/libmediadrm/Android.bp
index 98b01ba..0c14201 100644
--- a/drm/libmediadrm/Android.bp
+++ b/drm/libmediadrm/Android.bp
@@ -5,36 +5,31 @@
cc_library_shared {
name: "libmediadrm",
- aidl: {
- local_include_dirs: ["aidl"],
- export_aidl_headers: true,
- },
srcs: [
- "aidl/android/media/ICas.aidl",
- "aidl/android/media/ICasListener.aidl",
- "aidl/android/media/IDescrambler.aidl",
- "aidl/android/media/IMediaCasService.aidl",
-
- "CasImpl.cpp",
- "DescramblerImpl.cpp",
"DrmPluginPath.cpp",
"DrmSessionManager.cpp",
"ICrypto.cpp",
"IDrm.cpp",
"IDrmClient.cpp",
"IMediaDrmService.cpp",
- "MediaCasDefs.cpp",
+ "PluginMetricsReporting.cpp",
"SharedLibrary.cpp",
"DrmHal.cpp",
"CryptoHal.cpp",
+ "protos/plugin_metrics.proto",
],
+ proto: {
+ type: "lite",
+ },
+
shared_libs: [
"libbinder",
"libcutils",
"libdl",
"liblog",
+ "libmediametrics",
"libmediautils",
"libstagefright_foundation",
"libutils",
diff --git a/drm/libmediadrm/CasImpl.cpp b/drm/libmediadrm/CasImpl.cpp
deleted file mode 100644
index 1a33bb0..0000000
--- a/drm/libmediadrm/CasImpl.cpp
+++ /dev/null
@@ -1,224 +0,0 @@
-
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-//#define LOG_NDEBUG 0
-#define LOG_TAG "CasImpl"
-
-#include <android/media/ICasListener.h>
-#include <media/cas/CasAPI.h>
-#include <media/CasImpl.h>
-#include <media/SharedLibrary.h>
-#include <utils/Log.h>
-
-namespace android {
-
-static Status getBinderStatus(status_t err) {
- if (err == OK) {
- return Status::ok();
- }
- if (err == BAD_VALUE) {
- return Status::fromExceptionCode(Status::EX_ILLEGAL_ARGUMENT);
- }
- if (err == INVALID_OPERATION) {
- return Status::fromExceptionCode(Status::EX_ILLEGAL_STATE);
- }
- return Status::fromServiceSpecificError(err);
-}
-
-static String8 sessionIdToString(const CasSessionId &sessionId) {
- String8 result;
- for (size_t i = 0; i < sessionId.size(); i++) {
- result.appendFormat("%02x ", sessionId[i]);
- }
- if (result.isEmpty()) {
- result.append("(null)");
- }
- return result;
-}
-
-struct CasImpl::PluginHolder : public RefBase {
-public:
- explicit PluginHolder(CasPlugin *plugin) : mPlugin(plugin) {}
- ~PluginHolder() { if (mPlugin != NULL) delete mPlugin; }
- CasPlugin* get() { return mPlugin; }
-
-private:
- CasPlugin *mPlugin;
- DISALLOW_EVIL_CONSTRUCTORS(PluginHolder);
-};
-
-CasImpl::CasImpl(const sp<ICasListener> &listener)
- : mPluginHolder(NULL), mListener(listener) {
- ALOGV("CTOR");
-}
-
-CasImpl::~CasImpl() {
- ALOGV("DTOR");
- release();
-}
-
-//static
-void CasImpl::OnEvent(
- void *appData,
- int32_t event,
- int32_t arg,
- uint8_t *data,
- size_t size) {
- if (appData == NULL) {
- ALOGE("Invalid appData!");
- return;
- }
- CasImpl *casImpl = static_cast<CasImpl *>(appData);
- casImpl->onEvent(event, arg, data, size);
-}
-
-void CasImpl::init(const sp<SharedLibrary>& library, CasPlugin *plugin) {
- mLibrary = library;
- mPluginHolder = new PluginHolder(plugin);
-}
-
-void CasImpl::onEvent(
- int32_t event, int32_t arg, uint8_t *data, size_t size) {
- if (mListener == NULL) {
- return;
- }
-
- std::unique_ptr<CasData> eventData;
- if (data != NULL && size > 0) {
- eventData.reset(new CasData(data, data + size));
- }
-
- mListener->onEvent(event, arg, eventData);
-}
-
-Status CasImpl::setPrivateData(const CasData& pvtData) {
- ALOGV("setPrivateData");
- sp<PluginHolder> holder = mPluginHolder;
- if (holder == NULL) {
- return getBinderStatus(INVALID_OPERATION);
- }
- return getBinderStatus(holder->get()->setPrivateData(pvtData));
-}
-
-Status CasImpl::openSession(CasSessionId* sessionId) {
- ALOGV("openSession");
- sp<PluginHolder> holder = mPluginHolder;
- if (holder == NULL) {
- return getBinderStatus(INVALID_OPERATION);
- }
- status_t err = holder->get()->openSession(sessionId);
-
- ALOGV("openSession: session opened, sessionId=%s",
- sessionIdToString(*sessionId).string());
-
- return getBinderStatus(err);
-}
-
-Status CasImpl::setSessionPrivateData(
- const CasSessionId &sessionId, const CasData& pvtData) {
- ALOGV("setSessionPrivateData: sessionId=%s",
- sessionIdToString(sessionId).string());
- sp<PluginHolder> holder = mPluginHolder;
- if (holder == NULL) {
- return getBinderStatus(INVALID_OPERATION);
- }
- return getBinderStatus(holder->get()->setSessionPrivateData(sessionId, pvtData));
-}
-
-Status CasImpl::closeSession(const CasSessionId &sessionId) {
- ALOGV("closeSession: sessionId=%s",
- sessionIdToString(sessionId).string());
- sp<PluginHolder> holder = mPluginHolder;
- if (holder == NULL) {
- return getBinderStatus(INVALID_OPERATION);
- }
- return getBinderStatus(holder->get()->closeSession(sessionId));
-}
-
-Status CasImpl::processEcm(const CasSessionId &sessionId, const ParcelableCasData& ecm) {
- ALOGV("processEcm: sessionId=%s",
- sessionIdToString(sessionId).string());
- sp<PluginHolder> holder = mPluginHolder;
- if (holder == NULL) {
- return getBinderStatus(INVALID_OPERATION);
- }
-
- return getBinderStatus(holder->get()->processEcm(sessionId, ecm));
-}
-
-Status CasImpl::processEmm(const ParcelableCasData& emm) {
- ALOGV("processEmm");
- sp<PluginHolder> holder = mPluginHolder;
- if (holder == NULL) {
- return getBinderStatus(INVALID_OPERATION);
- }
-
- return getBinderStatus(holder->get()->processEmm(emm));
-}
-
-Status CasImpl::sendEvent(
- int32_t event, int32_t arg, const ::std::unique_ptr<CasData> &eventData) {
- ALOGV("sendEvent");
- sp<PluginHolder> holder = mPluginHolder;
- if (holder == NULL) {
- return getBinderStatus(INVALID_OPERATION);
- }
-
- status_t err;
- if (eventData == nullptr) {
- err = holder->get()->sendEvent(event, arg, CasData());
- } else {
- err = holder->get()->sendEvent(event, arg, *eventData);
- }
- return getBinderStatus(err);
-}
-
-Status CasImpl::provision(const String16& provisionString) {
- ALOGV("provision: provisionString=%s", String8(provisionString).string());
- sp<PluginHolder> holder = mPluginHolder;
- if (holder == NULL) {
- return getBinderStatus(INVALID_OPERATION);
- }
-
- return getBinderStatus(holder->get()->provision(String8(provisionString)));
-}
-
-Status CasImpl::refreshEntitlements(
- int32_t refreshType, const ::std::unique_ptr<CasData> &refreshData) {
- ALOGV("refreshEntitlements");
- sp<PluginHolder> holder = mPluginHolder;
- if (holder == NULL) {
- return getBinderStatus(INVALID_OPERATION);
- }
-
- status_t err;
- if (refreshData == nullptr) {
- err = holder->get()->refreshEntitlements(refreshType, CasData());
- } else {
- err = holder->get()->refreshEntitlements(refreshType, *refreshData);
- }
- return getBinderStatus(err);
-}
-
-Status CasImpl::release() {
- ALOGV("release: plugin=%p",
- mPluginHolder == NULL ? mPluginHolder->get() : NULL);
- mPluginHolder.clear();
- return Status::ok();
-}
-
-} // namespace android
-
diff --git a/drm/libmediadrm/DescramblerImpl.cpp b/drm/libmediadrm/DescramblerImpl.cpp
deleted file mode 100644
index 94e09e2..0000000
--- a/drm/libmediadrm/DescramblerImpl.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-//#define LOG_NDEBUG 0
-#define LOG_TAG "DescramblerImpl"
-
-#include <media/cas/DescramblerAPI.h>
-#include <media/DescramblerImpl.h>
-#include <media/SharedLibrary.h>
-#include <utils/Log.h>
-#include <binder/IMemory.h>
-
-namespace android {
-
-static Status getBinderStatus(status_t err) {
- if (err == OK) {
- return Status::ok();
- }
- if (err == BAD_VALUE) {
- return Status::fromExceptionCode(Status::EX_ILLEGAL_ARGUMENT);
- }
- if (err == INVALID_OPERATION) {
- return Status::fromExceptionCode(Status::EX_ILLEGAL_STATE);
- }
- return Status::fromServiceSpecificError(err);
-}
-
-static String8 sessionIdToString(const CasSessionId &sessionId) {
- String8 result;
- for (size_t i = 0; i < sessionId.size(); i++) {
- result.appendFormat("%02x ", sessionId[i]);
- }
- if (result.isEmpty()) {
- result.append("(null)");
- }
- return result;
-}
-
-DescramblerImpl::DescramblerImpl(
- const sp<SharedLibrary>& library, DescramblerPlugin *plugin) :
- mLibrary(library), mPlugin(plugin) {
- ALOGV("CTOR: mPlugin=%p", mPlugin);
-}
-
-DescramblerImpl::~DescramblerImpl() {
- ALOGV("DTOR: mPlugin=%p", mPlugin);
- release();
-}
-
-Status DescramblerImpl::setMediaCasSession(const CasSessionId& sessionId) {
- ALOGV("setMediaCasSession: sessionId=%s",
- sessionIdToString(sessionId).string());
-
- return getBinderStatus(mPlugin->setMediaCasSession(sessionId));
-}
-
-Status DescramblerImpl::requiresSecureDecoderComponent(
- const String16& mime, bool *result) {
- *result = mPlugin->requiresSecureDecoderComponent(String8(mime));
-
- return getBinderStatus(OK);
-}
-
-Status DescramblerImpl::descramble(
- const DescrambleInfo& info, int32_t *result) {
- ALOGV("descramble");
-
- *result = mPlugin->descramble(
- info.dstType != DescrambleInfo::kDestinationTypeVmPointer,
- info.scramblingControl,
- info.numSubSamples,
- info.subSamples,
- info.srcMem->pointer(),
- info.srcOffset,
- info.dstType == DescrambleInfo::kDestinationTypeVmPointer ?
- info.srcMem->pointer() : info.dstPtr,
- info.dstOffset,
- NULL);
-
- return getBinderStatus(*result >= 0 ? OK : *result);
-}
-
-Status DescramblerImpl::release() {
- ALOGV("release: mPlugin=%p", mPlugin);
-
- if (mPlugin != NULL) {
- delete mPlugin;
- mPlugin = NULL;
- }
- return Status::ok();
-}
-
-} // namespace android
-
diff --git a/drm/libmediadrm/DrmHal.cpp b/drm/libmediadrm/DrmHal.cpp
index 074489a..bc37557 100644
--- a/drm/libmediadrm/DrmHal.cpp
+++ b/drm/libmediadrm/DrmHal.cpp
@@ -30,6 +30,7 @@
#include <media/DrmHal.h>
#include <media/DrmSessionClientInterface.h>
#include <media/DrmSessionManager.h>
+#include <media/PluginMetricsReporting.h>
#include <media/drm/DrmAPI.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/AString.h>
@@ -194,7 +195,18 @@
mInitCheck((mFactories.size() == 0) ? ERROR_UNSUPPORTED : NO_INIT) {
}
+void DrmHal::closeOpenSessions() {
+ if (mPlugin != NULL) {
+ for (size_t i = 0; i < mOpenSessions.size(); i++) {
+ mPlugin->closeSession(toHidlVec(mOpenSessions[i]));
+ DrmSessionManager::Instance()->removeSession(mOpenSessions[i]);
+ }
+ }
+ mOpenSessions.clear();
+}
+
DrmHal::~DrmHal() {
+ closeOpenSessions();
DrmSessionManager::Instance()->removeDrm(mDrmSessionClient);
}
@@ -413,11 +425,12 @@
status_t DrmHal::destroyPlugin() {
Mutex::Autolock autoLock(mLock);
-
if (mInitCheck != OK) {
return mInitCheck;
}
+ closeOpenSessions();
+ reportMetrics();
setListener(NULL);
mInitCheck = NO_INIT;
@@ -471,6 +484,7 @@
if (err == OK) {
DrmSessionManager::Instance()->addSession(getCallingPid(),
mDrmSessionClient, sessionId);
+ mOpenSessions.push(sessionId);
}
return err;
}
@@ -486,7 +500,14 @@
if (status.isOk()) {
if (status == Status::OK) {
DrmSessionManager::Instance()->removeSession(sessionId);
+ for (size_t i = 0; i < mOpenSessions.size(); i++) {
+ if (mOpenSessions[i] == sessionId) {
+ mOpenSessions.removeAt(i);
+ break;
+ }
+ }
}
+ reportMetrics();
return toStatusT(status);
}
return DEAD_OBJECT;
@@ -740,6 +761,12 @@
status_t DrmHal::getPropertyString(String8 const &name, String8 &value ) const {
Mutex::Autolock autoLock(mLock);
+ return getPropertyStringInternal(name, value);
+}
+
+status_t DrmHal::getPropertyStringInternal(String8 const &name, String8 &value) const {
+ // This function is internal to the class and should only be called while
+ // mLock is already held.
if (mInitCheck != OK) {
return mInitCheck;
@@ -761,6 +788,12 @@
status_t DrmHal::getPropertyByteArray(String8 const &name, Vector<uint8_t> &value ) const {
Mutex::Autolock autoLock(mLock);
+ return getPropertyByteArrayInternal(name, value);
+}
+
+status_t DrmHal::getPropertyByteArrayInternal(String8 const &name, Vector<uint8_t> &value ) const {
+ // This function is internal to the class and should only be called while
+ // mLock is already held.
if (mInitCheck != OK) {
return mInitCheck;
@@ -975,7 +1008,7 @@
void DrmHal::binderDied(const wp<IBinder> &the_late_who __unused)
{
Mutex::Autolock autoLock(mLock);
-
+ closeOpenSessions();
setListener(NULL);
mInitCheck = NO_INIT;
@@ -997,4 +1030,20 @@
}
}
+void DrmHal::reportMetrics() const
+{
+ Vector<uint8_t> metrics;
+ String8 vendor;
+ String8 description;
+ if (getPropertyStringInternal(String8("vendor"), vendor) == OK &&
+ getPropertyStringInternal(String8("description"), description) == OK &&
+ getPropertyByteArrayInternal(String8("metrics"), metrics) == OK) {
+ status_t res = android::reportDrmPluginMetrics(
+ metrics, vendor, description);
+ if (res != OK) {
+ ALOGE("Metrics were retrieved but could not be reported: %i", res);
+ }
+ }
+}
+
} // namespace android
diff --git a/drm/libmediadrm/IDrm.cpp b/drm/libmediadrm/IDrm.cpp
index 4e47112..8ff6e6a 100644
--- a/drm/libmediadrm/IDrm.cpp
+++ b/drm/libmediadrm/IDrm.cpp
@@ -561,8 +561,13 @@
void BnDrm::readVector(const Parcel &data, Vector<uint8_t> &vector) const {
uint32_t size = data.readInt32();
- vector.insertAt((size_t)0, size);
- data.read(vector.editArray(), size);
+ if (vector.insertAt((size_t)0, size) < 0) {
+ vector.clear();
+ }
+ if (data.read(vector.editArray(), size) != NO_ERROR) {
+ vector.clear();
+ android_errorWriteWithInfoLog(0x534e4554, "62872384", -1, NULL, 0);
+ }
}
void BnDrm::writeVector(Parcel *reply, Vector<uint8_t> const &vector) const {
diff --git a/drm/libmediadrm/MediaCasDefs.cpp b/drm/libmediadrm/MediaCasDefs.cpp
deleted file mode 100644
index 9c2ba38..0000000
--- a/drm/libmediadrm/MediaCasDefs.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-//#define LOG_NDEBUG 0
-#define LOG_TAG "MediaCas"
-
-#include <media/MediaCasDefs.h>
-#include <utils/Log.h>
-#include <binder/IMemory.h>
-
-namespace android {
-namespace media {
-
-///////////////////////////////////////////////////////////////////////////////
-namespace MediaCas {
-
-status_t ParcelableCasData::readFromParcel(const Parcel* parcel) {
- return parcel->readByteVector(this);
-}
-
-status_t ParcelableCasData::writeToParcel(Parcel* parcel) const {
- return parcel->writeByteVector(*this);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-status_t ParcelableCasPluginDescriptor::readFromParcel(const Parcel* /*parcel*/) {
- ALOGE("CAPluginDescriptor::readFromParcel() shouldn't be called");
- return INVALID_OPERATION;
-}
-
-status_t ParcelableCasPluginDescriptor::writeToParcel(Parcel* parcel) const {
- status_t err = parcel->writeInt32(mCASystemId);
- if (err != NO_ERROR) {
- return err;
- }
- return parcel->writeString16(mName);
-}
-
-} // namespace MediaCas
-///////////////////////////////////////////////////////////////////////////////
-
-namespace MediaDescrambler {
-
-DescrambleInfo::DescrambleInfo() {}
-
-DescrambleInfo::~DescrambleInfo() {}
-
-status_t DescrambleInfo::readFromParcel(const Parcel* parcel) {
- status_t err = parcel->readInt32((int32_t*)&dstType);
- if (err != OK) {
- return err;
- }
- if (dstType != kDestinationTypeNativeHandle
- && dstType != kDestinationTypeVmPointer) {
- return BAD_VALUE;
- }
-
- err = parcel->readInt32((int32_t*)&scramblingControl);
- if (err != OK) {
- return err;
- }
-
- err = parcel->readUint32((uint32_t*)&numSubSamples);
- if (err != OK) {
- return err;
- }
- if (numSubSamples > 0xffff) {
- return BAD_VALUE;
- }
-
- subSamples = new DescramblerPlugin::SubSample[numSubSamples];
- if (subSamples == NULL) {
- return NO_MEMORY;
- }
-
- for (size_t i = 0; i < numSubSamples; i++) {
- err = parcel->readUint32(&subSamples[i].mNumBytesOfClearData);
- if (err != OK) {
- return err;
- }
- err = parcel->readUint32(&subSamples[i].mNumBytesOfEncryptedData);
- if (err != OK) {
- return err;
- }
- }
-
- srcMem = interface_cast<IMemory>(parcel->readStrongBinder());
- if (srcMem == NULL) {
- return BAD_VALUE;
- }
-
- err = parcel->readInt32(&srcOffset);
- if (err != OK) {
- return err;
- }
-
- native_handle_t *nativeHandle = NULL;
- if (dstType == kDestinationTypeNativeHandle) {
- nativeHandle = parcel->readNativeHandle();
- dstPtr = static_cast<void *>(nativeHandle);
- } else {
- dstPtr = NULL;
- }
-
- err = parcel->readInt32(&dstOffset);
- if (err != OK) {
- return err;
- }
-
- return OK;
-}
-
-status_t DescrambleInfo::writeToParcel(Parcel* parcel) const {
- if (dstType != kDestinationTypeNativeHandle
- && dstType != kDestinationTypeVmPointer) {
- return BAD_VALUE;
- }
-
- status_t err = parcel->writeInt32((int32_t)dstType);
- if (err != OK) {
- return err;
- }
-
- err = parcel->writeInt32(scramblingControl);
- if (err != OK) {
- return err;
- }
-
- err = parcel->writeUint32(numSubSamples);
- if (err != OK) {
- return err;
- }
-
- for (size_t i = 0; i < numSubSamples; i++) {
- err = parcel->writeUint32(subSamples[i].mNumBytesOfClearData);
- if (err != OK) {
- return err;
- }
- err = parcel->writeUint32(subSamples[i].mNumBytesOfEncryptedData);
- if (err != OK) {
- return err;
- }
- }
-
- err = parcel->writeStrongBinder(IInterface::asBinder(srcMem));
- if (err != OK) {
- return err;
- }
-
- err = parcel->writeInt32(srcOffset);
- if (err != OK) {
- return err;
- }
-
- if (dstType == kDestinationTypeNativeHandle) {
- parcel->writeNativeHandle(static_cast<native_handle_t *>(dstPtr));
- }
-
- err = parcel->writeInt32(dstOffset);
- if (err != OK) {
- return err;
- }
-
- return OK;
-}
-
-} // namespace MediaDescrambler
-
-} // namespace media
-} // namespace android
-
diff --git a/drm/libmediadrm/PluginMetricsReporting.cpp b/drm/libmediadrm/PluginMetricsReporting.cpp
new file mode 100644
index 0000000..57ff5b8
--- /dev/null
+++ b/drm/libmediadrm/PluginMetricsReporting.cpp
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "PluginMetricsReporting"
+#include <utils/Log.h>
+
+#include <media/PluginMetricsReporting.h>
+
+#include <media/MediaAnalyticsItem.h>
+
+#include "protos/plugin_metrics.pb.h"
+
+namespace android {
+
+namespace {
+
+using android::drm_metrics::MetricsGroup;
+using android::drm_metrics::MetricsGroup_Metric;
+using android::drm_metrics::MetricsGroup_Metric_MetricValue;
+
+const char* const kParentAttribute = "/parent/external";
+
+status_t reportMetricsGroup(const MetricsGroup& metricsGroup,
+ const String8& batchName,
+ const int64_t* parentId) {
+ MediaAnalyticsItem analyticsItem(batchName.c_str());
+ analyticsItem.generateSessionID();
+ int64_t sessionId = analyticsItem.getSessionID();
+ if (parentId != NULL) {
+ analyticsItem.setInt64(kParentAttribute, *parentId);
+ }
+
+ // Report the package name.
+ if (metricsGroup.has_app_package_name()) {
+ AString app_package_name(metricsGroup.app_package_name().c_str(),
+ metricsGroup.app_package_name().size());
+ analyticsItem.setPkgName(app_package_name);
+ }
+
+ for (int i = 0; i < metricsGroup.metric_size(); ++i) {
+ const MetricsGroup_Metric& metric = metricsGroup.metric(i);
+ if (!metric.has_name()) {
+ ALOGE("Metric with no name.");
+ return BAD_VALUE;
+ }
+
+ if (!metric.has_value()) {
+ ALOGE("Metric with no value.");
+ return BAD_VALUE;
+ }
+
+ const MetricsGroup_Metric_MetricValue& value = metric.value();
+ if (value.has_int_value()) {
+ analyticsItem.setInt64(metric.name().c_str(),
+ value.int_value());
+ } else if (value.has_double_value()) {
+ analyticsItem.setDouble(metric.name().c_str(),
+ value.double_value());
+ } else if (value.has_string_value()) {
+ analyticsItem.setCString(metric.name().c_str(),
+ value.string_value().c_str());
+ } else {
+ ALOGE("Metric Value with no actual value.");
+ return BAD_VALUE;
+ }
+ }
+
+ analyticsItem.setFinalized(true);
+ if (!analyticsItem.selfrecord()) {
+ // Note the cast to int is because we build on 32 and 64 bit.
+ // The cast prevents a peculiar printf problem where one format cannot
+ // satisfy both.
+ ALOGE("selfrecord() returned false. sessioId %d", (int) sessionId);
+ }
+
+ for (int i = 0; i < metricsGroup.metric_sub_group_size(); ++i) {
+ const MetricsGroup& subGroup = metricsGroup.metric_sub_group(i);
+ status_t res = reportMetricsGroup(subGroup, batchName, &sessionId);
+ if (res != OK) {
+ return res;
+ }
+ }
+
+ return OK;
+}
+
+String8 sanitize(const String8& input) {
+ // Filters the input string down to just alphanumeric characters.
+ String8 output;
+ for (size_t i = 0; i < input.size(); ++i) {
+ char candidate = input[i];
+ if ((candidate >= 'a' && candidate <= 'z') ||
+ (candidate >= 'A' && candidate <= 'Z') ||
+ (candidate >= '0' && candidate <= '9')) {
+ output.append(&candidate, 1);
+ }
+ }
+ return output;
+}
+
+} // namespace
+
+status_t reportDrmPluginMetrics(const Vector<uint8_t>& serializedMetrics,
+ const String8& vendor,
+ const String8& description) {
+ MetricsGroup root_metrics_group;
+ if (!root_metrics_group.ParseFromArray(serializedMetrics.array(),
+ serializedMetrics.size())) {
+ ALOGE("Failure to parse.");
+ return BAD_VALUE;
+ }
+
+ String8 name = String8::format("drm.vendor.%s.%s",
+ sanitize(vendor).c_str(),
+ sanitize(description).c_str());
+
+ return reportMetricsGroup(root_metrics_group, name, NULL);
+}
+
+} // namespace android
diff --git a/drm/libmediadrm/aidl/android/media/ICas.aidl b/drm/libmediadrm/aidl/android/media/ICas.aidl
deleted file mode 100644
index 9746593..0000000
--- a/drm/libmediadrm/aidl/android/media/ICas.aidl
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.media;
-
-import android.media.MediaCas;
-
-/** @hide */
-interface ICas {
- void setPrivateData(in byte[] pvtData);
- byte[] openSession();
- void closeSession(in byte[] sessionId);
- void setSessionPrivateData(in byte[] sessionId, in byte[] pvtData);
- void processEcm(in byte[] sessionId, in MediaCas.ParcelableCasData ecm);
- void processEmm(in MediaCas.ParcelableCasData emm);
- void sendEvent(int event, int arg, in @nullable byte[] eventData);
- void provision(String provisionString);
- void refreshEntitlements(int refreshType, in @nullable byte[] refreshData);
- void release();
-}
\ No newline at end of file
diff --git a/drm/libmediadrm/aidl/android/media/ICasListener.aidl b/drm/libmediadrm/aidl/android/media/ICasListener.aidl
deleted file mode 100644
index 01a5abc..0000000
--- a/drm/libmediadrm/aidl/android/media/ICasListener.aidl
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.media;
-
-/** @hide */
-interface ICasListener {
- void onEvent(int event, int arg, in @nullable byte[] data);
-}
\ No newline at end of file
diff --git a/drm/libmediadrm/aidl/android/media/IDescrambler.aidl b/drm/libmediadrm/aidl/android/media/IDescrambler.aidl
deleted file mode 100644
index fdf99eb..0000000
--- a/drm/libmediadrm/aidl/android/media/IDescrambler.aidl
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.media;
-
-import android.media.MediaDescrambler;
-
-/** @hide */
-interface IDescrambler {
- void setMediaCasSession(in byte[] sessionId);
- boolean requiresSecureDecoderComponent(String mime);
- int descramble(in MediaDescrambler.DescrambleInfo descrambleInfo);
- void release();
-}
\ No newline at end of file
diff --git a/drm/libmediadrm/aidl/android/media/IMediaCasService.aidl b/drm/libmediadrm/aidl/android/media/IMediaCasService.aidl
deleted file mode 100644
index 44f6825..0000000
--- a/drm/libmediadrm/aidl/android/media/IMediaCasService.aidl
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.media;
-
-import android.media.IDescrambler;
-import android.media.ICas;
-import android.media.ICasListener;
-import android.media.MediaCas;
-
-/** @hide */
-interface IMediaCasService {
- MediaCas.ParcelableCasPluginDescriptor[] enumeratePlugins();
- boolean isSystemIdSupported(int CA_system_id);
- ICas createPlugin(int CA_system_id, ICasListener listener);
- boolean isDescramblerSupported(int CA_system_id);
- IDescrambler createDescrambler(int CA_system_id);
-}
-
diff --git a/drm/libmediadrm/aidl/android/media/MediaCas.aidl b/drm/libmediadrm/aidl/android/media/MediaCas.aidl
deleted file mode 100644
index cb8d0c6..0000000
--- a/drm/libmediadrm/aidl/android/media/MediaCas.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.media;
-
-/** @hide */
-parcelable MediaCas.ParcelableCasPluginDescriptor cpp_header "media/MediaCasDefs.h";
-
-/** @hide */
-parcelable MediaCas.ParcelableCasData cpp_header "media/MediaCasDefs.h";
\ No newline at end of file
diff --git a/drm/libmediadrm/aidl/android/media/MediaDescrambler.aidl b/drm/libmediadrm/aidl/android/media/MediaDescrambler.aidl
deleted file mode 100644
index e789244..0000000
--- a/drm/libmediadrm/aidl/android/media/MediaDescrambler.aidl
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.media;
-
-/** @hide */
-parcelable MediaDescrambler.DescrambleInfo cpp_header "media/MediaCasDefs.h";
\ No newline at end of file
diff --git a/drm/libmediadrm/protos/plugin_metrics.proto b/drm/libmediadrm/protos/plugin_metrics.proto
new file mode 100644
index 0000000..7e3bcf5
--- /dev/null
+++ b/drm/libmediadrm/protos/plugin_metrics.proto
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto2";
+
+package android.drm_metrics;
+
+// need this if we are using libprotobuf-cpp-2.3.0-lite
+option optimize_for = LITE_RUNTIME;
+
+// The MetricsGroup is a collection of metric name/value pair instances
+// that can be serialized and provided to a caller.
+message MetricsGroup {
+ message Metric {
+ message MetricValue {
+ // Exactly one of the following values must be set.
+ optional int64 int_value = 1;
+ optional double double_value = 2;
+ optional string string_value = 3;
+ }
+
+ // The name of the metric. Must be valid UTF-8. Required.
+ optional string name = 1;
+
+ // The value of the metric. Required.
+ optional MetricValue value = 2;
+ }
+
+ // The list of name/value pairs of metrics.
+ repeated Metric metric = 1;
+
+ // Allow multiple sub groups of metrics.
+ repeated MetricsGroup metric_sub_group = 2;
+
+ // Name of the application package associated with the metrics.
+ optional string app_package_name = 3;
+}
diff --git a/drm/mediacas/plugins/clearkey/Android.mk b/drm/mediacas/plugins/clearkey/Android.mk
index 8fd866c..4b139a8 100644
--- a/drm/mediacas/plugins/clearkey/Android.mk
+++ b/drm/mediacas/plugins/clearkey/Android.mk
@@ -28,8 +28,7 @@
LOCAL_MODULE := libclearkeycasplugin
-#TODO: move this back to /vendor/lib after conversion to treble
-#LOCAL_PROPRIETARY_MODULE := true
+LOCAL_PROPRIETARY_MODULE := true
LOCAL_MODULE_RELATIVE_PATH := mediacas
LOCAL_SHARED_LIBRARIES := \
@@ -39,6 +38,9 @@
libstagefright_foundation \
libprotobuf-cpp-lite \
+LOCAL_HEADER_LIBRARIES := \
+ media_plugin_headers
+
LOCAL_STATIC_LIBRARIES := \
libjsmn \
diff --git a/drm/mediacas/plugins/clearkey/ClearKeyCasPlugin.cpp b/drm/mediacas/plugins/clearkey/ClearKeyCasPlugin.cpp
index 4ed5fce..e27631f 100644
--- a/drm/mediacas/plugins/clearkey/ClearKeyCasPlugin.cpp
+++ b/drm/mediacas/plugins/clearkey/ClearKeyCasPlugin.cpp
@@ -121,7 +121,7 @@
sp<ClearKeyCasSession> session =
ClearKeySessionLibrary::get()->findSession(sessionId);
if (session == NULL) {
- return ERROR_DRM_SESSION_NOT_OPENED;
+ return ERROR_CAS_SESSION_NOT_OPENED;
}
ClearKeySessionLibrary::get()->destroySession(sessionId);
@@ -135,7 +135,7 @@
sp<ClearKeyCasSession> session =
ClearKeySessionLibrary::get()->findSession(sessionId);
if (session == NULL) {
- return ERROR_DRM_SESSION_NOT_OPENED;
+ return ERROR_CAS_SESSION_NOT_OPENED;
}
return OK;
}
@@ -146,7 +146,7 @@
sp<ClearKeyCasSession> session =
ClearKeySessionLibrary::get()->findSession(sessionId);
if (session == NULL) {
- return ERROR_DRM_SESSION_NOT_OPENED;
+ return ERROR_CAS_SESSION_NOT_OPENED;
}
Mutex::Autolock lock(mKeyFetcherLock);
@@ -293,7 +293,7 @@
status_t ClearKeyCasSession::updateECM(
KeyFetcher *keyFetcher, void *ecm, size_t size) {
if (keyFetcher == nullptr) {
- return ERROR_DRM_NOT_PROVISIONED;
+ return ERROR_CAS_NOT_PROVISIONED;
}
if (size < kEcmHeaderLength) {
@@ -344,7 +344,7 @@
size_t numSubSamples, const DescramblerPlugin::SubSample *subSamples,
const void *srcPtr, void *dstPtr, AString * /* errorDetailMsg */) {
if (secure) {
- return ERROR_DRM_CANNOT_HANDLE;
+ return ERROR_CAS_CANNOT_HANDLE;
}
AES_KEY contentKey;
@@ -356,7 +356,7 @@
int32_t keyIndex = (scramblingControl & 1);
if (!mKeyInfo[keyIndex].valid) {
ALOGE("decrypt: key %d is invalid", keyIndex);
- return ERROR_DRM_DECRYPT;
+ return ERROR_CAS_DECRYPT;
}
contentKey = mKeyInfo[keyIndex].contentKey;
}
@@ -420,7 +420,7 @@
if (session == NULL) {
ALOGE("ClearKeyDescramblerPlugin: session not found");
- return ERROR_DRM_SESSION_NOT_OPENED;
+ return ERROR_CAS_SESSION_NOT_OPENED;
}
mCASSession = session;
@@ -446,7 +446,7 @@
if (mCASSession == NULL) {
ALOGE("Uninitialized CAS session!");
- return ERROR_DRM_DECRYPT_UNIT_NOT_INITIALIZED;
+ return ERROR_CAS_DECRYPT_UNIT_NOT_INITIALIZED;
}
return mCASSession->decrypt(
diff --git a/drm/mediacas/plugins/clearkey/ClearKeyFetcher.cpp b/drm/mediacas/plugins/clearkey/ClearKeyFetcher.cpp
index cb69f91..eaa3390 100644
--- a/drm/mediacas/plugins/clearkey/ClearKeyFetcher.cpp
+++ b/drm/mediacas/plugins/clearkey/ClearKeyFetcher.cpp
@@ -89,7 +89,7 @@
// asset_id change. If it sends an EcmContainer with 2 Ecms with different
// asset_ids (old and new) then it might be best to prefetch the Emm.
if ((asset_.id() != 0) && (*asset_id != asset_.id())) {
- ALOGW("Asset_id change from %" PRIu64 " to %" PRIu64, asset_.id(), *asset_id);
+ ALOGW("Asset_id change from %llu to %" PRIu64, asset_.id(), *asset_id);
asset_.Clear();
}
diff --git a/drm/mediacas/plugins/clearkey/ClearKeySessionLibrary.cpp b/drm/mediacas/plugins/clearkey/ClearKeySessionLibrary.cpp
index faea008..4b4051d 100644
--- a/drm/mediacas/plugins/clearkey/ClearKeySessionLibrary.cpp
+++ b/drm/mediacas/plugins/clearkey/ClearKeySessionLibrary.cpp
@@ -95,7 +95,7 @@
void ClearKeySessionLibrary::destroyPlugin(CasPlugin *plugin) {
Mutex::Autolock lock(mSessionsLock);
- for (ssize_t index = mIDToSessionMap.size() - 1; index >= 0; index--) {
+ for (ssize_t index = (ssize_t)mIDToSessionMap.size() - 1; index >= 0; index--) {
sp<ClearKeyCasSession> session = mIDToSessionMap.valueAt(index);
if (session->getPlugin() == plugin) {
mIDToSessionMap.removeItemsAt(index);
diff --git a/drm/mediacas/plugins/clearkey/JsonAssetLoader.cpp b/drm/mediacas/plugins/clearkey/JsonAssetLoader.cpp
index 9cd77e9..ee8dba3 100644
--- a/drm/mediacas/plugins/clearkey/JsonAssetLoader.cpp
+++ b/drm/mediacas/plugins/clearkey/JsonAssetLoader.cpp
@@ -36,8 +36,6 @@
const String8 kCasTypeTag("cas_type");
const String8 kBase64Padding("=");
-const uint32_t kKeyLength = 16;
-
JsonAssetLoader::JsonAssetLoader() {
}
@@ -48,24 +46,24 @@
* Extract a clear key asset from a JSON string.
*
* Returns OK if a clear key asset is extracted successfully,
- * or ERROR_DRM_NO_LICENSE if the string doesn't contain a valid
+ * or ERROR_CAS_NO_LICENSE if the string doesn't contain a valid
* clear key asset.
*/
status_t JsonAssetLoader::extractAssetFromString(
const String8& jsonAssetString, Asset *asset) {
if (!parseJsonAssetString(jsonAssetString, &mJsonObjects)) {
- return ERROR_DRM_NO_LICENSE;
+ return ERROR_CAS_NO_LICENSE;
}
if (mJsonObjects.size() < 1) {
- return ERROR_DRM_NO_LICENSE;
+ return ERROR_CAS_NO_LICENSE;
}
if (!parseJsonObject(mJsonObjects[0], &mTokens))
- return ERROR_DRM_NO_LICENSE;
+ return ERROR_CAS_NO_LICENSE;
if (!findKey(mJsonObjects[0], asset)) {
- return ERROR_DRM_NO_LICENSE;
+ return ERROR_CAS_NO_LICENSE;
}
return OK;
}
diff --git a/drm/mediacas/plugins/clearkey/ecm_generator.cpp b/drm/mediacas/plugins/clearkey/ecm_generator.cpp
index 7d29659..218ce35 100644
--- a/drm/mediacas/plugins/clearkey/ecm_generator.cpp
+++ b/drm/mediacas/plugins/clearkey/ecm_generator.cpp
@@ -38,8 +38,6 @@
const uint16_t kTotalEcmSize =
kEcmClearFieldsSize + kContentKeyByteSize; // clear fields + clear key
-const uint32_t kKeyLength = 16;
-
#define UNALIGNED_LOAD32(_p) (*reinterpret_cast<const uint32_t *>(_p))
static uint32_t Load32(const void *p) {
diff --git a/drm/mediacas/plugins/clearkey/ecm_generator.h b/drm/mediacas/plugins/clearkey/ecm_generator.h
index 2ef06c4..5fbdea5 100644
--- a/drm/mediacas/plugins/clearkey/ecm_generator.h
+++ b/drm/mediacas/plugins/clearkey/ecm_generator.h
@@ -29,7 +29,7 @@
namespace android {
namespace clearkeycas {
enum {
- CLEARKEY_STATUS_BASE = ERROR_DRM_VENDOR_MAX,
+ CLEARKEY_STATUS_BASE = ERROR_CAS_VENDOR_MAX,
CLEARKEY_STATUS_INVALIDASSETID = CLEARKEY_STATUS_BASE - 1,
CLEARKEY_STATUS_INVALIDSYSTEMID = CLEARKEY_STATUS_BASE - 2,
CLEARKEY_STATUS_INVALID_PARAMETER = CLEARKEY_STATUS_BASE - 3,
diff --git a/drm/mediacas/plugins/clearkey/tests/Android.mk b/drm/mediacas/plugins/clearkey/tests/Android.mk
index cbf7be7..e1545af 100644
--- a/drm/mediacas/plugins/clearkey/tests/Android.mk
+++ b/drm/mediacas/plugins/clearkey/tests/Android.mk
@@ -21,12 +21,13 @@
ClearKeyFetcherTest.cpp
LOCAL_MODULE := ClearKeyFetcherTest
+LOCAL_VENDOR_MODULE := true
# LOCAL_LDFLAGS is needed here for the test to use the plugin, because
# the plugin is not in standard library search path. Without this .so
# loading fails at run-time (linking is okay).
LOCAL_LDFLAGS := \
- -Wl,--rpath,\$${ORIGIN}/../../../system/lib/mediacas -Wl,--enable-new-dtags
+ -Wl,--rpath,\$${ORIGIN}/../../../system/vendor/lib/mediacas -Wl,--enable-new-dtags
LOCAL_SHARED_LIBRARIES := \
libutils libclearkeycasplugin libstagefright_foundation libprotobuf-cpp-lite liblog
diff --git a/drm/mediacas/plugins/clearkey/tests/ClearKeyFetcherTest.cpp b/drm/mediacas/plugins/clearkey/tests/ClearKeyFetcherTest.cpp
index ace086a..d12cfeb 100644
--- a/drm/mediacas/plugins/clearkey/tests/ClearKeyFetcherTest.cpp
+++ b/drm/mediacas/plugins/clearkey/tests/ClearKeyFetcherTest.cpp
@@ -93,7 +93,7 @@
uint64_t asset_id;
std::vector<KeyFetcher::KeyInfo> keys;
EXPECT_EQ(OK, fetcher.ObtainKey(ecm_, &asset_id, &keys));
- EXPECT_EQ(2, keys.size());
+ EXPECT_EQ(2U, keys.size());
EXPECT_EQ(0, keys[0].key_id);
EXPECT_EQ(content_key_[0]->size(), keys[0].key_bytes->size());
EXPECT_EQ(0, memcmp(content_key_[0]->data(),
diff --git a/drm/mediacas/plugins/mock/Android.mk b/drm/mediacas/plugins/mock/Android.mk
index a97fac6..a1d61da 100644
--- a/drm/mediacas/plugins/mock/Android.mk
+++ b/drm/mediacas/plugins/mock/Android.mk
@@ -28,6 +28,8 @@
LOCAL_SHARED_LIBRARIES := \
libutils liblog
+LOCAL_HEADER_LIBRARIES := media_plugin_headers
+
LOCAL_C_INCLUDES += \
$(TOP)/frameworks/av/include \
$(TOP)/frameworks/native/include/media \
diff --git a/drm/mediacas/plugins/mock/MockCasPlugin.cpp b/drm/mediacas/plugins/mock/MockCasPlugin.cpp
index 18cd9a4..06516b5 100644
--- a/drm/mediacas/plugins/mock/MockCasPlugin.cpp
+++ b/drm/mediacas/plugins/mock/MockCasPlugin.cpp
@@ -49,8 +49,8 @@
status_t MockCasFactory::createPlugin(
int32_t CA_system_id,
- uint64_t appData,
- CasPluginCallback callback,
+ uint64_t /*appData*/,
+ CasPluginCallback /*callback*/,
CasPlugin **plugin) {
if (!isSystemIdSupported(CA_system_id)) {
return BAD_VALUE;
@@ -98,7 +98,7 @@
MockSessionLibrary::get()->destroyPlugin(this);
}
-status_t MockCasPlugin::setPrivateData(const CasData &data) {
+status_t MockCasPlugin::setPrivateData(const CasData& /*data*/) {
ALOGV("setPrivateData");
return OK;
}
@@ -123,7 +123,7 @@
}
status_t MockCasPlugin::setSessionPrivateData(
- const CasSessionId &sessionId, const CasData &data) {
+ const CasSessionId &sessionId, const CasData& /*data*/) {
ALOGV("setSessionPrivateData: sessionId=%s",
arrayToString(sessionId).string());
Mutex::Autolock lock(mLock);
@@ -146,7 +146,7 @@
if (session == NULL) {
return BAD_VALUE;
}
- ALOGV("ECM: size=%d", ecm.size());
+ ALOGV("ECM: size=%zu", ecm.size());
ALOGV("ECM: data=%s", arrayToString(ecm).string());
return OK;
@@ -156,14 +156,14 @@
ALOGV("processEmm");
Mutex::Autolock lock(mLock);
- ALOGV("EMM: size=%d", emm.size());
+ ALOGV("EMM: size=%zu", emm.size());
ALOGV("EMM: data=%s", arrayToString(emm).string());
return OK;
}
status_t MockCasPlugin::sendEvent(
- int32_t event, int arg, const CasData &eventData) {
+ int32_t event, int /*arg*/, const CasData& /*eventData*/) {
ALOGV("sendEvent: event=%d", event);
Mutex::Autolock lock(mLock);
@@ -178,7 +178,7 @@
}
status_t MockCasPlugin::refreshEntitlements(
- int32_t refreshType, const CasData &refreshData) {
+ int32_t /*refreshType*/, const CasData &refreshData) {
ALOGV("refreshEntitlements: refreshData=%s", arrayToString(refreshData).string());
Mutex::Autolock lock(mLock);
@@ -216,7 +216,7 @@
int32_t srcOffset,
void *dstPtr,
int32_t dstOffset,
- AString *errorDetailMsg) {
+ AString* /*errorDetailMsg*/) {
ALOGV("MockDescramblerPlugin::descramble(secure=%d, sctrl=%d,"
"subSamples=%s, srcPtr=%p, dstPtr=%p, srcOffset=%d, dstOffset=%d)",
(int)secure, (int)scramblingControl,
diff --git a/drm/mediadrm/plugins/clearkey/ClearKeyUUID.cpp b/drm/mediadrm/plugins/clearkey/ClearKeyUUID.cpp
index ed050f7..0259a42 100644
--- a/drm/mediadrm/plugins/clearkey/ClearKeyUUID.cpp
+++ b/drm/mediadrm/plugins/clearkey/ClearKeyUUID.cpp
@@ -21,12 +21,19 @@
namespace clearkeydrm {
bool isClearKeyUUID(const uint8_t uuid[16]) {
- static const uint8_t kClearKeyUUID[16] = {
+ static const uint8_t kCommonPsshBoxUUID[16] = {
0x10,0x77,0xEF,0xEC,0xC0,0xB2,0x4D,0x02,
0xAC,0xE3,0x3C,0x1E,0x52,0xE2,0xFB,0x4B
};
- return !memcmp(uuid, kClearKeyUUID, sizeof(kClearKeyUUID));
+ // To be used in mpd to specify drm scheme for players
+ static const uint8_t kClearKeyUUID[16] = {
+ 0xE2,0x71,0x9D,0x58,0xA9,0x85,0xB3,0xC9,
+ 0x78,0x1A,0xB0,0x30,0xAF,0x78,0xD3,0x0E
+ };
+
+ return !memcmp(uuid, kCommonPsshBoxUUID, sizeof(kCommonPsshBoxUUID)) ||
+ !memcmp(uuid, kClearKeyUUID, sizeof(kClearKeyUUID));
}
} // namespace clearkeydrm
diff --git a/drm/mediadrm/plugins/clearkey/DrmPlugin.cpp b/drm/mediadrm/plugins/clearkey/DrmPlugin.cpp
index 5fdac5c..ec07d87 100644
--- a/drm/mediadrm/plugins/clearkey/DrmPlugin.cpp
+++ b/drm/mediadrm/plugins/clearkey/DrmPlugin.cpp
@@ -25,10 +25,28 @@
#include "Session.h"
+namespace {
+const android::String8 kStreaming("Streaming");
+const android::String8 kOffline("Offline");
+const android::String8 kTrue("True");
+
+const android::String8 kQueryKeyLicenseType("LicenseType");
+ // Value: "Streaming" or "Offline"
+const android::String8 kQueryKeyPlayAllowed("PlayAllowed");
+ // Value: "True" or "False"
+const android::String8 kQueryKeyRenewAllowed("RenewAllowed");
+ // Value: "True" or "False"
+};
+
namespace clearkeydrm {
using android::sp;
+DrmPlugin::DrmPlugin(SessionLibrary* sessionLibrary)
+ : mSessionLibrary(sessionLibrary) {
+ mPlayPolicy.clear();
+}
+
status_t DrmPlugin::openSession(Vector<uint8_t>& sessionId) {
sp<Session> session = mSessionLibrary->createSession();
sessionId = session->sessionId();
@@ -60,18 +78,28 @@
if (scope.size() == 0) {
return android::BAD_VALUE;
}
+
if (keyType != kKeyType_Streaming) {
return android::ERROR_DRM_CANNOT_HANDLE;
}
+
*keyRequestType = DrmPlugin::kKeyRequestType_Initial;
defaultUrl.clear();
sp<Session> session = mSessionLibrary->findSession(scope);
if (!session.get()) {
return android::ERROR_DRM_SESSION_NOT_OPENED;
}
+
return session->getKeyRequest(initData, mimeType, &request);
}
+void DrmPlugin::setPlayPolicy() {
+ mPlayPolicy.clear();
+ mPlayPolicy.add(kQueryKeyLicenseType, kStreaming);
+ mPlayPolicy.add(kQueryKeyPlayAllowed, kTrue);
+ mPlayPolicy.add(kQueryKeyRenewAllowed, kTrue);
+}
+
status_t DrmPlugin::provideKeyResponse(
const Vector<uint8_t>& scope,
const Vector<uint8_t>& response,
@@ -83,6 +111,8 @@
if (!session.get()) {
return android::ERROR_DRM_SESSION_NOT_OPENED;
}
+
+ setPlayPolicy();
status_t res = session->provideKeyResponse(response);
if (res == android::OK) {
// This is for testing AMediaDrm_setOnEventListener only.
@@ -111,4 +141,18 @@
return android::OK;
}
+status_t DrmPlugin::queryKeyStatus(
+ const Vector<uint8_t>& sessionId,
+ KeyedVector<String8, String8>& infoMap) const {
+
+ if (sessionId.size() == 0) {
+ return android::BAD_VALUE;
+ }
+
+ infoMap.clear();
+ for (size_t i = 0; i < mPlayPolicy.size(); ++i) {
+ infoMap.add(mPlayPolicy.keyAt(i), mPlayPolicy.valueAt(i));
+ }
+ return android::OK;
+}
} // namespace clearkeydrm
diff --git a/drm/mediadrm/plugins/clearkey/DrmPlugin.h b/drm/mediadrm/plugins/clearkey/DrmPlugin.h
index 58421b9..f37a706 100644
--- a/drm/mediadrm/plugins/clearkey/DrmPlugin.h
+++ b/drm/mediadrm/plugins/clearkey/DrmPlugin.h
@@ -39,8 +39,8 @@
class DrmPlugin : public android::DrmPlugin {
public:
- explicit DrmPlugin(SessionLibrary* sessionLibrary)
- : mSessionLibrary(sessionLibrary) {}
+ explicit DrmPlugin(SessionLibrary* sessionLibrary);
+
virtual ~DrmPlugin() {}
virtual status_t openSession(Vector<uint8_t>& sessionId);
@@ -81,13 +81,7 @@
virtual status_t queryKeyStatus(
const Vector<uint8_t>& sessionId,
- KeyedVector<String8, String8>& infoMap) const {
- if (sessionId.size() == 0) {
- return android::BAD_VALUE;
- }
- UNUSED(infoMap);
- return android::ERROR_DRM_CANNOT_HANDLE;
- }
+ KeyedVector<String8, String8>& infoMap) const;
virtual status_t getProvisionRequest(
const String8& cert_type,
@@ -248,9 +242,12 @@
}
private:
- DISALLOW_EVIL_CONSTRUCTORS(DrmPlugin);
+ void setPlayPolicy();
+ android::KeyedVector<android::String8, android::String8> mPlayPolicy;
SessionLibrary* mSessionLibrary;
+
+ DISALLOW_EVIL_CONSTRUCTORS(DrmPlugin);
};
} // namespace clearkeydrm
diff --git a/drm/mediadrm/plugins/clearkey/InitDataParser.cpp b/drm/mediadrm/plugins/clearkey/InitDataParser.cpp
index 6a4f8d5..caff393 100644
--- a/drm/mediadrm/plugins/clearkey/InitDataParser.cpp
+++ b/drm/mediadrm/plugins/clearkey/InitDataParser.cpp
@@ -136,7 +136,7 @@
AString encodedId;
for (size_t i = 0; i < keyIds.size(); ++i) {
encodedId.clear();
- android::encodeBase64(keyIds[i], kKeyIdSize, &encodedId);
+ android::encodeBase64Url(keyIds[i], kKeyIdSize, &encodedId);
if (i != 0) {
request.append(",");
}
diff --git a/drm/mediadrm/plugins/clearkey/tests/Android.bp b/drm/mediadrm/plugins/clearkey/tests/Android.bp
index 93feb80..ea17bbb 100644
--- a/drm/mediadrm/plugins/clearkey/tests/Android.bp
+++ b/drm/mediadrm/plugins/clearkey/tests/Android.bp
@@ -36,4 +36,5 @@
"libstagefright_foundation",
"libutils",
],
+ header_libs: ["media_plugin_headers"],
}
diff --git a/drm/mediadrm/plugins/clearkey/tests/InitDataParserUnittest.cpp b/drm/mediadrm/plugins/clearkey/tests/InitDataParserUnittest.cpp
index 84ed242..8c49656 100644
--- a/drm/mediadrm/plugins/clearkey/tests/InitDataParserUnittest.cpp
+++ b/drm/mediadrm/plugins/clearkey/tests/InitDataParserUnittest.cpp
@@ -59,7 +59,7 @@
(size_t)requestString.find(kRequestSuffix));
for (size_t i = 0; i < expectedKeys.size(); ++i) {
AString encodedIdAString;
- android::encodeBase64(expectedKeys[i], kKeyIdSize,
+ android::encodeBase64Url(expectedKeys[i], kKeyIdSize,
&encodedIdAString);
String8 encodedId(encodedIdAString.c_str());
encodedId.removeAll(kBase64Padding);
@@ -231,5 +231,4 @@
attemptParseExpectingFailure(initData, kCencMimeType);
}
-
} // namespace clearkeydrm
diff --git a/drm/mediadrm/plugins/clearkey/tests/JsonWebKeyUnittest.cpp b/drm/mediadrm/plugins/clearkey/tests/JsonWebKeyUnittest.cpp
index c3b0d84..d9f3ea6 100644
--- a/drm/mediadrm/plugins/clearkey/tests/JsonWebKeyUnittest.cpp
+++ b/drm/mediadrm/plugins/clearkey/tests/JsonWebKeyUnittest.cpp
@@ -284,14 +284,14 @@
"\"keys\":"
"[{"
"\"kid\":\"Y2xlYXJrZXlrZXlpZDAx\""
- "\"k\":\"SGVsbG8gRnJpZW5kISE\""
+ "\"k\":\"SGVsbG8gRnJpZW5kICE-Pw\""
"\"kty\":\"oct\""
"\"alg\":\"A128KW1\""
"}"
"{"
"\"kty\":\"oct\""
"\"alg\":\"A128KW2\""
- "\"k\":\"SGVsbG8gRnJpZW5kIQ\""
+ "\"k\":\"SGVsbG8gRnJpZW5kICE_\""
"\"kid\":\"Y2xlYXJrZXlrZXlpZDAy\""
"}"
"{"
@@ -303,7 +303,7 @@
"{"
"\"alg\":\"A128KW3\""
"\"kid\":\"Y2xlYXJrZXlrZXlpZDAz\""
- "\"k\":\"R29vZCBkYXkh\""
+ "\"k\":\"SGVsbG8gPz4-IEZyaWVuZCA_Pg\""
"\"kty\":\"oct\""
"}]"
"}");
@@ -313,8 +313,8 @@
EXPECT_TRUE(keys.size() == 3);
const String8 clearKeys[] =
- { String8("Hello Friend!!"), String8("Hello Friend!"),
- String8("Good day!") };
+ { String8("Hello Friend !>?"), String8("Hello Friend !?"),
+ String8("Hello ?>> Friend ?>") };
verifyKeys(keys, clearKeys);
}
diff --git a/drm/mediadrm/plugins/mock/Android.bp b/drm/mediadrm/plugins/mock/Android.bp
index f0a1ddd..dd2ad7b 100644
--- a/drm/mediadrm/plugins/mock/Android.bp
+++ b/drm/mediadrm/plugins/mock/Android.bp
@@ -22,6 +22,8 @@
vendor: true,
relative_install_path: "mediadrm",
+ header_libs: ["media_plugin_headers"],
+
shared_libs: [
"libutils",
"liblog",
diff --git a/include/OWNERS b/include/OWNERS
index 0ec7529..3cb6d9c 100644
--- a/include/OWNERS
+++ b/include/OWNERS
@@ -1,5 +1,6 @@
elaurent@google.com
gkasten@android.com
hunga@google.com
+jtinker@google.com
lajos@google.com
marcone@google.com
diff --git a/include/media/AudioClient.h b/include/media/AudioClient.h
deleted file mode 120000
index a0530e4..0000000
--- a/include/media/AudioClient.h
+++ /dev/null
@@ -1 +0,0 @@
-../../media/libaudioclient/include/media/AudioClient.h
\ No newline at end of file
diff --git a/include/media/AudioClient.h b/include/media/AudioClient.h
new file mode 100644
index 0000000..9efd76d
--- /dev/null
+++ b/include/media/AudioClient.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef ANDROID_AUDIO_CLIENT_H
+#define ANDROID_AUDIO_CLIENT_H
+
+#include <system/audio.h>
+#include <utils/String16.h>
+
+namespace android {
+
+class AudioClient {
+ public:
+ AudioClient() :
+ clientUid(-1), clientPid(-1), packageName("") {}
+
+ uid_t clientUid;
+ pid_t clientPid;
+ String16 packageName;
+};
+
+}; // namespace android
+
+#endif // ANDROID_AUDIO_CLIENT_H
diff --git a/include/media/AudioResampler.h b/include/media/AudioResampler.h
index 50e12f4..771f1b8 120000
--- a/include/media/AudioResampler.h
+++ b/include/media/AudioResampler.h
@@ -1 +1 @@
-../../media/libaudioprocessing/include/AudioResampler.h
\ No newline at end of file
+../../media/libaudioprocessing/include/media/AudioResampler.h
\ No newline at end of file
diff --git a/include/media/AudioResamplerPublic.h b/include/media/AudioResamplerPublic.h
index 309c23d..ce30a78 120000
--- a/include/media/AudioResamplerPublic.h
+++ b/include/media/AudioResamplerPublic.h
@@ -1 +1 @@
-../../media/libaudioprocessing/include/AudioResamplerPublic.h
\ No newline at end of file
+../../media/libaudioprocessing/include/media/AudioResamplerPublic.h
\ No newline at end of file
diff --git a/include/media/CasImpl.h b/include/media/CasImpl.h
deleted file mode 100644
index 726f1ce..0000000
--- a/include/media/CasImpl.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef CAS_IMPL_H_
-#define CAS_IMPL_H_
-
-#include <media/stagefright/foundation/ABase.h>
-#include <android/media/BnCas.h>
-
-namespace android {
-namespace media {
-class ICasListener;
-}
-using namespace media;
-using namespace MediaCas;
-using binder::Status;
-struct CasPlugin;
-class SharedLibrary;
-
-class CasImpl : public BnCas {
-public:
- CasImpl(const sp<ICasListener> &listener);
- virtual ~CasImpl();
-
- static void OnEvent(
- void *appData,
- int32_t event,
- int32_t arg,
- uint8_t *data,
- size_t size);
-
- void init(const sp<SharedLibrary>& library, CasPlugin *plugin);
- void onEvent(
- int32_t event,
- int32_t arg,
- uint8_t *data,
- size_t size);
-
- // ICas inherits
-
- virtual Status setPrivateData(
- const CasData& pvtData) override;
-
- virtual Status openSession(CasSessionId* _aidl_return) override;
-
- virtual Status closeSession(const CasSessionId& sessionId) override;
-
- virtual Status setSessionPrivateData(
- const CasSessionId& sessionId,
- const CasData& pvtData) override;
-
- virtual Status processEcm(
- const CasSessionId& sessionId, const ParcelableCasData& ecm) override;
-
- virtual Status processEmm(const ParcelableCasData& emm) override;
-
- virtual Status sendEvent(
- int32_t event, int32_t arg, const ::std::unique_ptr<CasData> &eventData) override;
-
- virtual Status provision(const String16& provisionString) override;
-
- virtual Status refreshEntitlements(
- int32_t refreshType, const ::std::unique_ptr<CasData> &refreshData) override;
-
- virtual Status release() override;
-
-private:
- struct PluginHolder;
- sp<SharedLibrary> mLibrary;
- sp<PluginHolder> mPluginHolder;
- sp<ICasListener> mListener;
-
- DISALLOW_EVIL_CONSTRUCTORS(CasImpl);
-};
-
-} // namespace android
-
-#endif // CAS_IMPL_H_
diff --git a/include/media/DescramblerImpl.h b/include/media/DescramblerImpl.h
deleted file mode 100644
index 9f212ac..0000000
--- a/include/media/DescramblerImpl.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef DESCRAMBLER_IMPL_H_
-#define DESCRAMBLER_IMPL_H_
-
-#include <media/stagefright/foundation/ABase.h>
-#include <android/media/BnDescrambler.h>
-
-namespace android {
-using namespace media;
-using namespace MediaDescrambler;
-using binder::Status;
-struct DescramblerPlugin;
-class SharedLibrary;
-
-class DescramblerImpl : public BnDescrambler {
-public:
- DescramblerImpl(const sp<SharedLibrary>& library, DescramblerPlugin *plugin);
- virtual ~DescramblerImpl();
-
- virtual Status setMediaCasSession(
- const CasSessionId& sessionId) override;
-
- virtual Status requiresSecureDecoderComponent(
- const String16& mime, bool *result) override;
-
- virtual Status descramble(
- const DescrambleInfo& descrambleInfo, int32_t *result) override;
-
- virtual Status release() override;
-
-private:
- sp<SharedLibrary> mLibrary;
- DescramblerPlugin *mPlugin;
-
- DISALLOW_EVIL_CONSTRUCTORS(DescramblerImpl);
-};
-
-} // namespace android
-
-#endif // DESCRAMBLER_IMPL_H_
diff --git a/include/media/MediaCasDefs.h b/include/media/MediaCasDefs.h
deleted file mode 100644
index 8c5a967..0000000
--- a/include/media/MediaCasDefs.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef MEDIA_CAS_DEFS_H_
-#define MEDIA_CAS_DEFS_H_
-
-#include <binder/Parcel.h>
-#include <media/cas/CasAPI.h>
-#include <media/cas/DescramblerAPI.h>
-#include <media/stagefright/foundation/ABase.h>
-
-namespace android {
-class IMemory;
-namespace media {
-
-namespace MediaCas {
-class ParcelableCasData : public CasData,
- public Parcelable {
-public:
- ParcelableCasData() {}
- ParcelableCasData(const uint8_t *data, size_t size) :
- CasData(data, data + size) {}
- virtual ~ParcelableCasData() {}
- status_t readFromParcel(const Parcel* parcel) override;
- status_t writeToParcel(Parcel* parcel) const override;
-
-private:
- DISALLOW_EVIL_CONSTRUCTORS(ParcelableCasData);
-};
-
-class ParcelableCasPluginDescriptor : public Parcelable {
-public:
- ParcelableCasPluginDescriptor(int32_t CA_system_id, const char *name)
- : mCASystemId(CA_system_id), mName(name) {}
-
- ParcelableCasPluginDescriptor() : mCASystemId(0) {}
-
- ParcelableCasPluginDescriptor(ParcelableCasPluginDescriptor&& desc) = default;
-
- virtual ~ParcelableCasPluginDescriptor() {}
-
- status_t readFromParcel(const Parcel* parcel) override;
- status_t writeToParcel(Parcel* parcel) const override;
-
-private:
- int32_t mCASystemId;
- String16 mName;
- DISALLOW_EVIL_CONSTRUCTORS(ParcelableCasPluginDescriptor);
-};
-}
-
-namespace MediaDescrambler {
-class DescrambleInfo : public Parcelable {
-public:
- enum DestinationType {
- kDestinationTypeVmPointer, // non-secure
- kDestinationTypeNativeHandle // secure
- };
-
- DestinationType dstType;
- DescramblerPlugin::ScramblingControl scramblingControl;
- size_t numSubSamples;
- DescramblerPlugin::SubSample *subSamples;
- sp<IMemory> srcMem;
- int32_t srcOffset;
- void *dstPtr;
- int32_t dstOffset;
-
- DescrambleInfo();
- virtual ~DescrambleInfo();
- status_t readFromParcel(const Parcel* parcel) override;
- status_t writeToParcel(Parcel* parcel) const override;
-
-private:
-
- DISALLOW_EVIL_CONSTRUCTORS(DescrambleInfo);
-};
-}
-
-} // namespace media
-} // namespace android
-
-
-#endif // MEDIA_CAS_DEFS_H_
diff --git a/include/media/PluginMetricsReporting.h b/include/media/PluginMetricsReporting.h
new file mode 120000
index 0000000..7d9a7a0
--- /dev/null
+++ b/include/media/PluginMetricsReporting.h
@@ -0,0 +1 @@
+../../media/libmedia/include/media/PluginMetricsReporting.h
\ No newline at end of file
diff --git a/include/media/audiohal b/include/media/audiohal
index 37e2c39..f400582 120000
--- a/include/media/audiohal
+++ b/include/media/audiohal
@@ -1 +1 @@
-../../media/libaudiohal/include
\ No newline at end of file
+../../media/libaudiohal/include/media/audiohal/
\ No newline at end of file
diff --git a/include/media/nbaio b/include/media/nbaio
deleted file mode 120000
index 67d0ba6..0000000
--- a/include/media/nbaio
+++ /dev/null
@@ -1 +0,0 @@
-../../media/libnbaio/include
\ No newline at end of file
diff --git a/include/media/nbaio/AudioBufferProviderSource.h b/include/media/nbaio/AudioBufferProviderSource.h
new file mode 120000
index 0000000..55841e7
--- /dev/null
+++ b/include/media/nbaio/AudioBufferProviderSource.h
@@ -0,0 +1 @@
+../../../media/libnbaio/include/media/nbaio/AudioBufferProviderSource.h
\ No newline at end of file
diff --git a/include/media/nbaio/AudioStreamInSource.h b/include/media/nbaio/AudioStreamInSource.h
new file mode 120000
index 0000000..f5bcc76
--- /dev/null
+++ b/include/media/nbaio/AudioStreamInSource.h
@@ -0,0 +1 @@
+../../../media/libnbaio/include/media/nbaio/AudioStreamInSource.h
\ No newline at end of file
diff --git a/include/media/nbaio/AudioStreamOutSink.h b/include/media/nbaio/AudioStreamOutSink.h
new file mode 120000
index 0000000..43bfac5
--- /dev/null
+++ b/include/media/nbaio/AudioStreamOutSink.h
@@ -0,0 +1 @@
+../../../media/libnbaio/include/media/nbaio/AudioStreamOutSink.h
\ No newline at end of file
diff --git a/include/media/nbaio/LibsndfileSink.h b/include/media/nbaio/LibsndfileSink.h
new file mode 120000
index 0000000..8a13b6c
--- /dev/null
+++ b/include/media/nbaio/LibsndfileSink.h
@@ -0,0 +1 @@
+../../../media/libnbaio/include/media/nbaio/LibsndfileSink.h
\ No newline at end of file
diff --git a/include/media/nbaio/LibsndfileSource.h b/include/media/nbaio/LibsndfileSource.h
new file mode 120000
index 0000000..2750fde
--- /dev/null
+++ b/include/media/nbaio/LibsndfileSource.h
@@ -0,0 +1 @@
+../../../media/libnbaio/include/media/nbaio/LibsndfileSource.h
\ No newline at end of file
diff --git a/include/media/nbaio/MonoPipe.h b/include/media/nbaio/MonoPipe.h
new file mode 120000
index 0000000..4ea43be
--- /dev/null
+++ b/include/media/nbaio/MonoPipe.h
@@ -0,0 +1 @@
+../../../media/libnbaio/include_mono/media/nbaio/MonoPipe.h
\ No newline at end of file
diff --git a/include/media/nbaio/MonoPipeReader.h b/include/media/nbaio/MonoPipeReader.h
new file mode 120000
index 0000000..30f426c
--- /dev/null
+++ b/include/media/nbaio/MonoPipeReader.h
@@ -0,0 +1 @@
+../../../media/libnbaio/include_mono/media/nbaio/MonoPipeReader.h
\ No newline at end of file
diff --git a/include/media/nbaio/NBAIO.h b/include/media/nbaio/NBAIO.h
new file mode 120000
index 0000000..ff6a151
--- /dev/null
+++ b/include/media/nbaio/NBAIO.h
@@ -0,0 +1 @@
+../../../media/libnbaio/include_mono/media/nbaio/NBAIO.h
\ No newline at end of file
diff --git a/include/media/nbaio/NBLog.h b/include/media/nbaio/NBLog.h
new file mode 120000
index 0000000..c35401e
--- /dev/null
+++ b/include/media/nbaio/NBLog.h
@@ -0,0 +1 @@
+../../../media/libnbaio/include/media/nbaio/NBLog.h
\ No newline at end of file
diff --git a/include/media/nbaio/PerformanceAnalysis.h b/include/media/nbaio/PerformanceAnalysis.h
new file mode 120000
index 0000000..7acfc90
--- /dev/null
+++ b/include/media/nbaio/PerformanceAnalysis.h
@@ -0,0 +1 @@
+../../../media/libnbaio/include/media/nbaio/PerformanceAnalysis.h
\ No newline at end of file
diff --git a/include/media/nbaio/Pipe.h b/include/media/nbaio/Pipe.h
new file mode 120000
index 0000000..a4bbbc9
--- /dev/null
+++ b/include/media/nbaio/Pipe.h
@@ -0,0 +1 @@
+../../../media/libnbaio/include/media/nbaio/Pipe.h
\ No newline at end of file
diff --git a/include/media/nbaio/PipeReader.h b/include/media/nbaio/PipeReader.h
new file mode 120000
index 0000000..64b21cf
--- /dev/null
+++ b/include/media/nbaio/PipeReader.h
@@ -0,0 +1 @@
+../../../media/libnbaio/include/media/nbaio/PipeReader.h
\ No newline at end of file
diff --git a/include/media/nbaio/SourceAudioBufferProvider.h b/include/media/nbaio/SourceAudioBufferProvider.h
new file mode 120000
index 0000000..74a3b06
--- /dev/null
+++ b/include/media/nbaio/SourceAudioBufferProvider.h
@@ -0,0 +1 @@
+../../../media/libnbaio/include/media/nbaio/SourceAudioBufferProvider.h
\ No newline at end of file
diff --git a/include/media/omx/1.0/WOmxBufferSource.h b/include/media/omx/1.0/WOmxBufferSource.h
deleted file mode 100644
index 86322da..0000000
--- a/include/media/omx/1.0/WOmxBufferSource.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2016, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_MEDIA_OMX_V1_0_WOMXBUFFERSOURCE_H
-#define ANDROID_HARDWARE_MEDIA_OMX_V1_0_WOMXBUFFERSOURCE_H
-
-#include <hidl/MQDescriptor.h>
-#include <hidl/Status.h>
-
-#include <binder/Binder.h>
-#include <OMXFenceParcelable.h>
-
-#include <android/hardware/media/omx/1.0/IOmxBufferSource.h>
-#include <android/BnOMXBufferSource.h>
-
-namespace android {
-namespace hardware {
-namespace media {
-namespace omx {
-namespace V1_0 {
-namespace utils {
-
-using ::android::hardware::media::omx::V1_0::IOmxBufferSource;
-using ::android::hidl::base::V1_0::IBase;
-using ::android::hardware::hidl_array;
-using ::android::hardware::hidl_memory;
-using ::android::hardware::hidl_string;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_handle;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::sp;
-
-using ::android::OMXFenceParcelable;
-using ::android::IOMXBufferSource;
-using ::android::BnOMXBufferSource;
-
-/**
- * Wrapper classes for conversion
- * ==============================
- *
- * Naming convention:
- * - LW = Legacy Wrapper --- It wraps a Treble object inside a legacy object.
- * - TW = Treble Wrapper --- It wraps a legacy object inside a Treble object.
- */
-
-struct LWOmxBufferSource : public BnOMXBufferSource {
- sp<IOmxBufferSource> mBase;
- LWOmxBufferSource(sp<IOmxBufferSource> const& base);
- ::android::binder::Status onOmxExecuting() override;
- ::android::binder::Status onOmxIdle() override;
- ::android::binder::Status onOmxLoaded() override;
- ::android::binder::Status onInputBufferAdded(int32_t bufferID) override;
- ::android::binder::Status onInputBufferEmptied(
- int32_t bufferID, OMXFenceParcelable const& fenceParcel) override;
-};
-
-struct TWOmxBufferSource : public IOmxBufferSource {
- sp<IOMXBufferSource> mBase;
- TWOmxBufferSource(sp<IOMXBufferSource> const& base);
- Return<void> onOmxExecuting() override;
- Return<void> onOmxIdle() override;
- Return<void> onOmxLoaded() override;
- Return<void> onInputBufferAdded(uint32_t buffer) override;
- Return<void> onInputBufferEmptied(
- uint32_t buffer, hidl_handle const& fence) override;
-};
-
-
-} // namespace utils
-} // namespace V1_0
-} // namespace omx
-} // namespace media
-} // namespace hardware
-} // namespace android
-
-#endif // ANDROID_HARDWARE_MEDIA_OMX_V1_0_WOMXBUFFERSOURCE_H
diff --git a/include/media/vndk/xmlparser/1.0/MediaCodecsXmlParser.h b/include/media/vndk/xmlparser/1.0/MediaCodecsXmlParser.h
deleted file mode 100644
index b324cd8..0000000
--- a/include/media/vndk/xmlparser/1.0/MediaCodecsXmlParser.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright 2017, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef MEDIA_CODECS_XML_PARSER_H_
-
-#define MEDIA_CODECS_XML_PARSER_H_
-
-#include <map>
-#include <vector>
-
-#include <media/stagefright/foundation/ABase.h>
-#include <media/stagefright/foundation/AString.h>
-
-#include <sys/types.h>
-#include <utils/Errors.h>
-#include <utils/Vector.h>
-#include <utils/StrongPointer.h>
-
-namespace android {
-
-struct AMessage;
-
-// Quirk still supported, even though deprecated
-enum Quirks {
- kRequiresAllocateBufferOnInputPorts = 1,
- kRequiresAllocateBufferOnOutputPorts = 2,
-
- kQuirksMask = kRequiresAllocateBufferOnInputPorts
- | kRequiresAllocateBufferOnOutputPorts,
-};
-
-// Lightweight struct for querying components.
-struct TypeInfo {
- AString mName;
- std::map<AString, AString> mStringFeatures;
- std::map<AString, bool> mBoolFeatures;
- std::map<AString, AString> mDetails;
-};
-
-struct ProfileLevel {
- uint32_t mProfile;
- uint32_t mLevel;
-};
-
-struct CodecInfo {
- std::vector<TypeInfo> mTypes;
- std::vector<ProfileLevel> mProfileLevels;
- std::vector<uint32_t> mColorFormats;
- uint32_t mFlags;
- bool mIsEncoder;
-};
-
-class MediaCodecsXmlParser {
-public:
- MediaCodecsXmlParser();
- ~MediaCodecsXmlParser();
-
- void getGlobalSettings(std::map<AString, AString> *settings) const;
-
- status_t getCodecInfo(const char *name, CodecInfo *info) const;
-
- status_t getQuirks(const char *name, std::vector<AString> *quirks) const;
-
-private:
- enum Section {
- SECTION_TOPLEVEL,
- SECTION_SETTINGS,
- SECTION_DECODERS,
- SECTION_DECODER,
- SECTION_DECODER_TYPE,
- SECTION_ENCODERS,
- SECTION_ENCODER,
- SECTION_ENCODER_TYPE,
- SECTION_INCLUDE,
- };
-
- status_t mInitCheck;
- Section mCurrentSection;
- bool mUpdate;
- Vector<Section> mPastSections;
- int32_t mDepth;
- AString mHrefBase;
-
- std::map<AString, AString> mGlobalSettings;
-
- // name -> CodecInfo
- std::map<AString, CodecInfo> mCodecInfos;
- std::map<AString, std::vector<AString>> mQuirks;
- AString mCurrentName;
- std::vector<TypeInfo>::iterator mCurrentType;
-
- status_t initCheck() const;
- void parseTopLevelXMLFile(const char *path, bool ignore_errors = false);
-
- void parseXMLFile(const char *path);
-
- static void StartElementHandlerWrapper(
- void *me, const char *name, const char **attrs);
-
- static void EndElementHandlerWrapper(void *me, const char *name);
-
- void startElementHandler(const char *name, const char **attrs);
- void endElementHandler(const char *name);
-
- status_t includeXMLFile(const char **attrs);
- status_t addSettingFromAttributes(const char **attrs);
- status_t addMediaCodecFromAttributes(bool encoder, const char **attrs);
- void addMediaCodec(bool encoder, const char *name, const char *type = NULL);
-
- status_t addQuirk(const char **attrs);
- status_t addTypeFromAttributes(const char **attrs, bool encoder);
- status_t addLimit(const char **attrs);
- status_t addFeature(const char **attrs);
- void addType(const char *name);
-
- DISALLOW_EVIL_CONSTRUCTORS(MediaCodecsXmlParser);
-};
-
-} // namespace android
-
-#endif // MEDIA_CODECS_XML_PARSER_H_
-
diff --git a/include/private/media/AudioTrackShared.h b/include/private/media/AudioTrackShared.h
index 9da5ef3..ff440bc 100644
--- a/include/private/media/AudioTrackShared.h
+++ b/include/private/media/AudioTrackShared.h
@@ -568,6 +568,9 @@
// which may include non-contiguous frames
virtual size_t framesReady();
+ // Safe frames ready query used by dump() - this has no side effects.
+ virtual size_t framesReadySafe() const;
+
// Currently AudioFlinger will call framesReady() for a fast track from two threads:
// FastMixer thread, and normal mixer thread. This is dangerous, as the proxy is intended
// to be called from at most one thread of server, and one thread of client.
@@ -620,6 +623,7 @@
public:
virtual size_t framesReady();
+ virtual size_t framesReadySafe() const override;
virtual void framesReadyIsCalledByMultipleThreads();
virtual status_t obtainBuffer(Buffer* buffer, bool ackFlush);
virtual void releaseBuffer(Buffer* buffer);
diff --git a/include/private/media/VideoFrame.h b/include/private/media/VideoFrame.h
index 51050cd..a9d4dd1 100644
--- a/include/private/media/VideoFrame.h
+++ b/include/private/media/VideoFrame.h
@@ -30,14 +30,41 @@
class VideoFrame
{
public:
- VideoFrame(): mWidth(0), mHeight(0), mDisplayWidth(0), mDisplayHeight(0), mSize(0),
- mRotationAngle(0), mData(0) {}
+ // Construct a VideoFrame object with the specified parameters,
+ // will allocate frame buffer if |allocate| is set to true, will
+ // allocate buffer to hold ICC data if |iccData| and |iccSize|
+ // indicate its presence.
+ VideoFrame(uint32_t width, uint32_t height,
+ uint32_t displayWidth, uint32_t displayHeight,
+ uint32_t angle, uint32_t bpp, bool allocate,
+ const void *iccData, size_t iccSize):
+ mWidth(width), mHeight(height),
+ mDisplayWidth(displayWidth), mDisplayHeight(displayHeight),
+ mRotationAngle(angle), mBytesPerPixel(bpp), mRowBytes(bpp * width),
+ mSize(0), mIccSize(0), mReserved(0), mData(0), mIccData(0) {
+ if (allocate) {
+ mSize = mRowBytes * mHeight;
+ mData = new uint8_t[mSize];
+ if (mData == NULL) {
+ mSize = 0;
+ }
+ }
+ if (iccData != NULL && iccSize > 0) {
+ mIccSize = iccSize;
+ mIccData = new uint8_t[iccSize];
+ if (mIccData != NULL) {
+ memcpy(mIccData, iccData, iccSize);
+ } else {
+ mIccSize = 0;
+ }
+ }
+ }
+
+ // Deep copy of both the information fields and the frame data
VideoFrame(const VideoFrame& copy) {
- mWidth = copy.mWidth;
- mHeight = copy.mHeight;
- mDisplayWidth = copy.mDisplayWidth;
- mDisplayHeight = copy.mDisplayHeight;
+ copyInfoOnly(copy);
+
mSize = copy.mSize;
mData = NULL; // initialize it first
if (mSize > 0 && copy.mData != NULL) {
@@ -48,26 +75,99 @@
mSize = 0;
}
}
- mRotationAngle = copy.mRotationAngle;
+
+ mIccSize = copy.mIccSize;
+ mIccData = NULL; // initialize it first
+ if (mIccSize > 0 && copy.mIccData != NULL) {
+ mIccData = new uint8_t[mIccSize];
+ if (mIccData != NULL) {
+ memcpy(mIccData, copy.mIccData, mIccSize);
+ } else {
+ mIccSize = 0;
+ }
+ }
}
~VideoFrame() {
if (mData != 0) {
delete[] mData;
}
+ if (mIccData != 0) {
+ delete[] mIccData;
+ }
+ }
+
+ // Copy |copy| to a flattened VideoFrame in IMemory, 'this' must point to
+ // a chunk of memory back by IMemory of size at least getFlattenedSize()
+ // of |copy|.
+ void copyFlattened(const VideoFrame& copy) {
+ copyInfoOnly(copy);
+
+ mSize = copy.mSize;
+ mData = NULL; // initialize it first
+ if (copy.mSize > 0 && copy.mData != NULL) {
+ memcpy(getFlattenedData(), copy.mData, copy.mSize);
+ }
+
+ mIccSize = copy.mIccSize;
+ mIccData = NULL; // initialize it first
+ if (copy.mIccSize > 0 && copy.mIccData != NULL) {
+ memcpy(getFlattenedIccData(), copy.mIccData, copy.mIccSize);
+ }
+ }
+
+ // Calculate the flattened size to put it in IMemory
+ size_t getFlattenedSize() const {
+ return sizeof(VideoFrame) + mSize + mIccSize;
+ }
+
+ // Get the pointer to the frame data in a flattened VideoFrame in IMemory
+ uint8_t* getFlattenedData() const {
+ return (uint8_t*)this + sizeof(VideoFrame);
+ }
+
+ // Get the pointer to the ICC data in a flattened VideoFrame in IMemory
+ uint8_t* getFlattenedIccData() const {
+ return (uint8_t*)this + sizeof(VideoFrame) + mSize;
}
// Intentional public access modifier:
- uint32_t mWidth;
- uint32_t mHeight;
- uint32_t mDisplayWidth;
- uint32_t mDisplayHeight;
+ uint32_t mWidth; // Decoded image width before rotation
+ uint32_t mHeight; // Decoded image height before rotation
+ uint32_t mDisplayWidth; // Display width before rotation
+ uint32_t mDisplayHeight; // Display height before rotation
+ int32_t mRotationAngle; // Rotation angle, clockwise, should be multiple of 90
+ uint32_t mBytesPerPixel; // Number of bytes per pixel
+ uint32_t mRowBytes; // Number of bytes per row before rotation
uint32_t mSize; // Number of bytes in mData
- int32_t mRotationAngle; // rotation angle, clockwise, should be multiple of 90
- // mData should be 64 bit aligned to prevent additional padding
+ uint32_t mIccSize; // Number of bytes in mIccData
+ uint32_t mReserved; // (padding to make mData 64-bit aligned)
+
+ // mData should be 64-bit aligned to prevent additional padding
uint8_t* mData; // Actual binary data
- // pad structure so it's the same size on 64 bit and 32 bit
+ // pad structure so it's the same size on 64-bit and 32-bit
char mPadding[8 - sizeof(mData)];
+
+ // mIccData should be 64-bit aligned to prevent additional padding
+ uint8_t* mIccData; // Actual binary data
+ // pad structure so it's the same size on 64-bit and 32-bit
+ char mIccPadding[8 - sizeof(mIccData)];
+
+private:
+ //
+ // Utility methods used only within VideoFrame struct
+ //
+
+ // Copy the information fields only
+ void copyInfoOnly(const VideoFrame& copy) {
+ mWidth = copy.mWidth;
+ mHeight = copy.mHeight;
+ mDisplayWidth = copy.mDisplayWidth;
+ mDisplayHeight = copy.mDisplayHeight;
+ mRotationAngle = copy.mRotationAngle;
+ mBytesPerPixel = copy.mBytesPerPixel;
+ mRowBytes = copy.mRowBytes;
+ }
};
}; // namespace android
diff --git a/include/radio/IRadio.h b/include/radio/IRadio.h
deleted file mode 100644
index 1877f8f..0000000
--- a/include/radio/IRadio.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_IRADIO_H
-#define ANDROID_HARDWARE_IRADIO_H
-
-#include <utils/RefBase.h>
-#include <binder/IInterface.h>
-#include <binder/IMemory.h>
-#include <binder/Parcel.h>
-#include <system/radio.h>
-
-namespace android {
-
-class IRadio : public IInterface
-{
-public:
-
- DECLARE_META_INTERFACE(Radio);
-
- virtual void detach() = 0;
-
- virtual status_t setConfiguration(const struct radio_band_config *config) = 0;
-
- virtual status_t getConfiguration(struct radio_band_config *config) = 0;
-
- virtual status_t setMute(bool mute) = 0;
-
- virtual status_t getMute(bool *mute) = 0;
-
- virtual status_t step(radio_direction_t direction, bool skipSubChannel) = 0;
-
- virtual status_t scan(radio_direction_t direction, bool skipSubChannel) = 0;
-
- virtual status_t tune(unsigned int channel, unsigned int subChannel) = 0;
-
- virtual status_t cancel() = 0;
-
- virtual status_t getProgramInformation(struct radio_program_info *info) = 0;
-
- virtual status_t hasControl(bool *hasControl) = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnRadio: public BnInterface<IRadio>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-}; // namespace android
-
-#endif //ANDROID_HARDWARE_IRADIO_H
diff --git a/include/radio/IRadioClient.h b/include/radio/IRadioClient.h
deleted file mode 100644
index 9062ad6..0000000
--- a/include/radio/IRadioClient.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_IRADIO_CLIENT_H
-#define ANDROID_HARDWARE_IRADIO_CLIENT_H
-
-#include <utils/RefBase.h>
-#include <binder/IInterface.h>
-#include <binder/IMemory.h>
-#include <binder/Parcel.h>
-
-namespace android {
-
-class IRadioClient : public IInterface
-{
-public:
-
- DECLARE_META_INTERFACE(RadioClient);
-
- virtual void onEvent(const sp<IMemory>& eventMemory) = 0;
-
-};
-
-// ----------------------------------------------------------------------------
-
-class BnRadioClient : public BnInterface<IRadioClient>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-}; // namespace android
-
-#endif //ANDROID_HARDWARE_IRADIO_CLIENT_H
diff --git a/include/radio/IRadioService.h b/include/radio/IRadioService.h
deleted file mode 100644
index a946dd5..0000000
--- a/include/radio/IRadioService.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_IRADIO_SERVICE_H
-#define ANDROID_HARDWARE_IRADIO_SERVICE_H
-
-#include <utils/RefBase.h>
-#include <binder/IInterface.h>
-#include <binder/Parcel.h>
-#include <system/radio.h>
-
-namespace android {
-
-class IRadio;
-class IRadioClient;
-
-class IRadioService : public IInterface
-{
-public:
-
- DECLARE_META_INTERFACE(RadioService);
-
- virtual status_t listModules(struct radio_properties *properties,
- uint32_t *numModules) = 0;
-
- virtual status_t attach(const radio_handle_t handle,
- const sp<IRadioClient>& client,
- const struct radio_band_config *config,
- bool withAudio,
- sp<IRadio>& radio) = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnRadioService: public BnInterface<IRadioService>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-}; // namespace android
-
-#endif //ANDROID_HARDWARE_IRADIO_SERVICE_H
diff --git a/include/radio/Radio.h b/include/radio/Radio.h
deleted file mode 100644
index fb4dd2f..0000000
--- a/include/radio/Radio.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_RADIO_H
-#define ANDROID_HARDWARE_RADIO_H
-
-#include <binder/IBinder.h>
-#include <utils/threads.h>
-#include <radio/RadioCallback.h>
-#include <radio/IRadio.h>
-#include <radio/IRadioService.h>
-#include <radio/IRadioClient.h>
-#include <system/radio.h>
-
-namespace android {
-
-class MemoryDealer;
-
-class Radio : public BnRadioClient,
- public IBinder::DeathRecipient
-{
-public:
-
- virtual ~Radio();
-
- static status_t listModules(struct radio_properties *properties,
- uint32_t *numModules);
- static sp<Radio> attach(radio_handle_t handle,
- const struct radio_band_config *config,
- bool withAudio,
- const sp<RadioCallback>& callback);
-
-
- void detach();
-
- status_t setConfiguration(const struct radio_band_config *config);
-
- status_t getConfiguration(struct radio_band_config *config);
-
- status_t setMute(bool mute);
-
- status_t getMute(bool *mute);
-
- status_t step(radio_direction_t direction, bool skipSubChannel);
-
- status_t scan(radio_direction_t direction, bool skipSubChannel);
-
- status_t tune(unsigned int channel, unsigned int subChannel);
-
- status_t cancel();
-
- status_t getProgramInformation(struct radio_program_info *info);
-
- status_t hasControl(bool *hasControl);
-
- // BpRadioClient
- virtual void onEvent(const sp<IMemory>& eventMemory);
-
- //IBinder::DeathRecipient
- virtual void binderDied(const wp<IBinder>& who);
-
-private:
- Radio(radio_handle_t handle,
- const sp<RadioCallback>&);
- static const sp<IRadioService> getRadioService();
-
- Mutex mLock;
- sp<IRadio> mIRadio;
- sp<RadioCallback> mCallback;
-};
-
-}; // namespace android
-
-#endif //ANDROID_HARDWARE_RADIO_H
diff --git a/include/radio/RadioCallback.h b/include/radio/RadioCallback.h
deleted file mode 100644
index 4a7f1a6..0000000
--- a/include/radio/RadioCallback.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_RADIO_CALLBACK_H
-#define ANDROID_HARDWARE_RADIO_CALLBACK_H
-
-#include <utils/RefBase.h>
-#include <system/radio.h>
-
-namespace android {
-
-class RadioCallback : public RefBase
-{
-public:
-
- RadioCallback() {}
- virtual ~RadioCallback() {}
-
- virtual void onEvent(struct radio_event *event) = 0;
-
-};
-
-}; // namespace android
-
-#endif //ANDROID_HARDWARE_RADIO_CALLBACK_H
diff --git a/media/audioserver/Android.mk b/media/audioserver/Android.mk
index afd1189..3ee7494 100644
--- a/media/audioserver/Android.mk
+++ b/media/audioserver/Android.mk
@@ -14,7 +14,6 @@
liblog \
libmedialogservice \
libnbaio \
- libradioservice \
libsoundtriggerservice \
libutils \
libhwbinder
diff --git a/media/audioserver/main_audioserver.cpp b/media/audioserver/main_audioserver.cpp
index ee02d23..474ef97 100644
--- a/media/audioserver/main_audioserver.cpp
+++ b/media/audioserver/main_audioserver.cpp
@@ -32,11 +32,12 @@
#include <hwbinder/ProcessState.h>
// from LOCAL_C_INCLUDES
+#include "aaudio/AAudioTesting.h"
#include "AudioFlinger.h"
#include "AudioPolicyService.h"
#include "AAudioService.h"
+#include "utility/AAudioUtilities.h"
#include "MediaLogService.h"
-#include "RadioService.h"
#include "SoundTriggerHwService.h"
using namespace android;
@@ -132,8 +133,16 @@
ALOGI("ServiceManager: %p", sm.get());
AudioFlinger::instantiate();
AudioPolicyService::instantiate();
- AAudioService::instantiate();
- RadioService::instantiate();
+
+ // AAudioService should only be used in OC-MR1 and later.
+ // And only enable the AAudioService if the system MMAP policy explicitly allows it.
+ // This prevents a client from misusing AAudioService when it is not supported.
+ aaudio_policy_t mmapPolicy = property_get_int32(AAUDIO_PROP_MMAP_POLICY,
+ AAUDIO_POLICY_NEVER);
+ if (mmapPolicy == AAUDIO_POLICY_AUTO || mmapPolicy == AAUDIO_POLICY_ALWAYS) {
+ AAudioService::instantiate();
+ }
+
SoundTriggerHwService::instantiate();
ProcessState::self()->startThreadPool();
diff --git a/media/libaaudio/Doxyfile b/media/libaaudio/Doxyfile
index e2c4960..7298d11 100644
--- a/media/libaaudio/Doxyfile
+++ b/media/libaaudio/Doxyfile
@@ -744,12 +744,12 @@
# Note: If this tag is empty the current directory is searched.
INPUT = include/aaudio/AAudio.h \
+ src/binding/AAudioCommon.h \
src/legacy/AudioStreamTrack.h \
src/legacy/AudioStreamRecord.h \
src/legacy/AAudioLegacy.h \
src/core/AudioStreamBuilder.h \
src/core/AudioStream.h \
- src/utility/HandleTracker.h \
src/utility/MonotonicCounter.h \
src/utility/AudioClock.h \
src/utility/AAudioUtilities.h
diff --git a/media/libaaudio/OWNERS b/media/libaaudio/OWNERS
new file mode 100644
index 0000000..f4d51f9
--- /dev/null
+++ b/media/libaaudio/OWNERS
@@ -0,0 +1 @@
+philburk@google.com
diff --git a/media/libaaudio/examples/input_monitor/src/input_monitor.cpp b/media/libaaudio/examples/input_monitor/src/input_monitor.cpp
index d1ae160..e5ad2d9 100644
--- a/media/libaaudio/examples/input_monitor/src/input_monitor.cpp
+++ b/media/libaaudio/examples/input_monitor/src/input_monitor.cpp
@@ -27,9 +27,11 @@
#include "AAudioSimpleRecorder.h"
// TODO support FLOAT
-#define REQUIRED_FORMAT AAUDIO_FORMAT_PCM_I16
+#define REQUIRED_FORMAT AAUDIO_FORMAT_PCM_I16
#define MIN_FRAMES_TO_READ 48 /* arbitrary, 1 msec at 48000 Hz */
+static const int FRAMES_PER_LINE = 20000;
+
int main(int argc, const char **argv)
{
AAudioArgsParser argParser;
@@ -45,17 +47,19 @@
int32_t framesPerRead = 0;
int32_t framesToRecord = 0;
int32_t framesLeft = 0;
+ int32_t nextFrameCount = 0;
+ int32_t frameCount = 0;
int32_t xRunCount = 0;
+ int64_t previousFramePosition = -1;
int16_t *data = nullptr;
float peakLevel = 0.0;
- int loopCounter = 0;
int32_t deviceId;
// Make printf print immediately so that debug info is not stuck
// in a buffer if we hang or crash.
setvbuf(stdout, nullptr, _IONBF, (size_t) 0);
- printf("%s - Monitor input level using AAudio\n", argv[0]);
+ printf("%s - Monitor input level using AAudio read, V0.1.2\n", argv[0]);
argParser.setFormat(REQUIRED_FORMAT);
if (argParser.parseArgs(argc, argv)) {
@@ -73,7 +77,7 @@
deviceId = AAudioStream_getDeviceId(aaudioStream);
printf("deviceId = %d\n", deviceId);
- actualSamplesPerFrame = AAudioStream_getSamplesPerFrame(aaudioStream);
+ actualSamplesPerFrame = AAudioStream_getChannelCount(aaudioStream);
printf("SamplesPerFrame = %d\n", actualSamplesPerFrame);
actualSampleRate = AAudioStream_getSampleRate(aaudioStream);
printf("SamplesPerFrame = %d\n", actualSampleRate);
@@ -132,6 +136,7 @@
goto finish;
}
framesLeft -= actual;
+ frameCount += actual;
// Peak finder.
for (int frameIndex = 0; frameIndex < actual; frameIndex++) {
@@ -142,9 +147,36 @@
}
// Display level as stars, eg. "******".
- if ((loopCounter++ % 10) == 0) {
+ if (frameCount > nextFrameCount) {
displayPeakLevel(peakLevel);
peakLevel = 0.0;
+ nextFrameCount += FRAMES_PER_LINE;
+ }
+
+ // Print timestamps.
+ int64_t framePosition = 0;
+ int64_t frameTime = 0;
+ aaudio_result_t timeResult;
+ timeResult = AAudioStream_getTimestamp(aaudioStream, CLOCK_MONOTONIC,
+ &framePosition, &frameTime);
+
+ if (timeResult == AAUDIO_OK) {
+ if (framePosition > (previousFramePosition + FRAMES_PER_LINE)) {
+ int64_t realTime = getNanoseconds();
+ int64_t framesRead = AAudioStream_getFramesRead(aaudioStream);
+
+ double latencyMillis = calculateLatencyMillis(framesRead, realTime,
+ framePosition, frameTime,
+ actualSampleRate);
+
+ printf("--- timestamp: result = %4d, position = %lld, at %lld nanos"
+ ", latency = %7.2f msec\n",
+ timeResult,
+ (long long) framePosition,
+ (long long) frameTime,
+ latencyMillis);
+ previousFramePosition = framePosition;
+ }
}
}
diff --git a/media/libaaudio/examples/input_monitor/src/input_monitor_callback.cpp b/media/libaaudio/examples/input_monitor/src/input_monitor_callback.cpp
index 9de2eb0..893795b 100644
--- a/media/libaaudio/examples/input_monitor/src/input_monitor_callback.cpp
+++ b/media/libaaudio/examples/input_monitor/src/input_monitor_callback.cpp
@@ -41,7 +41,7 @@
// Make printf print immediately so that debug info is not stuck
// in a buffer if we hang or crash.
setvbuf(stdout, nullptr, _IONBF, (size_t) 0);
- printf("%s - Display audio input using an AAudio callback\n", argv[0]);
+ printf("%s - Display audio input using an AAudio callback, V0.1.2\n", argv[0]);
result = recorder.open(2, 48000, AAUDIO_FORMAT_PCM_I16,
SimpleRecorderDataCallbackProc, SimpleRecorderErrorCallbackProc, &myData);
diff --git a/media/libaaudio/examples/loopback/src/loopback.cpp b/media/libaaudio/examples/loopback/src/loopback.cpp
index d3b6ff7..b678d8a 100644
--- a/media/libaaudio/examples/loopback/src/loopback.cpp
+++ b/media/libaaudio/examples/loopback/src/loopback.cpp
@@ -413,11 +413,18 @@
sleep(1);
printf("%4d: ", i);
loopbackData.loopbackProcessor->printStatus();
- int64_t framesWritten = AAudioStream_getFramesWritten(loopbackData.inputStream);
- int64_t framesRead = AAudioStream_getFramesRead(loopbackData.inputStream);
- printf(" input written = %lld, read %lld, xruns = %d\n",
- (long long) framesWritten,
- (long long) framesRead,
+
+ int64_t inputFramesWritten = AAudioStream_getFramesWritten(loopbackData.inputStream);
+ int64_t inputFramesRead = AAudioStream_getFramesRead(loopbackData.inputStream);
+ int64_t outputFramesWritten = AAudioStream_getFramesWritten(outputStream);
+ int64_t outputFramesRead = AAudioStream_getFramesRead(outputStream);
+ printf(" INPUT: wr %lld rd %lld state %s, OUTPUT: wr %lld rd %lld state %s, xruns %d\n",
+ (long long) inputFramesWritten,
+ (long long) inputFramesRead,
+ AAudio_convertStreamStateToText(AAudioStream_getState(loopbackData.inputStream)),
+ (long long) outputFramesWritten,
+ (long long) outputFramesRead,
+ AAudio_convertStreamStateToText(AAudioStream_getState(outputStream)),
AAudioStream_getXRunCount(outputStream)
);
}
diff --git a/media/libaaudio/examples/utils/AAudioArgsParser.h b/media/libaaudio/examples/utils/AAudioArgsParser.h
index 46bc99e..ada37e2 100644
--- a/media/libaaudio/examples/utils/AAudioArgsParser.h
+++ b/media/libaaudio/examples/utils/AAudioArgsParser.h
@@ -24,7 +24,8 @@
#include <aaudio/AAudio.h>
#include <aaudio/AAudioTesting.h>
-#include <AAudioExampleUtils.h>
+
+#include "AAudioExampleUtils.h"
// TODO use this as a base class within AAudio
class AAudioParameters {
@@ -149,6 +150,9 @@
setChannelCount(atoi(&arg[2]));
break;
case 'd':
+ setDeviceId(atoi(&arg[2]));
+ break;
+ case 's':
mDurationSeconds = atoi(&arg[2]);
break;
case 'm': {
@@ -201,7 +205,8 @@
printf(" Default values are UNSPECIFIED unless otherwise stated.\n");
printf(" -b{bufferCapacity} frames\n");
printf(" -c{channels} for example 2 for stereo\n");
- printf(" -d{duration} in seconds, default is %d\n", DEFAULT_DURATION_SECONDS);
+ printf(" -d{deviceId} default is %d\n", AAUDIO_UNSPECIFIED);
+ printf(" -s{duration} in seconds, default is %d\n", DEFAULT_DURATION_SECONDS);
printf(" -m{0|1|2|3} set MMAP policy\n");
printf(" 0 = _UNSPECIFIED, default\n");
printf(" 1 = _NEVER\n");
@@ -239,7 +244,7 @@
* Print stream parameters in comparison with requested values.
* @param stream
*/
- void compareWithStream(AAudioStream *stream) {
+ void compareWithStream(AAudioStream *stream) const {
printf(" DeviceId: requested = %d, actual = %d\n",
getDeviceId(), AAudioStream_getDeviceId(stream));
diff --git a/media/libaaudio/examples/utils/AAudioExampleUtils.h b/media/libaaudio/examples/utils/AAudioExampleUtils.h
index 156c7be..2671c3a 100644
--- a/media/libaaudio/examples/utils/AAudioExampleUtils.h
+++ b/media/libaaudio/examples/utils/AAudioExampleUtils.h
@@ -17,31 +17,74 @@
#ifndef AAUDIO_EXAMPLE_UTILS_H
#define AAUDIO_EXAMPLE_UTILS_H
+#include <atomic>
#include <errno.h>
+#include <linux/futex.h>
#include <sched.h>
#include <string.h>
+#include <sys/syscall.h>
#include <unistd.h>
#include <aaudio/AAudio.h>
+#include <utils/Errors.h>
#define NANOS_PER_MICROSECOND ((int64_t)1000)
#define NANOS_PER_MILLISECOND (NANOS_PER_MICROSECOND * 1000)
#define NANOS_PER_SECOND (NANOS_PER_MILLISECOND * 1000)
-template <class T = aaudio_sharing_mode_t>
const char *getSharingModeText(aaudio_sharing_mode_t mode) {
- const char *modeText = "unknown";
+ const char *text = "unknown";
switch (mode) {
- case AAUDIO_SHARING_MODE_EXCLUSIVE:
- modeText = "EXCLUSIVE";
- break;
- case AAUDIO_SHARING_MODE_SHARED:
- modeText = "SHARED";
- break;
- default:
- break;
+ case AAUDIO_SHARING_MODE_EXCLUSIVE:
+ text = "EXCLUSIVE";
+ break;
+ case AAUDIO_SHARING_MODE_SHARED:
+ text = "SHARED";
+ break;
+ default:
+ break;
}
- return modeText;
+ return text;
+}
+
+const char *getPerformanceModeText(aaudio_performance_mode_t mode) {
+ const char *text = "unknown";
+ switch (mode) {
+ case AAUDIO_PERFORMANCE_MODE_NONE:
+ text = "NONE";
+ break;
+ case AAUDIO_PERFORMANCE_MODE_LOW_LATENCY:
+ text = "LOW_LATENCY";
+ break;
+ case AAUDIO_PERFORMANCE_MODE_POWER_SAVING:
+ text = "POWER_SAVING";
+ break;
+ default:
+ break;
+ }
+ return text;
+}
+
+const char *getDirectionText(aaudio_direction_t direction) {
+ const char *text = "unknown";
+ switch (direction) {
+ case AAUDIO_DIRECTION_INPUT:
+ text = "INPUT";
+ break;
+ case AAUDIO_DIRECTION_OUTPUT:
+ text = "OUTPUT";
+ break;
+ default:
+ break;
+ }
+ return text;
+}
+
+template <class T = int64_t>
+void convertNanosecondsToTimespec(int64_t nanoseconds, struct timespec *time) {
+ time->tv_sec = nanoseconds / NANOS_PER_SECOND;
+ // Calculate the fractional nanoseconds. Avoids expensive % operation.
+ time->tv_nsec = nanoseconds - (time->tv_sec * NANOS_PER_SECOND);
}
template <class T = clockid_t>
@@ -54,6 +97,7 @@
return (time.tv_sec * NANOS_PER_SECOND) + time.tv_nsec;
}
+template <class T = float>
void displayPeakLevel(float peakLevel) {
printf("%5.3f ", peakLevel);
const int maxStars = 50; // arbitrary, fits on one line
@@ -64,4 +108,101 @@
printf("\n");
}
+/**
+ * @param position1 position of hardware frame
+ * @param nanoseconds1
+ * @param position2 position of client read/write
+ * @param nanoseconds2
+ * @param sampleRate
+ * @return latency in milliseconds
+ */
+template <class T = int64_t>
+double calculateLatencyMillis(int64_t position1, int64_t nanoseconds1,
+ int64_t position2, int64_t nanoseconds2,
+ int64_t sampleRate) {
+ int64_t deltaFrames = position2 - position1;
+ int64_t deltaTime =
+ (NANOS_PER_SECOND * deltaFrames / sampleRate);
+ int64_t timeCurrentFramePlayed = nanoseconds1 + deltaTime;
+ int64_t latencyNanos = timeCurrentFramePlayed - nanoseconds2;
+ double latencyMillis = latencyNanos / 1000000.0;
+ return latencyMillis;
+}
+
+// ================================================================================
+// These Futex calls are common online examples.
+template <class T = int>
+android::status_t sys_futex(void *addr1, int op, int val1,
+ struct timespec *timeout, void *addr2, int val3) {
+ android::status_t result = (android::status_t) syscall(SYS_futex, addr1,
+ op, val1, timeout,
+ addr2, val3);
+ return (result == 0) ? 0 : -errno;
+}
+
+template <class T = int>
+android::status_t futex_wake(void *addr, int numWake) {
+ // Use _PRIVATE because we are just using the futex in one process.
+ return sys_futex(addr, FUTEX_WAKE_PRIVATE, numWake, NULL, NULL, 0);
+}
+
+template <class T = int>
+android::status_t futex_wait(void *addr, int current, struct timespec *time) {
+ // Use _PRIVATE because we are just using the futex in one process.
+ return sys_futex(addr, FUTEX_WAIT_PRIVATE, current, time, NULL, 0);
+}
+
+// TODO better name?
+/**
+ * The WakeUp class is used to send a wakeup signal to one or more sleeping threads.
+ */
+class WakeUp {
+public:
+ WakeUp() : mValue(0) {}
+ explicit WakeUp(int32_t value) : mValue(value) {}
+
+ /**
+ * Wait until the internal value no longer matches the given value.
+ * Note that this code uses a futex, which is subject to spurious wake-ups.
+ * So check to make sure that the desired condition has been met.
+ *
+ * @return zero if the value changes or various negative errors including
+ * -ETIMEDOUT if a timeout occurs,
+ * or -EINTR if interrupted by a signal,
+ * or -EAGAIN or -EWOULDBLOCK if the internal value does not match the specified value
+ */
+ android::status_t wait(int32_t value, int64_t timeoutNanoseconds) {
+ struct timespec time;
+ convertNanosecondsToTimespec(timeoutNanoseconds, &time);
+ return futex_wait(&mValue, value, &time);
+ }
+
+ /**
+ * Increment value and wake up any threads that need to be woken.
+ *
+ * @return number of waiters woken up
+ */
+ android::status_t wake() {
+ ++mValue;
+ return futex_wake(&mValue, INT_MAX);
+ }
+
+ /**
+ * Set value and wake up any threads that need to be woken.
+ *
+ * @return number of waiters woken up
+ */
+ android::status_t wake(int32_t value) {
+ mValue.store(value);
+ return futex_wake(&mValue, INT_MAX);
+ }
+
+ int32_t get() {
+ return mValue.load();
+ }
+
+private:
+ std::atomic<int32_t> mValue;
+};
+
#endif // AAUDIO_EXAMPLE_UTILS_H
diff --git a/media/libaaudio/examples/utils/AAudioSimplePlayer.h b/media/libaaudio/examples/utils/AAudioSimplePlayer.h
index cc0cb34..606c4ba 100644
--- a/media/libaaudio/examples/utils/AAudioSimplePlayer.h
+++ b/media/libaaudio/examples/utils/AAudioSimplePlayer.h
@@ -23,6 +23,7 @@
#include <sched.h>
#include <aaudio/AAudio.h>
+#include <atomic>
#include "AAudioArgsParser.h"
#include "SineGenerator.h"
@@ -35,6 +36,13 @@
// How long to sleep in a callback to cause an intentional glitch. For testing.
#define FORCED_UNDERRUN_SLEEP_MICROS (10 * 1000)
+#define MAX_TIMESTAMPS 16
+
+typedef struct Timestamp {
+ int64_t position;
+ int64_t nanoseconds;
+} Timestamp;
+
/**
* Simple wrapper for AAudio that opens an output stream either in callback or blocking write mode.
*/
@@ -219,18 +227,28 @@
AAudioStream *mStream = nullptr;
aaudio_sharing_mode_t mRequestedSharingMode = SHARING_MODE;
aaudio_performance_mode_t mRequestedPerformanceMode = PERFORMANCE_MODE;
+
};
typedef struct SineThreadedData_s {
+
SineGenerator sineOsc1;
SineGenerator sineOsc2;
+ Timestamp timestamps[MAX_TIMESTAMPS];
int64_t framesTotal = 0;
int64_t nextFrameToGlitch = FORCED_UNDERRUN_PERIOD_FRAMES;
int32_t minNumFrames = INT32_MAX;
int32_t maxNumFrames = 0;
- int scheduler;
+ int32_t timestampCount = 0; // in timestamps
+
+ int scheduler = 0;
bool schedulerChecked = false;
bool forceUnderruns = false;
+
+ AAudioSimplePlayer simplePlayer;
+ int32_t callbackCount = 0;
+ WakeUp waker{AAUDIO_OK};
+
} SineThreadedData_t;
// Callback function that fills the audio output buffer.
@@ -247,6 +265,7 @@
return AAUDIO_CALLBACK_RESULT_STOP;
}
SineThreadedData_t *sineData = (SineThreadedData_t *) userData;
+ sineData->callbackCount++;
sineData->framesTotal += numFrames;
@@ -263,6 +282,17 @@
sineData->schedulerChecked = true;
}
+ if (sineData->timestampCount < MAX_TIMESTAMPS) {
+ Timestamp *timestamp = &sineData->timestamps[sineData->timestampCount];
+ aaudio_result_t result = AAudioStream_getTimestamp(stream,
+ CLOCK_MONOTONIC, ×tamp->position, ×tamp->nanoseconds);
+ if (result == AAUDIO_OK && // valid?
+ (sineData->timestampCount == 0 || // first one?
+ (timestamp->position != (timestamp - 1)->position))) { // advanced position?
+ sineData->timestampCount++; // keep this one
+ }
+ }
+
if (numFrames > sineData->maxNumFrames) {
sineData->maxNumFrames = numFrames;
}
@@ -304,9 +334,16 @@
void SimplePlayerErrorCallbackProc(
AAudioStream *stream __unused,
void *userData __unused,
- aaudio_result_t error)
-{
- printf("Error Callback, error: %d\n",(int)error);
+ aaudio_result_t error) {
+ // should not happen but just in case...
+ if (userData == nullptr) {
+ printf("ERROR - MyPlayerErrorCallbackProc needs userData\n");
+ return;
+ }
+ SineThreadedData_t *sineData = (SineThreadedData_t *) userData;
+ android::status_t ret = sineData->waker.wake(error);
+ printf("Error Callback, error: %d, futex wake returns %d\n", error, ret);
}
+
#endif //AAUDIO_SIMPLE_PLAYER_H
diff --git a/media/libaaudio/examples/utils/AAudioSimpleRecorder.h b/media/libaaudio/examples/utils/AAudioSimpleRecorder.h
index 5ecac04..1344273 100644
--- a/media/libaaudio/examples/utils/AAudioSimpleRecorder.h
+++ b/media/libaaudio/examples/utils/AAudioSimpleRecorder.h
@@ -77,7 +77,7 @@
if (mStream == nullptr) {
return AAUDIO_ERROR_INVALID_STATE;
}
- return AAudioStream_getChannelCount(mStream);
+ return AAudioStream_getChannelCount(mStream);;
}
/**
@@ -187,7 +187,7 @@
// Write zero data to fill up the buffer and prevent underruns.
aaudio_result_t prime() {
- int32_t samplesPerFrame = AAudioStream_getSamplesPerFrame(mStream);
+ int32_t samplesPerFrame = AAudioStream_getChannelCount(mStream);
const int numFrames = 32; // arbitrary
float zeros[numFrames * samplesPerFrame];
memset(zeros, 0, sizeof(zeros));
@@ -260,7 +260,7 @@
}
PeakTrackerData_t *data = (PeakTrackerData_t *) userData;
// printf("MyCallbackProc(): frameCount = %d\n", numFrames);
- int32_t samplesPerFrame = AAudioStream_getSamplesPerFrame(stream);
+ int32_t samplesPerFrame = AAudioStream_getChannelCount(stream);
float sample;
// This code assume mono or stereo.
switch (AAudioStream_getFormat(stream)) {
diff --git a/media/libaaudio/examples/utils/SineGenerator.h b/media/libaaudio/examples/utils/SineGenerator.h
index 64b772d..a755582 100644
--- a/media/libaaudio/examples/utils/SineGenerator.h
+++ b/media/libaaudio/examples/utils/SineGenerator.h
@@ -58,6 +58,13 @@
}
}
+ void setAmplitude(double amplitude) {
+ mAmplitude = amplitude;
+ }
+ double getAmplitude() const {
+ return mAmplitude;
+ }
+
private:
void advancePhase() {
mPhase += mPhaseIncrement;
diff --git a/media/libaaudio/examples/write_sine/src/write_sine.cpp b/media/libaaudio/examples/write_sine/src/write_sine.cpp
index 656ab05..8c6f783 100644
--- a/media/libaaudio/examples/write_sine/src/write_sine.cpp
+++ b/media/libaaudio/examples/write_sine/src/write_sine.cpp
@@ -56,7 +56,7 @@
// in a buffer if we hang or crash.
setvbuf(stdout, nullptr, _IONBF, (size_t) 0);
- printf("%s - Play a sine wave using AAudio V0.1.1\n", argv[0]);
+ printf("%s - Play a sine wave using AAudio V0.1.2\n", argv[0]);
if (argParser.parseArgs(argc, argv)) {
return EXIT_FAILURE;
diff --git a/media/libaaudio/examples/write_sine/src/write_sine_callback.cpp b/media/libaaudio/examples/write_sine/src/write_sine_callback.cpp
index b5602e9..4f9cde6 100644
--- a/media/libaaudio/examples/write_sine/src/write_sine_callback.cpp
+++ b/media/libaaudio/examples/write_sine/src/write_sine_callback.cpp
@@ -15,6 +15,7 @@
*/
// Play sine waves using an AAudio callback.
+// If a disconnection occurs then reopen the stream on the new device.
#include <assert.h>
#include <unistd.h>
@@ -22,33 +23,32 @@
#include <sched.h>
#include <stdio.h>
#include <math.h>
+#include <string.h>
#include <time.h>
#include <aaudio/AAudio.h>
#include "AAudioExampleUtils.h"
#include "AAudioSimplePlayer.h"
#include "../../utils/AAudioSimplePlayer.h"
-int main(int argc, const char **argv)
+/**
+ * Open stream, play some sine waves, then close the stream.
+ *
+ * @param argParser
+ * @return AAUDIO_OK or negative error code
+ */
+static aaudio_result_t testOpenPlayClose(AAudioArgsParser &argParser)
{
- AAudioArgsParser argParser;
- AAudioSimplePlayer player;
SineThreadedData_t myData;
- aaudio_result_t result;
- int32_t actualSampleRate;
+ AAudioSimplePlayer &player = myData.simplePlayer;
+ aaudio_result_t result = AAUDIO_OK;
+ bool disconnected = false;
+ int64_t startedAtNanos;
- // Make printf print immediately so that debug info is not stuck
- // in a buffer if we hang or crash.
- setvbuf(stdout, nullptr, _IONBF, (size_t) 0);
-
- printf("%s - Play a sine sweep using an AAudio callback V0.1.2\n", argv[0]);
-
+ printf("----------------------- run complete test --------------------------\n");
myData.schedulerChecked = false;
+ myData.callbackCount = 0;
myData.forceUnderruns = false; // set true to test AAudioStream_getXRunCount()
- if (argParser.parseArgs(argc, argv)) {
- return EXIT_FAILURE;
- }
-
result = player.open(argParser,
SimplePlayerDataCallbackProc, SimplePlayerErrorCallbackProc, &myData);
if (result != AAUDIO_OK) {
@@ -58,13 +58,19 @@
argParser.compareWithStream(player.getStream());
- actualSampleRate = player.getSampleRate();
- myData.sineOsc1.setup(440.0, actualSampleRate);
- myData.sineOsc1.setSweep(300.0, 600.0, 5.0);
- myData.sineOsc2.setup(660.0, actualSampleRate);
- myData.sineOsc2.setSweep(350.0, 900.0, 7.0);
+ // Setup sine wave generators.
+ {
+ int32_t actualSampleRate = player.getSampleRate();
+ myData.sineOsc1.setup(440.0, actualSampleRate);
+ myData.sineOsc1.setSweep(300.0, 600.0, 5.0);
+ myData.sineOsc1.setAmplitude(0.2);
+ myData.sineOsc2.setup(660.0, actualSampleRate);
+ myData.sineOsc2.setSweep(350.0, 900.0, 7.0);
+ myData.sineOsc2.setAmplitude(0.2);
+ }
#if 0
+ // writes not allowed for callback streams
result = player.prime(); // FIXME crashes AudioTrack.cpp
if (result != AAUDIO_OK) {
fprintf(stderr, "ERROR - player.prime() returned %d\n", result);
@@ -78,34 +84,32 @@
goto error;
}
+ // Play a sine wave in the background.
printf("Sleep for %d seconds while audio plays in a callback thread.\n",
argParser.getDurationSeconds());
+ startedAtNanos = getNanoseconds(CLOCK_MONOTONIC);
for (int second = 0; second < argParser.getDurationSeconds(); second++)
{
- const struct timespec request = { .tv_sec = 1, .tv_nsec = 0 };
- (void) clock_nanosleep(CLOCK_MONOTONIC, 0 /*flags*/, &request, NULL /*remain*/);
-
- aaudio_stream_state_t state;
- result = AAudioStream_waitForStateChange(player.getStream(),
- AAUDIO_STREAM_STATE_CLOSED,
- &state,
- 0);
+ // Sleep a while. Wake up early if there is an error, for example a DISCONNECT.
+ long ret = myData.waker.wait(AAUDIO_OK, NANOS_PER_SECOND);
+ int64_t millis = (getNanoseconds(CLOCK_MONOTONIC) - startedAtNanos) / NANOS_PER_MILLISECOND;
+ result = myData.waker.get();
+ printf("wait() returns %ld, aaudio_result = %d, at %6d millis"
+ ", second = %d, framesWritten = %8d, underruns = %d\n",
+ ret, result, (int) millis,
+ second,
+ (int) AAudioStream_getFramesWritten(player.getStream()),
+ (int) AAudioStream_getXRunCount(player.getStream()));
if (result != AAUDIO_OK) {
- fprintf(stderr, "ERROR - AAudioStream_waitForStateChange() returned %d\n", result);
- goto error;
- }
- if (state != AAUDIO_STREAM_STATE_STARTING && state != AAUDIO_STREAM_STATE_STARTED) {
- printf("Stream state is %d %s!\n", state, AAudio_convertStreamStateToText(state));
+ if (result == AAUDIO_ERROR_DISCONNECTED) {
+ disconnected = true;
+ }
break;
}
- printf("framesWritten = %d, underruns = %d\n",
- (int) AAudioStream_getFramesWritten(player.getStream()),
- (int) AAudioStream_getXRunCount(player.getStream())
- );
}
- printf("Woke up now.\n");
+ printf("AAudio result = %d = %s\n", result, AAudio_convertResultToText(result));
- printf("call stop()\n");
+ printf("call stop() callback # = %d\n", myData.callbackCount);
result = player.stop();
if (result != AAUDIO_OK) {
goto error;
@@ -116,6 +120,18 @@
goto error;
}
+ for (int i = 0; i < myData.timestampCount; i++) {
+ Timestamp *timestamp = &myData.timestamps[i];
+ bool retro = (i > 0 &&
+ ((timestamp->position < (timestamp - 1)->position)
+ || ((timestamp->nanoseconds < (timestamp - 1)->nanoseconds))));
+ const char *message = retro ? " <= RETROGRADE!" : "";
+ printf("Timestamp %3d : %8lld, %8lld %s\n", i,
+ (long long) timestamp->position,
+ (long long) timestamp->nanoseconds,
+ message);
+ }
+
if (myData.schedulerChecked) {
printf("scheduler = 0x%08x, SCHED_FIFO = 0x%08X\n",
myData.scheduler,
@@ -126,10 +142,28 @@
printf("max numFrames = %8d\n", (int) myData.maxNumFrames);
printf("SUCCESS\n");
- return EXIT_SUCCESS;
error:
player.close();
- printf("exiting - AAudio result = %d = %s\n", result, AAudio_convertResultToText(result));
- return EXIT_FAILURE;
+ return disconnected ? AAUDIO_ERROR_DISCONNECTED : result;
}
+int main(int argc, const char **argv)
+{
+ AAudioArgsParser argParser;
+ aaudio_result_t result;
+
+ // Make printf print immediately so that debug info is not stuck
+ // in a buffer if we hang or crash.
+ setvbuf(stdout, nullptr, _IONBF, (size_t) 0);
+
+ printf("%s - Play a sine sweep using an AAudio callback V0.1.2\n", argv[0]);
+
+ if (argParser.parseArgs(argc, argv)) {
+ return EXIT_FAILURE;
+ }
+
+ // Keep looping until we can complete the test without disconnecting.
+ while((result = testOpenPlayClose(argParser)) == AAUDIO_ERROR_DISCONNECTED);
+
+ return (result) ? EXIT_FAILURE : EXIT_SUCCESS;
+}
diff --git a/media/libaaudio/include/aaudio/AAudio.h b/media/libaaudio/include/aaudio/AAudio.h
index e1886ac..3c23736 100644
--- a/media/libaaudio/include/aaudio/AAudio.h
+++ b/media/libaaudio/include/aaudio/AAudio.h
@@ -234,10 +234,11 @@
int32_t channelCount);
/**
+ * Identical to AAudioStreamBuilder_setChannelCount().
*
- * @deprecated use AAudioStreamBuilder_setChannelCount()
+ * @param builder reference provided by AAudio_createStreamBuilder()
+ * @param samplesPerFrame Number of samples in a frame.
*/
-// TODO remove as soon as the NDK and OS are in sync, before RC1
AAUDIO_API void AAudioStreamBuilder_setSamplesPerFrame(AAudioStreamBuilder* builder,
int32_t samplesPerFrame);
@@ -729,11 +730,10 @@
AAUDIO_API int32_t AAudioStream_getChannelCount(AAudioStream* stream);
/**
- * The samplesPerFrame is also known as channelCount.
+ * Identical to AAudioStream_getChannelCount().
*
- * @deprecated use AAudioStream_getChannelCount()
* @param stream reference provided by AAudioStreamBuilder_openStream()
- * @return actual samples per frame
+ * @return actual number of samples frame
*/
AAUDIO_API int32_t AAudioStream_getSamplesPerFrame(AAudioStream* stream);
@@ -810,7 +810,7 @@
* The position and time passed back are monotonically increasing.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
- * @param clockid AAUDIO_CLOCK_MONOTONIC or AAUDIO_CLOCK_BOOTTIME
+ * @param clockid CLOCK_MONOTONIC or CLOCK_BOOTTIME
* @param framePosition pointer to a variable to receive the position
* @param timeNanoseconds pointer to a variable to receive the time
* @return AAUDIO_OK or a negative error
diff --git a/media/libaaudio/src/Android.bp b/media/libaaudio/src/Android.bp
index 42f577e..788833b 100644
--- a/media/libaaudio/src/Android.bp
+++ b/media/libaaudio/src/Android.bp
@@ -21,7 +21,6 @@
"legacy/AudioStreamLegacy.cpp",
"legacy/AudioStreamRecord.cpp",
"legacy/AudioStreamTrack.cpp",
- "utility/HandleTracker.cpp",
"utility/AAudioUtilities.cpp",
"utility/FixedBlockAdapter.cpp",
"utility/FixedBlockReader.cpp",
diff --git a/media/libaaudio/src/binding/AAudioBinderClient.cpp b/media/libaaudio/src/binding/AAudioBinderClient.cpp
index a268e49..07ee2de 100644
--- a/media/libaaudio/src/binding/AAudioBinderClient.cpp
+++ b/media/libaaudio/src/binding/AAudioBinderClient.cpp
@@ -45,6 +45,7 @@
using android::IInterface;
using android::IAAudioService;
using android::Mutex;
+using android::ProcessState;
using android::sp;
using android::wp;
@@ -52,15 +53,19 @@
ANDROID_SINGLETON_STATIC_INSTANCE(AAudioBinderClient);
+// If we don't keep a strong pointer here then this singleton can get deleted!
+android::sp<AAudioBinderClient> gKeepBinderClient;
+
AAudioBinderClient::AAudioBinderClient()
: AAudioServiceInterface()
, Singleton<AAudioBinderClient>() {
-
+ gKeepBinderClient = this; // so this singleton won't get deleted
mAAudioClient = new AAudioClient(this);
- ALOGV("AAudioBinderClient() created mAAudioClient = %p", mAAudioClient.get());
+ ALOGV("AAudioBinderClient() this = %p, created mAAudioClient = %p", this, mAAudioClient.get());
}
AAudioBinderClient::~AAudioBinderClient() {
+ ALOGV("AAudioBinderClient()::~AAudioBinderClient() destroying %p", this);
Mutex::Autolock _l(mServiceLock);
if (mAAudioService != 0) {
IInterface::asBinder(mAAudioService)->unlinkToDeath(mAAudioClient);
@@ -75,19 +80,19 @@
bool needToRegister = false;
{
Mutex::Autolock _l(mServiceLock);
- if (mAAudioService == 0) {
+ if (mAAudioService.get() == nullptr) {
sp<IBinder> binder;
sp<IServiceManager> sm = defaultServiceManager();
// Try several times to get the service.
int retries = 4;
do {
binder = sm->getService(String16(AAUDIO_SERVICE_NAME)); // This will wait a while.
- if (binder != 0) {
+ if (binder.get() != nullptr) {
break;
}
} while (retries-- > 0);
- if (binder != 0) {
+ if (binder.get() != nullptr) {
// Ask for notification if the service dies.
status_t status = binder->linkToDeath(mAAudioClient);
// TODO review what we should do if this fails
@@ -98,7 +103,7 @@
mAAudioService = interface_cast<IAAudioService>(binder);
needToRegister = true;
// Make sure callbacks can be received by mAAudioClient
- android::ProcessState::self()->startThreadPool();
+ ProcessState::self()->startThreadPool();
} else {
ALOGE("AAudioBinderClient could not connect to %s", AAUDIO_SERVICE_NAME);
}
@@ -106,7 +111,7 @@
aaudioService = mAAudioService;
}
// Do this outside the mutex lock.
- if (needToRegister && aaudioService != 0) { // new client?
+ if (needToRegister && aaudioService.get() != nullptr) { // new client?
aaudioService->registerClient(mAAudioClient);
}
return aaudioService;
@@ -117,7 +122,6 @@
mAAudioService.clear(); // force a reconnect
}
-
/**
* @param request info needed to create the stream
* @param configuration contains information about the created stream
@@ -128,14 +132,12 @@
aaudio_handle_t stream;
for (int i = 0; i < 2; i++) {
const sp<IAAudioService> &service = getAAudioService();
- if (service == 0) {
- return AAUDIO_ERROR_NO_SERVICE;
- }
+ if (service.get() == nullptr) return AAUDIO_ERROR_NO_SERVICE;
stream = service->openStream(request, configurationOutput);
if (stream == AAUDIO_ERROR_NO_SERVICE) {
- ALOGE("AAudioBinderClient: lost connection to AAudioService.");
+ ALOGE("AAudioBinderClient::openStream lost connection to AAudioService.");
dropAAudioService(); // force a reconnect
} else {
break;
@@ -145,8 +147,8 @@
}
aaudio_result_t AAudioBinderClient::closeStream(aaudio_handle_t streamHandle) {
- const sp<IAAudioService> &service = getAAudioService();
- if (service == 0) return AAUDIO_ERROR_NO_SERVICE;
+ const sp<IAAudioService> service = getAAudioService();
+ if (service.get() == nullptr) return AAUDIO_ERROR_NO_SERVICE;
return service->closeStream(streamHandle);
}
@@ -155,32 +157,32 @@
*/
aaudio_result_t AAudioBinderClient::getStreamDescription(aaudio_handle_t streamHandle,
AudioEndpointParcelable &parcelable) {
- const sp<IAAudioService> &service = getAAudioService();
- if (service == 0) return AAUDIO_ERROR_NO_SERVICE;
+ const sp<IAAudioService> service = getAAudioService();
+ if (service.get() == nullptr) return AAUDIO_ERROR_NO_SERVICE;
return service->getStreamDescription(streamHandle, parcelable);
}
aaudio_result_t AAudioBinderClient::startStream(aaudio_handle_t streamHandle) {
- const sp<IAAudioService> &service = getAAudioService();
- if (service == 0) return AAUDIO_ERROR_NO_SERVICE;
+ const sp<IAAudioService> service = getAAudioService();
+ if (service.get() == nullptr) return AAUDIO_ERROR_NO_SERVICE;
return service->startStream(streamHandle);
}
aaudio_result_t AAudioBinderClient::pauseStream(aaudio_handle_t streamHandle) {
- const sp<IAAudioService> &service = getAAudioService();
- if (service == 0) return AAUDIO_ERROR_NO_SERVICE;
+ const sp<IAAudioService> service = getAAudioService();
+ if (service.get() == nullptr) return AAUDIO_ERROR_NO_SERVICE;
return service->pauseStream(streamHandle);
}
aaudio_result_t AAudioBinderClient::stopStream(aaudio_handle_t streamHandle) {
- const sp<IAAudioService> &service = getAAudioService();
- if (service == 0) return AAUDIO_ERROR_NO_SERVICE;
+ const sp<IAAudioService> service = getAAudioService();
+ if (service.get() == nullptr) return AAUDIO_ERROR_NO_SERVICE;
return service->stopStream(streamHandle);
}
aaudio_result_t AAudioBinderClient::flushStream(aaudio_handle_t streamHandle) {
- const sp<IAAudioService> &service = getAAudioService();
- if (service == 0) return AAUDIO_ERROR_NO_SERVICE;
+ const sp<IAAudioService> service = getAAudioService();
+ if (service.get() == nullptr) return AAUDIO_ERROR_NO_SERVICE;
return service->flushStream(streamHandle);
}
@@ -190,8 +192,8 @@
aaudio_result_t AAudioBinderClient::registerAudioThread(aaudio_handle_t streamHandle,
pid_t clientThreadId,
int64_t periodNanoseconds) {
- const sp<IAAudioService> &service = getAAudioService();
- if (service == 0) return AAUDIO_ERROR_NO_SERVICE;
+ const sp<IAAudioService> service = getAAudioService();
+ if (service.get() == nullptr) return AAUDIO_ERROR_NO_SERVICE;
return service->registerAudioThread(streamHandle,
clientThreadId,
periodNanoseconds);
@@ -199,8 +201,8 @@
aaudio_result_t AAudioBinderClient::unregisterAudioThread(aaudio_handle_t streamHandle,
pid_t clientThreadId) {
- const sp<IAAudioService> &service = getAAudioService();
- if (service == 0) return AAUDIO_ERROR_NO_SERVICE;
+ const sp<IAAudioService> service = getAAudioService();
+ if (service.get() == nullptr) return AAUDIO_ERROR_NO_SERVICE;
return service->unregisterAudioThread(streamHandle,
clientThreadId);
}
diff --git a/media/libaaudio/src/binding/AAudioBinderClient.h b/media/libaaudio/src/binding/AAudioBinderClient.h
index 89ae85c..f9da8b4 100644
--- a/media/libaaudio/src/binding/AAudioBinderClient.h
+++ b/media/libaaudio/src/binding/AAudioBinderClient.h
@@ -118,13 +118,13 @@
{
public:
AAudioClient(android::wp<AAudioBinderClient> aaudioBinderClient)
- : mBinderClient(aaudioBinderClient) {
+ : mBinderClient(aaudioBinderClient) {
}
// implement DeathRecipient
virtual void binderDied(const android::wp<android::IBinder>& who __unused) {
android::sp<AAudioBinderClient> client = mBinderClient.promote();
- if (client != 0) {
+ if (client.get() != nullptr) {
client->dropAAudioService();
}
ALOGW("AAudio service binderDied()!");
@@ -133,7 +133,7 @@
// implement BnAAudioClient
void onStreamChange(aaudio_handle_t handle, int32_t opcode, int32_t value) {
android::sp<AAudioBinderClient> client = mBinderClient.promote();
- if (client != 0) {
+ if (client.get() != nullptr) {
client->onStreamChange(handle, opcode, value);
}
}
@@ -141,10 +141,11 @@
android::wp<AAudioBinderClient> mBinderClient;
};
+private:
- android::Mutex mServiceLock;
+ android::Mutex mServiceLock;
android::sp<android::IAAudioService> mAAudioService;
- android::sp<AAudioClient> mAAudioClient;
+ android::sp<AAudioClient> mAAudioClient;
};
diff --git a/media/libaaudio/src/binding/AAudioCommon.h b/media/libaaudio/src/binding/AAudioCommon.h
new file mode 100644
index 0000000..e3e9e82
--- /dev/null
+++ b/media/libaaudio/src/binding/AAudioCommon.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_AAUDIO_COMMON_H
+#define ANDROID_AAUDIO_COMMON_H
+
+#include <stdint.h>
+
+/*
+ * Internal header that is common to both client and server.
+ *
+ */
+namespace aaudio {
+
+typedef int32_t aaudio_handle_t;
+
+} /* namespace aaudio */
+
+#endif // ANDROID_AAUDIO_COMMON_H
diff --git a/media/libaaudio/src/binding/AAudioServiceMessage.h b/media/libaaudio/src/binding/AAudioServiceMessage.h
index b4377fb..54e8001 100644
--- a/media/libaaudio/src/binding/AAudioServiceMessage.h
+++ b/media/libaaudio/src/binding/AAudioServiceMessage.h
@@ -28,7 +28,6 @@
// Used to send information about the HAL to the client.
struct AAudioMessageTimestamp {
int64_t position; // number of frames transferred so far
- int64_t deviceOffset; // add to client position to get device position
int64_t timestamp; // time when that position was reached
};
@@ -51,7 +50,8 @@
typedef struct AAudioServiceMessage_s {
enum class code : uint32_t {
NOTHING,
- TIMESTAMP,
+ TIMESTAMP_SERVICE, // when frame is read or written by the service to the client
+ TIMESTAMP_HARDWARE, // when frame is at DAC or ADC
EVENT,
};
diff --git a/media/libaaudio/src/binding/AAudioStreamConfiguration.cpp b/media/libaaudio/src/binding/AAudioStreamConfiguration.cpp
index e763934..153fce3 100644
--- a/media/libaaudio/src/binding/AAudioStreamConfiguration.cpp
+++ b/media/libaaudio/src/binding/AAudioStreamConfiguration.cpp
@@ -46,6 +46,8 @@
if (status != NO_ERROR) goto error;
status = parcel->writeInt32((int32_t) getFormat());
if (status != NO_ERROR) goto error;
+ status = parcel->writeInt32((int32_t) getDirection());
+ if (status != NO_ERROR) goto error;
status = parcel->writeInt32(getBufferCapacity());
if (status != NO_ERROR) goto error;
return NO_ERROR;
@@ -73,9 +75,12 @@
setFormat(value);
status = parcel->readInt32(&value);
if (status != NO_ERROR) goto error;
+ setDirection((aaudio_direction_t) value);
+ status = parcel->readInt32(&value);
+ if (status != NO_ERROR) goto error;
setBufferCapacity(value);
return NO_ERROR;
error:
ALOGE("AAudioStreamConfiguration.readFromParcel(): read failed = %d", status);
return status;
-}
\ No newline at end of file
+}
diff --git a/media/libaaudio/src/binding/AAudioStreamRequest.cpp b/media/libaaudio/src/binding/AAudioStreamRequest.cpp
index abdcf5b..1200ab2 100644
--- a/media/libaaudio/src/binding/AAudioStreamRequest.cpp
+++ b/media/libaaudio/src/binding/AAudioStreamRequest.cpp
@@ -46,9 +46,6 @@
status_t status = parcel->writeInt32((int32_t) mUserId);
if (status != NO_ERROR) goto error;
- status = parcel->writeInt32((int32_t) mDirection);
- if (status != NO_ERROR) goto error;
-
status = parcel->writeBool(mSharingModeMatchRequired);
if (status != NO_ERROR) goto error;
@@ -71,10 +68,6 @@
if (status != NO_ERROR) goto error;
mUserId = (uid_t) temp;
- status = parcel->readInt32(&temp);
- if (status != NO_ERROR) goto error;
- mDirection = (aaudio_direction_t) temp;
-
status = parcel->readBool(&mSharingModeMatchRequired);
if (status != NO_ERROR) goto error;
@@ -98,7 +91,6 @@
void AAudioStreamRequest::dump() const {
ALOGD("AAudioStreamRequest mUserId = %d", mUserId);
ALOGD("AAudioStreamRequest mProcessId = %d", mProcessId);
- ALOGD("AAudioStreamRequest mDirection = %d", mDirection);
ALOGD("AAudioStreamRequest mSharingModeMatchRequired = %d", mSharingModeMatchRequired);
ALOGD("AAudioStreamRequest mInService = %d", mInService);
mConfiguration.dump();
diff --git a/media/libaaudio/src/binding/AAudioStreamRequest.h b/media/libaaudio/src/binding/AAudioStreamRequest.h
index b0fa96a..492f69d 100644
--- a/media/libaaudio/src/binding/AAudioStreamRequest.h
+++ b/media/libaaudio/src/binding/AAudioStreamRequest.h
@@ -52,14 +52,6 @@
mProcessId = processId;
}
- aaudio_direction_t getDirection() const {
- return mDirection;
- }
-
- void setDirection(aaudio_direction_t direction) {
- mDirection = direction;
- }
-
bool isSharingModeMatchRequired() const {
return mSharingModeMatchRequired;
}
@@ -94,9 +86,8 @@
protected:
AAudioStreamConfiguration mConfiguration;
- uid_t mUserId;
- pid_t mProcessId;
- aaudio_direction_t mDirection;
+ uid_t mUserId = (uid_t) -1;
+ pid_t mProcessId = (pid_t) -1;
bool mSharingModeMatchRequired = false;
bool mInService = false; // Stream opened by AAudioservice
};
diff --git a/media/libaaudio/src/binding/IAAudioClient.h b/media/libaaudio/src/binding/IAAudioClient.h
index 21cc33b..f21fd93 100644
--- a/media/libaaudio/src/binding/IAAudioClient.h
+++ b/media/libaaudio/src/binding/IAAudioClient.h
@@ -22,7 +22,7 @@
#include <aaudio/AAudio.h>
-#include "utility/HandleTracker.h"
+#include "binding/AAudioCommon.h"
namespace android {
@@ -33,7 +33,7 @@
DECLARE_META_INTERFACE(AAudioClient);
- virtual void onStreamChange(aaudio_handle_t handle, int32_t opcode, int32_t value) = 0;
+ virtual void onStreamChange(aaudio::aaudio_handle_t handle, int32_t opcode, int32_t value) = 0;
};
diff --git a/media/libaaudio/src/binding/IAAudioService.h b/media/libaaudio/src/binding/IAAudioService.h
index 30b3ead..6bdb826 100644
--- a/media/libaaudio/src/binding/IAAudioService.h
+++ b/media/libaaudio/src/binding/IAAudioService.h
@@ -24,12 +24,12 @@
#include <aaudio/AAudio.h>
+#include "binding/AAudioCommon.h"
#include "binding/AAudioServiceDefinitions.h"
-#include "binding/AudioEndpointParcelable.h"
-#include "binding/AAudioStreamRequest.h"
#include "binding/AAudioStreamConfiguration.h"
+#include "binding/AAudioStreamRequest.h"
+#include "binding/AudioEndpointParcelable.h"
#include "binding/IAAudioClient.h"
-#include "utility/HandleTracker.h"
namespace android {
@@ -51,7 +51,7 @@
* @param configuration contains information about the created stream
* @return handle to the stream or a negative error
*/
- virtual aaudio_handle_t openStream(const aaudio::AAudioStreamRequest &request,
+ virtual aaudio::aaudio_handle_t openStream(const aaudio::AAudioStreamRequest &request,
aaudio::AAudioStreamConfiguration &configurationOutput) = 0;
virtual aaudio_result_t closeStream(aaudio::aaudio_handle_t streamHandle) = 0;
@@ -89,11 +89,11 @@
/**
* Manage the specified thread as a low latency audio thread.
*/
- virtual aaudio_result_t registerAudioThread(aaudio_handle_t streamHandle,
+ virtual aaudio_result_t registerAudioThread(aaudio::aaudio_handle_t streamHandle,
pid_t clientThreadId,
int64_t periodNanoseconds) = 0;
- virtual aaudio_result_t unregisterAudioThread(aaudio_handle_t streamHandle,
+ virtual aaudio_result_t unregisterAudioThread(aaudio::aaudio_handle_t streamHandle,
pid_t clientThreadId) = 0;
};
diff --git a/media/libaaudio/src/client/AudioEndpoint.cpp b/media/libaaudio/src/client/AudioEndpoint.cpp
index 6ec285f..604eed5 100644
--- a/media/libaaudio/src/client/AudioEndpoint.cpp
+++ b/media/libaaudio/src/client/AudioEndpoint.cpp
@@ -32,14 +32,17 @@
#define RIDICULOUSLY_LARGE_FRAME_SIZE 4096
AudioEndpoint::AudioEndpoint()
- : mFreeRunning(false)
+ : mUpCommandQueue(nullptr)
+ , mDataQueue(nullptr)
+ , mFreeRunning(false)
, mDataReadCounter(0)
, mDataWriteCounter(0)
{
}
-AudioEndpoint::~AudioEndpoint()
-{
+AudioEndpoint::~AudioEndpoint() {
+ delete mDataQueue;
+ delete mUpCommandQueue;
}
static aaudio_result_t AudioEndpoint_validateQueueDescriptor(const char *type,
@@ -118,24 +121,28 @@
{
aaudio_result_t result = AudioEndpoint_validateDescriptor(pEndpointDescriptor);
if (result != AAUDIO_OK) {
- ALOGE("AudioEndpoint_validateQueueDescriptor returned %d %s",
- result, AAudio_convertResultToText(result));
return result;
}
// ============================ up message queue =============================
const RingBufferDescriptor *descriptor = &pEndpointDescriptor->upMessageQueueDescriptor;
if(descriptor->bytesPerFrame != sizeof(AAudioServiceMessage)) {
- ALOGE("AudioEndpoint::configure() bytesPerFrame != sizeof(AAudioServiceMessage) = %d",
+ ALOGE("AudioEndpoint.configure() bytesPerFrame != sizeof(AAudioServiceMessage) = %d",
descriptor->bytesPerFrame);
return AAUDIO_ERROR_INTERNAL;
}
if(descriptor->readCounterAddress == nullptr || descriptor->writeCounterAddress == nullptr) {
- ALOGE("AudioEndpoint_validateQueueDescriptor() NULL counter address");
+ ALOGE("AudioEndpoint.configure() NULL counter address");
return AAUDIO_ERROR_NULL;
}
+ // Prevent memory leak and reuse.
+ if(mUpCommandQueue != nullptr || mDataQueue != nullptr) {
+ ALOGE("AudioEndpoint.configure() endpoint already used");
+ return AAUDIO_ERROR_INTERNAL;
+ }
+
mUpCommandQueue = new FifoBuffer(
descriptor->bytesPerFrame,
descriptor->capacityInFrames,
@@ -146,8 +153,8 @@
// ============================ data queue =============================
descriptor = &pEndpointDescriptor->dataQueueDescriptor;
- ALOGV("AudioEndpoint::configure() data framesPerBurst = %d", descriptor->framesPerBurst);
- ALOGV("AudioEndpoint::configure() data readCounterAddress = %p",
+ ALOGV("AudioEndpoint.configure() data framesPerBurst = %d", descriptor->framesPerBurst);
+ ALOGV("AudioEndpoint.configure() data readCounterAddress = %p",
descriptor->readCounterAddress);
// An example of free running is when the other side is read or written by hardware DMA
@@ -156,7 +163,7 @@
? descriptor->readCounterAddress // read by other side
: descriptor->writeCounterAddress; // written by other side
mFreeRunning = (remoteCounter == nullptr);
- ALOGV("AudioEndpoint::configure() mFreeRunning = %d", mFreeRunning ? 1 : 0);
+ ALOGV("AudioEndpoint.configure() mFreeRunning = %d", mFreeRunning ? 1 : 0);
int64_t *readCounterAddress = (descriptor->readCounterAddress == nullptr)
? &mDataReadCounter
@@ -254,3 +261,7 @@
ALOGD("AudioEndpoint: data readCounter = %lld", (long long) mDataQueue->getReadCounter());
ALOGD("AudioEndpoint: data writeCounter = %lld", (long long) mDataQueue->getWriteCounter());
}
+
+void AudioEndpoint::eraseDataMemory() {
+ mDataQueue->eraseMemory();
+}
diff --git a/media/libaaudio/src/client/AudioEndpoint.h b/media/libaaudio/src/client/AudioEndpoint.h
index 81a4f7b..f5b67e8 100644
--- a/media/libaaudio/src/client/AudioEndpoint.h
+++ b/media/libaaudio/src/client/AudioEndpoint.h
@@ -86,6 +86,11 @@
int32_t getBufferCapacityInFrames() const;
+ /**
+ * Write zeros to the data queue memory.
+ */
+ void eraseDataMemory();
+
void dump() const;
private:
diff --git a/media/libaaudio/src/client/AudioStreamInternal.cpp b/media/libaaudio/src/client/AudioStreamInternal.cpp
index 4c7d0f7..2fdbfaf 100644
--- a/media/libaaudio/src/client/AudioStreamInternal.cpp
+++ b/media/libaaudio/src/client/AudioStreamInternal.cpp
@@ -23,7 +23,6 @@
#define ATRACE_TAG ATRACE_TAG_AUDIO
#include <stdint.h>
-#include <assert.h>
#include <binder/IServiceManager.h>
@@ -55,7 +54,7 @@
// Wait at least this many times longer than the operation should take.
#define MIN_TIMEOUT_OPERATIONS 4
-#define LOG_TIMESTAMPS 0
+#define LOG_TIMESTAMPS 0
AudioStreamInternal::AudioStreamInternal(AAudioServiceInterface &serviceInterface, bool inService)
: AudioStream()
@@ -63,9 +62,9 @@
, mAudioEndpoint()
, mServiceStreamHandle(AAUDIO_HANDLE_INVALID)
, mFramesPerBurst(16)
- , mStreamVolume(1.0f)
, mInService(inService)
, mServiceInterface(serviceInterface)
+ , mAtomicTimestamp()
, mWakeupDelayNanos(AAudioProperty_getWakeupDelayMicros() * AAUDIO_NANOS_PER_MICROSECOND)
, mMinimumSleepNanos(AAudioProperty_getMinimumSleepMicros() * AAUDIO_NANOS_PER_MICROSECOND)
{
@@ -79,9 +78,16 @@
aaudio_result_t AudioStreamInternal::open(const AudioStreamBuilder &builder) {
aaudio_result_t result = AAUDIO_OK;
+ int32_t capacity;
AAudioStreamRequest request;
- AAudioStreamConfiguration configuration;
+ AAudioStreamConfiguration configurationOutput;
+ if (getState() != AAUDIO_STREAM_STATE_UNINITIALIZED) {
+ ALOGE("AudioStreamInternal::open(): already open! state = %d", getState());
+ return AAUDIO_ERROR_INVALID_STATE;
+ }
+
+ // Copy requested parameters to the stream.
result = AudioStream::open(builder);
if (result < 0) {
return result;
@@ -97,103 +103,108 @@
// Build the request to send to the server.
request.setUserId(getuid());
request.setProcessId(getpid());
- request.setDirection(getDirection());
request.setSharingModeMatchRequired(isSharingModeMatchRequired());
request.setInService(mInService);
request.getConfiguration().setDeviceId(getDeviceId());
request.getConfiguration().setSampleRate(getSampleRate());
request.getConfiguration().setSamplesPerFrame(getSamplesPerFrame());
+ request.getConfiguration().setDirection(getDirection());
request.getConfiguration().setSharingMode(getSharingMode());
request.getConfiguration().setBufferCapacity(builder.getBufferCapacity());
- mServiceStreamHandle = mServiceInterface.openStream(request, configuration);
+ mServiceStreamHandle = mServiceInterface.openStream(request, configurationOutput);
if (mServiceStreamHandle < 0) {
result = mServiceStreamHandle;
- ALOGE("AudioStreamInternal.open(): openStream() returned %d", result);
- } else {
- result = configuration.validate();
- if (result != AAUDIO_OK) {
- close();
- return result;
- }
- // Save results of the open.
- setSampleRate(configuration.getSampleRate());
- setSamplesPerFrame(configuration.getSamplesPerFrame());
- setDeviceId(configuration.getDeviceId());
- setSharingMode(configuration.getSharingMode());
-
- // Save device format so we can do format conversion and volume scaling together.
- mDeviceFormat = configuration.getFormat();
-
- result = mServiceInterface.getStreamDescription(mServiceStreamHandle, mEndPointParcelable);
- if (result != AAUDIO_OK) {
- mServiceInterface.closeStream(mServiceStreamHandle);
- return result;
- }
-
- // resolve parcelable into a descriptor
- result = mEndPointParcelable.resolve(&mEndpointDescriptor);
- if (result != AAUDIO_OK) {
- mServiceInterface.closeStream(mServiceStreamHandle);
- return result;
- }
-
- // Configure endpoint based on descriptor.
- mAudioEndpoint.configure(&mEndpointDescriptor, getDirection());
-
- mFramesPerBurst = mEndpointDescriptor.dataQueueDescriptor.framesPerBurst;
- int32_t capacity = mEndpointDescriptor.dataQueueDescriptor.capacityInFrames;
-
- // Validate result from server.
- if (mFramesPerBurst < 16 || mFramesPerBurst > 16 * 1024) {
- ALOGE("AudioStream::open(): framesPerBurst out of range = %d", mFramesPerBurst);
- return AAUDIO_ERROR_OUT_OF_RANGE;
- }
- if (capacity < mFramesPerBurst || capacity > 32 * 1024) {
- ALOGE("AudioStream::open(): bufferCapacity out of range = %d", capacity);
- return AAUDIO_ERROR_OUT_OF_RANGE;
- }
-
- mClockModel.setSampleRate(getSampleRate());
- mClockModel.setFramesPerBurst(mFramesPerBurst);
-
- if (getDataCallbackProc()) {
- mCallbackFrames = builder.getFramesPerDataCallback();
- if (mCallbackFrames > getBufferCapacity() / 2) {
- ALOGE("AudioStreamInternal::open(): framesPerCallback too big = %d, capacity = %d",
- mCallbackFrames, getBufferCapacity());
- mServiceInterface.closeStream(mServiceStreamHandle);
- return AAUDIO_ERROR_OUT_OF_RANGE;
-
- } else if (mCallbackFrames < 0) {
- ALOGE("AudioStreamInternal::open(): framesPerCallback negative");
- mServiceInterface.closeStream(mServiceStreamHandle);
- return AAUDIO_ERROR_OUT_OF_RANGE;
-
- }
- if (mCallbackFrames == AAUDIO_UNSPECIFIED) {
- mCallbackFrames = mFramesPerBurst;
- }
-
- int32_t bytesPerFrame = getSamplesPerFrame()
- * AAudioConvert_formatToSizeInBytes(getFormat());
- int32_t callbackBufferSize = mCallbackFrames * bytesPerFrame;
- mCallbackBuffer = new uint8_t[callbackBufferSize];
- }
-
- setState(AAUDIO_STREAM_STATE_OPEN);
- // only connect to AudioManager if this is a playback stream running in client process
- if (!mInService && getDirection() == AAUDIO_DIRECTION_OUTPUT) {
- init(android::PLAYER_TYPE_AAUDIO, AUDIO_USAGE_MEDIA);
- }
+ ALOGE("AudioStreamInternal::open(): openStream() returned %d", result);
+ return result;
}
+
+ result = configurationOutput.validate();
+ if (result != AAUDIO_OK) {
+ goto error;
+ }
+ // Save results of the open.
+ setSampleRate(configurationOutput.getSampleRate());
+ setSamplesPerFrame(configurationOutput.getSamplesPerFrame());
+ setDeviceId(configurationOutput.getDeviceId());
+ setSharingMode(configurationOutput.getSharingMode());
+
+ // Save device format so we can do format conversion and volume scaling together.
+ mDeviceFormat = configurationOutput.getFormat();
+
+ result = mServiceInterface.getStreamDescription(mServiceStreamHandle, mEndPointParcelable);
+ if (result != AAUDIO_OK) {
+ goto error;
+ }
+
+ // Resolve parcelable into a descriptor.
+ result = mEndPointParcelable.resolve(&mEndpointDescriptor);
+ if (result != AAUDIO_OK) {
+ goto error;
+ }
+
+ // Configure endpoint based on descriptor.
+ result = mAudioEndpoint.configure(&mEndpointDescriptor, getDirection());
+ if (result != AAUDIO_OK) {
+ goto error;
+ }
+
+ mFramesPerBurst = mEndpointDescriptor.dataQueueDescriptor.framesPerBurst;
+ capacity = mEndpointDescriptor.dataQueueDescriptor.capacityInFrames;
+
+ // Validate result from server.
+ if (mFramesPerBurst < 16 || mFramesPerBurst > 16 * 1024) {
+ ALOGE("AudioStreamInternal::open(): framesPerBurst out of range = %d", mFramesPerBurst);
+ result = AAUDIO_ERROR_OUT_OF_RANGE;
+ goto error;
+ }
+ if (capacity < mFramesPerBurst || capacity > 32 * 1024) {
+ ALOGE("AudioStreamInternal::open(): bufferCapacity out of range = %d", capacity);
+ result = AAUDIO_ERROR_OUT_OF_RANGE;
+ goto error;
+ }
+
+ mClockModel.setSampleRate(getSampleRate());
+ mClockModel.setFramesPerBurst(mFramesPerBurst);
+
+ if (getDataCallbackProc()) {
+ mCallbackFrames = builder.getFramesPerDataCallback();
+ if (mCallbackFrames > getBufferCapacity() / 2) {
+ ALOGE("AudioStreamInternal::open(): framesPerCallback too big = %d, capacity = %d",
+ mCallbackFrames, getBufferCapacity());
+ result = AAUDIO_ERROR_OUT_OF_RANGE;
+ goto error;
+
+ } else if (mCallbackFrames < 0) {
+ ALOGE("AudioStreamInternal::open(): framesPerCallback negative");
+ result = AAUDIO_ERROR_OUT_OF_RANGE;
+ goto error;
+
+ }
+ if (mCallbackFrames == AAUDIO_UNSPECIFIED) {
+ mCallbackFrames = mFramesPerBurst;
+ }
+
+ int32_t bytesPerFrame = getSamplesPerFrame()
+ * AAudioConvert_formatToSizeInBytes(getFormat());
+ int32_t callbackBufferSize = mCallbackFrames * bytesPerFrame;
+ mCallbackBuffer = new uint8_t[callbackBufferSize];
+ }
+
+ setState(AAUDIO_STREAM_STATE_OPEN);
+
+ return result;
+
+error:
+ close();
return result;
}
aaudio_result_t AudioStreamInternal::close() {
- ALOGD("AudioStreamInternal::close(): mServiceStreamHandle = 0x%08X",
+ aaudio_result_t result = AAUDIO_OK;
+ ALOGD("close(): mServiceStreamHandle = 0x%08X",
mServiceStreamHandle);
if (mServiceStreamHandle != AAUDIO_HANDLE_INVALID) {
// Don't close a stream while it is running.
@@ -202,10 +213,10 @@
requestStop();
aaudio_stream_state_t nextState;
int64_t timeoutNanoseconds = MIN_TIMEOUT_NANOS;
- aaudio_result_t result = waitForStateChange(currentState, &nextState,
+ result = waitForStateChange(currentState, &nextState,
timeoutNanoseconds);
if (result != AAUDIO_OK) {
- ALOGE("AudioStreamInternal::close() waitForStateChange() returned %d %s",
+ ALOGE("close() waitForStateChange() returned %d %s",
result, AAudio_convertResultToText(result));
}
}
@@ -216,14 +227,16 @@
mServiceInterface.closeStream(serviceStreamHandle);
delete[] mCallbackBuffer;
mCallbackBuffer = nullptr;
+
setState(AAUDIO_STREAM_STATE_CLOSED);
- return mEndPointParcelable.close();
+ result = mEndPointParcelable.close();
+ aaudio_result_t result2 = AudioStream::close();
+ return (result != AAUDIO_OK) ? result : result2;
} else {
return AAUDIO_ERROR_INVALID_HANDLE;
}
}
-
static void *aaudio_callback_thread_proc(void *context)
{
AudioStreamInternal *stream = (AudioStreamInternal *)context;
@@ -235,24 +248,46 @@
}
}
+/*
+ * It normally takes about 20-30 msec to start a stream on the server.
+ * But the first time can take as much as 200-300 msec. The HW
+ * starts right away so by the time the client gets a chance to write into
+ * the buffer, it is already in a deep underflow state. That can cause the
+ * XRunCount to be non-zero, which could lead an app to tune its latency higher.
+ * To avoid this problem, we set a request for the processing code to start the
+ * client stream at the same position as the server stream.
+ * The processing code will then save the current offset
+ * between client and server and apply that to any position given to the app.
+ */
aaudio_result_t AudioStreamInternal::requestStart()
{
int64_t startTime;
- ALOGD("AudioStreamInternal()::requestStart()");
if (mServiceStreamHandle == AAUDIO_HANDLE_INVALID) {
+ ALOGE("requestStart() mServiceStreamHandle invalid");
return AAUDIO_ERROR_INVALID_STATE;
}
if (isActive()) {
+ ALOGE("requestStart() already active");
return AAUDIO_ERROR_INVALID_STATE;
}
- aaudio_stream_state_t originalState = getState();
+ aaudio_stream_state_t originalState = getState();
+ if (originalState == AAUDIO_STREAM_STATE_DISCONNECTED) {
+ ALOGE("requestStart() but DISCONNECTED");
+ return AAUDIO_ERROR_DISCONNECTED;
+ }
setState(AAUDIO_STREAM_STATE_STARTING);
- aaudio_result_t result = AAudioConvert_androidToAAudioResult(startWithStatus());
+
+ // Clear any stale timestamps from the previous run.
+ drainTimestampsFromService();
+
+ aaudio_result_t result = mServiceInterface.startStream(mServiceStreamHandle);
startTime = AudioClock::getNanoseconds();
mClockModel.start(startTime);
+ mNeedCatchUp.request(); // Ask data processing code to catch up when first timestamp received.
+ // Start data callback thread.
if (result == AAUDIO_OK && getDataCallbackProc() != nullptr) {
// Launch the callback loop thread.
int64_t periodNanos = mCallbackFrames
@@ -297,14 +332,16 @@
aaudio_result_t AudioStreamInternal::requestStopInternal()
{
if (mServiceStreamHandle == AAUDIO_HANDLE_INVALID) {
- ALOGE("AudioStreamInternal::requestStopInternal() mServiceStreamHandle invalid = 0x%08X",
+ ALOGE("requestStopInternal() mServiceStreamHandle invalid = 0x%08X",
mServiceStreamHandle);
return AAUDIO_ERROR_INVALID_STATE;
}
mClockModel.stop(AudioClock::getNanoseconds());
setState(AAUDIO_STREAM_STATE_STOPPING);
- return AAudioConvert_androidToAAudioResult(stopWithStatus());
+ mAtomicTimestamp.clear();
+
+ return mServiceInterface.stopStream(mServiceStreamHandle);
}
aaudio_result_t AudioStreamInternal::requestStop()
@@ -319,6 +356,7 @@
aaudio_result_t AudioStreamInternal::registerThread() {
if (mServiceStreamHandle == AAUDIO_HANDLE_INVALID) {
+ ALOGE("registerThread() mServiceStreamHandle invalid");
return AAUDIO_ERROR_INVALID_STATE;
}
return mServiceInterface.registerAudioThread(mServiceStreamHandle,
@@ -328,6 +366,7 @@
aaudio_result_t AudioStreamInternal::unregisterThread() {
if (mServiceStreamHandle == AAUDIO_HANDLE_INVALID) {
+ ALOGE("unregisterThread() mServiceStreamHandle invalid");
return AAUDIO_ERROR_INVALID_STATE;
}
return mServiceInterface.unregisterAudioThread(mServiceStreamHandle, gettid());
@@ -338,6 +377,7 @@
if (mServiceStreamHandle == AAUDIO_HANDLE_INVALID) {
return AAUDIO_ERROR_INVALID_STATE;
}
+
return mServiceInterface.startClient(mServiceStreamHandle, client, clientHandle);
}
@@ -351,15 +391,20 @@
aaudio_result_t AudioStreamInternal::getTimestamp(clockid_t clockId,
int64_t *framePosition,
int64_t *timeNanoseconds) {
- // TODO Generate in server and pass to client. Return latest.
- int64_t time = AudioClock::getNanoseconds();
- *framePosition = mClockModel.convertTimeToPosition(time) + mFramesOffsetFromService;
- // TODO Get a more accurate timestamp from the service. This code just adds a fudge factor.
- *timeNanoseconds = time + (6 * AAUDIO_NANOS_PER_MILLISECOND);
- return AAUDIO_OK;
+ // Generated in server and passed to client. Return latest.
+ if (mAtomicTimestamp.isValid()) {
+ Timestamp timestamp = mAtomicTimestamp.read();
+ int64_t position = timestamp.getPosition() + mFramesOffsetFromService;
+ if (position >= 0) {
+ *framePosition = position;
+ *timeNanoseconds = timestamp.getNanoseconds();
+ return AAUDIO_OK;
+ }
+ }
+ return AAUDIO_ERROR_INVALID_STATE;
}
-aaudio_result_t AudioStreamInternal::updateStateWhileWaiting() {
+aaudio_result_t AudioStreamInternal::updateStateMachine() {
if (isDataCallbackActive()) {
return AAUDIO_OK; // state is getting updated by the callback thread read/write call
}
@@ -371,21 +416,21 @@
static int64_t oldTime = 0;
int64_t framePosition = command.timestamp.position;
int64_t nanoTime = command.timestamp.timestamp;
- ALOGD("AudioStreamInternal: timestamp says framePosition = %08lld at nanoTime %lld",
+ ALOGD("logTimestamp: timestamp says framePosition = %8lld at nanoTime %lld",
(long long) framePosition,
(long long) nanoTime);
int64_t nanosDelta = nanoTime - oldTime;
if (nanosDelta > 0 && oldTime > 0) {
int64_t framesDelta = framePosition - oldPosition;
int64_t rate = (framesDelta * AAUDIO_NANOS_PER_SECOND) / nanosDelta;
- ALOGD("AudioStreamInternal: framesDelta = %08lld, nanosDelta = %08lld, rate = %lld",
+ ALOGD("logTimestamp: framesDelta = %8lld, nanosDelta = %8lld, rate = %lld",
(long long) framesDelta, (long long) nanosDelta, (long long) rate);
}
oldPosition = framePosition;
oldTime = nanoTime;
}
-aaudio_result_t AudioStreamInternal::onTimestampFromServer(AAudioServiceMessage *message) {
+aaudio_result_t AudioStreamInternal::onTimestampService(AAudioServiceMessage *message) {
#if LOG_TIMESTAMPS
logTimestamp(*message);
#endif
@@ -393,23 +438,29 @@
return AAUDIO_OK;
}
+aaudio_result_t AudioStreamInternal::onTimestampHardware(AAudioServiceMessage *message) {
+ Timestamp timestamp(message->timestamp.position, message->timestamp.timestamp);
+ mAtomicTimestamp.write(timestamp);
+ return AAUDIO_OK;
+}
+
aaudio_result_t AudioStreamInternal::onEventFromServer(AAudioServiceMessage *message) {
aaudio_result_t result = AAUDIO_OK;
switch (message->event.event) {
case AAUDIO_SERVICE_EVENT_STARTED:
- ALOGD("AudioStreamInternal::onEventFromServergot() AAUDIO_SERVICE_EVENT_STARTED");
+ ALOGD("AudioStreamInternal::onEventFromServer() got AAUDIO_SERVICE_EVENT_STARTED");
if (getState() == AAUDIO_STREAM_STATE_STARTING) {
setState(AAUDIO_STREAM_STATE_STARTED);
}
break;
case AAUDIO_SERVICE_EVENT_PAUSED:
- ALOGD("AudioStreamInternal::onEventFromServergot() AAUDIO_SERVICE_EVENT_PAUSED");
+ ALOGD("AudioStreamInternal::onEventFromServer() got AAUDIO_SERVICE_EVENT_PAUSED");
if (getState() == AAUDIO_STREAM_STATE_PAUSING) {
setState(AAUDIO_STREAM_STATE_PAUSED);
}
break;
case AAUDIO_SERVICE_EVENT_STOPPED:
- ALOGD("AudioStreamInternal::onEventFromServergot() AAUDIO_SERVICE_EVENT_STOPPED");
+ ALOGD("AudioStreamInternal::onEventFromServer() got AAUDIO_SERVICE_EVENT_STOPPED");
if (getState() == AAUDIO_STREAM_STATE_STOPPING) {
setState(AAUDIO_STREAM_STATE_STOPPED);
}
@@ -426,10 +477,14 @@
setState(AAUDIO_STREAM_STATE_CLOSED);
break;
case AAUDIO_SERVICE_EVENT_DISCONNECTED:
+ // Prevent hardware from looping on old data and making buzzing sounds.
+ if (getDirection() == AAUDIO_DIRECTION_OUTPUT) {
+ mAudioEndpoint.eraseDataMemory();
+ }
result = AAUDIO_ERROR_DISCONNECTED;
setState(AAUDIO_STREAM_STATE_DISCONNECTED);
ALOGW("WARNING - AudioStreamInternal::onEventFromServer()"
- " AAUDIO_SERVICE_EVENT_DISCONNECTED");
+ " AAUDIO_SERVICE_EVENT_DISCONNECTED - FIFO cleared");
break;
case AAUDIO_SERVICE_EVENT_VOLUME:
mStreamVolume = (float)message->event.dataDouble;
@@ -445,6 +500,34 @@
return result;
}
+aaudio_result_t AudioStreamInternal::drainTimestampsFromService() {
+ aaudio_result_t result = AAUDIO_OK;
+
+ while (result == AAUDIO_OK) {
+ AAudioServiceMessage message;
+ if (mAudioEndpoint.readUpCommand(&message) != 1) {
+ break; // no command this time, no problem
+ }
+ switch (message.what) {
+ // ignore most messages
+ case AAudioServiceMessage::code::TIMESTAMP_SERVICE:
+ case AAudioServiceMessage::code::TIMESTAMP_HARDWARE:
+ break;
+
+ case AAudioServiceMessage::code::EVENT:
+ result = onEventFromServer(&message);
+ break;
+
+ default:
+ ALOGE("WARNING - drainTimestampsFromService() Unrecognized what = %d",
+ (int) message.what);
+ result = AAUDIO_ERROR_INTERNAL;
+ break;
+ }
+ }
+ return result;
+}
+
// Process all the commands coming from the server.
aaudio_result_t AudioStreamInternal::processCommands() {
aaudio_result_t result = AAUDIO_OK;
@@ -456,8 +539,12 @@
break; // no command this time, no problem
}
switch (message.what) {
- case AAudioServiceMessage::code::TIMESTAMP:
- result = onTimestampFromServer(&message);
+ case AAudioServiceMessage::code::TIMESTAMP_SERVICE:
+ result = onTimestampService(&message);
+ break;
+
+ case AAudioServiceMessage::code::TIMESTAMP_HARDWARE:
+ result = onTimestampHardware(&message);
break;
case AAudioServiceMessage::code::EVENT:
@@ -465,7 +552,7 @@
break;
default:
- ALOGE("WARNING - AudioStreamInternal::processCommands() Unrecognized what = %d",
+ ALOGE("WARNING - processCommands() Unrecognized what = %d",
(int) message.what);
result = AAUDIO_ERROR_INTERNAL;
break;
@@ -517,12 +604,19 @@
wakeTimeNanos += mWakeupDelayNanos;
}
+ currentTimeNanos = AudioClock::getNanoseconds();
+ int64_t earliestWakeTime = currentTimeNanos + mMinimumSleepNanos;
+ // Guarantee a minimum sleep time.
+ if (wakeTimeNanos < earliestWakeTime) {
+ wakeTimeNanos = earliestWakeTime;
+ }
+
if (wakeTimeNanos > deadlineNanos) {
// If we time out, just return the framesWritten so far.
// TODO remove after we fix the deadline bug
ALOGW("AudioStreamInternal::processData(): entered at %lld nanos, currently %lld",
(long long) entryTimeNanos, (long long) currentTimeNanos);
- ALOGW("AudioStreamInternal::processData(): timed out after %lld nanos",
+ ALOGW("AudioStreamInternal::processData(): TIMEOUT after %lld nanos",
(long long) timeoutNanoseconds);
ALOGW("AudioStreamInternal::processData(): wakeTime = %lld, deadline = %lld nanos",
(long long) wakeTimeNanos, (long long) deadlineNanos);
@@ -533,13 +627,6 @@
break;
}
- currentTimeNanos = AudioClock::getNanoseconds();
- int64_t earliestWakeTime = currentTimeNanos + mMinimumSleepNanos;
- // Guarantee a minimum sleep time.
- if (wakeTimeNanos < earliestWakeTime) {
- wakeTimeNanos = earliestWakeTime;
- }
-
if (ATRACE_ENABLED()) {
int32_t fullFrames = mAudioEndpoint.getFullFramesAvailable();
ATRACE_INT(fifoName, fullFrames);
@@ -576,7 +663,7 @@
}
aaudio_result_t result = mAudioEndpoint.setBufferSizeInFrames(requestedFrames, &actualFrames);
- ALOGD("AudioStreamInternal::setBufferSize() req = %d => %d", requestedFrames, actualFrames);
+ ALOGD("setBufferSize() req = %d => %d", requestedFrames, actualFrames);
if (result < 0) {
return result;
} else {
@@ -599,32 +686,3 @@
aaudio_result_t AudioStreamInternal::joinThread(void** returnArg) {
return AudioStream::joinThread(returnArg, calculateReasonableTimeout(getFramesPerBurst()));
}
-
-void AudioStreamInternal::doSetVolume() {
- // No pan and only left volume is taken into account from IPLayer interface
- mVolumeRamp.setTarget(mStreamVolume * mVolumeMultiplierL /* * mPanMultiplierL */);
-}
-
-
-//------------------------------------------------------------------------------
-// Implementation of PlayerBase
-status_t AudioStreamInternal::playerStart() {
- return AAudioConvert_aaudioToAndroidStatus(mServiceInterface.startStream(mServiceStreamHandle));
-}
-
-status_t AudioStreamInternal::playerPause() {
- return AAudioConvert_aaudioToAndroidStatus(mServiceInterface.pauseStream(mServiceStreamHandle));
-}
-
-status_t AudioStreamInternal::playerStop() {
- return AAudioConvert_aaudioToAndroidStatus(mServiceInterface.stopStream(mServiceStreamHandle));
-}
-
-status_t AudioStreamInternal::playerSetVolume() {
- doSetVolume();
- return NO_ERROR;
-}
-
-void AudioStreamInternal::destroy() {
- baseDestroy();
-}
diff --git a/media/libaaudio/src/client/AudioStreamInternal.h b/media/libaaudio/src/client/AudioStreamInternal.h
index 1b991de..47024c0 100644
--- a/media/libaaudio/src/client/AudioStreamInternal.h
+++ b/media/libaaudio/src/client/AudioStreamInternal.h
@@ -18,7 +18,6 @@
#define ANDROID_AAUDIO_AUDIO_STREAM_INTERNAL_H
#include <stdint.h>
-#include <media/PlayerBase.h>
#include <aaudio/AAudio.h>
#include "binding/IAAudioService.h"
@@ -36,7 +35,7 @@
namespace aaudio {
// A stream that talks to the AAudioService or directly to a HAL.
-class AudioStreamInternal : public AudioStream, public android::PlayerBase {
+class AudioStreamInternal : public AudioStream {
public:
AudioStreamInternal(AAudioServiceInterface &serviceInterface, bool inService);
@@ -50,7 +49,7 @@
int64_t *framePosition,
int64_t *timeNanoseconds) override;
- virtual aaudio_result_t updateStateWhileWaiting() override;
+ virtual aaudio_result_t updateStateMachine() override;
aaudio_result_t open(const AudioStreamBuilder &builder) override;
@@ -85,14 +84,15 @@
// Calculate timeout based on framesPerBurst
int64_t calculateReasonableTimeout();
- //PlayerBase virtuals
- virtual void destroy();
-
aaudio_result_t startClient(const android::AudioClient& client,
audio_port_handle_t *clientHandle);
aaudio_result_t stopClient(audio_port_handle_t clientHandle);
+ aaudio_handle_t getServiceHandle() const {
+ return mServiceStreamHandle;
+ }
+
protected:
aaudio_result_t processData(void *buffer,
@@ -111,32 +111,29 @@
int64_t currentTimeNanos,
int64_t *wakeTimePtr) = 0;
+ aaudio_result_t drainTimestampsFromService();
+
aaudio_result_t processCommands();
aaudio_result_t requestStopInternal();
aaudio_result_t stopCallback();
+ virtual void advanceClientToMatchServerPosition() = 0;
virtual void onFlushFromServer() {}
aaudio_result_t onEventFromServer(AAudioServiceMessage *message);
- aaudio_result_t onTimestampFromServer(AAudioServiceMessage *message);
+ aaudio_result_t onTimestampService(AAudioServiceMessage *message);
+
+ aaudio_result_t onTimestampHardware(AAudioServiceMessage *message);
void logTimestamp(AAudioServiceMessage &message);
// Calculate timeout for an operation involving framesPerOperation.
int64_t calculateReasonableTimeout(int32_t framesPerOperation);
- void doSetVolume();
-
- //PlayerBase virtuals
- virtual status_t playerStart();
- virtual status_t playerPause();
- virtual status_t playerStop();
- virtual status_t playerSetVolume();
-
aaudio_format_t mDeviceFormat = AAUDIO_FORMAT_UNSPECIFIED;
IsochronousClockModel mClockModel; // timing model for chasing the HAL
@@ -147,9 +144,6 @@
int32_t mFramesPerBurst; // frames per HAL transfer
int32_t mXRunCount = 0; // how many underrun events?
- LinearRamp mVolumeRamp;
- float mStreamVolume;
-
// Offset from underlying frame position.
int64_t mFramesOffsetFromService = 0; // offset for timestamps
@@ -161,6 +155,12 @@
AAudioServiceInterface &mServiceInterface; // abstract interface to the service
+ SimpleDoubleBuffer<Timestamp> mAtomicTimestamp;
+
+ AtomicRequestor mNeedCatchUp; // Ask read() or write() to sync on first timestamp.
+
+ float mStreamVolume = 1.0f;
+
private:
/*
* Asynchronous write with data conversion.
@@ -181,6 +181,8 @@
AudioEndpointParcelable mEndPointParcelable; // description of the buffers filled by service
EndpointDescriptor mEndpointDescriptor; // buffer description with resolved addresses
+
+ int64_t mServiceLatencyNanos = 0;
};
} /* namespace aaudio */
diff --git a/media/libaaudio/src/client/AudioStreamInternalCapture.cpp b/media/libaaudio/src/client/AudioStreamInternalCapture.cpp
index 7b1e53e..b792ecd 100644
--- a/media/libaaudio/src/client/AudioStreamInternalCapture.cpp
+++ b/media/libaaudio/src/client/AudioStreamInternalCapture.cpp
@@ -39,6 +39,21 @@
AudioStreamInternalCapture::~AudioStreamInternalCapture() {}
+void AudioStreamInternalCapture::advanceClientToMatchServerPosition() {
+ int64_t readCounter = mAudioEndpoint.getDataReadCounter();
+ int64_t writeCounter = mAudioEndpoint.getDataWriteCounter();
+
+ // Bump offset so caller does not see the retrograde motion in getFramesRead().
+ int64_t offset = readCounter - writeCounter;
+ mFramesOffsetFromService += offset;
+ ALOGD("advanceClientToMatchServerPosition() readN = %lld, writeN = %lld, offset = %lld",
+ (long long)readCounter, (long long)writeCounter, (long long)mFramesOffsetFromService);
+
+ // Force readCounter to match writeCounter.
+ // This is because we cannot change the write counter in the hardware.
+ mAudioEndpoint.setDataReadCounter(writeCounter);
+}
+
// Write the data, block if needed and timeoutMillis > 0
aaudio_result_t AudioStreamInternalCapture::read(void *buffer, int32_t numFrames,
int64_t timeoutNanoseconds)
@@ -57,6 +72,18 @@
const char *traceName = "aaRdNow";
ATRACE_BEGIN(traceName);
+ if (mClockModel.isStarting()) {
+ // Still haven't got any timestamps from server.
+ // Keep waiting until we get some valid timestamps then start writing to the
+ // current buffer position.
+ ALOGD("processDataNow() wait for valid timestamps");
+ // Sleep very briefly and hope we get a timestamp soon.
+ *wakeTimePtr = currentNanoTime + (2000 * AAUDIO_NANOS_PER_MICROSECOND);
+ ATRACE_END();
+ return 0;
+ }
+ // If we have gotten this far then we have at least one timestamp from server.
+
if (mAudioEndpoint.isFreeRunning()) {
//ALOGD("AudioStreamInternalCapture::processDataNow() - update remote counter");
// Update data queue based on the timing model.
@@ -65,6 +92,14 @@
mAudioEndpoint.setDataWriteCounter(estimatedRemoteCounter);
}
+ // This code assumes that we have already received valid timestamps.
+ if (mNeedCatchUp.isRequested()) {
+ // Catch an MMAP pointer that is already advancing.
+ // This will avoid initial underruns caused by a slow cold start.
+ advanceClientToMatchServerPosition();
+ mNeedCatchUp.acknowledge();
+ }
+
// If the write index passed the read index then consider it an overrun.
if (mAudioEndpoint.getEmptyFramesAvailable() < 0) {
mXRunCount++;
@@ -100,8 +135,8 @@
// Calculate frame position based off of the readCounter because
// the writeCounter might have just advanced in the background,
// causing us to sleep until a later burst.
- int64_t nextReadPosition = mAudioEndpoint.getDataReadCounter() + mFramesPerBurst;
- wakeTime = mClockModel.convertPositionToTime(nextReadPosition);
+ int64_t nextPosition = mAudioEndpoint.getDataReadCounter() + mFramesPerBurst;
+ wakeTime = mClockModel.convertPositionToTime(nextPosition);
}
break;
default:
@@ -186,8 +221,7 @@
}
int64_t AudioStreamInternalCapture::getFramesRead() {
- int64_t frames = mAudioEndpoint.getDataWriteCounter()
- + mFramesOffsetFromService;
+ int64_t frames = mAudioEndpoint.getDataReadCounter() + mFramesOffsetFromService;
//ALOGD("AudioStreamInternalCapture::getFramesRead() returns %lld", (long long)frames);
return frames;
}
diff --git a/media/libaaudio/src/client/AudioStreamInternalCapture.h b/media/libaaudio/src/client/AudioStreamInternalCapture.h
index 17f37e8..294dbaf 100644
--- a/media/libaaudio/src/client/AudioStreamInternalCapture.h
+++ b/media/libaaudio/src/client/AudioStreamInternalCapture.h
@@ -46,6 +46,8 @@
}
protected:
+ void advanceClientToMatchServerPosition() override;
+
/**
* Low level data processing that will not block. It will just read or write as much as it can.
*
diff --git a/media/libaaudio/src/client/AudioStreamInternalPlay.cpp b/media/libaaudio/src/client/AudioStreamInternalPlay.cpp
index 31e0a40..1e02eee 100644
--- a/media/libaaudio/src/client/AudioStreamInternalPlay.cpp
+++ b/media/libaaudio/src/client/AudioStreamInternalPlay.cpp
@@ -48,7 +48,8 @@
mClockModel.stop(AudioClock::getNanoseconds());
setState(AAUDIO_STREAM_STATE_PAUSING);
- return AAudioConvert_androidToAAudioResult(pauseWithStatus());
+ mAtomicTimestamp.clear();
+ return mServiceInterface.pauseStream(mServiceStreamHandle);
}
aaudio_result_t AudioStreamInternalPlay::requestPause()
@@ -72,21 +73,25 @@
return mServiceInterface.flushStream(mServiceStreamHandle);
}
-void AudioStreamInternalPlay::onFlushFromServer() {
+void AudioStreamInternalPlay::advanceClientToMatchServerPosition() {
int64_t readCounter = mAudioEndpoint.getDataReadCounter();
int64_t writeCounter = mAudioEndpoint.getDataWriteCounter();
// Bump offset so caller does not see the retrograde motion in getFramesRead().
- int64_t framesFlushed = writeCounter - readCounter;
- mFramesOffsetFromService += framesFlushed;
- ALOGD("AudioStreamInternal::onFlushFromServer() readN = %lld, writeN = %lld, offset = %lld",
+ int64_t offset = writeCounter - readCounter;
+ mFramesOffsetFromService += offset;
+ ALOGD("advanceClientToMatchServerPosition() readN = %lld, writeN = %lld, offset = %lld",
(long long)readCounter, (long long)writeCounter, (long long)mFramesOffsetFromService);
- // Flush written frames by forcing writeCounter to readCounter.
- // This is because we cannot move the read counter in the hardware.
+ // Force writeCounter to match readCounter.
+ // This is because we cannot change the read counter in the hardware.
mAudioEndpoint.setDataWriteCounter(readCounter);
}
+void AudioStreamInternalPlay::onFlushFromServer() {
+ advanceClientToMatchServerPosition();
+}
+
// Write the data, block if needed and timeoutMillis > 0
aaudio_result_t AudioStreamInternalPlay::write(const void *buffer, int32_t numFrames,
int64_t timeoutNanoseconds)
@@ -106,6 +111,18 @@
const char *traceName = "aaWrNow";
ATRACE_BEGIN(traceName);
+ if (mClockModel.isStarting()) {
+ // Still haven't got any timestamps from server.
+ // Keep waiting until we get some valid timestamps then start writing to the
+ // current buffer position.
+ ALOGD("processDataNow() wait for valid timestamps");
+ // Sleep very briefly and hope we get a timestamp soon.
+ *wakeTimePtr = currentNanoTime + (2000 * AAUDIO_NANOS_PER_MICROSECOND);
+ ATRACE_END();
+ return 0;
+ }
+ // If we have gotten this far then we have at least one timestamp from server.
+
// If a DMA channel or DSP is reading the other end then we have to update the readCounter.
if (mAudioEndpoint.isFreeRunning()) {
// Update data queue based on the timing model.
@@ -114,6 +131,13 @@
mAudioEndpoint.setDataReadCounter(estimatedReadCounter);
}
+ if (mNeedCatchUp.isRequested()) {
+ // Catch an MMAP pointer that is already advancing.
+ // This will avoid initial underruns caused by a slow cold start.
+ advanceClientToMatchServerPosition();
+ mNeedCatchUp.acknowledge();
+ }
+
// If the read index passed the write index then consider it an underrun.
if (mAudioEndpoint.getFullFramesAvailable() < 0) {
mXRunCount++;
@@ -153,9 +177,9 @@
// Calculate frame position based off of the writeCounter because
// the readCounter might have just advanced in the background,
// causing us to sleep until a later burst.
- int64_t nextReadPosition = mAudioEndpoint.getDataWriteCounter() + mFramesPerBurst
+ int64_t nextPosition = mAudioEndpoint.getDataWriteCounter() + mFramesPerBurst
- mAudioEndpoint.getBufferSizeInFrames();
- wakeTime = mClockModel.convertPositionToTime(nextReadPosition);
+ wakeTime = mClockModel.convertPositionToTime(nextPosition);
}
break;
default:
@@ -266,7 +290,6 @@
return framesWritten;
}
-
int64_t AudioStreamInternalPlay::getFramesRead()
{
int64_t framesReadHardware;
@@ -340,3 +363,10 @@
result, (int) isActive());
return NULL;
}
+
+//------------------------------------------------------------------------------
+// Implementation of PlayerBase
+status_t AudioStreamInternalPlay::doSetVolume() {
+ mVolumeRamp.setTarget(mStreamVolume * getDuckAndMuteVolume());
+ return android::NO_ERROR;
+}
diff --git a/media/libaaudio/src/client/AudioStreamInternalPlay.h b/media/libaaudio/src/client/AudioStreamInternalPlay.h
index e59d02c..d5c1b1e 100644
--- a/media/libaaudio/src/client/AudioStreamInternalPlay.h
+++ b/media/libaaudio/src/client/AudioStreamInternalPlay.h
@@ -54,8 +54,12 @@
aaudio_result_t requestPauseInternal();
+ void advanceClientToMatchServerPosition() override;
+
void onFlushFromServer() override;
+ android::status_t doSetVolume() override;
+
/**
* Low level write that will not block. It will just write as much as it can.
*
@@ -78,6 +82,9 @@
int32_t numFrames);
int64_t mLastFramesRead = 0; // used to prevent retrograde motion
+
+ LinearRamp mVolumeRamp;
+
};
} /* namespace aaudio */
diff --git a/media/libaaudio/src/client/IsochronousClockModel.cpp b/media/libaaudio/src/client/IsochronousClockModel.cpp
index c06c8a9..bac69f1 100644
--- a/media/libaaudio/src/client/IsochronousClockModel.cpp
+++ b/media/libaaudio/src/client/IsochronousClockModel.cpp
@@ -48,19 +48,26 @@
}
void IsochronousClockModel::start(int64_t nanoTime) {
- ALOGD("IsochronousClockModel::start(nanos = %lld)\n", (long long) nanoTime);
+ ALOGV("IsochronousClockModel::start(nanos = %lld)\n", (long long) nanoTime);
mMarkerNanoTime = nanoTime;
mState = STATE_STARTING;
}
void IsochronousClockModel::stop(int64_t nanoTime) {
- ALOGD("IsochronousClockModel::stop(nanos = %lld)\n", (long long) nanoTime);
+ ALOGV("IsochronousClockModel::stop(nanos = %lld)\n", (long long) nanoTime);
setPositionAndTime(convertTimeToPosition(nanoTime), nanoTime);
// TODO should we set position?
mState = STATE_STOPPED;
}
+bool IsochronousClockModel::isStarting() {
+ return mState == STATE_STARTING;
+}
+
void IsochronousClockModel::processTimestamp(int64_t framePosition, int64_t nanoTime) {
+// ALOGD("processTimestamp() - framePosition = %lld at nanoTime %llu",
+// (long long)framePosition,
+// (long long)nanoTime);
int64_t framesDelta = framePosition - mMarkerFramePosition;
int64_t nanosDelta = nanoTime - mMarkerNanoTime;
if (nanosDelta < 1000) {
@@ -70,9 +77,6 @@
// ALOGD("processTimestamp() - mMarkerFramePosition = %lld at mMarkerNanoTime %llu",
// (long long)mMarkerFramePosition,
// (long long)mMarkerNanoTime);
-// ALOGD("processTimestamp() - framePosition = %lld at nanoTime %llu",
-// (long long)framePosition,
-// (long long)nanoTime);
int64_t expectedNanosDelta = convertDeltaPositionToTime(framesDelta);
// ALOGD("processTimestamp() - expectedNanosDelta = %lld, nanosDelta = %llu",
@@ -116,6 +120,8 @@
default:
break;
}
+
+// ALOGD("processTimestamp() - mState = %d", mState);
}
void IsochronousClockModel::setSampleRate(int32_t sampleRate) {
diff --git a/media/libaaudio/src/client/IsochronousClockModel.h b/media/libaaudio/src/client/IsochronousClockModel.h
index 585f53a..7182376 100644
--- a/media/libaaudio/src/client/IsochronousClockModel.h
+++ b/media/libaaudio/src/client/IsochronousClockModel.h
@@ -36,6 +36,8 @@
void start(int64_t nanoTime);
void stop(int64_t nanoTime);
+ bool isStarting();
+
void processTimestamp(int64_t framePosition, int64_t nanoTime);
/**
diff --git a/media/libaaudio/src/core/AAudioAudio.cpp b/media/libaaudio/src/core/AAudioAudio.cpp
index 3f5de77..1eaee81 100644
--- a/media/libaaudio/src/core/AAudioAudio.cpp
+++ b/media/libaaudio/src/core/AAudioAudio.cpp
@@ -24,15 +24,14 @@
#include <aaudio/AAudio.h>
#include <aaudio/AAudioTesting.h>
+#include "AudioClock.h"
#include "AudioStreamBuilder.h"
#include "AudioStream.h"
-#include "AudioClock.h"
+#include "binding/AAudioCommon.h"
#include "client/AudioStreamInternal.h"
-#include "HandleTracker.h"
using namespace aaudio;
-
// Macros for common code that includes a return.
// TODO Consider using do{}while(0) construct. I tried but it hung AndroidStudio
#define CONVERT_BUILDER_HANDLE_OR_RETURN() \
@@ -101,7 +100,6 @@
*/
static aaudio_policy_t s_MMapPolicy = AAUDIO_UNSPECIFIED;
-
static AudioStream *convertAAudioStreamToAudioStream(AAudioStream* stream)
{
return (AudioStream*) stream;
@@ -144,17 +142,16 @@
}
AAUDIO_API void AAudioStreamBuilder_setChannelCount(AAudioStreamBuilder* builder,
- int32_t channelCount)
+ int32_t channelCount)
{
AudioStreamBuilder *streamBuilder = convertAAudioBuilderToStreamBuilder(builder);
streamBuilder->setSamplesPerFrame(channelCount);
}
AAUDIO_API void AAudioStreamBuilder_setSamplesPerFrame(AAudioStreamBuilder* builder,
- int32_t samplesPerFrame)
+ int32_t channelCount)
{
- AudioStreamBuilder *streamBuilder = convertAAudioBuilderToStreamBuilder(builder);
- streamBuilder->setSamplesPerFrame(samplesPerFrame);
+ AAudioStreamBuilder_setChannelCount(builder, channelCount);
}
AAUDIO_API void AAudioStreamBuilder_setDirection(AAudioStreamBuilder* builder,
@@ -221,6 +218,7 @@
ALOGD("AAudioStreamBuilder_openStream() returns %d = %s for (%p) ----------------",
result, AAudio_convertResultToText(result), audioStream);
if (result == AAUDIO_OK) {
+ audioStream->registerPlayerBase();
*streamPtr = (AAudioStream*) audioStream;
} else {
*streamPtr = nullptr;
@@ -244,6 +242,7 @@
ALOGD("AAudioStream_close(%p)", stream);
if (audioStream != nullptr) {
audioStream->close();
+ audioStream->unregisterPlayerBase();
delete audioStream;
return AAUDIO_OK;
}
@@ -254,8 +253,8 @@
{
AudioStream *audioStream = convertAAudioStreamToAudioStream(stream);
ALOGD("AAudioStream_requestStart(%p) called --------------", stream);
- aaudio_result_t result = audioStream->requestStart();
- ALOGD("AAudioStream_requestStart(%p) returned ------------", stream);
+ aaudio_result_t result = audioStream->systemStart();
+ ALOGD("AAudioStream_requestStart(%p) returned %d ---------", stream, result);
return result;
}
@@ -263,7 +262,7 @@
{
AudioStream *audioStream = convertAAudioStreamToAudioStream(stream);
ALOGD("AAudioStream_requestPause(%p)", stream);
- return audioStream->requestPause();
+ return audioStream->systemPause();
}
AAUDIO_API aaudio_result_t AAudioStream_requestFlush(AAudioStream* stream)
@@ -277,7 +276,7 @@
{
AudioStream *audioStream = convertAAudioStreamToAudioStream(stream);
ALOGD("AAudioStream_requestStop(%p)", stream);
- return audioStream->requestStop();
+ return audioStream->systemStop();
}
AAUDIO_API aaudio_result_t AAudioStream_waitForStateChange(AAudioStream* stream,
@@ -359,8 +358,7 @@
AAUDIO_API int32_t AAudioStream_getSamplesPerFrame(AAudioStream* stream)
{
- AudioStream *audioStream = convertAAudioStreamToAudioStream(stream);
- return audioStream->getSamplesPerFrame();
+ return AAudioStream_getChannelCount(stream);
}
AAUDIO_API aaudio_stream_state_t AAudioStream_getState(AAudioStream* stream)
diff --git a/media/libaaudio/src/core/AAudioStreamParameters.cpp b/media/libaaudio/src/core/AAudioStreamParameters.cpp
index 65c2b46..82445e7 100644
--- a/media/libaaudio/src/core/AAudioStreamParameters.cpp
+++ b/media/libaaudio/src/core/AAudioStreamParameters.cpp
@@ -34,6 +34,16 @@
AAudioStreamParameters::AAudioStreamParameters() {}
AAudioStreamParameters::~AAudioStreamParameters() {}
+void AAudioStreamParameters::copyFrom(const AAudioStreamParameters &other) {
+ mSamplesPerFrame = other.mSamplesPerFrame;
+ mSampleRate = other.mSampleRate;
+ mDeviceId = other.mDeviceId;
+ mSharingMode = other.mSharingMode;
+ mAudioFormat = other.mAudioFormat;
+ mDirection = other.mDirection;
+ mBufferCapacity = other.mBufferCapacity;
+}
+
aaudio_result_t AAudioStreamParameters::validate() const {
if (mSamplesPerFrame != AAUDIO_UNSPECIFIED
&& (mSamplesPerFrame < SAMPLES_PER_FRAME_MIN || mSamplesPerFrame > SAMPLES_PER_FRAME_MAX)) {
@@ -78,6 +88,16 @@
return AAUDIO_ERROR_OUT_OF_RANGE;
}
+ switch (mDirection) {
+ case AAUDIO_DIRECTION_INPUT:
+ case AAUDIO_DIRECTION_OUTPUT:
+ break; // valid
+ default:
+ ALOGE("AAudioStreamParameters: direction not valid = %d", mDirection);
+ return AAUDIO_ERROR_ILLEGAL_ARGUMENT;
+ // break;
+ }
+
return AAUDIO_OK;
}
@@ -87,5 +107,7 @@
ALOGD("AAudioStreamParameters mSamplesPerFrame = %d", mSamplesPerFrame);
ALOGD("AAudioStreamParameters mSharingMode = %d", (int)mSharingMode);
ALOGD("AAudioStreamParameters mAudioFormat = %d", (int)mAudioFormat);
+ ALOGD("AAudioStreamParameters mDirection = %d", mDirection);
ALOGD("AAudioStreamParameters mBufferCapacity = %d", mBufferCapacity);
-}
\ No newline at end of file
+}
+
diff --git a/media/libaaudio/src/core/AAudioStreamParameters.h b/media/libaaudio/src/core/AAudioStreamParameters.h
index 97379cc..5e67c93 100644
--- a/media/libaaudio/src/core/AAudioStreamParameters.h
+++ b/media/libaaudio/src/core/AAudioStreamParameters.h
@@ -20,6 +20,7 @@
#include <stdint.h>
#include <aaudio/AAudio.h>
+#include <utility/AAudioUtilities.h>
namespace aaudio {
@@ -79,6 +80,24 @@
mBufferCapacity = frames;
}
+ aaudio_direction_t getDirection() const {
+ return mDirection;
+ }
+
+ void setDirection(aaudio_direction_t direction) {
+ mDirection = direction;
+ }
+
+ int32_t calculateBytesPerFrame() const {
+ return getSamplesPerFrame() * AAudioConvert_formatToSizeInBytes(getFormat());
+ }
+
+ /**
+ * Copy variables defined in other AAudioStreamParameters instance to this one.
+ * @param other
+ */
+ void copyFrom(const AAudioStreamParameters &other);
+
virtual aaudio_result_t validate() const;
void dump() const;
@@ -89,9 +108,10 @@
int32_t mDeviceId = AAUDIO_UNSPECIFIED;
aaudio_sharing_mode_t mSharingMode = AAUDIO_SHARING_MODE_SHARED;
aaudio_format_t mAudioFormat = AAUDIO_FORMAT_UNSPECIFIED;
+ aaudio_direction_t mDirection = AAUDIO_DIRECTION_OUTPUT;
int32_t mBufferCapacity = AAUDIO_UNSPECIFIED;
};
} /* namespace aaudio */
-#endif //AAUDIO_STREAM_PARAMETERS_H
\ No newline at end of file
+#endif //AAUDIO_STREAM_PARAMETERS_H
diff --git a/media/libaaudio/src/core/AudioStream.cpp b/media/libaaudio/src/core/AudioStream.cpp
index 4859c69..8dcc37a 100644
--- a/media/libaaudio/src/core/AudioStream.cpp
+++ b/media/libaaudio/src/core/AudioStream.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define LOG_TAG "AAudio"
+#define LOG_TAG "AAudioStream"
//#define LOG_NDEBUG 0
#include <utils/Log.h>
@@ -29,13 +29,26 @@
using namespace aaudio;
AudioStream::AudioStream()
- : mCallbackEnabled(false)
+ : mPlayerBase(new MyPlayerBase(this))
{
// mThread is a pthread_t of unknown size so we need memset.
memset(&mThread, 0, sizeof(mThread));
setPeriodNanoseconds(0);
}
+AudioStream::~AudioStream() {
+ ALOGD("destroying %p, state = %s", this, AAudio_convertStreamStateToText(getState()));
+ // If the stream is deleted when OPEN or in use then audio resources will leak.
+ // This would indicate an internal error. So we want to find this ASAP.
+ LOG_ALWAYS_FATAL_IF(!(getState() == AAUDIO_STREAM_STATE_CLOSED
+ || getState() == AAUDIO_STREAM_STATE_UNINITIALIZED
+ || getState() == AAUDIO_STREAM_STATE_DISCONNECTED),
+ "aaudio stream still in use, state = %s",
+ AAudio_convertStreamStateToText(getState()));
+
+ mPlayerBase->clearParentReference(); // remove reference to this AudioStream
+}
+
static const char *AudioStream_convertSharingModeToShortText(aaudio_sharing_mode_t sharingMode) {
const char *result;
switch (sharingMode) {
@@ -90,15 +103,12 @@
return AAUDIO_OK;
}
-AudioStream::~AudioStream() {
- close();
-}
aaudio_result_t AudioStream::waitForStateChange(aaudio_stream_state_t currentState,
aaudio_stream_state_t *nextState,
int64_t timeoutNanoseconds)
{
- aaudio_result_t result = updateStateWhileWaiting();
+ aaudio_result_t result = updateStateMachine();
if (result != AAUDIO_OK) {
return result;
}
@@ -112,7 +122,7 @@
AudioClock::sleepForNanos(durationNanos);
timeoutNanoseconds -= durationNanos;
- aaudio_result_t result = updateStateWhileWaiting();
+ aaudio_result_t result = updateStateMachine();
if (result != AAUDIO_OK) {
return result;
}
@@ -153,6 +163,7 @@
void* threadArg)
{
if (mHasThread) {
+ ALOGE("AudioStream::createThread() - mHasThread already true");
return AAUDIO_ERROR_INVALID_STATE;
}
if (threadProc == nullptr) {
@@ -174,6 +185,7 @@
aaudio_result_t AudioStream::joinThread(void** returnArg, int64_t timeoutNanoseconds)
{
if (!mHasThread) {
+ ALOGE("AudioStream::joinThread() - but has no thread");
return AAUDIO_ERROR_INVALID_STATE;
}
#if 0
@@ -187,3 +199,38 @@
return err ? AAudioConvert_androidToAAudioResult(-errno) : mThreadRegistrationResult;
}
+
+#if AAUDIO_USE_VOLUME_SHAPER
+android::media::VolumeShaper::Status AudioStream::applyVolumeShaper(
+ const android::media::VolumeShaper::Configuration& configuration __unused,
+ const android::media::VolumeShaper::Operation& operation __unused) {
+ ALOGW("applyVolumeShaper() is not supported");
+ return android::media::VolumeShaper::Status::ok();
+}
+#endif
+
+AudioStream::MyPlayerBase::MyPlayerBase(AudioStream *parent) : mParent(parent) {
+}
+
+AudioStream::MyPlayerBase::~MyPlayerBase() {
+ ALOGV("MyPlayerBase::~MyPlayerBase(%p) deleted", this);
+}
+
+void AudioStream::MyPlayerBase::registerWithAudioManager() {
+ if (!mRegistered) {
+ init(android::PLAYER_TYPE_AAUDIO, AUDIO_USAGE_MEDIA);
+ mRegistered = true;
+ }
+}
+
+void AudioStream::MyPlayerBase::unregisterWithAudioManager() {
+ if (mRegistered) {
+ baseDestroy();
+ mRegistered = false;
+ }
+}
+
+
+void AudioStream::MyPlayerBase::destroy() {
+ unregisterWithAudioManager();
+}
diff --git a/media/libaaudio/src/core/AudioStream.h b/media/libaaudio/src/core/AudioStream.h
index e5fdcc6..34202d2 100644
--- a/media/libaaudio/src/core/AudioStream.h
+++ b/media/libaaudio/src/core/AudioStream.h
@@ -21,10 +21,18 @@
#include <mutex>
#include <stdint.h>
#include <aaudio/AAudio.h>
+#include <binder/IServiceManager.h>
+#include <binder/Status.h>
+#include <utils/StrongPointer.h>
+#include "media/VolumeShaper.h"
+#include "media/PlayerBase.h"
#include "utility/AAudioUtilities.h"
#include "utility/MonotonicCounter.h"
+// Cannot get android::media::VolumeShaper to compile!
+#define AAUDIO_USE_VOLUME_SHAPER 0
+
namespace aaudio {
typedef void *(*aaudio_audio_thread_proc_t)(void *);
@@ -68,10 +76,10 @@
/**
- * Update state while in the middle of waitForStateChange()
+ * Update state machine.()
* @return
*/
- virtual aaudio_result_t updateStateWhileWaiting() = 0;
+ virtual aaudio_result_t updateStateMachine() = 0;
// =========== End ABSTRACT methods ===========================
@@ -234,8 +242,132 @@
return AAUDIO_ERROR_UNIMPLEMENTED;
}
+ // This is used by the AudioManager to duck and mute the stream when changing audio focus.
+ void setDuckAndMuteVolume(float duckAndMuteVolume) {
+ mDuckAndMuteVolume = duckAndMuteVolume;
+ doSetVolume(); // apply this change
+ }
+
+ float getDuckAndMuteVolume() {
+ return mDuckAndMuteVolume;
+ }
+
+ // Implement this in the output subclasses.
+ virtual android::status_t doSetVolume() { return android::NO_ERROR; }
+
+#if AAUDIO_USE_VOLUME_SHAPER
+ virtual ::android::binder::Status applyVolumeShaper(
+ const ::android::media::VolumeShaper::Configuration& configuration __unused,
+ const ::android::media::VolumeShaper::Operation& operation __unused);
+#endif
+
+ /**
+ * Register this stream's PlayerBase with the AudioManager if needed.
+ * Only register output streams.
+ * This should only be called for client streams and not for streams
+ * that run in the service.
+ */
+ void registerPlayerBase() {
+ if (getDirection() == AAUDIO_DIRECTION_OUTPUT) {
+ mPlayerBase->registerWithAudioManager();
+ }
+ }
+
+ /**
+ * Unregister this stream's PlayerBase with the AudioManager.
+ * This will only unregister if already registered.
+ */
+ void unregisterPlayerBase() {
+ mPlayerBase->unregisterWithAudioManager();
+ }
+
+ // Pass start request through PlayerBase for tracking.
+ aaudio_result_t systemStart() {
+ mPlayerBase->start();
+ // Pass aaudio_result_t around the PlayerBase interface, which uses status__t.
+ return mPlayerBase->getResult();
+ }
+
+ aaudio_result_t systemPause() {
+ mPlayerBase->pause();
+ return mPlayerBase->getResult();
+ }
+
+ aaudio_result_t systemStop() {
+ mPlayerBase->stop();
+ return mPlayerBase->getResult();
+ }
+
protected:
+ // PlayerBase allows the system to control the stream.
+ // Calling through PlayerBase->start() notifies the AudioManager of the player state.
+ // The AudioManager also can start/stop a stream by calling mPlayerBase->playerStart().
+ // systemStart() ==> mPlayerBase->start() mPlayerBase->playerStart() ==> requestStart()
+ // \ /
+ // ------ AudioManager -------
+ class MyPlayerBase : public android::PlayerBase {
+ public:
+ explicit MyPlayerBase(AudioStream *parent);
+
+ virtual ~MyPlayerBase();
+
+ /**
+ * Register for volume changes and remote control.
+ */
+ void registerWithAudioManager();
+
+ /**
+ * UnRegister.
+ */
+ void unregisterWithAudioManager();
+
+ /**
+ * Just calls unregisterWithAudioManager().
+ */
+ void destroy() override;
+
+ void clearParentReference() { mParent = nullptr; }
+
+ android::status_t playerStart() override {
+ // mParent should NOT be null. So go ahead and crash if it is.
+ mResult = mParent->requestStart();
+ return AAudioConvert_aaudioToAndroidStatus(mResult);
+ }
+
+ android::status_t playerPause() override {
+ mResult = mParent->requestPause();
+ return AAudioConvert_aaudioToAndroidStatus(mResult);
+ }
+
+ android::status_t playerStop() override {
+ mResult = mParent->requestStop();
+ return AAudioConvert_aaudioToAndroidStatus(mResult);
+ }
+
+ android::status_t playerSetVolume() override {
+ // No pan and only left volume is taken into account from IPLayer interface
+ mParent->setDuckAndMuteVolume(mVolumeMultiplierL /* * mPanMultiplierL */);
+ return android::NO_ERROR;
+ }
+
+#if AAUDIO_USE_VOLUME_SHAPER
+ ::android::binder::Status applyVolumeShaper(
+ const ::android::media::VolumeShaper::Configuration& configuration,
+ const ::android::media::VolumeShaper::Operation& operation) {
+ return mParent->applyVolumeShaper(configuration, operation);
+ }
+#endif
+
+ aaudio_result_t getResult() {
+ return mResult;
+ }
+
+ private:
+ AudioStream *mParent;
+ aaudio_result_t mResult = AAUDIO_OK;
+ bool mRegistered = false;
+ };
/**
* This should not be called after the open() call.
@@ -275,7 +407,9 @@
std::mutex mStreamMutex;
- std::atomic<bool> mCallbackEnabled;
+ std::atomic<bool> mCallbackEnabled{false};
+
+ float mDuckAndMuteVolume = 1.0f;
protected:
@@ -288,6 +422,8 @@
}
private:
+ const android::sp<MyPlayerBase> mPlayerBase;
+
// These do not change after open().
int32_t mSamplesPerFrame = AAUDIO_UNSPECIFIED;
int32_t mSampleRate = AAUDIO_UNSPECIFIED;
diff --git a/media/libaaudio/src/core/AudioStreamBuilder.cpp b/media/libaaudio/src/core/AudioStreamBuilder.cpp
index 43a1ef1..09ebb3e 100644
--- a/media/libaaudio/src/core/AudioStreamBuilder.cpp
+++ b/media/libaaudio/src/core/AudioStreamBuilder.cpp
@@ -184,16 +184,6 @@
return result;
}
- switch (mDirection) {
- case AAUDIO_DIRECTION_INPUT:
- case AAUDIO_DIRECTION_OUTPUT:
- break; // valid
- default:
- ALOGE("AudioStreamBuilder: direction not valid = %d", mDirection);
- return AAUDIO_ERROR_ILLEGAL_ARGUMENT;
- // break;
- }
-
switch (mPerformanceMode) {
case AAUDIO_PERFORMANCE_MODE_NONE:
case AAUDIO_PERFORMANCE_MODE_POWER_SAVING:
diff --git a/media/libaaudio/src/core/AudioStreamBuilder.h b/media/libaaudio/src/core/AudioStreamBuilder.h
index 6e548b1..a43cfa8 100644
--- a/media/libaaudio/src/core/AudioStreamBuilder.h
+++ b/media/libaaudio/src/core/AudioStreamBuilder.h
@@ -35,15 +35,6 @@
~AudioStreamBuilder();
- aaudio_direction_t getDirection() const {
- return mDirection;
- }
-
- AudioStreamBuilder* setDirection(aaudio_direction_t direction) {
- mDirection = direction;
- return this;
- }
-
bool isSharingModeMatchRequired() const {
return mSharingModeMatchRequired;
}
@@ -113,7 +104,6 @@
private:
bool mSharingModeMatchRequired = false; // must match sharing mode requested
- aaudio_direction_t mDirection = AAUDIO_DIRECTION_OUTPUT;
aaudio_performance_mode_t mPerformanceMode = AAUDIO_PERFORMANCE_MODE_NONE;
AAudioStream_dataCallback mDataCallbackProc = nullptr; // external callback functions
diff --git a/media/libaaudio/src/fifo/FifoBuffer.cpp b/media/libaaudio/src/fifo/FifoBuffer.cpp
index 8d2c62d..a869886 100644
--- a/media/libaaudio/src/fifo/FifoBuffer.cpp
+++ b/media/libaaudio/src/fifo/FifoBuffer.cpp
@@ -210,3 +210,9 @@
return mFifo->getCapacity();
}
+void FifoBuffer::eraseMemory() {
+ int32_t numBytes = convertFramesToBytes(getBufferCapacityInFrames());
+ if (numBytes > 0) {
+ memset(mStorage, 0, (size_t) numBytes);
+ }
+}
diff --git a/media/libaaudio/src/fifo/FifoBuffer.h b/media/libaaudio/src/fifo/FifoBuffer.h
index a94e9b0..f5a9e27 100644
--- a/media/libaaudio/src/fifo/FifoBuffer.h
+++ b/media/libaaudio/src/fifo/FifoBuffer.h
@@ -111,6 +111,11 @@
mFifo->setWriteCounter(n);
}
+ /*
+ * This is generally only called before or after the buffer is used.
+ */
+ void eraseMemory();
+
private:
void fillWrappingBuffer(WrappingBuffer *wrappingBuffer,
diff --git a/media/libaaudio/src/legacy/AudioStreamLegacy.cpp b/media/libaaudio/src/legacy/AudioStreamLegacy.cpp
index dd5e3c0..ee2504d 100644
--- a/media/libaaudio/src/legacy/AudioStreamLegacy.cpp
+++ b/media/libaaudio/src/legacy/AudioStreamLegacy.cpp
@@ -21,6 +21,7 @@
#include <stdint.h>
#include <utils/String16.h>
#include <media/AudioTrack.h>
+#include <media/AudioTimestamp.h>
#include <aaudio/AAudio.h>
#include "core/AudioStream.h"
@@ -30,7 +31,8 @@
using namespace aaudio;
AudioStreamLegacy::AudioStreamLegacy()
- : AudioStream(), mDeviceCallback(new StreamDeviceCallback(this)) {
+ : AudioStream()
+ , mDeviceCallback(new StreamDeviceCallback(this)) {
}
AudioStreamLegacy::~AudioStreamLegacy() {
@@ -46,33 +48,51 @@
return AudioStreamLegacy_callback;
}
-// Implement FixedBlockProcessor
-int32_t AudioStreamLegacy::onProcessFixedBlock(uint8_t *buffer, int32_t numBytes) {
- int32_t frameCount = numBytes / getBytesPerFrame();
+int32_t AudioStreamLegacy::callDataCallbackFrames(uint8_t *buffer, int32_t numFrames) {
+ if (getDirection() == AAUDIO_DIRECTION_INPUT) {
+ // Increment before because we already got the data from the device.
+ incrementFramesRead(numFrames);
+ }
+
// Call using the AAudio callback interface.
AAudioStream_dataCallback appCallback = getDataCallbackProc();
- return (*appCallback)(
+ aaudio_data_callback_result_t callbackResult = (*appCallback)(
(AAudioStream *) this,
getDataCallbackUserData(),
buffer,
- frameCount);
+ numFrames);
+
+ if (callbackResult == AAUDIO_CALLBACK_RESULT_CONTINUE
+ && getDirection() == AAUDIO_DIRECTION_OUTPUT) {
+ // Increment after because we are going to write the data to the device.
+ incrementFramesWritten(numFrames);
+ }
+ return callbackResult;
+}
+
+// Implement FixedBlockProcessor
+int32_t AudioStreamLegacy::onProcessFixedBlock(uint8_t *buffer, int32_t numBytes) {
+ int32_t numFrames = numBytes / getBytesPerFrame();
+ return callDataCallbackFrames(buffer, numFrames);
}
void AudioStreamLegacy::processCallbackCommon(aaudio_callback_operation_t opcode, void *info) {
aaudio_data_callback_result_t callbackResult;
- if (!mCallbackEnabled.load()) {
- return;
- }
-
switch (opcode) {
case AAUDIO_CALLBACK_OPERATION_PROCESS_DATA: {
- if (getState() != AAUDIO_STREAM_STATE_DISCONNECTED) {
- // Note that this code assumes an AudioTrack::Buffer is the same as
- // AudioRecord::Buffer
- // TODO define our own AudioBuffer and pass it from the subclasses.
- AudioTrack::Buffer *audioBuffer = static_cast<AudioTrack::Buffer *>(info);
- if (audioBuffer->frameCount == 0) return;
+ checkForDisconnectRequest();
+
+ // Note that this code assumes an AudioTrack::Buffer is the same as
+ // AudioRecord::Buffer
+ // TODO define our own AudioBuffer and pass it from the subclasses.
+ AudioTrack::Buffer *audioBuffer = static_cast<AudioTrack::Buffer *>(info);
+ if (getState() == AAUDIO_STREAM_STATE_DISCONNECTED || !mCallbackEnabled.load()) {
+ audioBuffer->size = 0; // silence the buffer
+ } else {
+ if (audioBuffer->frameCount == 0) {
+ return;
+ }
// If the caller specified an exact size then use a block size adapter.
if (mBlockAdapter != nullptr) {
@@ -81,44 +101,59 @@
(uint8_t *) audioBuffer->raw, byteCount);
} else {
// Call using the AAudio callback interface.
- callbackResult = (*getDataCallbackProc())(
- (AAudioStream *) this,
- getDataCallbackUserData(),
- audioBuffer->raw,
- audioBuffer->frameCount
- );
+ callbackResult = callDataCallbackFrames((uint8_t *)audioBuffer->raw,
+ audioBuffer->frameCount);
}
if (callbackResult == AAUDIO_CALLBACK_RESULT_CONTINUE) {
audioBuffer->size = audioBuffer->frameCount * getBytesPerFrame();
- incrementClientFrameCounter(audioBuffer->frameCount);
} else {
audioBuffer->size = 0;
}
- break;
- }
- }
- /// FALL THROUGH
- // Stream got rerouted so we disconnect.
- case AAUDIO_CALLBACK_OPERATION_DISCONNECTED: {
- setState(AAUDIO_STREAM_STATE_DISCONNECTED);
- ALOGD("processCallbackCommon() stream disconnected");
- if (getErrorCallbackProc() != nullptr) {
- (*getErrorCallbackProc())(
- (AAudioStream *) this,
- getErrorCallbackUserData(),
- AAUDIO_ERROR_DISCONNECTED
- );
+ if (updateStateMachine() != AAUDIO_OK) {
+ forceDisconnect();
+ mCallbackEnabled.store(false);
+ }
}
- mCallbackEnabled.store(false);
}
break;
+ // Stream got rerouted so we disconnect.
+ case AAUDIO_CALLBACK_OPERATION_DISCONNECTED:
+ ALOGD("processCallbackCommon() stream disconnected");
+ forceDisconnect();
+ mCallbackEnabled.store(false);
+ break;
+
default:
break;
}
}
+
+
+void AudioStreamLegacy::checkForDisconnectRequest() {
+ if (mRequestDisconnect.isRequested()) {
+ ALOGD("checkForDisconnectRequest() mRequestDisconnect acknowledged");
+ forceDisconnect();
+ mRequestDisconnect.acknowledge();
+ mCallbackEnabled.store(false);
+ }
+}
+
+void AudioStreamLegacy::forceDisconnect() {
+ if (getState() != AAUDIO_STREAM_STATE_DISCONNECTED) {
+ setState(AAUDIO_STREAM_STATE_DISCONNECTED);
+ if (getErrorCallbackProc() != nullptr) {
+ (*getErrorCallbackProc())(
+ (AAudioStream *) this,
+ getErrorCallbackUserData(),
+ AAUDIO_ERROR_DISCONNECTED
+ );
+ }
+ }
+}
+
aaudio_result_t AudioStreamLegacy::getBestTimestamp(clockid_t clockId,
int64_t *framePosition,
int64_t *timeNanoseconds,
@@ -136,8 +171,23 @@
return AAUDIO_ERROR_ILLEGAL_ARGUMENT;
break;
}
- status_t status = extendedTimestamp->getBestTimestamp(framePosition, timeNanoseconds, timebase);
- return AAudioConvert_androidToAAudioResult(status);
+ ExtendedTimestamp::Location location = ExtendedTimestamp::Location::LOCATION_INVALID;
+ int64_t localPosition;
+ status_t status = extendedTimestamp->getBestTimestamp(&localPosition, timeNanoseconds,
+ timebase, &location);
+ // use MonotonicCounter to prevent retrograde motion.
+ mTimestampPosition.update32((int32_t)localPosition);
+ *framePosition = mTimestampPosition.get();
+
+// ALOGD("getBestTimestamp() fposition: server = %6lld, kernel = %6lld, location = %d",
+// (long long) extendedTimestamp->mPosition[ExtendedTimestamp::Location::LOCATION_SERVER],
+// (long long) extendedTimestamp->mPosition[ExtendedTimestamp::Location::LOCATION_KERNEL],
+// (int)location);
+ if (status == WOULD_BLOCK) {
+ return AAUDIO_ERROR_INVALID_STATE;
+ } else {
+ return AAudioConvert_androidToAAudioResult(status);
+ }
}
void AudioStreamLegacy::onAudioDeviceUpdate(audio_port_handle_t deviceId)
@@ -145,15 +195,18 @@
ALOGD("onAudioDeviceUpdate() deviceId %d", (int)deviceId);
if (getDeviceId() != AAUDIO_UNSPECIFIED && getDeviceId() != deviceId &&
getState() != AAUDIO_STREAM_STATE_DISCONNECTED) {
- setState(AAUDIO_STREAM_STATE_DISCONNECTED);
- // if we have a data callback and the stream is active, send the error callback from
- // data callback thread when it sees the DISCONNECTED state
- if (!isDataCallbackActive() && getErrorCallbackProc() != nullptr) {
- (*getErrorCallbackProc())(
- (AAudioStream *) this,
- getErrorCallbackUserData(),
- AAUDIO_ERROR_DISCONNECTED
- );
+ // Note that isDataCallbackActive() is affected by state so call it before DISCONNECTING.
+ // If we have a data callback and the stream is active, then ask the data callback
+ // to DISCONNECT and call the error callback.
+ if (isDataCallbackActive()) {
+ ALOGD("onAudioDeviceUpdate() request DISCONNECT in data callback due to device change");
+ // If the stream is stopped before the data callback has a chance to handle the
+ // request then the requestStop() and requestPause() methods will handle it after
+ // the callback has stopped.
+ mRequestDisconnect.request();
+ } else {
+ ALOGD("onAudioDeviceUpdate() DISCONNECT the stream now");
+ forceDisconnect();
}
}
setDeviceId(deviceId);
diff --git a/media/libaaudio/src/legacy/AudioStreamLegacy.h b/media/libaaudio/src/legacy/AudioStreamLegacy.h
index d2ef3c7..7e28579 100644
--- a/media/libaaudio/src/legacy/AudioStreamLegacy.h
+++ b/media/libaaudio/src/legacy/AudioStreamLegacy.h
@@ -24,6 +24,7 @@
#include "AudioStream.h"
#include "AAudioLegacy.h"
+#include "utility/AAudioUtilities.h"
#include "utility/FixedBlockAdapter.h"
namespace aaudio {
@@ -63,6 +64,8 @@
aaudio_legacy_callback_t getLegacyCallback();
+ int32_t callDataCallbackFrames(uint8_t *buffer, int32_t numFrames);
+
// This is public so it can be called from the C callback function.
// This is called from the AudioTrack/AudioRecord client.
virtual void processCallback(int event, void *info) = 0;
@@ -109,6 +112,10 @@
void onAudioDeviceUpdate(audio_port_handle_t deviceId);
+ void checkForDisconnectRequest();
+
+ void forceDisconnect();
+
void onStart() { mCallbackEnabled.store(true); }
void onStop() { mCallbackEnabled.store(false); }
@@ -122,11 +129,14 @@
MonotonicCounter mFramesWritten;
MonotonicCounter mFramesRead;
+ MonotonicCounter mTimestampPosition;
FixedBlockAdapter *mBlockAdapter = nullptr;
aaudio_wrapping_frames_t mPositionWhenStarting = 0;
int32_t mCallbackBufferSize = 0;
const android::sp<StreamDeviceCallback> mDeviceCallback;
+
+ AtomicRequestor mRequestDisconnect;
};
} /* namespace aaudio */
diff --git a/media/libaaudio/src/legacy/AudioStreamRecord.cpp b/media/libaaudio/src/legacy/AudioStreamRecord.cpp
index 8e8070c..bc6e60c 100644
--- a/media/libaaudio/src/legacy/AudioStreamRecord.cpp
+++ b/media/libaaudio/src/legacy/AudioStreamRecord.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define LOG_TAG "AAudio"
+#define LOG_TAG "AudioStreamRecord"
//#define LOG_NDEBUG 0
#include <utils/Log.h>
@@ -159,6 +159,9 @@
actualPerformanceMode = AAUDIO_PERFORMANCE_MODE_LOW_LATENCY;
}
setPerformanceMode(actualPerformanceMode);
+
+ setSharingMode(AAUDIO_SHARING_MODE_SHARED); // EXCLUSIVE mode not supported in legacy
+
// Log warning if we did not get what we asked for.
ALOGW_IF(actualFlags != flags,
"AudioStreamRecord::open() flags changed from 0x%08X to 0x%08X",
@@ -178,11 +181,12 @@
{
// TODO add close() or release() to AudioRecord API then call it from here
if (getState() != AAUDIO_STREAM_STATE_CLOSED) {
+ mAudioRecord->removeAudioDeviceCallback(mDeviceCallback);
mAudioRecord.clear();
setState(AAUDIO_STREAM_STATE_CLOSED);
}
mFixedBlockWriter.close();
- return AAUDIO_OK;
+ return AudioStream::close();
}
void AudioStreamRecord::processCallback(int event, void *info) {
@@ -207,7 +211,7 @@
if (mAudioRecord.get() == nullptr) {
return AAUDIO_ERROR_INVALID_STATE;
}
- // Get current position so we can detect when the track is playing.
+ // Get current position so we can detect when the track is recording.
status_t err = mAudioRecord->getPosition(&mPositionWhenStarting);
if (err != OK) {
return AAudioConvert_androidToAAudioResult(err);
@@ -230,12 +234,15 @@
onStop();
setState(AAUDIO_STREAM_STATE_STOPPING);
incrementFramesWritten(getFramesRead() - getFramesWritten()); // TODO review
+ mTimestampPosition.set(getFramesRead());
mAudioRecord->stop();
mFramesRead.reset32();
+ mTimestampPosition.reset32();
+ checkForDisconnectRequest();
return AAUDIO_OK;
}
-aaudio_result_t AudioStreamRecord::updateStateWhileWaiting()
+aaudio_result_t AudioStreamRecord::updateStateMachine()
{
aaudio_result_t result = AAUDIO_OK;
aaudio_wrapping_frames_t position;
@@ -292,6 +299,12 @@
}
int32_t framesRead = (int32_t)(bytesRead / bytesPerFrame);
incrementFramesRead(framesRead);
+
+ result = updateStateMachine();
+ if (result != AAUDIO_OK) {
+ return result;
+ }
+
return (aaudio_result_t) framesRead;
}
@@ -325,8 +338,28 @@
int64_t *timeNanoseconds) {
ExtendedTimestamp extendedTimestamp;
status_t status = mAudioRecord->getTimestamp(&extendedTimestamp);
- if (status != NO_ERROR) {
+ if (status == WOULD_BLOCK) {
+ return AAUDIO_ERROR_INVALID_STATE;
+ } else if (status != NO_ERROR) {
return AAudioConvert_androidToAAudioResult(status);
}
return getBestTimestamp(clockId, framePosition, timeNanoseconds, &extendedTimestamp);
}
+
+int64_t AudioStreamRecord::getFramesWritten() {
+ aaudio_wrapping_frames_t position;
+ status_t result;
+ switch (getState()) {
+ case AAUDIO_STREAM_STATE_STARTING:
+ case AAUDIO_STREAM_STATE_STARTED:
+ case AAUDIO_STREAM_STATE_STOPPING:
+ result = mAudioRecord->getPosition(&position);
+ if (result == OK) {
+ mFramesWritten.update32(position);
+ }
+ break;
+ default:
+ break;
+ }
+ return AudioStreamLegacy::getFramesWritten();
+}
diff --git a/media/libaaudio/src/legacy/AudioStreamRecord.h b/media/libaaudio/src/legacy/AudioStreamRecord.h
index 2c6a7eb..c1723ba 100644
--- a/media/libaaudio/src/legacy/AudioStreamRecord.h
+++ b/media/libaaudio/src/legacy/AudioStreamRecord.h
@@ -59,9 +59,11 @@
int32_t getXRunCount() const override;
+ int64_t getFramesWritten() override;
+
int32_t getFramesPerBurst() const override;
- aaudio_result_t updateStateWhileWaiting() override;
+ aaudio_result_t updateStateMachine() override;
aaudio_direction_t getDirection() const override {
return AAUDIO_DIRECTION_INPUT;
diff --git a/media/libaaudio/src/legacy/AudioStreamTrack.cpp b/media/libaaudio/src/legacy/AudioStreamTrack.cpp
index 77f31e2..0e9aaef 100644
--- a/media/libaaudio/src/legacy/AudioStreamTrack.cpp
+++ b/media/libaaudio/src/legacy/AudioStreamTrack.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define LOG_TAG "AAudio"
+#define LOG_TAG "AudioStreamTrack"
//#define LOG_NDEBUG 0
#include <utils/Log.h>
@@ -115,7 +115,7 @@
ALOGD("AudioStreamTrack::open(), request notificationFrames = %d, frameCount = %u",
notificationFrames, (uint)frameCount);
- mAudioTrack = new AudioTrack();
+ mAudioTrack = new AudioTrack(); // TODO review
if (getDeviceId() != AAUDIO_UNSPECIFIED) {
mAudioTrack->setOutputDevice(getDeviceId());
}
@@ -143,8 +143,7 @@
return AAudioConvert_androidToAAudioResult(status);
}
- //TrackPlayerBase init
- init(mAudioTrack.get(), PLAYER_TYPE_AAUDIO, AUDIO_USAGE_MEDIA);
+ doSetVolume();
// Get the actual values from the AudioTrack.
setSamplesPerFrame(mAudioTrack->channelCount());
@@ -171,18 +170,20 @@
setDeviceId(mAudioTrack->getRoutedDeviceId());
mAudioTrack->addAudioDeviceCallback(mDeviceCallback);
- // Update performance mode based on the actual stream.
+ // Update performance mode based on the actual stream flags.
// For example, if the sample rate is not allowed then you won't get a FAST track.
audio_output_flags_t actualFlags = mAudioTrack->getFlags();
aaudio_performance_mode_t actualPerformanceMode = AAUDIO_PERFORMANCE_MODE_NONE;
- if ((actualFlags & (AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_RAW))
- == (AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_RAW)) {
+ // We may not get the RAW flag. But as long as we get the FAST flag we can call it LOW_LATENCY.
+ if ((actualFlags & AUDIO_OUTPUT_FLAG_FAST) != 0) {
actualPerformanceMode = AAUDIO_PERFORMANCE_MODE_LOW_LATENCY;
-
} else if ((actualFlags & AUDIO_OUTPUT_FLAG_DEEP_BUFFER) != 0) {
actualPerformanceMode = AAUDIO_PERFORMANCE_MODE_POWER_SAVING;
}
setPerformanceMode(actualPerformanceMode);
+
+ setSharingMode(AAUDIO_SHARING_MODE_SHARED); // EXCLUSIVE mode not supported in legacy
+
// Log warning if we did not get what we asked for.
ALOGW_IF(actualFlags != flags,
"AudioStreamTrack::open() flags changed from 0x%08X to 0x%08X",
@@ -197,7 +198,7 @@
aaudio_result_t AudioStreamTrack::close()
{
if (getState() != AAUDIO_STREAM_STATE_CLOSED) {
- destroy();
+ mAudioTrack->removeAudioDeviceCallback(mDeviceCallback);
setState(AAUDIO_STREAM_STATE_CLOSED);
}
mFixedBlockReader.close();
@@ -222,11 +223,11 @@
return;
}
-aaudio_result_t AudioStreamTrack::requestStart()
-{
+aaudio_result_t AudioStreamTrack::requestStart() {
std::lock_guard<std::mutex> lock(mStreamMutex);
if (mAudioTrack.get() == nullptr) {
+ ALOGE("AudioStreamTrack::requestStart() no AudioTrack");
return AAUDIO_ERROR_INVALID_STATE;
}
// Get current position so we can detect when the track is playing.
@@ -235,7 +236,7 @@
return AAudioConvert_androidToAAudioResult(err);
}
- err = startWithStatus();
+ err = mAudioTrack->start();
if (err != OK) {
return AAudioConvert_androidToAAudioResult(err);
} else {
@@ -245,11 +246,11 @@
return AAUDIO_OK;
}
-aaudio_result_t AudioStreamTrack::requestPause()
-{
+aaudio_result_t AudioStreamTrack::requestPause() {
std::lock_guard<std::mutex> lock(mStreamMutex);
if (mAudioTrack.get() == nullptr) {
+ ALOGE("requestPause() no AudioTrack");
return AAUDIO_ERROR_INVALID_STATE;
} else if (getState() != AAUDIO_STREAM_STATE_STARTING
&& getState() != AAUDIO_STREAM_STATE_STARTED) {
@@ -259,7 +260,8 @@
}
onStop();
setState(AAUDIO_STREAM_STATE_PAUSING);
- pause();
+ mAudioTrack->pause();
+ checkForDisconnectRequest();
status_t err = mAudioTrack->getPosition(&mPositionWhenPausing);
if (err != OK) {
return AAudioConvert_androidToAAudioResult(err);
@@ -271,14 +273,17 @@
std::lock_guard<std::mutex> lock(mStreamMutex);
if (mAudioTrack.get() == nullptr) {
+ ALOGE("AudioStreamTrack::requestFlush() no AudioTrack");
return AAUDIO_ERROR_INVALID_STATE;
} else if (getState() != AAUDIO_STREAM_STATE_PAUSED) {
+ ALOGE("AudioStreamTrack::requestFlush() not paused");
return AAUDIO_ERROR_INVALID_STATE;
}
setState(AAUDIO_STREAM_STATE_FLUSHING);
incrementFramesRead(getFramesWritten() - getFramesRead());
mAudioTrack->flush();
mFramesWritten.reset32();
+ mTimestampPosition.reset32();
return AAUDIO_OK;
}
@@ -286,17 +291,21 @@
std::lock_guard<std::mutex> lock(mStreamMutex);
if (mAudioTrack.get() == nullptr) {
+ ALOGE("AudioStreamTrack::requestStop() no AudioTrack");
return AAUDIO_ERROR_INVALID_STATE;
}
onStop();
setState(AAUDIO_STREAM_STATE_STOPPING);
incrementFramesRead(getFramesWritten() - getFramesRead()); // TODO review
- stop();
+ mTimestampPosition.set(getFramesWritten());
mFramesWritten.reset32();
+ mTimestampPosition.reset32();
+ mAudioTrack->stop();
+ checkForDisconnectRequest();
return AAUDIO_OK;
}
-aaudio_result_t AudioStreamTrack::updateStateWhileWaiting()
+aaudio_result_t AudioStreamTrack::updateStateMachine()
{
status_t err;
aaudio_wrapping_frames_t position;
@@ -373,6 +382,12 @@
}
int32_t framesWritten = (int32_t)(bytesWritten / bytesPerFrame);
incrementFramesWritten(framesWritten);
+
+ result = updateStateMachine();
+ if (result != AAUDIO_OK) {
+ return result;
+ }
+
return framesWritten;
}
@@ -431,8 +446,59 @@
int64_t *timeNanoseconds) {
ExtendedTimestamp extendedTimestamp;
status_t status = mAudioTrack->getTimestamp(&extendedTimestamp);
- if (status != NO_ERROR) {
+ if (status == WOULD_BLOCK) {
+ return AAUDIO_ERROR_INVALID_STATE;
+ } if (status != NO_ERROR) {
return AAudioConvert_androidToAAudioResult(status);
}
- return getBestTimestamp(clockId, framePosition, timeNanoseconds, &extendedTimestamp);
+ int64_t position = 0;
+ int64_t nanoseconds = 0;
+ aaudio_result_t result = getBestTimestamp(clockId, &position,
+ &nanoseconds, &extendedTimestamp);
+ if (result == AAUDIO_OK) {
+ if (position < getFramesWritten()) {
+ *framePosition = position;
+ *timeNanoseconds = nanoseconds;
+ return result;
+ } else {
+ return AAUDIO_ERROR_INVALID_STATE; // TODO review, documented but not consistent
+ }
+ }
+ return result;
}
+
+status_t AudioStreamTrack::doSetVolume() {
+ status_t status = NO_INIT;
+ if (mAudioTrack.get() != nullptr) {
+ float volume = getDuckAndMuteVolume();
+ mAudioTrack->setVolume(volume, volume);
+ status = NO_ERROR;
+ }
+ return status;
+}
+
+#if AAUDIO_USE_VOLUME_SHAPER
+
+using namespace android::media::VolumeShaper;
+
+binder::Status AudioStreamTrack::applyVolumeShaper(
+ const VolumeShaper::Configuration& configuration,
+ const VolumeShaper::Operation& operation) {
+
+ sp<VolumeShaper::Configuration> spConfiguration = new VolumeShaper::Configuration(configuration);
+ sp<VolumeShaper::Operation> spOperation = new VolumeShaper::Operation(operation);
+
+ if (mAudioTrack.get() != nullptr) {
+ ALOGD("applyVolumeShaper() from IPlayer");
+ binder::Status status = mAudioTrack->applyVolumeShaper(spConfiguration, spOperation);
+ if (status < 0) { // a non-negative value is the volume shaper id.
+ ALOGE("applyVolumeShaper() failed with status %d", status);
+ }
+ return binder::Status::fromStatusT(status);
+ } else {
+ ALOGD("applyVolumeShaper()"
+ " no AudioTrack for volume control from IPlayer");
+ return binder::Status::ok();
+ }
+}
+#endif
diff --git a/media/libaaudio/src/legacy/AudioStreamTrack.h b/media/libaaudio/src/legacy/AudioStreamTrack.h
index ff429ea..a871db4 100644
--- a/media/libaaudio/src/legacy/AudioStreamTrack.h
+++ b/media/libaaudio/src/legacy/AudioStreamTrack.h
@@ -19,6 +19,7 @@
#include <math.h>
#include <media/TrackPlayerBase.h>
+#include <media/AudioTrack.h>
#include <aaudio/AAudio.h>
#include "AudioStreamBuilder.h"
@@ -32,7 +33,7 @@
/**
* Internal stream that uses the legacy AudioTrack path.
*/
-class AudioStreamTrack : public AudioStreamLegacy, public android::TrackPlayerBase {
+class AudioStreamTrack : public AudioStreamLegacy {
public:
AudioStreamTrack();
@@ -67,7 +68,7 @@
return AAUDIO_DIRECTION_OUTPUT;
}
- aaudio_result_t updateStateWhileWaiting() override;
+ aaudio_result_t updateStateMachine() override;
// This is public so it can be called from the C callback function.
void processCallback(int event, void *info) override;
@@ -76,13 +77,22 @@
return incrementFramesWritten(frames);
}
+ android::status_t doSetVolume() override;
+
+#if AAUDIO_USE_VOLUME_SHAPER
+ virtual android::binder::Status applyVolumeShaper(
+ const android::media::VolumeShaper::Configuration& configuration,
+ const android::media::VolumeShaper::Operation& operation) override;
+#endif
+
private:
+ android::sp<android::AudioTrack> mAudioTrack;
+
// adapts between variable sized blocks and fixed size blocks
FixedBlockReader mFixedBlockReader;
- // TODO add 64-bit position reporting to AudioRecord and use it.
- aaudio_wrapping_frames_t mPositionWhenStarting = 0;
+ // TODO add 64-bit position reporting to AudioTrack and use it.
aaudio_wrapping_frames_t mPositionWhenPausing = 0;
};
diff --git a/media/libaaudio/src/utility/AAudioUtilities.cpp b/media/libaaudio/src/utility/AAudioUtilities.cpp
index 2450920..612ad27 100644
--- a/media/libaaudio/src/utility/AAudioUtilities.cpp
+++ b/media/libaaudio/src/utility/AAudioUtilities.cpp
@@ -323,7 +323,7 @@
const int32_t maxBytesPerFrame = maxChannels * sizeof(float);
// Prevent overflow by limiting multiplicands.
if (bytesPerFrame > maxBytesPerFrame || numFrames > (0x3FFFFFFF / maxBytesPerFrame)) {
- ALOGE("size overflow, numFrames = %d, frameSize = %zd", numFrames, bytesPerFrame);
+ ALOGE("size overflow, numFrames = %d, frameSize = %d", numFrames, bytesPerFrame);
return AAUDIO_ERROR_OUT_OF_RANGE;
}
*sizeInBytes = numFrames * bytesPerFrame;
diff --git a/media/libaaudio/src/utility/AAudioUtilities.h b/media/libaaudio/src/utility/AAudioUtilities.h
index acd319b..3afa976 100644
--- a/media/libaaudio/src/utility/AAudioUtilities.h
+++ b/media/libaaudio/src/utility/AAudioUtilities.h
@@ -258,4 +258,112 @@
}
}
+
+/**
+ * Simple double buffer for a structure that can be written occasionally and read occasionally.
+ * This allows a SINGLE writer with multiple readers.
+ *
+ * It is OK if the FIFO overflows and we lose old values.
+ * It is also OK if we read an old value.
+ * Thread may return a non-atomic result if the other thread is rapidly writing
+ * new values on another core.
+ */
+template <class T>
+class SimpleDoubleBuffer {
+public:
+ SimpleDoubleBuffer()
+ : mValues() {}
+
+ __attribute__((no_sanitize("integer")))
+ void write(T value) {
+ int index = mCounter.load() & 1;
+ mValues[index] = value;
+ mCounter++; // Increment AFTER updating storage, OK if it wraps.
+ }
+
+ /**
+ * This should only be called by the same thread that calls write() or when
+ * no other thread is calling write.
+ */
+ void clear() {
+ mCounter.store(0);
+ }
+
+ T read() const {
+ T result;
+ int before;
+ int after;
+ int timeout = 3;
+ do {
+ // Check to see if a write occurred while were reading.
+ before = mCounter.load();
+ int index = (before & 1) ^ 1;
+ result = mValues[index];
+ after = mCounter.load();
+ } while ((after != before) && (after > 0) && (--timeout > 0));
+ return result;
+ }
+
+ /**
+ * @return true if at least one value has been written
+ */
+ bool isValid() const {
+ return mCounter.load() > 0;
+ }
+
+private:
+ T mValues[2];
+ std::atomic<int> mCounter{0};
+};
+
+class Timestamp {
+public:
+ Timestamp()
+ : mPosition(0)
+ , mNanoseconds(0) {}
+ Timestamp(int64_t position, int64_t nanoseconds)
+ : mPosition(position)
+ , mNanoseconds(nanoseconds) {}
+
+ int64_t getPosition() const { return mPosition; }
+
+ int64_t getNanoseconds() const { return mNanoseconds; }
+
+private:
+ // These cannot be const because we need to implement the copy assignment operator.
+ int64_t mPosition;
+ int64_t mNanoseconds;
+};
+
+
+/**
+ * Pass a request to another thread.
+ * This is used when one thread, A, wants another thread, B, to do something.
+ * A naive approach would be for A to set a flag and for B to clear it when done.
+ * But that creates a race condition. This technique avoids the race condition.
+ *
+ * Assumes only one requester and one acknowledger.
+ */
+class AtomicRequestor {
+public:
+
+ __attribute__((no_sanitize("integer")))
+ void request() {
+ mRequested++;
+ }
+
+ __attribute__((no_sanitize("integer")))
+ bool isRequested() {
+ return (mRequested.load() - mAcknowledged.load()) > 0;
+ }
+
+ __attribute__((no_sanitize("integer")))
+ void acknowledge() {
+ mAcknowledged++;
+ }
+
+private:
+ std::atomic<int> mRequested{0};
+ std::atomic<int> mAcknowledged{0};
+};
#endif //UTILITY_AAUDIO_UTILITIES_H
diff --git a/media/libaaudio/src/utility/HandleTracker.cpp b/media/libaaudio/src/utility/HandleTracker.cpp
deleted file mode 100644
index 35ce95a..0000000
--- a/media/libaaudio/src/utility/HandleTracker.cpp
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#define LOG_TAG "AAudio"
-//#define LOG_NDEBUG 0
-#include <utils/Log.h>
-
-#include <assert.h>
-#include <functional>
-#include <iomanip>
-#include <new>
-#include <sstream>
-#include <stdint.h>
-#include <utils/Mutex.h>
-
-#include <aaudio/AAudio.h>
-#include "AAudioUtilities.h"
-#include "HandleTracker.h"
-
-using android::Mutex;
-
-// Handle format is: tgggiiii
-// where each letter is 4 bits, t=type, g=generation, i=index
-
-#define TYPE_SIZE 4
-#define GENERATION_SIZE 12
-#define INDEX_SIZE 16
-
-#define GENERATION_INVALID 0
-#define GENERATION_SHIFT INDEX_SIZE
-
-#define TYPE_MASK ((1 << TYPE_SIZE) - 1)
-#define GENERATION_MASK ((1 << GENERATION_SIZE) - 1)
-#define INDEX_MASK ((1 << INDEX_SIZE) - 1)
-
-#define SLOT_UNAVAILABLE (-1)
-
-// Error if handle is negative so type is limited to bottom half.
-#define HANDLE_INVALID_TYPE TYPE_MASK
-
-static_assert(HANDLE_TRACKER_MAX_TYPES == (1 << (TYPE_SIZE - 1)),
- "Mismatch between header and cpp.");
-static_assert(HANDLE_TRACKER_MAX_HANDLES == (1 << (INDEX_SIZE)),
- "Mismatch between header and cpp.");
-
-HandleTracker::HandleTracker(uint32_t maxHandles)
- : mMaxHandleCount(maxHandles)
- , mHandleHeaders(nullptr)
-{
- assert(maxHandles <= HANDLE_TRACKER_MAX_HANDLES);
- // Allocate arrays to hold addresses and validation info.
- mHandleAddresses = (handle_tracker_address_t *)
- new(std::nothrow) handle_tracker_address_t[maxHandles];
- if (mHandleAddresses != nullptr) {
- mHandleHeaders = new(std::nothrow) handle_tracker_header_t[maxHandles];
-
- if (mHandleHeaders != nullptr) {
- handle_tracker_header_t initialHeader = buildHeader(0, 1);
- // Initialize linked list of free nodes. nullptr terminated.
- for (uint32_t i = 0; i < (maxHandles - 1); i++) {
- mHandleAddresses[i] = &mHandleAddresses[i + 1]; // point to next node
- mHandleHeaders[i] = initialHeader;
- }
- mNextFreeAddress = &mHandleAddresses[0];
- mHandleAddresses[maxHandles - 1] = nullptr;
- mHandleHeaders[maxHandles - 1] = 0;
- } else {
- delete[] mHandleAddresses; // so the class appears uninitialized
- mHandleAddresses = nullptr;
- }
- }
-}
-
-HandleTracker::~HandleTracker()
-{
- Mutex::Autolock _l(mLock);
- delete[] mHandleAddresses;
- delete[] mHandleHeaders;
- mHandleAddresses = nullptr;
-}
-
-bool HandleTracker::isInitialized() const {
- return mHandleAddresses != nullptr;
-}
-
-
-
-std::string HandleTracker::dump() const {
- if (!isInitialized()) {
- return "HandleTracker is not initialized\n";
- }
-
- std::stringstream result;
- const bool isLocked = AAudio_tryUntilTrue(
- [this]()->bool { return mLock.tryLock(); } /* f */,
- 50 /* times */,
- 20 /* sleepMs */);
- if (!isLocked) {
- result << "HandleTracker may be deadlocked\n";
- }
-
- result << "HandleTracker:\n";
- result << " HandleHeaders:\n";
- // atLineStart() can be changed to support an arbitrary line breaking algorithm;
- // it should return true when a new line starts.
- // For simplicity, we will use a constant 16 items per line.
- const auto atLineStart = [](int index) -> bool {
- // Magic constant of 0xf used for mask to detect start every 16 items.
- return (index & 0xf) == 0; };
- const auto atLineEnd = [this, &atLineStart](int index) -> bool {
- return atLineStart(index + 1) || index == mMaxHandleCount - 1; };
-
- for (int i = 0; i < mMaxHandleCount; ++i) {
- if (atLineStart(i)) {
- result << " ";
- }
- result << std::hex << std::setw(4) << std::setfill('0') << mHandleHeaders[i]
- << (atLineEnd(i) ? "\n" : " ");
- }
-
- if (isLocked) {
- mLock.unlock();
- }
- return result.str();
-}
-
-handle_tracker_slot_t HandleTracker::allocateSlot_l() {
- void **allocated = mNextFreeAddress;
- if (allocated == nullptr) {
- return SLOT_UNAVAILABLE;
- }
- // Remove this slot from the head of the linked list.
- mNextFreeAddress = (void **) *allocated;
- return (allocated - mHandleAddresses);
-}
-
-handle_tracker_generation_t HandleTracker::nextGeneration_l(handle_tracker_slot_t index) {
- handle_tracker_generation_t generation = (mHandleHeaders[index] + 1) & GENERATION_MASK;
- // Avoid generation zero so that 0x0 is not a valid handle.
- if (generation == GENERATION_INVALID) {
- generation++;
- }
- return generation;
-}
-
-aaudio_handle_t HandleTracker::put(handle_tracker_type_t type, void *address)
-{
- if (type < 0 || type >= HANDLE_TRACKER_MAX_TYPES) {
- return static_cast<aaudio_handle_t>(AAUDIO_ERROR_OUT_OF_RANGE);
- }
- if (!isInitialized()) {
- return static_cast<aaudio_handle_t>(AAUDIO_ERROR_NO_MEMORY);
- }
-
- Mutex::Autolock _l(mLock);
-
- // Find an empty slot.
- handle_tracker_slot_t index = allocateSlot_l();
- if (index == SLOT_UNAVAILABLE) {
- ALOGE("HandleTracker::put() no room for more handles");
- return static_cast<aaudio_handle_t>(AAUDIO_ERROR_NO_FREE_HANDLES);
- }
-
- // Cycle the generation counter so stale handles can be detected.
- handle_tracker_generation_t generation = nextGeneration_l(index); // reads header table
- handle_tracker_header_t inputHeader = buildHeader(type, generation);
-
- // These two writes may need to be observed by other threads or cores during get().
- mHandleHeaders[index] = inputHeader;
- mHandleAddresses[index] = address;
- // TODO use store release to enforce memory order with get()
-
- // Generate a handle.
- aaudio_handle_t handle = buildHandle(inputHeader, index);
-
- ALOGV("HandleTracker::put(%p) returns 0x%08x", address, handle);
- return handle;
-}
-
-handle_tracker_slot_t HandleTracker::handleToIndex(handle_tracker_type_t type,
- aaudio_handle_t handle) const
-{
- // Validate the handle.
- handle_tracker_slot_t index = extractIndex(handle);
- if (index >= mMaxHandleCount) {
- ALOGE("HandleTracker::handleToIndex() invalid handle = 0x%08X", handle);
- return static_cast<aaudio_handle_t>(AAUDIO_ERROR_INVALID_HANDLE);
- }
- handle_tracker_generation_t handleGeneration = extractGeneration(handle);
- handle_tracker_header_t inputHeader = buildHeader(type, handleGeneration);
- // We do not need to synchronize this access to mHandleHeaders because it is constant for
- // the lifetime of the handle.
- if (inputHeader != mHandleHeaders[index]) {
- ALOGE("HandleTracker::handleToIndex() inputHeader = 0x%08x != mHandleHeaders[%d] = 0x%08x",
- inputHeader, index, mHandleHeaders[index]);
- return static_cast<aaudio_handle_t>(AAUDIO_ERROR_INVALID_HANDLE);
- }
- return index;
-}
-
-handle_tracker_address_t HandleTracker::get(handle_tracker_type_t type, aaudio_handle_t handle) const
-{
- if (!isInitialized()) {
- return nullptr;
- }
- handle_tracker_slot_t index = handleToIndex(type, handle);
- if (index >= 0) {
- // We do not need to synchronize this access to mHandleHeaders because this slot
- // is allocated and, therefore, not part of the linked list of free slots.
- return mHandleAddresses[index];
- } else {
- return nullptr;
- }
-}
-
-handle_tracker_address_t HandleTracker::remove(handle_tracker_type_t type, aaudio_handle_t handle) {
- if (!isInitialized()) {
- return nullptr;
- }
-
- Mutex::Autolock _l(mLock);
-
- handle_tracker_slot_t index = handleToIndex(type,handle);
- if (index >= 0) {
- handle_tracker_address_t address = mHandleAddresses[index];
-
- // Invalidate the header type but preserve the generation count.
- handle_tracker_generation_t generation = mHandleHeaders[index] & GENERATION_MASK;
- handle_tracker_header_t inputHeader = buildHeader(
- (handle_tracker_type_t) HANDLE_INVALID_TYPE, generation);
- mHandleHeaders[index] = inputHeader;
-
- // Add this slot to the head of the linked list.
- mHandleAddresses[index] = mNextFreeAddress;
- mNextFreeAddress = (handle_tracker_address_t *) &mHandleAddresses[index];
- return address;
- } else {
- return nullptr;
- }
-}
-
-aaudio_handle_t HandleTracker::buildHandle(handle_tracker_header_t typeGeneration,
- handle_tracker_slot_t index) {
- return (aaudio_handle_t)((typeGeneration << GENERATION_SHIFT) | (index & INDEX_MASK));
-}
-
-handle_tracker_header_t HandleTracker::buildHeader(handle_tracker_type_t type,
- handle_tracker_generation_t generation)
-{
- return (handle_tracker_header_t) (((type & TYPE_MASK) << GENERATION_SIZE)
- | (generation & GENERATION_MASK));
-}
-
-handle_tracker_slot_t HandleTracker::extractIndex(aaudio_handle_t handle)
-{
- return handle & INDEX_MASK;
-}
-
-handle_tracker_generation_t HandleTracker::extractGeneration(aaudio_handle_t handle)
-{
- return (handle >> GENERATION_SHIFT) & GENERATION_MASK;
-}
diff --git a/media/libaaudio/src/utility/HandleTracker.h b/media/libaaudio/src/utility/HandleTracker.h
deleted file mode 100644
index a4c51c0..0000000
--- a/media/libaaudio/src/utility/HandleTracker.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef UTILITY_HANDLE_TRACKER_H
-#define UTILITY_HANDLE_TRACKER_H
-
-#include <stdint.h>
-#include <string>
-#include <utils/Mutex.h>
-
-typedef int32_t aaudio_handle_t;
-typedef int32_t handle_tracker_type_t; // what kind of handle
-typedef int32_t handle_tracker_slot_t; // index in allocation table
-typedef int32_t handle_tracker_generation_t; // incremented when slot used
-typedef uint16_t handle_tracker_header_t; // combines type and generation
-typedef void *handle_tracker_address_t; // address of something that is stored here
-
-#define HANDLE_TRACKER_MAX_TYPES (1 << 3)
-#define HANDLE_TRACKER_MAX_HANDLES (1 << 16)
-
-/**
- * Represent Objects using an integer handle that can be used with Java.
- * This also makes the 'C' ABI more robust.
- *
- * Note that this should only be called from a single thread.
- * If you call it from more than one thread then you need to use your own mutex.
- */
-class HandleTracker {
-
-public:
- /**
- * @param maxHandles cannot exceed HANDLE_TRACKER_MAX_HANDLES
- */
- HandleTracker(uint32_t maxHandles = 256);
- virtual ~HandleTracker();
-
- /**
- * Don't use if this returns false;
- * @return true if the internal allocation succeeded
- */
- bool isInitialized() const;
-
- /**
- * Returns HandleTracker information.
- *
- * Will attempt to get the object lock, but will proceed
- * even if it cannot.
- *
- * Each line of information ends with a newline.
- *
- * @return a string representing the HandleTracker info.
- */
- std::string dump() const;
-
- /**
- * Store a pointer and return a handle that can be used to retrieve the pointer.
- *
- * It is safe to call put() or remove() from multiple threads.
- *
- * @param expectedType the type of the object to be tracked
- * @param address pointer to be converted to a handle
- * @return a valid handle or a negative error
- */
- aaudio_handle_t put(handle_tracker_type_t expectedType, handle_tracker_address_t address);
-
- /**
- * Get the original pointer associated with the handle.
- * The handle will be validated to prevent stale handles from being reused.
- * Note that the validation is designed to prevent common coding errors and not
- * to prevent deliberate hacking.
- *
- * @param expectedType shouldmatch the type we passed to put()
- * @param handle to be converted to a pointer
- * @return address associated with handle or nullptr
- */
- handle_tracker_address_t get(handle_tracker_type_t expectedType, aaudio_handle_t handle) const;
-
- /**
- * Free up the storage associated with the handle.
- * Subsequent attempts to use the handle will fail.
- *
- * Do NOT remove() a handle while get() is being called for the same handle from another thread.
- *
- * @param expectedType shouldmatch the type we passed to put()
- * @param handle to be removed from tracking
- * @return address associated with handle or nullptr if not found
- */
- handle_tracker_address_t remove(handle_tracker_type_t expectedType, aaudio_handle_t handle);
-
-private:
- const int32_t mMaxHandleCount; // size of array
- // This address is const after initialization.
- handle_tracker_address_t * mHandleAddresses; // address of objects or a free linked list node
- // This address is const after initialization.
- handle_tracker_header_t * mHandleHeaders; // combination of type and generation
- // head of the linked list of free nodes in mHandleAddresses
- handle_tracker_address_t * mNextFreeAddress;
-
- // This Mutex protects the linked list of free nodes.
- // The list is managed using mHandleAddresses and mNextFreeAddress.
- // The data in mHandleHeaders is only changed by put() and remove().
- mutable android::Mutex mLock;
-
- /**
- * Pull slot off of a list of empty slots.
- * @return index or a negative error
- */
- handle_tracker_slot_t allocateSlot_l();
-
- /**
- * Increment the generation for the slot, avoiding zero.
- */
- handle_tracker_generation_t nextGeneration_l(handle_tracker_slot_t index);
-
- /**
- * Validate the handle and return the corresponding index.
- * @return slot index or a negative error
- */
- handle_tracker_slot_t handleToIndex(aaudio_handle_t handle, handle_tracker_type_t type) const;
-
- /**
- * Construct a handle from a header and an index.
- * @param header combination of a type and a generation
- * @param index slot index returned from allocateSlot
- * @return handle or a negative error
- */
- static aaudio_handle_t buildHandle(handle_tracker_header_t header, handle_tracker_slot_t index);
-
- /**
- * Combine a type and a generation field into a header.
- */
- static handle_tracker_header_t buildHeader(handle_tracker_type_t type,
- handle_tracker_generation_t generation);
-
- /**
- * Extract the index from a handle.
- * Does not validate the handle.
- * @return index associated with a handle
- */
- static handle_tracker_slot_t extractIndex(aaudio_handle_t handle);
-
- /**
- * Extract the generation from a handle.
- * Does not validate the handle.
- * @return generation associated with a handle
- */
- static handle_tracker_generation_t extractGeneration(aaudio_handle_t handle);
-
-};
-
-#endif //UTILITY_HANDLE_TRACKER_H
diff --git a/media/libaaudio/src/utility/MonotonicCounter.h b/media/libaaudio/src/utility/MonotonicCounter.h
index 81d7f89..13c92a2 100644
--- a/media/libaaudio/src/utility/MonotonicCounter.h
+++ b/media/libaaudio/src/utility/MonotonicCounter.h
@@ -41,6 +41,13 @@
}
/**
+ * set the current value of the counter
+ */
+ void set(int64_t counter) {
+ mCounter64 = counter;
+ }
+
+ /**
* Advance the counter if delta is positive.
* @return current value of the counter
*/
diff --git a/media/libaaudio/tests/Android.bp b/media/libaaudio/tests/Android.bp
index 05135df..19c56d3 100644
--- a/media/libaaudio/tests/Android.bp
+++ b/media/libaaudio/tests/Android.bp
@@ -7,13 +7,6 @@
}
cc_test {
- name: "test_handle_tracker",
- defaults: ["libaaudio_tests_defaults"],
- srcs: ["test_handle_tracker.cpp"],
- shared_libs: ["libaaudio"],
-}
-
-cc_test {
name: "test_aaudio_marshalling",
defaults: ["libaaudio_tests_defaults"],
srcs: ["test_marshalling.cpp"],
@@ -33,6 +26,13 @@
}
cc_test {
+ name: "test_timestamps",
+ srcs: ["test_timestamps.cpp"],
+ header_libs: ["libaaudio_example_utils"],
+ shared_libs: ["libaaudio"],
+}
+
+cc_test {
name: "test_linear_ramp",
defaults: ["libaaudio_tests_defaults"],
srcs: ["test_linear_ramp.cpp"],
diff --git a/media/libaaudio/tests/test_handle_tracker.cpp b/media/libaaudio/tests/test_handle_tracker.cpp
deleted file mode 100644
index c4db47a..0000000
--- a/media/libaaudio/tests/test_handle_tracker.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Unit tests for AAudio Handle Tracker
-
-#include <stdlib.h>
-#include <math.h>
-
-#include <gtest/gtest.h>
-
-#include <aaudio/AAudio.h>
-#include "utility/HandleTracker.h"
-
-// Test adding one address.
-TEST(test_handle_tracker, aaudio_handle_tracker) {
- const int MAX_HANDLES = 4;
- HandleTracker tracker(MAX_HANDLES);
- handle_tracker_type_t type = 3; // arbitrary generic type
- int data; // something that has an address we can use
- handle_tracker_address_t found;
-
- // repeat the test several times to see if it breaks
- const int SEVERAL = 5; // arbitrary
- for (int i = 0; i < SEVERAL; i++) {
- // should fail to find a bogus handle
- found = tracker.get(type, 0); // bad handle
- EXPECT_EQ(nullptr, found);
-
- // create a valid handle and use it to lookup the object again
- aaudio_handle_t dataHandle = tracker.put(type, &data);
- ASSERT_TRUE(dataHandle > 0);
- found = tracker.get(type, dataHandle);
- EXPECT_EQ(&data, found);
- found = tracker.get(type, 0); // bad handle
- EXPECT_EQ(nullptr, found);
-
- // wrong type
- found = tracker.get(type+1, dataHandle);
- EXPECT_EQ(nullptr, found);
-
- // remove from storage
- found = tracker.remove(type, dataHandle);
- EXPECT_EQ(&data, found);
- // should fail the second time
- found = tracker.remove(type, dataHandle);
- EXPECT_EQ(nullptr, found);
- }
-}
-
-// Test filling the tracker.
-TEST(test_handle_tracker, aaudio_full_up) {
- const int MAX_HANDLES = 5;
- HandleTracker tracker(MAX_HANDLES);
- handle_tracker_type_t type = 4; // arbitrary generic type
- int data[MAX_HANDLES];
- aaudio_handle_t handles[MAX_HANDLES];
- handle_tracker_address_t found;
-
- // repeat the test several times to see if it breaks
- const int SEVERAL = 5; // arbitrary
- for (int i = 0; i < SEVERAL; i++) {
- for (int i = 0; i < MAX_HANDLES; i++) {
- // add a handle
- handles[i] = tracker.put(type, &data[i]);
- ASSERT_TRUE(handles[i] > 0);
- found = tracker.get(type, handles[i]);
- EXPECT_EQ(&data[i], found);
- }
-
- // Now that it is full, try to add one more.
- aaudio_handle_t handle = tracker.put(type, &data[0]);
- EXPECT_TRUE(handle < 0);
-
- for (int i = 0; i < MAX_HANDLES; i++) {
- // look up each handle
- found = tracker.get(type, handles[i]);
- EXPECT_EQ(&data[i], found);
- }
-
- // remove one from storage
- found = tracker.remove(type, handles[2]);
- EXPECT_EQ(&data[2], found);
- // now try to look up the same handle and fail
- found = tracker.get(type, handles[2]);
- EXPECT_EQ(nullptr, found);
-
- // add that same one back
- handle = tracker.put(type, &data[2]);
- ASSERT_TRUE(handle > 0);
- found = tracker.get(type, handle);
- EXPECT_EQ(&data[2], found);
- // now use a stale handle again with a valid index and fail
- found = tracker.get(type, handles[2]);
- EXPECT_EQ(nullptr, found);
-
- // remove them all
- handles[2] = handle;
- for (int i = 0; i < MAX_HANDLES; i++) {
- // look up each handle
- found = tracker.remove(type, handles[i]);
- EXPECT_EQ(&data[i], found);
- }
- }
-}
diff --git a/media/libaaudio/tests/test_timestamps.cpp b/media/libaaudio/tests/test_timestamps.cpp
new file mode 100644
index 0000000..b57f0a4
--- /dev/null
+++ b/media/libaaudio/tests/test_timestamps.cpp
@@ -0,0 +1,337 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Play silence and recover from dead servers or disconnected devices.
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <aaudio/AAudio.h>
+#include <aaudio/AAudioTesting.h>
+#include "utils/AAudioExampleUtils.h"
+#include "../examples/utils/AAudioExampleUtils.h"
+
+// Arbitrary period for glitches, once per second at 48000 Hz.
+#define FORCED_UNDERRUN_PERIOD_FRAMES 48000
+// How long to sleep in a callback to cause an intentional glitch. For testing.
+#define FORCED_UNDERRUN_SLEEP_MICROS (10 * 1000)
+
+#define MAX_TIMESTAMPS 1000
+
+#define DEFAULT_TIMEOUT_NANOS ((int64_t)1000000000)
+
+#define NUM_SECONDS 1
+#define NUM_LOOPS 4
+
+typedef struct TimestampInfo {
+ int64_t framesTotal;
+ int64_t appPosition; // frames
+ int64_t appNanoseconds;
+ int64_t timestampPosition; // frames
+ int64_t timestampNanos;
+ aaudio_result_t result;
+} TimestampInfo;
+
+typedef struct TimestampCallbackData_s {
+ TimestampInfo timestamps[MAX_TIMESTAMPS];
+ int64_t framesTotal = 0;
+ int64_t nextFrameToGlitch = FORCED_UNDERRUN_PERIOD_FRAMES;
+ int32_t timestampCount = 0; // in timestamps
+ bool forceUnderruns = false;
+} TimestampCallbackData_t;
+
+// Callback function that fills the audio output buffer.
+aaudio_data_callback_result_t timestampDataCallbackProc(
+ AAudioStream *stream,
+ void *userData,
+ void *audioData __unused,
+ int32_t numFrames
+) {
+
+ // should not happen but just in case...
+ if (userData == nullptr) {
+ printf("ERROR - SimplePlayerDataCallbackProc needs userData\n");
+ return AAUDIO_CALLBACK_RESULT_STOP;
+ }
+ TimestampCallbackData_t *timestampData = (TimestampCallbackData_t *) userData;
+
+ aaudio_direction_t direction = AAudioStream_getDirection(stream);
+ if (direction == AAUDIO_DIRECTION_INPUT) {
+ timestampData->framesTotal += numFrames;
+ }
+
+ if (timestampData->forceUnderruns) {
+ if (timestampData->framesTotal > timestampData->nextFrameToGlitch) {
+ usleep(FORCED_UNDERRUN_SLEEP_MICROS);
+ printf("Simulate glitch at %lld\n", (long long) timestampData->framesTotal);
+ timestampData->nextFrameToGlitch += FORCED_UNDERRUN_PERIOD_FRAMES;
+ }
+ }
+
+ if (timestampData->timestampCount < MAX_TIMESTAMPS) {
+ TimestampInfo *timestamp = ×tampData->timestamps[timestampData->timestampCount];
+ timestamp->result = AAudioStream_getTimestamp(stream,
+ CLOCK_MONOTONIC,
+ ×tamp->timestampPosition,
+ ×tamp->timestampNanos);
+ timestamp->framesTotal = timestampData->framesTotal;
+ timestamp->appPosition = (direction == AAUDIO_DIRECTION_OUTPUT)
+ ? AAudioStream_getFramesWritten(stream)
+ : AAudioStream_getFramesRead(stream);
+ timestamp->appNanoseconds = getNanoseconds();
+ timestampData->timestampCount++;
+ }
+
+ if (direction == AAUDIO_DIRECTION_OUTPUT) {
+ timestampData->framesTotal += numFrames;
+ }
+ return AAUDIO_CALLBACK_RESULT_CONTINUE;
+}
+
+static TimestampCallbackData_t sTimestampData;
+
+static aaudio_result_t testTimeStamps(aaudio_policy_t mmapPolicy,
+ aaudio_sharing_mode_t sharingMode,
+ aaudio_performance_mode_t performanceMode,
+ aaudio_direction_t direction) {
+ aaudio_result_t result = AAUDIO_OK;
+
+ int32_t framesPerBurst = 0;
+ int32_t actualChannelCount = 0;
+ int32_t actualSampleRate = 0;
+ int32_t originalBufferSize = 0;
+ int32_t requestedBufferSize = 0;
+ int32_t finalBufferSize = 0;
+ aaudio_format_t actualDataFormat = AAUDIO_FORMAT_PCM_FLOAT;
+ aaudio_sharing_mode_t actualSharingMode = AAUDIO_SHARING_MODE_SHARED;
+ aaudio_sharing_mode_t actualPerformanceMode = AAUDIO_PERFORMANCE_MODE_NONE;
+
+ AAudioStreamBuilder *aaudioBuilder = nullptr;
+ AAudioStream *aaudioStream = nullptr;
+
+ memset(&sTimestampData, 0, sizeof(sTimestampData));
+
+ printf("------------ testTimeStamps(policy = %d, sharing = %s, perf = %s, dir = %s) -----------\n",
+ mmapPolicy,
+ getSharingModeText(sharingMode),
+ getPerformanceModeText(performanceMode),
+ getDirectionText(direction));
+
+ AAudio_setMMapPolicy(mmapPolicy);
+
+ // Use an AAudioStreamBuilder to contain requested parameters.
+ result = AAudio_createStreamBuilder(&aaudioBuilder);
+ if (result != AAUDIO_OK) {
+ printf("AAudio_createStreamBuilder returned %s",
+ AAudio_convertResultToText(result));
+ goto finish;
+ }
+
+ // Request stream properties.
+ AAudioStreamBuilder_setFormat(aaudioBuilder, AAUDIO_FORMAT_PCM_I16);
+ AAudioStreamBuilder_setSharingMode(aaudioBuilder, sharingMode);
+ AAudioStreamBuilder_setPerformanceMode(aaudioBuilder, performanceMode);
+ AAudioStreamBuilder_setDirection(aaudioBuilder, direction);
+ AAudioStreamBuilder_setDataCallback(aaudioBuilder, timestampDataCallbackProc, &sTimestampData);
+
+ // Create an AAudioStream using the Builder.
+ result = AAudioStreamBuilder_openStream(aaudioBuilder, &aaudioStream);
+ if (result != AAUDIO_OK) {
+ printf("AAudioStreamBuilder_openStream returned %s",
+ AAudio_convertResultToText(result));
+ goto finish;
+ }
+
+ // Check to see what kind of stream we actually got.
+ actualSampleRate = AAudioStream_getSampleRate(aaudioStream);
+ actualChannelCount = AAudioStream_getChannelCount(aaudioStream);
+ actualDataFormat = AAudioStream_getFormat(aaudioStream);
+
+ actualSharingMode = AAudioStream_getSharingMode(aaudioStream);
+ if (actualSharingMode != sharingMode) {
+ printf("did not get expected sharingMode, got %3d, skipping test\n",
+ actualSharingMode);
+ result = AAUDIO_OK;
+ goto finish;
+ }
+ actualPerformanceMode = AAudioStream_getPerformanceMode(aaudioStream);
+ if (actualPerformanceMode != performanceMode) {
+ printf("did not get expected performanceMode, got %3d, skipping test\n",
+ actualPerformanceMode);
+ result = AAUDIO_OK;
+ goto finish;
+ }
+
+ printf(" chans = %3d, rate = %6d format = %d\n",
+ actualChannelCount, actualSampleRate, actualDataFormat);
+ printf(" Is MMAP used? %s\n", AAudioStream_isMMapUsed(aaudioStream)
+ ? "yes" : "no");
+
+ // This is the number of frames that are read in one chunk by a DMA controller
+ // or a DSP or a mixer.
+ framesPerBurst = AAudioStream_getFramesPerBurst(aaudioStream);
+ printf(" framesPerBurst = %3d\n", framesPerBurst);
+
+ originalBufferSize = AAudioStream_getBufferSizeInFrames(aaudioStream);
+ requestedBufferSize = 4 * framesPerBurst;
+ finalBufferSize = AAudioStream_setBufferSizeInFrames(aaudioStream, requestedBufferSize);
+
+ printf(" BufferSize: original = %4d, requested = %4d, final = %4d\n",
+ originalBufferSize, requestedBufferSize, finalBufferSize);
+
+ {
+ int64_t position;
+ int64_t nanoseconds;
+ result = AAudioStream_getTimestamp(aaudioStream, CLOCK_MONOTONIC, &position, &nanoseconds);
+ printf("before start, AAudioStream_getTimestamp() returns %s\n",
+ AAudio_convertResultToText(result));
+ }
+
+ for (int runs = 0; runs < NUM_LOOPS; runs++) {
+ printf("------------------ loop #%d\n", runs);
+
+ int64_t temp = sTimestampData.framesTotal;
+ memset(&sTimestampData, 0, sizeof(sTimestampData));
+ sTimestampData.framesTotal = temp;
+
+ sTimestampData.forceUnderruns = false;
+
+ result = AAudioStream_requestStart(aaudioStream);
+ if (result != AAUDIO_OK) {
+ printf("AAudioStream_requestStart returned %s",
+ AAudio_convertResultToText(result));
+ goto finish;
+ }
+
+ for (int second = 0; second < NUM_SECONDS; second++) {
+ // Give AAudio callback time to run in the background.
+ sleep(1);
+
+ // Periodically print the progress so we know it hasn't died.
+ printf("framesWritten = %d, XRuns = %d\n",
+ (int) AAudioStream_getFramesWritten(aaudioStream),
+ (int) AAudioStream_getXRunCount(aaudioStream)
+ );
+ }
+
+ result = AAudioStream_requestStop(aaudioStream);
+ if (result != AAUDIO_OK) {
+ printf("AAudioStream_requestStop returned %s\n",
+ AAudio_convertResultToText(result));
+ }
+
+ printf("timestampCount = %d\n", sTimestampData.timestampCount);
+ int printed = 0;
+ for (int i = 0; i < sTimestampData.timestampCount; i++) {
+ TimestampInfo *timestamp = &sTimestampData.timestamps[i];
+ bool posChanged = (timestamp->timestampPosition != (timestamp - 1)->timestampPosition);
+ bool timeChanged = (timestamp->timestampNanos != (timestamp - 1)->timestampNanos);
+ if ((printed < 20) && ((i < 10) || posChanged || timeChanged)) {
+ printf(" %3d : frames %8lld, xferd %8lld", i,
+ (long long) timestamp->framesTotal,
+ (long long) timestamp->appPosition);
+ if (timestamp->result != AAUDIO_OK) {
+ printf(", result = %s\n", AAudio_convertResultToText(timestamp->result));
+ } else {
+ bool negative = timestamp->timestampPosition < 0;
+ bool retro = (i > 0 && (timestamp->timestampPosition <
+ (timestamp - 1)->timestampPosition));
+ const char *message = negative ? " <=NEGATIVE!"
+ : (retro ? " <= RETROGRADE!" : "");
+
+ double latency = calculateLatencyMillis(timestamp->timestampPosition,
+ timestamp->timestampNanos,
+ timestamp->appPosition,
+ timestamp->appNanoseconds,
+ actualSampleRate);
+ printf(", STAMP: pos = %8lld, nanos = %8lld, lat = %7.1f msec %s\n",
+ (long long) timestamp->timestampPosition,
+ (long long) timestamp->timestampNanos,
+ latency,
+ message);
+ }
+ printed++;
+ }
+ }
+
+ // Avoid race conditions in AudioFlinger.
+ // There is normally a delay between a real user stopping and restarting a stream.
+ sleep(1);
+ }
+
+finish:
+ if (aaudioStream != nullptr) {
+ AAudioStream_close(aaudioStream);
+ }
+ AAudioStreamBuilder_delete(aaudioBuilder);
+ printf("result = %d = %s\n", result, AAudio_convertResultToText(result));
+
+ return result;
+}
+
+int main(int argc, char **argv) {
+ (void) argc;
+ (void) argv;
+
+ aaudio_result_t result = AAUDIO_OK;
+
+ // Make printf print immediately so that debug info is not stuck
+ // in a buffer if we hang or crash.
+ setvbuf(stdout, nullptr, _IONBF, (size_t) 0);
+
+ printf("Test Timestamps V0.1.3\n");
+
+ // Legacy
+ aaudio_policy_t policy = AAUDIO_POLICY_NEVER;
+ result = testTimeStamps(policy,
+ AAUDIO_SHARING_MODE_SHARED,
+ AAUDIO_PERFORMANCE_MODE_NONE,
+ AAUDIO_DIRECTION_INPUT);
+ result = testTimeStamps(policy,
+ AAUDIO_SHARING_MODE_SHARED,
+ AAUDIO_PERFORMANCE_MODE_LOW_LATENCY,
+ AAUDIO_DIRECTION_INPUT);
+ result = testTimeStamps(policy,
+ AAUDIO_SHARING_MODE_SHARED,
+ AAUDIO_PERFORMANCE_MODE_NONE,
+ AAUDIO_DIRECTION_OUTPUT);
+ result = testTimeStamps(policy,
+ AAUDIO_SHARING_MODE_SHARED,
+ AAUDIO_PERFORMANCE_MODE_LOW_LATENCY,
+ AAUDIO_DIRECTION_OUTPUT);
+
+ // MMAP
+ policy = AAUDIO_POLICY_ALWAYS;
+ result = testTimeStamps(policy,
+ AAUDIO_SHARING_MODE_EXCLUSIVE,
+ AAUDIO_PERFORMANCE_MODE_LOW_LATENCY,
+ AAUDIO_DIRECTION_INPUT);
+ result = testTimeStamps(policy,
+ AAUDIO_SHARING_MODE_EXCLUSIVE,
+ AAUDIO_PERFORMANCE_MODE_LOW_LATENCY,
+ AAUDIO_DIRECTION_OUTPUT);
+ result = testTimeStamps(policy,
+ AAUDIO_SHARING_MODE_SHARED,
+ AAUDIO_PERFORMANCE_MODE_LOW_LATENCY,
+ AAUDIO_DIRECTION_INPUT);
+ result = testTimeStamps(policy,
+ AAUDIO_SHARING_MODE_SHARED,
+ AAUDIO_PERFORMANCE_MODE_LOW_LATENCY,
+ AAUDIO_DIRECTION_OUTPUT);
+
+ return (result == AAUDIO_OK) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
diff --git a/media/libaudioclient/AudioEffect.cpp b/media/libaudioclient/AudioEffect.cpp
index a5f9ab6..b1cb0e7 100644
--- a/media/libaudioclient/AudioEffect.cpp
+++ b/media/libaudioclient/AudioEffect.cpp
@@ -135,7 +135,11 @@
&mStatus, &mId, &enabled);
if (iEffect == 0 || (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS)) {
- ALOGE("set(): AudioFlinger could not create effect, status: %d", mStatus);
+ char typeBuffer[64], uuidBuffer[64];
+ guidToString(type, typeBuffer, sizeof(typeBuffer));
+ guidToString(uuid, uuidBuffer, sizeof(uuidBuffer));
+ ALOGE("set(): AudioFlinger could not create effect %s / %s, status: %d",
+ typeBuffer, uuidBuffer, mStatus);
if (iEffect == 0) {
mStatus = NO_INIT;
}
diff --git a/media/libaudioclient/AudioRecord.cpp b/media/libaudioclient/AudioRecord.cpp
index 611cde7..ba4acc6 100644
--- a/media/libaudioclient/AudioRecord.cpp
+++ b/media/libaudioclient/AudioRecord.cpp
@@ -120,7 +120,7 @@
}
// No lock here: worst case we remove a NULL callback which will be a nop
if (mDeviceCallback != 0 && mInput != AUDIO_IO_HANDLE_NONE) {
- AudioSystem::removeAudioDeviceCallback(mDeviceCallback, mInput);
+ AudioSystem::removeAudioDeviceCallback(this, mInput);
}
IInterface::asBinder(mAudioRecord)->unlinkToDeath(mDeathNotifier, this);
mAudioRecord.clear();
@@ -274,7 +274,7 @@
mStatus = NO_ERROR;
mUserData = user;
// TODO: add audio hardware input latency here
- mLatency = (1000 * mFrameCount) / mSampleRate;
+ mLatency = (1000LL * mFrameCount) / mSampleRate;
mMarkerPosition = 0;
mMarkerReached = false;
mNewPosition = 0;
@@ -499,19 +499,26 @@
return mSelectedDeviceId;
}
+// must be called with mLock held
+void AudioRecord::updateRoutedDeviceId_l()
+{
+ // if the record is inactive, do not update actual device as the input stream maybe routed
+ // from a device not relevant to this client because of other active use cases.
+ if (!mActive) {
+ return;
+ }
+ if (mInput != AUDIO_IO_HANDLE_NONE) {
+ audio_port_handle_t deviceId = AudioSystem::getDeviceIdForIo(mInput);
+ if (deviceId != AUDIO_PORT_HANDLE_NONE) {
+ mRoutedDeviceId = deviceId;
+ }
+ }
+}
+
audio_port_handle_t AudioRecord::getRoutedDeviceId() {
AutoMutex lock(mLock);
- if (mInput == AUDIO_IO_HANDLE_NONE) {
- return AUDIO_PORT_HANDLE_NONE;
- }
- // if the input stream does not have an active audio patch, use either the device initially
- // selected by audio policy manager or the last routed device
- audio_port_handle_t deviceId = AudioSystem::getDeviceIdForIo(mInput);
- if (deviceId == AUDIO_PORT_HANDLE_NONE) {
- deviceId = mRoutedDeviceId;
- }
- mRoutedDeviceId = deviceId;
- return deviceId;
+ updateRoutedDeviceId_l();
+ return mRoutedDeviceId;
}
// -------------------------------------------------------------------------
@@ -537,9 +544,6 @@
return NO_INIT;
}
- if (mDeviceCallback != 0 && mInput != AUDIO_IO_HANDLE_NONE) {
- AudioSystem::removeAudioDeviceCallback(mDeviceCallback, mInput);
- }
audio_io_handle_t input;
// mFlags (not mOrigFlags) is modified depending on whether fast request is accepted.
@@ -744,6 +748,15 @@
}
mNotificationFramesAct = (uint32_t) notificationFrames;
+
+ //mInput != input includes the case where mInput == AUDIO_IO_HANDLE_NONE for first creation
+ if (mDeviceCallback != 0 && mInput != input) {
+ if (mInput != AUDIO_IO_HANDLE_NONE) {
+ AudioSystem::removeAudioDeviceCallback(this, mInput);
+ }
+ AudioSystem::addAudioDeviceCallback(this, input);
+ }
+
// We retain a copy of the I/O handle, but don't own the reference
mInput = input;
mRefreshRemaining = true;
@@ -763,10 +776,6 @@
mDeathNotifier = new DeathNotifier(this);
IInterface::asBinder(mAudioRecord)->linkToDeath(mDeathNotifier, this);
- if (mDeviceCallback != 0) {
- AudioSystem::addAudioDeviceCallback(mDeviceCallback, mInput);
- }
-
return NO_ERROR;
// End of retry loop.
@@ -1238,7 +1247,7 @@
return BAD_VALUE;
}
AutoMutex lock(mLock);
- if (mDeviceCallback == callback) {
+ if (mDeviceCallback.unsafe_get() == callback.get()) {
ALOGW("%s adding same callback!", __FUNCTION__);
return INVALID_OPERATION;
}
@@ -1246,9 +1255,9 @@
if (mInput != AUDIO_IO_HANDLE_NONE) {
if (mDeviceCallback != 0) {
ALOGW("%s callback already present!", __FUNCTION__);
- AudioSystem::removeAudioDeviceCallback(mDeviceCallback, mInput);
+ AudioSystem::removeAudioDeviceCallback(this, mInput);
}
- status = AudioSystem::addAudioDeviceCallback(callback, mInput);
+ status = AudioSystem::addAudioDeviceCallback(this, mInput);
}
mDeviceCallback = callback;
return status;
@@ -1262,17 +1271,38 @@
return BAD_VALUE;
}
AutoMutex lock(mLock);
- if (mDeviceCallback != callback) {
+ if (mDeviceCallback.unsafe_get() != callback.get()) {
ALOGW("%s removing different callback!", __FUNCTION__);
return INVALID_OPERATION;
}
+ mDeviceCallback.clear();
if (mInput != AUDIO_IO_HANDLE_NONE) {
- AudioSystem::removeAudioDeviceCallback(mDeviceCallback, mInput);
+ AudioSystem::removeAudioDeviceCallback(this, mInput);
}
- mDeviceCallback = 0;
return NO_ERROR;
}
+void AudioRecord::onAudioDeviceUpdate(audio_io_handle_t audioIo,
+ audio_port_handle_t deviceId)
+{
+ sp<AudioSystem::AudioDeviceCallback> callback;
+ {
+ AutoMutex lock(mLock);
+ if (audioIo != mInput) {
+ return;
+ }
+ callback = mDeviceCallback.promote();
+ // only update device if the record is active as route changes due to other use cases are
+ // irrelevant for this client
+ if (mActive) {
+ mRoutedDeviceId = deviceId;
+ }
+ }
+ if (callback.get() != nullptr) {
+ callback->onAudioDeviceUpdate(mInput, mRoutedDeviceId);
+ }
+}
+
// =========================================================================
void AudioRecord::DeathNotifier::binderDied(const wp<IBinder>& who __unused)
diff --git a/media/libaudioclient/AudioSystem.cpp b/media/libaudioclient/AudioSystem.cpp
index 2f710bd..cdc75ac 100644
--- a/media/libaudioclient/AudioSystem.cpp
+++ b/media/libaudioclient/AudioSystem.cpp
@@ -493,14 +493,16 @@
if (ioDesc == 0 || ioDesc->mIoHandle == AUDIO_IO_HANDLE_NONE) return;
audio_port_handle_t deviceId = AUDIO_PORT_HANDLE_NONE;
- Vector < sp<AudioDeviceCallback> > callbacks;
+ Vector < wp<AudioDeviceCallback> > callbacks;
{
Mutex::Autolock _l(mLock);
switch (event) {
case AUDIO_OUTPUT_OPENED:
- case AUDIO_INPUT_OPENED: {
+ case AUDIO_OUTPUT_REGISTERED:
+ case AUDIO_INPUT_OPENED:
+ case AUDIO_INPUT_REGISTERED: {
sp<AudioIoDescriptor> oldDesc = getIoDescriptor_l(ioDesc->mIoHandle);
if (oldDesc == 0) {
mIoDescriptors.add(ioDesc->mIoHandle, ioDesc);
@@ -511,13 +513,19 @@
if (ioDesc->getDeviceId() != AUDIO_PORT_HANDLE_NONE) {
deviceId = ioDesc->getDeviceId();
- ssize_t ioIndex = mAudioDeviceCallbacks.indexOfKey(ioDesc->mIoHandle);
- if (ioIndex >= 0) {
- callbacks = mAudioDeviceCallbacks.valueAt(ioIndex);
+ if (event == AUDIO_OUTPUT_OPENED || event == AUDIO_INPUT_OPENED) {
+ ssize_t ioIndex = mAudioDeviceCallbacks.indexOfKey(ioDesc->mIoHandle);
+ if (ioIndex >= 0) {
+ callbacks = mAudioDeviceCallbacks.valueAt(ioIndex);
+ }
}
}
- ALOGV("ioConfigChanged() new %s opened %d samplingRate %u, format %#x channel mask %#x "
- "frameCount %zu deviceId %d", event == AUDIO_OUTPUT_OPENED ? "output" : "input",
+ ALOGV("ioConfigChanged() new %s %s %d samplingRate %u, format %#x channel mask %#x "
+ "frameCount %zu deviceId %d",
+ event == AUDIO_OUTPUT_OPENED || event == AUDIO_OUTPUT_REGISTERED ?
+ "output" : "input",
+ event == AUDIO_OUTPUT_OPENED || event == AUDIO_INPUT_OPENED ?
+ "opened" : "registered",
ioDesc->mIoHandle, ioDesc->mSamplingRate, ioDesc->mFormat, ioDesc->mChannelMask,
ioDesc->mFrameCount, ioDesc->getDeviceId());
} break;
@@ -563,9 +571,23 @@
} break;
}
}
+ bool callbackRemoved = false;
// callbacks.size() != 0 => ioDesc->mIoHandle and deviceId are valid
- for (size_t i = 0; i < callbacks.size(); i++) {
- callbacks[i]->onAudioDeviceUpdate(ioDesc->mIoHandle, deviceId);
+ for (size_t i = 0; i < callbacks.size(); ) {
+ sp<AudioDeviceCallback> callback = callbacks[i].promote();
+ if (callback.get() != nullptr) {
+ callback->onAudioDeviceUpdate(ioDesc->mIoHandle, deviceId);
+ i++;
+ } else {
+ callbacks.removeAt(i);
+ callbackRemoved = true;
+ }
+ }
+ // clean up callback list while we are here if some clients have disappeared without
+ // unregistering their callback
+ if (callbackRemoved) {
+ Mutex::Autolock _l(mLock);
+ mAudioDeviceCallbacks.replaceValueFor(ioDesc->mIoHandle, callbacks);
}
}
@@ -618,17 +640,17 @@
}
status_t AudioSystem::AudioFlingerClient::addAudioDeviceCallback(
- const sp<AudioDeviceCallback>& callback, audio_io_handle_t audioIo)
+ const wp<AudioDeviceCallback>& callback, audio_io_handle_t audioIo)
{
Mutex::Autolock _l(mLock);
- Vector < sp<AudioDeviceCallback> > callbacks;
+ Vector < wp<AudioDeviceCallback> > callbacks;
ssize_t ioIndex = mAudioDeviceCallbacks.indexOfKey(audioIo);
if (ioIndex >= 0) {
callbacks = mAudioDeviceCallbacks.valueAt(ioIndex);
}
for (size_t cbIndex = 0; cbIndex < callbacks.size(); cbIndex++) {
- if (callbacks[cbIndex] == callback) {
+ if (callbacks[cbIndex].unsafe_get() == callback.unsafe_get()) {
return INVALID_OPERATION;
}
}
@@ -639,18 +661,18 @@
}
status_t AudioSystem::AudioFlingerClient::removeAudioDeviceCallback(
- const sp<AudioDeviceCallback>& callback, audio_io_handle_t audioIo)
+ const wp<AudioDeviceCallback>& callback, audio_io_handle_t audioIo)
{
Mutex::Autolock _l(mLock);
ssize_t ioIndex = mAudioDeviceCallbacks.indexOfKey(audioIo);
if (ioIndex < 0) {
return INVALID_OPERATION;
}
- Vector < sp<AudioDeviceCallback> > callbacks = mAudioDeviceCallbacks.valueAt(ioIndex);
+ Vector < wp<AudioDeviceCallback> > callbacks = mAudioDeviceCallbacks.valueAt(ioIndex);
size_t cbIndex;
for (cbIndex = 0; cbIndex < callbacks.size(); cbIndex++) {
- if (callbacks[cbIndex] == callback) {
+ if (callbacks[cbIndex].unsafe_get() == callback.unsafe_get()) {
break;
}
}
@@ -1128,7 +1150,7 @@
}
status_t AudioSystem::addAudioDeviceCallback(
- const sp<AudioDeviceCallback>& callback, audio_io_handle_t audioIo)
+ const wp<AudioDeviceCallback>& callback, audio_io_handle_t audioIo)
{
const sp<AudioFlingerClient> afc = getAudioFlingerClient();
if (afc == 0) {
@@ -1145,7 +1167,7 @@
}
status_t AudioSystem::removeAudioDeviceCallback(
- const sp<AudioDeviceCallback>& callback, audio_io_handle_t audioIo)
+ const wp<AudioDeviceCallback>& callback, audio_io_handle_t audioIo)
{
const sp<AudioFlingerClient> afc = getAudioFlingerClient();
if (afc == 0) {
@@ -1297,7 +1319,7 @@
}
void AudioSystem::AudioPolicyServiceClient::onRecordingConfigurationUpdate(
- int event, audio_session_t session, audio_source_t source,
+ int event, const record_client_info_t *clientInfo,
const audio_config_base_t *clientConfig, const audio_config_base_t *deviceConfig,
audio_patch_handle_t patchHandle) {
record_config_callback cb = NULL;
@@ -1307,7 +1329,7 @@
}
if (cb != NULL) {
- cb(event, session, source, clientConfig, deviceConfig, patchHandle);
+ cb(event, clientInfo, clientConfig, deviceConfig, patchHandle);
}
}
diff --git a/media/libaudioclient/AudioTrack.cpp b/media/libaudioclient/AudioTrack.cpp
index acf5a45..c6622cd 100644
--- a/media/libaudioclient/AudioTrack.cpp
+++ b/media/libaudioclient/AudioTrack.cpp
@@ -22,6 +22,7 @@
#include <math.h>
#include <sys/resource.h>
+#include <audio_utils/clock.h>
#include <audio_utils/primitives.h>
#include <binder/IPCThreadState.h>
#include <media/AudioTrack.h>
@@ -62,9 +63,12 @@
return tv.tv_sec * 1000000ll + tv.tv_nsec / 1000;
}
-static inline nsecs_t convertTimespecToNs(const struct timespec &tv)
-{
- return tv.tv_sec * (long long)NANOS_PER_SECOND + tv.tv_nsec;
+// TODO move to audio_utils.
+static inline struct timespec convertNsToTimespec(int64_t ns) {
+ struct timespec tv;
+ tv.tv_sec = static_cast<time_t>(ns / NANOS_PER_SECOND);
+ tv.tv_nsec = static_cast<long>(ns % NANOS_PER_SECOND);
+ return tv;
}
// current monotonic time in microseconds.
@@ -272,7 +276,7 @@
}
// No lock here: worst case we remove a NULL callback which will be a nop
if (mDeviceCallback != 0 && mOutput != AUDIO_IO_HANDLE_NONE) {
- AudioSystem::removeAudioDeviceCallback(mDeviceCallback, mOutput);
+ AudioSystem::removeAudioDeviceCallback(this, mOutput);
}
IInterface::asBinder(mAudioTrack)->unlinkToDeath(mDeathNotifier, this);
mAudioTrack.clear();
@@ -543,7 +547,8 @@
mUpdatePeriod = 0;
mPosition = 0;
mReleased = 0;
- mStartUs = 0;
+ mStartNs = 0;
+ mStartFromZeroUs = 0;
AudioSystem::acquireAudioSessionId(mSessionId, mClientPid);
mSequence = 1;
mObservedSequence = mSequence;
@@ -591,6 +596,7 @@
mStartEts.clear();
}
}
+ mStartNs = systemTime(); // save this for timestamp adjustment after starting.
if (previousState == STATE_STOPPED || previousState == STATE_FLUSHED) {
// reset current position as seen by client to 0
mPosition = 0;
@@ -609,7 +615,8 @@
+ mStartEts.mPosition[ExtendedTimestamp::LOCATION_SERVER]),
(long long)mStartEts.mFlushed,
(long long)mFramesWritten);
- mFramesWrittenServerOffset = -mStartEts.mPosition[ExtendedTimestamp::LOCATION_SERVER];
+ // mStartEts is already adjusted by mFramesWrittenServerOffset, so we delta adjust.
+ mFramesWrittenServerOffset -= mStartEts.mPosition[ExtendedTimestamp::LOCATION_SERVER];
}
mFramesWritten = 0;
mProxy->clearTimestamp(); // need new server push for valid timestamp
@@ -619,7 +626,7 @@
// since the flush is asynchronous and stop may not fully drain.
// We save the time when the track is started to later verify whether
// the counters are realistic (i.e. start from zero after this time).
- mStartUs = getNowUs();
+ mStartFromZeroUs = mStartNs / 1000;
// force refresh of remaining frames by processAudioBuffer() as last
// write before stop could be partial.
@@ -1222,19 +1229,26 @@
return mSelectedDeviceId;
}
+// must be called with mLock held
+void AudioTrack::updateRoutedDeviceId_l()
+{
+ // if the track is inactive, do not update actual device as the output stream maybe routed
+ // to a device not relevant to this client because of other active use cases.
+ if (mState != STATE_ACTIVE) {
+ return;
+ }
+ if (mOutput != AUDIO_IO_HANDLE_NONE) {
+ audio_port_handle_t deviceId = AudioSystem::getDeviceIdForIo(mOutput);
+ if (deviceId != AUDIO_PORT_HANDLE_NONE) {
+ mRoutedDeviceId = deviceId;
+ }
+ }
+}
+
audio_port_handle_t AudioTrack::getRoutedDeviceId() {
AutoMutex lock(mLock);
- if (mOutput == AUDIO_IO_HANDLE_NONE) {
- return AUDIO_PORT_HANDLE_NONE;
- }
- // if the output stream does not have an active audio patch, use either the device initially
- // selected by audio policy manager or the last routed device
- audio_port_handle_t deviceId = AudioSystem::getDeviceIdForIo(mOutput);
- if (deviceId == AUDIO_PORT_HANDLE_NONE) {
- deviceId = mRoutedDeviceId;
- }
- mRoutedDeviceId = deviceId;
- return deviceId;
+ updateRoutedDeviceId_l();
+ return mRoutedDeviceId;
}
status_t AudioTrack::attachAuxEffect(int effectId)
@@ -1272,7 +1286,7 @@
ALOGW("getLatency(%d) failed status %d", mOutput, status);
} else {
// FIXME don't believe this lie
- mLatency = mAfLatency + (1000 * mFrameCount) / mSampleRate;
+ mLatency = mAfLatency + (1000LL * mFrameCount) / mSampleRate;
}
}
@@ -1298,12 +1312,10 @@
return NO_INIT;
}
- if (mDeviceCallback != 0 && mOutput != AUDIO_IO_HANDLE_NONE) {
- AudioSystem::removeAudioDeviceCallback(mDeviceCallback, mOutput);
- }
audio_io_handle_t output;
audio_stream_type_t streamType = mStreamType;
audio_attributes_t *attr = (mStreamType == AUDIO_STREAM_DEFAULT) ? &mAttributes : NULL;
+ bool callbackAdded = false;
// mFlags (not mOrigFlags) is modified depending on whether fast request is accepted.
// After fast request is denied, we will request again if IAudioTrack is re-created.
@@ -1508,12 +1520,14 @@
sp<IMemory> iMem = track->getCblk();
if (iMem == 0) {
ALOGE("Could not get control block");
- return NO_INIT;
+ status = NO_INIT;
+ goto release;
}
void *iMemPointer = iMem->pointer();
if (iMemPointer == NULL) {
ALOGE("Could not get control block pointer");
- return NO_INIT;
+ status = NO_INIT;
+ goto release;
}
// invariant that mAudioTrack != 0 is true only after set() returns successfully
if (mAudioTrack != 0) {
@@ -1584,6 +1598,15 @@
}
}
+ //mOutput != output includes the case where mOutput == AUDIO_IO_HANDLE_NONE for first creation
+ if (mDeviceCallback != 0 && mOutput != output) {
+ if (mOutput != AUDIO_IO_HANDLE_NONE) {
+ AudioSystem::removeAudioDeviceCallback(this, mOutput);
+ }
+ AudioSystem::addAudioDeviceCallback(this, output);
+ callbackAdded = true;
+ }
+
// We retain a copy of the I/O handle, but don't own the reference
mOutput = output;
mRefreshRemaining = true;
@@ -1599,7 +1622,8 @@
buffers = mSharedBuffer->pointer();
if (buffers == NULL) {
ALOGE("Could not get buffer pointer");
- return NO_INIT;
+ status = NO_INIT;
+ goto release;
}
}
@@ -1644,15 +1668,15 @@
mDeathNotifier = new DeathNotifier(this);
IInterface::asBinder(mAudioTrack)->linkToDeath(mDeathNotifier, this);
- if (mDeviceCallback != 0) {
- AudioSystem::addAudioDeviceCallback(mDeviceCallback, mOutput);
- }
-
return NO_ERROR;
}
release:
AudioSystem::releaseOutput(output, streamType, mSessionId);
+ if (callbackAdded) {
+ // note: mOutput is always valid is callbackAdded is true
+ AudioSystem::removeAudioDeviceCallback(this, mOutput);
+ }
if (status == NO_ERROR) {
status = NO_INIT;
}
@@ -2099,7 +2123,14 @@
// Convert frame units to time units
nsecs_t ns = NS_WHENEVER;
if (minFrames != (uint32_t) ~0) {
- ns = framesToNanoseconds(minFrames, sampleRate, speed) + kWaitPeriodNs;
+ // AudioFlinger consumption of client data may be irregular when coming out of device
+ // standby since the kernel buffers require filling. This is throttled to no more than 2x
+ // the expected rate in the MixerThread. Hence, we reduce the estimated time to wait by one
+ // half (but no more than half a second) to improve callback accuracy during these temporary
+ // data surges.
+ const nsecs_t estimatedNs = framesToNanoseconds(minFrames, sampleRate, speed);
+ constexpr nsecs_t maxThrottleCompensationNs = 500000000LL;
+ ns = estimatedNs - min(estimatedNs / 2, maxThrottleCompensationNs) + kWaitPeriodNs;
ns -= (timeAfterCallbacks - timeBeforeCallbacks); // account for callback time
// TODO: Should we warn if the callback time is too long?
if (ns < 0) ns = 0;
@@ -2572,7 +2603,7 @@
// We update the timestamp time even when paused.
if (mState == STATE_PAUSED /* not needed: STATE_PAUSED_STOPPING */) {
const int64_t now = systemTime();
- const int64_t at = convertTimespecToNs(timestamp.mTime);
+ const int64_t at = audio_utils_ns_from_timespec(×tamp.mTime);
const int64_t lag =
(ets.mTimeNs[ExtendedTimestamp::LOCATION_SERVER_LASTKERNELOK] < 0 ||
ets.mTimeNs[ExtendedTimestamp::LOCATION_KERNEL_LASTKERNELOK] < 0)
@@ -2584,8 +2615,7 @@
if (at < limit) {
ALOGV("timestamp pause lag:%lld adjusting from %lld to %lld",
(long long)lag, (long long)at, (long long)limit);
- timestamp.mTime.tv_sec = limit / NANOS_PER_SECOND;
- timestamp.mTime.tv_nsec = limit % NANOS_PER_SECOND; // compiler opt.
+ timestamp.mTime = convertNsToTimespec(limit);
}
}
mPreviousLocation = location;
@@ -2628,18 +2658,18 @@
// the previous song under gapless playback.
// However, we sometimes see zero timestamps, then a glitch of
// the previous song's position, and then correct timestamps afterwards.
- if (mStartUs != 0 && mSampleRate != 0) {
+ if (mStartFromZeroUs != 0 && mSampleRate != 0) {
static const int kTimeJitterUs = 100000; // 100 ms
static const int k1SecUs = 1000000;
const int64_t timeNow = getNowUs();
- if (timeNow < mStartUs + k1SecUs) { // within first second of starting
+ if (timeNow < mStartFromZeroUs + k1SecUs) { // within first second of starting
const int64_t timestampTimeUs = convertTimespecToUs(timestamp.mTime);
- if (timestampTimeUs < mStartUs) {
+ if (timestampTimeUs < mStartFromZeroUs) {
return WOULD_BLOCK; // stale timestamp time, occurs before start.
}
- const int64_t deltaTimeUs = timestampTimeUs - mStartUs;
+ const int64_t deltaTimeUs = timestampTimeUs - mStartFromZeroUs;
const int64_t deltaPositionByUs = (double)timestamp.mPosition * 1000000
/ ((double)mSampleRate * mPlaybackRate.mSpeed);
@@ -2662,10 +2692,10 @@
return WOULD_BLOCK;
}
if (deltaPositionByUs != 0) {
- mStartUs = 0; // don't check again, we got valid nonzero position.
+ mStartFromZeroUs = 0; // don't check again, we got valid nonzero position.
}
} else {
- mStartUs = 0; // don't check again, start time expired.
+ mStartFromZeroUs = 0; // don't check again, start time expired.
}
mTimestampStartupGlitchReported = false;
}
@@ -2703,13 +2733,33 @@
// Prevent retrograde motion in timestamp.
// This is sometimes caused by erratic reports of the available space in the ALSA drivers.
if (status == NO_ERROR) {
+ // previousTimestampValid is set to false when starting after a stop or flush.
if (previousTimestampValid) {
- const int64_t previousTimeNanos = convertTimespecToNs(mPreviousTimestamp.mTime);
- const int64_t currentTimeNanos = convertTimespecToNs(timestamp.mTime);
+ const int64_t previousTimeNanos =
+ audio_utils_ns_from_timespec(&mPreviousTimestamp.mTime);
+ int64_t currentTimeNanos = audio_utils_ns_from_timespec(×tamp.mTime);
+
+ // Fix stale time when checking timestamp right after start().
+ //
+ // For offload compatibility, use a default lag value here.
+ // Any time discrepancy between this update and the pause timestamp is handled
+ // by the retrograde check afterwards.
+ const int64_t lagNs = int64_t(mAfLatency * 1000000LL);
+ const int64_t limitNs = mStartNs - lagNs;
+ if (currentTimeNanos < limitNs) {
+ ALOGD("correcting timestamp time for pause, "
+ "currentTimeNanos: %lld < limitNs: %lld < mStartNs: %lld",
+ (long long)currentTimeNanos, (long long)limitNs, (long long)mStartNs);
+ timestamp.mTime = convertNsToTimespec(limitNs);
+ currentTimeNanos = limitNs;
+ }
+
+ // retrograde check
if (currentTimeNanos < previousTimeNanos) {
ALOGW("retrograde timestamp time corrected, %lld < %lld",
(long long)currentTimeNanos, (long long)previousTimeNanos);
timestamp.mTime = mPreviousTimestamp.mTime;
+ // currentTimeNanos not used below.
}
// Looking at signed delta will work even when the timestamps
@@ -2735,7 +2785,7 @@
#if 0
// Uncomment this to verify audio timestamp rate.
const int64_t deltaTime =
- convertTimespecToNs(timestamp.mTime) - previousTimeNanos;
+ audio_utils_ns_from_timespec(×tamp.mTime) - previousTimeNanos;
if (deltaTime != 0) {
const int64_t computedSampleRate =
deltaPosition * (long long)NANOS_PER_SECOND / deltaTime;
@@ -2827,7 +2877,7 @@
return BAD_VALUE;
}
AutoMutex lock(mLock);
- if (mDeviceCallback == callback) {
+ if (mDeviceCallback.unsafe_get() == callback.get()) {
ALOGW("%s adding same callback!", __FUNCTION__);
return INVALID_OPERATION;
}
@@ -2835,9 +2885,9 @@
if (mOutput != AUDIO_IO_HANDLE_NONE) {
if (mDeviceCallback != 0) {
ALOGW("%s callback already present!", __FUNCTION__);
- AudioSystem::removeAudioDeviceCallback(mDeviceCallback, mOutput);
+ AudioSystem::removeAudioDeviceCallback(this, mOutput);
}
- status = AudioSystem::addAudioDeviceCallback(callback, mOutput);
+ status = AudioSystem::addAudioDeviceCallback(this, mOutput);
}
mDeviceCallback = callback;
return status;
@@ -2851,17 +2901,39 @@
return BAD_VALUE;
}
AutoMutex lock(mLock);
- if (mDeviceCallback != callback) {
+ if (mDeviceCallback.unsafe_get() != callback.get()) {
ALOGW("%s removing different callback!", __FUNCTION__);
return INVALID_OPERATION;
}
+ mDeviceCallback.clear();
if (mOutput != AUDIO_IO_HANDLE_NONE) {
- AudioSystem::removeAudioDeviceCallback(mDeviceCallback, mOutput);
+ AudioSystem::removeAudioDeviceCallback(this, mOutput);
}
- mDeviceCallback = 0;
return NO_ERROR;
}
+
+void AudioTrack::onAudioDeviceUpdate(audio_io_handle_t audioIo,
+ audio_port_handle_t deviceId)
+{
+ sp<AudioSystem::AudioDeviceCallback> callback;
+ {
+ AutoMutex lock(mLock);
+ if (audioIo != mOutput) {
+ return;
+ }
+ callback = mDeviceCallback.promote();
+ // only update device if the track is active as route changes due to other use cases are
+ // irrelevant for this client
+ if (mState == STATE_ACTIVE) {
+ mRoutedDeviceId = deviceId;
+ }
+ }
+ if (callback.get() != nullptr) {
+ callback->onAudioDeviceUpdate(mOutput, mRoutedDeviceId);
+ }
+}
+
status_t AudioTrack::pendingDuration(int32_t *msec, ExtendedTimestamp::Location location)
{
if (msec == nullptr ||
@@ -2919,7 +2991,7 @@
case STATE_STOPPED:
if (isOffloadedOrDirect_l()) {
// check if we have started in the past to return true.
- return mStartUs > 0;
+ return mStartFromZeroUs > 0;
}
// A normal audio track may still be draining, so
// check if stream has ended. This covers fasttrack position
diff --git a/media/libaudioclient/AudioTrackShared.cpp b/media/libaudioclient/AudioTrackShared.cpp
index 08c37f8..7bf4f99 100644
--- a/media/libaudioclient/AudioTrackShared.cpp
+++ b/media/libaudioclient/AudioTrackShared.cpp
@@ -36,7 +36,7 @@
// a value between "other" + 1 and "other" + INT32_MAX, the choice of
// which needs to be the "least recently used" sequence value for "self".
// In general, this means (new_self) returned is max(self, other) + 1.
-
+__attribute__((no_sanitize("integer")))
static uint32_t incrementSequence(uint32_t self, uint32_t other) {
int32_t diff = (int32_t) self - (int32_t) other;
if (diff >= 0 && diff < INT32_MAX) {
@@ -393,6 +393,7 @@
// ---------------------------------------------------------------------------
+__attribute__((no_sanitize("integer")))
void AudioTrackClientProxy::flush()
{
// This works for mFrameCountP2 <= 2^30
@@ -840,6 +841,25 @@
return filled;
}
+__attribute__((no_sanitize("integer")))
+size_t AudioTrackServerProxy::framesReadySafe() const
+{
+ if (mIsShutdown) {
+ return 0;
+ }
+ const audio_track_cblk_t* cblk = mCblk;
+ const int32_t flush = android_atomic_acquire_load(&cblk->u.mStreaming.mFlush);
+ if (flush != mFlush) {
+ return mFrameCount;
+ }
+ const int32_t rear = android_atomic_acquire_load(&cblk->u.mStreaming.mRear);
+ const ssize_t filled = rear - cblk->u.mStreaming.mFront;
+ if (!(0 <= filled && (size_t) filled <= mFrameCount)) {
+ return 0; // error condition, silently return 0.
+ }
+ return filled;
+}
+
bool AudioTrackServerProxy::setStreamEndDone() {
audio_track_cblk_t* cblk = mCblk;
bool old =
@@ -851,6 +871,7 @@
return old;
}
+__attribute__((no_sanitize("integer")))
void AudioTrackServerProxy::tallyUnderrunFrames(uint32_t frameCount)
{
audio_track_cblk_t* cblk = mCblk;
@@ -908,6 +929,11 @@
return mFramesReadySafe;
}
+size_t StaticAudioTrackServerProxy::framesReadySafe() const
+{
+ return mFramesReadySafe;
+}
+
status_t StaticAudioTrackServerProxy::updateStateWithLoop(
StaticAudioTrackState *localState, const StaticAudioTrackState &update) const
{
@@ -1001,6 +1027,7 @@
return (ssize_t) mState.mPosition;
}
+__attribute__((no_sanitize("integer")))
status_t StaticAudioTrackServerProxy::obtainBuffer(Buffer* buffer, bool ackFlush)
{
if (mIsShutdown) {
@@ -1047,6 +1074,7 @@
return NO_ERROR;
}
+__attribute__((no_sanitize("integer")))
void StaticAudioTrackServerProxy::releaseBuffer(Buffer* buffer)
{
size_t stepCount = buffer->mFrameCount;
diff --git a/media/libaudioclient/IAudioPolicyServiceClient.cpp b/media/libaudioclient/IAudioPolicyServiceClient.cpp
index 98a0521..ad7f1de 100644
--- a/media/libaudioclient/IAudioPolicyServiceClient.cpp
+++ b/media/libaudioclient/IAudioPolicyServiceClient.cpp
@@ -48,6 +48,18 @@
data.writeInt32((int32_t) config->format);
}
+inline void readRecordClientInfoFromParcel(const Parcel& data, record_client_info_t *clientInfo) {
+ clientInfo->uid = (uid_t) data.readUint32();
+ clientInfo->session = (audio_session_t) data.readInt32();
+ clientInfo->source = (audio_source_t) data.readInt32();
+}
+
+inline void writeRecordClientInfoFromParcel(Parcel& data, const record_client_info_t *clientInfo) {
+ data.writeUint32((uint32_t) clientInfo->uid);
+ data.writeInt32((int32_t) clientInfo->session);
+ data.writeInt32((int32_t) clientInfo->source);
+}
+
// ----------------------------------------------------------------------
class BpAudioPolicyServiceClient : public BpInterface<IAudioPolicyServiceClient>
{
@@ -80,14 +92,13 @@
remote()->transact(MIX_STATE_UPDATE, data, &reply, IBinder::FLAG_ONEWAY);
}
- void onRecordingConfigurationUpdate(int event, audio_session_t session,
- audio_source_t source, const audio_config_base_t *clientConfig,
+ void onRecordingConfigurationUpdate(int event, const record_client_info_t *clientInfo,
+ const audio_config_base_t *clientConfig,
const audio_config_base_t *deviceConfig, audio_patch_handle_t patchHandle) {
Parcel data, reply;
data.writeInterfaceToken(IAudioPolicyServiceClient::getInterfaceDescriptor());
data.writeInt32(event);
- data.writeInt32(session);
- data.writeInt32(source);
+ writeRecordClientInfoFromParcel(data, clientInfo);
writeAudioConfigBaseToParcel(data, clientConfig);
writeAudioConfigBaseToParcel(data, deviceConfig);
data.writeInt32(patchHandle);
@@ -123,14 +134,14 @@
case RECORDING_CONFIGURATION_UPDATE: {
CHECK_INTERFACE(IAudioPolicyServiceClient, data, reply);
int event = (int) data.readInt32();
- audio_session_t session = (audio_session_t) data.readInt32();
- audio_source_t source = (audio_source_t) data.readInt32();
+ record_client_info_t clientInfo;
audio_config_base_t clientConfig;
audio_config_base_t deviceConfig;
+ readRecordClientInfoFromParcel(data, &clientInfo);
readAudioConfigBaseFromParcel(data, &clientConfig);
readAudioConfigBaseFromParcel(data, &deviceConfig);
audio_patch_handle_t patchHandle = (audio_patch_handle_t) data.readInt32();
- onRecordingConfigurationUpdate(event, session, source, &clientConfig, &deviceConfig,
+ onRecordingConfigurationUpdate(event, &clientInfo, &clientConfig, &deviceConfig,
patchHandle);
return NO_ERROR;
} break;
diff --git a/media/libaudioclient/OWNERS b/media/libaudioclient/OWNERS
new file mode 100644
index 0000000..482b9fb
--- /dev/null
+++ b/media/libaudioclient/OWNERS
@@ -0,0 +1,3 @@
+gkasten@google.com
+jmtrivi@google.com
+mnaganov@google.com
diff --git a/media/libaudioclient/ToneGenerator.cpp b/media/libaudioclient/ToneGenerator.cpp
index cfb5be6..5338059 100644
--- a/media/libaudioclient/ToneGenerator.cpp
+++ b/media/libaudioclient/ToneGenerator.cpp
@@ -1029,7 +1029,7 @@
bool lResult = false;
status_t lStatus;
- if ((toneType < 0) || (toneType >= NUM_TONES))
+ if (toneType >= NUM_TONES)
return lResult;
toneType = getToneForRegion(toneType);
diff --git a/media/libaudioclient/include/media/AudioIoDescriptor.h b/media/libaudioclient/include/media/AudioIoDescriptor.h
index fed86c9..859f1a9 100644
--- a/media/libaudioclient/include/media/AudioIoDescriptor.h
+++ b/media/libaudioclient/include/media/AudioIoDescriptor.h
@@ -20,9 +20,11 @@
namespace android {
enum audio_io_config_event {
+ AUDIO_OUTPUT_REGISTERED,
AUDIO_OUTPUT_OPENED,
AUDIO_OUTPUT_CLOSED,
AUDIO_OUTPUT_CONFIG_CHANGED,
+ AUDIO_INPUT_REGISTERED,
AUDIO_INPUT_OPENED,
AUDIO_INPUT_CLOSED,
AUDIO_INPUT_CONFIG_CHANGED,
diff --git a/media/libaudioclient/include/media/AudioRecord.h b/media/libaudioclient/include/media/AudioRecord.h
index e6a5efb..dd72170 100644
--- a/media/libaudioclient/include/media/AudioRecord.h
+++ b/media/libaudioclient/include/media/AudioRecord.h
@@ -33,7 +33,7 @@
// ----------------------------------------------------------------------------
-class AudioRecord : public RefBase
+class AudioRecord : public AudioSystem::AudioDeviceCallback
{
public:
@@ -424,7 +424,12 @@
/* Returns the ID of the audio device actually used by the input to which this AudioRecord
* is attached.
- * A value of AUDIO_PORT_HANDLE_NONE indicates the AudioRecord is not attached to any input.
+ * The device ID is relevant only if the AudioRecord is active.
+ * When the AudioRecord is inactive, the device ID returned can be either:
+ * - AUDIO_PORT_HANDLE_NONE if the AudioRecord is not attached to any output.
+ * - The device ID used before paused or stopped.
+ * - The device ID selected by audio policy manager of setOutputDevice() if the AudioRecord
+ * has not been started yet.
*
* Parameters:
* none.
@@ -454,6 +459,10 @@
status_t removeAudioDeviceCallback(
const sp<AudioSystem::AudioDeviceCallback>& callback);
+ // AudioSystem::AudioDeviceCallback> virtuals
+ virtual void onAudioDeviceUpdate(audio_io_handle_t audioIo,
+ audio_port_handle_t deviceId);
+
private:
/* If nonContig is non-NULL, it is an output parameter that will be set to the number of
* additional non-contiguous frames that are predicted to be available immediately,
@@ -561,6 +570,8 @@
// FIXME enum is faster than strcmp() for parameter 'from'
status_t restoreRecord_l(const char *from);
+ void updateRoutedDeviceId_l();
+
sp<AudioRecordThread> mAudioRecordThread;
mutable Mutex mLock;
@@ -665,7 +676,7 @@
audio_port_handle_t mRoutedDeviceId; // Device actually selected by audio policy manager:
// May not match the app selection depending on other
// activity and connected devices
- sp<AudioSystem::AudioDeviceCallback> mDeviceCallback;
+ wp<AudioSystem::AudioDeviceCallback> mDeviceCallback;
audio_port_handle_t mPortId; // unique ID allocated by audio policy
};
diff --git a/media/libaudioclient/include/media/AudioSystem.h b/media/libaudioclient/include/media/AudioSystem.h
index 2e39d23..5a81d83 100644
--- a/media/libaudioclient/include/media/AudioSystem.h
+++ b/media/libaudioclient/include/media/AudioSystem.h
@@ -33,7 +33,7 @@
typedef void (*audio_error_callback)(status_t err);
typedef void (*dynamic_policy_callback)(int event, String8 regId, int val);
-typedef void (*record_config_callback)(int event, audio_session_t session, int source,
+typedef void (*record_config_callback)(int event, const record_client_info_t *clientInfo,
const audio_config_base_t *clientConfig, const audio_config_base_t *deviceConfig,
audio_patch_handle_t patchHandle);
@@ -370,9 +370,9 @@
audio_port_handle_t deviceId) = 0;
};
- static status_t addAudioDeviceCallback(const sp<AudioDeviceCallback>& callback,
+ static status_t addAudioDeviceCallback(const wp<AudioDeviceCallback>& callback,
audio_io_handle_t audioIo);
- static status_t removeAudioDeviceCallback(const sp<AudioDeviceCallback>& callback,
+ static status_t removeAudioDeviceCallback(const wp<AudioDeviceCallback>& callback,
audio_io_handle_t audioIo);
static audio_port_handle_t getDeviceIdForIo(audio_io_handle_t audioIo);
@@ -403,9 +403,9 @@
const sp<AudioIoDescriptor>& ioDesc);
- status_t addAudioDeviceCallback(const sp<AudioDeviceCallback>& callback,
+ status_t addAudioDeviceCallback(const wp<AudioDeviceCallback>& callback,
audio_io_handle_t audioIo);
- status_t removeAudioDeviceCallback(const sp<AudioDeviceCallback>& callback,
+ status_t removeAudioDeviceCallback(const wp<AudioDeviceCallback>& callback,
audio_io_handle_t audioIo);
audio_port_handle_t getDeviceIdForIo(audio_io_handle_t audioIo);
@@ -413,7 +413,7 @@
private:
Mutex mLock;
DefaultKeyedVector<audio_io_handle_t, sp<AudioIoDescriptor> > mIoDescriptors;
- DefaultKeyedVector<audio_io_handle_t, Vector < sp<AudioDeviceCallback> > >
+ DefaultKeyedVector<audio_io_handle_t, Vector < wp<AudioDeviceCallback> > >
mAudioDeviceCallbacks;
// cached values for recording getInputBufferSize() queries
size_t mInBuffSize; // zero indicates cache is invalid
@@ -440,8 +440,9 @@
virtual void onAudioPortListUpdate();
virtual void onAudioPatchListUpdate();
virtual void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state);
- virtual void onRecordingConfigurationUpdate(int event, audio_session_t session,
- audio_source_t source, const audio_config_base_t *clientConfig,
+ virtual void onRecordingConfigurationUpdate(int event,
+ const record_client_info_t *clientInfo,
+ const audio_config_base_t *clientConfig,
const audio_config_base_t *deviceConfig, audio_patch_handle_t patchHandle);
private:
diff --git a/media/libaudioclient/include/media/AudioTrack.h b/media/libaudioclient/include/media/AudioTrack.h
index b168fc9..47d87e9 100644
--- a/media/libaudioclient/include/media/AudioTrack.h
+++ b/media/libaudioclient/include/media/AudioTrack.h
@@ -35,7 +35,7 @@
// ----------------------------------------------------------------------------
-class AudioTrack : public RefBase
+class AudioTrack : public AudioSystem::AudioDeviceCallback
{
public:
@@ -605,7 +605,11 @@
/* Returns the ID of the audio device actually used by the output to which this AudioTrack is
* attached.
- * A value of AUDIO_PORT_HANDLE_NONE indicates the audio track is not attached to any output.
+ * When the AudioTrack is inactive, the device ID returned can be either:
+ * - AUDIO_PORT_HANDLE_NONE if the AudioTrack is not attached to any output.
+ * - The device ID used before paused or stopped.
+ * - The device ID selected by audio policy manager of setOutputDevice() if the AudioTrack
+ * has not been started yet.
*
* Parameters:
* none.
@@ -845,6 +849,12 @@
status_t removeAudioDeviceCallback(
const sp<AudioSystem::AudioDeviceCallback>& callback);
+ // AudioSystem::AudioDeviceCallback> virtuals
+ virtual void onAudioDeviceUpdate(audio_io_handle_t audioIo,
+ audio_port_handle_t deviceId);
+
+
+
/* Obtain the pending duration in milliseconds for playback of pure PCM
* (mixable without embedded timing) data remaining in AudioTrack.
*
@@ -974,6 +984,8 @@
void restartIfDisabled();
+ void updateRoutedDeviceId_l();
+
// Next 4 fields may be changed if IAudioTrack is re-created, but always != 0
sp<IAudioTrack> mAudioTrack;
sp<IMemory> mCblkMemory;
@@ -1085,8 +1097,10 @@
// reset by stop() but continues monotonically
// after new IAudioTrack to restore mPosition,
// and could be easily widened to uint64_t
- int64_t mStartUs; // the start time after flush or stop.
+ int64_t mStartFromZeroUs; // the start time after flush or stop,
+ // when position should be 0.
// only used for offloaded and direct tracks.
+ int64_t mStartNs; // the time when start() is called.
ExtendedTimestamp mStartEts; // Extended timestamp at start for normal
// AudioTracks.
AudioTimestamp mStartTs; // Timestamp at start for offloaded or direct
@@ -1163,7 +1177,7 @@
uid_t mClientUid;
pid_t mClientPid;
- sp<AudioSystem::AudioDeviceCallback> mDeviceCallback;
+ wp<AudioSystem::AudioDeviceCallback> mDeviceCallback;
audio_port_handle_t mPortId; // unique ID allocated by audio policy
};
diff --git a/media/libaudioclient/include/media/IAudioPolicyServiceClient.h b/media/libaudioclient/include/media/IAudioPolicyServiceClient.h
index d94ad00..e0d2495 100644
--- a/media/libaudioclient/include/media/IAudioPolicyServiceClient.h
+++ b/media/libaudioclient/include/media/IAudioPolicyServiceClient.h
@@ -26,6 +26,16 @@
// ----------------------------------------------------------------------------
+struct record_client_info {
+ uid_t uid;
+ audio_session_t session;
+ audio_source_t source;
+};
+
+typedef struct record_client_info record_client_info_t;
+
+// ----------------------------------------------------------------------------
+
class IAudioPolicyServiceClient : public IInterface
{
public:
@@ -38,8 +48,8 @@
// Notifies a change in the mixing state of a specific mix in a dynamic audio policy
virtual void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state) = 0;
// Notifies a change of audio recording configuration
- virtual void onRecordingConfigurationUpdate(int event, audio_session_t session,
- audio_source_t source,
+ virtual void onRecordingConfigurationUpdate(int event,
+ const record_client_info_t *clientInfo,
const audio_config_base_t *clientConfig,
const audio_config_base_t *deviceConfig,
audio_patch_handle_t patchHandle) = 0;
diff --git a/media/libaudiohal/Android.mk b/media/libaudiohal/Android.mk
index e592169..827908e 100644
--- a/media/libaudiohal/Android.mk
+++ b/media/libaudiohal/Android.mk
@@ -3,6 +3,7 @@
include $(CLEAR_VARS)
LOCAL_SHARED_LIBRARIES := \
+ libaudioutils \
libcutils \
liblog \
libutils \
diff --git a/media/libaudiohal/DeviceHalHidl.cpp b/media/libaudiohal/DeviceHalHidl.cpp
index 71fbd98..49ef991 100644
--- a/media/libaudiohal/DeviceHalHidl.cpp
+++ b/media/libaudiohal/DeviceHalHidl.cpp
@@ -98,7 +98,8 @@
} // namespace
DeviceHalHidl::DeviceHalHidl(const sp<IDevice>& device)
- : ConversionHelperHidl("Device"), mDevice(device) {
+ : ConversionHelperHidl("Device"), mDevice(device),
+ mPrimaryDevice(IPrimaryDevice::castFrom(device)) {
}
DeviceHalHidl::~DeviceHalHidl() {
@@ -120,24 +121,21 @@
status_t DeviceHalHidl::setVoiceVolume(float volume) {
if (mDevice == 0) return NO_INIT;
- sp<IPrimaryDevice> primaryDev = IPrimaryDevice::castFrom(mDevice);
- if (primaryDev == 0) return INVALID_OPERATION;
- return processReturn("setVoiceVolume", primaryDev->setVoiceVolume(volume));
+ if (mPrimaryDevice == 0) return INVALID_OPERATION;
+ return processReturn("setVoiceVolume", mPrimaryDevice->setVoiceVolume(volume));
}
status_t DeviceHalHidl::setMasterVolume(float volume) {
if (mDevice == 0) return NO_INIT;
- sp<IPrimaryDevice> primaryDev = IPrimaryDevice::castFrom(mDevice);
- if (primaryDev == 0) return INVALID_OPERATION;
- return processReturn("setMasterVolume", primaryDev->setMasterVolume(volume));
+ if (mPrimaryDevice == 0) return INVALID_OPERATION;
+ return processReturn("setMasterVolume", mPrimaryDevice->setMasterVolume(volume));
}
status_t DeviceHalHidl::getMasterVolume(float *volume) {
if (mDevice == 0) return NO_INIT;
- sp<IPrimaryDevice> primaryDev = IPrimaryDevice::castFrom(mDevice);
- if (primaryDev == 0) return INVALID_OPERATION;
+ if (mPrimaryDevice == 0) return INVALID_OPERATION;
Result retval;
- Return<void> ret = primaryDev->getMasterVolume(
+ Return<void> ret = mPrimaryDevice->getMasterVolume(
[&](Result r, float v) {
retval = r;
if (retval == Result::OK) {
@@ -149,9 +147,8 @@
status_t DeviceHalHidl::setMode(audio_mode_t mode) {
if (mDevice == 0) return NO_INIT;
- sp<IPrimaryDevice> primaryDev = IPrimaryDevice::castFrom(mDevice);
- if (primaryDev == 0) return INVALID_OPERATION;
- return processReturn("setMode", primaryDev->setMode(AudioMode(mode)));
+ if (mPrimaryDevice == 0) return INVALID_OPERATION;
+ return processReturn("setMode", mPrimaryDevice->setMode(AudioMode(mode)));
}
status_t DeviceHalHidl::setMicMute(bool state) {
diff --git a/media/libaudiohal/DeviceHalHidl.h b/media/libaudiohal/DeviceHalHidl.h
index 9da02a4..8651b51 100644
--- a/media/libaudiohal/DeviceHalHidl.h
+++ b/media/libaudiohal/DeviceHalHidl.h
@@ -18,11 +18,13 @@
#define ANDROID_HARDWARE_DEVICE_HAL_HIDL_H
#include <android/hardware/audio/2.0/IDevice.h>
+#include <android/hardware/audio/2.0/IPrimaryDevice.h>
#include <media/audiohal/DeviceHalInterface.h>
#include "ConversionHelperHidl.h"
using ::android::hardware::audio::V2_0::IDevice;
+using ::android::hardware::audio::V2_0::IPrimaryDevice;
using ::android::hardware::Return;
namespace android {
@@ -110,6 +112,7 @@
private:
friend class DevicesFactoryHalHidl;
sp<IDevice> mDevice;
+ sp<IPrimaryDevice> mPrimaryDevice; // Null if it's not a primary device.
// Can not be constructed directly by clients.
explicit DeviceHalHidl(const sp<IDevice>& device);
diff --git a/media/libaudiohal/EffectHalHidl.cpp b/media/libaudiohal/EffectHalHidl.cpp
index b49b975..61fb6bab 100644
--- a/media/libaudiohal/EffectHalHidl.cpp
+++ b/media/libaudiohal/EffectHalHidl.cpp
@@ -40,7 +40,7 @@
namespace android {
EffectHalHidl::EffectHalHidl(const sp<IEffect>& effect, uint64_t effectId)
- : mEffect(effect), mEffectId(effectId), mBuffersChanged(true) {
+ : mEffect(effect), mEffectId(effectId), mBuffersChanged(true), mEfGroup(nullptr) {
}
EffectHalHidl::~EffectHalHidl() {
@@ -49,6 +49,9 @@
mEffect.clear();
hardware::IPCThreadState::self()->flushCommands();
}
+ if (mEfGroup) {
+ EventFlag::deleteEventFlag(&mEfGroup);
+ }
}
// static
diff --git a/media/libaudiohal/OWNERS b/media/libaudiohal/OWNERS
new file mode 100644
index 0000000..1456ab6
--- /dev/null
+++ b/media/libaudiohal/OWNERS
@@ -0,0 +1,2 @@
+krocard@google.com
+mnaganov@google.com
diff --git a/media/libaudiohal/StreamHalHidl.cpp b/media/libaudiohal/StreamHalHidl.cpp
index 42785d5..0cafa36 100644
--- a/media/libaudiohal/StreamHalHidl.cpp
+++ b/media/libaudiohal/StreamHalHidl.cpp
@@ -47,7 +47,20 @@
StreamHalHidl::StreamHalHidl(IStream *stream)
: ConversionHelperHidl("Stream"),
mStream(stream),
- mHalThreadPriority(HAL_THREAD_PRIORITY_DEFAULT) {
+ mHalThreadPriority(HAL_THREAD_PRIORITY_DEFAULT),
+ mCachedBufferSize(0){
+
+ // Instrument audio signal power logging.
+ // Note: This assumes channel mask, format, and sample rate do not change after creation.
+ if (mStream != nullptr && mStreamPowerLog.isUserDebugOrEngBuild()) {
+ // Obtain audio properties (see StreamHalHidl::getAudioProperties() below).
+ Return<void> ret = mStream->getAudioProperties(
+ [&](uint32_t sr, AudioChannelMask m, AudioFormat f) {
+ mStreamPowerLog.init(sr,
+ static_cast<audio_channel_mask_t>(m),
+ static_cast<audio_format_t>(f));
+ });
+ }
}
StreamHalHidl::~StreamHalHidl() {
@@ -61,7 +74,11 @@
status_t StreamHalHidl::getBufferSize(size_t *size) {
if (!mStream) return NO_INIT;
- return processReturn("getBufferSize", mStream->getBufferSize(), size);
+ status_t status = processReturn("getBufferSize", mStream->getBufferSize(), size);
+ if (status == OK) {
+ mCachedBufferSize = *size;
+ }
+ return status;
}
status_t StreamHalHidl::getChannelMask(audio_channel_mask_t *mask) {
@@ -135,6 +152,7 @@
hidlHandle->data[0] = fd;
Return<void> ret = mStream->debugDump(hidlHandle);
native_handle_delete(hidlHandle);
+ mStreamPowerLog.dump(fd);
return processReturn("dump", ret);
}
@@ -189,6 +207,14 @@
return OK;
}
+status_t StreamHalHidl::getCachedBufferSize(size_t *size) {
+ if (mCachedBufferSize != 0) {
+ *size = mCachedBufferSize;
+ return OK;
+ }
+ return getBufferSize(size);
+}
+
bool StreamHalHidl::requestHalThreadPriority(pid_t threadPid, pid_t threadId) {
if (mHalThreadPriority == HAL_THREAD_PRIORITY_DEFAULT) {
return true;
@@ -307,11 +333,22 @@
}
status_t status;
- if (!mDataMQ && (status = prepareForWriting(bytes)) != OK) {
- return status;
+ if (!mDataMQ) {
+ // In case if playback starts close to the end of a compressed track, the bytes
+ // that need to be written is less than the actual buffer size. Need to use
+ // full buffer size for the MQ since otherwise after seeking back to the middle
+ // data will be truncated.
+ size_t bufferSize;
+ if ((status = getCachedBufferSize(&bufferSize)) != OK) {
+ return status;
+ }
+ if (bytes > bufferSize) bufferSize = bytes;
+ if ((status = prepareForWriting(bufferSize)) != OK) {
+ return status;
+ }
}
- return callWriterThread(
+ status = callWriterThread(
WriteCommand::WRITE, "write", static_cast<const uint8_t*>(buffer), bytes,
[&] (const WriteStatus& writeStatus) {
*written = writeStatus.reply.written;
@@ -320,6 +357,8 @@
"hal reports more bytes written than asked for: %lld > %lld",
(long long)*written, (long long)bytes);
});
+ mStreamPowerLog.log(buffer, *written);
+ return status;
}
status_t StreamOutHalHidl::callWriterThread(
@@ -580,7 +619,7 @@
ReadParameters params;
params.command = ReadCommand::READ;
params.params.read = bytes;
- return callReaderThread(params, "read",
+ status = callReaderThread(params, "read",
[&](const ReadStatus& readStatus) {
const size_t availToRead = mDataMQ->availableToRead();
if (!mDataMQ->read(static_cast<uint8_t*>(buffer), std::min(bytes, availToRead))) {
@@ -591,6 +630,8 @@
(int32_t)availToRead, (int32_t)readStatus.reply.read);
*read = readStatus.reply.read;
});
+ mStreamPowerLog.log(buffer, *read);
+ return status;
}
status_t StreamInHalHidl::callReaderThread(
diff --git a/media/libaudiohal/StreamHalHidl.h b/media/libaudiohal/StreamHalHidl.h
index a7df276..d4ab943 100644
--- a/media/libaudiohal/StreamHalHidl.h
+++ b/media/libaudiohal/StreamHalHidl.h
@@ -27,6 +27,7 @@
#include <media/audiohal/StreamHalInterface.h>
#include "ConversionHelperHidl.h"
+#include "StreamPowerLog.h"
using ::android::hardware::audio::V2_0::IStream;
using ::android::hardware::audio::V2_0::IStreamIn;
@@ -101,12 +102,18 @@
// The destructor automatically closes the stream.
virtual ~StreamHalHidl();
+ status_t getCachedBufferSize(size_t *size);
+
bool requestHalThreadPriority(pid_t threadPid, pid_t threadId);
+ // mStreamPowerLog is used for audio signal power logging.
+ StreamPowerLog mStreamPowerLog;
+
private:
const int HAL_THREAD_PRIORITY_DEFAULT = -1;
IStream *mStream;
int mHalThreadPriority;
+ size_t mCachedBufferSize;
};
class StreamOutHalHidl : public StreamOutHalInterface, public StreamHalHidl {
diff --git a/media/libaudiohal/StreamHalLocal.cpp b/media/libaudiohal/StreamHalLocal.cpp
index 05800a0..dc17f5c 100644
--- a/media/libaudiohal/StreamHalLocal.cpp
+++ b/media/libaudiohal/StreamHalLocal.cpp
@@ -27,7 +27,15 @@
namespace android {
StreamHalLocal::StreamHalLocal(audio_stream_t *stream, sp<DeviceHalLocal> device)
- : mDevice(device), mStream(stream) {
+ : mDevice(device),
+ mStream(stream) {
+ // Instrument audio signal power logging.
+ // Note: This assumes channel mask, format, and sample rate do not change after creation.
+ if (mStream != nullptr && mStreamPowerLog.isUserDebugOrEngBuild()) {
+ mStreamPowerLog.init(mStream->get_sample_rate(mStream),
+ mStream->get_channels(mStream),
+ mStream->get_format(mStream));
+ }
}
StreamHalLocal::~StreamHalLocal() {
@@ -95,7 +103,9 @@
}
status_t StreamHalLocal::dump(int fd) {
- return mStream->dump(mStream, fd);
+ status_t status = mStream->dump(mStream, fd);
+ mStreamPowerLog.dump(fd);
+ return status;
}
status_t StreamHalLocal::setHalThreadPriority(int) {
@@ -133,6 +143,7 @@
ssize_t writeResult = mStream->write(mStream, buffer, bytes);
if (writeResult > 0) {
*written = writeResult;
+ mStreamPowerLog.log(buffer, *written);
return OK;
} else {
*written = 0;
@@ -266,6 +277,7 @@
ssize_t readResult = mStream->read(mStream, buffer, bytes);
if (readResult > 0) {
*read = readResult;
+ mStreamPowerLog.log( buffer, *read);
return OK;
} else {
*read = 0;
diff --git a/media/libaudiohal/StreamHalLocal.h b/media/libaudiohal/StreamHalLocal.h
index 8c96c1f..c7136df 100644
--- a/media/libaudiohal/StreamHalLocal.h
+++ b/media/libaudiohal/StreamHalLocal.h
@@ -18,6 +18,7 @@
#define ANDROID_HARDWARE_STREAM_HAL_LOCAL_H
#include <media/audiohal/StreamHalInterface.h>
+#include "StreamPowerLog.h"
namespace android {
@@ -83,6 +84,9 @@
sp<DeviceHalLocal> mDevice;
+ // mStreamPowerLog is used for audio signal power logging.
+ StreamPowerLog mStreamPowerLog;
+
private:
audio_stream_t *mStream;
};
diff --git a/media/libaudiohal/StreamPowerLog.h b/media/libaudiohal/StreamPowerLog.h
new file mode 100644
index 0000000..a78b1aa
--- /dev/null
+++ b/media/libaudiohal/StreamPowerLog.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_STREAM_POWER_LOG_H
+#define ANDROID_HARDWARE_STREAM_POWER_LOG_H
+
+#include <audio_utils/clock.h>
+#include <audio_utils/PowerLog.h>
+#include <cutils/properties.h>
+#include <system/audio.h>
+
+namespace android {
+
+class StreamPowerLog {
+public:
+ StreamPowerLog() :
+ mIsUserDebugOrEngBuild(is_userdebug_or_eng_build()),
+ mPowerLog(nullptr),
+ mFrameSize(0) {
+ // use init() to set up the power log.
+ }
+
+ ~StreamPowerLog() {
+ power_log_destroy(mPowerLog); // OK for null mPowerLog
+ mPowerLog = nullptr;
+ }
+
+ // A one-time initialization (do not call twice) before using StreamPowerLog.
+ void init(uint32_t sampleRate, audio_channel_mask_t channelMask, audio_format_t format) {
+ if (mPowerLog == nullptr) {
+ // Note: A way to get channel count for both input and output channel masks
+ // but does not check validity of the channel mask.
+ const uint32_t channelCount = popcount(audio_channel_mask_get_bits(channelMask));
+ mFrameSize = channelCount * audio_bytes_per_sample(format);
+ if (mFrameSize > 0) {
+ const size_t kPowerLogFramesPerEntry =
+ (long long)sampleRate * kPowerLogSamplingIntervalMs / 1000;
+ mPowerLog = power_log_create(
+ sampleRate,
+ channelCount,
+ format,
+ kPowerLogEntries,
+ kPowerLogFramesPerEntry);
+ }
+ }
+ // mPowerLog may be NULL (not the right build, format not accepted, etc.).
+ }
+
+ // Dump the power log to fd.
+ void dump(int fd) const {
+ // OK for null mPowerLog
+ (void)power_log_dump(
+ mPowerLog, fd, " " /* prefix */, kPowerLogLines, 0 /* limit_ns */);
+ }
+
+ // Log the audio data contained in buffer.
+ void log(const void *buffer, size_t sizeInBytes) const {
+ if (mPowerLog != nullptr) { // mFrameSize is always nonzero if mPowerLog exists.
+ power_log_log(
+ mPowerLog, buffer, sizeInBytes / mFrameSize, audio_utils_get_real_time_ns());
+ }
+ }
+
+ bool isUserDebugOrEngBuild() const {
+ return mIsUserDebugOrEngBuild;
+ }
+
+private:
+
+ static inline bool is_userdebug_or_eng_build() {
+ char value[PROPERTY_VALUE_MAX];
+ (void)property_get("ro.build.type", value, "unknown"); // ignore actual length
+ return strcmp(value, "userdebug") == 0 || strcmp(value, "eng") == 0;
+ }
+
+ // Audio signal power log configuration.
+ static const size_t kPowerLogLines = 40;
+ static const size_t kPowerLogSamplingIntervalMs = 50;
+ static const size_t kPowerLogEntries = (1 /* minutes */ * 60 /* seconds */ * 1000 /* msec */
+ / kPowerLogSamplingIntervalMs);
+
+ const bool mIsUserDebugOrEngBuild;
+ power_log_t *mPowerLog;
+ size_t mFrameSize;
+};
+
+} // namespace android
+
+#endif // ANDROID_HARDWARE_STREAM_POWER_LOG_H
diff --git a/media/libaudiohal/include/DeviceHalInterface.h b/media/libaudiohal/include/media/audiohal/DeviceHalInterface.h
similarity index 100%
rename from media/libaudiohal/include/DeviceHalInterface.h
rename to media/libaudiohal/include/media/audiohal/DeviceHalInterface.h
diff --git a/media/libaudiohal/include/DevicesFactoryHalInterface.h b/media/libaudiohal/include/media/audiohal/DevicesFactoryHalInterface.h
similarity index 100%
rename from media/libaudiohal/include/DevicesFactoryHalInterface.h
rename to media/libaudiohal/include/media/audiohal/DevicesFactoryHalInterface.h
diff --git a/media/libaudiohal/include/EffectBufferHalInterface.h b/media/libaudiohal/include/media/audiohal/EffectBufferHalInterface.h
similarity index 100%
rename from media/libaudiohal/include/EffectBufferHalInterface.h
rename to media/libaudiohal/include/media/audiohal/EffectBufferHalInterface.h
diff --git a/media/libaudiohal/include/EffectHalInterface.h b/media/libaudiohal/include/media/audiohal/EffectHalInterface.h
similarity index 100%
rename from media/libaudiohal/include/EffectHalInterface.h
rename to media/libaudiohal/include/media/audiohal/EffectHalInterface.h
diff --git a/media/libaudiohal/include/EffectsFactoryHalInterface.h b/media/libaudiohal/include/media/audiohal/EffectsFactoryHalInterface.h
similarity index 100%
rename from media/libaudiohal/include/EffectsFactoryHalInterface.h
rename to media/libaudiohal/include/media/audiohal/EffectsFactoryHalInterface.h
diff --git a/media/libaudiohal/include/StreamHalInterface.h b/media/libaudiohal/include/media/audiohal/StreamHalInterface.h
similarity index 100%
rename from media/libaudiohal/include/StreamHalInterface.h
rename to media/libaudiohal/include/media/audiohal/StreamHalInterface.h
diff --git a/media/libaudiohal/include/hidl/HalDeathHandler.h b/media/libaudiohal/include/media/audiohal/hidl/HalDeathHandler.h
similarity index 100%
rename from media/libaudiohal/include/hidl/HalDeathHandler.h
rename to media/libaudiohal/include/media/audiohal/hidl/HalDeathHandler.h
diff --git a/media/libaudioprocessing/include/AudioResampler.h b/media/libaudioprocessing/include/media/AudioResampler.h
similarity index 100%
rename from media/libaudioprocessing/include/AudioResampler.h
rename to media/libaudioprocessing/include/media/AudioResampler.h
diff --git a/media/libaudioprocessing/include/AudioResamplerPublic.h b/media/libaudioprocessing/include/media/AudioResamplerPublic.h
similarity index 100%
rename from media/libaudioprocessing/include/AudioResamplerPublic.h
rename to media/libaudioprocessing/include/media/AudioResamplerPublic.h
diff --git a/media/libeffects/Android.bp b/media/libeffects/Android.bp
index ccaa2b4..0dd3f17 100644
--- a/media/libeffects/Android.bp
+++ b/media/libeffects/Android.bp
@@ -1 +1 @@
-subdirs = ["factory"]
+subdirs = ["factory", "config"]
diff --git a/media/libeffects/OWNERS b/media/libeffects/OWNERS
new file mode 100644
index 0000000..7e3de13
--- /dev/null
+++ b/media/libeffects/OWNERS
@@ -0,0 +1,3 @@
+krocard@google.com
+mnaganov@google.com
+rago@google.com
diff --git a/media/libeffects/config/Android.bp b/media/libeffects/config/Android.bp
new file mode 100644
index 0000000..4398a91
--- /dev/null
+++ b/media/libeffects/config/Android.bp
@@ -0,0 +1,17 @@
+// Effect configuration
+cc_library_shared {
+ name: "libeffectsconfig",
+ vendor_available: true,
+
+ srcs: ["src/EffectsConfig.cpp"],
+
+ shared_libs: [
+ "liblog",
+ "libtinyxml2",
+ ],
+
+ header_libs: ["libaudio_system_headers"],
+ export_header_lib_headers: ["libaudio_system_headers"],
+
+ export_include_dirs: ["include"],
+}
diff --git a/media/libeffects/config/include/media/EffectsConfig.h b/media/libeffects/config/include/media/EffectsConfig.h
new file mode 100644
index 0000000..811730c
--- /dev/null
+++ b/media/libeffects/config/include/media/EffectsConfig.h
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef ANDROID_MEDIA_EFFECTSCONFIG_H
+#define ANDROID_MEDIA_EFFECTSCONFIG_H
+
+/** @file Parses audio effects configuration file to C and C++ structure.
+ * @see audio_effects_conf_V2_0.xsd for documentation on each structure
+ */
+
+#include <system/audio_effect.h>
+
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace android {
+namespace effectsConfig {
+
+/** Default path of effect configuration file. */
+constexpr char DEFAULT_PATH[] = "/vendor/etc/audio_effects.xml";
+
+/** Directories where the effect libraries will be search for. */
+constexpr const char* LD_EFFECT_LIBRARY_PATH[] =
+#ifdef __LP64__
+ {"/odm/lib64/soundfx", "/vendor/lib64/soundfx", "/system/lib64/soundfx"};
+#else
+ {"/odm/lib/soundfx", "/vendor/lib/soundfx", "/system/lib/soundfx"};
+#endif
+
+struct Library {
+ std::string name;
+ std::string path;
+};
+using Libraries = std::vector<Library>;
+
+struct EffectImpl {
+ Library* library; //< Only valid as long as the associated library vector is unmodified
+ effect_uuid_t uuid;
+};
+
+struct Effect : public EffectImpl {
+ std::string name;
+ bool isProxy;
+ EffectImpl libSw; //< Only valid if isProxy
+ EffectImpl libHw; //< Only valid if isProxy
+};
+
+using Effects = std::vector<Effect>;
+
+template <class Type>
+struct Stream {
+ Type type;
+ std::vector<std::reference_wrapper<Effect>> effects;
+};
+using OutputStream = Stream<audio_stream_type_t>;
+using InputStream = Stream<audio_source_t>;
+
+/** Parsed configuration.
+ * Intended to be a transient structure only used for deserialization.
+ * Note: Everything is copied in the configuration from the xml dom.
+ * If copies needed to be avoided due to performance issue,
+ * consider keeping a private handle on the xml dom and replace all strings by dom pointers.
+ * Or even better, use SAX parsing to avoid the allocations all together.
+ */
+struct Config {
+ float version;
+ Libraries libraries;
+ Effects effects;
+ std::vector<OutputStream> postprocess;
+ std::vector<InputStream> preprocess;
+};
+
+/** Result of `parse(const char*)` */
+struct ParsingResult {
+ /** Parsed config, nullptr if the xml lib could not load the file */
+ std::unique_ptr<Config> parsedConfig;
+ size_t nbSkippedElement; //< Number of skipped invalid library, effect or processing chain
+};
+
+/** Parses the provided effect configuration.
+ * Parsing do not stop of first invalid element, but continues to the next.
+ * @see ParsingResult::nbSkippedElement
+ */
+ParsingResult parse(const char* path = DEFAULT_PATH);
+
+} // namespace effectsConfig
+} // namespace android
+#endif // ANDROID_MEDIA_EFFECTSCONFIG_H
diff --git a/media/libeffects/config/src/EffectsConfig.cpp b/media/libeffects/config/src/EffectsConfig.cpp
new file mode 100644
index 0000000..98a37ab
--- /dev/null
+++ b/media/libeffects/config/src/EffectsConfig.cpp
@@ -0,0 +1,302 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "EffectsConfig"
+
+#include <algorithm>
+#include <cstdint>
+#include <functional>
+#include <string>
+
+#include <tinyxml2.h>
+#include <log/log.h>
+
+#include <media/EffectsConfig.h>
+
+using namespace tinyxml2;
+
+namespace android {
+namespace effectsConfig {
+
+/** All functions except `parse(const char*)` are static. */
+namespace {
+
+/** @return all `node`s children that are elements and match the tag if provided. */
+std::vector<std::reference_wrapper<const XMLElement>> getChildren(const XMLNode& node,
+ const char* childTag = nullptr) {
+ std::vector<std::reference_wrapper<const XMLElement>> children;
+ for (auto* child = node.FirstChildElement(childTag); child != nullptr;
+ child = child->NextSiblingElement(childTag)) {
+ children.emplace_back(*child);
+ }
+ return children;
+}
+
+/** @return xml dump of the provided element.
+ * By not providing a printer, it is implicitly created in the caller context.
+ * In such case the return pointer has the same lifetime as the expression containing dump().
+ */
+const char* dump(const XMLElement& element, XMLPrinter&& printer = {}) {
+ element.Accept(&printer);
+ return printer.CStr();
+}
+
+
+bool stringToUuid(const char *str, effect_uuid_t *uuid)
+{
+ uint32_t tmp[10];
+
+ if (sscanf(str, "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x",
+ tmp, tmp+1, tmp+2, tmp+3, tmp+4, tmp+5, tmp+6, tmp+7, tmp+8, tmp+9) < 10) {
+ return false;
+ }
+ uuid->timeLow = (uint32_t)tmp[0];
+ uuid->timeMid = (uint16_t)tmp[1];
+ uuid->timeHiAndVersion = (uint16_t)tmp[2];
+ uuid->clockSeq = (uint16_t)tmp[3];
+ uuid->node[0] = (uint8_t)tmp[4];
+ uuid->node[1] = (uint8_t)tmp[5];
+ uuid->node[2] = (uint8_t)tmp[6];
+ uuid->node[3] = (uint8_t)tmp[7];
+ uuid->node[4] = (uint8_t)tmp[8];
+ uuid->node[5] = (uint8_t)tmp[9];
+
+ return true;
+}
+
+/** Map the enum and string representation of a string type.
+ * Intended to be specialized for each enum to deserialize.
+ * The general template is disabled.
+ */
+template <class Enum>
+constexpr std::enable_if<false, Enum> STREAM_NAME_MAP;
+
+/** All output stream types which support effects.
+ * This need to be kept in sink with the xsd streamOutputType.
+ */
+template <>
+constexpr std::pair<audio_stream_type_t, const char*> STREAM_NAME_MAP<audio_stream_type_t>[] = {
+ {AUDIO_STREAM_VOICE_CALL, "voice_call"},
+ {AUDIO_STREAM_SYSTEM, "system"},
+ {AUDIO_STREAM_RING, "ring"},
+ {AUDIO_STREAM_MUSIC, "music"},
+ {AUDIO_STREAM_ALARM, "alarm"},
+ {AUDIO_STREAM_NOTIFICATION, "notification"},
+ {AUDIO_STREAM_BLUETOOTH_SCO, "bluetooth_sco"},
+ {AUDIO_STREAM_ENFORCED_AUDIBLE, "enforced_audible"},
+ {AUDIO_STREAM_DTMF, "dtmf"},
+ {AUDIO_STREAM_TTS, "tts"},
+};
+
+/** All input stream types which support effects.
+ * This need to be kept in sink with the xsd streamOutputType.
+ */
+template <>
+constexpr std::pair<audio_source_t, const char*> STREAM_NAME_MAP<audio_source_t>[] = {
+ {AUDIO_SOURCE_MIC, "mic"},
+ {AUDIO_SOURCE_VOICE_UPLINK, "voice_uplink"},
+ {AUDIO_SOURCE_VOICE_DOWNLINK, "voice_downlink"},
+ {AUDIO_SOURCE_VOICE_CALL, "voice_call"},
+ {AUDIO_SOURCE_CAMCORDER, "camcorder"},
+ {AUDIO_SOURCE_VOICE_RECOGNITION, "voice_recognition"},
+ {AUDIO_SOURCE_VOICE_COMMUNICATION, "voice_communication"},
+ {AUDIO_SOURCE_UNPROCESSED, "unprocessed"},
+};
+
+/** Find the stream type enum corresponding to the stream type name or return false */
+template <class Type>
+bool stringToStreamType(const char *streamName, Type* type)
+{
+ for (auto& streamNamePair : STREAM_NAME_MAP<Type>) {
+ if (strcmp(streamNamePair.second, streamName) == 0) {
+ *type = streamNamePair.first;
+ return true;
+ }
+ }
+ return false;
+}
+
+/** Parse a library xml note and push the result in libraries or return false on failure. */
+bool parseLibrary(const XMLElement& xmlLibrary, Libraries* libraries) {
+ const char* name = xmlLibrary.Attribute("name");
+ const char* path = xmlLibrary.Attribute("path");
+ if (name == nullptr || path == nullptr) {
+ ALOGE("library must have a name and a path: %s", dump(xmlLibrary));
+ return false;
+ }
+ libraries->push_back({name, path});
+ return true;
+}
+
+/** Find an element in a collection by its name.
+ * @return nullptr if not found, the ellements address if found.
+ */
+template <class T>
+T* findByName(const char* name, std::vector<T>& collection) {
+ auto it = find_if(begin(collection), end(collection),
+ [name] (auto& item) { return item.name == name; });
+ return it != end(collection) ? &*it : nullptr;
+}
+
+/** Parse an effect from an xml element describing it.
+ * @return true and pushes the effect in effects on success,
+ * false on failure. */
+bool parseEffect(const XMLElement& xmlEffect, Libraries& libraries, Effects* effects) {
+ Effect effect{};
+
+ const char* name = xmlEffect.Attribute("name");
+ if (name == nullptr) {
+ ALOGE("%s must have a name: %s", xmlEffect.Value(), dump(xmlEffect));
+ return false;
+ }
+ effect.name = name;
+
+ // Function to parse effect.library and effect.uuid from xml
+ auto parseImpl = [&libraries](const XMLElement& xmlImpl, EffectImpl& effect) {
+ // Retrieve library name and uuid from xml
+ const char* libraryName = xmlImpl.Attribute("library");
+ const char* uuid = xmlImpl.Attribute("uuid");
+ if (libraryName == nullptr || uuid == nullptr) {
+ ALOGE("effect must have a library name and a uuid: %s", dump(xmlImpl));
+ return false;
+ }
+
+ // Convert library name to a pointer to the previously loaded library
+ auto* library = findByName(libraryName, libraries);
+ if (library == nullptr) {
+ ALOGE("Could not find library referenced in: %s", dump(xmlImpl));
+ return false;
+ }
+ effect.library = library;
+
+ if (!stringToUuid(uuid, &effect.uuid)) {
+ ALOGE("Invalid uuid in: %s", dump(xmlImpl));
+ return false;
+ }
+ return true;
+ };
+
+ if (!parseImpl(xmlEffect, effect)) {
+ return false;
+ }
+
+ // Handle proxy effects
+ effect.isProxy = false;
+ if (std::strcmp(xmlEffect.Name(), "effectProxy") == 0) {
+ effect.isProxy = true;
+
+ // Function to parse libhw and libsw
+ auto parseProxy = [&xmlEffect, &parseImpl](const char* tag, EffectImpl& proxyLib) {
+ auto* xmlProxyLib = xmlEffect.FirstChildElement(tag);
+ if (xmlProxyLib == nullptr) {
+ ALOGE("effectProxy must contain a <%s>: %s", tag, dump(*xmlProxyLib));
+ return false;
+ }
+ return parseImpl(*xmlProxyLib, proxyLib);
+ };
+ if (!parseProxy("libhw", effect.libHw) || !parseProxy("libsw", effect.libSw)) {
+ return false;
+ }
+ }
+
+ effects->push_back(std::move(effect));
+ return true;
+}
+
+/** Parse an stream from an xml element describing it.
+ * @return true and pushes the stream in streams on success,
+ * false on failure. */
+template <class Stream>
+bool parseStream(const XMLElement& xmlStream, Effects& effects, std::vector<Stream>* streams) {
+ const char* streamType = xmlStream.Attribute("type");
+ if (streamType == nullptr) {
+ ALOGE("stream must have a type: %s", dump(xmlStream));
+ return false;
+ }
+ Stream stream;
+ if (!stringToStreamType(streamType, &stream.type)) {
+ ALOGE("Invalid stream type %s: %s", streamType, dump(xmlStream));
+ return false;
+ }
+
+ for (auto& xmlApply : getChildren(xmlStream, "apply")) {
+ const char* effectName = xmlApply.get().Attribute("effect");
+ if (effectName == nullptr) {
+ ALOGE("stream/apply must have reference an effect: %s", dump(xmlApply));
+ return false;
+ }
+ auto* effect = findByName(effectName, effects);
+ if (effect == nullptr) {
+ ALOGE("Could not find effect referenced in: %s", dump(xmlApply));
+ return false;
+ }
+ stream.effects.emplace_back(*effect);
+ }
+ streams->push_back(std::move(stream));
+ return true;
+}
+
+}; // namespace
+
+ParsingResult parse(const char* path) {
+ XMLDocument doc;
+ doc.LoadFile(path);
+ if (doc.Error()) {
+ ALOGE("Failed to parse %s: Tinyxml2 error (%d): %s", path,
+ doc.ErrorID(), doc.ErrorStr());
+ return {nullptr, 0};
+ }
+
+ auto config = std::make_unique<Config>();
+ size_t nbSkippedElements = 0;
+ auto registerFailure = [&nbSkippedElements](bool result) {
+ nbSkippedElements += result ? 0 : 1;
+ };
+ for (auto& xmlConfig : getChildren(doc, "audio_effects_conf")) {
+
+ // Parse library
+ for (auto& xmlLibraries : getChildren(xmlConfig, "libraries")) {
+ for (auto& xmlLibrary : getChildren(xmlLibraries, "library")) {
+ registerFailure(parseLibrary(xmlLibrary, &config->libraries));
+ }
+ }
+
+ // Parse effects
+ for (auto& xmlEffects : getChildren(xmlConfig, "effects")) {
+ for (auto& xmlEffect : getChildren(xmlEffects)) {
+ registerFailure(parseEffect(xmlEffect, config->libraries, &config->effects));
+ }
+ }
+
+ // Parse pre processing chains
+ for (auto& xmlPreprocess : getChildren(xmlConfig, "preprocess")) {
+ for (auto& xmlStream : getChildren(xmlPreprocess, "stream")) {
+ registerFailure(parseStream(xmlStream, config->effects, &config->preprocess));
+ }
+ }
+
+ // Parse post processing chains
+ for (auto& xmlPostprocess : getChildren(xmlConfig, "postprocess")) {
+ for (auto& xmlStream : getChildren(xmlPostprocess, "stream")) {
+ registerFailure(parseStream(xmlStream, config->effects, &config->postprocess));
+ }
+ }
+ }
+ return {std::move(config), nbSkippedElements};
+}
+
+} // namespace effectsConfig
+} // namespace android
diff --git a/media/libeffects/downmix/Android.mk b/media/libeffects/downmix/Android.mk
index 73f6ef5..a5fbf14 100644
--- a/media/libeffects/downmix/Android.mk
+++ b/media/libeffects/downmix/Android.mk
@@ -20,6 +20,7 @@
$(call include-path-for, audio-effects) \
$(call include-path-for, audio-utils)
+#-DBUILD_FLOAT
LOCAL_CFLAGS += -fvisibility=hidden
LOCAL_CFLAGS += -Wall -Werror
diff --git a/media/libeffects/downmix/EffectDownmix.c b/media/libeffects/downmix/EffectDownmix.c
index 7c685ec..b4a1d77 100644
--- a/media/libeffects/downmix/EffectDownmix.c
+++ b/media/libeffects/downmix/EffectDownmix.c
@@ -33,6 +33,10 @@
#define MINUS_3_DB_IN_Q19_12 2896 // -3dB = 0.707 * 2^12 = 2896
+#ifdef BUILD_FLOAT
+#define MINUS_3_DB_IN_FLOAT 0.70710678f // -3dB = 0.70710678f
+#endif
+
// subset of possible audio_channel_mask_t values, and AUDIO_CHANNEL_OUT_* renamed to CHANNEL_MASK_*
typedef enum {
CHANNEL_MASK_QUAD_BACK = AUDIO_CHANNEL_OUT_QUAD_BACK,
@@ -82,8 +86,19 @@
// number of effects in this library
const int kNbEffects = sizeof(gDescriptors) / sizeof(const effect_descriptor_t *);
-
-
+#ifdef BUILD_FLOAT
+static LVM_FLOAT clamp_float(LVM_FLOAT a) {
+ if (a > 1.0f) {
+ return 1.0f;
+ }
+ else if (a < -1.0f) {
+ return -1.0f;
+ }
+ else {
+ return a;
+ }
+}
+#endif
/*----------------------------------------------------------------------------
* Test code
*--------------------------------------------------------------------------*/
@@ -286,7 +301,7 @@
return -EINVAL;
}
-
+#ifndef BUILD_FLOAT
/*--- Effect Control Interface Implementation ---*/
static int Downmix_Process(effect_handle_t self,
@@ -385,7 +400,108 @@
return 0;
}
+#else /*BUILD_FLOAT*/
+/*--- Effect Control Interface Implementation ---*/
+static int Downmix_Process(effect_handle_t self,
+ audio_buffer_t *inBuffer, audio_buffer_t *outBuffer) {
+
+ downmix_object_t *pDownmixer;
+ LVM_FLOAT *pSrc, *pDst;
+ downmix_module_t *pDwmModule = (downmix_module_t *)self;
+
+ if (pDwmModule == NULL) {
+ return -EINVAL;
+ }
+
+ if (inBuffer == NULL || inBuffer->raw == NULL ||
+ outBuffer == NULL || outBuffer->raw == NULL ||
+ inBuffer->frameCount != outBuffer->frameCount) {
+ return -EINVAL;
+ }
+
+ pDownmixer = (downmix_object_t*) &pDwmModule->context;
+
+ if (pDownmixer->state == DOWNMIX_STATE_UNINITIALIZED) {
+ ALOGE("Downmix_Process error: trying to use an uninitialized downmixer");
+ return -EINVAL;
+ } else if (pDownmixer->state == DOWNMIX_STATE_INITIALIZED) {
+ ALOGE("Downmix_Process error: trying to use a non-configured downmixer");
+ return -ENODATA;
+ }
+
+ pSrc = (LVM_FLOAT *) inBuffer->s16;
+ pDst = (LVM_FLOAT *) outBuffer->s16;
+ size_t numFrames = outBuffer->frameCount;
+
+ const bool accumulate =
+ (pDwmModule->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE);
+ const uint32_t downmixInputChannelMask = pDwmModule->config.inputCfg.channels;
+
+ switch(pDownmixer->type) {
+
+ case DOWNMIX_TYPE_STRIP:
+ if (accumulate) {
+ while (numFrames) {
+ pDst[0] = clamp_float(pDst[0] + pSrc[0]);
+ pDst[1] = clamp_float(pDst[1] + pSrc[1]);
+ pSrc += pDownmixer->input_channel_count;
+ pDst += 2;
+ numFrames--;
+ }
+ } else {
+ while (numFrames) {
+ pDst[0] = pSrc[0];
+ pDst[1] = pSrc[1];
+ pSrc += pDownmixer->input_channel_count;
+ pDst += 2;
+ numFrames--;
+ }
+ }
+ break;
+
+ case DOWNMIX_TYPE_FOLD:
+#ifdef DOWNMIX_ALWAYS_USE_GENERIC_DOWNMIXER
+ // bypass the optimized downmix routines for the common formats
+ if (!Downmix_foldGeneric(
+ downmixInputChannelMask, pSrc, pDst, numFrames, accumulate)) {
+ ALOGE("Multichannel configuration 0x%" PRIx32 " is not supported",
+ downmixInputChannelMask);
+ return -EINVAL;
+ }
+ break;
+#endif
+ // optimize for the common formats
+ switch((downmix_input_channel_mask_t)downmixInputChannelMask) {
+ case CHANNEL_MASK_QUAD_BACK:
+ case CHANNEL_MASK_QUAD_SIDE:
+ Downmix_foldFromQuad(pSrc, pDst, numFrames, accumulate);
+ break;
+ case CHANNEL_MASK_5POINT1_BACK:
+ case CHANNEL_MASK_5POINT1_SIDE:
+ Downmix_foldFrom5Point1(pSrc, pDst, numFrames, accumulate);
+ break;
+ case CHANNEL_MASK_7POINT1:
+ Downmix_foldFrom7Point1(pSrc, pDst, numFrames, accumulate);
+ break;
+ default:
+ if (!Downmix_foldGeneric(
+ downmixInputChannelMask, pSrc, pDst, numFrames, accumulate)) {
+ ALOGE("Multichannel configuration 0x%" PRIx32 " is not supported",
+ downmixInputChannelMask);
+ return -EINVAL;
+ }
+ break;
+ }
+ break;
+
+ default:
+ return -EINVAL;
+ }
+
+ return 0;
+}
+#endif
static int Downmix_Command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize,
void *pCmdData, uint32_t *replySize, void *pReplyData) {
@@ -822,6 +938,7 @@
*
*----------------------------------------------------------------------------
*/
+#ifndef BUILD_FLOAT
void Downmix_foldFromQuad(int16_t *pSrc, int16_t*pDst, size_t numFrames, bool accumulate) {
// sample at index 0 is FL
// sample at index 1 is FR
@@ -849,7 +966,35 @@
}
}
}
-
+#else
+void Downmix_foldFromQuad(LVM_FLOAT *pSrc, LVM_FLOAT *pDst, size_t numFrames, bool accumulate) {
+ // sample at index 0 is FL
+ // sample at index 1 is FR
+ // sample at index 2 is RL
+ // sample at index 3 is RR
+ if (accumulate) {
+ while (numFrames) {
+ // FL + RL
+ pDst[0] = clamp_float(pDst[0] + ((pSrc[0] + pSrc[2]) / 2.0f));
+ // FR + RR
+ pDst[1] = clamp_float(pDst[1] + ((pSrc[1] + pSrc[3]) / 2.0f));
+ pSrc += 4;
+ pDst += 2;
+ numFrames--;
+ }
+ } else { // same code as above but without adding and clamping pDst[i] to itself
+ while (numFrames) {
+ // FL + RL
+ pDst[0] = clamp_float((pSrc[0] + pSrc[2]) / 2.0f);
+ // FR + RR
+ pDst[1] = clamp_float((pSrc[1] + pSrc[3]) / 2.0f);
+ pSrc += 4;
+ pDst += 2;
+ numFrames--;
+ }
+ }
+}
+#endif
/*----------------------------------------------------------------------------
* Downmix_foldFrom5Point1()
@@ -868,6 +1013,7 @@
*
*----------------------------------------------------------------------------
*/
+#ifndef BUILD_FLOAT
void Downmix_foldFrom5Point1(int16_t *pSrc, int16_t*pDst, size_t numFrames, bool accumulate) {
int32_t lt, rt, centerPlusLfeContrib; // samples in Q19.12 format
// sample at index 0 is FL
@@ -912,7 +1058,52 @@
}
}
}
-
+#else
+void Downmix_foldFrom5Point1(LVM_FLOAT *pSrc, LVM_FLOAT *pDst, size_t numFrames, bool accumulate) {
+ LVM_FLOAT lt, rt, centerPlusLfeContrib; // samples in Q19.12 format
+ // sample at index 0 is FL
+ // sample at index 1 is FR
+ // sample at index 2 is FC
+ // sample at index 3 is LFE
+ // sample at index 4 is RL
+ // sample at index 5 is RR
+ // code is mostly duplicated between the two values of accumulate to avoid repeating the test
+ // for every sample
+ if (accumulate) {
+ while (numFrames) {
+ // centerPlusLfeContrib = FC(-3dB) + LFE(-3dB)
+ centerPlusLfeContrib = (pSrc[2] * MINUS_3_DB_IN_FLOAT)
+ + (pSrc[3] * MINUS_3_DB_IN_FLOAT);
+ // FL + centerPlusLfeContrib + RL
+ lt = pSrc[0] + centerPlusLfeContrib + pSrc[4];
+ // FR + centerPlusLfeContrib + RR
+ rt = pSrc[1] + centerPlusLfeContrib + pSrc[5];
+ // accumulate in destination
+ pDst[0] = clamp_float(pDst[0] + (lt / 2.0f));
+ pDst[1] = clamp_float(pDst[1] + (rt / 2.0f));
+ pSrc += 6;
+ pDst += 2;
+ numFrames--;
+ }
+ } else { // same code as above but without adding and clamping pDst[i] to itself
+ while (numFrames) {
+ // centerPlusLfeContrib = FC(-3dB) + LFE(-3dB)
+ centerPlusLfeContrib = (pSrc[2] * MINUS_3_DB_IN_FLOAT)
+ + (pSrc[3] * MINUS_3_DB_IN_FLOAT);
+ // FL + centerPlusLfeContrib + RL
+ lt = pSrc[0] + centerPlusLfeContrib + pSrc[4];
+ // FR + centerPlusLfeContrib + RR
+ rt = pSrc[1] + centerPlusLfeContrib + pSrc[5];
+ // store in destination
+ pDst[0] = clamp_float(lt / 2.0f); // differs from when accumulate is true above
+ pDst[1] = clamp_float(rt / 2.0f); // differs from when accumulate is true above
+ pSrc += 6;
+ pDst += 2;
+ numFrames--;
+ }
+ }
+}
+#endif
/*----------------------------------------------------------------------------
* Downmix_foldFrom7Point1()
@@ -931,6 +1122,7 @@
*
*----------------------------------------------------------------------------
*/
+#ifndef BUILD_FLOAT
void Downmix_foldFrom7Point1(int16_t *pSrc, int16_t*pDst, size_t numFrames, bool accumulate) {
int32_t lt, rt, centerPlusLfeContrib; // samples in Q19.12 format
// sample at index 0 is FL
@@ -977,8 +1169,54 @@
}
}
}
-
-
+#else
+void Downmix_foldFrom7Point1(LVM_FLOAT *pSrc, LVM_FLOAT *pDst, size_t numFrames, bool accumulate) {
+ LVM_FLOAT lt, rt, centerPlusLfeContrib; // samples in Q19.12 format
+ // sample at index 0 is FL
+ // sample at index 1 is FR
+ // sample at index 2 is FC
+ // sample at index 3 is LFE
+ // sample at index 4 is RL
+ // sample at index 5 is RR
+ // sample at index 6 is SL
+ // sample at index 7 is SR
+ // code is mostly duplicated between the two values of accumulate to avoid repeating the test
+ // for every sample
+ if (accumulate) {
+ while (numFrames) {
+ // centerPlusLfeContrib = FC(-3dB) + LFE(-3dB)
+ centerPlusLfeContrib = (pSrc[2] * MINUS_3_DB_IN_Q19_12)
+ + (pSrc[3] * MINUS_3_DB_IN_Q19_12);
+ // FL + centerPlusLfeContrib + SL + RL
+ lt = pSrc[0] + centerPlusLfeContrib + pSrc[6] + pSrc[4];
+ // FR + centerPlusLfeContrib + SR + RR
+ rt = pSrc[1] + centerPlusLfeContrib + pSrc[7] + pSrc[5];
+ //accumulate in destination
+ pDst[0] = clamp_float(pDst[0] + (lt / 2.0f));
+ pDst[1] = clamp_float(pDst[1] + (rt / 2.0f));
+ pSrc += 8;
+ pDst += 2;
+ numFrames--;
+ }
+ } else { // same code as above but without adding and clamping pDst[i] to itself
+ while (numFrames) {
+ // centerPlusLfeContrib = FC(-3dB) + LFE(-3dB)
+ centerPlusLfeContrib = (pSrc[2] * MINUS_3_DB_IN_FLOAT)
+ + (pSrc[3] * MINUS_3_DB_IN_FLOAT);
+ // FL + centerPlusLfeContrib + SL + RL
+ lt = pSrc[0] + centerPlusLfeContrib + pSrc[6] + pSrc[4];
+ // FR + centerPlusLfeContrib + SR + RR
+ rt = pSrc[1] + centerPlusLfeContrib + pSrc[7] + pSrc[5];
+ // store in destination
+ pDst[0] = clamp_float(lt / 2.0f); // differs from when accumulate is true above
+ pDst[1] = clamp_float(rt / 2.0f); // differs from when accumulate is true above
+ pSrc += 8;
+ pDst += 2;
+ numFrames--;
+ }
+ }
+}
+#endif
/*----------------------------------------------------------------------------
* Downmix_foldGeneric()
*----------------------------------------------------------------------------
@@ -1005,6 +1243,7 @@
*
*----------------------------------------------------------------------------
*/
+#ifndef BUILD_FLOAT
bool Downmix_foldGeneric(
uint32_t mask, int16_t *pSrc, int16_t*pDst, size_t numFrames, bool accumulate) {
@@ -1096,3 +1335,96 @@
}
return true;
}
+#else
+bool Downmix_foldGeneric(
+ uint32_t mask, LVM_FLOAT *pSrc, LVM_FLOAT *pDst, size_t numFrames, bool accumulate) {
+
+ if (!Downmix_validChannelMask(mask)) {
+ return false;
+ }
+
+ const bool hasSides = (mask & kSides) != 0;
+ const bool hasBacks = (mask & kBacks) != 0;
+
+ const int numChan = audio_channel_count_from_out_mask(mask);
+ const bool hasFC = ((mask & AUDIO_CHANNEL_OUT_FRONT_CENTER) == AUDIO_CHANNEL_OUT_FRONT_CENTER);
+ const bool hasLFE =
+ ((mask & AUDIO_CHANNEL_OUT_LOW_FREQUENCY) == AUDIO_CHANNEL_OUT_LOW_FREQUENCY);
+ const bool hasBC = ((mask & AUDIO_CHANNEL_OUT_BACK_CENTER) == AUDIO_CHANNEL_OUT_BACK_CENTER);
+ // compute at what index each channel is: samples will be in the following order:
+ // FL FR FC LFE BL BR BC SL SR
+ // when a channel is not present, its index is set to the same as the index of the preceding
+ // channel
+ const int indexFC = hasFC ? 2 : 1; // front center
+ const int indexLFE = hasLFE ? indexFC + 1 : indexFC; // low frequency
+ const int indexBL = hasBacks ? indexLFE + 1 : indexLFE; // back left
+ const int indexBR = hasBacks ? indexBL + 1 : indexBL; // back right
+ const int indexBC = hasBC ? indexBR + 1 : indexBR; // back center
+ const int indexSL = hasSides ? indexBC + 1 : indexBC; // side left
+ const int indexSR = hasSides ? indexSL + 1 : indexSL; // side right
+
+ LVM_FLOAT lt, rt, centersLfeContrib;
+ // code is mostly duplicated between the two values of accumulate to avoid repeating the test
+ // for every sample
+ if (accumulate) {
+ while (numFrames) {
+ // compute contribution of FC, BC and LFE
+ centersLfeContrib = 0;
+ if (hasFC) { centersLfeContrib += pSrc[indexFC]; }
+ if (hasLFE) { centersLfeContrib += pSrc[indexLFE]; }
+ if (hasBC) { centersLfeContrib += pSrc[indexBC]; }
+ centersLfeContrib *= MINUS_3_DB_IN_FLOAT;
+ // always has FL/FR
+ lt = pSrc[0];
+ rt = pSrc[1];
+ // mix in sides and backs
+ if (hasSides) {
+ lt += pSrc[indexSL];
+ rt += pSrc[indexSR];
+ }
+ if (hasBacks) {
+ lt += pSrc[indexBL];
+ rt += pSrc[indexBR];
+ }
+ lt += centersLfeContrib;
+ rt += centersLfeContrib;
+ // accumulate in destination
+ pDst[0] = clamp_float(pDst[0] + (lt / 2.0f));
+ pDst[1] = clamp_float(pDst[1] + (rt / 2.0f));
+ pSrc += numChan;
+ pDst += 2;
+ numFrames--;
+ }
+ } else {
+ while (numFrames) {
+ // compute contribution of FC, BC and LFE
+ centersLfeContrib = 0;
+ if (hasFC) { centersLfeContrib += pSrc[indexFC]; }
+ if (hasLFE) { centersLfeContrib += pSrc[indexLFE]; }
+ if (hasBC) { centersLfeContrib += pSrc[indexBC]; }
+ centersLfeContrib *= MINUS_3_DB_IN_FLOAT;
+ // always has FL/FR
+ lt = pSrc[0];
+ rt = pSrc[1];
+ // mix in sides and backs
+ if (hasSides) {
+ lt += pSrc[indexSL];
+ rt += pSrc[indexSR];
+ }
+ if (hasBacks) {
+ lt += pSrc[indexBL];
+ rt += pSrc[indexBR];
+ }
+ lt += centersLfeContrib;
+ rt += centersLfeContrib;
+ // store in destination
+ pDst[0] = clamp_float(lt / 2.0f); // differs from when accumulate is true above
+ pDst[1] = clamp_float(rt / 2.0f); // differs from when accumulate is true above
+ pSrc += numChan;
+ pDst += 2;
+ numFrames--;
+ }
+ }
+ return true;
+}
+#endif
\ No newline at end of file
diff --git a/media/libeffects/downmix/EffectDownmix.h b/media/libeffects/downmix/EffectDownmix.h
index 2399abd..c1be0f2 100644
--- a/media/libeffects/downmix/EffectDownmix.h
+++ b/media/libeffects/downmix/EffectDownmix.h
@@ -27,7 +27,9 @@
*/
#define DOWNMIX_OUTPUT_CHANNELS AUDIO_CHANNEL_OUT_STEREO
-
+#ifdef BUILD_FLOAT
+#define LVM_FLOAT float
+#endif
typedef enum {
DOWNMIX_STATE_UNINITIALIZED,
DOWNMIX_STATE_INITIALIZED,
@@ -95,11 +97,18 @@
int Downmix_Reset(downmix_object_t *pDownmixer, bool init);
int Downmix_setParameter(downmix_object_t *pDownmixer, int32_t param, uint32_t size, void *pValue);
int Downmix_getParameter(downmix_object_t *pDownmixer, int32_t param, uint32_t *pSize, void *pValue);
-
+#ifdef BUILD_FLOAT
+void Downmix_foldFromQuad(LVM_FLOAT *pSrc, LVM_FLOAT *pDst, size_t numFrames, bool accumulate);
+void Downmix_foldFrom5Point1(LVM_FLOAT *pSrc, LVM_FLOAT *pDst, size_t numFrames, bool accumulate);
+void Downmix_foldFrom7Point1(LVM_FLOAT *pSrc, LVM_FLOAT *pDst, size_t numFrames, bool accumulate);
+bool Downmix_foldGeneric(
+ uint32_t mask, LVM_FLOAT *pSrc, LVM_FLOAT *pDst, size_t numFrames, bool accumulate);
+#else
void Downmix_foldFromQuad(int16_t *pSrc, int16_t*pDst, size_t numFrames, bool accumulate);
void Downmix_foldFrom5Point1(int16_t *pSrc, int16_t*pDst, size_t numFrames, bool accumulate);
void Downmix_foldFrom7Point1(int16_t *pSrc, int16_t*pDst, size_t numFrames, bool accumulate);
bool Downmix_foldGeneric(
uint32_t mask, int16_t *pSrc, int16_t*pDst, size_t numFrames, bool accumulate);
+#endif
#endif /*ANDROID_EFFECTDOWNMIX_H_*/
diff --git a/media/libeffects/factory/Android.bp b/media/libeffects/factory/Android.bp
index 16680bd..ddbfdd8 100644
--- a/media/libeffects/factory/Android.bp
+++ b/media/libeffects/factory/Android.bp
@@ -10,18 +10,47 @@
cc_library_shared {
name: "libeffects",
vendor: true,
- srcs: ["EffectsFactory.c"],
+ srcs: [
+ "EffectsFactory.c",
+ "EffectsConfigLoader.c",
+ "EffectsFactoryState.c",
+ "EffectsXmlConfigLoader.cpp",
+ ],
shared_libs: [
"libcutils",
"liblog",
"libdl",
+ "libeffectsconfig",
],
-
- include_dirs: ["system/media/audio_effects/include"],
+ cflags: ["-fvisibility=hidden"],
local_include_dirs:["include/media"],
- header_libs: ["libeffects_headers"],
+ header_libs: [
+ "libaudioeffects",
+ "libeffects_headers",
+ ],
export_header_lib_headers: ["libeffects_headers"],
}
+
+cc_binary {
+ name: "dumpEffectConfigFile",
+ vendor: true,
+ srcs: ["test/DumpConfig.cpp"],
+
+ compile_multilib: "32",
+
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ ],
+
+
+ shared_libs: [
+ "libeffectsconfig",
+ "libeffects",
+ ],
+ local_include_dirs:[".", "include"],
+}
diff --git a/media/libeffects/factory/EffectsConfigLoader.c b/media/libeffects/factory/EffectsConfigLoader.c
new file mode 100644
index 0000000..fcef36f
--- /dev/null
+++ b/media/libeffects/factory/EffectsConfigLoader.c
@@ -0,0 +1,439 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "EffectsFactoryConfigLoader"
+//#define LOG_NDEBUG 0
+
+#include <dlfcn.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <cutils/config_utils.h>
+#include <cutils/misc.h>
+#include <log/log.h>
+
+#include <system/audio_effects/audio_effects_conf.h>
+
+#include "EffectsConfigLoader.h"
+#include "EffectsFactoryState.h"
+
+/////////////////////////////////////////////////
+// Local functions prototypes
+/////////////////////////////////////////////////
+
+static int loadEffectConfigFile(const char *path);
+static int loadLibraries(cnode *root);
+static int loadLibrary(cnode *root, const char *name);
+static int loadEffects(cnode *root);
+static int loadEffect(cnode *node);
+// To get and add the effect pointed by the passed node to the gSubEffectList
+static int addSubEffect(cnode *root);
+static lib_entry_t *getLibrary(const char *path);
+
+static lib_entry_t *gCachedLibrary; // last library accessed by getLibrary()
+
+int EffectLoadEffectConfig()
+{
+ if (access(AUDIO_EFFECT_VENDOR_CONFIG_FILE, R_OK) == 0) {
+ return loadEffectConfigFile(AUDIO_EFFECT_VENDOR_CONFIG_FILE);
+ } else if (access(AUDIO_EFFECT_DEFAULT_CONFIG_FILE, R_OK) == 0) {
+ return loadEffectConfigFile(AUDIO_EFFECT_DEFAULT_CONFIG_FILE);
+ }
+ return 0;
+}
+
+int loadEffectConfigFile(const char *path)
+{
+ cnode *root;
+ char *data;
+
+ data = load_file(path, NULL);
+ if (data == NULL) {
+ return -ENODEV;
+ }
+ root = config_node("", "");
+ config_load(root, data);
+ loadLibraries(root);
+ loadEffects(root);
+ config_free(root);
+ free(root);
+ free(data);
+
+ return 0;
+}
+
+int loadLibraries(cnode *root)
+{
+ cnode *node;
+
+ node = config_find(root, LIBRARIES_TAG);
+ if (node == NULL) {
+ return -ENOENT;
+ }
+ node = node->first_child;
+ while (node) {
+ loadLibrary(node, node->name);
+ node = node->next;
+ }
+ return 0;
+}
+
+#ifdef __LP64__
+// audio_effects.conf always specifies 32 bit lib path: convert to 64 bit path if needed
+static const char *kLibraryPathRoot[] =
+ {"/odm/lib64/soundfx", "/vendor/lib64/soundfx", "/system/lib64/soundfx"};
+#else
+static const char *kLibraryPathRoot[] =
+ {"/odm/lib/soundfx", "/vendor/lib/soundfx", "/system/lib/soundfx"};
+#endif
+
+static const int kLibraryPathRootSize =
+ (sizeof(kLibraryPathRoot) / sizeof(kLibraryPathRoot[0]));
+
+// Checks if the library path passed as lib_path_in can be opened and if not
+// tries in standard effect library directories with just the library name and returns correct path
+// in lib_path_out
+int checkLibraryPath(const char *lib_path_in, char *lib_path_out) {
+ char *str;
+ const char *lib_name;
+ size_t len;
+
+ if (lib_path_in == NULL || lib_path_out == NULL) {
+ return -EINVAL;
+ }
+
+ strlcpy(lib_path_out, lib_path_in, PATH_MAX);
+
+ // Try exact path first
+ str = strstr(lib_path_out, "/lib/soundfx/");
+ if (str == NULL) {
+ return -EINVAL;
+ }
+
+ // Extract library name from input path
+ len = str - lib_path_out;
+ lib_name = lib_path_in + len + strlen("/lib/soundfx/");
+
+ // Then try with library name and standard path names in order of preference
+ for (int i = 0; i < kLibraryPathRootSize; i++) {
+ char path[PATH_MAX];
+
+ snprintf(path,
+ PATH_MAX,
+ "%s/%s",
+ kLibraryPathRoot[i],
+ lib_name);
+ if (F_OK == access(path, 0)) {
+ strcpy(lib_path_out, path);
+ ALOGW_IF(strncmp(lib_path_out, lib_path_in, PATH_MAX) != 0,
+ "checkLibraryPath() corrected library path %s to %s", lib_path_in, lib_path_out);
+ return 0;
+ }
+ }
+ return -EINVAL;
+}
+
+
+
+int loadLibrary(cnode *root, const char *name)
+{
+ cnode *node;
+ void *hdl = NULL;
+ audio_effect_library_t *desc;
+ list_elem_t *e;
+ lib_entry_t *l;
+ char path[PATH_MAX];
+
+ node = config_find(root, PATH_TAG);
+ if (node == NULL) {
+ return -EINVAL;
+ }
+
+ if (checkLibraryPath((const char *)node->value, path) != 0) {
+ ALOGW("loadLibrary() could not find library %s", path);
+ goto error;
+ }
+
+ hdl = dlopen(path, RTLD_NOW);
+ if (hdl == NULL) {
+ ALOGW("loadLibrary() failed to open %s", path);
+ goto error;
+ }
+
+ desc = (audio_effect_library_t *)dlsym(hdl, AUDIO_EFFECT_LIBRARY_INFO_SYM_AS_STR);
+ if (desc == NULL) {
+ ALOGW("loadLibrary() could not find symbol %s", AUDIO_EFFECT_LIBRARY_INFO_SYM_AS_STR);
+ goto error;
+ }
+
+ if (AUDIO_EFFECT_LIBRARY_TAG != desc->tag) {
+ ALOGW("getLibrary() bad tag %08x in lib info struct", desc->tag);
+ goto error;
+ }
+
+ if (EFFECT_API_VERSION_MAJOR(desc->version) !=
+ EFFECT_API_VERSION_MAJOR(EFFECT_LIBRARY_API_VERSION)) {
+ ALOGW("loadLibrary() bad lib version %08x", desc->version);
+ goto error;
+ }
+
+ // add entry for library in gLibraryList
+ l = malloc(sizeof(lib_entry_t));
+ l->name = strndup(name, PATH_MAX);
+ l->path = strndup(path, PATH_MAX);
+ l->handle = hdl;
+ l->desc = desc;
+ l->effects = NULL;
+ pthread_mutex_init(&l->lock, NULL);
+
+ e = malloc(sizeof(list_elem_t));
+ e->object = l;
+ pthread_mutex_lock(&gLibLock);
+ e->next = gLibraryList;
+ gLibraryList = e;
+ pthread_mutex_unlock(&gLibLock);
+ ALOGV("getLibrary() linked library %p for path %s", l, path);
+
+ return 0;
+
+error:
+ if (hdl != NULL) {
+ dlclose(hdl);
+ }
+ //add entry for library errors in gLibraryFailedList
+ lib_failed_entry_t *fl = malloc(sizeof(lib_failed_entry_t));
+ fl->name = strndup(name, PATH_MAX);
+ fl->path = strndup(path, PATH_MAX);
+
+ list_elem_t *fe = malloc(sizeof(list_elem_t));
+ fe->object = fl;
+ fe->next = gLibraryFailedList;
+ gLibraryFailedList = fe;
+ ALOGV("getLibrary() linked error in library %p for path %s", fl, path);
+
+ return -EINVAL;
+}
+
+// This will find the library and UUID tags of the sub effect pointed by the
+// node, gets the effect descriptor and lib_entry_t and adds the subeffect -
+// sub_entry_t to the gSubEffectList
+int addSubEffect(cnode *root)
+{
+ ALOGV("addSubEffect");
+ cnode *node;
+ effect_uuid_t uuid;
+ effect_descriptor_t *d;
+ lib_entry_t *l;
+ list_elem_t *e;
+ node = config_find(root, LIBRARY_TAG);
+ if (node == NULL) {
+ return -EINVAL;
+ }
+ l = getLibrary(node->value);
+ if (l == NULL) {
+ ALOGW("addSubEffect() could not get library %s", node->value);
+ return -EINVAL;
+ }
+ node = config_find(root, UUID_TAG);
+ if (node == NULL) {
+ return -EINVAL;
+ }
+ if (stringToUuid(node->value, &uuid) != 0) {
+ ALOGW("addSubEffect() invalid uuid %s", node->value);
+ return -EINVAL;
+ }
+ d = malloc(sizeof(effect_descriptor_t));
+ if (l->desc->get_descriptor(&uuid, d) != 0) {
+ char s[40];
+ uuidToString(&uuid, s, 40);
+ ALOGW("Error querying effect %s on lib %s", s, l->name);
+ free(d);
+ return -EINVAL;
+ }
+#if (LOG_NDEBUG==0)
+ char s[512];
+ dumpEffectDescriptor(d, s, sizeof(s), 0 /* indent */);
+ ALOGV("addSubEffect() read descriptor %p:%s",d, s);
+#endif
+ if (EFFECT_API_VERSION_MAJOR(d->apiVersion) !=
+ EFFECT_API_VERSION_MAJOR(EFFECT_CONTROL_API_VERSION)) {
+ ALOGW("Bad API version %08x on lib %s", d->apiVersion, l->name);
+ free(d);
+ return -EINVAL;
+ }
+ sub_effect_entry_t *sub_effect = malloc(sizeof(sub_effect_entry_t));
+ sub_effect->object = d;
+ // lib_entry_t is stored since the sub effects are not linked to the library
+ sub_effect->lib = l;
+ e = malloc(sizeof(list_elem_t));
+ e->object = sub_effect;
+ e->next = gSubEffectList->sub_elem;
+ gSubEffectList->sub_elem = e;
+ ALOGV("addSubEffect end");
+ return 0;
+}
+
+int loadEffects(cnode *root)
+{
+ cnode *node;
+
+ node = config_find(root, EFFECTS_TAG);
+ if (node == NULL) {
+ return -ENOENT;
+ }
+ node = node->first_child;
+ while (node) {
+ loadEffect(node);
+ node = node->next;
+ }
+ return 0;
+}
+
+int loadEffect(cnode *root)
+{
+ cnode *node;
+ effect_uuid_t uuid;
+ lib_entry_t *l;
+ effect_descriptor_t *d;
+ list_elem_t *e;
+
+ node = config_find(root, LIBRARY_TAG);
+ if (node == NULL) {
+ return -EINVAL;
+ }
+
+ l = getLibrary(node->value);
+ if (l == NULL) {
+ ALOGW("loadEffect() could not get library %s", node->value);
+ return -EINVAL;
+ }
+
+ node = config_find(root, UUID_TAG);
+ if (node == NULL) {
+ return -EINVAL;
+ }
+ if (stringToUuid(node->value, &uuid) != 0) {
+ ALOGW("loadEffect() invalid uuid %s", node->value);
+ return -EINVAL;
+ }
+ lib_entry_t *tmp;
+ bool skip = false;
+ if (findEffect(NULL, &uuid, &tmp, NULL) == 0) {
+ ALOGW("skipping duplicate uuid %s %s", node->value,
+ node->next ? "and its sub-effects" : "");
+ skip = true;
+ }
+
+ d = malloc(sizeof(effect_descriptor_t));
+ if (l->desc->get_descriptor(&uuid, d) != 0) {
+ char s[40];
+ uuidToString(&uuid, s, 40);
+ ALOGW("Error querying effect %s on lib %s", s, l->name);
+ free(d);
+ return -EINVAL;
+ }
+#if (LOG_NDEBUG==0)
+ char s[512];
+ dumpEffectDescriptor(d, s, sizeof(s), 0 /* indent */);
+ ALOGV("loadEffect() read descriptor %p:%s",d, s);
+#endif
+ if (EFFECT_API_VERSION_MAJOR(d->apiVersion) !=
+ EFFECT_API_VERSION_MAJOR(EFFECT_CONTROL_API_VERSION)) {
+ ALOGW("Bad API version %08x on lib %s", d->apiVersion, l->name);
+ free(d);
+ return -EINVAL;
+ }
+ e = malloc(sizeof(list_elem_t));
+ e->object = d;
+ if (skip) {
+ e->next = gSkippedEffects;
+ gSkippedEffects = e;
+ return -EINVAL;
+ } else {
+ e->next = l->effects;
+ l->effects = e;
+ }
+
+ // After the UUID node in the config_tree, if node->next is valid,
+ // that would be sub effect node.
+ // Find the sub effects and add them to the gSubEffectList
+ node = node->next;
+ int count = 2;
+ bool hwSubefx = false, swSubefx = false;
+ list_sub_elem_t *sube = NULL;
+ if (node != NULL) {
+ ALOGV("Adding the effect to gEffectSubList as there are sub effects");
+ sube = malloc(sizeof(list_sub_elem_t));
+ sube->object = d;
+ sube->sub_elem = NULL;
+ sube->next = gSubEffectList;
+ gSubEffectList = sube;
+ }
+ while (node != NULL && count) {
+ if (addSubEffect(node)) {
+ ALOGW("loadEffect() could not add subEffect %s", node->value);
+ // Change the gSubEffectList to point to older list;
+ gSubEffectList = sube->next;
+ free(sube->sub_elem);// Free an already added sub effect
+ sube->sub_elem = NULL;
+ free(sube);
+ return -ENOENT;
+ }
+ sub_effect_entry_t *subEntry = (sub_effect_entry_t*)gSubEffectList->sub_elem->object;
+ effect_descriptor_t *subEffectDesc = (effect_descriptor_t*)(subEntry->object);
+ // Since we return a dummy descriptor for the proxy during
+ // get_descriptor call,we replace it with the correspoding
+ // sw effect descriptor, but with Proxy UUID
+ // check for Sw desc
+ if (!((subEffectDesc->flags & EFFECT_FLAG_HW_ACC_MASK) ==
+ EFFECT_FLAG_HW_ACC_TUNNEL)) {
+ swSubefx = true;
+ *d = *subEffectDesc;
+ d->uuid = uuid;
+ ALOGV("loadEffect() Changed the Proxy desc");
+ } else
+ hwSubefx = true;
+ count--;
+ node = node->next;
+ }
+ // 1 HW and 1 SW sub effect found. Set the offload flag in the Proxy desc
+ if (hwSubefx && swSubefx) {
+ d->flags |= EFFECT_FLAG_OFFLOAD_SUPPORTED;
+ }
+ return 0;
+}
+
+lib_entry_t *getLibrary(const char *name)
+{
+ list_elem_t *e;
+
+ if (gCachedLibrary &&
+ !strncmp(gCachedLibrary->name, name, PATH_MAX)) {
+ return gCachedLibrary;
+ }
+
+ e = gLibraryList;
+ while (e) {
+ lib_entry_t *l = (lib_entry_t *)e->object;
+ if (!strcmp(l->name, name)) {
+ gCachedLibrary = l;
+ return l;
+ }
+ e = e->next;
+ }
+
+ return NULL;
+}
diff --git a/media/libeffects/factory/EffectsConfigLoader.h b/media/libeffects/factory/EffectsConfigLoader.h
new file mode 100644
index 0000000..3f82609
--- /dev/null
+++ b/media/libeffects/factory/EffectsConfigLoader.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_EFFECTSCONFIGLOADER_H
+#define ANDROID_EFFECTSCONFIGLOADER_H
+
+#include <cutils/compiler.h>
+#include "EffectsFactoryState.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** Parses the platform effect configuration
+ * and stores its content in the global EffectFactoryState. */
+ANDROID_API
+int EffectLoadEffectConfig();
+
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // ANDROID_EFFECTSCONFIGLOADER_H
diff --git a/media/libeffects/factory/EffectsFactory.c b/media/libeffects/factory/EffectsFactory.c
index 37c0bb7..c1ce513 100644
--- a/media/libeffects/factory/EffectsFactory.c
+++ b/media/libeffects/factory/EffectsFactory.c
@@ -17,65 +17,46 @@
#define LOG_TAG "EffectsFactory"
//#define LOG_NDEBUG 0
-#include "EffectsFactory.h"
-
-#include <dlfcn.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <cutils/config_utils.h>
-#include <cutils/misc.h>
#include <cutils/properties.h>
#include <log/log.h>
-#include <system/audio_effects/audio_effects_conf.h>
+#include <media/EffectsFactoryApi.h>
+
+#include "EffectsConfigLoader.h"
+#include "EffectsFactoryState.h"
+#include "EffectsXmlConfigLoader.h"
+
+#include "EffectsFactory.h"
static list_elem_t *gEffectList; // list of effect_entry_t: all currently created effects
-static list_elem_t *gLibraryList; // list of lib_entry_t: all currently loaded libraries
-static list_elem_t *gSkippedEffects; // list of effects skipped because of duplicate uuid
-// list of effect_descriptor and list of sub effects : all currently loaded
-// It does not contain effects without sub effects.
-static list_sub_elem_t *gSubEffectList;
-static pthread_mutex_t gLibLock = PTHREAD_MUTEX_INITIALIZER; // controls access to gLibraryList
static uint32_t gNumEffects; // total number number of effects
static list_elem_t *gCurLib; // current library in enumeration process
static list_elem_t *gCurEffect; // current effect in enumeration process
static uint32_t gCurEffectIdx; // current effect index in enumeration process
-static lib_entry_t *gCachedLibrary; // last library accessed by getLibrary()
+/** Number of elements skipped during the effects configuration loading.
+ * -1 if the config loader failed
+ * -2 if config load was skipped
+ */
+static ssize_t gConfigNbElemSkipped = -2;
static int gInitDone; // true is global initialization has been preformed
static int gCanQueryEffect; // indicates that call to EffectQueryEffect() is valid, i.e. that the list of effects
// was not modified since last call to EffectQueryNumberEffects()
-
-static list_elem_t *gLibraryFailedList; //list of lib_failed_entry_t: libraries failed to load
-
/////////////////////////////////////////////////
// Local functions prototypes
/////////////////////////////////////////////////
static int init();
-static int loadEffectConfigFile(const char *path);
-static int loadLibraries(cnode *root);
-static int loadLibrary(cnode *root, const char *name);
-static int loadEffects(cnode *root);
-static int loadEffect(cnode *node);
-// To get and add the effect pointed by the passed node to the gSubEffectList
-static int addSubEffect(cnode *root);
-static lib_entry_t *getLibrary(const char *path);
static void resetEffectEnumeration();
static uint32_t updateNumEffects();
-static int findEffect(const effect_uuid_t *type,
- const effect_uuid_t *uuid,
- lib_entry_t **lib,
- effect_descriptor_t **desc);
// To search a subeffect in the gSubEffectList
static int findSubEffect(const effect_uuid_t *uuid,
lib_entry_t **lib,
effect_descriptor_t **desc);
-static void dumpEffectDescriptor(effect_descriptor_t *desc, char *str, size_t len, int indent);
-static int stringToUuid(const char *str, effect_uuid_t *uuid);
-static int uuidToString(const effect_uuid_t *uuid, char *str, size_t maxLen);
/////////////////////////////////////////////////
// Effect Control Interface functions
@@ -280,7 +261,6 @@
effect_descriptor_t *d = NULL;
effect_handle_t itfe;
effect_entry_t *fx;
- int found = 0;
int ret;
if (uuid == NULL || pHandle == NULL) {
@@ -447,8 +427,6 @@
/////////////////////////////////////////////////
int init() {
- int hdl;
-
if (gInitDone) {
return 0;
}
@@ -461,10 +439,12 @@
if (ignoreFxConfFiles) {
ALOGI("Audio effects in configuration files will be ignored");
} else {
- if (access(AUDIO_EFFECT_VENDOR_CONFIG_FILE, R_OK) == 0) {
- loadEffectConfigFile(AUDIO_EFFECT_VENDOR_CONFIG_FILE);
- } else if (access(AUDIO_EFFECT_DEFAULT_CONFIG_FILE, R_OK) == 0) {
- loadEffectConfigFile(AUDIO_EFFECT_DEFAULT_CONFIG_FILE);
+ gConfigNbElemSkipped = EffectLoadXmlEffectConfig(NULL);
+ if (gConfigNbElemSkipped < 0) {
+ ALOGW("Failed to load XML effect configuration, fallback to .conf");
+ EffectLoadEffectConfig();
+ } else if (gConfigNbElemSkipped > 0) {
+ ALOGE("Effect config is partially invalid, skipped %zd elements", gConfigNbElemSkipped);
}
}
@@ -474,367 +454,6 @@
return 0;
}
-int loadEffectConfigFile(const char *path)
-{
- cnode *root;
- char *data;
-
- data = load_file(path, NULL);
- if (data == NULL) {
- return -ENODEV;
- }
- root = config_node("", "");
- config_load(root, data);
- loadLibraries(root);
- loadEffects(root);
- config_free(root);
- free(root);
- free(data);
-
- return 0;
-}
-
-int loadLibraries(cnode *root)
-{
- cnode *node;
-
- node = config_find(root, LIBRARIES_TAG);
- if (node == NULL) {
- return -ENOENT;
- }
- node = node->first_child;
- while (node) {
- loadLibrary(node, node->name);
- node = node->next;
- }
- return 0;
-}
-
-#ifdef __LP64__
-// audio_effects.conf always specifies 32 bit lib path: convert to 64 bit path if needed
-static const char *kLibraryPathRoot[] =
- {"/odm/lib64/soundfx", "/vendor/lib64/soundfx", "/system/lib64/soundfx"};
-#else
-static const char *kLibraryPathRoot[] =
- {"/odm/lib/soundfx", "/vendor/lib/soundfx", "/system/lib/soundfx"};
-#endif
-
-static const int kLibraryPathRootSize =
- (sizeof(kLibraryPathRoot) / sizeof(kLibraryPathRoot[0]));
-
-// Checks if the library path passed as lib_path_in can be opened and if not
-// tries in standard effect library directories with just the library name and returns correct path
-// in lib_path_out
-int checkLibraryPath(const char *lib_path_in, char *lib_path_out) {
- char *str;
- const char *lib_name;
- size_t len;
-
- if (lib_path_in == NULL || lib_path_out == NULL) {
- return -EINVAL;
- }
-
- strlcpy(lib_path_out, lib_path_in, PATH_MAX);
-
- // Try exact path first
- str = strstr(lib_path_out, "/lib/soundfx/");
- if (str == NULL) {
- return -EINVAL;
- }
-
- // Extract library name from input path
- len = str - lib_path_out;
- lib_name = lib_path_in + len + strlen("/lib/soundfx/");
-
- // Then try with library name and standard path names in order of preference
- for (int i = 0; i < kLibraryPathRootSize; i++) {
- char path[PATH_MAX];
-
- snprintf(path,
- PATH_MAX,
- "%s/%s",
- kLibraryPathRoot[i],
- lib_name);
- if (F_OK == access(path, 0)) {
- strcpy(lib_path_out, path);
- ALOGW_IF(strncmp(lib_path_out, lib_path_in, PATH_MAX) != 0,
- "checkLibraryPath() corrected library path %s to %s", lib_path_in, lib_path_out);
- return 0;
- }
- }
- return -EINVAL;
-}
-
-
-
-int loadLibrary(cnode *root, const char *name)
-{
- cnode *node;
- void *hdl = NULL;
- audio_effect_library_t *desc;
- list_elem_t *e;
- lib_entry_t *l;
- char path[PATH_MAX];
-
- node = config_find(root, PATH_TAG);
- if (node == NULL) {
- return -EINVAL;
- }
-
- if (checkLibraryPath((const char *)node->value, path) != 0) {
- ALOGW("loadLibrary() could not find library %s", path);
- goto error;
- }
-
- hdl = dlopen(path, RTLD_NOW);
- if (hdl == NULL) {
- ALOGW("loadLibrary() failed to open %s", path);
- goto error;
- }
-
- desc = (audio_effect_library_t *)dlsym(hdl, AUDIO_EFFECT_LIBRARY_INFO_SYM_AS_STR);
- if (desc == NULL) {
- ALOGW("loadLibrary() could not find symbol %s", AUDIO_EFFECT_LIBRARY_INFO_SYM_AS_STR);
- goto error;
- }
-
- if (AUDIO_EFFECT_LIBRARY_TAG != desc->tag) {
- ALOGW("getLibrary() bad tag %08x in lib info struct", desc->tag);
- goto error;
- }
-
- if (EFFECT_API_VERSION_MAJOR(desc->version) !=
- EFFECT_API_VERSION_MAJOR(EFFECT_LIBRARY_API_VERSION)) {
- ALOGW("loadLibrary() bad lib version %08x", desc->version);
- goto error;
- }
-
- // add entry for library in gLibraryList
- l = malloc(sizeof(lib_entry_t));
- l->name = strndup(name, PATH_MAX);
- l->path = strndup(path, PATH_MAX);
- l->handle = hdl;
- l->desc = desc;
- l->effects = NULL;
- pthread_mutex_init(&l->lock, NULL);
-
- e = malloc(sizeof(list_elem_t));
- e->object = l;
- pthread_mutex_lock(&gLibLock);
- e->next = gLibraryList;
- gLibraryList = e;
- pthread_mutex_unlock(&gLibLock);
- ALOGV("getLibrary() linked library %p for path %s", l, path);
-
- return 0;
-
-error:
- if (hdl != NULL) {
- dlclose(hdl);
- }
- //add entry for library errors in gLibraryFailedList
- lib_failed_entry_t *fl = malloc(sizeof(lib_failed_entry_t));
- fl->name = strndup(name, PATH_MAX);
- fl->path = strndup(path, PATH_MAX);
-
- list_elem_t *fe = malloc(sizeof(list_elem_t));
- fe->object = fl;
- fe->next = gLibraryFailedList;
- gLibraryFailedList = fe;
- ALOGV("getLibrary() linked error in library %p for path %s", fl, path);
-
- return -EINVAL;
-}
-
-// This will find the library and UUID tags of the sub effect pointed by the
-// node, gets the effect descriptor and lib_entry_t and adds the subeffect -
-// sub_entry_t to the gSubEffectList
-int addSubEffect(cnode *root)
-{
- ALOGV("addSubEffect");
- cnode *node;
- effect_uuid_t uuid;
- effect_descriptor_t *d;
- lib_entry_t *l;
- list_elem_t *e;
- node = config_find(root, LIBRARY_TAG);
- if (node == NULL) {
- return -EINVAL;
- }
- l = getLibrary(node->value);
- if (l == NULL) {
- ALOGW("addSubEffect() could not get library %s", node->value);
- return -EINVAL;
- }
- node = config_find(root, UUID_TAG);
- if (node == NULL) {
- return -EINVAL;
- }
- if (stringToUuid(node->value, &uuid) != 0) {
- ALOGW("addSubEffect() invalid uuid %s", node->value);
- return -EINVAL;
- }
- d = malloc(sizeof(effect_descriptor_t));
- if (l->desc->get_descriptor(&uuid, d) != 0) {
- char s[40];
- uuidToString(&uuid, s, 40);
- ALOGW("Error querying effect %s on lib %s", s, l->name);
- free(d);
- return -EINVAL;
- }
-#if (LOG_NDEBUG==0)
- char s[512];
- dumpEffectDescriptor(d, s, sizeof(s), 0 /* indent */);
- ALOGV("addSubEffect() read descriptor %p:%s",d, s);
-#endif
- if (EFFECT_API_VERSION_MAJOR(d->apiVersion) !=
- EFFECT_API_VERSION_MAJOR(EFFECT_CONTROL_API_VERSION)) {
- ALOGW("Bad API version %08x on lib %s", d->apiVersion, l->name);
- free(d);
- return -EINVAL;
- }
- sub_effect_entry_t *sub_effect = malloc(sizeof(sub_effect_entry_t));
- sub_effect->object = d;
- // lib_entry_t is stored since the sub effects are not linked to the library
- sub_effect->lib = l;
- e = malloc(sizeof(list_elem_t));
- e->object = sub_effect;
- e->next = gSubEffectList->sub_elem;
- gSubEffectList->sub_elem = e;
- ALOGV("addSubEffect end");
- return 0;
-}
-
-int loadEffects(cnode *root)
-{
- cnode *node;
-
- node = config_find(root, EFFECTS_TAG);
- if (node == NULL) {
- return -ENOENT;
- }
- node = node->first_child;
- while (node) {
- loadEffect(node);
- node = node->next;
- }
- return 0;
-}
-
-int loadEffect(cnode *root)
-{
- cnode *node;
- effect_uuid_t uuid;
- lib_entry_t *l;
- effect_descriptor_t *d;
- list_elem_t *e;
-
- node = config_find(root, LIBRARY_TAG);
- if (node == NULL) {
- return -EINVAL;
- }
-
- l = getLibrary(node->value);
- if (l == NULL) {
- ALOGW("loadEffect() could not get library %s", node->value);
- return -EINVAL;
- }
-
- node = config_find(root, UUID_TAG);
- if (node == NULL) {
- return -EINVAL;
- }
- if (stringToUuid(node->value, &uuid) != 0) {
- ALOGW("loadEffect() invalid uuid %s", node->value);
- return -EINVAL;
- }
- lib_entry_t *tmp;
- bool skip = false;
- if (findEffect(NULL, &uuid, &tmp, NULL) == 0) {
- ALOGW("skipping duplicate uuid %s %s", node->value,
- node->next ? "and its sub-effects" : "");
- skip = true;
- }
-
- d = malloc(sizeof(effect_descriptor_t));
- if (l->desc->get_descriptor(&uuid, d) != 0) {
- char s[40];
- uuidToString(&uuid, s, 40);
- ALOGW("Error querying effect %s on lib %s", s, l->name);
- free(d);
- return -EINVAL;
- }
-#if (LOG_NDEBUG==0)
- char s[512];
- dumpEffectDescriptor(d, s, sizeof(s), 0 /* indent */);
- ALOGV("loadEffect() read descriptor %p:%s",d, s);
-#endif
- if (EFFECT_API_VERSION_MAJOR(d->apiVersion) !=
- EFFECT_API_VERSION_MAJOR(EFFECT_CONTROL_API_VERSION)) {
- ALOGW("Bad API version %08x on lib %s", d->apiVersion, l->name);
- free(d);
- return -EINVAL;
- }
- e = malloc(sizeof(list_elem_t));
- e->object = d;
- if (skip) {
- e->next = gSkippedEffects;
- gSkippedEffects = e;
- return -EINVAL;
- } else {
- e->next = l->effects;
- l->effects = e;
- }
-
- // After the UUID node in the config_tree, if node->next is valid,
- // that would be sub effect node.
- // Find the sub effects and add them to the gSubEffectList
- node = node->next;
- int count = 2;
- bool hwSubefx = false, swSubefx = false;
- list_sub_elem_t *sube = NULL;
- if (node != NULL) {
- ALOGV("Adding the effect to gEffectSubList as there are sub effects");
- sube = malloc(sizeof(list_sub_elem_t));
- sube->object = d;
- sube->sub_elem = NULL;
- sube->next = gSubEffectList;
- gSubEffectList = sube;
- }
- while (node != NULL && count) {
- if (addSubEffect(node)) {
- ALOGW("loadEffect() could not add subEffect %s", node->value);
- // Change the gSubEffectList to point to older list;
- gSubEffectList = sube->next;
- free(sube->sub_elem);// Free an already added sub effect
- sube->sub_elem = NULL;
- free(sube);
- return -ENOENT;
- }
- sub_effect_entry_t *subEntry = (sub_effect_entry_t*)gSubEffectList->sub_elem->object;
- effect_descriptor_t *subEffectDesc = (effect_descriptor_t*)(subEntry->object);
- // Since we return a dummy descriptor for the proxy during
- // get_descriptor call,we replace it with the correspoding
- // sw effect descriptor, but with Proxy UUID
- // check for Sw desc
- if (!((subEffectDesc->flags & EFFECT_FLAG_HW_ACC_MASK) ==
- EFFECT_FLAG_HW_ACC_TUNNEL)) {
- swSubefx = true;
- *d = *subEffectDesc;
- d->uuid = uuid;
- ALOGV("loadEffect() Changed the Proxy desc");
- } else
- hwSubefx = true;
- count--;
- node = node->next;
- }
- // 1 HW and 1 SW sub effect found. Set the offload flag in the Proxy desc
- if (hwSubefx && swSubefx) {
- d->flags |= EFFECT_FLAG_OFFLOAD_SUPPORTED;
- }
- return 0;
-}
-
// Searches the sub effect matching to the specified uuid
// in the gSubEffectList. It gets the lib_entry_t for
// the matched sub_effect . Used in EffectCreate of sub effects
@@ -881,29 +500,6 @@
return ret;
}
-lib_entry_t *getLibrary(const char *name)
-{
- list_elem_t *e;
-
- if (gCachedLibrary &&
- !strncmp(gCachedLibrary->name, name, PATH_MAX)) {
- return gCachedLibrary;
- }
-
- e = gLibraryList;
- while (e) {
- lib_entry_t *l = (lib_entry_t *)e->object;
- if (!strcmp(l->name, name)) {
- gCachedLibrary = l;
- return l;
- }
- e = e->next;
- }
-
- return NULL;
-}
-
-
void resetEffectEnumeration()
{
gCurLib = gLibraryList;
@@ -935,114 +531,6 @@
return cnt;
}
-int findEffect(const effect_uuid_t *type,
- const effect_uuid_t *uuid,
- lib_entry_t **lib,
- effect_descriptor_t **desc)
-{
- list_elem_t *e = gLibraryList;
- lib_entry_t *l = NULL;
- effect_descriptor_t *d = NULL;
- int found = 0;
- int ret = 0;
-
- while (e && !found) {
- l = (lib_entry_t *)e->object;
- list_elem_t *efx = l->effects;
- while (efx) {
- d = (effect_descriptor_t *)efx->object;
- if (type != NULL && memcmp(&d->type, type, sizeof(effect_uuid_t)) == 0) {
- found = 1;
- break;
- }
- if (uuid != NULL && memcmp(&d->uuid, uuid, sizeof(effect_uuid_t)) == 0) {
- found = 1;
- break;
- }
- efx = efx->next;
- }
- e = e->next;
- }
- if (!found) {
- ALOGV("findEffect() effect not found");
- ret = -ENOENT;
- } else {
- ALOGV("findEffect() found effect: %s in lib %s", d->name, l->name);
- *lib = l;
- if (desc) {
- *desc = d;
- }
- }
-
- return ret;
-}
-
-void dumpEffectDescriptor(effect_descriptor_t *desc, char *str, size_t len, int indent) {
- char s[256];
- char ss[256];
- char idt[indent + 1];
-
- memset(idt, ' ', indent);
- idt[indent] = 0;
-
- str[0] = 0;
-
- snprintf(s, sizeof(s), "%s%s / %s\n", idt, desc->name, desc->implementor);
- strlcat(str, s, len);
-
- uuidToString(&desc->uuid, s, sizeof(s));
- snprintf(ss, sizeof(ss), "%s UUID: %s\n", idt, s);
- strlcat(str, ss, len);
-
- uuidToString(&desc->type, s, sizeof(s));
- snprintf(ss, sizeof(ss), "%s TYPE: %s\n", idt, s);
- strlcat(str, ss, len);
-
- sprintf(s, "%s apiVersion: %08X\n%s flags: %08X\n", idt,
- desc->apiVersion, idt, desc->flags);
- strlcat(str, s, len);
-}
-
-int stringToUuid(const char *str, effect_uuid_t *uuid)
-{
- int tmp[10];
-
- if (sscanf(str, "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x",
- tmp, tmp+1, tmp+2, tmp+3, tmp+4, tmp+5, tmp+6, tmp+7, tmp+8, tmp+9) < 10) {
- return -EINVAL;
- }
- uuid->timeLow = (uint32_t)tmp[0];
- uuid->timeMid = (uint16_t)tmp[1];
- uuid->timeHiAndVersion = (uint16_t)tmp[2];
- uuid->clockSeq = (uint16_t)tmp[3];
- uuid->node[0] = (uint8_t)tmp[4];
- uuid->node[1] = (uint8_t)tmp[5];
- uuid->node[2] = (uint8_t)tmp[6];
- uuid->node[3] = (uint8_t)tmp[7];
- uuid->node[4] = (uint8_t)tmp[8];
- uuid->node[5] = (uint8_t)tmp[9];
-
- return 0;
-}
-
-int uuidToString(const effect_uuid_t *uuid, char *str, size_t maxLen)
-{
-
- snprintf(str, maxLen, "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x",
- uuid->timeLow,
- uuid->timeMid,
- uuid->timeHiAndVersion,
- uuid->clockSeq,
- uuid->node[0],
- uuid->node[1],
- uuid->node[2],
- uuid->node[3],
- uuid->node[4],
- uuid->node[5]);
-
- return 0;
-}
-
int EffectDumpEffects(int fd) {
char s[512];
@@ -1061,7 +549,6 @@
list_elem_t *e = gLibraryList;
lib_entry_t *l = NULL;
effect_descriptor_t *d = NULL;
- int found = 0;
int ret = 0;
dprintf(fd, "Libraries loaded:\n");
@@ -1092,6 +579,20 @@
e = e->next;
}
}
+ switch (gConfigNbElemSkipped) {
+ case -2:
+ dprintf(fd, "Effect configuration loading skipped.\n");
+ break;
+ case -1:
+ dprintf(fd, "XML effect configuration failed to load.\n");
+ break;
+ case 0:
+ dprintf(fd, "XML effect configuration loaded successfully.\n");
+ break;
+ default:
+ dprintf(fd, "XML effect configuration partially loaded, skipped %zd elements.\n",
+ gConfigNbElemSkipped);
+ }
return ret;
}
diff --git a/media/libeffects/factory/EffectsFactory.h b/media/libeffects/factory/EffectsFactory.h
index 72e0931..29dbc9c 100644
--- a/media/libeffects/factory/EffectsFactory.h
+++ b/media/libeffects/factory/EffectsFactory.h
@@ -20,7 +20,7 @@
#include <dirent.h>
#include <pthread.h>
-#include <android/log.h>
+#include <cutils/compiler.h>
#include <hardware/audio_effect.h>
#if __cplusplus
@@ -96,6 +96,7 @@
// *pDescriptor: updated with the sub effect descriptors.
//
////////////////////////////////////////////////////////////////////////////////
+ANDROID_API
int EffectGetSubEffects(const effect_uuid_t *pEffectUuid,
sub_effect_entry_t **pSube,
size_t size);
diff --git a/media/libeffects/factory/EffectsFactoryState.c b/media/libeffects/factory/EffectsFactoryState.c
new file mode 100644
index 0000000..b364004
--- /dev/null
+++ b/media/libeffects/factory/EffectsFactoryState.c
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "EffectsFactoryState"
+
+#include "EffectsFactoryState.h"
+
+#include "log/log.h"
+
+list_elem_t *gLibraryList;
+list_elem_t *gSkippedEffects;
+list_sub_elem_t *gSubEffectList;
+pthread_mutex_t gLibLock = PTHREAD_MUTEX_INITIALIZER;
+
+list_elem_t *gLibraryFailedList; //list of lib_failed_entry_t: libraries failed to load
+
+
+int findEffect(const effect_uuid_t *type,
+ const effect_uuid_t *uuid,
+ lib_entry_t **lib,
+ effect_descriptor_t **desc)
+{
+ list_elem_t *e = gLibraryList;
+ lib_entry_t *l = NULL;
+ effect_descriptor_t *d = NULL;
+ int found = 0;
+ int ret = 0;
+
+ while (e && !found) {
+ l = (lib_entry_t *)e->object;
+ list_elem_t *efx = l->effects;
+ while (efx) {
+ d = (effect_descriptor_t *)efx->object;
+ if (type != NULL && memcmp(&d->type, type, sizeof(effect_uuid_t)) == 0) {
+ found = 1;
+ break;
+ }
+ if (uuid != NULL && memcmp(&d->uuid, uuid, sizeof(effect_uuid_t)) == 0) {
+ found = 1;
+ break;
+ }
+ efx = efx->next;
+ }
+ e = e->next;
+ }
+ if (!found) {
+ ALOGV("findEffect() effect not found");
+ ret = -ENOENT;
+ } else {
+ ALOGV("findEffect() found effect: %s in lib %s", d->name, l->name);
+ *lib = l;
+ if (desc) {
+ *desc = d;
+ }
+ }
+
+ return ret;
+}
+
+int stringToUuid(const char *str, effect_uuid_t *uuid)
+{
+ int tmp[10];
+
+ if (sscanf(str, "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x",
+ tmp, tmp+1, tmp+2, tmp+3, tmp+4, tmp+5, tmp+6, tmp+7, tmp+8, tmp+9) < 10) {
+ return -EINVAL;
+ }
+ uuid->timeLow = (uint32_t)tmp[0];
+ uuid->timeMid = (uint16_t)tmp[1];
+ uuid->timeHiAndVersion = (uint16_t)tmp[2];
+ uuid->clockSeq = (uint16_t)tmp[3];
+ uuid->node[0] = (uint8_t)tmp[4];
+ uuid->node[1] = (uint8_t)tmp[5];
+ uuid->node[2] = (uint8_t)tmp[6];
+ uuid->node[3] = (uint8_t)tmp[7];
+ uuid->node[4] = (uint8_t)tmp[8];
+ uuid->node[5] = (uint8_t)tmp[9];
+
+ return 0;
+}
+
+int uuidToString(const effect_uuid_t *uuid, char *str, size_t maxLen)
+{
+
+ snprintf(str, maxLen, "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x",
+ uuid->timeLow,
+ uuid->timeMid,
+ uuid->timeHiAndVersion,
+ uuid->clockSeq,
+ uuid->node[0],
+ uuid->node[1],
+ uuid->node[2],
+ uuid->node[3],
+ uuid->node[4],
+ uuid->node[5]);
+
+ return 0;
+}
+
+
+void dumpEffectDescriptor(effect_descriptor_t *desc, char *str, size_t len, int indent) {
+ char s[256];
+ char ss[256];
+ char idt[indent + 1];
+
+ memset(idt, ' ', indent);
+ idt[indent] = 0;
+
+ str[0] = 0;
+
+ snprintf(s, sizeof(s), "%s%s / %s\n", idt, desc->name, desc->implementor);
+ strlcat(str, s, len);
+
+ uuidToString(&desc->uuid, s, sizeof(s));
+ snprintf(ss, sizeof(ss), "%s UUID: %s\n", idt, s);
+ strlcat(str, ss, len);
+
+ uuidToString(&desc->type, s, sizeof(s));
+ snprintf(ss, sizeof(ss), "%s TYPE: %s\n", idt, s);
+ strlcat(str, ss, len);
+
+ sprintf(s, "%s apiVersion: %08X\n%s flags: %08X\n", idt,
+ desc->apiVersion, idt, desc->flags);
+ strlcat(str, s, len);
+}
diff --git a/media/libeffects/factory/EffectsFactoryState.h b/media/libeffects/factory/EffectsFactoryState.h
new file mode 100644
index 0000000..aef945e
--- /dev/null
+++ b/media/libeffects/factory/EffectsFactoryState.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_EFFECTSFACTORYSTATE_H_
+#define ANDROID_EFFECTSFACTORYSTATE_H_
+
+#include "EffectsFactory.h"
+
+#if __cplusplus
+extern "C" {
+#endif
+
+/** @file Contains the state shared with configuration loader of the Effect factory.
+ * This global state should probably be refactor in a structure
+ * provided by the config loader on EffectsFactory init.
+ * This header also contains some helper functions to work on the state.
+ */
+
+extern list_elem_t *gLibraryList; // list of lib_entry_t: all currently loaded libraries
+// list of effects skipped because of duplicate uuid or invalid version
+extern list_elem_t *gSkippedEffects;
+// list of effect_descriptor and list of sub effects : all currently loaded
+// It does not contain effects without sub effects.
+extern list_sub_elem_t *gSubEffectList;
+extern pthread_mutex_t gLibLock; // controls access to gLibraryList
+
+extern list_elem_t *gLibraryFailedList; //list of lib_failed_entry_t: libraries failed to load
+
+
+
+int findEffect(const effect_uuid_t *type,
+ const effect_uuid_t *uuid,
+ lib_entry_t **lib,
+ effect_descriptor_t **desc);
+
+int stringToUuid(const char *str, effect_uuid_t *uuid);
+/** Used to log UUIDs */
+int uuidToString(const effect_uuid_t *uuid, char *str, size_t maxLen);
+
+/** Used for debuging. */
+void dumpEffectDescriptor(effect_descriptor_t *desc, char *str, size_t len, int indent);
+
+#if __cplusplus
+} // extern "C"
+#endif
+
+#endif // ANDROID_EFFECTSFACTORYSTATE_H_
diff --git a/media/libeffects/factory/EffectsXmlConfigLoader.cpp b/media/libeffects/factory/EffectsXmlConfigLoader.cpp
new file mode 100644
index 0000000..438b787
--- /dev/null
+++ b/media/libeffects/factory/EffectsXmlConfigLoader.cpp
@@ -0,0 +1,335 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "EffectsFactoryConfigLoader"
+//#define LOG_NDEBUG 0
+
+#include <dlfcn.h>
+#include <set>
+#include <stdlib.h>
+#include <string>
+
+#include <log/log.h>
+
+#include <media/EffectsConfig.h>
+
+#include "EffectsConfigLoader.h"
+#include "EffectsFactoryState.h"
+#include "EffectsXmlConfigLoader.h"
+
+namespace android {
+
+using namespace effectsConfig;
+
+/////////////////////////////////////////////////
+// Local functions
+/////////////////////////////////////////////////
+
+namespace {
+
+/** Similarly to dlopen, looks for the provided path in LD_EFFECT_LIBRARY_PATH.
+ * @return true if the library is found and set resolvedPath to its absolute path.
+ * false if not found
+ */
+bool resolveLibrary(const std::string& path, std::string* resolvedPath) {
+ for (auto* libraryDirectory : LD_EFFECT_LIBRARY_PATH) {
+ std::string candidatePath = std::string(libraryDirectory) + '/' + path;
+ if (access(candidatePath.c_str(), R_OK) == 0) {
+ *resolvedPath = std::move(candidatePath);
+ return true;
+ }
+ }
+ return false;
+}
+
+/** Loads a library given its relative path and stores the result in libEntry.
+ * @return true on success with libEntry's path, handle and desc filled
+ * false on success with libEntry's path filled with the path of the failed lib
+ * The caller MUST free the resources path (free) and handle (dlclose) if filled.
+ */
+bool loadLibrary(const char* relativePath, lib_entry_t* libEntry) noexcept {
+
+ std::string absolutePath;
+ if (!resolveLibrary(relativePath, &absolutePath)) {
+ ALOGE("Could not find library in effect directories: %s", relativePath);
+ libEntry->path = strdup(relativePath);
+ return false;
+ }
+ const char* path = absolutePath.c_str();
+ libEntry->path = strdup(path);
+
+ // Make sure the lib is closed on early return
+ std::unique_ptr<void, decltype(dlclose)*> libHandle(dlopen(path, RTLD_NOW),
+ dlclose);
+ if (libHandle == nullptr) {
+ ALOGE("Could not dlopen library %s: %s", path, dlerror());
+ return false;
+ }
+
+ auto* description = static_cast<audio_effect_library_t*>(
+ dlsym(libHandle.get(), AUDIO_EFFECT_LIBRARY_INFO_SYM_AS_STR));
+ if (description == nullptr) {
+ ALOGE("Invalid effect library, failed not find symbol '%s' in %s: %s",
+ AUDIO_EFFECT_LIBRARY_INFO_SYM_AS_STR, path, dlerror());
+ return false;
+ }
+
+ if (description->tag != AUDIO_EFFECT_LIBRARY_TAG) {
+ ALOGE("Bad tag %#08x in description structure, expected %#08x for library %s",
+ description->tag, AUDIO_EFFECT_LIBRARY_TAG, path);
+ return false;
+ }
+
+ uint32_t majorVersion = EFFECT_API_VERSION_MAJOR(description->version);
+ uint32_t expectedMajorVersion = EFFECT_API_VERSION_MAJOR(EFFECT_LIBRARY_API_VERSION);
+ if (majorVersion != expectedMajorVersion) {
+ ALOGE("Unsupported major version %#08x, expected %#08x for library %s",
+ majorVersion, expectedMajorVersion, path);
+ return false;
+ }
+
+ libEntry->handle = libHandle.release();
+ libEntry->desc = description;
+ return true;
+}
+
+/** Because the structures will be destroyed by c code, using new to allocate shared structure
+ * is not possible. Provide a equivalent of unique_ptr for malloc/freed structure to make sure
+ * they are not leaked in the c++ code.
+ @{ */
+struct FreeDeleter {
+ void operator()(void* p) {
+ free(p);
+ }
+};
+/** unique_ptr for object created with malloc. */
+template <class T>
+using UniqueCPtr = std::unique_ptr<T, FreeDeleter>;
+
+/** c version of std::make_unique. Uses malloc and free. */
+template <class T>
+UniqueCPtr<T> makeUniqueC() {
+ T* ptr = new (malloc(sizeof(T))) T{}; // Use placement new to initialize the structure
+ return UniqueCPtr<T>{ptr};
+}
+
+/** @} */
+
+/** Push an not owned element in a list_elem link list with an optional lock. */
+template <class T, class ListElem>
+void listPush(T* object, ListElem** list, pthread_mutex_t* mutex = nullptr) noexcept {
+ auto listElem = makeUniqueC<ListElem>();
+ listElem->object = object;
+ if (mutex != nullptr) {
+ pthread_mutex_lock(mutex);
+ }
+ listElem->next = *list;
+ *list = listElem.release();
+ if (mutex != nullptr) {
+ pthread_mutex_unlock(mutex);
+ }
+}
+
+/** Push an owned element in a list_elem link list with an optional lock. */
+template <class T, class ListElem>
+void listPush(UniqueCPtr<T>&& object, ListElem** list, pthread_mutex_t* mutex = nullptr) noexcept {
+ listPush(object.release(), list, mutex);
+}
+
+size_t loadLibraries(const effectsConfig::Libraries& libs,
+ list_elem_t** libList, pthread_mutex_t* libListLock,
+ list_elem_t** libFailedList)
+{
+ size_t nbSkippedElement = 0;
+ for (auto& library : libs) {
+
+ // Construct a lib entry
+ auto libEntry = makeUniqueC<lib_entry_t>();
+ libEntry->name = strdup(library.name.c_str());
+ libEntry->effects = nullptr;
+ pthread_mutex_init(&libEntry->lock, nullptr);
+
+ if (!loadLibrary(library.path.c_str(), libEntry.get())) {
+ // Register library load failure
+ listPush(std::move(libEntry), libFailedList);
+ ++nbSkippedElement;
+ continue;
+ }
+ listPush(std::move(libEntry), libList, libListLock);
+ }
+ return nbSkippedElement;
+}
+
+/** Find a library with the given name in the given list. */
+lib_entry_t* findLibrary(const char* name, list_elem_t* list) {
+
+ while (list != nullptr) {
+ auto* object = static_cast<lib_entry_t*>(list->object);
+ if (strcmp(object->name, name) == 0) {
+ return object;
+ }
+ list = list->next;
+ }
+ return nullptr;
+}
+
+struct UuidStr {
+ /** Length of an uuid represented as string. @TODO: use a constant instead of 40. */
+ char buff[40];
+};
+
+/** @return a string representing the provided uuid.
+ * By not providing an output buffer, it is implicitly created in the caller context.
+ * In such case the return pointer has the same lifetime as the expression containing uuidToString()
+ */
+char* uuidToString(const effect_uuid_t& uuid, UuidStr&& str = {}) {
+ uuidToString(&uuid, str.buff, sizeof(str.buff));
+ return str.buff;
+}
+
+struct LoadEffectResult {
+ /** true if the effect is usable (aka, existing lib, desc, right version, unique uuid) */
+ bool success = false;
+ /** Set if the effect lib was found*/
+ lib_entry_t* lib = nullptr;
+ //* Set if the description was successfuly retrieved from the lib */
+ UniqueCPtr<effect_descriptor_t> effectDesc;
+};
+
+LoadEffectResult loadEffect(const EffectImpl& effect, const std::string& name,
+ list_elem_t* libList) {
+ LoadEffectResult result;
+
+ // Find the effect library
+ result.lib = findLibrary(effect.library->name.c_str(), libList);
+ if (result.lib == nullptr) {
+ ALOGE("Could not find library %s to load effect %s",
+ effect.library->name.c_str(), name.c_str());
+ return result;
+ }
+
+ result.effectDesc = makeUniqueC<effect_descriptor_t>();
+
+ // Get the effect descriptor
+ if (result.lib->desc->get_descriptor(&effect.uuid, result.effectDesc.get()) != 0) {
+ ALOGE("Error querying effect %s on lib %s",
+ uuidToString(effect.uuid), result.lib->name);
+ result.effectDesc.reset();
+ return result;
+ }
+
+ // Dump effect for debug
+#if (LOG_NDEBUG==0)
+ char s[512];
+ dumpEffectDescriptor(result.effectDesc.get(), s, sizeof(s), 0 /* indent */);
+ ALOGV("loadEffect() read descriptor %p:%s", result.effectDesc.get(), s);
+#endif
+
+ // Check effect is supported
+ uint32_t expectedMajorVersion = EFFECT_API_VERSION_MAJOR(EFFECT_CONTROL_API_VERSION);
+ if (EFFECT_API_VERSION_MAJOR(result.effectDesc->apiVersion) != expectedMajorVersion) {
+ ALOGE("Bad API version %#08x for effect %s in lib %s, expected major %#08x",
+ result.effectDesc->apiVersion, name.c_str(), result.lib->name, expectedMajorVersion);
+ return result;
+ }
+
+ lib_entry_t *_;
+ if (findEffect(nullptr, &effect.uuid, &_, nullptr) == 0) {
+ ALOGE("Effect %s uuid %s already exist", uuidToString(effect.uuid), name.c_str());
+ return result;
+ }
+
+ result.success = true;
+ return result;
+}
+
+size_t loadEffects(const Effects& effects, list_elem_t* libList, list_elem_t** skippedEffects,
+ list_sub_elem_t** subEffectList) {
+ size_t nbSkippedElement = 0;
+
+ for (auto& effect : effects) {
+
+ auto effectLoadResult = loadEffect(effect, effect.name, libList);
+ if (!effectLoadResult.success) {
+ if (effectLoadResult.effectDesc != nullptr) {
+ listPush(std::move(effectLoadResult.effectDesc), skippedEffects);
+ }
+ ++nbSkippedElement;
+ continue;
+ }
+
+ if (effect.isProxy) {
+ auto swEffectLoadResult = loadEffect(effect.libSw, effect.name + " libsw", libList);
+ auto hwEffectLoadResult = loadEffect(effect.libHw, effect.name + " libhw", libList);
+ if (!swEffectLoadResult.success || !hwEffectLoadResult.success) {
+ // Push the main effect in the skipped list even if only a subeffect is invalid
+ // as the main effect is not usable without its subeffects.
+ listPush(std::move(effectLoadResult.effectDesc), skippedEffects);
+ ++nbSkippedElement;
+ continue;
+ }
+ listPush(effectLoadResult.effectDesc.get(), subEffectList);
+
+ // Since we return a dummy descriptor for the proxy during
+ // get_descriptor call, we replace it with the corresponding
+ // sw effect descriptor, but keep the Proxy UUID
+ *effectLoadResult.effectDesc = *swEffectLoadResult.effectDesc;
+ effectLoadResult.effectDesc->uuid = effect.uuid;
+
+ effectLoadResult.effectDesc->flags |= EFFECT_FLAG_OFFLOAD_SUPPORTED;
+
+ auto registerSubEffect = [subEffectList](auto&& result) {
+ auto entry = makeUniqueC<sub_effect_entry_t>();
+ entry->object = result.effectDesc.release();
+ // lib_entry_t is stored since the sub effects are not linked to the library
+ entry->lib = result.lib;
+ listPush(std::move(entry), &(*subEffectList)->sub_elem);
+ };
+ registerSubEffect(std::move(swEffectLoadResult));
+ registerSubEffect(std::move(hwEffectLoadResult));
+ }
+
+ listPush(std::move(effectLoadResult.effectDesc), &effectLoadResult.lib->effects);
+ }
+ return nbSkippedElement;
+}
+
+} // namespace
+
+/////////////////////////////////////////////////
+// Interface function
+/////////////////////////////////////////////////
+
+extern "C" ssize_t EffectLoadXmlEffectConfig(const char* path)
+{
+ using effectsConfig::parse;
+ auto result = path ? parse(path) : parse();
+ if (result.parsedConfig == nullptr) {
+ ALOGE("Failed to parse XML configuration file");
+ return -1;
+ }
+ result.nbSkippedElement += loadLibraries(result.parsedConfig->libraries,
+ &gLibraryList, &gLibLock, &gLibraryFailedList) +
+ loadEffects(result.parsedConfig->effects, gLibraryList,
+ &gSkippedEffects, &gSubEffectList);
+
+ ALOGE_IF(result.nbSkippedElement != 0, "%zu errors during loading of configuration: %s",
+ result.nbSkippedElement, path ?: effectsConfig::DEFAULT_PATH);
+
+ return result.nbSkippedElement;
+}
+
+} // namespace android
diff --git a/media/libeffects/factory/EffectsXmlConfigLoader.h b/media/libeffects/factory/EffectsXmlConfigLoader.h
new file mode 100644
index 0000000..a3fe9a3
--- /dev/null
+++ b/media/libeffects/factory/EffectsXmlConfigLoader.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_EFFECTSXMLCONFIGLOADER_H
+#define ANDROID_EFFECTSXMLCONFIGLOADER_H
+
+#include <unistd.h>
+
+#include <cutils/compiler.h>
+
+#include "EffectsFactoryState.h"
+
+#if __cplusplus
+extern "C" {
+#endif
+
+/** Parses the platform effect xml configuration and stores its content in EffectFactoryState.
+ * @param[in] path of the configuration file or NULL to load the default one
+ * @return -1 on unrecoverable error (eg: no configuration file)
+ * 0 on success
+ * the number of invalid elements (lib & effect) skipped if the config is partially invalid
+ * @note this function is exported for test purpose only. Do not call from outside this library.
+ */
+ANDROID_API
+ssize_t EffectLoadXmlEffectConfig(const char* path);
+
+#if __cplusplus
+} // extern "C"
+#endif
+
+#endif // ANDROID_EFFECTSXMLCONFIGLOADER_H
diff --git a/media/libeffects/factory/include/media/EffectsFactoryApi.h b/media/libeffects/factory/include/media/EffectsFactoryApi.h
index 64a3212..a5a12eb 100644
--- a/media/libeffects/factory/include/media/EffectsFactoryApi.h
+++ b/media/libeffects/factory/include/media/EffectsFactoryApi.h
@@ -17,6 +17,7 @@
#ifndef ANDROID_EFFECTSFACTORYAPI_H_
#define ANDROID_EFFECTSFACTORYAPI_H_
+#include <cutils/compiler.h>
#include <errno.h>
#include <stdint.h>
#include <sys/types.h>
@@ -52,6 +53,7 @@
// *pNumEffects: updated with number of effects in factory
//
////////////////////////////////////////////////////////////////////////////////
+ANDROID_API
int EffectQueryNumberEffects(uint32_t *pNumEffects);
////////////////////////////////////////////////////////////////////////////////
@@ -79,6 +81,7 @@
// *pDescriptor: updated with the effect descriptor.
//
////////////////////////////////////////////////////////////////////////////////
+ANDROID_API
int EffectQueryEffect(uint32_t index, effect_descriptor_t *pDescriptor);
////////////////////////////////////////////////////////////////////////////////
@@ -110,6 +113,7 @@
// *pHandle: updated with the effect handle.
//
////////////////////////////////////////////////////////////////////////////////
+ANDROID_API
int EffectCreate(const effect_uuid_t *pEffectUuid, int32_t sessionId, int32_t ioId,
effect_handle_t *pHandle);
@@ -130,6 +134,7 @@
// -EINVAL invalid interface handle
//
////////////////////////////////////////////////////////////////////////////////
+ANDROID_API
int EffectRelease(effect_handle_t handle);
////////////////////////////////////////////////////////////////////////////////
@@ -153,6 +158,7 @@
// *pDescriptor: updated with the effect descriptor.
//
////////////////////////////////////////////////////////////////////////////////
+ANDROID_API
int EffectGetDescriptor(const effect_uuid_t *pEffectUuid, effect_descriptor_t *pDescriptor);
////////////////////////////////////////////////////////////////////////////////
@@ -169,8 +175,10 @@
// 1 if uuid is equal to EFFECT_UUID_NULL.
//
////////////////////////////////////////////////////////////////////////////////
+ANDROID_API
int EffectIsNullUuid(const effect_uuid_t *pEffectUuid);
+ANDROID_API
int EffectDumpEffects(int fd);
#if __cplusplus
diff --git a/media/libeffects/factory/test/DumpConfig.cpp b/media/libeffects/factory/test/DumpConfig.cpp
new file mode 100644
index 0000000..0a156b4
--- /dev/null
+++ b/media/libeffects/factory/test/DumpConfig.cpp
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <media/EffectsFactoryApi.h>
+#include <unistd.h>
+#include "EffectsXmlConfigLoader.h"
+#include "EffectsConfigLoader.h"
+
+int main(int argc, char* argv[]) {
+ const char* path = nullptr;
+ bool legacyFormat;
+
+ if (argc == 2 && strcmp(argv[1], "--legacy") == 0) {
+ legacyFormat = true;
+ fprintf(stderr, "Dumping legacy effect config file\n");
+ } else if ((argc == 2 || argc == 3) && strcmp(argv[1], "--xml") == 0) {
+ legacyFormat = false;
+ if (argc == 3) {
+ fprintf(stderr, "Dumping XML effect config file: %s\n", path);
+ } else {
+ fprintf(stderr, "Dumping default XML effect config file.\n");
+ }
+ } else {
+ fprintf(stderr, "Invalid arguments.\n"
+ "Usage: %s [--legacy|--xml [FILE]]\n", argv[0]);
+ return 1;
+ }
+
+ if (!legacyFormat) {
+ ssize_t ret = EffectLoadXmlEffectConfig(path);
+ if (ret < 0) {
+ fprintf(stderr, "loadXmlEffectConfig failed, see logcat for detail.\n");
+ return 2;
+ }
+ if (ret > 0) {
+ fprintf(stderr, "Partially failed to load config. Skipped %zu elements, "
+ "see logcat for detail.\n", (size_t)ret);
+ }
+ }
+
+ if (legacyFormat) {
+ auto ret = EffectLoadEffectConfig();
+ if (ret < 0) {
+ fprintf(stderr, "loadEffectConfig failed, see logcat for detail.\n");
+ return 3;
+ }
+ fprintf(stderr, "legacy loadEffectConfig has probably succeed, see logcat to make sure.\n");
+ }
+
+ if (EffectDumpEffects(STDOUT_FILENO) != 0) {
+ fprintf(stderr, "Effect dump failed, see logcat for detail.\n");
+ return 4;
+ }
+}
diff --git a/media/libeffects/lvm/lib/Android.mk b/media/libeffects/lvm/lib/Android.mk
index 83e8288..941eb3e 100644
--- a/media/libeffects/lvm/lib/Android.mk
+++ b/media/libeffects/lvm/lib/Android.mk
@@ -72,19 +72,25 @@
Common/src/From2iToMono_16.c \
Common/src/Copy_16.c \
Common/src/MonoTo2I_16.c \
+ Common/src/MonoTo2I_32.c \
Common/src/LoadConst_16.c \
+ Common/src/LoadConst_32.c \
Common/src/dB_to_Lin32.c \
Common/src/Shift_Sat_v16xv16.c \
+ Common/src/Shift_Sat_v32xv32.c \
Common/src/Abs_32.c \
Common/src/Int32RShiftToInt16_Sat_32x16.c \
Common/src/From2iToMono_32.c \
Common/src/mult3s_16x16.c \
+ Common/src/Mult3s_32x16.c \
Common/src/NonLinComp_D16.c \
Common/src/DelayMix_16x16.c \
Common/src/MSTo2i_Sat_16x16.c \
Common/src/From2iToMS_16x16.c \
Common/src/Mac3s_Sat_16x16.c \
+ Common/src/Mac3s_Sat_32x16.c \
Common/src/Add2_Sat_16x16.c \
+ Common/src/Add2_Sat_32x32.c \
Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.c \
Common/src/LVC_MixSoft_1St_D16C31_SAT.c \
Common/src/LVC_Mixer_VarSlope_SetTimeConstant.c \
@@ -120,7 +126,7 @@
$(LOCAL_PATH)/StereoWidening/src \
$(LOCAL_PATH)/StereoWidening/lib
-LOCAL_CFLAGS += -fvisibility=hidden
+LOCAL_CFLAGS += -fvisibility=hidden -DBUILD_FLOAT -DHIGHER_FS
LOCAL_CFLAGS += -Wall -Werror
include $(BUILD_STATIC_LIBRARY)
@@ -179,6 +185,7 @@
$(LOCAL_PATH)/Common/lib \
$(LOCAL_PATH)/Common/src
-LOCAL_CFLAGS += -fvisibility=hidden
+LOCAL_CFLAGS += -fvisibility=hidden -DBUILD_FLOAT -DHIGHER_FS
LOCAL_CFLAGS += -Wall -Werror
+
include $(BUILD_STATIC_LIBRARY)
diff --git a/media/libeffects/lvm/lib/Bass/lib/LVDBE.h b/media/libeffects/lvm/lib/Bass/lib/LVDBE.h
index 228977d..4c2b954 100644
--- a/media/libeffects/lvm/lib/Bass/lib/LVDBE.h
+++ b/media/libeffects/lvm/lib/Bass/lib/LVDBE.h
@@ -198,6 +198,10 @@
#define LVDBE_CAP_FS_32000 64
#define LVDBE_CAP_FS_44100 128
#define LVDBE_CAP_FS_48000 256
+#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
+#define LVDBE_CAP_FS_96000 512
+#define LVDBE_CAP_FS_192000 1024
+#endif
typedef enum
{
@@ -210,6 +214,10 @@
LVDBE_FS_32000 = 6,
LVDBE_FS_44100 = 7,
LVDBE_FS_48000 = 8,
+#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
+ LVDBE_FS_96000 = 9,
+ LVDBE_FS_192000 = 10,
+#endif
LVDBE_FS_MAX = LVM_MAXINT_32
} LVDBE_Fs_en;
@@ -450,12 +458,17 @@
/* NOTES: */
/* */
/****************************************************************************************/
-
+#ifdef BUILD_FLOAT
+LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 NumSamples);
+#else
LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 *pOutData,
LVM_UINT16 NumSamples);
-
+#endif
#ifdef __cplusplus
}
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h b/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
index b1ebadf..f32ed30 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
@@ -19,6 +19,7 @@
#define __LVDBE_COEFFS_H__
+#ifndef BUILD_FLOAT
/************************************************************************************/
/* */
/* General */
@@ -514,5 +515,632 @@
#define MIX_TC_Fs44100 32097 /* Floating point value 0.979515 */
#define MIX_TC_Fs48000 32150 /* Floating point value 0.981150 */
+#else /*BUILD_FLOAT*/
+/************************************************************************************/
+/* */
+/* General */
+/* */
+/************************************************************************************/
+
+#define LVDBE_SCALESHIFT 10 /* As a power of 2 */
+
+
+/************************************************************************************/
+/* */
+/* High Pass Filter coefficients */
+/* */
+/************************************************************************************/
+
+ /* Coefficients for centre frequency 55Hz */
+#define HPF_Fs8000_Fc55_A0 0.958849f
+#define HPF_Fs8000_Fc55_A1 -1.917698f
+#define HPF_Fs8000_Fc55_A2 0.958849f
+#define HPF_Fs8000_Fc55_B1 -1.939001f
+#define HPF_Fs8000_Fc55_B2 0.940807f
+#define HPF_Fs11025_Fc55_A0 0.966909f
+#define HPF_Fs11025_Fc55_A1 -1.933818f
+#define HPF_Fs11025_Fc55_A2 0.966909f
+#define HPF_Fs11025_Fc55_B1 -1.955732f
+#define HPF_Fs11025_Fc55_B2 0.956690f
+#define HPF_Fs12000_Fc55_A0 0.968650f
+#define HPF_Fs12000_Fc55_A1 -1.937300f
+#define HPF_Fs12000_Fc55_A2 0.968650f
+#define HPF_Fs12000_Fc55_B1 -1.959327f
+#define HPF_Fs12000_Fc55_B2 0.960138f
+#define HPF_Fs16000_Fc55_A0 0.973588f
+#define HPF_Fs16000_Fc55_A1 -1.947176f
+#define HPF_Fs16000_Fc55_A2 0.973588f
+#define HPF_Fs16000_Fc55_B1 -1.969494f
+#define HPF_Fs16000_Fc55_B2 0.969952f
+#define HPF_Fs22050_Fc55_A0 0.977671f
+#define HPF_Fs22050_Fc55_A1 -1.955343f
+#define HPF_Fs22050_Fc55_A2 0.977671f
+#define HPF_Fs22050_Fc55_B1 -1.977863f
+#define HPF_Fs22050_Fc55_B2 0.978105f
+#define HPF_Fs24000_Fc55_A0 0.978551f
+#define HPF_Fs24000_Fc55_A1 -1.957102f
+#define HPF_Fs24000_Fc55_A2 0.978551f
+#define HPF_Fs24000_Fc55_B1 -1.979662f
+#define HPF_Fs24000_Fc55_B2 0.979866f
+#define HPF_Fs32000_Fc55_A0 0.981042f
+#define HPF_Fs32000_Fc55_A1 -1.962084f
+#define HPF_Fs32000_Fc55_A2 0.981042f
+#define HPF_Fs32000_Fc55_B1 -1.984746f
+#define HPF_Fs32000_Fc55_B2 0.984861f
+#define HPF_Fs44100_Fc55_A0 0.983097f
+#define HPF_Fs44100_Fc55_A1 -1.966194f
+#define HPF_Fs44100_Fc55_A2 0.983097f
+#define HPF_Fs44100_Fc55_B1 -1.988931f
+#define HPF_Fs44100_Fc55_B2 0.988992f
+#define HPF_Fs48000_Fc55_A0 0.983539f
+#define HPF_Fs48000_Fc55_A1 -1.967079f
+#define HPF_Fs48000_Fc55_A2 0.983539f
+#define HPF_Fs48000_Fc55_B1 -1.989831f
+#define HPF_Fs48000_Fc55_B2 0.989882f
+
+#ifdef HIGHER_FS
+#define HPF_Fs96000_Fc55_A0 0.986040f
+#define HPF_Fs96000_Fc55_A1 -1.972080f
+#define HPF_Fs96000_Fc55_A2 0.986040f
+#define HPF_Fs96000_Fc55_B1 -1.994915f
+#define HPF_Fs96000_Fc55_B2 0.994928f
+
+#define HPF_Fs192000_Fc55_A0 0.987294f
+#define HPF_Fs192000_Fc55_A1 -1.974588f
+#define HPF_Fs192000_Fc55_A2 0.987294f
+#define HPF_Fs192000_Fc55_B1 -1.997458f
+#define HPF_Fs192000_Fc55_B2 0.997461f
#endif
+
+
+ /* Coefficients for centre frequency 66Hz */
+#define HPF_Fs8000_Fc66_A0 0.953016f
+#define HPF_Fs8000_Fc66_A1 -1.906032f
+#define HPF_Fs8000_Fc66_A2 0.953016f
+#define HPF_Fs8000_Fc66_B1 -1.926810f
+#define HPF_Fs8000_Fc66_B2 0.929396f
+#define HPF_Fs11025_Fc66_A0 0.962638f
+#define HPF_Fs11025_Fc66_A1 -1.925275f
+#define HPF_Fs11025_Fc66_A2 0.962638f
+#define HPF_Fs11025_Fc66_B1 -1.946881f
+#define HPF_Fs11025_Fc66_B2 0.948256f
+#define HPF_Fs12000_Fc66_A0 0.964718f
+#define HPF_Fs12000_Fc66_A1 -1.929435f
+#define HPF_Fs12000_Fc66_A2 0.964718f
+#define HPF_Fs12000_Fc66_B1 -1.951196f
+#define HPF_Fs12000_Fc66_B2 0.952359f
+#define HPF_Fs16000_Fc66_A0 0.970622f
+#define HPF_Fs16000_Fc66_A1 -1.941244f
+#define HPF_Fs16000_Fc66_A2 0.970622f
+#define HPF_Fs16000_Fc66_B1 -1.963394f
+#define HPF_Fs16000_Fc66_B2 0.964052f
+#define HPF_Fs22050_Fc66_A0 0.975509f
+#define HPF_Fs22050_Fc66_A1 -1.951019f
+#define HPF_Fs22050_Fc66_A2 0.975509f
+#define HPF_Fs22050_Fc66_B1 -1.973436f
+#define HPF_Fs22050_Fc66_B2 0.973784f
+#define HPF_Fs24000_Fc66_A0 0.976563f
+#define HPF_Fs24000_Fc66_A1 -1.953125f
+#define HPF_Fs24000_Fc66_A2 0.976563f
+#define HPF_Fs24000_Fc66_B1 -1.975594f
+#define HPF_Fs24000_Fc66_B2 0.975889f
+#define HPF_Fs32000_Fc66_A0 0.979547f
+#define HPF_Fs32000_Fc66_A1 -1.959093f
+#define HPF_Fs32000_Fc66_A2 0.979547f
+#define HPF_Fs32000_Fc66_B1 -1.981695f
+#define HPF_Fs32000_Fc66_B2 0.981861f
+#define HPF_Fs44100_Fc66_A0 0.982010f
+#define HPF_Fs44100_Fc66_A1 -1.964019f
+#define HPF_Fs44100_Fc66_A2 0.982010f
+#define HPF_Fs44100_Fc66_B1 -1.986718f
+#define HPF_Fs44100_Fc66_B2 0.986805f
+#define HPF_Fs48000_Fc66_A0 0.982540f
+#define HPF_Fs48000_Fc66_A1 -1.965079f
+#define HPF_Fs48000_Fc66_A2 0.982540f
+#define HPF_Fs48000_Fc66_B1 -1.987797f
+#define HPF_Fs48000_Fc66_B2 0.987871f
+
+#ifdef HIGHER_FS
+#define HPF_Fs96000_Fc66_A0 0.985539f
+#define HPF_Fs96000_Fc66_A1 -1.971077f
+#define HPF_Fs96000_Fc66_A2 0.985539f
+#define HPF_Fs96000_Fc66_B1 -1.993898f
+#define HPF_Fs96000_Fc66_B2 0.993917f
+
+#define HPF_Fs192000_Fc66_A0 0.987043f
+#define HPF_Fs192000_Fc66_A1 -1.974086f
+#define HPF_Fs192000_Fc66_A2 0.987043f
+#define HPF_Fs192000_Fc66_B1 -1.996949f
+#define HPF_Fs192000_Fc66_B2 0.996954f
+#endif
+
+/* Coefficients for centre frequency 78Hz */
+#define HPF_Fs8000_Fc78_A0 0.946693f
+#define HPF_Fs8000_Fc78_A1 -1.893387f
+#define HPF_Fs8000_Fc78_A2 0.946693f
+#define HPF_Fs8000_Fc78_B1 -1.913517f
+#define HPF_Fs8000_Fc78_B2 0.917105f
+#define HPF_Fs11025_Fc78_A0 0.957999f
+#define HPF_Fs11025_Fc78_A1 -1.915998f
+#define HPF_Fs11025_Fc78_A2 0.957999f
+#define HPF_Fs11025_Fc78_B1 -1.937229f
+#define HPF_Fs11025_Fc78_B2 0.939140f
+#define HPF_Fs12000_Fc78_A0 0.960446f
+#define HPF_Fs12000_Fc78_A1 -1.920892f
+#define HPF_Fs12000_Fc78_A2 0.960446f
+#define HPF_Fs12000_Fc78_B1 -1.942326f
+#define HPF_Fs12000_Fc78_B2 0.943944f
+#define HPF_Fs16000_Fc78_A0 0.967397f
+#define HPF_Fs16000_Fc78_A1 -1.934794f
+#define HPF_Fs16000_Fc78_A2 0.967397f
+#define HPF_Fs16000_Fc78_B1 -1.956740f
+#define HPF_Fs16000_Fc78_B2 0.957656f
+#define HPF_Fs22050_Fc78_A0 0.973156f
+#define HPF_Fs22050_Fc78_A1 -1.946313f
+#define HPF_Fs22050_Fc78_A2 0.973156f
+#define HPF_Fs22050_Fc78_B1 -1.968607f
+#define HPF_Fs22050_Fc78_B2 0.969092f
+#define HPF_Fs24000_Fc78_A0 0.974398f
+#define HPF_Fs24000_Fc78_A1 -1.948797f
+#define HPF_Fs24000_Fc78_A2 0.974398f
+#define HPF_Fs24000_Fc78_B1 -1.971157f
+#define HPF_Fs24000_Fc78_B2 0.971568f
+#define HPF_Fs32000_Fc78_A0 0.977918f
+#define HPF_Fs32000_Fc78_A1 -1.955836f
+#define HPF_Fs32000_Fc78_A2 0.977918f
+#define HPF_Fs32000_Fc78_B1 -1.978367f
+#define HPF_Fs32000_Fc78_B2 0.978599f
+#define HPF_Fs44100_Fc78_A0 0.980824f
+#define HPF_Fs44100_Fc78_A1 -1.961649f
+#define HPF_Fs44100_Fc78_A2 0.980824f
+#define HPF_Fs44100_Fc78_B1 -1.984303f
+#define HPF_Fs44100_Fc78_B2 0.984425f
+#define HPF_Fs48000_Fc78_A0 0.981450f
+#define HPF_Fs48000_Fc78_A1 -1.962900f
+#define HPF_Fs48000_Fc78_A2 0.981450f
+#define HPF_Fs48000_Fc78_B1 -1.985578f
+#define HPF_Fs48000_Fc78_B2 0.985681f
+
+#ifdef HIGHER_FS
+#define HPF_Fs96000_Fc78_A0 0.984992f
+#define HPF_Fs96000_Fc78_A1 -1.969984f
+#define HPF_Fs96000_Fc78_A2 0.984992f
+#define HPF_Fs96000_Fc78_B1 -1.992789f
+#define HPF_Fs96000_Fc78_B2 0.992815f
+
+#define HPF_Fs192000_Fc78_A0 0.986769f
+#define HPF_Fs192000_Fc78_A1 -1.973539f
+#define HPF_Fs192000_Fc78_A2 0.986769f
+#define HPF_Fs192000_Fc78_B1 -1.996394f
+#define HPF_Fs192000_Fc78_B2 0.996401f
+#endif
+
+/* Coefficients for centre frequency 90Hz */
+#define HPF_Fs8000_Fc90_A0 0.940412f
+#define HPF_Fs8000_Fc90_A1 -1.880825f
+#define HPF_Fs8000_Fc90_A2 0.940412f
+#define HPF_Fs8000_Fc90_B1 -1.900231f
+#define HPF_Fs8000_Fc90_B2 0.904977f
+#define HPF_Fs11025_Fc90_A0 0.953383f
+#define HPF_Fs11025_Fc90_A1 -1.906766f
+#define HPF_Fs11025_Fc90_A2 0.953383f
+#define HPF_Fs11025_Fc90_B1 -1.927579f
+#define HPF_Fs11025_Fc90_B2 0.930111f
+#define HPF_Fs12000_Fc90_A0 0.956193f
+#define HPF_Fs12000_Fc90_A1 -1.912387f
+#define HPF_Fs12000_Fc90_A2 0.956193f
+#define HPF_Fs12000_Fc90_B1 -1.933459f
+#define HPF_Fs12000_Fc90_B2 0.935603f
+#define HPF_Fs16000_Fc90_A0 0.964183f
+#define HPF_Fs16000_Fc90_A1 -1.928365f
+#define HPF_Fs16000_Fc90_A2 0.964183f
+#define HPF_Fs16000_Fc90_B1 -1.950087f
+#define HPF_Fs16000_Fc90_B2 0.951303f
+#define HPF_Fs22050_Fc90_A0 0.970809f
+#define HPF_Fs22050_Fc90_A1 -1.941618f
+#define HPF_Fs22050_Fc90_A2 0.970809f
+#define HPF_Fs22050_Fc90_B1 -1.963778f
+#define HPF_Fs22050_Fc90_B2 0.964423f
+#define HPF_Fs24000_Fc90_A0 0.972239f
+#define HPF_Fs24000_Fc90_A1 -1.944477f
+#define HPF_Fs24000_Fc90_A2 0.972239f
+#define HPF_Fs24000_Fc90_B1 -1.966721f
+#define HPF_Fs24000_Fc90_B2 0.967266f
+#define HPF_Fs32000_Fc90_A0 0.976292f
+#define HPF_Fs32000_Fc90_A1 -1.952584f
+#define HPF_Fs32000_Fc90_A2 0.976292f
+#define HPF_Fs32000_Fc90_B1 -1.975040f
+#define HPF_Fs32000_Fc90_B2 0.975347f
+#define HPF_Fs44100_Fc90_A0 0.979641f
+#define HPF_Fs44100_Fc90_A1 -1.959282f
+#define HPF_Fs44100_Fc90_A2 0.979641f
+#define HPF_Fs44100_Fc90_B1 -1.981888f
+#define HPF_Fs44100_Fc90_B2 0.982050f
+#define HPF_Fs48000_Fc90_A0 0.980362f
+#define HPF_Fs48000_Fc90_A1 -1.960724f
+#define HPF_Fs48000_Fc90_A2 0.980362f
+#define HPF_Fs48000_Fc90_B1 -1.983359f
+#define HPF_Fs48000_Fc90_B2 0.983497f
+
+#ifdef HIGHER_FS
+#define HPF_Fs96000_Fc90_A0 0.984446f
+#define HPF_Fs96000_Fc90_A1 -1.968892f
+#define HPF_Fs96000_Fc90_A2 0.984446f
+#define HPF_Fs96000_Fc90_B1 -1.991680f
+#define HPF_Fs96000_Fc90_B2 0.991714f
+
+#define HPF_Fs192000_Fc90_A0 0.986496f
+#define HPF_Fs192000_Fc90_A1 -1.972992f
+#define HPF_Fs192000_Fc90_A2 0.986496f
+#define HPF_Fs192000_Fc90_B1 -1.995840f
+#define HPF_Fs192000_Fc90_B2 0.995848f
+#endif
+
+/************************************************************************************/
+/* */
+/* Band Pass Filter coefficients */
+/* */
+/************************************************************************************/
+
+/* Coefficients for centre frequency 55Hz */
+#define BPF_Fs8000_Fc55_A0 0.009197f
+#define BPF_Fs8000_Fc55_A1 0.000000f
+#define BPF_Fs8000_Fc55_A2 -0.009197f
+#define BPF_Fs8000_Fc55_B1 -1.979545f
+#define BPF_Fs8000_Fc55_B2 0.981393f
+#define BPF_Fs11025_Fc55_A0 0.006691f
+#define BPF_Fs11025_Fc55_A1 0.000000f
+#define BPF_Fs11025_Fc55_A2 -0.006691f
+#define BPF_Fs11025_Fc55_B1 -1.985488f
+#define BPF_Fs11025_Fc55_B2 0.986464f
+#define BPF_Fs12000_Fc55_A0 0.006150f
+#define BPF_Fs12000_Fc55_A1 0.000000f
+#define BPF_Fs12000_Fc55_A2 -0.006150f
+#define BPF_Fs12000_Fc55_B1 -1.986733f
+#define BPF_Fs12000_Fc55_B2 0.987557f
+#define BPF_Fs16000_Fc55_A0 0.004620f
+#define BPF_Fs16000_Fc55_A1 0.000000f
+#define BPF_Fs16000_Fc55_A2 -0.004620f
+#define BPF_Fs16000_Fc55_B1 -1.990189f
+#define BPF_Fs16000_Fc55_B2 0.990653f
+#define BPF_Fs22050_Fc55_A0 0.003357f
+#define BPF_Fs22050_Fc55_A1 0.000000f
+#define BPF_Fs22050_Fc55_A2 -0.003357f
+#define BPF_Fs22050_Fc55_B1 -1.992964f
+#define BPF_Fs22050_Fc55_B2 0.993209f
+#define BPF_Fs24000_Fc55_A0 0.003085f
+#define BPF_Fs24000_Fc55_A1 0.000000f
+#define BPF_Fs24000_Fc55_A2 -0.003085f
+#define BPF_Fs24000_Fc55_B1 -1.993552f
+#define BPF_Fs24000_Fc55_B2 0.993759f
+#define BPF_Fs32000_Fc55_A0 0.002315f
+#define BPF_Fs32000_Fc55_A1 0.000000f
+#define BPF_Fs32000_Fc55_A2 -0.002315f
+#define BPF_Fs32000_Fc55_B1 -1.995199f
+#define BPF_Fs32000_Fc55_B2 0.995316f
+#define BPF_Fs44100_Fc55_A0 0.001681f
+#define BPF_Fs44100_Fc55_A1 0.000000f
+#define BPF_Fs44100_Fc55_A2 -0.001681f
+#define BPF_Fs44100_Fc55_B1 -1.996537f
+#define BPF_Fs44100_Fc55_B2 0.996599f
+#define BPF_Fs48000_Fc55_A0 0.001545f
+#define BPF_Fs48000_Fc55_A1 0.000000f
+#define BPF_Fs48000_Fc55_A2 -0.001545f
+#define BPF_Fs48000_Fc55_B1 -1.996823f
+#define BPF_Fs48000_Fc55_B2 0.996875f
+
+#ifdef HIGHER_FS
+#define BPF_Fs96000_Fc55_A0 0.000762f
+#define BPF_Fs96000_Fc55_A1 0.000000f
+#define BPF_Fs96000_Fc55_A2 -0.000762f
+#define BPF_Fs96000_Fc55_B1 -1.998461f
+#define BPF_Fs96000_Fc55_B2 0.998477f
+
+#define BPF_Fs192000_Fc55_A0 0.000381f
+#define BPF_Fs192000_Fc55_A1 0.000000f
+#define BPF_Fs192000_Fc55_A2 -0.000381f
+#define BPF_Fs192000_Fc55_B1 -1.999234f
+#define BPF_Fs192000_Fc55_B2 0.999238f
+#endif
+
+/* Coefficients for centre frequency 66Hz */
+#define BPF_Fs8000_Fc66_A0 0.012648f
+#define BPF_Fs8000_Fc66_A1 0.000000f
+#define BPF_Fs8000_Fc66_A2 -0.012648f
+#define BPF_Fs8000_Fc66_B1 -1.971760f
+#define BPF_Fs8000_Fc66_B2 0.974412f
+#define BPF_Fs11025_Fc66_A0 0.009209f
+#define BPF_Fs11025_Fc66_A1 0.000000f
+#define BPF_Fs11025_Fc66_A2 -0.009209f
+#define BPF_Fs11025_Fc66_B1 -1.979966f
+#define BPF_Fs11025_Fc66_B2 0.981368f
+#define BPF_Fs12000_Fc66_A0 0.008468f
+#define BPF_Fs12000_Fc66_A1 0.000000f
+#define BPF_Fs12000_Fc66_A2 -0.008468f
+#define BPF_Fs12000_Fc66_B1 -1.981685f
+#define BPF_Fs12000_Fc66_B2 0.982869f
+#define BPF_Fs16000_Fc66_A0 0.006364f
+#define BPF_Fs16000_Fc66_A1 0.000000f
+#define BPF_Fs16000_Fc66_A2 -0.006364f
+#define BPF_Fs16000_Fc66_B1 -1.986457f
+#define BPF_Fs16000_Fc66_B2 0.987124f
+#define BPF_Fs22050_Fc66_A0 0.004626f
+#define BPF_Fs22050_Fc66_A1 0.000000f
+#define BPF_Fs22050_Fc66_A2 -0.004626f
+#define BPF_Fs22050_Fc66_B1 -1.990288f
+#define BPF_Fs22050_Fc66_B2 0.990641f
+#define BPF_Fs24000_Fc66_A0 0.004252f
+#define BPF_Fs24000_Fc66_A1 0.000000f
+#define BPF_Fs24000_Fc66_A2 -0.004252f
+#define BPF_Fs24000_Fc66_B1 -1.991100f
+#define BPF_Fs24000_Fc66_B2 0.991398f
+#define BPF_Fs32000_Fc66_A0 0.003192f
+#define BPF_Fs32000_Fc66_A1 0.000000f
+#define BPF_Fs32000_Fc66_A2 -0.003192f
+#define BPF_Fs32000_Fc66_B1 -1.993374f
+#define BPF_Fs32000_Fc66_B2 0.993541f
+#define BPF_Fs44100_Fc66_A0 0.002318f
+#define BPF_Fs44100_Fc66_A1 0.000000f
+#define BPF_Fs44100_Fc66_A2 -0.002318f
+#define BPF_Fs44100_Fc66_B1 -1.995221f
+#define BPF_Fs44100_Fc66_B2 0.995309f
+#define BPF_Fs48000_Fc66_A0 0.002131f
+#define BPF_Fs48000_Fc66_A1 0.000000f
+#define BPF_Fs48000_Fc66_A2 -0.002131f
+#define BPF_Fs48000_Fc66_B1 -1.995615f
+#define BPF_Fs48000_Fc66_B2 0.995690f
+
+#ifdef HIGHER_FS
+#define BPF_Fs96000_Fc66_A0 0.001055f
+#define BPF_Fs96000_Fc66_A1 0.000000f
+#define BPF_Fs96000_Fc66_A2 -0.001055f
+#define BPF_Fs96000_Fc66_B1 -1.997868f
+#define BPF_Fs96000_Fc66_B2 0.997891f
+
+#define BPF_Fs192000_Fc66_A0 0.000528f
+#define BPF_Fs192000_Fc66_A1 0.000000f
+#define BPF_Fs192000_Fc66_A2 -0.000528f
+#define BPF_Fs192000_Fc66_B1 -1.998939f
+#define BPF_Fs192000_Fc66_B2 0.998945f
+#endif
+
+/* Coefficients for centre frequency 78Hz */
+#define BPF_Fs8000_Fc78_A0 0.018572f
+#define BPF_Fs8000_Fc78_A1 0.000000f
+#define BPF_Fs8000_Fc78_A2 -0.018572f
+#define BPF_Fs8000_Fc78_B1 -1.958745f
+#define BPF_Fs8000_Fc78_B2 0.962427f
+#define BPF_Fs11025_Fc78_A0 0.013545f
+#define BPF_Fs11025_Fc78_A1 0.000000f
+#define BPF_Fs11025_Fc78_A2 -0.013545f
+#define BPF_Fs11025_Fc78_B1 -1.970647f
+#define BPF_Fs11025_Fc78_B2 0.972596f
+#define BPF_Fs12000_Fc78_A0 0.012458f
+#define BPF_Fs12000_Fc78_A1 0.000000f
+#define BPF_Fs12000_Fc78_A2 -0.012458f
+#define BPF_Fs12000_Fc78_B1 -1.973148f
+#define BPF_Fs12000_Fc78_B2 0.974795f
+#define BPF_Fs16000_Fc78_A0 0.009373f
+#define BPF_Fs16000_Fc78_A1 0.000000f
+#define BPF_Fs16000_Fc78_A2 -0.009373f
+#define BPF_Fs16000_Fc78_B1 -1.980108f
+#define BPF_Fs16000_Fc78_B2 0.981037f
+#define BPF_Fs22050_Fc78_A0 0.006819f
+#define BPF_Fs22050_Fc78_A1 0.000000f
+#define BPF_Fs22050_Fc78_A2 -0.006819f
+#define BPF_Fs22050_Fc78_B1 -1.985714f
+#define BPF_Fs22050_Fc78_B2 0.986204f
+#define BPF_Fs24000_Fc78_A0 0.006268f
+#define BPF_Fs24000_Fc78_A1 0.000000f
+#define BPF_Fs24000_Fc78_A2 -0.006268f
+#define BPF_Fs24000_Fc78_B1 -1.986904f
+#define BPF_Fs24000_Fc78_B2 0.987318f
+#define BPF_Fs32000_Fc78_A0 0.004709f
+#define BPF_Fs32000_Fc78_A1 0.000000f
+#define BPF_Fs32000_Fc78_A2 -0.004709f
+#define BPF_Fs32000_Fc78_B1 -1.990240f
+#define BPF_Fs32000_Fc78_B2 0.990473f
+#define BPF_Fs44100_Fc78_A0 0.003421f
+#define BPF_Fs44100_Fc78_A1 0.000000f
+#define BPF_Fs44100_Fc78_A2 -0.003421f
+#define BPF_Fs44100_Fc78_B1 -1.992955f
+#define BPF_Fs44100_Fc78_B2 0.993078f
+#define BPF_Fs48000_Fc78_A0 0.003144f
+#define BPF_Fs48000_Fc78_A1 0.000000f
+#define BPF_Fs48000_Fc78_A2 -0.003144f
+#define BPF_Fs48000_Fc78_B1 -1.993535f
+#define BPF_Fs48000_Fc78_B2 0.993639f
+
+#ifdef HIGHER_FS
+#define BPF_Fs96000_Fc78_A0 0.001555f
+#define BPF_Fs96000_Fc78_A1 0.000000f
+#define BPF_Fs96000_Fc78_A2 -0.0015555f
+#define BPF_Fs96000_Fc78_B1 -1.996860f
+#define BPF_Fs96000_Fc78_B2 0.996891f
+
+#define BPF_Fs192000_Fc78_A0 0.000778f
+#define BPF_Fs192000_Fc78_A1 0.000000f
+#define BPF_Fs192000_Fc78_A2 -0.000778f
+#define BPF_Fs192000_Fc78_B1 -1.998437f
+#define BPF_Fs192000_Fc78_B2 0.998444f
+#endif
+
+/* Coefficients for centre frequency 90Hz */
+#define BPF_Fs8000_Fc90_A0 0.022760f
+#define BPF_Fs8000_Fc90_A1 0.000000f
+#define BPF_Fs8000_Fc90_A2 -0.022760f
+#define BPF_Fs8000_Fc90_B1 -1.949073f
+#define BPF_Fs8000_Fc90_B2 0.953953f
+#define BPF_Fs11025_Fc90_A0 0.016619f
+#define BPF_Fs11025_Fc90_A1 0.000000f
+#define BPF_Fs11025_Fc90_A2 -0.016619f
+#define BPF_Fs11025_Fc90_B1 -1.963791f
+#define BPF_Fs11025_Fc90_B2 0.966377f
+#define BPF_Fs12000_Fc90_A0 0.015289f
+#define BPF_Fs12000_Fc90_A1 0.000000f
+#define BPF_Fs12000_Fc90_A2 -0.015289f
+#define BPF_Fs12000_Fc90_B1 -1.966882f
+#define BPF_Fs12000_Fc90_B2 0.969067f
+#define BPF_Fs16000_Fc90_A0 0.011511f
+#define BPF_Fs16000_Fc90_A1 0.000000f
+#define BPF_Fs16000_Fc90_A2 -0.011511f
+#define BPF_Fs16000_Fc90_B1 -1.975477f
+#define BPF_Fs16000_Fc90_B2 0.976711f
+#define BPF_Fs22050_Fc90_A0 0.008379f
+#define BPF_Fs22050_Fc90_A1 0.000000f
+#define BPF_Fs22050_Fc90_A2 -0.008379f
+#define BPF_Fs22050_Fc90_B1 -1.982395f
+#define BPF_Fs22050_Fc90_B2 0.983047f
+#define BPF_Fs24000_Fc90_A0 0.007704f
+#define BPF_Fs24000_Fc90_A1 0.000000f
+#define BPF_Fs24000_Fc90_A2 -0.007704f
+#define BPF_Fs24000_Fc90_B1 -1.983863f
+#define BPF_Fs24000_Fc90_B2 0.984414f
+#define BPF_Fs32000_Fc90_A0 0.005789f
+#define BPF_Fs32000_Fc90_A1 0.000000f
+#define BPF_Fs32000_Fc90_A2 -0.005789f
+#define BPF_Fs32000_Fc90_B1 -1.987977f
+#define BPF_Fs32000_Fc90_B2 0.988288f
+#define BPF_Fs44100_Fc90_A0 0.004207f
+#define BPF_Fs44100_Fc90_A1 0.000000f
+#define BPF_Fs44100_Fc90_A2 -0.004207f
+#define BPF_Fs44100_Fc90_B1 -1.991324f
+#define BPF_Fs44100_Fc90_B2 0.991488f
+#define BPF_Fs48000_Fc90_A0 0.003867f
+#define BPF_Fs48000_Fc90_A1 0.000000f
+#define BPF_Fs48000_Fc90_A2 -0.003867f
+#define BPF_Fs48000_Fc90_B1 -1.992038f
+#define BPF_Fs48000_Fc90_B2 0.992177f
+
+#ifdef HIGHER_FS
+#define BPF_Fs96000_Fc90_A0 0.001913f
+#define BPF_Fs96000_Fc90_A1 0.000000f
+#define BPF_Fs96000_Fc90_A2 -0.001913f
+#define BPF_Fs96000_Fc90_B1 -1.996134f
+#define BPF_Fs96000_Fc90_B2 0.996174f
+
+#define BPF_Fs192000_Fc90_A0 0.000958f
+#define BPF_Fs192000_Fc90_A1 0.000000f
+#define BPF_Fs192000_Fc90_A2 -0.000958f
+#define BPF_Fs192000_Fc90_B1 -1.998075f
+#define BPF_Fs192000_Fc90_B2 0.998085f
+#endif
+
+/************************************************************************************/
+/* */
+/* Automatic Gain Control time constants and gain settings */
+/* */
+/************************************************************************************/
+
+/* AGC Time constants */
+#define AGC_ATTACK_Fs8000 0.841395f
+#define AGC_ATTACK_Fs11025 0.882223f
+#define AGC_ATTACK_Fs12000 0.891251f
+#define AGC_ATTACK_Fs16000 0.917276f
+#define AGC_ATTACK_Fs22050 0.939267f
+#define AGC_ATTACK_Fs24000 0.944061f
+#define AGC_ATTACK_Fs32000 0.957745f
+#define AGC_ATTACK_Fs44100 0.969158f
+#define AGC_ATTACK_Fs48000 0.971628f
+
+#ifdef HIGHER_FS
+#define AGC_ATTACK_Fs96000 0.985712f
+#define AGC_ATTACK_Fs192000 0.992830f
+#endif
+
+#define DECAY_SHIFT 10
+
+#define AGC_DECAY_Fs8000 0.000042f
+#define AGC_DECAY_Fs11025 0.000030f
+#define AGC_DECAY_Fs12000 0.000028f
+#define AGC_DECAY_Fs16000 0.000021f
+#define AGC_DECAY_Fs22050 0.000015f
+#define AGC_DECAY_Fs24000 0.000014f
+#define AGC_DECAY_Fs32000 0.000010f
+#define AGC_DECAY_Fs44100 0.000008f
+#define AGC_DECAY_Fs48000 0.000007f
+
+#ifdef HIGHER_FS
+#define AGC_DECAY_FS96000 0.0000035f
+#define AGC_DECAY_FS192000 0.00000175f
+#endif
+
+/* AGC Gain settings */
+#define AGC_GAIN_SCALE 31 /* As a power of 2 */
+#define AGC_GAIN_SHIFT 4 /* As a power of 2 */
+#define AGC_TARGETLEVEL 0.988553f
+#define AGC_HPFGAIN_0dB 0.412538f
+#define AGC_GAIN_0dB 0.000000f
+#define AGC_HPFGAIN_1dB 0.584893f
+#define AGC_GAIN_1dB 0.122018f
+#define AGC_HPFGAIN_2dB 0.778279f
+#define AGC_GAIN_2dB 0.258925f
+#define AGC_HPFGAIN_3dB 0.995262f
+#define AGC_GAIN_3dB 0.412538f
+#define AGC_HPFGAIN_4dB 1.238721f
+#define AGC_GAIN_4dB 0.584893f
+#define AGC_HPFGAIN_5dB 1.511886f
+#define AGC_GAIN_5dB 0.778279f
+#define AGC_HPFGAIN_6dB 1.818383f
+#define AGC_GAIN_6dB 0.995262f
+#define AGC_HPFGAIN_7dB 2.162278f
+#define AGC_GAIN_7dB 1.238721f
+#define AGC_HPFGAIN_8dB 2.548134f
+#define AGC_GAIN_8dB 1.511886f
+#define AGC_HPFGAIN_9dB 2.981072f
+#define AGC_GAIN_9dB 1.818383f
+#define AGC_HPFGAIN_10dB 3.466836f
+#define AGC_GAIN_10dB 2.162278f
+#define AGC_HPFGAIN_11dB 4.011872f
+#define AGC_GAIN_11dB 2.548134f
+#define AGC_HPFGAIN_12dB 4.623413f
+#define AGC_GAIN_12dB 2.981072f
+#define AGC_HPFGAIN_13dB 5.309573f
+#define AGC_GAIN_13dB 3.466836f
+#define AGC_HPFGAIN_14dB 6.079458f
+#define AGC_GAIN_14dB 4.011872f
+#define AGC_HPFGAIN_15dB 6.943282f
+#define AGC_GAIN_15dB 4.623413f
+
+/************************************************************************************/
+/* */
+/* Volume control */
+/* */
+/************************************************************************************/
+
+/* Volume control gain */
+#define VOLUME_MAX 0 /* In dBs */
+#define VOLUME_SHIFT 0 /* In dBs */
+
+/* Volume control time constants */
+#define VOL_TC_SHIFT 21 /* As a power of 2 */
+#define VOL_TC_Fs8000 0.024690f
+#define VOL_TC_Fs11025 0.017977f
+#define VOL_TC_Fs12000 0.016529f
+#define VOL_TC_Fs16000 0.012422f
+#define VOL_TC_Fs22050 0.009029f
+#define VOL_TC_Fs24000 0.008299f
+#define VOL_TC_Fs32000 0.006231f
+#define VOL_TC_Fs44100 0.004525f
+#define VOL_TC_Fs48000 0.004158f
+#ifdef HIGHER_FS
+#define VOL_TC_Fs96000 0.002079f
+#define VOL_TC_Fs192000 0.001039f
+#endif
+#define MIX_TC_Fs8000 29365 /* Floating point value 0.896151 */
+#define MIX_TC_Fs11025 30230 /* Floating point value 0.922548 */
+#define MIX_TC_Fs12000 30422 /* Floating point value 0.928415 */
+#define MIX_TC_Fs16000 30978 /* Floating point value 0.945387 */
+#define MIX_TC_Fs22050 31451 /* Floating point value 0.959804 */
+#define MIX_TC_Fs24000 31554 /* Floating point value 0.962956 */
+#define MIX_TC_Fs32000 31850 /* Floating point value 0.971973 */
+#define MIX_TC_Fs44100 32097 /* Floating point value 0.979515 */
+#define MIX_TC_Fs48000 32150 /* Floating point value 0.981150 */
+#ifdef HIGHER_FS
+#define MIX_TC_Fs96000 32456 /* Floating point value 0.990530 */
+#define MIX_TC_Fs192000 32611 /* Floating point value 0.992524 */
+#endif
+
+#endif /*BUILD_FLOAT*/
+#endif
\ No newline at end of file
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c b/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c
index b6632a3..fd4016b 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c
@@ -107,35 +107,68 @@
LVDBE_Params_t *pParams)
{
+#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
/*
* Calculate the table offsets
*/
- LVM_UINT16 Offset = (LVM_UINT16)((LVM_UINT16)pParams->SampleRate + (LVM_UINT16)(pParams->CentreFrequency * (1+LVDBE_FS_48000)));
-
+ LVM_UINT16 Offset = (LVM_UINT16)((LVM_UINT16)pParams->SampleRate + \
+ (LVM_UINT16)(pParams->CentreFrequency * (1+LVDBE_FS_192000)));
+#else
+ /*
+ * Calculate the table offsets
+ */
+ LVM_UINT16 Offset = (LVM_UINT16)((LVM_UINT16)pParams->SampleRate + \
+ (LVM_UINT16)(pParams->CentreFrequency * (1+LVDBE_FS_48000)));
+#endif
/*
* Setup the high pass filter
*/
- LoadConst_16(0, /* Clear the history, value 0 */
- (void *)&pInstance->pData->HPFTaps, /* Destination Cast to void: \
- no dereferencing in function*/
+#ifndef BUILD_FLOAT
+ LoadConst_16(0, /* Clear the history, value 0 */
+ (void *)&pInstance->pData->HPFTaps, /* Destination Cast to void: \
+ no dereferencing in function*/
sizeof(pInstance->pData->HPFTaps)/sizeof(LVM_INT16)); /* Number of words */
- BQ_2I_D32F32Cll_TRC_WRA_01_Init(&pInstance->pCoef->HPFInstance, /* Initialise the filter */
+#else
+ LoadConst_Float(0, /* Clear the history, value 0 */
+ (void *)&pInstance->pData->HPFTaps, /* Destination Cast to void: \
+ no dereferencing in function*/
+ sizeof(pInstance->pData->HPFTaps) / sizeof(LVM_FLOAT)); /* Number of words */
+#endif
+#ifndef BUILD_FLOAT
+ BQ_2I_D32F32Cll_TRC_WRA_01_Init(&pInstance->pCoef->HPFInstance, /* Initialise the filter */
&pInstance->pData->HPFTaps,
(BQ_C32_Coefs_t *)&LVDBE_HPF_Table[Offset]);
+#else
+ BQ_2I_D32F32Cll_TRC_WRA_01_Init(&pInstance->pCoef->HPFInstance, /* Initialise the filter */
+ &pInstance->pData->HPFTaps,
+ (BQ_FLOAT_Coefs_t *)&LVDBE_HPF_Table[Offset]);
+#endif
/*
* Setup the band pass filter
*/
+#ifndef BUILD_FLOAT
LoadConst_16(0, /* Clear the history, value 0 */
- (void *)&pInstance->pData->BPFTaps, /* Destination Cast to void:\
+ (void *)&pInstance->pData->BPFTaps, /* Destination Cast to void: \
no dereferencing in function*/
sizeof(pInstance->pData->BPFTaps)/sizeof(LVM_INT16)); /* Number of words */
+#else
+ LoadConst_Float(0, /* Clear the history, value 0 */
+ (void *)&pInstance->pData->BPFTaps, /* Destination Cast to void: \
+ no dereferencing in function*/
+ sizeof(pInstance->pData->BPFTaps) / sizeof(LVM_FLOAT)); /* Number of words */
+#endif
+#ifndef BUILD_FLOAT
BP_1I_D32F32Cll_TRC_WRA_02_Init(&pInstance->pCoef->BPFInstance, /* Initialise the filter */
&pInstance->pData->BPFTaps,
(BP_C32_Coefs_t *)&LVDBE_BPF_Table[Offset]);
-
+#else
+ BP_1I_D32F32Cll_TRC_WRA_02_Init(&pInstance->pCoef->BPFInstance, /* Initialise the filter */
+ &pInstance->pData->BPFTaps,
+ (BP_FLOAT_Coefs_t *)&LVDBE_BPF_Table[Offset]);
+#endif
}
@@ -175,7 +208,9 @@
{
pInstance->pData->AGCInstance.AGC_MaxGain = LVDBE_AGC_GAIN_Table[(LVM_UINT16)pParams->EffectLevel]; /* High pass filter off */
}
+#ifndef BUILD_FLOAT
pInstance->pData->AGCInstance.AGC_GainShift = AGC_GAIN_SHIFT;
+#endif
pInstance->pData->AGCInstance.AGC_Target = AGC_TARGETLEVEL;
}
@@ -212,6 +247,9 @@
LVM_UINT16 dBOffset; /* Table offset */
LVM_INT16 Volume = 0; /* Required volume in dBs */
+#ifdef BUILD_FLOAT
+ LVM_FLOAT dBShifts_fac;
+#endif
/*
* Apply the volume if enabled
*/
@@ -237,33 +275,58 @@
dBOffset = (LVM_UINT16)(6 + Volume % 6); /* Get the dBs 0-5 */
dBShifts = (LVM_UINT16)(Volume / -6); /* Get the 6dB shifts */
-
+#ifdef BUILD_FLOAT
+ dBShifts_fac = (LVM_FLOAT)(1 << dBShifts);
+#endif
/*
* When DBE is enabled use AGC volume
*/
+#ifndef BUILD_FLOAT
pInstance->pData->AGCInstance.Target = ((LVM_INT32)LVDBE_VolumeTable[dBOffset] << 16);
pInstance->pData->AGCInstance.Target = pInstance->pData->AGCInstance.Target >> dBShifts;
-
+#else
+ pInstance->pData->AGCInstance.Target = (LVDBE_VolumeTable[dBOffset]);
+ pInstance->pData->AGCInstance.Target = pInstance->pData->AGCInstance.Target / dBShifts_fac;
+#endif
pInstance->pData->AGCInstance.VolumeTC = LVDBE_VolumeTCTable[(LVM_UINT16)pParams->SampleRate]; /* Volume update time constant */
+#ifndef BUILD_FLOAT
pInstance->pData->AGCInstance.VolumeShift = VOLUME_SHIFT+1;
+#endif
/*
* When DBE is disabled use the bypass volume control
*/
if(dBShifts > 0)
{
+#ifndef BUILD_FLOAT
LVC_Mixer_SetTarget(&pInstance->pData->BypassVolume.MixerStream[0],(((LVM_INT32)LVDBE_VolumeTable[dBOffset]) >> dBShifts));
+#else
+ LVC_Mixer_SetTarget(&pInstance->pData->BypassVolume.MixerStream[0],
+ LVDBE_VolumeTable[dBOffset] / dBShifts_fac);
+#endif
}
else
{
+#ifndef BUILD_FLOAT
LVC_Mixer_SetTarget(&pInstance->pData->BypassVolume.MixerStream[0],(LVM_INT32)LVDBE_VolumeTable[dBOffset]);
+#else
+ LVC_Mixer_SetTarget(&pInstance->pData->BypassVolume.MixerStream[0],
+ LVDBE_VolumeTable[dBOffset]);
+#endif
}
pInstance->pData->BypassVolume.MixerStream[0].CallbackSet = 1;
+#ifndef BUILD_FLOAT
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->pData->BypassVolume.MixerStream[0],
LVDBE_MIXER_TC,
(LVM_Fs_en)pInstance->Params.SampleRate,
2);
+#else
+ LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->pData->BypassVolume.MixerStream[0],
+ LVDBE_MIXER_TC,
+ (LVM_Fs_en)pInstance->Params.SampleRate,
+ 2);
+#endif
}
@@ -309,7 +372,11 @@
{
LVDBE_Instance_t *pInstance =(LVDBE_Instance_t *)hInstance;
+#ifndef BUILD_FLOAT
LVMixer3_2St_st *pBypassMixer_Instance = &pInstance->pData->BypassMixer;
+#else
+ LVMixer3_2St_FLOAT_st *pBypassMixer_Instance = &pInstance->pData->BypassMixer;
+#endif
/*
@@ -332,12 +399,19 @@
{
LVDBE_SetAGC(pInstance, /* Instance pointer */
pParams); /* New parameters */
-
+#ifndef BUILD_FLOAT
LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[0],
LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate,2);
LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[1],
LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate,2);
+#else
+ LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[0],
+ LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate, 2);
+
+ LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[1],
+ LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate, 2);
+#endif
}
@@ -357,13 +431,23 @@
if (pInstance->Params.OperatingMode==LVDBE_ON && pParams->OperatingMode==LVDBE_OFF)
{
+#ifndef BUILD_FLOAT
LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[0],0);
LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[1],0x00007FFF);
+#else
+ LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[0], 0);
+ LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[1], 1.0f);
+#endif
}
if (pInstance->Params.OperatingMode==LVDBE_OFF && pParams->OperatingMode==LVDBE_ON)
{
+#ifndef BUILD_FLOAT
LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[0],0x00007FFF);
LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[1],0);
+#else
+ LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[0], 1.0f);
+ LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[1], 0);
+#endif
}
/*
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c b/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c
index a3623bc..3fff2a2 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c
@@ -80,7 +80,11 @@
/*
* Data memory
*/
+#ifdef BUILD_FLOAT
+ pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Size = sizeof(LVDBE_Data_FLOAT_t);
+#else
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Size = sizeof(LVDBE_Data_t);
+#endif
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Alignment = LVDBE_PERSISTENT_DATA_ALIGN;
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Type = LVDBE_PERSISTENT_DATA;
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].pBaseAddress = LVM_NULL;
@@ -88,7 +92,11 @@
/*
* Coef memory
*/
- pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Size = sizeof(LVDBE_Coef_t);
+#ifdef BUILD_FLOAT
+ pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Size = sizeof(LVDBE_Coef_FLOAT_t);
+#else
+ pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Size = sizeof(LVDBE_Coef_t);
+#endif
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Alignment = LVDBE_PERSISTENT_COEF_ALIGN;
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Type = LVDBE_PERSISTENT_COEF;
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].pBaseAddress = LVM_NULL;
@@ -96,7 +104,12 @@
/*
* Scratch memory
*/
+#ifdef BUILD_FLOAT
+ ScratchSize = (LVM_UINT32)(LVDBE_SCRATCHBUFFERS_INPLACE*sizeof(LVM_FLOAT) * \
+ pCapabilities->MaxBlockSize);
+#else /*BUILD_FLOAT*/
ScratchSize = (LVM_UINT32)(LVDBE_SCRATCHBUFFERS_INPLACE*sizeof(LVM_INT16)*pCapabilities->MaxBlockSize);
+#endif
pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].Size = ScratchSize;
pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].Alignment = LVDBE_SCRATCH_ALIGN;
pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].Type = LVDBE_SCRATCH;
@@ -151,10 +164,16 @@
{
LVDBE_Instance_t *pInstance;
+#ifdef BUILD_FLOAT
+ LVMixer3_1St_FLOAT_st *pMixer_Instance;
+ LVMixer3_2St_FLOAT_st *pBypassMixer_Instance;
+ LVM_FLOAT MixGain;
+#else
LVMixer3_1St_st *pMixer_Instance;
LVMixer3_2St_st *pBypassMixer_Instance;
- LVM_INT16 i;
LVM_INT32 MixGain;
+#endif
+ LVM_INT16 i;
/*
@@ -235,7 +254,11 @@
// initialize the mixer with some fixes values since otherwise LVDBE_SetVolume ends up
// reading uninitialized data
pMixer_Instance = &pInstance->pData->BypassVolume;
+#ifndef BUILD_FLOAT
LVC_Mixer_Init(&pMixer_Instance->MixerStream[0],0x00007FFF,0x00007FFF);
+#else
+ LVC_Mixer_Init(&pMixer_Instance->MixerStream[0], 1.0, 1.0);
+#endif
/*
* Initialise the volume
@@ -245,9 +268,13 @@
pInstance->pData->AGCInstance.Volume = pInstance->pData->AGCInstance.Target;
/* Initialise as the target */
-
+#ifndef BUILD_FLOAT
MixGain = LVC_Mixer_GetTarget(&pMixer_Instance->MixerStream[0]);
LVC_Mixer_Init(&pMixer_Instance->MixerStream[0],MixGain,MixGain);
+#else
+ MixGain = LVC_Mixer_GetTarget(&pMixer_Instance->MixerStream[0]);
+ LVC_Mixer_Init(&pMixer_Instance->MixerStream[0], MixGain, MixGain);
+#endif
/* Configure the mixer process path */
pMixer_Instance->MixerStream[0].CallbackParam = 0;
@@ -268,9 +295,11 @@
pBypassMixer_Instance->MixerStream[0].pCallbackHandle = LVM_NULL;
pBypassMixer_Instance->MixerStream[0].pCallBack = LVM_NULL;
pBypassMixer_Instance->MixerStream[0].CallbackSet=0;
+
LVC_Mixer_Init(&pBypassMixer_Instance->MixerStream[0],0,0);
LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[0],
LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pInstance->Params.SampleRate,2);
+
/*
* Setup the mixer gain for the unprocessed path
*/
@@ -278,9 +307,15 @@
pBypassMixer_Instance->MixerStream[1].pCallbackHandle = LVM_NULL;
pBypassMixer_Instance->MixerStream[1].pCallBack = LVM_NULL;
pBypassMixer_Instance->MixerStream[1].CallbackSet=0;
+#ifndef BUILD_FLOAT
LVC_Mixer_Init(&pBypassMixer_Instance->MixerStream[1],0x00007FFF,0x00007FFF);
LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[1],
LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pInstance->Params.SampleRate,2);
+#else
+ LVC_Mixer_Init(&pBypassMixer_Instance->MixerStream[1], 1.0, 1.0);
+ LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[1],
+ LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pInstance->Params.SampleRate, 2);
+#endif
return(LVDBE_SUCCESS);
}
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h b/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h
index 8339d3c..4e5207f 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h
@@ -77,6 +77,7 @@
/****************************************************************************************/
/* Data structure */
+#ifndef BUILD_FLOAT
typedef struct
{
/* AGC parameters */
@@ -98,7 +99,29 @@
Biquad_Instance_t BPFInstance; /* Band pass filter instance */
} LVDBE_Coef_t;
+#else
+/* Data structure */
+typedef struct
+{
+ /* AGC parameters */
+ AGC_MIX_VOL_2St1Mon_FLOAT_t AGCInstance; /* AGC instance parameters */
+ /* Process variables */
+ Biquad_2I_Order2_FLOAT_Taps_t HPFTaps; /* High pass filter taps */
+ Biquad_1I_Order2_FLOAT_Taps_t BPFTaps; /* Band pass filter taps */
+ LVMixer3_1St_FLOAT_st BypassVolume; /* Bypass volume scaler */
+ LVMixer3_2St_FLOAT_st BypassMixer; /* Bypass Mixer for Click Removal */
+
+} LVDBE_Data_FLOAT_t;
+
+/* Coefs structure */
+typedef struct
+{
+ /* Process variables */
+ Biquad_FLOAT_Instance_t HPFInstance; /* High pass filter instance */
+ Biquad_FLOAT_Instance_t BPFInstance; /* Band pass filter instance */
+} LVDBE_Coef_FLOAT_t;
+#endif
/* Instance structure */
typedef struct
{
@@ -108,8 +131,13 @@
LVDBE_Capabilities_t Capabilities; /* Instance capabilities */
/* Data and coefficient pointers */
+#ifndef BUILD_FLOAT
LVDBE_Data_t *pData; /* Instance data */
LVDBE_Coef_t *pCoef; /* Instance coefficients */
+#else
+ LVDBE_Data_FLOAT_t *pData; /* Instance data */
+ LVDBE_Coef_FLOAT_t *pCoef; /* Instance coefficients */
+#endif
} LVDBE_Instance_t;
@@ -136,5 +164,3 @@
#endif /* __cplusplus */
#endif /* __LVDBE_PRIVATE_H__ */
-
-
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Process.c b/media/libeffects/lvm/lib/Bass/src/LVDBE_Process.c
index 69d79d2..10ea700 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Process.c
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Process.c
@@ -27,7 +27,6 @@
#include "AGC.h"
#include "LVDBE_Coeffs.h" /* Filter coefficients */
-
/********************************************************************************************/
/* */
/* FUNCTION: LVDBE_Process */
@@ -72,136 +71,236 @@
/* overall end to end gain is odB. */
/* */
/********************************************************************************************/
+#ifndef BUILD_FLOAT
+LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
+ const LVM_INT16 *pInData, LVM_INT16 *pOutData, LVM_UINT16 NumSamples) {
-LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples)
+ LVDBE_Instance_t *pInstance = (LVDBE_Instance_t *) hInstance;
+ LVM_INT32 *pScratch =
+ (LVM_INT32 *) pInstance->MemoryTable.Region[LVDBE_MEMREGION_SCRATCH].pBaseAddress;
+ LVM_INT32 *pMono;
+ LVM_INT16 *pInput = (LVM_INT16 *) pInData;
+
+ /* Scratch for Volume Control starts at offset of 2*NumSamples short values from pScratch */
+ LVM_INT16 *pScratchVol = (LVM_INT16 *) (&pScratch[NumSamples]);
+
+ /* Scratch for Mono path starts at offset of 2*NumSamples 32-bit values from pScratch */
+ pMono = &pScratch[2 * NumSamples];
+
+ /*
+ * Check the number of samples is not too large
+ */
+ if (NumSamples > pInstance->Capabilities.MaxBlockSize) {
+ return (LVDBE_TOOMANYSAMPLES);
+ }
+
+ /*
+ * Check if the algorithm is enabled
+ */
+ /* DBE path is processed when DBE is ON or during On/Off transitions */
+ if ((pInstance->Params.OperatingMode == LVDBE_ON)
+ || (LVC_Mixer_GetCurrent(
+ &pInstance->pData->BypassMixer.MixerStream[0])
+ != LVC_Mixer_GetTarget(
+ &pInstance->pData->BypassMixer.MixerStream[0]))) {
+
+ /*
+ * Convert 16-bit samples to 32-bit and scale
+ * (For a 16-bit implementation apply headroom loss here)
+ */
+ Int16LShiftToInt32_16x32(pInput, /* Source 16-bit data */
+ pScratch, /* Dest. 32-bit data */
+ (LVM_INT16) (2 * NumSamples), /* Left and right */
+ LVDBE_SCALESHIFT); /* Shift scale */
+
+ /*
+ * Apply the high pass filter if selected
+ */
+ if (pInstance->Params.HPFSelect == LVDBE_HPF_ON) {
+ BQ_2I_D32F32C30_TRC_WRA_01(&pInstance->pCoef->HPFInstance,/* Filter instance */
+ (LVM_INT32 *) pScratch, /* Source */
+ (LVM_INT32 *) pScratch, /* Destination */
+ (LVM_INT16) NumSamples); /* Number of samples */
+ }
+
+ /*
+ * Create the mono stream
+ */
+ From2iToMono_32(pScratch, /* Stereo source */
+ pMono, /* Mono destination */
+ (LVM_INT16) NumSamples); /* Number of samples */
+
+ /*
+ * Apply the band pass filter
+ */
+ BP_1I_D32F32C30_TRC_WRA_02(&pInstance->pCoef->BPFInstance, /* Filter instance */
+ (LVM_INT32 *) pMono, /* Source */
+ (LVM_INT32 *) pMono, /* Destination */
+ (LVM_INT16) NumSamples); /* Number of samples */
+
+ /*
+ * Apply the AGC and mix
+ */
+ AGC_MIX_VOL_2St1Mon_D32_WRA(&pInstance->pData->AGCInstance, /* Instance pointer */
+ pScratch, /* Stereo source */
+ pMono, /* Mono band pass source */
+ pScratch, /* Stereo destination */
+ NumSamples); /* Number of samples */
+
+ /*
+ * Convert 32-bit samples to 16-bit and saturate
+ * (Not required for 16-bit implemenations)
+ */
+ Int32RShiftToInt16_Sat_32x16(pScratch, /* Source 32-bit data */
+ (LVM_INT16 *) pScratch, /* Dest. 16-bit data */
+ (LVM_INT16) (2 * NumSamples), /* Left and right */
+ LVDBE_SCALESHIFT); /* Shift scale */
+
+ }
+
+ /* Bypass Volume path is processed when DBE is OFF or during On/Off transitions */
+ if ((pInstance->Params.OperatingMode == LVDBE_OFF)
+ || (LVC_Mixer_GetCurrent(
+ &pInstance->pData->BypassMixer.MixerStream[1])
+ != LVC_Mixer_GetTarget(
+ &pInstance->pData->BypassMixer.MixerStream[1]))) {
+
+ /*
+ * The algorithm is disabled but volume management is required to compensate for
+ * headroom and volume (if enabled)
+ */
+ LVC_MixSoft_1St_D16C31_SAT(&pInstance->pData->BypassVolume, pInData,
+ pScratchVol, (LVM_INT16) (2 * NumSamples)); /* Left and right */
+
+ }
+
+ /*
+ * Mix DBE processed path and bypass volume path
+ */
+ LVC_MixSoft_2St_D16C31_SAT(&pInstance->pData->BypassMixer,
+ (LVM_INT16 *) pScratch, pScratchVol, pOutData,
+ (LVM_INT16) (2 * NumSamples));
+
+ return (LVDBE_SUCCESS);
+}
+#else /*BUILD_FLOAT*/
+LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 NumSamples)
{
- LVDBE_Instance_t *pInstance =(LVDBE_Instance_t *)hInstance;
- LVM_INT32 *pScratch = (LVM_INT32 *)pInstance->MemoryTable.Region[LVDBE_MEMREGION_SCRATCH].pBaseAddress;
- LVM_INT32 *pMono;
- LVM_INT16 *pInput = (LVM_INT16 *)pInData;
+ LVDBE_Instance_t *pInstance =(LVDBE_Instance_t *)hInstance;
+ LVM_FLOAT *pScratch_in = (LVM_FLOAT *)pInstance->MemoryTable.Region
+ [LVDBE_MEMREGION_SCRATCH].pBaseAddress;
+ LVM_FLOAT *pScratch = pScratch_in + 2 * NumSamples;
+ LVM_FLOAT *pMono;
+ LVM_INT32 ii = 0;
+ /* Scratch for Volume Control starts at offset of 4*NumSamples float values from pScratch */
+ LVM_FLOAT *pScratchVol = (LVM_FLOAT *)(&pScratch_in[4 * NumSamples]);
+// LVM_INT16 *pScratchVol_int = (LVM_INT16 *)(pScratchVol);
- /* Scratch for Volume Control starts at offset of 2*NumSamples short values from pScratch */
- LVM_INT16 *pScratchVol = (LVM_INT16 *)(&pScratch[NumSamples]);
+ /* Scratch for Mono path starts at offset of 6*NumSamples 32-bit values from pScratch */
+ pMono = &pScratch_in[4 * NumSamples];
- /* Scratch for Mono path starts at offset of 2*NumSamples 32-bit values from pScratch */
- pMono = &pScratch[2*NumSamples];
+ /*
+ * Check the number of samples is not too large
+ */
+ if (NumSamples > pInstance->Capabilities.MaxBlockSize)
+ {
+ return(LVDBE_TOOMANYSAMPLES);
+ }
+
+ /*
+ * Convert 16-bit samples to Float
+ */
+ Copy_Float(pInData, /* Source 16-bit data */
+ pScratch_in, /* Dest. 32-bit data */
+ (LVM_INT16)(2 * NumSamples)); /* Left and right */
+
+ for (ii = 0; ii < 2 * NumSamples; ii++) {
+ pScratch[ii] = pScratch_in[ii];
+ }
+ /*
+ * Check if the algorithm is enabled
+ */
+ /* DBE path is processed when DBE is ON or during On/Off transitions */
+ if ((pInstance->Params.OperatingMode == LVDBE_ON)||
+ (LVC_Mixer_GetCurrent(&pInstance->pData->BypassMixer.MixerStream[0])
+ !=LVC_Mixer_GetTarget(&pInstance->pData->BypassMixer.MixerStream[0])))
+ {
/*
- * Check the number of samples is not too large
+ * Apply the high pass filter if selected
*/
- if (NumSamples > pInstance->Capabilities.MaxBlockSize)
+ if (pInstance->Params.HPFSelect == LVDBE_HPF_ON)
{
- return(LVDBE_TOOMANYSAMPLES);
+ BQ_2I_D32F32C30_TRC_WRA_01(&pInstance->pCoef->HPFInstance,/* Filter instance */
+ (LVM_FLOAT *)pScratch, /* Source */
+ (LVM_FLOAT *)pScratch, /* Destination */
+ (LVM_INT16)NumSamples); /* Number of samples */
}
/*
- * Check if the algorithm is enabled
+ * Create the mono stream
*/
- /* DBE path is processed when DBE is ON or during On/Off transitions */
- if ((pInstance->Params.OperatingMode == LVDBE_ON)||
- (LVC_Mixer_GetCurrent(&pInstance->pData->BypassMixer.MixerStream[0])
- !=LVC_Mixer_GetTarget(&pInstance->pData->BypassMixer.MixerStream[0])))
- {
-
- /*
- * Convert 16-bit samples to 32-bit and scale
- * (For a 16-bit implementation apply headroom loss here)
- */
- Int16LShiftToInt32_16x32(pInput, /* Source 16-bit data */
- pScratch, /* Dest. 32-bit data */
- (LVM_INT16)(2*NumSamples), /* Left and right */
- LVDBE_SCALESHIFT); /* Shift scale */
-
-
- /*
- * Apply the high pass filter if selected
- */
- if (pInstance->Params.HPFSelect == LVDBE_HPF_ON)
- {
- BQ_2I_D32F32C30_TRC_WRA_01(&pInstance->pCoef->HPFInstance,/* Filter instance */
- (LVM_INT32 *)pScratch, /* Source */
- (LVM_INT32 *)pScratch, /* Destination */
- (LVM_INT16)NumSamples); /* Number of samples */
- }
-
-
- /*
- * Create the mono stream
- */
- From2iToMono_32(pScratch, /* Stereo source */
- pMono, /* Mono destination */
- (LVM_INT16)NumSamples); /* Number of samples */
-
-
- /*
- * Apply the band pass filter
- */
- BP_1I_D32F32C30_TRC_WRA_02(&pInstance->pCoef->BPFInstance, /* Filter instance */
- (LVM_INT32 *)pMono, /* Source */
- (LVM_INT32 *)pMono, /* Destination */
- (LVM_INT16)NumSamples); /* Number of samples */
-
-
- /*
- * Apply the AGC and mix
- */
- AGC_MIX_VOL_2St1Mon_D32_WRA(&pInstance->pData->AGCInstance, /* Instance pointer */
- pScratch, /* Stereo source */
- pMono, /* Mono band pass source */
- pScratch, /* Stereo destination */
- NumSamples); /* Number of samples */
-
- /*
- * Convert 32-bit samples to 16-bit and saturate
- * (Not required for 16-bit implemenations)
- */
- Int32RShiftToInt16_Sat_32x16(pScratch, /* Source 32-bit data */
- (LVM_INT16 *)pScratch, /* Dest. 16-bit data */
- (LVM_INT16)(2*NumSamples), /* Left and right */
- LVDBE_SCALESHIFT); /* Shift scale */
-
- }
-
- /* Bypass Volume path is processed when DBE is OFF or during On/Off transitions */
- if ((pInstance->Params.OperatingMode == LVDBE_OFF)||
- (LVC_Mixer_GetCurrent(&pInstance->pData->BypassMixer.MixerStream[1])
- !=LVC_Mixer_GetTarget(&pInstance->pData->BypassMixer.MixerStream[1])))
- {
-
- /*
- * The algorithm is disabled but volume management is required to compensate for
- * headroom and volume (if enabled)
- */
- LVC_MixSoft_1St_D16C31_SAT(&pInstance->pData->BypassVolume,
- pInData,
- pScratchVol,
- (LVM_INT16)(2*NumSamples)); /* Left and right */
-
- }
+ From2iToMono_Float((LVM_FLOAT *)pScratch, /* Stereo source */
+ pMono, /* Mono destination */
+ (LVM_INT16)NumSamples); /* Number of samples */
/*
- * Mix DBE processed path and bypass volume path
+ * Apply the band pass filter
*/
- LVC_MixSoft_2St_D16C31_SAT(&pInstance->pData->BypassMixer,
- (LVM_INT16 *) pScratch,
- pScratchVol,
- pOutData,
- (LVM_INT16)(2*NumSamples));
+ BP_1I_D32F32C30_TRC_WRA_02(&pInstance->pCoef->BPFInstance, /* Filter instance */
+ (LVM_FLOAT *)pMono, /* Source */
+ (LVM_FLOAT *)pMono, /* Destination */
+ (LVM_INT16)NumSamples); /* Number of samples */
- return(LVDBE_SUCCESS);
+ /*
+ * Apply the AGC and mix
+ */
+ AGC_MIX_VOL_2St1Mon_D32_WRA(&pInstance->pData->AGCInstance, /* Instance pointer */
+ pScratch, /* Stereo source */
+ pMono, /* Mono band pass source */
+ pScratch, /* Stereo destination */
+ NumSamples); /* Number of samples */
+
+ for (ii = 0; ii < 2 * NumSamples; ii++) {
+ //TODO: replace with existing clamping function
+ if(pScratch[ii] < -1.0) {
+ pScratch[ii] = -1.0;
+ } else if(pScratch[ii] > 1.0) {
+ pScratch[ii] = 1.0;
+ }
+ }
+ }
+
+ /* Bypass Volume path is processed when DBE is OFF or during On/Off transitions */
+ if ((pInstance->Params.OperatingMode == LVDBE_OFF)||
+ (LVC_Mixer_GetCurrent(&pInstance->pData->BypassMixer.MixerStream[1])
+ !=LVC_Mixer_GetTarget(&pInstance->pData->BypassMixer.MixerStream[1])))
+ {
+
+ /*
+ * The algorithm is disabled but volume management is required to compensate for
+ * headroom and volume (if enabled)
+ */
+ LVC_MixSoft_1St_D16C31_SAT(&pInstance->pData->BypassVolume,
+ pScratch_in,
+ pScratchVol,
+ (LVM_INT16)(2 * NumSamples)); /* Left and right */
+ }
+
+ /*
+ * Mix DBE processed path and bypass volume path
+ */
+ LVC_MixSoft_2St_D16C31_SAT(&pInstance->pData->BypassMixer,
+ pScratch,
+ pScratchVol,
+ pOutData,
+ (LVM_INT16)(2 * NumSamples));
+
+ return(LVDBE_SUCCESS);
}
-
-
-
-
-
-
-
-
-
-
+#endif
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.c b/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.c
index f5d229e..c4a9b14 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.c
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.c
@@ -36,7 +36,11 @@
/*
* High Pass Filter Coefficient table
*/
+#ifndef BUILD_FLOAT
const BQ_C32_Coefs_t LVDBE_HPF_Table[] = {
+#else /*BUILD_FLOAT*/
+const BQ_FLOAT_Coefs_t LVDBE_HPF_Table[] = {
+#endif /*BUILD_FLOAT*/
/* Coefficients for 55Hz centre frequency */
{HPF_Fs8000_Fc55_A2, /* 8kS/s coefficients */
HPF_Fs8000_Fc55_A1,
@@ -83,6 +87,18 @@
HPF_Fs48000_Fc55_A0,
-HPF_Fs48000_Fc55_B2,
-HPF_Fs48000_Fc55_B1},
+#ifdef HIGHER_FS
+ {HPF_Fs96000_Fc55_A2, /* 96kS/s coefficients */
+ HPF_Fs96000_Fc55_A1,
+ HPF_Fs96000_Fc55_A0,
+ -HPF_Fs96000_Fc55_B2,
+ -HPF_Fs96000_Fc55_B1},
+ {HPF_Fs192000_Fc55_A2, /* 192kS/s coefficients */
+ HPF_Fs192000_Fc55_A1,
+ HPF_Fs192000_Fc55_A0,
+ -HPF_Fs192000_Fc55_B2,
+ -HPF_Fs192000_Fc55_B1},
+#endif
/* Coefficients for 66Hz centre frequency */
{HPF_Fs8000_Fc66_A2, /* 8kS/s coefficients */
@@ -130,6 +146,19 @@
HPF_Fs48000_Fc66_A0,
-HPF_Fs48000_Fc66_B2,
-HPF_Fs48000_Fc66_B1},
+#ifdef HIGHER_FS
+ {HPF_Fs96000_Fc66_A2, /* 96kS/s coefficients */
+ HPF_Fs96000_Fc66_A1,
+ HPF_Fs96000_Fc66_A0,
+ -HPF_Fs96000_Fc66_B2,
+ -HPF_Fs96000_Fc66_B1},
+ {HPF_Fs192000_Fc66_A2, /* 192kS/s coefficients */
+ HPF_Fs192000_Fc66_A1,
+ HPF_Fs192000_Fc66_A0,
+ -HPF_Fs192000_Fc66_B2,
+ -HPF_Fs192000_Fc66_B1},
+#endif
+
/* Coefficients for 78Hz centre frequency */
{HPF_Fs8000_Fc78_A2, /* 8kS/s coefficients */
@@ -177,6 +206,19 @@
HPF_Fs48000_Fc78_A0,
-HPF_Fs48000_Fc78_B2,
-HPF_Fs48000_Fc78_B1},
+#ifdef HIGHER_FS
+ {HPF_Fs96000_Fc78_A2, /* 96kS/s coefficients */
+ HPF_Fs96000_Fc78_A1,
+ HPF_Fs96000_Fc78_A0,
+ -HPF_Fs96000_Fc78_B2,
+ -HPF_Fs96000_Fc78_B1},
+ {HPF_Fs192000_Fc78_A2, /* 192kS/s coefficients */
+ HPF_Fs192000_Fc78_A1,
+ HPF_Fs192000_Fc78_A0,
+ -HPF_Fs192000_Fc78_B2,
+ -HPF_Fs192000_Fc78_B1},
+#endif
+
/* Coefficients for 90Hz centre frequency */
{HPF_Fs8000_Fc90_A2, /* 8kS/s coefficients */
@@ -223,12 +265,32 @@
HPF_Fs48000_Fc90_A1,
HPF_Fs48000_Fc90_A0,
-HPF_Fs48000_Fc90_B2,
- -HPF_Fs48000_Fc90_B1}};
+ -HPF_Fs48000_Fc90_B1}
+
+#ifdef HIGHER_FS
+ ,
+ {HPF_Fs96000_Fc90_A2, /* 96kS/s coefficients */
+ HPF_Fs96000_Fc90_A1,
+ HPF_Fs96000_Fc90_A0,
+ -HPF_Fs96000_Fc90_B2,
+ -HPF_Fs96000_Fc90_B1},
+ {HPF_Fs192000_Fc90_A2, /* 192kS/s coefficients */
+ HPF_Fs192000_Fc90_A1,
+ HPF_Fs192000_Fc90_A0,
+ -HPF_Fs192000_Fc90_B2,
+ -HPF_Fs192000_Fc90_B1}
+#endif
+
+};
/*
* Band Pass Filter coefficient table
*/
+#ifndef BUILD_FLOAT
const BP_C32_Coefs_t LVDBE_BPF_Table[] = {
+#else /*BUILD_FLOAT*/
+const BP_FLOAT_Coefs_t LVDBE_BPF_Table[] = {
+#endif /*BUILD_FLOAT*/
/* Coefficients for 55Hz centre frequency */
{BPF_Fs8000_Fc55_A0, /* 8kS/s coefficients */
-BPF_Fs8000_Fc55_B2,
@@ -257,6 +319,14 @@
{BPF_Fs48000_Fc55_A0, /* 48kS/s coefficients */
-BPF_Fs48000_Fc55_B2,
-BPF_Fs48000_Fc55_B1},
+#ifdef HIGHER_FS
+ {BPF_Fs96000_Fc55_A0, /* 96kS/s coefficients */
+ -BPF_Fs96000_Fc55_B2,
+ -BPF_Fs96000_Fc55_B1},
+ {BPF_Fs192000_Fc55_A0, /* 192kS/s coefficients */
+ -BPF_Fs192000_Fc55_B2,
+ -BPF_Fs192000_Fc55_B1},
+#endif
/* Coefficients for 66Hz centre frequency */
{BPF_Fs8000_Fc66_A0, /* 8kS/s coefficients */
@@ -286,6 +356,14 @@
{BPF_Fs48000_Fc66_A0, /* 48kS/s coefficients */
-BPF_Fs48000_Fc66_B2,
-BPF_Fs48000_Fc66_B1},
+#ifdef HIGHER_FS
+ {BPF_Fs96000_Fc66_A0, /* 96kS/s coefficients */
+ -BPF_Fs96000_Fc66_B2,
+ -BPF_Fs96000_Fc66_B1},
+ {BPF_Fs192000_Fc66_A0, /* 192kS/s coefficients */
+ -BPF_Fs192000_Fc66_B2,
+ -BPF_Fs192000_Fc66_B1},
+#endif
/* Coefficients for 78Hz centre frequency */
{BPF_Fs8000_Fc78_A0, /* 8kS/s coefficients */
@@ -315,6 +393,14 @@
{BPF_Fs48000_Fc78_A0, /* 48kS/s coefficients */
-BPF_Fs48000_Fc78_B2,
-BPF_Fs48000_Fc78_B1},
+#ifdef HIGHER_FS
+ {BPF_Fs96000_Fc78_A0, /* 96kS/s coefficients */
+ -BPF_Fs96000_Fc78_B2,
+ -BPF_Fs96000_Fc78_B1},
+ {BPF_Fs192000_Fc78_A0, /* 192kS/s coefficients */
+ -BPF_Fs192000_Fc78_B2,
+ -BPF_Fs192000_Fc78_B1},
+#endif
/* Coefficients for 90Hz centre frequency */
{BPF_Fs8000_Fc90_A0, /* 8kS/s coefficients */
@@ -343,7 +429,19 @@
-BPF_Fs44100_Fc90_B1},
{BPF_Fs48000_Fc90_A0, /* 48kS/s coefficients */
-BPF_Fs48000_Fc90_B2,
- -BPF_Fs48000_Fc90_B1}};
+ -BPF_Fs48000_Fc90_B1}
+#ifdef HIGHER_FS
+ ,
+ {BPF_Fs96000_Fc90_A0, /* 96kS/s coefficients */
+ -BPF_Fs96000_Fc90_B2,
+ -BPF_Fs96000_Fc90_B1},
+ {BPF_Fs192000_Fc90_A0, /* 192kS/s coefficients */
+ -BPF_Fs192000_Fc90_B2,
+ -BPF_Fs192000_Fc90_B1}
+#endif
+
+
+};
/************************************************************************************/
@@ -353,7 +451,11 @@
/************************************************************************************/
/* Attack time (signal too large) */
+#ifndef BUILD_FLOAT
const LVM_INT16 LVDBE_AGC_ATTACK_Table[] = {
+#else /*BUILD_FLOAT*/
+const LVM_FLOAT LVDBE_AGC_ATTACK_Table[] = {
+#endif /*BUILD_FLOAT*/
AGC_ATTACK_Fs8000,
AGC_ATTACK_Fs11025,
AGC_ATTACK_Fs12000,
@@ -362,10 +464,20 @@
AGC_ATTACK_Fs24000,
AGC_ATTACK_Fs32000,
AGC_ATTACK_Fs44100,
- AGC_ATTACK_Fs48000};
+ AGC_ATTACK_Fs48000
+#ifdef HIGHER_FS
+ ,AGC_ATTACK_Fs96000
+ ,AGC_ATTACK_Fs192000
+#endif
+
+};
/* Decay time (signal too small) */
+#ifndef BUILD_FLOAT
const LVM_INT16 LVDBE_AGC_DECAY_Table[] = {
+#else /*BUILD_FLOAT*/
+const LVM_FLOAT LVDBE_AGC_DECAY_Table[] = {
+#endif /*BUILD_FLOAT*/
AGC_DECAY_Fs8000,
AGC_DECAY_Fs11025,
AGC_DECAY_Fs12000,
@@ -374,10 +486,20 @@
AGC_DECAY_Fs24000,
AGC_DECAY_Fs32000,
AGC_DECAY_Fs44100,
- AGC_DECAY_Fs48000};
+ AGC_DECAY_Fs48000
+#ifdef HIGHER_FS
+ ,AGC_DECAY_FS96000
+ ,AGC_DECAY_FS192000
+#endif
+
+};
/* Gain for use without the high pass filter */
+#ifndef BUILD_FLOAT
const LVM_INT32 LVDBE_AGC_GAIN_Table[] = {
+#else /*BUILD_FLOAT*/
+const LVM_FLOAT LVDBE_AGC_GAIN_Table[] = {
+#endif /*BUILD_FLOAT*/
AGC_GAIN_0dB,
AGC_GAIN_1dB,
AGC_GAIN_2dB,
@@ -396,7 +518,11 @@
AGC_GAIN_15dB};
/* Gain for use with the high pass filter */
+#ifndef BUILD_FLOAT
const LVM_INT32 LVDBE_AGC_HPFGAIN_Table[] = {
+#else /*BUILD_FLOAT*/
+const LVM_FLOAT LVDBE_AGC_HPFGAIN_Table[] = {
+#endif /*BUILD_FLOAT*/
AGC_HPFGAIN_0dB,
AGC_HPFGAIN_1dB,
AGC_HPFGAIN_2dB,
@@ -422,6 +548,7 @@
/************************************************************************************/
/* dB to linear conversion table */
+#ifndef BUILD_FLOAT
const LVM_INT16 LVDBE_VolumeTable[] = {
0x4000, /* -6dB */
0x47FB, /* -5dB */
@@ -430,8 +557,22 @@
0x65AD, /* -2dB */
0x7215, /* -1dB */
0x7FFF}; /* 0dB */
+#else /*BUILD_FLOAT*/
+const LVM_FLOAT LVDBE_VolumeTable[] = {
+ 0.500000f, /* -6dB */
+ 0.562341f, /* -5dB */
+ 0.630957f, /* -4dB */
+ 0.707946f, /* -3dB */
+ 0.794328f, /* -2dB */
+ 0.891251f, /* -1dB */
+ 1.000000f}; /* 0dB */
+#endif /*BUILD_FLOAT*/
+#ifndef BUILD_FLOAT
const LVM_INT16 LVDBE_VolumeTCTable[] = {
+#else /*BUILD_FLOAT*/
+const LVM_FLOAT LVDBE_VolumeTCTable[] = {
+#endif /*BUILD_FLOAT*/
VOL_TC_Fs8000,
VOL_TC_Fs11025,
VOL_TC_Fs12000,
@@ -440,9 +581,17 @@
VOL_TC_Fs24000,
VOL_TC_Fs32000,
VOL_TC_Fs44100,
- VOL_TC_Fs48000};
+ VOL_TC_Fs48000
+#ifdef HIGHER_FS
+ ,VOL_TC_Fs96000
+ ,VOL_TC_Fs192000
+#endif
+};
+
+
const LVM_INT16 LVDBE_MixerTCTable[] = {
+
MIX_TC_Fs8000,
MIX_TC_Fs11025,
MIX_TC_Fs12000,
@@ -451,6 +600,10 @@
MIX_TC_Fs24000,
MIX_TC_Fs32000,
MIX_TC_Fs44100,
- MIX_TC_Fs48000};
+ MIX_TC_Fs48000
+#ifdef HIGHER_FS
+ ,MIX_TC_Fs96000
+ ,MIX_TC_Fs192000
+#endif
-
+};
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.h b/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.h
index 476e6a0..ca46e37 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.h
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.h
@@ -31,6 +31,7 @@
#include "BIQUAD.h"
#include "LVM_Types.h"
+#ifndef BUILD_FLOAT
/************************************************************************************/
/* */
/* Coefficients constant table */
@@ -76,8 +77,57 @@
extern const LVM_INT16 LVDBE_VolumeTCTable[];
+#else /*BUILD_FLOAT*/
+
+/************************************************************************************/
+/* */
+/* Coefficients constant table */
+/* */
+/************************************************************************************/
+
+/*
+ * High Pass Filter Coefficient table
+ */
+extern const BQ_FLOAT_Coefs_t LVDBE_HPF_Table[];
+
+/*
+ * Band Pass Filter coefficient table
+ */
+extern const BP_FLOAT_Coefs_t LVDBE_BPF_Table[];
+
+/************************************************************************************/
+/* */
+/* AGC constant tables */
+/* */
+/************************************************************************************/
+
+/* Attack time (signal too large) */
+extern const LVM_FLOAT LVDBE_AGC_ATTACK_Table[];
+
+/* Decay time (signal too small) */
+extern const LVM_FLOAT LVDBE_AGC_DECAY_Table[];
+
+/* Gain for use without the high pass filter */
+extern const LVM_FLOAT LVDBE_AGC_GAIN_Table[];
+
+/* Gain for use with the high pass filter */
+extern const LVM_FLOAT LVDBE_AGC_HPFGAIN_Table[];
+
+/************************************************************************************/
+/* */
+/* Volume control gain and time constant tables */
+/* */
+/************************************************************************************/
+
+/* dB to linear conversion table */
+extern const LVM_FLOAT LVDBE_VolumeTable[];
+extern const LVM_FLOAT LVDBE_VolumeTCTable[];
+
+#endif /*BUILD_FLOAT*/
+
extern const LVM_INT16 LVDBE_MixerTCTable[];
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/media/libeffects/lvm/lib/Bundle/lib/LVM.h b/media/libeffects/lvm/lib/Bundle/lib/LVM.h
index 1ff2a2c..9b6da31 100644
--- a/media/libeffects/lvm/lib/Bundle/lib/LVM.h
+++ b/media/libeffects/lvm/lib/Bundle/lib/LVM.h
@@ -514,11 +514,19 @@
/* STEREO the number of sample pairs in the block */
/* */
/****************************************************************************************/
+#ifdef BUILD_FLOAT
+LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 NumSamples,
+ LVM_UINT32 AudioTime);
+#else
LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 *pOutData,
LVM_UINT16 NumSamples,
LVM_UINT32 AudioTime);
+#endif
/****************************************************************************************/
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.c b/media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.c
index 6cbee7d..0a3c30e 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.c
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.c
@@ -48,7 +48,152 @@
/* NOTES: */
/* */
/****************************************************************************************/
+#ifdef BUILD_FLOAT
+void LVM_BufferManagedIn(LVM_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT **pToProcess,
+ LVM_FLOAT **pProcessed,
+ LVM_UINT16 *pNumSamples)
+{
+ LVM_INT16 SampleCount; /* Number of samples to be processed this call */
+ LVM_INT16 NumSamples; /* Number of samples in scratch buffer */
+ LVM_FLOAT *pStart;
+ LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
+ LVM_Buffer_t *pBuffer;
+ LVM_FLOAT *pDest;
+ LVM_INT16 NumChannels = 2;
+
+
+ /*
+ * Set the processing address pointers
+ */
+ pBuffer = pInstance->pBufferManagement;
+ pDest = pBuffer->pScratch;
+ *pToProcess = pBuffer->pScratch;
+ *pProcessed = pBuffer->pScratch;
+
+ /*
+ * Check if it is the first call of a block
+ */
+ if (pInstance->SamplesToProcess == 0)
+ {
+ /*
+ * First call for a new block of samples
+ */
+ pInstance->SamplesToProcess = (LVM_INT16)(*pNumSamples + pBuffer->InDelaySamples);
+ pInstance->pInputSamples = (LVM_FLOAT *)pInData;
+ pBuffer->BufferState = LVM_FIRSTCALL;
+ }
+ pStart = pInstance->pInputSamples; /* Pointer to the input samples */
+ pBuffer->SamplesToOutput = 0; /* Samples to output is same as
+ number read for inplace processing */
+
+
+ /*
+ * Calculate the number of samples to process this call and update the buffer state
+ */
+ if (pInstance->SamplesToProcess > pInstance->InternalBlockSize)
+ {
+ /*
+ * Process the maximum bock size of samples.
+ */
+ SampleCount = pInstance->InternalBlockSize;
+ NumSamples = pInstance->InternalBlockSize;
+ }
+ else
+ {
+ /*
+ * Last call for the block, so calculate how many frames and samples to process
+ */
+ LVM_INT16 NumFrames;
+
+ NumSamples = pInstance->SamplesToProcess;
+ NumFrames = (LVM_INT16)(NumSamples >> MIN_INTERNAL_BLOCKSHIFT);
+ SampleCount = (LVM_INT16)(NumFrames << MIN_INTERNAL_BLOCKSHIFT);
+
+ /*
+ * Update the buffer state
+ */
+ if (pBuffer->BufferState == LVM_FIRSTCALL)
+ {
+ pBuffer->BufferState = LVM_FIRSTLASTCALL;
+ }
+ else
+ {
+ pBuffer->BufferState = LVM_LASTCALL;
+ }
+ }
+ *pNumSamples = (LVM_UINT16)SampleCount; /* Set the number of samples to process this call */
+
+
+ /*
+ * Copy samples from the delay buffer as required
+ */
+ if (((pBuffer->BufferState == LVM_FIRSTCALL) ||
+ (pBuffer->BufferState == LVM_FIRSTLASTCALL)) &&
+ (pBuffer->InDelaySamples != 0))
+ {
+ Copy_Float(&pBuffer->InDelayBuffer[0], /* Source */
+ pDest, /* Destination */
+ (LVM_INT16)(NumChannels * pBuffer->InDelaySamples)); /* Number of delay \
+ samples, left and right */
+ NumSamples = (LVM_INT16)(NumSamples - pBuffer->InDelaySamples); /* Update sample count */
+ pDest += NumChannels * pBuffer->InDelaySamples; /* Update the destination pointer */
+ }
+
+
+ /*
+ * Copy the rest of the samples for this call from the input buffer
+ */
+ if (NumSamples > 0)
+ {
+ Copy_Float(pStart, /* Source */
+ pDest, /* Destination */
+ (LVM_INT16)(NumChannels * NumSamples)); /* Number of input samples */
+ pStart += NumChannels * NumSamples; /* Update the input pointer */
+
+ /*
+ * Update the input data pointer and samples to output
+ */
+ /* Update samples to output */
+ pBuffer->SamplesToOutput = (LVM_INT16)(pBuffer->SamplesToOutput + NumSamples);
+ }
+
+
+ /*
+ * Update the sample count and input pointer
+ */
+ /* Update the count of samples */
+ pInstance->SamplesToProcess = (LVM_INT16)(pInstance->SamplesToProcess - SampleCount);
+ pInstance->pInputSamples = pStart; /* Update input sample pointer */
+
+
+ /*
+ * Save samples to the delay buffer if any left unprocessed
+ */
+ if ((pBuffer->BufferState == LVM_FIRSTLASTCALL) ||
+ (pBuffer->BufferState == LVM_LASTCALL))
+ {
+ NumSamples = pInstance->SamplesToProcess;
+ pStart = pBuffer->pScratch; /* Start of the buffer */
+ pStart += NumChannels * SampleCount; /* Offset by the number of processed samples */
+ if (NumSamples != 0)
+ {
+ Copy_Float(pStart, /* Source */
+ &pBuffer->InDelayBuffer[0], /* Destination */
+ (LVM_INT16)(NumChannels * NumSamples)); /* Number of input samples */
+ }
+
+
+ /*
+ * Update the delay sample count
+ */
+ pBuffer->InDelaySamples = NumSamples; /* Number of delay sample pairs */
+ pInstance->SamplesToProcess = 0; /* All Samples used */
+ }
+}
+#else
void LVM_BufferManagedIn(LVM_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 **pToProcess,
@@ -189,7 +334,7 @@
pInstance->SamplesToProcess = 0; /* All Samples used */
}
}
-
+#endif
/****************************************************************************************/
/* */
@@ -213,7 +358,47 @@
/* NOTES: */
/* */
/****************************************************************************************/
+#ifdef BUILD_FLOAT
+void LVM_BufferUnmanagedIn(LVM_Handle_t hInstance,
+ LVM_FLOAT **pToProcess,
+ LVM_FLOAT **pProcessed,
+ LVM_UINT16 *pNumSamples)
+{
+ LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
+
+
+ /*
+ * Check if this is the first call of a block
+ */
+ if (pInstance->SamplesToProcess == 0)
+ {
+ pInstance->SamplesToProcess = (LVM_INT16)*pNumSamples; /* Get the number of samples
+ on first call */
+ pInstance->pInputSamples = *pToProcess; /* Get the I/O pointers */
+ pInstance->pOutputSamples = *pProcessed;
+
+
+ /*
+ * Set te block size to process
+ */
+ if (pInstance->SamplesToProcess > pInstance->InternalBlockSize)
+ {
+ *pNumSamples = (LVM_UINT16)pInstance->InternalBlockSize;
+ }
+ else
+ {
+ *pNumSamples = (LVM_UINT16)pInstance->SamplesToProcess;
+ }
+ }
+
+ /*
+ * Set the process pointers
+ */
+ *pToProcess = pInstance->pInputSamples;
+ *pProcessed = pInstance->pOutputSamples;
+}
+#else
void LVM_BufferUnmanagedIn(LVM_Handle_t hInstance,
LVM_INT16 **pToProcess,
LVM_INT16 **pProcessed,
@@ -252,7 +437,7 @@
*pToProcess = pInstance->pInputSamples;
*pProcessed = pInstance->pOutputSamples;
}
-
+#endif
/****************************************************************************************/
/* */
@@ -278,6 +463,7 @@
/* */
/****************************************************************************************/
+#ifndef BUILD_FLOAT
void LVM_BufferOptimisedIn(LVM_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 **pToProcess,
@@ -416,7 +602,7 @@
}
}
}
-
+#endif
/****************************************************************************************/
/* */
/* FUNCTION: LVM_BufferIn */
@@ -471,7 +657,37 @@
/* NOTES: */
/* */
/****************************************************************************************/
+#ifdef BUILD_FLOAT
+void LVM_BufferIn(LVM_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT **pToProcess,
+ LVM_FLOAT **pProcessed,
+ LVM_UINT16 *pNumSamples)
+{
+ LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
+
+
+ /*
+ * Check which mode, managed or unmanaged
+ */
+ if (pInstance->InstParams.BufferMode == LVM_MANAGED_BUFFERS)
+ {
+ LVM_BufferManagedIn(hInstance,
+ pInData,
+ pToProcess,
+ pProcessed,
+ pNumSamples);
+ }
+ else
+ {
+ LVM_BufferUnmanagedIn(hInstance,
+ pToProcess,
+ pProcessed,
+ pNumSamples);
+ }
+}
+#else
void LVM_BufferIn(LVM_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 **pToProcess,
@@ -501,7 +717,7 @@
pNumSamples);
}
}
-
+#endif
/****************************************************************************************/
/* */
/* FUNCTION: LVM_BufferManagedOut */
@@ -522,7 +738,156 @@
/* NOTES: */
/* */
/****************************************************************************************/
+#ifdef BUILD_FLOAT
+void LVM_BufferManagedOut(LVM_Handle_t hInstance,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 *pNumSamples)
+{
+ LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
+ LVM_Buffer_t *pBuffer = pInstance->pBufferManagement;
+ LVM_INT16 SampleCount = (LVM_INT16)*pNumSamples;
+ LVM_INT16 NumSamples;
+ LVM_FLOAT *pStart;
+ LVM_FLOAT *pDest;
+
+
+ /*
+ * Set the pointers
+ */
+ NumSamples = pBuffer->SamplesToOutput;
+ pStart = pBuffer->pScratch;
+
+
+ /*
+ * check if it is the first call of a block
+ */
+ if ((pBuffer->BufferState == LVM_FIRSTCALL) ||
+ (pBuffer->BufferState == LVM_FIRSTLASTCALL))
+ {
+ /* First call for a new block */
+ pInstance->pOutputSamples = pOutData; /* Initialise the destination */
+ }
+ pDest = pInstance->pOutputSamples; /* Set the output address */
+
+
+ /*
+ * If the number of samples is non-zero then there are still samples to send to
+ * the output buffer
+ */
+ if ((NumSamples != 0) &&
+ (pBuffer->OutDelaySamples != 0))
+ {
+ /*
+ * Copy the delayed output buffer samples to the output
+ */
+ if (pBuffer->OutDelaySamples <= NumSamples)
+ {
+ /*
+ * Copy all output delay samples to the output
+ */
+ Copy_Float(&pBuffer->OutDelayBuffer[0], /* Source */
+ pDest, /* Detsination */
+ (LVM_INT16)(2 * pBuffer->OutDelaySamples)); /* Number of delay samples */
+
+ /*
+ * Update the pointer and sample counts
+ */
+ pDest += 2 * pBuffer->OutDelaySamples; /* Output sample pointer */
+ NumSamples = (LVM_INT16)(NumSamples - pBuffer->OutDelaySamples); /* Samples left \
+ to send */
+ pBuffer->OutDelaySamples = 0; /* No samples left in the buffer */
+ }
+ else
+ {
+ /*
+ * Copy only some of the ouput delay samples to the output
+ */
+ Copy_Float(&pBuffer->OutDelayBuffer[0], /* Source */
+ pDest, /* Detsination */
+ (LVM_INT16)(2 * NumSamples)); /* Number of delay samples */
+
+ /*
+ * Update the pointer and sample counts
+ */
+ pDest += 2 * NumSamples; /* Output sample pointer */
+ /* No samples left in the buffer */
+ pBuffer->OutDelaySamples = (LVM_INT16)(pBuffer->OutDelaySamples - NumSamples);
+
+ /*
+ * Realign the delay buffer data to avoid using circular buffer management
+ */
+ Copy_Float(&pBuffer->OutDelayBuffer[2 * NumSamples], /* Source */
+ &pBuffer->OutDelayBuffer[0], /* Destination */
+ (LVM_INT16)(2 * pBuffer->OutDelaySamples)); /* Number of samples to move */
+ NumSamples = 0; /* Samples left to send */
+ }
+ }
+
+
+ /*
+ * Copy the processed results to the output
+ */
+ if ((NumSamples != 0) &&
+ (SampleCount != 0))
+ {
+ if (SampleCount <= NumSamples)
+ {
+ /*
+ * Copy all processed samples to the output
+ */
+ Copy_Float(pStart, /* Source */
+ pDest, /* Detsination */
+ (LVM_INT16)(2 * SampleCount)); /* Number of processed samples */
+ /*
+ * Update the pointer and sample counts
+ */
+ pDest += 2 * SampleCount; /* Output sample pointer */
+ NumSamples = (LVM_INT16)(NumSamples - SampleCount); /* Samples left to send */
+ SampleCount = 0; /* No samples left in the buffer */
+ }
+ else
+ {
+ /*
+ * Copy only some processed samples to the output
+ */
+ Copy_Float(pStart, /* Source */
+ pDest, /* Destination */
+ (LVM_INT16)(2 * NumSamples)); /* Number of processed samples */
+ /*
+ * Update the pointers and sample counts
+ */
+ pStart += 2 * NumSamples; /* Processed sample pointer */
+ pDest += 2 * NumSamples; /* Output sample pointer */
+ SampleCount = (LVM_INT16)(SampleCount - NumSamples); /* Processed samples left */
+ NumSamples = 0; /* Clear the sample count */
+ }
+ }
+
+
+ /*
+ * Copy the remaining processed data to the output delay buffer
+ */
+ if (SampleCount != 0)
+ {
+ Copy_Float(pStart, /* Source */
+ &pBuffer->OutDelayBuffer[2 * pBuffer->OutDelaySamples], /* Destination */
+ (LVM_INT16)(2 * SampleCount)); /* Number of processed samples */
+ /* Update the buffer count */
+ pBuffer->OutDelaySamples = (LVM_INT16)(pBuffer->OutDelaySamples + SampleCount);
+ }
+
+ /*
+ * pointers, counts and set default buffer processing
+ */
+ pBuffer->SamplesToOutput = NumSamples; /* Samples left to send */
+ pInstance->pOutputSamples = pDest; /* Output sample pointer */
+ pBuffer->BufferState = LVM_MAXBLOCKCALL; /* Set for the default call \
+ block size */
+ /* This will terminate the loop when all samples processed */
+ *pNumSamples = (LVM_UINT16)pInstance->SamplesToProcess;
+}
+#else
void LVM_BufferManagedOut(LVM_Handle_t hInstance,
LVM_INT16 *pOutData,
LVM_UINT16 *pNumSamples)
@@ -672,7 +1037,7 @@
pBuffer->BufferState = LVM_MAXBLOCKCALL; /* Set for the default call block size */
*pNumSamples = (LVM_UINT16)pInstance->SamplesToProcess; /* This will terminate the loop when all samples processed */
}
-
+#endif
/****************************************************************************************/
/* */
@@ -741,6 +1106,7 @@
/* */
/****************************************************************************************/
+#ifndef BUILD_FLOAT
void LVM_BufferOptimisedOut(LVM_Handle_t hInstance,
LVM_UINT16 *pNumSamples)
{
@@ -805,7 +1171,7 @@
}
}
}
-
+#endif
/****************************************************************************************/
/* */
@@ -843,7 +1209,31 @@
/* NOTES: */
/* */
/****************************************************************************************/
+#ifdef BUILD_FLOAT
+void LVM_BufferOut(LVM_Handle_t hInstance,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 *pNumSamples)
+{
+ LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
+
+
+ /*
+ * Check which mode, managed or unmanaged
+ */
+ if (pInstance->InstParams.BufferMode == LVM_MANAGED_BUFFERS)
+ {
+ LVM_BufferManagedOut(hInstance,
+ pOutData,
+ pNumSamples);
+ }
+ else
+ {
+ LVM_BufferUnmanagedOut(hInstance,
+ pNumSamples);
+ }
+}
+#else
void LVM_BufferOut(LVM_Handle_t hInstance,
LVM_INT16 *pOutData,
LVM_UINT16 *pNumSamples)
@@ -867,4 +1257,4 @@
pNumSamples);
}
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h b/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
index 2712b2c..353560c 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
@@ -26,10 +26,655 @@
/************************************************************************************/
#define TrebleBoostCorner 8000
-#define TrebleBoostMinRate 4
-#define TrebleBoostSteps 15
+#define TrebleBoostMinRate 4
+#define TrebleBoostSteps 15
+#ifdef BUILD_FLOAT
+/* Coefficients for sample rate 22050Hz */
+ /* Gain = 1.000000 dB */
+#define HPF_Fs22050_Gain1_A0 1.038434
+#define HPF_Fs22050_Gain1_A1 0.331599
+#define HPF_Fs22050_Gain1_A2 0.000000
+#define HPF_Fs22050_Gain1_B1 0.370033
+#define HPF_Fs22050_Gain1_B2 0.000000
+ /* Gain = 2.000000 dB */
+#define HPF_Fs22050_Gain2_A0 1.081557
+#define HPF_Fs22050_Gain2_A1 0.288475
+#define HPF_Fs22050_Gain2_A2 0.000000
+#define HPF_Fs22050_Gain2_B1 0.370033
+#define HPF_Fs22050_Gain2_B2 0.000000
+ /* Gain = 3.000000 dB */
+#define HPF_Fs22050_Gain3_A0 1.129943
+#define HPF_Fs22050_Gain3_A1 0.240090
+#define HPF_Fs22050_Gain3_A2 0.000000
+#define HPF_Fs22050_Gain3_B1 0.370033
+#define HPF_Fs22050_Gain3_B2 0.000000
+ /* Gain = 4.000000 dB */
+#define HPF_Fs22050_Gain4_A0 1.184232
+#define HPF_Fs22050_Gain4_A1 0.185801
+#define HPF_Fs22050_Gain4_A2 0.000000
+#define HPF_Fs22050_Gain4_B1 0.370033
+#define HPF_Fs22050_Gain4_B2 0.000000
+ /* Gain = 5.000000 dB */
+#define HPF_Fs22050_Gain5_A0 1.245145
+#define HPF_Fs22050_Gain5_A1 0.124887
+#define HPF_Fs22050_Gain5_A2 0.000000
+#define HPF_Fs22050_Gain5_B1 0.370033
+#define HPF_Fs22050_Gain5_B2 0.000000
+ /* Gain = 6.000000 dB */
+#define HPF_Fs22050_Gain6_A0 1.313491
+#define HPF_Fs22050_Gain6_A1 0.056541
+#define HPF_Fs22050_Gain6_A2 0.000000
+#define HPF_Fs22050_Gain6_B1 0.370033
+#define HPF_Fs22050_Gain6_B2 0.000000
+ /* Gain = 7.000000 dB */
+#define HPF_Fs22050_Gain7_A0 1.390177
+#define HPF_Fs22050_Gain7_A1 -0.020144
+#define HPF_Fs22050_Gain7_A2 0.000000
+#define HPF_Fs22050_Gain7_B1 0.370033
+#define HPF_Fs22050_Gain7_B2 0.000000
+ /* Gain = 8.000000 dB */
+#define HPF_Fs22050_Gain8_A0 1.476219
+#define HPF_Fs22050_Gain8_A1 -0.106187
+#define HPF_Fs22050_Gain8_A2 0.000000
+#define HPF_Fs22050_Gain8_B1 0.370033
+#define HPF_Fs22050_Gain8_B2 0.000000
+ /* Gain = 9.000000 dB */
+#define HPF_Fs22050_Gain9_A0 1.572761
+#define HPF_Fs22050_Gain9_A1 -0.202728
+#define HPF_Fs22050_Gain9_A2 0.000000
+#define HPF_Fs22050_Gain9_B1 0.370033
+#define HPF_Fs22050_Gain9_B2 0.000000
+ /* Gain = 10.000000 dB */
+#define HPF_Fs22050_Gain10_A0 1.681082
+#define HPF_Fs22050_Gain10_A1 -0.311049
+#define HPF_Fs22050_Gain10_A2 0.000000
+#define HPF_Fs22050_Gain10_B1 0.370033
+#define HPF_Fs22050_Gain10_B2 0.000000
+ /* Gain = 11.000000 dB */
+#define HPF_Fs22050_Gain11_A0 1.802620
+#define HPF_Fs22050_Gain11_A1 -0.432588
+#define HPF_Fs22050_Gain11_A2 0.000000
+#define HPF_Fs22050_Gain11_B1 0.370033
+#define HPF_Fs22050_Gain11_B2 0.000000
+ /* Gain = 12.000000 dB */
+#define HPF_Fs22050_Gain12_A0 1.938989
+#define HPF_Fs22050_Gain12_A1 -0.568956
+#define HPF_Fs22050_Gain12_A2 0.000000
+#define HPF_Fs22050_Gain12_B1 0.370033
+#define HPF_Fs22050_Gain12_B2 0.000000
+ /* Gain = 13.000000 dB */
+#define HPF_Fs22050_Gain13_A0 2.091997
+#define HPF_Fs22050_Gain13_A1 -0.721964
+#define HPF_Fs22050_Gain13_A2 0.000000
+#define HPF_Fs22050_Gain13_B1 0.370033
+#define HPF_Fs22050_Gain13_B2 0.000000
+ /* Gain = 14.000000 dB */
+#define HPF_Fs22050_Gain14_A0 2.263674
+#define HPF_Fs22050_Gain14_A1 -0.893641
+#define HPF_Fs22050_Gain14_A2 0.000000
+#define HPF_Fs22050_Gain14_B1 0.370033
+#define HPF_Fs22050_Gain14_B2 0.000000
+ /* Gain = 15.000000 dB */
+#define HPF_Fs22050_Gain15_A0 2.456300
+#define HPF_Fs22050_Gain15_A1 -1.086267
+#define HPF_Fs22050_Gain15_A2 0.000000
+#define HPF_Fs22050_Gain15_B1 0.370033
+#define HPF_Fs22050_Gain15_B2 0.000000
+/* Coefficients for sample rate 24000Hz */
+ /* Gain = 1.000000 dB */
+#define HPF_Fs24000_Gain1_A0 1.044662
+#define HPF_Fs24000_Gain1_A1 0.223287
+#define HPF_Fs24000_Gain1_A2 0.000000
+#define HPF_Fs24000_Gain1_B1 0.267949
+#define HPF_Fs24000_Gain1_B2 0.000000
+ /* Gain = 2.000000 dB */
+#define HPF_Fs24000_Gain2_A0 1.094773
+#define HPF_Fs24000_Gain2_A1 0.173176
+#define HPF_Fs24000_Gain2_A2 0.000000
+#define HPF_Fs24000_Gain2_B1 0.267949
+#define HPF_Fs24000_Gain2_B2 0.000000
+ /* Gain = 3.000000 dB */
+#define HPF_Fs24000_Gain3_A0 1.150999
+#define HPF_Fs24000_Gain3_A1 0.116950
+#define HPF_Fs24000_Gain3_A2 0.000000
+#define HPF_Fs24000_Gain3_B1 0.267949
+#define HPF_Fs24000_Gain3_B2 0.000000
+ /* Gain = 4.000000 dB */
+#define HPF_Fs24000_Gain4_A0 1.214086
+#define HPF_Fs24000_Gain4_A1 0.053863
+#define HPF_Fs24000_Gain4_A2 0.000000
+#define HPF_Fs24000_Gain4_B1 0.267949
+#define HPF_Fs24000_Gain4_B2 0.000000
+ /* Gain = 5.000000 dB */
+#define HPF_Fs24000_Gain5_A0 1.284870
+#define HPF_Fs24000_Gain5_A1 -0.016921
+#define HPF_Fs24000_Gain5_A2 0.000000
+#define HPF_Fs24000_Gain5_B1 0.267949
+#define HPF_Fs24000_Gain5_B2 0.000000
+ /* Gain = 6.000000 dB */
+#define HPF_Fs24000_Gain6_A0 1.364291
+#define HPF_Fs24000_Gain6_A1 -0.096342
+#define HPF_Fs24000_Gain6_A2 0.000000
+#define HPF_Fs24000_Gain6_B1 0.267949
+#define HPF_Fs24000_Gain6_B2 0.000000
+ /* Gain = 7.000000 dB */
+#define HPF_Fs24000_Gain7_A0 1.453403
+#define HPF_Fs24000_Gain7_A1 -0.185454
+#define HPF_Fs24000_Gain7_A2 0.000000
+#define HPF_Fs24000_Gain7_B1 0.267949
+#define HPF_Fs24000_Gain7_B2 0.000000
+ /* Gain = 8.000000 dB */
+#define HPF_Fs24000_Gain8_A0 1.553389
+#define HPF_Fs24000_Gain8_A1 -0.285440
+#define HPF_Fs24000_Gain8_A2 0.000000
+#define HPF_Fs24000_Gain8_B1 0.267949
+#define HPF_Fs24000_Gain8_B2 0.000000
+ /* Gain = 9.000000 dB */
+#define HPF_Fs24000_Gain9_A0 1.665574
+#define HPF_Fs24000_Gain9_A1 -0.397625
+#define HPF_Fs24000_Gain9_A2 0.000000
+#define HPF_Fs24000_Gain9_B1 0.267949
+#define HPF_Fs24000_Gain9_B2 0.000000
+ /* Gain = 10.000000 dB */
+#define HPF_Fs24000_Gain10_A0 1.791449
+#define HPF_Fs24000_Gain10_A1 -0.523499
+#define HPF_Fs24000_Gain10_A2 0.000000
+#define HPF_Fs24000_Gain10_B1 0.267949
+#define HPF_Fs24000_Gain10_B2 0.000000
+ /* Gain = 11.000000 dB */
+#define HPF_Fs24000_Gain11_A0 1.932682
+#define HPF_Fs24000_Gain11_A1 -0.664733
+#define HPF_Fs24000_Gain11_A2 0.000000
+#define HPF_Fs24000_Gain11_B1 0.267949
+#define HPF_Fs24000_Gain11_B2 0.000000
+ /* Gain = 12.000000 dB */
+#define HPF_Fs24000_Gain12_A0 2.091148
+#define HPF_Fs24000_Gain12_A1 -0.823199
+#define HPF_Fs24000_Gain12_A2 0.000000
+#define HPF_Fs24000_Gain12_B1 0.267949
+#define HPF_Fs24000_Gain12_B2 0.000000
+ /* Gain = 13.000000 dB */
+#define HPF_Fs24000_Gain13_A0 2.268950
+#define HPF_Fs24000_Gain13_A1 -1.001001
+#define HPF_Fs24000_Gain13_A2 0.000000
+#define HPF_Fs24000_Gain13_B1 0.267949
+#define HPF_Fs24000_Gain13_B2 0.000000
+ /* Gain = 14.000000 dB */
+#define HPF_Fs24000_Gain14_A0 2.468447
+#define HPF_Fs24000_Gain14_A1 -1.200498
+#define HPF_Fs24000_Gain14_A2 0.000000
+#define HPF_Fs24000_Gain14_B1 0.267949
+#define HPF_Fs24000_Gain14_B2 0.000000
+ /* Gain = 15.000000 dB */
+#define HPF_Fs24000_Gain15_A0 2.692287
+#define HPF_Fs24000_Gain15_A1 -1.424338
+#define HPF_Fs24000_Gain15_A2 0.000000
+#define HPF_Fs24000_Gain15_B1 0.267949
+#define HPF_Fs24000_Gain15_B2 0.000000
+/* Coefficients for sample rate 32000Hz */
+ /* Gain = 1.000000 dB */
+#define HPF_Fs32000_Gain1_A0 1.061009
+#define HPF_Fs32000_Gain1_A1 -0.061009
+#define HPF_Fs32000_Gain1_A2 0.000000
+#define HPF_Fs32000_Gain1_B1 -0.000000
+#define HPF_Fs32000_Gain1_B2 0.000000
+ /* Gain = 2.000000 dB */
+#define HPF_Fs32000_Gain2_A0 1.129463
+#define HPF_Fs32000_Gain2_A1 -0.129463
+#define HPF_Fs32000_Gain2_A2 0.000000
+#define HPF_Fs32000_Gain2_B1 -0.000000
+#define HPF_Fs32000_Gain2_B2 0.000000
+ /* Gain = 3.000000 dB */
+#define HPF_Fs32000_Gain3_A0 1.206267
+#define HPF_Fs32000_Gain3_A1 -0.206267
+#define HPF_Fs32000_Gain3_A2 0.000000
+#define HPF_Fs32000_Gain3_B1 -0.000000
+#define HPF_Fs32000_Gain3_B2 0.000000
+ /* Gain = 4.000000 dB */
+#define HPF_Fs32000_Gain4_A0 1.292447
+#define HPF_Fs32000_Gain4_A1 -0.292447
+#define HPF_Fs32000_Gain4_A2 0.000000
+#define HPF_Fs32000_Gain4_B1 -0.000000
+#define HPF_Fs32000_Gain4_B2 0.000000
+ /* Gain = 5.000000 dB */
+#define HPF_Fs32000_Gain5_A0 1.389140
+#define HPF_Fs32000_Gain5_A1 -0.389140
+#define HPF_Fs32000_Gain5_A2 0.000000
+#define HPF_Fs32000_Gain5_B1 -0.000000
+#define HPF_Fs32000_Gain5_B2 0.000000
+ /* Gain = 6.000000 dB */
+#define HPF_Fs32000_Gain6_A0 1.497631
+#define HPF_Fs32000_Gain6_A1 -0.497631
+#define HPF_Fs32000_Gain6_A2 0.000000
+#define HPF_Fs32000_Gain6_B1 -0.000000
+#define HPF_Fs32000_Gain6_B2 0.000000
+ /* Gain = 7.000000 dB */
+#define HPF_Fs32000_Gain7_A0 1.619361
+#define HPF_Fs32000_Gain7_A1 -0.619361
+#define HPF_Fs32000_Gain7_A2 0.000000
+#define HPF_Fs32000_Gain7_B1 -0.000000
+#define HPF_Fs32000_Gain7_B2 0.000000
+ /* Gain = 8.000000 dB */
+#define HPF_Fs32000_Gain8_A0 1.755943
+#define HPF_Fs32000_Gain8_A1 -0.755943
+#define HPF_Fs32000_Gain8_A2 0.000000
+#define HPF_Fs32000_Gain8_B1 -0.000000
+#define HPF_Fs32000_Gain8_B2 0.000000
+ /* Gain = 9.000000 dB */
+#define HPF_Fs32000_Gain9_A0 1.909191
+#define HPF_Fs32000_Gain9_A1 -0.909191
+#define HPF_Fs32000_Gain9_A2 0.000000
+#define HPF_Fs32000_Gain9_B1 -0.000000
+#define HPF_Fs32000_Gain9_B2 0.000000
+ /* Gain = 10.000000 dB */
+#define HPF_Fs32000_Gain10_A0 2.081139
+#define HPF_Fs32000_Gain10_A1 -1.081139
+#define HPF_Fs32000_Gain10_A2 0.000000
+#define HPF_Fs32000_Gain10_B1 -0.000000
+#define HPF_Fs32000_Gain10_B2 0.000000
+ /* Gain = 11.000000 dB */
+#define HPF_Fs32000_Gain11_A0 2.274067
+#define HPF_Fs32000_Gain11_A1 -1.274067
+#define HPF_Fs32000_Gain11_A2 0.000000
+#define HPF_Fs32000_Gain11_B1 -0.000000
+#define HPF_Fs32000_Gain11_B2 0.000000
+ /* Gain = 12.000000 dB */
+#define HPF_Fs32000_Gain12_A0 2.490536
+#define HPF_Fs32000_Gain12_A1 -1.490536
+#define HPF_Fs32000_Gain12_A2 0.000000
+#define HPF_Fs32000_Gain12_B1 -0.000000
+#define HPF_Fs32000_Gain12_B2 0.000000
+ /* Gain = 13.000000 dB */
+#define HPF_Fs32000_Gain13_A0 2.733418
+#define HPF_Fs32000_Gain13_A1 -1.733418
+#define HPF_Fs32000_Gain13_A2 0.000000
+#define HPF_Fs32000_Gain13_B1 -0.000000
+#define HPF_Fs32000_Gain13_B2 0.000000
+ /* Gain = 14.000000 dB */
+#define HPF_Fs32000_Gain14_A0 3.005936
+#define HPF_Fs32000_Gain14_A1 -2.005936
+#define HPF_Fs32000_Gain14_A2 0.000000
+#define HPF_Fs32000_Gain14_B1 -0.000000
+#define HPF_Fs32000_Gain14_B2 0.000000
+ /* Gain = 15.000000 dB */
+#define HPF_Fs32000_Gain15_A0 3.311707
+#define HPF_Fs32000_Gain15_A1 -2.311707
+#define HPF_Fs32000_Gain15_A2 0.000000
+#define HPF_Fs32000_Gain15_B1 -0.000000
+#define HPF_Fs32000_Gain15_B2 0.000000
+/* Coefficients for sample rate 44100Hz */
+ /* Gain = 1.000000 dB */
+#define HPF_Fs44100_Gain1_A0 1.074364
+#define HPF_Fs44100_Gain1_A1 -0.293257
+#define HPF_Fs44100_Gain1_A2 0.000000
+#define HPF_Fs44100_Gain1_B1 -0.218894
+#define HPF_Fs44100_Gain1_B2 0.000000
+ /* Gain = 2.000000 dB */
+#define HPF_Fs44100_Gain2_A0 1.157801
+#define HPF_Fs44100_Gain2_A1 -0.376695
+#define HPF_Fs44100_Gain2_A2 0.000000
+#define HPF_Fs44100_Gain2_B1 -0.218894
+#define HPF_Fs44100_Gain2_B2 0.000000
+ /* Gain = 3.000000 dB */
+#define HPF_Fs44100_Gain3_A0 1.251420
+#define HPF_Fs44100_Gain3_A1 -0.470313
+#define HPF_Fs44100_Gain3_A2 0.000000
+#define HPF_Fs44100_Gain3_B1 -0.218894
+#define HPF_Fs44100_Gain3_B2 0.000000
+ /* Gain = 4.000000 dB */
+#define HPF_Fs44100_Gain4_A0 1.356461
+#define HPF_Fs44100_Gain4_A1 -0.575355
+#define HPF_Fs44100_Gain4_A2 0.000000
+#define HPF_Fs44100_Gain4_B1 -0.218894
+#define HPF_Fs44100_Gain4_B2 0.000000
+ /* Gain = 5.000000 dB */
+#define HPF_Fs44100_Gain5_A0 1.474320
+#define HPF_Fs44100_Gain5_A1 -0.693213
+#define HPF_Fs44100_Gain5_A2 0.000000
+#define HPF_Fs44100_Gain5_B1 -0.218894
+#define HPF_Fs44100_Gain5_B2 0.000000
+ /* Gain = 6.000000 dB */
+#define HPF_Fs44100_Gain6_A0 1.606559
+#define HPF_Fs44100_Gain6_A1 -0.825453
+#define HPF_Fs44100_Gain6_A2 0.000000
+#define HPF_Fs44100_Gain6_B1 -0.218894
+#define HPF_Fs44100_Gain6_B2 0.000000
+ /* Gain = 7.000000 dB */
+#define HPF_Fs44100_Gain7_A0 1.754935
+#define HPF_Fs44100_Gain7_A1 -0.973828
+#define HPF_Fs44100_Gain7_A2 0.000000
+#define HPF_Fs44100_Gain7_B1 -0.218894
+#define HPF_Fs44100_Gain7_B2 0.000000
+ /* Gain = 8.000000 dB */
+#define HPF_Fs44100_Gain8_A0 1.921414
+#define HPF_Fs44100_Gain8_A1 -1.140308
+#define HPF_Fs44100_Gain8_A2 0.000000
+#define HPF_Fs44100_Gain8_B1 -0.218894
+#define HPF_Fs44100_Gain8_B2 0.000000
+ /* Gain = 9.000000 dB */
+#define HPF_Fs44100_Gain9_A0 2.108208
+#define HPF_Fs44100_Gain9_A1 -1.327101
+#define HPF_Fs44100_Gain9_A2 0.000000
+#define HPF_Fs44100_Gain9_B1 -0.218894
+#define HPF_Fs44100_Gain9_B2 0.000000
+ /* Gain = 10.000000 dB */
+#define HPF_Fs44100_Gain10_A0 2.317793
+#define HPF_Fs44100_Gain10_A1 -1.536687
+#define HPF_Fs44100_Gain10_A2 0.000000
+#define HPF_Fs44100_Gain10_B1 -0.218894
+#define HPF_Fs44100_Gain10_B2 0.000000
+ /* Gain = 11.000000 dB */
+#define HPF_Fs44100_Gain11_A0 2.552952
+#define HPF_Fs44100_Gain11_A1 -1.771846
+#define HPF_Fs44100_Gain11_A2 0.000000
+#define HPF_Fs44100_Gain11_B1 -0.218894
+#define HPF_Fs44100_Gain11_B2 0.000000
+ /* Gain = 12.000000 dB */
+#define HPF_Fs44100_Gain12_A0 2.816805
+#define HPF_Fs44100_Gain12_A1 -2.035698
+#define HPF_Fs44100_Gain12_A2 0.000000
+#define HPF_Fs44100_Gain12_B1 -0.218894
+#define HPF_Fs44100_Gain12_B2 0.000000
+ /* Gain = 13.000000 dB */
+#define HPF_Fs44100_Gain13_A0 3.112852
+#define HPF_Fs44100_Gain13_A1 -2.331746
+#define HPF_Fs44100_Gain13_A2 0.000000
+#define HPF_Fs44100_Gain13_B1 -0.218894
+#define HPF_Fs44100_Gain13_B2 0.000000
+ /* Gain = 14.000000 dB */
+#define HPF_Fs44100_Gain14_A0 3.445023
+#define HPF_Fs44100_Gain14_A1 -2.663916
+#define HPF_Fs44100_Gain14_A2 0.000000
+#define HPF_Fs44100_Gain14_B1 -0.218894
+#define HPF_Fs44100_Gain14_B2 0.000000
+ /* Gain = 15.000000 dB */
+#define HPF_Fs44100_Gain15_A0 3.817724
+#define HPF_Fs44100_Gain15_A1 -3.036618
+#define HPF_Fs44100_Gain15_A2 0.000000
+#define HPF_Fs44100_Gain15_B1 -0.218894
+#define HPF_Fs44100_Gain15_B2 0.000000
+/* Coefficients for sample rate 48000Hz */
+ /* Gain = 1.000000 dB */
+#define HPF_Fs48000_Gain1_A0 1.077357
+#define HPF_Fs48000_Gain1_A1 -0.345306
+#define HPF_Fs48000_Gain1_A2 0.000000
+#define HPF_Fs48000_Gain1_B1 -0.267949
+#define HPF_Fs48000_Gain1_B2 0.000000
+ /* Gain = 2.000000 dB */
+#define HPF_Fs48000_Gain2_A0 1.164152
+#define HPF_Fs48000_Gain2_A1 -0.432101
+#define HPF_Fs48000_Gain2_A2 0.000000
+#define HPF_Fs48000_Gain2_B1 -0.267949
+#define HPF_Fs48000_Gain2_B2 0.000000
+ /* Gain = 3.000000 dB */
+#define HPF_Fs48000_Gain3_A0 1.261538
+#define HPF_Fs48000_Gain3_A1 -0.529488
+#define HPF_Fs48000_Gain3_A2 0.000000
+#define HPF_Fs48000_Gain3_B1 -0.267949
+#define HPF_Fs48000_Gain3_B2 0.000000
+ /* Gain = 4.000000 dB */
+#define HPF_Fs48000_Gain4_A0 1.370807
+#define HPF_Fs48000_Gain4_A1 -0.638757
+#define HPF_Fs48000_Gain4_A2 0.000000
+#define HPF_Fs48000_Gain4_B1 -0.267949
+#define HPF_Fs48000_Gain4_B2 0.000000
+ /* Gain = 5.000000 dB */
+#define HPF_Fs48000_Gain5_A0 1.493409
+#define HPF_Fs48000_Gain5_A1 -0.761359
+#define HPF_Fs48000_Gain5_A2 0.000000
+#define HPF_Fs48000_Gain5_B1 -0.267949
+#define HPF_Fs48000_Gain5_B2 0.000000
+ /* Gain = 6.000000 dB */
+#define HPF_Fs48000_Gain6_A0 1.630971
+#define HPF_Fs48000_Gain6_A1 -0.898920
+#define HPF_Fs48000_Gain6_A2 0.000000
+#define HPF_Fs48000_Gain6_B1 -0.267949
+#define HPF_Fs48000_Gain6_B2 0.000000
+ /* Gain = 7.000000 dB */
+#define HPF_Fs48000_Gain7_A0 1.785318
+#define HPF_Fs48000_Gain7_A1 -1.053267
+#define HPF_Fs48000_Gain7_A2 0.000000
+#define HPF_Fs48000_Gain7_B1 -0.267949
+#define HPF_Fs48000_Gain7_B2 0.000000
+ /* Gain = 8.000000 dB */
+#define HPF_Fs48000_Gain8_A0 1.958498
+#define HPF_Fs48000_Gain8_A1 -1.226447
+#define HPF_Fs48000_Gain8_A2 0.000000
+#define HPF_Fs48000_Gain8_B1 -0.267949
+#define HPF_Fs48000_Gain8_B2 0.000000
+ /* Gain = 9.000000 dB */
+#define HPF_Fs48000_Gain9_A0 2.152809
+#define HPF_Fs48000_Gain9_A1 -1.420758
+#define HPF_Fs48000_Gain9_A2 0.000000
+#define HPF_Fs48000_Gain9_B1 -0.267949
+#define HPF_Fs48000_Gain9_B2 0.000000
+ /* Gain = 10.000000 dB */
+#define HPF_Fs48000_Gain10_A0 2.370829
+#define HPF_Fs48000_Gain10_A1 -1.638778
+#define HPF_Fs48000_Gain10_A2 0.000000
+#define HPF_Fs48000_Gain10_B1 -0.267949
+#define HPF_Fs48000_Gain10_B2 0.000000
+ /* Gain = 11.000000 dB */
+#define HPF_Fs48000_Gain11_A0 2.615452
+#define HPF_Fs48000_Gain11_A1 -1.883401
+#define HPF_Fs48000_Gain11_A2 0.000000
+#define HPF_Fs48000_Gain11_B1 -0.267949
+#define HPF_Fs48000_Gain11_B2 0.000000
+ /* Gain = 12.000000 dB */
+#define HPF_Fs48000_Gain12_A0 2.889924
+#define HPF_Fs48000_Gain12_A1 -2.157873
+#define HPF_Fs48000_Gain12_A2 0.000000
+#define HPF_Fs48000_Gain12_B1 -0.267949
+#define HPF_Fs48000_Gain12_B2 0.000000
+ /* Gain = 13.000000 dB */
+#define HPF_Fs48000_Gain13_A0 3.197886
+#define HPF_Fs48000_Gain13_A1 -2.465835
+#define HPF_Fs48000_Gain13_A2 0.000000
+#define HPF_Fs48000_Gain13_B1 -0.267949
+#define HPF_Fs48000_Gain13_B2 0.000000
+ /* Gain = 14.000000 dB */
+#define HPF_Fs48000_Gain14_A0 3.543425
+#define HPF_Fs48000_Gain14_A1 -2.811374
+#define HPF_Fs48000_Gain14_A2 0.000000
+#define HPF_Fs48000_Gain14_B1 -0.267949
+#define HPF_Fs48000_Gain14_B2 0.000000
+ /* Gain = 15.000000 dB */
+#define HPF_Fs48000_Gain15_A0 3.931127
+#define HPF_Fs48000_Gain15_A1 -3.199076
+#define HPF_Fs48000_Gain15_A2 0.000000
+#define HPF_Fs48000_Gain15_B1 -0.267949
+#define HPF_Fs48000_Gain15_B2 0.000000
+#ifdef HIGHER_FS
+
+/* Coefficients for sample rate 96000Hz */
+ /* Gain = 1.000000 dB */
+#define HPF_Fs96000_Gain1_A0 1.096233
+#define HPF_Fs96000_Gain1_A1 -0.673583
+#define HPF_Fs96000_Gain1_A2 0.000000
+#define HPF_Fs96000_Gain1_B1 -0.577350
+#define HPF_Fs96000_Gain1_B2 0.000000
+ /* Gain = 2.000000 dB */
+#define HPF_Fs96000_Gain2_A0 1.204208
+#define HPF_Fs96000_Gain2_A1 -0.781558
+#define HPF_Fs96000_Gain2_A2 0.000000
+#define HPF_Fs96000_Gain2_B1 -0.577350
+#define HPF_Fs96000_Gain2_B2 0.000000
+ /* Gain = 3.000000 dB */
+#define HPF_Fs96000_Gain3_A0 1.325358
+#define HPF_Fs96000_Gain3_A1 -0.902708
+#define HPF_Fs96000_Gain3_A2 0.000000
+#define HPF_Fs96000_Gain3_B1 -0.577350
+#define HPF_Fs96000_Gain3_B2 0.000000
+ /* Gain = 4.000000 dB */
+#define HPF_Fs96000_Gain4_A0 1.461291
+#define HPF_Fs96000_Gain4_A1 -1.038641
+#define HPF_Fs96000_Gain4_A2 0.000000
+#define HPF_Fs96000_Gain4_B1 -0.577350
+#define HPF_Fs96000_Gain4_B2 0.000000
+ /* Gain = 5.000000 dB */
+#define HPF_Fs96000_Gain5_A0 1.613810
+#define HPF_Fs96000_Gain5_A1 -1.191160
+#define HPF_Fs96000_Gain5_A2 0.000000
+#define HPF_Fs96000_Gain5_B1 -0.577350
+#define HPF_Fs96000_Gain5_B2 0.000000
+ /* Gain = 6.000000 dB */
+#define HPF_Fs96000_Gain6_A0 1.784939
+#define HPF_Fs96000_Gain6_A1 -1.362289
+#define HPF_Fs96000_Gain6_A2 0.000000
+#define HPF_Fs96000_Gain6_B1 -0.577350
+#define HPF_Fs96000_Gain6_B2 0.000000
+ /* Gain = 7.000000 dB */
+#define HPF_Fs96000_Gain7_A0 1.976949
+#define HPF_Fs96000_Gain7_A1 -1.554299
+#define HPF_Fs96000_Gain7_A2 0.000000
+#define HPF_Fs96000_Gain7_B1 -0.577350
+#define HPF_Fs96000_Gain7_B2 0.000000
+ /* Gain = 8.000000 dB */
+#define HPF_Fs96000_Gain8_A0 2.192387
+#define HPF_Fs96000_Gain8_A1 -1.769738
+#define HPF_Fs96000_Gain8_A2 0.000000
+#define HPF_Fs96000_Gain8_B1 -0.577350
+#define HPF_Fs96000_Gain8_B2 0.000000
+ /* Gain = 9.000000 dB */
+#define HPF_Fs96000_Gain9_A0 2.434113
+#define HPF_Fs96000_Gain9_A1 -2.011464
+#define HPF_Fs96000_Gain9_A2 0.000000
+#define HPF_Fs96000_Gain9_B1 -0.577350
+#define HPF_Fs96000_Gain9_B2 0.000000
+ /* Gain = 10.000000 dB */
+#define HPF_Fs96000_Gain10_A0 2.705335
+#define HPF_Fs96000_Gain10_A1 -2.282685
+#define HPF_Fs96000_Gain10_A2 0.000000
+#define HPF_Fs96000_Gain10_B1 -0.577350
+#define HPF_Fs96000_Gain10_B2 0.000000
+ /* Gain = 11.000000 dB */
+#define HPF_Fs96000_Gain11_A0 3.009650
+#define HPF_Fs96000_Gain11_A1 -2.587000
+#define HPF_Fs96000_Gain11_A2 0.000000
+#define HPF_Fs96000_Gain11_B1 -0.577350
+#define HPF_Fs96000_Gain11_B2 0.000000
+ /* Gain = 12.000000 dB */
+#define HPF_Fs96000_Gain12_A0 3.351097
+#define HPF_Fs96000_Gain12_A1 -2.928447
+#define HPF_Fs96000_Gain12_A2 0.000000
+#define HPF_Fs96000_Gain12_B1 -0.577350
+#define HPF_Fs96000_Gain12_B2 0.000000
+ /* Gain = 13.000000 dB */
+#define HPF_Fs96000_Gain13_A0 3.734207
+#define HPF_Fs96000_Gain13_A1 -3.311558
+#define HPF_Fs96000_Gain13_A2 0.000000
+#define HPF_Fs96000_Gain13_B1 -0.577350
+#define HPF_Fs96000_Gain13_B2 0.000000
+ /* Gain = 14.000000 dB */
+#define HPF_Fs96000_Gain14_A0 4.164064
+#define HPF_Fs96000_Gain14_A1 -3.741414
+#define HPF_Fs96000_Gain14_A2 0.000000
+#define HPF_Fs96000_Gain14_B1 -0.577350
+#define HPF_Fs96000_Gain14_B2 0.000000
+ /* Gain = 15.000000 dB */
+#define HPF_Fs96000_Gain15_A0 4.646371
+#define HPF_Fs96000_Gain15_A1 -4.223721
+#define HPF_Fs96000_Gain15_A2 0.000000
+#define HPF_Fs96000_Gain15_B1 -0.577350
+#define HPF_Fs96000_Gain15_B2 0.000000
+
+/* Coefficients for sample rate 192000Hz */
+ /* Gain = 1.000000 dB */
+#define HPF_Fs192000_Gain1_A0 1.107823
+#define HPF_Fs192000_Gain1_A1 -0.875150
+#define HPF_Fs192000_Gain1_A2 0.000000
+#define HPF_Fs192000_Gain1_B1 -0.767327
+#define HPF_Fs192000_Gain1_B2 0.000000
+ /* Gain = 2.000000 dB */
+#define HPF_Fs192000_Gain2_A0 1.228803
+#define HPF_Fs192000_Gain2_A1 -0.996130
+#define HPF_Fs192000_Gain2_A2 0.000000
+#define HPF_Fs192000_Gain2_B1 -0.767327
+#define HPF_Fs192000_Gain2_B2 0.000000
+ /* Gain = 3.000000 dB */
+#define HPF_Fs192000_Gain3_A0 1.364544
+#define HPF_Fs192000_Gain3_A1 -1.131871
+#define HPF_Fs192000_Gain3_A2 0.000000
+#define HPF_Fs192000_Gain3_B1 -0.767327
+#define HPF_Fs192000_Gain3_B2 0.000000
+ /* Gain = 4.000000 dB */
+#define HPF_Fs192000_Gain4_A0 1.516849
+#define HPF_Fs192000_Gain4_A1 -1.284176
+#define HPF_Fs192000_Gain4_A2 0.000000
+#define HPF_Fs192000_Gain4_B1 -0.767327
+#define HPF_Fs192000_Gain4_B2 0.000000
+ /* Gain = 5.000000 dB */
+#define HPF_Fs192000_Gain5_A0 1.687737
+#define HPF_Fs192000_Gain5_A1 -1.455064
+#define HPF_Fs192000_Gain5_A2 0.000000
+#define HPF_Fs192000_Gain5_B1 -0.767327
+#define HPF_Fs192000_Gain5_B2 0.000000
+ /* Gain = 6.000000 dB */
+#define HPF_Fs192000_Gain6_A0 1.879477
+#define HPF_Fs192000_Gain6_A1 -1.646804
+#define HPF_Fs192000_Gain6_A2 0.000000
+#define HPF_Fs192000_Gain6_B1 -0.767327
+#define HPF_Fs192000_Gain6_B2 0.000000
+ /* Gain = 7.000000 dB */
+#define HPF_Fs192000_Gain7_A0 2.094613
+#define HPF_Fs192000_Gain7_A1 -1.861940
+#define HPF_Fs192000_Gain7_A2 0.000000
+#define HPF_Fs192000_Gain7_B1 -0.767327
+#define HPF_Fs192000_Gain7_B2 0.000000
+ /* Gain = 8.000000 dB */
+#define HPF_Fs192000_Gain8_A0 2.335999
+#define HPF_Fs192000_Gain8_A1 -2.103326
+#define HPF_Fs192000_Gain8_A2 0.000000
+#define HPF_Fs192000_Gain8_B1 -0.767327
+#define HPF_Fs192000_Gain8_B2 0.000000
+ /* Gain = 9.000000 dB */
+#define HPF_Fs192000_Gain9_A0 2.606839
+#define HPF_Fs192000_Gain9_A1 -2.374166
+#define HPF_Fs192000_Gain9_A2 0.000000
+#define HPF_Fs192000_Gain9_B1 -0.767327
+#define HPF_Fs192000_Gain9_B2 0.000000
+ /* Gain = 10.000000 dB */
+#define HPF_Fs192000_Gain10_A0 2.910726
+#define HPF_Fs192000_Gain10_A1 -2.678053
+#define HPF_Fs192000_Gain10_A2 0.000000
+#define HPF_Fs192000_Gain10_B1 -0.767327
+#define HPF_Fs192000_Gain10_B2 0.000000
+ /* Gain = 11.000000 dB */
+#define HPF_Fs192000_Gain11_A0 3.251693
+#define HPF_Fs192000_Gain11_A1 -3.019020
+#define HPF_Fs192000_Gain11_A2 0.000000
+#define HPF_Fs192000_Gain11_B1 -0.767327
+#define HPF_Fs192000_Gain11_B2 0.000000
+ /* Gain = 12.000000 dB */
+#define HPF_Fs192000_Gain12_A0 3.634264
+#define HPF_Fs192000_Gain12_A1 -3.401591
+#define HPF_Fs192000_Gain12_A2 0.000000
+#define HPF_Fs192000_Gain12_B1 -0.767327
+#define HPF_Fs192000_Gain12_B2 0.000000
+ /* Gain = 13.000000 dB */
+#define HPF_Fs192000_Gain13_A0 4.063516
+#define HPF_Fs192000_Gain13_A1 -3.830843
+#define HPF_Fs192000_Gain13_A2 0.000000
+#define HPF_Fs192000_Gain13_B1 -0.767327
+#define HPF_Fs192000_Gain13_B2 0.000000
+ /* Gain = 14.000000 dB */
+#define HPF_Fs192000_Gain14_A0 4.545145
+#define HPF_Fs192000_Gain14_A1 -4.312472
+#define HPF_Fs192000_Gain14_A2 0.000000
+#define HPF_Fs192000_Gain14_B1 -0.767327
+#define HPF_Fs192000_Gain14_B2 0.000000
+ /* Gain = 15.000000 dB */
+#define HPF_Fs192000_Gain15_A0 5.085542
+#define HPF_Fs192000_Gain15_A1 -4.852868
+#define HPF_Fs192000_Gain15_A2 0.000000
+#define HPF_Fs192000_Gain15_B1 -0.767327
+#define HPF_Fs192000_Gain15_B2 0.000000
+
+#endif
+
+#else
/* Coefficients for sample rate 22050Hz */
/* Gain = 1.000000 dB */
#define HPF_Fs22050_Gain1_A0 5383 /* Floating point value 0.164291 */
@@ -571,3 +1216,4 @@
#endif
+#endif
\ No newline at end of file
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Control.c b/media/libeffects/lvm/lib/Bundle/src/LVM_Control.c
index 72564d4..cfe53b8 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Control.c
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Control.c
@@ -65,9 +65,16 @@
if(
/* General parameters */
((pParams->OperatingMode != LVM_MODE_OFF) && (pParams->OperatingMode != LVM_MODE_ON)) ||
+#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
+ ((pParams->SampleRate != LVM_FS_8000) && (pParams->SampleRate != LVM_FS_11025) && (pParams->SampleRate != LVM_FS_12000) &&
+ (pParams->SampleRate != LVM_FS_16000) && (pParams->SampleRate != LVM_FS_22050) && (pParams->SampleRate != LVM_FS_24000) &&
+ (pParams->SampleRate != LVM_FS_32000) && (pParams->SampleRate != LVM_FS_44100) && (pParams->SampleRate != LVM_FS_48000) &&
+ (pParams->SampleRate != LVM_FS_96000) && (pParams->SampleRate != LVM_FS_192000)) ||
+#else
((pParams->SampleRate != LVM_FS_8000) && (pParams->SampleRate != LVM_FS_11025) && (pParams->SampleRate != LVM_FS_12000) &&
(pParams->SampleRate != LVM_FS_16000) && (pParams->SampleRate != LVM_FS_22050) && (pParams->SampleRate != LVM_FS_24000) &&
(pParams->SampleRate != LVM_FS_32000) && (pParams->SampleRate != LVM_FS_44100) && (pParams->SampleRate != LVM_FS_48000)) ||
+#endif
((pParams->SourceFormat != LVM_STEREO) && (pParams->SourceFormat != LVM_MONOINSTEREO) && (pParams->SourceFormat != LVM_MONO)) ||
(pParams->SpeakerType > LVM_EX_HEADPHONES))
{
@@ -268,7 +275,12 @@
void LVM_SetTrebleBoost(LVM_Instance_t *pInstance,
LVM_ControlParams_t *pParams)
{
+#ifdef BUILD_FLOAT
+ extern FO_FLOAT_LShx_Coefs_t LVM_TrebleBoostCoefs[];
+#else
extern FO_C16_LShx_Coefs_t LVM_TrebleBoostCoefs[];
+#endif
+
LVM_INT16 Offset;
LVM_INT16 EffectLevel = 0;
@@ -298,6 +310,20 @@
* Load the coefficients and enabled the treble boost
*/
Offset = (LVM_INT16)(EffectLevel - 1 + TrebleBoostSteps * (pParams->SampleRate - TrebleBoostMinRate));
+#ifdef BUILD_FLOAT
+ FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(&pInstance->pTE_State->TrebleBoost_State,
+ &pInstance->pTE_Taps->TrebleBoost_Taps,
+ &LVM_TrebleBoostCoefs[Offset]);
+
+ /*
+ * Clear the taps
+ */
+ LoadConst_Float((LVM_FLOAT)0, /* Value */
+ (void *)&pInstance->pTE_Taps->TrebleBoost_Taps, /* Destination.\
+ Cast to void: no dereferencing in function */
+ (LVM_UINT16)(sizeof(pInstance->pTE_Taps->TrebleBoost_Taps) / \
+ sizeof(LVM_FLOAT))); /* Number of words */
+#else
FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(&pInstance->pTE_State->TrebleBoost_State,
&pInstance->pTE_Taps->TrebleBoost_Taps,
&LVM_TrebleBoostCoefs[Offset]);
@@ -309,6 +335,7 @@
(void *)&pInstance->pTE_Taps->TrebleBoost_Taps, /* Destination.\
Cast to void: no dereferencing in function */
(LVM_UINT16)(sizeof(pInstance->pTE_Taps->TrebleBoost_Taps)/sizeof(LVM_INT16))); /* Number of words */
+#endif
}
}
else
@@ -342,6 +369,9 @@
LVM_UINT16 dBShifts; /* 6dB shifts */
LVM_UINT16 dBOffset; /* Table offset */
LVM_INT16 Volume = 0; /* Required volume in dBs */
+#ifdef BUILD_FLOAT
+ LVM_FLOAT Temp;
+#endif
/*
* Limit the gain to the maximum allowed
@@ -401,22 +431,46 @@
*/
if(dBShifts == 0)
{
+#ifdef BUILD_FLOAT
+ LVC_Mixer_SetTarget(&pInstance->VC_Volume.MixerStream[0],
+ (LVM_FLOAT)LVM_VolumeTable[dBOffset]);
+#else
LVC_Mixer_SetTarget(&pInstance->VC_Volume.MixerStream[0],
(LVM_INT32)LVM_VolumeTable[dBOffset]);
- }
+#endif
+ }
else
{
+#ifdef BUILD_FLOAT
+ Temp = LVM_VolumeTable[dBOffset];
+ while(dBShifts) {
+ Temp = Temp / 2.0f;
+ dBShifts--;
+ }
+ LVC_Mixer_SetTarget(&pInstance->VC_Volume.MixerStream[0], Temp);
+#else
LVC_Mixer_SetTarget(&pInstance->VC_Volume.MixerStream[0],
(((LVM_INT32)LVM_VolumeTable[dBOffset])>>dBShifts));
+#endif
}
pInstance->VC_Volume.MixerStream[0].CallbackSet = 1;
if(pInstance->NoSmoothVolume == LVM_TRUE)
{
+#ifdef BUILD_FLOAT
+ LVC_Mixer_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0], 0,
+ pInstance->Params.SampleRate, 2);
+#else
LVC_Mixer_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0],0,pInstance->Params.SampleRate,2);
+#endif
}
else
{
+#ifdef BUILD_FLOAT
+ LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0],
+ LVM_VC_MIXER_TIME, pInstance->Params.SampleRate, 2);
+#else
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0],LVM_VC_MIXER_TIME,pInstance->Params.SampleRate,2);
+#endif
}
}
@@ -554,8 +608,23 @@
/* Configure Mixer module for gradual changes to volume*/
if(LocalParams.VC_Balance < 0)
{
+#ifdef BUILD_FLOAT
+ LVM_FLOAT Target_Float;
+#else
LVM_INT32 Target;
+#endif
/* Drop in right channel volume*/
+#ifdef BUILD_FLOAT
+ Target_Float = LVM_MAXFLOAT;
+ LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[0], Target_Float);
+ LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],
+ LVM_VC_MIXER_TIME, LocalParams.SampleRate, 1);
+
+ Target_Float = dB_to_LinFloat((LVM_INT16)(LocalParams.VC_Balance << 4));
+ LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[1], Target_Float);
+ LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],
+ LVM_VC_MIXER_TIME, LocalParams.SampleRate, 1);
+#else
Target = LVM_MAXINT_16;
LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[0],Target);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],LVM_VC_MIXER_TIME,LocalParams.SampleRate,1);
@@ -563,11 +632,27 @@
Target = dB_to_Lin32((LVM_INT16)(LocalParams.VC_Balance<<4));
LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[1],Target);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],LVM_VC_MIXER_TIME,LocalParams.SampleRate,1);
+#endif
}
else if(LocalParams.VC_Balance >0)
{
+#ifdef BUILD_FLOAT
+ LVM_FLOAT Target_Float;
+#else
LVM_INT32 Target;
+#endif
/* Drop in left channel volume*/
+#ifdef BUILD_FLOAT
+ Target_Float = dB_to_LinFloat((LVM_INT16)((-LocalParams.VC_Balance) << 4));
+ LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[0], Target_Float);
+ LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],
+ LVM_VC_MIXER_TIME, LocalParams.SampleRate, 1);
+
+ Target_Float = LVM_MAXFLOAT;
+ LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[1], Target_Float);
+ LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],
+ LVM_VC_MIXER_TIME, LocalParams.SampleRate, 1);
+#else
Target = dB_to_Lin32((LVM_INT16)((-LocalParams.VC_Balance)<<4));
LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[0],Target);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],LVM_VC_MIXER_TIME,LocalParams.SampleRate,1);
@@ -575,17 +660,36 @@
Target = LVM_MAXINT_16;
LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[1],Target);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],LVM_VC_MIXER_TIME,LocalParams.SampleRate,1);
+#endif
}
else
{
+#ifdef BUILD_FLOAT
+ LVM_FLOAT Target_Float;
+#else
LVM_INT32 Target;
+#endif
/* No drop*/
+#ifdef BUILD_FLOAT
+ Target_Float = LVM_MAXFLOAT;
+#else
Target = LVM_MAXINT_16;
+#endif
+#ifdef BUILD_FLOAT
+ LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[0],Target_Float);
+ LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],
+ LVM_VC_MIXER_TIME,LocalParams.SampleRate, 1);
+
+ LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[1],Target_Float);
+ LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],
+ LVM_VC_MIXER_TIME,LocalParams.SampleRate, 1);
+#else
LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[0],Target);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],LVM_VC_MIXER_TIME,LocalParams.SampleRate,1);
LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[1],Target);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],LVM_VC_MIXER_TIME,LocalParams.SampleRate,1);
+#endif
}
}
/*
@@ -1008,18 +1112,30 @@
short CallBackParam)
{
LVM_Instance_t *pInstance =(LVM_Instance_t *)pBundleHandle;
+#ifdef BUILD_FLOAT
+ LVM_FLOAT Target;
+#else
LVM_INT32 Target;
+#endif
(void) pGeneralPurpose;
(void) CallBackParam;
/* When volume mixer has reached 0 dB target then stop it to avoid
unnecessary processing. */
+#ifdef BUILD_FLOAT
+ Target = LVC_Mixer_GetTarget(&pInstance->VC_Volume.MixerStream[0]);
+ if(Target == 1.0f)
+ {
+ pInstance->VC_Active = LVM_FALSE;
+ }
+#else
Target = LVC_Mixer_GetTarget(&pInstance->VC_Volume.MixerStream[0]);
if(Target == 0x7FFF)
{
pInstance->VC_Active = LVM_FALSE;
}
+#endif
return 1;
}
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Init.c b/media/libeffects/lvm/lib/Bundle/src/LVM_Init.c
index 542c3c8..26c1c4f 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Init.c
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Init.c
@@ -232,7 +232,11 @@
/*
* Set the capabilities
*/
+#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
+ DBE_Capabilities.SampleRate = LVDBE_CAP_FS_8000 | LVDBE_CAP_FS_11025 | LVDBE_CAP_FS_12000 | LVDBE_CAP_FS_16000 | LVDBE_CAP_FS_22050 | LVDBE_CAP_FS_24000 | LVDBE_CAP_FS_32000 | LVDBE_CAP_FS_44100 | LVDBE_CAP_FS_48000 | LVDBE_CAP_FS_96000 | LVDBE_CAP_FS_192000;
+#else
DBE_Capabilities.SampleRate = LVDBE_CAP_FS_8000 | LVDBE_CAP_FS_11025 | LVDBE_CAP_FS_12000 | LVDBE_CAP_FS_16000 | LVDBE_CAP_FS_22050 | LVDBE_CAP_FS_24000 | LVDBE_CAP_FS_32000 | LVDBE_CAP_FS_44100 | LVDBE_CAP_FS_48000;
+#endif
DBE_Capabilities.CentreFrequency = LVDBE_CAP_CENTRE_55Hz | LVDBE_CAP_CENTRE_55Hz | LVDBE_CAP_CENTRE_66Hz | LVDBE_CAP_CENTRE_78Hz | LVDBE_CAP_CENTRE_90Hz;
DBE_Capabilities.MaxBlockSize = InternalBlockSize;
@@ -265,7 +269,11 @@
/*
* Set the capabilities
*/
+#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
+ EQNB_Capabilities.SampleRate = LVEQNB_CAP_FS_8000 | LVEQNB_CAP_FS_11025 | LVEQNB_CAP_FS_12000 | LVEQNB_CAP_FS_16000 | LVEQNB_CAP_FS_22050 | LVEQNB_CAP_FS_24000 | LVEQNB_CAP_FS_32000 | LVEQNB_CAP_FS_44100 | LVEQNB_CAP_FS_48000 | LVEQNB_CAP_FS_96000 | LVEQNB_CAP_FS_192000;
+#else
EQNB_Capabilities.SampleRate = LVEQNB_CAP_FS_8000 | LVEQNB_CAP_FS_11025 | LVEQNB_CAP_FS_12000 | LVEQNB_CAP_FS_16000 | LVEQNB_CAP_FS_22050 | LVEQNB_CAP_FS_24000 | LVEQNB_CAP_FS_32000 | LVEQNB_CAP_FS_44100 | LVEQNB_CAP_FS_48000;
+#endif
EQNB_Capabilities.SourceFormat = LVEQNB_CAP_STEREO | LVEQNB_CAP_MONOINSTEREO;
EQNB_Capabilities.MaxBlockSize = InternalBlockSize;
EQNB_Capabilities.MaxBands = pInstParams->EQNB_NumBands;
@@ -542,10 +550,15 @@
BundleScratchSize = (LVM_INT32)(6 * (MIN_INTERNAL_BLOCKSIZE + InternalBlockSize) * sizeof(LVM_INT16));
pInstance->pBufferManagement->pScratch = InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_TEMPORARY_FAST], /* Scratch 1 buffer */
(LVM_UINT32)BundleScratchSize);
-
+#ifdef BUILD_FLOAT
+ LoadConst_Float(0, /* Clear the input delay buffer */
+ (LVM_FLOAT *)&pInstance->pBufferManagement->InDelayBuffer,
+ (LVM_INT16)(2 * MIN_INTERNAL_BLOCKSIZE));
+#else
LoadConst_16(0, /* Clear the input delay buffer */
(LVM_INT16 *)&pInstance->pBufferManagement->InDelayBuffer,
(LVM_INT16)(2 * MIN_INTERNAL_BLOCKSIZE));
+#endif
pInstance->pBufferManagement->InDelaySamples = MIN_INTERNAL_BLOCKSIZE; /* Set the number of delay samples */
pInstance->pBufferManagement->OutDelaySamples = 0; /* No samples in the output buffer */
pInstance->pBufferManagement->BufferState = LVM_FIRSTCALL; /* Set the state ready for the first call */
@@ -598,14 +611,26 @@
/* In managed buffering, start with low signal level as delay in buffer management causes a click*/
if (pInstParams->BufferMode == LVM_MANAGED_BUFFERS)
{
+#ifdef BUILD_FLOAT
+ LVC_Mixer_Init(&pInstance->VC_Volume.MixerStream[0], 0, 0);
+#else
LVC_Mixer_Init(&pInstance->VC_Volume.MixerStream[0],0,0);
+#endif
}
else
{
+#ifdef BUILD_FLOAT
+ LVC_Mixer_Init(&pInstance->VC_Volume.MixerStream[0], LVM_MAXFLOAT, LVM_MAXFLOAT);
+#else
LVC_Mixer_Init(&pInstance->VC_Volume.MixerStream[0],LVM_MAXINT_16,LVM_MAXINT_16);
+#endif
}
+#ifdef BUILD_FLOAT
LVC_Mixer_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0],0,LVM_FS_8000,2);
+#else
+ LVC_Mixer_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0], 0, LVM_FS_8000, 2);
+#endif
pInstance->VC_VolumedB = 0;
pInstance->VC_AVLFixedVolume = 0;
@@ -615,15 +640,24 @@
pInstance->VC_BalanceMix.MixerStream[0].CallbackSet = 0;
pInstance->VC_BalanceMix.MixerStream[0].pCallbackHandle = pInstance;
pInstance->VC_BalanceMix.MixerStream[0].pCallBack = LVM_VCCallBack;
+#ifdef BUILD_FLOAT
+ LVC_Mixer_Init(&pInstance->VC_BalanceMix.MixerStream[0], LVM_MAXFLOAT, LVM_MAXFLOAT);
+#else
LVC_Mixer_Init(&pInstance->VC_BalanceMix.MixerStream[0],LVM_MAXINT_16,LVM_MAXINT_16);
+#endif
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],LVM_VC_MIXER_TIME,LVM_FS_8000,2);
pInstance->VC_BalanceMix.MixerStream[1].CallbackParam = 0;
pInstance->VC_BalanceMix.MixerStream[1].CallbackSet = 0;
pInstance->VC_BalanceMix.MixerStream[1].pCallbackHandle = pInstance;
pInstance->VC_BalanceMix.MixerStream[1].pCallBack = LVM_VCCallBack;
+#ifdef BUILD_FLOAT
+ LVC_Mixer_Init(&pInstance->VC_BalanceMix.MixerStream[1], LVM_MAXFLOAT, LVM_MAXFLOAT);
+#else
LVC_Mixer_Init(&pInstance->VC_BalanceMix.MixerStream[1],LVM_MAXINT_16,LVM_MAXINT_16);
+#endif
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],LVM_VC_MIXER_TIME,LVM_FS_8000,2);
+
/*
* Set the default EQNB pre-gain and pointer to the band definitions
*/
@@ -709,7 +743,11 @@
/*
* Set the initialisation capabilities
*/
+#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
+ DBE_Capabilities.SampleRate = LVDBE_CAP_FS_8000 | LVDBE_CAP_FS_11025 | LVDBE_CAP_FS_12000 | LVDBE_CAP_FS_16000 | LVDBE_CAP_FS_22050 | LVDBE_CAP_FS_24000 | LVDBE_CAP_FS_32000 | LVDBE_CAP_FS_44100 | LVDBE_CAP_FS_48000 | LVDBE_CAP_FS_96000 | LVDBE_CAP_FS_192000;
+#else
DBE_Capabilities.SampleRate = LVDBE_CAP_FS_8000 | LVDBE_CAP_FS_11025 | LVDBE_CAP_FS_12000 | LVDBE_CAP_FS_16000 | LVDBE_CAP_FS_22050 | LVDBE_CAP_FS_24000 | LVDBE_CAP_FS_32000 | LVDBE_CAP_FS_44100 | LVDBE_CAP_FS_48000;
+#endif
DBE_Capabilities.CentreFrequency = LVDBE_CAP_CENTRE_55Hz | LVDBE_CAP_CENTRE_55Hz | LVDBE_CAP_CENTRE_66Hz | LVDBE_CAP_CENTRE_78Hz | LVDBE_CAP_CENTRE_90Hz;
DBE_Capabilities.MaxBlockSize = (LVM_UINT16)InternalBlockSize;
@@ -763,7 +801,11 @@
/*
* Set the initialisation capabilities
*/
+#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
+ EQNB_Capabilities.SampleRate = LVEQNB_CAP_FS_8000 | LVEQNB_CAP_FS_11025 | LVEQNB_CAP_FS_12000 | LVEQNB_CAP_FS_16000 | LVEQNB_CAP_FS_22050 | LVEQNB_CAP_FS_24000 | LVEQNB_CAP_FS_32000 | LVEQNB_CAP_FS_44100 | LVEQNB_CAP_FS_48000 | LVEQNB_CAP_FS_96000 | LVEQNB_CAP_FS_192000;
+#else
EQNB_Capabilities.SampleRate = LVEQNB_CAP_FS_8000 | LVEQNB_CAP_FS_11025 | LVEQNB_CAP_FS_12000 | LVEQNB_CAP_FS_16000 | LVEQNB_CAP_FS_22050 | LVEQNB_CAP_FS_24000 | LVEQNB_CAP_FS_32000 | LVEQNB_CAP_FS_44100 | LVEQNB_CAP_FS_48000;
+#endif
EQNB_Capabilities.MaxBlockSize = (LVM_UINT16)InternalBlockSize;
EQNB_Capabilities.MaxBands = pInstParams->EQNB_NumBands;
EQNB_Capabilities.SourceFormat = LVEQNB_CAP_STEREO | LVEQNB_CAP_MONOINSTEREO;
@@ -868,9 +910,14 @@
PSA_MemTab.Region[LVM_PERSISTENT_FAST_COEF].Size);
/* Fast Temporary */
+#ifdef BUILD_FLOAT
pInstance->pPSAInput = InstAlloc_AddMember(&AllocMem[LVM_TEMPORARY_FAST],
- (LVM_UINT32) MAX_INTERNAL_BLOCKSIZE * sizeof(LVM_INT16));
-
+ (LVM_UINT32) MAX_INTERNAL_BLOCKSIZE * \
+ sizeof(LVM_FLOAT));
+#else
+ pInstance->pPSAInput = InstAlloc_AddMember(&AllocMem[LVM_TEMPORARY_FAST],
+ (LVM_UINT32) MAX_INTERNAL_BLOCKSIZE * sizeof(LVM_INT16));
+#endif
PSA_MemTab.Region[LVM_TEMPORARY_FAST].pBaseAddress = (void *)InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_TEMPORARY_FAST],0);
@@ -994,7 +1041,6 @@
/* DC removal filter */
DC_2I_D16_TRC_WRA_01_Init(&pInstance->DC_RemovalInstance);
-
return LVM_SUCCESS;
}
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h b/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
index 2e85f77..b453222 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
@@ -138,6 +138,23 @@
/* Buffer Management */
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ LVM_FLOAT *pScratch; /* Bundle scratch buffer */
+
+ LVM_INT16 BufferState; /* Buffer status */
+ LVM_FLOAT InDelayBuffer[6 * MIN_INTERNAL_BLOCKSIZE]; /* Input buffer delay line, \
+ left and right */
+ LVM_INT16 InDelaySamples; /* Number of samples in the input delay buffer */
+
+ LVM_FLOAT OutDelayBuffer[2 * MIN_INTERNAL_BLOCKSIZE]; /* Output buffer delay \
+ line */
+ LVM_INT16 OutDelaySamples; /* Number of samples in the output delay buffer, \
+ left and right */
+ LVM_INT16 SamplesToOutput; /* Samples to write to the output */
+} LVM_Buffer_t;
+#else
typedef struct
{
LVM_INT16 *pScratch; /* Bundle scratch buffer */
@@ -150,22 +167,28 @@
LVM_INT16 OutDelaySamples; /* Number of samples in the output delay buffer, left and right */
LVM_INT16 SamplesToOutput; /* Samples to write to the output */
} LVM_Buffer_t;
-
+#endif
/* Filter taps */
typedef struct
{
+#ifdef BUILD_FLOAT
+ Biquad_2I_Order1_FLOAT_Taps_t TrebleBoost_Taps; /* Treble boost Taps */
+#else
Biquad_2I_Order1_Taps_t TrebleBoost_Taps; /* Treble boost Taps */
+#endif
} LVM_TE_Data_t;
-
/* Coefficients */
typedef struct
{
+#ifdef BUILD_FLOAT
+ Biquad_FLOAT_Instance_t TrebleBoost_State; /* State for the treble boost filter */
+#else
Biquad_Instance_t TrebleBoost_State; /* State for the treble boost filter */
+#endif
} LVM_TE_Coefs_t;
-
typedef struct
{
/* Public parameters */
@@ -181,15 +204,24 @@
LVM_INT16 InternalBlockSize; /* Maximum internal block size */
LVM_Buffer_t *pBufferManagement; /* Buffer management variables */
LVM_INT16 SamplesToProcess; /* Input samples left to process */
+#ifdef BUILD_FLOAT
+ LVM_FLOAT *pInputSamples; /* External input sample pointer */
+ LVM_FLOAT *pOutputSamples; /* External output sample pointer */
+#else
LVM_INT16 *pInputSamples; /* External input sample pointer */
LVM_INT16 *pOutputSamples; /* External output sample pointer */
+#endif
/* Configuration number */
LVM_INT32 ConfigurationNumber;
LVM_INT32 BlickSizeMultiple;
/* DC removal */
+#ifdef BUILD_FLOAT
+ Biquad_FLOAT_Instance_t DC_RemovalInstance; /* DC removal filter instance */
+#else
Biquad_Instance_t DC_RemovalInstance; /* DC removal filter instance */
+#endif
/* Concert Sound */
LVCS_Handle_t hCSInstance; /* Concert Sound instance handle */
@@ -209,8 +241,16 @@
LVM_INT16 DBE_Active; /* Control flag */
/* Volume Control */
+#ifdef BUILD_FLOAT
+ LVMixer3_1St_FLOAT_st VC_Volume; /* Volume scaler */
+#else
LVMixer3_1St_st VC_Volume; /* Volume scaler */
+#endif
+#ifdef BUILD_FLOAT
+ LVMixer3_2St_FLOAT_st VC_BalanceMix; /* VC balance mixer */
+#else
LVMixer3_2St_st VC_BalanceMix; /* VC balance mixer */
+#endif
LVM_INT16 VC_VolumedB; /* Gain in dB */
LVM_INT16 VC_Active; /* Control flag */
LVM_INT16 VC_AVLFixedVolume; /* AVL fixed volume */
@@ -234,7 +274,11 @@
LVPSA_ControlParams_t PSA_ControlParams; /* Spectrum Analyzer control parameters */
LVM_INT16 PSA_GainOffset; /* Tone control flag */
LVM_Callback CallBack;
+#ifdef BUILD_FLOAT
+ LVM_FLOAT *pPSAInput; /* PSA input pointer */
+#else
LVM_INT16 *pPSAInput; /* PSA input pointer */
+#endif
LVM_INT16 NoSmoothVolume; /* Enable or disable smooth volume changes*/
@@ -261,16 +305,28 @@
void LVM_SetHeadroom( LVM_Instance_t *pInstance,
LVM_ControlParams_t *pParams);
-
+#ifdef BUILD_FLOAT
+void LVM_BufferIn( LVM_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT **pToProcess,
+ LVM_FLOAT **pProcessed,
+ LVM_UINT16 *pNumSamples);
+#else
void LVM_BufferIn( LVM_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 **pToProcess,
LVM_INT16 **pProcessed,
LVM_UINT16 *pNumSamples);
-
+#endif
+#ifdef BUILD_FLOAT
+void LVM_BufferOut( LVM_Handle_t hInstance,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 *pNumSamples);
+#else
void LVM_BufferOut( LVM_Handle_t hInstance,
LVM_INT16 *pOutData,
LVM_UINT16 *pNumSamples);
+#endif
LVM_INT32 LVM_AlgoCallBack( void *pBundleHandle,
void *pData,
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c b/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c
index f5a01f3..4a19a13 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c
@@ -51,7 +51,231 @@
/* NOTES: */
/* */
/****************************************************************************************/
+#ifdef BUILD_FLOAT
+LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 NumSamples,
+ LVM_UINT32 AudioTime)
+{
+ LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
+ LVM_UINT16 SampleCount = NumSamples;
+ LVM_FLOAT *pInput = (LVM_FLOAT *)pInData;
+ LVM_FLOAT *pToProcess = (LVM_FLOAT *)pInData;
+ LVM_FLOAT *pProcessed = pOutData;
+ LVM_ReturnStatus_en Status;
+
+ /*
+ * Check if the number of samples is zero
+ */
+ if (NumSamples == 0)
+ {
+ return(LVM_SUCCESS);
+ }
+
+
+ /*
+ * Check valid points have been given
+ */
+ if ((hInstance == LVM_NULL) || (pInData == LVM_NULL) || (pOutData == LVM_NULL))
+ {
+ return (LVM_NULLADDRESS);
+ }
+
+ /*
+ * For unmanaged mode only
+ */
+ if(pInstance->InstParams.BufferMode == LVM_UNMANAGED_BUFFERS)
+ {
+ /*
+ * Check if the number of samples is a good multiple (unmanaged mode only)
+ */
+ if((NumSamples % pInstance->BlickSizeMultiple) != 0)
+ {
+ return(LVM_INVALIDNUMSAMPLES);
+ }
+
+ /*
+ * Check the buffer alignment
+ */
+ if((((uintptr_t)pInData % 4) != 0) || (((uintptr_t)pOutData % 4) != 0))
+ {
+ return(LVM_ALIGNMENTERROR);
+ }
+ }
+
+
+ /*
+ * Update new parameters if necessary
+ */
+ if (pInstance->ControlPending == LVM_TRUE)
+ {
+ Status = LVM_ApplyNewSettings(hInstance);
+
+ if(Status != LVM_SUCCESS)
+ {
+ return Status;
+ }
+ }
+
+
+ /*
+ * Convert from Mono if necessary
+ */
+ if (pInstance->Params.SourceFormat == LVM_MONO)
+ {
+ MonoTo2I_Float(pInData, /* Source */
+ pOutData, /* Destination */
+ (LVM_INT16)NumSamples); /* Number of input samples */
+ pInput = pOutData;
+ pToProcess = pOutData;
+ }
+
+
+ /*
+ * Process the data with managed buffers
+ */
+ while (SampleCount != 0)
+ {
+ /*
+ * Manage the input buffer and frame processing
+ */
+ LVM_BufferIn(hInstance,
+ pInput,
+ &pToProcess,
+ &pProcessed,
+ &SampleCount);
+
+ /*
+ * Only process data when SampleCount is none zero, a zero count can occur when
+ * the BufferIn routine is working in managed mode.
+ */
+ if (SampleCount != 0)
+ {
+
+ /*
+ * Apply ConcertSound if required
+ */
+ if (pInstance->CS_Active == LVM_TRUE)
+ {
+ (void)LVCS_Process(pInstance->hCSInstance, /* Concert Sound instance handle */
+ pToProcess,
+ pProcessed,
+ SampleCount);
+ pToProcess = pProcessed;
+ }
+
+ /*
+ * Apply volume if required
+ */
+ if (pInstance->VC_Active!=0)
+ {
+ LVC_MixSoft_1St_D16C31_SAT(&pInstance->VC_Volume,
+ pToProcess,
+ pProcessed,
+ (LVM_INT16)(2 * SampleCount)); /* Left and right*/
+ pToProcess = pProcessed;
+ }
+
+ /*
+ * Call N-Band equaliser if enabled
+ */
+ if (pInstance->EQNB_Active == LVM_TRUE)
+ {
+ LVEQNB_Process(pInstance->hEQNBInstance, /* N-Band equaliser instance handle */
+ pToProcess,
+ pProcessed,
+ SampleCount);
+ pToProcess = pProcessed;
+ }
+
+ /*
+ * Call bass enhancement if enabled
+ */
+ if (pInstance->DBE_Active == LVM_TRUE)
+ {
+ LVDBE_Process(pInstance->hDBEInstance, /* Dynamic Bass Enhancement \
+ instance handle */
+ pToProcess,
+ pProcessed,
+ SampleCount);
+ pToProcess = pProcessed;
+ }
+
+ /*
+ * Bypass mode or everything off, so copy the input to the output
+ */
+ if (pToProcess != pProcessed)
+ {
+ Copy_Float(pToProcess, /* Source */
+ pProcessed, /* Destination */
+ (LVM_INT16)(2 * SampleCount)); /* Left and right */
+ }
+
+ /*
+ * Apply treble boost if required
+ */
+ if (pInstance->TE_Active == LVM_TRUE)
+ {
+ /*
+ * Apply the filter
+ */
+ FO_2I_D16F32C15_LShx_TRC_WRA_01(&pInstance->pTE_State->TrebleBoost_State,
+ pProcessed,
+ pProcessed,
+ (LVM_INT16)SampleCount);
+
+ }
+
+ /*
+ * Volume balance
+ */
+ LVC_MixSoft_1St_2i_D16C31_SAT(&pInstance->VC_BalanceMix,
+ pProcessed,
+ pProcessed,
+ SampleCount);
+
+ /*
+ * Perform Parametric Spectum Analysis
+ */
+ if ((pInstance->Params.PSA_Enable == LVM_PSA_ON) &&
+ (pInstance->InstParams.PSA_Included == LVM_PSA_ON))
+ {
+ From2iToMono_Float(pProcessed,
+ pInstance->pPSAInput,
+ (LVM_INT16)(SampleCount));
+
+ LVPSA_Process(pInstance->hPSAInstance,
+ pInstance->pPSAInput,
+ (LVM_UINT16)(SampleCount),
+ AudioTime);
+ }
+
+
+ /*
+ * DC removal
+ */
+ DC_2I_D16_TRC_WRA_01(&pInstance->DC_RemovalInstance,
+ pProcessed,
+ pProcessed,
+ (LVM_INT16)SampleCount);
+
+
+ }
+
+ /*
+ * Manage the output buffer
+ */
+ LVM_BufferOut(hInstance,
+ pOutData,
+ &SampleCount);
+
+ }
+
+ return(LVM_SUCCESS);
+}
+#else
LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 *pOutData,
@@ -273,3 +497,4 @@
return(LVM_SUCCESS);
}
+#endif
\ No newline at end of file
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.c b/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.c
index e14f909..199ddde 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.c
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.c
@@ -29,7 +29,342 @@
/* Treble Boost Filter Coefficients */
/* */
/************************************************************************************/
+#ifdef BUILD_FLOAT
+FO_FLOAT_LShx_Coefs_t LVM_TrebleBoostCoefs[] = {
+
+ /* 22kHz sampling rate */
+ {HPF_Fs22050_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs22050_Gain1_A0,
+ -HPF_Fs22050_Gain1_B1},
+ {HPF_Fs22050_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs22050_Gain2_A0,
+ -HPF_Fs22050_Gain2_B1},
+ {HPF_Fs22050_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs22050_Gain3_A0,
+ -HPF_Fs22050_Gain3_B1},
+ {HPF_Fs22050_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs22050_Gain4_A0,
+ -HPF_Fs22050_Gain4_B1},
+ {HPF_Fs22050_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs22050_Gain5_A0,
+ -HPF_Fs22050_Gain5_B1},
+ {HPF_Fs22050_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs22050_Gain6_A0,
+ -HPF_Fs22050_Gain6_B1},
+ {HPF_Fs22050_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs22050_Gain7_A0,
+ -HPF_Fs22050_Gain7_B1},
+ {HPF_Fs22050_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs22050_Gain8_A0,
+ -HPF_Fs22050_Gain8_B1},
+ {HPF_Fs22050_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs22050_Gain9_A0,
+ -HPF_Fs22050_Gain9_B1},
+ {HPF_Fs22050_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs22050_Gain10_A0,
+ -HPF_Fs22050_Gain10_B1},
+ {HPF_Fs22050_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs22050_Gain11_A0,
+ -HPF_Fs22050_Gain11_B1},
+ {HPF_Fs22050_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs22050_Gain12_A0,
+ -HPF_Fs22050_Gain12_B1},
+ {HPF_Fs22050_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs22050_Gain13_A0,
+ -HPF_Fs22050_Gain13_B1},
+ {HPF_Fs22050_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs22050_Gain14_A0,
+ -HPF_Fs22050_Gain14_B1},
+ {HPF_Fs22050_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs22050_Gain15_A0,
+ -HPF_Fs22050_Gain15_B1},
+
+ /* 24kHz sampling rate */
+ {HPF_Fs24000_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs24000_Gain1_A0,
+ -HPF_Fs24000_Gain1_B1},
+ {HPF_Fs24000_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs24000_Gain2_A0,
+ -HPF_Fs24000_Gain2_B1},
+ {HPF_Fs24000_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs24000_Gain3_A0,
+ -HPF_Fs24000_Gain3_B1},
+ {HPF_Fs24000_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs24000_Gain4_A0,
+ -HPF_Fs24000_Gain4_B1},
+ {HPF_Fs24000_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs24000_Gain5_A0,
+ -HPF_Fs24000_Gain5_B1},
+ {HPF_Fs24000_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs24000_Gain6_A0,
+ -HPF_Fs24000_Gain6_B1},
+ {HPF_Fs24000_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs24000_Gain7_A0,
+ -HPF_Fs24000_Gain7_B1},
+ {HPF_Fs24000_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs24000_Gain8_A0,
+ -HPF_Fs24000_Gain8_B1},
+ {HPF_Fs24000_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs24000_Gain9_A0,
+ -HPF_Fs24000_Gain9_B1},
+ {HPF_Fs24000_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs24000_Gain10_A0,
+ -HPF_Fs24000_Gain10_B1},
+ {HPF_Fs24000_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs24000_Gain11_A0,
+ -HPF_Fs24000_Gain11_B1},
+ {HPF_Fs24000_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs24000_Gain12_A0,
+ -HPF_Fs24000_Gain12_B1},
+ {HPF_Fs24000_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs24000_Gain13_A0,
+ -HPF_Fs24000_Gain13_B1},
+ {HPF_Fs24000_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs24000_Gain14_A0,
+ -HPF_Fs24000_Gain14_B1},
+ {HPF_Fs24000_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs24000_Gain15_A0,
+ -HPF_Fs24000_Gain15_B1},
+
+ /* 32kHz sampling rate */
+ {HPF_Fs32000_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs32000_Gain1_A0,
+ -HPF_Fs32000_Gain1_B1},
+ {HPF_Fs32000_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs32000_Gain2_A0,
+ -HPF_Fs32000_Gain2_B1},
+ {HPF_Fs32000_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs32000_Gain3_A0,
+ -HPF_Fs32000_Gain3_B1},
+ {HPF_Fs32000_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs32000_Gain4_A0,
+ -HPF_Fs32000_Gain4_B1},
+ {HPF_Fs32000_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs32000_Gain5_A0,
+ -HPF_Fs32000_Gain5_B1},
+ {HPF_Fs32000_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs32000_Gain6_A0,
+ -HPF_Fs32000_Gain6_B1},
+ {HPF_Fs32000_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs32000_Gain7_A0,
+ -HPF_Fs32000_Gain7_B1},
+ {HPF_Fs32000_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs32000_Gain8_A0,
+ -HPF_Fs32000_Gain8_B1},
+ {HPF_Fs32000_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs32000_Gain9_A0,
+ -HPF_Fs32000_Gain9_B1},
+ {HPF_Fs32000_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs32000_Gain10_A0,
+ -HPF_Fs32000_Gain10_B1},
+ {HPF_Fs32000_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs32000_Gain11_A0,
+ -HPF_Fs32000_Gain11_B1},
+ {HPF_Fs32000_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs32000_Gain12_A0,
+ -HPF_Fs32000_Gain12_B1},
+ {HPF_Fs32000_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs32000_Gain13_A0,
+ -HPF_Fs32000_Gain13_B1},
+ {HPF_Fs32000_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs32000_Gain14_A0,
+ -HPF_Fs32000_Gain14_B1},
+ {HPF_Fs32000_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs32000_Gain15_A0,
+ -HPF_Fs32000_Gain15_B1},
+
+ /* 44kHz sampling rate */
+ {HPF_Fs44100_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs44100_Gain1_A0,
+ -HPF_Fs44100_Gain1_B1,},
+ {HPF_Fs44100_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs44100_Gain2_A0,
+ -HPF_Fs44100_Gain2_B1},
+ {HPF_Fs44100_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs44100_Gain3_A0,
+ -HPF_Fs44100_Gain3_B1},
+ {HPF_Fs44100_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs44100_Gain4_A0,
+ -HPF_Fs44100_Gain4_B1},
+ {HPF_Fs44100_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs44100_Gain5_A0,
+ -HPF_Fs44100_Gain5_B1},
+ {HPF_Fs44100_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs44100_Gain6_A0,
+ -HPF_Fs44100_Gain6_B1},
+ {HPF_Fs44100_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs44100_Gain7_A0,
+ -HPF_Fs44100_Gain7_B1},
+ {HPF_Fs44100_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs44100_Gain8_A0,
+ -HPF_Fs44100_Gain8_B1},
+ {HPF_Fs44100_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs44100_Gain9_A0,
+ -HPF_Fs44100_Gain9_B1},
+ {HPF_Fs44100_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs44100_Gain10_A0,
+ -HPF_Fs44100_Gain10_B1},
+ {HPF_Fs44100_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs44100_Gain11_A0,
+ -HPF_Fs44100_Gain11_B1},
+ {HPF_Fs44100_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs44100_Gain12_A0,
+ -HPF_Fs44100_Gain12_B1},
+ {HPF_Fs44100_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs44100_Gain13_A0,
+ -HPF_Fs44100_Gain13_B1},
+ {HPF_Fs44100_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs44100_Gain14_A0,
+ -HPF_Fs44100_Gain14_B1},
+ {HPF_Fs44100_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs44100_Gain15_A0,
+ -HPF_Fs44100_Gain15_B1},
+
+ /* 48kHz sampling rate */
+ {HPF_Fs48000_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs48000_Gain1_A0,
+ -HPF_Fs48000_Gain1_B1},
+ {HPF_Fs48000_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs48000_Gain2_A0,
+ -HPF_Fs48000_Gain2_B1},
+ {HPF_Fs48000_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs48000_Gain3_A0,
+ -HPF_Fs48000_Gain3_B1},
+ {HPF_Fs48000_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs48000_Gain4_A0,
+ -HPF_Fs48000_Gain4_B1},
+ {HPF_Fs48000_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs48000_Gain5_A0,
+ -HPF_Fs48000_Gain5_B1},
+ {HPF_Fs48000_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs48000_Gain6_A0,
+ -HPF_Fs48000_Gain6_B1},
+ {HPF_Fs48000_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs48000_Gain7_A0,
+ -HPF_Fs48000_Gain7_B1},
+ {HPF_Fs48000_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs48000_Gain8_A0,
+ -HPF_Fs48000_Gain8_B1},
+ {HPF_Fs48000_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs48000_Gain9_A0,
+ -HPF_Fs48000_Gain9_B1},
+ {HPF_Fs48000_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs48000_Gain10_A0,
+ -HPF_Fs48000_Gain10_B1},
+ {HPF_Fs48000_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs48000_Gain11_A0,
+ -HPF_Fs48000_Gain11_B1},
+ {HPF_Fs48000_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs48000_Gain12_A0,
+ -HPF_Fs48000_Gain12_B1},
+ {HPF_Fs48000_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs48000_Gain13_A0,
+ -HPF_Fs48000_Gain13_B1},
+ {HPF_Fs48000_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs48000_Gain14_A0,
+ -HPF_Fs48000_Gain14_B1},
+ {HPF_Fs48000_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs48000_Gain15_A0,
+ -HPF_Fs48000_Gain15_B1}
+#ifdef HIGHER_FS
+ ,
+ /* 96kHz sampling rate */
+ {HPF_Fs96000_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs96000_Gain1_A0,
+ -HPF_Fs96000_Gain1_B1},
+ {HPF_Fs96000_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs96000_Gain2_A0,
+ -HPF_Fs96000_Gain2_B1},
+ {HPF_Fs96000_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs96000_Gain3_A0,
+ -HPF_Fs96000_Gain3_B1},
+ {HPF_Fs96000_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs96000_Gain4_A0,
+ -HPF_Fs96000_Gain4_B1},
+ {HPF_Fs96000_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs96000_Gain5_A0,
+ -HPF_Fs96000_Gain5_B1},
+ {HPF_Fs96000_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs96000_Gain6_A0,
+ -HPF_Fs96000_Gain6_B1},
+ {HPF_Fs96000_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs96000_Gain7_A0,
+ -HPF_Fs96000_Gain7_B1},
+ {HPF_Fs96000_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs96000_Gain8_A0,
+ -HPF_Fs96000_Gain8_B1},
+ {HPF_Fs96000_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs96000_Gain9_A0,
+ -HPF_Fs96000_Gain9_B1},
+ {HPF_Fs96000_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs96000_Gain10_A0,
+ -HPF_Fs96000_Gain10_B1},
+ {HPF_Fs96000_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs96000_Gain11_A0,
+ -HPF_Fs96000_Gain11_B1},
+ {HPF_Fs96000_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs96000_Gain12_A0,
+ -HPF_Fs96000_Gain12_B1},
+ {HPF_Fs96000_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs96000_Gain13_A0,
+ -HPF_Fs96000_Gain13_B1},
+ {HPF_Fs96000_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs96000_Gain14_A0,
+ -HPF_Fs96000_Gain14_B1},
+ {HPF_Fs96000_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs96000_Gain15_A0,
+ -HPF_Fs96000_Gain15_B1},
+
+ /* 192kHz sampling rate */
+ {HPF_Fs192000_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs192000_Gain1_A0,
+ -HPF_Fs192000_Gain1_B1},
+ {HPF_Fs192000_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs192000_Gain2_A0,
+ -HPF_Fs192000_Gain2_B1},
+ {HPF_Fs192000_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs192000_Gain3_A0,
+ -HPF_Fs192000_Gain3_B1},
+ {HPF_Fs192000_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs192000_Gain4_A0,
+ -HPF_Fs192000_Gain4_B1},
+ {HPF_Fs192000_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs192000_Gain5_A0,
+ -HPF_Fs192000_Gain5_B1},
+ {HPF_Fs192000_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs192000_Gain6_A0,
+ -HPF_Fs192000_Gain6_B1},
+ {HPF_Fs192000_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs192000_Gain7_A0,
+ -HPF_Fs192000_Gain7_B1},
+ {HPF_Fs192000_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs192000_Gain8_A0,
+ -HPF_Fs192000_Gain8_B1},
+ {HPF_Fs192000_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs192000_Gain9_A0,
+ -HPF_Fs192000_Gain9_B1},
+ {HPF_Fs192000_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs192000_Gain10_A0,
+ -HPF_Fs192000_Gain10_B1},
+ {HPF_Fs192000_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs192000_Gain11_A0,
+ -HPF_Fs192000_Gain11_B1},
+ {HPF_Fs192000_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs192000_Gain12_A0,
+ -HPF_Fs192000_Gain12_B1},
+ {HPF_Fs192000_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs192000_Gain13_A0,
+ -HPF_Fs192000_Gain13_B1},
+ {HPF_Fs192000_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs192000_Gain14_A0,
+ -HPF_Fs192000_Gain14_B1},
+ {HPF_Fs192000_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs192000_Gain15_A0,
+ -HPF_Fs192000_Gain15_B1}
+#endif
+ };
+#else
FO_C16_LShx_Coefs_t LVM_TrebleBoostCoefs[] = {
/* 22kHz sampling rate */
@@ -340,8 +675,9 @@
{HPF_Fs48000_Gain15_A1, /* Gain setting 15 */
HPF_Fs48000_Gain15_A0,
-HPF_Fs48000_Gain15_B1,
- HPF_Fs48000_Gain15_Shift}};
-
+ HPF_Fs48000_Gain15_Shift}
+ };
+#endif
/************************************************************************************/
/* */
@@ -350,6 +686,16 @@
/************************************************************************************/
/* dB to linear conversion table */
+#ifdef BUILD_FLOAT
+const LVM_FLOAT LVM_VolumeTable[] = {
+ 1.000f, /* 0dB */
+ 0.891f, /* -1dB */
+ 0.794f, /* -2dB */
+ 0.708f, /* -3dB */
+ 0.631f, /* -4dB */
+ 0.562f, /* -5dB */
+ 0.501f}; /* -6dB */
+#else
const LVM_INT16 LVM_VolumeTable[] = {
0x7FFF, /* 0dB */
0x7215, /* -1dB */
@@ -358,6 +704,7 @@
0x50C3, /* -4dB */
0x47FB, /* -5dB */
0x4000}; /* -6dB */
+#endif
/************************************************************************************/
/* */
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h b/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h
index a7601ff..4cf7119 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h
@@ -37,16 +37,23 @@
/* */
/************************************************************************************/
+#ifdef BUILD_FLOAT
+extern FO_FLOAT_LShx_Coefs_t LVM_TrebleBoostCoefs[];
+#else
extern FO_C16_LShx_Coefs_t LVM_TrebleBoostCoefs[];
-
+#endif
/************************************************************************************/
/* */
/* Volume control gain and time constant tables */
/* */
/************************************************************************************/
-
+#ifdef BUILD_FLOAT
+extern const LVM_FLOAT LVM_VolumeTable[];
+#else
extern const LVM_INT16 LVM_VolumeTable[];
+#endif
+
extern const LVM_INT16 LVM_MixerTCTable[];
diff --git a/media/libeffects/lvm/lib/Common/lib/AGC.h b/media/libeffects/lvm/lib/Common/lib/AGC.h
index 2080d64..9a3d35d 100644
--- a/media/libeffects/lvm/lib/Common/lib/AGC.h
+++ b/media/libeffects/lvm/lib/Common/lib/AGC.h
@@ -37,7 +37,7 @@
/* Types */
/* */
/**********************************************************************************/
-
+#ifndef BUILD_FLOAT
typedef struct
{
LVM_INT32 AGC_Gain; /* The current AGC gain */
@@ -52,20 +52,39 @@
LVM_INT16 VolumeTC; /* Volume update time constant */
} AGC_MIX_VOL_2St1Mon_D32_t;
+#else
+typedef struct
+{
+ LVM_FLOAT AGC_Gain; /* The current AGC gain */
+ LVM_FLOAT AGC_MaxGain; /* The maximum AGC gain */
+ LVM_FLOAT Volume; /* The current volume setting */
+ LVM_FLOAT Target; /* The target volume setting */
+ LVM_FLOAT AGC_Target; /* AGC target level */
+ LVM_FLOAT AGC_Attack; /* AGC attack scaler */
+ LVM_FLOAT AGC_Decay; /* AGC decay scaler */
+ LVM_FLOAT VolumeTC; /* Volume update time constant */
+} AGC_MIX_VOL_2St1Mon_FLOAT_t;
+#endif
/**********************************************************************************/
/* */
/* Function Prototypes */
/* */
/**********************************************************************************/
-
+#ifdef BUILD_FLOAT
+void AGC_MIX_VOL_2St1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_FLOAT_t *pInstance, /* Instance pointer */
+ const LVM_FLOAT *pStSrc, /* Stereo source */
+ const LVM_FLOAT *pMonoSrc, /* Mono source */
+ LVM_FLOAT *pDst, /* Stereo destination */
+ LVM_UINT16 n); /* Number of samples */
+#else
void AGC_MIX_VOL_2St1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_D32_t *pInstance, /* Instance pointer */
const LVM_INT32 *pStSrc, /* Stereo source */
const LVM_INT32 *pMonoSrc, /* Mono source */
LVM_INT32 *pDst, /* Stereo destination */
LVM_UINT16 n); /* Number of samples */
-
+#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/media/libeffects/lvm/lib/Common/lib/BIQUAD.h b/media/libeffects/lvm/lib/Common/lib/BIQUAD.h
index 7ac7fbd..3ee7f63 100644
--- a/media/libeffects/lvm/lib/Common/lib/BIQUAD.h
+++ b/media/libeffects/lvm/lib/Common/lib/BIQUAD.h
@@ -27,19 +27,34 @@
/**********************************************************************************
INSTANCE MEMORY TYPE DEFINITION
***********************************************************************************/
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ LVM_FLOAT Storage[6];
+} Biquad_FLOAT_Instance_t;
+#else
typedef struct
{
LVM_INT32 Storage[6];
} Biquad_Instance_t;
-
-
+#endif
/**********************************************************************************
COEFFICIENT TYPE DEFINITIONS
***********************************************************************************/
/*** Biquad coefficients **********************************************************/
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ LVM_FLOAT A2; /* a2 */
+ LVM_FLOAT A1; /* a1 */
+ LVM_FLOAT A0; /* a0 */
+ LVM_FLOAT B2; /* -b2! */
+ LVM_FLOAT B1; /* -b1! */
+} BQ_FLOAT_Coefs_t;
+#else
typedef struct
{
LVM_INT16 A2; /* a2 */
@@ -57,8 +72,17 @@
LVM_INT32 B2; /* -b2! */
LVM_INT32 B1; /* -b1! */
} BQ_C32_Coefs_t;
+#endif
/*** First order coefficients *****************************************************/
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ LVM_FLOAT A1; /* a1 */
+ LVM_FLOAT A0; /* a0 */
+ LVM_FLOAT B1; /* -b1! */
+} FO_FLOAT_Coefs_t;
+#else
typedef struct
{
LVM_INT16 A1; /* a1 */
@@ -72,8 +96,17 @@
LVM_INT32 A0; /* a0 */
LVM_INT32 B1; /* -b1! */
} FO_C32_Coefs_t;
+#endif
/*** First order coefficients with Shift*****************************************************/
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ LVM_FLOAT A1; /* a1 */
+ LVM_FLOAT A0; /* a0 */
+ LVM_FLOAT B1; /* -b1! */
+} FO_FLOAT_LShx_Coefs_t;
+#else
typedef struct
{
LVM_INT16 A1; /* a1 */
@@ -81,8 +114,16 @@
LVM_INT16 B1; /* -b1! */
LVM_INT16 Shift; /* Shift */
} FO_C16_LShx_Coefs_t;
-
+#endif
/*** Band pass coefficients *******************************************************/
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ LVM_FLOAT A0; /* a0 */
+ LVM_FLOAT B2; /* -b2! */
+ LVM_FLOAT B1; /* -b1! */
+} BP_FLOAT_Coefs_t;
+#else
typedef struct
{
LVM_INT16 A0; /* a0 */
@@ -96,8 +137,18 @@
LVM_INT32 B2; /* -b2! */
LVM_INT32 B1; /* -b1! */
} BP_C32_Coefs_t;
+#endif
/*** Peaking coefficients *********************************************************/
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ LVM_FLOAT A0; /* a0 */
+ LVM_FLOAT B2; /* -b2! */
+ LVM_FLOAT B1; /* -b1! */
+ LVM_FLOAT G; /* Gain */
+} PK_FLOAT_Coefs_t;
+#else
typedef struct
{
LVM_INT16 A0; /* a0 */
@@ -113,16 +164,26 @@
LVM_INT32 B1; /* -b1! */
LVM_INT16 G; /* Gain */
} PK_C32_Coefs_t;
-
+#endif
/**********************************************************************************
TAPS TYPE DEFINITIONS
***********************************************************************************/
/*** Types used for first order and shelving filter *******************************/
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ LVM_FLOAT Storage[ (1 * 2) ]; /* One channel, two taps of size LVM_INT32 */
+} Biquad_1I_Order1_FLOAT_Taps_t;
typedef struct
{
+ LVM_FLOAT Storage[ (2 * 2) ]; /* Two channels, two taps of size LVM_INT32 */
+} Biquad_2I_Order1_FLOAT_Taps_t;
+#else
+typedef struct
+{
LVM_INT32 Storage[ (1*2) ]; /* One channel, two taps of size LVM_INT32 */
} Biquad_1I_Order1_Taps_t;
@@ -130,12 +191,22 @@
{
LVM_INT32 Storage[ (2*2) ]; /* Two channels, two taps of size LVM_INT32 */
} Biquad_2I_Order1_Taps_t;
-
+#endif
/*** Types used for biquad, band pass and peaking filter **************************/
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ LVM_FLOAT Storage[ (1 * 4) ]; /* One channel, four taps of size LVM_INT32 */
+} Biquad_1I_Order2_FLOAT_Taps_t;
typedef struct
{
+ LVM_FLOAT Storage[ (2 * 4) ]; /* Two channels, four taps of size LVM_INT32 */
+} Biquad_2I_Order2_FLOAT_Taps_t;
+#else
+typedef struct
+{
LVM_INT32 Storage[ (1*4) ]; /* One channel, four taps of size LVM_INT32 */
} Biquad_1I_Order2_Taps_t;
@@ -143,7 +214,7 @@
{
LVM_INT32 Storage[ (2*4) ]; /* Two channels, four taps of size LVM_INT32 */
} Biquad_2I_Order2_Taps_t;
-
+#endif
/* The names of the functions are changed to satisfy QAC rules: Name should be Unique withing 16 characters*/
#define BQ_2I_D32F32Cll_TRC_WRA_01_Init Init_BQ_2I_D32F32Cll_TRC_WRA_01
#define BP_1I_D32F32C30_TRC_WRA_02 TWO_BP_1I_D32F32C30_TRC_WRA_02
@@ -154,59 +225,148 @@
/*** 16 bit data path *************************************************************/
+
+#ifdef BUILD_FLOAT
+void BQ_2I_D16F32Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
+ BQ_FLOAT_Coefs_t *pCoef);
+#else
void BQ_2I_D16F32Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_2I_Order2_Taps_t *pTaps,
BQ_C16_Coefs_t *pCoef);
+#endif
+#ifdef BUILD_FLOAT
+void BQ_2I_D16F32C15_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+#else
void BQ_2I_D16F32C15_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
LVM_INT16 NrSamples);
+#endif
+#ifdef BUILD_FLOAT
+void BQ_2I_D16F32C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+#else
void BQ_2I_D16F32C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
LVM_INT16 NrSamples);
+#endif
+
+#ifdef BUILD_FLOAT
+void BQ_2I_D16F32C13_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+#else
void BQ_2I_D16F32C13_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
LVM_INT16 NrSamples);
+#endif
+
+#ifdef BUILD_FLOAT
+void BQ_2I_D16F16Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
+ BQ_FLOAT_Coefs_t *pCoef);
+#else
void BQ_2I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_2I_Order2_Taps_t *pTaps,
BQ_C16_Coefs_t *pCoef);
+#endif
+
+#ifdef BUILD_FLOAT
+void BQ_2I_D16F16C15_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+#else
void BQ_2I_D16F16C15_TRC_WRA_01( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
LVM_INT16 NrSamples);
+#endif
+
+#ifdef BUILD_FLOAT
+void BQ_2I_D16F16C14_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+#else
void BQ_2I_D16F16C14_TRC_WRA_01( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
LVM_INT16 NrSamples);
+#endif
+#ifdef BUILD_FLOAT
+void BQ_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
+ BQ_FLOAT_Coefs_t *pCoef);
+#else
void BQ_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_1I_Order2_Taps_t *pTaps,
BQ_C16_Coefs_t *pCoef);
+#endif
+
+#ifdef BUILD_FLOAT
+void BQ_1I_D16F16C15_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+#else
void BQ_1I_D16F16C15_TRC_WRA_01( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
LVM_INT16 NrSamples);
+#endif
+
+#ifdef BUILD_FLOAT
+void BQ_1I_D16F32Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
+ BQ_FLOAT_Coefs_t *pCoef);
+#else
void BQ_1I_D16F32Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_1I_Order2_Taps_t *pTaps,
BQ_C16_Coefs_t *pCoef);
+#endif
+
+#ifdef BUILD_FLOAT
+void BQ_1I_D16F32C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+#else
void BQ_1I_D16F32C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
LVM_INT16 NrSamples);
+#endif
/*** 32 bit data path *************************************************************/
-
+#ifdef BUILD_FLOAT
+void BQ_2I_D32F32Cll_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
+ BQ_FLOAT_Coefs_t *pCoef);
+void BQ_2I_D32F32C30_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+#else
void BQ_2I_D32F32Cll_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_2I_Order2_Taps_t *pTaps,
BQ_C32_Coefs_t *pCoef);
@@ -215,33 +375,66 @@
LVM_INT32 *pDataIn,
LVM_INT32 *pDataOut,
LVM_INT16 NrSamples);
+#endif
/**********************************************************************************
FUNCTION PROTOTYPES: FIRST ORDER FILTERS
***********************************************************************************/
/*** 16 bit data path *************************************************************/
-
+#ifdef BUILD_FLOAT
+void FO_1I_D16F16Css_TRC_WRA_01_Init( Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_1I_Order1_FLOAT_Taps_t *pTaps,
+ FO_FLOAT_Coefs_t *pCoef);
+#else
void FO_1I_D16F16Css_TRC_WRA_01_Init( Biquad_Instance_t *pInstance,
Biquad_1I_Order1_Taps_t *pTaps,
FO_C16_Coefs_t *pCoef);
+#endif
+#ifdef BUILD_FLOAT
+void FO_1I_D16F16C15_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+#else
void FO_1I_D16F16C15_TRC_WRA_01( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
LVM_INT16 NrSamples);
+#endif
+#ifdef BUILD_FLOAT
+void FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_2I_Order1_FLOAT_Taps_t *pTaps,
+ FO_FLOAT_LShx_Coefs_t *pCoef);
+#else
void FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(Biquad_Instance_t *pInstance,
Biquad_2I_Order1_Taps_t *pTaps,
FO_C16_LShx_Coefs_t *pCoef);
+#endif
+#ifdef BUILD_FLOAT
+void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+#else
void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
LVM_INT16 NrSamples);
-
+#endif
/*** 32 bit data path *************************************************************/
-
+#ifdef BUILD_FLOAT
+void FO_1I_D32F32Cll_TRC_WRA_01_Init( Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_1I_Order1_FLOAT_Taps_t *pTaps,
+ FO_FLOAT_Coefs_t *pCoef);
+void FO_1I_D32F32C31_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+#else
void FO_1I_D32F32Cll_TRC_WRA_01_Init( Biquad_Instance_t *pInstance,
Biquad_1I_Order1_Taps_t *pTaps,
FO_C32_Coefs_t *pCoef);
@@ -250,13 +443,28 @@
LVM_INT32 *pDataIn,
LVM_INT32 *pDataOut,
LVM_INT16 NrSamples);
-
+#endif
/**********************************************************************************
FUNCTION PROTOTYPES: BAND PASS FILTERS
***********************************************************************************/
/*** 16 bit data path *************************************************************/
-
+#ifdef BUILD_FLOAT
+void BP_1I_D16F16Css_TRC_WRA_01_Init( Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
+ BP_FLOAT_Coefs_t *pCoef);
+void BP_1I_D16F16C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+void BP_1I_D16F32Cll_TRC_WRA_01_Init (Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
+ BP_FLOAT_Coefs_t *pCoef);
+void BP_1I_D16F32C30_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+#else
void BP_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_1I_Order2_Taps_t *pTaps,
BP_C16_Coefs_t *pCoef);
@@ -274,10 +482,17 @@
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
LVM_INT16 NrSamples);
-
-
+#endif
/*** 32 bit data path *************************************************************/
-
+#ifdef BUILD_FLOAT
+void BP_1I_D32F32Cll_TRC_WRA_02_Init ( Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
+ BP_FLOAT_Coefs_t *pCoef);
+void BP_1I_D32F32C30_TRC_WRA_02( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+#else
void BP_1I_D32F32Cll_TRC_WRA_02_Init ( Biquad_Instance_t *pInstance,
Biquad_1I_Order2_Taps_t *pTaps,
BP_C32_Coefs_t *pCoef);
@@ -286,42 +501,59 @@
LVM_INT32 *pDataIn,
LVM_INT32 *pDataOut,
LVM_INT16 NrSamples);
-
+#endif
/*** 32 bit data path STEREO ******************************************************/
-
+#ifndef BUILD_FLOAT
void PK_2I_D32F32CllGss_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_2I_Order2_Taps_t *pTaps,
PK_C32_Coefs_t *pCoef);
-
void PK_2I_D32F32C30G11_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT32 *pDataIn,
LVM_INT32 *pDataOut,
LVM_INT16 NrSamples);
-
+#endif
+#ifdef BUILD_FLOAT
+void PK_2I_D32F32CssGss_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
+ PK_FLOAT_Coefs_t *pCoef);
+#else
void PK_2I_D32F32CssGss_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_2I_Order2_Taps_t *pTaps,
PK_C16_Coefs_t *pCoef);
-
+#endif
+#ifdef BUILD_FLOAT
+void PK_2I_D32F32C14G11_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+#else
void PK_2I_D32F32C14G11_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT32 *pDataIn,
LVM_INT32 *pDataOut,
LVM_INT16 NrSamples);
-
+#endif
/**********************************************************************************
FUNCTION PROTOTYPES: DC REMOVAL FILTERS
***********************************************************************************/
/*** 16 bit data path STEREO ******************************************************/
+#ifdef BUILD_FLOAT
+void DC_2I_D16_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance);
+void DC_2I_D16_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+#else
void DC_2I_D16_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance);
void DC_2I_D16_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
LVM_INT16 NrSamples);
-
+#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/media/libeffects/lvm/lib/Common/lib/CompLim.h b/media/libeffects/lvm/lib/Common/lib/CompLim.h
index 4cb8aa2..498faa3 100644
--- a/media/libeffects/lvm/lib/Common/lib/CompLim.h
+++ b/media/libeffects/lvm/lib/Common/lib/CompLim.h
@@ -66,13 +66,17 @@
/* Function Prototypes */
/* */
/************************************************************************************/
-
+#ifdef BUILD_FLOAT
+void NonLinComp_Float(LVM_FLOAT Gain,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT32 BlockLength);
+#else
void NonLinComp_D16(LVM_INT16 Gain,
LVM_INT16 *pSterBfIn,
LVM_INT16 *pSterBfOut,
LVM_INT32 BlockLength);
-
-
+#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/media/libeffects/lvm/lib/Common/lib/Filter.h b/media/libeffects/lvm/lib/Common/lib/Filter.h
index 229701a..0c8955d 100644
--- a/media/libeffects/lvm/lib/Common/lib/Filter.h
+++ b/media/libeffects/lvm/lib/Common/lib/Filter.h
@@ -33,11 +33,32 @@
DEFINES
***********************************************************************************/
#define FILTER_LOSS 32730 /* -0.01dB loss to avoid wrapping due to band ripple */
-
+#ifdef BUILD_FLOAT
+#define FILTER_LOSS_FLOAT 0.998849f
+#endif
/**********************************************************************************
FUNCTION PROTOTYPES
***********************************************************************************/
+#ifdef BUILD_FLOAT
+LVM_FLOAT LVM_Power10( LVM_FLOAT X);
+
+LVM_FLOAT LVM_Polynomial(LVM_UINT16 N,
+ LVM_FLOAT *pCoefficients,
+ LVM_FLOAT X);
+#ifdef HIGHER_FS
+LVM_FLOAT LVM_GetOmega(LVM_UINT32 Fc,
+#else
+LVM_FLOAT LVM_GetOmega(LVM_UINT16 Fc,
+#endif
+ LVM_Fs_en SampleRate);
+
+LVM_FLOAT LVM_FO_LPF( LVM_FLOAT w,
+ FO_FLOAT_Coefs_t *pCoeffs);
+
+LVM_FLOAT LVM_FO_HPF( LVM_FLOAT w,
+ FO_FLOAT_Coefs_t *pCoeffs);
+#else
LVM_INT32 LVM_Polynomial(LVM_UINT16 N,
LVM_INT32 *pCoefficients,
LVM_INT32 X);
@@ -52,7 +73,7 @@
LVM_INT32 LVM_GetOmega(LVM_UINT16 Fc,
LVM_Fs_en SampleRate);
-
+#endif
/**********************************************************************************/
#ifdef __cplusplus
}
diff --git a/media/libeffects/lvm/lib/Common/lib/LVM_Types.h b/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
index 68c55f7..cb15b60 100644
--- a/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
+++ b/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
@@ -44,6 +44,9 @@
#define LVM_MAXINT_8 127 /* Maximum positive integer size */
#define LVM_MAXINT_16 32767
+#ifdef BUILD_FLOAT
+#define LVM_MAXFLOAT 1.0f
+#endif
#define LVM_MAXINT_32 2147483647
#define LVM_MAXENUM 2147483647
@@ -95,7 +98,9 @@
typedef int32_t LVM_INT32; /* Signed 32-bit word */
typedef uint32_t LVM_UINT32; /* Unsigned 32-bit word */
-
+#ifdef BUILD_FLOAT
+typedef float LVM_FLOAT; /* single precission floating point*/
+#endif
/****************************************************************************************/
/* */
/* Standard Enumerated types */
@@ -133,6 +138,10 @@
LVM_FS_32000 = 6,
LVM_FS_44100 = 7,
LVM_FS_48000 = 8,
+#ifdef HIGHER_FS
+ LVM_FS_96000 = 9,
+ LVM_FS_192000 = 10,
+#endif
LVM_FS_INVALID = LVM_MAXENUM-1,
LVM_FS_DUMMY = LVM_MAXENUM
} LVM_Fs_en;
diff --git a/media/libeffects/lvm/lib/Common/lib/Mixer.h b/media/libeffects/lvm/lib/Common/lib/Mixer.h
index 89deb0d..07c53cd 100644
--- a/media/libeffects/lvm/lib/Common/lib/Mixer.h
+++ b/media/libeffects/lvm/lib/Common/lib/Mixer.h
@@ -30,6 +30,43 @@
INSTANCE MEMORY TYPE DEFINITION
***********************************************************************************/
+#ifdef BUILD_FLOAT /* BUILD_FLOAT*/
+typedef struct
+{
+ LVM_FLOAT Alpha; /* Time constant. Set by calling application. \
+ Can be changed at any time */
+ LVM_FLOAT Target; /* Target value. Set by calling application. \
+ Can be changed at any time */
+ LVM_FLOAT Current; /* Current value. Set by the mixer function. */
+ LVM_INT16 CallbackSet; /* Boolean. Should be set by calling application \
+ each time the target value is updated */
+ LVM_INT16 CallbackParam; /* Parameter that will be used in the calback function */
+ void *pCallbackHandle; /* Pointer to the instance of the callback function */
+ void *pGeneralPurpose; /* Pointer for general purpose usage */
+ LVM_Callback pCallBack; /* Pointer to the callback function */
+} Mix_1St_Cll_FLOAT_t;
+typedef struct
+{
+ LVM_FLOAT Alpha1;
+ LVM_FLOAT Target1;
+ LVM_FLOAT Current1;
+ LVM_INT16 CallbackSet1;
+ LVM_INT16 CallbackParam1;
+ void *pCallbackHandle1;
+ void *pGeneralPurpose1;
+ LVM_Callback pCallBack1;
+
+ LVM_FLOAT Alpha2; /* Warning the address of this location is passed as a \
+ pointer to Mix_1St_Cll_t in some functions */
+ LVM_FLOAT Target2;
+ LVM_FLOAT Current2;
+ LVM_INT16 CallbackSet2;
+ LVM_INT16 CallbackParam2;
+ void *pCallbackHandle2;
+ void *pGeneralPurpose2;
+ LVM_Callback pCallBack2;
+} Mix_2St_Cll_FLOAT_t;
+#else
typedef struct
{
LVM_INT32 Alpha; /* Time constant. Set by calling application. Can be changed at any time */
@@ -64,9 +101,35 @@
} Mix_2St_Cll_t;
+#endif
/*** General functions ************************************************************/
+#ifdef BUILD_FLOAT
+LVM_FLOAT LVM_Mixer_TimeConstant(LVM_UINT32 tc,
+#ifdef HIGHER_FS
+ LVM_UINT32 Fs,
+#else
+ LVM_UINT16 Fs,
+#endif
+ LVM_UINT16 NumChannels);
+
+void MixSoft_1St_D32C31_WRA( Mix_1St_Cll_FLOAT_t *pInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+
+void MixSoft_2St_D32C31_SAT( Mix_2St_Cll_FLOAT_t *pInstance,
+ const LVM_FLOAT *src1,
+ const LVM_FLOAT *src2,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+
+void MixInSoft_D32C31_SAT( Mix_1St_Cll_FLOAT_t *pInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+#else
LVM_UINT32 LVM_Mixer_TimeConstant(LVM_UINT32 tc,
LVM_UINT16 Fs,
LVM_UINT16 NumChannels);
@@ -88,10 +151,26 @@
LVM_INT32 *dst,
LVM_INT16 n);
+#endif
+
/**********************************************************************************
FUNCTION PROTOTYPES (LOW LEVEL SUBFUNCTIONS)
***********************************************************************************/
-
+#ifdef BUILD_FLOAT
+void Core_MixSoft_1St_D32C31_WRA( Mix_1St_Cll_FLOAT_t *pInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+void Core_MixHard_2St_D32C31_SAT( Mix_2St_Cll_FLOAT_t *pInstance,
+ const LVM_FLOAT *src1,
+ const LVM_FLOAT *src2,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+void Core_MixInSoft_D32C31_SAT( Mix_1St_Cll_FLOAT_t *pInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+#else
void Core_MixSoft_1St_D32C31_WRA( Mix_1St_Cll_t *pInstance,
const LVM_INT32 *src,
LVM_INT32 *dst,
@@ -107,6 +186,7 @@
const LVM_INT32 *src,
LVM_INT32 *dst,
LVM_INT16 n);
+#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
@@ -115,13 +195,3 @@
/**********************************************************************************/
#endif /* __MIXER_H__ */
-
-
-
-
-
-
-
-
-
-
diff --git a/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h b/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h
index 3d62704..cdb3837 100644
--- a/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h
+++ b/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h
@@ -34,7 +34,12 @@
/*######################################################################################*/
/* Absolute value including the corner case for the extreme negative value */
+
+#ifdef BUILD_FLOAT
+LVM_FLOAT Abs_Float(LVM_FLOAT input);
+#else
LVM_INT32 Abs_32(LVM_INT32 input);
+#endif
/****************************************************************************************
* Name : dB_to_Lin32()
@@ -48,8 +53,11 @@
* (15->01) = decimal part
* Returns : Lin value format 1.16.15
****************************************************************************************/
-
+#ifdef BUILD_FLOAT
+LVM_FLOAT dB_to_LinFloat(LVM_INT16 db_fix);
+#else
LVM_INT32 dB_to_Lin32(LVM_INT16 db_fix);
+#endif
#ifdef __cplusplus
}
diff --git a/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h b/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h
index 2b791bd..0ba20a3 100644
--- a/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h
+++ b/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h
@@ -29,6 +29,11 @@
VARIOUS FUNCTIONS
***********************************************************************************/
+#ifdef BUILD_FLOAT
+void LoadConst_Float( const LVM_FLOAT val,
+ LVM_FLOAT *dst,
+ LVM_INT16 n );
+#else
void LoadConst_16( const LVM_INT16 val,
LVM_INT16 *dst,
LVM_INT16 n );
@@ -36,10 +41,17 @@
void LoadConst_32( const LVM_INT32 val,
LVM_INT32 *dst,
LVM_INT16 n );
+#endif
+#ifdef BUILD_FLOAT
+void Copy_Float( const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n );
+#else
void Copy_16( const LVM_INT16 *src,
LVM_INT16 *dst,
LVM_INT16 n );
+#endif
/*********************************************************************************
* note: In Mult3s_16x16() saturation of result is not taken care when *
@@ -49,10 +61,17 @@
* This is the only case which will give wrong result. *
* For more information refer to Vector_Arithmetic.doc in /doc folder *
*********************************************************************************/
+#ifdef BUILD_FLOAT
+void Mult3s_Float( const LVM_FLOAT *src,
+ const LVM_FLOAT val,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+#else
void Mult3s_16x16( const LVM_INT16 *src,
const LVM_INT16 val,
- LVM_INT16 *dst,
- LVM_INT16 n);
+ LVM_INT16 *dst,
+ LVM_INT16 n);
+#endif
/*********************************************************************************
* note: In Mult3s_32x16() saturation of result is not taken care when *
@@ -66,20 +85,31 @@
const LVM_INT16 val,
LVM_INT32 *dst,
LVM_INT16 n);
-
+#ifdef BUILD_FLOAT
+void DelayMix_Float(const LVM_FLOAT *src, /* Source 1, to be delayed */
+ LVM_FLOAT *delay, /* Delay buffer */
+ LVM_INT16 size, /* Delay size */
+ LVM_FLOAT *dst, /* Source/destination */
+ LVM_INT16 *pOffset, /* Delay offset */
+ LVM_INT16 n) ; /* Number of stereo samples */
+#else
void DelayMix_16x16( const LVM_INT16 *src,
LVM_INT16 *delay,
LVM_INT16 size,
LVM_INT16 *dst,
LVM_INT16 *pOffset,
LVM_INT16 n);
-
+#endif
void DelayWrite_32( const LVM_INT32 *src, /* Source 1, to be delayed */
LVM_INT32 *delay, /* Delay buffer */
LVM_UINT16 size, /* Delay size */
LVM_UINT16 *pOffset, /* Delay offset */
LVM_INT16 n);
-
+#ifdef BUILD_FLOAT
+void Add2_Sat_Float( const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n );
+#else
void Add2_Sat_16x16( const LVM_INT16 *src,
LVM_INT16 *dst,
LVM_INT16 n );
@@ -87,7 +117,13 @@
void Add2_Sat_32x32( const LVM_INT32 *src,
LVM_INT32 *dst,
LVM_INT16 n );
-
+#endif
+#ifdef BUILD_FLOAT
+void Mac3s_Sat_Float( const LVM_FLOAT *src,
+ const LVM_FLOAT val,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+#else
void Mac3s_Sat_16x16( const LVM_INT16 *src,
const LVM_INT16 val,
LVM_INT16 *dst,
@@ -97,7 +133,7 @@
const LVM_INT16 val,
LVM_INT32 *dst,
LVM_INT16 n);
-
+#endif
void DelayAllPass_Sat_32x16To32( LVM_INT32 *delay, /* Delay buffer */
LVM_UINT16 size, /* Delay size */
LVM_INT16 coeff, /* All pass filter coefficient */
@@ -109,7 +145,12 @@
/**********************************************************************************
SHIFT FUNCTIONS
***********************************************************************************/
-
+#ifdef BUILD_FLOAT
+void Shift_Sat_Float (const LVM_INT16 val,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+#else
void Shift_Sat_v16xv16 ( const LVM_INT16 val,
const LVM_INT16 *src,
LVM_INT16 *dst,
@@ -119,11 +160,15 @@
const LVM_INT32 *src,
LVM_INT32 *dst,
LVM_INT16 n);
-
+#endif
/**********************************************************************************
AUDIO FORMAT CONVERSION FUNCTIONS
***********************************************************************************/
-
+#ifdef BUILD_FLOAT
+void MonoTo2I_Float( const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+#else
void MonoTo2I_16( const LVM_INT16 *src,
LVM_INT16 *dst,
LVM_INT16 n);
@@ -131,29 +176,52 @@
void MonoTo2I_32( const LVM_INT32 *src,
LVM_INT32 *dst,
LVM_INT16 n);
-
+#endif
+#ifdef BUILD_FLOAT
+void From2iToMono_Float( const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+#else
void From2iToMono_32( const LVM_INT32 *src,
LVM_INT32 *dst,
LVM_INT16 n);
-
+#endif
+#ifdef BUILD_FLOAT
+void MSTo2i_Sat_Float( const LVM_FLOAT *srcM,
+ const LVM_FLOAT *srcS,
+ LVM_FLOAT *dst,
+ LVM_INT16 n );
+#else
void MSTo2i_Sat_16x16( const LVM_INT16 *srcM,
const LVM_INT16 *srcS,
LVM_INT16 *dst,
LVM_INT16 n );
-
+#endif
+#ifdef BUILD_FLOAT
+void From2iToMS_Float( const LVM_FLOAT *src,
+ LVM_FLOAT *dstM,
+ LVM_FLOAT *dstS,
+ LVM_INT16 n );
+#else
void From2iToMS_16x16( const LVM_INT16 *src,
LVM_INT16 *dstM,
LVM_INT16 *dstS,
LVM_INT16 n );
-
+#endif
+#ifdef BUILD_FLOAT
+void JoinTo2i_Float( const LVM_FLOAT *srcL,
+ const LVM_FLOAT *srcR,
+ LVM_FLOAT *dst,
+ LVM_INT16 n );
+#else
void From2iToMono_16( const LVM_INT16 *src,
LVM_INT16 *dst,
LVM_INT16 n);
-
void JoinTo2i_32x32( const LVM_INT32 *srcL,
const LVM_INT32 *srcR,
- LVM_INT32 *dst,
- LVM_INT16 n );
+ LVM_INT32 *dst,
+ LVM_INT16 n );
+#endif
/**********************************************************************************
DATA TYPE CONVERSION FUNCTIONS
diff --git a/media/libeffects/lvm/lib/Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.c b/media/libeffects/lvm/lib/Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.c
index 920b515..fa9f01f 100644
--- a/media/libeffects/lvm/lib/Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.c
+++ b/media/libeffects/lvm/lib/Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.c
@@ -33,7 +33,10 @@
#define VOL_TC_SHIFT 21 /* As a power of 2 */
#define DECAY_SHIFT 10 /* As a power of 2 */
-
+#ifdef BUILD_FLOAT
+#define VOL_TC_FLOAT 2.0f /* As a power of 2 */
+#define DECAY_FAC_FLOAT 64.0f /* As a power of 2 */
+#endif
/****************************************************************************************/
/* */
@@ -69,7 +72,7 @@
/* NOTES: */
/* */
/****************************************************************************************/
-
+#ifndef BUILD_FLOAT
void AGC_MIX_VOL_2St1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_D32_t *pInstance, /* Instance pointer */
const LVM_INT32 *pStSrc, /* Stereo source */
const LVM_INT32 *pMonoSrc, /* Mono source */
@@ -193,4 +196,113 @@
return;
}
+#else
+void AGC_MIX_VOL_2St1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_FLOAT_t *pInstance, /* Instance pointer */
+ const LVM_FLOAT *pStSrc, /* Stereo source */
+ const LVM_FLOAT *pMonoSrc, /* Mono source */
+ LVM_FLOAT *pDst, /* Stereo destination */
+ LVM_UINT16 NumSamples) /* Number of samples */
+{
+ /*
+ * General variables
+ */
+ LVM_UINT16 i; /* Sample index */
+ LVM_FLOAT Left; /* Left sample */
+ LVM_FLOAT Right; /* Right sample */
+ LVM_FLOAT Mono; /* Mono sample */
+ LVM_FLOAT AbsPeak; /* Absolute peak signal */
+ LVM_FLOAT AGC_Mult; /* Short AGC gain */
+ LVM_FLOAT Vol_Mult; /* Short volume */
+
+
+ /*
+ * Instance control variables
+ */
+ LVM_FLOAT AGC_Gain = pInstance->AGC_Gain; /* Get the current AGC gain */
+ LVM_FLOAT AGC_MaxGain = pInstance->AGC_MaxGain; /* Get maximum AGC gain */
+ LVM_FLOAT AGC_Attack = pInstance->AGC_Attack; /* Attack scaler */
+ LVM_FLOAT AGC_Decay = (pInstance->AGC_Decay * (1 << (DECAY_SHIFT)));/* Decay scaler */
+ LVM_FLOAT AGC_Target = pInstance->AGC_Target; /* Get the target level */
+ LVM_FLOAT Vol_Current = pInstance->Volume; /* Actual volume setting */
+ LVM_FLOAT Vol_Target = pInstance->Target; /* Target volume setting */
+ LVM_FLOAT Vol_TC = pInstance->VolumeTC; /* Time constant */
+
+
+ /*
+ * Process on a sample by sample basis
+ */
+ for (i = 0; i < NumSamples; i++) /* For each sample */
+ {
+
+ /*
+ * Get the short scalers
+ */
+ AGC_Mult = (LVM_FLOAT)(AGC_Gain); /* Get the short AGC gain */
+ Vol_Mult = (LVM_FLOAT)(Vol_Current); /* Get the short volume gain */
+
+
+ /*
+ * Get the input samples
+ */
+ Left = *pStSrc++; /* Get the left sample */
+ Right = *pStSrc++; /* Get the right sample */
+ Mono = *pMonoSrc++; /* Get the mono sample */
+
+
+ /*
+ * Apply the AGC gain to the mono input and mix with the stereo signal
+ */
+ Left += (Mono * AGC_Mult); /* Mix in the mono signal */
+ Right += (Mono * AGC_Mult);
+
+ /*
+ * Apply the volume and write to the output stream
+ */
+ Left = Left * Vol_Mult;
+ Right = Right * Vol_Mult;
+ *pDst++ = Left; /* Save the results */
+ *pDst++ = Right;
+
+ /*
+ * Update the AGC gain
+ */
+ AbsPeak = Abs_Float(Left) > Abs_Float(Right) ? Abs_Float(Left) : Abs_Float(Right);
+ if (AbsPeak > AGC_Target)
+ {
+ /*
+ * The signal is too large so decrease the gain
+ */
+ AGC_Gain = AGC_Gain * AGC_Attack;
+ }
+ else
+ {
+ /*
+ * The signal is too small so increase the gain
+ */
+ if (AGC_Gain > AGC_MaxGain)
+ {
+ AGC_Gain -= (AGC_Decay);
+ }
+ else
+ {
+ AGC_Gain += (AGC_Decay);
+ }
+ }
+
+ /*
+ * Update the gain
+ */
+ Vol_Current += (Vol_Target - Vol_Current) * ((LVM_FLOAT)Vol_TC / VOL_TC_FLOAT);
+ }
+
+
+ /*
+ * Update the parameters
+ */
+ pInstance->Volume = Vol_Current; /* Actual volume setting */
+ pInstance->AGC_Gain = AGC_Gain;
+
+ return;
+}
+#endif /*BUILD_FLOAT*/
diff --git a/media/libeffects/lvm/lib/Common/src/Abs_32.c b/media/libeffects/lvm/lib/Common/src/Abs_32.c
index 9128b82..84fabd8 100644
--- a/media/libeffects/lvm/lib/Common/src/Abs_32.c
+++ b/media/libeffects/lvm/lib/Common/src/Abs_32.c
@@ -47,4 +47,14 @@
}
return input;
}
-
+#ifdef BUILD_FLOAT
+LVM_FLOAT Abs_Float(LVM_FLOAT input)
+{
+ if(input < 0)
+ {
+ /* Negative input, so invert */
+ input = (LVM_FLOAT)(-input);
+ }
+ return input;
+}
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.c b/media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.c
index 69d357e..e3edccc 100644
--- a/media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.c
+++ b/media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.c
@@ -57,4 +57,33 @@
return;
}
+#ifdef BUILD_FLOAT
+void Add2_Sat_Float( const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n )
+{
+ LVM_FLOAT Temp;
+ LVM_INT16 ii;
+ for (ii = n; ii != 0; ii--)
+ {
+ Temp = ((LVM_FLOAT) *src) + ((LVM_FLOAT) *dst);
+ src++;
+
+ if (Temp > 1.000000f)
+ {
+ *dst = 1.000000f;
+ }
+ else if (Temp < -1.000000f)
+ {
+ *dst = -1.000000f;
+ }
+ else
+ {
+ *dst = Temp;
+ }
+ dst++;
+ }
+ return;
+}
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16C14_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16C14_TRC_WRA_01.c
index f4c5757..88f9986 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16C14_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16C14_TRC_WRA_01.c
@@ -33,7 +33,51 @@
pBiquadState->pDelays[2] is y(n-1)L in Q0 format
pBiquadState->pDelays[3] is y(n-2)L in Q0 format
***************************************************************************/
+#ifdef BUILD_FLOAT
+void BP_1I_D16F16C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples)
+
+ {
+ LVM_FLOAT ynL;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+
+ for (ii = NrSamples; ii != 0; ii--)
+ {
+
+
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ // ynL= (A0 * (x(n)L - x(n-2)L ) )
+ ynL = pBiquadState->coefs[0] * ((*pDataIn)-pBiquadState->pDelays[1]);
+
+ // ynL+= ((-B2 * y(n-2)L ) )
+ ynL += pBiquadState->coefs[1] * pBiquadState->pDelays[3];
+
+ // ynL+= ((-B1 * y(n-1)L ) )
+ ynL += pBiquadState->coefs[2] * pBiquadState->pDelays[2];
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[3] = pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
+ pBiquadState->pDelays[1] = pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
+ pBiquadState->pDelays[2] = ynL; // Update y(n-1)L
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++=ynL; // Write Left output
+
+ }
+
+ }
+#else
void BP_1I_D16F16C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
@@ -78,4 +122,5 @@
}
}
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Init.c
index 88914ad..27ab57a 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Init.c
@@ -38,6 +38,19 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
+#ifdef BUILD_FLOAT
+void BP_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
+ BP_FLOAT_Coefs_t *pCoef)
+{
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT *) pTaps;
+
+ pBiquadState->coefs[0] = pCoef->A0;
+ pBiquadState->coefs[1] = pCoef->B2;
+ pBiquadState->coefs[2] = pCoef->B1;
+}
+#else
void BP_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_1I_Order2_Taps_t *pTaps,
BP_C16_Coefs_t *pCoef)
@@ -49,6 +62,7 @@
pBiquadState->coefs[1]=pCoef->B2;
pBiquadState->coefs[2]=pCoef->B1;
}
+#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BP_1I_D16F16Css_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Private.h
index 980539c..e194f92 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Private.h
@@ -27,4 +27,13 @@
typedef Filter_State * PFilter_State ;
+#ifdef BUILD_FLOAT
+typedef struct _Filter_State_FLOAT
+{
+
+ LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_FLOAT coefs[3]; /* pointer to the filter coefficients */
+}Filter_State_FLOAT;
+typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
+#endif
#endif /*_BP_1I_D16F16CSS_TRC_WRA_01_PRIVATE_H_*/
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32C30_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32C30_TRC_WRA_01.c
index ba1a42f..3abdd43 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32C30_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32C30_TRC_WRA_01.c
@@ -33,7 +33,48 @@
pBiquadState->pDelays[2] is y(n-1)L in Q16 format
pBiquadState->pDelays[3] is y(n-2)L in Q16 format
***************************************************************************/
+#ifdef BUILD_FLOAT
+void BP_1I_D16F32C30_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples)
+{
+ LVM_FLOAT ynL,templ;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
+ for (ii = NrSamples; ii != 0; ii--)
+ {
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ // ynL= (A0 * (x(n)L - x(n-2)L ))
+ templ = (LVM_FLOAT) *pDataIn - pBiquadState->pDelays[1];
+ ynL = pBiquadState->coefs[0] * templ;
+
+ // ynL+= ((-B2 * y(n-2)L ) )
+ templ = pBiquadState->coefs[1] * pBiquadState->pDelays[3];
+ ynL += templ;
+
+ // ynL+= ((-B1 * y(n-1)L ))
+ templ = pBiquadState->coefs[2] * pBiquadState->pDelays[2];
+ ynL += templ;
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[3] = pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
+ pBiquadState->pDelays[1] = pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
+ pBiquadState->pDelays[2] = ynL; // Update y(n-1)L in Q16
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L in Q0
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = (ynL); // Write Left output
+ }
+}
+#else
void BP_1I_D16F32C30_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
@@ -80,4 +121,4 @@
}
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Init.c
index e833218..d6e047a 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Init.c
@@ -48,6 +48,20 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
+#ifdef BUILD_FLOAT
+void BP_1I_D16F32Cll_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
+ BP_FLOAT_Coefs_t *pCoef)
+{
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ pBiquadState->pDelays =(LVM_FLOAT *) pTaps;
+
+
+ pBiquadState->coefs[0] = pCoef->A0;
+ pBiquadState->coefs[1] = pCoef->B2;
+ pBiquadState->coefs[2] = pCoef->B1;
+}
+#else
void BP_1I_D16F32Cll_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_1I_Order2_Taps_t *pTaps,
BP_C32_Coefs_t *pCoef)
@@ -59,6 +73,7 @@
pBiquadState->coefs[1] = pCoef->B2;
pBiquadState->coefs[2] = pCoef->B1;
}
+#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BP_1I_D16F32Cll_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Private.h
index 9cca627..aa9e669 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Private.h
@@ -26,5 +26,12 @@
}Filter_State;
typedef Filter_State * PFilter_State ;
-
+#ifdef BUILD_FLOAT
+typedef struct _Filter_State_FLOAT
+{
+ LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_FLOAT coefs[3]; /* pointer to the filter coefficients */
+}Filter_State_Float;
+typedef Filter_State_Float * PFilter_State_FLOAT ;
+#endif
#endif /*_BP_1I_D16F32CLL_TRC_WRA_01_PRIVATE_H_*/
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32C30_TRC_WRA_02.c b/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32C30_TRC_WRA_02.c
index b09c1aa..abdb2f7 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32C30_TRC_WRA_02.c
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32C30_TRC_WRA_02.c
@@ -33,7 +33,52 @@
pBiquadState->pDelays[2] is y(n-1)L in Q0 format
pBiquadState->pDelays[3] is y(n-2)L in Q0 format
***************************************************************************/
+#ifdef BUILD_FLOAT
+void BP_1I_D32F32C30_TRC_WRA_02 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples)
+ {
+ LVM_FLOAT ynL,templ;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ for (ii = NrSamples; ii != 0; ii--)
+ {
+
+
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ // ynL= (A0 * (x(n)L - x(n-2)L ) )
+ templ = (*pDataIn) - pBiquadState->pDelays[1];
+ ynL = pBiquadState->coefs[0] * templ;
+
+ // ynL+= ((-B2 * y(n-2)L ) )
+ templ = pBiquadState->coefs[1] * pBiquadState->pDelays[3];
+ ynL += templ;
+
+ // ynL+= ((-B1 * y(n-1)L ) )
+ templ = pBiquadState->coefs[2] * pBiquadState->pDelays[2];
+ ynL += templ;
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[3] = pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
+ pBiquadState->pDelays[1] = pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
+ pBiquadState->pDelays[2] = ynL; // Update y(n-1)L
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = ynL; // Write Left output in Q0
+
+ }
+
+ }
+#else
void BP_1I_D32F32C30_TRC_WRA_02 ( Biquad_Instance_t *pInstance,
LVM_INT32 *pDataIn,
LVM_INT32 *pDataOut,
@@ -78,4 +123,4 @@
}
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Init.c b/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Init.c
index 9367912..5590c32 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Init.c
@@ -37,6 +37,21 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
+#ifdef BUILD_FLOAT
+void BP_1I_D32F32Cll_TRC_WRA_02_Init ( Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
+ BP_FLOAT_Coefs_t *pCoef)
+{
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ pBiquadState->pDelays =(LVM_FLOAT *) pTaps;
+
+ pBiquadState->coefs[0] = pCoef->A0;
+
+ pBiquadState->coefs[1] = pCoef->B2;
+
+ pBiquadState->coefs[2] = pCoef->B1;
+}
+#else
void BP_1I_D32F32Cll_TRC_WRA_02_Init ( Biquad_Instance_t *pInstance,
Biquad_1I_Order2_Taps_t *pTaps,
BP_C32_Coefs_t *pCoef)
@@ -50,6 +65,7 @@
pBiquadState->coefs[2]=pCoef->B1;
}
+#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BP_1I_D32F32Cll_TRC_WRA_02_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Private.h b/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Private.h
index 5cc1ce2..80c3920 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Private.h
@@ -26,5 +26,13 @@
}Filter_State;
typedef Filter_State * PFilter_State ;
+#ifdef BUILD_FLOAT
+typedef struct _Filter_State_FLOAT
+{
+ LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_FLOAT coefs[3]; /* pointer to the filter coefficients */
+}Filter_State_Float;
+typedef Filter_State_Float* PFilter_State_FLOAT ;
+#endif
#endif /*_BP_1I_D32F32CLL_TRC_WRA_02_PRIVATE_H_*/
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16C15_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16C15_TRC_WRA_01.c
index f2f8c6b..ee9bf7a 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16C15_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16C15_TRC_WRA_01.c
@@ -32,7 +32,56 @@
pBiquadState->pDelays[2] is y(n-1)L in Q0 format
pBiquadState->pDelays[3] is y(n-2)L in Q0 format
***************************************************************************/
+#ifdef BUILD_FLOAT
+void BQ_1I_D16F16C15_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples)
+ {
+ LVM_FLOAT ynL;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ for (ii = NrSamples; ii != 0; ii--)
+ {
+
+
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ // ynL=A2 * x(n-2)L
+ ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[1];
+
+ // ynL+=A1 * x(n-1)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
+
+ // ynL+=A0 * x(n)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
+
+ // ynL+= (-B2 * y(n-2)L )
+ ynL += (LVM_FLOAT)pBiquadState->coefs[3] * pBiquadState->pDelays[3];
+
+ // ynL+= (-B1 * y(n-1)L )
+ ynL += (LVM_FLOAT)pBiquadState->coefs[4] * pBiquadState->pDelays[2];
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[3] = pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
+ pBiquadState->pDelays[1] = pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
+ pBiquadState->pDelays[2] = ynL; // Update y(n-1)L
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output in Q0
+
+
+ }
+
+ }
+#else
void BQ_1I_D16F16C15_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
@@ -82,4 +131,4 @@
}
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Init.c
index baf0c1a..3d5befa 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Init.c
@@ -37,6 +37,26 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
+#ifdef BUILD_FLOAT
+void BQ_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
+ BQ_FLOAT_Coefs_t *pCoef)
+{
+ LVM_FLOAT temp;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT *) pTaps ;
+ temp = pCoef->A2;
+ pBiquadState->coefs[0] = temp;
+ temp = pCoef->A1;
+ pBiquadState->coefs[1] = temp;
+ temp = pCoef->A0;
+ pBiquadState->coefs[2] = temp;
+ temp = pCoef->B2;
+ pBiquadState->coefs[3] = temp;
+ temp = pCoef->B1;
+ pBiquadState->coefs[4] = temp;
+}
+#else
void BQ_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_1I_Order2_Taps_t *pTaps,
BQ_C16_Coefs_t *pCoef)
@@ -56,6 +76,7 @@
temp=pCoef->B1;
pBiquadState->coefs[4]=temp;
}
+#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BQ_1I_D16F16Css_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Private.h
index 909c699..811da8b 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Private.h
@@ -27,4 +27,13 @@
typedef Filter_State * PFilter_State ;
+#ifdef BUILD_FLOAT
+typedef struct _Filter_State_FLOAT
+{
+ LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
+
+}Filter_State_FLOAT;
+typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
+#endif
#endif /*_BQ_1I_D16F16CSS_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32C14_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32C14_TRC_WRA_01.c
index 92f6caf..c74a137 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32C14_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32C14_TRC_WRA_01.c
@@ -32,7 +32,54 @@
pBiquadState->pDelays[2] is y(n-1)L in Q16 format
pBiquadState->pDelays[3] is y(n-2)L in Q16 format
***************************************************************************/
+#ifdef BUILD_FLOAT
+void BQ_1I_D16F32C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples)
+ {
+ LVM_FLOAT ynL;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ for (ii = NrSamples; ii != 0; ii--)
+ {
+
+
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ // ynL=A2 * x(n-2)L
+ ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[1];
+
+ // ynL+=A1 * x(n-1)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
+
+ // ynL+=A0 * x(n)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
+
+ // ynL+= ( (-B2 * y(n-2)L )
+ ynL += pBiquadState->pDelays[3] * pBiquadState->coefs[3];
+
+ // ynL+= -B1 * y(n-1)L
+ ynL += pBiquadState->pDelays[2] * pBiquadState->coefs[4];
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[3] = pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
+ pBiquadState->pDelays[1] = pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
+ pBiquadState->pDelays[2] = ynL; // Update y(n-1)L
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = (LVM_FLOAT)(ynL); // Write Left output
+
+ }
+ }
+#else
void BQ_1I_D16F32C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
@@ -81,4 +128,4 @@
}
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_Private.h
index aea10f0..9812274 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_Private.h
@@ -27,4 +27,13 @@
typedef Filter_State * PFilter_State ;
+#ifdef BUILD_FLOAT
+typedef struct _Filter_State_FLOAT
+{
+ LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
+
+}Filter_State_FLOAT;
+typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
+#endif
#endif /*_BQ_1I_D16F32CSS_TRC_WRA_01_PRIVATE_H_*/
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_init.c b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_init.c
index 1d6be4e..feae20d 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_init.c
+++ b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_init.c
@@ -38,6 +38,27 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
+#ifdef BUILD_FLOAT
+void BQ_1I_D16F32Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
+ BQ_FLOAT_Coefs_t *pCoef)
+{
+ LVM_FLOAT temp;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT *)pTaps;
+
+ temp = pCoef->A2;
+ pBiquadState->coefs[0] = temp;
+ temp = pCoef->A1;
+ pBiquadState->coefs[1] = temp;
+ temp = pCoef->A0;
+ pBiquadState->coefs[2] = temp;
+ temp = pCoef->B2;
+ pBiquadState->coefs[3] = temp;
+ temp = pCoef->B1;
+ pBiquadState->coefs[4] = temp;
+}
+#else
void BQ_1I_D16F32Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_1I_Order2_Taps_t *pTaps,
BQ_C16_Coefs_t *pCoef)
@@ -57,6 +78,7 @@
temp=pCoef->B1;
pBiquadState->coefs[4]=temp;
}
+#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BQ_1I_D16F32Css_TRC_WRA_01_Init */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C14_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C14_TRC_WRA_01.c
index 972e704..9b0fde3 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C14_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C14_TRC_WRA_01.c
@@ -37,7 +37,81 @@
pBiquadState->pDelays[6] is y(n-2)L in Q0 format
pBiquadState->pDelays[7] is y(n-2)R in Q0 format
***************************************************************************/
+#ifdef BUILD_FLOAT
+void BQ_2I_D16F16C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples)
+ {
+ LVM_FLOAT ynL,ynR;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ for (ii = NrSamples; ii != 0; ii--)
+ {
+
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ // ynL=A2 * x(n-2)L
+ ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[2];
+
+ // ynL+=A1 * x(n-1)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
+
+ // ynL+=A0 * x(n)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
+
+ // ynL+= ( -B2 * y(n-2)L )
+ ynL += (LVM_FLOAT)pBiquadState->coefs[3] * pBiquadState->pDelays[6];
+
+ // ynL+=( -B1 * y(n-1)L )
+ ynL += (LVM_FLOAT)pBiquadState->coefs[4] * pBiquadState->pDelays[4];
+
+
+
+ /**************************************************************************
+ PROCESSING OF THE RIGHT CHANNEL
+ ***************************************************************************/
+ // ynR=A2 * x(n-2)R
+ ynR = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[3];
+
+ // ynR+=A1 * x(n-1)R
+ ynR += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[1];
+
+ // ynR+=A0 * x(n)R
+ ynR += (LVM_FLOAT)pBiquadState->coefs[2] * (*(pDataIn+1));
+
+ // ynR+= ( -B2 * y(n-2)R )
+ ynR += (LVM_FLOAT)pBiquadState->coefs[3] * pBiquadState->pDelays[7];
+
+ // ynR+=( -B1 * y(n-1)R )
+ ynR += (LVM_FLOAT)pBiquadState->coefs[4] * pBiquadState->pDelays[5];
+
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[7] = pBiquadState->pDelays[5]; // y(n-2)R=y(n-1)R
+ pBiquadState->pDelays[6] = pBiquadState->pDelays[4]; // y(n-2)L=y(n-1)L
+ pBiquadState->pDelays[3] = pBiquadState->pDelays[1]; // x(n-2)R=x(n-1)R
+ pBiquadState->pDelays[2] = pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
+ pBiquadState->pDelays[5] = ynR; // Update y(n-1)R
+ pBiquadState->pDelays[4] = ynL; // Update y(n-1)L
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
+ pBiquadState->pDelays[1] = (*pDataIn++); // Update x(n-1)R
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output
+ *pDataOut++ = (LVM_FLOAT)ynR; // Write Right ouput
+
+
+ }
+
+ }
+#else
void BQ_2I_D16F16C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
@@ -112,3 +186,4 @@
}
+#endif
\ No newline at end of file
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C15_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C15_TRC_WRA_01.c
index e056373..f24db8f 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C15_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C15_TRC_WRA_01.c
@@ -37,7 +37,81 @@
pBiquadState->pDelays[6] is y(n-2)L in Q0 format
pBiquadState->pDelays[7] is y(n-2)R in Q0 format
***************************************************************************/
+#ifdef BUILD_FLOAT
+void BQ_2I_D16F16C15_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples)
+ {
+ LVM_FLOAT ynL,ynR;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ for (ii = NrSamples; ii != 0; ii--)
+ {
+
+
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ // ynL=A2 * x(n-2)L
+ ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[2];
+
+ // ynL+=A1 * x(n-1)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
+
+ // ynL+=A0 * x(n)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
+
+ // ynL+= ( -B2 * y(n-2)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[3] * pBiquadState->pDelays[6];
+
+ // ynL+=( -B1 * y(n-1)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[4] * pBiquadState->pDelays[4];
+
+
+
+ /**************************************************************************
+ PROCESSING OF THE RIGHT CHANNEL
+ ***************************************************************************/
+ // ynR=A2 * x(n-2)R
+ ynR = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[3];
+
+ // ynR+=A1 * x(n-1)R
+ ynR += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[1];
+
+ // ynR+=A0 * x(n)R
+ ynR += (LVM_FLOAT)pBiquadState->coefs[2] * (*(pDataIn+1));
+
+ // ynR+= ( -B2 * y(n-2)R )
+ ynR += (LVM_FLOAT)pBiquadState->coefs[3] * pBiquadState->pDelays[7];
+
+ // ynR+=( -B1 * y(n-1)R )
+ ynR += (LVM_FLOAT)pBiquadState->coefs[4] * pBiquadState->pDelays[5];
+
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[7] = pBiquadState->pDelays[5]; // y(n-2)R=y(n-1)R
+ pBiquadState->pDelays[6] = pBiquadState->pDelays[4]; // y(n-2)L=y(n-1)L
+ pBiquadState->pDelays[3] = pBiquadState->pDelays[1]; // x(n-2)R=x(n-1)R
+ pBiquadState->pDelays[2] = pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
+ pBiquadState->pDelays[5] = ynR; // Update y(n-1)R
+ pBiquadState->pDelays[4] = ynL; // Update y(n-1)L
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
+ pBiquadState->pDelays[1] = (*pDataIn++); // Update x(n-1)R
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output
+ *pDataOut++ = (LVM_FLOAT)ynR; // Write Right ouput
+
+ }
+
+ }
+#else
void BQ_2I_D16F16C15_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
@@ -111,4 +185,4 @@
}
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Init.c
index 0a8ac35..39e1bda 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Init.c
@@ -38,6 +38,27 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
+#ifdef BUILD_FLOAT
+void BQ_2I_D16F16Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
+ BQ_FLOAT_Coefs_t *pCoef)
+{
+ LVM_FLOAT temp;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT *) pTaps ;
+
+ temp = pCoef->A2;
+ pBiquadState->coefs[0] = temp;
+ temp = pCoef->A1;
+ pBiquadState->coefs[1] = temp;
+ temp = pCoef->A0;
+ pBiquadState->coefs[2] = temp;
+ temp = pCoef->B2;
+ pBiquadState->coefs[3] = temp;
+ temp = pCoef->B1;
+ pBiquadState->coefs[4] = temp;
+}
+#else
void BQ_2I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_2I_Order2_Taps_t *pTaps,
BQ_C16_Coefs_t *pCoef)
@@ -57,6 +78,7 @@
temp=pCoef->B1;
pBiquadState->coefs[4]=temp;
}
+#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BQ_2I_D16F16Css_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Private.h
index 7d42ced..0691b8c 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Private.h
@@ -28,4 +28,14 @@
typedef Filter_State * PFilter_State ;
+#ifdef BUILD_FLOAT
+typedef struct _Filter_State_FLOAT
+{
+ LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
+
+}Filter_State_FLOAT;
+typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
+#endif
+
#endif /* _BQ_2I_D16F16CSS_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C13_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C13_TRC_WRA_01.c
index 4a0cce4..61c07c7 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C13_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C13_TRC_WRA_01.c
@@ -37,7 +37,79 @@
pBiquadState->pDelays[6] is y(n-2)L in Q16 format
pBiquadState->pDelays[7] is y(n-2)R in Q16 format
***************************************************************************/
+#ifdef BUILD_FLOAT
+void BQ_2I_D16F32C13_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples)
+ {
+ LVM_FLOAT ynL,ynR;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ for (ii = NrSamples; ii != 0; ii--)
+ {
+
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ /* ynL=A2 * x(n-2)L */
+ ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[2];
+
+ /* ynL+=A1* x(n-1)L */
+ ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
+
+ /* ynL+=A0* x(n)L */
+ ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
+
+ /* ynL+=-B2*y(n-2)L */
+ ynL += pBiquadState->pDelays[6] * pBiquadState->coefs[3];
+
+ /* ynL+=-B1*y(n-1)L */
+ ynL += pBiquadState->pDelays[4] * pBiquadState->coefs[4];
+
+ /**************************************************************************
+ PROCESSING OF THE RIGHT CHANNEL
+ ***************************************************************************/
+ /* ynR=A2 * x(n-2)R */
+ ynR = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[3];
+
+ /* ynR+=A1* x(n-1)R */
+ ynR += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[1];
+
+ /* ynR+=A0* x(n)R */
+ ynR += (LVM_FLOAT)pBiquadState->coefs[2] * (*(pDataIn+1));
+
+ /* ynR+=-B2 * y(n-2)R */
+ ynR += pBiquadState->pDelays[7] * pBiquadState->coefs[3];
+
+ /* ynR+=-B1 * y(n-1)R */
+ ynR += pBiquadState->pDelays[5] * pBiquadState->coefs[4];
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[7] = pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
+ pBiquadState->pDelays[6] = pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
+ pBiquadState->pDelays[3] = pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
+ pBiquadState->pDelays[2] = pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
+ pBiquadState->pDelays[5] = ynR; /* Update y(n-1)R */
+ pBiquadState->pDelays[4] = ynL; /* Update y(n-1)L */
+ pBiquadState->pDelays[0] = (*pDataIn); /* Update x(n-1)L */
+ pDataIn++;
+ pBiquadState->pDelays[1] = (*pDataIn); /* Update x(n-1)R */
+ pDataIn++;
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut = (LVM_FLOAT)(ynL); /* Write Left output */
+ pDataOut++;
+ *pDataOut = (LVM_FLOAT)(ynR); /* Write Right ouput */
+ pDataOut++;
+ }
+ }
+#else
void BQ_2I_D16F32C13_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
@@ -115,4 +187,4 @@
}
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C14_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C14_TRC_WRA_01.c
index 052e2a0..cf19e06 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C14_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C14_TRC_WRA_01.c
@@ -36,7 +36,82 @@
pBiquadState->pDelays[6] is y(n-2)L in Q16 format
pBiquadState->pDelays[7] is y(n-2)R in Q16 format
***************************************************************************/
+#ifdef BUILD_FLOAT
+void BQ_2I_D16F32C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples)
+ {
+ LVM_FLOAT ynL,ynR;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ for (ii = NrSamples; ii != 0; ii--)
+ {
+
+
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ /* ynL=A2 * x(n-2)L */
+ ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[2];
+
+ /* ynL+=A1 * x(n-1)L */
+ ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
+
+ /* ynL+=A0 * x(n)L */
+ ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
+
+ /* ynL+= ( (-B2 * y(n-2)L ))*/
+ ynL += pBiquadState->pDelays[6] * pBiquadState->coefs[3];
+
+
+ /* ynL+=( (-B1 * y(n-1)L )) */
+ ynL += pBiquadState->pDelays[4] * pBiquadState->coefs[4];
+
+ /**************************************************************************
+ PROCESSING OF THE RIGHT CHANNEL
+ ***************************************************************************/
+ /* ynR=A2 * x(n-2)R */
+ ynR = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[3];
+
+ /* ynR+=A1 * x(n-1)R */
+ ynR += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[1];
+
+ /* ynR+=A0 * x(n)R */
+ ynR += (LVM_FLOAT)pBiquadState->coefs[2] * (*(pDataIn+1));
+
+ /* ynR+= ( (-B2 * y(n-2)R ))*/
+ ynR += pBiquadState->pDelays[7] * pBiquadState->coefs[3];
+
+ /* ynR+=( (-B1 * y(n-1)R )) */
+ ynR += pBiquadState->pDelays[5] * pBiquadState->coefs[4];
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[7] = pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
+ pBiquadState->pDelays[6] = pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
+ pBiquadState->pDelays[3] = pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
+ pBiquadState->pDelays[2] = pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
+ pBiquadState->pDelays[5] = ynR; /* Update y(n-1)R */
+ pBiquadState->pDelays[4] = ynL; /* Update y(n-1)L */
+ pBiquadState->pDelays[0] = (*pDataIn); /* Update x(n-1)L */
+ pDataIn++;
+ pBiquadState->pDelays[1] = (*pDataIn); /* Update x(n-1)R */
+ pDataIn++;
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut = (LVM_FLOAT)(ynL); /* Write Left output */
+ pDataOut++;
+ *pDataOut = (LVM_FLOAT)(ynR); /* Write Right ouput */
+ pDataOut++;
+ }
+
+ }
+#else
void BQ_2I_D16F32C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
@@ -114,4 +189,4 @@
}
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C15_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C15_TRC_WRA_01.c
index 8c741e1..2611b19 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C15_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C15_TRC_WRA_01.c
@@ -36,7 +36,84 @@
pBiquadState->pDelays[6] is y(n-2)L in Q16 format
pBiquadState->pDelays[7] is y(n-2)R in Q16 format
***************************************************************************/
+#ifdef BUILD_FLOAT
+void BQ_2I_D16F32C15_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples)
+ {
+ LVM_FLOAT ynL,ynR;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ for (ii = NrSamples; ii != 0; ii--)
+ {
+
+
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ /* ynL=A2 * x(n-2)L */
+ ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[2];
+
+ /* ynL+=A1 * x(n-1)L */
+ ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
+
+ /* ynL+=A0 * x(n)L */
+ ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
+
+ /* ynL+= ( (-B2 * y(n-2)L ) */
+ ynL += pBiquadState->pDelays[6] * pBiquadState->coefs[3];
+
+
+ /* ynL+=( (-B1 * y(n-1)L )) */
+ ynL += pBiquadState->pDelays[4] * pBiquadState->coefs[4];
+
+
+ /**************************************************************************
+ PROCESSING OF THE RIGHT CHANNEL
+ ***************************************************************************/
+ /* ynR=A2 * x(n-2)R */
+ ynR = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[3];
+
+ /* ynR+=A1 * x(n-1)R */
+ ynR += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[1];
+
+ /* ynR+=A0 * x(n)R */
+ ynR += (LVM_FLOAT)pBiquadState->coefs[2] * (*(pDataIn+1));
+
+ /* ynR+= ( (-B2 * y(n-2)R ) */
+ ynR += pBiquadState->pDelays[7] * pBiquadState->coefs[3];
+
+
+ /* ynR+=( (-B1 * y(n-1)R )) in Q15 */
+ ynR += pBiquadState->pDelays[5] * pBiquadState->coefs[4];
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[7] = pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
+ pBiquadState->pDelays[6] = pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
+ pBiquadState->pDelays[3] = pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
+ pBiquadState->pDelays[2] = pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
+ pBiquadState->pDelays[5] = ynR; /* Update y(n-1)R*/
+ pBiquadState->pDelays[4] = ynL; /* Update y(n-1)L*/
+ pBiquadState->pDelays[0] = (*pDataIn); /* Update x(n-1)L*/
+ pDataIn++;
+ pBiquadState->pDelays[1] = (*pDataIn); /* Update x(n-1)R*/
+ pDataIn++;
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut = (LVM_FLOAT)(ynL); /* Write Left output*/
+ pDataOut++;
+ *pDataOut = (LVM_FLOAT)(ynR); /* Write Right ouput*/
+ pDataOut++;
+ }
+
+ }
+#else
void BQ_2I_D16F32C15_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
@@ -114,4 +191,4 @@
}
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_Private.h
index 4f0cf67..c0319c9 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_Private.h
@@ -28,4 +28,14 @@
typedef Filter_State * PFilter_State ;
+#ifdef BUILD_FLOAT
+typedef struct _Filter_State_FLOAT
+{
+ LVM_FLOAT * pDelays; /* pointer to the delayed samples \
+ (data of 32 bits) */
+ LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
+}Filter_State_FLOAT;
+typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
+#endif
+
#endif /* _BQ_2I_D16F32CSS_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_init.c b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_init.c
index 4591ee0..4d9bbfe 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_init.c
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_init.c
@@ -37,6 +37,26 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
+#ifdef BUILD_FLOAT
+void BQ_2I_D16F32Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
+ BQ_FLOAT_Coefs_t *pCoef)
+{
+ LVM_FLOAT temp;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT *) pTaps;
+ temp = pCoef->A2;
+ pBiquadState->coefs[0] = temp;
+ temp = pCoef->A1;
+ pBiquadState->coefs[1] = temp;
+ temp = pCoef->A0;
+ pBiquadState->coefs[2] = temp;
+ temp = pCoef->B2;
+ pBiquadState->coefs[3] = temp;
+ temp = pCoef->B1;
+ pBiquadState->coefs[4] = temp;
+}
+#else
void BQ_2I_D16F32Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_2I_Order2_Taps_t *pTaps,
BQ_C16_Coefs_t *pCoef)
@@ -56,6 +76,7 @@
temp=pCoef->B1;
pBiquadState->coefs[4]=temp;
}
+#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BQ_2I_D16F32Css_TRC_WRA_01_Init */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32C30_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32C30_TRC_WRA_01.c
index fd8212e4..960de79 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32C30_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32C30_TRC_WRA_01.c
@@ -36,7 +36,94 @@
pBiquadState->pDelays[6] is y(n-2)L in Q0 format
pBiquadState->pDelays[7] is y(n-2)R in Q0 format
***************************************************************************/
+#ifdef BUILD_FLOAT
+void BQ_2I_D32F32C30_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples)
+
+ {
+ LVM_FLOAT ynL,ynR,templ,tempd;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+
+ for (ii = NrSamples; ii != 0; ii--)
+ {
+
+
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ /* ynL= ( A2 * x(n-2)L ) */
+ ynL = pBiquadState->coefs[0] * pBiquadState->pDelays[2];
+
+ /* ynL+= ( A1 * x(n-1)L )*/
+ templ = pBiquadState->coefs[1] * pBiquadState->pDelays[0];
+ ynL += templ;
+
+ /* ynL+= ( A0 * x(n)L ) */
+ templ = pBiquadState->coefs[2] * (*pDataIn);
+ ynL += templ;
+
+ /* ynL+= (-B2 * y(n-2)L ) */
+ templ = pBiquadState->coefs[3] * pBiquadState->pDelays[6];
+ ynL += templ;
+
+ /* ynL+= (-B1 * y(n-1)L )*/
+ templ = pBiquadState->coefs[4] * pBiquadState->pDelays[4];
+ ynL += templ;
+
+ /**************************************************************************
+ PROCESSING OF THE RIGHT CHANNEL
+ ***************************************************************************/
+ /* ynR= ( A2 * x(n-2)R ) */
+ ynR = pBiquadState->coefs[0] * pBiquadState->pDelays[3];
+
+ /* ynR+= ( A1 * x(n-1)R ) */
+ templ = pBiquadState->coefs[1] * pBiquadState->pDelays[1];
+ ynR += templ;
+
+ /* ynR+= ( A0 * x(n)R ) */
+ tempd =* (pDataIn+1);
+ templ = pBiquadState->coefs[2] * tempd;
+ ynR += templ;
+
+ /* ynR+= (-B2 * y(n-2)R ) */
+ templ = pBiquadState->coefs[3] * pBiquadState->pDelays[7];
+ ynR += templ;
+
+ /* ynR+= (-B1 * y(n-1)R ) */
+ templ = pBiquadState->coefs[4] * pBiquadState->pDelays[5];
+ ynR += templ;
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[7] = pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
+ pBiquadState->pDelays[6] = pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
+ pBiquadState->pDelays[3] = pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
+ pBiquadState->pDelays[2] = pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
+ pBiquadState->pDelays[5] = (LVM_FLOAT)ynR; /* Update y(n-1)R */
+ pBiquadState->pDelays[4] = (LVM_FLOAT)ynL; /* Update y(n-1)L */
+ pBiquadState->pDelays[0] = (*pDataIn); /* Update x(n-1)L */
+ pDataIn++;
+ pBiquadState->pDelays[1] = (*pDataIn); /* Update x(n-1)R */
+ pDataIn++;
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut = (LVM_FLOAT)ynL; /* Write Left output */
+ pDataOut++;
+ *pDataOut = (LVM_FLOAT)ynR; /* Write Right ouput */
+ pDataOut++;
+
+
+ }
+
+ }
+#else
void BQ_2I_D32F32C30_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT32 *pDataIn,
LVM_INT32 *pDataOut,
@@ -123,4 +210,4 @@
}
}
-
+#endif /*BUILD_FLOAT*/
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Init.c
index 1709f71..fff05ed 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Init.c
@@ -37,6 +37,26 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
+#ifdef BUILD_FLOAT
+void BQ_2I_D32F32Cll_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
+ BQ_FLOAT_Coefs_t *pCoef)
+{
+ LVM_FLOAT temp;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT *) pTaps;
+ temp = pCoef->A2;
+ pBiquadState->coefs[0] = temp;
+ temp = pCoef->A1;
+ pBiquadState->coefs[1] = temp;
+ temp = pCoef->A0;
+ pBiquadState->coefs[2] = temp;
+ temp = pCoef->B2;
+ pBiquadState->coefs[3] = temp;
+ temp = pCoef->B1;
+ pBiquadState->coefs[4] = temp;
+}
+#else
void BQ_2I_D32F32Cll_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_2I_Order2_Taps_t *pTaps,
BQ_C32_Coefs_t *pCoef)
@@ -56,6 +76,7 @@
temp=pCoef->B1;
pBiquadState->coefs[4]=temp;
}
+#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BQ_2I_D32F32C32_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Private.h
index 747af6a..c0f0dcc 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Private.h
@@ -29,4 +29,14 @@
typedef Filter_State * PFilter_State ;
+#ifdef BUILD_FLOAT
+typedef struct _Filter_State_FLOAT
+{
+ LVM_FLOAT * pDelays; /* pointer to the delayed samples \
+ (data of 32 bits) */
+ LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
+}Filter_State_FLOAT;
+typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
+#endif
+
#endif /* _BQ_2I_D32F32CLL_TRC_WRA_01_PRIVATE_H_*/
diff --git a/media/libeffects/lvm/lib/Common/src/Copy_16.c b/media/libeffects/lvm/lib/Common/src/Copy_16.c
index 20404ad..e489031 100644
--- a/media/libeffects/lvm/lib/Common/src/Copy_16.c
+++ b/media/libeffects/lvm/lib/Common/src/Copy_16.c
@@ -54,5 +54,35 @@
return;
}
+#ifdef BUILD_FLOAT
+void Copy_Float( const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n )
+{
+ LVM_INT16 ii;
+ if (src > dst)
+ {
+ for (ii = n; ii != 0; ii--)
+ {
+ *dst = *src;
+ dst++;
+ src++;
+ }
+ }
+ else
+ {
+ src += n - 1;
+ dst += n - 1;
+ for (ii = n; ii != 0; ii--)
+ {
+ *dst = *src;
+ dst--;
+ src--;
+ }
+ }
+
+ return;
+}
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Core_MixHard_2St_D32C31_SAT.c b/media/libeffects/lvm/lib/Common/src/Core_MixHard_2St_D32C31_SAT.c
index bf69e35..ea98041 100644
--- a/media/libeffects/lvm/lib/Common/src/Core_MixHard_2St_D32C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/Core_MixHard_2St_D32C31_SAT.c
@@ -25,7 +25,37 @@
/**********************************************************************************
FUNCTION CORE_MIXHARD_2ST_D32C31_SAT
***********************************************************************************/
+#ifdef BUILD_FLOAT
+void Core_MixHard_2St_D32C31_SAT( Mix_2St_Cll_FLOAT_t *pInstance,
+ const LVM_FLOAT *src1,
+ const LVM_FLOAT *src2,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ LVM_FLOAT Temp1,Temp2,Temp3;
+ LVM_INT16 ii;
+ LVM_FLOAT Current1Short;
+ LVM_FLOAT Current2Short;
+ Current1Short = (pInstance->Current1);
+ Current2Short = (pInstance->Current2);
+
+ for (ii = n; ii != 0; ii--){
+ Temp1 = *src1++;
+ Temp3 = Temp1 * Current1Short;
+ Temp2 = *src2++;
+ Temp1 = Temp2 * Current2Short;
+ Temp2 = (Temp1 / 2.0f) + (Temp3 / 2.0f);
+ if (Temp2 > 0.5f)
+ Temp2 = 1.0f;
+ else if (Temp2 < -0.5f )
+ Temp2 = -1.0f;
+ else
+ Temp2 = (Temp2 * 2);
+ *dst++ = Temp2;
+ }
+}
+#else
void Core_MixHard_2St_D32C31_SAT( Mix_2St_Cll_t *pInstance,
const LVM_INT32 *src1,
const LVM_INT32 *src2,
@@ -55,6 +85,5 @@
*dst++ = Temp2;
}
}
-
-
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Core_MixInSoft_D32C31_SAT.c b/media/libeffects/lvm/lib/Common/src/Core_MixInSoft_D32C31_SAT.c
index 3471f05..2814f19 100644
--- a/media/libeffects/lvm/lib/Common/src/Core_MixInSoft_D32C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/Core_MixInSoft_D32C31_SAT.c
@@ -26,6 +26,70 @@
FUNCTION CORE_MIXSOFT_1ST_D32C31_WRA
***********************************************************************************/
+#ifdef BUILD_FLOAT /* BUILD_FLOAT */
+void Core_MixInSoft_D32C31_SAT( Mix_1St_Cll_FLOAT_t *pInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ LVM_FLOAT Temp1,Temp2,Temp3;
+ LVM_INT16 OutLoop;
+ LVM_INT16 InLoop;
+ LVM_FLOAT TargetTimesOneMinAlpha;
+ LVM_FLOAT CurrentTimesAlpha;
+ LVM_INT16 ii,jj;
+
+
+ InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
+ OutLoop = (LVM_INT16)(n - (InLoop << 2));
+
+ TargetTimesOneMinAlpha = ((1.0f -pInstance->Alpha) * pInstance->Target);
+ if (pInstance->Target >= pInstance->Current){
+ TargetTimesOneMinAlpha +=(LVM_FLOAT)(2.0f / 2147483647.0f); /* Ceil*/
+ }
+
+ if (OutLoop){
+
+ CurrentTimesAlpha = pInstance->Current * pInstance->Alpha;
+ pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha;
+
+ for (ii = OutLoop; ii != 0; ii--){
+ Temp1 = *src++;
+ Temp2 = *dst;
+
+ Temp3 = Temp1 * (pInstance->Current);
+ Temp1 = Temp2 + Temp3;
+
+ if (Temp1 > 1.0f)
+ Temp1 = 1.0f;
+ else if (Temp1 < -1.0f)
+ Temp1 = -1.0f;
+
+ *dst++ = Temp1;
+ }
+ }
+
+ for (ii = InLoop; ii != 0; ii--){
+
+ CurrentTimesAlpha = pInstance->Current * pInstance->Alpha;
+ pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha;
+
+ for (jj = 4; jj!=0 ; jj--){
+ Temp1 = *src++;
+ Temp2 = *dst;
+
+ Temp3 = Temp1 * (pInstance->Current);
+ Temp1 = Temp2 + Temp3;
+
+ if (Temp1 > 1.0f)
+ Temp1 = 1.0f;
+ else if (Temp1 < -1.0f)
+ Temp1 = -1.0f;
+ *dst++ = Temp1;
+ }
+ }
+}
+#else
void Core_MixInSoft_D32C31_SAT( Mix_1St_Cll_t *pInstance,
const LVM_INT32 *src,
LVM_INT32 *dst,
@@ -89,6 +153,5 @@
}
}
}
-
-
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Core_MixSoft_1St_D32C31_WRA.c b/media/libeffects/lvm/lib/Common/src/Core_MixSoft_1St_D32C31_WRA.c
index 709c304..814ccee 100644
--- a/media/libeffects/lvm/lib/Common/src/Core_MixSoft_1St_D32C31_WRA.c
+++ b/media/libeffects/lvm/lib/Common/src/Core_MixSoft_1St_D32C31_WRA.c
@@ -25,7 +25,79 @@
/**********************************************************************************
FUNCTION CORE_MIXSOFT_1ST_D32C31_WRA
***********************************************************************************/
+#ifdef BUILD_FLOAT
+void Core_MixSoft_1St_D32C31_WRA( Mix_1St_Cll_FLOAT_t *pInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ LVM_FLOAT Temp1,Temp2;
+ LVM_INT16 OutLoop;
+ LVM_INT16 InLoop;
+ LVM_FLOAT TargetTimesOneMinAlpha;
+ LVM_FLOAT CurrentTimesAlpha;
+ LVM_INT16 ii;
+
+ InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
+ OutLoop = (LVM_INT16)(n - (InLoop << 2));
+
+ TargetTimesOneMinAlpha = (1.0f - pInstance->Alpha) * pInstance->Target; /* float * float in float */
+ if (pInstance->Target >= pInstance->Current)
+ {
+ TargetTimesOneMinAlpha += (LVM_FLOAT)(2.0f / 2147483647.0f); /* Ceil*/
+ }
+
+ if (OutLoop != 0)
+ {
+ CurrentTimesAlpha = (pInstance->Current * pInstance->Alpha);
+ pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha;
+
+ for (ii = OutLoop; ii != 0; ii--)
+ {
+ Temp1 = *src;
+ src++;
+
+ Temp2 = Temp1 * (pInstance->Current);
+ *dst = Temp2;
+ dst++;
+ }
+ }
+
+ for (ii = InLoop; ii != 0; ii--)
+ {
+ CurrentTimesAlpha = pInstance->Current * pInstance->Alpha;
+ pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha;
+
+ Temp1 = *src;
+ src++;
+
+ Temp2 = Temp1 * (pInstance->Current);
+ *dst = Temp2;
+ dst++;
+
+ Temp1 = *src;
+ src++;
+
+ Temp2 = Temp1 * (pInstance->Current);
+ *dst = Temp2;
+ dst++;
+
+ Temp1 = *src;
+ src++;
+
+ Temp2 = Temp1 * (pInstance->Current);
+ *dst = Temp2;
+ dst++;
+
+ Temp1 = *src;
+ src++;
+ Temp2 = Temp1 * (pInstance->Current);
+ *dst = Temp2;
+ dst++;
+ }
+}
+#else
void Core_MixSoft_1St_D32C31_WRA( Mix_1St_Cll_t *pInstance,
const LVM_INT32 *src,
LVM_INT32 *dst,
@@ -98,6 +170,5 @@
dst++;
}
}
-
-
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01.c
index 49fa184..d261c9e 100644
--- a/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01.c
@@ -18,7 +18,53 @@
#include "BIQUAD.h"
#include "DC_2I_D16_TRC_WRA_01_Private.h"
#include "LVM_Macros.h"
+#ifdef BUILD_FLOAT
+void DC_2I_D16_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples)
+ {
+ LVM_FLOAT LeftDC,RightDC;
+ LVM_FLOAT Diff;
+ LVM_INT32 j;
+ PFilter_FLOAT_State pBiquadState = (PFilter_FLOAT_State) pInstance;
+ LeftDC = pBiquadState->LeftDC;
+ RightDC = pBiquadState->RightDC;
+ for(j = NrSamples-1; j >= 0; j--)
+ {
+ /* Subtract DC an saturate */
+ Diff =* (pDataIn++) - (LeftDC);
+ if (Diff > 1.0f) {
+ Diff = 1.0f; }
+ else if (Diff < -1.0f) {
+ Diff = -1.0f; }
+ *(pDataOut++) = (LVM_FLOAT)Diff;
+ if (Diff < 0) {
+ LeftDC -= DC_FLOAT_STEP; }
+ else {
+ LeftDC += DC_FLOAT_STEP; }
+
+
+ /* Subtract DC an saturate */
+ Diff =* (pDataIn++) - (RightDC);
+ if (Diff > 1.0f) {
+ Diff = 1.0f; }
+ else if (Diff < -1.0f) {
+ Diff = -1.0f; }
+ *(pDataOut++) = (LVM_FLOAT)Diff;
+ if (Diff < 0) {
+ RightDC -= DC_FLOAT_STEP; }
+ else {
+ RightDC += DC_FLOAT_STEP; }
+
+ }
+ pBiquadState->LeftDC = LeftDC;
+ pBiquadState->RightDC = RightDC;
+
+
+ }
+#else
void DC_2I_D16_TRC_WRA_01( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
@@ -64,4 +110,4 @@
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Init.c
index 468a88d..4f4fcd8 100644
--- a/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Init.c
@@ -17,11 +17,18 @@
#include "BIQUAD.h"
#include "DC_2I_D16_TRC_WRA_01_Private.h"
-
+#ifdef BUILD_FLOAT
+void DC_2I_D16_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t *pInstance)
+{
+ PFilter_FLOAT_State pBiquadState = (PFilter_FLOAT_State) pInstance;
+ pBiquadState->LeftDC = 0.0f;
+ pBiquadState->RightDC = 0.0f;
+}
+#else
void DC_2I_D16_TRC_WRA_01_Init(Biquad_Instance_t *pInstance)
{
PFilter_State pBiquadState = (PFilter_State) pInstance;
pBiquadState->LeftDC = 0;
pBiquadState->RightDC = 0;
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Private.h
index 89a4e68..fa6b729 100644
--- a/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Private.h
@@ -18,11 +18,23 @@
#ifndef _DC_2I_D16_TRC_WRA_01_PRIVATE_H_
#define _DC_2I_D16_TRC_WRA_01_PRIVATE_H_
+#ifdef BUILD_FLOAT
+#define DC_FLOAT_STEP 0.0000002384f;
+#else
#define DC_D16_STEP 0x200;
+#endif
/* The internal state variables are implemented in a (for the user) hidden structure */
/* In this (private) file, the internal structure is declared fro private use.*/
+#ifdef BUILD_FLOAT
+typedef struct _Filter_FLOAT_State_
+{
+ LVM_FLOAT LeftDC; /* LeftDC */
+ LVM_FLOAT RightDC; /* RightDC */
+}Filter_FLOAT_State;
+typedef Filter_FLOAT_State * PFilter_FLOAT_State ;
+#else
typedef struct _Filter_State_
{
LVM_INT32 LeftDC; /* LeftDC */
@@ -30,5 +42,5 @@
}Filter_State;
typedef Filter_State * PFilter_State ;
-
+#endif
#endif /* _DC_2I_D16_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/DelayMix_16x16.c b/media/libeffects/lvm/lib/Common/src/DelayMix_16x16.c
index 7e3182d..f502716 100644
--- a/media/libeffects/lvm/lib/Common/src/DelayMix_16x16.c
+++ b/media/libeffects/lvm/lib/Common/src/DelayMix_16x16.c
@@ -36,10 +36,55 @@
LVM_INT16 Offset = *pOffset;
LVM_INT16 temp;
+ for (i = 0; i < n; i++)
+ {
+ /* Left channel */
+ temp = (LVM_INT16)((LVM_UINT32)((LVM_INT32)(*dst) + (LVM_INT32)delay[Offset]) >> 1);
+ *dst = temp;
+ dst++;
+
+ delay[Offset] = *src;
+ Offset++;
+ src++;
+
+
+ /* Right channel */
+ temp = (LVM_INT16)((LVM_UINT32)((LVM_INT32)(*dst) - (LVM_INT32)delay[Offset]) >> 1);
+ *dst = temp;
+ dst++;
+
+ delay[Offset] = *src;
+ Offset++;
+ src++;
+
+ /* Make the reverb delay buffer a circular buffer */
+ if (Offset >= size)
+ {
+ Offset = 0;
+ }
+ }
+
+ /* Update the offset */
+ *pOffset = Offset;
+
+ return;
+}
+#ifdef BUILD_FLOAT
+void DelayMix_Float(const LVM_FLOAT *src, /* Source 1, to be delayed */
+ LVM_FLOAT *delay, /* Delay buffer */
+ LVM_INT16 size, /* Delay size */
+ LVM_FLOAT *dst, /* Source/destination */
+ LVM_INT16 *pOffset, /* Delay offset */
+ LVM_INT16 n) /* Number of stereo samples */
+{
+ LVM_INT16 i;
+ LVM_INT16 Offset = *pOffset;
+ LVM_FLOAT temp;
+
for (i=0; i<n; i++)
{
/* Left channel */
- temp = (LVM_INT16)((LVM_UINT32)((LVM_INT32)(*dst) + (LVM_INT32)delay[Offset]) >> 1);
+ temp = (LVM_FLOAT)((LVM_FLOAT)(*dst + (LVM_FLOAT)delay[Offset]) / 2.0f);
*dst = temp;
dst++;
@@ -49,7 +94,7 @@
/* Right channel */
- temp = (LVM_INT16)((LVM_UINT32)((LVM_INT32)(*dst) - (LVM_INT32)delay[Offset]) >> 1);
+ temp = (LVM_FLOAT)((LVM_FLOAT)(*dst - (LVM_FLOAT)delay[Offset]) / 2.0f);
*dst = temp;
dst++;
@@ -69,5 +114,5 @@
return;
}
-
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16C15_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16C15_TRC_WRA_01.c
index de77361..039c88c 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16C15_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16C15_TRC_WRA_01.c
@@ -31,6 +31,46 @@
pBiquadState->pDelays[1] is y(n-1)L in Q0 format
***************************************************************************/
+#ifdef BUILD_FLOAT
+void FO_1I_D16F16C15_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples)
+ {
+ LVM_FLOAT ynL;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+
+ for (ii = NrSamples; ii != 0; ii--)
+ {
+
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ // ynL=A1 * x(n-1)L
+ ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[0];
+
+ // ynL+=A0 * x(n)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[1] * (*pDataIn);
+
+ // ynL+= (-B1 * y(n-1)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[2] * pBiquadState->pDelays[1];
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[1] = ynL; // Update y(n-1)L
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output
+
+ }
+
+ }
+#else
void FO_1I_D16F16C15_TRC_WRA_01( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
@@ -71,4 +111,4 @@
}
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Init.c
index 96252cc..b21b8a4 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Init.c
@@ -38,6 +38,22 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
+#ifdef BUILD_FLOAT
+void FO_1I_D16F16Css_TRC_WRA_01_Init( Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_1I_Order1_FLOAT_Taps_t *pTaps,
+ FO_FLOAT_Coefs_t *pCoef)
+{
+ LVM_FLOAT temp;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT *)pTaps;
+ temp = pCoef->A1;
+ pBiquadState->coefs[0] = temp;
+ temp = pCoef->A0;
+ pBiquadState->coefs[1] = temp;
+ temp = pCoef->B1;
+ pBiquadState->coefs[2] = temp;
+}
+#else
void FO_1I_D16F16Css_TRC_WRA_01_Init( Biquad_Instance_t *pInstance,
Biquad_1I_Order1_Taps_t *pTaps,
FO_C16_Coefs_t *pCoef)
@@ -53,6 +69,7 @@
temp=pCoef->B1;
pBiquadState->coefs[2]=temp;
}
+#endif
/*------------------------------------------------*/
/* End Of File: FO_1I_D16F16Css_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Private.h
index 516ca83..6fdb039 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Private.h
@@ -28,4 +28,14 @@
typedef Filter_State * PFilter_State ;
+#ifdef BUILD_FLOAT
+typedef struct _Filter_State_FLOAT
+{
+ LVM_FLOAT * pDelays; /* pointer to the delayed samples \
+ (data of 32 bits) */
+ LVM_FLOAT coefs[3]; /* pointer to the filter coefficients */
+}Filter_State_FLOAT;
+
+typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
+#endif
#endif /* _FO_1I_D16F16CSS_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32C31_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32C31_TRC_WRA_01.c
index 0f1d5bc..416e8eb 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32C31_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32C31_TRC_WRA_01.c
@@ -31,7 +31,47 @@
pBiquadState->pDelays[0] is x(n-1)L in Q0 format
pBiquadState->pDelays[1] is y(n-1)L in Q0 format
***************************************************************************/
+#ifdef BUILD_FLOAT
+void FO_1I_D32F32C31_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples)
+ {
+ LVM_FLOAT ynL,templ;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ for (ii = NrSamples; ii != 0; ii--)
+ {
+
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ // ynL=A1 * x(n-1)L
+ ynL = pBiquadState->coefs[0] * pBiquadState->pDelays[0];
+
+ // ynL+=A0 * x(n)L
+ templ = pBiquadState->coefs[1] * (*pDataIn);
+ ynL += templ;
+
+ // ynL+= (-B1 * y(n-1)L
+ templ = pBiquadState->coefs[2] * pBiquadState->pDelays[1];
+ ynL += templ;
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[1] = ynL; // Update y(n-1)L
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output in Q0
+ }
+
+ }
+#else
void FO_1I_D32F32C31_TRC_WRA_01( Biquad_Instance_t *pInstance,
LVM_INT32 *pDataIn,
LVM_INT32 *pDataOut,
@@ -71,4 +111,4 @@
}
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.c
index 136e4f6..f33d24d 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.c
@@ -37,6 +37,23 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
+#ifdef BUILD_FLOAT
+void FO_1I_D32F32Cll_TRC_WRA_01_Init( Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_1I_Order1_FLOAT_Taps_t *pTaps,
+ FO_FLOAT_Coefs_t *pCoef)
+{
+ LVM_FLOAT temp;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT *) pTaps;
+
+ temp = pCoef->A1;
+ pBiquadState->coefs[0] = temp;
+ temp = pCoef->A0;
+ pBiquadState->coefs[1] = temp;
+ temp = pCoef->B1;
+ pBiquadState->coefs[2] = temp;
+}
+#else
void FO_1I_D32F32Cll_TRC_WRA_01_Init( Biquad_Instance_t *pInstance,
Biquad_1I_Order1_Taps_t *pTaps,
FO_C32_Coefs_t *pCoef)
@@ -52,6 +69,7 @@
temp=pCoef->B1;
pBiquadState->coefs[2]=temp;
}
+#endif
/*------------------------------------------------*/
/* End Of File: FO_1I_D32F32Cll_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Private.h
index 94ad48c..fdb528b 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Private.h
@@ -29,4 +29,13 @@
typedef Filter_State * PFilter_State ;
+#ifdef BUILD_FLOAT
+typedef struct _Filter_State_FLOAT_
+{
+ LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_FLOAT coefs[3]; /* pointer to the filter coefficients */
+}Filter_State_FLOAT;
+
+typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
+#endif
#endif /* _FO_1I_D32F32CLL_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32C15_LShx_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32C15_LShx_TRC_WRA_01.c
index 8388050..192927c 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32C15_LShx_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32C15_LShx_TRC_WRA_01.c
@@ -32,7 +32,92 @@
pBiquadState->pDelays[2] is x(n-1)R in Q15 format
pBiquadState->pDelays[3] is y(n-1)R in Q30 format
***************************************************************************/
+#ifdef BUILD_FLOAT
+void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples)
+ {
+ LVM_FLOAT ynL,ynR;
+ LVM_FLOAT Temp;
+ LVM_FLOAT NegSatValue;
+ LVM_INT16 ii;
+ PFilter_Float_State pBiquadState = (PFilter_Float_State) pInstance;
+
+ NegSatValue = -1.0f;
+
+ for (ii = NrSamples; ii != 0; ii--)
+ {
+
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+
+ // ynL =A1 * x(n-1)L
+ ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[0];
+ // ynR =A1 * x(n-1)R
+ ynR = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[2];
+
+
+ // ynL+=A0 * x(n)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[1] * (*pDataIn);
+ // ynR+=A0 * x(n)L
+ ynR += (LVM_FLOAT)pBiquadState->coefs[1] * (*(pDataIn+1));
+
+
+ // ynL += (-B1 * y(n-1)L )
+ Temp = pBiquadState->pDelays[1] * pBiquadState->coefs[2];
+ ynL += Temp;
+ // ynR += (-B1 * y(n-1)R ) )
+ Temp = pBiquadState->pDelays[3] * pBiquadState->coefs[2];
+ ynR += Temp;
+
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[1] = ynL; // Update y(n-1)L
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
+
+ pBiquadState->pDelays[3] = ynR; // Update y(n-1)R
+ pBiquadState->pDelays[2] = (*pDataIn++); // Update x(n-1)R
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+
+ /*Saturate results*/
+ if(ynL > 1.0f)
+ {
+ ynL = 1.0f;
+ }
+ else
+ {
+ if(ynL < NegSatValue)
+ {
+ ynL = NegSatValue;
+ }
+ }
+
+ if(ynR > 1.0f)
+ {
+ ynR = 1.0f;
+ }
+ else
+ {
+ if(ynR < NegSatValue)
+ {
+ ynR = NegSatValue;
+ }
+ }
+
+ *pDataOut++ = (LVM_FLOAT)ynL;
+ *pDataOut++ = (LVM_FLOAT)ynR;
+ }
+
+ }
+#else
void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
@@ -125,4 +210,4 @@
}
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.c
index a19c32c..33ca6cf 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.c
@@ -37,6 +37,23 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
+#ifdef BUILD_FLOAT
+void FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_2I_Order1_FLOAT_Taps_t *pTaps,
+ FO_FLOAT_LShx_Coefs_t *pCoef)
+{
+ LVM_FLOAT temp;
+ PFilter_Float_State pBiquadState = (PFilter_Float_State) pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT *) pTaps ;
+
+ temp = pCoef->A1;
+ pBiquadState->coefs[0] = temp;
+ temp = pCoef->A0;
+ pBiquadState->coefs[1] = temp;
+ temp = pCoef->B1;
+ pBiquadState->coefs[2] = temp;
+}
+#else
void FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(Biquad_Instance_t *pInstance,
Biquad_2I_Order1_Taps_t *pTaps,
FO_C16_LShx_Coefs_t *pCoef)
@@ -55,6 +72,7 @@
temp=pCoef->Shift;
pBiquadState->Shift = temp;
}
+#endif
/*-------------------------------------------------------------------------*/
/* End Of File: FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Private.h
index 4640743..368bfce 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Private.h
@@ -20,6 +20,15 @@
/* The internal state variables are implemented in a (for the user) hidden structure */
/* In this (private) file, the internal structure is declared fro private use. */
+#ifdef BUILD_FLOAT
+typedef struct _Filter_State_
+{
+ LVM_FLOAT *pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_FLOAT coefs[3]; /* pointer to the filter coefficients */
+}Filter_Float_State;
+
+typedef Filter_Float_State * PFilter_Float_State ;
+#else
typedef struct _Filter_State_
{
LVM_INT32 *pDelays; /* pointer to the delayed samples (data of 32 bits) */
@@ -28,5 +37,5 @@
}Filter_State;
typedef Filter_State * PFilter_State ;
-
+#endif
#endif /* _FO_2I_D16F32CSS_LSHX_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/Filters.h b/media/libeffects/lvm/lib/Common/src/Filters.h
index 4d32df1..b1fde0c 100644
--- a/media/libeffects/lvm/lib/Common/src/Filters.h
+++ b/media/libeffects/lvm/lib/Common/src/Filters.h
@@ -34,6 +34,7 @@
* Biquad with coefficients A0, A1, A2, B1 and B2 coefficients
*/
/* Single precision (16-bit) Biquad section coefficients */
+#ifndef BUILD_FLOAT
typedef struct
{
LVM_INT16 A0;
@@ -43,12 +44,22 @@
LVM_INT16 B2;
LVM_UINT16 Scale;
} BiquadA012B12CoefsSP_t;
-
-
+#else
+typedef struct
+{
+ LVM_FLOAT A0;
+ LVM_FLOAT A1;
+ LVM_FLOAT A2;
+ LVM_FLOAT B1;
+ LVM_FLOAT B2;
+ LVM_UINT16 Scale;
+} BiquadA012B12CoefsSP_t;
+#endif
/*
* Biquad with coefficients A0, A1 and B1 coefficients
*/
/* Single precision (16-bit) Biquad section coefficients */
+#ifndef BUILD_FLOAT
typedef struct
{
LVM_INT16 A0;
@@ -56,8 +67,15 @@
LVM_INT16 B1;
LVM_UINT16 Scale;
} BiquadA01B1CoefsSP_t;
-
-
+#else
+typedef struct
+{
+ LVM_FLOAT A0;
+ LVM_FLOAT A1;
+ LVM_FLOAT B1;
+ LVM_UINT16 Scale;
+} BiquadA01B1CoefsSP_t;
+#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.c b/media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.c
index 7975e8b..2c6e6c3 100644
--- a/media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.c
+++ b/media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.c
@@ -53,5 +53,34 @@
return;
}
+#ifdef BUILD_FLOAT
+void From2iToMS_Float( const LVM_FLOAT *src,
+ LVM_FLOAT *dstM,
+ LVM_FLOAT *dstS,
+ LVM_INT16 n )
+{
+ LVM_FLOAT temp1,left,right;
+ LVM_INT16 ii;
+ for (ii = n; ii != 0; ii--)
+ {
+ left = (LVM_FLOAT)*src;
+ src++;
+ right = (LVM_FLOAT)*src;
+ src++;
+
+ /* Compute M signal*/
+ temp1 = (left + right) / 2.0f;
+ *dstM = (LVM_FLOAT)temp1;
+ dstM++;
+
+ /* Compute S signal*/
+ temp1 = (left - right) / 2.0f;
+ *dstS = (LVM_FLOAT)temp1;
+ dstS++;
+ }
+
+ return;
+}
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/From2iToMono_32.c b/media/libeffects/lvm/lib/Common/src/From2iToMono_32.c
index 8bb292f..ac1eea8 100644
--- a/media/libeffects/lvm/lib/Common/src/From2iToMono_32.c
+++ b/media/libeffects/lvm/lib/Common/src/From2iToMono_32.c
@@ -46,5 +46,27 @@
return;
}
+#ifdef BUILD_FLOAT
+void From2iToMono_Float( const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ LVM_INT16 ii;
+ LVM_FLOAT Temp;
+ for (ii = n; ii != 0; ii--)
+ {
+ Temp = (*src);
+ src++;
+
+ Temp += (*src);
+ src++;
+
+ *dst = Temp / 2.0f;
+ dst++;
+ }
+
+ return;
+}
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.c b/media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.c
index 9b938bd..ebc477e 100644
--- a/media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.c
+++ b/media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.c
@@ -49,6 +49,31 @@
return;
}
+#ifdef BUILD_FLOAT
+void JoinTo2i_Float( const LVM_FLOAT *srcL,
+ const LVM_FLOAT *srcR,
+ LVM_FLOAT *dst,
+ LVM_INT16 n )
+{
+ LVM_INT16 ii;
+ srcL += n - 1;
+ srcR += n - 1;
+ dst += ((2 * n) - 1);
+
+ for (ii = n; ii != 0; ii--)
+ {
+ *dst = *srcR;
+ dst--;
+ srcR--;
+
+ *dst = *srcL;
+ dst--;
+ srcL--;
+ }
+
+ return;
+}
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.c b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.c
index 3d39b93..eb5755e 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.c
@@ -27,7 +27,39 @@
/**********************************************************************************
FUNCTION LVC_Core_MixHard_1St_2i_D16C31_SAT
***********************************************************************************/
+#ifdef BUILD_FLOAT
+void LVC_Core_MixHard_1St_2i_D16C31_SAT( LVMixer3_FLOAT_st *ptrInstance1,
+ LVMixer3_FLOAT_st *ptrInstance2,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ LVM_FLOAT Temp;
+ LVM_INT16 ii;
+ Mix_Private_FLOAT_st *pInstance1 = (Mix_Private_FLOAT_st *)(ptrInstance1->PrivateParams);
+ Mix_Private_FLOAT_st *pInstance2 = (Mix_Private_FLOAT_st *)(ptrInstance2->PrivateParams);
+ for (ii = n; ii != 0; ii--)
+ {
+ Temp = ((LVM_FLOAT)*(src++) * (LVM_FLOAT)pInstance1->Current);
+ if (Temp > 1.0f)
+ *dst++ = 1.0f;
+ else if (Temp < -1.0f)
+ *dst++ = -1.0f;
+ else
+ *dst++ = (LVM_FLOAT)Temp;
+ Temp = ((LVM_FLOAT)*(src++) * (LVM_FLOAT)pInstance2->Current);
+ if (Temp > 1.0f)
+ *dst++ = 1.0f;
+ else if (Temp < -1.0f)
+ *dst++ = -1.0f;
+ else
+ *dst++ = (LVM_FLOAT)Temp;
+ }
+
+
+}
+#else
void LVC_Core_MixHard_1St_2i_D16C31_SAT( LVMixer3_st *ptrInstance1,
LVMixer3_st *ptrInstance2,
const LVM_INT16 *src,
@@ -66,4 +98,5 @@
}
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_2St_D16C31_SAT.c b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_2St_D16C31_SAT.c
index 2daf74a..ec0baaf 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_2St_D16C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_2St_D16C31_SAT.c
@@ -24,7 +24,37 @@
/**********************************************************************************
FUNCTION LVCore_MIXHARD_2ST_D16C31_SAT
***********************************************************************************/
+#ifdef BUILD_FLOAT
+void LVC_Core_MixHard_2St_D16C31_SAT( LVMixer3_FLOAT_st *ptrInstance1,
+ LVMixer3_FLOAT_st *ptrInstance2,
+ const LVM_FLOAT *src1,
+ const LVM_FLOAT *src2,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ LVM_FLOAT Temp;
+ LVM_INT16 ii;
+ LVM_FLOAT Current1;
+ LVM_FLOAT Current2;
+ Mix_Private_FLOAT_st *pInstance1 = (Mix_Private_FLOAT_st *)(ptrInstance1->PrivateParams);
+ Mix_Private_FLOAT_st *pInstance2 = (Mix_Private_FLOAT_st *)(ptrInstance2->PrivateParams);
+
+ Current1 = (pInstance1->Current);
+ Current2 = (pInstance2->Current);
+
+ for (ii = n; ii != 0; ii--){
+ Temp = (((LVM_FLOAT)*(src1++) * (LVM_FLOAT)Current1)) +
+ (((LVM_FLOAT)*(src2++) * (LVM_FLOAT)Current2));
+ if (Temp > 1.0f)
+ *dst++ = 1.0f;
+ else if (Temp < -1.0f)
+ *dst++ = -1.0f;
+ else
+ *dst++ = Temp;
+ }
+}
+#else
void LVC_Core_MixHard_2St_D16C31_SAT( LVMixer3_st *ptrInstance1,
LVMixer3_st *ptrInstance2,
const LVM_INT16 *src1,
@@ -54,6 +84,5 @@
*dst++ = (LVM_INT16)Temp;
}
}
-
-
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixInSoft_D16C31_SAT.c b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixInSoft_D16C31_SAT.c
index caa0951..d2694cc 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixInSoft_D16C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixInSoft_D16C31_SAT.c
@@ -25,7 +25,96 @@
/**********************************************************************************
FUNCTION LVCore_MIXSOFT_1ST_D16C31_WRA
***********************************************************************************/
+#ifdef BUILD_FLOAT
+void LVC_Core_MixInSoft_D16C31_SAT( LVMixer3_FLOAT_st *ptrInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ LVM_INT16 OutLoop;
+ LVM_INT16 InLoop;
+ LVM_INT32 ii,jj;
+ Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)(ptrInstance->PrivateParams);
+ LVM_FLOAT Delta = pInstance->Delta;
+ LVM_FLOAT Current = pInstance->Current;
+ LVM_FLOAT Target = pInstance->Target;
+ LVM_FLOAT Temp;
+
+ InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
+ OutLoop = (LVM_INT16)(n - (InLoop << 2));
+
+ if(Current < Target){
+ if (OutLoop){
+ Temp = Current + Delta;
+ Current = Temp;
+ if (Current > Target)
+ Current = Target;
+
+ for (ii = OutLoop; ii != 0; ii--){
+ Temp = ((LVM_FLOAT)*dst) + (((LVM_FLOAT)*(src++) * Current));
+ if (Temp > 1.0f)
+ *dst++ = 1.0f;
+ else if (Temp < -1.0f)
+ *dst++ = -1.0f;
+ else
+ *dst++ = (LVM_FLOAT)Temp;
+ }
+ }
+
+ for (ii = InLoop; ii != 0; ii--){
+ Temp = Current + Delta;
+ Current = Temp;
+ if (Current > Target)
+ Current = Target;
+
+ for (jj = 4; jj != 0 ; jj--){
+ Temp = ((LVM_FLOAT)*dst) + (((LVM_FLOAT)*(src++) * Current));
+ if (Temp > 1.0f)
+ *dst++ = 1.0f;
+ else if (Temp < -1.0f)
+ *dst++ = -1.0f;
+ else
+ *dst++ = (LVM_FLOAT)Temp;
+ }
+ }
+ }
+ else{
+ if (OutLoop){
+ Current -= Delta;
+ if (Current < Target)
+ Current = Target;
+
+ for (ii = OutLoop; ii != 0; ii--){
+ Temp = ((LVM_FLOAT)*dst) + (((LVM_FLOAT)*(src++) * Current));
+ if (Temp > 1.0f)
+ *dst++ = 1.0f;
+ else if (Temp < -1.0f)
+ *dst++ = -1.0f;
+ else
+ *dst++ = (LVM_FLOAT)Temp;
+ }
+ }
+
+ for (ii = InLoop; ii != 0; ii--){
+ Current -= Delta;
+ if (Current < Target)
+ Current = Target;
+
+ for (jj = 4; jj != 0 ; jj--){
+ Temp = ((LVM_FLOAT)*dst) + (((LVM_FLOAT)*(src++) * Current));
+ if (Temp > 1.0f)
+ *dst++ = 1.0f;
+ else if (Temp < -1.0f)
+ *dst++ = -1.0f;
+ else
+ *dst++ = (LVM_FLOAT)Temp;
+ }
+ }
+ }
+ pInstance->Current = Current;
+}
+#else
void LVC_Core_MixInSoft_D16C31_SAT( LVMixer3_st *ptrInstance,
const LVM_INT16 *src,
LVM_INT16 *dst,
@@ -123,6 +212,5 @@
}
pInstance->Current=Current;
}
-
-
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.c b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.c
index 09ec427..656a117 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.c
@@ -26,7 +26,127 @@
/**********************************************************************************
FUNCTION LVC_Core_MixSoft_1St_2i_D16C31_WRA
***********************************************************************************/
+#ifdef BUILD_FLOAT
+static LVM_FLOAT ADD2_SAT_FLOAT(LVM_FLOAT a,
+ LVM_FLOAT b,
+ LVM_FLOAT c)
+{
+ LVM_FLOAT temp;
+ temp = a + b ;
+ if (temp < -1.0f)
+ c = -1.0f;
+ else if (temp > 1.0f)
+ c = 1.0f;
+ else
+ c = temp;
+ return c;
+}
+void LVC_Core_MixSoft_1St_2i_D16C31_WRA( LVMixer3_FLOAT_st *ptrInstance1,
+ LVMixer3_FLOAT_st *ptrInstance2,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ LVM_INT16 OutLoop;
+ LVM_INT16 InLoop;
+ LVM_INT32 ii;
+ Mix_Private_FLOAT_st *pInstanceL = (Mix_Private_FLOAT_st *)(ptrInstance1->PrivateParams);
+ Mix_Private_FLOAT_st *pInstanceR = (Mix_Private_FLOAT_st *)(ptrInstance2->PrivateParams);
+ LVM_FLOAT DeltaL = pInstanceL->Delta;
+ LVM_FLOAT CurrentL = pInstanceL->Current;
+ LVM_FLOAT TargetL = pInstanceL->Target;
+
+ LVM_FLOAT DeltaR = pInstanceR->Delta;
+ LVM_FLOAT CurrentR = pInstanceR->Current;
+ LVM_FLOAT TargetR = pInstanceR->Target;
+
+ LVM_FLOAT Temp = 0;
+
+ InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
+ OutLoop = (LVM_INT16)(n - (InLoop << 2));
+
+ if (OutLoop)
+ {
+ if(CurrentL < TargetL)
+ {
+ ADD2_SAT_FLOAT(CurrentL, DeltaL, Temp);
+ CurrentL = Temp;
+ if (CurrentL > TargetL)
+ CurrentL = TargetL;
+ }
+ else
+ {
+ CurrentL -= DeltaL;
+ if (CurrentL < TargetL)
+ CurrentL = TargetL;
+ }
+
+ if(CurrentR < TargetR)
+ {
+ ADD2_SAT_FLOAT(CurrentR, DeltaR, Temp);
+ CurrentR = Temp;
+ if (CurrentR > TargetR)
+ CurrentR = TargetR;
+ }
+ else
+ {
+ CurrentR -= DeltaR;
+ if (CurrentR < TargetR)
+ CurrentR = TargetR;
+ }
+
+ for (ii = OutLoop * 2; ii != 0; ii -= 2)
+ {
+ *(dst++) = (LVM_FLOAT)(((LVM_FLOAT)*(src++) * (LVM_FLOAT)CurrentL));
+ *(dst++) = (LVM_FLOAT)(((LVM_FLOAT)*(src++) * (LVM_FLOAT)CurrentR));
+ }
+ }
+
+ for (ii = InLoop * 2; ii != 0; ii-=2)
+ {
+ if(CurrentL < TargetL)
+ {
+ ADD2_SAT_FLOAT(CurrentL, DeltaL, Temp);
+ CurrentL = Temp;
+ if (CurrentL > TargetL)
+ CurrentL = TargetL;
+ }
+ else
+ {
+ CurrentL -= DeltaL;
+ if (CurrentL < TargetL)
+ CurrentL = TargetL;
+ }
+
+ if(CurrentR < TargetR)
+ {
+ ADD2_SAT_FLOAT(CurrentR, DeltaR, Temp);
+ CurrentR = Temp;
+ if (CurrentR > TargetR)
+ CurrentR = TargetR;
+ }
+ else
+ {
+ CurrentR -= DeltaR;
+ if (CurrentR < TargetR)
+ CurrentR = TargetR;
+ }
+
+ *(dst++) = (LVM_FLOAT)(((LVM_FLOAT)*(src++) * (LVM_FLOAT)CurrentL));
+ *(dst++) = (LVM_FLOAT)(((LVM_FLOAT)*(src++) * (LVM_FLOAT)CurrentR));
+ *(dst++) = (LVM_FLOAT)(((LVM_FLOAT)*(src++) * (LVM_FLOAT)CurrentL));
+ *(dst++) = (LVM_FLOAT)(((LVM_FLOAT)*(src++) * (LVM_FLOAT)CurrentR));
+ *(dst++) = (LVM_FLOAT)(((LVM_FLOAT)*(src++) * (LVM_FLOAT)CurrentL));
+ *(dst++) = (LVM_FLOAT)(((LVM_FLOAT)*(src++) * (LVM_FLOAT)CurrentR));
+ *(dst++) = (LVM_FLOAT)(((LVM_FLOAT)*(src++) * (LVM_FLOAT)CurrentL));
+ *(dst++) = (LVM_FLOAT)(((LVM_FLOAT)*(src++) * (LVM_FLOAT)CurrentR));
+ }
+ pInstanceL->Current = CurrentL;
+ pInstanceR->Current = CurrentR;
+
+}
+#else
void LVC_Core_MixSoft_1St_2i_D16C31_WRA( LVMixer3_st *ptrInstance1,
LVMixer3_st *ptrInstance2,
const LVM_INT16 *src,
@@ -140,4 +260,5 @@
pInstanceR->Current=CurrentR;
}
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_D16C31_WRA.c b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_D16C31_WRA.c
index f1a9ca3..b5e7f5c 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_D16C31_WRA.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_D16C31_WRA.c
@@ -26,7 +26,86 @@
/**********************************************************************************
FUNCTION LVCore_MIXSOFT_1ST_D16C31_WRA
***********************************************************************************/
+#ifdef BUILD_FLOAT
+void LVC_Core_MixSoft_1St_D16C31_WRA( LVMixer3_FLOAT_st *ptrInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ LVM_INT16 OutLoop;
+ LVM_INT16 InLoop;
+ LVM_INT32 ii;
+ Mix_Private_FLOAT_st *pInstance=(Mix_Private_FLOAT_st *)(ptrInstance->PrivateParams);
+ LVM_FLOAT Delta= (LVM_FLOAT)pInstance->Delta;
+ LVM_FLOAT Current = (LVM_FLOAT)pInstance->Current;
+ LVM_FLOAT Target= (LVM_FLOAT)pInstance->Target;
+ LVM_FLOAT Temp;
+ InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
+ OutLoop = (LVM_INT16)(n - (InLoop << 2));
+
+ if(Current<Target){
+ if (OutLoop){
+
+ Temp = Current + Delta;
+ if (Temp > 1.0f)
+ Temp = 1.0f;
+ else if (Temp < -1.0f)
+ Temp = -1.0f;
+
+ Current=Temp;
+ if (Current > Target)
+ Current = Target;
+
+ for (ii = OutLoop; ii != 0; ii--){
+ *(dst++) = (((LVM_FLOAT)*(src++) * (LVM_FLOAT)Current));
+ }
+ }
+
+ for (ii = InLoop; ii != 0; ii--){
+
+ Temp = Current + Delta;
+
+ if (Temp > 1.0f)
+ Temp = 1.0f;
+ else if (Temp < -1.0f)
+ Temp = -1.0f;
+
+ Current=Temp;
+ if (Current > Target)
+ Current = Target;
+
+ *(dst++) = (((LVM_FLOAT)*(src++) * Current) );
+ *(dst++) = (((LVM_FLOAT)*(src++) * Current) );
+ *(dst++) = (((LVM_FLOAT)*(src++) * Current) );
+ *(dst++) = (((LVM_FLOAT)*(src++) * Current) );
+ }
+ }
+ else{
+ if (OutLoop){
+ Current -= Delta;
+ if (Current < Target)
+ Current = Target;
+
+ for (ii = OutLoop; ii != 0; ii--){
+ *(dst++) = (((LVM_FLOAT)*(src++) * Current));
+ }
+ }
+
+ for (ii = InLoop; ii != 0; ii--){
+ Current -= Delta;
+ if (Current < Target)
+ Current = Target;
+
+ *(dst++) = (((LVM_FLOAT)*(src++) * Current));
+ *(dst++) = (((LVM_FLOAT)*(src++) * Current));
+ *(dst++) = (((LVM_FLOAT)*(src++) * Current));
+ *(dst++) = (((LVM_FLOAT)*(src++) * Current));
+ }
+ }
+ pInstance->Current=Current;
+}
+#else
void LVC_Core_MixSoft_1St_D16C31_WRA( LVMixer3_st *ptrInstance,
const LVM_INT16 *src,
LVM_INT16 *dst,
@@ -101,6 +180,5 @@
}
pInstance->Current=Current;
}
-
-
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_MixInSoft_D16C31_SAT.c b/media/libeffects/lvm/lib/Common/src/LVC_MixInSoft_D16C31_SAT.c
index 0052dd7..192f126 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_MixInSoft_D16C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_MixInSoft_D16C31_SAT.c
@@ -33,7 +33,80 @@
/**********************************************************************************
FUNCTION MIXINSOFT_D16C31_SAT
***********************************************************************************/
+#ifdef BUILD_FLOAT
+void LVC_MixInSoft_D16C31_SAT( LVMixer3_1St_FLOAT_st *ptrInstance,
+ LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ char HardMixing = TRUE;
+ LVM_FLOAT TargetGain;
+ Mix_Private_FLOAT_st *pInstance = \
+ (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[0].PrivateParams);
+ if(n <= 0) return;
+
+ /******************************************************************************
+ SOFT MIXING
+ *******************************************************************************/
+ if (pInstance->Current != pInstance->Target)
+ {
+ if(pInstance->Delta == 1.0f){
+ pInstance->Current = pInstance->Target;
+ TargetGain = pInstance->Target;
+ LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
+ }else if (Abs_Float(pInstance->Current - pInstance->Target) < pInstance->Delta){
+ pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
+ Make them equal. */
+ TargetGain = pInstance->Target;
+ LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
+ }else{
+ /* Soft mixing has to be applied */
+ HardMixing = FALSE;
+ LVC_Core_MixInSoft_D16C31_SAT(&(ptrInstance->MixerStream[0]), src, dst, n);
+ }
+ }
+
+ /******************************************************************************
+ HARD MIXING
+ *******************************************************************************/
+
+ if (HardMixing){
+ if (pInstance->Target != 0){ /* Nothing to do in case Target = 0 */
+ if ((pInstance->Target) == 1.0f){
+ Add2_Sat_Float(src, dst, n);
+ }
+ else{
+ Mac3s_Sat_Float(src, (pInstance->Target), dst, n);
+ /* In case the LVCore function would have changed the Current value */
+ pInstance->Current = pInstance->Target;
+ }
+ }
+ }
+
+
+ /******************************************************************************
+ CALL BACK
+ *******************************************************************************/
+
+ if (ptrInstance->MixerStream[0].CallbackSet){
+ if (Abs_Float(pInstance->Current - pInstance->Target) < pInstance->Delta){
+ pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
+ Make them equal. */
+ TargetGain = pInstance->Target;
+ LVC_Mixer_SetTarget(ptrInstance->MixerStream, TargetGain);
+ ptrInstance->MixerStream[0].CallbackSet = FALSE;
+ if (ptrInstance->MixerStream[0].pCallBack != 0){
+ (*ptrInstance->MixerStream[0].pCallBack) ( \
+ ptrInstance->MixerStream[0].pCallbackHandle,
+ ptrInstance->MixerStream[0].pGeneralPurpose,
+ ptrInstance->MixerStream[0].CallbackParam );
+ }
+ }
+ }
+
+}
+#else
void LVC_MixInSoft_D16C31_SAT( LVMixer3_1St_st *ptrInstance,
LVM_INT16 *src,
LVM_INT16 *dst,
@@ -108,5 +181,5 @@
}
}
-
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.c b/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.c
index f443c8f..bd5a925 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.c
@@ -33,7 +33,138 @@
/**********************************************************************************
FUNCTION LVC_MixSoft_1St_2i_D16C31_SAT
***********************************************************************************/
+#ifdef BUILD_FLOAT
+void LVC_MixSoft_1St_2i_D16C31_SAT( LVMixer3_2St_FLOAT_st *ptrInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ char HardMixing = TRUE;
+ LVM_FLOAT TargetGain;
+ Mix_Private_FLOAT_st *pInstance1 = \
+ (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[0].PrivateParams);
+ Mix_Private_FLOAT_st *pInstance2 = \
+ (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[1].PrivateParams);
+ if(n <= 0) return;
+
+ /******************************************************************************
+ SOFT MIXING
+ *******************************************************************************/
+ if ((pInstance1->Current != pInstance1->Target) || (pInstance2->Current != pInstance2->Target))
+ {
+ if(pInstance1->Delta == 1.0f)
+ {
+ pInstance1->Current = pInstance1->Target;
+ TargetGain = pInstance1->Target;
+ LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
+ }
+ else if (Abs_Float(pInstance1->Current - pInstance1->Target) < pInstance1->Delta)
+ {
+ pInstance1->Current = pInstance1->Target; /* Difference is not significant anymore. \
+ Make them equal. */
+ TargetGain = pInstance1->Target;
+ LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
+ }
+ else
+ {
+ /* Soft mixing has to be applied */
+ HardMixing = FALSE;
+ }
+
+ if(HardMixing == TRUE)
+ {
+ if(pInstance2->Delta == 1.0f)
+ {
+ pInstance2->Current = pInstance2->Target;
+ TargetGain = pInstance2->Target;
+ LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[1]), TargetGain);
+ }
+ else if (Abs_Float(pInstance2->Current - pInstance2->Target) < pInstance2->Delta)
+ {
+ pInstance2->Current = pInstance2->Target; /* Difference is not significant anymore. \
+ Make them equal. */
+ TargetGain = pInstance2->Target;
+ LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[1]), TargetGain);
+ }
+ else
+ {
+ /* Soft mixing has to be applied */
+ HardMixing = FALSE;
+ }
+ }
+
+ if(HardMixing == FALSE)
+ {
+ LVC_Core_MixSoft_1St_2i_D16C31_WRA( &(ptrInstance->MixerStream[0]),
+ &(ptrInstance->MixerStream[1]),
+ src, dst, n);
+ }
+ }
+
+ /******************************************************************************
+ HARD MIXING
+ *******************************************************************************/
+
+ if (HardMixing)
+ {
+ if ((pInstance1->Target == 1.0f) && (pInstance2->Target == 1.0f))
+ {
+ if(src != dst)
+ {
+ Copy_Float(src, dst, n);
+ }
+ }
+ else
+ {
+ LVC_Core_MixHard_1St_2i_D16C31_SAT(&(ptrInstance->MixerStream[0]),
+ &(ptrInstance->MixerStream[1]),
+ src, dst, n);
+ }
+ }
+
+ /******************************************************************************
+ CALL BACK
+ *******************************************************************************/
+
+ if (ptrInstance->MixerStream[0].CallbackSet)
+ {
+ if (Abs_Float(pInstance1->Current - pInstance1->Target) < pInstance1->Delta)
+ {
+ pInstance1->Current = pInstance1->Target; /* Difference is not significant anymore. \
+ Make them equal. */
+ TargetGain = pInstance1->Target;
+ LVC_Mixer_SetTarget(&ptrInstance->MixerStream[0], TargetGain);
+ ptrInstance->MixerStream[0].CallbackSet = FALSE;
+ if (ptrInstance->MixerStream[0].pCallBack != 0)
+ {
+ (*ptrInstance->MixerStream[0].pCallBack) ( \
+ ptrInstance->MixerStream[0].pCallbackHandle,
+ ptrInstance->MixerStream[0].pGeneralPurpose,
+ ptrInstance->MixerStream[0].CallbackParam );
+ }
+ }
+ }
+ if (ptrInstance->MixerStream[1].CallbackSet)
+ {
+ if (Abs_Float(pInstance2->Current - pInstance2->Target) < pInstance2->Delta)
+ {
+ pInstance2->Current = pInstance2->Target; /* Difference is not significant anymore.
+ Make them equal. */
+ TargetGain = pInstance2->Target;
+ LVC_Mixer_SetTarget(&ptrInstance->MixerStream[1], TargetGain);
+ ptrInstance->MixerStream[1].CallbackSet = FALSE;
+ if (ptrInstance->MixerStream[1].pCallBack != 0)
+ {
+ (*ptrInstance->MixerStream[1].pCallBack) (
+ ptrInstance->MixerStream[1].pCallbackHandle,
+ ptrInstance->MixerStream[1].pGeneralPurpose,
+ ptrInstance->MixerStream[1].CallbackParam );
+ }
+ }
+ }
+}
+#else
void LVC_MixSoft_1St_2i_D16C31_SAT( LVMixer3_2St_st *ptrInstance,
const LVM_INT16 *src,
LVM_INT16 *dst,
@@ -148,5 +279,5 @@
}
}
}
-
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_D16C31_SAT.c b/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_D16C31_SAT.c
index c8dcad7..1017de3 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_D16C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_D16C31_SAT.c
@@ -33,7 +33,77 @@
/**********************************************************************************
FUNCTION LVMixer3_MIXSOFT_1ST_D16C31_SAT
***********************************************************************************/
+#ifdef BUILD_FLOAT
+void LVC_MixSoft_1St_D16C31_SAT( LVMixer3_1St_FLOAT_st *ptrInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ char HardMixing = TRUE;
+ LVM_FLOAT TargetGain;
+ Mix_Private_FLOAT_st *pInstance = \
+ (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[0].PrivateParams);
+ if(n <= 0) return;
+
+ /******************************************************************************
+ SOFT MIXING
+ *******************************************************************************/
+ if (pInstance->Current != pInstance->Target)
+ {
+ if(pInstance->Delta == 1.0f){
+ pInstance->Current = pInstance->Target;
+ TargetGain = pInstance->Target;
+ LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
+ }else if (Abs_Float(pInstance->Current - pInstance->Target) < pInstance->Delta){
+ pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
+ Make them equal. */
+ TargetGain = pInstance->Target;
+ LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
+ }else{
+ /* Soft mixing has to be applied */
+ HardMixing = FALSE;
+ LVC_Core_MixSoft_1St_D16C31_WRA(&(ptrInstance->MixerStream[0]), src, dst, n);
+ }
+ }
+
+ /******************************************************************************
+ HARD MIXING
+ *******************************************************************************/
+
+ if (HardMixing){
+ if (pInstance->Target == 0)
+ LoadConst_Float(0.0, dst, n);
+ else {
+ if ((pInstance->Target) != 1.0f)
+ Mult3s_Float(src, (pInstance->Target), dst, n);
+ else if(src != dst)
+ Copy_Float(src, dst, n);
+ }
+
+ }
+
+ /******************************************************************************
+ CALL BACK
+ *******************************************************************************/
+
+ if (ptrInstance->MixerStream[0].CallbackSet){
+ if (Abs_Float(pInstance->Current - pInstance->Target) < pInstance->Delta){
+ pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
+ Make them equal. */
+ TargetGain = pInstance->Target;
+ LVC_Mixer_SetTarget(ptrInstance->MixerStream, TargetGain);
+ ptrInstance->MixerStream[0].CallbackSet = FALSE;
+ if (ptrInstance->MixerStream[0].pCallBack != 0){
+ (*ptrInstance->MixerStream[0].pCallBack) ( \
+ ptrInstance->MixerStream[0].pCallbackHandle,
+ ptrInstance->MixerStream[0].pGeneralPurpose,
+ ptrInstance->MixerStream[0].CallbackParam );
+ }
+ }
+ }
+}
+#else
void LVC_MixSoft_1St_D16C31_SAT( LVMixer3_1St_st *ptrInstance,
const LVM_INT16 *src,
LVM_INT16 *dst,
@@ -107,5 +177,5 @@
}
}
}
-
+#endif/*BUILD_FLOAT*/
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_2St_D16C31_SAT.c b/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_2St_D16C31_SAT.c
index 7240705..3c90071 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_2St_D16C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_2St_D16C31_SAT.c
@@ -25,7 +25,49 @@
/**********************************************************************************
FUNCTION LVC_MixSoft_2St_D16C31_SAT.c
***********************************************************************************/
+#ifdef BUILD_FLOAT
+void LVC_MixSoft_2St_D16C31_SAT( LVMixer3_2St_FLOAT_st *ptrInstance,
+ const LVM_FLOAT *src1,
+ LVM_FLOAT *src2,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ Mix_Private_FLOAT_st *pInstance1 = \
+ (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[0].PrivateParams);
+ Mix_Private_FLOAT_st *pInstance2 = \
+ (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[1].PrivateParams);
+ if(n <= 0) return;
+
+ /******************************************************************************
+ SOFT MIXING
+ *******************************************************************************/
+ if ((pInstance1->Current == pInstance1->Target) && (pInstance1->Current == 0)){
+ LVC_MixSoft_1St_D16C31_SAT((LVMixer3_1St_FLOAT_st *)(&ptrInstance->MixerStream[1]),
+ src2, dst, n);
+ }
+ else if ((pInstance2->Current == pInstance2->Target) && (pInstance2->Current == 0)){
+ LVC_MixSoft_1St_D16C31_SAT((LVMixer3_1St_FLOAT_st *)(&ptrInstance->MixerStream[0]),
+ src1, dst, n);
+ }
+ else if ((pInstance1->Current != pInstance1->Target) || \
+ (pInstance2->Current != pInstance2->Target))
+ {
+ LVC_MixSoft_1St_D16C31_SAT((LVMixer3_1St_FLOAT_st *)(&ptrInstance->MixerStream[0]),
+ src1, dst, n);
+ LVC_MixInSoft_D16C31_SAT((LVMixer3_1St_FLOAT_st *)(&ptrInstance->MixerStream[1]),
+ src2, dst, n);
+ }
+ else{
+ /******************************************************************************
+ HARD MIXING
+ *******************************************************************************/
+ LVC_Core_MixHard_2St_D16C31_SAT( &ptrInstance->MixerStream[0],
+ &ptrInstance->MixerStream[1],
+ src1, src2, dst, n);
+ }
+}
+#else
void LVC_MixSoft_2St_D16C31_SAT( LVMixer3_2St_st *ptrInstance,
const LVM_INT16 *src1,
LVM_INT16 *src2,
@@ -66,5 +108,5 @@
LVC_Core_MixHard_2St_D16C31_SAT( &ptrInstance->MixerStream[0], &ptrInstance->MixerStream[1], src1, src2, dst, n);
}
}
-
+#endif /*BUILD_FLOAT*/
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer.h b/media/libeffects/lvm/lib/Common/src/LVC_Mixer.h
index 980c783..f904915 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer.h
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer.h
@@ -31,6 +31,19 @@
***********************************************************************************/
/* LVMixer3_st structure stores Instance parameters for one audio stream */
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ LVM_FLOAT PrivateParams[3]; /* Private Instance params for \
+ Audio Stream shift parameter */
+ LVM_INT16 CallbackSet; /* Boolean. Should be set by calling application \
+ each time the target value is updated */
+ LVM_INT16 CallbackParam; /* Parameter that will be used in the calback function */
+ void *pCallbackHandle; /* Pointer to the instance of the callback function */
+ void *pGeneralPurpose; /* Pointer for general purpose usage */
+ LVM_Callback pCallBack; /* Pointer to the callback function */
+} LVMixer3_FLOAT_st;
+#else
typedef struct
{
LVM_INT32 PrivateParams[4]; /* Private Instance params for Audio Stream */
@@ -40,22 +53,35 @@
void *pGeneralPurpose; /* Pointer for general purpose usage */
LVM_Callback pCallBack; /* Pointer to the callback function */
} LVMixer3_st;
-
+#endif
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ LVMixer3_FLOAT_st MixerStream[1]; /* Instance Params for one Audio Stream */
+} LVMixer3_1St_FLOAT_st;
+#else
typedef struct
{
LVMixer3_st MixerStream[1]; /* Instance Params for one Audio Stream */
} LVMixer3_1St_st;
-
+#endif
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ LVMixer3_FLOAT_st MixerStream[2]; /* Instance Params for two Audio Streams */
+} LVMixer3_2St_FLOAT_st;
+#else
typedef struct
{
LVMixer3_st MixerStream[2]; /* Instance Params for two Audio Streams */
} LVMixer3_2St_st;
-
+#endif
+#ifndef BUILD_FLOAT
typedef struct
{
LVMixer3_st MixerStream[3]; /* Instance Params for three Audio Streams */
} LVMixer3_3St_st;
-
+#endif
/**********************************************************************************
FUNCTION PROTOTYPES (HIGH LEVEL FUNCTIONS)
***********************************************************************************/
@@ -75,57 +101,115 @@
/* then the calculation will give an incorrect value for alpha, see the mixer */
/* documentation for further details. */
/* ********************************************************************************/
+#ifdef BUILD_FLOAT
+void LVC_Mixer_SetTarget( LVMixer3_FLOAT_st *pStream,
+ LVM_FLOAT TargetGain);
+#else
void LVC_Mixer_SetTarget( LVMixer3_st *pStream,
LVM_INT32 TargetGain);
-
+#endif
+#ifdef BUILD_FLOAT
+LVM_FLOAT LVC_Mixer_GetTarget( LVMixer3_FLOAT_st *pStream);
+#else
LVM_INT32 LVC_Mixer_GetTarget( LVMixer3_st *pStream);
+#endif
+#ifdef BUILD_FLOAT
+LVM_FLOAT LVC_Mixer_GetCurrent( LVMixer3_FLOAT_st *pStream);
+#else
LVM_INT32 LVC_Mixer_GetCurrent( LVMixer3_st *pStream);
+#endif
+#ifdef BUILD_FLOAT
+void LVC_Mixer_Init( LVMixer3_FLOAT_st *pStream,
+ LVM_FLOAT TargetGain,
+ LVM_FLOAT CurrentGain);
+#else
void LVC_Mixer_Init( LVMixer3_st *pStream,
LVM_INT32 TargetGain,
LVM_INT32 CurrentGain);
+#endif
+#ifdef BUILD_FLOAT
+void LVC_Mixer_SetTimeConstant( LVMixer3_FLOAT_st *pStream,
+ LVM_INT32 Tc_millisec,
+ LVM_Fs_en Fs,
+ LVM_INT16 NumChannels);
+#else
void LVC_Mixer_SetTimeConstant( LVMixer3_st *pStream,
LVM_INT32 Tc_millisec,
LVM_Fs_en Fs,
LVM_INT16 NumChannels);
+#endif
+#ifdef BUILD_FLOAT
+void LVC_Mixer_VarSlope_SetTimeConstant( LVMixer3_FLOAT_st *pStream,
+ LVM_INT32 Tc_millisec,
+ LVM_Fs_en Fs,
+ LVM_INT16 NumChannels);
+#else
void LVC_Mixer_VarSlope_SetTimeConstant( LVMixer3_st *pStream,
LVM_INT32 Tc_millisec,
LVM_Fs_en Fs,
LVM_INT16 NumChannels);
+#endif
/*** 16 bit functions *************************************************************/
+#ifdef BUILD_FLOAT
+void LVC_MixSoft_1St_D16C31_SAT( LVMixer3_1St_FLOAT_st *pInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+#else
void LVC_MixSoft_1St_D16C31_SAT( LVMixer3_1St_st *pInstance,
const LVM_INT16 *src,
LVM_INT16 *dst,
LVM_INT16 n);
+#endif
+#ifdef BUILD_FLOAT
+void LVC_MixInSoft_D16C31_SAT( LVMixer3_1St_FLOAT_st *pInstance,
+ LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+#else
void LVC_MixInSoft_D16C31_SAT( LVMixer3_1St_st *pInstance,
LVM_INT16 *src,
LVM_INT16 *dst,
LVM_INT16 n);
+#endif
+#ifdef BUILD_FLOAT
+void LVC_MixSoft_2St_D16C31_SAT( LVMixer3_2St_FLOAT_st *pInstance,
+ const LVM_FLOAT *src1,
+ LVM_FLOAT *src2,
+ LVM_FLOAT *dst, /* dst cannot be equal to src2 */
+ LVM_INT16 n);
+#else
void LVC_MixSoft_2St_D16C31_SAT( LVMixer3_2St_st *pInstance,
const LVM_INT16 *src1,
LVM_INT16 *src2,
LVM_INT16 *dst, /* dst cannot be equal to src2 */
LVM_INT16 n);
-
+#endif
/**********************************************************************************/
/* For applying different gains to Left and right chennals */
/* MixerStream[0] applies to Left channel */
/* MixerStream[1] applies to Right channel */
/* Gain values should not be more that 1.0 */
/**********************************************************************************/
+#ifdef BUILD_FLOAT
+void LVC_MixSoft_1St_2i_D16C31_SAT( LVMixer3_2St_FLOAT_st *pInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst, /* dst can be equal to src */
+ LVM_INT16 n); /* Number of stereo samples */
+#else
void LVC_MixSoft_1St_2i_D16C31_SAT( LVMixer3_2St_st *pInstance,
const LVM_INT16 *src,
LVM_INT16 *dst, /* dst can be equal to src */
LVM_INT16 n); /* Number of stereo samples */
-
-
+#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetCurrent.c b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetCurrent.c
index b5ae264..5990412 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetCurrent.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetCurrent.c
@@ -31,7 +31,15 @@
/* CurrentGain - CurrentGain value in Q 16.15 format */
/* */
/************************************************************************/
-
+#ifdef BUILD_FLOAT
+LVM_FLOAT LVC_Mixer_GetCurrent( LVMixer3_FLOAT_st *pStream)
+{
+ LVM_FLOAT CurrentGain;
+ Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)pStream->PrivateParams;
+ CurrentGain = pInstance->Current; // CurrentGain
+ return CurrentGain;
+}
+#else
LVM_INT32 LVC_Mixer_GetCurrent( LVMixer3_st *pStream)
{
LVM_INT32 CurrentGain;
@@ -39,3 +47,4 @@
CurrentGain=pInstance->Current>>(16-pInstance->Shift); // CurrentGain in Q16.15 format
return CurrentGain;
}
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetTarget.c b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetTarget.c
index dc2f8e9..c67455a 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetTarget.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetTarget.c
@@ -30,7 +30,16 @@
/* TargetGain - TargetGain value in Q 16.15 format */
/* */
/************************************************************************/
-
+#ifdef BUILD_FLOAT
+LVM_FLOAT LVC_Mixer_GetTarget( LVMixer3_FLOAT_st *pStream)
+{
+ LVM_FLOAT TargetGain;
+ Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)pStream->PrivateParams;
+
+ TargetGain = pInstance->Target; // TargetGain
+ return TargetGain;
+}
+#else
LVM_INT32 LVC_Mixer_GetTarget( LVMixer3_st *pStream)
{
LVM_INT32 TargetGain;
@@ -40,3 +49,4 @@
return TargetGain;
}
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Init.c b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Init.c
index 449e7b1..737e26b 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Init.c
@@ -44,7 +44,19 @@
/* void */
/* */
/************************************************************************/
-
+#ifdef BUILD_FLOAT
+void LVC_Mixer_Init( LVMixer3_FLOAT_st *pStream,
+ LVM_FLOAT TargetGain,
+ LVM_FLOAT CurrentGain)
+{
+ LVM_FLOAT MaxGain = TargetGain;
+ Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)pStream->PrivateParams;
+ if(CurrentGain > MaxGain)
+ MaxGain = CurrentGain;
+ pInstance->Target = TargetGain; // Update fractional gain Target
+ pInstance->Current = CurrentGain; // Update fractional gain Current
+}
+#else
void LVC_Mixer_Init( LVMixer3_st *pStream,
LVM_INT32 TargetGain,
LVM_INT32 CurrentGain)
@@ -64,4 +76,4 @@
pInstance->Current=CurrentGain<<(16-Shift); // Update fractional gain Current
pInstance->Shift=Shift; // Update Shift
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Private.h b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Private.h
index 294e05c..d0d0e1f 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Private.h
@@ -26,6 +26,15 @@
#include "VectorArithmetic.h"
/* Instance parameter structure */
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ /* General */
+ LVM_FLOAT Target; /*number specifying value of Target Gain */
+ LVM_FLOAT Current; /*number specifying value of Current Gain */
+ LVM_FLOAT Delta; /*number specifying value of Delta Gain */
+} Mix_Private_FLOAT_st;
+#else
typedef struct
{
/* General */
@@ -34,8 +43,7 @@
LVM_INT32 Shift; /* Left Shift for Integer part of Gain */
LVM_INT32 Delta; /* 32 bit number specifying the fractional value of Delta Gain */
} Mix_Private_st;
-
-
+#endif
/**********************************************************************************
DEFINITIONS
@@ -49,23 +57,43 @@
***********************************************************************************/
/*** 16 bit functions *************************************************************/
-
+#ifdef BUILD_FLOAT
+void LVC_Core_MixInSoft_D16C31_SAT( LVMixer3_FLOAT_st *ptrInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+#else
void LVC_Core_MixInSoft_D16C31_SAT( LVMixer3_st *pInstance,
const LVM_INT16 *src,
LVM_INT16 *dst,
LVM_INT16 n);
-
+#endif
+#ifdef BUILD_FLOAT
+void LVC_Core_MixSoft_1St_D16C31_WRA( LVMixer3_FLOAT_st *ptrInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+#else
void LVC_Core_MixSoft_1St_D16C31_WRA( LVMixer3_st *pInstance,
const LVM_INT16 *src,
LVM_INT16 *dst,
LVM_INT16 n);
-
+#endif
+#ifdef BUILD_FLOAT
+void LVC_Core_MixHard_2St_D16C31_SAT( LVMixer3_FLOAT_st *pInstance1,
+ LVMixer3_FLOAT_st *pInstance2,
+ const LVM_FLOAT *src1,
+ const LVM_FLOAT *src2,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+#else
void LVC_Core_MixHard_2St_D16C31_SAT( LVMixer3_st *pInstance1,
LVMixer3_st *pInstance2,
const LVM_INT16 *src1,
const LVM_INT16 *src2,
LVM_INT16 *dst,
LVM_INT16 n);
+#endif
/**********************************************************************************/
/* For applying different gains to Left and right chennals */
@@ -73,12 +101,19 @@
/* ptrInstance2 applies to Right channel */
/* Gain values should not be more that 1.0 */
/**********************************************************************************/
-
+#ifdef BUILD_FLOAT
+void LVC_Core_MixSoft_1St_2i_D16C31_WRA( LVMixer3_FLOAT_st *ptrInstance1,
+ LVMixer3_FLOAT_st *ptrInstance2,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+#else
void LVC_Core_MixSoft_1St_2i_D16C31_WRA( LVMixer3_st *ptrInstance1,
LVMixer3_st *ptrInstance2,
const LVM_INT16 *src,
LVM_INT16 *dst, /* dst can be equal to src */
LVM_INT16 n); /* Number of stereo samples */
+#endif
/**********************************************************************************/
/* For applying different gains to Left and right chennals */
@@ -86,16 +121,22 @@
/* ptrInstance2 applies to Right channel */
/* Gain values should not be more that 1.0 */
/**********************************************************************************/
+#ifdef BUILD_FLOAT
+void LVC_Core_MixHard_1St_2i_D16C31_SAT( LVMixer3_FLOAT_st *ptrInstance1,
+ LVMixer3_FLOAT_st *ptrInstance2,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+#else
void LVC_Core_MixHard_1St_2i_D16C31_SAT( LVMixer3_st *ptrInstance1,
LVMixer3_st *ptrInstance2,
const LVM_INT16 *src,
LVM_INT16 *dst, /* dst can be equal to src */
LVM_INT16 n); /* Number of stereo samples */
-
-
+#endif
/*** 32 bit functions *************************************************************/
-
+#ifndef BUILD_FLOAT
void LVC_Core_MixInSoft_D32C31_SAT( LVMixer3_st *pInstance,
const LVM_INT32 *src,
LVM_INT32 *dst,
@@ -112,7 +153,7 @@
const LVM_INT32 *src2,
LVM_INT32 *dst,
LVM_INT16 n);
-
+#endif
/**********************************************************************************/
#endif //#ifndef __LVC_MIXER_PRIVATE_H__
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTarget.c b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTarget.c
index 5efa501..577179d 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTarget.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTarget.c
@@ -43,7 +43,14 @@
/* void */
/* */
/************************************************************************/
-
+#ifdef BUILD_FLOAT
+void LVC_Mixer_SetTarget(LVMixer3_FLOAT_st *pStream,
+ LVM_FLOAT TargetGain)
+{
+ Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)pStream->PrivateParams;
+ pInstance->Target = TargetGain; // Update gain Target
+}
+#else
void LVC_Mixer_SetTarget(LVMixer3_st *pStream,
LVM_INT32 TargetGain)
{
@@ -64,3 +71,4 @@
pInstance->Current=CurrentGain<<(16-Shift); // Update fractional gain Current
pInstance->Shift=Shift; // Update Shift
}
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTimeConstant.c b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTimeConstant.c
index 4c1c8b2..48f5d54 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTimeConstant.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTimeConstant.c
@@ -44,7 +44,51 @@
/* RETURNS: */
/* void */
/************************************************************************/
+#ifdef BUILD_FLOAT
+void LVC_Mixer_SetTimeConstant(LVMixer3_FLOAT_st *pStream,
+ LVM_INT32 Tc_millisec,
+ LVM_Fs_en Fs,
+ LVM_INT16 NumChannels)
+{
+#ifdef HIGHER_FS
+ LVM_FLOAT DeltaTable[11] = {0.500000f,/*8000*/
+ 0.362812f,/*11025*/
+ 0.333333f,/*12000*/
+ 0.250000f,/*16000*/
+ 0.181406f,/*22050*/
+ 0.166666f,/*24000*/
+ 0.125000f,/*32000*/
+ 0.090703f,/*44100*/
+ 0.083333f,/*48000*/
+ 0.041667f,/*96000*/
+ 0.020833f};/*192000*/
+#else
+ LVM_FLOAT DeltaTable[9] = {0.500000f,/*8000*/
+ 0.362812f,/*11025*/
+ 0.333333f,/*12000*/
+ 0.250000f,/*16000*/
+ 0.181406f,/*22050*/
+ 0.166666f,/*24000*/
+ 0.125000f,/*32000*/
+ 0.090703f,/*44100*/
+ 0.083333f};/*48000*/
+#endif
+ Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)pStream->PrivateParams;
+ LVM_FLOAT Delta = DeltaTable[Fs];
+ Delta = Delta / (NumChannels);
+
+ if(Tc_millisec == 0)
+ Delta = 1.000000f;
+ else
+ Delta = Delta / Tc_millisec;
+
+ if(Delta == 0)
+ Delta = 0.0000000005f; /* If Time Constant is so large that Delta is 0, \
+ assign minimum value to Delta */
+ pInstance->Delta = Delta; // Delta=(2147483647*4*1000)/(NumChannels*SampleRate*Tc_millisec)
+}
+#else
void LVC_Mixer_SetTimeConstant(LVMixer3_st *pStream,
LVM_INT32 Tc_millisec,
LVM_Fs_en Fs,
@@ -73,3 +117,4 @@
pInstance->Delta=Delta; // Delta=(2147483647*4*1000)/(NumChannels*SampleRate*Tc_millisec) in Q 0.31 format
}
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_VarSlope_SetTimeConstant.c b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_VarSlope_SetTimeConstant.c
index 8d5304e..9dc7d21 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_VarSlope_SetTimeConstant.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_VarSlope_SetTimeConstant.c
@@ -45,7 +45,72 @@
/* RETURNS: */
/* void */
/************************************************************************/
+#ifdef BUILD_FLOAT
+void LVC_Mixer_VarSlope_SetTimeConstant( LVMixer3_FLOAT_st *pStream,
+ LVM_INT32 Tc_millisec,
+ LVM_Fs_en Fs,
+ LVM_INT16 NumChannels)
+{
+#ifdef HIGHER_FS
+ LVM_FLOAT DeltaTable[11] = {0.500000f,/*8000*/
+ 0.362812f,/*11025*/
+ 0.333333f,/*12000*/
+ 0.250000f,/*16000*/
+ 0.181406f,/*22050*/
+ 0.166666f,/*24000*/
+ 0.125000f,/*32000*/
+ 0.090703f,/*44100*/
+ 0.083333f,/*48000*/
+ 0.041666f,/*96000*/
+ 0.020833f};/*192000*/
+#else
+ LVM_FLOAT DeltaTable[9] = {0.500000f,/*8000*/
+ 0.362812f,/*11025*/
+ 0.333333f,/*12000*/
+ 0.250000f,/*16000*/
+ 0.181406f,/*22050*/
+ 0.166666f,/*24000*/
+ 0.125000f,/*32000*/
+ 0.090703f,/*44100*/
+ 0.083333f};/*48000*/
+#endif
+ LVM_FLOAT Tc_millisec_float;
+ Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)pStream->PrivateParams;
+ LVM_FLOAT Delta = DeltaTable[Fs];
+ LVM_FLOAT Current;
+ LVM_FLOAT Target;
+
+ Delta=Delta / (NumChannels);
+
+ /* Get gain values */
+ Current = pInstance->Current;
+ Target = pInstance->Target;
+
+ if (Current != Target)
+ {
+ Tc_millisec_float = (LVM_FLOAT)(Tc_millisec) / (Current - Target);
+ if (Tc_millisec_float < 0)
+ Tc_millisec_float = -Tc_millisec_float;
+
+ if(Tc_millisec == 0)
+ Delta = 1.000000f;
+ else
+ Delta = Delta / Tc_millisec_float;
+
+ if(Delta == 0)
+ Delta = 0.0000000005f; /* If Time Constant is so large that Delta is 0, \
+ assign minimum value to Delta */
+ }
+ else
+ {
+ Delta = 0.0000000005f; /* Minimum value for proper call-backs \
+ (setting it to zero has some problems, to be corrected) */
+ }
+
+ pInstance->Delta = Delta; // Delta=(2147483647*4*1000)/(NumChannels*SampleRate*Tc_millisec)
+}
+#else
void LVC_Mixer_VarSlope_SetTimeConstant( LVMixer3_st *pStream,
LVM_INT32 Tc_millisec,
LVM_Fs_en Fs,
@@ -93,3 +158,4 @@
pInstance->Delta=Delta; // Delta=(2147483647*4*1000)/(NumChannels*SampleRate*Tc_millisec) in Q 0.31 format
}
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_FO_HPF.c b/media/libeffects/lvm/lib/Common/src/LVM_FO_HPF.c
index 6d8fe46..9094622 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_FO_HPF.c
+++ b/media/libeffects/lvm/lib/Common/src/LVM_FO_HPF.c
@@ -53,7 +53,7 @@
/* A9 194669577 */
/* A10 8 */
/* */
-/* Y = (A0 + A1*X + A2*X2 + A3*X3 + Â….. + AN*xN) << AN+1 */
+/* Y = (A0 + A1*X + A2*X2 + A3*X3 + �.. + AN*xN) << AN+1 */
/* */
/* */
/* PARAMETERS: */
@@ -68,7 +68,36 @@
/* RETURNS: */
/* */
/*-------------------------------------------------------------------------*/
+#ifdef BUILD_FLOAT
+LVM_FLOAT LVM_FO_HPF( LVM_FLOAT w,
+ FO_FLOAT_Coefs_t *pCoeffs)
+{
+ LVM_FLOAT Y,Coefficients[13] = {-0.999996f,
+ 0.999801f,
+ -0.497824f,
+ 0.322937f,
+ -0.180880f,
+ 0.087658f,
+ -0.032102f,
+ 0.008163f,
+ -0.001252f,
+ 0.000089f,
+ 0,
+ 0,
+ 0};
+ Y=LVM_Polynomial((LVM_UINT16)9, Coefficients, w);
+ pCoeffs->B1 = -Y; /* Store -B1 in filter structure instead of B1!*/
+ /* A0=(1-B1)/2= B1/2 - 0.5*/
+ Y = Y / 2.0f; /* A0=Y=B1/2*/
+ Y = Y - 0.5f; /* A0=Y=(B1/2 - 0.5)*/
+
+ pCoeffs->A0 = Y * FILTER_LOSS_FLOAT; /* Apply loss to avoid overflow*/
+ pCoeffs->A1 = -pCoeffs->A0; /* Store A1=-A0*/
+
+ return 1;
+}
+#else
LVM_INT32 LVM_FO_HPF( LVM_INT32 w,
FO_C32_Coefs_t *pCoeffs)
{
@@ -97,4 +126,4 @@
return 1;
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_FO_LPF.c b/media/libeffects/lvm/lib/Common/src/LVM_FO_LPF.c
index 86ec951..9fe67f8 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_FO_LPF.c
+++ b/media/libeffects/lvm/lib/Common/src/LVM_FO_LPF.c
@@ -53,7 +53,7 @@
/* A9 194669577 */
/* A10 8 */
/* */
-/* Y = (A0 + A1*X + A2*X2 + A3*X3 + Â….. + AN*xN) << AN+1 */
+/* Y = (A0 + A1*X + A2*X2 + A3*X3 + �.. + AN*xN) << AN+1 */
/* */
/* */
/* PARAMETERS: */
@@ -68,7 +68,33 @@
/* RETURNS: */
/* */
/*-------------------------------------------------------------------------*/
+#ifdef BUILD_FLOAT
+LVM_FLOAT LVM_FO_LPF( LVM_FLOAT w,
+ FO_FLOAT_Coefs_t *pCoeffs)
+{
+ LVM_FLOAT Y,Coefficients[13] = {-0.999996f,
+ 0.999801f,
+ -0.497824f,
+ 0.322937f,
+ -0.180880f,
+ 0.087658f,
+ -0.032102f,
+ 0.008163f,
+ -0.001252f,
+ 0.000089f,
+ 0};
+ Y=LVM_Polynomial((LVM_UINT16)9, Coefficients, w);
+ pCoeffs->B1 = -Y; // Store -B1 in filter structure instead of B1!
+ // A0=(1+B1)/2= B1/2 + 0.5
+ Y = Y / 2.0f; // A0=Y=B1/2
+ Y = Y + 0.5f; // A0=Y=(B1/2 + 0.5)
+ pCoeffs->A0 = Y * FILTER_LOSS_FLOAT;
+ pCoeffs->A1 = pCoeffs->A0;
+
+ return 1;
+}
+#else
LVM_INT32 LVM_FO_LPF( LVM_INT32 w,
FO_C32_Coefs_t *pCoeffs)
{
@@ -94,4 +120,4 @@
pCoeffs->A1=pCoeffs->A0;
return 1;
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_GetOmega.c b/media/libeffects/lvm/lib/Common/src/LVM_GetOmega.c
index f3b9b3c..7846ca0 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_GetOmega.c
+++ b/media/libeffects/lvm/lib/Common/src/LVM_GetOmega.c
@@ -32,16 +32,45 @@
#define LVVDL_2PiByFs_SHIFT1 12 /* Qformat shift for 8kHz, 11.025kHz and 12kHz i.e. 12=41-29 */
#define LVVDL_2PiByFs_SHIFT2 13 /* Qformat shift for 16kHz, 22.050kHz and 24kHz i.e. 13=42-29 */
#define LVVDL_2PiByFs_SHIFT3 14 /* Qformat shift for 32kHz, 44.1kHz and 48kHz i.e. 14=43-29 */
-
+#ifndef BUILD_FLOAT
const LVM_INT32 LVVDL_2PiOnFsTable[] = {LVVDL_2PiBy_8000 , /* 8kHz in Q41, 16kHz in Q42, 32kHz in Q43 */
LVVDL_2PiBy_11025, /* 11025 Hz in Q41, 22050Hz in Q42, 44100 Hz in Q43*/
LVVDL_2PiBy_12000}; /* 12kHz in Q41, 24kHz in Q42, 48kHz in Q43 */
-
+#endif
const LVM_INT32 LVVDL_2PiOnFsShiftTable[]={LVVDL_2PiByFs_SHIFT1 , /* 8kHz, 11025Hz, 12kHz */
LVVDL_2PiByFs_SHIFT2, /* 16kHz, 22050Hz, 24kHz*/
LVVDL_2PiByFs_SHIFT3}; /* 32kHz, 44100Hz, 48kHz */
+#ifdef BUILD_FLOAT
+#define LVVDL_2PiBy_8000_f 0.000785398f
+#define LVVDL_2PiBy_11025_f 0.000569903f
+#define LVVDL_2PiBy_12000_f 0.000523599f
+#define LVVDL_2PiBy_16000_f 0.000392700f
+#define LVVDL_2PiBy_22050_f 0.000284952f
+#define LVVDL_2PiBy_24000_f 0.000261800f
+#define LVVDL_2PiBy_32000_f 0.000196350f
+#define LVVDL_2PiBy_44100_f 0.000142476f
+#define LVVDL_2PiBy_48000_f 0.000130900f
+#ifdef HIGHER_FS
+#define LVVDL_2PiBy_96000_f 0.000065450f
+#define LVVDL_2PiBy_192000_f 0.000032725f
+#endif
+const LVM_FLOAT LVVDL_2PiOnFsTable[] = {LVVDL_2PiBy_8000_f,
+ LVVDL_2PiBy_11025_f,
+ LVVDL_2PiBy_12000_f,
+ LVVDL_2PiBy_16000_f,
+ LVVDL_2PiBy_22050_f,
+ LVVDL_2PiBy_24000_f,
+ LVVDL_2PiBy_32000_f,
+ LVVDL_2PiBy_44100_f,
+ LVVDL_2PiBy_48000_f
+#ifdef HIGHER_FS
+ ,LVVDL_2PiBy_96000_f
+ ,LVVDL_2PiBy_192000_f
+#endif
+ };
+#endif
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* LVM_GetOmega */
@@ -59,7 +88,20 @@
/* RETURNS: */
/* w=2*pi*Fc/Fs in Q2.29 format */
/*-------------------------------------------------------------------------*/
-
+#ifdef BUILD_FLOAT
+#ifdef HIGHER_FS
+LVM_FLOAT LVM_GetOmega(LVM_UINT32 Fc,
+ LVM_Fs_en Fs)
+#else
+LVM_FLOAT LVM_GetOmega(LVM_UINT16 Fc,
+ LVM_Fs_en Fs)
+#endif
+{
+ LVM_FLOAT w;
+ w = (LVM_FLOAT)Fc * LVVDL_2PiOnFsTable[Fs];
+ return w;
+}
+#else
LVM_INT32 LVM_GetOmega(LVM_UINT16 Fc,
LVM_Fs_en Fs)
{
@@ -67,4 +109,4 @@
MUL32x32INTO32((LVM_INT32)Fc,LVVDL_2PiOnFsTable[Fs%3],w,LVVDL_2PiOnFsShiftTable[Fs/3])
return w;
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Mixer_FilterCoeffs.h b/media/libeffects/lvm/lib/Common/src/LVM_Mixer_FilterCoeffs.h
index 6846d49..f1e45fa 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Mixer_FilterCoeffs.h
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Mixer_FilterCoeffs.h
@@ -87,5 +87,58 @@
#define ALPHA_49 0 /* Floating point Alpha = 0.000000 */
#define ALPHA_50 0 /* Floating point Alpha = 0.000000 */
+#ifdef BUILD_FLOAT /* BUILD_FLOAT */
+#define ALPHA_Float_0 0.999999f
+#define ALPHA_Float_1 0.999998f
+#define ALPHA_Float_2 0.999997f
+#define ALPHA_Float_3 0.999996f
+#define ALPHA_Float_4 0.999995f
+#define ALPHA_Float_5 0.999992f
+#define ALPHA_Float_6 0.999989f
+#define ALPHA_Float_7 0.999985f
+#define ALPHA_Float_8 0.999979f
+#define ALPHA_Float_9 0.999970f
+#define ALPHA_Float_10 0.999957f
+#define ALPHA_Float_11 0.999939f
+#define ALPHA_Float_12 0.999914f
+#define ALPHA_Float_13 0.999879f
+#define ALPHA_Float_14 0.999829f
+#define ALPHA_Float_15 0.999758f
+#define ALPHA_Float_16 0.999658f
+#define ALPHA_Float_17 0.999516f
+#define ALPHA_Float_18 0.999316f
+#define ALPHA_Float_19 0.999033f
+#define ALPHA_Float_20 0.998633f
+#define ALPHA_Float_21 0.998067f
+#define ALPHA_Float_22 0.997268f
+#define ALPHA_Float_23 0.996139f
+#define ALPHA_Float_24 0.994545f
+#define ALPHA_Float_25 0.992295f
+#define ALPHA_Float_26 0.989123f
+#define ALPHA_Float_27 0.984654f
+#define ALPHA_Float_28 0.978370f
+#define ALPHA_Float_29 0.969553f
+#define ALPHA_Float_30 0.957221f
+#define ALPHA_Float_31 0.940051f
+#define ALPHA_Float_32 0.916297f
+#define ALPHA_Float_33 0.883729f
+#define ALPHA_Float_34 0.839645f
+#define ALPHA_Float_35 0.781036f
+#define ALPHA_Float_36 0.705078f
+#define ALPHA_Float_37 0.610108f
+#define ALPHA_Float_38 0.497239f
+#define ALPHA_Float_39 0.372343f
+#define ALPHA_Float_40 0.247351f
+#define ALPHA_Float_41 0.138722f
+#define ALPHA_Float_42 0.061234f
+#define ALPHA_Float_43 0.019267f
+#define ALPHA_Float_44 0.003756f
+#define ALPHA_Float_45 0.000372f
+#define ALPHA_Float_46 0.000014f
+#define ALPHA_Float_47 0.000000f
+#define ALPHA_Float_48 0.000000f
+#define ALPHA_Float_49 0.000000f
+#define ALPHA_Float_50 0.000000f
+#endif
#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Mixer_TimeConstant.c b/media/libeffects/lvm/lib/Common/src/LVM_Mixer_TimeConstant.c
index 809d904..18b2782 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Mixer_TimeConstant.c
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Mixer_TimeConstant.c
@@ -57,7 +57,110 @@
/* Alpha - the filter coefficient Q31 format */
/* */
/************************************************************************/
+#ifdef BUILD_FLOAT
+LVM_FLOAT LVM_Mixer_TimeConstant(LVM_UINT32 tc,
+#ifdef HIGHER_FS
+ LVM_UINT32 Fs,
+#else
+ LVM_UINT16 Fs,
+#endif
+ LVM_UINT16 NumChannels)
+{
+ LVM_UINT32 Product;
+ LVM_FLOAT ProductFloat;
+ LVM_INT16 InterpolateShort;
+ LVM_FLOAT Interpolate;
+ LVM_UINT16 Shift;
+ LVM_FLOAT Diff;
+ LVM_FLOAT Table[] = {ALPHA_Float_0, /* Log spaced look-up table */
+ ALPHA_Float_1,
+ ALPHA_Float_2,
+ ALPHA_Float_3,
+ ALPHA_Float_4,
+ ALPHA_Float_5,
+ ALPHA_Float_6,
+ ALPHA_Float_7,
+ ALPHA_Float_8,
+ ALPHA_Float_9,
+ ALPHA_Float_10,
+ ALPHA_Float_11,
+ ALPHA_Float_12,
+ ALPHA_Float_13,
+ ALPHA_Float_14,
+ ALPHA_Float_15,
+ ALPHA_Float_16,
+ ALPHA_Float_17,
+ ALPHA_Float_18,
+ ALPHA_Float_19,
+ ALPHA_Float_20,
+ ALPHA_Float_21,
+ ALPHA_Float_22,
+ ALPHA_Float_23,
+ ALPHA_Float_24,
+ ALPHA_Float_25,
+ ALPHA_Float_26,
+ ALPHA_Float_27,
+ ALPHA_Float_28,
+ ALPHA_Float_29,
+ ALPHA_Float_30,
+ ALPHA_Float_31,
+ ALPHA_Float_32,
+ ALPHA_Float_33,
+ ALPHA_Float_34,
+ ALPHA_Float_35,
+ ALPHA_Float_36,
+ ALPHA_Float_37,
+ ALPHA_Float_38,
+ ALPHA_Float_39,
+ ALPHA_Float_40,
+ ALPHA_Float_41,
+ ALPHA_Float_42,
+ ALPHA_Float_43,
+ ALPHA_Float_44,
+ ALPHA_Float_45,
+ ALPHA_Float_46,
+ ALPHA_Float_47,
+ ALPHA_Float_48,
+ ALPHA_Float_49,
+ ALPHA_Float_50};
+
+ /* Calculate the product of the time constant and the sample rate */
+ Product = ((tc >> 16) * (LVM_UINT32)Fs) << 13; /* Stereo value */
+ Product = Product + (((tc & 0x0000FFFF) * (LVM_UINT32)Fs) >> 3);
+
+ if (NumChannels == 1)
+ {
+ Product = Product >> 1; /* Mono value */
+ }
+
+ /* Normalize to get the table index and interpolation factor */
+ for (Shift = 0; Shift < ((Alpha_TableSize - 1) / 2); Shift++)
+ {
+ if ((Product & 0x80000000) != 0)
+ {
+ break;
+ }
+
+ Product = Product << 1;
+ }
+ Shift = (LVM_UINT16)((Shift << 1));
+
+ if ((Product & 0x40000000)==0)
+ {
+ Shift++;
+ }
+
+ InterpolateShort = (LVM_INT16)((Product >> 15) & 0x00007FFF);
+ Interpolate = (LVM_FLOAT)InterpolateShort / 32768.0f;
+
+ Diff = (Table[Shift] - Table[Shift + 1]);
+ Diff = Diff * Interpolate;
+ ProductFloat = Table[Shift + 1] + Diff;
+
+ return ProductFloat;
+}
+#else
LVM_UINT32 LVM_Mixer_TimeConstant(LVM_UINT32 tc,
LVM_UINT16 Fs,
LVM_UINT16 NumChannels)
@@ -154,3 +257,4 @@
return Product;
}
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Polynomial.c b/media/libeffects/lvm/lib/Common/src/LVM_Polynomial.c
index a6d7db2..cd57767 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Polynomial.c
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Polynomial.c
@@ -25,7 +25,7 @@
/* */
/* DESCRIPTION: */
/* This function performs polynomial expansion */
-/* Y = (A0 + A1*X + A2*X2 + A3*X3 + Â….. + AN*xN) << AN+1 */
+/* Y = (A0 + A1*X + A2*X2 + A3*X3 + �.. + AN*xN) << AN+1 */
/* */
/* LVM_INT32 LVM_Polynomial(LVM_UINT16 N, */
/* LVM_INT32 *pCoefficients, */
@@ -40,7 +40,48 @@
/* RETURNS: */
/* The result of the polynomial expansion in Q1.31 format */
/*-------------------------------------------------------------------------*/
+#ifdef BUILD_FLOAT
+LVM_FLOAT LVM_Polynomial(LVM_UINT16 N,
+ LVM_FLOAT *pCoefficients,
+ LVM_FLOAT X)
+{
+ LVM_INT32 i;
+ LVM_FLOAT Y,A,XTemp,Temp,sign;
+ Y = *pCoefficients; /* Y=A0*/
+ pCoefficients++;
+
+ if(X == -1.0f)
+ {
+ Temp = -1;
+ sign = Temp;
+ for(i = 1; i <= N; i++)
+ {
+ Y += ((*pCoefficients) * sign);
+ pCoefficients++;
+ sign *= Temp;
+ }
+
+
+ }
+ else
+ {
+ XTemp = X;
+ for(i = N-1; i >= 0; i--)
+ {
+ A = *pCoefficients;
+ pCoefficients++;
+
+ Temp = A * XTemp;
+ Y += Temp;
+
+ Temp = XTemp * X;
+ XTemp = Temp;
+ }
+ }
+ return Y;
+}
+#else
LVM_INT32 LVM_Polynomial(LVM_UINT16 N,
LVM_INT32 *pCoefficients,
LVM_INT32 X)
@@ -93,4 +134,4 @@
}
return Y;
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Power10.c b/media/libeffects/lvm/lib/Common/src/LVM_Power10.c
index 6ca1077..8785594 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Power10.c
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Power10.c
@@ -44,7 +44,7 @@
/* A11 50477244 */
/* A12 -2 */
/* */
-/* Y = (A0 + A1*X + A2*X2 + A3*X3 + Â….. + AN*xN) << AN+1 */
+/* Y = (A0 + A1*X + A2*X2 + A3*X3 + �.. + AN*xN) << AN+1 */
/* */
/* */
/* PARAMETERS: */
@@ -54,7 +54,28 @@
/* RETURNS: */
/* The result of the 10x expansion in Q8.24 format */
/*-------------------------------------------------------------------------*/
-
+#ifdef BUILD_FLOAT
+LVM_FLOAT LVM_Power10(LVM_FLOAT X)
+{
+ LVM_FLOAT Y,Coefficients[13]={0.999906f,
+ 2.302475f,
+ 2.652765f,
+ 2.035494f,
+ 1.165667f,
+ 0.537676f,
+ 0.213192f,
+ 0.069603f,
+ 0.016553f,
+ 0.004373f,
+ 0.001817f,
+ 0.000367f,
+ 0};
+ Y=LVM_Polynomial((LVM_UINT16)11,
+ Coefficients,
+ X);
+ return Y;
+}
+#else
LVM_INT32 LVM_Power10(LVM_INT32 X)
{
LVM_INT32 Y,Coefficients[13]={ 16775636,
@@ -75,4 +96,4 @@
X);
return Y;
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LoadConst_32.c b/media/libeffects/lvm/lib/Common/src/LoadConst_32.c
index 2f1e591..9e14c3b 100644
--- a/media/libeffects/lvm/lib/Common/src/LoadConst_32.c
+++ b/media/libeffects/lvm/lib/Common/src/LoadConst_32.c
@@ -24,7 +24,22 @@
/**********************************************************************************
FUNCTION LoadConst_32
***********************************************************************************/
+#ifdef BUILD_FLOAT
+void LoadConst_Float(const LVM_FLOAT val,
+ LVM_FLOAT *dst,
+ LVM_INT16 n )
+{
+ LVM_INT16 ii;
+ for (ii = n; ii != 0; ii--)
+ {
+ *dst = val;
+ dst++;
+ }
+
+ return;
+}
+#else
void LoadConst_32(const LVM_INT32 val,
LVM_INT32 *dst,
LVM_INT16 n )
@@ -39,5 +54,6 @@
return;
}
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/MSTo2i_Sat_16x16.c b/media/libeffects/lvm/lib/Common/src/MSTo2i_Sat_16x16.c
index 26297e7..02c906a 100644
--- a/media/libeffects/lvm/lib/Common/src/MSTo2i_Sat_16x16.c
+++ b/media/libeffects/lvm/lib/Common/src/MSTo2i_Sat_16x16.c
@@ -77,4 +77,58 @@
return;
}
+#ifdef BUILD_FLOAT
+void MSTo2i_Sat_Float(const LVM_FLOAT *srcM,
+ const LVM_FLOAT *srcS,
+ LVM_FLOAT *dst,
+ LVM_INT16 n )
+{
+ LVM_FLOAT temp,mVal,sVal;
+ LVM_INT16 ii;
+
+
+ for (ii = n; ii != 0; ii--)
+ {
+ mVal = (LVM_FLOAT)*srcM;
+ srcM++;
+
+ sVal = (LVM_FLOAT)*srcS;
+ srcS++;
+
+ temp = mVal + sVal;
+
+ if (temp > 1.0f)
+ {
+ *dst = 1.0f;
+ }
+ else if (temp < -1.0f)
+ {
+ *dst = -1.0f;
+ }
+ else
+ {
+ *dst = (LVM_FLOAT)temp;
+ }
+ dst++;
+
+ temp = mVal - sVal;
+
+ if (temp > 1.0f)
+ {
+ *dst = 1.0f;
+ }
+ else if (temp < -1.0f)
+ {
+ *dst = - 1.0f;
+ }
+ else
+ {
+ *dst = (LVM_FLOAT)temp;
+ }
+ dst++;
+ }
+
+ return;
+}
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.c b/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.c
index f28f366..e3fb40d 100644
--- a/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.c
+++ b/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.c
@@ -64,7 +64,44 @@
return;
}
+#ifdef BUILD_FLOAT
+void Mac3s_Sat_Float(const LVM_FLOAT *src,
+ const LVM_FLOAT val,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ LVM_INT16 ii;
+ LVM_FLOAT srcval;
+ LVM_FLOAT Temp,dInVal;
+ for (ii = n; ii != 0; ii--)
+ {
+ srcval = *src;
+ src++;
+
+ Temp = srcval * val;
+
+ dInVal = (LVM_FLOAT)*dst;
+ Temp = Temp + dInVal;
+
+ if (Temp > 1.000000f)
+ {
+ *dst = 1.000000f;
+ }
+ else if (Temp < -1.000000f)
+ {
+ *dst = -1.000000f;
+ }
+ else
+ {
+ *dst = Temp;
+ }
+ dst++;
+ }
+
+ return;
+}
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/MixInSoft_D32C31_SAT.c b/media/libeffects/lvm/lib/Common/src/MixInSoft_D32C31_SAT.c
index 73c26ed..16e367b 100644
--- a/media/libeffects/lvm/lib/Common/src/MixInSoft_D32C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/MixInSoft_D32C31_SAT.c
@@ -32,7 +32,71 @@
/**********************************************************************************
FUNCTION MIXINSOFT_D32C31_SAT
***********************************************************************************/
+#ifdef BUILD_FLOAT
+void MixInSoft_D32C31_SAT( Mix_1St_Cll_FLOAT_t *pInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ char HardMixing = TRUE;
+ if(n <= 0) return;
+
+ /******************************************************************************
+ SOFT MIXING
+ *******************************************************************************/
+ if (pInstance->Current != pInstance->Target)
+ {
+ if(pInstance->Alpha == 0){
+ pInstance->Current = pInstance->Target;
+ }else if ((pInstance->Current-pInstance->Target < POINT_ZERO_ONE_DB_FLOAT) &&
+ (pInstance->Current-pInstance->Target > -POINT_ZERO_ONE_DB_FLOAT)){
+ pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
+ Make them equal. */
+ }else{
+ /* Soft mixing has to be applied */
+ HardMixing = FALSE;
+ Core_MixInSoft_D32C31_SAT(pInstance, src, dst, n);
+ }
+ }
+
+ /******************************************************************************
+ HARD MIXING
+ *******************************************************************************/
+
+ if (HardMixing){
+ if (pInstance->Target != 0){ /* Nothing to do in case Target = 0 */
+ if ((pInstance->Target) == 1.0f)
+ Add2_Sat_Float(src, dst, n);
+ else{
+ Core_MixInSoft_D32C31_SAT(pInstance, src, dst, n);
+ pInstance->Current = pInstance->Target; /* In case the core function would \
+ have changed the Current value */
+ }
+ }
+ }
+
+ /******************************************************************************
+ CALL BACK
+ *******************************************************************************/
+ /* Call back before the hard mixing, because in this case, hard mixing makes
+ use of the core soft mix function which can change the Current value! */
+
+ if (pInstance->CallbackSet){
+ if ((pInstance->Current - pInstance->Target < POINT_ZERO_ONE_DB_FLOAT) &&
+ (pInstance->Current - pInstance->Target > -POINT_ZERO_ONE_DB_FLOAT)){
+ pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
+ Make them equal. */
+ pInstance->CallbackSet = FALSE;
+ if (pInstance->pCallBack != 0){
+ (*pInstance->pCallBack) ( pInstance->pCallbackHandle,
+ pInstance->pGeneralPurpose,
+ pInstance->CallbackParam );
+ }
+ }
+ }
+}
+#else
void MixInSoft_D32C31_SAT( Mix_1St_Cll_t *pInstance,
const LVM_INT32 *src,
LVM_INT32 *dst,
@@ -91,5 +155,5 @@
}
}
}
-
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/MixSoft_1St_D32C31_WRA.c b/media/libeffects/lvm/lib/Common/src/MixSoft_1St_D32C31_WRA.c
index ca88b04..869293b 100644
--- a/media/libeffects/lvm/lib/Common/src/MixSoft_1St_D32C31_WRA.c
+++ b/media/libeffects/lvm/lib/Common/src/MixSoft_1St_D32C31_WRA.c
@@ -34,7 +34,68 @@
/**********************************************************************************
FUNCTION MIXSOFT_1ST_D32C31_WRA
***********************************************************************************/
+#ifdef BUILD_FLOAT
+void MixSoft_1St_D32C31_WRA( Mix_1St_Cll_FLOAT_t *pInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ char HardMixing = TRUE;
+ if(n <= 0) return;
+
+ /******************************************************************************
+ SOFT MIXING
+ *******************************************************************************/
+ if (pInstance->Current != pInstance->Target)
+ {
+ if(pInstance->Alpha == 0){
+ pInstance->Current = pInstance->Target;
+ }else if ((pInstance->Current - pInstance->Target < POINT_ZERO_ONE_DB_FLOAT) &&
+ (pInstance->Current - pInstance->Target > -POINT_ZERO_ONE_DB_FLOAT)){
+ pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
+ Make them equal. */
+ }else{
+ /* Soft mixing has to be applied */
+ HardMixing = FALSE;
+ Core_MixSoft_1St_D32C31_WRA(pInstance, src, dst, n);
+ }
+ }
+
+ /******************************************************************************
+ HARD MIXING
+ *******************************************************************************/
+
+ if (HardMixing){
+ if (pInstance->Target == 0)
+ LoadConst_Float(0, dst, n);
+ else if ((pInstance->Target) == 1.0f){
+ if (src != dst)
+ Copy_Float((LVM_FLOAT*)src, (LVM_FLOAT*)dst, (LVM_INT16)(n));
+ }
+ else
+ Mult3s_Float(src, pInstance->Current, dst, n);
+ }
+
+ /******************************************************************************
+ CALL BACK
+ *******************************************************************************/
+
+ if (pInstance->CallbackSet){
+ if ((pInstance->Current - pInstance->Target < POINT_ZERO_ONE_DB_FLOAT) &&
+ (pInstance->Current - pInstance->Target > -POINT_ZERO_ONE_DB_FLOAT)){
+ pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
+ Make them equal. */
+ pInstance->CallbackSet = FALSE;
+ if (pInstance->pCallBack != 0){
+ (*pInstance->pCallBack) ( pInstance->pCallbackHandle,
+ pInstance->pGeneralPurpose,
+ pInstance->CallbackParam );
+ }
+ }
+ }
+}
+#else
void MixSoft_1St_D32C31_WRA( Mix_1St_Cll_t *pInstance,
const LVM_INT32 *src,
LVM_INT32 *dst,
@@ -91,5 +152,5 @@
}
}
}
-
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/MixSoft_2St_D32C31_SAT.c b/media/libeffects/lvm/lib/Common/src/MixSoft_2St_D32C31_SAT.c
index 2e0a099..6fc1b92 100644
--- a/media/libeffects/lvm/lib/Common/src/MixSoft_2St_D32C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/MixSoft_2St_D32C31_SAT.c
@@ -26,7 +26,44 @@
/**********************************************************************************
FUNCTION MIXSOFT_2ST_D32C31_SAT
***********************************************************************************/
+#ifdef BUILD_FLOAT
+void MixSoft_2St_D32C31_SAT( Mix_2St_Cll_FLOAT_t *pInstance,
+ const LVM_FLOAT *src1,
+ const LVM_FLOAT *src2,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ if(n <= 0) return;
+
+ /******************************************************************************
+ SOFT MIXING
+ *******************************************************************************/
+ if ((pInstance->Current1 != pInstance->Target1) || (pInstance->Current2 != pInstance->Target2))
+ {
+ MixSoft_1St_D32C31_WRA((Mix_1St_Cll_FLOAT_t*)pInstance, src1, dst, n);
+ MixInSoft_D32C31_SAT((void *)&pInstance->Alpha2, /* Cast to void: \
+ no dereferencing in function*/
+ src2, dst, n);
+ }
+
+ /******************************************************************************
+ HARD MIXING
+ *******************************************************************************/
+
+ else
+ {
+ if (pInstance->Current1 == 0)
+ MixSoft_1St_D32C31_WRA((void *) &pInstance->Alpha2, /* Cast to void: no \
+ dereferencing in function*/
+ src2, dst, n);
+ else if (pInstance->Current2 == 0)
+ MixSoft_1St_D32C31_WRA((Mix_1St_Cll_FLOAT_t*) pInstance, src1, dst, n);
+ else
+ Core_MixHard_2St_D32C31_SAT(pInstance, src1, src2, dst, n);
+ }
+}
+#else
void MixSoft_2St_D32C31_SAT( Mix_2St_Cll_t *pInstance,
const LVM_INT32 *src1,
const LVM_INT32 *src2,
@@ -61,5 +98,6 @@
Core_MixHard_2St_D32C31_SAT( pInstance, src1, src2, dst, n);
}
}
-
+#endif
/**********************************************************************************/
+
diff --git a/media/libeffects/lvm/lib/Common/src/Mixer_private.h b/media/libeffects/lvm/lib/Common/src/Mixer_private.h
index 607073c..00d55ed 100644
--- a/media/libeffects/lvm/lib/Common/src/Mixer_private.h
+++ b/media/libeffects/lvm/lib/Common/src/Mixer_private.h
@@ -26,6 +26,10 @@
#define POINT_ZERO_ONE_DB 2473805 /* 0.01 dB on a full scale signal = (10^(0.01/20) -1) * 2^31 */
+#ifdef BUILD_FLOAT
+#define POINT_ZERO_ONE_DB_FLOAT 0.001152 /* 0.01 dB on a full scale \
+ signal = (10^(0.01/20) -1) * 2^31 */
+#endif
/**********************************************************************************
DEFINITIONS
***********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/MonoTo2I_32.c b/media/libeffects/lvm/lib/Common/src/MonoTo2I_32.c
index c09ec0f..796a15c 100644
--- a/media/libeffects/lvm/lib/Common/src/MonoTo2I_32.c
+++ b/media/libeffects/lvm/lib/Common/src/MonoTo2I_32.c
@@ -45,5 +45,26 @@
return;
}
+#ifdef BUILD_FLOAT
+void MonoTo2I_Float( const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ LVM_INT16 ii;
+ src += (n - 1);
+ dst += ((n * 2) - 1);
+ for (ii = n; ii != 0; ii--)
+ {
+ *dst = *src;
+ dst--;
+
+ *dst = *src;
+ dst--;
+ src--;
+ }
+
+ return;
+}
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Mult3s_32x16.c b/media/libeffects/lvm/lib/Common/src/Mult3s_32x16.c
index a5dc50f..c758560 100644
--- a/media/libeffects/lvm/lib/Common/src/Mult3s_32x16.c
+++ b/media/libeffects/lvm/lib/Common/src/Mult3s_32x16.c
@@ -47,5 +47,23 @@
return;
}
+#ifdef BUILD_FLOAT
+void Mult3s_Float( const LVM_FLOAT *src,
+ const LVM_FLOAT val,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ LVM_INT16 ii;
+ LVM_FLOAT temp;
+ for (ii = n; ii != 0; ii--)
+ {
+ temp = (*src) * val;
+ src++;
+ *dst = temp;
+ dst++;
+ }
+ return;
+}
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/NonLinComp_D16.c b/media/libeffects/lvm/lib/Common/src/NonLinComp_D16.c
index 73343cd..5156edc 100644
--- a/media/libeffects/lvm/lib/Common/src/NonLinComp_D16.c
+++ b/media/libeffects/lvm/lib/Common/src/NonLinComp_D16.c
@@ -114,4 +114,54 @@
}
}
+#ifdef BUILD_FLOAT
+void NonLinComp_Float(LVM_FLOAT Gain,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT32 BlockLength)
+{
+ LVM_FLOAT Sample; /* Input samples */
+ LVM_INT32 SampleNo; /* Sample index */
+ LVM_FLOAT Temp;
+
+
+ /*
+ * Process a block of samples
+ */
+ for(SampleNo = 0; SampleNo < BlockLength; SampleNo++)
+ {
+ /*
+ * Read the input
+ */
+ Sample = *pDataIn;
+ pDataIn++;
+
+
+ /*
+ * Apply the compander, this compresses the signal at the expense of
+ * harmonic distortion. The amount of compression is control by the
+ * gain factor
+ */
+ if (Sample != -1.0f)
+ {
+ Temp = ((Sample * Sample));
+ if(Sample > 0)
+ {
+ Sample = (Sample + ((Gain * (Sample - Temp)) ));
+ }
+ else
+ {
+ Sample = (Sample + ((Gain * (Sample + Temp)) ));
+ }
+ }
+
+
+ /*
+ * Save the output
+ */
+ *pDataOut = Sample;
+ pDataOut++;
+ }
+}
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C14G11_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C14G11_TRC_WRA_01.c
index c8c1527..9c17a05 100644
--- a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C14G11_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C14G11_TRC_WRA_01.c
@@ -38,6 +38,88 @@
pBiquadState->pDelays[6] is y(n-2)L in Q0 format
pBiquadState->pDelays[7] is y(n-2)R in Q0 format
***************************************************************************/
+#ifdef BUILD_FLOAT
+void PK_2I_D32F32C14G11_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples)
+ {
+ LVM_FLOAT ynL,ynR,ynLO,ynRO,templ;
+ LVM_INT16 ii;
+ PFilter_State_Float pBiquadState = (PFilter_State_Float) pInstance;
+
+ for (ii = NrSamples; ii != 0; ii--)
+ {
+
+
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ /* ynL= (A0 * (x(n)L - x(n-2)L ) )*/
+ templ = (*pDataIn) - pBiquadState->pDelays[2];
+ ynL = templ * pBiquadState->coefs[0];
+
+ /* ynL+= ((-B2 * y(n-2)L )) */
+ templ = pBiquadState->pDelays[6] * pBiquadState->coefs[1];
+ ynL += templ;
+
+ /* ynL+= ((-B1 * y(n-1)L ) ) */
+ templ = pBiquadState->pDelays[4] * pBiquadState->coefs[2];
+ ynL += templ;
+
+ /* ynLO= ((Gain * ynL )) */
+ ynLO = ynL * pBiquadState->coefs[3];
+
+ /* ynLO=( ynLO + x(n)L )*/
+ ynLO += (*pDataIn);
+
+ /**************************************************************************
+ PROCESSING OF THE RIGHT CHANNEL
+ ***************************************************************************/
+ /* ynR= (A0 * (x(n)R - x(n-2)R ) ) */
+ templ = (*(pDataIn + 1)) - pBiquadState->pDelays[3];
+ ynR = templ * pBiquadState->coefs[0];
+
+ /* ynR+= ((-B2 * y(n-2)R ) ) */
+ templ = pBiquadState->pDelays[7] * pBiquadState->coefs[1];
+ ynR += templ;
+
+ /* ynR+= ((-B1 * y(n-1)R ) ) */
+ templ = pBiquadState->pDelays[5] * pBiquadState->coefs[2];
+ ynR += templ;
+
+ /* ynRO= ((Gain * ynR )) */
+ ynRO = ynR * pBiquadState->coefs[3];
+
+ /* ynRO=( ynRO + x(n)R )*/
+ ynRO += (*(pDataIn+1));
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[7] = pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
+ pBiquadState->pDelays[6] = pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
+ pBiquadState->pDelays[3] = pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
+ pBiquadState->pDelays[2] = pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
+ pBiquadState->pDelays[5] = ynR; /* Update y(n-1)R */
+ pBiquadState->pDelays[4] = ynL; /* Update y(n-1)L */
+ pBiquadState->pDelays[0] = (*pDataIn); /* Update x(n-1)L */
+ pDataIn++;
+ pBiquadState->pDelays[1] = (*pDataIn); /* Update x(n-1)R */
+ pDataIn++;
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut = ynLO; /* Write Left output*/
+ pDataOut++;
+ *pDataOut = ynRO; /* Write Right ouput*/
+ pDataOut++;
+
+ }
+
+ }
+#else
void PK_2I_D32F32C14G11_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT32 *pDataIn,
LVM_INT32 *pDataOut,
@@ -118,4 +200,4 @@
}
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C30G11_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C30G11_TRC_WRA_01.c
index 67a570b..f705cbf 100644
--- a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C30G11_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C30G11_TRC_WRA_01.c
@@ -38,6 +38,7 @@
pBiquadState->pDelays[6] is y(n-2)L in Q0 format
pBiquadState->pDelays[7] is y(n-2)R in Q0 format
***************************************************************************/
+#ifndef BUILD_FLOAT
void PK_2I_D32F32C30G11_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT32 *pDataIn,
LVM_INT32 *pDataOut,
@@ -116,4 +117,4 @@
}
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Init.c
index 1d6142c..65475a3 100644
--- a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Init.c
@@ -18,7 +18,7 @@
#include "BIQUAD.h"
#include "PK_2I_D32F32CllGss_TRC_WRA_01_Private.h"
-
+#ifndef BUILD_FLOAT
void PK_2I_D32F32CllGss_TRC_WRA_01_Init(Biquad_Instance_t *pInstance,
Biquad_2I_Order2_Taps_t *pTaps,
PK_C32_Coefs_t *pCoef)
@@ -35,4 +35,4 @@
pBiquadState->coefs[3]=pCoef->G;
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Init.c
index b9f64e6..a36330e 100644
--- a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Init.c
@@ -17,7 +17,23 @@
#include "BIQUAD.h"
#include "PK_2I_D32F32CssGss_TRC_WRA_01_Private.h"
+#ifdef BUILD_FLOAT
+void PK_2I_D32F32CssGss_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
+ PK_FLOAT_Coefs_t *pCoef)
+{
+ PFilter_State_Float pBiquadState = (PFilter_State_Float) pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT *) pTaps;
+ pBiquadState->coefs[0] = pCoef->A0;
+
+ pBiquadState->coefs[1] = pCoef->B2;
+
+ pBiquadState->coefs[2] = pCoef->B1;
+
+ pBiquadState->coefs[3] = pCoef->G;
+}
+#else
void PK_2I_D32F32CssGss_TRC_WRA_01_Init(Biquad_Instance_t *pInstance,
Biquad_2I_Order2_Taps_t *pTaps,
PK_C16_Coefs_t *pCoef)
@@ -34,4 +50,4 @@
pBiquadState->coefs[3]=pCoef->G;
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Private.h
index e2050e0..1e32062 100644
--- a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Private.h
@@ -21,6 +21,16 @@
/* The internal state variables are implemented in a (for the user) hidden structure */
/* In this (private) file, the internal structure is declared fro private use. */
+
+#ifdef BUILD_FLOAT
+typedef struct _Filter_State_Float_
+{
+ LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
+}Filter_State_Float;
+
+typedef Filter_State_Float * PFilter_State_Float ;
+#endif
typedef struct _Filter_State_
{
LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
diff --git a/media/libeffects/lvm/lib/Common/src/Shift_Sat_v16xv16.c b/media/libeffects/lvm/lib/Common/src/Shift_Sat_v16xv16.c
index 8363270..28fea65 100644
--- a/media/libeffects/lvm/lib/Common/src/Shift_Sat_v16xv16.c
+++ b/media/libeffects/lvm/lib/Common/src/Shift_Sat_v16xv16.c
@@ -24,7 +24,7 @@
/**********************************************************************************
FUNCTION Shift_Sat_v16xv16
***********************************************************************************/
-
+#ifndef BUILD_FLOAT
void Shift_Sat_v16xv16 (const LVM_INT16 val,
const LVM_INT16 *src,
LVM_INT16 *dst,
@@ -77,5 +77,5 @@
}
return;
}
-
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Shift_Sat_v32xv32.c b/media/libeffects/lvm/lib/Common/src/Shift_Sat_v32xv32.c
index fbd132e..fac9de7 100644
--- a/media/libeffects/lvm/lib/Common/src/Shift_Sat_v32xv32.c
+++ b/media/libeffects/lvm/lib/Common/src/Shift_Sat_v32xv32.c
@@ -24,7 +24,62 @@
/**********************************************************************************
FUNCTION Shift_Sat_v32xv32
***********************************************************************************/
+#ifdef BUILD_FLOAT
+void Shift_Sat_Float (const LVM_INT16 val,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ LVM_FLOAT temp;
+ LVM_INT32 ii,ij;
+ LVM_INT16 RShift;
+ if(val > 0)
+ {
+ for (ii = n; ii != 0; ii--)
+ {
+ temp = (LVM_FLOAT)*src;
+ src++;
+ for(ij = 0; ij < val; ij++)
+ {
+ temp = temp * 2;
+ }
+
+ if(temp > 1.0)
+ temp = 1.0;
+ if(temp < -1.0)
+ temp = -1.0;
+
+ *dst = (LVM_FLOAT)temp;
+ dst++;
+ }
+ }
+ else if(val < 0)
+ {
+ RShift=(LVM_INT16)(-val);
+
+ for (ii = n; ii != 0; ii--)
+ {
+ temp = (LVM_FLOAT)*src;
+ src++;
+ for(ij = 0; ij < RShift; ij++)
+ {
+ temp = temp / 2;
+ }
+ *dst = (LVM_FLOAT)temp;
+ dst++;
+ }
+ }
+ else
+ {
+ if(src != dst)
+ {
+ Copy_Float(src, dst, n);
+ }
+ }
+ return;
+}
+#else
void Shift_Sat_v32xv32 (const LVM_INT16 val,
const LVM_INT32 *src,
LVM_INT32 *dst,
@@ -79,5 +134,5 @@
}
return;
}
-
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/dB_to_Lin32.c b/media/libeffects/lvm/lib/Common/src/dB_to_Lin32.c
index ac0343f..9a726f2 100644
--- a/media/libeffects/lvm/lib/Common/src/dB_to_Lin32.c
+++ b/media/libeffects/lvm/lib/Common/src/dB_to_Lin32.c
@@ -29,6 +29,9 @@
/*######################################################################################*/
#include "ScalarArithmetic.h"
+#ifdef BUILD_FLOAT
+#include <math.h>
+#endif
/****************************************************************************************
@@ -64,6 +67,18 @@
#define SECOND_COEF 38836
#define MAX_VALUE 1536 /* 96 * 16 */
+#ifdef BUILD_FLOAT
+LVM_FLOAT dB_to_LinFloat(LVM_INT16 db_fix)
+{
+ LVM_FLOAT dB_Float;
+ LVM_FLOAT LinFloat;
+
+ dB_Float = (LVM_FLOAT)((LVM_FLOAT)db_fix / 16.0f);
+ LinFloat = pow(10, dB_Float / 20.0);
+
+ return LinFloat;
+}
+#else
LVM_INT32 dB_to_Lin32(LVM_INT16 db_fix)
{
LVM_INT32 Lin_val_32;
@@ -106,4 +121,4 @@
return Lin_val_32; /* format 1.16.15 */
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Eq/lib/LVEQNB.h b/media/libeffects/lvm/lib/Eq/lib/LVEQNB.h
index db6aabe..8e0b738 100644
--- a/media/libeffects/lvm/lib/Eq/lib/LVEQNB.h
+++ b/media/libeffects/lvm/lib/Eq/lib/LVEQNB.h
@@ -200,6 +200,10 @@
#define LVEQNB_CAP_FS_32000 64
#define LVEQNB_CAP_FS_44100 128
#define LVEQNB_CAP_FS_48000 256
+#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
+#define LVEQNB_CAP_FS_96000 512
+#define LVEQNB_CAP_FS_192000 1024
+#endif
typedef enum
{
@@ -212,6 +216,10 @@
LVEQNB_FS_32000 = 6,
LVEQNB_FS_44100 = 7,
LVEQNB_FS_48000 = 8,
+#ifdef HIGHER_FS
+ LVEQNB_FS_96000 = 9,
+ LVEQNB_FS_192000 = 10,
+#endif
LVEQNB_FS_MAX = LVM_MAXINT_32
} LVEQNB_Fs_en;
@@ -268,6 +276,7 @@
{
/* General parameters */
LVM_UINT16 SampleRate;
+
LVM_UINT16 SourceFormat;
LVM_UINT16 MaxBlockSize;
LVM_UINT16 MaxBands;
@@ -460,11 +469,17 @@
/* NOTES: */
/* */
/****************************************************************************************/
-
+#ifdef BUILD_FLOAT
+LVEQNB_ReturnStatus_en LVEQNB_Process(LVEQNB_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 NumSamples);
+#else
LVEQNB_ReturnStatus_en LVEQNB_Process(LVEQNB_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 *pOutData,
LVM_UINT16 NumSamples);
+#endif
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_CalcCoef.c b/media/libeffects/lvm/lib/Eq/src/LVEQNB_CalcCoef.c
index fddedb9..ff52b7f 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_CalcCoef.c
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_CalcCoef.c
@@ -22,7 +22,9 @@
/****************************************************************************************/
#include "LVEQNB_Private.h"
-
+#ifdef BUILD_FLOAT
+#include <math.h>
+#endif
/****************************************************************************************/
/* */
@@ -77,6 +79,7 @@
/****************************************************************************************/
+#ifndef BUILD_FLOAT
LVEQNB_ReturnStatus_en LVEQNB_DoublePrecCoefs(LVM_UINT16 Fs,
LVEQNB_BandDef_t *pFilterDefinition,
PK_C32_Coefs_t *pCoefficients)
@@ -168,7 +171,7 @@
return(LVEQNB_SUCCESS);
}
-
+#endif
/****************************************************************************************/
/* */
@@ -205,7 +208,67 @@
/* */
/****************************************************************************************/
+#ifdef BUILD_FLOAT
+LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16 Fs,
+ LVEQNB_BandDef_t *pFilterDefinition,
+ PK_FLOAT_Coefs_t *pCoefficients)
+{
+ extern LVM_FLOAT LVEQNB_GainTable[];
+ extern LVM_FLOAT LVEQNB_TwoPiOnFsTable[];
+ extern LVM_FLOAT LVEQNB_DTable[];
+
+
+ /*
+ * Get the filter definition
+ */
+ LVM_INT16 Gain = pFilterDefinition->Gain;
+ LVM_UINT16 Frequency = pFilterDefinition->Frequency;
+ /* As mentioned in effectbundle.h */
+ LVM_FLOAT QFactor = (LVM_FLOAT)pFilterDefinition->QFactor / 100.0f;
+
+
+ /*
+ * Intermediate variables and temporary values
+ */
+ LVM_FLOAT T0;
+ LVM_FLOAT D;
+ LVM_FLOAT A0;
+ LVM_FLOAT B1;
+ LVM_FLOAT B2;
+
+ /*
+ * Calculating the intermediate values
+ */
+ T0 = Frequency * LVEQNB_TwoPiOnFsTable[Fs]; /* T0 = 2 * Pi * Fc / Fs */
+ if (Gain >= 0)
+ {
+ D = LVEQNB_DTable[15]; /* D = 1 if GaindB >= 0 */
+ }
+ else
+ {
+ D = LVEQNB_DTable[Gain + 15]; /* D = 1 / (1 + G) if GaindB < 0 */
+ }
+
+ /*
+ * Calculate the B2,B1,A0 coefficients
+ */
+ B2 = -0.5 * (2 * QFactor - D * T0) / (2 * QFactor + D * T0);
+ B1 = (0.5 - B2) * cos(T0);
+ A0 = (0.5 + B2) / 2.0;
+
+ /*
+ * Write coeff into the data structure
+ */
+ /* all the coefficients are multiplied with 2 to make them align with fixed point values*/
+ pCoefficients->A0 = 2 * A0;
+ pCoefficients->B1 = 2 * B1;
+ pCoefficients->B2 = 2 * B2;
+ pCoefficients->G = LVEQNB_GainTable[Gain + 15];
+
+ return(LVEQNB_SUCCESS);
+}
+#else
LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16 Fs,
LVEQNB_BandDef_t *pFilterDefinition,
PK_C16_Coefs_t *pCoefficients)
@@ -296,3 +359,4 @@
return(LVEQNB_SUCCESS);
}
+#endif
\ No newline at end of file
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h
index 95212f2..f0deb6c 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h
@@ -25,7 +25,39 @@
/* Gain table for (10^(Gain/20) - 1) */
/* */
/************************************************************************************/
-
+#ifdef BUILD_FLOAT
+#define LVEQNB_Gain_Neg15_dB -0.822172f
+#define LVEQNB_Gain_Neg14_dB -0.800474f
+#define LVEQNB_Gain_Neg13_dB -0.776128f
+#define LVEQNB_Gain_Neg12_dB -0.748811f
+#define LVEQNB_Gain_Neg11_dB -0.718162f
+#define LVEQNB_Gain_Neg10_dB -0.683772f
+#define LVEQNB_Gain_Neg9_dB -0.645187f
+#define LVEQNB_Gain_Neg8_dB -0.601893f
+#define LVEQNB_Gain_Neg7_dB -0.553316f
+#define LVEQNB_Gain_Neg6_dB -0.498813f
+#define LVEQNB_Gain_Neg5_dB -0.437659f
+#define LVEQNB_Gain_Neg4_dB -0.369043f
+#define LVEQNB_Gain_Neg3_dB -0.292054f
+#define LVEQNB_Gain_Neg2_dB -0.205672f
+#define LVEQNB_Gain_Neg1_dB -0.108749f
+#define LVEQNB_Gain_0_dB 0.000000f
+#define LVEQNB_Gain_1_dB 0.122018f
+#define LVEQNB_Gain_2_dB 0.258925f
+#define LVEQNB_Gain_3_dB 0.412538f
+#define LVEQNB_Gain_4_dB 0.584893f
+#define LVEQNB_Gain_5_dB 0.778279f
+#define LVEQNB_Gain_6_dB 0.995262f
+#define LVEQNB_Gain_7_dB 1.238721f
+#define LVEQNB_Gain_8_dB 1.511886f
+#define LVEQNB_Gain_9_dB 1.818383f
+#define LVEQNB_Gain_10_dB 2.162278f
+#define LVEQNB_Gain_11_dB 2.548134f
+#define LVEQNB_Gain_12_dB 2.981072f
+#define LVEQNB_Gain_13_dB 3.466836f
+#define LVEQNB_Gain_14_dB 4.011872f
+#define LVEQNB_Gain_15_dB 4.623413f
+#else
#define LVEQNB_GAINSHIFT 11 /* As a power of 2 */
#define LVEQNB_Gain_Neg15_dB (-1684) /* Floating point value -0.822172 */
#define LVEQNB_Gain_Neg14_dB (-1639) /* Floating point value -0.800474 */
@@ -58,14 +90,30 @@
#define LVEQNB_Gain_13_dB 7100 /* Floating point value 3.466836 */
#define LVEQNB_Gain_14_dB 8216 /* Floating point value 4.011872 */
#define LVEQNB_Gain_15_dB 9469 /* Floating point value 4.623413 */
-
+#endif
/************************************************************************************/
/* */
/* Frequency table for 2*Pi/Fs */
/* */
/************************************************************************************/
+#ifdef BUILD_FLOAT
+#define LVEQNB_2PiOn_8000 0.000785f
+#define LVEQNB_2PiOn_11025 0.000570f
+#define LVEQNB_2PiOn_12000 0.000524f
+#define LVEQNB_2PiOn_16000 0.000393f
+#define LVEQNB_2PiOn_22050 0.000285f
+#define LVEQNB_2PiOn_24000 0.000262f
+#define LVEQNB_2PiOn_32000 0.000196f
+#define LVEQNB_2PiOn_44100 0.000142f
+#define LVEQNB_2PiOn_48000 0.000131f
+#ifdef HIGHER_FS
+#define LVEQNB_2PiOn_96000 0.000065f
+#define LVEQNB_2PiOn_192000 0.000033f
+#endif
+
+#else
#define LVEQNB_FREQSHIFT 25 /* As a power of 2 */
#define LVEQNB_2PiOn_8000 26354 /* Floating point value 0.000785 */
#define LVEQNB_2PiOn_11025 19123 /* Floating point value 0.000570 */
@@ -76,14 +124,31 @@
#define LVEQNB_2PiOn_32000 6588 /* Floating point value 0.000196 */
#define LVEQNB_2PiOn_44100 4781 /* Floating point value 0.000142 */
#define LVEQNB_2PiOn_48000 4392 /* Floating point value 0.000131 */
-
+#endif
/************************************************************************************/
/* */
/* 50D table for 50 / ( 1 + Gain ) */
/* */
/************************************************************************************/
-
+#ifdef BUILD_FLOAT
+#define LVEQNB_100D_Neg15_dB 5.623413f
+#define LVEQNB_100D_Neg14_dB 5.011872f
+#define LVEQNB_100D_Neg13_dB 4.466836f
+#define LVEQNB_100D_Neg12_dB 3.981072f
+#define LVEQNB_100D_Neg11_dB 3.548134f
+#define LVEQNB_100D_Neg10_dB 3.162278f
+#define LVEQNB_100D_Neg9_dB 2.818383f
+#define LVEQNB_100D_Neg8_dB 2.511886f
+#define LVEQNB_100D_Neg7_dB 2.238721f
+#define LVEQNB_100D_Neg6_dB 1.995262f
+#define LVEQNB_100D_Neg5_dB 1.778279f
+#define LVEQNB_100D_Neg4_dB 1.584893f
+#define LVEQNB_100D_Neg3_dB 1.412538f
+#define LVEQNB_100D_Neg2_dB 1.258925f
+#define LVEQNB_100D_Neg1_dB 1.122018f
+#define LVEQNB_100D_0_dB 1.000000f
+#else
#define LVEQNB_100DSHIFT 5 /* As a power of 2 */
#define LVEQNB_100D_Neg15_dB 17995 /* Floating point value 5.623413 */
#define LVEQNB_100D_Neg14_dB 16038 /* Floating point value 5.011872 */
@@ -101,6 +166,6 @@
#define LVEQNB_100D_Neg2_dB 4029 /* Floating point value 1.258925 */
#define LVEQNB_100D_Neg1_dB 3590 /* Floating point value 1.122018 */
#define LVEQNB_100D_0_dB 3200 /* Floating point value 1.000000 */
-
+#endif
#endif
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Control.c b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Control.c
index 10e7d74..c290aec 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Control.c
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Control.c
@@ -140,8 +140,12 @@
void LVEQNB_SetFilters(LVEQNB_Instance_t *pInstance,
LVEQNB_Params_t *pParams)
{
-
+#ifdef HIGHER_FS
+ extern const LVM_UINT32 LVEQNB_SampleRateTab[]; /* Sample rate table */
+#else
extern const LVM_UINT16 LVEQNB_SampleRateTab[]; /* Sample rate table */
+#endif
+
LVM_UINT16 i; /* Filter band index */
LVM_UINT32 fs = (LVM_UINT32)LVEQNB_SampleRateTab[(LVM_UINT16)pParams->SampleRate]; /* Sample rate */
LVM_UINT32 fc; /* Filter centre frequency */
@@ -158,11 +162,15 @@
fc = (LVM_UINT32)pParams->pBandDefinition[i].Frequency; /* Get the band centre frequency */
QFactor = (LVM_INT16)pParams->pBandDefinition[i].QFactor; /* Get the band Q factor */
-
+#ifdef BUILD_FLOAT
+ pInstance->pBiquadType[i] = LVEQNB_SinglePrecision_Float; /* Default to single precision */
+#else
/*
* For each filter set the type of biquad required
*/
pInstance->pBiquadType[i] = LVEQNB_SinglePrecision; /* Default to single precision */
+#endif
+#ifndef BUILD_FLOAT
if ((fc << 15) <= (LOW_FREQ * fs))
{
/*
@@ -177,7 +185,7 @@
*/
pInstance->pBiquadType[i] = LVEQNB_DoublePrecision;
}
-
+#endif
/*
* Check for out of range frequencies
@@ -230,6 +238,25 @@
BiquadType = pInstance->pBiquadType[i];
switch (BiquadType)
{
+#ifdef BUILD_FLOAT
+ case LVEQNB_SinglePrecision_Float:
+ {
+ PK_FLOAT_Coefs_t Coefficients;
+ /*
+ * Calculate the single precision coefficients
+ */
+ LVEQNB_SinglePrecCoefs((LVM_UINT16)pInstance->Params.SampleRate,
+ &pInstance->pBandDefinitions[i],
+ &Coefficients);
+ /*
+ * Set the coefficients
+ */
+ PK_2I_D32F32CssGss_TRC_WRA_01_Init(&pInstance->pEQNB_FilterState_Float[i],
+ &pInstance->pEQNB_Taps_Float[i],
+ &Coefficients);
+ break;
+ }
+#else
case LVEQNB_DoublePrecision:
{
PK_C32_Coefs_t Coefficients;
@@ -269,6 +296,7 @@
&Coefficients);
break;
}
+#endif
default:
break;
}
@@ -288,7 +316,7 @@
/* pInstance Pointer to the instance */
/* */
/************************************************************************************/
-
+#ifndef BUILD_FLOAT
void LVEQNB_ClearFilterHistory(LVEQNB_Instance_t *pInstance)
{
LVM_INT16 *pTapAddress;
@@ -305,8 +333,24 @@
NumTaps); /* Number of words */
}
}
+#else
+void LVEQNB_ClearFilterHistory(LVEQNB_Instance_t *pInstance)
+{
+ LVM_FLOAT *pTapAddress;
+ LVM_INT16 NumTaps;
+ pTapAddress = (LVM_FLOAT *)pInstance->pEQNB_Taps_Float;
+ NumTaps = (LVM_INT16)((pInstance->Capabilities.MaxBands * \
+ sizeof(Biquad_2I_Order2_FLOAT_Taps_t)) / sizeof(LVM_FLOAT));
+ if (NumTaps != 0)
+ {
+ LoadConst_Float(0, /* Clear the history, value 0 */
+ pTapAddress, /* Destination */
+ NumTaps); /* Number of words */
+ }
+}
+#endif
/****************************************************************************************/
/* */
/* FUNCTION: LVEQNB_Control */
@@ -422,9 +466,13 @@
{
if(pParams->OperatingMode == LVEQNB_ON)
{
+#ifdef BUILD_FLOAT
+ LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[0], 1.0f);
+ LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[1], 0.0f);
+#else
LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[0],LVM_MAXINT_16);
LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[1],0);
-
+#endif
pInstance->BypassMixer.MixerStream[0].CallbackSet = 1;
pInstance->BypassMixer.MixerStream[1].CallbackSet = 1;
}
@@ -432,15 +480,18 @@
{
/* Stay on the ON operating mode until the transition is done */
pInstance->Params.OperatingMode = LVEQNB_ON;
-
+#ifdef BUILD_FLOAT
+ LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[0], 0.0f);
+ LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[1], 1.0f);
+#else
LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[0],0);
LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[1],LVM_MAXINT_16);
+#endif
pInstance->BypassMixer.MixerStream[0].CallbackSet = 1;
pInstance->BypassMixer.MixerStream[1].CallbackSet = 1;
}
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMixer.MixerStream[0],LVEQNB_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate,2);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMixer.MixerStream[1],LVEQNB_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate,2);
-
pInstance->bInOperatingModeTransition = LVM_TRUE;
}
@@ -470,8 +521,13 @@
/*
* Send an ALGOFF event if the ON->OFF switch transition is finished
*/
+#ifdef BUILD_FLOAT
+ if((LVC_Mixer_GetTarget(&pInstance->BypassMixer.MixerStream[0]) == 0) &&
+ (CallbackParam == 0)){
+#else
if((LVC_Mixer_GetTarget(&pInstance->BypassMixer.MixerStream[0]) == 0x00000000) &&
(CallbackParam == 0)){
+#endif
pInstance->Params.OperatingMode = LVEQNB_BYPASS;
if (CallBack != LVM_NULL){
CallBack(pInstance->Capabilities.pBundleInstance, LVM_NULL, ALGORITHM_EQNB_ID|LVEQNB_EVENT_ALGOFF);
@@ -485,9 +541,3 @@
return 1;
}
-
-
-
-
-
-
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.c b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.c
index e01c1c5..de1bbb7 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.c
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.c
@@ -97,6 +97,21 @@
*/
InstAlloc_Init(&AllocMem,
LVM_NULL);
+#ifdef BUILD_FLOAT
+ InstAlloc_AddMember(&AllocMem, /* Low pass filter */
+ sizeof(Biquad_2I_Order2_FLOAT_Taps_t));
+ InstAlloc_AddMember(&AllocMem, /* High pass filter */
+ sizeof(Biquad_2I_Order2_FLOAT_Taps_t));
+ /* Equaliser Biquad Taps */
+ InstAlloc_AddMember(&AllocMem,
+ (pCapabilities->MaxBands * sizeof(Biquad_2I_Order2_FLOAT_Taps_t)));
+ /* Filter definitions */
+ InstAlloc_AddMember(&AllocMem,
+ (pCapabilities->MaxBands * sizeof(LVEQNB_BandDef_t)));
+ /* Biquad types */
+ InstAlloc_AddMember(&AllocMem,
+ (pCapabilities->MaxBands * sizeof(LVEQNB_BiquadType_en)));
+#else
InstAlloc_AddMember(&AllocMem, /* Low pass filter */
sizeof(Biquad_2I_Order2_Taps_t));
InstAlloc_AddMember(&AllocMem, /* High pass filter */
@@ -107,6 +122,7 @@
(pCapabilities->MaxBands * sizeof(LVEQNB_BandDef_t))); /* Filter definitions */
InstAlloc_AddMember(&AllocMem,
(pCapabilities->MaxBands * sizeof(LVEQNB_BiquadType_en))); /* Biquad types */
+#endif
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_DATA].Size = InstAlloc_GetTotal(&AllocMem);
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_DATA].Alignment = LVEQNB_DATA_ALIGN;
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_DATA].Type = LVEQNB_PERSISTENT_DATA;
@@ -117,12 +133,22 @@
*/
InstAlloc_Init(&AllocMem,
LVM_NULL);
+#ifdef BUILD_FLOAT
+ InstAlloc_AddMember(&AllocMem, /* Low pass filter */
+ sizeof(Biquad_FLOAT_Instance_t));
+ InstAlloc_AddMember(&AllocMem, /* High pass filter */
+ sizeof(Biquad_FLOAT_Instance_t));
+ /* Equaliser Biquad Instance */
+ InstAlloc_AddMember(&AllocMem,
+ pCapabilities->MaxBands * sizeof(Biquad_FLOAT_Instance_t));
+#else
InstAlloc_AddMember(&AllocMem, /* Low pass filter */
sizeof(Biquad_Instance_t));
InstAlloc_AddMember(&AllocMem, /* High pass filter */
sizeof(Biquad_Instance_t));
InstAlloc_AddMember(&AllocMem,
pCapabilities->MaxBands * sizeof(Biquad_Instance_t)); /* Equaliser Biquad Instance */
+#endif
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_COEF].Size = InstAlloc_GetTotal(&AllocMem);
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_COEF].Alignment = LVEQNB_COEF_ALIGN;
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_COEF].Type = LVEQNB_PERSISTENT_COEF;
@@ -133,8 +159,14 @@
*/
InstAlloc_Init(&AllocMem,
LVM_NULL);
+#ifdef BUILD_FLOAT
+ InstAlloc_AddMember(&AllocMem, /* Low pass filter */
+ LVEQNB_SCRATCHBUFFERS * sizeof(LVM_FLOAT) * \
+ pCapabilities->MaxBlockSize);
+#else
InstAlloc_AddMember(&AllocMem, /* Low pass filter */
LVEQNB_SCRATCHBUFFERS*sizeof(LVM_INT16)*pCapabilities->MaxBlockSize);
+#endif
pMemoryTable->Region[LVEQNB_MEMREGION_SCRATCH].Size = InstAlloc_GetTotal(&AllocMem);
pMemoryTable->Region[LVEQNB_MEMREGION_SCRATCH].Alignment = LVEQNB_SCRATCH_ALIGN;
pMemoryTable->Region[LVEQNB_MEMREGION_SCRATCH].Type = LVEQNB_SCRATCH;
@@ -248,8 +280,15 @@
InstAlloc_Init(&AllocMem,
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_COEF].pBaseAddress);
+#ifdef BUILD_FLOAT
+ /* Equaliser Biquad Instance */
+ pInstance->pEQNB_FilterState_Float = InstAlloc_AddMember(&AllocMem,
+ pCapabilities->MaxBands * \
+ sizeof(Biquad_FLOAT_Instance_t));
+#else
pInstance->pEQNB_FilterState = InstAlloc_AddMember(&AllocMem,
pCapabilities->MaxBands * sizeof(Biquad_Instance_t)); /* Equaliser Biquad Instance */
+#endif
@@ -259,9 +298,15 @@
InstAlloc_Init(&AllocMem,
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_DATA].pBaseAddress);
+#ifdef BUILD_FLOAT
+ MemSize = (pCapabilities->MaxBands * sizeof(Biquad_2I_Order2_FLOAT_Taps_t));
+ pInstance->pEQNB_Taps_Float = (Biquad_2I_Order2_FLOAT_Taps_t *)InstAlloc_AddMember(&AllocMem,
+ MemSize);
+#else
MemSize = (pCapabilities->MaxBands * sizeof(Biquad_2I_Order2_Taps_t));
pInstance->pEQNB_Taps = (Biquad_2I_Order2_Taps_t *)InstAlloc_AddMember(&AllocMem,
MemSize);
+#endif
MemSize = (pCapabilities->MaxBands * sizeof(LVEQNB_BandDef_t));
pInstance->pBandDefinitions = (LVEQNB_BandDef_t *)InstAlloc_AddMember(&AllocMem,
MemSize);
@@ -279,8 +324,13 @@
InstAlloc_Init(&AllocMem,
pMemoryTable->Region[LVEQNB_MEMREGION_SCRATCH].pBaseAddress);
+#ifdef BUILD_FLOAT
+ pInstance->pFastTemporary = (LVM_FLOAT *)InstAlloc_AddMember(&AllocMem,
+ sizeof(LVM_FLOAT));
+#else
pInstance->pFastTemporary = (LVM_INT16 *)InstAlloc_AddMember(&AllocMem,
sizeof(LVM_INT16));
+#endif
/*
* Update the instance parameters
@@ -308,15 +358,22 @@
pInstance->BypassMixer.MixerStream[0].CallbackParam = 0;
pInstance->BypassMixer.MixerStream[0].pCallbackHandle = (void*)pInstance;
pInstance->BypassMixer.MixerStream[0].pCallBack = LVEQNB_BypassMixerCallBack;
+
LVC_Mixer_Init(&pInstance->BypassMixer.MixerStream[0],0,0);
LVC_Mixer_SetTimeConstant(&pInstance->BypassMixer.MixerStream[0],0,LVM_FS_8000,2);
+
pInstance->BypassMixer.MixerStream[1].CallbackSet = 1;
pInstance->BypassMixer.MixerStream[1].CallbackParam = 0;
pInstance->BypassMixer.MixerStream[1].pCallbackHandle = LVM_NULL;
pInstance->BypassMixer.MixerStream[1].pCallBack = LVM_NULL;
+#ifdef BUILD_FLOAT
+ LVC_Mixer_Init(&pInstance->BypassMixer.MixerStream[1], 0, 1.0f);
+ LVC_Mixer_SetTimeConstant(&pInstance->BypassMixer.MixerStream[1], 0, LVM_FS_8000, 2);
+#else
LVC_Mixer_Init(&pInstance->BypassMixer.MixerStream[1],0,LVM_MAXINT_16);
LVC_Mixer_SetTimeConstant(&pInstance->BypassMixer.MixerStream[1],0,LVM_FS_8000,2);
+#endif
pInstance->bInOperatingModeTransition = LVM_FALSE;
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Private.h b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Private.h
index 9df980c..56b02e0 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Private.h
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Private.h
@@ -60,6 +60,9 @@
/* Filter biquad types */
typedef enum
{
+#ifdef BUILD_FLOAT
+ LVEQNB_SinglePrecision_Float = -1,
+#endif
LVEQNB_SinglePrecision = 0,
LVEQNB_DoublePrecision = 1,
LVEQNB_OutOfRange = 2,
@@ -84,11 +87,20 @@
LVEQNB_Capabilities_t Capabilities; /* Instance capabilities */
/* Aligned memory pointers */
+#ifdef BUILD_FLOAT
+ LVM_FLOAT *pFastTemporary; /* Fast temporary data base address */
+#else
LVM_INT16 *pFastTemporary; /* Fast temporary data base address */
+#endif
+#ifdef BUILD_FLOAT
+ Biquad_2I_Order2_FLOAT_Taps_t *pEQNB_Taps_Float; /* Equaliser Taps */
+ Biquad_FLOAT_Instance_t *pEQNB_FilterState_Float; /* State for each filter band */
+#else
/* Process variables */
Biquad_2I_Order2_Taps_t *pEQNB_Taps; /* Equaliser Taps */
Biquad_Instance_t *pEQNB_FilterState; /* State for each filter band */
+#endif
/* Filter definitions and call back */
LVM_UINT16 NBands; /* Number of bands */
@@ -96,7 +108,12 @@
LVEQNB_BiquadType_en *pBiquadType; /* Filter biquad types */
/* Bypass variable */
+#ifdef BUILD_FLOAT
+ LVMixer3_2St_FLOAT_st BypassMixer;
+#else
LVMixer3_2St_st BypassMixer; /* Bypass mixer used in transitions */
+#endif
+
LVM_INT16 bInOperatingModeTransition; /* Operating mode transition flag */
} LVEQNB_Instance_t;
@@ -114,7 +131,11 @@
void LVEQNB_SetCoefficients(LVEQNB_Instance_t *pInstance);
void LVEQNB_ClearFilterHistory(LVEQNB_Instance_t *pInstance);
-
+#ifdef BUILD_FLOAT
+LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16 Fs,
+ LVEQNB_BandDef_t *pFilterDefinition,
+ PK_FLOAT_Coefs_t *pCoefficients);
+#else
LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16 Fs,
LVEQNB_BandDef_t *pFilterDefinition,
PK_C16_Coefs_t *pCoefficients);
@@ -122,6 +143,7 @@
LVEQNB_ReturnStatus_en LVEQNB_DoublePrecCoefs(LVM_UINT16 Fs,
LVEQNB_BandDef_t *pFilterDefinition,
PK_C32_Coefs_t *pCoefficients);
+#endif
LVM_INT32 LVEQNB_BypassMixerCallBack (void* hInstance, void *pGeneralPurpose, LVM_INT16 CallbackParam);
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.c b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.c
index 58f58ed..6328181 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.c
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.c
@@ -57,7 +57,121 @@
/* NOTES: */
/* */
/****************************************************************************************/
+#ifdef BUILD_FLOAT
+LVEQNB_ReturnStatus_en LVEQNB_Process(LVEQNB_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 NumSamples)
+{
+ LVM_UINT16 i;
+ Biquad_FLOAT_Instance_t *pBiquad;
+ LVEQNB_Instance_t *pInstance = (LVEQNB_Instance_t *)hInstance;
+ LVM_FLOAT *pScratch;
+
+
+ /* Check for NULL pointers */
+ if((hInstance == LVM_NULL) || (pInData == LVM_NULL) || (pOutData == LVM_NULL))
+ {
+ return LVEQNB_NULLADDRESS;
+ }
+
+ /* Check if the input and output data buffers are 32-bit aligned */
+ if ((((uintptr_t)pInData % 4) != 0) || (((uintptr_t)pOutData % 4) != 0))
+ {
+ return LVEQNB_ALIGNMENTERROR;
+ }
+
+ pScratch = (LVM_FLOAT *)pInstance->pFastTemporary;
+
+ /*
+ * Check the number of samples is not too large
+ */
+ if (NumSamples > pInstance->Capabilities.MaxBlockSize)
+ {
+ return(LVEQNB_TOOMANYSAMPLES);
+ }
+
+ if (pInstance->Params.OperatingMode == LVEQNB_ON)
+ {
+ /*
+ * Copy input data in to scratch buffer
+ */
+
+ Copy_Float((LVM_FLOAT *)pInData, /* Source */
+ pScratch, /* Destination */
+ (LVM_INT16)(2 * NumSamples)); /* Left and Right */
+ /*
+ * For each section execte the filter unless the gain is 0dB
+ */
+ if (pInstance->NBands != 0)
+ {
+ for (i = 0; i < pInstance->NBands; i++)
+ {
+ /*
+ * Check if band is non-zero dB gain
+ */
+ if (pInstance->pBandDefinitions[i].Gain != 0)
+ {
+ /*
+ * Get the address of the biquad instance
+ */
+ pBiquad = &pInstance->pEQNB_FilterState_Float[i];
+
+
+ /*
+ * Select single or double precision as required
+ */
+ switch (pInstance->pBiquadType[i])
+ {
+ case LVEQNB_SinglePrecision_Float:
+ {
+ PK_2I_D32F32C14G11_TRC_WRA_01(pBiquad,
+ (LVM_FLOAT *)pScratch,
+ (LVM_FLOAT *)pScratch,
+ (LVM_INT16)NumSamples);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+
+ if(pInstance->bInOperatingModeTransition == LVM_TRUE){
+ LVC_MixSoft_2St_D16C31_SAT(&pInstance->BypassMixer,
+ (LVM_FLOAT *)pScratch,
+ (LVM_FLOAT *)pInData,
+ (LVM_FLOAT *)pScratch,
+ (LVM_INT16)(2 * NumSamples));
+ Copy_Float((LVM_FLOAT*)pScratch, /* Source */
+ pOutData, /* Destination */
+ (LVM_INT16)(2 * NumSamples)); /* Left and Right samples */
+ }
+ else{
+ Copy_Float(pScratch, /* Source */
+ pOutData, /* Destination */
+ (LVM_INT16 )(2 * NumSamples)); /* Left and Right */
+ }
+ }
+ else
+ {
+ /*
+ * Mode is OFF so copy the data if necessary
+ */
+ if (pInData != pOutData)
+ {
+ Copy_Float(pInData, /* Source */
+ pOutData, /* Destination */
+ (LVM_INT16)(2 * NumSamples)); /* Left and Right samples */
+ }
+ }
+ return(LVEQNB_SUCCESS);
+
+}
+#else
LVEQNB_ReturnStatus_en LVEQNB_Process(LVEQNB_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 *pOutData,
@@ -198,3 +312,4 @@
return(LVEQNB_SUCCESS);
}
+#endif
\ No newline at end of file
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.c b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.c
index 8e2e0e8..563181c 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.c
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.c
@@ -36,6 +36,20 @@
* Sample rate table for converting between the enumerated type and the actual
* frequency
*/
+#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
+const LVM_UINT32 LVEQNB_SampleRateTab[] = {8000, /* 8kS/s */
+ 11025,
+ 12000,
+ 16000,
+ 22050,
+ 24000,
+ 32000,
+ 44100,
+ 48000,
+ 96000,
+ 192000
+};
+#else
const LVM_UINT16 LVEQNB_SampleRateTab[] = {8000, /* 8kS/s */
11025,
12000,
@@ -44,8 +58,9 @@
24000,
32000,
44100,
- 48000}; /* 48kS/s */
-
+ 48000
+};
+#endif
/************************************************************************************/
/* */
@@ -56,6 +71,22 @@
/*
* Table for 2 * Pi / Fs
*/
+#ifdef BUILD_FLOAT
+const LVM_FLOAT LVEQNB_TwoPiOnFsTable[] = {LVEQNB_2PiOn_8000, /* 8kS/s */
+ LVEQNB_2PiOn_11025,
+ LVEQNB_2PiOn_12000,
+ LVEQNB_2PiOn_16000,
+ LVEQNB_2PiOn_22050,
+ LVEQNB_2PiOn_24000,
+ LVEQNB_2PiOn_32000,
+ LVEQNB_2PiOn_44100,
+ LVEQNB_2PiOn_48000
+#ifdef HIGHER_FS
+ ,LVEQNB_2PiOn_96000
+ ,LVEQNB_2PiOn_192000
+#endif
+ };
+#else
const LVM_INT16 LVEQNB_TwoPiOnFsTable[] = {LVEQNB_2PiOn_8000, /* 8kS/s */
LVEQNB_2PiOn_11025,
LVEQNB_2PiOn_12000,
@@ -65,10 +96,44 @@
LVEQNB_2PiOn_32000,
LVEQNB_2PiOn_44100,
LVEQNB_2PiOn_48000}; /* 48kS/s */
+#endif
/*
* Gain table
*/
+#ifdef BUILD_FLOAT
+const LVM_FLOAT LVEQNB_GainTable[] = {LVEQNB_Gain_Neg15_dB, /* -15dB gain */
+ LVEQNB_Gain_Neg14_dB,
+ LVEQNB_Gain_Neg13_dB,
+ LVEQNB_Gain_Neg12_dB,
+ LVEQNB_Gain_Neg11_dB,
+ LVEQNB_Gain_Neg10_dB,
+ LVEQNB_Gain_Neg9_dB,
+ LVEQNB_Gain_Neg8_dB,
+ LVEQNB_Gain_Neg7_dB,
+ LVEQNB_Gain_Neg6_dB,
+ LVEQNB_Gain_Neg5_dB,
+ LVEQNB_Gain_Neg4_dB,
+ LVEQNB_Gain_Neg3_dB,
+ LVEQNB_Gain_Neg2_dB,
+ LVEQNB_Gain_Neg1_dB,
+ LVEQNB_Gain_0_dB, /* 0dB gain */
+ LVEQNB_Gain_1_dB,
+ LVEQNB_Gain_2_dB,
+ LVEQNB_Gain_3_dB,
+ LVEQNB_Gain_4_dB,
+ LVEQNB_Gain_5_dB,
+ LVEQNB_Gain_6_dB,
+ LVEQNB_Gain_7_dB,
+ LVEQNB_Gain_8_dB,
+ LVEQNB_Gain_9_dB,
+ LVEQNB_Gain_10_dB,
+ LVEQNB_Gain_11_dB,
+ LVEQNB_Gain_12_dB,
+ LVEQNB_Gain_13_dB,
+ LVEQNB_Gain_14_dB,
+ LVEQNB_Gain_15_dB}; /* +15dB gain */
+#else
const LVM_INT16 LVEQNB_GainTable[] = {LVEQNB_Gain_Neg15_dB, /* -15dB gain */
LVEQNB_Gain_Neg14_dB,
LVEQNB_Gain_Neg13_dB,
@@ -101,10 +166,28 @@
LVEQNB_Gain_14_dB,
LVEQNB_Gain_15_dB}; /* +15dB gain */
-
+#endif
/*
* D table for 100 / (Gain + 1)
*/
+#ifdef BUILD_FLOAT
+const LVM_FLOAT LVEQNB_DTable[] = {LVEQNB_100D_Neg15_dB, /* -15dB gain */
+ LVEQNB_100D_Neg14_dB,
+ LVEQNB_100D_Neg13_dB,
+ LVEQNB_100D_Neg12_dB,
+ LVEQNB_100D_Neg11_dB,
+ LVEQNB_100D_Neg10_dB,
+ LVEQNB_100D_Neg9_dB,
+ LVEQNB_100D_Neg8_dB,
+ LVEQNB_100D_Neg7_dB,
+ LVEQNB_100D_Neg6_dB,
+ LVEQNB_100D_Neg5_dB,
+ LVEQNB_100D_Neg4_dB,
+ LVEQNB_100D_Neg3_dB,
+ LVEQNB_100D_Neg2_dB,
+ LVEQNB_100D_Neg1_dB,
+ LVEQNB_100D_0_dB}; /* 0dB gain */
+#else
const LVM_INT16 LVEQNB_DTable[] = {LVEQNB_100D_Neg15_dB, /* -15dB gain */
LVEQNB_100D_Neg14_dB,
LVEQNB_100D_Neg13_dB,
@@ -122,7 +205,7 @@
LVEQNB_100D_Neg1_dB,
LVEQNB_100D_0_dB}; /* 0dB gain */
-
+#endif
/************************************************************************************/
/* */
/* Filter polynomial coefficients */
diff --git a/media/libeffects/lvm/lib/Reverb/lib/LVREV.h b/media/libeffects/lvm/lib/Reverb/lib/LVREV.h
index 28e3369..9c2e297 100644
--- a/media/libeffects/lvm/lib/Reverb/lib/LVREV.h
+++ b/media/libeffects/lvm/lib/Reverb/lib/LVREV.h
@@ -107,8 +107,14 @@
/* Parameters for REV */
LVM_UINT16 Level; /* Level, 0 to 100 representing percentage of reverb */
+#ifndef HIGHER_FS
LVM_UINT16 LPF; /* Low pass filter, in Hz */
LVM_UINT16 HPF; /* High pass filter, in Hz */
+#else
+ LVM_UINT32 LPF; /* Low pass filter, in Hz */
+ LVM_UINT32 HPF; /* High pass filter, in Hz */
+#endif
+
LVM_UINT16 T60; /* Decay time constant, in ms */
LVM_UINT16 Density; /* Echo density, 0 to 100 for minimum to maximum density */
LVM_UINT16 Damping; /* Damping */
@@ -297,11 +303,17 @@
/* 1. The input and output buffers must be 32-bit aligned */
/* */
/****************************************************************************************/
+#ifdef BUILD_FLOAT
+LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT *pOutData,
+ const LVM_UINT16 NumSamples);
+#else
LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance,
const LVM_INT32 *pInData,
LVM_INT32 *pOutData,
const LVM_UINT16 NumSamples);
-
+#endif
#ifdef __cplusplus
}
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.c
index ac2ef9d..e710844 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.c
@@ -41,6 +41,7 @@
/* */
/****************************************************************************************/
+#ifndef BUILD_FLOAT
LVREV_ReturnStatus_en LVREV_ApplyNewSettings (LVREV_Instance_st *pPrivate)
{
@@ -593,8 +594,589 @@
return LVREV_SUCCESS;
}
+#else /* BUILD_FLOAT*/
+LVREV_ReturnStatus_en LVREV_ApplyNewSettings (LVREV_Instance_st *pPrivate)
+{
+
+ LVM_Mode_en OperatingMode;
+ LVM_INT32 NumberOfDelayLines;
+ /* Check for NULL pointer */
+ if(pPrivate == LVM_NULL)
+ {
+ return LVREV_NULLADDRESS;
+ }
+
+ OperatingMode = pPrivate->NewParams.OperatingMode;
+
+ if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
+ {
+ NumberOfDelayLines = 4;
+ }
+ else if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2)
+ {
+ NumberOfDelayLines = 2;
+ }
+ else
+ {
+ NumberOfDelayLines = 1;
+ }
+
+ /*
+ * Update the high pass filter coefficients
+ */
+ if((pPrivate->NewParams.HPF != pPrivate->CurrentParams.HPF) ||
+ (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->bFirstControl == LVM_TRUE))
+ {
+ LVM_FLOAT Omega;
+ FO_FLOAT_Coefs_t Coeffs;
+
+ Omega = LVM_GetOmega(pPrivate->NewParams.HPF, pPrivate->NewParams.SampleRate);
+ LVM_FO_HPF(Omega, &Coeffs);
+ FO_1I_D32F32Cll_TRC_WRA_01_Init( &pPrivate->pFastCoef->HPCoefs,
+ &pPrivate->pFastData->HPTaps, &Coeffs);
+ LoadConst_Float(0,
+ (void *)&pPrivate->pFastData->HPTaps, /* Destination Cast to void: \
+ no dereferencing in function*/
+ sizeof(Biquad_1I_Order1_FLOAT_Taps_t) / sizeof(LVM_FLOAT));
+ }
+
+
+ /*
+ * Update the low pass filter coefficients
+ */
+ if((pPrivate->NewParams.LPF != pPrivate->CurrentParams.LPF) ||
+ (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->bFirstControl == LVM_TRUE))
+ {
+ LVM_FLOAT Omega;
+ FO_FLOAT_Coefs_t Coeffs;
+
+ Coeffs.A0 = 1;
+ Coeffs.A1 = 0;
+ Coeffs.B1 = 0;
+ if(pPrivate->NewParams.LPF <= (LVM_FsTable[pPrivate->NewParams.SampleRate] >> 1))
+ {
+ Omega = LVM_GetOmega(pPrivate->NewParams.LPF, pPrivate->NewParams.SampleRate);
+
+ /*
+ * Do not apply filter if w =2*pi*fc/fs >= 2.9
+ */
+ if(Omega <= (LVM_FLOAT)LVREV_2_9_INQ29)
+ {
+ LVM_FO_LPF(Omega, &Coeffs);
+ }
+ }
+ FO_1I_D32F32Cll_TRC_WRA_01_Init( &pPrivate->pFastCoef->LPCoefs,
+ &pPrivate->pFastData->LPTaps, &Coeffs);
+ LoadConst_Float(0,
+ (void *)&pPrivate->pFastData->LPTaps, /* Destination Cast to void: \
+ no dereferencing in function*/
+ sizeof(Biquad_1I_Order1_FLOAT_Taps_t) / sizeof(LVM_FLOAT));
+ }
+
+
+ /*
+ * Calculate the room size parameter
+ */
+ if( pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize)
+ {
+ /* Room size range is 10ms to 200ms
+ * 0% -- 10ms
+ * 50% -- 65ms
+ * 100% -- 120ms
+ */
+ pPrivate->RoomSizeInms = 10 + (((pPrivate->NewParams.RoomSize*11) + 5) / 10);
+ }
+
+
+ /*
+ * Update the T delay number of samples and the all pass delay number of samples
+ */
+ if( (pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
+ (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->bFirstControl == LVM_TRUE))
+ {
+
+ LVM_UINT32 Temp;
+ LVM_INT32 APDelaySize;
+ LVM_INT32 Fs = LVM_GetFsFromTable(pPrivate->NewParams.SampleRate);
+ LVM_UINT32 DelayLengthSamples = (LVM_UINT32)(Fs * pPrivate->RoomSizeInms);
+ LVM_INT16 i;
+ LVM_FLOAT ScaleTable[] = {LVREV_T_3_Power_minus0_on_4, LVREV_T_3_Power_minus1_on_4, \
+ LVREV_T_3_Power_minus2_on_4, LVREV_T_3_Power_minus3_on_4};
+ LVM_INT16 MaxT_Delay[] = {LVREV_MAX_T0_DELAY, LVREV_MAX_T1_DELAY, \
+ LVREV_MAX_T2_DELAY, LVREV_MAX_T3_DELAY};
+ LVM_INT16 MaxAP_Delay[] = {LVREV_MAX_AP0_DELAY, LVREV_MAX_AP1_DELAY, \
+ LVREV_MAX_AP2_DELAY, LVREV_MAX_AP3_DELAY};
+
+
+ /*
+ * For each delay line
+ */
+ for (i = 0; i < NumberOfDelayLines; i++)
+ {
+ if (i != 0)
+ {
+ LVM_FLOAT Temp1; /* to avoid QAC warning on type conversion */
+
+ Temp1=(LVM_FLOAT)DelayLengthSamples;
+ Temp = (LVM_UINT32)(Temp1 * ScaleTable[i]);
+ }
+ else
+ {
+ Temp = DelayLengthSamples;
+ }
+ APDelaySize = Temp / 1500;
+
+
+ /*
+ * Set the fixed delay
+ */
+
+#ifdef HIGHER_FS
+ Temp = (MaxT_Delay[i] - MaxAP_Delay[i]) * Fs / 192000;
+#else
+ Temp = (MaxT_Delay[i] - MaxAP_Delay[i]) * Fs / 48000;
+#endif
+ pPrivate->Delay_AP[i] = pPrivate->T[i] - Temp;
+
+
+ /*
+ * Set the tap selection
+ */
+ if (pPrivate->AB_Selection)
+ {
+ /* Smooth from tap A to tap B */
+ pPrivate->pOffsetB[i] = &pPrivate->pDelay_T[i][pPrivate->T[i] - \
+ Temp - APDelaySize];
+ pPrivate->B_DelaySize[i] = APDelaySize;
+ pPrivate->Mixer_APTaps[i].Target1 = 0;
+ pPrivate->Mixer_APTaps[i].Target2 = 1.0f;
+ }
+ else
+ {
+ /* Smooth from tap B to tap A */
+ pPrivate->pOffsetA[i] = &pPrivate->pDelay_T[i][pPrivate->T[i] - \
+ Temp - APDelaySize];
+ pPrivate->A_DelaySize[i] = APDelaySize;
+ pPrivate->Mixer_APTaps[i].Target2 = 0;
+ pPrivate->Mixer_APTaps[i].Target1 = 1.0f;
+ }
+
+ /*
+ * Set the maximum block size to the smallest delay size
+ */
+ pPrivate->MaxBlkLen = Temp;
+ if (pPrivate->MaxBlkLen > pPrivate->A_DelaySize[i])
+ {
+ pPrivate->MaxBlkLen = pPrivate->A_DelaySize[i];
+ }
+ if (pPrivate->MaxBlkLen > pPrivate->B_DelaySize[i])
+ {
+ pPrivate->MaxBlkLen = pPrivate->B_DelaySize[i];
+ }
+ }
+ if (pPrivate->AB_Selection)
+ {
+ pPrivate->AB_Selection = 0;
+ }
+ else
+ {
+ pPrivate->AB_Selection = 1;
+ }
+
+
+ /*
+ * Limit the maximum block length
+ */
+ /* Just as a precausion, but no problem if we remove this line */
+ pPrivate->MaxBlkLen = pPrivate->MaxBlkLen - 2;
+ if(pPrivate->MaxBlkLen > pPrivate->InstanceParams.MaxBlockSize)
+ {
+ pPrivate->MaxBlkLen = (LVM_INT32)pPrivate->InstanceParams.MaxBlockSize;
+ }
+ }
+
+
+
+ /*
+ * Update the low pass filter coefficient
+ */
+ if( (pPrivate->NewParams.Damping != pPrivate->CurrentParams.Damping) ||
+ (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->bFirstControl == LVM_TRUE))
+ {
+
+ LVM_INT32 Temp;
+ LVM_FLOAT Omega;
+ FO_FLOAT_Coefs_t Coeffs;
+ LVM_INT16 i;
+ LVM_INT16 Damping = (LVM_INT16)((pPrivate->NewParams.Damping * 100) + 1000);
+ LVM_FLOAT ScaleTable[] = {LVREV_T_3_Power_0_on_4, LVREV_T_3_Power_1_on_4,
+ LVREV_T_3_Power_2_on_4, LVREV_T_3_Power_3_on_4};
+
+
+ /*
+ * For each filter
+ */
+ for (i = 0; i < NumberOfDelayLines; i++)
+ {
+ if (i != 0)
+ {
+ Temp = (LVM_INT32)(ScaleTable[i] * Damping);
+ }
+ else
+ {
+ Temp = Damping;
+ }
+ if(Temp <= (LVM_INT32)(LVM_FsTable[pPrivate->NewParams.SampleRate] >> 1))
+ {
+ Omega = LVM_GetOmega(Temp, pPrivate->NewParams.SampleRate);
+ LVM_FO_LPF(Omega, &Coeffs);
+ }
+ else
+ {
+ Coeffs.A0 = 1;
+ Coeffs.A1 = 0;
+ Coeffs.B1 = 0;
+ }
+ FO_1I_D32F32Cll_TRC_WRA_01_Init(&pPrivate->pFastCoef->RevLPCoefs[i],
+ &pPrivate->pFastData->RevLPTaps[i], &Coeffs);
+ }
+ }
+
+
+ /*
+ * Update All-pass filter mixer time constants
+ */
+ if( (pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
+ (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->NewParams.Density != pPrivate->CurrentParams.Density))
+ {
+ LVM_INT16 i;
+ LVM_FLOAT Alpha;
+ LVM_FLOAT AlphaTap;
+
+ Alpha = LVM_Mixer_TimeConstant(LVREV_ALLPASS_TC,
+ LVM_GetFsFromTable(pPrivate->NewParams.SampleRate),
+ 1);
+
+ AlphaTap = LVM_Mixer_TimeConstant(LVREV_ALLPASS_TAP_TC,
+ LVM_GetFsFromTable(pPrivate->NewParams.SampleRate),
+ 1);
+
+ for (i = 0; i < 4; i++)
+ {
+ pPrivate->Mixer_APTaps[i].Alpha1 = AlphaTap;
+ pPrivate->Mixer_APTaps[i].Alpha2 = AlphaTap;
+ pPrivate->Mixer_SGFeedback[i].Alpha = Alpha;
+ pPrivate->Mixer_SGFeedforward[i].Alpha = Alpha;
+ }
+ }
+
+
+ /*
+ * Update the feed back gain
+ */
+ if( (pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
+ (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->NewParams.T60 != pPrivate->CurrentParams.T60) ||
+ (pPrivate->bFirstControl == LVM_TRUE))
+ {
+
+ LVM_FLOAT G[4]; /* Feedback gain (Q7.24) */
+
+ if(pPrivate->NewParams.T60 == 0)
+ {
+ G[3] = 0;
+ G[2] = 0;
+ G[1] = 0;
+ G[0] = 0;
+ }
+ else
+ {
+ LVM_FLOAT Temp1;
+ LVM_FLOAT Temp2;
+ LVM_INT16 i;
+ LVM_FLOAT ScaleTable[] = {LVREV_T_3_Power_minus0_on_4, LVREV_T_3_Power_minus1_on_4,
+ LVREV_T_3_Power_minus2_on_4, LVREV_T_3_Power_minus3_on_4};
+
+
+ /*
+ * For each delay line
+ */
+ for (i = 0; i < NumberOfDelayLines; i++)
+ {
+ Temp1 = (3 * pPrivate->RoomSizeInms * ScaleTable[i]) / pPrivate->NewParams.T60;
+ if(Temp1 >= (4))
+ {
+ G[i] = 0;
+ }
+ else if((Temp1 >= (2)))
+ {
+ Temp2 = LVM_Power10(-(Temp1 / 2.0f));
+ Temp1 = LVM_Power10(-(Temp1 / 2.0f));
+ Temp1 = Temp1 * Temp2;
+ }
+ else
+ {
+ Temp1 = LVM_Power10(-(Temp1));
+ }
+ if (NumberOfDelayLines == 1)
+ {
+ G[i] = Temp1;
+ }
+ else
+ {
+ LVM_FLOAT TempG;
+ TempG = Temp1 * ONE_OVER_SQRT_TWO;
+ G[i]=TempG;
+ }
+ }
+ }
+
+ /* Set up the feedback mixers for four delay lines */
+ pPrivate->FeedbackMixer[0].Target=G[0];
+ pPrivate->FeedbackMixer[1].Target=G[1];
+ pPrivate->FeedbackMixer[2].Target=G[2];
+ pPrivate->FeedbackMixer[3].Target=G[3];
+ }
+
+
+ /*
+ * Calculate the gain correction
+ */
+ if((pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
+ (pPrivate->NewParams.Level != pPrivate->CurrentParams.Level) ||
+ (pPrivate->NewParams.T60 != pPrivate->CurrentParams.T60) )
+ {
+ LVM_INT32 Index=0;
+ LVM_FLOAT Index_FLOAT;
+ LVM_INT32 i=0;
+ LVM_FLOAT Gain=0;
+ LVM_INT32 RoomSize=0;
+ LVM_FLOAT T60;
+ LVM_FLOAT Coefs[5];
+
+
+ if(pPrivate->NewParams.RoomSize == 0)
+ {
+ RoomSize = 1;
+ }
+ else
+ {
+ RoomSize = (LVM_INT32)pPrivate->NewParams.RoomSize;
+ }
+
+
+ if(pPrivate->NewParams.T60 < 100)
+ {
+ T60 = 100 * LVREV_T60_SCALE;
+ }
+ else
+ {
+ T60 = pPrivate->NewParams.T60 * LVREV_T60_SCALE;
+ }
+
+ /* Find the nearest room size in table */
+ for(i = 0; i < 24; i++)
+ {
+ if(RoomSize <= LVREV_GainPolyTable[i][0])
+ {
+ Index = i;
+ break;
+ }
+ }
+
+
+ if(RoomSize == LVREV_GainPolyTable[Index][0])
+ {
+ /* Take table values if the room size is in table */
+ for(i = 1; i < 5; i++)
+ {
+ Coefs[i-1] = LVREV_GainPolyTable[Index][i];
+ }
+ Coefs[4] = 0;
+ Gain = LVM_Polynomial(3, Coefs, T60); /* Q.24 result */
+ }
+ else
+ {
+ /* Interpolate the gain between nearest room sizes */
+
+ LVM_FLOAT Gain1,Gain2;
+ LVM_INT32 Tot_Dist,Dist;
+
+ Tot_Dist = (LVM_UINT32)LVREV_GainPolyTable[Index][0] - \
+ (LVM_UINT32)LVREV_GainPolyTable[Index-1][0];
+ Dist = RoomSize - (LVM_UINT32)LVREV_GainPolyTable[Index - 1][0];
+
+
+ /* Get gain for first */
+ for(i = 1; i < 5; i++)
+ {
+ Coefs[i-1] = LVREV_GainPolyTable[Index-1][i];
+ }
+ Coefs[4] = 0;
+
+ Gain1 = LVM_Polynomial(3, Coefs, T60); /* Q.24 result */
+
+ /* Get gain for second */
+ for(i = 1; i < 5; i++)
+ {
+ Coefs[i-1] = LVREV_GainPolyTable[Index][i];
+ }
+ Coefs[4] = 0;
+
+ Gain2 = LVM_Polynomial(3, Coefs, T60); /* Q.24 result */
+
+ /* Linear Interpolate the gain */
+ Gain = Gain1 + (((Gain2 - Gain1) * Dist) / (Tot_Dist));
+ }
+
+
+ /*
+ * Get the inverse of gain: Q.15
+ * Gain is mostly above one except few cases, take only gains above 1
+ */
+ if(Gain < 1)
+ {
+ pPrivate->Gain = 1;
+ }
+ else
+ {
+ pPrivate->Gain = 1 / Gain;
+ }
+
+ Index_FLOAT = 100.0f / (LVM_FLOAT)(100 + pPrivate->NewParams.Level);
+ pPrivate->Gain = pPrivate->Gain * Index_FLOAT;
+ pPrivate->GainMixer.Target = (pPrivate->Gain*Index_FLOAT) / 2;
+ }
+
+
+ /*
+ * Update the all pass comb filter coefficient
+ */
+ if( (pPrivate->NewParams.Density != pPrivate->CurrentParams.Density) ||
+ (pPrivate->bFirstControl == LVM_TRUE))
+ {
+ LVM_INT16 i;
+ LVM_FLOAT b = (LVM_FLOAT)pPrivate->NewParams.Density * LVREV_B_8_on_1000;
+
+ for (i = 0; i < 4; i++)
+ {
+ pPrivate->Mixer_SGFeedback[i].Target = b;
+ pPrivate->Mixer_SGFeedforward[i].Target = b;
+ }
+ }
+
+
+ /*
+ * Update the bypass mixer time constant
+ */
+ if((pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->bFirstControl == LVM_TRUE))
+ {
+ LVM_UINT16 NumChannels = 1; /* Assume MONO format */
+ LVM_FLOAT Alpha;
+
+ Alpha = LVM_Mixer_TimeConstant(LVREV_FEEDBACKMIXER_TC,
+ LVM_GetFsFromTable(pPrivate->NewParams.SampleRate),
+ NumChannels);
+ pPrivate->FeedbackMixer[0].Alpha = Alpha;
+ pPrivate->FeedbackMixer[1].Alpha = Alpha;
+ pPrivate->FeedbackMixer[2].Alpha = Alpha;
+ pPrivate->FeedbackMixer[3].Alpha = Alpha;
+
+ NumChannels = 2; /* Always stereo output */
+ pPrivate->BypassMixer.Alpha1 = LVM_Mixer_TimeConstant(LVREV_BYPASSMIXER_TC,
+ LVM_GetFsFromTable(pPrivate->NewParams.SampleRate), NumChannels);
+ pPrivate->BypassMixer.Alpha2 = pPrivate->BypassMixer.Alpha1;
+ pPrivate->GainMixer.Alpha = pPrivate->BypassMixer.Alpha1;
+ }
+
+
+ /*
+ * Update the bypass mixer targets
+ */
+ if( (pPrivate->NewParams.Level != pPrivate->CurrentParams.Level) &&
+ (pPrivate->NewParams.OperatingMode == LVM_MODE_ON))
+ {
+ pPrivate->BypassMixer.Target2 = (LVM_FLOAT)(pPrivate->NewParams.Level ) / 100.0f;
+ pPrivate->BypassMixer.Target1 = 0x00000000;
+ if ((pPrivate->NewParams.Level == 0) && (pPrivate->bFirstControl == LVM_FALSE))
+ {
+ pPrivate->BypassMixer.CallbackSet2 = LVM_TRUE;
+ }
+ if (pPrivate->NewParams.Level != 0)
+ {
+ pPrivate->bDisableReverb = LVM_FALSE;
+ }
+ }
+
+ if(pPrivate->NewParams.OperatingMode != pPrivate->CurrentParams.OperatingMode)
+ {
+ if(pPrivate->NewParams.OperatingMode == LVM_MODE_ON)
+ {
+ pPrivate->BypassMixer.Target2 = (LVM_FLOAT)(pPrivate->NewParams.Level ) / 100.0f;
+ pPrivate->BypassMixer.Target1 = 0x00000000;
+
+ pPrivate->BypassMixer.CallbackSet2 = LVM_FALSE;
+ OperatingMode = LVM_MODE_ON;
+ if (pPrivate->NewParams.Level == 0)
+ {
+ pPrivate->bDisableReverb = LVM_TRUE;
+ }
+ else
+ {
+ pPrivate->bDisableReverb = LVM_FALSE;
+ }
+ }
+ else if (pPrivate->bFirstControl == LVM_FALSE)
+ {
+ pPrivate->BypassMixer.Target2 = 0x00000000;
+ pPrivate->BypassMixer.Target1 = 0x00000000;
+ pPrivate->BypassMixer.CallbackSet2 = LVM_TRUE;
+ pPrivate->GainMixer.Target = 0.03125f;
+ OperatingMode = LVM_MODE_ON;
+ }
+ else
+ {
+ OperatingMode = LVM_MODE_OFF;
+ }
+ }
+
+
+ /* If it is the first call to ApplyNew settings force the current to the target \
+ to begin immediate playback of the effect */
+ if(pPrivate->bFirstControl == LVM_TRUE)
+ {
+ pPrivate->BypassMixer.Current1 = pPrivate->BypassMixer.Target1;
+ pPrivate->BypassMixer.Current2 = pPrivate->BypassMixer.Target2;
+ }
+
+
+ /*
+ * Copy the new parameters
+ */
+ pPrivate->CurrentParams = pPrivate->NewParams;
+ pPrivate->CurrentParams.OperatingMode = OperatingMode;
+
+
+ /*
+ * Update flag
+ */
+ if(pPrivate->bFirstControl == LVM_TRUE)
+ {
+ pPrivate->bFirstControl = LVM_FALSE;
+ }
+
+
+ return LVREV_SUCCESS;
+}
+#endif /*BUILD_FLOAT*/
/****************************************************************************************/
/* */
/* FUNCTION: BypassMixer_Callback */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.c
index 6bb1e88..9491016 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.c
@@ -61,16 +61,26 @@
* Clear all filter tap data, delay-lines and other signal related data
*/
-
+#ifdef BUILD_FLOAT
+ LoadConst_Float(0,
+ (void *)&pLVREV_Private->pFastData->HPTaps, /* Destination Cast to void: \
+ no dereferencing in function*/
+ 2);
+ LoadConst_Float(0,
+ (void *)&pLVREV_Private->pFastData->LPTaps, /* Destination Cast to void: \
+ no dereferencing in function*/
+ 2);
+#else
LoadConst_32(0,
(void *)&pLVREV_Private->pFastData->HPTaps, /* Destination Cast to void: no dereferencing in function*/
2);
LoadConst_32(0,
(void *)&pLVREV_Private->pFastData->LPTaps, /* Destination Cast to void: no dereferencing in function*/
2);
-
+#endif
if((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
{
+#ifndef BUILD_FLOAT
LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[3], 2);
LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[2], 2);
LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[1], 2);
@@ -80,24 +90,46 @@
LoadConst_32(0,pLVREV_Private->pDelay_T[2], (LVM_INT16)LVREV_MAX_T2_DELAY);
LoadConst_32(0,pLVREV_Private->pDelay_T[1], (LVM_INT16)LVREV_MAX_T1_DELAY);
LoadConst_32(0,pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
+#else
+ LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[3], 2);
+ LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[2], 2);
+ LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[1], 2);
+ LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
+ LoadConst_Float(0, pLVREV_Private->pDelay_T[3], LVREV_MAX_T3_DELAY);
+ LoadConst_Float(0, pLVREV_Private->pDelay_T[2], LVREV_MAX_T2_DELAY);
+ LoadConst_Float(0, pLVREV_Private->pDelay_T[1], LVREV_MAX_T1_DELAY);
+ LoadConst_Float(0, pLVREV_Private->pDelay_T[0], LVREV_MAX_T0_DELAY);
+#endif
}
if((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays >= LVREV_DELAYLINES_2)
{
+#ifndef BUILD_FLOAT
LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[1], 2);
LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
LoadConst_32(0,pLVREV_Private->pDelay_T[1], (LVM_INT16)LVREV_MAX_T1_DELAY);
LoadConst_32(0,pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
+#else
+ LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[1], 2);
+ LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
+
+ LoadConst_Float(0, pLVREV_Private->pDelay_T[1], LVREV_MAX_T1_DELAY);
+ LoadConst_Float(0, pLVREV_Private->pDelay_T[0], LVREV_MAX_T0_DELAY);
+#endif
}
if((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays >= LVREV_DELAYLINES_1)
{
+#ifndef BUILD_FLOAT
LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
LoadConst_32(0,pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
+#else
+ LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
+ LoadConst_Float(0, pLVREV_Private->pDelay_T[0], LVREV_MAX_T0_DELAY);
+#endif
}
-
return LVREV_SUCCESS;
}
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.c
index ffa5138..3366bcb 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.c
@@ -108,11 +108,29 @@
/*
* Zero all memory regions
*/
- LoadConst_16(0, (LVM_INT16 *)pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress, (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Size)/sizeof(LVM_INT16)));
- LoadConst_16(0, (LVM_INT16 *)pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress, (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Size)/sizeof(LVM_INT16)));
- LoadConst_16(0, (LVM_INT16 *)pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress, (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Size)/sizeof(LVM_INT16)));
- LoadConst_16(0, (LVM_INT16 *)pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress, (LVM_INT16)((pMemoryTable->Region[LVM_TEMPORARY_FAST].Size)/sizeof(LVM_INT16)));
-
+#ifdef BUILD_FLOAT
+ LoadConst_Float(0,
+ (LVM_FLOAT *)pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress,
+ (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Size) / \
+ sizeof(LVM_FLOAT)));
+ LoadConst_Float(0,
+ (LVM_FLOAT *)pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress,
+ (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Size) / \
+ sizeof(LVM_FLOAT)));
+ LoadConst_Float(0,
+ (LVM_FLOAT *)pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress,
+ (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Size) / \
+ sizeof(LVM_FLOAT)));
+ LoadConst_Float(0,
+ (LVM_FLOAT *)pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress,
+ (LVM_INT16)((pMemoryTable->Region[LVM_TEMPORARY_FAST].Size) / \
+ sizeof(LVM_FLOAT)));
+#else
+ LoadConst_16(0, (LVM_INT16 *)pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress, (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Size)/sizeof(LVM_INT16)));
+ LoadConst_16(0, (LVM_INT16 *)pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress, (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Size)/sizeof(LVM_INT16)));
+ LoadConst_16(0, (LVM_INT16 *)pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress, (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Size)/sizeof(LVM_INT16)));
+ LoadConst_16(0, (LVM_INT16 *)pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress, (LVM_INT16)((pMemoryTable->Region[LVM_TEMPORARY_FAST].Size)/sizeof(LVM_INT16)));
+#endif
/*
* Set the instance handle if not already initialised
*/
@@ -146,7 +164,7 @@
* Set the data, coefficient and temporary memory pointers
*/
pLVREV_Private->pFastData = InstAlloc_AddMember(&FastData, sizeof(LVREV_FastData_st)); /* Fast data memory base address */
-
+#ifndef BUILD_FLOAT
if(pInstanceParams->NumDelays == LVREV_DELAYLINES_4)
{
pLVREV_Private->pDelay_T[3] = InstAlloc_AddMember(&FastData, LVREV_MAX_T3_DELAY * sizeof(LVM_INT32));
@@ -190,7 +208,67 @@
LoadConst_32(0,pLVREV_Private->pDelay_T[0] , (LVM_INT16)LVREV_MAX_T0_DELAY);
}
+#else
+ if(pInstanceParams->NumDelays == LVREV_DELAYLINES_4)
+ {
+ pLVREV_Private->pDelay_T[3] = InstAlloc_AddMember(&FastData, LVREV_MAX_T3_DELAY * \
+ sizeof(LVM_FLOAT));
+ pLVREV_Private->pDelay_T[2] = InstAlloc_AddMember(&FastData, LVREV_MAX_T2_DELAY * \
+ sizeof(LVM_FLOAT));
+ pLVREV_Private->pDelay_T[1] = InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * \
+ sizeof(LVM_FLOAT));
+ pLVREV_Private->pDelay_T[0] = InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * \
+ sizeof(LVM_FLOAT));
+ for(i = 0; i < 4; i++)
+ {
+ /* Scratch for each delay line output */
+ pLVREV_Private->pScratchDelayLine[i] = InstAlloc_AddMember(&Temporary,
+ sizeof(LVM_FLOAT) * \
+ MaxBlockSize);
+ }
+
+ LoadConst_Float(0, pLVREV_Private->pDelay_T[3], LVREV_MAX_T3_DELAY);
+ LoadConst_Float(0, pLVREV_Private->pDelay_T[2], LVREV_MAX_T2_DELAY);
+ LoadConst_Float(0, pLVREV_Private->pDelay_T[1], LVREV_MAX_T1_DELAY);
+ LoadConst_Float(0, pLVREV_Private->pDelay_T[0], LVREV_MAX_T0_DELAY);
+ }
+
+ if(pInstanceParams->NumDelays == LVREV_DELAYLINES_2)
+ {
+ pLVREV_Private->pDelay_T[1] = InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * \
+ sizeof(LVM_FLOAT));
+ pLVREV_Private->pDelay_T[0] = InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * \
+ sizeof(LVM_FLOAT));
+
+ for(i = 0; i < 2; i++)
+ {
+ /* Scratch for each delay line output */
+ pLVREV_Private->pScratchDelayLine[i] = InstAlloc_AddMember(&Temporary,
+ sizeof(LVM_FLOAT) * \
+ MaxBlockSize);
+ }
+
+ LoadConst_Float(0, pLVREV_Private->pDelay_T[1], (LVM_INT16)LVREV_MAX_T1_DELAY);
+ LoadConst_Float(0, pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
+ }
+
+ if(pInstanceParams->NumDelays == LVREV_DELAYLINES_1)
+ {
+ pLVREV_Private->pDelay_T[0] = InstAlloc_AddMember(&FastData,
+ LVREV_MAX_T0_DELAY * sizeof(LVM_FLOAT));
+
+ for(i = 0; i < 1; i++)
+ {
+ /* Scratch for each delay line output */
+ pLVREV_Private->pScratchDelayLine[i] = InstAlloc_AddMember(&Temporary,
+ sizeof(LVM_FLOAT) * \
+ MaxBlockSize);
+ }
+
+ LoadConst_Float(0, pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
+ }
+#endif
/* All-pass delay buffer addresses and sizes */
pLVREV_Private->T[0] = LVREV_MAX_T0_DELAY;
pLVREV_Private->T[1] = LVREV_MAX_T1_DELAY;
@@ -200,10 +278,19 @@
pLVREV_Private->pFastCoef = InstAlloc_AddMember(&FastCoef, sizeof(LVREV_FastCoef_st)); /* Fast coefficient memory base address */
+#ifndef BUILD_FLOAT
pLVREV_Private->pScratch = InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* General purpose scratch */
pLVREV_Private->pInputSave = InstAlloc_AddMember(&Temporary, 2 * sizeof(LVM_INT32) * MaxBlockSize); /* Mono->stereo input save for end mix */
LoadConst_32(0, pLVREV_Private->pInputSave, (LVM_INT16)(MaxBlockSize*2));
-
+#else
+ /* General purpose scratch */
+ pLVREV_Private->pScratch = InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * \
+ MaxBlockSize);
+ /* Mono->stereo input save for end mix */
+ pLVREV_Private->pInputSave = InstAlloc_AddMember(&Temporary, 2 * sizeof(LVM_FLOAT) * \
+ MaxBlockSize);
+ LoadConst_Float(0, pLVREV_Private->pInputSave, (LVM_INT16)(MaxBlockSize * 2));
+#endif
/*
* Save the instance parameters in the instance structure
@@ -252,9 +339,13 @@
pLVREV_Private->GainMixer.pGeneralPurpose = LVM_NULL;
pLVREV_Private->GainMixer.pCallBack = LVM_NULL;
pLVREV_Private->GainMixer.CallbackSet = LVM_FALSE;
+#ifndef BUILD_FLOAT
pLVREV_Private->GainMixer.Current = 0x03ffffff;
pLVREV_Private->GainMixer.Target = 0x03ffffff;
-
+#else
+ pLVREV_Private->GainMixer.Current = 0.03125f;//0x03ffffff;
+ pLVREV_Private->GainMixer.Target = 0.03125f;//0x03ffffff;
+#endif
/*
* Set the All-Pass Filter mixers
@@ -277,7 +368,11 @@
pLVREV_Private->Mixer_APTaps[i].pCallBack1 = LVM_NULL;
pLVREV_Private->Mixer_APTaps[i].CallbackSet1 = LVM_FALSE;
pLVREV_Private->Mixer_APTaps[i].Current1 = 0;
+#ifndef BUILD_FLOAT
pLVREV_Private->Mixer_APTaps[i].Target1 = 0x7fffffff;
+#else
+ pLVREV_Private->Mixer_APTaps[i].Target1 = 1;
+#endif
/* Feedforward mixer */
pLVREV_Private->Mixer_SGFeedforward[i].CallbackParam = 0;
pLVREV_Private->Mixer_SGFeedforward[i].pCallbackHandle = LVM_NULL;
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.c
index 2012432..f6d446b 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.c
@@ -161,21 +161,37 @@
InstAlloc_AddMember(&FastData, sizeof(LVREV_FastData_st));
if(pInstanceParams->NumDelays == LVREV_DELAYLINES_4)
{
+#ifndef BUILD_FLOAT
InstAlloc_AddMember(&FastData, LVREV_MAX_T3_DELAY * sizeof(LVM_INT32));
InstAlloc_AddMember(&FastData, LVREV_MAX_T2_DELAY * sizeof(LVM_INT32));
InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_INT32));
InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
+#else
+ InstAlloc_AddMember(&FastData, LVREV_MAX_T3_DELAY * sizeof(LVM_FLOAT));
+ InstAlloc_AddMember(&FastData, LVREV_MAX_T2_DELAY * sizeof(LVM_FLOAT));
+ InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_FLOAT));
+ InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_FLOAT));
+#endif
}
if(pInstanceParams->NumDelays == LVREV_DELAYLINES_2)
{
+#ifndef BUILD_FLOAT
InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_INT32));
InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
+#else
+ InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_FLOAT));
+ InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_FLOAT));
+#endif
}
if(pInstanceParams->NumDelays == LVREV_DELAYLINES_1)
{
+#ifndef BUILD_FLOAT
InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
+#else
+ InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_FLOAT));
+#endif
}
pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Size = InstAlloc_GetTotal(&FastData);
@@ -195,14 +211,25 @@
/*
* Temporary fast memory
*/
+#ifndef BUILD_FLOAT
InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* General purpose scratch memory */
InstAlloc_AddMember(&Temporary, 2*sizeof(LVM_INT32) * MaxBlockSize); /* Mono->stereo input saved for end mix */
-
+#else
+ /* General purpose scratch memory */
+ InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * MaxBlockSize);
+ /* Mono->stereo input saved for end mix */
+ InstAlloc_AddMember(&Temporary, 2 * sizeof(LVM_FLOAT) * MaxBlockSize);
+#endif
if(pInstanceParams->NumDelays == LVREV_DELAYLINES_4)
{
for(i=0; i<4; i++)
{
+#ifndef BUILD_FLOAT
InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* A Scratch buffer for each delay line */
+#else
+ /* A Scratch buffer for each delay line */
+ InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * MaxBlockSize);
+#endif
}
}
@@ -210,7 +237,12 @@
{
for(i=0; i<2; i++)
{
+#ifndef BUILD_FLOAT
InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* A Scratch buffer for each delay line */
+#else
+ /* A Scratch buffer for each delay line */
+ InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * MaxBlockSize);
+#endif
}
}
@@ -218,7 +250,12 @@
{
for(i=0; i<1; i++)
{
+#ifndef BUILD_FLOAT
InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* A Scratch buffer for each delay line */
+#else
+ /* A Scratch buffer for each delay line */
+ InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * MaxBlockSize);
+#endif
}
}
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h b/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h
index fbfa437..ff7475e 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h
@@ -42,16 +42,27 @@
/* Defines */
/* */
/****************************************************************************************/
+#ifndef BUILD_FLOAT
/* General */
#define ONE_OVER_SQRT_TWO 23170 /* 1/sqrt(2) * 2^15 */
#define LVREV_B_8_on_1000 17179869 /* 0.8 * 2^31 */
#define LVREV_HEADROOM 8192 /* -12dB * 2^15 */
#define LVREV_2_9_INQ29 1583769190L /* 2.9 in Q29 format */
#define LVREV_MIN3DB 0x5A82 /* -3dB in Q15 format */
+#else
+/* General */
+#define ONE_OVER_SQRT_TWO 0.707107f /* 1/sqrt(2) * 2^15 */
+#define LVREV_B_8_on_1000 0.008f /* 0.8 * 2^31 */
+#define LVREV_HEADROOM 0.25f /* -12dB * 2^15 */
+#define LVREV_2_9_INQ29 2.9f /* 2.9 in Q29 format */
+#define LVREV_MIN3DB 0.7079457f /* -3dB in Q15 format */
+#endif
/* Intenal constants */
#define LVREV_LP_Poly_Order 4
#define LVREV_LP_Poly_Shift 5
+
+#ifndef BUILD_FLOAT
#define LVREV_T_3_Power_0_on_4 32768
#define LVREV_T_3_Power_1_on_4 43125
#define LVREV_T_3_Power_2_on_4 56755
@@ -61,14 +72,47 @@
#define LVREV_T_3_Power_minus1_on_4 24898 /* 3^(-1/4) * 2^15 */
#define LVREV_T_3_Power_minus2_on_4 18919 /* 3^(-2/4) * 2^15 */
#define LVREV_T_3_Power_minus3_on_4 14375 /* 3^(-3/4) * 2^15 */
-#define LVREV_MAX_T3_DELAY 2527 /* ((48000 * 120 * LVREV_T_3_Power_minus3_on_4) >> 15) / 1000 */
-#define LVREV_MAX_T2_DELAY 3326 /* ((48000 * 120 * LVREV_T_3_Power_minus2_on_4) >> 15) / 1000 */
-#define LVREV_MAX_T1_DELAY 4377 /* ((48000 * 120 * LVREV_T_3_Power_minus1_on_4) >> 15) / 1000 */
-#define LVREV_MAX_T0_DELAY 5760 /* ((48000 * 120 * LVREV_T_3_Power_minus0_on_4) >> 15) / 1000 */
-#define LVREV_MAX_AP3_DELAY 1685 /* ((48000 * 120 * LVREV_T_3_Power_minus3_on_4) >> 15) / 1500 */
-#define LVREV_MAX_AP2_DELAY 2218 /* ((48000 * 120 * LVREV_T_3_Power_minus2_on_4) >> 15) / 1500 */
-#define LVREV_MAX_AP1_DELAY 2918 /* ((48000 * 120 * LVREV_T_3_Power_minus1_on_4) >> 15) / 1500 */
-#define LVREV_MAX_AP0_DELAY 3840 /* ((48000 * 120 * LVREV_T_3_Power_minus0_on_4) >> 15) / 1500 */
+#else/*BUILD_FLOAT*/
+#define LVREV_T60_SCALE 0.000142f /*(1/7000) */
+
+#define LVREV_T_3_Power_0_on_4 1.0f
+#define LVREV_T_3_Power_1_on_4 1.316074f
+#define LVREV_T_3_Power_2_on_4 1.732051f
+#define LVREV_T_3_Power_3_on_4 2.279507f
+#define LVREV_T_3_Power_minus0_on_4 1.0f /* 3^(-0/4) * 2^15 */
+#define LVREV_T_3_Power_minus1_on_4 0.759836f /* 3^(-1/4) * 2^15 */
+#define LVREV_T_3_Power_minus2_on_4 0.577350f /* 3^(-2/4) * 2^15 */
+#define LVREV_T_3_Power_minus3_on_4 0.438691f /* 3^(-3/4) * 2^15 */
+#endif
+
+#ifndef HIGHER_FS
+#define LVREV_MAX_T3_DELAY 2527 /* ((48000 * 120 * LVREV_T_3_Power_minus3_on_4) >> 15) / 1000 */
+#define LVREV_MAX_T2_DELAY 3326 /* ((48000 * 120 * LVREV_T_3_Power_minus2_on_4) >> 15) / 1000 */
+#define LVREV_MAX_T1_DELAY 4377 /* ((48000 * 120 * LVREV_T_3_Power_minus1_on_4) >> 15) / 1000 */
+#define LVREV_MAX_T0_DELAY 5760 /* ((48000 * 120 * LVREV_T_3_Power_minus0_on_4) >> 15) / 1000 */
+#define LVREV_MAX_AP3_DELAY 1685 /* ((48000 * 120 * LVREV_T_3_Power_minus3_on_4) >> 15) / 1500 */
+#define LVREV_MAX_AP2_DELAY 2218 /* ((48000 * 120 * LVREV_T_3_Power_minus2_on_4) >> 15) / 1500 */
+#define LVREV_MAX_AP1_DELAY 2918 /* ((48000 * 120 * LVREV_T_3_Power_minus1_on_4) >> 15) / 1500 */
+#define LVREV_MAX_AP0_DELAY 3840 /* ((48000 * 120 * LVREV_T_3_Power_minus0_on_4) >> 15) / 1500 */
+#else
+ /* ((192000 * 120 * LVREV_T_3_Power_minus3_on_4) >> 15) / 1000 */
+#define LVREV_MAX_T3_DELAY 10108
+ /* ((192000 * 120 * LVREV_T_3_Power_minus2_on_4) >> 15) / 1000 */
+#define LVREV_MAX_T2_DELAY 13304
+ /* ((192000 * 120 * LVREV_T_3_Power_minus1_on_4) >> 15) / 1000 */
+#define LVREV_MAX_T1_DELAY 17508
+ /* ((192000 * 120 * LVREV_T_3_Power_minus0_on_4) >> 15) / 1000 */
+#define LVREV_MAX_T0_DELAY 23040
+ /* ((192000 * 120 * LVREV_T_3_Power_minus3_on_4) >> 15) / 1500 */
+#define LVREV_MAX_AP3_DELAY 6740
+ /* ((192000 * 120 * LVREV_T_3_Power_minus2_on_4) >> 15) / 1500 */
+#define LVREV_MAX_AP2_DELAY 8872
+ /* ((192000 * 120 * LVREV_T_3_Power_minus1_on_4) >> 15) / 1500 */
+#define LVREV_MAX_AP1_DELAY 11672
+ /* ((192000 * 120 * LVREV_T_3_Power_minus0_on_4) >> 15) / 1500 */
+#define LVREV_MAX_AP0_DELAY 15360
+#endif
+
#define LVREV_BYPASSMIXER_TC 1000 /* Bypass mixer time constant*/
#define LVREV_ALLPASS_TC 1000 /* All-pass filter time constant */
#define LVREV_ALLPASS_TAP_TC 10000 /* All-pass filter dely tap change */
@@ -76,7 +120,12 @@
#define LVREV_OUTPUTGAIN_SHIFT 5 /* Bits shift for output gain correction */
/* Parameter limits */
+#ifndef HIGHER_FS
#define LVREV_NUM_FS 9 /* Number of supported sample rates */
+#else
+#define LVREV_NUM_FS 11 /* Number of supported sample rates */
+#endif
+
#define LVREV_MAXBLKSIZE_LIMIT 64 /* Maximum block size low limit */
#define LVREV_MAX_LEVEL 100 /* Maximum level, 100% */
#define LVREV_MIN_LPF_CORNER 50 /* Low pass filter limits */
@@ -95,6 +144,7 @@
/* Structures */
/* */
/****************************************************************************************/
+#ifndef BUILD_FLOAT
/* Fast data structure */
typedef struct
{
@@ -161,7 +211,81 @@
} LVREV_Instance_st;
+#else /* BUILD_FLOAT */
+/* Fast data structure */
+typedef struct
+{
+ Biquad_1I_Order1_FLOAT_Taps_t HPTaps; /* High pass filter taps */
+ Biquad_1I_Order1_FLOAT_Taps_t LPTaps; /* Low pass filter taps */
+ Biquad_1I_Order1_FLOAT_Taps_t RevLPTaps[4]; /* Reverb low pass filters taps */
+
+} LVREV_FastData_st;
+
+
+/* Fast coefficient structure */
+typedef struct
+{
+
+ Biquad_FLOAT_Instance_t HPCoefs; /* High pass filter coefficients */
+ Biquad_FLOAT_Instance_t LPCoefs; /* Low pass filter coefficients */
+ Biquad_FLOAT_Instance_t RevLPCoefs[4]; /* Reverb low pass filters coefficients */
+
+} LVREV_FastCoef_st;
+typedef struct
+{
+ /* General */
+ LVREV_InstanceParams_st InstanceParams; /* Initialisation time instance parameters */
+ LVREV_MemoryTable_st MemoryTable; /* Memory table */
+ LVREV_ControlParams_st CurrentParams; /* Parameters being used */
+ LVREV_ControlParams_st NewParams; /* New parameters from the \
+ calling application */
+ LVM_CHAR bControlPending; /* Flag to indicate new parameters \
+ are available */
+ LVM_CHAR bFirstControl; /* Flag to indicate that the control \
+ function is called for the first time */
+ LVM_CHAR bDisableReverb; /* Flag to indicate that the mix level is
+ 0% and the reverb can be disabled */
+ LVM_INT32 RoomSizeInms; /* Room size in msec */
+ LVM_INT32 MaxBlkLen; /* Maximum block size for internal
+ processing */
+
+ /* Aligned memory pointers */
+ LVREV_FastData_st *pFastData; /* Fast data memory base address */
+ LVREV_FastCoef_st *pFastCoef; /* Fast coefficient memory base address */
+ LVM_FLOAT *pScratchDelayLine[4]; /* Delay line scratch memory */
+ LVM_FLOAT *pScratch; /* Multi ussge scratch */
+ LVM_FLOAT *pInputSave; /* Reverb block input save for dry/wet
+ mixing*/
+
+ /* Feedback matrix */
+ Mix_1St_Cll_FLOAT_t FeedbackMixer[4]; /* Mixer for Pop and Click Supression \
+ caused by feedback Gain */
+
+
+ /* All-Pass Filter */
+ LVM_INT32 T[4]; /* Maximum delay size of buffer */
+ LVM_FLOAT *pDelay_T[4]; /* Pointer to delay buffers */
+ LVM_INT32 Delay_AP[4]; /* Offset to AP delay buffer start */
+ LVM_INT16 AB_Selection; /* Smooth from tap A to B when 1 \
+ otherwise B to A */
+ LVM_INT32 A_DelaySize[4]; /* A delay length in samples */
+ LVM_INT32 B_DelaySize[4]; /* B delay length in samples */
+ LVM_FLOAT *pOffsetA[4]; /* Offset for the A delay tap */
+ LVM_FLOAT *pOffsetB[4]; /* Offset for the B delay tap */
+ Mix_2St_Cll_FLOAT_t Mixer_APTaps[4]; /* Smoothed AP delay mixer */
+ Mix_1St_Cll_FLOAT_t Mixer_SGFeedback[4]; /* Smoothed SAfeedback gain */
+ Mix_1St_Cll_FLOAT_t Mixer_SGFeedforward[4]; /* Smoothed AP feedforward gain */
+
+ /* Output gain */
+ Mix_2St_Cll_FLOAT_t BypassMixer; /* Dry/wet mixer */
+ LVM_FLOAT Gain; /* Gain applied to output to maintain
+ average signal power */
+ Mix_1St_Cll_FLOAT_t GainMixer; /* Gain smoothing */
+
+} LVREV_Instance_st;
+
+#endif
/****************************************************************************************/
/* */
/* Function prototypes */
@@ -169,12 +293,17 @@
/****************************************************************************************/
LVREV_ReturnStatus_en LVREV_ApplyNewSettings(LVREV_Instance_st *pPrivate);
-
+#ifdef BUILD_FLOAT
+void ReverbBlock(LVM_FLOAT *pInput,
+ LVM_FLOAT *pOutput,
+ LVREV_Instance_st *pPrivate,
+ LVM_UINT16 NumSamples);
+#else
void ReverbBlock(LVM_INT32 *pInput,
LVM_INT32 *pOutput,
LVREV_Instance_st *pPrivate,
LVM_UINT16 NumSamples);
-
+#endif
LVM_INT32 BypassMixer_Callback(void *pCallbackData,
void *pGeneralPurpose,
LVM_INT16 GeneralPurpose );
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.c
index 5c7a8a0..566d84f 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.c
@@ -46,14 +46,26 @@
/* 1. The input and output buffers must be 32-bit aligned */
/* */
/****************************************************************************************/
+#ifdef BUILD_FLOAT
+LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT *pOutData,
+ const LVM_UINT16 NumSamples)
+#else
LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance,
const LVM_INT32 *pInData,
LVM_INT32 *pOutData,
const LVM_UINT16 NumSamples)
+#endif
{
LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
+#ifdef BUILD_FLOAT
+ LVM_FLOAT *pInput = (LVM_FLOAT *)pInData;
+ LVM_FLOAT *pOutput = pOutData;
+#else
LVM_INT32 *pInput = (LVM_INT32 *)pInData;
LVM_INT32 *pOutput = pOutData;
+#endif
LVM_INT32 SamplesToProcess, RemainingSamples;
LVM_INT32 format = 1;
@@ -105,7 +117,7 @@
/*
* Copy the data to the output buffer, convert to stereo is required
*/
-
+#ifndef BUILD_FLOAT
if(pLVREV_Private->CurrentParams.SourceFormat == LVM_MONO){
MonoTo2I_32(pInput, pOutput, NumSamples);
} else {
@@ -113,6 +125,15 @@
(LVM_INT16 *)pOutput,
(LVM_INT16)(NumSamples << 2)); // 32 bit data, stereo
}
+#else
+ if(pLVREV_Private->CurrentParams.SourceFormat == LVM_MONO){
+ MonoTo2I_Float(pInput, pOutput, NumSamples);
+ } else {
+ Copy_Float(pInput,
+ pOutput,
+ (LVM_INT16)(NumSamples << 1)); // 32 bit data, stereo
+ }
+#endif
}
return LVREV_SUCCESS;
@@ -143,9 +164,13 @@
}
ReverbBlock(pInput, pOutput, pLVREV_Private, (LVM_UINT16)SamplesToProcess);
-
+#ifdef BUILD_FLOAT
+ pInput = (LVM_FLOAT *)(pInput + (SamplesToProcess * format));
+ pOutput = (LVM_FLOAT *)(pOutput + (SamplesToProcess * 2)); // Always stereo output
+#else
pInput = (LVM_INT32 *)(pInput +(SamplesToProcess*format));
- pOutput = (LVM_INT32 *)(pOutput+(SamplesToProcess*2)); // Always stereo output
+ pOutput = (LVM_INT32 *)(pOutput+(SamplesToProcess*2));
+#endif
}
return LVREV_SUCCESS;
@@ -175,7 +200,7 @@
/* 1. The input and output buffers must be 32-bit aligned */
/* */
/****************************************************************************************/
-
+#ifndef BUILD_FLOAT
void ReverbBlock(LVM_INT32 *pInput, LVM_INT32 *pOutput, LVREV_Instance_st *pPrivate, LVM_UINT16 NumSamples)
{
LVM_INT16 j, size;
@@ -479,7 +504,322 @@
return;
}
+#else
+void ReverbBlock(LVM_FLOAT *pInput, LVM_FLOAT *pOutput,
+ LVREV_Instance_st *pPrivate, LVM_UINT16 NumSamples)
+{
+ LVM_INT16 j, size;
+ LVM_FLOAT *pDelayLine;
+ LVM_FLOAT *pDelayLineInput = pPrivate->pScratch;
+ LVM_FLOAT *pScratch = pPrivate->pScratch;
+ LVM_FLOAT *pIn;
+ LVM_FLOAT *pTemp = pPrivate->pInputSave;
+ LVM_INT32 NumberOfDelayLines;
+
+ /******************************************************************************
+ * All calculations will go into the buffer pointed to by pTemp, this will *
+ * then be mixed with the original input to create the final output. *
+ * *
+ * When INPLACE processing is selected this must be a temporary buffer and *
+ * hence this is the worst case, so for simplicity this will ALWAYS be so *
+ * *
+ * The input buffer will remain untouched until the output of the mixer if *
+ * INPLACE processing is selected. *
+ * *
+ * The temp buffer will always be NumSamples in size regardless of MONO or *
+ * STEREO input. In the case of stereo input all processing is done in MONO *
+ * and the final output is converted to STEREO after the mixer *
+ ******************************************************************************/
+
+ if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
+ {
+ NumberOfDelayLines = 4;
+ }
+ else if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2)
+ {
+ NumberOfDelayLines = 2;
+ }
+ else
+ {
+ NumberOfDelayLines = 1;
+ }
+
+ if(pPrivate->CurrentParams.SourceFormat == LVM_MONO)
+ {
+ pIn = pInput;
+ }
+ else
+ {
+ /*
+ * Stereo to mono conversion
+ */
+
+ From2iToMono_Float(pInput,
+ pTemp,
+ (LVM_INT16)NumSamples);
+ pIn = pTemp;
+ }
+
+ Mult3s_Float(pIn,
+ (LVM_FLOAT)LVREV_HEADROOM,
+ pTemp,
+ (LVM_INT16)NumSamples);
+
+ /*
+ * High pass filter
+ */
+ FO_1I_D32F32C31_TRC_WRA_01(&pPrivate->pFastCoef->HPCoefs,
+ pTemp,
+ pTemp,
+ (LVM_INT16)NumSamples);
+ /*
+ * Low pass filter
+ */
+ FO_1I_D32F32C31_TRC_WRA_01(&pPrivate->pFastCoef->LPCoefs,
+ pTemp,
+ pTemp,
+ (LVM_INT16)NumSamples);
+
+ /*
+ * Process all delay lines
+ */
+
+ for(j = 0; j < NumberOfDelayLines; j++)
+ {
+ pDelayLine = pPrivate->pScratchDelayLine[j];
+
+ /*
+ * All-pass filter with pop and click suppression
+ */
+ /* Get the smoothed, delayed output. Put it in the output buffer */
+ MixSoft_2St_D32C31_SAT(&pPrivate->Mixer_APTaps[j],
+ pPrivate->pOffsetA[j],
+ pPrivate->pOffsetB[j],
+ pDelayLine,
+ (LVM_INT16)NumSamples);
+ /* Re-align the all pass filter delay buffer and copying the fixed delay data \
+ to the AP delay in the process */
+ Copy_Float(&pPrivate->pDelay_T[j][NumSamples],
+ pPrivate->pDelay_T[j],
+ (LVM_INT16)(pPrivate->T[j] - NumSamples)); /* 32-bit data */
+ /* Apply the smoothed feedback and save to fixed delay input (currently empty) */
+ MixSoft_1St_D32C31_WRA(&pPrivate->Mixer_SGFeedback[j],
+ pDelayLine,
+ &pPrivate->pDelay_T[j][pPrivate->T[j] - NumSamples],
+ (LVM_INT16)NumSamples);
+ /* Sum into the AP delay line */
+ Mac3s_Sat_Float(&pPrivate->pDelay_T[j][pPrivate->T[j] - NumSamples],
+ -1.0f, /* Invert since the feedback coefficient is negative */
+ &pPrivate->pDelay_T[j][pPrivate->Delay_AP[j] - NumSamples],
+ (LVM_INT16)NumSamples);
+ /* Apply smoothed feedforward sand save to fixed delay input (currently empty) */
+ MixSoft_1St_D32C31_WRA(&pPrivate->Mixer_SGFeedforward[j],
+ &pPrivate->pDelay_T[j][pPrivate->Delay_AP[j] - NumSamples],
+ &pPrivate->pDelay_T[j][pPrivate->T[j] - NumSamples],
+ (LVM_INT16)NumSamples);
+ /* Sum into the AP output */
+ Mac3s_Sat_Float(&pPrivate->pDelay_T[j][pPrivate->T[j] - NumSamples],
+ 1.0f,
+ pDelayLine,
+ (LVM_INT16)NumSamples);
+
+ /*
+ * Feedback gain
+ */
+ MixSoft_1St_D32C31_WRA(&pPrivate->FeedbackMixer[j], pDelayLine, pDelayLine, NumSamples);
+
+ /*
+ * Low pass filter
+ */
+ FO_1I_D32F32C31_TRC_WRA_01(&pPrivate->pFastCoef->RevLPCoefs[j],
+ pDelayLine,
+ pDelayLine,
+ (LVM_INT16)NumSamples);
+ }
+
+ /*
+ * Apply rotation matrix and delay samples
+ */
+ for(j = 0; j < NumberOfDelayLines; j++)
+ {
+
+ Copy_Float(pTemp,
+ pDelayLineInput,
+ (LVM_INT16)(NumSamples));
+ /*
+ * Rotation matrix mix
+ */
+ switch(j)
+ {
+ case 3:
+ /*
+ * Add delay line 1 and 2 contribution
+ */
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[1], -1.0f,
+ pDelayLineInput, (LVM_INT16)NumSamples);
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[2], -1.0f,
+ pDelayLineInput, (LVM_INT16)NumSamples);
+
+ break;
+ case 2:
+
+ /*
+ * Add delay line 0 and 3 contribution
+ */
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[0], -1.0f,
+ pDelayLineInput, (LVM_INT16)NumSamples);
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[3], -1.0f,
+ pDelayLineInput, (LVM_INT16)NumSamples);
+
+ break;
+ case 1:
+ if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
+ {
+ /*
+ * Add delay line 0 and 3 contribution
+ */
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[0], -1.0f,
+ pDelayLineInput, (LVM_INT16)NumSamples);
+ Add2_Sat_Float(pPrivate->pScratchDelayLine[3], pDelayLineInput,
+ (LVM_INT16)NumSamples);
+
+ }
+ else
+ {
+ /*
+ * Add delay line 0 and 1 contribution
+ */
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[0], -1.0f,
+ pDelayLineInput, (LVM_INT16)NumSamples);
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[1], -1.0f,
+ pDelayLineInput, (LVM_INT16)NumSamples);
+
+ }
+ break;
+ case 0:
+ if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
+ {
+ /*
+ * Add delay line 1 and 2 contribution
+ */
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[1], -1.0f,
+ pDelayLineInput, (LVM_INT16)NumSamples);
+ Add2_Sat_Float(pPrivate->pScratchDelayLine[2], pDelayLineInput,
+ (LVM_INT16)NumSamples);
+
+ }
+ else if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2)
+ {
+ /*
+ * Add delay line 0 and 1 contribution
+ */
+ Add2_Sat_Float(pPrivate->pScratchDelayLine[0], pDelayLineInput,
+ (LVM_INT16)NumSamples);
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[1], -1.0f,
+ pDelayLineInput, (LVM_INT16)NumSamples);
+
+ }
+ else
+ {
+ /*
+ * Add delay line 0 contribution
+ */
+
+ /* SOURCE DESTINATION*/
+ Add2_Sat_Float(pPrivate->pScratchDelayLine[0], pDelayLineInput,
+ (LVM_INT16)NumSamples);
+ }
+ break;
+ default:
+ break;
+ }
+
+ /*
+ * Delay samples
+ */
+ Copy_Float(pDelayLineInput,
+ &pPrivate->pDelay_T[j][pPrivate->T[j] - NumSamples],
+ (LVM_INT16)(NumSamples)); /* 32-bit data */
+ }
+ /*
+ * Create stereo output
+ */
+ switch(pPrivate->InstanceParams.NumDelays)
+ {
+ case LVREV_DELAYLINES_4:
+ Add2_Sat_Float(pPrivate->pScratchDelayLine[3],
+ pPrivate->pScratchDelayLine[0],
+ (LVM_INT16)NumSamples);
+ Add2_Sat_Float(pPrivate->pScratchDelayLine[2],
+ pPrivate->pScratchDelayLine[1],
+ (LVM_INT16)NumSamples);
+
+
+ JoinTo2i_Float(pPrivate->pScratchDelayLine[0],
+ pPrivate->pScratchDelayLine[1],
+ pTemp,
+ (LVM_INT16)NumSamples);
+
+
+ break;
+ case LVREV_DELAYLINES_2:
+
+ Copy_Float(pPrivate->pScratchDelayLine[1],
+ pScratch,
+ (LVM_INT16)(NumSamples));
+
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[0],
+ -1.0f,
+ pScratch,
+ (LVM_INT16)NumSamples);
+
+ Add2_Sat_Float(pPrivate->pScratchDelayLine[1],
+ pPrivate->pScratchDelayLine[0],
+ (LVM_INT16)NumSamples);
+
+
+ JoinTo2i_Float(pPrivate->pScratchDelayLine[0],
+ pScratch,
+ pTemp,
+ (LVM_INT16)NumSamples);
+ break;
+ case LVREV_DELAYLINES_1:
+ MonoTo2I_Float(pPrivate->pScratchDelayLine[0],
+ pTemp,
+ (LVM_INT16)NumSamples);
+ break;
+ default:
+ break;
+ }
+
+
+ /*
+ * Dry/wet mixer
+ */
+
+ size = (LVM_INT16)(NumSamples << 1);
+ MixSoft_2St_D32C31_SAT(&pPrivate->BypassMixer,
+ pTemp,
+ pTemp,
+ pOutput,
+ size);
+
+ /* Apply Gain*/
+
+ Shift_Sat_Float(LVREV_OUTPUTGAIN_SHIFT,
+ pOutput,
+ pOutput,
+ size);
+
+ MixSoft_1St_D32C31_WRA(&pPrivate->GainMixer,
+ pOutput,
+ pOutput,
+ size);
+
+ return;
+}
+#endif
/* End of file */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.c
index f5895a7..a719053 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.c
@@ -61,10 +61,15 @@
* Check all new control parameters are in range
*/
if( ((pNewParams->OperatingMode != LVM_MODE_OFF) && (pNewParams->OperatingMode != LVM_MODE_ON)) ||
- ((pNewParams->SampleRate != LVM_FS_8000) && (pNewParams->SampleRate != LVM_FS_11025) && (pNewParams->SampleRate != LVM_FS_12000) &&
+ (
+ (pNewParams->SampleRate != LVM_FS_8000) && (pNewParams->SampleRate != LVM_FS_11025) && (pNewParams->SampleRate != LVM_FS_12000) &&
(pNewParams->SampleRate != LVM_FS_16000) && (pNewParams->SampleRate != LVM_FS_22050) && (pNewParams->SampleRate != LVM_FS_24000) &&
- (pNewParams->SampleRate != LVM_FS_32000) && (pNewParams->SampleRate != LVM_FS_44100) && (pNewParams->SampleRate != LVM_FS_48000)) ||
- ((pNewParams->SourceFormat != LVM_STEREO) && (pNewParams->SourceFormat != LVM_MONOINSTEREO) && (pNewParams->SourceFormat != LVM_MONO)) )
+ (pNewParams->SampleRate != LVM_FS_32000) && (pNewParams->SampleRate != LVM_FS_44100) && (pNewParams->SampleRate != LVM_FS_48000)
+#ifdef HIGHER_FS
+ && (pNewParams->SampleRate != LVM_FS_96000) && (pNewParams->SampleRate != LVM_FS_192000)
+#endif
+ )
+ || ((pNewParams->SourceFormat != LVM_STEREO) && (pNewParams->SourceFormat != LVM_MONOINSTEREO) && (pNewParams->SourceFormat != LVM_MONO)) )
{
return (LVREV_OUTOFRANGE);
}
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.c
index 5a6d43d..b3edc60 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.c
@@ -29,6 +29,7 @@
/****************************************************************************************/
/* Table with supported sampling rates. The table can be indexed using LVM_Fs_en */
+#ifndef HIGHER_FS
const LVM_UINT16 LVM_FsTable[] = {
8000 ,
11025,
@@ -40,14 +41,37 @@
44100,
48000
};
-
+#else
+const LVM_UINT32 LVM_FsTable[] = {
+ 8000 ,
+ 11025,
+ 12000,
+ 16000,
+ 22050,
+ 24000,
+ 32000,
+ 44100,
+ 48000,
+ 96000,
+ 192000
+};
+#endif
/* Table with supported sampling rates. The table can be indexed using LVM_Fs_en */
+#ifndef HIGHER_FS
LVM_UINT16 LVM_GetFsFromTable(LVM_Fs_en FsIndex){
if (FsIndex > LVM_FS_48000)
return 0;
return (LVM_FsTable[FsIndex]);
}
+#else
+LVM_UINT32 LVM_GetFsFromTable(LVM_Fs_en FsIndex){
+ if (FsIndex > LVM_FS_192000)
+ return 0;
+
+ return (LVM_FsTable[FsIndex]);
+}
+#endif
/* In order to maintain consistant input and out put signal strengths
output gain/attenuation is applied. This gain depends on T60 and Rooms
@@ -69,6 +93,7 @@
*/
/* Normalizing output including Reverb Level part (only shift up)*/
+#ifndef BUILD_FLOAT
const LVM_INT32 LVREV_GainPolyTable[24][5]={{1,17547434,128867434,-120988896,50761228,},
{2,18256869,172666902,-193169292,88345744,},
{3,16591311,139250151,-149667234,66770059,},
@@ -94,6 +119,32 @@
{90,16003322,48323661,-35607378,13153872,},
{100,15955223,48558201,-33706865,11715792,},
};
-
+#else
+const LVM_FLOAT LVREV_GainPolyTable[24][5]={{1,1.045909f,7.681098f,-7.211500f,3.025605f,},
+ {2,1.088194f,10.291749f,-11.513787f,5.265817f,},
+ {3,0.988919f,8.299956f,-8.920862f,3.979806f,},
+ {4,1.035927f,10.182567f,-10.346134f,4.546533f,},
+ {5,1.130313f,12.538727f,-13.627023f,6.165208f,},
+ {6,1.060743f,8.091713f,-8.588079f,3.834230f,},
+ {7,1.040381f,10.406566f,-11.176650f,5.075132f,},
+ {8,1.026944f,8.387302f,-8.689796f,3.895863f,},
+ {9,1.013312f,9.727236f,-10.534165f,4.742272f,},
+ {10,0.996095f,8.492249f,-7.947677f,3.478917f,},
+ {13,1.079346f,8.894425f,-9.641768f,4.434442f,},
+ {15,0.994327f,7.441335f,-8.003979f,3.581177f,},
+ {17,0.991067f,7.208373f,-7.257859f,3.167774f,},
+ {20,1.033445f,7.476371f,-7.546960f,3.369703f,},
+ {25,0.982830f,5.913867f,-5.638448f,2.420932f,},
+ {30,0.928782f,5.035343f,-4.492104f,1.844904f,},
+ {40,0.953714f,5.060232f,-4.472204f,1.829642f,},
+ {50,0.899258f,4.273357f,-3.537492f,1.387576f,},
+ {60,0.943584f,4.093228f,-3.469658f,1.410911f,},
+ {70,0.926021f,3.973125f,-3.331985f,1.344690f,},
+ {75,0.894853f,2.871747f,-1.438758f,0.311856f,},
+ {80,0.935122f,2.991857f,-2.038882f,0.686395f,},
+ {90,0.953872f,2.880315f,-2.122365f,0.784032f,},
+ {100,0.951005f,2.894294f,-2.009086f,0.698316f,},
+};
+#endif
/* End of file */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.h b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.h
index 5f993bd..0658186 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.h
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.h
@@ -37,10 +37,19 @@
/* */
/****************************************************************************************/
+#ifndef HIGHER_FS
extern const LVM_UINT16 LVM_FsTable[];
extern LVM_UINT16 LVM_GetFsFromTable(LVM_Fs_en FsIndex);
-extern LVM_INT32 LVREV_GainPolyTable[24][5];
+#else
+extern const LVM_UINT32 LVM_FsTable[];
+extern LVM_UINT32 LVM_GetFsFromTable(LVM_Fs_en FsIndex);
+#endif
+#ifndef BUILD_FLOAT
+extern LVM_INT32 LVREV_GainPolyTable[24][5];
+#else
+extern LVM_FLOAT LVREV_GainPolyTable[24][5];
+#endif
#ifdef __cplusplus
}
#endif
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/lib/LVPSA.h b/media/libeffects/lvm/lib/SpectrumAnalyzer/lib/LVPSA.h
index a675cb2..2038fbb 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/lib/LVPSA.h
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/lib/LVPSA.h
@@ -216,11 +216,17 @@
/* otherwise Error due to bad parameters */
/* */
/*********************************************************************************************************************************/
+#ifdef BUILD_FLOAT
+LVPSA_RETURN LVPSA_Process ( pLVPSA_Handle_t hInstance,
+ LVM_FLOAT *pLVPSA_InputSamples,
+ LVM_UINT16 InputBlockSize,
+ LVPSA_Time AudioTime );
+#else
LVPSA_RETURN LVPSA_Process ( pLVPSA_Handle_t hInstance,
LVM_INT16 *pLVPSA_InputSamples,
LVM_UINT16 InputBlockSize,
LVPSA_Time AudioTime );
-
+#endif
/*********************************************************************************************************************************/
/* */
/* FUNCTION: LVPSA_GetSpectrum */
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Control.c b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Control.c
index cd5f69c..f6c4ea7 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Control.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Control.c
@@ -28,6 +28,15 @@
LVPSA_RETURN LVPSA_SetQPFCoefficients( LVPSA_InstancePr_t *pInst,
LVPSA_ControlParams_t *pParams );
+#ifdef BUILD_FLOAT
+LVPSA_RETURN LVPSA_BPSinglePrecCoefs( LVM_UINT16 Fs,
+ LVPSA_FilterParam_t *pFilterParams,
+ BP_FLOAT_Coefs_t *pCoefficients);
+
+LVPSA_RETURN LVPSA_BPDoublePrecCoefs( LVM_UINT16 Fs,
+ LVPSA_FilterParam_t *pFilterParams,
+ BP_FLOAT_Coefs_t *pCoefficients);
+#else
LVPSA_RETURN LVPSA_BPSinglePrecCoefs( LVM_UINT16 Fs,
LVPSA_FilterParam_t *pFilterParams,
BP_C16_Coefs_t *pCoefficients);
@@ -39,7 +48,7 @@
LVPSA_RETURN LVPSA_BPDoublePrecCoefs( LVM_UINT16 Fs,
LVPSA_FilterParam_t *pFilterParams,
BP_C32_Coefs_t *pCoefficients);
-
+#endif
LVPSA_RETURN LVPSA_SetBPFCoefficients( LVPSA_InstancePr_t *pInst,
LVPSA_ControlParams_t *pParams );
@@ -179,7 +188,11 @@
LVM_UINT16 Freq;
LVPSA_ControlParams_t Params;
extern LVM_INT16 LVPSA_nSamplesBufferUpdate[];
+#ifndef HIGHER_FS
extern LVM_UINT16 LVPSA_SampleRateTab[];
+#else
+ extern LVM_UINT32 LVPSA_SampleRateTab[];
+#endif
extern LVM_UINT16 LVPSA_DownSamplingFactor[];
@@ -267,8 +280,11 @@
LVPSA_RETURN LVPSA_SetBPFiltersType ( LVPSA_InstancePr_t *pInst,
LVPSA_ControlParams_t *pParams )
{
-
+#ifndef HIGHER_FS
extern LVM_UINT16 LVPSA_SampleRateTab[]; /* Sample rate table */
+#else
+ extern LVM_UINT32 LVPSA_SampleRateTab[]; /* Sample rate table */
+#endif
LVM_UINT16 ii; /* Filter band index */
LVM_UINT32 fs = (LVM_UINT32)LVPSA_SampleRateTab[(LVM_UINT16)pParams->Fs]; /* Sample rate */
LVM_UINT32 fc; /* Filter centre frequency */
@@ -342,26 +358,42 @@
{
case LVPSA_DoublePrecisionFilter:
{
+#ifndef BUILD_FLOAT
BP_C32_Coefs_t Coefficients;
/*
* Calculate the double precision coefficients
*/
LVPSA_BPDoublePrecCoefs((LVM_UINT16)pParams->Fs,
- &pInst->pFiltersParams[ii],
- &Coefficients);
-
+ &pInst->pFiltersParams[ii],
+ &Coefficients);
/*
* Set the coefficients
*/
BP_1I_D16F32Cll_TRC_WRA_01_Init ( &pInst->pBP_Instances[ii],
&pInst->pBP_Taps[ii],
&Coefficients);
+#else
+ BP_FLOAT_Coefs_t Coefficients;
+ /*
+ * Calculate the double precision coefficients
+ */
+ LVPSA_BPDoublePrecCoefs((LVM_UINT16)pParams->Fs,
+ &pInst->pFiltersParams[ii],
+ &Coefficients);
+ /*
+ * Set the coefficients
+ */
+ BP_1I_D16F32Cll_TRC_WRA_01_Init ( &pInst->pBP_Instances[ii],
+ &pInst->pBP_Taps[ii],
+ &Coefficients);
+#endif
break;
}
case LVPSA_SimplePrecisionFilter:
{
+#ifndef BUILD_FLOAT
BP_C16_Coefs_t Coefficients;
/*
@@ -374,9 +406,26 @@
/*
* Set the coefficients
*/
- BP_1I_D16F16Css_TRC_WRA_01_Init ( &pInst->pBP_Instances[ii],
+ BP_1I_D16F16Css_TRC_WRA_01_Init (&pInst->pBP_Instances[ii],
&pInst->pBP_Taps[ii],
&Coefficients);
+#else
+ BP_FLOAT_Coefs_t Coefficients;
+
+ /*
+ * Calculate the single precision coefficients
+ */
+ LVPSA_BPSinglePrecCoefs((LVM_UINT16)pParams->Fs,
+ &pInst->pFiltersParams[ii],
+ &Coefficients);
+
+ /*
+ * Set the coefficients
+ */
+ BP_1I_D16F16Css_TRC_WRA_01_Init (&pInst->pBP_Instances[ii],
+ &pInst->pBP_Taps[ii],
+ &Coefficients);
+#endif
break;
}
}
@@ -409,18 +458,31 @@
{
LVM_UINT16 ii;
LVM_Fs_en Fs = pParams->Fs;
+#ifndef BUILD_FLOAT
QPD_C32_Coefs *pCoefficients;
extern QPD_C32_Coefs LVPSA_QPD_Coefs[];
-
pCoefficients = &LVPSA_QPD_Coefs[(pParams->LevelDetectionSpeed * LVPSA_NR_SUPPORTED_RATE) + Fs];
+#else
+ QPD_FLOAT_Coefs *pCoefficients;
+ extern QPD_FLOAT_Coefs LVPSA_QPD_Float_Coefs[];
+
+ pCoefficients = &LVPSA_QPD_Float_Coefs[(pParams->LevelDetectionSpeed * \
+ LVPSA_NR_SUPPORTED_RATE) + Fs];
+#endif
for (ii = 0; ii < pInst->nRelevantFilters; ii++)
{
- LVPSA_QPD_Init (&pInst->pQPD_States[ii],
- &pInst->pQPD_Taps[ii],
- pCoefficients );
+#ifndef BUILD_FLOAT
+ LVPSA_QPD_Init (&pInst->pQPD_States[ii],
+ &pInst->pQPD_Taps[ii],
+ pCoefficients );
+#else
+ LVPSA_QPD_Init_Float (&pInst->pQPD_States[ii],
+ &pInst->pQPD_Taps[ii],
+ pCoefficients );
+#endif
}
return(LVPSA_OK);
@@ -460,6 +522,87 @@
/* of the n bands equalizer (LVEQNB */
/* */
/****************************************************************************************/
+#ifdef BUILD_FLOAT
+LVPSA_RETURN LVPSA_BPSinglePrecCoefs( LVM_UINT16 Fs,
+ LVPSA_FilterParam_t *pFilterParams,
+ BP_FLOAT_Coefs_t *pCoefficients)
+{
+
+ extern LVM_FLOAT LVPSA_Float_TwoPiOnFsTable[];
+ extern LVM_FLOAT LVPSA_Float_CosCoef[];
+
+
+ /*
+ * Intermediate variables and temporary values
+ */
+ LVM_FLOAT T0;
+ LVM_FLOAT D;
+ LVM_FLOAT A0;
+ LVM_FLOAT B1;
+ LVM_FLOAT B2;
+ LVM_FLOAT Dt0;
+ LVM_FLOAT B2_Den;
+ LVM_FLOAT B2_Num;
+ LVM_FLOAT COS_T0;
+ LVM_FLOAT coef;
+ LVM_FLOAT factor;
+ LVM_FLOAT t0;
+ LVM_INT16 i;
+
+
+ /*
+ * Get the filter definition
+ */
+ LVM_FLOAT Frequency = (LVM_FLOAT)(pFilterParams->CenterFrequency);
+ LVM_FLOAT QFactor = ((LVM_FLOAT)(pFilterParams->QFactor)) / 100;
+
+ /*
+ * Calculating the intermediate values
+ */
+ T0 = Frequency * LVPSA_Float_TwoPiOnFsTable[Fs]; /* T0 = 2 * Pi * Fc / Fs */
+ D = 3200; /* Floating point value 1.000000 (1*100*2^5) */
+ /* Force D = 1 : the function was originally used for a peaking filter.
+ The D parameter do not exist for a BandPass filter coefficients */
+
+ /*
+ * Calculate the B2 coefficient
+ */
+ Dt0 = T0 / 2048 ;
+ B2_Den = QFactor + Dt0;
+ B2_Num = Dt0 - QFactor;
+ B2 = B2_Num / (2 * B2_Den);
+
+ /*
+ * Calculate the cosine by a polynomial expansion using the equation:
+ *
+ * Cos += coef(n) * t0^n For n = 0 to 6
+ */
+ T0 = (T0 / 2048) * 0.63658558f; /* Scale to 1.0 in 16-bit for range 0 to fs/2 */
+ t0 = T0 ;
+ factor = 1.0f; /* Initialise to 1.0 for the a0 coefficient */
+ COS_T0 = 0.0f; /* Initialise the error to zero */
+ for (i = 1; i < 7; i++)
+ {
+ coef = LVPSA_Float_CosCoef[i]; /* Get the nth coefficient */
+ COS_T0 += (factor * coef); /* The nth partial sum */
+ factor = (factor * t0) ; /* Calculate t0^n */
+ }
+ COS_T0 = COS_T0 * 8; /*LVPSA_CosCoef_float[0]*/ /* Correct the scaling */
+
+
+ B1 = ((LVM_FLOAT)0.5 - B2) * (COS_T0); /* B1 = (0.5 - b2) * cos(t0) */
+ A0 = ((LVM_FLOAT)0.5 + B2) / 2; /* A0 = (0.5 + b2) / 2 */
+
+ /*
+ * Write coeff into the data structure
+ */
+ pCoefficients->A0 = A0 * 2;
+ pCoefficients->B1 = B1 * 2;
+ pCoefficients->B2 = B2 * 2;
+
+ return(LVPSA_OK);
+}
+#else
LVPSA_RETURN LVPSA_BPSinglePrecCoefs( LVM_UINT16 Fs,
LVPSA_FilterParam_t *pFilterParams,
BP_C16_Coefs_t *pCoefficients)
@@ -541,7 +684,7 @@
return(LVPSA_OK);
}
-
+#endif
/****************************************************************************************/
/* */
/* FUNCTION: LVPSA_BPDoublePrecCoefs */
@@ -584,6 +727,90 @@
/* of the n bands equalizer (LVEQNB */
/* */
/****************************************************************************************/
+#ifdef BUILD_FLOAT
+LVPSA_RETURN LVPSA_BPDoublePrecCoefs( LVM_UINT16 Fs,
+ LVPSA_FilterParam_t *pFilterParams,
+ BP_FLOAT_Coefs_t *pCoefficients)
+{
+
+ extern LVM_FLOAT LVPSA_Float_TwoPiOnFsTable[];
+ extern LVM_FLOAT LVPSA_Float_DPCosCoef[];
+
+ /*
+ * Intermediate variables and temporary values
+ */
+ LVM_FLOAT T0;
+ LVM_FLOAT D;
+ LVM_FLOAT A0;
+ LVM_FLOAT B1;
+ LVM_FLOAT B2;
+ LVM_FLOAT Dt0;
+ LVM_FLOAT B2_Den;
+ LVM_FLOAT B2_Num;
+ LVM_FLOAT CosErr;
+ LVM_FLOAT coef;
+ LVM_FLOAT factor;
+ LVM_FLOAT t0;
+ LVM_INT16 i;
+
+ /*
+ * Get the filter definition
+ */
+ LVM_FLOAT Frequency = (LVM_FLOAT)(pFilterParams->CenterFrequency);
+ LVM_FLOAT QFactor = ((LVM_FLOAT)(pFilterParams->QFactor)) / 100;
+
+
+ /*
+ * Calculating the intermediate values
+ */
+ T0 = Frequency * LVPSA_Float_TwoPiOnFsTable[Fs]; /* T0 = 2 * Pi * Fc / Fs */
+ D = 3200; /* Floating point value 1.000000 (1*100*2^5) */
+ /* Force D = 1 : the function was originally used for a peaking filter.
+ The D parameter do not exist for a BandPass filter coefficients */
+
+ /*
+ * Calculate the B2 coefficient
+ */
+ Dt0 = T0 / 2048 ;
+ B2_Den = QFactor + Dt0;
+ B2_Num = Dt0 - QFactor;
+ B2 = B2_Num / (2 * B2_Den);
+
+ /*
+ * Calculate the cosine error by a polynomial expansion using the equation:
+ *
+ * CosErr += coef(n) * t0^n For n = 0 to 4
+ */
+ T0 = T0 * 0.994750f; /* Scale to 1.0 in 16-bit for range 0 to fs/50 */
+ t0 = T0;
+ factor = 1.0f; /* Initialise to 1.0 for the a0 coefficient */
+ CosErr = 0.0f; /* Initialise the error to zero */
+ for (i = 1; i < 5; i++)
+ {
+ coef = LVPSA_Float_DPCosCoef[i]; /* Get the nth coefficient */
+ CosErr += factor * coef; /* The nth partial sum */
+ factor = factor * t0; /* Calculate t0^n */
+ }
+ CosErr = CosErr * 2; /* Correct the scaling */
+
+ /*
+ * Calculate the B1 and A0 coefficients
+ */
+ B1 = ((LVM_FLOAT)0.5 - B2); /* B1 = (0.5 - b2) */
+ A0 = B1 * CosErr ; /* Temporary storage for (0.5 - b2) * coserr(t0) */
+ B1 -= A0; /* B1 = (0.5 - b2) * (1 - coserr(t0)) */
+ A0 = ((LVM_FLOAT)0.5 + B2) / 2; /* A0 = (0.5 + b2) / 2 */
+
+ /*
+ * Write coeff into the data structure
+ */
+ pCoefficients->A0 = A0;
+ pCoefficients->B1 = B1;
+ pCoefficients->B2 = B2;
+
+ return(LVPSA_OK);
+}
+#else
LVPSA_RETURN LVPSA_BPDoublePrecCoefs( LVM_UINT16 Fs,
LVPSA_FilterParam_t *pFilterParams,
BP_C32_Coefs_t *pCoefficients)
@@ -666,7 +893,7 @@
return(LVPSA_OK);
}
-
+#endif
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_ClearFilterHistory */
@@ -690,11 +917,17 @@
/* Band Pass filters taps */
pTapAddress = (LVM_INT8 *)pInst->pBP_Taps;
+#ifdef BUILD_FLOAT
+ for(i = 0; i < pInst->nBands * sizeof(Biquad_1I_Order2_FLOAT_Taps_t); i++)
+ {
+ pTapAddress[i] = 0;
+ }
+#else
for(i = 0; i < pInst->nBands * sizeof(Biquad_1I_Order2_Taps_t); i++)
{
pTapAddress[i] = 0;
}
-
+#endif
/* Quasi-peak filters taps */
pTapAddress = (LVM_INT8 *)pInst->pQPD_Taps;
for(i = 0; i < pInst->nBands * sizeof(QPD_Taps_t); i++)
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Init.c b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Init.c
index 27a4bc3..1c26860 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Init.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Init.c
@@ -47,7 +47,11 @@
LVPSA_InstancePr_t *pLVPSA_Inst;
LVPSA_RETURN errorCode = LVPSA_OK;
LVM_UINT32 ii;
+#ifndef BUILD_FLOAT
extern LVM_INT16 LVPSA_GainTable[];
+#else
+ extern LVM_FLOAT LVPSA_Float_GainTable[];
+#endif
LVM_UINT32 BufferLength = 0;
/* Ints_Alloc instances, needed for memory alignment management */
@@ -141,19 +145,37 @@
/* Assign the pointers */
-
+#ifndef BUILD_FLOAT
pLVPSA_Inst->pPostGains = InstAlloc_AddMember( &Instance, pInitParams->nBands * sizeof(LVM_UINT16) );
+#else
+ pLVPSA_Inst->pPostGains = InstAlloc_AddMember( &Instance, pInitParams->nBands * \
+ sizeof(LVM_FLOAT) );
+#endif
pLVPSA_Inst->pFiltersParams = InstAlloc_AddMember( &Instance, pInitParams->nBands * sizeof(LVPSA_FilterParam_t) );
pLVPSA_Inst->pSpectralDataBufferStart = InstAlloc_AddMember( &Instance, pInitParams->nBands * pLVPSA_Inst->SpectralDataBufferLength * sizeof(LVM_UINT8) );
pLVPSA_Inst->pPreviousPeaks = InstAlloc_AddMember( &Instance, pInitParams->nBands * sizeof(LVM_UINT8) );
pLVPSA_Inst->pBPFiltersPrecision = InstAlloc_AddMember( &Instance, pInitParams->nBands * sizeof(LVPSA_BPFilterPrecision_en) );
-
+#ifndef BUILD_FLOAT
pLVPSA_Inst->pBP_Instances = InstAlloc_AddMember( &Coef, pInitParams->nBands * sizeof(Biquad_Instance_t) );
pLVPSA_Inst->pQPD_States = InstAlloc_AddMember( &Coef, pInitParams->nBands * sizeof(QPD_State_t) );
+#else
+ pLVPSA_Inst->pBP_Instances = InstAlloc_AddMember( &Coef, pInitParams->nBands * \
+ sizeof(Biquad_FLOAT_Instance_t) );
+ pLVPSA_Inst->pQPD_States = InstAlloc_AddMember( &Coef, pInitParams->nBands * \
+ sizeof(QPD_FLOAT_State_t) );
+#endif
+#ifndef BUILD_FLOAT
pLVPSA_Inst->pBP_Taps = InstAlloc_AddMember( &Data, pInitParams->nBands * sizeof(Biquad_1I_Order2_Taps_t) );
pLVPSA_Inst->pQPD_Taps = InstAlloc_AddMember( &Data, pInitParams->nBands * sizeof(QPD_Taps_t) );
+#else
+ pLVPSA_Inst->pBP_Taps = InstAlloc_AddMember( &Data,
+ pInitParams->nBands * \
+ sizeof(Biquad_1I_Order2_FLOAT_Taps_t));
+ pLVPSA_Inst->pQPD_Taps = InstAlloc_AddMember( &Data, pInitParams->nBands * \
+ sizeof(QPD_FLOAT_Taps_t) );
+#endif
/* Copy filters parameters in the private instance */
for(ii = 0; ii < pLVPSA_Inst->nBands; ii++)
@@ -164,7 +186,12 @@
/* Set Post filters gains*/
for(ii = 0; ii < pLVPSA_Inst->nBands; ii++)
{
+#ifndef BUILD_FLOAT
pLVPSA_Inst->pPostGains[ii] =(LVM_UINT16) LVPSA_GainTable[pInitParams->pFiltersParams[ii].PostGain + 15];
+#else
+ pLVPSA_Inst->pPostGains[ii] = LVPSA_Float_GainTable[15 + \
+ pInitParams->pFiltersParams[ii].PostGain];
+#endif
}
pLVPSA_Inst->pSpectralDataBufferWritePointer = pLVPSA_Inst->pSpectralDataBufferStart;
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Memory.c b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Memory.c
index 0984b10..06a8f9d 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Memory.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Memory.c
@@ -106,7 +106,11 @@
*/
InstAlloc_AddMember( &Instance, sizeof(LVPSA_InstancePr_t) );
+#ifdef BUILD_FLOAT
+ InstAlloc_AddMember( &Instance, pInitParams->nBands * sizeof(LVM_FLOAT) );
+#else
InstAlloc_AddMember( &Instance, pInitParams->nBands * sizeof(LVM_UINT16) );
+#endif
InstAlloc_AddMember( &Instance, pInitParams->nBands * sizeof(LVPSA_FilterParam_t) );
{
@@ -134,7 +138,11 @@
/*
* Scratch memory
*/
+#ifndef BUILD_FLOAT
InstAlloc_AddMember( &Scratch, 2 * pInitParams->MaxInputBlockSize * sizeof(LVM_INT16) );
+#else
+ InstAlloc_AddMember( &Scratch, 2 * pInitParams->MaxInputBlockSize * sizeof(LVM_FLOAT) );
+#endif
pMemoryTable->Region[LVPSA_MEMREGION_SCRATCH].Size = InstAlloc_GetTotal(&Scratch);
pMemoryTable->Region[LVPSA_MEMREGION_SCRATCH].Type = LVPSA_SCRATCH;
pMemoryTable->Region[LVPSA_MEMREGION_SCRATCH].pBaseAddress = LVM_NULL;
@@ -142,8 +150,13 @@
/*
* Persistent coefficients memory
*/
+#ifndef BUILD_FLOAT
InstAlloc_AddMember( &Coef, pInitParams->nBands * sizeof(Biquad_Instance_t) );
InstAlloc_AddMember( &Coef, pInitParams->nBands * sizeof(QPD_State_t) );
+#else
+ InstAlloc_AddMember( &Coef, pInitParams->nBands * sizeof(Biquad_FLOAT_Instance_t) );
+ InstAlloc_AddMember( &Coef, pInitParams->nBands * sizeof(QPD_FLOAT_State_t) );
+#endif
pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_COEF].Size = InstAlloc_GetTotal(&Coef);
pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_COEF].Type = LVPSA_PERSISTENT_COEF;
pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_COEF].pBaseAddress = LVM_NULL;
@@ -151,8 +164,13 @@
/*
* Persistent data memory
*/
+#ifndef BUILD_FLOAT
InstAlloc_AddMember( &Data, pInitParams->nBands * sizeof(Biquad_1I_Order2_Taps_t) );
InstAlloc_AddMember( &Data, pInitParams->nBands * sizeof(QPD_Taps_t) );
+#else
+ InstAlloc_AddMember( &Data, pInitParams->nBands * sizeof(Biquad_1I_Order2_FLOAT_Taps_t) );
+ InstAlloc_AddMember( &Data, pInitParams->nBands * sizeof(QPD_FLOAT_Taps_t) );
+#endif
pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_DATA].Size = InstAlloc_GetTotal(&Data);
pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_DATA].Type = LVPSA_PERSISTENT_DATA;
pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_DATA].pBaseAddress = LVM_NULL;
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h
index 03522fb..a750bb0 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h
@@ -43,8 +43,11 @@
#define LVPSA_MEMREGION_PERSISTENT_COEF 1 /* Offset to persistent coefficients memory region in memory table */
#define LVPSA_MEMREGION_PERSISTENT_DATA 2 /* Offset to persistent taps memory region in memory table */
#define LVPSA_MEMREGION_SCRATCH 3 /* Offset to scratch memory region in memory table */
-
-#define LVPSA_NR_SUPPORTED_RATE 9 /* From 8000Hz to 48000Hz */
+#ifndef HIGHER_FS
+#define LVPSA_NR_SUPPORTED_RATE 9 /* From 8000Hz to 48000Hz*/
+#else
+#define LVPSA_NR_SUPPORTED_RATE 11 /* From 8000Hz to 192000Hz*/
+#endif
#define LVPSA_NR_SUPPORTED_SPEED 3 /* LOW, MEDIUM, HIGH */
#define LVPSA_MAXBUFFERDURATION 4000 /* Maximum length in ms of the levels buffer */
@@ -93,12 +96,27 @@
LVPSA_MemTab_t MemoryTable;
LVPSA_BPFilterPrecision_en *pBPFiltersPrecision; /* Points a nBands elements array that contains the filter precision for each band */
+#ifndef BUILD_FLOAT
Biquad_Instance_t *pBP_Instances; /* Points a nBands elements array that contains the band pass filter instance for each band */
Biquad_1I_Order2_Taps_t *pBP_Taps; /* Points a nBands elements array that contains the band pass filter taps for each band */
QPD_State_t *pQPD_States; /* Points a nBands elements array that contains the QPD filter instance for each band */
QPD_Taps_t *pQPD_Taps; /* Points a nBands elements array that contains the QPD filter taps for each band */
- LVM_UINT16 *pPostGains; /* Points a nBands elements array that contains the post-filter gains for each band */
+#else
+ Biquad_FLOAT_Instance_t *pBP_Instances;
+ /* Points a nBands elements array that contains the band pass filter taps for each band */
+ Biquad_1I_Order2_FLOAT_Taps_t *pBP_Taps;
+ /* Points a nBands elements array that contains the QPD filter instance for each band */
+ QPD_FLOAT_State_t *pQPD_States;
+ /* Points a nBands elements array that contains the QPD filter taps for each band */
+ QPD_FLOAT_Taps_t *pQPD_Taps;
+#endif
+#ifndef BUILD_FLOAT
+ LVM_UINT16 *pPostGains; /* Points a nBands elements array that contains the post-filter gains for each band */
+#else
+ /* Points a nBands elements array that contains the post-filter gains for each band */
+ LVM_FLOAT *pPostGains;
+#endif
LVPSA_FilterParam_t *pFiltersParams; /* Copy of the filters parameters from the input parameters */
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Process.c b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Process.c
index 9e29f68..ea5f74a 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Process.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Process.c
@@ -43,6 +43,96 @@
/* otherwise Error due to bad parameters */
/* */
/************************************************************************************/
+#ifdef BUILD_FLOAT
+LVPSA_RETURN LVPSA_Process ( pLVPSA_Handle_t hInstance,
+ LVM_FLOAT *pLVPSA_InputSamples,
+ LVM_UINT16 InputBlockSize,
+ LVPSA_Time AudioTime )
+
+{
+ LVPSA_InstancePr_t *pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
+ LVM_FLOAT *pScratch;
+ LVM_INT16 ii;
+ LVM_INT32 AudioTimeInc;
+ extern LVM_UINT32 LVPSA_SampleRateInvTab[];
+ LVM_UINT8 *pWrite_Save; /* Position of the write pointer
+ at the beginning of the process */
+
+ /******************************************************************************
+ CHECK PARAMETERS
+ *******************************************************************************/
+ if(hInstance == LVM_NULL || pLVPSA_InputSamples == LVM_NULL)
+ {
+ return(LVPSA_ERROR_NULLADDRESS);
+ }
+ if(InputBlockSize == 0 || InputBlockSize > pLVPSA_Inst->MaxInputBlockSize)
+ {
+ return(LVPSA_ERROR_INVALIDPARAM);
+ }
+
+ pScratch = (LVM_FLOAT*)pLVPSA_Inst->MemoryTable.Region[LVPSA_MEMREGION_SCRATCH].pBaseAddress;
+ pWrite_Save = pLVPSA_Inst->pSpectralDataBufferWritePointer;
+
+ /******************************************************************************
+ APPLY NEW SETTINGS IF NEEDED
+ *******************************************************************************/
+ if (pLVPSA_Inst->bControlPending == LVM_TRUE)
+ {
+ pLVPSA_Inst->bControlPending = 0;
+ LVPSA_ApplyNewSettings( pLVPSA_Inst);
+ }
+
+ /******************************************************************************
+ PROCESS SAMPLES
+ *******************************************************************************/
+ /* Put samples in range [-0.5;0.5[ for BP filters (see Biquads documentation) */
+ Copy_Float(pLVPSA_InputSamples, pScratch, (LVM_INT16)InputBlockSize);
+ Shift_Sat_Float(-1, pScratch, pScratch, (LVM_INT16)InputBlockSize);
+
+ for (ii = 0; ii < pLVPSA_Inst->nRelevantFilters; ii++)
+ {
+ switch(pLVPSA_Inst->pBPFiltersPrecision[ii])
+ {
+ case LVPSA_SimplePrecisionFilter:
+ BP_1I_D16F16C14_TRC_WRA_01 ( &pLVPSA_Inst->pBP_Instances[ii],
+ pScratch,
+ pScratch + InputBlockSize,
+ (LVM_INT16)InputBlockSize);
+ break;
+
+ case LVPSA_DoublePrecisionFilter:
+ BP_1I_D16F32C30_TRC_WRA_01 ( &pLVPSA_Inst->pBP_Instances[ii],
+ pScratch,
+ pScratch + InputBlockSize,
+ (LVM_INT16)InputBlockSize);
+ break;
+ default:
+ break;
+ }
+
+
+ LVPSA_QPD_Process_Float ( pLVPSA_Inst,
+ pScratch + InputBlockSize,
+ (LVM_INT16)InputBlockSize,
+ ii);
+ }
+
+ /******************************************************************************
+ UPDATE SpectralDataBufferAudioTime
+ *******************************************************************************/
+
+ if(pLVPSA_Inst->pSpectralDataBufferWritePointer != pWrite_Save)
+ {
+ MUL32x32INTO32((AudioTime + (LVM_INT32)((LVM_INT32)pLVPSA_Inst->LocalSamplesCount*1000)),
+ (LVM_INT32)LVPSA_SampleRateInvTab[pLVPSA_Inst->CurrentParams.Fs],
+ AudioTimeInc,
+ LVPSA_FsInvertShift)
+ pLVPSA_Inst->SpectralDataBufferAudioTime = AudioTime + AudioTimeInc;
+ }
+
+ return(LVPSA_OK);
+}
+#else
LVPSA_RETURN LVPSA_Process ( pLVPSA_Handle_t hInstance,
LVM_INT16 *pLVPSA_InputSamples,
LVM_UINT16 InputBlockSize,
@@ -130,7 +220,7 @@
return(LVPSA_OK);
}
-
+#endif
/************************************************************************************/
/* */
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD.h b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD.h
index 836bfd7..99d844b 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD.h
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD.h
@@ -31,6 +31,15 @@
LVM_INT32 Coefs[2]; /* pointer to the filter coefficients */
}QPD_State_t, *pQPD_State_t;
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ /* pointer to the delayed samples (data of 32 bits) */
+ LVM_FLOAT *pDelay;
+ LVM_FLOAT Coefs[2]; /* pointer to the filter coefficients */
+}QPD_FLOAT_State_t, *pQPD_FLOAT_State_t;
+#endif
+
typedef struct
{
LVM_INT32 KP; /*should store a0*/
@@ -38,12 +47,30 @@
} QPD_C32_Coefs, *PQPD_C32_Coefs;
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ LVM_FLOAT KP; /*should store a0*/
+ LVM_FLOAT KM; /*should store b2*/
+
+} QPD_FLOAT_Coefs, *PQPD_FLOAT_Coefs;
+#endif
+
+
typedef struct
{
LVM_INT32 Storage[1];
} QPD_Taps_t, *pQPD_Taps_t;
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ LVM_FLOAT Storage[1];
+
+} QPD_FLOAT_Taps_t, *pQPD_FLOAT_Taps_t;
+
+#endif
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_QPD_Process */
@@ -62,6 +89,12 @@
LVM_INT16 numSamples,
LVM_INT16 BandIndex);
+#ifdef BUILD_FLOAT
+void LVPSA_QPD_Process_Float ( void *hInstance,
+ LVM_FLOAT *pInSamps,
+ LVM_INT16 numSamples,
+ LVM_INT16 BandIndex);
+#endif
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_QPD_Init */
@@ -80,8 +113,12 @@
void LVPSA_QPD_Init ( QPD_State_t *pInstance,
QPD_Taps_t *pTaps,
QPD_C32_Coefs *pCoef );
+#ifdef BUILD_FLOAT
-
+void LVPSA_QPD_Init_Float ( QPD_FLOAT_State_t *pInstance,
+ QPD_FLOAT_Taps_t *pTaps,
+ QPD_FLOAT_Coefs *pCoef );
+#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Init.c b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Init.c
index 50e0a80..2cc32ab 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Init.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Init.c
@@ -40,3 +40,14 @@
pQPD_State->Coefs[0] = pCoef->KP;
pQPD_State->Coefs[1] = pCoef->KM;
}
+
+#ifdef BUILD_FLOAT
+void LVPSA_QPD_Init_Float ( pQPD_FLOAT_State_t pQPD_State,
+ QPD_FLOAT_Taps_t *pTaps,
+ QPD_FLOAT_Coefs *pCoef )
+{
+ pQPD_State->pDelay = pTaps->Storage;
+ pQPD_State->Coefs[0] = ((LVM_FLOAT)pCoef->KP);
+ pQPD_State->Coefs[1] = ((LVM_FLOAT)pCoef->KM);
+}
+#endif
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Process.c b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Process.c
index 67197c1..e233172 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Process.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Process.c
@@ -35,12 +35,16 @@
/* */
/************************************************************************************/
void LVPSA_QPD_WritePeak( pLVPSA_InstancePr_t pLVPSA_Inst,
- LVM_UINT8 **ppWrite,
- LVM_INT16 BandIndex,
- LVM_INT16 Value );
+ LVM_UINT8 **ppWrite,
+ LVM_INT16 BandIndex,
+ LVM_INT16 Value );
-
-
+#ifdef BUILD_FLOAT
+void LVPSA_QPD_WritePeak_Float( pLVPSA_InstancePr_t pLVPSA_Inst,
+ LVM_UINT8 **ppWrite,
+ LVM_INT16 BandIndex,
+ LVM_FLOAT Value );
+#endif
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_QPD_Process */
@@ -54,6 +58,7 @@
/* RETURNS: void */
/* */
/************************************************************************************/
+#ifndef BUILD_FLOAT
void LVPSA_QPD_Process ( void *hInstance,
LVM_INT16 *pInSamps,
LVM_INT16 numSamples,
@@ -173,7 +178,131 @@
pLVPSA_Inst->DownSamplingCount = (LVM_UINT16)(-ii);
}
}
+#else
+void LVPSA_QPD_Process_Float ( void *hInstance,
+ LVM_FLOAT *pInSamps,
+ LVM_INT16 numSamples,
+ LVM_INT16 BandIndex)
+{
+ /******************************************************************************
+ PARAMETERS
+ *******************************************************************************/
+ LVPSA_InstancePr_t *pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
+ QPD_FLOAT_State_t *pQPDState = (QPD_FLOAT_State_t*)&pLVPSA_Inst->pQPD_States[BandIndex];
+
+ /* Pointer to taps */
+ LVM_FLOAT* pDelay = pQPDState->pDelay;
+
+ /* Parameters needed during quasi peak calculations */
+ LVM_FLOAT X0;
+ LVM_FLOAT temp,temp2;
+ LVM_FLOAT accu;
+ LVM_FLOAT Xg0;
+ LVM_FLOAT D0;
+ LVM_FLOAT V0 = (LVM_FLOAT)(*pDelay);
+
+ /* Filter's coef */
+ LVM_FLOAT Kp = ((LVM_FLOAT)(pQPDState->Coefs[0]));
+ LVM_FLOAT Km = ((LVM_FLOAT)(pQPDState->Coefs[1]));
+
+ LVM_INT16 ii = numSamples;
+
+ LVM_UINT8 *pWrite = pLVPSA_Inst->pSpectralDataBufferWritePointer;
+ LVM_INT32 BufferUpdateSamplesCount = pLVPSA_Inst->BufferUpdateSamplesCount;
+ LVM_UINT16 DownSamplingFactor = pLVPSA_Inst->DownSamplingFactor;
+
+ /******************************************************************************
+ INITIALIZATION
+ *******************************************************************************/
+ /* Correct the pointer to take the first down sampled signal sample */
+ pInSamps += pLVPSA_Inst->DownSamplingCount;
+ /* Correct also the number of samples */
+ ii = (LVM_INT16)(ii - (LVM_INT16)pLVPSA_Inst->DownSamplingCount);
+
+ while (ii > 0)
+ {
+ /* Apply post gain */
+ /* - 1 to compensate scaling in process function*/
+ X0 = (*pInSamps) * pLVPSA_Inst->pPostGains[BandIndex];
+ pInSamps = pInSamps + DownSamplingFactor;
+
+ /* Saturate and take absolute value */
+ if(X0 < 0.0f)
+ X0 = -X0;
+ if (X0 > 1.0f)
+ Xg0 = 1.0f;
+ else
+ Xg0 =X0;
+
+
+ /* Quasi peak filter calculation */
+ D0 = Xg0 - V0;
+
+ temp2 = D0;
+
+ accu = temp2 * Kp;
+ D0 = D0 / 2.0f;
+ if (D0 < 0.0f){
+ D0 = -D0;
+ }
+
+ temp2 = D0;
+
+ temp = D0 * Km;
+ accu += temp + Xg0;
+
+ if (accu > 1.0f)
+ accu = 1.0f;
+ else if(accu < 0.0f)
+ accu = 0.0f;
+
+ V0 = accu;
+
+ if(((pLVPSA_Inst->nSamplesBufferUpdate - BufferUpdateSamplesCount) < DownSamplingFactor))
+ {
+ LVPSA_QPD_WritePeak_Float( pLVPSA_Inst,
+ &pWrite,
+ BandIndex,
+ V0);
+
+ BufferUpdateSamplesCount -= pLVPSA_Inst->nSamplesBufferUpdate;
+ pLVPSA_Inst->LocalSamplesCount = (LVM_UINT16)(numSamples - ii);
+ }
+ BufferUpdateSamplesCount += DownSamplingFactor;
+
+ ii = (LVM_INT16)(ii - DownSamplingFactor);
+
+ }
+
+ /* Store last taps in memory */
+ *pDelay = V0;
+
+ /* If this is the last call to the function after last band processing,
+ update the parameters. */
+ if(BandIndex == (pLVPSA_Inst->nRelevantFilters - 1))
+ {
+ pLVPSA_Inst->pSpectralDataBufferWritePointer = pWrite;
+ /* Adjustment for 11025Hz input, 220,5 is normally
+ the exact number of samples for 20ms.*/
+ if((pLVPSA_Inst->pSpectralDataBufferWritePointer != pWrite)&&
+ (pLVPSA_Inst->CurrentParams.Fs == LVM_FS_11025))
+ {
+ if(pLVPSA_Inst->nSamplesBufferUpdate == 220)
+ {
+ pLVPSA_Inst->nSamplesBufferUpdate = 221;
+ }
+ else
+ {
+ pLVPSA_Inst->nSamplesBufferUpdate = 220;
+ }
+ }
+ pLVPSA_Inst->pSpectralDataBufferWritePointer = pWrite;
+ pLVPSA_Inst->BufferUpdateSamplesCount = BufferUpdateSamplesCount;
+ pLVPSA_Inst->DownSamplingCount = (LVM_UINT16)(-ii);
+ }
+}
+#endif
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_QPD_WritePeak */
@@ -209,4 +338,23 @@
*ppWrite = pWrite;
}
+#ifdef BUILD_FLOAT
+void LVPSA_QPD_WritePeak_Float( pLVPSA_InstancePr_t pLVPSA_Inst,
+ LVM_UINT8 **ppWrite,
+ LVM_INT16 BandIndex,
+ LVM_FLOAT Value )
+{
+ LVM_UINT8 *pWrite = *ppWrite;
+ /* Write the value and update the write pointer */
+ *(pWrite + BandIndex) = (LVM_UINT8)(Value * 256);
+ pWrite += pLVPSA_Inst->nBands;
+ if (pWrite == (pLVPSA_Inst->pSpectralDataBufferStart + pLVPSA_Inst->nBands * \
+ pLVPSA_Inst->SpectralDataBufferLength))
+ {
+ pWrite = pLVPSA_Inst->pSpectralDataBufferStart;
+ }
+
+ *ppWrite = pWrite;
+}
+#endif
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.c b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.c
index 21a5d8d..1287503 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.c
@@ -34,6 +34,7 @@
* Sample rate table for converting between the enumerated type and the actual
* frequency
*/
+#ifndef HIGHER_FS
const LVM_UINT16 LVPSA_SampleRateTab[] = { 8000, /* 8kS/s */
11025,
12000,
@@ -43,6 +44,19 @@
32000,
44100,
48000}; /* 48kS/s */
+#else
+const LVM_UINT32 LVPSA_SampleRateTab[] = { 8000, /* 8kS/s */
+ 11025,
+ 12000,
+ 16000,
+ 22050,
+ 24000,
+ 32000,
+ 44100,
+ 48000,
+ 96000,
+ 192000}; /* 192kS/s */
+#endif
/************************************************************************************/
/* */
@@ -62,7 +76,12 @@
89478,
67109,
48696,
- 44739}; /* 48kS/s */
+ 44739
+#ifdef HIGHER_FS
+ ,22369
+ ,11185 /* 192kS/s */
+#endif
+ };
@@ -84,7 +103,12 @@
480,
640,
882,
- 960}; /* 48kS/s */
+ 960
+#ifdef HIGHER_FS
+ ,1920
+ ,3840 /* 192kS/s */
+#endif
+ };
/************************************************************************************/
/* */
/* Down sampling factors */
@@ -102,7 +126,12 @@
16, /* 24000 S/s */
21, /* 32000 S/s */
30, /* 44100 S/s */
- 32}; /* 48000 S/s */
+ 32 /* 48000 S/s */
+#ifdef HIGHER_FS
+ ,64 /* 96000 S/s */
+ ,128 /*192000 S/s */
+#endif
+ };
/************************************************************************************/
@@ -122,8 +151,30 @@
8785,
6588,
4781,
- 4392}; /* 48kS/s */
+ 4392
+#ifdef HIGHER_FS
+ ,2196
+ ,1098 /* 192kS/s */
+#endif
+ };
+#ifdef BUILD_FLOAT
+const LVM_FLOAT LVPSA_Float_TwoPiOnFsTable[] = { 0.8042847f, /* 8kS/s */
+ 0.5836054f,
+ 0.5361796f,
+ 0.4021423f,
+ 0.2917874f,
+ 0.2681051f,
+ 0.2010559f,
+ 0.1459089f,
+ 0.1340372f
+#ifdef HIGHER_FS
+ ,0.0670186f
+ ,0.0335093f /* 192kS/s */
+#endif
+ };
+
+#endif
/*
* Gain table
*/
@@ -159,6 +210,39 @@
10264,
11576}; /* +15dB gain */
+#ifdef BUILD_FLOAT
+const LVM_FLOAT LVPSA_Float_GainTable[]={ 0.177734375f, /* -15dB gain */
+ 0.199218750f,
+ 0.223632812f,
+ 0.250976562f,
+ 0.281738281f,
+ 0.315917968f,
+ 0.354492187f,
+ 0.397949218f,
+ 0.446289062f,
+ 0.500976562f,
+ 0.562011718f,
+ 0.630859375f,
+ 0.707519531f,
+ 0.793945312f,
+ 0.891113281f,
+ 1.000000000f, /* 0dB gain */
+ 1.121582031f,
+ 1.258789062f,
+ 1.412109375f,
+ 1.584472656f,
+ 1.777832031f,
+ 2.000000000f,
+ 2.238281250f,
+ 2.511718750f,
+ 2.818359375f,
+ 3.162109375f,
+ 3.547851562f,
+ 3.980957031f,
+ 4.466796875f,
+ 5.011718750f,
+ 5.652343750f}; /* +15dB gain */
+#endif
/************************************************************************************/
/* */
/* Cosone polynomial coefficients */
@@ -181,7 +265,15 @@
-2671, /* a3 */
23730, /* a4 */
-9490}; /* a5 */
-
+#ifdef BUILD_FLOAT
+const LVM_FLOAT LVPSA_Float_CosCoef[] = { 3, /* Shifts */
+ 0.1250038f, /* a0 */
+ -0.0010986f, /* a1 */
+ -0.6019775f, /* a2 */
+ -0.0815149f, /* a3 */
+ 0.7242042f, /* a4 */
+ -0.2896206f}; /* a5 */
+#endif
/*
* Coefficients for calculating the cosine error with the equation:
*
@@ -201,7 +293,13 @@
-6, /* a1 */
16586, /* a2 */
-44}; /* a3 */
-
+#ifdef BUILD_FLOAT
+const LVM_FLOAT LVPSA_Float_DPCosCoef[] = {1.0f, /* Shifts */
+ 0.0f, /* a0 */
+ -0.00008311f, /* a1 */
+ 0.50617999f, /* a2 */
+ -0.00134281f}; /* a3 */
+#endif
/************************************************************************************/
/* */
/* Quasi peak filter coefficients table */
@@ -239,3 +337,54 @@
{0xA375B2C6,0x1E943BBC},
{0xA2E1E950,0x1E2A532E}}; /* 48kS/s */
+#ifdef BUILD_FLOAT
+const QPD_FLOAT_Coefs LVPSA_QPD_Float_Coefs[] = {
+
+ /* 8kS/s */ /* LVPSA_SPEED_LOW */
+ {-0.9936831989325583f,0.0062135565094650f},
+ {-0.9935833332128823f,0.0063115493394434f},
+ {-0.9932638457976282f,0.0066249934025109f},
+ {-0.9936831989325583f,0.0062135565094650f},
+ {-0.9931269618682563f,0.0067592649720609f},
+ {-0.9932638457976282f,0.0066249934025109f},
+ {-0.9933686633594334f,0.0065221670083702f},
+ {-0.9931269618682563f,0.0067592649720609f},
+ /* 48kS/s */
+ {-0.9932638457976282f,0.0066249934025109f},
+#ifdef HIGHER_FS
+ {-0.9932638457976282f,0.0066249934025109f},
+ {-0.9932638457976282f,0.0066249934025109f},
+#endif
+ /* 8kS/s */ /* LVPSA_SPEED_MEDIUM */
+ {-0.9568079425953329f,0.0418742666952312f},
+ {-0.9561413046903908f,0.0425090822391212f},
+ {-0.9540119562298059f,0.0445343819446862f},
+ {-0.9568079425953329f,0.0418742666952312f},
+ {-0.9531011912040412f,0.0453995238058269f},
+ {-0.9540119562298059f,0.0445343819446862f},
+ {-0.9547099955379963f,0.0438708555884659f},
+ //{0x8600C7B9,0x05CFA6CF},
+ {-0.9531011912040412f,0.0453995238058269f},
+ /* 48kS/s */
+ {-0.9540119562298059f,0.0445343819446862f},
+#ifdef HIGHER_FS
+ {-0.9540119562298059f,0.0445343819446862f},
+ {-0.9540119562298059f,0.0445343819446862f},
+#endif
+ /* 8kS/s */ /* LVPSA_SPEED_HIGH */
+ {-0.7415186790749431f,0.2254409026354551f},
+ {-0.7381451204419136f,0.2279209652915597f},
+ {-0.7274807319045067f,0.2356666540727019f},
+ {-0.7415186790749431f,0.2254409026354551f},
+ {-0.7229706319049001f,0.2388987224549055f},
+ {-0.7274807319045067f,0.2356666540727019f},
+ {-0.7309581353329122f,0.2331568226218224f},
+ {-0.7229706319049001f,0.2388987224549055f},
+ /* 48kS/s */
+ {-0.7274807319045067f,0.2356666540727019f}
+#ifdef HIGHER_FS
+ ,{-0.7274807319045067f,0.2356666540727019f}
+ ,{-0.7274807319045067f,0.2356666540727019f}
+#endif
+ };
+#endif
diff --git a/media/libeffects/lvm/lib/StereoWidening/lib/LVCS.h b/media/libeffects/lvm/lib/StereoWidening/lib/LVCS.h
index 0d62274..e75695e 100644
--- a/media/libeffects/lvm/lib/StereoWidening/lib/LVCS.h
+++ b/media/libeffects/lvm/lib/StereoWidening/lib/LVCS.h
@@ -374,12 +374,17 @@
/* NOTES: */
/* */
/****************************************************************************************/
-
+#ifdef BUILD_FLOAT
+LVCS_ReturnStatus_en LVCS_Process(LVCS_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 NumSamples);
+#else
LVCS_ReturnStatus_en LVCS_Process(LVCS_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 *pOutData,
LVM_UINT16 NumSamples);
-
+#endif
#ifdef __cplusplus
}
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.c
index 3e48c7e..29e3c9e 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.c
@@ -70,11 +70,17 @@
{
LVM_UINT16 Offset;
+#ifndef BUILD_FLOAT
LVM_UINT32 Gain;
+ LVM_INT32 Current;
+#else
+ LVM_FLOAT Gain;
+ LVM_FLOAT Current;
+#endif
LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
LVCS_BypassMix_t *pConfig = (LVCS_BypassMix_t *)&pInstance->BypassMix;
const Gain_t *pOutputGainTable;
- LVM_INT32 Current;
+
/*
@@ -85,7 +91,11 @@
&& (pInstance->MSTarget1 != 0x7FFF) /* this indicates an off->on transtion */
)
{
+#ifndef BUILD_FLOAT
pInstance->TransitionGain = pParams->EffectLevel;
+#else
+ pInstance->TransitionGain = ((LVM_FLOAT)pParams->EffectLevel / 32767);
+#endif
}
else
{
@@ -102,23 +112,46 @@
/*
* Setup the mixer gain for the processed path
*/
+#ifndef BUILD_FLOAT
Gain = (LVM_UINT32)(pOutputGainTable[Offset].Loss * pInstance->TransitionGain);
+#else
+ Gain = (LVM_FLOAT)(pOutputGainTable[Offset].Loss * pInstance->TransitionGain);
+#endif
pConfig->Mixer_Instance.MixerStream[0].CallbackParam = 0;
pConfig->Mixer_Instance.MixerStream[0].pCallbackHandle = LVM_NULL;
pConfig->Mixer_Instance.MixerStream[0].pCallBack = LVM_NULL;
pConfig->Mixer_Instance.MixerStream[0].CallbackSet=1;
+
+#ifndef BUILD_FLOAT
Current = LVC_Mixer_GetCurrent(&pConfig->Mixer_Instance.MixerStream[0]);
LVC_Mixer_Init(&pConfig->Mixer_Instance.MixerStream[0],(LVM_INT32)(Gain >> 15),Current);
LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[0],LVCS_BYPASS_MIXER_TC,pParams->SampleRate,2);
+#else
+ Current = LVC_Mixer_GetCurrent(&pConfig->Mixer_Instance.MixerStream[0]);
+ LVC_Mixer_Init(&pConfig->Mixer_Instance.MixerStream[0], (LVM_FLOAT)(Gain), Current);
+ LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[0],
+ LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
+#endif
+
/*
* Setup the mixer gain for the unprocessed path
*/
+#ifndef BUILD_FLOAT
Gain = (LVM_UINT32)(pOutputGainTable[Offset].Loss * (0x7FFF - pInstance->TransitionGain));
Gain = (LVM_UINT32)pOutputGainTable[Offset].UnprocLoss * (Gain >> 15);
Current = LVC_Mixer_GetCurrent(&pConfig->Mixer_Instance.MixerStream[1]);
LVC_Mixer_Init(&pConfig->Mixer_Instance.MixerStream[1],(LVM_INT32)(Gain >> 15),Current);
LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[1],LVCS_BYPASS_MIXER_TC,pParams->SampleRate,2);
+#else
+ Gain = (LVM_FLOAT)(pOutputGainTable[Offset].Loss * (1.0 - \
+ (LVM_FLOAT)pInstance->TransitionGain));
+ Gain = (LVM_FLOAT)pOutputGainTable[Offset].UnprocLoss * Gain;
+ Current = LVC_Mixer_GetCurrent(&pConfig->Mixer_Instance.MixerStream[1]);
+ LVC_Mixer_Init(&pConfig->Mixer_Instance.MixerStream[1], (LVM_FLOAT)(Gain), Current);
+ LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[1],
+ LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
+#endif
pConfig->Mixer_Instance.MixerStream[1].CallbackParam = 0;
pConfig->Mixer_Instance.MixerStream[1].pCallbackHandle = hInstance;
pConfig->Mixer_Instance.MixerStream[1].CallbackSet=1;
@@ -134,7 +167,7 @@
* Correct gain for the effect level
*/
{
-
+#ifndef BUILD_FLOAT
LVM_INT16 GainCorrect;
LVM_INT32 Gain1;
LVM_INT32 Gain2;
@@ -172,6 +205,43 @@
LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[0],LVCS_BYPASS_MIXER_TC,pParams->SampleRate,2);
LVC_Mixer_SetTarget(&pConfig->Mixer_Instance.MixerStream[1],Gain2>>16);
LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[1],LVCS_BYPASS_MIXER_TC,pParams->SampleRate,2);
+#else
+ LVM_FLOAT GainCorrect;
+ LVM_FLOAT Gain1;
+ LVM_FLOAT Gain2;
+
+ Gain1 = LVC_Mixer_GetTarget(&pConfig->Mixer_Instance.MixerStream[0]);
+ Gain2 = LVC_Mixer_GetTarget(&pConfig->Mixer_Instance.MixerStream[1]);
+ /*
+ * Calculate the gain correction
+ */
+ if (pInstance->Params.CompressorMode == LVM_MODE_ON)
+ {
+ GainCorrect = (LVM_FLOAT)( pInstance->VolCorrect.GainMin
+ - (((LVM_FLOAT)pInstance->VolCorrect.GainMin * \
+ ((LVM_FLOAT)pInstance->TransitionGain)))
+ + (((LVM_FLOAT)pInstance->VolCorrect.GainFull * \
+ ((LVM_FLOAT)pInstance->TransitionGain))));
+
+ /*
+ * Apply the gain correction
+ */
+ Gain1 = (Gain1 * GainCorrect);
+ Gain2 = (Gain2 * GainCorrect);
+
+ }
+
+ /*
+ * Set the gain values
+ */
+ pConfig->Output_Shift = pConfig->Output_Shift;
+ LVC_Mixer_SetTarget(&pConfig->Mixer_Instance.MixerStream[0],Gain1);
+ LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[0],
+ LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
+ LVC_Mixer_SetTarget(&pConfig->Mixer_Instance.MixerStream[1],Gain2);
+ LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[1],
+ LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
+#endif
}
return(LVCS_SUCCESS);
@@ -206,9 +276,15 @@
/************************************************************************************/
LVCS_ReturnStatus_en LVCS_BypassMixer(LVCS_Handle_t hInstance,
+#ifndef BUILD_FLOAT
const LVM_INT16 *pProcessed,
const LVM_INT16 *pUnprocessed,
LVM_INT16 *pOutData,
+#else
+ const LVM_FLOAT *pProcessed,
+ const LVM_FLOAT *pUnprocessed,
+ LVM_FLOAT *pOutData,
+#endif
LVM_UINT16 NumSamples)
{
@@ -223,6 +299,7 @@
/*
* Apply the bypass mix
*/
+#ifndef BUILD_FLOAT
LVC_MixSoft_2St_D16C31_SAT(&pConfig->Mixer_Instance,
pProcessed,
(LVM_INT16 *) pUnprocessed,
@@ -236,6 +313,20 @@
(LVM_INT16*)pOutData,
(LVM_INT16*)pOutData,
(LVM_INT16)(2*NumSamples)); /* Left and right*/
+#else
+ LVC_MixSoft_2St_D16C31_SAT(&pConfig->Mixer_Instance,
+ pProcessed,
+ (LVM_FLOAT *) pUnprocessed,
+ pOutData,
+ (LVM_INT16)(2 * NumSamples));
+ /*
+ * Apply output gain correction shift
+ */
+ Shift_Sat_Float((LVM_INT16)pConfig->Output_Shift,
+ (LVM_FLOAT*)pOutData,
+ (LVM_FLOAT*)pOutData,
+ (LVM_INT16)(2 * NumSamples)); /* Left and right*/
+#endif
}
return(LVCS_SUCCESS);
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.h
index d1ef70a..f69ba38 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.h
@@ -42,12 +42,16 @@
typedef struct
{
/* Mixer settings */
+#ifdef BUILD_FLOAT
+ LVMixer3_2St_FLOAT_st Mixer_Instance; /* Mixer instance */
+#else
LVMixer3_2St_st Mixer_Instance; /* Mixer instance */
+#endif
LVM_UINT16 Output_Shift; /* Correcting gain output shift */
} LVCS_BypassMix_t;
-
+#ifndef BUILD_FLOAT
/* Output gain type */
typedef struct
{
@@ -56,8 +60,15 @@
LVM_UINT16 Loss; /* Loss required */
LVM_UINT16 UnprocLoss; /* Unprocessed path loss */
} Gain_t;
-
-
+#else
+typedef struct
+{
+ /* Output gain settings, Gain = (Loss/32768) * 2^Shift */
+ LVM_UINT16 Shift; /* Left shifts required */
+ LVM_FLOAT Loss; /* Loss required */
+ LVM_FLOAT UnprocLoss; /* Unprocessed path loss */
+} Gain_t;
+#endif
/************************************************************************************/
/* */
/* Function prototypes */
@@ -67,13 +78,19 @@
LVCS_ReturnStatus_en LVCS_BypassMixInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams);
-
+#ifndef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_BypassMixer(LVCS_Handle_t hInstance,
const LVM_INT16 *pProcessed,
const LVM_INT16 *unProcessed,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples);
-
+ LVM_INT16 *pOutData,
+ LVM_UINT16 NumSamples);
+#else
+LVCS_ReturnStatus_en LVCS_BypassMixer(LVCS_Handle_t hInstance,
+ const LVM_FLOAT *pProcessed,
+ const LVM_FLOAT *unProcessed,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 NumSamples);
+#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.c
index ce6d410..3bf6ec6 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.c
@@ -120,11 +120,13 @@
pInstance->VolCorrect = pLVCS_VolCorrectTable[Offset];
pInstance->CompressGain = pInstance->VolCorrect.CompMin;
-
+#ifdef BUILD_FLOAT
+ LVC_Mixer_Init(&pInstance->BypassMix.Mixer_Instance.MixerStream[0], 0, 0);
+#else
LVC_Mixer_Init(&pInstance->BypassMix.Mixer_Instance.MixerStream[0],0,0);
-
-
+#endif
{
+#ifndef BUILD_FLOAT
LVM_UINT32 Gain;
const Gain_t *pOutputGainTable = (Gain_t*)&LVCS_OutputGainTable[0];
Gain = (LVM_UINT32)(pOutputGainTable[Offset].Loss * LVM_MAXINT_16);
@@ -140,7 +142,23 @@
LVCS_BYPASS_MIXER_TC,pParams->SampleRate,2);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMix.Mixer_Instance.MixerStream[1],
LVCS_BYPASS_MIXER_TC,pParams->SampleRate,2);
+#else
+ LVM_FLOAT Gain;
+ const Gain_t *pOutputGainTable = (Gain_t*)&LVCS_OutputGainTable[0];
+ Gain = (LVM_FLOAT)(pOutputGainTable[Offset].Loss);
+ Gain = (LVM_FLOAT)pOutputGainTable[Offset].UnprocLoss * (Gain);
+ /*
+ * Apply the gain correction
+ */
+ Gain = (Gain * pInstance->VolCorrect.GainMin);
+
+ LVC_Mixer_Init(&pInstance->BypassMix.Mixer_Instance.MixerStream[1], 0, Gain);
+ LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMix.Mixer_Instance.MixerStream[0],
+ LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
+ LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMix.Mixer_Instance.MixerStream[1],
+ LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
+#endif
}
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.c
index 25b0d86..ec5312e 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.c
@@ -53,7 +53,72 @@
/* NOTES: */
/* */
/************************************************************************************/
+#ifdef BUILD_FLOAT
+LVCS_ReturnStatus_en LVCS_EqualiserInit(LVCS_Handle_t hInstance,
+ LVCS_Params_t *pParams)
+{
+ LVM_UINT16 Offset;
+ LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
+ LVCS_Equaliser_t *pConfig = (LVCS_Equaliser_t *)&pInstance->Equaliser;
+ LVCS_Data_t *pData;
+ LVCS_Coefficient_t *pCoefficients;
+ BQ_FLOAT_Coefs_t Coeffs;
+ const BiquadA012B12CoefsSP_t *pEqualiserCoefTable;
+
+ pData = (LVCS_Data_t *) \
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_DATA].pBaseAddress;
+
+ pCoefficients = (LVCS_Coefficient_t *) \
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
+ /*
+ * If the sample rate changes re-initialise the filters
+ */
+ if ((pInstance->Params.SampleRate != pParams->SampleRate) ||
+ (pInstance->Params.SpeakerType != pParams->SpeakerType))
+ {
+ /*
+ * Setup the filter coefficients and clear the history
+ */
+ Offset = (LVM_UINT16)(pParams->SampleRate + (pParams->SpeakerType * (1 + LVM_FS_48000)));
+ pEqualiserCoefTable = (BiquadA012B12CoefsSP_t*)&LVCS_EqualiserCoefTable[0];
+
+ /* Left and right filters */
+ /* Convert incoming coefficients to the required format/ordering */
+ Coeffs.A0 = (LVM_FLOAT) pEqualiserCoefTable[Offset].A0;
+ Coeffs.A1 = (LVM_FLOAT) pEqualiserCoefTable[Offset].A1;
+ Coeffs.A2 = (LVM_FLOAT) pEqualiserCoefTable[Offset].A2;
+ Coeffs.B1 = (LVM_FLOAT)-pEqualiserCoefTable[Offset].B1;
+ Coeffs.B2 = (LVM_FLOAT)-pEqualiserCoefTable[Offset].B2;
+
+ LoadConst_Float((LVM_INT16)0, /* Value */
+ (void *)&pData->EqualiserBiquadTaps, /* Destination Cast to void:\
+ no dereferencing in function*/
+ /* Number of words */
+ (LVM_UINT16)(sizeof(pData->EqualiserBiquadTaps) / sizeof(LVM_FLOAT)));
+
+ BQ_2I_D16F32Css_TRC_WRA_01_Init(&pCoefficients->EqualiserBiquadInstance,
+ &pData->EqualiserBiquadTaps,
+ &Coeffs);
+
+ /* Callbacks */
+ switch(pEqualiserCoefTable[Offset].Scale)
+ {
+ case 13:
+ pConfig->pBiquadCallBack = BQ_2I_D16F32C13_TRC_WRA_01;
+ break;
+ case 14:
+ pConfig->pBiquadCallBack = BQ_2I_D16F32C14_TRC_WRA_01;
+ break;
+ case 15:
+ pConfig->pBiquadCallBack = BQ_2I_D16F32C15_TRC_WRA_01;
+ break;
+ }
+ }
+
+ return(LVCS_SUCCESS);
+}
+#else
LVCS_ReturnStatus_en LVCS_EqualiserInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams)
{
@@ -112,7 +177,7 @@
return(LVCS_SUCCESS);
}
-
+#endif
/************************************************************************************/
/* */
/* FUNCTION: LVCS_Equaliser */
@@ -132,7 +197,37 @@
/* 1. Always processes in place. */
/* */
/************************************************************************************/
+#ifdef BUILD_FLOAT
+LVCS_ReturnStatus_en LVCS_Equaliser(LVCS_Handle_t hInstance,
+ LVM_FLOAT *pInputOutput,
+ LVM_UINT16 NumSamples)
+{
+ LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
+ LVCS_Equaliser_t *pConfig = (LVCS_Equaliser_t *)&pInstance->Equaliser;
+ LVCS_Coefficient_t *pCoefficients;
+
+
+ pCoefficients = (LVCS_Coefficient_t *) \
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
+
+
+ /*
+ * Check if the equaliser is required
+ */
+ if ((pInstance->Params.OperatingMode & LVCS_EQUALISERSWITCH) != 0)
+ {
+ /* Apply filter to the left and right channels */
+ (pConfig->pBiquadCallBack)((Biquad_FLOAT_Instance_t*) \
+ &pCoefficients->EqualiserBiquadInstance,
+ (LVM_FLOAT *)pInputOutput,
+ (LVM_FLOAT *)pInputOutput,
+ (LVM_INT16)NumSamples);
+ }
+
+ return(LVCS_SUCCESS);
+}
+#else
LVCS_ReturnStatus_en LVCS_Equaliser(LVCS_Handle_t hInstance,
LVM_INT16 *pInputOutput,
LVM_UINT16 NumSamples)
@@ -157,4 +252,4 @@
return(LVCS_SUCCESS);
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.h
index cf96f5b..0e756e7 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.h
@@ -32,8 +32,11 @@
/* Equaliser structure */
typedef struct
{
+#ifndef BUILD_FLOAT
void (*pBiquadCallBack) (Biquad_Instance_t*, LVM_INT16*, LVM_INT16*, LVM_INT16);
-
+#else
+ void (*pBiquadCallBack) (Biquad_FLOAT_Instance_t*, LVM_FLOAT*, LVM_FLOAT*, LVM_INT16);
+#endif
} LVCS_Equaliser_t;
@@ -45,12 +48,15 @@
LVCS_ReturnStatus_en LVCS_EqualiserInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams);
-
+#ifndef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_Equaliser(LVCS_Handle_t hInstance,
LVM_INT16 *pInputOutput,
LVM_UINT16 NumSamples);
-
-
+#else
+LVCS_ReturnStatus_en LVCS_Equaliser(LVCS_Handle_t hInstance,
+ LVM_FLOAT *pInputOutput,
+ LVM_UINT16 NumSamples);
+#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h
index 3e640cb..4f5221a 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h
@@ -24,7 +24,463 @@
/* The Stereo Enhancer */
/* */
/************************************************************************************/
+#ifdef BUILD_FLOAT
+/* Stereo Enhancer coefficients for 8000 Hz sample rate, scaled with 0.161258 */
+#define CS_MIDDLE_8000_A0 0.227720
+#define CS_MIDDLE_8000_A1 -0.215125
+#define CS_MIDDLE_8000_A2 0.000000
+#define CS_MIDDLE_8000_B1 -0.921899
+#define CS_MIDDLE_8000_B2 0.000000
+#define CS_MIDDLE_8000_SCALE 15
+#define CS_SIDE_8000_A0 0.611441
+#define CS_SIDE_8000_A1 -0.380344
+#define CS_SIDE_8000_A2 -0.231097
+#define CS_SIDE_8000_B1 -0.622470
+#define CS_SIDE_8000_B2 -0.130759
+#define CS_SIDE_8000_SCALE 15
+/* Stereo Enhancer coefficients for 11025Hz sample rate, scaled with 0.162943 */
+#define CS_MIDDLE_11025_A0 0.230838
+#define CS_MIDDLE_11025_A1 -0.221559
+#define CS_MIDDLE_11025_A2 0.000000
+#define CS_MIDDLE_11025_B1 -0.943056
+#define CS_MIDDLE_11025_B2 0.000000
+#define CS_MIDDLE_11025_SCALE 15
+#define CS_SIDE_11025_A0 0.557372
+#define CS_SIDE_11025_A1 -0.391490
+#define CS_SIDE_11025_A2 -0.165881
+#define CS_SIDE_11025_B1 -0.880608
+#define CS_SIDE_11025_B2 0.032397
+#define CS_SIDE_11025_SCALE 15
+
+/* Stereo Enhancer coefficients for 12000Hz sample rate, scaled with 0.162191 */
+#define CS_MIDDLE_12000_A0 0.229932
+#define CS_MIDDLE_12000_A1 -0.221436
+#define CS_MIDDLE_12000_A2 0.000000
+#define CS_MIDDLE_12000_B1 -0.947616
+#define CS_MIDDLE_12000_B2 0.000000
+#define CS_MIDDLE_12000_SCALE 15
+#define CS_SIDE_12000_A0 0.558398
+#define CS_SIDE_12000_A1 -0.392211
+#define CS_SIDE_12000_A2 -0.166187
+#define CS_SIDE_12000_B1 -0.892550
+#define CS_SIDE_12000_B2 0.032856
+#define CS_SIDE_12000_SCALE 15
+
+/* Stereo Enhancer coefficients for 16000Hz sample rate, scaled with 0.162371 */
+#define CS_MIDDLE_16000_A0 0.230638
+#define CS_MIDDLE_16000_A1 -0.224232
+#define CS_MIDDLE_16000_A2 0.000000
+#define CS_MIDDLE_16000_B1 -0.960550
+#define CS_MIDDLE_16000_B2 0.000000
+#define CS_MIDDLE_16000_SCALE 15
+#define CS_SIDE_16000_A0 0.499695
+#define CS_SIDE_16000_A1 -0.355543
+#define CS_SIDE_16000_A2 -0.144152
+#define CS_SIDE_16000_B1 -1.050788
+#define CS_SIDE_16000_B2 0.144104
+#define CS_SIDE_16000_SCALE 14
+
+/* Stereo Enhancer coefficients for 22050Hz sample rate, scaled with 0.160781 */
+#define CS_MIDDLE_22050_A0 0.228749
+#define CS_MIDDLE_22050_A1 -0.224128
+#define CS_MIDDLE_22050_A2 0.000000
+#define CS_MIDDLE_22050_B1 -0.971262
+#define CS_MIDDLE_22050_B2 0.000000
+#define CS_MIDDLE_22050_SCALE 15
+#define CS_SIDE_22050_A0 0.440112
+#define CS_SIDE_22050_A1 -0.261096
+#define CS_SIDE_22050_A2 -0.179016
+#define CS_SIDE_22050_B1 -1.116786
+#define CS_SIDE_22050_B2 0.182507
+#define CS_SIDE_22050_SCALE 14
+
+/* Stereo Enhancer coefficients for 24000Hz sample rate, scaled with 0.161882 */
+#define CS_MIDDLE_24000_A0 0.230395
+#define CS_MIDDLE_24000_A1 -0.226117
+#define CS_MIDDLE_24000_A2 0.000000
+#define CS_MIDDLE_24000_B1 -0.973573
+#define CS_MIDDLE_24000_B2 0.000000
+#define CS_MIDDLE_24000_SCALE 15
+#define CS_SIDE_24000_A0 0.414770
+#define CS_SIDE_24000_A1 -0.287182
+#define CS_SIDE_24000_A2 -0.127588
+#define CS_SIDE_24000_B1 -1.229648
+#define CS_SIDE_24000_B2 0.282177
+#define CS_SIDE_24000_SCALE 14
+
+/* Stereo Enhancer coefficients for 32000Hz sample rate, scaled with 0.160322 */
+#define CS_MIDDLE_32000_A0 0.228400
+#define CS_MIDDLE_32000_A1 -0.225214
+#define CS_MIDDLE_32000_A2 0.000000
+#define CS_MIDDLE_32000_B1 -0.980126
+#define CS_MIDDLE_32000_B2 0.000000
+#define CS_MIDDLE_32000_SCALE 15
+#define CS_SIDE_32000_A0 0.364579
+#define CS_SIDE_32000_A1 -0.207355
+#define CS_SIDE_32000_A2 -0.157224
+#define CS_SIDE_32000_B1 -1.274231
+#define CS_SIDE_32000_B2 0.312495
+#define CS_SIDE_32000_SCALE 14
+
+/* Stereo Enhancer coefficients for 44100Hz sample rate, scaled with 0.163834 */
+#define CS_MIDDLE_44100_A0 0.233593
+#define CS_MIDDLE_44100_A1 -0.231225
+#define CS_MIDDLE_44100_A2 0.000000
+#define CS_MIDDLE_44100_B1 -0.985545
+#define CS_MIDDLE_44100_B2 0.000000
+#define CS_MIDDLE_44100_SCALE 15
+#define CS_SIDE_44100_A0 0.284573
+#define CS_SIDE_44100_A1 -0.258910
+#define CS_SIDE_44100_A2 -0.025662
+#define CS_SIDE_44100_B1 -1.572248
+#define CS_SIDE_44100_B2 0.588399
+#define CS_SIDE_44100_SCALE 14
+
+/* Stereo Enhancer coefficients for 48000Hz sample rate, scaled with 0.164402 */
+#define CS_MIDDLE_48000_A0 0.234445
+#define CS_MIDDLE_48000_A1 -0.232261
+#define CS_MIDDLE_48000_A2 0.000000
+#define CS_MIDDLE_48000_B1 -0.986713
+#define CS_MIDDLE_48000_B2 0.000000
+#define CS_MIDDLE_48000_SCALE 15
+#define CS_SIDE_48000_A0 0.272606
+#define CS_SIDE_48000_A1 -0.266952
+#define CS_SIDE_48000_A2 -0.005654
+#define CS_SIDE_48000_B1 -1.617141
+#define CS_SIDE_48000_B2 0.630405
+#define CS_SIDE_48000_SCALE 14
+
+#ifdef HIGHER_FS
+/* Stereo Enhancer coefficients for 96000Hz sample rate, scaled with 0.165*/
+/* high pass filter with cutoff frequency 102.18 Hz*/
+#define CS_MIDDLE_96000_A0 0.235532
+#define CS_MIDDLE_96000_A1 -0.234432
+#define CS_MIDDLE_96000_A2 0.000000
+#define CS_MIDDLE_96000_B1 -0.993334
+#define CS_MIDDLE_96000_B2 0.000000
+#define CS_MIDDLE_96000_SCALE 15
+/* bandpass filter with fc1 270 and fc2 3703, designed using 2nd order butterworth */
+#define CS_SIDE_96000_A0 0.016727
+#define CS_SIDE_96000_A1 0.000000
+#define CS_SIDE_96000_A2 -0.016727
+#define CS_SIDE_96000_B1 -1.793372
+#define CS_SIDE_96000_B2 0.797236
+#define CS_SIDE_96000_SCALE 14
+
+/* Stereo Enhancer coefficients for 192000Hz sample rate, scaled with 0.1689*/
+#define CS_MIDDLE_192000_A0 0.241219
+#define CS_MIDDLE_192000_A1 -0.240656
+#define CS_MIDDLE_192000_A2 0.000000
+#define CS_MIDDLE_192000_B1 -0.996661
+#define CS_MIDDLE_192000_B2 0.000000
+#define CS_MIDDLE_192000_SCALE 15
+/* bandpass filter with fc1 270 and fc2 3703, designed using 2nd order butterworth */
+#define CS_SIDE_192000_A0 0.008991
+#define CS_SIDE_192000_A1 -0.000000
+#define CS_SIDE_192000_A2 -0.008991
+#define CS_SIDE_192000_B1 -1.892509
+#define CS_SIDE_192000_B2 0.893524
+#define CS_SIDE_192000_SCALE 14
+#endif
+
+/************************************************************************************/
+/* */
+/* The Reverb Unit */
+/* */
+/************************************************************************************/
+
+/* Reverb delay settings in samples */
+#define LVCS_STEREODELAY_CS_8KHZ 93 /* Sample rate 8kS/s */
+#define LVCS_STEREODELAY_CS_11KHZ 128 /* Sample rate 11kS/s */
+#define LVCS_STEREODELAY_CS_12KHZ 139 /* Sample rate 12kS/s */
+#define LVCS_STEREODELAY_CS_16KHZ 186 /* Sample rate 16kS/s */
+#define LVCS_STEREODELAY_CS_22KHZ 256 /* Sample rate 22kS/s */
+#define LVCS_STEREODELAY_CS_24KHZ 279 /* Sample rate 24kS/s */
+#define LVCS_STEREODELAY_CS_32KHZ 372 /* Sample rate 32kS/s */
+#define LVCS_STEREODELAY_CS_44KHZ 512 /* Sample rate 44kS/s */
+#define LVCS_STEREODELAY_CS_48KHZ 512 /* Sample rate 48kS/s */
+
+/* Reverb coefficients for 8000 Hz sample rate, scaled with 1.038030 */
+#define CS_REVERB_8000_A0 0.667271
+#define CS_REVERB_8000_A1 -0.667271
+#define CS_REVERB_8000_A2 0.000000
+#define CS_REVERB_8000_B1 -0.668179
+#define CS_REVERB_8000_B2 0.000000
+#define CS_REVERB_8000_SCALE 15
+
+/* Reverb coefficients for 11025Hz sample rate, scaled with 1.038030 */
+#define CS_REVERB_11025_A0 0.699638
+#define CS_REVERB_11025_A1 -0.699638
+#define CS_REVERB_11025_A2 0.000000
+#define CS_REVERB_11025_B1 -0.749096
+#define CS_REVERB_11025_B2 0.000000
+#define CS_REVERB_11025_SCALE 15
+
+/* Reverb coefficients for 12000Hz sample rate, scaled with 1.038030 */
+#define CS_REVERB_12000_A0 0.706931
+#define CS_REVERB_12000_A1 -0.706931
+#define CS_REVERB_12000_A2 0.000000
+#define CS_REVERB_12000_B1 -0.767327
+#define CS_REVERB_12000_B2 0.000000
+#define CS_REVERB_12000_SCALE 15
+
+/* Reverb coefficients for 16000Hz sample rate, scaled with 1.038030 */
+#define CS_REVERB_16000_A0 0.728272
+#define CS_REVERB_16000_A1 -0.728272
+#define CS_REVERB_16000_A2 0.000000
+#define CS_REVERB_16000_B1 -0.820679
+#define CS_REVERB_16000_B2 0.000000
+#define CS_REVERB_16000_SCALE 15
+
+/* Reverb coefficients for 22050Hz sample rate, scaled with 1.038030 */
+#define CS_REVERB_22050_A0 0.516396
+#define CS_REVERB_22050_A1 0.000000
+#define CS_REVERB_22050_A2 -0.516396
+#define CS_REVERB_22050_B1 -0.518512
+#define CS_REVERB_22050_B2 -0.290990
+#define CS_REVERB_22050_SCALE 15
+
+
+/* Reverb coefficients for 24000Hz sample rate, scaled with 1.038030 */
+#define CS_REVERB_24000_A0 0.479565
+#define CS_REVERB_24000_A1 0.000000
+#define CS_REVERB_24000_A2 -0.479565
+#define CS_REVERB_24000_B1 -0.637745
+#define CS_REVERB_24000_B2 -0.198912
+#define CS_REVERB_24000_SCALE 15
+
+/* Reverb coefficients for 32000Hz sample rate, scaled with 1.038030 */
+#define CS_REVERB_32000_A0 0.380349
+#define CS_REVERB_32000_A1 0.000000
+#define CS_REVERB_32000_A2 -0.380349
+#define CS_REVERB_32000_B1 -0.950873
+#define CS_REVERB_32000_B2 0.049127
+#define CS_REVERB_32000_SCALE 15
+
+/* Reverb coefficients for 44100Hz sample rate, scaled with 1.038030 */
+#define CS_REVERB_44100_A0 0.297389
+#define CS_REVERB_44100_A1 0.000000
+#define CS_REVERB_44100_A2 -0.297389
+#define CS_REVERB_44100_B1 -1.200423
+#define CS_REVERB_44100_B2 0.256529
+#define CS_REVERB_44100_SCALE 14
+
+/* Reverb coefficients for 48000Hz sample rate, scaled with 1.038030 */
+#define CS_REVERB_48000_A0 0.278661
+#define CS_REVERB_48000_A1 0.000000
+#define CS_REVERB_48000_A2 -0.278661
+#define CS_REVERB_48000_B1 -1.254993
+#define CS_REVERB_48000_B2 0.303347
+#define CS_REVERB_48000_SCALE 14
+
+#ifdef HIGHER_FS
+/* Reverb coefficients for 96000Hz sample rate, scaled with 0.8 */
+/* Band pass filter with fc1=500 and fc2=8000*/
+#define CS_REVERB_96000_A0 0.1602488
+#define CS_REVERB_96000_A1 0.000000
+#define CS_REVERB_96000_A2 -0.1602488
+#define CS_REVERB_96000_B1 -1.585413
+#define CS_REVERB_96000_B2 0.599377
+#define CS_REVERB_96000_SCALE 14
+
+/* Reverb coefficients for 192000Hz sample rate, scaled with 0.8 */
+/* Band pass filter with fc1=500 and fc2=8000*/
+#define CS_REVERB_192000_A0 0.0878369
+#define CS_REVERB_192000_A1 0.000000
+#define CS_REVERB_192000_A2 -0.0878369
+#define CS_REVERB_192000_B1 -1.7765764
+#define CS_REVERB_192000_B2 0.7804076
+#define CS_REVERB_192000_SCALE 14
+
+#endif
+
+
+/* Reverb Gain Settings */
+#define LVCS_HEADPHONE_DELAYGAIN 0.800000 /* Algorithm delay path gain */
+#define LVCS_HEADPHONE_OUTPUTGAIN 1.000000 /* Algorithm output gain */
+#define LVCS_HEADPHONE_PROCGAIN 18403 /* Processed path gain */
+#define LVCS_HEADPHONE_UNPROCGAIN 18403 /* Unprocessed path gain */
+#define LVCS_HEADPHONE_GAINCORRECT 1.009343 /* Delay mixer gain correction */
+
+/************************************************************************************/
+/* */
+/* The Equaliser */
+/* */
+/************************************************************************************/
+
+/* Equaliser coefficients for 8000 Hz sample rate, \
+ CS scaled with 1.038497 and CSEX scaled with 0.775480 */
+#define CS_EQUALISER_8000_A0 1.263312
+#define CS_EQUALISER_8000_A1 -0.601748
+#define CS_EQUALISER_8000_A2 -0.280681
+#define CS_EQUALISER_8000_B1 -0.475865
+#define CS_EQUALISER_8000_B2 -0.408154
+#define CS_EQUALISER_8000_SCALE 14
+#define CSEX_EQUALISER_8000_A0 0.943357
+#define CSEX_EQUALISER_8000_A1 -0.449345
+#define CSEX_EQUALISER_8000_A2 -0.209594
+#define CSEX_EQUALISER_8000_B1 -0.475865
+#define CSEX_EQUALISER_8000_B2 -0.408154
+#define CSEX_EQUALISER_8000_SCALE 15
+
+/* Equaliser coefficients for 11025Hz sample rate, \
+ CS scaled with 1.027761 and CSEX scaled with 0.767463 */
+#define CS_EQUALISER_11025_A0 1.101145
+#define CS_EQUALISER_11025_A1 0.139020
+#define CS_EQUALISER_11025_A2 -0.864423
+#define CS_EQUALISER_11025_B1 0.024541
+#define CS_EQUALISER_11025_B2 -0.908930
+#define CS_EQUALISER_11025_SCALE 14
+#define CSEX_EQUALISER_11025_A0 0.976058
+#define CSEX_EQUALISER_11025_A1 -0.695326
+#define CSEX_EQUALISER_11025_A2 -0.090809
+#define CSEX_EQUALISER_11025_B1 -0.610594
+#define CSEX_EQUALISER_11025_B2 -0.311149
+#define CSEX_EQUALISER_11025_SCALE 15
+
+/* Equaliser coefficients for 12000Hz sample rate, \
+ CS scaled with 1.032521 and CSEX scaled with 0.771017 */
+#define CS_EQUALISER_12000_A0 1.276661
+#define CS_EQUALISER_12000_A1 -1.017519
+#define CS_EQUALISER_12000_A2 -0.044128
+#define CS_EQUALISER_12000_B1 -0.729616
+#define CS_EQUALISER_12000_B2 -0.204532
+#define CS_EQUALISER_12000_SCALE 14
+#define CSEX_EQUALISER_12000_A0 1.007095
+#define CSEX_EQUALISER_12000_A1 -0.871912
+#define CSEX_EQUALISER_12000_A2 0.023232
+#define CSEX_EQUALISER_12000_B1 -0.745857
+#define CSEX_EQUALISER_12000_B2 -0.189171
+#define CSEX_EQUALISER_12000_SCALE 14
+
+/* Equaliser coefficients for 16000Hz sample rate, \
+ CS scaled with 1.031378 and CSEX scaled with 0.770164 */
+#define CS_EQUALISER_16000_A0 1.281629
+#define CS_EQUALISER_16000_A1 -1.075872
+#define CS_EQUALISER_16000_A2 -0.041365
+#define CS_EQUALISER_16000_B1 -0.725239
+#define CS_EQUALISER_16000_B2 -0.224358
+#define CS_EQUALISER_16000_SCALE 14
+#define CSEX_EQUALISER_16000_A0 1.081091
+#define CSEX_EQUALISER_16000_A1 -0.867183
+#define CSEX_EQUALISER_16000_A2 -0.070247
+#define CSEX_EQUALISER_16000_B1 -0.515121
+#define CSEX_EQUALISER_16000_B2 -0.425893
+#define CSEX_EQUALISER_16000_SCALE 14
+
+/* Equaliser coefficients for 22050Hz sample rate, \
+ CS scaled with 1.041576 and CSEX scaled with 0.777779 */
+#define CS_EQUALISER_22050_A0 1.388605
+#define CS_EQUALISER_22050_A1 -1.305799
+#define CS_EQUALISER_22050_A2 0.039922
+#define CS_EQUALISER_22050_B1 -0.719494
+#define CS_EQUALISER_22050_B2 -0.243245
+#define CS_EQUALISER_22050_SCALE 14
+#define CSEX_EQUALISER_22050_A0 1.272910
+#define CSEX_EQUALISER_22050_A1 -1.341014
+#define CSEX_EQUALISER_22050_A2 0.167462
+#define CSEX_EQUALISER_22050_B1 -0.614219
+#define CSEX_EQUALISER_22050_B2 -0.345384
+#define CSEX_EQUALISER_22050_SCALE 14
+
+/* Equaliser coefficients for 24000Hz sample rate, \
+ CS scaled with 1.034495 and CSEX scaled with 0.772491 */
+#define CS_EQUALISER_24000_A0 1.409832
+#define CS_EQUALISER_24000_A1 -1.456506
+#define CS_EQUALISER_24000_A2 0.151410
+#define CS_EQUALISER_24000_B1 -0.804201
+#define CS_EQUALISER_24000_B2 -0.163783
+#define CS_EQUALISER_24000_SCALE 14
+#define CSEX_EQUALISER_24000_A0 1.299198
+#define CSEX_EQUALISER_24000_A1 -1.452447
+#define CSEX_EQUALISER_24000_A2 0.240489
+#define CSEX_EQUALISER_24000_B1 -0.669303
+#define CSEX_EQUALISER_24000_B2 -0.294984
+#define CSEX_EQUALISER_24000_SCALE 14
+
+/* Equaliser coefficients for 32000Hz sample rate, \
+ CS scaled with 1.044559 and CSEX scaled with 0.780006 */
+#define CS_EQUALISER_32000_A0 1.560988
+#define CS_EQUALISER_32000_A1 -1.877724
+#define CS_EQUALISER_32000_A2 0.389741
+#define CS_EQUALISER_32000_B1 -0.907410
+#define CS_EQUALISER_32000_B2 -0.070489
+#define CS_EQUALISER_32000_SCALE 14
+#define CSEX_EQUALISER_32000_A0 1.785049
+#define CSEX_EQUALISER_32000_A1 -2.233497
+#define CSEX_EQUALISER_32000_A2 0.526431
+#define CSEX_EQUALISER_32000_B1 -0.445939
+#define CSEX_EQUALISER_32000_B2 -0.522446
+#define CSEX_EQUALISER_32000_SCALE 13
+
+/* Equaliser coefficients for 44100Hz sample rate, \
+ CS scaled with 1.022170 and CSEX scaled with 0.763288 */
+#define CS_EQUALISER_44100_A0 1.623993
+#define CS_EQUALISER_44100_A1 -2.270743
+#define CS_EQUALISER_44100_A2 0.688829
+#define CS_EQUALISER_44100_B1 -1.117190
+#define CS_EQUALISER_44100_B2 0.130208
+#define CS_EQUALISER_44100_SCALE 13
+#define CSEX_EQUALISER_44100_A0 2.028315
+#define CSEX_EQUALISER_44100_A1 -2.882459
+#define CSEX_EQUALISER_44100_A2 0.904535
+#define CSEX_EQUALISER_44100_B1 -0.593308
+#define CSEX_EQUALISER_44100_B2 -0.385816
+#define CSEX_EQUALISER_44100_SCALE 13
+
+/* Equaliser coefficients for 48000Hz sample rate, \
+ CS scaled with 1.018635 and CSEX scaled with 0.760648 */
+#define CS_EQUALISER_48000_A0 1.641177
+#define CS_EQUALISER_48000_A1 -2.364687
+#define CS_EQUALISER_48000_A2 0.759910
+#define CS_EQUALISER_48000_B1 -1.166774
+#define CS_EQUALISER_48000_B2 0.178074
+#define CS_EQUALISER_48000_SCALE 13
+#define CSEX_EQUALISER_48000_A0 2.099655
+#define CSEX_EQUALISER_48000_A1 -3.065220
+#define CSEX_EQUALISER_48000_A2 1.010417
+#define CSEX_EQUALISER_48000_B1 -0.634021
+#define CSEX_EQUALISER_48000_B2 -0.347332
+#define CSEX_EQUALISER_48000_SCALE 13
+
+
+#ifdef HIGHER_FS
+#define CS_EQUALISER_96000_A0 1.784497
+#define CS_EQUALISER_96000_A1 -3.001435
+#define CS_EQUALISER_96000_A2 1.228422
+#define CS_EQUALISER_96000_B1 -1.477804
+#define CS_EQUALISER_96000_B2 0.481369
+#define CS_EQUALISER_96000_SCALE 13
+#define CSEX_EQUALISER_96000_A0 2.7573
+#define CSEX_EQUALISER_96000_A1 -4.6721
+#define CSEX_EQUALISER_96000_A2 1.9317
+#define CSEX_EQUALISER_96000_B1 -0.971718
+#define CSEX_EQUALISER_96000_B2 -0.021216
+#define CSEX_EQUALISER_96000_SCALE 13
+
+#define CS_EQUALISER_192000_A0 1.889582
+#define CS_EQUALISER_192000_A1 -3.456140
+#define CS_EQUALISER_192000_A2 1.569864
+#define CS_EQUALISER_192000_B1 -1.700798
+#define CS_EQUALISER_192000_B2 0.701824
+#define CS_EQUALISER_192000_SCALE 13
+#define CSEX_EQUALISER_192000_A0 3.4273
+#define CSEX_EQUALISER_192000_A1 -6.2936
+#define CSEX_EQUALISER_192000_A2 2.8720
+#define CSEX_EQUALISER_192000_B1 -1.31074
+#define CSEX_EQUALISER_192000_B2 0.31312
+#define CSEX_EQUALISER_192000_SCALE 13
+#endif
+
+
+#define LVCS_HEADPHONE_SHIFT 2 /* Output Shift */
+#define LVCS_HEADPHONE_SHIFTLOSS 0.8477735 /* Output Shift loss */
+#define LVCS_HEADPHONE_GAIN 0.2087465 /* Unprocessed path gain */
+#define LVCS_EX_HEADPHONE_SHIFT 3 /* EX Output Shift */
+#define LVCS_EX_HEADPHONE_SHIFTLOSS 0.569225 /* EX Output Shift loss */
+#define LVCS_EX_HEADPHONE_GAIN 0.07794425 /* EX Unprocessed path gain */
+#else
/* Stereo Enhancer coefficients for 8000 Hz sample rate, scaled with 0.161258 */
#define CS_MIDDLE_8000_A0 7462 /* Floating point value 0.227720 */
#define CS_MIDDLE_8000_A1 (-7049) /* Floating point value -0.215125 */
@@ -394,5 +850,6 @@
#define LVCS_EX_HEADPHONE_SHIFT 3 /* EX Output Shift */
#define LVCS_EX_HEADPHONE_SHIFTLOSS 18600 /* EX Output Shift loss */
#define LVCS_EX_HEADPHONE_GAIN 5108 /* EX Unprocessed path gain */
-
#endif
+#endif
+
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.c
index 1904e46..d4c7627 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.c
@@ -98,7 +98,13 @@
/*
* Scratch memory
*/
+#ifdef BUILD_FLOAT
+ /* Inplace processing */
+ ScratchSize = (LVM_UINT32) \
+ (LVCS_SCRATCHBUFFERS * sizeof(LVM_FLOAT) * pCapabilities->MaxBlockSize);
+#else
ScratchSize = (LVM_UINT32)(LVCS_SCRATCHBUFFERS*sizeof(LVM_INT16)*pCapabilities->MaxBlockSize); /* Inplace processing */
+#endif
pMemoryTable->Region[LVCS_MEMREGION_TEMPORARY_FAST].Size = ScratchSize;
pMemoryTable->Region[LVCS_MEMREGION_TEMPORARY_FAST].Type = LVCS_SCRATCH;
pMemoryTable->Region[LVCS_MEMREGION_TEMPORARY_FAST].pBaseAddress = LVM_NULL;
@@ -190,6 +196,7 @@
pLVCS_VolCorrectTable = (LVCS_VolCorrect_t*)&LVCS_VolCorrectTable[0];
pInstance->VolCorrect = pLVCS_VolCorrectTable[0];
pInstance->TransitionGain = 0;
+
/* These current and target values are intialized again in LVCS_Control.c */
LVC_Mixer_Init(&pInstance->BypassMix.Mixer_Instance.MixerStream[0],0,0);
/* These current and target values are intialized again in LVCS_Control.c */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Private.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Private.h
index f3adb8d..a97e4f0 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Private.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Private.h
@@ -95,10 +95,17 @@
/* Volume correction structure */
typedef struct
{
+#ifdef BUILD_FLOAT
+ LVM_FLOAT CompFull; /* Post CS compression 100% effect */
+ LVM_FLOAT CompMin; /* Post CS compression 0% effect */
+ LVM_FLOAT GainFull; /* CS gain correct 100% effect */
+ LVM_FLOAT GainMin; /* CS gain correct 0% effect */
+#else
LVM_INT16 CompFull; /* Post CS compression 100% effect */
LVM_INT16 CompMin; /* Post CS compression 0% effect */
LVM_INT16 GainFull; /* CS gain correct 100% effect */
LVM_INT16 GainMin; /* CS gain correct 0% effect */
+#endif
} LVCS_VolCorrect_t;
/* Instance structure */
@@ -112,8 +119,13 @@
/* Private parameters */
LVCS_OutputDevice_en OutputDevice; /* Selected output device type */
LVCS_VolCorrect_t VolCorrect; /* Volume correction settings */
+#ifndef BUILD_FLOAT
LVM_INT16 TransitionGain; /* Transition gain */
LVM_INT16 CompressGain; /* Last used compressor gain*/
+#else
+ LVM_FLOAT TransitionGain; /* Transition gain */
+ LVM_FLOAT CompressGain; /* Last used compressor gain*/
+#endif
/* Sub-block configurations */
LVCS_StereoEnhancer_t StereoEnhancer; /* Stereo enhancer configuration */
@@ -134,24 +146,35 @@
/* Coefficient Structure */
typedef struct
{
+#ifdef BUILD_FLOAT
+ Biquad_FLOAT_Instance_t EqualiserBiquadInstance;
+ Biquad_FLOAT_Instance_t ReverbBiquadInstance;
+ Biquad_FLOAT_Instance_t SEBiquadInstanceMid;
+ Biquad_FLOAT_Instance_t SEBiquadInstanceSide;
+#else
Biquad_Instance_t EqualiserBiquadInstance;
Biquad_Instance_t ReverbBiquadInstance;
Biquad_Instance_t SEBiquadInstanceMid;
Biquad_Instance_t SEBiquadInstanceSide;
-
+#endif
} LVCS_Coefficient_t;
/* Data Structure */
typedef struct
{
+#ifdef BUILD_FLOAT
+ Biquad_2I_Order2_FLOAT_Taps_t EqualiserBiquadTaps;
+ Biquad_2I_Order2_FLOAT_Taps_t ReverbBiquadTaps;
+ Biquad_1I_Order1_FLOAT_Taps_t SEBiquadTapsMid;
+ Biquad_1I_Order2_FLOAT_Taps_t SEBiquadTapsSide;
+#else
Biquad_2I_Order2_Taps_t EqualiserBiquadTaps;
Biquad_2I_Order2_Taps_t ReverbBiquadTaps;
Biquad_1I_Order1_Taps_t SEBiquadTapsMid;
Biquad_1I_Order2_Taps_t SEBiquadTapsSide;
-
+#endif
} LVCS_Data_t;
-
void LVCS_TimerCallBack ( void* hInstance,
void* pCallBackParams,
LVM_INT32 CallbackParam);
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Process.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Process.c
index 5d99461..3956d4d 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Process.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Process.c
@@ -66,7 +66,77 @@
/* NOTES: */
/* */
/************************************************************************************/
+#ifdef BUILD_FLOAT
+LVCS_ReturnStatus_en LVCS_Process_CS(LVCS_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 NumSamples)
+{
+ const LVM_FLOAT *pInput;
+ LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
+ LVM_FLOAT *pScratch;
+ LVCS_ReturnStatus_en err;
+ pScratch = (LVM_FLOAT *) \
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_TEMPORARY_FAST].pBaseAddress;
+
+ /*
+ * Check if the processing is inplace
+ */
+ if (pInData == pOutData)
+ {
+ /* Processing inplace */
+ pInput = pScratch + (2 * NumSamples);
+ Copy_Float((LVM_FLOAT *)pInData, /* Source */
+ (LVM_FLOAT *)pInput, /* Destination */
+ (LVM_INT16)(2 * NumSamples)); /* Left and right */
+ }
+ else
+ {
+ /* Processing outplace */
+ pInput = pInData;
+ }
+
+ /*
+ * Call the stereo enhancer
+ */
+ err = LVCS_StereoEnhancer(hInstance, /* Instance handle */
+ pInData, /* Pointer to the input data */
+ pOutData, /* Pointer to the output data */
+ NumSamples); /* Number of samples to process */
+
+ /*
+ * Call the reverb generator
+ */
+ err = LVCS_ReverbGenerator(hInstance, /* Instance handle */
+ pOutData, /* Pointer to the input data */
+ pOutData, /* Pointer to the output data */
+ NumSamples); /* Number of samples to process */
+
+ /*
+ * Call the equaliser
+ */
+ err = LVCS_Equaliser(hInstance, /* Instance handle */
+ pOutData, /* Pointer to the input data */
+ NumSamples); /* Number of samples to process */
+
+ /*
+ * Call the bypass mixer
+ */
+ err = LVCS_BypassMixer(hInstance, /* Instance handle */
+ pOutData, /* Pointer to the processed data */
+ pInput, /* Pointer to the input (unprocessed) data */
+ pOutData, /* Pointer to the output data */
+ NumSamples); /* Number of samples to process */
+
+ if(err != LVCS_SUCCESS)
+ {
+ return err;
+ }
+
+ return(LVCS_SUCCESS);
+}
+#else
LVCS_ReturnStatus_en LVCS_Process_CS(LVCS_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 *pOutData,
@@ -133,7 +203,7 @@
return(LVCS_SUCCESS);
}
-
+#endif
/************************************************************************************/
/* */
/* FUNCTION: LVCS_Process */
@@ -160,7 +230,170 @@
/* NOTES: */
/* */
/************************************************************************************/
+#ifdef BUILD_FLOAT
+LVCS_ReturnStatus_en LVCS_Process(LVCS_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 NumSamples)
+{
+ LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
+ LVCS_ReturnStatus_en err;
+
+ /*
+ * Check the number of samples is not too large
+ */
+ if (NumSamples > pInstance->Capabilities.MaxBlockSize)
+ {
+ return(LVCS_TOOMANYSAMPLES);
+ }
+
+ /*
+ * Check if the algorithm is enabled
+ */
+ if (pInstance->Params.OperatingMode != LVCS_OFF)
+ {
+ /*
+ * Call CS process function
+ */
+ err = LVCS_Process_CS(hInstance,
+ pInData,
+ pOutData,
+ NumSamples);
+
+
+ /*
+ * Compress to reduce expansion effect of Concert Sound and correct volume
+ * differences for difference settings. Not applied in test modes
+ */
+ if ((pInstance->Params.OperatingMode == LVCS_ON)&& \
+ (pInstance->Params.CompressorMode == LVM_MODE_ON))
+ {
+ LVM_FLOAT Gain = pInstance->VolCorrect.CompMin;
+ LVM_FLOAT Current1;
+
+ Current1 = LVC_Mixer_GetCurrent(&pInstance->BypassMix.Mixer_Instance.MixerStream[0]);
+ Gain = (LVM_FLOAT)( pInstance->VolCorrect.CompMin
+ - (((LVM_FLOAT)pInstance->VolCorrect.CompMin * (Current1)))
+ + (((LVM_FLOAT)pInstance->VolCorrect.CompFull * (Current1))));
+
+ if(NumSamples < LVCS_COMPGAINFRAME)
+ {
+ NonLinComp_Float(Gain, /* Compressor gain setting */
+ pOutData,
+ pOutData,
+ (LVM_INT32)(2 * NumSamples));
+ }
+ else
+ {
+ LVM_FLOAT GainStep;
+ LVM_FLOAT FinalGain;
+ LVM_INT16 SampleToProcess = NumSamples;
+ LVM_FLOAT *pOutPtr;
+
+ /* Large changes in Gain can cause clicks in output
+ Split data into small blocks and use interpolated gain values */
+
+ GainStep = (LVM_FLOAT)(((Gain-pInstance->CompressGain) * \
+ LVCS_COMPGAINFRAME) / NumSamples);
+
+ if((GainStep == 0) && (pInstance->CompressGain < Gain))
+ {
+ GainStep = 1;
+ }
+ else
+ {
+ if((GainStep == 0) && (pInstance->CompressGain > Gain))
+ {
+ GainStep = -1;
+ }
+ }
+
+ FinalGain = Gain;
+ Gain = pInstance->CompressGain;
+ pOutPtr = pOutData;
+
+ while(SampleToProcess > 0)
+ {
+ Gain = (LVM_FLOAT)(Gain + GainStep);
+ if((GainStep > 0) && (FinalGain <= Gain))
+ {
+ Gain = FinalGain;
+ GainStep = 0;
+ }
+
+ if((GainStep < 0) && (FinalGain > Gain))
+ {
+ Gain = FinalGain;
+ GainStep = 0;
+ }
+
+ if(SampleToProcess > LVCS_COMPGAINFRAME)
+ {
+ NonLinComp_Float(Gain, /* Compressor gain setting */
+ pOutPtr,
+ pOutPtr,
+ (LVM_INT32)(2 * LVCS_COMPGAINFRAME));
+ pOutPtr += (2 * LVCS_COMPGAINFRAME);
+ SampleToProcess = (LVM_INT16)(SampleToProcess - LVCS_COMPGAINFRAME);
+ }
+ else
+ {
+ NonLinComp_Float(Gain, /* Compressor gain setting */
+ pOutPtr,
+ pOutPtr,
+ (LVM_INT32)(2 * SampleToProcess));
+ SampleToProcess = 0;
+ }
+
+ }
+ }
+
+ /* Store gain value*/
+ pInstance->CompressGain = Gain;
+ }
+
+
+ if(pInstance->bInOperatingModeTransition == LVM_TRUE){
+
+ /*
+ * Re-init bypass mix when timer has completed
+ */
+ if ((pInstance->bTimerDone == LVM_TRUE) &&
+ (pInstance->BypassMix.Mixer_Instance.MixerStream[1].CallbackSet == 0))
+ {
+ err = LVCS_BypassMixInit(hInstance,
+ &pInstance->Params);
+
+ if(err != LVCS_SUCCESS)
+ {
+ return err;
+ }
+
+ }
+ else{
+ LVM_Timer ( &pInstance->TimerInstance,
+ (LVM_INT16)NumSamples);
+ }
+ }
+ }
+ else
+ {
+ if (pInData != pOutData)
+ {
+ /*
+ * The algorithm is disabled so just copy the data
+ */
+ Copy_Float((LVM_FLOAT *)pInData, /* Source */
+ (LVM_FLOAT *)pOutData, /* Destination */
+ (LVM_INT16)(2 * NumSamples)); /* Left and right */
+ }
+ }
+
+
+ return(LVCS_SUCCESS);
+}
+#else
LVCS_ReturnStatus_en LVCS_Process(LVCS_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 *pOutData,
@@ -321,13 +554,4 @@
return(LVCS_SUCCESS);
}
-
-
-
-
-
-
-
-
-
-
+#endif
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.c
index ee257b8..1085101 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.c
@@ -57,7 +57,98 @@
/* 2. The numerator coefficients of the filter are negated to cause an inversion. */
/* */
/************************************************************************************/
+#ifdef BUILD_FLOAT
+LVCS_ReturnStatus_en LVCS_ReverbGeneratorInit(LVCS_Handle_t hInstance,
+ LVCS_Params_t *pParams)
+{
+ LVM_UINT16 Delay;
+ LVM_UINT16 Offset;
+ LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
+ LVCS_ReverbGenerator_t *pConfig = (LVCS_ReverbGenerator_t *)&pInstance->Reverberation;
+ LVCS_Data_t *pData;
+ LVCS_Coefficient_t *pCoefficients;
+ BQ_FLOAT_Coefs_t Coeffs;
+ const BiquadA012B12CoefsSP_t *pReverbCoefTable;
+
+
+ pData = (LVCS_Data_t *) \
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_DATA].pBaseAddress;
+
+ pCoefficients = (LVCS_Coefficient_t *) \
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
+
+ /*
+ * Initialise the delay and filters if:
+ * - the sample rate has changed
+ * - the speaker type has changed to or from the mobile speaker
+ */
+ if(pInstance->Params.SampleRate != pParams->SampleRate ) /* Sample rate change test */
+
+ {
+ /*
+ * Setup the delay
+ */
+ Delay = (LVM_UINT16)LVCS_StereoDelayCS[(LVM_UINT16)pParams->SampleRate];
+
+
+ pConfig->DelaySize = (LVM_INT16)(2 * Delay);
+ pConfig->DelayOffset = 0;
+ LoadConst_Float(0, /* Value */
+ (LVM_FLOAT *)&pConfig->StereoSamples[0], /* Destination */
+ /* Number of words */
+ (LVM_UINT16)(sizeof(pConfig->StereoSamples) / sizeof(LVM_FLOAT)));
+ /*
+ * Setup the filters
+ */
+ Offset = (LVM_UINT16)pParams->SampleRate;
+ pReverbCoefTable = (BiquadA012B12CoefsSP_t*)&LVCS_ReverbCoefTable[0];
+
+ /* Convert incoming coefficients to the required format/ordering */
+ Coeffs.A0 = (LVM_FLOAT)pReverbCoefTable[Offset].A0;
+ Coeffs.A1 = (LVM_FLOAT)pReverbCoefTable[Offset].A1;
+ Coeffs.A2 = (LVM_FLOAT)pReverbCoefTable[Offset].A2;
+ Coeffs.B1 = (LVM_FLOAT)-pReverbCoefTable[Offset].B1;
+ Coeffs.B2 = (LVM_FLOAT)-pReverbCoefTable[Offset].B2;
+
+ LoadConst_Float(0, /* Value */
+ (void *)&pData->ReverbBiquadTaps, /* Destination Cast to void:
+ no dereferencing in function*/
+ /* Number of words */
+ (LVM_UINT16)(sizeof(pData->ReverbBiquadTaps) / sizeof(LVM_FLOAT)));
+
+ BQ_2I_D16F16Css_TRC_WRA_01_Init(&pCoefficients->ReverbBiquadInstance,
+ &pData->ReverbBiquadTaps,
+ &Coeffs);
+
+ /* Callbacks */
+ switch(pReverbCoefTable[Offset].Scale)
+ {
+ case 14:
+ pConfig->pBiquadCallBack = BQ_2I_D16F16C14_TRC_WRA_01;
+ break;
+ case 15:
+ pConfig->pBiquadCallBack = BQ_2I_D16F16C15_TRC_WRA_01;
+ break;
+ }
+
+
+ /*
+ * Setup the mixer
+ */
+ pConfig->ProcGain = (LVM_UINT16)(HEADPHONEGAINPROC);
+ pConfig->UnprocGain = (LVM_UINT16)(HEADPHONEGAINUNPROC);
+ }
+
+ if(pInstance->Params.ReverbLevel != pParams->ReverbLevel)
+ {
+ LVM_INT32 ReverbPercentage = 83886; // 1 Percent Reverb i.e 1/100 in Q 23 format
+ ReverbPercentage *= pParams->ReverbLevel; // Actual Reverb Level in Q 23 format
+ pConfig->ReverbLevel = ((LVM_FLOAT)(ReverbPercentage>>8)) / 32767.0f;
+ }
+ return(LVCS_SUCCESS);
+}
+#else
LVCS_ReturnStatus_en LVCS_ReverbGeneratorInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams)
{
@@ -140,7 +231,7 @@
return(LVCS_SUCCESS);
}
-
+#endif
/************************************************************************************/
/* */
/* FUNCTION: LVCS_Reverb */
@@ -179,7 +270,91 @@
/* 2. The Gain is combined with the LPF and incorporated in to the coefficients */
/* */
/************************************************************************************/
+#ifdef BUILD_FLOAT
+LVCS_ReturnStatus_en LVCS_ReverbGenerator(LVCS_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 NumSamples)
+{
+ LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
+ LVCS_ReverbGenerator_t *pConfig = (LVCS_ReverbGenerator_t *)&pInstance->Reverberation;
+ LVCS_Coefficient_t *pCoefficients;
+ LVM_FLOAT *pScratch;
+
+ pCoefficients = (LVCS_Coefficient_t *)\
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
+
+ pScratch = (LVM_FLOAT *)\
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_TEMPORARY_FAST].pBaseAddress;
+
+ /*
+ * Copy the data to the output in outplace processing
+ */
+ if (pInData != pOutData)
+ {
+ /*
+ * Reverb not required so just copy the data
+ */
+ Copy_Float((LVM_FLOAT *)pInData, /* Source */
+ (LVM_FLOAT *)pOutData, /* Destination */
+ (LVM_INT16)(2 * NumSamples)); /* Left and right */
+ }
+
+
+ /*
+ * Check if the reverb is required
+ */
+ /* Disable when CS4MS in stereo mode */
+ if (((pInstance->Params.SpeakerType == LVCS_HEADPHONE) || \
+ (pInstance->Params.SpeakerType == LVCS_EX_HEADPHONES) ||
+ (pInstance->Params.SourceFormat != LVCS_STEREO)) &&
+ /* For validation testing */
+ ((pInstance->Params.OperatingMode & LVCS_REVERBSWITCH) !=0))
+ {
+ /********************************************************************************/
+ /* */
+ /* Copy the input data to scratch memory and filter it */
+ /* */
+ /********************************************************************************/
+
+ /*
+ * Copy the input data to the scratch memory
+ */
+ Copy_Float((LVM_FLOAT *)pInData, /* Source */
+ (LVM_FLOAT *)pScratch, /* Destination */
+ (LVM_INT16)(2 * NumSamples)); /* Left and right */
+
+ /*
+ * Filter the data
+ */
+ (pConfig->pBiquadCallBack)((Biquad_FLOAT_Instance_t*)&pCoefficients->ReverbBiquadInstance,
+ (LVM_FLOAT *)pScratch,
+ (LVM_FLOAT *)pScratch,
+ (LVM_INT16)NumSamples);
+
+ Mult3s_Float( (LVM_FLOAT *)pScratch,
+ pConfig->ReverbLevel,
+ (LVM_FLOAT *)pScratch,
+ (LVM_INT16)(2 * NumSamples));
+
+
+ /*
+ * Apply the delay mix
+ */
+ DelayMix_Float((LVM_FLOAT *)pScratch,
+ &pConfig->StereoSamples[0],
+ pConfig->DelaySize,
+ pOutData,
+ &pConfig->DelayOffset,
+ (LVM_INT16)NumSamples);
+
+
+ }
+
+ return(LVCS_SUCCESS);
+}
+#else
LVCS_ReturnStatus_en LVCS_ReverbGenerator(LVCS_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 *pOutData,
@@ -257,8 +432,4 @@
return(LVCS_SUCCESS);
}
-
-
-
-
-
+#endif
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.h
index 6e026ff..69892b6 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.h
@@ -58,14 +58,20 @@
LVM_INT16 DelayOffset;
LVM_INT16 ProcGain;
LVM_INT16 UnprocGain;
+#ifndef BUILD_FLOAT
LVM_INT16 StereoSamples[2*LVCS_STEREODELAY_CS_48KHZ];
-
/* Reverb Level */
LVM_INT16 ReverbLevel;
-
/* Filter */
void (*pBiquadCallBack) (Biquad_Instance_t*, LVM_INT16*, LVM_INT16*, LVM_INT16);
-
+#else
+ LVM_FLOAT StereoSamples[2 * LVCS_STEREODELAY_CS_48KHZ];
+ /* Reverb Level */
+ LVM_FLOAT ReverbLevel;
+ /* Filter */
+ void (*pBiquadCallBack) (Biquad_FLOAT_Instance_t*,
+ LVM_FLOAT*, LVM_FLOAT*, LVM_INT16);
+#endif
} LVCS_ReverbGenerator_t;
@@ -77,12 +83,17 @@
LVCS_ReturnStatus_en LVCS_ReverbGeneratorInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams);
-
+#ifdef BUILD_FLOAT
+LVCS_ReturnStatus_en LVCS_ReverbGenerator(LVCS_Handle_t hInstance,
+ const LVM_FLOAT *pInput,
+ LVM_FLOAT *pOutput,
+ LVM_UINT16 NumSamples);
+#else
LVCS_ReturnStatus_en LVCS_ReverbGenerator(LVCS_Handle_t hInstance,
const LVM_INT16 *pInput,
LVM_INT16 *pOutput,
LVM_UINT16 NumSamples);
-
+#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.c
index b9b8b05..2992c35 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.c
@@ -49,7 +49,103 @@
/* NOTES: */
/* */
/************************************************************************************/
+#ifdef BUILD_FLOAT
+LVCS_ReturnStatus_en LVCS_SEnhancerInit(LVCS_Handle_t hInstance,
+ LVCS_Params_t *pParams)
+{
+ LVM_UINT16 Offset;
+ LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
+ LVCS_StereoEnhancer_t *pConfig = (LVCS_StereoEnhancer_t *)&pInstance->StereoEnhancer;
+ LVCS_Data_t *pData;
+ LVCS_Coefficient_t *pCoefficient;
+ FO_FLOAT_Coefs_t CoeffsMid;
+ BQ_FLOAT_Coefs_t CoeffsSide;
+ const BiquadA012B12CoefsSP_t *pSESideCoefs;
+
+
+ pData = (LVCS_Data_t *) \
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_DATA].pBaseAddress;
+
+ pCoefficient = (LVCS_Coefficient_t *) \
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
+
+ /*
+ * If the sample rate or speaker type has changed update the filters
+ */
+ if ((pInstance->Params.SampleRate != pParams->SampleRate) ||
+ (pInstance->Params.SpeakerType != pParams->SpeakerType))
+ {
+ /*
+ * Set the filter coefficients based on the sample rate
+ */
+ /* Mid filter */
+ Offset = (LVM_UINT16)pParams->SampleRate;
+
+ /* Convert incoming coefficients to the required format/ordering */
+ CoeffsMid.A0 = (LVM_FLOAT) LVCS_SEMidCoefTable[Offset].A0;
+ CoeffsMid.A1 = (LVM_FLOAT) LVCS_SEMidCoefTable[Offset].A1;
+ CoeffsMid.B1 = (LVM_FLOAT)-LVCS_SEMidCoefTable[Offset].B1;
+
+ /* Clear the taps */
+ LoadConst_Float(0, /* Value */
+ (void *)&pData->SEBiquadTapsMid, /* Destination Cast to void:\
+ no dereferencing in function*/
+ /* Number of words */
+ (LVM_UINT16)(sizeof(pData->SEBiquadTapsMid) / sizeof(LVM_FLOAT)));
+
+ FO_1I_D16F16Css_TRC_WRA_01_Init(&pCoefficient->SEBiquadInstanceMid,
+ &pData->SEBiquadTapsMid,
+ &CoeffsMid);
+
+ /* Callbacks */
+ if(LVCS_SEMidCoefTable[Offset].Scale == 15)
+ {
+ pConfig->pBiquadCallBack_Mid = FO_1I_D16F16C15_TRC_WRA_01;
+ }
+
+ Offset = (LVM_UINT16)(pParams->SampleRate);
+ pSESideCoefs = (BiquadA012B12CoefsSP_t*)&LVCS_SESideCoefTable[0];
+
+ /* Side filter */
+ /* Convert incoming coefficients to the required format/ordering */
+ CoeffsSide.A0 = (LVM_FLOAT) pSESideCoefs[Offset].A0;
+ CoeffsSide.A1 = (LVM_FLOAT) pSESideCoefs[Offset].A1;
+ CoeffsSide.A2 = (LVM_FLOAT) pSESideCoefs[Offset].A2;
+ CoeffsSide.B1 = (LVM_FLOAT)-pSESideCoefs[Offset].B1;
+ CoeffsSide.B2 = (LVM_FLOAT)-pSESideCoefs[Offset].B2;
+
+ /* Clear the taps */
+ LoadConst_Float(0, /* Value */
+ (void *)&pData->SEBiquadTapsSide, /* Destination Cast to void:\
+ no dereferencing in function*/
+ /* Number of words */
+ (LVM_UINT16)(sizeof(pData->SEBiquadTapsSide) / sizeof(LVM_FLOAT)));
+ /* Callbacks */
+ switch(pSESideCoefs[Offset].Scale)
+ {
+ case 14:
+ BQ_1I_D16F32Css_TRC_WRA_01_Init(&pCoefficient->SEBiquadInstanceSide,
+ &pData->SEBiquadTapsSide,
+ &CoeffsSide);
+
+ pConfig->pBiquadCallBack_Side = BQ_1I_D16F32C14_TRC_WRA_01;
+ break;
+ case 15:
+ BQ_1I_D16F16Css_TRC_WRA_01_Init(&pCoefficient->SEBiquadInstanceSide,
+ &pData->SEBiquadTapsSide,
+ &CoeffsSide);
+
+ pConfig->pBiquadCallBack_Side = BQ_1I_D16F16C15_TRC_WRA_01;
+ break;
+ }
+
+ }
+
+
+ return(LVCS_SUCCESS);
+}
+#else
LVCS_ReturnStatus_en LVCS_SEnhancerInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams)
{
@@ -138,7 +234,7 @@
return(LVCS_SUCCESS);
}
-
+#endif
/************************************************************************************/
/* */
/* FUNCTION: LVCS_StereoEnhance */
@@ -177,7 +273,90 @@
/* 1. The side filter is not used in Mobile Speaker mode */
/* */
/************************************************************************************/
+#ifdef BUILD_FLOAT
+LVCS_ReturnStatus_en LVCS_StereoEnhancer(LVCS_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 NumSamples)
+{
+ LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
+ LVCS_StereoEnhancer_t *pConfig = (LVCS_StereoEnhancer_t *)&pInstance->StereoEnhancer;
+ LVCS_Coefficient_t *pCoefficient;
+ LVM_FLOAT *pScratch;
+
+ pCoefficient = (LVCS_Coefficient_t *) \
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
+
+ pScratch = (LVM_FLOAT *) \
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_TEMPORARY_FAST].pBaseAddress;
+ /*
+ * Check if the Stereo Enhancer is enabled
+ */
+ if ((pInstance->Params.OperatingMode & LVCS_STEREOENHANCESWITCH) != 0)
+ {
+ /*
+ * Convert from stereo to middle and side
+ */
+ From2iToMS_Float(pInData,
+ pScratch,
+ pScratch + NumSamples,
+ (LVM_INT16)NumSamples);
+
+ /*
+ * Apply filter to the middle signal
+ */
+ if (pInstance->OutputDevice == LVCS_HEADPHONE)
+ {
+ (pConfig->pBiquadCallBack_Mid)((Biquad_FLOAT_Instance_t*)\
+ &pCoefficient->SEBiquadInstanceMid,
+ (LVM_FLOAT *)pScratch,
+ (LVM_FLOAT *)pScratch,
+ (LVM_INT16)NumSamples);
+ }
+ else
+ {
+ Mult3s_Float(pScratch, /* Source */
+ (LVM_FLOAT)pConfig->MidGain, /* Gain */
+ pScratch, /* Destination */
+ (LVM_INT16)NumSamples); /* Number of samples */
+ }
+
+ /*
+ * Apply the filter the side signal only in stereo mode for headphones
+ * and in all modes for mobile speakers
+ */
+ if (pInstance->Params.SourceFormat == LVCS_STEREO)
+ {
+ (pConfig->pBiquadCallBack_Side)((Biquad_FLOAT_Instance_t*) \
+ &pCoefficient->SEBiquadInstanceSide,
+ (LVM_FLOAT *)(pScratch + NumSamples),
+ (LVM_FLOAT *)(pScratch + NumSamples),
+ (LVM_INT16)NumSamples);
+ }
+
+ /*
+ * Convert from middle and side to stereo
+ */
+ MSTo2i_Sat_Float(pScratch,
+ pScratch + NumSamples,
+ pOutData,
+ (LVM_INT16)NumSamples);
+
+ }
+ else
+ {
+ /*
+ * The stereo enhancer is disabled so just copy the data
+ */
+ Copy_Float((LVM_FLOAT *)pInData, /* Source */
+ (LVM_FLOAT *)pOutData, /* Destination */
+ (LVM_INT16)(2 * NumSamples)); /* Left and right */
+ }
+
+ return(LVCS_SUCCESS);
+}
+#else
LVCS_ReturnStatus_en LVCS_StereoEnhancer(LVCS_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 *pOutData,
@@ -254,7 +433,4 @@
return(LVCS_SUCCESS);
}
-
-
-
-
+#endif
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.h
index 15bc407..4125f24 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.h
@@ -43,18 +43,31 @@
/* Stereo enhancer structure */
typedef struct
{
+
+#ifndef BUILD_FLOAT
/*
* Middle filter
*/
void (*pBiquadCallBack_Mid)(Biquad_Instance_t*, LVM_INT16*, LVM_INT16*, LVM_INT16);
-
/*
* Side filter
*/
void (*pBiquadCallBack_Side)(Biquad_Instance_t*, LVM_INT16*, LVM_INT16*, LVM_INT16);
+ LVM_UINT16 MidGain; /* Middle gain in mobile speaker mode */
+#else
+ /*
+ * Middle filter
+ */
+ void (*pBiquadCallBack_Mid)(Biquad_FLOAT_Instance_t*,
+ LVM_FLOAT*, LVM_FLOAT*, LVM_INT16);
- LVM_UINT16 MidGain; /* Middle gain in mobile speaker mode */
-
+ /*
+ * Side filter
+ */
+ void (*pBiquadCallBack_Side)(Biquad_FLOAT_Instance_t*,
+ LVM_FLOAT*, LVM_FLOAT*, LVM_INT16);
+ LVM_FLOAT MidGain; /* Middle gain in mobile speaker mode */
+#endif
} LVCS_StereoEnhancer_t;
@@ -67,12 +80,17 @@
LVCS_ReturnStatus_en LVCS_SEnhancerInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams);
+#ifndef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_StereoEnhancer(LVCS_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 *pOutData,
LVM_UINT16 NumSamples);
-
-
+#else
+LVCS_ReturnStatus_en LVCS_StereoEnhancer(LVCS_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 NumSamples);
+#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.c
index 974de21..e154e29 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.c
@@ -71,7 +71,19 @@
{CS_MIDDLE_48000_A0, /* 48kS/s coefficients */
CS_MIDDLE_48000_A1,
CS_MIDDLE_48000_B1,
- (LVM_UINT16 )CS_MIDDLE_48000_SCALE}};
+ (LVM_UINT16 )CS_MIDDLE_48000_SCALE}
+#ifdef HIGHER_FS
+ ,
+ {CS_MIDDLE_96000_A0, /* 96kS/s coefficients */
+ CS_MIDDLE_96000_A1,
+ CS_MIDDLE_96000_B1,
+ (LVM_UINT16 )CS_MIDDLE_96000_SCALE},
+ {CS_MIDDLE_192000_A0, /* 192kS/s coefficients */
+ CS_MIDDLE_192000_A1,
+ CS_MIDDLE_192000_B1,
+ (LVM_UINT16 )CS_MIDDLE_192000_SCALE}
+#endif
+ };
/* Coefficient table for the side filter */
const BiquadA012B12CoefsSP_t LVCS_SESideCoefTable[] = {
@@ -130,6 +142,21 @@
CS_SIDE_48000_B1,
CS_SIDE_48000_B2,
(LVM_UINT16 )CS_SIDE_48000_SCALE}
+#ifdef HIGHER_FS
+ ,
+ {CS_SIDE_96000_A0, /* 96kS/s coefficients */
+ CS_SIDE_96000_A1,
+ CS_SIDE_96000_A2,
+ CS_SIDE_96000_B1,
+ CS_SIDE_96000_B2,
+ (LVM_UINT16 )CS_SIDE_96000_SCALE},
+ {CS_SIDE_192000_A0, /* 192kS/s coefficients */
+ CS_SIDE_192000_A1,
+ CS_SIDE_192000_A2,
+ CS_SIDE_192000_B1,
+ CS_SIDE_192000_B2,
+ (LVM_UINT16 )CS_SIDE_192000_SCALE}
+#endif
};
@@ -195,6 +222,20 @@
CS_EQUALISER_48000_B1,
CS_EQUALISER_48000_B2,
(LVM_UINT16 )CS_EQUALISER_48000_SCALE},
+#ifdef HIGHER_FS
+ {CS_EQUALISER_96000_A0, /* 96kS/s coefficients */
+ CS_EQUALISER_96000_A1,
+ CS_EQUALISER_96000_A2,
+ CS_EQUALISER_96000_B1,
+ CS_EQUALISER_96000_B2,
+ (LVM_UINT16 )CS_EQUALISER_96000_SCALE},
+ {CS_EQUALISER_192000_A0, /* 192kS/s coefficients */
+ CS_EQUALISER_192000_A1,
+ CS_EQUALISER_192000_A2,
+ CS_EQUALISER_192000_B1,
+ CS_EQUALISER_192000_B2,
+ (LVM_UINT16 )CS_EQUALISER_192000_SCALE},
+#endif
/* Concert Sound EX Headphone coefficients */
{CSEX_EQUALISER_8000_A0, /* 8kS/s coefficients */
@@ -251,6 +292,21 @@
CSEX_EQUALISER_48000_B1,
CSEX_EQUALISER_48000_B2,
(LVM_UINT16 )CSEX_EQUALISER_48000_SCALE}
+#ifdef HIGHER_FS
+ ,
+ {CSEX_EQUALISER_96000_A0, /* 96kS/s coefficients */
+ CSEX_EQUALISER_96000_A1,
+ CSEX_EQUALISER_96000_A2,
+ CSEX_EQUALISER_96000_B1,
+ CSEX_EQUALISER_96000_B2,
+ (LVM_UINT16 )CSEX_EQUALISER_96000_SCALE},
+ {CSEX_EQUALISER_192000_A0, /* 192kS/s coefficients */
+ CSEX_EQUALISER_192000_A1,
+ CSEX_EQUALISER_192000_A2,
+ CSEX_EQUALISER_192000_B1,
+ CSEX_EQUALISER_192000_B2,
+ (LVM_UINT16 )CSEX_EQUALISER_192000_SCALE}
+#endif
};
@@ -334,6 +390,21 @@
CS_REVERB_48000_B1,
CS_REVERB_48000_B2,
(LVM_UINT16 )CS_REVERB_48000_SCALE}
+#ifdef HIGHER_FS
+ ,
+ {CS_REVERB_96000_A0, /* 96kS/s coefficients */
+ CS_REVERB_96000_A1,
+ CS_REVERB_96000_A2,
+ CS_REVERB_96000_B1,
+ CS_REVERB_96000_B2,
+ (LVM_UINT16 )CS_REVERB_96000_SCALE},
+ {CS_REVERB_192000_A0, /* 192kS/s coefficients */
+ CS_REVERB_192000_A1,
+ CS_REVERB_192000_A2,
+ CS_REVERB_192000_B1,
+ CS_REVERB_192000_B2,
+ (LVM_UINT16 )CS_REVERB_192000_SCALE}
+#endif
};
@@ -385,6 +456,24 @@
/* */
/************************************************************************************/
const LVCS_VolCorrect_t LVCS_VolCorrectTable[] = {
+#ifdef BUILD_FLOAT
+ {0.433362f, /* Headphone, stereo mode */
+ 0.000000f,
+ 1.000024f,
+ 1.412640f},
+ {0.433362f, /* EX Headphone, stereo mode */
+ 0.000000f,
+ 1.000024f,
+ 1.412640f},
+ {1.000000f, /* Headphone, mono mode */
+ 0.000000f,
+ 1.000024f,
+ 1.412640f},
+ {1.000000f, /* EX Headphone, mono mode */
+ 0.000000f,
+ 1.000024f,
+ 1.412640f}
+#else
{14200, /* Headphone, stereo mode */
0,
4096,
@@ -401,6 +490,7 @@
0,
4096,
5786}
+#endif
};
/************************************************************************************/
@@ -418,8 +508,25 @@
#define LVCS_VOL_TC_Fs32000 32721 /* Floating point value 0.998565674 */
#define LVCS_VOL_TC_Fs44100 32734 /* Floating point value 0.998962402 */
#define LVCS_VOL_TC_Fs48000 32737 /* Floating point value 0.999053955 */
+#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
+#define LVCS_VOL_TC_Fs96000 32751 /* Floating point value 0.999511703 */ /* Todo @ need to re check this value*/
+#define LVCS_VOL_TC_Fs192000 32763 /* Floating point value 0.999877925 */ /* Todo @ need to re check this value*/
+#endif
-
+#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
+const LVM_INT16 LVCS_VolumeTCTable[11] = {LVCS_VOL_TC_Fs8000,
+ LVCS_VOL_TC_Fs11025,
+ LVCS_VOL_TC_Fs12000,
+ LVCS_VOL_TC_Fs16000,
+ LVCS_VOL_TC_Fs22050,
+ LVCS_VOL_TC_Fs24000,
+ LVCS_VOL_TC_Fs32000,
+ LVCS_VOL_TC_Fs44100,
+ LVCS_VOL_TC_Fs48000,
+ LVCS_VOL_TC_Fs96000,
+ LVCS_VOL_TC_Fs192000
+};
+#else
const LVM_INT16 LVCS_VolumeTCTable[9] = {LVCS_VOL_TC_Fs8000,
LVCS_VOL_TC_Fs11025,
LVCS_VOL_TC_Fs12000,
@@ -428,15 +535,30 @@
LVCS_VOL_TC_Fs24000,
LVCS_VOL_TC_Fs32000,
LVCS_VOL_TC_Fs44100,
- LVCS_VOL_TC_Fs48000};
+ LVCS_VOL_TC_Fs48000
+};
+#endif
/************************************************************************************/
/* */
/* Sample rate table */
/* */
/************************************************************************************/
-
-const LVM_INT32 LVCS_SampleRateTable[9] = {8000,
+#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
+const LVM_INT32 LVCS_SampleRateTable[11] = {8000,
+ 11025,
+ 12000,
+ 16000,
+ 22050,
+ 24000,
+ 32000,
+ 44100,
+ 48000,
+ 96000,
+ 192000
+};
+#else
+const LVM_INT16 LVCS_SampleRateTable[9] = {8000,
11025,
12000,
16000,
@@ -444,5 +566,6 @@
24000,
32000,
44100,
- 48000};
-
+ 48000
+};
+#endif
diff --git a/media/libeffects/lvm/wrapper/Android.mk b/media/libeffects/lvm/wrapper/Android.mk
index efd30fb..f106aae 100644
--- a/media/libeffects/lvm/wrapper/Android.mk
+++ b/media/libeffects/lvm/wrapper/Android.mk
@@ -10,7 +10,7 @@
LOCAL_SRC_FILES:= \
Bundle/EffectBundle.cpp
-LOCAL_CFLAGS += -fvisibility=hidden
+LOCAL_CFLAGS += -fvisibility=hidden -DBUILD_FLOAT -DHIGHER_FS
LOCAL_CFLAGS += -Wall -Werror
LOCAL_MODULE:= libbundlewrapper
@@ -43,7 +43,7 @@
LOCAL_SRC_FILES:= \
Reverb/EffectReverb.cpp
-LOCAL_CFLAGS += -fvisibility=hidden
+LOCAL_CFLAGS += -fvisibility=hidden -DBUILD_FLOAT -DHIGHER_FS
LOCAL_CFLAGS += -Wall -Werror
LOCAL_MODULE:= libreverbwrapper
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
index df6501b..94d4516 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
@@ -14,7 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+#ifndef LVM_FLOAT
+typedef float LVM_FLOAT;
+#endif
#define LOG_TAG "Bundle"
#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array)[0])
//#define LOG_NDEBUG 0
@@ -33,6 +35,15 @@
// effect_handle_t interface implementation for bass boost
extern "C" const struct effect_interface_s gLvmEffectInterface;
+// Turn on VERY_VERY_VERBOSE_LOGGING to log parameter get and set for effects.
+
+//#define VERY_VERY_VERBOSE_LOGGING
+#ifdef VERY_VERY_VERBOSE_LOGGING
+#define ALOGVV ALOGV
+#else
+#define ALOGVV(a...) do { } while (false)
+#endif
+
#define LVM_ERROR_CHECK(LvmStatus, callingFunc, calledFunc){\
if ((LvmStatus) == LVM_NULLADDRESS){\
ALOGV("\tLVM_ERROR : Parameter error - "\
@@ -138,26 +149,43 @@
void LvmEffect_free (EffectContext *pContext);
int Effect_setConfig (EffectContext *pContext, effect_config_t *pConfig);
void Effect_getConfig (EffectContext *pContext, effect_config_t *pConfig);
-int BassBoost_setParameter (EffectContext *pContext, void *pParam, void *pValue);
+int BassBoost_setParameter (EffectContext *pContext,
+ uint32_t paramSize,
+ void *pParam,
+ uint32_t valueSize,
+ void *pValue);
int BassBoost_getParameter (EffectContext *pContext,
- void *pParam,
- uint32_t *pValueSize,
- void *pValue);
-int Virtualizer_setParameter (EffectContext *pContext, void *pParam, void *pValue);
-int Virtualizer_getParameter (EffectContext *pContext,
- void *pParam,
- uint32_t *pValueSize,
- void *pValue);
-int Equalizer_setParameter (EffectContext *pContext,
- void *pParam,
- uint32_t valueSize,
- void *pValue);
-int Equalizer_getParameter (EffectContext *pContext,
+ uint32_t paramSize,
void *pParam,
uint32_t *pValueSize,
void *pValue);
-int Volume_setParameter (EffectContext *pContext, void *pParam, void *pValue);
+int Virtualizer_setParameter (EffectContext *pContext,
+ uint32_t paramSize,
+ void *pParam,
+ uint32_t valueSize,
+ void *pValue);
+int Virtualizer_getParameter (EffectContext *pContext,
+ uint32_t paramSize,
+ void *pParam,
+ uint32_t *pValueSize,
+ void *pValue);
+int Equalizer_setParameter (EffectContext *pContext,
+ uint32_t paramSize,
+ void *pParam,
+ uint32_t valueSize,
+ void *pValue);
+int Equalizer_getParameter (EffectContext *pContext,
+ uint32_t paramSize,
+ void *pParam,
+ uint32_t *pValueSize,
+ void *pValue);
+int Volume_setParameter (EffectContext *pContext,
+ uint32_t paramSize,
+ void *pParam,
+ uint32_t valueSize,
+ void *pValue);
int Volume_getParameter (EffectContext *pContext,
+ uint32_t paramSize,
void *pParam,
uint32_t *pValueSize,
void *pValue);
@@ -170,7 +198,7 @@
int32_t ioId __unused,
effect_handle_t *pHandle){
int ret = 0;
- int sessionNo;
+ int sessionNo = -1;
int i;
EffectContext *pContext = NULL;
bool newBundle = false;
@@ -190,22 +218,27 @@
LvmGlobalBundle_init();
}
- // Find next available sessionNo
+ // Find sessionNo: if one already exists for the sessionId use it,
+ // otherwise choose the first available empty slot.
for(i=0; i<LVM_MAX_SESSIONS; i++){
- if((SessionIndex[i] == LVM_UNUSED_SESSION)||(SessionIndex[i] == sessionId)){
- sessionNo = i;
- SessionIndex[i] = sessionId;
- ALOGV("\tEffectCreate: Allocating SessionNo %d for SessionId %d\n", sessionNo,sessionId);
+ if (SessionIndex[i] == sessionId) {
+ sessionNo = i;
break;
}
+ if (sessionNo < 0 && SessionIndex[i] == LVM_UNUSED_SESSION) {
+ sessionNo = i;
+ // do not break; allow loop to continue to search for a sessionId match.
+ }
}
-
- if(i==LVM_MAX_SESSIONS){
+ if (sessionNo < 0) {
ALOGV("\tLVM_ERROR : Cannot find memory to allocate for current session");
ret = -EINVAL;
goto exit;
}
+ SessionIndex[sessionNo] = sessionId;
+ ALOGV("\tEffectCreate: Allocating sessionNo %d for sessionId %d\n", sessionNo, sessionId);
+
pContext = new EffectContext;
// If this is the first create in this session
@@ -271,7 +304,10 @@
pContext->pBundledContext->SamplesToExitCountVirt = 0;
pContext->pBundledContext->SamplesToExitCountBb = 0;
pContext->pBundledContext->SamplesToExitCountEq = 0;
-
+#ifdef BUILD_FLOAT
+ pContext->pBundledContext->pInputBuffer = NULL;
+ pContext->pBundledContext->pOutputBuffer = NULL;
+#endif
for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
pContext->pBundledContext->bandGaindB[i] = EQNB_5BandSoftPresets[i];
}
@@ -439,6 +475,14 @@
if (pContext->pBundledContext->workBuffer != NULL) {
free(pContext->pBundledContext->workBuffer);
}
+#ifdef BUILD_FLOAT
+ if (pContext->pBundledContext->pInputBuffer != NULL) {
+ free(pContext->pBundledContext->pInputBuffer);
+ }
+ if (pContext->pBundledContext->pOutputBuffer != NULL) {
+ free(pContext->pBundledContext->pOutputBuffer);
+ }
+#endif
delete pContext->pBundledContext;
pContext->pBundledContext = LVM_NULL;
}
@@ -695,7 +739,47 @@
return 0;
} /* end LvmBundle_init */
+#ifdef BUILD_FLOAT
+/**********************************************************************************
+ FUNCTION INT16LTOFLOAT
+***********************************************************************************/
+// Todo: need to write function descriptor
+static void Int16ToFloat(const LVM_INT16 *src, LVM_FLOAT *dst, size_t n) {
+ size_t ii;
+ src += n-1;
+ dst += n-1;
+ for (ii = n; ii != 0; ii--) {
+ *dst = ((LVM_FLOAT)((LVM_INT16)*src)) / 32768.0f;
+ src--;
+ dst--;
+ }
+ return;
+}
+/**********************************************************************************
+ FUNCTION FLOATTOINT16_SAT
+***********************************************************************************/
+// Todo : Need to write function descriptor
+static void FloatToInt16_SAT(const LVM_FLOAT *src, LVM_INT16 *dst, size_t n) {
+ size_t ii;
+ LVM_INT32 temp;
+ src += n-1;
+ dst += n-1;
+ for (ii = n; ii != 0; ii--) {
+ temp = (LVM_INT32)((*src) * 32768.0f);
+ if (temp >= 32767) {
+ *dst = 32767;
+ } else if (temp <= -32768) {
+ *dst = -32768;
+ } else {
+ *dst = (LVM_INT16)temp;
+ }
+ src--;
+ dst--;
+ }
+ return;
+}
+#endif
//----------------------------------------------------------------------------
// LvmBundle_process()
//----------------------------------------------------------------------------
@@ -713,7 +797,99 @@
// pOut: pointer to updated stereo 16 bit output data
//
//----------------------------------------------------------------------------
+#ifdef BUILD_FLOAT
+int LvmBundle_process(LVM_INT16 *pIn,
+ LVM_INT16 *pOut,
+ int frameCount,
+ EffectContext *pContext){
+
+ //LVM_ControlParams_t ActiveParams; /* Current control Parameters */
+ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
+ LVM_INT16 *pOutTmp;
+ LVM_FLOAT *pInputBuff;
+ LVM_FLOAT *pOutputBuff;
+
+ if (pContext->pBundledContext->pInputBuffer == NULL ||
+ pContext->pBundledContext->frameCount < frameCount) {
+ if (pContext->pBundledContext->pInputBuffer != NULL) {
+ free(pContext->pBundledContext->pInputBuffer);
+ }
+ pContext->pBundledContext->pInputBuffer = (LVM_FLOAT *)malloc(frameCount * \
+ sizeof(LVM_FLOAT) * FCC_2);
+ }
+
+ if (pContext->pBundledContext->pOutputBuffer == NULL ||
+ pContext->pBundledContext->frameCount < frameCount) {
+ if (pContext->pBundledContext->pOutputBuffer != NULL) {
+ free(pContext->pBundledContext->pOutputBuffer);
+ }
+ pContext->pBundledContext->pOutputBuffer = (LVM_FLOAT *)malloc(frameCount * \
+ sizeof(LVM_FLOAT) * FCC_2);
+ }
+
+ if ((pContext->pBundledContext->pInputBuffer == NULL) ||
+ (pContext->pBundledContext->pOutputBuffer == NULL)) {
+ ALOGV("LVM_ERROR : LvmBundle_process memory allocation for float buffer's failed");
+ return -EINVAL;
+ }
+
+ pInputBuff = pContext->pBundledContext->pInputBuffer;
+ pOutputBuff = pContext->pBundledContext->pOutputBuffer;
+
+ if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_WRITE){
+ pOutTmp = pOut;
+ } else if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE){
+ if (pContext->pBundledContext->frameCount != frameCount) {
+ if (pContext->pBundledContext->workBuffer != NULL) {
+ free(pContext->pBundledContext->workBuffer);
+ }
+ pContext->pBundledContext->workBuffer =
+ (LVM_INT16 *)calloc(frameCount, sizeof(LVM_INT16) * FCC_2);
+ if (pContext->pBundledContext->workBuffer == NULL) {
+ return -ENOMEM;
+ }
+ pContext->pBundledContext->frameCount = frameCount;
+ }
+ pOutTmp = pContext->pBundledContext->workBuffer;
+ } else {
+ ALOGV("LVM_ERROR : LvmBundle_process invalid access mode");
+ return -EINVAL;
+ }
+
+ #ifdef LVM_PCM
+ fwrite(pIn, frameCount*sizeof(LVM_INT16) * FCC_2, 1, pContext->pBundledContext->PcmInPtr);
+ fflush(pContext->pBundledContext->PcmInPtr);
+ #endif
+
+ /* Converting input data from fixed point to float point */
+ Int16ToFloat(pIn, pInputBuff, frameCount * 2);
+
+ /* Process the samples */
+ LvmStatus = LVM_Process(pContext->pBundledContext->hInstance, /* Instance handle */
+ pInputBuff, /* Input buffer */
+ pOutputBuff, /* Output buffer */
+ (LVM_UINT16)frameCount, /* Number of samples to read */
+ 0); /* Audo Time */
+
+ LVM_ERROR_CHECK(LvmStatus, "LVM_Process", "LvmBundle_process")
+ if(LvmStatus != LVM_SUCCESS) return -EINVAL;
+
+ /* Converting output data from float point to fixed point */
+ FloatToInt16_SAT(pOutputBuff, pOutTmp, (LVM_UINT16)frameCount * 2);
+ #ifdef LVM_PCM
+ fwrite(pOutTmp, frameCount*sizeof(LVM_INT16) * FCC_2, 1, pContext->pBundledContext->PcmOutPtr);
+ fflush(pContext->pBundledContext->PcmOutPtr);
+ #endif
+
+ if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE){
+ for (int i = 0; i < frameCount * 2; i++){
+ pOut[i] = clamp16((LVM_INT32)pOut[i] + (LVM_INT32)pOutTmp[i]);
+ }
+ }
+ return 0;
+} /* end LvmBundle_process */
+#else
int LvmBundle_process(LVM_INT16 *pIn,
LVM_INT16 *pOut,
int frameCount,
@@ -771,7 +947,7 @@
}
return 0;
} /* end LvmBundle_process */
-
+#endif
//----------------------------------------------------------------------------
// EqualizerUpdateActiveParams()
@@ -840,8 +1016,12 @@
float energyBassBoost = 0;
float crossCorrection = 0;
+ bool eqEnabled = pContext->pBundledContext->bEqualizerEnabled == LVM_TRUE;
+ bool bbEnabled = pContext->pBundledContext->bBassEnabled == LVM_TRUE;
+ bool viEnabled = pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE;
+
//EQ contribution
- if (pContext->pBundledContext->bEqualizerEnabled == LVM_TRUE) {
+ if (eqEnabled) {
for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
float bandFactor = pContext->pBundledContext->bandGaindB[i]/15.0;
float bandCoefficient = LimitLevel_bandEnergyCoefficient[i];
@@ -867,35 +1047,37 @@
}
bandFactorSum -= 1.0;
if (bandFactorSum > 0)
- crossCorrection = bandFactorSum * 0.7;
+ crossCorrection = bandFactorSum * 0.7;
}
//BassBoost contribution
- if (pContext->pBundledContext->bBassEnabled == LVM_TRUE) {
+ if (bbEnabled) {
float boostFactor = (pContext->pBundledContext->BassStrengthSaved)/1000.0;
float boostCoefficient = LimitLevel_bassBoostEnergyCoefficient;
energyContribution += boostFactor * boostCoefficient * boostCoefficient;
- for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
- float bandFactor = pContext->pBundledContext->bandGaindB[i]/15.0;
- float bandCrossCoefficient = LimitLevel_bassBoostEnergyCrossCoefficient[i];
- float bandEnergy = boostFactor * bandFactor *
+ if (eqEnabled) {
+ for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
+ float bandFactor = pContext->pBundledContext->bandGaindB[i]/15.0;
+ float bandCrossCoefficient = LimitLevel_bassBoostEnergyCrossCoefficient[i];
+ float bandEnergy = boostFactor * bandFactor *
bandCrossCoefficient;
- if (bandEnergy > 0)
- energyBassBoost += bandEnergy;
+ if (bandEnergy > 0)
+ energyBassBoost += bandEnergy;
+ }
}
}
//Virtualizer contribution
- if (pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE) {
+ if (viEnabled) {
energyContribution += LimitLevel_virtualizerContribution *
LimitLevel_virtualizerContribution;
}
double totalEnergyEstimation = sqrt(energyContribution + energyCross + energyBassBoost) -
crossCorrection;
- ALOGV(" TOTAL energy estimation: %0.2f", totalEnergyEstimation);
+ ALOGV(" TOTAL energy estimation: %0.2f dB", totalEnergyEstimation);
//roundoff
int maxLevelRound = (int)(totalEnergyEstimation + 0.99);
@@ -913,6 +1095,8 @@
/* Activate the initial settings */
LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "LvmEffect_limitLevel")
+
+ ALOGV("LVM_SetControlParameters return:%d", (int)LvmStatus);
//ALOGV("\tLvmEffect_limitLevel just Set -> %d\n",
// ActiveParams.pEQNB_BandDefinition[band].Gain);
@@ -1126,6 +1310,16 @@
SampleRate = LVM_FS_48000;
pContext->pBundledContext->SamplesPerSecond = 48000*2; // 2 secs Stereo
break;
+#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
+ case 96000:
+ SampleRate = LVM_FS_96000;
+ pContext->pBundledContext->SamplesPerSecond = 96000*2; // 2 secs Stereo
+ break;
+ case 192000:
+ SampleRate = LVM_FS_192000;
+ pContext->pBundledContext->SamplesPerSecond = 192000*2; // 2 secs Stereo
+ break;
+#endif
default:
ALOGV("\tEffect_setConfig invalid sampling rate %d", pConfig->inputCfg.samplingRate);
return -EINVAL;
@@ -1153,6 +1347,8 @@
ALOGV("\tEffect_setConfig Succesfully called LVM_SetControlParameters\n");
pContext->pBundledContext->SampleRate = SampleRate;
+ LvmEffect_limitLevel(pContext);
+
}else{
//ALOGV("\tEffect_setConfig keep sampling rate at %d", SampleRate);
}
@@ -2010,59 +2206,54 @@
//
//----------------------------------------------------------------------------
-int BassBoost_getParameter(EffectContext *pContext,
- void *pParam,
- uint32_t *pValueSize,
- void *pValue){
+int BassBoost_getParameter(EffectContext *pContext,
+ uint32_t paramSize,
+ void *pParam,
+ uint32_t *pValueSize,
+ void *pValue) {
int status = 0;
- int32_t *pParamTemp = (int32_t *)pParam;
- int32_t param = *pParamTemp++;
+ int32_t *params = (int32_t *)pParam;
- //ALOGV("\tBassBoost_getParameter start");
+ ALOGVV("%s start", __func__);
- switch (param){
- case BASSBOOST_PARAM_STRENGTH_SUPPORTED:
- if (*pValueSize != sizeof(uint32_t)){
- ALOGV("\tLVM_ERROR : BassBoost_getParameter() invalid pValueSize1 %d", *pValueSize);
- return -EINVAL;
- }
- *pValueSize = sizeof(uint32_t);
- break;
- case BASSBOOST_PARAM_STRENGTH:
- if (*pValueSize != sizeof(int16_t)){
- ALOGV("\tLVM_ERROR : BassBoost_getParameter() invalid pValueSize2 %d", *pValueSize);
- return -EINVAL;
- }
- *pValueSize = sizeof(int16_t);
- break;
-
- default:
- ALOGV("\tLVM_ERROR : BassBoost_getParameter() invalid param %d", param);
- return -EINVAL;
+ if (paramSize < sizeof(int32_t)) {
+ ALOGV("%s invalid paramSize: %u", __func__, paramSize);
+ return -EINVAL;
}
-
- switch (param){
+ switch (params[0]) {
case BASSBOOST_PARAM_STRENGTH_SUPPORTED:
- *(uint32_t *)pValue = 1;
+ if (*pValueSize != sizeof(uint32_t)) { // legacy: check equality here.
+ ALOGV("%s BASSBOOST_PARAM_STRENGTH_SUPPORTED invalid *pValueSize %u",
+ __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ // no need to set *pValueSize
- //ALOGV("\tBassBoost_getParameter() BASSBOOST_PARAM_STRENGTH_SUPPORTED Value is %d",
- // *(uint32_t *)pValue);
+ *(uint32_t *)pValue = 1;
+ ALOGVV("%s BASSBOOST_PARAM_STRENGTH_SUPPORTED %u", __func__, *(uint32_t *)pValue);
break;
case BASSBOOST_PARAM_STRENGTH:
- *(int16_t *)pValue = BassGetStrength(pContext);
+ if (*pValueSize != sizeof(int16_t)) { // legacy: check equality here.
+ ALOGV("%s BASSBOOST_PARAM_STRENGTH invalid *pValueSize %u",
+ __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ // no need to set *pValueSize
- //ALOGV("\tBassBoost_getParameter() BASSBOOST_PARAM_STRENGTH Value is %d",
- // *(int16_t *)pValue);
+ *(int16_t *)pValue = BassGetStrength(pContext);
+ ALOGVV("%s BASSBOOST_PARAM_STRENGTH %d", __func__, *(int16_t *)pValue);
break;
default:
- ALOGV("\tLVM_ERROR : BassBoost_getParameter() invalid param %d", param);
+ ALOGV("%s invalid param %d", __func__, params[0]);
status = -EINVAL;
break;
}
- //ALOGV("\tBassBoost_getParameter end");
+ ALOGVV("%s end param: %d, status: %d", __func__, params[0], status);
return status;
} /* end BassBoost_getParameter */
@@ -2081,27 +2272,42 @@
//
//----------------------------------------------------------------------------
-int BassBoost_setParameter (EffectContext *pContext, void *pParam, void *pValue){
+int BassBoost_setParameter(EffectContext *pContext,
+ uint32_t paramSize,
+ void *pParam,
+ uint32_t valueSize,
+ void *pValue) {
int status = 0;
- int16_t strength;
- int32_t *pParamTemp = (int32_t *)pParam;
+ int32_t *params = (int32_t *)pParam;
- //ALOGV("\tBassBoost_setParameter start");
+ ALOGVV("%s start", __func__);
- switch (*pParamTemp){
- case BASSBOOST_PARAM_STRENGTH:
- strength = *(int16_t *)pValue;
- //ALOGV("\tBassBoost_setParameter() BASSBOOST_PARAM_STRENGTH value is %d", strength);
- //ALOGV("\tBassBoost_setParameter() Calling pBassBoost->BassSetStrength");
+ if (paramSize != sizeof(int32_t)) { // legacy: check equality here.
+ ALOGV("%s invalid paramSize: %u", __func__, paramSize);
+ return -EINVAL;
+ }
+ switch (params[0]) {
+ case BASSBOOST_PARAM_STRENGTH: {
+ if (valueSize < sizeof(int16_t)) {
+ ALOGV("%s BASSBOOST_PARAM_STRENGTH invalid valueSize: %u", __func__, valueSize);
+ status = -EINVAL;
+ break;
+ }
+
+ const int16_t strength = *(int16_t *)pValue;
+ ALOGVV("%s BASSBOOST_PARAM_STRENGTH %d", __func__, strength);
+ ALOGVV("%s BASSBOOST_PARAM_STRENGTH Calling BassSetStrength", __func__);
BassSetStrength(pContext, (int32_t)strength);
- //ALOGV("\tBassBoost_setParameter() Called pBassBoost->BassSetStrength");
- break;
+ ALOGVV("%s BASSBOOST_PARAM_STRENGTH Called BassSetStrength", __func__);
+ } break;
+
default:
- ALOGV("\tLVM_ERROR : BassBoost_setParameter() invalid param %d", *pParamTemp);
+ ALOGV("%s invalid param %d", __func__, params[0]);
+ status = -EINVAL;
break;
}
- //ALOGV("\tBassBoost_setParameter end");
+ ALOGVV("%s end param: %d, status: %d", __func__, params[0], status);
return status;
} /* end BassBoost_setParameter */
@@ -2126,92 +2332,97 @@
//
//----------------------------------------------------------------------------
-int Virtualizer_getParameter(EffectContext *pContext,
- void *pParam,
- uint32_t *pValueSize,
- void *pValue){
+int Virtualizer_getParameter(EffectContext *pContext,
+ uint32_t paramSize,
+ void *pParam,
+ uint32_t *pValueSize,
+ void *pValue) {
int status = 0;
- int32_t *pParamTemp = (int32_t *)pParam;
- int32_t param = *pParamTemp++;
+ int32_t *params = (int32_t *)pParam;
- //ALOGV("\tVirtualizer_getParameter start");
+ ALOGVV("%s start", __func__);
- switch (param){
- case VIRTUALIZER_PARAM_STRENGTH_SUPPORTED:
- if (*pValueSize != sizeof(uint32_t)){
- ALOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid pValueSize %d",*pValueSize);
- return -EINVAL;
- }
- *pValueSize = sizeof(uint32_t);
- break;
- case VIRTUALIZER_PARAM_STRENGTH:
- if (*pValueSize != sizeof(int16_t)){
- ALOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid pValueSize2 %d",*pValueSize);
- return -EINVAL;
- }
- *pValueSize = sizeof(int16_t);
- break;
- case VIRTUALIZER_PARAM_VIRTUAL_SPEAKER_ANGLES:
- // return value size can only be interpreted as relative to input value,
- // deferring validity check to below
- break;
- case VIRTUALIZER_PARAM_VIRTUALIZATION_MODE:
- if (*pValueSize != sizeof(uint32_t)){
- ALOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid pValueSize %d",*pValueSize);
- return -EINVAL;
- }
- *pValueSize = sizeof(uint32_t);
- break;
- default:
- ALOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid param %d", param);
- return -EINVAL;
+ if (paramSize < sizeof(int32_t)) {
+ ALOGV("%s invalid paramSize: %u", __func__, paramSize);
+ return -EINVAL;
}
-
- switch (param){
+ switch (params[0]) {
case VIRTUALIZER_PARAM_STRENGTH_SUPPORTED:
- *(uint32_t *)pValue = 1;
+ if (*pValueSize != sizeof(uint32_t)) { // legacy: check equality here.
+ ALOGV("%s VIRTUALIZER_PARAM_STRENGTH_SUPPORTED invalid *pValueSize %u",
+ __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ // no need to set *pValueSize
- //ALOGV("\tVirtualizer_getParameter() VIRTUALIZER_PARAM_STRENGTH_SUPPORTED Value is %d",
- // *(uint32_t *)pValue);
+ *(uint32_t *)pValue = 1;
+ ALOGVV("%s VIRTUALIZER_PARAM_STRENGTH_SUPPORTED %d", __func__, *(uint32_t *)pValue);
break;
case VIRTUALIZER_PARAM_STRENGTH:
+ if (*pValueSize != sizeof(int16_t)) { // legacy: check equality here.
+ ALOGV("%s VIRTUALIZER_PARAM_STRENGTH invalid *pValueSize %u",
+ __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ // no need to set *pValueSize
+
*(int16_t *)pValue = VirtualizerGetStrength(pContext);
- //ALOGV("\tVirtualizer_getParameter() VIRTUALIZER_PARAM_STRENGTH Value is %d",
- // *(int16_t *)pValue);
+ ALOGVV("%s VIRTUALIZER_PARAM_STRENGTH %d", __func__, *(int16_t *)pValue);
break;
case VIRTUALIZER_PARAM_VIRTUAL_SPEAKER_ANGLES: {
- const audio_channel_mask_t channelMask = (audio_channel_mask_t) *pParamTemp++;
- const audio_devices_t deviceType = (audio_devices_t) *pParamTemp;
- uint32_t nbChannels = audio_channel_count_from_out_mask(channelMask);
- if (*pValueSize < 3 * nbChannels * sizeof(int32_t)){
- ALOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid pValueSize %d",*pValueSize);
- return -EINVAL;
+ if (paramSize < 3 * sizeof(int32_t)) {
+ ALOGV("%s VIRTUALIZER_PARAM_SPEAKER_ANGLES invalid paramSize: %u",
+ __func__, paramSize);
+ status = -EINVAL;
+ break;
}
+
+ const audio_channel_mask_t channelMask = (audio_channel_mask_t) params[1];
+ const audio_devices_t deviceType = (audio_devices_t) params[2];
+ const uint32_t nbChannels = audio_channel_count_from_out_mask(channelMask);
+ const uint32_t valueSizeRequired = 3 * nbChannels * sizeof(int32_t);
+ if (*pValueSize < valueSizeRequired) {
+ ALOGV("%s VIRTUALIZER_PARAM_SPEAKER_ANGLES invalid *pValueSize %u",
+ __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ *pValueSize = valueSizeRequired;
+
// verify the configuration is supported
status = VirtualizerIsConfigurationSupported(channelMask, deviceType);
if (status == 0) {
- ALOGV("VIRTUALIZER_PARAM_VIRTUAL_SPEAKER_ANGLES supports mask=0x%x device=0x%x",
- channelMask, deviceType);
+ ALOGV("%s VIRTUALIZER_PARAM_VIRTUAL_SPEAKER_ANGLES mask=0x%x device=0x%x",
+ __func__, channelMask, deviceType);
// configuration is supported, get the angles
VirtualizerGetSpeakerAngles(channelMask, deviceType, (int32_t *)pValue);
}
- }
- break;
+ } break;
case VIRTUALIZER_PARAM_VIRTUALIZATION_MODE:
- *(uint32_t *)pValue = (uint32_t) VirtualizerGetVirtualizationMode(pContext);
+ if (*pValueSize != sizeof(uint32_t)) { // legacy: check equality here.
+ ALOGV("%s VIRTUALIZER_PARAM_VIRTUALIZATION_MODE invalid *pValueSize %u",
+ __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ // no need to set *pValueSize
+
+ *(uint32_t *)pValue = (uint32_t) VirtualizerGetVirtualizationMode(pContext);
break;
default:
- ALOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid param %d", param);
+ ALOGV("%s invalid param %d", __func__, params[0]);
status = -EINVAL;
break;
}
- ALOGV("\tVirtualizer_getParameter end returning status=%d", status);
+ ALOGVV("%s end param: %d, status: %d", __func__, params[0], status);
return status;
} /* end Virtualizer_getParameter */
@@ -2230,37 +2441,57 @@
//
//----------------------------------------------------------------------------
-int Virtualizer_setParameter (EffectContext *pContext, void *pParam, void *pValue){
+int Virtualizer_setParameter(EffectContext *pContext,
+ uint32_t paramSize,
+ void *pParam,
+ uint32_t valueSize,
+ void *pValue) {
int status = 0;
- int16_t strength;
- int32_t *pParamTemp = (int32_t *)pParam;
- int32_t param = *pParamTemp++;
+ int32_t *params = (int32_t *)pParam;
- //ALOGV("\tVirtualizer_setParameter start");
+ ALOGVV("%s start", __func__);
- switch (param){
- case VIRTUALIZER_PARAM_STRENGTH:
- strength = *(int16_t *)pValue;
- //ALOGV("\tVirtualizer_setParameter() VIRTUALIZER_PARAM_STRENGTH value is %d", strength);
- //ALOGV("\tVirtualizer_setParameter() Calling pVirtualizer->setStrength");
+ if (paramSize != sizeof(int32_t)) { // legacy: check equality here.
+ ALOGV("%s invalid paramSize: %u", __func__, paramSize);
+ return -EINVAL;
+ }
+ switch (params[0]) {
+ case VIRTUALIZER_PARAM_STRENGTH: {
+ if (valueSize < sizeof(int16_t)) {
+ ALOGV("%s VIRTUALIZER_PARAM_STRENGTH invalid valueSize: %u", __func__, valueSize);
+ status = -EINVAL;
+ break;
+ }
+
+ const int16_t strength = *(int16_t *)pValue;
+ ALOGVV("%s VIRTUALIZER_PARAM_STRENGTH %d", __func__, strength);
+ ALOGVV("%s VIRTUALIZER_PARAM_STRENGTH Calling VirtualizerSetStrength", __func__);
VirtualizerSetStrength(pContext, (int32_t)strength);
- //ALOGV("\tVirtualizer_setParameter() Called pVirtualizer->setStrength");
- break;
+ ALOGVV("%s VIRTUALIZER_PARAM_STRENGTH Called VirtualizerSetStrength", __func__);
+ } break;
case VIRTUALIZER_PARAM_FORCE_VIRTUALIZATION_MODE: {
- const audio_devices_t deviceType = *(audio_devices_t *) pValue;
- status = VirtualizerForceVirtualizationMode(pContext, deviceType);
- //ALOGV("VIRTUALIZER_PARAM_FORCE_VIRTUALIZATION_MODE device=0x%x result=%d",
- // deviceType, status);
+ if (valueSize < sizeof(int32_t)) {
+ ALOGV("%s VIRTUALIZER_PARAM_FORCE_VIRTUALIZATION_MODE invalid valueSize: %u",
+ __func__, valueSize);
+ android_errorWriteLog(0x534e4554, "64478003");
+ status = -EINVAL;
+ break;
}
- break;
+
+ const audio_devices_t deviceType = (audio_devices_t)*(int32_t *)pValue;
+ status = VirtualizerForceVirtualizationMode(pContext, deviceType);
+ ALOGVV("%s VIRTUALIZER_PARAM_FORCE_VIRTUALIZATION_MODE device=%#x result=%d",
+ __func__, deviceType, status);
+ } break;
default:
- ALOGV("\tLVM_ERROR : Virtualizer_setParameter() invalid param %d", param);
+ ALOGV("%s invalid param %d", __func__, params[0]);
+ status = -EINVAL;
break;
}
- //ALOGV("\tVirtualizer_setParameter end");
+ ALOGVV("%s end param: %d, status: %d", __func__, params[0], status);
return status;
} /* end Virtualizer_setParameter */
@@ -2284,174 +2515,215 @@
// Side Effects:
//
//----------------------------------------------------------------------------
-int Equalizer_getParameter(EffectContext *pContext,
- void *pParam,
- uint32_t *pValueSize,
- void *pValue){
+int Equalizer_getParameter(EffectContext *pContext,
+ uint32_t paramSize,
+ void *pParam,
+ uint32_t *pValueSize,
+ void *pValue) {
int status = 0;
- int32_t *pParamTemp = (int32_t *)pParam;
- int32_t param = *pParamTemp++;
- int32_t param2;
- char *name;
+ int32_t *params = (int32_t *)pParam;
- //ALOGV("\tEqualizer_getParameter start");
+ ALOGVV("%s start", __func__);
- switch (param) {
+ if (paramSize < sizeof(int32_t)) {
+ ALOGV("%s invalid paramSize: %u", __func__, paramSize);
+ return -EINVAL;
+ }
+ switch (params[0]) {
case EQ_PARAM_NUM_BANDS:
+ if (*pValueSize < sizeof(uint16_t)) {
+ ALOGV("%s EQ_PARAM_NUM_BANDS invalid *pValueSize %u", __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ *pValueSize = sizeof(uint16_t);
+
+ *(uint16_t *)pValue = (uint16_t)FIVEBAND_NUMBANDS;
+ ALOGVV("%s EQ_PARAM_NUM_BANDS %u", __func__, *(uint16_t *)pValue);
+ break;
+
case EQ_PARAM_CUR_PRESET:
+ if (*pValueSize < sizeof(uint16_t)) {
+ ALOGV("%s EQ_PARAM_CUR_PRESET invalid *pValueSize %u", __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ *pValueSize = sizeof(uint16_t);
+
+ *(uint16_t *)pValue = (uint16_t)EqualizerGetPreset(pContext);
+ ALOGVV("%s EQ_PARAM_CUR_PRESET %u", __func__, *(uint16_t *)pValue);
+ break;
+
case EQ_PARAM_GET_NUM_OF_PRESETS:
- case EQ_PARAM_BAND_LEVEL:
- case EQ_PARAM_GET_BAND:
+ if (*pValueSize < sizeof(uint16_t)) {
+ ALOGV("%s EQ_PARAM_GET_NUM_OF_PRESETS invalid *pValueSize %u", __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ *pValueSize = sizeof(uint16_t);
+
+ *(uint16_t *)pValue = (uint16_t)EqualizerGetNumPresets();
+ ALOGVV("%s EQ_PARAM_GET_NUM_OF_PRESETS %u", __func__, *(uint16_t *)pValue);
+ break;
+
+ case EQ_PARAM_GET_BAND: {
+ if (paramSize < 2 * sizeof(int32_t)) {
+ ALOGV("%s EQ_PARAM_GET_BAND invalid paramSize: %u", __func__, paramSize);
+ status = -EINVAL;
+ break;
+ }
+ if (*pValueSize < sizeof(uint16_t)) {
+ ALOGV("%s EQ_PARAM_GET_BAND invalid *pValueSize %u", __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ *pValueSize = sizeof(uint16_t);
+
+ const int32_t frequency = params[1];
+ *(uint16_t *)pValue = (uint16_t)EqualizerGetBand(pContext, frequency);
+ ALOGVV("%s EQ_PARAM_GET_BAND frequency %d, band %u",
+ __func__, frequency, *(uint16_t *)pValue);
+ } break;
+
+ case EQ_PARAM_BAND_LEVEL: {
+ if (paramSize < 2 * sizeof(int32_t)) {
+ ALOGV("%s EQ_PARAM_BAND_LEVEL invalid paramSize %u", __func__, paramSize);
+ status = -EINVAL;
+ break;
+ }
if (*pValueSize < sizeof(int16_t)) {
- ALOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 1 %d", *pValueSize);
- return -EINVAL;
+ ALOGV("%s EQ_PARAM_BAND_LEVEL invalid *pValueSize %u", __func__, *pValueSize);
+ status = -EINVAL;
+ break;
}
*pValueSize = sizeof(int16_t);
- break;
+
+ const int32_t band = params[1];
+ if (band < 0 || band >= FIVEBAND_NUMBANDS) {
+ if (band < 0) {
+ android_errorWriteLog(0x534e4554, "32438598");
+ ALOGW("%s EQ_PARAM_BAND_LEVEL invalid band %d", __func__, band);
+ }
+ status = -EINVAL;
+ break;
+ }
+ *(int16_t *)pValue = (int16_t)EqualizerGetBandLevel(pContext, band);
+ ALOGVV("%s EQ_PARAM_BAND_LEVEL band %d, level %d",
+ __func__, band, *(int16_t *)pValue);
+ } break;
case EQ_PARAM_LEVEL_RANGE:
if (*pValueSize < 2 * sizeof(int16_t)) {
- ALOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 2 %d", *pValueSize);
- return -EINVAL;
+ ALOGV("%s EQ_PARAM_LEVEL_RANGE invalid *pValueSize %u", __func__, *pValueSize);
+ status = -EINVAL;
+ break;
}
*pValueSize = 2 * sizeof(int16_t);
- break;
- case EQ_PARAM_BAND_FREQ_RANGE:
- if (*pValueSize < 2 * sizeof(int32_t)) {
- ALOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 3 %d", *pValueSize);
- return -EINVAL;
- }
- *pValueSize = 2 * sizeof(int32_t);
- break;
- case EQ_PARAM_CENTER_FREQ:
- if (*pValueSize < sizeof(int32_t)) {
- ALOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 5 %d", *pValueSize);
- return -EINVAL;
- }
- *pValueSize = sizeof(int32_t);
- break;
-
- case EQ_PARAM_GET_PRESET_NAME:
- break;
-
- case EQ_PARAM_PROPERTIES:
- if (*pValueSize < (2 + FIVEBAND_NUMBANDS) * sizeof(uint16_t)) {
- ALOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 1 %d", *pValueSize);
- return -EINVAL;
- }
- *pValueSize = (2 + FIVEBAND_NUMBANDS) * sizeof(uint16_t);
- break;
-
- default:
- ALOGV("\tLVM_ERROR : Equalizer_getParameter unknown param %d", param);
- return -EINVAL;
- }
-
- switch (param) {
- case EQ_PARAM_NUM_BANDS:
- *(uint16_t *)pValue = (uint16_t)FIVEBAND_NUMBANDS;
- //ALOGV("\tEqualizer_getParameter() EQ_PARAM_NUM_BANDS %d", *(int16_t *)pValue);
- break;
-
- case EQ_PARAM_LEVEL_RANGE:
*(int16_t *)pValue = -1500;
*((int16_t *)pValue + 1) = 1500;
- //ALOGV("\tEqualizer_getParameter() EQ_PARAM_LEVEL_RANGE min %d, max %d",
- // *(int16_t *)pValue, *((int16_t *)pValue + 1));
+ ALOGVV("%s EQ_PARAM_LEVEL_RANGE min %d, max %d",
+ __func__, *(int16_t *)pValue, *((int16_t *)pValue + 1));
break;
- case EQ_PARAM_BAND_LEVEL:
- param2 = *pParamTemp;
- if (param2 < 0 || param2 >= FIVEBAND_NUMBANDS) {
+ case EQ_PARAM_BAND_FREQ_RANGE: {
+ if (paramSize < 2 * sizeof(int32_t)) {
+ ALOGV("%s EQ_PARAM_BAND_FREQ_RANGE invalid paramSize: %u", __func__, paramSize);
status = -EINVAL;
- if (param2 < 0) {
- android_errorWriteLog(0x534e4554, "32438598");
- ALOGW("\tERROR Equalizer_getParameter() EQ_PARAM_BAND_LEVEL band %d", param2);
- }
break;
}
- *(int16_t *)pValue = (int16_t)EqualizerGetBandLevel(pContext, param2);
- //ALOGV("\tEqualizer_getParameter() EQ_PARAM_BAND_LEVEL band %d, level %d",
- // param2, *(int32_t *)pValue);
- break;
-
- case EQ_PARAM_CENTER_FREQ:
- param2 = *pParamTemp;
- if (param2 < 0 || param2 >= FIVEBAND_NUMBANDS) {
+ if (*pValueSize < 2 * sizeof(int32_t)) {
+ ALOGV("%s EQ_PARAM_BAND_FREQ_RANGE invalid *pValueSize %u", __func__, *pValueSize);
status = -EINVAL;
- if (param2 < 0) {
- android_errorWriteLog(0x534e4554, "32436341");
- ALOGW("\tERROR Equalizer_getParameter() EQ_PARAM_CENTER_FREQ band %d", param2);
- }
break;
}
- *(int32_t *)pValue = EqualizerGetCentreFrequency(pContext, param2);
- //ALOGV("\tEqualizer_getParameter() EQ_PARAM_CENTER_FREQ band %d, frequency %d",
- // param2, *(int32_t *)pValue);
- break;
+ *pValueSize = 2 * sizeof(int32_t);
- case EQ_PARAM_BAND_FREQ_RANGE:
- param2 = *pParamTemp;
- if (param2 < 0 || param2 >= FIVEBAND_NUMBANDS) {
- status = -EINVAL;
- if (param2 < 0) {
+ const int32_t band = params[1];
+ if (band < 0 || band >= FIVEBAND_NUMBANDS) {
+ if (band < 0) {
android_errorWriteLog(0x534e4554, "32247948");
- ALOGW("\tERROR Equalizer_getParameter() EQ_PARAM_BAND_FREQ_RANGE band %d", param2);
+ ALOGW("%s EQ_PARAM_BAND_FREQ_RANGE invalid band %d",
+ __func__, band);
}
- break;
- }
- EqualizerGetBandFreqRange(pContext, param2, (uint32_t *)pValue, ((uint32_t *)pValue + 1));
- //ALOGV("\tEqualizer_getParameter() EQ_PARAM_BAND_FREQ_RANGE band %d, min %d, max %d",
- // param2, *(int32_t *)pValue, *((int32_t *)pValue + 1));
- break;
-
- case EQ_PARAM_GET_BAND:
- param2 = *pParamTemp;
- *(uint16_t *)pValue = (uint16_t)EqualizerGetBand(pContext, param2);
- //ALOGV("\tEqualizer_getParameter() EQ_PARAM_GET_BAND frequency %d, band %d",
- // param2, *(uint16_t *)pValue);
- break;
-
- case EQ_PARAM_CUR_PRESET:
- *(uint16_t *)pValue = (uint16_t)EqualizerGetPreset(pContext);
- //ALOGV("\tEqualizer_getParameter() EQ_PARAM_CUR_PRESET %d", *(int32_t *)pValue);
- break;
-
- case EQ_PARAM_GET_NUM_OF_PRESETS:
- *(uint16_t *)pValue = (uint16_t)EqualizerGetNumPresets();
- //ALOGV("\tEqualizer_getParameter() EQ_PARAM_GET_NUM_OF_PRESETS %d", *(int16_t *)pValue);
- break;
-
- case EQ_PARAM_GET_PRESET_NAME:
- param2 = *pParamTemp;
- if ((param2 < 0 && param2 != PRESET_CUSTOM) || param2 >= EqualizerGetNumPresets()) {
status = -EINVAL;
- if (param2 < 0) {
- android_errorWriteLog(0x534e4554, "32448258");
- ALOGE("\tERROR Equalizer_getParameter() EQ_PARAM_GET_PRESET_NAME preset %d",
- param2);
+ break;
+ }
+ EqualizerGetBandFreqRange(pContext, band, (uint32_t *)pValue, ((uint32_t *)pValue + 1));
+ ALOGVV("%s EQ_PARAM_BAND_FREQ_RANGE band %d, min %d, max %d",
+ __func__, band, *(int32_t *)pValue, *((int32_t *)pValue + 1));
+
+ } break;
+
+ case EQ_PARAM_CENTER_FREQ: {
+ if (paramSize < 2 * sizeof(int32_t)) {
+ ALOGV("%s EQ_PARAM_CENTER_FREQ invalid paramSize: %u", __func__, paramSize);
+ status = -EINVAL;
+ break;
+ }
+ if (*pValueSize < sizeof(int32_t)) {
+ ALOGV("%s EQ_PARAM_CENTER_FREQ invalid *pValueSize %u", __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ *pValueSize = sizeof(int32_t);
+
+ const int32_t band = params[1];
+ if (band < 0 || band >= FIVEBAND_NUMBANDS) {
+ status = -EINVAL;
+ if (band < 0) {
+ android_errorWriteLog(0x534e4554, "32436341");
+ ALOGW("%s EQ_PARAM_CENTER_FREQ invalid band %d", __func__, band);
}
break;
}
+ *(int32_t *)pValue = EqualizerGetCentreFrequency(pContext, band);
+ ALOGVV("%s EQ_PARAM_CENTER_FREQ band %d, frequency %d",
+ __func__, band, *(int32_t *)pValue);
+ } break;
+ case EQ_PARAM_GET_PRESET_NAME: {
+ if (paramSize < 2 * sizeof(int32_t)) {
+ ALOGV("%s EQ_PARAM_PRESET_NAME invalid paramSize: %u", __func__, paramSize);
+ status = -EINVAL;
+ break;
+ }
if (*pValueSize < 1) {
- status = -EINVAL;
android_errorWriteLog(0x534e4554, "37536407");
+ status = -EINVAL;
break;
}
- name = (char *)pValue;
- strncpy(name, EqualizerGetPresetName(param2), *pValueSize - 1);
+ const int32_t preset = params[1];
+ if ((preset < 0 && preset != PRESET_CUSTOM) || preset >= EqualizerGetNumPresets()) {
+ if (preset < 0) {
+ android_errorWriteLog(0x534e4554, "32448258");
+ ALOGE("%s EQ_PARAM_GET_PRESET_NAME preset %d", __func__, preset);
+ }
+ status = -EINVAL;
+ break;
+ }
+
+ char * const name = (char *)pValue;
+ strncpy(name, EqualizerGetPresetName(preset), *pValueSize - 1);
name[*pValueSize - 1] = 0;
*pValueSize = strlen(name) + 1;
- //ALOGV("\tEqualizer_getParameter() EQ_PARAM_GET_PRESET_NAME preset %d, name %s len %d",
- // param2, gEqualizerPresets[param2].name, *pValueSize);
- break;
+ ALOGVV("%s EQ_PARAM_GET_PRESET_NAME preset %d, name %s len %d",
+ __func__, preset, gEqualizerPresets[preset].name, *pValueSize);
+
+ } break;
case EQ_PARAM_PROPERTIES: {
+ constexpr uint32_t requiredValueSize = (2 + FIVEBAND_NUMBANDS) * sizeof(uint16_t);
+ if (*pValueSize < requiredValueSize) {
+ ALOGV("%s EQ_PARAM_PROPERTIES invalid *pValueSize %u", __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ *pValueSize = requiredValueSize;
+
int16_t *p = (int16_t *)pValue;
- ALOGV("\tEqualizer_getParameter() EQ_PARAM_PROPERTIES");
+ ALOGV("%s EQ_PARAM_PROPERTIES", __func__);
p[0] = (int16_t)EqualizerGetPreset(pContext);
p[1] = (int16_t)FIVEBAND_NUMBANDS;
for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
@@ -2460,12 +2732,12 @@
} break;
default:
- ALOGV("\tLVM_ERROR : Equalizer_getParameter() invalid param %d", param);
+ ALOGV("%s invalid param %d", __func__, params[0]);
status = -EINVAL;
break;
}
- //GV("\tEqualizer_getParameter end\n");
+ ALOGVV("%s end param: %d, status: %d", __func__, params[0], status);
return status;
} /* end Equalizer_getParameter */
@@ -2485,74 +2757,89 @@
// Outputs:
//
//----------------------------------------------------------------------------
-int Equalizer_setParameter (EffectContext *pContext,
- void *pParam,
- uint32_t valueSize,
- void *pValue) {
+int Equalizer_setParameter(EffectContext *pContext,
+ uint32_t paramSize,
+ void *pParam,
+ uint32_t valueSize,
+ void *pValue) {
int status = 0;
- int32_t preset;
- int32_t band;
- int32_t level;
- int32_t *pParamTemp = (int32_t *)pParam;
- int32_t param = *pParamTemp++;
+ int32_t *params = (int32_t *)pParam;
+ ALOGVV("%s start", __func__);
- //ALOGV("\tEqualizer_setParameter start");
- switch (param) {
- case EQ_PARAM_CUR_PRESET:
+ if (paramSize < sizeof(int32_t)) {
+ ALOGV("%s invalid paramSize: %u", __func__, paramSize);
+ return -EINVAL;
+ }
+ switch (params[0]) {
+ case EQ_PARAM_CUR_PRESET: {
if (valueSize < sizeof(int16_t)) {
- status = -EINVAL;
- break;
+ ALOGV("%s EQ_PARAM_CUR_PRESET invalid valueSize %u", __func__, valueSize);
+ status = -EINVAL;
+ break;
}
- preset = (int32_t)(*(uint16_t *)pValue);
+ const int32_t preset = (int32_t)*(uint16_t *)pValue;
- //ALOGV("\tEqualizer_setParameter() EQ_PARAM_CUR_PRESET %d", preset);
- if ((preset >= EqualizerGetNumPresets())||(preset < 0)) {
+ ALOGVV("%s EQ_PARAM_CUR_PRESET %d", __func__, preset);
+ if (preset >= EqualizerGetNumPresets() || preset < 0) {
+ ALOGV("%s EQ_PARAM_CUR_PRESET invalid preset %d", __func__, preset);
status = -EINVAL;
break;
}
EqualizerSetPreset(pContext, preset);
- break;
- case EQ_PARAM_BAND_LEVEL:
- if (valueSize < sizeof(int16_t)) {
- status = -EINVAL;
- break;
- }
- band = *pParamTemp;
- level = (int32_t)(*(int16_t *)pValue);
- //ALOGV("\tEqualizer_setParameter() EQ_PARAM_BAND_LEVEL band %d, level %d", band, level);
- if (band < 0 || band >= FIVEBAND_NUMBANDS) {
+ } break;
+
+ case EQ_PARAM_BAND_LEVEL: {
+ if (paramSize < 2 * sizeof(int32_t)) {
+ ALOGV("%s EQ_PARAM_BAND_LEVEL invalid paramSize: %u", __func__, paramSize);
status = -EINVAL;
+ break;
+ }
+ if (valueSize < sizeof(int16_t)) {
+ ALOGV("%s EQ_PARAM_BAND_LEVEL invalid valueSize %u", __func__, valueSize);
+ status = -EINVAL;
+ break;
+ }
+ const int32_t band = params[1];
+ const int32_t level = (int32_t)*(int16_t *)pValue;
+ ALOGVV("%s EQ_PARAM_BAND_LEVEL band %d, level %d", __func__, band, level);
+ if (band < 0 || band >= FIVEBAND_NUMBANDS) {
if (band < 0) {
android_errorWriteLog(0x534e4554, "32095626");
- ALOGE("\tERROR Equalizer_setParameter() EQ_PARAM_BAND_LEVEL band %d", band);
+ ALOGE("%s EQ_PARAM_BAND_LEVEL invalid band %d", __func__, band);
}
+ status = -EINVAL;
break;
}
EqualizerSetBandLevel(pContext, band, level);
- break;
+ } break;
+
case EQ_PARAM_PROPERTIES: {
- //ALOGV("\tEqualizer_setParameter() EQ_PARAM_PROPERTIES");
+ ALOGVV("%s EQ_PARAM_PROPERTIES", __func__);
if (valueSize < sizeof(int16_t)) {
- status = -EINVAL;
- break;
+ ALOGV("%s EQ_PARAM_PROPERTIES invalid valueSize %u", __func__, valueSize);
+ status = -EINVAL;
+ break;
}
int16_t *p = (int16_t *)pValue;
if ((int)p[0] >= EqualizerGetNumPresets()) {
+ ALOGV("%s EQ_PARAM_PROPERTIES invalid preset %d", __func__, (int)p[0]);
status = -EINVAL;
break;
}
if (p[0] >= 0) {
EqualizerSetPreset(pContext, (int)p[0]);
} else {
- if (valueSize < (2 + FIVEBAND_NUMBANDS) * sizeof(int16_t)) {
+ constexpr uint32_t valueSizeRequired = (2 + FIVEBAND_NUMBANDS) * sizeof(int16_t);
+ if (valueSize < valueSizeRequired) {
android_errorWriteLog(0x534e4554, "37563371");
- ALOGE("\tERROR Equalizer_setParameter() EQ_PARAM_PROPERTIES valueSize %d < %d",
- (int)valueSize, (int)((2 + FIVEBAND_NUMBANDS) * sizeof(int16_t)));
+ ALOGE("%s EQ_PARAM_PROPERTIES invalid valueSize %u < %u",
+ __func__, valueSize, valueSizeRequired);
status = -EINVAL;
break;
}
if ((int)p[1] != FIVEBAND_NUMBANDS) {
+ ALOGV("%s EQ_PARAM_PROPERTIES invalid bands %d", __func__, (int)p[1]);
status = -EINVAL;
break;
}
@@ -2561,13 +2848,14 @@
}
}
} break;
+
default:
- ALOGV("\tLVM_ERROR : Equalizer_setParameter() invalid param %d", param);
+ ALOGV("%s invalid param %d", __func__, params[0]);
status = -EINVAL;
break;
}
- //ALOGV("\tEqualizer_setParameter end");
+ ALOGVV("%s end param: %d, status: %d", __func__, params[0], status);
return status;
} /* end Equalizer_setParameter */
@@ -2592,79 +2880,92 @@
//
//----------------------------------------------------------------------------
-int Volume_getParameter(EffectContext *pContext,
- void *pParam,
- uint32_t *pValueSize,
- void *pValue){
+int Volume_getParameter(EffectContext *pContext,
+ uint32_t paramSize,
+ void *pParam,
+ uint32_t *pValueSize,
+ void *pValue) {
int status = 0;
- int32_t *pParamTemp = (int32_t *)pParam;
- int32_t param = *pParamTemp++;;
+ int32_t *params = (int32_t *)pParam;
- //ALOGV("\tVolume_getParameter start");
+ ALOGVV("%s start", __func__);
- switch (param){
+ if (paramSize < sizeof(int32_t)) {
+ ALOGV("%s invalid paramSize: %u", __func__, paramSize);
+ return -EINVAL;
+ }
+ switch (params[0]) {
case VOLUME_PARAM_LEVEL:
- case VOLUME_PARAM_MAXLEVEL:
- case VOLUME_PARAM_STEREOPOSITION:
- if (*pValueSize != sizeof(int16_t)){
- ALOGV("\tLVM_ERROR : Volume_getParameter() invalid pValueSize 1 %d", *pValueSize);
- return -EINVAL;
+ if (*pValueSize != sizeof(int16_t)) { // legacy: check equality here.
+ ALOGV("%s VOLUME_PARAM_LEVEL invalid *pValueSize %u", __func__, *pValueSize);
+ status = -EINVAL;
+ break;
}
- *pValueSize = sizeof(int16_t);
+ // no need to set *pValueSize
+
+ status = VolumeGetVolumeLevel(pContext, (int16_t *)(pValue));
+ ALOGVV("%s VOLUME_PARAM_LEVEL %d", __func__, *(int16_t *)pValue);
+ break;
+
+ case VOLUME_PARAM_MAXLEVEL:
+ if (*pValueSize != sizeof(int16_t)) { // legacy: check equality here.
+ ALOGV("%s VOLUME_PARAM_MAXLEVEL invalid *pValueSize %u", __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ // no need to set *pValueSize
+
+ // in millibel
+ *(int16_t *)pValue = 0;
+ ALOGVV("%s VOLUME_PARAM_MAXLEVEL %d", __func__, *(int16_t *)pValue);
+ break;
+
+ case VOLUME_PARAM_STEREOPOSITION:
+ if (*pValueSize != sizeof(int16_t)) { // legacy: check equality here.
+ ALOGV("%s VOLUME_PARAM_STEREOPOSITION invalid *pValueSize %u",
+ __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ // no need to set *pValueSize
+
+ VolumeGetStereoPosition(pContext, (int16_t *)pValue);
+ ALOGVV("%s VOLUME_PARAM_STEREOPOSITION %d", __func__, *(int16_t *)pValue);
break;
case VOLUME_PARAM_MUTE:
+ if (*pValueSize < sizeof(uint32_t)) {
+ ALOGV("%s VOLUME_PARAM_MUTE invalid *pValueSize %u", __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ *pValueSize = sizeof(uint32_t);
+
+ status = VolumeGetMute(pContext, (uint32_t *)pValue);
+ ALOGV("%s VOLUME_PARAM_MUTE %u", __func__, *(uint32_t *)pValue);
+ break;
+
case VOLUME_PARAM_ENABLESTEREOPOSITION:
- if (*pValueSize < sizeof(int32_t)){
- ALOGV("\tLVM_ERROR : Volume_getParameter() invalid pValueSize 2 %d", *pValueSize);
- return -EINVAL;
+ if (*pValueSize < sizeof(int32_t)) {
+ ALOGV("%s VOLUME_PARAM_ENABLESTEREOPOSITION invalid *pValueSize %u",
+ __func__, *pValueSize);
+ status = -EINVAL;
+ break;
}
*pValueSize = sizeof(int32_t);
- break;
- default:
- ALOGV("\tLVM_ERROR : Volume_getParameter unknown param %d", param);
- return -EINVAL;
- }
-
- switch (param){
- case VOLUME_PARAM_LEVEL:
- status = VolumeGetVolumeLevel(pContext, (int16_t *)(pValue));
- //ALOGV("\tVolume_getParameter() VOLUME_PARAM_LEVEL Value is %d",
- // *(int16_t *)pValue);
- break;
-
- case VOLUME_PARAM_MAXLEVEL:
- *(int16_t *)pValue = 0;
- //ALOGV("\tVolume_getParameter() VOLUME_PARAM_MAXLEVEL Value is %d",
- // *(int16_t *)pValue);
- break;
-
- case VOLUME_PARAM_STEREOPOSITION:
- VolumeGetStereoPosition(pContext, (int16_t *)pValue);
- //ALOGV("\tVolume_getParameter() VOLUME_PARAM_STEREOPOSITION Value is %d",
- // *(int16_t *)pValue);
- break;
-
- case VOLUME_PARAM_MUTE:
- status = VolumeGetMute(pContext, (uint32_t *)pValue);
- ALOGV("\tVolume_getParameter() VOLUME_PARAM_MUTE Value is %d",
- *(uint32_t *)pValue);
- break;
-
- case VOLUME_PARAM_ENABLESTEREOPOSITION:
*(int32_t *)pValue = pContext->pBundledContext->bStereoPositionEnabled;
- //ALOGV("\tVolume_getParameter() VOLUME_PARAM_ENABLESTEREOPOSITION Value is %d",
- // *(uint32_t *)pValue);
+ ALOGVV("%s VOLUME_PARAM_ENABLESTEREOPOSITION %d", __func__, *(int32_t *)pValue);
+
break;
default:
- ALOGV("\tLVM_ERROR : Volume_getParameter() invalid param %d", param);
+ ALOGV("%s invalid param %d", __func__, params[0]);
status = -EINVAL;
break;
}
- //ALOGV("\tVolume_getParameter end");
+ ALOGVV("%s end param: %d, status: %d", __func__, params[0], status);
return status;
} /* end Volume_getParameter */
@@ -2684,55 +2985,87 @@
//
//----------------------------------------------------------------------------
-int Volume_setParameter (EffectContext *pContext, void *pParam, void *pValue){
- int status = 0;
- int16_t level;
- int16_t position;
- uint32_t mute;
- uint32_t positionEnabled;
- int32_t *pParamTemp = (int32_t *)pParam;
- int32_t param = *pParamTemp++;
+int Volume_setParameter(EffectContext *pContext,
+ uint32_t paramSize,
+ void *pParam,
+ uint32_t valueSize,
+ void *pValue) {
+ int status = 0;
+ int32_t *params = (int32_t *)pParam;
- //ALOGV("\tVolume_setParameter start");
+ ALOGVV("%s start", __func__);
- switch (param){
- case VOLUME_PARAM_LEVEL:
- level = *(int16_t *)pValue;
- //ALOGV("\tVolume_setParameter() VOLUME_PARAM_LEVEL value is %d", level);
- //ALOGV("\tVolume_setParameter() Calling pVolume->setVolumeLevel");
- status = VolumeSetVolumeLevel(pContext, (int16_t)level);
- //ALOGV("\tVolume_setParameter() Called pVolume->setVolumeLevel");
- break;
+ if (paramSize < sizeof(int32_t)) {
+ ALOGV("%s invalid paramSize: %u", __func__, paramSize);
+ return -EINVAL;
+ }
+ switch (params[0]) {
+ case VOLUME_PARAM_LEVEL: {
+ if (valueSize < sizeof(int16_t)) {
+ ALOGV("%s VOLUME_PARAM_LEVEL invalid valueSize %u", __func__, valueSize);
+ status = -EINVAL;
+ break;
+ }
- case VOLUME_PARAM_MUTE:
- mute = *(uint32_t *)pValue;
- //ALOGV("\tVolume_setParameter() Calling pVolume->setMute, mute is %d", mute);
- //ALOGV("\tVolume_setParameter() Calling pVolume->setMute");
+ const int16_t level = *(int16_t *)pValue;
+ ALOGVV("%s VOLUME_PARAM_LEVEL %d", __func__, level);
+ ALOGVV("%s VOLUME_PARAM_LEVEL Calling VolumeSetVolumeLevel", __func__);
+ status = VolumeSetVolumeLevel(pContext, level);
+ ALOGVV("%s VOLUME_PARAM_LEVEL Called VolumeSetVolumeLevel", __func__);
+ } break;
+
+ case VOLUME_PARAM_MUTE: {
+ if (valueSize < sizeof(uint32_t)) {
+ ALOGV("%s VOLUME_PARAM_MUTE invalid valueSize %u", __func__, valueSize);
+ android_errorWriteLog(0x534e4554, "64477217");
+ status = -EINVAL;
+ break;
+ }
+
+ const uint32_t mute = *(uint32_t *)pValue;
+ ALOGVV("%s VOLUME_PARAM_MUTE %d", __func__, mute);
+ ALOGVV("%s VOLUME_PARAM_MUTE Calling VolumeSetMute", __func__);
status = VolumeSetMute(pContext, mute);
- //ALOGV("\tVolume_setParameter() Called pVolume->setMute");
- break;
+ ALOGVV("%s VOLUME_PARAM_MUTE Called VolumeSetMute", __func__);
+ } break;
- case VOLUME_PARAM_ENABLESTEREOPOSITION:
- positionEnabled = *(uint32_t *)pValue;
- (void) VolumeEnableStereoPosition(pContext, positionEnabled);
- (void) VolumeSetStereoPosition(pContext, pContext->pBundledContext->positionSaved);
- //ALOGV("\tVolume_setParameter() VOLUME_PARAM_ENABLESTEREOPOSITION called");
- break;
+ case VOLUME_PARAM_ENABLESTEREOPOSITION: {
+ if (valueSize < sizeof(uint32_t)) {
+ ALOGV("%s VOLUME_PARAM_ENABLESTEREOPOSITION invalid valueSize %u",
+ __func__, valueSize);
+ status = -EINVAL;
+ break;
+ }
- case VOLUME_PARAM_STEREOPOSITION:
- position = *(int16_t *)pValue;
- //ALOGV("\tVolume_setParameter() VOLUME_PARAM_STEREOPOSITION value is %d", position);
- //ALOGV("\tVolume_setParameter() Calling pVolume->VolumeSetStereoPosition");
- status = VolumeSetStereoPosition(pContext, (int16_t)position);
- //ALOGV("\tVolume_setParameter() Called pVolume->VolumeSetStereoPosition");
- break;
+ const uint32_t positionEnabled = *(uint32_t *)pValue;
+ status = VolumeEnableStereoPosition(pContext, positionEnabled)
+ ?: VolumeSetStereoPosition(pContext, pContext->pBundledContext->positionSaved);
+ ALOGVV("%s VOLUME_PARAM_ENABLESTEREOPOSITION called", __func__);
+ } break;
+
+ case VOLUME_PARAM_STEREOPOSITION: {
+ if (valueSize < sizeof(int16_t)) {
+ ALOGV("%s VOLUME_PARAM_STEREOPOSITION invalid valueSize %u", __func__, valueSize);
+ status = -EINVAL;
+ break;
+ }
+
+ const int16_t position = *(int16_t *)pValue;
+ ALOGVV("%s VOLUME_PARAM_STEREOPOSITION %d", __func__, position);
+ ALOGVV("%s VOLUME_PARAM_STEREOPOSITION Calling VolumeSetStereoPosition",
+ __func__);
+ status = VolumeSetStereoPosition(pContext, position);
+ ALOGVV("%s VOLUME_PARAM_STEREOPOSITION Called VolumeSetStereoPosition",
+ __func__);
+ } break;
default:
- ALOGV("\tLVM_ERROR : Volume_setParameter() invalid param %d", param);
+ ALOGV("%s invalid param %d", __func__, params[0]);
+ status = -EINVAL;
break;
}
- //ALOGV("\tVolume_setParameter end");
+ ALOGVV("%s end param: %d, status: %d", __func__, params[0], status);
return status;
} /* end Volume_setParameter */
@@ -3050,6 +3383,13 @@
return status;
} /* end Effect_process */
+// The value offset of an effect parameter is computed by rounding up
+// the parameter size to the next 32 bit alignment.
+static inline uint32_t computeParamVOffset(const effect_param_t *p) {
+ return ((p->psize + sizeof(int32_t) - 1) / sizeof(int32_t)) *
+ sizeof(int32_t);
+}
+
/* Effect Control Interface Implementation: Command */
int Effect_command(effect_handle_t self,
uint32_t cmdCode,
@@ -3160,8 +3500,7 @@
ALOGV("\tLVM_ERROR : EFFECT_CMD_GET_PARAM: psize too big");
return -EINVAL;
}
- uint32_t paddedParamSize = ((p->psize + sizeof(int32_t) - 1) / sizeof(int32_t)) *
- sizeof(int32_t);
+ const uint32_t paddedParamSize = computeParamVOffset(p);
if ((EFFECT_PARAM_SIZE_MAX - sizeof(effect_param_t) < paddedParamSize) ||
(EFFECT_PARAM_SIZE_MAX - sizeof(effect_param_t) - paddedParamSize <
p->vsize)) {
@@ -3183,6 +3522,7 @@
uint32_t voffset = paddedParamSize;
if(pContext->EffectType == LVM_BASS_BOOST){
p->status = android::BassBoost_getParameter(pContext,
+ p->psize,
p->data,
&p->vsize,
p->data + voffset);
@@ -3195,6 +3535,7 @@
if(pContext->EffectType == LVM_VIRTUALIZER){
p->status = android::Virtualizer_getParameter(pContext,
+ p->psize,
(void *)p->data,
&p->vsize,
p->data + voffset);
@@ -3209,6 +3550,7 @@
//ALOGV("\tEqualizer_command cmdCode Case: "
// "EFFECT_CMD_GET_PARAM start");
p->status = android::Equalizer_getParameter(pContext,
+ p->psize,
p->data,
&p->vsize,
p->data + voffset);
@@ -3223,6 +3565,7 @@
if(pContext->EffectType == LVM_VOLUME){
//ALOGV("\tVolume_command cmdCode Case: EFFECT_CMD_GET_PARAM start");
p->status = android::Volume_getParameter(pContext,
+ p->psize,
(void *)p->data,
&p->vsize,
p->data + voffset);
@@ -3252,13 +3595,9 @@
"EFFECT_CMD_SET_PARAM: ERROR");
return -EINVAL;
}
- effect_param_t *p = (effect_param_t *) pCmdData;
- if (p->psize != sizeof(int32_t)){
- ALOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: "
- "EFFECT_CMD_SET_PARAM: ERROR, psize is not sizeof(int32_t)");
- return -EINVAL;
- }
+ effect_param_t * const p = (effect_param_t *) pCmdData;
+ const uint32_t voffset = computeParamVOffset(p);
//ALOGV("\tnBassBoost_command cmdSize is %d\n"
// "\tsizeof(effect_param_t) is %d\n"
@@ -3268,8 +3607,10 @@
// cmdSize, sizeof(effect_param_t), p->psize, p->vsize );
*(int *)pReplyData = android::BassBoost_setParameter(pContext,
- (void *)p->data,
- p->data + p->psize);
+ p->psize,
+ (void *)p->data,
+ p->vsize,
+ p->data + voffset);
}
if(pContext->EffectType == LVM_VIRTUALIZER){
// Warning this log will fail to properly read an int32_t value, assumes int16_t
@@ -3287,13 +3628,9 @@
"EFFECT_CMD_SET_PARAM: ERROR");
return -EINVAL;
}
- effect_param_t *p = (effect_param_t *) pCmdData;
- if (p->psize != sizeof(int32_t)){
- ALOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: "
- "EFFECT_CMD_SET_PARAM: ERROR, psize is not sizeof(int32_t)");
- return -EINVAL;
- }
+ effect_param_t * const p = (effect_param_t *) pCmdData;
+ const uint32_t voffset = computeParamVOffset(p);
//ALOGV("\tnVirtualizer_command cmdSize is %d\n"
// "\tsizeof(effect_param_t) is %d\n"
@@ -3303,8 +3640,10 @@
// cmdSize, sizeof(effect_param_t), p->psize, p->vsize );
*(int *)pReplyData = android::Virtualizer_setParameter(pContext,
- (void *)p->data,
- p->data + p->psize);
+ p->psize,
+ (void *)p->data,
+ p->vsize,
+ p->data + voffset);
}
if(pContext->EffectType == LVM_EQUALIZER){
//ALOGV("\tEqualizer_command cmdCode Case: "
@@ -3320,12 +3659,15 @@
"EFFECT_CMD_SET_PARAM: ERROR");
return -EINVAL;
}
- effect_param_t *p = (effect_param_t *) pCmdData;
+
+ effect_param_t * const p = (effect_param_t *) pCmdData;
+ const uint32_t voffset = computeParamVOffset(p);
*(int *)pReplyData = android::Equalizer_setParameter(pContext,
- (void *)p->data,
- p->vsize,
- p->data + p->psize);
+ p->psize,
+ (void *)p->data,
+ p->vsize,
+ p->data + voffset);
}
if(pContext->EffectType == LVM_VOLUME){
//ALOGV("\tVolume_command cmdCode Case: EFFECT_CMD_SET_PARAM start");
@@ -3342,11 +3684,15 @@
"EFFECT_CMD_SET_PARAM: ERROR");
return -EINVAL;
}
- effect_param_t *p = (effect_param_t *) pCmdData;
+
+ effect_param_t * const p = (effect_param_t *) pCmdData;
+ const uint32_t voffset = computeParamVOffset(p);
*(int *)pReplyData = android::Volume_setParameter(pContext,
- (void *)p->data,
- p->data + p->psize);
+ p->psize,
+ (void *)p->data,
+ p->vsize,
+ p->data + voffset);
}
//ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_PARAM end");
} break;
@@ -3493,10 +3839,10 @@
if(rightdB > maxdB){
maxdB = rightdB;
}
- //ALOGV("\tEFFECT_CMD_SET_VOLUME Session: %d, SessionID: %d VOLUME is %d dB (%d), "
+ //ALOGV("\tEFFECT_CMD_SET_VOLUME Session: %d, SessionID: %d VOLUME is %d dB, "
// "effect is %d",
//pContext->pBundledContext->SessionNo, pContext->pBundledContext->SessionId,
- //(int32_t)maxdB, maxVol<<7, pContext->EffectType);
+ //(int32_t)maxdB, pContext->EffectType);
//ALOGV("\tEFFECT_CMD_SET_VOLUME: Left is %d, Right is %d", leftVolume, rightVolume);
//ALOGV("\tEFFECT_CMD_SET_VOLUME: Left %ddB, Right %ddB, Position %ddB",
// leftdB, rightdB, pandB);
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
index ee604eb..291383a 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
@@ -103,6 +103,10 @@
FILE *PcmInPtr;
FILE *PcmOutPtr;
#endif
+ #ifdef BUILD_FLOAT
+ LVM_FLOAT *pInputBuffer;
+ LVM_FLOAT *pOutputBuffer;
+ #endif
};
/* SessionContext : One session */
@@ -209,7 +213,7 @@
static const float LimitLevel_bassBoostEnergyCrossCoefficient[FIVEBAND_NUMBANDS] = {
221.21, 208.10, 28.16, 0.0, 0.0 };
-static const float LimitLevel_bassBoostEnergyCoefficient = 7.12;
+static const float LimitLevel_bassBoostEnergyCoefficient = 9.00;
static const float LimitLevel_virtualizerContribution = 1.9;
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
index 6d7d4cd..ee9406d 100644
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
@@ -14,7 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+#ifndef LVM_FLOAT
+typedef float LVM_FLOAT;
+#endif
#define LOG_TAG "Reverb"
#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array)[0])
//#define LOG_NDEBUG 0
@@ -152,6 +154,8 @@
LVM_Fs_en SampleRate;
LVM_INT32 *InFrames32;
LVM_INT32 *OutFrames32;
+ size_t bufferSizeIn;
+ size_t bufferSizeOut;
bool auxiliary;
bool preset;
uint16_t curPreset;
@@ -172,8 +176,11 @@
#define REVERB_DEFAULT_PRESET REVERB_PRESET_NONE
-
+#ifdef BUILD_FLOAT
+#define REVERB_SEND_LEVEL 0.75f // 0.75 in 4.12 format
+#else
#define REVERB_SEND_LEVEL (0x0C00) // 0.75 in 4.12 format
+#endif
#define REVERB_UNIT_VOLUME (0x1000) // 1.0 in 4.12 format
//--- local function prototypes
@@ -270,8 +277,15 @@
// Allocate memory for reverb process (*2 is for STEREO)
- pContext->InFrames32 = (LVM_INT32 *)malloc(LVREV_MAX_FRAME_SIZE * sizeof(LVM_INT32) * 2);
- pContext->OutFrames32 = (LVM_INT32 *)malloc(LVREV_MAX_FRAME_SIZE * sizeof(LVM_INT32) * 2);
+#ifdef BUILD_FLOAT
+ pContext->bufferSizeIn = LVREV_MAX_FRAME_SIZE * sizeof(float) * 2;
+ pContext->bufferSizeOut = pContext->bufferSizeIn;
+#else
+ pContext->bufferSizeIn = LVREV_MAX_FRAME_SIZE * sizeof(LVM_INT32) * 2;
+ pContext->bufferSizeOut = pContext->bufferSizeIn;
+#endif
+ pContext->InFrames32 = (LVM_INT32 *)malloc(pContext->bufferSizeIn);
+ pContext->OutFrames32 = (LVM_INT32 *)malloc(pContext->bufferSizeOut);
ALOGV("\tEffectCreate %p, size %zu", pContext, sizeof(ReverbContext));
ALOGV("\tEffectCreate end\n");
@@ -293,6 +307,8 @@
#endif
free(pContext->InFrames32);
free(pContext->OutFrames32);
+ pContext->bufferSizeIn = 0;
+ pContext->bufferSizeOut = 0;
Reverb_free(pContext);
delete pContext;
return 0;
@@ -389,6 +405,46 @@
}
#endif
+#ifdef BUILD_FLOAT
+/**********************************************************************************
+ FUNCTION INT16LTOFLOAT
+***********************************************************************************/
+// Todo: need to write function descriptor
+static void Int16ToFloat(const LVM_INT16 *src, LVM_FLOAT *dst, size_t n) {
+ size_t ii;
+ src += n-1;
+ dst += n-1;
+ for (ii = n; ii != 0; ii--) {
+ *dst = ((LVM_FLOAT)((LVM_INT16)*src)) / 32768.0f;
+ src--;
+ dst--;
+ }
+ return;
+}
+/**********************************************************************************
+ FUNCTION FLOATTOINT16_SAT
+***********************************************************************************/
+// Todo : Need to write function descriptor
+static void FloatToInt16_SAT(const LVM_FLOAT *src, LVM_INT16 *dst, size_t n) {
+ size_t ii;
+ LVM_INT32 temp;
+
+ for (ii = 0; ii < n; ii++) {
+ temp = (LVM_INT32)((*src) * 32768.0f);
+ if (temp >= 32767) {
+ *dst = 32767;
+ } else if (temp <= -32768) {
+ *dst = -32768;
+ } else {
+ *dst = (LVM_INT16)temp;
+ }
+ src++;
+ dst++;
+ }
+ return;
+}
+#endif
+
static inline int16_t clamp16(int32_t sample)
{
if ((sample>>15) ^ (sample>>31))
@@ -422,8 +478,31 @@
LVM_INT16 samplesPerFrame = 1;
LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
LVM_INT16 *OutFrames16;
+#ifdef BUILD_FLOAT
+ LVM_FLOAT *pInputBuff;
+ LVM_FLOAT *pOutputBuff;
+#endif
-
+#ifdef BUILD_FLOAT
+ if (pContext->InFrames32 == NULL ||
+ pContext->bufferSizeIn < frameCount * sizeof(float) * 2) {
+ if (pContext->InFrames32 != NULL) {
+ free(pContext->InFrames32);
+ }
+ pContext->bufferSizeIn = frameCount * sizeof(float) * 2;
+ pContext->InFrames32 = (LVM_INT32 *)malloc(pContext->bufferSizeIn);
+ }
+ if (pContext->OutFrames32 == NULL ||
+ pContext->bufferSizeOut < frameCount * sizeof(float) * 2) {
+ if (pContext->OutFrames32 != NULL) {
+ free(pContext->OutFrames32);
+ }
+ pContext->bufferSizeOut = frameCount * sizeof(float) * 2;
+ pContext->OutFrames32 = (LVM_INT32 *)malloc(pContext->bufferSizeOut);
+ }
+ pInputBuff = (float *)pContext->InFrames32;
+ pOutputBuff = (float *)pContext->OutFrames32;
+#endif
// Check that the input is either mono or stereo
if (pContext->config.inputCfg.channels == AUDIO_CHANNEL_OUT_STEREO) {
samplesPerFrame = 2;
@@ -449,49 +528,84 @@
Reverb_LoadPreset(pContext);
}
-
-
// Convert to Input 32 bits
if (pContext->auxiliary) {
+#ifdef BUILD_FLOAT
+ Int16ToFloat(pIn, pInputBuff, frameCount * samplesPerFrame);
+#else
for(int i=0; i<frameCount*samplesPerFrame; i++){
pContext->InFrames32[i] = (LVM_INT32)pIn[i]<<8;
}
- } else {
+#endif
+ } else {
// insert reverb input is always stereo
for (int i = 0; i < frameCount; i++) {
+#ifndef BUILD_FLOAT
pContext->InFrames32[2*i] = (pIn[2*i] * REVERB_SEND_LEVEL) >> 4; // <<8 + >>12
pContext->InFrames32[2*i+1] = (pIn[2*i+1] * REVERB_SEND_LEVEL) >> 4; // <<8 + >>12
+#else
+ pInputBuff[2 * i] = (LVM_FLOAT)pIn[2 * i] * REVERB_SEND_LEVEL / 32768.0f;
+ pInputBuff[2 * i + 1] = (LVM_FLOAT)pIn[2 * i + 1] * REVERB_SEND_LEVEL / 32768.0f;
+#endif
}
}
if (pContext->preset && pContext->curPreset == REVERB_PRESET_NONE) {
+#ifdef BUILD_FLOAT
+ memset(pOutputBuff, 0, frameCount * sizeof(LVM_FLOAT) * 2); //always stereo here
+#else
memset(pContext->OutFrames32, 0, frameCount * sizeof(LVM_INT32) * 2); //always stereo here
+#endif
} else {
if(pContext->bEnabled == LVM_FALSE && pContext->SamplesToExitCount > 0) {
+#ifdef BUILD_FLOAT
+ memset(pInputBuff, 0, frameCount * sizeof(LVM_FLOAT) * samplesPerFrame);
+#else
memset(pContext->InFrames32,0,frameCount * sizeof(LVM_INT32) * samplesPerFrame);
+#endif
ALOGV("\tZeroing %d samples per frame at the end of call", samplesPerFrame);
}
/* Process the samples, producing a stereo output */
+#ifdef BUILD_FLOAT
+ LvmStatus = LVREV_Process(pContext->hInstance, /* Instance handle */
+ pInputBuff, /* Input buffer */
+ pOutputBuff, /* Output buffer */
+ frameCount); /* Number of samples to read */
+#else
LvmStatus = LVREV_Process(pContext->hInstance, /* Instance handle */
pContext->InFrames32, /* Input buffer */
pContext->OutFrames32, /* Output buffer */
frameCount); /* Number of samples to read */
- }
+#endif
+ }
LVM_ERROR_CHECK(LvmStatus, "LVREV_Process", "process")
if(LvmStatus != LVREV_SUCCESS) return -EINVAL;
// Convert to 16 bits
if (pContext->auxiliary) {
+#ifdef BUILD_FLOAT
+ FloatToInt16_SAT(pOutputBuff, OutFrames16, (size_t)frameCount * 2);
+#else
for (int i=0; i < frameCount*2; i++) { //always stereo here
OutFrames16[i] = clamp16(pContext->OutFrames32[i]>>8);
}
- } else {
- for (int i=0; i < frameCount*2; i++) { //always stereo here
- OutFrames16[i] = clamp16((pContext->OutFrames32[i]>>8) + (LVM_INT32)pIn[i]);
- }
+#endif
+ } else {
+#ifdef BUILD_FLOAT
+ for (int i = 0; i < frameCount * 2; i++) {//always stereo here
+ //pOutputBuff and OutFrames16 point to the same buffer, so better to
+ //accumulate in pInputBuff, which is available
+ pInputBuff[i] = pOutputBuff[i] + (LVM_FLOAT)pIn[i] / 32768.0f;
+ }
+ FloatToInt16_SAT(pInputBuff, OutFrames16, (size_t)frameCount * 2);
+#else
+ for (int i=0; i < frameCount*2; i++) { //always stereo here
+ OutFrames16[i] = clamp16((pContext->OutFrames32[i]>>8) + (LVM_INT32)pIn[i]);
+ }
+#endif
// apply volume with ramp if needed
if ((pContext->leftVolume != pContext->prevLeftVolume ||
pContext->rightVolume != pContext->prevRightVolume) &&
@@ -644,6 +758,14 @@
case 48000:
SampleRate = LVM_FS_48000;
break;
+#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
+ case 96000:
+ SampleRate = LVM_FS_96000;
+ break;
+ case 192000:
+ SampleRate = LVM_FS_192000;
+ break;
+#endif
default:
ALOGV("\rReverb_setConfig invalid sampling rate %d", pConfig->inputCfg.samplingRate);
return -EINVAL;
@@ -1011,7 +1133,7 @@
//ALOGV("\tReverbGetRoomHfLevel() ActiveParams.LPFL %d, pContext->SavedHfLevel: %d, "
// "converted level: %d\n", ActiveParams.LPF, pContext->SavedHfLevel, level);
- if(ActiveParams.LPF != level){
+ if((int16_t)ActiveParams.LPF != level){
ALOGV("\tLVM_ERROR : (ignore at start up) ReverbGetRoomHfLevel() has wrong level -> %d %d\n",
ActiveParams.Level, level);
}
diff --git a/media/libeffects/visualizer/EffectVisualizer.cpp b/media/libeffects/visualizer/EffectVisualizer.cpp
index 0e82339..807f24d 100644
--- a/media/libeffects/visualizer/EffectVisualizer.cpp
+++ b/media/libeffects/visualizer/EffectVisualizer.cpp
@@ -594,7 +594,9 @@
deltaSmpl = CAPTURE_BUF_SIZE;
}
- int32_t capturePoint = pContext->mCaptureIdx - deltaSmpl;
+ int32_t capturePoint;
+ //capturePoint = (int32_t)pContext->mCaptureIdx - deltaSmpl;
+ __builtin_sub_overflow((int32_t)pContext->mCaptureIdx, deltaSmpl, &capturePoint);
// a negative capturePoint means we wrap the buffer.
if (capturePoint < 0) {
uint32_t size = -capturePoint;
diff --git a/media/libheif/Android.bp b/media/libheif/Android.bp
new file mode 100644
index 0000000..7d5a4eb
--- /dev/null
+++ b/media/libheif/Android.bp
@@ -0,0 +1,23 @@
+cc_library_shared {
+ name: "libheif",
+
+ srcs: [
+ "HeifDecoderImpl.cpp",
+ ],
+
+ shared_libs: [
+ "libbinder",
+ "liblog",
+ "libutils",
+ "libmedia",
+ ],
+
+ cflags: [
+ "-Werror",
+ "-Wall",
+ ],
+
+ include_dirs: [],
+
+ export_include_dirs: ["include"],
+}
diff --git a/media/libheif/HeifDecoderImpl.cpp b/media/libheif/HeifDecoderImpl.cpp
new file mode 100644
index 0000000..4b131a7
--- /dev/null
+++ b/media/libheif/HeifDecoderImpl.cpp
@@ -0,0 +1,439 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "HeifDecoderImpl"
+
+#include "HeifDecoderImpl.h"
+
+#include <stdio.h>
+
+#include <binder/IMemory.h>
+#include <drm/drm_framework_common.h>
+#include <media/IDataSource.h>
+#include <media/mediametadataretriever.h>
+#include <media/stagefright/foundation/ADebug.h>
+#include <media/stagefright/MediaSource.h>
+#include <private/media/VideoFrame.h>
+#include <utils/Log.h>
+#include <utils/RefBase.h>
+
+HeifDecoder* createHeifDecoder() {
+ return new android::HeifDecoderImpl();
+}
+
+namespace android {
+
+/*
+ * HeifDataSource
+ *
+ * Proxies data requests over IDataSource interface from MediaMetadataRetriever
+ * to the HeifStream interface we received from the heif decoder client.
+ */
+class HeifDataSource : public BnDataSource {
+public:
+ /*
+ * Constructs HeifDataSource; will take ownership of |stream|.
+ */
+ HeifDataSource(HeifStream* stream)
+ : mStream(stream), mEOS(false),
+ mCachedOffset(0), mCachedSize(0), mCacheBufferSize(0) {}
+
+ ~HeifDataSource() override {}
+
+ /*
+ * Initializes internal resources.
+ */
+ bool init();
+
+ sp<IMemory> getIMemory() override { return mMemory; }
+ ssize_t readAt(off64_t offset, size_t size) override;
+ status_t getSize(off64_t* size) override ;
+ void close() {}
+ uint32_t getFlags() override { return 0; }
+ String8 toString() override { return String8("HeifDataSource"); }
+ sp<DecryptHandle> DrmInitialization(const char*) override {
+ return nullptr;
+ }
+
+private:
+ enum {
+ /*
+ * Buffer size for passing the read data to mediaserver. Set to 64K
+ * (which is what MediaDataSource Java API's jni implementation uses).
+ */
+ kBufferSize = 64 * 1024,
+ /*
+ * Initial and max cache buffer size.
+ */
+ kInitialCacheBufferSize = 4 * 1024 * 1024,
+ kMaxCacheBufferSize = 64 * 1024 * 1024,
+ };
+ sp<IMemory> mMemory;
+ std::unique_ptr<HeifStream> mStream;
+ bool mEOS;
+ std::unique_ptr<uint8_t> mCache;
+ off64_t mCachedOffset;
+ size_t mCachedSize;
+ size_t mCacheBufferSize;
+};
+
+bool HeifDataSource::init() {
+ sp<MemoryDealer> memoryDealer =
+ new MemoryDealer(kBufferSize, "HeifDataSource");
+ mMemory = memoryDealer->allocate(kBufferSize);
+ if (mMemory == nullptr) {
+ ALOGE("Failed to allocate shared memory!");
+ return false;
+ }
+ mCache.reset(new uint8_t[kInitialCacheBufferSize]);
+ if (mCache.get() == nullptr) {
+ ALOGE("mFailed to allocate cache!");
+ return false;
+ }
+ mCacheBufferSize = kInitialCacheBufferSize;
+ return true;
+}
+
+ssize_t HeifDataSource::readAt(off64_t offset, size_t size) {
+ ALOGV("readAt: offset=%lld, size=%zu", (long long)offset, size);
+
+ if (offset < mCachedOffset) {
+ // try seek, then rewind/skip, fail if none worked
+ if (mStream->seek(offset)) {
+ ALOGV("readAt: seek to offset=%lld", (long long)offset);
+ mCachedOffset = offset;
+ mCachedSize = 0;
+ mEOS = false;
+ } else if (mStream->rewind()) {
+ ALOGV("readAt: rewind to offset=0");
+ mCachedOffset = 0;
+ mCachedSize = 0;
+ mEOS = false;
+ } else {
+ ALOGE("readAt: couldn't seek or rewind!");
+ mEOS = true;
+ }
+ }
+
+ if (mEOS && (offset < mCachedOffset ||
+ offset >= (off64_t)(mCachedOffset + mCachedSize))) {
+ ALOGV("readAt: EOS");
+ return ERROR_END_OF_STREAM;
+ }
+
+ // at this point, offset must be >= mCachedOffset, other cases should
+ // have been caught above.
+ CHECK(offset >= mCachedOffset);
+
+ if (size == 0) {
+ return 0;
+ }
+
+ // Can only read max of kBufferSize
+ if (size > kBufferSize) {
+ size = kBufferSize;
+ }
+
+ // copy from cache if the request falls entirely in cache
+ if (offset + size <= mCachedOffset + mCachedSize) {
+ memcpy(mMemory->pointer(), mCache.get() + offset - mCachedOffset, size);
+ return size;
+ }
+
+ // need to fetch more, check if we need to expand the cache buffer.
+ if ((off64_t)(offset + size) > mCachedOffset + kMaxCacheBufferSize) {
+ // it's reaching max cache buffer size, need to roll window, and possibly
+ // expand the cache buffer.
+ size_t newCacheBufferSize = mCacheBufferSize;
+ std::unique_ptr<uint8_t> newCache;
+ uint8_t* dst = mCache.get();
+ if (newCacheBufferSize < kMaxCacheBufferSize) {
+ newCacheBufferSize = kMaxCacheBufferSize;
+ newCache.reset(new uint8_t[newCacheBufferSize]);
+ dst = newCache.get();
+ }
+
+ // when rolling the cache window, try to keep about half the old bytes
+ // in case that the client goes back.
+ off64_t newCachedOffset = offset - (off64_t)(newCacheBufferSize / 2);
+ if (newCachedOffset < mCachedOffset) {
+ newCachedOffset = mCachedOffset;
+ }
+
+ int64_t newCachedSize = (int64_t)(mCachedOffset + mCachedSize) - newCachedOffset;
+ if (newCachedSize > 0) {
+ // in this case, the new cache region partially overlop the old cache,
+ // move the portion of the cache we want to save to the beginning of
+ // the cache buffer.
+ memcpy(dst, mCache.get() + newCachedOffset - mCachedOffset, newCachedSize);
+ } else if (newCachedSize < 0){
+ // in this case, the new cache region is entirely out of the old cache,
+ // in order to guarantee sequential read, we need to skip a number of
+ // bytes before reading.
+ size_t bytesToSkip = -newCachedSize;
+ size_t bytesSkipped = mStream->read(nullptr, bytesToSkip);
+ if (bytesSkipped != bytesToSkip) {
+ // bytesSkipped is invalid, there is not enough bytes to reach
+ // the requested offset.
+ ALOGE("readAt: skip failed, EOS");
+
+ mEOS = true;
+ mCachedOffset = newCachedOffset;
+ mCachedSize = 0;
+ return ERROR_END_OF_STREAM;
+ }
+ // set cache size to 0, since we're not keeping any old cache
+ newCachedSize = 0;
+ }
+
+ if (newCache.get() != nullptr) {
+ mCache.reset(newCache.release());
+ mCacheBufferSize = newCacheBufferSize;
+ }
+ mCachedOffset = newCachedOffset;
+ mCachedSize = newCachedSize;
+
+ ALOGV("readAt: rolling cache window to (%lld, %zu), cache buffer size %zu",
+ (long long)mCachedOffset, mCachedSize, mCacheBufferSize);
+ } else {
+ // expand cache buffer, but no need to roll the window
+ size_t newCacheBufferSize = mCacheBufferSize;
+ while (offset + size > mCachedOffset + newCacheBufferSize) {
+ newCacheBufferSize *= 2;
+ }
+ CHECK(newCacheBufferSize <= kMaxCacheBufferSize);
+ if (mCacheBufferSize < newCacheBufferSize) {
+ uint8_t* newCache = new uint8_t[newCacheBufferSize];
+ memcpy(newCache, mCache.get(), mCachedSize);
+ mCache.reset(newCache);
+ mCacheBufferSize = newCacheBufferSize;
+
+ ALOGV("readAt: current cache window (%lld, %zu), new cache buffer size %zu",
+ (long long) mCachedOffset, mCachedSize, mCacheBufferSize);
+ }
+ }
+ size_t bytesToRead = offset + size - mCachedOffset - mCachedSize;
+ size_t bytesRead = mStream->read(mCache.get() + mCachedSize, bytesToRead);
+ if (bytesRead > bytesToRead || bytesRead == 0) {
+ // bytesRead is invalid
+ mEOS = true;
+ bytesRead = 0;
+ } else if (bytesRead < bytesToRead) {
+ // read some bytes but not all, set EOS
+ mEOS = true;
+ }
+ mCachedSize += bytesRead;
+ ALOGV("readAt: current cache window (%lld, %zu)",
+ (long long) mCachedOffset, mCachedSize);
+
+ // here bytesAvailable could be negative if offset jumped past EOS.
+ int64_t bytesAvailable = mCachedOffset + mCachedSize - offset;
+ if (bytesAvailable <= 0) {
+ return ERROR_END_OF_STREAM;
+ }
+ if (bytesAvailable < (int64_t)size) {
+ size = bytesAvailable;
+ }
+ memcpy(mMemory->pointer(), mCache.get() + offset - mCachedOffset, size);
+ return size;
+}
+
+status_t HeifDataSource::getSize(off64_t* size) {
+ if (!mStream->hasLength()) {
+ *size = -1;
+ ALOGE("getSize: not supported!");
+ return ERROR_UNSUPPORTED;
+ }
+ *size = mStream->getLength();
+ ALOGV("getSize: size=%lld", (long long)*size);
+ return OK;
+}
+
+/////////////////////////////////////////////////////////////////////////
+
+HeifDecoderImpl::HeifDecoderImpl() :
+ // output color format should always be set via setOutputColor(), in case
+ // it's not, default to HAL_PIXEL_FORMAT_RGB_565.
+ mOutputColor(HAL_PIXEL_FORMAT_RGB_565),
+ mCurScanline(0),
+ mFrameDecoded(false) {
+}
+
+HeifDecoderImpl::~HeifDecoderImpl() {
+}
+
+bool HeifDecoderImpl::init(HeifStream* stream, HeifFrameInfo* frameInfo) {
+ mFrameDecoded = false;
+ sp<HeifDataSource> dataSource = new HeifDataSource(stream);
+ if (!dataSource->init()) {
+ return false;
+ }
+ mDataSource = dataSource;
+
+ mRetriever = new MediaMetadataRetriever();
+ status_t err = mRetriever->setDataSource(mDataSource, "video/mp4");
+ if (err != OK) {
+ ALOGE("failed to set data source!");
+
+ mRetriever.clear();
+ mDataSource.clear();
+ return false;
+ }
+ ALOGV("successfully set data source.");
+
+ const char* hasVideo = mRetriever->extractMetadata(METADATA_KEY_HAS_VIDEO);
+ if (!hasVideo || strcasecmp(hasVideo, "yes")) {
+ ALOGE("no video: %s", hasVideo ? hasVideo : "null");
+ return false;
+ }
+
+ mFrameMemory = mRetriever->getFrameAtTime(0,
+ IMediaSource::ReadOptions::SEEK_PREVIOUS_SYNC,
+ mOutputColor, true /*metaOnly*/);
+ if (mFrameMemory == nullptr || mFrameMemory->pointer() == nullptr) {
+ ALOGE("getFrameAtTime: videoFrame is a nullptr");
+ return false;
+ }
+
+ VideoFrame* videoFrame = static_cast<VideoFrame*>(mFrameMemory->pointer());
+
+ ALOGV("Meta dimension %dx%d, display %dx%d, angle %d, iccSize %d",
+ videoFrame->mWidth,
+ videoFrame->mHeight,
+ videoFrame->mDisplayWidth,
+ videoFrame->mDisplayHeight,
+ videoFrame->mRotationAngle,
+ videoFrame->mIccSize);
+
+ if (frameInfo != nullptr) {
+ frameInfo->set(
+ videoFrame->mDisplayWidth,
+ videoFrame->mDisplayHeight,
+ videoFrame->mRotationAngle,
+ videoFrame->mBytesPerPixel,
+ videoFrame->mIccSize,
+ videoFrame->getFlattenedIccData());
+ }
+ return true;
+}
+
+bool HeifDecoderImpl::getEncodedColor(HeifEncodedColor* /*outColor*/) const {
+ ALOGW("getEncodedColor: not implemented!");
+ return false;
+}
+
+bool HeifDecoderImpl::setOutputColor(HeifColorFormat heifColor) {
+ switch(heifColor) {
+ case kHeifColorFormat_RGB565:
+ {
+ mOutputColor = HAL_PIXEL_FORMAT_RGB_565;
+ return true;
+ }
+ case kHeifColorFormat_RGBA_8888:
+ {
+ mOutputColor = HAL_PIXEL_FORMAT_RGBA_8888;
+ return true;
+ }
+ case kHeifColorFormat_BGRA_8888:
+ {
+ mOutputColor = HAL_PIXEL_FORMAT_BGRA_8888;
+ return true;
+ }
+ default:
+ break;
+ }
+ ALOGE("Unsupported output color format %d", heifColor);
+ return false;
+}
+
+bool HeifDecoderImpl::decode(HeifFrameInfo* frameInfo) {
+ // reset scanline pointer
+ mCurScanline = 0;
+
+ if (mFrameDecoded) {
+ return true;
+ }
+
+ mFrameMemory = mRetriever->getFrameAtTime(0,
+ IMediaSource::ReadOptions::SEEK_PREVIOUS_SYNC, mOutputColor);
+ if (mFrameMemory == nullptr || mFrameMemory->pointer() == nullptr) {
+ ALOGE("getFrameAtTime: videoFrame is a nullptr");
+ return false;
+ }
+
+ VideoFrame* videoFrame = static_cast<VideoFrame*>(mFrameMemory->pointer());
+ if (videoFrame->mSize == 0 ||
+ mFrameMemory->size() < videoFrame->getFlattenedSize()) {
+ ALOGE("getFrameAtTime: videoFrame size is invalid");
+ return false;
+ }
+
+ ALOGV("Decoded dimension %dx%d, display %dx%d, angle %d, rowbytes %d, size %d",
+ videoFrame->mWidth,
+ videoFrame->mHeight,
+ videoFrame->mDisplayWidth,
+ videoFrame->mDisplayHeight,
+ videoFrame->mRotationAngle,
+ videoFrame->mRowBytes,
+ videoFrame->mSize);
+
+ if (frameInfo != nullptr) {
+ frameInfo->set(
+ videoFrame->mDisplayWidth,
+ videoFrame->mDisplayHeight,
+ videoFrame->mRotationAngle,
+ videoFrame->mBytesPerPixel,
+ videoFrame->mIccSize,
+ videoFrame->getFlattenedIccData());
+ }
+ mFrameDecoded = true;
+
+ // Aggressive clear to avoid holding on to resources
+ mRetriever.clear();
+ mDataSource.clear();
+ return true;
+}
+
+bool HeifDecoderImpl::getScanline(uint8_t* dst) {
+ if (mFrameMemory == nullptr || mFrameMemory->pointer() == nullptr) {
+ return false;
+ }
+ VideoFrame* videoFrame = static_cast<VideoFrame*>(mFrameMemory->pointer());
+ if (mCurScanline >= videoFrame->mDisplayHeight) {
+ ALOGE("no more scanline available");
+ return false;
+ }
+ uint8_t* src = videoFrame->getFlattenedData() + videoFrame->mRowBytes * mCurScanline++;
+ memcpy(dst, src, videoFrame->mBytesPerPixel * videoFrame->mDisplayWidth);
+ return true;
+}
+
+size_t HeifDecoderImpl::skipScanlines(size_t count) {
+ if (mFrameMemory == nullptr || mFrameMemory->pointer() == nullptr) {
+ return 0;
+ }
+ VideoFrame* videoFrame = static_cast<VideoFrame*>(mFrameMemory->pointer());
+
+ uint32_t oldScanline = mCurScanline;
+ mCurScanline += count;
+ if (mCurScanline > videoFrame->mDisplayHeight) {
+ mCurScanline = videoFrame->mDisplayHeight;
+ }
+ return (mCurScanline > oldScanline) ? (mCurScanline - oldScanline) : 0;
+}
+
+} // namespace android
diff --git a/media/libheif/HeifDecoderImpl.h b/media/libheif/HeifDecoderImpl.h
new file mode 100644
index 0000000..c2e4ff3
--- /dev/null
+++ b/media/libheif/HeifDecoderImpl.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _HEIF_DECODER_IMPL_
+#define _HEIF_DECODER_IMPL_
+
+#include "include/HeifDecoderAPI.h"
+#include <system/graphics.h>
+#include <utils/RefBase.h>
+
+namespace android {
+
+class IDataSource;
+class IMemory;
+class MediaMetadataRetriever;
+
+/*
+ * An implementation of HeifDecoder based on Android's MediaMetadataRetriever.
+ */
+class HeifDecoderImpl : public HeifDecoder {
+public:
+
+ HeifDecoderImpl();
+ ~HeifDecoderImpl() override;
+
+ bool init(HeifStream* stream, HeifFrameInfo* frameInfo) override;
+
+ bool getEncodedColor(HeifEncodedColor* outColor) const override;
+
+ bool setOutputColor(HeifColorFormat heifColor) override;
+
+ bool decode(HeifFrameInfo* frameInfo) override;
+
+ bool getScanline(uint8_t* dst) override;
+
+ size_t skipScanlines(size_t count) override;
+
+private:
+ sp<IDataSource> mDataSource;
+ sp<MediaMetadataRetriever> mRetriever;
+ sp<IMemory> mFrameMemory;
+ android_pixel_format_t mOutputColor;
+ size_t mCurScanline;
+ bool mFrameDecoded;
+};
+
+} // namespace android
+
+#endif // _HEIF_DECODER_IMPL_
diff --git a/media/libheif/include/HeifDecoderAPI.h b/media/libheif/include/HeifDecoderAPI.h
new file mode 100644
index 0000000..5183c39
--- /dev/null
+++ b/media/libheif/include/HeifDecoderAPI.h
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _HEIF_DECODER_API_
+#define _HEIF_DECODER_API_
+
+#include <memory>
+
+/*
+ * The output color pixel format of heif decoder.
+ */
+typedef enum {
+ kHeifColorFormat_RGB565 = 0,
+ kHeifColorFormat_RGBA_8888 = 1,
+ kHeifColorFormat_BGRA_8888 = 2,
+} HeifColorFormat;
+
+/*
+ * The color spaces encoded in the heif image.
+ */
+typedef enum {
+ kHeifEncodedColor_RGB = 0,
+ kHeifEncodedColor_YUV = 1,
+ kHeifEncodedColor_CMYK = 2,
+} HeifEncodedColor;
+
+/*
+ * Represents a color converted (RGB-based) video frame
+ */
+struct HeifFrameInfo
+{
+ HeifFrameInfo() :
+ mWidth(0), mHeight(0), mRotationAngle(0), mBytesPerPixel(0),
+ mIccSize(0), mIccData(nullptr) {}
+
+ // update the frame info, will make a copy of |iccData| internally
+ void set(uint32_t width, uint32_t height, int32_t rotation, uint32_t bpp,
+ uint32_t iccSize, uint8_t* iccData) {
+ mWidth = width;
+ mHeight = height;
+ mRotationAngle = rotation;
+ mBytesPerPixel = bpp;
+
+ if (mIccData != nullptr) {
+ mIccData.reset(nullptr);
+ }
+ mIccSize = iccSize;
+ if (iccSize > 0) {
+ mIccData.reset(new uint8_t[iccSize]);
+ if (mIccData.get() != nullptr) {
+ memcpy(mIccData.get(), iccData, iccSize);
+ } else {
+ mIccSize = 0;
+ }
+ }
+ }
+
+ // Intentional public access modifiers:
+ uint32_t mWidth;
+ uint32_t mHeight;
+ int32_t mRotationAngle; // Rotation angle, clockwise, should be multiple of 90
+ uint32_t mBytesPerPixel; // Number of bytes for one pixel
+ uint32_t mIccSize; // Number of bytes in mIccData
+ std::unique_ptr<uint8_t> mIccData; // Actual ICC data, memory is owned by this structure
+};
+
+/*
+ * Abstract interface to provide data to HeifDecoder.
+ */
+struct HeifStream {
+ HeifStream() {}
+
+ virtual ~HeifStream() {}
+
+ /*
+ * Reads or skips size number of bytes. return the number of bytes actually
+ * read or skipped.
+ * If |buffer| == NULL, skip size bytes, return how many were skipped.
+ * If |buffer| != NULL, copy size bytes into buffer, return how many were copied.
+ */
+ virtual size_t read(void* buffer, size_t size) = 0;
+
+ /*
+ * Rewinds to the beginning of the stream. Returns true if the stream is known
+ * to be at the beginning after this call returns.
+ */
+ virtual bool rewind() = 0;
+
+ /*
+ * Seeks to an absolute position in the stream. If this cannot be done, returns false.
+ * If an attempt is made to seek past the end of the stream, the position will be set
+ * to the end of the stream.
+ */
+ virtual bool seek(size_t /*position*/) = 0;
+
+ /** Returns true if this stream can report its total length. */
+ virtual bool hasLength() const = 0;
+
+ /** Returns the total length of the stream. If this cannot be done, returns 0. */
+ virtual size_t getLength() const = 0;
+
+private:
+ HeifStream(const HeifFrameInfo&) = delete;
+ HeifStream& operator=(const HeifFrameInfo&) = delete;
+};
+
+/*
+ * Abstract interface to decode heif images from a HeifStream data source.
+ */
+struct HeifDecoder {
+ HeifDecoder() {}
+
+ virtual ~HeifDecoder() {}
+
+ /*
+ * Returns true if it successfully sets outColor to the encoded color,
+ * and false otherwise.
+ */
+ virtual bool getEncodedColor(HeifEncodedColor* outColor) const = 0;
+
+ /*
+ * Returns true if it successfully sets the output color format to color,
+ * and false otherwise.
+ */
+ virtual bool setOutputColor(HeifColorFormat color) = 0;
+
+ /*
+ * Returns true if it successfully initialize heif decoder with source,
+ * and false otherwise. |frameInfo| will be filled with information of
+ * the primary picture upon success and unmodified upon failure.
+ * Takes ownership of |stream| regardless of result.
+ */
+ virtual bool init(HeifStream* stream, HeifFrameInfo* frameInfo) = 0;
+
+ /*
+ * Decode the picture internally, returning whether it succeeded. |frameInfo|
+ * will be filled with information of the primary picture upon success and
+ * unmodified upon failure.
+ *
+ * After this succeeded, getScanline can be called to read the scanlines
+ * that were decoded.
+ */
+ virtual bool decode(HeifFrameInfo* frameInfo) = 0;
+
+ /*
+ * Read the next scanline (in top-down order), returns true upon success
+ * and false otherwise.
+ */
+ virtual bool getScanline(uint8_t* dst) = 0;
+
+ /*
+ * Skip the next |count| scanlines, returns true upon success and
+ * false otherwise.
+ */
+ virtual size_t skipScanlines(size_t count) = 0;
+
+private:
+ HeifDecoder(const HeifFrameInfo&) = delete;
+ HeifDecoder& operator=(const HeifFrameInfo&) = delete;
+};
+
+/*
+ * Creates a HeifDecoder. Returns a HeifDecoder instance upon success, or NULL
+ * if the creation has failed.
+ */
+HeifDecoder* createHeifDecoder();
+
+#endif // _HEIF_DECODER_API_
diff --git a/media/libmedia/Android.bp b/media/libmedia/Android.bp
index bbe97ee..a462f3a 100644
--- a/media/libmedia/Android.bp
+++ b/media/libmedia/Android.bp
@@ -2,11 +2,22 @@
name: "libmedia_headers",
vendor_available: true,
export_include_dirs: ["include"],
+ header_libs:[
+ "libstagefright_headers",
+ "media_plugin_headers",
+ ],
+ export_header_lib_headers: [
+ "libstagefright_headers",
+ "media_plugin_headers",
+ ],
}
cc_library {
name: "libmedia_helper",
vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: ["AudioParameter.cpp", "TypeConverter.cpp"],
cflags: [
"-Werror",
@@ -34,6 +45,7 @@
"IMediaCodecList.cpp",
"IMediaCodecService.cpp",
"IOMX.cpp",
+ "IOMXStore.cpp",
"MediaCodecBuffer.cpp",
"MediaCodecInfo.cpp",
"MediaDefs.cpp",
@@ -69,14 +81,6 @@
"libutils",
],
- include_dirs: [
- "frameworks/av/include", // for media/vndk/xmlparser/1.0/MediaCodecsXmlParser.h
- "frameworks/av/include/media",
- "frameworks/native/include", // for media/hardware/MetadataBufferType.h
- "frameworks/native/include/media/openmax",
- "frameworks/av/media/libstagefright",
- ],
-
export_shared_lib_headers: [
"android.hidl.memory@1.0",
"android.hidl.token@1.0-utils",
@@ -120,6 +124,9 @@
cc_library_shared {
name: "libmedia_omx",
vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
defaults: ["libmedia_omx_defaults"],
}
@@ -202,6 +209,7 @@
"libicui18n",
"libsonivox",
"libmediadrm",
+ "libmedia_helper",
"android.hidl.memory@1.0",
],
@@ -210,15 +218,10 @@
"libc_malloc_debug_backtrace",
],
- include_dirs: [
- "frameworks/native/include/media/openmax",
- "frameworks/av/include/media/",
- "frameworks/av/media/libstagefright",
- ],
-
export_include_dirs: [
"include",
],
+
cflags: [
"-Werror",
"-Wno-error=deprecated-declarations",
diff --git a/media/libmedia/CharacterEncodingDetector.cpp b/media/libmedia/CharacterEncodingDetector.cpp
index 808c2b5..990d260 100644
--- a/media/libmedia/CharacterEncodingDetector.cpp
+++ b/media/libmedia/CharacterEncodingDetector.cpp
@@ -18,15 +18,15 @@
#define LOG_TAG "CharacterEncodingDector"
#include <utils/Log.h>
-#include <CharacterEncodingDetector.h>
+#include <media/CharacterEncodingDetector.h>
#include "CharacterEncodingDetectorTables.h"
-#include "utils/Vector.h"
-#include "StringArray.h"
+#include <utils/Vector.h>
+#include <media/StringArray.h>
-#include "unicode/ucnv.h"
-#include "unicode/ucsdet.h"
-#include "unicode/ustring.h"
+#include <unicode/ucnv.h>
+#include <unicode/ucsdet.h>
+#include <unicode/ustring.h>
namespace android {
diff --git a/media/libmedia/IMediaCodecService.cpp b/media/libmedia/IMediaCodecService.cpp
index 2d62419..adfa93d 100644
--- a/media/libmedia/IMediaCodecService.cpp
+++ b/media/libmedia/IMediaCodecService.cpp
@@ -27,7 +27,8 @@
namespace android {
enum {
- GET_OMX = IBinder::FIRST_CALL_TRANSACTION
+ GET_OMX = IBinder::FIRST_CALL_TRANSACTION,
+ GET_OMX_STORE
};
class BpMediaCodecService : public BpInterface<IMediaCodecService>
@@ -45,6 +46,13 @@
return interface_cast<IOMX>(reply.readStrongBinder());
}
+ virtual sp<IOMXStore> getOMXStore() {
+ Parcel data, reply;
+ data.writeInterfaceToken(IMediaCodecService::getInterfaceDescriptor());
+ remote()->transact(GET_OMX_STORE, data, &reply);
+ return interface_cast<IOMXStore>(reply.readStrongBinder());
+ }
+
};
IMPLEMENT_META_INTERFACE(MediaCodecService, "android.media.IMediaCodecService");
@@ -62,6 +70,12 @@
reply->writeStrongBinder(IInterface::asBinder(omx));
return NO_ERROR;
}
+ case GET_OMX_STORE: {
+ CHECK_INTERFACE(IMediaCodecService, data, reply);
+ sp<IOMXStore> omxStore = getOMXStore();
+ reply->writeStrongBinder(IInterface::asBinder(omxStore));
+ return NO_ERROR;
+ }
default:
return BBinder::onTransact(code, data, reply, flags);
}
diff --git a/media/libmedia/IMediaExtractor.cpp b/media/libmedia/IMediaExtractor.cpp
index 4caa79e..a8a7b82 100644
--- a/media/libmedia/IMediaExtractor.cpp
+++ b/media/libmedia/IMediaExtractor.cpp
@@ -21,7 +21,6 @@
#include <stdint.h>
#include <sys/types.h>
-#include <android/media/ICas.h>
#include <binder/IPCThreadState.h>
#include <binder/Parcel.h>
#include <binder/PermissionCache.h>
@@ -40,7 +39,8 @@
SETMEDIACAS,
SETUID,
NAME,
- GETMETRICS
+ GETMETRICS,
+ RELEASE,
};
class BpMediaExtractor : public BpInterface<IMediaExtractor> {
@@ -118,12 +118,12 @@
return NULL;
}
- virtual status_t setMediaCas(const sp<ICas> & cas) {
+ virtual status_t setMediaCas(const HInterfaceToken &casToken) {
ALOGV("setMediaCas");
Parcel data, reply;
data.writeInterfaceToken(BpMediaExtractor::getInterfaceDescriptor());
- data.writeStrongBinder(IInterface::asBinder(cas));
+ data.writeByteVector(casToken);
status_t err = remote()->transact(SETMEDIACAS, data, &reply);
if (err != NO_ERROR) {
@@ -140,6 +140,13 @@
ALOGV("name NOT IMPLEMENTED");
return NULL;
}
+
+ virtual void release() {
+ ALOGV("release");
+ Parcel data, reply;
+ data.writeInterfaceToken(BpMediaExtractor::getInterfaceDescriptor());
+ remote()->transact(RELEASE, data, &reply);
+ }
};
IMPLEMENT_META_INTERFACE(MediaExtractor, "android.media.IMediaExtractor");
@@ -207,15 +214,20 @@
ALOGV("setMediaCas");
CHECK_INTERFACE(IMediaExtractor, data, reply);
- sp<IBinder> casBinder;
- status_t err = data.readNullableStrongBinder(&casBinder);
+ HInterfaceToken casToken;
+ status_t err = data.readByteVector(&casToken);
if (err != NO_ERROR) {
- ALOGE("Error reading cas from parcel");
+ ALOGE("Error reading casToken from parcel");
return err;
}
- sp<ICas> cas = interface_cast<ICas>(casBinder);
- reply->writeInt32(setMediaCas(cas));
+ reply->writeInt32(setMediaCas(casToken));
+ return OK;
+ }
+ case RELEASE: {
+ ALOGV("release");
+ CHECK_INTERFACE(IMediaExtractor, data, reply);
+ release();
return OK;
}
default:
diff --git a/media/libmedia/IMediaMetadataRetriever.cpp b/media/libmedia/IMediaMetadataRetriever.cpp
index 7058ee8..5ea2e8b 100644
--- a/media/libmedia/IMediaMetadataRetriever.cpp
+++ b/media/libmedia/IMediaMetadataRetriever.cpp
@@ -127,22 +127,32 @@
return reply.readInt32();
}
- status_t setDataSource(const sp<IDataSource>& source)
+ status_t setDataSource(const sp<IDataSource>& source, const char *mime)
{
Parcel data, reply;
data.writeInterfaceToken(IMediaMetadataRetriever::getInterfaceDescriptor());
data.writeStrongBinder(IInterface::asBinder(source));
+
+ if (mime != NULL) {
+ data.writeInt32(1);
+ data.writeCString(mime);
+ } else {
+ data.writeInt32(0);
+ }
remote()->transact(SET_DATA_SOURCE_CALLBACK, data, &reply);
return reply.readInt32();
}
- sp<IMemory> getFrameAtTime(int64_t timeUs, int option)
+ sp<IMemory> getFrameAtTime(int64_t timeUs, int option, int colorFormat, bool metaOnly)
{
- ALOGV("getTimeAtTime: time(%" PRId64 " us) and option(%d)", timeUs, option);
+ ALOGV("getTimeAtTime: time(%" PRId64 " us), option(%d), colorFormat(%d) metaOnly(%d)",
+ timeUs, option, colorFormat, metaOnly);
Parcel data, reply;
data.writeInterfaceToken(IMediaMetadataRetriever::getInterfaceDescriptor());
data.writeInt64(timeUs);
data.writeInt32(option);
+ data.writeInt32(colorFormat);
+ data.writeInt32(metaOnly);
#ifndef DISABLE_GROUP_SCHEDULE_HACK
sendSchedPolicy(data);
#endif
@@ -258,7 +268,12 @@
if (source == NULL) {
reply->writeInt32(BAD_VALUE);
} else {
- reply->writeInt32(setDataSource(source));
+ int32_t hasMime = data.readInt32();
+ const char *mime = NULL;
+ if (hasMime) {
+ mime = data.readCString();
+ }
+ reply->writeInt32(setDataSource(source, mime));
}
return NO_ERROR;
} break;
@@ -266,11 +281,14 @@
CHECK_INTERFACE(IMediaMetadataRetriever, data, reply);
int64_t timeUs = data.readInt64();
int option = data.readInt32();
- ALOGV("getTimeAtTime: time(%" PRId64 " us) and option(%d)", timeUs, option);
+ int colorFormat = data.readInt32();
+ bool metaOnly = (data.readInt32() != 0);
+ ALOGV("getTimeAtTime: time(%" PRId64 " us), option(%d), colorFormat(%d), metaOnly(%d)",
+ timeUs, option, colorFormat, metaOnly);
#ifndef DISABLE_GROUP_SCHEDULE_HACK
setSchedPolicy(data);
#endif
- sp<IMemory> bitmap = getFrameAtTime(timeUs, option);
+ sp<IMemory> bitmap = getFrameAtTime(timeUs, option, colorFormat, metaOnly);
if (bitmap != 0) { // Don't send NULL across the binder interface
reply->writeInt32(NO_ERROR);
reply->writeStrongBinder(IInterface::asBinder(bitmap));
diff --git a/media/libmedia/IOMX.cpp b/media/libmedia/IOMX.cpp
index 43130eb..a073081 100644
--- a/media/libmedia/IOMX.cpp
+++ b/media/libmedia/IOMX.cpp
@@ -29,7 +29,7 @@
#include <utils/NativeHandle.h>
#include <gui/IGraphicBufferProducer.h>
-#include <omx/1.0/WOmxNode.h>
+#include <media/omx/1.0/WOmxNode.h>
#include <android/IGraphicBufferSource.h>
#include <android/IOMXBufferSource.h>
diff --git a/media/libmedia/IOMXStore.cpp b/media/libmedia/IOMXStore.cpp
new file mode 100644
index 0000000..4948f1a
--- /dev/null
+++ b/media/libmedia/IOMXStore.cpp
@@ -0,0 +1,367 @@
+/*
+ * Copyright (c) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "IOMXStore"
+
+#include <utils/Log.h>
+
+#include <media/IOMX.h>
+#include <media/IOMXStore.h>
+#include <android/hardware/media/omx/1.0/IOmxStore.h>
+
+#include <binder/IInterface.h>
+#include <binder/IBinder.h>
+#include <binder/Parcel.h>
+
+#include <vector>
+#include <string>
+
+namespace android {
+
+namespace {
+
+enum {
+ CONNECT = IBinder::FIRST_CALL_TRANSACTION,
+ LIST_SERVICE_ATTRIBUTES,
+ GET_NODE_PREFIX,
+ LIST_ROLES,
+ GET_OMX,
+};
+
+// Forward declarations of std::vector<T> <-> Parcel conversion funcitons that
+// depend on writeToParcel() and readToParcel() for T <-> Parcel.
+
+template <typename T>
+status_t writeToParcel(const std::vector<T>& v, Parcel* p);
+
+template <typename T>
+status_t readFromParcel(std::vector<T>* v, const Parcel& p);
+
+// std::string <-> Parcel
+
+status_t writeToParcel(const std::string& s, Parcel* p) {
+ if (s.size() > INT32_MAX) {
+ return BAD_VALUE;
+ }
+ return p->writeByteArray(
+ s.size(), reinterpret_cast<const uint8_t*>(s.c_str()));
+}
+
+status_t readFromParcel(std::string* s, const Parcel& p) {
+ int32_t len;
+ status_t status = p.readInt32(&len);
+ if (status != NO_ERROR) {
+ return status;
+ } else if ((len < 0) || (static_cast<uint64_t>(len) > SIZE_MAX)) {
+ return BAD_VALUE;
+ }
+ s->resize(len);
+ if (len == 0) {
+ return NO_ERROR;
+ }
+ return p.read(static_cast<void*>(&s->front()), static_cast<size_t>(len));
+}
+
+// IOMXStore::Attribute <-> Parcel
+
+status_t writeToParcel(const IOMXStore::Attribute& a, Parcel* p) {
+ status_t status = writeToParcel(a.key, p);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ return writeToParcel(a.value, p);
+}
+
+status_t readFromParcel(IOMXStore::Attribute* a, const Parcel& p) {
+ status_t status = readFromParcel(&(a->key), p);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ return readFromParcel(&(a->value), p);
+}
+
+// IOMXStore::NodeInfo <-> Parcel
+
+status_t writeToParcel(const IOMXStore::NodeInfo& n, Parcel* p) {
+ status_t status = writeToParcel(n.name, p);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ status = writeToParcel(n.owner, p);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ return writeToParcel(n.attributes, p);
+}
+
+status_t readFromParcel(IOMXStore::NodeInfo* n, const Parcel& p) {
+ status_t status = readFromParcel(&(n->name), p);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ status = readFromParcel(&(n->owner), p);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ return readFromParcel(&(n->attributes), p);
+}
+
+// IOMXStore::RoleInfo <-> Parcel
+
+status_t writeToParcel(const IOMXStore::RoleInfo& r, Parcel* p) {
+ status_t status = writeToParcel(r.role, p);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ status = writeToParcel(r.type, p);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ status = p->writeBool(r.isEncoder);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ status = p->writeBool(r.preferPlatformNodes);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ return writeToParcel(r.nodes, p);
+}
+
+status_t readFromParcel(IOMXStore::RoleInfo* r, const Parcel& p) {
+ status_t status = readFromParcel(&(r->role), p);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ status = readFromParcel(&(r->type), p);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ status = p.readBool(&(r->isEncoder));
+ if (status != NO_ERROR) {
+ return status;
+ }
+ status = p.readBool(&(r->preferPlatformNodes));
+ if (status != NO_ERROR) {
+ return status;
+ }
+ return readFromParcel(&(r->nodes), p);
+}
+
+// std::vector<NodeInfo> <-> Parcel
+// std::vector<RoleInfo> <-> Parcel
+
+template <typename T>
+status_t writeToParcel(const std::vector<T>& v, Parcel* p) {
+ status_t status = p->writeVectorSize(v);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ for (const T& x : v) {
+ status = writeToParcel(x, p);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ }
+ return NO_ERROR;
+}
+
+template <typename T>
+status_t readFromParcel(std::vector<T>* v, const Parcel& p) {
+ status_t status = p.resizeOutVector(v);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ for (T& x : *v) {
+ status = readFromParcel(&x, p);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ }
+ return NO_ERROR;
+}
+
+} // unnamed namespace
+
+////////////////////////////////////////////////////////////////////////////////
+
+class BpOMXStore : public BpInterface<IOMXStore> {
+public:
+ explicit BpOMXStore(const sp<IBinder> &impl)
+ : BpInterface<IOMXStore>(impl) {
+ }
+
+ status_t listServiceAttributes(
+ std::vector<Attribute>* attributes) override {
+ Parcel data, reply;
+ status_t status;
+ status = data.writeInterfaceToken(IOMXStore::getInterfaceDescriptor());
+ if (status != NO_ERROR) {
+ return status;
+ }
+ status = remote()->transact(LIST_SERVICE_ATTRIBUTES, data, &reply);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ return readFromParcel(attributes, reply);
+ }
+
+ status_t getNodePrefix(std::string* prefix) override {
+ Parcel data, reply;
+ status_t status;
+ status = data.writeInterfaceToken(IOMXStore::getInterfaceDescriptor());
+ if (status != NO_ERROR) {
+ return status;
+ }
+ status = remote()->transact(GET_NODE_PREFIX, data, &reply);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ return readFromParcel(prefix, reply);
+ }
+
+ status_t listRoles(std::vector<RoleInfo>* roleList) override {
+ Parcel data, reply;
+ status_t status;
+ status = data.writeInterfaceToken(IOMXStore::getInterfaceDescriptor());
+ if (status != NO_ERROR) {
+ return status;
+ }
+ status = remote()->transact(LIST_ROLES, data, &reply);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ return readFromParcel(roleList, reply);
+ }
+
+ status_t getOmx(const std::string& name, sp<IOMX>* omx) override {
+ Parcel data, reply;
+ status_t status;
+ status = data.writeInterfaceToken(IOMXStore::getInterfaceDescriptor());
+ if (status != NO_ERROR) {
+ return status;
+ }
+ status = writeToParcel(name, &data);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ status = remote()->transact(GET_OMX, data, &reply);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ return reply.readStrongBinder(omx);
+ }
+
+};
+
+IMPLEMENT_META_INTERFACE(OMXStore, "android.hardware.IOMXStore");
+
+////////////////////////////////////////////////////////////////////////////////
+
+#define CHECK_OMX_INTERFACE(interface, data, reply) \
+ do { if (!(data).enforceInterface(interface::getInterfaceDescriptor())) { \
+ ALOGW("Call incorrectly routed to " #interface); \
+ return PERMISSION_DENIED; \
+ } } while (0)
+
+status_t BnOMXStore::onTransact(
+ uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags) {
+ switch (code) {
+ case LIST_SERVICE_ATTRIBUTES: {
+ CHECK_OMX_INTERFACE(IOMXStore, data, reply);
+ status_t status;
+ std::vector<Attribute> attributes;
+
+ status = listServiceAttributes(&attributes);
+ if (status != NO_ERROR) {
+ ALOGE("listServiceAttributes() fails with status %d",
+ static_cast<int>(status));
+ return NO_ERROR;
+ }
+ status = writeToParcel(attributes, reply);
+ if (status != NO_ERROR) {
+ ALOGE("listServiceAttributes() fails to send reply");
+ return NO_ERROR;
+ }
+ return NO_ERROR;
+ }
+ case GET_NODE_PREFIX: {
+ CHECK_OMX_INTERFACE(IOMXStore, data, reply);
+ status_t status;
+ std::string prefix;
+
+ status = getNodePrefix(&prefix);
+ if (status != NO_ERROR) {
+ ALOGE("getNodePrefix() fails with status %d",
+ static_cast<int>(status));
+ return NO_ERROR;
+ }
+ status = writeToParcel(prefix, reply);
+ if (status != NO_ERROR) {
+ ALOGE("getNodePrefix() fails to send reply");
+ return NO_ERROR;
+ }
+ return NO_ERROR;
+ }
+ case LIST_ROLES: {
+ CHECK_OMX_INTERFACE(IOMXStore, data, reply);
+ status_t status;
+ std::vector<RoleInfo> roleList;
+
+ status = listRoles(&roleList);
+ if (status != NO_ERROR) {
+ ALOGE("listRoles() fails with status %d",
+ static_cast<int>(status));
+ return NO_ERROR;
+ }
+ status = writeToParcel(roleList, reply);
+ if (status != NO_ERROR) {
+ ALOGE("listRoles() fails to send reply");
+ return NO_ERROR;
+ }
+ return NO_ERROR;
+ }
+ case GET_OMX: {
+ CHECK_OMX_INTERFACE(IOMXStore, data, reply);
+ status_t status;
+ std::string name;
+ sp<IOMX> omx;
+
+ status = readFromParcel(&name, data);
+ if (status != NO_ERROR) {
+ ALOGE("getOmx() fails to retrieve name");
+ return NO_ERROR;
+ }
+ status = getOmx(name, &omx);
+ if (status != NO_ERROR) {
+ ALOGE("getOmx() fails with status %d",
+ static_cast<int>(status));
+ return NO_ERROR;
+ }
+ status = reply->writeStrongBinder(IInterface::asBinder(omx));
+ if (status != NO_ERROR) {
+ ALOGE("getOmx() fails to send reply");
+ return NO_ERROR;
+ }
+ return NO_ERROR;
+ }
+ default:
+ return BBinder::onTransact(code, data, reply, flags);
+ }
+}
+
+} // namespace android
diff --git a/media/libmedia/IResourceManagerService.cpp b/media/libmedia/IResourceManagerService.cpp
index 95f7d2e..9724fc1 100644
--- a/media/libmedia/IResourceManagerService.cpp
+++ b/media/libmedia/IResourceManagerService.cpp
@@ -19,7 +19,7 @@
#define LOG_TAG "IResourceManagerService"
#include <utils/Log.h>
-#include "media/IResourceManagerService.h"
+#include <media/IResourceManagerService.h>
#include <binder/Parcel.h>
diff --git a/media/libmedia/MediaCodecInfo.cpp b/media/libmedia/MediaCodecInfo.cpp
index 1f188f3..a570ffe 100644
--- a/media/libmedia/MediaCodecInfo.cpp
+++ b/media/libmedia/MediaCodecInfo.cpp
@@ -101,36 +101,46 @@
return OK;
}
-void MediaCodecInfo::CapabilitiesBuilder::addProfileLevel(uint32_t profile, uint32_t level) {
+void MediaCodecInfo::CapabilitiesWriter::addDetail(
+ const char* key, const char* value) {
+ mCap->mDetails->setString(key, value);
+}
+
+void MediaCodecInfo::CapabilitiesWriter::addDetail(
+ const char* key, int32_t value) {
+ mCap->mDetails->setInt32(key, value);
+}
+
+void MediaCodecInfo::CapabilitiesWriter::addProfileLevel(
+ uint32_t profile, uint32_t level) {
ProfileLevel profileLevel;
profileLevel.mProfile = profile;
profileLevel.mLevel = level;
- mProfileLevels.push_back(profileLevel);
+ if (mCap->mProfileLevelsSorted.indexOf(profileLevel) < 0) {
+ mCap->mProfileLevels.push_back(profileLevel);
+ mCap->mProfileLevelsSorted.add(profileLevel);
+ }
}
-void MediaCodecInfo::CapabilitiesBuilder::addColorFormat(uint32_t format) {
- mColorFormats.push(format);
+void MediaCodecInfo::CapabilitiesWriter::addColorFormat(uint32_t format) {
+ if (mCap->mColorFormatsSorted.indexOf(format) < 0) {
+ mCap->mColorFormats.push(format);
+ mCap->mColorFormatsSorted.add(format);
+ }
}
-void MediaCodecInfo::CapabilitiesBuilder::addFlags(uint32_t flags) {
- mFlags |= flags;
+void MediaCodecInfo::CapabilitiesWriter::addFlags(uint32_t flags) {
+ mCap->mFlags |= flags;
+}
+
+MediaCodecInfo::CapabilitiesWriter::CapabilitiesWriter(
+ MediaCodecInfo::Capabilities* cap) : mCap(cap) {
}
bool MediaCodecInfo::isEncoder() const {
return mIsEncoder;
}
-bool MediaCodecInfo::hasQuirk(const char *name) const {
- if (name) {
- for (size_t ix = 0; ix < mQuirks.size(); ix++) {
- if (mQuirks.itemAt(ix).equalsIgnoreCase(name)) {
- return true;
- }
- }
- }
- return false;
-}
-
void MediaCodecInfo::getSupportedMimes(Vector<AString> *mimes) const {
mimes->clear();
for (size_t ix = 0; ix < mCaps.size(); ix++) {
@@ -151,20 +161,21 @@
return mName.c_str();
}
+const char *MediaCodecInfo::getOwnerName() const {
+ return mOwner.c_str();
+}
+
// static
sp<MediaCodecInfo> MediaCodecInfo::FromParcel(const Parcel &parcel) {
AString name = AString::FromParcel(parcel);
+ AString owner = AString::FromParcel(parcel);
bool isEncoder = static_cast<bool>(parcel.readInt32());
- sp<MediaCodecInfo> info = new MediaCodecInfo(name, isEncoder, NULL);
+ sp<MediaCodecInfo> info = new MediaCodecInfo;
+ info->mName = name;
+ info->mOwner = owner;
+ info->mIsEncoder = isEncoder;
size_t size = static_cast<size_t>(parcel.readInt32());
for (size_t i = 0; i < size; i++) {
- AString quirk = AString::FromParcel(parcel);
- if (info != NULL) {
- info->mQuirks.push_back(quirk);
- }
- }
- size = static_cast<size_t>(parcel.readInt32());
- for (size_t i = 0; i < size; i++) {
AString mime = AString::FromParcel(parcel);
sp<Capabilities> caps = Capabilities::FromParcel(parcel);
if (caps == NULL)
@@ -178,11 +189,8 @@
status_t MediaCodecInfo::writeToParcel(Parcel *parcel) const {
mName.writeToParcel(parcel);
+ mOwner.writeToParcel(parcel);
parcel->writeInt32(mIsEncoder);
- parcel->writeInt32(mQuirks.size());
- for (size_t i = 0; i < mQuirks.size(); i++) {
- mQuirks.itemAt(i).writeToParcel(parcel);
- }
parcel->writeInt32(mCaps.size());
for (size_t i = 0; i < mCaps.size(); i++) {
mCaps.keyAt(i).writeToParcel(parcel);
@@ -202,86 +210,46 @@
return -1;
}
-MediaCodecInfo::MediaCodecInfo(AString name, bool encoder, const char *mime)
- : mName(name),
- mIsEncoder(encoder),
- mHasSoleMime(false) {
- if (mime != NULL) {
- addMime(mime);
- mHasSoleMime = true;
- }
+MediaCodecInfo::MediaCodecInfo() {
}
-status_t MediaCodecInfo::addMime(const char *mime) {
- if (mHasSoleMime) {
- ALOGE("Codec '%s' already had its type specified", mName.c_str());
- return -EINVAL;
- }
- ssize_t ix = getCapabilityIndex(mime);
+void MediaCodecInfoWriter::setName(const char* name) {
+ mInfo->mName = name;
+}
+
+void MediaCodecInfoWriter::setOwner(const char* owner) {
+ mInfo->mOwner = owner;
+}
+
+void MediaCodecInfoWriter::setEncoder(bool isEncoder) {
+ mInfo->mIsEncoder = isEncoder;
+}
+
+std::unique_ptr<MediaCodecInfo::CapabilitiesWriter>
+ MediaCodecInfoWriter::addMime(const char *mime) {
+ ssize_t ix = mInfo->getCapabilityIndex(mime);
if (ix >= 0) {
- mCurrentCaps = mCaps.valueAt(ix);
- } else {
- mCurrentCaps = new Capabilities();
- mCaps.add(AString(mime), mCurrentCaps);
+ return std::unique_ptr<MediaCodecInfo::CapabilitiesWriter>(
+ new MediaCodecInfo::CapabilitiesWriter(
+ mInfo->mCaps.valueAt(ix).get()));
}
- return OK;
+ sp<MediaCodecInfo::Capabilities> caps = new MediaCodecInfo::Capabilities();
+ mInfo->mCaps.add(AString(mime), caps);
+ return std::unique_ptr<MediaCodecInfo::CapabilitiesWriter>(
+ new MediaCodecInfo::CapabilitiesWriter(caps.get()));
}
-status_t MediaCodecInfo::updateMime(const char *mime) {
- ssize_t ix = getCapabilityIndex(mime);
- if (ix < 0) {
- ALOGE("updateMime mime not found %s", mime);
- return -EINVAL;
- }
-
- mCurrentCaps = mCaps.valueAt(ix);
- return OK;
-}
-
-void MediaCodecInfo::removeMime(const char *mime) {
- ssize_t ix = getCapabilityIndex(mime);
+bool MediaCodecInfoWriter::removeMime(const char *mime) {
+ ssize_t ix = mInfo->getCapabilityIndex(mime);
if (ix >= 0) {
- mCaps.removeItemsAt(ix);
- // mCurrentCaps will be removed when completed
+ mInfo->mCaps.removeItemsAt(ix);
+ return true;
}
+ return false;
}
-status_t MediaCodecInfo::initializeCapabilities(const sp<Capabilities> &caps) {
- // TRICKY: copy data to mCurrentCaps as it is a reference to
- // an element of the capabilites map.
- mCurrentCaps->mColorFormats.clear();
- mCurrentCaps->mColorFormats.appendVector(caps->mColorFormats);
- mCurrentCaps->mProfileLevels.clear();
- mCurrentCaps->mProfileLevels.appendVector(caps->mProfileLevels);
- mCurrentCaps->mFlags = caps->mFlags;
- mCurrentCaps->mDetails = caps->mDetails;
- return OK;
-}
-
-void MediaCodecInfo::addQuirk(const char *name) {
- if (!hasQuirk(name)) {
- mQuirks.push(name);
- }
-}
-
-void MediaCodecInfo::complete() {
- mCurrentCaps = NULL;
-}
-
-void MediaCodecInfo::addDetail(const AString &key, const AString &value) {
- mCurrentCaps->mDetails->setString(key.c_str(), value.c_str());
-}
-
-void MediaCodecInfo::addFeature(const AString &key, int32_t value) {
- AString tag = "feature-";
- tag.append(key);
- mCurrentCaps->mDetails->setInt32(tag.c_str(), value);
-}
-
-void MediaCodecInfo::addFeature(const AString &key, const char *value) {
- AString tag = "feature-";
- tag.append(key);
- mCurrentCaps->mDetails->setString(tag.c_str(), value);
+MediaCodecInfoWriter::MediaCodecInfoWriter(MediaCodecInfo* info) :
+ mInfo(info) {
}
} // namespace android
diff --git a/media/libmedia/MediaScannerClient.cpp b/media/libmedia/MediaScannerClient.cpp
index 9f803cb..028616b 100644
--- a/media/libmedia/MediaScannerClient.cpp
+++ b/media/libmedia/MediaScannerClient.cpp
@@ -20,8 +20,8 @@
#include <media/mediascanner.h>
-#include "CharacterEncodingDetector.h"
-#include "StringArray.h"
+#include <media/CharacterEncodingDetector.h>
+#include <media/StringArray.h>
namespace android {
diff --git a/media/libmedia/MidiDeviceInfo.cpp b/media/libmedia/MidiDeviceInfo.cpp
index 02efc5f..7588e00 100644
--- a/media/libmedia/MidiDeviceInfo.cpp
+++ b/media/libmedia/MidiDeviceInfo.cpp
@@ -16,7 +16,7 @@
#define LOG_TAG "MidiDeviceInfo"
-#include "MidiDeviceInfo.h"
+#include <media/MidiDeviceInfo.h>
#include <binder/Parcel.h>
#include <log/log.h>
diff --git a/media/libmedia/MidiIoWrapper.cpp b/media/libmedia/MidiIoWrapper.cpp
index faae954..4e5d67f 100644
--- a/media/libmedia/MidiIoWrapper.cpp
+++ b/media/libmedia/MidiIoWrapper.cpp
@@ -22,7 +22,7 @@
#include <sys/stat.h>
#include <fcntl.h>
-#include "media/MidiIoWrapper.h"
+#include <media/MidiIoWrapper.h>
static int readAt(void *handle, void *buffer, int pos, int size) {
return ((android::MidiIoWrapper*)handle)->readAt(buffer, pos, size);
diff --git a/media/libmedia/StringArray.cpp b/media/libmedia/StringArray.cpp
index b2e5907..7868b85 100644
--- a/media/libmedia/StringArray.cpp
+++ b/media/libmedia/StringArray.cpp
@@ -21,7 +21,7 @@
#include <stdlib.h>
#include <string.h>
-#include "StringArray.h"
+#include <media/StringArray.h>
namespace android {
diff --git a/media/libmedia/TypeConverter.cpp b/media/libmedia/TypeConverter.cpp
index a6eba86..e6c8f9c 100644
--- a/media/libmedia/TypeConverter.cpp
+++ b/media/libmedia/TypeConverter.cpp
@@ -375,7 +375,7 @@
audio_channel_mask_t channelMaskFromString(const std::string &literalChannels)
{
audio_channel_mask_t channels;
- if (!OutputChannelConverter::fromString(literalChannels, channels) ||
+ if (!OutputChannelConverter::fromString(literalChannels, channels) &&
!InputChannelConverter::fromString(literalChannels, channels)) {
return AUDIO_CHANNEL_INVALID;
}
diff --git a/media/libmedia/include/media/DrmHal.h b/media/libmedia/include/media/DrmHal.h
index e031765..5d25e4d 100644
--- a/media/libmedia/include/media/DrmHal.h
+++ b/media/libmedia/include/media/DrmHal.h
@@ -39,6 +39,11 @@
struct DrmSessionClientInterface;
+inline bool operator==(const Vector<uint8_t> &l, const Vector<uint8_t> &r) {
+ if (l.size() != r.size()) return false;
+ return memcmp(l.array(), r.array(), l.size()) == 0;
+}
+
struct DrmHal : public BnDrm,
public IBinder::DeathRecipient,
public IDrmPluginListener {
@@ -161,6 +166,9 @@
const Vector<sp<IDrmFactory>> mFactories;
sp<IDrmPlugin> mPlugin;
+ Vector<Vector<uint8_t>> mOpenSessions;
+ void closeOpenSessions();
+
/**
* mInitCheck is:
* NO_INIT if a plugin hasn't been created yet
@@ -175,6 +183,11 @@
void writeByteArray(Parcel &obj, const hidl_vec<uint8_t>& array);
+ void reportMetrics() const;
+ status_t getPropertyStringInternal(String8 const &name, String8 &value) const;
+ status_t getPropertyByteArrayInternal(String8 const &name,
+ Vector<uint8_t> &value) const;
+
DISALLOW_EVIL_CONSTRUCTORS(DrmHal);
};
diff --git a/media/libmedia/include/media/IDataSource.h b/media/libmedia/include/media/IDataSource.h
index 655f337..3858f78 100644
--- a/media/libmedia/include/media/IDataSource.h
+++ b/media/libmedia/include/media/IDataSource.h
@@ -35,7 +35,9 @@
// Get the memory that readAt writes into.
virtual sp<IMemory> getIMemory() = 0;
// Read up to |size| bytes into the memory returned by getIMemory(). Returns
- // the number of bytes read, or -1 on error. |size| must not be larger than
+ // the number of bytes read, or negative value on error (eg.
+ // ERROR_END_OF_STREAM indicating EOS. This is needed by CallbackDataSource
+ // to properly handle reading of last chunk). |size| must not be larger than
// the buffer.
virtual ssize_t readAt(off64_t offset, size_t size) = 0;
// Get the size, or -1 if the size is unknown.
diff --git a/media/libmedia/include/media/IMediaCodecService.h b/media/libmedia/include/media/IMediaCodecService.h
index da3c5a03..59fb1c0 100644
--- a/media/libmedia/include/media/IMediaCodecService.h
+++ b/media/libmedia/include/media/IMediaCodecService.h
@@ -22,6 +22,7 @@
#include <binder/Parcel.h>
#include <media/IDataSource.h>
#include <media/IOMX.h>
+#include <media/IOMXStore.h>
namespace android {
@@ -31,6 +32,7 @@
DECLARE_META_INTERFACE(MediaCodecService);
virtual sp<IOMX> getOMX() = 0;
+ virtual sp<IOMXStore> getOMXStore() = 0;
};
class BnMediaCodecService: public BnInterface<IMediaCodecService>
diff --git a/media/libmedia/include/media/IMediaExtractor.h b/media/libmedia/include/media/IMediaExtractor.h
index ab40f53..0ac7673 100644
--- a/media/libmedia/include/media/IMediaExtractor.h
+++ b/media/libmedia/include/media/IMediaExtractor.h
@@ -20,14 +20,12 @@
#include <media/IMediaSource.h>
#include <media/stagefright/DataSource.h>
+#include <vector>
namespace android {
class MetaData;
-namespace media {
-class ICas;
-};
-using namespace media;
+typedef std::vector<uint8_t> HInterfaceToken;
class IMediaExtractor : public IInterface {
public:
@@ -65,11 +63,13 @@
// for DRM
virtual char* getDrmTrackInfo(size_t trackID, int *len) = 0;
- virtual status_t setMediaCas(const sp<ICas> &cas) = 0;
+ virtual status_t setMediaCas(const HInterfaceToken &casToken) = 0;
virtual void setUID(uid_t uid) = 0;
virtual const char * name() = 0;
+
+ virtual void release() = 0;
};
diff --git a/media/libmedia/include/media/IMediaMetadataRetriever.h b/media/libmedia/include/media/IMediaMetadataRetriever.h
index c90f254..ea95161 100644
--- a/media/libmedia/include/media/IMediaMetadataRetriever.h
+++ b/media/libmedia/include/media/IMediaMetadataRetriever.h
@@ -19,13 +19,12 @@
#define ANDROID_IMEDIAMETADATARETRIEVER_H
#include <binder/IInterface.h>
-#include <binder/Parcel.h>
#include <binder/IMemory.h>
#include <utils/KeyedVector.h>
#include <utils/RefBase.h>
namespace android {
-
+class Parcel;
class IDataSource;
struct IMediaHTTPService;
@@ -41,8 +40,10 @@
const KeyedVector<String8, String8> *headers = NULL) = 0;
virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0;
- virtual status_t setDataSource(const sp<IDataSource>& dataSource) = 0;
- virtual sp<IMemory> getFrameAtTime(int64_t timeUs, int option) = 0;
+ virtual status_t setDataSource(
+ const sp<IDataSource>& dataSource, const char *mime) = 0;
+ virtual sp<IMemory> getFrameAtTime(
+ int64_t timeUs, int option, int colorFormat, bool metaOnly) = 0;
virtual sp<IMemory> extractAlbumArt() = 0;
virtual const char* extractMetadata(int keyCode) = 0;
};
diff --git a/media/libmedia/include/media/IOMX.h b/media/libmedia/include/media/IOMX.h
index 9a0ada1..e69c02d 100644
--- a/media/libmedia/include/media/IOMX.h
+++ b/media/libmedia/include/media/IOMX.h
@@ -29,8 +29,9 @@
#include <media/hardware/MetadataBufferType.h>
#include <android/hardware/media/omx/1.0/IOmxNode.h>
-#include <OMX_Core.h>
-#include <OMX_Video.h>
+#include <media/openmax/OMX_Core.h>
+#include <media/openmax/OMX_Video.h>
+#include <media/openmax/OMX_VideoExt.h>
namespace android {
diff --git a/media/libmedia/include/media/IOMXStore.h b/media/libmedia/include/media/IOMXStore.h
new file mode 100644
index 0000000..628db70
--- /dev/null
+++ b/media/libmedia/include/media/IOMXStore.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_IOMXSTORE_H_
+
+#define ANDROID_IOMXSTORE_H_
+
+#include <media/IOMX.h>
+#include <android/hardware/media/omx/1.0/IOmxStore.h>
+
+#include <binder/IInterface.h>
+#include <binder/IBinder.h>
+
+#include <vector>
+#include <string>
+
+namespace android {
+
+using hardware::media::omx::V1_0::IOmxStore;
+
+class IOMXStore : public IInterface {
+public:
+ DECLARE_META_INTERFACE(OMXStore);
+
+ struct Attribute {
+ std::string key;
+ std::string value;
+ };
+
+ struct NodeInfo {
+ std::string name;
+ std::string owner;
+ std::vector<Attribute> attributes;
+ };
+
+ struct RoleInfo {
+ std::string role;
+ std::string type;
+ bool isEncoder;
+ bool preferPlatformNodes;
+ std::vector<NodeInfo> nodes;
+ };
+
+ virtual status_t listServiceAttributes(
+ std::vector<Attribute>* attributes) = 0;
+
+ virtual status_t getNodePrefix(std::string* prefix) = 0;
+
+ virtual status_t listRoles(std::vector<RoleInfo>* roleList) = 0;
+
+ virtual status_t getOmx(const std::string& name, sp<IOMX>* omx) = 0;
+};
+
+
+////////////////////////////////////////////////////////////////////////////////
+
+class BnOMXStore : public BnInterface<IOMXStore> {
+public:
+ virtual status_t onTransact(
+ uint32_t code, const Parcel &data, Parcel *reply,
+ uint32_t flags = 0);
+};
+
+} // namespace android
+
+#endif // ANDROID_IOMX_H_
diff --git a/media/libmedia/include/media/MediaCodecInfo.h b/media/libmedia/include/media/MediaCodecInfo.h
index 6b50f22..ab2cd24 100644
--- a/media/libmedia/include/media/MediaCodecInfo.h
+++ b/media/libmedia/include/media/MediaCodecInfo.h
@@ -18,6 +18,7 @@
#define MEDIA_CODEC_INFO_H_
+#include <android-base/macros.h>
#include <binder/Parcel.h>
#include <media/stagefright/foundation/ABase.h>
#include <media/stagefright/foundation/AString.h>
@@ -36,12 +37,20 @@
typedef KeyedVector<AString, AString> CodecSettings;
+struct MediaCodecInfoWriter;
+struct MediaCodecListWriter;
+
struct MediaCodecInfo : public RefBase {
struct ProfileLevel {
uint32_t mProfile;
uint32_t mLevel;
+ bool operator <(const ProfileLevel &o) const {
+ return mProfile < o.mProfile || (mProfile == o.mProfile && mLevel < o.mLevel);
+ }
};
+ struct CapabilitiesWriter;
+
struct Capabilities : public RefBase {
enum {
// decoder flags
@@ -61,7 +70,9 @@
protected:
Vector<ProfileLevel> mProfileLevels;
+ SortedVector<ProfileLevel> mProfileLevelsSorted;
Vector<uint32_t> mColorFormats;
+ SortedVector<uint32_t> mColorFormatsSorted;
uint32_t mFlags;
sp<AMessage> mDetails;
@@ -72,72 +83,191 @@
static sp<Capabilities> FromParcel(const Parcel &parcel);
status_t writeToParcel(Parcel *parcel) const;
- DISALLOW_EVIL_CONSTRUCTORS(Capabilities);
+ DISALLOW_COPY_AND_ASSIGN(Capabilities);
friend struct MediaCodecInfo;
+ friend struct MediaCodecInfoWriter;
+ friend struct CapabilitiesWriter;
};
- // Use a subclass to allow setting fields on construction without allowing
- // to do the same throughout the framework.
- struct CapabilitiesBuilder : public Capabilities {
+ /**
+ * This class is used for modifying information inside a `Capabilities`
+ * object. An object of type `CapabilitiesWriter` can be obtained by calling
+ * `MediaCodecInfoWriter::addMime()` or
+ * `MediaCodecInfoWriter::updateMime()`.
+ */
+ struct CapabilitiesWriter {
+ /**
+ * Add a key-value pair to the list of details. If the key already
+ * exists, the old value will be replaced.
+ *
+ * A pair added by this function will be accessible by
+ * `Capabilities::getDetails()`. Call `AMessage::getString()` with the
+ * same key to retrieve the value.
+ *
+ * @param key The key.
+ * @param value The string value.
+ */
+ void addDetail(const char* key, const char* value);
+ /**
+ * Add a key-value pair to the list of details. If the key already
+ * exists, the old value will be replaced.
+ *
+ * A pair added by this function will be accessible by
+ * `Capabilities::getDetails()`. Call `AMessage::getInt32()` with the
+ * same key to retrieve the value.
+ *
+ * @param key The key.
+ * @param value The `int32_t` value.
+ */
+ void addDetail(const char* key, int32_t value);
+ /**
+ * Add a profile-level pair. If this profile-level pair already exists,
+ * it will be ignored.
+ *
+ * @param profile The "profile" component.
+ * @param level The "level" component.
+ */
void addProfileLevel(uint32_t profile, uint32_t level);
+ /**
+ * Add a color format. If this color format already exists, it will be
+ * ignored.
+ *
+ * @param format The color format.
+ */
void addColorFormat(uint32_t format);
+ /**
+ * Add flags. The underlying operation is bitwise-or. In other words,
+ * bits that have already been set will be ignored.
+ *
+ * @param flags The additional flags.
+ */
void addFlags(uint32_t flags);
+ private:
+ /**
+ * The associated `Capabilities` object.
+ */
+ Capabilities* mCap;
+ /**
+ * Construct a writer for the given `Capabilities` object.
+ *
+ * @param cap The `Capabilities` object to be written to.
+ */
+ CapabilitiesWriter(Capabilities* cap);
+
+ friend MediaCodecInfoWriter;
};
bool isEncoder() const;
- bool hasQuirk(const char *name) const;
void getSupportedMimes(Vector<AString> *mimes) const;
const sp<Capabilities> getCapabilitiesFor(const char *mime) const;
const char *getCodecName() const;
/**
+ * Return the name of the service that hosts the codec. This value is not
+ * visible at the Java level.
+ *
+ * Currently, this is the "instance name" of the IOmx service.
+ */
+ const char *getOwnerName() const;
+
+ /**
* Serialization over Binder
*/
static sp<MediaCodecInfo> FromParcel(const Parcel &parcel);
status_t writeToParcel(Parcel *parcel) const;
private:
- // variable set only in constructor - these are accessed by MediaCodecList
- // to avoid duplication of same variables
AString mName;
+ AString mOwner;
bool mIsEncoder;
- bool mHasSoleMime; // was initialized with mime
-
- Vector<AString> mQuirks;
KeyedVector<AString, sp<Capabilities> > mCaps;
- sp<Capabilities> mCurrentCaps; // currently initalized capabilities
-
ssize_t getCapabilityIndex(const char *mime) const;
- /* Methods used by MediaCodecList to construct the info
- * object from XML.
- *
- * After info object is created:
- * - additional quirks can be added
- * - additional mimes can be added
- * - OMX codec capabilities can be set for the current mime-type
- * - a capability detail can be set for the current mime-type
- * - a feature can be set for the current mime-type
- * - info object can be completed when parsing of a mime-type is done
+ /**
+ * Construct an `MediaCodecInfo` object. After the construction, its
+ * information can be set via an `MediaCodecInfoWriter` object obtained from
+ * `MediaCodecListWriter::addMediaCodecInfo()`.
*/
- MediaCodecInfo(AString name, bool encoder, const char *mime);
- void addQuirk(const char *name);
- status_t addMime(const char *mime);
- status_t updateMime(const char *mime);
+ MediaCodecInfo();
- status_t initializeCapabilities(const sp<Capabilities> &caps);
- void addDetail(const AString &key, const AString &value);
- void addFeature(const AString &key, int32_t value);
- void addFeature(const AString &key, const char *value);
- void removeMime(const char *mime);
- void complete();
+ DISALLOW_COPY_AND_ASSIGN(MediaCodecInfo);
- DISALLOW_EVIL_CONSTRUCTORS(MediaCodecInfo);
-
- friend struct MediaCodecList;
friend class MediaCodecListOverridesTest;
+ friend struct MediaCodecInfoWriter;
+ friend struct MediaCodecListWriter;
+};
+
+/**
+ * This class is to be used by a `MediaCodecListBuilderBase` instance to
+ * populate information inside the associated `MediaCodecInfo` object.
+ *
+ * The only place where an instance of `MediaCodecInfoWriter` can be constructed
+ * is `MediaCodecListWriter::addMediaCodecInfo()`. A `MediaCodecListBuilderBase`
+ * instance should call `MediaCodecListWriter::addMediaCodecInfo()` on the given
+ * `MediaCodecListWriter` object given as an input to
+ * `MediaCodecListBuilderBase::buildMediaCodecList()`.
+ */
+struct MediaCodecInfoWriter {
+ /**
+ * Set the name of the codec.
+ *
+ * @param name The new name.
+ */
+ void setName(const char* name);
+ /**
+ * Set the owner name of the codec.
+ *
+ * This "owner name" is the name of the `IOmx` instance that supports this
+ * codec.
+ *
+ * @param owner The new owner name.
+ */
+ void setOwner(const char* owner);
+ /**
+ * Set whether this codec is an encoder or a decoder.
+ *
+ * @param isEncoder Whether this codec is an encoder or a decoder.
+ */
+ void setEncoder(bool isEncoder = true);
+ /**
+ * Add a mime to an indexed list and return a `CapabilitiesWriter` object
+ * that can be used for modifying the associated `Capabilities`.
+ *
+ * If the mime already exists, this function will return the
+ * `CapabilitiesWriter` associated with the mime.
+ *
+ * @param[in] mime The name of a new mime to add.
+ * @return writer The `CapabilitiesWriter` object for modifying the
+ * `Capabilities` associated with the mime. `writer` will be valid
+ * regardless of whether `mime` already exists or not.
+ */
+ std::unique_ptr<MediaCodecInfo::CapabilitiesWriter> addMime(
+ const char* mime);
+ /**
+ * Remove a mime.
+ *
+ * @param mime The name of the mime to remove.
+ * @return `true` if `mime` is removed; `false` if `mime` is not found.
+ */
+ bool removeMime(const char* mime);
+private:
+ /**
+ * The associated `MediaCodecInfo`.
+ */
+ MediaCodecInfo* mInfo;
+ /**
+ * Construct the `MediaCodecInfoWriter` object associated with the given
+ * `MediaCodecInfo` object.
+ *
+ * @param info The underlying `MediaCodecInfo` object.
+ */
+ MediaCodecInfoWriter(MediaCodecInfo* info);
+
+ DISALLOW_COPY_AND_ASSIGN(MediaCodecInfoWriter);
+
+ friend struct MediaCodecListWriter;
};
} // namespace android
diff --git a/media/libmedia/include/media/MediaMetadataRetrieverInterface.h b/media/libmedia/include/media/MediaMetadataRetrieverInterface.h
index a5e1350..257002d 100644
--- a/media/libmedia/include/media/MediaMetadataRetrieverInterface.h
+++ b/media/libmedia/include/media/MediaMetadataRetrieverInterface.h
@@ -41,8 +41,9 @@
const KeyedVector<String8, String8> *headers = NULL) = 0;
virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0;
- virtual status_t setDataSource(const sp<DataSource>& source) = 0;
- virtual VideoFrame* getFrameAtTime(int64_t timeUs, int option) = 0;
+ virtual status_t setDataSource(const sp<DataSource>& source, const char *mime) = 0;
+ virtual VideoFrame* getFrameAtTime(
+ int64_t timeUs, int option, int colorFormat, bool metaOnly) = 0;
virtual MediaAlbumArt* extractAlbumArt() = 0;
virtual const char* extractMetadata(int keyCode) = 0;
};
@@ -54,7 +55,9 @@
MediaMetadataRetrieverInterface() {}
virtual ~MediaMetadataRetrieverInterface() {}
- virtual VideoFrame* getFrameAtTime(int64_t /*timeUs*/, int /*option*/) { return NULL; }
+ virtual VideoFrame* getFrameAtTime(
+ int64_t /*timeUs*/, int /*option*/, int /*colorFormat*/, bool /*metaOnly*/)
+ { return NULL; }
virtual MediaAlbumArt* extractAlbumArt() { return NULL; }
virtual const char* extractMetadata(int /*keyCode*/) { return NULL; }
};
diff --git a/media/libmedia/include/media/PluginMetricsReporting.h b/media/libmedia/include/media/PluginMetricsReporting.h
new file mode 100644
index 0000000..4a5a363
--- /dev/null
+++ b/media/libmedia/include/media/PluginMetricsReporting.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef PLUGIN_METRICS_REPORTING_H_
+
+#define PLUGIN_METRICS_REPORTING_H_
+
+#include <utils/Errors.h>
+#include <utils/String8.h>
+#include <utils/Vector.h>
+
+namespace android {
+
+status_t reportDrmPluginMetrics(const Vector<uint8_t>& serializedMetrics,
+ const String8& vendorName,
+ const String8& description);
+
+} // namespace android
+
+#endif // PLUGIN_METRICS_REPORTING_H_
diff --git a/media/libmedia/include/media/mediametadataretriever.h b/media/libmedia/include/media/mediametadataretriever.h
index 8ed07ee..65c266b 100644
--- a/media/libmedia/include/media/mediametadataretriever.h
+++ b/media/libmedia/include/media/mediametadataretriever.h
@@ -76,8 +76,10 @@
const KeyedVector<String8, String8> *headers = NULL);
status_t setDataSource(int fd, int64_t offset, int64_t length);
- status_t setDataSource(const sp<IDataSource>& dataSource);
- sp<IMemory> getFrameAtTime(int64_t timeUs, int option);
+ status_t setDataSource(
+ const sp<IDataSource>& dataSource, const char *mime = NULL);
+ sp<IMemory> getFrameAtTime(int64_t timeUs, int option,
+ int colorFormat = HAL_PIXEL_FORMAT_RGB_565, bool metaOnly = false);
sp<IMemory> extractAlbumArt();
const char* extractMetadata(int keyCode);
diff --git a/include/media/omx/1.0/Conversion.h b/media/libmedia/include/media/omx/1.0/Conversion.h
similarity index 100%
rename from include/media/omx/1.0/Conversion.h
rename to media/libmedia/include/media/omx/1.0/Conversion.h
diff --git a/include/media/omx/1.0/WGraphicBufferSource.h b/media/libmedia/include/media/omx/1.0/WGraphicBufferSource.h
similarity index 100%
rename from include/media/omx/1.0/WGraphicBufferSource.h
rename to media/libmedia/include/media/omx/1.0/WGraphicBufferSource.h
diff --git a/include/media/omx/1.0/WOmx.h b/media/libmedia/include/media/omx/1.0/WOmx.h
similarity index 100%
rename from include/media/omx/1.0/WOmx.h
rename to media/libmedia/include/media/omx/1.0/WOmx.h
diff --git a/media/libmedia/include/media/omx/1.0/WOmxBufferSource.h b/media/libmedia/include/media/omx/1.0/WOmxBufferSource.h
new file mode 100644
index 0000000..086f648
--- /dev/null
+++ b/media/libmedia/include/media/omx/1.0/WOmxBufferSource.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2016, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_MEDIA_OMX_V1_0_WOMXBUFFERSOURCE_H
+#define ANDROID_HARDWARE_MEDIA_OMX_V1_0_WOMXBUFFERSOURCE_H
+
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+#include <binder/Binder.h>
+#include <media/OMXFenceParcelable.h>
+
+#include <android/hardware/media/omx/1.0/IOmxBufferSource.h>
+#include <android/BnOMXBufferSource.h>
+
+namespace android {
+namespace hardware {
+namespace media {
+namespace omx {
+namespace V1_0 {
+namespace utils {
+
+using ::android::hardware::media::omx::V1_0::IOmxBufferSource;
+using ::android::hidl::base::V1_0::IBase;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_handle;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+
+using ::android::OMXFenceParcelable;
+using ::android::IOMXBufferSource;
+using ::android::BnOMXBufferSource;
+
+/**
+ * Wrapper classes for conversion
+ * ==============================
+ *
+ * Naming convention:
+ * - LW = Legacy Wrapper --- It wraps a Treble object inside a legacy object.
+ * - TW = Treble Wrapper --- It wraps a legacy object inside a Treble object.
+ */
+
+struct LWOmxBufferSource : public BnOMXBufferSource {
+ sp<IOmxBufferSource> mBase;
+ LWOmxBufferSource(sp<IOmxBufferSource> const& base);
+ ::android::binder::Status onOmxExecuting() override;
+ ::android::binder::Status onOmxIdle() override;
+ ::android::binder::Status onOmxLoaded() override;
+ ::android::binder::Status onInputBufferAdded(int32_t bufferID) override;
+ ::android::binder::Status onInputBufferEmptied(
+ int32_t bufferID, OMXFenceParcelable const& fenceParcel) override;
+};
+
+struct TWOmxBufferSource : public IOmxBufferSource {
+ sp<IOMXBufferSource> mBase;
+ TWOmxBufferSource(sp<IOMXBufferSource> const& base);
+ Return<void> onOmxExecuting() override;
+ Return<void> onOmxIdle() override;
+ Return<void> onOmxLoaded() override;
+ Return<void> onInputBufferAdded(uint32_t buffer) override;
+ Return<void> onInputBufferEmptied(
+ uint32_t buffer, hidl_handle const& fence) override;
+};
+
+
+} // namespace utils
+} // namespace V1_0
+} // namespace omx
+} // namespace media
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_MEDIA_OMX_V1_0_WOMXBUFFERSOURCE_H
diff --git a/include/media/omx/1.0/WOmxNode.h b/media/libmedia/include/media/omx/1.0/WOmxNode.h
similarity index 100%
rename from include/media/omx/1.0/WOmxNode.h
rename to media/libmedia/include/media/omx/1.0/WOmxNode.h
diff --git a/include/media/omx/1.0/WOmxObserver.h b/media/libmedia/include/media/omx/1.0/WOmxObserver.h
similarity index 100%
rename from include/media/omx/1.0/WOmxObserver.h
rename to media/libmedia/include/media/omx/1.0/WOmxObserver.h
diff --git a/media/libmedia/mediametadataretriever.cpp b/media/libmedia/mediametadataretriever.cpp
index 08a9e6a..7d27d57 100644
--- a/media/libmedia/mediametadataretriever.cpp
+++ b/media/libmedia/mediametadataretriever.cpp
@@ -130,7 +130,7 @@
}
status_t MediaMetadataRetriever::setDataSource(
- const sp<IDataSource>& dataSource)
+ const sp<IDataSource>& dataSource, const char *mime)
{
ALOGV("setDataSource(IDataSource)");
Mutex::Autolock _l(mLock);
@@ -138,18 +138,20 @@
ALOGE("retriever is not initialized");
return INVALID_OPERATION;
}
- return mRetriever->setDataSource(dataSource);
+ return mRetriever->setDataSource(dataSource, mime);
}
-sp<IMemory> MediaMetadataRetriever::getFrameAtTime(int64_t timeUs, int option)
+sp<IMemory> MediaMetadataRetriever::getFrameAtTime(
+ int64_t timeUs, int option, int colorFormat, bool metaOnly)
{
- ALOGV("getFrameAtTime: time(%" PRId64 " us) option(%d)", timeUs, option);
+ ALOGV("getFrameAtTime: time(%" PRId64 " us) option(%d) colorFormat(%d) metaOnly(%d)",
+ timeUs, option, colorFormat, metaOnly);
Mutex::Autolock _l(mLock);
if (mRetriever == 0) {
ALOGE("retriever is not initialized");
return NULL;
}
- return mRetriever->getFrameAtTime(timeUs, option);
+ return mRetriever->getFrameAtTime(timeUs, option, colorFormat, metaOnly);
}
const char* MediaMetadataRetriever::extractMetadata(int keyCode)
diff --git a/media/libmediametrics/IMediaAnalyticsService.cpp b/media/libmediametrics/IMediaAnalyticsService.cpp
index 68bafe1..28a7746 100644
--- a/media/libmediametrics/IMediaAnalyticsService.cpp
+++ b/media/libmediametrics/IMediaAnalyticsService.cpp
@@ -60,7 +60,7 @@
data.writeInterfaceToken(IMediaAnalyticsService::getInterfaceDescriptor());
err = remote()->transact(GENERATE_UNIQUE_SESSIONID, data, &reply);
if (err != NO_ERROR) {
- ALOGW("bad response from service");
+ ALOGW("bad response from service for generateSessionId, err=%d", err);
return MediaAnalyticsItem::SessionIDInvalid;
}
sessionid = reply.readInt64();
@@ -94,6 +94,7 @@
err = remote()->transact(SUBMIT_ITEM, data, &reply);
if (err != NO_ERROR) {
+ ALOGW("bad response from service for submit, err=%d", err);
return MediaAnalyticsItem::SessionIDInvalid;
}
diff --git a/media/libmediametrics/MediaAnalyticsItem.cpp b/media/libmediametrics/MediaAnalyticsItem.cpp
index 43881b3..f968c09 100644
--- a/media/libmediametrics/MediaAnalyticsItem.cpp
+++ b/media/libmediametrics/MediaAnalyticsItem.cpp
@@ -59,6 +59,7 @@
MediaAnalyticsItem::MediaAnalyticsItem()
: mPid(-1),
mUid(-1),
+ mPkgVersionCode(0),
mSessionID(MediaAnalyticsItem::SessionIDNone),
mTimestamp(0),
mFinalized(0),
@@ -70,6 +71,7 @@
MediaAnalyticsItem::MediaAnalyticsItem(MediaAnalyticsItem::Key key)
: mPid(-1),
mUid(-1),
+ mPkgVersionCode(0),
mSessionID(MediaAnalyticsItem::SessionIDNone),
mTimestamp(0),
mFinalized(0),
@@ -98,7 +100,7 @@
// clean attributes
// contents of the attributes
- for (size_t i = 0 ; i < mPropSize; i++ ) {
+ for (size_t i = 0 ; i < mPropCount; i++ ) {
clearProp(&mProps[i]);
}
// the attribute records themselves
@@ -120,6 +122,8 @@
// key as part of constructor
dst->mPid = this->mPid;
dst->mUid = this->mUid;
+ dst->mPkgName = this->mPkgName;
+ dst->mPkgVersionCode = this->mPkgVersionCode;
dst->mSessionID = this->mSessionID;
dst->mTimestamp = this->mTimestamp;
dst->mFinalized = this->mFinalized;
@@ -201,6 +205,24 @@
return mUid;
}
+MediaAnalyticsItem &MediaAnalyticsItem::setPkgName(AString pkgName) {
+ mPkgName = pkgName;
+ return *this;
+}
+
+AString MediaAnalyticsItem::getPkgName() const {
+ return mPkgName;
+}
+
+MediaAnalyticsItem &MediaAnalyticsItem::setPkgVersionCode(int32_t pkgVersionCode) {
+ mPkgVersionCode = pkgVersionCode;
+ return *this;
+}
+
+int32_t MediaAnalyticsItem::getPkgVersionCode() const {
+ return mPkgVersionCode;
+}
+
// this key is for the overall record -- "codec", "player", "drm", etc
MediaAnalyticsItem &MediaAnalyticsItem::setKey(MediaAnalyticsItem::Key key) {
mKey = key;
@@ -263,11 +285,30 @@
i = mPropCount++;
prop = &mProps[i];
prop->setName(name, len);
+ prop->mType = kTypeNone; // make caller set type info
}
return prop;
}
+// used within the summarizers; return whether property existed
+bool MediaAnalyticsItem::removeProp(const char *name) {
+ size_t len = strlen(name);
+ size_t i = findPropIndex(name, len);
+ if (i < mPropCount) {
+ Prop *prop = &mProps[i];
+ clearProp(prop);
+ if (i != mPropCount-1) {
+ // in the middle, bring last one down to fill gap
+ copyProp(prop, &mProps[mPropCount-1]);
+ clearProp(&mProps[mPropCount-1]);
+ }
+ mPropCount--;
+ return true;
+ }
+ return false;
+}
+
// set the values
void MediaAnalyticsItem::setInt32(MediaAnalyticsItem::Attr name, int32_t value) {
Prop *prop = allocateProp(name);
@@ -568,6 +609,10 @@
// into 'this' object
// .. we make a copy of the string to put away.
mKey = data.readCString();
+ mPid = data.readInt32();
+ mUid = data.readInt32();
+ mPkgName = data.readCString();
+ mPkgVersionCode = data.readInt32();
mSessionID = data.readInt64();
mFinalized = data.readInt32();
mTimestamp = data.readInt64();
@@ -611,6 +656,10 @@
data->writeCString(mKey.c_str());
+ data->writeInt32(mPid);
+ data->writeInt32(mUid);
+ data->writeCString(mPkgName.c_str());
+ data->writeInt32(mPkgVersionCode);
data->writeInt64(mSessionID);
data->writeInt32(mFinalized);
data->writeInt64(mTimestamp);
@@ -651,21 +700,54 @@
AString MediaAnalyticsItem::toString() {
+ return toString(-1);
+}
- AString result = "(";
+AString MediaAnalyticsItem::toString(int version) {
+
+ // v0 : released with 'o'
+ // v1 : bug fix (missing pid/finalized separator),
+ // adds apk name, apk version code
+
+ if (version <= PROTO_FIRST) {
+ // default to original v0 format, until proper parsers are in place
+ version = PROTO_V0;
+ } else if (version > PROTO_LAST) {
+ version = PROTO_LAST;
+ }
+
+ AString result;
char buffer[512];
+ if (version == PROTO_V0) {
+ result = "(";
+ } else {
+ snprintf(buffer, sizeof(buffer), "[%d:", version);
+ result.append(buffer);
+ }
+
// same order as we spill into the parcel, although not required
// key+session are our primary matching criteria
- //RBE ALOGD("mKey.c_str");
result.append(mKey.c_str());
- //RBE ALOGD("post-mKey.c_str");
result.append(":");
snprintf(buffer, sizeof(buffer), "%" PRId64 ":", mSessionID);
result.append(buffer);
- // we need these internally, but don't want to upload them
- snprintf(buffer, sizeof(buffer), "%d:%d", mUid, mPid);
+ snprintf(buffer, sizeof(buffer), "%d:", mUid);
+ result.append(buffer);
+
+ if (version >= PROTO_V1) {
+ result.append(mPkgName);
+ snprintf(buffer, sizeof(buffer), ":%d:", mPkgVersionCode);
+ result.append(buffer);
+ }
+
+ // in 'o' (v1) , the separator between pid and finalized was omitted
+ if (version <= PROTO_V0) {
+ snprintf(buffer, sizeof(buffer), "%d", mPid);
+ } else {
+ snprintf(buffer, sizeof(buffer), "%d:", mPid);
+ }
result.append(buffer);
snprintf(buffer, sizeof(buffer), "%d:", mFinalized);
@@ -713,7 +795,11 @@
result.append(buffer);
}
- result.append(")");
+ if (version == PROTO_V0) {
+ result.append(")");
+ } else {
+ result.append("]");
+ }
return result;
}
@@ -734,11 +820,16 @@
sp<IMediaAnalyticsService> svc = getInstance();
if (svc != NULL) {
- svc->submit(this, forcenew);
+ MediaAnalyticsItem::SessionID_t newid = svc->submit(this, forcenew);
+ if (newid == SessionIDInvalid) {
+ AString p = this->toString();
+ ALOGW("Failed to record: %s [forcenew=%d]", p.c_str(), forcenew);
+ return false;
+ }
return true;
} else {
AString p = this->toString();
- ALOGD("Unable to record: %s [forcenew=%d]", p.c_str(), forcenew);
+ ALOGW("Unable to record: %s [forcenew=%d]", p.c_str(), forcenew);
return false;
}
}
@@ -747,6 +838,7 @@
// static
sp<IMediaAnalyticsService> MediaAnalyticsItem::sAnalyticsService;
static Mutex sInitMutex;
+static int remainingBindAttempts = SVC_TRIES;
//static
bool MediaAnalyticsItem::isEnabled() {
@@ -764,10 +856,28 @@
return true;
}
+
+// monitor health of our connection to the metrics service
+class MediaMetricsDeathNotifier : public IBinder::DeathRecipient {
+ virtual void binderDied(const wp<IBinder> &) {
+ ALOGW("Reacquire service connection on next request");
+ MediaAnalyticsItem::dropInstance();
+ }
+};
+
+static sp<MediaMetricsDeathNotifier> sNotifier = NULL;
+
+// static
+void MediaAnalyticsItem::dropInstance() {
+ Mutex::Autolock _l(sInitMutex);
+ remainingBindAttempts = SVC_TRIES;
+ sAnalyticsService = NULL;
+}
+
//static
sp<IMediaAnalyticsService> MediaAnalyticsItem::getInstance() {
+
static const char *servicename = "media.metrics";
- static int tries_remaining = SVC_TRIES;
int enabled = isEnabled();
if (enabled == false) {
@@ -799,15 +909,20 @@
Mutex::Autolock _l(sInitMutex);
const char *badness = "";
- // think of tries_remaining as telling us whether service==NULL because
+ // think of remainingBindAttempts as telling us whether service==NULL because
// (1) we haven't tried to initialize it yet
// (2) we've tried to initialize it, but failed.
- if (sAnalyticsService == NULL && tries_remaining > 0) {
+ if (sAnalyticsService == NULL && remainingBindAttempts > 0) {
sp<IServiceManager> sm = defaultServiceManager();
if (sm != NULL) {
sp<IBinder> binder = sm->getService(String16(servicename));
if (binder != NULL) {
sAnalyticsService = interface_cast<IMediaAnalyticsService>(binder);
+ if (sNotifier != NULL) {
+ sNotifier = NULL;
+ }
+ sNotifier = new MediaMetricsDeathNotifier();
+ binder->linkToDeath(sNotifier);
} else {
badness = "did not find service";
}
@@ -816,8 +931,8 @@
}
if (sAnalyticsService == NULL) {
- if (tries_remaining > 0) {
- tries_remaining--;
+ if (remainingBindAttempts > 0) {
+ remainingBindAttempts--;
}
if (DEBUG_SERVICEACCESS) {
ALOGD("Unable to bind to service %s: %s", servicename, badness);
@@ -829,7 +944,6 @@
}
}
-
// merge the info from 'incoming' into this record.
// we finish with a union of this+incoming and special handling for collisions
bool MediaAnalyticsItem::merge(MediaAnalyticsItem *incoming) {
diff --git a/media/libmediametrics/include/MediaAnalyticsItem.h b/media/libmediametrics/include/MediaAnalyticsItem.h
index dc501b2..dd7452f 100644
--- a/media/libmediametrics/include/MediaAnalyticsItem.h
+++ b/media/libmediametrics/include/MediaAnalyticsItem.h
@@ -42,6 +42,7 @@
friend class IMediaAnalyticsService;
friend class MediaMetricsJNI;
friend class MetricsSummarizer;
+ friend class MediaMetricsDeathNotifier;
public:
@@ -75,6 +76,14 @@
typedef const char *Attr;
+ enum {
+ PROTO_V0 = 0,
+ PROTO_FIRST = PROTO_V0,
+ PROTO_V1 = 1,
+ PROTO_LAST = PROTO_V1,
+ };
+
+
public:
// access functions for the class
@@ -161,11 +170,18 @@
MediaAnalyticsItem &setUid(uid_t);
uid_t getUid() const;
+ MediaAnalyticsItem &setPkgName(AString);
+ AString getPkgName() const;
+
+ MediaAnalyticsItem &setPkgVersionCode(int32_t);
+ int32_t getPkgVersionCode() const;
+
// our serialization code for binder calls
int32_t writeToParcel(Parcel *);
int32_t readFromParcel(const Parcel&);
AString toString();
+ AString toString(int version);
// are we collecting analytics data
static bool isEnabled();
@@ -188,10 +204,13 @@
// to help validate that A doesn't mess with B's records
pid_t mPid;
uid_t mUid;
+ AString mPkgName;
+ int32_t mPkgVersionCode;
// let's reuse a binder connection
static sp<IMediaAnalyticsService> sAnalyticsService;
static sp<IMediaAnalyticsService> getInstance();
+ static void dropInstance();
// tracking information
SessionID_t mSessionID; // grouping similar records
@@ -228,6 +247,7 @@
size_t findPropIndex(const char *name, size_t len);
Prop *findProp(const char *name);
Prop *allocateProp(const char *name);
+ bool removeProp(const char *name);
size_t mPropCount;
size_t mPropSize;
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index 942a8fc..496db0d 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -77,7 +77,7 @@
#include "TestPlayerStub.h"
#include "nuplayer/NuPlayerDriver.h"
-#include <OMX.h>
+#include <media/stagefright/omx/OMX.h>
#include "HDCP.h"
#include "HTTPBase.h"
diff --git a/media/libmediaplayerservice/MetadataRetrieverClient.cpp b/media/libmediaplayerservice/MetadataRetrieverClient.cpp
index 793f476..5a468f3 100644
--- a/media/libmediaplayerservice/MetadataRetrieverClient.cpp
+++ b/media/libmediaplayerservice/MetadataRetrieverClient.cpp
@@ -175,7 +175,7 @@
}
status_t MetadataRetrieverClient::setDataSource(
- const sp<IDataSource>& source)
+ const sp<IDataSource>& source, const char *mime)
{
ALOGV("setDataSource(IDataSource)");
Mutex::Autolock lock(mLock);
@@ -186,16 +186,18 @@
ALOGV("player type = %d", playerType);
sp<MediaMetadataRetrieverBase> p = createRetriever(playerType);
if (p == NULL) return NO_INIT;
- status_t ret = p->setDataSource(dataSource);
+ status_t ret = p->setDataSource(dataSource, mime);
if (ret == NO_ERROR) mRetriever = p;
return ret;
}
Mutex MetadataRetrieverClient::sLock;
-sp<IMemory> MetadataRetrieverClient::getFrameAtTime(int64_t timeUs, int option)
+sp<IMemory> MetadataRetrieverClient::getFrameAtTime(
+ int64_t timeUs, int option, int colorFormat, bool metaOnly)
{
- ALOGV("getFrameAtTime: time(%lld us) option(%d)", (long long)timeUs, option);
+ ALOGV("getFrameAtTime: time(%lld us) option(%d) colorFormat(%d), metaOnly(%d)",
+ (long long)timeUs, option, colorFormat, metaOnly);
Mutex::Autolock lock(mLock);
Mutex::Autolock glock(sLock);
mThumbnail.clear();
@@ -203,12 +205,13 @@
ALOGE("retriever is not initialized");
return NULL;
}
- VideoFrame *frame = mRetriever->getFrameAtTime(timeUs, option);
+ VideoFrame *frame = mRetriever->getFrameAtTime(
+ timeUs, option, colorFormat, metaOnly);
if (frame == NULL) {
ALOGE("failed to capture a video frame");
return NULL;
}
- size_t size = sizeof(VideoFrame) + frame->mSize;
+ size_t size = frame->getFlattenedSize();
sp<MemoryHeapBase> heap = new MemoryHeapBase(size, 0, "MetadataRetrieverClient");
if (heap == NULL) {
ALOGE("failed to create MemoryDealer");
@@ -222,16 +225,7 @@
return NULL;
}
VideoFrame *frameCopy = static_cast<VideoFrame *>(mThumbnail->pointer());
- frameCopy->mWidth = frame->mWidth;
- frameCopy->mHeight = frame->mHeight;
- frameCopy->mDisplayWidth = frame->mDisplayWidth;
- frameCopy->mDisplayHeight = frame->mDisplayHeight;
- frameCopy->mSize = frame->mSize;
- frameCopy->mRotationAngle = frame->mRotationAngle;
- ALOGV("rotation: %d", frameCopy->mRotationAngle);
- frameCopy->mData = (uint8_t *)frameCopy + sizeof(VideoFrame);
- memcpy(frameCopy->mData, frame->mData, frame->mSize);
- frameCopy->mData = 0;
+ frameCopy->copyFlattened(*frame);
delete frame; // Fix memory leakage
return mThumbnail;
}
diff --git a/media/libmediaplayerservice/MetadataRetrieverClient.h b/media/libmediaplayerservice/MetadataRetrieverClient.h
index fe7547c..c78cd4b 100644
--- a/media/libmediaplayerservice/MetadataRetrieverClient.h
+++ b/media/libmediaplayerservice/MetadataRetrieverClient.h
@@ -49,8 +49,9 @@
const KeyedVector<String8, String8> *headers);
virtual status_t setDataSource(int fd, int64_t offset, int64_t length);
- virtual status_t setDataSource(const sp<IDataSource>& source);
- virtual sp<IMemory> getFrameAtTime(int64_t timeUs, int option);
+ virtual status_t setDataSource(const sp<IDataSource>& source, const char *mime);
+ virtual sp<IMemory> getFrameAtTime(
+ int64_t timeUs, int option, int colorFormat, bool metaOnly);
virtual sp<IMemory> extractAlbumArt();
virtual const char* extractMetadata(int keyCode);
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index 6a09227..df36046 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -1171,7 +1171,7 @@
if (mSource != nullptr) {
if (audio) {
if (mVideoDecoderError || mSource->getFormat(false /* audio */) == NULL
- || mSurface == NULL) {
+ || mSurface == NULL || mVideoDecoder == NULL) {
// When both audio and video have error, or this stream has only audio
// which has error, notify client of error.
notifyListener(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, err);
@@ -1182,7 +1182,7 @@
mAudioDecoderError = true;
} else {
if (mAudioDecoderError || mSource->getFormat(true /* audio */) == NULL
- || mAudioSink == NULL) {
+ || mAudioSink == NULL || mAudioDecoder == NULL) {
// When both audio and video have error, or this stream has only video
// which has error, notify client of error.
notifyListener(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, err);
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp
index 8fe255b..ac187cc 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp
@@ -343,7 +343,7 @@
format, mSurface, crypto, 0 /* flags */);
if (err != OK) {
- ALOGE("Failed to configure %s decoder (err=%d)", mComponentName.c_str(), err);
+ ALOGE("Failed to configure [%s] decoder (err=%d)", mComponentName.c_str(), err);
mCodec->release();
mCodec.clear();
handleError(err);
@@ -372,7 +372,7 @@
err = mCodec->start();
if (err != OK) {
- ALOGE("Failed to start %s decoder (err=%d)", mComponentName.c_str(), err);
+ ALOGE("Failed to start [%s] decoder (err=%d)", mComponentName.c_str(), err);
mCodec->release();
mCodec.clear();
handleError(err);
@@ -460,6 +460,12 @@
if (notifyComplete) {
mResumePending = true;
}
+
+ if (mCodec == NULL) {
+ ALOGE("[%s] onResume without a valid codec", mComponentName.c_str());
+ handleError(NO_INIT);
+ return;
+ }
mCodec->start();
}
@@ -481,7 +487,7 @@
}
if (err != OK) {
- ALOGE("failed to flush %s (err=%d)", mComponentName.c_str(), err);
+ ALOGE("failed to flush [%s] (err=%d)", mComponentName.c_str(), err);
handleError(err);
// finish with posting kWhatFlushCompleted.
// we attempt to release the buffers even if flush fails.
@@ -530,7 +536,7 @@
releaseAndResetMediaBuffers();
if (err != OK) {
- ALOGE("failed to release %s (err=%d)", mComponentName.c_str(), err);
+ ALOGE("failed to release [%s] (err=%d)", mComponentName.c_str(), err);
handleError(err);
// finish with posting kWhatShutdownCompleted.
}
@@ -631,10 +637,17 @@
return false;
}
+ if (mCodec == NULL) {
+ ALOGE("[%s] handleAnInputBuffer without a valid codec", mComponentName.c_str());
+ handleError(NO_INIT);
+ return false;
+ }
+
sp<MediaCodecBuffer> buffer;
mCodec->getInputBuffer(index, &buffer);
if (buffer == NULL) {
+ ALOGE("[%s] handleAnInputBuffer, failed to get input buffer", mComponentName.c_str());
handleError(UNKNOWN_ERROR);
return false;
}
@@ -697,11 +710,18 @@
size_t size,
int64_t timeUs,
int32_t flags) {
+ if (mCodec == NULL) {
+ ALOGE("[%s] handleAnOutputBuffer without a valid codec", mComponentName.c_str());
+ handleError(NO_INIT);
+ return false;
+ }
+
// CHECK_LT(bufferIx, mOutputBuffers.size());
sp<MediaCodecBuffer> buffer;
mCodec->getOutputBuffer(index, &buffer);
if (buffer == NULL) {
+ ALOGE("[%s] handleAnOutputBuffer, failed to get output buffer", mComponentName.c_str());
handleError(UNKNOWN_ERROR);
return false;
}
@@ -949,6 +969,12 @@
}
bool NuPlayer::Decoder::onInputBufferFetched(const sp<AMessage> &msg) {
+ if (mCodec == NULL) {
+ ALOGE("[%s] onInputBufferFetched without a valid codec", mComponentName.c_str());
+ handleError(NO_INIT);
+ return false;
+ }
+
size_t bufferIx;
CHECK(msg->findSize("buffer-ix", &bufferIx));
CHECK_LT(bufferIx, mInputBuffers.size());
@@ -979,7 +1005,7 @@
}
if (streamErr != ERROR_END_OF_STREAM) {
- ALOGE("Stream error for %s (err=%d), EOS %s queued",
+ ALOGE("Stream error for [%s] (err=%d), EOS %s queued",
mComponentName.c_str(),
streamErr,
err == OK ? "successfully" : "unsuccessfully");
@@ -1073,7 +1099,7 @@
} // no cryptInfo
if (err != OK) {
- ALOGE("onInputBufferFetched: queue%sInputBuffer failed for %s (err=%d, %s)",
+ ALOGE("onInputBufferFetched: queue%sInputBuffer failed for [%s] (err=%d, %s)",
(cryptInfo != NULL ? "Secure" : ""),
mComponentName.c_str(), err, errorDetailMsg.c_str());
handleError(err);
@@ -1102,7 +1128,9 @@
}
}
- if (msg->findInt32("render", &render) && render) {
+ if (mCodec == NULL) {
+ err = NO_INIT;
+ } else if (msg->findInt32("render", &render) && render) {
int64_t timestampNs;
CHECK(msg->findInt64("timestampNs", ×tampNs));
err = mCodec->renderOutputBufferAndRelease(bufferIx, timestampNs);
@@ -1111,7 +1139,7 @@
err = mCodec->releaseOutputBuffer(bufferIx);
}
if (err != OK) {
- ALOGE("failed to release output buffer for %s (err=%d)",
+ ALOGE("failed to release output buffer for [%s] (err=%d)",
mComponentName.c_str(), err);
handleError(err);
}
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
index ad788f7..dc29761 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
@@ -69,6 +69,7 @@
mPlayer(new NuPlayer(pid)),
mPlayerFlags(0),
mAnalyticsItem(NULL),
+ mClientUid(-1),
mAtEOS(false),
mLooping(false),
mAutoLoop(false) {
@@ -109,6 +110,10 @@
status_t NuPlayerDriver::setUID(uid_t uid) {
mPlayer->setUID(uid);
+ mClientUid = uid;
+ if (mAnalyticsItem) {
+ mAnalyticsItem->setUid(mClientUid);
+ }
return OK;
}
@@ -601,6 +606,7 @@
mAnalyticsItem = new MediaAnalyticsItem("nuplayer");
if (mAnalyticsItem) {
mAnalyticsItem->generateSessionID();
+ mAnalyticsItem->setUid(mClientUid);
}
} else {
ALOGV("did not have anything to record");
@@ -639,11 +645,6 @@
notifyListener_l(MEDIA_STOPPED);
}
- if (property_get_bool("persist.debug.sf.stats", false)) {
- Vector<String16> args;
- dump(-1, args);
- }
-
mState = STATE_RESET_IN_PROGRESS;
mPlayer->resetAsync();
@@ -935,7 +936,10 @@
// don't send completion event when looping
return;
}
-
+ if (property_get_bool("persist.debug.sf.stats", false)) {
+ Vector<String16> args;
+ dump(-1, args);
+ }
mPlayer->pause();
mState = STATE_PAUSED;
}
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.h b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.h
index c5ddcb0..d0cf1dd 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.h
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.h
@@ -132,11 +132,13 @@
uint32_t mPlayerFlags;
MediaAnalyticsItem *mAnalyticsItem;
+ uid_t mClientUid;
bool mAtEOS;
bool mLooping;
bool mAutoLoop;
+
void updateMetrics(const char *where);
void logMetrics(const char *where);
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
index 758db1f..bd866cb 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
@@ -840,7 +840,7 @@
return;
}
- notifyEOS(true /* audio */, ERROR_END_OF_STREAM);
+ notifyEOS_l(true /* audio */, ERROR_END_OF_STREAM);
}
size_t NuPlayer::Renderer::fillAudioBuffer(void *buffer, size_t size) {
@@ -917,10 +917,10 @@
if (mAudioSink->needsTrailingPadding()) {
postEOSDelayUs = getPendingAudioPlayoutDurationUs(ALooper::GetNowUs());
}
- ALOGV("fillAudioBuffer: notifyEOS "
+ ALOGV("fillAudioBuffer: notifyEOS_l "
"mNumFramesWritten:%u finalResult:%d postEOSDelay:%lld",
mNumFramesWritten, entry->mFinalResult, (long long)postEOSDelayUs);
- notifyEOS(true /* audio */, entry->mFinalResult, postEOSDelayUs);
+ notifyEOS_l(true /* audio */, entry->mFinalResult, postEOSDelayUs);
}
}
return sizeCopied;
@@ -1152,7 +1152,18 @@
return writtenAudioDurationUs - (mediaUs - mAudioFirstAnchorTimeMediaUs);
}
}
- return writtenAudioDurationUs - mAudioSink->getPlayedOutDurationUs(nowUs);
+
+ const int64_t audioSinkPlayedUs = mAudioSink->getPlayedOutDurationUs(nowUs);
+ int64_t pendingUs = writtenAudioDurationUs - audioSinkPlayedUs;
+ if (pendingUs < 0) {
+ // This shouldn't happen unless the timestamp is stale.
+ ALOGW("%s: pendingUs %lld < 0, clamping to zero, potential resume after pause "
+ "writtenAudioDurationUs: %lld, audioSinkPlayedUs: %lld",
+ __func__, (long long)pendingUs,
+ (long long)writtenAudioDurationUs, (long long)audioSinkPlayedUs);
+ pendingUs = 0;
+ }
+ return pendingUs;
}
int64_t NuPlayer::Renderer::getRealTimeUs(int64_t mediaTimeUs, int64_t nowUs) {
@@ -1408,6 +1419,11 @@
}
void NuPlayer::Renderer::notifyEOS(bool audio, status_t finalResult, int64_t delayUs) {
+ Mutex::Autolock autoLock(mLock);
+ notifyEOS_l(audio, finalResult, delayUs);
+}
+
+void NuPlayer::Renderer::notifyEOS_l(bool audio, status_t finalResult, int64_t delayUs) {
if (audio && delayUs > 0) {
sp<AMessage> msg = new AMessage(kWhatEOS, this);
msg->setInt32("audioEOSGeneration", mAudioEOSGeneration);
@@ -1420,6 +1436,11 @@
notify->setInt32("audio", static_cast<int32_t>(audio));
notify->setInt32("finalResult", finalResult);
notify->post(delayUs);
+
+ if (audio) {
+ // Video might outlive audio. Clear anchor to enable video only case.
+ mAnchorTimeMediaUs = -1;
+ }
}
void NuPlayer::Renderer::notifyAudioTearDown(AudioTearDownReason reason) {
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.h b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.h
index e6850b5..f58b79c 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.h
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.h
@@ -275,6 +275,7 @@
void onChangeAudioFormat(const sp<AMessage> &meta, const sp<AMessage> ¬ify);
void notifyEOS(bool audio, status_t finalResult, int64_t delayUs = 0);
+ void notifyEOS_l(bool audio, status_t finalResult, int64_t delayUs = 0);
void notifyFlushComplete(bool audio);
void notifyPosition();
void notifyVideoLateBy(int64_t lateByUs);
diff --git a/media/libnbaio/Android.bp b/media/libnbaio/Android.bp
index f511876..4220b77 100644
--- a/media/libnbaio/Android.bp
+++ b/media/libnbaio/Android.bp
@@ -1,15 +1,51 @@
+
+cc_defaults {
+ name: "libnbaio_mono_defaults",
+ srcs: [
+ "MonoPipe.cpp",
+ "MonoPipeReader.cpp",
+ "NBAIO.cpp",
+ ],
+ header_libs: [
+ "libaudioclient_headers",
+ "libaudio_system_headers",
+ "libmedia_headers",
+ ],
+ export_header_lib_headers: [
+ "libaudioclient_headers",
+ "libmedia_headers",
+ ],
+
+ shared_libs: [
+ "libaudioutils",
+ "liblog",
+ "libutils",
+ ],
+
+ export_include_dirs: ["include_mono"],
+}
+
+// libnbaio_mono is the part of libnbaio that is available for vendors to use. Vendor modules can't
+// link against libnbaio and system modules can't link against libnbaio_mono. The rest of libnbaio
+// pulls in too many other dependencies.
+cc_library_shared {
+ name: "libnbaio_mono",
+ vendor: true,
+ defaults: ["libnbaio_mono_defaults"],
+}
+
cc_library_shared {
name: "libnbaio",
+ defaults: ["libnbaio_mono_defaults"],
srcs: [
"AudioBufferProviderSource.cpp",
"AudioStreamInSource.cpp",
"AudioStreamOutSink.cpp",
- "MonoPipe.cpp",
- "MonoPipeReader.cpp",
- "NBAIO.cpp",
"NBLog.cpp",
+ "PerformanceAnalysis.cpp",
"Pipe.cpp",
"PipeReader.cpp",
+ "ReportPerformance.cpp",
"SourceAudioBufferProvider.cpp",
],
@@ -24,8 +60,8 @@
"libaudioutils",
"libbinder",
"libcutils",
- "libutils",
"liblog",
+ "libutils",
],
cflags: [
@@ -35,7 +71,5 @@
include_dirs: ["system/media/audio_utils/include"],
- local_include_dirs: ["include"],
-
export_include_dirs: ["include"],
}
diff --git a/media/libnbaio/AudioStreamOutSink.cpp b/media/libnbaio/AudioStreamOutSink.cpp
index cbff87d..8564899 100644
--- a/media/libnbaio/AudioStreamOutSink.cpp
+++ b/media/libnbaio/AudioStreamOutSink.cpp
@@ -18,6 +18,7 @@
//#define LOG_NDEBUG 0
#include <utils/Log.h>
+#include <audio_utils/clock.h>
#include <media/audiohal/StreamHalInterface.h>
#include <media/nbaio/AudioStreamOutSink.h>
@@ -82,8 +83,7 @@
return INVALID_OPERATION;
}
timestamp.mPosition[ExtendedTimestamp::LOCATION_KERNEL] = position64;
- timestamp.mTimeNs[ExtendedTimestamp::LOCATION_KERNEL] =
- time.tv_sec * 1000000000LL + time.tv_nsec;
+ timestamp.mTimeNs[ExtendedTimestamp::LOCATION_KERNEL] = audio_utils_ns_from_timespec(&time);
return OK;
}
diff --git a/media/libnbaio/NBLog.cpp b/media/libnbaio/NBLog.cpp
index ebb90c8..827cba9 100644
--- a/media/libnbaio/NBLog.cpp
+++ b/media/libnbaio/NBLog.cpp
@@ -18,14 +18,14 @@
* Documentation: Workflow summary for histogram data processing:
* For more details on FIFO, please see system/media/audio_utils; doxygen
* TODO: add this documentation to doxygen once it is further developed
-* 1) writing the data to a buffer
-* onWork
+* 1) Writing buffer period timestamp to the circular buffer
+* onWork()
* Called every period length (e.g., 4ms)
* Calls LOG_HIST_TS
* LOG_HIST_TS
-* Hashes file name and line number
-* calls NBLOG::Writer::logHistTS once
-* NBLOG::Writer::logHistTS
+* Hashes file name and line number, and writes single timestamp to buffer
+* calls NBLOG::Writer::logEventHistTS once
+* NBLOG::Writer::logEventHistTS
* calls NBLOG::Writer::log on hash and current timestamp
* time is in CLOCK_MONOTONIC converted to ns
* NBLOG::Writer::log(Event, const void*, size_t)
@@ -44,6 +44,8 @@
* ssize_t audio_utils_fifo_reader::obtain
* Determines readable buffer section via pointer arithmetic on reader
* and writer pointers
+* Similarly, LOG_AUDIO_STATE() is called by onStateChange whenever audio is
+* turned on or off, and writes this notification to the FIFO.
*
* 2) reading the data from shared memory
* Thread::threadloop()
@@ -51,6 +53,7 @@
* NBLog::MergeThread::threadLoop()
* calls NBLog::Merger::merge
* NBLog::Merger::merge
+* Merges snapshots sorted by timestamp
* for each reader in vector of class NamedReader,
* callsNamedReader::reader()->getSnapshot
* TODO: check whether the rest of this function is relevant
@@ -59,11 +62,12 @@
* calls mFifoReader->obtain to find readable data
* sets snapshot.begin() and .end() iterators to boundaries of valid entries
* moves the fifo reader index to after the last entry read
-* in this case, the buffer is in shared memory. in (3), the buffer is private
+* in this case, the buffer is in shared memory. in (4), the buffer is private
*
* 3) reading the data from private buffer
* MediaLogService::dump
-* calls NBLog::Reader::dump(int) on instance of subclass mergeReader
+* calls NBLog::Reader::dump(CONSOLE)
+* The private buffer contains all logs for all readers in shared memory
* NBLog::Reader::dump(int)
* calls getSnapshot on the current reader
* calls dump(int, size_t, Snapshot)
@@ -72,9 +76,10 @@
* (string, timestamp, etc...)
* In the case of EVENT_HISTOGRAM_ENTRY_TS, adds a list of timestamp sequences
* (histogram entry) to NBLog::mHists
-* In the case of EVENT_HISTOGRAM_FLUSH, calls drawHistogram on each element in
-* the list and erases it
-* TODO: when do these events occur?
+* TODO: add every HISTOGRAM_ENTRY_TS to two
+* circular buffers: one short-term and one long-term (can add even longer-term
+* structures in the future). When dump is called, print everything currently
+* in the buffer.
* NBLog::drawHistogram
* input: timestamp array
* buckets this to a histogram and prints
@@ -82,7 +87,7 @@
*/
#define LOG_TAG "NBLog"
-//#define LOG_NDEBUG 0
+// #define LOG_NDEBUG 0
#include <algorithm>
#include <climits>
@@ -102,6 +107,8 @@
#include <new>
#include <audio_utils/roundup.h>
#include <media/nbaio/NBLog.h>
+#include <media/nbaio/PerformanceAnalysis.h>
+#include <media/nbaio/ReportPerformance.h>
// #include <utils/CallStack.h> // used to print callstack
#include <utils/Log.h>
#include <utils/String8.h>
@@ -134,7 +141,7 @@
switch (type) {
case EVENT_START_FMT:
return std::make_unique<FormatEntry>(FormatEntry(ptr));
- case EVENT_HISTOGRAM_FLUSH:
+ case EVENT_AUDIO_STATE:
case EVENT_HISTOGRAM_ENTRY_TS:
return std::make_unique<HistogramEntry>(HistogramEntry(ptr));
default:
@@ -324,7 +331,8 @@
*(int*) (buffer + sizeof(entry) + sizeof(HistTsEntry)) = author;
// Update lengths
buffer[offsetof(entry, length)] = sizeof(HistTsEntryWithAuthor);
- buffer[sizeof(buffer) + Entry::kPreviousLengthOffset] = sizeof(HistTsEntryWithAuthor);
+ buffer[offsetof(entry, data) + sizeof(HistTsEntryWithAuthor) + offsetof(ending, length)]
+ = sizeof(HistTsEntryWithAuthor);
// Write new buffer into FIFO
dst->write(buffer, sizeof(buffer));
return EntryIterator(mEntry).next();
@@ -513,7 +521,7 @@
log(EVENT_HASH, &hash, sizeof(hash));
}
-void NBLog::Writer::logHistTS(log_hash_t hash)
+void NBLog::Writer::logEventHistTs(Event event, log_hash_t hash)
{
if (!mEnabled) {
return;
@@ -522,22 +530,7 @@
data.hash = hash;
data.ts = get_monotonic_ns();
if (data.ts > 0) {
- log(EVENT_HISTOGRAM_ENTRY_TS, &data, sizeof(data));
- } else {
- ALOGE("Failed to get timestamp");
- }
-}
-
-void NBLog::Writer::logHistFlush(log_hash_t hash)
-{
- if (!mEnabled) {
- return;
- }
- HistTsEntry data;
- data.hash = hash;
- data.ts = get_monotonic_ns();
- if (data.ts > 0) {
- log(EVENT_HISTOGRAM_FLUSH, &data, sizeof(data));
+ log(event, &data, sizeof(data));
} else {
ALOGE("Failed to get timestamp");
}
@@ -771,15 +764,15 @@
NBLog::Event::EVENT_HISTOGRAM_ENTRY_TS};
const std::set<NBLog::Event> NBLog::Reader::endingTypes {NBLog::Event::EVENT_END_FMT,
NBLog::Event::EVENT_HISTOGRAM_ENTRY_TS,
- NBLog::Event::EVENT_HISTOGRAM_FLUSH};
+ NBLog::Event::EVENT_AUDIO_STATE};
+
NBLog::Reader::Reader(const void *shared, size_t size)
: mShared((/*const*/ Shared *) shared), /*mIMemory*/
mFd(-1), mIndent(0),
mFifo(mShared != NULL ?
new audio_utils_fifo(size, sizeof(uint8_t),
mShared->mBuffer, mShared->mRear, NULL /*throttlesFront*/) : NULL),
- mFifoReader(mFifo != NULL ? new audio_utils_fifo_reader(*mFifo) : NULL),
- findGlitch(false)
+ mFifoReader(mFifo != NULL ? new audio_utils_fifo_reader(*mFifo) : NULL)
{
}
@@ -795,39 +788,6 @@
delete mFifo;
}
-inline static int deltaMs(int64_t ns1, int64_t ns2) {
- return (ns2 - ns1) / (1000 * 1000);
-}
-
-// Produces a log warning if the timing of recent buffer periods caused a glitch
-// Computes sum of running window of three buffer periods
-// Checks whether the buffer periods leave enough CPU time for the next one
-// e.g. if a buffer period is expected to be 4 ms and a buffer requires 3 ms of CPU time,
-// here are some glitch cases:
-// 4 + 4 + 6 ; 5 + 4 + 5; 2 + 2 + 10
-// TODO: develop this code to track changes in histogram distribution in addition
-// to / instead of glitches
-void NBLog::Reader::alertIfGlitch(const std::vector<int64_t> &samples) {
- //TODO: measure kPeriodLen and kRatio from the data as they may change.
- static const int kPeriodLen = 4; // current period length is ideally 4 ms
- static const double kRatio = 0.75; // estimate of CPU time as ratio of period length
- // DAC processing time for 4 ms buffer
- static const int kPeriodTime = static_cast<int>(round(kPeriodLen * kRatio));
- static const int kNumBuff = 3; // number of buffers considered in local history
- std::deque<int> periods(kNumBuff, kPeriodLen);
- for (size_t i = 2; i < samples.size(); ++i) { // skip first time entry
- periods.push_front(deltaMs(samples[i - 1], samples[i]));
- periods.pop_back();
- // TODO: check that all glitch cases are covered
- if (std::accumulate(periods.begin(), periods.end(), 0) > kNumBuff * kPeriodLen +
- kPeriodLen - kPeriodTime) {
- ALOGW("A glitch occurred");
- periods.assign(kNumBuff, kPeriodLen);
- }
- }
- return;
-}
-
const uint8_t *NBLog::Reader::findLastEntryOfTypes(const uint8_t *front, const uint8_t *back,
const std::set<Event> &types) {
while (back + Entry::kPreviousLengthOffset >= front) {
@@ -911,61 +871,17 @@
}
-// writes sample deltas to file, either truncating or appending
-inline void writeHistToFile(const std::vector<int64_t> &samples, bool append) {
- // name of file on audioserver
- static const char* const kName = (char *)"/data/misc/audioserver/sample_results.txt";
- // stores deltas between the samples
- std::vector<int64_t> intervals;
- for (size_t i = 1; i < samples.size(); ++i) {
- intervals.push_back(deltaMs(samples[i - 1], samples[i]));
- }
- if (intervals.empty()) return;
- // Deletes maximum value in a histogram. Temp quick fix.
- // FIXME: need to find root cause of approx. 35th element from the end
- // consistently being an outlier in the first histogram of a flush
- // ALOGW("%" PRId64 "before", (int64_t) *(std::max_element(intervals.begin(), intervals.end())));
- intervals.erase(std::max_element(intervals.begin(), intervals.end()));
- // ALOGW("%" PRId64 "after", (int64_t) *(std::max_element(intervals.begin(), intervals.end())));
- std::ofstream ofs;
- ofs.open(kName, append ? std::ios::app : std::ios::trunc);
- if (!ofs) {
- ALOGW("couldn't open file %s", kName);
- return;
- }
- for (size_t i = 0; i < intervals.size(); ++i) {
- ofs << intervals[i] << "\n";
- }
- ofs.close();
-}
-
+// TODO: move this to PerformanceAnalysis
+// TODO: make call to dump periodic so that data in shared FIFO does not get overwritten
void NBLog::Reader::dump(int fd, size_t indent, NBLog::Reader::Snapshot &snapshot)
{
- // CallStack cs(LOG_TAG);
-#if 0
- struct timespec ts;
- time_t maxSec = -1;
- while (entry - start >= (int) Entry::kOverhead) {
- if (prevEntry - start < 0 || !prevEntry.hasConsistentLength()) {
- break;
- }
- if (prevEntry->type == EVENT_TIMESTAMP) {
- if (prevEntry->length != sizeof(struct timespec)) {
- // corrupt
- break;
- }
- prevEntry.copyData((uint8_t*) &ts);
- if (ts.tv_sec > maxSec) {
- maxSec = ts.tv_sec;
- }
- }
- --entry;
- --prevEntry;
- }
-#endif
mFd = fd;
mIndent = indent;
String8 timestamp, body;
+ // FIXME: this is not thread safe
+ // TODO: need a separate instance of performanceAnalysis for each thread
+ // used to store data and to call analysis functions
+ static ReportPerformance::PerformanceAnalysis performanceAnalysis;
size_t lost = snapshot.lost() + (snapshot.begin() - EntryIterator(snapshot.data()));
if (lost > 0) {
body.appendFormat("warning: lost %zu bytes worth of events", lost);
@@ -973,85 +889,9 @@
// log to push it out. Consider keeping the timestamp/body between calls to copyEntryDataAt().
dumpLine(timestamp, body);
}
-#if 0
- size_t width = 1;
- while (maxSec >= 10) {
- ++width;
- maxSec /= 10;
- }
- if (maxSec >= 0) {
- timestamp.appendFormat("[%*s]", (int) width + 4, "");
- }
- bool deferredTimestamp = false;
-#endif
for (auto entry = snapshot.begin(); entry != snapshot.end();) {
switch (entry->type) {
-#if 0
- case EVENT_STRING:
- body.appendFormat("%.*s", (int) entry.length(), entry.data());
- break;
- case EVENT_TIMESTAMP: {
- // already checked that length == sizeof(struct timespec);
- entry.copyData((const uint8_t*) &ts);
- long prevNsec = ts.tv_nsec;
- long deltaMin = LONG_MAX;
- long deltaMax = -1;
- long deltaTotal = 0;
- auto aux(entry);
- for (;;) {
- ++aux;
- if (end - aux >= 0 || aux.type() != EVENT_TIMESTAMP) {
- break;
- }
- struct timespec tsNext;
- aux.copyData((const uint8_t*) &tsNext);
- if (tsNext.tv_sec != ts.tv_sec) {
- break;
- }
- long delta = tsNext.tv_nsec - prevNsec;
- if (delta < 0) {
- break;
- }
- if (delta < deltaMin) {
- deltaMin = delta;
- }
- if (delta > deltaMax) {
- deltaMax = delta;
- }
- deltaTotal += delta;
- prevNsec = tsNext.tv_nsec;
- }
- size_t n = (aux - entry) / (sizeof(struct timespec) + 3 /*Entry::kOverhead?*/);
- if (deferredTimestamp) {
- dumpLine(timestamp, body);
- deferredTimestamp = false;
- }
- timestamp.clear();
- if (n >= kSquashTimestamp) {
- timestamp.appendFormat("[%d.%03d to .%.03d by .%.03d to .%.03d]",
- (int) ts.tv_sec, (int) (ts.tv_nsec / 1000000),
- (int) ((ts.tv_nsec + deltaTotal) / 1000000),
- (int) (deltaMin / 1000000), (int) (deltaMax / 1000000));
- entry = aux;
- // advance = 0;
- break;
- }
- timestamp.appendFormat("[%d.%03d]", (int) ts.tv_sec,
- (int) (ts.tv_nsec / 1000000));
- deferredTimestamp = true;
- }
- break;
- case EVENT_INTEGER:
- appendInt(&body, entry.data());
- break;
- case EVENT_FLOAT:
- appendFloat(&body, entry.data());
- break;
- case EVENT_PID:
- appendPID(&body, entry.data(), entry.length());
- break;
-#endif
case EVENT_START_FMT:
entry = handleFormat(FormatEntry(entry), ×tamp, &body);
break;
@@ -1063,40 +903,12 @@
memcpy(&hash, &(data->hash), sizeof(hash));
int64_t ts;
memcpy(&ts, &data->ts, sizeof(ts));
- const std::pair<log_hash_t, int> key(hash, data->author);
- // TODO might want to filter excessively high outliers, which are usually caused
- // by the thread being inactive.
- mHists[key].push_back(ts);
+ performanceAnalysis.logTsEntry(ts);
++entry;
break;
}
- // draws histograms stored in global Reader::mHists and erases them
- case EVENT_HISTOGRAM_FLUSH: {
- HistogramEntry histEntry(entry);
- // Log timestamp
- // Timestamp of call to drawHistogram, not when audio was generated
- const int64_t ts = histEntry.timestamp();
- timestamp.clear();
- timestamp.appendFormat("[%d.%03d]", (int) (ts / (1000 * 1000 * 1000)),
- (int) ((ts / (1000 * 1000)) % 1000));
- // Log histograms
- setFindGlitch(true);
- body.appendFormat("Histogram flush - ");
- handleAuthor(histEntry, &body);
- for (auto hist = mHists.begin(); hist != mHists.end();) {
- if (hist->first.second == histEntry.author()) {
- body.appendFormat("%X", (int)hist->first.first);
- if (findGlitch) {
- alertIfGlitch(hist->second);
- }
- // set file to empty and write data for all histograms in this set
- writeHistToFile(hist->second, hist != mHists.begin());
- drawHistogram(&body, hist->second, true, indent);
- hist = mHists.erase(hist);
- } else {
- ++hist;
- }
- }
+ case EVENT_AUDIO_STATE: {
+ performanceAnalysis.handleStateChange();
++entry;
break;
}
@@ -1110,10 +922,10 @@
++entry;
break;
}
-
- if (!body.isEmpty()) {
- dumpLine(timestamp, body);
- }
+ }
+ performanceAnalysis.reportPerformance(&body);
+ if (!body.isEmpty()) {
+ dumpLine(timestamp, body);
}
}
@@ -1139,16 +951,6 @@
return iMemory != 0 && mIMemory != 0 && iMemory->pointer() == mIMemory->pointer();
}
-void NBLog::Reader::setFindGlitch(bool s)
-{
- findGlitch = s;
-}
-
-bool NBLog::Reader::isFindGlitch() const
-{
- return findGlitch;
-}
-
// ---------------------------------------------------------------------------
void NBLog::appendTimestamp(String8 *body, const void *data) {
@@ -1283,126 +1085,6 @@
return arg;
}
-static int widthOf(int x) {
- int width = 0;
- while (x > 0) {
- ++width;
- x /= 10;
- }
- return width;
-}
-
-static std::map<int, int> buildBuckets(const std::vector<int64_t> &samples) {
- // TODO allow buckets of variable resolution
- std::map<int, int> buckets;
- for (size_t i = 1; i < samples.size(); ++i) {
- ++buckets[deltaMs(samples[i - 1], samples[i])];
- }
- return buckets;
-}
-
-static inline uint32_t log2(uint32_t x) {
- // This works for x > 0
- return 31 - __builtin_clz(x);
-}
-
-// TODO put this function in separate file. Make it return a std::string instead of modifying body
-/*
-Example output:
-[54.234] Histogram flush - AudioOut_D:
-Histogram 33640BF1
- [ 1][ 1][ 1][ 3][54][69][ 1][ 2][ 1]
- 64| []
- 32| [] []
- 16| [] []
- 8| [] []
- 4| [] []
- 2|______________[]__[]__[]______[]____
- 4 5 6 8 9 10 11 13 15
-Notice that all values that fall in the same row have the same height (65 and 127 are displayed
-identically). That's why exact counts are added at the top.
-*/
-void NBLog::Reader::drawHistogram(String8 *body,
- const std::vector<int64_t> &samples,
- bool logScale,
- int indent,
- int maxHeight) {
- // this avoids some corner cases
- if (samples.size() <= 1) {
- return;
- }
- // temp code for debugging the outlier timestamp
- const int kMaxMs = 100;
- for (size_t i = 1; i < samples.size()-1; ++i) {
- const int currDelta = deltaMs(samples[i - 1], samples[i]);
- if (currDelta > kMaxMs) {
- body->appendFormat("\nlocation: %zu, size: %zu, pos from end: %zu, %d\t", i,
- samples.size(), samples.size() - i, currDelta);
- }
- }
- // FIXME: as can be seen when printing the values, the outlier timestamps typically occur
- // in the first histogram 35 to 38 indices from the end (most often 35).
- // TODO: build histogram buckets earlier and discard timestamps to save memory
- std::map<int, int> buckets = buildBuckets(samples);
- // TODO consider changing all ints to uint32_t or uint64_t
-
- // underscores and spaces length corresponds to maximum width of histogram
- static const int kLen = 40;
- std::string underscores(kLen, '-');
- std::string spaces(kLen, ' ');
-
- auto it = buckets.begin();
- int maxDelta = it->first;
- int maxCount = it->second;
- // Compute maximum values
- while (++it != buckets.end()) {
- if (it->first > maxDelta) {
- maxDelta = it->first;
- }
- if (it->second > maxCount) {
- maxCount = it->second;
- }
- }
- int height = logScale ? log2(maxCount) + 1 : maxCount; // maxCount > 0, safe to call log2
- const int leftPadding = widthOf(logScale ? pow(2, height) : maxCount);
- const int colWidth = std::max(std::max(widthOf(maxDelta) + 1, 3), leftPadding + 2);
- int scalingFactor = 1;
- // scale data if it exceeds maximum height
- if (height > maxHeight) {
- scalingFactor = (height + maxHeight) / maxHeight;
- height /= scalingFactor;
- }
- body->appendFormat("\n%*s", leftPadding + 11, "Occurrences");
- // write histogram label line with bucket values
- body->appendFormat("\n%*s", indent, " ");
- body->appendFormat("%*s", leftPadding, " ");
- for (auto const &x : buckets) {
- body->appendFormat("%*d", colWidth, x.second);
- }
- // write histogram ascii art
- body->appendFormat("\n%*s", indent, " ");
- for (int row = height * scalingFactor; row >= 0; row -= scalingFactor) {
- const int value = logScale ? (1 << row) : row;
- body->appendFormat("%.*s", leftPadding, spaces.c_str());
- for (auto const &x : buckets) {
- body->appendFormat("%.*s%s", colWidth - 1, spaces.c_str(), x.second < value ? " " : "|");
- }
- body->appendFormat("\n%*s", indent, " ");
- }
- // print x-axis
- const int columns = static_cast<int>(buckets.size());
- body->appendFormat("%*c", leftPadding, ' ');
- body->appendFormat("%.*s", (columns + 1) * colWidth, underscores.c_str());
- body->appendFormat("\n%*s", indent, " ");
-
- // write footer with bucket labels
- body->appendFormat("%*s", leftPadding, " ");
- for (auto const &x : buckets) {
- body->appendFormat("%*d", colWidth, x.first);
- }
- body->appendFormat("%.*s%s", colWidth, spaces.c_str(), "ms\n");
-}
-
NBLog::Merger::Merger(const void *shared, size_t size):
mShared((Shared *) shared),
mFifo(mShared != NULL ?
diff --git a/media/libnbaio/OWNERS b/media/libnbaio/OWNERS
new file mode 100644
index 0000000..f9cb567
--- /dev/null
+++ b/media/libnbaio/OWNERS
@@ -0,0 +1 @@
+gkasten@google.com
diff --git a/media/libnbaio/PerformanceAnalysis.cpp b/media/libnbaio/PerformanceAnalysis.cpp
new file mode 100644
index 0000000..fb3bddc
--- /dev/null
+++ b/media/libnbaio/PerformanceAnalysis.cpp
@@ -0,0 +1,374 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#define LOG_TAG "PerformanceAnalysis"
+// #define LOG_NDEBUG 0
+
+#include <algorithm>
+#include <climits>
+#include <deque>
+#include <iostream>
+#include <math.h>
+#include <numeric>
+#include <vector>
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/prctl.h>
+#include <time.h>
+#include <new>
+#include <audio_utils/roundup.h>
+#include <media/nbaio/NBLog.h>
+#include <media/nbaio/PerformanceAnalysis.h>
+#include <media/nbaio/ReportPerformance.h>
+// #include <utils/CallStack.h> // used to print callstack
+#include <utils/Log.h>
+#include <utils/String8.h>
+
+#include <queue>
+#include <utility>
+
+namespace android {
+
+namespace ReportPerformance {
+
+PerformanceAnalysis::PerformanceAnalysis() {
+ // These variables will be (FIXME) learned from the data
+ kPeriodMs = 4; // typical buffer period (mode)
+ // average number of Ms spent processing buffer
+ kPeriodMsCPU = static_cast<int>(kPeriodMs * kRatio);
+}
+
+// converts a time series into a map. key: buffer period length. value: count
+static std::map<int, int> buildBuckets(const std::vector<int64_t> &samples) {
+ // TODO allow buckets of variable resolution
+ std::map<int, int> buckets;
+ for (size_t i = 1; i < samples.size(); ++i) {
+ ++buckets[deltaMs(samples[i - 1], samples[i])];
+ }
+ return buckets;
+}
+
+static int widthOf(int x) {
+ int width = 0;
+ while (x > 0) {
+ ++width;
+ x /= 10;
+ }
+ return width;
+}
+
+// Given a series of audio processing wakeup timestamps,
+// buckets the time intervals into a histogram, searches for
+// outliers, analyzes the outlier series for unexpectedly
+// small or large values and stores these as peaks, and flushes
+// the timestamp series from memory.
+void PerformanceAnalysis::processAndFlushTimeStampSeries() {
+ // 1) analyze the series to store all outliers and their exact timestamps:
+ storeOutlierData(mTimeStampSeries);
+
+ // 2) detect peaks in the outlier series
+ detectPeaks();
+
+ // 3) compute its histogram, append to mRecentHists and clear the time series
+ mRecentHists.emplace_back(static_cast<timestamp>(mTimeStampSeries[0]),
+ buildBuckets(mTimeStampSeries));
+ // do not let mRecentHists exceed capacity
+ // ALOGD("mRecentHists size: %d", static_cast<int>(mRecentHists.size()));
+ if (mRecentHists.size() >= kRecentHistsCapacity) {
+ // ALOGD("popped back mRecentHists");
+ mRecentHists.pop_front();
+ }
+ mTimeStampSeries.clear();
+}
+
+// forces short-term histogram storage to avoid adding idle audio time interval
+// to buffer period data
+void PerformanceAnalysis::handleStateChange() {
+ ALOGD("handleStateChange");
+ processAndFlushTimeStampSeries();
+ return;
+}
+
+// Takes a single buffer period timestamp entry information and stores it in a
+// temporary series of timestamps. Once the series is full, the data is analyzed,
+// stored, and emptied.
+void PerformanceAnalysis::logTsEntry(int64_t ts) {
+ // TODO might want to filter excessively high outliers, which are usually caused
+ // by the thread being inactive.
+ // Store time series data for each reader in order to bucket it once there
+ // is enough data. Then, write to recentHists as a histogram.
+ mTimeStampSeries.push_back(ts);
+ // if length of the time series has reached kShortHistSize samples,
+ // analyze the data and flush the timestamp series from memory
+ if (mTimeStampSeries.size() >= kShortHistSize) {
+ processAndFlushTimeStampSeries();
+ }
+}
+
+// When the short-term histogram array mRecentHists has reached capacity,
+// merge histograms for data compression and store them in mLongTermHists
+// clears mRecentHists
+// TODO: have logTsEntry write directly to mLongTermHists, discard mRecentHists,
+// start a new histogram when a peak occurs
+void PerformanceAnalysis::processAndFlushRecentHists() {
+
+ // Buckets is used to aggregate short-term histograms.
+ Histogram buckets;
+ timestamp startingTs = mRecentHists[0].first;
+
+ for (const auto &shortHist: mRecentHists) {
+ // If the time between starting and ending timestamps has reached the maximum,
+ // add the current histogram (buckets) to the long-term histogram buffer,
+ // clear buckets, and start a new long-term histogram aggregation process.
+ if (deltaMs(startingTs, shortHist.first) >= kMaxHistTimespanMs) {
+ mLongTermHists.emplace_back(startingTs, std::move(buckets));
+ buckets.clear();
+ startingTs = shortHist.first;
+ // When memory is full, delete oldest histogram
+ // TODO use a circular buffer
+ if (mLongTermHists.size() >= kLongTermHistsCapacity) {
+ mLongTermHists.pop_front();
+ }
+ }
+
+ // add current histogram to buckets
+ for (const auto &countPair : shortHist.second) {
+ buckets[countPair.first] += countPair.second;
+ }
+ }
+ mRecentHists.clear();
+ // TODO: decide when/where to call writeToFile
+ // TODO: add a thread-specific extension to the file name
+ static const char* const kName = (const char *) "/data/misc/audioserver/sample_results.txt";
+ writeToFile(mOutlierData, mLongTermHists, kName, false);
+}
+
+// Given a series of outlier intervals (mOutlier data),
+// looks for changes in distribution (peaks), which can be either positive or negative.
+// The function sets the mean to the starting value and sigma to 0, and updates
+// them as long as no peak is detected. When a value is more than 'threshold'
+// standard deviations from the mean, a peak is detected and the mean and sigma
+// are set to the peak value and 0.
+void PerformanceAnalysis::detectPeaks() {
+ if (mOutlierData.empty()) {
+ return;
+ }
+
+ // compute mean of the distribution. Used to check whether a value is large
+ const double kTypicalDiff = std::accumulate(
+ mOutlierData.begin(), mOutlierData.end(), 0,
+ [](auto &a, auto &b){return a + b.first;}) / mOutlierData.size();
+ // ALOGD("typicalDiff %f", kTypicalDiff);
+
+ // iterator at the beginning of a sequence, or updated to the most recent peak
+ std::deque<std::pair<uint64_t, uint64_t>>::iterator start = mOutlierData.begin();
+ // the mean and standard deviation are updated every time a peak is detected
+ // initialize first time. The mean from the previous sequence is stored
+ // for the next sequence. Here, they are initialized for the first time.
+ if (mPeakDetectorMean < 0) {
+ mPeakDetectorMean = static_cast<double>(start->first);
+ mPeakDetectorSd = 0;
+ }
+ auto sqr = [](auto x){ return x * x; };
+ for (auto it = mOutlierData.begin(); it != mOutlierData.end(); ++it) {
+ // no surprise occurred:
+ // the new element is a small number of standard deviations from the mean
+ if ((fabs(it->first - mPeakDetectorMean) < kStddevThreshold * mPeakDetectorSd) ||
+ // or: right after peak has been detected, the delta is smaller than average
+ (mPeakDetectorSd == 0 && fabs(it->first - mPeakDetectorMean) < kTypicalDiff)) {
+ // update the mean and sd:
+ // count number of elements (distance between start interator and current)
+ const int kN = std::distance(start, it) + 1;
+ // usual formulas for mean and sd
+ mPeakDetectorMean = std::accumulate(start, it + 1, 0.0,
+ [](auto &a, auto &b){return a + b.first;}) / kN;
+ mPeakDetectorSd = sqrt(std::accumulate(start, it + 1, 0.0,
+ [=](auto &a, auto &b){ return a + sqr(b.first - mPeakDetectorMean);})) /
+ ((kN > 1)? kN - 1 : kN); // kN - 1: mean is correlated with variance
+ }
+ // surprising value: store peak timestamp and reset mean, sd, and start iterator
+ else {
+ mPeakTimestamps.emplace_back(it->second);
+ // TODO: remove pop_front once a circular buffer is in place
+ if (mPeakTimestamps.size() >= kPeakSeriesSize) {
+ mPeakTimestamps.pop_front();
+ }
+ mPeakDetectorMean = static_cast<double>(it->first);
+ mPeakDetectorSd = 0;
+ start = it;
+ }
+ }
+ return;
+}
+
+// Called by LogTsEntry. The input is a vector of timestamps.
+// Finds outliers and writes to mOutlierdata.
+// Each value in mOutlierdata consists of: <outlier timestamp, time elapsed since previous outlier>.
+// e.g. timestamps (ms) 1, 4, 5, 16, 18, 28 will produce pairs (4, 5), (13, 18).
+// This function is applied to the time series before it is converted into a histogram.
+void PerformanceAnalysis::storeOutlierData(const std::vector<int64_t> ×tamps) {
+ if (timestamps.size() < 1) {
+ return;
+ }
+ // first pass: need to initialize
+ if (mElapsed == 0) {
+ mPrevNs = timestamps[0];
+ }
+ for (const auto &ts: timestamps) {
+ const uint64_t diffMs = static_cast<uint64_t>(deltaMs(mPrevNs, ts));
+ if (diffMs >= static_cast<uint64_t>(kOutlierMs)) {
+ mOutlierData.emplace_back(mElapsed, static_cast<uint64_t>(mPrevNs));
+ // Remove oldest value if the vector is full
+ // TODO: remove pop_front once circular buffer is in place
+ // FIXME: make sure kShortHistSize is large enough that that data will never be lost
+ // before being written to file or to a FIFO
+ if (mOutlierData.size() >= kOutlierSeriesSize) {
+ mOutlierData.pop_front();
+ }
+ mElapsed = 0;
+ }
+ mElapsed += diffMs;
+ mPrevNs = ts;
+ }
+}
+
+
+// FIXME: delete this temporary test code, recycled for various new functions
+void PerformanceAnalysis::testFunction() {
+ // produces values (4: 5000000), (13: 18000000)
+ // ns timestamps of buffer periods
+ const std::vector<int64_t>kTempTestData = {1000000, 4000000, 5000000,
+ 16000000, 18000000, 28000000};
+ PerformanceAnalysis::storeOutlierData(kTempTestData);
+ for (const auto &outlier: mOutlierData) {
+ ALOGE("PerformanceAnalysis test %lld: %lld",
+ static_cast<long long>(outlier.first), static_cast<long long>(outlier.second));
+ }
+ detectPeaks();
+}
+
+// TODO Make it return a std::string instead of modifying body --> is this still relevant?
+// TODO consider changing all ints to uint32_t or uint64_t
+// TODO: move this to ReportPerformance, probably make it a friend function of PerformanceAnalysis
+void PerformanceAnalysis::reportPerformance(String8 *body, int maxHeight) {
+ if (mRecentHists.size() < 1) {
+ ALOGD("reportPerformance: mRecentHists is empty");
+ return;
+ }
+ ALOGD("reportPerformance: hists size %d", static_cast<int>(mRecentHists.size()));
+ // TODO: more elaborate data analysis
+ std::map<int, int> buckets;
+ for (const auto &shortHist: mRecentHists) {
+ for (const auto &countPair : shortHist.second) {
+ buckets[countPair.first] += countPair.second;
+ }
+ }
+
+ // underscores and spaces length corresponds to maximum width of histogram
+ static const int kLen = 40;
+ std::string underscores(kLen, '_');
+ std::string spaces(kLen, ' ');
+
+ auto it = buckets.begin();
+ int maxDelta = it->first;
+ int maxCount = it->second;
+ // Compute maximum values
+ while (++it != buckets.end()) {
+ if (it->first > maxDelta) {
+ maxDelta = it->first;
+ }
+ if (it->second > maxCount) {
+ maxCount = it->second;
+ }
+ }
+ int height = log2(maxCount) + 1; // maxCount > 0, safe to call log2
+ const int leftPadding = widthOf(1 << height);
+ const int colWidth = std::max(std::max(widthOf(maxDelta) + 1, 3), leftPadding + 2);
+ int scalingFactor = 1;
+ // scale data if it exceeds maximum height
+ if (height > maxHeight) {
+ scalingFactor = (height + maxHeight) / maxHeight;
+ height /= scalingFactor;
+ }
+ body->appendFormat("\n%*s", leftPadding + 11, "Occurrences");
+ // write histogram label line with bucket values
+ body->appendFormat("\n%s", " ");
+ body->appendFormat("%*s", leftPadding, " ");
+ for (auto const &x : buckets) {
+ body->appendFormat("%*d", colWidth, x.second);
+ }
+ // write histogram ascii art
+ body->appendFormat("\n%s", " ");
+ for (int row = height * scalingFactor; row >= 0; row -= scalingFactor) {
+ const int value = 1 << row;
+ body->appendFormat("%.*s", leftPadding, spaces.c_str());
+ for (auto const &x : buckets) {
+ body->appendFormat("%.*s%s", colWidth - 1, spaces.c_str(), x.second < value ? " " : "|");
+ }
+ body->appendFormat("\n%s", " ");
+ }
+ // print x-axis
+ const int columns = static_cast<int>(buckets.size());
+ body->appendFormat("%*c", leftPadding, ' ');
+ body->appendFormat("%.*s", (columns + 1) * colWidth, underscores.c_str());
+ body->appendFormat("\n%s", " ");
+
+ // write footer with bucket labels
+ body->appendFormat("%*s", leftPadding, " ");
+ for (auto const &x : buckets) {
+ body->appendFormat("%*d", colWidth, x.first);
+ }
+ body->appendFormat("%.*s%s", colWidth, spaces.c_str(), "ms\n");
+
+ // Now report glitches
+ body->appendFormat("\ntime elapsed between glitches and glitch timestamps\n");
+ for (const auto &outlier: mOutlierData) {
+ body->appendFormat("%lld: %lld\n", static_cast<long long>(outlier.first),
+ static_cast<long long>(outlier.second));
+ }
+
+}
+
+
+// Produces a log warning if the timing of recent buffer periods caused a glitch
+// Computes sum of running window of three buffer periods
+// Checks whether the buffer periods leave enough CPU time for the next one
+// e.g. if a buffer period is expected to be 4 ms and a buffer requires 3 ms of CPU time,
+// here are some glitch cases:
+// 4 + 4 + 6 ; 5 + 4 + 5; 2 + 2 + 10
+// TODO: develop this code to track changes in histogram distribution in addition
+// to / instead of glitches.
+void PerformanceAnalysis::alertIfGlitch(const std::vector<int64_t> &samples) {
+ std::deque<int> periods(kNumBuff, kPeriodMs);
+ for (size_t i = 2; i < samples.size(); ++i) { // skip first time entry
+ periods.push_front(deltaMs(samples[i - 1], samples[i]));
+ periods.pop_back();
+ // TODO: check that all glitch cases are covered
+ if (std::accumulate(periods.begin(), periods.end(), 0) > kNumBuff * kPeriodMs +
+ kPeriodMs - kPeriodMsCPU) {
+ ALOGW("A glitch occurred");
+ periods.assign(kNumBuff, kPeriodMs);
+ }
+ }
+ return;
+}
+
+} // namespace ReportPerformance
+
+} // namespace android
diff --git a/media/libnbaio/ReportPerformance.cpp b/media/libnbaio/ReportPerformance.cpp
new file mode 100644
index 0000000..dc50ada
--- /dev/null
+++ b/media/libnbaio/ReportPerformance.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "ReportPerformance"
+
+#include <fstream>
+#include <iostream>
+#include <queue>
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/prctl.h>
+#include <utility>
+#include <media/nbaio/NBLog.h>
+#include <media/nbaio/PerformanceAnalysis.h>
+#include <media/nbaio/ReportPerformance.h>
+// #include <utils/CallStack.h> // used to print callstack
+#include <utils/Log.h>
+#include <utils/String8.h>
+
+namespace android {
+
+namespace ReportPerformance {
+
+// Writes outlier intervals, timestamps, and histograms spanning long time intervals to a file.
+// TODO: format the data efficiently and write different types of data to different files
+void writeToFile(std::deque<std::pair<outlierInterval, timestamp>> &outlierData,
+ std::deque<std::pair<timestamp, Histogram>> &hists,
+ const char * kName,
+ bool append) {
+ ALOGD("writing performance data to file");
+ if (outlierData.empty() || hists.empty()) {
+ return;
+ }
+
+ std::ofstream ofs;
+ ofs.open(kName, append ? std::ios::app : std::ios::trunc);
+ if (!ofs.is_open()) {
+ ALOGW("couldn't open file %s", kName);
+ return;
+ }
+ ofs << "Outlier data: interval and timestamp\n";
+ for (const auto &outlier : outlierData) {
+ ofs << outlier.first << ": " << outlier.second << "\n";
+ }
+ ofs << "Histogram data\n";
+ for (const auto &hist : hists) {
+ ofs << "\ttimestamp\n";
+ ofs << hist.first << "\n";
+ ofs << "\tbuckets and counts\n";
+ for (const auto &bucket : hist.second) {
+ ofs << bucket.first << ": " << bucket.second << "\n";
+ }
+ }
+ ofs.close();
+}
+
+} // namespace ReportPerformance
+
+} // namespace android
diff --git a/media/libnbaio/include/AudioBufferProviderSource.h b/media/libnbaio/include/AudioBufferProviderSource.h
deleted file mode 100644
index 4747dcf..0000000
--- a/media/libnbaio/include/AudioBufferProviderSource.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Implementation of NBAIO_Source that wraps an AudioBufferProvider
-
-#ifndef ANDROID_AUDIO_BUFFER_PROVIDER_SOURCE_H
-#define ANDROID_AUDIO_BUFFER_PROVIDER_SOURCE_H
-
-#include "NBAIO.h"
-#include <media/AudioBufferProvider.h>
-
-namespace android {
-
-class AudioBufferProviderSource : public NBAIO_Source {
-
-public:
- AudioBufferProviderSource(AudioBufferProvider *provider, const NBAIO_Format& format);
- virtual ~AudioBufferProviderSource();
-
- // NBAIO_Port interface
-
- //virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers,
- // NBAIO_Format counterOffers[], size_t& numCounterOffers);
- //virtual NBAIO_Format format();
-
- // NBAIO_Source interface
-
- //virtual size_t framesRead() const;
- //virtual size_t framesOverrun();
- //virtual size_t overruns();
- virtual ssize_t availableToRead();
- virtual ssize_t read(void *buffer, size_t count);
- virtual ssize_t readVia(readVia_t via, size_t total, void *user, size_t block);
-
-private:
- AudioBufferProvider * const mProvider;
- AudioBufferProvider::Buffer mBuffer; // current buffer
- size_t mConsumed; // number of frames consumed so far from current buffer
-};
-
-} // namespace android
-
-#endif // ANDROID_AUDIO_BUFFER_PROVIDER_SOURCE_H
diff --git a/media/libnbaio/include/AudioStreamInSource.h b/media/libnbaio/include/AudioStreamInSource.h
deleted file mode 100644
index 508e0fe..0000000
--- a/media/libnbaio/include/AudioStreamInSource.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_AUDIO_STREAM_IN_SOURCE_H
-#define ANDROID_AUDIO_STREAM_IN_SOURCE_H
-
-#include "NBAIO.h"
-
-namespace android {
-
-class StreamInHalInterface;
-
-// not multi-thread safe
-class AudioStreamInSource : public NBAIO_Source {
-
-public:
- AudioStreamInSource(sp<StreamInHalInterface> stream);
- virtual ~AudioStreamInSource();
-
- // NBAIO_Port interface
-
- virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers,
- NBAIO_Format counterOffers[], size_t& numCounterOffers);
- //virtual NBAIO_Format format() const;
-
- // NBAIO_Sink interface
-
- //virtual size_t framesRead() const;
- virtual int64_t framesOverrun();
- virtual int64_t overruns() { (void) framesOverrun(); return mOverruns; }
-
- // This is an over-estimate, and could dupe the caller into making a blocking read()
- // FIXME Use an audio HAL API to query the buffer filling status when it's available.
- virtual ssize_t availableToRead() { return mStreamBufferSizeBytes / mFrameSize; }
-
- virtual ssize_t read(void *buffer, size_t count);
-
- // NBAIO_Sink end
-
-#if 0 // until necessary
- sp<StreamInHalInterface> stream() const { return mStream; }
-#endif
-
-private:
- sp<StreamInHalInterface> mStream;
- size_t mStreamBufferSizeBytes; // as reported by get_buffer_size()
- int64_t mFramesOverrun;
- int64_t mOverruns;
-};
-
-} // namespace android
-
-#endif // ANDROID_AUDIO_STREAM_IN_SOURCE_H
diff --git a/media/libnbaio/include/AudioStreamOutSink.h b/media/libnbaio/include/AudioStreamOutSink.h
deleted file mode 100644
index 56a2a38..0000000
--- a/media/libnbaio/include/AudioStreamOutSink.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_AUDIO_STREAM_OUT_SINK_H
-#define ANDROID_AUDIO_STREAM_OUT_SINK_H
-
-#include "NBAIO.h"
-
-namespace android {
-
-class StreamOutHalInterface;
-
-// not multi-thread safe
-class AudioStreamOutSink : public NBAIO_Sink {
-
-public:
- AudioStreamOutSink(sp<StreamOutHalInterface> stream);
- virtual ~AudioStreamOutSink();
-
- // NBAIO_Port interface
-
- virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers,
- NBAIO_Format counterOffers[], size_t& numCounterOffers);
- //virtual NBAIO_Format format();
-
- // NBAIO_Sink interface
-
- //virtual size_t framesWritten() const;
- //virtual size_t framesUnderrun() const;
- //virtual size_t underruns() const;
-
- // This is an over-estimate, and could dupe the caller into making a blocking write()
- // FIXME Use an audio HAL API to query the buffer emptying status when it's available.
- virtual ssize_t availableToWrite() { return mStreamBufferSizeBytes / mFrameSize; }
-
- virtual ssize_t write(const void *buffer, size_t count);
-
- virtual status_t getTimestamp(ExtendedTimestamp ×tamp);
-
- // NBAIO_Sink end
-
-#if 0 // until necessary
- sp<StreamOutHalInterface> stream() const { return mStream; }
-#endif
-
-private:
- sp<StreamOutHalInterface> mStream;
- size_t mStreamBufferSizeBytes; // as reported by get_buffer_size()
-};
-
-} // namespace android
-
-#endif // ANDROID_AUDIO_STREAM_OUT_SINK_H
diff --git a/media/libnbaio/include/LibsndfileSink.h b/media/libnbaio/include/LibsndfileSink.h
deleted file mode 100644
index 97a57e0..0000000
--- a/media/libnbaio/include/LibsndfileSink.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_AUDIO_LIBSNDFILE_SINK_H
-#define ANDROID_AUDIO_LIBSNDFILE_SINK_H
-
-#include "NBAIO.h"
-#include "sndfile.h"
-
-// Implementation of NBAIO_Sink that wraps a libsndfile opened in SFM_WRITE mode
-
-namespace android {
-
-class LibsndfileSink : public NBAIO_Sink {
-
-public:
- LibsndfileSink(SNDFILE *sndfile, const SF_INFO &sfinfo);
- virtual ~LibsndfileSink();
-
- // NBAIO_Port interface
-
- //virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers,
- // NBAIO_Format counterOffers[], size_t& numCounterOffers);
- //virtual NBAIO_Format format() const;
-
- // NBAIO_Sink interface
-
- //virtual size_t framesWritten() const;
- //virtual size_t framesUnderrun() const;
- //virtual size_t underruns() const;
- //virtual ssize_t availableToWrite();
- virtual ssize_t write(const void *buffer, size_t count);
- //virtual ssize_t writeVia(writeVia_t via, size_t total, void *user, size_t block);
-
-private:
- SNDFILE * mSndfile;
-};
-
-} // namespace android
-
-#endif // ANDROID_AUDIO_LIBSNDFILE_SINK_H
diff --git a/media/libnbaio/include/LibsndfileSource.h b/media/libnbaio/include/LibsndfileSource.h
deleted file mode 100644
index 4fbdb4b..0000000
--- a/media/libnbaio/include/LibsndfileSource.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_AUDIO_LIBSNDFILE_SOURCE_H
-#define ANDROID_AUDIO_LIBSNDFILE_SOURCE_H
-
-#include "NBAIO.h"
-#include "sndfile.h"
-
-// Implementation of NBAIO_Source that wraps a libsndfile opened in SFM_READ mode
-
-namespace android {
-
-class LibsndfileSource : public NBAIO_Source {
-
-public:
- // If 'loop' is true and it permits seeking, then we'll act as an infinite source
- LibsndfileSource(SNDFILE *sndfile, const SF_INFO &sfinfo, bool loop = false);
- virtual ~LibsndfileSource();
-
- // NBAIO_Port interface
-
- //virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers,
- // NBAIO_Format counterOffers[], size_t& numCounterOffers);
- //virtual NBAIO_Format format() const;
-
- // NBAIO_Source interface
-
- //virtual size_t framesRead() const;
- //virtual size_t framesOverrun();
- //virtual size_t overruns();
- virtual ssize_t availableToRead();
- virtual ssize_t read(void *buffer, size_t count);
- //virtual ssize_t readVia(readVia_t via, size_t total, void *user, size_t block);
-
-private:
- SNDFILE * mSndfile;
- sf_count_t mEstimatedFramesUntilEOF;
- bool mLooping;
- bool mReadAnyFramesThisLoopCycle;
-};
-
-} // namespace android
-
-#endif // ANDROID_AUDIO_LIBSNDFILE_SOURCE_H
diff --git a/media/libnbaio/include/MonoPipe.h b/media/libnbaio/include/MonoPipe.h
deleted file mode 100644
index 60ae92e..0000000
--- a/media/libnbaio/include/MonoPipe.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_AUDIO_MONO_PIPE_H
-#define ANDROID_AUDIO_MONO_PIPE_H
-
-#include <time.h>
-#include <audio_utils/fifo.h>
-#include <media/SingleStateQueue.h>
-#include "NBAIO.h"
-
-namespace android {
-
-typedef SingleStateQueue<ExtendedTimestamp> ExtendedTimestampSingleStateQueue;
-
-// MonoPipe is similar to Pipe except:
-// - supports only a single reader, called MonoPipeReader
-// - write() cannot overrun; instead it will return a short actual count if insufficient space
-// - write() can optionally block if the pipe is full
-// Like Pipe, it is not multi-thread safe for either writer or reader
-// but writer and reader can be different threads.
-class MonoPipe : public NBAIO_Sink {
-
- friend class MonoPipeReader;
-
-public:
- // reqFrames will be rounded up to a power of 2, and all slots are available. Must be >= 2.
- // Note: whatever shares this object with another thread needs to do so in an SMP-safe way (like
- // creating it the object before creating the other thread, or storing the object with a
- // release_store). Otherwise the other thread could see a partially-constructed object.
- MonoPipe(size_t reqFrames, const NBAIO_Format& format, bool writeCanBlock = false);
- virtual ~MonoPipe();
-
- // NBAIO_Port interface
-
- //virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers,
- // NBAIO_Format counterOffers[], size_t& numCounterOffers);
- //virtual NBAIO_Format format() const;
-
- // NBAIO_Sink interface
-
- //virtual int64_t framesWritten() const;
- //virtual int64_t framesUnderrun() const;
- //virtual int64_t underruns() const;
-
- // returns n where 0 <= n <= mMaxFrames, or a negative status_t
- // including the private status codes in NBAIO.h
- virtual ssize_t availableToWrite();
-
- virtual ssize_t write(const void *buffer, size_t count);
- //virtual ssize_t writeVia(writeVia_t via, size_t total, void *user, size_t block);
-
- // average number of frames present in the pipe under normal conditions.
- // See throttling mechanism in MonoPipe::write()
- size_t getAvgFrames() const { return mSetpoint; }
- void setAvgFrames(size_t setpoint);
- size_t maxFrames() const { return mMaxFrames; }
-
- // Set the shutdown state for the write side of a pipe.
- // This may be called by an unrelated thread. When shutdown state is 'true',
- // a write that would otherwise block instead returns a short transfer count.
- // There is no guarantee how long it will take for the shutdown to be recognized,
- // but it will not be an unbounded amount of time.
- // The state can be restored to normal by calling shutdown(false).
- void shutdown(bool newState = true);
-
- // Return true if the write side of a pipe is currently shutdown.
- bool isShutdown();
-
- // Return NO_ERROR if there is a timestamp available
- status_t getTimestamp(ExtendedTimestamp ×tamp);
-
-private:
- const size_t mMaxFrames; // as requested in constructor, rounded up to a power of 2
- void * const mBuffer;
- audio_utils_fifo mFifo;
- audio_utils_fifo_writer mFifoWriter;
- bool mWriteTsValid; // whether mWriteTs is valid
- struct timespec mWriteTs; // time that the previous write() completed
- size_t mSetpoint; // target value for pipe fill depth
- const bool mWriteCanBlock; // whether write() should block if the pipe is full
-
- bool mIsShutdown; // whether shutdown(true) was called, no barriers are needed
-
- ExtendedTimestampSingleStateQueue::Shared mTimestampShared;
- ExtendedTimestampSingleStateQueue::Mutator mTimestampMutator;
- ExtendedTimestampSingleStateQueue::Observer mTimestampObserver;
-};
-
-} // namespace android
-
-#endif // ANDROID_AUDIO_MONO_PIPE_H
diff --git a/media/libnbaio/include/NBLog.h b/media/libnbaio/include/NBLog.h
deleted file mode 100644
index 785b9c2..0000000
--- a/media/libnbaio/include/NBLog.h
+++ /dev/null
@@ -1,605 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Non-blocking event logger intended for safe communication between processes via shared memory
-
-#ifndef ANDROID_MEDIA_NBLOG_H
-#define ANDROID_MEDIA_NBLOG_H
-
-#include <binder/IMemory.h>
-#include <audio_utils/fifo.h>
-#include <utils/Mutex.h>
-#include <utils/threads.h>
-
-#include <map>
-#include <set>
-#include <vector>
-
-namespace android {
-
-class String8;
-
-class NBLog {
-
-public:
-
-typedef uint64_t log_hash_t;
-
-// FIXME Everything needed for client (writer API and registration) should be isolated
-// from the rest of the implementation.
-class Writer;
-class Reader;
-
-private:
-
-enum Event : uint8_t {
- EVENT_RESERVED,
- EVENT_STRING, // ASCII string, not NUL-terminated
- // TODO: make timestamp optional
- EVENT_TIMESTAMP, // clock_gettime(CLOCK_MONOTONIC)
- EVENT_INTEGER, // integer value entry
- EVENT_FLOAT, // floating point value entry
- EVENT_PID, // process ID and process name
- EVENT_AUTHOR, // author index (present in merged logs) tracks entry's original log
- EVENT_START_FMT, // logFormat start event: entry includes format string, following
- // entries contain format arguments
- EVENT_HASH, // unique HASH of log origin, originates from hash of file name
- // and line number
- EVENT_HISTOGRAM_ENTRY_TS, // single datum for timestamp histogram
- EVENT_HISTOGRAM_FLUSH, // show histogram on log
- EVENT_END_FMT, // end of logFormat argument list
-
- EVENT_UPPER_BOUND, // to check for invalid events
-};
-
-
-// ---------------------------------------------------------------------------
-// API for handling format entry operations
-
-// a formatted entry has the following structure:
-// * START_FMT entry, containing the format string
-// * TIMESTAMP entry
-// * HASH entry
-// * author entry of the thread that generated it (optional, present in merged log)
-// * format arg1
-// * format arg2
-// * ...
-// * END_FMT entry
-
-// entry representation in memory
-struct entry {
- const uint8_t type;
- const uint8_t length;
- const uint8_t data[0];
-};
-
-// entry tail representation (after data)
-struct ending {
- uint8_t length;
- uint8_t next[0];
-};
-
-// entry iterator
-class EntryIterator {
-public:
- EntryIterator();
- explicit EntryIterator(const uint8_t *entry);
- EntryIterator(const EntryIterator &other);
-
- // dereference underlying entry
- const entry& operator*() const;
- const entry* operator->() const;
- // advance to next entry
- EntryIterator& operator++(); // ++i
- // back to previous entry
- EntryIterator& operator--(); // --i
- EntryIterator next() const;
- EntryIterator prev() const;
- bool operator!=(const EntryIterator &other) const;
- int operator-(const EntryIterator &other) const;
-
- bool hasConsistentLength() const;
- void copyTo(std::unique_ptr<audio_utils_fifo_writer> &dst) const;
- void copyData(uint8_t *dst) const;
-
- template<typename T>
- inline const T& payload() {
- return *reinterpret_cast<const T *>(ptr + offsetof(entry, data));
- }
-
- inline operator const uint8_t*() const {
- return ptr;
- }
-
-private:
- const uint8_t *ptr;
-};
-
-class AbstractEntry {
-public:
-
- // Entry starting in the given pointer
- explicit AbstractEntry(const uint8_t *entry);
- virtual ~AbstractEntry() {}
-
- // build concrete entry of appropriate class from pointer
- static std::unique_ptr<AbstractEntry> buildEntry(const uint8_t *ptr);
-
- // get format entry timestamp
- // TODO consider changing to uint64_t
- virtual int64_t timestamp() const = 0;
-
- // get format entry's unique id
- virtual log_hash_t hash() const = 0;
-
- // entry's author index (-1 if none present)
- // a Merger has a vector of Readers, author simply points to the index of the
- // Reader that originated the entry
- // TODO consider changing to uint32_t
- virtual int author() const = 0;
-
- // copy entry, adding author before timestamp, returns iterator to end of entry
- virtual EntryIterator copyWithAuthor(std::unique_ptr<audio_utils_fifo_writer> &dst,
- int author) const = 0;
-
-protected:
- // copies ordinary entry from src to dst, and returns length of entry
- // size_t copyEntry(audio_utils_fifo_writer *dst, const iterator &it);
- const uint8_t *mEntry;
-};
-
-class FormatEntry : public AbstractEntry {
-public:
- // explicit FormatEntry(const EntryIterator &it);
- explicit FormatEntry(const uint8_t *ptr) : AbstractEntry(ptr) {}
- virtual ~FormatEntry() {}
-
- EntryIterator begin() const;
-
- // Entry's format string
- const char* formatString() const;
-
- // Enrty's format string length
- size_t formatStringLength() const;
-
- // Format arguments (excluding format string, timestamp and author)
- EntryIterator args() const;
-
- // get format entry timestamp
- virtual int64_t timestamp() const override;
-
- // get format entry's unique id
- virtual log_hash_t hash() const override;
-
- // entry's author index (-1 if none present)
- // a Merger has a vector of Readers, author simply points to the index of the
- // Reader that originated the entry
- virtual int author() const override;
-
- // copy entry, adding author before timestamp, returns size of original entry
- virtual EntryIterator copyWithAuthor(std::unique_ptr<audio_utils_fifo_writer> &dst,
- int author) const override;
-
-};
-
-class HistogramEntry : public AbstractEntry {
-public:
- explicit HistogramEntry(const uint8_t *ptr) : AbstractEntry(ptr) {
- }
- virtual ~HistogramEntry() {}
-
- virtual int64_t timestamp() const override;
-
- virtual log_hash_t hash() const override;
-
- virtual int author() const override;
-
- virtual EntryIterator copyWithAuthor(std::unique_ptr<audio_utils_fifo_writer> &dst,
- int author) const override;
-
-};
-
-// ---------------------------------------------------------------------------
-
-// representation of a single log entry in private memory
-struct Entry {
- Entry(Event event, const void *data, size_t length)
- : mEvent(event), mLength(length), mData(data) { }
- /*virtual*/ ~Entry() { }
-
- // used during writing to format Entry information as follows: [type][length][data ... ][length]
- int copyEntryDataAt(size_t offset) const;
-
-private:
- friend class Writer;
- Event mEvent; // event type
- uint8_t mLength; // length of additional data, 0 <= mLength <= kMaxLength
- const void *mData; // event type-specific data
- static const size_t kMaxLength = 255;
-public:
- // mEvent, mLength, mData[...], duplicate mLength
- static const size_t kOverhead = sizeof(entry) + sizeof(ending);
- // endind length of previous entry
- static const size_t kPreviousLengthOffset = - sizeof(ending) +
- offsetof(ending, length);
-};
-
-struct HistTsEntry {
- log_hash_t hash;
- int64_t ts;
-}; //TODO __attribute__((packed));
-
-struct HistTsEntryWithAuthor {
- log_hash_t hash;
- int64_t ts;
- int author;
-}; //TODO __attribute__((packed));
-
-struct HistIntEntry {
- log_hash_t hash;
- int value;
-}; //TODO __attribute__((packed));
-
-// representation of a single log entry in shared memory
-// byte[0] mEvent
-// byte[1] mLength
-// byte[2] mData[0]
-// ...
-// byte[2+i] mData[i]
-// ...
-// byte[2+mLength-1] mData[mLength-1]
-// byte[2+mLength] duplicate copy of mLength to permit reverse scan
-// byte[3+mLength] start of next log entry
-
- static void appendInt(String8 *body, const void *data);
- static void appendFloat(String8 *body, const void *data);
- static void appendPID(String8 *body, const void *data, size_t length);
- static void appendTimestamp(String8 *body, const void *data);
- static size_t fmtEntryLength(const uint8_t *data);
- static String8 bufferDump(const uint8_t *buffer, size_t size);
- static String8 bufferDump(const EntryIterator &it);
-public:
-
-// Located in shared memory, must be POD.
-// Exactly one process must explicitly call the constructor or use placement new.
-// Since this is a POD, the destructor is empty and unnecessary to call it explicitly.
-struct Shared {
- Shared() /* mRear initialized via default constructor */ { }
- /*virtual*/ ~Shared() { }
-
- audio_utils_fifo_index mRear; // index one byte past the end of most recent Entry
- char mBuffer[0]; // circular buffer for entries
-};
-
-public:
-
-// ---------------------------------------------------------------------------
-
-// FIXME Timeline was intended to wrap Writer and Reader, but isn't actually used yet.
-// For now it is just a namespace for sharedSize().
-class Timeline : public RefBase {
-public:
-#if 0
- Timeline(size_t size, void *shared = NULL);
- virtual ~Timeline();
-#endif
-
- // Input parameter 'size' is the desired size of the timeline in byte units.
- // Returns the size rounded up to a power-of-2, plus the constant size overhead for indices.
- static size_t sharedSize(size_t size);
-
-#if 0
-private:
- friend class Writer;
- friend class Reader;
-
- const size_t mSize; // circular buffer size in bytes, must be a power of 2
- bool mOwn; // whether I own the memory at mShared
- Shared* const mShared; // pointer to shared memory
-#endif
-};
-
-// ---------------------------------------------------------------------------
-
-// Writer is thread-safe with respect to Reader, but not with respect to multiple threads
-// calling Writer methods. If you need multi-thread safety for writing, use LockedWriter.
-class Writer : public RefBase {
-public:
- Writer(); // dummy nop implementation without shared memory
-
- // Input parameter 'size' is the desired size of the timeline in byte units.
- // The size of the shared memory must be at least Timeline::sharedSize(size).
- Writer(void *shared, size_t size);
- Writer(const sp<IMemory>& iMemory, size_t size);
-
- virtual ~Writer();
-
- // FIXME needs comments, and some should be private
- virtual void log(const char *string);
- virtual void logf(const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
- virtual void logvf(const char *fmt, va_list ap);
- virtual void logTimestamp();
- virtual void logTimestamp(const int64_t ts);
- virtual void logInteger(const int x);
- virtual void logFloat(const float x);
- virtual void logPID();
- virtual void logFormat(const char *fmt, log_hash_t hash, ...);
- virtual void logVFormat(const char *fmt, log_hash_t hash, va_list ap);
- virtual void logStart(const char *fmt);
- virtual void logEnd();
- virtual void logHash(log_hash_t hash);
- virtual void logHistTS(log_hash_t hash);
- virtual void logHistFlush(log_hash_t hash);
-
- virtual bool isEnabled() const;
-
- // return value for all of these is the previous isEnabled()
- virtual bool setEnabled(bool enabled); // but won't enable if no shared memory
- bool enable() { return setEnabled(true); }
- bool disable() { return setEnabled(false); }
-
- sp<IMemory> getIMemory() const { return mIMemory; }
-
-private:
- // 0 <= length <= kMaxLength
- // writes a single Entry to the FIFO
- void log(Event event, const void *data, size_t length);
- // checks validity of an event before calling log above this one
- void log(const Entry *entry, bool trusted = false);
-
- Shared* const mShared; // raw pointer to shared memory
- sp<IMemory> mIMemory; // ref-counted version, initialized in constructor and then const
- audio_utils_fifo * const mFifo; // FIFO itself,
- // non-NULL unless constructor fails
- audio_utils_fifo_writer * const mFifoWriter; // used to write to FIFO,
- // non-NULL unless dummy constructor used
- bool mEnabled; // whether to actually log
-
- // cached pid and process name to use in %p format specifier
- // total tag length is mPidTagSize and process name is not zero terminated
- char *mPidTag;
- size_t mPidTagSize;
-};
-
-// ---------------------------------------------------------------------------
-
-// Similar to Writer, but safe for multiple threads to call concurrently
-class LockedWriter : public Writer {
-public:
- LockedWriter();
- LockedWriter(void *shared, size_t size);
-
- virtual void log(const char *string);
- virtual void logf(const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
- virtual void logvf(const char *fmt, va_list ap);
- virtual void logTimestamp();
- virtual void logTimestamp(const int64_t ts);
- virtual void logInteger(const int x);
- virtual void logFloat(const float x);
- virtual void logPID();
- virtual void logStart(const char *fmt);
- virtual void logEnd();
- virtual void logHash(log_hash_t hash);
-
- virtual bool isEnabled() const;
- virtual bool setEnabled(bool enabled);
-
-private:
- mutable Mutex mLock;
-};
-
-// ---------------------------------------------------------------------------
-
-class Reader : public RefBase {
-public:
-
- // A snapshot of a readers buffer
- class Snapshot {
- public:
- Snapshot() : mData(NULL), mLost(0) {}
-
- Snapshot(size_t bufferSize) : mData(new uint8_t[bufferSize]) {}
-
- ~Snapshot() { delete[] mData; }
-
- // copy of the buffer
- uint8_t *data() const { return mData; }
-
- // amount of data lost (given by audio_utils_fifo_reader)
- size_t lost() const { return mLost; }
-
- // iterator to beginning of readable segment of snapshot
- // data between begin and end has valid entries
- EntryIterator begin() { return mBegin; }
-
- // iterator to end of readable segment of snapshot
- EntryIterator end() { return mEnd; }
-
- private:
- friend class Reader;
- uint8_t *mData;
- size_t mLost;
- EntryIterator mBegin;
- EntryIterator mEnd;
- };
-
- // Input parameter 'size' is the desired size of the timeline in byte units.
- // The size of the shared memory must be at least Timeline::sharedSize(size).
- Reader(const void *shared, size_t size);
- Reader(const sp<IMemory>& iMemory, size_t size);
-
- virtual ~Reader();
-
- void alertIfGlitch(const std::vector<int64_t> &samples);
-
- // get snapshot of readers fifo buffer, effectively consuming the buffer
- std::unique_ptr<Snapshot> getSnapshot();
- // dump a particular snapshot of the reader
- void dump(int fd, size_t indent, Snapshot & snap);
- // dump the current content of the reader's buffer (call getSnapshot() and previous dump())
- void dump(int fd, size_t indent = 0);
- bool isIMemory(const sp<IMemory>& iMemory) const;
- // if findGlitch is true, log warning when buffer periods caused glitch
- void setFindGlitch(bool s);
- bool isFindGlitch() const;
-
-private:
- static const std::set<Event> startingTypes;
- static const std::set<Event> endingTypes;
- /*const*/ Shared* const mShared; // raw pointer to shared memory, actually const but not
- // declared as const because audio_utils_fifo() constructor
- sp<IMemory> mIMemory; // ref-counted version, assigned only in constructor
- int mFd; // file descriptor
- int mIndent; // indentation level
- audio_utils_fifo * const mFifo; // FIFO itself,
- // non-NULL unless constructor fails
- audio_utils_fifo_reader * const mFifoReader; // used to read from FIFO,
- // non-NULL unless constructor fails
-
- // each pair contains a sequence of timestamps (one histogram's worth)
- // pair's log_hash_t is the hash of the source code location where the timestamp was taken
- // pair's int points to the Reader that originated the entry
- std::map<std::pair<log_hash_t, int>, std::vector<int64_t>> mHists;
- // TODO: it might be clearer, instead of a direct map from source location to vector of
- // timestamps, if we instead first mapped from source location to an object that
- // represented that location. And one_of its fields would be a vector of timestamps.
- // That would allow us to record other information about the source location beyond timestamps.
- void dumpLine(const String8& timestamp, String8& body);
-
- EntryIterator handleFormat(const FormatEntry &fmtEntry,
- String8 *timestamp,
- String8 *body);
- // dummy method for handling absent author entry
- virtual void handleAuthor(const AbstractEntry& /*fmtEntry*/, String8* /*body*/) {}
-
- static void drawHistogram(String8 *body, const std::vector<int64_t> &samples,
- bool logScale, int indent = 0, int maxHeight = 10);
-
- // Searches for the last entry of type <type> in the range [front, back)
- // back has to be entry-aligned. Returns nullptr if none enconuntered.
- static const uint8_t *findLastEntryOfTypes(const uint8_t *front, const uint8_t *back,
- const std::set<Event> &types);
-
- static const size_t kSquashTimestamp = 5; // squash this many or more adjacent timestamps
-
- bool findGlitch; // alert if a local buffer period sequence caused an audio glitch
-};
-
-// Wrapper for a reader with a name. Contains a pointer to the reader and a pointer to the name
-class NamedReader {
-public:
- NamedReader() { mName[0] = '\0'; } // for Vector
- NamedReader(const sp<NBLog::Reader>& reader, const char *name) :
- mReader(reader)
- { strlcpy(mName, name, sizeof(mName)); }
- ~NamedReader() { }
- const sp<NBLog::Reader>& reader() const { return mReader; }
- const char* name() const { return mName; }
-
-private:
- sp<NBLog::Reader> mReader;
- static const size_t kMaxName = 32;
- char mName[kMaxName];
-};
-
-// ---------------------------------------------------------------------------
-
-class Merger : public RefBase {
-public:
- Merger(const void *shared, size_t size);
-
- virtual ~Merger() {}
-
- void addReader(const NamedReader &reader);
- // TODO add removeReader
- void merge();
- // FIXME This is returning a reference to a shared variable that needs a lock
- const std::vector<NamedReader>& getNamedReaders() const;
-private:
- // vector of the readers the merger is supposed to merge from.
- // every reader reads from a writer's buffer
- // FIXME Needs to be protected by a lock
- std::vector<NamedReader> mNamedReaders;
-
- // TODO Need comments on all of these
- Shared * const mShared;
- std::unique_ptr<audio_utils_fifo> mFifo;
- std::unique_ptr<audio_utils_fifo_writer> mFifoWriter;
-};
-
-class MergeReader : public Reader {
-public:
- MergeReader(const void *shared, size_t size, Merger &merger);
-private:
- // FIXME Needs to be protected by a lock,
- // because even though our use of it is read-only there may be asynchronous updates
- const std::vector<NamedReader>& mNamedReaders;
- // handle author entry by looking up the author's name and appending it to the body
- // returns number of bytes read from fmtEntry
- void handleAuthor(const AbstractEntry &fmtEntry, String8 *body);
-};
-
-// MergeThread is a thread that contains a Merger. It works as a retriggerable one-shot:
-// when triggered, it awakes for a lapse of time, during which it periodically merges; if
-// retriggered, the timeout is reset.
-// The thread is triggered on AudioFlinger binder activity.
-class MergeThread : public Thread {
-public:
- MergeThread(Merger &merger);
- virtual ~MergeThread() override;
-
- // Reset timeout and activate thread to merge periodically if it's idle
- void wakeup();
-
- // Set timeout period until the merging thread goes idle again
- void setTimeoutUs(int time);
-
-private:
- virtual bool threadLoop() override;
-
- // the merger who actually does the work of merging the logs
- Merger& mMerger;
-
- // mutex for the condition variable
- Mutex mMutex;
-
- // condition variable to activate merging on timeout >= 0
- Condition mCond;
-
- // time left until the thread blocks again (in microseconds)
- int mTimeoutUs;
-
- // merging period when the thread is awake
- static const int kThreadSleepPeriodUs = 1000000 /*1s*/;
-
- // initial timeout value when triggered
- static const int kThreadWakeupPeriodUs = 3000000 /*3s*/;
-};
-
-}; // class NBLog
-
-// TODO put somewhere else
-static inline int64_t get_monotonic_ns() {
- timespec ts;
- if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
- return (uint64_t) ts.tv_sec * 1000 * 1000 * 1000 + ts.tv_nsec;
- }
- return 0; // should not happen.
-}
-
-} // namespace android
-
-#endif // ANDROID_MEDIA_NBLOG_H
diff --git a/media/libnbaio/include/Pipe.h b/media/libnbaio/include/Pipe.h
deleted file mode 100644
index 58b9750..0000000
--- a/media/libnbaio/include/Pipe.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_AUDIO_PIPE_H
-#define ANDROID_AUDIO_PIPE_H
-
-#include <audio_utils/fifo.h>
-#include "NBAIO.h"
-
-namespace android {
-
-// Pipe is multi-thread safe for readers (see PipeReader), but safe for only a single writer thread.
-// It cannot UNDERRUN on write, unless we allow designation of a master reader that provides the
-// time-base. Readers can be added and removed dynamically, and it's OK to have no readers.
-class Pipe : public NBAIO_Sink {
-
- friend class PipeReader;
-
-public:
- // maxFrames will be rounded up to a power of 2, and all slots are available. Must be >= 2.
- // buffer is an optional parameter specifying the virtual address of the pipe buffer,
- // which must be of size roundup(maxFrames) * Format_frameSize(format) bytes.
- Pipe(size_t maxFrames, const NBAIO_Format& format, void *buffer = NULL);
-
- // If a buffer was specified in the constructor, it is not automatically freed by destructor.
- virtual ~Pipe();
-
- // NBAIO_Port interface
-
- //virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers,
- // NBAIO_Format counterOffers[], size_t& numCounterOffers);
- //virtual NBAIO_Format format() const;
-
- // NBAIO_Sink interface
-
- //virtual int64_t framesWritten() const;
- //virtual int64_t framesUnderrun() const;
- //virtual int64_t underruns() const;
-
- // The write side of a pipe permits overruns; flow control is the caller's responsibility.
- // It doesn't return +infinity because that would guarantee an overrun.
- virtual ssize_t availableToWrite() { return mMaxFrames; }
-
- virtual ssize_t write(const void *buffer, size_t count);
- //virtual ssize_t writeVia(writeVia_t via, size_t total, void *user, size_t block);
-
-private:
- const size_t mMaxFrames; // always a power of 2
- void * const mBuffer;
- audio_utils_fifo mFifo;
- audio_utils_fifo_writer mFifoWriter;
- volatile int32_t mReaders; // number of PipeReader clients currently attached to this Pipe
- const bool mFreeBufferInDestructor;
-};
-
-} // namespace android
-
-#endif // ANDROID_AUDIO_PIPE_H
diff --git a/media/libnbaio/include/SourceAudioBufferProvider.h b/media/libnbaio/include/SourceAudioBufferProvider.h
deleted file mode 100644
index ae49903..0000000
--- a/media/libnbaio/include/SourceAudioBufferProvider.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Implementation of AudioBufferProvider that wraps an NBAIO_Source
-
-#ifndef ANDROID_SOURCE_AUDIO_BUFFER_PROVIDER_H
-#define ANDROID_SOURCE_AUDIO_BUFFER_PROVIDER_H
-
-#include "NBAIO.h"
-#include <media/ExtendedAudioBufferProvider.h>
-
-namespace android {
-
-class SourceAudioBufferProvider : public ExtendedAudioBufferProvider {
-
-public:
- SourceAudioBufferProvider(const sp<NBAIO_Source>& source);
- virtual ~SourceAudioBufferProvider();
-
- // AudioBufferProvider interface
- virtual status_t getNextBuffer(Buffer *buffer);
- virtual void releaseBuffer(Buffer *buffer);
-
- // ExtendedAudioBufferProvider interface
- virtual size_t framesReady() const;
- virtual int64_t framesReleased() const;
- virtual void onTimestamp(const ExtendedTimestamp ×tamp);
-
-private:
- const sp<NBAIO_Source> mSource; // the wrapped source
- /*const*/ size_t mFrameSize; // frame size in bytes
- void* mAllocated; // pointer to base of allocated memory
- size_t mSize; // size of mAllocated in frames
- size_t mOffset; // frame offset within mAllocated of valid data
- size_t mRemaining; // frame count within mAllocated of valid data
- size_t mGetCount; // buffer.frameCount of the most recent getNextBuffer
- int64_t mFramesReleased; // counter of the total number of frames released
-};
-
-} // namespace android
-
-#endif // ANDROID_SOURCE_AUDIO_BUFFER_PROVIDER_H
diff --git a/media/libnbaio/include/media/nbaio/AudioBufferProviderSource.h b/media/libnbaio/include/media/nbaio/AudioBufferProviderSource.h
new file mode 100644
index 0000000..71182bb
--- /dev/null
+++ b/media/libnbaio/include/media/nbaio/AudioBufferProviderSource.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Implementation of NBAIO_Source that wraps an AudioBufferProvider
+
+#ifndef ANDROID_AUDIO_BUFFER_PROVIDER_SOURCE_H
+#define ANDROID_AUDIO_BUFFER_PROVIDER_SOURCE_H
+
+#include <media/AudioBufferProvider.h>
+#include <media/nbaio/NBAIO.h>
+
+namespace android {
+
+class AudioBufferProviderSource : public NBAIO_Source {
+
+public:
+ AudioBufferProviderSource(AudioBufferProvider *provider, const NBAIO_Format& format);
+ virtual ~AudioBufferProviderSource();
+
+ // NBAIO_Port interface
+
+ //virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers,
+ // NBAIO_Format counterOffers[], size_t& numCounterOffers);
+ //virtual NBAIO_Format format();
+
+ // NBAIO_Source interface
+
+ //virtual size_t framesRead() const;
+ //virtual size_t framesOverrun();
+ //virtual size_t overruns();
+ virtual ssize_t availableToRead();
+ virtual ssize_t read(void *buffer, size_t count);
+ virtual ssize_t readVia(readVia_t via, size_t total, void *user, size_t block);
+
+private:
+ AudioBufferProvider * const mProvider;
+ AudioBufferProvider::Buffer mBuffer; // current buffer
+ size_t mConsumed; // number of frames consumed so far from current buffer
+};
+
+} // namespace android
+
+#endif // ANDROID_AUDIO_BUFFER_PROVIDER_SOURCE_H
diff --git a/media/libnbaio/include/media/nbaio/AudioStreamInSource.h b/media/libnbaio/include/media/nbaio/AudioStreamInSource.h
new file mode 100644
index 0000000..8a3ffbe
--- /dev/null
+++ b/media/libnbaio/include/media/nbaio/AudioStreamInSource.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_AUDIO_STREAM_IN_SOURCE_H
+#define ANDROID_AUDIO_STREAM_IN_SOURCE_H
+
+#include <media/nbaio/NBAIO.h>
+
+namespace android {
+
+class StreamInHalInterface;
+
+// not multi-thread safe
+class AudioStreamInSource : public NBAIO_Source {
+
+public:
+ AudioStreamInSource(sp<StreamInHalInterface> stream);
+ virtual ~AudioStreamInSource();
+
+ // NBAIO_Port interface
+
+ virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers,
+ NBAIO_Format counterOffers[], size_t& numCounterOffers);
+ //virtual NBAIO_Format format() const;
+
+ // NBAIO_Sink interface
+
+ //virtual size_t framesRead() const;
+ virtual int64_t framesOverrun();
+ virtual int64_t overruns() { (void) framesOverrun(); return mOverruns; }
+
+ // This is an over-estimate, and could dupe the caller into making a blocking read()
+ // FIXME Use an audio HAL API to query the buffer filling status when it's available.
+ virtual ssize_t availableToRead() { return mStreamBufferSizeBytes / mFrameSize; }
+
+ virtual ssize_t read(void *buffer, size_t count);
+
+ // NBAIO_Sink end
+
+#if 0 // until necessary
+ sp<StreamInHalInterface> stream() const { return mStream; }
+#endif
+
+private:
+ sp<StreamInHalInterface> mStream;
+ size_t mStreamBufferSizeBytes; // as reported by get_buffer_size()
+ int64_t mFramesOverrun;
+ int64_t mOverruns;
+};
+
+} // namespace android
+
+#endif // ANDROID_AUDIO_STREAM_IN_SOURCE_H
diff --git a/media/libnbaio/include/media/nbaio/AudioStreamOutSink.h b/media/libnbaio/include/media/nbaio/AudioStreamOutSink.h
new file mode 100644
index 0000000..348b4f8
--- /dev/null
+++ b/media/libnbaio/include/media/nbaio/AudioStreamOutSink.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_AUDIO_STREAM_OUT_SINK_H
+#define ANDROID_AUDIO_STREAM_OUT_SINK_H
+
+#include <media/nbaio/NBAIO.h>
+
+namespace android {
+
+class StreamOutHalInterface;
+
+// not multi-thread safe
+class AudioStreamOutSink : public NBAIO_Sink {
+
+public:
+ AudioStreamOutSink(sp<StreamOutHalInterface> stream);
+ virtual ~AudioStreamOutSink();
+
+ // NBAIO_Port interface
+
+ virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers,
+ NBAIO_Format counterOffers[], size_t& numCounterOffers);
+ //virtual NBAIO_Format format();
+
+ // NBAIO_Sink interface
+
+ //virtual size_t framesWritten() const;
+ //virtual size_t framesUnderrun() const;
+ //virtual size_t underruns() const;
+
+ // This is an over-estimate, and could dupe the caller into making a blocking write()
+ // FIXME Use an audio HAL API to query the buffer emptying status when it's available.
+ virtual ssize_t availableToWrite() { return mStreamBufferSizeBytes / mFrameSize; }
+
+ virtual ssize_t write(const void *buffer, size_t count);
+
+ virtual status_t getTimestamp(ExtendedTimestamp ×tamp);
+
+ // NBAIO_Sink end
+
+#if 0 // until necessary
+ sp<StreamOutHalInterface> stream() const { return mStream; }
+#endif
+
+private:
+ sp<StreamOutHalInterface> mStream;
+ size_t mStreamBufferSizeBytes; // as reported by get_buffer_size()
+};
+
+} // namespace android
+
+#endif // ANDROID_AUDIO_STREAM_OUT_SINK_H
diff --git a/media/libnbaio/include/media/nbaio/LibsndfileSink.h b/media/libnbaio/include/media/nbaio/LibsndfileSink.h
new file mode 100644
index 0000000..535e3f5
--- /dev/null
+++ b/media/libnbaio/include/media/nbaio/LibsndfileSink.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_AUDIO_LIBSNDFILE_SINK_H
+#define ANDROID_AUDIO_LIBSNDFILE_SINK_H
+
+#include <media/nbaio/NBAIO.h>
+
+#include "sndfile.h"
+
+// Implementation of NBAIO_Sink that wraps a libsndfile opened in SFM_WRITE mode
+
+namespace android {
+
+class LibsndfileSink : public NBAIO_Sink {
+
+public:
+ LibsndfileSink(SNDFILE *sndfile, const SF_INFO &sfinfo);
+ virtual ~LibsndfileSink();
+
+ // NBAIO_Port interface
+
+ //virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers,
+ // NBAIO_Format counterOffers[], size_t& numCounterOffers);
+ //virtual NBAIO_Format format() const;
+
+ // NBAIO_Sink interface
+
+ //virtual size_t framesWritten() const;
+ //virtual size_t framesUnderrun() const;
+ //virtual size_t underruns() const;
+ //virtual ssize_t availableToWrite();
+ virtual ssize_t write(const void *buffer, size_t count);
+ //virtual ssize_t writeVia(writeVia_t via, size_t total, void *user, size_t block);
+
+private:
+ SNDFILE * mSndfile;
+};
+
+} // namespace android
+
+#endif // ANDROID_AUDIO_LIBSNDFILE_SINK_H
diff --git a/media/libnbaio/include/media/nbaio/LibsndfileSource.h b/media/libnbaio/include/media/nbaio/LibsndfileSource.h
new file mode 100644
index 0000000..bc6aa9d
--- /dev/null
+++ b/media/libnbaio/include/media/nbaio/LibsndfileSource.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_AUDIO_LIBSNDFILE_SOURCE_H
+#define ANDROID_AUDIO_LIBSNDFILE_SOURCE_H
+
+#include <media/nbaio/NBAIO.h>
+
+#include "sndfile.h"
+
+// Implementation of NBAIO_Source that wraps a libsndfile opened in SFM_READ mode
+
+namespace android {
+
+class LibsndfileSource : public NBAIO_Source {
+
+public:
+ // If 'loop' is true and it permits seeking, then we'll act as an infinite source
+ LibsndfileSource(SNDFILE *sndfile, const SF_INFO &sfinfo, bool loop = false);
+ virtual ~LibsndfileSource();
+
+ // NBAIO_Port interface
+
+ //virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers,
+ // NBAIO_Format counterOffers[], size_t& numCounterOffers);
+ //virtual NBAIO_Format format() const;
+
+ // NBAIO_Source interface
+
+ //virtual size_t framesRead() const;
+ //virtual size_t framesOverrun();
+ //virtual size_t overruns();
+ virtual ssize_t availableToRead();
+ virtual ssize_t read(void *buffer, size_t count);
+ //virtual ssize_t readVia(readVia_t via, size_t total, void *user, size_t block);
+
+private:
+ SNDFILE * mSndfile;
+ sf_count_t mEstimatedFramesUntilEOF;
+ bool mLooping;
+ bool mReadAnyFramesThisLoopCycle;
+};
+
+} // namespace android
+
+#endif // ANDROID_AUDIO_LIBSNDFILE_SOURCE_H
diff --git a/media/libnbaio/include/media/nbaio/NBLog.h b/media/libnbaio/include/media/nbaio/NBLog.h
new file mode 100644
index 0000000..3e48ee1
--- /dev/null
+++ b/media/libnbaio/include/media/nbaio/NBLog.h
@@ -0,0 +1,595 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Non-blocking event logger intended for safe communication between processes via shared memory
+
+#ifndef ANDROID_MEDIA_NBLOG_H
+#define ANDROID_MEDIA_NBLOG_H
+
+#include <binder/IMemory.h>
+#include <audio_utils/fifo.h>
+#include <utils/Mutex.h>
+#include <utils/threads.h>
+
+#include <map>
+#include <deque>
+#include <set>
+#include <vector>
+
+namespace android {
+
+class String8;
+
+class NBLog {
+
+public:
+
+typedef uint64_t log_hash_t;
+
+// FIXME Everything needed for client (writer API and registration) should be isolated
+// from the rest of the implementation.
+class Writer;
+class Reader;
+
+enum Event : uint8_t {
+ EVENT_RESERVED,
+ EVENT_STRING, // ASCII string, not NUL-terminated
+ // TODO: make timestamp optional
+ EVENT_TIMESTAMP, // clock_gettime(CLOCK_MONOTONIC)
+ EVENT_INTEGER, // integer value entry
+ EVENT_FLOAT, // floating point value entry
+ EVENT_PID, // process ID and process name
+ EVENT_AUTHOR, // author index (present in merged logs) tracks entry's original log
+ EVENT_START_FMT, // logFormat start event: entry includes format string, following
+ // entries contain format arguments
+ EVENT_HASH, // unique HASH of log origin, originates from hash of file name
+ // and line number
+ EVENT_HISTOGRAM_ENTRY_TS, // single datum for timestamp histogram
+ EVENT_AUDIO_STATE, // audio on/off event: logged upon FastMixer::onStateChange() call
+ EVENT_END_FMT, // end of logFormat argument list
+
+ EVENT_UPPER_BOUND, // to check for invalid events
+};
+
+private:
+
+// ---------------------------------------------------------------------------
+// API for handling format entry operations
+
+// a formatted entry has the following structure:
+// * START_FMT entry, containing the format string
+// * TIMESTAMP entry
+// * HASH entry
+// * author entry of the thread that generated it (optional, present in merged log)
+// * format arg1
+// * format arg2
+// * ...
+// * END_FMT entry
+
+// entry representation in memory
+struct entry {
+ const uint8_t type;
+ const uint8_t length;
+ const uint8_t data[0];
+};
+
+// entry tail representation (after data)
+struct ending {
+ uint8_t length;
+ uint8_t next[0];
+};
+
+// entry iterator
+class EntryIterator {
+public:
+ EntryIterator();
+ explicit EntryIterator(const uint8_t *entry);
+ EntryIterator(const EntryIterator &other);
+
+ // dereference underlying entry
+ const entry& operator*() const;
+ const entry* operator->() const;
+ // advance to next entry
+ EntryIterator& operator++(); // ++i
+ // back to previous entry
+ EntryIterator& operator--(); // --i
+ EntryIterator next() const;
+ EntryIterator prev() const;
+ bool operator!=(const EntryIterator &other) const;
+ int operator-(const EntryIterator &other) const;
+
+ bool hasConsistentLength() const;
+ void copyTo(std::unique_ptr<audio_utils_fifo_writer> &dst) const;
+ void copyData(uint8_t *dst) const;
+
+ template<typename T>
+ inline const T& payload() {
+ return *reinterpret_cast<const T *>(ptr + offsetof(entry, data));
+ }
+
+ inline operator const uint8_t*() const {
+ return ptr;
+ }
+
+private:
+ const uint8_t *ptr;
+};
+
+class AbstractEntry {
+public:
+
+ // Entry starting in the given pointer
+ explicit AbstractEntry(const uint8_t *entry);
+ virtual ~AbstractEntry() {}
+
+ // build concrete entry of appropriate class from pointer
+ static std::unique_ptr<AbstractEntry> buildEntry(const uint8_t *ptr);
+
+ // get format entry timestamp
+ // TODO consider changing to uint64_t
+ virtual int64_t timestamp() const = 0;
+
+ // get format entry's unique id
+ virtual log_hash_t hash() const = 0;
+
+ // entry's author index (-1 if none present)
+ // a Merger has a vector of Readers, author simply points to the index of the
+ // Reader that originated the entry
+ // TODO consider changing to uint32_t
+ virtual int author() const = 0;
+
+ // copy entry, adding author before timestamp, returns iterator to end of entry
+ virtual EntryIterator copyWithAuthor(std::unique_ptr<audio_utils_fifo_writer> &dst,
+ int author) const = 0;
+
+protected:
+ // copies ordinary entry from src to dst, and returns length of entry
+ // size_t copyEntry(audio_utils_fifo_writer *dst, const iterator &it);
+ const uint8_t *mEntry;
+};
+
+class FormatEntry : public AbstractEntry {
+public:
+ // explicit FormatEntry(const EntryIterator &it);
+ explicit FormatEntry(const uint8_t *ptr) : AbstractEntry(ptr) {}
+ virtual ~FormatEntry() {}
+
+ EntryIterator begin() const;
+
+ // Entry's format string
+ const char* formatString() const;
+
+ // Enrty's format string length
+ size_t formatStringLength() const;
+
+ // Format arguments (excluding format string, timestamp and author)
+ EntryIterator args() const;
+
+ // get format entry timestamp
+ virtual int64_t timestamp() const override;
+
+ // get format entry's unique id
+ virtual log_hash_t hash() const override;
+
+ // entry's author index (-1 if none present)
+ // a Merger has a vector of Readers, author simply points to the index of the
+ // Reader that originated the entry
+ virtual int author() const override;
+
+ // copy entry, adding author before timestamp, returns size of original entry
+ virtual EntryIterator copyWithAuthor(std::unique_ptr<audio_utils_fifo_writer> &dst,
+ int author) const override;
+
+};
+
+class HistogramEntry : public AbstractEntry {
+public:
+ explicit HistogramEntry(const uint8_t *ptr) : AbstractEntry(ptr) {
+ }
+ virtual ~HistogramEntry() {}
+
+ virtual int64_t timestamp() const override;
+
+ virtual log_hash_t hash() const override;
+
+ virtual int author() const override;
+
+ virtual EntryIterator copyWithAuthor(std::unique_ptr<audio_utils_fifo_writer> &dst,
+ int author) const override;
+
+};
+
+// ---------------------------------------------------------------------------
+
+// representation of a single log entry in private memory
+struct Entry {
+ Entry(Event event, const void *data, size_t length)
+ : mEvent(event), mLength(length), mData(data) { }
+ /*virtual*/ ~Entry() { }
+
+ // used during writing to format Entry information as follows: [type][length][data ... ][length]
+ int copyEntryDataAt(size_t offset) const;
+
+private:
+ friend class Writer;
+ Event mEvent; // event type
+ uint8_t mLength; // length of additional data, 0 <= mLength <= kMaxLength
+ const void *mData; // event type-specific data
+ static const size_t kMaxLength = 255;
+public:
+ // mEvent, mLength, mData[...], duplicate mLength
+ static const size_t kOverhead = sizeof(entry) + sizeof(ending);
+ // endind length of previous entry
+ static const size_t kPreviousLengthOffset = - sizeof(ending) +
+ offsetof(ending, length);
+};
+
+struct HistTsEntry {
+ log_hash_t hash;
+ int64_t ts;
+}; //TODO __attribute__((packed));
+
+struct HistTsEntryWithAuthor {
+ log_hash_t hash;
+ int64_t ts;
+ int author;
+}; //TODO __attribute__((packed));
+
+using StateTsEntryWithAuthor = HistTsEntryWithAuthor;
+
+struct HistIntEntry {
+ log_hash_t hash;
+ int value;
+}; //TODO __attribute__((packed));
+
+// representation of a single log entry in shared memory
+// byte[0] mEvent
+// byte[1] mLength
+// byte[2] mData[0]
+// ...
+// byte[2+i] mData[i]
+// ...
+// byte[2+mLength-1] mData[mLength-1]
+// byte[2+mLength] duplicate copy of mLength to permit reverse scan
+// byte[3+mLength] start of next log entry
+
+ static void appendInt(String8 *body, const void *data);
+ static void appendFloat(String8 *body, const void *data);
+ static void appendPID(String8 *body, const void *data, size_t length);
+ static void appendTimestamp(String8 *body, const void *data);
+ static size_t fmtEntryLength(const uint8_t *data);
+ static String8 bufferDump(const uint8_t *buffer, size_t size);
+ static String8 bufferDump(const EntryIterator &it);
+public:
+
+// Located in shared memory, must be POD.
+// Exactly one process must explicitly call the constructor or use placement new.
+// Since this is a POD, the destructor is empty and unnecessary to call it explicitly.
+struct Shared {
+ Shared() /* mRear initialized via default constructor */ { }
+ /*virtual*/ ~Shared() { }
+
+ audio_utils_fifo_index mRear; // index one byte past the end of most recent Entry
+ char mBuffer[0]; // circular buffer for entries
+};
+
+public:
+
+// ---------------------------------------------------------------------------
+
+// FIXME Timeline was intended to wrap Writer and Reader, but isn't actually used yet.
+// For now it is just a namespace for sharedSize().
+class Timeline : public RefBase {
+public:
+#if 0
+ Timeline(size_t size, void *shared = NULL);
+ virtual ~Timeline();
+#endif
+
+ // Input parameter 'size' is the desired size of the timeline in byte units.
+ // Returns the size rounded up to a power-of-2, plus the constant size overhead for indices.
+ static size_t sharedSize(size_t size);
+
+#if 0
+private:
+ friend class Writer;
+ friend class Reader;
+
+ const size_t mSize; // circular buffer size in bytes, must be a power of 2
+ bool mOwn; // whether I own the memory at mShared
+ Shared* const mShared; // pointer to shared memory
+#endif
+};
+
+// ---------------------------------------------------------------------------
+
+// Writer is thread-safe with respect to Reader, but not with respect to multiple threads
+// calling Writer methods. If you need multi-thread safety for writing, use LockedWriter.
+class Writer : public RefBase {
+public:
+ Writer(); // dummy nop implementation without shared memory
+
+ // Input parameter 'size' is the desired size of the timeline in byte units.
+ // The size of the shared memory must be at least Timeline::sharedSize(size).
+ Writer(void *shared, size_t size);
+ Writer(const sp<IMemory>& iMemory, size_t size);
+
+ virtual ~Writer();
+
+ // FIXME needs comments, and some should be private
+ virtual void log(const char *string);
+ virtual void logf(const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
+ virtual void logvf(const char *fmt, va_list ap);
+ virtual void logTimestamp();
+ virtual void logTimestamp(const int64_t ts);
+ virtual void logInteger(const int x);
+ virtual void logFloat(const float x);
+ virtual void logPID();
+ virtual void logFormat(const char *fmt, log_hash_t hash, ...);
+ virtual void logVFormat(const char *fmt, log_hash_t hash, va_list ap);
+ virtual void logStart(const char *fmt);
+ virtual void logEnd();
+ virtual void logHash(log_hash_t hash);
+ virtual void logEventHistTs(Event event, log_hash_t hash);
+
+ virtual bool isEnabled() const;
+
+ // return value for all of these is the previous isEnabled()
+ virtual bool setEnabled(bool enabled); // but won't enable if no shared memory
+ bool enable() { return setEnabled(true); }
+ bool disable() { return setEnabled(false); }
+
+ sp<IMemory> getIMemory() const { return mIMemory; }
+
+private:
+ // 0 <= length <= kMaxLength
+ // writes a single Entry to the FIFO
+ void log(Event event, const void *data, size_t length);
+ // checks validity of an event before calling log above this one
+ void log(const Entry *entry, bool trusted = false);
+
+ Shared* const mShared; // raw pointer to shared memory
+ sp<IMemory> mIMemory; // ref-counted version, initialized in constructor and then const
+ audio_utils_fifo * const mFifo; // FIFO itself,
+ // non-NULL unless constructor fails
+ audio_utils_fifo_writer * const mFifoWriter; // used to write to FIFO,
+ // non-NULL unless dummy constructor used
+ bool mEnabled; // whether to actually log
+
+ // cached pid and process name to use in %p format specifier
+ // total tag length is mPidTagSize and process name is not zero terminated
+ char *mPidTag;
+ size_t mPidTagSize;
+};
+
+// ---------------------------------------------------------------------------
+
+// Similar to Writer, but safe for multiple threads to call concurrently
+class LockedWriter : public Writer {
+public:
+ LockedWriter();
+ LockedWriter(void *shared, size_t size);
+
+ virtual void log(const char *string);
+ virtual void logf(const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
+ virtual void logvf(const char *fmt, va_list ap);
+ virtual void logTimestamp();
+ virtual void logTimestamp(const int64_t ts);
+ virtual void logInteger(const int x);
+ virtual void logFloat(const float x);
+ virtual void logPID();
+ virtual void logStart(const char *fmt);
+ virtual void logEnd();
+ virtual void logHash(log_hash_t hash);
+
+ virtual bool isEnabled() const;
+ virtual bool setEnabled(bool enabled);
+
+private:
+ mutable Mutex mLock;
+};
+
+// ---------------------------------------------------------------------------
+
+class Reader : public RefBase {
+public:
+
+ // A snapshot of a readers buffer
+ // This is raw data. No analysis has been done on it
+ class Snapshot {
+ public:
+ Snapshot() : mData(NULL), mLost(0) {}
+
+ Snapshot(size_t bufferSize) : mData(new uint8_t[bufferSize]) {}
+
+ ~Snapshot() { delete[] mData; }
+
+ // copy of the buffer
+ uint8_t *data() const { return mData; }
+
+ // amount of data lost (given by audio_utils_fifo_reader)
+ size_t lost() const { return mLost; }
+
+ // iterator to beginning of readable segment of snapshot
+ // data between begin and end has valid entries
+ EntryIterator begin() { return mBegin; }
+
+ // iterator to end of readable segment of snapshot
+ EntryIterator end() { return mEnd; }
+
+ private:
+ friend class Reader;
+ uint8_t *mData;
+ size_t mLost;
+ EntryIterator mBegin;
+ EntryIterator mEnd;
+ };
+
+ // Input parameter 'size' is the desired size of the timeline in byte units.
+ // The size of the shared memory must be at least Timeline::sharedSize(size).
+ Reader(const void *shared, size_t size);
+ Reader(const sp<IMemory>& iMemory, size_t size);
+
+ virtual ~Reader();
+
+ // get snapshot of readers fifo buffer, effectively consuming the buffer
+ std::unique_ptr<Snapshot> getSnapshot();
+ // dump a particular snapshot of the reader
+ // TODO: move dump to PerformanceAnalysis. Model/view/controller design
+ void dump(int fd, size_t indent, Snapshot & snap);
+ // dump the current content of the reader's buffer (call getSnapshot() and previous dump())
+ void dump(int fd, size_t indent = 0);
+ bool isIMemory(const sp<IMemory>& iMemory) const;
+
+private:
+
+ static const std::set<Event> startingTypes;
+ static const std::set<Event> endingTypes;
+ /*const*/ Shared* const mShared; // raw pointer to shared memory, actually const but not
+ // declared as const because audio_utils_fifo() constructor
+ sp<IMemory> mIMemory; // ref-counted version, assigned only in constructor
+ int mFd; // file descriptor
+ int mIndent; // indentation level
+ audio_utils_fifo * const mFifo; // FIFO itself,
+ // non-NULL unless constructor fails
+ audio_utils_fifo_reader * const mFifoReader; // used to read from FIFO,
+ // non-NULL unless constructor fails
+
+ // TODO: it might be clearer, instead of a direct map from source location to vector of
+ // timestamps, if we instead first mapped from source location to an object that
+ // represented that location. And one_of its fields would be a vector of timestamps.
+ // That would allow us to record other information about the source location beyond timestamps.
+ void dumpLine(const String8& timestamp, String8& body);
+
+ EntryIterator handleFormat(const FormatEntry &fmtEntry,
+ String8 *timestamp,
+ String8 *body);
+ // dummy method for handling absent author entry
+ virtual void handleAuthor(const AbstractEntry& /*fmtEntry*/, String8* /*body*/) {}
+
+ // Searches for the last entry of type <type> in the range [front, back)
+ // back has to be entry-aligned. Returns nullptr if none enconuntered.
+ static const uint8_t *findLastEntryOfTypes(const uint8_t *front, const uint8_t *back,
+ const std::set<Event> &types);
+
+ static const size_t kSquashTimestamp = 5; // squash this many or more adjacent timestamps
+};
+
+// Wrapper for a reader with a name. Contains a pointer to the reader and a pointer to the name
+class NamedReader {
+public:
+ NamedReader() { mName[0] = '\0'; } // for Vector
+ NamedReader(const sp<NBLog::Reader>& reader, const char *name) :
+ mReader(reader)
+ { strlcpy(mName, name, sizeof(mName)); }
+ ~NamedReader() { }
+ const sp<NBLog::Reader>& reader() const { return mReader; }
+ const char* name() const { return mName; }
+
+private:
+ sp<NBLog::Reader> mReader;
+ static const size_t kMaxName = 32;
+ char mName[kMaxName];
+};
+
+// ---------------------------------------------------------------------------
+
+class Merger : public RefBase {
+public:
+ Merger(const void *shared, size_t size);
+
+ virtual ~Merger() {}
+
+ void addReader(const NamedReader &reader);
+ // TODO add removeReader
+ void merge();
+ // FIXME This is returning a reference to a shared variable that needs a lock
+ const std::vector<NamedReader>& getNamedReaders() const;
+private:
+ // vector of the readers the merger is supposed to merge from.
+ // every reader reads from a writer's buffer
+ // FIXME Needs to be protected by a lock
+ std::vector<NamedReader> mNamedReaders;
+
+ // TODO Need comments on all of these
+ Shared * const mShared;
+ std::unique_ptr<audio_utils_fifo> mFifo;
+ std::unique_ptr<audio_utils_fifo_writer> mFifoWriter;
+};
+
+class MergeReader : public Reader {
+public:
+ MergeReader(const void *shared, size_t size, Merger &merger);
+private:
+ // FIXME Needs to be protected by a lock,
+ // because even though our use of it is read-only there may be asynchronous updates
+ const std::vector<NamedReader>& mNamedReaders;
+ // handle author entry by looking up the author's name and appending it to the body
+ // returns number of bytes read from fmtEntry
+ void handleAuthor(const AbstractEntry &fmtEntry, String8 *body);
+};
+
+// MergeThread is a thread that contains a Merger. It works as a retriggerable one-shot:
+// when triggered, it awakes for a lapse of time, during which it periodically merges; if
+// retriggered, the timeout is reset.
+// The thread is triggered on AudioFlinger binder activity.
+class MergeThread : public Thread {
+public:
+ MergeThread(Merger &merger);
+ virtual ~MergeThread() override;
+
+ // Reset timeout and activate thread to merge periodically if it's idle
+ void wakeup();
+
+ // Set timeout period until the merging thread goes idle again
+ void setTimeoutUs(int time);
+
+private:
+ virtual bool threadLoop() override;
+
+ // the merger who actually does the work of merging the logs
+ Merger& mMerger;
+
+ // mutex for the condition variable
+ Mutex mMutex;
+
+ // condition variable to activate merging on timeout >= 0
+ Condition mCond;
+
+ // time left until the thread blocks again (in microseconds)
+ int mTimeoutUs;
+
+ // merging period when the thread is awake
+ static const int kThreadSleepPeriodUs = 1000000 /*1s*/;
+
+ // initial timeout value when triggered
+ static const int kThreadWakeupPeriodUs = 3000000 /*3s*/;
+};
+
+}; // class NBLog
+
+// TODO put somewhere else
+static inline int64_t get_monotonic_ns() {
+ timespec ts;
+ if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
+ return (uint64_t) ts.tv_sec * 1000 * 1000 * 1000 + ts.tv_nsec;
+ }
+ return 0; // should not happen.
+}
+
+} // namespace android
+
+#endif // ANDROID_MEDIA_NBLOG_H
diff --git a/media/libnbaio/include/media/nbaio/PerformanceAnalysis.h b/media/libnbaio/include/media/nbaio/PerformanceAnalysis.h
new file mode 100644
index 0000000..b0dc148
--- /dev/null
+++ b/media/libnbaio/include/media/nbaio/PerformanceAnalysis.h
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Non-blocking event logger intended for safe communication between processes via shared memory
+
+#ifndef ANDROID_MEDIA_PERFORMANCEANALYSIS_H
+#define ANDROID_MEDIA_PERFORMANCEANALYSIS_H
+
+#include <map>
+#include <deque>
+#include <vector>
+#include "NBLog.h"
+#include "ReportPerformance.h"
+
+namespace android {
+
+namespace ReportPerformance {
+
+class PerformanceAnalysis {
+ // This class stores and analyzes audio processing wakeup timestamps from NBLog
+ // FIXME: currently, all performance data is stored in deques. Need to add a mutex.
+ // FIXME: continue this way until analysis is done in a separate thread. Then, use
+ // the fifo writer utilities.
+public:
+
+ PerformanceAnalysis();
+
+ // Given a series of audio processing wakeup timestamps,
+ // compresses and and analyzes the data, and flushes
+ // the timestamp series from memory.
+ void processAndFlushTimeStampSeries();
+
+ // Called when an audio on/off event is read from the buffer,
+ // e.g. EVENT_AUDIO_STATE.
+ // calls flushTimeStampSeries on the data up to the event,
+ // effectively discarding the idle audio time interval
+ void handleStateChange();
+
+ // When the short-term histogram array mRecentHists has reached capacity,
+ // merges histograms for data compression and stores them in mLongTermHists
+ void processAndFlushRecentHists();
+
+ // Writes wakeup timestamp entry to log and runs analysis
+ // TODO: make this thread safe. Each thread should have its own instance
+ // of PerformanceAnalysis.
+ void logTsEntry(timestamp_raw ts);
+
+ // FIXME: make peakdetector and storeOutlierData a single function
+ // Input: mOutlierData. Looks at time elapsed between outliers
+ // finds significant changes in the distribution
+ // writes timestamps of significant changes to mPeakTimestamps
+ void detectPeaks();
+
+ // runs analysis on timestamp series before it is converted to a histogram
+ // finds outliers
+ // writes to mOutlierData <time elapsed since previous outlier, outlier timestamp>
+ void storeOutlierData(const std::vector<timestamp_raw> ×tamps);
+
+ // input: series of short histograms. Generates a string of analysis of the buffer periods
+ // TODO: WIP write more detailed analysis
+ // FIXME: move this data visualization to a separate class. Model/view/controller
+ void reportPerformance(String8 *body, int maxHeight = 10);
+
+ // TODO: delete this. temp for testing
+ void testFunction();
+
+ // This function used to detect glitches in a time series
+ // TODO incorporate this into the analysis (currently unused)
+ void alertIfGlitch(const std::vector<timestamp_raw> &samples);
+
+private:
+
+ // stores outlier analysis: <elapsed time between outliers in ms, outlier timestamp>
+ std::deque<std::pair<outlierInterval, timestamp>> mOutlierData;
+
+ // stores each timestamp at which a peak was detected
+ // a peak is a moment at which the average outlier interval changed significantly
+ std::deque<timestamp> mPeakTimestamps;
+
+ // TODO: turn these into circular buffers for better data flow
+ // FIFO of small histograms
+ // stores fixed-size short buffer period histograms with timestamp of first sample
+ std::deque<std::pair<timestamp, Histogram>> mRecentHists;
+
+ // FIFO of small histograms
+ // stores fixed-size long-term buffer period histograms with timestamp of first sample
+ std::deque<std::pair<timestamp, Histogram>> mLongTermHists;
+
+ // vector of timestamps, collected from NBLog for a (TODO) specific thread
+ // when a vector reaches its maximum size, the data is processed and flushed
+ std::vector<timestamp_raw> mTimeStampSeries;
+
+ static const int kMsPerSec = 1000;
+
+ // Parameters used when detecting outliers
+ // TODO: learn some of these from the data, delete unused ones
+ // FIXME: decide whether to make kPeriodMs static.
+ static const int kNumBuff = 3; // number of buffers considered in local history
+ int kPeriodMs; // current period length is ideally 4 ms
+ static const int kOutlierMs = 7; // values greater or equal to this cause glitches
+ // DAC processing time for 4 ms buffer
+ static constexpr double kRatio = 0.75; // estimate of CPU time as ratio of period length
+ int kPeriodMsCPU; // compute based on kPeriodLen and kRatio
+
+ // Peak detection: number of standard deviations from mean considered a significant change
+ static const int kStddevThreshold = 5;
+
+ // capacity allocated to data structures
+ // TODO: adjust all of these values
+ static const int kRecentHistsCapacity = 100; // number of short-term histograms stored in memory
+ static const int kShortHistSize = 50; // number of samples in a short-term histogram
+ static const int kOutlierSeriesSize = 100; // number of values stored in outlier array
+ static const int kPeakSeriesSize = 100; // number of values stored in peak array
+ static const int kLongTermHistsCapacity = 20; // number of long-term histogram stored in memory
+ // maximum elapsed time between first and last timestamp of a long-term histogram
+ static const int kMaxHistTimespanMs = 5 * kMsPerSec;
+
+ // these variables are stored in-class to ensure continuity while analyzing the timestamp
+ // series one short sequence at a time: the variables are not re-initialized every time.
+ // FIXME: create inner class for these variables and decide which other ones to add to it
+ double mPeakDetectorMean = -1;
+ double mPeakDetectorSd = -1;
+ // variables for storeOutlierData
+ uint64_t mElapsed = 0;
+ int64_t mPrevNs = -1;
+
+};
+
+} // namespace ReportPerformance
+
+} // namespace android
+
+#endif // ANDROID_MEDIA_PERFORMANCEANALYSIS_H
diff --git a/media/libnbaio/include/media/nbaio/Pipe.h b/media/libnbaio/include/media/nbaio/Pipe.h
new file mode 100644
index 0000000..0431976
--- /dev/null
+++ b/media/libnbaio/include/media/nbaio/Pipe.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_AUDIO_PIPE_H
+#define ANDROID_AUDIO_PIPE_H
+
+#include <audio_utils/fifo.h>
+#include <media/nbaio/NBAIO.h>
+
+namespace android {
+
+// Pipe is multi-thread safe for readers (see PipeReader), but safe for only a single writer thread.
+// It cannot UNDERRUN on write, unless we allow designation of a master reader that provides the
+// time-base. Readers can be added and removed dynamically, and it's OK to have no readers.
+class Pipe : public NBAIO_Sink {
+
+ friend class PipeReader;
+
+public:
+ // maxFrames will be rounded up to a power of 2, and all slots are available. Must be >= 2.
+ // buffer is an optional parameter specifying the virtual address of the pipe buffer,
+ // which must be of size roundup(maxFrames) * Format_frameSize(format) bytes.
+ Pipe(size_t maxFrames, const NBAIO_Format& format, void *buffer = NULL);
+
+ // If a buffer was specified in the constructor, it is not automatically freed by destructor.
+ virtual ~Pipe();
+
+ // NBAIO_Port interface
+
+ //virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers,
+ // NBAIO_Format counterOffers[], size_t& numCounterOffers);
+ //virtual NBAIO_Format format() const;
+
+ // NBAIO_Sink interface
+
+ //virtual int64_t framesWritten() const;
+ //virtual int64_t framesUnderrun() const;
+ //virtual int64_t underruns() const;
+
+ // The write side of a pipe permits overruns; flow control is the caller's responsibility.
+ // It doesn't return +infinity because that would guarantee an overrun.
+ virtual ssize_t availableToWrite() { return mMaxFrames; }
+
+ virtual ssize_t write(const void *buffer, size_t count);
+ //virtual ssize_t writeVia(writeVia_t via, size_t total, void *user, size_t block);
+
+private:
+ const size_t mMaxFrames; // always a power of 2
+ void * const mBuffer;
+ audio_utils_fifo mFifo;
+ audio_utils_fifo_writer mFifoWriter;
+ volatile int32_t mReaders; // number of PipeReader clients currently attached to this Pipe
+ const bool mFreeBufferInDestructor;
+};
+
+} // namespace android
+
+#endif // ANDROID_AUDIO_PIPE_H
diff --git a/media/libnbaio/include/PipeReader.h b/media/libnbaio/include/media/nbaio/PipeReader.h
similarity index 100%
rename from media/libnbaio/include/PipeReader.h
rename to media/libnbaio/include/media/nbaio/PipeReader.h
diff --git a/media/libnbaio/include/media/nbaio/ReportPerformance.h b/media/libnbaio/include/media/nbaio/ReportPerformance.h
new file mode 100644
index 0000000..27d2810
--- /dev/null
+++ b/media/libnbaio/include/media/nbaio/ReportPerformance.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_MEDIA_REPORTPERFORMANCE_H
+#define ANDROID_MEDIA_REPORTPERFORMANCE_H
+
+#include <deque>
+#include <map>
+#include <vector>
+
+namespace android {
+
+// This class is used by reportPerformance function
+// TODO move reportPerformance function to ReportPerformance.cpp
+class String8;
+
+namespace ReportPerformance {
+
+// stores a histogram: key: observed buffer period. value: count
+// TODO: unsigned, unsigned
+using Histogram = std::map<int, int>;
+
+using outlierInterval = uint64_t;
+// int64_t timestamps are converted to uint64_t in PerformanceAnalysis::storeOutlierData,
+// and all analysis functions use uint64_t.
+using timestamp = uint64_t;
+using timestamp_raw = int64_t;
+
+// FIXME: decide whether to use 64 or 32 bits
+// TODO: the code has a mix of typedef and using. Standardize to one or the other.
+typedef uint64_t log_hash_t;
+
+static inline int deltaMs(int64_t ns1, int64_t ns2) {
+ return (ns2 - ns1) / (1000 * 1000);
+}
+
+static inline uint32_t log2(uint32_t x) {
+ // This works for x > 0
+ return 31 - __builtin_clz(x);
+}
+
+// Writes outlier intervals, timestamps, and histograms spanning long time
+// intervals to a file.
+void writeToFile(std::deque<std::pair<outlierInterval, timestamp>> &outlierData,
+ std::deque<std::pair<timestamp, Histogram>> &hists,
+ const char * kName,
+ bool append);
+
+} // namespace ReportPerformance
+
+} // namespace android
+
+#endif // ANDROID_MEDIA_REPORTPERFORMANCE_H
diff --git a/media/libnbaio/include/media/nbaio/SourceAudioBufferProvider.h b/media/libnbaio/include/media/nbaio/SourceAudioBufferProvider.h
new file mode 100644
index 0000000..cc2d019
--- /dev/null
+++ b/media/libnbaio/include/media/nbaio/SourceAudioBufferProvider.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Implementation of AudioBufferProvider that wraps an NBAIO_Source
+
+#ifndef ANDROID_SOURCE_AUDIO_BUFFER_PROVIDER_H
+#define ANDROID_SOURCE_AUDIO_BUFFER_PROVIDER_H
+
+#include <media/nbaio/NBAIO.h>
+#include <media/ExtendedAudioBufferProvider.h>
+
+namespace android {
+
+class SourceAudioBufferProvider : public ExtendedAudioBufferProvider {
+
+public:
+ SourceAudioBufferProvider(const sp<NBAIO_Source>& source);
+ virtual ~SourceAudioBufferProvider();
+
+ // AudioBufferProvider interface
+ virtual status_t getNextBuffer(Buffer *buffer);
+ virtual void releaseBuffer(Buffer *buffer);
+
+ // ExtendedAudioBufferProvider interface
+ virtual size_t framesReady() const;
+ virtual int64_t framesReleased() const;
+ virtual void onTimestamp(const ExtendedTimestamp ×tamp);
+
+private:
+ const sp<NBAIO_Source> mSource; // the wrapped source
+ /*const*/ size_t mFrameSize; // frame size in bytes
+ void* mAllocated; // pointer to base of allocated memory
+ size_t mSize; // size of mAllocated in frames
+ size_t mOffset; // frame offset within mAllocated of valid data
+ size_t mRemaining; // frame count within mAllocated of valid data
+ size_t mGetCount; // buffer.frameCount of the most recent getNextBuffer
+ int64_t mFramesReleased; // counter of the total number of frames released
+};
+
+} // namespace android
+
+#endif // ANDROID_SOURCE_AUDIO_BUFFER_PROVIDER_H
diff --git a/media/libnbaio/include_mono/media/nbaio/MonoPipe.h b/media/libnbaio/include_mono/media/nbaio/MonoPipe.h
new file mode 100644
index 0000000..c51d0fe
--- /dev/null
+++ b/media/libnbaio/include_mono/media/nbaio/MonoPipe.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_AUDIO_MONO_PIPE_H
+#define ANDROID_AUDIO_MONO_PIPE_H
+
+#include <time.h>
+#include <audio_utils/fifo.h>
+#include <media/SingleStateQueue.h>
+#include <media/nbaio/NBAIO.h>
+
+namespace android {
+
+typedef SingleStateQueue<ExtendedTimestamp> ExtendedTimestampSingleStateQueue;
+
+// MonoPipe is similar to Pipe except:
+// - supports only a single reader, called MonoPipeReader
+// - write() cannot overrun; instead it will return a short actual count if insufficient space
+// - write() can optionally block if the pipe is full
+// Like Pipe, it is not multi-thread safe for either writer or reader
+// but writer and reader can be different threads.
+class MonoPipe : public NBAIO_Sink {
+
+ friend class MonoPipeReader;
+
+public:
+ // reqFrames will be rounded up to a power of 2, and all slots are available. Must be >= 2.
+ // Note: whatever shares this object with another thread needs to do so in an SMP-safe way (like
+ // creating it the object before creating the other thread, or storing the object with a
+ // release_store). Otherwise the other thread could see a partially-constructed object.
+ MonoPipe(size_t reqFrames, const NBAIO_Format& format, bool writeCanBlock = false);
+ virtual ~MonoPipe();
+
+ // NBAIO_Port interface
+
+ //virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers,
+ // NBAIO_Format counterOffers[], size_t& numCounterOffers);
+ //virtual NBAIO_Format format() const;
+
+ // NBAIO_Sink interface
+
+ //virtual int64_t framesWritten() const;
+ //virtual int64_t framesUnderrun() const;
+ //virtual int64_t underruns() const;
+
+ // returns n where 0 <= n <= mMaxFrames, or a negative status_t
+ // including the private status codes in NBAIO.h
+ virtual ssize_t availableToWrite();
+
+ virtual ssize_t write(const void *buffer, size_t count);
+ //virtual ssize_t writeVia(writeVia_t via, size_t total, void *user, size_t block);
+
+ // average number of frames present in the pipe under normal conditions.
+ // See throttling mechanism in MonoPipe::write()
+ size_t getAvgFrames() const { return mSetpoint; }
+ void setAvgFrames(size_t setpoint);
+ size_t maxFrames() const { return mMaxFrames; }
+
+ // Set the shutdown state for the write side of a pipe.
+ // This may be called by an unrelated thread. When shutdown state is 'true',
+ // a write that would otherwise block instead returns a short transfer count.
+ // There is no guarantee how long it will take for the shutdown to be recognized,
+ // but it will not be an unbounded amount of time.
+ // The state can be restored to normal by calling shutdown(false).
+ void shutdown(bool newState = true);
+
+ // Return true if the write side of a pipe is currently shutdown.
+ bool isShutdown();
+
+ // Return NO_ERROR if there is a timestamp available
+ status_t getTimestamp(ExtendedTimestamp ×tamp);
+
+private:
+ const size_t mMaxFrames; // as requested in constructor, rounded up to a power of 2
+ void * const mBuffer;
+ audio_utils_fifo mFifo;
+ audio_utils_fifo_writer mFifoWriter;
+ bool mWriteTsValid; // whether mWriteTs is valid
+ struct timespec mWriteTs; // time that the previous write() completed
+ size_t mSetpoint; // target value for pipe fill depth
+ const bool mWriteCanBlock; // whether write() should block if the pipe is full
+
+ bool mIsShutdown; // whether shutdown(true) was called, no barriers are needed
+
+ ExtendedTimestampSingleStateQueue::Shared mTimestampShared;
+ ExtendedTimestampSingleStateQueue::Mutator mTimestampMutator;
+ ExtendedTimestampSingleStateQueue::Observer mTimestampObserver;
+};
+
+} // namespace android
+
+#endif // ANDROID_AUDIO_MONO_PIPE_H
diff --git a/media/libnbaio/include/MonoPipeReader.h b/media/libnbaio/include_mono/media/nbaio/MonoPipeReader.h
similarity index 100%
rename from media/libnbaio/include/MonoPipeReader.h
rename to media/libnbaio/include_mono/media/nbaio/MonoPipeReader.h
diff --git a/media/libnbaio/include/NBAIO.h b/media/libnbaio/include_mono/media/nbaio/NBAIO.h
similarity index 100%
rename from media/libnbaio/include/NBAIO.h
rename to media/libnbaio/include_mono/media/nbaio/NBAIO.h
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 6491ceb..c44e868 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -49,21 +49,18 @@
#include <hidlmemory/mapping.h>
-#include <OMX_AudioExt.h>
-#include <OMX_VideoExt.h>
-#include <OMX_Component.h>
-#include <OMX_IndexExt.h>
-#include <OMX_AsString.h>
+#include <media/openmax/OMX_AudioExt.h>
+#include <media/openmax/OMX_VideoExt.h>
+#include <media/openmax/OMX_Component.h>
+#include <media/openmax/OMX_IndexExt.h>
+#include <media/openmax/OMX_AsString.h>
#include "include/avc_utils.h"
#include "include/ACodecBufferChannel.h"
#include "include/DataConverter.h"
#include "include/SecureBuffer.h"
#include "include/SharedMemoryBuffer.h"
-#include "omx/OMXUtils.h"
-
-#include <android/hidl/allocator/1.0/IAllocator.h>
-#include <android/hidl/memory/1.0/IMemory.h>
+#include <media/stagefright/omx/OMXUtils.h>
namespace android {
@@ -1866,16 +1863,15 @@
mFlags |= kFlagIsGrallocUsageProtected;
mFlags |= kFlagPushBlankBuffersToNativeWindowOnShutdown;
}
+ }
+ if (mFlags & kFlagIsSecure) {
+ // use native_handles for secure input buffers
+ err = setPortMode(kPortIndexInput, IOMX::kPortModePresetSecureBuffer);
- if (mFlags & kFlagIsSecure) {
- // use native_handles for secure input buffers
- err = setPortMode(kPortIndexInput, IOMX::kPortModePresetSecureBuffer);
-
- if (err != OK) {
- ALOGI("falling back to non-native_handles");
- setPortMode(kPortIndexInput, IOMX::kPortModePresetByteBuffer);
- err = OK; // ignore error for now
- }
+ if (err != OK) {
+ ALOGI("falling back to non-native_handles");
+ setPortMode(kPortIndexInput, IOMX::kPortModePresetByteBuffer);
+ err = OK; // ignore error for now
}
}
if (haveNativeWindow) {
@@ -4174,11 +4170,12 @@
// static
int /* OMX_VIDEO_AVCLEVELTYPE */ ACodec::getAVCLevelFor(
int width, int height, int rate, int bitrate,
- OMX_VIDEO_AVCPROFILETYPE profile) {
+ OMX_VIDEO_AVCPROFILEEXTTYPE profile) {
// convert bitrate to main/baseline profile kbps equivalent
- switch (profile) {
+ switch ((uint32_t)profile) {
case OMX_VIDEO_AVCProfileHigh10:
bitrate = divUp(bitrate, 3000); break;
+ case OMX_VIDEO_AVCProfileConstrainedHigh:
case OMX_VIDEO_AVCProfileHigh:
bitrate = divUp(bitrate, 1250); break;
default:
@@ -4322,9 +4319,14 @@
h264type.bUseHadamard = OMX_TRUE;
h264type.nRefFrames = 2;
h264type.nBFrames = mLatency == 0 ? 1 : std::min(1U, mLatency - 1);
+
+ // disable B-frames until MPEG4Writer can guarantee finalizing files with B-frames
+ h264type.nRefFrames = 1;
+ h264type.nBFrames = 0;
+
h264type.nPFrames = setPFramesSpacing(iFrameInterval, frameRate, h264type.nBFrames);
h264type.nAllowedPictureTypes =
- OMX_VIDEO_PictureTypeI | OMX_VIDEO_PictureTypeP | OMX_VIDEO_PictureTypeB;
+ OMX_VIDEO_PictureTypeI | OMX_VIDEO_PictureTypeP;
h264type.nRefIdx10ActiveMinus1 = 0;
h264type.nRefIdx11ActiveMinus1 = 0;
h264type.bEntropyCodingCABAC = OMX_TRUE;
@@ -6339,19 +6341,10 @@
CHECK(mCodec->mOMXNode == NULL);
- OMXClient client;
- bool trebleFlag;
- if (client.connect(&trebleFlag) != OK) {
- mCodec->signalError(OMX_ErrorUndefined, NO_INIT);
- return false;
- }
- mCodec->setTrebleFlag(trebleFlag);
-
- sp<IOMX> omx = client.interface();
-
sp<AMessage> notify = new AMessage(kWhatOMXDied, mCodec);
Vector<AString> matchingCodecs;
+ Vector<AString> owners;
AString mime;
@@ -6359,9 +6352,31 @@
int32_t encoder = false;
if (msg->findString("componentName", &componentName)) {
sp<IMediaCodecList> list = MediaCodecList::getInstance();
- if (list != NULL && list->findCodecByName(componentName.c_str()) >= 0) {
- matchingCodecs.add(componentName);
+ if (list == nullptr) {
+ ALOGE("Unable to obtain MediaCodecList while "
+ "attempting to create codec \"%s\"",
+ componentName.c_str());
+ mCodec->signalError(OMX_ErrorUndefined, NO_INIT);
+ return false;
}
+ ssize_t index = list->findCodecByName(componentName.c_str());
+ if (index < 0) {
+ ALOGE("Unable to find codec \"%s\"",
+ componentName.c_str());
+ mCodec->signalError(OMX_ErrorInvalidComponent, NAME_NOT_FOUND);
+ return false;
+ }
+ sp<MediaCodecInfo> info = list->getCodecInfo(index);
+ if (info == nullptr) {
+ ALOGE("Unexpected error (index out-of-bound) while "
+ "retrieving information for codec \"%s\"",
+ componentName.c_str());
+ mCodec->signalError(OMX_ErrorUndefined, UNKNOWN_ERROR);
+ return false;
+ }
+ matchingCodecs.add(info->getCodecName());
+ owners.add(info->getOwnerName() == nullptr ?
+ "default" : info->getOwnerName());
} else {
CHECK(msg->findString("mime", &mime));
@@ -6373,10 +6388,12 @@
mime.c_str(),
encoder, // createEncoder
0, // flags
- &matchingCodecs);
+ &matchingCodecs,
+ &owners);
}
sp<CodecObserver> observer = new CodecObserver;
+ sp<IOMX> omx;
sp<IOMXNode> omxNode;
status_t err = NAME_NOT_FOUND;
@@ -6384,6 +6401,14 @@
++matchIndex) {
componentName = matchingCodecs[matchIndex];
+ OMXClient client;
+ bool trebleFlag;
+ if (client.connect(owners[matchIndex].c_str(), &trebleFlag) != OK) {
+ mCodec->signalError(OMX_ErrorUndefined, NO_INIT);
+ return false;
+ }
+ omx = client.interface();
+
pid_t tid = gettid();
int prevPriority = androidGetThreadPriority(tid);
androidSetThreadPriority(tid, ANDROID_PRIORITY_FOREGROUND);
@@ -6391,6 +6416,7 @@
androidSetThreadPriority(tid, prevPriority);
if (err == OK) {
+ mCodec->setTrebleFlag(trebleFlag);
break;
} else {
ALOGW("Allocating component '%s' failed, try next one.", componentName.c_str());
@@ -8214,16 +8240,15 @@
}
status_t ACodec::queryCapabilities(
- const AString &name, const AString &mime, bool isEncoder,
- sp<MediaCodecInfo::Capabilities> *caps) {
- (*caps).clear();
- const char *role = GetComponentRole(isEncoder, mime.c_str());
+ const char* owner, const char* name, const char* mime, bool isEncoder,
+ MediaCodecInfo::CapabilitiesWriter* caps) {
+ const char *role = GetComponentRole(isEncoder, mime);
if (role == NULL) {
return BAD_VALUE;
}
OMXClient client;
- status_t err = client.connect();
+ status_t err = client.connect(owner);
if (err != OK) {
return err;
}
@@ -8232,7 +8257,7 @@
sp<CodecObserver> observer = new CodecObserver;
sp<IOMXNode> omxNode;
- err = omx->allocateNode(name.c_str(), observer, &omxNode);
+ err = omx->allocateNode(name, observer, &omxNode);
if (err != OK) {
client.disconnect();
return err;
@@ -8245,8 +8270,7 @@
return err;
}
- sp<MediaCodecInfo::CapabilitiesBuilder> builder = new MediaCodecInfo::CapabilitiesBuilder();
- bool isVideo = mime.startsWithIgnoreCase("video/");
+ bool isVideo = strncasecmp(mime, "video/", 6) == 0;
if (isVideo) {
OMX_VIDEO_PARAM_PROFILELEVELTYPE param;
@@ -8261,11 +8285,22 @@
if (err != OK) {
break;
}
- builder->addProfileLevel(param.eProfile, param.eLevel);
+ caps->addProfileLevel(param.eProfile, param.eLevel);
+
+ // AVC components may not list the constrained profiles explicitly, but
+ // decoders that support a profile also support its constrained version.
+ // Encoders must explicitly support constrained profiles.
+ if (!isEncoder && strcasecmp(mime, MEDIA_MIMETYPE_VIDEO_AVC) == 0) {
+ if (param.eProfile == OMX_VIDEO_AVCProfileHigh) {
+ caps->addProfileLevel(OMX_VIDEO_AVCProfileConstrainedHigh, param.eLevel);
+ } else if (param.eProfile == OMX_VIDEO_AVCProfileBaseline) {
+ caps->addProfileLevel(OMX_VIDEO_AVCProfileConstrainedBaseline, param.eLevel);
+ }
+ }
if (index == kMaxIndicesToCheck) {
ALOGW("[%s] stopping checking profiles after %u: %x/%x",
- name.c_str(), index,
+ name, index,
param.eProfile, param.eLevel);
}
}
@@ -8276,7 +8311,6 @@
OMX_VIDEO_PARAM_PORTFORMATTYPE portFormat;
InitOMXParams(&portFormat);
portFormat.nPortIndex = isEncoder ? kPortIndexInput : kPortIndexOutput;
- Vector<uint32_t> supportedColors; // shadow copy to check for duplicates
for (OMX_U32 index = 0; index <= kMaxIndicesToCheck; ++index) {
portFormat.nIndex = index;
status_t err = omxNode->getParameter(
@@ -8290,28 +8324,17 @@
if (IsFlexibleColorFormat(
omxNode, portFormat.eColorFormat, false /* usingNativeWindow */,
&flexibleEquivalent)) {
- bool marked = false;
- for (size_t i = 0; i < supportedColors.size(); ++i) {
- if (supportedColors[i] == flexibleEquivalent) {
- marked = true;
- break;
- }
- }
- if (!marked) {
- supportedColors.push(flexibleEquivalent);
- builder->addColorFormat(flexibleEquivalent);
- }
+ caps->addColorFormat(flexibleEquivalent);
}
- supportedColors.push(portFormat.eColorFormat);
- builder->addColorFormat(portFormat.eColorFormat);
+ caps->addColorFormat(portFormat.eColorFormat);
if (index == kMaxIndicesToCheck) {
ALOGW("[%s] stopping checking formats after %u: %s(%x)",
- name.c_str(), index,
+ name, index,
asString(portFormat.eColorFormat), portFormat.eColorFormat);
}
}
- } else if (mime.equalsIgnoreCase(MEDIA_MIMETYPE_AUDIO_AAC)) {
+ } else if (strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AAC) == 0) {
// More audio codecs if they have profiles.
OMX_AUDIO_PARAM_ANDROID_PROFILETYPE param;
InitOMXParams(¶m);
@@ -8325,11 +8348,11 @@
break;
}
// For audio, level is ignored.
- builder->addProfileLevel(param.eProfile, 0 /* level */);
+ caps->addProfileLevel(param.eProfile, 0 /* level */);
if (index == kMaxIndicesToCheck) {
ALOGW("[%s] stopping checking profiles after %u: %x",
- name.c_str(), index,
+ name, index,
param.eProfile);
}
}
@@ -8337,7 +8360,7 @@
// NOTE: Without Android extensions, OMX does not provide a way to query
// AAC profile support
if (param.nProfileIndex == 0) {
- ALOGW("component %s doesn't support profile query.", name.c_str());
+ ALOGW("component %s doesn't support profile query.", name);
}
}
@@ -8346,14 +8369,14 @@
if (omxNode->configureVideoTunnelMode(
kPortIndexOutput, OMX_TRUE, 0, &sidebandHandle) == OK) {
// tunneled playback includes adaptive playback
- builder->addFlags(MediaCodecInfo::Capabilities::kFlagSupportsAdaptivePlayback
+ caps->addFlags(MediaCodecInfo::Capabilities::kFlagSupportsAdaptivePlayback
| MediaCodecInfo::Capabilities::kFlagSupportsTunneledPlayback);
} else if (omxNode->setPortMode(
kPortIndexOutput, IOMX::kPortModeDynamicANWBuffer) == OK ||
omxNode->prepareForAdaptivePlayback(
kPortIndexOutput, OMX_TRUE,
1280 /* width */, 720 /* height */) == OK) {
- builder->addFlags(MediaCodecInfo::Capabilities::kFlagSupportsAdaptivePlayback);
+ caps->addFlags(MediaCodecInfo::Capabilities::kFlagSupportsAdaptivePlayback);
}
}
@@ -8365,11 +8388,10 @@
if (omxNode->getConfig(
(OMX_INDEXTYPE)OMX_IndexConfigAndroidIntraRefresh,
¶ms, sizeof(params)) == OK) {
- builder->addFlags(MediaCodecInfo::Capabilities::kFlagSupportsIntraRefresh);
+ caps->addFlags(MediaCodecInfo::Capabilities::kFlagSupportsIntraRefresh);
}
}
- *caps = builder;
omxNode->freeNode();
client.disconnect();
return OK;
diff --git a/media/libstagefright/ACodecBufferChannel.cpp b/media/libstagefright/ACodecBufferChannel.cpp
index 0d9696f..3c7ae3e 100644
--- a/media/libstagefright/ACodecBufferChannel.cpp
+++ b/media/libstagefright/ACodecBufferChannel.cpp
@@ -20,7 +20,7 @@
#include <numeric>
-#include <android/media/IDescrambler.h>
+#include <android/hardware/cas/native/1.0/IDescrambler.h>
#include <binder/MemoryDealer.h>
#include <media/openmax/OMX_Core.h>
#include <media/stagefright/foundation/AMessage.h>
@@ -34,8 +34,11 @@
#include "include/SharedMemoryBuffer.h"
namespace android {
-using binder::Status;
-using MediaDescrambler::DescrambleInfo;
+using hardware::hidl_handle;
+using hardware::hidl_string;
+using hardware::hidl_vec;
+using namespace hardware::cas::V1_0;
+using namespace hardware::cas::native::V1_0;
using BufferInfo = ACodecBufferChannel::BufferInfo;
using BufferInfoIterator = std::vector<const BufferInfo>::const_iterator;
@@ -114,74 +117,97 @@
return -ENOENT;
}
- ICrypto::DestinationBuffer destination;
+ native_handle_t *secureHandle = NULL;
if (secure) {
sp<SecureBuffer> secureData =
static_cast<SecureBuffer *>(it->mCodecBuffer.get());
- destination.mType = secureData->getDestinationType();
- if (destination.mType != ICrypto::kDestinationTypeNativeHandle) {
+ if (secureData->getDestinationType() != ICrypto::kDestinationTypeNativeHandle) {
return BAD_VALUE;
}
- destination.mHandle =
- static_cast<native_handle_t *>(secureData->getDestinationPointer());
- } else {
- destination.mType = ICrypto::kDestinationTypeSharedMemory;
- destination.mSharedMemory = mDecryptDestination;
+ secureHandle = static_cast<native_handle_t *>(secureData->getDestinationPointer());
}
-
- ICrypto::SourceBuffer source;
- source.mSharedMemory = it->mSharedEncryptedBuffer;
- source.mHeapSeqNum = mHeapSeqNum;
-
ssize_t result = -1;
if (mCrypto != NULL) {
+ ICrypto::DestinationBuffer destination;
+ if (secure) {
+ destination.mType = ICrypto::kDestinationTypeNativeHandle;
+ destination.mHandle = secureHandle;
+ } else {
+ destination.mType = ICrypto::kDestinationTypeSharedMemory;
+ destination.mSharedMemory = mDecryptDestination;
+ }
+
+ ICrypto::SourceBuffer source;
+ source.mSharedMemory = it->mSharedEncryptedBuffer;
+ source.mHeapSeqNum = mHeapSeqNum;
+
result = mCrypto->decrypt(key, iv, mode, pattern,
source, it->mClientBuffer->offset(),
subSamples, numSubSamples, destination, errorDetailMsg);
- } else {
- DescrambleInfo descrambleInfo;
- descrambleInfo.dstType = destination.mType ==
- ICrypto::kDestinationTypeSharedMemory ?
- DescrambleInfo::kDestinationTypeVmPointer :
- DescrambleInfo::kDestinationTypeNativeHandle;
- descrambleInfo.scramblingControl = key != NULL ?
- (DescramblerPlugin::ScramblingControl)key[0] :
- DescramblerPlugin::kScrambling_Unscrambled;
- descrambleInfo.numSubSamples = numSubSamples;
- descrambleInfo.subSamples = (DescramblerPlugin::SubSample *)subSamples;
- descrambleInfo.srcMem = it->mSharedEncryptedBuffer;
- descrambleInfo.srcOffset = 0;
- descrambleInfo.dstPtr = NULL;
- descrambleInfo.dstOffset = 0;
-
- int32_t descrambleResult = -1;
- Status status = mDescrambler->descramble(descrambleInfo, &descrambleResult);
-
- if (status.isOk()) {
- result = descrambleResult;
- }
if (result < 0) {
- ALOGE("descramble failed, exceptionCode=%d, err=%d, result=%zd",
- status.exceptionCode(), status.transactionError(), result);
- } else {
- ALOGV("descramble succeeded, result=%zd", result);
+ return result;
}
- if (result > 0 && destination.mType == ICrypto::kDestinationTypeSharedMemory) {
- memcpy(destination.mSharedMemory->pointer(),
+ if (destination.mType == ICrypto::kDestinationTypeSharedMemory) {
+ memcpy(it->mCodecBuffer->base(), destination.mSharedMemory->pointer(), result);
+ }
+ } else {
+ // Here we cast CryptoPlugin::SubSample to hardware::cas::native::V1_0::SubSample
+ // directly, the structure definitions should match as checked in DescramblerImpl.cpp.
+ hidl_vec<SubSample> hidlSubSamples;
+ hidlSubSamples.setToExternal((SubSample *)subSamples, numSubSamples, false /*own*/);
+
+ ssize_t offset;
+ size_t size;
+ it->mSharedEncryptedBuffer->getMemory(&offset, &size);
+ hardware::cas::native::V1_0::SharedBuffer srcBuffer = {
+ .heapBase = mHidlMemory,
+ .offset = (uint64_t) offset,
+ .size = size
+ };
+
+ DestinationBuffer dstBuffer;
+ if (secure) {
+ dstBuffer.type = BufferType::NATIVE_HANDLE;
+ dstBuffer.secureMemory = hidl_handle(secureHandle);
+ } else {
+ dstBuffer.type = BufferType::SHARED_MEMORY;
+ dstBuffer.nonsecureMemory = srcBuffer;
+ }
+
+ Status status = Status::OK;
+ hidl_string detailedError;
+
+ auto returnVoid = mDescrambler->descramble(
+ key != NULL ? (ScramblingControl)key[0] : ScramblingControl::UNSCRAMBLED,
+ hidlSubSamples,
+ srcBuffer,
+ 0,
+ dstBuffer,
+ 0,
+ [&status, &result, &detailedError] (
+ Status _status, uint32_t _bytesWritten,
+ const hidl_string& _detailedError) {
+ status = _status;
+ result = (ssize_t)_bytesWritten;
+ detailedError = _detailedError;
+ });
+
+ if (!returnVoid.isOk() || status != Status::OK || result < 0) {
+ ALOGE("descramble failed, trans=%s, status=%d, result=%zd",
+ returnVoid.description().c_str(), status, result);
+ return UNKNOWN_ERROR;
+ }
+
+ ALOGV("descramble succeeded, %zd bytes", result);
+
+ if (dstBuffer.type == BufferType::SHARED_MEMORY) {
+ memcpy(it->mCodecBuffer->base(),
(uint8_t*)it->mSharedEncryptedBuffer->pointer(), result);
}
}
- if (result < 0) {
- return result;
- }
-
- if (destination.mType == ICrypto::kDestinationTypeSharedMemory) {
- memcpy(it->mCodecBuffer->base(), destination.mSharedMemory->pointer(), result);
- }
-
it->mCodecBuffer->setRange(0, result);
// Copy metadata from client to codec buffer.
@@ -275,10 +301,21 @@
int32_t seqNum = mCrypto->setHeap(dealer->getMemoryHeap());
if (seqNum >= 0) {
mHeapSeqNum = seqNum;
- ALOGD("setHeap returned mHeapSeqNum=%d", mHeapSeqNum);
+ ALOGV("setHeap returned mHeapSeqNum=%d", mHeapSeqNum);
} else {
mHeapSeqNum = -1;
- ALOGD("setHeap failed, setting mHeapSeqNum=-1");
+ ALOGE("setHeap failed, setting mHeapSeqNum=-1");
+ }
+ } else if (mDescrambler != nullptr) {
+ sp<IMemoryHeap> heap = dealer->getMemoryHeap();
+ native_handle_t* nativeHandle = native_handle_create(1, 0);
+ if (nativeHandle != nullptr) {
+ int fd = heap->getHeapID();
+ nativeHandle->data[0] = fd;
+ mHidlMemory = hidl_memory("ashmem", hidl_handle(nativeHandle), heap->getSize());
+ ALOGV("created hidl_memory for descrambler");
+ } else {
+ ALOGE("failed to create hidl_memory for descrambler");
}
}
return dealer;
diff --git a/media/libstagefright/AVIExtractor.cpp b/media/libstagefright/AVIExtractor.cpp
deleted file mode 100644
index 5a6211e..0000000
--- a/media/libstagefright/AVIExtractor.cpp
+++ /dev/null
@@ -1,1307 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "AVIExtractor"
-#include <utils/Log.h>
-
-#include "include/avc_utils.h"
-#include "include/AVIExtractor.h"
-
-#include <binder/ProcessState.h>
-#include <media/stagefright/foundation/hexdump.h>
-#include <media/stagefright/foundation/ABuffer.h>
-#include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/DataSource.h>
-#include <media/stagefright/MediaBuffer.h>
-#include <media/stagefright/MediaBufferGroup.h>
-#include <media/stagefright/MediaDefs.h>
-#include <media/stagefright/MediaErrors.h>
-#include <media/stagefright/MetaData.h>
-#include <media/stagefright/Utils.h>
-
-namespace android {
-
-struct AVIExtractor::AVISource : public MediaSource {
- AVISource(const sp<AVIExtractor> &extractor, size_t trackIndex);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
- virtual ~AVISource();
-
-private:
- sp<AVIExtractor> mExtractor;
- size_t mTrackIndex;
- const AVIExtractor::Track &mTrack;
- MediaBufferGroup *mBufferGroup;
- size_t mSampleIndex;
-
- sp<MP3Splitter> mSplitter;
-
- DISALLOW_EVIL_CONSTRUCTORS(AVISource);
-};
-
-////////////////////////////////////////////////////////////////////////////////
-
-struct AVIExtractor::MP3Splitter : public RefBase {
- MP3Splitter();
-
- void clear();
- void append(MediaBuffer *buffer);
- status_t read(MediaBuffer **buffer);
-
-protected:
- virtual ~MP3Splitter();
-
-private:
- bool mFindSync;
- int64_t mBaseTimeUs;
- int64_t mNumSamplesRead;
- sp<ABuffer> mBuffer;
-
- bool resync();
-
- DISALLOW_EVIL_CONSTRUCTORS(MP3Splitter);
-};
-
-////////////////////////////////////////////////////////////////////////////////
-
-AVIExtractor::AVISource::AVISource(
- const sp<AVIExtractor> &extractor, size_t trackIndex)
- : mExtractor(extractor),
- mTrackIndex(trackIndex),
- mTrack(mExtractor->mTracks.itemAt(trackIndex)),
- mBufferGroup(NULL) {
-}
-
-AVIExtractor::AVISource::~AVISource() {
- if (mBufferGroup) {
- stop();
- }
-}
-
-status_t AVIExtractor::AVISource::start(MetaData *params) {
- CHECK(!mBufferGroup);
-
- mBufferGroup = new MediaBufferGroup;
-
- mBufferGroup->add_buffer(new MediaBuffer(mTrack.mMaxSampleSize));
- mBufferGroup->add_buffer(new MediaBuffer(mTrack.mMaxSampleSize));
- mSampleIndex = 0;
-
- const char *mime;
- CHECK(mTrack.mMeta->findCString(kKeyMIMEType, &mime));
-
- if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_MPEG)) {
- mSplitter = new MP3Splitter;
- } else {
- mSplitter.clear();
- }
-
- return OK;
-}
-
-status_t AVIExtractor::AVISource::stop() {
- CHECK(mBufferGroup);
-
- delete mBufferGroup;
- mBufferGroup = NULL;
-
- mSplitter.clear();
-
- return OK;
-}
-
-sp<MetaData> AVIExtractor::AVISource::getFormat() {
- return mTrack.mMeta;
-}
-
-status_t AVIExtractor::AVISource::read(
- MediaBuffer **buffer, const ReadOptions *options) {
- CHECK(mBufferGroup);
-
- *buffer = NULL;
-
- int64_t seekTimeUs;
- ReadOptions::SeekMode seekMode;
- if (options && options->getSeekTo(&seekTimeUs, &seekMode)) {
- status_t err =
- mExtractor->getSampleIndexAtTime(
- mTrackIndex, seekTimeUs, seekMode, &mSampleIndex);
-
- if (err != OK) {
- return ERROR_END_OF_STREAM;
- }
-
- if (mSplitter != NULL) {
- mSplitter->clear();
- }
- }
-
- for (;;) {
- if (mSplitter != NULL) {
- status_t err = mSplitter->read(buffer);
-
- if (err == OK) {
- break;
- } else if (err != -EAGAIN) {
- return err;
- }
- }
-
- off64_t offset;
- size_t size;
- bool isKey;
- int64_t timeUs;
- status_t err = mExtractor->getSampleInfo(
- mTrackIndex, mSampleIndex, &offset, &size, &isKey, &timeUs);
-
- ++mSampleIndex;
-
- if (err != OK) {
- return ERROR_END_OF_STREAM;
- }
-
- MediaBuffer *out;
- CHECK_EQ(mBufferGroup->acquire_buffer(&out), (status_t)OK);
-
- ssize_t n = mExtractor->mDataSource->readAt(offset, out->data(), size);
-
- if (n < (ssize_t)size) {
- return n < 0 ? (status_t)n : (status_t)ERROR_MALFORMED;
- }
-
- out->set_range(0, size);
-
- out->meta_data()->setInt64(kKeyTime, timeUs);
-
- if (isKey) {
- out->meta_data()->setInt32(kKeyIsSyncFrame, 1);
- }
-
- if (mSplitter == NULL) {
- *buffer = out;
- break;
- }
-
- mSplitter->append(out);
- out->release();
- out = NULL;
- }
-
- return OK;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-AVIExtractor::MP3Splitter::MP3Splitter()
- : mFindSync(true),
- mBaseTimeUs(-1ll),
- mNumSamplesRead(0) {
-}
-
-AVIExtractor::MP3Splitter::~MP3Splitter() {
-}
-
-void AVIExtractor::MP3Splitter::clear() {
- mFindSync = true;
- mBaseTimeUs = -1ll;
- mNumSamplesRead = 0;
-
- if (mBuffer != NULL) {
- mBuffer->setRange(0, 0);
- }
-}
-
-void AVIExtractor::MP3Splitter::append(MediaBuffer *buffer) {
- size_t prevCapacity = (mBuffer != NULL) ? mBuffer->capacity() : 0;
-
- if (mBaseTimeUs < 0) {
- CHECK(mBuffer == NULL || mBuffer->size() == 0);
- CHECK(buffer->meta_data()->findInt64(kKeyTime, &mBaseTimeUs));
- mNumSamplesRead = 0;
- }
-
- if (mBuffer != NULL && mBuffer->offset() > 0) {
- memmove(mBuffer->base(), mBuffer->data(), mBuffer->size());
- mBuffer->setRange(0, mBuffer->size());
- }
-
- if (mBuffer == NULL
- || mBuffer->size() + buffer->range_length() > prevCapacity) {
- size_t newCapacity =
- (prevCapacity + buffer->range_length() + 1023) & ~1023;
-
- sp<ABuffer> newBuffer = new ABuffer(newCapacity);
- if (mBuffer != NULL) {
- memcpy(newBuffer->data(), mBuffer->data(), mBuffer->size());
- newBuffer->setRange(0, mBuffer->size());
- } else {
- newBuffer->setRange(0, 0);
- }
- mBuffer = newBuffer;
- }
-
- memcpy(mBuffer->data() + mBuffer->size(),
- (const uint8_t *)buffer->data() + buffer->range_offset(),
- buffer->range_length());
-
- mBuffer->setRange(0, mBuffer->size() + buffer->range_length());
-}
-
-bool AVIExtractor::MP3Splitter::resync() {
- if (mBuffer == NULL) {
- return false;
- }
-
- bool foundSync = false;
- for (size_t offset = 0; offset + 3 < mBuffer->size(); ++offset) {
- uint32_t firstHeader = U32_AT(mBuffer->data() + offset);
-
- size_t frameSize;
- if (!GetMPEGAudioFrameSize(firstHeader, &frameSize)) {
- continue;
- }
-
- size_t subsequentOffset = offset + frameSize;
- size_t i = 3;
- while (i > 0) {
- if (subsequentOffset + 3 >= mBuffer->size()) {
- break;
- }
-
- static const uint32_t kMask = 0xfffe0c00;
-
- uint32_t header = U32_AT(mBuffer->data() + subsequentOffset);
- if ((header & kMask) != (firstHeader & kMask)) {
- break;
- }
-
- if (!GetMPEGAudioFrameSize(header, &frameSize)) {
- break;
- }
-
- subsequentOffset += frameSize;
- --i;
- }
-
- if (i == 0) {
- foundSync = true;
- memmove(mBuffer->data(),
- mBuffer->data() + offset,
- mBuffer->size() - offset);
-
- mBuffer->setRange(0, mBuffer->size() - offset);
- break;
- }
- }
-
- return foundSync;
-}
-
-status_t AVIExtractor::MP3Splitter::read(MediaBuffer **out) {
- *out = NULL;
-
- if (mFindSync) {
- if (!resync()) {
- return -EAGAIN;
- }
-
- mFindSync = false;
- }
-
- if (mBuffer->size() < 4) {
- return -EAGAIN;
- }
-
- uint32_t header = U32_AT(mBuffer->data());
- size_t frameSize;
- int sampleRate;
- int numSamples;
- if (!GetMPEGAudioFrameSize(
- header, &frameSize, &sampleRate, NULL, NULL, &numSamples)) {
- return ERROR_MALFORMED;
- }
-
- if (mBuffer->size() < frameSize) {
- return -EAGAIN;
- }
-
- MediaBuffer *mbuf = new MediaBuffer(frameSize);
- memcpy(mbuf->data(), mBuffer->data(), frameSize);
-
- int64_t timeUs = mBaseTimeUs + (mNumSamplesRead * 1000000ll) / sampleRate;
- mNumSamplesRead += numSamples;
-
- mbuf->meta_data()->setInt64(kKeyTime, timeUs);
-
- mBuffer->setRange(
- mBuffer->offset() + frameSize, mBuffer->size() - frameSize);
-
- *out = mbuf;
-
- return OK;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-AVIExtractor::AVIExtractor(const sp<DataSource> &dataSource)
- : mDataSource(dataSource) {
- mInitCheck = parseHeaders();
-
- if (mInitCheck != OK) {
- mTracks.clear();
- }
-}
-
-AVIExtractor::~AVIExtractor() {
-}
-
-size_t AVIExtractor::countTracks() {
- return mTracks.size();
-}
-
-sp<MediaSource> AVIExtractor::getTrack(size_t index) {
- return index < mTracks.size() ? new AVISource(this, index) : NULL;
-}
-
-sp<MetaData> AVIExtractor::getTrackMetaData(
- size_t index, uint32_t flags) {
- return index < mTracks.size() ? mTracks.editItemAt(index).mMeta : NULL;
-}
-
-sp<MetaData> AVIExtractor::getMetaData() {
- sp<MetaData> meta = new MetaData;
-
- if (mInitCheck == OK) {
- meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_CONTAINER_AVI);
- }
-
- return meta;
-}
-
-status_t AVIExtractor::parseHeaders() {
- mTracks.clear();
- mMovieOffset = 0;
- mFoundIndex = false;
- mOffsetsAreAbsolute = false;
-
- ssize_t res = parseChunk(0ll, -1ll);
-
- if (res < 0) {
- return (status_t)res;
- }
-
- if (mMovieOffset == 0ll || !mFoundIndex) {
- return ERROR_MALFORMED;
- }
-
- return OK;
-}
-
-ssize_t AVIExtractor::parseChunk(off64_t offset, off64_t size, int depth) {
- if (size >= 0 && size < 8) {
- return ERROR_MALFORMED;
- }
-
- uint8_t tmp[12];
- ssize_t n = mDataSource->readAt(offset, tmp, 8);
-
- if (n < 8) {
- return (n < 0) ? n : (ssize_t)ERROR_MALFORMED;
- }
-
- uint32_t fourcc = U32_AT(tmp);
- uint32_t chunkSize = U32LE_AT(&tmp[4]);
-
- if (size >= 0 && chunkSize + 8 > size) {
- return ERROR_MALFORMED;
- }
-
- static const char kPrefix[] = " ";
- const char *prefix = &kPrefix[strlen(kPrefix) - 2 * depth];
-
- if (fourcc == FOURCC('L', 'I', 'S', 'T')
- || fourcc == FOURCC('R', 'I', 'F', 'F')) {
- // It's a list of chunks
-
- if (size >= 0 && size < 12) {
- return ERROR_MALFORMED;
- }
-
- n = mDataSource->readAt(offset + 8, &tmp[8], 4);
-
- if (n < 4) {
- return (n < 0) ? n : (ssize_t)ERROR_MALFORMED;
- }
-
- uint32_t subFourcc = U32_AT(&tmp[8]);
-
- ALOGV("%s offset 0x%08llx LIST of '%c%c%c%c', size %d",
- prefix,
- offset,
- (char)(subFourcc >> 24),
- (char)((subFourcc >> 16) & 0xff),
- (char)((subFourcc >> 8) & 0xff),
- (char)(subFourcc & 0xff),
- chunkSize - 4);
-
- if (subFourcc == FOURCC('m', 'o', 'v', 'i')) {
- // We're not going to parse this, but will take note of the
- // offset.
-
- mMovieOffset = offset;
- } else {
- off64_t subOffset = offset + 12;
- off64_t subOffsetLimit = subOffset + chunkSize - 4;
- while (subOffset < subOffsetLimit) {
- ssize_t res =
- parseChunk(subOffset, subOffsetLimit - subOffset, depth + 1);
-
- if (res < 0) {
- return res;
- }
-
- subOffset += res;
- }
- }
- } else {
- ALOGV("%s offset 0x%08llx CHUNK '%c%c%c%c'",
- prefix,
- offset,
- (char)(fourcc >> 24),
- (char)((fourcc >> 16) & 0xff),
- (char)((fourcc >> 8) & 0xff),
- (char)(fourcc & 0xff));
-
- status_t err = OK;
-
- switch (fourcc) {
- case FOURCC('s', 't', 'r', 'h'):
- {
- err = parseStreamHeader(offset + 8, chunkSize);
- break;
- }
-
- case FOURCC('s', 't', 'r', 'f'):
- {
- err = parseStreamFormat(offset + 8, chunkSize);
- break;
- }
-
- case FOURCC('i', 'd', 'x', '1'):
- {
- err = parseIndex(offset + 8, chunkSize);
- break;
- }
-
- default:
- break;
- }
-
- if (err != OK) {
- return err;
- }
- }
-
- if (chunkSize & 1) {
- ++chunkSize;
- }
-
- return chunkSize + 8;
-}
-
-static const char *GetMIMETypeForHandler(uint32_t handler) {
- switch (handler) {
- // Wow... shamelessly copied from
- // http://wiki.multimedia.cx/index.php?title=ISO_MPEG-4
-
- case FOURCC('3', 'I', 'V', '2'):
- case FOURCC('3', 'i', 'v', '2'):
- case FOURCC('B', 'L', 'Z', '0'):
- case FOURCC('D', 'I', 'G', 'I'):
- case FOURCC('D', 'I', 'V', '1'):
- case FOURCC('d', 'i', 'v', '1'):
- case FOURCC('D', 'I', 'V', 'X'):
- case FOURCC('d', 'i', 'v', 'x'):
- case FOURCC('D', 'X', '5', '0'):
- case FOURCC('d', 'x', '5', '0'):
- case FOURCC('D', 'X', 'G', 'M'):
- case FOURCC('E', 'M', '4', 'A'):
- case FOURCC('E', 'P', 'H', 'V'):
- case FOURCC('F', 'M', 'P', '4'):
- case FOURCC('f', 'm', 'p', '4'):
- case FOURCC('F', 'V', 'F', 'W'):
- case FOURCC('H', 'D', 'X', '4'):
- case FOURCC('h', 'd', 'x', '4'):
- case FOURCC('M', '4', 'C', 'C'):
- case FOURCC('M', '4', 'S', '2'):
- case FOURCC('m', '4', 's', '2'):
- case FOURCC('M', 'P', '4', 'S'):
- case FOURCC('m', 'p', '4', 's'):
- case FOURCC('M', 'P', '4', 'V'):
- case FOURCC('m', 'p', '4', 'v'):
- case FOURCC('M', 'V', 'X', 'M'):
- case FOURCC('R', 'M', 'P', '4'):
- case FOURCC('S', 'E', 'D', 'G'):
- case FOURCC('S', 'M', 'P', '4'):
- case FOURCC('U', 'M', 'P', '4'):
- case FOURCC('W', 'V', '1', 'F'):
- case FOURCC('X', 'V', 'I', 'D'):
- case FOURCC('X', 'v', 'i', 'D'):
- case FOURCC('x', 'v', 'i', 'd'):
- case FOURCC('X', 'V', 'I', 'X'):
- return MEDIA_MIMETYPE_VIDEO_MPEG4;
-
- // from http://wiki.multimedia.cx/index.php?title=H264
- case FOURCC('a', 'v', 'c', '1'):
- case FOURCC('d', 'a', 'v', 'c'):
- case FOURCC('x', '2', '6', '4'):
- case FOURCC('H', '2', '6', '4'):
- case FOURCC('v', 's', 's', 'h'):
- return MEDIA_MIMETYPE_VIDEO_AVC;
-
- default:
- return NULL;
- }
-}
-
-status_t AVIExtractor::parseStreamHeader(off64_t offset, size_t size) {
- if (size != 56) {
- return ERROR_MALFORMED;
- }
-
- if (mTracks.size() > 99) {
- return -ERANGE;
- }
-
- sp<ABuffer> buffer = new ABuffer(size);
- ssize_t n = mDataSource->readAt(offset, buffer->data(), buffer->size());
-
- if (n < (ssize_t)size) {
- return n < 0 ? (status_t)n : ERROR_MALFORMED;
- }
-
- const uint8_t *data = buffer->data();
-
- uint32_t type = U32_AT(data);
- uint32_t handler = U32_AT(&data[4]);
- uint32_t flags = U32LE_AT(&data[8]);
-
- sp<MetaData> meta = new MetaData;
-
- uint32_t rate = U32LE_AT(&data[20]);
- uint32_t scale = U32LE_AT(&data[24]);
-
- uint32_t sampleSize = U32LE_AT(&data[44]);
-
- const char *mime = NULL;
- Track::Kind kind = Track::OTHER;
-
- if (type == FOURCC('v', 'i', 'd', 's')) {
- mime = GetMIMETypeForHandler(handler);
-
- if (mime && strncasecmp(mime, "video/", 6)) {
- return ERROR_MALFORMED;
- }
-
- if (mime == NULL) {
- ALOGW("Unsupported video format '%c%c%c%c'",
- (char)(handler >> 24),
- (char)((handler >> 16) & 0xff),
- (char)((handler >> 8) & 0xff),
- (char)(handler & 0xff));
- }
-
- kind = Track::VIDEO;
- } else if (type == FOURCC('a', 'u', 'd', 's')) {
- if (mime && strncasecmp(mime, "audio/", 6)) {
- return ERROR_MALFORMED;
- }
-
- kind = Track::AUDIO;
- }
-
- if (!mime) {
- mime = "application/octet-stream";
- }
-
- meta->setCString(kKeyMIMEType, mime);
-
- mTracks.push();
- Track *track = &mTracks.editItemAt(mTracks.size() - 1);
-
- track->mMeta = meta;
- track->mRate = rate;
- track->mScale = scale;
- track->mBytesPerSample = sampleSize;
- track->mKind = kind;
- track->mNumSyncSamples = 0;
- track->mThumbnailSampleSize = 0;
- track->mThumbnailSampleIndex = -1;
- track->mMaxSampleSize = 0;
- track->mAvgChunkSize = 1.0;
- track->mFirstChunkSize = 0;
-
- return OK;
-}
-
-status_t AVIExtractor::parseStreamFormat(off64_t offset, size_t size) {
- if (mTracks.isEmpty()) {
- return ERROR_MALFORMED;
- }
-
- Track *track = &mTracks.editItemAt(mTracks.size() - 1);
-
- if (track->mKind == Track::OTHER) {
- // We don't support this content, but that's not a parsing error.
- return OK;
- }
-
- bool isVideo = (track->mKind == Track::VIDEO);
-
- if ((isVideo && size < 40) || (!isVideo && size < 16)) {
- // Expected a BITMAPINFO or WAVEFORMAT(EX) structure, respectively.
- return ERROR_MALFORMED;
- }
-
- sp<ABuffer> buffer = new ABuffer(size);
- ssize_t n = mDataSource->readAt(offset, buffer->data(), buffer->size());
-
- if (n < (ssize_t)size) {
- return n < 0 ? (status_t)n : ERROR_MALFORMED;
- }
-
- const uint8_t *data = buffer->data();
-
- if (isVideo) {
- uint32_t width = U32LE_AT(&data[4]);
- uint32_t height = U32LE_AT(&data[8]);
-
- track->mMeta->setInt32(kKeyWidth, width);
- track->mMeta->setInt32(kKeyHeight, height);
- } else {
- uint32_t format = U16LE_AT(data);
-
- if (format == 0x55) {
- track->mMeta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_MPEG);
- } else {
- ALOGW("Unsupported audio format = 0x%04x", format);
- }
-
- uint32_t numChannels = U16LE_AT(&data[2]);
- uint32_t sampleRate = U32LE_AT(&data[4]);
-
- track->mMeta->setInt32(kKeyChannelCount, numChannels);
- track->mMeta->setInt32(kKeySampleRate, sampleRate);
- }
-
- return OK;
-}
-
-// static
-bool AVIExtractor::IsCorrectChunkType(
- ssize_t trackIndex, Track::Kind kind, uint32_t chunkType) {
- uint32_t chunkBase = chunkType & 0xffff;
-
- switch (kind) {
- case Track::VIDEO:
- {
- if (chunkBase != FOURCC(0, 0, 'd', 'c')
- && chunkBase != FOURCC(0, 0, 'd', 'b')) {
- return false;
- }
- break;
- }
-
- case Track::AUDIO:
- {
- if (chunkBase != FOURCC(0, 0, 'w', 'b')) {
- return false;
- }
- break;
- }
-
- default:
- break;
- }
-
- if (trackIndex < 0) {
- return true;
- }
-
- uint8_t hi = chunkType >> 24;
- uint8_t lo = (chunkType >> 16) & 0xff;
-
- if (hi < '0' || hi > '9' || lo < '0' || lo > '9') {
- return false;
- }
-
- if (trackIndex != (10 * (hi - '0') + (lo - '0'))) {
- return false;
- }
-
- return true;
-}
-
-status_t AVIExtractor::parseIndex(off64_t offset, size_t size) {
- if ((size % 16) != 0) {
- return ERROR_MALFORMED;
- }
-
- sp<ABuffer> buffer = new ABuffer(size);
- ssize_t n = mDataSource->readAt(offset, buffer->data(), buffer->size());
-
- if (n < (ssize_t)size) {
- return n < 0 ? (status_t)n : ERROR_MALFORMED;
- }
-
- const uint8_t *data = buffer->data();
-
- while (size > 0) {
- uint32_t chunkType = U32_AT(data);
-
- uint8_t hi = chunkType >> 24;
- uint8_t lo = (chunkType >> 16) & 0xff;
-
- if (hi < '0' || hi > '9' || lo < '0' || lo > '9') {
- return ERROR_MALFORMED;
- }
-
- size_t trackIndex = 10 * (hi - '0') + (lo - '0');
-
- if (trackIndex >= mTracks.size()) {
- return ERROR_MALFORMED;
- }
-
- Track *track = &mTracks.editItemAt(trackIndex);
-
- if (!IsCorrectChunkType(-1, track->mKind, chunkType)) {
- return ERROR_MALFORMED;
- }
-
- if (track->mKind == Track::OTHER) {
- data += 16;
- size -= 16;
- continue;
- }
-
- uint32_t flags = U32LE_AT(&data[4]);
- uint32_t offset = U32LE_AT(&data[8]);
- uint32_t chunkSize = U32LE_AT(&data[12]);
-
- if (chunkSize > track->mMaxSampleSize) {
- track->mMaxSampleSize = chunkSize;
- }
-
- track->mSamples.push();
-
- SampleInfo *info =
- &track->mSamples.editItemAt(track->mSamples.size() - 1);
-
- info->mOffset = offset;
- info->mIsKey = (flags & 0x10) != 0;
-
- if (info->mIsKey) {
- static const size_t kMaxNumSyncSamplesToScan = 20;
-
- if (track->mNumSyncSamples < kMaxNumSyncSamplesToScan) {
- if (chunkSize > track->mThumbnailSampleSize) {
- track->mThumbnailSampleSize = chunkSize;
-
- track->mThumbnailSampleIndex =
- track->mSamples.size() - 1;
- }
- }
-
- ++track->mNumSyncSamples;
- }
-
- data += 16;
- size -= 16;
- }
-
- if (!mTracks.isEmpty()) {
- off64_t offset;
- size_t size;
- bool isKey;
- int64_t timeUs;
- status_t err = getSampleInfo(0, 0, &offset, &size, &isKey, &timeUs);
-
- if (err != OK) {
- mOffsetsAreAbsolute = !mOffsetsAreAbsolute;
- err = getSampleInfo(0, 0, &offset, &size, &isKey, &timeUs);
-
- if (err != OK) {
- return err;
- }
- }
-
- ALOGV("Chunk offsets are %s",
- mOffsetsAreAbsolute ? "absolute" : "movie-chunk relative");
- }
-
- for (size_t i = 0; i < mTracks.size(); ++i) {
- Track *track = &mTracks.editItemAt(i);
-
- if (track->mBytesPerSample > 0) {
- // Assume all chunks are roughly the same size for now.
-
- // Compute the avg. size of the first 128 chunks (if there are
- // that many), but exclude the size of the first one, since
- // it may be an outlier.
- size_t numSamplesToAverage = track->mSamples.size();
- if (numSamplesToAverage > 256) {
- numSamplesToAverage = 256;
- }
-
- double avgChunkSize = 0;
- size_t j;
- for (j = 0; j <= numSamplesToAverage; ++j) {
- off64_t offset;
- size_t size;
- bool isKey;
- int64_t dummy;
-
- status_t err =
- getSampleInfo(
- i, j,
- &offset, &size, &isKey, &dummy);
-
- if (err != OK) {
- return err;
- }
-
- if (j == 0) {
- track->mFirstChunkSize = size;
- continue;
- }
-
- avgChunkSize += size;
- }
-
- avgChunkSize /= numSamplesToAverage;
-
- track->mAvgChunkSize = avgChunkSize;
- }
-
- int64_t durationUs;
- CHECK_EQ((status_t)OK,
- getSampleTime(i, track->mSamples.size() - 1, &durationUs));
-
- ALOGV("track %d duration = %.2f secs", i, durationUs / 1E6);
-
- track->mMeta->setInt64(kKeyDuration, durationUs);
- track->mMeta->setInt32(kKeyMaxInputSize, track->mMaxSampleSize);
-
- const char *tmp;
- CHECK(track->mMeta->findCString(kKeyMIMEType, &tmp));
-
- AString mime = tmp;
-
- if (!strncasecmp("video/", mime.c_str(), 6)) {
- if (track->mThumbnailSampleIndex >= 0) {
- int64_t thumbnailTimeUs;
- CHECK_EQ((status_t)OK,
- getSampleTime(i, track->mThumbnailSampleIndex,
- &thumbnailTimeUs));
-
- track->mMeta->setInt64(kKeyThumbnailTime, thumbnailTimeUs);
- }
-
- status_t err = OK;
-
- if (!strcasecmp(mime.c_str(), MEDIA_MIMETYPE_VIDEO_MPEG4)) {
- err = addMPEG4CodecSpecificData(i);
- } else if (!strcasecmp(mime.c_str(), MEDIA_MIMETYPE_VIDEO_AVC)) {
- err = addH264CodecSpecificData(i);
- }
-
- if (err != OK) {
- return err;
- }
- }
- }
-
- mFoundIndex = true;
-
- return OK;
-}
-
-static size_t GetSizeWidth(size_t x) {
- size_t n = 1;
- while (x > 127) {
- ++n;
- x >>= 7;
- }
- return n;
-}
-
-static uint8_t *EncodeSize(uint8_t *dst, size_t x) {
- while (x > 127) {
- *dst++ = (x & 0x7f) | 0x80;
- x >>= 7;
- }
- *dst++ = x;
- return dst;
-}
-
-sp<ABuffer> MakeMPEG4VideoCodecSpecificData(const sp<ABuffer> &config) {
- size_t len1 = config->size() + GetSizeWidth(config->size()) + 1;
- size_t len2 = len1 + GetSizeWidth(len1) + 1 + 13;
- size_t len3 = len2 + GetSizeWidth(len2) + 1 + 3;
-
- sp<ABuffer> csd = new ABuffer(len3);
- uint8_t *dst = csd->data();
- *dst++ = 0x03;
- dst = EncodeSize(dst, len2 + 3);
- *dst++ = 0x00; // ES_ID
- *dst++ = 0x00;
- *dst++ = 0x00; // streamDependenceFlag, URL_Flag, OCRstreamFlag
-
- *dst++ = 0x04;
- dst = EncodeSize(dst, len1 + 13);
- *dst++ = 0x01; // Video ISO/IEC 14496-2 Simple Profile
- for (size_t i = 0; i < 12; ++i) {
- *dst++ = 0x00;
- }
-
- *dst++ = 0x05;
- dst = EncodeSize(dst, config->size());
- memcpy(dst, config->data(), config->size());
- dst += config->size();
-
- // hexdump(csd->data(), csd->size());
-
- return csd;
-}
-
-status_t AVIExtractor::addMPEG4CodecSpecificData(size_t trackIndex) {
- Track *track = &mTracks.editItemAt(trackIndex);
-
- off64_t offset;
- size_t size;
- bool isKey;
- int64_t timeUs;
- status_t err =
- getSampleInfo(trackIndex, 0, &offset, &size, &isKey, &timeUs);
-
- if (err != OK) {
- return err;
- }
-
- sp<ABuffer> buffer = new ABuffer(size);
- ssize_t n = mDataSource->readAt(offset, buffer->data(), buffer->size());
-
- if (n < (ssize_t)size) {
- return n < 0 ? (status_t)n : ERROR_MALFORMED;
- }
-
- // Extract everything up to the first VOP start code from the first
- // frame's encoded data and use it to construct an ESDS with the
- // codec specific data.
-
- size_t i = 0;
- bool found = false;
- while (i + 3 < buffer->size()) {
- if (!memcmp("\x00\x00\x01\xb6", &buffer->data()[i], 4)) {
- found = true;
- break;
- }
-
- ++i;
- }
-
- if (!found) {
- return ERROR_MALFORMED;
- }
-
- buffer->setRange(0, i);
-
- sp<ABuffer> csd = MakeMPEG4VideoCodecSpecificData(buffer);
- track->mMeta->setData(kKeyESDS, kTypeESDS, csd->data(), csd->size());
-
- return OK;
-}
-
-status_t AVIExtractor::addH264CodecSpecificData(size_t trackIndex) {
- Track *track = &mTracks.editItemAt(trackIndex);
-
- off64_t offset;
- size_t size;
- bool isKey;
- int64_t timeUs;
-
- // Extract codec specific data from the first non-empty sample.
-
- size_t sampleIndex = 0;
- for (;;) {
- status_t err =
- getSampleInfo(
- trackIndex, sampleIndex, &offset, &size, &isKey, &timeUs);
-
- if (err != OK) {
- return err;
- }
-
- if (size > 0) {
- break;
- }
-
- ++sampleIndex;
- }
-
- sp<ABuffer> buffer = new ABuffer(size);
- ssize_t n = mDataSource->readAt(offset, buffer->data(), buffer->size());
-
- if (n < (ssize_t)size) {
- return n < 0 ? (status_t)n : ERROR_MALFORMED;
- }
-
- sp<MetaData> meta = MakeAVCCodecSpecificData(buffer);
-
- if (meta == NULL) {
- ALOGE("Unable to extract AVC codec specific data");
- return ERROR_MALFORMED;
- }
-
- int32_t width, height;
- CHECK(meta->findInt32(kKeyWidth, &width));
- CHECK(meta->findInt32(kKeyHeight, &height));
-
- uint32_t type;
- const void *csd;
- size_t csdSize;
- CHECK(meta->findData(kKeyAVCC, &type, &csd, &csdSize));
-
- track->mMeta->setInt32(kKeyWidth, width);
- track->mMeta->setInt32(kKeyHeight, height);
- track->mMeta->setData(kKeyAVCC, type, csd, csdSize);
-
- return OK;
-}
-
-status_t AVIExtractor::getSampleInfo(
- size_t trackIndex, size_t sampleIndex,
- off64_t *offset, size_t *size, bool *isKey,
- int64_t *sampleTimeUs) {
- if (trackIndex >= mTracks.size()) {
- return -ERANGE;
- }
-
- const Track &track = mTracks.itemAt(trackIndex);
-
- if (sampleIndex >= track.mSamples.size()) {
- return -ERANGE;
- }
-
- const SampleInfo &info = track.mSamples.itemAt(sampleIndex);
-
- if (!mOffsetsAreAbsolute) {
- *offset = info.mOffset + mMovieOffset + 8;
- } else {
- *offset = info.mOffset;
- }
-
- *size = 0;
-
- uint8_t tmp[8];
- ssize_t n = mDataSource->readAt(*offset, tmp, 8);
-
- if (n < 8) {
- return n < 0 ? (status_t)n : (status_t)ERROR_MALFORMED;
- }
-
- uint32_t chunkType = U32_AT(tmp);
-
- if (!IsCorrectChunkType(trackIndex, track.mKind, chunkType)) {
- return ERROR_MALFORMED;
- }
-
- *offset += 8;
- *size = U32LE_AT(&tmp[4]);
-
- *isKey = info.mIsKey;
-
- if (track.mBytesPerSample > 0) {
- size_t sampleStartInBytes;
- if (sampleIndex == 0) {
- sampleStartInBytes = 0;
- } else {
- sampleStartInBytes =
- track.mFirstChunkSize + track.mAvgChunkSize * (sampleIndex - 1);
- }
-
- sampleIndex = sampleStartInBytes / track.mBytesPerSample;
- }
-
- *sampleTimeUs = (sampleIndex * 1000000ll * track.mRate) / track.mScale;
-
- return OK;
-}
-
-status_t AVIExtractor::getSampleTime(
- size_t trackIndex, size_t sampleIndex, int64_t *sampleTimeUs) {
- off64_t offset;
- size_t size;
- bool isKey;
- return getSampleInfo(
- trackIndex, sampleIndex, &offset, &size, &isKey, sampleTimeUs);
-}
-
-status_t AVIExtractor::getSampleIndexAtTime(
- size_t trackIndex,
- int64_t timeUs, MediaSource::ReadOptions::SeekMode mode,
- size_t *sampleIndex) const {
- if (trackIndex >= mTracks.size()) {
- return -ERANGE;
- }
-
- const Track &track = mTracks.itemAt(trackIndex);
-
- ssize_t closestSampleIndex;
-
- if (track.mBytesPerSample > 0) {
- size_t closestByteOffset =
- (timeUs * track.mBytesPerSample)
- / track.mRate * track.mScale / 1000000ll;
-
- if (closestByteOffset <= track.mFirstChunkSize) {
- closestSampleIndex = 0;
- } else {
- closestSampleIndex =
- (closestByteOffset - track.mFirstChunkSize)
- / track.mAvgChunkSize;
- }
- } else {
- // Each chunk contains a single sample.
- closestSampleIndex = timeUs / track.mRate * track.mScale / 1000000ll;
- }
-
- ssize_t numSamples = track.mSamples.size();
-
- if (closestSampleIndex < 0) {
- closestSampleIndex = 0;
- } else if (closestSampleIndex >= numSamples) {
- closestSampleIndex = numSamples - 1;
- }
-
- if (mode == MediaSource::ReadOptions::SEEK_CLOSEST) {
- *sampleIndex = closestSampleIndex;
-
- return OK;
- }
-
- ssize_t prevSyncSampleIndex = closestSampleIndex;
- while (prevSyncSampleIndex >= 0) {
- const SampleInfo &info =
- track.mSamples.itemAt(prevSyncSampleIndex);
-
- if (info.mIsKey) {
- break;
- }
-
- --prevSyncSampleIndex;
- }
-
- ssize_t nextSyncSampleIndex = closestSampleIndex;
- while (nextSyncSampleIndex < numSamples) {
- const SampleInfo &info =
- track.mSamples.itemAt(nextSyncSampleIndex);
-
- if (info.mIsKey) {
- break;
- }
-
- ++nextSyncSampleIndex;
- }
-
- switch (mode) {
- case MediaSource::ReadOptions::SEEK_PREVIOUS_SYNC:
- {
- *sampleIndex = prevSyncSampleIndex;
-
- return prevSyncSampleIndex >= 0 ? OK : UNKNOWN_ERROR;
- }
-
- case MediaSource::ReadOptions::SEEK_NEXT_SYNC:
- {
- *sampleIndex = nextSyncSampleIndex;
-
- return nextSyncSampleIndex < numSamples ? OK : UNKNOWN_ERROR;
- }
-
- case MediaSource::ReadOptions::SEEK_CLOSEST_SYNC:
- {
- if (prevSyncSampleIndex < 0 && nextSyncSampleIndex >= numSamples) {
- return UNKNOWN_ERROR;
- }
-
- if (prevSyncSampleIndex < 0) {
- *sampleIndex = nextSyncSampleIndex;
- return OK;
- }
-
- if (nextSyncSampleIndex >= numSamples) {
- *sampleIndex = prevSyncSampleIndex;
- return OK;
- }
-
- size_t dist1 = closestSampleIndex - prevSyncSampleIndex;
- size_t dist2 = nextSyncSampleIndex - closestSampleIndex;
-
- *sampleIndex =
- (dist1 < dist2) ? prevSyncSampleIndex : nextSyncSampleIndex;
-
- return OK;
- }
-
- default:
- TRESPASS();
- break;
- }
-}
-
-bool SniffAVI(
- const sp<DataSource> &source, String8 *mimeType, float *confidence,
- sp<AMessage> *) {
- char tmp[12];
- if (source->readAt(0, tmp, 12) < 12) {
- return false;
- }
-
- if (!memcmp(tmp, "RIFF", 4) && !memcmp(&tmp[8], "AVI ", 4)) {
- mimeType->setTo(MEDIA_MIMETYPE_CONTAINER_AVI);
-
- // Just a tad over the mp3 extractor's confidence, since
- // these .avi files may contain .mp3 content that otherwise would
- // mistakenly lead to us identifying the entire file as a .mp3 file.
- *confidence = 0.21;
-
- return true;
- }
-
- return false;
-}
-
-} // namespace android
diff --git a/media/libstagefright/Android.bp b/media/libstagefright/Android.bp
index 81b4964..b764c98 100644
--- a/media/libstagefright/Android.bp
+++ b/media/libstagefright/Android.bp
@@ -17,6 +17,7 @@
"AudioPlayer.cpp",
"AudioSource.cpp",
"BufferImpl.cpp",
+ "CodecBase.cpp",
"CallbackDataSource.cpp",
"CameraSource.cpp",
"CameraSourceTimeLapse.cpp",
@@ -29,6 +30,7 @@
"FrameRenderTracker.cpp",
"HTTPBase.cpp",
"HevcUtils.cpp",
+ "ItemTable.cpp",
"JPEGSource.cpp",
"MP3Extractor.cpp",
"MPEG2TSWriter.cpp",
@@ -49,6 +51,7 @@
"NuCachedSource2.cpp",
"NuMediaExtractor.cpp",
"OMXClient.cpp",
+ "OmxInfoBuilder.cpp",
"OggExtractor.cpp",
"SampleIterator.cpp",
"SampleTable.cpp",
@@ -67,11 +70,6 @@
"avc_utils.cpp",
],
- include_dirs: [
- "frameworks/native/include/media/openmax",
- "frameworks/native/include/media/hardware",
- ],
-
shared_libs: [
"libaudioutils",
"libbinder",
@@ -93,15 +91,21 @@
"libutils",
"libvorbisidec",
"libmediadrm",
+ "libnativewindow",
"libmedia_helper",
+ "libstagefright_omx_utils",
"libstagefright_flacdec",
"libstagefright_foundation",
- "libdl",
+ "libstagefright_xmlparser",
"libRScpp",
"libhidlbase",
"libhidlmemory",
"android.hidl.allocator@1.0",
+ "android.hidl.memory@1.0",
+ "android.hidl.token@1.0-utils",
+ "android.hardware.cas@1.0",
+ "android.hardware.cas.native@1.0",
"android.hardware.media.omx@1.0",
],
@@ -110,7 +114,6 @@
"libyuv_static",
"libstagefright_matroska",
"libstagefright_mediafilter",
- "libstagefright_omx_utils",
"libstagefright_webm",
"libstagefright_timedtext",
"libvpx",
@@ -120,9 +123,12 @@
"libFLAC",
],
- export_shared_lib_headers: ["libmedia"],
+ export_shared_lib_headers: [
+ "libmedia",
+ "android.hidl.allocator@1.0",
+ ],
+
export_include_dirs: [
- ".",
"include",
],
@@ -169,4 +175,5 @@
"timedtext",
"webm",
"wifi-display",
+ "xmlparser",
]
diff --git a/media/libstagefright/CallbackDataSource.cpp b/media/libstagefright/CallbackDataSource.cpp
index 4309372..6dfe2de 100644
--- a/media/libstagefright/CallbackDataSource.cpp
+++ b/media/libstagefright/CallbackDataSource.cpp
@@ -127,10 +127,6 @@
}
ssize_t TinyCacheSource::readAt(off64_t offset, void* data, size_t size) {
- if (size >= kCacheSize) {
- return mSource->readAt(offset, data, size);
- }
-
// Check if the cache satisfies the read.
if (mCachedOffset <= offset
&& offset < (off64_t) (mCachedOffset + mCachedSize)) {
@@ -154,6 +150,9 @@
}
}
+ if (size >= kCacheSize) {
+ return mSource->readAt(offset, data, size);
+ }
// Fill the cache and copy to the caller.
const ssize_t numRead = mSource->readAt(offset, mCache, kCacheSize);
diff --git a/media/libstagefright/CodecBase.cpp b/media/libstagefright/CodecBase.cpp
new file mode 100644
index 0000000..d0610b2
--- /dev/null
+++ b/media/libstagefright/CodecBase.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2017, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "CodecBase"
+
+#include <android/hardware/cas/native/1.0/IDescrambler.h>
+#include <media/ICrypto.h>
+#include <media/stagefright/CodecBase.h>
+#include <utils/Log.h>
+
+namespace android {
+
+void BufferChannelBase::setCrypto(const sp<ICrypto> &crypto) {
+ mCrypto = crypto;
+}
+
+void BufferChannelBase::setDescrambler(const sp<IDescrambler> &descrambler) {
+ mDescrambler = descrambler;
+}
+
+} // namespace android
diff --git a/media/libstagefright/DataSource.cpp b/media/libstagefright/DataSource.cpp
index a5760d1..c22053e 100644
--- a/media/libstagefright/DataSource.cpp
+++ b/media/libstagefright/DataSource.cpp
@@ -92,6 +92,48 @@
return true;
}
+bool DataSource::getUInt16Var(off64_t offset, uint16_t *x, size_t size) {
+ if (size == 2) {
+ return getUInt16(offset, x);
+ }
+ if (size == 1) {
+ uint8_t tmp;
+ if (readAt(offset, &tmp, 1) == 1) {
+ *x = tmp;
+ return true;
+ }
+ }
+ return false;
+}
+
+bool DataSource::getUInt32Var(off64_t offset, uint32_t *x, size_t size) {
+ if (size == 4) {
+ return getUInt32(offset, x);
+ }
+ if (size == 2) {
+ uint16_t tmp;
+ if (getUInt16(offset, &tmp)) {
+ *x = tmp;
+ return true;
+ }
+ }
+ return false;
+}
+
+bool DataSource::getUInt64Var(off64_t offset, uint64_t *x, size_t size) {
+ if (size == 8) {
+ return getUInt64(offset, x);
+ }
+ if (size == 4) {
+ uint32_t tmp;
+ if (getUInt32(offset, &tmp)) {
+ *x = tmp;
+ return true;
+ }
+ }
+ return false;
+}
+
status_t DataSource::getSize(off64_t *size) {
*size = 0;
diff --git a/media/libstagefright/FrameRenderTracker.cpp b/media/libstagefright/FrameRenderTracker.cpp
index 917870f..1aa3bad 100644
--- a/media/libstagefright/FrameRenderTracker.cpp
+++ b/media/libstagefright/FrameRenderTracker.cpp
@@ -88,7 +88,9 @@
status_t FrameRenderTracker::onFrameRendered(int64_t mediaTimeUs, nsecs_t systemNano) {
// ensure monotonic timestamps
- if (mLastRenderTimeNs >= systemNano) {
+ if (mLastRenderTimeNs > systemNano ||
+ // EOS is normally marked on the last frame
+ (mLastRenderTimeNs == systemNano && mediaTimeUs != INT64_MAX)) {
ALOGW("[%s] Ignoring out of order/stale system nano %lld for media time %lld from codec.",
mComponentName.c_str(), (long long)systemNano, (long long)mediaTimeUs);
return BAD_VALUE;
diff --git a/media/libstagefright/ItemTable.cpp b/media/libstagefright/ItemTable.cpp
new file mode 100644
index 0000000..7bc4f3c
--- /dev/null
+++ b/media/libstagefright/ItemTable.cpp
@@ -0,0 +1,1560 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "ItemTable"
+
+#include <include/ItemTable.h>
+#include <media/MediaDefs.h>
+#include <media/stagefright/DataSource.h>
+#include <media/stagefright/MetaData.h>
+#include <media/stagefright/MediaErrors.h>
+#include <media/stagefright/Utils.h>
+#include <media/stagefright/foundation/ABuffer.h>
+#include <media/stagefright/foundation/hexdump.h>
+#include <utils/Log.h>
+
+namespace android {
+
+namespace heif {
+
+/////////////////////////////////////////////////////////////////////
+//
+// struct to keep track of one image item
+//
+
+struct ImageItem {
+ friend struct ItemReference;
+ friend struct ItemProperty;
+
+ ImageItem() : ImageItem(0) {}
+ ImageItem(uint32_t _type) : type(_type),
+ rows(0), columns(0), width(0), height(0), rotation(0),
+ offset(0), size(0), nextTileIndex(0) {}
+
+ bool isGrid() const {
+ return type == FOURCC('g', 'r', 'i', 'd');
+ }
+
+ status_t getNextTileItemId(uint32_t *nextTileItemId, bool reset) {
+ if (reset) {
+ nextTileIndex = 0;
+ }
+ if (nextTileIndex >= dimgRefs.size()) {
+ return ERROR_END_OF_STREAM;
+ }
+ *nextTileItemId = dimgRefs[nextTileIndex++];
+ return OK;
+ }
+
+ uint32_t type;
+ int32_t rows;
+ int32_t columns;
+ int32_t width;
+ int32_t height;
+ int32_t rotation;
+ off64_t offset;
+ size_t size;
+ sp<ABuffer> hvcc;
+ sp<ABuffer> icc;
+
+ Vector<uint32_t> thumbnails;
+ Vector<uint32_t> dimgRefs;
+ size_t nextTileIndex;
+};
+
+
+/////////////////////////////////////////////////////////////////////
+//
+// ISO boxes
+//
+
+struct Box {
+protected:
+ Box(const sp<DataSource> source, uint32_t type) :
+ mDataSource(source), mType(type) {}
+
+ virtual ~Box() {}
+
+ virtual status_t onChunkData(
+ uint32_t /*type*/, off64_t /*offset*/, size_t /*size*/) {
+ return OK;
+ }
+
+ inline uint32_t type() const { return mType; }
+
+ inline sp<DataSource> source() const { return mDataSource; }
+
+ status_t parseChunk(off64_t *offset);
+
+ status_t parseChunks(off64_t offset, size_t size);
+
+private:
+ sp<DataSource> mDataSource;
+ uint32_t mType;
+};
+
+status_t Box::parseChunk(off64_t *offset) {
+ if (*offset < 0) {
+ ALOGE("b/23540914");
+ return ERROR_MALFORMED;
+ }
+ uint32_t hdr[2];
+ if (mDataSource->readAt(*offset, hdr, 8) < 8) {
+ return ERROR_IO;
+ }
+ uint64_t chunk_size = ntohl(hdr[0]);
+ int32_t chunk_type = ntohl(hdr[1]);
+ off64_t data_offset = *offset + 8;
+
+ if (chunk_size == 1) {
+ if (mDataSource->readAt(*offset + 8, &chunk_size, 8) < 8) {
+ return ERROR_IO;
+ }
+ chunk_size = ntoh64(chunk_size);
+ data_offset += 8;
+
+ if (chunk_size < 16) {
+ // The smallest valid chunk is 16 bytes long in this case.
+ return ERROR_MALFORMED;
+ }
+ } else if (chunk_size == 0) {
+ // This shouldn't happen since we should never be top level
+ ALOGE("invalid chunk size 0 for non-top level box");
+ return ERROR_MALFORMED;
+ } else if (chunk_size < 8) {
+ // The smallest valid chunk is 8 bytes long.
+ ALOGE("invalid chunk size: %lld", (long long)chunk_size);
+ return ERROR_MALFORMED;
+ }
+
+ char chunk[5];
+ MakeFourCCString(chunk_type, chunk);
+ ALOGV("chunk: %s @ %lld", chunk, (long long)*offset);
+
+ off64_t chunk_data_size = chunk_size - (data_offset - *offset);
+ if (chunk_data_size < 0) {
+ ALOGE("b/23540914");
+ return ERROR_MALFORMED;
+ }
+
+ status_t err = onChunkData(chunk_type, data_offset, chunk_data_size);
+
+ if (err != OK) {
+ return err;
+ }
+ *offset += chunk_size;
+ return OK;
+}
+
+status_t Box::parseChunks(off64_t offset, size_t size) {
+ off64_t stopOffset = offset + size;
+ while (offset < stopOffset) {
+ status_t err = parseChunk(&offset);
+ if (err != OK) {
+ return err;
+ }
+ }
+ if (offset != stopOffset) {
+ return ERROR_MALFORMED;
+ }
+ return OK;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+struct FullBox : public Box {
+protected:
+ FullBox(const sp<DataSource> source, uint32_t type) :
+ Box(source, type), mVersion(0), mFlags(0) {}
+
+ inline uint8_t version() const { return mVersion; }
+
+ inline uint32_t flags() const { return mFlags; }
+
+ status_t parseFullBoxHeader(off64_t *offset, size_t *size);
+
+private:
+ uint8_t mVersion;
+ uint32_t mFlags;
+};
+
+status_t FullBox::parseFullBoxHeader(off64_t *offset, size_t *size) {
+ if (*size < 4) {
+ return ERROR_MALFORMED;
+ }
+ if (!source()->readAt(*offset, &mVersion, 1)) {
+ return ERROR_IO;
+ }
+ if (!source()->getUInt24(*offset + 1, &mFlags)) {
+ return ERROR_IO;
+ }
+ *offset += 4;
+ *size -= 4;
+ return OK;
+}
+
+/////////////////////////////////////////////////////////////////////
+//
+// PrimaryImage box
+//
+
+struct PitmBox : public FullBox {
+ PitmBox(const sp<DataSource> source) :
+ FullBox(source, FOURCC('p', 'i', 't', 'm')) {}
+
+ status_t parse(off64_t offset, size_t size, uint32_t *primaryItemId);
+};
+
+status_t PitmBox::parse(off64_t offset, size_t size, uint32_t *primaryItemId) {
+ status_t err = parseFullBoxHeader(&offset, &size);
+ if (err != OK) {
+ return err;
+ }
+
+ size_t itemIdSize = (version() == 0) ? 2 : 4;
+ if (size < itemIdSize) {
+ return ERROR_MALFORMED;
+ }
+ uint32_t itemId;
+ if (!source()->getUInt32Var(offset, &itemId, itemIdSize)) {
+ return ERROR_IO;
+ }
+
+ ALOGV("primary id %d", itemId);
+ *primaryItemId = itemId;
+
+ return OK;
+}
+
+/////////////////////////////////////////////////////////////////////
+//
+// ItemLocation related boxes
+//
+
+struct ExtentEntry {
+ uint64_t extentIndex;
+ uint64_t extentOffset;
+ uint64_t extentLength;
+};
+
+struct ItemLoc {
+ ItemLoc() : ItemLoc(0, 0, 0, 0) {}
+ ItemLoc(uint32_t item_id, uint16_t construction_method,
+ uint16_t data_reference_index, uint64_t base_offset) :
+ itemId(item_id),
+ constructionMethod(construction_method),
+ dataReferenceIndex(data_reference_index),
+ baseOffset(base_offset) {}
+
+ void addExtent(const ExtentEntry& extent) {
+ extents.push_back(extent);
+ }
+
+ status_t getLoc(off64_t *offset, size_t *size,
+ off64_t idatOffset, size_t idatSize) const {
+ // TODO: fix extent handling, fix constructionMethod = 2
+ CHECK(extents.size() == 1);
+ if (constructionMethod == 0) {
+ *offset = baseOffset + extents[0].extentOffset;
+ *size = extents[0].extentLength;
+ return OK;
+ } else if (constructionMethod == 1) {
+ if (baseOffset + extents[0].extentOffset + extents[0].extentLength
+ > idatSize) {
+ return ERROR_MALFORMED;
+ }
+ *offset = baseOffset + extents[0].extentOffset + idatOffset;
+ *size = extents[0].extentLength;
+ return OK;
+ }
+ return ERROR_UNSUPPORTED;
+ }
+
+ // parsed info
+ uint32_t itemId;
+ uint16_t constructionMethod;
+ uint16_t dataReferenceIndex;
+ off64_t baseOffset;
+ Vector<ExtentEntry> extents;
+};
+
+struct IlocBox : public FullBox {
+ IlocBox(const sp<DataSource> source, KeyedVector<uint32_t, ItemLoc> *itemLocs) :
+ FullBox(source, FOURCC('i', 'l', 'o', 'c')),
+ mItemLocs(itemLocs), mHasConstructMethod1(false) {}
+
+ status_t parse(off64_t offset, size_t size);
+
+ bool hasConstructMethod1() { return mHasConstructMethod1; }
+
+private:
+ static bool isSizeFieldValid(uint32_t offset_size) {
+ return offset_size == 0 || offset_size == 4 || offset_size == 8;
+ }
+ KeyedVector<uint32_t, ItemLoc> *mItemLocs;
+ bool mHasConstructMethod1;
+};
+
+status_t IlocBox::parse(off64_t offset, size_t size) {
+ status_t err = parseFullBoxHeader(&offset, &size);
+ if (err != OK) {
+ return err;
+ }
+ if (version() > 2) {
+ ALOGE("%s: invalid version %d", __FUNCTION__, version());
+ return ERROR_MALFORMED;
+ }
+
+ if (size < 2) {
+ return ERROR_MALFORMED;
+ }
+ uint8_t offset_size;
+ if (!source()->readAt(offset++, &offset_size, 1)) {
+ return ERROR_IO;
+ }
+ uint8_t length_size = (offset_size & 0xF);
+ offset_size >>= 4;
+
+ uint8_t base_offset_size;
+ if (!source()->readAt(offset++, &base_offset_size, 1)) {
+ return ERROR_IO;
+ }
+ uint8_t index_size = 0;
+ if (version() == 1 || version() == 2) {
+ index_size = (base_offset_size & 0xF);
+ }
+ base_offset_size >>= 4;
+ size -= 2;
+
+ if (!isSizeFieldValid(offset_size)
+ || !isSizeFieldValid(length_size)
+ || !isSizeFieldValid(base_offset_size)
+ || !isSizeFieldValid((index_size))) {
+ ALOGE("%s: offset size not valid: %d, %d, %d, %d", __FUNCTION__,
+ offset_size, length_size, base_offset_size, index_size);
+ return ERROR_MALFORMED;
+ }
+
+ uint32_t item_count;
+ size_t itemFieldSize = version() < 2 ? 2 : 4;
+ if (size < itemFieldSize) {
+ return ERROR_MALFORMED;
+ }
+ if (!source()->getUInt32Var(offset, &item_count, itemFieldSize)) {
+ return ERROR_IO;
+ }
+
+ ALOGV("item_count %lld", (long long) item_count);
+ offset += itemFieldSize;
+ size -= itemFieldSize;
+
+ for (size_t i = 0; i < item_count; i++) {
+ uint32_t item_id;
+ if (!source()->getUInt32Var(offset, &item_id, itemFieldSize)) {
+ return ERROR_IO;
+ }
+ ALOGV("item[%zu]: id %lld", i, (long long)item_id);
+ offset += itemFieldSize;
+
+ uint8_t construction_method = 0;
+ if (version() == 1 || version() == 2) {
+ uint8_t buf[2];
+ if (!source()->readAt(offset, buf, 2)) {
+ return ERROR_IO;
+ }
+ construction_method = (buf[1] & 0xF);
+ ALOGV("construction_method %d", construction_method);
+ if (construction_method == 1) {
+ mHasConstructMethod1 = true;
+ }
+
+ offset += 2;
+ }
+
+ uint16_t data_reference_index;
+ if (!source()->getUInt16(offset, &data_reference_index)) {
+ return ERROR_IO;
+ }
+ ALOGV("data_reference_index %d", data_reference_index);
+ if (data_reference_index != 0) {
+ // we don't support reference to other files
+ return ERROR_UNSUPPORTED;
+ }
+ offset += 2;
+
+ uint64_t base_offset = 0;
+ if (base_offset_size != 0) {
+ if (!source()->getUInt64Var(offset, &base_offset, base_offset_size)) {
+ return ERROR_IO;
+ }
+ offset += base_offset_size;
+ }
+ ALOGV("base_offset %lld", (long long) base_offset);
+
+ ssize_t index = mItemLocs->add(item_id, ItemLoc(
+ item_id, construction_method, data_reference_index, base_offset));
+ ItemLoc &item = mItemLocs->editValueAt(index);
+
+ uint16_t extent_count;
+ if (!source()->getUInt16(offset, &extent_count)) {
+ return ERROR_IO;
+ }
+ ALOGV("extent_count %d", extent_count);
+
+ if (extent_count > 1 && (offset_size == 0 || length_size == 0)) {
+ // if the item is dividec into more than one extents, offset and
+ // length must be present.
+ return ERROR_MALFORMED;
+ }
+ offset += 2;
+
+ for (size_t j = 0; j < extent_count; j++) {
+ uint64_t extent_index = 1; // default=1
+ if ((version() == 1 || version() == 2) && (index_size > 0)) {
+ if (!source()->getUInt64Var(offset, &extent_index, index_size)) {
+ return ERROR_IO;
+ }
+ // TODO: add support for this mode
+ offset += index_size;
+ ALOGV("extent_index %lld", (long long)extent_index);
+ }
+
+ uint64_t extent_offset = 0; // default=0
+ if (offset_size > 0) {
+ if (!source()->getUInt64Var(offset, &extent_offset, offset_size)) {
+ return ERROR_IO;
+ }
+ offset += offset_size;
+ }
+ ALOGV("extent_offset %lld", (long long)extent_offset);
+
+ uint64_t extent_length = 0; // this indicates full length of file
+ if (length_size > 0) {
+ if (!source()->getUInt64Var(offset, &extent_length, length_size)) {
+ return ERROR_IO;
+ }
+ offset += length_size;
+ }
+ ALOGV("extent_length %lld", (long long)extent_length);
+
+ item.addExtent({ extent_index, extent_offset, extent_length });
+ }
+ }
+ return OK;
+}
+
+/////////////////////////////////////////////////////////////////////
+//
+// ItemReference related boxes
+//
+
+struct ItemReference : public Box, public RefBase {
+ ItemReference(const sp<DataSource> source, uint32_t type, uint32_t itemIdSize) :
+ Box(source, type), mItemId(0), mRefIdSize(itemIdSize) {}
+
+ status_t parse(off64_t offset, size_t size);
+
+ uint32_t itemId() { return mItemId; }
+
+ void apply(KeyedVector<uint32_t, ImageItem> &itemIdToImageMap) const {
+ ssize_t imageIndex = itemIdToImageMap.indexOfKey(mItemId);
+
+ // ignore non-image items
+ if (imageIndex < 0) {
+ return;
+ }
+
+ ALOGV("attach reference type 0x%x to item id %d)", type(), mItemId);
+
+ if (type() == FOURCC('d', 'i', 'm', 'g')) {
+ ImageItem &image = itemIdToImageMap.editValueAt(imageIndex);
+ if (!image.dimgRefs.empty()) {
+ ALOGW("dimgRefs if not clean!");
+ }
+ image.dimgRefs.appendVector(mRefs);
+ } else if (type() == FOURCC('t', 'h', 'm', 'b')) {
+ for (size_t i = 0; i < mRefs.size(); i++) {
+ imageIndex = itemIdToImageMap.indexOfKey(mRefs[i]);
+
+ // ignore non-image items
+ if (imageIndex < 0) {
+ continue;
+ }
+ ALOGV("Image item id %d uses thumbnail item id %d", mRefs[i], mItemId);
+ ImageItem &image = itemIdToImageMap.editValueAt(imageIndex);
+ if (!image.thumbnails.empty()) {
+ ALOGW("already has thumbnails!");
+ }
+ image.thumbnails.push_back(mItemId);
+ }
+ } else {
+ ALOGW("ignoring unsupported ref type 0x%x", type());
+ }
+ }
+
+private:
+ uint32_t mItemId;
+ uint32_t mRefIdSize;
+ Vector<uint32_t> mRefs;
+
+ DISALLOW_EVIL_CONSTRUCTORS(ItemReference);
+};
+
+status_t ItemReference::parse(off64_t offset, size_t size) {
+ if (size < mRefIdSize + 2) {
+ return ERROR_MALFORMED;
+ }
+ if (!source()->getUInt32Var(offset, &mItemId, mRefIdSize)) {
+ return ERROR_IO;
+ }
+ offset += mRefIdSize;
+
+ uint16_t count;
+ if (!source()->getUInt16(offset, &count)) {
+ return ERROR_IO;
+ }
+ offset += 2;
+ size -= (mRefIdSize + 2);
+
+ if (size < count * mRefIdSize) {
+ return ERROR_MALFORMED;
+ }
+
+ for (size_t i = 0; i < count; i++) {
+ uint32_t refItemId;
+ if (!source()->getUInt32Var(offset, &refItemId, mRefIdSize)) {
+ return ERROR_IO;
+ }
+ offset += mRefIdSize;
+ mRefs.push_back(refItemId);
+ ALOGV("item id %d: referencing item id %d", mItemId, refItemId);
+ }
+
+ return OK;
+}
+
+struct IrefBox : public FullBox {
+ IrefBox(const sp<DataSource> source, Vector<sp<ItemReference> > *itemRefs) :
+ FullBox(source, FOURCC('i', 'r', 'e', 'f')), mRefIdSize(0), mItemRefs(itemRefs) {}
+
+ status_t parse(off64_t offset, size_t size);
+
+protected:
+ status_t onChunkData(uint32_t type, off64_t offset, size_t size) override;
+
+private:
+ uint32_t mRefIdSize;
+ Vector<sp<ItemReference> > *mItemRefs;
+};
+
+status_t IrefBox::parse(off64_t offset, size_t size) {
+ ALOGV("%s: offset %lld, size %zu", __FUNCTION__, (long long)offset, size);
+ status_t err = parseFullBoxHeader(&offset, &size);
+ if (err != OK) {
+ return err;
+ }
+
+ mRefIdSize = (version() == 0) ? 2 : 4;
+ return parseChunks(offset, size);
+}
+
+status_t IrefBox::onChunkData(uint32_t type, off64_t offset, size_t size) {
+ sp<ItemReference> itemRef = new ItemReference(source(), type, mRefIdSize);
+
+ status_t err = itemRef->parse(offset, size);
+ if (err != OK) {
+ return err;
+ }
+ mItemRefs->push_back(itemRef);
+ return OK;
+}
+
+/////////////////////////////////////////////////////////////////////
+//
+// ItemProperty related boxes
+//
+
+struct AssociationEntry {
+ uint32_t itemId;
+ bool essential;
+ uint16_t index;
+};
+
+struct ItemProperty : public RefBase {
+ ItemProperty() {}
+
+ virtual void attachTo(ImageItem &/*image*/) const {
+ ALOGW("Unrecognized property");
+ }
+ virtual status_t parse(off64_t /*offset*/, size_t /*size*/) {
+ ALOGW("Unrecognized property");
+ return OK;
+ }
+
+private:
+ DISALLOW_EVIL_CONSTRUCTORS(ItemProperty);
+};
+
+struct IspeBox : public FullBox, public ItemProperty {
+ IspeBox(const sp<DataSource> source) :
+ FullBox(source, FOURCC('i', 's', 'p', 'e')), mWidth(0), mHeight(0) {}
+
+ status_t parse(off64_t offset, size_t size) override;
+
+ void attachTo(ImageItem &image) const override {
+ image.width = mWidth;
+ image.height = mHeight;
+ }
+
+private:
+ uint32_t mWidth;
+ uint32_t mHeight;
+};
+
+status_t IspeBox::parse(off64_t offset, size_t size) {
+ ALOGV("%s: offset %lld, size %zu", __FUNCTION__, (long long)offset, size);
+
+ status_t err = parseFullBoxHeader(&offset, &size);
+ if (err != OK) {
+ return err;
+ }
+
+ if (size < 8) {
+ return ERROR_MALFORMED;
+ }
+ if (!source()->getUInt32(offset, &mWidth)
+ || !source()->getUInt32(offset + 4, &mHeight)) {
+ return ERROR_IO;
+ }
+ ALOGV("property ispe: %dx%d", mWidth, mHeight);
+
+ return OK;
+}
+
+struct HvccBox : public Box, public ItemProperty {
+ HvccBox(const sp<DataSource> source) :
+ Box(source, FOURCC('h', 'v', 'c', 'C')) {}
+
+ status_t parse(off64_t offset, size_t size) override;
+
+ void attachTo(ImageItem &image) const override {
+ image.hvcc = mHVCC;
+ }
+
+private:
+ sp<ABuffer> mHVCC;
+};
+
+status_t HvccBox::parse(off64_t offset, size_t size) {
+ ALOGV("%s: offset %lld, size %zu", __FUNCTION__, (long long)offset, size);
+
+ mHVCC = new ABuffer(size);
+
+ if (mHVCC->data() == NULL) {
+ ALOGE("b/28471206");
+ return NO_MEMORY;
+ }
+
+ if (source()->readAt(offset, mHVCC->data(), size) < (ssize_t)size) {
+ return ERROR_IO;
+ }
+
+ ALOGV("property hvcC");
+
+ return OK;
+}
+
+struct IrotBox : public Box, public ItemProperty {
+ IrotBox(const sp<DataSource> source) :
+ Box(source, FOURCC('i', 'r', 'o', 't')), mAngle(0) {}
+
+ status_t parse(off64_t offset, size_t size) override;
+
+ void attachTo(ImageItem &image) const override {
+ image.rotation = mAngle * 90;
+ }
+
+private:
+ uint8_t mAngle;
+};
+
+status_t IrotBox::parse(off64_t offset, size_t size) {
+ ALOGV("%s: offset %lld, size %zu", __FUNCTION__, (long long)offset, size);
+
+ if (size < 1) {
+ return ERROR_MALFORMED;
+ }
+ if (source()->readAt(offset, &mAngle, 1) != 1) {
+ return ERROR_IO;
+ }
+ mAngle &= 0x3;
+ ALOGV("property irot: %d", mAngle);
+
+ return OK;
+}
+
+struct ColrBox : public Box, public ItemProperty {
+ ColrBox(const sp<DataSource> source) :
+ Box(source, FOURCC('c', 'o', 'l', 'r')) {}
+
+ status_t parse(off64_t offset, size_t size) override;
+
+ void attachTo(ImageItem &image) const override {
+ image.icc = mICCData;
+ }
+
+private:
+ sp<ABuffer> mICCData;
+};
+
+status_t ColrBox::parse(off64_t offset, size_t size) {
+ ALOGV("%s: offset %lld, size %zu", __FUNCTION__, (long long)offset, size);
+
+ if (size < 4) {
+ return ERROR_MALFORMED;
+ }
+ uint32_t colour_type;
+ if (!source()->getUInt32(offset, &colour_type)) {
+ return ERROR_IO;
+ }
+ offset += 4;
+ size -= 4;
+ if (colour_type == FOURCC('n', 'c', 'l', 'x')) {
+ return OK;
+ }
+ if ((colour_type != FOURCC('r', 'I', 'C', 'C')) &&
+ (colour_type != FOURCC('p', 'r', 'o', 'f'))) {
+ return ERROR_MALFORMED;
+ }
+
+ mICCData = new ABuffer(size);
+ if (mICCData->data() == NULL) {
+ ALOGE("b/28471206");
+ return NO_MEMORY;
+ }
+
+ if (source()->readAt(offset, mICCData->data(), size) != (ssize_t)size) {
+ return ERROR_IO;
+ }
+
+ ALOGV("property Colr: size %zd", size);
+ return OK;
+}
+
+struct IpmaBox : public FullBox {
+ IpmaBox(const sp<DataSource> source, Vector<AssociationEntry> *associations) :
+ FullBox(source, FOURCC('i', 'p', 'm', 'a')), mAssociations(associations) {}
+
+ status_t parse(off64_t offset, size_t size);
+private:
+ Vector<AssociationEntry> *mAssociations;
+};
+
+status_t IpmaBox::parse(off64_t offset, size_t size) {
+ status_t err = parseFullBoxHeader(&offset, &size);
+ if (err != OK) {
+ return err;
+ }
+
+ if (size < 4) {
+ return ERROR_MALFORMED;
+ }
+ uint32_t entryCount;
+ if (!source()->getUInt32(offset, &entryCount)) {
+ return ERROR_IO;
+ }
+ offset += 4;
+ size -= 4;
+
+ for (size_t k = 0; k < entryCount; ++k) {
+ uint32_t itemId = 0;
+ size_t itemIdSize = (version() < 1) ? 2 : 4;
+
+ if (size < itemIdSize + 1) {
+ return ERROR_MALFORMED;
+ }
+
+ if (!source()->getUInt32Var(offset, &itemId, itemIdSize)) {
+ return ERROR_IO;
+ }
+ offset += itemIdSize;
+ size -= itemIdSize;
+
+ uint8_t associationCount;
+ if (!source()->readAt(offset, &associationCount, 1)) {
+ return ERROR_IO;
+ }
+ offset++;
+ size--;
+
+ for (size_t i = 0; i < associationCount; ++i) {
+ size_t propIndexSize = (flags() & 1) ? 2 : 1;
+ if (size < propIndexSize) {
+ return ERROR_MALFORMED;
+ }
+ uint16_t propIndex;
+ if (!source()->getUInt16Var(offset, &propIndex, propIndexSize)) {
+ return ERROR_IO;
+ }
+ offset += propIndexSize;
+ size -= propIndexSize;
+ uint16_t bitmask = (1 << (8 * propIndexSize - 1));
+ AssociationEntry entry = {
+ .itemId = itemId,
+ .essential = !!(propIndex & bitmask),
+ .index = (uint16_t) (propIndex & ~bitmask)
+ };
+
+ ALOGV("item id %d associated to property %d (essential %d)",
+ itemId, entry.index, entry.essential);
+
+ mAssociations->push_back(entry);
+ }
+ }
+
+ return OK;
+}
+
+struct IpcoBox : public Box {
+ IpcoBox(const sp<DataSource> source, Vector<sp<ItemProperty> > *properties) :
+ Box(source, FOURCC('i', 'p', 'c', 'o')), mItemProperties(properties) {}
+
+ status_t parse(off64_t offset, size_t size);
+protected:
+ status_t onChunkData(uint32_t type, off64_t offset, size_t size) override;
+
+private:
+ Vector<sp<ItemProperty> > *mItemProperties;
+};
+
+status_t IpcoBox::parse(off64_t offset, size_t size) {
+ ALOGV("%s: offset %lld, size %zu", __FUNCTION__, (long long)offset, size);
+ // push dummy as the index is 1-based
+ mItemProperties->push_back(new ItemProperty());
+ return parseChunks(offset, size);
+}
+
+status_t IpcoBox::onChunkData(uint32_t type, off64_t offset, size_t size) {
+ sp<ItemProperty> itemProperty;
+ switch(type) {
+ case FOURCC('h', 'v', 'c', 'C'):
+ {
+ itemProperty = new HvccBox(source());
+ break;
+ }
+ case FOURCC('i', 's', 'p', 'e'):
+ {
+ itemProperty = new IspeBox(source());
+ break;
+ }
+ case FOURCC('i', 'r', 'o', 't'):
+ {
+ itemProperty = new IrotBox(source());
+ break;
+ }
+ case FOURCC('c', 'o', 'l', 'r'):
+ {
+ itemProperty = new ColrBox(source());
+ break;
+ }
+ default:
+ {
+ // push dummy to maintain correct item property index
+ itemProperty = new ItemProperty();
+ break;
+ }
+ }
+ status_t err = itemProperty->parse(offset, size);
+ if (err != OK) {
+ return err;
+ }
+ mItemProperties->push_back(itemProperty);
+ return OK;
+}
+
+struct IprpBox : public Box {
+ IprpBox(const sp<DataSource> source,
+ Vector<sp<ItemProperty> > *properties,
+ Vector<AssociationEntry> *associations) :
+ Box(source, FOURCC('i', 'p', 'r', 'p')),
+ mProperties(properties), mAssociations(associations) {}
+
+ status_t parse(off64_t offset, size_t size);
+protected:
+ status_t onChunkData(uint32_t type, off64_t offset, size_t size) override;
+
+private:
+ Vector<sp<ItemProperty> > *mProperties;
+ Vector<AssociationEntry> *mAssociations;
+};
+
+status_t IprpBox::parse(off64_t offset, size_t size) {
+ ALOGV("%s: offset %lld, size %zu", __FUNCTION__, (long long)offset, size);
+
+ status_t err = parseChunks(offset, size);
+ if (err != OK) {
+ return err;
+ }
+ return OK;
+}
+
+status_t IprpBox::onChunkData(uint32_t type, off64_t offset, size_t size) {
+ switch(type) {
+ case FOURCC('i', 'p', 'c', 'o'):
+ {
+ IpcoBox ipcoBox(source(), mProperties);
+ return ipcoBox.parse(offset, size);
+ }
+ case FOURCC('i', 'p', 'm', 'a'):
+ {
+ IpmaBox ipmaBox(source(), mAssociations);
+ return ipmaBox.parse(offset, size);
+ }
+ default:
+ {
+ ALOGW("Unrecognized box.");
+ break;
+ }
+ }
+ return OK;
+}
+
+/////////////////////////////////////////////////////////////////////
+//
+// ItemInfo related boxes
+//
+struct ItemInfo {
+ uint32_t itemId;
+ uint32_t itemType;
+};
+
+struct InfeBox : public FullBox {
+ InfeBox(const sp<DataSource> source) :
+ FullBox(source, FOURCC('i', 'n', 'f', 'e')) {}
+
+ status_t parse(off64_t offset, size_t size, ItemInfo *itemInfo);
+
+private:
+ bool parseNullTerminatedString(off64_t *offset, size_t *size, String8 *out);
+};
+
+bool InfeBox::parseNullTerminatedString(
+ off64_t *offset, size_t *size, String8 *out) {
+ char tmp[256];
+ size_t len = 0;
+ off64_t newOffset = *offset;
+ off64_t stopOffset = *offset + *size;
+ while (newOffset < stopOffset) {
+ if (!source()->readAt(newOffset++, &tmp[len], 1)) {
+ return false;
+ }
+ if (tmp[len] == 0) {
+ out->append(tmp, len);
+
+ *offset = newOffset;
+ *size = stopOffset - newOffset;
+
+ return true;
+ }
+ if (++len >= sizeof(tmp)) {
+ out->append(tmp, len);
+ len = 0;
+ }
+ }
+ return false;
+}
+
+status_t InfeBox::parse(off64_t offset, size_t size, ItemInfo *itemInfo) {
+ status_t err = parseFullBoxHeader(&offset, &size);
+ if (err != OK) {
+ return err;
+ }
+
+ if (version() == 0 || version() == 1) {
+ if (size < 4) {
+ return ERROR_MALFORMED;
+ }
+ uint16_t item_id;
+ if (!source()->getUInt16(offset, &item_id)) {
+ return ERROR_IO;
+ }
+ ALOGV("item_id %d", item_id);
+ uint16_t item_protection_index;
+ if (!source()->getUInt16(offset + 2, &item_protection_index)) {
+ return ERROR_IO;
+ }
+ offset += 4;
+ size -= 4;
+
+ String8 item_name;
+ if (!parseNullTerminatedString(&offset, &size, &item_name)) {
+ return ERROR_MALFORMED;
+ }
+
+ String8 content_type;
+ if (!parseNullTerminatedString(&offset, &size, &content_type)) {
+ return ERROR_MALFORMED;
+ }
+
+ String8 content_encoding;
+ if (!parseNullTerminatedString(&offset, &size, &content_encoding)) {
+ return ERROR_MALFORMED;
+ }
+
+ if (version() == 1) {
+ uint32_t extension_type;
+ if (!source()->getUInt32(offset, &extension_type)) {
+ return ERROR_IO;
+ }
+ offset++;
+ size--;
+ // TODO: handle this case
+ }
+ } else { // version >= 2
+ uint32_t item_id;
+ size_t itemIdSize = (version() == 2) ? 2 : 4;
+ if (size < itemIdSize + 6) {
+ return ERROR_MALFORMED;
+ }
+ if (!source()->getUInt32Var(offset, &item_id, itemIdSize)) {
+ return ERROR_IO;
+ }
+ ALOGV("item_id %d", item_id);
+ offset += itemIdSize;
+ uint16_t item_protection_index;
+ if (!source()->getUInt16(offset, &item_protection_index)) {
+ return ERROR_IO;
+ }
+ ALOGV("item_protection_index %d", item_protection_index);
+ offset += 2;
+ uint32_t item_type;
+ if (!source()->getUInt32(offset, &item_type)) {
+ return ERROR_IO;
+ }
+
+ itemInfo->itemId = item_id;
+ itemInfo->itemType = item_type;
+
+ char itemTypeString[5];
+ MakeFourCCString(item_type, itemTypeString);
+ ALOGV("item_type %s", itemTypeString);
+ offset += 4;
+ size -= itemIdSize + 6;
+
+ String8 item_name;
+ if (!parseNullTerminatedString(&offset, &size, &item_name)) {
+ return ERROR_MALFORMED;
+ }
+ ALOGV("item_name %s", item_name.c_str());
+
+ if (item_type == FOURCC('m', 'i', 'm', 'e')) {
+ String8 content_type;
+ if (!parseNullTerminatedString(&offset, &size, &content_type)) {
+ return ERROR_MALFORMED;
+ }
+
+ String8 content_encoding;
+ if (!parseNullTerminatedString(&offset, &size, &content_encoding)) {
+ return ERROR_MALFORMED;
+ }
+ } else if (item_type == FOURCC('u', 'r', 'i', ' ')) {
+ String8 item_uri_type;
+ if (!parseNullTerminatedString(&offset, &size, &item_uri_type)) {
+ return ERROR_MALFORMED;
+ }
+ }
+ }
+ return OK;
+}
+
+struct IinfBox : public FullBox {
+ IinfBox(const sp<DataSource> source, Vector<ItemInfo> *itemInfos) :
+ FullBox(source, FOURCC('i', 'i', 'n', 'f')),
+ mItemInfos(itemInfos), mHasGrids(false) {}
+
+ status_t parse(off64_t offset, size_t size);
+
+ bool hasGrids() { return mHasGrids; }
+
+protected:
+ status_t onChunkData(uint32_t type, off64_t offset, size_t size) override;
+
+private:
+ Vector<ItemInfo> *mItemInfos;
+ bool mHasGrids;
+};
+
+status_t IinfBox::parse(off64_t offset, size_t size) {
+ ALOGV("%s: offset %lld, size %zu", __FUNCTION__, (long long)offset, size);
+
+ status_t err = parseFullBoxHeader(&offset, &size);
+ if (err != OK) {
+ return err;
+ }
+
+ size_t entryCountSize = version() == 0 ? 2 : 4;
+ if (size < entryCountSize) {
+ return ERROR_MALFORMED;
+ }
+ uint32_t entry_count;
+ if (!source()->getUInt32Var(offset, &entry_count, entryCountSize)) {
+ return ERROR_IO;
+ }
+ ALOGV("entry_count %d", entry_count);
+
+ off64_t stopOffset = offset + size;
+ offset += entryCountSize;
+ for (size_t i = 0; i < entry_count && offset < stopOffset; i++) {
+ ALOGV("entry %zu", i);
+ status_t err = parseChunk(&offset);
+ if (err != OK) {
+ return err;
+ }
+ }
+ if (offset != stopOffset) {
+ return ERROR_MALFORMED;
+ }
+
+ return OK;
+}
+
+status_t IinfBox::onChunkData(uint32_t type, off64_t offset, size_t size) {
+ if (type != FOURCC('i', 'n', 'f', 'e')) {
+ return OK;
+ }
+
+ InfeBox infeBox(source());
+ ItemInfo itemInfo;
+ status_t err = infeBox.parse(offset, size, &itemInfo);
+ if (err != OK) {
+ return err;
+ }
+ mItemInfos->push_back(itemInfo);
+ mHasGrids |= (itemInfo.itemType == FOURCC('g', 'r', 'i', 'd'));
+ return OK;
+}
+
+//////////////////////////////////////////////////////////////////
+
+ItemTable::ItemTable(const sp<DataSource> &source)
+ : mDataSource(source),
+ mPrimaryItemId(0),
+ mIdatOffset(0),
+ mIdatSize(0),
+ mImageItemsValid(false),
+ mCurrentImageIndex(0) {
+ mRequiredBoxes.insert('iprp');
+ mRequiredBoxes.insert('iloc');
+ mRequiredBoxes.insert('pitm');
+ mRequiredBoxes.insert('iinf');
+}
+
+ItemTable::~ItemTable() {}
+
+status_t ItemTable::parse(uint32_t type, off64_t data_offset, size_t chunk_data_size) {
+ switch(type) {
+ case FOURCC('i', 'l', 'o', 'c'):
+ {
+ return parseIlocBox(data_offset, chunk_data_size);
+ }
+ case FOURCC('i', 'i', 'n', 'f'):
+ {
+ return parseIinfBox(data_offset, chunk_data_size);
+ }
+ case FOURCC('i', 'p', 'r', 'p'):
+ {
+ return parseIprpBox(data_offset, chunk_data_size);
+ }
+ case FOURCC('p', 'i', 't', 'm'):
+ {
+ return parsePitmBox(data_offset, chunk_data_size);
+ }
+ case FOURCC('i', 'd', 'a', 't'):
+ {
+ return parseIdatBox(data_offset, chunk_data_size);
+ }
+ case FOURCC('i', 'r', 'e', 'f'):
+ {
+ return parseIrefBox(data_offset, chunk_data_size);
+ }
+ case FOURCC('i', 'p', 'r', 'o'):
+ {
+ ALOGW("ipro box not supported!");
+ break;
+ }
+ default:
+ {
+ ALOGW("unrecognized box type: 0x%x", type);
+ break;
+ }
+ }
+ return ERROR_UNSUPPORTED;
+}
+
+status_t ItemTable::parseIlocBox(off64_t offset, size_t size) {
+ ALOGV("%s: offset %lld, size %zu", __FUNCTION__, (long long)offset, size);
+
+ IlocBox ilocBox(mDataSource, &mItemLocs);
+ status_t err = ilocBox.parse(offset, size);
+ if (err != OK) {
+ return err;
+ }
+
+ if (ilocBox.hasConstructMethod1()) {
+ mRequiredBoxes.insert('idat');
+ }
+
+ return buildImageItemsIfPossible('iloc');
+}
+
+status_t ItemTable::parseIinfBox(off64_t offset, size_t size) {
+ ALOGV("%s: offset %lld, size %zu", __FUNCTION__, (long long)offset, size);
+
+ IinfBox iinfBox(mDataSource, &mItemInfos);
+ status_t err = iinfBox.parse(offset, size);
+ if (err != OK) {
+ return err;
+ }
+
+ if (iinfBox.hasGrids()) {
+ mRequiredBoxes.insert('iref');
+ }
+
+ return buildImageItemsIfPossible('iinf');
+}
+
+status_t ItemTable::parsePitmBox(off64_t offset, size_t size) {
+ ALOGV("%s: offset %lld, size %zu", __FUNCTION__, (long long)offset, size);
+
+ PitmBox pitmBox(mDataSource);
+ status_t err = pitmBox.parse(offset, size, &mPrimaryItemId);
+ if (err != OK) {
+ return err;
+ }
+
+ return buildImageItemsIfPossible('pitm');
+}
+
+status_t ItemTable::parseIprpBox(off64_t offset, size_t size) {
+ ALOGV("%s: offset %lld, size %zu", __FUNCTION__, (long long)offset, size);
+
+ IprpBox iprpBox(mDataSource, &mItemProperties, &mAssociations);
+ status_t err = iprpBox.parse(offset, size);
+ if (err != OK) {
+ return err;
+ }
+
+ return buildImageItemsIfPossible('iprp');
+}
+
+status_t ItemTable::parseIdatBox(off64_t offset, size_t size) {
+ ALOGV("%s: idat offset %lld, size %zu", __FUNCTION__, (long long)offset, size);
+
+ // only remember the offset and size of idat box for later use
+ mIdatOffset = offset;
+ mIdatSize = size;
+
+ return buildImageItemsIfPossible('idat');
+}
+
+status_t ItemTable::parseIrefBox(off64_t offset, size_t size) {
+ ALOGV("%s: offset %lld, size %zu", __FUNCTION__, (long long)offset, size);
+
+ IrefBox irefBox(mDataSource, &mItemReferences);
+ status_t err = irefBox.parse(offset, size);
+ if (err != OK) {
+ return err;
+ }
+
+ return buildImageItemsIfPossible('iref');
+}
+
+status_t ItemTable::buildImageItemsIfPossible(uint32_t type) {
+ if (mImageItemsValid) {
+ return OK;
+ }
+
+ mBoxesSeen.insert(type);
+
+ // need at least 'iprp', 'iloc', 'pitm', 'iinf';
+ // need 'idat' if any items used construction_method of 2;
+ // need 'iref' if there are grids.
+ if (!std::includes(
+ mBoxesSeen.begin(), mBoxesSeen.end(),
+ mRequiredBoxes.begin(), mRequiredBoxes.end())) {
+ return OK;
+ }
+
+ ALOGV("building image table...");
+
+ for (size_t i = 0; i < mItemInfos.size(); i++) {
+ const ItemInfo &info = mItemInfos[i];
+
+
+ // ignore non-image items
+ if (info.itemType != FOURCC('g', 'r', 'i', 'd') &&
+ info.itemType != FOURCC('h', 'v', 'c', '1')) {
+ continue;
+ }
+
+ ssize_t imageIndex = mItemIdToImageMap.indexOfKey(info.itemId);
+ if (imageIndex >= 0) {
+ ALOGW("ignoring duplicate image item id %d", info.itemId);
+ continue;
+ }
+
+ ssize_t ilocIndex = mItemLocs.indexOfKey(info.itemId);
+ if (ilocIndex < 0) {
+ ALOGE("iloc missing for image item id %d", info.itemId);
+ continue;
+ }
+ const ItemLoc &iloc = mItemLocs[ilocIndex];
+
+ off64_t offset;
+ size_t size;
+ if (iloc.getLoc(&offset, &size, mIdatOffset, mIdatSize) != OK) {
+ return ERROR_MALFORMED;
+ }
+
+ ImageItem image(info.itemType);
+
+ ALOGV("adding %s: itemId %d", image.isGrid() ? "grid" : "image", info.itemId);
+
+ if (image.isGrid()) {
+ if (size > 12) {
+ return ERROR_MALFORMED;
+ }
+ uint8_t buf[12];
+ if (!mDataSource->readAt(offset, buf, size)) {
+ return ERROR_IO;
+ }
+
+ image.rows = buf[2] + 1;
+ image.columns = buf[3] + 1;
+
+ ALOGV("rows %d, columans %d", image.rows, image.columns);
+ } else {
+ image.offset = offset;
+ image.size = size;
+ }
+ mItemIdToImageMap.add(info.itemId, image);
+ }
+
+ for (size_t i = 0; i < mAssociations.size(); i++) {
+ attachProperty(mAssociations[i]);
+ }
+
+ for (size_t i = 0; i < mItemReferences.size(); i++) {
+ mItemReferences[i]->apply(mItemIdToImageMap);
+ }
+
+ mImageItemsValid = true;
+ return OK;
+}
+
+void ItemTable::attachProperty(const AssociationEntry &association) {
+ ssize_t imageIndex = mItemIdToImageMap.indexOfKey(association.itemId);
+
+ // ignore non-image items
+ if (imageIndex < 0) {
+ return;
+ }
+
+ uint16_t propertyIndex = association.index;
+ if (propertyIndex >= mItemProperties.size()) {
+ ALOGW("Ignoring invalid property index %d", propertyIndex);
+ return;
+ }
+
+ ALOGV("attach property %d to item id %d)",
+ propertyIndex, association.itemId);
+
+ mItemProperties[propertyIndex]->attachTo(
+ mItemIdToImageMap.editValueAt(imageIndex));
+}
+
+sp<MetaData> ItemTable::getImageMeta() {
+ if (!mImageItemsValid) {
+ return NULL;
+ }
+
+ ssize_t imageIndex = mItemIdToImageMap.indexOfKey(mPrimaryItemId);
+ if (imageIndex < 0) {
+ ALOGE("Primary item id %d not found!", mPrimaryItemId);
+ return NULL;
+ }
+
+ ALOGV("primary image index %zu", imageIndex);
+
+ const ImageItem *image = &mItemIdToImageMap[imageIndex];
+
+ sp<MetaData> meta = new MetaData;
+ meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_HEVC);
+
+ ALOGV("setting image size %dx%d", image->width, image->height);
+ meta->setInt32(kKeyWidth, image->width);
+ meta->setInt32(kKeyHeight, image->height);
+ if (image->rotation != 0) {
+ // Rotation angle in HEIF is CCW, convert to CW here to be
+ // consistent with the other media formats.
+ switch(image->rotation) {
+ case 90: meta->setInt32(kKeyRotation, 270); break;
+ case 180: meta->setInt32(kKeyRotation, 180); break;
+ case 270: meta->setInt32(kKeyRotation, 90); break;
+ default: break; // don't set if invalid
+ }
+ }
+ meta->setInt32(kKeyMaxInputSize, image->width * image->height * 1.5);
+
+ if (!image->thumbnails.empty()) {
+ ssize_t thumbnailIndex = mItemIdToImageMap.indexOfKey(image->thumbnails[0]);
+ if (thumbnailIndex >= 0) {
+ const ImageItem &thumbnail = mItemIdToImageMap[thumbnailIndex];
+
+ meta->setInt32(kKeyThumbnailWidth, thumbnail.width);
+ meta->setInt32(kKeyThumbnailHeight, thumbnail.height);
+ meta->setData(kKeyThumbnailHVCC, kTypeHVCC,
+ thumbnail.hvcc->data(), thumbnail.hvcc->size());
+ ALOGV("thumbnail meta: %dx%d, index %zd",
+ thumbnail.width, thumbnail.height, thumbnailIndex);
+ } else {
+ ALOGW("Referenced thumbnail does not exist!");
+ }
+ }
+
+ if (image->isGrid()) {
+ ssize_t tileIndex = mItemIdToImageMap.indexOfKey(image->dimgRefs[0]);
+ if (tileIndex < 0) {
+ return NULL;
+ }
+ // when there are tiles, (kKeyWidth, kKeyHeight) is the full tiled area,
+ // and (kKeyDisplayWidth, kKeyDisplayHeight) may be smaller than that.
+ meta->setInt32(kKeyDisplayWidth, image->width);
+ meta->setInt32(kKeyDisplayHeight, image->height);
+ int32_t gridRows = image->rows, gridCols = image->columns;
+
+ // point image to the first tile for grid size and HVCC
+ image = &mItemIdToImageMap.editValueAt(tileIndex);
+ meta->setInt32(kKeyWidth, image->width * gridCols);
+ meta->setInt32(kKeyHeight, image->height * gridRows);
+ meta->setInt32(kKeyGridWidth, image->width);
+ meta->setInt32(kKeyGridHeight, image->height);
+ meta->setInt32(kKeyMaxInputSize, image->width * image->height * 1.5);
+ }
+
+ if (image->hvcc == NULL) {
+ ALOGE("hvcc is missing!");
+ return NULL;
+ }
+ meta->setData(kKeyHVCC, kTypeHVCC, image->hvcc->data(), image->hvcc->size());
+
+ if (image->icc != NULL) {
+ meta->setData(kKeyIccProfile, 0, image->icc->data(), image->icc->size());
+ }
+ return meta;
+}
+
+uint32_t ItemTable::countImages() const {
+ return mImageItemsValid ? mItemIdToImageMap.size() : 0;
+}
+
+status_t ItemTable::findPrimaryImage(uint32_t *imageIndex) {
+ if (!mImageItemsValid) {
+ return INVALID_OPERATION;
+ }
+
+ ssize_t index = mItemIdToImageMap.indexOfKey(mPrimaryItemId);
+ if (index < 0) {
+ return ERROR_MALFORMED;
+ }
+
+ *imageIndex = index;
+ return OK;
+}
+
+status_t ItemTable::findThumbnail(uint32_t *imageIndex) {
+ if (!mImageItemsValid) {
+ return INVALID_OPERATION;
+ }
+
+ ssize_t primaryIndex = mItemIdToImageMap.indexOfKey(mPrimaryItemId);
+ if (primaryIndex < 0) {
+ ALOGE("Primary item id %d not found!", mPrimaryItemId);
+ return ERROR_MALFORMED;
+ }
+
+ const ImageItem &primaryImage = mItemIdToImageMap[primaryIndex];
+ if (primaryImage.thumbnails.empty()) {
+ ALOGW("Using primary in place of thumbnail.");
+ *imageIndex = primaryIndex;
+ return OK;
+ }
+
+ ssize_t thumbnailIndex = mItemIdToImageMap.indexOfKey(
+ primaryImage.thumbnails[0]);
+ if (thumbnailIndex < 0) {
+ ALOGE("Thumbnail item id %d not found!", primaryImage.thumbnails[0]);
+ return ERROR_MALFORMED;
+ }
+
+ *imageIndex = thumbnailIndex;
+ return OK;
+}
+
+status_t ItemTable::getImageOffsetAndSize(
+ uint32_t *imageIndex, off64_t *offset, size_t *size) {
+ if (!mImageItemsValid) {
+ return INVALID_OPERATION;
+ }
+
+ if (imageIndex != NULL) {
+ if (*imageIndex >= mItemIdToImageMap.size()) {
+ ALOGE("Bad image index!");
+ return BAD_VALUE;
+ }
+ mCurrentImageIndex = *imageIndex;
+ }
+
+ ImageItem &image = mItemIdToImageMap.editValueAt(mCurrentImageIndex);
+ if (image.isGrid()) {
+ uint32_t tileItemId;
+ status_t err = image.getNextTileItemId(&tileItemId, imageIndex != NULL);
+ if (err != OK) {
+ return err;
+ }
+ ssize_t tileImageIndex = mItemIdToImageMap.indexOfKey(tileItemId);
+ if (tileImageIndex < 0) {
+ return ERROR_END_OF_STREAM;
+ }
+ *offset = mItemIdToImageMap[tileImageIndex].offset;
+ *size = mItemIdToImageMap[tileImageIndex].size;
+ } else {
+ if (imageIndex == NULL) {
+ // For single images, we only allow it to be read once, after that
+ // it's EOS. New image index must be requested each time.
+ return ERROR_END_OF_STREAM;
+ }
+ *offset = mItemIdToImageMap[mCurrentImageIndex].offset;
+ *size = mItemIdToImageMap[mCurrentImageIndex].size;
+ }
+
+ return OK;
+}
+
+} // namespace heif
+
+} // namespace android
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index 445a861..a8b6614 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -28,6 +28,7 @@
#include "include/MPEG4Extractor.h"
#include "include/SampleTable.h"
+#include "include/ItemTable.h"
#include "include/ESDS.h"
#include <media/stagefright/foundation/ABitReader.h>
@@ -36,6 +37,7 @@
#include <media/stagefright/foundation/AMessage.h>
#include <media/stagefright/foundation/AUtils.h>
#include <media/stagefright/foundation/ColorUtils.h>
+#include <media/stagefright/foundation/hexdump.h>
#include <media/stagefright/MediaBuffer.h>
#include <media/stagefright/MediaBufferGroup.h>
#include <media/stagefright/MediaDefs.h>
@@ -72,7 +74,8 @@
const sp<SampleTable> &sampleTable,
Vector<SidxEntry> &sidx,
const Trex *trex,
- off64_t firstMoofOffset);
+ off64_t firstMoofOffset,
+ const sp<ItemTable> &itemTable);
virtual status_t init();
virtual status_t start(MetaData *params = NULL);
@@ -134,6 +137,9 @@
uint8_t *mSrcBuffer;
+ bool mIsHEIF;
+ sp<ItemTable> mItemTable;
+
size_t parseNALSize(const uint8_t *data) const;
status_t parseChunk(off64_t *offset);
status_t parseTrackFragmentHeader(off64_t offset, off64_t size);
@@ -285,45 +291,6 @@
static const bool kUseHexDump = false;
-static void hexdump(const void *_data, size_t size) {
- const uint8_t *data = (const uint8_t *)_data;
- size_t offset = 0;
- while (offset < size) {
- printf("0x%04zx ", offset);
-
- size_t n = size - offset;
- if (n > 16) {
- n = 16;
- }
-
- for (size_t i = 0; i < 16; ++i) {
- if (i == 8) {
- printf(" ");
- }
-
- if (offset + i < size) {
- printf("%02x ", data[offset + i]);
- } else {
- printf(" ");
- }
- }
-
- printf(" ");
-
- for (size_t i = 0; i < n; ++i) {
- if (isprint(data[offset + i])) {
- printf("%c", data[offset + i]);
- } else {
- printf(".");
- }
- }
-
- printf("\n");
-
- offset += 16;
- }
-}
-
static const char *FourCC2MIME(uint32_t fourcc) {
switch (fourcc) {
case FOURCC('m', 'p', '4', 'a'):
@@ -378,6 +345,7 @@
mInitCheck(NO_INIT),
mHeaderTimescale(0),
mIsQT(false),
+ mIsHEIF(false),
mFirstTrack(NULL),
mLastTrack(NULL),
mFileMetaData(new MetaData),
@@ -386,6 +354,10 @@
}
MPEG4Extractor::~MPEG4Extractor() {
+ release();
+}
+
+void MPEG4Extractor::release() {
Track *track = mFirstTrack;
while (track) {
Track *next = track->next;
@@ -407,6 +379,12 @@
for (size_t i = 0; i < mPssh.size(); i++) {
delete [] mPssh[i].data;
}
+ mPssh.clear();
+
+ if (mDataSource != NULL) {
+ mDataSource->close();
+ mDataSource.clear();
+ }
}
uint32_t MPEG4Extractor::flags() const {
@@ -463,65 +441,81 @@
return NULL;
}
- int64_t duration;
- int32_t samplerate;
- if (track->has_elst && mHeaderTimescale != 0 &&
- track->meta->findInt64(kKeyDuration, &duration) &&
- track->meta->findInt32(kKeySampleRate, &samplerate)) {
+ [=] {
+ int64_t duration;
+ int32_t samplerate;
+ if (track->has_elst && mHeaderTimescale != 0 &&
+ track->meta->findInt64(kKeyDuration, &duration) &&
+ track->meta->findInt32(kKeySampleRate, &samplerate)) {
- track->has_elst = false;
+ track->has_elst = false;
- if (track->elst_segment_duration > INT64_MAX) {
- goto editlistoverflow;
+ if (track->elst_segment_duration > INT64_MAX) {
+ return;
+ }
+ int64_t segment_duration = track->elst_segment_duration;
+ int64_t media_time = track->elst_media_time;
+ int64_t halfscale = mHeaderTimescale / 2;
+ ALOGV("segment_duration = %" PRId64 ", media_time = %" PRId64
+ ", halfscale = %" PRId64 ", timescale = %d",
+ segment_duration,
+ media_time,
+ halfscale,
+ mHeaderTimescale);
+
+ int64_t delay;
+ // delay = ((media_time * samplerate) + halfscale) / mHeaderTimescale;
+ if (__builtin_mul_overflow(media_time, samplerate, &delay) ||
+ __builtin_add_overflow(delay, halfscale, &delay) ||
+ (delay /= mHeaderTimescale, false) ||
+ delay > INT32_MAX ||
+ delay < INT32_MIN) {
+ return;
+ }
+ ALOGV("delay = %" PRId64, delay);
+ track->meta->setInt32(kKeyEncoderDelay, delay);
+
+ int64_t scaled_duration;
+ // scaled_duration = duration * mHeaderTimescale;
+ if (__builtin_mul_overflow(duration, mHeaderTimescale, &scaled_duration)) {
+ return;
+ }
+ ALOGV("scaled_duration = %" PRId64, scaled_duration);
+
+ int64_t segment_end;
+ int64_t padding;
+ // padding = scaled_duration - ((segment_duration + media_time) * 1000000);
+ if (__builtin_add_overflow(segment_duration, media_time, &segment_end) ||
+ __builtin_mul_overflow(segment_end, 1000000, &segment_end) ||
+ __builtin_sub_overflow(scaled_duration, segment_end, &padding)) {
+ return;
+ }
+ ALOGV("segment_end = %" PRId64 ", padding = %" PRId64, segment_end, padding);
+
+ if (padding < 0) {
+ // track duration from media header (which is what kKeyDuration is) might
+ // be slightly shorter than the segment duration, which would make the
+ // padding negative. Clamp to zero.
+ padding = 0;
+ }
+
+ int64_t paddingsamples;
+ int64_t halfscale_e6;
+ int64_t timescale_e6;
+ // paddingsamples = ((padding * samplerate) + (halfscale * 1000000))
+ // / (mHeaderTimescale * 1000000);
+ if (__builtin_mul_overflow(padding, samplerate, &paddingsamples) ||
+ __builtin_mul_overflow(halfscale, 1000000, &halfscale_e6) ||
+ __builtin_mul_overflow(mHeaderTimescale, 1000000, ×cale_e6) ||
+ __builtin_add_overflow(paddingsamples, halfscale_e6, &paddingsamples) ||
+ (paddingsamples /= timescale_e6, false) ||
+ paddingsamples > INT32_MAX) {
+ return;
+ }
+ ALOGV("paddingsamples = %" PRId64, paddingsamples);
+ track->meta->setInt32(kKeyEncoderPadding, paddingsamples);
}
- int64_t segment_duration = track->elst_segment_duration;
- int64_t media_time = track->elst_media_time;
- int64_t halfscale = mHeaderTimescale / 2;
-
- int64_t delay;
- // delay = ((media_time * samplerate) + halfscale) / mHeaderTimescale;
- if (__builtin_mul_overflow(media_time, samplerate, &delay) ||
- __builtin_add_overflow(delay, halfscale, &delay) ||
- (delay /= mHeaderTimescale, false) ||
- delay > INT32_MAX ||
- delay < INT32_MIN) {
- goto editlistoverflow;
- }
- track->meta->setInt32(kKeyEncoderDelay, delay);
-
- int64_t scaled_duration;
- // scaled_duration = ((duration * mHeaderTimescale) + 500000) / 1000000;
- if (__builtin_mul_overflow(duration, mHeaderTimescale, &scaled_duration) ||
- __builtin_add_overflow(scaled_duration, 500000, &scaled_duration)) {
- goto editlistoverflow;
- }
- scaled_duration /= 1000000;
-
- int64_t segment_end;
- int64_t padding;
- if (__builtin_add_overflow(segment_duration, media_time, &segment_end) ||
- __builtin_sub_overflow(scaled_duration, segment_end, &padding)) {
- goto editlistoverflow;
- }
-
- if (padding < 0) {
- // track duration from media header (which is what kKeyDuration is) might
- // be slightly shorter than the segment duration, which would make the
- // padding negative. Clamp to zero.
- padding = 0;
- }
-
- int64_t paddingsamples;
- // paddingsamples = ((padding * samplerate) + halfscale) / mHeaderTimescale;
- if (__builtin_mul_overflow(padding, samplerate, &paddingsamples) ||
- __builtin_add_overflow(paddingsamples, halfscale, &paddingsamples) ||
- (paddingsamples /= mHeaderTimescale, false) ||
- paddingsamples > INT32_MAX) {
- goto editlistoverflow;
- }
- track->meta->setInt32(kKeyEncoderPadding, paddingsamples);
- }
- editlistoverflow:
+ }();
if ((flags & kIncludeExtensiveMetaData)
&& !track->includes_expensive_metadata) {
@@ -572,14 +566,6 @@
return track->meta;
}
-static void MakeFourCCString(uint32_t x, char *s) {
- s[0] = x >> 24;
- s[1] = (x >> 16) & 0xff;
- s[2] = (x >> 8) & 0xff;
- s[3] = x & 0xff;
- s[4] = '\0';
-}
-
status_t MPEG4Extractor::readMetaData() {
if (mInitCheck != NO_INIT) {
return mInitCheck;
@@ -589,7 +575,8 @@
status_t err;
bool sawMoovOrSidx = false;
- while (!(sawMoovOrSidx && (mMdatFound || mMoofFound))) {
+ while (!((sawMoovOrSidx && (mMdatFound || mMoofFound)) ||
+ (mIsHEIF && (mItemTable != NULL) && mItemTable->isValid()))) {
off64_t orig_offset = offset;
err = parseChunk(&offset, 0);
@@ -641,6 +628,29 @@
mFileMetaData->setData(kKeyPssh, 'pssh', buf, psshsize);
free(buf);
}
+
+ if (mIsHEIF) {
+ sp<MetaData> meta = mItemTable->getImageMeta();
+ if (meta == NULL) {
+ return ERROR_MALFORMED;
+ }
+
+ Track *track = mLastTrack;
+ if (track != NULL) {
+ ALOGW("track is set before metadata is fully processed");
+ } else {
+ track = new Track;
+ track->next = NULL;
+ mFirstTrack = mLastTrack = track;
+ }
+
+ track->meta = meta;
+ track->meta->setInt32(kKeyTrackID, 0);
+ track->includes_expensive_metadata = false;
+ track->skipTrack = false;
+ track->timescale = 0;
+ }
+
return mInitCheck;
}
@@ -1027,8 +1037,9 @@
}
}
- if (mLastTrack == NULL)
+ if (mLastTrack == NULL) {
return ERROR_MALFORMED;
+ }
mLastTrack->sampleTable = new SampleTable(mDataSource);
}
@@ -1184,8 +1195,9 @@
original_fourcc = ntohl(original_fourcc);
ALOGV("read original format: %d", original_fourcc);
- if (mLastTrack == NULL)
+ if (mLastTrack == NULL) {
return ERROR_MALFORMED;
+ }
mLastTrack->meta->setCString(kKeyMIMEType, FourCC2MIME(original_fourcc));
uint32_t num_channels = 0;
@@ -1625,8 +1637,9 @@
case FOURCC('s', 't', 'c', 'o'):
case FOURCC('c', 'o', '6', '4'):
{
- if ((mLastTrack == NULL) || (mLastTrack->sampleTable == NULL))
+ if ((mLastTrack == NULL) || (mLastTrack->sampleTable == NULL)) {
return ERROR_MALFORMED;
+ }
status_t err =
mLastTrack->sampleTable->setChunkOffsetParams(
@@ -1662,8 +1675,9 @@
case FOURCC('s', 't', 's', 'z'):
case FOURCC('s', 't', 'z', '2'):
{
- if ((mLastTrack == NULL) || (mLastTrack->sampleTable == NULL))
+ if ((mLastTrack == NULL) || (mLastTrack->sampleTable == NULL)) {
return ERROR_MALFORMED;
+ }
status_t err =
mLastTrack->sampleTable->setSampleSizeParams(
@@ -1722,6 +1736,9 @@
// ratio. Use compression ratio of 1.
max_size = width * height * 3 / 2;
}
+ // HACK: allow 10% overhead
+ // TODO: read sample size from traf atom for fragmented MPEG4.
+ max_size += max_size / 10;
mLastTrack->meta->setInt32(kKeyMaxInputSize, max_size);
}
@@ -2079,6 +2096,28 @@
break;
}
+ case FOURCC('i', 'l', 'o', 'c'):
+ case FOURCC('i', 'i', 'n', 'f'):
+ case FOURCC('i', 'p', 'r', 'p'):
+ case FOURCC('p', 'i', 't', 'm'):
+ case FOURCC('i', 'd', 'a', 't'):
+ case FOURCC('i', 'r', 'e', 'f'):
+ case FOURCC('i', 'p', 'r', 'o'):
+ {
+ if (mIsHEIF) {
+ if (mItemTable == NULL) {
+ mItemTable = new ItemTable(mDataSource);
+ }
+ status_t err = mItemTable->parse(
+ chunk_type, data_offset, chunk_data_size);
+ if (err != OK) {
+ return err;
+ }
+ }
+ *offset += chunk_size;
+ break;
+ }
+
case FOURCC('m', 'e', 'a', 'n'):
case FOURCC('n', 'a', 'm', 'e'):
case FOURCC('d', 'a', 't', 'a'):
@@ -2426,6 +2465,7 @@
off64_t stop_offset = *offset + chunk_size;
uint32_t numCompatibleBrands = (chunk_data_size - 8) / 4;
+ std::set<uint32_t> brandSet;
for (size_t i = 0; i < numCompatibleBrands + 2; ++i) {
if (i == 1) {
// Skip this index, it refers to the minorVersion,
@@ -2439,10 +2479,15 @@
}
brand = ntohl(brand);
- if (brand == FOURCC('q', 't', ' ', ' ')) {
- mIsQT = true;
- break;
- }
+ brandSet.insert(brand);
+ }
+
+ if (brandSet.count(FOURCC('q', 't', ' ', ' ')) > 0) {
+ mIsQT = true;
+ } else if (brandSet.count(FOURCC('m', 'i', 'f', '1')) > 0
+ && brandSet.count(FOURCC('h', 'e', 'i', 'c')) > 0) {
+ mIsHEIF = true;
+ ALOGV("identified HEIF image");
}
*offset = stop_offset;
@@ -3391,7 +3436,7 @@
sp<MPEG4Source> source = new MPEG4Source(this,
track->meta, mDataSource, track->timescale, track->sampleTable,
- mSidxEntries, trex, mMoofOffset);
+ mSidxEntries, trex, mMoofOffset, mItemTable);
if (source->init() != OK) {
return NULL;
}
@@ -3792,7 +3837,8 @@
const sp<SampleTable> &sampleTable,
Vector<SidxEntry> &sidx,
const Trex *trex,
- off64_t firstMoofOffset)
+ off64_t firstMoofOffset,
+ const sp<ItemTable> &itemTable)
: mOwner(owner),
mFormat(format),
mDataSource(dataSource),
@@ -3817,7 +3863,9 @@
mGroup(NULL),
mBuffer(NULL),
mWantsNALFragments(false),
- mSrcBuffer(NULL) {
+ mSrcBuffer(NULL),
+ mIsHEIF(itemTable != NULL),
+ mItemTable(itemTable) {
memset(&mTrackFragmentHeaderInfo, 0, sizeof(mTrackFragmentHeaderInfo));
@@ -4592,77 +4640,93 @@
int64_t seekTimeUs;
ReadOptions::SeekMode mode;
if (options && options->getSeekTo(&seekTimeUs, &mode)) {
- uint32_t findFlags = 0;
- switch (mode) {
- case ReadOptions::SEEK_PREVIOUS_SYNC:
- findFlags = SampleTable::kFlagBefore;
- break;
- case ReadOptions::SEEK_NEXT_SYNC:
- findFlags = SampleTable::kFlagAfter;
- break;
- case ReadOptions::SEEK_CLOSEST_SYNC:
- case ReadOptions::SEEK_CLOSEST:
- findFlags = SampleTable::kFlagClosest;
- break;
- default:
- CHECK(!"Should not be here.");
- break;
- }
+ if (mIsHEIF) {
+ CHECK(mSampleTable == NULL);
+ CHECK(mItemTable != NULL);
- uint32_t sampleIndex;
- status_t err = mSampleTable->findSampleAtTime(
- seekTimeUs, 1000000, mTimescale,
- &sampleIndex, findFlags);
-
- if (mode == ReadOptions::SEEK_CLOSEST) {
- // We found the closest sample already, now we want the sync
- // sample preceding it (or the sample itself of course), even
- // if the subsequent sync sample is closer.
- findFlags = SampleTable::kFlagBefore;
- }
-
- uint32_t syncSampleIndex;
- if (err == OK) {
- err = mSampleTable->findSyncSampleNear(
- sampleIndex, &syncSampleIndex, findFlags);
- }
-
- uint32_t sampleTime;
- if (err == OK) {
- err = mSampleTable->getMetaDataForSample(
- sampleIndex, NULL, NULL, &sampleTime);
- }
-
- if (err != OK) {
- if (err == ERROR_OUT_OF_RANGE) {
- // An attempt to seek past the end of the stream would
- // normally cause this ERROR_OUT_OF_RANGE error. Propagating
- // this all the way to the MediaPlayer would cause abnormal
- // termination. Legacy behaviour appears to be to behave as if
- // we had seeked to the end of stream, ending normally.
- err = ERROR_END_OF_STREAM;
+ status_t err;
+ if (seekTimeUs >= 0) {
+ err = mItemTable->findPrimaryImage(&mCurrentSampleIndex);
+ } else {
+ err = mItemTable->findThumbnail(&mCurrentSampleIndex);
}
- ALOGV("end of stream");
- return err;
- }
+ if (err != OK) {
+ return err;
+ }
+ } else {
+ uint32_t findFlags = 0;
+ switch (mode) {
+ case ReadOptions::SEEK_PREVIOUS_SYNC:
+ findFlags = SampleTable::kFlagBefore;
+ break;
+ case ReadOptions::SEEK_NEXT_SYNC:
+ findFlags = SampleTable::kFlagAfter;
+ break;
+ case ReadOptions::SEEK_CLOSEST_SYNC:
+ case ReadOptions::SEEK_CLOSEST:
+ findFlags = SampleTable::kFlagClosest;
+ break;
+ default:
+ CHECK(!"Should not be here.");
+ break;
+ }
- if (mode == ReadOptions::SEEK_CLOSEST) {
- targetSampleTimeUs = (sampleTime * 1000000ll) / mTimescale;
- }
+ uint32_t sampleIndex;
+ status_t err = mSampleTable->findSampleAtTime(
+ seekTimeUs, 1000000, mTimescale,
+ &sampleIndex, findFlags);
+
+ if (mode == ReadOptions::SEEK_CLOSEST) {
+ // We found the closest sample already, now we want the sync
+ // sample preceding it (or the sample itself of course), even
+ // if the subsequent sync sample is closer.
+ findFlags = SampleTable::kFlagBefore;
+ }
+
+ uint32_t syncSampleIndex;
+ if (err == OK) {
+ err = mSampleTable->findSyncSampleNear(
+ sampleIndex, &syncSampleIndex, findFlags);
+ }
+
+ uint32_t sampleTime;
+ if (err == OK) {
+ err = mSampleTable->getMetaDataForSample(
+ sampleIndex, NULL, NULL, &sampleTime);
+ }
+
+ if (err != OK) {
+ if (err == ERROR_OUT_OF_RANGE) {
+ // An attempt to seek past the end of the stream would
+ // normally cause this ERROR_OUT_OF_RANGE error. Propagating
+ // this all the way to the MediaPlayer would cause abnormal
+ // termination. Legacy behaviour appears to be to behave as if
+ // we had seeked to the end of stream, ending normally.
+ err = ERROR_END_OF_STREAM;
+ }
+ ALOGV("end of stream");
+ return err;
+ }
+
+ if (mode == ReadOptions::SEEK_CLOSEST) {
+ targetSampleTimeUs = (sampleTime * 1000000ll) / mTimescale;
+ }
#if 0
- uint32_t syncSampleTime;
- CHECK_EQ(OK, mSampleTable->getMetaDataForSample(
- syncSampleIndex, NULL, NULL, &syncSampleTime));
+ uint32_t syncSampleTime;
+ CHECK_EQ(OK, mSampleTable->getMetaDataForSample(
+ syncSampleIndex, NULL, NULL, &syncSampleTime));
- ALOGI("seek to time %lld us => sample at time %lld us, "
- "sync sample at time %lld us",
- seekTimeUs,
- sampleTime * 1000000ll / mTimescale,
- syncSampleTime * 1000000ll / mTimescale);
+ ALOGI("seek to time %lld us => sample at time %lld us, "
+ "sync sample at time %lld us",
+ seekTimeUs,
+ sampleTime * 1000000ll / mTimescale,
+ syncSampleTime * 1000000ll / mTimescale);
#endif
- mCurrentSampleIndex = syncSampleIndex;
+ mCurrentSampleIndex = syncSampleIndex;
+ }
+
if (mBuffer != NULL) {
mBuffer->release();
mBuffer = NULL;
@@ -4679,9 +4743,19 @@
if (mBuffer == NULL) {
newBuffer = true;
- status_t err =
- mSampleTable->getMetaDataForSample(
+ status_t err;
+ if (!mIsHEIF) {
+ err = mSampleTable->getMetaDataForSample(
mCurrentSampleIndex, &offset, &size, &cts, &isSyncSample, &stts);
+ } else {
+ err = mItemTable->getImageOffsetAndSize(
+ options && options->getSeekTo(&seekTimeUs, &mode) ?
+ &mCurrentSampleIndex : NULL, &offset, &size);
+
+ cts = stts = 0;
+ isSyncSample = 0;
+ ALOGV("image offset %lld, size %zu", (long long)offset, size);
+ }
if (err != OK) {
return err;
@@ -4695,6 +4769,8 @@
}
if (size > mBuffer->size()) {
ALOGE("buffer too small: %zu > %zu", size, mBuffer->size());
+ mBuffer->release();
+ mBuffer = NULL;
return ERROR_BUFFER_TOO_SMALL;
}
}
@@ -4987,6 +5063,8 @@
}
if (size > mBuffer->size()) {
ALOGE("buffer too small: %zu > %zu", size, mBuffer->size());
+ mBuffer->release();
+ mBuffer = NULL;
return ERROR_BUFFER_TOO_SMALL;
}
}
@@ -5235,6 +5313,7 @@
void MPEG4Extractor::populateMetrics() {
ALOGV("MPEG4Extractor::populateMetrics");
+ // write into mAnalyticsItem
}
static bool LegacySniffMPEG4(
@@ -5251,7 +5330,8 @@
|| !memcmp(header, "ftyp3ge6", 8) || !memcmp(header, "ftyp3gg6", 8)
|| !memcmp(header, "ftypisom", 8) || !memcmp(header, "ftypM4V ", 8)
|| !memcmp(header, "ftypM4A ", 8) || !memcmp(header, "ftypf4v ", 8)
- || !memcmp(header, "ftypkddi", 8) || !memcmp(header, "ftypM4VP", 8)) {
+ || !memcmp(header, "ftypkddi", 8) || !memcmp(header, "ftypM4VP", 8)
+ || !memcmp(header, "ftypmif1", 8) || !memcmp(header, "ftypheic", 8)) {
*mimeType = MEDIA_MIMETYPE_CONTAINER_MPEG4;
*confidence = 0.4;
@@ -5280,6 +5360,8 @@
FOURCC('3', 'g', '2', 'a'), // 3GPP2
FOURCC('3', 'g', '2', 'b'),
+ FOURCC('m', 'i', 'f', '1'), // HEIF image
+ FOURCC('h', 'e', 'i', 'c'), // HEIF image
};
for (size_t i = 0;
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index 93d4f57..7786c4d 100644
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -432,7 +432,7 @@
};
MPEG4Writer::MPEG4Writer(int fd) {
- initInternal(fd);
+ initInternal(fd, true /*isFirstSession*/);
}
MPEG4Writer::~MPEG4Writer() {
@@ -451,19 +451,26 @@
}
}
-void MPEG4Writer::initInternal(int fd) {
+void MPEG4Writer::initInternal(int fd, bool isFirstSession) {
ALOGV("initInternal");
mFd = dup(fd);
mNextFd = -1;
mInitCheck = mFd < 0? NO_INIT: OK;
- mIsRealTimeRecording = true;
- mUse4ByteNalLength = true;
- mUse32BitOffset = true;
- mIsFileSizeLimitExplicitlyRequested = false;
+
+ mInterleaveDurationUs = 1000000;
+
+ mStartTimestampUs = -1ll;
+ mStartTimeOffsetMs = -1;
mPaused = false;
mStarted = false;
mWriterThreadStarted = false;
mSendNotify = false;
+
+ // Reset following variables for all the sessions and they will be
+ // initialized in start(MetaData *param).
+ mIsRealTimeRecording = true;
+ mUse4ByteNalLength = true;
+ mUse32BitOffset = true;
mOffset = 0;
mMdatOffset = 0;
mMoovBoxBuffer = NULL;
@@ -472,17 +479,21 @@
mFreeBoxOffset = 0;
mStreamableFile = false;
mEstimatedMoovBoxSize = 0;
- mMoovExtraSize = 0;
- mInterleaveDurationUs = 1000000;
mTimeScale = -1;
- mStartTimestampUs = -1ll;
- mLatitudex10000 = 0;
- mLongitudex10000 = 0;
- mAreGeoTagsAvailable = false;
- mStartTimeOffsetMs = -1;
- mSwitchPending = false;
- mMetaKeys = new AMessage();
- addDeviceMeta();
+
+ // Following variables only need to be set for the first recording session.
+ // And they will stay the same for all the recording sessions.
+ if (isFirstSession) {
+ mMoovExtraSize = 0;
+ mMetaKeys = new AMessage();
+ addDeviceMeta();
+ mLatitudex10000 = 0;
+ mLongitudex10000 = 0;
+ mAreGeoTagsAvailable = false;
+ mSwitchPending = false;
+ mIsFileSizeLimitExplicitlyRequested = false;
+ }
+
// Verify mFd is seekable
off64_t off = lseek64(mFd, 0, SEEK_SET);
if (off < 0) {
@@ -873,19 +884,8 @@
}
status_t MPEG4Writer::pause() {
- if (mInitCheck != OK) {
- return OK;
- }
- mPaused = true;
- status_t err = OK;
- for (List<Track *>::iterator it = mTracks.begin();
- it != mTracks.end(); ++it) {
- status_t status = (*it)->pause();
- if (status != OK) {
- err = status;
- }
- }
- return err;
+ ALOGW("MPEG4Writer: pause is not supported");
+ return ERROR_UNSUPPORTED;
}
void MPEG4Writer::stopWriterThread() {
@@ -1833,7 +1833,7 @@
int fd = mNextFd;
mNextFd = -1;
mLock.unlock();
- initInternal(fd);
+ initInternal(fd, false /*isFirstSession*/);
start(mStartMeta.get());
mSwitchPending = false;
notify(MEDIA_RECORDER_EVENT_INFO, MEDIA_RECORDER_INFO_NEXT_OUTPUT_FILE_STARTED, 0);
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index bd71632..759e42d 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -23,7 +23,8 @@
#include "include/SharedMemoryBuffer.h"
#include "include/SoftwareRenderer.h"
-#include <android/media/IDescrambler.h>
+#include <android/hardware/cas/native/1.0/IDescrambler.h>
+
#include <binder/IMemory.h>
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
@@ -72,6 +73,13 @@
static const char *kCodecCrypto = "android.media.mediacodec.crypto"; /* 0,1 */
static const char *kCodecEncoder = "android.media.mediacodec.encoder"; /* 0,1 */
+static const char *kCodecBytesIn = "android.media.mediacodec.bytesin"; /* 0..n */
+static const char *kCodecProfile = "android.media.mediacodec.profile"; /* 0..n */
+static const char *kCodecLevel = "android.media.mediacodec.level"; /* 0..n */
+static const char *kCodecMaxWidth = "android.media.mediacodec.maxwidth"; /* 0..n */
+static const char *kCodecMaxHeight = "android.media.mediacodec.maxheight"; /* 0..n */
+static const char *kCodecError = "android.media.mediacodec.errcode";
+static const char *kCodecErrorState = "android.media.mediacodec.errstate";
static int64_t getId(const sp<IResourceManagerClient> &client) {
@@ -428,22 +436,6 @@
}
// static
-status_t MediaCodec::QueryCapabilities(
- const AString &name, const AString &mime, bool isEncoder,
- sp<MediaCodecInfo::Capabilities> *caps /* nonnull */) {
- // TRICKY: this method is used by MediaCodecList/Info during its
- // initialization. As such, we cannot create a MediaCodec instance
- // because that requires an initialized MediaCodecList.
-
- sp<CodecBase> codec = GetCodecBase(name);
- if (codec == NULL) {
- return NAME_NOT_FOUND;
- }
-
- return codec->queryCapabilities(name, mime, isEncoder, caps);
-}
-
-// static
sp<PersistentSurface> MediaCodec::CreatePersistentInputSurface() {
OMXClient client;
if (client.connect() != OK) {
@@ -475,6 +467,7 @@
mFlags(0),
mStickyError(OK),
mSoftRenderer(NULL),
+ mAnalyticsItem(NULL),
mResourceManagerClient(new ResourceManagerClient(this)),
mResourceManagerService(new ResourceManagerServiceProxy(pid)),
mBatteryStatNotified(false),
@@ -493,6 +486,18 @@
} else {
mUid = uid;
}
+ initAnalyticsItem();
+}
+
+MediaCodec::~MediaCodec() {
+ CHECK_EQ(mState, UNINITIALIZED);
+ mResourceManagerService->removeResource(getId(mResourceManagerClient));
+
+ flushAnalyticsItem();
+}
+
+void MediaCodec::initAnalyticsItem() {
+ CHECK(mAnalyticsItem == NULL);
// set up our new record, get a sessionID, put it into the in-progress list
mAnalyticsItem = new MediaAnalyticsItem(kCodecKeyName);
if (mAnalyticsItem != NULL) {
@@ -502,11 +507,9 @@
}
}
-MediaCodec::~MediaCodec() {
- CHECK_EQ(mState, UNINITIALIZED);
- mResourceManagerService->removeResource(getId(mResourceManagerClient));
-
- if (mAnalyticsItem != NULL ) {
+void MediaCodec::flushAnalyticsItem() {
+ if (mAnalyticsItem != NULL) {
+ // don't log empty records
if (mAnalyticsItem->count() > 0) {
mAnalyticsItem->setFinalized(true);
mAnalyticsItem->selfrecord();
@@ -699,10 +702,21 @@
uint32_t flags) {
sp<AMessage> msg = new AMessage(kWhatConfigure, this);
+ if (mAnalyticsItem != NULL) {
+ int32_t profile = 0;
+ if (format->findInt32("profile", &profile)) {
+ mAnalyticsItem->setInt32(kCodecProfile, profile);
+ }
+ int32_t level = 0;
+ if (format->findInt32("level", &level)) {
+ mAnalyticsItem->setInt32(kCodecLevel, level);
+ }
+ }
+
if (mIsVideo) {
format->findInt32("width", &mVideoWidth);
format->findInt32("height", &mVideoHeight);
- if (!format->findInt32(kCodecRotation, &mRotationDegrees)) {
+ if (!format->findInt32("rotation-degrees", &mRotationDegrees)) {
mRotationDegrees = 0;
}
@@ -710,6 +724,14 @@
mAnalyticsItem->setInt32(kCodecWidth, mVideoWidth);
mAnalyticsItem->setInt32(kCodecHeight, mVideoHeight);
mAnalyticsItem->setInt32(kCodecRotation, mRotationDegrees);
+ int32_t maxWidth = 0;
+ if (format->findInt32("max-width", &maxWidth)) {
+ mAnalyticsItem->setInt32(kCodecMaxWidth, maxWidth);
+ }
+ int32_t maxHeight = 0;
+ if (format->findInt32("max-height", &maxHeight)) {
+ mAnalyticsItem->setInt32(kCodecMaxHeight, maxHeight);
+ }
}
// Prevent possible integer overflow in downstream code.
@@ -1416,6 +1438,12 @@
case CONFIGURING:
{
+ if (actionCode == ACTION_CODE_FATAL) {
+ mAnalyticsItem->setInt32(kCodecError, err);
+ mAnalyticsItem->setInt32(kCodecErrorState, mState);
+ flushAnalyticsItem();
+ initAnalyticsItem();
+ }
setState(actionCode == ACTION_CODE_FATAL ?
UNINITIALIZED : INITIALIZED);
break;
@@ -1423,6 +1451,12 @@
case STARTING:
{
+ if (actionCode == ACTION_CODE_FATAL) {
+ mAnalyticsItem->setInt32(kCodecError, err);
+ mAnalyticsItem->setInt32(kCodecErrorState, mState);
+ flushAnalyticsItem();
+ initAnalyticsItem();
+ }
setState(actionCode == ACTION_CODE_FATAL ?
UNINITIALIZED : CONFIGURED);
break;
@@ -1459,6 +1493,11 @@
case FLUSHING:
{
if (actionCode == ACTION_CODE_FATAL) {
+ mAnalyticsItem->setInt32(kCodecError, err);
+ mAnalyticsItem->setInt32(kCodecErrorState, mState);
+ flushAnalyticsItem();
+ initAnalyticsItem();
+
setState(UNINITIALIZED);
} else {
setState(
@@ -1487,6 +1526,10 @@
setState(INITIALIZED);
break;
default:
+ mAnalyticsItem->setInt32(kCodecError, err);
+ mAnalyticsItem->setInt32(kCodecErrorState, mState);
+ flushAnalyticsItem();
+ initAnalyticsItem();
setState(UNINITIALIZED);
break;
}
@@ -1591,6 +1634,19 @@
}
setState(CONFIGURED);
(new AMessage)->postReply(mReplyID);
+
+ // augment our media metrics info, now that we know more things
+ if (mAnalyticsItem != NULL) {
+ sp<AMessage> format;
+ if (mConfigureMsg != NULL &&
+ mConfigureMsg->findMessage("format", &format)) {
+ // format includes: mime
+ AString mime;
+ if (format->findString("mime", &mime)) {
+ mAnalyticsItem->setCString(kCodecMime, mime.c_str());
+ }
+ }
+ }
break;
}
@@ -2816,6 +2872,9 @@
Mutex::Autolock al(mBufferLock);
info->mOwnedByClient = false;
info->mData.clear();
+ if (mAnalyticsItem != NULL) {
+ mAnalyticsItem->addInt64(kCodecBytesIn, size);
+ }
}
return err;
diff --git a/media/libstagefright/MediaCodecList.cpp b/media/libstagefright/MediaCodecList.cpp
index 1dcba29..4652594 100644
--- a/media/libstagefright/MediaCodecList.cpp
+++ b/media/libstagefright/MediaCodecList.cpp
@@ -24,17 +24,17 @@
#include <media/IMediaCodecList.h>
#include <media/IMediaPlayerService.h>
-#include <media/IResourceManagerService.h>
+#include <media/IMediaCodecService.h>
#include <media/MediaCodecInfo.h>
-#include <media/MediaResourcePolicy.h>
+#include <media/MediaDefs.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/AMessage.h>
-#include <media/stagefright/ACodec.h>
-#include <media/stagefright/MediaCodec.h>
#include <media/stagefright/MediaCodecList.h>
#include <media/stagefright/MediaErrors.h>
-#include <media/stagefright/OMXClient.h>
+#include <media/stagefright/OmxInfoBuilder.h>
+#include <media/stagefright/omx/OMXUtils.h>
+#include <media/stagefright/xmlparser/MediaCodecsXmlParser.h>
#include <sys/stat.h>
#include <utils/threads.h>
@@ -42,20 +42,20 @@
#include <cutils/properties.h>
#include <expat.h>
+#include <algorithm>
+
namespace android {
-static Mutex sInitMutex;
+namespace {
-static bool parseBoolean(const char *s) {
- if (!strcasecmp(s, "true") || !strcasecmp(s, "yes") || !strcasecmp(s, "y")) {
- return true;
- }
- char *end;
- unsigned long res = strtoul(s, &end, 10);
- return *s != '\0' && *end == '\0' && res > 0;
-}
+Mutex sInitMutex;
-static bool isProfilingNeeded() {
+Mutex sRemoteInitMutex;
+
+constexpr const char* kProfilingResults =
+ MediaCodecsXmlParser::defaultProfilingResultsXmlPath;
+
+bool isProfilingNeeded() {
int8_t value = property_get_bool("debug.stagefright.profilecodec", 0);
if (value == 0) {
return false;
@@ -78,6 +78,10 @@
return profilingNeeded;
}
+OmxInfoBuilder sOmxInfoBuilder;
+
+} // unnamed namespace
+
// static
sp<IMediaCodecList> MediaCodecList::sCodecList;
@@ -86,42 +90,42 @@
ALOGV("Enter profilerThreadWrapper.");
remove(kProfilingResults); // remove previous result so that it won't be loaded to
// the new MediaCodecList
- MediaCodecList *codecList = new MediaCodecList();
+ sp<MediaCodecList> codecList(new MediaCodecList(&sOmxInfoBuilder));
if (codecList->initCheck() != OK) {
ALOGW("Failed to create a new MediaCodecList, skipping codec profiling.");
- delete codecList;
- return NULL;
+ return nullptr;
}
- Vector<sp<MediaCodecInfo>> infos;
- for (size_t i = 0; i < codecList->countCodecs(); ++i) {
- infos.push_back(codecList->getCodecInfo(i));
- }
+ const auto& infos = codecList->mCodecInfos;
ALOGV("Codec profiling started.");
- profileCodecs(infos);
+ profileCodecs(infos, kProfilingResults);
ALOGV("Codec profiling completed.");
- codecList->parseTopLevelXMLFile(kProfilingResults, true /* ignore_errors */);
+ codecList = new MediaCodecList(&sOmxInfoBuilder);
+ if (codecList->initCheck() != OK) {
+ ALOGW("Failed to parse profiling results.");
+ return nullptr;
+ }
{
Mutex::Autolock autoLock(sInitMutex);
sCodecList = codecList;
}
- return NULL;
+ return nullptr;
}
// static
sp<IMediaCodecList> MediaCodecList::getLocalInstance() {
Mutex::Autolock autoLock(sInitMutex);
- if (sCodecList == NULL) {
- MediaCodecList *codecList = new MediaCodecList;
+ if (sCodecList == nullptr) {
+ MediaCodecList *codecList = new MediaCodecList(&sOmxInfoBuilder);
if (codecList->initCheck() == OK) {
sCodecList = codecList;
if (isProfilingNeeded()) {
ALOGV("Codec profiling needed, will be run in separated thread.");
pthread_t profiler;
- if (pthread_create(&profiler, NULL, profilerThreadWrapper, NULL) != 0) {
+ if (pthread_create(&profiler, nullptr, profilerThreadWrapper, nullptr) != 0) {
ALOGW("Failed to create thread for codec profiling.");
}
}
@@ -134,8 +138,6 @@
return sCodecList;
}
-static Mutex sRemoteInitMutex;
-
sp<IMediaCodecList> MediaCodecList::sRemoteList;
sp<MediaCodecList::BinderDeathObserver> MediaCodecList::sBinderDeathObserver;
@@ -149,19 +151,19 @@
// static
sp<IMediaCodecList> MediaCodecList::getInstance() {
Mutex::Autolock _l(sRemoteInitMutex);
- if (sRemoteList == NULL) {
+ if (sRemoteList == nullptr) {
sp<IBinder> binder =
defaultServiceManager()->getService(String16("media.player"));
sp<IMediaPlayerService> service =
interface_cast<IMediaPlayerService>(binder);
- if (service.get() != NULL) {
+ if (service.get() != nullptr) {
sRemoteList = service->getCodecList();
- if (sRemoteList != NULL) {
+ if (sRemoteList != nullptr) {
sBinderDeathObserver = new BinderDeathObserver();
binder->linkToDeath(sBinderDeathObserver.get());
}
}
- if (sRemoteList == NULL) {
+ if (sRemoteList == nullptr) {
// if failed to get remote list, create local list
sRemoteList = getLocalInstance();
}
@@ -169,175 +171,11 @@
return sRemoteList;
}
-// Treblized media codec list will be located in /odm/etc or /vendor/etc.
-static const char *kConfigLocationList[] =
- {"/odm/etc", "/vendor/etc", "/etc"};
-static const int kConfigLocationListSize =
- (sizeof(kConfigLocationList) / sizeof(kConfigLocationList[0]));
-
-#define MEDIA_CODECS_CONFIG_FILE_PATH_MAX_LENGTH 128
-
-static bool findMediaCodecListFileFullPath(const char *file_name, char *out_path) {
- for (int i = 0; i < kConfigLocationListSize; i++) {
- snprintf(out_path,
- MEDIA_CODECS_CONFIG_FILE_PATH_MAX_LENGTH,
- "%s/%s",
- kConfigLocationList[i],
- file_name);
- struct stat file_stat;
- if (stat(out_path, &file_stat) == 0 && S_ISREG(file_stat.st_mode)) {
- return true;
- }
- }
- return false;
-}
-
-MediaCodecList::MediaCodecList()
- : mInitCheck(NO_INIT),
- mUpdate(false),
- mGlobalSettings(new AMessage()) {
- char config_file_path[MEDIA_CODECS_CONFIG_FILE_PATH_MAX_LENGTH];
- if (findMediaCodecListFileFullPath("media_codecs.xml", config_file_path)) {
- parseTopLevelXMLFile(config_file_path);
- }
- if (findMediaCodecListFileFullPath("media_codecs_performance.xml",
- config_file_path)) {
- parseTopLevelXMLFile(config_file_path, true/* ignore_errors */);
- }
- parseTopLevelXMLFile(kProfilingResults, true/* ignore_errors */);
-}
-
-void MediaCodecList::parseTopLevelXMLFile(const char *codecs_xml, bool ignore_errors) {
- // get href_base
- const char *href_base_end = strrchr(codecs_xml, '/');
- if (href_base_end != NULL) {
- mHrefBase = AString(codecs_xml, href_base_end - codecs_xml + 1);
- }
-
- mInitCheck = OK; // keeping this here for safety
- mCurrentSection = SECTION_TOPLEVEL;
- mDepth = 0;
-
- OMXClient client;
- mInitCheck = client.connect();
- if (mInitCheck != OK) {
- return; // this may fail if IMediaPlayerService is not available.
- }
- parseXMLFile(codecs_xml);
-
- if (mInitCheck != OK) {
- if (ignore_errors) {
- mInitCheck = OK;
- return;
- }
- mCodecInfos.clear();
- return;
- }
-
- Vector<MediaResourcePolicy> policies;
- AString value;
- if (mGlobalSettings->findString(kPolicySupportsMultipleSecureCodecs, &value)) {
- policies.push_back(
- MediaResourcePolicy(
- String8(kPolicySupportsMultipleSecureCodecs),
- String8(value.c_str())));
- }
- if (mGlobalSettings->findString(kPolicySupportsSecureWithNonSecureCodec, &value)) {
- policies.push_back(
- MediaResourcePolicy(
- String8(kPolicySupportsSecureWithNonSecureCodec),
- String8(value.c_str())));
- }
- if (policies.size() > 0) {
- sp<IServiceManager> sm = defaultServiceManager();
- sp<IBinder> binder = sm->getService(String16("media.resource_manager"));
- sp<IResourceManagerService> service = interface_cast<IResourceManagerService>(binder);
- if (service == NULL) {
- ALOGE("MediaCodecList: failed to get ResourceManagerService");
- } else {
- service->config(policies);
- }
- }
-
- for (size_t i = mCodecInfos.size(); i > 0;) {
- i--;
- const MediaCodecInfo &info = *mCodecInfos.itemAt(i).get();
- if (info.mCaps.size() == 0) {
- // No types supported by this component???
- ALOGW("Component %s does not support any type of media?",
- info.mName.c_str());
-
- mCodecInfos.removeAt(i);
-#if LOG_NDEBUG == 0
- } else {
- for (size_t type_ix = 0; type_ix < info.mCaps.size(); ++type_ix) {
- AString mime = info.mCaps.keyAt(type_ix);
- const sp<MediaCodecInfo::Capabilities> &caps = info.mCaps.valueAt(type_ix);
-
- ALOGV("%s codec info for %s: %s", info.mName.c_str(), mime.c_str(),
- caps->getDetails()->debugString().c_str());
- ALOGV(" flags=%d", caps->getFlags());
- {
- Vector<uint32_t> colorFormats;
- caps->getSupportedColorFormats(&colorFormats);
- AString nice;
- for (size_t ix = 0; ix < colorFormats.size(); ix++) {
- if (ix > 0) {
- nice.append(", ");
- }
- nice.append(colorFormats.itemAt(ix));
- }
- ALOGV(" colors=[%s]", nice.c_str());
- }
- {
- Vector<MediaCodecInfo::ProfileLevel> profileLevels;
- caps->getSupportedProfileLevels(&profileLevels);
- AString nice;
- for (size_t ix = 0; ix < profileLevels.size(); ix++) {
- if (ix > 0) {
- nice.append(", ");
- }
- const MediaCodecInfo::ProfileLevel &pl =
- profileLevels.itemAt(ix);
- nice.append(pl.mProfile);
- nice.append("/");
- nice.append(pl.mLevel);
- }
- ALOGV(" levels=[%s]", nice.c_str());
- }
- {
- AString quirks;
- for (size_t ix = 0; ix < info.mQuirks.size(); ix++) {
- if (ix > 0) {
- quirks.append(", ");
- }
- quirks.append(info.mQuirks[ix]);
- }
- ALOGV(" quirks=[%s]", quirks.c_str());
- }
- }
-#endif
- }
- }
-
-#if 0
- for (size_t i = 0; i < mCodecInfos.size(); ++i) {
- const CodecInfo &info = mCodecInfos.itemAt(i);
-
- AString line = info.mName;
- line.append(" supports ");
- for (size_t j = 0; j < mTypes.size(); ++j) {
- uint32_t value = mTypes.valueAt(j);
-
- if (info.mTypes & (1ul << value)) {
- line.append(mTypes.keyAt(j));
- line.append(" ");
- }
- }
-
- ALOGI("%s", line.c_str());
- }
-#endif
+MediaCodecList::MediaCodecList(MediaCodecListBuilderBase* builder) {
+ mGlobalSettings = new AMessage();
+ mCodecInfos.clear();
+ MediaCodecListWriter writer(this);
+ mInitCheck = builder->buildMediaCodecList(&writer);
}
MediaCodecList::~MediaCodecList() {
@@ -347,531 +185,21 @@
return mInitCheck;
}
-void MediaCodecList::parseXMLFile(const char *path) {
- FILE *file = fopen(path, "r");
-
- if (file == NULL) {
- ALOGW("unable to open media codecs configuration xml file: %s", path);
- mInitCheck = NAME_NOT_FOUND;
- return;
- }
-
- XML_Parser parser = ::XML_ParserCreate(NULL);
- CHECK(parser != NULL);
-
- ::XML_SetUserData(parser, this);
- ::XML_SetElementHandler(
- parser, StartElementHandlerWrapper, EndElementHandlerWrapper);
-
- const int BUFF_SIZE = 512;
- while (mInitCheck == OK) {
- void *buff = ::XML_GetBuffer(parser, BUFF_SIZE);
- if (buff == NULL) {
- ALOGE("failed in call to XML_GetBuffer()");
- mInitCheck = UNKNOWN_ERROR;
- break;
- }
-
- int bytes_read = ::fread(buff, 1, BUFF_SIZE, file);
- if (bytes_read < 0) {
- ALOGE("failed in call to read");
- mInitCheck = ERROR_IO;
- break;
- }
-
- XML_Status status = ::XML_ParseBuffer(parser, bytes_read, bytes_read == 0);
- if (status != XML_STATUS_OK) {
- ALOGE("malformed (%s)", ::XML_ErrorString(::XML_GetErrorCode(parser)));
- mInitCheck = ERROR_MALFORMED;
- break;
- }
-
- if (bytes_read == 0) {
- break;
- }
- }
-
- ::XML_ParserFree(parser);
-
- fclose(file);
- file = NULL;
+MediaCodecListWriter::MediaCodecListWriter(MediaCodecList* list) :
+ mList(list) {
}
-// static
-void MediaCodecList::StartElementHandlerWrapper(
- void *me, const char *name, const char **attrs) {
- static_cast<MediaCodecList *>(me)->startElementHandler(name, attrs);
+void MediaCodecListWriter::addGlobalSetting(
+ const char* key, const char* value) {
+ mList->mGlobalSettings->setString(key, value);
}
-// static
-void MediaCodecList::EndElementHandlerWrapper(void *me, const char *name) {
- static_cast<MediaCodecList *>(me)->endElementHandler(name);
-}
-
-status_t MediaCodecList::includeXMLFile(const char **attrs) {
- const char *href = NULL;
- size_t i = 0;
- while (attrs[i] != NULL) {
- if (!strcmp(attrs[i], "href")) {
- if (attrs[i + 1] == NULL) {
- return -EINVAL;
- }
- href = attrs[i + 1];
- ++i;
- } else {
- return -EINVAL;
- }
- ++i;
- }
-
- // For security reasons and for simplicity, file names can only contain
- // [a-zA-Z0-9_.] and must start with media_codecs_ and end with .xml
- for (i = 0; href[i] != '\0'; i++) {
- if (href[i] == '.' || href[i] == '_' ||
- (href[i] >= '0' && href[i] <= '9') ||
- (href[i] >= 'A' && href[i] <= 'Z') ||
- (href[i] >= 'a' && href[i] <= 'z')) {
- continue;
- }
- ALOGE("invalid include file name: %s", href);
- return -EINVAL;
- }
-
- AString filename = href;
- if (!filename.startsWith("media_codecs_") ||
- !filename.endsWith(".xml")) {
- ALOGE("invalid include file name: %s", href);
- return -EINVAL;
- }
- filename.insert(mHrefBase, 0);
-
- parseXMLFile(filename.c_str());
- return mInitCheck;
-}
-
-void MediaCodecList::startElementHandler(
- const char *name, const char **attrs) {
- if (mInitCheck != OK) {
- return;
- }
-
- bool inType = true;
-
- if (!strcmp(name, "Include")) {
- mInitCheck = includeXMLFile(attrs);
- if (mInitCheck == OK) {
- mPastSections.push(mCurrentSection);
- mCurrentSection = SECTION_INCLUDE;
- }
- ++mDepth;
- return;
- }
-
- switch (mCurrentSection) {
- case SECTION_TOPLEVEL:
- {
- if (!strcmp(name, "Decoders")) {
- mCurrentSection = SECTION_DECODERS;
- } else if (!strcmp(name, "Encoders")) {
- mCurrentSection = SECTION_ENCODERS;
- } else if (!strcmp(name, "Settings")) {
- mCurrentSection = SECTION_SETTINGS;
- }
- break;
- }
-
- case SECTION_SETTINGS:
- {
- if (!strcmp(name, "Setting")) {
- mInitCheck = addSettingFromAttributes(attrs);
- }
- break;
- }
-
- case SECTION_DECODERS:
- {
- if (!strcmp(name, "MediaCodec")) {
- mInitCheck =
- addMediaCodecFromAttributes(false /* encoder */, attrs);
-
- mCurrentSection = SECTION_DECODER;
- }
- break;
- }
-
- case SECTION_ENCODERS:
- {
- if (!strcmp(name, "MediaCodec")) {
- mInitCheck =
- addMediaCodecFromAttributes(true /* encoder */, attrs);
-
- mCurrentSection = SECTION_ENCODER;
- }
- break;
- }
-
- case SECTION_DECODER:
- case SECTION_ENCODER:
- {
- if (!strcmp(name, "Quirk")) {
- mInitCheck = addQuirk(attrs);
- } else if (!strcmp(name, "Type")) {
- mInitCheck = addTypeFromAttributes(attrs);
- mCurrentSection =
- (mCurrentSection == SECTION_DECODER
- ? SECTION_DECODER_TYPE : SECTION_ENCODER_TYPE);
- }
- }
- inType = false;
- // fall through
-
- case SECTION_DECODER_TYPE:
- case SECTION_ENCODER_TYPE:
- {
- // ignore limits and features specified outside of type
- bool outside = !inType && !mCurrentInfo->mHasSoleMime;
- if (outside && (!strcmp(name, "Limit") || !strcmp(name, "Feature"))) {
- ALOGW("ignoring %s specified outside of a Type", name);
- } else if (!strcmp(name, "Limit")) {
- mInitCheck = addLimit(attrs);
- } else if (!strcmp(name, "Feature")) {
- mInitCheck = addFeature(attrs);
- }
- break;
- }
-
- default:
- break;
- }
-
- ++mDepth;
-}
-
-void MediaCodecList::endElementHandler(const char *name) {
- if (mInitCheck != OK) {
- return;
- }
-
- switch (mCurrentSection) {
- case SECTION_SETTINGS:
- {
- if (!strcmp(name, "Settings")) {
- mCurrentSection = SECTION_TOPLEVEL;
- }
- break;
- }
-
- case SECTION_DECODERS:
- {
- if (!strcmp(name, "Decoders")) {
- mCurrentSection = SECTION_TOPLEVEL;
- }
- break;
- }
-
- case SECTION_ENCODERS:
- {
- if (!strcmp(name, "Encoders")) {
- mCurrentSection = SECTION_TOPLEVEL;
- }
- break;
- }
-
- case SECTION_DECODER_TYPE:
- case SECTION_ENCODER_TYPE:
- {
- if (!strcmp(name, "Type")) {
- mCurrentSection =
- (mCurrentSection == SECTION_DECODER_TYPE
- ? SECTION_DECODER : SECTION_ENCODER);
-
- mCurrentInfo->complete();
- }
- break;
- }
-
- case SECTION_DECODER:
- {
- if (!strcmp(name, "MediaCodec")) {
- mCurrentSection = SECTION_DECODERS;
- mCurrentInfo->complete();
- mCurrentInfo = NULL;
- }
- break;
- }
-
- case SECTION_ENCODER:
- {
- if (!strcmp(name, "MediaCodec")) {
- mCurrentSection = SECTION_ENCODERS;
- mCurrentInfo->complete();;
- mCurrentInfo = NULL;
- }
- break;
- }
-
- case SECTION_INCLUDE:
- {
- if (!strcmp(name, "Include") && mPastSections.size() > 0) {
- mCurrentSection = mPastSections.top();
- mPastSections.pop();
- }
- break;
- }
-
- default:
- break;
- }
-
- --mDepth;
-}
-
-status_t MediaCodecList::addSettingFromAttributes(const char **attrs) {
- const char *name = NULL;
- const char *value = NULL;
- const char *update = NULL;
-
- size_t i = 0;
- while (attrs[i] != NULL) {
- if (!strcmp(attrs[i], "name")) {
- if (attrs[i + 1] == NULL) {
- return -EINVAL;
- }
- name = attrs[i + 1];
- ++i;
- } else if (!strcmp(attrs[i], "value")) {
- if (attrs[i + 1] == NULL) {
- return -EINVAL;
- }
- value = attrs[i + 1];
- ++i;
- } else if (!strcmp(attrs[i], "update")) {
- if (attrs[i + 1] == NULL) {
- return -EINVAL;
- }
- update = attrs[i + 1];
- ++i;
- } else {
- return -EINVAL;
- }
-
- ++i;
- }
-
- if (name == NULL || value == NULL) {
- return -EINVAL;
- }
-
- mUpdate = (update != NULL) && parseBoolean(update);
- if (mUpdate != mGlobalSettings->contains(name)) {
- return -EINVAL;
- }
-
- mGlobalSettings->setString(name, value);
- return OK;
-}
-
-void MediaCodecList::setCurrentCodecInfo(bool encoder, const char *name, const char *type) {
- for (size_t i = 0; i < mCodecInfos.size(); ++i) {
- if (AString(name) == mCodecInfos[i]->getCodecName()) {
- if (mCodecInfos[i]->getCapabilitiesFor(type) == NULL) {
- ALOGW("Overrides with an unexpected mime %s", type);
- // Create a new MediaCodecInfo (but don't add it to mCodecInfos) to hold the
- // overrides we don't want.
- mCurrentInfo = new MediaCodecInfo(name, encoder, type);
- } else {
- mCurrentInfo = mCodecInfos.editItemAt(i);
- mCurrentInfo->updateMime(type); // to set the current cap
- }
- return;
- }
- }
- mCurrentInfo = new MediaCodecInfo(name, encoder, type);
- // The next step involves trying to load the codec, which may
- // fail. Only list the codec if this succeeds.
- // However, keep mCurrentInfo object around until parsing
- // of full codec info is completed.
- if (initializeCapabilities(type) == OK) {
- mCodecInfos.push_back(mCurrentInfo);
- }
-}
-
-status_t MediaCodecList::addMediaCodecFromAttributes(
- bool encoder, const char **attrs) {
- const char *name = NULL;
- const char *type = NULL;
- const char *update = NULL;
-
- size_t i = 0;
- while (attrs[i] != NULL) {
- if (!strcmp(attrs[i], "name")) {
- if (attrs[i + 1] == NULL) {
- return -EINVAL;
- }
- name = attrs[i + 1];
- ++i;
- } else if (!strcmp(attrs[i], "type")) {
- if (attrs[i + 1] == NULL) {
- return -EINVAL;
- }
- type = attrs[i + 1];
- ++i;
- } else if (!strcmp(attrs[i], "update")) {
- if (attrs[i + 1] == NULL) {
- return -EINVAL;
- }
- update = attrs[i + 1];
- ++i;
- } else {
- return -EINVAL;
- }
-
- ++i;
- }
-
- if (name == NULL) {
- return -EINVAL;
- }
-
- mUpdate = (update != NULL) && parseBoolean(update);
- ssize_t index = -1;
- for (size_t i = 0; i < mCodecInfos.size(); ++i) {
- if (AString(name) == mCodecInfos[i]->getCodecName()) {
- index = i;
- }
- }
- if (mUpdate != (index >= 0)) {
- return -EINVAL;
- }
-
- if (index >= 0) {
- // existing codec
- mCurrentInfo = mCodecInfos.editItemAt(index);
- if (type != NULL) {
- // existing type
- if (mCodecInfos[index]->getCapabilitiesFor(type) == NULL) {
- return -EINVAL;
- }
- mCurrentInfo->updateMime(type);
- }
- } else {
- // new codec
- mCurrentInfo = new MediaCodecInfo(name, encoder, type);
- // The next step involves trying to load the codec, which may
- // fail. Only list the codec if this succeeds.
- // However, keep mCurrentInfo object around until parsing
- // of full codec info is completed.
- if (initializeCapabilities(type) == OK) {
- mCodecInfos.push_back(mCurrentInfo);
- }
- }
-
- return OK;
-}
-
-status_t MediaCodecList::initializeCapabilities(const char *type) {
- if (type == NULL) {
- return OK;
- }
-
- ALOGV("initializeCapabilities %s:%s",
- mCurrentInfo->mName.c_str(), type);
-
- sp<MediaCodecInfo::Capabilities> caps;
- status_t err = MediaCodec::QueryCapabilities(
- mCurrentInfo->mName,
- type,
- mCurrentInfo->mIsEncoder,
- &caps);
- if (err != OK) {
- return err;
- } else if (caps == NULL) {
- ALOGE("MediaCodec::QueryCapabilities returned OK but no capabilities for '%s':'%s':'%s'",
- mCurrentInfo->mName.c_str(), type,
- mCurrentInfo->mIsEncoder ? "encoder" : "decoder");
- return UNKNOWN_ERROR;
- }
-
- return mCurrentInfo->initializeCapabilities(caps);
-}
-
-status_t MediaCodecList::addQuirk(const char **attrs) {
- const char *name = NULL;
-
- size_t i = 0;
- while (attrs[i] != NULL) {
- if (!strcmp(attrs[i], "name")) {
- if (attrs[i + 1] == NULL) {
- return -EINVAL;
- }
- name = attrs[i + 1];
- ++i;
- } else {
- return -EINVAL;
- }
-
- ++i;
- }
-
- if (name == NULL) {
- return -EINVAL;
- }
-
- mCurrentInfo->addQuirk(name);
- return OK;
-}
-
-status_t MediaCodecList::addTypeFromAttributes(const char **attrs) {
- const char *name = NULL;
- const char *update = NULL;
-
- size_t i = 0;
- while (attrs[i] != NULL) {
- if (!strcmp(attrs[i], "name")) {
- if (attrs[i + 1] == NULL) {
- return -EINVAL;
- }
- name = attrs[i + 1];
- ++i;
- } else if (!strcmp(attrs[i], "update")) {
- if (attrs[i + 1] == NULL) {
- return -EINVAL;
- }
- update = attrs[i + 1];
- ++i;
- } else {
- return -EINVAL;
- }
-
- ++i;
- }
-
- if (name == NULL) {
- return -EINVAL;
- }
-
- bool isExistingType = (mCurrentInfo->getCapabilitiesFor(name) != NULL);
- if (mUpdate != isExistingType) {
- return -EINVAL;
- }
-
- status_t ret;
- if (mUpdate) {
- ret = mCurrentInfo->updateMime(name);
- } else {
- ret = mCurrentInfo->addMime(name);
- }
-
- if (ret != OK) {
- return ret;
- }
-
- // The next step involves trying to load the codec, which may
- // fail. Handle this gracefully (by not reporting such mime).
- if (!mUpdate && initializeCapabilities(name) != OK) {
- mCurrentInfo->removeMime(name);
- }
- return OK;
+std::unique_ptr<MediaCodecInfoWriter>
+ MediaCodecListWriter::addMediaCodecInfo() {
+ sp<MediaCodecInfo> info = new MediaCodecInfo();
+ mList->mCodecInfos.push_back(info);
+ return std::unique_ptr<MediaCodecInfoWriter>(
+ new MediaCodecInfoWriter(info.get()));
}
// legacy method for non-advanced codecs
@@ -882,15 +210,15 @@
"feature-tunneled-playback",
};
- size_t numCodecs = mCodecInfos.size();
- for (; startIndex < numCodecs; ++startIndex) {
- const MediaCodecInfo &info = *mCodecInfos.itemAt(startIndex).get();
+ size_t numCodecInfos = mCodecInfos.size();
+ for (; startIndex < numCodecInfos; ++startIndex) {
+ const MediaCodecInfo &info = *mCodecInfos[startIndex];
if (info.isEncoder() != encoder) {
continue;
}
sp<MediaCodecInfo::Capabilities> capabilities = info.getCapabilitiesFor(type);
- if (capabilities == NULL) {
+ if (capabilities == nullptr) {
continue;
}
const sp<AMessage> &details = capabilities->getDetails();
@@ -913,223 +241,9 @@
return -ENOENT;
}
-static status_t limitFoundMissingAttr(const AString &name, const char *attr, bool found = true) {
- ALOGE("limit '%s' with %s'%s' attribute", name.c_str(),
- (found ? "" : "no "), attr);
- return -EINVAL;
-}
-
-static status_t limitError(const AString &name, const char *msg) {
- ALOGE("limit '%s' %s", name.c_str(), msg);
- return -EINVAL;
-}
-
-static status_t limitInvalidAttr(const AString &name, const char *attr, const AString &value) {
- ALOGE("limit '%s' with invalid '%s' attribute (%s)", name.c_str(),
- attr, value.c_str());
- return -EINVAL;
-}
-
-status_t MediaCodecList::addLimit(const char **attrs) {
- sp<AMessage> msg = new AMessage();
-
- size_t i = 0;
- while (attrs[i] != NULL) {
- if (attrs[i + 1] == NULL) {
- return -EINVAL;
- }
-
- // attributes with values
- if (!strcmp(attrs[i], "name")
- || !strcmp(attrs[i], "default")
- || !strcmp(attrs[i], "in")
- || !strcmp(attrs[i], "max")
- || !strcmp(attrs[i], "min")
- || !strcmp(attrs[i], "range")
- || !strcmp(attrs[i], "ranges")
- || !strcmp(attrs[i], "scale")
- || !strcmp(attrs[i], "value")) {
- msg->setString(attrs[i], attrs[i + 1]);
- ++i;
- } else {
- return -EINVAL;
- }
- ++i;
- }
-
- AString name;
- if (!msg->findString("name", &name)) {
- ALOGE("limit with no 'name' attribute");
- return -EINVAL;
- }
-
- // size, blocks, bitrate, frame-rate, blocks-per-second, aspect-ratio,
- // measured-frame-rate, measured-blocks-per-second: range
- // quality: range + default + [scale]
- // complexity: range + default
- bool found;
-
- if (name == "aspect-ratio" || name == "bitrate" || name == "block-count"
- || name == "blocks-per-second" || name == "complexity"
- || name == "frame-rate" || name == "quality" || name == "size"
- || name == "measured-blocks-per-second" || name.startsWith("measured-frame-rate-")) {
- AString min, max;
- if (msg->findString("min", &min) && msg->findString("max", &max)) {
- min.append("-");
- min.append(max);
- if (msg->contains("range") || msg->contains("value")) {
- return limitError(name, "has 'min' and 'max' as well as 'range' or "
- "'value' attributes");
- }
- msg->setString("range", min);
- } else if (msg->contains("min") || msg->contains("max")) {
- return limitError(name, "has only 'min' or 'max' attribute");
- } else if (msg->findString("value", &max)) {
- min = max;
- min.append("-");
- min.append(max);
- if (msg->contains("range")) {
- return limitError(name, "has both 'range' and 'value' attributes");
- }
- msg->setString("range", min);
- }
-
- AString range, scale = "linear", def, in_;
- if (!msg->findString("range", &range)) {
- return limitError(name, "with no 'range', 'value' or 'min'/'max' attributes");
- }
-
- if ((name == "quality" || name == "complexity") ^
- (found = msg->findString("default", &def))) {
- return limitFoundMissingAttr(name, "default", found);
- }
- if (name != "quality" && msg->findString("scale", &scale)) {
- return limitFoundMissingAttr(name, "scale");
- }
- if ((name == "aspect-ratio") ^ (found = msg->findString("in", &in_))) {
- return limitFoundMissingAttr(name, "in", found);
- }
-
- if (name == "aspect-ratio") {
- if (!(in_ == "pixels") && !(in_ == "blocks")) {
- return limitInvalidAttr(name, "in", in_);
- }
- in_.erase(5, 1); // (pixel|block)-aspect-ratio
- in_.append("-");
- in_.append(name);
- name = in_;
- }
- if (name == "quality") {
- mCurrentInfo->addDetail("quality-scale", scale);
- }
- if (name == "quality" || name == "complexity") {
- AString tag = name;
- tag.append("-default");
- mCurrentInfo->addDetail(tag, def);
- }
- AString tag = name;
- tag.append("-range");
- mCurrentInfo->addDetail(tag, range);
- } else {
- AString max, value, ranges;
- if (msg->contains("default")) {
- return limitFoundMissingAttr(name, "default");
- } else if (msg->contains("in")) {
- return limitFoundMissingAttr(name, "in");
- } else if ((name == "channel-count" || name == "concurrent-instances") ^
- (found = msg->findString("max", &max))) {
- return limitFoundMissingAttr(name, "max", found);
- } else if (msg->contains("min")) {
- return limitFoundMissingAttr(name, "min");
- } else if (msg->contains("range")) {
- return limitFoundMissingAttr(name, "range");
- } else if ((name == "sample-rate") ^
- (found = msg->findString("ranges", &ranges))) {
- return limitFoundMissingAttr(name, "ranges", found);
- } else if (msg->contains("scale")) {
- return limitFoundMissingAttr(name, "scale");
- } else if ((name == "alignment" || name == "block-size") ^
- (found = msg->findString("value", &value))) {
- return limitFoundMissingAttr(name, "value", found);
- }
-
- if (max.size()) {
- AString tag = "max-";
- tag.append(name);
- mCurrentInfo->addDetail(tag, max);
- } else if (value.size()) {
- mCurrentInfo->addDetail(name, value);
- } else if (ranges.size()) {
- AString tag = name;
- tag.append("-ranges");
- mCurrentInfo->addDetail(tag, ranges);
- } else {
- ALOGW("Ignoring unrecognized limit '%s'", name.c_str());
- }
- }
- return OK;
-}
-
-status_t MediaCodecList::addFeature(const char **attrs) {
- size_t i = 0;
- const char *name = NULL;
- int32_t optional = -1;
- int32_t required = -1;
- const char *value = NULL;
-
- while (attrs[i] != NULL) {
- if (attrs[i + 1] == NULL) {
- return -EINVAL;
- }
-
- // attributes with values
- if (!strcmp(attrs[i], "name")) {
- name = attrs[i + 1];
- ++i;
- } else if (!strcmp(attrs[i], "optional") || !strcmp(attrs[i], "required")) {
- int value = (int)parseBoolean(attrs[i + 1]);
- if (!strcmp(attrs[i], "optional")) {
- optional = value;
- } else {
- required = value;
- }
- ++i;
- } else if (!strcmp(attrs[i], "value")) {
- value = attrs[i + 1];
- ++i;
- } else {
- return -EINVAL;
- }
- ++i;
- }
- if (name == NULL) {
- ALOGE("feature with no 'name' attribute");
- return -EINVAL;
- }
-
- if (optional == required && optional != -1) {
- ALOGE("feature '%s' is both/neither optional and required", name);
- return -EINVAL;
- }
-
- if ((optional != -1 || required != -1) && (value != NULL)) {
- ALOGE("feature '%s' has both a value and optional/required attribute", name);
- return -EINVAL;
- }
-
- if (value != NULL) {
- mCurrentInfo->addFeature(name, value);
- } else {
- mCurrentInfo->addFeature(name, (required == 1) || (optional == 0));
- }
- return OK;
-}
-
ssize_t MediaCodecList::findCodecByName(const char *name) const {
for (size_t i = 0; i < mCodecInfos.size(); ++i) {
- const MediaCodecInfo &info = *mCodecInfos.itemAt(i).get();
-
- if (info.mName == name) {
+ if (strcmp(mCodecInfos[i]->getCodecName(), name) == 0) {
return i;
}
}
@@ -1167,11 +281,15 @@
//static
void MediaCodecList::findMatchingCodecs(
- const char *mime, bool encoder, uint32_t flags, Vector<AString> *matches) {
+ const char *mime, bool encoder, uint32_t flags,
+ Vector<AString> *matches, Vector<AString> *owners) {
matches->clear();
+ if (owners != nullptr) {
+ owners->clear();
+ }
const sp<IMediaCodecList> list = getInstance();
- if (list == NULL) {
+ if (list == nullptr) {
return;
}
@@ -1187,45 +305,27 @@
index = matchIndex + 1;
const sp<MediaCodecInfo> info = list->getCodecInfo(matchIndex);
- CHECK(info != NULL);
+ CHECK(info != nullptr);
AString componentName = info->getCodecName();
if ((flags & kHardwareCodecsOnly) && isSoftwareCodec(componentName)) {
ALOGV("skipping SW codec '%s'", componentName.c_str());
} else {
matches->push(componentName);
+ if (owners != nullptr) {
+ owners->push(AString(info->getOwnerName()));
+ }
ALOGV("matching '%s'", componentName.c_str());
}
}
- if (flags & kPreferSoftwareCodecs || property_get_bool("debug.stagefright.swcodec", false)) {
+ if (flags & kPreferSoftwareCodecs ||
+ property_get_bool("debug.stagefright.swcodec", false)) {
matches->sort(compareSoftwareCodecsFirst);
}
}
-// static
-uint32_t MediaCodecList::getQuirksFor(const char *componentName) {
- const sp<IMediaCodecList> list = getInstance();
- if (list == NULL) {
- return 0;
- }
-
- ssize_t ix = list->findCodecByName(componentName);
- if (ix < 0) {
- return 0;
- }
-
- const sp<MediaCodecInfo> info = list->getCodecInfo(ix);
-
- uint32_t quirks = 0;
- if (info->hasQuirk("requires-allocate-on-input-ports")) {
- quirks |= ACodec::kRequiresAllocateBufferOnInputPorts;
- }
- if (info->hasQuirk("requires-allocate-on-output-ports")) {
- quirks |= ACodec::kRequiresAllocateBufferOnOutputPorts;
- }
-
- return quirks;
+MediaCodecListBuilderBase::~MediaCodecListBuilderBase() {
}
} // namespace android
diff --git a/media/libstagefright/MediaCodecListOverrides.cpp b/media/libstagefright/MediaCodecListOverrides.cpp
index 095fc6a..6920e51 100644
--- a/media/libstagefright/MediaCodecListOverrides.cpp
+++ b/media/libstagefright/MediaCodecListOverrides.cpp
@@ -33,8 +33,6 @@
namespace android {
-const char *kProfilingResults = "/data/misc/media/media_codecs_profiling_results.xml";
-
AString getProfilingVersionString() {
char val[PROPERTY_VALUE_MAX];
if (property_get("ro.build.display.id", val, NULL) && (strlen(val) > 0)) {
@@ -205,24 +203,24 @@
return true;
}
-void profileCodecs(const Vector<sp<MediaCodecInfo>> &infos) {
+void profileCodecs(const std::vector<sp<MediaCodecInfo>> &infos,
+ const char* profilingResults) {
CodecSettings global_results;
KeyedVector<AString, CodecSettings> encoder_results;
KeyedVector<AString, CodecSettings> decoder_results;
profileCodecs(infos, &global_results, &encoder_results, &decoder_results);
- exportResultsToXML(kProfilingResults, global_results, encoder_results, decoder_results);
+ exportResultsToXML(profilingResults, global_results, encoder_results, decoder_results);
}
void profileCodecs(
- const Vector<sp<MediaCodecInfo>> &infos,
+ const std::vector<sp<MediaCodecInfo>> &infos,
CodecSettings *global_results,
KeyedVector<AString, CodecSettings> *encoder_results,
KeyedVector<AString, CodecSettings> *decoder_results,
bool forceToMeasure) {
KeyedVector<AString, sp<MediaCodecInfo::Capabilities>> codecsNeedMeasure;
AString supportMultipleSecureCodecs = "true";
- for (size_t i = 0; i < infos.size(); ++i) {
- const sp<MediaCodecInfo> info = infos[i];
+ for (const auto& info : infos) {
AString name = info->getCodecName();
if (name.startsWith("OMX.google.") ||
// TODO: reenable below codecs once fixed
diff --git a/media/libstagefright/MediaCodecListOverrides.h b/media/libstagefright/MediaCodecListOverrides.h
index d4bb225..4f8c2f5 100644
--- a/media/libstagefright/MediaCodecListOverrides.h
+++ b/media/libstagefright/MediaCodecListOverrides.h
@@ -23,12 +23,10 @@
#include <utils/StrongPointer.h>
#include <utils/KeyedVector.h>
+#include <vector>
namespace android {
-extern const char *kProfilingVersionString;
-extern const char *kProfilingResults;
-
struct MediaCodecInfo;
AString getProfilingVersionString();
@@ -36,11 +34,12 @@
bool splitString(const AString &s, const AString &delimiter, AString *s1, AString *s2);
// profile codecs and save the result to xml file named kProfilingResults.
-void profileCodecs(const Vector<sp<MediaCodecInfo>> &infos);
+void profileCodecs(const std::vector<sp<MediaCodecInfo>> &infos,
+ const char* profilingResults);
// profile codecs and save the result to global_results, encoder_results and decoder_results.
void profileCodecs(
- const Vector<sp<MediaCodecInfo>> &infos,
+ const std::vector<sp<MediaCodecInfo>> &infos,
CodecSettings *global_results,
KeyedVector<AString, CodecSettings> *encoder_results,
KeyedVector<AString, CodecSettings> *decoder_results,
diff --git a/media/libstagefright/NuMediaExtractor.cpp b/media/libstagefright/NuMediaExtractor.cpp
index 51f1ba3..640cb82 100644
--- a/media/libstagefright/NuMediaExtractor.cpp
+++ b/media/libstagefright/NuMediaExtractor.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-//#define LOG_NDEBUG 0
+#define LOG_NDEBUG 0
#define LOG_TAG "NuMediaExtractor"
#include <utils/Log.h>
@@ -35,7 +35,6 @@
#include <media/stagefright/MediaSource.h>
#include <media/stagefright/MetaData.h>
#include <media/stagefright/Utils.h>
-#include <android/media/ICas.h>
namespace android {
@@ -83,8 +82,8 @@
return ERROR_UNSUPPORTED;
}
- if (mCas != NULL) {
- mImpl->setMediaCas(mCas);
+ if (!mCasToken.empty()) {
+ mImpl->setMediaCas(mCasToken);
}
status_t err = updateDurationAndBitrate();
@@ -119,8 +118,8 @@
return ERROR_UNSUPPORTED;
}
- if (mCas != NULL) {
- mImpl->setMediaCas(mCas);
+ if (!mCasToken.empty()) {
+ mImpl->setMediaCas(mCasToken);
}
err = updateDurationAndBitrate();
@@ -149,8 +148,8 @@
return ERROR_UNSUPPORTED;
}
- if (mCas != NULL) {
- mImpl->setMediaCas(mCas);
+ if (!mCasToken.empty()) {
+ mImpl->setMediaCas(mCasToken);
}
err = updateDurationAndBitrate();
@@ -161,24 +160,36 @@
return err;
}
-status_t NuMediaExtractor::setMediaCas(const sp<ICas> &cas) {
- ALOGV("setMediaCas: cas=%p", cas.get());
+static String8 arrayToString(const std::vector<uint8_t> &array) {
+ String8 result;
+ for (size_t i = 0; i < array.size(); i++) {
+ result.appendFormat("%02x ", array[i]);
+ }
+ if (result.isEmpty()) {
+ result.append("(null)");
+ }
+ return result;
+}
+
+status_t NuMediaExtractor::setMediaCas(const HInterfaceToken &casToken) {
+ ALOGV("setMediaCas: casToken={%s}", arrayToString(casToken).c_str());
Mutex::Autolock autoLock(mLock);
- if (cas == NULL) {
+ if (casToken.empty()) {
return BAD_VALUE;
}
+ mCasToken = casToken;
+
if (mImpl != NULL) {
- mImpl->setMediaCas(cas);
+ mImpl->setMediaCas(casToken);
status_t err = updateDurationAndBitrate();
if (err != OK) {
return err;
}
}
- mCas = cas;
return OK;
}
diff --git a/media/libstagefright/OMXClient.cpp b/media/libstagefright/OMXClient.cpp
index 5f9aa01..5f50e46 100644
--- a/media/libstagefright/OMXClient.cpp
+++ b/media/libstagefright/OMXClient.cpp
@@ -38,7 +38,7 @@
}
status_t OMXClient::connect() {
- return connect(nullptr);
+ return connect("default", nullptr);
}
status_t OMXClient::connect(bool* trebleFlag) {
@@ -54,6 +54,19 @@
return connectLegacy();
}
+status_t OMXClient::connect(const char* name, bool* trebleFlag) {
+ if (property_get_bool("persist.media.treble_omx", true)) {
+ if (trebleFlag != nullptr) {
+ *trebleFlag = true;
+ }
+ return connectTreble(name);
+ }
+ if (trebleFlag != nullptr) {
+ *trebleFlag = false;
+ }
+ return connectLegacy();
+}
+
status_t OMXClient::connectLegacy() {
sp<IServiceManager> sm = defaultServiceManager();
sp<IBinder> codecbinder = sm->getService(String16("media.codec"));
@@ -73,9 +86,12 @@
return OK;
}
-status_t OMXClient::connectTreble() {
+status_t OMXClient::connectTreble(const char* name) {
using namespace ::android::hardware::media::omx::V1_0;
- sp<IOmx> tOmx = IOmx::getService("default");
+ if (name == nullptr) {
+ name = "default";
+ }
+ sp<IOmx> tOmx = IOmx::getService(name);
if (tOmx.get() == nullptr) {
ALOGE("Cannot obtain Treble IOmx.");
return NO_INIT;
diff --git a/media/libstagefright/OmxInfoBuilder.cpp b/media/libstagefright/OmxInfoBuilder.cpp
new file mode 100644
index 0000000..8717a79
--- /dev/null
+++ b/media/libstagefright/OmxInfoBuilder.cpp
@@ -0,0 +1,323 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "OmxInfoBuilder"
+
+#ifdef __LP64__
+#define OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS
+#endif
+
+#include <utils/Log.h>
+#include <cutils/properties.h>
+
+#include <binder/IServiceManager.h>
+#include <media/IMediaCodecService.h>
+#include <media/stagefright/OmxInfoBuilder.h>
+#include <media/stagefright/ACodec.h>
+
+#include <android/hardware/media/omx/1.0/IOmxStore.h>
+#include <android/hardware/media/omx/1.0/IOmx.h>
+#include <android/hardware/media/omx/1.0/IOmxNode.h>
+#include <media/stagefright/omx/OMXUtils.h>
+
+#include <media/IOMXStore.h>
+#include <media/IOMX.h>
+#include <media/MediaDefs.h>
+#include <media/omx/1.0/WOmx.h>
+
+#include <media/openmax/OMX_Index.h>
+#include <media/openmax/OMX_IndexExt.h>
+#include <media/openmax/OMX_Audio.h>
+#include <media/openmax/OMX_AudioExt.h>
+#include <media/openmax/OMX_Video.h>
+#include <media/openmax/OMX_VideoExt.h>
+
+namespace android {
+
+namespace /* unnamed */ {
+
+status_t queryCapabilities(
+ const IOMXStore::NodeInfo& node, const char* mime, bool isEncoder,
+ MediaCodecInfo::CapabilitiesWriter* caps) {
+ sp<ACodec> codec = new ACodec();
+ status_t err = codec->queryCapabilities(
+ node.owner.c_str(), node.name.c_str(), mime, isEncoder, caps);
+ if (err != OK) {
+ return err;
+ }
+ for (const auto& attribute : node.attributes) {
+ // All features have an int32 value except
+ // "feature-bitrate-modes", which has a string value.
+ if ((attribute.key.compare(0, 8, "feature-") == 0) &&
+ (attribute.key.compare(8, 15, "bitrate-modes")
+ != 0)) {
+ // If this attribute.key is a feature that is not a bitrate
+ // control, add an int32 value.
+ caps->addDetail(
+ attribute.key.c_str(),
+ attribute.value == "1" ? 1 : 0);
+ } else {
+ // Non-feature attributes
+ caps->addDetail(
+ attribute.key.c_str(), attribute.value.c_str());
+ }
+ }
+ return OK;
+}
+
+} // unnamed namespace
+
+OmxInfoBuilder::OmxInfoBuilder() {
+}
+
+status_t OmxInfoBuilder::buildMediaCodecList(MediaCodecListWriter* writer) {
+ bool treble;
+ sp<IOMX> omx;
+ std::vector<IOMXStore::RoleInfo> roles;
+
+ treble = property_get_bool("persist.media.treble_omx", true);
+ if (treble) {
+ using namespace ::android::hardware::media::omx::V1_0;
+ using ::android::hardware::hidl_vec;
+ using ::android::hardware::hidl_string;
+
+ // Obtain IOmxStore
+ sp<IOmxStore> omxStore = IOmxStore::getService();
+ if (omxStore == nullptr) {
+ ALOGE("Cannot connect to an IOmxStore instance.");
+ return NO_INIT;
+ }
+
+ // List service attributes (global settings)
+ Status status;
+ hidl_vec<IOmxStore::ServiceAttribute> serviceAttributes;
+ auto transStatus = omxStore->listServiceAttributes(
+ [&status, &serviceAttributes]
+ (Status inStatus, const hidl_vec<IOmxStore::ServiceAttribute>&
+ inAttributes) {
+ status = inStatus;
+ serviceAttributes = inAttributes;
+ });
+ if (!transStatus.isOk()) {
+ ALOGE("Fail to obtain global settings from IOmxStore.");
+ return NO_INIT;
+ }
+ if (status != Status::OK) {
+ ALOGE("IOmxStore reports parsing error.");
+ return NO_INIT;
+ }
+ for (const auto& p : serviceAttributes) {
+ writer->addGlobalSetting(
+ p.key.c_str(), p.value.c_str());
+ }
+
+ // List roles and convert to IOMXStore's format
+ transStatus = omxStore->listRoles(
+ [&roles]
+ (const hidl_vec<IOmxStore::RoleInfo>& inRoleList) {
+ roles.reserve(inRoleList.size());
+ for (const auto& inRole : inRoleList) {
+ IOMXStore::RoleInfo role;
+ role.role = inRole.role;
+ role.type = inRole.type;
+ role.isEncoder = inRole.isEncoder;
+ role.preferPlatformNodes = inRole.preferPlatformNodes;
+ std::vector<IOMXStore::NodeInfo>& nodes =
+ role.nodes;
+ nodes.reserve(inRole.nodes.size());
+ for (const auto& inNode : inRole.nodes) {
+ IOMXStore::NodeInfo node;
+ node.name = inNode.name;
+ node.owner = inNode.owner;
+ std::vector<IOMXStore::Attribute>& attributes =
+ node.attributes;
+ attributes.reserve(inNode.attributes.size());
+ for (const auto& inAttr : inNode.attributes) {
+ IOMXStore::Attribute attr;
+ attr.key = inAttr.key;
+ attr.value = inAttr.value;
+ attributes.push_back(std::move(attr));
+ }
+ nodes.push_back(std::move(node));
+ }
+ roles.push_back(std::move(role));
+ }
+ });
+ if (!transStatus.isOk()) {
+ ALOGE("Fail to obtain codec roles from IOmxStore.");
+ return NO_INIT;
+ }
+ } else {
+ // Obtain IOMXStore
+ sp<IServiceManager> sm = defaultServiceManager();
+ if (sm == nullptr) {
+ ALOGE("Cannot obtain the default service manager.");
+ return NO_INIT;
+ }
+ sp<IBinder> codecBinder = sm->getService(String16("media.codec"));
+ if (codecBinder == nullptr) {
+ ALOGE("Cannot obtain the media codec service.");
+ return NO_INIT;
+ }
+ sp<IMediaCodecService> codecService =
+ interface_cast<IMediaCodecService>(codecBinder);
+ if (codecService == nullptr) {
+ ALOGE("Wrong type of media codec service obtained.");
+ return NO_INIT;
+ }
+ omx = codecService->getOMX();
+ if (omx == nullptr) {
+ ALOGE("Cannot connect to an IOMX instance.");
+ }
+ sp<IOMXStore> omxStore = codecService->getOMXStore();
+ if (omxStore == nullptr) {
+ ALOGE("Cannot connect to an IOMXStore instance.");
+ return NO_INIT;
+ }
+
+ // List service attributes (global settings)
+ std::vector<IOMXStore::Attribute> serviceAttributes;
+ status_t status = omxStore->listServiceAttributes(&serviceAttributes);
+ if (status != OK) {
+ ALOGE("Fail to obtain global settings from IOMXStore.");
+ return NO_INIT;
+ }
+ for (const auto& p : serviceAttributes) {
+ writer->addGlobalSetting(
+ p.key.c_str(), p.value.c_str());
+ }
+
+ // List roles
+ status = omxStore->listRoles(&roles);
+ if (status != OK) {
+ ALOGE("Fail to obtain codec roles from IOMXStore.");
+ return NO_INIT;
+ }
+ }
+
+ // Convert roles to lists of codecs
+
+ // codec name -> index into swCodecs
+ std::map<std::string, std::unique_ptr<MediaCodecInfoWriter> >
+ swCodecName2Info;
+ // codec name -> index into hwCodecs
+ std::map<std::string, std::unique_ptr<MediaCodecInfoWriter> >
+ hwCodecName2Info;
+ // owner name -> MediaCodecInfo
+ // This map will be used to obtain the correct IOmx service(s) needed for
+ // creating IOmxNode instances and querying capabilities.
+ std::map<std::string, std::vector<sp<MediaCodecInfo> > >
+ owner2CodecInfo;
+
+ for (const auto& role : roles) {
+ const auto& typeName = role.type;
+ bool isEncoder = role.isEncoder;
+ bool preferPlatformNodes = role.preferPlatformNodes;
+ // If preferPlatformNodes is true, hardware nodes must be added after
+ // platform (software) nodes. hwCodecs is used to hold hardware nodes
+ // that need to be added after software nodes for the same role.
+ std::vector<const IOMXStore::NodeInfo*> hwCodecs;
+ for (const auto& node : role.nodes) {
+ const auto& nodeName = node.name;
+ bool isSoftware = nodeName.compare(0, 10, "OMX.google") == 0;
+ MediaCodecInfoWriter* info;
+ if (isSoftware) {
+ auto c2i = swCodecName2Info.find(nodeName);
+ if (c2i == swCodecName2Info.end()) {
+ // Create a new MediaCodecInfo for a new node.
+ c2i = swCodecName2Info.insert(std::make_pair(
+ nodeName, writer->addMediaCodecInfo())).first;
+ info = c2i->second.get();
+ info->setName(nodeName.c_str());
+ info->setOwner(node.owner.c_str());
+ info->setEncoder(isEncoder);
+ } else {
+ // The node has been seen before. Simply retrieve the
+ // existing MediaCodecInfoWriter.
+ info = c2i->second.get();
+ }
+ } else {
+ auto c2i = hwCodecName2Info.find(nodeName);
+ if (c2i == hwCodecName2Info.end()) {
+ // Create a new MediaCodecInfo for a new node.
+ if (!preferPlatformNodes) {
+ c2i = hwCodecName2Info.insert(std::make_pair(
+ nodeName, writer->addMediaCodecInfo())).first;
+ info = c2i->second.get();
+ info->setName(nodeName.c_str());
+ info->setOwner(node.owner.c_str());
+ info->setEncoder(isEncoder);
+ } else {
+ // If preferPlatformNodes is true, this node must be
+ // added after all software nodes.
+ hwCodecs.push_back(&node);
+ continue;
+ }
+ } else {
+ // The node has been seen before. Simply retrieve the
+ // existing MediaCodecInfoWriter.
+ info = c2i->second.get();
+ }
+ }
+ std::unique_ptr<MediaCodecInfo::CapabilitiesWriter> caps =
+ info->addMime(typeName.c_str());
+ if (queryCapabilities(
+ node, typeName.c_str(), isEncoder, caps.get()) != OK) {
+ ALOGW("Fail to add mime %s to codec %s",
+ typeName.c_str(), nodeName.c_str());
+ info->removeMime(typeName.c_str());
+ }
+ }
+
+ // If preferPlatformNodes is true, hardware nodes will not have been
+ // added in the loop above, but rather saved in hwCodecs. They are
+ // going to be added here.
+ if (preferPlatformNodes) {
+ for (const auto& node : hwCodecs) {
+ MediaCodecInfoWriter* info;
+ const auto& nodeName = node->name;
+ auto c2i = hwCodecName2Info.find(nodeName);
+ if (c2i == hwCodecName2Info.end()) {
+ // Create a new MediaCodecInfo for a new node.
+ c2i = hwCodecName2Info.insert(std::make_pair(
+ nodeName, writer->addMediaCodecInfo())).first;
+ info = c2i->second.get();
+ info->setName(nodeName.c_str());
+ info->setOwner(node->owner.c_str());
+ info->setEncoder(isEncoder);
+ } else {
+ // The node has been seen before. Simply retrieve the
+ // existing MediaCodecInfoWriter.
+ info = c2i->second.get();
+ }
+ std::unique_ptr<MediaCodecInfo::CapabilitiesWriter> caps =
+ info->addMime(typeName.c_str());
+ if (queryCapabilities(
+ *node, typeName.c_str(), isEncoder, caps.get()) != OK) {
+ ALOGW("Fail to add mime %s to codec %s "
+ "after software codecs",
+ typeName.c_str(), nodeName.c_str());
+ info->removeMime(typeName.c_str());
+ }
+ }
+ }
+ }
+ return OK;
+}
+
+} // namespace android
+
diff --git a/media/libstagefright/SampleIterator.cpp b/media/libstagefright/SampleIterator.cpp
index 75f744d..7a51027 100644
--- a/media/libstagefright/SampleIterator.cpp
+++ b/media/libstagefright/SampleIterator.cpp
@@ -244,13 +244,14 @@
switch (mTable->mSampleSizeFieldSize) {
case 32:
{
+ uint32_t x;
if (mTable->mDataSource->readAt(
mTable->mSampleSizeOffset + 12 + 4 * sampleIndex,
- size, sizeof(*size)) < (ssize_t)sizeof(*size)) {
+ &x, sizeof(x)) < (ssize_t)sizeof(x)) {
return ERROR_IO;
}
- *size = ntohl(*size);
+ *size = ntohl(x);
break;
}
diff --git a/media/libstagefright/StagefrightMediaScanner.cpp b/media/libstagefright/StagefrightMediaScanner.cpp
index f0c27ac..4ff2bfe 100644
--- a/media/libstagefright/StagefrightMediaScanner.cpp
+++ b/media/libstagefright/StagefrightMediaScanner.cpp
@@ -85,7 +85,8 @@
status_t status;
if (fd < 0) {
// couldn't open it locally, maybe the media server can?
- status = mRetriever->setDataSource(NULL /* httpService */, path);
+ sp<IMediaHTTPService> nullService;
+ status = mRetriever->setDataSource(nullService, path);
} else {
status = mRetriever->setDataSource(fd, 0, 0x7ffffffffffffffL);
close(fd);
diff --git a/media/libstagefright/StagefrightMetadataRetriever.cpp b/media/libstagefright/StagefrightMetadataRetriever.cpp
index 03dc9df..103da95 100644
--- a/media/libstagefright/StagefrightMetadataRetriever.cpp
+++ b/media/libstagefright/StagefrightMetadataRetriever.cpp
@@ -60,6 +60,12 @@
StagefrightMetadataRetriever::~StagefrightMetadataRetriever() {
ALOGV("~StagefrightMetadataRetriever()");
clearMetadata();
+ // Explicitly release extractor before continuing with the destructor,
+ // some extractors might need to callback to close off the DataSource
+ // and we need to make sure it's still there.
+ if (mExtractor != NULL) {
+ mExtractor->release();
+ }
if (mSource != NULL) {
mSource->close();
}
@@ -121,12 +127,12 @@
}
status_t StagefrightMetadataRetriever::setDataSource(
- const sp<DataSource>& source) {
+ const sp<DataSource>& source, const char *mime) {
ALOGV("setDataSource(DataSource)");
clearMetadata();
mSource = source;
- mExtractor = MediaExtractor::Create(mSource);
+ mExtractor = MediaExtractor::Create(mSource, mime);
if (mExtractor == NULL) {
ALOGE("Failed to instantiate a MediaExtractor.");
@@ -137,17 +143,173 @@
return OK;
}
+static VideoFrame *allocVideoFrame(
+ const sp<MetaData> &trackMeta, int32_t width, int32_t height, int32_t bpp, bool metaOnly) {
+ int32_t rotationAngle;
+ if (!trackMeta->findInt32(kKeyRotation, &rotationAngle)) {
+ rotationAngle = 0; // By default, no rotation
+ }
+
+ uint32_t type;
+ const void *iccData;
+ size_t iccSize;
+ if (!trackMeta->findData(kKeyIccProfile, &type, &iccData, &iccSize)){
+ iccData = NULL;
+ iccSize = 0;
+ }
+
+ int32_t sarWidth, sarHeight;
+ int32_t displayWidth, displayHeight;
+ if (trackMeta->findInt32(kKeySARWidth, &sarWidth)
+ && trackMeta->findInt32(kKeySARHeight, &sarHeight)
+ && sarHeight != 0) {
+ displayWidth = (width * sarWidth) / sarHeight;
+ displayHeight = height;
+ } else if (trackMeta->findInt32(kKeyDisplayWidth, &displayWidth)
+ && trackMeta->findInt32(kKeyDisplayHeight, &displayHeight)
+ && displayWidth > 0 && displayHeight > 0
+ && width > 0 && height > 0) {
+ ALOGV("found display size %dx%d", displayWidth, displayHeight);
+ } else {
+ displayWidth = width;
+ displayHeight = height;
+ }
+
+ return new VideoFrame(width, height, displayWidth, displayHeight,
+ rotationAngle, bpp, !metaOnly, iccData, iccSize);
+}
+
+static bool getDstColorFormat(android_pixel_format_t colorFormat,
+ OMX_COLOR_FORMATTYPE *omxColorFormat, int32_t *bpp) {
+ switch (colorFormat) {
+ case HAL_PIXEL_FORMAT_RGB_565:
+ {
+ *omxColorFormat = OMX_COLOR_Format16bitRGB565;
+ *bpp = 2;
+ return true;
+ }
+ case HAL_PIXEL_FORMAT_RGBA_8888:
+ {
+ *omxColorFormat = OMX_COLOR_Format32BitRGBA8888;
+ *bpp = 4;
+ return true;
+ }
+ case HAL_PIXEL_FORMAT_BGRA_8888:
+ {
+ *omxColorFormat = OMX_COLOR_Format32bitBGRA8888;
+ *bpp = 4;
+ return true;
+ }
+ default:
+ {
+ ALOGE("Unsupported color format: %d", colorFormat);
+ break;
+ }
+ }
+ return false;
+}
+
static VideoFrame *extractVideoFrame(
const AString &componentName,
const sp<MetaData> &trackMeta,
const sp<IMediaSource> &source,
int64_t frameTimeUs,
- int seekMode) {
-
+ int seekMode,
+ int colorFormat,
+ bool metaOnly) {
sp<MetaData> format = source->getFormat();
+ MediaSource::ReadOptions::SeekMode mode =
+ static_cast<MediaSource::ReadOptions::SeekMode>(seekMode);
+ if (seekMode < MediaSource::ReadOptions::SEEK_PREVIOUS_SYNC ||
+ seekMode > MediaSource::ReadOptions::SEEK_CLOSEST) {
+ ALOGE("Unknown seek mode: %d", seekMode);
+ return NULL;
+ }
+
+ int32_t dstBpp;
+ OMX_COLOR_FORMATTYPE dstFormat;
+ if (!getDstColorFormat(
+ (android_pixel_format_t)colorFormat, &dstFormat, &dstBpp)) {
+ return NULL;
+ }
+
+ if (metaOnly) {
+ int32_t width, height;
+ CHECK(trackMeta->findInt32(kKeyWidth, &width));
+ CHECK(trackMeta->findInt32(kKeyHeight, &height));
+ return allocVideoFrame(trackMeta, width, height, dstBpp, true);
+ }
+
+ MediaSource::ReadOptions options;
+ sp<MetaData> overrideMeta;
+ if (frameTimeUs < 0) {
+ uint32_t type;
+ const void *data;
+ size_t size;
+ int64_t thumbNailTime;
+ int32_t thumbnailWidth, thumbnailHeight;
+
+ // if we have a stand-alone thumbnail, set up the override meta,
+ // and set seekTo time to -1.
+ if (trackMeta->findInt32(kKeyThumbnailWidth, &thumbnailWidth)
+ && trackMeta->findInt32(kKeyThumbnailHeight, &thumbnailHeight)
+ && trackMeta->findData(kKeyThumbnailHVCC, &type, &data, &size)){
+ overrideMeta = new MetaData(*trackMeta);
+ overrideMeta->remove(kKeyDisplayWidth);
+ overrideMeta->remove(kKeyDisplayHeight);
+ overrideMeta->setInt32(kKeyWidth, thumbnailWidth);
+ overrideMeta->setInt32(kKeyHeight, thumbnailHeight);
+ overrideMeta->setData(kKeyHVCC, type, data, size);
+ thumbNailTime = -1ll;
+ ALOGV("thumbnail: %dx%d", thumbnailWidth, thumbnailHeight);
+ } else if (!trackMeta->findInt64(kKeyThumbnailTime, &thumbNailTime)
+ || thumbNailTime < 0) {
+ thumbNailTime = 0;
+ }
+
+ options.setSeekTo(thumbNailTime, mode);
+ } else {
+ options.setSeekTo(frameTimeUs, mode);
+ }
+
+ int32_t gridRows = 1, gridCols = 1;
+ if (overrideMeta == NULL) {
+ // check if we're dealing with a tiled heif
+ int32_t gridWidth, gridHeight;
+ if (trackMeta->findInt32(kKeyGridWidth, &gridWidth) && gridWidth > 0
+ && trackMeta->findInt32(kKeyGridHeight, &gridHeight) && gridHeight > 0) {
+ int32_t width, height, displayWidth, displayHeight;
+ CHECK(trackMeta->findInt32(kKeyWidth, &width));
+ CHECK(trackMeta->findInt32(kKeyHeight, &height));
+ CHECK(trackMeta->findInt32(kKeyDisplayWidth, &displayWidth));
+ CHECK(trackMeta->findInt32(kKeyDisplayHeight, &displayHeight));
+
+ if (width >= displayWidth && height >= displayHeight
+ && (width % gridWidth == 0) && (height % gridHeight == 0)) {
+ ALOGV("grid config: %dx%d, display %dx%d, grid %dx%d",
+ width, height, displayWidth, displayHeight, gridWidth, gridHeight);
+
+ overrideMeta = new MetaData(*trackMeta);
+ overrideMeta->remove(kKeyDisplayWidth);
+ overrideMeta->remove(kKeyDisplayHeight);
+ overrideMeta->setInt32(kKeyWidth, gridWidth);
+ overrideMeta->setInt32(kKeyHeight, gridHeight);
+ gridCols = width / gridWidth;
+ gridRows = height / gridHeight;
+ } else {
+ ALOGE("Bad grid config: %dx%d, display %dx%d, grid %dx%d",
+ width, height, displayWidth, displayHeight, gridWidth, gridHeight);
+ }
+ }
+ if (overrideMeta == NULL) {
+ overrideMeta = trackMeta;
+ }
+ }
+ int32_t numTiles = gridRows * gridCols;
+
sp<AMessage> videoFormat;
- if (convertMetaDataToMessage(trackMeta, &videoFormat) != OK) {
+ if (convertMetaDataToMessage(overrideMeta, &videoFormat) != OK) {
ALOGE("b/23680780");
ALOGW("Failed to convert meta data to message");
return NULL;
@@ -160,7 +322,8 @@
// input and output ports, if seeking to a sync frame. NOTE: This request may
// fail if component requires more than that for decoding.
bool isSeekingClosest = (seekMode == MediaSource::ReadOptions::SEEK_CLOSEST);
- if (!isSeekingClosest) {
+ bool decodeSingleFrame = !isSeekingClosest && (numTiles == 1);
+ if (decodeSingleFrame) {
videoFormat->setInt32("android._num-input-buffers", 1);
videoFormat->setInt32("android._num-output-buffers", 1);
}
@@ -190,30 +353,6 @@
return NULL;
}
- MediaSource::ReadOptions options;
- if (seekMode < MediaSource::ReadOptions::SEEK_PREVIOUS_SYNC ||
- seekMode > MediaSource::ReadOptions::SEEK_CLOSEST) {
-
- ALOGE("Unknown seek mode: %d", seekMode);
- decoder->release();
- return NULL;
- }
-
- MediaSource::ReadOptions::SeekMode mode =
- static_cast<MediaSource::ReadOptions::SeekMode>(seekMode);
-
- int64_t thumbNailTime;
- if (frameTimeUs < 0) {
- if (!trackMeta->findInt64(kKeyThumbnailTime, &thumbNailTime)
- || thumbNailTime < 0) {
- thumbNailTime = 0;
- }
- options.setSeekTo(thumbNailTime, mode);
- } else {
- thumbNailTime = -1;
- options.setSeekTo(frameTimeUs, mode);
- }
-
err = source->start();
if (err != OK) {
ALOGW("source failed to start: %d (%s)", err, asString(err));
@@ -258,6 +397,9 @@
bool firstSample = true;
int64_t targetTimeUs = -1ll;
+ VideoFrame *frame = NULL;
+ int32_t tilesDecoded = 0;
+
do {
size_t inputIndex = -1;
int64_t ptsUs = 0ll;
@@ -282,6 +424,9 @@
if (err != OK) {
ALOGW("Input Error or EOS");
haveMoreInputs = false;
+ if (err == ERROR_END_OF_STREAM) {
+ err = OK;
+ }
break;
}
if (firstSample && isSeekingClosest) {
@@ -293,6 +438,7 @@
if (mediaBuffer->range_length() > codecBuffer->capacity()) {
ALOGE("buffer size (%zu) too large for codec input size (%zu)",
mediaBuffer->range_length(), codecBuffer->capacity());
+ haveMoreInputs = false;
err = BAD_VALUE;
} else {
codecBuffer->setRange(0, mediaBuffer->range_length());
@@ -301,19 +447,20 @@
memcpy(codecBuffer->data(),
(const uint8_t*)mediaBuffer->data() + mediaBuffer->range_offset(),
mediaBuffer->range_length());
- if (isAvcOrHevc && IsIDR(codecBuffer) && !isSeekingClosest) {
- // Only need to decode one IDR frame, unless we're seeking with CLOSEST
- // option, in which case we need to actually decode to targetTimeUs.
- haveMoreInputs = false;
- flags |= MediaCodec::BUFFER_FLAG_EOS;
- }
}
mediaBuffer->release();
break;
}
- if (err == OK && inputIndex < inputBuffers.size()) {
+ if (haveMoreInputs && inputIndex < inputBuffers.size()) {
+ if (isAvcOrHevc && IsIDR(codecBuffer) && decodeSingleFrame) {
+ // Only need to decode one IDR frame, unless we're seeking with CLOSEST
+ // option, in which case we need to actually decode to targetTimeUs.
+ haveMoreInputs = false;
+ flags |= MediaCodec::BUFFER_FLAG_EOS;
+ }
+
ALOGV("QueueInput: size=%zu ts=%" PRId64 " us flags=%x",
codecBuffer->size(), ptsUs, flags);
err = decoder->queueInputBuffer(
@@ -352,11 +499,70 @@
} else if (err == OK) {
// If we're seeking with CLOSEST option and obtained a valid targetTimeUs
// from the extractor, decode to the specified frame. Otherwise we're done.
- done = (targetTimeUs < 0ll) || (timeUs >= targetTimeUs);
ALOGV("Received an output buffer, timeUs=%lld", (long long)timeUs);
- if (!done) {
- err = decoder->releaseOutputBuffer(index);
+ sp<MediaCodecBuffer> videoFrameBuffer = outputBuffers.itemAt(index);
+
+ int32_t width, height;
+ CHECK(outputFormat != NULL);
+ CHECK(outputFormat->findInt32("width", &width));
+ CHECK(outputFormat->findInt32("height", &height));
+
+ int32_t crop_left, crop_top, crop_right, crop_bottom;
+ if (!outputFormat->findRect("crop", &crop_left, &crop_top, &crop_right, &crop_bottom)) {
+ crop_left = crop_top = 0;
+ crop_right = width - 1;
+ crop_bottom = height - 1;
}
+
+ if (frame == NULL) {
+ frame = allocVideoFrame(
+ trackMeta,
+ (crop_right - crop_left + 1) * gridCols,
+ (crop_bottom - crop_top + 1) * gridRows,
+ dstBpp,
+ false /*metaOnly*/);
+ }
+
+ int32_t srcFormat;
+ CHECK(outputFormat->findInt32("color-format", &srcFormat));
+
+ ColorConverter converter((OMX_COLOR_FORMATTYPE)srcFormat, dstFormat);
+
+ int32_t dstLeft, dstTop, dstRight, dstBottom;
+ if (numTiles == 1) {
+ dstLeft = crop_left;
+ dstTop = crop_top;
+ dstRight = crop_right;
+ dstBottom = crop_bottom;
+ } else {
+ dstLeft = tilesDecoded % gridCols * width;
+ dstTop = tilesDecoded / gridCols * height;
+ dstRight = dstLeft + width - 1;
+ dstBottom = dstTop + height - 1;
+ }
+
+ if (converter.isValid()) {
+ err = converter.convert(
+ (const uint8_t *)videoFrameBuffer->data(),
+ width, height,
+ crop_left, crop_top, crop_right, crop_bottom,
+ frame->mData,
+ frame->mWidth,
+ frame->mHeight,
+ dstLeft, dstTop, dstRight, dstBottom);
+ } else {
+ ALOGE("Unable to convert from format 0x%08x to 0x%08x",
+ srcFormat, dstFormat);
+
+ err = ERROR_UNSUPPORTED;
+ }
+
+ done = (targetTimeUs < 0ll) || (timeUs >= targetTimeUs);
+ if (numTiles > 1) {
+ tilesDecoded++;
+ done &= (tilesDecoded >= numTiles);
+ }
+ err = decoder->releaseOutputBuffer(index);
} else {
ALOGW("Received error %d (%s) instead of output", err, asString(err));
done = true;
@@ -366,102 +572,11 @@
}
} while (err == OK && !done);
- if (err != OK || size <= 0 || outputFormat == NULL) {
- ALOGE("Failed to decode thumbnail frame");
- source->stop();
- decoder->release();
- return NULL;
- }
-
- ALOGV("successfully decoded video frame.");
- sp<MediaCodecBuffer> videoFrameBuffer = outputBuffers.itemAt(index);
-
- if (thumbNailTime >= 0) {
- if (timeUs != thumbNailTime) {
- AString mime;
- CHECK(outputFormat->findString("mime", &mime));
-
- ALOGV("thumbNailTime = %lld us, timeUs = %lld us, mime = %s",
- (long long)thumbNailTime, (long long)timeUs, mime.c_str());
- }
- }
-
- int32_t width, height;
- CHECK(outputFormat->findInt32("width", &width));
- CHECK(outputFormat->findInt32("height", &height));
-
- int32_t crop_left, crop_top, crop_right, crop_bottom;
- if (!outputFormat->findRect("crop", &crop_left, &crop_top, &crop_right, &crop_bottom)) {
- crop_left = crop_top = 0;
- crop_right = width - 1;
- crop_bottom = height - 1;
- }
-
- int32_t rotationAngle;
- if (!trackMeta->findInt32(kKeyRotation, &rotationAngle)) {
- rotationAngle = 0; // By default, no rotation
- }
-
- VideoFrame *frame = new VideoFrame;
- frame->mWidth = crop_right - crop_left + 1;
- frame->mHeight = crop_bottom - crop_top + 1;
- frame->mDisplayWidth = frame->mWidth;
- frame->mDisplayHeight = frame->mHeight;
- frame->mSize = frame->mWidth * frame->mHeight * 2;
- frame->mData = new uint8_t[frame->mSize];
- frame->mRotationAngle = rotationAngle;
-
- int32_t sarWidth, sarHeight;
- if (trackMeta->findInt32(kKeySARWidth, &sarWidth)
- && trackMeta->findInt32(kKeySARHeight, &sarHeight)
- && sarHeight != 0) {
- frame->mDisplayWidth = (frame->mDisplayWidth * sarWidth) / sarHeight;
- } else {
- int32_t width, height;
- if (trackMeta->findInt32(kKeyDisplayWidth, &width)
- && trackMeta->findInt32(kKeyDisplayHeight, &height)
- && frame->mDisplayWidth > 0 && frame->mDisplayHeight > 0
- && width > 0 && height > 0) {
- if (frame->mDisplayHeight * (int64_t)width / height > (int64_t)frame->mDisplayWidth) {
- frame->mDisplayHeight =
- (int32_t)(height * (int64_t)frame->mDisplayWidth / width);
- } else {
- frame->mDisplayWidth =
- (int32_t)(frame->mDisplayHeight * (int64_t)width / height);
- }
- ALOGV("thumbNail width and height are overridden to %d x %d",
- frame->mDisplayWidth, frame->mDisplayHeight);
- }
- }
-
- int32_t srcFormat;
- CHECK(outputFormat->findInt32("color-format", &srcFormat));
-
- ColorConverter converter((OMX_COLOR_FORMATTYPE)srcFormat, OMX_COLOR_Format16bitRGB565);
-
- if (converter.isValid()) {
- err = converter.convert(
- (const uint8_t *)videoFrameBuffer->data(),
- width, height,
- crop_left, crop_top, crop_right, crop_bottom,
- frame->mData,
- frame->mWidth,
- frame->mHeight,
- 0, 0, frame->mWidth - 1, frame->mHeight - 1);
- } else {
- ALOGE("Unable to convert from format 0x%08x to RGB565", srcFormat);
-
- err = ERROR_UNSUPPORTED;
- }
-
- videoFrameBuffer.clear();
source->stop();
- decoder->releaseOutputBuffer(index);
decoder->release();
if (err != OK) {
- ALOGE("Colorconverter failed to convert frame.");
-
+ ALOGE("failed to get video frame (err %d)", err);
delete frame;
frame = NULL;
}
@@ -470,9 +585,10 @@
}
VideoFrame *StagefrightMetadataRetriever::getFrameAtTime(
- int64_t timeUs, int option) {
+ int64_t timeUs, int option, int colorFormat, bool metaOnly) {
- ALOGV("getFrameAtTime: %" PRId64 " us option: %d", timeUs, option);
+ ALOGV("getFrameAtTime: %" PRId64 " us option: %d colorFormat: %d, metaOnly: %d",
+ timeUs, option, colorFormat, metaOnly);
if (mExtractor.get() == NULL) {
ALOGV("no extractor.");
@@ -540,8 +656,8 @@
for (size_t i = 0; i < matchingCodecs.size(); ++i) {
const AString &componentName = matchingCodecs[i];
- VideoFrame *frame =
- extractVideoFrame(componentName, trackMeta, source, timeUs, option);
+ VideoFrame *frame = extractVideoFrame(
+ componentName, trackMeta, source, timeUs, option, colorFormat, metaOnly);
if (frame != NULL) {
return frame;
diff --git a/media/libstagefright/Utils.cpp b/media/libstagefright/Utils.cpp
index 0aea8e1..3ef8f2a 100644
--- a/media/libstagefright/Utils.cpp
+++ b/media/libstagefright/Utils.cpp
@@ -237,6 +237,11 @@
OMX_VIDEO_AVCPROFILETYPE codecProfile;
OMX_VIDEO_AVCLEVELTYPE codecLevel;
if (profiles.map(profile, &codecProfile)) {
+ if (profile == 66 && (constraints & 0x40)) {
+ codecProfile = (OMX_VIDEO_AVCPROFILETYPE)OMX_VIDEO_AVCProfileConstrainedBaseline;
+ } else if (profile == 100 && (constraints & 0x0C) == 0x0C) {
+ codecProfile = (OMX_VIDEO_AVCPROFILETYPE)OMX_VIDEO_AVCProfileConstrainedHigh;
+ }
format->setInt32("profile", codecProfile);
if (levels.map(level, &codecLevel)) {
// for 9 && 11 decide level based on profile and constraint_set3 flag
@@ -1874,5 +1879,13 @@
return result;
}
+void MakeFourCCString(uint32_t x, char *s) {
+ s[0] = x >> 24;
+ s[1] = (x >> 16) & 0xff;
+ s[2] = (x >> 8) & 0xff;
+ s[3] = x & 0xff;
+ s[4] = '\0';
+}
+
} // namespace android
diff --git a/media/libstagefright/VideoFrameScheduler.cpp b/media/libstagefright/VideoFrameScheduler.cpp
index 03226c7..6819bba 100644
--- a/media/libstagefright/VideoFrameScheduler.cpp
+++ b/media/libstagefright/VideoFrameScheduler.cpp
@@ -129,6 +129,11 @@
numSamplesToUse = mNumSamples;
}
+ if ((period >> kPrecision) == 0 ) {
+ ALOGW("Period is 0, or after including precision is 0 - would cause div0, returning");
+ return false;
+ }
+
int64_t sumX = 0;
int64_t sumXX = 0;
int64_t sumXY = 0;
diff --git a/media/libstagefright/codecs/aacdec/Android.bp b/media/libstagefright/codecs/aacdec/Android.bp
index 6e04c1e..21c00a1 100644
--- a/media/libstagefright/codecs/aacdec/Android.bp
+++ b/media/libstagefright/codecs/aacdec/Android.bp
@@ -1,5 +1,9 @@
cc_library_shared {
name: "libstagefright_soft_aacdec",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: [
"SoftAAC2.cpp",
@@ -33,4 +37,5 @@
"libcutils",
"liblog",
],
+ compile_multilib: "32",
}
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
index 9fbdb72..e0c0c32 100644
--- a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
+++ b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
@@ -218,6 +218,30 @@
OMX_ERRORTYPE SoftAAC2::internalGetParameter(
OMX_INDEXTYPE index, OMX_PTR params) {
switch ((OMX_U32) index) {
+ case OMX_IndexParamAudioPortFormat:
+ {
+ OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
+ (OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
+
+ if (!isValidOMXParam(formatParams)) {
+ return OMX_ErrorBadParameter;
+ }
+
+ if (formatParams->nPortIndex > 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ if (formatParams->nIndex > 0) {
+ return OMX_ErrorNoMore;
+ }
+
+ formatParams->eEncoding =
+ (formatParams->nPortIndex == 0)
+ ? OMX_AUDIO_CodingAAC : OMX_AUDIO_CodingPCM;
+
+ return OMX_ErrorNone;
+ }
+
case OMX_IndexParamAudioAac:
{
OMX_AUDIO_PARAM_AACPROFILETYPE *aacParams =
@@ -342,6 +366,29 @@
return OMX_ErrorNone;
}
+ case OMX_IndexParamAudioPortFormat:
+ {
+ const OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
+ (const OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
+
+ if (!isValidOMXParam(formatParams)) {
+ return OMX_ErrorBadParameter;
+ }
+
+ if (formatParams->nPortIndex > 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ if ((formatParams->nPortIndex == 0
+ && formatParams->eEncoding != OMX_AUDIO_CodingAAC)
+ || (formatParams->nPortIndex == 1
+ && formatParams->eEncoding != OMX_AUDIO_CodingPCM)) {
+ return OMX_ErrorUndefined;
+ }
+
+ return OMX_ErrorNone;
+ }
+
case OMX_IndexParamAudioAac:
{
const OMX_AUDIO_PARAM_AACPROFILETYPE *aacParams =
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC2.h b/media/libstagefright/codecs/aacdec/SoftAAC2.h
index a1cf285..73a3965 100644
--- a/media/libstagefright/codecs/aacdec/SoftAAC2.h
+++ b/media/libstagefright/codecs/aacdec/SoftAAC2.h
@@ -17,7 +17,7 @@
#ifndef SOFT_AAC_2_H_
#define SOFT_AAC_2_H_
-#include "SimpleSoftOMXComponent.h"
+#include <media/stagefright/omx/SimpleSoftOMXComponent.h>
#include "aacdecoder_lib.h"
#include "DrcPresModeWrap.h"
diff --git a/media/libstagefright/codecs/aacenc/Android.bp b/media/libstagefright/codecs/aacenc/Android.bp
index 432047b..d734b9c 100644
--- a/media/libstagefright/codecs/aacenc/Android.bp
+++ b/media/libstagefright/codecs/aacenc/Android.bp
@@ -1,5 +1,9 @@
cc_library_shared {
name: "libstagefright_soft_aacenc",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: ["SoftAACEncoder2.cpp"],
@@ -29,4 +33,5 @@
"libutils",
"liblog",
],
+ compile_multilib: "32",
}
diff --git a/media/libstagefright/codecs/aacenc/SoftAACEncoder.h b/media/libstagefright/codecs/aacenc/SoftAACEncoder.h
index 981cbbb..e64c1b7 100644
--- a/media/libstagefright/codecs/aacenc/SoftAACEncoder.h
+++ b/media/libstagefright/codecs/aacenc/SoftAACEncoder.h
@@ -18,7 +18,7 @@
#define SOFT_AAC_ENCODER_H_
-#include "SimpleSoftOMXComponent.h"
+#include <media/stagefright/omx/SimpleSoftOMXComponent.h>
struct VO_AUDIO_CODECAPI;
struct VO_MEM_OPERATOR;
diff --git a/media/libstagefright/codecs/aacenc/SoftAACEncoder2.h b/media/libstagefright/codecs/aacenc/SoftAACEncoder2.h
index 123fd25..681dcf2 100644
--- a/media/libstagefright/codecs/aacenc/SoftAACEncoder2.h
+++ b/media/libstagefright/codecs/aacenc/SoftAACEncoder2.h
@@ -18,7 +18,7 @@
#define SOFT_AAC_ENCODER_2_H_
-#include "SimpleSoftOMXComponent.h"
+#include <media/stagefright/omx/SimpleSoftOMXComponent.h>
#include "aacenc_lib.h"
diff --git a/media/libstagefright/codecs/amrnb/common/Android.bp b/media/libstagefright/codecs/amrnb/common/Android.bp
index c5ac558..5177593 100644
--- a/media/libstagefright/codecs/amrnb/common/Android.bp
+++ b/media/libstagefright/codecs/amrnb/common/Android.bp
@@ -1,5 +1,9 @@
cc_library_shared {
name: "libstagefright_amrnb_common",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: [
"src/add.cpp",
diff --git a/media/libstagefright/codecs/amrnb/dec/Android.bp b/media/libstagefright/codecs/amrnb/dec/Android.bp
index 9f3fe08..b493e21 100644
--- a/media/libstagefright/codecs/amrnb/dec/Android.bp
+++ b/media/libstagefright/codecs/amrnb/dec/Android.bp
@@ -1,5 +1,6 @@
cc_library_static {
name: "libstagefright_amrnbdec",
+ vendor_available: true,
srcs: [
"src/a_refl.cpp",
@@ -55,13 +56,20 @@
// ],
//},
- shared_libs: ["libstagefright_amrnb_common"],
+ shared_libs: [
+ "libstagefright_amrnb_common",
+ "liblog",
+ ],
}
//###############################################################################
cc_library_shared {
name: "libstagefright_soft_amrdec",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: ["SoftAMR.cpp"],
@@ -96,6 +104,7 @@
"liblog",
"libstagefright_amrnb_common",
],
+ compile_multilib: "32",
}
//###############################################################################
diff --git a/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp b/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp
index 7553153..b7e84ec 100644
--- a/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp
+++ b/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp
@@ -143,6 +143,30 @@
OMX_ERRORTYPE SoftAMR::internalGetParameter(
OMX_INDEXTYPE index, OMX_PTR params) {
switch (index) {
+ case OMX_IndexParamAudioPortFormat:
+ {
+ OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
+ (OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
+
+ if (!isValidOMXParam(formatParams)) {
+ return OMX_ErrorBadParameter;
+ }
+
+ if (formatParams->nPortIndex > 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ if (formatParams->nIndex > 0) {
+ return OMX_ErrorNoMore;
+ }
+
+ formatParams->eEncoding =
+ (formatParams->nPortIndex == 0)
+ ? OMX_AUDIO_CodingAMR : OMX_AUDIO_CodingPCM;
+
+ return OMX_ErrorNone;
+ }
+
case OMX_IndexParamAudioAmr:
{
OMX_AUDIO_PARAM_AMRTYPE *amrParams =
@@ -236,6 +260,29 @@
return OMX_ErrorNone;
}
+ case OMX_IndexParamAudioPortFormat:
+ {
+ const OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
+ (const OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
+
+ if (!isValidOMXParam(formatParams)) {
+ return OMX_ErrorBadParameter;
+ }
+
+ if (formatParams->nPortIndex > 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ if ((formatParams->nPortIndex == 0
+ && formatParams->eEncoding != OMX_AUDIO_CodingAMR)
+ || (formatParams->nPortIndex == 1
+ && formatParams->eEncoding != OMX_AUDIO_CodingPCM)) {
+ return OMX_ErrorUndefined;
+ }
+
+ return OMX_ErrorNone;
+ }
+
case OMX_IndexParamAudioAmr:
{
const OMX_AUDIO_PARAM_AMRTYPE *aacParams =
diff --git a/media/libstagefright/codecs/amrnb/dec/SoftAMR.h b/media/libstagefright/codecs/amrnb/dec/SoftAMR.h
index 758d6ac..869b81d 100644
--- a/media/libstagefright/codecs/amrnb/dec/SoftAMR.h
+++ b/media/libstagefright/codecs/amrnb/dec/SoftAMR.h
@@ -18,7 +18,7 @@
#define SOFT_AMR_H_
-#include "SimpleSoftOMXComponent.h"
+#include <media/stagefright/omx/SimpleSoftOMXComponent.h>
namespace android {
diff --git a/media/libstagefright/codecs/amrnb/enc/Android.bp b/media/libstagefright/codecs/amrnb/enc/Android.bp
index a0cf260..1e8fd31 100644
--- a/media/libstagefright/codecs/amrnb/enc/Android.bp
+++ b/media/libstagefright/codecs/amrnb/enc/Android.bp
@@ -1,5 +1,6 @@
cc_library_static {
name: "libstagefright_amrnbenc",
+ vendor_available: true,
srcs: [
"src/amrencode.cpp",
@@ -83,6 +84,10 @@
cc_library_shared {
name: "libstagefright_soft_amrnbenc",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: ["SoftAMRNBEncoder.cpp"],
@@ -110,6 +115,7 @@
"liblog",
"libstagefright_amrnb_common",
],
+ compile_multilib: "32",
}
//###############################################################################
diff --git a/media/libstagefright/codecs/amrnb/enc/SoftAMRNBEncoder.h b/media/libstagefright/codecs/amrnb/enc/SoftAMRNBEncoder.h
index 50178c4..c73e4dd 100644
--- a/media/libstagefright/codecs/amrnb/enc/SoftAMRNBEncoder.h
+++ b/media/libstagefright/codecs/amrnb/enc/SoftAMRNBEncoder.h
@@ -18,7 +18,7 @@
#define SOFT_AMRNB_ENCODER_H_
-#include "SimpleSoftOMXComponent.h"
+#include <media/stagefright/omx/SimpleSoftOMXComponent.h>
namespace android {
diff --git a/media/libstagefright/codecs/amrwb/Android.bp b/media/libstagefright/codecs/amrwb/Android.bp
index f2ab0da..14a73d6 100644
--- a/media/libstagefright/codecs/amrwb/Android.bp
+++ b/media/libstagefright/codecs/amrwb/Android.bp
@@ -1,5 +1,6 @@
cc_library_static {
name: "libstagefright_amrwbdec",
+ vendor_available: true,
srcs: [
"src/agc2_amr_wb.cpp",
diff --git a/media/libstagefright/codecs/amrwbenc/Android.bp b/media/libstagefright/codecs/amrwbenc/Android.bp
index eb27388..b6f637f 100644
--- a/media/libstagefright/codecs/amrwbenc/Android.bp
+++ b/media/libstagefright/codecs/amrwbenc/Android.bp
@@ -1,5 +1,6 @@
cc_library_static {
name: "libstagefright_amrwbenc",
+ vendor_available: true,
srcs: [
"src/autocorr.c",
@@ -144,6 +145,10 @@
cc_library_shared {
name: "libstagefright_soft_amrwbenc",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: ["SoftAMRWBEncoder.cpp"],
@@ -173,6 +178,7 @@
"liblog",
"libstagefright_enc_common",
],
+ compile_multilib: "32",
}
//###############################################################################
diff --git a/media/libstagefright/codecs/amrwbenc/SoftAMRWBEncoder.h b/media/libstagefright/codecs/amrwbenc/SoftAMRWBEncoder.h
index d0c1dab..8950a8c 100644
--- a/media/libstagefright/codecs/amrwbenc/SoftAMRWBEncoder.h
+++ b/media/libstagefright/codecs/amrwbenc/SoftAMRWBEncoder.h
@@ -18,7 +18,7 @@
#define SOFT_AMRWB_ENCODER_H_
-#include "SimpleSoftOMXComponent.h"
+#include <media/stagefright/omx/SimpleSoftOMXComponent.h>
#include "voAMRWB.h"
diff --git a/media/libstagefright/codecs/avcdec/Android.bp b/media/libstagefright/codecs/avcdec/Android.bp
index b6724be..34db19b 100644
--- a/media/libstagefright/codecs/avcdec/Android.bp
+++ b/media/libstagefright/codecs/avcdec/Android.bp
@@ -1,5 +1,9 @@
cc_library_shared {
name: "libstagefright_soft_avcdec",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
static_libs: ["libavcdec"],
srcs: ["SoftAVCDec.cpp"],
@@ -18,7 +22,7 @@
],
shared_libs: [
- "libmedia",
+ "libmedia_omx",
"libstagefright_omx",
"libstagefright_foundation",
"libutils",
@@ -36,4 +40,5 @@
},
ldflags: ["-Wl,-Bsymbolic"],
+ compile_multilib: "32",
}
diff --git a/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp b/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp
index 248ab6d..c342b6c 100644
--- a/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp
+++ b/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp
@@ -48,10 +48,14 @@
(IVD_CONTROL_API_COMMAND_TYPE_T)IH264D_CMD_CTL_SET_NUM_CORES
static const CodecProfileLevel kProfileLevels[] = {
+ { OMX_VIDEO_AVCProfileConstrainedBaseline, OMX_VIDEO_AVCLevel52 },
+
{ OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel52 },
{ OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel52 },
+ { OMX_VIDEO_AVCProfileConstrainedHigh, OMX_VIDEO_AVCLevel52 },
+
{ OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel52 },
};
diff --git a/media/libstagefright/codecs/avcdec/SoftAVCDec.h b/media/libstagefright/codecs/avcdec/SoftAVCDec.h
index 18b7556..679ed3e 100644
--- a/media/libstagefright/codecs/avcdec/SoftAVCDec.h
+++ b/media/libstagefright/codecs/avcdec/SoftAVCDec.h
@@ -18,7 +18,7 @@
#define SOFT_H264_DEC_H_
-#include "SoftVideoDecoderOMXComponent.h"
+#include <media/stagefright/omx/SoftVideoDecoderOMXComponent.h>
#include <sys/time.h>
namespace android {
diff --git a/media/libstagefright/codecs/avcenc/Android.bp b/media/libstagefright/codecs/avcenc/Android.bp
index f0542a3..5203126 100644
--- a/media/libstagefright/codecs/avcenc/Android.bp
+++ b/media/libstagefright/codecs/avcenc/Android.bp
@@ -1,5 +1,9 @@
cc_library_shared {
name: "libstagefright_soft_avcenc",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
static_libs: ["libavcenc"],
srcs: ["SoftAVCEnc.cpp"],
@@ -13,7 +17,7 @@
],
shared_libs: [
- "libmedia",
+ "libmedia_omx",
"libstagefright_omx",
"libutils",
"liblog",
@@ -35,4 +39,5 @@
"-Wno-unused-variable",
],
ldflags: ["-Wl,-Bsymbolic"],
+ compile_multilib: "32",
}
diff --git a/media/libstagefright/codecs/avcenc/SoftAVCEnc.cpp b/media/libstagefright/codecs/avcenc/SoftAVCEnc.cpp
index b1af17b..358c743 100644
--- a/media/libstagefright/codecs/avcenc/SoftAVCEnc.cpp
+++ b/media/libstagefright/codecs/avcenc/SoftAVCEnc.cpp
@@ -27,7 +27,6 @@
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/MediaErrors.h>
#include <media/stagefright/MetaData.h>
-#include <media/stagefright/Utils.h>
#include <OMX_IndexExt.h>
#include <OMX_VideoExt.h>
@@ -75,33 +74,11 @@
};
static const CodecProfileLevel kProfileLevels[] = {
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel1 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel1b },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel11 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel12 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel13 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel2 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel21 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel22 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel3 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel31 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel32 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel4 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel41 },
- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel1 },
- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel1b },
- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel11 },
- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel12 },
- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel13 },
- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel2 },
- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel21 },
- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel22 },
- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel3 },
- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel31 },
- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel32 },
- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel4 },
- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel41 },
+ { OMX_VIDEO_AVCProfileConstrainedBaseline, OMX_VIDEO_AVCLevel41 },
+ { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel41 },
+
+ { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel41 },
};
static size_t GetCPUCoreCount() {
@@ -629,8 +606,10 @@
level = 30;
} else if (displaySizeY > (352 * 288)) {
level = 21;
- } else {
+ } else if (displaySizeY > (176 * 144)) {
level = 20;
+ } else {
+ level = 10;
}
mAVCEncLevel = MAX(level, mAVCEncLevel);
@@ -963,7 +942,8 @@
return OMX_ErrorUndefined;
}
- avcParams->eProfile = OMX_VIDEO_AVCProfileBaseline;
+ // TODO: maintain profile
+ avcParams->eProfile = (OMX_VIDEO_AVCPROFILETYPE)OMX_VIDEO_AVCProfileConstrainedBaseline;
avcParams->eLevel = omxLevel;
avcParams->nRefFrames = 1;
avcParams->bUseHadamard = OMX_TRUE;
diff --git a/media/libstagefright/codecs/avcenc/SoftAVCEnc.h b/media/libstagefright/codecs/avcenc/SoftAVCEnc.h
index 818e4a1..a43cdf1 100644
--- a/media/libstagefright/codecs/avcenc/SoftAVCEnc.h
+++ b/media/libstagefright/codecs/avcenc/SoftAVCEnc.h
@@ -21,7 +21,7 @@
#include <media/stagefright/foundation/ABase.h>
#include <utils/Vector.h>
-#include "SoftVideoEncoderOMXComponent.h"
+#include <media/stagefright/omx/SoftVideoEncoderOMXComponent.h>
namespace android {
diff --git a/media/libstagefright/codecs/common/Android.bp b/media/libstagefright/codecs/common/Android.bp
index 021e6af..3726922 100644
--- a/media/libstagefright/codecs/common/Android.bp
+++ b/media/libstagefright/codecs/common/Android.bp
@@ -1,5 +1,9 @@
cc_library {
name: "libstagefright_enc_common",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: ["cmnMemory.c"],
diff --git a/media/libstagefright/codecs/flac/dec/Android.bp b/media/libstagefright/codecs/flac/dec/Android.bp
index 6ac264d..595cfdb 100644
--- a/media/libstagefright/codecs/flac/dec/Android.bp
+++ b/media/libstagefright/codecs/flac/dec/Android.bp
@@ -1,5 +1,9 @@
cc_library_shared {
name: "libstagefright_soft_flacdec",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: [
"SoftFlacDecoder.cpp",
@@ -33,4 +37,5 @@
"libstagefright_foundation",
"libutils",
],
+ compile_multilib: "32",
}
diff --git a/media/libstagefright/codecs/flac/dec/SoftFlacDecoder.cpp b/media/libstagefright/codecs/flac/dec/SoftFlacDecoder.cpp
index cff4a33..4ab1ab2 100644
--- a/media/libstagefright/codecs/flac/dec/SoftFlacDecoder.cpp
+++ b/media/libstagefright/codecs/flac/dec/SoftFlacDecoder.cpp
@@ -126,6 +126,29 @@
OMX_INDEXTYPE index, OMX_PTR params) {
ALOGV("internalGetParameter: index(%x)", index);
switch ((OMX_U32)index) {
+ case OMX_IndexParamAudioPortFormat:
+ {
+ OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
+ (OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
+
+ if (!isValidOMXParam(formatParams)) {
+ return OMX_ErrorBadParameter;
+ }
+
+ if (formatParams->nPortIndex > 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ if (formatParams->nIndex > 0) {
+ return OMX_ErrorNoMore;
+ }
+
+ formatParams->eEncoding =
+ (formatParams->nPortIndex == 0)
+ ? OMX_AUDIO_CodingFLAC : OMX_AUDIO_CodingPCM;
+
+ return OMX_ErrorNone;
+ }
case OMX_IndexParamAudioFlac:
{
OMX_AUDIO_PARAM_FLACTYPE *flacParams =
@@ -219,6 +242,29 @@
return OMX_ErrorNone;
}
+ case OMX_IndexParamAudioPortFormat:
+ {
+ const OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
+ (const OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
+
+ if (!isValidOMXParam(formatParams)) {
+ return OMX_ErrorBadParameter;
+ }
+
+ if (formatParams->nPortIndex > 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ if ((formatParams->nPortIndex == 0
+ && formatParams->eEncoding != OMX_AUDIO_CodingFLAC)
+ || (formatParams->nPortIndex == 1
+ && formatParams->eEncoding != OMX_AUDIO_CodingPCM)) {
+ return OMX_ErrorUndefined;
+ }
+
+ return OMX_ErrorNone;
+ }
+
case OMX_IndexParamAudioPcm:
{
const OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =
@@ -256,10 +302,27 @@
while (!inQueue.empty() && !outQueue.empty()) {
BufferInfo *inInfo = *inQueue.begin();
OMX_BUFFERHEADERTYPE *inHeader = inInfo->mHeader;
+ BufferInfo *outInfo = *outQueue.begin();
+ OMX_BUFFERHEADERTYPE *outHeader = outInfo->mHeader;
uint8_t* inBuffer = inHeader->pBuffer + inHeader->nOffset;
uint32_t inBufferLength = inHeader->nFilledLen;
bool endOfInput = (inHeader->nFlags & OMX_BUFFERFLAG_EOS) != 0;
+ if (inHeader->nFilledLen == 0) {
+ if (endOfInput) {
+ outHeader->nFilledLen = 0;
+ outHeader->nFlags = OMX_BUFFERFLAG_EOS;
+ outInfo->mOwnedByUs = false;
+ outQueue.erase(outQueue.begin());
+ notifyFillBufferDone(outHeader);
+ } else {
+ ALOGE("onQueueFilled: emptyInputBuffer received");
+ }
+ inInfo->mOwnedByUs = false;
+ inQueue.erase(inQueue.begin());
+ notifyEmptyBufferDone(inHeader);
+ return;
+ }
if (mInputBufferCount == 0 && !(inHeader->nFlags & OMX_BUFFERFLAG_CODECCONFIG)) {
ALOGE("onQueueFilled: first buffer should have OMX_BUFFERFLAG_CODECCONFIG set");
inHeader->nFlags |= OMX_BUFFERFLAG_CODECCONFIG;
@@ -297,8 +360,6 @@
return;
}
- BufferInfo *outInfo = *outQueue.begin();
- OMX_BUFFERHEADERTYPE *outHeader = outInfo->mHeader;
short *outBuffer =
reinterpret_cast<short *>(outHeader->pBuffer + outHeader->nOffset);
size_t outBufferSize = outHeader->nAllocLen - outHeader->nOffset;
diff --git a/media/libstagefright/codecs/flac/dec/SoftFlacDecoder.h b/media/libstagefright/codecs/flac/dec/SoftFlacDecoder.h
index c09081d..4a21c34 100644
--- a/media/libstagefright/codecs/flac/dec/SoftFlacDecoder.h
+++ b/media/libstagefright/codecs/flac/dec/SoftFlacDecoder.h
@@ -18,7 +18,7 @@
#define SOFT_FLAC_DECODER_H
#include "FLACDecoder.h"
-#include "SimpleSoftOMXComponent.h"
+#include <media/stagefright/omx/SimpleSoftOMXComponent.h>
namespace android {
diff --git a/media/libstagefright/codecs/flac/enc/Android.bp b/media/libstagefright/codecs/flac/enc/Android.bp
index d1413f6..066917b 100644
--- a/media/libstagefright/codecs/flac/enc/Android.bp
+++ b/media/libstagefright/codecs/flac/enc/Android.bp
@@ -22,7 +22,7 @@
},
shared_libs: [
- "libmedia",
+ "libmedia_omx",
"libstagefright_omx",
"libstagefright_foundation",
"libutils",
@@ -32,5 +32,10 @@
static_libs: ["libFLAC"],
name: "libstagefright_soft_flacenc",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
+ compile_multilib: "32",
}
diff --git a/media/libstagefright/codecs/flac/enc/SoftFlacEncoder.cpp b/media/libstagefright/codecs/flac/enc/SoftFlacEncoder.cpp
index caceda9..56d2d69 100644
--- a/media/libstagefright/codecs/flac/enc/SoftFlacEncoder.cpp
+++ b/media/libstagefright/codecs/flac/enc/SoftFlacEncoder.cpp
@@ -154,6 +154,30 @@
ALOGV("SoftFlacEncoder::internalGetParameter(index=0x%x)", index);
switch (index) {
+ case OMX_IndexParamAudioPortFormat:
+ {
+ OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
+ (OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
+
+ if (!isValidOMXParam(formatParams)) {
+ return OMX_ErrorBadParameter;
+ }
+
+ if (formatParams->nPortIndex > 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ if (formatParams->nIndex > 0) {
+ return OMX_ErrorNoMore;
+ }
+
+ formatParams->eEncoding =
+ (formatParams->nPortIndex == 0)
+ ? OMX_AUDIO_CodingPCM : OMX_AUDIO_CodingFLAC;
+
+ return OMX_ErrorNone;
+ }
+
case OMX_IndexParamAudioPcm:
{
OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =
@@ -163,7 +187,7 @@
return OMX_ErrorBadParameter;
}
- if (pcmParams->nPortIndex > 1) {
+ if (pcmParams->nPortIndex != 0) {
return OMX_ErrorUndefined;
}
@@ -189,6 +213,10 @@
return OMX_ErrorBadParameter;
}
+ if (flacParams->nPortIndex != 1) {
+ return OMX_ErrorUndefined;
+ }
+
flacParams->nCompressionLevel = mCompressionLevel;
flacParams->nChannels = mNumChannels;
flacParams->nSampleRate = mSampleRate;
@@ -203,6 +231,29 @@
OMX_ERRORTYPE SoftFlacEncoder::internalSetParameter(
OMX_INDEXTYPE index, const OMX_PTR params) {
switch (index) {
+ case OMX_IndexParamAudioPortFormat:
+ {
+ const OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
+ (const OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
+
+ if (!isValidOMXParam(formatParams)) {
+ return OMX_ErrorBadParameter;
+ }
+
+ if (formatParams->nPortIndex > 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ if ((formatParams->nPortIndex == 0
+ && formatParams->eEncoding != OMX_AUDIO_CodingPCM)
+ || (formatParams->nPortIndex == 1
+ && formatParams->eEncoding != OMX_AUDIO_CodingFLAC)) {
+ return OMX_ErrorUndefined;
+ }
+
+ return OMX_ErrorNone;
+ }
+
case OMX_IndexParamAudioPcm:
{
ALOGV("SoftFlacEncoder::internalSetParameter(OMX_IndexParamAudioPcm)");
@@ -212,7 +263,7 @@
return OMX_ErrorBadParameter;
}
- if (pcmParams->nPortIndex != 0 && pcmParams->nPortIndex != 1) {
+ if (pcmParams->nPortIndex != 0) {
ALOGE("SoftFlacEncoder::internalSetParameter() Error #1");
return OMX_ErrorUndefined;
}
@@ -258,6 +309,10 @@
return OMX_ErrorBadParameter;
}
+ if (flacParams->nPortIndex != 1) {
+ return OMX_ErrorUndefined;
+ }
+
mCompressionLevel = flacParams->nCompressionLevel; // range clamping done inside encoder
return OMX_ErrorNone;
}
diff --git a/media/libstagefright/codecs/flac/enc/SoftFlacEncoder.h b/media/libstagefright/codecs/flac/enc/SoftFlacEncoder.h
index 6027f76..f4f0655 100644
--- a/media/libstagefright/codecs/flac/enc/SoftFlacEncoder.h
+++ b/media/libstagefright/codecs/flac/enc/SoftFlacEncoder.h
@@ -18,7 +18,7 @@
#define SOFT_FLAC_ENC_H_
-#include "SimpleSoftOMXComponent.h"
+#include <media/stagefright/omx/SimpleSoftOMXComponent.h>
#include "FLAC/stream_encoder.h"
diff --git a/media/libstagefright/codecs/g711/dec/Android.bp b/media/libstagefright/codecs/g711/dec/Android.bp
index b78b689..fff72a8 100644
--- a/media/libstagefright/codecs/g711/dec/Android.bp
+++ b/media/libstagefright/codecs/g711/dec/Android.bp
@@ -1,5 +1,9 @@
cc_library_shared {
name: "libstagefright_soft_g711dec",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: ["SoftG711.cpp"],
@@ -9,7 +13,7 @@
],
shared_libs: [
- "libmedia",
+ "libmedia_omx",
"libstagefright_omx",
"libutils",
"liblog",
@@ -27,4 +31,5 @@
cfi: true,
},
},
+ compile_multilib: "32",
}
diff --git a/media/libstagefright/codecs/g711/dec/SoftG711.cpp b/media/libstagefright/codecs/g711/dec/SoftG711.cpp
index f7c0429..7a4cca9 100644
--- a/media/libstagefright/codecs/g711/dec/SoftG711.cpp
+++ b/media/libstagefright/codecs/g711/dec/SoftG711.cpp
@@ -105,6 +105,30 @@
OMX_ERRORTYPE SoftG711::internalGetParameter(
OMX_INDEXTYPE index, OMX_PTR params) {
switch (index) {
+ case OMX_IndexParamAudioPortFormat:
+ {
+ OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
+ (OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
+
+ if (!isValidOMXParam(formatParams)) {
+ return OMX_ErrorBadParameter;
+ }
+
+ if (formatParams->nPortIndex > 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ if (formatParams->nIndex > 0) {
+ return OMX_ErrorNoMore;
+ }
+
+ formatParams->eEncoding =
+ (formatParams->nPortIndex == 0)
+ ? OMX_AUDIO_CodingG711 : OMX_AUDIO_CodingPCM;
+
+ return OMX_ErrorNone;
+ }
+
case OMX_IndexParamAudioPcm:
{
OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =
@@ -173,6 +197,29 @@
return OMX_ErrorNone;
}
+ case OMX_IndexParamAudioPortFormat:
+ {
+ const OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
+ (const OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
+
+ if (!isValidOMXParam(formatParams)) {
+ return OMX_ErrorBadParameter;
+ }
+
+ if (formatParams->nPortIndex > 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ if ((formatParams->nPortIndex == 0
+ && formatParams->eEncoding != OMX_AUDIO_CodingG711)
+ || (formatParams->nPortIndex == 1
+ && formatParams->eEncoding != OMX_AUDIO_CodingPCM)) {
+ return OMX_ErrorUndefined;
+ }
+
+ return OMX_ErrorNone;
+ }
+
case OMX_IndexParamStandardComponentRole:
{
const OMX_PARAM_COMPONENTROLETYPE *roleParams =
diff --git a/media/libstagefright/codecs/g711/dec/SoftG711.h b/media/libstagefright/codecs/g711/dec/SoftG711.h
index 16b6340..3ece246 100644
--- a/media/libstagefright/codecs/g711/dec/SoftG711.h
+++ b/media/libstagefright/codecs/g711/dec/SoftG711.h
@@ -18,7 +18,7 @@
#define SOFT_G711_H_
-#include "SimpleSoftOMXComponent.h"
+#include <media/stagefright/omx/SimpleSoftOMXComponent.h>
namespace android {
diff --git a/media/libstagefright/codecs/gsm/dec/Android.bp b/media/libstagefright/codecs/gsm/dec/Android.bp
index 8e86ad6..753eeef 100644
--- a/media/libstagefright/codecs/gsm/dec/Android.bp
+++ b/media/libstagefright/codecs/gsm/dec/Android.bp
@@ -1,5 +1,9 @@
cc_library_shared {
name: "libstagefright_soft_gsmdec",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: ["SoftGSM.cpp"],
@@ -23,11 +27,12 @@
},
shared_libs: [
- "libmedia",
+ "libmedia_omx",
"libstagefright_omx",
"libutils",
"liblog",
],
static_libs: ["libgsm"],
+ compile_multilib: "32",
}
diff --git a/media/libstagefright/codecs/gsm/dec/SoftGSM.cpp b/media/libstagefright/codecs/gsm/dec/SoftGSM.cpp
index 11999b4..d777229 100644
--- a/media/libstagefright/codecs/gsm/dec/SoftGSM.cpp
+++ b/media/libstagefright/codecs/gsm/dec/SoftGSM.cpp
@@ -105,6 +105,30 @@
OMX_ERRORTYPE SoftGSM::internalGetParameter(
OMX_INDEXTYPE index, OMX_PTR params) {
switch (index) {
+ case OMX_IndexParamAudioPortFormat:
+ {
+ OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
+ (OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
+
+ if (!isValidOMXParam(formatParams)) {
+ return OMX_ErrorBadParameter;
+ }
+
+ if (formatParams->nPortIndex > 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ if (formatParams->nIndex > 0) {
+ return OMX_ErrorNoMore;
+ }
+
+ formatParams->eEncoding =
+ (formatParams->nPortIndex == 0)
+ ? OMX_AUDIO_CodingGSMFR : OMX_AUDIO_CodingPCM;
+
+ return OMX_ErrorNone;
+ }
+
case OMX_IndexParamAudioPcm:
{
OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =
@@ -164,6 +188,29 @@
return OMX_ErrorNone;
}
+ case OMX_IndexParamAudioPortFormat:
+ {
+ const OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
+ (const OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
+
+ if (!isValidOMXParam(formatParams)) {
+ return OMX_ErrorBadParameter;
+ }
+
+ if (formatParams->nPortIndex > 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ if ((formatParams->nPortIndex == 0
+ && formatParams->eEncoding != OMX_AUDIO_CodingGSMFR)
+ || (formatParams->nPortIndex == 1
+ && formatParams->eEncoding != OMX_AUDIO_CodingPCM)) {
+ return OMX_ErrorUndefined;
+ }
+
+ return OMX_ErrorNone;
+ }
+
case OMX_IndexParamStandardComponentRole:
{
const OMX_PARAM_COMPONENTROLETYPE *roleParams =
diff --git a/media/libstagefright/codecs/gsm/dec/SoftGSM.h b/media/libstagefright/codecs/gsm/dec/SoftGSM.h
index 0303dea..ef86915 100644
--- a/media/libstagefright/codecs/gsm/dec/SoftGSM.h
+++ b/media/libstagefright/codecs/gsm/dec/SoftGSM.h
@@ -18,7 +18,7 @@
#define SOFT_GSM_H_
-#include "SimpleSoftOMXComponent.h"
+#include <media/stagefright/omx/SimpleSoftOMXComponent.h>
extern "C" {
#include "gsm.h"
diff --git a/media/libstagefright/codecs/hevcdec/Android.bp b/media/libstagefright/codecs/hevcdec/Android.bp
index 3beb5d0..d9a5ee3 100644
--- a/media/libstagefright/codecs/hevcdec/Android.bp
+++ b/media/libstagefright/codecs/hevcdec/Android.bp
@@ -1,5 +1,9 @@
cc_library_shared {
name: "libstagefright_soft_hevcdec",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
static_libs: ["libhevcdec"],
srcs: ["SoftHEVC.cpp"],
@@ -28,7 +32,7 @@
},
shared_libs: [
- "libmedia",
+ "libmedia_omx",
"libstagefright_omx",
"libstagefright_foundation",
"libutils",
@@ -39,4 +43,5 @@
// requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
// Bug: 16853291
ldflags: ["-Wl,-Bsymbolic"],
+ compile_multilib: "32",
}
diff --git a/media/libstagefright/codecs/hevcdec/SoftHEVC.h b/media/libstagefright/codecs/hevcdec/SoftHEVC.h
index e7c2127..5800490 100644
--- a/media/libstagefright/codecs/hevcdec/SoftHEVC.h
+++ b/media/libstagefright/codecs/hevcdec/SoftHEVC.h
@@ -18,7 +18,7 @@
#define SOFT_HEVC_H_
-#include "SoftVideoDecoderOMXComponent.h"
+#include <media/stagefright/omx/SoftVideoDecoderOMXComponent.h>
#include <sys/time.h>
namespace android {
diff --git a/media/libstagefright/codecs/m4v_h263/dec/Android.bp b/media/libstagefright/codecs/m4v_h263/dec/Android.bp
index 04ea075..1216ae5 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/Android.bp
+++ b/media/libstagefright/codecs/m4v_h263/dec/Android.bp
@@ -1,5 +1,7 @@
cc_library_static {
name: "libstagefright_m4vh263dec",
+ vendor_available: true,
+ shared_libs: ["liblog"],
srcs: [
"src/adaptive_smooth_no_mmx.cpp",
@@ -66,6 +68,10 @@
cc_library_shared {
name: "libstagefright_soft_mpeg4dec",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: ["SoftMPEG4.cpp"],
@@ -87,7 +93,7 @@
static_libs: ["libstagefright_m4vh263dec"],
shared_libs: [
- "libmedia",
+ "libmedia_omx",
"libstagefright_omx",
"libstagefright_foundation",
"libutils",
@@ -103,4 +109,5 @@
cfi: true,
},
},
+ compile_multilib: "32",
}
diff --git a/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp b/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp
index 411a251..39b67ab 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp
+++ b/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp
@@ -31,20 +31,12 @@
namespace android {
static const CodecProfileLevel kM4VProfileLevels[] = {
- { OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level0 },
- { OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level0b },
- { OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level1 },
- { OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level2 },
{ OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level3 },
};
static const CodecProfileLevel kH263ProfileLevels[] = {
- { OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level10 },
- { OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level20 },
{ OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level30 },
{ OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level45 },
- { OMX_VIDEO_H263ProfileISWV2, OMX_VIDEO_H263Level10 },
- { OMX_VIDEO_H263ProfileISWV2, OMX_VIDEO_H263Level20 },
{ OMX_VIDEO_H263ProfileISWV2, OMX_VIDEO_H263Level30 },
{ OMX_VIDEO_H263ProfileISWV2, OMX_VIDEO_H263Level45 },
};
diff --git a/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.h b/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.h
index 4114e7d..e399ac9 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.h
+++ b/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.h
@@ -18,7 +18,7 @@
#define SOFT_MPEG4_H_
-#include "SoftVideoDecoderOMXComponent.h"
+#include <media/stagefright/omx/SoftVideoDecoderOMXComponent.h>
struct tagvideoDecControls;
diff --git a/media/libstagefright/codecs/m4v_h263/dec/src/vlc_decode.cpp b/media/libstagefright/codecs/m4v_h263/dec/src/vlc_decode.cpp
index f7192b1c..7202f98 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/src/vlc_decode.cpp
+++ b/media/libstagefright/codecs/m4v_h263/dec/src/vlc_decode.cpp
@@ -560,7 +560,7 @@
BitstreamShow13Bits(stream, &code);
- if (code == 0)
+ if (code < 8)
{
return VLC_CODE_ERROR;
}
diff --git a/media/libstagefright/codecs/m4v_h263/enc/Android.bp b/media/libstagefright/codecs/m4v_h263/enc/Android.bp
index d63c946..a95b807 100644
--- a/media/libstagefright/codecs/m4v_h263/enc/Android.bp
+++ b/media/libstagefright/codecs/m4v_h263/enc/Android.bp
@@ -1,5 +1,6 @@
cc_library_static {
name: "libstagefright_m4vh263enc",
+ vendor_available: true,
srcs: [
"src/bitstream_io.cpp",
@@ -52,6 +53,10 @@
cc_library_shared {
name: "libstagefright_soft_mpeg4enc",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: ["SoftMPEG4Encoder.cpp"],
@@ -75,7 +80,7 @@
static_libs: ["libstagefright_m4vh263enc"],
shared_libs: [
- "libmedia",
+ "libmedia_omx",
"libstagefright_omx",
"libutils",
"liblog",
@@ -90,6 +95,7 @@
cfi: true,
},
},
+ compile_multilib: "32",
}
//###############################################################################
diff --git a/media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp b/media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp
index 6d4cb69..7b90a01 100644
--- a/media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp
+++ b/media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp
@@ -29,7 +29,6 @@
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/MediaErrors.h>
#include <media/stagefright/MetaData.h>
-#include <media/stagefright/Utils.h>
#include "SoftMPEG4Encoder.h"
diff --git a/media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.h b/media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.h
index ae8cb6f..00f2dd3 100644
--- a/media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.h
+++ b/media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.h
@@ -19,7 +19,7 @@
#include <media/stagefright/MediaBuffer.h>
#include <media/stagefright/foundation/ABase.h>
-#include "SoftVideoEncoderOMXComponent.h"
+#include <media/stagefright/omx/SoftVideoEncoderOMXComponent.h>
#include "mp4enc_api.h"
diff --git a/media/libstagefright/codecs/mp3dec/Android.bp b/media/libstagefright/codecs/mp3dec/Android.bp
index 304fef8..c554a99 100644
--- a/media/libstagefright/codecs/mp3dec/Android.bp
+++ b/media/libstagefright/codecs/mp3dec/Android.bp
@@ -1,5 +1,6 @@
cc_library_static {
name: "libstagefright_mp3dec",
+ vendor_available: true,
srcs: [
"src/pvmp3_normalize.cpp",
@@ -77,6 +78,10 @@
cc_library_shared {
name: "libstagefright_soft_mp3dec",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: ["SoftMP3.cpp"],
@@ -102,7 +107,7 @@
},
shared_libs: [
- "libmedia",
+ "libmedia_omx",
"libstagefright_omx",
"libstagefright_foundation",
"libutils",
@@ -110,6 +115,7 @@
],
static_libs: ["libstagefright_mp3dec"],
+ compile_multilib: "32",
}
//###############################################################################
diff --git a/media/libstagefright/codecs/mp3dec/SoftMP3.cpp b/media/libstagefright/codecs/mp3dec/SoftMP3.cpp
index 3def1f0..2364684 100644
--- a/media/libstagefright/codecs/mp3dec/SoftMP3.cpp
+++ b/media/libstagefright/codecs/mp3dec/SoftMP3.cpp
@@ -134,6 +134,30 @@
OMX_ERRORTYPE SoftMP3::internalGetParameter(
OMX_INDEXTYPE index, OMX_PTR params) {
switch (index) {
+ case OMX_IndexParamAudioPortFormat:
+ {
+ OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
+ (OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
+
+ if (!isValidOMXParam(formatParams)) {
+ return OMX_ErrorBadParameter;
+ }
+
+ if (formatParams->nPortIndex > 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ if (formatParams->nIndex > 0) {
+ return OMX_ErrorNoMore;
+ }
+
+ formatParams->eEncoding =
+ (formatParams->nPortIndex == 0)
+ ? OMX_AUDIO_CodingMP3 : OMX_AUDIO_CodingPCM;
+
+ return OMX_ErrorNone;
+ }
+
case OMX_IndexParamAudioPcm:
{
OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =
@@ -208,6 +232,29 @@
return OMX_ErrorNone;
}
+ case OMX_IndexParamAudioPortFormat:
+ {
+ const OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
+ (const OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
+
+ if (!isValidOMXParam(formatParams)) {
+ return OMX_ErrorBadParameter;
+ }
+
+ if (formatParams->nPortIndex > 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ if ((formatParams->nPortIndex == 0
+ && formatParams->eEncoding != OMX_AUDIO_CodingMP3)
+ || (formatParams->nPortIndex == 1
+ && formatParams->eEncoding != OMX_AUDIO_CodingPCM)) {
+ return OMX_ErrorUndefined;
+ }
+
+ return OMX_ErrorNone;
+ }
+
case OMX_IndexParamAudioPcm:
{
const OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =
diff --git a/media/libstagefright/codecs/mp3dec/SoftMP3.h b/media/libstagefright/codecs/mp3dec/SoftMP3.h
index 3bfa6c7..976fd00 100644
--- a/media/libstagefright/codecs/mp3dec/SoftMP3.h
+++ b/media/libstagefright/codecs/mp3dec/SoftMP3.h
@@ -18,7 +18,7 @@
#define SOFT_MP3_H_
-#include "SimpleSoftOMXComponent.h"
+#include <media/stagefright/omx/SimpleSoftOMXComponent.h>
struct tPVMP3DecoderExternal;
diff --git a/media/libstagefright/codecs/mpeg2dec/Android.bp b/media/libstagefright/codecs/mpeg2dec/Android.bp
index 051b89b..9590e9f 100644
--- a/media/libstagefright/codecs/mpeg2dec/Android.bp
+++ b/media/libstagefright/codecs/mpeg2dec/Android.bp
@@ -1,5 +1,9 @@
cc_library_shared {
name: "libstagefright_soft_mpeg2dec",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
static_libs: ["libmpeg2dec"],
srcs: ["SoftMPEG2.cpp"],
@@ -18,7 +22,7 @@
],
shared_libs: [
- "libmedia",
+ "libmedia_omx",
"libstagefright_omx",
"libstagefright_foundation",
"libutils",
@@ -36,4 +40,5 @@
cfi: true,
},
},
+ compile_multilib: "32",
}
diff --git a/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.cpp b/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.cpp
index 9a69226..9d5f342 100644
--- a/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.cpp
+++ b/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.cpp
@@ -789,7 +789,7 @@
if (s_dec_op.u4_output_present) {
ssize_t timeStampIdx;
- outHeader->nFilledLen = (mWidth * mHeight * 3) / 2;
+ outHeader->nFilledLen = (outputBufferWidth() * outputBufferHeight() * 3) / 2;
timeStampIdx = getMinTimestampIdx(mTimeStamps, mTimeStampsValid);
if (timeStampIdx < 0) {
diff --git a/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.h b/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.h
index 6729a54..338fc30 100644
--- a/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.h
+++ b/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.h
@@ -18,7 +18,7 @@
#define SOFT_MPEG2_H_
-#include "SoftVideoDecoderOMXComponent.h"
+#include <media/stagefright/omx/SoftVideoDecoderOMXComponent.h>
#include <sys/time.h>
namespace android {
diff --git a/media/libstagefright/codecs/on2/dec/Android.bp b/media/libstagefright/codecs/on2/dec/Android.bp
index c4242c2..59c1f5d 100644
--- a/media/libstagefright/codecs/on2/dec/Android.bp
+++ b/media/libstagefright/codecs/on2/dec/Android.bp
@@ -1,5 +1,9 @@
cc_library_shared {
name: "libstagefright_soft_vpxdec",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: ["SoftVPX.cpp"],
@@ -11,7 +15,7 @@
static_libs: ["libvpx"],
shared_libs: [
- "libmedia",
+ "libmedia_omx",
"libstagefright_omx",
"libstagefright_foundation",
"libutils",
@@ -30,4 +34,5 @@
cfi: true,
},
},
+ compile_multilib: "32",
}
diff --git a/media/libstagefright/codecs/on2/dec/SoftVPX.h b/media/libstagefright/codecs/on2/dec/SoftVPX.h
index 84cf79c..d6bb902 100644
--- a/media/libstagefright/codecs/on2/dec/SoftVPX.h
+++ b/media/libstagefright/codecs/on2/dec/SoftVPX.h
@@ -18,7 +18,7 @@
#define SOFT_VPX_H_
-#include "SoftVideoDecoderOMXComponent.h"
+#include <media/stagefright/omx/SoftVideoDecoderOMXComponent.h>
#include "vpx/vpx_decoder.h"
#include "vpx/vpx_codec.h"
diff --git a/media/libstagefright/codecs/on2/enc/Android.bp b/media/libstagefright/codecs/on2/enc/Android.bp
index ba53090..5a52225 100644
--- a/media/libstagefright/codecs/on2/enc/Android.bp
+++ b/media/libstagefright/codecs/on2/enc/Android.bp
@@ -1,5 +1,9 @@
cc_library_shared {
name: "libstagefright_soft_vpxenc",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: [
"SoftVPXEncoder.cpp",
@@ -28,10 +32,11 @@
static_libs: ["libvpx"],
shared_libs: [
- "libmedia",
+ "libmedia_omx",
"libstagefright_omx",
"libstagefright_foundation",
"libutils",
"liblog",
],
+ compile_multilib: "32",
}
diff --git a/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h
index 86dfad7..dd86d36 100644
--- a/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h
+++ b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h
@@ -18,7 +18,7 @@
#define SOFT_VPX_ENCODER_H_
-#include "SoftVideoEncoderOMXComponent.h"
+#include <media/stagefright/omx/SoftVideoEncoderOMXComponent.h>
#include <OMX_VideoExt.h>
#include <OMX_IndexExt.h>
diff --git a/media/libstagefright/codecs/on2/h264dec/Android.bp b/media/libstagefright/codecs/on2/h264dec/Android.bp
deleted file mode 100644
index 0984283..0000000
--- a/media/libstagefright/codecs/on2/h264dec/Android.bp
+++ /dev/null
@@ -1,141 +0,0 @@
-cc_library_shared {
- name: "libstagefright_soft_h264dec",
-
- srcs: [
- "source/h264bsd_transform.c",
- "source/h264bsd_util.c",
- "source/h264bsd_byte_stream.c",
- "source/h264bsd_seq_param_set.c",
- "source/h264bsd_pic_param_set.c",
- "source/h264bsd_slice_header.c",
- "source/h264bsd_slice_data.c",
- "source/h264bsd_macroblock_layer.c",
- "source/h264bsd_stream.c",
- "source/h264bsd_vlc.c",
- "source/h264bsd_cavlc.c",
- "source/h264bsd_nal_unit.c",
- "source/h264bsd_neighbour.c",
- "source/h264bsd_storage.c",
- "source/h264bsd_slice_group_map.c",
- "source/h264bsd_intra_prediction.c",
- "source/h264bsd_inter_prediction.c",
- "source/h264bsd_reconstruct.c",
- "source/h264bsd_dpb.c",
- "source/h264bsd_image.c",
- "source/h264bsd_deblocking.c",
- "source/h264bsd_conceal.c",
- "source/h264bsd_vui.c",
- "source/h264bsd_pic_order_cnt.c",
- "source/h264bsd_decoder.c",
- "source/H264SwDecApi.c",
- "SoftAVC.cpp",
- ],
-
- arch: {
- arm: {
- instruction_set: "arm",
-
- neon: {
- cflags: [
- "-DH264DEC_NEON",
- "-DH264DEC_OMXDL",
- ],
- srcs: [
- "source/arm_neon_asm_gcc/h264bsdWriteMacroblock.S",
- "source/arm_neon_asm_gcc/h264bsdClearMbLayer.S",
- "source/arm_neon_asm_gcc/h264bsdFillRow7.S",
- "source/arm_neon_asm_gcc/h264bsdCountLeadingZeros.S",
- "source/arm_neon_asm_gcc/h264bsdFlushBits.S",
-
- "omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_DeblockChroma_I.c",
- "omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_DeblockLuma_I.c",
- "omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_InterpolateChroma.c",
- "omxdl/arm_neon/vc/m4p10/src/armVCM4P10_CAVLCTables.c",
- "omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC.c",
- "omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_DecodeCoeffsToPairCAVLC.c",
- "omxdl/arm_neon/src/armCOMM_Bitstream.c",
- "omxdl/arm_neon/src/armCOMM.c",
-
- "omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_DeblockingChroma_unsafe_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_DeblockingLuma_unsafe_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_Interpolate_Chroma_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_Align_unsafe_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_Copy_unsafe_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_DiagCopy_unsafe_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_FilterDeblockingChroma_HorEdge_I_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_FilterDeblockingChroma_VerEdge_I_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_FilterDeblockingLuma_HorEdge_I_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_FilterDeblockingLuma_VerEdge_I_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_InterpolateLuma_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_Average_4x_Align_unsafe_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_DecodeCoeffsToPair_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_DequantTables_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_QuantTables_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_TransformResidual4x4_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_UnpackBlock4x4_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_TransformDequantLumaDCFromPair_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_PredictIntra_16x16_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_PredictIntra_4x4_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_PredictIntraChroma_8x8_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_DequantTransformResidualFromPairAndAdd_s.S",
- "omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_TransformDequantChromaDCFromPair_s.S",
- ],
-
- local_include_dirs: [
- "source/arm_neon_asm_gcc",
-
- "omxdl/arm_neon/api",
- "omxdl/arm_neon/vc/api",
- "omxdl/arm_neon/vc/m4p10/api",
- ],
- },
- },
- },
-
- cflags: ["-Wall", "-Werror"],
-
- include_dirs: [
- "frameworks/av/media/libstagefright/include",
- "frameworks/native/include/media/openmax",
- ],
-
- export_include_dirs: ["inc"],
-
- sanitize: {
- misc_undefined: [
- "signed-integer-overflow",
- ],
- cfi: true,
- diag: {
- cfi: true,
- },
- },
-
- shared_libs: [
- "libmedia",
- "libstagefright_omx",
- "libstagefright_foundation",
- "libutils",
- "liblog",
- ],
-}
-
-//####################################################################
-// test utility: decoder
-//####################################################################
-//#
-//# Test application
-//#
-cc_binary {
- name: "decoder",
-
- srcs: ["source/DecTestBench.c"],
-
- cflags: ["-Wall", "-Werror"],
-
- shared_libs: ["libstagefright_soft_h264dec"],
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/on2/h264dec/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/media/libstagefright/codecs/on2/h264dec/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/on2/h264dec/NOTICE b/media/libstagefright/codecs/on2/h264dec/NOTICE
deleted file mode 100644
index c5b1efa..0000000
--- a/media/libstagefright/codecs/on2/h264dec/NOTICE
+++ /dev/null
@@ -1,190 +0,0 @@
-
- Copyright (c) 2005-2008, The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
diff --git a/media/libstagefright/codecs/on2/h264dec/SoftAVC.cpp b/media/libstagefright/codecs/on2/h264dec/SoftAVC.cpp
deleted file mode 100644
index 2f61d12..0000000
--- a/media/libstagefright/codecs/on2/h264dec/SoftAVC.cpp
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "SoftAVC"
-#include <utils/Log.h>
-
-#include "SoftAVC.h"
-
-#include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/MediaDefs.h>
-#include <media/stagefright/MediaErrors.h>
-#include <media/IOMX.h>
-
-
-namespace android {
-
-static const CodecProfileLevel kProfileLevels[] = {
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel1 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel1b },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel11 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel12 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel13 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel2 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel21 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel22 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel3 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel31 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel32 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel4 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel41 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel42 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel5 },
- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel51 },
-};
-
-SoftAVC::SoftAVC(
- const char *name,
- const OMX_CALLBACKTYPE *callbacks,
- OMX_PTR appData,
- OMX_COMPONENTTYPE **component)
- : SoftVideoDecoderOMXComponent(
- name, "video_decoder.avc", OMX_VIDEO_CodingAVC,
- kProfileLevels, ARRAY_SIZE(kProfileLevels),
- 320 /* width */, 240 /* height */, callbacks, appData, component),
- mHandle(NULL),
- mInputBufferCount(0),
- mFirstPicture(NULL),
- mFirstPictureId(-1),
- mPicId(0),
- mHeadersDecoded(false),
- mEOSStatus(INPUT_DATA_AVAILABLE),
- mSignalledError(false) {
- const size_t kMinCompressionRatio = 2;
- const size_t kMaxOutputBufferSize = 2048 * 2048 * 3 / 2;
- initPorts(
- kNumInputBuffers, kMaxOutputBufferSize / kMinCompressionRatio /* minInputBufferSize */,
- kNumOutputBuffers, MEDIA_MIMETYPE_VIDEO_AVC, kMinCompressionRatio);
-
- CHECK_EQ(initDecoder(), (status_t)OK);
-}
-
-SoftAVC::~SoftAVC() {
- H264SwDecRelease(mHandle);
- mHandle = NULL;
-
- while (mPicToHeaderMap.size() != 0) {
- OMX_BUFFERHEADERTYPE *header = mPicToHeaderMap.editValueAt(0);
- mPicToHeaderMap.removeItemsAt(0);
- delete header;
- header = NULL;
- }
- List<BufferInfo *> &outQueue = getPortQueue(kOutputPortIndex);
- List<BufferInfo *> &inQueue = getPortQueue(kInputPortIndex);
- CHECK(outQueue.empty());
- CHECK(inQueue.empty());
-
- delete[] mFirstPicture;
-}
-
-status_t SoftAVC::initDecoder() {
- // Force decoder to output buffers in display order.
- if (H264SwDecInit(&mHandle, 0) == H264SWDEC_OK) {
- return OK;
- }
- return UNKNOWN_ERROR;
-}
-
-void SoftAVC::onQueueFilled(OMX_U32 /* portIndex */) {
- if (mSignalledError || mOutputPortSettingsChange != NONE) {
- return;
- }
-
- if (mEOSStatus == OUTPUT_FRAMES_FLUSHED) {
- return;
- }
-
- List<BufferInfo *> &inQueue = getPortQueue(kInputPortIndex);
- List<BufferInfo *> &outQueue = getPortQueue(kOutputPortIndex);
-
- if (mHeadersDecoded) {
- // Dequeue any already decoded output frames to free up space
- // in the output queue.
-
- drainAllOutputBuffers(false /* eos */);
- }
-
- H264SwDecRet ret = H264SWDEC_PIC_RDY;
- bool portWillReset = false;
- while ((mEOSStatus != INPUT_DATA_AVAILABLE || !inQueue.empty())
- && outQueue.size() == kNumOutputBuffers) {
-
- if (mEOSStatus == INPUT_EOS_SEEN) {
- drainAllOutputBuffers(true /* eos */);
- return;
- }
-
- BufferInfo *inInfo = *inQueue.begin();
- OMX_BUFFERHEADERTYPE *inHeader = inInfo->mHeader;
- ++mPicId;
-
- OMX_BUFFERHEADERTYPE *header = new OMX_BUFFERHEADERTYPE;
- memset(header, 0, sizeof(OMX_BUFFERHEADERTYPE));
- header->nTimeStamp = inHeader->nTimeStamp;
- header->nFlags = inHeader->nFlags;
- if (header->nFlags & OMX_BUFFERFLAG_EOS) {
- mEOSStatus = INPUT_EOS_SEEN;
- }
- mPicToHeaderMap.add(mPicId, header);
- inQueue.erase(inQueue.begin());
-
- H264SwDecInput inPicture;
- H264SwDecOutput outPicture;
- memset(&inPicture, 0, sizeof(inPicture));
- inPicture.dataLen = inHeader->nFilledLen;
- inPicture.pStream = inHeader->pBuffer + inHeader->nOffset;
- inPicture.picId = mPicId;
- inPicture.intraConcealmentMethod = 1;
- H264SwDecPicture decodedPicture;
-
- while (inPicture.dataLen > 0) {
- ret = H264SwDecDecode(mHandle, &inPicture, &outPicture);
- if (ret == H264SWDEC_HDRS_RDY_BUFF_NOT_EMPTY ||
- ret == H264SWDEC_PIC_RDY_BUFF_NOT_EMPTY) {
- inPicture.dataLen -= (u32)(outPicture.pStrmCurrPos - inPicture.pStream);
- inPicture.pStream = outPicture.pStrmCurrPos;
- if (ret == H264SWDEC_HDRS_RDY_BUFF_NOT_EMPTY) {
- mHeadersDecoded = true;
- H264SwDecInfo decoderInfo;
- CHECK(H264SwDecGetInfo(mHandle, &decoderInfo) == H264SWDEC_OK);
-
- SoftVideoDecoderOMXComponent::CropSettingsMode cropSettingsMode =
- handleCropParams(decoderInfo);
- handlePortSettingsChange(
- &portWillReset, decoderInfo.picWidth, decoderInfo.picHeight,
- cropSettingsMode);
- }
- } else {
- if (portWillReset) {
- if (H264SwDecNextPicture(mHandle, &decodedPicture, 0)
- == H264SWDEC_PIC_RDY) {
-
- // Save this output buffer; otherwise, it will be
- // lost during dynamic port reconfiguration because
- // OpenMAX client will delete _all_ output buffers
- // in the process.
- saveFirstOutputBuffer(
- decodedPicture.picId,
- (uint8_t *)decodedPicture.pOutputPicture);
- }
- }
- inPicture.dataLen = 0;
- if (ret < 0) {
- ALOGE("Decoder failed: %d", ret);
-
- notify(OMX_EventError, OMX_ErrorUndefined,
- ERROR_MALFORMED, NULL);
-
- mSignalledError = true;
- return;
- }
- }
- }
- inInfo->mOwnedByUs = false;
- notifyEmptyBufferDone(inHeader);
-
- if (portWillReset) {
- return;
- }
-
- if (mFirstPicture && !outQueue.empty()) {
- if (!drainOneOutputBuffer(mFirstPictureId, mFirstPicture)) {
- ALOGE("Drain failed");
- notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
- mSignalledError = true;
- return;
- }
- delete[] mFirstPicture;
- mFirstPicture = NULL;
- mFirstPictureId = -1;
- }
-
- drainAllOutputBuffers(false /* eos */);
- }
-}
-
-SoftVideoDecoderOMXComponent::CropSettingsMode SoftAVC::handleCropParams(
- const H264SwDecInfo& decInfo) {
- if (!decInfo.croppingFlag) {
- return kCropUnSet;
- }
-
- const CropParams& crop = decInfo.cropParams;
- if (mCropLeft == crop.cropLeftOffset &&
- mCropTop == crop.cropTopOffset &&
- mCropWidth == crop.cropOutWidth &&
- mCropHeight == crop.cropOutHeight) {
- return kCropSet;
- }
-
- mCropLeft = crop.cropLeftOffset;
- mCropTop = crop.cropTopOffset;
- mCropWidth = crop.cropOutWidth;
- mCropHeight = crop.cropOutHeight;
- return kCropChanged;
-}
-
-void SoftAVC::saveFirstOutputBuffer(int32_t picId, uint8_t *data) {
- CHECK(mFirstPicture == NULL);
- mFirstPictureId = picId;
-
- uint32_t pictureSize = mWidth * mHeight * 3 / 2;
- mFirstPicture = new uint8_t[pictureSize];
- memcpy(mFirstPicture, data, pictureSize);
-}
-
-bool SoftAVC::drainOneOutputBuffer(int32_t picId, uint8_t* data) {
- List<BufferInfo *> &outQueue = getPortQueue(kOutputPortIndex);
- BufferInfo *outInfo = *outQueue.begin();
- OMX_BUFFERHEADERTYPE *outHeader = outInfo->mHeader;
- OMX_U32 frameSize = mWidth * mHeight * 3 / 2;
- if (outHeader->nAllocLen - outHeader->nOffset < frameSize) {
- android_errorWriteLog(0x534e4554, "27833616");
- return false;
- }
- outQueue.erase(outQueue.begin());
- OMX_BUFFERHEADERTYPE *header = mPicToHeaderMap.valueFor(picId);
- outHeader->nTimeStamp = header->nTimeStamp;
- outHeader->nFlags = header->nFlags;
- outHeader->nFilledLen = frameSize;
-
- uint8_t *dst = outHeader->pBuffer + outHeader->nOffset;
- const uint8_t *srcY = data;
- const uint8_t *srcU = srcY + mWidth * mHeight;
- const uint8_t *srcV = srcU + mWidth * mHeight / 4;
- size_t srcYStride = mWidth;
- size_t srcUStride = mWidth / 2;
- size_t srcVStride = srcUStride;
- copyYV12FrameToOutputBuffer(dst, srcY, srcU, srcV, srcYStride, srcUStride, srcVStride);
-
- mPicToHeaderMap.removeItem(picId);
- delete header;
- outInfo->mOwnedByUs = false;
- notifyFillBufferDone(outHeader);
- return true;
-}
-
-void SoftAVC::drainAllOutputBuffers(bool eos) {
- List<BufferInfo *> &outQueue = getPortQueue(kOutputPortIndex);
- H264SwDecPicture decodedPicture;
-
- if (mHeadersDecoded) {
- while (!outQueue.empty()
- && H264SWDEC_PIC_RDY == H264SwDecNextPicture(
- mHandle, &decodedPicture, eos /* flush */)) {
- int32_t picId = decodedPicture.picId;
- uint8_t *data = (uint8_t *) decodedPicture.pOutputPicture;
- if (!drainOneOutputBuffer(picId, data)) {
- ALOGE("Drain failed");
- notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
- mSignalledError = true;
- return;
- }
- }
- }
-
- if (!eos) {
- return;
- }
-
- while (!outQueue.empty()) {
- BufferInfo *outInfo = *outQueue.begin();
- outQueue.erase(outQueue.begin());
- OMX_BUFFERHEADERTYPE *outHeader = outInfo->mHeader;
-
- outHeader->nTimeStamp = 0;
- outHeader->nFilledLen = 0;
- outHeader->nFlags = OMX_BUFFERFLAG_EOS;
-
- outInfo->mOwnedByUs = false;
- notifyFillBufferDone(outHeader);
-
- mEOSStatus = OUTPUT_FRAMES_FLUSHED;
- }
-}
-
-void SoftAVC::onPortFlushCompleted(OMX_U32 portIndex) {
- if (portIndex == kInputPortIndex) {
- mEOSStatus = INPUT_DATA_AVAILABLE;
- }
-}
-
-void SoftAVC::onReset() {
- SoftVideoDecoderOMXComponent::onReset();
- mSignalledError = false;
-}
-
-} // namespace android
-
-android::SoftOMXComponent *createSoftOMXComponent(
- const char *name, const OMX_CALLBACKTYPE *callbacks,
- OMX_PTR appData, OMX_COMPONENTTYPE **component) {
- return new android::SoftAVC(name, callbacks, appData, component);
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/SoftAVC.h b/media/libstagefright/codecs/on2/h264dec/SoftAVC.h
deleted file mode 100644
index b8c1807..0000000
--- a/media/libstagefright/codecs/on2/h264dec/SoftAVC.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SOFT_AVC_H_
-
-#define SOFT_AVC_H_
-
-#include "SoftVideoDecoderOMXComponent.h"
-#include <utils/KeyedVector.h>
-
-#include "H264SwDecApi.h"
-#include "basetype.h"
-
-namespace android {
-
-struct SoftAVC : public SoftVideoDecoderOMXComponent {
- SoftAVC(const char *name,
- const OMX_CALLBACKTYPE *callbacks,
- OMX_PTR appData,
- OMX_COMPONENTTYPE **component);
-
-protected:
- virtual ~SoftAVC();
-
- virtual void onQueueFilled(OMX_U32 portIndex);
- virtual void onPortFlushCompleted(OMX_U32 portIndex);
- virtual void onReset();
-
-private:
- enum {
- kNumInputBuffers = 8,
- kNumOutputBuffers = 2,
- };
-
- enum EOSStatus {
- INPUT_DATA_AVAILABLE,
- INPUT_EOS_SEEN,
- OUTPUT_FRAMES_FLUSHED,
- };
-
- void *mHandle;
-
- size_t mInputBufferCount;
-
- uint8_t *mFirstPicture;
- int32_t mFirstPictureId;
-
- int32_t mPicId; // Which output picture is for which input buffer?
-
- // OMX_BUFFERHEADERTYPE may be overkill, but it is convenient
- // for tracking the following fields: nFlags, nTimeStamp, etc.
- KeyedVector<int32_t, OMX_BUFFERHEADERTYPE *> mPicToHeaderMap;
- bool mHeadersDecoded;
-
- EOSStatus mEOSStatus;
-
- bool mSignalledError;
-
- status_t initDecoder();
- void drainAllOutputBuffers(bool eos);
- bool drainOneOutputBuffer(int32_t picId, uint8_t *data);
- void saveFirstOutputBuffer(int32_t pidId, uint8_t *data);
- CropSettingsMode handleCropParams(const H264SwDecInfo& decInfo);
-
- DISALLOW_EVIL_CONSTRUCTORS(SoftAVC);
-};
-
-} // namespace android
-
-#endif // SOFT_AVC_H_
-
diff --git a/media/libstagefright/codecs/on2/h264dec/inc/H264SwDecApi.h b/media/libstagefright/codecs/on2/h264dec/inc/H264SwDecApi.h
deleted file mode 100644
index 9814e73..0000000
--- a/media/libstagefright/codecs/on2/h264dec/inc/H264SwDecApi.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include Headers
-
- 2. Enumerations used as a return value or a parameter.
- 2.1. API's return value enumerations.
-
- 3. User Structures
- 3.1. Structures for H264SwDecDecode() parameters.
- 3.2. Structures for information interchange with
- DEC API and user application.
-
- 4. Prototypes of Decoder API functions
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDECAPI_H
-#define H264SWDECAPI_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/*------------------------------------------------------------------------------
- 1. Include Headers
-------------------------------------------------------------------------------*/
-
- #include "basetype.h"
-
-/*------------------------------------------------------------------------------
- 2.1. API's return value enumerations.
-------------------------------------------------------------------------------*/
-
- typedef enum
- {
- H264SWDEC_OK = 0,
- H264SWDEC_STRM_PROCESSED = 1,
- H264SWDEC_PIC_RDY,
- H264SWDEC_PIC_RDY_BUFF_NOT_EMPTY,
- H264SWDEC_HDRS_RDY_BUFF_NOT_EMPTY,
- H264SWDEC_PARAM_ERR = -1,
- H264SWDEC_STRM_ERR = -2,
- H264SWDEC_NOT_INITIALIZED = -3,
- H264SWDEC_MEMFAIL = -4,
- H264SWDEC_INITFAIL = -5,
- H264SWDEC_HDRS_NOT_RDY = -6,
- H264SWDEC_EVALUATION_LIMIT_EXCEEDED = -7
- } H264SwDecRet;
-
-/*------------------------------------------------------------------------------
- 3.1. Structures for H264SwDecDecode() parameters.
-------------------------------------------------------------------------------*/
-
- /* typedef of the Decoder instance */
- typedef void *H264SwDecInst;
-
- /* Input structure */
- typedef struct
- {
- u8 *pStream; /* Pointer to stream to be decoded */
- u32 dataLen; /* Number of bytes to be decoded */
- u32 picId; /* Identifier for the picture to be decoded */
- u32 intraConcealmentMethod; /* 0 = Gray concealment for intra
- 1 = Reference concealment for intra */
-
- } H264SwDecInput;
-
-
- /* Output structure */
- typedef struct
- {
- u8 *pStrmCurrPos; /* Pointer to stream position where decoder
- ended up */
- } H264SwDecOutput;
-
- /* Output structure for H264SwDecNextPicture */
- typedef struct
- {
- u32 *pOutputPicture; /* Pointer to the picture, YUV format */
- u32 picId; /* Identifier of the picture to be displayed*/
- u32 isIdrPicture; /* Flag to indicate if the picture is an
- IDR picture */
- u32 nbrOfErrMBs; /* Number of concealed MB's in the picture */
- } H264SwDecPicture;
-
-/*------------------------------------------------------------------------------
- 3.2. Structures for information interchange with DEC API
- and user application.
-------------------------------------------------------------------------------*/
-
- typedef struct
- {
- u32 cropLeftOffset;
- u32 cropOutWidth;
- u32 cropTopOffset;
- u32 cropOutHeight;
- } CropParams;
-
- typedef struct
- {
- u32 profile;
- u32 picWidth;
- u32 picHeight;
- u32 videoRange;
- u32 matrixCoefficients;
- u32 parWidth;
- u32 parHeight;
- u32 croppingFlag;
- CropParams cropParams;
- } H264SwDecInfo;
-
- /* Version information */
- typedef struct
- {
- u32 major; /* Decoder API major version */
- u32 minor; /* Dncoder API minor version */
- } H264SwDecApiVersion;
-
-/*------------------------------------------------------------------------------
- 4. Prototypes of Decoder API functions
-------------------------------------------------------------------------------*/
-
- H264SwDecRet H264SwDecDecode(H264SwDecInst decInst,
- H264SwDecInput *pInput,
- H264SwDecOutput *pOutput);
-
- H264SwDecRet H264SwDecInit(H264SwDecInst *decInst,
- u32 noOutputReordering);
-
- H264SwDecRet H264SwDecNextPicture(H264SwDecInst decInst,
- H264SwDecPicture *pOutput,
- u32 endOfStream);
-
- H264SwDecRet H264SwDecGetInfo(H264SwDecInst decInst,
- H264SwDecInfo *pDecInfo);
-
- void H264SwDecRelease(H264SwDecInst decInst);
-
- H264SwDecApiVersion H264SwDecGetAPIVersion(void);
-
- /* function prototype for API trace */
- void H264SwDecTrace(char *);
-
- /* function prototype for memory allocation */
- void* H264SwDecMalloc(u32 size, u32 num);
-
- /* function prototype for memory free */
- void H264SwDecFree(void *ptr);
-
- /* function prototype for memory copy */
- void H264SwDecMemcpy(void *dest, void *src, u32 count);
-
- /* function prototype for memset */
- void H264SwDecMemset(void *ptr, i32 value, u32 count);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* H264SWDECAPI_H */
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/inc/basetype.h b/media/libstagefright/codecs/on2/h264dec/inc/basetype.h
deleted file mode 100644
index 63d5653..0000000
--- a/media/libstagefright/codecs/on2/h264dec/inc/basetype.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef BASETYPE_H_INCLUDED
-#define BASETYPE_H_INCLUDED
-
-
-#ifdef __arm
-#define VOLATILE volatile
-#else
-#define VOLATILE
-#endif
-
-typedef unsigned char u8;
-typedef signed char i8;
-typedef unsigned short u16;
-typedef signed short i16;
-typedef unsigned int u32;
-typedef signed int i32;
-
-#if defined(VC1SWDEC_16BIT) || defined(MP4ENC_ARM11)
-typedef unsigned short u16x;
-typedef signed short i16x;
-#else
-typedef unsigned int u16x;
-typedef signed int i16x;
-#endif
-
-
-#ifndef NULL
-#ifdef __cplusplus
-#define NULL 0
-#else
-#define NULL ((void *)0)
-#endif
-#endif
-
-#endif /* BASETYPE_H_INCLUDED */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/ARM_DELIVERY.TXT b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/ARM_DELIVERY.TXT
deleted file mode 100644
index 5ce70ca..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/ARM_DELIVERY.TXT
+++ /dev/null
@@ -1,63 +0,0 @@
-The contents of this transaction was created by Hedley Francis
-of ARM on 19-Feb-2008.
-
-It contains the ARM data versions listed below.
-
-This data, unless otherwise stated, is ARM Proprietary and access to it
-is subject to the agreements indicated below.
-
-If you experience problems with this data, please contact ARM support
-quoting transaction reference <97413>.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-- OX001-SW-98010-r0p0-00bet1
- Video codecs - optimised code
- V6 optimized code release for Hantro (Ver 1.0.2)
- internal access
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-This transaction contains deliverables which are designated as being of
-beta release status (BET).
-
-Beta release status has a particular meaning to ARM of which the recipient
-must be aware. Beta is a pre-release status indicating that the deliverable
-so described is believed to robustly demonstrate specified behaviour, to be
-consistent across its included aspects and be ready for general deployment.
-But Beta also indicates that pre-release reliability trials are ongoing and
-that it is possible residual defects or errors in operation, consistency
-and documentation may still be encountered. The recipient should consider
-this position when using this Beta material supplied. ARM will normally
-attempt to provide fixes or a work-around for defects identified by the
-recipient, but the provision or timeliness of this support cannot be
-guaranteed. ARM shall not be responsible for direct or consequential
-damages as a result of encountering one or more of these residual defects.
-By accepting a Beta release, the recipient agrees to these constraints and
-to providing reasonable information to ARM to enable the replication of the
-defects identified by the recipient. The specific Beta version supplied
-will not be supported after release of a later or higher status version.
-It should be noted that Support for the Beta release of the deliverable
-will only be provided by ARM to a recipient who has a current support and
-maintenance contract for the deliverable.
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-In addition to the data versions listed above, this transaction contains
-two additional files at the top level.
-
-The first is this file, ARM_DELIVERY_97413.TXT, which is the delivery
-note.
-
-The second is ARM_MANIFEST_97413.TXT which contains a manifest of all the
-files included in this transaction, together with their checksums.
-
-The checksums provided are calculated using the RSA Data Security, Inc.
-MD5 Message-Digest Algorithm.
-
-The checksums can be used to verify the integrity of this data using the
-"md5sum" tool (which is part of the GNU "textutils" package) by running:
-
- % md5sum --check ARM_MANIFEST_97413.TXT
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/ARM_MANIFEST.TXT b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/ARM_MANIFEST.TXT
deleted file mode 100644
index 9b2238b..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/ARM_MANIFEST.TXT
+++ /dev/null
@@ -1,91 +0,0 @@
- OX001-SW-98010-r0p0-00bet1/
- OX001-SW-98010-r0p0-00bet1/api/
-e049791cfab6060a08cbac7b3ad767d6 OX001-SW-98010-r0p0-00bet1/api/armCOMM_s.h
-ed798face25497b2703ede736d6d52b6 OX001-SW-98010-r0p0-00bet1/api/omxtypes_s.h
-4eebd63af087376811d6749f0646b864 OX001-SW-98010-r0p0-00bet1/api/armCOMM_BitDec_s.h
-43cf46c2cf2fe1f93c615b57bcbe4809 OX001-SW-98010-r0p0-00bet1/api/armCOMM.h
-8f248ceaac8f602e277a521b679dcbbe OX001-SW-98010-r0p0-00bet1/api/armCOMM_IDCTTable.h
-53f2ae8a98495f05e26a4cf862a7f750 OX001-SW-98010-r0p0-00bet1/api/armCOMM_Version.h
-3a2f420ddf6a1b950470bd0f5ebd5c62 OX001-SW-98010-r0p0-00bet1/api/armCOMM_IDCT_s.h
-511c0bb534fe223599e2c84eff24c9ed OX001-SW-98010-r0p0-00bet1/api/armCOMM_MaskTable.h
-8971932d56eed6b1ad1ba507f0bff5f0 OX001-SW-98010-r0p0-00bet1/api/armCOMM_Bitstream.h
-f87fedd9ca432fefa757008176864ef8 OX001-SW-98010-r0p0-00bet1/api/armOMX.h
-8e49899a428822c36ef9dd94e0e05f18 OX001-SW-98010-r0p0-00bet1/api/omxtypes.h
-694281d11af52f88e6f9d4cb226ac8a7 OX001-SW-98010-r0p0-00bet1/build_vc.pl
-e72d96c0a415459748df9807f3dae72f OX001-SW-98010-r0p0-00bet1/filelist_vc.txt
- OX001-SW-98010-r0p0-00bet1/src/
-5eeae659a29477f5c52296d24afffd3c OX001-SW-98010-r0p0-00bet1/src/armCOMM_IDCTTable.c
-d64cdcf38f7749dc7f77465e5b7d356d OX001-SW-98010-r0p0-00bet1/src/armCOMM_MaskTable.c
- OX001-SW-98010-r0p0-00bet1/vc/
- OX001-SW-98010-r0p0-00bet1/vc/m4p10/
- OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/
-e7e0c320978564a7c9b2c723749a98d6 OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_CAVLCTables.c
-4adcd0df081990bdfc4729041a2a9152 OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_InterpolateChroma.c
-852e0404142965dc1f3aa7f00ee5127b OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_UnpackBlock4x4_s.s
-7054151c5bfea6b5e74feee86b2d7b01 OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_DecodeCoeffsToPairCAVLC.c
-38944c5e0bba01e32ff349c2c87c71b2 OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_DequantTables_s.s
-32ff4b8be62e2f0f3e764b83c1e5e2fd OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_DeblockChroma_I.c
-90b0e6a04e764902c0a0903640c10b32 OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_DeblockingLuma_unsafe_s.s
-28a19ae4fe2258628080d6a89bb54b91 OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_DeblockingChroma_unsafe_s.s
-98e196b9e1ffebaf91f62ea9d17fb97d OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_InterpolateLuma_s.s
-01ba60eff66ea49a4f833ce6279f8e2f OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_DeblockLuma_I.c
-f301d5a95e07354f593ea5747c01cb0a OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe_s.s
-44c9ef21e840a100301f7d7a4189957c OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe_s.s
-a33b03bbd3352d24ed744769e12bb87d OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe_s.s
-00c20bfda67bb86096b615fc17c94b35 OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_TransformDequantChromaDCFromPair_s.s
-2ddcaf60a8ea1e6e6b77737f768bfb9d OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_QuantTables_s.s
-c3002aad5600f872b70a5d7fe3915846 OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_InterpolateLuma_Align_unsafe_s.s
-a2900f2c47f1c61d20bd6c1eda33d6d4 OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_InterpolateLuma_Copy_unsafe_s.s
-e4fecd66bc47f07539bc308935e84a1f OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_PredictIntra_4x4_s.s
-78815c9df50ba53131bb22d2b829e3c3 OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_TransformDequantLumaDCFromPair_s.s
-1909ae312ac79a03a5fac1d1e8bc0291 OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_HorEdge_I_s.s
-3d2c48580655928065de7839866d9bc4 OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe_s.s
-23aa2fdf155d4fa6ff745eab6e01f32b OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_PredictIntra_16x16_s.s
-97f20a93c481d7f6173d919f41e415bd OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_VerEdge_I_s.s
-becd512da202436286811b6aec061f47 OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_HorEdge_I_s.s
-dd24a99ae3cd842dcacaf31d47de88b3 OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_VerEdge_I_s.s
-c2d995f787b6f44ef10c751c12d1935f OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_InterpolateLuma_DiagCopy_unsafe_s.s
-3628fbdf0cd217c287b6ccc94135d06e OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_PredictIntraChroma_8x8_s.s
-4a52b3e9e268b8a8f07829bf500d03af OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_DecodeCoeffsToPair_s.s
-11249f8a98c5d4b84cb5575b0e37ca9c OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_Average_4x_Align_unsafe_s.s
-3599b1074330965c8ca285d164efccff OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_Interpolate_Chroma_s.s
-3339e026c7de655d9400949eb5e51451 OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_TransformResidual4x4_s.s
-cc4a6f32db0b72a91d3f278f6855df69 OX001-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC.c
- OX001-SW-98010-r0p0-00bet1/vc/m4p10/api/
-6e530ddaa7c2b57ffe88162c020cb662 OX001-SW-98010-r0p0-00bet1/vc/m4p10/api/armVCM4P10_CAVLCTables.h
- OX001-SW-98010-r0p0-00bet1/vc/m4p2/
- OX001-SW-98010-r0p0-00bet1/vc/m4p2/src/
-cdf412920c2037a725d0420002b6752e OX001-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_Clip8_s.s
-dba9824e959b21d401cac925e68a11a6 OX001-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_Inter_s.s
-b559b71d5c94627f10e616fb72c0cefc OX001-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_QuantInvIntra_I_s.s
-4fba4c431a783a78a2eb6497a94ac967 OX001-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_Zigzag_Tables.c
-1e4c3be8c5eddc00c9f05e83bcf315ef OX001-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_MCReconBlock_s.s
-1b0b2990c2669dfb87cf6b810611c01b OX001-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_Huff_Tables_VLC.c
-1c9b87abf3283e957816b3937c680701 OX001-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_DecodePadMV_PVOP_s.s
-4fe1afca659a9055fc1172e58f78a506 OX001-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Intra.c
-2ea067f0436f91ba1351edaf411cb4ea OX001-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_Lookup_Tables.c
-acb92be1dbcdb3ebe824cbe9e28d03bf OX001-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_IDCT8x8blk_s.s
-a6b41f01b1df7dd656ebdba3084bfa2a OX001-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_FindMVpred_s.s
-293a48a648a3085456e6665bb7366fad OX001-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_SetPredDir_s.s
-ffe6b96c74d4881f4d3c8de8cc737797 OX001-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_QuantInvInter_I_s.s
-437dfa204508850d61d4b87091446e9f OX001-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraACVLC_s.s
-ff5915d181bfd2cd2f0bd588bd2300dc OX001-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraDCVLC_s.s
-6775eb0c561dbab965c60f85b08c96fd OX001-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_PredictReconCoefIntra_s.s
-a0d85f4f517c945a4c9317ac021f2d08 OX001-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_DecodeVLCZigzag_AC_unsafe_s.s
-386020dee8b725c7fe2526f1fc211d7d OX001-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Inter.c
- OX001-SW-98010-r0p0-00bet1/vc/m4p2/api/
-4624e7c838e10a249abcc3d3f4f40748 OX001-SW-98010-r0p0-00bet1/vc/m4p2/api/armVCM4P2_Huff_Tables_VLC.h
-65e1057d04e2cb844559dc9f6e09795a OX001-SW-98010-r0p0-00bet1/vc/m4p2/api/armVCM4P2_ZigZag_Tables.h
- OX001-SW-98010-r0p0-00bet1/vc/src/
-e627b3346b0dc9aff14446005ce0fa43 OX001-SW-98010-r0p0-00bet1/vc/src/armVC_Version.c
- OX001-SW-98010-r0p0-00bet1/vc/api/
-7ca94b1c33ac0211e17d38baadd7d1dd OX001-SW-98010-r0p0-00bet1/vc/api/armVC.h
-12cf7596edbbf6048b626d15e8d0ed48 OX001-SW-98010-r0p0-00bet1/vc/api/omxVC.h
-11726e286a81257cb45f5547fb4d374c OX001-SW-98010-r0p0-00bet1/vc/api/omxVC_s.h
-a5b2af605c319cd2491319e430741377 OX001-SW-98010-r0p0-00bet1/vc/api/armVCCOMM_s.h
- OX001-SW-98010-r0p0-00bet1/vc/comm/
- OX001-SW-98010-r0p0-00bet1/vc/comm/src/
-50cca6954c447b012ab39ca7872e5e8f OX001-SW-98010-r0p0-00bet1/vc/comm/src/omxVCCOMM_Copy16x16_s.s
-d1c3bce77fc5774c899b447d13f02cd0 OX001-SW-98010-r0p0-00bet1/vc/comm/src/omxVCCOMM_Copy8x8_s.s
-fdac1d1bad3fd23c880beb39bc2e89aa OX001-SW-98010-r0p0-00bet1/vc/comm/src/omxVCCOMM_ExpandFrame_I_s.s
-6d9adc2be5bd0311591030d0c6df771c ARM_DELIVERY_97413.TXT
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM.h
deleted file mode 100644
index fbb97e2..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM.h
+++ /dev/null
@@ -1,800 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armCOMM.h
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * File: armCOMM.h
- * Brief: Declares Common APIs/Data Types used across OpenMAX API's
- *
- */
-
-
-#ifndef _armCommon_H_
-#define _armCommon_H_
-
-#include "omxtypes.h"
-
-typedef struct
-{
- OMX_F32 Re; /** Real part */
- OMX_F32 Im; /** Imaginary part */
-
-} OMX_FC32; /** single precision floating point complex number */
-
-typedef struct
-{
- OMX_F64 Re; /** Real part */
- OMX_F64 Im; /** Imaginary part */
-
-} OMX_FC64; /** double precision floating point complex number */
-
-
-/* Used by both IP and IC domains for 8x8 JPEG blocks. */
-typedef OMX_S16 ARM_BLOCK8x8[64];
-
-
-#include "armOMX.h"
-
-#define armPI (OMX_F64)(3.1415926535897932384626433832795)
-
-/***********************************************************************/
-
-/* Compiler extensions */
-#ifdef ARM_DEBUG
-/* debug version */
-#include <stdlib.h>
-#include <assert.h>
-#include <stdio.h>
-#define armError(str) {printf((str)); printf("\n"); exit(-1);}
-#define armWarn(str) {printf((str)); printf("\n");}
-#define armIgnore(a) ((void)a)
-#define armAssert(a) assert(a)
-#else
-/* release version */
-#define armError(str) ((void) (str))
-#define armWarn(str) ((void) (str))
-#define armIgnore(a) ((void) (a))
-#define armAssert(a) ((void) (a))
-#endif /* ARM_DEBUG */
-
-/* Arithmetic operations */
-
-#define armMin(a,b) ( (a) > (b) ? (b):(a) )
-#define armMax(a,b) ( (a) > (b) ? (a):(b) )
-#define armAbs(a) ( (a) < 0 ? -(a):(a) )
-
-/* Alignment operation */
-
-#define armAlignToBytes(Ptr,N) (Ptr + ( ((N-(int)Ptr)&(N-1)) / sizeof(*Ptr) ))
-#define armAlignTo2Bytes(Ptr) armAlignToBytes(Ptr,2)
-#define armAlignTo4Bytes(Ptr) armAlignToBytes(Ptr,4)
-#define armAlignTo8Bytes(Ptr) armAlignToBytes(Ptr,8)
-#define armAlignTo16Bytes(Ptr) armAlignToBytes(Ptr,16)
-
-/* Error and Alignment check */
-
-#define armRetArgErrIf(condition, code) if(condition) { return (code); }
-#define armRetDataErrIf(condition, code) if(condition) { return (code); }
-
-#ifndef ALIGNMENT_DOESNT_MATTER
-#define armIsByteAligned(Ptr,N) ((((int)(Ptr)) % N)==0)
-#define armNotByteAligned(Ptr,N) ((((int)(Ptr)) % N)!=0)
-#else
-#define armIsByteAligned(Ptr,N) (1)
-#define armNotByteAligned(Ptr,N) (0)
-#endif
-
-#define armIs2ByteAligned(Ptr) armIsByteAligned(Ptr,2)
-#define armIs4ByteAligned(Ptr) armIsByteAligned(Ptr,4)
-#define armIs8ByteAligned(Ptr) armIsByteAligned(Ptr,8)
-#define armIs16ByteAligned(Ptr) armIsByteAligned(Ptr,16)
-
-#define armNot2ByteAligned(Ptr) armNotByteAligned(Ptr,2)
-#define armNot4ByteAligned(Ptr) armNotByteAligned(Ptr,4)
-#define armNot8ByteAligned(Ptr) armNotByteAligned(Ptr,8)
-#define armNot16ByteAligned(Ptr) armNotByteAligned(Ptr,16)
-#define armNot32ByteAligned(Ptr) armNotByteAligned(Ptr,32)
-
-/**
- * Function: armRoundFloatToS16_ref/armRoundFloatToS32_ref/armRoundFloatToS64
- *
- * Description:
- * Converts a double precision value into a short int/int after rounding
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S16/OMX_S32 format
- *
- */
-
-OMX_S16 armRoundFloatToS16 (OMX_F64 Value);
-OMX_S32 armRoundFloatToS32 (OMX_F64 Value);
-OMX_S64 armRoundFloatToS64 (OMX_F64 Value);
-
-/**
- * Function: armSatRoundFloatToS16_ref/armSatRoundFloatToS32
- *
- * Description:
- * Converts a double precision value into a short int/int after rounding and saturation
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S16/OMX_S32 format
- *
- */
-
-OMX_S16 armSatRoundFloatToS16 (OMX_F64 Value);
-OMX_S32 armSatRoundFloatToS32 (OMX_F64 Value);
-
-/**
- * Function: armSatRoundFloatToU16_ref/armSatRoundFloatToU32
- *
- * Description:
- * Converts a double precision value into a unsigned short int/int after rounding and saturation
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_U16/OMX_U32 format
- *
- */
-
-OMX_U16 armSatRoundFloatToU16 (OMX_F64 Value);
-OMX_U32 armSatRoundFloatToU32 (OMX_F64 Value);
-
-/**
- * Function: armSignCheck
- *
- * Description:
- * Checks the sign of a variable:
- * returns 1 if it is Positive
- * returns 0 if it is 0
- * returns -1 if it is Negative
- *
- * Remarks:
- *
- * Parameters:
- * [in] var Variable to be checked
- *
- * Return Value:
- * OMX_INT -- returns 1 if it is Positive
- * returns 0 if it is 0
- * returns -1 if it is Negative
- */
-
-OMX_INT armSignCheck (OMX_S16 var);
-
-/**
- * Function: armClip
- *
- * Description: Clips the input between MAX and MIN value
- *
- *
- * Remarks:
- *
- * Parameters:
- * [in] Min lower bound
- * [in] Max upper bound
- * [in] src variable to the clipped
- *
- * Return Value:
- * OMX_S32 -- returns clipped value
- */
-
-OMX_S32 armClip (
- OMX_INT min,
- OMX_INT max,
- OMX_S32 src
- );
-
-/**
- * Function: armClip_F32
- *
- * Description: Clips the input between MAX and MIN value
- *
- *
- * Remarks:
- *
- * Parameters:
- * [in] Min lower bound
- * [in] Max upper bound
- * [in] src variable to the clipped
- *
- * Return Value:
- * OMX_F32 -- returns clipped value
- */
-
-OMX_F32 armClip_F32 (
- OMX_F32 min,
- OMX_F32 max,
- OMX_F32 src
- );
-
-/**
- * Function: armShiftSat_F32
- *
- * Description: Divides a float value by 2^shift and
- * saturates it for unsigned value range for satBits.
- * Second parameter is like "shifting" the corresponding
- * integer value. Takes care of rounding while clipping the final
- * value.
- *
- * Parameters:
- * [in] v Number to be operated upon
- * [in] shift Divides the input "v" by "2^shift"
- * [in] satBits Final range is [0, 2^satBits)
- *
- * Return Value:
- * OMX_S32 -- returns "shifted" saturated value
- */
-
-OMX_U32 armShiftSat_F32(
- OMX_F32 v,
- OMX_INT shift,
- OMX_INT satBits
- );
-
-/**
- * Functions: armSwapElem
- *
- * Description:
- * This function swaps two elements at the specified pointer locations.
- * The size of each element could be anything as specified by <elemSize>
- *
- * Return Value:
- * OMXResult -- Error status from the function
- */
-OMXResult armSwapElem(OMX_U8 *pBuf1, OMX_U8 *pBuf2, OMX_INT elemSize);
-
-
-/**
- * Function: armMedianOf3
- *
- * Description: Finds the median of three numbers
- *
- * Remarks:
- *
- * Parameters:
- * [in] fEntry First entry
- * [in] sEntry second entry
- * [in] tEntry Third entry
- *
- * Return Value:
- * OMX_S32 -- returns the median value
- */
-
-OMX_S32 armMedianOf3 (
- OMX_S32 fEntry,
- OMX_S32 sEntry,
- OMX_S32 tEntry
- );
-
-/**
- * Function: armLogSize
- *
- * Description: Finds the size of a positive value and returns the same
- *
- * Remarks:
- *
- * Parameters:
- * [in] value Positive value
- *
- * Return Value:
- * OMX_U8 -- returns the size of the positive value
- */
-
-OMX_U8 armLogSize (
- OMX_U16 value
- );
-
-/***********************************************************************/
- /* Saturating Arithmetic operations */
-
-/**
- * Function :armSatAdd_S32()
- *
- * Description :
- * Returns the result of saturated addition of the two inputs Value1, Value2
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- *
- * Return:
- * [out] Result of operation
- *
- *
- **/
-
-OMX_S32 armSatAdd_S32(
- OMX_S32 Value1,
- OMX_S32 Value2
- );
-
-/**
- * Function :armSatAdd_S64()
- *
- * Description :
- * Returns the result of saturated addition of the two inputs Value1, Value2
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- *
- * Return:
- * [out] Result of operation
- *
- *
- **/
-
-OMX_S64 armSatAdd_S64(
- OMX_S64 Value1,
- OMX_S64 Value2
- );
-
-/** Function :armSatSub_S32()
- *
- * Description :
- * Returns the result of saturated substraction of the two inputs Value1, Value2
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S32 armSatSub_S32(
- OMX_S32 Value1,
- OMX_S32 Value2
- );
-
-/**
- * Function :armSatMac_S32()
- *
- * Description :
- * Returns the result of Multiplication of Value1 and Value2 and subesquent saturated
- * accumulation with Mac
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- * [in] Mac Accumulator
- *
- * Return:
- * [out] Result of operation
- **/
-
-OMX_S32 armSatMac_S32(
- OMX_S32 Mac,
- OMX_S16 Value1,
- OMX_S16 Value2
- );
-
-/**
- * Function :armSatMac_S16S32_S32
- *
- * Description :
- * Returns the result of saturated MAC operation of the three inputs delayElem, filTap , mac
- *
- * mac = mac + Saturate_in_32Bits(delayElem * filTap)
- *
- * Parametrs:
- * [in] delayElem First 32 bit Operand
- * [in] filTap Second 16 bit Operand
- * [in] mac Result of MAC operation
- *
- * Return:
- * [out] mac Result of operation
- *
- **/
-
-OMX_S32 armSatMac_S16S32_S32(
- OMX_S32 mac,
- OMX_S32 delayElem,
- OMX_S16 filTap );
-
-/**
- * Function :armSatRoundRightShift_S32_S16
- *
- * Description :
- * Returns the result of rounded right shift operation of input by the scalefactor
- *
- * output = Saturate_in_16Bits( ( RightShift( (Round(input) , scaleFactor ) )
- *
- * Parametrs:
- * [in] input The input to be operated on
- * [in] scaleFactor The shift number
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-
-OMX_S16 armSatRoundRightShift_S32_S16(
- OMX_S32 input,
- OMX_INT scaleFactor);
-
-/**
- * Function :armSatRoundLeftShift_S32()
- *
- * Description :
- * Returns the result of saturating left-shift operation on input
- * Or rounded Right shift if the input Shift is negative.
- *
- * Parametrs:
- * [in] Value Operand
- * [in] shift Operand for shift operation
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S32 armSatRoundLeftShift_S32(
- OMX_S32 Value,
- OMX_INT shift
- );
-
-/**
- * Function :armSatRoundLeftShift_S64()
- *
- * Description :
- * Returns the result of saturating left-shift operation on input
- * Or rounded Right shift if the input Shift is negative.
- *
- * Parametrs:
- * [in] Value Operand
- * [in] shift Operand for shift operation
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S64 armSatRoundLeftShift_S64(
- OMX_S64 Value,
- OMX_INT shift
- );
-
-/**
- * Function :armSatMulS16S32_S32()
- *
- * Description :
- * Returns the result of a S16 data type multiplied with an S32 data type
- * in a S32 container
- *
- * Parametrs:
- * [in] input1 Operand 1
- * [in] input2 Operand 2
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-
-OMX_S32 armSatMulS16S32_S32(
- OMX_S16 input1,
- OMX_S32 input2);
-
-/**
- * Function :armSatMulS32S32_S32()
- *
- * Description :
- * Returns the result of a S32 data type multiplied with an S32 data type
- * in a S32 container
- *
- * Parametrs:
- * [in] input1 Operand 1
- * [in] input2 Operand 2
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S32 armSatMulS32S32_S32(
- OMX_S32 input1,
- OMX_S32 input2);
-
-
-/**
- * Function :armIntDivAwayFromZero()
- *
- * Description : Integer division with rounding to the nearest integer.
- * Half-integer values are rounded away from zero
- * unless otherwise specified. For example 3//2 is rounded
- * to 2, and -3//2 is rounded to -2.
- *
- * Parametrs:
- * [in] Num Operand 1
- * [in] Deno Operand 2
- *
- * Return:
- * [out] Result of operation input1//input2
- *
- **/
-
-OMX_S32 armIntDivAwayFromZero (OMX_S32 Num, OMX_S32 Deno);
-
-
-/***********************************************************************/
-/*
- * Debugging macros
- *
- */
-
-
-/*
- * Definition of output stream - change to stderr if necessary
- */
-#define DEBUG_STREAM stdout
-
-/*
- * Debug printf macros, one for each argument count.
- * Add more if needed.
- */
-#ifdef DEBUG_ON
-#include <stdio.h>
-
-#define DEBUG_PRINTF_0(a) fprintf(DEBUG_STREAM, a)
-#define DEBUG_PRINTF_1(a, b) fprintf(DEBUG_STREAM, a, b)
-#define DEBUG_PRINTF_2(a, b, c) fprintf(DEBUG_STREAM, a, b, c)
-#define DEBUG_PRINTF_3(a, b, c, d) fprintf(DEBUG_STREAM, a, b, c, d)
-#define DEBUG_PRINTF_4(a, b, c, d, e) fprintf(DEBUG_STREAM, a, b, c, d, e)
-#define DEBUG_PRINTF_5(a, b, c, d, e, f) fprintf(DEBUG_STREAM, a, b, c, d, e, f)
-#define DEBUG_PRINTF_6(a, b, c, d, e, f, g) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g)
-#define DEBUG_PRINTF_7(a, b, c, d, e, f, g, h) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h)
-#define DEBUG_PRINTF_8(a, b, c, d, e, f, g, h, i) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i)
-#define DEBUG_PRINTF_9(a, b, c, d, e, f, g, h, i, j) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i, j)
-#define DEBUG_PRINTF_10(a, b, c, d, e, f, g, h, i, j, k) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i, j, k)
-#define DEBUG_PRINTF_11(a, b, c, d, e, f, g, h, i, j, k, l) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i, j, k, l)
-#define DEBUG_PRINTF_12(a, b, c, d, e, f, g, h, i, j, k, l, m) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i, j, k, l, m)
-#define DEBUG_PRINTF_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i, j, k, l, m, n)
-#define DEBUG_PRINTF_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
-#else /* DEBUG_ON */
-#define DEBUG_PRINTF_0(a)
-#define DEBUG_PRINTF_1(a, b)
-#define DEBUG_PRINTF_2(a, b, c)
-#define DEBUG_PRINTF_3(a, b, c, d)
-#define DEBUG_PRINTF_4(a, b, c, d, e)
-#define DEBUG_PRINTF_5(a, b, c, d, e, f)
-#define DEBUG_PRINTF_6(a, b, c, d, e, f, g)
-#define DEBUG_PRINTF_7(a, b, c, d, e, f, g, h)
-#define DEBUG_PRINTF_8(a, b, c, d, e, f, g, h, i)
-#define DEBUG_PRINTF_9(a, b, c, d, e, f, g, h, i, j)
-#define DEBUG_PRINTF_10(a, b, c, d, e, f, g, h, i, j, k)
-#define DEBUG_PRINTF_11(a, b, c, d, e, f, g, h, i, j, k, l)
-#define DEBUG_PRINTF_12(a, b, c, d, e, f, g, h, i, j, k, l, m)
-#define DEBUG_PRINTF_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n)
-#define DEBUG_PRINTF_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
-#endif /* DEBUG_ON */
-
-
-/*
- * Domain and sub domain definitions
- *
- * In order to turn on debug for an entire domain or sub-domain
- * at compile time, one of the DEBUG_DOMAIN_* below may be defined,
- * which will activate debug in all of the defines it contains.
- */
-
-#ifdef DEBUG_DOMAIN_AC
-#define DEBUG_OMXACAAC_DECODECHANPAIRELT_MPEG4
-#define DEBUG_OMXACAAC_DECODECHANPAIRELT
-#define DEBUG_OMXACAAC_DECODEDATSTRELT
-#define DEBUG_OMXACAAC_DECODEFILLELT
-#define DEBUG_OMXACAAC_DECODEISSTEREO_S32
-#define DEBUG_OMXACAAC_DECODEMSPNS_S32
-#define DEBUG_OMXACAAC_DECODEMSSTEREO_S32_I
-#define DEBUG_OMXACAAC_DECODEPRGCFGELT
-#define DEBUG_OMXACAAC_DECODETNS_S32_I
-#define DEBUG_OMXACAAC_DEINTERLEAVESPECTRUM_S32
-#define DEBUG_OMXACAAC_ENCODETNS_S32_I
-#define DEBUG_OMXACAAC_LONGTERMPREDICT_S32
-#define DEBUG_OMXACAAC_LONGTERMRECONSTRUCT_S32
-#define DEBUG_OMXACAAC_MDCTFWD_S32
-#define DEBUG_OMXACAAC_MDCTINV_S32_S16
-#define DEBUG_OMXACAAC_NOISELESSDECODE
-#define DEBUG_OMXACAAC_QUANTINV_S32_I
-#define DEBUG_OMXACAAC_UNPACKADIFHEADER
-#define DEBUG_OMXACAAC_UNPACKADTSFRAMEHEADER
-#define DEBUG_OMXACMP3_HUFFMANDECODESFBMBP_S32
-#define DEBUG_OMXACMP3_HUFFMANDECODESFB_S32
-#define DEBUG_OMXACMP3_HUFFMANDECODE_S32
-#define DEBUG_OMXACMP3_MDCTINV_S32
-#define DEBUG_OMXACMP3_REQUANTIZESFB_S32_I
-#define DEBUG_OMXACMP3_REQUANTIZE_S32_I
-#define DEBUG_OMXACMP3_SYNTHPQMF_S32_S16
-#define DEBUG_OMXACMP3_UNPACKFRAMEHEADER
-#define DEBUG_OMXACMP3_UNPACKSCALEFACTORS_S8
-#define DEBUG_OMXACMP3_UNPACKSIDEINFO
-#endif /* DEBUG_DOMAIN_AC */
-
-
-#ifdef DEBUG_DOMAIN_VC
-#define DEBUG_OMXVCM4P10_AVERAGE_16X
-#define DEBUG_OMXVCM4P10_AVERAGE_4X
-#define DEBUG_OMXVCM4P10_AVERAGE_8X
-#define DEBUG_OMXVCM4P10_DEBLOCKCHROMA_U8_C1IR
-#define DEBUG_OMXVCM4P10_DEBLOCKLUMA_U8_C1IR
-#define DEBUG_OMXVCM4P10_DECODECHROMADCCOEFFSTOPAIRCAVLC_U8
-#define DEBUG_OMXVCM4P10_DECODECOEFFSTOPAIRCAVLC_U8
-#define DEBUG_OMXVCM4P10_DEQUANTTRANSFORMACFROMPAIR_U8_S16_C1_DLX
-#define DEBUG_OMXVCM4P10_EXPANDFRAME
-#define DEBUG_OMXVCM4P10_FILTERDEBLOCKINGCHROMA_HOREDGE_U8_C1IR
-#define DEBUG_OMXVCM4P10_FILTERDEBLOCKINGCHROMA_VEREDGE_U8_C1IR
-#define DEBUG_OMXVCM4P10_FILTERDEBLOCKINGLUMA_HOREDGE_U8_C1IR
-#define DEBUG_OMXVCM4P10_FILTERDEBLOCKINGLUMA_VEREDGE_U8_C1IR
-#define DEBUG_OMXVCM4P10_PREDICTINTRACHROMA8X8_U8_C1R
-#define DEBUG_OMXVCM4P10_PREDICTINTRA_16X16_U8_C1R
-#define DEBUG_OMXVCM4P10_PREDICTINTRA_4X4_U8_C1R
-#define DEBUG_OMXVCM4P10_SADQUAR_16X
-#define DEBUG_OMXVCM4P10_SADQUAR_4X
-#define DEBUG_OMXVCM4P10_SADQUAR_8X
-#define DEBUG_OMXVCM4P10_SAD_16X
-#define DEBUG_OMXVCM4P10_SAD_4X
-#define DEBUG_OMXVCM4P10_SAD_8X
-#define DEBUG_OMXVCM4P10_SATD_4X4
-#define DEBUG_OMXVCM4P10_TRANSFORMDEQUANTCHROMADCFROMPAIR_U8_S16_C1
-#define DEBUG_OMXVCM4P10_TRANSFORMDEQUANTLUMADCFROMPAIR_U8_S16_C1
-#define DEBUG_OMXVCM4P10_TRANSFORMQUANT_CHROMADC
-#define DEBUG_OMXVCM4P10_TRANSFORMQUANT_LUMADC
-#define DEBUG_OMXVCM4P2_BLOCKMATCH_HALF_16X16
-#define DEBUG_OMXVCM4P2_BLOCKMATCH_HALF_8X8
-#define DEBUG_OMXVCM4P2_BLOCKMATCH_INTEGER_16X16
-#define DEBUG_OMXVCM4P2_BLOCKMATCH_INTEGER_8X8
-#define DEBUG_OMXVCM4P2_COMPUTETEXTUREERRORBLOCK_SAD_U8_S16
-#define DEBUG_OMXVCM4P2_COMPUTETEXTUREERRORBLOCK_U8_S16
-#define DEBUG_OMXVCM4P2_DCT8X8BLKDLX
-#define DEBUG_OMXVCM4P2_DECODEBLOCKCOEF_INTER_S16
-#define DEBUG_OMXVCM4P2_DECODEPADMV_PVOP
-#define DEBUG_OMXVCM4P2_DECODEVLCZIGZAG_INTER_S16
-#define DEBUG_OMXVCM4P2_DECODEVLCZIGZAG_INTRAACVLC_S16
-#define DEBUG_OMXVCM4P2_DECODEVLCZIGZAG_INTRADCVLC_S16
-#define DEBUG_OMXVCM4P2_ENCODEMV_U8_S16
-#define DEBUG_OMXVCM4P2_ENCODEVLCZIGZAG_INTER_S16
-#define DEBUG_OMXVCM4P2_ENCODEVLCZIGZAG_INTRAACVLC_S16
-#define DEBUG_OMXVCM4P2_ENCODEVLCZIGZAG_INTRADCVLC_S16
-#define DEBUG_OMXVCM4P2_FINDMVPRED
-#define DEBUG_OMXVCM4P2_IDCT8X8BLKDLX
-#define DEBUG_OMXVCM4P2_LIMITMVTORECT
-#define DEBUG_OMXVCM4P2_MOTIONESTIMATIONMB
-#define DEBUG_OMXVCM4P2_PADMBGRAY_U8
-#define DEBUG_OMXVCM4P2_PADMBHORIZONTAL_U8
-#define DEBUG_OMXVCM4P2_PADMBVERTICAL_U8
-#define DEBUG_OMXVCM4P2_PADMV
-#define DEBUG_OMXVCM4P2_QUANTINTER_S16_I
-#define DEBUG_OMXVCM4P2_QUANTINTRA_S16_I
-#define DEBUG_OMXVCM4P2_QUANTINVINTER_S16_I
-#define DEBUG_OMXVCM4P2_QUANTINVINTRA_S16_I
-#define DEBUG_OMXVCM4P2_TRANSRECBLOCKCEOF_INTER
-#define DEBUG_OMXVCM4P2_TRANSRECBLOCKCEOF_INTRA
-#endif /* DEBUG_DOMAIN_VC */
-
-
-#ifdef DEBUG_DOMAIN_IC
-/* To be filled in */
-#endif /* DEBUG_DOMAIN_IC */
-
-
-#ifdef DEBUG_DOMAIN_SP
-#define DEBUG_OMXACSP_DOTPROD_S16
-#define DEBUG_OMXACSP_BLOCKEXP_S16
-#define DEBUG_OMXACSP_BLOCKEXP_S32
-#define DEBUG_OMXACSP_COPY_S16
-#define DEBUG_OMXACSP_DOTPROD_S16
-#define DEBUG_OMXACSP_DOTPROD_S16_SFS
-#define DEBUG_OMXACSP_FFTFWD_CTOC_SC16_SFS
-#define DEBUG_OMXACSP_FFTFWD_CTOC_SC32_SFS
-#define DEBUG_OMXACSP_FFTFWD_RTOCCS_S16S32_SFS
-#define DEBUG_OMXACSP_FFTFWD_RTOCCS_S32_SFS
-#define DEBUG_OMXACSP_FFTGETBUFSIZE_C_SC16
-#define DEBUG_OMXACSP_FFTGETBUFSIZE_C_SC32
-#define DEBUG_OMXACSP_FFTGETBUFSIZE_R_S16_S32
-#define DEBUG_OMXACSP_FFTGETBUFSIZE_R_S32
-#define DEBUG_OMXACSP_FFTINIT_C_SC16
-#define DEBUG_OMXACSP_FFTINIT_C_SC32
-#define DEBUG_OMXACSP_FFTINIT_R_S16_S32
-#define DEBUG_OMXACSP_FFTINIT_R_S32
-#define DEBUG_OMXACSP_FFTINV_CCSTOR_S32S16_SFS
-#define DEBUG_OMXACSP_FFTINV_CCSTOR_S32_SFS
-#define DEBUG_OMXACSP_FFTINV_CTOC_SC16_SFS
-#define DEBUG_OMXACSP_FFTINV_CTOC_SC32_SFS
-#define DEBUG_OMXACSP_FILTERMEDIAN_S32_I
-#define DEBUG_OMXACSP_FILTERMEDIAN_S32
-#define DEBUG_OMXACSP_FIRONE_DIRECT_S16_ISFS
-#define DEBUG_OMXACSP_FIRONE_DIRECT_S16_I
-#define DEBUG_OMXACSP_FIRONE_DIRECT_S16
-#define DEBUG_OMXACSP_FIRONE_DIRECT_S16_SFS
-#define DEBUG_OMXACSP_FIR_DIRECT_S16_ISFS
-#define DEBUG_OMXACSP_FIR_DIRECT_S16_I
-#define DEBUG_OMXACSP_FIR_DIRECT_S16
-#define DEBUG_OMXACSP_FIR_DIRECT_S16_SFS
-#define DEBUG_OMXACSP_IIRONE_BIQUADDIRECT_S16_I
-#define DEBUG_OMXACSP_IIRONE_BIQUADDIRECT_S16
-#define DEBUG_OMXACSP_IIRONE_DIRECT_S16_I
-#define DEBUG_OMXACSP_IIRONE_DIRECT_S16
-#define DEBUG_OMXACSP_IIR_BIQUADDIRECT_S16_I
-#define DEBUG_OMXACSP_IIR_BIQUADDIRECT_S16
-#define DEBUG_OMXACSP_IIR_DIRECT_S16_I
-#define DEBUG_OMXACSP_IIR_DIRECT_S16
-#endif /* DEBUG_DOMAIN_SP */
-
-
-#ifdef DEBUG_DOMAIN_IP
-#define DEBUG_OMXIPBM_ADDC_U8_C1R_SFS
-#define DEBUG_OMXIPBM_COPY_U8_C1R
-#define DEBUG_OMXIPBM_COPY_U8_C3R
-#define DEBUG_OMXIPBM_MIRROR_U8_C1R
-#define DEBUG_OMXIPBM_MULC_U8_C1R_SFS
-#define DEBUG_OMXIPCS_COLORTWISTQ14_U8_C3R
-#define DEBUG_OMXIPCS_RGB565TOYCBCR420LS_MCU_U16_S16_C3P3R
-#define DEBUG_OMXIPCS_RGB565TOYCBCR422LS_MCU_U16_S16_C3P3R
-#define DEBUG_OMXIPCS_RGB565TOYCBCR444LS_MCU_U16_S16_C3P3R
-#define DEBUG_OMXIPCS_RGBTOYCBCR420LS_MCU_U8_S16_C3P3R
-#define DEBUG_OMXIPCS_RGBTOYCBCR422LS_MCU_U8_S16_C3P3R
-#define DEBUG_OMXIPCS_RGBTOYCBCR444LS_MCU_U8_S16_C3P3R
-#define DEBUG_OMXIPCS_YCBCR420RSZROT_U8_P3R
-#define DEBUG_OMXIPCS_YCBCR420TORGB565LS_MCU_S16_U16_P3C3R
-#define DEBUG_OMXIPCS_YCBCR420TORGB565_U8_U16_P3C3R
-#define DEBUG_OMXIPCS_YCBCR420TORGBLS_MCU_S16_U8_P3C3R
-#define DEBUG_OMXIPCS_YCBCR422RSZCSCROTRGB_U8_C2R
-#define DEBUG_OMXIPCS_YCBCR422RSZROT_U8_P3R
-#define DEBUG_OMXIPCS_YCBCR422TORGB565LS_MCU_S16_U16_P3C3R
-#define DEBUG_OMXIPCS_YCBCR422TORGB565_U8_U16_C2C3R
-#define DEBUG_OMXIPCS_YCBCR422TORGBLS_MCU_S16_U8_P3C3R
-#define DEBUG_OMXIPCS_YCBCR422TORGB_U8_C2C3R
-#define DEBUG_OMXIPCS_YCBCR422TOYCBCR420ROTATE_U8_C2P3R
-#define DEBUG_OMXIPCS_YCBCR422TOYCBCR420ROTATE_U8_P3R
-#define DEBUG_OMXIPCS_YCBCR444TORGB565LS_MCU_S16_U16_P3C3R
-#define DEBUG_OMXIPCS_YCBCR444TORGBLS_MCU_S16_U8_P3C3R
-#define DEBUG_OMXIPCS_YCBCRTORGB565_U8_U16_C3R
-#define DEBUG_OMXIPCS_YCBCRTORGB565_U8_U16_P3C3R
-#define DEBUG_OMXIPCS_YCBCRTORGB_U8_C3R
-#define DEBUG_OMXIPPP_GETCENTRALMOMENT_S64
-#define DEBUG_OMXIPPP_GETSPATIALMOMENT_S64
-#define DEBUG_OMXIPPP_MOMENTGETSTATESIZE_S64
-#define DEBUG_OMXIPPP_MOMENTINIT_S64
-#define DEBUG_OMXIPPP_MOMENTS64S_U8_C1R
-#define DEBUG_OMXIPPP_MOMENTS64S_U8_C3R
-#endif /* DEBUG_DOMAIN_IP */
-
-
-#endif /* _armCommon_H_ */
-
-/*End of File*/
-
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_BitDec_s.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_BitDec_s.h
deleted file mode 100644
index d5866fa..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_BitDec_s.h
+++ /dev/null
@@ -1,684 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armCOMM_BitDec_s.h
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-;// OpenMAX optimized bitstream decode module
-;//
-;// You must include armCOMM_s.h before including this file
-;//
-;// This module provides macros to perform assembly optimized fixed and
-;// variable length decoding from a read-only bitstream. The variable
-;// length decode modules take as input a pointer to a table of 16-bit
-;// entries of the following format.
-;//
-;// VLD Table Entry format
-;//
-;// 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
-;// +------------------------------------------------+
-;// | Len | Symbol | 1 |
-;// +------------------------------------------------+
-;// | Offset | 0 |
-;// +------------------------------------------------+
-;//
-;// If the table entry is a leaf entry then bit 0 set:
-;// Len = Number of bits overread (0 to 7)
-;// Symbol = Symbol payload (unsigned 12 bits)
-;//
-;// If the table entry is an internal node then bit 0 is clear:
-;// Offset = Number of (16-bit) half words from the table
-;// start to the next table node
-;//
-;// The table is accessed by successive lookup up on the
-;// next Step bits of the input bitstream until a leaf node
-;// is obtained. The Step sizes are supplied to the VLD macro.
-;//
-;// USAGE:
-;//
-;// To use any of the macros in this package, first call:
-;//
-;// M_BD_INIT ppBitStream, pBitOffset, pBitStream, RBitBuffer, RBitCount, Tmp
-;//
-;// This caches the current bitstream position and next available
-;// bits in registers pBitStream, RBitBuffer, RBitCount. These registers
-;// are reserved for use by the bitstream decode package until you
-;// call M_BD_FINI.
-;//
-;// Next call the following macro(s) as many times as you need:
-;//
-;// M_BD_LOOK8 - Look ahead constant 1<=N<=8 bits into the bitstream
-;// M_BD_LOOK16 - Look ahead constant 1<=N<=16 bits into the bitstream
-;// M_BD_READ8 - Read constant 1<=N<=8 bits from the bitstream
-;// M_BD_READ16 - Read constant 1<=N<=16 bits from the bitstream
-;// M_BD_VREAD8 - Read variable 1<=N<=8 bits from the bitstream
-;// M_BD_VREAD16 - Read variable 1<=N<=16 bits from the bitstream
-;// M_BD_VLD - Perform variable length decode using lookup table
-;//
-;// Finally call the macro:
-;//
-;// M_BD_FINI ppBitStream, pBitOffset
-;//
-;// This writes the bitstream state back to memory.
-;//
-;// The three bitstream cache register names are assigned to the following global
-;// variables:
-;//
-
- GBLS pBitStream ;// Register name for pBitStream
- GBLS BitBuffer ;// Register name for BitBuffer
- GBLS BitCount ;// Register name for BitCount
-
-;//
-;// These register variables must have a certain defined state on entry to every bitstream
-;// macro (except M_BD_INIT) and on exit from every bitstream macro (except M_BD_FINI).
-;// The state may depend on implementation.
-;//
-;// For the default (ARM11) implementation the following hold:
-;// pBitStream - points to the first byte not held in the BitBuffer
-;// BitBuffer - is a cache of (4 bytes) 32 bits, bit 31 the first bit
-;// BitCount - is offset (from the top bit) to the next unused bitstream bit
-;// 0<=BitCount<=15 (so BitBuffer holds at least 17 unused bits)
-;//
-;//
-
- ;// Bitstream Decode initialise
- ;//
- ;// Initialises the bitstream decode global registers from
- ;// bitstream pointers. This macro is split into 3 parts to enable
- ;// scheduling.
- ;//
- ;// Input Registers:
- ;//
- ;// $ppBitStream - pointer to pointer to the next bitstream byte
- ;// $pBitOffset - pointer to the number of bits used in the current byte (0..7)
- ;// $RBitStream - register to use for pBitStream (can be $ppBitStream)
- ;// $RBitBuffer - register to use for BitBuffer
- ;// $RBitCount - register to use for BitCount (can be $pBitOffset)
- ;//
- ;// Output Registers:
- ;//
- ;// $T1,$T2,$T3 - registers that must be preserved between calls to
- ;// M_BD_INIT1 and M_BD_INIT2
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_INIT0 $ppBitStream, $pBitOffset, $RBitStream, $RBitBuffer, $RBitCount
-
-pBitStream SETS "$RBitStream"
-BitBuffer SETS "$RBitBuffer"
-BitCount SETS "$RBitCount"
-
- ;// load inputs
- LDR $pBitStream, [$ppBitStream]
- LDR $BitCount, [$pBitOffset]
- MEND
-
- MACRO
- M_BD_INIT1 $T1, $T2, $T3
- LDRB $T2, [$pBitStream, #2]
- LDRB $T1, [$pBitStream, #1]
- LDRB $BitBuffer, [$pBitStream], #3
- ADD $BitCount, $BitCount, #8
- MEND
-
- MACRO
- M_BD_INIT2 $T1, $T2, $T3
- ORR $T2, $T2, $T1, LSL #8
- ORR $BitBuffer, $T2, $BitBuffer, LSL #16
- MEND
-
- ;//
- ;// Look ahead fixed 1<=N<=8 bits without consuming any bits
- ;// The next bits will be placed at bit 31..24 of destination register
- ;//
- ;// Input Registers:
- ;//
- ;// $N - number of bits to look
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $Symbol - the next N bits of the bitstream
- ;// $T1 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_LOOK8 $Symbol, $N
- ASSERT ($N>=1):LAND:($N<=8)
- MOV $Symbol, $BitBuffer, LSL $BitCount
- MEND
-
- ;//
- ;// Look ahead fixed 1<=N<=16 bits without consuming any bits
- ;// The next bits will be placed at bit 31..16 of destination register
- ;//
- ;// Input Registers:
- ;//
- ;// $N - number of bits to look
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $Symbol - the next N bits of the bitstream
- ;// $T1 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_LOOK16 $Symbol, $N, $T1
- ASSERT ($N >= 1):LAND:($N <= 16)
- MOV $Symbol, $BitBuffer, LSL $BitCount
- MEND
-
- ;//
- ;// Skips fixed 1<=N<=8 bits from the bitstream, advancing the bitstream pointer
- ;//
- ;// Input Registers:
- ;//
- ;// $N - number of bits
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $T1 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_SKIP8 $N, $T1
- ASSERT ($N>=1):LAND:($N<=8)
- SUBS $BitCount, $BitCount, #(8-$N)
- LDRCSB $T1, [$pBitStream], #1
- ADDCC $BitCount, $BitCount, #8
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- MEND
-
-
- ;//
- ;// Read fixed 1<=N<=8 bits from the bitstream, advancing the bitstream pointer
- ;//
- ;// Input Registers:
- ;//
- ;// $N - number of bits to read
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $Symbol - the next N bits of the bitstream
- ;// $T1 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_READ8 $Symbol, $N, $T1
- ASSERT ($N>=1):LAND:($N<=8)
- MOVS $Symbol, $BitBuffer, LSL $BitCount
- SUBS $BitCount, $BitCount, #(8-$N)
- LDRCSB $T1, [$pBitStream], #1
- ADDCC $BitCount, $BitCount, #8
- MOV $Symbol, $Symbol, LSR #(32-$N)
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- MEND
-
- ;//
- ;// Read fixed 1<=N<=16 bits from the bitstream, advancing the bitstream pointer
- ;//
- ;// Input Registers:
- ;//
- ;// $N - number of bits to read
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $Symbol - the next N bits of the bitstream
- ;// $T1 - corrupted temp/scratch register
- ;// $T2 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_READ16 $Symbol, $N, $T1, $T2
- ASSERT ($N>=1):LAND:($N<=16)
- ASSERT $Symbol<>$T1
- IF ($N<=8)
- M_BD_READ8 $Symbol, $N, $T1
- ELSE
- ;// N>8 so we will be able to refill at least one byte
- LDRB $T1, [$pBitStream], #1
- MOVS $Symbol, $BitBuffer, LSL $BitCount
- ORR $BitBuffer, $T1, $BitBuffer, LSL #8
- SUBS $BitCount, $BitCount, #(16-$N)
- LDRCSB $T1, [$pBitStream], #1
- MOV $Symbol, $Symbol, LSR #(32-$N)
- ADDCC $BitCount, $BitCount, #8
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- ENDIF
- MEND
-
- ;//
- ;// Skip variable 1<=N<=8 bits from the bitstream, advancing the bitstream pointer.
- ;//
- ;// Input Registers:
- ;//
- ;// $N - number of bits. 1<=N<=8
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $T1 - corrupted temp/scratch register
- ;// $T2 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_VSKIP8 $N, $T1
- ADD $BitCount, $BitCount, $N
- SUBS $BitCount, $BitCount, #8
- LDRCSB $T1, [$pBitStream], #1
- ADDCC $BitCount, $BitCount, #8
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- MEND
-
- ;//
- ;// Skip variable 1<=N<=16 bits from the bitstream, advancing the bitstream pointer.
- ;//
- ;// Input Registers:
- ;//
- ;// $N - number of bits. 1<=N<=16
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $T1 - corrupted temp/scratch register
- ;// $T2 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_VSKIP16 $N, $T1, $T2
- ADD $BitCount, $BitCount, $N
- SUBS $BitCount, $BitCount, #8
- LDRCSB $T1, [$pBitStream], #1
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- SUBCSS $BitCount, $BitCount, #8
- LDRCSB $T1, [$pBitStream], #1
- ADDCC $BitCount, $BitCount, #8
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- MEND
-
- ;//
- ;// Read variable 1<=N<=8 bits from the bitstream, advancing the bitstream pointer.
- ;//
- ;// Input Registers:
- ;//
- ;// $N - number of bits to read. 1<=N<=8
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $Symbol - the next N bits of the bitstream
- ;// $T1 - corrupted temp/scratch register
- ;// $T2 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_VREAD8 $Symbol, $N, $T1, $T2
- MOV $Symbol, $BitBuffer, LSL $BitCount
- ADD $BitCount, $BitCount, $N
- SUBS $BitCount, $BitCount, #8
- LDRCSB $T1, [$pBitStream], #1
- RSB $T2, $N, #32
- ADDCC $BitCount, $BitCount, #8
- MOV $Symbol, $Symbol, LSR $T2
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- MEND
-
-
- ;//
- ;// Read variable 1<=N<=16 bits from the bitstream, advancing the bitstream pointer.
- ;//
- ;// Input Registers:
- ;//
- ;// $N - number of bits to read. 1<=N<=16
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $Symbol - the next N bits of the bitstream
- ;// $T1 - corrupted temp/scratch register
- ;// $T2 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_VREAD16 $Symbol, $N, $T1, $T2
- MOV $Symbol, $BitBuffer, LSL $BitCount
- ADD $BitCount, $BitCount, $N
- SUBS $BitCount, $BitCount, #8
- LDRCSB $T1, [$pBitStream], #1
- RSB $T2, $N, #32
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- SUBCSS $BitCount, $BitCount, #8
- LDRCSB $T1, [$pBitStream], #1
- ADDCC $BitCount, $BitCount, #8
- MOV $Symbol, $Symbol, LSR $T2
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- MEND
-
-
- ;//
- ;// Decode a code of the form 0000...001 where there
- ;// are N zeros before the 1 and N<=15 (code length<=16)
- ;//
- ;// Input Registers:
- ;//
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $Symbol - the number of zeros before the next 1
- ;// >=16 is an illegal code
- ;// $T1 - corrupted temp/scratch register
- ;// $T2 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_CLZ16 $Symbol, $T1, $T2
- MOVS $Symbol, $BitBuffer, LSL $BitCount
- CLZ $Symbol, $Symbol
- ADD $BitCount, $BitCount, $Symbol
- SUBS $BitCount, $BitCount, #7 ;// length is Symbol+1
- LDRCSB $T1, [$pBitStream], #1
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- SUBCSS $BitCount, $BitCount, #8
- LDRCSB $T1, [$pBitStream], #1
- ADDCC $BitCount, $BitCount, #8
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- MEND
-
- ;//
- ;// Decode a code of the form 1111...110 where there
- ;// are N ones before the 0 and N<=15 (code length<=16)
- ;//
- ;// Input Registers:
- ;//
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $Symbol - the number of zeros before the next 1
- ;// >=16 is an illegal code
- ;// $T1 - corrupted temp/scratch register
- ;// $T2 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_CLO16 $Symbol, $T1, $T2
- MOV $Symbol, $BitBuffer, LSL $BitCount
- MVN $Symbol, $Symbol
- CLZ $Symbol, $Symbol
- ADD $BitCount, $BitCount, $Symbol
- SUBS $BitCount, $BitCount, #7 ;// length is Symbol+1
- LDRCSB $T1, [$pBitStream], #1
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- SUBCSS $BitCount, $BitCount, #8
- LDRCSB $T1, [$pBitStream], #1
- ADDCC $BitCount, $BitCount, #8
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- MEND
-
-
- ;//
- ;// Variable Length Decode module
- ;//
- ;// Decodes one VLD Symbol from a bitstream and refill the bitstream
- ;// buffer.
- ;//
- ;// Input Registers:
- ;//
- ;// $pVLDTable - pointer to VLD decode table of 16-bit entries.
- ;// The format is described above at the start of
- ;// this file.
- ;// $S0 - The number of bits to look up for the first step
- ;// 1<=$S0<=8
- ;// $S1 - The number of bits to look up for each subsequent
- ;// step 1<=$S1<=$S0.
- ;//
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $Symbol - decoded VLD symbol value
- ;// $T1 - corrupted temp/scratch register
- ;// $T2 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_VLD $Symbol, $T1, $T2, $pVLDTable, $S0, $S1
- ASSERT (1<=$S0):LAND:($S0<=8)
- ASSERT (1<=$S1):LAND:($S1<=$S0)
-
- ;// Note 0<=BitCount<=15 on entry and exit
-
- MOVS $T1, $BitBuffer, LSL $BitCount ;// left align next bits
- MOVS $Symbol, #(2<<$S0)-2 ;// create mask
- AND $Symbol, $Symbol, $T1, LSR #(31-$S0) ;// 2*(next $S0 bits)
- SUBS $BitCount, $BitCount, #8 ;// CS if buffer can be filled
-01
- LDRCSB $T1, [$pBitStream], #1 ;// load refill byte
- LDRH $Symbol, [$pVLDTable, $Symbol] ;// load table entry
- ADDCC $BitCount, $BitCount, #8 ;// refill not possible
- ADD $BitCount, $BitCount, #$S0 ;// assume $S0 bits used
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8 ;// merge in refill byte
- MOVS $T1, $Symbol, LSR #1 ;// CS=leaf entry
- BCS %FT02
-
- MOVS $T1, $BitBuffer, LSL $BitCount ;// left align next bit
- IF (2*$S0-$S1<=8)
- ;// Can combine refill check and -S0+S1 and keep $BitCount<=15
- SUBS $BitCount, $BitCount, #8+($S0-$S1)
- ELSE
- ;// Separate refill check and -S0+S1 offset
- SUBS $BitCount, $BitCount, #8
- SUB $BitCount, $BitCount, #($S0-$S1)
- ENDIF
- ADD $Symbol, $Symbol, $T1, LSR #(31-$S1) ;// add 2*(next $S1 bits) to
- BIC $Symbol, $Symbol, #1 ;// table offset
- B %BT01 ;// load next table entry
-02
- ;// BitCount range now depend on the route here
- ;// if (first step) S0 <= BitCount <= 7+S0 <=15
- ;// else if (2*S0-S1<=8) S0 <= BitCount <= 7+(2*S0-S1) <=15
- ;// else S1 <= BitCount <= 7+S1 <=15
-
- SUB $BitCount, $BitCount, $Symbol, LSR#13
- BIC $Symbol, $T1, #0xF000
- MEND
-
-
- ;// Add an offset number of bits
- ;//
- ;// Outputs destination byte and bit index values which corresponds to an offset number of bits
- ;// from the current location. This is used to compare bitstream positions using. M_BD_CMP.
- ;//
- ;// Input Registers:
- ;//
- ;// $Offset - Offset to be added in bits.
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $ByteIndex - Destination pBitStream pointer after adding the Offset.
- ;// This value will be 4 byte ahead and needs to subtract by 4 to get exact
- ;// pointer (as in M_BD_FINI). But for using with M_BD_CMP subtract is not needed.
- ;// $BitIndex - Destination BitCount after the addition of Offset number of bits
- ;//
- MACRO
- M_BD_ADD $ByteIndex, $BitIndex, $Offset
-
- ;// ($ByteIndex,$BitIndex) = Current position + $Offset bits
- ADD $Offset, $Offset, $BitCount
- AND $BitIndex, $Offset, #7
- ADD $ByteIndex, $pBitStream, $Offset, ASR #3
- MEND
-
- ;// Move bitstream pointers to the location given
- ;//
- ;// Outputs destination byte and bit index values which corresponds to
- ;// the current location given (calculated using M_BD_ADD).
- ;//
- ;// Input Registers:
- ;//
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;// $ByteIndex - Destination pBitStream pointer after move.
- ;// This value will be 4 byte ahead and needs to subtract by 4 to get exact
- ;// pointer (as in M_BD_FINI).
- ;// $BitIndex - Destination BitCount after the move
- ;//
- ;// Output Registers:
- ;//
- ;// $pBitStream \
- ;// } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_MOV $ByteIndex, $BitIndex
-
- ;// ($pBitStream, $Offset) = ($ByteIndex,$BitIndex)
- MOV $BitCount, $BitIndex
- MOV $pBitStream, $ByteIndex
- MEND
-
- ;// Bitstream Compare
- ;//
- ;// Compares bitstream position with that of a destination position. Destination position
- ;// is held in two input registers which are calculated using M_BD_ADD macro
- ;//
- ;// Input Registers:
- ;//
- ;// $ByteIndex - Destination pBitStream pointer, (4 byte ahead as described in M_BD_ADD)
- ;// $BitIndex - Destination BitCount
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// FLAGS - GE if destination is reached, LT = is destination is ahead
- ;// $T1 - corrupted temp/scratch register
- ;//
- MACRO
- M_BD_CMP $ByteIndex, $BitIndex, $T1
-
- ;// Return flags set by (current positon)-($ByteIndex,$BitIndex)
- ;// so GE means that we have reached the indicated position
-
- ADD $T1, $pBitStream, $BitCount, LSR #3
- CMP $T1, $ByteIndex
- AND $T1, $BitCount, #7
- CMPEQ $T1, $BitIndex
- MEND
-
-
- ;// Bitstream Decode finalise
- ;//
- ;// Writes back the bitstream state to the bitstream pointers
- ;//
- ;// Input Registers:
- ;//
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $ppBitStream - pointer to pointer to the next bitstream byte
- ;// $pBitOffset - pointer to the number of bits used in the current byte (0..7)
- ;// $pBitStream \
- ;// $BitBuffer } these register are corrupted
- ;// $BitCount /
- ;//
- MACRO
- M_BD_FINI $ppBitStream, $pBitOffset
-
- ;// Advance pointer by the number of free bits in the buffer
- ADD $pBitStream, $pBitStream, $BitCount, LSR#3
- AND $BitCount, $BitCount, #7
-
- ;// Now move back 32 bits to reach the first usued bit
- SUB $pBitStream, $pBitStream, #4
-
- ;// Store out bitstream state
- STR $BitCount, [$pBitOffset]
- STR $pBitStream, [$ppBitStream]
- MEND
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_Bitstream.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_Bitstream.h
deleted file mode 100644
index 576b66d..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_Bitstream.h
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armCOMM_Bitstream.h
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * File: armCOMM_Bitstream.h
- * Brief: Declares common API's/Data types used across the OpenMax Encoders/Decoders.
- *
- */
-
-#ifndef _armCodec_H_
-#define _armCodec_H_
-
-#include "omxtypes.h"
-
-typedef struct {
- OMX_U8 codeLen;
- OMX_U32 codeWord;
-} ARM_VLC32;
-
-/* The above should be renamed as "ARM_VLC32" */
-
-/**
- * Function: armLookAheadBits()
- *
- * Description:
- * Get the next N bits from the bitstream without advancing the bitstream pointer
- *
- * Parameters:
- * [in] **ppBitStream
- * [in] *pOffset
- * [in] N=1...32
- *
- * Returns Value
- */
-
-OMX_U32 armLookAheadBits(const OMX_U8 **ppBitStream, OMX_INT *pOffset, OMX_INT N);
-
-/**
- * Function: armGetBits()
- *
- * Description:
- * Read N bits from the bitstream
- *
- * Parameters:
- * [in] *ppBitStream
- * [in] *pOffset
- * [in] N=1..32
- *
- * [out] *ppBitStream
- * [out] *pOffset
- * Returns Value
- */
-
-OMX_U32 armGetBits(const OMX_U8 **ppBitStream, OMX_INT *pOffset, OMX_INT N);
-
-/**
- * Function: armByteAlign()
- *
- * Description:
- * Align the pointer *ppBitStream to the next byte boundary
- *
- * Parameters:
- * [in] *ppBitStream
- * [in] *pOffset
- *
- * [out] *ppBitStream
- * [out] *pOffset
- *
- **/
-
-OMXVoid armByteAlign(const OMX_U8 **ppBitStream,OMX_INT *pOffset);
-
-/**
- * Function: armSkipBits()
- *
- * Description:
- * Skip N bits from the value at *ppBitStream
- *
- * Parameters:
- * [in] *ppBitStream
- * [in] *pOffset
- * [in] N
- *
- * [out] *ppBitStream
- * [out] *pOffset
- *
- **/
-
-OMXVoid armSkipBits(const OMX_U8 **ppBitStream,OMX_INT *pOffset,OMX_INT N);
-
-/***************************************
- * Variable bit length Decode
- ***************************************/
-
-/**
- * Function: armUnPackVLC32()
- *
- * Description:
- * Variable length decode of variable length symbol (max size 32 bits) read from
- * the bit stream pointed by *ppBitStream at *pOffset by using the table
- * pointed by pCodeBook
- *
- * Parameters:
- * [in] **ppBitStream
- * [in] *pOffset
- * [in] pCodeBook
- *
- * [out] **ppBitStream
- * [out] *pOffset
- *
- * Returns : Code Book Index if successfull.
- * : "ARM_NO_CODEBOOK_INDEX = 0xFFFF" if search fails.
- **/
-
-#define ARM_NO_CODEBOOK_INDEX (OMX_U16)(0xFFFF)
-
-OMX_U16 armUnPackVLC32(
- const OMX_U8 **ppBitStream,
- OMX_INT *pOffset,
- const ARM_VLC32 *pCodeBook
-);
-
-/***************************************
- * Fixed bit length Encode
- ***************************************/
-
-/**
- * Function: armPackBits
- *
- * Description:
- * Pack a VLC code word into the bitstream
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte
- * in the bit stream.
- * [in] pOffset pointer to the bit position in the byte
- * pointed by *ppBitStream. Valid within 0
- * to 7.
- * [in] codeWord Code word that need to be inserted in to the
- * bitstream
- * [in] codeLength Length of the code word valid range 1...32
- *
- * [out] ppBitStream *ppBitStream is updated after the block is encoded,
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMX_RESULT result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armPackBits (
- OMX_U8 **ppBitStream,
- OMX_INT *pOffset,
- OMX_U32 codeWord,
- OMX_INT codeLength
-);
-
-/***************************************
- * Variable bit length Encode
- ***************************************/
-
-/**
- * Function: armPackVLC32
- *
- * Description:
- * Pack a VLC code word into the bitstream
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte
- * in the bit stream.
- * [in] pBitOffset pointer to the bit position in the byte
- * pointed by *ppBitStream. Valid within 0
- * to 7.
- * [in] code VLC code word that need to be inserted in to the
- * bitstream
- *
- * [out] ppBitStream *ppBitStream is updated after the block is encoded,
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMX_RESULT result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armPackVLC32 (
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- ARM_VLC32 code
-);
-
-#endif /*_armCodec_H_*/
-
-/*End of File*/
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_IDCTTable.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_IDCTTable.h
deleted file mode 100644
index 223684e..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_IDCTTable.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- *
- * File Name: armCOMM_IDCTTable.h
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * File : armCOMM_IDCTTable.h
- * Description : Contains declarations of tables for IDCT calculation.
- *
- */
-
-#ifndef _armCOMM_IDCTTable_H_
-#define _armCOMM_IDCTTable_H_
-
-#include "omxtypes.h"
-
- /* Table of s(u)*A(u)*A(v)/16 at Q15
- * s(u)=1.0 0 <= u <= 5
- * s(6)=2.0
- * s(7)=4.0
- * A(0) = 2*sqrt(2)
- * A(u) = 4*cos(u*pi/16) for (u!=0)
- */
-extern const OMX_U16 armCOMM_IDCTPreScale [64];
-extern const OMX_U16 armCOMM_IDCTCoef [4];
-
-#endif /* _armCOMM_IDCTTable_H_ */
-
-
-/* End of File */
-
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_IDCT_s.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_IDCT_s.h
deleted file mode 100644
index 6a7d24f..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_IDCT_s.h
+++ /dev/null
@@ -1,1453 +0,0 @@
-;//
-;// Copyright (C) 2004 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// IDCT_s.s
-;//
-;// Inverse DCT module
-;//
-;//
-;// ALGORITHM DESCRIPTION
-;//
-;// The 8x8 2D IDCT is performed by calculating a 1D IDCT for each
-;// column and then a 1D IDCT for each row.
-;//
-;// The 8-point 1D IDCT is defined by
-;// f(x) = (C(0)*T(0)*c(0,x) + ... + C(7)*T(7)*c(7,x))/2
-;//
-;// C(u) = 1/sqrt(2) if u=0 or 1 if u!=0
-;// c(u,x) = cos( (2x+1)*u*pi/16 )
-;//
-;// We compute the 8-point 1D IDCT using the reverse of
-;// the Arai-Agui-Nakajima flow graph which we split into
-;// 5 stages named in reverse order to identify with the
-;// forward DCT. Direct inversion of the forward formulae
-;// in file FDCT_s.s gives:
-;//
-;// IStage 5: j(u) = T(u)*A(u) [ A(u)=4*C(u)*c(u,0) ]
-;// [ A(0) = 2*sqrt(2)
-;// A(u) = 4*cos(u*pi/16) for (u!=0) ]
-;//
-;// IStage 4: i0 = j0 i1 = j4
-;// i3 = (j2+j6)/2 i2 = (j2-j6)/2
-;// i7 = (j5+j3)/2 i4 = (j5-j3)/2
-;// i5 = (j1+j7)/2 i6 = (j1-j7)/2
-;//
-;// IStage 3: h0 = (i0+i1)/2 h1 = (i0-i1)/2
-;// h2 = (i2*sqrt2)-i3 h3 = i3
-;// h4 = cos(pi/8)*i4 + sin(pi/8)*i6
-;// h6 = -sin(pi/8)*i4 + cos(pi/8)*i6
-;// [ The above two lines rotate by -(pi/8) ]
-;// h5 = (i5-i7)/sqrt2 h7 = (i5+i7)/2
-;//
-;// IStage 2: g0 = (h0+h3)/2 g3 = (h0-h3)/2
-;// g1 = (h1+h2)/2 g2 = (h1-h2)/2
-;// g7 = h7 g6 = h6 - h7
-;// g5 = h5 - g6 g4 = h4 - g5
-;//
-;// IStage 1: f0 = (g0+g7)/2 f7 = (g0-g7)/2
-;// f1 = (g1+g6)/2 f6 = (g1-g6)/2
-;// f2 = (g2+g5)/2 f5 = (g2-g5)/2
-;// f3 = (g3+g4)/2 f4 = (g3-g4)/2
-;//
-;// Note that most coefficients are halved 3 times during the
-;// above calculation. We can rescale the algorithm dividing
-;// the input by 8 to remove the halvings.
-;//
-;// IStage 5: j(u) = T(u)*A(u)/8
-;//
-;// IStage 4: i0 = j0 i1 = j4
-;// i3 = j2 + j6 i2 = j2 - j6
-;// i7 = j5 + j3 i4 = j5 - j3
-;// i5 = j1 + j7 i6 = j1 - j7
-;//
-;// IStage 3: h0 = i0 + i1 h1 = i0 - i1
-;// h2 = (i2*sqrt2)-i3 h3 = i3
-;// h4 = 2*( cos(pi/8)*i4 + sin(pi/8)*i6)
-;// h6 = 2*(-sin(pi/8)*i4 + cos(pi/8)*i6)
-;// h5 = (i5-i7)*sqrt2 h7 = i5 + i7
-;//
-;// IStage 2: g0 = h0 + h3 g3 = h0 - h3
-;// g1 = h1 + h2 g2 = h1 - h2
-;// g7 = h7 g6 = h6 - h7
-;// g5 = h5 - g6 g4 = h4 - g5
-;//
-;// IStage 1: f0 = g0 + g7 f7 = g0 - g7
-;// f1 = g1 + g6 f6 = g1 - g6
-;// f2 = g2 + g5 f5 = g2 - g5
-;// f3 = g3 + g4 f4 = g3 - g4
-;//
-;// Note:
-;// 1. The scaling by A(u)/8 can often be combined with inverse
-;// quantization. The column and row scalings can be combined.
-;// 2. The flowgraph in the AAN paper has h4,g6 negated compared
-;// to the above code but is otherwise identical.
-;// 3. The rotation by -pi/8 can be peformed using three multiplies
-;// Eg c*i4+s*i6 = (i6-i4)*s + (c+s)*i4
-;// -s*i4+c*i6 = (i6-i4)*s + (c-s)*i6
-;// 4. If |T(u)|<=1 then from the IDCT definition,
-;// |f(x)| <= ((1/sqrt2) + |c(1,x)| + .. + |c(7,x)|)/2
-;// = ((1/sqrt2) + cos(pi/16) + ... + cos(7*pi/16))/2
-;// = ((1/sqrt2) + (cot(pi/32)-1)/2)/2
-;// = (1 + cos(pi/16) + cos(2pi/16) + cos(3pi/16))/sqrt(2)
-;// = (approx)2.64
-;// So the max gain of the 2D IDCT is ~x7.0 = 3 bits.
-;// The table below shows input patterns generating the maximum
-;// value of |f(u)| for input in the range |T(x)|<=1. M=-1, P=+1
-;// InputPattern Max |f(x)|
-;// PPPPPPPP |f0| = 2.64
-;// PPPMMMMM |f1| = 2.64
-;// PPMMMPPP |f2| = 2.64
-;// PPMMPPMM |f3| = 2.64
-;// PMMPPMMP |f4| = 2.64
-;// PMMPMMPM |f5| = 2.64
-;// PMPPMPMP |f6| = 2.64
-;// PMPMPMPM |f7| = 2.64
-;// Note that this input pattern is the transpose of the
-;// corresponding max input patter for the FDCT.
-
-;// Arguments
-
-pSrc RN 0 ;// source data buffer
-Stride RN 1 ;// destination stride in bytes
-pDest RN 2 ;// destination data buffer
-pScale RN 3 ;// pointer to scaling table
-
-
- ;// DCT Inverse Macro
- ;// The DCT code should be parametrized according
- ;// to the following inputs:
- ;// $outsize = "u8" : 8-bit unsigned data saturated (0 to +255)
- ;// "s9" : 16-bit signed data saturated to 9-bit (-256 to +255)
- ;// "s16" : 16-bit signed data not saturated (max size ~+/-14273)
- ;// $inscale = "s16" : signed 16-bit aan-scale table, Q15 format, with 4 byte alignment
- ;// "s32" : signed 32-bit aan-scale table, Q23 format, with 4 byte alignment
- ;//
- ;// Inputs:
- ;// pSrc = r0 = Pointer to input data
- ;// Range is -256 to +255 (9-bit)
- ;// Stride = r1 = Stride between input lines
- ;// pDest = r2 = Pointer to output data
- ;// pScale = r3 = Pointer to aan-scale table in the format defined by $inscale
-
-
-
- MACRO
- M_IDCT $outsize, $inscale, $stride
- LCLA SHIFT
-
-
- IF ARM1136JS
-
-;// REGISTER ALLOCATION
-;// This is hard since we have 8 values, 9 free registers and each
-;// butterfly requires a temporary register. We also want to
-;// maintain register order so we can use LDM/STM. The table below
-;// summarises the register allocation that meets all these criteria.
-;// a=1stcol, b=2ndcol, f,g,h,i are dataflow points described above.
-;//
-;// r1 a01 g0 h0
-;// r4 b01 f0 g1 h1 i0
-;// r5 a23 f1 g2 i1
-;// r6 b23 f2 g3 h2 i2
-;// r7 a45 f3 h3 i3
-;// r8 b45 f4 g4 h4 i4
-;// r9 a67 f5 g5 h5 i5
-;// r10 b67 f6 g6 h6 i6
-;// r11 f7 g7 h7 i7
-;//
-ra01 RN 1
-rb01 RN 4
-ra23 RN 5
-rb23 RN 6
-ra45 RN 7
-rb45 RN 8
-ra67 RN 9
-rb67 RN 10
-rtmp RN 11
-csPiBy8 RN 12 ;// [ (Sin(pi/8)@Q15), (Cos(pi/8)@Q15) ]
-LoopRR2 RN 14 ;// [ LoopNumber<<13 , (1/Sqrt(2))@Q15 ]
-;// Transpose allocation
-xft RN ra01
-xf0 RN rb01
-xf1 RN ra23
-xf2 RN rb23
-xf3 RN ra45
-xf4 RN rb45
-xf5 RN ra67
-xf6 RN rb67
-xf7 RN rtmp
-;// IStage 1 allocation
-xg0 RN xft
-xg1 RN xf0
-xg2 RN xf1
-xg3 RN xf2
-xgt RN xf3
-xg4 RN xf4
-xg5 RN xf5
-xg6 RN xf6
-xg7 RN xf7
-;// IStage 2 allocation
-xh0 RN xg0
-xh1 RN xg1
-xht RN xg2
-xh2 RN xg3
-xh3 RN xgt
-xh4 RN xg4
-xh5 RN xg5
-xh6 RN xg6
-xh7 RN xg7
-;// IStage 3,4 allocation
-xit RN xh0
-xi0 RN xh1
-xi1 RN xht
-xi2 RN xh2
-xi3 RN xh3
-xi4 RN xh4
-xi5 RN xh5
-xi6 RN xh6
-xi7 RN xh7
-
- M_STR pDest, ppDest
- IF "$stride"="s"
- M_STR Stride, pStride
- ENDIF
- M_ADR pDest, pBlk
- LDR csPiBy8, =0x30fc7642
- LDR LoopRR2, =0x00005a82
-
-v6_idct_col$_F
- ;// Load even values
- LDR xi4, [pSrc], #4 ;// j0
- LDR xi5, [pSrc, #4*16-4] ;// j4
- LDR xi6, [pSrc, #2*16-4] ;// j2
- LDR xi7, [pSrc, #6*16-4] ;// j6
-
- ;// Scale Even Values
- IF "$inscale"="s16" ;// 16x16 mul
-SHIFT SETA 12
- LDR xi0, [pScale], #4
- LDR xi1, [pScale, #4*16-4]
- LDR xi2, [pScale, #2*16-4]
- MOV xit, #1<<(SHIFT-1)
- SMLABB xi3, xi0, xi4, xit
- SMLATT xi4, xi0, xi4, xit
- SMLABB xi0, xi1, xi5, xit
- SMLATT xi5, xi1, xi5, xit
- MOV xi3, xi3, ASR #SHIFT
- PKHBT xi4, xi3, xi4, LSL #(16-SHIFT)
- LDR xi3, [pScale, #6*16-4]
- SMLABB xi1, xi2, xi6, xit
- SMLATT xi6, xi2, xi6, xit
- MOV xi0, xi0, ASR #SHIFT
- PKHBT xi5, xi0, xi5, LSL #(16-SHIFT)
- SMLABB xi2, xi3, xi7, xit
- SMLATT xi7, xi3, xi7, xit
- MOV xi1, xi1, ASR #SHIFT
- PKHBT xi6, xi1, xi6, LSL #(16-SHIFT)
- MOV xi2, xi2, ASR #SHIFT
- PKHBT xi7, xi2, xi7, LSL #(16-SHIFT)
- ENDIF
- IF "$inscale"="s32" ;// 32x16 mul
-SHIFT SETA (12+8-16)
- MOV xit, #1<<(SHIFT-1)
- LDR xi0, [pScale], #8
- LDR xi1, [pScale, #0*32+4-8]
- LDR xi2, [pScale, #4*32-8]
- LDR xi3, [pScale, #4*32+4-8]
- SMLAWB xi0, xi0, xi4, xit
- SMLAWT xi1, xi1, xi4, xit
- SMLAWB xi2, xi2, xi5, xit
- SMLAWT xi3, xi3, xi5, xit
- MOV xi0, xi0, ASR #SHIFT
- PKHBT xi4, xi0, xi1, LSL #(16-SHIFT)
- MOV xi2, xi2, ASR #SHIFT
- PKHBT xi5, xi2, xi3, LSL #(16-SHIFT)
- LDR xi0, [pScale, #2*32-8]
- LDR xi1, [pScale, #2*32+4-8]
- LDR xi2, [pScale, #6*32-8]
- LDR xi3, [pScale, #6*32+4-8]
- SMLAWB xi0, xi0, xi6, xit
- SMLAWT xi1, xi1, xi6, xit
- SMLAWB xi2, xi2, xi7, xit
- SMLAWT xi3, xi3, xi7, xit
- MOV xi0, xi0, ASR #SHIFT
- PKHBT xi6, xi0, xi1, LSL #(16-SHIFT)
- MOV xi2, xi2, ASR #SHIFT
- PKHBT xi7, xi2, xi3, LSL #(16-SHIFT)
- ENDIF
-
- ;// Load odd values
- LDR xi0, [pSrc, #1*16-4] ;// j1
- LDR xi1, [pSrc, #7*16-4] ;// j7
- LDR xi2, [pSrc, #5*16-4] ;// j5
- LDR xi3, [pSrc, #3*16-4] ;// j3
-
- IF {TRUE}
- ;// shortcut if odd values 0
- TEQ xi0, #0
- TEQEQ xi1, #0
- TEQEQ xi2, #0
- TEQEQ xi3, #0
- BEQ v6OddZero$_F
- ENDIF
-
- ;// Store scaled even values
- STMIA pDest, {xi4, xi5, xi6, xi7}
-
- ;// Scale odd values
- IF "$inscale"="s16"
- ;// Perform AAN Scale
- LDR xi4, [pScale, #1*16-4]
- LDR xi5, [pScale, #7*16-4]
- LDR xi6, [pScale, #5*16-4]
- SMLABB xi7, xi0, xi4, xit
- SMLATT xi0, xi0, xi4, xit
- SMLABB xi4, xi1, xi5, xit
- SMLATT xi1, xi1, xi5, xit
- MOV xi7, xi7, ASR #SHIFT
- PKHBT xi0, xi7, xi0, LSL #(16-SHIFT)
- LDR xi7, [pScale, #3*16-4]
- SMLABB xi5, xi2, xi6, xit
- SMLATT xi2, xi2, xi6, xit
- MOV xi4, xi4, ASR #SHIFT
- PKHBT xi1, xi4, xi1, LSL #(16-SHIFT)
- SMLABB xi6, xi3, xi7, xit
- SMLATT xi3, xi3, xi7, xit
- MOV xi5, xi5, ASR #SHIFT
- PKHBT xi2, xi5, xi2, LSL #(16-SHIFT)
- MOV xi6, xi6, ASR #SHIFT
- PKHBT xi3, xi6, xi3, LSL #(16-SHIFT)
- ENDIF
- IF "$inscale"="s32" ;// 32x16 mul
- LDR xi4, [pScale, #1*32-8]
- LDR xi5, [pScale, #1*32+4-8]
- LDR xi6, [pScale, #7*32-8]
- LDR xi7, [pScale, #7*32+4-8]
- SMLAWB xi4, xi4, xi0, xit
- SMLAWT xi5, xi5, xi0, xit
- SMLAWB xi6, xi6, xi1, xit
- SMLAWT xi7, xi7, xi1, xit
- MOV xi4, xi4, ASR #SHIFT
- PKHBT xi0, xi4, xi5, LSL #(16-SHIFT)
- MOV xi6, xi6, ASR #SHIFT
- PKHBT xi1, xi6, xi7, LSL #(16-SHIFT)
- LDR xi4, [pScale, #5*32-8]
- LDR xi5, [pScale, #5*32+4-8]
- LDR xi6, [pScale, #3*32-8]
- LDR xi7, [pScale, #3*32+4-8]
- SMLAWB xi4, xi4, xi2, xit
- SMLAWT xi5, xi5, xi2, xit
- SMLAWB xi6, xi6, xi3, xit
- SMLAWT xi7, xi7, xi3, xit
- MOV xi4, xi4, ASR #SHIFT
- PKHBT xi2, xi4, xi5, LSL #(16-SHIFT)
- MOV xi6, xi6, ASR #SHIFT
- PKHBT xi3, xi6, xi7, LSL #(16-SHIFT)
- ENDIF
-
- SHADD16 xi5, xi0, xi1 ;// (j1+j7)/2
- SSUB16 xi6, xi0, xi1 ;// j1-j7
- SHADD16 xi7, xi2, xi3 ;// (j5+j3)/2
- SSUB16 xi4, xi2, xi3 ;// j5-j3
-
- SSUB16 xi3, xi5, xi7 ;// (i5-i7)/2
-
- PKHBT xi0, xi6, xi4, LSL#16 ;// [i4,i6] row a
- PKHTB xi1, xi4, xi6, ASR#16 ;// [i4,i6] row b
-
- SMUADX xi2, xi0, csPiBy8 ;// rowa by [c,s]
- SMUADX xi4, xi1, csPiBy8 ;// rowb by [c,s]
- SMUSD xi0, xi0, csPiBy8 ;// rowa by [-s,c]
- SMUSD xi6, xi1, csPiBy8 ;// rowb by [-s,c]
-
- SMULBB xi1, xi3, LoopRR2
- SMULTB xi3, xi3, LoopRR2
-
- PKHTB xh4, xi4, xi2, ASR#16 ;// h4/4
- PKHTB xh6, xi6, xi0, ASR#16 ;// h6/4
- SHADD16 xh7, xi5, xi7 ;// (i5+i7)/4
-
- ;// xi0,xi1,xi2,xi3 now free
- ;// IStage 4,3, rows 2to3 x1/2
-
- MOV xi3, xi3, LSL #1
- PKHTB xh5, xi3, xi1, ASR#15 ;// h5/4
- LDRD xi0, [pDest, #8] ;// j2,j6 scaled
-
- ;// IStage 2, rows4to7
- SSUB16 xg6, xh6, xh7
- SSUB16 xg5, xh5, xg6
- SSUB16 xg4, xh4, xg5
-
- SSUB16 xi2, xi0, xi1 ;// (j2-j6)
- SHADD16 xi3, xi0, xi1 ;// (j2+j6)/2
-
- SMULBB xi0, xi2, LoopRR2
- SMULTB xi2, xi2, LoopRR2
-
- MOV xi2, xi2, LSL #1
- PKHTB xh2, xi2, xi0, ASR#15 ;// i2*sqrt(2)/4
-
- ;// xi0, xi1 now free
- ;// IStage 4,3 rows 0to1 x 1/2
- LDRD xi0, [pDest] ;// j0, j4 scaled
- SSUB16 xh2, xh2, xi3
- ADDS LoopRR2, LoopRR2, #2<<29 ;// done two rows
-
- SHADD16 xh0, xi0, xi1
- SHSUB16 xh1, xi0, xi1
-
- ;// IStage 2 rows 0to3 x 1/2
- SHSUB16 xg2, xh1, xh2
- SHADD16 xg1, xh1, xh2
- SHSUB16 xg3, xh0, xh3
- SHADD16 xg0, xh0, xh3
-
- ;// IStage 1 all rows
- SADD16 xf3, xg3, xg4
- SSUB16 xf4, xg3, xg4
- SADD16 xf2, xg2, xg5
- SSUB16 xf5, xg2, xg5
- SADD16 xf1, xg1, xg6
- SSUB16 xf6, xg1, xg6
- SADD16 xf0, xg0, xg7
- SSUB16 xf7, xg0, xg7
-
- ;// Transpose, store and loop
- PKHBT ra01, xf0, xf1, LSL #16
- PKHTB rb01, xf1, xf0, ASR #16
-
- PKHBT ra23, xf2, xf3, LSL #16
- PKHTB rb23, xf3, xf2, ASR #16
-
- PKHBT ra45, xf4, xf5, LSL #16
- PKHTB rb45, xf5, xf4, ASR #16
-
- PKHBT ra67, xf6, xf7, LSL #16
- STMIA pDest!, {ra01, ra23, ra45, ra67}
- PKHTB rb67, xf7, xf6, ASR #16
- STMIA pDest!, {rb01, rb23, rb45, rb67}
- BCC v6_idct_col$_F
-
- SUB pSrc, pDest, #(64*2)
- M_LDR pDest, ppDest
- IF "$stride"="s"
- M_LDR pScale, pStride
- ENDIF
- B v6_idct_row$_F
-
-v6OddZero$_F
- SSUB16 xi2, xi6, xi7 ;// (j2-j6)
- SHADD16 xi3, xi6, xi7 ;// (j2+j6)/2
-
- SMULBB xi0, xi2, LoopRR2
- SMULTB xi2, xi2, LoopRR2
-
- MOV xi2, xi2, LSL #1
- PKHTB xh2, xi2, xi0, ASR#15 ;// i2*sqrt(2)/4
- SSUB16 xh2, xh2, xi3
-
- ;// xi0, xi1 now free
- ;// IStage 4,3 rows 0to1 x 1/2
-
- SHADD16 xh0, xi4, xi5
- SHSUB16 xh1, xi4, xi5
-
- ;// IStage 2 rows 0to3 x 1/2
- SHSUB16 xg2, xh1, xh2
- SHADD16 xg1, xh1, xh2
- SHSUB16 xg3, xh0, xh3
- SHADD16 xg0, xh0, xh3
-
- ;// IStage 1 all rows
- MOV xf3, xg3
- MOV xf4, xg3
- MOV xf2, xg2
- MOV xf5, xg2
- MOV xf1, xg1
- MOV xf6, xg1
- MOV xf0, xg0
- MOV xf7, xg0
-
- ;// Transpose
- PKHBT ra01, xf0, xf1, LSL #16
- PKHTB rb01, xf1, xf0, ASR #16
-
- PKHBT ra23, xf2, xf3, LSL #16
- PKHTB rb23, xf3, xf2, ASR #16
-
- PKHBT ra45, xf4, xf5, LSL #16
- PKHTB rb45, xf5, xf4, ASR #16
-
- PKHBT ra67, xf6, xf7, LSL #16
- PKHTB rb67, xf7, xf6, ASR #16
-
- STMIA pDest!, {ra01, ra23, ra45, ra67}
- ADDS LoopRR2, LoopRR2, #2<<29 ;// done two rows
- STMIA pDest!, {rb01, rb23, rb45, rb67}
-
- BCC v6_idct_col$_F
- SUB pSrc, pDest, #(64*2)
- M_LDR pDest, ppDest
- IF "$stride"="s"
- M_LDR pScale, pStride
- ENDIF
-
-
-v6_idct_row$_F
- ;// IStage 4,3, rows4to7 x1/4
- LDR xit, =0x00010001 ;// rounding constant
- LDR xi0, [pSrc, #1*16] ;// j1
- LDR xi1, [pSrc, #7*16] ;// 4*j7
- LDR xi2, [pSrc, #5*16] ;// j5
- LDR xi3, [pSrc, #3*16] ;// j3
-
- SHADD16 xi1, xi1, xit ;// 2*j7
- SHADD16 xi1, xi1, xit ;// j7
-
- SHADD16 xi5, xi0, xi1 ;// (j1+j7)/2
- SSUB16 xi6, xi0, xi1 ;// j1-j7
- SHADD16 xi7, xi2, xi3 ;// (j5+j3)/2
- SSUB16 xi4, xi2, xi3 ;// j5-j3
-
- SSUB16 xi3, xi5, xi7 ;// (i5-i7)/2
-
- PKHBT xi0, xi6, xi4, LSL#16 ;// [i4,i6] row a
- PKHTB xi1, xi4, xi6, ASR#16 ;// [i4,i6] row b
-
- SMUADX xi2, xi0, csPiBy8 ;// rowa by [c,s]
- SMUADX xi4, xi1, csPiBy8 ;// rowb by [c,s]
- SMUSD xi0, xi0, csPiBy8 ;// rowa by [-s,c]
- SMUSD xi6, xi1, csPiBy8 ;// rowb by [-s,c]
-
- SMULBB xi1, xi3, LoopRR2
- SMULTB xi3, xi3, LoopRR2
-
- PKHTB xh4, xi4, xi2, ASR#16 ;// h4/4
- PKHTB xh6, xi6, xi0, ASR#16 ;// h6/4
- SHADD16 xh7, xi5, xi7 ;// (i5+i7)/4
-
- MOV xi3, xi3, LSL #1
- PKHTB xh5, xi3, xi1, ASR#15 ;// h5/4
-
- ;// xi0,xi1,xi2,xi3 now free
- ;// IStage 4,3, rows 2to3 x1/2
-
- LDR xi0, [pSrc, #2*16] ;// j2
- LDR xi1, [pSrc, #6*16] ;// 2*j6
-
- ;// IStage 2, rows4to7
- SSUB16 xg6, xh6, xh7
- SSUB16 xg5, xh5, xg6
- SSUB16 xg4, xh4, xg5
-
- SHADD16 xi1, xi1, xit ;// j6
- SSUB16 xi2, xi0, xi1 ;// (j2-j6)
- SHADD16 xi3, xi0, xi1 ;// (j2+j6)/2
-
- SMULBB xi0, xi2, LoopRR2
- SMULTB xi2, xi2, LoopRR2
-
- MOV xi2, xi2, LSL #1
-
- PKHTB xh2, xi2, xi0, ASR#15 ;// i2*sqrt(2)/4
-
- ;// xi0, xi1 now free
- ;// IStage 4,3 rows 0to1 x 1/2
- LDR xi1, [pSrc, #4*16] ;// j4
- LDR xi0, [pSrc], #4 ;// j0
-
- SSUB16 xh2, xh2, xi3
- ADDS LoopRR2, LoopRR2, #2<<29 ;// done two rows
-
- ADD xi0, xi0, xit, LSL #2 ;// ensure correct round
- SHADD16 xh0, xi0, xi1 ;// of DC result
- SHSUB16 xh1, xi0, xi1
-
- ;// IStage 2 rows 0to3 x 1/2
- SHSUB16 xg2, xh1, xh2
- SHADD16 xg1, xh1, xh2
- SHSUB16 xg3, xh0, xh3
- SHADD16 xg0, xh0, xh3
-
- ;// IStage 1 all rows
- SHADD16 xf3, xg3, xg4
- SHSUB16 xf4, xg3, xg4
- SHADD16 xf2, xg2, xg5
- SHSUB16 xf5, xg2, xg5
- SHADD16 xf1, xg1, xg6
- SHSUB16 xf6, xg1, xg6
- SHADD16 xf0, xg0, xg7
- SHSUB16 xf7, xg0, xg7
-
- ;// Saturate
- IF ("$outsize"="u8")
- USAT16 xf0, #8, xf0
- USAT16 xf1, #8, xf1
- USAT16 xf2, #8, xf2
- USAT16 xf3, #8, xf3
- USAT16 xf4, #8, xf4
- USAT16 xf5, #8, xf5
- USAT16 xf6, #8, xf6
- USAT16 xf7, #8, xf7
- ENDIF
- IF ("$outsize"="s9")
- SSAT16 xf0, #9, xf0
- SSAT16 xf1, #9, xf1
- SSAT16 xf2, #9, xf2
- SSAT16 xf3, #9, xf3
- SSAT16 xf4, #9, xf4
- SSAT16 xf5, #9, xf5
- SSAT16 xf6, #9, xf6
- SSAT16 xf7, #9, xf7
- ENDIF
-
- ;// Transpose to Row, Pack and store
- IF ("$outsize"="u8")
- ORR xf0, xf0, xf1, LSL #8 ;// [ b1 b0 a1 a0 ]
- ORR xf2, xf2, xf3, LSL #8 ;// [ b3 b2 a3 a2 ]
- ORR xf4, xf4, xf5, LSL #8 ;// [ b5 b4 a5 a4 ]
- ORR xf6, xf6, xf7, LSL #8 ;// [ b7 b6 a7 a6 ]
- PKHBT ra01, xf0, xf2, LSL #16
- PKHTB rb01, xf2, xf0, ASR #16
- PKHBT ra23, xf4, xf6, LSL #16
- PKHTB rb23, xf6, xf4, ASR #16
- STMIA pDest, {ra01, ra23}
- IF "$stride"="s"
- ADD pDest, pDest, pScale
- STMIA pDest, {rb01, rb23}
- ADD pDest, pDest, pScale
- ELSE
- ADD pDest, pDest, #($stride)
- STMIA pDest, {rb01, rb23}
- ADD pDest, pDest, #($stride)
- ENDIF
- ENDIF
- IF ("$outsize"="s9"):LOR:("$outsize"="s16")
- PKHBT ra01, xf0, xf1, LSL #16
- PKHTB rb01, xf1, xf0, ASR #16
-
- PKHBT ra23, xf2, xf3, LSL #16
- PKHTB rb23, xf3, xf2, ASR #16
-
- PKHBT ra45, xf4, xf5, LSL #16
- PKHTB rb45, xf5, xf4, ASR #16
-
- PKHBT ra67, xf6, xf7, LSL #16
- PKHTB rb67, xf7, xf6, ASR #16
-
- STMIA pDest, {ra01, ra23, ra45, ra67}
- IF "$stride"="s"
- ADD pDest, pDest, pScale
- STMIA pDest, {rb01, rb23, rb45, rb67}
- ADD pDest, pDest, pScale
- ELSE
- ADD pDest, pDest, #($stride)
- STMIA pDest, {rb01, rb23, rb45, rb67}
- ADD pDest, pDest, #($stride)
- ENDIF
- ENDIF
-
- BCC v6_idct_row$_F
- ENDIF ;// ARM1136JS
-
-
- IF CortexA8
-
-Src0 EQU 7
-Src1 EQU 8
-Src2 EQU 9
-Src3 EQU 10
-Src4 EQU 11
-Src5 EQU 12
-Src6 EQU 13
-Src7 EQU 14
-Tmp EQU 15
-
-qXj0 QN Src0.S16
-qXj1 QN Src1.S16
-qXj2 QN Src2.S16
-qXj3 QN Src3.S16
-qXj4 QN Src4.S16
-qXj5 QN Src5.S16
-qXj6 QN Src6.S16
-qXj7 QN Src7.S16
-qXjt QN Tmp.S16
-
-dXj0lo DN (Src0*2).S16
-dXj0hi DN (Src0*2+1).S16
-dXj1lo DN (Src1*2).S16
-dXj1hi DN (Src1*2+1).S16
-dXj2lo DN (Src2*2).S16
-dXj2hi DN (Src2*2+1).S16
-dXj3lo DN (Src3*2).S16
-dXj3hi DN (Src3*2+1).S16
-dXj4lo DN (Src4*2).S16
-dXj4hi DN (Src4*2+1).S16
-dXj5lo DN (Src5*2).S16
-dXj5hi DN (Src5*2+1).S16
-dXj6lo DN (Src6*2).S16
-dXj6hi DN (Src6*2+1).S16
-dXj7lo DN (Src7*2).S16
-dXj7hi DN (Src7*2+1).S16
-dXjtlo DN (Tmp*2).S16
-dXjthi DN (Tmp*2+1).S16
-
-qXi0 QN qXj0
-qXi1 QN qXj4
-qXi2 QN qXj2
-qXi3 QN qXj7
-qXi4 QN qXj5
-qXi5 QN qXjt
-qXi6 QN qXj1
-qXi7 QN qXj6
-qXit QN qXj3
-
-dXi0lo DN dXj0lo
-dXi0hi DN dXj0hi
-dXi1lo DN dXj4lo
-dXi1hi DN dXj4hi
-dXi2lo DN dXj2lo
-dXi2hi DN dXj2hi
-dXi3lo DN dXj7lo
-dXi3hi DN dXj7hi
-dXi4lo DN dXj5lo
-dXi4hi DN dXj5hi
-dXi5lo DN dXjtlo
-dXi5hi DN dXjthi
-dXi6lo DN dXj1lo
-dXi6hi DN dXj1hi
-dXi7lo DN dXj6lo
-dXi7hi DN dXj6hi
-dXitlo DN dXj3lo
-dXithi DN dXj3hi
-
-qXh0 QN qXit
-qXh1 QN qXi0
-qXh2 QN qXi2
-qXh3 QN qXi3
-qXh4 QN qXi7
-qXh5 QN qXi5
-qXh6 QN qXi4
-qXh7 QN qXi1
-qXht QN qXi6
-
-dXh0lo DN dXitlo
-dXh0hi DN dXithi
-dXh1lo DN dXi0lo
-dXh1hi DN dXi0hi
-dXh2lo DN dXi2lo
-dXh2hi DN dXi2hi
-dXh3lo DN dXi3lo
-dXh3hi DN dXi3hi
-dXh4lo DN dXi7lo
-dXh4hi DN dXi7hi
-dXh5lo DN dXi5lo
-dXh5hi DN dXi5hi
-dXh6lo DN dXi4lo
-dXh6hi DN dXi4hi
-dXh7lo DN dXi1lo
-dXh7hi DN dXi1hi
-dXhtlo DN dXi6lo
-dXhthi DN dXi6hi
-
-qXg0 QN qXh2
-qXg1 QN qXht
-qXg2 QN qXh1
-qXg3 QN qXh0
-qXg4 QN qXh4
-qXg5 QN qXh5
-qXg6 QN qXh6
-qXg7 QN qXh7
-qXgt QN qXh3
-
-qXf0 QN qXg6
-qXf1 QN qXg5
-qXf2 QN qXg4
-qXf3 QN qXgt
-qXf4 QN qXg3
-qXf5 QN qXg2
-qXf6 QN qXg1
-qXf7 QN qXg0
-qXft QN qXg7
-
-
-qXt0 QN 1.S32
-qXt1 QN 2.S32
-qT0lo QN 1.S32
-qT0hi QN 2.S32
-qT1lo QN 3.S32
-qT1hi QN 4.S32
-qScalelo QN 5.S32 ;// used to read post scale values
-qScalehi QN 6.S32
-qTemp0 QN 5.S32
-qTemp1 QN 6.S32
-
-
-Scale1 EQU 6
-Scale2 EQU 15
-qScale1 QN Scale1.S16
-qScale2 QN Scale2.S16
-dScale1lo DN (Scale1*2).S16
-dScale1hi DN (Scale1*2+1).S16
-dScale2lo DN (Scale2*2).S16
-dScale2hi DN (Scale2*2+1).S16
-
-dCoefs DN 0.S16 ;// Scale coefficients in format {[0] [C] [S] [InvSqrt2]}
-InvSqrt2 DN dCoefs[0] ;// 1/sqrt(2) in Q15
-S DN dCoefs[1] ;// Sin(PI/8) in Q15
-C DN dCoefs[2] ;// Cos(PI/8) in Q15
-
-pTemp RN 12
-
-
- IMPORT armCOMM_IDCTCoef
-
- VLD1 {qXj0,qXj1}, [pSrc @64]!
- VLD1 {qXj2,qXj3}, [pSrc @64]!
- VLD1 {qXj4,qXj5}, [pSrc @64]!
- VLD1 {qXj6,qXj7}, [pSrc @64]!
-
- ;// Load PreScale and multiply with Src
- ;// IStage 4
-
- IF "$inscale"="s16" ;// 16X16 Mul
- M_IDCT_PRESCALE16
- ENDIF
-
- IF "$inscale"="s32" ;// 32X32 ,ul
- M_IDCT_PRESCALE32
- ENDIF
-
- ;// IStage 3
- VQRDMULH qXi2, qXi2, InvSqrt2 ;// i2/sqrt(2)
- VHADD qXh0, qXi0, qXi1 ;// (i0+i1)/2
- VHSUB qXh1, qXi0, qXi1 ;// (i0-i1)/2
- VHADD qXh7, qXi5, qXi7 ;// (i5+i7)/4
- VSUB qXh5, qXi5, qXi7 ;// (i5-i7)/2
- VQRDMULH qXh5, qXh5, InvSqrt2 ;// h5/sqrt(2)
- VSUB qXh2, qXi2, qXi3 ;// h2, h3
-
- VMULL qXt0, dXi4lo, C ;// c*i4
- VMLAL qXt0, dXi6lo, S ;// c*i4+s*i6
- VMULL qXt1, dXi4hi, C
- VMLAL qXt1, dXi6hi, S
- VSHRN dXh4lo, qXt0, #16 ;// h4
- VSHRN dXh4hi, qXt1, #16
-
- VMULL qXt0, dXi6lo, C ;// c*i6
- VMLSL qXt0, dXi4lo, S ;// -s*i4 + c*h6
- VMULL qXt1, dXi6hi, C
- VMLSL qXt1, dXi4hi, S
- VSHRN dXh6lo, qXt0, #16 ;// h6
- VSHRN dXh6hi, qXt1, #16
-
- ;// IStage 2
- VSUB qXg6, qXh6, qXh7
- VSUB qXg5, qXh5, qXg6
- VSUB qXg4, qXh4, qXg5
- VHADD qXg1, qXh1, qXh2 ;// (h1+h2)/2
- VHSUB qXg2, qXh1, qXh2 ;// (h1-h2)/2
- VHADD qXg0, qXh0, qXh3 ;// (h0+h3)/2
- VHSUB qXg3, qXh0, qXh3 ;// (h0-h3)/2
-
- ;// IStage 1 all rows
- VADD qXf3, qXg3, qXg4
- VSUB qXf4, qXg3, qXg4
- VADD qXf2, qXg2, qXg5
- VSUB qXf5, qXg2, qXg5
- VADD qXf1, qXg1, qXg6
- VSUB qXf6, qXg1, qXg6
- VADD qXf0, qXg0, qXg7
- VSUB qXf7, qXg0, qXg7
-
- ;// Transpose, store and loop
-XTR0 EQU Src5
-XTR1 EQU Tmp
-XTR2 EQU Src6
-XTR3 EQU Src7
-XTR4 EQU Src3
-XTR5 EQU Src0
-XTR6 EQU Src1
-XTR7 EQU Src2
-XTRt EQU Src4
-
-qA0 QN XTR0.S32 ;// for XTRpose
-qA1 QN XTR1.S32
-qA2 QN XTR2.S32
-qA3 QN XTR3.S32
-qA4 QN XTR4.S32
-qA5 QN XTR5.S32
-qA6 QN XTR6.S32
-qA7 QN XTR7.S32
-
-dB0 DN XTR0*2+1 ;// for using VSWP
-dB1 DN XTR1*2+1
-dB2 DN XTR2*2+1
-dB3 DN XTR3*2+1
-dB4 DN XTR4*2
-dB5 DN XTR5*2
-dB6 DN XTR6*2
-dB7 DN XTR7*2
-
-
- VTRN qXf0, qXf1
- VTRN qXf2, qXf3
- VTRN qXf4, qXf5
- VTRN qXf6, qXf7
- VTRN qA0, qA2
- VTRN qA1, qA3
- VTRN qA4, qA6
- VTRN qA5, qA7
- VSWP dB0, dB4
- VSWP dB1, dB5
- VSWP dB2, dB6
- VSWP dB3, dB7
-
-
-qYj0 QN qXf0
-qYj1 QN qXf1
-qYj2 QN qXf2
-qYj3 QN qXf3
-qYj4 QN qXf4
-qYj5 QN qXf5
-qYj6 QN qXf6
-qYj7 QN qXf7
-qYjt QN qXft
-
-dYj0lo DN (XTR0*2).S16
-dYj0hi DN (XTR0*2+1).S16
-dYj1lo DN (XTR1*2).S16
-dYj1hi DN (XTR1*2+1).S16
-dYj2lo DN (XTR2*2).S16
-dYj2hi DN (XTR2*2+1).S16
-dYj3lo DN (XTR3*2).S16
-dYj3hi DN (XTR3*2+1).S16
-dYj4lo DN (XTR4*2).S16
-dYj4hi DN (XTR4*2+1).S16
-dYj5lo DN (XTR5*2).S16
-dYj5hi DN (XTR5*2+1).S16
-dYj6lo DN (XTR6*2).S16
-dYj6hi DN (XTR6*2+1).S16
-dYj7lo DN (XTR7*2).S16
-dYj7hi DN (XTR7*2+1).S16
-dYjtlo DN (XTRt*2).S16
-dYjthi DN (XTRt*2+1).S16
-
-qYi0 QN qYj0
-qYi1 QN qYj4
-qYi2 QN qYj2
-qYi3 QN qYj7
-qYi4 QN qYj5
-qYi5 QN qYjt
-qYi6 QN qYj1
-qYi7 QN qYj6
-qYit QN qYj3
-
-dYi0lo DN dYj0lo
-dYi0hi DN dYj0hi
-dYi1lo DN dYj4lo
-dYi1hi DN dYj4hi
-dYi2lo DN dYj2lo
-dYi2hi DN dYj2hi
-dYi3lo DN dYj7lo
-dYi3hi DN dYj7hi
-dYi4lo DN dYj5lo
-dYi4hi DN dYj5hi
-dYi5lo DN dYjtlo
-dYi5hi DN dYjthi
-dYi6lo DN dYj1lo
-dYi6hi DN dYj1hi
-dYi7lo DN dYj6lo
-dYi7hi DN dYj6hi
-dYitlo DN dYj3lo
-dYithi DN dYj3hi
-
-qYh0 QN qYit
-qYh1 QN qYi0
-qYh2 QN qYi2
-qYh3 QN qYi3
-qYh4 QN qYi7
-qYh5 QN qYi5
-qYh6 QN qYi4
-qYh7 QN qYi1
-qYht QN qYi6
-
-dYh0lo DN dYitlo
-dYh0hi DN dYithi
-dYh1lo DN dYi0lo
-dYh1hi DN dYi0hi
-dYh2lo DN dYi2lo
-dYh2hi DN dYi2hi
-dYh3lo DN dYi3lo
-dYh3hi DN dYi3hi
-dYh4lo DN dYi7lo
-dYh4hi DN dYi7hi
-dYh5lo DN dYi5lo
-dYh5hi DN dYi5hi
-dYh6lo DN dYi4lo
-dYh6hi DN dYi4hi
-dYh7lo DN dYi1lo
-dYh7hi DN dYi1hi
-dYhtlo DN dYi6lo
-dYhthi DN dYi6hi
-
-qYg0 QN qYh2
-qYg1 QN qYht
-qYg2 QN qYh1
-qYg3 QN qYh0
-qYg4 QN qYh4
-qYg5 QN qYh5
-qYg6 QN qYh6
-qYg7 QN qYh7
-qYgt QN qYh3
-
-qYf0 QN qYg6
-qYf1 QN qYg5
-qYf2 QN qYg4
-qYf3 QN qYgt
-qYf4 QN qYg3
-qYf5 QN qYg2
-qYf6 QN qYg1
-qYf7 QN qYg0
-qYft QN qYg7
-
- VRSHR qYj7, qYj7, #2
- VRSHR qYj6, qYj6, #1
-
- VHADD qYi5, qYj1, qYj7 ;// i5 = (j1+j7)/2
- VSUB qYi6, qYj1, qYj7 ;// i6 = j1-j7
- VHADD qYi3, qYj2, qYj6 ;// i3 = (j2+j6)/2
- VSUB qYi2, qYj2, qYj6 ;// i2 = j2-j6
- VHADD qYi7, qYj5, qYj3 ;// i7 = (j5+j3)/2
- VSUB qYi4, qYj5, qYj3 ;// i4 = j5-j3
-
- VQRDMULH qYi2, qYi2, InvSqrt2 ;// i2/sqrt(2)
- ;// IStage 4,3 rows 0to1 x 1/2
-
- MOV pTemp, #0x4 ;// ensure correct round
- VDUP qScale1, pTemp ;// of DC result
- VADD qYi0, qYi0, qScale1
-
- VHADD qYh0, qYi0, qYi1 ;// (i0+i1)/2
- VHSUB qYh1, qYi0, qYi1 ;// (i0-i1)/2
-
- VHADD qYh7, qYi5, qYi7 ;// (i5+i7)/4
- VSUB qYh5, qYi5, qYi7 ;// (i5-i7)/2
- VSUB qYh2, qYi2, qYi3 ;// h2, h3
- VQRDMULH qYh5, qYh5, InvSqrt2 ;// h5/sqrt(2)
-
- VMULL qXt0, dYi4lo, C ;// c*i4
- VMLAL qXt0, dYi6lo, S ;// c*i4+s*i6
- VMULL qXt1, dYi4hi, C
- VMLAL qXt1, dYi6hi, S
- VSHRN dYh4lo, qXt0, #16 ;// h4
- VSHRN dYh4hi, qXt1, #16
-
- VMULL qXt0, dYi6lo, C ;// c*i6
- VMLSL qXt0, dYi4lo, S ;// -s*i4 + c*h6
- VMULL qXt1, dYi6hi, C
- VMLSL qXt1, dYi4hi, S
- VSHRN dYh6lo, qXt0, #16 ;// h6
- VSHRN dYh6hi, qXt1, #16
-
- VSUB qYg6, qYh6, qYh7
- VSUB qYg5, qYh5, qYg6
- VSUB qYg4, qYh4, qYg5
-
- ;// IStage 2 rows 0to3 x 1/2
- VHADD qYg1, qYh1, qYh2 ;// (h1+h2)/2
- VHSUB qYg2, qYh1, qYh2 ;// (h1-h2)/2
- VHADD qYg0, qYh0, qYh3 ;// (h0+h3)/2
- VHSUB qYg3, qYh0, qYh3 ;// (h0-h3)/2
-
-
- ;// IStage 1 all rows
- VHADD qYf3, qYg3, qYg4
- VHSUB qYf4, qYg3, qYg4
- VHADD qYf2, qYg2, qYg5
- VHSUB qYf5, qYg2, qYg5
- VHADD qYf1, qYg1, qYg6
- VHSUB qYf6, qYg1, qYg6
- VHADD qYf0, qYg0, qYg7
- VHSUB qYf7, qYg0, qYg7
-
-YTR0 EQU Src0
-YTR1 EQU Src4
-YTR2 EQU Src1
-YTR3 EQU Src2
-YTR4 EQU Src7
-YTR5 EQU Src5
-YTR6 EQU Tmp
-YTR7 EQU Src6
-YTRt EQU Src3
-
-qC0 QN YTR0.S32 ;// for YTRpose
-qC1 QN YTR1.S32
-qC2 QN YTR2.S32
-qC3 QN YTR3.S32
-qC4 QN YTR4.S32
-qC5 QN YTR5.S32
-qC6 QN YTR6.S32
-qC7 QN YTR7.S32
-
-dD0 DN YTR0*2+1 ;// for using VSWP
-dD1 DN YTR1*2+1
-dD2 DN YTR2*2+1
-dD3 DN YTR3*2+1
-dD4 DN YTR4*2
-dD5 DN YTR5*2
-dD6 DN YTR6*2
-dD7 DN YTR7*2
-
- VTRN qYf0, qYf1
- VTRN qYf2, qYf3
- VTRN qYf4, qYf5
- VTRN qYf6, qYf7
- VTRN qC0, qC2
- VTRN qC1, qC3
- VTRN qC4, qC6
- VTRN qC5, qC7
- VSWP dD0, dD4
- VSWP dD1, dD5
- VSWP dD2, dD6
- VSWP dD3, dD7
-
-
-dYf0U8 DN YTR0*2.U8
-dYf1U8 DN YTR1*2.U8
-dYf2U8 DN YTR2*2.U8
-dYf3U8 DN YTR3*2.U8
-dYf4U8 DN YTR4*2.U8
-dYf5U8 DN YTR5*2.U8
-dYf6U8 DN YTR6*2.U8
-dYf7U8 DN YTR7*2.U8
-
- ;//
- ;// Do saturation if outsize is other than S16
- ;//
-
- IF ("$outsize"="u8")
- ;// Output range [0-255]
- VQMOVN dYf0U8, qYf0
- VQMOVN dYf1U8, qYf1
- VQMOVN dYf2U8, qYf2
- VQMOVN dYf3U8, qYf3
- VQMOVN dYf4U8, qYf4
- VQMOVN dYf5U8, qYf5
- VQMOVN dYf6U8, qYf6
- VQMOVN dYf7U8, qYf7
- ENDIF
-
- IF ("$outsize"="s9")
- ;// Output range [-256 to +255]
- VQSHL qYf0, qYf0, #16-9
- VQSHL qYf1, qYf1, #16-9
- VQSHL qYf2, qYf2, #16-9
- VQSHL qYf3, qYf3, #16-9
- VQSHL qYf4, qYf4, #16-9
- VQSHL qYf5, qYf5, #16-9
- VQSHL qYf6, qYf6, #16-9
- VQSHL qYf7, qYf7, #16-9
-
- VSHR qYf0, qYf0, #16-9
- VSHR qYf1, qYf1, #16-9
- VSHR qYf2, qYf2, #16-9
- VSHR qYf3, qYf3, #16-9
- VSHR qYf4, qYf4, #16-9
- VSHR qYf5, qYf5, #16-9
- VSHR qYf6, qYf6, #16-9
- VSHR qYf7, qYf7, #16-9
- ENDIF
-
- ;// Store output depending on the Stride size
- IF "$stride"="s"
- VST1 qYf0, [pDest @64], Stride
- VST1 qYf1, [pDest @64], Stride
- VST1 qYf2, [pDest @64], Stride
- VST1 qYf3, [pDest @64], Stride
- VST1 qYf4, [pDest @64], Stride
- VST1 qYf5, [pDest @64], Stride
- VST1 qYf6, [pDest @64], Stride
- VST1 qYf7, [pDest @64]
- ELSE
- IF ("$outsize"="u8")
- VST1 dYf0U8, [pDest @64], #8
- VST1 dYf1U8, [pDest @64], #8
- VST1 dYf2U8, [pDest @64], #8
- VST1 dYf3U8, [pDest @64], #8
- VST1 dYf4U8, [pDest @64], #8
- VST1 dYf5U8, [pDest @64], #8
- VST1 dYf6U8, [pDest @64], #8
- VST1 dYf7U8, [pDest @64]
- ELSE
- ;// ("$outsize"="s9") or ("$outsize"="s16")
- VST1 qYf0, [pDest @64], #16
- VST1 qYf1, [pDest @64], #16
- VST1 qYf2, [pDest @64], #16
- VST1 qYf3, [pDest @64], #16
- VST1 qYf4, [pDest @64], #16
- VST1 qYf5, [pDest @64], #16
- VST1 qYf6, [pDest @64], #16
- VST1 qYf7, [pDest @64]
- ENDIF
-
- ENDIF
-
-
-
- ENDIF ;// CortexA8
-
-
-
- MEND
-
- ;// Scale TWO input rows with TWO rows of 16 bit scale values
- ;//
- ;// This macro is used by M_IDCT_PRESCALE16 to pre-scale one row
- ;// input (Eight input values) with one row of scale values. Also
- ;// Loads next scale values from pScale, if $LastRow flag is not set.
- ;//
- ;// Input Registers:
- ;//
- ;// $dAlo - Input D register with first four S16 values of row n
- ;// $dAhi - Input D register with next four S16 values of row n
- ;// $dBlo - Input D register with first four S16 values of row n+1
- ;// $dBhi - Input D register with next four S16 values of row n+1
- ;// pScale - Pointer to next row of scale values
- ;// qT0lo - Temporary scratch register
- ;// qT0hi - Temporary scratch register
- ;// qT1lo - Temporary scratch register
- ;// qT1hi - Temporary scratch register
- ;// dScale1lo - Scale value of row n
- ;// dScale1hi - Scale value of row n
- ;// dScale2lo - Scale value of row n+1
- ;// dScale2hi - Scale value of row n+1
- ;//
- ;// Input Flag
- ;//
- ;// $LastRow - Flag to indicate whether current row is last row
- ;//
- ;// Output Registers:
- ;//
- ;// $dAlo - Scaled output values (first four S16 of row n)
- ;// $dAhi - Scaled output values (next four S16 of row n)
- ;// $dBlo - Scaled output values (first four S16 of row n+1)
- ;// $dBhi - Scaled output values (next four S16 of row n+1)
- ;// qScale1 - Scale values for next row
- ;// qScale2 - Scale values for next row+1
- ;// pScale - Pointer to next row of scale values
- ;//
- MACRO
- M_IDCT_SCALE16 $dAlo, $dAhi, $dBlo, $dBhi, $LastRow
- VMULL qT0lo, $dAlo, dScale1lo
- VMULL qT0hi, $dAhi, dScale1hi
- VMULL qT1lo, $dBlo, dScale2lo
- VMULL qT1hi, $dBhi, dScale2hi
- IF "$LastRow"="0"
- VLD1 qScale1, [pScale], #16 ;// Load scale for row n+1
- VLD1 qScale2, [pScale], #16 ;// Load scale for row n+2
- ENDIF
- VQRSHRN $dAlo, qT0lo, #12
- VQRSHRN $dAhi, qT0hi, #12
- VQRSHRN $dBlo, qT1lo, #12
- VQRSHRN $dBhi, qT1hi, #12
- MEND
-
- ;// Scale 8x8 block input values with 16 bit scale values
- ;//
- ;// This macro is used to pre-scale block of 8x8 input.
- ;// This also do the Ist stage transformations of IDCT.
- ;//
- ;// Input Registers:
- ;//
- ;// dXjnlo - n th input D register with first four S16 values
- ;// dXjnhi - n th input D register with next four S16 values
- ;// qXjn - n th input Q register with eight S16 values
- ;// pScale - Pointer to scale values
- ;//
- ;// Output Registers:
- ;//
- ;// qXin - n th output Q register with eight S16 output values of 1st stage
- ;//
- MACRO
- M_IDCT_PRESCALE16
- VLD1 qScale1, [pScale], #16 ;// Load Pre scale for row 0
- VLD1 qScale2, [pScale], #16 ;// Load Pre scale for row 0
- M_IDCT_SCALE16 dXj0lo, dXj0hi, dXj1lo, dXj1hi, 0 ;// Pre scale row 0 & 1
- M_IDCT_SCALE16 dXj2lo, dXj2hi, dXj3lo, dXj3hi, 0
- M_IDCT_SCALE16 dXj4lo, dXj4hi, dXj5lo, dXj5hi, 0
- M_IDCT_SCALE16 dXj6lo, dXj6hi, dXj7lo, dXj7hi, 1
- VHADD qXi5, qXj1, qXj7 ;// (j1+j7)/2
- VSUB qXi6, qXj1, qXj7 ;// j1-j7
- LDR pSrc, =armCOMM_IDCTCoef ;// Address of DCT inverse AAN constants
- VHADD qXi3, qXj2, qXj6 ;// (j2+j6)/2
- VSUB qXi2, qXj2, qXj6 ;// j2-j6
- VLDR dCoefs, [pSrc] ;// Load DCT inverse AAN constants
- VHADD qXi7, qXj5, qXj3 ;// (j5+j3)/2
- VSUB qXi4, qXj5, qXj3 ;// j5-j3
- MEND
-
-
- ;// Scale 8x8 block input values with 32 bit scale values
- ;//
- ;// This macro is used to pre-scale block of 8x8 input.
- ;// This also do the Ist stage transformations of IDCT.
- ;//
- ;// Input Registers:
- ;//
- ;// dXjnlo - n th input D register with first four S16 values
- ;// dXjnhi - n th input D register with next four S16 values
- ;// qXjn - n th input Q register with eight S16 values
- ;// pScale - Pointer to 32bit scale values in Q23 format
- ;//
- ;// Output Registers:
- ;//
- ;// dXinlo - n th output D register with first four S16 output values of 1st stage
- ;// dXinhi - n th output D register with next four S16 output values of 1st stage
- ;//
- MACRO
- M_IDCT_PRESCALE32
-qScale0lo QN 0.S32
-qScale0hi QN 1.S32
-qScale1lo QN 2.S32
-qScale1hi QN 3.S32
-qScale2lo QN qScale1lo
-qScale2hi QN qScale1hi
-qScale3lo QN qScale1lo
-qScale3hi QN qScale1hi
-qScale4lo QN qScale1lo
-qScale4hi QN qScale1hi
-qScale5lo QN qScale0lo
-qScale5hi QN qScale0hi
-qScale6lo QN qScale0lo
-qScale6hi QN qScale0hi
-qScale7lo QN qScale0lo
-qScale7hi QN qScale0hi
-
-qSrc0lo QN 4.S32
-qSrc0hi QN 5.S32
-qSrc1lo QN 6.S32
-qSrc1hi QN Src4.S32
-qSrc2lo QN qSrc0lo
-qSrc2hi QN qSrc0hi
-qSrc3lo QN qSrc0lo
-qSrc3hi QN qSrc0hi
-qSrc4lo QN qSrc0lo
-qSrc4hi QN qSrc0hi
-qSrc5lo QN qSrc1lo
-qSrc5hi QN qSrc1hi
-qSrc6lo QN qSrc1lo
-qSrc6hi QN qSrc1hi
-qSrc7lo QN qSrc0lo
-qSrc7hi QN qSrc0hi
-
-qRes17lo QN qScale0lo
-qRes17hi QN qScale0hi
-qRes26lo QN qScale0lo
-qRes26hi QN qScale0hi
-qRes53lo QN qScale0lo
-qRes53hi QN qScale0hi
-
- ADD pTemp, pScale, #4*8*7 ;// Address of pScale[7]
-
- ;// Row 0
- VLD1 {qScale0lo, qScale0hi}, [pScale]!
- VSHLL qSrc0lo, dXj0lo, #(12-1)
- VSHLL qSrc0hi, dXj0hi, #(12-1)
- VLD1 {qScale1lo, qScale1hi}, [pScale]!
- VQRDMULH qSrc0lo, qScale0lo, qSrc0lo
- VQRDMULH qSrc0hi, qScale0hi, qSrc0hi
- VLD1 {qScale7lo, qScale7hi}, [pTemp]!
- VSHLL qSrc1lo, dXj1lo, #(12-1)
- VSHLL qSrc1hi, dXj1hi, #(12-1)
- VMOVN dXi0lo, qSrc0lo ;// Output i0
- VMOVN dXi0hi, qSrc0hi
- VSHLL qSrc7lo, dXj7lo, #(12-1)
- VSHLL qSrc7hi, dXj7hi, #(12-1)
- SUB pTemp, pTemp, #((16*2)+(4*8*1))
- VQRDMULH qSrc1lo, qScale1lo, qSrc1lo
- VQRDMULH qSrc1hi, qScale1hi, qSrc1hi
- VQRDMULH qSrc7lo, qScale7lo, qSrc7lo
- VQRDMULH qSrc7hi, qScale7hi, qSrc7hi
- VLD1 {qScale2lo, qScale2hi}, [pScale]!
-
- ;// Row 1 & 7
- VHADD qRes17lo, qSrc1lo, qSrc7lo ;// (j1+j7)/2
- VHADD qRes17hi, qSrc1hi, qSrc7hi ;// (j1+j7)/2
- VMOVN dXi5lo, qRes17lo ;// Output i5
- VMOVN dXi5hi, qRes17hi
- VSUB qRes17lo, qSrc1lo, qSrc7lo ;// j1-j7
- VSUB qRes17hi, qSrc1hi, qSrc7hi ;// j1-j7
- VMOVN dXi6lo, qRes17lo ;// Output i6
- VMOVN dXi6hi, qRes17hi
- VSHLL qSrc2lo, dXj2lo, #(12-1)
- VSHLL qSrc2hi, dXj2hi, #(12-1)
- VLD1 {qScale6lo, qScale6hi}, [pTemp]!
- VSHLL qSrc6lo, dXj6lo, #(12-1)
- VSHLL qSrc6hi, dXj6hi, #(12-1)
- SUB pTemp, pTemp, #((16*2)+(4*8*1))
- VQRDMULH qSrc2lo, qScale2lo, qSrc2lo
- VQRDMULH qSrc2hi, qScale2hi, qSrc2hi
- VQRDMULH qSrc6lo, qScale6lo, qSrc6lo
- VQRDMULH qSrc6hi, qScale6hi, qSrc6hi
- VLD1 {qScale3lo, qScale3hi}, [pScale]!
-
- ;// Row 2 & 6
- VHADD qRes26lo, qSrc2lo, qSrc6lo ;// (j2+j6)/2
- VHADD qRes26hi, qSrc2hi, qSrc6hi ;// (j2+j6)/2
- VMOVN dXi3lo, qRes26lo ;// Output i3
- VMOVN dXi3hi, qRes26hi
- VSUB qRes26lo, qSrc2lo, qSrc6lo ;// j2-j6
- VSUB qRes26hi, qSrc2hi, qSrc6hi ;// j2-j6
- VMOVN dXi2lo, qRes26lo ;// Output i2
- VMOVN dXi2hi, qRes26hi
- VSHLL qSrc3lo, dXj3lo, #(12-1)
- VSHLL qSrc3hi, dXj3hi, #(12-1)
- VLD1 {qScale5lo, qScale5hi}, [pTemp]!
- VSHLL qSrc5lo, dXj5lo, #(12-1)
- VSHLL qSrc5hi, dXj5hi, #(12-1)
- VQRDMULH qSrc3lo, qScale3lo, qSrc3lo
- VQRDMULH qSrc3hi, qScale3hi, qSrc3hi
- VQRDMULH qSrc5lo, qScale5lo, qSrc5lo
- VQRDMULH qSrc5hi, qScale5hi, qSrc5hi
-
- ;// Row 3 & 5
- VHADD qRes53lo, qSrc5lo, qSrc3lo ;// (j5+j3)/2
- VHADD qRes53hi, qSrc5hi, qSrc3hi ;// (j5+j3)/2
- SUB pSrc, pSrc, #16*2*2
- VMOVN dXi7lo, qRes53lo ;// Output i7
- VMOVN dXi7hi, qRes53hi
- VSUB qRes53lo, qSrc5lo, qSrc3lo ;// j5-j3
- VSUB qRes53hi, qSrc5hi, qSrc3hi ;// j5-j3
- VLD1 qXj4, [pSrc @64]
- VMOVN dXi4lo, qRes53lo ;// Output i4
- VMOVN dXi4hi, qRes53hi
- VSHLL qSrc4lo, dXj4lo, #(12-1)
- VSHLL qSrc4hi, dXj4hi, #(12-1)
- VLD1 {qScale4lo, qScale4hi}, [pScale]
- LDR pSrc, =armCOMM_IDCTCoef ;// Address of DCT inverse AAN constants
- VQRDMULH qSrc4lo, qScale4lo, qSrc4lo
- VQRDMULH qSrc4hi, qScale4hi, qSrc4hi
- VLDR dCoefs, [pSrc] ;// Load DCT inverse AAN constants
- ;// Row 4
- VMOVN dXi1lo, qSrc4lo ;// Output i1
- VMOVN dXi1hi, qSrc4hi
-
- MEND
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_MaskTable.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_MaskTable.h
deleted file mode 100644
index 5246f15..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_MaskTable.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armCOMM_MaskTable.h
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Mask Table to mask the end of array
- */
-
-
-
-#ifndef _ARMCOMM_MASKTABLE_H_
-#define _ARMCOMM_MASKTABLE_H_
-
-#define MaskTableSize 72
-
-/* Mask table */
-
-extern const OMX_U16 armCOMM_qMaskTable16[MaskTableSize];
-extern const OMX_U8 armCOMM_qMaskTable8[MaskTableSize];
-
-#endif
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_Version.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_Version.h
deleted file mode 100644
index 13e5b2b..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_Version.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Guard the header against multiple inclusion. */
-#ifndef __ARM_COMM_VERSION_H__
-#define __ARM_COMM_VERSION_H__
-
-
-/* The following line should be in omxtypes.h but hasn't been approved by OpenMAX yet */
-#define OMX_VERSION 102
-
-/* We need to define these macros in order to convert a #define number into a #define string. */
-#define ARM_QUOTE(a) #a
-#define ARM_INDIRECT(A) ARM_QUOTE(A)
-
-/* Convert the OMX_VERSION number into a string that can be used, for example, to print it out. */
-#define ARM_VERSION_STRING ARM_INDIRECT(OMX_VERSION)
-
-
-/* Define this in order to turn on ARM version/release/build strings in each domain */
-#define ARM_INCLUDE_VERSION_DESCRIPTIONS
-
-#ifdef ARM_INCLUDE_VERSION_DESCRIPTIONS
- extern const char * const omxAC_VersionDescription;
- extern const char * const omxIC_VersionDescription;
- extern const char * const omxIP_VersionDescription;
- extern const char * const omxSP_VersionDescription;
- extern const char * const omxVC_VersionDescription;
-#endif /* ARM_INCLUDE_VERSION_DESCRIPTIONS */
-
-
-/* The following entries should be automatically updated by the release script */
-/* They are used in the ARM version strings defined for each domain. */
-
-/* The release tag associated with this release of the library. - used for source and object releases */
-#define OMX_ARM_RELEASE_TAG "r0p0-00bet1"
-
-/* The ARM architecture used to build any objects or executables in this release. */
-#define OMX_ARM_BUILD_ARCHITECTURE "ARM Architecture V6"
-
-/* The ARM Toolchain used to build any objects or executables in this release. */
-#define OMX_ARM_BUILD_TOOLCHAIN "ARM RVCT 3.1"
-
-
-#endif /* __ARM_COMM_VERSION_H__ */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_s.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_s.h
deleted file mode 100644
index 04735a9..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armCOMM_s.h
+++ /dev/null
@@ -1,1168 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armCOMM_s.h
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-;// ARM optimized OpenMAX common header file
-;//
-
-;// Protect against multiple inclusion
- IF :LNOT::DEF:ARMCOMM_S_H
- GBLL ARMCOMM_S_H
-
- REQUIRE8 ;// Requires 8-byte stack alignment
- PRESERVE8 ;// Preserves 8-byte stack alignment
-
- GBLL ARM_ERRORCHECK
-ARM_ERRORCHECK SETL {FALSE}
-
-;// Globals
-
- GBLS _RRegList ;// R saved register list
- GBLS _DRegList ;// D saved register list
- GBLS _Variant ;// Selected processor variant
- GBLS _CPU ;// CPU name
- GBLS _Struct ;// Structure name
-
- GBLL _InFunc ;// Inside function assembly flag
- GBLL _SwLong ;// Long switch flag
-
- GBLA _RBytes ;// Number of register bytes on stack
- GBLA _SBytes ;// Number of scratch bytes on stack
- GBLA _ABytes ;// Stack offset of next argument
- GBLA _Workspace ;// Stack offset of scratch workspace
- GBLA _F ;// Function number
- GBLA _StOff ;// Struct offset
- GBLA _SwNum ;// Switch number
- GBLS _32 ;// Suffix for 32 byte alignmnet
- GBLS _16 ;// Suffix for 16 byte alignmnet
-
-_InFunc SETL {FALSE}
-_SBytes SETA 0
-_F SETA 0
-_SwNum SETA 0
-_32 SETS "ALIGN32"
-_16 SETS "ALIGN16"
-
-;/////////////////////////////////////////////////////////
-;// Override the tools settings of the CPU if the #define
-;// USECPU is set, otherwise use the CPU defined by the
-;// assembler settings.
-;/////////////////////////////////////////////////////////
-
- IF :DEF: OVERRIDECPU
-_CPU SETS OVERRIDECPU
- ELSE
-_CPU SETS {CPU}
- ENDIF
-
-
-
-;/////////////////////////////////////////////////////////
-;// Work out which code to build
-;/////////////////////////////////////////////////////////
-
- IF :DEF:ARM1136JS:LOR::DEF:CortexA8:LOR::DEF:ARM_GENERIC
- INFO 1,"Please switch to using M_VARIANTS"
- ENDIF
-
- ;// Define and reset all officially recongnised variants
- MACRO
- _M_DEF_VARIANTS
- _M_DEF_VARIANT ARM926EJS
- _M_DEF_VARIANT ARM1136JS
- _M_DEF_VARIANT ARM1136JS_U
- _M_DEF_VARIANT CortexA8
- _M_DEF_VARIANT ARM7TDMI
- MEND
-
- MACRO
- _M_DEF_VARIANT $var
- GBLL $var
- GBLL _ok$var
-$var SETL {FALSE}
- MEND
-
-
- ;// Variant declaration
- ;//
- ;// Define a list of code variants supported by this
- ;// source file. This macro then chooses the most
- ;// appropriate variant to build for the currently configured
- ;// core.
- ;//
- MACRO
- M_VARIANTS $v0,$v1,$v2,$v3,$v4,$v5,$v6,$v7
- ;// Set to TRUE variants that are supported
- _M_DEF_VARIANTS
- _M_VARIANT $v0
- _M_VARIANT $v1
- _M_VARIANT $v2
- _M_VARIANT $v3
- _M_VARIANT $v4
- _M_VARIANT $v5
- _M_VARIANT $v6
- _M_VARIANT $v7
-
- ;// Look for first available variant to match a CPU
- ;// _M_TRY cpu, variant fall back list
-_Variant SETS ""
- _M_TRY ARM926EJ-S, ARM926EJS
- _M_TRY ARM1176JZ-S, ARM1136JS
- _M_TRY ARM1176JZF-S, ARM1136JS
- _M_TRY ARM1156T2-S, ARM1136JS
- _M_TRY ARM1156T2F-S, ARM1136JS
- _M_TRY ARM1136J-S, ARM1136JS
- _M_TRY ARM1136JF-S, ARM1136JS
- _M_TRY MPCore, ARM1136JS
- _M_TRY Cortex-A8, CortexA8, ARM1136JS
- _M_TRY Cortex-R4, ARM1136JS
- _M_TRY ARM7TDMI
-
- ;// Select the correct variant
- _M_DEF_VARIANTS
- IF _Variant=""
- INFO 1, "No match found for CPU '$_CPU'"
- ELSE
-$_Variant SETL {TRUE}
- ENDIF
- MEND
-
- ;// Register a variant as available
- MACRO
- _M_VARIANT $var
- IF "$var"=""
- MEXIT
- ENDIF
- IF :LNOT::DEF:_ok$var
- INFO 1, "Unrecognized variant '$var'"
- ENDIF
-$var SETL {TRUE}
- MEND
-
- ;// For a given CPU, see if any of the variants supporting
- ;// this CPU are available. The first available variant is
- ;// chosen
- MACRO
- _M_TRY $cpu, $v0,$v1,$v2,$v3,$v4,$v5,$v6,$v7
- IF "$cpu"<>_CPU
- MEXIT
- ENDIF
- _M_TRY1 $v0
- _M_TRY1 $v1
- _M_TRY1 $v2
- _M_TRY1 $v3
- _M_TRY1 $v4
- _M_TRY1 $v5
- _M_TRY1 $v6
- _M_TRY1 $v7
- ;// Check a match was found
- IF _Variant=""
- INFO 1, "No variant match found for CPU '$_CPU'"
- ENDIF
- MEND
-
- MACRO
- _M_TRY1 $var
- IF "$var"=""
- MEXIT
- ENDIF
- IF (_Variant=""):LAND:$var
-_Variant SETS "$var"
- ENDIF
- MEND
-
-;////////////////////////////////////////////////////////
-;// Structure definition
-;////////////////////////////////////////////////////////
-
- ;// Declare a structure of given name
- MACRO
- M_STRUCT $sname
-_Struct SETS "$sname"
-_StOff SETA 0
- MEND
-
- ;// Declare a structure field
- ;// The field is called $sname_$fname
- ;// $size = the size of each entry, must be power of 2
- ;// $number = (if provided) the number of entries for an array
- MACRO
- M_FIELD $fname, $size, $number
- IF (_StOff:AND:($size-1))!=0
-_StOff SETA _StOff + ($size - (_StOff:AND:($size-1)))
- ENDIF
-$_Struct._$fname EQU _StOff
- IF "$number"<>""
-_StOff SETA _StOff + $size*$number
- ELSE
-_StOff SETA _StOff + $size
- ENDIF
- MEND
-
-
- MACRO
- M_ENDSTRUCT
-sizeof_$_Struct EQU _StOff
-_Struct SETS ""
- MEND
-
-;//////////////////////////////////////////////////////////
-;// Switch and table macros
-;//////////////////////////////////////////////////////////
-
- ;// Start a relative switch table with register to switch on
- ;//
- ;// $v = the register to switch on
- ;// $s = if specified must be "L" to indicate long
- ;// this allows a greater range to the case code
- MACRO
- M_SWITCH $v, $s
- ASSERT "$s"="":LOR:"$s"="L"
-_SwLong SETL {FALSE}
- IF "$s"="L"
-_SwLong SETL {TRUE}
- ENDIF
-_SwNum SETA _SwNum+1
- IF {CONFIG}=16
- ;// Thumb
- IF _SwLong
- TBH [pc, $v, LSL#1]
- ELSE
- TBB [pc, $v]
- ENDIF
-_Switch$_SwNum
- ELSE
- ;// ARM
- ADD pc, pc, $v, LSL #2
- NOP
- ENDIF
- MEND
-
- ;// Add a case to the switch statement
- MACRO
- M_CASE $label
- IF {CONFIG}=16
- ;// Thumb
- IF _SwLong
- DCW ($label - _Switch$_SwNum)/2
- ELSE
- DCB ($label - _Switch$_SwNum)/2
- ENDIF
- ELSE
- ;// ARM
- B $label
- ENDIF
- MEND
-
- ;// End of switch statement
- MACRO
- M_ENDSWITCH
- ALIGN 2
- MEND
-
-
-;////////////////////////////////////////////////////////
-;// Data area allocation
-;////////////////////////////////////////////////////////
-
- ;// Constant table allocator macro
- ;//
- ;// Creates a new section for each constant table
- ;// $name is symbol through which the table can be accessed.
- ;// $align is the optional alignment of the table, log2 of
- ;// the byte alignment - $align=4 is 16 byte aligned
- MACRO
- M_TABLE $name, $align
- ASSERT :LNOT:_InFunc
- IF "$align"=""
- AREA |.constdata|, READONLY, DATA
- ELSE
- ;// AREAs inherit the alignment of the first declaration.
- ;// Therefore for each alignment size we must have an area
- ;// of a different name.
- AREA constdata_a$align, READONLY, DATA, ALIGN=$align
-
- ;// We also force alignment incase we are tagging onto
- ;// an already started area.
- ALIGN (1<<$align)
- ENDIF
-$name
- MEND
-
-;/////////////////////////////////////////////////////
-;// Macros to allocate space on the stack
-;//
-;// These all assume that the stack is 8-byte aligned
-;// at entry to the function, which means that the
-;// 32-byte alignment macro needs to work in a
-;// bit more of a special way...
-;/////////////////////////////////////////////////////
-
-
-
-
- ;// Allocate 1-byte aligned area of name
- ;// $name size $size bytes.
- MACRO
- M_ALLOC1 $name, $size
- ASSERT :LNOT:_InFunc
-$name$_F EQU _SBytes
-_SBytes SETA _SBytes + ($size)
- MEND
-
- ;// Allocate 2-byte aligned area of name
- ;// $name size $size bytes.
- MACRO
- M_ALLOC2 $name, $size
- ASSERT :LNOT:_InFunc
- IF (_SBytes:AND:1)!=0
-_SBytes SETA _SBytes + (2 - (_SBytes:AND:1))
- ENDIF
-$name$_F EQU _SBytes
-_SBytes SETA _SBytes + ($size)
- MEND
-
- ;// Allocate 4-byte aligned area of name
- ;// $name size $size bytes.
- MACRO
- M_ALLOC4 $name, $size
- ASSERT :LNOT:_InFunc
- IF (_SBytes:AND:3)!=0
-_SBytes SETA _SBytes + (4 - (_SBytes:AND:3))
- ENDIF
-$name$_F EQU _SBytes
-_SBytes SETA _SBytes + ($size)
- MEND
-
- ;// Allocate 8-byte aligned area of name
- ;// $name size $size bytes.
- MACRO
- M_ALLOC8 $name, $size
- ASSERT :LNOT:_InFunc
- IF (_SBytes:AND:7)!=0
-_SBytes SETA _SBytes + (8 - (_SBytes:AND:7))
- ENDIF
-$name$_F EQU _SBytes
-_SBytes SETA _SBytes + ($size)
- MEND
-
-
- ;// Allocate 8-byte aligned area of name
- ;// $name size ($size+16) bytes.
- ;// The extra 16 bytes are later used to align the pointer to 16 bytes
-
- MACRO
- M_ALLOC16 $name, $size
- ASSERT :LNOT:_InFunc
- IF (_SBytes:AND:7)!=0
-_SBytes SETA _SBytes + (8 - (_SBytes:AND:7))
- ENDIF
-$name$_F$_16 EQU (_SBytes + 8)
-_SBytes SETA _SBytes + ($size) + 8
- MEND
-
- ;// Allocate 8-byte aligned area of name
- ;// $name size ($size+32) bytes.
- ;// The extra 32 bytes are later used to align the pointer to 32 bytes
-
- MACRO
- M_ALLOC32 $name, $size
- ASSERT :LNOT:_InFunc
- IF (_SBytes:AND:7)!=0
-_SBytes SETA _SBytes + (8 - (_SBytes:AND:7))
- ENDIF
-$name$_F$_32 EQU (_SBytes + 24)
-_SBytes SETA _SBytes + ($size) + 24
- MEND
-
-
-
-
- ;// Argument Declaration Macro
- ;//
- ;// Allocate an argument name $name
- ;// size $size bytes
- MACRO
- M_ARG $name, $size
- ASSERT _InFunc
-$name$_F EQU _ABytes
-_ABytes SETA _ABytes + ($size)
- MEND
-
-;///////////////////////////////////////////////
-;// Macros to access stacked variables
-;///////////////////////////////////////////////
-
- ;// Macro to perform a data processing operation
- ;// with a constant second operand
- MACRO
- _M_OPC $op,$rd,$rn,$const
- LCLA _sh
- LCLA _cst
-_sh SETA 0
-_cst SETA $const
- IF _cst=0
- $op $rd, $rn, #_cst
- MEXIT
- ENDIF
- WHILE (_cst:AND:3)=0
-_cst SETA _cst>>2
-_sh SETA _sh+2
- WEND
- $op $rd, $rn, #(_cst:AND:0x000000FF)<<_sh
- IF _cst>=256
- $op $rd, $rd, #(_cst:AND:0xFFFFFF00)<<_sh
- ENDIF
- MEND
-
- ;// Macro to perform a data access operation
- ;// Such as LDR or STR
- ;// The addressing mode is modified such that
- ;// 1. If no address is given then the name is taken
- ;// as a stack offset
- ;// 2. If the addressing mode is not available for the
- ;// state being assembled for (eg Thumb) then a suitable
- ;// addressing mode is substituted.
- ;//
- ;// On Entry:
- ;// $i = Instruction to perform (eg "LDRB")
- ;// $a = Required byte alignment
- ;// $r = Register(s) to transfer (eg "r1")
- ;// $a0,$a1,$a2. Addressing mode and condition. One of:
- ;// label {,cc}
- ;// [base] {,,,cc}
- ;// [base, offset]{!} {,,cc}
- ;// [base, offset, shift]{!} {,cc}
- ;// [base], offset {,,cc}
- ;// [base], offset, shift {,cc}
- MACRO
- _M_DATA $i,$a,$r,$a0,$a1,$a2,$a3
- IF "$a0":LEFT:1="["
- IF "$a1"=""
- $i$a3 $r, $a0
- ELSE
- IF "$a0":RIGHT:1="]"
- IF "$a2"=""
- _M_POSTIND $i$a3, "$r", $a0, $a1
- ELSE
- _M_POSTIND $i$a3, "$r", $a0, "$a1,$a2"
- ENDIF
- ELSE
- IF "$a2"=""
- _M_PREIND $i$a3, "$r", $a0, $a1
- ELSE
- _M_PREIND $i$a3, "$r", $a0, "$a1,$a2"
- ENDIF
- ENDIF
- ENDIF
- ELSE
- LCLA _Offset
-_Offset SETA _Workspace + $a0$_F
- ASSERT (_Offset:AND:($a-1))=0
- $i$a1 $r, [sp, #_Offset]
- ENDIF
- MEND
-
- ;// Handle post indexed load/stores
- ;// op reg, [base], offset
- MACRO
- _M_POSTIND $i,$r,$a0,$a1
- LCLS _base
- LCLS _offset
- IF {CONFIG}=16 ;// Thumb
-_base SETS ("$a0":LEFT:(:LEN:"$a0"-1)):RIGHT:(:LEN:"$a0"-2) ;// remove []
-_offset SETS "$a1"
- IF _offset:LEFT:1="+"
-_offset SETS _offset:RIGHT:(:LEN:_offset-1)
- ENDIF
- $i $r, $a0
- IF _offset:LEFT:1="-"
-_offset SETS _offset:RIGHT:(:LEN:_offset-1)
- SUB $_base, $_base, $_offset
- ELSE
- ADD $_base, $_base, $_offset
- ENDIF
- ELSE ;// ARM
- $i $r, $a0, $a1
- ENDIF
- MEND
-
- ;// Handle pre indexed load/store
- ;// op reg, [base, offset]{!}
- MACRO
- _M_PREIND $i,$r,$a0,$a1
- LCLS _base
- LCLS _offset
- IF ({CONFIG}=16):LAND:(("$a1":RIGHT:2)="]!")
-_base SETS "$a0":RIGHT:(:LEN:("$a0")-1)
-_offset SETS "$a1":LEFT:(:LEN:("$a1")-2)
- $i $r, [$_base, $_offset]
- ADD $_base, $_base, $_offset
- ELSE
- $i $r, $a0, $a1
- ENDIF
- MEND
-
- ;// Load unsigned byte from stack
- MACRO
- M_LDRB $r,$a0,$a1,$a2,$a3
- _M_DATA "LDRB",1,$r,$a0,$a1,$a2,$a3
- MEND
-
- ;// Load signed byte from stack
- MACRO
- M_LDRSB $r,$a0,$a1,$a2,$a3
- _M_DATA "LDRSB",1,$r,$a0,$a1,$a2,$a3
- MEND
-
- ;// Store byte to stack
- MACRO
- M_STRB $r,$a0,$a1,$a2,$a3
- _M_DATA "STRB",1,$r,$a0,$a1,$a2,$a3
- MEND
-
- ;// Load unsigned half word from stack
- MACRO
- M_LDRH $r,$a0,$a1,$a2,$a3
- _M_DATA "LDRH",2,$r,$a0,$a1,$a2,$a3
- MEND
-
- ;// Load signed half word from stack
- MACRO
- M_LDRSH $r,$a0,$a1,$a2,$a3
- _M_DATA "LDRSH",2,$r,$a0,$a1,$a2,$a3
- MEND
-
- ;// Store half word to stack
- MACRO
- M_STRH $r,$a0,$a1,$a2,$a3
- _M_DATA "STRH",2,$r,$a0,$a1,$a2,$a3
- MEND
-
- ;// Load word from stack
- MACRO
- M_LDR $r,$a0,$a1,$a2,$a3
- _M_DATA "LDR",4,$r,$a0,$a1,$a2,$a3
- MEND
-
- ;// Store word to stack
- MACRO
- M_STR $r,$a0,$a1,$a2,$a3
- _M_DATA "STR",4,$r,$a0,$a1,$a2,$a3
- MEND
-
- ;// Load double word from stack
- MACRO
- M_LDRD $r0,$r1,$a0,$a1,$a2,$a3
- _M_DATA "LDRD",8,"$r0,$r1",$a0,$a1,$a2,$a3
- MEND
-
- ;// Store double word to stack
- MACRO
- M_STRD $r0,$r1,$a0,$a1,$a2,$a3
- _M_DATA "STRD",8,"$r0,$r1",$a0,$a1,$a2,$a3
- MEND
-
- ;// Get absolute address of stack allocated location
- MACRO
- M_ADR $a, $b, $cc
- _M_OPC ADD$cc, $a, sp, (_Workspace + $b$_F)
- MEND
-
- ;// Get absolute address of stack allocated location and align the address to 16 bytes
- MACRO
- M_ADR16 $a, $b, $cc
- _M_OPC ADD$cc, $a, sp, (_Workspace + $b$_F$_16)
-
- ;// Now align $a to 16 bytes
- BIC$cc $a,$a,#0x0F
- MEND
-
- ;// Get absolute address of stack allocated location and align the address to 32 bytes
- MACRO
- M_ADR32 $a, $b, $cc
- _M_OPC ADD$cc, $a, sp, (_Workspace + $b$_F$_32)
-
- ;// Now align $a to 32 bytes
- BIC$cc $a,$a,#0x1F
- MEND
-
-;//////////////////////////////////////////////////////////
-;// Function header and footer macros
-;//////////////////////////////////////////////////////////
-
- ;// Function Header Macro
- ;// Generates the function prologue
- ;// Note that functions should all be "stack-moves-once"
- ;// The FNSTART and FNEND macros should be the only places
- ;// where the stack moves.
- ;//
- ;// $name = function name
- ;// $rreg = "" don't stack any registers
- ;// "lr" stack "lr" only
- ;// "rN" stack registers "r4-rN,lr"
- ;// $dreg = "" don't stack any D registers
- ;// "dN" stack registers "d8-dN"
- ;//
- ;// Note: ARM Archicture procedure call standard AAPCS
- ;// states that r4-r11, sp, d8-d15 must be preserved by
- ;// a compliant function.
- MACRO
- M_START $name, $rreg, $dreg
- ASSERT :LNOT:_InFunc
- ASSERT "$name"!=""
-_InFunc SETL {TRUE}
-_RBytes SETA 0
-_Workspace SETA 0
-
- ;// Create an area for the function
- AREA |.text|, CODE
- EXPORT $name
-$name FUNCTION
-
- ;// Save R registers
- _M_GETRREGLIST $rreg
- IF _RRegList<>""
- STMFD sp!, {$_RRegList, lr}
- ENDIF
-
- ;// Save D registers
- _M_GETDREGLIST $dreg
- IF _DRegList<>""
- VSTMFD sp!, {$_DRegList}
- ENDIF
-
-
- ;// Ensure size claimed on stack is 8-byte aligned
- IF ((_SBytes:AND:7)!=0)
-_SBytes SETA _SBytes + (8 - (_SBytes:AND:7))
- ENDIF
-
- IF (_SBytes!=0)
- _M_OPC SUB, sp, sp, _SBytes
- ENDIF
-
-
-_ABytes SETA _SBytes + _RBytes - _Workspace
-
-
- ;// Print function name if debug enabled
- M_PRINTF "$name\n",
- MEND
-
- ;// Work out a list of R saved registers
- MACRO
- _M_GETRREGLIST $rreg
- IF "$rreg"=""
-_RRegList SETS ""
- MEXIT
- ENDIF
- IF "$rreg"="lr":LOR:"$rreg"="r4"
-_RRegList SETS "r4"
-_RBytes SETA _RBytes+8
- MEXIT
- ENDIF
- IF "$rreg"="r5":LOR:"$rreg"="r6"
-_RRegList SETS "r4-r6"
-_RBytes SETA _RBytes+16
- MEXIT
- ENDIF
- IF "$rreg"="r7":LOR:"$rreg"="r8"
-_RRegList SETS "r4-r8"
-_RBytes SETA _RBytes+24
- MEXIT
- ENDIF
- IF "$rreg"="r9":LOR:"$rreg"="r10"
-_RRegList SETS "r4-r10"
-_RBytes SETA _RBytes+32
- MEXIT
- ENDIF
- IF "$rreg"="r11":LOR:"$rreg"="r12"
-_RRegList SETS "r4-r12"
-_RBytes SETA _RBytes+40
- MEXIT
- ENDIF
- INFO 1, "Unrecognized saved r register limit '$rreg'"
- MEND
-
- ;// Work out a list of D saved registers
- MACRO
- _M_GETDREGLIST $dreg
- IF "$dreg"=""
-_DRegList SETS ""
- MEXIT
- ENDIF
- IF "$dreg"="d8"
-_DRegList SETS "d8"
-_RBytes SETA _RBytes+8
- MEXIT
- ENDIF
- IF "$dreg"="d9"
-_DRegList SETS "d8-d9"
-_RBytes SETA _RBytes+16
- MEXIT
- ENDIF
- IF "$dreg"="d10"
-_DRegList SETS "d8-d10"
-_RBytes SETA _RBytes+24
- MEXIT
- ENDIF
- IF "$dreg"="d11"
-_DRegList SETS "d8-d11"
-_RBytes SETA _RBytes+32
- MEXIT
- ENDIF
- IF "$dreg"="d12"
-_DRegList SETS "d8-d12"
-_RBytes SETA _RBytes+40
- MEXIT
- ENDIF
- IF "$dreg"="d13"
-_DRegList SETS "d8-d13"
-_RBytes SETA _RBytes+48
- MEXIT
- ENDIF
- IF "$dreg"="d14"
-_DRegList SETS "d8-d14"
-_RBytes SETA _RBytes+56
- MEXIT
- ENDIF
- IF "$dreg"="d15"
-_DRegList SETS "d8-d15"
-_RBytes SETA _RBytes+64
- MEXIT
- ENDIF
- INFO 1, "Unrecognized saved d register limit '$dreg'"
- MEND
-
- ;// Produce function return instructions
- MACRO
- _M_RET $cc
- IF _DRegList<>""
- VPOP$cc {$_DRegList}
- ENDIF
- IF _RRegList=""
- BX$cc lr
- ELSE
- LDM$cc.FD sp!, {$_RRegList, pc}
- ENDIF
- MEND
-
- ;// Early Function Exit Macro
- ;// $cc = condition to exit with
- ;// (Example: M_EXIT EQ)
- MACRO
- M_EXIT $cc
- ASSERT _InFunc
- IF _SBytes!=0
- ;// Restore stack frame and exit
- B$cc _End$_F
- ELSE
- ;// Can return directly
- _M_RET $cc
- ENDIF
- MEND
-
- ;// Function Footer Macro
- ;// Generates the function epilogue
- MACRO
- M_END
- ASSERT _InFunc
-_InFunc SETL {FALSE}
-_End$_F
-
- ;// Restore the stack pointer to its original value on function entry
- IF _SBytes!=0
- _M_OPC ADD, sp, sp, _SBytes
- ENDIF
- _M_RET
- ENDFUNC
-
- ;// Reset the global stack tracking variables back to their
- ;// initial values, and increment the function count
-_SBytes SETA 0
-_F SETA _F+1
- MEND
-
-
-;//==========================================================================
-;// Debug Macros
-;//==========================================================================
-
- GBLL DEBUG_ON
-DEBUG_ON SETL {FALSE}
- GBLL DEBUG_STALLS_ON
-DEBUG_STALLS_ON SETL {FALSE}
-
- ;//==========================================================================
- ;// Debug call to printf
- ;// M_PRINTF $format, $val0, $val1, $val2
- ;//
- ;// Examples:
- ;// M_PRINTF "x=%08x\n", r0
- ;//
- ;// This macro preserves the value of all registers including the
- ;// flags.
- ;//==========================================================================
-
- MACRO
- M_PRINTF $format, $val0, $val1, $val2
- IF DEBUG_ON
-
- IMPORT printf
- LCLA nArgs
-nArgs SETA 0
-
- ;// save registers so we don't corrupt them
- STMFD sp!, {r0-r12, lr}
-
- ;// Drop stack to give us some workspace
- SUB sp, sp, #16
-
- ;// Save registers we need to print to the stack
- IF "$val2" <> ""
- ASSERT "$val1" <> ""
- STR $val2, [sp, #8]
-nArgs SETA nArgs+1
- ENDIF
- IF "$val1" <> ""
- ASSERT "$val0" <> ""
- STR $val1, [sp, #4]
-nArgs SETA nArgs+1
- ENDIF
- IF "$val0"<>""
- STR $val0, [sp]
-nArgs SETA nArgs+1
- ENDIF
-
- ;// Now we are safe to corrupt registers
- ADR r0, %FT00
- IF nArgs=1
- LDR r1, [sp]
- ENDIF
- IF nArgs=2
- LDMIA sp, {r1,r2}
- ENDIF
- IF nArgs=3
- LDMIA sp, {r1,r2,r3}
- ENDIF
-
- ;// print the values
- MRS r4, cpsr ;// preserve flags
- BL printf
- MSR cpsr_f, r4 ;// restore flags
- B %FT01
-00 ;// string to print
- DCB "$format", 0
- ALIGN
-01 ;// Finished
- ADD sp, sp, #16
- ;// Restore registers
- LDMFD sp!, {r0-r12,lr}
-
- ENDIF ;// DEBUG_ON
- MEND
-
-
- ;// Stall Simulation Macro
- ;// Inserts a given number of NOPs for the currently
- ;// defined platform
- MACRO
- M_STALL $plat1stall, $plat2stall, $plat3stall, $plat4stall, $plat5stall, $plat6stall
- IF DEBUG_STALLS_ON
- _M_STALL_SUB $plat1stall
- _M_STALL_SUB $plat2stall
- _M_STALL_SUB $plat3stall
- _M_STALL_SUB $plat4stall
- _M_STALL_SUB $plat5stall
- _M_STALL_SUB $plat6stall
- ENDIF
- MEND
-
- MACRO
- _M_STALL_SUB $platstall
- IF "$platstall"!=""
- LCLA _pllen
- LCLS _pl
- LCLL _pllog
-_pllen SETA :LEN:"$platstall"
-_pl SETS "$platstall":LEFT:(_pllen - 2)
- IF :DEF:$_pl
- IF $_pl
- LCLS _st
- LCLA _stnum
-_st SETS "$platstall":RIGHT:1
-_stnum SETA $_st
- WHILE _stnum>0
- MOV sp, sp
-_stnum SETA _stnum - 1
- WEND
- ENDIF
- ENDIF
- ENDIF
- MEND
-
-
-
-;//==========================================================================
-;// Endian Invarience Macros
-;//
-;// The idea behind these macros is that if an array is
-;// loaded as words then the SMUL00 macro will multiply
-;// array elements 0 regardless of the endianess of the
-;// system. For little endian SMUL00=SMULBB, for big
-;// endian SMUL00=SMULTT and similarly for other packed operations.
-;//
-;//==========================================================================
-
- MACRO
- LIBI4 $comli, $combi, $a, $b, $c, $d, $cc
- IF {ENDIAN}="big"
- $combi.$cc $a, $b, $c, $d
- ELSE
- $comli.$cc $a, $b, $c, $d
- ENDIF
- MEND
-
- MACRO
- LIBI3 $comli, $combi, $a, $b, $c, $cc
- IF {ENDIAN}="big"
- $combi.$cc $a, $b, $c
- ELSE
- $comli.$cc $a, $b, $c
- ENDIF
- MEND
-
- ;// SMLAxy macros
-
- MACRO
- SMLA00 $a, $b, $c, $d, $cc
- LIBI4 SMLABB, SMLATT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLA01 $a, $b, $c, $d, $cc
- LIBI4 SMLABT, SMLATB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLA0B $a, $b, $c, $d, $cc
- LIBI4 SMLABB, SMLATB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLA0T $a, $b, $c, $d, $cc
- LIBI4 SMLABT, SMLATT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLA10 $a, $b, $c, $d, $cc
- LIBI4 SMLATB, SMLABT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLA11 $a, $b, $c, $d, $cc
- LIBI4 SMLATT, SMLABB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLA1B $a, $b, $c, $d, $cc
- LIBI4 SMLATB, SMLABB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLA1T $a, $b, $c, $d, $cc
- LIBI4 SMLATT, SMLABT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAB0 $a, $b, $c, $d, $cc
- LIBI4 SMLABB, SMLABT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAB1 $a, $b, $c, $d, $cc
- LIBI4 SMLABT, SMLABB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAT0 $a, $b, $c, $d, $cc
- LIBI4 SMLATB, SMLATT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAT1 $a, $b, $c, $d, $cc
- LIBI4 SMLATT, SMLATB, $a, $b, $c, $d, $cc
- MEND
-
- ;// SMULxy macros
-
- MACRO
- SMUL00 $a, $b, $c, $cc
- LIBI3 SMULBB, SMULTT, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMUL01 $a, $b, $c, $cc
- LIBI3 SMULBT, SMULTB, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMUL0B $a, $b, $c, $cc
- LIBI3 SMULBB, SMULTB, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMUL0T $a, $b, $c, $cc
- LIBI3 SMULBT, SMULTT, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMUL10 $a, $b, $c, $cc
- LIBI3 SMULTB, SMULBT, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMUL11 $a, $b, $c, $cc
- LIBI3 SMULTT, SMULBB, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMUL1B $a, $b, $c, $cc
- LIBI3 SMULTB, SMULBB, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMUL1T $a, $b, $c, $cc
- LIBI3 SMULTT, SMULBT, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMULB0 $a, $b, $c, $cc
- LIBI3 SMULBB, SMULBT, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMULB1 $a, $b, $c, $cc
- LIBI3 SMULBT, SMULBB, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMULT0 $a, $b, $c, $cc
- LIBI3 SMULTB, SMULTT, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMULT1 $a, $b, $c, $cc
- LIBI3 SMULTT, SMULTB, $a, $b, $c, $cc
- MEND
-
- ;// SMLAWx, SMULWx macros
-
- MACRO
- SMLAW0 $a, $b, $c, $d, $cc
- LIBI4 SMLAWB, SMLAWT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAW1 $a, $b, $c, $d, $cc
- LIBI4 SMLAWT, SMLAWB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMULW0 $a, $b, $c, $cc
- LIBI3 SMULWB, SMULWT, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMULW1 $a, $b, $c, $cc
- LIBI3 SMULWT, SMULWB, $a, $b, $c, $cc
- MEND
-
- ;// SMLALxy macros
-
-
- MACRO
- SMLAL00 $a, $b, $c, $d, $cc
- LIBI4 SMLALBB, SMLALTT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAL01 $a, $b, $c, $d, $cc
- LIBI4 SMLALBT, SMLALTB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAL0B $a, $b, $c, $d, $cc
- LIBI4 SMLALBB, SMLALTB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAL0T $a, $b, $c, $d, $cc
- LIBI4 SMLALBT, SMLALTT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAL10 $a, $b, $c, $d, $cc
- LIBI4 SMLALTB, SMLALBT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAL11 $a, $b, $c, $d, $cc
- LIBI4 SMLALTT, SMLALBB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAL1B $a, $b, $c, $d, $cc
- LIBI4 SMLALTB, SMLALBB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAL1T $a, $b, $c, $d, $cc
- LIBI4 SMLALTT, SMLALBT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLALB0 $a, $b, $c, $d, $cc
- LIBI4 SMLALBB, SMLALBT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLALB1 $a, $b, $c, $d, $cc
- LIBI4 SMLALBT, SMLALBB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLALT0 $a, $b, $c, $d, $cc
- LIBI4 SMLALTB, SMLALTT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLALT1 $a, $b, $c, $d, $cc
- LIBI4 SMLALTT, SMLALTB, $a, $b, $c, $d, $cc
- MEND
-
- ENDIF ;// ARMCOMM_S_H
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armOMX.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armOMX.h
deleted file mode 100644
index e7c0c26..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/armOMX.h
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- * File Name: armOMX_ReleaseVersion.h
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * This file allows a version of the OMX DL libraries to be built where some or
- * all of the function names can be given a user specified suffix.
- *
- * You might want to use it where:
- *
- * - you want to rename a function "out of the way" so that you could replace
- * a function with a different version (the original version would still be
- * in the library just with a different name - so you could debug the new
- * version by comparing it to the output of the old)
- *
- * - you want to rename all the functions to versions with a suffix so that
- * you can include two versions of the library and choose between functions
- * at runtime.
- *
- * e.g. omxIPBM_Copy_U8_C1R could be renamed omxIPBM_Copy_U8_C1R_CortexA8
- *
- */
-
-
-#ifndef _armOMX_H_
-#define _armOMX_H_
-
-
-/* We need to define these two macros in order to expand and concatenate the names */
-#define OMXCAT2BAR(A, B) omx ## A ## B
-#define OMXCATBAR(A, B) OMXCAT2BAR(A, B)
-
-/* Define the suffix to add to all functions - the default is no suffix */
-#define BARE_SUFFIX
-
-
-
-/* Define what happens to the bare suffix-less functions, down to the sub-domain accuracy */
-#define OMXACAAC_SUFFIX BARE_SUFFIX
-#define OMXACMP3_SUFFIX BARE_SUFFIX
-#define OMXICJP_SUFFIX BARE_SUFFIX
-#define OMXIPBM_SUFFIX BARE_SUFFIX
-#define OMXIPCS_SUFFIX BARE_SUFFIX
-#define OMXIPPP_SUFFIX BARE_SUFFIX
-#define OMXSP_SUFFIX BARE_SUFFIX
-#define OMXVCCOMM_SUFFIX BARE_SUFFIX
-#define OMXVCM4P10_SUFFIX BARE_SUFFIX
-#define OMXVCM4P2_SUFFIX BARE_SUFFIX
-
-
-
-
-/* Define what the each bare, un-suffixed OpenMAX API function names is to be renamed */
-#define omxACAAC_DecodeChanPairElt OMXCATBAR(ACAAC_DecodeChanPairElt, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodeDatStrElt OMXCATBAR(ACAAC_DecodeDatStrElt, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodeFillElt OMXCATBAR(ACAAC_DecodeFillElt, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodeIsStereo_S32 OMXCATBAR(ACAAC_DecodeIsStereo_S32, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodeMsPNS_S32_I OMXCATBAR(ACAAC_DecodeMsPNS_S32_I, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodeMsStereo_S32_I OMXCATBAR(ACAAC_DecodeMsStereo_S32_I, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodePrgCfgElt OMXCATBAR(ACAAC_DecodePrgCfgElt, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodeTNS_S32_I OMXCATBAR(ACAAC_DecodeTNS_S32_I, OMXACAAC_SUFFIX)
-#define omxACAAC_DeinterleaveSpectrum_S32 OMXCATBAR(ACAAC_DeinterleaveSpectrum_S32, OMXACAAC_SUFFIX)
-#define omxACAAC_EncodeTNS_S32_I OMXCATBAR(ACAAC_EncodeTNS_S32_I, OMXACAAC_SUFFIX)
-#define omxACAAC_LongTermPredict_S32 OMXCATBAR(ACAAC_LongTermPredict_S32, OMXACAAC_SUFFIX)
-#define omxACAAC_LongTermReconstruct_S32_I OMXCATBAR(ACAAC_LongTermReconstruct_S32_I, OMXACAAC_SUFFIX)
-#define omxACAAC_MDCTFwd_S32 OMXCATBAR(ACAAC_MDCTFwd_S32, OMXACAAC_SUFFIX)
-#define omxACAAC_MDCTInv_S32_S16 OMXCATBAR(ACAAC_MDCTInv_S32_S16, OMXACAAC_SUFFIX)
-#define omxACAAC_NoiselessDecode OMXCATBAR(ACAAC_NoiselessDecode, OMXACAAC_SUFFIX)
-#define omxACAAC_QuantInv_S32_I OMXCATBAR(ACAAC_QuantInv_S32_I, OMXACAAC_SUFFIX)
-#define omxACAAC_UnpackADIFHeader OMXCATBAR(ACAAC_UnpackADIFHeader, OMXACAAC_SUFFIX)
-#define omxACAAC_UnpackADTSFrameHeader OMXCATBAR(ACAAC_UnpackADTSFrameHeader, OMXACAAC_SUFFIX)
-
-
-#define omxACMP3_HuffmanDecode_S32 OMXCATBAR(ACMP3_HuffmanDecode_S32, OMXACMP3_SUFFIX)
-#define omxACMP3_HuffmanDecodeSfb_S32 OMXCATBAR(ACMP3_HuffmanDecodeSfb_S32, OMXACMP3_SUFFIX)
-#define omxACMP3_HuffmanDecodeSfbMbp_S32 OMXCATBAR(ACMP3_HuffmanDecodeSfbMbp_S32, OMXACMP3_SUFFIX)
-#define omxACMP3_MDCTInv_S32 OMXCATBAR(ACMP3_MDCTInv_S32, OMXACMP3_SUFFIX)
-#define omxACMP3_ReQuantize_S32_I OMXCATBAR(ACMP3_ReQuantize_S32_I, OMXACMP3_SUFFIX)
-#define omxACMP3_ReQuantizeSfb_S32_I OMXCATBAR(ACMP3_ReQuantizeSfb_S32_I, OMXACMP3_SUFFIX)
-#define omxACMP3_SynthPQMF_S32_S16 OMXCATBAR(ACMP3_SynthPQMF_S32_S16, OMXACMP3_SUFFIX)
-#define omxACMP3_UnpackFrameHeader OMXCATBAR(ACMP3_UnpackFrameHeader, OMXACMP3_SUFFIX)
-#define omxACMP3_UnpackScaleFactors_S8 OMXCATBAR(ACMP3_UnpackScaleFactors_S8, OMXACMP3_SUFFIX)
-#define omxACMP3_UnpackSideInfo OMXCATBAR(ACMP3_UnpackSideInfo, OMXACMP3_SUFFIX)
-
-#define omxICJP_CopyExpand_U8_C3 OMXCATBAR(ICJP_CopyExpand_U8_C3, OMXICJP_SUFFIX)
-#define omxICJP_DCTFwd_S16 OMXCATBAR(ICJP_DCTFwd_S16, OMXICJP_SUFFIX)
-#define omxICJP_DCTFwd_S16_I OMXCATBAR(ICJP_DCTFwd_S16_I, OMXICJP_SUFFIX)
-#define omxICJP_DCTInv_S16 OMXCATBAR(ICJP_DCTInv_S16, OMXICJP_SUFFIX)
-#define omxICJP_DCTInv_S16_I OMXCATBAR(ICJP_DCTInv_S16_I, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantFwd_Multiple_S16 OMXCATBAR(ICJP_DCTQuantFwd_Multiple_S16, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantFwd_S16 OMXCATBAR(ICJP_DCTQuantFwd_S16, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantFwd_S16_I OMXCATBAR(ICJP_DCTQuantFwd_S16_I, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantFwdTableInit OMXCATBAR(ICJP_DCTQuantFwdTableInit, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantInv_Multiple_S16 OMXCATBAR(ICJP_DCTQuantInv_Multiple_S16, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantInv_S16 OMXCATBAR(ICJP_DCTQuantInv_S16, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantInv_S16_I OMXCATBAR(ICJP_DCTQuantInv_S16_I, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantInvTableInit OMXCATBAR(ICJP_DCTQuantInvTableInit, OMXICJP_SUFFIX)
-#define omxICJP_DecodeHuffman8x8_Direct_S16_C1 OMXCATBAR(ICJP_DecodeHuffman8x8_Direct_S16_C1, OMXICJP_SUFFIX)
-#define omxICJP_DecodeHuffmanSpecGetBufSize_U8 OMXCATBAR(ICJP_DecodeHuffmanSpecGetBufSize_U8, OMXICJP_SUFFIX)
-#define omxICJP_DecodeHuffmanSpecInit_U8 OMXCATBAR(ICJP_DecodeHuffmanSpecInit_U8, OMXICJP_SUFFIX)
-#define omxICJP_EncodeHuffman8x8_Direct_S16_U1_C1 OMXCATBAR(ICJP_EncodeHuffman8x8_Direct_S16_U1_C1, OMXICJP_SUFFIX)
-#define omxICJP_EncodeHuffmanSpecGetBufSize_U8 OMXCATBAR(ICJP_EncodeHuffmanSpecGetBufSize_U8, OMXICJP_SUFFIX)
-#define omxICJP_EncodeHuffmanSpecInit_U8 OMXCATBAR(ICJP_EncodeHuffmanSpecInit_U8, OMXICJP_SUFFIX)
-
-#define omxIPBM_AddC_U8_C1R_Sfs OMXCATBAR(IPBM_AddC_U8_C1R_Sfs, OMXIPBM_SUFFIX)
-#define omxIPBM_Copy_U8_C1R OMXCATBAR(IPBM_Copy_U8_C1R, OMXIPBM_SUFFIX)
-#define omxIPBM_Copy_U8_C3R OMXCATBAR(IPBM_Copy_U8_C3R, OMXIPBM_SUFFIX)
-#define omxIPBM_Mirror_U8_C1R OMXCATBAR(IPBM_Mirror_U8_C1R, OMXIPBM_SUFFIX)
-#define omxIPBM_MulC_U8_C1R_Sfs OMXCATBAR(IPBM_MulC_U8_C1R_Sfs, OMXIPBM_SUFFIX)
-
-#define omxIPCS_ColorTwistQ14_U8_C3R OMXCATBAR(IPCS_ColorTwistQ14_U8_C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_BGR565ToYCbCr420LS_MCU_U16_S16_C3P3R OMXCATBAR(IPCS_BGR565ToYCbCr420LS_MCU_U16_S16_C3P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_BGR565ToYCbCr422LS_MCU_U16_S16_C3P3R OMXCATBAR(IPCS_BGR565ToYCbCr422LS_MCU_U16_S16_C3P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_BGR565ToYCbCr444LS_MCU_U16_S16_C3P3R OMXCATBAR(IPCS_BGR565ToYCbCr444LS_MCU_U16_S16_C3P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_BGR888ToYCbCr420LS_MCU_U8_S16_C3P3R OMXCATBAR(IPCS_BGR888ToYCbCr420LS_MCU_U8_S16_C3P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_BGR888ToYCbCr422LS_MCU_U8_S16_C3P3R OMXCATBAR(IPCS_BGR888ToYCbCr422LS_MCU_U8_S16_C3P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_BGR888ToYCbCr444LS_MCU_U8_S16_C3P3R OMXCATBAR(IPCS_BGR888ToYCbCr444LS_MCU_U8_S16_C3P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr420RszCscRotBGR_U8_P3C3R OMXCATBAR(IPCS_YCbCr420RszCscRotBGR_U8_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr420RszRot_U8_P3R OMXCATBAR(IPCS_YCbCr420RszRot_U8_P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr420ToBGR565_U8_U16_P3C3R OMXCATBAR(IPCS_YCbCr420ToBGR565_U8_U16_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr420ToBGR565LS_MCU_S16_U16_P3C3R OMXCATBAR(IPCS_YCbCr420ToBGR565LS_MCU_S16_U16_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr420ToBGR888LS_MCU_S16_U8_P3C3R OMXCATBAR(IPCS_YCbCr420ToBGR888LS_MCU_S16_U8_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr422RszCscRotBGR_U8_P3C3R OMXCATBAR(IPCS_YCbCr422RszCscRotBGR_U8_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_CbYCrY422RszCscRotBGR_U8_U16_C2R OMXCATBAR(IPCS_CbYCrY422RszCscRotBGR_U8_U16_C2R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr422RszRot_U8_P3R OMXCATBAR(IPCS_YCbCr422RszRot_U8_P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbYCr422ToBGR565_U8_U16_C2C3R OMXCATBAR(IPCS_YCbYCr422ToBGR565_U8_U16_C2C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr422ToBGR565LS_MCU_S16_U16_P3C3R OMXCATBAR(IPCS_YCbCr422ToBGR565LS_MCU_S16_U16_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbYCr422ToBGR888_U8_C2C3R OMXCATBAR(IPCS_YCbYCr422ToBGR888_U8_C2C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr422ToBGR888LS_MCU_S16_U8_P3C3R OMXCATBAR(IPCS_YCbCr422ToBGR888LS_MCU_S16_U8_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr422ToBGR888LS_MCU_S16_U8_P3C3R OMXCATBAR(IPCS_YCbCr422ToBGR888LS_MCU_S16_U8_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_CbYCrY422ToYCbCr420Rotate_U8_C2P3R OMXCATBAR(IPCS_CbYCrY422ToYCbCr420Rotate_U8_C2P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr422ToYCbCr420Rotate_U8_P3R OMXCATBAR(IPCS_YCbCr422ToYCbCr420Rotate_U8_P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr444ToBGR565_U8_U16_C3R OMXCATBAR(IPCS_YCbCr444ToBGR565_U8_U16_C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr444ToBGR565_U8_U16_P3C3R OMXCATBAR(IPCS_YCbCr444ToBGR565_U8_U16_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr444ToBGR565LS_MCU_S16_U16_P3C3R OMXCATBAR(IPCS_YCbCr444ToBGR565LS_MCU_S16_U16_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr444ToBGR888_U8_C3R OMXCATBAR(IPCS_YCbCr444ToBGR888_U8_C3R, OMXIPCS_SUFFIX)
-
-#define omxIPPP_Deblock_HorEdge_U8_I OMXCATBAR(IPPP_Deblock_HorEdge_U8_I, OMXIPPP_SUFFIX)
-#define omxIPPP_Deblock_VerEdge_U8_I OMXCATBAR(IPPP_Deblock_VerEdge_U8_I, OMXIPPP_SUFFIX)
-#define omxIPPP_FilterFIR_U8_C1R OMXCATBAR(IPPP_FilterFIR_U8_C1R, OMXIPPP_SUFFIX)
-#define omxIPPP_FilterMedian_U8_C1R OMXCATBAR(IPPP_FilterMedian_U8_C1R, OMXIPPP_SUFFIX)
-#define omxIPPP_GetCentralMoment_S64 OMXCATBAR(IPPP_GetCentralMoment_S64, OMXIPPP_SUFFIX)
-#define omxIPPP_GetSpatialMoment_S64 OMXCATBAR(IPPP_GetSpatialMoment_S64, OMXIPPP_SUFFIX)
-#define omxIPPP_MomentGetStateSize OMXCATBAR(IPPP_MomentGetStateSize, OMXIPPP_SUFFIX)
-#define omxIPPP_MomentInit OMXCATBAR(IPPP_MomentInit, OMXIPPP_SUFFIX)
-#define omxIPPP_Moments_U8_C1R OMXCATBAR(IPPP_Moments_U8_C1R, OMXIPPP_SUFFIX)
-#define omxIPPP_Moments_U8_C3R OMXCATBAR(IPPP_Moments_U8_C3R, OMXIPPP_SUFFIX)
-
-#define omxSP_BlockExp_S16 OMXCATBAR(SP_BlockExp_S16, OMXSP_SUFFIX)
-#define omxSP_BlockExp_S32 OMXCATBAR(SP_BlockExp_S32, OMXSP_SUFFIX)
-#define omxSP_Copy_S16 OMXCATBAR(SP_Copy_S16, OMXSP_SUFFIX)
-#define omxSP_DotProd_S16 OMXCATBAR(SP_DotProd_S16, OMXSP_SUFFIX)
-#define omxSP_DotProd_S16_Sfs OMXCATBAR(SP_DotProd_S16_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTFwd_CToC_SC16_Sfs OMXCATBAR(SP_FFTFwd_CToC_SC16_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTFwd_CToC_SC32_Sfs OMXCATBAR(SP_FFTFwd_CToC_SC32_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTFwd_RToCCS_S16S32_Sfs OMXCATBAR(SP_FFTFwd_RToCCS_S16S32_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTFwd_RToCCS_S32_Sfs OMXCATBAR(SP_FFTFwd_RToCCS_S32_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTGetBufSize_C_SC16 OMXCATBAR(SP_FFTGetBufSize_C_SC16, OMXSP_SUFFIX)
-#define omxSP_FFTGetBufSize_C_SC32 OMXCATBAR(SP_FFTGetBufSize_C_SC32, OMXSP_SUFFIX)
-#define omxSP_FFTGetBufSize_R_S16S32 OMXCATBAR(SP_FFTGetBufSize_R_S16S32, OMXSP_SUFFIX)
-#define omxSP_FFTGetBufSize_R_S32 OMXCATBAR(SP_FFTGetBufSize_R_S32, OMXSP_SUFFIX)
-#define omxSP_FFTInit_C_SC16 OMXCATBAR(SP_FFTInit_C_SC16, OMXSP_SUFFIX)
-#define omxSP_FFTInit_C_SC32 OMXCATBAR(SP_FFTInit_C_SC32, OMXSP_SUFFIX)
-#define omxSP_FFTInit_R_S16S32 OMXCATBAR(SP_FFTInit_R_S16S32, OMXSP_SUFFIX)
-#define omxSP_FFTInit_R_S32 OMXCATBAR(SP_FFTInit_R_S32, OMXSP_SUFFIX)
-#define omxSP_FFTInv_CCSToR_S32_Sfs OMXCATBAR(SP_FFTInv_CCSToR_S32_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTInv_CCSToR_S32S16_Sfs OMXCATBAR(SP_FFTInv_CCSToR_S32S16_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTInv_CToC_SC16_Sfs OMXCATBAR(SP_FFTInv_CToC_SC16_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTInv_CToC_SC32_Sfs OMXCATBAR(SP_FFTInv_CToC_SC32_Sfs, OMXSP_SUFFIX)
-#define omxSP_FilterMedian_S32 OMXCATBAR(SP_FilterMedian_S32, OMXSP_SUFFIX)
-#define omxSP_FilterMedian_S32_I OMXCATBAR(SP_FilterMedian_S32_I, OMXSP_SUFFIX)
-#define omxSP_FIR_Direct_S16 OMXCATBAR(SP_FIR_Direct_S16, OMXSP_SUFFIX)
-#define omxSP_FIR_Direct_S16_I OMXCATBAR(SP_FIR_Direct_S16_I, OMXSP_SUFFIX)
-#define omxSP_FIR_Direct_S16_ISfs OMXCATBAR(SP_FIR_Direct_S16_ISfs, OMXSP_SUFFIX)
-#define omxSP_FIR_Direct_S16_Sfs OMXCATBAR(SP_FIR_Direct_S16_Sfs, OMXSP_SUFFIX)
-#define omxSP_FIROne_Direct_S16 OMXCATBAR(SP_FIROne_Direct_S16, OMXSP_SUFFIX)
-#define omxSP_FIROne_Direct_S16_I OMXCATBAR(SP_FIROne_Direct_S16_I, OMXSP_SUFFIX)
-#define omxSP_FIROne_Direct_S16_ISfs OMXCATBAR(SP_FIROne_Direct_S16_ISfs, OMXSP_SUFFIX)
-#define omxSP_FIROne_Direct_S16_Sfs OMXCATBAR(SP_FIROne_Direct_S16_Sfs, OMXSP_SUFFIX)
-#define omxSP_IIR_BiQuadDirect_S16 OMXCATBAR(SP_IIR_BiQuadDirect_S16, OMXSP_SUFFIX)
-#define omxSP_IIR_BiQuadDirect_S16_I OMXCATBAR(SP_IIR_BiQuadDirect_S16_I, OMXSP_SUFFIX)
-#define omxSP_IIR_Direct_S16 OMXCATBAR(SP_IIR_Direct_S16, OMXSP_SUFFIX)
-#define omxSP_IIR_Direct_S16_I OMXCATBAR(SP_IIR_Direct_S16_I, OMXSP_SUFFIX)
-#define omxSP_IIROne_BiQuadDirect_S16 OMXCATBAR(SP_IIROne_BiQuadDirect_S16, OMXSP_SUFFIX)
-#define omxSP_IIROne_BiQuadDirect_S16_I OMXCATBAR(SP_IIROne_BiQuadDirect_S16_I, OMXSP_SUFFIX)
-#define omxSP_IIROne_Direct_S16 OMXCATBAR(SP_IIROne_Direct_S16, OMXSP_SUFFIX)
-#define omxSP_IIROne_Direct_S16_I OMXCATBAR(SP_IIROne_Direct_S16_I, OMXSP_SUFFIX)
-
-#define omxVCCOMM_Average_16x OMXCATBAR(VCCOMM_Average_16x, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_Average_8x OMXCATBAR(VCCOMM_Average_8x, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_ComputeTextureErrorBlock OMXCATBAR(VCCOMM_ComputeTextureErrorBlock, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_ComputeTextureErrorBlock_SAD OMXCATBAR(VCCOMM_ComputeTextureErrorBlock_SAD, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_Copy16x16 OMXCATBAR(VCCOMM_Copy16x16, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_Copy8x8 OMXCATBAR(VCCOMM_Copy8x8, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_ExpandFrame_I OMXCATBAR(VCCOMM_ExpandFrame_I, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_LimitMVToRect OMXCATBAR(VCCOMM_LimitMVToRect, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_SAD_16x OMXCATBAR(VCCOMM_SAD_16x, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_SAD_8x OMXCATBAR(VCCOMM_SAD_8x, OMXVCCOMM_SUFFIX)
-
-#define omxVCM4P10_Average_4x OMXCATBAR(VCM4P10_Average_4x, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_BlockMatch_Half OMXCATBAR(VCM4P10_BlockMatch_Half, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_BlockMatch_Integer OMXCATBAR(VCM4P10_BlockMatch_Integer, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_BlockMatch_Quarter OMXCATBAR(VCM4P10_BlockMatch_Quarter, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_DeblockChroma_I OMXCATBAR(VCM4P10_DeblockChroma_I, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_DeblockLuma_I OMXCATBAR(VCM4P10_DeblockLuma_I, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC OMXCATBAR(VCM4P10_DecodeChromaDcCoeffsToPairCAVLC, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_DecodeCoeffsToPairCAVLC OMXCATBAR(VCM4P10_DecodeCoeffsToPairCAVLC, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_DequantTransformResidualFromPairAndAdd OMXCATBAR(VCM4P10_DequantTransformResidualFromPairAndAdd, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_FilterDeblockingChroma_HorEdge_I OMXCATBAR(VCM4P10_FilterDeblockingChroma_HorEdge_I, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_FilterDeblockingChroma_VerEdge_I OMXCATBAR(VCM4P10_FilterDeblockingChroma_VerEdge_I, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_FilterDeblockingLuma_HorEdge_I OMXCATBAR(VCM4P10_FilterDeblockingLuma_HorEdge_I, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_FilterDeblockingLuma_VerEdge_I OMXCATBAR(VCM4P10_FilterDeblockingLuma_VerEdge_I, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_GetVLCInfo OMXCATBAR(VCM4P10_GetVLCInfo, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InterpolateChroma OMXCATBAR(VCM4P10_InterpolateChroma, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InterpolateHalfHor_Luma OMXCATBAR(VCM4P10_InterpolateHalfHor_Luma, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InterpolateHalfVer_Luma OMXCATBAR(VCM4P10_InterpolateHalfVer_Luma, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InterpolateLuma OMXCATBAR(VCM4P10_InterpolateLuma, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InvTransformDequant_ChromaDC OMXCATBAR(VCM4P10_InvTransformDequant_ChromaDC, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InvTransformDequant_LumaDC OMXCATBAR(VCM4P10_InvTransformDequant_LumaDC, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InvTransformResidualAndAdd OMXCATBAR(VCM4P10_InvTransformResidualAndAdd, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_MEGetBufSize OMXCATBAR(VCM4P10_MEGetBufSize, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_MEInit OMXCATBAR(VCM4P10_MEInit, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_MotionEstimationMB OMXCATBAR(VCM4P10_MotionEstimationMB, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_PredictIntra_16x16 OMXCATBAR(VCM4P10_PredictIntra_16x16, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_PredictIntra_4x4 OMXCATBAR(VCM4P10_PredictIntra_4x4, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_PredictIntraChroma_8x8 OMXCATBAR(VCM4P10_PredictIntraChroma_8x8, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_SAD_4x OMXCATBAR(VCM4P10_SAD_4x, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_SADQuar_16x OMXCATBAR(VCM4P10_SADQuar_16x, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_SADQuar_4x OMXCATBAR(VCM4P10_SADQuar_4x, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_SADQuar_8x OMXCATBAR(VCM4P10_SADQuar_8x, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_SATD_4x4 OMXCATBAR(VCM4P10_SATD_4x4, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_SubAndTransformQDQResidual OMXCATBAR(VCM4P10_SubAndTransformQDQResidual, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_TransformDequantChromaDCFromPair OMXCATBAR(VCM4P10_TransformDequantChromaDCFromPair, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_TransformDequantLumaDCFromPair OMXCATBAR(VCM4P10_TransformDequantLumaDCFromPair, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_TransformQuant_ChromaDC OMXCATBAR(VCM4P10_TransformQuant_ChromaDC, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_TransformQuant_LumaDC OMXCATBAR(VCM4P10_TransformQuant_LumaDC, OMXVCM4P10_SUFFIX)
-
-#define omxVCM4P2_BlockMatch_Half_16x16 OMXCATBAR(VCM4P2_BlockMatch_Half_16x16, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_BlockMatch_Half_8x8 OMXCATBAR(VCM4P2_BlockMatch_Half_8x8, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_BlockMatch_Integer_16x16 OMXCATBAR(VCM4P2_BlockMatch_Integer_16x16, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_BlockMatch_Integer_8x8 OMXCATBAR(VCM4P2_BlockMatch_Integer_8x8, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DCT8x8blk OMXCATBAR(VCM4P2_DCT8x8blk, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DecodeBlockCoef_Inter OMXCATBAR(VCM4P2_DecodeBlockCoef_Inter, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DecodeBlockCoef_Intra OMXCATBAR(VCM4P2_DecodeBlockCoef_Intra, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DecodePadMV_PVOP OMXCATBAR(VCM4P2_DecodePadMV_PVOP, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DecodeVLCZigzag_Inter OMXCATBAR(VCM4P2_DecodeVLCZigzag_Inter, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DecodeVLCZigzag_IntraACVLC OMXCATBAR(VCM4P2_DecodeVLCZigzag_IntraACVLC, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DecodeVLCZigzag_IntraDCVLC OMXCATBAR(VCM4P2_DecodeVLCZigzag_IntraDCVLC, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_EncodeMV OMXCATBAR(VCM4P2_EncodeMV, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_EncodeVLCZigzag_Inter OMXCATBAR(VCM4P2_EncodeVLCZigzag_Inter, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_EncodeVLCZigzag_IntraACVLC OMXCATBAR(VCM4P2_EncodeVLCZigzag_IntraACVLC, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_EncodeVLCZigzag_IntraDCVLC OMXCATBAR(VCM4P2_EncodeVLCZigzag_IntraDCVLC, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_FindMVpred OMXCATBAR(VCM4P2_FindMVpred, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_IDCT8x8blk OMXCATBAR(VCM4P2_IDCT8x8blk, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_MCReconBlock OMXCATBAR(VCM4P2_MCReconBlock, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_MEGetBufSize OMXCATBAR(VCM4P2_MEGetBufSize, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_MEInit OMXCATBAR(VCM4P2_MEInit, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_MotionEstimationMB OMXCATBAR(VCM4P2_MotionEstimationMB, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_PredictReconCoefIntra OMXCATBAR(VCM4P2_PredictReconCoefIntra, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_QuantInter_I OMXCATBAR(VCM4P2_QuantInter_I, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_QuantIntra_I OMXCATBAR(VCM4P2_QuantIntra_I, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_QuantInvInter_I OMXCATBAR(VCM4P2_QuantInvInter_I, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_QuantInvIntra_I OMXCATBAR(VCM4P2_QuantInvIntra_I, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_TransRecBlockCoef_inter OMXCATBAR(VCM4P2_TransRecBlockCoef_inter, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_TransRecBlockCoef_intra OMXCATBAR(VCM4P2_TransRecBlockCoef_intra, OMXVCM4P2_SUFFIX)
-
-
-#endif /* _armOMX_h_ */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/omxtypes.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/omxtypes.h
deleted file mode 100644
index 912cb0d..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/omxtypes.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/**
- * File: omxtypes.h
- * Brief: Defines basic Data types used in OpenMAX v1.0.2 header files.
- *
- * Copyright © 2005-2008 The Khronos Group Inc. All Rights Reserved.
- *
- * These materials are protected by copyright laws and contain material
- * proprietary to the Khronos Group, Inc. You may use these materials
- * for implementing Khronos specifications, without altering or removing
- * any trademark, copyright or other notice from the specification.
- *
- * Khronos Group makes no, and expressly disclaims any, representations
- * or warranties, express or implied, regarding these materials, including,
- * without limitation, any implied warranties of merchantability or fitness
- * for a particular purpose or non-infringement of any intellectual property.
- * Khronos Group makes no, and expressly disclaims any, warranties, express
- * or implied, regarding the correctness, accuracy, completeness, timeliness,
- * and reliability of these materials.
- *
- * Under no circumstances will the Khronos Group, or any of its Promoters,
- * Contributors or Members or their respective partners, officers, directors,
- * employees, agents or representatives be liable for any damages, whether
- * direct, indirect, special or consequential damages for lost revenues,
- * lost profits, or otherwise, arising from or in connection with these
- * materials.
- *
- * Khronos and OpenMAX are trademarks of the Khronos Group Inc.
- *
- */
-
-#ifndef _OMXTYPES_H_
-#define _OMXTYPES_H_
-
-#include <limits.h>
-#include <stdint.h>
-
-#define OMX_IN
-#define OMX_OUT
-#define OMX_INOUT
-
-
-typedef enum {
-
- /* Mandatory return codes - use cases are explicitly described for each function */
- OMX_Sts_NoErr = 0, /* No error, the function completed successfully */
- OMX_Sts_Err = -2, /* Unknown/unspecified error */
- OMX_Sts_InvalidBitstreamValErr = -182, /* Invalid value detected during bitstream processing */
- OMX_Sts_MemAllocErr = -9, /* Not enough memory allocated for the operation */
- OMX_StsACAAC_GainCtrErr = -159, /* AAC: Unsupported gain control data detected */
- OMX_StsACAAC_PrgNumErr = -167, /* AAC: Invalid number of elements for one program */
- OMX_StsACAAC_CoefValErr = -163, /* AAC: Invalid quantized coefficient value */
- OMX_StsACAAC_MaxSfbErr = -162, /* AAC: Invalid maxSfb value in relation to numSwb */
- OMX_StsACAAC_PlsDataErr = -160, /* AAC: pulse escape sequence data error */
-
- /* Optional return codes - use cases are explicitly described for each function*/
- OMX_Sts_BadArgErr = -5, /* Bad Arguments */
-
- OMX_StsACAAC_TnsNumFiltErr = -157, /* AAC: Invalid number of TNS filters */
- OMX_StsACAAC_TnsLenErr = -156, /* AAC: Invalid TNS region length */
- OMX_StsACAAC_TnsOrderErr = -155, /* AAC: Invalid order of TNS filter */
- OMX_StsACAAC_TnsCoefResErr = -154, /* AAC: Invalid bit-resolution for TNS filter coefficients */
- OMX_StsACAAC_TnsCoefErr = -153, /* AAC: Invalid TNS filter coefficients */
- OMX_StsACAAC_TnsDirectErr = -152, /* AAC: Invalid TNS filter direction */
-
- OMX_StsICJP_JPEGMarkerErr = -183, /* JPEG marker encountered within an entropy-coded block; */
- /* Huffman decoding operation terminated early. */
- OMX_StsICJP_JPEGMarker = -181, /* JPEG marker encountered; Huffman decoding */
- /* operation terminated early. */
- OMX_StsIPPP_ContextMatchErr = -17, /* Context parameter doesn't match to the operation */
-
- OMX_StsSP_EvenMedianMaskSizeErr = -180, /* Even size of the Median Filter mask was replaced by the odd one */
-
- OMX_Sts_MaximumEnumeration = INT_MAX /*Placeholder, forces enum of size OMX_INT*/
-
- } OMXResult; /** Return value or error value returned from a function. Identical to OMX_INT */
-
-
-/* OMX_U8 */
-typedef uint8_t OMX_U8;
-
-/* OMX_S8 */
-typedef int8_t OMX_S8;
-
-/* OMX_U16 */
-typedef uint16_t OMX_U16;
-
-/* OMX_S16 */
-typedef int16_t OMX_S16;
-
-/* OMX_U32 */
-typedef uint32_t OMX_U32;
-
-/* OMX_S32 */
-typedef int32_t OMX_S32;
-
-/* OMX_U64 & OMX_S64 */
-#if defined( _WIN32 ) || defined ( _WIN64 )
- typedef __int64 OMX_S64; /** Signed 64-bit integer */
- typedef unsigned __int64 OMX_U64; /** Unsigned 64-bit integer */
- #define OMX_MIN_S64 (0x8000000000000000i64)
- #define OMX_MIN_U64 (0x0000000000000000i64)
- #define OMX_MAX_S64 (0x7FFFFFFFFFFFFFFFi64)
- #define OMX_MAX_U64 (0xFFFFFFFFFFFFFFFFi64)
-#else
- typedef int64_t OMX_S64; /** Signed 64-bit integer */
- typedef uint64_t OMX_U64; /** Unsigned 64-bit integer */
- #define OMX_MIN_S64 (0x8000000000000000LL)
- #define OMX_MIN_U64 (0x0000000000000000LL)
- #define OMX_MAX_S64 (0x7FFFFFFFFFFFFFFFLL)
- #define OMX_MAX_U64 (0xFFFFFFFFFFFFFFFFLL)
-#endif
-
-/* OMX_SC8 */
-typedef struct
-{
- OMX_S8 Re; /** Real part */
- OMX_S8 Im; /** Imaginary part */
-
-} OMX_SC8; /** Signed 8-bit complex number */
-
-
-/* OMX_SC16 */
-typedef struct
-{
- OMX_S16 Re; /** Real part */
- OMX_S16 Im; /** Imaginary part */
-
-} OMX_SC16; /** Signed 16-bit complex number */
-
-
-/* OMX_SC32 */
-typedef struct
-{
- OMX_S32 Re; /** Real part */
- OMX_S32 Im; /** Imaginary part */
-
-} OMX_SC32; /** Signed 32-bit complex number */
-
-
-/* OMX_SC64 */
-typedef struct
-{
- OMX_S64 Re; /** Real part */
- OMX_S64 Im; /** Imaginary part */
-
-} OMX_SC64; /** Signed 64-bit complex number */
-
-
-/* OMX_F32 */
-typedef float OMX_F32; /** Single precision floating point,IEEE 754 */
-
-
-/* OMX_F64 */
-typedef double OMX_F64; /** Double precision floating point,IEEE 754 */
-
-
-/* OMX_INT */
-typedef int OMX_INT; /** signed integer corresponding to machine word length, has maximum signed value INT_MAX*/
-
-
-#define OMX_MIN_S8 (-128)
-#define OMX_MIN_U8 0
-#define OMX_MIN_S16 (-32768)
-#define OMX_MIN_U16 0
-#define OMX_MIN_S32 (-2147483647-1)
-#define OMX_MIN_U32 0
-
-#define OMX_MAX_S8 (127)
-#define OMX_MAX_U8 (255)
-#define OMX_MAX_S16 (32767)
-#define OMX_MAX_U16 (0xFFFF)
-#define OMX_MAX_S32 (2147483647)
-#define OMX_MAX_U32 (0xFFFFFFFF)
-
-typedef void OMXVoid;
-
-#ifndef NULL
-#define NULL ((void*)0)
-#endif
-
-/** Defines the geometric position and size of a rectangle,
- * where x,y defines the coordinates of the top left corner
- * of the rectangle, with dimensions width in the x-direction
- * and height in the y-direction */
-typedef struct {
- OMX_INT x; /** x-coordinate of top left corner of rectangle */
- OMX_INT y; /** y-coordinate of top left corner of rectangle */
- OMX_INT width; /** Width in the x-direction. */
- OMX_INT height; /** Height in the y-direction. */
-}OMXRect;
-
-
-/** Defines the geometric position of a point, */
-typedef struct
-{
- OMX_INT x; /** x-coordinate */
- OMX_INT y; /** y-coordinate */
-
-} OMXPoint;
-
-
-/** Defines the dimensions of a rectangle, or region of interest in an image */
-typedef struct
-{
- OMX_INT width; /** Width of the rectangle, in the x-direction */
- OMX_INT height; /** Height of the rectangle, in the y-direction */
-
-} OMXSize;
-
-#endif /* _OMXTYPES_H_ */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/omxtypes_s.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/omxtypes_s.h
deleted file mode 100644
index d41a037..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/api/omxtypes_s.h
+++ /dev/null
@@ -1,91 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxtypes_s.h
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
-;// Mandatory return codes - use cases are explicitly described for each function
-OMX_Sts_NoErr EQU 0 ;// No error the function completed successfully
-OMX_Sts_Err EQU -2 ;// Unknown/unspecified error
-OMX_Sts_InvalidBitstreamValErr EQU -182 ;// Invalid value detected during bitstream processing
-OMX_Sts_MemAllocErr EQU -9 ;// Not enough memory allocated for the operation
-OMX_StsACAAC_GainCtrErr EQU -159 ;// AAC: Unsupported gain control data detected
-OMX_StsACAAC_PrgNumErr EQU -167 ;// AAC: Invalid number of elements for one program
-OMX_StsACAAC_CoefValErr EQU -163 ;// AAC: Invalid quantized coefficient value
-OMX_StsACAAC_MaxSfbErr EQU -162 ;// AAC: Invalid maxSfb value in relation to numSwb
-OMX_StsACAAC_PlsDataErr EQU -160 ;// AAC: pulse escape sequence data error
-
-;// Optional return codes - use cases are explicitly described for each function
-OMX_Sts_BadArgErr EQU -5 ;// Bad Arguments
-
-OMX_StsACAAC_TnsNumFiltErr EQU -157 ;// AAC: Invalid number of TNS filters
-OMX_StsACAAC_TnsLenErr EQU -156 ;// AAC: Invalid TNS region length
-OMX_StsACAAC_TnsOrderErr EQU -155 ;// AAC: Invalid order of TNS filter
-OMX_StsACAAC_TnsCoefResErr EQU -154 ;// AAC: Invalid bit-resolution for TNS filter coefficients
-OMX_StsACAAC_TnsCoefErr EQU -153 ;// AAC: Invalid TNS filter coefficients
-OMX_StsACAAC_TnsDirectErr EQU -152 ;// AAC: Invalid TNS filter direction
-
-OMX_StsICJP_JPEGMarkerErr EQU -183 ;// JPEG marker encountered within an entropy-coded block;
- ;// Huffman decoding operation terminated early.
-OMX_StsICJP_JPEGMarker EQU -181 ;// JPEG marker encountered; Huffman decoding
- ;// operation terminated early.
-OMX_StsIPPP_ContextMatchErr EQU -17 ;// Context parameter doesn't match to the operation
-
-OMX_StsSP_EvenMedianMaskSizeErr EQU -180 ;// Even size of the Median Filter mask was replaced by the odd one
-
-OMX_Sts_MaximumEnumeration EQU 0x7FFFFFFF
-
-
-
-OMX_MIN_S8 EQU (-128)
-OMX_MIN_U8 EQU 0
-OMX_MIN_S16 EQU (-32768)
-OMX_MIN_U16 EQU 0
-
-
-OMX_MIN_S32 EQU (-2147483647-1)
-OMX_MIN_U32 EQU 0
-
-OMX_MAX_S8 EQU (127)
-OMX_MAX_U8 EQU (255)
-OMX_MAX_S16 EQU (32767)
-OMX_MAX_U16 EQU (0xFFFF)
-OMX_MAX_S32 EQU (2147483647)
-OMX_MAX_U32 EQU (0xFFFFFFFF)
-
-OMX_VC_UPPER EQU 0x1 ;// Used by the PredictIntra functions
-OMX_VC_LEFT EQU 0x2 ;// Used by the PredictIntra functions
-OMX_VC_UPPER_RIGHT EQU 0x40 ;// Used by the PredictIntra functions
-
-NULL EQU 0
-
-;// Structures
-
- INCLUDE armCOMM_s.h
-
- M_STRUCT OMXPoint
- M_FIELD x, 4
- M_FIELD y, 4
- M_ENDSTRUCT
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/build_vc.pl b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/build_vc.pl
deleted file mode 100755
index 5d672b3..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/build_vc.pl
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-#!/usr/bin/perl
-#
-#
-# File Name: build_vc.pl
-# OpenMAX DL: v1.0.2
-# Revision: 9641
-# Date: Thursday, February 7, 2008
-#
-#
-#
-#
-# This file builds the OpenMAX DL vc domain library omxVC.o.
-#
-
-use File::Spec;
-use strict;
-
-my ($CC, $CC_OPTS, $AS, $AS_OPTS, $LIB, $LIB_OPTS, $LIB_TYPE);
-
-$CC = 'armcc';
-$CC_OPTS = '--no_unaligned_access --cpu ARM1136J-S -c';
-$AS = 'armasm';
-$AS_OPTS = '--no_unaligned_access --cpu ARM1136J-S';
-# $LIB = 'armlink';
-# $LIB_OPTS = '--partial -o';
-# $LIB_TYPE = '.o';
-$LIB = 'armar';
-$LIB_OPTS = '--create -r';
-$LIB_TYPE = '.a';
-
-#------------------------
-
-my (@headerlist, @filelist, $hd, $file, $ofile, $command, $objlist, $libfile, $h);
-
-# Define the list of directories containing included header files.
-@headerlist = qw(api vc/api vc/m4p2/api vc/m4p10/api);
-
-# Define the list of source files to compile.
-open(FILES, '<filelist_vc.txt') or die("Can't open source file list\n");
-@filelist = <FILES>;
-close(FILES);
-
-# Fix the file separators in the header paths
-foreach $h (@headerlist)
-{
- $h = File::Spec->canonpath($h);
-}
-
-# Create the include path to be passed to the compiler
-$hd = '-I' . join(' -I', @headerlist);
-
-# Create the build directories "/lib/" and "/obj/" (if they are not there already)
-mkdir "obj", 0777 if (! -d "obj");
-mkdir "lib", 0777 if (! -d "lib");
-
-$objlist = '';
-
-# Compile each file
-foreach $file (@filelist)
-{
- my $f;
- my $base;
- my $ext;
- my $objfile;
-
- chomp($file);
- $file = File::Spec->canonpath($file);
-
- (undef, undef, $f) = File::Spec->splitpath($file);
- if(($base, $ext) = $f =~ /(.+)\.(\w)$/)
- {
- $objfile = File::Spec->catfile('obj', $base.'.o');
-
- if($ext eq 'c')
- {
- $objlist .= "$objfile ";
- $command = $CC.' '.$CC_OPTS.' '.$hd.' -o '.$objfile.' '.$file;
- print "$command\n";
- system($command);
- }
- elsif($ext eq 's')
- {
- $objlist .= "$objfile ";
- $command = $AS.' '.$AS_OPTS.' '.$hd.' -o '.$objfile.' '.$file;
- print "$command\n";
- system($command);
- }
- else
- {
- print "Ignoring file: $f\n";
- }
- }
- else
- {
- die "No file extension found: $f\n";
- }
-}
-
-# Do the final link stage to create the libraries.
-$libfile = File::Spec->catfile('lib', 'omxVC'.$LIB_TYPE);
-$command = $LIB.' '.$LIB_OPTS.' '.$libfile.' '.$objlist;
-print "$command\n";
-(system($command) == 0) and print "Build successful\n";
-
-
-
-
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/filelist_vc.txt b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/filelist_vc.txt
deleted file mode 100644
index 0f1623f..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/filelist_vc.txt
+++ /dev/null
@@ -1,74 +0,0 @@
-./api/armCOMM.h
-./api/armCOMM_BitDec_s.h
-./api/armCOMM_Bitstream.h
-./api/armCOMM_IDCT_s.h
-./api/armCOMM_IDCTTable.h
-./api/armCOMM_MaskTable.h
-./api/armCOMM_s.h
-./api/armCOMM_Version.h
-./api/armOMX_ReleaseVersion.h
-./api/omxtypes.h
-./api/omxtypes_s.h
-./src/armCOMM_IDCTTable.c
-./src/armCOMM_MaskTable.c
-./vc/api/armVC.h
-./vc/api/armVCCOMM_s.h
-./vc/api/omxVC.h
-./vc/api/omxVC_s.h
-./vc/comm/src/omxVCCOMM_Copy16x16_s.s
-./vc/comm/src/omxVCCOMM_Copy8x8_s.s
-./vc/comm/src/omxVCCOMM_ExpandFrame_I_s.s
-./vc/m4p10/api/armVCM4P10_CAVLCTables.h
-./vc/m4p10/src/armVCM4P10_Average_4x_Align_unsafe_s.s
-./vc/m4p10/src/armVCM4P10_CAVLCTables.c
-./vc/m4p10/src/armVCM4P10_DeblockingChroma_unsafe_s.s
-./vc/m4p10/src/armVCM4P10_DeblockingLuma_unsafe_s.s
-./vc/m4p10/src/armVCM4P10_DecodeCoeffsToPair_s.s
-./vc/m4p10/src/armVCM4P10_DequantTables_s.s
-./vc/m4p10/src/armVCM4P10_Interpolate_Chroma_s.s
-./vc/m4p10/src/armVCM4P10_InterpolateLuma_Align_unsafe_s.s
-./vc/m4p10/src/armVCM4P10_InterpolateLuma_Copy_unsafe_s.s
-./vc/m4p10/src/armVCM4P10_InterpolateLuma_DiagCopy_unsafe_s.s
-./vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe_s.s
-./vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe_s.s
-./vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe_s.s
-./vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe_s.s
-./vc/m4p10/src/armVCM4P10_QuantTables_s.s
-./vc/m4p10/src/armVCM4P10_TransformResidual4x4_s.s
-./vc/m4p10/src/armVCM4P10_UnpackBlock4x4_s.s
-./vc/m4p10/src/omxVCM4P10_DeblockChroma_I.c
-./vc/m4p10/src/omxVCM4P10_DeblockLuma_I.c
-./vc/m4p10/src/omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC.c
-./vc/m4p10/src/omxVCM4P10_DecodeCoeffsToPairCAVLC.c
-./vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_HorEdge_I_s.s
-./vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_VerEdge_I_s.s
-./vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_HorEdge_I_s.s
-./vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_VerEdge_I_s.s
-./vc/m4p10/src/omxVCM4P10_InterpolateChroma.c
-./vc/m4p10/src/omxVCM4P10_InterpolateLuma_s.s
-./vc/m4p10/src/omxVCM4P10_PredictIntra_16x16_s.s
-./vc/m4p10/src/omxVCM4P10_PredictIntra_4x4_s.s
-./vc/m4p10/src/omxVCM4P10_PredictIntraChroma_8x8_s.s
-./vc/m4p10/src/omxVCM4P10_TransformDequantChromaDCFromPair_s.s
-./vc/m4p10/src/omxVCM4P10_TransformDequantLumaDCFromPair_s.s
-./vc/m4p2/api/armVCM4P2_Huff_Tables_VLC.h
-./vc/m4p2/api/armVCM4P2_ZigZag_Tables.h
-./vc/m4p2/src/armVCM4P2_Clip8_s.s
-./vc/m4p2/src/armVCM4P2_DecodeVLCZigzag_AC_unsafe_s.s
-./vc/m4p2/src/armVCM4P2_Huff_Tables_VLC.c
-./vc/m4p2/src/armVCM4P2_Lookup_Tables.c
-./vc/m4p2/src/armVCM4P2_SetPredDir_s.s
-./vc/m4p2/src/armVCM4P2_Zigzag_Tables.c
-./vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Inter.c
-./vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Intra.c
-./vc/m4p2/src/omxVCM4P2_DecodePadMV_PVOP_s.s
-./vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_Inter_s.s
-./vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraACVLC_s.s
-./vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraDCVLC_s.s
-./vc/m4p2/src/omxVCM4P2_FindMVpred_s.s
-./vc/m4p2/src/omxVCM4P2_IDCT8x8blk_s.s
-./vc/m4p2/src/omxVCM4P2_MCReconBlock_s.s
-./vc/m4p2/src/omxVCM4P2_PredictReconCoefIntra_s.s
-./vc/m4p2/src/omxVCM4P2_QuantInvInter_I_s.s
-./vc/m4p2/src/omxVCM4P2_QuantInvIntra_I_s.s
-./vc/src/armVC_Version.c
\ No newline at end of file
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/src/armCOMM.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/src/armCOMM.c
deleted file mode 100644
index e8dbf41..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/src/armCOMM.c
+++ /dev/null
@@ -1,951 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armCOMM.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Defines Common APIs used across OpenMAX API's
- */
-
-#include "omxtypes.h"
-#include "armCOMM.h"
-
-/***********************************************************************/
- /* Miscellaneous Arithmetic operations */
-
-/**
- * Function: armRoundFloatToS16
- *
- * Description:
- * Converts a double precision value into a short int after rounding
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S16 format
- *
- */
-
-OMX_S16 armRoundFloatToS16 (OMX_F64 Value)
-{
- if (Value > 0)
- {
- return (OMX_S16)(Value + .5);
- }
- else
- {
- return (OMX_S16)(Value - .5);
- }
-}
-
-/**
- * Function: armRoundFloatToS32
- *
- * Description:
- * Converts a double precision value into a int after rounding
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S32 format
- *
- */
-
-OMX_S32 armRoundFloatToS32 (OMX_F64 Value)
-{
- if (Value > 0)
- {
- return (OMX_S32)(Value + .5);
- }
- else
- {
- return (OMX_S32)(Value - .5);
- }
-}
-/**
- * Function: armSatRoundFloatToS16
- *
- * Description:
- * Converts a double precision value into a short int after rounding and saturation
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S16 format
- *
- */
-
-OMX_S16 armSatRoundFloatToS16 (OMX_F64 Value)
-{
- if (Value > 0)
- {
- Value += 0.5;
-
- if(Value > (OMX_S16)OMX_MAX_S16 )
- {
- return (OMX_S16)OMX_MAX_S16;
- }
- else
- {
- return (OMX_S16)Value;
- }
- }
- else
- {
- Value -= 0.5;
-
- if(Value < (OMX_S16)OMX_MIN_S16 )
- {
- return (OMX_S16)OMX_MIN_S16;
- }
- else
- {
- return (OMX_S16)Value;
- }
- }
-}
-
-/**
- * Function: armSatRoundFloatToS32
- *
- * Description:
- * Converts a double precision value into a int after rounding and saturation
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S32 format
- *
- */
-
-OMX_S32 armSatRoundFloatToS32 (OMX_F64 Value)
-{
- if (Value > 0)
- {
- Value += 0.5;
-
- if(Value > (OMX_S32)OMX_MAX_S32 )
- {
- return (OMX_S32)OMX_MAX_S32;
- }
- else
- {
- return (OMX_S32)Value;
- }
- }
- else
- {
- Value -= 0.5;
-
- if(Value < (OMX_S32)OMX_MIN_S32 )
- {
- return (OMX_S32)OMX_MIN_S32;
- }
- else
- {
- return (OMX_S32)Value;
- }
- }
-}
-
-/**
- * Function: armSatRoundFloatToU16
- *
- * Description:
- * Converts a double precision value into a unsigned short int after rounding and saturation
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_U16 format
- *
- */
-
-OMX_U16 armSatRoundFloatToU16 (OMX_F64 Value)
-{
- Value += 0.5;
-
- if(Value > (OMX_U16)OMX_MAX_U16 )
- {
- return (OMX_U16)OMX_MAX_U16;
- }
- else
- {
- return (OMX_U16)Value;
- }
-}
-
-/**
- * Function: armSatRoundFloatToU32
- *
- * Description:
- * Converts a double precision value into a unsigned int after rounding and saturation
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_U32 format
- *
- */
-
-OMX_U32 armSatRoundFloatToU32 (OMX_F64 Value)
-{
- Value += 0.5;
-
- if(Value > (OMX_U32)OMX_MAX_U32 )
- {
- return (OMX_U32)OMX_MAX_U32;
- }
- else
- {
- return (OMX_U32)Value;
- }
-}
-
-/**
- * Function: armRoundFloatToS64
- *
- * Description:
- * Converts a double precision value into a 64 bit int after rounding
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S64 format
- *
- */
-
-OMX_S64 armRoundFloatToS64 (OMX_F64 Value)
-{
- if (Value > 0)
- {
- return (OMX_S64)(Value + .5);
- }
- else
- {
- return (OMX_S64)(Value - .5);
- }
-}
-
-/**
- * Function: armSignCheck
- *
- * Description:
- * Checks the sign of a variable:
- * returns 1 if it is Positive
- * returns 0 if it is 0
- * returns -1 if it is Negative
- *
- * Remarks:
- *
- * Parameters:
- * [in] var Variable to be checked
- *
- * Return Value:
- * OMX_INT -- returns 1 if it is Positive
- * returns 0 if it is 0
- * returns -1 if it is Negative
- */
-
-OMX_INT armSignCheck (
- OMX_S16 var
-)
-
-{
- OMX_INT Sign;
-
- if (var < 0)
- {
- Sign = -1;
- }
- else if ( var > 0)
- {
- Sign = 1;
- }
- else
- {
- Sign = 0;
- }
-
- return Sign;
-}
-
-/**
- * Function: armClip
- *
- * Description: Clips the input between MAX and MIN value
- *
- *
- * Remarks:
- *
- * Parameters:
- * [in] Min lower bound
- * [in] Max upper bound
- * [in] src variable to the clipped
- *
- * Return Value:
- * OMX_S32 -- returns clipped value
- */
-
-OMX_S32 armClip (
- OMX_INT min,
- OMX_INT max,
- OMX_S32 src
-)
-
-{
- if (src > max)
- {
- src = max;
- }
- else if (src < min)
- {
- src = min;
- }
-
- return src;
-}
-
-/**
- * Function: armClip_F32
- *
- * Description: Clips the input between MAX and MIN value
- *
- *
- * Remarks:
- *
- * Parameters:
- * [in] Min lower bound
- * [in] Max upper bound
- * [in] src variable to the clipped
- *
- * Return Value:
- * OMX_F32 -- returns clipped value
- */
-
-OMX_F32 armClip_F32 (
- OMX_F32 min,
- OMX_F32 max,
- OMX_F32 src
-)
-
-{
- if (src > max)
- {
- src = max;
- }
- else if (src < min)
- {
- src = min;
- }
-
- return src;
-}
-
-/**
- * Function: armShiftSat_F32
- *
- * Description: Divides a float value by 2^shift and
- * saturates it for unsigned value range for satBits.
- * Second parameter is like "shifting" the corresponding
- * integer value. Takes care of rounding while clipping the final
- * value.
- *
- * Parameters:
- * [in] v Number to be operated upon
- * [in] shift Divides the input "v" by "2^shift"
- * [in] satBits Final range is [0, 2^satBits)
- *
- * Return Value:
- * OMX_S32 -- returns "shifted" saturated value
- */
-
-OMX_U32 armShiftSat_F32(OMX_F32 v, OMX_INT shift, OMX_INT satBits)
-{
- OMX_U32 allOnes = (OMX_U32)(-1);
- OMX_U32 maxV = allOnes >> (32-satBits);
- OMX_F32 vShifted, vRounded, shiftDiv = (OMX_F32)(1 << shift);
- OMX_U32 vInt;
- OMX_U32 vIntSat;
-
- if(v <= 0)
- return 0;
-
- vShifted = v / shiftDiv;
- vRounded = (OMX_F32)(vShifted + 0.5);
- vInt = (OMX_U32)vRounded;
- vIntSat = vInt;
- if(vIntSat > maxV)
- vIntSat = maxV;
- return vIntSat;
-}
-
-/**
- * Functions: armSwapElem
- *
- * Description:
- * These function swaps two elements at the specified pointer locations.
- * The size of each element could be anything as specified by <elemSize>
- *
- * Return Value:
- * OMXResult -- Error status from the function
- */
-OMXResult armSwapElem(
- OMX_U8 *pBuf1,
- OMX_U8 *pBuf2,
- OMX_INT elemSize
- )
-{
- OMX_INT i;
- OMX_U8 temp;
- armRetArgErrIf(!pBuf1 || !pBuf2, OMX_Sts_BadArgErr);
-
- for(i = 0; i < elemSize; i++)
- {
- temp = *(pBuf1 + i);
- *(pBuf1 + i) = *(pBuf2 + i);
- *(pBuf2 + i) = temp;
- }
- return OMX_Sts_NoErr;
-}
-
-/**
- * Function: armMedianOf3
- *
- * Description: Finds the median of three numbers
- *
- * Remarks:
- *
- * Parameters:
- * [in] fEntry First entry
- * [in] sEntry second entry
- * [in] tEntry Third entry
- *
- * Return Value:
- * OMX_S32 -- returns the median value
- */
-
-OMX_S32 armMedianOf3 (
- OMX_S32 fEntry,
- OMX_S32 sEntry,
- OMX_S32 tEntry
-)
-{
- OMX_S32 a, b, c;
-
- a = armMin (fEntry, sEntry);
- b = armMax (fEntry, sEntry);
- c = armMin (b, tEntry);
- return (armMax (a, c));
-}
-
-/**
- * Function: armLogSize
- *
- * Description: Finds the size of a positive value and returns the same
- *
- * Remarks:
- *
- * Parameters:
- * [in] value Positive value
- *
- * Return Value:
- * OMX_U8 -- Returns the minimum number of bits required to represent the positive value.
- This is the smallest k>=0 such that that value is less than (1<<k).
- */
-
-OMX_U8 armLogSize (
- OMX_U16 value
-)
-{
- OMX_U8 i;
- for ( i = 0; value > 0; value = value >> 1)
- {
- i++;
- }
- return i;
-}
-
-/***********************************************************************/
- /* Saturating Arithmetic operations */
-
-/**
- * Function :armSatAdd_S32()
- *
- * Description :
- * Returns the result of saturated addition of the two inputs Value1, Value2
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- *
- * Return:
- * [out] Result of operation
- *
- *
- **/
-
-OMX_S32 armSatAdd_S32(OMX_S32 Value1,OMX_S32 Value2)
-{
- OMX_S32 Result;
-
- Result = Value1 + Value2;
-
- if( (Value1^Value2) >= 0)
- {
- /*Same sign*/
- if( (Result^Value1) >= 0)
- {
- /*Result has not saturated*/
- return Result;
- }
- else
- {
- if(Value1 >= 0)
- {
- /*Result has saturated in positive side*/
- return OMX_MAX_S32;
- }
- else
- {
- /*Result has saturated in negative side*/
- return OMX_MIN_S32;
- }
-
- }
-
- }
- else
- {
- return Result;
- }
-
-}
-
-/**
- * Function :armSatAdd_S64()
- *
- * Description :
- * Returns the result of saturated addition of the two inputs Value1, Value2
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- *
- * Return:
- * [out] Result of operation
- *
- *
- **/
-
-OMX_S64 armSatAdd_S64(OMX_S64 Value1,OMX_S64 Value2)
-{
- OMX_S64 Result;
-
- Result = Value1 + Value2;
-
- if( (Value1^Value2) >= 0)
- {
- /*Same sign*/
- if( (Result^Value1) >= 0)
- {
- /*Result has not saturated*/
- return Result;
- }
- else
- {
- if(Value1 >= 0)
- {
- /*Result has saturated in positive side*/
- Result = OMX_MAX_S64;
- return Result;
- }
- else
- {
- /*Result has saturated in negative side*/
- return OMX_MIN_S64;
- }
-
- }
-
- }
- else
- {
- return Result;
- }
-
-}
-
-/** Function :armSatSub_S32()
- *
- * Description :
- * Returns the result of saturated substraction of the two inputs Value1, Value2
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S32 armSatSub_S32(OMX_S32 Value1,OMX_S32 Value2)
-{
- OMX_S32 Result;
-
- Result = Value1 - Value2;
-
- if( (Value1^Value2) < 0)
- {
- /*Opposite sign*/
- if( (Result^Value1) >= 0)
- {
- /*Result has not saturated*/
- return Result;
- }
- else
- {
- if(Value1 >= 0)
- {
- /*Result has saturated in positive side*/
- return OMX_MAX_S32;
- }
- else
- {
- /*Result has saturated in negative side*/
- return OMX_MIN_S32;
- }
-
- }
-
- }
- else
- {
- return Result;
- }
-
-}
-
-/**
- * Function :armSatMac_S32()
- *
- * Description :
- * Returns the result of Multiplication of Value1 and Value2 and subesquent saturated
- * accumulation with Mac
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- * [in] Mac Accumulator
- *
- * Return:
- * [out] Result of operation
- **/
-
-OMX_S32 armSatMac_S32(OMX_S32 Mac,OMX_S16 Value1,OMX_S16 Value2)
-{
- OMX_S32 Result;
-
- Result = (OMX_S32)(Value1*Value2);
- Result = armSatAdd_S32( Mac , Result );
-
- return Result;
-}
-
-/**
- * Function :armSatMac_S16S32_S32
- *
- * Description :
- * Returns the result of saturated MAC operation of the three inputs delayElem, filTap , mac
- *
- * mac = mac + Saturate_in_32Bits(delayElem * filTap)
- *
- * Parametrs:
- * [in] delayElem First 32 bit Operand
- * [in] filTap Second 16 bit Operand
- * [in] mac Result of MAC operation
- *
- * Return:
- * [out] mac Result of operation
- *
- **/
-
-OMX_S32 armSatMac_S16S32_S32(OMX_S32 mac, OMX_S32 delayElem, OMX_S16 filTap )
-{
-
- OMX_S32 result;
-
- result = armSatMulS16S32_S32(filTap,delayElem);
-
- if ( result > OMX_MAX_S16 )
- {
- result = OMX_MAX_S32;
- }
- else if( result < OMX_MIN_S16 )
- {
- result = OMX_MIN_S32;
- }
- else
- {
- result = delayElem * filTap;
- }
-
- mac = armSatAdd_S32(mac,result);
-
- return mac;
-}
-
-
-/**
- * Function :armSatRoundRightShift_S32_S16
- *
- * Description :
- * Returns the result of rounded right shift operation of input by the scalefactor
- *
- * output = Saturate_in_16Bits( ( Right/LeftShift( (Round(input) , shift ) )
- *
- * Parametrs:
- * [in] input The input to be operated on
- * [in] shift The shift number
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-
-OMX_S16 armSatRoundRightShift_S32_S16(OMX_S32 input, OMX_INT shift)
-{
- input = armSatRoundLeftShift_S32(input,-shift);
-
- if ( input > OMX_MAX_S16 )
- {
- return (OMX_S16)OMX_MAX_S16;
- }
- else if (input < OMX_MIN_S16)
- {
- return (OMX_S16)OMX_MIN_S16;
- }
- else
- {
- return (OMX_S16)input;
- }
-
-}
-
-/**
- * Function :armSatRoundLeftShift_S32()
- *
- * Description :
- * Returns the result of saturating left-shift operation on input
- * Or rounded Right shift if the input Shift is negative.
- *
- * Parametrs:
- * [in] Value Operand
- * [in] Shift Operand for shift operation
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S32 armSatRoundLeftShift_S32(OMX_S32 Value, OMX_INT Shift)
-{
- OMX_INT i;
-
- if (Shift < 0)
- {
- Shift = -Shift;
- Value = armSatAdd_S32(Value, (1 << (Shift - 1)));
- Value = Value >> Shift;
- }
- else
- {
- for (i = 0; i < Shift; i++)
- {
- Value = armSatAdd_S32(Value, Value);
- }
- }
- return Value;
-}
-
-/**
- * Function :armSatRoundLeftShift_S64()
- *
- * Description :
- * Returns the result of saturating left-shift operation on input
- * Or rounded Right shift if the input Shift is negative.
- *
- * Parametrs:
- * [in] Value Operand
- * [in] shift Operand for shift operation
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S64 armSatRoundLeftShift_S64(OMX_S64 Value, OMX_INT Shift)
-{
- OMX_INT i;
-
- if (Shift < 0)
- {
- Shift = -Shift;
- Value = armSatAdd_S64(Value, ((OMX_S64)1 << (Shift - 1)));
- Value = Value >> Shift;
- }
- else
- {
- for (i = 0; i < Shift; i++)
- {
- Value = armSatAdd_S64(Value, Value);
- }
- }
- return Value;
-}
-
-/**
- * Function :armSatMulS16S32_S32()
- *
- * Description :
- * Returns the result of a S16 data type multiplied with an S32 data type
- * in a S32 container
- *
- * Parametrs:
- * [in] input1 Operand 1
- * [in] input2 Operand 2
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-
-OMX_S32 armSatMulS16S32_S32(OMX_S16 input1,OMX_S32 input2)
-{
- OMX_S16 hi2,lo1;
- OMX_U16 lo2;
-
- OMX_S32 temp1,temp2;
- OMX_S32 result;
-
- lo1 = input1;
-
- hi2 = ( input2 >> 16 );
- lo2 = ( (OMX_U32)( input2 << 16 ) >> 16 );
-
- temp1 = hi2 * lo1;
- temp2 = ( lo2* lo1 ) >> 16;
-
- result = armSatAdd_S32(temp1,temp2);
-
- return result;
-}
-
-/**
- * Function :armSatMulS32S32_S32()
- *
- * Description :
- * Returns the result of a S32 data type multiplied with an S32 data type
- * in a S32 container
- *
- * Parametrs:
- * [in] input1 Operand 1
- * [in] input2 Operand 2
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S32 armSatMulS32S32_S32(OMX_S32 input1,OMX_S32 input2)
-{
- OMX_S16 hi1,hi2;
- OMX_U16 lo1,lo2;
-
- OMX_S32 temp1,temp2,temp3;
- OMX_S32 result;
-
- hi1 = ( input1 >> 16 );
- lo1 = ( (OMX_U32)( input1 << 16 ) >> 16 );
-
- hi2 = ( input2 >> 16 );
- lo2 = ( (OMX_U32)( input2 << 16 ) >> 16 );
-
- temp1 = hi1 * hi2;
- temp2 = ( hi1* lo2 ) >> 16;
- temp3 = ( hi2* lo1 ) >> 16;
-
- result = armSatAdd_S32(temp1,temp2);
- result = armSatAdd_S32(result,temp3);
-
- return result;
-}
-
-/**
- * Function :armIntDivAwayFromZero()
- *
- * Description : Integer division with rounding to the nearest integer.
- * Half-integer values are rounded away from zero
- * unless otherwise specified. For example 3//2 is rounded
- * to 2, and -3//2 is rounded to -2.
- *
- * Parametrs:
- * [in] Num Operand 1
- * [in] Deno Operand 2
- *
- * Return:
- * [out] Result of operation input1//input2
- *
- **/
-
-OMX_S32 armIntDivAwayFromZero (OMX_S32 Num, OMX_S32 Deno)
-{
- OMX_F64 result;
-
- result = ((OMX_F64)Num)/((OMX_F64)Deno);
-
- if (result >= 0)
- {
- result += 0.5;
- }
- else
- {
- result -= 0.5;
- }
-
- return (OMX_S32)(result);
-}
-
-
-/*End of File*/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/src/armCOMM_Bitstream.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/src/armCOMM_Bitstream.c
deleted file mode 100644
index 99f53ca..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/src/armCOMM_Bitstream.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armCOMM_Bitstream.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Defines bitstream encode and decode functions common to all codecs
- */
-
-#include "omxtypes.h"
-#include "armCOMM.h"
-#include "armCOMM_Bitstream.h"
-
-/***************************************
- * Fixed bit length Decode
- ***************************************/
-
-/**
- * Function: armLookAheadBits()
- *
- * Description:
- * Get the next N bits from the bitstream without advancing the bitstream pointer
- *
- * Parameters:
- * [in] **ppBitStream
- * [in] *pOffset
- * [in] N=1...32
- *
- * Returns Value
- */
-
-OMX_U32 armLookAheadBits(const OMX_U8 **ppBitStream, OMX_INT *pOffset, OMX_INT N)
-{
- const OMX_U8 *pBitStream = *ppBitStream;
- OMX_INT Offset = *pOffset;
- OMX_U32 Value;
-
- armAssert(Offset>=0 && Offset<=7);
- armAssert(N>=1 && N<=32);
-
- /* Read next 32 bits from stream */
- Value = (pBitStream[0] << 24 ) | ( pBitStream[1] << 16) | (pBitStream[2] << 8 ) | (pBitStream[3]) ;
- Value = (Value << Offset ) | (pBitStream[4] >> (8-Offset));
-
- /* Return N bits */
- return Value >> (32-N);
-}
-
-
-/**
- * Function: armGetBits()
- *
- * Description:
- * Read N bits from the bitstream
- *
- * Parameters:
- * [in] *ppBitStream
- * [in] *pOffset
- * [in] N=1..32
- *
- * [out] *ppBitStream
- * [out] *pOffset
- * Returns Value
- */
-
-
-OMX_U32 armGetBits(const OMX_U8 **ppBitStream, OMX_INT *pOffset, OMX_INT N)
-{
- const OMX_U8 *pBitStream = *ppBitStream;
- OMX_INT Offset = *pOffset;
- OMX_U32 Value;
-
- if(N == 0)
- {
- return 0;
- }
-
- armAssert(Offset>=0 && Offset<=7);
- armAssert(N>=1 && N<=32);
-
- /* Read next 32 bits from stream */
- Value = (pBitStream[0] << 24 ) | ( pBitStream[1] << 16) | (pBitStream[2] << 8 ) | (pBitStream[3]) ;
- Value = (Value << Offset ) | (pBitStream[4] >> (8-Offset));
-
- /* Advance bitstream pointer by N bits */
- Offset += N;
- *ppBitStream = pBitStream + (Offset>>3);
- *pOffset = Offset & 7;
-
- /* Return N bits */
- return Value >> (32-N);
-}
-
-/**
- * Function: armByteAlign()
- *
- * Description:
- * Align the pointer *ppBitStream to the next byte boundary
- *
- * Parameters:
- * [in] *ppBitStream
- * [in] *pOffset
- *
- * [out] *ppBitStream
- * [out] *pOffset
- *
- **/
-
-OMXVoid armByteAlign(const OMX_U8 **ppBitStream,OMX_INT *pOffset)
-{
- if(*pOffset > 0)
- {
- *ppBitStream += 1;
- *pOffset = 0;
- }
-}
-
-/**
- * Function: armSkipBits()
- *
- * Description:
- * Skip N bits from the value at *ppBitStream
- *
- * Parameters:
- * [in] *ppBitStream
- * [in] *pOffset
- * [in] N
- *
- * [out] *ppBitStream
- * [out] *pOffset
- *
- **/
-
-
-OMXVoid armSkipBits(const OMX_U8 **ppBitStream,OMX_INT *pOffset,OMX_INT N)
-{
- OMX_INT Offset = *pOffset;
- const OMX_U8 *pBitStream = *ppBitStream;
-
- /* Advance bitstream pointer by N bits */
- Offset += N;
- *ppBitStream = pBitStream + (Offset>>3);
- *pOffset = Offset & 7;
-}
-
-/***************************************
- * Variable bit length Decode
- ***************************************/
-
-/**
- * Function: armUnPackVLC32()
- *
- * Description:
- * Variable length decode of variable length symbol (max size 32 bits) read from
- * the bit stream pointed by *ppBitStream at *pOffset by using the table
- * pointed by pCodeBook
- *
- * Parameters:
- * [in] *pBitStream
- * [in] *pOffset
- * [in] pCodeBook
- *
- * [out] *pBitStream
- * [out] *pOffset
- *
- * Returns : Code Book Index if successfull.
- * : ARM_NO_CODEBOOK_INDEX = -1 if search fails.
- **/
-#ifndef C_OPTIMIZED_IMPLEMENTATION
-
-OMX_U16 armUnPackVLC32(
- const OMX_U8 **ppBitStream,
- OMX_INT *pOffset,
- const ARM_VLC32 *pCodeBook
-)
-{
- const OMX_U8 *pBitStream = *ppBitStream;
- OMX_INT Offset = *pOffset;
- OMX_U32 Value;
- OMX_INT Index;
-
- armAssert(Offset>=0 && Offset<=7);
-
- /* Read next 32 bits from stream */
- Value = (pBitStream[0] << 24 ) | ( pBitStream[1] << 16) | (pBitStream[2] << 8 ) | (pBitStream[3]) ;
- Value = (Value << Offset ) | (pBitStream[4] >> (8-Offset));
-
- /* Search through the codebook */
- for (Index=0; pCodeBook->codeLen != 0; Index++)
- {
- if (pCodeBook->codeWord == (Value >> (32 - pCodeBook->codeLen)))
- {
- Offset = Offset + pCodeBook->codeLen;
- *ppBitStream = pBitStream + (Offset >> 3) ;
- *pOffset = Offset & 7;
-
- return Index;
- }
- pCodeBook++;
- }
-
- /* No code match found */
- return ARM_NO_CODEBOOK_INDEX;
-}
-
-#endif
-
-/***************************************
- * Fixed bit length Encode
- ***************************************/
-
-/**
- * Function: armPackBits
- *
- * Description:
- * Pack a VLC code word into the bitstream
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte
- * in the bit stream.
- * [in] pOffset pointer to the bit position in the byte
- * pointed by *ppBitStream. Valid within 0
- * to 7.
- * [in] codeWord Code word that need to be inserted in to the
- * bitstream
- * [in] codeLength Length of the code word valid range 1...32
- *
- * [out] ppBitStream *ppBitStream is updated after the block is encoded,
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMX_RESULT result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armPackBits (
- OMX_U8 **ppBitStream,
- OMX_INT *pOffset,
- OMX_U32 codeWord,
- OMX_INT codeLength
-)
-{
- OMX_U8 *pBitStream = *ppBitStream;
- OMX_INT Offset = *pOffset;
- OMX_U32 Value;
-
- /* checking argument validity */
- armRetArgErrIf(Offset < 0, OMX_Sts_BadArgErr);
- armRetArgErrIf(Offset > 7, OMX_Sts_BadArgErr);
- armRetArgErrIf(codeLength < 1, OMX_Sts_BadArgErr);
- armRetArgErrIf(codeLength > 32, OMX_Sts_BadArgErr);
-
- /* Prepare the first byte */
- codeWord = codeWord << (32-codeLength);
- Value = (pBitStream[0] >> (8-Offset)) << (8-Offset);
- Value = Value | (codeWord >> (24+Offset));
-
- /* Write out whole bytes */
- while (8-Offset <= codeLength)
- {
- *pBitStream++ = (OMX_U8)Value;
- codeWord = codeWord << (8-Offset);
- codeLength = codeLength - (8-Offset);
- Offset = 0;
- Value = codeWord >> 24;
- }
-
- /* Write out final partial byte */
- *pBitStream = (OMX_U8)Value;
- *ppBitStream = pBitStream;
- *pOffset = Offset + codeLength;
-
- return OMX_Sts_NoErr;
-}
-
-/***************************************
- * Variable bit length Encode
- ***************************************/
-
-/**
- * Function: armPackVLC32
- *
- * Description:
- * Pack a VLC code word into the bitstream
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte
- * in the bit stream.
- * [in] pBitOffset pointer to the bit position in the byte
- * pointed by *ppBitStream. Valid within 0
- * to 7.
- * [in] code VLC code word that need to be inserted in to the
- * bitstream
- *
- * [out] ppBitStream *ppBitStream is updated after the block is encoded,
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMX_RESULT result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armPackVLC32 (
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- ARM_VLC32 code
-)
-{
- return (armPackBits(ppBitStream, pBitOffset, code.codeWord, code.codeLen));
-}
-
-/*End of File*/
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/src/armCOMM_IDCTTable.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/src/armCOMM_IDCTTable.c
deleted file mode 100644
index 6f0b87f..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/src/armCOMM_IDCTTable.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armCOMM_IDCTTable.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * File: armCOMM_IDCTTable.c
- * Brief: Defines Tables used in IDCT computation
- *
- */
-
-#include "armCOMM_IDCTTable.h"
-
- /* Table of s(u)*A(u)*A(v)/16 at Q15
- * s(u)=1.0 0 <= u <= 5
- * s(6)=2.0
- * s(7)=4.0
- * A(0) = 2*sqrt(2)
- * A(u) = 4*cos(u*pi/16) for (u!=0)
- */
-
-__align(4) const OMX_U16 armCOMM_IDCTPreScale [64] =
-{
- 0x4000, 0x58c5, 0x539f, 0x4b42, 0x4000, 0x3249, 0x4546, 0x46a1,
- 0x58c5, 0x7b21, 0x73fc, 0x6862, 0x58c5, 0x45bf, 0x6016, 0x61f8,
- 0x539f, 0x73fc, 0x6d41, 0x6254, 0x539f, 0x41b3, 0x5a82, 0x5c48,
- 0x4b42, 0x6862, 0x6254, 0x587e, 0x4b42, 0x3b21, 0x5175, 0x530d,
- 0x4000, 0x58c5, 0x539f, 0x4b42, 0x4000, 0x3249, 0x4546, 0x46a1,
- 0x3249, 0x45bf, 0x41b3, 0x3b21, 0x3249, 0x2782, 0x366d, 0x377e,
- 0x22a3, 0x300b, 0x2d41, 0x28ba, 0x22a3, 0x1b37, 0x257e, 0x263a,
- 0x11a8, 0x187e, 0x1712, 0x14c3, 0x11a8, 0x0de0, 0x131d, 0x137d
-};
- /* Above array armCOMM_IDCTPreScale, in Q23 format */
-const OMX_U32 armCOMM_IDCTPreScaleU32 [64] =
-{
- 0x400000, 0x58c543, 0x539eba, 0x4b418c, 0x400000, 0x3248d4, 0x4545ea, 0x46a157,
- 0x58c543, 0x7b20d8, 0x73fbfc, 0x686214, 0x58c543, 0x45bf1f, 0x6015a5, 0x61f78b,
- 0x539eba, 0x73fbfc, 0x6d413d, 0x6253a6, 0x539eba, 0x41b328, 0x5a827a, 0x5c4869,
- 0x4b418c, 0x686214, 0x6253a6, 0x587de3, 0x4b418c, 0x3b20d8, 0x5174e0, 0x530d69,
- 0x400000, 0x58c543, 0x539eba, 0x4b418c, 0x400000, 0x3248d4, 0x4545ea, 0x46a157,
- 0x3248d4, 0x45bf1f, 0x41b328, 0x3b20d8, 0x3248d4, 0x27821d, 0x366d72, 0x377e6b,
- 0x22a2f5, 0x300ad3, 0x2d413d, 0x28ba70, 0x22a2f5, 0x1b36b9, 0x257d86, 0x26398d,
- 0x11a856, 0x187de3, 0x17121a, 0x14c35a, 0x11a856, 0x0ddf9b, 0x131cc7, 0x137ca2
-};
-
-const OMX_U16 armCOMM_IDCTCoef [4] =
-{
- 0x5a82, /* InvSqrt2 */
- 0x30fc, /* SinPIBy8 */
- 0x7642, /* CosPIBy8 */
- 0x0000
-};
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/src/armCOMM_MaskTable.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/src/armCOMM_MaskTable.c
deleted file mode 100644
index 906a8e5..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/src/armCOMM_MaskTable.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: armCOMM_MaskTable.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Mask Table to mask the end of array.
- *
- */
-
-#include "omxtypes.h"
-
-#define MaskTableSize 72
-
-const OMX_U16 armCOMM_qMaskTable16[MaskTableSize] =
-{
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0xFFFF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0x0000,
- 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000,
- 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000,
- 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000,
- 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF
-};
-
-const OMX_U8 armCOMM_qMaskTable8[MaskTableSize] =
-{
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
-};
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/api/armVC.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/api/armVC.h
deleted file mode 100644
index 6dbe8b6..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/api/armVC.h
+++ /dev/null
@@ -1,1168 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVC.h
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * File: armVideo.h
- * Brief: Declares API's/Basic Data types used across the OpenMAX Video domain
- *
- */
-
-
-#ifndef _armVideo_H_
-#define _armVideo_H_
-
-#include "omxVC.h"
-#include "armCOMM_Bitstream.h"
-
-/**
- * ARM specific state structure to hold Motion Estimation information.
- */
-
-struct m4p2_MESpec
-{
- OMXVCM4P2MEParams MEParams;
- OMXVCM4P2MEMode MEMode;
-};
-
-struct m4p10_MESpec
-{
- OMXVCM4P10MEParams MEParams;
- OMXVCM4P10MEMode MEMode;
-};
-
-typedef struct m4p2_MESpec ARMVCM4P2_MESpec;
-typedef struct m4p10_MESpec ARMVCM4P10_MESpec;
-
-/**
- * Function: armVCM4P2_CompareMV
- *
- * Description:
- * Performs comparision of motion vectors and SAD's to decide the
- * best MV and SAD
- *
- * Remarks:
- *
- * Parameters:
- * [in] mvX x coordinate of the candidate motion vector
- * [in] mvY y coordinate of the candidate motion vector
- * [in] candSAD Candidate SAD
- * [in] bestMVX x coordinate of the best motion vector
- * [in] bestMVY y coordinate of the best motion vector
- * [in] bestSAD best SAD
- *
- * Return Value:
- * OMX_INT -- 1 to indicate that the current sad is the best
- * 0 to indicate that it is NOT the best SAD
- */
-
-OMX_INT armVCM4P2_CompareMV (
- OMX_S16 mvX,
- OMX_S16 mvY,
- OMX_INT candSAD,
- OMX_S16 bestMVX,
- OMX_S16 bestMVY,
- OMX_INT bestSAD);
-
-/**
- * Function: armVCM4P2_ACDCPredict
- *
- * Description:
- * Performs adaptive DC/AC coefficient prediction for an intra block. Prior
- * to the function call, prediction direction (predDir) should be selected
- * as specified in subclause 7.4.3.1 of ISO/IEC 14496-2.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcDst pointer to the coefficient buffer which contains
- * the quantized coefficient residuals (PQF) of the
- * current block
- * [in] pPredBufRow pointer to the coefficient row buffer
- * [in] pPredBufCol pointer to the coefficient column buffer
- * [in] curQP quantization parameter of the current block. curQP
- * may equal to predQP especially when the current
- * block and the predictor block are in the same
- * macroblock.
- * [in] predQP quantization parameter of the predictor block
- * [in] predDir indicates the prediction direction which takes one
- * of the following values:
- * OMX_VIDEO_HORIZONTAL predict horizontally
- * OMX_VIDEO_VERTICAL predict vertically
- * [in] ACPredFlag a flag indicating if AC prediction should be
- * performed. It is equal to ac_pred_flag in the bit
- * stream syntax of MPEG-4
- * [in] videoComp video component type (luminance, chrominance or
- * alpha) of the current block
- * [in] flag This flag defines the if one wants to use this functions to
- * calculate PQF (set 1, prediction) or QF (set 0, reconstruction)
- * [out] pPreACPredict pointer to the predicted coefficients buffer.
- * Filled ONLY if it is not NULL
- * [out] pSrcDst pointer to the coefficient buffer which contains
- * the quantized coefficients (QF) of the current
- * block
- * [out] pPredBufRow pointer to the updated coefficient row buffer
- * [out] pPredBufCol pointer to the updated coefficient column buffer
- * [out] pSumErr pointer to the updated sum of the difference
- * between predicted and unpredicted coefficients
- * If this is NULL, do not update
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_ACDCPredict(
- OMX_S16 * pSrcDst,
- OMX_S16 * pPreACPredict,
- OMX_S16 * pPredBufRow,
- OMX_S16 * pPredBufCol,
- OMX_INT curQP,
- OMX_INT predQP,
- OMX_INT predDir,
- OMX_INT ACPredFlag,
- OMXVCM4P2VideoComponent videoComp,
- OMX_U8 flag,
- OMX_INT *pSumErr
-);
-
-/**
- * Function: armVCM4P2_SetPredDir
- *
- * Description:
- * Performs detecting the prediction direction
- *
- * Remarks:
- *
- * Parameters:
- * [in] blockIndex block index indicating the component type and
- * position as defined in subclause 6.1.3.8, of ISO/IEC
- * 14496-2. Furthermore, indexes 6 to 9 indicate the
- * alpha blocks spatially corresponding to luminance
- * blocks 0 to 3 in the same macroblock.
- * [in] pCoefBufRow pointer to the coefficient row buffer
- * [in] pQpBuf pointer to the quantization parameter buffer
- * [out] predQP quantization parameter of the predictor block
- * [out] predDir indicates the prediction direction which takes one
- * of the following values:
- * OMX_VIDEO_HORIZONTAL predict horizontally
- * OMX_VIDEO_VERTICAL predict vertically
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_SetPredDir(
- OMX_INT blockIndex,
- OMX_S16 *pCoefBufRow,
- OMX_S16 *pCoefBufCol,
- OMX_INT *predDir,
- OMX_INT *predQP,
- const OMX_U8 *pQpBuf
-);
-
-/**
- * Function: armVCM4P2_EncodeVLCZigzag_Intra
- *
- * Description:
- * Performs zigzag scanning and VLC encoding for one intra block.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bit stream
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * by *ppBitStream. Valid within 0 to 7.
- * [in] pQDctBlkCoef pointer to the quantized DCT coefficient
- * [in] predDir AC prediction direction, which is used to decide
- * the zigzag scan pattern. This takes one of the
- * following values:
- * OMX_VIDEO_NONE AC prediction not used.
- * Performs classical zigzag
- * scan.
- * OMX_VIDEO_HORIZONTAL Horizontal prediction.
- * Performs alternate-vertical
- * zigzag scan.
- * OMX_VIDEO_VERTICAL Vertical prediction.
- * Performs alternate-horizontal
- * zigzag scan.
- * [in] pattern block pattern which is used to decide whether
- * this block is encoded
- * [in] start start indicates whether the encoding begins with 0th element
- * or 1st.
- * [out] ppBitStream *ppBitStream is updated after the block is encoded,
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_EncodeVLCZigzag_Intra(
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- const OMX_S16 *pQDctBlkCoef,
- OMX_U8 predDir,
- OMX_U8 pattern,
- OMX_INT shortVideoHeader,
- OMX_U8 start
-);
-
-/**
- * Function: armVCM4P2_DecodeVLCZigzag_Intra
- *
- * Description:
- * Performs VLC decoding and inverse zigzag scan for one intra coded block.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bitstream buffer
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * to by *ppBitStream. *pBitOffset is valid within
- * [0-7].
- * [in] predDir AC prediction direction which is used to decide
- * the zigzag scan pattern. It takes one of the
- * following values:
- * OMX_VIDEO_NONE AC prediction not used;
- * perform classical zigzag scan;
- * OMX_VIDEO_HORIZONTAL Horizontal prediction;
- * perform alternate-vertical
- * zigzag scan;
- * OMX_VIDEO_VERTICAL Vertical prediction;
- * thus perform
- * alternate-horizontal
- * zigzag scan.
- * [in] videoComp video component type (luminance, chrominance or
- * alpha) of the current block
- * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0,
- * and escape mode 4 is used when shortVideoHeader==1.
- * [in] start start indicates whether the encoding begins with 0th element
- * or 1st.
- * [out] ppBitStream *ppBitStream is updated after the block is
- * decoded, so that it points to the current byte
- * in the bit stream buffer
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream
- * [out] pDst pointer to the coefficient buffer of current
- * block. Should be 32-bit aligned
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_DecodeVLCZigzag_Intra(
- const OMX_U8 ** ppBitStream,
- OMX_INT * pBitOffset,
- OMX_S16 * pDst,
- OMX_U8 predDir,
- OMX_INT shortVideoHeader,
- OMX_U8 start
-);
-
-/**
- * Function: armVCM4P2_FillVLDBuffer
- *
- * Description:
- * Performs filling of the coefficient buffer according to the run, level
- * and sign, also updates the index
- *
- * Parameters:
- * [in] storeRun Stored Run value (count of zeros)
- * [in] storeLevel Stored Level value (non-zero value)
- * [in] sign Flag indicating the sign of level
- * [in] last status of the last flag
- * [in] pIndex pointer to coefficient index in 8x8 matrix
- * [out] pIndex pointer to updated coefficient index in 8x8
- * matrix
- * [in] pZigzagTable pointer to the zigzag tables
- * [out] pDst pointer to the coefficient buffer of current
- * block. Should be 32-bit aligned
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_FillVLDBuffer(
- OMX_U32 storeRun,
- OMX_S16 * pDst,
- OMX_S16 storeLevel,
- OMX_U8 sign,
- OMX_U8 last,
- OMX_U8 * index,
- const OMX_U8 * pZigzagTable
-);
-
-/**
- * Function: armVCM4P2_GetVLCBits
- *
- * Description:
- * Performs escape mode decision based on the run, run+, level, level+ and
- * last combinations.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bit stream
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * by *ppBitStream. Valid within 0 to 7
- * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0,
- * and escape mode 4 is used when shortVideoHeader==1.
- * [in] start start indicates whether the encoding begins with
- * 0th element or 1st.
- * [in/out] pLast pointer to last status flag
- * [in] runBeginSingleLevelEntriesL0 The run value from which level
- * will be equal to 1: last == 0
- * [in] IndexBeginSingleLevelEntriesL0 Array index in the VLC table
- * pointing to the
- * runBeginSingleLevelEntriesL0
- * [in] runBeginSingleLevelEntriesL1 The run value from which level
- * will be equal to 1: last == 1
- * [in] IndexBeginSingleLevelEntriesL1 Array index in the VLC table
- * pointing to the
- * runBeginSingleLevelEntriesL0
- * [in] pRunIndexTableL0 Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pVlcTableL0 VLC table for last == 0
- * [in] pRunIndexTableL1 Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [in] pVlcTableL1 VLC table for last == 1
- * [in] pLMAXTableL0 Level MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pLMAXTableL1 Level MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [in] pRMAXTableL0 Run MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pRMAXTableL1 Run MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [out]pDst pointer to the coefficient buffer of current
- * block. Should be 32-bit aligned
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_GetVLCBits (
- const OMX_U8 **ppBitStream,
- OMX_INT * pBitOffset,
- OMX_S16 * pDst,
- OMX_INT shortVideoHeader,
- OMX_U8 start,
- OMX_U8 * pLast,
- OMX_U8 runBeginSingleLevelEntriesL0,
- OMX_U8 maxIndexForMultipleEntriesL0,
- OMX_U8 maxRunForMultipleEntriesL1,
- OMX_U8 maxIndexForMultipleEntriesL1,
- const OMX_U8 * pRunIndexTableL0,
- const ARM_VLC32 *pVlcTableL0,
- const OMX_U8 * pRunIndexTableL1,
- const ARM_VLC32 *pVlcTableL1,
- const OMX_U8 * pLMAXTableL0,
- const OMX_U8 * pLMAXTableL1,
- const OMX_U8 * pRMAXTableL0,
- const OMX_U8 * pRMAXTableL1,
- const OMX_U8 * pZigzagTable
-);
-
-/**
- * Function: armVCM4P2_PutVLCBits
- *
- * Description:
- * Checks the type of Escape Mode and put encoded bits for
- * quantized DCT coefficients.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bit stream
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * by *ppBitStream. Valid within 0 to 7
- * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0,
- * and escape mode 4 is used when shortVideoHeader==1.
- * [in] start start indicates whether the encoding begins with
- * 0th element or 1st.
- * [in] maxStoreRunL0 Max store possible (considering last and inter/intra)
- * for last = 0
- * [in] maxStoreRunL1 Max store possible (considering last and inter/intra)
- * for last = 1
- * [in] maxRunForMultipleEntriesL0
- * The run value after which level
- * will be equal to 1:
- * (considering last and inter/intra status) for last = 0
- * [in] maxRunForMultipleEntriesL1
- * The run value after which level
- * will be equal to 1:
- * (considering last and inter/intra status) for last = 1
- * [in] pRunIndexTableL0 Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pVlcTableL0 VLC table for last == 0
- * [in] pRunIndexTableL1 Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [in] pVlcTableL1 VLC table for last == 1
- * [in] pLMAXTableL0 Level MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pLMAXTableL1 Level MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [in] pRMAXTableL0 Run MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pRMAXTableL1 Run MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [out] pQDctBlkCoef pointer to the quantized DCT coefficient
- * [out] ppBitStream *ppBitStream is updated after the block is encoded
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-
-OMXResult armVCM4P2_PutVLCBits (
- OMX_U8 **ppBitStream,
- OMX_INT * pBitOffset,
- const OMX_S16 *pQDctBlkCoef,
- OMX_INT shortVideoHeader,
- OMX_U8 start,
- OMX_U8 maxStoreRunL0,
- OMX_U8 maxStoreRunL1,
- OMX_U8 maxRunForMultipleEntriesL0,
- OMX_U8 maxRunForMultipleEntriesL1,
- const OMX_U8 * pRunIndexTableL0,
- const ARM_VLC32 *pVlcTableL0,
- const OMX_U8 * pRunIndexTableL1,
- const ARM_VLC32 *pVlcTableL1,
- const OMX_U8 * pLMAXTableL0,
- const OMX_U8 * pLMAXTableL1,
- const OMX_U8 * pRMAXTableL0,
- const OMX_U8 * pRMAXTableL1,
- const OMX_U8 * pZigzagTable
-);
-/**
- * Function: armVCM4P2_FillVLCBuffer
- *
- * Description:
- * Performs calculating the VLC bits depending on the escape type and insert
- * the same in the bitstream
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bit stream
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * by *ppBitStream. Valid within 0 to 7
- * [in] run Run value (count of zeros) to be encoded
- * [in] level Level value (non-zero value) to be encoded
- * [in] runPlus Calculated as runPlus = run - (RMAX + 1)
- * [in] levelPlus Calculated as
- * levelPlus = sign(level)*[abs(level) - LMAX]
- * [in] fMode Flag indicating the escape modes
- * [in] last status of the last flag
- * [in] maxRunForMultipleEntries
- * The run value after which level will be equal to 1:
- * (considering last and inter/intra status)
- * [in] pRunIndexTable Run Index table defined in
- * armVCM4P2_Huff_tables_VLC.h
- * [in] pVlcTable VLC table defined in armVCM4P2_Huff_tables_VLC.h
- * [out] ppBitStream *ppBitStream is updated after the block is encoded
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_FillVLCBuffer (
- OMX_U8 **ppBitStream,
- OMX_INT * pBitOffset,
- OMX_U32 run,
- OMX_S16 level,
- OMX_U32 runPlus,
- OMX_S16 levelPlus,
- OMX_U8 fMode,
- OMX_U8 last,
- OMX_U8 maxRunForMultipleEntries,
- const OMX_U8 *pRunIndexTable,
- const ARM_VLC32 *pVlcTable
-);
-
-/**
- * Function: armVCM4P2_CheckVLCEscapeMode
- *
- * Description:
- * Performs escape mode decision based on the run, run+, level, level+ and
- * last combinations.
- *
- * Remarks:
- *
- * Parameters:
- * [in] run Run value (count of zeros) to be encoded
- * [in] level Level value (non-zero value) to be encoded
- * [in] runPlus Calculated as runPlus = run - (RMAX + 1)
- * [in] levelPlus Calculated as
- * levelPlus = sign(level)*[abs(level) - LMAX]
- * [in] maxStoreRun Max store possible (considering last and inter/intra)
- * [in] maxRunForMultipleEntries
- * The run value after which level
- * will be equal to 1:
- * (considering last and inter/intra status)
- * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0,
- * and escape mode 4 is used when shortVideoHeader==1.
- * [in] pRunIndexTable Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.c
- * (considering last and inter/intra status)
- *
- *
- * Return Value:
- * Returns an Escape mode which can take values from 0 to 3
- * 0 --> no escape mode, 1 --> escape type 1,
- * 1 --> escape type 2, 3 --> escape type 3, check section 7.4.1.3
- * in the MPEG ISO standard.
- *
- */
-
-OMX_U8 armVCM4P2_CheckVLCEscapeMode(
- OMX_U32 run,
- OMX_U32 runPlus,
- OMX_S16 level,
- OMX_S16 levelPlus,
- OMX_U8 maxStoreRun,
- OMX_U8 maxRunForMultipleEntries,
- OMX_INT shortVideoHeader,
- const OMX_U8 *pRunIndexTable
-);
-
-
-/**
- * Function: armVCM4P2_BlockMatch_Integer
- *
- * Description:
- * Performs a 16x16 block search; estimates motion vector and associated minimum SAD.
- * Both the input and output motion vectors are represented using half-pixel units, and
- * therefore a shift left or right by 1 bit may be required, respectively, to match the
- * input or output MVs with other functions that either generate output MVs or expect
- * input MVs represented using integer pixel units.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcRefBuf pointer to the reference Y plane; points to the reference MB that
- * corresponds to the location of the current macroblock in the current
- * plane.
- * [in] refWidth width of the reference plane
- * [in] pRefRect pointer to the valid rectangular in reference plane. Relative to image origin.
- * It's not limited to the image boundary, but depended on the padding. For example,
- * if you pad 4 pixels outside the image border, then the value for left border
- * can be -4
- * [in] pSrcCurrBuf pointer to the current macroblock extracted from original plane (linear array,
- * 256 entries); must be aligned on an 8-byte boundary.
- * [in] pCurrPointPos position of the current macroblock in the current plane
- * [in] pSrcPreMV pointer to predicted motion vector; NULL indicates no predicted MV
- * [in] pSrcPreSAD pointer to SAD associated with the predicted MV (referenced by pSrcPreMV)
- * [in] searchRange search range for 16X16 integer block,the units of it is full pixel,the search range
- * is the same in all directions.It is in inclusive of the boundary and specified in
- * terms of integer pixel units.
- * [in] pMESpec vendor-specific motion estimation specification structure; must have been allocated
- * and then initialized using omxVCM4P2_MEInit prior to calling the block matching
- * function.
- * [in] BlockSize MacroBlock Size i.e either 16x16 or 8x8.
- * [out] pDstMV pointer to estimated MV
- * [out] pDstSAD pointer to minimum SAD
- *
- * Return Value:
- * OMX_Sts_NoErr ¨C no error.
- * OMX_Sts_BadArgErr ¨C bad arguments
- *
- */
-
-OMXResult armVCM4P2_BlockMatch_Integer(
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- const OMXVCMotionVector *pSrcPreMV,
- const OMX_INT *pSrcPreSAD,
- void *pMESpec,
- OMXVCMotionVector *pDstMV,
- OMX_INT *pDstSAD,
- OMX_U8 BlockSize
-);
-
-/**
- * Function: armVCM4P2_BlockMatch_Half
- *
- * Description:
- * Performs a 16x16 block match with half-pixel resolution. Returns the estimated
- * motion vector and associated minimum SAD. This function estimates the half-pixel
- * motion vector by interpolating the integer resolution motion vector referenced
- * by the input parameter pSrcDstMV, i.e., the initial integer MV is generated
- * externally. The input parameters pSrcRefBuf and pSearchPointRefPos should be
- * shifted by the winning MV of 16x16 integer search prior to calling BlockMatch_Half_16x16.
- * The function BlockMatch_Integer_16x16 may be used for integer motion estimation.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcRefBuf pointer to the reference Y plane; points to the reference MB
- * that corresponds to the location of the current macroblock in
- * the current plane.
- * [in] refWidth width of the reference plane
- * [in] pRefRect reference plane valid region rectangle
- * [in] pSrcCurrBuf pointer to the current macroblock extracted from original plane
- * (linear array, 256 entries); must be aligned on an 8-byte boundary.
- * [in] pSearchPointRefPos position of the starting point for half pixel search (specified
- * in terms of integer pixel units) in the reference plane.
- * [in] rndVal rounding control bit for half pixel motion estimation;
- * 0=rounding control disabled; 1=rounding control enabled
- * [in] pSrcDstMV pointer to the initial MV estimate; typically generated during a prior
- * 16X16 integer search and its unit is half pixel.
- * [in] BlockSize MacroBlock Size i.e either 16x16 or 8x8.
- * [out]pSrcDstMV pointer to estimated MV
- * [out]pDstSAD pointer to minimum SAD
- *
- * Return Value:
- * OMX_Sts_NoErr ¨C no error
- * OMX_Sts_BadArgErr ¨C bad arguments
- *
- */
-
-OMXResult armVCM4P2_BlockMatch_Half(
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pSearchPointRefPos,
- OMX_INT rndVal,
- OMXVCMotionVector *pSrcDstMV,
- OMX_INT *pDstSAD,
- OMX_U8 BlockSize
-);
-/**
- * Function: armVCM4P2_PadMV
- *
- * Description:
- * Performs motion vector padding for a macroblock.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcDstMV pointer to motion vector buffer of the current
- * macroblock
- * [in] pTransp pointer to transparent status buffer of the
- * current macroblock
- * [out] pSrcDstMV pointer to motion vector buffer in which the
- * motion vectors have been padded
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_PadMV(
- OMXVCMotionVector * pSrcDstMV,
- OMX_U8 * pTransp
-);
-
-/*
- * H.264 Specific Declarations
- */
-/* Defines */
-#define ARM_M4P10_Q_OFFSET (15)
-
-
-/* Dequant tables */
-
-extern const OMX_U8 armVCM4P10_PosToVCol4x4[16];
-extern const OMX_U8 armVCM4P10_PosToVCol2x2[4];
-extern const OMX_U8 armVCM4P10_VMatrix[6][3];
-extern const OMX_U32 armVCM4P10_MFMatrix[6][3];
-
-
-/*
- * Description:
- * This function perform the work required by the OpenMAX
- * DecodeCoeffsToPair function and DecodeChromaDCCoeffsToPair.
- * Since most of the code is common we share it here.
- *
- * Parameters:
- * [in] ppBitStream Double pointer to current byte in bit stream buffer
- * [in] pOffset Pointer to current bit position in the byte pointed
- * to by *ppBitStream
- * [in] sMaxNumCoeff Maximum number of non-zero coefficients in current
- * block (4,15 or 16)
- * [in] nTable Table number (0 to 4) according to the five columns
- * of Table 9-5 in the H.264 spec
- * [out] ppBitStream *ppBitStream is updated after each block is decoded
- * [out] pOffset *pOffset is updated after each block is decoded
- * [out] pNumCoeff Pointer to the number of nonzero coefficients in
- * this block
- * [out] ppPosCoefbuf Double pointer to destination residual
- * coefficient-position pair buffer
- * Return Value:
- * Standard omxError result. See enumeration for possible result codes.
-
- */
-
-OMXResult armVCM4P10_DecodeCoeffsToPair(
- const OMX_U8** ppBitStream,
- OMX_S32* pOffset,
- OMX_U8* pNumCoeff,
- OMX_U8**ppPosCoefbuf,
- OMX_INT nTable,
- OMX_INT sMaxNumCoeff
- );
-
-/*
- * Description:
- * Perform DC style intra prediction, averaging upper and left block
- *
- * Parameters:
- * [in] pSrcLeft Pointer to the buffer of 16 left coefficients:
- * p[x, y] (x = -1, y = 0..3)
- * [in] pSrcAbove Pointer to the buffer of 16 above coefficients:
- * p[x,y] (x = 0..3, y = -1)
- * [in] leftStep Step of left coefficient buffer
- * [in] dstStep Step of the destination buffer
- * [in] availability Neighboring 16x16 MB availability flag
- * [out] pDst Pointer to the destination buffer
- *
- * Return Value:
- * None
- */
-
-void armVCM4P10_PredictIntraDC4x4(
- const OMX_U8* pSrcLeft,
- const OMX_U8 *pSrcAbove,
- OMX_U8* pDst,
- OMX_INT leftStep,
- OMX_INT dstStep,
- OMX_S32 availability
-);
-
-/*
- * Description
- * Unpack a 4x4 block of coefficient-residual pair values
- *
- * Parameters:
- * [in] ppSrc Double pointer to residual coefficient-position pair
- * buffer output by CALVC decoding
- * [out] ppSrc *ppSrc is updated to the start of next non empty block
- * [out] pDst Pointer to unpacked 4x4 block
- */
-
-void armVCM4P10_UnpackBlock4x4(
- const OMX_U8 **ppSrc,
- OMX_S16* pDst
-);
-
-/*
- * Description
- * Unpack a 2x2 block of coefficient-residual pair values
- *
- * Parameters:
- * [in] ppSrc Double pointer to residual coefficient-position pair
- * buffer output by CALVC decoding
- * [out] ppSrc *ppSrc is updated to the start of next non empty block
- * [out] pDst Pointer to unpacked 4x4 block
- */
-
-void armVCM4P10_UnpackBlock2x2(
- const OMX_U8 **ppSrc,
- OMX_S16* pDst
-);
-
-/*
- * Description
- * Deblock one boundary pixel
- *
- * Parameters:
- * [in] pQ0 Pointer to pixel q0
- * [in] Step Step between pixels q0 and q1
- * [in] tC0 Edge threshold value
- * [in] alpha alpha threshold value
- * [in] beta beta threshold value
- * [in] bS deblocking strength
- * [in] ChromaFlag True for chroma blocks
- * [out] pQ0 Deblocked pixels
- *
- */
-
-void armVCM4P10_DeBlockPixel(
- OMX_U8 *pQ0, /* pointer to the pixel q0 */
- int Step, /* step between pixels q0 and q1 */
- int tC0, /* edge threshold value */
- int alpha, /* alpha */
- int beta, /* beta */
- int bS, /* deblocking strength */
- int ChromaFlag
-);
-
-/**
- * Function: armVCM4P10_InterpolateHalfHor_Luma
- *
- * Description:
- * This function performs interpolation for horizontal 1/2-pel positions
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block used to interpolate
- in the reconstructed frame plane
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination(interpolation) buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [out] pDst Pointer to the interpolation buffer of the 1/2-pel
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-
-OMXResult armVCM4P10_InterpolateHalfHor_Luma(
- const OMX_U8* pSrc,
- OMX_U32 iSrcStep,
- OMX_U8* pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-);
-
-/**
- * Function: armVCM4P10_InterpolateHalfVer_Luma
- *
- * Description:
- * This function performs interpolation for vertical 1/2-pel positions
- * around a full-pel position.
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block used to interpolate
- * in the reconstructed frame plane
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination(interpolation) buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [out] pDst Pointer to the interpolation buffer of the 1/2-pel
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-
-OMXResult armVCM4P10_InterpolateHalfVer_Luma(
- const OMX_U8* pSrc,
- OMX_U32 iSrcStep,
- OMX_U8* pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-);
-
-/**
- * Function: armVCM4P10_InterpolateHalfDiag_Luma
- *
- * Description:
- * This function performs interpolation for (1/2, 1/2) positions
- * around a full-pel position.
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block used to interpolate
- * in the reconstructed frame plane
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination(interpolation) buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [out] pDst Pointer to the interpolation buffer of the (1/2,1/2)-pel
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-
-OMXResult armVCM4P10_InterpolateHalfDiag_Luma(
- const OMX_U8* pSrc,
- OMX_U32 iSrcStep,
- OMX_U8* pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-);
-
-/*
- * Description:
- * Transform Residual 4x4 Coefficients
- *
- * Parameters:
- * [in] pSrc Source 4x4 block
- * [out] pDst Destination 4x4 block
- *
- */
-
-void armVCM4P10_TransformResidual4x4(OMX_S16* pDst, OMX_S16 *pSrc);
-
-/*
- * Description:
- * Forward Transform Residual 4x4 Coefficients
- *
- * Parameters:
- * [in] pSrc Source 4x4 block
- * [out] pDst Destination 4x4 block
- *
- */
-
-void armVCM4P10_FwdTransformResidual4x4(OMX_S16* pDst, OMX_S16 *pSrc);
-
-OMX_INT armVCM4P10_CompareMotionCostToMV (
- OMX_S16 mvX,
- OMX_S16 mvY,
- OMXVCMotionVector diffMV,
- OMX_INT candSAD,
- OMXVCMotionVector *bestMV,
- OMX_U32 nLamda,
- OMX_S32 *pBestCost);
-
-/**
- * Function: armVCCOMM_SAD
- *
- * Description:
- * This function calculate the SAD for NxM blocks.
- *
- * Remarks:
- *
- * [in] pSrcOrg Pointer to the original block
- * [in] iStepOrg Step of the original block buffer
- * [in] pSrcRef Pointer to the reference block
- * [in] iStepRef Step of the reference block buffer
- * [in] iHeight Height of the block
- * [in] iWidth Width of the block
- * [out] pDstSAD Pointer of result SAD
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-OMXResult armVCCOMM_SAD(
- const OMX_U8* pSrcOrg,
- OMX_U32 iStepOrg,
- const OMX_U8* pSrcRef,
- OMX_U32 iStepRef,
- OMX_S32* pDstSAD,
- OMX_U32 iHeight,
- OMX_U32 iWidth);
-
-/**
- * Function: armVCCOMM_Average
- *
- * Description:
- * This function calculates the average of two blocks and stores the result.
- *
- * Remarks:
- *
- * [in] pPred0 Pointer to the top-left corner of reference block 0
- * [in] pPred1 Pointer to the top-left corner of reference block 1
- * [in] iPredStep0 Step of reference block 0
- * [in] iPredStep1 Step of reference block 1
- * [in] iDstStep Step of the destination buffer
- * [in] iWidth Width of the blocks
- * [in] iHeight Height of the blocks
- * [out] pDstPred Pointer to the destination buffer
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
- OMXResult armVCCOMM_Average (
- const OMX_U8* pPred0,
- const OMX_U8* pPred1,
- OMX_U32 iPredStep0,
- OMX_U32 iPredStep1,
- OMX_U8* pDstPred,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-);
-
-/**
- * Function: armVCM4P10_SADQuar
- *
- * Description:
- * This function calculates the SAD between one block (pSrc) and the
- * average of the other two (pSrcRef0 and pSrcRef1)
- *
- * Remarks:
- *
- * [in] pSrc Pointer to the original block
- * [in] pSrcRef0 Pointer to reference block 0
- * [in] pSrcRef1 Pointer to reference block 1
- * [in] iSrcStep Step of the original block buffer
- * [in] iRefStep0 Step of reference block 0
- * [in] iRefStep1 Step of reference block 1
- * [in] iHeight Height of the block
- * [in] iWidth Width of the block
- * [out] pDstSAD Pointer of result SAD
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-OMXResult armVCM4P10_SADQuar(
- const OMX_U8* pSrc,
- const OMX_U8* pSrcRef0,
- const OMX_U8* pSrcRef1,
- OMX_U32 iSrcStep,
- OMX_U32 iRefStep0,
- OMX_U32 iRefStep1,
- OMX_U32* pDstSAD,
- OMX_U32 iHeight,
- OMX_U32 iWidth
-);
-
-/**
- * Function: armVCM4P10_Interpolate_Chroma
- *
- * Description:
- * This function performs interpolation for chroma components.
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block used to
- * interpolate in the reconstructed frame plane
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination(interpolation) buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [in] dx Fractional part of horizontal motion vector
- * component in 1/8 pixel unit (0~7)
- * [in] dy Fractional part of vertical motion vector
- * component in 1/8 pixel unit (0~7)
- * [out] pDst Pointer to the interpolation buffer
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
- OMXResult armVCM4P10_Interpolate_Chroma(
- OMX_U8 *pSrc,
- OMX_U32 iSrcStep,
- OMX_U8 *pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight,
- OMX_U32 dx,
- OMX_U32 dy
-);
-
-/**
- * Function: armVCM4P10_Interpolate_Luma
- *
- * Description:
- * This function performs interpolation for luma components.
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block used to
- * interpolate in the reconstructed frame plane
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination(interpolation) buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [in] dx Fractional part of horizontal motion vector
- * component in 1/4 pixel unit (0~3)
- * [in] dy Fractional part of vertical motion vector
- * component in 1/4 pixel unit (0~3)
- * [out] pDst Pointer to the interpolation buffer
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-
- OMXResult armVCM4P10_Interpolate_Luma(
- const OMX_U8 *pSrc,
- OMX_U32 iSrcStep,
- OMX_U8 *pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight,
- OMX_U32 dx,
- OMX_U32 dy
-);
-
-/**
- * Function: omxVCH264_DequantTransformACFromPair_U8_S16_C1_DLx
- *
- * Description:
- * Reconstruct the 4x4 residual block from coefficient-position pair buffer,
- * perform dequantisation and integer inverse transformation for 4x4 block of
- * residuals and update the pair buffer pointer to next non-empty block.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppSrc Double pointer to residual coefficient-position
- * pair buffer output by CALVC decoding
- * [in] pDC Pointer to the DC coefficient of this block, NULL
- * if it doesn't exist
- * [in] QP Quantization parameter
- * [in] AC Flag indicating if at least one non-zero coefficient exists
- * [out] pDst pointer to the reconstructed 4x4 block data
- *
- * Return Value:
- * Standard omxError result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P10_DequantTransformACFromPair_U8_S16_C1_DLx(
- OMX_U8 **ppSrc,
- OMX_S16 *pDst,
- OMX_INT QP,
- OMX_S16* pDC,
- int AC
-);
-
-#endif /*_armVideo_H_*/
-
-/*End of File*/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/api/armVCCOMM_s.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/api/armVCCOMM_s.h
deleted file mode 100644
index a9d4644..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/api/armVCCOMM_s.h
+++ /dev/null
@@ -1,86 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCCOMM_s.h
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-;// ARM optimized OpenMAX AC header file
-;//
-;// Formula used:
-;// MACRO for calculating median for three values.
-
-
-
- IF :LNOT::DEF:ARMVCCOMM_S_H
- INCLUDE armCOMM_s.h
- M_VARIANTS CortexA8, ARM1136JS
-
- IF ARM1136JS :LOR: CortexA8
-
- ;///*
- ;// * Macro: M_MEDIAN3
- ;// *
- ;// * Description: Finds the median of three numbers
- ;// *
- ;// * Remarks:
- ;// *
- ;// * Parameters:
- ;// * [in] x First entry for the list of three numbers.
- ;// * [in] y Second entry for the list of three numbers.
- ;// * Input value may be corrupted at the end of
- ;// * the execution of this macro.
- ;// * [in] z Third entry of the list of three numbers.
- ;// * Input value corrupted at the end of the
- ;// * execution of this macro.
- ;// * [in] t Temporary scratch register.
- ;// * [out]z Median of the three numbers.
- ;// */
-
- MACRO
-
- M_MEDIAN3 $x, $y, $z, $t
-
- SUBS $t, $y, $z; // if (y < z)
- ADDLT $z, $z, $t; // swap y and z
- SUBLT $y, $y, $t;
-
- ;// Now z' <= y', so there are three cases for the
- ;// median value, depending on x.
-
- ;// 1) x <= z' <= y' : median value is z'
- ;// 2) z' <= x <= y' : median value is x
- ;// 3) z' <= y' <= x : median value is y'
-
- CMP $z, $x; // if ( x > min(y,z) )
- MOVLT $z, $x; // ans = x
-
- CMP $x, $y; // if ( x > max(y,z) )
- MOVGT $z, $y; // ans = max(y,z)
-
- MEND
- ENDIF
-
-
-
- ENDIF ;// ARMACCOMM_S_H
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/api/omxVC.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/api/omxVC.h
deleted file mode 100644
index 7b3cc72..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/api/omxVC.h
+++ /dev/null
@@ -1,4381 +0,0 @@
-/**
- * File: omxVC.h
- * Brief: OpenMAX DL v1.0.2 - Video Coding library
- *
- * Copyright © 2005-2008 The Khronos Group Inc. All Rights Reserved.
- *
- * These materials are protected by copyright laws and contain material
- * proprietary to the Khronos Group, Inc. You may use these materials
- * for implementing Khronos specifications, without altering or removing
- * any trademark, copyright or other notice from the specification.
- *
- * Khronos Group makes no, and expressly disclaims any, representations
- * or warranties, express or implied, regarding these materials, including,
- * without limitation, any implied warranties of merchantability or fitness
- * for a particular purpose or non-infringement of any intellectual property.
- * Khronos Group makes no, and expressly disclaims any, warranties, express
- * or implied, regarding the correctness, accuracy, completeness, timeliness,
- * and reliability of these materials.
- *
- * Under no circumstances will the Khronos Group, or any of its Promoters,
- * Contributors or Members or their respective partners, officers, directors,
- * employees, agents or representatives be liable for any damages, whether
- * direct, indirect, special or consequential damages for lost revenues,
- * lost profits, or otherwise, arising from or in connection with these
- * materials.
- *
- * Khronos and OpenMAX are trademarks of the Khronos Group Inc.
- *
- */
-
-/* *****************************************************************************************/
-
-#ifndef _OMXVC_H_
-#define _OMXVC_H_
-
-#include "omxtypes.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* 6.1.1.1 Motion Vectors */
-/* In omxVC, motion vectors are represented as follows: */
-
-typedef struct {
- OMX_S16 dx;
- OMX_S16 dy;
-} OMXVCMotionVector;
-
-
-
-/**
- * Function: omxVCCOMM_Average_8x (6.1.3.1.1)
- *
- * Description:
- * This function calculates the average of two 8x4, 8x8, or 8x16 blocks. The
- * result is rounded according to (a+b+1)/2. The block average function can
- * be used in conjunction with half-pixel interpolation to obtain quarter
- * pixel motion estimates, as described in [ISO14496-10], subclause 8.4.2.2.1.
- *
- * Input Arguments:
- *
- * pPred0 - Pointer to the top-left corner of reference block 0
- * pPred1 - Pointer to the top-left corner of reference block 1
- * iPredStep0 - Step of reference block 0
- * iPredStep1 - Step of reference block 1
- * iDstStep - Step of the destination buffer.
- * iHeight - Height of the blocks
- *
- * Output Arguments:
- *
- * pDstPred - Pointer to the destination buffer. 8-byte aligned.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - one or more of the following pointers is NULL: pPred0, pPred1, or
- * pDstPred.
- * - pDstPred is not aligned on an 8-byte boundary.
- * - iPredStep0 <= 0 or iPredStep0 is not a multiple of 8.
- * - iPredStep1 <= 0 or iPredStep1 is not a multiple of 8.
- * - iDstStep <= 0 or iDstStep is not a multiple of 8.
- * - iHeight is not 4, 8, or 16.
- *
- */
-OMXResult omxVCCOMM_Average_8x (
- const OMX_U8 *pPred0,
- const OMX_U8 *pPred1,
- OMX_U32 iPredStep0,
- OMX_U32 iPredStep1,
- OMX_U8 *pDstPred,
- OMX_U32 iDstStep,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCCOMM_Average_16x (6.1.3.1.2)
- *
- * Description:
- * This function calculates the average of two 16x16 or 16x8 blocks. The
- * result is rounded according to (a+b+1)/2. The block average function can
- * be used in conjunction with half-pixel interpolation to obtain quarter
- * pixel motion estimates, as described in [ISO14496-10], subclause 8.4.2.2.1.
- *
- * Input Arguments:
- *
- * pPred0 - Pointer to the top-left corner of reference block 0
- * pPred1 - Pointer to the top-left corner of reference block 1
- * iPredStep0 - Step of reference block 0
- * iPredStep1 - Step of reference block 1
- * iDstStep - Step of the destination buffer
- * iHeight - Height of the blocks
- *
- * Output Arguments:
- *
- * pDstPred - Pointer to the destination buffer. 16-byte aligned.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - one or more of the following pointers is NULL: pPred0, pPred1, or
- * pDstPred.
- * - pDstPred is not aligned on a 16-byte boundary.
- * - iPredStep0 <= 0 or iPredStep0 is not a multiple of 16.
- * - iPredStep1 <= 0 or iPredStep1 is not a multiple of 16.
- * - iDstStep <= 0 or iDstStep is not a multiple of 16.
- * - iHeight is not 8 or 16.
- *
- */
-OMXResult omxVCCOMM_Average_16x (
- const OMX_U8 *pPred0,
- const OMX_U8 *pPred1,
- OMX_U32 iPredStep0,
- OMX_U32 iPredStep1,
- OMX_U8 *pDstPred,
- OMX_U32 iDstStep,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCCOMM_ExpandFrame_I (6.1.3.2.1)
- *
- * Description:
- * This function expands a reconstructed frame in-place. The unexpanded
- * source frame should be stored in a plane buffer with sufficient space
- * pre-allocated for edge expansion, and the input frame should be located in
- * the plane buffer center. This function executes the pixel expansion by
- * replicating source frame edge pixel intensities in the empty pixel
- * locations (expansion region) between the source frame edge and the plane
- * buffer edge. The width/height of the expansion regions on the
- * horizontal/vertical edges is controlled by the parameter iExpandPels.
- *
- * Input Arguments:
- *
- * pSrcDstPlane - pointer to the top-left corner of the frame to be
- * expanded; must be aligned on an 8-byte boundary.
- * iFrameWidth - frame width; must be a multiple of 8.
- * iFrameHeight -frame height; must be a multiple of 8.
- * iExpandPels - number of pixels to be expanded in the horizontal and
- * vertical directions; must be a multiple of 8.
- * iPlaneStep - distance, in bytes, between the start of consecutive lines
- * in the plane buffer; must be larger than or equal to
- * (iFrameWidth + 2 * iExpandPels).
- *
- * Output Arguments:
- *
- * pSrcDstPlane -Pointer to the top-left corner of the frame (NOT the
- * top-left corner of the plane); must be aligned on an 8-byte
- * boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - pSrcDstPlane is NULL.
- * - pSrcDstPlane is not aligned on an 8-byte boundary.
- * - one of the following parameters is either equal to zero or is a
- * non-multiple of 8: iFrameHeight, iFrameWidth, iPlaneStep, or
- * iExpandPels.
- * - iPlaneStep < (iFrameWidth + 2 * iExpandPels).
- *
- */
-OMXResult omxVCCOMM_ExpandFrame_I (
- OMX_U8 *pSrcDstPlane,
- OMX_U32 iFrameWidth,
- OMX_U32 iFrameHeight,
- OMX_U32 iExpandPels,
- OMX_U32 iPlaneStep
-);
-
-
-
-/**
- * Function: omxVCCOMM_Copy8x8 (6.1.3.3.1)
- *
- * Description:
- * Copies the reference 8x8 block to the current block.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the reference block in the source frame; must be
- * aligned on an 8-byte boundary.
- * step - distance between the starts of consecutive lines in the reference
- * frame, in bytes; must be a multiple of 8 and must be larger than
- * or equal to 8.
- *
- * Output Arguments:
- *
- * pDst - pointer to the destination block; must be aligned on an 8-byte
- * boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - one or more of the following pointers is NULL: pSrc, pDst
- * - one or more of the following pointers is not aligned on an 8-byte
- * boundary: pSrc, pDst
- * - step <8 or step is not a multiple of 8.
- *
- */
-OMXResult omxVCCOMM_Copy8x8 (
- const OMX_U8 *pSrc,
- OMX_U8 *pDst,
- OMX_INT step
-);
-
-
-
-/**
- * Function: omxVCCOMM_Copy16x16 (6.1.3.3.2)
- *
- * Description:
- * Copies the reference 16x16 macroblock to the current macroblock.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the reference macroblock in the source frame; must be
- * aligned on a 16-byte boundary.
- * step - distance between the starts of consecutive lines in the reference
- * frame, in bytes; must be a multiple of 16 and must be larger
- * than or equal to 16.
- *
- * Output Arguments:
- *
- * pDst - pointer to the destination macroblock; must be aligned on a
- * 16-byte boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - one or more of the following pointers is NULL: pSrc, pDst
- * - one or more of the following pointers is not aligned on a 16-byte
- * boundary: pSrc, pDst
- * - step <16 or step is not a multiple of 16.
- *
- */
-OMXResult omxVCCOMM_Copy16x16 (
- const OMX_U8 *pSrc,
- OMX_U8 *pDst,
- OMX_INT step
-);
-
-
-
-/**
- * Function: omxVCCOMM_ComputeTextureErrorBlock_SAD (6.1.4.1.1)
- *
- * Description:
- * Computes texture error of the block; also returns SAD.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the source plane; must be aligned on an 8-byte
- * boundary.
- * srcStep - step of the source plane
- * pSrcRef - pointer to the reference buffer, an 8x8 block; must be aligned
- * on an 8-byte boundary.
- *
- * Output Arguments:
- *
- * pDst - pointer to the destination buffer, an 8x8 block; must be aligned
- * on an 8-byte boundary.
- * pDstSAD - pointer to the Sum of Absolute Differences (SAD) value
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - At least one of the following
- * pointers is NULL: pSrc, pSrcRef, pDst and pDstSAD.
- * - pSrc is not 8-byte aligned.
- * - SrcStep <= 0 or srcStep is not a multiple of 8.
- * - pSrcRef is not 8-byte aligned.
- * - pDst is not 8-byte aligned.
- *
- */
-OMXResult omxVCCOMM_ComputeTextureErrorBlock_SAD (
- const OMX_U8 *pSrc,
- OMX_INT srcStep,
- const OMX_U8 *pSrcRef,
- OMX_S16 *pDst,
- OMX_INT *pDstSAD
-);
-
-
-
-/**
- * Function: omxVCCOMM_ComputeTextureErrorBlock (6.1.4.1.2)
- *
- * Description:
- * Computes the texture error of the block.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the source plane. This should be aligned on an 8-byte
- * boundary.
- * srcStep - step of the source plane
- * pSrcRef - pointer to the reference buffer, an 8x8 block. This should be
- * aligned on an 8-byte boundary.
- *
- * Output Arguments:
- *
- * pDst - pointer to the destination buffer, an 8x8 block. This should be
- * aligned on an 8-byte boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - At least one of the following pointers is NULL:
- * pSrc, pSrcRef, pDst.
- * - pSrc is not 8-byte aligned.
- * - SrcStep <= 0 or srcStep is not a multiple of 8.
- * - pSrcRef is not 8-byte aligned.
- * - pDst is not 8-byte aligned
- *
- */
-OMXResult omxVCCOMM_ComputeTextureErrorBlock (
- const OMX_U8 *pSrc,
- OMX_INT srcStep,
- const OMX_U8 *pSrcRef,
- OMX_S16 *pDst
-);
-
-
-
-/**
- * Function: omxVCCOMM_LimitMVToRect (6.1.4.1.3)
- *
- * Description:
- * Limits the motion vector associated with the current block/macroblock to
- * prevent the motion compensated block/macroblock from moving outside a
- * bounding rectangle as shown in Figure 6-1.
- *
- * Input Arguments:
- *
- * pSrcMV - pointer to the motion vector associated with the current block
- * or macroblock
- * pRectVOPRef - pointer to the bounding rectangle
- * Xcoord, Ycoord - coordinates of the current block or macroblock
- * size - size of the current block or macroblock; must be equal to 8 or
- * 16.
- *
- * Output Arguments:
- *
- * pDstMV - pointer to the limited motion vector
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one or more of the
- * following conditions is true:
- * - at least one of the following pointers is NULL:
- * pSrcMV, pDstMV, or pRectVOPRef.
- * - size is not equal to either 8 or 16.
- * - the width or height of the bounding rectangle is less than
- * twice the block size.
- */
-OMXResult omxVCCOMM_LimitMVToRect (
- const OMXVCMotionVector *pSrcMV,
- OMXVCMotionVector *pDstMV,
- const OMXRect *pRectVOPRef,
- OMX_INT Xcoord,
- OMX_INT Ycoord,
- OMX_INT size
-);
-
-
-
-/**
- * Function: omxVCCOMM_SAD_16x (6.1.4.1.4)
- *
- * Description:
- * This function calculates the SAD for 16x16 and 16x8 blocks.
- *
- * Input Arguments:
- *
- * pSrcOrg - Pointer to the original block; must be aligned on a 16-byte
- * boundary.
- * iStepOrg - Step of the original block buffer
- * pSrcRef - Pointer to the reference block
- * iStepRef - Step of the reference block buffer
- * iHeight - Height of the block
- *
- * Output Arguments:
- *
- * pDstSAD - Pointer of result SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one or more of the
- * following conditions is true:
- * - at least one of the following pointers is NULL:
- * pSrcOrg, pDstSAD, or pSrcRef
- * - pSrcOrg is not 16-byte aligned.
- * - iStepOrg <= 0 or iStepOrg is not a multiple of 16
- * - iStepRef <= 0 or iStepRef is not a multiple of 16
- * - iHeight is not 8 or 16
- *
- */
-OMXResult omxVCCOMM_SAD_16x (
- const OMX_U8 *pSrcOrg,
- OMX_U32 iStepOrg,
- const OMX_U8 *pSrcRef,
- OMX_U32 iStepRef,
- OMX_S32 *pDstSAD,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCCOMM_SAD_8x (6.1.4.1.5)
- *
- * Description:
- * This function calculates the SAD for 8x16, 8x8, 8x4 blocks.
- *
- * Input Arguments:
- *
- * pSrcOrg - Pointer to the original block; must be aligned on a 8-byte
- * boundary.
- * iStepOrg - Step of the original block buffer
- * pSrcRef - Pointer to the reference block
- * iStepRef - Step of the reference block buffer
- * iHeight - Height of the block
- *
- * Output Arguments:
- *
- * pDstSAD -Pointer of result SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one or more of the
- * following conditions is true:
- * - at least one of the following pointers is NULL:
- * pSrcOrg, pDstSAD, or pSrcRef
- * - pSrcOrg is not 8-byte aligned.
- * - iStepOrg <= 0 or iStepOrg is not a multiple of 8
- * - iStepRef <= 0 or iStepRef is not a multiple of 8
- * - iHeight is not 4, 8 or 16
- *
- */
-OMXResult omxVCCOMM_SAD_8x (
- const OMX_U8 *pSrcOrg,
- OMX_U32 iStepOrg,
- const OMX_U8 *pSrcRef,
- OMX_U32 iStepRef,
- OMX_S32*pDstSAD,
- OMX_U32 iHeight
-);
-
-
-
-/* 6.2.1.1 Direction */
-/* The direction enumerator is used with functions that perform AC/DC prediction and zig-zag scan. */
-
-enum {
- OMX_VC_NONE = 0,
- OMX_VC_HORIZONTAL = 1,
- OMX_VC_VERTICAL = 2
-};
-
-
-
-/* 6.2.1.2 Bilinear Interpolation */
-/* The bilinear interpolation enumerator is used with motion estimation, motion compensation, and reconstruction functions. */
-
-enum {
- OMX_VC_INTEGER_PIXEL = 0, /* case a */
- OMX_VC_HALF_PIXEL_X = 1, /* case b */
- OMX_VC_HALF_PIXEL_Y = 2, /* case c */
- OMX_VC_HALF_PIXEL_XY = 3 /* case d */
-};
-
-
-
-/* 6.2.1.3 Neighboring Macroblock Availability */
-/* Neighboring macroblock availability is indicated using the following flags: */
-
-enum {
- OMX_VC_UPPER = 1, /** above macroblock is available */
- OMX_VC_LEFT = 2, /** left macroblock is available */
- OMX_VC_CENTER = 4,
- OMX_VC_RIGHT = 8,
- OMX_VC_LOWER = 16,
- OMX_VC_UPPER_LEFT = 32, /** above-left macroblock is available */
- OMX_VC_UPPER_RIGHT = 64, /** above-right macroblock is available */
- OMX_VC_LOWER_LEFT = 128,
- OMX_VC_LOWER_RIGHT = 256
-};
-
-
-
-/* 6.2.1.4 Video Components */
-/* A data type that enumerates video components is defined as follows: */
-
-typedef enum {
- OMX_VC_LUMINANCE, /** Luminance component */
- OMX_VC_CHROMINANCE /** chrominance component */
-} OMXVCM4P2VideoComponent;
-
-
-
-/* 6.2.1.5 MacroblockTypes */
-/* A data type that enumerates macroblock types is defined as follows: */
-
-typedef enum {
- OMX_VC_INTER = 0, /** P picture or P-VOP */
- OMX_VC_INTER_Q = 1, /** P picture or P-VOP */
- OMX_VC_INTER4V = 2, /** P picture or P-VOP */
- OMX_VC_INTRA = 3, /** I and P picture, I- and P-VOP */
- OMX_VC_INTRA_Q = 4, /** I and P picture, I- and P-VOP */
- OMX_VC_INTER4V_Q = 5 /** P picture or P-VOP (H.263)*/
-} OMXVCM4P2MacroblockType;
-
-
-
-/* 6.2.1.6 Coordinates */
-/* Coordinates are represented as follows: */
-
-typedef struct {
- OMX_INT x;
- OMX_INT y;
-} OMXVCM4P2Coordinate;
-
-
-
-/* 6.2.1.7 Motion Estimation Algorithms */
-/* A data type that enumerates motion estimation search methods is defined as follows: */
-
-typedef enum {
- OMX_VC_M4P2_FAST_SEARCH = 0, /** Fast motion search */
- OMX_VC_M4P2_FULL_SEARCH = 1 /** Full motion search */
-} OMXVCM4P2MEMode;
-
-
-
-/* 6.2.1.8 Motion Estimation Parameters */
-/* A data structure containing control parameters for
- * motion estimation functions is defined as follows:
- */
-
-typedef struct {
- OMX_INT searchEnable8x8; /** enables 8x8 search */
- OMX_INT halfPelSearchEnable; /** enables half-pel resolution */
- OMX_INT searchRange; /** search range */
- OMX_INT rndVal; /** rounding control; 0-disabled, 1-enabled*/
-} OMXVCM4P2MEParams;
-
-
-
-/* 6.2.1.9 Macroblock Information */
-/* A data structure containing macroblock parameters for
- * motion estimation functions is defined as follows:
- */
-
-typedef struct {
- OMX_S32 sliceId; /* slice number */
- OMXVCM4P2MacroblockType mbType; /* MB type: OMX_VC_INTRA, OMX_VC_INTER, or OMX_VC_INTER4 */
- OMX_S32 qp; /* quantization parameter*/
- OMX_U32 cbpy; /* CBP Luma */
- OMX_U32 cbpc; /* CBP Chroma */
- OMXVCMotionVector pMV0[2][2]; /* motion vector, represented using 1/2-pel units,
- * pMV0[blocky][blockx] (blocky = 0~1, blockx =0~1)
- */
- OMXVCMotionVector pMVPred[2][2]; /* motion vector prediction, represented using 1/2-pel units,
- * pMVPred[blocky][blockx] (blocky = 0~1, blockx = 0~1)
- */
- OMX_U8 pPredDir[2][2]; /* AC prediction direction:
- * OMX_VC_NONE, OMX_VC_VERTICAL, OMX_VC_HORIZONTAL
- */
-} OMXVCM4P2MBInfo, *OMXVCM4P2MBInfoPtr;
-
-
-
-/**
- * Function: omxVCM4P2_FindMVpred (6.2.3.1.1)
- *
- * Description:
- * Predicts a motion vector for the current block using the procedure
- * specified in [ISO14496-2], subclause 7.6.5. The resulting predicted MV is
- * returned in pDstMVPred. If the parameter pDstMVPredME if is not NULL then
- * the set of three MV candidates used for prediction is also returned,
- * otherwise pDstMVPredMEis NULL upon return.
- *
- * Input Arguments:
- *
- * pSrcMVCurMB - pointer to the MV buffer associated with the current Y
- * macroblock; a value of NULL indicates unavailability.
- * pSrcCandMV1 - pointer to the MV buffer containing the 4 MVs associated
- * with the MB located to the left of the current MB; set to NULL
- * if there is no MB to the left.
- * pSrcCandMV2 - pointer to the MV buffer containing the 4 MVs associated
- * with the MB located above the current MB; set to NULL if there
- * is no MB located above the current MB.
- * pSrcCandMV3 - pointer to the MV buffer containing the 4 MVs associated
- * with the MB located to the right and above the current MB; set
- * to NULL if there is no MB located to the above-right.
- * iBlk - the index of block in the current macroblock
- * pDstMVPredME - MV candidate return buffer; if set to NULL then
- * prediction candidate MVs are not returned and pDstMVPredME will
- * be NULL upon function return; if pDstMVPredME is non-NULL then it
- * must point to a buffer containing sufficient space for three
- * return MVs.
- *
- * Output Arguments:
- *
- * pDstMVPred - pointer to the predicted motion vector
- * pDstMVPredME - if non-NULL upon input then pDstMVPredME points upon
- * return to a buffer containing the three motion vector candidates
- * used for prediction as specified in [ISO14496-2], subclause
- * 7.6.5, otherwise if NULL upon input then pDstMVPredME is NULL
- * upon output.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - the pointer pDstMVPred is NULL
- * - the parameter iBlk does not fall into the range 0 <= iBlk<=3
- *
- */
-OMXResult omxVCM4P2_FindMVpred (
- const OMXVCMotionVector *pSrcMVCurMB,
- const OMXVCMotionVector *pSrcCandMV1,
- const OMXVCMotionVector *pSrcCandMV2,
- const OMXVCMotionVector *pSrcCandMV3,
- OMXVCMotionVector *pDstMVPred,
- OMXVCMotionVector *pDstMVPredME,
- OMX_INT iBlk
-);
-
-
-
-/**
- * Function: omxVCM4P2_IDCT8x8blk (6.2.3.2.1)
- *
- * Description:
- * Computes a 2D inverse DCT for a single 8x8 block, as defined in
- * [ISO14496-2].
- *
- * Input Arguments:
- *
- * pSrc - pointer to the start of the linearly arranged IDCT input buffer;
- * must be aligned on a 16-byte boundary. According to
- * [ISO14496-2], the input coefficient values should lie within the
- * range [-2048, 2047].
- *
- * Output Arguments:
- *
- * pDst - pointer to the start of the linearly arranged IDCT output buffer;
- * must be aligned on a 16-byte boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - pSrc or pDst is NULL.
- * - pSrc or pDst is not 16-byte aligned.
- *
- */
-OMXResult omxVCM4P2_IDCT8x8blk (
- const OMX_S16 *pSrc,
- OMX_S16 *pDst
-);
-
-
-
-/**
- * Function: omxVCM4P2_MEGetBufSize (6.2.4.1.1)
- *
- * Description:
- * Computes the size, in bytes, of the vendor-specific specification
- * structure for the following motion estimation functions:
- * BlockMatch_Integer_8x8, BlockMatch_Integer_16x16, and MotionEstimationMB.
- *
- * Input Arguments:
- *
- * MEmode - motion estimation mode; available modes are defined by the
- * enumerated type OMXVCM4P2MEMode
- * pMEParams - motion estimation parameters
- *
- * Output Arguments:
- *
- * pSize - pointer to the number of bytes required for the specification
- * structure
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - one or more of the following is true:
- * - an invalid value was specified for the parameter MEmode
- * - a negative or zero value was specified for the
- * parameter pMEParams->searchRange
- *
- */
-OMXResult omxVCM4P2_MEGetBufSize (
- OMXVCM4P2MEMode MEmode,
- const OMXVCM4P2MEParams *pMEParams,
- OMX_U32 *pSize
-);
-
-
-
-/**
- * Function: omxVCM4P2_MEInit (6.2.4.1.2)
- *
- * Description:
- * Initializes the vendor-specific specification structure required for the
- * following motion estimation functions: BlockMatch_Integer_8x8,
- * BlockMatch_Integer_16x16, and MotionEstimationMB. Memory for the
- * specification structure *pMESpec must be allocated prior to calling the
- * function, and should be aligned on a 4-byte boundary. Following
- * initialization by this function, the vendor-specific structure *pMESpec
- * should contain an implementation-specific representation of all motion
- * estimation parameters received via the structure pMEParams, for example
- * rndVal, searchRange, etc. The number of bytes required for the
- * specification structure can be determined using the function
- * omxVCM4P2_MEGetBufSize.
- *
- * Input Arguments:
- *
- * MEmode - motion estimation mode; available modes are defined by the
- * enumerated type OMXVCM4P2MEMode
- * pMEParams - motion estimation parameters
- * pMESpec - pointer to the uninitialized ME specification structure
- *
- * Output Arguments:
- *
- * pMESpec - pointer to the initialized ME specification structure
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - one or more of the following is true:
- * - an invalid value was specified for the parameter MEmode
- * - a negative or zero value was specified for the
- * parameter pMEParams->searchRange
- *
- */
-OMXResult omxVCM4P2_MEInit (
- OMXVCM4P2MEMode MEmode,
- const OMXVCM4P2MEParams*pMEParams,
- void *pMESpec
-);
-
-
-
-/**
- * Function: omxVCM4P2_BlockMatch_Integer_16x16 (6.2.4.2.1)
- *
- * Description:
- * Performs a 16x16 block search; estimates motion vector and associated
- * minimum SAD. Both the input and output motion vectors are represented using
- * half-pixel units, and therefore a shift left or right by 1 bit may be
- * required, respectively, to match the input or output MVs with other
- * functions that either generate output MVs or expect input MVs represented
- * using integer pixel units.
- *
- * Input Arguments:
- *
- * pSrcRefBuf - pointer to the reference Y plane; points to the reference
- * MB that corresponds to the location of the current macroblock in
- * the current plane.
- * refWidth - width of the reference plane
- * pRefRect - pointer to the valid reference plane rectangle; coordinates
- * are specified relative to the image origin. Rectangle
- * boundaries may extend beyond image boundaries if the image has
- * been padded. For example, if padding extends 4 pixels beyond
- * frame border, then the value for the left border could be set to
- * -4.
- * pSrcCurrBuf - pointer to the current block in the current macroblock
- * buffer extracted from the original plane (linear array, 256
- * entries); must be aligned on a 16-byte boundary. The number of
- * bytes between lines (step) is 16.
- * pCurrPointPos - position of the current macroblock in the current plane
- * pSrcPreMV - pointer to predicted motion vector; NULL indicates no
- * predicted MV
- * pSrcPreSAD - pointer to SAD associated with the predicted MV (referenced
- * by pSrcPreMV); may be set to NULL if unavailable.
- * pMESpec - vendor-specific motion estimation specification structure;
- * must have been allocated and then initialized using
- * omxVCM4P2_MEInit prior to calling the block matching function.
- *
- * Output Arguments:
- *
- * pDstMV - pointer to estimated MV
- * pDstSAD - pointer to minimum SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following
- * conditions is true:
- * - at least one of the following pointers is NULL: pSrcRefBuf,
- * pRefRect, pSrcCurrBuff, pCurrPointPos, pDstMV, pDstSAD or
- * pMESpec, or
- * - pSrcCurrBuf is not 16-byte aligned
- *
- */
-OMXResult omxVCM4P2_BlockMatch_Integer_16x16 (
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- const OMXVCMotionVector*pSrcPreMV,
- const OMX_INT *pSrcPreSAD,
- void *pMESpec,
- OMXVCMotionVector*pDstMV,
- OMX_INT *pDstSAD
-);
-
-
-
-/**
- * Function: omxVCM4P2_BlockMatch_Integer_8x8 (6.2.4.2.2)
- *
- * Description:
- * Performs an 8x8 block search; estimates motion vector and associated
- * minimum SAD. Both the input and output motion vectors are represented
- * using half-pixel units, and therefore a shift left or right by 1 bit may be
- * required, respectively, to match the input or output MVs with other
- * functions that either generate output MVs or expect input MVs represented
- * using integer pixel units.
- *
- * Input Arguments:
- *
- * pSrcRefBuf - pointer to the reference Y plane; points to the reference
- * block that corresponds to the location of the current 8x8 block
- * in the current plane.
- * refWidth - width of the reference plane
- * pRefRect - pointer to the valid reference plane rectangle; coordinates
- * are specified relative to the image origin. Rectangle
- * boundaries may extend beyond image boundaries if the image has
- * been padded.
- * pSrcCurrBuf - pointer to the current block in the current macroblock
- * buffer extracted from the original plane (linear array, 128
- * entries); must be aligned on an 8-byte boundary. The number of
- * bytes between lines (step) is 16 bytes.
- * pCurrPointPos - position of the current block in the current plane
- * pSrcPreMV - pointer to predicted motion vector; NULL indicates no
- * predicted MV
- * pSrcPreSAD - pointer to SAD associated with the predicted MV (referenced
- * by pSrcPreMV); may be set to NULL if unavailable.
- * pMESpec - vendor-specific motion estimation specification structure;
- * must have been allocated and then initialized using
- * omxVCM4P2_MEInit prior to calling the block matching function.
- *
- * Output Arguments:
- *
- * pDstMV - pointer to estimated MV
- * pDstSAD - pointer to minimum SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following
- * conditions is true:
- * - at least one of the following pointers is NULL: pSrcRefBuf,
- * pRefRect, pSrcCurrBuff, pCurrPointPos, pDstMV, pDstSAD or
- * pMESpec, or
- * - pSrcCurrBuf is not 8-byte aligned
- *
- */
-OMXResult omxVCM4P2_BlockMatch_Integer_8x8 (
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- const OMXVCMotionVector *pSrcPreMV,
- const OMX_INT *pSrcPreSAD,
- void *pMESpec,
- OMXVCMotionVector *pDstMV,
- OMX_INT *pDstSAD
-);
-
-
-
-/**
- * Function: omxVCM4P2_BlockMatch_Half_16x16 (6.2.4.2.3)
- *
- * Description:
- * Performs a 16x16 block match with half-pixel resolution. Returns the
- * estimated motion vector and associated minimum SAD. This function
- * estimates the half-pixel motion vector by interpolating the integer
- * resolution motion vector referenced by the input parameter pSrcDstMV, i.e.,
- * the initial integer MV is generated externally. The input parameters
- * pSrcRefBuf and pSearchPointRefPos should be shifted by the winning MV of
- * 16x16 integer search prior to calling BlockMatch_Half_16x16. The function
- * BlockMatch_Integer_16x16 may be used for integer motion estimation.
- *
- * Input Arguments:
- *
- * pSrcRefBuf - pointer to the reference Y plane; points to the reference
- * macroblock that corresponds to the location of the current
- * macroblock in the current plane.
- * refWidth - width of the reference plane
- * pRefRect - reference plane valid region rectangle
- * pSrcCurrBuf - pointer to the current block in the current macroblock
- * buffer extracted from the original plane (linear array, 256
- * entries); must be aligned on a 16-byte boundary. The number of
- * bytes between lines (step) is 16.
- * pSearchPointRefPos - position of the starting point for half pixel
- * search (specified in terms of integer pixel units) in the
- * reference plane, i.e., the reference position pointed to by the
- * predicted motion vector.
- * rndVal - rounding control parameter: 0 - disabled; 1 - enabled.
- * pSrcDstMV - pointer to the initial MV estimate; typically generated
- * during a prior 16X16 integer search; specified in terms of
- * half-pixel units.
- *
- * Output Arguments:
- *
- * pSrcDstMV - pointer to estimated MV
- * pDstSAD - pointer to minimum SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following
- * conditions is true:
- * - at least one of the following pointers is NULL: pSrcRefBuf,
- * pRefRect, pSrcCurrBuff, pSearchPointRefPos, pSrcDstMV.
- * - pSrcCurrBuf is not 16-byte aligned, or
- *
- */
-OMXResult omxVCM4P2_BlockMatch_Half_16x16 (
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pSearchPointRefPos,
- OMX_INT rndVal,
- OMXVCMotionVector *pSrcDstMV,
- OMX_INT *pDstSAD
-);
-
-
-
-/**
- * Function: omxVCM4P2_BlockMatch_Half_8x8 (6.2.4.2.4)
- *
- * Description:
- * Performs an 8x8 block match with half-pixel resolution. Returns the
- * estimated motion vector and associated minimum SAD. This function
- * estimates the half-pixel motion vector by interpolating the integer
- * resolution motion vector referenced by the input parameter pSrcDstMV, i.e.,
- * the initial integer MV is generated externally. The input parameters
- * pSrcRefBuf and pSearchPointRefPos should be shifted by the winning MV of
- * 8x8 integer search prior to calling BlockMatch_Half_8x8. The function
- * BlockMatch_Integer_8x8 may be used for integer motion estimation.
- *
- * Input Arguments:
- *
- * pSrcRefBuf - pointer to the reference Y plane; points to the reference
- * block that corresponds to the location of the current 8x8 block
- * in the current plane.
- * refWidth - width of the reference plane
- * pRefRect - reference plane valid region rectangle
- * pSrcCurrBuf - pointer to the current block in the current macroblock
- * buffer extracted from the original plane (linear array, 128
- * entries); must be aligned on a 8-byte boundary. The number of
- * bytes between lines (step) is 16.
- * pSearchPointRefPos - position of the starting point for half pixel
- * search (specified in terms of integer pixel units) in the
- * reference plane.
- * rndVal - rounding control parameter: 0 - disabled; 1 - enabled.
- * pSrcDstMV - pointer to the initial MV estimate; typically generated
- * during a prior 8x8 integer search, specified in terms of
- * half-pixel units.
- *
- * Output Arguments:
- *
- * pSrcDstMV - pointer to estimated MV
- * pDstSAD - pointer to minimum SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following
- * conditions is true:
- * - at least one of the following pointers is NULL:
- * pSrcRefBuf, pRefRect, pSrcCurrBuff, pSearchPointRefPos, pSrcDstMV
- * - pSrcCurrBuf is not 8-byte aligned
- *
- */
-OMXResult omxVCM4P2_BlockMatch_Half_8x8 (
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pSearchPointRefPos,
- OMX_INT rndVal,
- OMXVCMotionVector *pSrcDstMV,
- OMX_INT *pDstSAD
-);
-
-
-
-/**
- * Function: omxVCM4P2_MotionEstimationMB (6.2.4.3.1)
- *
- * Description:
- * Performs motion search for a 16x16 macroblock. Selects best motion search
- * strategy from among inter-1MV, inter-4MV, and intra modes. Supports
- * integer and half pixel resolution.
- *
- * Input Arguments:
- *
- * pSrcCurrBuf - pointer to the top-left corner of the current MB in the
- * original picture plane; must be aligned on a 16-byte boundary.
- * The function does not expect source data outside the region
- * bounded by the MB to be available; for example it is not
- * necessary for the caller to guarantee the availability of
- * pSrcCurrBuf[-SrcCurrStep], i.e., the row of pixels above the MB
- * to be processed.
- * srcCurrStep - width of the original picture plane, in terms of full
- * pixels; must be a multiple of 16.
- * pSrcRefBuf - pointer to the reference Y plane; points to the reference
- * plane location corresponding to the location of the current
- * macroblock in the current plane; must be aligned on a 16-byte
- * boundary.
- * srcRefStep - width of the reference picture plane, in terms of full
- * pixels; must be a multiple of 16.
- * pRefRect - reference plane valid region rectangle, specified relative to
- * the image origin
- * pCurrPointPos - position of the current macroblock in the current plane
- * pMESpec - pointer to the vendor-specific motion estimation specification
- * structure; must be allocated and then initialized using
- * omxVCM4P2_MEInit prior to calling this function.
- * pMBInfo - array, of dimension four, containing pointers to information
- * associated with four nearby MBs:
- * - pMBInfo[0] - pointer to left MB information
- * - pMBInfo[1] - pointer to top MB information
- * - pMBInfo[2] - pointer to top-left MB information
- * - pMBInfo[3] - pointer to top-right MB information
- * Any pointer in the array may be set equal to NULL if the
- * corresponding MB doesn't exist. For each MB, the following structure
- * members are used:
- * - mbType - macroblock type, either OMX_VC_INTRA, OMX_VC_INTER, or
- * OMX_VC_INTER4V
- * - pMV0[2][2] - estimated motion vectors; represented
- * in 1/2 pixel units
- * - sliceID - number of the slice to which the MB belongs
- * pSrcDstMBCurr - pointer to information structure for the current MB.
- * The following entries should be set prior to calling the
- * function: sliceID - the number of the slice the to which the
- * current MB belongs. The structure elements cbpy and cbpc are
- * ignored.
- *
- * Output Arguments:
- *
- * pSrcDstMBCurr - pointer to updated information structure for the current
- * MB after MB-level motion estimation has been completed. The
- * following structure members are updated by the ME function:
- * - mbType - macroblock type: OMX_VC_INTRA, OMX_VC_INTER, or
- * OMX_VC_INTER4V.
- * - pMV0[2][2] - estimated motion vectors; represented in
- * terms of 1/2 pel units.
- * - pMVPred[2][2] - predicted motion vectors; represented
- * in terms of 1/2 pel units.
- * The structure members cbpy and cbpc are not updated by the function.
- * pDstSAD - pointer to the minimum SAD for INTER1V, or sum of minimum SADs
- * for INTER4V
- * pDstBlockSAD - pointer to an array of SAD values for each of the four
- * 8x8 luma blocks in the MB. The block SADs are in scan order for
- * each MB.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one or more of the
- * following conditions is true:
- * - at least one of the following pointers is NULL: pSrcCurrBuf,
- * pSrcRefBuf, pRefRect, pCurrPointPos, pMBInter, pMBIntra,
- * pSrcDstMBCurr, or pDstSAD.
- *
- */
-OMXResult omxVCM4P2_MotionEstimationMB (
- const OMX_U8 *pSrcCurrBuf,
- OMX_S32 srcCurrStep,
- const OMX_U8 *pSrcRefBuf,
- OMX_S32 srcRefStep,
- const OMXRect*pRefRect,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- void *pMESpec,
- const OMXVCM4P2MBInfoPtr *pMBInfo,
- OMXVCM4P2MBInfo *pSrcDstMBCurr,
- OMX_U16 *pDstSAD,
- OMX_U16 *pDstBlockSAD
-);
-
-
-
-/**
- * Function: omxVCM4P2_DCT8x8blk (6.2.4.4.1)
- *
- * Description:
- * Computes a 2D forward DCT for a single 8x8 block, as defined in
- * [ISO14496-2].
- *
- * Input Arguments:
- *
- * pSrc - pointer to the start of the linearly arranged input buffer; must
- * be aligned on a 16-byte boundary. Input values (pixel
- * intensities) are valid in the range [-255,255].
- *
- * Output Arguments:
- *
- * pDst - pointer to the start of the linearly arranged output buffer; must
- * be aligned on a 16-byte boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments, returned if:
- * - pSrc or pDst is NULL.
- * - pSrc or pDst is not 16-byte aligned.
- *
- */
-OMXResult omxVCM4P2_DCT8x8blk (
- const OMX_S16 *pSrc,
- OMX_S16 *pDst
-);
-
-
-
-/**
- * Function: omxVCM4P2_QuantIntra_I (6.2.4.4.2)
- *
- * Description:
- * Performs quantization on intra block coefficients. This function supports
- * bits_per_pixel == 8.
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input intra block coefficients; must be aligned
- * on a 16-byte boundary.
- * QP - quantization parameter (quantizer_scale).
- * blockIndex - block index indicating the component type and position,
- * valid in the range 0 to 5, as defined in [ISO14496-2], subclause
- * 6.1.3.8.
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; shortVideoHeader==1 selects linear intra DC
- * mode, and shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to the output (quantized) interblock coefficients.
- * When shortVideoHeader==1, AC coefficients are saturated on the
- * interval [-127, 127], and DC coefficients are saturated on the
- * interval [1, 254]. When shortVideoHeader==0, AC coefficients
- * are saturated on the interval [-2047, 2047].
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - pSrcDst is NULL.
- * - blockIndex < 0 or blockIndex >= 10
- * - QP <= 0 or QP >= 32.
- *
- */
-OMXResult omxVCM4P2_QuantIntra_I (
- OMX_S16 *pSrcDst,
- OMX_U8 QP,
- OMX_INT blockIndex,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_QuantInter_I (6.2.4.4.3)
- *
- * Description:
- * Performs quantization on an inter coefficient block; supports
- * bits_per_pixel == 8.
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input inter block coefficients; must be aligned
- * on a 16-byte boundary.
- * QP - quantization parameter (quantizer_scale)
- * shortVideoHeader - binary flag indicating presence of short_video_header;
- * shortVideoHeader==1 selects linear intra DC mode, and
- * shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to the output (quantized) interblock coefficients.
- * When shortVideoHeader==1, AC coefficients are saturated on the
- * interval [-127, 127], and DC coefficients are saturated on the
- * interval [1, 254]. When shortVideoHeader==0, AC coefficients
- * are saturated on the interval [-2047, 2047].
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - pSrcDst is NULL.
- * - QP <= 0 or QP >= 32.
- *
- */
-OMXResult omxVCM4P2_QuantInter_I (
- OMX_S16 *pSrcDst,
- OMX_U8 QP,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_TransRecBlockCoef_intra (6.2.4.4.4)
- *
- * Description:
- * Quantizes the DCT coefficients, implements intra block AC/DC coefficient
- * prediction, and reconstructs the current intra block texture for prediction
- * on the next frame. Quantized row and column coefficients are returned in
- * the updated coefficient buffers.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the pixels of current intra block; must be aligned on
- * an 8-byte boundary.
- * pPredBufRow - pointer to the coefficient row buffer containing
- * ((num_mb_per_row * 2 + 1) * 8) elements of type OMX_S16.
- * Coefficients are organized into blocks of eight as described
- * below (Internal Prediction Coefficient Update Procedures). The
- * DC coefficient is first, and the remaining buffer locations
- * contain the quantized AC coefficients. Each group of eight row
- * buffer elements combined with one element eight elements ahead
- * contains the coefficient predictors of the neighboring block
- * that is spatially above or to the left of the block currently to
- * be decoded. A negative-valued DC coefficient indicates that this
- * neighboring block is not INTRA-coded or out of bounds, and
- * therefore the AC and DC coefficients are invalid. Pointer must
- * be aligned on an 8-byte boundary.
- * pPredBufCol - pointer to the prediction coefficient column buffer
- * containing 16 elements of type OMX_S16. Coefficients are
- * organized as described in section 6.2.2.5. Pointer must be
- * aligned on an 8-byte boundary.
- * pSumErr - pointer to a flag indicating whether or not AC prediction is
- * required; AC prediction is enabled if *pSumErr >=0, but the
- * value is not used for coefficient prediction, i.e., the sum of
- * absolute differences starts from 0 for each call to this
- * function. Otherwise AC prediction is disabled if *pSumErr < 0 .
- * blockIndex - block index indicating the component type and position, as
- * defined in [ISO14496-2], subclause 6.1.3.8.
- * curQp - quantization parameter of the macroblock to which the current
- * block belongs
- * pQpBuf - pointer to a 2-element quantization parameter buffer; pQpBuf[0]
- * contains the quantization parameter associated with the 8x8
- * block left of the current block (QPa), and pQpBuf[1] contains
- * the quantization parameter associated with the 8x8 block above
- * the current block (QPc). In the event that the corresponding
- * block is outside of the VOP bound, the Qp value will not affect
- * the intra prediction process, as described in [ISO14496-2],
- * sub-clause 7.4.3.3, Adaptive AC Coefficient Prediction.
- * srcStep - width of the source buffer; must be a multiple of 8.
- * dstStep - width of the reconstructed destination buffer; must be a
- * multiple of 16.
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; shortVideoHeader==1 selects linear intra DC
- * mode, and shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * pDst - pointer to the quantized DCT coefficient buffer; pDst[0] contains
- * the predicted DC coefficient; the remaining entries contain the
- * quantized AC coefficients (without prediction). The pointer
- * pDstmust be aligned on a 16-byte boundary.
- * pRec - pointer to the reconstructed texture; must be aligned on an
- * 8-byte boundary.
- * pPredBufRow - pointer to the updated coefficient row buffer
- * pPredBufCol - pointer to the updated coefficient column buffer
- * pPreACPredict - if prediction is enabled, the parameter points to the
- * start of the buffer containing the coefficient differences for
- * VLC encoding. The entry pPreACPredict[0]indicates prediction
- * direction for the current block and takes one of the following
- * values: OMX_VC_NONE (prediction disabled), OMX_VC_HORIZONTAL, or
- * OMX_VC_VERTICAL. The entries
- * pPreACPredict[1]-pPreACPredict[7]contain predicted AC
- * coefficients. If prediction is disabled (*pSumErr<0) then the
- * contents of this buffer are undefined upon return from the
- * function
- * pSumErr - pointer to the value of the accumulated AC coefficient errors,
- * i.e., sum of the absolute differences between predicted and
- * unpredicted AC coefficients
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - Bad arguments:
- * - At least one of the following pointers is NULL: pSrc, pDst, pRec,
- * pCoefBufRow, pCoefBufCol, pQpBuf, pPreACPredict, pSumErr.
- * - blockIndex < 0 or blockIndex >= 10;
- * - curQP <= 0 or curQP >= 32.
- * - srcStep, or dstStep <= 0 or not a multiple of 8.
- * - pDst is not 16-byte aligned: .
- * - At least one of the following pointers is not 8-byte aligned:
- * pSrc, pRec.
- *
- * Note: The coefficient buffers must be updated in accordance with the
- * update procedures defined in section in 6.2.2.
- *
- */
-OMXResult omxVCM4P2_TransRecBlockCoef_intra (
- const OMX_U8 *pSrc,
- OMX_S16 *pDst,
- OMX_U8 *pRec,
- OMX_S16 *pPredBufRow,
- OMX_S16 *pPredBufCol,
- OMX_S16 *pPreACPredict,
- OMX_INT *pSumErr,
- OMX_INT blockIndex,
- OMX_U8 curQp,
- const OMX_U8 *pQpBuf,
- OMX_INT srcStep,
- OMX_INT dstStep,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_TransRecBlockCoef_inter (6.2.4.4.5)
- *
- * Description:
- * Implements DCT, and quantizes the DCT coefficients of the inter block
- * while reconstructing the texture residual. There is no boundary check for
- * the bit stream buffer.
- *
- * Input Arguments:
- *
- * pSrc -pointer to the residuals to be encoded; must be aligned on an
- * 16-byte boundary.
- * QP - quantization parameter.
- * shortVideoHeader - binary flag indicating presence of short_video_header;
- * shortVideoHeader==1 selects linear intra DC mode, and
- * shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * pDst - pointer to the quantized DCT coefficients buffer; must be aligned
- * on a 16-byte boundary.
- * pRec - pointer to the reconstructed texture residuals; must be aligned
- * on a 16-byte boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - At least one of the following pointers is either NULL or
- * not 16-byte aligned:
- * - pSrc
- * - pDst
- * - pRec
- * - QP <= 0 or QP >= 32.
- *
- */
-OMXResult omxVCM4P2_TransRecBlockCoef_inter (
- const OMX_S16 *pSrc,
- OMX_S16 *pDst,
- OMX_S16 *pRec,
- OMX_U8 QP,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_EncodeVLCZigzag_IntraDCVLC (6.2.4.5.2)
- *
- * Description:
- * Performs zigzag scan and VLC encoding of AC and DC coefficients for one
- * intra block. Two versions of the function (DCVLC and ACVLC) are provided
- * in order to support the two different methods of processing DC
- * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, "Intra DC
- * Coefficient Decoding for the Case of Switched VLC Encoding".
- *
- * Input Arguments:
- *
- * ppBitStream - double pointer to the current byte in the bitstream
- * pBitOffset - pointer to the bit position in the byte pointed by
- * *ppBitStream. Valid within 0 to 7.
- * pQDctBlkCoef - pointer to the quantized DCT coefficient
- * predDir - AC prediction direction, which is used to decide the zigzag
- * scan pattern; takes one of the following values:
- * - OMX_VC_NONE - AC prediction not used.
- * Performs classical zigzag scan.
- * - OMX_VC_HORIZONTAL - Horizontal prediction.
- * Performs alternate-vertical zigzag scan.
- * - OMX_VC_VERTICAL - Vertical prediction.
- * Performs alternate-horizontal zigzag scan.
- * pattern - block pattern which is used to decide whether this block is
- * encoded
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- * videoComp - video component type (luminance, chrominance) of the current
- * block
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is encoded, so
- * that it points to the current byte in the bit stream buffer.
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - Bad arguments:
- * - At least one of the following pointers is NULL: ppBitStream,
- * *ppBitStream, pBitOffset, pQDctBlkCoef.
- * - *pBitOffset < 0, or *pBitOffset >7.
- * - PredDir is not one of: OMX_VC_NONE, OMX_VC_HORIZONTAL, or
- * OMX_VC_VERTICAL.
- * - VideoComp is not one component of enum OMXVCM4P2VideoComponent.
- *
- */
-OMXResult omxVCM4P2_EncodeVLCZigzag_IntraDCVLC (
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- const OMX_S16 *pQDctBlkCoef,
- OMX_U8 predDir,
- OMX_U8 pattern,
- OMX_INT shortVideoHeader,
- OMXVCM4P2VideoComponent videoComp
-);
-
-
-
-/**
- * Function: omxVCM4P2_EncodeVLCZigzag_IntraACVLC (6.2.4.5.2)
- *
- * Description:
- * Performs zigzag scan and VLC encoding of AC and DC coefficients for one
- * intra block. Two versions of the function (DCVLC and ACVLC) are provided
- * in order to support the two different methods of processing DC
- * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, Intra DC
- * Coefficient Decoding for the Case of Switched VLC Encoding.
- *
- * Input Arguments:
- *
- * ppBitStream - double pointer to the current byte in the bitstream
- * pBitOffset - pointer to the bit position in the byte pointed by
- * *ppBitStream. Valid within 0 to 7.
- * pQDctBlkCoef - pointer to the quantized DCT coefficient
- * predDir - AC prediction direction, which is used to decide the zigzag
- * scan pattern; takes one of the following values:
- * - OMX_VC_NONE - AC prediction not used.
- * Performs classical zigzag scan.
- * - OMX_VC_HORIZONTAL - Horizontal prediction.
- * Performs alternate-vertical zigzag scan.
- * - OMX_VC_VERTICAL - Vertical prediction.
- * Performs alternate-horizontal zigzag scan.
- * pattern - block pattern which is used to decide whether this block is
- * encoded
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is encoded, so
- * that it points to the current byte in the bit stream buffer.
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - Bad arguments:
- * - At least one of the following pointers is NULL: ppBitStream,
- * *ppBitStream, pBitOffset, pQDctBlkCoef.
- * - *pBitOffset < 0, or *pBitOffset >7.
- * - PredDir is not one of: OMX_VC_NONE, OMX_VC_HORIZONTAL, or
- * OMX_VC_VERTICAL.
- * - VideoComp is not one component of enum OMXVCM4P2VideoComponent.
- *
- */
-OMXResult omxVCM4P2_EncodeVLCZigzag_IntraACVLC (
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- const OMX_S16 *pQDctBlkCoef,
- OMX_U8 predDir,
- OMX_U8 pattern,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_EncodeVLCZigzag_Inter (6.2.4.5.3)
- *
- * Description:
- * Performs classical zigzag scanning and VLC encoding for one inter block.
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the bit
- * stream
- * pBitOffset - pointer to the bit position in the byte pointed by
- * *ppBitStream. Valid within 0 to 7
- * pQDctBlkCoef - pointer to the quantized DCT coefficient
- * pattern - block pattern which is used to decide whether this block is
- * encoded
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is encoded so that
- * it points to the current byte in the bit stream buffer.
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - Bad arguments
- * - At least one of the pointers: is NULL: ppBitStream, *ppBitStream,
- * pBitOffset, pQDctBlkCoef
- * - *pBitOffset < 0, or *pBitOffset >7.
- *
- */
-OMXResult omxVCM4P2_EncodeVLCZigzag_Inter (
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- const OMX_S16 *pQDctBlkCoef,
- OMX_U8 pattern,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_EncodeMV (6.2.4.5.4)
- *
- * Description:
- * Predicts a motion vector for the current macroblock, encodes the
- * difference, and writes the output to the stream buffer. The input MVs
- * pMVCurMB, pSrcMVLeftMB, pSrcMVUpperMB, and pSrcMVUpperRightMB should lie
- * within the ranges associated with the input parameter fcodeForward, as
- * described in [ISO14496-2], subclause 7.6.3. This function provides a
- * superset of the functionality associated with the function
- * omxVCM4P2_FindMVpred.
- *
- * Input Arguments:
- *
- * ppBitStream - double pointer to the current byte in the bitstream buffer
- * pBitOffset - index of the first free (next available) bit in the stream
- * buffer referenced by *ppBitStream, valid in the range 0 to 7.
- * pMVCurMB - pointer to the current macroblock motion vector; a value of
- * NULL indicates unavailability.
- * pSrcMVLeftMB - pointer to the source left macroblock motion vector; a
- * value of NULLindicates unavailability.
- * pSrcMVUpperMB - pointer to source upper macroblock motion vector; a
- * value of NULL indicates unavailability.
- * pSrcMVUpperRightMB - pointer to source upper right MB motion vector; a
- * value of NULL indicates unavailability.
- * fcodeForward - an integer with values from 1 to 7; used in encoding
- * motion vectors related to search range, as described in
- * [ISO14496-2], subclause 7.6.3.
- * MBType - macro block type, valid in the range 0 to 5
- *
- * Output Arguments:
- *
- * ppBitStream - updated pointer to the current byte in the bit stream
- * buffer
- * pBitOffset - updated index of the next available bit position in stream
- * buffer referenced by *ppBitStream
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - At least one of the following pointers is NULL: ppBitStream,
- * *ppBitStream, pBitOffset, pMVCurMB
- * - *pBitOffset < 0, or *pBitOffset >7.
- * - fcodeForward <= 0, or fcodeForward > 7, or MBType < 0.
- *
- */
-OMXResult omxVCM4P2_EncodeMV (
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- const OMXVCMotionVector *pMVCurMB,
- const OMXVCMotionVector*pSrcMVLeftMB,
- const OMXVCMotionVector *pSrcMVUpperMB,
- const OMXVCMotionVector *pSrcMVUpperRightMB,
- OMX_INT fcodeForward,
- OMXVCM4P2MacroblockType MBType
-);
-
-
-
-/**
- * Function: omxVCM4P2_DecodePadMV_PVOP (6.2.5.1.1)
- *
- * Description:
- * Decodes and pads the four motion vectors associated with a non-intra P-VOP
- * macroblock. For macroblocks of type OMX_VC_INTER4V, the output MV is
- * padded as specified in [ISO14496-2], subclause 7.6.1.6. Otherwise, for
- * macroblocks of types other than OMX_VC_INTER4V, the decoded MV is copied to
- * all four output MV buffer entries.
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the bit
- * stream buffer
- * pBitOffset - pointer to the bit position in the byte pointed to by
- * *ppBitStream. *pBitOffset is valid within [0-7].
- * pSrcMVLeftMB, pSrcMVUpperMB, and pSrcMVUpperRightMB - pointers to the
- * motion vector buffers of the macroblocks specially at the left,
- * upper, and upper-right side of the current macroblock,
- * respectively; a value of NULL indicates unavailability. Note:
- * Any neighborhood macroblock outside the current VOP or video
- * packet or outside the current GOB (when short_video_header is
- * 1 ) for which gob_header_empty is 0 is treated as
- * transparent, according to [ISO14496-2], subclause 7.6.5.
- * fcodeForward - a code equal to vop_fcode_forward in MPEG-4 bit stream
- * syntax
- * MBType - the type of the current macroblock. If MBType is not equal to
- * OMX_VC_INTER4V, the destination motion vector buffer is still
- * filled with the same decoded vector.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded, so
- * that it points to the current byte in the bit stream buffer
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream
- * pDstMVCurMB - pointer to the motion vector buffer for the current
- * macroblock; contains four decoded motion vectors
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - At least one of the following pointers is NULL:
- * ppBitStream, *ppBitStream, pBitOffset, pDstMVCurMB
- * - *pBitOffset exceeds [0,7]
- * - fcodeForward exceeds (0,7]
- * - MBType less than zero
- * - motion vector buffer is not 4-byte aligned.
- * OMX_Sts_Err - status error
- *
- */
-OMXResult omxVCM4P2_DecodePadMV_PVOP (
- const OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- OMXVCMotionVector *pSrcMVLeftMB,
- OMXVCMotionVector*pSrcMVUpperMB,
- OMXVCMotionVector *pSrcMVUpperRightMB,
- OMXVCMotionVector*pDstMVCurMB,
- OMX_INT fcodeForward,
- OMXVCM4P2MacroblockType MBType
-);
-
-
-
-/**
- * Function: omxVCM4P2_DecodeVLCZigzag_IntraDCVLC (6.2.5.2.2)
- *
- * Description:
- * Performs VLC decoding and inverse zigzag scan of AC and DC coefficients
- * for one intra block. Two versions of the function (DCVLC and ACVLC) are
- * provided in order to support the two different methods of processing DC
- * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, Intra DC
- * Coefficient Decoding for the Case of Switched VLC Encoding.
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the
- * bitstream buffer
- * pBitOffset - pointer to the bit position in the current byte referenced
- * by *ppBitStream. The parameter *pBitOffset is valid in the
- * range [0-7].
- * Bit Position in one byte: |Most Least|
- * *pBitOffset |0 1 2 3 4 5 6 7|
- * predDir - AC prediction direction; used to select the zigzag scan
- * pattern; takes one of the following values:
- * - OMX_VC_NONE - AC prediction not used;
- * performs classical zigzag scan.
- * - OMX_VC_HORIZONTAL - Horizontal prediction;
- * performs alternate-vertical zigzag scan;
- * - OMX_VC_VERTICAL - Vertical prediction;
- * performs alternate-horizontal zigzag scan.
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- * videoComp - video component type (luminance or chrominance) of the
- * current block
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded such
- * that it points to the current byte in the bit stream buffer
- * pBitOffset - *pBitOffset is updated such that it points to the current
- * bit position in the byte pointed by *ppBitStream
- * pDst - pointer to the coefficient buffer of current block; must be
- * 4-byte aligned.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments, if:
- * - At least one of the following pointers is NULL:
- * ppBitStream, *ppBitStream, pBitOffset, pDst
- * - *pBitOffset exceeds [0,7]
- * - preDir exceeds [0,2]
- * - pDst is not 4-byte aligned
- * OMX_Sts_Err - if:
- * - In DecodeVLCZigzag_IntraDCVLC, dc_size > 12
- * - At least one of mark bits equals zero
- * - Illegal stream encountered; code cannot be located in VLC table
- * - Forbidden code encountered in the VLC FLC table.
- * - The number of coefficients is greater than 64
- *
- */
-OMXResult omxVCM4P2_DecodeVLCZigzag_IntraDCVLC (
- const OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- OMX_S16 *pDst,
- OMX_U8 predDir,
- OMX_INT shortVideoHeader,
- OMXVCM4P2VideoComponent videoComp
-);
-
-
-
-/**
- * Function: omxVCM4P2_DecodeVLCZigzag_IntraACVLC (6.2.5.2.2)
- *
- * Description:
- * Performs VLC decoding and inverse zigzag scan of AC and DC coefficients
- * for one intra block. Two versions of the function (DCVLC and ACVLC) are
- * provided in order to support the two different methods of processing DC
- * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, Intra DC
- * Coefficient Decoding for the Case of Switched VLC Encoding.
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the
- * bitstream buffer
- * pBitOffset - pointer to the bit position in the current byte referenced
- * by *ppBitStream. The parameter *pBitOffset is valid in the
- * range [0-7]. Bit Position in one byte: |Most Least| *pBitOffset
- * |0 1 2 3 4 5 6 7|
- * predDir - AC prediction direction; used to select the zigzag scan
- * pattern; takes one of the following values: OMX_VC_NONE - AC
- * prediction not used; performs classical zigzag scan.
- * OMX_VC_HORIZONTAL - Horizontal prediction; performs
- * alternate-vertical zigzag scan; OMX_VC_VERTICAL - Vertical
- * prediction; performs alternate-horizontal zigzag scan.
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- * videoComp - video component type (luminance or chrominance) of the
- * current block
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded such
- * that it points to the current byte in the bit stream buffer
- * pBitOffset - *pBitOffset is updated such that it points to the current
- * bit position in the byte pointed by *ppBitStream
- * pDst - pointer to the coefficient buffer of current block; must be
- * 4-byte aligned.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments At least one of the following
- * pointers is NULL: ppBitStream, *ppBitStream, pBitOffset, pDst,
- * or At least one of the following conditions is true:
- * *pBitOffset exceeds [0,7], preDir exceeds [0,2], or pDst is
- * not 4-byte aligned
- * OMX_Sts_Err In DecodeVLCZigzag_IntraDCVLC, dc_size > 12 At least one of
- * mark bits equals zero Illegal stream encountered; code cannot
- * be located in VLC table Forbidden code encountered in the VLC
- * FLC table The number of coefficients is greater than 64
- *
- */
-OMXResult omxVCM4P2_DecodeVLCZigzag_IntraACVLC (
- const OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- OMX_S16 *pDst,
- OMX_U8 predDir,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_DecodeVLCZigzag_Inter (6.2.5.2.3)
- *
- * Description:
- * Performs VLC decoding and inverse zigzag scan for one inter-coded block.
- *
- * Input Arguments:
- *
- * ppBitStream - double pointer to the current byte in the stream buffer
- * pBitOffset - pointer to the next available bit in the current stream
- * byte referenced by *ppBitStream. The parameter *pBitOffset is
- * valid within the range [0-7].
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded such
- * that it points to the current byte in the stream buffer
- * pBitOffset - *pBitOffset is updated after decoding such that it points
- * to the next available bit in the stream byte referenced by
- * *ppBitStream
- * pDst - pointer to the coefficient buffer of current block; must be
- * 4-byte aligned.
- *
- * Return Value:
- *
- * OMX_Sts_BadArgErr - bad arguments:
- * - At least one of the following pointers is NULL:
- * ppBitStream, *ppBitStream, pBitOffset, pDst
- * - pDst is not 4-byte aligned
- * - *pBitOffset exceeds [0,7]
- * OMX_Sts_Err - status error, if:
- * - At least one mark bit is equal to zero
- * - Encountered an illegal stream code that cannot be found in the VLC table
- * - Encountered an illegal code in the VLC FLC table
- * - The number of coefficients is greater than 64
- *
- */
-OMXResult omxVCM4P2_DecodeVLCZigzag_Inter (
- const OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- OMX_S16 *pDst,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_QuantInvIntra_I (6.2.5.3.2)
- *
- * Description:
- * Performs the second inverse quantization mode on an intra/inter coded
- * block. Supports bits_per_pixel = 8. The output coefficients are clipped to
- * the range [-2048, 2047].
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input (quantized) intra/inter block; must be
- * aligned on a 16-byte boundary.
- * QP - quantization parameter (quantizer_scale)
- * videoComp - video component type of the current block. Takes one of the
- * following flags: OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE (intra
- * version only).
- * shortVideoHeader - binary flag indicating presence of short_video_header
- * (intra version only).
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to the output (dequantized) intra/inter block
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; one or more of the following is
- * true:
- * - pSrcDst is NULL
- * - QP <= 0 or QP >=31
- * - videoComp is neither OMX_VC_LUMINANCE nor OMX_VC_CHROMINANCE.
- *
- */
-OMXResult omxVCM4P2_QuantInvIntra_I (
- OMX_S16 *pSrcDst,
- OMX_INT QP,
- OMXVCM4P2VideoComponent videoComp,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_QuantInvInter_I (6.2.5.3.2)
- *
- * Description:
- * Performs the second inverse quantization mode on an intra/inter coded
- * block. Supports bits_per_pixel = 8. The output coefficients are clipped to
- * the range [-2048, 2047].
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input (quantized) intra/inter block; must be
- * aligned on a 16-byte boundary.
- * QP - quantization parameter (quantizer_scale)
- * videoComp - video component type of the current block. Takes one of the
- * following flags: OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE (intra
- * version only).
- * shortVideoHeader - binary flag indicating presence of short_video_header
- * (intra version only).
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to the output (dequantized) intra/inter block
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; one or more of the following is
- * true:
- * - pSrcDst is NULL
- * - QP <= 0 or QP >=31
- * - videoComp is neither OMX_VC_LUMINANCE nor OMX_VC_CHROMINANCE.
- *
- */
-OMXResult omxVCM4P2_QuantInvInter_I (
- OMX_S16 *pSrcDst,
- OMX_INT QP
-);
-
-
-
-/**
- * Function: omxVCM4P2_DecodeBlockCoef_Intra (6.2.5.4.1)
- *
- * Description:
- * Decodes the INTRA block coefficients. Inverse quantization, inversely
- * zigzag positioning, and IDCT, with appropriate clipping on each step, are
- * performed on the coefficients. The results are then placed in the output
- * frame/plane on a pixel basis. Note: This function will be used only when
- * at least one non-zero AC coefficient of current block exists in the bit
- * stream. The DC only condition will be handled in another function.
- *
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the bit
- * stream buffer. There is no boundary check for the bit stream
- * buffer.
- * pBitOffset - pointer to the bit position in the byte pointed to by
- * *ppBitStream. *pBitOffset is valid within [0-7].
- * step - width of the destination plane
- * pCoefBufRow - pointer to the coefficient row buffer; must be aligned on
- * an 8-byte boundary.
- * pCoefBufCol - pointer to the coefficient column buffer; must be aligned
- * on an 8-byte boundary.
- * curQP - quantization parameter of the macroblock which the current block
- * belongs to
- * pQPBuf - pointer to the quantization parameter buffer
- * blockIndex - block index indicating the component type and position as
- * defined in [ISO14496-2], subclause 6.1.3.8, Figure 6-5.
- * intraDCVLC - a code determined by intra_dc_vlc_thr and QP. This allows a
- * mechanism to switch between two VLC for coding of Intra DC
- * coefficients as per [ISO14496-2], Table 6-21.
- * ACPredFlag - a flag equal to ac_pred_flag (of luminance) indicating if
- * the ac coefficients of the first row or first column are
- * differentially coded for intra coded macroblock.
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; shortVideoHeader==1 selects linear intra DC
- * mode, and shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded, so
- * that it points to the current byte in the bit stream buffer
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream
- * pDst - pointer to the block in the destination plane; must be aligned on
- * an 8-byte boundary.
- * pCoefBufRow - pointer to the updated coefficient row buffer.
- * pCoefBufCol - pointer to the updated coefficient column buffer Note:
- * The coefficient buffers must be updated in accordance with the
- * update procedure defined in section 6.2.2.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments, if:
- * - At least one of the following pointers is NULL:
- * ppBitStream, *ppBitStream, pBitOffset, pCoefBufRow, pCoefBufCol,
- * pQPBuf, pDst.
- * - *pBitOffset exceeds [0,7]
- * - curQP exceeds (1, 31)
- * - blockIndex exceeds [0,5]
- * - step is not the multiple of 8
- * - a pointer alignment requirement was violated.
- * OMX_Sts_Err - status error. Refer to OMX_Sts_Err of DecodeVLCZigzag_Intra.
- *
- */
-OMXResult omxVCM4P2_DecodeBlockCoef_Intra (
- const OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- OMX_U8 *pDst,
- OMX_INT step,
- OMX_S16 *pCoefBufRow,
- OMX_S16 *pCoefBufCol,
- OMX_U8 curQP,
- const OMX_U8 *pQPBuf,
- OMX_INT blockIndex,
- OMX_INT intraDCVLC,
- OMX_INT ACPredFlag,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_DecodeBlockCoef_Inter (6.2.5.4.2)
- *
- * Description:
- * Decodes the INTER block coefficients. This function performs inverse
- * quantization, inverse zigzag positioning, and IDCT (with appropriate
- * clipping on each step) on the coefficients. The results (residuals) are
- * placed in a contiguous array of 64 elements. For INTER block, the output
- * buffer holds the residuals for further reconstruction.
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the bit
- * stream buffer. There is no boundary check for the bit stream
- * buffer.
- * pBitOffset - pointer to the bit position in the byte pointed to by
- * *ppBitStream. *pBitOffset is valid within [0-7]
- * QP - quantization parameter
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; shortVideoHeader==1 selects linear intra DC
- * mode, and shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded, so
- * that it points to the current byte in the bit stream buffer
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream
- * pDst - pointer to the decoded residual buffer (a contiguous array of 64
- * elements of OMX_S16 data type); must be aligned on a 16-byte
- * boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments, if:
- * - At least one of the following pointers is Null:
- * ppBitStream, *ppBitStream, pBitOffset , pDst
- * - *pBitOffset exceeds [0,7]
- * - QP <= 0.
- * - pDst is not 16-byte aligned
- * OMX_Sts_Err - status error. Refer to OMX_Sts_Err of DecodeVLCZigzag_Inter .
- *
- */
-OMXResult omxVCM4P2_DecodeBlockCoef_Inter (
- const OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- OMX_S16 *pDst,
- OMX_INT QP,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_PredictReconCoefIntra (6.2.5.4.3)
- *
- * Description:
- * Performs adaptive DC/AC coefficient prediction for an intra block. Prior
- * to the function call, prediction direction (predDir) should be selected as
- * specified in [ISO14496-2], subclause 7.4.3.1.
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the coefficient buffer which contains the quantized
- * coefficient residuals (PQF) of the current block; must be
- * aligned on a 4-byte boundary. The output coefficients are
- * saturated to the range [-2048, 2047].
- * pPredBufRow - pointer to the coefficient row buffer; must be aligned on
- * a 4-byte boundary.
- * pPredBufCol - pointer to the coefficient column buffer; must be aligned
- * on a 4-byte boundary.
- * curQP - quantization parameter of the current block. curQP may equal to
- * predQP especially when the current block and the predictor block
- * are in the same macroblock.
- * predQP - quantization parameter of the predictor block
- * predDir - indicates the prediction direction which takes one of the
- * following values: OMX_VC_HORIZONTAL - predict horizontally
- * OMX_VC_VERTICAL - predict vertically
- * ACPredFlag - a flag indicating if AC prediction should be performed. It
- * is equal to ac_pred_flag in the bit stream syntax of MPEG-4
- * videoComp - video component type (luminance or chrominance) of the
- * current block
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to the coefficient buffer which contains the quantized
- * coefficients (QF) of the current block
- * pPredBufRow - pointer to the updated coefficient row buffer
- * pPredBufCol - pointer to the updated coefficient column buffer Note:
- * Buffer update: Update the AC prediction buffer (both row and
- * column buffer).
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments, if:
- * - At least one of the pointers is NULL:
- * pSrcDst, pPredBufRow, or pPredBufCol.
- * - curQP <= 0,
- * - predQP <= 0,
- * - curQP >31,
- * - predQP > 31,
- * - preDir exceeds [1,2]
- * - pSrcDst, pPredBufRow, or pPredBufCol is not 4-byte aligned.
- *
- */
-OMXResult omxVCM4P2_PredictReconCoefIntra (
- OMX_S16 *pSrcDst,
- OMX_S16 *pPredBufRow,
- OMX_S16 *pPredBufCol,
- OMX_INT curQP,
- OMX_INT predQP,
- OMX_INT predDir,
- OMX_INT ACPredFlag,
- OMXVCM4P2VideoComponent videoComp
-);
-
-
-
-/**
- * Function: omxVCM4P2_MCReconBlock (6.2.5.5.1)
- *
- * Description:
- * Performs motion compensation prediction for an 8x8 block using
- * interpolation described in [ISO14496-2], subclause 7.6.2.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the block in the reference plane.
- * srcStep - distance between the start of consecutive lines in the
- * reference plane, in bytes; must be a multiple of 8.
- * dstStep - distance between the start of consecutive lines in the
- * destination plane, in bytes; must be a multiple of 8.
- * pSrcResidue - pointer to a buffer containing the 16-bit prediction
- * residuals; must be 16-byte aligned. If the pointer is NULL, then
- * no prediction is done, only motion compensation, i.e., the block
- * is moved with interpolation.
- * predictType - bilinear interpolation type, as defined in section
- * 6.2.1.2.
- * rndVal - rounding control parameter: 0 - disabled; 1 - enabled.
- *
- * Output Arguments:
- *
- * pDst - pointer to the destination buffer; must be 8-byte aligned. If
- * prediction residuals are added then output intensities are
- * clipped to the range [0,255].
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - pDst is not 8-byte aligned.
- * - pSrcResidue is not 16-byte aligned.
- * - one or more of the following pointers is NULL: pSrc or pDst.
- * - either srcStep or dstStep is not a multiple of 8.
- * - invalid type specified for the parameter predictType.
- * - the parameter rndVal is not equal either to 0 or 1.
- *
- */
-OMXResult omxVCM4P2_MCReconBlock (
- const OMX_U8 *pSrc,
- OMX_INT srcStep,
- const OMX_S16 *pSrcResidue,
- OMX_U8 *pDst,
- OMX_INT dstStep,
- OMX_INT predictType,
- OMX_INT rndVal
-);
-
-
-
-/* 6.3.1.1 Intra 16x16 Prediction Modes */
-/* A data type that enumerates intra_16x16 macroblock prediction modes is defined as follows: */
-
-typedef enum {
- OMX_VC_16X16_VERT = 0, /** Intra_16x16_Vertical */
- OMX_VC_16X16_HOR = 1, /** Intra_16x16_Horizontal */
- OMX_VC_16X16_DC = 2, /** Intra_16x16_DC */
- OMX_VC_16X16_PLANE = 3 /** Intra_16x16_Plane */
-} OMXVCM4P10Intra16x16PredMode;
-
-
-
-/* 6.3.1.2 Intra 4x4 Prediction Modes */
-/* A data type that enumerates intra_4x4 macroblock prediction modes is defined as follows: */
-
-typedef enum {
- OMX_VC_4X4_VERT = 0, /** Intra_4x4_Vertical */
- OMX_VC_4X4_HOR = 1, /** Intra_4x4_Horizontal */
- OMX_VC_4X4_DC = 2, /** Intra_4x4_DC */
- OMX_VC_4X4_DIAG_DL = 3, /** Intra_4x4_Diagonal_Down_Left */
- OMX_VC_4X4_DIAG_DR = 4, /** Intra_4x4_Diagonal_Down_Right */
- OMX_VC_4X4_VR = 5, /** Intra_4x4_Vertical_Right */
- OMX_VC_4X4_HD = 6, /** Intra_4x4_Horizontal_Down */
- OMX_VC_4X4_VL = 7, /** Intra_4x4_Vertical_Left */
- OMX_VC_4X4_HU = 8 /** Intra_4x4_Horizontal_Up */
-} OMXVCM4P10Intra4x4PredMode;
-
-
-
-/* 6.3.1.3 Chroma Prediction Modes */
-/* A data type that enumerates intra chroma prediction modes is defined as follows: */
-
-typedef enum {
- OMX_VC_CHROMA_DC = 0, /** Intra_Chroma_DC */
- OMX_VC_CHROMA_HOR = 1, /** Intra_Chroma_Horizontal */
- OMX_VC_CHROMA_VERT = 2, /** Intra_Chroma_Vertical */
- OMX_VC_CHROMA_PLANE = 3 /** Intra_Chroma_Plane */
-} OMXVCM4P10IntraChromaPredMode;
-
-
-
-/* 6.3.1.4 Motion Estimation Modes */
-/* A data type that enumerates H.264 motion estimation modes is defined as follows: */
-
-typedef enum {
- OMX_VC_M4P10_FAST_SEARCH = 0, /** Fast motion search */
- OMX_VC_M4P10_FULL_SEARCH = 1 /** Full motion search */
-} OMXVCM4P10MEMode;
-
-
-
-/* 6.3.1.5 Macroblock Types */
-/* A data type that enumerates H.264 macroblock types is defined as follows: */
-
-typedef enum {
- OMX_VC_P_16x16 = 0, /* defined by [ISO14496-10] */
- OMX_VC_P_16x8 = 1,
- OMX_VC_P_8x16 = 2,
- OMX_VC_P_8x8 = 3,
- OMX_VC_PREF0_8x8 = 4,
- OMX_VC_INTER_SKIP = 5,
- OMX_VC_INTRA_4x4 = 8,
- OMX_VC_INTRA_16x16 = 9,
- OMX_VC_INTRA_PCM = 10
-} OMXVCM4P10MacroblockType;
-
-
-
-/* 6.3.1.6 Sub-Macroblock Types */
-/* A data type that enumerates H.264 sub-macroblock types is defined as follows: */
-
-typedef enum {
- OMX_VC_SUB_P_8x8 = 0, /* defined by [ISO14496-10] */
- OMX_VC_SUB_P_8x4 = 1,
- OMX_VC_SUB_P_4x8 = 2,
- OMX_VC_SUB_P_4x4 = 3
-} OMXVCM4P10SubMacroblockType;
-
-
-
-/* 6.3.1.7 Variable Length Coding (VLC) Information */
-
-typedef struct {
- OMX_U8 uTrailing_Ones; /* Trailing ones; 3 at most */
- OMX_U8 uTrailing_One_Signs; /* Trailing ones signal */
- OMX_U8 uNumCoeffs; /* Total number of non-zero coefs, including trailing ones */
- OMX_U8 uTotalZeros; /* Total number of zero coefs */
- OMX_S16 iLevels[16]; /* Levels of non-zero coefs, in reverse zig-zag order */
- OMX_U8 uRuns[16]; /* Runs for levels and trailing ones, in reverse zig-zag order */
-} OMXVCM4P10VLCInfo;
-
-
-
-/* 6.3.1.8 Macroblock Information */
-
-typedef struct {
- OMX_S32 sliceId; /* slice number */
- OMXVCM4P10MacroblockType mbType; /* MB type */
- OMXVCM4P10SubMacroblockType subMBType[4]; /* sub-block type */
- OMX_S32 qpy; /* qp for luma */
- OMX_S32 qpc; /* qp for chroma */
- OMX_U32 cbpy; /* CBP Luma */
- OMX_U32 cbpc; /* CBP Chroma */
- OMXVCMotionVector pMV0[4][4]; /* motion vector, represented using 1/4-pel units, pMV0[blocky][blockx] (blocky = 0~3, blockx =0~3) */
- OMXVCMotionVector pMVPred[4][4]; /* motion vector prediction, Represented using 1/4-pel units, pMVPred[blocky][blockx] (blocky = 0~3, blockx = 0~3) */
- OMX_U8 pRefL0Idx[4]; /* reference picture indices */
- OMXVCM4P10Intra16x16PredMode Intra16x16PredMode; /* best intra 16x16 prediction mode */
- OMXVCM4P10Intra4x4PredMode pIntra4x4PredMode[16]; /* best intra 4x4 prediction mode for each block, pMV0 indexed as above */
-} OMXVCM4P10MBInfo, *OMXVCM4P10MBInfoPtr;
-
-
-
-/* 6.3.1.9 Motion Estimation Parameters */
-
-typedef struct {
- OMX_S32 blockSplitEnable8x8; /* enables 16x8, 8x16, 8x8 */
- OMX_S32 blockSplitEnable4x4; /* enable splitting of 8x4, 4x8, 4x4 blocks */
- OMX_S32 halfSearchEnable;
- OMX_S32 quarterSearchEnable;
- OMX_S32 intraEnable4x4; /* 1=enable, 0=disable */
- OMX_S32 searchRange16x16; /* integer pixel units */
- OMX_S32 searchRange8x8;
- OMX_S32 searchRange4x4;
-} OMXVCM4P10MEParams;
-
-
-
-/**
- * Function: omxVCM4P10_PredictIntra_4x4 (6.3.3.1.1)
- *
- * Description:
- * Perform Intra_4x4 prediction for luma samples. If the upper-right block is
- * not available, then duplication work should be handled inside the function.
- * Users need not define them outside.
- *
- * Input Arguments:
- *
- * pSrcLeft - Pointer to the buffer of 4 left pixels:
- * p[x, y] (x = -1, y = 0..3)
- * pSrcAbove - Pointer to the buffer of 8 above pixels:
- * p[x,y] (x = 0..7, y =-1);
- * must be aligned on a 4-byte boundary.
- * pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1)
- * leftStep - Step of left pixel buffer; must be a multiple of 4.
- * dstStep - Step of the destination buffer; must be a multiple of 4.
- * predMode - Intra_4x4 prediction mode.
- * availability - Neighboring 4x4 block availability flag, refer to
- * "Neighboring Macroblock Availability" .
- *
- * Output Arguments:
- *
- * pDst - Pointer to the destination buffer; must be aligned on a 4-byte
- * boundary.
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * pDst is NULL.
- * dstStep < 4, or dstStep is not a multiple of 4.
- * leftStep is not a multiple of 4.
- * predMode is not in the valid range of enumeration
- * OMXVCM4P10Intra4x4PredMode.
- * predMode is OMX_VC_4x4_VERT, but availability doesn't set OMX_VC_UPPER
- * indicating p[x,-1] (x = 0..3) is not available.
- * predMode is OMX_VC_4x4_HOR, but availability doesn't set OMX_VC_LEFT
- * indicating p[-1,y] (y = 0..3) is not available.
- * predMode is OMX_VC_4x4_DIAG_DL, but availability doesn't set
- * OMX_VC_UPPER indicating p[x, -1] (x = 0..3) is not available.
- * predMode is OMX_VC_4x4_DIAG_DR, but availability doesn't set
- * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
- * p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not
- * available.
- * predMode is OMX_VC_4x4_VR, but availability doesn't set
- * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
- * p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not
- * available.
- * predMode is OMX_VC_4x4_HD, but availability doesn't set
- * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
- * p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not
- * available.
- * predMode is OMX_VC_4x4_VL, but availability doesn't set OMX_VC_UPPER
- * indicating p[x,-1] (x = 0..3) is not available.
- * predMode is OMX_VC_4x4_HU, but availability doesn't set OMX_VC_LEFT
- * indicating p[-1,y] (y = 0..3) is not available.
- * availability sets OMX_VC_UPPER, but pSrcAbove is NULL.
- * availability sets OMX_VC_LEFT, but pSrcLeft is NULL.
- * availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL.
- * either pSrcAbove or pDst is not aligned on a 4-byte boundary.
- *
- * Note:
- * pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointers if
- * they are not used by intra prediction as implied in predMode.
- *
- */
-OMXResult omxVCM4P10_PredictIntra_4x4 (
- const OMX_U8 *pSrcLeft,
- const OMX_U8 *pSrcAbove,
- const OMX_U8 *pSrcAboveLeft,
- OMX_U8 *pDst,
- OMX_INT leftStep,
- OMX_INT dstStep,
- OMXVCM4P10Intra4x4PredMode predMode,
- OMX_S32 availability
-);
-
-
-
-/**
- * Function: omxVCM4P10_PredictIntra_16x16 (6.3.3.1.2)
- *
- * Description:
- * Perform Intra_16x16 prediction for luma samples. If the upper-right block
- * is not available, then duplication work should be handled inside the
- * function. Users need not define them outside.
- *
- * Input Arguments:
- *
- * pSrcLeft - Pointer to the buffer of 16 left pixels: p[x, y] (x = -1, y =
- * 0..15)
- * pSrcAbove - Pointer to the buffer of 16 above pixels: p[x,y] (x = 0..15,
- * y= -1); must be aligned on a 16-byte boundary.
- * pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1)
- * leftStep - Step of left pixel buffer; must be a multiple of 16.
- * dstStep - Step of the destination buffer; must be a multiple of 16.
- * predMode - Intra_16x16 prediction mode, please refer to section 3.4.1.
- * availability - Neighboring 16x16 MB availability flag. Refer to
- * section 3.4.4.
- *
- * Output Arguments:
- *
- * pDst -Pointer to the destination buffer; must be aligned on a 16-byte
- * boundary.
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * pDst is NULL.
- * dstStep < 16. or dstStep is not a multiple of 16.
- * leftStep is not a multiple of 16.
- * predMode is not in the valid range of enumeration
- * OMXVCM4P10Intra16x16PredMode
- * predMode is OMX_VC_16X16_VERT, but availability doesn't set
- * OMX_VC_UPPER indicating p[x,-1] (x = 0..15) is not available.
- * predMode is OMX_VC_16X16_HOR, but availability doesn't set OMX_VC_LEFT
- * indicating p[-1,y] (y = 0..15) is not available.
- * predMode is OMX_VC_16X16_PLANE, but availability doesn't set
- * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
- * p[x,-1](x = 0..15), or p[-1,y] (y = 0..15), or p[-1,-1] is not
- * available.
- * availability sets OMX_VC_UPPER, but pSrcAbove is NULL.
- * availability sets OMX_VC_LEFT, but pSrcLeft is NULL.
- * availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL.
- * either pSrcAbove or pDst is not aligned on a 16-byte boundary.
- *
- * Note:
- * pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointers if
- * they are not used by intra prediction implied in predMode.
- * Note:
- * OMX_VC_UPPER_RIGHT is not used in intra_16x16 luma prediction.
- *
- */
-OMXResult omxVCM4P10_PredictIntra_16x16 (
- const OMX_U8 *pSrcLeft,
- const OMX_U8 *pSrcAbove,
- const OMX_U8 *pSrcAboveLeft,
- OMX_U8 *pDst,
- OMX_INT leftStep,
- OMX_INT dstStep,
- OMXVCM4P10Intra16x16PredMode predMode,
- OMX_S32 availability
-);
-
-
-
-/**
- * Function: omxVCM4P10_PredictIntraChroma_8x8 (6.3.3.1.3)
- *
- * Description:
- * Performs intra prediction for chroma samples.
- *
- * Input Arguments:
- *
- * pSrcLeft - Pointer to the buffer of 8 left pixels: p[x, y] (x = -1, y=
- * 0..7).
- * pSrcAbove - Pointer to the buffer of 8 above pixels: p[x,y] (x = 0..7, y
- * = -1); must be aligned on an 8-byte boundary.
- * pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1)
- * leftStep - Step of left pixel buffer; must be a multiple of 8.
- * dstStep - Step of the destination buffer; must be a multiple of 8.
- * predMode - Intra chroma prediction mode, please refer to section 3.4.3.
- * availability - Neighboring chroma block availability flag, please refer
- * to "Neighboring Macroblock Availability".
- *
- * Output Arguments:
- *
- * pDst - Pointer to the destination buffer; must be aligned on an 8-byte
- * boundary.
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If any of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * pDst is NULL.
- * dstStep < 8 or dstStep is not a multiple of 8.
- * leftStep is not a multiple of 8.
- * predMode is not in the valid range of enumeration
- * OMXVCM4P10IntraChromaPredMode.
- * predMode is OMX_VC_CHROMA_VERT, but availability doesn't set
- * OMX_VC_UPPER indicating p[x,-1] (x = 0..7) is not available.
- * predMode is OMX_VC_CHROMA_HOR, but availability doesn't set OMX_VC_LEFT
- * indicating p[-1,y] (y = 0..7) is not available.
- * predMode is OMX_VC_CHROMA_PLANE, but availability doesn't set
- * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
- * p[x,-1](x = 0..7), or p[-1,y] (y = 0..7), or p[-1,-1] is not
- * available.
- * availability sets OMX_VC_UPPER, but pSrcAbove is NULL.
- * availability sets OMX_VC_LEFT, but pSrcLeft is NULL.
- * availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL.
- * either pSrcAbove or pDst is not aligned on a 8-byte boundary.
- *
- * Note: pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointer if
- * they are not used by intra prediction implied in predMode.
- *
- * Note: OMX_VC_UPPER_RIGHT is not used in intra chroma prediction.
- *
- */
-OMXResult omxVCM4P10_PredictIntraChroma_8x8 (
- const OMX_U8 *pSrcLeft,
- const OMX_U8 *pSrcAbove,
- const OMX_U8 *pSrcAboveLeft,
- OMX_U8 *pDst,
- OMX_INT leftStep,
- OMX_INT dstStep,
- OMXVCM4P10IntraChromaPredMode predMode,
- OMX_S32 availability
-);
-
-
-
-/**
- * Function: omxVCM4P10_InterpolateLuma (6.3.3.2.1)
- *
- * Description:
- * Performs quarter-pixel interpolation for inter luma MB. It is assumed that
- * the frame is already padded when calling this function.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the source reference frame buffer
- * srcStep - reference frame step, in bytes; must be a multiple of roi.width
- * dstStep - destination frame step, in bytes; must be a multiple of
- * roi.width
- * dx - Fractional part of horizontal motion vector component in 1/4 pixel
- * unit; valid in the range [0,3]
- * dy - Fractional part of vertical motion vector y component in 1/4 pixel
- * unit; valid in the range [0,3]
- * roi - Dimension of the interpolation region; the parameters roi.width and
- * roi.height must be equal to either 4, 8, or 16.
- *
- * Output Arguments:
- *
- * pDst - Pointer to the destination frame buffer:
- * if roi.width==4, 4-byte alignment required
- * if roi.width==8, 8-byte alignment required
- * if roi.width==16, 16-byte alignment required
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * pSrc or pDst is NULL.
- * srcStep or dstStep < roi.width.
- * dx or dy is out of range [0,3].
- * roi.width or roi.height is out of range {4, 8, 16}.
- * roi.width is equal to 4, but pDst is not 4 byte aligned.
- * roi.width is equal to 8 or 16, but pDst is not 8 byte aligned.
- * srcStep or dstStep is not a multiple of 8.
- *
- */
-OMXResult omxVCM4P10_InterpolateLuma (
- const OMX_U8 *pSrc,
- OMX_S32 srcStep,
- OMX_U8 *pDst,
- OMX_S32 dstStep,
- OMX_S32 dx,
- OMX_S32 dy,
- OMXSize roi
-);
-
-
-
-/**
- * Function: omxVCM4P10_InterpolateChroma (6.3.3.2.2)
- *
- * Description:
- * Performs 1/8-pixel interpolation for inter chroma MB.
- *
- * Input Arguments:
- *
- * pSrc -Pointer to the source reference frame buffer
- * srcStep -Reference frame step in bytes
- * dstStep -Destination frame step in bytes; must be a multiple of
- * roi.width.
- * dx -Fractional part of horizontal motion vector component in 1/8 pixel
- * unit; valid in the range [0,7]
- * dy -Fractional part of vertical motion vector component in 1/8 pixel
- * unit; valid in the range [0,7]
- * roi -Dimension of the interpolation region; the parameters roi.width and
- * roi.height must be equal to either 2, 4, or 8.
- *
- * Output Arguments:
- *
- * pDst -Pointer to the destination frame buffer:
- * if roi.width==2, 2-byte alignment required
- * if roi.width==4, 4-byte alignment required
- * if roi.width==8, 8-byte alignment required
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * pSrc or pDst is NULL.
- * srcStep or dstStep < 8.
- * dx or dy is out of range [0-7].
- * roi.width or roi.height is out of range {2,4,8}.
- * roi.width is equal to 2, but pDst is not 2-byte aligned.
- * roi.width is equal to 4, but pDst is not 4-byte aligned.
- * roi.width is equal to 8, but pDst is not 8 byte aligned.
- * srcStep or dstStep is not a multiple of 8.
- *
- */
-OMXResult omxVCM4P10_InterpolateChroma (
- const OMX_U8 *pSrc,
- OMX_S32 srcStep,
- OMX_U8 *pDst,
- OMX_S32 dstStep,
- OMX_S32 dx,
- OMX_S32 dy,
- OMXSize roi
-);
-
-
-
-/**
- * Function: omxVCM4P10_FilterDeblockingLuma_VerEdge_I (6.3.3.3.1)
- *
- * Description:
- * Performs in-place deblock filtering on four vertical edges of the luma
- * macroblock (16x16).
- *
- * Input Arguments:
- *
- * pSrcDst - Pointer to the input macroblock; must be 16-byte aligned.
- * srcdstStep -Step of the arrays; must be a multiple of 16.
- * pAlpha -Array of size 2 of alpha thresholds (the first item is the alpha
- * threshold for the external vertical edge, and the second item is
- * for the internal vertical edge); per [ISO14496-10] alpha values
- * must be in the range [0,255].
- * pBeta -Array of size 2 of beta thresholds (the first item is the beta
- * threshold for the external vertical edge, and the second item is
- * for the internal vertical edge); per [ISO14496-10] beta values
- * must be in the range [0,18].
- * pThresholds -Array of size 16 of Thresholds (TC0) (values for the left
- * edge of each 4x4 block, arranged in vertical block order); must
- * be aligned on a 4-byte boundary.. Per [ISO14496-10] values must
- * be in the range [0,25].
- * pBS -Array of size 16 of BS parameters (arranged in vertical block
- * order); valid in the range [0,4] with the following
- * restrictions: i) pBS[i]== 4 may occur only for 0<=i<=3, ii)
- * pBS[i]== 4 if and only if pBS[i^3]== 4. Must be 4-byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst -Pointer to filtered output macroblock.
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * Either of the pointers in pSrcDst, pAlpha, pBeta, pThresholds, or pBS
- * is NULL.
- * Either pThresholds or pBS is not aligned on a 4-byte boundary.
- * pSrcDst is not 16-byte aligned.
- * srcdstStep is not a multiple of 16.
- * pAlpha[0] and/or pAlpha[1] is outside the range [0,255].
- * pBeta[0] and/or pBeta[1] is outside the range [0,18].
- * One or more entries in the table pThresholds[0..15]is outside of the
- * range [0,25].
- * pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or (pBS[i]==4 &&
- * pBS[i^3]!=4) for 0<=i<=3.
- *
- */
-OMXResult omxVCM4P10_FilterDeblockingLuma_VerEdge_I (
- OMX_U8 *pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8 *pAlpha,
- const OMX_U8 *pBeta,
- const OMX_U8 *pThresholds,
- const OMX_U8 *pBS
-);
-
-
-
-/**
- * Function: omxVCM4P10_FilterDeblockingLuma_HorEdge_I (6.3.3.3.2)
- *
- * Description:
- * Performs in-place deblock filtering on four horizontal edges of the luma
- * macroblock (16x16).
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input macroblock; must be 16-byte aligned.
- * srcdstStep - step of the arrays; must be a multiple of 16.
- * pAlpha - array of size 2 of alpha thresholds (the first item is the alpha
- * threshold for the external vertical edge, and the second item is
- * for the internal horizontal edge); per [ISO14496-10] alpha
- * values must be in the range [0,255].
- * pBeta - array of size 2 of beta thresholds (the first item is the beta
- * threshold for the external horizontal edge, and the second item
- * is for the internal horizontal edge). Per [ISO14496-10] beta
- * values must be in the range [0,18].
- * pThresholds - array of size 16 containing thresholds, TC0, for the top
- * horizontal edge of each 4x4 block, arranged in horizontal block
- * order; must be aligned on a 4-byte boundary. Per [ISO14496 10]
- * values must be in the range [0,25].
- * pBS - array of size 16 of BS parameters (arranged in horizontal block
- * order); valid in the range [0,4] with the following
- * restrictions: i) pBS[i]== 4 may occur only for 0<=i<=3, ii)
- * pBS[i]== 4 if and only if pBS[i^3]== 4. Must be 4-byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst -Pointer to filtered output macroblock.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr, if the function runs without error.
- *
- * OMX_Sts_BadArgErr, if one of the following cases occurs:
- * - one or more of the following pointers is NULL: pSrcDst, pAlpha,
- * pBeta, pThresholds, or pBS.
- * - either pThresholds or pBS is not aligned on a 4-byte boundary.
- * - pSrcDst is not 16-byte aligned.
- * - srcdstStep is not a multiple of 16.
- * - pAlpha[0] and/or pAlpha[1] is outside the range [0,255].
- * - pBeta[0] and/or pBeta[1] is outside the range [0,18].
- * - One or more entries in the table pThresholds[0..15] is
- * outside of the range [0,25].
- * - pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
- * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
- *
- */
-OMXResult omxVCM4P10_FilterDeblockingLuma_HorEdge_I (
- OMX_U8 *pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8 *pAlpha,
- const OMX_U8 *pBeta,
- const OMX_U8 *pThresholds,
- const OMX_U8 *pBS
-);
-
-
-
-/**
- * Function: omxVCM4P10_FilterDeblockingChroma_VerEdge_I (6.3.3.3.3)
- *
- * Description:
- * Performs in-place deblock filtering on four vertical edges of the chroma
- * macroblock (8x8).
- *
- * Input Arguments:
- *
- * pSrcDst - Pointer to the input macroblock; must be 8-byte aligned.
- * srcdstStep - Step of the arrays; must be a multiple of 8.
- * pAlpha - Array of size 2 of alpha thresholds (the first item is alpha
- * threshold for external vertical edge, and the second item is for
- * internal vertical edge); per [ISO14496-10] alpha values must be
- * in the range [0,255].
- * pBeta - Array of size 2 of beta thresholds (the first item is the beta
- * threshold for the external vertical edge, and the second item is
- * for the internal vertical edge); per [ISO14496-10] beta values
- * must be in the range [0,18].
- * pThresholds - Array of size 8 containing thresholds, TC0, for the left
- * vertical edge of each 4x2 chroma block, arranged in vertical
- * block order; must be aligned on a 4-byte boundary. Per
- * [ISO14496-10] values must be in the range [0,25].
- * pBS - Array of size 16 of BS parameters (values for each 2x2 chroma
- * block, arranged in vertical block order). This parameter is the
- * same as the pBS parameter passed into FilterDeblockLuma_VerEdge;
- * valid in the range [0,4] with the following restrictions: i)
- * pBS[i]== 4 may occur only for 0<=i<=3, ii) pBS[i]== 4 if and
- * only if pBS[i^3]== 4. Must be 4 byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst -Pointer to filtered output macroblock.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr, if the function runs without error.
- *
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - one or more of the following pointers is NULL: pSrcDst, pAlpha,
- * pBeta, pThresholds, or pBS.
- * - pSrcDst is not 8-byte aligned.
- * - srcdstStep is not a multiple of 8.
- * - pThresholds is not 4-byte aligned.
- * - pAlpha[0] and/or pAlpha[1] is outside the range [0,255].
- * - pBeta[0] and/or pBeta[1] is outside the range [0,18].
- * - One or more entries in the table pThresholds[0..7] is outside
- * of the range [0,25].
- * - pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
- * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
- * - pBS is not 4-byte aligned.
- *
- */
-OMXResult omxVCM4P10_FilterDeblockingChroma_VerEdge_I (
- OMX_U8 *pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8 *pAlpha,
- const OMX_U8 *pBeta,
- const OMX_U8 *pThresholds,
- const OMX_U8 *pBS
-);
-
-
-
-/**
- * Function: omxVCM4P10_FilterDeblockingChroma_HorEdge_I (6.3.3.3.4)
- *
- * Description:
- * Performs in-place deblock filtering on the horizontal edges of the chroma
- * macroblock (8x8).
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input macroblock; must be 8-byte aligned.
- * srcdstStep - array step; must be a multiple of 8.
- * pAlpha - array of size 2 containing alpha thresholds; the first element
- * contains the threshold for the external horizontal edge, and the
- * second element contains the threshold for internal horizontal
- * edge. Per [ISO14496-10] alpha values must be in the range
- * [0,255].
- * pBeta - array of size 2 containing beta thresholds; the first element
- * contains the threshold for the external horizontal edge, and the
- * second element contains the threshold for the internal
- * horizontal edge. Per [ISO14496-10] beta values must be in the
- * range [0,18].
- * pThresholds - array of size 8 containing thresholds, TC0, for the top
- * horizontal edge of each 2x4 chroma block, arranged in horizontal
- * block order; must be aligned on a 4-byte boundary. Per
- * [ISO14496-10] values must be in the range [0,25].
- * pBS - array of size 16 containing BS parameters for each 2x2 chroma
- * block, arranged in horizontal block order; valid in the range
- * [0,4] with the following restrictions: i) pBS[i]== 4 may occur
- * only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]== 4.
- * Must be 4-byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst -Pointer to filtered output macroblock.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr, if the function runs without error.
- *
- * OMX_Sts_BadArgErr, if one of the following cases occurs:
- * - any of the following pointers is NULL:
- * pSrcDst, pAlpha, pBeta, pThresholds, or pBS.
- * - pSrcDst is not 8-byte aligned.
- * - srcdstStep is not a multiple of 8.
- * - pThresholds is not 4-byte aligned.
- * - pAlpha[0] and/or pAlpha[1] is outside the range [0,255].
- * - pBeta[0] and/or pBeta[1] is outside the range [0,18].
- * - One or more entries in the table pThresholds[0..7] is outside
- * of the range [0,25].
- * - pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
- * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
- * - pBS is not 4-byte aligned.
- *
- */
-OMXResult omxVCM4P10_FilterDeblockingChroma_HorEdge_I (
- OMX_U8 *pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8 *pAlpha,
- const OMX_U8 *pBeta,
- const OMX_U8 *pThresholds,
- const OMX_U8 *pBS
-);
-
-
-
-/**
- * Function: omxVCM4P10_DeblockLuma_I (6.3.3.3.5)
- *
- * Description:
- * This function performs in-place deblock filtering the horizontal and
- * vertical edges of a luma macroblock (16x16).
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input macroblock; must be 16-byte aligned.
- * srcdstStep - image width; must be a multiple of 16.
- * pAlpha - pointer to a 2x2 table of alpha thresholds, organized as
- * follows: {external vertical edge, internal vertical edge,
- * external horizontal edge, internal horizontal edge }. Per
- * [ISO14496-10] alpha values must be in the range [0,255].
- * pBeta - pointer to a 2x2 table of beta thresholds, organized as follows:
- * {external vertical edge, internal vertical edge, external
- * horizontal edge, internal horizontal edge }. Per [ISO14496-10]
- * beta values must be in the range [0,18].
- * pThresholds - pointer to a 16x2 table of threshold (TC0), organized as
- * follows: {values for the left or above edge of each 4x4 block,
- * arranged in vertical block order and then in horizontal block
- * order}; must be aligned on a 4-byte boundary. Per [ISO14496-10]
- * values must be in the range [0,25].
- * pBS - pointer to a 16x2 table of BS parameters arranged in scan block
- * order for vertical edges and then horizontal edges; valid in the
- * range [0,4] with the following restrictions: i) pBS[i]== 4 may
- * occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]==
- * 4. Must be 4-byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to filtered output macroblock.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - one or more of the following pointers is NULL: pSrcDst, pAlpha,
- * pBeta, pThresholds or pBS.
- * - pSrcDst is not 16-byte aligned.
- * - either pThresholds or pBS is not aligned on a 4-byte boundary.
- * - one or more entries in the table pAlpha[0..3] is outside the range
- * [0,255].
- * - one or more entries in the table pBeta[0..3] is outside the range
- * [0,18].
- * - one or more entries in the table pThresholds[0..31]is outside of
- * the range [0,25].
- * - pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
- * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
- * - srcdstStep is not a multiple of 16.
- *
- */
-OMXResult omxVCM4P10_DeblockLuma_I (
- OMX_U8 *pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8 *pAlpha,
- const OMX_U8 *pBeta,
- const OMX_U8 *pThresholds,
- const OMX_U8 *pBS
-);
-
-
-
-/**
- * Function: omxVCM4P10_DeblockChroma_I (6.3.3.3.6)
- *
- * Description:
- * Performs in-place deblocking filtering on all edges of the chroma
- * macroblock (16x16).
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input macroblock; must be 8-byte aligned.
- * srcdstStep - step of the arrays; must be a multiple of 8.
- * pAlpha - pointer to a 2x2 array of alpha thresholds, organized as
- * follows: {external vertical edge, internal vertical edge,
- * external horizontal edge, internal horizontal edge }. Per
- * [ISO14496-10] alpha values must be in the range [0,255].
- * pBeta - pointer to a 2x2 array of Beta Thresholds, organized as follows:
- * { external vertical edge, internal vertical edge, external
- * horizontal edge, internal horizontal edge }. Per [ISO14496-10]
- * beta values must be in the range [0,18].
- * pThresholds - array of size 8x2 of Thresholds (TC0) (values for the left
- * or above edge of each 4x2 or 2x4 block, arranged in vertical
- * block order and then in horizontal block order); must be aligned
- * on a 4-byte boundary. Per [ISO14496-10] values must be in the
- * range [0,25].
- * pBS - array of size 16x2 of BS parameters (arranged in scan block order
- * for vertical edges and then horizontal edges); valid in the
- * range [0,4] with the following restrictions: i) pBS[i]== 4 may
- * occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]==
- * 4. Must be 4-byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to filtered output macroblock.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - one or more of the following pointers is NULL: pSrcDst, pAlpha,
- * pBeta, pThresholds, or pBS.
- * - pSrcDst is not 8-byte aligned.
- * - either pThresholds or pBS is not 4-byte aligned.
- * - one or more entries in the table pAlpha[0..3] is outside the range
- * [0,255].
- * - one or more entries in the table pBeta[0..3] is outside the range
- * [0,18].
- * - one or more entries in the table pThresholds[0..15]is outside of
- * the range [0,25].
- * - pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
- * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
- * - srcdstStep is not a multiple of 8.
- *
- */
-OMXResult omxVCM4P10_DeblockChroma_I (
- OMX_U8 *pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8 *pAlpha,
- const OMX_U8 *pBeta,
- const OMX_U8 *pThresholds,
- const OMX_U8 *pBS
-);
-
-
-
-/**
- * Function: omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC (6.3.4.1.1)
- *
- * Description:
- * Performs CAVLC decoding and inverse raster scan for a 2x2 block of
- * ChromaDCLevel. The decoded coefficients in the packed position-coefficient
- * buffer are stored in reverse zig-zag order, i.e., the first buffer element
- * contains the last non-zero postion-coefficient pair of the block. Within
- * each position-coefficient pair, the position entry indicates the
- * raster-scan position of the coefficient, while the coefficient entry
- * contains the coefficient value.
- *
- * Input Arguments:
- *
- * ppBitStream - Double pointer to current byte in bit stream buffer
- * pOffset - Pointer to current bit position in the byte pointed to by
- * *ppBitStream; valid in the range [0,7].
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after each block is decoded
- * pOffset - *pOffset is updated after each block is decoded
- * pNumCoeff - Pointer to the number of nonzero coefficients in this block
- * ppPosCoefBuf - Double pointer to destination residual
- * coefficient-position pair buffer. Buffer position
- * (*ppPosCoefBuf) is updated upon return, unless there are only
- * zero coefficients in the currently decoded block. In this case
- * the caller is expected to bypass the transform/dequantization of
- * the empty blocks.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr, if the function runs without error.
- *
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - ppBitStream or pOffset is NULL.
- * - ppPosCoefBuf or pNumCoeff is NULL.
- * OMX_Sts_Err - if one of the following is true:
- * - an illegal code is encountered in the bitstream
- *
- */
-OMXResult omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC (
- const OMX_U8 **ppBitStream,
- OMX_S32*pOffset,
- OMX_U8 *pNumCoeff,
- OMX_U8 **ppPosCoefbuf
-);
-
-
-
-/**
- * Function: omxVCM4P10_DecodeCoeffsToPairCAVLC (6.3.4.1.2)
- *
- * Description:
- * Performs CAVLC decoding and inverse zigzag scan for 4x4 block of
- * Intra16x16DCLevel, Intra16x16ACLevel, LumaLevel, and ChromaACLevel. Inverse
- * field scan is not supported. The decoded coefficients in the packed
- * position-coefficient buffer are stored in reverse zig-zag order, i.e., the
- * first buffer element contains the last non-zero postion-coefficient pair of
- * the block. Within each position-coefficient pair, the position entry
- * indicates the raster-scan position of the coefficient, while the
- * coefficient entry contains the coefficient value.
- *
- * Input Arguments:
- *
- * ppBitStream -Double pointer to current byte in bit stream buffer
- * pOffset - Pointer to current bit position in the byte pointed to by
- * *ppBitStream; valid in the range [0,7].
- * sMaxNumCoeff - Maximum the number of non-zero coefficients in current
- * block
- * sVLCSelect - VLC table selector, obtained from the number of non-zero
- * coefficients contained in the above and left 4x4 blocks. It is
- * equivalent to the variable nC described in H.264 standard table
- * 9 5, except its value can t be less than zero.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after each block is decoded.
- * Buffer position (*ppPosCoefBuf) is updated upon return, unless
- * there are only zero coefficients in the currently decoded block.
- * In this case the caller is expected to bypass the
- * transform/dequantization of the empty blocks.
- * pOffset - *pOffset is updated after each block is decoded
- * pNumCoeff - Pointer to the number of nonzero coefficients in this block
- * ppPosCoefBuf - Double pointer to destination residual
- * coefficient-position pair buffer
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- *
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - ppBitStream or pOffset is NULL.
- * - ppPosCoefBuf or pNumCoeff is NULL.
- * - sMaxNumCoeff is not equal to either 15 or 16.
- * - sVLCSelect is less than 0.
- *
- * OMX_Sts_Err - if one of the following is true:
- * - an illegal code is encountered in the bitstream
- *
- */
-OMXResult omxVCM4P10_DecodeCoeffsToPairCAVLC (
- const OMX_U8 **ppBitStream,
- OMX_S32 *pOffset,
- OMX_U8 *pNumCoeff,
- OMX_U8 **ppPosCoefbuf,
- OMX_INT sVLCSelect,
- OMX_INT sMaxNumCoeff
-);
-
-
-
-/**
- * Function: omxVCM4P10_TransformDequantLumaDCFromPair (6.3.4.2.1)
- *
- * Description:
- * Reconstructs the 4x4 LumaDC block from the coefficient-position pair
- * buffer, performs integer inverse, and dequantization for 4x4 LumaDC
- * coefficients, and updates the pair buffer pointer to the next non-empty
- * block.
- *
- * Input Arguments:
- *
- * ppSrc - Double pointer to residual coefficient-position pair buffer
- * output by CALVC decoding
- * QP - Quantization parameter QpY
- *
- * Output Arguments:
- *
- * ppSrc - *ppSrc is updated to the start of next non empty block
- * pDst - Pointer to the reconstructed 4x4 LumaDC coefficients buffer; must
- * be aligned on a 8-byte boundary.
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - ppSrc or pDst is NULL.
- * - pDst is not 8 byte aligned.
- * - QP is not in the range of [0-51].
- *
- */
-OMXResult omxVCM4P10_TransformDequantLumaDCFromPair (
- const OMX_U8 **ppSrc,
- OMX_S16 *pDst,
- OMX_INT QP
-);
-
-
-
-/**
- * Function: omxVCM4P10_TransformDequantChromaDCFromPair (6.3.4.2.2)
- *
- * Description:
- * Reconstruct the 2x2 ChromaDC block from coefficient-position pair buffer,
- * perform integer inverse transformation, and dequantization for 2x2 chroma
- * DC coefficients, and update the pair buffer pointer to next non-empty
- * block.
- *
- * Input Arguments:
- *
- * ppSrc - Double pointer to residual coefficient-position pair buffer
- * output by CALVC decoding
- * QP - Quantization parameter QpC
- *
- * Output Arguments:
- *
- * ppSrc - *ppSrc is updated to the start of next non empty block
- * pDst - Pointer to the reconstructed 2x2 ChromaDC coefficients buffer;
- * must be aligned on a 4-byte boundary.
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - ppSrc or pDst is NULL.
- * - pDst is not 4-byte aligned.
- * - QP is not in the range of [0-51].
- *
- */
-OMXResult omxVCM4P10_TransformDequantChromaDCFromPair (
- const OMX_U8 **ppSrc,
- OMX_S16 *pDst,
- OMX_INT QP
-);
-
-
-
-/**
- * Function: omxVCM4P10_DequantTransformResidualFromPairAndAdd (6.3.4.2.3)
- *
- * Description:
- * Reconstruct the 4x4 residual block from coefficient-position pair buffer,
- * perform dequantization and integer inverse transformation for 4x4 block of
- * residuals with previous intra prediction or motion compensation data, and
- * update the pair buffer pointer to next non-empty block. If pDC == NULL,
- * there re 16 non-zero AC coefficients at most in the packed buffer starting
- * from 4x4 block position 0; If pDC != NULL, there re 15 non-zero AC
- * coefficients at most in the packet buffer starting from 4x4 block position
- * 1.
- *
- * Input Arguments:
- *
- * ppSrc - Double pointer to residual coefficient-position pair buffer
- * output by CALVC decoding
- * pPred - Pointer to the predicted 4x4 block; must be aligned on a 4-byte
- * boundary
- * predStep - Predicted frame step size in bytes; must be a multiple of 4
- * dstStep - Destination frame step in bytes; must be a multiple of 4
- * pDC - Pointer to the DC coefficient of this block, NULL if it doesn't
- * exist
- * QP - QP Quantization parameter. It should be QpC in chroma 4x4 block
- * decoding, otherwise it should be QpY.
- * AC - Flag indicating if at least one non-zero AC coefficient exists
- *
- * Output Arguments:
- *
- * pDst - pointer to the reconstructed 4x4 block data; must be aligned on a
- * 4-byte boundary
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - pPred or pDst is NULL.
- * - pPred or pDst is not 4-byte aligned.
- * - predStep or dstStep is not a multiple of 4.
- * - AC !=0 and Qp is not in the range of [0-51] or ppSrc == NULL.
- * - AC ==0 && pDC ==NULL.
- *
- */
-OMXResult omxVCM4P10_DequantTransformResidualFromPairAndAdd (
- const OMX_U8 **ppSrc,
- const OMX_U8 *pPred,
- const OMX_S16 *pDC,
- OMX_U8 *pDst,
- OMX_INT predStep,
- OMX_INT dstStep,
- OMX_INT QP,
- OMX_INT AC
-);
-
-
-
-/**
- * Function: omxVCM4P10_MEGetBufSize (6.3.5.1.1)
- *
- * Description:
- * Computes the size, in bytes, of the vendor-specific specification
- * structure for the omxVCM4P10 motion estimation functions BlockMatch_Integer
- * and MotionEstimationMB.
- *
- * Input Arguments:
- *
- * MEmode - motion estimation mode; available modes are defined by the
- * enumerated type OMXVCM4P10MEMode
- * pMEParams -motion estimation parameters
- *
- * Output Arguments:
- *
- * pSize - pointer to the number of bytes required for the motion
- * estimation specification structure
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - pMEParams or pSize is NULL.
- * - an invalid MEMode is specified.
- *
- */
-OMXResult omxVCM4P10_MEGetBufSize (
- OMXVCM4P10MEMode MEmode,
- const OMXVCM4P10MEParams *pMEParams,
- OMX_U32 *pSize
-);
-
-
-
-/**
- * Function: omxVCM4P10_MEInit (6.3.5.1.2)
- *
- * Description:
- * Initializes the vendor-specific specification structure required for the
- * omxVCM4P10 motion estimation functions: BlockMatch_Integer and
- * MotionEstimationMB. Memory for the specification structure *pMESpec must be
- * allocated prior to calling the function, and should be aligned on a 4-byte
- * boundary. The number of bytes required for the specification structure can
- * be determined using the function omxVCM4P10_MEGetBufSize. Following
- * initialization by this function, the vendor-specific structure *pMESpec
- * should contain an implementation-specific representation of all motion
- * estimation parameters received via the structure pMEParams, for example
- * searchRange16x16, searchRange8x8, etc.
- *
- * Input Arguments:
- *
- * MEmode - motion estimation mode; available modes are defined by the
- * enumerated type OMXVCM4P10MEMode
- * pMEParams - motion estimation parameters
- * pMESpec - pointer to the uninitialized ME specification structure
- *
- * Output Arguments:
- *
- * pMESpec - pointer to the initialized ME specification structure
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - pMEParams or pSize is NULL.
- * - an invalid value was specified for the parameter MEmode
- * - a negative or zero value was specified for one of the search ranges
- * (e.g., pMBParams >searchRange8x8, pMEParams->searchRange16x16, etc.)
- * - either in isolation or in combination, one or more of the enables or
- * search ranges in the structure *pMEParams were configured such
- * that the requested behavior fails to comply with [ISO14496-10].
- *
- */
-OMXResult omxVCM4P10_MEInit (
- OMXVCM4P10MEMode MEmode,
- const OMXVCM4P10MEParams *pMEParams,
- void *pMESpec
-);
-
-
-
-/**
- * Function: omxVCM4P10_BlockMatch_Integer (6.3.5.2.1)
- *
- * Description:
- * Performs integer block match. Returns best MV and associated cost.
- *
- * Input Arguments:
- *
- * pSrcOrgY - Pointer to the top-left corner of the current block:
- * If iBlockWidth==4, 4-byte alignment required.
- * If iBlockWidth==8, 8-byte alignment required.
- * If iBlockWidth==16, 16-byte alignment required.
- * pSrcRefY - Pointer to the top-left corner of the co-located block in the
- * reference picture:
- * If iBlockWidth==4, 4-byte alignment required.
- * If iBlockWidth==8, 8-byte alignment required.
- * If iBlockWidth==16, 16-byte alignment required.
- * nSrcOrgStep - Stride of the original picture plane, expressed in terms
- * of integer pixels; must be a multiple of iBlockWidth.
- * nSrcRefStep - Stride of the reference picture plane, expressed in terms
- * of integer pixels
- * pRefRect - pointer to the valid reference rectangle inside the reference
- * picture plane
- * nCurrPointPos - position of the current block in the current plane
- * iBlockWidth - Width of the current block, expressed in terms of integer
- * pixels; must be equal to either 4, 8, or 16.
- * iBlockHeight - Height of the current block, expressed in terms of
- * integer pixels; must be equal to either 4, 8, or 16.
- * nLamda - Lamda factor; used to compute motion cost
- * pMVPred - Predicted MV; used to compute motion cost, expressed in terms
- * of 1/4-pel units
- * pMVCandidate - Candidate MV; used to initialize the motion search,
- * expressed in terms of integer pixels
- * pMESpec - pointer to the ME specification structure
- *
- * Output Arguments:
- *
- * pDstBestMV - Best MV resulting from integer search, expressed in terms
- * of 1/4-pel units
- * pBestCost - Motion cost associated with the best MV; computed as
- * SAD+Lamda*BitsUsedByMV
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - any of the following pointers are NULL:
- * pSrcOrgY, pSrcRefY, pRefRect, pMVPred, pMVCandidate, or pMESpec.
- * - Either iBlockWidth or iBlockHeight are values other than 4, 8, or 16.
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_BlockMatch_Integer (
- const OMX_U8 *pSrcOrgY,
- OMX_S32 nSrcOrgStep,
- const OMX_U8 *pSrcRefY,
- OMX_S32 nSrcRefStep,
- const OMXRect *pRefRect,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- OMX_U8 iBlockWidth,
- OMX_U8 iBlockHeight,
- OMX_U32 nLamda,
- const OMXVCMotionVector *pMVPred,
- const OMXVCMotionVector *pMVCandidate,
- OMXVCMotionVector *pBestMV,
- OMX_S32 *pBestCost,
- void *pMESpec
-);
-
-
-
-/**
- * Function: omxVCM4P10_BlockMatch_Half (6.3.5.2.2)
- *
- * Description:
- * Performs a half-pel block match using results from a prior integer search.
- * Returns the best MV and associated cost. This function estimates the
- * half-pixel motion vector by interpolating the integer resolution motion
- * vector referenced by the input parameter pSrcDstBestMV, i.e., the initial
- * integer MV is generated externally. The function
- * omxVCM4P10_BlockMatch_Integer may be used for integer motion estimation.
- *
- * Input Arguments:
- *
- * pSrcOrgY - Pointer to the current position in original picture plane:
- * If iBlockWidth==4, 4-byte alignment required.
- * If iBlockWidth==8, 8-byte alignment required.
- * If iBlockWidth==16, 16-byte alignment required.
- * pSrcRefY - Pointer to the top-left corner of the co-located block in the
- * reference picture:
- * If iBlockWidth==4, 4-byte alignment required.
- * If iBlockWidth==8, 8-byte alignment required.
- * If iBlockWidth==16, 16-byte alignment required.
- * nSrcOrgStep - Stride of the original picture plane in terms of full
- * pixels; must be a multiple of iBlockWidth.
- * nSrcRefStep - Stride of the reference picture plane in terms of full
- * pixels
- * iBlockWidth - Width of the current block in terms of full pixels; must
- * be equal to either 4, 8, or 16.
- * iBlockHeight - Height of the current block in terms of full pixels; must
- * be equal to either 4, 8, or 16.
- * nLamda - Lamda factor, used to compute motion cost
- * pMVPred - Predicted MV, represented in terms of 1/4-pel units; used to
- * compute motion cost
- * pSrcDstBestMV - The best MV resulting from a prior integer search,
- * represented in terms of 1/4-pel units
- *
- * Output Arguments:
- *
- * pSrcDstBestMV - Best MV resulting from the half-pel search, expressed in
- * terms of 1/4-pel units
- * pBestCost - Motion cost associated with the best MV; computed as
- * SAD+Lamda*BitsUsedByMV
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - any of the following pointers is NULL: pSrcOrgY, pSrcRefY,
- * pSrcDstBestMV, pMVPred, pBestCost
- * - iBlockWidth or iBlockHeight are equal to values other than 4, 8, or 16.
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_BlockMatch_Half (
- const OMX_U8 *pSrcOrgY,
- OMX_S32 nSrcOrgStep,
- const OMX_U8 *pSrcRefY,
- OMX_S32 nSrcRefStep,
- OMX_U8 iBlockWidth,
- OMX_U8 iBlockHeight,
- OMX_U32 nLamda,
- const OMXVCMotionVector *pMVPred,
- OMXVCMotionVector *pSrcDstBestMV,
- OMX_S32 *pBestCost
-);
-
-
-
-/**
- * Function: omxVCM4P10_BlockMatch_Quarter (6.3.5.2.3)
- *
- * Description:
- * Performs a quarter-pel block match using results from a prior half-pel
- * search. Returns the best MV and associated cost. This function estimates
- * the quarter-pixel motion vector by interpolating the half-pel resolution
- * motion vector referenced by the input parameter pSrcDstBestMV, i.e., the
- * initial half-pel MV is generated externally. The function
- * omxVCM4P10_BlockMatch_Half may be used for half-pel motion estimation.
- *
- * Input Arguments:
- *
- * pSrcOrgY - Pointer to the current position in original picture plane:
- * If iBlockWidth==4, 4-byte alignment required.
- * If iBlockWidth==8, 8-byte alignment required.
- * If iBlockWidth==16, 16-byte alignment required.
- * pSrcRefY - Pointer to the top-left corner of the co-located block in the
- * reference picture:
- * If iBlockWidth==4, 4-byte alignment required.
- * If iBlockWidth==8, 8-byte alignment required.
- * If iBlockWidth==16, 16-byte alignment required.
- * nSrcOrgStep - Stride of the original picture plane in terms of full
- * pixels; must be a multiple of iBlockWidth.
- * nSrcRefStep - Stride of the reference picture plane in terms of full
- * pixels
- * iBlockWidth - Width of the current block in terms of full pixels; must
- * be equal to either 4, 8, or 16.
- * iBlockHeight - Height of the current block in terms of full pixels; must
- * be equal to either 4, 8, or 16.
- * nLamda - Lamda factor, used to compute motion cost
- * pMVPred - Predicted MV, represented in terms of 1/4-pel units; used to
- * compute motion cost
- * pSrcDstBestMV - The best MV resulting from a prior half-pel search,
- * represented in terms of 1/4 pel units
- *
- * Output Arguments:
- *
- * pSrcDstBestMV - Best MV resulting from the quarter-pel search, expressed
- * in terms of 1/4-pel units
- * pBestCost - Motion cost associated with the best MV; computed as
- * SAD+Lamda*BitsUsedByMV
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - One or more of the following pointers is NULL:
- * pSrcOrgY, pSrcRefY, pSrcDstBestMV, pMVPred, pBestCost
- * - iBlockWidth or iBlockHeight are equal to values other than 4, 8, or 16.
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_BlockMatch_Quarter (
- const OMX_U8 *pSrcOrgY,
- OMX_S32 nSrcOrgStep,
- const OMX_U8 *pSrcRefY,
- OMX_S32 nSrcRefStep,
- OMX_U8 iBlockWidth,
- OMX_U8 iBlockHeight,
- OMX_U32 nLamda,
- const OMXVCMotionVector *pMVPred,
- OMXVCMotionVector *pSrcDstBestMV,
- OMX_S32 *pBestCost
-);
-
-
-
-/**
- * Function: omxVCM4P10_MotionEstimationMB (6.3.5.3.1)
- *
- * Description:
- * Performs MB-level motion estimation and selects best motion estimation
- * strategy from the set of modes supported in baseline profile [ISO14496-10].
- *
- * Input Arguments:
- *
- * pSrcCurrBuf - Pointer to the current position in original picture plane;
- * 16-byte alignment required
- * pSrcRefBufList - Pointer to an array with 16 entries. Each entry points
- * to the top-left corner of the co-located MB in a reference
- * picture. The array is filled from low-to-high with valid
- * reference frame pointers; the unused high entries should be set
- * to NULL. Ordering of the reference frames should follow
- * [ISO14496-10] subclause 8.2.4 Decoding Process for Reference
- * Picture Lists. The entries must be 16-byte aligned.
- * pSrcRecBuf - Pointer to the top-left corner of the co-located MB in the
- * reconstructed picture; must be 16-byte aligned.
- * SrcCurrStep - Width of the original picture plane in terms of full
- * pixels; must be a multiple of 16.
- * SrcRefStep - Width of the reference picture plane in terms of full
- * pixels; must be a multiple of 16.
- * SrcRecStep - Width of the reconstructed picture plane in terms of full
- * pixels; must be a multiple of 16.
- * pRefRect - Pointer to the valid reference rectangle; relative to the
- * image origin.
- * pCurrPointPos - Position of the current macroblock in the current plane.
- * Lambda - Lagrange factor for computing the cost function
- * pMESpec - Pointer to the motion estimation specification structure; must
- * have been allocated and initialized prior to calling this
- * function.
- * pMBInter - Array, of dimension four, containing pointers to information
- * associated with four adjacent type INTER MBs (Left, Top,
- * Top-Left, Top-Right). Any pointer in the array may be set equal
- * to NULL if the corresponding MB doesn t exist or is not of type
- * INTER.
- * - pMBInter[0] - Pointer to left MB information
- * - pMBInter[1] - Pointer to top MB information
- * - pMBInter[2] - Pointer to top-left MB information
- * - pMBInter[3] - Pointer to top-right MB information
- * pMBIntra - Array, of dimension four, containing pointers to information
- * associated with four adjacent type INTRA MBs (Left, Top,
- * Top-Left, Top-Right). Any pointer in the array may be set equal
- * to NULL if the corresponding MB doesn t exist or is not of type
- * INTRA.
- * - pMBIntra[0] - Pointer to left MB information
- * - pMBIntra[1] - Pointer to top MB information
- * - pMBIntra[2] - Pointer to top-left MB information
- * - pMBIntra[3] - Pointer to top-right MB information
- * pSrcDstMBCurr - Pointer to information structure for the current MB.
- * The following entries should be set prior to calling the
- * function: sliceID - the number of the slice the to which the
- * current MB belongs.
- *
- * Output Arguments:
- *
- * pDstCost - Pointer to the minimum motion cost for the current MB.
- * pDstBlockSAD - Pointer to the array of SADs for each of the sixteen luma
- * 4x4 blocks in each MB. The block SADs are in scan order for
- * each MB. For implementations that cannot compute the SAD values
- * individually, the maximum possible value (0xffff) is returned
- * for each of the 16 block SAD entries.
- * pSrcDstMBCurr - Pointer to updated information structure for the current
- * MB after MB-level motion estimation has been completed. The
- * following fields are updated by the ME function. The following
- * parameter set quantifies the MB-level ME search results:
- * - MbType
- * - subMBType[4]
- * - pMV0[4][4]
- * - pMVPred[4][4]
- * - pRefL0Idx[4]
- * - Intra16x16PredMode
- * - pIntra4x4PredMode[4][4]
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - One or more of the following pointers is NULL: pSrcCurrBuf,
- * pSrcRefBufList, pSrcRecBuf, pRefRect, pCurrPointPos, pMESpec,
- * pMBInter, pMBIntra,pSrcDstMBCurr, pDstCost, pSrcRefBufList[0]
- * - SrcRefStep, SrcRecStep are not multiples of 16
- * - iBlockWidth or iBlockHeight are values other than 4, 8, or 16.
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_MotionEstimationMB (
- const OMX_U8 *pSrcCurrBuf,
- OMX_S32 SrcCurrStep,
- const OMX_U8 *pSrcRefBufList[15],
- OMX_S32 SrcRefStep,
- const OMX_U8 *pSrcRecBuf,
- OMX_S32 SrcRecStep,
- const OMXRect *pRefRect,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- OMX_U32 Lambda,
- void *pMESpec,
- const OMXVCM4P10MBInfoPtr *pMBInter,
- const OMXVCM4P10MBInfoPtr *pMBIntra,
- OMXVCM4P10MBInfoPtr pSrcDstMBCurr,
- OMX_INT *pDstCost,
- OMX_U16 *pDstBlockSAD
-);
-
-
-
-/**
- * Function: omxVCM4P10_SAD_4x (6.3.5.4.1)
- *
- * Description:
- * This function calculates the SAD for 4x8 and 4x4 blocks.
- *
- * Input Arguments:
- *
- * pSrcOrg -Pointer to the original block; must be aligned on a 4-byte
- * boundary.
- * iStepOrg -Step of the original block buffer; must be a multiple of 4.
- * pSrcRef -Pointer to the reference block
- * iStepRef -Step of the reference block buffer
- * iHeight -Height of the block; must be equal to either 4 or 8.
- *
- * Output Arguments:
- *
- * pDstSAD -Pointer of result SAD
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - One or more of the following pointers is NULL:
- * pSrcOrg, pSrcRef, or pDstSAD
- * - iHeight is not equal to either 4 or 8.
- * - iStepOrg is not a multiple of 4
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_SAD_4x (
- const OMX_U8 *pSrcOrg,
- OMX_U32 iStepOrg,
- const OMX_U8 *pSrcRef,
- OMX_U32 iStepRef,
- OMX_S32 *pDstSAD,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_SADQuar_4x (6.3.5.4.2)
- *
- * Description:
- * This function calculates the SAD between one block (pSrc) and the average
- * of the other two (pSrcRef0 and pSrcRef1) for 4x8 or 4x4 blocks. Rounding
- * is applied according to the convention (a+b+1)>>1.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the original block; must be aligned on a 4-byte
- * boundary.
- * pSrcRef0 - Pointer to reference block 0
- * pSrcRef1 - Pointer to reference block 1
- * iSrcStep - Step of the original block buffer; must be a multiple of 4.
- * iRefStep0 - Step of reference block 0
- * iRefStep1 - Step of reference block 1
- * iHeight - Height of the block; must be equal to either 4 or 8.
- *
- * Output Arguments:
- *
- * pDstSAD - Pointer of result SAD
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - iHeight is not equal to either 4 or 8.
- * - One or more of the following pointers is NULL: pSrc, pSrcRef0,
- * pSrcRef1, pDstSAD.
- * - iSrcStep is not a multiple of 4
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_SADQuar_4x (
- const OMX_U8 *pSrc,
- const OMX_U8 *pSrcRef0,
- const OMX_U8 *pSrcRef1,
- OMX_U32 iSrcStep,
- OMX_U32 iRefStep0,
- OMX_U32 iRefStep1,
- OMX_U32 *pDstSAD,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_SADQuar_8x (6.3.5.4.3)
- *
- * Description:
- * This function calculates the SAD between one block (pSrc) and the average
- * of the other two (pSrcRef0 and pSrcRef1) for 8x16, 8x8, or 8x4 blocks.
- * Rounding is applied according to the convention (a+b+1)>>1.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the original block; must be aligned on an 8-byte
- * boundary.
- * pSrcRef0 - Pointer to reference block 0
- * pSrcRef1 - Pointer to reference block 1
- * iSrcStep - Step of the original block buffer; must be a multiple of 8.
- * iRefStep0 - Step of reference block 0
- * iRefStep1 - Step of reference block 1
- * iHeight - Height of the block; must be equal either 4, 8, or 16.
- *
- * Output Arguments:
- *
- * pDstSAD - Pointer of result SAD
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - iHeight is not equal to either 4, 8, or 16.
- * - One or more of the following pointers is NULL: pSrc, pSrcRef0,
- * pSrcRef1, pDstSAD.
- * - iSrcStep is not a multiple of 8
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_SADQuar_8x (
- const OMX_U8 *pSrc,
- const OMX_U8 *pSrcRef0,
- const OMX_U8 *pSrcRef1,
- OMX_U32 iSrcStep,
- OMX_U32 iRefStep0,
- OMX_U32 iRefStep1,
- OMX_U32 *pDstSAD,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_SADQuar_16x (6.3.5.4.4)
- *
- * Description:
- * This function calculates the SAD between one block (pSrc) and the average
- * of the other two (pSrcRef0 and pSrcRef1) for 16x16 or 16x8 blocks.
- * Rounding is applied according to the convention (a+b+1)>>1.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the original block; must be aligned on a 16-byte
- * boundary.
- * pSrcRef0 - Pointer to reference block 0
- * pSrcRef1 - Pointer to reference block 1
- * iSrcStep - Step of the original block buffer; must be a multiple of 16
- * iRefStep0 - Step of reference block 0
- * iRefStep1 - Step of reference block 1
- * iHeight - Height of the block; must be equal to either 8 or 16
- *
- * Output Arguments:
- *
- * pDstSAD -Pointer of result SAD
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - iHeight is not equal to either 8 or 16.
- * - One or more of the following pointers is NULL: pSrc, pSrcRef0,
- * pSrcRef1, pDstSAD.
- * - iSrcStep is not a multiple of 16
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_SADQuar_16x (
- const OMX_U8 *pSrc,
- const OMX_U8 *pSrcRef0,
- const OMX_U8 *pSrcRef1,
- OMX_U32 iSrcStep,
- OMX_U32 iRefStep0,
- OMX_U32 iRefStep1,
- OMX_U32 *pDstSAD,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_SATD_4x4 (6.3.5.4.5)
- *
- * Description:
- * This function calculates the sum of absolute transform differences (SATD)
- * for a 4x4 block by applying a Hadamard transform to the difference block
- * and then calculating the sum of absolute coefficient values.
- *
- * Input Arguments:
- *
- * pSrcOrg - Pointer to the original block; must be aligned on a 4-byte
- * boundary
- * iStepOrg - Step of the original block buffer; must be a multiple of 4
- * pSrcRef - Pointer to the reference block; must be aligned on a 4-byte
- * boundary
- * iStepRef - Step of the reference block buffer; must be a multiple of 4
- *
- * Output Arguments:
- *
- * pDstSAD - pointer to the resulting SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrcOrg, pSrcRef, or pDstSAD either pSrcOrg
- * - pSrcRef is not aligned on a 4-byte boundary
- * - iStepOrg <= 0 or iStepOrg is not a multiple of 4
- * - iStepRef <= 0 or iStepRef is not a multiple of 4
- *
- */
-OMXResult omxVCM4P10_SATD_4x4 (
- const OMX_U8 *pSrcOrg,
- OMX_U32 iStepOrg,
- const OMX_U8 *pSrcRef,
- OMX_U32 iStepRef,
- OMX_U32 *pDstSAD
-);
-
-
-
-/**
- * Function: omxVCM4P10_InterpolateHalfHor_Luma (6.3.5.5.1)
- *
- * Description:
- * This function performs interpolation for two horizontal 1/2-pel positions
- * (-1/2,0) and (1/2, 0) - around a full-pel position.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the top-left corner of the block used to interpolate in
- * the reconstruction frame plane.
- * iSrcStep - Step of the source buffer.
- * iDstStep - Step of the destination(interpolation) buffer; must be a
- * multiple of iWidth.
- * iWidth - Width of the current block; must be equal to either 4, 8, or 16
- * iHeight - Height of the current block; must be equal to 4, 8, or 16
- *
- * Output Arguments:
- *
- * pDstLeft -Pointer to the interpolation buffer of the left -pel position
- * (-1/2, 0)
- * If iWidth==4, 4-byte alignment required.
- * If iWidth==8, 8-byte alignment required.
- * If iWidth==16, 16-byte alignment required.
- * pDstRight -Pointer to the interpolation buffer of the right -pel
- * position (1/2, 0)
- * If iWidth==4, 4-byte alignment required.
- * If iWidth==8, 8-byte alignment required.
- * If iWidth==16, 16-byte alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrc, pDstLeft, or pDstRight
- * - iWidth or iHeight have values other than 4, 8, or 16
- * - iWidth==4 but pDstLeft and/or pDstRight is/are not aligned on a 4-byte boundary
- * - iWidth==8 but pDstLeft and/or pDstRight is/are not aligned on a 8-byte boundary
- * - iWidth==16 but pDstLeft and/or pDstRight is/are not aligned on a 16-byte boundary
- * - any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_InterpolateHalfHor_Luma (
- const OMX_U8 *pSrc,
- OMX_U32 iSrcStep,
- OMX_U8 *pDstLeft,
- OMX_U8 *pDstRight,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_InterpolateHalfVer_Luma (6.3.5.5.2)
- *
- * Description:
- * This function performs interpolation for two vertical 1/2-pel positions -
- * (0, -1/2) and (0, 1/2) - around a full-pel position.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to top-left corner of block used to interpolate in the
- * reconstructed frame plane
- * iSrcStep - Step of the source buffer.
- * iDstStep - Step of the destination (interpolation) buffer; must be a
- * multiple of iWidth.
- * iWidth - Width of the current block; must be equal to either 4, 8, or 16
- * iHeight - Height of the current block; must be equal to either 4, 8, or 16
- *
- * Output Arguments:
- *
- * pDstUp -Pointer to the interpolation buffer of the -pel position above
- * the current full-pel position (0, -1/2)
- * If iWidth==4, 4-byte alignment required.
- * If iWidth==8, 8-byte alignment required.
- * If iWidth==16, 16-byte alignment required.
- * pDstDown -Pointer to the interpolation buffer of the -pel position below
- * the current full-pel position (0, 1/2)
- * If iWidth==4, 4-byte alignment required.
- * If iWidth==8, 8-byte alignment required.
- * If iWidth==16, 16-byte alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrc, pDstUp, or pDstDown
- * - iWidth or iHeight have values other than 4, 8, or 16
- * - iWidth==4 but pDstUp and/or pDstDown is/are not aligned on a 4-byte boundary
- * - iWidth==8 but pDstUp and/or pDstDown is/are not aligned on a 8-byte boundary
- * - iWidth==16 but pDstUp and/or pDstDown is/are not aligned on a 16-byte boundary
- *
- */
-OMXResult omxVCM4P10_InterpolateHalfVer_Luma (
- const OMX_U8 *pSrc,
- OMX_U32 iSrcStep,
- OMX_U8 *pDstUp,
- OMX_U8 *pDstDown,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_Average_4x (6.3.5.5.3)
- *
- * Description:
- * This function calculates the average of two 4x4, 4x8 blocks. The result
- * is rounded according to (a+b+1)/2.
- *
- * Input Arguments:
- *
- * pPred0 - Pointer to the top-left corner of reference block 0
- * pPred1 - Pointer to the top-left corner of reference block 1
- * iPredStep0 - Step of reference block 0; must be a multiple of 4.
- * iPredStep1 - Step of reference block 1; must be a multiple of 4.
- * iDstStep - Step of the destination buffer; must be a multiple of 4.
- * iHeight - Height of the blocks; must be either 4 or 8.
- *
- * Output Arguments:
- *
- * pDstPred - Pointer to the destination buffer. 4-byte alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pPred0, pPred1, or pDstPred
- * - pDstPred is not aligned on a 4-byte boundary
- * - iPredStep0 <= 0 or iPredStep0 is not a multiple of 4
- * - iPredStep1 <= 0 or iPredStep1 is not a multiple of 4
- * - iDstStep <= 0 or iDstStep is not a multiple of 4
- * - iHeight is not equal to either 4 or 8
- *
- */
-OMXResult omxVCM4P10_Average_4x (
- const OMX_U8 *pPred0,
- const OMX_U8 *pPred1,
- OMX_U32 iPredStep0,
- OMX_U32 iPredStep1,
- OMX_U8 *pDstPred,
- OMX_U32 iDstStep,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_TransformQuant_ChromaDC (6.3.5.6.1)
- *
- * Description:
- * This function performs 2x2 Hadamard transform of chroma DC coefficients
- * and then quantizes the coefficients.
- *
- * Input Arguments:
- *
- * pSrcDst - Pointer to the 2x2 array of chroma DC coefficients. 8-byte
- * alignment required.
- * iQP - Quantization parameter; must be in the range [0,51].
- * bIntra - Indicate whether this is an INTRA block. 1-INTRA, 0-INTER
- *
- * Output Arguments:
- *
- * pSrcDst - Pointer to transformed and quantized coefficients. 8-byte
- * alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrcDst
- * - pSrcDst is not aligned on an 8-byte boundary
- *
- */
-OMXResult omxVCM4P10_TransformQuant_ChromaDC (
- OMX_S16 *pSrcDst,
- OMX_U32 iQP,
- OMX_U8 bIntra
-);
-
-
-
-/**
- * Function: omxVCM4P10_TransformQuant_LumaDC (6.3.5.6.2)
- *
- * Description:
- * This function performs a 4x4 Hadamard transform of luma DC coefficients
- * and then quantizes the coefficients.
- *
- * Input Arguments:
- *
- * pSrcDst - Pointer to the 4x4 array of luma DC coefficients. 16-byte
- * alignment required.
- * iQP - Quantization parameter; must be in the range [0,51].
- *
- * Output Arguments:
- *
- * pSrcDst - Pointer to transformed and quantized coefficients. 16-byte
- * alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL: pSrcDst
- * - pSrcDst is not aligned on an 16-byte boundary
- *
- */
-OMXResult omxVCM4P10_TransformQuant_LumaDC (
- OMX_S16 *pSrcDst,
- OMX_U32 iQP
-);
-
-
-
-/**
- * Function: omxVCM4P10_InvTransformDequant_LumaDC (6.3.5.6.3)
- *
- * Description:
- * This function performs inverse 4x4 Hadamard transform and then dequantizes
- * the coefficients.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the 4x4 array of the 4x4 Hadamard-transformed and
- * quantized coefficients. 16 byte alignment required.
- * iQP - Quantization parameter; must be in the range [0,51].
- *
- * Output Arguments:
- *
- * pDst - Pointer to inverse-transformed and dequantized coefficients.
- * 16-byte alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL: pSrc
- * - pSrc or pDst is not aligned on a 16-byte boundary
- *
- */
-OMXResult omxVCM4P10_InvTransformDequant_LumaDC (
- const OMX_S16 *pSrc,
- OMX_S16 *pDst,
- OMX_U32 iQP
-);
-
-
-
-/**
- * Function: omxVCM4P10_InvTransformDequant_ChromaDC (6.3.5.6.4)
- *
- * Description:
- * This function performs inverse 2x2 Hadamard transform and then dequantizes
- * the coefficients.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the 2x2 array of the 2x2 Hadamard-transformed and
- * quantized coefficients. 8 byte alignment required.
- * iQP - Quantization parameter; must be in the range [0,51].
- *
- * Output Arguments:
- *
- * pDst - Pointer to inverse-transformed and dequantized coefficients.
- * 8-byte alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL: pSrc
- * - pSrc or pDst is not aligned on an 8-byte boundary
- *
- */
-OMXResult omxVCM4P10_InvTransformDequant_ChromaDC (
- const OMX_S16 *pSrc,
- OMX_S16 *pDst,
- OMX_U32 iQP
-);
-
-
-
-/**
- * Function: omxVCM4P10_InvTransformResidualAndAdd (6.3.5.7.1)
- *
- * Description:
- * This function performs inverse an 4x4 integer transformation to produce
- * the difference signal and then adds the difference to the prediction to get
- * the reconstructed signal.
- *
- * Input Arguments:
- *
- * pSrcPred - Pointer to prediction signal. 4-byte alignment required.
- * pDequantCoeff - Pointer to the transformed coefficients. 8-byte
- * alignment required.
- * iSrcPredStep - Step of the prediction buffer; must be a multiple of 4.
- * iDstReconStep - Step of the destination reconstruction buffer; must be a
- * multiple of 4.
- * bAC - Indicate whether there is AC coefficients in the coefficients
- * matrix.
- *
- * Output Arguments:
- *
- * pDstRecon -Pointer to the destination reconstruction buffer. 4-byte
- * alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrcPred, pDequantCoeff, pDstRecon
- * - pSrcPred is not aligned on a 4-byte boundary
- * - iSrcPredStep or iDstReconStep is not a multiple of 4.
- * - pDequantCoeff is not aligned on an 8-byte boundary
- *
- */
-OMXResult omxVCM4P10_InvTransformResidualAndAdd (
- const OMX_U8 *pSrcPred,
- const OMX_S16 *pDequantCoeff,
- OMX_U8 *pDstRecon,
- OMX_U32 iSrcPredStep,
- OMX_U32 iDstReconStep,
- OMX_U8 bAC
-);
-
-
-
-/**
- * Function: omxVCM4P10_SubAndTransformQDQResidual (6.3.5.8.1)
- *
- * Description:
- * This function subtracts the prediction signal from the original signal to
- * produce the difference signal and then performs a 4x4 integer transform and
- * quantization. The quantized transformed coefficients are stored as
- * pDstQuantCoeff. This function can also output dequantized coefficients or
- * unquantized DC coefficients optionally by setting the pointers
- * pDstDeQuantCoeff, pDCCoeff.
- *
- * Input Arguments:
- *
- * pSrcOrg - Pointer to original signal. 4-byte alignment required.
- * pSrcPred - Pointer to prediction signal. 4-byte alignment required.
- * iSrcOrgStep - Step of the original signal buffer; must be a multiple of
- * 4.
- * iSrcPredStep - Step of the prediction signal buffer; must be a multiple
- * of 4.
- * pNumCoeff -Number of non-zero coefficients after quantization. If this
- * parameter is not required, it is set to NULL.
- * nThreshSAD - Zero-block early detection threshold. If this parameter is
- * not required, it is set to 0.
- * iQP - Quantization parameter; must be in the range [0,51].
- * bIntra - Indicates whether this is an INTRA block, either 1-INTRA or
- * 0-INTER
- *
- * Output Arguments:
- *
- * pDstQuantCoeff - Pointer to the quantized transformed coefficients.
- * 8-byte alignment required.
- * pDstDeQuantCoeff - Pointer to the dequantized transformed coefficients
- * if this parameter is not equal to NULL. 8-byte alignment
- * required.
- * pDCCoeff - Pointer to the unquantized DC coefficient if this parameter
- * is not equal to NULL.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrcOrg, pSrcPred, pNumCoeff, pDstQuantCoeff,
- * pDstDeQuantCoeff, pDCCoeff
- * - pSrcOrg is not aligned on a 4-byte boundary
- * - pSrcPred is not aligned on a 4-byte boundary
- * - iSrcOrgStep is not a multiple of 4
- * - iSrcPredStep is not a multiple of 4
- * - pDstQuantCoeff or pDstDeQuantCoeff is not aligned on an 8-byte boundary
- *
- */
-OMXResult omxVCM4P10_SubAndTransformQDQResidual (
- const OMX_U8 *pSrcOrg,
- const OMX_U8 *pSrcPred,
- OMX_U32 iSrcOrgStep,
- OMX_U32 iSrcPredStep,
- OMX_S16 *pDstQuantCoeff,
- OMX_S16 *pDstDeQuantCoeff,
- OMX_S16 *pDCCoeff,
- OMX_S8 *pNumCoeff,
- OMX_U32 nThreshSAD,
- OMX_U32 iQP,
- OMX_U8 bIntra
-);
-
-
-
-/**
- * Function: omxVCM4P10_GetVLCInfo (6.3.5.9.1)
- *
- * Description:
- * This function extracts run-length encoding (RLE) information from the
- * coefficient matrix. The results are returned in an OMXVCM4P10VLCInfo
- * structure.
- *
- * Input Arguments:
- *
- * pSrcCoeff - pointer to the transform coefficient matrix. 8-byte
- * alignment required.
- * pScanMatrix - pointer to the scan order definition matrix. For a luma
- * block the scan matrix should follow [ISO14496-10] section 8.5.4,
- * and should contain the values 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13,
- * 10, 7, 11, 14, 15. For a chroma block, the scan matrix should
- * contain the values 0, 1, 2, 3.
- * bAC - indicates presence of a DC coefficient; 0 = DC coefficient
- * present, 1= DC coefficient absent.
- * MaxNumCoef - specifies the number of coefficients contained in the
- * transform coefficient matrix, pSrcCoeff. The value should be 16
- * for blocks of type LUMADC, LUMAAC, LUMALEVEL, and CHROMAAC. The
- * value should be 4 for blocks of type CHROMADC.
- *
- * Output Arguments:
- *
- * pDstVLCInfo - pointer to structure that stores information for
- * run-length coding.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrcCoeff, pScanMatrix, pDstVLCInfo
- * - pSrcCoeff is not aligned on an 8-byte boundary
- *
- */
-OMXResult omxVCM4P10_GetVLCInfo (
- const OMX_S16 *pSrcCoeff,
- const OMX_U8 *pScanMatrix,
- OMX_U8 bAC,
- OMX_U32 MaxNumCoef,
- OMXVCM4P10VLCInfo*pDstVLCInfo
-);
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /** end of #define _OMXVC_H_ */
-
-/** EOF */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/api/omxVC_s.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/api/omxVC_s.h
deleted file mode 100644
index be974d5..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/api/omxVC_s.h
+++ /dev/null
@@ -1,129 +0,0 @@
-;/******************************************************************************
-;// Copyright (c) 1999-2005 The Khronos Group Inc. All Rights Reserved
-;//
-;//
-;//
-;//
-;//
-;//
-;//
-;//
-;******************************************************************************/
-
-;/** =============== Structure Definition for Sample Generation ============== */
-;/** transparent status */
-
-;enum {
-OMX_VIDEO_TRANSPARENT EQU 0; /** Wholly transparent */
-OMX_VIDEO_PARTIAL EQU 1; /** Partially transparent */
-OMX_VIDEO_OPAQUE EQU 2; /** Opaque */
-;}
-
-;/** direction */
-;enum {
-OMX_VIDEO_NONE EQU 0;
-OMX_VIDEO_HORIZONTAL EQU 1;
-OMX_VIDEO_VERTICAL EQU 2;
-;}
-
-;/** bilinear interpolation type */
-;enum {
-OMX_VIDEO_INTEGER_PIXEL EQU 0; /** case ¡°a¡± */
-OMX_VIDEO_HALF_PIXEL_X EQU 1; /** case ¡°b¡± */
-OMX_VIDEO_HALF_PIXEL_Y EQU 2; /** case ¡°c¡± */
-OMX_VIDEO_HALF_PIXEL_XY EQU 3; /** case ¡°d¡± */
-;}
-
-;enum {
-OMX_UPPER EQU 1; /** set if the above macroblock is available */
-OMX_LEFT EQU 2; /** set if the left macroblock is available */
-OMX_CENTER EQU 4;
-OMX_RIGHT EQU 8;
-OMX_LOWER EQU 16;
-OMX_UPPER_LEFT EQU 32; /** set if the above-left macroblock is available */
-OMX_UPPER_RIGHT EQU 64; /** set if the above-right macroblock is available */
-OMX_LOWER_LEFT EQU 128;
-OMX_LOWER_RIGHT EQU 256
-;}
-
-;enum {
-OMX_VIDEO_LUMINANCE EQU 0; /** Luminance component */
-OMX_VIDEO_CHROMINANCE EQU 1; /** chrominance component */
-OMX_VIDEO_ALPHA EQU 2; /** Alpha component */
-;}
-
-;enum {
-OMX_VIDEO_INTER EQU 0; /** P picture or P-VOP */
-OMX_VIDEO_INTER_Q EQU 1; /** P picture or P-VOP */
-OMX_VIDEO_INTER4V EQU 2; /** P picture or P-VOP */
-OMX_VIDEO_INTRA EQU 3; /** I and P picture; I- and P-VOP */
-OMX_VIDEO_INTRA_Q EQU 4; /** I and P picture; I- and P-VOP */
-OMX_VIDEO_INTER4V_Q EQU 5; /** P picture or P-VOP (H.263)*/
-OMX_VIDEO_DIRECT EQU 6; /** B picture or B-VOP (MPEG-4 only) */
-OMX_VIDEO_INTERPOLATE EQU 7; /** B picture or B-VOP */
-OMX_VIDEO_BACKWARD EQU 8; /** B picture or B-VOP */
-OMX_VIDEO_FORWARD EQU 9; /** B picture or B-VOP */
-OMX_VIDEO_NOTCODED EQU 10; /** B picture or B-VOP */
-;}
-
-;enum {
-OMX_16X16_VERT EQU 0; /** Intra_16x16_Vertical (prediction mode) */
-OMX_16X16_HOR EQU 1; /** Intra_16x16_Horizontal (prediction mode) */
-OMX_16X16_DC EQU 2; /** Intra_16x16_DC (prediction mode) */
-OMX_16X16_PLANE EQU 3; /** Intra_16x16_Plane (prediction mode) */
-;}
-
-;enum {
-OMX_4x4_VERT EQU 0; /** Intra_4x4_Vertical (prediction mode) */
-OMX_4x4_HOR EQU 1; /** Intra_4x4_Horizontal (prediction mode) */
-OMX_4x4_DC EQU 2; /** Intra_4x4_DC (prediction mode) */
-OMX_4x4_DIAG_DL EQU 3; /** Intra_4x4_Diagonal_Down_Left (prediction mode) */
-OMX_4x4_DIAG_DR EQU 4; /** Intra_4x4_Diagonal_Down_Right (prediction mode) */
-OMX_4x4_VR EQU 5; /** Intra_4x4_Vertical_Right (prediction mode) */
-OMX_4x4_HD EQU 6; /** Intra_4x4_Horizontal_Down (prediction mode) */
-OMX_4x4_VL EQU 7; /** Intra_4x4_Vertical_Left (prediction mode) */
-OMX_4x4_HU EQU 8; /** Intra_4x4_Horizontal_Up (prediction mode) */
-;}
-
-;enum {
-OMX_CHROMA_DC EQU 0; /** Intra_Chroma_DC (prediction mode) */
-OMX_CHROMA_HOR EQU 1; /** Intra_Chroma_Horizontal (prediction mode) */
-OMX_CHROMA_VERT EQU 2; /** Intra_Chroma_Vertical (prediction mode) */
-OMX_CHROMA_PLANE EQU 3; /** Intra_Chroma_Plane (prediction mode) */
-;}
-
-;typedef struct {
-x EQU 0;
-y EQU 4;
-;}OMXCoordinate;
-
-;typedef struct {
-dx EQU 0;
-dy EQU 2;
-;}OMXMotionVector;
-
-;typedef struct {
-xx EQU 0;
-yy EQU 4;
-width EQU 8;
-height EQU 12;
-;}OMXiRect;
-
-;typedef enum {
-OMX_VC_INTER EQU 0; /** P picture or P-VOP */
-OMX_VC_INTER_Q EQU 1; /** P picture or P-VOP */
-OMX_VC_INTER4V EQU 2; /** P picture or P-VOP */
-OMX_VC_INTRA EQU 3; /** I and P picture, I- and P-VOP */
-OMX_VC_INTRA_Q EQU 4; /** I and P picture, I- and P-VOP */
-OMX_VC_INTER4V_Q EQU 5; /** P picture or P-VOP (H.263)*/
-;} OMXVCM4P2MacroblockType;
-
-;enum {
-OMX_VC_NONE EQU 0
-OMX_VC_HORIZONTAL EQU 1
-OMX_VC_VERTICAL EQU 2
-;};
-
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/comm/src/omxVCCOMM_Copy16x16_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/comm/src/omxVCCOMM_Copy16x16_s.s
deleted file mode 100644
index 2663a70..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/comm/src/omxVCCOMM_Copy16x16_s.s
+++ /dev/null
@@ -1,148 +0,0 @@
- ;/**
- ; * Function: omxVCCOMM_Copy16x16
- ; *
- ; * Description:
- ; * Copies the reference 16x16 block to the current block.
- ; * Parameters:
- ; * [in] pSrc - pointer to the reference block in the source frame; must be aligned on an 16-byte boundary.
- ; * [in] step - distance between the starts of consecutive lines in the reference frame, in bytes;
- ; * must be a multiple of 16 and must be larger than or equal to 16.
- ; * [out] pDst - pointer to the destination block; must be aligned on an 8-byte boundary.
- ; * Return Value:
- ; * OMX_Sts_NoErr - no error
- ; * OMX_Sts_BadArgErr - bad arguments; returned under any of the following conditions:
- ; * - one or more of the following pointers is NULL: pSrc, pDst
- ; * - one or more of the following pointers is not aligned on an 16-byte boundary: pSrc, pDst
- ; * - step <16 or step is not a multiple of 16.
- ; */
-
- INCLUDE omxtypes_s.h
-
-
- M_VARIANTS ARM1136JS
-
-
-
-
- IF ARM1136JS
-
-;//Input Arguments
-pSrc RN 0
-pDst RN 1
-step RN 2
-
-;//Local Variables
-Count RN 14
-X0 RN 2
-X1 RN 4
-
-Return RN 0
-
- M_START omxVCCOMM_Copy16x16,r5
-
-
-
- SUB Count,step,#8 ;//Count=step-8
- LDRD X0,[pSrc],#8 ;//pSrc after loading pSrc=pSrc+8
- LDRD X1,[pSrc],Count ;//pSrc after loading pSrc=pSrc+step
-
- ;// loading 16 bytes and storing
- STRD X0,[pDst],#8
- LDRD X0,[pSrc],#8
- STRD X1,[pDst],#8
- LDRD X1,[pSrc],Count
-
- ;// loading 16 bytes and storing
- STRD X0,[pDst],#8
- LDRD X0,[pSrc],#8
- STRD X1,[pDst],#8
- LDRD X1,[pSrc],Count
-
- ;// loading 16 bytes and storing
- STRD X0,[pDst],#8
- LDRD X0,[pSrc],#8
- STRD X1,[pDst],#8
- LDRD X1,[pSrc],Count
-
- ;// loading 16 bytes and storing
- STRD X0,[pDst],#8
- LDRD X0,[pSrc],#8
- STRD X1,[pDst],#8
- LDRD X1,[pSrc],Count
-
- ;// loading 16 bytes and storing
- STRD X0,[pDst],#8
- LDRD X0,[pSrc],#8
- STRD X1,[pDst],#8
- LDRD X1,[pSrc],Count
-
- ;// loading 16 bytes and storing
- STRD X0,[pDst],#8
- LDRD X0,[pSrc],#8
- STRD X1,[pDst],#8
- LDRD X1,[pSrc],Count
-
- ;// loading 16 bytes and storing
- STRD X0,[pDst],#8
- LDRD X0,[pSrc],#8
- STRD X1,[pDst],#8
- LDRD X1,[pSrc],Count
-
- ;// loading 16 bytes and storing
- STRD X0,[pDst],#8
- LDRD X0,[pSrc],#8
- STRD X1,[pDst],#8
- LDRD X1,[pSrc],Count
-
- ;// loading 16 bytes and storing
- STRD X0,[pDst],#8
- LDRD X0,[pSrc],#8
- STRD X1,[pDst],#8
- LDRD X1,[pSrc],Count
-
- ;// loading 16 bytes and storing
- STRD X0,[pDst],#8
- LDRD X0,[pSrc],#8
- STRD X1,[pDst],#8
- LDRD X1,[pSrc],Count
-
- ;// loading 16 bytes and storing
- STRD X0,[pDst],#8
- LDRD X0,[pSrc],#8
- STRD X1,[pDst],#8
- LDRD X1,[pSrc],Count
-
- ;// loading 16 bytes and storing
- STRD X0,[pDst],#8
- LDRD X0,[pSrc],#8
- STRD X1,[pDst],#8
- LDRD X1,[pSrc],Count
-
- ;// loading 16 bytes and storing
- STRD X0,[pDst],#8
- LDRD X0,[pSrc],#8
- STRD X1,[pDst],#8
- LDRD X1,[pSrc],Count
-
- ;// loading 16 bytes and storing
- STRD X0,[pDst],#8
- LDRD X0,[pSrc],#8
- STRD X1,[pDst],#8
- LDRD X1,[pSrc],Count
-
- ;// loading 16 bytes and storing
- STRD X0,[pDst],#8
- LDRD X0,[pSrc],#8
- STRD X1,[pDst],#8
- LDRD X1,[pSrc],Count
-
- STRD X0,[pDst],#8
- MOV Return,#OMX_Sts_NoErr
- STRD X1,[pDst],#8
-
-
- M_END
- ENDIF
-
- END
-
\ No newline at end of file
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/comm/src/omxVCCOMM_Copy8x8_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/comm/src/omxVCCOMM_Copy8x8_s.s
deleted file mode 100644
index 993873c..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/comm/src/omxVCCOMM_Copy8x8_s.s
+++ /dev/null
@@ -1,72 +0,0 @@
- ;/**
- ; * Function: omxVCCOMM_Copy8x8
- ; *
- ; * Description:
- ; * Copies the reference 8x8 block to the current block.
- ; * Parameters:
- ; * [in] pSrc - pointer to the reference block in the source frame; must be aligned on an 8-byte boundary.
- ; * [in] step - distance between the starts of consecutive lines in the reference frame, in bytes;
- ; * must be a multiple of 8 and must be larger than or equal to 8.
- ; * [out] pDst - pointer to the destination block; must be aligned on an 8-byte boundary.
- ; * Return Value:
- ; * OMX_Sts_NoErr - no error
- ; * OMX_Sts_BadArgErr - bad arguments; returned under any of the following conditions:
- ; * - one or more of the following pointers is NULL: pSrc, pDst
- ; * - one or more of the following pointers is not aligned on an 8-byte boundary: pSrc, pDst
- ; * - step <8 or step is not a multiple of 8.
- ; */
-
- INCLUDE omxtypes_s.h
-
-
- M_VARIANTS ARM1136JS
-
-
-
-
- IF ARM1136JS
-
-;//Input Arguments
-pSrc RN 0
-pDst RN 1
-step RN 2
-
-;//Local Variables
-Count RN 14
-X0 RN 2
-X1 RN 4
-Return RN 0
- M_START omxVCCOMM_Copy8x8,r5
-
-
-
- MOV Count,step ;//Count=step
-
- LDRD X0,[pSrc],Count ;//pSrc after loading : pSrc=pSrc+step
- LDRD X1,[pSrc],Count
-
- STRD X0,[pDst],#8
- LDRD X0,[pSrc],Count
- STRD X1,[pDst],#8
- LDRD X1,[pSrc],Count
-
- STRD X0,[pDst],#8
- LDRD X0,[pSrc],Count
- STRD X1,[pDst],#8
- LDRD X1,[pSrc],Count
-
- STRD X0,[pDst],#8
- LDRD X0,[pSrc],Count
- STRD X1,[pDst],#8
- LDRD X1,[pSrc],Count
-
- STRD X0,[pDst],#8
- MOV Return,#OMX_Sts_NoErr
- STRD X1,[pDst],#8
-
-
- M_END
- ENDIF
-
- END
-
\ No newline at end of file
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/comm/src/omxVCCOMM_ExpandFrame_I_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/comm/src/omxVCCOMM_ExpandFrame_I_s.s
deleted file mode 100644
index f5d2271..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/comm/src/omxVCCOMM_ExpandFrame_I_s.s
+++ /dev/null
@@ -1,203 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCCOMM_ExpandFrame_I_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-;// Description:
-;// This function will Expand Frame boundary pixels into Plane
-;//
-;//
-
-;// Include standard headers
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
-;// Import symbols required from other files
-;// (For example tables)
-
-
-;// Set debugging level
-DEBUG_ON SETL {FALSE}
-
-
-
-
-
-
-
-;// Guarding implementation by the processor name
-
- IF ARM1136JS
-
-;//Input Registers
-
-pSrcDstPlane RN 0
-iFrameWidth RN 1
-iFrameHeight RN 2
-iExpandPels RN 3
-
-
-;//Output Registers
-
-result RN 0
-
-;//Local Scratch Registers
-
-iPlaneStep RN 4
-pTop RN 5
-pBottom RN 6
-pBottomIndex RN 7
-x RN 8
-y RN 9
-tempTop RN 10
-tempBot RN 11
-ColStep RN 12
-pLeft RN 5
-pRight RN 6
-pRightIndex RN 7
-tempLeft1 RN 10
-tempRight1 RN 11
-tempLeft2 RN 14
-tempRight2 RN 2
-indexY RN 14
-RowStep RN 12
-expandTo4bytes RN 1 ;// copy a byte to 4 bytes of a word
-
- ;// Allocate stack memory required by the function
-
-
- ;// Write function header
- M_START omxVCCOMM_ExpandFrame_I,r11
-
- ;// Define stack arguments
- M_ARG iPlaneStepOnStack, 4
-
- ;// Load argument from the stack
- M_LDR iPlaneStep, iPlaneStepOnStack
-
- MUL pTop,iExpandPels,iPlaneStep
- MLA pBottom,iFrameHeight,iPlaneStep,pSrcDstPlane
- SUB x,iFrameWidth,#4
- MOV indexY,pTop
- ADD ColStep,indexY,#4
- SUB pBottomIndex,pBottom,iPlaneStep
- SUB pTop,pSrcDstPlane,pTop
-
-
- ADD pTop,pTop,x
- ADD pBottom,pBottom,x
-
- ;//------------------------------------------------------------------------
- ;// The following improves upon the C implmentation
- ;// The x and y loops are interchanged: This ensures that the values of
- ;// pSrcDstPlane [x] and pSrcDstPlane [(iFrameHeight - 1) * iPlaneStep + x]
- ;// which depend only on loop variable 'x' are loaded once and used in
- ;// multiple stores in the 'Y' loop
- ;//------------------------------------------------------------------------
-
- ;// xloop
-ExpandFrameTopBotXloop
-
- LDR tempTop,[pSrcDstPlane,x]
- ;//------------------------------------------------------------------------
- ;// pSrcDstPlane [(iFrameHeight - 1) * iPlaneStep + x] is simplified as:
- ;// pSrcDstPlane + (iFrameHeight * iPlaneStep) - iPlaneStep + x ==
- ;// pBottom - iPlaneStep + x == pBottomIndex [x]
- ;// The value of pBottomIndex is calculated above this 'x' loop
- ;//------------------------------------------------------------------------
- LDR tempBot,[pBottomIndex,x]
-
- ;// yloop
- MOV y,iExpandPels
-
-ExpandFrameTopBotYloop
- SUBS y,y,#1
- M_STR tempTop,[pTop],iPlaneStep
- M_STR tempBot,[pBottom],iPlaneStep
- BGT ExpandFrameTopBotYloop
-
- SUBS x,x,#4
- SUB pTop,pTop,ColStep
- SUB pBottom,pBottom,ColStep
- BGE ExpandFrameTopBotXloop
-
-
- ;// y loop
- ;// The product is already calculated above : Reuse
- ;//MUL indexY,iExpandPels,iPlaneStep
-
- SUB pSrcDstPlane,pSrcDstPlane,indexY
- SUB pLeft,pSrcDstPlane,iExpandPels ;// pLeft->points to the top left of the expanded block
- ADD pRight,pSrcDstPlane,iFrameWidth
- SUB pRightIndex,pRight,#1
-
- ADD y,iFrameHeight,iExpandPels,LSL #1
- LDR expandTo4bytes,=0x01010101
-
- RSB RowStep,iExpandPels,iPlaneStep,LSL #1
-
- ;// The Y Loop is unrolled twice
-ExpandFrameLeftRightYloop
- LDRB tempLeft2,[pSrcDstPlane,iPlaneStep] ;// PreLoad the values
- LDRB tempRight2,[pRightIndex,iPlaneStep]
- M_LDRB tempLeft1,[pSrcDstPlane],iPlaneStep,LSL #1 ;// PreLoad the values
- M_LDRB tempRight1,[pRightIndex],iPlaneStep,LSL #1
-
- SUB x,iExpandPels,#4
- MUL tempLeft2,tempLeft2,expandTo4bytes ;// Copy the single byte to 4 bytes
- MUL tempRight2,tempRight2,expandTo4bytes
- MUL tempLeft1,tempLeft1,expandTo4bytes ;// Copy the single byte to 4 bytes
- MUL tempRight1,tempRight1,expandTo4bytes
-
-
- ;// x loop
-ExpandFrameLeftRightXloop
- SUBS x,x,#4
- STR tempLeft2,[pLeft,iPlaneStep] ;// Store the 4 bytes at one go
- STR tempRight2,[pRight,iPlaneStep]
- STR tempLeft1,[pLeft],#4 ;// Store the 4 bytes at one go
- STR tempRight1,[pRight],#4
- BGE ExpandFrameLeftRightXloop
-
- SUBS y,y,#2
- ADD pLeft,pLeft,RowStep
- ADD pRight,pRight,RowStep
- BGT ExpandFrameLeftRightYloop
-
-
- ;// Set return value
-
- MOV result,#OMX_Sts_NoErr
-End
-
- ;// Write function tail
-
- M_END
-
- ENDIF ;//ARM1136JS
-
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/api/armVCM4P10_CAVLCTables.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/api/armVCM4P10_CAVLCTables.h
deleted file mode 100644
index d43d86b..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/api/armVCM4P10_CAVLCTables.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: armVCM4P10_CAVLCTables.h
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Header file for optimized H.264 CALVC tables
- *
- */
-
-#ifndef ARMVCM4P10_CAVLCTABLES_H
-#define ARMVCM4P10_CAVLCTABLES_H
-
-/* CAVLC tables */
-
-extern const OMX_U16 *armVCM4P10_CAVLCCoeffTokenTables[18];
-extern const OMX_U16 *armVCM4P10_CAVLCTotalZeroTables[15];
-extern const OMX_U16 *armVCM4P10_CAVLCTotalZeros2x2Tables[3];
-extern const OMX_U16 *armVCM4P10_CAVLCRunBeforeTables[15];
-extern const OMX_U8 armVCM4P10_ZigZag_4x4[16];
-extern const OMX_U8 armVCM4P10_ZigZag_2x2[4];
-extern const OMX_S8 armVCM4P10_SuffixToLevel[7];
-
-#endif
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_Average_4x_Align_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_Average_4x_Align_unsafe_s.s
deleted file mode 100644
index 198f0ac..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_Average_4x_Align_unsafe_s.s
+++ /dev/null
@@ -1,236 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_Average_4x_Align_unsafe_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
-
-;// Functions:
-;// armVCM4P10_Average_4x4_Align<ALIGNMENT>_unsafe
-;//
-;// Implements Average of 4x4 with equation c = (a+b+1)>>1.
-;// First operand will be at offset ALIGNMENT from aligned address
-;// Second operand will be at aligned location and will be used as output.
-;// destination pointed by (pDst) for vertical interpolation.
-;// This function needs to copy 4 bytes in horizontal direction
-;//
-;// Registers used as input for this function
-;// r0,r1,r2,r3 where r2 containings aligned memory pointer and r3 step size
-;//
-;// Registers preserved for top level function
-;// r4,r5,r6,r8,r9,r14
-;//
-;// Registers modified by the function
-;// r7,r10,r11,r12
-;//
-;// Output registers
-;// r2 - pointer to the aligned location
-;// r3 - step size to this aligned location
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
- EXPORT armVCM4P10_Average_4x4_Align0_unsafe
- EXPORT armVCM4P10_Average_4x4_Align2_unsafe
- EXPORT armVCM4P10_Average_4x4_Align3_unsafe
-
-DEBUG_ON SETL {FALSE}
-
-;// Declare input registers
-pPred0 RN 0
-iPredStep0 RN 1
-pPred1 RN 2
-iPredStep1 RN 3
-pDstPred RN 2
-iDstStep RN 3
-
-;// Declare other intermediate registers
-iPredA0 RN 10
-iPredA1 RN 11
-iPredB0 RN 12
-iPredB1 RN 14
-Temp1 RN 4
-Temp2 RN 5
-ResultA RN 5
-ResultB RN 4
-r0x80808080 RN 7
-
- IF ARM1136JS
-
- ;// This function calculates average of 4x4 block
- ;// pPred0 is at alignment offset 0 and pPred1 is alignment 4
-
- ;// Function header
- M_START armVCM4P10_Average_4x4_Align0_unsafe, r6
-
- ;// Code start
- LDR r0x80808080, =0x80808080
-
- ;// 1st load
- M_LDR iPredB0, [pPred1]
- M_LDR iPredA0, [pPred0], iPredStep0
- M_LDR iPredB1, [pPred1, iPredStep1]
- M_LDR iPredA1, [pPred0], iPredStep0
-
- ;// (a+b+1)/2 = (a+256-(255-b))/2 = (a-(255-b))/2 + 128
- MVN iPredB0, iPredB0
- MVN iPredB1, iPredB1
- UHSUB8 ResultA, iPredA0, iPredB0
- UHSUB8 ResultB, iPredA1, iPredB1
- EOR ResultA, ResultA, r0x80808080
- M_STR ResultA, [pDstPred], iDstStep
- EOR ResultB, ResultB, r0x80808080
- M_STR ResultB, [pDstPred], iDstStep
-
- ;// 2nd load
- M_LDR iPredA0, [pPred0], iPredStep0
- M_LDR iPredB0, [pPred1]
- M_LDR iPredA1, [pPred0], iPredStep0
- M_LDR iPredB1, [pPred1, iPredStep1]
-
- MVN iPredB0, iPredB0
- UHSUB8 ResultA, iPredA0, iPredB0
- MVN iPredB1, iPredB1
- UHSUB8 ResultB, iPredA1, iPredB1
- EOR ResultA, ResultA, r0x80808080
- M_STR ResultA, [pDstPred], iDstStep
- EOR ResultB, ResultB, r0x80808080
- M_STR ResultB, [pDstPred], iDstStep
-End0
- M_END
-
- ;// This function calculates average of 4x4 block
- ;// pPred0 is at alignment offset 2 and pPred1 is alignment 4
-
- ;// Function header
- M_START armVCM4P10_Average_4x4_Align2_unsafe, r6
-
- ;// Code start
- LDR r0x80808080, =0x80808080
-
- ;// 1st load
- LDR Temp1, [pPred0, #4]
- M_LDR iPredA0, [pPred0], iPredStep0
- M_LDR iPredB0, [pPred1]
- M_LDR iPredB1, [pPred1, iPredStep1]
- M_LDR Temp2, [pPred0, #4]
- M_LDR iPredA1, [pPred0], iPredStep0
- MVN iPredB0, iPredB0
- MVN iPredB1, iPredB1
- MOV iPredA0, iPredA0, LSR #16
- ORR iPredA0, iPredA0, Temp1, LSL #16
- MOV iPredA1, iPredA1, LSR #16
- ORR iPredA1, iPredA1, Temp2, LSL #16
-
- ;// (a+b+1)/2 = (a+256-(255-b))/2 = (a-(255-b))/2 + 128
- UHSUB8 ResultA, iPredA0, iPredB0
- UHSUB8 ResultB, iPredA1, iPredB1
- EOR ResultA, ResultA, r0x80808080
- M_STR ResultA, [pDstPred], iDstStep
- EOR ResultB, ResultB, r0x80808080
- M_STR ResultB, [pDstPred], iDstStep
-
- ;// 2nd load
- LDR Temp1, [pPred0, #4]
- M_LDR iPredA0, [pPred0], iPredStep0
- LDR iPredB0, [pPred1]
- LDR iPredB1, [pPred1, iPredStep1]
- LDR Temp2, [pPred0, #4]
- M_LDR iPredA1, [pPred0], iPredStep0
- MVN iPredB0, iPredB0
- MVN iPredB1, iPredB1
- MOV iPredA0, iPredA0, LSR #16
- ORR iPredA0, iPredA0, Temp1, LSL #16
- MOV iPredA1, iPredA1, LSR #16
- ORR iPredA1, iPredA1, Temp2, LSL #16
-
- UHSUB8 ResultA, iPredA0, iPredB0
- UHSUB8 ResultB, iPredA1, iPredB1
- EOR ResultA, ResultA, r0x80808080
- M_STR ResultA, [pDstPred], iDstStep
- EOR ResultB, ResultB, r0x80808080
- M_STR ResultB, [pDstPred], iDstStep
-End2
- M_END
-
-
- ;// This function calculates average of 4x4 block
- ;// pPred0 is at alignment offset 3 and pPred1 is alignment 4
-
- ;// Function header
- M_START armVCM4P10_Average_4x4_Align3_unsafe, r6
-
- ;// Code start
- LDR r0x80808080, =0x80808080
-
- ;// 1st load
- LDR Temp1, [pPred0, #4]
- M_LDR iPredA0, [pPred0], iPredStep0
- LDR iPredB0, [pPred1]
- LDR iPredB1, [pPred1, iPredStep1]
- LDR Temp2, [pPred0, #4]
- M_LDR iPredA1, [pPred0], iPredStep0
-
- MVN iPredB0, iPredB0
- MVN iPredB1, iPredB1
- MOV iPredA0, iPredA0, LSR #24
- ORR iPredA0, iPredA0, Temp1, LSL #8
- MOV iPredA1, iPredA1, LSR #24
- ORR iPredA1, iPredA1, Temp2, LSL #8
- UHSUB8 ResultA, iPredA0, iPredB0
- UHSUB8 ResultB, iPredA1, iPredB1
- EOR ResultA, ResultA, r0x80808080
- M_STR ResultA, [pDstPred], iDstStep
- EOR ResultB, ResultB, r0x80808080
- M_STR ResultB, [pDstPred], iDstStep
-
- ;// 2nd load
- LDR Temp1, [pPred0, #4]
- M_LDR iPredA0, [pPred0], iPredStep0
- LDR iPredB0, [pPred1]
- LDR iPredB1, [pPred1, iPredStep1]
- LDR Temp2, [pPred0, #4]
- M_LDR iPredA1, [pPred0], iPredStep0
-
- MVN iPredB0, iPredB0
- MVN iPredB1, iPredB1
- MOV iPredA0, iPredA0, LSR #24
- ORR iPredA0, iPredA0, Temp1, LSL #8
- MOV iPredA1, iPredA1, LSR #24
- ORR iPredA1, iPredA1, Temp2, LSL #8
-
- UHSUB8 ResultA, iPredA0, iPredB0
- UHSUB8 ResultB, iPredA1, iPredB1
- EOR ResultA, ResultA, r0x80808080
- M_STR ResultA, [pDstPred], iDstStep
- EOR ResultB, ResultB, r0x80808080
- M_STR ResultB, [pDstPred], iDstStep
-End3
- M_END
-
- ENDIF
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_CAVLCTables.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_CAVLCTables.c
deleted file mode 100644
index 3b84c8d..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_CAVLCTables.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: armVCM4P10_CAVLCTables.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Optimized CAVLC tables for H.264
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-
-#include "armVCM4P10_CAVLCTables.h"
-
-/* 4x4 DeZigZag table */
-
-const OMX_U8 armVCM4P10_ZigZag_4x4[16] =
-{
- 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15
-};
-
-/* 2x2 DeZigZag table */
-
-const OMX_U8 armVCM4P10_ZigZag_2x2[4] =
-{
- 0, 1, 2, 3
-};
-
-
-/*
- * Suffix To Level table
- * We increment the suffix length if
- * ((LevelCode>>1)+1)>(3<<(SuffixLength-1)) && SuffixLength<6
- * (LevelCode>>1)>=(3<<(SuffixLength-1)) && SuffixLength<6
- * LevelCode >= 3<<SuffixLength && SuffixLength<6
- * (LevelCode+2) >= (3<<SuffixLength)+2 && SuffixLength<6
- */
-const OMX_S8 armVCM4P10_SuffixToLevel[7] =
-{
- (3<<1)+2, /* SuffixLength=1 */
- (3<<1)+2, /* SuffixLength=1 */
- (3<<2)+2, /* SuffixLength=2 */
- (3<<3)+2, /* SuffixLength=3 */
- (3<<4)+2, /* SuffixLength=4 */
- (3<<5)+2, /* SuffixLength=5 */
- -1 /* SuffixLength=6 - never increment */
-};
-
-static const OMX_U16 armVCM4P10_CAVLCCoeffTokenTables_0[132] = {
- 0x0020, 0x0100, 0x2015, 0x2015, 0x400b, 0x400b, 0x400b, 0x400b,
- 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001,
- 0x0028, 0x00f0, 0x00f8, 0x0027, 0x0030, 0x00d8, 0x00e0, 0x00e8,
- 0x0038, 0x00a0, 0x00c8, 0x00d0, 0x0040, 0x0068, 0x0090, 0x0098,
- 0x0048, 0x0050, 0x0058, 0x0060, 0x27ff, 0x27ff, 0x206b, 0x206b,
- 0x0081, 0x0085, 0x0083, 0x0079, 0x0087, 0x007d, 0x007b, 0x0071,
- 0x007f, 0x0075, 0x0073, 0x0069, 0x0070, 0x0078, 0x0080, 0x0088,
- 0x2077, 0x2077, 0x206d, 0x206d, 0x2063, 0x2063, 0x2061, 0x2061,
- 0x206f, 0x206f, 0x2065, 0x2065, 0x205b, 0x205b, 0x2059, 0x2059,
- 0x0067, 0x005d, 0x0053, 0x0051, 0x005f, 0x0055, 0x004b, 0x0049,
- 0x00a8, 0x00b0, 0x00b8, 0x00c0, 0x2041, 0x2041, 0x204d, 0x204d,
- 0x2043, 0x2043, 0x2039, 0x2039, 0x2057, 0x2057, 0x2045, 0x2045,
- 0x203b, 0x203b, 0x2031, 0x2031, 0x204f, 0x204f, 0x203d, 0x203d,
- 0x2033, 0x2033, 0x2029, 0x2029, 0x0047, 0x0035, 0x002b, 0x0021,
- 0x203f, 0x203f, 0x202d, 0x202d, 0x2023, 0x2023, 0x2019, 0x2019,
- 0x0037, 0x0025, 0x001b, 0x0011, 0x202f, 0x202f, 0x201d, 0x201d,
- 0x0013, 0x0009, 0x201f, 0x201f
-};
-
-static const OMX_U16 armVCM4P10_CAVLCCoeffTokenTables_1[128] = {
- 0x0020, 0x00e8, 0x00f0, 0x00f8, 0x0027, 0x001f, 0x2015, 0x2015,
- 0x400b, 0x400b, 0x400b, 0x400b, 0x4001, 0x4001, 0x4001, 0x4001,
- 0x0028, 0x00d0, 0x00d8, 0x00e0, 0x0030, 0x0098, 0x00c0, 0x00c8,
- 0x0038, 0x0060, 0x0088, 0x0090, 0x0040, 0x0048, 0x0050, 0x0058,
- 0x27ff, 0x27ff, 0x207f, 0x207f, 0x0087, 0x0085, 0x0083, 0x0081,
- 0x007b, 0x0079, 0x007d, 0x0073, 0x2075, 0x2075, 0x2071, 0x2071,
- 0x0068, 0x0070, 0x0078, 0x0080, 0x2077, 0x2077, 0x206d, 0x206d,
- 0x206b, 0x206b, 0x2069, 0x2069, 0x206f, 0x206f, 0x2065, 0x2065,
- 0x2063, 0x2063, 0x2061, 0x2061, 0x0059, 0x005d, 0x005b, 0x0051,
- 0x0067, 0x0055, 0x0053, 0x0049, 0x00a0, 0x00a8, 0x00b0, 0x00b8,
- 0x205f, 0x205f, 0x204d, 0x204d, 0x204b, 0x204b, 0x2041, 0x2041,
- 0x2057, 0x2057, 0x2045, 0x2045, 0x2043, 0x2043, 0x2039, 0x2039,
- 0x204f, 0x204f, 0x203d, 0x203d, 0x203b, 0x203b, 0x2031, 0x2031,
- 0x0029, 0x0035, 0x0033, 0x0021, 0x2047, 0x2047, 0x202d, 0x202d,
- 0x202b, 0x202b, 0x2019, 0x2019, 0x003f, 0x0025, 0x0023, 0x0011,
- 0x0037, 0x001d, 0x001b, 0x0009, 0x202f, 0x202f, 0x2013, 0x2013
-};
-
-static const OMX_U16 armVCM4P10_CAVLCCoeffTokenTables_2[112] = {
- 0x0020, 0x0088, 0x00b0, 0x00b8, 0x00c0, 0x00c8, 0x00d0, 0x00d8,
- 0x003f, 0x0037, 0x002f, 0x0027, 0x001f, 0x0015, 0x000b, 0x0001,
- 0x0028, 0x0050, 0x0078, 0x0080, 0x0030, 0x0038, 0x0040, 0x0048,
- 0x07ff, 0x0081, 0x0087, 0x0085, 0x0083, 0x0079, 0x007f, 0x007d,
- 0x007b, 0x0071, 0x0077, 0x0075, 0x0073, 0x0069, 0x206b, 0x206b,
- 0x0058, 0x0060, 0x0068, 0x0070, 0x2061, 0x2061, 0x206d, 0x206d,
- 0x2063, 0x2063, 0x2059, 0x2059, 0x206f, 0x206f, 0x2065, 0x2065,
- 0x205b, 0x205b, 0x2051, 0x2051, 0x0067, 0x005d, 0x0053, 0x0049,
- 0x005f, 0x0055, 0x004b, 0x0041, 0x0090, 0x0098, 0x00a0, 0x00a8,
- 0x2039, 0x2039, 0x2031, 0x2031, 0x204d, 0x204d, 0x2029, 0x2029,
- 0x2057, 0x2057, 0x2045, 0x2045, 0x2043, 0x2043, 0x2021, 0x2021,
- 0x0019, 0x003d, 0x003b, 0x0011, 0x004f, 0x0035, 0x0033, 0x0009,
- 0x202b, 0x202b, 0x202d, 0x202d, 0x2023, 0x2023, 0x2025, 0x2025,
- 0x201b, 0x201b, 0x2047, 0x2047, 0x201d, 0x201d, 0x2013, 0x2013
-};
-
-static const OMX_U16 armVCM4P10_CAVLCCoeffTokenTables_3[80] = {
- 0x0020, 0x0028, 0x0030, 0x0038, 0x0040, 0x0048, 0x0050, 0x0058,
- 0x0060, 0x0068, 0x0070, 0x0078, 0x0080, 0x0088, 0x0090, 0x0098,
- 0x0009, 0x000b, 0x07ff, 0x0001, 0x0011, 0x0013, 0x0015, 0x07ff,
- 0x0019, 0x001b, 0x001d, 0x001f, 0x0021, 0x0023, 0x0025, 0x0027,
- 0x0029, 0x002b, 0x002d, 0x002f, 0x0031, 0x0033, 0x0035, 0x0037,
- 0x0039, 0x003b, 0x003d, 0x003f, 0x0041, 0x0043, 0x0045, 0x0047,
- 0x0049, 0x004b, 0x004d, 0x004f, 0x0051, 0x0053, 0x0055, 0x0057,
- 0x0059, 0x005b, 0x005d, 0x005f, 0x0061, 0x0063, 0x0065, 0x0067,
- 0x0069, 0x006b, 0x006d, 0x006f, 0x0071, 0x0073, 0x0075, 0x0077,
- 0x0079, 0x007b, 0x007d, 0x007f, 0x0081, 0x0083, 0x0085, 0x0087
-};
-
-static const OMX_U16 armVCM4P10_CAVLCCoeffTokenTables_4[32] = {
- 0x0020, 0x0038, 0x2015, 0x2015, 0x4001, 0x4001, 0x4001, 0x4001,
- 0x600b, 0x600b, 0x600b, 0x600b, 0x600b, 0x600b, 0x600b, 0x600b,
- 0x0028, 0x0030, 0x0021, 0x0019, 0x2027, 0x2027, 0x0025, 0x0023,
- 0x201d, 0x201d, 0x201b, 0x201b, 0x0011, 0x001f, 0x0013, 0x0009
-};
-
-const OMX_U16 * armVCM4P10_CAVLCCoeffTokenTables[18] = {
- armVCM4P10_CAVLCCoeffTokenTables_0, /* nC=0 */
- armVCM4P10_CAVLCCoeffTokenTables_0, /* nC=1 */
- armVCM4P10_CAVLCCoeffTokenTables_1, /* nC=2 */
- armVCM4P10_CAVLCCoeffTokenTables_1, /* nC=3 */
- armVCM4P10_CAVLCCoeffTokenTables_2, /* nC=4 */
- armVCM4P10_CAVLCCoeffTokenTables_2, /* nC=5 */
- armVCM4P10_CAVLCCoeffTokenTables_2, /* nC=6 */
- armVCM4P10_CAVLCCoeffTokenTables_2, /* nC=7 */
- armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=8 */
- armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=9 */
- armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=10 */
- armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=11 */
- armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=12 */
- armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=13 */
- armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=14 */
- armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=15 */
- armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=16 */
- armVCM4P10_CAVLCCoeffTokenTables_4 /* nC=-1 */
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_0[40] = {
- 0x0020, 0x0048, 0x0009, 0x0007, 0x2005, 0x2005, 0x2003, 0x2003,
- 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001,
- 0x0028, 0x0040, 0x0011, 0x000f, 0x0030, 0x0038, 0x0019, 0x0017,
- 0x27ff, 0x27ff, 0x201f, 0x201f, 0x201d, 0x201d, 0x201b, 0x201b,
- 0x2015, 0x2015, 0x2013, 0x2013, 0x200d, 0x200d, 0x200b, 0x200b
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_1[24] = {
- 0x0020, 0x0028, 0x0011, 0x000f, 0x000d, 0x000b, 0x2009, 0x2009,
- 0x2007, 0x2007, 0x2005, 0x2005, 0x2003, 0x2003, 0x2001, 0x2001,
- 0x001d, 0x001b, 0x0019, 0x0017, 0x2015, 0x2015, 0x2013, 0x2013
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_2[24] = {
- 0x0020, 0x0028, 0x0011, 0x000b, 0x0009, 0x0001, 0x200f, 0x200f,
- 0x200d, 0x200d, 0x2007, 0x2007, 0x2005, 0x2005, 0x2003, 0x2003,
- 0x001b, 0x0017, 0x2019, 0x2019, 0x2015, 0x2015, 0x2013, 0x2013
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_3[24] = {
- 0x0020, 0x0028, 0x0013, 0x000f, 0x0007, 0x0005, 0x2011, 0x2011,
- 0x200d, 0x200d, 0x200b, 0x200b, 0x2009, 0x2009, 0x2003, 0x2003,
- 0x2019, 0x2019, 0x2017, 0x2017, 0x2015, 0x2015, 0x2001, 0x2001
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_4[20] = {
- 0x0020, 0x0015, 0x0011, 0x0005, 0x0003, 0x0001, 0x200f, 0x200f,
- 0x200d, 0x200d, 0x200b, 0x200b, 0x2009, 0x2009, 0x2007, 0x2007,
- 0x2017, 0x2017, 0x2013, 0x2013
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_5[20] = {
- 0x0020, 0x0011, 0x2013, 0x2013, 0x200f, 0x200f, 0x200d, 0x200d,
- 0x200b, 0x200b, 0x2009, 0x2009, 0x2007, 0x2007, 0x2005, 0x2005,
- 0x0015, 0x0001, 0x2003, 0x2003
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_6[20] = {
- 0x0020, 0x000f, 0x2011, 0x2011, 0x200d, 0x200d, 0x2009, 0x2009,
- 0x2007, 0x2007, 0x2005, 0x2005, 0x400b, 0x400b, 0x400b, 0x400b,
- 0x0013, 0x0001, 0x2003, 0x2003
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_7[20] = {
- 0x0020, 0x0003, 0x200f, 0x200f, 0x200d, 0x200d, 0x2007, 0x2007,
- 0x400b, 0x400b, 0x400b, 0x400b, 0x4009, 0x4009, 0x4009, 0x4009,
- 0x0011, 0x0001, 0x2005, 0x2005
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_8[20] = {
- 0x0020, 0x0005, 0x200b, 0x200b, 0x400d, 0x400d, 0x400d, 0x400d,
- 0x4009, 0x4009, 0x4009, 0x4009, 0x4007, 0x4007, 0x4007, 0x4007,
- 0x0003, 0x0001, 0x200f, 0x200f
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_9[20] = {
- 0x0020, 0x000d, 0x2005, 0x2005, 0x400b, 0x400b, 0x400b, 0x400b,
- 0x4009, 0x4009, 0x4009, 0x4009, 0x4007, 0x4007, 0x4007, 0x4007,
- 0x2003, 0x2003, 0x2001, 0x2001
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_10[16] = {
- 0x0001, 0x0003, 0x2005, 0x2005, 0x2007, 0x2007, 0x200b, 0x200b,
- 0x6009, 0x6009, 0x6009, 0x6009, 0x6009, 0x6009, 0x6009, 0x6009
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_11[16] = {
- 0x0001, 0x0003, 0x2009, 0x2009, 0x4005, 0x4005, 0x4005, 0x4005,
- 0x6007, 0x6007, 0x6007, 0x6007, 0x6007, 0x6007, 0x6007, 0x6007
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_12[16] = {
- 0x2001, 0x2001, 0x2003, 0x2003, 0x4007, 0x4007, 0x4007, 0x4007,
- 0x6005, 0x6005, 0x6005, 0x6005, 0x6005, 0x6005, 0x6005, 0x6005
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_13[16] = {
- 0x4001, 0x4001, 0x4001, 0x4001, 0x4003, 0x4003, 0x4003, 0x4003,
- 0x6005, 0x6005, 0x6005, 0x6005, 0x6005, 0x6005, 0x6005, 0x6005
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_14[16] = {
- 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001,
- 0x6003, 0x6003, 0x6003, 0x6003, 0x6003, 0x6003, 0x6003, 0x6003
-};
-
-const OMX_U16 * armVCM4P10_CAVLCTotalZeroTables[15] = {
- armVCM4P10_CAVLCTotalZeroTables_0,
- armVCM4P10_CAVLCTotalZeroTables_1,
- armVCM4P10_CAVLCTotalZeroTables_2,
- armVCM4P10_CAVLCTotalZeroTables_3,
- armVCM4P10_CAVLCTotalZeroTables_4,
- armVCM4P10_CAVLCTotalZeroTables_5,
- armVCM4P10_CAVLCTotalZeroTables_6,
- armVCM4P10_CAVLCTotalZeroTables_7,
- armVCM4P10_CAVLCTotalZeroTables_8,
- armVCM4P10_CAVLCTotalZeroTables_9,
- armVCM4P10_CAVLCTotalZeroTables_10,
- armVCM4P10_CAVLCTotalZeroTables_11,
- armVCM4P10_CAVLCTotalZeroTables_12,
- armVCM4P10_CAVLCTotalZeroTables_13,
- armVCM4P10_CAVLCTotalZeroTables_14
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeros2x2Tables_0[16] = {
- 0x2007, 0x2007, 0x2005, 0x2005, 0x4003, 0x4003, 0x4003, 0x4003,
- 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeros2x2Tables_1[16] = {
- 0x4005, 0x4005, 0x4005, 0x4005, 0x4003, 0x4003, 0x4003, 0x4003,
- 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeros2x2Tables_2[16] = {
- 0x6003, 0x6003, 0x6003, 0x6003, 0x6003, 0x6003, 0x6003, 0x6003,
- 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001
-};
-
-const OMX_U16 * armVCM4P10_CAVLCTotalZeros2x2Tables[3] = {
- armVCM4P10_CAVLCTotalZeros2x2Tables_0,
- armVCM4P10_CAVLCTotalZeros2x2Tables_1,
- armVCM4P10_CAVLCTotalZeros2x2Tables_2
-};
-
-static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_0[8] = {
- 0x4003, 0x4003, 0x4003, 0x4003, 0x4001, 0x4001, 0x4001, 0x4001
-};
-
-static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_1[8] = {
- 0x2005, 0x2005, 0x2003, 0x2003, 0x4001, 0x4001, 0x4001, 0x4001
-};
-
-static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_2[8] = {
- 0x2007, 0x2007, 0x2005, 0x2005, 0x2003, 0x2003, 0x2001, 0x2001
-};
-
-static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_3[8] = {
- 0x0009, 0x0007, 0x2005, 0x2005, 0x2003, 0x2003, 0x2001, 0x2001
-};
-
-static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_4[8] = {
- 0x000b, 0x0009, 0x0007, 0x0005, 0x2003, 0x2003, 0x2001, 0x2001
-};
-
-static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_5[8] = {
- 0x0003, 0x0005, 0x0009, 0x0007, 0x000d, 0x000b, 0x2001, 0x2001
-};
-
-static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_6[24] = {
- 0x0010, 0x000d, 0x000b, 0x0009, 0x0007, 0x0005, 0x0003, 0x0001,
- 0x0018, 0x0011, 0x200f, 0x200f, 0x0020, 0x0015, 0x2013, 0x2013,
- 0x0028, 0x0019, 0x2017, 0x2017, 0x07ff, 0x001d, 0x201b, 0x201b
-};
-
-/* Tables 7 to 14 are duplicates of table 6 */
-
-const OMX_U16 * armVCM4P10_CAVLCRunBeforeTables[15] = {
- armVCM4P10_CAVLCRunBeforeTables_0, /* ZerosLeft=1 */
- armVCM4P10_CAVLCRunBeforeTables_1,
- armVCM4P10_CAVLCRunBeforeTables_2,
- armVCM4P10_CAVLCRunBeforeTables_3,
- armVCM4P10_CAVLCRunBeforeTables_4,
- armVCM4P10_CAVLCRunBeforeTables_5, /* ZerosLeft=6 */
- armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=7 */
- armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=8 */
- armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=9 */
- armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=10 */
- armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=11 */
- armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=12 */
- armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=13 */
- armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=14 */
- armVCM4P10_CAVLCRunBeforeTables_6 /* ZerosLeft=15 */
-};
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_DeblockingChroma_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_DeblockingChroma_unsafe_s.s
deleted file mode 100644
index 51dcb92..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_DeblockingChroma_unsafe_s.s
+++ /dev/null
@@ -1,34 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_DeblockingChroma_unsafe_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
-
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_DeblockingLuma_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_DeblockingLuma_unsafe_s.s
deleted file mode 100644
index 2085233..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_DeblockingLuma_unsafe_s.s
+++ /dev/null
@@ -1,380 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_DeblockingLuma_unsafe_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
-
-
- IF ARM1136JS
-
-MASK_1 EQU 0x01010101
-
-;// Declare input registers
-
-pQ0 RN 0
-StepArg RN 1
-tC0Arg RN 2
-alpha RN 6
-
-beta RN 14
-bS RN 14
-tC0 RN 14
-ptC0 RN 1
-
-;// Declare Local/Temporary variables
-
-;// Pixels
-p_0 RN 3
-p_1 RN 5
-p_2 RN 4
-p_3 RN 2
-q_0 RN 8
-q_1 RN 9
-q_2 RN 10
-q_3 RN 12
-
-
-;// Filtering
-
-ap0q0 RN 1
-filt RN 2
-
-m00 RN 7
-m01 RN 11
-
-apflg RN 0
-aqflg RN 6
-
-tC RN 1
-
-
-;//Declarations for bSLT4 kernel
-
-pos RN 7
-neg RN 12
-
-P0a RN 1
-P1a RN 8
-Q0a RN 7
-Q1a RN 4
-
-u1 RN 3
-max RN 12
-min RN 2
-
-
-
-;//Declarations for bSGE4 kernel
-
-q_3b RN 9
-p_3b RN 0
-apqflg RN 12
-
-P0b RN 6
-P1b RN 7
-P2b RN 1
-
-Q0b RN 9
-Q1b RN 0
-Q2b RN 2
-
-;// Miscellanous
-
-a RN 0
-t0 RN 3
-t1 RN 12
-t2 RN 7
-t3 RN 11
-t4 RN 4
-t5 RN 1
-t8 RN 6
-t9 RN 14
-t10 RN 5
-t11 RN 9
-
-;// Register usage for - armVCM4P10_DeblockingLumabSLT4_unsafe()
-;//
-;// Inputs - 3,4,5,8,9,10 - Input Pixels (p0-p2,q0-q2)
-;// - 2 - filt, 0 - apflg, 6 - aqflg
-;// - 11 - m01, 7 - tC0
-;//
-;// Outputs - 1,8,7,11 - Output Pixels(P0a,P1a,Q0a,Q1a)
-;//
-;// Registers Corrupted - 0-3,5-12,14
-
-
- M_START armVCM4P10_DeblockingLumabSLT4_unsafe, lr
-
- ;// Since beta <= 18 and alpha <= 255 we know
- ;// -254 <= p0-q0 <= 254
- ;// -17 <= q1-q0 <= 17
- ;// -17 <= p1-p0 <= 17
-
- ;// delta = Clip3( -tC, tC, ((((q0-p0)<<2) + (p1-q1) + 4)>>3))
- ;//
- ;// Calculate A = (((q0-p0)<<2) + (p1-q1) + 4)>>3
- ;// = (4*q0 - 4*p0 + p1 - q1 + 4)>>3
- ;// = ((p1-p0) - (q1-q0) - 3*(p0-q0) + 4)>>3
-
- USUB8 t1, p_1, p_0
- MUL tC0, t2, m01
-
- USUB8 t2, q_1, q_0
- SSUB8 t1, t1, t2
-
- USUB8 t2, p_0, q_0
- AND t2, t2, m01
- SHSUB8 t1, t1, t2
- UHSUB8 t5, p_0, q_0
- SSUB8 t1, t1, t2
- SHSUB8 t1, t1, t5
- MOV m00, #0
- SADD8 t1, t1, m01
- SHSUB8 t1, t1, t5
-
- ;// tC = tC0
- ;// if (ap < beta) tC++;
- ;// if (aq < beta) tC++;
- USUB8 t5, filt, m01
- SEL tC0, tC0, m00
- UQADD8 tC, tC0, apflg
- SSUB8 t1, t1, m00
- UQADD8 tC, tC, aqflg
-
- ;// Split into positive and negative part and clip
- SEL pos, t1, m00
- USUB8 neg, pos, t1
- USUB8 t3, pos, tC
- SEL pos, tC, pos
- USUB8 t3, neg, tC
- SEL neg, tC, neg
-
- ;//Reload m01
- LDR m01,=MASK_1
-
- UQADD8 P0a, p_0, pos
- UQSUB8 Q0a, q_0, pos
- UQSUB8 P0a, P0a, neg
- UQADD8 Q0a, Q0a, neg
-
- ;// Choose to store the filtered
- ;// value or the original pixel
- USUB8 t1, filt, m01
- SEL P0a, P0a, p_0
- SEL Q0a, Q0a, q_0
-
- ;// delta = (p2 + ((p0+q0+1)>>1) - (p1<<1))>>1;
- ;// u1 = (p0 + q0 + 1)>>1
- ;// u1 = ( (q_0 - p_0')>>1 ) ^ 0x80
- MVN p_0, p_0
- UHSUB8 u1, q_0, p_0
- UQADD8 max, p_1, tC0
- EOR u1, u1, m01 ,LSL #7
-
- ;// Calculate A = (p2+u1)>>1
- ;// Then delta = Clip3( -tC0, tC0, A - p1)
-
- ;// Clip P1
- UHADD8 P1a, p_2, u1
- UQSUB8 min, p_1, tC0
- USUB8 t4, P1a, max
- SEL P1a, max, P1a
- USUB8 t4, P1a, min
- SEL P1a, P1a, min
-
- ;// Clip Q1
- UHADD8 Q1a, q_2, u1
- UQADD8 max, q_1, tC0
- UQSUB8 min, q_1, tC0
- USUB8 t0, Q1a, max
- SEL Q1a, max, Q1a
- USUB8 t0, Q1a, min
- SEL Q1a, Q1a, min
-
- ;// Choose to store the filtered
- ;// value or the original pixel
- USUB8 t0, apflg, m01
- SEL P1a, P1a, p_1
- USUB8 t0, aqflg, m01
- SEL t3, Q1a, q_1
-
- M_END
-
-;// Register usage for - armVCM4P10_DeblockingLumabSGE4_unsafe()
-;//
-;// Inputs - 3,4,5,8,9,10 - Input Pixels (p0-p2,q0-q2)
-;// - 2 - filt, 0 - apflg,aqflg
-;// - 1 - ap0q0, 6 - alpha
-;// - 7 - m00, 11 - m01
-;//
-;// Outputs - 6,7,1,9,0,2 - Output Pixels(P0b,P1b,P2b, Q0b,Q1b,Q2b)
-;//
-;// Registers Corrupted - 0-3,5-12,14
-
- M_START armVCM4P10_DeblockingLumabSGE4_unsafe, lr
-
- ;// apflg = apflg && |p0-q0|<((alpha>>2)+2)
- ;// apflg = aqflg && |p0-q0|<((alpha>>2)+2)
-
- M_ARG pDummy,4
- M_ARG pQ_3,4
- M_ARG pP_3,4
-
- UHADD8 alpha, alpha, m00
- USUB8 t9, p_2, p_0 ;//t9 = dp2p0
- UHADD8 alpha, alpha, m00
- ADD alpha, alpha, m01, LSL #1
- USUB8 ap0q0, ap0q0, alpha
- SEL apqflg, m00, apflg
-
- ;// P0 = (p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4)>>3
- ;// = ((p2-p0) + 2*(p1-p0) + (q1-q0) + 3*(q0-p0) + 8*p0 + 4)>>3
- ;// = p0 + (((p2-p0) + 2*(p1-p0) + (q1-q0) - 3*(p0-q0) + 4)>>3)
-
- ;// P1 = (p2 + p1 + q0 + p0 + 2)>>2
- ;// = p0 + (((p2-p0) + (p1-p0) - (p0-q0) + 2)>>2)
-
- ;// P2 = (2*p3 + 3*p2 + p1 + p0 + q0 + 4)>>3
- ;// = (2*(p3-p0) + 3*(p2-p0) + (p1-p0) - (p0-q0) + 8*p0 + 4)>>3
- ;// = p0 + (((p3-p0) + (p2-p0) + t2 + 2)>>2)
-
- ;// Compute P0b
- USUB8 t2, p_0, q_0
- SSUB8 t5, t9, t2
-
- USUB8 t8, q_1, q_0
- SHADD8 t8, t5, t8
-
- USUB8 t9, p_1, p_0
- SADD8 t8, t8, t9
- SHSUB8 t8, t8, t2
- SHADD8 t5, t5, t9
- SHADD8 t8, t8, m01
- SHADD8 t9, t5, m01
- SADD8 P0b, p_0, t8
- ;// P0b ready
-
- ;// Compute P1b
- M_LDR p_3b, pP_3
- SADD8 P1b, p_0, t9
- ;// P1b ready
-
- ;// Compute P2b
- USUB8 t9, p_2, p_0
- SADD8 t5, t5, t9
- UHSUB8 t9, p_3b, p_0
- EOR a, p_3b, p_0
- AND a, a, m01
- SHADD8 t5, t5, a
- UHADD8 a, p_0, q_1
- SADD8 t5, t5, m01
- SHADD8 t5, t5, t9
- MVN t9, p_1
- SADD8 P2b, p_0, t5
- ;// P2b ready
-
- UHSUB8 a, a, t9
- ORR t9, apqflg, m01
- USUB8 t9, apqflg, t9
-
- EOR a, a, m01, LSL #7
- SEL P0b, P0b, a
- SEL P1b, P1b, p_1
- SEL P2b, P2b, p_2
-
- USUB8 t4, filt, m01
- SEL P0b, P0b, p_0
-
-
- ;// Q0 = (q2 + 2*q1 + 2*q0 + 2*p0 + p1 + 4)>>3
- ;// = ((q2-q0) + 2*(q1-q0) + (p1-p0) + 3*(p0-q0) + 8*q0 + 4)>>3
- ;// = q0 + (((q2-q0) + 2*(q1-q0) + (p1-p0) + 3*(p0-q0) + 4)>>3)
-
- ;// Q1 = (q2 + q1 + p0 + q0 + 2)>>2
- ;// = q0 + (((q2-q0) + (q1-q0) + (p0-q0) + 2)>>2)
-
- ;// Q2 = (2*q3 + 3*q2 + q1 + q0 + p0 + 4)>>3
- ;// = (2*(q3-q0) + 3*(q2-q0) + (q1-q0) + (p0-q0) + 8*q0 + 4)>>3
- ;// = q0 + (((q3-q0) + (q2-q0) + t2 + 2)>>2)
-
-
- ;// Compute Q0b Q1b
- USUB8 t4, q_2, q_0
- USUB8 a, p_0, q_0
- USUB8 t9, p_1, p_0
- SADD8 t0, t4, a
- SHADD8 t9, t0, t9
- UHADD8 t10, q_0, p_1
- SADD8 t9, t9, a
- USUB8 a, q_1, q_0
- SHADD8 t9, t9, a
- SHADD8 t0, t0, a
- SHADD8 t9, t9, m01
- SHADD8 a, t0, m01
- SADD8 t9, q_0, t9
- ;// Q0b ready - t9
-
- MOV t4, #0
- UHADD8 apqflg, apqflg, t4
-
- SADD8 Q1b, q_0, a
- ;// Q1b ready
-
- USUB8 t4, apqflg, m01
- SEL Q1b, Q1b, q_1
- MVN t11, q_1
- UHSUB8 t10, t10, t11
- M_LDR q_3b, pQ_3
- EOR t10, t10, m01, LSL #7
- SEL t9, t9, t10
-
- ;// Compute Q2b
- USUB8 t4, q_2, q_0
- SADD8 t4, t0, t4
- EOR t0, q_3b, q_0
- AND t0, t0, m01
- SHADD8 t4, t4, t0
- UHSUB8 t10, q_3b, q_0
- SADD8 t4, t4, m01
- SHADD8 t4, t4, t10
-
- USUB8 t10, filt, m01
- SEL Q0b, t9, q_0
-
- SADD8 t4, q_0, t4
- ;// Q2b ready - t4
-
- USUB8 t10, apqflg, m01
- SEL Q2b, t4, q_2
-
- M_END
-
- ENDIF
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_DecodeCoeffsToPair_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_DecodeCoeffsToPair_s.s
deleted file mode 100644
index 33638bf..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_DecodeCoeffsToPair_s.s
+++ /dev/null
@@ -1,339 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_DecodeCoeffsToPair_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
- INCLUDE armCOMM_BitDec_s.h
-
- IMPORT armVCM4P10_CAVLCCoeffTokenTables
- IMPORT armVCM4P10_CAVLCTotalZeroTables
- IMPORT armVCM4P10_CAVLCTotalZeros2x2Tables
- IMPORT armVCM4P10_CAVLCRunBeforeTables
- IMPORT armVCM4P10_SuffixToLevel
- IMPORT armVCM4P10_ZigZag_4x4
- IMPORT armVCM4P10_ZigZag_2x2
-
- M_VARIANTS ARM1136JS
-
-;//DEBUG_ON SETL {TRUE}
-
-LAST_COEFF EQU 0x20 ;// End of block flag
-TWO_BYTE_COEFF EQU 0x10
-
-;// Declare input registers
-
-ppBitStream RN 0
-pOffset RN 1
-pNumCoeff RN 2
-ppPosCoefbuf RN 3
-nC RN 4 ;// number of coeffs or 17 for chroma
-sMaxNumCoeff RN 5
-
-;// Declare inner loop registers
-
-;// Level loop
-Count RN 0
-TrailingOnes RN 1
-pLevel RN 2
-LevelSuffix RN 3
-SuffixLength RN 4
-TotalCoeff RN 5
-
-pVLDTable RN 6
-Symbol RN 7
-T1 RN 8
-T2 RN 9
-RBitStream RN 10
-RBitBuffer RN 11
-RBitCount RN 12
-lr RN 14
-
-;// Run loop
-Count RN 0
-ZerosLeft RN 1
-pLevel RN 2
-ppRunTable RN 3
-pRun RN 4
-TotalCoeff RN 5
-
-pVLDTable RN 6
-Symbol RN 7
-T1 RN 8
-T2 RN 9
-RBitStream RN 10
-RBitBuffer RN 11
-RBitCount RN 12
-lr RN 14
-
-;// Fill in coefficients loop
-pPosCoefbuf RN 0
-temp RN 1
-pLevel RN 2
-ppPosCoefbuf RN 3
-pRun RN 4
-TotalCoeff RN 5
-pZigZag RN 6
-
-T1 RN 8
-T2 RN 9
-RBitStream RN 10
-RBitBuffer RN 11
-RBitCount RN 12
-CoeffNum RN 14
-
-
-
- IF ARM1136JS
-
- ;// Allocate stack memory required by the function
- M_ALLOC4 pppBitStream, 4
- M_ALLOC4 ppOffset, 4
- M_ALLOC4 pppPosCoefbuf, 4
- M_ALLOC4 ppLevel, 16*2
- M_ALLOC4 ppRun, 16
-
- ;// Write function header
- M_START armVCM4P10_DecodeCoeffsToPair, r11
-
- ;// Define stack arguments
- M_ARG pNC, 4
- M_ARG pSMaxNumCoeff,4
-
- ;// Code start
- M_BD_INIT0 ppBitStream, pOffset, RBitStream, RBitBuffer, RBitCount
- LDR pVLDTable, =armVCM4P10_CAVLCCoeffTokenTables
- M_LDR nC, pNC
-
- M_BD_INIT1 T1, T2, lr
- LDR pVLDTable, [pVLDTable, nC, LSL #2] ;// Find VLD table
-
- M_BD_INIT2 T1, T2, lr
-
- ;// Decode Symbol = TotalCoeff*4 + TrailingOnes
- M_BD_VLD Symbol, T1, T2, pVLDTable, 4, 2
-
- MOVS TotalCoeff, Symbol, LSR #2
- STRB TotalCoeff, [pNumCoeff]
- M_PRINTF "TotalCoeff=%d\n", TotalCoeff
- BEQ.W EndNoError ;// Finished if no coefficients
-
- CMP Symbol, #17*4
- BGE.W EndBadSymbol ;// Error if bad symbol
-
- ;// Save bitstream pointers
- M_STR ppBitStream, pppBitStream
- M_STR pOffset, ppOffset
- M_STR ppPosCoefbuf, pppPosCoefbuf
-
- ;// Decode Trailing Ones
- ANDS TrailingOnes, Symbol, #3
- M_ADR pLevel, ppLevel
- M_PRINTF "TrailingOnes=%d\n", TrailingOnes
- BEQ TrailingOnesDone
- MOV Count, TrailingOnes
-TrailingOnesLoop
- M_BD_READ8 Symbol, 1, T1
- SUBS Count, Count, #1
- MOV T1, #1
- SUB T1, T1, Symbol, LSL #1
- M_PRINTF "Level=%d\n", T1
- STRH T1, [pLevel], #2
- BGT TrailingOnesLoop
-TrailingOnesDone
-
- ;// Decode level values
- SUBS Count, TotalCoeff, TrailingOnes ;// Number of levels to read
- BEQ DecodeRuns ;// None left
-
- MOV SuffixLength, #1
- CMP TotalCoeff, #10
- MOVLE SuffixLength, #0
- CMP TrailingOnes, #3 ;// if (TrailingOnes<3)
- MOVLT TrailingOnes, #4 ;// then TrailingOnes = +4
- MOVGE TrailingOnes, #2 ;// else TrailingOnes = +2
- MOVGE SuffixLength, #0 ;// SuffixLength = 0
-
-LevelLoop
- M_BD_CLZ16 Symbol, T1, T2 ;// Symbol=LevelPrefix
- CMP Symbol,#16
- BGE EndBadSymbol
-
- MOVS lr, SuffixLength ;// if LevelSuffixSize==0
- TEQEQ Symbol, #14 ;// and LevelPrefix==14
- MOVEQ lr, #4 ;// then LevelSuffixSize=4
- TEQ Symbol, #15 ;// if LevelSuffixSize==15
- MOVEQ lr, #12 ;// then LevelSuffixSize=12
-
- TEQEQ SuffixLength,#0
- ADDEQ Symbol,Symbol,#15
-
- TEQ lr, #0 ;// if LevelSuffixSize==0
- BEQ LevelCodeRead ;// LevelCode = LevelPrefix
-
- M_BD_VREAD16 LevelSuffix, lr, T1, T2 ;// Read Level Suffix
-
- MOV Symbol, Symbol, LSL SuffixLength
- ADD Symbol, LevelSuffix, Symbol
-
-LevelCodeRead
- ;// Symbol = LevelCode
- ADD Symbol, Symbol, TrailingOnes ;// +4 if level cannot be +/-1, +2 o/w
- MOV TrailingOnes, #2
- MOVS T1, Symbol, LSR #1
- RSBCS T1, T1, #0 ;// If Symbol odd then negate
- M_PRINTF "Level=%d\n", T1
- STRH T1, [pLevel], #2 ;// Store level.
-
- LDR T2, =armVCM4P10_SuffixToLevel
- LDRSB T1, [T2, SuffixLength] ;// Find increment level
- TEQ SuffixLength, #0
- MOVEQ SuffixLength, #1
- CMP Symbol, T1
- ADDCS SuffixLength, SuffixLength, #1
- SUBS Count, Count, #1
- BGT LevelLoop
-
-DecodeRuns
- ;// Find number of zeros
- M_LDR T1, pSMaxNumCoeff ;// sMaxNumCoeff
- SUB Count, TotalCoeff, #1 ;// Number of runs excluding last
- SUBS ZerosLeft, T1, TotalCoeff ;// Maximum number of zeros there could be
- M_ADR pRun, ppRun
- MOV CoeffNum,TotalCoeff
- SUB CoeffNum,CoeffNum,#1
- BEQ NoZerosLeft
-
- ;// Unpack number of zeros from bitstream
- TEQ T1, #4
- LDREQ pVLDTable, =(armVCM4P10_CAVLCTotalZeros2x2Tables-4)
- LDRNE pVLDTable, =(armVCM4P10_CAVLCTotalZeroTables-4)
- LDR pVLDTable, [pVLDTable, TotalCoeff, LSL #2]
-
- M_BD_VLD Symbol, T1, T2, pVLDTable, 4, 2 ;// Symbol = ZerosLeft
- CMP Symbol,#16
- BGE EndBadSymbol
-
- LDR ppRunTable, =(armVCM4P10_CAVLCRunBeforeTables-4)
- M_ADR pRun, ppRun
- MOVS ZerosLeft, Symbol
-
- ADD CoeffNum,CoeffNum,ZerosLeft
-
- BEQ NoZerosLeft
-
- ;// Decode runs while zeros are left and more than one coefficient
-RunLoop
- SUBS Count, Count, #1
- LDR pVLDTable, [ppRunTable, ZerosLeft, LSL#2]
- BLT LastRun
- M_BD_VLD Symbol, T1, T2, pVLDTable, 3, 2 ;// Symbol = Run
- CMP Symbol,#15
- BGE EndBadSymbol
-
- SUBS ZerosLeft, ZerosLeft, Symbol
- M_PRINTF "Run=%d\n", Symbol
- STRB Symbol, [pRun], #1
- BGT RunLoop
-
- ;// Decode runs while no zeros are left
-NoZerosLeft
- SUBS Count, Count, #1
- M_PRINTF "Run=%d\n", ZerosLeft
- STRGEB ZerosLeft, [pRun], #1
- BGT NoZerosLeft
-
-LastRun
- ;// Final run length is remaining zeros
- M_PRINTF "LastRun=%d\n", ZerosLeft
- STRB ZerosLeft, [pRun], #1
-
- ;// Write coefficients to output array
- M_LDR T1, pSMaxNumCoeff ;// sMaxNumCoeff
- TEQ T1, #15
- ADDEQ CoeffNum,CoeffNum,#1
-
-
- SUB pRun,pRun,TotalCoeff
- SUB pLevel,pLevel,TotalCoeff
- SUB pLevel,pLevel,TotalCoeff
-
- M_LDR ppPosCoefbuf, pppPosCoefbuf
- LDR pPosCoefbuf, [ppPosCoefbuf]
- TEQ T1, #4
- LDREQ pZigZag, =armVCM4P10_ZigZag_2x2
- LDRNE pZigZag, =armVCM4P10_ZigZag_4x4
-
-
-
-OutputLoop
-
- LDRB T2, [pRun],#1
- LDRB T1, [pZigZag, CoeffNum]
- SUB CoeffNum, CoeffNum, #1 ;// Skip Non zero
- SUB CoeffNum, CoeffNum, T2 ;// Skip Zero run
-
- LDRSH T2, [pLevel],#2
-
- SUBS TotalCoeff, TotalCoeff, #1
- ORREQ T1, T1, #LAST_COEFF
-
- ADD temp, T2, #128
- CMP temp, #256
- ORRCS T1, T1, #TWO_BYTE_COEFF
-
-
- TEQ TotalCoeff, #0 ;// Preserves carry
-
- M_PRINTF "Output=%02x %04x\n", T1, T2
- STRB T1, [pPosCoefbuf], #1
- STRB T2, [pPosCoefbuf], #1
- MOV T2, T2, LSR #8
- STRCSB T2, [pPosCoefbuf], #1
- BNE OutputLoop
-
- ;// Finished
- STR pPosCoefbuf, [ppPosCoefbuf]
- M_LDR ppBitStream, pppBitStream
- M_LDR pOffset, ppOffset
- B EndNoError
-
-EndBadSymbol
- MOV r0, #OMX_Sts_Err
- B End
-
-EndNoError
- ;// Finished reading from the bitstream
- M_BD_FINI ppBitStream, pOffset
-
- ;// Set return value
- MOV r0, #OMX_Sts_NoErr
-End
- M_END
-
- ENDIF
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_DequantTables_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_DequantTables_s.s
deleted file mode 100644
index afe07b5..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_DequantTables_s.s
+++ /dev/null
@@ -1,137 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_DequantTables_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- EXPORT armVCM4P10_QPDivTable
- EXPORT armVCM4P10_VMatrixQPModTable
- EXPORT armVCM4P10_PosToVCol4x4
- EXPORT armVCM4P10_PosToVCol2x2
- EXPORT armVCM4P10_VMatrix
- EXPORT armVCM4P10_QPModuloTable
- EXPORT armVCM4P10_VMatrixU16
-
-;// Define the processor variants supported by this file
-
- M_VARIANTS ARM1136JS
-
-
-;// Guarding implementation by the processor name
-
-
- IF ARM1136JS :LOR: CortexA8
-
-
- M_TABLE armVCM4P10_PosToVCol4x4
- DCB 0, 2, 0, 2
- DCB 2, 1, 2, 1
- DCB 0, 2, 0, 2
- DCB 2, 1, 2, 1
-
-
- M_TABLE armVCM4P10_PosToVCol2x2
- DCB 0, 2
- DCB 2, 1
-
-
- M_TABLE armVCM4P10_VMatrix
- DCB 10, 16, 13
- DCB 11, 18, 14
- DCB 13, 20, 16
- DCB 14, 23, 18
- DCB 16, 25, 20
- DCB 18, 29, 23
-
-;//-------------------------------------------------------
-;// This table evaluates the expression [(INT)(QP/6)],
-;// for values of QP from 0 to 51 (inclusive).
-;//-------------------------------------------------------
-
- M_TABLE armVCM4P10_QPDivTable
- DCB 0, 0, 0, 0, 0, 0
- DCB 1, 1, 1, 1, 1, 1
- DCB 2, 2, 2, 2, 2, 2
- DCB 3, 3, 3, 3, 3, 3
- DCB 4, 4, 4, 4, 4, 4
- DCB 5, 5, 5, 5, 5, 5
- DCB 6, 6, 6, 6, 6, 6
- DCB 7, 7, 7, 7, 7, 7
- DCB 8, 8, 8, 8, 8, 8
-
-;//----------------------------------------------------
-;// This table contains armVCM4P10_VMatrix[QP%6][0] entires,
-;// for values of QP from 0 to 51 (inclusive).
-;//----------------------------------------------------
-
- M_TABLE armVCM4P10_VMatrixQPModTable
- DCB 10, 11, 13, 14, 16, 18
- DCB 10, 11, 13, 14, 16, 18
- DCB 10, 11, 13, 14, 16, 18
- DCB 10, 11, 13, 14, 16, 18
- DCB 10, 11, 13, 14, 16, 18
- DCB 10, 11, 13, 14, 16, 18
- DCB 10, 11, 13, 14, 16, 18
- DCB 10, 11, 13, 14, 16, 18
- DCB 10, 11, 13, 14, 16, 18
-
-;//-------------------------------------------------------
-;// This table evaluates the modulus expression [QP%6]*6,
-;// for values of QP from 0 to 51 (inclusive).
-;//-------------------------------------------------------
-
- M_TABLE armVCM4P10_QPModuloTable
- DCB 0, 6, 12, 18, 24, 30
- DCB 0, 6, 12, 18, 24, 30
- DCB 0, 6, 12, 18, 24, 30
- DCB 0, 6, 12, 18, 24, 30
- DCB 0, 6, 12, 18, 24, 30
- DCB 0, 6, 12, 18, 24, 30
- DCB 0, 6, 12, 18, 24, 30
- DCB 0, 6, 12, 18, 24, 30
- DCB 0, 6, 12, 18, 24, 30
-
-;//-------------------------------------------------------
-;// This table contains the invidual byte values stored as
-;// halfwords. This avoids unpacking inside the function
-;//-------------------------------------------------------
-
- M_TABLE armVCM4P10_VMatrixU16
- DCW 10, 16, 13
- DCW 11, 18, 14
- DCW 13, 20, 16
- DCW 14, 23, 18
- DCW 16, 25, 20
- DCW 18, 29, 23
-
- ENDIF ;//ARM1136JS
-
-
-
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_Align_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_Align_unsafe_s.s
deleted file mode 100644
index ffe123d..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_Align_unsafe_s.s
+++ /dev/null
@@ -1,250 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_InterpolateLuma_Align_unsafe_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
- EXPORT armVCM4P10_InterpolateLuma_HorAlign9x_unsafe
- EXPORT armVCM4P10_InterpolateLuma_VerAlign4x_unsafe
-
-DEBUG_ON SETL {FALSE}
-
- IF ARM1136JS
-
-;// Declare input registers
-pSrc RN 0
-srcStep RN 1
-pDst RN 8
-iHeight RN 9
-
-;// Declare inner loop registers
-x RN 7
-x0 RN 7
-x1 RN 10
-x2 RN 11
-Scratch RN 12
-
-;// Function:
-;// armVCM4P10_InterpolateLuma_HorAlign9x_unsafe
-;//
-;// Implements copy from an arbitrary aligned source memory location (pSrc) to a 4 byte aligned
-;// destination pointed by (pDst) for horizontal interpolation.
-;// This function needs to copy 9 bytes in horizontal direction.
-;//
-;// Registers used as input for this function
-;// r0,r1,r8,r9 where r8 containings aligned memory pointer and r9 no rows to copy
-;//
-;// Registers preserved for top level function
-;// r2,r3,r4,r5,r6
-;//
-;// Registers modified by the function
-;// r7,r8,r9,r10,r11,r12
-;//
-;// Output registers
-;// r0 - pointer to the new aligned location which will be used as pSrc
-;// r1 - step size to this aligned location
-
- ;// Function header
- M_START armVCM4P10_InterpolateLuma_HorAlign9x_unsafe
-
- ;// Copy pDst to scratch
- MOV Scratch, pDst
-
-StartAlignedStackCopy
- AND x, pSrc, #3
- BIC pSrc, pSrc, #3
-
- M_SWITCH x
- M_CASE Copy0toAligned
- M_CASE Copy1toAligned
- M_CASE Copy2toAligned
- M_CASE Copy3toAligned
- M_ENDSWITCH
-
-Copy0toAligned
- LDM pSrc, {x0, x1, x2}
- SUBS iHeight, iHeight, #1
- ADD pSrc, pSrc, srcStep
-
- ;// One cycle stall
-
- STM pDst!, {x0, x1, x2} ;// Store aligned output row
- BGT Copy0toAligned
- B CopyEnd
-
-Copy1toAligned
- LDM pSrc, {x0, x1, x2}
- SUBS iHeight, iHeight, #1
- ADD pSrc, pSrc, srcStep
-
- ;// One cycle stall
-
- MOV x0, x0, LSR #8
- ORR x0, x0, x1, LSL #24
- MOV x1, x1, LSR #8
- ORR x1, x1, x2, LSL #24
- MOV x2, x2, LSR #8
- STM pDst!, {x0, x1, x2} ;// Store aligned output row
- BGT Copy1toAligned
- B CopyEnd
-
-Copy2toAligned
- LDM pSrc, {x0, x1, x2}
- SUBS iHeight, iHeight, #1
- ADD pSrc, pSrc, srcStep
-
- ;// One cycle stall
-
- MOV x0, x0, LSR #16
- ORR x0, x0, x1, LSL #16
- MOV x1, x1, LSR #16
- ORR x1, x1, x2, LSL #16
- MOV x2, x2, LSR #16
- STM pDst!, {x0, x1, x2} ;// Store aligned output row
- BGT Copy2toAligned
- B CopyEnd
-
-Copy3toAligned
- LDM pSrc, {x0, x1, x2}
- SUBS iHeight, iHeight, #1
- ADD pSrc, pSrc, srcStep
-
- ;// One cycle stall
-
- MOV x0, x0, LSR #24
- ORR x0, x0, x1, LSL #8
- MOV x1, x1, LSR #24
- ORR x1, x1, x2, LSL #8
- MOV x2, x2, LSR #24
- STM pDst!, {x0, x1, x2} ;// Store aligned output row
- BGT Copy3toAligned
-
-CopyEnd
-
- MOV pSrc, Scratch
- MOV srcStep, #12
-
- M_END
-
-
-;// Function:
-;// armVCM4P10_InterpolateLuma_VerAlign4x_unsafe
-;//
-;// Implements copy from an arbitrary aligned source memory location (pSrc) to an aligned
-;// destination pointed by (pDst) for vertical interpolation.
-;// This function needs to copy 4 bytes in horizontal direction
-;//
-;// Registers used as input for this function
-;// r0,r1,r8,r9 where r8 containings aligned memory pointer and r9 no of rows to copy
-;//
-;// Registers preserved for top level function
-;// r2,r3,r4,r5,r6
-;//
-;// Registers modified by the function
-;// r7,r8,r9,r10,r11,r12
-;//
-;// Output registers
-;// r0 - pointer to the new aligned location which will be used as pSrc
-;// r1 - step size to this aligned location
-
- ;// Function header
- M_START armVCM4P10_InterpolateLuma_VerAlign4x_unsafe
-
- ;// Copy pSrc to stack
-StartVAlignedStackCopy
- AND x, pSrc, #3
- BIC pSrc, pSrc, #3
-
-
- M_SWITCH x
- M_CASE Copy0toVAligned
- M_CASE Copy1toVAligned
- M_CASE Copy2toVAligned
- M_CASE Copy3toVAligned
- M_ENDSWITCH
-
-Copy0toVAligned
- M_LDR x0, [pSrc], srcStep
- SUBS iHeight, iHeight, #1
-
- ;// One cycle stall
-
- STR x0, [pDst], #4 ;// Store aligned output row
- BGT Copy0toVAligned
- B CopyVEnd
-
-Copy1toVAligned
- LDR x1, [pSrc, #4]
- M_LDR x0, [pSrc], srcStep
- SUBS iHeight, iHeight, #1
-
- ;// One cycle stall
-
- MOV x1, x1, LSL #24
- ORR x0, x1, x0, LSR #8
- STR x0, [pDst], #4 ;// Store aligned output row
- BGT Copy1toVAligned
- B CopyVEnd
-
-Copy2toVAligned
- LDR x1, [pSrc, #4]
- M_LDR x0, [pSrc], srcStep
- SUBS iHeight, iHeight, #1
-
- ;// One cycle stall
-
- MOV x1, x1, LSL #16
- ORR x0, x1, x0, LSR #16
- STR x0, [pDst], #4 ;// Store aligned output row
- BGT Copy2toVAligned
- B CopyVEnd
-
-Copy3toVAligned
- LDR x1, [pSrc, #4]
- M_LDR x0, [pSrc], srcStep
- SUBS iHeight, iHeight, #1
-
- ;// One cycle stall
-
- MOV x1, x1, LSL #8
- ORR x0, x1, x0, LSR #24
- STR x0, [pDst], #4 ;// Store aligned output row
- BGT Copy3toVAligned
-
-CopyVEnd
-
- SUB pSrc, pDst, #28
- MOV srcStep, #4
-
- M_END
-
-
- ENDIF
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_Copy_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_Copy_unsafe_s.s
deleted file mode 100644
index c9a89fd..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_Copy_unsafe_s.s
+++ /dev/null
@@ -1,163 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_InterpolateLuma_Copy_unsafe_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
-;// Function:
-;// armVCM4P10_InterpolateLuma_Copy4x4_unsafe
-;//
-;// Implements copy from an arbitrary aligned source memory location (pSrc) to an aligned
-;// destination pointed by (pDst)
-;//
-;// Registers preserved for top level function
-;// r1,r3,r4,r5,r6,r7,r10,r11,r14
-;//
-;// Registers modified by the function
-;// r0,r2,r8,r9,r12
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
- EXPORT armVCM4P10_InterpolateLuma_Copy4x4_unsafe
-
-;// Declare input registers
-pSrc RN 0
-srcStep RN 1
-pDst RN 2
-dstStep RN 3
-
-;// Declare other intermediate registers
-x0 RN 4
-x1 RN 5
-x2 RN 8
-x3 RN 9
-Temp RN 12
-
- IF ARM1136JS
-
- M_START armVCM4P10_InterpolateLuma_Copy4x4_unsafe, r6
-
-Copy4x4Start
- ;// Do Copy and branch to EndOfInterpolation
- AND Temp, pSrc, #3
- BIC pSrc, pSrc, #3
-
- M_SWITCH Temp
- M_CASE Copy4x4Align0
- M_CASE Copy4x4Align1
- M_CASE Copy4x4Align2
- M_CASE Copy4x4Align3
- M_ENDSWITCH
-
-Copy4x4Align0
- M_LDR x0, [pSrc], srcStep
- M_LDR x1, [pSrc], srcStep
- M_STR x0, [pDst], dstStep
- M_LDR x2, [pSrc], srcStep
- M_STR x1, [pDst], dstStep
- M_LDR x3, [pSrc], srcStep
- M_STR x2, [pDst], dstStep
- M_STR x3, [pDst], dstStep
- B Copy4x4End
-
-Copy4x4Align1
- LDR x1, [pSrc, #4]
- M_LDR x0, [pSrc], srcStep
- LDR x3, [pSrc, #4]
- M_LDR x2, [pSrc], srcStep
- MOV x0, x0, LSR #8
- ORR x0, x0, x1, LSL #24
- M_STR x0, [pDst], dstStep
- MOV x2, x2, LSR #8
- ORR x2, x2, x3, LSL #24
- LDR x1, [pSrc, #4]
- M_LDR x0, [pSrc], srcStep
- M_STR x2, [pDst], dstStep
- LDR x3, [pSrc, #4]
- M_LDR x2, [pSrc], srcStep
- MOV x0, x0, LSR #8
- ORR x0, x0, x1, LSL #24
- M_STR x0, [pDst], dstStep
- MOV x2, x2, LSR #8
- ORR x2, x2, x3, LSL #24
- M_STR x2, [pDst], dstStep
- B Copy4x4End
-
-Copy4x4Align2
- LDR x1, [pSrc, #4]
- M_LDR x0, [pSrc], srcStep
- LDR x3, [pSrc, #4]
- M_LDR x2, [pSrc], srcStep
- MOV x0, x0, LSR #16
- ORR x0, x0, x1, LSL #16
- M_STR x0, [pDst], dstStep
- MOV x2, x2, LSR #16
- ORR x2, x2, x3, LSL #16
- M_STR x2, [pDst], dstStep
-
- LDR x1, [pSrc, #4]
- M_LDR x0, [pSrc], srcStep
- LDR x3, [pSrc, #4]
- M_LDR x2, [pSrc], srcStep
- MOV x0, x0, LSR #16
- ORR x0, x0, x1, LSL #16
- M_STR x0, [pDst], dstStep
- MOV x2, x2, LSR #16
- ORR x2, x2, x3, LSL #16
- M_STR x2, [pDst], dstStep
- B Copy4x4End
-
-Copy4x4Align3
- LDR x1, [pSrc, #4]
- M_LDR x0, [pSrc], srcStep
- LDR x3, [pSrc, #4]
- M_LDR x2, [pSrc], srcStep
- MOV x0, x0, LSR #24
- ORR x0, x0, x1, LSL #8
- M_STR x0, [pDst], dstStep
- MOV x2, x2, LSR #24
- ORR x2, x2, x3, LSL #8
- M_STR x2, [pDst], dstStep
-
- LDR x1, [pSrc, #4]
- M_LDR x0, [pSrc], srcStep
- LDR x3, [pSrc, #4]
- M_LDR x2, [pSrc], srcStep
- MOV x0, x0, LSR #24
- ORR x0, x0, x1, LSL #8
- M_STR x0, [pDst], dstStep
- MOV x2, x2, LSR #24
- ORR x2, x2, x3, LSL #8
- M_STR x2, [pDst], dstStep
- B Copy4x4End
-
-Copy4x4End
- M_END
-
- ENDIF
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_DiagCopy_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_DiagCopy_unsafe_s.s
deleted file mode 100644
index 98b67eb..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_DiagCopy_unsafe_s.s
+++ /dev/null
@@ -1,192 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_InterpolateLuma_DiagCopy_unsafe_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
- EXPORT armVCM4P10_InterpolateLuma_HorDiagCopy_unsafe
- EXPORT armVCM4P10_InterpolateLuma_VerDiagCopy_unsafe
-
-;// Functions:
-;// armVCM4P10_InterpolateLuma_HorDiagCopy_unsafe and
-;// armVCM4P10_InterpolateLuma_VerDiagCopy_unsafe
-;//
-;// Implements re-arrangement of data from temporary buffer to a buffer pointed by pBuf.
-;// This will do the convertion of data from 16 bit to 8 bit and it also
-;// remove offset and check for saturation.
-;//
-;// Registers used as input for this function
-;// r0,r1,r7 where r0 is input pointer and r2 its step size, r7 is output pointer
-;//
-;// Registers preserved for top level function
-;// r4,r5,r6,r8,r9,r14
-;//
-;// Registers modified by the function
-;// r7,r10,r11,r12
-;//
-;// Output registers
-;// r0 - pointer to the destination location
-;// r1 - step size to this destination location
-
-
-DEBUG_ON SETL {FALSE}
-
-MASK EQU 0x80808080 ;// Mask is used to implement (a+b+1)/2
-
-;// Declare input registers
-
-pSrc0 RN 0
-srcStep0 RN 1
-
-;// Declare other intermediate registers
-Temp1 RN 4
-Temp2 RN 5
-Temp3 RN 10
-Temp4 RN 11
-pBuf RN 7
-r0x0fe00fe0 RN 6
-r0x00ff00ff RN 12
-Count RN 14
-ValueA0 RN 10
-ValueA1 RN 11
-
- IF ARM1136JS
-
-
- ;// Function header
- M_START armVCM4P10_InterpolateLuma_HorDiagCopy_unsafe, r6
-
- ;// Code start
- MOV Count, #4
- LDR r0x0fe00fe0, =0x0fe00fe0
- LDR r0x00ff00ff, =0x00ff00ff
-LoopStart1
- LDR Temp4, [pSrc0, #12]
- LDR Temp3, [pSrc0, #8]
- LDR Temp2, [pSrc0, #4]
- M_LDR Temp1, [pSrc0], srcStep0
- UQSUB16 Temp4, Temp4, r0x0fe00fe0
- UQSUB16 Temp3, Temp3, r0x0fe00fe0
- UQSUB16 Temp2, Temp2, r0x0fe00fe0
- UQSUB16 Temp1, Temp1, r0x0fe00fe0
- USAT16 Temp4, #13, Temp4
- USAT16 Temp3, #13, Temp3
- USAT16 Temp2, #13, Temp2
- USAT16 Temp1, #13, Temp1
- AND Temp4, r0x00ff00ff, Temp4, LSR #5
- AND Temp3, r0x00ff00ff, Temp3, LSR #5
- AND Temp2, r0x00ff00ff, Temp2, LSR #5
- AND Temp1, r0x00ff00ff, Temp1, LSR #5
- ORR ValueA1, Temp3, Temp4, LSL #8
- ORR ValueA0, Temp1, Temp2, LSL #8
- SUBS Count, Count, #1
- STRD ValueA0, [pBuf], #8
- BGT LoopStart1
-End1
- SUB pSrc0, pBuf, #32
- MOV srcStep0, #8
-
- M_END
-
-
- ;// Function header
- M_START armVCM4P10_InterpolateLuma_VerDiagCopy_unsafe, r6
-
- ;// Code start
- LDR r0x0fe00fe0, =0x0fe00fe0
- LDR r0x00ff00ff, =0x00ff00ff
- MOV Count, #2
-
-LoopStart
- LDR Temp4, [pSrc0, #12]
- LDR Temp3, [pSrc0, #8]
- LDR Temp2, [pSrc0, #4]
- M_LDR Temp1, [pSrc0], srcStep0
-
- UQSUB16 Temp4, Temp4, r0x0fe00fe0
- UQSUB16 Temp3, Temp3, r0x0fe00fe0
- UQSUB16 Temp2, Temp2, r0x0fe00fe0
- UQSUB16 Temp1, Temp1, r0x0fe00fe0
-
- USAT16 Temp4, #13, Temp4
- USAT16 Temp3, #13, Temp3
- USAT16 Temp2, #13, Temp2
- USAT16 Temp1, #13, Temp1
-
- AND Temp4, r0x00ff00ff, Temp4, LSR #5
- AND Temp3, r0x00ff00ff, Temp3, LSR #5
- AND Temp2, r0x00ff00ff, Temp2, LSR #5
- AND Temp1, r0x00ff00ff, Temp1, LSR #5
- ORR ValueA1, Temp3, Temp4, LSL #8 ;// [d2 c2 d0 c0]
- ORR ValueA0, Temp1, Temp2, LSL #8 ;// [b2 a2 b0 a0]
-
- PKHBT Temp1, ValueA0, ValueA1, LSL #16 ;// [d0 c0 b0 a0]
-
- STR Temp1, [pBuf], #8
- PKHTB Temp2, ValueA1, ValueA0, ASR #16 ;// [d2 c2 b2 a2]
- STR Temp2, [pBuf], #-4
-
- LDR Temp4, [pSrc0, #12]
- LDR Temp3, [pSrc0, #8]
- LDR Temp2, [pSrc0, #4]
- M_LDR Temp1, [pSrc0], srcStep0
-
- UQSUB16 Temp4, Temp4, r0x0fe00fe0
- UQSUB16 Temp3, Temp3, r0x0fe00fe0
- UQSUB16 Temp2, Temp2, r0x0fe00fe0
- UQSUB16 Temp1, Temp1, r0x0fe00fe0
-
- USAT16 Temp4, #13, Temp4
- USAT16 Temp3, #13, Temp3
- USAT16 Temp2, #13, Temp2
- USAT16 Temp1, #13, Temp1
-
- AND Temp4, r0x00ff00ff, Temp4, LSR #5
- AND Temp3, r0x00ff00ff, Temp3, LSR #5
- AND Temp2, r0x00ff00ff, Temp2, LSR #5
- AND Temp1, r0x00ff00ff, Temp1, LSR #5
- ORR ValueA1, Temp3, Temp4, LSL #8 ;// [d2 c2 d0 c0]
- ORR ValueA0, Temp1, Temp2, LSL #8 ;// [b2 a2 b0 a0]
-
- PKHBT Temp1, ValueA0, ValueA1, LSL #16 ;// [d0 c0 b0 a0]
- SUBS Count, Count, #1
- STR Temp1, [pBuf], #8
- PKHTB Temp2, ValueA1, ValueA0, ASR #16 ;// [d2 c2 b2 a2]
- STR Temp2, [pBuf], #4
-
- BGT LoopStart
-End2
- SUB pSrc0, pBuf, #32-8
- MOV srcStep0, #4
-
- M_END
-
- ENDIF
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe_s.s
deleted file mode 100644
index 523eace..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe_s.s
+++ /dev/null
@@ -1,310 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- EXPORT armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe
-
- M_VARIANTS ARM1136JS
-
-
-
- IF ARM1136JS
-
-
- M_ALLOC8 ppDstArgs, 8
- M_ALLOC8 pTempResult1, 8
- M_ALLOC8 pTempResult2, 8
- M_ALLOC4 ppSrc, 4
- M_ALLOC4 ppDst, 4
- M_ALLOC4 pDstStep, 4
- M_ALLOC4 pSrcStep, 4
- M_ALLOC4 pCounter, 4
-
- ;// Function header
- ;// Function:
- ;// armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe
- ;//
- ;// Implements diagonal interpolation for a block of size 4x4. Input and output should
- ;// be aligned.
- ;//
- ;// Registers used as input for this function
- ;// r0,r1,r2,r3, r8 where r0,r2 input pointer and r1,r3 step size, r8 intermediate-buf pointer
- ;//
- ;// Registers preserved for top level function
- ;// r0,r1,r2,r3,r4,r5,r6,r14
- ;//
- ;// Registers modified by the function
- ;// r7,r8,r9,r10,r11,r12
- ;//
- ;// Output registers
- ;// None. Function will preserve r0-r3
-
- M_START armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe, r6
-
-;// Declare input registers
-pSrc RN 0
-srcStep RN 1
-pDst RN 2
-dstStep RN 3
-
-;// Declare inner loop registers
-Acc0 RN 4
-Acc1 RN 5
-Acc2 RN 6
-Acc3 RN 7
-
-ValA RN 4
-ValB RN 5
-ValC RN 6
-ValD RN 7
-ValE RN 8
-ValF RN 9
-ValG RN 12
-ValH RN 14
-ValI RN 1
-
-Temp1 RN 3
-Temp2 RN 1
-Temp3 RN 12
-Temp4 RN 7
-Temp5 RN 5
-r0x0fe00fe0 RN 3 ;// [0 (16*255 - 16) 0 (16*255 - 16)]
-r0x00ff00ff RN 10 ;// [0 255 0 255] where 255 is offset
-Counter RN 11
-pInterBuf RN 8
-
-ValCA RN 8
-ValDB RN 9
-ValGE RN 10
-ValHF RN 11
-r0x00140001 RN 12
-r0x0014fffb RN 14
-
-r0x0001fc00 RN 11
-
-Accx RN 8
-Accy RN 9
-Temp6 RN 14
-
- M_STRD pDst, dstStep, ppDstArgs
-
- MOV pDst, pInterBuf
- MOV dstStep, #16
-
- ;// Set up counter of format, [0] [0] [1 (height)] [8 (width)]
- MOV Counter, #4
- M_STR dstStep, pDstStep
- M_STR srcStep, pSrcStep
- LDR r0x00ff00ff, =0x00ff00ff ;// [0 255 0 255] 255 is offset to avoid negative results
-
-HeightLoop
-NextTwoRowsLoop
- LDR ValD, [pSrc, srcStep] ;// Load row 1 [d1 c1 b1 a1]
- LDR ValA, [pSrc], #4 ;// Load row 0 [d0 c0 b0 a0]
- LDR ValH, [pSrc, srcStep] ;// Load [h1 g1 f1 e1]
- LDR ValE, [pSrc], #4 ;// Load [h0 g0 f0 e0]
- LDRB Temp2, [pSrc, srcStep] ;// Load row 1 [l1 k1 j1 i1]
- LDRB Temp1, [pSrc], #-8 ;// Load row 0 [l0 k0 j0 i0]
-
- PKHBT ValB, ValA, ValD, LSL #16 ;// [b1 a1 b0 a0]
- PKHTB ValD, ValD, ValA, ASR #16 ;// [d1 c1 d0 c0]
- UXTAB16 ValA, r0x00ff00ff, ValB ;// [00 a1 00 a0] + [0 255 0 255]
- UXTAB16 ValC, r0x00ff00ff, ValD ;// [00 c1 00 c0] + [0 255 0 255]
- PKHBT ValI, Temp1, Temp2, LSL #16 ;// [00 i1 00 i0]
- PKHBT ValF, ValE, ValH, LSL #16 ;// [f1 e1 f0 e0]
- PKHTB ValH, ValH, ValE, ASR #16 ;// [h1 g1 h0 g0]
- UXTAB16 ValE, r0x00ff00ff, ValF ;// [00 e1 00 e0] + [0 255 0 255]
-
- ;// Calculate Acc0
- ;// Acc0 = a - 5*b + 20*c + 20*d - 5*e + f
- UXTAB16 Temp1, ValC, ValD, ROR #8
- UXTAB16 Temp3, ValE, ValB, ROR #8
- RSB Temp1, Temp3, Temp1, LSL #2
- UXTAB16 Acc0, ValA, ValF, ROR #8
- ADD Temp1, Temp1, Temp1, LSL #2
- ADD Acc0, Acc0, Temp1
-
- ;// Calculate Acc1
- ;// Acc1 = b - 5*c + 20*d + 20*e - 5*f + g
- UXTAB16 Temp1, ValE, ValD, ROR #8
- UXTAB16 Temp3, ValC, ValF, ROR #8
- RSB Temp1, Temp3, Temp1, LSL #2
- UXTAB16 ValG, r0x00ff00ff, ValH ;// [00 g1 00 g0] + [0 255 0 255]
- ADD Temp1, Temp1, Temp1, LSL #2
- UXTAB16 Acc1, ValG, ValB, ROR #8
- ADD Acc1, Acc1, Temp1
-
- UXTAB16 Acc2, ValC, ValH, ROR #8
- ADD ValI, r0x00ff00ff, ValI ;// [00 i1 00 i0] + [0 255 0 255]
-
- ;// Calculate Acc2
- ;// Acc2 = c - 5*d + 20*e + 20*f - 5*g + h
- UXTAB16 Temp1, ValG, ValD, ROR #8
- UXTAB16 Acc3, ValI, ValD, ROR #8
- UXTAB16 Temp2, ValE, ValF, ROR #8
-
- RSB Temp1, Temp1, Temp2, LSL #2
- UXTAB16 Temp2, ValG, ValF, ROR #8
- ADD Temp1, Temp1, Temp1, LSL #2
- ADD Acc2, Acc2, Temp1
-
- ;// Calculate Acc3
- ;// Acc3 = d - 5*e + 20*f + 20*g - 5*h + i
- UXTAB16 Temp1, ValE, ValH, ROR #8
- RSB Temp1, Temp1, Temp2, LSL #2
- ADD Temp1, Temp1, Temp1, LSL #2
- ADD Acc3, Acc3, Temp1
-
- M_LDR dstStep, pDstStep
- M_LDR srcStep, pSrcStep
-
- ;// If Counter is even store Acc0-Acc3 in a temporary buffer
- ;// If Counter is off store Acc0-Acc3 and previous Acc0-Acc3 in a intermediate buf
- ANDS Temp3, Counter, #1
- BEQ NoProcessing
-
- ;// Packing previous and current Acc0-Acc3 values
- M_LDRD Accx, Accy, pTempResult1
- PKHBT Temp6, Accx, Acc0, LSL #16 ;//[0 a2 0 a0] = [0 a3 0 a2] [0 a1 0 a0]
- PKHTB Acc0, Acc0, Accx, ASR #16 ;//[0 a3 0 a1] = [0 a1 0 a0] [0 a3 0 a2]
- STR Acc0, [pDst, dstStep]
- STR Temp6, [pDst], #4
- PKHBT Temp6, Accy, Acc1, LSL #16 ;//[0 b2 0 b0] = [0 b3 0 b2] [0 b1 0 b0]
- PKHTB Acc1, Acc1, Accy, ASR #16 ;//[0 b3 0 b1] = [0 b1 0 b0] [0 b3 0 b2]
- M_LDRD Accx, Accy, pTempResult2
- STR Acc1, [pDst, dstStep]
- STR Temp6, [pDst], #4
-
- PKHBT Temp6, Accx, Acc2, LSL #16 ;//[0 c2 0 c0] = [0 c3 0 c2] [0 c1 0 c0]
- PKHTB Acc2, Acc2, Accx, ASR #16 ;//[0 c3 0 c1] = [0 c1 0 c0] [0 c3 0 c2]
- STR Acc2, [pDst, dstStep]
- STR Temp6, [pDst], #4
- PKHBT Temp6, Accy, Acc3, LSL #16 ;//[0 d2 0 d0] = [0 d3 0 d2] [0 d1 0 d0]
- PKHTB Acc3, Acc3, Accy, ASR #16 ;//[0 d3 0 d1] = [0 d1 0 d0] [0 d3 0 d2]
- STR Acc3, [pDst, dstStep]
- STR Temp6, [pDst], #-12
- ADD pDst, pDst, dstStep, LSL #1
- B AfterStore
-
-NoProcessing
- M_STRD Acc0, Acc1, pTempResult1
- M_STRD Acc2, Acc3, pTempResult2
-AfterStore
- SUBS Counter, Counter, #1 ;// Loop till height is 10
- ADD pSrc, pSrc, srcStep, LSL #1
- BPL HeightLoop
-
- STR Acc0, [pDst], #4 ;//[0 a1 0 a0]
- STR Acc1, [pDst], #4
- STR Acc2, [pDst], #4
- STR Acc3, [pDst], #-12
-
- ;//
- ;// Horizontal interpolation using multiplication
- ;//
-
- SUB pSrc, pDst, dstStep, LSL #2
- MOV srcStep, #16
- M_LDRD pDst, dstStep, ppDstArgs
-
- MOV Counter, #4
- LDR r0x0014fffb, =0x0014fffb
- LDR r0x00140001, =0x00140001
-
-HeightLoop1
- M_STR Counter, pCounter
-
- M_LDR ValCA, [pSrc], srcStep ;// Load [0 c 0 a]
- M_LDR ValDB, [pSrc], srcStep ;// Load [0 d 0 b]
- M_LDR ValGE, [pSrc], srcStep ;// Load [0 g 0 e]
- M_LDR ValHF, [pSrc], srcStep ;// Load [0 h 0 f]
-
-
- ;// Acc0 = smuad ([0 20 0 1], add([0 c 0 a] + [0 d 0 f])) - (5 * (b + e))
- ;// Acc1 = smuad ([0 20 0 1], add([0 e 0 g] + [0 d 0 b])) - (5 * (c + f))
- ;// Acc2 = smuad ([0 1 0 20], add([0 c 0 e] + [0 h 0 f])) - (5 * (d + g))
- ;// Acc3 = smuad ([0 20 0 1], add([0 d 0 f] + [0 i 0 g])) - (5 * (e + h))
-
- SMUAD Acc0, ValCA, r0x00140001 ;// Acc0 = [0 c 0 a] * [0 20 0 1]
- SMUAD Acc1, ValDB, r0x00140001 ;// Acc1 = [0 c 0 a] * [0 20 0 1]
- SMUADX Acc2, ValGE, r0x0014fffb ;// Acc2 = [0 g 0 e] * [0 20 0 -5]
- SMUAD Acc3, ValGE, r0x0014fffb ;// Acc3 = [0 g 0 e] * [0 20 0 -5]
-
- SMLAD Acc0, ValDB, r0x0014fffb, Acc0 ;// Acc0 += [0 d 0 b] * [0 20 0 -5]
- SMLADX Acc1, ValGE, r0x00140001, Acc1 ;// Acc1 += [0 g 0 e] * [0 20 0 1]
- SMLADX Acc2, ValHF, r0x00140001, Acc2 ;// Acc2 += [0 h 0 f] * [0 20 0 1]
- SMLADX Acc3, ValHF, r0x0014fffb, Acc3 ;// Acc3 += [0 h 0 f] * [0 20 0 -5]
-
- SMLABB Acc0, ValGE, r0x0014fffb, Acc0 ;// Acc0 += [0 g 0 e] * [0 0 0 -5]
- SMLATB Acc1, ValCA, r0x0014fffb, Acc1 ;// Acc1 += [0 d 0 b] * [0 0 0 -5]
- SMLATB Acc2, ValCA, r0x00140001, Acc2 ;// Acc2 += [0 c 0 a] * [0 0 0 1]
- SMLATB Acc3, ValDB, r0x00140001, Acc3 ;// Acc3 += [0 c 0 a] * [0 0 0 1]
-
- LDRH ValCA, [pSrc], #4 ;// 8 = srcStep - 16
- SMLABB Acc0, ValHF, r0x00140001, Acc0 ;// Acc0 += [0 h 0 f] * [0 0 0 1]
- SMLABB Acc1, ValHF, r0x0014fffb, Acc1 ;// Acc1 += [0 h 0 f] * [0 0 0 -5]
- SMLATB Acc2, ValDB, r0x0014fffb, Acc2 ;// Acc2 += [0 d 0 b] * [0 0 0 -5]
- SMLABB Acc3, ValCA, r0x00140001, Acc3 ;// Acc3 += [0 d 0 b] * [0 0 0 1]
-
- LDR r0x0001fc00, =0x0001fc00 ;// (0xff * 16 * 32) - 512
- SUB Acc0, Acc0, r0x0001fc00
- SUB Acc1, Acc1, r0x0001fc00
- SUB Acc2, Acc2, r0x0001fc00
- SUB Acc3, Acc3, r0x0001fc00
-
- USAT Acc0, #18, Acc0
- USAT Acc1, #18, Acc1
- USAT Acc2, #18, Acc2
- USAT Acc3, #18, Acc3
-
- MOV Acc0, Acc0, LSR #10
- M_STRB Acc0, [pDst], dstStep
- MOV Acc1, Acc1, LSR #10
- M_STRB Acc1, [pDst], dstStep
- MOV Acc2, Acc2, LSR #10
- M_STRB Acc2, [pDst], dstStep
- MOV Acc3, Acc3, LSR #10
- M_STRB Acc3, [pDst], dstStep
-
-
- M_LDR Counter, pCounter
- SUB pDst, pDst, dstStep, LSL #2
- SUB pSrc, pSrc, srcStep, LSL #2
- ADD pDst, pDst, #1
- SUBS Counter, Counter, #1
- BGT HeightLoop1
-End
- SUB pDst, pDst, #4
- SUB pSrc, pSrc, #16
-
- M_END
-
- ENDIF
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe_s.s
deleted file mode 100644
index 2e7c5c7..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe_s.s
+++ /dev/null
@@ -1,290 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- EXPORT armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe
-
- M_VARIANTS ARM1136JS
-
-
-
-
-
- IF ARM1136JS
-
- M_ALLOC8 ppDstArgs, 8
- M_ALLOC4 ppSrc, 4
- M_ALLOC4 ppDst, 4
- M_ALLOC4 pCounter, 4
-
- ;// Function header
- ;// Function:
- ;// armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe
- ;//
- ;// Implements diagonal interpolation for a block of size 4x4. Input and output should
- ;// be aligned.
- ;//
- ;// Registers used as input for this function
- ;// r0,r1,r2,r3, r8 where r0,r2 input pointer and r1,r3 step size, r8 intermediate-buf pointer
- ;//
- ;// Registers preserved for top level function
- ;// r0,r1,r2,r3,r4,r5,r6,r14
- ;//
- ;// Registers modified by the function
- ;// r7,r8,r9,r10,r11,r12
- ;//
- ;// Output registers
- ;// None. Function will preserve r0-r3
-
- M_START armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe, r6
-
-;// Declare input registers
-pSrc RN 0
-srcStep RN 1
-pDst RN 2
-dstStep RN 3
-
-;// Declare inner loop registers
-ValA RN 5
-ValA0 RN 4
-ValA1 RN 5
-ValAF0 RN 4
-ValAF1 RN 5
-
-ValB RN 11
-
-ValC RN 5
-ValC0 RN 4
-ValC1 RN 5
-ValCD0 RN 12
-ValCD1 RN 14
-ValCF0 RN 4
-ValCF1 RN 5
-
-ValD RN 10
-
-ValE RN 7
-ValE0 RN 6
-ValE1 RN 7
-ValEB0 RN 10
-ValEB1 RN 11
-ValED0 RN 6
-ValED1 RN 7
-
-ValF RN 10
-
-ValG RN 14
-ValG0 RN 12
-ValG1 RN 14
-ValGB0 RN 12
-ValGB1 RN 14
-
-Acc0 RN 4
-Acc1 RN 5
-Acc2 RN 6
-Acc3 RN 7
-
-Temp RN 7
-Step RN 6
-
-pInterBuf RN 8
-Counter RN 8
-r0x00ff00ff RN 9 ;// [0 255 0 255] where 255 is offset
-r0x0001fc00 RN 10 ;// [0 (16*255 - 16) 0 (16*255 - 16)]
-
-
-;// Declare inner loop registers
-ValCA RN 8
-ValDB RN 9
-ValGE RN 10
-ValHF RN 11
-r0x00140001 RN 12
-r0x0014fffb RN 14
-
-r0x00000200 RN 12
-r0x000000ff RN 12
-
- M_STRD pDst, dstStep, ppDstArgs
- MOV pDst, pInterBuf
- MOV dstStep, #24
-
- ;// Set up counter of format, [0] [0] [1 (height)] [8 (width)]
- MOV Counter, #1
- MOV Temp, #8
- ADD Counter, Temp, Counter, LSL #8 ;// [0 0 H W]
-
- LDR r0x00ff00ff, =0x00ff00ff ;// [0 255 0 255] 255 is offset to avoid negative results
-WidthLoop
- M_STR pSrc, ppSrc
- M_STR pDst, ppDst
-HeightLoop
-TwoRowsLoop
- M_LDR ValC, [pSrc], srcStep ;// Load [c3 c2 c1 c0]
- M_LDR ValD, [pSrc], srcStep ;// Load [d3 d2 d1 d0]
- M_LDR ValE, [pSrc], srcStep ;// Load [e3 e2 e1 e0]
- SUB pSrc, pSrc, srcStep, LSL #2
- UXTAB16 ValC0, r0x00ff00ff, ValC ;// [0 c2 0 c0] + [0 255 0 255]
- UXTAB16 ValC1, r0x00ff00ff, ValC, ROR #8 ;// [0 c3 0 c1] + [0 255 0 255]
- LDR ValB, [pSrc] ;// Load [b3 b2 b1 b0]
- UXTAB16 ValE0, r0x00ff00ff, ValE ;// [0 e2 0 e0] + [0 255 0 255]
- UXTAB16 ValE1, r0x00ff00ff, ValE, ROR #8 ;// [0 e3 0 e1] + [0 255 0 255]
- UXTAB16 ValCD0, ValC0, ValD ;// [0 c2 0 c0] + [0 255 0 255] + [0 d2 0 d0]
- UXTAB16 ValCD1, ValC1, ValD, ROR #8 ;// [0 c3 0 c1] + [0 255 0 255] + [0 d3 0 d1]
- UXTAB16 ValEB0, ValE0, ValB ;// [0 e2 0 e0] + [0 255 0 255] + [0 b2 0 b0]
- RSB ValCD0, ValEB0, ValCD0, LSL #2 ;// 4*(Off+C+D) - (Off+B+E)
-
- LDR ValD, [pSrc, srcStep, LSL #1] ;// Load [d3 d2 d1 d0]
- UXTAB16 ValEB1, ValE1, ValB, ROR #8 ;// [0 e3 0 e1] + [0 255 0 255] + [0 b3 0 b1]
- RSB ValCD1, ValEB1, ValCD1, LSL #2
-
- UXTAB16 ValED0, ValE0, ValD ;// [0 e2 0 e0] + [0 255 0 255] + [0 d2 0 d0]
- UXTAB16 ValED1, ValE1, ValD, ROR #8 ;// [0 e3 0 e1] + [0 255 0 255] + [0 d3 0 d1]
- LDR ValF, [pSrc, srcStep, LSL #2] ;// Load [f3 f2 f1 f0]
- M_LDR ValB, [pSrc], srcStep ;// Load [b3 b2 b1 b0]
- ADD ValCD0, ValCD0, ValCD0, LSL #2 ;// 5 * [4*(Off+C+D) - (Off+B+E)]
- ADD ValCD1, ValCD1, ValCD1, LSL #2
- UXTAB16 ValCF1, ValC1, ValF, ROR #8 ;// [0 c3 0 c1] + [0 255 0 255] + [0 f3 0 f1]
- UXTAB16 ValCF0, ValC0, ValF ;// [0 c2 0 c0] + [0 255 0 255] + [0 f2 0 f0]
- RSB ValED1, ValCF1, ValED1, LSL #2
-
- SUB ValA, pSrc, srcStep, LSL #1
- LDR ValA, [ValA] ;// Load [a3 a2 a1 a0]
- RSB ValED0, ValCF0, ValED0, LSL #2 ;// 4*(Off+E+D) - (Off+C+F)
- ADD ValED1, ValED1, ValED1, LSL #2
- ADD ValED0, ValED0, ValED0, LSL #2 ;// 5 * [4*(Off+E+D) - (Off+C+F)]
- UXTAB16 ValA0, r0x00ff00ff, ValA ;// [0 a2 0 a0] + [0 255 0 255]
- UXTAB16 ValA1, r0x00ff00ff, ValA, ROR #8 ;// [0 a3 0 a1] + [0 255 0 255]
- UXTAB16 ValAF0, ValA0, ValF ;// [0 a2 0 a0] + [0 255 0 255] + [0 f2 0 f0]
- UXTAB16 ValAF1, ValA1, ValF, ROR #8 ;// [0 a3 0 a1] + [0 255 0 255] + [0 f3 0 f1]
- ADD Acc1, ValCD1, ValAF1
-
- LDR ValG, [pSrc, srcStep, LSL #2] ;// Load [g3 g2 g1 g0]
- ADD Acc0, ValCD0, ValAF0 ;// Acc0 = 16*Off + (A+F) + 20*(C+D) - 5*(B+E)
- STR Acc1, [pDst, #4] ;// Store result & adjust pointer
- M_STR Acc0, [pDst], dstStep ;// Store result & adjust pointer
- UXTAB16 ValG0, r0x00ff00ff, ValG ;// [0 g2 0 g0] + [0 255 0 255]
- UXTAB16 ValG1, r0x00ff00ff, ValG, ROR #8 ;// [0 g3 0 g1] + [0 255 0 255]
- UXTAB16 ValGB0, ValG0, ValB ;// [0 g2 0 g0] + [0 255 0 255] + [0 b2 0 b0]
- UXTAB16 ValGB1, ValG1, ValB, ROR #8 ;// [0 g3 0 g1] + [0 255 0 255] + [0 b3 0 b1]
- ADD Acc2, ValED0, ValGB0 ;// Acc2 = 16*Off + (B+G) + 20*(D+E) - 5*(C+F)
- ADD Acc3, ValED1, ValGB1
-
- STR Acc3, [pDst, #4] ;// Store result & adjust pointer
- M_STR Acc2, [pDst], dstStep ;// Store result & adjust pointer
-
- SUBS Counter, Counter, #1 << 8 ;// Loop till height is 10
- ADD pSrc, pSrc, srcStep, LSL #1
- BPL HeightLoop
-
- M_LDR pSrc, ppSrc
- M_LDR pDst, ppDst
- ADDS Counter, Counter, #(1 << 8)-4 ;// Loop till width is 12
- ADD pSrc, pSrc, #4
- ADD pDst, pDst, #8
- ADD Counter, Counter, #1<<8
- BPL WidthLoop
-
- ;//
- ;// Horizontal interpolation using multiplication
- ;//
-
- SUB pSrc, pDst, #24
- MOV srcStep, #24
- M_LDRD pDst, dstStep, ppDstArgs
-
- MOV Counter, #4
- LDR r0x0014fffb, =0x0014fffb
- LDR r0x00140001, =0x00140001
-
-HeightLoop1
- M_STR Counter, pCounter
-
-
- LDR ValCA, [pSrc], #4 ;// Load [0 c 0 a]
- LDR ValDB, [pSrc], #4 ;// Load [0 d 0 b]
- LDR ValGE, [pSrc], #4 ;// Load [0 g 0 e]
- LDR ValHF, [pSrc], #4 ;// Load [0 h 0 f]
-
- ;// Acc0 = smuad ([0 20 0 1], add([0 c 0 a] + [0 d 0 f])) - (5 * (b + e))
- ;// Acc1 = smuad ([0 20 0 1], add([0 e 0 g] + [0 d 0 b])) - (5 * (c + f))
- ;// Acc2 = smuad ([0 1 0 20], add([0 c 0 e] + [0 h 0 f])) - (5 * (d + g))
- ;// Acc3 = smuad ([0 20 0 1], add([0 d 0 f] + [0 i 0 g])) - (5 * (e + h))
- SMUAD Acc0, ValCA, r0x00140001 ;// Acc0 = [0 c 0 a] * [0 20 0 1]
- SMUAD Acc1, ValDB, r0x00140001 ;// Acc1 = [0 c 0 a] * [0 20 0 1]
- SMUADX Acc2, ValGE, r0x0014fffb ;// Acc2 = [0 g 0 e] * [0 20 0 -5]
- SMUAD Acc3, ValGE, r0x0014fffb ;// Acc3 = [0 g 0 e] * [0 20 0 -5]
-
- SMLAD Acc0, ValDB, r0x0014fffb, Acc0 ;// Acc0 += [0 d 0 b] * [0 20 0 -5]
- SMLADX Acc1, ValGE, r0x00140001, Acc1 ;// Acc1 += [0 g 0 e] * [0 20 0 1]
- SMLADX Acc2, ValHF, r0x00140001, Acc2 ;// Acc2 += [0 h 0 f] * [0 20 0 1]
- SMLADX Acc3, ValHF, r0x0014fffb, Acc3 ;// Acc3 += [0 h 0 f] * [0 20 0 -5]
-
- SMLABB Acc0, ValGE, r0x0014fffb, Acc0 ;// Acc0 += [0 g 0 e] * [0 0 0 -5]
- SMLATB Acc1, ValCA, r0x0014fffb, Acc1 ;// Acc1 += [0 d 0 b] * [0 0 0 -5]
- SMLATB Acc2, ValCA, r0x00140001, Acc2 ;// Acc2 += [0 c 0 a] * [0 0 0 1]
- SMLATB Acc3, ValDB, r0x00140001, Acc3 ;// Acc3 += [0 c 0 a] * [0 0 0 1]
-
- LDRH ValCA, [pSrc], #8 ;// 8 = srcStep - 16
- SMLABB Acc0, ValHF, r0x00140001, Acc0 ;// Acc0 += [0 h 0 f] * [0 0 0 1]
- SMLABB Acc1, ValHF, r0x0014fffb, Acc1 ;// Acc1 += [0 h 0 f] * [0 0 0 -5]
- SMLATB Acc2, ValDB, r0x0014fffb, Acc2 ;// Acc2 += [0 d 0 b] * [0 0 0 -5]
- SMLABB Acc3, ValCA, r0x00140001, Acc3 ;// Acc3 += [0 d 0 b] * [0 0 0 1]
-
- LDR r0x0001fc00, =0x0001fc00 ;// (0xff * 16 * 32) - 512
- SUB Acc0, Acc0, r0x0001fc00
- SUB Acc1, Acc1, r0x0001fc00
- SUB Acc2, Acc2, r0x0001fc00
- SUB Acc3, Acc3, r0x0001fc00
-
- USAT Acc0, #18, Acc0
- USAT Acc1, #18, Acc1
- USAT Acc2, #18, Acc2
- USAT Acc3, #18, Acc3
-
- MOV Acc0, Acc0, LSR #10
- MOV Acc1, Acc1, LSR #10
- MOV Acc2, Acc2, LSR #10
- MOV Acc3, Acc3, LSR #10
-
- M_LDR Counter, pCounter
- ORR Acc0, Acc0, Acc1, LSL #8
- ORR Acc2, Acc2, Acc3, LSL #8
- SUBS Counter, Counter, #1
- ORR Acc0, Acc0, Acc2, LSL #16
- M_STR Acc0, [pDst], dstStep
- BGT HeightLoop1
-End
- SUB pDst, pDst, dstStep, LSL #2
- SUB pSrc, pSrc, srcStep, LSL #2
-
- M_END
-
- ENDIF
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe_s.s
deleted file mode 100644
index 81af75a..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe_s.s
+++ /dev/null
@@ -1,253 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
- EXPORT armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
-
-DEBUG_ON SETL {FALSE}
-
-
- IF ARM1136JS
-
-;// Function:
-;// armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
-;//
-;// Implements horizontal interpolation for a block of size 4x4. Input and output should
-;// be aligned.
-;//
-;// Registers used as input for this function
-;// r0,r1,r2,r3 where r0,r2 input pointer and r1,r3 corresponding step size
-;//
-;// Registers preserved for top level function
-;// r0,r1,r2,r3,r4,r5,r6,r14
-;//
-;// Registers modified by the function
-;// r7,r8,r9,r10,r11,r12
-;//
-;// Output registers
-;// None. Function will preserve r0-r3
-
-
-;// Declare input registers
-pSrc RN 0
-srcStep RN 1
-pDst RN 2
-dstStep RN 3
-
-;// Declare inner loop registers
-Acc0 RN 4
-Acc1 RN 5
-Acc2 RN 6
-Acc3 RN 7
-
-ValA RN 4
-ValB RN 5
-ValC RN 6
-ValD RN 7
-ValE RN 8
-ValF RN 9
-ValG RN 12
-ValH RN 14
-ValI RN 1
-
-Temp1 RN 3
-Temp2 RN 1
-Temp3 RN 12
-Temp4 RN 7
-Temp5 RN 5
-r0x0fe00fe0 RN 3 ;// [0 (16*255 - 16) 0 (16*255 - 16)]
-r0x00ff00ff RN 10 ;// [0 255 0 255] where 255 is offset
-Counter RN 11
-
-Height RN 3
-
- M_ALLOC4 pDstStep, 4
- M_ALLOC4 pSrcStep, 4
-
- ;// Function header
- M_START armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe, r6
-
- MOV Counter, #2
- M_STR dstStep, pDstStep
- M_STR srcStep, pSrcStep
- LDR r0x00ff00ff, =0x00ff00ff ;// [0 255 0 255] 255 is offset to avoid negative results
-
-NextTwoRowsLoop
- LDR ValD, [pSrc, srcStep] ;// Load row 1 [d1 c1 b1 a1]
- LDR ValA, [pSrc], #4 ;// Load row 0 [d0 c0 b0 a0]
- LDR ValH, [pSrc, srcStep] ;// Load [h1 g1 f1 e1]
- LDR ValE, [pSrc], #4 ;// Load [h0 g0 f0 e0]
- LDRB Temp2, [pSrc, srcStep] ;// Load row 1 [l1 k1 j1 i1]
- LDRB Temp1, [pSrc], #-8 ;// Load row 0 [l0 k0 j0 i0]
-
- PKHBT ValB, ValA, ValD, LSL #16 ;// [b1 a1 b0 a0]
- PKHTB ValD, ValD, ValA, ASR #16 ;// [d1 c1 d0 c0]
- UXTAB16 ValA, r0x00ff00ff, ValB ;// [00 a1 00 a0] + [0 255 0 255]
- UXTAB16 ValC, r0x00ff00ff, ValD ;// [00 c1 00 c0] + [0 255 0 255]
- PKHBT ValI, Temp1, Temp2, LSL #16 ;// [00 i1 00 i0]
- PKHBT ValF, ValE, ValH, LSL #16 ;// [f1 e1 f0 e0]
- PKHTB ValH, ValH, ValE, ASR #16 ;// [h1 g1 h0 g0]
- UXTAB16 ValE, r0x00ff00ff, ValF ;// [00 e1 00 e0] + [0 255 0 255]
-
- ;// Calculate Acc0
- ;// Acc0 = a - 5*b + 20*c + 20*d - 5*e + f
- UXTAB16 Temp1, ValC, ValD, ROR #8
- UXTAB16 Temp3, ValE, ValB, ROR #8
- RSB Temp1, Temp3, Temp1, LSL #2
- UXTAB16 Acc0, ValA, ValF, ROR #8
- ADD Temp1, Temp1, Temp1, LSL #2
- ADD Acc0, Acc0, Temp1
-
- ;// Calculate Acc1
- ;// Acc1 = b - 5*c + 20*d + 20*e - 5*f + g
- UXTAB16 Temp1, ValE, ValD, ROR #8
- UXTAB16 Temp3, ValC, ValF, ROR #8
- RSB Temp1, Temp3, Temp1, LSL #2
- UXTAB16 ValG, r0x00ff00ff, ValH ;// [00 g1 00 g0] + [0 255 0 255]
- ADD Temp1, Temp1, Temp1, LSL #2
- UXTAB16 Acc1, ValG, ValB, ROR #8
- ADD Acc1, Acc1, Temp1
-
- LDR r0x0fe00fe0, =0x0fe00fe0 ;// 0x0fe00fe0 = (16 * Offset) - 16 where Offset is 255
- UXTAB16 Acc2, ValC, ValH, ROR #8
- ADD ValI, r0x00ff00ff, ValI ;// [00 i1 00 i0] + [0 255 0 255]
- UQSUB16 Acc0, Acc0, r0x0fe00fe0
- UQSUB16 Acc1, Acc1, r0x0fe00fe0
- USAT16 Acc0, #13, Acc0
- USAT16 Acc1, #13, Acc1
-
- ;// Calculate Acc2
- ;// Acc2 = c - 5*d + 20*e + 20*f - 5*g + h
- UXTAB16 Temp1, ValG, ValD, ROR #8
- UXTAB16 Acc3, ValI, ValD, ROR #8
- UXTAB16 Temp2, ValE, ValF, ROR #8
- AND Acc1, r0x00ff00ff, Acc1, LSR #5
- AND Acc0, r0x00ff00ff, Acc0, LSR #5
- ORR Acc0, Acc0, Acc1, LSL #8
- RSB Temp5, Temp1, Temp2, LSL #2
- UXTAB16 Temp2, ValG, ValF, ROR #8
- ADD Temp5, Temp5, Temp5, LSL #2
- ADD Acc2, Acc2, Temp5
-
- ;// Calculate Acc3
- ;// Acc3 = d - 5*e + 20*f + 20*g - 5*h + i
- UXTAB16 Temp5, ValE, ValH, ROR #8
- RSB Temp5, Temp5, Temp2, LSL #2
- LDR r0x0fe00fe0, =0x0fe00fe0
- ADD Temp5, Temp5, Temp5, LSL #2
- ADD Acc3, Acc3, Temp5
-
- UQSUB16 Acc3, Acc3, r0x0fe00fe0
- UQSUB16 Acc2, Acc2, r0x0fe00fe0
- USAT16 Acc3, #13, Acc3
- USAT16 Acc2, #13, Acc2
-
- M_LDR dstStep, pDstStep
- AND Acc3, r0x00ff00ff, Acc3, LSR #5
- AND Acc2, r0x00ff00ff, Acc2, LSR #5
- ORR Acc2, Acc2, Acc3, LSL #8
-
- SUBS Counter, Counter, #1
- M_LDR srcStep, pSrcStep
- PKHBT Acc1, Acc0, Acc2, LSL #16
- M_STR Acc1, [pDst], dstStep ;// Store result1
- PKHTB Acc2, Acc2, Acc0, ASR #16
- M_STR Acc2, [pDst], dstStep ;// Store result2
- ADD pSrc, pSrc, srcStep, LSL #1
-
- BGT NextTwoRowsLoop
-End
- SUB pDst, pDst, dstStep, LSL #2
- SUB pSrc, pSrc, srcStep, LSL #2
-
- M_END
-
- ENDIF
-
- END
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe_s.s
deleted file mode 100644
index 906cbf3..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe_s.s
+++ /dev/null
@@ -1,199 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
- EXPORT armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
-
-
-
- IF ARM1136JS
-
- ;// Function header
-
- ;// Function:
- ;// armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- ;//
- ;// Implements vertical interpolation for a block of size 4x4. Input and output should
- ;// be aligned.
- ;//
- ;// Registers used as input for this function
- ;// r0,r1,r2,r3 where r0,r2 input pointer and r1,r3 corresponding step size
- ;//
- ;// Registers preserved for top level function
- ;// r0,r1,r2,r3,r4,r5,r6,r14
- ;//
- ;// Registers modified by the function
- ;// r7,r8,r9,r10,r11,r12
- ;//
- ;// Output registers
- ;// None. Function will preserve r0-r3
- M_START armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe, r6
-
-;// Declare input registers
-pSrc RN 0
-srcStep RN 1
-pDst RN 2
-dstStep RN 3
-
-;// Declare inner loop registers
-ValA RN 5
-ValA0 RN 4
-ValA1 RN 5
-ValAF0 RN 4
-ValAF1 RN 5
-
-ValB RN 11
-
-ValC RN 5
-ValC0 RN 4
-ValC1 RN 5
-ValCD0 RN 12
-ValCD1 RN 14
-ValCF0 RN 4
-ValCF1 RN 5
-
-ValD RN 10
-
-ValE RN 7
-ValE0 RN 6
-ValE1 RN 7
-ValEB0 RN 10
-ValEB1 RN 11
-ValED0 RN 6
-ValED1 RN 7
-
-ValF RN 10
-
-ValG RN 14
-ValG0 RN 12
-ValG1 RN 14
-ValGB0 RN 12
-ValGB1 RN 14
-
-Acc0 RN 4
-Acc1 RN 5
-Acc2 RN 6
-Acc3 RN 7
-
-Temp RN 7
-Height RN 3
-Step RN 6
-
-Counter RN 8
-r0x00ff00ff RN 9 ;// [0 255 0 255] where 255 is offset
-r0x0fe00fe0 RN 10 ;// [0 (16*255 - 16) 0 (16*255 - 16)]
-
-
- LDR r0x00ff00ff, =0x00ff00ff ;// [0 255 0 255] 255 is offset to avoid negative results
- MOV Counter, #2
-
-TwoRowsLoop
- M_LDR ValC, [pSrc], srcStep ;// Load [c3 c2 c1 c0]
- M_LDR ValD, [pSrc], srcStep ;// Load [d3 d2 d1 d0]
- M_LDR ValE, [pSrc], srcStep ;// Load [e3 e2 e1 e0]
- SUB pSrc, pSrc, srcStep, LSL #2
- LDR ValB, [pSrc] ;// Load [b3 b2 b1 b0]
- UXTAB16 ValC0, r0x00ff00ff, ValC ;// [0 c2 0 c0] + [0 255 0 255]
- UXTAB16 ValC1, r0x00ff00ff, ValC, ROR #8 ;// [0 c3 0 c1] + [0 255 0 255]
-
- UXTAB16 ValE0, r0x00ff00ff, ValE ;// [0 e2 0 e0] + [0 255 0 255]
- UXTAB16 ValE1, r0x00ff00ff, ValE, ROR #8 ;// [0 e3 0 e1] + [0 255 0 255]
- UXTAB16 ValCD0, ValC0, ValD ;// [0 c2 0 c0] + [0 255 0 255] + [0 d2 0 d0]
- UXTAB16 ValCD1, ValC1, ValD, ROR #8 ;// [0 c3 0 c1] + [0 255 0 255] + [0 d3 0 d1]
- UXTAB16 ValEB0, ValE0, ValB ;// [0 e2 0 e0] + [0 255 0 255] + [0 b2 0 b0]
- RSB ValCD0, ValEB0, ValCD0, LSL #2 ;// 4*(Off+C+D) - (Off+B+E)
-
- LDR ValD, [pSrc, srcStep, LSL #1] ;// Load [d3 d2 d1 d0]
- UXTAB16 ValEB1, ValE1, ValB, ROR #8 ;// [0 e3 0 e1] + [0 255 0 255] + [0 b3 0 b1]
- RSB ValCD1, ValEB1, ValCD1, LSL #2
- ;// One cycle stall
- UXTAB16 ValED0, ValE0, ValD ;// [0 e2 0 e0] + [0 255 0 255] + [0 d2 0 d0]
- UXTAB16 ValED1, ValE1, ValD, ROR #8 ;// [0 e3 0 e1] + [0 255 0 255] + [0 d3 0 d1]
-
- LDR ValF, [pSrc, srcStep, LSL #2] ;// Load [f3 f2 f1 f0]
- M_LDR ValB, [pSrc], srcStep ;// Load [b3 b2 b1 b0]
- ADD ValCD0, ValCD0, ValCD0, LSL #2 ;// 5 * [4*(Off+C+D) - (Off+B+E)]
- ADD ValCD1, ValCD1, ValCD1, LSL #2
- UXTAB16 ValCF1, ValC1, ValF, ROR #8 ;// [0 c3 0 c1] + [0 255 0 255] + [0 f3 0 f1]
- UXTAB16 ValCF0, ValC0, ValF ;// [0 c2 0 c0] + [0 255 0 255] + [0 f2 0 f0]
- RSB ValED1, ValCF1, ValED1, LSL #2
-
- SUB ValA, pSrc, srcStep, LSL #1
- LDR ValA, [ValA] ;// Load [a3 a2 a1 a0]
- RSB ValED0, ValCF0, ValED0, LSL #2 ;// 4*(Off+E+D) - (Off+C+F)
- ADD ValED1, ValED1, ValED1, LSL #2
- ADD ValED0, ValED0, ValED0, LSL #2 ;// 5 * [4*(Off+E+D) - (Off+C+F)]
- UXTAB16 ValA0, r0x00ff00ff, ValA ;// [0 a2 0 a0] + [0 255 0 255]
- UXTAB16 ValA1, r0x00ff00ff, ValA, ROR #8 ;// [0 a3 0 a1] + [0 255 0 255]
- UXTAB16 ValAF0, ValA0, ValF ;// [0 a2 0 a0] + [0 255 0 255] + [0 f2 0 f0]
- UXTAB16 ValAF1, ValA1, ValF, ROR #8 ;// [0 a3 0 a1] + [0 255 0 255] + [0 f3 0 f1]
-
- LDR r0x0fe00fe0, =0x0fe00fe0 ;// [0 255 0 255] 255 is offset to avoid negative results
- ADD Acc1, ValCD1, ValAF1
-
- LDR ValG, [pSrc, srcStep, LSL #2] ;// Load [g3 g2 g1 g0]
- ADD Acc0, ValCD0, ValAF0 ;// Acc0 = 16*Off + (A+F) + 20*(C+D) - 5*(B+E)
- UQSUB16 Acc1, Acc1, r0x0fe00fe0 ;// Acc1 -= (16*Off - 16)
- UQSUB16 Acc0, Acc0, r0x0fe00fe0
- UXTAB16 ValG0, r0x00ff00ff, ValG ;// [0 g2 0 g0] + [0 255 0 255]
- UXTAB16 ValG1, r0x00ff00ff, ValG, ROR #8 ;// [0 g3 0 g1] + [0 255 0 255]
- UXTAB16 ValGB0, ValG0, ValB ;// [0 g2 0 g0] + [0 255 0 255] + [0 b2 0 b0]
- UXTAB16 ValGB1, ValG1, ValB, ROR #8 ;// [0 g3 0 g1] + [0 255 0 255] + [0 b3 0 b1]
- ADD Acc2, ValED0, ValGB0 ;// Acc2 = 16*Off + (B+G) + 20*(D+E) - 5*(C+F)
- ADD Acc3, ValED1, ValGB1
- UQSUB16 Acc3, Acc3, r0x0fe00fe0 ;// Acc3 -= (16*Off - 16)
- UQSUB16 Acc2, Acc2, r0x0fe00fe0
- USAT16 Acc1, #13, Acc1 ;// Saturate to 8+5 = 13 bits
- USAT16 Acc0, #13, Acc0
- USAT16 Acc3, #13, Acc3
- USAT16 Acc2, #13, Acc2
- AND Acc1, r0x00ff00ff, Acc1, LSR #5 ;// [0 a3 0 a1]
- AND Acc0, r0x00ff00ff, Acc0, LSR #5 ;// [0 a2 0 a0]
- ORR Acc0, Acc0, Acc1, LSL #8 ;// [a3 a2 a1 a0]
- AND Acc3, r0x00ff00ff, Acc3, LSR #5 ;// [0 b3 0 b1]
- AND Acc2, r0x00ff00ff, Acc2, LSR #5 ;// [0 b2 0 b0]
-
- M_STR Acc0, [pDst], dstStep ;// Store result & adjust pointer
- ORR Acc2, Acc2, Acc3, LSL #8 ;// [b3 b2 b1 b0]
- M_STR Acc2, [pDst], dstStep ;// Store result & adjust pointer
- ADD pSrc, pSrc, srcStep, LSL #1
-
- SUBS Counter, Counter, #1
- BGT TwoRowsLoop
-End
- SUB pDst, pDst, dstStep, LSL #2
- SUB pSrc, pSrc, srcStep, LSL #2
-
- M_END
-
- ENDIF
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_Interpolate_Chroma_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_Interpolate_Chroma_s.s
deleted file mode 100644
index 35bf67c..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_Interpolate_Chroma_s.s
+++ /dev/null
@@ -1,287 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_Interpolate_Chroma_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
- IF ARM1136JS
-
-;// input registers
-
-pSrc RN 0
-iSrcStep RN 1
-pDst RN 2
-iDstStep RN 3
-iWidth RN 4
-iHeight RN 5
-dx RN 6
-dy RN 7
-
-
-;// local variable registers
-temp RN 11
-r0x20 RN 12
-tmp0x20 RN 14
-return RN 0
-dxPlusdy RN 10
-EightMinusdx RN 8
-EightMinusdy RN 9
-dxEightMinusdx RN 8
-BACoeff RN 6
-DCCoeff RN 7
-
-iDstStepx2MinusWidth RN 8
-iSrcStepx2MinusWidth RN 9
-iSrcStep1 RN 10
-
-pSrc1 RN 1
-pSrc2 RN 8
-pDst1 RN 8
-pDst2 RN 12
-
-pix00 RN 8
-pix01 RN 9
-pix10 RN 10
-pix11 RN 11
-
-Out0100 RN 8
-Out1110 RN 10
-
-x00 RN 8
-x01 RN 10
-x02 RN 12
-x10 RN 9
-x11 RN 11
-x12 RN 14
-x20 RN 10
-x21 RN 12
-x22 RN 14
-
-x01x00 RN 8
-x02x01 RN 10
-x11x10 RN 9
-x12x11 RN 11
-x21x20 RN 10
-x22x21 RN 12
-
-OutRow00 RN 12
-OutRow01 RN 14
-OutRow10 RN 10
-OutRow11 RN 12
-
-OutRow0100 RN 12
-OutRow1110 RN 12
-
-;//-----------------------------------------------------------------------------------------------
-;// armVCM4P10_Interpolate_Chroma_asm starts
-;//-----------------------------------------------------------------------------------------------
-
- ;// Write function header
- M_START armVCM4P10_Interpolate_Chroma, r11
-
- ;// Define stack arguments
- M_ARG Width, 4
- M_ARG Height, 4
- M_ARG Dx, 4
- M_ARG Dy, 4
-
- ;// Load argument from the stack
- ;// M_STALL ARM1136JS=4
-
- M_LDR iWidth, Width
- M_LDR iHeight, Height
- M_LDR dx, Dx
- M_LDR dy, Dy
-
- ;// EightMinusdx = 8 - dx
- ;// EightMinusdy = 8 - dy
-
- ;// ACoeff = EightMinusdx * EightMinusdy
- ;// BCoeff = dx * EightMinusdy
- ;// CCoeff = EightMinusdx * dy
- ;// DCoeff = dx * dy
-
- ADD pSrc1, pSrc, iSrcStep
- SUB temp, iWidth, #1
- RSB EightMinusdx, dx, #8
- RSB EightMinusdy, dy, #8
- CMN dx,dy
- ADD dxEightMinusdx, EightMinusdx, dx, LSL #16
- ORR iWidth, iWidth, temp, LSL #16
-
- ;// Packed Coeffs.
-
- MUL BACoeff, dxEightMinusdx, EightMinusdy
- MUL DCCoeff, dxEightMinusdx, dy
-
-
- ;// Checking either of dx and dy being non-zero
-
- BEQ MVIsZero
-
-;// Pixel layout:
-;//
-;// x00 x01 x02
-;// x10 x11 x12
-;// x20 x21 x22
-
-;// If fractionl mv is not (0, 0)
-
-OuterLoopMVIsNotZero
-
-InnerLoopMVIsNotZero
-
- LDRB x00, [pSrc, #+0]
- LDRB x10, [pSrc1, #+0]
- LDRB x01, [pSrc, #+1]
- LDRB x11, [pSrc1, #+1]
- LDRB x02, [pSrc, #+2]!
- LDRB x12, [pSrc1, #+2]!
-
- ORR x01x00, x00, x01, LSL #16
- ;// M_STALL ARM1136JS=1
- ORR x02x01, x01, x02, LSL #16
- MOV r0x20, #32
- ORR x11x10, x10, x11, LSL #16
- ORR x12x11, x11, x12, LSL #16
-
- SMLAD x01x00, x01x00, BACoeff, r0x20
- SMLAD x02x01, x02x01, BACoeff, r0x20
-
- ;// iWidth packed with MSB (top 16 bits)
- ;// as inner loop counter value i.e
- ;// (iWidth -1) and LSB (lower 16 bits)
- ;// as original width
-
- SUBS iWidth, iWidth, #1<<17
-
- SMLAD OutRow00, x11x10, DCCoeff, x01x00
- SMLAD OutRow01, x12x11, DCCoeff, x02x01
-
- RSB pSrc2, pSrc, pSrc1, LSL #1
-
- MOV OutRow00, OutRow00, LSR #6
- MOV OutRow01, OutRow01, LSR #6
-
- LDRB x20,[pSrc2, #-2]
-
- ORR OutRow0100, OutRow00, OutRow01, LSL #8
- STRH OutRow0100, [pDst], #2
-
- LDRB x21,[pSrc2, #-1]
- LDRB x22,[pSrc2, #+0]
-
- ADD pDst1, pDst, iDstStep
-
- ;// M_STALL ARM1136JS=1
-
- ORR x21x20, x20, x21, LSL #16
- ORR x22x21, x21, x22, LSL #16
-
- MOV tmp0x20, #32
-
- ;// Reusing the packed data x11x10 and x12x11
-
- SMLAD x11x10, x11x10, BACoeff, tmp0x20
- SMLAD x12x11, x12x11, BACoeff, tmp0x20
- SMLAD OutRow10, x21x20, DCCoeff, x11x10
- SMLAD OutRow11, x22x21, DCCoeff, x12x11
-
- MOV OutRow10, OutRow10, LSR #6
- MOV OutRow11, OutRow11, LSR #6
-
- ;// M_STALL ARM1136JS=1
-
- ORR OutRow1110, OutRow10, OutRow11, LSL #8
-
- STRH OutRow1110, [pDst1, #-2]
-
- BGT InnerLoopMVIsNotZero
-
- SUBS iHeight, iHeight, #2
- ADD iWidth, iWidth, #1<<16
- RSB iDstStepx2MinusWidth, iWidth, iDstStep, LSL #1
- SUB iSrcStep1, pSrc1, pSrc
- SUB temp, iWidth, #1
- RSB iSrcStepx2MinusWidth, iWidth, iSrcStep1, LSL #1
- ADD pDst, pDst, iDstStepx2MinusWidth
- ADD pSrc1, pSrc1, iSrcStepx2MinusWidth
- ADD pSrc, pSrc, iSrcStepx2MinusWidth
- ORR iWidth, iWidth, temp, LSL #16
- BGT OuterLoopMVIsNotZero
- MOV return, #OMX_Sts_NoErr
- M_EXIT
-
-;// If fractionl mv is (0, 0)
-
-MVIsZero
- ;// M_STALL ARM1136JS=4
-OuterLoopMVIsZero
-
-InnerLoopMVIsZero
-
- LDRB pix00, [pSrc], #+1
- LDRB pix01, [pSrc], #+1
- LDRB pix10, [pSrc1], #+1
- LDRB pix11, [pSrc1], #+1
-
- ADD pDst2, pDst, iDstStep
- SUBS iWidth, iWidth, #1<<17
-
- ORR Out0100, pix00, pix01, LSL #8
- ORR Out1110, pix10, pix11, LSL #8
-
- STRH Out0100, [pDst], #2
- STRH Out1110, [pDst2], #2
-
- BGT InnerLoopMVIsZero
-
- SUBS iHeight, iHeight, #2
- ADD iWidth, iWidth, #1<<16
- RSB iDstStepx2MinusWidth, iWidth, iDstStep, LSL #1
- SUB iSrcStep1, pSrc1, pSrc
- SUB temp, iWidth, #1
- RSB iSrcStepx2MinusWidth, iWidth, iSrcStep1, LSL #1
- ADD pDst, pDst, iDstStepx2MinusWidth
- ADD pSrc1, pSrc1, iSrcStepx2MinusWidth
- ADD pSrc, pSrc, iSrcStepx2MinusWidth
- ORR iWidth, iWidth, temp, LSL #16
- BGT OuterLoopMVIsZero
- MOV return, #OMX_Sts_NoErr
- M_END
-
- ENDIF ;// ARM1136JS
-
-
- END
-
-;//-----------------------------------------------------------------------------------------------
-;// armVCM4P10_Interpolate_Chroma_asm ends
-;//-----------------------------------------------------------------------------------------------
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_QuantTables_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_QuantTables_s.s
deleted file mode 100644
index 938c719..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_QuantTables_s.s
+++ /dev/null
@@ -1,88 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_QuantTables_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;// Description:
-;// This file contains quantization tables
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
-
- EXPORT armVCM4P10_MFMatrixQPModTable
- EXPORT armVCM4P10_QPDivIntraTable
- EXPORT armVCM4P10_QPDivPlusOneTable
-
-;//--------------------------------------------------------------
-;// This table contains armVCM4P10_MFMatrix [iQP % 6][0] entires,
-;// for values of iQP from 0 to 51 (inclusive).
-;//--------------------------------------------------------------
-
- M_TABLE armVCM4P10_MFMatrixQPModTable
- DCW 13107, 11916, 10082, 9362, 8192, 7282
- DCW 13107, 11916, 10082, 9362, 8192, 7282
- DCW 13107, 11916, 10082, 9362, 8192, 7282
- DCW 13107, 11916, 10082, 9362, 8192, 7282
- DCW 13107, 11916, 10082, 9362, 8192, 7282
- DCW 13107, 11916, 10082, 9362, 8192, 7282
- DCW 13107, 11916, 10082, 9362, 8192, 7282
- DCW 13107, 11916, 10082, 9362, 8192, 7282
- DCW 13107, 11916, 10082, 9362, 8192, 7282
-
-;//---------------------------------------------------------------
-;// This table contains ARM_M4P10_Q_OFFSET + 1 + (iQP / 6) values,
-;// for values of iQP from 0 to 51 (inclusive).
-;//---------------------------------------------------------------
-
- M_TABLE armVCM4P10_QPDivPlusOneTable
- DCB 16, 16, 16, 16, 16, 16
- DCB 17, 17, 17, 17, 17, 17
- DCB 18, 18, 18, 18, 18, 18
- DCB 19, 19, 19, 19, 19, 19
- DCB 20, 20, 20, 20, 20, 20
- DCB 21, 21, 21, 21, 21, 21
- DCB 22, 22, 22, 22, 22, 22
- DCB 23, 23, 23, 23, 23, 23
- DCB 24, 24, 24, 24, 24, 24
-
-;//------------------------------------------------------------------
-;// This table contains (1 << QbitsPlusOne) / 3 Values (Intra case) ,
-;// for values of iQP from 0 to 51 (inclusive).
-;//------------------------------------------------------------------
-
- M_TABLE armVCM4P10_QPDivIntraTable, 2
- DCD 21845, 21845, 21845, 21845, 21845, 21845
- DCD 43690, 43690, 43690, 43690, 43690, 43690
- DCD 87381, 87381, 87381, 87381, 87381, 87381
- DCD 174762, 174762, 174762, 174762, 174762, 174762
- DCD 349525, 349525, 349525, 349525, 349525, 349525
- DCD 699050, 699050, 699050, 699050, 699050, 699050
- DCD 1398101, 1398101, 1398101, 1398101, 1398101, 1398101
- DCD 2796202, 2796202, 2796202, 2796202, 2796202, 2796202
- DCD 5592405, 5592405, 5592405, 5592405, 5592405, 5592405
-
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_TransformResidual4x4_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_TransformResidual4x4_s.s
deleted file mode 100644
index e5372e1..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_TransformResidual4x4_s.s
+++ /dev/null
@@ -1,421 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_TransformResidual4x4_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-;// Description:
-;// Transform Residual 4x4 Coefficients
-;//
-;//
-
-
-;// Include standard headers
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
-;// Import symbols required from other files
-;// (For example tables)
-
-
-
-
-;// Set debugging level
-;//DEBUG_ON SETL {TRUE}
-
-
-
-;// Guarding implementation by the processor name
-
- IF ARM1136JS
-
-;//Input Registers
-pDst RN 0
-pSrc RN 1
-
-;//Output Registers
-
-
-;//Local Scratch Registers
-
-;// Packed Input pixels
-in00 RN 2 ;// Src[0] & Src[1]
-in02 RN 3 ;// Src[2] & Src[3]
-in10 RN 4 ;// Src[4] & Src[5]
-in12 RN 5 ;// Src[6] & Src[7]
-in20 RN 6 ;// Src[8] & Src[9]
-in22 RN 7 ;// Src[10] & Src[11]
-in30 RN 8 ;// Src[12] & Src[13]
-in32 RN 9 ;// Src[14] & Src[15]
-
-;// Transpose for Row operations (Rows to cols)
-trRow00 RN 2
-trRow10 RN 10
-trRow02 RN 3
-trRow12 RN 5
-trRow20 RN 11
-trRow30 RN 12
-trRow32 RN 14
-trRow22 RN 7
-
-;// Intermediate calculations
-e0 RN 4
-e1 RN 6
-e2 RN 8
-e3 RN 9
-constZero RN 1
-
-;// Row operated pixels
-rowOp00 RN 2
-rowOp10 RN 10
-rowOp20 RN 11
-rowOp30 RN 12
-rowOp02 RN 3
-rowOp12 RN 5
-rowOp22 RN 7
-rowOp32 RN 14
-
-;// Transpose for colulmn operations
-trCol00 RN 2
-trCol02 RN 3
-trCol10 RN 4
-trCol12 RN 5
-trCol20 RN 6
-trCol22 RN 7
-trCol30 RN 8
-trCol32 RN 9
-
-;// Intermediate calculations
-g0 RN 10
-g1 RN 11
-g2 RN 12
-g3 RN 14
-
-;// Coloumn operated pixels
-colOp00 RN 2
-colOp02 RN 3
-colOp10 RN 4
-colOp12 RN 5
-colOp20 RN 6
-colOp22 RN 7
-colOp30 RN 8
-colOp32 RN 9
-
-
-temp1 RN 10 ;// Temporary scratch varaibles
-const1 RN 11
-const2 RN 12
-mask RN 14
-
-;// Output pixels
-out00 RN 2
-out02 RN 3
-out10 RN 4
-out12 RN 5
-out20 RN 6
-out22 RN 7
-out30 RN 8
-out32 RN 9
-
-
-
- ;// Allocate stack memory required by the function
-
-
- ;// Write function header
- M_START armVCM4P10_TransformResidual4x4,r11
-
- ;******************************************************************
- ;// The strategy used in implementing the transform is as follows:*
- ;// Load the 4x4 block into 8 registers *
- ;// Transpose the 4x4 matrix *
- ;// Perform the row operations (on columns) using SIMD *
- ;// Transpose the 4x4 result matrix *
- ;// Perform the coloumn operations *
- ;// Store the 4x4 block at one go *
- ;******************************************************************
-
- ;// Load all the 4x4 pixels
-
- LDMIA pSrc,{in00,in02,in10,in12,in20,in22,in30,in32}
-
- MOV constZero,#0 ;// Used to right shift by 1
- ;LDR constZero,=0x00000000
-
- ;*****************************************************************
- ;//
- ;// Transpose the matrix inorder to perform row ops as coloumn ops
- ;// Input: in[][] = original matrix
- ;// Output: trRow[][]= transposed matrix
- ;// Step1: Obtain the LL part of the transposed matrix
- ;// Step2: Obtain the HL part
- ;// step3: Obtain the LH part
- ;// Step4: Obtain the HH part
- ;//
- ;*****************************************************************
-
- ;// LL 2x2 transposed matrix
- ;// d0 d1 - -
- ;// d4 d5 - -
- ;// - - - -
- ;// - - - -
-
- PKHTB trRow10,in10,in00,ASR #16 ;// [5 4] = [f5:f1]
- PKHBT trRow00,in00,in10,LSL #16 ;// [1 0] = [f4:f0]
-
- ;// HL 2x2 transposed matrix
- ;// - - - -
- ;// - - - -
- ;// d8 d9 - -
- ;// d12 d13 - -
-
-
- PKHTB trRow30,in12,in02,ASR #16 ;// [13 12] = [7 3]
- PKHBT trRow20,in02,in12,LSL #16 ;// [9 8] = [6 2]
-
- ;// LH 2x2 transposed matrix
- ;// - - d2 d3
- ;// - - d6 d7
- ;// - - - -
- ;// - - - -
-
- PKHBT trRow02,in20,in30,LSL #16 ;// [3 2] = [f12:f8]
- PKHTB trRow12,in30,in20,ASR #16 ;// [7 6] = [f13:f9]
-
-
-
-
- ;// HH 2x2 transposed matrix
- ;// - - - -
- ;// - - - -
- ;// - - d10 d11
- ;// - - d14 d15
-
- PKHTB trRow32,in32,in22,ASR #16 ;// [15 14] = [15 11]
- PKHBT trRow22,in22,in32,LSL #16 ;// [11 10] = [14 10]
-
-
- ;****************************************
- ;// Row Operations (Performed on columns)
- ;****************************************
-
-
- ;// SIMD operations on first two columns(two rows of the original matrix)
-
-
- SADD16 e0, trRow00,trRow20 ;// e0 = d0 + d2
- SSUB16 e1, trRow00,trRow20 ;// e1 = d0 - d2
- SHADD16 e2, trRow10,constZero ;// (f1>>1) constZero is a register holding 0
- SHADD16 e3, trRow30,constZero ;// avoid pipeline stalls for e2 and e3
- SSUB16 e2, e2, trRow30 ;// e2 = (d1>>1) - d3
- SADD16 e3, e3, trRow10 ;// e3 = d1 + (d3>>1)
- SADD16 rowOp00, e0, e3 ;// f0 = e0 + e3
- SADD16 rowOp10, e1, e2 ;// f1 = e1 + e2
- SSUB16 rowOp20, e1, e2 ;// f2 = e1 - e2
- SSUB16 rowOp30, e0, e3 ;// f3 = e0 - e3
-
- ;// SIMD operations on next two columns(next two rows of the original matrix)
-
- SADD16 e0, trRow02,trRow22
- SSUB16 e1, trRow02,trRow22
- SHADD16 e2, trRow12,constZero ;//(f1>>1) constZero is a register holding 0
- SHADD16 e3, trRow32,constZero
- SSUB16 e2, e2, trRow32
- SADD16 e3, e3, trRow12
- SADD16 rowOp02, e0, e3
- SADD16 rowOp12, e1, e2
- SSUB16 rowOp22, e1, e2
- SSUB16 rowOp32, e0, e3
-
-
- ;*****************************************************************
- ;// Transpose the resultant matrix
- ;// Input: rowOp[][]
- ;// Output: trCol[][]
- ;*****************************************************************
-
- ;// LL 2x2 transposed matrix
- ;// d0 d1 - -
- ;// d4 d5 - -
- ;// - - - -
- ;// - - - -
-
- PKHTB trCol10,rowOp10,rowOp00,ASR #16 ;// [5 4] = [f5:f1]
- PKHBT trCol00,rowOp00,rowOp10,LSL #16 ;// [1 0] = [f4:f0]
-
- ;// HL 2x2 transposed matrix
- ;// - - - -
- ;// - - - -
- ;// d8 d9 - -
- ;// d12 d13 - -
-
-
- PKHTB trCol30,rowOp12,rowOp02,ASR #16 ;// [13 12] = [7 3]
- PKHBT trCol20,rowOp02,rowOp12,LSL #16 ;// [9 8] = [6 2]
-
- ;// LH 2x2 transposed matrix
- ;// - - d2 d3
- ;// - - d6 d7
- ;// - - - -
- ;// - - - -
-
- PKHBT trCol02,rowOp20,rowOp30,LSL #16 ;// [3 2] = [f12:f8]
- PKHTB trCol12,rowOp30,rowOp20,ASR #16 ;// [7 6] = [f13:f9]
-
-
-
-
- ;// HH 2x2 transposed matrix
- ;// - - - -
- ;// - - - -
- ;// - - d10 d11
- ;// - - d14 d15
-
- PKHTB trCol32,rowOp32,rowOp22,ASR #16 ;// [15 14] = [15 11]
- PKHBT trCol22,rowOp22,rowOp32,LSL #16 ;// [11 10] = [14 10]
-
-
- ;*******************************
- ;// Coloumn Operations
- ;*******************************
-
-
- ;// SIMD operations on first two columns
-
-
- SADD16 g0, trCol00,trCol20
- SSUB16 g1, trCol00,trCol20
- SHADD16 g2, trCol10,constZero ;// (f1>>1) constZero is a register holding 0
- SHADD16 g3, trCol30,constZero
- SSUB16 g2, g2, trCol30
- SADD16 g3, g3, trCol10
- SADD16 colOp00, g0, g3
- SADD16 colOp10, g1, g2
- SSUB16 colOp20, g1, g2
- SSUB16 colOp30, g0, g3
-
- ;// SIMD operations on next two columns
-
- SADD16 g0, trCol02,trCol22
- SSUB16 g1, trCol02,trCol22
- SHADD16 g2, trCol12,constZero ;// (f1>>1) constZero is a register holding 0
- SHADD16 g3, trCol32,constZero
- SSUB16 g2, g2, trCol32
- SADD16 g3, g3, trCol12
- SADD16 colOp02, g0, g3
- SADD16 colOp12, g1, g2
- SSUB16 colOp22, g1, g2
- SSUB16 colOp32, g0, g3
-
-
-
-
-
- ;************************************************
- ;// Calculate final value (colOp[i][j] + 32)>>6
- ;************************************************
-
- ;// const1: Serves dual purpose
- ;// (1) Add #32 to both the lower and higher 16bits of the SIMD result
- ;// (2) Convert the lower 16 bit value to an unsigned number (Add 32768)
-
- LDR const1, =0x00208020
-
- LDR mask, =0xffff03ff ;// Used to mask the down shifted 6 bits
-
- ;// const2(#512): used to convert the lower 16bit number back to signed value
-
- MOV const2,#0x200 ;// const2 = 2^9
-
- ;// First Row
-
- SADD16 colOp00, colOp00, const1
- SADD16 colOp02, colOp02, const1
- AND colOp00, mask, colOp00, ASR #6
- AND colOp02, mask, colOp02, ASR #6
- SSUB16 out00,colOp00,const2
- SSUB16 out02,colOp02,const2
-
-
- ;// Second Row
-
- SADD16 colOp10, colOp10, const1
- SADD16 colOp12, colOp12, const1
- AND colOp10, mask, colOp10, ASR #6
- AND colOp12, mask, colOp12, ASR #6
- SSUB16 out10,colOp10,const2
- SSUB16 out12,colOp12,const2
-
-
- ;// Third Row
-
- SADD16 colOp20, colOp20, const1
- SADD16 colOp22, colOp22, const1
- AND colOp20, mask, colOp20, ASR #6
- AND colOp22, mask, colOp22, ASR #6
- SSUB16 out20,colOp20,const2
- SSUB16 out22,colOp22,const2
-
-
- ;// Fourth Row
-
- SADD16 colOp30, colOp30, const1
- SADD16 colOp32, colOp32, const1
- AND colOp30, mask, colOp30, ASR #6
- AND colOp32, mask, colOp32, ASR #6
- SSUB16 out30,colOp30,const2
- SSUB16 out32,colOp32,const2
-
-
-
-
- ;***************************
- ;// Store all the 4x4 pixels
- ;***************************
-
- STMIA pDst,{out00,out02,out10,out12,out20,out22,out30,out32}
-
-
-
- ;// Set return value
-
-End
-
-
- ;// Write function tail
- M_END
-
- ENDIF ;//ARM1136JS
-
-
-
-
-
-
-
-;// Guarding implementation by the processor name
-
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_UnpackBlock4x4_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_UnpackBlock4x4_s.s
deleted file mode 100644
index d02b4f3..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/armVCM4P10_UnpackBlock4x4_s.s
+++ /dev/null
@@ -1,106 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_UnpackBlock4x4_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
-;// Define the processor variants supported by this file
-
- M_VARIANTS ARM1136JS
-
-
- IF ARM1136JS
-
-;//--------------------------------------
-;// Input Arguments and their scope/usage
-;//--------------------------------------
-ppSrc RN 0 ;// Persistent variable
-pDst RN 1 ;// Persistent variable
-
-;//--------------------------------
-;// Variables and their scope/usage
-;//--------------------------------
-pSrc RN 2 ;// Persistent variables
-Flag RN 3
-Value RN 4
-Value2 RN 5
-strOffset RN 6
-cstOffset RN 7
-
-
- M_START armVCM4P10_UnpackBlock4x4, r7
-
- LDR pSrc, [ppSrc] ;// Load pSrc
- MOV cstOffset, #31 ;// To be used in the loop, to compute offset
-
- ;//-----------------------------------------------------------------------
- ; Firstly, fill all the coefficient values on the <pDst> buffer by zero
- ;//-----------------------------------------------------------------------
-
- MOV Value, #0 ;// Initialize the zero value
- MOV Value2, #0 ;// Initialize the zero value
- LDRB Flag, [pSrc], #1 ;// Preload <Flag> before <unpackLoop>
-
- STRD Value, [pDst, #0] ;// pDst[0] = pDst[1] = pDst[2] = pDst[3] = 0
- STRD Value, [pDst, #8] ;// pDst[4] = pDst[5] = pDst[6] = pDst[7] = 0
- STRD Value, [pDst, #16] ;// pDst[8] = pDst[9] = pDst[10] = pDst[11] = 0
- STRD Value, [pDst, #24] ;// pDst[12] = pDst[13] = pDst[14] = pDst[15] = 0
-
- ;//----------------------------------------------------------------------------
- ;// The loop below parses and unpacks the input stream. The C-model has
- ;// a somewhat complicated logic for sign extension. But in the v6 version,
- ;// that can be easily taken care by loading the data from <pSrc> stream as
- ;// SIGNED byte/halfword. So, based on the first TST instruction, 8-bits or
- ;// 16-bits are read.
- ;//
- ;// Next, to compute the offset, where the unpacked value needs to be stored,
- ;// we modify the computation to perform [(Flag & 15) < 1] as [(Flag < 1) & 31]
- ;// This results in a saving of one cycle.
- ;//----------------------------------------------------------------------------
-
-unpackLoop
- TST Flag, #0x10 ;// Computing (Flag & 0x10)
- LDRSBNE Value2,[pSrc,#1] ;// Load byte wise to avoid unaligned access
- LDRBNE Value, [pSrc], #2
- AND strOffset, cstOffset, Flag, LSL #1 ;// strOffset = (Flag & 15) < 1;
- LDRSBEQ Value, [pSrc], #1 ;// Value = (OMX_U8) *pSrc++
- ORRNE Value,Value,Value2, LSL #8 ;// Value = (OMX_U16) *pSrc++
-
- TST Flag, #0x20 ;// Computing (Flag & 0x20) to check, if we're done
- LDRBEQ Flag, [pSrc], #1 ;// Flag = (OMX_U8) *pSrc++, for next iteration
- STRH Value, [pDst, strOffset] ;// Store <Value> at offset <strOffset>
- BEQ unpackLoop ;// Branch to the loop beginning
-
- STR pSrc, [ppSrc] ;// Update the bitstream pointer
- M_END
-
- ENDIF
-
-
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_DeblockChroma_I.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_DeblockChroma_I.c
deleted file mode 100644
index 34adea8..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_DeblockChroma_I.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_DeblockChroma_I.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 intra chroma deblock
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_DeblockChroma_I
- *
- * Description:
- * Performs deblocking filtering on all edges of the chroma macroblock (16x16).
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcDst pointer to the input macroblock. Must be 8-byte aligned.
- * [in] srcdstStep Step of the arrays
- * [in] pAlpha pointer to a 2x2 array of alpha thresholds, organized as follows: { external
- * vertical edge, internal vertical edge, external
- * horizontal edge, internal horizontal edge }
- * [in] pBeta pointer to a 2x2 array of beta thresholds, organized as follows: { external
- * vertical edge, internal vertical edge, external horizontal edge,
- * internal horizontal edge }
- * [in] pThresholds AArray of size 8x2 of Thresholds (TC0) (values for the left or
- * above edge of each 4x2 or 2x4 block, arranged in vertical block order
- * and then in horizontal block order)
- * [in] pBS array of size 16x2 of BS parameters (arranged in scan block order for vertical edges and then horizontal edges);
- * valid in the range [0,4] with the following restrictions: i) pBS[i]== 4 may occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^1]== 4. Must be 4-byte aligned.
- * [out] pSrcDst pointer to filtered output macroblock
- *
- * Return Value:
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - Either of the pointers in pSrcDst, pAlpha, pBeta, pTresholds, or pBS is NULL.
- * - pSrcDst is not 8-byte aligned.
- * - either pThresholds or pBS is not 4-byte aligned.
- * - pBS is out of range, i.e., one of the following conditions is true: pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or (pBS[i]==4 && pBS[i^1]!=4) for 0<=i<=3.
- * - srcdstStep is not a multiple of 8.
- *
- */
-OMXResult omxVCM4P10_DeblockChroma_I(
- OMX_U8* pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8* pAlpha,
- const OMX_U8* pBeta,
- const OMX_U8* pThresholds,
- const OMX_U8 *pBS
-)
-{
- OMXResult errorCode;
-
- armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot8ByteAligned(pSrcDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(srcdstStep & 7, OMX_Sts_BadArgErr);
- armRetArgErrIf(pAlpha == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBeta == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pThresholds == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pThresholds), OMX_Sts_BadArgErr);
- armRetArgErrIf(pBS == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pBS), OMX_Sts_BadArgErr);
-
- errorCode = omxVCM4P10_FilterDeblockingChroma_VerEdge_I(
- pSrcDst, srcdstStep, pAlpha, pBeta, pThresholds, pBS);
-
- armRetArgErrIf(errorCode != OMX_Sts_NoErr, errorCode)
-
- errorCode = omxVCM4P10_FilterDeblockingChroma_HorEdge_I(
- pSrcDst, srcdstStep, pAlpha+2, pBeta+2, pThresholds+8, pBS+16);
-
- return errorCode;
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_DeblockLuma_I.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_DeblockLuma_I.c
deleted file mode 100644
index 8b47dc2..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_DeblockLuma_I.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_DeblockLuma_I.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 luma deblock
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-
-/**
- * Function: omxVCM4P10_DeblockLuma_I
- *
- * Description:
- * This function performs deblock filtering the horizontal and vertical edges of a luma macroblock
- *(16x16).
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcDst pointer to the input macroblock. Must be 8-byte aligned.
- * [in] srcdstStep image width
- * [in] pAlpha pointer to a 2x2 table of alpha thresholds, organized as follows: { external
- * vertical edge, internal vertical edge, external horizontal
- * edge, internal horizontal edge }
- * [in] pBeta pointer to a 2x2 table of beta thresholds, organized as follows: { external
- * vertical edge, internal vertical edge, external horizontal edge,
- * internal horizontal edge }
- * [in] pThresholds pointer to a 16x2 table of threshold (TC0), organized as follows: { values for
- * the left or above edge of each 4x4 block, arranged in vertical block order
- * and then in horizontal block order)
- * [in] pBS pointer to a 16x2 table of BS parameters arranged in scan block order for vertical edges and then horizontal edges;
- * valid in the range [0,4] with the following restrictions: i) pBS[i]== 4 may occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^1]== 4. Must be 4-byte aligned.
- * [out] pSrcDst pointer to filtered output macroblock.
- *
- * Return Value:
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - Either of the pointers in pSrcDst, pAlpha, pBeta, pTresholds or pBS is NULL.
- * - pSrcDst is not 8-byte aligned.
- * - srcdstStep is not a multiple of 8
- * - pBS is out of range, i.e., one of the following conditions is true: pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or (pBS[i]==4 && pBS[i^1]!=4) for 0<=i<=3.
-.
- *
- */
-
-OMXResult omxVCM4P10_DeblockLuma_I(
- OMX_U8* pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8* pAlpha,
- const OMX_U8* pBeta,
- const OMX_U8* pThresholds,
- const OMX_U8 *pBS
-)
-{
- OMXResult errorCode;
-
- armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot8ByteAligned(pSrcDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(srcdstStep & 7, OMX_Sts_BadArgErr);
- armRetArgErrIf(pAlpha == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBeta == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pThresholds == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pThresholds), OMX_Sts_BadArgErr);
- armRetArgErrIf(pBS == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pBS), OMX_Sts_BadArgErr);
-
- errorCode = omxVCM4P10_FilterDeblockingLuma_VerEdge_I(
- pSrcDst, srcdstStep, pAlpha, pBeta, pThresholds, pBS);
-
- armRetArgErrIf(errorCode != OMX_Sts_NoErr, errorCode)
-
- errorCode = omxVCM4P10_FilterDeblockingLuma_HorEdge_I(
- pSrcDst, srcdstStep, pAlpha+2, pBeta+2, pThresholds+16, pBS+16);
-
- return errorCode;
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC.c
deleted file mode 100644
index 2cd65ca..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 decode coefficients module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC
- *
- * Description:
- * Performs CAVLC decoding and inverse raster scan for 2x2 block of
- * ChromaDCLevel. The decoded coefficients in packed position-coefficient
- * buffer are stored in increasing raster scan order, namely position order.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream Double pointer to current byte in bit stream
- * buffer
- * [in] pOffset Pointer to current bit position in the byte
- * pointed to by *ppBitStream
- * [out] ppBitStream *ppBitStream is updated after each block is decoded
- * [out] pOffset *pOffset is updated after each block is decoded
- * [out] pNumCoeff Pointer to the number of nonzero coefficients
- * in this block
- * [out] ppPosCoefbuf Double pointer to destination residual
- * coefficient-position pair buffer
- *
- * Return Value:
- * Standard omxError result. See enumeration for possible result codes.
- *
- */
-
-OMXResult omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC (
- const OMX_U8** ppBitStream,
- OMX_S32* pOffset,
- OMX_U8* pNumCoeff,
- OMX_U8** ppPosCoefbuf
- )
-
-{
- return armVCM4P10_DecodeCoeffsToPair(ppBitStream, pOffset, pNumCoeff,
- ppPosCoefbuf, 17, 4);
-
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_DecodeCoeffsToPairCAVLC.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_DecodeCoeffsToPairCAVLC.c
deleted file mode 100644
index 9f9706b..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_DecodeCoeffsToPairCAVLC.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_DecodeCoeffsToPairCAVLC.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 decode coefficients module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_DecodeCoeffsToPairCAVLC
- *
- * Description:
- * Performs CAVLC decoding and inverse zigzag scan for 4x4 block of
- * Intra16x16DCLevel, Intra16x16ACLevel,LumaLevel, and ChromaACLevel.
- * Inverse field scan is not supported. The decoded coefficients in packed
- * position-coefficient buffer are stored in increasing zigzag order instead
- * of position order.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream Double pointer to current byte in bit stream buffer
- * [in] pOffset Pointer to current bit position in the byte pointed
- * to by *ppBitStream
- * [in] sMaxNumCoeff Maximum number of non-zero coefficients in current
- * block
- * [in] sVLCSelect VLC table selector, obtained from number of non-zero
- * AC coefficients of above and left 4x4 blocks. It is
- * equivalent to the variable nC described in H.264 standard
- * table 9-5, except its value can¡¯t be less than zero.
- * [out] ppBitStream *ppBitStream is updated after each block is decoded
- * [out] pOffset *pOffset is updated after each block is decoded
- * [out] pNumCoeff Pointer to the number of nonzero coefficients in
- * this block
- * [out] ppPosCoefbuf Double pointer to destination residual
- * coefficient-position pair buffer
- * Return Value:
- * Standard omxError result. See enumeration for possible result codes.
- *
- */
-
-OMXResult omxVCM4P10_DecodeCoeffsToPairCAVLC(
- const OMX_U8** ppBitStream,
- OMX_S32* pOffset,
- OMX_U8* pNumCoeff,
- OMX_U8**ppPosCoefbuf,
- OMX_INT sVLCSelect,
- OMX_INT sMaxNumCoeff
- )
-{
- return armVCM4P10_DecodeCoeffsToPair(ppBitStream, pOffset, pNumCoeff,
- ppPosCoefbuf, sVLCSelect, sMaxNumCoeff);
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_DequantTransformResidualFromPairAndAdd_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_DequantTransformResidualFromPairAndAdd_s.s
deleted file mode 100644
index 3187f2b..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_DequantTransformResidualFromPairAndAdd_s.s
+++ /dev/null
@@ -1,494 +0,0 @@
-;//
-;// Copyright (C) 2007 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// Description:
-;// H.264 inverse quantize and transform module
-;//
-;//
-
-
-
-;// Include standard headers
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
-;// Import symbols required from other files
-;// (For example tables)
-
- IMPORT armVCM4P10_UnpackBlock4x4
- IMPORT armVCM4P10_TransformResidual4x4
- IMPORT armVCM4P10_QPDivTable
- IMPORT armVCM4P10_VMatrixU16
- IMPORT armVCM4P10_QPModuloTable
-
- M_VARIANTS ARM1136JS, ARM1136JS_U
-
-;// Set debugging level
-;//DEBUG_ON SETL {TRUE}
-
-
-;// Static Function: armVCM4P10_DequantLumaAC4x4
-
-;// Guarding implementation by the processor name
-
- IF ARM1136JS
-
-;//Input Registers
-pSrcDst RN 0
-QP RN 1
-
-
-;//Output Registers
-
-
-;//Local Scratch Registers
-pQPdiv RN 4
-pQPmod RN 5
-pVRow RN 2
-QPmod RN 6
-shift RN 3
-rowLuma01 RN 1
-rowLuma23 RN 4
-
-SrcDst00 RN 5
-SrcDst02 RN 6
-SrcDst10 RN 7
-SrcDst12 RN 8
-SrcDst20 RN 9
-SrcDst22 RN 10
-SrcDst30 RN 11
-SrcDst32 RN 12
-
-temp1 RN 2
-temp2 RN 3
-temp3 RN 14
-
-
- ;// Allocate stack memory required by the function
-
- ;// Write function header
- M_START armVCM4P10_DequantLumaAC4x4,r11
-
- LDR pQPmod,=armVCM4P10_QPModuloTable
- LDR pQPdiv,=armVCM4P10_QPDivTable
- LDR pVRow,=armVCM4P10_VMatrixU16
-
- LDRSB QPmod,[pQPmod,QP] ;// (QP%6) * 6
- LDRSB shift,[pQPdiv,QP] ;// Shift = QP / 6
-
- LDRH rowLuma01,[pVRow,QPmod]! ;// rowLuma01 = [00|0a]
- LDRH temp3,[pVRow,#2] ;// temp3 = [00|0b]
- LDRH rowLuma23,[pVRow,#4] ;// rowLuma23 = [00|0c]
- ORR rowLuma01,rowLuma01,temp3,LSL #16 ;// rowLuma01 = [0b|0a]
-
- ;// Load all the 16 'src' values
- LDMIA pSrcDst,{SrcDst00,SrcDst02,SrcDst10,SrcDst12,SrcDst20,SrcDst22,SrcDst30,SrcDst32}
-
-
- ;//*********************************************************************************************
- ;//
- ;// 'Shift' ranges between [0,8]
- ;// So we can shift the packed rowLuma values [0b|0a] with a single LSL operation
- ;//
- ;//*********************************************************************************************
-
- LSL rowLuma01,rowLuma01,shift
- LSL rowLuma23,rowLuma23,shift
-
-
- ;//**********************************************************************************************
- ;//
- ;// The idea is to unroll the Loop completely
- ;// All the 16 src values are loaded at once into 8 registers : SrcDst<y><x> (above)
- ;// 0<= armVCM4P10_PosToVCol4x4[i] <=2 for any 'i<16'
- ;// So the only values of pVRow[i] that need to be loaded are for i=0,1,2
- ;// These 3 values are loaded into rowLuma01 and rowLuma23 (above)
- ;// We first calculate pVRow[armVCM4P10_PosToVCol4x4[i]]) << Shift which fits into 16 bits (above)
- ;// Then the product pSrcDst[i] * (pVRow[armVCM4P10_PosToVCol4x4[i]] << Shift) is calculated
- ;// Here we interleave the PKHBT operations for various rows to avoide pipeline stalls
- ;//
- ;// We then pack the two 16 bit multiplication result into a word and store at one go
- ;//
- ;//**********************************************************************************************
-
-
- ;// Row 1
-
-
- SMULTB temp1,SrcDst00,rowLuma23 ;// pSrcDst[1] * (pVRow[2]<<Shift)
- SMULBB SrcDst00,SrcDst00,rowLuma01 ;// pSrcDst[0] * (pVRow[0]<<Shift)
-
- SMULTB temp2,SrcDst02,rowLuma23 ;// pSrcDst[3] * (pVRow[2]<<Shift)
- SMULBB SrcDst02,SrcDst02,rowLuma01 ;// pSrcDst[2] * (pVRow[0]<<Shift)
-
- PKHBT SrcDst00,SrcDst00,temp1,LSL #16 ;// Pack the first two product values
-
-
- ;// Row 2
- SMULTT temp1,SrcDst10,rowLuma01 ;// pSrcDst[5] * (pVRow[1]<<Shift)
- SMULBB SrcDst10,SrcDst10,rowLuma23 ;// pSrcDst[4] * (pVRow[2]<<Shift)
-
- PKHBT SrcDst02,SrcDst02,temp2,LSL #16 ;// Pack the next two product values
- SMULTT temp2,SrcDst12,rowLuma01 ;// pSrcDst[7] * (pVRow[1]<<Shift)
- SMULBB SrcDst12,SrcDst12,rowLuma23 ;// pSrcDst[6] * (pVRow[2]<<Shift)
-
- PKHBT SrcDst10,SrcDst10,temp1,LSL #16 ;// Pack the next two product values
-
-
- ;// Row 3
-
- SMULTB temp1,SrcDst20,rowLuma23 ;// pSrcDst[9] * (pVRow[2]<<Shift)
- SMULBB SrcDst20,SrcDst20,rowLuma01 ;// pSrcDst[8] * (pVRow[0]<<Shift)
-
- PKHBT SrcDst12,SrcDst12,temp2,LSL #16 ;// Pack the next two product values
- SMULTB temp2,SrcDst22,rowLuma23 ;// pSrcDst[11] * (pVRow[2]<<Shift)
- SMULBB SrcDst22,SrcDst22,rowLuma01 ;// pSrcDst[10] * (pVRow[0]<<Shift)
-
- PKHBT SrcDst20,SrcDst20,temp1,LSL #16 ;// Pack the next two product values
-
-
-
- ;// Row 4
-
- SMULTT temp1,SrcDst30,rowLuma01 ;// pSrcDst[13] * (pVRow[1]<<Shift)
- SMULBB SrcDst30,SrcDst30,rowLuma23 ;// pSrcDst[12] * (pVRow[2]<<Shift)
-
- SMULTT temp3,SrcDst32,rowLuma01 ;// pSrcDst[15] * (pVRow[1]<<Shift)
- SMULBB SrcDst32,SrcDst32,rowLuma23 ;// pSrcDst[14] * (pVRow[2]<<Shift)
-
- PKHBT SrcDst22,SrcDst22,temp2,LSL #16 ;// Pack the remaining product values
- PKHBT SrcDst30,SrcDst30,temp1,LSL #16
- PKHBT SrcDst32,SrcDst32,temp3,LSL #16
-
-
- STMIA pSrcDst,{SrcDst00,SrcDst02,SrcDst10,SrcDst12,SrcDst20,SrcDst22,SrcDst30,SrcDst32}
-
-
- ;// Set return value
-
-
-
- ;// Write function tail
- M_END
-
- ENDIF ;//ARM1136JS
-
-
-;// Guarding implementation by the processor name
-
- IF ARM1136JS_U
-
-;//Input Registers
-pSrcDst RN 0
-QP RN 1
-
-
-;//Output Registers
-
-
-;//Local Scratch Registers
-pQPdiv RN 4
-pQPmod RN 5
-pVRow RN 2
-QPmod RN 6
-shift RN 3
-rowLuma01 RN 1
-rowLuma23 RN 4
-
-SrcDst00 RN 5
-SrcDst02 RN 6
-SrcDst10 RN 7
-SrcDst12 RN 8
-SrcDst20 RN 9
-SrcDst22 RN 10
-SrcDst30 RN 11
-SrcDst32 RN 12
-
-temp1 RN 2
-temp2 RN 3
-temp3 RN 14
-
-
- ;// Allocate stack memory required by the function
-
- ;// Write function header
- M_START armVCM4P10_DequantLumaAC4x4,r11
-
- LDR pQPmod,=armVCM4P10_QPModuloTable
- LDR pQPdiv,=armVCM4P10_QPDivTable
- LDR pVRow,=armVCM4P10_VMatrixU16
-
- LDRSB QPmod,[pQPmod,QP] ;// (QP%6) * 6
- LDRSB shift,[pQPdiv,QP] ;// Shift = QP / 6
-
- LDR rowLuma01,[pVRow,QPmod]! ;// rowLuma01 = [0b|0a]
- LDR rowLuma23,[pVRow,#4] ;// rowLuma23 = [0d|0c]
-
- ;// Load all the 16 'src' values
- LDMIA pSrcDst,{SrcDst00,SrcDst02,SrcDst10,SrcDst12,SrcDst20,SrcDst22,SrcDst30,SrcDst32}
-
-
- ;//*********************************************************************************************
- ;//
- ;// 'Shift' ranges between [0,8]
- ;// So we can shift the packed rowLuma values [0b|0a] with a single LSL operation
- ;//
- ;//*********************************************************************************************
-
- LSL rowLuma01,rowLuma01,shift
- LSL rowLuma23,rowLuma23,shift
-
-
- ;//**********************************************************************************************
- ;//
- ;// The idea is to unroll the Loop completely
- ;// All the 16 src values are loaded at once into 8 registers : SrcDst<y><x> (above)
- ;// 0<= armVCM4P10_PosToVCol4x4[i] <=2 for any 'i<16'
- ;// So the only values of pVRow[i] that need to be loaded are for i=0,1,2
- ;// These 3 values are loaded into rowLuma01 and rowLuma23 (above)
- ;// We first calculate pVRow[armVCM4P10_PosToVCol4x4[i]]) << Shift which fits into 16 bits (above)
- ;// Then the product pSrcDst[i] * (pVRow[armVCM4P10_PosToVCol4x4[i]] << Shift) is calculated
- ;// Here we interleave the PKHBT operations for various rows to avoide pipeline stalls
- ;//
- ;// We then pack the two 16 bit multiplication result into a word and store at one go
- ;//
- ;//**********************************************************************************************
-
-
- ;// Row 1
-
-
- SMULTB temp1,SrcDst00,rowLuma23 ;// pSrcDst[1] * (pVRow[2]<<Shift)
- SMULBB SrcDst00,SrcDst00,rowLuma01 ;// pSrcDst[0] * (pVRow[0]<<Shift)
-
- SMULTB temp2,SrcDst02,rowLuma23 ;// pSrcDst[3] * (pVRow[2]<<Shift)
- SMULBB SrcDst02,SrcDst02,rowLuma01 ;// pSrcDst[2] * (pVRow[0]<<Shift)
-
- PKHBT SrcDst00,SrcDst00,temp1,LSL #16 ;// Pack the first two product values
-
-
- ;// Row 2
- SMULTT temp1,SrcDst10,rowLuma01 ;// pSrcDst[5] * (pVRow[1]<<Shift)
- SMULBB SrcDst10,SrcDst10,rowLuma23 ;// pSrcDst[4] * (pVRow[2]<<Shift)
-
- PKHBT SrcDst02,SrcDst02,temp2,LSL #16 ;// Pack the next two product values
- SMULTT temp2,SrcDst12,rowLuma01 ;// pSrcDst[7] * (pVRow[1]<<Shift)
- SMULBB SrcDst12,SrcDst12,rowLuma23 ;// pSrcDst[6] * (pVRow[2]<<Shift)
-
- PKHBT SrcDst10,SrcDst10,temp1,LSL #16 ;// Pack the next two product values
-
-
- ;// Row 3
-
- SMULTB temp1,SrcDst20,rowLuma23 ;// pSrcDst[9] * (pVRow[2]<<Shift)
- SMULBB SrcDst20,SrcDst20,rowLuma01 ;// pSrcDst[8] * (pVRow[0]<<Shift)
-
- PKHBT SrcDst12,SrcDst12,temp2,LSL #16 ;// Pack the next two product values
- SMULTB temp2,SrcDst22,rowLuma23 ;// pSrcDst[11] * (pVRow[2]<<Shift)
- SMULBB SrcDst22,SrcDst22,rowLuma01 ;// pSrcDst[10] * (pVRow[0]<<Shift)
-
- PKHBT SrcDst20,SrcDst20,temp1,LSL #16 ;// Pack the next two product values
-
-
-
- ;// Row 4
-
- SMULTT temp1,SrcDst30,rowLuma01 ;// pSrcDst[13] * (pVRow[1]<<Shift)
- SMULBB SrcDst30,SrcDst30,rowLuma23 ;// pSrcDst[12] * (pVRow[2]<<Shift)
-
- SMULTT temp3,SrcDst32,rowLuma01 ;// pSrcDst[15] * (pVRow[1]<<Shift)
- SMULBB SrcDst32,SrcDst32,rowLuma23 ;// pSrcDst[14] * (pVRow[2]<<Shift)
-
- PKHBT SrcDst22,SrcDst22,temp2,LSL #16 ;// Pack the remaining product values
- PKHBT SrcDst30,SrcDst30,temp1,LSL #16
- PKHBT SrcDst32,SrcDst32,temp3,LSL #16
-
-
- STMIA pSrcDst,{SrcDst00,SrcDst02,SrcDst10,SrcDst12,SrcDst20,SrcDst22,SrcDst30,SrcDst32}
-
-
- ;// Set return value
-
-
-
- ;// Write function tail
- M_END
-
- ENDIF ;//ARM1136JS_U
-
-
-
-
-
-;// Function: omxVCM4P10_DequantTransformResidualFromPairAndAdd
-
-;// Guarding implementation by the processor name
-
- IF ARM1136JS
-
-;//Input Registers
-ppSrc RN 0
-pPred RN 1
-pDC RN 2
-pDst RN 3
-
-
-;//Output Registers
-result RN 0
-
-;//Local Scratch Registers
-pDelta RN 4
-pDeltaTmp RN 6
-AC RN 5 ;//Load from stack
-pPredTemp RN 7
-pDCTemp RN 8
-pDstTemp RN 9
-pDeltaArg1 RN 1
-pDeltaArg0 RN 0
-QP RN 1 ;//Load from stack
-DCval RN 10
-DCvalCopy RN 11
-predstep RN 1
-dstStep RN 10
-ycounter RN 0
-PredVal1 RN 3
-PredVal2 RN 5
-DeltaVal1 RN 2
-DeltaVal2 RN 11
-PredVal RN 8
-tmpDeltaVal RN 6
-sum1 RN 12
-sum2 RN 14
-
-
-
- ;// Allocate stack memory required by the function
- M_ALLOC8 pBuffer, 32
-
-
- ;// Write function header
- M_START omxVCM4P10_DequantTransformResidualFromPairAndAdd,r11
-
- ;// Define stack arguments
- M_ARG predStepOnStack, 4
- M_ARG dstStepOnStack,4
- M_ARG QPOnStack, 4
- M_ARG ACOnStack,4
-
-
- M_ADR pDelta,pBuffer
- M_LDR AC,ACOnStack
-
-
- ;// Save registers r1,r2,r3 before function call
- MOV pPredTemp,pPred
- MOV pDCTemp,pDC
- MOV pDstTemp,pDst
-
- CMP AC,#0
- BEQ DCcase
- MOV pDeltaArg1,pDelta ;// Set up r1 for armVCM4P10_UnpackBlock4x4
-
- BL armVCM4P10_UnpackBlock4x4
-
- M_LDR QP,QPOnStack ;// Set up r1 for DequantLumaAC4x4
- MOV pDeltaArg0,pDelta ;// Set up r0 for DequantLumaAC4x4
-
- BL armVCM4P10_DequantLumaAC4x4
-
-
- CMP pDCTemp,#0
- LDRSHNE DCval,[pDCTemp]
- MOV pDeltaArg0,pDelta ;// Set up r0 for armVCM4P10_TransformResidual4x4
- MOV pDeltaArg1,pDelta ;// Set up r1 for armVCM4P10_TransformResidual4x4
- STRHNE DCval,[pDelta]
-
- BL armVCM4P10_TransformResidual4x4
- B OutDCcase
-
-
-DCcase
- LDRSH DCval,[pDCTemp]
- ADD DCval,DCval,#32
- ASR DCval,DCval,#6
- PKHBT DCval,DCval,DCval,LSL #16 ;// Duplicating the Lower halfword
- MOV DCvalCopy, DCval ;// Needed for STRD
- STRD DCval, [pDelta, #0] ;// pDelta[0] = pDelta[1] = pDelta[2] = pDelta[3] = DCval
- STRD DCval, [pDelta, #8] ;// pDelta[4] = pDelta[5] = pDelta[6] = pDelta[7] = DCval
- STRD DCval, [pDelta, #16] ;// pDelta[8] = pDelta[9] = pDelta[10] = pDelta[11] = DCval
- STRD DCval, [pDelta, #24]
-
-
-OutDCcase
- M_LDR predstep,predStepOnStack
- M_LDR dstStep,dstStepOnStack
-
- LDMIA pDelta!,{tmpDeltaVal,DeltaVal2} ;// Pre load
- MOV ycounter,#4 ;// Counter for the PredPlusDeltaLoop
- LDR PredVal,[pPredTemp] ;// Pre load
-
-PredPlusDeltaLoop
-
-
- SUBS ycounter,ycounter,#1
- ADD pPredTemp,pPredTemp,predstep ;// Increment pPred ptr
-
- PKHBT DeltaVal1,tmpDeltaVal,DeltaVal2,LSL #16 ;// Deltaval1 = [C A]
- PKHTB DeltaVal2,DeltaVal2,tmpDeltaVal,ASR #16 ;// DeltaVal2 = [D B]
-
- UXTB16 PredVal1,PredVal ;// PredVal1 = [0c0a]
- UXTB16 PredVal2,PredVal,ROR #8 ;// PredVal2 = [0d0b]
-
- LDRGT PredVal,[pPredTemp] ;// Pre load
-
- QADD16 sum2,DeltaVal2,PredVal2 ;// Add and saturate to 16 bits
- QADD16 sum1,DeltaVal1,PredVal1
-
- USAT16 sum2,#8,sum2 ;// armClip(0,255,sum2)
- USAT16 sum1,#8,sum1
-
- LDMGTIA pDelta!,{tmpDeltaVal,DeltaVal2} ;// Pre load
-
- ORR sum1,sum1,sum2,LSL #8 ;// sum1 = [dcba]
- STR sum1,[pDstTemp]
-
- ADD pDstTemp,pDstTemp,dstStep ;// Increment pDst ptr
- BGT PredPlusDeltaLoop
-
-
- ;// Set return value
- MOV result,#OMX_Sts_NoErr
-
-End
-
-
- ;// Write function tail
-
- M_END
-
- ENDIF ;//ARM1136JS
-
-
-;// Function: omxVCM4P10_DequantTransformResidualFromPairAndAdd
-
-;// Guarding implementation by the processor name
-
-
-
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_HorEdge_I_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_HorEdge_I_s.s
deleted file mode 100644
index d940418..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_HorEdge_I_s.s
+++ /dev/null
@@ -1,350 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_FilterDeblockingChroma_HorEdge_I_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
-
- IF ARM1136JS
-
-MASK_0 EQU 0x00000000
-MASK_1 EQU 0x01010101
-LOOP_COUNT EQU 0x50000000
-
-;// Declare input registers
-
-pSrcDst RN 0
-srcdstStep RN 1
-pAlphaArg RN 2
-pBetaArg RN 3
-
-pThresholds RN 6
-pBS RN 9
-pQ0 RN 0
-bS RN 10
-
-alpha RN 6
-alpha0 RN 6
-alpha1 RN 8
-
-beta RN 7
-beta0 RN 7
-beta1 RN 9
-
-;// Declare Local/Temporary variables
-
-;// Pixels
-p_0 RN 3
-p_1 RN 5
-q_0 RN 8
-q_1 RN 9
-
-;// Filtering
-
-dp0q0 RN 12
-dp1p0 RN 12
-dq1q0 RN 12
-
-ap0q0 RN 4
-filt RN 2
-
-m00 RN 14
-m01 RN 11
-
-pQ0 RN 0
-Step RN 1
-
-;// Output
-
-P_0 RN 6
-Q_0 RN 7
-
-;//Declarations for bSLT4 kernel
-
-tC RN 12
-tC0 RN 5
-tC1 RN 12
-pos RN 5
-neg RN 9
-
-;//Declarations for bSGE4 kernel
-
-
-;// Miscellanous
-XY RN 8
-
-a RN 10
-t1 RN 10
-t2 RN 12
-t3 RN 14
-t4 RN 6
-t5 RN 5
-
-
- ;// Allocate stack memory
- M_ALLOC4 ppThresholds,4
- M_ALLOC8 pAlphaBeta0,8
- M_ALLOC8 pAlphaBeta1,8
- M_ALLOC8 pXYBS,4
- M_ALLOC4 ppBS,4
-
- ;// Function header
- M_START omxVCM4P10_FilterDeblockingChroma_HorEdge_I, r11
-
- ;//Input arguments on the stack
- M_ARG ppThresholdsArg, 4
- M_ARG ppBSArg, 4
-
- LDRB alpha1, [pAlphaArg,#1]
- LDRB beta1, [pBetaArg,#1]
- M_LDR pThresholds, ppThresholdsArg
- LDR a,=MASK_1
- LDRB beta0, [pBetaArg]
- M_STR pThresholds, ppThresholds
- LDRB alpha0, [pAlphaArg]
-
- MUL alpha1, alpha1, a
- MUL beta1, beta1, a
- MUL alpha0, alpha0, a
- MUL beta0, beta0, a
-
- M_STRD alpha1, beta1, pAlphaBeta1
- M_LDR pBS, ppBSArg
- M_STRD alpha0, beta0, pAlphaBeta0
-
- LDR XY,=LOOP_COUNT
- M_STRD XY, pBS, pXYBS
-
- SUB pQ0, pQ0, srcdstStep, LSL #1
-LoopY
-LoopX
-;//---------------Load Pixels-------------------
- LDRH bS, [pBS], #2
-
- M_STR pBS, ppBS
- M_LDR p_1, [pQ0],srcdstStep
-
- CMP bS, #0
-
- M_LDR p_0, [pQ0],srcdstStep
- M_LDR q_0, [pQ0],srcdstStep
- M_LDR q_1, [pQ0]
- LDR m01, =MASK_1 ;// 01010101 mask
- BEQ NoFilterBS0
-
-
- ;// p_0 = [r3p0 r2p0 r1p0 r0p0]
- ;// p_1 = [r3p1 r2p1 r1p1 r0p1]
- ;// q_0 = [r3q0 r2q0 r1q0 r0q0]
- ;// q_1 = [r3q1 r2q1 r1q1 r0q1]
-
-;//--------------Filtering Decision -------------------
- MOV m00, #MASK_0 ;// 00000000 mask
-
- MOV filt, m01
- TST bS, #0xff00
- MOVEQ filt, filt, LSR #16
- TST bS, #0xff
- MOVEQ filt, filt, LSL #16
- TST bS, #4
-
-
- ;// Check |p0-q0|<Alpha
- USUB8 dp0q0, p_0, q_0
- USUB8 a, q_0, p_0
- SEL ap0q0, a, dp0q0
- USUB8 a, ap0q0, alpha
- SEL filt, m00, filt
-
- ;// Check |p1-p0|<Beta
- USUB8 dp1p0, p_1, p_0
- USUB8 a, p_0, p_1
- SEL a, a, dp1p0
- USUB8 a, a, beta
- SEL filt, m00, filt
-
- ;// Check |q1-q0|<Beta
- USUB8 dq1q0, q_1, q_0
- USUB8 a, q_0, q_1
- SEL a, a, dq1q0
- USUB8 a, a, beta
- SEL filt, m00, filt
-
- BEQ bSLT4
-;//-------------------Filter--------------------
-bSGE4
- ;//---------bSGE4 Execution---------------
- CMP filt, #0
-
- M_LDR pThresholds, ppThresholds
-
- ;// Compute P0b
- UHADD8 t1, p_0, q_1
- BEQ NoFilterFilt0
- MVN t2, p_1
- UHSUB8 t1, t1, t2
- USUB8 t2, filt, m01
- EOR t1, t1, m01, LSL #7
-
- ADD pThresholds,pThresholds, #2
-
- ;// Compute Q0b
- UHADD8 t2, q_0, p_1
- MVN t3, q_1
- UHSUB8 t2, t2, t3
- M_STR pThresholds, ppThresholds
- SEL P_0, t1, p_0
- EOR t2, t2, m01, LSL #7
- SEL Q_0, t2, q_0
-
- SUB pQ0, pQ0, srcdstStep, LSL #1
- B StoreResultAndExit
-
-;//---------- Exit of LoopX --------------
-;//---- for the case of no filtering -----
-
-NoFilterFilt0
-NoFilterBS0
- M_LDR pThresholds, ppThresholds
- SUB pQ0, pQ0, srcdstStep, LSL #1
- SUB pQ0, pQ0, srcdstStep
- ADD pQ0, pQ0, #4
- ADD pThresholds, pThresholds, #2
-
- ;// Load counter for LoopX
- M_LDRD XY, pBS, pXYBS
- M_STR pThresholds, ppThresholds
- M_LDRD alpha, beta, pAlphaBeta0
-
- ;// Align the pointer
- ADDS XY, XY, XY
- M_STR XY, pXYBS
- BCC LoopY
- B ExitLoopY
-
-bSLT4
- ;//---------bSLT4 Execution---------------
- M_LDR pThresholds, ppThresholds
- CMP filt, #0
-
- ;// Since beta <= 18 and alpha <= 255 we know
- ;// -254 <= p0-q0 <= 254
- ;// -17 <= q1-q0 <= 17
- ;// -17 <= p1-p0 <= 17
-
- ;// delta = Clip3( -tC, tC, ((((q0-p0)<<2) + (p1-q1) + 4)>>3))
- ;//
- ;// Calculate A = (((q0-p0)<<2) + (p1-q1) + 4)>>3
- ;// = (4*q0 - 4*p0 + p1 - q1 + 4)>>3
- ;// = ((p1-p0) - (q1-q0) - 3*(p0-q0) + 4)>>3
-
- USUB8 t1, p_1, p_0
- USUB8 t2, q_1, q_0
- BEQ NoFilterFilt0
-
- LDRB tC0, [pThresholds],#1
- SSUB8 t1, t1, t2
- LDRB tC1, [pThresholds],#1
- M_STR pThresholds, ppThresholds
- UHSUB8 t4, p_0, q_0
- ORR tC, tC0, tC1, LSL #16
- USUB8 t5, p_0, q_0
- AND t5, t5, m01
- SHSUB8 t1, t1, t5
- ORR tC, tC, LSL #8
- SSUB8 t1, t1, t5
- SHSUB8 t1, t1, t4
- UQADD8 tC, tC, m01
- SADD8 t1, t1, m01
- USUB8 t5, filt, m01
- SHSUB8 t1, t1, t4
- SEL tC, tC, m00
-
- ;// Split into positive and negative part and clip
-
- SSUB8 t1, t1, m00
- SEL pos, t1, m00
- USUB8 neg, pos, t1
- USUB8 t3, pos, tC
- SEL pos, tC, pos
- USUB8 t3, neg, tC
- SEL neg, tC, neg
- UQADD8 P_0, p_0, pos
- UQSUB8 Q_0, q_0, pos
- UQSUB8 P_0, P_0, neg
- UQADD8 Q_0, Q_0, neg
-
- SUB pQ0, pQ0, srcdstStep, LSL #1
-
- ;// Choose to store the filtered
- ;// value or the original pixel
- USUB8 t1, filt, m01
- SEL P_0, P_0, p_0
- SEL Q_0, Q_0, q_0
-
-StoreResultAndExit
-
- ;//---------Store result---------------
-
- ;// P_0 = [r0p0 r1p0 r2p0 r3p0]
- ;// Q_0 = [r0q0 r1q0 r2q0 r3q0]
-
- M_STR P_0, [pQ0], srcdstStep
- STR Q_0, [pQ0], #4
-
- M_LDRD XY, pBS, pXYBS
- M_LDRD alpha, beta, pAlphaBeta0
-
- SUB pQ0, pQ0, srcdstStep, LSL #1
-
- ADDS XY, XY, XY
- M_STR XY, pXYBS
- BCC LoopX
-
-;//-------- Common Exit of LoopY -----------------
- ;// Align the pointers
-
-ExitLoopY
- ADD pBS, pBS, #4
- M_LDRD alpha, beta, pAlphaBeta1
- SUB pQ0, pQ0, #8
- ADD pQ0, pQ0, srcdstStep, LSL #2
- M_STRD alpha, beta, pAlphaBeta0
-
- BNE LoopY
- MOV r0, #OMX_Sts_NoErr
-
-;//-----------------End Filter--------------------
- M_END
-
- ENDIF
-
- END
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_VerEdge_I_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_VerEdge_I_s.s
deleted file mode 100644
index 2dc9369..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_VerEdge_I_s.s
+++ /dev/null
@@ -1,451 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_FilterDeblockingChroma_VerEdge_I_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
-
- IF ARM1136JS
-
-
-MASK_0 EQU 0x00000000
-MASK_1 EQU 0x01010101
-MASK_2 EQU 0x0000ff00
-LOOP_COUNT EQU 0x50000000
-
-;// Declare input registers
-
-pSrcDst RN 0
-srcdstStep RN 1
-pAlphaArg RN 2
-pBetaArg RN 3
-
-pThresholds RN 6
-pBS RN 9
-pQ0 RN 0
-bS RN 2
-bSTemp RN 10
-
-alpha RN 6
-alpha0 RN 6
-alpha1 RN 8
-
-beta RN 7
-beta0 RN 7
-beta1 RN 9
-
-;// Declare Local/Temporary variables
-
-;// Pixels
-p_0 RN 3
-p_1 RN 5
-q_0 RN 8
-q_1 RN 9
-
-;// Unpacking
-mask RN 11
-
-row0 RN 2
-row1 RN 4
-row2 RN 5
-row3 RN 3
-
-row4 RN 8
-row5 RN 9
-row6 RN 10
-row7 RN 12
-
-tunpk0 RN 2
-tunpk2 RN 10
-tunpk3 RN 12
-
-tunpk4 RN 4
-tunpk5 RN 5
-tunpk6 RN 14
-tunpk7 RN 2
-
-;// Filtering
-
-dp0q0 RN 12
-dp1p0 RN 12
-dq1q0 RN 12
-
-ap0q0 RN 4
-filt RN 2
-
-m00 RN 14
-m01 RN 11
-
-pQ0 RN 0
-Step RN 1
-
-;// Output
-
-P_0 RN 6
-Q_0 RN 7
-
-;//Declarations for bSLT4 kernel
-
-tC RN 12
-tC0 RN 5
-tC1 RN 12
-pos RN 5
-neg RN 9
-
-;//Declarations for bSGE4 kernel
-
-
-;// Miscellanous
-XY RN 8
-
-a RN 10
-t1 RN 10
-t2 RN 12
-t3 RN 14
-t4 RN 6
-t5 RN 5
-
-
- ;// Allocate stack memory
- M_ALLOC4 ppThresholds,4
- M_ALLOC8 pAlphaBeta0,8
- M_ALLOC8 pAlphaBeta1,8
- M_ALLOC8 pXYBS,4
- M_ALLOC4 ppBS,4
-
- ;// Function header
- M_START omxVCM4P10_FilterDeblockingChroma_VerEdge_I, r11
-
- ;//Input arguments on the stack
- M_ARG ppThresholdsArg, 4
- M_ARG ppBSArg, 4
-
- LDRB alpha1, [pAlphaArg,#1]
- LDRB beta1, [pBetaArg,#1]
- M_LDR pThresholds, ppThresholdsArg
- LDR a,=MASK_1
- LDRB beta0, [pBetaArg]
- M_STR pThresholds, ppThresholds
- LDRB alpha0, [pAlphaArg]
-
- MUL alpha1, alpha1, a
- MUL beta1, beta1, a
- MUL alpha0, alpha0, a
- MUL beta0, beta0, a
-
- M_STRD alpha1, beta1, pAlphaBeta1
- M_LDR pBS, ppBSArg
- M_STRD alpha0, beta0, pAlphaBeta0
-
- LDR XY,=LOOP_COUNT
- M_STRD XY, pBS, pXYBS
-
-
-LoopY
-LoopX
-;//---------------Load Pixels-------------------
-
-;//----------------Pack q0-q1-----------------------
- LDRH bS, [pBS], #8
- LDR mask, =MASK_2
-
- M_LDRH row4, [pQ0], srcdstStep
- CMP bS, #0
- M_STR pBS, ppBS
- M_LDRH row5, [pQ0], srcdstStep
- BEQ.W NoFilterBS0
- LDRH row6, [pQ0]
- LDRH row7, [pQ0, srcdstStep]
-
- ;// row4 = [0 0 r0q0 r0q1]
- ;// row5 = [0 0 r1q0 r1q1]
- ;// row6 = [0 0 r2q0 r2q1]
- ;// row7 = [0 0 r3q0 r3q1]
-
- AND tunpk4, mask, row4
- AND tunpk5, mask, row4, LSL#8
- UXTAB tunpk4, tunpk4, row5, ROR#8
- UXTAB tunpk5, tunpk5, row5
- AND tunpk6, mask, row6
- AND tunpk7, mask, row6, LSL#8
- UXTAB tunpk6, tunpk6, row7, ROR#8
- UXTAB tunpk7, tunpk7, row7
-
- ;// tunpk4 = [0 0 r0q0 r1q0]
- ;// tunpk5 = [0 0 r0q1 r1q1]
- ;// tunpk6 = [0 0 r2q0 r3q0]
- ;// tunpk7 = [0 0 r2q1 r3q1]
-
- SUB pQ0, pQ0, srcdstStep, LSL #1
- SUB pQ0, pQ0, #2
-
- PKHBT q_1, tunpk6, tunpk4, LSL#16
- PKHBT q_0, tunpk7, tunpk5, LSL#16
-
- ;// q_0 = [r0q0 r1q0 r2q0 r3q0]
- ;// q_1 = [r0q1 r1q1 r2q1 r3q1]
-
-
-;//----------------Pack p0-p1-----------------------
-
- M_LDRH row0, [pQ0], srcdstStep
- M_LDRH row1, [pQ0], srcdstStep
- LDRH row2, [pQ0]
- LDRH row3, [pQ0, srcdstStep]
-
- ;// row0 = [0 0 r0p0 r0p1]
- ;// row1 = [0 0 r1p0 r1p1]
- ;// row2 = [0 0 r2p0 r2p1]
- ;// row3 = [0 0 r3p0 r3p1]
-
- AND tunpk2, mask, row0
- AND tunpk6, mask, row0, LSL#8
- UXTAB tunpk2, tunpk2, row1, ROR#8
- UXTAB tunpk6, tunpk6, row1
-
- AND tunpk0, mask, row2
- AND tunpk3, mask, row2, LSL#8
- UXTAB tunpk0, tunpk0, row3, ROR#8
- UXTAB tunpk3, tunpk3, row3
-
- ;// tunpk2 = [0 0 r0p0 r1p0]
- ;// tunpk6 = [0 0 r0p1 r1p1]
- ;// tunpk0 = [0 0 r2p0 r3p0]
- ;// tunpk3 = [0 0 r2p1 r3p1]
-
- PKHBT p_0, tunpk0, tunpk2, LSL#16
- M_LDR bSTemp, ppBS
- PKHBT p_1, tunpk3, tunpk6, LSL#16
-
- ;// p_0 = [r0p0 r1p0 r2p0 r3p0]
- ;// p_1 = [r0p1 r1p1 r2p1 r3p1]
-
-;//--------------Filtering Decision -------------------
- USUB8 dp0q0, p_0, q_0
- LDR m01, =MASK_1
- LDRH bSTemp, [bSTemp ,#-8]
- MOV m00, #MASK_0 ;// 00000000 mask
-
- MOV filt, m01
- TST bSTemp, #0xff00
- MOVEQ filt, filt, LSL #16
- TST bSTemp, #0xff
- MOVEQ filt, filt, LSR #16
- TST bSTemp, #4
-
- ;// Check |p0-q0|<Alpha
- USUB8 a, q_0, p_0
- SEL ap0q0, a, dp0q0
- USUB8 a, ap0q0, alpha
- SEL filt, m00, filt
-
- ;// Check |p1-p0|<Beta
- USUB8 dp1p0, p_1, p_0
- USUB8 a, p_0, p_1
- SEL a, a, dp1p0
- USUB8 a, a, beta
- SEL filt, m00, filt
-
- ;// Check |q1-q0|<Beta
- USUB8 dq1q0, q_1, q_0
- USUB8 a, q_0, q_1
- SEL a, a, dq1q0
- USUB8 a, a, beta
- SEL filt, m00, filt
-
- BEQ bSLT4
-;//-------------------Filter--------------------
-bSGE4
- ;//---------bSGE4 Execution---------------
- CMP filt, #0
-
- M_LDR pThresholds, ppThresholds
-
- ;// Compute P0b
- UHADD8 t1, p_0, q_1
- BEQ NoFilterFilt0
- MVN t2, p_1
- UHSUB8 t1, t1, t2
- USUB8 t2, filt, m01
- EOR t1, t1, m01, LSL #7
-
- ADD pThresholds,pThresholds, #4
-
- ;// Compute Q0b
- UHADD8 t2, q_0, p_1
- MVN t3, q_1
- UHSUB8 t2, t2, t3
- M_STR pThresholds, ppThresholds
- SEL P_0, t1, p_0
- EOR t2, t2, m01, LSL #7
- SEL Q_0, t2, q_0
-
- B StoreResultAndExit
-
-;//---------- Exit of LoopX --------------
-;//---- for the case of no filtering -----
-
-NoFilterFilt0
- ADD pQ0, pQ0, #2
-NoFilterBS0
- M_LDR pThresholds, ppThresholds
- SUB pQ0, pQ0, srcdstStep, LSL #1
- ADD pQ0, pQ0, #4
- ADD pThresholds, pThresholds, #4
- ;// Load counter for LoopX
- M_LDRD XY, pBS, pXYBS
- M_STR pThresholds, ppThresholds
- M_LDRD alpha, beta, pAlphaBeta1
-
- ;// Align the pointer
- ADDS XY, XY, XY
- M_STR XY, pXYBS
- BCC LoopY
- B ExitLoopY
-
-bSLT4
- ;//---------bSLT4 Execution---------------
- M_LDR pThresholds, ppThresholds
- CMP filt, #0
-
-
- ;// Since beta <= 18 and alpha <= 255 we know
- ;// -254 <= p0-q0 <= 254
- ;// -17 <= q1-q0 <= 17
- ;// -17 <= p1-p0 <= 17
-
- ;// delta = Clip3( -tC, tC, ((((q0-p0)<<2) + (p1-q1) + 4)>>3))
- ;//
- ;// Calculate A = (((q0-p0)<<2) + (p1-q1) + 4)>>3
- ;// = (4*q0 - 4*p0 + p1 - q1 + 4)>>3
- ;// = ((p1-p0) - (q1-q0) - 3*(p0-q0) + 4)>>3
-
- USUB8 t1, p_1, p_0
- USUB8 t2, q_1, q_0
- BEQ NoFilterFilt0
-
- LDRB tC0, [pThresholds], #1
- SSUB8 t1, t1, t2
- LDRB tC1, [pThresholds], #3
- M_STR pThresholds, ppThresholds
- UHSUB8 t4, p_0, q_0
- ORR tC, tC1, tC0, LSL #16
- USUB8 t5, p_0, q_0
- AND t5, t5, m01
- SHSUB8 t1, t1, t5
- ORR tC, tC, LSL #8
- SSUB8 t1, t1, t5
- SHSUB8 t1, t1, t4
- UQADD8 tC, tC, m01
- SADD8 t1, t1, m01
- USUB8 t5, filt, m01
- SHSUB8 t1, t1, t4
- SEL tC, tC, m00
-
- ;// Split into positive and negative part and clip
-
- SSUB8 t1, t1, m00
- SEL pos, t1, m00
- USUB8 neg, pos, t1
- USUB8 t3, pos, tC
- SEL pos, tC, pos
- USUB8 t3, neg, tC
- SEL neg, tC, neg
- UQADD8 P_0, p_0, pos
- UQSUB8 Q_0, q_0, pos
- UQSUB8 P_0, P_0, neg
- UQADD8 Q_0, Q_0, neg
-
- ;// Choose to store the filtered
- ;// value or the original pixel
- USUB8 t1, filt, m01
- SEL P_0, P_0, p_0
- SEL Q_0, Q_0, q_0
-
-StoreResultAndExit
-
- ;//---------Store result---------------
-
- ;// P_0 = [r0p0 r1p0 r2p0 r3p0]
- ;// Q_0 = [r0q0 r1q0 r2q0 r3q0]
-
- SUB pQ0, pQ0, srcdstStep, LSL #1
- ADD pQ0, pQ0, #1
-
- MOV t1, Q_0, LSR #24
- STRB t1, [pQ0, #1]
- MOV t1, P_0, LSR #24
- M_STRB t1, [pQ0], srcdstStep
-
- MOV t1, Q_0, LSR #16
- STRB t1, [pQ0, #1]
- MOV t1, P_0, LSR #16
- M_STRB t1, [pQ0], srcdstStep
-
- MOV t1, P_0, LSR #8
- STRB t1, [pQ0]
- STRB P_0, [pQ0, srcdstStep]
- MOV t1, Q_0, LSR #8
- STRB t1, [pQ0, #1]!
- STRB Q_0, [pQ0, srcdstStep]
-
- M_LDRD XY, pBS, pXYBS
- M_LDRD alpha, beta, pAlphaBeta1
-
- SUB pQ0, pQ0, srcdstStep, LSL #1
- ADD pQ0, pQ0, #4
-
- ADDS XY, XY, XY
- M_STR XY, pXYBS
- BCC LoopX
-
-;//-------- Common Exit of LoopY -----------------
- ;// Align the pointers
-
-ExitLoopY
-
- M_LDR pThresholds, ppThresholds
- SUB pQ0, pQ0, #8
- ADD pQ0, pQ0, srcdstStep, LSL #2
- SUB pBS, pBS, #14
- SUB pThresholds, pThresholds, #6
- M_STR pThresholds, ppThresholds
-
- M_LDRD alpha, beta, pAlphaBeta0
-
- BNE LoopY
- MOV r0, #OMX_Sts_NoErr
-;//-----------------End Filter--------------------
-
- M_END
-
- ENDIF
-
- END
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_HorEdge_I_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_HorEdge_I_s.s
deleted file mode 100644
index e4fbfa4..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_HorEdge_I_s.s
+++ /dev/null
@@ -1,345 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_FilterDeblockingLuma_HorEdge_I_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
- IMPORT armVCM4P10_DeblockingLumabSLT4_unsafe
- IMPORT armVCM4P10_DeblockingLumabSGE4_unsafe
-
-
-
- IF ARM1136JS
-
-
-MASK_0 EQU 0x00000000
-MASK_1 EQU 0x01010101
-MASK_2 EQU 0xff00ff00
-LOOP_COUNT EQU 0x11110000
-
-;// Declare input registers
-
-pSrcDst RN 0
-srcdstStep RN 1
-pAlphaArg RN 2
-pBetaArg RN 3
-
-pThresholds RN 14
-pBS RN 9
-pQ0 RN 0
-bS RN 2
-
-alpha RN 6
-alpha0 RN 6
-alpha1 RN 8
-
-beta RN 7
-beta0 RN 7
-beta1 RN 9
-
-;// Declare Local/Temporary variables
-
-;// Pixels
-p_0 RN 3
-p_1 RN 5
-p_2 RN 4
-p_3 RN 2
-q_0 RN 8
-q_1 RN 9
-q_2 RN 10
-q_3 RN 12
-
-;// Filtering
-
-dp0q0 RN 12
-dp1p0 RN 12
-dq1q0 RN 12
-dp2p0 RN 12
-dq2q0 RN 12
-
-ap0q0 RN 1
-filt RN 2
-
-m00 RN 14
-m01 RN 11
-
-apflg RN 0
-aqflg RN 6
-apqflg RN 0
-
-
-;//Declarations for bSLT4 kernel
-
-tC0 RN 7
-ptC0 RN 1
-
-pQ0a RN 0
-Stepa RN 1
-maska RN 14
-
-P0a RN 1
-P1a RN 8
-Q0a RN 7
-Q1a RN 11
-
-;//Declarations for bSGE4 kernel
-
-pQ0b RN 0
-Stepb RN 1
-maskb RN 14
-
-P0b RN 6
-P1b RN 7
-P2b RN 1
-P3b RN 3
-
-Q0b RN 9
-Q1b RN 0
-Q2b RN 2
-Q3b RN 3
-
-;// Miscellanous
-XY RN 8
-t0 RN 3
-t1 RN 12
-t2 RN 14
-t7 RN 7
-t4 RN 4
-t5 RN 1
-t8 RN 6
-a RN 0
-
-
-
-
- ;// Allocate stack memory
- M_ALLOC4 ppThresholds,4
- M_ALLOC4 pQ_3,4
- M_ALLOC4 pP_3,4
- M_ALLOC8 pAlphaBeta0,8
- M_ALLOC8 pAlphaBeta1,8
- M_ALLOC8 pXYBS,4
- M_ALLOC4 ppBS,4
- M_ALLOC8 ppQ0Step,4
- M_ALLOC4 pStep,4
-
- ;// Function header
- M_START omxVCM4P10_FilterDeblockingLuma_HorEdge_I, r11
-
- ;//Input arguments on the stack
- M_ARG ppThresholdsArg, 4
- M_ARG ppBSArg, 4
-
- LDR t4,=MASK_1
-
- LDRB alpha0, [pAlphaArg]
- LDRB beta0, [pBetaArg]
- LDRB alpha1, [pAlphaArg,#1]
- LDRB beta1, [pBetaArg,#1]
-
- MUL alpha0, alpha0, t4
- MUL beta0, beta0, t4
- MUL alpha1, alpha1, t4
- MUL beta1, beta1, t4
-
- M_STRD alpha0, beta0, pAlphaBeta0
- M_STRD alpha1, beta1, pAlphaBeta1
-
- LDR XY,=LOOP_COUNT
- M_LDR pBS, ppBSArg
- M_LDR pThresholds, ppThresholdsArg
- M_STR srcdstStep, pStep
- M_STRD XY, pBS, pXYBS
- SUB pQ0, pQ0, srcdstStep, LSL #2
- M_STR pThresholds, ppThresholds
-LoopY
-LoopX
-;//---------------Load Pixels-------------------
- M_STR pQ0, ppQ0Step
- M_LDR p_3, [pQ0], srcdstStep
- M_LDR p_2, [pQ0], srcdstStep
- M_STR p_3, pP_3
- LDRB bS, [pBS], #1
- M_STR pBS, ppBS
- M_LDR p_1, [pQ0], srcdstStep
- CMP bS, #0
- M_LDR p_0, [pQ0], srcdstStep
- M_LDR q_0, [pQ0], srcdstStep
- M_LDR q_1, [pQ0], srcdstStep
- M_LDR q_2, [pQ0], srcdstStep
- M_LDR q_3, [pQ0], srcdstStep
- BEQ NoFilterBS0
- CMP bS, #4
- M_STR q_3, pQ_3
-
-;//--------------Filtering Decision -------------------
- LDR m01, =MASK_1 ;// 01010101 mask
- MOV m00, #MASK_0 ;// 00000000 mask
-
- ;// Check |p0-q0|<Alpha
- USUB8 dp0q0, p_0, q_0
- USUB8 a, q_0, p_0
- SEL ap0q0, a, dp0q0
- USUB8 a, ap0q0, alpha
- SEL filt, m00, m01
-
- ;// Check |p1-p0|<Beta
- USUB8 dp1p0, p_1, p_0
- USUB8 a, p_0, p_1
- SEL a, a, dp1p0
- USUB8 a, a, beta
- SEL filt, m00, filt
-
- ;// Check |q1-q0|<Beta
- USUB8 dq1q0, q_1, q_0
- USUB8 a, q_0, q_1
- SEL a, a, dq1q0
- USUB8 a, a, beta
- SEL filt, m00, filt
-
- ;// Check ap<Beta
- USUB8 dp2p0, p_2, p_0
- USUB8 a, p_0, p_2
- SEL a, a, dp2p0
- USUB8 a, a, beta
- SEL apflg, m00, filt ;// apflg = filt && (ap<beta)
-
- ;// Check aq<Beta
- USUB8 dq2q0, q_2, q_0
- USUB8 t2, q_0, q_2
- SEL t2, t2, dq2q0
- USUB8 t2, t2, beta
- MOV t7,#0
-
- BLT bSLT4
-;//-------------------Filter--------------------
-bSGE4
- ;//---------bSGE4 Execution---------------
- SEL t1, t7, filt ;// aqflg = filt && (aq<beta)
- CMP filt, #0
- ORR apqflg, apflg, t1, LSL #1
- M_LDRD pQ0, srcdstStep, ppQ0Step, EQ
- BEQ NoFilterFilt0
-
- BL armVCM4P10_DeblockingLumabSGE4_unsafe
-
- ;//---------Store result---------------
- M_LDR pThresholds, ppThresholds
- MOV p_2, Q1b
- MOV p_1, P2b
- M_LDRD pQ0b, Stepb, ppQ0Step
- ADD pThresholds, #1
- M_STR pThresholds, ppThresholds
- M_STR p_1, [pQ0b, Stepb]!
- M_STR P1b, [pQ0b, Stepb]!
- M_STR P0b, [pQ0b, Stepb]!
- M_STR Q0b, [pQ0b, Stepb]!
- STR p_2, [pQ0b, Stepb]
- STR Q2b, [pQ0b, Stepb, LSL #1]
-
-
- M_LDRD XY, pBS, pXYBS
- SUB pQ0, pQ0b, Stepb, LSL #2
- ADD pQ0, pQ0, #4
- M_LDRD alpha, beta, pAlphaBeta0
- ADDS XY, XY, XY
- M_STR XY, pXYBS
- BCC LoopX
- B ExitLoopY
-
-;//---------- Exit of LoopX --------------
-;//---- for the case of no filtering -----
-
-NoFilterBS0
- SUB pQ0, pQ0, srcdstStep, LSL #3
-NoFilterFilt0
- ADD pQ0, pQ0, #4
- ;// Load counter for LoopX
- M_LDRD XY, pBS, pXYBS
- M_LDR pThresholds, ppThresholds
- M_LDRD alpha, beta, pAlphaBeta0
-
- ;// Align the pointers
- ADDS XY, XY, XY
- ADD pThresholds, pThresholds, #1
- M_STR pThresholds, ppThresholds
- M_STR XY, pXYBS
- BCC LoopX
- B ExitLoopY
-
-bSLT4
- ;//---------bSLT4 Execution---------------
- SEL aqflg, t7, filt ;// aqflg = filt && (aq<beta)
- M_LDR ptC0, ppThresholds
- CMP filt, #0
- M_LDRD pQ0, srcdstStep, ppQ0Step, EQ
- BEQ NoFilterFilt0
-
- LDRB tC0, [ptC0], #1
- M_STR ptC0, ppThresholds
-
- BL armVCM4P10_DeblockingLumabSLT4_unsafe
-
- ;//---------Store result---------------
- MOV p_2, P0a
- M_LDRD pQ0a, Stepa, ppQ0Step
- M_STR P1a, [pQ0a, Stepa, LSL #1]!
- M_STR p_2, [pQ0a, Stepa]!
- M_STR Q0a, [pQ0a, Stepa]!
- STR Q1a, [pQ0a, Stepa]
-
- ;// Load counter
- M_LDRD XY, pBS, pXYBS
- M_LDRD alpha, beta, pAlphaBeta0
-
- SUB pQ0, pQ0a, Stepa, LSL #2
- ADD pQ0, pQ0, #4
-
- ADDS XY, XY, XY
- M_STR XY, pXYBS
- BCC LoopX
-
-;//-------- Common Exit of LoopY -----------------
- ;// Align the pointers
-ExitLoopY
- M_LDRD alpha, beta, pAlphaBeta1
- SUB pQ0, pQ0, #16
- ADD pQ0, pQ0, srcdstStep, LSL #2
- M_STRD alpha, beta, pAlphaBeta0
-
- BNE LoopY
- MOV r0, #OMX_Sts_NoErr
-;//-----------------End Filter--------------------
- M_END
-
- ENDIF
-
-
- END
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_VerEdge_I_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_VerEdge_I_s.s
deleted file mode 100644
index 6adf27b..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_VerEdge_I_s.s
+++ /dev/null
@@ -1,564 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_FilterDeblockingLuma_VerEdge_I_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
- IMPORT armVCM4P10_DeblockingLumabSLT4_unsafe
- IMPORT armVCM4P10_DeblockingLumabSGE4_unsafe
-
-
- IF ARM1136JS
-
-MASK_0 EQU 0x00000000
-MASK_1 EQU 0x01010101
-MASK_2 EQU 0xff00ff00
-LOOP_COUNT EQU 0x11110000
-
-;// Declare input registers
-
-pSrcDst RN 0
-srcdstStep RN 1
-pAlphaArg RN 2
-pBetaArg RN 3
-
-pThresholds RN 14
-pBS RN 9
-pQ0 RN 0
-bS RN 2
-
-alpha RN 6
-alpha0 RN 6
-alpha1 RN 8
-
-beta RN 7
-beta0 RN 7
-beta1 RN 9
-
-;// Declare Local/Temporary variables
-
-;// Pixels
-p_0 RN 3
-p_1 RN 5
-p_2 RN 4
-p_3 RN 2
-q_0 RN 8
-q_1 RN 9
-q_2 RN 10
-q_3 RN 12
-
-;// Unpacking
-mask RN 11
-
-row0 RN 2
-row1 RN 4
-row2 RN 5
-row3 RN 3
-
-row4 RN 8
-row5 RN 9
-row6 RN 10
-row7 RN 12
-row8 RN 14
-row9 RN 7
-
-tunpk0 RN 8
-tunpk1 RN 9
-tunpk2 RN 10
-tunpk3 RN 12
-tunpk4 RN 0
-
-tunpk5 RN 1
-tunpk6 RN 14
-tunpk7 RN 2
-tunpk8 RN 5
-tunpk9 RN 6
-
-
-;// Filtering
-
-dp0q0 RN 12
-dp1p0 RN 12
-dq1q0 RN 12
-dp2p0 RN 12
-dq2q0 RN 12
-
-ap0q0 RN 1
-filt RN 2
-
-m00 RN 14
-m01 RN 11
-
-apflg RN 0
-aqflg RN 6
-apqflg RN 0
-
-
-;//Declarations for bSLT4 kernel
-
-tC0 RN 7
-ptC0 RN 1
-
-pQ0a RN 0
-Stepa RN 1
-maska RN 14
-
-P0a RN 1
-P1a RN 8
-Q0a RN 7
-Q1a RN 11
-
-;//Declarations for bSGE4 kernel
-
-pQ0b RN 0
-Stepb RN 1
-maskb RN 14
-
-P0b RN 6
-P1b RN 7
-P2b RN 1
-P3b RN 3
-
-Q0b RN 9
-Q1b RN 0
-Q2b RN 2
-Q3b RN 3
-
-;// Miscellanous
-XY RN 8
-t0 RN 3
-t1 RN 12
-t2 RN 14
-t7 RN 7
-t4 RN 4
-t5 RN 1
-t8 RN 6
-a RN 0
-
-
-
- ;// Allocate stack memory
- M_ALLOC4 ppThresholds,4
- M_ALLOC4 pQ_3,4
- M_ALLOC4 pP_3,4
- M_ALLOC8 pAlphaBeta0,8
- M_ALLOC8 pAlphaBeta1,8
- M_ALLOC8 pXYBS,4
- M_ALLOC4 ppBS,4
- M_ALLOC8 ppQ0Step,4
- M_ALLOC4 pStep,4
-
- ;// Function header
- M_START omxVCM4P10_FilterDeblockingLuma_VerEdge_I, r11
-
- ;//Input arguments on the stack
- M_ARG ppThresholdsArg, 4
- M_ARG ppBSArg, 4
-
- LDR t4,=MASK_1
-
- LDRB alpha0, [pAlphaArg]
- LDRB beta0, [pBetaArg]
- LDRB alpha1, [pAlphaArg,#1]
- LDRB beta1, [pBetaArg,#1]
-
- MUL alpha0, alpha0, t4
- MUL beta0, beta0, t4
- MUL alpha1, alpha1, t4
- MUL beta1, beta1, t4
-
- M_STRD alpha0, beta0, pAlphaBeta0
- M_STRD alpha1, beta1, pAlphaBeta1
-
- LDR XY,=LOOP_COUNT
- M_LDR pBS, ppBSArg
- M_LDR pThresholds, ppThresholdsArg
- M_STR srcdstStep, pStep
- M_STRD XY, pBS, pXYBS
- M_STR pThresholds, ppThresholds
-
- SUB pQ0, pQ0, #4
-LoopY
-;//---------------Load Pixels-------------------
-
-;//----------------Pack p0-p3-----------------------
- LDR mask, =MASK_2
-
- M_LDR row0, [pQ0], srcdstStep
- M_LDR row1, [pQ0], srcdstStep
- LDR row2, [pQ0]
- LDR row3, [pQ0, srcdstStep]
- SUB pQ0, pQ0, srcdstStep, LSL #1
-
- ;// row0 = [r0p0 r0p1 r0p2 r0p3]
- ;// row1 = [r1p0 r1p1 r1p2 r1p3]
- ;// row2 = [r2p0 r2p1 r2p2 r2p3]
- ;// row3 = [r3p0 r3p1 r3p2 r3p3]
-
- AND tunpk0, mask, row0
- AND tunpk6, mask, row0, LSL#8
- UXTAB16 tunpk0, tunpk0, row1, ROR#8
- UXTAB16 tunpk6, tunpk6, row1
- AND tunpk2, mask, row2
- AND tunpk3, mask, row2, LSL#8
- UXTAB16 tunpk2, tunpk2, row3, ROR#8
- UXTAB16 tunpk3, tunpk3, row3
-
- ;// tunpk0 = [r0p0 r1p0 r0p2 r1p2]
- ;// tunpk6 = [r0p1 r1p1 r0p3 r1p3]
- ;// tunpk2 = [r2p0 r3p0 r2p2 r3p2]
- ;// tunpk3 = [r2p1 r3p1 r2p3 r3p3]
-
- PKHTB p_0, tunpk0, tunpk2, ASR#16
- PKHTB p_1, tunpk6, tunpk3, ASR#16
- PKHBT p_2, tunpk2, tunpk0, LSL#16
- PKHBT p_3, tunpk3, tunpk6, LSL#16
-
-
- ;// p_0 = [r0p0 r1p0 r2p0 r3p0]
- ;// p_1 = [r0p1 r1p1 r2p1 r3p1]
- ;// p_2 = [r0p2 r1p2 r2p1 r3p2]
- ;// p_3 = [r0p3 r1p3 r2p3 r3p3]
-
- M_STR p_3, pP_3
-
-;//----------------Pack q0-q3-----------------------
-LoopX
- LDRB bS, [pBS], #4
- M_STR pQ0, ppQ0Step
- LDR mask, =MASK_2
- CMP bS, #0
- M_STR pBS, ppBS
-
- LDR row4, [pQ0, #4]!
- BEQ.W NoFilterBS0
- M_LDR row5, [pQ0, srcdstStep]!
- M_LDR row6, [pQ0, srcdstStep]!
- M_LDR row7, [pQ0, srcdstStep]
-
- ;// row4 = [r0q3 r0q2 r0q1 r0q0]
- ;// row5 = [r1q3 r1q2 r1q1 r1q0]
- ;// row6 = [r2q3 r2q2 r2q1 r2q0]
- ;// row7 = [r3q3 r3q2 r3q1 r3q0]
-
- AND tunpk4, mask, row4
- CMP bS, #4
- AND tunpk5, mask, row4, LSL#8
- UXTAB16 tunpk4, tunpk4, row5, ROR#8
- UXTAB16 tunpk5, tunpk5, row5
- AND tunpk6, mask, row6
- AND tunpk7, mask, row6, LSL#8
- UXTAB16 tunpk6, tunpk6, row7, ROR#8
- UXTAB16 tunpk7, tunpk7, row7
-
- ;// tunpk4 = [r0q0 r1q0 r0q2 r1q2]
- ;// tunpk5 = [r0q1 r1q1 r0q3 r1q3]
- ;// tunpk6 = [r2q0 r3q0 r2q2 r3q2]
- ;// tunpk7 = [r2q1 r3q1 r2q3 r3q3]
-
- PKHTB q_3, tunpk4, tunpk6, ASR#16
- PKHTB q_2, tunpk5, tunpk7, ASR#16
- PKHBT q_1, tunpk6, tunpk4, LSL#16
- M_STR q_3, pQ_3
- PKHBT q_0, tunpk7, tunpk5, LSL#16
-
-
- ;// q_0 = [r0q0 r1q0 r2q0 r3q0]
- ;// q_1 = [r0q1 r1q1 r2q1 r3q1]
- ;// q_2 = [r0q2 r1q2 r2q1 r3q2]
- ;// q_3 = [r0q3 r1q3 r2q3 r3q3]
-
-
-;//--------------Filtering Decision -------------------
- LDR m01, =MASK_1 ;// 01010101 mask
- MOV m00, #MASK_0 ;// 00000000 mask
-
- ;// Check |p0-q0|<Alpha
- USUB8 dp0q0, p_0, q_0
- USUB8 a, q_0, p_0
- SEL ap0q0, a, dp0q0
- USUB8 a, ap0q0, alpha
- SEL filt, m00, m01
-
- ;// Check |p1-p0|<Beta
- USUB8 dp1p0, p_1, p_0
- USUB8 a, p_0, p_1
- SEL a, a, dp1p0
- USUB8 a, a, beta
- SEL filt, m00, filt
-
- ;// Check |q1-q0|<Beta
- USUB8 dq1q0, q_1, q_0
- USUB8 a, q_0, q_1
- SEL a, a, dq1q0
- USUB8 a, a, beta
- SEL filt, m00, filt
-
- ;// Check ap<Beta
- USUB8 dp2p0, p_2, p_0
- USUB8 a, p_0, p_2
- SEL a, a, dp2p0
- USUB8 a, a, beta
- SEL apflg, m00, filt ;// apflg = filt && (ap<beta)
-
- ;// Check aq<Beta
- USUB8 dq2q0, q_2, q_0
- USUB8 t2, q_0, q_2
- SEL t2, t2, dq2q0
- USUB8 t2, t2, beta
- MOV t7,#0
-
-
- BLT bSLT4
-;//-------------------Filter--------------------
-bSGE4
- ;//---------bSGE4 Execution---------------
- SEL t1, t7, filt ;// aqflg = filt && (aq<beta)
- CMP filt, #0
- ORR apqflg, apflg, t1, LSL #1
- M_LDRD pQ0, srcdstStep, ppQ0Step, EQ
- BEQ NoFilterFilt0
-
- BL armVCM4P10_DeblockingLumabSGE4_unsafe
-
- ;//---------Store result---------------
-
- LDR maskb,=MASK_2
-
- ;// P0b = [r0p0 r1p0 r2p0 r3p0]
- ;// P1b = [r0p1 r1p1 r2p1 r3p1]
- ;// P2b = [r0p2 r1p2 r2p2 r3p2]
- ;// P3b = [r0p3 r1p3 r2p3 r3p3]
-
- M_LDR P3b, pP_3
- M_STR Q0b, pP_3
-
- ;//------Pack p0-p3------
- AND tunpk0, maskb, P0b
- AND tunpk2, maskb, P0b, LSL#8
- UXTAB16 tunpk0, tunpk0, P1b, ROR#8
- UXTAB16 tunpk2, tunpk2, P1b
-
- AND tunpk3, maskb, P2b
- AND tunpk8, maskb, P2b, LSL#8
- UXTAB16 tunpk3, tunpk3, P3b, ROR#8
- UXTAB16 tunpk8, tunpk8, P3b
-
- ;// tunpk0 = [r0p0 r0p1 r2p0 r2p1]
- ;// tunpk2 = [r1p0 r1p1 r3p0 r3p1]
- ;// tunpk3 = [r0p2 r0p3 r2p2 r2p3]
- ;// tunpk8 = [r1p2 r1p3 r3p2 r3p3]
-
- MOV p_2, Q1b
- M_LDRD pQ0b, Stepb, ppQ0Step
-
- PKHTB row9, tunpk0, tunpk3, ASR#16
- PKHBT row7, tunpk3, tunpk0, LSL#16
- PKHTB row3, tunpk2, tunpk8, ASR#16
- PKHBT row6, tunpk8, tunpk2, LSL#16
-
- ;// row9 = [r0p0 r0p1 r0p2 r0p3]
- ;// row3 = [r1p0 r1p1 r1p2 r1p3]
- ;// row7 = [r2p0 r2p1 r2p2 r2p3]
- ;// row6 = [r3p0 r3p1 r3p2 r3p3]
-
- M_STR row9, [pQ0b], Stepb
- STR row7, [pQ0b, Stepb]
- STR row6, [pQ0b, Stepb, LSL #1]
- STR row3, [pQ0b], #4
-
- M_LDR Q3b, pQ_3
-
- ;// Q0b = [r0q0 r1q0 r2q0 r3q0]
- ;// Q1b = [r0q1 r1q1 r2q1 r3q1]
- ;// Q2b = [r0q2 r1q2 r2q2 r3q2]
- ;// Q3b = [r0q3 r1q3 r2q3 r3q3]
-
- ;//------Pack q0-q3------
- AND tunpk0, maskb, p_2
- AND tunpk2, maskb, p_2, LSL#8
- UXTAB16 tunpk0, tunpk0, Q0b, ROR#8
- UXTAB16 tunpk2, tunpk2, Q0b
-
- AND tunpk3, maskb, Q3b
- AND tunpk8, maskb, Q3b, LSL#8
- UXTAB16 tunpk3, tunpk3, Q2b, ROR#8
- UXTAB16 tunpk8, tunpk8, Q2b
-
- ;// tunpk0 = [r0q1 r0q0 r2q1 r2q0]
- ;// tunpk2 = [r1q1 r1q0 r3q1 r3q0]
- ;// tunpk3 = [r0q3 r0q2 r2q3 r2q2]
- ;// tunpk8 = [r1q3 r1q2 r3q3 r3q2]
-
- PKHTB row8, tunpk3, tunpk0, ASR#16
- PKHBT row7, tunpk0, tunpk3, LSL#16
- PKHTB row4, tunpk8, tunpk2, ASR#16
- PKHBT row6, tunpk2, tunpk8, LSL#16
-
- ;// row8 = [r0q0 r0q1 r0q2 r0q3]
- ;// row4 = [r1q0 r1q1 r1q2 r1q3]
- ;// row7 = [r2q0 r2q1 r2q2 r2q3]
- ;// row6 = [r3q0 r3q1 r3q2 r3q3]
-
- STR row4, [pQ0b]
- STR row7, [pQ0b, Stepb]
- STR row6, [pQ0b, Stepb, LSL #1]
-
- SUB pQ0, pQ0b, Stepb
- MOV p_1, Q2b
-
- STR row8, [pQ0]
-
- M_LDRD XY, pBS, pXYBS
- M_LDR pThresholds, ppThresholds
- M_LDRD alpha, beta, pAlphaBeta1
-
- ADDS XY, XY, XY
- ADD pThresholds, #4
- M_STR pThresholds, ppThresholds
- M_STR XY, pXYBS
- BCC LoopX
- B ExitLoopY
-
-;//---------- Exit of LoopX --------------
-;//---- for the case of no filtering -----
-
-NoFilterFilt0
- ADD pQ0, pQ0, #4
-NoFilterBS0
- ;// Load counter for LoopX
- M_LDRD XY, pBS, pXYBS
- M_LDR pThresholds, ppThresholds
- M_LDRD alpha, beta, pAlphaBeta1
-
- ;// Align the pointer
- ADDS XY, XY, XY
- ADD pThresholds, pThresholds, #4
- M_STR pThresholds, ppThresholds
- M_STR XY, pXYBS
- BCC LoopY
- B ExitLoopY
-
-bSLT4
- ;//---------bSLT4 Execution---------------
- SEL aqflg, t7, filt ;// aqflg = filt && (aq<beta)
- M_LDR ptC0, ppThresholds
- CMP filt, #0
- M_LDRD pQ0, srcdstStep, ppQ0Step, EQ
- BEQ NoFilterFilt0
-
- LDRB tC0, [ptC0], #4
- M_STR ptC0, ppThresholds
-
- BL armVCM4P10_DeblockingLumabSLT4_unsafe
-
- ;//---------Store result---------------
- ;//--------Pack p1,p0,q1,q0------------
-
- ;//Load destination pointer
- LDR maska,=MASK_2
- M_STR Q0a, pP_3
- MOV p_1, q_2
-
- ;// P1a = [r0p1 r1p1 r2p1 r3p1]
- ;// P0a = [r0p0 r1p0 r2p0 r3p0]
- ;// Q0a = [r0q0 r1q0 r2q0 r3q0]
- ;// Q1a = [r0q1 r1q1 r2q1 r3q1]
-
- AND tunpk1, maska, P0a
- AND tunpk2, maska, P0a, LSL#8
- UXTAB16 tunpk1, tunpk1, P1a, ROR#8
- UXTAB16 tunpk2, tunpk2, P1a
-
- M_LDRD pQ0a, Stepa, ppQ0Step
-
- AND tunpk9, maska, Q1a
- AND tunpk3, maska, Q1a, LSL#8
- UXTAB16 tunpk9, tunpk9, Q0a, ROR#8
- UXTAB16 tunpk3, tunpk3, Q0a
-
- ;// tunpk1 = [r0p0 r0p1 r2p0 r2p1]
- ;// tunpk2 = [r1p0 r1p1 r3p0 r3p1]
- ;// tunpk9 = [r0q1 r0q0 r2q1 r2q0]
- ;// tunpk3 = [r1q1 r1q0 r3q1 r3q0]
-
- MOV t4, tunpk1, LSR #16
- MOV t0, tunpk9, LSR #16
-
- STRH t4,[pQ0a, #2]! ;//Stores [r0p0 r0p1]
- STRH t0,[pQ0a, #2] ;//Stores [r0q0 r0q1]
-
- MOV t4, tunpk2, LSR #16
- MOV t0, tunpk3, LSR #16
-
- M_STRH t4,[pQ0a, Stepa]! ;//Stores [r1p0 r1p1]
- STRH t0,[pQ0a, #2] ;//Stores [r1q0 r1q1]
-
- M_STRH tunpk1,[pQ0a, Stepa]! ;//Stores [r2p0 r2p1]
- STRH tunpk2,[pQ0a, Stepa] ;//Stores [r3p0 r3p1]
- STRH tunpk9,[pQ0a, #2]! ;//Stores [r2q0 r2q1]
- STRH tunpk3,[pQ0a, Stepa] ;//Stores [r3q0 r3q1]
-
- SUB pQ0, pQ0a, Stepa, LSL #1
-
- ;// Load counter
- M_LDRD XY, pBS, pXYBS
-
- ;// Reload Pixels
- M_LDR p_0, pQ_3
- MOV p_2, Q1a
-
- M_LDRD alpha, beta, pAlphaBeta1
-
- ADDS XY, XY, XY
- M_STR XY, pXYBS
- BCC LoopX
-
-;//-------- Common Exit of LoopY -----------------
- ;// Align the pointers
- M_LDR pThresholds, ppThresholds
-ExitLoopY
- SUB pQ0, pQ0, #16
- ADD pQ0, pQ0, srcdstStep, LSL #2
- SUB pBS, pBS, #15
- SUB pThresholds, pThresholds, #15
- M_STR pThresholds, ppThresholds
-
- M_LDRD alpha, beta, pAlphaBeta0
-
- BNE LoopY
- MOV r0, #OMX_Sts_NoErr
-
- M_END
-;//-----------------End Filter--------------------
-
- ENDIF
-
- END
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_InterpolateChroma.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_InterpolateChroma.c
deleted file mode 100644
index 63d185f..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_InterpolateChroma.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_InterpolateChroma.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate 1/8 Pixel interpolation for Chroma Block
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-
-/**
- * Function: omxVCM4P10_InterpolateChroma,
- *
- * Description:
- * Performs 1/8-pixel interpolation for inter chroma MB.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrc Pointer to the source reference frame buffer
- * [in] srcStep Reference frame step in byte
- * [in] dstStep Destination frame step in byte. Must be multiple of roi.width.
- * [in] dx Fractional part of horizontal motion vector component
- * in 1/8 pixel unit;valid in the range [0,7]
- * [in] dy Fractional part of vertical motion vector component
- * in 1/8 pixel unit;valid in the range [0,7]
- * [in] roi Dimension of the interpolation region;the parameters roi.width and roi.height must
- * be equal to either 2, 4, or 8.
- * [out] pDst Pointer to the destination frame buffer.
- * if roi.width==2, 2-byte alignment required
- * if roi.width==4, 4-byte alignment required
- * if roi.width==8, 8-byte alignment required
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns OMX_Sts_BadArgErr:
- * pSrc or pDst is NULL.
- * srcStep or dstStep < 8.
- * dx or dy is out of range [0-7].
- * roi.width or roi.height is out of range {2,4,8}.
- * roi.width is equal to 2, but pDst is not 2-byte aligned.
- * roi.width is equal to 4, but pDst is not 4-byte aligned.
- * roi.width is equal to 8, but pDst is not 8 byte aligned.
- * srcStep or dstStep is not a multiple of 8.
- *
- */
-
-OMXResult omxVCM4P10_InterpolateChroma (
- const OMX_U8* pSrc,
- OMX_S32 srcStep,
- OMX_U8* pDst,
- OMX_S32 dstStep,
- OMX_S32 dx,
- OMX_S32 dy,
- OMXSize roi
- )
-{
- return armVCM4P10_Interpolate_Chroma
- ((OMX_U8*)pSrc, srcStep, pDst, dstStep, roi.width, roi.height, dx, dy);
-}
-
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_InterpolateLuma_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_InterpolateLuma_s.s
deleted file mode 100644
index cb3b4e2..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_InterpolateLuma_s.s
+++ /dev/null
@@ -1,440 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_InterpolateLuma_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
-;// Function:
-;// omxVCM4P10_InterpolateLuma
-;//
-;// This function implements omxVCM4P10_InterpolateLuma in v6 assembly.
-;// Performs quarter pel interpolation of inter luma MB.
-;// It's assumed that the frame is already padded when calling this function.
-;// Parameters:
-;// [in] pSrc Pointer to the source reference frame buffer
-;// [in] srcStep Reference frame step in byte
-;// [in] dstStep Destination frame step in byte. Must be multiple of roi.width
-;// [in] dx Fractional part of horizontal motion vector
-;// component in 1/4 pixel unit; valid in the range [0,3]
-;// [in] dy Fractional part of vertical motion vector
-;// component in 1/4 pixel unit; valid in the range [0,3]
-;// [in] roi Dimension of the interpolation region;the parameters roi.width and roi.height must
-;// be equal to either 4, 8, or 16.
-;// [out] pDst Pointer to the destination frame buffer.
-;// if roi.width==4, 4-byte alignment required
-;// if roi.width==8, 8-byte alignment required
-;// if roi.width==16, 16-byte alignment required
-;//
-;// Return Value:
-;// If the function runs without error, it returns OMX_Sts_NoErr.
-;// It is assued that following cases are satisfied before calling this function:
-;// pSrc or pDst is not NULL.
-;// srcStep or dstStep >= roi.width.
-;// dx or dy is in the range [0-3].
-;// roi.width or roi.height is not out of range {4, 8, 16}.
-;// If roi.width is equal to 4, Dst is 4 byte aligned.
-;// If roi.width is equal to 8, pDst is 8 byte aligned.
-;// If roi.width is equal to 16, pDst is 16 byte aligned.
-;// srcStep and dstStep is multiple of 8.
-;//
-;//
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
- EXPORT omxVCM4P10_InterpolateLuma
-
- IF ARM1136JS
- IMPORT armVCM4P10_InterpolateLuma_Copy4x4_unsafe
- IMPORT armVCM4P10_InterpolateLuma_HorAlign9x_unsafe
- IMPORT armVCM4P10_InterpolateLuma_VerAlign4x_unsafe
- IMPORT armVCM4P10_Average_4x4_Align0_unsafe
- IMPORT armVCM4P10_Average_4x4_Align2_unsafe
- IMPORT armVCM4P10_Average_4x4_Align3_unsafe
- IMPORT armVCM4P10_InterpolateLuma_HorDiagCopy_unsafe
- IMPORT armVCM4P10_InterpolateLuma_VerDiagCopy_unsafe
- ENDIF
-
- IF ARM1136JS
- IMPORT armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- IMPORT armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- IMPORT armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe
- IMPORT armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe
- ENDIF
-
-
-
-;// Declare input registers
-pSrc RN 0
-srcStep RN 1
-pDst RN 2
-dstStep RN 3
-iHeight RN 4
-iWidth RN 5
-
-;// Declare other intermediate registers
-idx RN 6
-idy RN 7
-index RN 6
-Temp RN 12
-pArgs RN 11
-
-
- ;// End of CortexA8
-
-;//-------------------------------------------------------------------------------------------------------------------------
-;//-------------------------------------------------------------------------------------------------------------------------
- IF ARM1136JS
-
-
- M_ALLOC4 ppDst, 8
- M_ALLOC4 ppSrc, 8
- M_ALLOC4 ppArgs, 16
- M_ALLOC4 pBuffer, 120 ;// 120 = 12x10
- M_ALLOC8 pInterBuf, 120 ;// 120 = 12*5*2
- M_ALLOC8 pTempBuf, 32 ;// 32 = 8*4
-
- ;// Function header
- ;// Interpolation of luma is implemented by processing block of pixels, size 4x4 at a time.
- ;// Depending on the values of motion vector fractional parts (dx,dy), one out of 16 cases will be processed.
- ;// Registers r4, r5, r6 to be preserved by internal unsafe functions
- ;// r4 - iHeight
- ;// r5 - iWidth
- ;// r6 - index
- M_START omxVCM4P10_InterpolateLuma, r11
-
-;// Declare other intermediate registers
-idx RN 6
-idy RN 7
-index RN 6
-Temp RN 12
-pArgs RN 11
-
-pBuf RN 8
-Height RN 9
-bufStep RN 9
-
- ;// Define stack arguments
- M_ARG ptridx, 4
- M_ARG ptridy, 4
- M_ARG ptrWidth, 4
- M_ARG ptrHeight, 4
-
- ;// Load structure elements of roi
- M_LDR idx, ptridx
- M_LDR idy, ptridy
- M_LDR iWidth, ptrWidth
- M_LDR iHeight, ptrHeight
-
- M_PRINTF "roi.width %d\n", iWidth
- M_PRINTF "roi.height %d\n", iHeight
-
- ADD index, idx, idy, LSL #2 ;// [index] = [idy][idx]
- M_ADR pArgs, ppArgs
-
-InterpolateLuma
-Block4x4WidthLoop
-Block4x4HeightLoop
-
- STM pArgs, {pSrc,srcStep,pDst,dstStep}
- M_ADR pBuf, pBuffer
-
- ;// switch table using motion vector as index
- M_SWITCH index, L
- M_CASE Case_0
- M_CASE Case_1
- M_CASE Case_2
- M_CASE Case_3
- M_CASE Case_4
- M_CASE Case_5
- M_CASE Case_6
- M_CASE Case_7
- M_CASE Case_8
- M_CASE Case_9
- M_CASE Case_a
- M_CASE Case_b
- M_CASE Case_c
- M_CASE Case_d
- M_CASE Case_e
- M_CASE Case_f
- M_ENDSWITCH
-
-Case_0
- ;// Case G
- M_PRINTF "Case 0 \n"
-
- BL armVCM4P10_InterpolateLuma_Copy4x4_unsafe
- B Block4x4LoopEnd
-
-Case_1
- ;// Case a
- M_PRINTF "Case 1 \n"
-
- SUB pSrc, pSrc, #2
- MOV Height, #4
- BL armVCM4P10_InterpolateLuma_HorAlign9x_unsafe
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- BL armVCM4P10_Average_4x4_Align2_unsafe
- B Block4x4LoopEnd
-Case_2
- ;// Case b
- M_PRINTF "Case 2 \n"
-
- SUB pSrc, pSrc, #2
- MOV Height, #4
- BL armVCM4P10_InterpolateLuma_HorAlign9x_unsafe
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- B Block4x4LoopEnd
-Case_3
- ;// Case c
- M_PRINTF "Case 3 \n"
-
- SUB pSrc, pSrc, #2
- MOV Height, #4
- BL armVCM4P10_InterpolateLuma_HorAlign9x_unsafe
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- BL armVCM4P10_Average_4x4_Align3_unsafe
- B Block4x4LoopEnd
-Case_4
- ;// Case d
- M_PRINTF "Case 4 \n"
-
- SUB pSrc, pSrc, srcStep, LSL #1
- MOV Height, #9
- BL armVCM4P10_InterpolateLuma_VerAlign4x_unsafe
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- BL armVCM4P10_Average_4x4_Align0_unsafe
-
- B Block4x4LoopEnd
-Case_5
- ;// Case e
- M_PRINTF "Case 5 \n"
-
- SUB pSrc, pSrc, #2
- MOV Height, #4
- M_ADR pDst, pTempBuf
- MOV dstStep, #4
- BL armVCM4P10_InterpolateLuma_HorAlign9x_unsafe
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- M_ADR pArgs, ppArgs
- LDM pArgs, {pSrc, srcStep, pDst, dstStep}
- SUB pSrc, pSrc, srcStep, LSL #1
- M_ADR pBuf, pBuffer
- MOV Height, #9
- BL armVCM4P10_InterpolateLuma_VerAlign4x_unsafe
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- M_ADR pSrc, pTempBuf
- MOV srcStep, #4
- BL armVCM4P10_Average_4x4_Align0_unsafe
-
-
- B Block4x4LoopEnd
-Case_6
- ;// Case f
- M_PRINTF "Case 6 \n"
-
- SUB pSrc, pSrc, #2
- SUB pSrc, pSrc, srcStep, LSL #1
- MOV Height, #9
- BL armVCM4P10_InterpolateLuma_HorAlign9x_unsafe
- M_ADR pBuf, pInterBuf
- BL armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe
- M_ADR idy, pTempBuf
- BL armVCM4P10_InterpolateLuma_VerDiagCopy_unsafe
- BL armVCM4P10_Average_4x4_Align0_unsafe
- B Block4x4LoopEnd
-Case_7
- ;// Case g
- M_PRINTF "Case 7 \n"
-
- SUB pSrc, pSrc, #2
- MOV Height, #4
- M_ADR pDst, pTempBuf
- MOV dstStep, #4
- BL armVCM4P10_InterpolateLuma_HorAlign9x_unsafe
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- M_ADR pArgs, ppArgs
- LDM pArgs, {pSrc, srcStep, pDst, dstStep}
- SUB pSrc, pSrc, srcStep, LSL #1
- ADD pSrc, pSrc, #1
- M_ADR pBuf, pBuffer
- MOV Height, #9
- BL armVCM4P10_InterpolateLuma_VerAlign4x_unsafe
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- M_ADR pSrc, pTempBuf
- MOV srcStep, #4
- BL armVCM4P10_Average_4x4_Align0_unsafe
-
- B Block4x4LoopEnd
-Case_8
- ;// Case h
- M_PRINTF "Case 8 \n"
-
- SUB pSrc, pSrc, srcStep, LSL #1
- MOV Height, #9
- BL armVCM4P10_InterpolateLuma_VerAlign4x_unsafe
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- B Block4x4LoopEnd
-Case_9
- ;// Case i
- M_PRINTF "Case 9 \n"
-
- SUB pSrc, pSrc, #2
- SUB pSrc, pSrc, srcStep, LSL #1
- MOV Height, #9
- BL armVCM4P10_InterpolateLuma_HorAlign9x_unsafe
- ADD pSrc, pSrc, srcStep, LSL #1
- M_ADR pBuf, pInterBuf
- BL armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe
- M_ADR idy, pTempBuf
- BL armVCM4P10_InterpolateLuma_HorDiagCopy_unsafe
- BL armVCM4P10_Average_4x4_Align2_unsafe
- B Block4x4LoopEnd
-Case_a
- ;// Case j
- M_PRINTF "Case a \n"
-
- SUB pSrc, pSrc, #2
- SUB pSrc, pSrc, srcStep, LSL #1
- MOV Height, #9
- BL armVCM4P10_InterpolateLuma_HorAlign9x_unsafe
- ADD pSrc, pSrc, srcStep, LSL #1
- M_ADR pBuf, pInterBuf
- BL armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe
- B Block4x4LoopEnd
-Case_b
- ;// Case k
- M_PRINTF "Case b \n"
- SUB pSrc, pSrc, #2
- SUB pSrc, pSrc, srcStep, LSL #1
- MOV Height, #9
- BL armVCM4P10_InterpolateLuma_HorAlign9x_unsafe
- ADD pSrc, pSrc, srcStep, LSL #1
- M_ADR pBuf, pInterBuf
- BL armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe
- M_ADR idy, pTempBuf
- BL armVCM4P10_InterpolateLuma_HorDiagCopy_unsafe
- BL armVCM4P10_Average_4x4_Align3_unsafe
- B Block4x4LoopEnd
-Case_c
- ;// Case n
- M_PRINTF "Case c \n"
-
- SUB pSrc, pSrc, srcStep, LSL #1
- MOV Height, #9
- BL armVCM4P10_InterpolateLuma_VerAlign4x_unsafe
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- ADD pSrc, pSrc, srcStep ;// Update pSrc to one row down
- BL armVCM4P10_Average_4x4_Align0_unsafe
- B Block4x4LoopEnd
-Case_d
- ;// Case p
- M_PRINTF "Case d \n"
- SUB pSrc, pSrc, #2
- ADD pSrc, pSrc, srcStep
- MOV Height, #4
- M_ADR pDst, pTempBuf
- MOV dstStep, #4
- BL armVCM4P10_InterpolateLuma_HorAlign9x_unsafe
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- M_ADR pArgs, ppArgs
- LDM pArgs, {pSrc, srcStep, pDst, dstStep}
- SUB pSrc, pSrc, srcStep, LSL #1
- M_ADR pBuf, pBuffer
- MOV Height, #9
- BL armVCM4P10_InterpolateLuma_VerAlign4x_unsafe
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- M_ADR pSrc, pTempBuf
- MOV srcStep, #4
- BL armVCM4P10_Average_4x4_Align0_unsafe
- B Block4x4LoopEnd
-Case_e
- ;// Case q
- M_PRINTF "Case e \n"
-
- SUB pSrc, pSrc, #2
- SUB pSrc, pSrc, srcStep, LSL #1
- MOV Height, #9
- BL armVCM4P10_InterpolateLuma_HorAlign9x_unsafe
- M_ADR pBuf, pInterBuf
- BL armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe
- M_ADR idy, pTempBuf
- BL armVCM4P10_InterpolateLuma_VerDiagCopy_unsafe
- ADD pSrc, pSrc, #4
- BL armVCM4P10_Average_4x4_Align0_unsafe
-
- B Block4x4LoopEnd
-Case_f
- ;// Case r
- M_PRINTF "Case f \n"
- SUB pSrc, pSrc, #2
- ADD pSrc, pSrc, srcStep
- MOV Height, #4
- M_ADR pDst, pTempBuf
- MOV dstStep, #4
- BL armVCM4P10_InterpolateLuma_HorAlign9x_unsafe
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- M_ADR pArgs, ppArgs
- LDM pArgs, {pSrc, srcStep, pDst, dstStep}
- SUB pSrc, pSrc, srcStep, LSL #1
- ADD pSrc, pSrc, #1
- M_ADR pBuf, pBuffer
- MOV Height, #9
- BL armVCM4P10_InterpolateLuma_VerAlign4x_unsafe
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- M_ADR pSrc, pTempBuf
- MOV srcStep, #4
- BL armVCM4P10_Average_4x4_Align0_unsafe
-
-Block4x4LoopEnd
-
- ;// Width Loop
- SUBS iWidth, iWidth, #4
- M_ADR pArgs, ppArgs
- LDM pArgs, {pSrc,srcStep,pDst,dstStep} ;// Load arguments
- ADD pSrc, pSrc, #4
- ADD pDst, pDst, #4
- BGT Block4x4WidthLoop
-
- ;// Height Loop
- SUBS iHeight, iHeight, #4
- M_LDR iWidth, ptrWidth
- M_ADR pArgs, ppArgs
- ADD pSrc, pSrc, srcStep, LSL #2
- ADD pDst, pDst, dstStep, LSL #2
- SUB pSrc, pSrc, iWidth
- SUB pDst, pDst, iWidth
- BGT Block4x4HeightLoop
-
-EndOfInterpolation
- MOV r0, #0
- M_END
-
- ENDIF
-
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_PredictIntraChroma_8x8_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_PredictIntraChroma_8x8_s.s
deleted file mode 100644
index 09b4cf6..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_PredictIntraChroma_8x8_s.s
+++ /dev/null
@@ -1,508 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_PredictIntraChroma_8x8_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- EXPORT armVCM4P10_pIndexTable8x8
-
-;// Define the processor variants supported by this file
-
- M_VARIANTS ARM1136JS
-
- AREA table, DATA
-;//-------------------------------------------------------
-;// This table for implementing switch case of C in asm by
-;// the mehtod of two levels of indexing.
-;//-------------------------------------------------------
-
- M_TABLE armVCM4P10_pIndexTable8x8
- DCD OMX_VC_CHROMA_DC, OMX_VC_CHROMA_HOR
- DCD OMX_VC_CHROMA_VERT, OMX_VC_CHROMA_PLANE
-
- M_TABLE armVCM4P10_MultiplierTableChroma8x8,1
- DCW 3, 2, 1,4
- DCW -3,-2,-1,0
- DCW 1, 2, 3,4
-
- IF ARM1136JS
-
-;//--------------------------------------------
-;// Constants
-;//--------------------------------------------
-
-BLK_SIZE EQU 0x8
-MUL_CONST0 EQU 0x01010101
-MASK_CONST EQU 0x00FF00FF
-MUL_CONST1 EQU 0x80808080
-
-;//--------------------------------------------
-;// Scratch variable
-;//--------------------------------------------
-y RN 12
-pc RN 15
-return RN 0
-pSrcLeft2 RN 1
-pDst2 RN 2
-sum1 RN 6
-sum2 RN 7
-pTable RN 9
-dstStepx2 RN 11
-leftStepx2 RN 14
-outerCount RN 14
-r0x01010101 RN 10
-r0x00FF00FF RN 11
-
-tVal0 RN 0
-tVal1 RN 1
-tVal2 RN 2
-tVal3 RN 3
-tVal4 RN 4
-tVal5 RN 5
-tVal6 RN 6
-tVal7 RN 7
-tVal8 RN 8
-tVal9 RN 9
-tVal10 RN 10
-tVal11 RN 11
-tVal12 RN 12
-tVal14 RN 14
-
-b RN 14
-c RN 12
-
-p2p0 RN 0
-p3p1 RN 1
-p6p4 RN 2
-p7p5 RN 4
-
-pp2pp0 RN 6
-pp3pp1 RN 7
-pp6pp4 RN 8
-pp7pp5 RN 9
-
-p3210 RN 10
-p7654 RN 10
-
-;//--------------------------------------------
-;// Input Arguments
-;//--------------------------------------------
-pSrcLeft RN 0 ;// input pointer
-pSrcAbove RN 1 ;// input pointer
-pSrcAboveLeft RN 2 ;// input pointer
-pDst RN 3 ;// output pointer
-leftStep RN 4 ;// input variable
-dstStep RN 5 ;// input variable
-predMode RN 6 ;// input variable
-availability RN 7 ;// input variable
-
-;//-----------------------------------------------------------------------------------------------
-;// omxVCM4P10_PredictIntraChroma_8x8 starts
-;//-----------------------------------------------------------------------------------------------
-
- ;// Write function header
- M_START omxVCM4P10_PredictIntraChroma_8x8, r11
-
- ;// Define stack arguments
- M_ARG LeftStep, 4
- M_ARG DstStep, 4
- M_ARG PredMode, 4
- M_ARG Availability, 4
-
- ;// M_STALL ARM1136JS=4
-
- LDR pTable,=armVCM4P10_pIndexTable8x8 ;// Load index table for switch case
-
-
- ;// Load argument from the stack
- M_LDR predMode, PredMode ;// Arg predMode loaded from stack to reg
- M_LDR leftStep, LeftStep ;// Arg leftStep loaded from stack to reg
- M_LDR dstStep, DstStep ;// Arg dstStep loaded from stack to reg
- M_LDR availability, Availability ;// Arg availability loaded from stack to reg
-
- MOV y, #BLK_SIZE ;// Outer Loop Count
- LDR pc, [pTable, predMode, LSL #2] ;// Branch to the case based on preMode
-
-OMX_VC_CHROMA_DC
- AND availability, availability,#(OMX_VC_UPPER + OMX_VC_LEFT)
- CMP availability, #(OMX_VC_UPPER + OMX_VC_LEFT) ;// if(availability & (#OMX_VC_UPPER | #OMX_VC_LEFT))
- LDR r0x01010101, =MUL_CONST0
- BNE TST_UPPER ;// Jump to Upper if not both
- LDM pSrcAbove,{tVal8,tVal9} ;// tVal 8 to 9 = pSrcAbove[0 to 7]
-
- ADD leftStepx2, leftStep,leftStep ;// leftStepx2 = 2 * leftStep
- ADD pSrcLeft2, pSrcLeft, leftStep ;// pSrcLeft2 = pSrcLeft + leftStep
-
- ;// M_STALL ARM1136JS=1
-
- UXTB16 tVal7, tVal8 ;// pSrcAbove[0, 2]
- UXTB16 tVal8, tVal8, ROR #8 ;// pSrcAbove[1, 3]
- UADD16 sum1, tVal7, tVal8 ;// pSrcAbove[0, 2] + pSrcAbove[1, 3]
-
- UXTB16 tVal7, tVal9 ;// pSrcAbove[4, 6]
- UXTB16 tVal9, tVal9, ROR #8 ;// pSrcAbove[5, 7]
- UADD16 sum2, tVal7, tVal9 ;// pSrcAbove[0, 2] + pSrcAbove[4, 6]
- ADD sum1, sum1, sum1, LSR #16 ;// sum(pSrcAbove[0] to pSrcAbove[3])
- ADD sum2, sum2, sum2, LSR #16 ;// sum(pSrcAbove[4] to pSrcAbove[7])
- UXTH sum1, sum1 ;// upsum1 (Clear the top junk bits)
- UXTH sum2, sum2 ;// upsum2 (Clear the top junk bits)
-
- M_LDRB tVal8, [pSrcLeft], +leftStepx2 ;// tVal8 = pSrcLeft[0]
- M_LDRB tVal9, [pSrcLeft2], +leftStepx2 ;// tVal9 = pSrcLeft[1]
- M_LDRB tVal4, [pSrcLeft], +leftStepx2 ;// tVal4 = pSrcLeft[2]
- M_LDRB tVal12,[pSrcLeft2], +leftStepx2 ;// tVal12= pSrcLeft[3]
- ADD tVal2, tVal8, tVal9 ;// tVal14 = tVal8 + tVal9
-
- M_LDRB tVal8, [pSrcLeft], +leftStepx2 ;// tVal8 = pSrcLeft[4]
- M_LDRB tVal9, [pSrcLeft2], +leftStepx2 ;// tVal9 = pSrcLeft[5]
- ADD tVal14, tVal4, tVal12 ;// tVal14 = tVal4 + tVal12
-
- LDRB tVal4, [pSrcLeft] ;// tVal4 = pSrcLeft[6]
- LDRB tVal12,[pSrcLeft2] ;// tVal12= pSrcLeft[7]
- ADD tVal8, tVal8, tVal9 ;// tVal8 = tVal8 + tVal9
- ADD tVal2, tVal2, tVal14 ;// leftsum1 = sum(pSrcLeft[0] to pSrcLeft[3])
- ADD tVal4, tVal4, tVal12 ;// tVal4 = tVal4 + tVal12
- ADD tVal14, tVal8, tVal4 ;// leftsum2 = sum(pSrcLeft[4] to pSrcLeft[7])
- ADD tVal8, tVal14, #2 ;// tVal8 = leftsum2 + 2
- ADD tVal9, sum2, #2 ;// tVal8 = upsum2 + 2
- ADD sum1, sum1, tVal2 ;// sum1 = upsum1 + leftsum1
- ADD sum2, sum2, tVal14 ;// sum2 = upsum2 + leftsum2
- ADD sum1, sum1, #4 ;// (sum1 + 4)
- ADD sum2, sum2, #4 ;// (sum2 + 4)
- MOV sum1, sum1, LSR #3 ;// (sum1 + 4)>>3
- MOV tVal9, tVal9, LSR #2 ;// (tVal9 + 2)>>2
- MOV tVal8, tVal8, LSR #2 ;// (tVal8 + 2)>>2
- MOV sum2, sum2, LSR #3 ;// (sum2 + 4)>>3
-
- MUL tVal0, sum1, r0x01010101 ;// replicate the val in all the bytes
- MUL tVal1, tVal9,r0x01010101 ;// replicate the val in all the bytes
- MUL tVal8, tVal8,r0x01010101 ;// replicate the val in all the bytes
- MUL tVal9, sum2, r0x01010101 ;// replicate the val in all the bytes
-
- M_STRD tVal0, tVal1, [pDst], dstStep ;// pDst[0 to 7] = tVal 0 to 1
- M_STRD tVal0, tVal1, [pDst], dstStep ;// pDst[8 to 15] = tVal 0 to 1
- M_STRD tVal0, tVal1, [pDst], dstStep ;// pDst[16 to 23] = tVal 0 to 1
- M_STRD tVal0, tVal1, [pDst], dstStep ;// pDst[24 to 31] = tVal 0 to 1
-
- M_STRD tVal8, tVal9, [pDst], dstStep ;// pDst[32 to 39] = tVal 8 to 9
- M_STRD tVal8, tVal9, [pDst], dstStep ;// pDst[40 to 47] = tVal 8 to 9
- M_STRD tVal8, tVal9, [pDst], dstStep ;// pDst[48 to 55] = tVal 8 to 9
- M_STRD tVal8, tVal9, [pDst], dstStep ;// pDst[56 to 63] = tVal 8 to 9
- MOV return, #OMX_Sts_NoErr
- M_EXIT
-
-TST_UPPER
-
- ;// M_STALL ARM1136JS=3
-
- CMP availability, #OMX_VC_UPPER ;// if(availability & #OMX_VC_UPPER)
-
- BNE TST_LEFT ;// Jump to Left if not upper
- LDM pSrcAbove,{tVal8,tVal9} ;// tVal 8 to 9 = pSrcAbove[0 to 7]
-
- ;// M_STALL ARM1136JS=3
-
- UXTB16 tVal7, tVal8 ;// pSrcAbove[0, 2]
- UXTB16 tVal8, tVal8, ROR #8 ;// pSrcAbove[1, 3]
- UADD16 sum1, tVal7, tVal8 ;// pSrcAbove[0, 2] + pSrcAbove[1, 3]
-
- UXTB16 tVal7, tVal9 ;// pSrcAbove[4, 6]
- UXTB16 tVal9, tVal9, ROR #8 ;// pSrcAbove[5, 7]
- UADD16 sum2, tVal7, tVal9 ;// pSrcAbove[0, 2] + pSrcAbove[4, 6]
-
- ADD sum1, sum1, sum1, LSR #16 ;// sum(pSrcAbove[0] to pSrcAbove[3])
- ADD sum2, sum2, sum2, LSR #16 ;// sum(pSrcAbove[4] to pSrcAbove[7])
-
- UXTH sum1, sum1 ;// upsum1 (Clear the top junk bits)
- UXTH sum2, sum2 ;// upsum2 (Clear the top junk bits)
-
- ADD sum1, sum1, #2 ;// sum1 + 2
- ADD sum2, sum2, #2 ;// sum2 + 2
-
- MOV sum1, sum1, LSR #2 ;// (sum1 + 2)>>2
- MOV sum2, sum2, LSR #2 ;// (sum2 + 2)>>2
-
- MUL sum1, sum1,r0x01010101 ;// replicate the val in all the bytes
- MUL sum2, sum2,r0x01010101 ;// replicate the val in all the bytes
-
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[0 to 7] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[8 to 15] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[16 to 23] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[24 to 31] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[32 to 39] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[40 to 47] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[48 to 55] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[56 to 63] = tVal 6 to 7
- MOV return, #OMX_Sts_NoErr
- M_EXIT
-
-TST_LEFT
- ;// M_STALL ARM1136JS=3
-
- CMP availability, #OMX_VC_LEFT
- BNE TST_COUNT0
- ADD leftStepx2, leftStep,leftStep ;// leftStepx2 = 2 * leftStep
- ADD pSrcLeft2, pSrcLeft, leftStep ;// pSrcLeft2 = pSrcLeft + leftStep
-
- M_LDRB tVal8, [pSrcLeft], +leftStepx2 ;// tVal8 = pSrcLeft[0]
- M_LDRB tVal9, [pSrcLeft2], +leftStepx2 ;// tVal9 = pSrcLeft[1]
- M_LDRB tVal4, [pSrcLeft], +leftStepx2 ;// tVal4 = pSrcLeft[2]
- M_LDRB tVal12,[pSrcLeft2], +leftStepx2 ;// tVal12= pSrcLeft[3]
-
- ADD tVal6, tVal8, tVal9 ;// tVal6 = tVal8 + tVal9
-
- M_LDRB tVal8, [pSrcLeft], +leftStepx2 ;// tVal8 = pSrcLeft[4]
- ADD tVal7, tVal4, tVal12 ;// tVal7 = tVal4 + tVal12
- M_LDRB tVal9, [pSrcLeft2], +leftStepx2 ;// tVal9 = pSrcLeft[5]
- M_LDRB tVal4, [pSrcLeft], +leftStepx2 ;// tVal4 = pSrcLeft[6]
- M_LDRB tVal12,[pSrcLeft2], +leftStepx2 ;// tVal12= pSrcLeft[7]
-
- ADD tVal8, tVal8, tVal9 ;// tVal8 = tVal8 + tVal9
- ADD sum1, tVal6, tVal7 ;// sum1 = sum(pSrcLeft[0] to pSrcLeft[3])
- ADD tVal4, tVal4, tVal12 ;// tVal4 = tVal4 + tVal12
- ADD sum2, tVal8, tVal4 ;// sum2 = sum(pSrcLeft[4] to pSrcLeft[7])
-
- ADD sum1, sum1, #2 ;// sum1 + 2
- ADD sum2, sum2, #2 ;// sum2 + 2
-
- MOV sum1, sum1, LSR #2 ;// (sum1 + 2)>>2
- MOV sum2, sum2, LSR #2 ;// (sum2 + 2)>>2
-
- MUL tVal6, sum1,r0x01010101 ;// replicate the val in all the bytes
- MUL tVal8, sum2,r0x01010101 ;// replicate the val in all the bytes
-
- ;// M_STALL ARM1136JS=1
- MOV tVal7,tVal6 ;// tVal7 = sum1
- MOV tVal9,tVal8 ;// tVal9 = sum2
-
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[0 to 7] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[8 to 15] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[16 to 23] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[24 to 31] = tVal 6 to 7
-
- M_STRD tVal8, tVal9, [pDst], dstStep ;// pDst[32 to 39] = tVal 8 to 9
- M_STRD tVal8, tVal9, [pDst], dstStep ;// pDst[40 to 47] = tVal 8 to 9
- M_STRD tVal8, tVal9, [pDst], dstStep ;// pDst[48 to 55] = tVal 8 to 9
- M_STRD tVal8, tVal9, [pDst], dstStep ;// pDst[56 to 63] = tVal 8 to 9
-
- MOV return, #OMX_Sts_NoErr
- M_EXIT ;// Macro to exit midway-break frm case
-
-TST_COUNT0
- LDR sum1, =MUL_CONST1 ;// sum1 = 0x80808080 if(count == 0)
-
- ;// M_STALL ARM1136JS=2
-
- MOV tVal7, sum1 ;// tVal7 = sum1
-
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[0 to 7] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[8 to 15] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[16 to 23] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[24 to 31] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[32 to 39] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[40 to 47] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[48 to 55] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[56 to 63] = tVal 6 to 7
-
- MOV return, #OMX_Sts_NoErr
- M_EXIT ;// Macro to exit midway-break frm case
-
-OMX_VC_CHROMA_HOR
-
- ;// M_STALL ARM1136JS=2
-
- ADD pSrcLeft2, pSrcLeft, leftStep ;// pSrcLeft2 = pSrcLeft + leftStep
- ADD leftStepx2, leftStep, leftStep ;// leftStepx2 = leftStep * 2
- ADD pDst2, pDst, dstStep ;// pDst2 = pDst + dstStep
- ADD dstStepx2, dstStep, dstStep ;// double dstStep
- SUB dstStepx2, dstStepx2, #4 ;// double dstStep minus 4
- LDR r0x01010101, =MUL_CONST0 ;// Const to repeat the byte in reg 4 times
- M_LDRB tVal6, [pSrcLeft], +leftStepx2 ;// tVal6 = pSrcLeft[0]
- M_LDRB tVal7, [pSrcLeft2],+leftStepx2 ;// tVal7 = pSrcLeft[1]
- M_LDRB tVal8, [pSrcLeft], +leftStepx2 ;// tVal8 = pSrcLeft[2]
- M_LDRB tVal9, [pSrcLeft2],+leftStepx2 ;// tVal9 = pSrcLeft[3]
- MUL tVal6, tVal6, r0x01010101 ;// replicate the val in all the bytes
- MUL tVal7, tVal7, r0x01010101 ;// replicate the val in all the bytes
- MUL tVal8, tVal8, r0x01010101 ;// replicate the val in all the bytes
- MUL tVal9, tVal9, r0x01010101 ;// replicate the val in all the bytes
- STR tVal6, [pDst], #+4 ;// store {tVal6} at pDst [0 to 3]
- STR tVal7, [pDst2], #+4 ;// store {tVal7} at pDst2[0 to 3]
- M_STR tVal6, [pDst], dstStepx2 ;// store {tVal6} at pDst [4 to 7]
- M_STR tVal7, [pDst2], dstStepx2 ;// store {tVal7} at pDst2[4 to 7]
- STR tVal8, [pDst], #+4 ;// store {tVal6} at pDst [0 to 3]
- STR tVal9, [pDst2], #+4 ;// store {tVal7} at pDst2[0 to 3]
- M_STR tVal8, [pDst], dstStepx2 ;// store {tVal6} at pDst [4 to 7]
- M_STR tVal9, [pDst2], dstStepx2 ;// store {tVal7} at pDst2[4 to 7]
- M_LDRB tVal6, [pSrcLeft], +leftStepx2 ;// tVal6 = pSrcLeft[4]
- M_LDRB tVal7, [pSrcLeft2],+leftStepx2 ;// tVal7 = pSrcLeft[5]
- M_LDRB tVal8, [pSrcLeft], +leftStepx2 ;// tVal8 = pSrcLeft[6]
- M_LDRB tVal9, [pSrcLeft2],+leftStepx2 ;// tVal9 = pSrcLeft[7]
- MUL tVal6, tVal6, r0x01010101 ;// replicate the val in all the bytes
- MUL tVal7, tVal7, r0x01010101 ;// replicate the val in all the bytes
- MUL tVal8, tVal8, r0x01010101 ;// replicate the val in all the bytes
- MUL tVal9, tVal9, r0x01010101 ;// replicate the val in all the bytes
- STR tVal6, [pDst], #+4 ;// store {tVal6} at pDst [0 to 3]
- STR tVal7, [pDst2], #+4 ;// store {tVal7} at pDst2[0 to 3]
- M_STR tVal6, [pDst], dstStepx2 ;// store {tVal6} at pDst [4 to 7]
- M_STR tVal7, [pDst2], dstStepx2 ;// store {tVal7} at pDst2[4 to 7]
- STR tVal8, [pDst], #+4 ;// store {tVal6} at pDst [0 to 3]
- STR tVal9, [pDst2], #+4 ;// store {tVal7} at pDst2[0 to 3]
- M_STR tVal8, [pDst], dstStepx2 ;// store {tVal6} at pDst [4 to 7]
- M_STR tVal9, [pDst2], dstStepx2 ;// store {tVal7} at pDst2[4 to 7]
- MOV return, #OMX_Sts_NoErr
- M_EXIT
-
-OMX_VC_CHROMA_VERT
-
- ;// M_STALL ARM1136JS=4
-
- LDMIA pSrcAbove, {tVal6,tVal7} ;// tVal 6 to 7 = pSrcAbove[0 to 7]
- MOV return, #OMX_Sts_NoErr
-
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[0 to 7] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[8 to 15] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[16 to 23] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[24 to 31] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[32 to 39] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[40 to 47] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[48 to 55] = tVal 6 to 7
- M_STRD tVal6, tVal7, [pDst], dstStep ;// pDst[56 to 63] = tVal 6 to 7
-
- M_EXIT ;// Macro to exit midway-break frm case
-
-OMX_VC_CHROMA_PLANE
-
- ;// M_STALL ARM1136JS=3
-
- RSB tVal14, leftStep, leftStep, LSL #3 ;// 7*leftStep
- LDRB tVal7, [pSrcAbove, #+7] ;// pSrcAbove[7]
- LDRB tVal6, [pSrcLeft, +tVal14] ;// pSrcLeft[7*leftStep]
- LDRB tVal8, [pSrcAboveLeft] ;// pSrcAboveLeft[0]
- LDRB tVal9, [pSrcAbove, #+6 ] ;// pSrcAbove[6]
- LDRB tVal10,[pSrcAbove] ;// pSrcAbove[0]
- ADD tVal2, tVal7, tVal6 ;// pSrcAbove[7] + pSrcLeft[7*leftStep]
- SUB tVal6, tVal6, tVal8 ;// V0 = pSrcLeft[7*leftStep] - pSrcAboveLeft[0]
- SUB tVal7, tVal7, tVal8 ;// H0 = pSrcAbove[7] - pSrcAboveLeft[0]
- LSL tVal2, tVal2, #4 ;// a = 16 * (pSrcAbove[15] + pSrcLeft[15*lS])
- ADD tVal2, tVal2, #16 ;// a + 16
- SUB tVal9, tVal9,tVal10 ;// pSrcAbove[6] - pSrcAbove[0]
- LDRB tVal8, [pSrcAbove,#+5] ;// pSrcAbove[5]
- LDRB tVal10,[pSrcAbove,#+1] ;// pSrcAbove[1]
- ADD tVal9, tVal9, tVal9, LSL #1 ;// H1 = 3 * (pSrcAbove[6] - pSrcAbove[0])
- ADD tVal7, tVal9, tVal7, LSL #2 ;// H = H1 + H0
- SUB tVal8, tVal8, tVal10 ;// pSrcAbove[5] - pSrcAbove[1]
- LDRB tVal9, [pSrcAbove,#+4] ;// pSrcAbove[4]
- LDRB tVal10,[pSrcAbove,#+2] ;// pSrcAbove[2]
- ADD tVal7, tVal7, tVal8, LSL #1 ;// H = H + H2
- SUB tVal11, tVal14,leftStep ;// 6*leftStep
- ADD tVal11, pSrcLeft, tVal11 ;// pSrcLeft + 6*leftStep
- MOV tVal12, pSrcLeft ;// pSrcLeft
- SUB tVal9, tVal9, tVal10 ;// pSrcAbove[4] - pSrcAbove[2]
- ADD tVal7, tVal7, tVal9 ;// H = H + H3
- M_LDRB tVal8, [tVal11],-leftStep ;// pSrcLeft[6*leftStep]
- M_LDRB tVal10,[tVal12],+leftStep ;// pSrcLeft[0]
- ADD tVal7, tVal7, tVal7, LSL #4 ;// 17 * H
- ADD tVal7, tVal7, #16 ;// 17 * H + 16
- SUB tVal8, tVal8, tVal10 ;// pSrcLeft[6*leftStep] - pSrcLeft[0]
- ASR b, tVal7, #5 ;// b = (17 * H + 16) >> 5
- ADD tVal8, tVal8, tVal8, LSL #1 ;// V1 = 3 * (pSrcLeft[6*leftStep] - pSrcLeft[0])
- ADD tVal6, tVal8, tVal6, LSL #2 ;// V = V0 +V1
- M_LDRB tVal8, [tVal11],-leftStep ;// pSrcLeft[5*leftStep]
- M_LDRB tVal10,[tVal12],+leftStep ;// pSrcLeft[leftStep]
- ADD tVal7, b, b, LSL #1 ;// 3*b
- SUB tVal2, tVal2, tVal7 ;// a + 16 - 3*b
- SUB tVal7, tVal8, tVal10 ;// pSrcLeft[5*leftStep] - pSrcLeft[leftStep]
- M_LDRB tVal8, [tVal11],-leftStep ;// pSrcLeft[4*leftStep]
- M_LDRB tVal10,[tVal12],+leftStep ;// pSrcLeft[2*leftStep]
- ADD tVal6, tVal6, tVal7, LSL #1 ;// V = V + V2
- LDR r0x00FF00FF, =MASK_CONST ;// r0x00FF00FF = 0x00FF00FF
- SUB tVal7, tVal8, tVal10 ;// pSrcLeft[4*leftStep] - pSrcLeft[2*leftStep]
- ADD tVal6, tVal6, tVal7 ;// V = V + V7
- SUB dstStep, dstStep, #4 ;// dstStep - 4
- ADD tVal6, tVal6, tVal6, LSL #4 ;// 17*V
- ADD tVal6, tVal6, #16 ;// 17*V + 16
-
- ;// M_STALL ARM1136JS=1
-
- ASR c, tVal6, #5 ;// c = (17*V + 16)>>5
-
- ;// M_STALL ARM1136JS=1
-
- ADD tVal6, c, c, LSL #1 ;// 3*c
- UXTH c, c ;// only in half word
- SUB tVal6, tVal2, tVal6 ;// a - 3*b - 3*c + 16
- ORR c, c, c, LSL #16 ;// c c
- ADD tVal7, b, b ;// 2b
- ADD tVal2, tVal6, tVal7 ;// pp2 = d + 2*b
- ADD tVal7, tVal7, b ;// 3b
- ORR p2p0, tVal6, tVal2, LSL #16 ;// p2p0 = pack {p2, p0}
- UXTH b, b
- UXTH tVal7, tVal7
- ORR b, b, b, LSL #16 ;// {b,b}
- ORR tVal7, tVal7, tVal7, LSL #16 ;// {3b,3b}
- SADD16 p3p1, p2p0, b ;// p3p1 = p2p0 + {b,b}
- SADD16 p6p4, p3p1, tVal7 ;// p6p4 = p3p1 + {3b,3b}
- SADD16 p7p5, p6p4, b ;// p7p5 = p6p4 + {b,b}
- MOV outerCount, #BLK_SIZE ;// Outer Loop Count
-
-LOOP_PLANE
-
- USAT16 p7p5, #13, p7p5 ;// clip13(p7) clip13(p5)
- USAT16 p6p4, #13, p6p4 ;// clip13(p6) clip13(p4)
- USAT16 p3p1, #13, p3p1 ;// clip13(p3) clip13(p1)
- USAT16 p2p0, #13, p2p0 ;// clip13(p2) clip13(p0)
-
- AND pp7pp5, r0x00FF00FF, p7p5, ASR #5 ;// clip8(p7) clip8(p5)
- AND pp6pp4, r0x00FF00FF, p6p4, ASR #5 ;// clip8(p6) clip8(p4)
- AND pp3pp1, r0x00FF00FF, p3p1, ASR #5 ;// clip8(p3) clip8(p1)
- AND pp2pp0, r0x00FF00FF, p2p0, ASR #5 ;// clip8(p2) clip8(p0)
-
- SUBS outerCount, outerCount, #1 ;// outerCount--
-
- ORR p3210, pp2pp0, pp3pp1, LSL #8 ;// pack {p3,p2, p1, p0}
- STR p3210, [pDst], #4 ;// store {pDst[0] to pDst[3]}
-
- ORR p7654, pp6pp4, pp7pp5, LSL #8 ;// pack {p7,p6, p5, p4}
- M_STR p7654, [pDst], dstStep ;// store {pDst[4] to pDst[7]}
-
- SADD16 p7p5, p7p5, c ;// {p7 + c}, {p5 + c}
- SADD16 p6p4, p6p4, c ;// {p6 + c}, {p4 + c}
- SADD16 p3p1, p3p1, c ;// {p3 + c}, {p1 + c}
- SADD16 p2p0, p2p0, c ;// {p2 + c}, {p0 + c}
-
- BNE LOOP_PLANE ;// Loop for 8 times
- MOV return, #OMX_Sts_NoErr
- M_END
-
- ENDIF ;// ARM1136JS
-
-
-
- END
-;//-----------------------------------------------------------------------------------------------
-;// omxVCM4P10_PredictIntraChroma_8x8 ends
-;//-----------------------------------------------------------------------------------------------
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_PredictIntra_16x16_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_PredictIntra_16x16_s.s
deleted file mode 100644
index 0c0cba7..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_PredictIntra_16x16_s.s
+++ /dev/null
@@ -1,515 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_PredictIntra_16x16_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
-;//-------------------------------------------------------
-;// This table for implementing switch case of C in asm by
-;// the mehtod of two levels of indexing.
-;//-------------------------------------------------------
-
- M_TABLE armVCM4P10_pIndexTable16x16
- DCD OMX_VC_16X16_VERT, OMX_VC_16X16_HOR
- DCD OMX_VC_16X16_DC, OMX_VC_16X16_PLANE
-
- IF ARM1136JS
-
-;//--------------------------------------------
-;// Constants
-;//--------------------------------------------
-BLK_SIZE EQU 0x10
-MUL_CONST0 EQU 0x01010101
-MUL_CONST1 EQU 0x00060004
-MUL_CONST2 EQU 0x00070005
-MUL_CONST3 EQU 0x00030001
-MASK_CONST EQU 0x00FF00FF
-
-;//--------------------------------------------
-;// Scratch variable
-;//--------------------------------------------
-y RN 12
-pc RN 15
-
-return RN 0
-innerCount RN 0
-outerCount RN 1
-pSrcLeft2 RN 1
-pDst2 RN 2
-sum RN 6
-pTable RN 9
-temp1 RN 10
-temp2 RN 12
-cMul1 RN 11
-cMul2 RN 12
-count RN 12
-dstStepx2 RN 11
-leftStepx2 RN 14
-r0x01010101 RN 10
-r0x00FF00FF RN 11
-
-tVal0 RN 0
-tVal1 RN 1
-tVal2 RN 2
-tVal3 RN 3
-tVal4 RN 4
-tVal5 RN 5
-tVal6 RN 6
-tVal7 RN 7
-tVal8 RN 8
-tVal9 RN 9
-tVal10 RN 10
-tVal11 RN 11
-tVal12 RN 12
-tVal14 RN 14
-
-b RN 12
-c RN 14
-
-p2p0 RN 0
-p3p1 RN 1
-p6p4 RN 2
-p7p5 RN 4
-p10p8 RN 6
-p11p9 RN 7
-p14p12 RN 8
-p15p13 RN 9
-
-p3210 RN 10
-p7654 RN 10
-p111098 RN 10
-p15141312 RN 10
-
-;//--------------------------------------------
-;// Declare input registers
-;//--------------------------------------------
-pSrcLeft RN 0 ;// input pointer
-pSrcAbove RN 1 ;// input pointer
-pSrcAboveLeft RN 2 ;// input pointer
-pDst RN 3 ;// output pointer
-leftStep RN 4 ;// input variable
-dstStep RN 5 ;// input variable
-predMode RN 6 ;// input variable
-availability RN 7 ;// input variable
-
-;//-----------------------------------------------------------------------------------------------
-;// omxVCM4P10_PredictIntra_16x16 starts
-;//-----------------------------------------------------------------------------------------------
-
- ;// Write function header
- M_START omxVCM4P10_PredictIntra_16x16, r11
-
- ;// Define stack arguments
- M_ARG LeftStep, 4
- M_ARG DstStep, 4
- M_ARG PredMode, 4
- M_ARG Availability, 4
-
- ;// M_STALL ARM1136JS=4
-
- LDR pTable,=armVCM4P10_pIndexTable16x16 ;// Load index table for switch case
-
- ;// Load argument from the stack
- M_LDR predMode, PredMode ;// Arg predMode loaded from stack to reg
- M_LDR leftStep, LeftStep ;// Arg leftStep loaded from stack to reg
- M_LDR dstStep, DstStep ;// Arg dstStep loaded from stack to reg
- M_LDR availability, Availability ;// Arg availability loaded from stack to reg
-
- MOV y, #BLK_SIZE ;// Outer Loop Count
- LDR pc, [pTable, predMode, LSL #2] ;// Branch to the case based on preMode
-
-OMX_VC_16X16_VERT
- LDM pSrcAbove, {tVal6,tVal7,tVal8,tVal9};// tVal 6 to 9 = pSrcAbove[0 to 15]
- ADD dstStepx2, dstStep, dstStep ;// double dstStep
- ADD pDst2, pDst, dstStep ;// pDst2- pDst advanced by dstStep
-
- ;// M_STALL ARM1136JS=2 ;// Stall outside the loop
-
-LOOP_VERT
- STM pDst, {tVal6,tVal7,tVal8,tVal9} ;// pDst[0 to 15] = tVal 6 to 9
- SUBS y, y, #2 ;// y--
- ADD pDst, pDst, dstStepx2 ;// pDst advanced by dstStep
- STM pDst2, {tVal6,tVal7,tVal8,tVal9} ;// pDst2[16 to 31] = tVal 6 to 9
- ADD pDst2, pDst2, dstStepx2 ;// pDst advanced by dstStep
- BNE LOOP_VERT ;// Loop for 8 times
- MOV return, #OMX_Sts_NoErr
- M_EXIT
-
-
-OMX_VC_16X16_HOR
-
- ;// M_STALL ARM1136JS=6
-
- LDR r0x01010101, =MUL_CONST0 ;// Const to repeat the byte in reg 4 times
- MOV y, #4 ;// Outer Loop Count
- M_LDRB tVal6, [pSrcLeft], +leftStep ;// tVal6 = pSrcLeft[0 to 3]
- ADD pDst2, pDst, dstStep ;// pDst2- pDst advanced by dstStep
- M_LDRB tVal7, [pSrcLeft], +leftStep ;// tVal1 = pSrcLeft[4 to 7]
- ADD dstStepx2, dstStep, dstStep ;// double dstStep
- SUB dstStepx2, dstStepx2, #12 ;// double dstStep minus 12
-
-LOOP_HOR
- M_LDRB tVal8, [pSrcLeft], +leftStep ;// tVal8 = pSrcLeft[0 to 3]
- MUL tVal6, tVal6, r0x01010101 ;// replicate the val in all the bytes
- M_LDRB tVal9, [pSrcLeft], +leftStep ;// tVal9 = pSrcLeft[4 to 7]
- MUL tVal7, tVal7, r0x01010101 ;// replicate the val in all the bytes
- SUBS y, y, #1 ;// y--
- STR tVal6, [pDst], #+4 ;// store {tVal6} at pDst[0 to 3]
- STR tVal7, [pDst2], #+4 ;// store {tVal7} at pDst2[0 to 3]
- STR tVal6, [pDst], #+4 ;// store {tVal6} at pDst[4 to 7]
- STR tVal7, [pDst2], #+4 ;// store {tVal7} at pDst2[4 to 7]
- MUL tVal8, tVal8, r0x01010101 ;// replicate the val in all the bytes
- STR tVal6, [pDst], #+4 ;// store {tVal6} at pDst[8 to 11]
- STR tVal7, [pDst2], #+4 ;// store {tVal7} at pDst2[8 to 11]
- MUL tVal9, tVal9, r0x01010101 ;// replicate the val in all the bytes
- M_STR tVal6, [pDst], dstStepx2 ;// store {tVal6} at pDst[12 to 15]
- M_STR tVal7, [pDst2], dstStepx2 ;// store {tVal7} at pDst2[12 to 15]
- STR tVal8, [pDst], #+4 ;// store {tVal6} at pDst[0 to 3]
- STR tVal9, [pDst2], #+4 ;// store {tVal7} at pDst2[0 to 3]
- STR tVal8, [pDst], #+4 ;// store {tVal6} at pDst[4 to 7]
- STR tVal9, [pDst2], #+4 ;// store {tVal7} at pDst2[4 to 7]
- STR tVal8, [pDst], #+4 ;// store {tVal6} at pDst[8 to 11]
- STR tVal9, [pDst2], #+4 ;// store {tVal7} at pDst2[8 to 11]
- M_STR tVal8, [pDst], dstStepx2 ;// store {tVal6} at pDst[12 to 15]
- M_LDRB tVal6, [pSrcLeft], +leftStep ;// tVal6 = pSrcLeft[0 to 3]
- M_STR tVal9, [pDst2], dstStepx2 ;// store {tVal7} at pDst2[12 to 15]
- M_LDRB tVal7, [pSrcLeft], +leftStep ;// tVal7 = pSrcLeft[4 to 7]
- BNE LOOP_HOR ;// Loop for 3 times
- MOV return, #OMX_Sts_NoErr
- M_EXIT
-
-OMX_VC_16X16_DC
-
- ;// M_STALL ARM1136JS=2
-
- MOV count, #0 ;// count = 0
- TST availability, #OMX_VC_UPPER ;// if(availability & #OMX_VC_UPPER)
- BEQ TST_LEFT ;// Jump to Left if not upper
- LDM pSrcAbove,{tVal8,tVal9,tVal10,tVal11};// tVal 8 to 11 = pSrcAbove[0 to 15]
- ADD count, count, #1 ;// if upper inc count by 1
-
- ;// M_STALL ARM1136JS=2
-
- UXTB16 tVal2, tVal8 ;// pSrcAbove[0, 2]
- UXTB16 tVal6, tVal9 ;// pSrcAbove[4, 6]
- UADD16 tVal2, tVal2, tVal6 ;// pSrcAbove[0, 2] + pSrcAbove[4, 6]
- UXTB16 tVal8, tVal8, ROR #8 ;// pSrcAbove[1, 3]
- UXTB16 tVal9, tVal9, ROR #8 ;// pSrcAbove[5, 7]
- UADD16 tVal8, tVal8, tVal9 ;// pSrcAbove[1, 3] + pSrcAbove[5, 7]
- UADD16 tVal2, tVal2, tVal8 ;// sum(pSrcAbove[0] to pSrcAbove[7])
-
- UXTB16 tVal8, tVal10 ;// pSrcAbove[8, 10]
- UXTB16 tVal9, tVal11 ;// pSrcAbove[12, 14]
- UADD16 tVal8, tVal8, tVal9 ;// pSrcAbove[8, 10] + pSrcAbove[12, 14]
- UXTB16 tVal10, tVal10, ROR #8 ;// pSrcAbove[9, 11]
- UXTB16 tVal11, tVal11, ROR #8 ;// pSrcAbove[13, 15]
- UADD16 tVal10, tVal10, tVal11 ;// pSrcAbove[9, 11] + pSrcAbove[13, 15]
- UADD16 tVal8, tVal8, tVal10 ;// sum(pSrcAbove[8] to pSrcAbove[15])
-
- UADD16 tVal2, tVal2, tVal8 ;// sum(pSrcAbove[0] to pSrcAbove[15])
-
- ;// M_STALL ARM1136JS=1
-
- ADD tVal2, tVal2, tVal2, LSR #16 ;// sum(pSrcAbove[0] to pSrcAbove[15])
-
- ;// M_STALL ARM1136JS=1
-
- UXTH sum, tVal2 ;// Extract the lower half for result
-
-TST_LEFT
- TST availability, #OMX_VC_LEFT
- BEQ TST_COUNT
- ADD leftStepx2, leftStep,leftStep ;// leftStepx2 = 2 * leftStep
- ADD pSrcLeft2, pSrcLeft, leftStep ;// pSrcLeft2 = pSrcLeft + leftStep
-
- M_LDRB tVal8, [pSrcLeft], +leftStepx2 ;// tVal8 = pSrcLeft[0]
- M_LDRB tVal9, [pSrcLeft2], +leftStepx2 ;// tVal9 = pSrcLeft[1]
- M_LDRB tVal10, [pSrcLeft], +leftStepx2 ;// tVal10= pSrcLeft[2]
- M_LDRB tVal11, [pSrcLeft2],+leftStepx2 ;// tVal11= pSrcLeft[3]
- ADD tVal7, tVal8, tVal9 ;// tVal7 = tVal8 + tVal9
- ADD count, count, #1 ;// Inc Counter if Left is available
- ADD tVal6, tVal10, tVal11 ;// tVal6 = tVal10 + tVal11
-
- M_LDRB tVal8, [pSrcLeft], +leftStepx2 ;// tVal8 = pSrcLeft[0]
- M_LDRB tVal9, [pSrcLeft2], +leftStepx2 ;// tVal9 = pSrcLeft[1]
- M_LDRB tVal10, [pSrcLeft], +leftStepx2 ;// tVal10= pSrcLeft[2]
- M_LDRB tVal11, [pSrcLeft2],+leftStepx2 ;// tVal11= pSrcLeft[3]
- ADD sum, tVal7, tVal6 ;// sum = tVal8 + tVal10
- ADD tVal8, tVal8, tVal9 ;// tVal8 = tVal8 + tVal9
- ADD tVal10, tVal10, tVal11 ;// tVal10= tVal10 + tVal11
- ADD tVal7, tVal8, tVal10 ;// tVal7 = tVal8 + tVal10
-
-
- M_LDRB tVal8, [pSrcLeft], +leftStepx2 ;// tVal8 = pSrcLeft[0]
- M_LDRB tVal9, [pSrcLeft2], +leftStepx2 ;// tVal9 = pSrcLeft[1]
- M_LDRB tVal10, [pSrcLeft], +leftStepx2 ;// tVal10= pSrcLeft[2]
- M_LDRB tVal11, [pSrcLeft2],+leftStepx2 ;// tVal11= pSrcLeft[3]
- ADD sum, sum, tVal7 ;// sum = sum + tVal7
- ADD tVal8, tVal8, tVal9 ;// tVal8 = tVal8 + tVal9
- ADD tVal10, tVal10, tVal11 ;// tVal10= tVal10 + tVal11
- ADD tVal7, tVal8, tVal10 ;// tVal7 = tVal8 + tVal10
-
-
- M_LDRB tVal8, [pSrcLeft], +leftStepx2 ;// tVal8 = pSrcLeft[0]
- M_LDRB tVal9, [pSrcLeft2], +leftStepx2 ;// tVal9 = pSrcLeft[1]
- M_LDRB tVal10, [pSrcLeft], +leftStepx2 ;// tVal10= pSrcLeft[2]
- M_LDRB tVal11, [pSrcLeft2],+leftStepx2 ;// tVal11= pSrcLeft[3]
- ADD sum, sum, tVal7 ;// sum = sum + tVal7
- ADD tVal8, tVal8, tVal9 ;// tVal8 = tVal8 + tVal9
- ADD tVal10, tVal10, tVal11 ;// tVal10= tVal10 + tVal11
- ADD tVal7, tVal8, tVal10 ;// tVal7 = tVal8 + tVal10
- ADD sum, sum, tVal7 ;// sum = sum + tVal7
-
-TST_COUNT
- CMP count, #0 ;// if(count == 0)
- MOVEQ sum, #128 ;// sum = 128 if(count == 0)
- BEQ TST_COUNT0 ;// if(count == 0)
- CMP count, #1 ;// if(count == 1)
- ADDEQ sum, sum, #8 ;// sum += 8 if(count == 1)
- ADDNE sum, sum, tVal2 ;// sum = sumleft + sumupper
- ADDNE sum, sum, #16 ;// sum += 16 if(count == 2)
-
- ;// M_STALL ARM1136JS=1
-
- UXTH sum, sum ;// sum only byte rest cleared
-
- ;// M_STALL ARM1136JS=1
-
- LSREQ sum, sum, #4 ;// sum >> 4 if(count == 1)
-
- ;// M_STALL ARM1136JS=1
-
- LSRNE sum, sum, #5 ;// sum >> 5 if(count == 2)
-
-TST_COUNT0
-
- ;// M_STALL ARM1136JS=1
-
- ORR sum, sum, sum, LSL #8 ;// sum replicated in two halfword
-
- ;// M_STALL ARM1136JS=1
-
- ORR tVal6, sum, sum, LSL #16 ;// sum replicated in all bytes
- CPY tVal7, tVal6 ;// tVal1 = tVal0
- CPY tVal8, tVal6 ;// tVal2 = tVal0
- CPY tVal9, tVal6 ;// tVal3 = tVal0
- ADD dstStepx2, dstStep, dstStep ;// double dstStep
- ADD pDst2, pDst, dstStep ;// pDst2- pDst advanced by dstStep
- MOV y, #BLK_SIZE ;// Outer Loop Count
-
-LOOP_DC
- STM pDst, {tVal6,tVal7,tVal8,tVal9} ;// pDst[0 to 15] = tVal 6 to 9
- SUBS y, y, #2 ;// y--
- ADD pDst, pDst, dstStepx2 ;// pDst advanced by dstStep
- STM pDst2, {tVal6,tVal7,tVal8,tVal9} ;// pDst2[16 to 31] = tVal 6 to 9
- ADD pDst2, pDst2, dstStepx2 ;// pDst advanced by dstStep
- BNE LOOP_DC ;// Loop for 8 times
-
- MOV return, #OMX_Sts_NoErr
- M_EXIT
-
-OMX_VC_16X16_PLANE
-
- ;// M_STALL ARM1136JS=3
- RSB tVal14, leftStep, leftStep, LSL #4 ;// tVal14 = 15*leftStep
-
- ;// M_STALL ARM1136JS=2
- LDRB tVal10, [pSrcLeft, tVal14] ;// tVal10 = pSrcLeft[15*leftStep]
- LDRB tVal11, [pSrcAboveLeft] ;// tVal11 = pSrcAboveLeft[0]
- LDRB tVal12, [pSrcAbove, #15]
-
- ADD tVal2, tVal12, tVal10 ;// tVal2 = pSrcAbove[15] + pSrcLeft[15*leftStep]
- SUB tVal10, tVal10, tVal11 ;// tVal10 = V0 = pSrcLeft[15*leftStep] - pSrcAboveLeft[0]
- SUB tVal11, tVal12, tVal11 ;// tVal11 = H0 = pSrcAbove[15] - pSrcAboveLeft[0]
- MOV tVal2, tVal2, LSL #4 ;// tVal2 = a = 16 * (pSrcAbove[15] + pSrcLeft[15*leftStep])
-
- MOV tVal11, tVal11, LSL #3 ;// 8*[15]-[-1]
- LDRB tVal6, [pSrcAbove, #0]
- LDRB tVal7, [pSrcAbove, #14]
- SUB tVal8, tVal7, tVal6
- RSB tVal8, tVal8, tVal8, LSL #3 ;// 7*[14]-[0]
- ADD tVal11, tVal11, tVal8
- LDRB tVal6, [pSrcAbove, #1]
- LDRB tVal7, [pSrcAbove, #13]
- SUB tVal8, tVal7, tVal6
- ADD tVal8, tVal8, tVal8
- ADD tVal8, tVal8, tVal8, LSL #1 ;// 6*[13]-[1]
- ADD tVal11, tVal11, tVal8
- LDRB tVal6, [pSrcAbove, #2]
- LDRB tVal7, [pSrcAbove, #12]
- SUB tVal8, tVal7, tVal6
- ADD tVal8, tVal8, tVal8, LSL #2 ;// 5*[12]-[2]
- ADD tVal11, tVal11, tVal8
- LDRB tVal6, [pSrcAbove, #3]
- LDRB tVal7, [pSrcAbove, #11]
- SUB tVal8, tVal7, tVal6
- ADD tVal11, tVal11, tVal8, LSL #2 ;// + 4*[11]-[3]
- LDRB tVal6, [pSrcAbove, #4]
- LDRB tVal7, [pSrcAbove, #10]
- SUB tVal8, tVal7, tVal6
- ADD tVal8, tVal8, tVal8, LSL #1 ;// 3*[10]-[4]
- ADD tVal11, tVal11, tVal8
- LDRB tVal6, [pSrcAbove, #5]
- LDRB tVal7, [pSrcAbove, #9]
- SUB tVal8, tVal7, tVal6
- ADD tVal11, tVal11, tVal8, LSL #1 ;// + 2*[9]-[5]
- LDRB tVal6, [pSrcAbove, #6]
- LDRB tVal7, [pSrcAbove, #8]
- SUB tVal8, tVal7, tVal6 ;// 1*[8]-[6]
- ADD tVal7, tVal11, tVal8
-
- ADD tVal2, tVal2, #16 ;// tVal2 = a + 16
- MOV tVal1, pSrcLeft ;// tVal4 = pSrcLeft
- SUB tVal9, tVal14, leftStep ;// tVal9 = 14*leftStep
- ADD tVal9, pSrcLeft, tVal9 ;// tVal9 = pSrcLeft + 14*leftStep
-
- M_LDRB tVal8, [tVal9], -leftStep ;// tVal8 = pSrcLeft[14*leftStep]
- M_LDRB tVal11, [tVal1], +leftStep ;// tVal11 = pSrcLeft[0]
- ADD tVal7, tVal7, tVal7, LSL #2 ;// tVal7 = 5 * H
- ADD tVal7, tVal7, #32 ;// tVal7 = 5 * H + 32
- SUB tVal8, tVal8, tVal11 ;// tVal8 = pSrcLeft[14*leftStep] - pSrcLeft[0]
- ASR tVal12, tVal7, #6 ;// tVal12 = b = (5 * H + 32) >> 6
-
- RSB tVal8, tVal8, tVal8, LSL #3 ;// tVal8 = V1 = 7* (pSrcLeft[14*leftStep]-pSrcLeft[0])
- ADD tVal6, tVal8, tVal10, LSL #3 ;// tVal6 = V = V0 +V1
- M_LDRB tVal8, [tVal9], -leftStep ;// tVal8 = pSrcLeft[13*leftStep]
- M_LDRB tVal10, [tVal1], +leftStep ;// tVal10 = pSrcLeft[leftStep]
- RSB tVal7, tVal12, tVal12, LSL #3 ;// tVal7 = 7*b
- SUB tVal2, tVal2, tVal7 ;// tVal2 = a + 16 - 7*b
- SUB tVal7, tVal8, tVal10 ;// tVal7 = pSrcLeft[13*leftStep] - pSrcLeft[leftStep]
- M_LDRB tVal8, [tVal9], -leftStep ;// tVal8 = pSrcLeft[12*lS]
- ADD tVal7, tVal7, tVal7 ;// tVal7 = 2 * (pSrcLeft[13*leftStep] - pSrcLeft[leftStep])
- M_LDRB tVal10, [tVal1], +leftStep ;// tVal10 = pSrcLeft[2*leftStep]
- ADD tVal7, tVal7, tVal7, LSL #1 ;// tVal7 = 6 * (pSrcLeft[13*leftStep] - pSrcLeft[leftStep])
- ADD tVal6, tVal6, tVal7 ;// tVal6 = V = V + V2
- SUB tVal7, tVal8, tVal10 ;// tVal7 = pSrcLeft[12*leftStep] - pSrcLeft[2*leftStep]
- M_LDRB tVal8, [tVal9], -leftStep ;// tVal8 = pSrcLeft[11*leftStep]
- M_LDRB tVal10, [tVal1], +leftStep ;// tVal10 = pSrcLeft[3*leftStep]
- ADD tVal7, tVal7, tVal7, LSL #2 ;// tVal7 = 5 * (pSrcLeft[12*leftStep] - pSrcLeft[2*leftStep])
- ADD tVal6, tVal6, tVal7 ;// tVal6 = V = V + V3
- SUB tVal7, tVal8, tVal10 ;// tVal7 = pSrcLeft[11*leftStep] - pSrcLeft[3*leftStep]
- M_LDRB tVal8, [tVal9], -leftStep ;// tVal8 = pSrcLeft[10*leftStep]
- M_LDRB tVal10, [tVal1], +leftStep ;// tVal10 = pSrcLeft[4*leftStep]
- ADD tVal6, tVal6, tVal7, LSL #2 ;// tVal6 = V = V + V4
- SUB dstStep, dstStep, #16 ;// tVal5 = dstStep - 16
- SUB tVal7, tVal8, tVal10 ;// tVal7 = pSrcLeft[10*leftStep] - pSrcLeft[4*leftStep]
- M_LDRB tVal8, [tVal9], -leftStep ;// tVal8 = pSrcLeft[9*leftStep]
- M_LDRB tVal10, [tVal1], +leftStep ;// tVal10 = pSrcLeft[5*leftStep]
- ADD tVal7, tVal7, tVal7, LSL #1 ;// tVal7 = 3 * (pSrcLeft[10*leftStep] - pSrcLeft[4*leftStep])
- ADD tVal6, tVal6, tVal7 ;// tVal6 = V = V + V5
- SUB tVal7, tVal8, tVal10 ;// tVal7 = pSrcLeft[9*leftStep] - pSrcLeft[5*leftStep]
- M_LDRB tVal8, [tVal9], -leftStep ;// tVal8 = pSrcLeft[8*leftStep]
- M_LDRB tVal10, [tVal1], +leftStep ;// tVal10 = pSrcLeft[6*leftStep]
- ADD tVal6, tVal6, tVal7, LSL #1 ;// tVal6 = V = V + V6
-
- ;// M_STALL ARM1136JS=1
- SUB tVal7, tVal8, tVal10 ;// tVal7 = pSrcLeft[8*leftStep] - pSrcLeft[6*leftStep]
- ADD tVal6, tVal6, tVal7 ;// tVal6 = V = V + V7
-
- ;// M_STALL ARM1136JS=1
- ADD tVal6, tVal6, tVal6, LSL #2 ;// tVal6 = 5*V
- ADD tVal6, tVal6, #32 ;// tVal6 = 5*V + 32
-
- ;// M_STALL ARM1136JS=1
- ASR tVal14, tVal6, #6 ;// tVal14 = c = (5*V + 32)>>6
-
- ;// M_STALL ARM1136JS=1
- RSB tVal6, tVal14, tVal14, LSL #3 ;// tVal6 = 7*c
- UXTH tVal14, tVal14 ;// tVal14 = Cleared the upper half word
- ADD tVal10, tVal12, tVal12 ;// tVal10 = 2*b
- ORR tVal14, tVal14, tVal14, LSL #16 ;// tVal14 = {c , c}
- SUB tVal6, tVal2, tVal6 ;// tVal6 = d = a - 7*b - 7*c + 16
- ADD tVal1, tVal6, tVal10 ;// tVal1 = pp2 = d + 2*b
- ADD tVal10, tVal10, tVal12 ;// tVal10 =3*b
- ORR tVal0, tVal6, tVal1, LSL #16 ;// tval0 = p2p0 = pack {p2, p0}
- UXTH tVal12, tVal12 ;// tVal12 = Cleared the upper half word
- UXTH tVal10, tVal10 ;// tVal12 = Cleared the upper half word
- ORR tVal12, tVal12, tVal12, LSL #16 ;// tVal12 = {b , b}
- ORR tVal10, tVal10, tVal10, LSL #16 ;// tVal10 = {3b , 3b}
- SADD16 tVal1, tVal0, tVal12 ;// tVal1 = p3p1 = p2p0 + {b,b}
- SADD16 tVal2, tVal1, tVal10 ;// tVal2 = p6p4 = p3p1 + {3b,3b}
- SADD16 tVal4, tVal2, tVal12 ;// tVal4 = p7p5 = p6p4 + {b,b}
- SADD16 tVal6, tVal4, tVal10 ;// tVal6 = p10p8 = p7p5 + {3b,3b}
- SADD16 tVal7, tVal6, tVal12 ;// tVal7 = p11p9 = p10p8 + {b,b}
- SADD16 tVal8, tVal7, tVal10 ;// tVal8 = p14p12 = p11p9 + {3b,3b}
- SADD16 tVal9, tVal8, tVal12 ;// tVal9 = p15p13 = p14p12 + {b,b}
- LDR r0x00FF00FF, =MASK_CONST ;// r0x00FF00FF = 0x00FF00FF
-
-LOOP_PLANE
-
- USAT16 temp2, #13, p3p1
- USAT16 temp1, #13, p2p0
- SADD16 p3p1, p3p1, c
- SADD16 p2p0, p2p0, c
- AND temp2, r0x00FF00FF, temp2, ASR #5
- AND temp1, r0x00FF00FF, temp1, ASR #5
- ORR temp1, temp1, temp2, LSL #8
- STR temp1, [pDst], #4
-
- USAT16 temp2, #13, p7p5
- USAT16 temp1, #13, p6p4
- SADD16 p7p5, p7p5, c
- SADD16 p6p4, p6p4, c
- AND temp2, r0x00FF00FF, temp2, ASR #5
- AND temp1, r0x00FF00FF, temp1, ASR #5
- ORR temp1, temp1, temp2, LSL #8
- STR temp1, [pDst], #4
-
- USAT16 temp2, #13, p11p9
- USAT16 temp1, #13, p10p8
- SADD16 p11p9, p11p9, c
- SADD16 p10p8, p10p8, c
- AND temp2, r0x00FF00FF, temp2, ASR #5
- AND temp1, r0x00FF00FF, temp1, ASR #5
- ORR temp1, temp1, temp2, LSL #8
- STR temp1, [pDst], #4
-
- USAT16 temp2, #13, p15p13
- USAT16 temp1, #13, p14p12
- SADD16 p15p13, p15p13, c
- SADD16 p14p12, p14p12, c
- AND temp2, r0x00FF00FF, temp2, ASR #5
- AND temp1, r0x00FF00FF, temp1, ASR #5
- ORR temp1, temp1, temp2, LSL #8
- STR temp1, [pDst], #4
-
- ADDS r0x00FF00FF, r0x00FF00FF, #1<<28 ;// Loop counter value in top 4 bits
-
- ADD pDst, pDst, dstStep
-
- BCC LOOP_PLANE ;// Loop for 16 times
- MOV return, #OMX_Sts_NoErr
- M_END
-
- ENDIF ;// ARM1136JS
-
-
- END
-;-----------------------------------------------------------------------------------------------
-; omxVCM4P10_PredictIntra_16x16 ends
-;-----------------------------------------------------------------------------------------------
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_PredictIntra_4x4_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_PredictIntra_4x4_s.s
deleted file mode 100644
index 112139f..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_PredictIntra_4x4_s.s
+++ /dev/null
@@ -1,581 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_PredictIntra_4x4_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
-;// Define the processor variants supported by this file
-
- M_VARIANTS ARM1136JS
-
-;//-------------------------------------------------------
-;// This table for implementing switch case of C in asm by
-;// the mehtod of two levels of indexing.
-;//-------------------------------------------------------
-
- M_TABLE armVCM4P10_pSwitchTable4x4
- DCD OMX_VC_4x4_VERT, OMX_VC_4x4_HOR
- DCD OMX_VC_4x4_DC, OMX_VC_4x4_DIAG_DL
- DCD OMX_VC_4x4_DIAG_DR, OMX_VC_4x4_VR
- DCD OMX_VC_4x4_HD, OMX_VC_4x4_VL
- DCD OMX_VC_4x4_HU
-
- IF ARM1136JS
-
-;//--------------------------------------------
-;// Constants
-;//--------------------------------------------
-BLK_SIZE EQU 0x8
-MUL_CONST0 EQU 0x01010101
-ADD_CONST1 EQU 0x80808080
-
-;//--------------------------------------------
-;// Scratch variable
-;//--------------------------------------------
-return RN 0
-pTable RN 9
-pc RN 15
-r0x01010101 RN 1
-r0x80808080 RN 0
-
-tVal0 RN 0
-tVal1 RN 1
-tVal2 RN 2
-tVal4 RN 4
-tVal6 RN 6
-tVal7 RN 7
-tVal8 RN 8
-tVal9 RN 9
-tVal10 RN 10
-tVal11 RN 11
-tVal12 RN 12
-tVal14 RN 14
-
-Out0 RN 6
-Out1 RN 7
-Out2 RN 8
-Out3 RN 9
-
-Left0 RN 6
-Left1 RN 7
-Left2 RN 8
-Left3 RN 9
-
-Above0123 RN 12
-Above4567 RN 14
-
-AboveLeft RN 10
-
-;//--------------------------------------------
-;// Declare input registers
-;//--------------------------------------------
-pSrcLeft RN 0 ;// input pointer
-pSrcAbove RN 1 ;// input pointer
-pSrcAboveLeft RN 2 ;// input pointer
-pDst RN 3 ;// output pointer
-leftStep RN 4 ;// input variable
-dstStep RN 5 ;// input variable
-predMode RN 6 ;// input variable
-availability RN 7 ;// input variable
-
-;//-----------------------------------------------------------------------------------------------
-;// omxVCM4P10_PredictIntra_4x4 starts
-;//-----------------------------------------------------------------------------------------------
-
- ;// Write function header
- M_START omxVCM4P10_PredictIntra_4x4, r11
-
- ;// Define stack arguments
- M_ARG LeftStep, 4
- M_ARG DstStep, 4
- M_ARG PredMode, 4
- M_ARG Availability, 4
-
- ;// M_STALL ARM1136JS=4
-
- LDR pTable,=armVCM4P10_pSwitchTable4x4 ;// Load index table for switch case
-
- ;// Load argument from the stack
- M_LDR predMode, PredMode ;// Arg predMode loaded from stack to reg
- M_LDR leftStep, LeftStep ;// Arg leftStep loaded from stack to reg
- M_LDR dstStep, DstStep ;// Arg dstStep loaded from stack to reg
- M_LDR availability, Availability ;// Arg availability loaded from stack to reg
-
- LDR pc, [pTable, predMode, LSL #2] ;// Branch to the case based on preMode
-
-OMX_VC_4x4_VERT
-
- LDR Above0123, [pSrcAbove] ;// Above0123 = pSrcAbove[0 to 3]
- M_STR Above0123, [pDst], dstStep ;// pDst[0 to 3] = Above0123
- M_STR Above0123, [pDst], dstStep ;// pDst[4 to 7] = Above0123
- M_STR Above0123, [pDst], dstStep ;// pDst[8 to 11] = Above0123
- STR Above0123, [pDst] ;// pDst[12 to 15] = Above0123
- MOV return, #OMX_Sts_NoErr
- M_EXIT ;// Macro to exit midway-break frm case
-
-OMX_VC_4x4_HOR
-
- ;// M_STALL ARM1136JS=6
-
- LDR r0x01010101, =MUL_CONST0 ;// Const to repeat the byte in reg 4 times
- M_LDRB Left0, [pSrcLeft], leftStep ;// Left0 = pSrcLeft[0]
- M_LDRB Left1, [pSrcLeft], leftStep ;// Left1 = pSrcLeft[1]
- M_LDRB Left2, [pSrcLeft], leftStep ;// Left2 = pSrcLeft[2]
- LDRB Left3, [pSrcLeft] ;// Left3 = pSrcLeft[3]
- MUL Out0, Left0, r0x01010101 ;// replicate the val in all the bytes
- MUL Out1, Left1, r0x01010101 ;// replicate the val in all the bytes
- MUL Out2, Left2, r0x01010101 ;// replicate the val in all the bytes
- MUL Out3, Left3, r0x01010101 ;// replicate the val in all the bytes
- M_STR Out0, [pDst], dstStep ;// store {Out0} at pDst [0 to 3 ]
- M_STR Out1, [pDst], dstStep ;// store {Out1} at pDst [4 to 7 ]
- M_STR Out2, [pDst], dstStep ;// store {Out2} at pDst [8 to 11]
- STR Out3, [pDst] ;// store {Out3} at pDst [12 to 15]
- MOV return, #OMX_Sts_NoErr
- M_EXIT ;// Macro to exit midway-break frm case
-
-OMX_VC_4x4_DC
-
- ;// M_STALL ARM1136JS=6
-
- AND availability, availability, #(OMX_VC_UPPER + OMX_VC_LEFT)
- CMP availability, #(OMX_VC_UPPER + OMX_VC_LEFT)
- BNE UpperOrLeftOrNoneAvailable ;// Jump to Upper if not both
- LDR Above0123, [pSrcAbove] ;// Above0123 = pSrcAbove[0 to 3]
-
- ;// M_STALL ARM1136JS=1
-
- UXTB16 tVal7, Above0123 ;// pSrcAbove[0, 2]
- UXTB16 tVal6, Above0123, ROR #8 ;// pSrcAbove[1, 3]
- UADD16 tVal11, tVal6, tVal7 ;// pSrcAbove[0, 2] + pSrcAbove[1, 3]
- M_LDRB Left0, [pSrcLeft], leftStep ;// Left0 = pSrcLeft[0]
- M_LDRB Left1, [pSrcLeft], leftStep ;// Left1 = pSrcLeft[1]
- ADD tVal11, tVal11, LSR #16 ;// sum(pSrcAbove[0] to pSrcAbove[3])
- M_LDRB Left2, [pSrcLeft], leftStep ;// Left2 = pSrcLeft[2]
- LDRB Left3, [pSrcLeft] ;// Left3 = pSrcLeft[3]
- UXTH tVal11, tVal11 ;// upsum1 (Clear the top junk bits)
- ADD tVal6, Left0, Left1 ;// tVal6 = Left0 + Left1
- ADD tVal7, Left2, Left3 ;// tVal7 = Left2 + Left3
- ADD tVal6, tVal6, tVal7 ;// tVal6 = tVal6 + tVal7
- ADD Out0, tVal6, tVal11 ;// Out0 = tVal6 + tVal11
- ADD Out0, Out0, #4 ;// Out0 = Out0 + 4
- LDR r0x01010101, =MUL_CONST0 ;// 0x01010101
- MOV Out0, Out0, LSR #3 ;// Out0 = (Out0 + 4)>>3
-
- ;// M_STALL ARM1136JS=1
-
- MUL Out0, Out0, r0x01010101 ;// replicate the val in all the bytes
-
- ;// M_STALL ARM1136JS=1
-
- MOV return, #OMX_Sts_NoErr
- M_STR Out0, [pDst], dstStep ;// store {Out0} at pDst [0 to 3 ]
- M_STR Out0, [pDst], dstStep ;// store {Out0} at pDst [4 to 7 ]
- M_STR Out0, [pDst], dstStep ;// store {Out0} at pDst [8 to 11]
- STR Out0, [pDst] ;// store {Out0} at pDst [12 to 15]
- M_EXIT ;// Macro to exit midway-break frm case
-
-UpperOrLeftOrNoneAvailable
- ;// M_STALL ARM1136JS=3
-
- CMP availability, #OMX_VC_UPPER ;// if(availability & #OMX_VC_UPPER)
- BNE LeftOrNoneAvailable ;// Jump to Left if not upper
- LDR Above0123, [pSrcAbove] ;// Above0123 = pSrcAbove[0 to 3]
-
- ;// M_STALL ARM1136JS=3
-
- UXTB16 tVal7, Above0123 ;// pSrcAbove[0, 2]
- UXTB16 tVal6, Above0123, ROR #8 ;// pSrcAbove[1, 3]
- UADD16 Out0, tVal6, tVal7 ;// pSrcAbove[0, 2] + pSrcAbove[1, 3]
- LDR r0x01010101, =MUL_CONST0 ;// 0x01010101
- ADD Out0, Out0, LSR #16 ;// sum(pSrcAbove[0] to pSrcAbove[3])
-
- ;// M_STALL ARM1136JS=1
-
- UXTH Out0, Out0 ;// upsum1 (Clear the top junk bits)
- ADD Out0, Out0, #2 ;// Out0 = Out0 + 2
-
- ;// M_STALL ARM1136JS=1
-
- MOV Out0, Out0, LSR #2 ;// Out0 = (Out0 + 2)>>2
-
- ;// M_STALL ARM1136JS=1
-
- MUL Out0, Out0, r0x01010101 ;// replicate the val in all the bytes
-
- ;// M_STALL ARM1136JS=1
-
- MOV return, #OMX_Sts_NoErr
- M_STR Out0, [pDst], dstStep ;// store {tVal6} at pDst [0 to 3 ]
- M_STR Out0, [pDst], dstStep ;// store {tVal6} at pDst [4 to 7 ]
- M_STR Out0, [pDst], dstStep ;// store {tVal6} at pDst [8 to 11]
- STR Out0, [pDst] ;// store {tVal6} at pDst [12 to 15]
-
- M_EXIT ;// Macro to exit midway-break frm case
-
-LeftOrNoneAvailable
- ;// M_STALL ARM1136JS=3
-
- LDR r0x01010101, =MUL_CONST0 ;// 0x01010101
- CMP availability, #OMX_VC_LEFT
- BNE NoneAvailable
- M_LDRB Left0, [pSrcLeft], leftStep ;// Left0 = pSrcLeft[0]
- M_LDRB Left1, [pSrcLeft], leftStep ;// Left1 = pSrcLeft[1]
- M_LDRB Left2, [pSrcLeft], leftStep ;// Left2 = pSrcLeft[2]
- LDRB Left3, [pSrcLeft] ;// Left3 = pSrcLeft[3]
- ADD Out0, Left0, Left1 ;// Out0 = Left0 + Left1
-
- ;// M_STALL ARM1136JS=1
-
- ADD Out1, Left2, Left3 ;// Out1 = Left2 + Left3
- ADD Out0, Out0, Out1 ;// Out0 = Out0 + Out1
- ADD Out0, Out0, #2 ;// Out0 = Out0 + 2
-
- ;// M_STALL ARM1136JS=1
-
- MOV Out0, Out0, LSR #2 ;// Out0 = (Out0 + 2)>>2
-
- ;// M_STALL ARM1136JS=1
-
- MUL Out0, Out0, r0x01010101 ;// replicate the val in all the bytes
-
- ;// M_STALL ARM1136JS=1
-
- MOV return, #OMX_Sts_NoErr
- M_STR Out0, [pDst], dstStep ;// store {Out0} at pDst [0 to 3 ]
- M_STR Out0, [pDst], dstStep ;// store {Out0} at pDst [4 to 7 ]
- M_STR Out0, [pDst], dstStep ;// store {Out0} at pDst [8 to 11]
- STR Out0, [pDst] ;// store {Out0} at pDst [12 to 15]
- M_EXIT ;// Macro to exit midway-break frm case
-
-NoneAvailable
- MOV Out0, #128 ;// Out0 = 128 if(count == 0)
-
- ;// M_STALL ARM1136JS=5
-
- MUL Out0, Out0, r0x01010101 ;// replicate the val in all the bytes
-
- ;// M_STALL ARM1136JS=1
-
- MOV return, #OMX_Sts_NoErr
- M_STR Out0, [pDst], dstStep ;// store {Out0} at pDst [0 to 3 ]
- M_STR Out0, [pDst], dstStep ;// store {Out0} at pDst [4 to 7 ]
- M_STR Out0, [pDst], dstStep ;// store {Out0} at pDst [8 to 11]
- STR Out0, [pDst] ;// store {Out0} at pDst [12 to 15]
- M_EXIT ;// Macro to exit midway-break frm case
-
-OMX_VC_4x4_DIAG_DL
-
- ;//------------------------------------------------------------------
- ;// f = (a+2*b+c+2)>>2
- ;// Calculate as:
- ;// d = (a + c )>>1
- ;// e = (d - b')>>1
- ;// f = e + 128
- ;//------------------------------------------------------------------
-
- ;// M_STALL ARM1136JS=3
-
- TST availability, #OMX_VC_UPPER_RIGHT
- LDMIA pSrcAbove, {Above0123, Above4567} ;// Above0123, Above4567 = pSrcAbove[0 to 7]
- LDR r0x80808080, =ADD_CONST1 ;// 0x80808080
- BNE DLUpperRightAvailable
- LDR r0x01010101, =MUL_CONST0 ;// 0x01010101
- MOV tVal7, Above0123, LSR #24 ;// {00, 00, 00, U3 }
- MOV tVal11, tVal7, LSL #24 ;// {U3, 00, 00, 00 }
- MUL Out3, tVal7, r0x01010101 ;// {U3, U3, U3, U3 }
- MOV tVal8, Above0123, LSR #16 ;// {00, 00, U3, U2 }
- MOV tVal10, Above0123, LSR #8 ;// {00, U3, U2, U1 }
- MVN tVal10, tVal10 ;// {00', U3', U2', U1'}
- UHADD8 tVal8, tVal8, Above0123 ;// {xx, xx, d1, d0 }
- UHADD8 tVal6, Above0123, tVal9 ;// {xx, d2, xx, xx }
- UHSUB8 tVal8, tVal8, tVal10 ;// {xx, xx, e1, e0 }
- UHSUB8 tVal6, tVal6, tVal10 ;// {xx, e2, xx, xx }
- UADD8 tVal8, tVal8, r0x80808080 ;// {xx, xx, f1, f0 }
- UADD8 tVal6, tVal6, r0x80808080 ;// {xx, f2, xx, xx }
-
- ;// M_STALL ARM1136JS=1
-
- PKHBT tVal6, tVal8, tVal6 ;// {xx, f2, f1, f0 }
- BIC tVal6, tVal6, #0xFF000000 ;// {00, f2, f1, f0 }
- ORR Out0, tVal6, tVal11 ;// {U3, f2, f1, f0 }
-
- ;// M_STALL ARM1136JS=1
-
- PKHTB Out1, Out3, Out0, ASR #8 ;// {U3, U3, f2, f1 }
- MOV return, #OMX_Sts_NoErr
- PKHTB Out2, Out3, Out1, ASR #8 ;// {U3, U3, U3, f2 }
-
- M_STR Out0, [pDst], dstStep ;// store {f3 to f0} at pDst[3 to 0 ]
- M_STR Out1, [pDst], dstStep ;// store {f4 to f1} at pDst[7 to 4 ]
- M_STR Out2, [pDst], dstStep ;// store {f5 to f2} at pDst[11 to 8 ]
- STR Out3, [pDst] ;// store {f6 to f3} at pDSt[15 to 12]
- M_EXIT ;// Macro to exit midway-break frm case
-
-DLUpperRightAvailable
-
- MOV tVal8, Above0123, LSR #24 ;// {00, 00, 00, U3 }
- MOV tVal9, Above0123, LSR #16 ;// {00, 00, U3, U2 }
- MOV tVal10, Above0123, LSR #8 ;// {00, U3, U2, U1 }
- ORR tVal8, tVal8, Above4567, LSL #8 ;// {U6, U5, U4, U3 }
- ORR tVal10, tVal10, Above4567, LSL #24 ;// {U4, U3, U2, U1 }
- PKHBT tVal9, tVal9, Above4567, LSL #16 ;// {U5, U4, U3, U2 }
- MVN tVal1, tVal8 ;// {U6', U5', U4', U3'}
- MVN tVal10, tVal10 ;// {U4', U3', U2', U1'}
- MVN tVal2, Above4567 ;// {U7', U6', U5', U4'}
- UHADD8 tVal6, Above0123, tVal9 ;// {d3, d2, d1, d0 }
- UHADD8 tVal9, tVal9, Above4567 ;// {d5, d4, d3, d2 }
- UHADD8 tVal8, Above4567, tVal8 ;// {d6, xx, xx, xx }
- UHSUB8 tVal6, tVal6, tVal10 ;// {e3, e2, e1, e0 }
- UHSUB8 tVal12, tVal9, tVal1 ;// {e5, e4, e3, e2 }
- UHSUB8 tVal8, tVal8, tVal2 ;// {e6, xx, xx, xx }
- UADD8 Out0, tVal6, r0x80808080 ;// {f3, f2, f1, f0 }
- UADD8 tVal9, tVal8, r0x80808080 ;// {f6, xx, xx, xx }
- UADD8 Out2, tVal12, r0x80808080 ;// {f5, f4, f3, f2 }
- MOV tVal7, Out0, LSR #8 ;// {00, f3, f2, f1 }
- AND tVal9, tVal9, #0xFF000000 ;// {f6, 00, 00, 00 }
- PKHBT Out1, tVal7, Out2, LSL #8 ;// {f4, f3, f2, f1 }
- ORR Out3, tVal9, Out2, LSR #8 ;// {f6, f5, f4, f3 }
- M_STR Out0, [pDst], dstStep ;// store {f3 to f0} at pDst[3 to 0 ]
- M_STR Out1, [pDst], dstStep ;// store {f4 to f1} at pDst[7 to 4 ]
- M_STR Out2, [pDst], dstStep ;// store {f5 to f2} at pDst[11 to 8 ]
- STR Out3, [pDst] ;// store {f6 to f3} at pDSt[15 to 12]
- MOV return, #OMX_Sts_NoErr
- M_EXIT ;// Macro to exit midway-break frm case
-
-
-OMX_VC_4x4_DIAG_DR
-
- ;// M_STALL ARM1136JS=4
-
- M_LDRB Left0, [pSrcLeft], leftStep ;// Left0 = pSrcLeft[0]
- M_LDRB Left1, [pSrcLeft], leftStep ;// Left1 = pSrcLeft[1]
- M_LDRB Left2, [pSrcLeft], leftStep ;// Left2 = pSrcLeft[2]
- LDRB Left3, [pSrcLeft] ;// Left3 = pSrcLeft[3]
- LDRB AboveLeft, [pSrcAboveLeft] ;// AboveLeft = pSrcAboveLeft[0]
- ORR tVal7, Left1, Left0, LSL #8 ;// tVal7 = 00 00 L0 L1
- LDR Above0123, [pSrcAbove] ;// Above0123 = U3 U2 U1 U0
- LDR r0x80808080, =ADD_CONST1 ;// 0x80808080
- ORR tVal8, Left3, Left2, LSL #8 ;// tVal8 = 00 00 L2 L3
- PKHBT tVal7, tVal8, tVal7, LSL #16 ;// tVal7 = L0 L1 L2 L3
- MOV tVal8, Above0123, LSL #8 ;// tVal8 = U2 U1 U0 00
- MOV tVal9, tVal7, LSR #8 ;// tVal9 = 00 L0 L1 L2
- ORR tVal8, tVal8, AboveLeft ;// tVal8 = U2 U1 U0 UL
- ORR tVal9, tVal9, AboveLeft, LSL #24 ;// tVal9 = UL L0 L1 L2
- MOV tVal10, Above0123, LSL #24 ;// tVal10= U0 00 00 00
- UXTB tVal11, tVal7, ROR #24 ;// tVal11= 00 00 00 L0
- ORR tVal10, tVal10, tVal9, LSR #8 ;// tVal10= U0 UL L0 L1
- ORR tVal11, tVal11, tVal8, LSL #8 ;// tVal11= U1 U0 UL L0
- UHADD8 tVal11, Above0123, tVal11 ;// tVal11= d1 d0 dL g0
- UHADD8 tVal10, tVal7, tVal10 ;// tVal10= g0 g1 g2 g3
- MVN tVal8, tVal8 ;// tVal8 = U2'U1'U0'UL'
- MVN tVal9, tVal9 ;// tVal9 = UL'L0'L1'L2'
- UHSUB8 tVal11, tVal11, tVal8 ;// tVal11= e1 e0 eL h0
- UHSUB8 tVal10, tVal10, tVal9 ;// tVal10= h0 h1 h2 h3
- UADD8 Out3, tVal10, r0x80808080 ;// Out3 = i0 i1 i2 i3
- UADD8 Out0, tVal11, r0x80808080 ;// Out0 = f1 f0 fL i0
- UXTH tVal11, Out3, ROR #8 ;// tVal11= 00 00 i1 i2
- MOV tVal7, Out0, LSL #8 ;// tVal7 = f0 fL i0 00
- ORR Out1, tVal7, tVal11, LSR #8 ;// Out1 = f0 fL i0 i1
- PKHBT Out2, tVal11, Out0, LSL #16 ;// Out2 = fL i0 i1 i2
- M_STR Out0, [pDst], dstStep ;// store {f1 to i0} at pDst[3 to 0 ]
- M_STR Out1, [pDst], dstStep ;// store {f0 to i1} at pDst[7 to 4 ]
- M_STR Out2, [pDst], dstStep ;// store {fL to i2} at pDst[11 to 8 ]
- STR Out3, [pDst] ;// store {i0 to i3} at pDst[15 to 12]
- MOV return, #OMX_Sts_NoErr
- M_EXIT ;// Macro to exit midway-break frm case
-
-OMX_VC_4x4_VR
-
- ;// M_STALL ARM1136JS=4
-
- LDR Above0123, [pSrcAbove] ;// Above0123 = U3 U2 U1 U0
- LDRB AboveLeft, [pSrcAboveLeft] ;// AboveLeft = 00 00 00 UL
- M_LDRB Left0, [pSrcLeft], leftStep ;// Left0 = 00 00 00 L0
- M_LDRB Left1, [pSrcLeft], leftStep ;// Left1 = 00 00 00 L1
- LDRB Left2, [pSrcLeft] ;// Left2 = 00 00 00 L2
- MOV tVal0, Above0123, LSL #8 ;// tVal0 = U2 U1 U0 00
- MOV tVal9, Above0123 ;// tVal9 = U3 U2 U1 U0
- ORR tVal14, tVal0, AboveLeft ;// tVal14 = U2 U1 U0 UL
- MVN tVal11, tVal14 ;// tVal11 = U2'U1'U0'UL'
- MOV tVal2, tVal14, LSL #8 ;// tVal2 = U1 U0 UL 00
- UHSUB8 tVal1, Above0123, tVal11 ;// tVal1 = d2 d1 d0 dL
- UHADD8 tVal10, AboveLeft, Left1 ;// tVal10 = 00 00 00 j1
- MVN tVal4, Left0 ;// tVal4 = 00 00 00 L0'
- UHSUB8 tVal4, tVal10, tVal4 ;// tVal4 = 00 00 00 k1
- ORR tVal12, tVal0, Left0 ;// tVal12 = U2 U1 U0 L0
- ORR tVal14, tVal2, Left0 ;// tVal14 = U1 U0 UL L0
- LDR r0x80808080, =ADD_CONST1 ;// 0x80808080
- UHADD8 tVal10, tVal9, tVal14 ;// tVal10 = g3 g2 g1 g0
- UADD8 Out0, tVal1, r0x80808080 ;// Out0 = e2 e1 e0 eL
- UHSUB8 tVal10, tVal10, tVal11 ;// tVal10 = h3 h2 h1 h0
- M_STR Out0, [pDst], dstStep ;// store {e2 to eL} at pDst[3 to 0 ]
- MOV tVal1, tVal14, LSL #8 ;// tVal1 = U0 UL L0 00
- MOV tVal6, Out0, LSL #8 ;// tVal6 = e1 e0 eL 00
- ORR tVal2, tVal2, Left1 ;// tVal2 = U1 U0 UL L1
- UADD8 tVal4, tVal4, r0x80808080 ;// tVal4 = 00 00 00 l1
- UADD8 Out1, tVal10, r0x80808080 ;// Out1 = i3 i2 i1 i0
- MVN tVal2, tVal2 ;// tVal14 = U1'U0'UL'L1'
- ORR tVal1, tVal1, Left2 ;// tVal1 = U0 UL L0 L2
- ORR Out2, tVal6, tVal4 ;// Out2 = e1 e0 eL l1
- UHADD8 tVal1, tVal1, tVal12 ;// tVal1 = g2 g1 g0 j2
- M_STR Out1, [pDst], dstStep ;// store {i3 to i0} at pDst[7 to 4 ]
- M_STR Out2, [pDst], dstStep ;// store {e1 to l1} at pDst[11 to 8 ]
- UHSUB8 tVal9, tVal1, tVal2 ;// tVal9 = h2 h1 h0 k2
- UADD8 Out3, tVal9, r0x80808080 ;// Out3 = i2 i1 i0 l2
- STR Out3, [pDst] ;// store {i2 to l2} at pDst[15 to 12]
- MOV return, #OMX_Sts_NoErr
- M_EXIT ;// Macro to exit midway-break frm case
-
-OMX_VC_4x4_HD
-
- ;// M_STALL ARM1136JS=4
-
- LDR Above0123, [pSrcAbove] ;// Above0123 = U3 U2 U1 U0
- LDRB AboveLeft, [pSrcAboveLeft] ;// AboveLeft = 00 00 00 UL
- M_LDRB Left0, [pSrcLeft], leftStep ;// Left0 = 00 00 00 L0
- M_LDRB Left1, [pSrcLeft], leftStep ;// Left1 = 00 00 00 L1
- M_LDRB Left2, [pSrcLeft], leftStep ;// Left2 = 00 00 00 L2
- LDRB Left3, [pSrcLeft] ;// Left3 = 00 00 00 L3
- LDR r0x80808080, =ADD_CONST1 ;// 0x80808080
- ORR tVal2, AboveLeft, Above0123, LSL #8;// tVal2 = U2 U1 U0 UL
- MVN tVal1, Left0 ;// tVal1 = 00 00 00 L0'
- ORR tVal4, Left0, tVal2, LSL #8 ;// tVal4 = U1 U0 UL L0
- MVN tVal2, tVal2 ;// tVal2 = U2'U1'U0'UL'
- UHADD8 tVal4, tVal4, Above0123 ;// tVal4 = g3 g2 g1 g0
- UHSUB8 tVal1, AboveLeft, tVal1 ;// tVal1 = 00 00 00 dL
- UHSUB8 tVal4, tVal4, tVal2 ;// tVal4 = h3 h2 h1 h0
- UADD8 tVal1, tVal1, r0x80808080 ;// tVal1 = 00 00 00 eL
- UADD8 tVal4, tVal4, r0x80808080 ;// tVal4 = i3 i2 i1 i0
- ORR tVal2, Left0, AboveLeft, LSL #16 ;// tVal2 = 00 UL 00 L0
- MOV tVal4, tVal4, LSL #8 ;// tVal4 = i2 i1 i0 00
- ORR tVal11, Left1, Left0, LSL #16 ;// tVal11= 00 L0 00 L1
- ORR tVal7, Left2, Left1, LSL #16 ;// tVal7 = 00 L1 00 L2
- ORR tVal10, Left3, Left2, LSL #16 ;// tVal10= 00 L2 00 L3
- ORR Out0, tVal4, tVal1 ;// Out0 = i2 i1 i0 eL
- M_STR Out0, [pDst], dstStep ;// store {Out0} at pDst [0 to 3 ]
- MOV tVal4, Out0, LSL #16 ;// tVal4 = i1 i0 00 00
- UHADD8 tVal2, tVal2, tVal7 ;// tVal2 = 00 j1 00 j2
- UHADD8 tVal6, tVal11, tVal10 ;// tVal11= 00 j2 00 j3
- MVN tVal12, tVal11 ;// tVal12= 00 L0'00 L1'
- MVN tVal14, tVal7 ;// tVal14= 00 L1'00 L2'
- UHSUB8 tVal2, tVal2, tVal12 ;// tVal2 = 00 k1 00 k2
- UHSUB8 tVal8, tVal7, tVal12 ;// tVal8 = 00 d1 00 d2
- UHSUB8 tVal11, tVal6, tVal14 ;// tVal11= 00 k2 00 k3
- UHSUB8 tVal9, tVal10, tVal14 ;// tVal9 = 00 d2 00 d3
- UADD8 tVal2, tVal2, r0x80808080 ;// tVal2 = 00 l1 00 l2
- UADD8 tVal8, tVal8, r0x80808080 ;// tVal8 = 00 e1 00 e2
- UADD8 tVal11, tVal11, r0x80808080 ;// tVal11= 00 l2 00 l3
- UADD8 tVal9, tVal9, r0x80808080 ;// tVal9 = 00 e2 00 e3
- ORR Out2, tVal8, tVal2, LSL #8 ;// Out2 = l1 e1 l2 e2
- ORR Out3, tVal9, tVal11, LSL #8 ;// Out3 = l2 e2 l3 e3
- PKHTB Out1, tVal4, Out2, ASR #16 ;// Out1 = i1 i0 l1 e1
- M_STR Out1, [pDst], dstStep ;// store {Out1} at pDst [4 to 7 ]
- M_STR Out2, [pDst], dstStep ;// store {Out2} at pDst [8 to 11]
- STR Out3, [pDst] ;// store {Out3} at pDst [12 to 15]
- MOV return, #OMX_Sts_NoErr
- M_EXIT ;// Macro to exit midway-break frm case
-
-OMX_VC_4x4_VL
-
- ;// M_STALL ARM1136JS=3
-
- LDMIA pSrcAbove, {Above0123, Above4567} ;// Above0123, Above4567 = pSrcAbove[0 to 7]
- TST availability, #OMX_VC_UPPER_RIGHT
- LDR r0x80808080, =ADD_CONST1 ;// 0x80808080
- LDR r0x01010101, =MUL_CONST0 ;// 0x01010101
- MOV tVal11, Above0123, LSR #24 ;// tVal11= 00 00 00 U3
- MULEQ Above4567, tVal11, r0x01010101 ;// Above4567 = U3 U3 U3 U3
- MOV tVal9, Above0123, LSR #8 ;// tVal9 = 00 U3 U2 U1
- MVN tVal10, Above0123 ;// tVal10= U3'U2'U1'U0'
- ORR tVal2, tVal9, Above4567, LSL #24 ;// tVal2 = U4 U3 U2 U1
- UHSUB8 tVal8, tVal2, tVal10 ;// tVal8 = d4 d3 d2 d1
- UADD8 Out0, tVal8, r0x80808080 ;// Out0 = e4 e3 e2 e1
- M_STR Out0, [pDst], dstStep ;// store {Out0} at pDst [0 to 3 ]
- MOV tVal9, tVal9, LSR #8 ;// tVal9 = 00 00 U3 U2
- MOV tVal10, Above4567, LSL #8 ;// tVal10= U6 U5 U4 00
- PKHBT tVal9, tVal9, Above4567, LSL #16 ;// tVal9 = U5 U4 U3 U2
- ORR tVal10, tVal10, tVal11 ;// tVal10= U6 U5 U4 U3
- UHADD8 tVal11, tVal9, Above0123 ;// tVal11= g5 g4 g3 g2
- UHADD8 tVal14, tVal2, tVal10 ;// tVal14= g6 g5 g4 g3
- MVN tVal8, tVal2 ;// tVal8 = U4'U3'U2'U1'
- MVN tVal7, tVal9 ;// tVal7 = U5'U4'U3'U2'
- UHSUB8 tVal12, tVal9, tVal8 ;// tVal12= d5 d4 d3 d2
- UHSUB8 tVal11, tVal11, tVal8 ;// tVal11= h5 h4 h3 h2
- UHSUB8 tVal2, tVal14, tVal7 ;// tVal2 = h6 h5 h4 h3
- UADD8 Out1, tVal11, r0x80808080 ;// Out1 = i5 i4 i3 i2
- UADD8 Out2, tVal12, r0x80808080 ;// Out2 = e5 e4 e3 e2
- UADD8 Out3, tVal2, r0x80808080 ;// Out3 = i6 i5 i4 i3
- M_STR Out1, [pDst], dstStep ;// store {Out1} at pDst [4 to 7 ]
- M_STR Out2, [pDst], dstStep ;// store {Out2} at pDst [8 to 11]
- M_STR Out3, [pDst], dstStep ;// store {Out3} at pDst [12 to 15]
- MOV return, #OMX_Sts_NoErr
- M_EXIT ;// Macro to exit midway-break frm case
-
-OMX_VC_4x4_HU
-
- ;// M_STALL ARM1136JS=2
-
- LDR r0x01010101, =MUL_CONST0 ;// 0x01010101
- M_LDRB Left0, [pSrcLeft], leftStep ;// Left0 = pSrcLeft[0]
- M_LDRB Left1, [pSrcLeft], leftStep ;// Left1 = pSrcLeft[1]
- M_LDRB Left2, [pSrcLeft], leftStep ;// Left2 = pSrcLeft[2]
- LDRB Left3, [pSrcLeft] ;// Left3 = pSrcLeft[3]
- MOV r0x80808080, r0x01010101, LSL #7 ;// 0x80808080
- ORR tVal6, Left0, Left1, LSL #16 ;// tVal6 = 00 L1 00 L0
- ORR tVal7, Left1, Left2, LSL #16 ;// tVal7 = 00 L2 00 L1
- ORR tVal11, Left2, Left3, LSL #16 ;// tVal11= 00 L3 00 L2
- MUL Out3, Left3, r0x01010101 ;// Out3 = L3 L3 L3 L3
- MVN tVal8, tVal7 ;// tVal8 = 00 L2'00 L1'
- MVN tVal10, tVal11 ;// tVal10= 00 L3'00 L2'
- UHADD8 tVal4, tVal6, tVal11 ;// tVal4 = 00 g3 00 g2
- UXTB16 tVal12, Out3 ;// tVal12= 00 L3 00 L3
- UHSUB8 tVal4, tVal4, tVal8 ;// tVal4 = 00 h3 00 h2
- UHSUB8 tVal6, tVal6, tVal8 ;// tVal6 = 00 d2 00 d1
- UHSUB8 tVal11, tVal11, tVal8 ;// tVal11= 00 d3 00 d2
- UHADD8 tVal12, tVal12, tVal7 ;// tVal12= 00 g4 00 g3
- UADD8 tVal4, tVal4, r0x80808080 ;// tVal4 = 00 i3 00 i2
- UHSUB8 tVal12, tVal12, tVal10 ;// tVal12= 00 h4 00 h3
- UADD8 tVal8, tVal6, r0x80808080 ;// tVal8 = 00 e2 00 e1
- UADD8 tVal11, tVal11, r0x80808080 ;// tVal11= 00 e3 00 e2
- UADD8 tVal12, tVal12, r0x80808080 ;// tVal12= 00 i4 00 i3
- ORR Out0, tVal8, tVal4, LSL #8 ;// Out0 = i3 e2 i2 e1
- ORR Out1, tVal11, tVal12, LSL #8 ;// Out1 = i4 e3 i3 e2
- M_STR Out0, [pDst], dstStep ;// store {Out0} at pDst [0 to 3 ]
- PKHTB Out2, Out3, Out1, ASR #16 ;// Out2 = L3 L3 i4 e3
- M_STR Out1, [pDst], dstStep ;// store {Out1} at pDst [4 to 7 ]
- M_STR Out2, [pDst], dstStep ;// store {Out2} at pDst [8 to 11]
- STR Out3, [pDst] ;// store {Out3} at pDst [12 to 15]
- MOV return, #OMX_Sts_NoErr
- M_END
-
- ENDIF ;// ARM1136JS
-
-
- END
-;//-----------------------------------------------------------------------------------------------
-;// omxVCM4P10_PredictIntra_4x4 ends
-;//-----------------------------------------------------------------------------------------------
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_TransformDequantChromaDCFromPair_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_TransformDequantChromaDCFromPair_s.s
deleted file mode 100644
index b83d7f0..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_TransformDequantChromaDCFromPair_s.s
+++ /dev/null
@@ -1,142 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_TransformDequantChromaDCFromPair_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- IMPORT armVCM4P10_QPDivTable
- IMPORT armVCM4P10_VMatrixQPModTable
-
- M_VARIANTS ARM1136JS
-
-
- IF ARM1136JS
-
-;//--------------------------------------
-;// Declare input registers
-;//--------------------------------------
-ppSrc RN 0
-pDst RN 1
-QP RN 2
-
-;//--------------------------------
-;// Scratch variable for Unpack2x2
-;//--------------------------------
-pSrc RN 9
-Value RN 4
-Value2 RN 5
-Flag RN 6
-strOffset RN 7
-cstOffset RN 8
-
-;//--------------------------------
-;// Scratch variable
-;//--------------------------------
-r0w0 RN 3
-r0w1 RN 4
-
-c0w0 RN 5
-c1w0 RN 6
-
-return RN 0
-pQPDivTable RN 5
-pQPModTable RN 6
-Shift RN 9
-Scale RN 2
-
-Temp1 RN 3
-Temp2 RN 4
-Temp3 RN 7
-Temp4 RN 8
-
- ;// Write function header
- M_START omxVCM4P10_TransformDequantChromaDCFromPair, r9
-
-
- LDR pSrc, [ppSrc] ;// Load pSrc
- MOV cstOffset, #31 ;// To be used in the loop, to compute offset
-
- ;//-----------------------------------------------------------------------
- ;// Firstly, fill all the coefficient values on the <pDst> buffer by zero
- ;//-----------------------------------------------------------------------
-
- MOV Value, #0 ;// Initialize the zero value
- MOV Value2, #0 ;// Initialize the zero value
- LDRB Flag, [pSrc], #1 ;// Preload <Flag> before <unpackLoop>
- STRD Value, [pDst, #0] ;// pDst[0] = pDst[1] = pDst[2] = pDst[3] = 0
-
-
-unpackLoop
- TST Flag, #0x10 ;// Computing (Flag & 0x10)
- LDRSBNE Value2,[pSrc,#1]
- LDRBNE Value, [pSrc], #2 ;// Load byte wise to avoid unaligned access
- AND strOffset, cstOffset, Flag, LSL #1 ;// strOffset = (Flag & 15) < 1;
- LDRSBEQ Value, [pSrc], #1 ;// Value = (OMX_U8) *pSrc++
- ORRNE Value,Value,Value2, LSL #8 ;// Value = (OMX_U16) *pSrc++
-
- TST Flag, #0x20 ;// Computing (Flag & 0x20) to check, if we're done
- LDRBEQ Flag, [pSrc], #1 ;// Flag = (OMX_U8) *pSrc++, for next iteration
- STRH Value, [pDst, strOffset] ;// Store <Value> at offset <strOffset>
- BEQ unpackLoop ;// Branch to the loop beginning
-
- LDMIA pDst, {r0w0, r0w1} ;// r0w0 = |c1|c0| & r0w1 = |c3|c2|
-
-
- STR pSrc, [ppSrc] ;// Update the bitstream pointer
-
- LDR pQPDivTable, =armVCM4P10_QPDivTable ;// QP Division look-up-table base pointer
- LDR pQPModTable, =armVCM4P10_VMatrixQPModTable ;// QP Modulo look-up-table base pointer
-
- SADDSUBX r0w0, r0w0, r0w0 ;// [ c00+c01, c00-c01 ]
- SADDSUBX r0w1, r0w1, r0w1 ;// [ c10+c11, c10-c11 ]
-
- LDRSB Shift, [pQPDivTable, QP] ;// Shift = pQPDivTable[QP]
- LDRSB Scale, [pQPModTable, QP] ;// Scale = pQPModTable[QP]
-
- SADD16 c0w0, r0w0, r0w1 ;// [ d00+d10, d01+d11 ]
- SSUB16 c1w0, r0w0, r0w1 ;// [ d00-d10, d01-d11 ]
-
- LSL Scale, Scale, Shift ;// Scale = Scale << Shift
-
- SMULTB Temp2, c0w0, Scale ;// Temp2 = T(c0w0) * Scale
- SMULTB Temp4, c1w0, Scale ;// Temp4 = T(c1w0) * Scale
- SMULBB Temp1, c0w0, Scale ;// Temp1 = B(c0w0) * Scale
- SMULBB Temp3, c1w0, Scale ;// Temp3 = B(c1w0) * Scale
- MOV Temp2, Temp2, ASR #1 ;// Temp2 = Temp2 >> 1 & Temp1 = (Temp1 >> 1) << 16
- MOV Temp4, Temp4, ASR #1 ;// Temp4 = Temp4 >> 1 & Temp3 = (Temp3 >> 1) << 16
- PKHBT c0w0, Temp2, Temp1, LSL #15 ;// c0w0 = | Temp1 | Temp2 |
- PKHBT c1w0, Temp4, Temp3, LSL #15 ;// c1w0 = | Temp3 | Temp4 |
- STMIA pDst, {c0w0, c1w0} ;// Storing all the coefficients at once
- MOV return, #OMX_Sts_NoErr
- M_END
-
- ENDIF ;// ARM1136JS
-
-
-
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_TransformDequantLumaDCFromPair_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_TransformDequantLumaDCFromPair_s.s
deleted file mode 100644
index 6974cd1..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p10/src/omxVCM4P10_TransformDequantLumaDCFromPair_s.s
+++ /dev/null
@@ -1,483 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_TransformDequantLumaDCFromPair_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-;// Description:
-;// H.264 inverse quantize and transform module
-;//
-;//
-
-;// Include standard headers
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
-;// Import/Export symbols required from/to other files
-;// (For example tables)
-
- IMPORT armVCM4P10_UnpackBlock4x4
- IMPORT armVCM4P10_QPDivTable
- IMPORT armVCM4P10_VMatrixQPModTable
-
- M_VARIANTS ARM1136JS
-
-;// Set debugging level
-;//DEBUG_ON SETL {TRUE}
-
-
-;// Static Function: armVCM4P10_InvTransformDequantLumaDC4x4
-
-
-;// Guarding implementation by the processor name
-
- IF ARM1136JS
-
-
-;//Input Registers
-pData RN 0
-QP RN 1
-
-;//Output Registers
-
-
-;//Local Scratch Registers
-
-;// Packed Input pixels
-in00 RN 2 ;// Src[0] & Src[1]
-in02 RN 3 ;// Src[2] & Src[3]
-in10 RN 4 ;// Src[4] & Src[5]
-in12 RN 5 ;// Src[6] & Src[7]
-in20 RN 6 ;// Src[8] & Src[9]
-in22 RN 7 ;// Src[10] & Src[11]
-in30 RN 8 ;// Src[12] & Src[13]
-in32 RN 9 ;// Src[14] & Src[15]
-
-;// Transpose for Row operations (Rows to cols)
-trRow00 RN 2
-trRow10 RN 10
-trRow02 RN 3
-trRow12 RN 5
-trRow20 RN 11
-trRow30 RN 12
-trRow32 RN 14
-trRow22 RN 7
-
-;// Intermediate calculations
-rowSum1 RN 4
-rowSum2 RN 6
-rowDiff1 RN 8
-rowDiff2 RN 9
-
-
-;// Row operated pixels
-rowOp00 RN 2
-rowOp10 RN 10
-rowOp20 RN 11
-rowOp30 RN 12
-rowOp02 RN 3
-rowOp12 RN 5
-rowOp22 RN 7
-rowOp32 RN 14
-
-;// Transpose for colulmn operations
-trCol00 RN 2
-trCol02 RN 3
-trCol10 RN 4
-trCol12 RN 5
-trCol20 RN 6
-trCol22 RN 7
-trCol30 RN 8
-trCol32 RN 9
-
-;// Intermediate calculations
-colSum1 RN 10
-colSum2 RN 11
-colDiff1 RN 12
-colDiff2 RN 14
-
-
-;// Coloumn operated pixels
-colOp00 RN 2
-colOp02 RN 3
-colOp10 RN 4
-colOp12 RN 5
-colOp20 RN 6
-colOp22 RN 7
-colOp30 RN 8
-colOp32 RN 9
-
-;// Temporary scratch varaibles
-pQPDivTable RN 0
-pQPModTable RN 11
-Shift RN 10
-Scale RN 14
-Round RN 0
-
-temp1 RN 10
-temp2 RN 11
-temp3 RN 12
-temp4 RN 1
-
-
-
-;// InvTransformed and Dequantized pixels
-out00 RN 2
-out02 RN 3
-out10 RN 4
-out12 RN 5
-out20 RN 6
-out22 RN 7
-out30 RN 8
-out32 RN 9
-
-
-
-
- ;// Allocate stack memory required by the function
- M_ALLOC4 pDataOnStack, 4
-
- ;// Write function header
- M_START armVCM4P10_InvTransformDequantLumaDC4x4,r11
-
- ;******************************************************************
- ;// The strategy used in implementing the transform is as follows:*
- ;// Load the 4x4 block into 8 registers *
- ;// Transpose the 4x4 matrix *
- ;// Perform the row operations (on columns) using SIMD *
- ;// Transpose the 4x4 result matrix *
- ;// Perform the coloumn operations *
- ;// Store the 4x4 block at one go *
- ;******************************************************************
-
- ;// Load all the 4x4 pixels
-
- LDMIA pData,{in00,in02,in10,in12,in20,in22,in30,in32}
-
- ;//*****************************************************************
- ;//
- ;// Transpose the matrix inorder to perform row ops as coloumn ops
- ;// Input: in[][] = original matrix
- ;// Output: trRow[][]= transposed matrix
- ;// Step1: Obtain the LL part of the transposed matrix
- ;// Step2: Obtain the HL part
- ;// step3: Obtain the LH part
- ;// Step4: Obtain the HH part
- ;//
- ;//*****************************************************************
-
- ;// LL 2x2 transposed matrix
- ;// d0 d1 - -
- ;// d4 d5 - -
- ;// - - - -
- ;// - - - -
-
- PKHTB trRow10,in10,in00,ASR #16 ;// [5 4] = [f5:f1]
- PKHBT trRow00,in00,in10,LSL #16 ;// [1 0] = [f4:f0]
-
- ;// HL 2x2 transposed matrix
- ;// - - - -
- ;// - - - -
- ;// d8 d9 - -
- ;// d12 d13 - -
-
-
- PKHTB trRow30,in12,in02,ASR #16 ;// [13 12] = [7 3]
- PKHBT trRow20,in02,in12,LSL #16 ;// [9 8] = [6 2]
-
- ;// LH 2x2 transposed matrix
- ;// - - d2 d3
- ;// - - d6 d7
- ;// - - - -
- ;// - - - -
-
- PKHBT trRow02,in20,in30,LSL #16 ;// [3 2] = [f12:f8]
- PKHTB trRow12,in30,in20,ASR #16 ;// [7 6] = [f13:f9]
-
-
-
-
- ;// HH 2x2 transposed matrix
- ;// - - - -
- ;// - - - -
- ;// - - d10 d11
- ;// - - d14 d15
-
- PKHTB trRow32,in32,in22,ASR #16 ;// [15 14] = [15 11]
- PKHBT trRow22,in22,in32,LSL #16 ;// [11 10] = [14 10]
-
-
- ;****************************************
- ;// Row Operations (Performed on columns)
- ;****************************************
-
-
- ;// SIMD operations on first two columns(two rows of the original matrix)
-
- SADD16 rowSum1,trRow00,trRow10 ;// (c0+c1)
- SADD16 rowSum2,trRow20,trRow30 ;// (c2+c3)
- SSUB16 rowDiff1,trRow00,trRow10 ;// (c0-c1)
- SSUB16 rowDiff2,trRow20,trRow30 ;// (c2-c3)
- SADD16 rowOp00,rowSum1,rowSum2 ;// (c0+c1+c2+c3)
- SSUB16 rowOp10,rowSum1,rowSum2 ;// (c0+c1-c2-c3)
- SSUB16 rowOp20,rowDiff1,rowDiff2 ;// (c0-c1-c2+c3)
- SADD16 rowOp30,rowDiff1,rowDiff2 ;// (c0-c1+c2-c3)
-
-
- ;// SIMD operations on next two columns(next two rows of the original matrix)
-
- SADD16 rowSum1,trRow02,trRow12 ;// (c0+c1)
- SADD16 rowSum2,trRow22,trRow32 ;// (c2+c3)
- SSUB16 rowDiff1,trRow02,trRow12 ;// (c0-c1)
- SSUB16 rowDiff2,trRow22,trRow32 ;// (c2-c3)
- SADD16 rowOp02,rowSum1,rowSum2 ;// (c0+c1+c2+c3)
- SSUB16 rowOp12,rowSum1,rowSum2 ;// (c0+c1-c2-c3)
- SSUB16 rowOp22,rowDiff1,rowDiff2 ;// (c0-c1-c2+c3)
- SADD16 rowOp32,rowDiff1,rowDiff2 ;// (c0-c1+c2-c3)
-
-
-
- ;*****************************************************************
- ;// Transpose the resultant matrix
- ;// Input: rowOp[][]
- ;// Output: trCol[][]
- ;*****************************************************************
-
- ;// LL 2x2 transposed matrix
- ;// d0 d1 - -
- ;// d4 d5 - -
- ;// - - - -
- ;// - - - -
-
- PKHTB trCol10,rowOp10,rowOp00,ASR #16 ;// [5 4] = [f5:f1]
- PKHBT trCol00,rowOp00,rowOp10,LSL #16 ;// [1 0] = [f4:f0]
-
- ;// HL 2x2 transposed matrix
- ;// - - - -
- ;// - - - -
- ;// d8 d9 - -
- ;// d12 d13 - -
-
-
- PKHTB trCol30,rowOp12,rowOp02,ASR #16 ;// [13 12] = [7 3]
- PKHBT trCol20,rowOp02,rowOp12,LSL #16 ;// [9 8] = [6 2]
-
- ;// LH 2x2 transposed matrix
- ;// - - d2 d3
- ;// - - d6 d7
- ;// - - - -
- ;// - - - -
-
- PKHBT trCol02,rowOp20,rowOp30,LSL #16 ;// [3 2] = [f12:f8]
- PKHTB trCol12,rowOp30,rowOp20,ASR #16 ;// [7 6] = [f13:f9]
-
-
-
-
- ;// HH 2x2 transposed matrix
- ;// - - - -
- ;// - - - -
- ;// - - d10 d11
- ;// - - d14 d15
-
- PKHTB trCol32,rowOp32,rowOp22,ASR #16 ;// [15 14] = [15 11]
- PKHBT trCol22,rowOp22,rowOp32,LSL #16 ;// [11 10] = [14 10]
-
-
- ;*******************************
- ;// Coloumn Operations
- ;*******************************
-
- ;//--------------------------------------------------------------------------------------
- ;// Store pData(RN0) on stack and restore it only at the final store back
- ;// This frees up a register (RN0) which is used to reduce number of intermediate stalls
- ;//--------------------------------------------------------------------------------------
- M_STR pData,pDataOnStack
-
-
- ;// SIMD operations on first two columns(two rows of the original matrix)
-
- SADD16 colSum1,trCol00,trCol10 ;// (c0+c1)
- SADD16 colSum2,trCol20,trCol30 ;// (c2+c3)
- SSUB16 colDiff1,trCol00,trCol10 ;// (c0-c1)
- SSUB16 colDiff2,trCol20,trCol30 ;// (c2-c3)
- SADD16 colOp00,colSum1,colSum2 ;// (c0+c1+c2+c3)
- SSUB16 colOp10,colSum1,colSum2 ;// (c0+c1-c2-c3)
- SSUB16 colOp20,colDiff1,colDiff2 ;// (c0-c1-c2+c3)
- SADD16 colOp30,colDiff1,colDiff2 ;// (c0-c1+c2-c3)
-
-
- ;// SIMD operations on next two columns(next two rows of the original matrix)
-
- LDR pQPDivTable, =armVCM4P10_QPDivTable ;// QP Division look-up-table base pointer
- SADD16 colSum1,trCol02,trCol12 ;// (c0+c1)
- SADD16 colSum2,trCol22,trCol32 ;// (c2+c3)
- SSUB16 colDiff1,trCol02,trCol12 ;// (c0-c1)
- SSUB16 colDiff2,trCol22,trCol32 ;// (c2-c3)
- SADD16 colOp02,colSum1,colSum2 ;// (c0+c1+c2+c3)
- SSUB16 colOp12,colSum1,colSum2 ;// (c0+c1-c2-c3)
- LDR pQPModTable, =armVCM4P10_VMatrixQPModTable ;// QP Modulo look-up-table base pointer
- LDRSB Shift, [pQPDivTable, QP] ;// Shift = pQPDivTable[QP]
- SSUB16 colOp22,colDiff1,colDiff2 ;// (c0-c1-c2+c3)
- SADD16 colOp32,colDiff1,colDiff2 ;// (c0-c1+c2-c3)
-
-
- LDRSB Scale, [pQPModTable, QP] ;// Scale = pQPModTable[QP]
-
- ;//----------------------------------------------------------------------
- ;//
- ;// <Dequantize> improves on the c-reference code
- ;// Both the cases i.e., Shift>=0 and Shift<0 cases are covered together
- ;// We do not subtract 2 from Shift as in C reference, instead perform a
- ;// Scale << Shift once in the beginning and do a right shift by a
- ;// constant 2 after the Multiplication. The value of Round would be 2
- ;//
- ;// By doing this we aviod the Branches required and also
- ;// reduce the code size substantially
- ;//
- ;//----------------------------------------------------------------------
-
- MOV Round, #2 ;// Round = 2
- LSL Scale, Scale, Shift ;// Scale = Scale << Shift
-
-
- ;// Row 1
- SMLABB temp1, colOp00, Scale, Round ;// Temp1 = B(c0w0) * Scale + Round
- SMLABB temp3, colOp02, Scale, Round ;// Temp3 = B(c1w0) * Scale + Round
- SMLATB temp2, colOp00, Scale, Round ;// Temp2 = T(c0w0) * Scale + Round
- SMLATB temp4, colOp02, Scale, Round ;// Temp4 = T(c1w0) * Scale + Round
-
- ASR temp1, temp1, #2 ;// Temp1 = Temp1 >> 2
- ASR temp3, temp3, #2 ;// Temp3 = Temp3 >> 2
- PKHBT out00, temp1, temp2, LSL #14 ;// c0w0 = | Temp2 | Temp1 |
- PKHBT out02, temp3, temp4, LSL #14 ;// c1w0 = | Temp2 | Temp1 |
-
-
- ;// Row 2
- SMLABB temp1, colOp10, Scale, Round ;// Temp1 = B(c0w0) * Scale + Round
- SMLABB temp3, colOp12, Scale, Round ;// Temp3 = B(c1w0) * Scale + Round
- SMLATB temp2, colOp10, Scale, Round ;// Temp2 = T(c0w0) * Scale + Round
- SMLATB temp4, colOp12, Scale, Round ;// Temp4 = T(c1w0) * Scale + Round
-
- ASR temp1, temp1, #2 ;// Temp1 = Temp1 >> 2
- ASR temp3, temp3, #2 ;// Temp3 = Temp3 >> 2
- PKHBT out10, temp1, temp2, LSL #14 ;// c0w0 = | Temp2 | Temp1 |
- PKHBT out12, temp3, temp4, LSL #14 ;// c1w0 = | Temp2 | Temp1 |
-
- ;// Row 3
- SMLABB temp1, colOp20, Scale, Round ;// Temp1 = B(c0w0) * Scale + Round
- SMLABB temp3, colOp22, Scale, Round ;// Temp3 = B(c1w0) * Scale + Round
- SMLATB temp2, colOp20, Scale, Round ;// Temp2 = T(c0w0) * Scale + Round
- SMLATB temp4, colOp22, Scale, Round ;// Temp4 = T(c1w0) * Scale + Round
-
- ASR temp1, temp1, #2 ;// Temp1 = Temp1 >> 2
- ASR temp3, temp3, #2 ;// Temp3 = Temp3 >> 2
- PKHBT out20, temp1, temp2, LSL #14 ;// c0w0 = | Temp2 | Temp1 |
- PKHBT out22, temp3, temp4, LSL #14 ;// c1w0 = | Temp2 | Temp1 |
-
- ;// Row 4
- SMLABB temp1, colOp30, Scale, Round ;// Temp1 = B(c0w0) * Scale + Round
- SMLABB temp3, colOp32, Scale, Round ;// Temp3 = B(c1w0) * Scale + Round
- SMLATB temp2, colOp30, Scale, Round ;// Temp2 = T(c0w0) * Scale + Round
- SMLATB temp4, colOp32, Scale, Round ;// Temp4 = T(c1w0) * Scale + Round
-
- M_LDR pData,pDataOnStack ;// Restore pData pointer from stack
- ASR temp1, temp1, #2 ;// Temp1 = Temp1 >> 2
- ASR temp3, temp3, #2 ;// Temp3 = Temp3 >> 2
- PKHBT out30, temp1, temp2, LSL #14 ;// c0w0 = | Temp2 | Temp1 |
- PKHBT out32, temp3, temp4, LSL #14 ;// c1w0 = | Temp2 | Temp1 |
-
-
-
- ;***************************
- ;// Store all the 4x4 pixels
- ;***************************
-
-store_coeff
-
- STMIA pData,{out00,out02,out10,out12,out20,out22,out30,out32}
-
-
-
- ;// Set return value
-
-
- ;// Write function tail
- M_END
-
- ENDIF ;//ARM1136JS
-
-
-;// Static Function: armVCM4P10_InvTransformDequantLumaDC4x4
-
-;// Guarding implementation by the processor name
-
-
-
-
-;// Function: omxVCM4P10_TransformDequantLumaDCFromPair
-
-;//Input Registers
-ppSrc RN 0
-pDst RN 1
-QPR2 RN 2
-
-;//Output Registers
-result RN 0
-
-;//Local Scratch Registers
-pDstR4 RN 4
-pDstR0 RN 0
-QPR1 RN 1
-QPR5 RN 5
-
-;// Guarding implementation by the processor name
-
- IF ARM1136JS
-
- ;// Allocate stack memory required by the function
-
-
- ;// Write function header
- M_START omxVCM4P10_TransformDequantLumaDCFromPair,r5
-
- MOV pDstR4,pDst ;// Saving register r1
- MOV QPR5,QPR2 ;// Saving register r2
- BL armVCM4P10_UnpackBlock4x4
-
- MOV pDstR0,pDstR4 ;// Setting up register r0
- MOV QPR1,QPR5 ;// Setting up register r1
- BL armVCM4P10_InvTransformDequantLumaDC4x4
-
-
- ;// Set return value
- MOV result,#OMX_Sts_NoErr
-
- ;// Write function tail
- M_END
-
-
- ENDIF ;//ARM1136JS
-
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/api/armVCM4P2_Huff_Tables_VLC.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/api/armVCM4P2_Huff_Tables_VLC.h
deleted file mode 100644
index 359e752..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/api/armVCM4P2_Huff_Tables_VLC.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_Huff_Tables_VLC.h
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- *
- * File: armVCM4P2_Huff_Tables.h
- * Description: Declares Tables used for Hufffman coding and decoding
- * in MP4P2 codec.
- *
- */
-
-#ifndef _OMXHUFFTAB_H_
-#define _OMXHUFFTAB_H_
-
-
-extern const OMX_U16 armVCM4P2_IntraVlcL0L1[200];
-
-
-extern const OMX_U16 armVCM4P2_InterVlcL0L1[200];
-
-extern const OMX_U16 armVCM4P2_aIntraDCLumaChromaIndex[64];
-//extern const OMX_U16 armVCM4P2_aIntraDCChromaIndex[32];
-extern const OMX_U16 armVCM4P2_aVlcMVD[124];
-
-extern const OMX_U8 armVCM4P2_InterL0L1LMAX[73];
-extern const OMX_U8 armVCM4P2_InterL0L1RMAX[35];
-extern const OMX_U8 armVCM4P2_IntraL0L1LMAX[53];
-extern const OMX_U8 armVCM4P2_IntraL0L1RMAX[40]
-
-#endif /* _OMXHUFFTAB_H_ */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/api/armVCM4P2_ZigZag_Tables.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/api/armVCM4P2_ZigZag_Tables.h
deleted file mode 100644
index 286ba04..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/api/armVCM4P2_ZigZag_Tables.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_ZigZag_Tables.h
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- *
- * File: armVCM4P2_Zigzag_Tables.h
- * Description: Declares Tables used for Zigzag scan in MP4P2 codec.
- *
- */
-
-#ifndef _OMXZIGZAGTAB_H
-#define _OMXZIGZAGTAB_H
-
-extern const OMX_U8 armVCM4P2_aClassicalZigzagScan [192];
-//extern const OMX_U8 armVCM4P2_aHorizontalZigzagScan [64];
-//extern const OMX_U8 armVCM4P2_aVerticalZigzagScan [64];
-
-#endif /* _OMXZIGZAGTAB_H_ */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/armVCM4P2_Clip8_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/armVCM4P2_Clip8_s.s
deleted file mode 100644
index 241d441..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/armVCM4P2_Clip8_s.s
+++ /dev/null
@@ -1,89 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-; /**
-; *
-; * File Name: armVCM4P2_Clip8_s.s
-; * OpenMAX DL: v1.0.2
-; * Revision: 9641
-; * Date: Thursday, February 7, 2008
-; *
-; *
-; *
-; *
-; * Description:
-; * Contains module for Clipping 16 bit value to [0,255] Range
-; */
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
-
- M_VARIANTS ARM1136JS
-
-
-
- IF ARM1136JS
-
-;//Input Arguments
-
-pSrc RN 0
-pDst RN 1
-step RN 2
-
-;// Local variables
-
-x0 RN 3
-x1 RN 4
-x2 RN 5
-x3 RN 6
-
-Count RN 14
-
-
- M_START armVCM4P2_Clip8,r6
-
-
- MOV Count,#8
-loop
-
- LDMIA pSrc!,{x0, x1}
- SUBS Count,Count, #1 ;// count down
- LDMIA pSrc!,{x2, x3}
- USAT16 x0, #8, x0 ;// clip two samples to [0,255]
- USAT16 x1, #8, x1 ;// clip two samples to [0,255]
- STRB x0, [pDst]
- MOV x0, x0, LSR #16
- STRB x0, [pDst,#1]
- STRB x1, [pDst,#2]
- MOV x1, x1, LSR #16
- STRB x1, [pDst,#3]
-
- USAT16 x2, #8, x2 ;// clip two samples to [0,255]
- USAT16 x3, #8, x3 ;// clip two samples to [0,255]
- STRB x2, [pDst,#4]
- MOV x2, x2, LSR #16
- STRB x2, [pDst,#5]
- STRB x3, [pDst,#6]
- MOV x3, x3, LSR #16
- STRB x3, [pDst,#7]
- ADD pDst,pDst,step ;// Increment pDst by step value
-
- BGT loop ;// Continue loop until Count reaches 64
-
- M_END
- ENDIF
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/armVCM4P2_DecodeVLCZigzag_AC_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/armVCM4P2_DecodeVLCZigzag_AC_unsafe_s.s
deleted file mode 100644
index 96f5bed..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/armVCM4P2_DecodeVLCZigzag_AC_unsafe_s.s
+++ /dev/null
@@ -1,412 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;/**
-; *
-; * File Name: armVCM4P2_DecodeVLCZigzag_AC_unsafe_s.s
-; * OpenMAX DL: v1.0.2
-; * Revision: 9641
-; * Date: Thursday, February 7, 2008
-; *
-; *
-; *
-; *
-; * Description:
-; * Contains modules for zigzag scanning and VLC decoding
-; * for inter, intra block.
-; *
-; *
-; *
-; * Function: omxVCM4P2_DecodeVLCZigzag_AC_unsafe
-; *
-; * Description:
-; * Performs VLC decoding and inverse zigzag scan
-; *
-; *
-; *
-; *
-; */
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
- INCLUDE armCOMM_BitDec_s.h
-
-
- M_VARIANTS ARM1136JS
-
-
-
-
-
- IF ARM1136JS
-
-
-
-
-
-;//Input Arguments
-
-ppBitStream RN 0
-pBitOffset RN 1
-pDst RN 2
-shortVideoHeader RN 3
-
-
-;//Local Variables
-
-Return RN 0
-
-pVlcTableL0L1 RN 4
-pLMAXTableL0L1 RN 4
-pRMAXTableL0L1 RN 4
-pZigzagTable RN 4
-
-ftype RN 0
-temp3 RN 4
-temp RN 5
-Count RN 6
-Escape RN 5
-
-;// armVCM4P2_FillVLDBuffer
-zigzag RN 0
-storeLevel RN 1
-temp2 RN 4
-temp1 RN 5
-sign RN 5
-Last RN 7
-storeRun RN 14
-
-
-packRetIndex RN 5
-
-
-markerbit RN 5
-
-;// Scratch Registers
-
-RBitStream RN 8
-RBitBuffer RN 9
-RBitCount RN 10
-
-T1 RN 11
-T2 RN 12
-LR RN 14
-
-
-
- M_ALLOC4 pppBitStream,4
- M_ALLOC4 ppOffset,4
- M_ALLOC4 pLinkRegister,4
-
- M_START armVCM4P2_DecodeVLCZigzag_AC_unsafe
-
- ;// get the table addresses from stack
- M_ARG ppVlcTableL0L1,4
- M_ARG ppLMAXTableL0L1,4
- M_ARG ppRMAXTableL0L1,4
- M_ARG ppZigzagTable,4
-
- ;// Store ALL zeros at pDst
-
- MOV temp1,#0 ;// Initialize Count to zero
- MOV Last,#0
- M_STR LR,pLinkRegister ;// Store Link Register on Stack
- MOV temp2,#0
- MOV LR,#0
-
- ;// Initialize the Macro and Store all zeros to pDst
-
- STM pDst!,{temp2,temp1,Last,LR}
- M_BD_INIT0 ppBitStream, pBitOffset, RBitStream, RBitBuffer, RBitCount
- STM pDst!,{temp2,temp1,Last,LR}
- M_BD_INIT1 T1, T2, T2
- STM pDst!,{temp2,temp1,Last,LR}
- M_BD_INIT2 T1, T2, T2
- STM pDst!,{temp2,temp1,Last,LR}
- M_STR ppBitStream,pppBitStream ;// Store ppBitstream on stack
- STM pDst!,{temp2,temp1,Last,LR}
- M_STR pBitOffset,ppOffset ;// Store pBitOffset on stack
- STM pDst!,{temp2,temp1,Last,LR}
-
- STM pDst!,{temp2,temp1,Last,LR}
- STM pDst!,{temp2,temp1,Last,LR}
-
-
- SUB pDst,pDst,#128 ;// Restore pDst
-
- ;// The armVCM4P2_GetVLCBits begins
-
-getVLCbits
-
- M_BD_LOOK8 Escape,7 ;// Load Escape Value
- LSR Escape,Escape,#25
- CMP Escape,#3 ;// check for escape mode
- MOVNE ftype,#0
- BNE notEscapemode ;// Branch if not in Escape mode 3
-
- M_BD_VSKIP8 #7,T1
- CMP shortVideoHeader,#0 ;// Check shortVideoHeader flag to know the type of Escape mode
- BEQ endFillVLD
-
- ;// Escape Mode 4
-
- M_BD_READ8 Last,1,T1
- M_BD_READ8 storeRun,6,T1
- M_BD_READ8 storeLevel,8,T1
-
-
- ;// Check whether the Reserved values for Level are used and Exit with an Error Message if it is so
-
- TEQ storeLevel,#0
- TEQNE storeLevel,#128
- BEQ ExitError
-
- ADD temp2,storeRun,Count
- CMP temp2,#64
- BGE ExitError ;// error if Count+storeRun >= 64
-
-
- ;// Load address of zigzagTable
-
- M_LDR pZigzagTable,ppZigzagTable ;// Loading the Address of Zigzag table
-
-
- ;// armVCM4P2_FillVLDBuffer
-
- SXTB storeLevel,storeLevel ;// Sign Extend storeLevel to 32 bits
-
-
- ;// To Reflect Runlength
-
- ADD Count,Count,storeRun
- LDRB zigzag,[pZigzagTable,Count]
- ADD Count,Count,#1
- STRH storeLevel,[pDst,zigzag] ;// store Level
-
- B ExitOk
-
-
-
-endFillVLD
-
-
- ;// Load Ftype( Escape Mode) value based on the two successive bits in the bitstream
-
- M_BD_READ8 temp1,1,T1
- CMP temp1,#0
- MOVEQ ftype,#1
- BEQ notEscapemode
- M_BD_READ8 temp1,1,T1
- CMP temp1,#1
- MOVEQ ftype,#3
- MOVNE ftype,#2
-
-
-notEscapemode
-
- ;// Load optimized packed VLC table with last=0 and Last=1
-
- M_LDR pVlcTableL0L1,ppVlcTableL0L1 ;// Load Combined VLC Table
-
-
- CMP ftype,#3 ;// If ftype >=3 get perform Fixed Length Decoding (Escape Mode 3)
- BGE EscapeMode3 ;// Else continue normal VLC Decoding
-
- ;// Variable lengh decoding, "armUnPackVLC32"
-
-
- M_BD_VLD packRetIndex,T1,T2,pVlcTableL0L1,4,2
-
-
- LDR temp3,=0xFFF
-
- CMP packRetIndex,temp3 ;// Check for invalid symbol
- BEQ ExitError ;// if invalid symbol occurs exit with an error message
-
- AND Last,packRetIndex,#2 ;// Get Last from packed Index
-
-
-
-
- LSR storeRun,packRetIndex,#7 ;// Get Run Value from Packed index
- AND storeLevel,packRetIndex,#0x7c ;// storeLevel=packRetIndex[2-6],storeLevel[0-1]=0
-
-
- M_LDR pLMAXTableL0L1,ppLMAXTableL0L1 ;// Load LMAX table
-
-
- LSR storeLevel,storeLevel,#2 ;// Level value
-
- CMP ftype,#1
- BNE ftype2
-
- ;// ftype==1; Escape mode =1
-
-
- ADD temp1, pLMAXTableL0L1, Last, LSL#4 ;// If the Last=1 add 32 to table address
- LDRB temp1,[temp1,storeRun]
-
-
- ADD storeLevel,temp1,storeLevel
-
-ftype2
-
- ;// ftype =2; Escape mode =2
-
- M_LDR pRMAXTableL0L1,ppRMAXTableL0L1 ;// Load RMAX Table
-
- CMP ftype,#2
- BNE FillVLDL1
-
- ADD temp1, pRMAXTableL0L1, Last, LSL#4 ;// If Last=1 add 32 to table address
- SUB temp2,storeLevel,#1
- LDRB temp1,[temp1,temp2]
-
-
- ADD storeRun,storeRun,#1
- ADD storeRun,temp1
-
-FillVLDL1
-
-
- ;// armVCM4P2_FillVLDBuffer
-
- M_LDR pZigzagTable,ppZigzagTable ;// Load address of zigzagTable
-
- M_BD_READ8 sign,1,T1
-
- CMP sign,#1
- RSBEQ storeLevel,storeLevel,#0
-
- ADD temp1,storeRun,Count ;// Exit with an error message if Run + Count exceeds 63
- CMP temp1,#64
- BGE ExitError
-
-
-
-
-
-
- ;// To Reflect Runlenght
-
- ADD Count,Count,storeRun
-
-storeLevelL1
-
- LDRB zigzag,[pZigzagTable,Count]
- CMP Last,#2 ;// Check if the Level val is Last non zero val
- ADD Count,Count,#1
- LSR Last,Last,#1
- STRH storeLevel,[pDst,zigzag]
-
- BNE end
-
- B ExitOk
-
-
-
- ;// Fixed Lengh Decoding Escape Mode 3
-
-EscapeMode3
-
- M_BD_READ8 Last,1,T1
- M_BD_READ8 storeRun,6,T1
-
- ADD temp2,storeRun,Count ;// Exit with an error message if Run + Count exceeds 63
- CMP temp2,#64
- BGE ExitError
-
- M_BD_READ8 markerbit,1,T1
- TEQ markerbit,#0 ;// Exit with an error message if marker bit is zero
- BEQ ExitError
-
- M_BD_READ16 storeLevel,12,T1
-
- TST storeLevel,#0x800 ;// test if the level is negative
- SUBNE storeLevel,storeLevel,#4096
- CMP storeLevel,#0
- CMPNE storeLevel,#-2048
- BEQ ExitError ;// Exit with an error message if Level==0 or -2048
-
- M_LDR pZigzagTable,ppZigzagTable ;// Load address of zigzagTable
-
- M_BD_READ8 markerbit,1,T1
-
-
- ;// armVCM4P2_FillVLDBuffer ( Sign not used as storeLevel is preprocessed)
-
-
-
- ;// To Reflect Run Length
-
- ADD Count,Count,storeRun
-
-
-
-storeLevelLast
-
- LDRB zigzag,[pZigzagTable,Count]
- CMP Last,#1
- ADD Count,Count,#1
- STRH storeLevel,[pDst,zigzag]
-
- BNE end
-
- B ExitOk
-
-end
-
- CMP Count,#64 ;//Run the Loop untill Count reaches 64
-
- BLT getVLCbits
-
-
-ExitOk
- ;// Exit When VLC Decoding is done Successfully
-
- ;// Loading ppBitStream and pBitOffset from stack
-
- CMP Last,#1
- M_LDR ppBitStream,pppBitStream
- M_LDR pBitOffset,ppOffset
-
- ;//Ending the macro
-
- M_BD_FINI ppBitStream,pBitOffset
-
- MOVEQ Return,#OMX_Sts_NoErr
- MOVNE Return,#OMX_Sts_Err
- M_LDR LR,pLinkRegister ;// Load the Link Register Back
- B exit2
-
-ExitError
- ;// Exit When an Error occurs
-
- M_LDR ppBitStream,pppBitStream
- M_LDR pBitOffset,ppOffset
- ;//Ending the macro
-
- M_BD_FINI ppBitStream,pBitOffset
- M_LDR LR,pLinkRegister
- MOV Return,#OMX_Sts_Err
-
-exit2
-
-
- M_END
- ENDIF
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/armVCM4P2_Huff_Tables_VLC.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/armVCM4P2_Huff_Tables_VLC.c
deleted file mode 100644
index 04d86ed..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/armVCM4P2_Huff_Tables_VLC.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
- /**
- *
- * File Name: armVCM4P2_Huff_Tables_VLC.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * File: armVCM4P2_Huff_Tables_VLC.c
- * Description: Contains all the Huffman tables used in MPEG4 codec
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-
-#include "armCOMM_Bitstream.h"
-
-
-
-
-// Contains optimized and Packed VLC tables with Last=0 and Last=1
-
-// optimized Packed VLC table Entry Format
-// ---------------------------------------
-//
-// 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
-// +------------------------------------------------+
-// | Len | Run | Level |L | 1 |
-// +------------------------------------------------+
-// | Offset | 0 |
-// +------------------------------------------------+
-// If the table entry is a leaf entry then bit 0 set:
-// Len = Number of bits overread (0 to 7) 3 bits
-// Run = RunLength of the Symbol (0 to 63) 6 bits
-// Level = Level of the Symbol (0 to 31) 5 bits
-// L = Last Value of the Symbol (0 or 1) 1 bit
-//
-// If the table entry is an internal node then bit 0 is clear:
-// Offset = Number of (16-bit) half words from the table
-// start to the next table node
-//
-// The table is accessed by successive lookup up on the
-// next Step bits of the input bitstream until a leaf node
-// is obtained. The Step sizes are supplied to the VLD macro.
-
-// The VLC tables used for Intra and non inta coefficients in non Escape mode
-// contains symbols with both Last=0 and Last=1.
-// If a symbol is not found in the table it will be coded as 0xFFF
-
-
-const OMX_U16 armVCM4P2_InterVlcL0L1[200] = {
- 0x0020, 0x0108, 0x0148, 0x0170, 0x0178, 0x0180, 0x0188, 0x1b09,
- 0x4009, 0x4009, 0x4009, 0x4009, 0x2109, 0x2109, 0x0209, 0x0011,
- 0x0028, 0x0060, 0x00b8, 0x00e0, 0x0030, 0x0048, 0x0050, 0x0058,
- 0x3fff, 0x3fff, 0x0038, 0x0040, 0x2115, 0x2115, 0x201d, 0x201d,
- 0x2059, 0x2059, 0x2051, 0x2051, 0x1c0d, 0x1b0d, 0x1a0d, 0x190d,
- 0x0911, 0x0811, 0x0711, 0x0611, 0x0511, 0x0319, 0x0219, 0x0121,
- 0x0068, 0x0090, 0x3fff, 0x3fff, 0x0070, 0x0078, 0x0080, 0x0088,
- 0x2061, 0x2061, 0x2129, 0x2129, 0x3709, 0x3709, 0x3809, 0x3809,
- 0x3d0d, 0x3d0d, 0x3e0d, 0x3e0d, 0x3f0d, 0x3f0d, 0x200d, 0x200d,
- 0x0098, 0x00a0, 0x00a8, 0x00b0, 0x0131, 0x0221, 0x0419, 0x0519,
- 0x0619, 0x0a11, 0x1909, 0x1a09, 0x210d, 0x220d, 0x230d, 0x240d,
- 0x250d, 0x260d, 0x270d, 0x280d, 0x00c0, 0x00c8, 0x00d0, 0x00d8,
- 0x0049, 0x0041, 0x380d, 0x380d, 0x370d, 0x370d, 0x360d, 0x360d,
- 0x350d, 0x350d, 0x340d, 0x340d, 0x330d, 0x330d, 0x320d, 0x320d,
- 0x00e8, 0x00f0, 0x00f8, 0x0100, 0x310d, 0x310d, 0x2015, 0x2015,
- 0x3609, 0x3609, 0x3509, 0x3509, 0x3409, 0x3409, 0x3309, 0x3309,
- 0x3209, 0x3209, 0x3109, 0x3109, 0x0110, 0x0130, 0x0138, 0x0140,
- 0x0118, 0x0120, 0x0128, 0x100d, 0x3009, 0x3009, 0x2f09, 0x2f09,
- 0x2411, 0x2411, 0x2311, 0x2311, 0x2039, 0x2039, 0x2031, 0x2031,
- 0x0f0d, 0x0e0d, 0x0d0d, 0x0c0d, 0x0b0d, 0x0a0d, 0x090d, 0x0e09,
- 0x0d09, 0x0211, 0x0119, 0x0029, 0x0150, 0x0158, 0x0160, 0x0168,
- 0x280d, 0x280d, 0x270d, 0x270d, 0x260d, 0x260d, 0x250d, 0x250d,
- 0x2c09, 0x2c09, 0xb759, 0xb759, 0x2a09, 0x2a09, 0x2021, 0x2021,
- 0x040d, 0x030d, 0x0b35, 0x010d, 0x0909, 0x0809, 0x0709, 0x0609,
- 0x0111, 0x0019, 0x2509, 0x2509, 0x2409, 0x2409, 0x2309, 0x2309
-};
-
-
-const OMX_U16 armVCM4P2_IntraVlcL0L1[200] = {
- 0x0020, 0x0108, 0x0148, 0x0170, 0x0178, 0x0180, 0x0188, 0x0f09,
- 0x4009, 0x4009, 0x4009, 0x4009, 0x2011, 0x2011, 0x0109, 0x0019,
- 0x0028, 0x0060, 0x00b8, 0x00e0, 0x0030, 0x0048, 0x0050, 0x0058,
- 0x3fff, 0x3fff, 0x0038, 0x0040, 0x203d, 0x203d, 0x2035, 0x2035,
- 0x20b1, 0x20b1, 0x20a9, 0x20a9, 0x0215, 0x011d, 0x002d, 0x0d09,
- 0x0519, 0x0811, 0x0419, 0x0321, 0x0221, 0x0139, 0x00a1, 0x0099,
- 0x0068, 0x0090, 0x3fff, 0x3fff, 0x0070, 0x0078, 0x0080, 0x0088,
- 0x20b9, 0x20b9, 0x20c1, 0x20c1, 0x2141, 0x2141, 0x2911, 0x2911,
- 0x2315, 0x2315, 0x2415, 0x2415, 0x2f0d, 0x2f0d, 0x300d, 0x300d,
- 0x0098, 0x00a0, 0x00a8, 0x00b0, 0x00c9, 0x00d1, 0x00d9, 0x0149,
- 0x0619, 0x0151, 0x0229, 0x0719, 0x0e09, 0x0045, 0x0515, 0x0615,
- 0x110d, 0x120d, 0x130d, 0x140d, 0x00c0, 0x00c8, 0x00d0, 0x00d8,
- 0x0091, 0x0089, 0x2e0d, 0x2e0d, 0x2d0d, 0x2d0d, 0x2c0d, 0x2c0d,
- 0x2b0d, 0x2b0d, 0x2a0d, 0x2a0d, 0x2115, 0x2115, 0x2025, 0x2025,
- 0x00e8, 0x00f0, 0x00f8, 0x0100, 0x2c09, 0x2c09, 0x2b09, 0x2b09,
- 0x2711, 0x2711, 0x2611, 0x2611, 0x2511, 0x2511, 0x2319, 0x2319,
- 0x2219, 0x2219, 0x2131, 0x2131, 0x0110, 0x0130, 0x0138, 0x0140,
- 0x0118, 0x0120, 0x0128, 0x080d, 0x2129, 0x2129, 0x2081, 0x2081,
- 0x2411, 0x2411, 0x2079, 0x2079, 0x2071, 0x2071, 0x2069, 0x2069,
- 0x1bb5, 0x060d, 0x001d, 0xd3f9, 0x0909, 0x0809, 0x090d, 0x0311,
- 0x0121, 0x0061, 0x0059, 0x0051, 0x0150, 0x0158, 0x0160, 0x0168,
- 0x240d, 0x240d, 0x230d, 0x230d, 0x2609, 0x2609, 0x250d, 0x250d,
- 0x2709, 0x2709, 0x2211, 0x2211, 0x2119, 0x2119, 0x2049, 0x2049,
- 0x0015, 0x0509, 0x020d, 0x010d, 0x0409, 0x0309, 0x0041, 0x0039,
- 0x0111, 0x0031, 0x2209, 0x2209, 0x2029, 0x2029, 0x2021, 0x2021
-};
-
-const OMX_U16 armVCM4P2_aIntraDCLumaChromaIndex[64] = {
- 0x0020, 0x000b, 0x2009, 0x2009, 0x2007, 0x2007, 0x2001, 0x2001,
- 0x4005, 0x4005, 0x4005, 0x4005, 0x4003, 0x4003, 0x4003, 0x4003,
- 0x0028, 0x000f, 0x200d, 0x200d, 0x0030, 0x0013, 0x2011, 0x2011,
- 0x0038, 0x0017, 0x2015, 0x2015, 0x3fff, 0x3fff, 0x2019, 0x2019,
-
- 0x0020, 0x0009, 0x2007, 0x2007, 0x4005, 0x4005, 0x4005, 0x4005,
- 0x4003, 0x4003, 0x4003, 0x4003, 0x4001, 0x4001, 0x4001, 0x4001,
- 0x0028, 0x000d, 0x200b, 0x200b, 0x0030, 0x0011, 0x200f, 0x200f,
- 0x0038, 0x0015, 0x2013, 0x2013, 0x1fff, 0x0019, 0x2017, 0x2017
-};
-
-
-const OMX_U16 armVCM4P2_aVlcMVD[124] = {
- 0x0010, 0x00f0, 0x0043, 0x003f, 0x4041, 0x4041, 0x4041, 0x4041,
- 0x0018, 0x00d8, 0x0047, 0x003b, 0x0020, 0x0080, 0x00a8, 0x00d0,
- 0x0028, 0x0048, 0x0070, 0x0078, 0x1fff, 0x0030, 0x0038, 0x0040,
- 0x0081, 0x0001, 0x007f, 0x0003, 0x207d, 0x207d, 0x2005, 0x2005,
- 0x207b, 0x207b, 0x2007, 0x2007, 0x0050, 0x0058, 0x0060, 0x0068,
- 0x2079, 0x2079, 0x2009, 0x2009, 0x2077, 0x2077, 0x200b, 0x200b,
- 0x2075, 0x2075, 0x200d, 0x200d, 0x2073, 0x2073, 0x200f, 0x200f,
- 0x0071, 0x0011, 0x006f, 0x0013, 0x006d, 0x0015, 0x006b, 0x0017,
- 0x0088, 0x0090, 0x0098, 0x00a0, 0x0069, 0x0019, 0x0067, 0x001b,
- 0x0065, 0x001d, 0x0063, 0x001f, 0x0061, 0x0021, 0x005f, 0x0023,
- 0x005d, 0x0025, 0x005b, 0x0027, 0x00b0, 0x00b8, 0x00c0, 0x00c8,
- 0x0059, 0x0029, 0x0057, 0x002b, 0x2055, 0x2055, 0x202d, 0x202d,
- 0x2053, 0x2053, 0x202f, 0x202f, 0x2051, 0x2051, 0x2031, 0x2031,
- 0x204f, 0x204f, 0x2033, 0x2033, 0x00e0, 0x00e8, 0x0049, 0x0039,
- 0x204d, 0x204d, 0x2035, 0x2035, 0x204b, 0x204b, 0x2037, 0x2037,
- 0x2045, 0x2045, 0x203d, 0x203d
-};
-
-/* LMAX table for non Inter (Last == 0 and Last=1)
- Level - 1 Indexed
- padded armVCM4P2_InterL0L1LMAX[27-31] with zeros to acess entries for Last=1 effectively
-
-*/
-const OMX_U8 armVCM4P2_InterL0L1LMAX[73] =
-{
- 12, 6, 4, 3, 3, 3, 3, 2,
- 2, 2, 2, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 0, 0, 0, 0, 0,
- 3, 2, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1
-};
-
-/* RMAX table for non Inter (Last == 0 and Last=1)
- Level - 1 Indexed
- padded armVCM4P2_InterL0L1RMAX[12-31] with zeros to access entries for Last=1 table effectively */
-
-
-const OMX_U8 armVCM4P2_InterL0L1RMAX[35] =
-{
- 26, 10, 6, 2, 1, 1,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0, 40, 1, 0
-};
-
-/* LMAX table for non Intra (Last == 0 and Last=1)
- Level - 1 Indexed
- padded armVCM4P2_IntraL0L1LMAX[15-31] with zeros to acess entries for Last=1 effectively
-
-*/
-const OMX_U8 armVCM4P2_IntraL0L1LMAX[53] =
-{
- 27, 10, 5, 4, 3, 3, 3,
- 3, 2, 2, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
- 8, 3, 2, 2, 2, 2, 2, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1
-};
-
-
-/* RMAX table for non Inter (Last == 0 and Last=1)
- Level - 1 Indexed
- padded armVCM4P2_IntraL0L1RMAX[27-31] with zeros to access entries for Last=1 table effectively */
-
-
-const OMX_U8 armVCM4P2_IntraL0L1RMAX[40] =
-{
- 14, 9, 7, 3, 2, 1, 1,
- 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,
-
- 20, 6, 1, 0, 0, 0, 0, 0
-
-};
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/armVCM4P2_Lookup_Tables.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/armVCM4P2_Lookup_Tables.c
deleted file mode 100644
index 04739a5..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/armVCM4P2_Lookup_Tables.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
- /**
- *
- * File Name: armVCM4P2_Lookup_Tables.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * File: armVCM4P2_Lookup_Tables.c
- * Description: Contains all the Lookup tables used in MPEG4 codec
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-
- /* * Table Entries contain Dc Scaler values
- * armVCM4P2_DCScaler[i]= 8 for i=1 to 4 and i=33 to 36
- * = 2*i for i=5 to 8
- * = i+8 for i=9 to 25
- * = 2*i-16 for i=26 to 31
- * = (i-32+13)/2 for i=37 to 59
- * = i-6-32 for i=60 to 63
- * = 255 for i=0 and i=32
- */
-
-const OMX_U8 armVCM4P2_DCScaler[64]={
- 0xff, 0x8, 0x8, 0x8, 0x8, 0xa, 0xc, 0xe,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
- 0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e,
- 0xff, 0x8, 0x8, 0x8, 0x8, 0x9, 0x9, 0xa,
- 0xa, 0xb, 0xb, 0xc, 0xc, 0xd, 0xd, 0xe,
- 0xe, 0xf, 0xf, 0x10, 0x10, 0x11, 0x11, 0x12,
- 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
-
-};
-
-
- /* Table Entries Contain reciprocal of 1 to 63
- * armVCM4P2_Reciprocal_QP_S16[i]=round(32767/i)
- * armVCM4P2_Reciprocal_QP_S16[0]= 0
- */
-
-const OMX_S16 armVCM4P2_Reciprocal_QP_S16[64]={
- 0x0000,0x7fff,0x4000,0x2aaa,0x2000,0x1999,0x1555,0x1249,
- 0x1000,0x0e39,0x0ccd,0x0ba3,0x0aab,0x09d9,0x0925,0x0888,
- 0x0800,0x0787,0x071c,0x06bd,0x0666,0x0618,0x05d1,0x0591,
- 0x0555,0x051f,0x04ec,0x04be,0x0492,0x046a,0x0444,0x0421,
- 0x0400,0x03e1,0x03c4,0x03a8,0x038e,0x0376,0x035e,0x0348,
- 0x0333,0x031f,0x030c,0x02fa,0x02e9,0x02d8,0x02c8,0x02b9,
- 0x02ab,0x029d,0x028f,0x0282,0x0276,0x026a,0x025f,0x0254,
- 0x0249,0x023f,0x0235,0x022b,0x0222,0x0219,0x0211,0x0208
-
-};
-
- /* Table Entries Contain reciprocal of 1 to 63
- * armVCM4P2_Reciprocal_QP_S32[i]=round(131071/i)
- * armVCM4P2_Reciprocal_QP_S32[0]= 0
- */
-
-const OMX_S32 armVCM4P2_Reciprocal_QP_S32[64]={
- 0x00000000,0x0001ffff,0x00010000,0x0000aaaa, 0x00008000, 0x00006666, 0x00005555, 0x00004924,
- 0x00004000,0x000038e3,0x00003333,0x00002e8c, 0x00002aab, 0x00002762, 0x00002492, 0x00002222,
- 0x00002000,0x00001e1e,0x00001c72,0x00001af2, 0x0000199a, 0x00001861, 0x00001746, 0x00001643,
- 0x00001555,0x0000147b,0x000013b1,0x000012f6, 0x00001249, 0x000011a8, 0x00001111, 0x00001084,
- 0x00001000,0x00000f84,0x00000f0f,0x00000ea1, 0x00000e39, 0x00000dd6, 0x00000d79, 0x00000d21,
- 0x00000ccd,0x00000c7d,0x00000c31,0x00000be8, 0x00000ba3, 0x00000b61, 0x00000b21, 0x00000ae5,
- 0x00000aab,0x00000a73,0x00000a3d,0x00000a0a, 0x000009d9, 0x000009a9, 0x0000097b, 0x0000094f,
- 0x00000925,0x000008fb,0x000008d4,0x000008ae, 0x00000889, 0x00000865, 0x00000842, 0x00000820
-
-};
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/armVCM4P2_SetPredDir_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/armVCM4P2_SetPredDir_s.s
deleted file mode 100644
index d0d13d1..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/armVCM4P2_SetPredDir_s.s
+++ /dev/null
@@ -1,118 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P2_SetPredDir_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
-; **
-; * Function: armVCM4P2_SetPredDir
-; *
-; * Description:
-; * Performs detecting the prediction direction
-; *
-; * Remarks:
-; *
-; * Parameters:
-; * [in] blockIndex block index indicating the component type and
-; * position as defined in subclause 6.1.3.8, of ISO/IEC
-; * 14496-2. Furthermore, indexes 6 to 9 indicate the
-; * alpha blocks spatially corresponding to luminance
-; * blocks 0 to 3 in the same macroblock.
-; * [in] pCoefBufRow pointer to the coefficient row buffer
-; * [in] pQpBuf pointer to the quantization parameter buffer
-; * [out]predQP quantization parameter of the predictor block
-; * [out]predDir indicates the prediction direction which takes one
-; * of the following values:
-; * OMX_VC_HORIZONTAL predict horizontally
-; * OMX_VC_VERTICAL predict vertically
-; *
-; * Return Value:
-; * Standard OMXResult result. See enumeration for possible result codes.
-; *
-; */
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
- INCLUDE omxVC_s.h
-
-
- M_VARIANTS ARM1136JS
-
-
- IF ARM1136JS
-
-;// Input Arguments
-BlockIndex RN 0
-pCoefBufRow RN 1
-pCoefBufCol RN 2
-predDir RN 3
-predQP RN 4
-pQpBuf RN 5
-
-;// Local Variables
-
-Return RN 0
-blockDCLeft RN 6
-blockDCTop RN 7
-blockDCTopLeft RN 8
-temp1 RN 9
-temp2 RN 14
-
- M_START armVCM4P2_SetPredDir,r9
-
- M_ARG ppredQP,4
- M_ARG ppQpBuf,4
-
- LDRH blockDCTopLeft,[pCoefBufRow,#-16]
- LDRH blockDCLeft,[pCoefBufCol]
-
- TEQ BlockIndex,#3
- LDREQH blockDCTop,[pCoefBufCol,#-16]
- LDRNEH blockDCTop,[pCoefBufRow]
-
- SUBS temp1,blockDCLeft,blockDCTopLeft
- RSBLT temp1,temp1,#0
- SUBS temp2,blockDCTopLeft,blockDCTop
- RSBLT temp2,temp2,#0
-
- M_LDR pQpBuf,ppQpBuf
- M_LDR predQP,ppredQP
- CMP temp1,temp2
- MOV temp2,#OMX_VC_VERTICAL
- LDRLTB temp1,[pQpBuf,#1]
- STRLT temp2,[predDir]
- STRLT temp1,[predQP]
- MOV temp2,#OMX_VC_HORIZONTAL
- LDRGEB temp1,[pQpBuf]
- STRGE temp2,[predDir]
- MOV Return,#OMX_Sts_NoErr
- STRGE temp1,[predQP]
-
-
-
- M_END
-
- ENDIF
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/armVCM4P2_Zigzag_Tables.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/armVCM4P2_Zigzag_Tables.c
deleted file mode 100644
index b647559..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/armVCM4P2_Zigzag_Tables.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_Zigzag_Tables.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * File: armVCM4P2_ZigZag_Tables.c
- * Description: Contains the zigzag tables
- *
- */
-
-#include "omxtypes.h"
-
-/* Contains Double the values in the reference Zigzag Table
- * Contains Classical,Vetical and Horizontal Zigzagscan tables in one array
- */
-
-const OMX_U8 armVCM4P2_aClassicalZigzagScan [192] =
-{
- 0, 2, 16, 32, 18, 4, 6, 20,
- 34, 48, 64, 50, 36, 22, 8, 10,
- 24, 38, 52, 66, 80, 96, 82, 68,
- 54, 40, 26, 12, 14, 28, 42, 56,
- 70, 84, 98, 112, 114, 100, 86, 72,
- 58, 44, 30, 46, 60, 74, 88, 102,
- 116, 118, 104, 90, 76, 62, 78, 92,
- 106, 120, 122, 104, 94, 110, 124, 126,
-
- 0, 16, 32, 48, 2, 18, 4, 20,
- 34, 50, 64, 80, 96, 112, 114, 98,
- 82, 66, 52, 36, 6, 22, 8, 24,
- 38, 54, 68, 84, 100, 116, 70, 86,
- 102, 118, 40, 56, 10, 26, 12, 28,
- 42, 58, 72, 88, 104, 120, 74, 90,
- 106, 122, 44, 60, 14, 30, 46, 62,
- 76, 92, 108, 124, 78, 94, 110, 126,
-
- 0, 2, 4, 6, 16, 18, 32, 34,
- 20, 22, 8, 10, 12, 14, 30, 28,
- 26, 24, 38, 36, 48, 50, 64, 66,
- 52, 54, 40, 42, 44, 46, 56, 58,
- 60, 62, 68, 70, 80, 82, 96, 98,
- 84, 86, 72, 74, 76, 78, 88, 90,
- 92, 94, 100, 102, 112, 114, 116, 118,
- 104, 106, 108, 110, 120, 122, 124, 126
-
-
-};
-
-
-
-
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Inter.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Inter.c
deleted file mode 100644
index 127772a..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Inter.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_DecodeBlockCoef_Inter.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for inter reconstruction
- *
- */
-
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-
-
-/**
- * Function: omxVCM4P2_DecodeBlockCoef_Inter
- *
- * Description:
- * Decodes the INTER block coefficients. Inverse quantization, inversely zigzag
- * positioning and IDCT, with appropriate clipping on each step, are performed
- * on the coefficients. The results (residuals) are placed in a contiguous array
- * of 64 elements. For INTER block, the output buffer holds the residuals for
- * further reconstruction.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bit stream buffer. There is no boundary
- * check for the bit stream buffer.
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * to by *ppBitStream. *pBitOffset is valid within
- * [0-7]
- * [in] QP quantization parameter
- * [in] shortVideoHeader a flag indicating presence of short_video_header;
- * shortVideoHeader==1 indicates using quantization method defined in short
- * video header mode, and shortVideoHeader==0 indicates normail quantization method.
- * [out] ppBitStream *ppBitStream is updated after the block is decoded, so that it points to the
- * current byte in the bit stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the current bit position in the
- * byte pointed by *ppBitStream
- * [out] pDst pointer to the decoded residual buffer (a contiguous array of 64 elements of
- * OMX_S16 data type). Must be 16-byte aligned.
- *
- * Return Value:
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - At least one of the following pointers is Null: ppBitStream, *ppBitStream, pBitOffset , pDst
- * - At least one of the below case:
- * - *pBitOffset exceeds [0,7], QP <= 0;
- * - pDst not 16-byte aligned
- * OMX_Sts_Err - status error
- *
- */
-OMXResult omxVCM4P2_DecodeBlockCoef_Inter(
- const OMX_U8 ** ppBitStream,
- OMX_INT * pBitOffset,
- OMX_S16 * pDst,
- OMX_INT QP,
- OMX_INT shortVideoHeader
-)
-{
- /* 64 elements are needed but to align it to 16 bytes need
- 15 more elements of padding */
- OMX_S16 tempBuf[79];
- OMX_S16 *pTempBuf1;
- OMXResult errorCode;
- /* Aligning the local buffers */
- pTempBuf1 = armAlignTo16Bytes(tempBuf);
-
-
- /* VLD and zigzag */
- errorCode = omxVCM4P2_DecodeVLCZigzag_Inter(ppBitStream, pBitOffset,
- pTempBuf1,shortVideoHeader);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- /* Dequantization */
- errorCode = omxVCM4P2_QuantInvInter_I(
- pTempBuf1,
- QP);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- /* Inverse transform */
- errorCode = omxVCM4P2_IDCT8x8blk(pTempBuf1, pDst);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Intra.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Intra.c
deleted file mode 100644
index f24fc07..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Intra.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_DecodeBlockCoef_Intra.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for intra reconstruction
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P2_DecodeBlockCoef_Intra
- *
- * Description:
- * Decodes the INTRA block coefficients. Inverse quantization, inversely zigzag
- * positioning, and IDCT, with appropriate clipping on each step, are performed
- * on the coefficients. The results are then placed in the output frame/plane on
- * a pixel basis. For INTRA block, the output values are clipped to [0, 255] and
- * written to corresponding block buffer within the destination plane.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bit stream buffer. There is no boundary
- * check for the bit stream buffer.
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * to by *ppBitStream. *pBitOffset is valid within
- * [0-7].
- * [in] step width of the destination plane
- * [in/out] pCoefBufRow [in] pointer to the coefficient row buffer
- * [out] updated coefficient rwo buffer
- * [in/out] pCoefBufCol [in] pointer to the coefficient column buffer
- * [out] updated coefficient column buffer
- * [in] curQP quantization parameter of the macroblock which
- * the current block belongs to
- * [in] pQpBuf Pointer to a 2-element QP array. pQpBuf[0] holds the QP of the 8x8 block left to
- * the current block(QPa). pQpBuf[1] holds the QP of the 8x8 block just above the
- * current block(QPc).
- * Note, in case the corresponding block is out of VOP bound, the QP value will have
- * no effect to the intra-prediction process. Refer to subclause "7.4.3.3 Adaptive
- * ac coefficient prediction" of ISO/IEC 14496-2(MPEG4 Part2) for accurate description.
- * [in] blockIndex block index indicating the component type and
- * position as defined in subclause 6.1.3.8,
- * Figure 6-5 of ISO/IEC 14496-2.
- * [in] intraDCVLC a code determined by intra_dc_vlc_thr and QP.
- * This allows a mechanism to switch between two VLC
- * for coding of Intra DC coefficients as per Table
- * 6-21 of ISO/IEC 14496-2.
- * [in] ACPredFlag a flag equal to ac_pred_flag (of luminance) indicating
- * if the ac coefficients of the first row or first
- * column are differentially coded for intra coded
- * macroblock.
- * [in] shortVideoHeader a flag indicating presence of short_video_header;
- * shortVideoHeader==1 selects linear intra DC mode,
- * and shortVideoHeader==0 selects nonlinear intra DC mode.
- * [out] ppBitStream *ppBitStream is updated after the block is
- * decoded, so that it points to the current byte
- * in the bit stream buffer
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream
- * [out] pDst pointer to the block in the destination plane.
- * pDst should be 16-byte aligned.
- * [out] pCoefBufRow pointer to the updated coefficient row buffer.
- *
- * Return Value:
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - At least one of the following pointers is NULL: ppBitStream, *ppBitStream, pBitOffset,
- * pCoefBufRow, pCoefBufCol, pQPBuf, pDst.
- * or
- * - At least one of the below case: *pBitOffset exceeds [0,7], curQP exceeds (1, 31),
- * blockIndex exceeds [0,9], step is not the multiple of 8, intraDCVLC is zero while
- * blockIndex greater than 5.
- * or
- * - pDst is not 16-byte aligned
- * OMX_Sts_Err - status error
- *
- */
-
-OMXResult omxVCM4P2_DecodeBlockCoef_Intra(
- const OMX_U8 ** ppBitStream,
- OMX_INT *pBitOffset,
- OMX_U8 *pDst,
- OMX_INT step,
- OMX_S16 *pCoefBufRow,
- OMX_S16 *pCoefBufCol,
- OMX_U8 curQP,
- const OMX_U8 *pQPBuf,
- OMX_INT blockIndex,
- OMX_INT intraDCVLC,
- OMX_INT ACPredFlag,
- OMX_INT shortVideoHeader
- )
-{
- OMX_S16 tempBuf1[79], tempBuf2[79];
- OMX_S16 *pTempBuf1, *pTempBuf2;
- OMX_INT predDir, predACDir;
- OMX_INT predQP;
- OMXVCM4P2VideoComponent videoComp;
- OMXResult errorCode;
-
-
- /* Aligning the local buffers */
- pTempBuf1 = armAlignTo16Bytes(tempBuf1);
- pTempBuf2 = armAlignTo16Bytes(tempBuf2);
-
- /* Setting the AC prediction direction and prediction direction */
- armVCM4P2_SetPredDir(
- blockIndex,
- pCoefBufRow,
- pCoefBufCol,
- &predDir,
- &predQP,
- pQPBuf);
-
- predACDir = predDir;
-
-
- if (ACPredFlag == 0)
- {
- predACDir = OMX_VC_NONE;
- }
-
- /* Setting the videoComp */
- if (blockIndex <= 3)
- {
- videoComp = OMX_VC_LUMINANCE;
- }
- else
- {
- videoComp = OMX_VC_CHROMINANCE;
- }
-
-
- /* VLD and zigzag */
- if (intraDCVLC == 1)
- {
- errorCode = omxVCM4P2_DecodeVLCZigzag_IntraDCVLC(
- ppBitStream,
- pBitOffset,
- pTempBuf1,
- predACDir,
- shortVideoHeader,
- videoComp);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
- }
- else
- {
- errorCode = omxVCM4P2_DecodeVLCZigzag_IntraACVLC(
- ppBitStream,
- pBitOffset,
- pTempBuf1,
- predACDir,
- shortVideoHeader);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
- }
-
- /* AC DC prediction */
- errorCode = omxVCM4P2_PredictReconCoefIntra(
- pTempBuf1,
- pCoefBufRow,
- pCoefBufCol,
- curQP,
- predQP,
- predDir,
- ACPredFlag,
- videoComp);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- /* Dequantization */
- errorCode = omxVCM4P2_QuantInvIntra_I(
- pTempBuf1,
- curQP,
- videoComp,
- shortVideoHeader);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- /* Inverse transform */
- errorCode = omxVCM4P2_IDCT8x8blk (pTempBuf1, pTempBuf2);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- /* Placing the linear array into the destination plane and clipping
- it to 0 to 255 */
-
- armVCM4P2_Clip8(pTempBuf2,pDst,step);
-
-
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_DecodePadMV_PVOP_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_DecodePadMV_PVOP_s.s
deleted file mode 100644
index 65a01d7..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_DecodePadMV_PVOP_s.s
+++ /dev/null
@@ -1,378 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-; **********
-; *
-; * File Name: omxVCM4P2_DecodePadMV_PVOP_s.s
-; * OpenMAX DL: v1.0.2
-; * Revision: 9641
-; * Date: Thursday, February 7, 2008
-; *
-; *
-; *
-; *
-; **
-; * Function: omxVCM4P2_DecodePadMV_PVOP
-; *
-; * Description:
-; * Decodes and pads four motion vectors of the non-intra macroblock in P-VOP.
-; * The motion vector padding process is specified in subclause 7.6.1.6 of
-; * ISO/IEC 14496-2.
-; *
-; * Remarks:
-; *
-; *
-; * Parameters:
-; * [in] ppBitStream pointer to the pointer to the current byte in
-; * the bit stream buffer
-; * [in] pBitOffset pointer to the bit position in the byte pointed
-; * to by *ppBitStream. *pBitOffset is valid within
-; * [0-7].
-; * [in] pSrcMVLeftMB pointers to the motion vector buffers of the
-; * macroblocks specially at the left side of the current macroblock
-; * respectively.
-; * [in] pSrcMVUpperMB pointers to the motion vector buffers of the
-; * macroblocks specially at the upper side of the current macroblock
-; * respectively.
-; * [in] pSrcMVUpperRightMB pointers to the motion vector buffers of the
-; * macroblocks specially at the upper-right side of the current macroblock
-; * respectively.
-; * [in] fcodeForward a code equal to vop_fcode_forward in MPEG-4
-; * bit stream syntax
-; * [in] MBType the type of the current macroblock. If MBType
-; * is not equal to OMX_VC_INTER4V, the destination
-; * motion vector buffer is still filled with the
-; * same decoded vector.
-; * [out] ppBitStream *ppBitStream is updated after the block is decoded,
-; * so that it points to the current byte in the bit
-; * stream buffer
-; * [out] pBitOffset *pBitOffset is updated so that it points to the
-; * current bit position in the byte pointed by
-; * *ppBitStream
-; * [out] pDstMVCurMB pointer to the motion vector buffer of the current
-; * macroblock which contains four decoded motion vectors
-; *
-; * Return Value:
-; * OMX_Sts_NoErr -no error
-; *
-; *
-; * OMX_Sts_Err - status error
-; *
-; *
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
- INCLUDE armCOMM_BitDec_s.h
- INCLUDE omxVC_s.h
-
- M_VARIANTS ARM1136JS
-
-
-
-
- IF ARM1136JS
-
-;//Input Arguments
-
-ppBitStream RN 0
-pBitOffset RN 1
-pSrcMVLeftMB RN 2
-pSrcMVUpperMB RN 3
-pSrcMVUpperRightMB RN 4
-pDstMVCurMB RN 5
-fcodeForward RN 6
-MBType RN 7
-
-;//Local Variables
-
-zero RN 4
-one RN 4
-scaleFactor RN 1
-
-
-Return RN 0
-
-VlcMVD RN 0
-index RN 4
-Count RN 7
-
-mvHorData RN 4
-mvHorResidual RN 0
-
-mvVerData RN 4
-mvVerResidual RN 0
-
-temp RN 1
-
-temp1 RN 3
-High RN 4
-Low RN 2
-Range RN 1
-
-BlkCount RN 14
-
-diffMVdx RN 0
-diffMVdy RN 1
-
-;// Scratch Registers
-
-RBitStream RN 8
-RBitCount RN 9
-RBitBuffer RN 10
-
-T1 RN 11
-T2 RN 12
-LR RN 14
-
- IMPORT armVCM4P2_aVlcMVD
- IMPORT omxVCM4P2_FindMVpred
-
- ;// Allocate stack memory
-
- M_ALLOC4 ppDstMVCurMB,4
- M_ALLOC4 pDstMVPredME,4
- M_ALLOC4 pBlkCount,4
-
- M_ALLOC4 pppBitStream,4
- M_ALLOC4 ppBitOffset,4
- M_ALLOC4 ppSrcMVLeftMB,4
- M_ALLOC4 ppSrcMVUpperMB,4
-
- M_ALLOC4 pdiffMVdx,4
- M_ALLOC4 pdiffMVdy,4
- M_ALLOC4 pHigh,4
-
-
-
-
- M_START omxVCM4P2_DecodePadMV_PVOP,r11
-
- M_ARG pSrcMVUpperRightMBonStack,4 ;// pointer to pSrcMVUpperRightMB on stack
- M_ARG pDstMVCurMBonStack,4 ;// pointer to pDstMVCurMB on stack
- M_ARG fcodeForwardonStack,4 ;// pointer to fcodeForward on stack
- M_ARG MBTypeonStack,4 ;// pointer to MBType on stack
-
-
-
-
-
- ;// Initializing the BitStream Macro
-
- M_BD_INIT0 ppBitStream, pBitOffset, RBitStream, RBitBuffer, RBitCount
- M_LDR MBType,MBTypeonStack ;// Load MBType from stack
- M_LDR pDstMVCurMB,pDstMVCurMBonStack ;// Load pDstMVCurMB from stack
- MOV zero,#0
-
- TEQ MBType,#OMX_VC_INTRA ;// Check if MBType=OMX_VC_INTRA
- TEQNE MBType,#OMX_VC_INTRA_Q ;// check if MBType=OMX_VC_INTRA_Q
- STREQ zero,[pDstMVCurMB]
- M_BD_INIT1 T1, T2, T2
- STREQ zero,[pDstMVCurMB,#4]
- M_BD_INIT2 T1, T2, T2
- STREQ zero,[pDstMVCurMB,#4]
- MOVEQ Return,#OMX_Sts_NoErr
- MOV BlkCount,#0
- STREQ zero,[pDstMVCurMB,#4]
-
- BEQ ExitOK
-
- TEQ MBType,#OMX_VC_INTER4V ;// Check if MBType=OMX_VC_INTER4V
- TEQNE MBType,#OMX_VC_INTER4V_Q ;// Check if MBType=OMX_VC_INTER4V_Q
- MOVEQ Count,#4
-
- TEQ MBType,#OMX_VC_INTER ;// Check if MBType=OMX_VC_INTER
- TEQNE MBType,#OMX_VC_INTER_Q ;// Check if MBType=OMX_VC_INTER_Q
- MOVEQ Count,#1
-
- M_LDR fcodeForward,fcodeForwardonStack ;// Load fcodeForward from stack
-
- ;// Storing the values temporarily on stack
-
- M_STR ppBitStream,pppBitStream
- M_STR pBitOffset,ppBitOffset
-
-
- SUB temp,fcodeForward,#1 ;// temp=fcodeForward-1
- MOV one,#1
- M_STR pSrcMVLeftMB,ppSrcMVLeftMB
- LSL scaleFactor,one,temp ;// scaleFactor=1<<(fcodeForward-1)
- M_STR pSrcMVUpperMB,ppSrcMVUpperMB
- LSL scaleFactor,scaleFactor,#5
- M_STR scaleFactor,pHigh ;// [pHigh]=32*scaleFactor
-
- ;// VLD Decoding
-
-
-Loop
-
- LDR VlcMVD, =armVCM4P2_aVlcMVD ;// Load the optimized MVD VLC table
-
- ;// Horizontal Data and Residual calculation
-
- LDR temp,=0xFFF
- M_BD_VLD index,T1,T2,VlcMVD,3,2 ;// variable lenght decoding using the macro
-
- TEQ index,temp
- BEQ ExitError ;// Exit with an Error Message if the decoded symbol is an invalied symbol
-
- SUB mvHorData,index,#32 ;// mvHorData=index-32
- MOV mvHorResidual,#1 ;// mvHorResidual=1
- CMP fcodeForward,#1
- TEQNE mvHorData,#0
- MOVEQ diffMVdx,mvHorData ;// if scaleFactor=1(fcodeForward=1) or mvHorData=0 diffMVdx=mvHorData
- BEQ VerticalData
-
- SUB temp,fcodeForward,#1
- M_BD_VREAD8 mvHorResidual,temp,T1,T2 ;// get mvHorResidual from bitstream if fcodeForward>1 and mvHorData!=0
-
- CMP mvHorData,#0
- RSBLT mvHorData,mvHorData,#0 ;// mvHorData=abs(mvHorData)
- SUB mvHorResidual,mvHorResidual,fcodeForward
- SMLABB diffMVdx,mvHorData,fcodeForward,mvHorResidual ;// diffMVdx=abs(mvHorData)*fcodeForward+mvHorResidual-fcodeForward
- ADD diffMVdx,diffMVdx,#1
- RSBLT diffMVdx,diffMVdx,#0
-
- ;// Vertical Data and Residual calculation
-
-VerticalData
-
- M_STR diffMVdx,pdiffMVdx ;// Store the diffMVdx on stack
- LDR VlcMVD, =armVCM4P2_aVlcMVD ;// Loading the address of optimized VLC tables
-
- LDR temp,=0xFFF
- M_BD_VLD index,T1,T2,VlcMVD,3,2 ;// VLC decoding using the macro
-
- TEQ index,temp
- BEQ ExitError ;// Exit with an Error Message if an Invalied Symbol occurs
-
- SUB mvVerData,index,#32 ;// mvVerData=index-32
- MOV mvVerResidual,#1
- CMP fcodeForward,#1
- TEQNE mvVerData,#0
- MOVEQ diffMVdy,mvVerData ;// diffMVdy = mvVerData if scaleFactor=1(fcodeForward=1) or mvVerData=0
- BEQ FindMVPred
-
- SUB temp,fcodeForward,#1
- M_BD_VREAD8 mvVerResidual,temp,T1,T2 ;// Get mvVerResidual from bit stream if fcodeForward>1 and mnVerData!=0
-
-
- CMP mvVerData,#0
- RSBLT mvVerData,mvVerData,#0
- SUB mvVerResidual,mvVerResidual,fcodeForward
- SMLABB diffMVdy,mvVerData,fcodeForward,mvVerResidual ;// diffMVdy=abs(mvVerData)*fcodeForward+mvVerResidual-fcodeForward
- ADD diffMVdy,diffMVdy,#1
- RSBLT diffMVdy,diffMVdy,#0
-
- ;//Calling the Function omxVCM4P2_FindMVpred
-
-FindMVPred
-
- M_STR diffMVdy,pdiffMVdy
- ADD temp,pDstMVCurMB,BlkCount,LSL #2 ;// temp=pDstMVCurMB[BlkCount]
- M_STR temp,ppDstMVCurMB ;// store temp on stack for passing as an argument to FindMVPred
-
- MOV temp,#0
- M_STR temp,pDstMVPredME ;// Pass pDstMVPredME=NULL as an argument
- M_STR BlkCount,pBlkCount ;// Passs BlkCount as Argument through stack
-
- MOV temp,pSrcMVLeftMB ;// temp (RN 1)=pSrcMVLeftMB
- M_LDR pSrcMVUpperRightMB,pSrcMVUpperRightMBonStack
- MOV pSrcMVLeftMB,pSrcMVUpperMB ;// pSrcMVLeftMB ( RN 2) = pSrcMVUpperMB
- MOV ppBitStream,pDstMVCurMB ;// ppBitStream ( RN 0) = pDstMVCurMB
- MOV pSrcMVUpperMB,pSrcMVUpperRightMB ;// pSrcMVUpperMB( RN 3) = pSrcMVUpperRightMB
- BL omxVCM4P2_FindMVpred ;// Branch to subroutine omxVCM4P2_FindMVpred
-
- ;// Store Horizontal Motion Vector
-
- M_LDR BlkCount,pBlkCount ;// Load BlkCount from stack
- M_LDR High,pHigh ;// High=32*scaleFactor
- LSL temp1,BlkCount,#2 ;// temp=BlkCount*4
- M_LDR diffMVdx,pdiffMVdx ;// Laad diffMVdx
-
- LDRSH temp,[pDstMVCurMB,temp1] ;// temp=pDstMVCurMB[BlkCount]
-
-
- RSB Low,High,#0 ;// Low = -32*scaleFactor
- ADD diffMVdx,temp,diffMVdx ;// diffMVdx=pDstMVCurMB[BlkCount]+diffMVdx
- ADD Range,High,High ;// Range=64*ScaleFactor
- SUB High,High,#1 ;// High= 32*scaleFactor-1
-
- CMP diffMVdx,Low ;// If diffMVdx<Low
- ADDLT diffMVdx,diffMVdx,Range ;// diffMVdx+=Range
-
- CMP diffMVdx,High
- SUBGT diffMVdx,diffMVdx,Range ;// If diffMVdx > High diffMVdx-=Range
- STRH diffMVdx,[pDstMVCurMB,temp1]
-
- ;// Store Vertical
-
- ADD temp1,temp1,#2 ;// temp1=4*BlkCount+2
- M_LDR diffMVdx,pdiffMVdy ;// Laad diffMVdy
- LDRSH temp,[pDstMVCurMB,temp1] ;// temp=pDstMVCurMB[BlkCount].diffMVdy
- ADD BlkCount,BlkCount,#1 ;// BlkCount=BlkCount+1
- ADD diffMVdx,temp,diffMVdx
- CMP diffMVdx,Low
- ADDLT diffMVdx,diffMVdx,Range ;// If diffMVdy<Low diffMVdy+=Range
- CMP diffMVdx,High
- SUBGT diffMVdx,diffMVdx,Range ;// If diffMVdy > High diffMVdy-=Range
- STRH diffMVdx,[pDstMVCurMB,temp1]
-
- CMP BlkCount,Count
- M_LDR pSrcMVLeftMB,ppSrcMVLeftMB
- M_LDR pSrcMVUpperMB,ppSrcMVUpperMB
-
- BLT Loop ;// If BlkCount<Count Continue the Loop
-
-
- ;// If MBType=OMX_VC_INTER or MBtype=OMX_VC_INTER_Q copy pDstMVCurMB[0] to
- ;// pDstMVCurMB[1], pDstMVCurMB[2], pDstMVCurMB[3]
-
- M_LDR MBType,MBTypeonStack
-
- TEQ MBType,#OMX_VC_INTER
- TEQNE MBType,#OMX_VC_INTER_Q
- LDREQ temp,[pDstMVCurMB]
- M_LDR ppBitStream,pppBitStream
- STREQ temp,[pDstMVCurMB,#4]
-
- STREQ temp,[pDstMVCurMB,#8]
- STREQ temp,[pDstMVCurMB,#12]
-
-
- M_LDR pBitOffset,ppBitOffset
- ;//Ending the macro
- M_BD_FINI ppBitStream,pBitOffset ;// Finishing the Macro
-
-
- MOV Return,#OMX_Sts_NoErr
- B ExitOK
-
-ExitError
-
- M_LDR ppBitStream,pppBitStream
- M_LDR pBitOffset,ppBitOffset
- ;//Ending the macro
- M_BD_FINI ppBitStream,pBitOffset
-
- MOV Return,#OMX_Sts_Err
-
-ExitOK
-
- M_END
- ENDIF
- END
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_Inter_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_Inter_s.s
deleted file mode 100644
index 5ee33d8..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_Inter_s.s
+++ /dev/null
@@ -1,146 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;/**
-; *
-; * File Name: omxVCM4P2_DecodeVLCZigzag_Inter_s.s
-; * OpenMAX DL: v1.0.2
-; * Revision: 9641
-; * Date: Thursday, February 7, 2008
-; *
-; *
-; *
-; *
-; * Description:
-; * Contains modules for zigzag scanning and VLC decoding
-; * for inter block.
-; *
-; *
-; *
-; * Function: omxVCM4P2_DecodeVLCZigzag_Inter
-; *
-; * Description:
-; * Performs VLC decoding and inverse zigzag scan for one inter coded block.
-; *
-; * Remarks:
-; *
-; * Parameters:
-; * [in] ppBitStream pointer to the pointer to the current byte in
-; * the bitstream buffer
-; * [in] pBitOffset pointer to the bit position in the byte pointed
-; * to by *ppBitStream. *pBitOffset is valid within [0-7].
-; * [in] shortVideoHeader binary flag indicating presence of short_video_header;
-; * escape modes 0-3 are used if shortVideoHeader==0,
-; * and escape mode 4 is used when shortVideoHeader==1.
-; * [out] ppBitStream *ppBitStream is updated after the block is
-; * decoded, so that it points to the current byte
-; * in the bit stream buffer
-; * [out] pBitOffset *pBitOffset is updated so that it points to the
-; * current bit position in the byte pointed by
-; * *ppBitStream
-; * [out] pDst pointer to the coefficient buffer of current
-; * block. Must be 16-byte aligned
-; *
-; * Return Value:
-; * OMX_Sts_BadArgErr - bad arguments
-; * -At least one of the following pointers is NULL: ppBitStream, *ppBitStream, pBitOffset, pDst, or
-; * -pDst is not 16-byte aligned, or
-; * -*pBitOffset exceeds [0,7].
-; * OMX_Sts_Err - status error
-; * -At least one mark bit is equal to zero
-; * -Encountered an illegal stream code that cannot be found in the VLC table
-; * -Encountered and illegal code in the VLC FLC table
-; * -The number of coefficients is greater than 64
-; *
-; */
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
- INCLUDE armCOMM_BitDec_s.h
-
-
- M_VARIANTS ARM1136JS
-
-
-
-
-
- IF ARM1136JS
-
- ;// Import various tables needed for the function
-
-
- IMPORT armVCM4P2_InterVlcL0L1 ;// Contains optimized and packed VLC Tables for both Last =1 and last=0
- ;// Packed in Run:Level:Last format
- IMPORT armVCM4P2_InterL0L1LMAX ;// Contains LMAX table entries with both Last=0 and Last=1
- IMPORT armVCM4P2_InterL0L1RMAX ;// Contains RMAX table entries with both Last=0 and Last=1
- IMPORT armVCM4P2_aClassicalZigzagScan ;// contains classical Zigzag table entries with double the original values
- IMPORT armVCM4P2_DecodeVLCZigzag_AC_unsafe
-
-
-
-;//Input Arguments
-
-ppBitStream RN 0
-pBitOffset RN 1
-pDst RN 2
-shortVideoHeader RN 3
-
-;//Local Variables
-
-Return RN 0
-
-pVlcTableL0L1 RN 4
-pLMAXTableL0L1 RN 4
-pRMAXTableL0L1 RN 4
-pZigzagTable RN 4
-Count RN 6
-
-
-
- ;// Allocate stack memory to store the VLC,Zigzag,LMAX and RMAX tables
-
-
- M_ALLOC4 ppVlcTableL0L1,4
- M_ALLOC4 ppLMAXTableL0L1,4
- M_ALLOC4 ppRMAXTableL0L1,4
- M_ALLOC4 ppZigzagTable,4
-
-
- M_START omxVCM4P2_DecodeVLCZigzag_Inter,r12
-
-
-
-
- LDR pZigzagTable, =armVCM4P2_aClassicalZigzagScan ;// Load zigzag table
- M_STR pZigzagTable,ppZigzagTable ;// Store zigzag table on stack to pass as argument to unsafe function
- LDR pVlcTableL0L1, =armVCM4P2_InterVlcL0L1 ;// Load optimized VLC table with both L=0 and L=1 entries
- M_STR pVlcTableL0L1,ppVlcTableL0L1 ;// Store optimized VLC table address on stack
- LDR pLMAXTableL0L1, =armVCM4P2_InterL0L1LMAX ;// Load Interleaved L=0 and L=1 LMAX Tables
- M_STR pLMAXTableL0L1,ppLMAXTableL0L1 ;// Store LMAX table address on stack
- LDR pRMAXTableL0L1, =armVCM4P2_InterL0L1RMAX ;// Load Interleaved L=0 and L=1 RMAX Tables
- MOV Count,#0 ;// set start=0
- M_STR pRMAXTableL0L1,ppRMAXTableL0L1 ;// store RMAX table address on stack
-
-
- BL armVCM4P2_DecodeVLCZigzag_AC_unsafe ;// call Unsafe Function for VLC Zigzag Decoding
-
-
-
- M_END
- ENDIF
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraACVLC_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraACVLC_s.s
deleted file mode 100644
index 9d5940c..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraACVLC_s.s
+++ /dev/null
@@ -1,150 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;/**
-; *
-; * File Name: omxVCM4P2_DecodeVLCZigzag_IntraACVLC_s.s
-; * OpenMAX DL: v1.0.2
-; * Revision: 9641
-; * Date: Thursday, February 7, 2008
-; *
-; *
-; *
-; *
-; * Description:
-; * Contains modules for zigzag scanning and VLC decoding
-; * for inter block.
-; *
-; *
-; *
-; * Function: omxVCM4P2_DecodeVLCZigzag_Inter
-; *
-; * Description:
-; * Performs VLC decoding and inverse zigzag scan for one intra coded block.
-; *
-; * Remarks:
-; *
-; * Parameters:
-; * [in] ppBitStream pointer to the pointer to the current byte in
-; * the bitstream buffer
-; * [in] pBitOffset pointer to the bit position in the byte pointed
-; * to by *ppBitStream. *pBitOffset is valid within [0-7].
-; * [in] shortVideoHeader binary flag indicating presence of short_video_header;
-; * escape modes 0-3 are used if shortVideoHeader==0,
-; * and escape mode 4 is used when shortVideoHeader==1.
-; * [out] ppBitStream *ppBitStream is updated after the block is
-; * decoded, so that it points to the current byte
-; * in the bit stream buffer
-; * [out] pBitOffset *pBitOffset is updated so that it points to the
-; * current bit position in the byte pointed by
-; * *ppBitStream
-; * [out] pDst pointer to the coefficient buffer of current
-; * block. Must be 16-byte aligned
-; *
-; * Return Value:
-; * OMX_Sts_BadArgErr - bad arguments
-; * -At least one of the following pointers is NULL: ppBitStream, *ppBitStream, pBitOffset, pDst, or
-; * -pDst is not 16-byte aligned, or
-; * -*pBitOffset exceeds [0,7].
-; * OMX_Sts_Err - status error
-; * -At least one mark bit is equal to zero
-; * -Encountered an illegal stream code that cannot be found in the VLC table
-; * -Encountered and illegal code in the VLC FLC table
-; * -The number of coefficients is greater than 64
-; *
-; */
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
- INCLUDE armCOMM_BitDec_s.h
-
-
- M_VARIANTS ARM1136JS
-
-
-
-
-
- IF ARM1136JS
-
- ;// Import various tables needed for the function
-
-
- IMPORT armVCM4P2_IntraVlcL0L1 ;// Contains optimized and packed VLC Tables for both Last =1 and last=0
- ;// Packed in Run:Level:Last format
- IMPORT armVCM4P2_IntraL0L1LMAX ;// Contains LMAX table entries with both Last=0 and Last=1
- IMPORT armVCM4P2_IntraL0L1RMAX ;// Contains RMAX table entries with both Last=0 and Last=1
- IMPORT armVCM4P2_aClassicalZigzagScan ;// contains classical Zigzag table entries with double the original values
- IMPORT armVCM4P2_DecodeVLCZigzag_AC_unsafe
-
-;//Input Arguments
-
-ppBitStream RN 0
-pBitOffset RN 1
-pDst RN 2
-PredDir RN 3
-shortVideoHeader RN 3
-
-;//Local Variables
-
-Return RN 0
-
-pVlcTableL0L1 RN 4
-pLMAXTableL0L1 RN 4
-pRMAXTableL0L1 RN 4
-pZigzagTable RN 4
-Count RN 6
-
-
-
- ;// Allocate stack memory to store optimized VLC,Zigzag, RMAX, LMAX Table Addresses
-
- M_ALLOC4 ppVlcTableL0L1,4
- M_ALLOC4 ppLMAXTableL0L1,4
- M_ALLOC4 ppRMAXTableL0L1,4
- M_ALLOC4 ppZigzagTable,4
-
-
- M_START omxVCM4P2_DecodeVLCZigzag_IntraACVLC,r12
-
- M_ARG shortVideoHeaderonStack,4 ;// pointer to Input Argument on stack
-
- LDR pZigzagTable, =armVCM4P2_aClassicalZigzagScan ;// Load Address of the Zigzag table
- ADD pZigzagTable, pZigzagTable, PredDir, LSL #6 ;// Loading Different type of zigzag tables based on PredDir
-
- M_STR pZigzagTable,ppZigzagTable ;// Store Zigzag table address on stack
- LDR pVlcTableL0L1, =armVCM4P2_IntraVlcL0L1 ;// Load optimized packed VLC Table with both L=0 and L=1 entries
- M_STR pVlcTableL0L1,ppVlcTableL0L1 ;// Store VLC Table address on stack
- LDR pLMAXTableL0L1, =armVCM4P2_IntraL0L1LMAX ;// Load LMAX Table
- M_STR pLMAXTableL0L1,ppLMAXTableL0L1 ;// Store LMAX Table address on Stack
- LDR pRMAXTableL0L1, =armVCM4P2_IntraL0L1RMAX ;// Load RMAX Table
- MOV Count,#0 ;// Set Start=0
-
- M_STR pRMAXTableL0L1,ppRMAXTableL0L1 ;// Store RMAX Table address on stack
-
-
-
- M_LDR shortVideoHeader,shortVideoHeaderonStack ;// get the Input Argument from stack
-
- BL armVCM4P2_DecodeVLCZigzag_AC_unsafe ;// Call Unsafe Function
-
-
-
-
- M_END
- ENDIF
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraDCVLC_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraDCVLC_s.s
deleted file mode 100644
index 266a62b..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraDCVLC_s.s
+++ /dev/null
@@ -1,238 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;/**
-; *
-; * File Name: omxVCM4P2_DecodeVLCZigzag_IntraDCVLC_s.s
-; * OpenMAX DL: v1.0.2
-; * Revision: 9641
-; * Date: Thursday, February 7, 2008
-; *
-; *
-; *
-; *
-; * Description:
-; * Contains modules for zigzag scanning and VLC decoding
-; * for inter block.
-; *
-; *
-; *
-; * Function: omxVCM4P2_DecodeVLCZigzag_Inter
-; *
-; * Description:
-; * Performs VLC decoding and inverse zigzag scan for one intra coded block.
-; *
-; * Remarks:
-; *
-; * Parameters:
-; * [in] ppBitStream pointer to the pointer to the current byte in
-; * the bitstream buffer
-; * [in] pBitOffset pointer to the bit position in the byte pointed
-; * to by *ppBitStream. *pBitOffset is valid within [0-7].
-; * [in] shortVideoHeader binary flag indicating presence of short_video_header;
-; * escape modes 0-3 are used if shortVideoHeader==0,
-; * and escape mode 4 is used when shortVideoHeader==1.
-; * [out] ppBitStream *ppBitStream is updated after the block is
-; * decoded, so that it points to the current byte
-; * in the bit stream buffer
-; * [out] pBitOffset *pBitOffset is updated so that it points to the
-; * current bit position in the byte pointed by
-; * *ppBitStream
-; * [out] pDst pointer to the coefficient buffer of current
-; * block. Must be 16-byte aligned
-; *
-; * Return Value:
-; * OMX_Sts_BadArgErr - bad arguments
-; * -At least one of the following pointers is NULL: ppBitStream, *ppBitStream, pBitOffset, pDst, or
-; * -pDst is not 16-byte aligned, or
-; * -*pBitOffset exceeds [0,7].
-; * OMX_Sts_Err - status error
-; * -At least one mark bit is equal to zero
-; * -Encountered an illegal stream code that cannot be found in the VLC table
-; * -Encountered and illegal code in the VLC FLC table
-; * -The number of coefficients is greater than 64
-; *
-; */
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
- INCLUDE armCOMM_BitDec_s.h
-
-
- M_VARIANTS ARM1136JS
-
-
-
-
-
- IF ARM1136JS :LOR: CortexA8
-
-
- ;// Import various tables needed for the function
-
-
- IMPORT armVCM4P2_IntraVlcL0L1 ;// Contains optimized and packed VLC Tables for both Last =1 and last=0
- ;// Packed in Run:Level:Last format
- IMPORT armVCM4P2_IntraL0L1LMAX ;// Contains LMAX table entries with both Last=0 and Last=1
- IMPORT armVCM4P2_IntraL0L1RMAX ;// Contains RMAX table entries with both Last=0 and Last=1
- IMPORT armVCM4P2_aClassicalZigzagScan ;// contains CLassical, Horizontal, Vertical Zigzag table entries with double the original values
- IMPORT armVCM4P2_aIntraDCLumaChromaIndex ;// Contains Optimized DCLuma and DCChroma Index table Entries
-
-
- IMPORT armVCM4P2_DecodeVLCZigzag_AC_unsafe
-
-;//Input Arguments
-
-ppBitStream RN 0
-pBitOffset RN 1
-pDst RN 2
-PredDir RN 3
-shortVideoHeader RN 3
-videoComp RN 5
-;//Local Variables
-
-Return RN 0
-
-pDCLumaChromaIndex RN 4
-pDCChromaIndex RN 7
-pVlcTableL0L1 RN 4
-pLMAXTableL0L1 RN 4
-pRMAXTableL0L1 RN 4
-pZigzagTable RN 4
-Count RN 6
-DCValueSize RN 6
-powOfSize RN 7
-temp1 RN 5
-
-
-;// Scratch Registers
-
-RBitStream RN 8
-RBitBuffer RN 9
-RBitCount RN 10
-
-T1 RN 11
-T2 RN 12
-DCVal RN 14
-
-
- ;// Allocate stack memory to store optimized VLC,Zigzag, RMAX, LMAX Table Addresses
-
- M_ALLOC4 ppVlcTableL0L1,4
- M_ALLOC4 ppLMAXTableL0L1,4
- M_ALLOC4 ppRMAXTableL0L1,4
- M_ALLOC4 ppZigzagTable,4
- M_ALLOC4 pDCCoeff,4
-
-
-
- M_START omxVCM4P2_DecodeVLCZigzag_IntraDCVLC,r12
-
- M_ARG shortVideoHeaderonStack,4 ;// Pointer to argument on stack
- M_ARG videoComponstack,4 ;// Pointer to argument on stack
-
-
- ;// Decode DC Coefficient
-
-
- LDR pDCLumaChromaIndex, =armVCM4P2_aIntraDCLumaChromaIndex ;// Load Optimized VLC Table for Luminance and Chrominance
-
- ;// Initializing the Bitstream Macro
-
- M_BD_INIT0 ppBitStream, pBitOffset, RBitStream, RBitBuffer, RBitCount
- M_LDR videoComp,videoComponstack
- M_BD_INIT1 T1, T2, T2
- ADD pDCLumaChromaIndex,pDCLumaChromaIndex,videoComp, LSL #6
- M_BD_INIT2 T1, T2, T2
-
-
- M_BD_VLD DCValueSize,T1,T2,pDCLumaChromaIndex,4,2 ;// VLC Decode using optimized Luminance and Chrominance VLC Table
-
-
-
-
-DecodeDC
-
- CMP DCValueSize,#12
- BGT ExitError
-
- CMP DCValueSize,#0
- MOVEQ DCVal,#0 ;// If DCValueSize is zero then DC coeff =0
- BEQ ACDecode ;// Branch to perform AC Coeff Decoding
-
- M_BD_VREAD16 DCVal,DCValueSize,T1,T2 ;// Get DC Value From Bit stream
-
-
- MOV powOfSize,#1
- LSL powOfSize,DCValueSize ;// powOfSize=pow(2,DCValueSize)
- CMP DCVal,powOfSize,LSR #1 ;// Compare DCVal with powOfSize/2
- ADDLT DCVal,DCVal,#1
- SUBLT DCVal,DCVal,powOfSize ;// If Lessthan powOfSize/2 DCVal=DCVal-powOfSize+1
- ;// Else DCVal= fetchbits from bit stream
-
-CheckDCValueSize
-
- CMP DCValueSize,#8 ;// If DCValueSize greater than 8 check marker bit
-
- BLE ACDecode
-
- M_BD_READ8 temp1,1,T1
- TEQ temp1,#0 ;// If Marker bit is zero Exit with an Error Message
- BEQ ExitError
-
-
-
- ;// Decode AC Coefficient
-
-ACDecode
-
- M_STR DCVal,pDCCoeff ;// Store Decoded DC Coeff on Stack
- M_BD_FINI ppBitStream,pBitOffset ;// Terminating the Bit stream Macro
-
- LDR pZigzagTable, =armVCM4P2_aClassicalZigzagScan ;// Load Zigzag talbe address
- ADD pZigzagTable, pZigzagTable, PredDir, LSL #6 ;// Modify the Zigzag table adress based on PredDir
-
- M_STR pZigzagTable,ppZigzagTable ;// Store zigzag table on stack
- LDR pVlcTableL0L1, =armVCM4P2_IntraVlcL0L1 ;// Load Optimized VLC Table With both Last=0 and Last=1 Entries
- M_STR pVlcTableL0L1,ppVlcTableL0L1 ;// Store Optimized VLC Table on stack
- LDR pLMAXTableL0L1, =armVCM4P2_IntraL0L1LMAX ;// Load LMAX Table
- M_STR pLMAXTableL0L1,ppLMAXTableL0L1 ;// Store LMAX table on stack
- LDR pRMAXTableL0L1, =armVCM4P2_IntraL0L1RMAX ;// Load RMAX Table
- MOV Count,#1 ;// Set Start =1
-
- M_STR pRMAXTableL0L1,ppRMAXTableL0L1 ;// Store RMAX Table on Stack
-
-
- M_LDR shortVideoHeader,shortVideoHeaderonStack ;// Load the Input Argument From Stack
-
- BL armVCM4P2_DecodeVLCZigzag_AC_unsafe ;// Call the Unsafe Function
-
- M_LDR DCVal,pDCCoeff ;// Get the Decoded DC Value From Stack
- STRH DCVal,[pDst] ;// Store the DC Value
- B ExitOK
-
-
-
-ExitError
-
- M_BD_FINI ppBitStream,pBitOffset ;// Terminating the Bit Stream Macro in case of an Error
- MOV Return,#OMX_Sts_Err ;// Exit with an Error Message
-ExitOK
-
- M_END
- ENDIF
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_FindMVpred_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_FindMVpred_s.s
deleted file mode 100644
index 92acd51..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_FindMVpred_s.s
+++ /dev/null
@@ -1,208 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P2_FindMVpred_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
-;// Function:
-;// omxVCM4P2_FindMVpred
-;//
- ;// Include headers
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
- INCLUDE armVCCOMM_s.h
-
- ;// Define cpu variants
- M_VARIANTS ARM1136JS
-
-
- IF ARM1136JS
-
- M_TABLE armVCM4P2_pBlkIndexTable
- DCD OMXVCBlk0, OMXVCBlk1
- DCD OMXVCBlk2, OMXVCBlk3
-
-;//--------------------------------------------
-;// Declare input registers
-;//--------------------------------------------
-
-pSrcMVCurMB RN 0
-pSrcCandMV1 RN 1
-pSrcCandMV2 RN 2
-pSrcCandMV3 RN 3
-pDstMVPred RN 4
-pDstMVPredME RN 5
-iBlk RN 6
-
-pTable RN 4
-CandMV RN 12
-
-pCandMV1 RN 7
-pCandMV2 RN 8
-pCandMV3 RN 9
-
-CandMV1dx RN 0
-CandMV1dy RN 1
-CandMV2dx RN 2
-CandMV2dy RN 3
-CandMV3dx RN 10
-CandMV3dy RN 11
-
-temp RN 14
-
-zero RN 14
-return RN 0
-
-; ----------------------------------------------
-; Main routine
-; ----------------------------------------------
-
- M_ALLOC4 MV, 4
-
- ;// Function header
- M_START omxVCM4P2_FindMVpred, r11
-
- ;// Define stack arguments
- M_ARG ppDstMVPred, 4
- M_ARG ppDstMVPredME, 4
- M_ARG Blk, 4
-
- M_ADR CandMV, MV
- MOV zero, #0
- M_LDR iBlk, Blk
-
- ;// Set the default value for these
- ;// to be used if pSrcCandMV[1|2|3] == NULL
- MOV pCandMV1, CandMV
- MOV pCandMV2, CandMV
- MOV pCandMV3, CandMV
-
- STR zero, [CandMV]
-
- ;// Branch to the case based on blk number
- M_SWITCH iBlk
- M_CASE OMXVCBlk0 ;// iBlk=0
- M_CASE OMXVCBlk1 ;// iBlk=0
- M_CASE OMXVCBlk2 ;// iBlk=0
- M_CASE OMXVCBlk3 ;// iBlk=0
- M_ENDSWITCH
-
-OMXVCBlk0
- CMP pSrcCandMV1, #0
- ADDNE pCandMV1, pSrcCandMV1, #4
-
- CMP pSrcCandMV2, #0
- ADDNE pCandMV2, pSrcCandMV2, #8
-
- CMP pSrcCandMV3, #0
- ADDNE pCandMV3, pSrcCandMV3, #8
- CMPEQ pSrcCandMV1, #0
-
- MOVEQ pCandMV3, pCandMV2
- MOVEQ pCandMV1, pCandMV2
-
- CMP pSrcCandMV1, #0
- CMPEQ pSrcCandMV2, #0
-
- MOVEQ pCandMV1, pCandMV3
- MOVEQ pCandMV2, pCandMV3
-
- CMP pSrcCandMV2, #0
- CMPEQ pSrcCandMV3, #0
-
- MOVEQ pCandMV2, pCandMV1
- MOVEQ pCandMV3, pCandMV1
-
- B BlkEnd
-
-OMXVCBlk1
- MOV pCandMV1, pSrcMVCurMB
- CMP pSrcCandMV3, #0
- ADDNE pCandMV3, pSrcCandMV3, #8
-
- CMP pSrcCandMV2, #0
- ADDNE pCandMV2, pSrcCandMV2, #12
-
- CMPEQ pSrcCandMV3, #0
-
- MOVEQ pCandMV2, pCandMV1
- MOVEQ pCandMV3, pCandMV1
-
- B BlkEnd
-
-OMXVCBlk2
- CMP pSrcCandMV1, #0
- MOV pCandMV2, pSrcMVCurMB
- ADD pCandMV3, pSrcMVCurMB, #4
- ADDNE pCandMV1, pSrcCandMV1, #12
- B BlkEnd
-
-OMXVCBlk3
- ADD pCandMV1, pSrcMVCurMB, #8
- MOV pCandMV2, pSrcMVCurMB
- ADD pCandMV3, pSrcMVCurMB, #4
-
-BlkEnd
-
- ;// Using the transperancy info, zero
- ;// out the candidate MV if neccesary
- LDRSH CandMV1dx, [pCandMV1], #2
- LDRSH CandMV2dx, [pCandMV2], #2
- LDRSH CandMV3dx, [pCandMV3], #2
-
- ;// Load argument from the stack
- M_LDR pDstMVPredME, ppDstMVPredME
-
- LDRSH CandMV1dy, [pCandMV1]
- LDRSH CandMV2dy, [pCandMV2]
- LDRSH CandMV3dy, [pCandMV3]
-
- CMP pDstMVPredME, #0
-
- ;// Store the candidate MV's into the pDstMVPredME,
- ;// these can be used in the fast algorithm if implemented
-
- STRHNE CandMV1dx, [pDstMVPredME], #2
- STRHNE CandMV1dy, [pDstMVPredME], #2
- STRHNE CandMV2dx, [pDstMVPredME], #2
- STRHNE CandMV2dy, [pDstMVPredME], #2
- STRHNE CandMV3dx, [pDstMVPredME], #2
- STRHNE CandMV3dy, [pDstMVPredME]
-
- ; Find the median of the 3 candidate MV's
- M_MEDIAN3 CandMV1dx, CandMV2dx, CandMV3dx, temp
-
- ;// Load argument from the stack
- M_LDR pDstMVPred, ppDstMVPred
-
- M_MEDIAN3 CandMV1dy, CandMV2dy, CandMV3dy, temp
-
- STRH CandMV3dx, [pDstMVPred], #2
- STRH CandMV3dy, [pDstMVPred]
-
- MOV return, #OMX_Sts_NoErr
-
- M_END
- ENDIF ;// ARM1136JS :LOR: CortexA8
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_IDCT8x8blk_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_IDCT8x8blk_s.s
deleted file mode 100644
index e4f91fb..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_IDCT8x8blk_s.s
+++ /dev/null
@@ -1,87 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P2_IDCT8x8blk_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
-;// Function:
-;// omxVCM4P2_IDCT8x8blk
-;//
- ;// Include headers
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- ;// Define cpu variants
- M_VARIANTS ARM1136JS
-
- INCLUDE armCOMM_IDCT_s.h
-
- IMPORT armCOMM_IDCTPreScale
- ;//
- ;// Function prototype
- ;//
- ;// OMXResult
- ;// omxVCM4P2_IDCT8x8blk(const OMX_S16* pSrc,
- ;// OMX_S16* pDst)
- ;//
-
- IF ARM1136JS :LOR: CortexA8
- M_ALLOC4 ppDest, 4
- M_ALLOC4 pStride, 4
- M_ALLOC8 pBlk, 2*8*8
- ENDIF
-
- IF ARM1136JS
- M_START omxVCM4P2_IDCT8x8blk, r11
- ENDIF
-
-
- IF ARM1136JS :LOR: CortexA8
-
-;// Declare input registers
-pSrc RN 0
-pDst RN 1
-
-;// Declare other intermediate registers
-Result RN 0
-
-;// Prototype for macro M_IDCT
-;// pSrc RN 0 ;// source data buffer
-;// Stride RN 1 ;// destination stride in bytes
-;// pDest RN 2 ;// destination data buffer
-;// pScale RN 3 ;// pointer to scaling table
-
-pSrc RN 0
-Stride RN 1
-pDest RN 2
-pScale RN 3
-
- MOV pDest, pDst
- LDR pScale, =armCOMM_IDCTPreScale
- M_IDCT s9, s16, 16
- MOV Result, #OMX_Sts_NoErr
- M_END
- ENDIF
- ;// ARM1136JS :LOR: CortexA8
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_MCReconBlock_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_MCReconBlock_s.s
deleted file mode 100644
index 8ac6ff9..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_MCReconBlock_s.s
+++ /dev/null
@@ -1,727 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P2_MCReconBlock_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-;// Description:
-;//
-;//
-
-;// Include standard headers
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
-;// Import symbols required from other files
-
- M_VARIANTS ARM1136JS
-
-;// ***************************************************************************
-;// ARM1136JS implementation
-;// ***************************************************************************
- IF ARM1136JS
-
-;// ***************************************************************************
-;// MACRO DEFINITIONS
-;// ***************************************************************************
- ;// Description:
- ;//
- ;// dest[j] = (x[j] + y[j] + round) >> 1, j=0..3
- ;//
- ;// Similar to UHADD8 instruction, but with a rounding value of 1 added to
- ;// each sum before dividing by two, if round is 1
- ;//
- ;// Syntax:
- ;// M_UHADD8R $dest, $x, $y, $round, $mask
- ;//
- ;// Inputs:
- ;// $x four packed bytes, x[3] : x[2] : x[1] : x[0]
- ;// $y four packed bytes, y[3] : y[2] : y[1] : y[0]
- ;// $round 0 if no rounding to be added, 1 if rounding to be done
- ;// $mask some register set to 0x80808080
- ;//
- ;// Outputs:
- ;// $dest four packed bytes, z[3] : z[2] : z[1] : z[0]
-
- MACRO
- M_UHADD8R $dest, $x, $y, $round, $mask
- IF $round = 1
- IF $dest /= $y
- MVN $dest, $x
- UHSUB8 $dest, $y, $dest
- EOR $dest, $dest, $mask
- ELSE
- MVN $dest, $y
- UHSUB8 $dest, $x, $dest
- EOR $dest, $dest, $mask
- ENDIF
- ELSE
- UHADD8 $dest, $x, $y
- ENDIF
- MEND
-;// ***************************************************************************
- ;// Description:
- ;// Load 8 bytes from $pSrc (aligned or unaligned locations)
- ;//
- ;// Syntax:
- ;// M_LOAD_X $pSrc, $srcStep, $out0, $out1, $scratch, $offset
- ;//
- ;// Inputs:
- ;// $pSrc 4 byte aligned source pointer to an address just less than
- ;// or equal to the data location
- ;// $srcStep The stride on source
- ;// $scratch A scratch register, used internally for temp calculations
- ;// $offset Difference of source data location to the source pointer
- ;// Use when $offset != 0 (unaligned load)
- ;//
- ;// Outputs:
- ;// $pSrc In case the macro accepts stride, it increments the pSrc by
- ;// that value, else unchanged
- ;// $out0 four packed bytes, z[3] : z[2] : z[1] : z[0]
- ;// $out1 four packed bytes, z[7] : z[6] : z[5] : z[4]
- ;//
- ;// Note: {$out0, $out1, $scratch} should be registers with ascending
- ;// register numbering. In case offset is 0, $scratch is not modified.
-
- MACRO
- M_LOAD_X $pSrc, $srcStep, $out0, $out1, $scratch, $offset
- IF $offset = 0
- LDM $pSrc, {$out0, $out1}
- ADD $pSrc, $pSrc, $srcStep
- ELSE
- LDM $pSrc, {$out0, $out1, $scratch}
- ADD $pSrc, $pSrc, $srcStep
-
- MOV $out0, $out0, LSR #8 * $offset
- ORR $out0, $out0, $out1, LSL #(32 - 8 * ($offset))
- MOV $out1, $out1, LSR #8 * $offset
- ORR $out1, $out1, $scratch, LSL #(32 - 8 * ($offset))
- ENDIF
- MEND
-
-;// ***************************************************************************
- ;// Description:
- ;// Loads three words for X interpolation, update pointer to next row. For
- ;// X interpolation, given a truncated-4byteAligned source pointer,
- ;// invariably three continous words are required from there to get the
- ;// nine bytes from the source pointer for filtering.
- ;//
- ;// Syntax:
- ;// M_LOAD_XINT $pSrc, $srcStep, $offset, $word0, $word1, $word2, $word3
- ;//
- ;// Inputs:
- ;// $pSrc 4 byte aligned source pointer to an address just less than
- ;// or equal to the data location
- ;//
- ;// $srcStep The stride on source
- ;//
- ;// $offset Difference of source data location to the source pointer
- ;// Use when $offset != 0 (unaligned load)
- ;//
- ;// Outputs:
- ;// $pSrc Incremented by $srcStep
- ;//
- ;// $word0, $word1, $word2, $word3
- ;// Three of these are outputs based on the $offset parameter.
- ;// The outputs are specifically generated to be processed by
- ;// the M_EXT_XINT macro. Following is the illustration to show
- ;// how the nine bytes are spanned for different offsets from
- ;// notTruncatedForAlignmentSourcePointer.
- ;//
- ;// ------------------------------------------------------
- ;// | Offset | Aligned Ptr | word0 | word1 | word2 | word3 |
- ;// |------------------------------------------------------|
- ;// | 0 | 0 | 0123 | 4567 | 8xxx | |
- ;// | 1 | -1 | x012 | 3456 | 78xx | |
- ;// | 2 | -2 | xx01 | 2345 | 678x | |
- ;// | 3 | -3 | xxx0 | | 1234 | 5678 |
- ;// ------------------------------------------------------
- ;//
- ;// where the numbering (0-8) is to designate the 9 bytes from
- ;// start of a particular row. The illustration doesn't take in
- ;// account the positioning of bytes with in the word and the
- ;// macro combination with M_EXT_XINT will work only in little
- ;// endian environs
- ;//
- ;// Note: {$word0, $word1, $word2, $word3} should be registers with ascending
- ;// register numbering
-
- MACRO
- M_LOAD_XINT $pSrc, $srcStep, $offset, $word0, $word1, $word2, $word3
- IF $offset /= 3
- LDM $pSrc, {$word0, $word1, $word2}
- ELSE
- LDM $pSrc, {$word0, $word2, $word3}
- ENDIF
- ADD $pSrc, $pSrc, $srcStep
- MEND
-
-;// ***************************************************************************
- ;// Description:
- ;// Extract four registers of four pixels for X interpolation
- ;//
- ;// Syntax:
- ;// M_EXT_XINT $offset, $word0, $word1, $word2, $word3
- ;//
- ;// Inputs:
- ;// $offset Difference of source data location to the source pointer
- ;// Use when $offset != 0 (unaligned load)
- ;//
- ;// $word0, $word1, $word2, $word3
- ;// Three of these are inputs based on the $offset parameter.
- ;// The inputs are specifically selected to be processed by
- ;// the M_EXT_XINT macro.
- ;//
- ;// ------------------------------------------------------
- ;// | Offset | Aligned Ptr | word0 | word1 | word2 | word3 |
- ;// |------------------------------------------------------|
- ;// | 0 | 0 | 0123 | 4567 | 8xxx | yyyy |
- ;// | 1 | -1 | x012 | 3456 | 78xx | yyyy |
- ;// | 2 | -2 | xx01 | 2345 | 678x | yyyy |
- ;// | 3 | -3 | xxx0 | yyyy | 1234 | 5678 |
- ;// ------------------------------------------------------
- ;//
- ;// Outputs:
- ;// $word0, $word1, $word2, $word3
- ;// Bytes from the original source pointer (not truncated for
- ;// 4 byte alignment) as shown in the table.
- ;// -------------------------------
- ;// | word0 | word1 | word2 | word3 |
- ;// |-------------------------------|
- ;// | 0123 | 4567 | 1234 | 5678 |
- ;// -------------------------------
- ;//
- ;// Note: {$word0, $word1, $word2, $word3} should be registers with ascending
- ;// register numbering
-
- MACRO
- M_EXT_XINT $offset, $word0, $word1, $word2, $word3
- IF $offset = 0
- ; $word0 and $word1 are ok
- ; $word2, $word3 are just 8 shifted versions
- MOV $word3, $word1, LSR #8
- ORR $word3, $word3, $word2, LSL #24
- MOV $word2, $word0, LSR #8
- ORR $word2, $word2, $word1, LSL #24
- ELIF $offset = 3
- ; $word2 and $word3 are ok (taken care while loading itself)
- ; set $word0 & $word1
- MOV $word0, $word0, LSR #24
- ORR $word0, $word0, $word2, LSL #8
- MOV $word1, $word2, LSR #24
- ORR $word1, $word1, $word3, LSL #8
- ELSE
- MOV $word0, $word0, LSR #8 * $offset
- ORR $word0, $word0, $word1, LSL #(32 - 8 * ($offset))
- MOV $word1, $word1, LSR #8 * $offset
- ORR $word1, $word1, $word2, LSL #(32 - 8 * ($offset))
-
- MOV $word3, $word1, LSR #8
- ORR $word3, $word3, $word2, LSL #(32 - 8 * (($offset)+1))
- MOV $word2, $word0, LSR #8
- ORR $word2, $word2, $word1, LSL #24
- ENDIF
- MEND
-
-;// ***************************************************************************
- ;// Description:
- ;// Computes half-sum and xor of two inputs and puts them in the input
- ;// registers in that order
- ;//
- ;// Syntax:
- ;// M_HSUM_XOR $v0, $v1, $tmp
- ;//
- ;// Inputs:
- ;// $v0 a, first input
- ;// $v1 b, second input
- ;// $tmp scratch register
- ;//
- ;// Outputs:
- ;// $v0 (a + b)/2
- ;// $v1 a ^ b
-
- MACRO
- M_HSUM_XOR $v0, $v1, $tmp
- UHADD8 $tmp, $v0, $v1 ;// s0 = a + b
- EOR $v1, $v0, $v1 ;// l0 = a ^ b
- MOV $v0, $tmp ;// s0
- MEND
-;// ***************************************************************************
- ;// Description:
- ;// Calculates average of 4 values (a,b,c,d) for HalfPixelXY predict type in
- ;// mcReconBlock module. Very specific to the implementation of
- ;// M_MCRECONBLOCK_HalfPixelXY done here. Uses "tmp" as scratch register and
- ;// "yMask" for mask variable "0x1010101x" set in it. In yMask 4 lsbs are
- ;// not significant and are used by the callee for row counter (y)
- ;//
- ;// Some points to note are:
- ;// 1. Input is pair of pair-averages and Xors
- ;// 2. $sum1 and $lsb1 are not modified and hence can be reused in another
- ;// running average
- ;// 3. Output is in the first argument
- ;//
- ;// Syntax:
- ;// M_AVG4 $sum0, $lsb0, $sum1, $lsb1, $rndVal
- ;//
- ;// Inputs:
- ;// $sum0 (a + b) >> 1, where a and b are 1st and 2nd inputs to be averaged
- ;// $lsb0 (a ^ b)
- ;// $sum1 (c + d) >> 1. Not modified
- ;// $lsb1 (c ^ d) Not modified
- ;// $rndVal Assembler Variable. 0 for rounding, 1 for no rounding
- ;//
- ;// Outputs:
- ;// $sum0 (a + b + c + d + 1) / 4 : If no rounding
- ;// (a + b + c + d + 2) / 4 : If rounding
-
- MACRO
- M_AVG4 $sum0, $lsb0, $sum1, $lsb1, $rndVal
- LCLS OP1
- LCLS OP2
- IF $rndVal = 0 ;// rounding case
-OP1 SETS "AND"
-OP2 SETS "ORR"
- ELSE ;// Not rounding case
-OP1 SETS "ORR"
-OP2 SETS "AND"
- ENDIF
-
- LCLS lsb2
- LCLS sum2
- LCLS dest
-
-lsb2 SETS "tmp"
-sum2 SETS "$lsb0"
-dest SETS "$sum0"
-
- $OP1 $lsb0, $lsb0, $lsb1 ;// e0 = e0 & e1
- EOR $lsb2, $sum0, $sum1 ;// e2 = s0 ^ s1
- $OP2 $lsb2, $lsb2, $lsb0 ;// e2 = e2 | e0
- AND $lsb2, $lsb2, yMask, LSR # 4 ;// e2 = e2 & mask
- UHADD8 $sum2, $sum0, $sum1 ;// s2 = (s0 + s1)/2
- UADD8 $dest, $sum2, $lsb2 ;// dest = s2 + e2
- MEND
-;// ***************************************************************************
-;// Motion compensation handler macros
-;// ***************************************************************************
- ;// Description:
- ;// Implement motion compensation routines using the named registers in
- ;// callee function. Each of the following 4 implement the 4 predict type
- ;// Each handles 8 cases each ie all the combinations of 4 types of source
- ;// alignment offsets and 2 types of rounding flag
- ;//
- ;// Syntax:
- ;// M_MCRECONBLOCK_IntegerPixel $rndVal, $offset
- ;// M_MCRECONBLOCK_HalfPixelX $rndVal, $offset
- ;// M_MCRECONBLOCK_HalfPixelY $rndVal, $offset
- ;// M_MCRECONBLOCK_HalfPixelXY $rndVal, $offset
- ;//
- ;// Inputs:
- ;// $rndVal Assembler Variable. 0 for rounding, 1 for no rounding
- ;// $offset $pSrc MOD 4 value. Offset from 4 byte aligned location.
- ;//
- ;// Outputs:
- ;// Outputs come in the named registers of the callee functions
- ;// The macro loads the data from the source pointer, processes it and
- ;// stores in the destination pointer. Does the whole prediction cycle
- ;// of Motion Compensation routine for a particular predictType
- ;// After this only residue addition to the predicted values remain
-
- MACRO
- M_MCRECONBLOCK_IntegerPixel $rndVal, $offset
- ;// Algorithmic Description:
- ;// This handles motion compensation for IntegerPixel predictType. Both
- ;// rounding cases are handled by the same code base. It is just a copy
- ;// from source to destination. Two lines are done per loop to reduce
- ;// stalls. Loop has been software pipelined as well for that purpose.
- ;//
- ;// M_LOAD_X loads a whole row in two registers and then they are stored
-
-CaseIntegerPixelRnd0Offset$offset
-CaseIntegerPixelRnd1Offset$offset
- M_LOAD_X pSrc, srcStep, tmp1, tmp2, tmp3, $offset
- M_LOAD_X pSrc, srcStep, tmp3, tmp4, tmp5, $offset
-YloopIntegerPixelOffset$offset
- SUBS y, y, #2
- STRD tmp1, tmp2, [pDst], dstStep
- STRD tmp3, tmp4, [pDst], dstStep
- M_LOAD_X pSrc, srcStep, tmp1, tmp2, tmp3, $offset
- M_LOAD_X pSrc, srcStep, tmp3, tmp4, tmp5, $offset
- BGT YloopIntegerPixelOffset$offset
-
- B SwitchPredictTypeEnd
- MEND
-;// ***************************************************************************
- MACRO
- M_MCRECONBLOCK_HalfPixelX $rndVal, $offset
- ;// Algorithmic Description:
- ;// This handles motion compensation for HalfPixelX predictType. The two
- ;// rounding cases are handled by the different code base and spanned by
- ;// different macro calls. Loop has been software pipelined to reduce
- ;// stalls.
- ;//
- ;// Filtering involves averaging a pixel with the next horizontal pixel.
- ;// M_LOAD_XINT and M_EXT_XINT combination generate 4 registers, 2 with
- ;// all pixels in a row with 4 pixel in each register and another 2
- ;// registers with pixels corresponding to one horizontally shifted pixel
- ;// corresponding to the initial row pixels. These are set of packed
- ;// registers appropriate to do 4 lane SIMD.
- ;// After that M_UHADD8R macro does the averaging taking care of the
- ;// rounding as required
-
-CaseHalfPixelXRnd$rndVal.Offset$offset
- IF $rndVal = 0
- LDR mask, =0x80808080
- ENDIF
-
- M_LOAD_XINT pSrc, srcStep, $offset, tmp1, tmp2, tmp3, tmp4
-YloopHalfPixelXRnd$rndVal.Offset$offset
- SUBS y, y, #1
- M_EXT_XINT $offset, tmp1, tmp2, tmp3, tmp4
- M_UHADD8R tmp5, tmp1, tmp3, (1-$rndVal), mask
- M_UHADD8R tmp6, tmp2, tmp4, (1-$rndVal), mask
- STRD tmp5, tmp6, [pDst], dstStep
- M_LOAD_XINT pSrc, srcStep, $offset, tmp1, tmp2, tmp3, tmp4
- BGT YloopHalfPixelXRnd$rndVal.Offset$offset
-
- B SwitchPredictTypeEnd
- MEND
-;// ***************************************************************************
- MACRO
- M_MCRECONBLOCK_HalfPixelY $rndVal, $offset
- ;// Algorithmic Description:
- ;// This handles motion compensation for HalfPixelY predictType. The two
- ;// rounding cases are handled by the different code base and spanned by
- ;// different macro calls. PreLoading is used to avoid reload of same data.
- ;//
- ;// Filtering involves averaging a pixel with the next vertical pixel.
- ;// M_LOAD_X generates 2 registers with all pixels in a row with 4 pixel in
- ;// each register. These are set of packed registers appropriate to do
- ;// 4 lane SIMD. After that M_UHADD8R macro does the averaging taking care
- ;// of the rounding as required
-
-CaseHalfPixelYRnd$rndVal.Offset$offset
- IF $rndVal = 0
- LDR mask, =0x80808080
- ENDIF
-
- M_LOAD_X pSrc, srcStep, tmp1, tmp2, tmp5, $offset ;// Pre-load
-YloopHalfPixelYRnd$rndVal.Offset$offset
- SUBS y, y, #2
- ;// Processing one line
- M_LOAD_X pSrc, srcStep, tmp3, tmp4, tmp5, $offset
- M_UHADD8R tmp1, tmp1, tmp3, (1-$rndVal), mask
- M_UHADD8R tmp2, tmp2, tmp4, (1-$rndVal), mask
- STRD tmp1, tmp2, [pDst], dstStep
- ;// Processing another line
- M_LOAD_X pSrc, srcStep, tmp1, tmp2, tmp5, $offset
- M_UHADD8R tmp3, tmp3, tmp1, (1-$rndVal), mask
- M_UHADD8R tmp4, tmp4, tmp2, (1-$rndVal), mask
- STRD tmp3, tmp4, [pDst], dstStep
-
- BGT YloopHalfPixelYRnd$rndVal.Offset$offset
-
- B SwitchPredictTypeEnd
- MEND
-;// ***************************************************************************
- MACRO
- M_MCRECONBLOCK_HalfPixelXY $rndVal, $offset
- ;// Algorithmic Description:
- ;// This handles motion compensation for HalfPixelXY predictType. The two
- ;// rounding cases are handled by the different code base and spanned by
- ;// different macro calls. PreLoading is used to avoid reload of same data.
- ;//
- ;// Filtering involves averaging a pixel with the next vertical, horizontal
- ;// and right-down diagonal pixels. Just as in HalfPixelX case, M_LOAD_XINT
- ;// and M_EXT_XINT combination generates 4 registers with a row and its
- ;// 1 pixel right shifted version, with 4 pixels in one register. Another
- ;// call of that macro-combination gets another row. Then M_HSUM_XOR is
- ;// called to get mutual half-sum and xor combinations of a row with its
- ;// shifted version as they are inputs to the M_AVG4 macro which computes
- ;// the 4 element average with rounding. Note that it is the half-sum/xor
- ;// values that are preserved for next row as they can be re-used in the
- ;// next call to the M_AVG4 and saves recomputation.
- ;// Due to lack of register, the row counter and a masking value required
- ;// in M_AVG4 are packed into a single register yMask where the last nibble
- ;// holds the row counter values and rest holds the masking variable left
- ;// shifted by 4
-
-CaseHalfPixelXYRnd$rndVal.Offset$offset
- LDR yMask, =((0x01010101 << 4) + 8)
-
- M_LOAD_XINT pSrc, srcStep, $offset, t00, t01, t10, t11 ;// Load a, a', b, b'
- M_EXT_XINT $offset, t00, t01, t10, t11
- M_HSUM_XOR t00, t10, tmp ;// s0, l0
- M_HSUM_XOR t01, t11, tmp ;// s0', l0'
-
-YloopHalfPixelXYRnd$rndVal.Offset$offset
- ;// Processsing one line
- ;// t00, t01, t10, t11 required from previous loop
- M_LOAD_XINT pSrc, srcStep, $offset, t20, t21, t30, t31 ;// Load c, c', d, d'
- SUB yMask, yMask, #2
- M_EXT_XINT $offset, t20, t21, t30, t31
- M_HSUM_XOR t20, t30, tmp ;// s1, l1
- M_HSUM_XOR t21, t31, tmp ;// s1', l1'
- M_AVG4 t00, t10, t20, t30, $rndVal ;// s0, l0, s1, l1
- M_AVG4 t01, t11, t21, t31, $rndVal ;// s0', l0', s1', l1'
- STRD t00, t01, [pDst], dstStep ;// store the average
-
- ;// Processsing another line
- ;// t20, t21, t30, t31 required from above
- M_LOAD_XINT pSrc, srcStep, $offset, t00, t01, t10, t11 ;// Load a, a', b, b'
- TST yMask, #7
- M_EXT_XINT $offset, t00, t01, t10, t11
- M_HSUM_XOR t00, t10, tmp
- M_HSUM_XOR t01, t11, tmp
- M_AVG4 t20, t30, t00, t10, $rndVal
- M_AVG4 t21, t31, t01, t11, $rndVal
- STRD t20, t21, [pDst], dstStep
-
- BGT YloopHalfPixelXYRnd$rndVal.Offset$offset
-
- IF $offset/=3 :LOR: $rndVal/=1
- B SwitchPredictTypeEnd
- ENDIF
- MEND
-;// ***************************************************************************
-;// Motion compensation handler macros end here
-;// ***************************************************************************
- ;// Description:
- ;// Populates all 4 kinds of offsets "cases" for each predictType and rndVal
- ;// combination in the "switch" to prediction processing code segment
- ;//
- ;// Syntax:
- ;// M_CASE_OFFSET $rnd, $predictType
- ;//
- ;// Inputs:
- ;// $rnd 0 for rounding, 1 for no rounding
- ;// $predictType The prediction mode
- ;//
- ;// Outputs:
- ;// Populated list of "M_CASE"s for the "M_SWITCH" macro
-
- MACRO
- M_CASE_OFFSET $rnd, $predictType
- M_CASE Case$predictType.Rnd$rnd.Offset0
- M_CASE Case$predictType.Rnd$rnd.Offset1
- M_CASE Case$predictType.Rnd$rnd.Offset2
- M_CASE Case$predictType.Rnd$rnd.Offset3
- MEND
-;// ***************************************************************************
- ;// Description:
- ;// Populates all 2 kinds of rounding "cases" for each predictType in the
- ;// "switch" to prediction processing code segment
- ;//
- ;// Syntax:
- ;// M_CASE_OFFSET $predictType
- ;//
- ;// Inputs:
- ;// $predictType The prediction mode
- ;//
- ;// Outputs:
- ;// Populated list of "M_CASE_OFFSET" macros
-
- MACRO
- M_CASE_MCRECONBLOCK $predictType
- M_CASE_OFFSET 0, $predictType ;// 0 for rounding
- M_CASE_OFFSET 1, $predictType ;// 1 for no rounding
- MEND
-;// ***************************************************************************
- ;// Description:
- ;// Populates all 8 kinds of rounding and offset combinations handling macros
- ;// for the specified predictType. In case of "IntegerPixel" predictType,
- ;// rounding is not required so same code segment handles both cases
- ;//
- ;// Syntax:
- ;// M_MCRECONBLOCK $predictType
- ;//
- ;// Inputs:
- ;// $predictType The prediction mode
- ;//
- ;// Outputs:
- ;// Populated list of "M_MCRECONBLOCK_<predictType>" macros for specified
- ;// predictType. Each
- ;// M_MCRECONBLOCK_<predictType> $rnd, $offset
- ;// is an code segment (starting with a label indicating the predictType,
- ;// rounding and offset combination)
- ;// Four calls of this macro with the 4 prediction modes populate all the 32
- ;// handlers
-
- MACRO
- M_MCRECONBLOCK $predictType
- M_MCRECONBLOCK_$predictType 0, 0
- M_MCRECONBLOCK_$predictType 0, 1
- M_MCRECONBLOCK_$predictType 0, 2
- M_MCRECONBLOCK_$predictType 0, 3
- IF "$predictType" /= "IntegerPixel" ;// If not IntegerPixel then rounding makes a difference
- M_MCRECONBLOCK_$predictType 1, 0
- M_MCRECONBLOCK_$predictType 1, 1
- M_MCRECONBLOCK_$predictType 1, 2
- M_MCRECONBLOCK_$predictType 1, 3
- ENDIF
- MEND
-;// ***************************************************************************
-;// Input/Output Registers
-pSrc RN 0
-srcStep RN 1
-arg_pSrcResidue RN 2
-pSrcResidue RN 12
-pDst RN 3
-dstStep RN 2
-predictType RN 10
-rndVal RN 11
-mask RN 11
-
-;// Local Scratch Registers
-zero RN 12
-y RN 14
-
-tmp1 RN 4
-tmp2 RN 5
-tmp3 RN 6
-tmp4 RN 7
-tmp5 RN 8
-tmp6 RN 9
-tmp7 RN 10
-tmp8 RN 11
-tmp9 RN 12
-
-t00 RN 4
-t01 RN 5
-t10 RN 6
-t11 RN 7
-t20 RN 8
-t21 RN 9
-t30 RN 10
-t31 RN 11
-tmp RN 12
-
-yMask RN 14
-
-dst RN 1
-return RN 0
-
- ;// Allocate memory on stack
- M_ALLOC4 Stk_pDst, 4
- M_ALLOC4 Stk_pSrcResidue, 4
- ;// Function header
- M_START omxVCM4P2_MCReconBlock, r11
- ;// Define stack arguments
- M_ARG Arg_dstStep, 4
- M_ARG Arg_predictType, 4
- M_ARG Arg_rndVal, 4
- ;// Save on stack
- M_STR pDst, Stk_pDst
- M_STR arg_pSrcResidue, Stk_pSrcResidue
- ;// Load argument from the stack
- M_LDR dstStep, Arg_dstStep
- M_LDR predictType, Arg_predictType
- M_LDR rndVal, Arg_rndVal
-
- MOV y, #8
-
- AND tmp1, pSrc, #3
- ORR predictType, tmp1, predictType, LSL #3
- ORR predictType, predictType, rndVal, LSL #2
- ;// Truncating source pointer to align to 4 byte location
- BIC pSrc, pSrc, #3
-
- ;// Implementation takes care of all combinations of different
- ;// predictTypes, rounding cases and source pointer offsets to alignment
- ;// of 4 bytes in different code bases unless one of these parameter wasn't
- ;// making any difference to the implementation. Below M_CASE_MCRECONBLOCK
- ;// macros branch into 8 M_CASE macros for all combinations of the 2
- ;// rounding cases and 4 offsets of the pSrc pointer to the 4 byte
- ;// alignment.
- M_SWITCH predictType
- M_CASE_MCRECONBLOCK IntegerPixel
- M_CASE_MCRECONBLOCK HalfPixelX
- M_CASE_MCRECONBLOCK HalfPixelY
- M_CASE_MCRECONBLOCK HalfPixelXY
- M_ENDSWITCH
-
- ;// The M_MCRECONBLOCK macros populate the code bases by calling all 8
- ;// particular macros (4 in case of IntegerPixel as rounding makes no
- ;// difference there) to generate the code for all cases of rounding and
- ;// offsets. LTORG is used to segment the code as code size bloated beyond
- ;// 4KB.
- M_MCRECONBLOCK IntegerPixel
- M_MCRECONBLOCK HalfPixelX
- LTORG
- M_MCRECONBLOCK HalfPixelY
- M_MCRECONBLOCK HalfPixelXY
-SwitchPredictTypeEnd
-
- ;// Residue Addition
- ;// This is done in 2 lane SIMD though loads are further optimized and
- ;// 4 bytes are loaded in case of destination buffer. Algorithmic
- ;// details are in inlined comments
- M_LDR pSrcResidue, Stk_pSrcResidue
- CMP pSrcResidue, #0
- BEQ pSrcResidueConditionEnd
-pSrcResidueNotNull
- M_LDR pDst, Stk_pDst
- MOV y, #8
- SUB dstStep, dstStep, #4
-Yloop_pSrcResidueNotNull
- SUBS y, y, #1
- LDR dst, [pDst] ;// dst = [dcba]
- LDMIA pSrcResidue!, {tmp1, tmp2} ;// tmp1=[DC] tmp2=[BA]
- PKHBT tmp3, tmp1, tmp2, LSL #16 ;// Deltaval1 = [C A]
- PKHTB tmp4, tmp2, tmp1, ASR #16 ;// DeltaVal2 = [D B]
- UXTB16 tmp1, dst ;// tmp1 = [0c0a]
- UXTB16 tmp2, dst, ROR #8 ;// tmp2 = [0d0b]
- QADD16 tmp1, tmp1, tmp3 ;// Add and saturate to 16 bits
- QADD16 tmp2, tmp2, tmp4
- USAT16 tmp1, #8, tmp1
- USAT16 tmp2, #8, tmp2 ;// armClip(0, 255, tmp2)
- ORR tmp1, tmp1, tmp2, LSL #8 ;// tmp1 = [dcba]
- STR tmp1, [pDst], #4
-
- LDR dst, [pDst]
- LDMIA pSrcResidue!, {tmp1, tmp2}
- PKHBT tmp3, tmp1, tmp2, LSL #16
- PKHTB tmp4, tmp2, tmp1, ASR #16
- UXTB16 tmp1, dst
- UXTB16 tmp2, dst, ROR #8
- QADD16 tmp1, tmp1, tmp3
- QADD16 tmp2, tmp2, tmp4
- USAT16 tmp1, #8, tmp1
- USAT16 tmp2, #8, tmp2
- ORR tmp1, tmp1, tmp2, LSL #8
- STR tmp1, [pDst], dstStep
-
- BGT Yloop_pSrcResidueNotNull
-pSrcResidueConditionEnd
-
- MOV return, #OMX_Sts_NoErr
-
- M_END
- ENDIF ;// ARM1136JS
-
-;// ***************************************************************************
-;// CortexA8 implementation
-;// ***************************************************************************
- END
-;// ***************************************************************************
-;// omxVCM4P2_MCReconBlock ends
-;// ***************************************************************************
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_PredictReconCoefIntra_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_PredictReconCoefIntra_s.s
deleted file mode 100644
index 116c81d..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_PredictReconCoefIntra_s.s
+++ /dev/null
@@ -1,297 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-; **********
-; *
-; * File Name: omxVCM4P2_PredictReconCoefIntra_s.s
-; * OpenMAX DL: v1.0.2
-; * Revision: 9641
-; * Date: Thursday, February 7, 2008
-; *
-; *
-; *
-; *
-; * Description:
-; * Contains module for DC/AC coefficient prediction
-; *
-; *
-; * Function: omxVCM4P2_PredictReconCoefIntra
-; *
-; * Description:
-; * Performs adaptive DC/AC coefficient prediction for an intra block. Prior
-; * to the function call, prediction direction (predDir) should be selected
-; * as specified in subclause 7.4.3.1 of ISO/IEC 14496-2.
-; *
-; * Remarks:
-; *
-; * Parameters:
-; * [in] pSrcDst pointer to the coefficient buffer which contains the
-; * quantized coefficient residuals (PQF) of the current
-; * block; must be aligned on a 4-byte boundary. The
-; * output coefficients are saturated to the range
-; * [-2048, 2047].
-; * [in] pPredBufRow pointer to the coefficient row buffer; must be aligned
-; * on a 4-byte boundary.
-; * [in] pPredBufCol pointer to the coefficient column buffer; must be
-; * aligned on a 4-byte boundary.
-; * [in] curQP quantization parameter of the current block. curQP may
-; * equal to predQP especially when the current block and
-; * the predictor block are in the same macroblock.
-; * [in] predQP quantization parameter of the predictor block
-; * [in] predDir indicates the prediction direction which takes one
-; * of the following values:
-; * OMX_VIDEO_HORIZONTAL predict horizontally
-; * OMX_VIDEO_VERTICAL predict vertically
-; * [in] ACPredFlag a flag indicating if AC prediction should be
-; * performed. It is equal to ac_pred_flag in the bit
-; * stream syntax of MPEG-4
-; * [in] videoComp video component type (luminance, chrominance or
-; * alpha) of the current block
-; * [out] pSrcDst pointer to the coefficient buffer which contains
-; * the quantized coefficients (QF) of the current
-; * block
-; * [out] pPredBufRow pointer to the updated coefficient row buffer
-; * [out] pPredBufCol pointer to the updated coefficient column buffer
-; * Return Value:
-; * OMX_Sts_NoErr - no error
-; * OMX_Sts_BadArgErr - Bad arguments
-; * - At least one of the pointers is NULL: pSrcDst, pPredBufRow, or pPredBufCol.
-; * - At least one the following cases: curQP <= 0, predQP <= 0, curQP >31,
-; * predQP > 31, preDir exceeds [1,2].
-; * - At least one of the pointers pSrcDst, pPredBufRow, or pPredBufCol is not
-; * 4-byte aligned.
-; *
-; *********
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
-
-
- IMPORT armVCM4P2_Reciprocal_QP_S32
- IMPORT armVCM4P2_Reciprocal_QP_S16
- IMPORT armVCM4P2_DCScaler
-
-
-
- IF ARM1136JS
-
-
-;// Input Arguments
-
-pSrcDst RN 0
-pPredBufRow RN 1
-pPredBufCol RN 2
-curQP RN 3
-QP RN 3
-predQP RN 4
-predDir RN 5
-ACPredFlag RN 6
-videoComp RN 7
-
-;// Local Variables
-
-temp2 RN 5
-negCurQP RN 7
-negdcScaler RN 7
-tempPred RN 8
-
-dcScaler RN 4
-CoeffTable RN 9
-absCoeffDC RN 9
-temp3 RN 6
-absCoeffAC RN 6
-
-shortVideoHeader RN 9
-predCoeffTable RN 10
-Count RN 10
-temp1 RN 12
-index RN 12
-Rem RN 14
-temp RN 11
-Return RN 0
-
-
-
- M_START omxVCM4P2_PredictReconCoefIntra,r12
-
- ;// Assigning pointers to Input arguments on Stack
-
- M_ARG predQPonStack,4
- M_ARG predDironStack,4
- M_ARG ACPredFlagonStack,4
- M_ARG videoComponStack,4
-
- ;// DC Prediction
-
- M_LDR videoComp,videoComponStack ;// Load videoComp From Stack
-
- M_LDR predDir,predDironStack ;// Load Prediction direction
-
- ;// dcScaler Calculation
-
- LDR index, =armVCM4P2_DCScaler
- ADD index,index,videoComp,LSL #5
- LDRB dcScaler,[index,QP]
-
-
-calDCVal
-
-
- LDR predCoeffTable, =armVCM4P2_Reciprocal_QP_S16 ;// Loading the table with entries 32767/(1 to 63)
-
- CMP predDir,#2 ;// Check if the Prediction direction is vertical
-
- ;// Caulucate temp pred by performing Division
-
- LDREQSH absCoeffDC,[pPredBufRow] ;// If vetical load the coeff from Row Prediction Buffer
- LDRNESH absCoeffDC,[pPredBufCol] ;// If horizontal load the coeff from column Prediction Buffer
-
- RSB negdcScaler,dcScaler,#0 ;// negdcScaler=-dcScaler
-
- MOV temp1,absCoeffDC ;// temp1=prediction coeff
- CMP temp1,#0
- RSBLT absCoeffDC,temp1,#0 ;//absCoeffDC=abs(temp1)
-
- ADD temp,dcScaler,dcScaler
- LDRH temp,[predCoeffTable,temp] ;// Load value from coeff table for performing division using multiplication
-
- SMULBB tempPred,temp,absCoeffDC ;// tempPred=pPredBufRow(Col)[0]*32767/dcScaler
- ADD temp3,dcScaler,#1
- LSR tempPred,tempPred,#15 ;// tempPred=pPredBufRow(Col)[0]/dcScaler
- LSR temp3,temp3,#1 ;// temp3=round(dcScaler/2)
-
- MLA Rem,negdcScaler,tempPred,absCoeffDC ;// Rem = pPredBufRow(Col)[0]-tempPred*dcScaler
-
-
- LDRH temp,[pPredBufCol]
- CMP Rem,temp3
- ADDGE tempPred,#1 ;// If Rem>=round(dcScaler/2);tempPred=tempPred+1
- CMP temp1,#0
- RSBLT tempPred,tempPred,#0 ;/ if pPredBufRow(Col)[0]<0; tempPred=-tempPred
-
-
- STRH temp,[pPredBufRow,#-16]
-
- LDRH temp,[pSrcDst] ;// temp=pSrcDst[0]
- M_LDR ACPredFlag,ACPredFlagonStack
- ADD temp,temp,tempPred ;// temp=pSrcDst[0]+tempPred
- SSAT16 temp,#12,temp ;// clip temp to [-2048,2047]
-
- SMULBB temp1,temp,dcScaler ;// temp1=clipped(pSrcDst[0])*dcScaler
- M_LDR predQP,predQPonStack
- STRH temp,[pSrcDst]
- CMP ACPredFlag,#1 ;// Check if the AC prediction flag is set or not
- STRH temp1,[pPredBufCol] ;// store temp1 to pPredBufCol
-
- ;// AC Prediction
-
-
- BNE Exit ;// If not set Exit
-
- LDR predCoeffTable, =armVCM4P2_Reciprocal_QP_S32 ;// Loading the table with entries 0x1ffff/(1 to 63)
- MOV temp1,#4
- MUL temp1,curQP,temp1
- CMP predDir,#2 ;// Check the Prediction direction
- RSB negCurQP,curQP,#0
- LDR CoeffTable,[predCoeffTable,temp1] ;// CoeffTable=0x1ffff/curQP
- ADD curQP,curQP,#1 ;// curQP=curQP+1
- LSR curQP,curQP,#1 ;// curQP=round(curQP/2)
- MOV Count,#2 ;// Initializing the Loop Count
- BNE Horizontal ;// If the Prediction direction is horizontal branch to Horizontal
-
-
-
-loop1
- ;// Calculate tempPred
-
- LDRSH absCoeffAC,[pPredBufRow,Count] ;// absCoeffAC=pPredBufRow[i], 1=<i<=7
- MOV temp1,absCoeffAC
- CMP temp1,#0 ;// compare pPredBufRow[i] with zero, 1=<i<=7
- RSBLT absCoeffAC,temp1,#0 ;// absCoeffAC= abs(pPredBufRow[i])
-
- SMULBB absCoeffAC,absCoeffAC,predQP ;// temp1=pPredBufRow[i]*predQP
- MUL tempPred,absCoeffAC,CoeffTable ;// tempPred=pPredBufRow[i]*predQP*0x1ffff/curQP
- LSR tempPred,tempPred,#17
-
- MLA Rem,negCurQP,tempPred,absCoeffAC ;// Rem=abs(pPredBufRow[i])-tempPred*curQP
- LDRH temp,[pSrcDst,Count] ;// temp=pSrcDst[i],1<=i<8
-
- CMP Rem,curQP
- ADDGE tempPred,#1 ;// if Rem>=round(curQP/2); tempPred=tempPred+1
- CMP temp1,#0
- RSBLT tempPred,tempPred,#0 ;// if pPredBufRow[i]<0 ; tempPred=-tempPred
-
- ;// Update source and Row Prediction buffers
-
- ADD temp,temp,tempPred ;// temp=tempPred+pSrcDst[i]
- SSAT16 temp,#12,temp ;// Clip temp to [-2048,2047]
- STRH temp,[pSrcDst,Count]
- STRH temp,[pPredBufRow,Count] ;// pPredBufRow[i]=temp
- ADD Count,Count,#2 ;// i=i+1
- CMP Count,#16 ;// compare if i=8
- BLT loop1
- B Exit ;// Branch to exit
-
-Horizontal
-
- MOV Count,#16 ;// Initializing i=8
-
-loop2
-
- LSR temp2,Count,#3 ;// temp2=i>>3
-
- ;// Calculate tempPred
-
- LDRH absCoeffAC,[pPredBufCol,temp2] ;// absCoefAC=pPredBufCol[i>>3]
- MOV temp1,absCoeffAC
- CMP temp1,#0 ;// compare pPredBufRow[i] with zero, 1=<i<=7
- RSBLT absCoeffAC,temp1,#0 ;// absCoeffAC=abs(pPredBufCol[i>>3])
-
- SMULBB absCoeffAC,absCoeffAC,predQP ;// temp1=pPredBufCol[i>>3]*predQP
- MUL tempPred,absCoeffAC,CoeffTable ;// tempPred=pPredBufCol[i>>3]*predQP*0x1ffff/curQP
- LSR tempPred,tempPred,#17 ;// tempPred=pPredBufCol[i>>3]*predQP/curQP
-
- MLA Rem,negCurQP,tempPred,absCoeffAC
- LDRH temp,[pSrcDst,Count] ;// temp=pSrcDst[i]
-
- CMP Rem,curQP ;// Compare Rem with round(curQP/2)
- ADDGE tempPred,#1 ;// tempPred=tempPred+1 if Rem>=round(curQP/2)
- CMP temp1,#0
- RSBLT tempPred,tempPred,#0 ;// if pPredBufCol[i>>3 <0 tempPred=-tempPred
-
- ;// Update source and Row Prediction buffers
-
- ADD temp,temp,tempPred ;// temp=pSrcDst[i]+tempPred
- SSAT16 temp,#12,temp ;// Clip temp to [-2048,2047]
- STRH temp,[pSrcDst,Count] ;// pSrcDst[0]= clipped value
- STRH temp,[pPredBufCol,temp2] ;// pPredBufCol[i>>3]=temp
- ADD Count,Count,#16 ;// i=i+8
- CMP Count,#128 ;// compare i with 64
- BLT loop2
-
-
-Exit
-
- MOV Return,#OMX_Sts_NoErr
-
- M_END
- ENDIF
- END
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_QuantInvInter_I_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_QuantInvInter_I_s.s
deleted file mode 100644
index d57160f..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_QuantInvInter_I_s.s
+++ /dev/null
@@ -1,155 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;/**
-; *
-; * File Name: omxVCM4P2_QuantInvInter_I_s.s
-; * OpenMAX DL: v1.0.2
-; * Revision: 9641
-; * Date: Thursday, February 7, 2008
-; *
-; *
-; *
-; *
-; * Description:
-; * Contains modules for inter reconstruction
-; *
-; *
-; *
-; *
-; *
-; * Function: omxVCM4P2_QuantInvInter_I
-; *
-; * Description:
-; * Performs inverse quantization on intra/inter coded block.
-; * This function supports bits_per_pixel = 8. Mismatch control
-; * is performed for the first MPEG-4 mode inverse quantization method.
-; * The output coefficients are clipped to the range: [-2048, 2047].
-; * Mismatch control is performed for the first inverse quantization method.
-; *
-; * Remarks:
-; *
-; * Parameters:
-; * [in] pSrcDst pointer to the input (quantized) intra/inter block. Must be 16-byte aligned.
-; * [in] QP quantization parameter (quantiser_scale)
-; * [in] videoComp (Intra version only.) Video component type of the
-; * current block. Takes one of the following flags:
-; * OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE,
-; * OMX_VC_ALPHA.
-; * [in] shortVideoHeader a flag indicating presence of short_video_header;
-; * shortVideoHeader==1 selects linear intra DC mode,
-; * and shortVideoHeader==0 selects nonlinear intra DC mode.
-; * [out] pSrcDst pointer to the output (dequantized) intra/inter block. Must be 16-byte aligned.
-; *
-; * Return Value:
-; * OMX_Sts_NoErr - no error
-; * OMX_Sts_BadArgErr - bad arguments
-; * - If pSrcDst is NULL or is not 16-byte aligned.
-; * or
-; * - If QP <= 0.
-; * or
-; * - videoComp is none of OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE and OMX_VC_ALPHA.
-; *
-; */
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
-
-
- IF ARM1136JS
-
-;//Input Arguments
-pSrcDst RN 0
-QP RN 1
-
-;//Local Variables
-Return RN 0
-Count RN 4
-tempVal21 RN 2
-tempVal43 RN 3
-QP1 RN 5
-X2 RN 6
-X3 RN 14
-Result1 RN 8
-Result2 RN 9
-two RN 7
-
- M_START omxVCM4P2_QuantInvInter_I,r9
-
- MOV Count,#64
- TST QP,#1
- LDRD tempVal21,[pSrcDst] ;// Loads first two values of pSrcDst to tempVal21,
- ;// next two values to tempVal43
- SUBEQ QP1,QP,#1 ;// QP1=QP if QP is odd , QP1=QP-1 if QP is even
- MOVNE QP1,QP
- MOV two,#2
-
-
-
-Loop
-
-
- SMULBB X2,tempVal21,two ;// X2= first val(lower 16 bits of tampVal21)*2
- CMP X2,#0
-
- RSBLT X2,X2,#0 ;// X2=absoluteval(first val)
- SMLABBNE X2,QP,X2,QP1 ;// X2=2*absval(first val)*QP+QP if QP is odd
- ;// X2=2*absval(first val)*QP+QP-1 if QP is even
- SMULTB X3,tempVal21,two ;// X3= second val(top 16 bits of tampVal21)*2
- RSBLT X2,X2,#0
-
- CMP X3,#0
-
- RSBLT X3,X3,#0
- SMLABBNE X3,QP,X3,QP1
-
- RSBLT X3,X3,#0
- PKHBT Result1,X2,X3,LSL #16 ;// Result1[0-15]=X2[0-15],Result1[16-31]=X3[16-31]
- SMULBB X2,tempVal43,two ;// X2= first val(lower 16 bits of tampVal43)*2
- SSAT16 Result1,#12,Result1 ;// clip to range [-2048,2047]
- CMP X2,#0
-
-
-
- RSBLE X2,X2,#0
- SMLABBNE X2,QP,X2,QP1
- SMULTB X3,tempVal43,two ;// X2= first val(top 16 bits of tampVal21)*2
- RSBLT X2,X2,#0
- CMP X3,#0
-
- LDRD tempVal21,[pSrcDst,#8] ;// Load next four Values to tempVal21,tempVal43
-
- RSBLT X3,X3,#0
- SMLABBNE X3,QP,X3,QP1
- RSBLT X3,X3,#0
- PKHBT Result2,X2,X3,LSL #16 ;// Result2[0-15]=X2[0-15],Result2[16-31]=X3[0-15]
- SSAT16 Result2,#12,Result2 ;// clip to range [-2048,2047]
-
- SUBS Count,Count,#4 ;// Decrement Count by 4 and continue if it has not reached 0
- STRD Result1,[pSrcDst],#8 ;// Store Double words and increment the pointer to point the next store address
-
-
-
- BGT Loop
-
- MOV Return,#OMX_Sts_NoErr
-
- M_END
- ENDIF
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_QuantInvIntra_I_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_QuantInvIntra_I_s.s
deleted file mode 100644
index bd82da4..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/m4p2/src/omxVCM4P2_QuantInvIntra_I_s.s
+++ /dev/null
@@ -1,202 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;/**
-; *
-; * File Name: omxVCM4P2_QuantInvIntra_I_s.s
-; * OpenMAX DL: v1.0.2
-; * Revision: 9641
-; * Date: Thursday, February 7, 2008
-; *
-; *
-; *
-; *
-; * Description:
-; * Contains modules for inter reconstruction
-; *
-; *
-; *
-; *
-; *
-; *
-; * Function: omxVCM4P2_QuantInvIntra_I
-; *
-; * Description:
-; * Performs inverse quantization on intra/inter coded block.
-; * This function supports bits_per_pixel = 8. Mismatch control
-; * is performed for the first MPEG-4 mode inverse quantization method.
-; * The output coefficients are clipped to the range: [-2048, 2047].
-; * Mismatch control is performed for the first inverse quantization method.
-; *
-; * Remarks:
-; *
-; * Parameters:
-; * [in] pSrcDst pointer to the input (quantized) intra/inter block. Must be 16-byte aligned.
-; * [in] QP quantization parameter (quantiser_scale)
-; * [in] videoComp (Intra version only.) Video component type of the
-; * current block. Takes one of the following flags:
-; * OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE,
-; * OMX_VC_ALPHA.
-; * [in] shortVideoHeader a flag indicating presence of short_video_header;
-; * shortVideoHeader==1 selects linear intra DC mode,
-; * and shortVideoHeader==0 selects nonlinear intra DC mode.
-; * [out] pSrcDst pointer to the output (dequantized) intra/inter block. Must be 16-byte aligned.
-; *
-; * Return Value:
-; * OMX_Sts_NoErr - no error
-; * OMX_Sts_BadArgErr - bad arguments
-; * - If pSrcDst is NULL or is not 16-byte aligned.
-; * or
-; * - If QP <= 0.
-; * or
-; * - videoComp is none of OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE and OMX_VC_ALPHA.
-; *
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
-
- IMPORT armVCM4P2_DCScaler
-
-
-
- IF ARM1136JS
-
-;//Input Arguments
-pSrcDst RN 0
-QP RN 1
-videoComp RN 2
-shortVideoHeader RN 3
-
-;//Local Variables
-Return RN 0
-dcScaler RN 4
-temp RN 12
-index RN 6
-
-tempVal21 RN 4
-tempVal43 RN 5
-QP1 RN 6
-X2 RN 7
-X3 RN 14
-Result1 RN 8
-Result2 RN 9
-two RN 10
-Count RN 11
-
-
-
-
- M_START omxVCM4P2_QuantInvIntra_I,r11
-
-
-
- ;// Perform Inverse Quantization for DC coefficient
-
- TEQ shortVideoHeader,#0 ;// Test if short Video Header flag =0
- MOVNE dcScaler,#8 ;// if shortVideoHeader is non zero dcScaler=8
- BNE calDCVal
- LDR index, =armVCM4P2_DCScaler
- ADD index,index,videoComp,LSL #5
- LDRB dcScaler,[index,QP]
-
-
- ;//M_CalDCScalar shortVideoHeader,videoComp, QP
-
-calDCVal
-
- LDRH temp,[pSrcDst]
- SMULBB temp,temp,dcScaler ;// dcCoeff = dcScaler * Quantized DC coefficient(from memory)
- SSAT temp,#12,temp ;// Saturating to 12 bits
-
-
- MOV Count,#64
- TST QP,#1
- LDRD tempVal21,[pSrcDst] ;// Loads first two values of pSrcDst to tempVal21,
- ;// next two values to tempVal43
- SUBEQ QP1,QP,#1 ;// QP1=QP if QP is odd , QP1=QP-1 if QP is even
- MOVNE QP1,QP
- MOV two,#2
-
-
-
-
-
-Loop
-
-
- SMULBB X2,tempVal21,two ;// X2= first val(lower 16 bits of tampVal21)*2
- CMP X2,#0
-
- RSBLT X2,X2,#0 ;// X2=absoluteval(first val)
- SMLABBNE X2,QP,X2,QP1 ;// X2=2*absval(first val)*QP+QP if QP is odd
- ;// X2=2*absval(first val)*QP+QP-1 if QP is even
- SMULTB X3,tempVal21,two ;// X3= second val(top 16 bits of tampVal21)*2
- RSBLT X2,X2,#0
-
- CMP X3,#0
-
- RSBLT X3,X3,#0
- SMLABBNE X3,QP,X3,QP1
-
- RSBLT X3,X3,#0
- PKHBT Result1,X2,X3,LSL #16 ;// Result1[0-15]=X2[0-15],Result1[16-31]=X3[16-31]
- SMULBB X2,tempVal43,two ;// X2= first val(lower 16 bits of tampVal43)*2
- SSAT16 Result1,#12,Result1 ;// clip to range [-2048,2047]
- CMP X2,#0
-
-
-
- RSBLE X2,X2,#0
- SMLABBNE X2,QP,X2,QP1
- SMULTB X3,tempVal43,two ;// X2= first val(top 16 bits of tampVal21)*2
- RSBLT X2,X2,#0
- CMP X3,#0
-
- LDRD tempVal21,[pSrcDst,#8] ;// Load next four Values to tempVal21,tempVal43
-
- RSBLT X3,X3,#0
- SMLABBNE X3,QP,X3,QP1
- RSBLT X3,X3,#0
- PKHBT Result2,X2,X3,LSL #16 ;// Result2[0-15]=X2[0-15],Result2[16-31]=X3[16-31]
- SSAT16 Result2,#12,Result2 ;// clip to range [-2048,2047]
-
- SUBS Count,Count,#4 ;// Decrement Count by 4 and continue if it has not reached 0
- STRD Result1,[pSrcDst],#8 ;// Store Double words and increment the pointer to point the next store address
-
-
-
- BGT Loop
-
- SUB pSrcDst,pSrcDst,#128
-
- ;// Storing the Inverse Quantized DC coefficient
-
- STRH temp,[pSrcDst],#2
-
-
-
- MOV Return,#OMX_Sts_NoErr
-
-
-
-
- M_END
- ENDIF
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/src/armVC_Version.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/src/armVC_Version.c
deleted file mode 100644
index 5d93681..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm11/vc/src/armVC_Version.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "omxtypes.h"
-#include "armCOMM_Version.h"
-
-#ifdef ARM_INCLUDE_VERSION_DESCRIPTIONS
-const char * const omxVC_VersionDescription = "ARM OpenMAX DL v" ARM_VERSION_STRING " Rel=" OMX_ARM_RELEASE_TAG " Arch=" OMX_ARM_BUILD_ARCHITECTURE " Tools=" OMX_ARM_BUILD_TOOLCHAIN ;
-#endif /* ARM_INCLUDE_VERSION_DESCRIPTIONS */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/ARM_DELIVERY.TXT b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/ARM_DELIVERY.TXT
deleted file mode 100644
index cc2d70a..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/ARM_DELIVERY.TXT
+++ /dev/null
@@ -1,63 +0,0 @@
-The contents of this transaction was created by Hedley Francis
-of ARM on 19-Feb-2008.
-
-It contains the ARM data versions listed below.
-
-This data, unless otherwise stated, is ARM Proprietary and access to it
-is subject to the agreements indicated below.
-
-If you experience problems with this data, please contact ARM support
-quoting transaction reference <97414>.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-- OX002-SW-98010-r0p0-00bet1
- Video codecs - optimised code
- V7 code release for Hantro (Ver 1.0.2)
- internal access
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-This transaction contains deliverables which are designated as being of
-beta release status (BET).
-
-Beta release status has a particular meaning to ARM of which the recipient
-must be aware. Beta is a pre-release status indicating that the deliverable
-so described is believed to robustly demonstrate specified behaviour, to be
-consistent across its included aspects and be ready for general deployment.
-But Beta also indicates that pre-release reliability trials are ongoing and
-that it is possible residual defects or errors in operation, consistency
-and documentation may still be encountered. The recipient should consider
-this position when using this Beta material supplied. ARM will normally
-attempt to provide fixes or a work-around for defects identified by the
-recipient, but the provision or timeliness of this support cannot be
-guaranteed. ARM shall not be responsible for direct or consequential
-damages as a result of encountering one or more of these residual defects.
-By accepting a Beta release, the recipient agrees to these constraints and
-to providing reasonable information to ARM to enable the replication of the
-defects identified by the recipient. The specific Beta version supplied
-will not be supported after release of a later or higher status version.
-It should be noted that Support for the Beta release of the deliverable
-will only be provided by ARM to a recipient who has a current support and
-maintenance contract for the deliverable.
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-In addition to the data versions listed above, this transaction contains
-two additional files at the top level.
-
-The first is this file, ARM_DELIVERY_97414.TXT, which is the delivery
-note.
-
-The second is ARM_MANIFEST_97414.TXT which contains a manifest of all the
-files included in this transaction, together with their checksums.
-
-The checksums provided are calculated using the RSA Data Security, Inc.
-MD5 Message-Digest Algorithm.
-
-The checksums can be used to verify the integrity of this data using the
-"md5sum" tool (which is part of the GNU "textutils" package) by running:
-
- % md5sum --check ARM_MANIFEST_97414.TXT
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/ARM_MANIFEST.TXT b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/ARM_MANIFEST.TXT
deleted file mode 100644
index 8310f67..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/ARM_MANIFEST.TXT
+++ /dev/null
@@ -1,91 +0,0 @@
- OX002-SW-98010-r0p0-00bet1/
- OX002-SW-98010-r0p0-00bet1/api/
-e049791cfab6060a08cbac7b3ad767d6 OX002-SW-98010-r0p0-00bet1/api/armCOMM_s.h
-ed798face25497b2703ede736d6d52b6 OX002-SW-98010-r0p0-00bet1/api/omxtypes_s.h
-4eebd63af087376811d6749f0646b864 OX002-SW-98010-r0p0-00bet1/api/armCOMM_BitDec_s.h
-43cf46c2cf2fe1f93c615b57bcbe4809 OX002-SW-98010-r0p0-00bet1/api/armCOMM.h
-8f248ceaac8f602e277a521b679dcbbe OX002-SW-98010-r0p0-00bet1/api/armCOMM_IDCTTable.h
-8ac5fa80ea98e391f5730a375280b5bd OX002-SW-98010-r0p0-00bet1/api/armCOMM_Version.h
-3a2f420ddf6a1b950470bd0f5ebd5c62 OX002-SW-98010-r0p0-00bet1/api/armCOMM_IDCT_s.h
-511c0bb534fe223599e2c84eff24c9ed OX002-SW-98010-r0p0-00bet1/api/armCOMM_MaskTable.h
-8971932d56eed6b1ad1ba507f0bff5f0 OX002-SW-98010-r0p0-00bet1/api/armCOMM_Bitstream.h
-f87fedd9ca432fefa757008176864ef8 OX002-SW-98010-r0p0-00bet1/api/armOMX.h
-8e49899a428822c36ef9dd94e0e05f18 OX002-SW-98010-r0p0-00bet1/api/omxtypes.h
-323008b72e9f04099a8cb42e99a1face OX002-SW-98010-r0p0-00bet1/build_vc.pl
-e72d96c0a415459748df9807f3dae72f OX002-SW-98010-r0p0-00bet1/filelist_vc.txt
- OX002-SW-98010-r0p0-00bet1/src/
-5eeae659a29477f5c52296d24afffd3c OX002-SW-98010-r0p0-00bet1/src/armCOMM_IDCTTable.c
-d64cdcf38f7749dc7f77465e5b7d356d OX002-SW-98010-r0p0-00bet1/src/armCOMM_MaskTable.c
- OX002-SW-98010-r0p0-00bet1/vc/
- OX002-SW-98010-r0p0-00bet1/vc/m4p10/
- OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/
-e7e0c320978564a7c9b2c723749a98d6 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_CAVLCTables.c
-4adcd0df081990bdfc4729041a2a9152 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_InterpolateChroma.c
-852e0404142965dc1f3aa7f00ee5127b OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_UnpackBlock4x4_s.s
-7054151c5bfea6b5e74feee86b2d7b01 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_DecodeCoeffsToPairCAVLC.c
-5f7213a4f37627b3c58f6294ba477e30 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_DequantTables_s.s
-32ff4b8be62e2f0f3e764b83c1e5e2fd OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_DeblockChroma_I.c
-d066e3c81d82616f37ec1810ea49e7b7 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_DeblockingLuma_unsafe_s.s
-fe629a3e9d55395a6098bdf2431b5f02 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_DeblockingChroma_unsafe_s.s
-5b13fb954b7679de20076bb6a7f4ee1d OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_InterpolateLuma_s.s
-01ba60eff66ea49a4f833ce6279f8e2f OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_DeblockLuma_I.c
-fa1072cf1d17e9666c9f1e215fa302b1 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe_s.s
-db387b9e66d32787f47ef9cf0347da2a OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe_s.s
-ea537e4e2ad03a1940981055fa3ace01 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe_s.s
-29a4283885b9473a3550a81eff2559d2 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_TransformDequantChromaDCFromPair_s.s
-2ddcaf60a8ea1e6e6b77737f768bfb9d OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_QuantTables_s.s
-c3002aad5600f872b70a5d7fe3915846 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_InterpolateLuma_Align_unsafe_s.s
-a2900f2c47f1c61d20bd6c1eda33d6d4 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_InterpolateLuma_Copy_unsafe_s.s
-c921df73397a32c947dc996ba6858553 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_PredictIntra_4x4_s.s
-3769e14f2fc3f514d025fe6ab73ff67a OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_TransformDequantLumaDCFromPair_s.s
-c029d1cebea0a09e1d235a37e2155002 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_HorEdge_I_s.s
-076a033f8161750a685756f9f51f04c9 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe_s.s
-c5b5d22842822e6e5e31094882cbeb46 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_PredictIntra_16x16_s.s
-f6bdf6d914a4a1479f524951a3409846 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_VerEdge_I_s.s
-ebeb0713a9b2ea25986360ef262138c4 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_HorEdge_I_s.s
-78ed9ea200faa7be665445a713859af1 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_VerEdge_I_s.s
-c2d995f787b6f44ef10c751c12d1935f OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_InterpolateLuma_DiagCopy_unsafe_s.s
-40bed679a9f6e0d3efe216b7d4a9cf45 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_PredictIntraChroma_8x8_s.s
-4a52b3e9e268b8a8f07829bf500d03af OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_DecodeCoeffsToPair_s.s
-11249f8a98c5d4b84cb5575b0e37ca9c OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_Average_4x_Align_unsafe_s.s
-2513b60559ba71ae495c6053fb779fa9 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_Interpolate_Chroma_s.s
-2fb1ee17c36e3c1469c170f6dac11bf1 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_TransformResidual4x4_s.s
-cc4a6f32db0b72a91d3f278f6855df69 OX002-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC.c
- OX002-SW-98010-r0p0-00bet1/vc/m4p10/api/
-6e530ddaa7c2b57ffe88162c020cb662 OX002-SW-98010-r0p0-00bet1/vc/m4p10/api/armVCM4P10_CAVLCTables.h
- OX002-SW-98010-r0p0-00bet1/vc/m4p2/
- OX002-SW-98010-r0p0-00bet1/vc/m4p2/src/
-bec6de348b113438498867b869001622 OX002-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_Clip8_s.s
-dba9824e959b21d401cac925e68a11a6 OX002-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_Inter_s.s
-dfa7e5b58027be3542dda0593b77b2d3 OX002-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_QuantInvIntra_I_s.s
-4fba4c431a783a78a2eb6497a94ac967 OX002-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_Zigzag_Tables.c
-39991961179ca03b6381b6e653b1f14b OX002-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_MCReconBlock_s.s
-1b0b2990c2669dfb87cf6b810611c01b OX002-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_Huff_Tables_VLC.c
-1c9b87abf3283e957816b3937c680701 OX002-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_DecodePadMV_PVOP_s.s
-4fe1afca659a9055fc1172e58f78a506 OX002-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Intra.c
-2ea067f0436f91ba1351edaf411cb4ea OX002-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_Lookup_Tables.c
-6ce363aadc9d65c308b40cca8902e4f6 OX002-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_IDCT8x8blk_s.s
-bf212f786772aed2bc705d22ff4e74f5 OX002-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_FindMVpred_s.s
-293a48a648a3085456e6665bb7366fad OX002-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_SetPredDir_s.s
-2bb47ed9c9e25c5709c6d9b4ad39a38a OX002-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_QuantInvInter_I_s.s
-437dfa204508850d61d4b87091446e9f OX002-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraACVLC_s.s
-bc9778898dd41101dc0fb0139eaf83cc OX002-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraDCVLC_s.s
-fc191eeae43f8ce735dbd311cc7bcb8d OX002-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_PredictReconCoefIntra_s.s
-a0d85f4f517c945a4c9317ac021f2d08 OX002-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_DecodeVLCZigzag_AC_unsafe_s.s
-386020dee8b725c7fe2526f1fc211d7d OX002-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Inter.c
- OX002-SW-98010-r0p0-00bet1/vc/m4p2/api/
-4624e7c838e10a249abcc3d3f4f40748 OX002-SW-98010-r0p0-00bet1/vc/m4p2/api/armVCM4P2_Huff_Tables_VLC.h
-65e1057d04e2cb844559dc9f6e09795a OX002-SW-98010-r0p0-00bet1/vc/m4p2/api/armVCM4P2_ZigZag_Tables.h
- OX002-SW-98010-r0p0-00bet1/vc/src/
-e627b3346b0dc9aff14446005ce0fa43 OX002-SW-98010-r0p0-00bet1/vc/src/armVC_Version.c
- OX002-SW-98010-r0p0-00bet1/vc/api/
-7ca94b1c33ac0211e17d38baadd7d1dd OX002-SW-98010-r0p0-00bet1/vc/api/armVC.h
-12cf7596edbbf6048b626d15e8d0ed48 OX002-SW-98010-r0p0-00bet1/vc/api/omxVC.h
-11726e286a81257cb45f5547fb4d374c OX002-SW-98010-r0p0-00bet1/vc/api/omxVC_s.h
-a5b2af605c319cd2491319e430741377 OX002-SW-98010-r0p0-00bet1/vc/api/armVCCOMM_s.h
- OX002-SW-98010-r0p0-00bet1/vc/comm/
- OX002-SW-98010-r0p0-00bet1/vc/comm/src/
-1f81187b48487a8ea6dbc327648e3e4f OX002-SW-98010-r0p0-00bet1/vc/comm/src/omxVCCOMM_Copy16x16_s.s
-936d3f2038a6f8613ec25e50cc601fe8 OX002-SW-98010-r0p0-00bet1/vc/comm/src/omxVCCOMM_Copy8x8_s.s
-8f6708a249130962e0bc5c044ac6dd93 OX002-SW-98010-r0p0-00bet1/vc/comm/src/omxVCCOMM_ExpandFrame_I_s.s
-aab7713414428e95de0ba799a2679b36 ARM_DELIVERY_97414.TXT
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM.h
deleted file mode 100644
index 1992885..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM.h
+++ /dev/null
@@ -1,800 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armCOMM.h
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- * File: armCOMM.h
- * Brief: Declares Common APIs/Data Types used across OpenMAX API's
- *
- */
-
-
-#ifndef _armCommon_H_
-#define _armCommon_H_
-
-#include "omxtypes.h"
-
-typedef struct
-{
- OMX_F32 Re; /** Real part */
- OMX_F32 Im; /** Imaginary part */
-
-} OMX_FC32; /** single precision floating point complex number */
-
-typedef struct
-{
- OMX_F64 Re; /** Real part */
- OMX_F64 Im; /** Imaginary part */
-
-} OMX_FC64; /** double precision floating point complex number */
-
-
-/* Used by both IP and IC domains for 8x8 JPEG blocks. */
-typedef OMX_S16 ARM_BLOCK8x8[64];
-
-
-#include "armOMX.h"
-
-#define armPI (OMX_F64)(3.1415926535897932384626433832795)
-
-/***********************************************************************/
-
-/* Compiler extensions */
-#ifdef ARM_DEBUG
-/* debug version */
-#include <stdlib.h>
-#include <assert.h>
-#include <stdio.h>
-#define armError(str) {printf((str)); printf("\n"); exit(-1);}
-#define armWarn(str) {printf((str)); printf("\n");}
-#define armIgnore(a) ((void)a)
-#define armAssert(a) assert(a)
-#else
-/* release version */
-#define armError(str) ((void) (str))
-#define armWarn(str) ((void) (str))
-#define armIgnore(a) ((void) (a))
-#define armAssert(a) ((void) (a))
-#endif /* ARM_DEBUG */
-
-/* Arithmetic operations */
-
-#define armMin(a,b) ( (a) > (b) ? (b):(a) )
-#define armMax(a,b) ( (a) > (b) ? (a):(b) )
-#define armAbs(a) ( (a) < 0 ? -(a):(a) )
-
-/* Alignment operation */
-
-#define armAlignToBytes(Ptr,N) (Ptr + ( ((N-(intptr_t)Ptr)&(N-1)) / sizeof(*Ptr) ))
-#define armAlignTo2Bytes(Ptr) armAlignToBytes(Ptr,2)
-#define armAlignTo4Bytes(Ptr) armAlignToBytes(Ptr,4)
-#define armAlignTo8Bytes(Ptr) armAlignToBytes(Ptr,8)
-#define armAlignTo16Bytes(Ptr) armAlignToBytes(Ptr,16)
-
-/* Error and Alignment check */
-
-#define armRetArgErrIf(condition, code) if(condition) { return (code); }
-#define armRetDataErrIf(condition, code) if(condition) { return (code); }
-
-#ifndef ALIGNMENT_DOESNT_MATTER
-#define armIsByteAligned(Ptr,N) ((((intptr_t)(Ptr)) % N)==0)
-#define armNotByteAligned(Ptr,N) ((((intptr_t)(Ptr)) % N)!=0)
-#else
-#define armIsByteAligned(Ptr,N) (1)
-#define armNotByteAligned(Ptr,N) (0)
-#endif
-
-#define armIs2ByteAligned(Ptr) armIsByteAligned(Ptr,2)
-#define armIs4ByteAligned(Ptr) armIsByteAligned(Ptr,4)
-#define armIs8ByteAligned(Ptr) armIsByteAligned(Ptr,8)
-#define armIs16ByteAligned(Ptr) armIsByteAligned(Ptr,16)
-
-#define armNot2ByteAligned(Ptr) armNotByteAligned(Ptr,2)
-#define armNot4ByteAligned(Ptr) armNotByteAligned(Ptr,4)
-#define armNot8ByteAligned(Ptr) armNotByteAligned(Ptr,8)
-#define armNot16ByteAligned(Ptr) armNotByteAligned(Ptr,16)
-#define armNot32ByteAligned(Ptr) armNotByteAligned(Ptr,32)
-
-/**
- * Function: armRoundFloatToS16_ref/armRoundFloatToS32_ref/armRoundFloatToS64
- *
- * Description:
- * Converts a double precision value into a short int/int after rounding
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S16/OMX_S32 format
- *
- */
-
-OMX_S16 armRoundFloatToS16 (OMX_F64 Value);
-OMX_S32 armRoundFloatToS32 (OMX_F64 Value);
-OMX_S64 armRoundFloatToS64 (OMX_F64 Value);
-
-/**
- * Function: armSatRoundFloatToS16_ref/armSatRoundFloatToS32
- *
- * Description:
- * Converts a double precision value into a short int/int after rounding and saturation
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S16/OMX_S32 format
- *
- */
-
-OMX_S16 armSatRoundFloatToS16 (OMX_F64 Value);
-OMX_S32 armSatRoundFloatToS32 (OMX_F64 Value);
-
-/**
- * Function: armSatRoundFloatToU16_ref/armSatRoundFloatToU32
- *
- * Description:
- * Converts a double precision value into a unsigned short int/int after rounding and saturation
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_U16/OMX_U32 format
- *
- */
-
-OMX_U16 armSatRoundFloatToU16 (OMX_F64 Value);
-OMX_U32 armSatRoundFloatToU32 (OMX_F64 Value);
-
-/**
- * Function: armSignCheck
- *
- * Description:
- * Checks the sign of a variable:
- * returns 1 if it is Positive
- * returns 0 if it is 0
- * returns -1 if it is Negative
- *
- * Remarks:
- *
- * Parameters:
- * [in] var Variable to be checked
- *
- * Return Value:
- * OMX_INT -- returns 1 if it is Positive
- * returns 0 if it is 0
- * returns -1 if it is Negative
- */
-
-OMX_INT armSignCheck (OMX_S16 var);
-
-/**
- * Function: armClip
- *
- * Description: Clips the input between MAX and MIN value
- *
- *
- * Remarks:
- *
- * Parameters:
- * [in] Min lower bound
- * [in] Max upper bound
- * [in] src variable to the clipped
- *
- * Return Value:
- * OMX_S32 -- returns clipped value
- */
-
-OMX_S32 armClip (
- OMX_INT min,
- OMX_INT max,
- OMX_S32 src
- );
-
-/**
- * Function: armClip_F32
- *
- * Description: Clips the input between MAX and MIN value
- *
- *
- * Remarks:
- *
- * Parameters:
- * [in] Min lower bound
- * [in] Max upper bound
- * [in] src variable to the clipped
- *
- * Return Value:
- * OMX_F32 -- returns clipped value
- */
-
-OMX_F32 armClip_F32 (
- OMX_F32 min,
- OMX_F32 max,
- OMX_F32 src
- );
-
-/**
- * Function: armShiftSat_F32
- *
- * Description: Divides a float value by 2^shift and
- * saturates it for unsigned value range for satBits.
- * Second parameter is like "shifting" the corresponding
- * integer value. Takes care of rounding while clipping the final
- * value.
- *
- * Parameters:
- * [in] v Number to be operated upon
- * [in] shift Divides the input "v" by "2^shift"
- * [in] satBits Final range is [0, 2^satBits)
- *
- * Return Value:
- * OMX_S32 -- returns "shifted" saturated value
- */
-
-OMX_U32 armShiftSat_F32(
- OMX_F32 v,
- OMX_INT shift,
- OMX_INT satBits
- );
-
-/**
- * Functions: armSwapElem
- *
- * Description:
- * This function swaps two elements at the specified pointer locations.
- * The size of each element could be anything as specified by <elemSize>
- *
- * Return Value:
- * OMXResult -- Error status from the function
- */
-OMXResult armSwapElem(OMX_U8 *pBuf1, OMX_U8 *pBuf2, OMX_INT elemSize);
-
-
-/**
- * Function: armMedianOf3
- *
- * Description: Finds the median of three numbers
- *
- * Remarks:
- *
- * Parameters:
- * [in] fEntry First entry
- * [in] sEntry second entry
- * [in] tEntry Third entry
- *
- * Return Value:
- * OMX_S32 -- returns the median value
- */
-
-OMX_S32 armMedianOf3 (
- OMX_S32 fEntry,
- OMX_S32 sEntry,
- OMX_S32 tEntry
- );
-
-/**
- * Function: armLogSize
- *
- * Description: Finds the size of a positive value and returns the same
- *
- * Remarks:
- *
- * Parameters:
- * [in] value Positive value
- *
- * Return Value:
- * OMX_U8 -- returns the size of the positive value
- */
-
-OMX_U8 armLogSize (
- OMX_U16 value
- );
-
-/***********************************************************************/
- /* Saturating Arithmetic operations */
-
-/**
- * Function :armSatAdd_S32()
- *
- * Description :
- * Returns the result of saturated addition of the two inputs Value1, Value2
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- *
- * Return:
- * [out] Result of operation
- *
- *
- **/
-
-OMX_S32 armSatAdd_S32(
- OMX_S32 Value1,
- OMX_S32 Value2
- );
-
-/**
- * Function :armSatAdd_S64()
- *
- * Description :
- * Returns the result of saturated addition of the two inputs Value1, Value2
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- *
- * Return:
- * [out] Result of operation
- *
- *
- **/
-
-OMX_S64 armSatAdd_S64(
- OMX_S64 Value1,
- OMX_S64 Value2
- );
-
-/** Function :armSatSub_S32()
- *
- * Description :
- * Returns the result of saturated substraction of the two inputs Value1, Value2
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S32 armSatSub_S32(
- OMX_S32 Value1,
- OMX_S32 Value2
- );
-
-/**
- * Function :armSatMac_S32()
- *
- * Description :
- * Returns the result of Multiplication of Value1 and Value2 and subesquent saturated
- * accumulation with Mac
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- * [in] Mac Accumulator
- *
- * Return:
- * [out] Result of operation
- **/
-
-OMX_S32 armSatMac_S32(
- OMX_S32 Mac,
- OMX_S16 Value1,
- OMX_S16 Value2
- );
-
-/**
- * Function :armSatMac_S16S32_S32
- *
- * Description :
- * Returns the result of saturated MAC operation of the three inputs delayElem, filTap , mac
- *
- * mac = mac + Saturate_in_32Bits(delayElem * filTap)
- *
- * Parametrs:
- * [in] delayElem First 32 bit Operand
- * [in] filTap Second 16 bit Operand
- * [in] mac Result of MAC operation
- *
- * Return:
- * [out] mac Result of operation
- *
- **/
-
-OMX_S32 armSatMac_S16S32_S32(
- OMX_S32 mac,
- OMX_S32 delayElem,
- OMX_S16 filTap );
-
-/**
- * Function :armSatRoundRightShift_S32_S16
- *
- * Description :
- * Returns the result of rounded right shift operation of input by the scalefactor
- *
- * output = Saturate_in_16Bits( ( RightShift( (Round(input) , scaleFactor ) )
- *
- * Parametrs:
- * [in] input The input to be operated on
- * [in] scaleFactor The shift number
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-
-OMX_S16 armSatRoundRightShift_S32_S16(
- OMX_S32 input,
- OMX_INT scaleFactor);
-
-/**
- * Function :armSatRoundLeftShift_S32()
- *
- * Description :
- * Returns the result of saturating left-shift operation on input
- * Or rounded Right shift if the input Shift is negative.
- *
- * Parametrs:
- * [in] Value Operand
- * [in] shift Operand for shift operation
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S32 armSatRoundLeftShift_S32(
- OMX_S32 Value,
- OMX_INT shift
- );
-
-/**
- * Function :armSatRoundLeftShift_S64()
- *
- * Description :
- * Returns the result of saturating left-shift operation on input
- * Or rounded Right shift if the input Shift is negative.
- *
- * Parametrs:
- * [in] Value Operand
- * [in] shift Operand for shift operation
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S64 armSatRoundLeftShift_S64(
- OMX_S64 Value,
- OMX_INT shift
- );
-
-/**
- * Function :armSatMulS16S32_S32()
- *
- * Description :
- * Returns the result of a S16 data type multiplied with an S32 data type
- * in a S32 container
- *
- * Parametrs:
- * [in] input1 Operand 1
- * [in] input2 Operand 2
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-
-OMX_S32 armSatMulS16S32_S32(
- OMX_S16 input1,
- OMX_S32 input2);
-
-/**
- * Function :armSatMulS32S32_S32()
- *
- * Description :
- * Returns the result of a S32 data type multiplied with an S32 data type
- * in a S32 container
- *
- * Parametrs:
- * [in] input1 Operand 1
- * [in] input2 Operand 2
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S32 armSatMulS32S32_S32(
- OMX_S32 input1,
- OMX_S32 input2);
-
-
-/**
- * Function :armIntDivAwayFromZero()
- *
- * Description : Integer division with rounding to the nearest integer.
- * Half-integer values are rounded away from zero
- * unless otherwise specified. For example 3//2 is rounded
- * to 2, and -3//2 is rounded to -2.
- *
- * Parametrs:
- * [in] Num Operand 1
- * [in] Deno Operand 2
- *
- * Return:
- * [out] Result of operation input1//input2
- *
- **/
-
-OMX_S32 armIntDivAwayFromZero (OMX_S32 Num, OMX_S32 Deno);
-
-
-/***********************************************************************/
-/*
- * Debugging macros
- *
- */
-
-
-/*
- * Definition of output stream - change to stderr if necessary
- */
-#define DEBUG_STREAM stdout
-
-/*
- * Debug printf macros, one for each argument count.
- * Add more if needed.
- */
-#ifdef DEBUG_ON
-#include <stdio.h>
-
-#define DEBUG_PRINTF_0(a) fprintf(DEBUG_STREAM, a)
-#define DEBUG_PRINTF_1(a, b) fprintf(DEBUG_STREAM, a, b)
-#define DEBUG_PRINTF_2(a, b, c) fprintf(DEBUG_STREAM, a, b, c)
-#define DEBUG_PRINTF_3(a, b, c, d) fprintf(DEBUG_STREAM, a, b, c, d)
-#define DEBUG_PRINTF_4(a, b, c, d, e) fprintf(DEBUG_STREAM, a, b, c, d, e)
-#define DEBUG_PRINTF_5(a, b, c, d, e, f) fprintf(DEBUG_STREAM, a, b, c, d, e, f)
-#define DEBUG_PRINTF_6(a, b, c, d, e, f, g) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g)
-#define DEBUG_PRINTF_7(a, b, c, d, e, f, g, h) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h)
-#define DEBUG_PRINTF_8(a, b, c, d, e, f, g, h, i) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i)
-#define DEBUG_PRINTF_9(a, b, c, d, e, f, g, h, i, j) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i, j)
-#define DEBUG_PRINTF_10(a, b, c, d, e, f, g, h, i, j, k) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i, j, k)
-#define DEBUG_PRINTF_11(a, b, c, d, e, f, g, h, i, j, k, l) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i, j, k, l)
-#define DEBUG_PRINTF_12(a, b, c, d, e, f, g, h, i, j, k, l, m) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i, j, k, l, m)
-#define DEBUG_PRINTF_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i, j, k, l, m, n)
-#define DEBUG_PRINTF_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
-#else /* DEBUG_ON */
-#define DEBUG_PRINTF_0(a)
-#define DEBUG_PRINTF_1(a, b)
-#define DEBUG_PRINTF_2(a, b, c)
-#define DEBUG_PRINTF_3(a, b, c, d)
-#define DEBUG_PRINTF_4(a, b, c, d, e)
-#define DEBUG_PRINTF_5(a, b, c, d, e, f)
-#define DEBUG_PRINTF_6(a, b, c, d, e, f, g)
-#define DEBUG_PRINTF_7(a, b, c, d, e, f, g, h)
-#define DEBUG_PRINTF_8(a, b, c, d, e, f, g, h, i)
-#define DEBUG_PRINTF_9(a, b, c, d, e, f, g, h, i, j)
-#define DEBUG_PRINTF_10(a, b, c, d, e, f, g, h, i, j, k)
-#define DEBUG_PRINTF_11(a, b, c, d, e, f, g, h, i, j, k, l)
-#define DEBUG_PRINTF_12(a, b, c, d, e, f, g, h, i, j, k, l, m)
-#define DEBUG_PRINTF_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n)
-#define DEBUG_PRINTF_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
-#endif /* DEBUG_ON */
-
-
-/*
- * Domain and sub domain definitions
- *
- * In order to turn on debug for an entire domain or sub-domain
- * at compile time, one of the DEBUG_DOMAIN_* below may be defined,
- * which will activate debug in all of the defines it contains.
- */
-
-#ifdef DEBUG_DOMAIN_AC
-#define DEBUG_OMXACAAC_DECODECHANPAIRELT_MPEG4
-#define DEBUG_OMXACAAC_DECODECHANPAIRELT
-#define DEBUG_OMXACAAC_DECODEDATSTRELT
-#define DEBUG_OMXACAAC_DECODEFILLELT
-#define DEBUG_OMXACAAC_DECODEISSTEREO_S32
-#define DEBUG_OMXACAAC_DECODEMSPNS_S32
-#define DEBUG_OMXACAAC_DECODEMSSTEREO_S32_I
-#define DEBUG_OMXACAAC_DECODEPRGCFGELT
-#define DEBUG_OMXACAAC_DECODETNS_S32_I
-#define DEBUG_OMXACAAC_DEINTERLEAVESPECTRUM_S32
-#define DEBUG_OMXACAAC_ENCODETNS_S32_I
-#define DEBUG_OMXACAAC_LONGTERMPREDICT_S32
-#define DEBUG_OMXACAAC_LONGTERMRECONSTRUCT_S32
-#define DEBUG_OMXACAAC_MDCTFWD_S32
-#define DEBUG_OMXACAAC_MDCTINV_S32_S16
-#define DEBUG_OMXACAAC_NOISELESSDECODE
-#define DEBUG_OMXACAAC_QUANTINV_S32_I
-#define DEBUG_OMXACAAC_UNPACKADIFHEADER
-#define DEBUG_OMXACAAC_UNPACKADTSFRAMEHEADER
-#define DEBUG_OMXACMP3_HUFFMANDECODESFBMBP_S32
-#define DEBUG_OMXACMP3_HUFFMANDECODESFB_S32
-#define DEBUG_OMXACMP3_HUFFMANDECODE_S32
-#define DEBUG_OMXACMP3_MDCTINV_S32
-#define DEBUG_OMXACMP3_REQUANTIZESFB_S32_I
-#define DEBUG_OMXACMP3_REQUANTIZE_S32_I
-#define DEBUG_OMXACMP3_SYNTHPQMF_S32_S16
-#define DEBUG_OMXACMP3_UNPACKFRAMEHEADER
-#define DEBUG_OMXACMP3_UNPACKSCALEFACTORS_S8
-#define DEBUG_OMXACMP3_UNPACKSIDEINFO
-#endif /* DEBUG_DOMAIN_AC */
-
-
-#ifdef DEBUG_DOMAIN_VC
-#define DEBUG_OMXVCM4P10_AVERAGE_16X
-#define DEBUG_OMXVCM4P10_AVERAGE_4X
-#define DEBUG_OMXVCM4P10_AVERAGE_8X
-#define DEBUG_OMXVCM4P10_DEBLOCKCHROMA_U8_C1IR
-#define DEBUG_OMXVCM4P10_DEBLOCKLUMA_U8_C1IR
-#define DEBUG_OMXVCM4P10_DECODECHROMADCCOEFFSTOPAIRCAVLC_U8
-#define DEBUG_OMXVCM4P10_DECODECOEFFSTOPAIRCAVLC_U8
-#define DEBUG_OMXVCM4P10_DEQUANTTRANSFORMACFROMPAIR_U8_S16_C1_DLX
-#define DEBUG_OMXVCM4P10_EXPANDFRAME
-#define DEBUG_OMXVCM4P10_FILTERDEBLOCKINGCHROMA_HOREDGE_U8_C1IR
-#define DEBUG_OMXVCM4P10_FILTERDEBLOCKINGCHROMA_VEREDGE_U8_C1IR
-#define DEBUG_OMXVCM4P10_FILTERDEBLOCKINGLUMA_HOREDGE_U8_C1IR
-#define DEBUG_OMXVCM4P10_FILTERDEBLOCKINGLUMA_VEREDGE_U8_C1IR
-#define DEBUG_OMXVCM4P10_PREDICTINTRACHROMA8X8_U8_C1R
-#define DEBUG_OMXVCM4P10_PREDICTINTRA_16X16_U8_C1R
-#define DEBUG_OMXVCM4P10_PREDICTINTRA_4X4_U8_C1R
-#define DEBUG_OMXVCM4P10_SADQUAR_16X
-#define DEBUG_OMXVCM4P10_SADQUAR_4X
-#define DEBUG_OMXVCM4P10_SADQUAR_8X
-#define DEBUG_OMXVCM4P10_SAD_16X
-#define DEBUG_OMXVCM4P10_SAD_4X
-#define DEBUG_OMXVCM4P10_SAD_8X
-#define DEBUG_OMXVCM4P10_SATD_4X4
-#define DEBUG_OMXVCM4P10_TRANSFORMDEQUANTCHROMADCFROMPAIR_U8_S16_C1
-#define DEBUG_OMXVCM4P10_TRANSFORMDEQUANTLUMADCFROMPAIR_U8_S16_C1
-#define DEBUG_OMXVCM4P10_TRANSFORMQUANT_CHROMADC
-#define DEBUG_OMXVCM4P10_TRANSFORMQUANT_LUMADC
-#define DEBUG_OMXVCM4P2_BLOCKMATCH_HALF_16X16
-#define DEBUG_OMXVCM4P2_BLOCKMATCH_HALF_8X8
-#define DEBUG_OMXVCM4P2_BLOCKMATCH_INTEGER_16X16
-#define DEBUG_OMXVCM4P2_BLOCKMATCH_INTEGER_8X8
-#define DEBUG_OMXVCM4P2_COMPUTETEXTUREERRORBLOCK_SAD_U8_S16
-#define DEBUG_OMXVCM4P2_COMPUTETEXTUREERRORBLOCK_U8_S16
-#define DEBUG_OMXVCM4P2_DCT8X8BLKDLX
-#define DEBUG_OMXVCM4P2_DECODEBLOCKCOEF_INTER_S16
-#define DEBUG_OMXVCM4P2_DECODEPADMV_PVOP
-#define DEBUG_OMXVCM4P2_DECODEVLCZIGZAG_INTER_S16
-#define DEBUG_OMXVCM4P2_DECODEVLCZIGZAG_INTRAACVLC_S16
-#define DEBUG_OMXVCM4P2_DECODEVLCZIGZAG_INTRADCVLC_S16
-#define DEBUG_OMXVCM4P2_ENCODEMV_U8_S16
-#define DEBUG_OMXVCM4P2_ENCODEVLCZIGZAG_INTER_S16
-#define DEBUG_OMXVCM4P2_ENCODEVLCZIGZAG_INTRAACVLC_S16
-#define DEBUG_OMXVCM4P2_ENCODEVLCZIGZAG_INTRADCVLC_S16
-#define DEBUG_OMXVCM4P2_FINDMVPRED
-#define DEBUG_OMXVCM4P2_IDCT8X8BLKDLX
-#define DEBUG_OMXVCM4P2_LIMITMVTORECT
-#define DEBUG_OMXVCM4P2_MOTIONESTIMATIONMB
-#define DEBUG_OMXVCM4P2_PADMBGRAY_U8
-#define DEBUG_OMXVCM4P2_PADMBHORIZONTAL_U8
-#define DEBUG_OMXVCM4P2_PADMBVERTICAL_U8
-#define DEBUG_OMXVCM4P2_PADMV
-#define DEBUG_OMXVCM4P2_QUANTINTER_S16_I
-#define DEBUG_OMXVCM4P2_QUANTINTRA_S16_I
-#define DEBUG_OMXVCM4P2_QUANTINVINTER_S16_I
-#define DEBUG_OMXVCM4P2_QUANTINVINTRA_S16_I
-#define DEBUG_OMXVCM4P2_TRANSRECBLOCKCEOF_INTER
-#define DEBUG_OMXVCM4P2_TRANSRECBLOCKCEOF_INTRA
-#endif /* DEBUG_DOMAIN_VC */
-
-
-#ifdef DEBUG_DOMAIN_IC
-/* To be filled in */
-#endif /* DEBUG_DOMAIN_IC */
-
-
-#ifdef DEBUG_DOMAIN_SP
-#define DEBUG_OMXACSP_DOTPROD_S16
-#define DEBUG_OMXACSP_BLOCKEXP_S16
-#define DEBUG_OMXACSP_BLOCKEXP_S32
-#define DEBUG_OMXACSP_COPY_S16
-#define DEBUG_OMXACSP_DOTPROD_S16
-#define DEBUG_OMXACSP_DOTPROD_S16_SFS
-#define DEBUG_OMXACSP_FFTFWD_CTOC_SC16_SFS
-#define DEBUG_OMXACSP_FFTFWD_CTOC_SC32_SFS
-#define DEBUG_OMXACSP_FFTFWD_RTOCCS_S16S32_SFS
-#define DEBUG_OMXACSP_FFTFWD_RTOCCS_S32_SFS
-#define DEBUG_OMXACSP_FFTGETBUFSIZE_C_SC16
-#define DEBUG_OMXACSP_FFTGETBUFSIZE_C_SC32
-#define DEBUG_OMXACSP_FFTGETBUFSIZE_R_S16_S32
-#define DEBUG_OMXACSP_FFTGETBUFSIZE_R_S32
-#define DEBUG_OMXACSP_FFTINIT_C_SC16
-#define DEBUG_OMXACSP_FFTINIT_C_SC32
-#define DEBUG_OMXACSP_FFTINIT_R_S16_S32
-#define DEBUG_OMXACSP_FFTINIT_R_S32
-#define DEBUG_OMXACSP_FFTINV_CCSTOR_S32S16_SFS
-#define DEBUG_OMXACSP_FFTINV_CCSTOR_S32_SFS
-#define DEBUG_OMXACSP_FFTINV_CTOC_SC16_SFS
-#define DEBUG_OMXACSP_FFTINV_CTOC_SC32_SFS
-#define DEBUG_OMXACSP_FILTERMEDIAN_S32_I
-#define DEBUG_OMXACSP_FILTERMEDIAN_S32
-#define DEBUG_OMXACSP_FIRONE_DIRECT_S16_ISFS
-#define DEBUG_OMXACSP_FIRONE_DIRECT_S16_I
-#define DEBUG_OMXACSP_FIRONE_DIRECT_S16
-#define DEBUG_OMXACSP_FIRONE_DIRECT_S16_SFS
-#define DEBUG_OMXACSP_FIR_DIRECT_S16_ISFS
-#define DEBUG_OMXACSP_FIR_DIRECT_S16_I
-#define DEBUG_OMXACSP_FIR_DIRECT_S16
-#define DEBUG_OMXACSP_FIR_DIRECT_S16_SFS
-#define DEBUG_OMXACSP_IIRONE_BIQUADDIRECT_S16_I
-#define DEBUG_OMXACSP_IIRONE_BIQUADDIRECT_S16
-#define DEBUG_OMXACSP_IIRONE_DIRECT_S16_I
-#define DEBUG_OMXACSP_IIRONE_DIRECT_S16
-#define DEBUG_OMXACSP_IIR_BIQUADDIRECT_S16_I
-#define DEBUG_OMXACSP_IIR_BIQUADDIRECT_S16
-#define DEBUG_OMXACSP_IIR_DIRECT_S16_I
-#define DEBUG_OMXACSP_IIR_DIRECT_S16
-#endif /* DEBUG_DOMAIN_SP */
-
-
-#ifdef DEBUG_DOMAIN_IP
-#define DEBUG_OMXIPBM_ADDC_U8_C1R_SFS
-#define DEBUG_OMXIPBM_COPY_U8_C1R
-#define DEBUG_OMXIPBM_COPY_U8_C3R
-#define DEBUG_OMXIPBM_MIRROR_U8_C1R
-#define DEBUG_OMXIPBM_MULC_U8_C1R_SFS
-#define DEBUG_OMXIPCS_COLORTWISTQ14_U8_C3R
-#define DEBUG_OMXIPCS_RGB565TOYCBCR420LS_MCU_U16_S16_C3P3R
-#define DEBUG_OMXIPCS_RGB565TOYCBCR422LS_MCU_U16_S16_C3P3R
-#define DEBUG_OMXIPCS_RGB565TOYCBCR444LS_MCU_U16_S16_C3P3R
-#define DEBUG_OMXIPCS_RGBTOYCBCR420LS_MCU_U8_S16_C3P3R
-#define DEBUG_OMXIPCS_RGBTOYCBCR422LS_MCU_U8_S16_C3P3R
-#define DEBUG_OMXIPCS_RGBTOYCBCR444LS_MCU_U8_S16_C3P3R
-#define DEBUG_OMXIPCS_YCBCR420RSZROT_U8_P3R
-#define DEBUG_OMXIPCS_YCBCR420TORGB565LS_MCU_S16_U16_P3C3R
-#define DEBUG_OMXIPCS_YCBCR420TORGB565_U8_U16_P3C3R
-#define DEBUG_OMXIPCS_YCBCR420TORGBLS_MCU_S16_U8_P3C3R
-#define DEBUG_OMXIPCS_YCBCR422RSZCSCROTRGB_U8_C2R
-#define DEBUG_OMXIPCS_YCBCR422RSZROT_U8_P3R
-#define DEBUG_OMXIPCS_YCBCR422TORGB565LS_MCU_S16_U16_P3C3R
-#define DEBUG_OMXIPCS_YCBCR422TORGB565_U8_U16_C2C3R
-#define DEBUG_OMXIPCS_YCBCR422TORGBLS_MCU_S16_U8_P3C3R
-#define DEBUG_OMXIPCS_YCBCR422TORGB_U8_C2C3R
-#define DEBUG_OMXIPCS_YCBCR422TOYCBCR420ROTATE_U8_C2P3R
-#define DEBUG_OMXIPCS_YCBCR422TOYCBCR420ROTATE_U8_P3R
-#define DEBUG_OMXIPCS_YCBCR444TORGB565LS_MCU_S16_U16_P3C3R
-#define DEBUG_OMXIPCS_YCBCR444TORGBLS_MCU_S16_U8_P3C3R
-#define DEBUG_OMXIPCS_YCBCRTORGB565_U8_U16_C3R
-#define DEBUG_OMXIPCS_YCBCRTORGB565_U8_U16_P3C3R
-#define DEBUG_OMXIPCS_YCBCRTORGB_U8_C3R
-#define DEBUG_OMXIPPP_GETCENTRALMOMENT_S64
-#define DEBUG_OMXIPPP_GETSPATIALMOMENT_S64
-#define DEBUG_OMXIPPP_MOMENTGETSTATESIZE_S64
-#define DEBUG_OMXIPPP_MOMENTINIT_S64
-#define DEBUG_OMXIPPP_MOMENTS64S_U8_C1R
-#define DEBUG_OMXIPPP_MOMENTS64S_U8_C3R
-#endif /* DEBUG_DOMAIN_IP */
-
-
-#endif /* _armCommon_H_ */
-
-/*End of File*/
-
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_BitDec_s.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_BitDec_s.h
deleted file mode 100644
index 56344e3..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_BitDec_s.h
+++ /dev/null
@@ -1,684 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armCOMM_BitDec_s.h
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-;// OpenMAX optimized bitstream decode module
-;//
-;// You must include armCOMM_s.h before including this file
-;//
-;// This module provides macros to perform assembly optimized fixed and
-;// variable length decoding from a read-only bitstream. The variable
-;// length decode modules take as input a pointer to a table of 16-bit
-;// entries of the following format.
-;//
-;// VLD Table Entry format
-;//
-;// 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
-;// +------------------------------------------------+
-;// | Len | Symbol | 1 |
-;// +------------------------------------------------+
-;// | Offset | 0 |
-;// +------------------------------------------------+
-;//
-;// If the table entry is a leaf entry then bit 0 set:
-;// Len = Number of bits overread (0 to 7)
-;// Symbol = Symbol payload (unsigned 12 bits)
-;//
-;// If the table entry is an internal node then bit 0 is clear:
-;// Offset = Number of (16-bit) half words from the table
-;// start to the next table node
-;//
-;// The table is accessed by successive lookup up on the
-;// next Step bits of the input bitstream until a leaf node
-;// is obtained. The Step sizes are supplied to the VLD macro.
-;//
-;// USAGE:
-;//
-;// To use any of the macros in this package, first call:
-;//
-;// M_BD_INIT ppBitStream, pBitOffset, pBitStream, RBitBuffer, RBitCount, Tmp
-;//
-;// This caches the current bitstream position and next available
-;// bits in registers pBitStream, RBitBuffer, RBitCount. These registers
-;// are reserved for use by the bitstream decode package until you
-;// call M_BD_FINI.
-;//
-;// Next call the following macro(s) as many times as you need:
-;//
-;// M_BD_LOOK8 - Look ahead constant 1<=N<=8 bits into the bitstream
-;// M_BD_LOOK16 - Look ahead constant 1<=N<=16 bits into the bitstream
-;// M_BD_READ8 - Read constant 1<=N<=8 bits from the bitstream
-;// M_BD_READ16 - Read constant 1<=N<=16 bits from the bitstream
-;// M_BD_VREAD8 - Read variable 1<=N<=8 bits from the bitstream
-;// M_BD_VREAD16 - Read variable 1<=N<=16 bits from the bitstream
-;// M_BD_VLD - Perform variable length decode using lookup table
-;//
-;// Finally call the macro:
-;//
-;// M_BD_FINI ppBitStream, pBitOffset
-;//
-;// This writes the bitstream state back to memory.
-;//
-;// The three bitstream cache register names are assigned to the following global
-;// variables:
-;//
-
- GBLS pBitStream ;// Register name for pBitStream
- GBLS BitBuffer ;// Register name for BitBuffer
- GBLS BitCount ;// Register name for BitCount
-
-;//
-;// These register variables must have a certain defined state on entry to every bitstream
-;// macro (except M_BD_INIT) and on exit from every bitstream macro (except M_BD_FINI).
-;// The state may depend on implementation.
-;//
-;// For the default (ARM11) implementation the following hold:
-;// pBitStream - points to the first byte not held in the BitBuffer
-;// BitBuffer - is a cache of (4 bytes) 32 bits, bit 31 the first bit
-;// BitCount - is offset (from the top bit) to the next unused bitstream bit
-;// 0<=BitCount<=15 (so BitBuffer holds at least 17 unused bits)
-;//
-;//
-
- ;// Bitstream Decode initialise
- ;//
- ;// Initialises the bitstream decode global registers from
- ;// bitstream pointers. This macro is split into 3 parts to enable
- ;// scheduling.
- ;//
- ;// Input Registers:
- ;//
- ;// $ppBitStream - pointer to pointer to the next bitstream byte
- ;// $pBitOffset - pointer to the number of bits used in the current byte (0..7)
- ;// $RBitStream - register to use for pBitStream (can be $ppBitStream)
- ;// $RBitBuffer - register to use for BitBuffer
- ;// $RBitCount - register to use for BitCount (can be $pBitOffset)
- ;//
- ;// Output Registers:
- ;//
- ;// $T1,$T2,$T3 - registers that must be preserved between calls to
- ;// M_BD_INIT1 and M_BD_INIT2
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_INIT0 $ppBitStream, $pBitOffset, $RBitStream, $RBitBuffer, $RBitCount
-
-pBitStream SETS "$RBitStream"
-BitBuffer SETS "$RBitBuffer"
-BitCount SETS "$RBitCount"
-
- ;// load inputs
- LDR $pBitStream, [$ppBitStream]
- LDR $BitCount, [$pBitOffset]
- MEND
-
- MACRO
- M_BD_INIT1 $T1, $T2, $T3
- LDRB $T2, [$pBitStream, #2]
- LDRB $T1, [$pBitStream, #1]
- LDRB $BitBuffer, [$pBitStream], #3
- ADD $BitCount, $BitCount, #8
- MEND
-
- MACRO
- M_BD_INIT2 $T1, $T2, $T3
- ORR $T2, $T2, $T1, LSL #8
- ORR $BitBuffer, $T2, $BitBuffer, LSL #16
- MEND
-
- ;//
- ;// Look ahead fixed 1<=N<=8 bits without consuming any bits
- ;// The next bits will be placed at bit 31..24 of destination register
- ;//
- ;// Input Registers:
- ;//
- ;// $N - number of bits to look
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $Symbol - the next N bits of the bitstream
- ;// $T1 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_LOOK8 $Symbol, $N
- ASSERT ($N>=1):LAND:($N<=8)
- MOV $Symbol, $BitBuffer, LSL $BitCount
- MEND
-
- ;//
- ;// Look ahead fixed 1<=N<=16 bits without consuming any bits
- ;// The next bits will be placed at bit 31..16 of destination register
- ;//
- ;// Input Registers:
- ;//
- ;// $N - number of bits to look
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $Symbol - the next N bits of the bitstream
- ;// $T1 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_LOOK16 $Symbol, $N, $T1
- ASSERT ($N >= 1):LAND:($N <= 16)
- MOV $Symbol, $BitBuffer, LSL $BitCount
- MEND
-
- ;//
- ;// Skips fixed 1<=N<=8 bits from the bitstream, advancing the bitstream pointer
- ;//
- ;// Input Registers:
- ;//
- ;// $N - number of bits
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $T1 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_SKIP8 $N, $T1
- ASSERT ($N>=1):LAND:($N<=8)
- SUBS $BitCount, $BitCount, #(8-$N)
- LDRCSB $T1, [$pBitStream], #1
- ADDCC $BitCount, $BitCount, #8
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- MEND
-
-
- ;//
- ;// Read fixed 1<=N<=8 bits from the bitstream, advancing the bitstream pointer
- ;//
- ;// Input Registers:
- ;//
- ;// $N - number of bits to read
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $Symbol - the next N bits of the bitstream
- ;// $T1 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_READ8 $Symbol, $N, $T1
- ASSERT ($N>=1):LAND:($N<=8)
- MOVS $Symbol, $BitBuffer, LSL $BitCount
- SUBS $BitCount, $BitCount, #(8-$N)
- LDRCSB $T1, [$pBitStream], #1
- ADDCC $BitCount, $BitCount, #8
- MOV $Symbol, $Symbol, LSR #(32-$N)
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- MEND
-
- ;//
- ;// Read fixed 1<=N<=16 bits from the bitstream, advancing the bitstream pointer
- ;//
- ;// Input Registers:
- ;//
- ;// $N - number of bits to read
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $Symbol - the next N bits of the bitstream
- ;// $T1 - corrupted temp/scratch register
- ;// $T2 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_READ16 $Symbol, $N, $T1, $T2
- ASSERT ($N>=1):LAND:($N<=16)
- ASSERT $Symbol<>$T1
- IF ($N<=8)
- M_BD_READ8 $Symbol, $N, $T1
- ELSE
- ;// N>8 so we will be able to refill at least one byte
- LDRB $T1, [$pBitStream], #1
- MOVS $Symbol, $BitBuffer, LSL $BitCount
- ORR $BitBuffer, $T1, $BitBuffer, LSL #8
- SUBS $BitCount, $BitCount, #(16-$N)
- LDRCSB $T1, [$pBitStream], #1
- MOV $Symbol, $Symbol, LSR #(32-$N)
- ADDCC $BitCount, $BitCount, #8
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- ENDIF
- MEND
-
- ;//
- ;// Skip variable 1<=N<=8 bits from the bitstream, advancing the bitstream pointer.
- ;//
- ;// Input Registers:
- ;//
- ;// $N - number of bits. 1<=N<=8
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $T1 - corrupted temp/scratch register
- ;// $T2 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_VSKIP8 $N, $T1
- ADD $BitCount, $BitCount, $N
- SUBS $BitCount, $BitCount, #8
- LDRCSB $T1, [$pBitStream], #1
- ADDCC $BitCount, $BitCount, #8
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- MEND
-
- ;//
- ;// Skip variable 1<=N<=16 bits from the bitstream, advancing the bitstream pointer.
- ;//
- ;// Input Registers:
- ;//
- ;// $N - number of bits. 1<=N<=16
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $T1 - corrupted temp/scratch register
- ;// $T2 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_VSKIP16 $N, $T1, $T2
- ADD $BitCount, $BitCount, $N
- SUBS $BitCount, $BitCount, #8
- LDRCSB $T1, [$pBitStream], #1
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- SUBCSS $BitCount, $BitCount, #8
- LDRCSB $T1, [$pBitStream], #1
- ADDCC $BitCount, $BitCount, #8
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- MEND
-
- ;//
- ;// Read variable 1<=N<=8 bits from the bitstream, advancing the bitstream pointer.
- ;//
- ;// Input Registers:
- ;//
- ;// $N - number of bits to read. 1<=N<=8
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $Symbol - the next N bits of the bitstream
- ;// $T1 - corrupted temp/scratch register
- ;// $T2 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_VREAD8 $Symbol, $N, $T1, $T2
- MOV $Symbol, $BitBuffer, LSL $BitCount
- ADD $BitCount, $BitCount, $N
- SUBS $BitCount, $BitCount, #8
- LDRCSB $T1, [$pBitStream], #1
- RSB $T2, $N, #32
- ADDCC $BitCount, $BitCount, #8
- MOV $Symbol, $Symbol, LSR $T2
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- MEND
-
-
- ;//
- ;// Read variable 1<=N<=16 bits from the bitstream, advancing the bitstream pointer.
- ;//
- ;// Input Registers:
- ;//
- ;// $N - number of bits to read. 1<=N<=16
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $Symbol - the next N bits of the bitstream
- ;// $T1 - corrupted temp/scratch register
- ;// $T2 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_VREAD16 $Symbol, $N, $T1, $T2
- MOV $Symbol, $BitBuffer, LSL $BitCount
- ADD $BitCount, $BitCount, $N
- SUBS $BitCount, $BitCount, #8
- LDRCSB $T1, [$pBitStream], #1
- RSB $T2, $N, #32
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- SUBCSS $BitCount, $BitCount, #8
- LDRCSB $T1, [$pBitStream], #1
- ADDCC $BitCount, $BitCount, #8
- MOV $Symbol, $Symbol, LSR $T2
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- MEND
-
-
- ;//
- ;// Decode a code of the form 0000...001 where there
- ;// are N zeros before the 1 and N<=15 (code length<=16)
- ;//
- ;// Input Registers:
- ;//
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $Symbol - the number of zeros before the next 1
- ;// >=16 is an illegal code
- ;// $T1 - corrupted temp/scratch register
- ;// $T2 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_CLZ16 $Symbol, $T1, $T2
- MOVS $Symbol, $BitBuffer, LSL $BitCount
- CLZ $Symbol, $Symbol
- ADD $BitCount, $BitCount, $Symbol
- SUBS $BitCount, $BitCount, #7 ;// length is Symbol+1
- LDRCSB $T1, [$pBitStream], #1
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- SUBCSS $BitCount, $BitCount, #8
- LDRCSB $T1, [$pBitStream], #1
- ADDCC $BitCount, $BitCount, #8
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- MEND
-
- ;//
- ;// Decode a code of the form 1111...110 where there
- ;// are N ones before the 0 and N<=15 (code length<=16)
- ;//
- ;// Input Registers:
- ;//
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $Symbol - the number of zeros before the next 1
- ;// >=16 is an illegal code
- ;// $T1 - corrupted temp/scratch register
- ;// $T2 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_CLO16 $Symbol, $T1, $T2
- MOV $Symbol, $BitBuffer, LSL $BitCount
- MVN $Symbol, $Symbol
- CLZ $Symbol, $Symbol
- ADD $BitCount, $BitCount, $Symbol
- SUBS $BitCount, $BitCount, #7 ;// length is Symbol+1
- LDRCSB $T1, [$pBitStream], #1
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- SUBCSS $BitCount, $BitCount, #8
- LDRCSB $T1, [$pBitStream], #1
- ADDCC $BitCount, $BitCount, #8
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8
- MEND
-
-
- ;//
- ;// Variable Length Decode module
- ;//
- ;// Decodes one VLD Symbol from a bitstream and refill the bitstream
- ;// buffer.
- ;//
- ;// Input Registers:
- ;//
- ;// $pVLDTable - pointer to VLD decode table of 16-bit entries.
- ;// The format is described above at the start of
- ;// this file.
- ;// $S0 - The number of bits to look up for the first step
- ;// 1<=$S0<=8
- ;// $S1 - The number of bits to look up for each subsequent
- ;// step 1<=$S1<=$S0.
- ;//
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $Symbol - decoded VLD symbol value
- ;// $T1 - corrupted temp/scratch register
- ;// $T2 - corrupted temp/scratch register
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_VLD $Symbol, $T1, $T2, $pVLDTable, $S0, $S1
- ASSERT (1<=$S0):LAND:($S0<=8)
- ASSERT (1<=$S1):LAND:($S1<=$S0)
-
- ;// Note 0<=BitCount<=15 on entry and exit
-
- MOVS $T1, $BitBuffer, LSL $BitCount ;// left align next bits
- MOVS $Symbol, #(2<<$S0)-2 ;// create mask
- AND $Symbol, $Symbol, $T1, LSR #(31-$S0) ;// 2*(next $S0 bits)
- SUBS $BitCount, $BitCount, #8 ;// CS if buffer can be filled
-01
- LDRCSB $T1, [$pBitStream], #1 ;// load refill byte
- LDRH $Symbol, [$pVLDTable, $Symbol] ;// load table entry
- ADDCC $BitCount, $BitCount, #8 ;// refill not possible
- ADD $BitCount, $BitCount, #$S0 ;// assume $S0 bits used
- ORRCS $BitBuffer, $T1, $BitBuffer, LSL #8 ;// merge in refill byte
- MOVS $T1, $Symbol, LSR #1 ;// CS=leaf entry
- BCS %FT02
-
- MOVS $T1, $BitBuffer, LSL $BitCount ;// left align next bit
- IF (2*$S0-$S1<=8)
- ;// Can combine refill check and -S0+S1 and keep $BitCount<=15
- SUBS $BitCount, $BitCount, #8+($S0-$S1)
- ELSE
- ;// Separate refill check and -S0+S1 offset
- SUBS $BitCount, $BitCount, #8
- SUB $BitCount, $BitCount, #($S0-$S1)
- ENDIF
- ADD $Symbol, $Symbol, $T1, LSR #(31-$S1) ;// add 2*(next $S1 bits) to
- BIC $Symbol, $Symbol, #1 ;// table offset
- B %BT01 ;// load next table entry
-02
- ;// BitCount range now depend on the route here
- ;// if (first step) S0 <= BitCount <= 7+S0 <=15
- ;// else if (2*S0-S1<=8) S0 <= BitCount <= 7+(2*S0-S1) <=15
- ;// else S1 <= BitCount <= 7+S1 <=15
-
- SUB $BitCount, $BitCount, $Symbol, LSR#13
- BIC $Symbol, $T1, #0xF000
- MEND
-
-
- ;// Add an offset number of bits
- ;//
- ;// Outputs destination byte and bit index values which corresponds to an offset number of bits
- ;// from the current location. This is used to compare bitstream positions using. M_BD_CMP.
- ;//
- ;// Input Registers:
- ;//
- ;// $Offset - Offset to be added in bits.
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $ByteIndex - Destination pBitStream pointer after adding the Offset.
- ;// This value will be 4 byte ahead and needs to subtract by 4 to get exact
- ;// pointer (as in M_BD_FINI). But for using with M_BD_CMP subtract is not needed.
- ;// $BitIndex - Destination BitCount after the addition of Offset number of bits
- ;//
- MACRO
- M_BD_ADD $ByteIndex, $BitIndex, $Offset
-
- ;// ($ByteIndex,$BitIndex) = Current position + $Offset bits
- ADD $Offset, $Offset, $BitCount
- AND $BitIndex, $Offset, #7
- ADD $ByteIndex, $pBitStream, $Offset, ASR #3
- MEND
-
- ;// Move bitstream pointers to the location given
- ;//
- ;// Outputs destination byte and bit index values which corresponds to
- ;// the current location given (calculated using M_BD_ADD).
- ;//
- ;// Input Registers:
- ;//
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;// $ByteIndex - Destination pBitStream pointer after move.
- ;// This value will be 4 byte ahead and needs to subtract by 4 to get exact
- ;// pointer (as in M_BD_FINI).
- ;// $BitIndex - Destination BitCount after the move
- ;//
- ;// Output Registers:
- ;//
- ;// $pBitStream \
- ;// } See description above.
- ;// $BitCount /
- ;//
- MACRO
- M_BD_MOV $ByteIndex, $BitIndex
-
- ;// ($pBitStream, $Offset) = ($ByteIndex,$BitIndex)
- MOV $BitCount, $BitIndex
- MOV $pBitStream, $ByteIndex
- MEND
-
- ;// Bitstream Compare
- ;//
- ;// Compares bitstream position with that of a destination position. Destination position
- ;// is held in two input registers which are calculated using M_BD_ADD macro
- ;//
- ;// Input Registers:
- ;//
- ;// $ByteIndex - Destination pBitStream pointer, (4 byte ahead as described in M_BD_ADD)
- ;// $BitIndex - Destination BitCount
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// FLAGS - GE if destination is reached, LT = is destination is ahead
- ;// $T1 - corrupted temp/scratch register
- ;//
- MACRO
- M_BD_CMP $ByteIndex, $BitIndex, $T1
-
- ;// Return flags set by (current positon)-($ByteIndex,$BitIndex)
- ;// so GE means that we have reached the indicated position
-
- ADD $T1, $pBitStream, $BitCount, LSR #3
- CMP $T1, $ByteIndex
- AND $T1, $BitCount, #7
- CMPEQ $T1, $BitIndex
- MEND
-
-
- ;// Bitstream Decode finalise
- ;//
- ;// Writes back the bitstream state to the bitstream pointers
- ;//
- ;// Input Registers:
- ;//
- ;// $pBitStream \
- ;// $BitBuffer } See description above.
- ;// $BitCount /
- ;//
- ;// Output Registers:
- ;//
- ;// $ppBitStream - pointer to pointer to the next bitstream byte
- ;// $pBitOffset - pointer to the number of bits used in the current byte (0..7)
- ;// $pBitStream \
- ;// $BitBuffer } these register are corrupted
- ;// $BitCount /
- ;//
- MACRO
- M_BD_FINI $ppBitStream, $pBitOffset
-
- ;// Advance pointer by the number of free bits in the buffer
- ADD $pBitStream, $pBitStream, $BitCount, LSR#3
- AND $BitCount, $BitCount, #7
-
- ;// Now move back 32 bits to reach the first usued bit
- SUB $pBitStream, $pBitStream, #4
-
- ;// Store out bitstream state
- STR $BitCount, [$pBitOffset]
- STR $pBitStream, [$ppBitStream]
- MEND
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_Bitstream.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_Bitstream.h
deleted file mode 100644
index 8c0ef37..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_Bitstream.h
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armCOMM_Bitstream.h
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- * File: armCOMM_Bitstream.h
- * Brief: Declares common API's/Data types used across the OpenMax Encoders/Decoders.
- *
- */
-
-#ifndef _armCodec_H_
-#define _armCodec_H_
-
-#include "omxtypes.h"
-
-typedef struct {
- OMX_U8 codeLen;
- OMX_U32 codeWord;
-} ARM_VLC32;
-
-/* The above should be renamed as "ARM_VLC32" */
-
-/**
- * Function: armLookAheadBits()
- *
- * Description:
- * Get the next N bits from the bitstream without advancing the bitstream pointer
- *
- * Parameters:
- * [in] **ppBitStream
- * [in] *pOffset
- * [in] N=1...32
- *
- * Returns Value
- */
-
-OMX_U32 armLookAheadBits(const OMX_U8 **ppBitStream, OMX_INT *pOffset, OMX_INT N);
-
-/**
- * Function: armGetBits()
- *
- * Description:
- * Read N bits from the bitstream
- *
- * Parameters:
- * [in] *ppBitStream
- * [in] *pOffset
- * [in] N=1..32
- *
- * [out] *ppBitStream
- * [out] *pOffset
- * Returns Value
- */
-
-OMX_U32 armGetBits(const OMX_U8 **ppBitStream, OMX_INT *pOffset, OMX_INT N);
-
-/**
- * Function: armByteAlign()
- *
- * Description:
- * Align the pointer *ppBitStream to the next byte boundary
- *
- * Parameters:
- * [in] *ppBitStream
- * [in] *pOffset
- *
- * [out] *ppBitStream
- * [out] *pOffset
- *
- **/
-
-OMXVoid armByteAlign(const OMX_U8 **ppBitStream,OMX_INT *pOffset);
-
-/**
- * Function: armSkipBits()
- *
- * Description:
- * Skip N bits from the value at *ppBitStream
- *
- * Parameters:
- * [in] *ppBitStream
- * [in] *pOffset
- * [in] N
- *
- * [out] *ppBitStream
- * [out] *pOffset
- *
- **/
-
-OMXVoid armSkipBits(const OMX_U8 **ppBitStream,OMX_INT *pOffset,OMX_INT N);
-
-/***************************************
- * Variable bit length Decode
- ***************************************/
-
-/**
- * Function: armUnPackVLC32()
- *
- * Description:
- * Variable length decode of variable length symbol (max size 32 bits) read from
- * the bit stream pointed by *ppBitStream at *pOffset by using the table
- * pointed by pCodeBook
- *
- * Parameters:
- * [in] **ppBitStream
- * [in] *pOffset
- * [in] pCodeBook
- *
- * [out] **ppBitStream
- * [out] *pOffset
- *
- * Returns : Code Book Index if successfull.
- * : "ARM_NO_CODEBOOK_INDEX = 0xFFFF" if search fails.
- **/
-
-#define ARM_NO_CODEBOOK_INDEX (OMX_U16)(0xFFFF)
-
-OMX_U16 armUnPackVLC32(
- const OMX_U8 **ppBitStream,
- OMX_INT *pOffset,
- const ARM_VLC32 *pCodeBook
-);
-
-/***************************************
- * Fixed bit length Encode
- ***************************************/
-
-/**
- * Function: armPackBits
- *
- * Description:
- * Pack a VLC code word into the bitstream
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte
- * in the bit stream.
- * [in] pOffset pointer to the bit position in the byte
- * pointed by *ppBitStream. Valid within 0
- * to 7.
- * [in] codeWord Code word that need to be inserted in to the
- * bitstream
- * [in] codeLength Length of the code word valid range 1...32
- *
- * [out] ppBitStream *ppBitStream is updated after the block is encoded,
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMX_RESULT result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armPackBits (
- OMX_U8 **ppBitStream,
- OMX_INT *pOffset,
- OMX_U32 codeWord,
- OMX_INT codeLength
-);
-
-/***************************************
- * Variable bit length Encode
- ***************************************/
-
-/**
- * Function: armPackVLC32
- *
- * Description:
- * Pack a VLC code word into the bitstream
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte
- * in the bit stream.
- * [in] pBitOffset pointer to the bit position in the byte
- * pointed by *ppBitStream. Valid within 0
- * to 7.
- * [in] code VLC code word that need to be inserted in to the
- * bitstream
- *
- * [out] ppBitStream *ppBitStream is updated after the block is encoded,
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMX_RESULT result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armPackVLC32 (
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- ARM_VLC32 code
-);
-
-#endif /*_armCodec_H_*/
-
-/*End of File*/
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_IDCTTable.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_IDCTTable.h
deleted file mode 100644
index d761f61..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_IDCTTable.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- *
- * File Name: armCOMM_IDCTTable.h
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- * File : armCOMM_IDCTTable.h
- * Description : Contains declarations of tables for IDCT calculation.
- *
- */
-
-#ifndef _armCOMM_IDCTTable_H_
-#define _armCOMM_IDCTTable_H_
-
-#include "omxtypes.h"
-
- /* Table of s(u)*A(u)*A(v)/16 at Q15
- * s(u)=1.0 0 <= u <= 5
- * s(6)=2.0
- * s(7)=4.0
- * A(0) = 2*sqrt(2)
- * A(u) = 4*cos(u*pi/16) for (u!=0)
- */
-extern const OMX_U16 armCOMM_IDCTPreScale [64];
-extern const OMX_U16 armCOMM_IDCTCoef [4];
-
-#endif /* _armCOMM_IDCTTable_H_ */
-
-
-/* End of File */
-
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_IDCT_s.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_IDCT_s.h
deleted file mode 100644
index 9130223..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_IDCT_s.h
+++ /dev/null
@@ -1,1459 +0,0 @@
-;//
-;// Copyright (C) 2004 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// IDCT_s.s
-;//
-;// Inverse DCT module
-;//
-;//
-;// ALGORITHM DESCRIPTION
-;//
-;// The 8x8 2D IDCT is performed by calculating a 1D IDCT for each
-;// column and then a 1D IDCT for each row.
-;//
-;// The 8-point 1D IDCT is defined by
-;// f(x) = (C(0)*T(0)*c(0,x) + ... + C(7)*T(7)*c(7,x))/2
-;//
-;// C(u) = 1/sqrt(2) if u=0 or 1 if u!=0
-;// c(u,x) = cos( (2x+1)*u*pi/16 )
-;//
-;// We compute the 8-point 1D IDCT using the reverse of
-;// the Arai-Agui-Nakajima flow graph which we split into
-;// 5 stages named in reverse order to identify with the
-;// forward DCT. Direct inversion of the forward formulae
-;// in file FDCT_s.s gives:
-;//
-;// IStage 5: j(u) = T(u)*A(u) [ A(u)=4*C(u)*c(u,0) ]
-;// [ A(0) = 2*sqrt(2)
-;// A(u) = 4*cos(u*pi/16) for (u!=0) ]
-;//
-;// IStage 4: i0 = j0 i1 = j4
-;// i3 = (j2+j6)/2 i2 = (j2-j6)/2
-;// i7 = (j5+j3)/2 i4 = (j5-j3)/2
-;// i5 = (j1+j7)/2 i6 = (j1-j7)/2
-;//
-;// IStage 3: h0 = (i0+i1)/2 h1 = (i0-i1)/2
-;// h2 = (i2*sqrt2)-i3 h3 = i3
-;// h4 = cos(pi/8)*i4 + sin(pi/8)*i6
-;// h6 = -sin(pi/8)*i4 + cos(pi/8)*i6
-;// [ The above two lines rotate by -(pi/8) ]
-;// h5 = (i5-i7)/sqrt2 h7 = (i5+i7)/2
-;//
-;// IStage 2: g0 = (h0+h3)/2 g3 = (h0-h3)/2
-;// g1 = (h1+h2)/2 g2 = (h1-h2)/2
-;// g7 = h7 g6 = h6 - h7
-;// g5 = h5 - g6 g4 = h4 - g5
-;//
-;// IStage 1: f0 = (g0+g7)/2 f7 = (g0-g7)/2
-;// f1 = (g1+g6)/2 f6 = (g1-g6)/2
-;// f2 = (g2+g5)/2 f5 = (g2-g5)/2
-;// f3 = (g3+g4)/2 f4 = (g3-g4)/2
-;//
-;// Note that most coefficients are halved 3 times during the
-;// above calculation. We can rescale the algorithm dividing
-;// the input by 8 to remove the halvings.
-;//
-;// IStage 5: j(u) = T(u)*A(u)/8
-;//
-;// IStage 4: i0 = j0 i1 = j4
-;// i3 = j2 + j6 i2 = j2 - j6
-;// i7 = j5 + j3 i4 = j5 - j3
-;// i5 = j1 + j7 i6 = j1 - j7
-;//
-;// IStage 3: h0 = i0 + i1 h1 = i0 - i1
-;// h2 = (i2*sqrt2)-i3 h3 = i3
-;// h4 = 2*( cos(pi/8)*i4 + sin(pi/8)*i6)
-;// h6 = 2*(-sin(pi/8)*i4 + cos(pi/8)*i6)
-;// h5 = (i5-i7)*sqrt2 h7 = i5 + i7
-;//
-;// IStage 2: g0 = h0 + h3 g3 = h0 - h3
-;// g1 = h1 + h2 g2 = h1 - h2
-;// g7 = h7 g6 = h6 - h7
-;// g5 = h5 - g6 g4 = h4 - g5
-;//
-;// IStage 1: f0 = g0 + g7 f7 = g0 - g7
-;// f1 = g1 + g6 f6 = g1 - g6
-;// f2 = g2 + g5 f5 = g2 - g5
-;// f3 = g3 + g4 f4 = g3 - g4
-;//
-;// Note:
-;// 1. The scaling by A(u)/8 can often be combined with inverse
-;// quantization. The column and row scalings can be combined.
-;// 2. The flowgraph in the AAN paper has h4,g6 negated compared
-;// to the above code but is otherwise identical.
-;// 3. The rotation by -pi/8 can be peformed using three multiplies
-;// Eg c*i4+s*i6 = (i6-i4)*s + (c+s)*i4
-;// -s*i4+c*i6 = (i6-i4)*s + (c-s)*i6
-;// 4. If |T(u)|<=1 then from the IDCT definition,
-;// |f(x)| <= ((1/sqrt2) + |c(1,x)| + .. + |c(7,x)|)/2
-;// = ((1/sqrt2) + cos(pi/16) + ... + cos(7*pi/16))/2
-;// = ((1/sqrt2) + (cot(pi/32)-1)/2)/2
-;// = (1 + cos(pi/16) + cos(2pi/16) + cos(3pi/16))/sqrt(2)
-;// = (approx)2.64
-;// So the max gain of the 2D IDCT is ~x7.0 = 3 bits.
-;// The table below shows input patterns generating the maximum
-;// value of |f(u)| for input in the range |T(x)|<=1. M=-1, P=+1
-;// InputPattern Max |f(x)|
-;// PPPPPPPP |f0| = 2.64
-;// PPPMMMMM |f1| = 2.64
-;// PPMMMPPP |f2| = 2.64
-;// PPMMPPMM |f3| = 2.64
-;// PMMPPMMP |f4| = 2.64
-;// PMMPMMPM |f5| = 2.64
-;// PMPPMPMP |f6| = 2.64
-;// PMPMPMPM |f7| = 2.64
-;// Note that this input pattern is the transpose of the
-;// corresponding max input patter for the FDCT.
-
-;// Arguments
-
-pSrc RN 0 ;// source data buffer
-Stride RN 1 ;// destination stride in bytes
-pDest RN 2 ;// destination data buffer
-pScale RN 3 ;// pointer to scaling table
-
-
- ;// DCT Inverse Macro
- ;// The DCT code should be parametrized according
- ;// to the following inputs:
- ;// $outsize = "u8" : 8-bit unsigned data saturated (0 to +255)
- ;// "s9" : 16-bit signed data saturated to 9-bit (-256 to +255)
- ;// "s16" : 16-bit signed data not saturated (max size ~+/-14273)
- ;// $inscale = "s16" : signed 16-bit aan-scale table, Q15 format, with 4 byte alignment
- ;// "s32" : signed 32-bit aan-scale table, Q23 format, with 4 byte alignment
- ;//
- ;// Inputs:
- ;// pSrc = r0 = Pointer to input data
- ;// Range is -256 to +255 (9-bit)
- ;// Stride = r1 = Stride between input lines
- ;// pDest = r2 = Pointer to output data
- ;// pScale = r3 = Pointer to aan-scale table in the format defined by $inscale
-
-
-
- MACRO
- M_IDCT $outsize, $inscale, $stride
- LCLA SHIFT
-
-
- IF ARM1136JS
-
-;// REGISTER ALLOCATION
-;// This is hard since we have 8 values, 9 free registers and each
-;// butterfly requires a temporary register. We also want to
-;// maintain register order so we can use LDM/STM. The table below
-;// summarises the register allocation that meets all these criteria.
-;// a=1stcol, b=2ndcol, f,g,h,i are dataflow points described above.
-;//
-;// r1 a01 g0 h0
-;// r4 b01 f0 g1 h1 i0
-;// r5 a23 f1 g2 i1
-;// r6 b23 f2 g3 h2 i2
-;// r7 a45 f3 h3 i3
-;// r8 b45 f4 g4 h4 i4
-;// r9 a67 f5 g5 h5 i5
-;// r10 b67 f6 g6 h6 i6
-;// r11 f7 g7 h7 i7
-;//
-ra01 RN 1
-rb01 RN 4
-ra23 RN 5
-rb23 RN 6
-ra45 RN 7
-rb45 RN 8
-ra67 RN 9
-rb67 RN 10
-rtmp RN 11
-csPiBy8 RN 12 ;// [ (Sin(pi/8)@Q15), (Cos(pi/8)@Q15) ]
-LoopRR2 RN 14 ;// [ LoopNumber<<13 , (1/Sqrt(2))@Q15 ]
-;// Transpose allocation
-xft RN ra01
-xf0 RN rb01
-xf1 RN ra23
-xf2 RN rb23
-xf3 RN ra45
-xf4 RN rb45
-xf5 RN ra67
-xf6 RN rb67
-xf7 RN rtmp
-;// IStage 1 allocation
-xg0 RN xft
-xg1 RN xf0
-xg2 RN xf1
-xg3 RN xf2
-xgt RN xf3
-xg4 RN xf4
-xg5 RN xf5
-xg6 RN xf6
-xg7 RN xf7
-;// IStage 2 allocation
-xh0 RN xg0
-xh1 RN xg1
-xht RN xg2
-xh2 RN xg3
-xh3 RN xgt
-xh4 RN xg4
-xh5 RN xg5
-xh6 RN xg6
-xh7 RN xg7
-;// IStage 3,4 allocation
-xit RN xh0
-xi0 RN xh1
-xi1 RN xht
-xi2 RN xh2
-xi3 RN xh3
-xi4 RN xh4
-xi5 RN xh5
-xi6 RN xh6
-xi7 RN xh7
-
- M_STR pDest, ppDest
- IF "$stride"="s"
- M_STR Stride, pStride
- ENDIF
- M_ADR pDest, pBlk
- LDR csPiBy8, =0x30fc7642
- LDR LoopRR2, =0x00005a82
-
-v6_idct_col$_F
- ;// Load even values
- LDR xi4, [pSrc], #4 ;// j0
- LDR xi5, [pSrc, #4*16-4] ;// j4
- LDR xi6, [pSrc, #2*16-4] ;// j2
- LDR xi7, [pSrc, #6*16-4] ;// j6
-
- ;// Scale Even Values
- IF "$inscale"="s16" ;// 16x16 mul
-SHIFT SETA 12
- LDR xi0, [pScale], #4
- LDR xi1, [pScale, #4*16-4]
- LDR xi2, [pScale, #2*16-4]
- MOV xit, #1<<(SHIFT-1)
- SMLABB xi3, xi0, xi4, xit
- SMLATT xi4, xi0, xi4, xit
- SMLABB xi0, xi1, xi5, xit
- SMLATT xi5, xi1, xi5, xit
- MOV xi3, xi3, ASR #SHIFT
- PKHBT xi4, xi3, xi4, LSL #(16-SHIFT)
- LDR xi3, [pScale, #6*16-4]
- SMLABB xi1, xi2, xi6, xit
- SMLATT xi6, xi2, xi6, xit
- MOV xi0, xi0, ASR #SHIFT
- PKHBT xi5, xi0, xi5, LSL #(16-SHIFT)
- SMLABB xi2, xi3, xi7, xit
- SMLATT xi7, xi3, xi7, xit
- MOV xi1, xi1, ASR #SHIFT
- PKHBT xi6, xi1, xi6, LSL #(16-SHIFT)
- MOV xi2, xi2, ASR #SHIFT
- PKHBT xi7, xi2, xi7, LSL #(16-SHIFT)
- ENDIF
- IF "$inscale"="s32" ;// 32x16 mul
-SHIFT SETA (12+8-16)
- MOV xit, #1<<(SHIFT-1)
- LDR xi0, [pScale], #8
- LDR xi1, [pScale, #0*32+4-8]
- LDR xi2, [pScale, #4*32-8]
- LDR xi3, [pScale, #4*32+4-8]
- SMLAWB xi0, xi0, xi4, xit
- SMLAWT xi1, xi1, xi4, xit
- SMLAWB xi2, xi2, xi5, xit
- SMLAWT xi3, xi3, xi5, xit
- MOV xi0, xi0, ASR #SHIFT
- PKHBT xi4, xi0, xi1, LSL #(16-SHIFT)
- MOV xi2, xi2, ASR #SHIFT
- PKHBT xi5, xi2, xi3, LSL #(16-SHIFT)
- LDR xi0, [pScale, #2*32-8]
- LDR xi1, [pScale, #2*32+4-8]
- LDR xi2, [pScale, #6*32-8]
- LDR xi3, [pScale, #6*32+4-8]
- SMLAWB xi0, xi0, xi6, xit
- SMLAWT xi1, xi1, xi6, xit
- SMLAWB xi2, xi2, xi7, xit
- SMLAWT xi3, xi3, xi7, xit
- MOV xi0, xi0, ASR #SHIFT
- PKHBT xi6, xi0, xi1, LSL #(16-SHIFT)
- MOV xi2, xi2, ASR #SHIFT
- PKHBT xi7, xi2, xi3, LSL #(16-SHIFT)
- ENDIF
-
- ;// Load odd values
- LDR xi0, [pSrc, #1*16-4] ;// j1
- LDR xi1, [pSrc, #7*16-4] ;// j7
- LDR xi2, [pSrc, #5*16-4] ;// j5
- LDR xi3, [pSrc, #3*16-4] ;// j3
-
- IF {TRUE}
- ;// shortcut if odd values 0
- TEQ xi0, #0
- TEQEQ xi1, #0
- TEQEQ xi2, #0
- TEQEQ xi3, #0
- BEQ v6OddZero$_F
- ENDIF
-
- ;// Store scaled even values
- STMIA pDest, {xi4, xi5, xi6, xi7}
-
- ;// Scale odd values
- IF "$inscale"="s16"
- ;// Perform AAN Scale
- LDR xi4, [pScale, #1*16-4]
- LDR xi5, [pScale, #7*16-4]
- LDR xi6, [pScale, #5*16-4]
- SMLABB xi7, xi0, xi4, xit
- SMLATT xi0, xi0, xi4, xit
- SMLABB xi4, xi1, xi5, xit
- SMLATT xi1, xi1, xi5, xit
- MOV xi7, xi7, ASR #SHIFT
- PKHBT xi0, xi7, xi0, LSL #(16-SHIFT)
- LDR xi7, [pScale, #3*16-4]
- SMLABB xi5, xi2, xi6, xit
- SMLATT xi2, xi2, xi6, xit
- MOV xi4, xi4, ASR #SHIFT
- PKHBT xi1, xi4, xi1, LSL #(16-SHIFT)
- SMLABB xi6, xi3, xi7, xit
- SMLATT xi3, xi3, xi7, xit
- MOV xi5, xi5, ASR #SHIFT
- PKHBT xi2, xi5, xi2, LSL #(16-SHIFT)
- MOV xi6, xi6, ASR #SHIFT
- PKHBT xi3, xi6, xi3, LSL #(16-SHIFT)
- ENDIF
- IF "$inscale"="s32" ;// 32x16 mul
- LDR xi4, [pScale, #1*32-8]
- LDR xi5, [pScale, #1*32+4-8]
- LDR xi6, [pScale, #7*32-8]
- LDR xi7, [pScale, #7*32+4-8]
- SMLAWB xi4, xi4, xi0, xit
- SMLAWT xi5, xi5, xi0, xit
- SMLAWB xi6, xi6, xi1, xit
- SMLAWT xi7, xi7, xi1, xit
- MOV xi4, xi4, ASR #SHIFT
- PKHBT xi0, xi4, xi5, LSL #(16-SHIFT)
- MOV xi6, xi6, ASR #SHIFT
- PKHBT xi1, xi6, xi7, LSL #(16-SHIFT)
- LDR xi4, [pScale, #5*32-8]
- LDR xi5, [pScale, #5*32+4-8]
- LDR xi6, [pScale, #3*32-8]
- LDR xi7, [pScale, #3*32+4-8]
- SMLAWB xi4, xi4, xi2, xit
- SMLAWT xi5, xi5, xi2, xit
- SMLAWB xi6, xi6, xi3, xit
- SMLAWT xi7, xi7, xi3, xit
- MOV xi4, xi4, ASR #SHIFT
- PKHBT xi2, xi4, xi5, LSL #(16-SHIFT)
- MOV xi6, xi6, ASR #SHIFT
- PKHBT xi3, xi6, xi7, LSL #(16-SHIFT)
- ENDIF
-
- LDR xit, =0x00010001 ;// rounding constant
- SADD16 xi5, xi0, xi1 ;// (j1+j7)/2
- SHADD16 xi5, xi5, xit
-
- SSUB16 xi6, xi0, xi1 ;// j1-j7
- SADD16 xi7, xi2, xi3 ;// (j5+j3)/2
- SHADD16 xi7, xi7, xit
-
- SSUB16 xi4, xi2, xi3 ;// j5-j3
-
- SSUB16 xi3, xi5, xi7 ;// (i5-i7)/2
-
- PKHBT xi0, xi6, xi4, LSL#16 ;// [i4,i6] row a
- PKHTB xi1, xi4, xi6, ASR#16 ;// [i4,i6] row b
-
- SMUADX xi2, xi0, csPiBy8 ;// rowa by [c,s]
- SMUADX xi4, xi1, csPiBy8 ;// rowb by [c,s]
- SMUSD xi0, xi0, csPiBy8 ;// rowa by [-s,c]
- SMUSD xi6, xi1, csPiBy8 ;// rowb by [-s,c]
-
- SMULBB xi1, xi3, LoopRR2
- SMULTB xi3, xi3, LoopRR2
-
- PKHTB xh4, xi4, xi2, ASR#16 ;// h4/4
- PKHTB xh6, xi6, xi0, ASR#16 ;// h6/4
- SHADD16 xh7, xi5, xi7 ;// (i5+i7)/4
-
- ;// xi0,xi1,xi2,xi3 now free
- ;// IStage 4,3, rows 2to3 x1/2
-
- MOV xi3, xi3, LSL #1
- PKHTB xh5, xi3, xi1, ASR#15 ;// h5/4
- LDRD xi0, [pDest, #8] ;// j2,j6 scaled
-
- ;// IStage 2, rows4to7
- SSUB16 xg6, xh6, xh7
- SSUB16 xg5, xh5, xg6
- SSUB16 xg4, xh4, xg5
-
- SSUB16 xi2, xi0, xi1 ;// (j2-j6)
-
- SHADD16 xi3, xi0, xi1 ;// (j2+j6)/2
-
- SMULBB xi0, xi2, LoopRR2
- SMULTB xi2, xi2, LoopRR2
-
- MOV xi2, xi2, LSL #1
- PKHTB xh2, xi2, xi0, ASR#15 ;// i2*sqrt(2)/4
-
- ;// xi0, xi1 now free
- ;// IStage 4,3 rows 0to1 x 1/2
- LDRD xi0, [pDest] ;// j0, j4 scaled
- SSUB16 xh2, xh2, xi3
- ADDS LoopRR2, LoopRR2, #2<<29 ;// done two rows
-
- SHADD16 xh0, xi0, xi1
- SHSUB16 xh1, xi0, xi1
-
- ;// IStage 2 rows 0to3 x 1/2
- SHSUB16 xg2, xh1, xh2
- SHADD16 xg1, xh1, xh2
- SHSUB16 xg3, xh0, xh3
- SHADD16 xg0, xh0, xh3
-
- ;// IStage 1 all rows
- SADD16 xf3, xg3, xg4
- SSUB16 xf4, xg3, xg4
- SADD16 xf2, xg2, xg5
- SSUB16 xf5, xg2, xg5
- SADD16 xf1, xg1, xg6
- SSUB16 xf6, xg1, xg6
- SADD16 xf0, xg0, xg7
- SSUB16 xf7, xg0, xg7
-
- ;// Transpose, store and loop
- PKHBT ra01, xf0, xf1, LSL #16
- PKHTB rb01, xf1, xf0, ASR #16
-
- PKHBT ra23, xf2, xf3, LSL #16
- PKHTB rb23, xf3, xf2, ASR #16
-
- PKHBT ra45, xf4, xf5, LSL #16
- PKHTB rb45, xf5, xf4, ASR #16
-
- PKHBT ra67, xf6, xf7, LSL #16
- STMIA pDest!, {ra01, ra23, ra45, ra67}
- PKHTB rb67, xf7, xf6, ASR #16
- STMIA pDest!, {rb01, rb23, rb45, rb67}
- BCC v6_idct_col$_F
-
- SUB pSrc, pDest, #(64*2)
- M_LDR pDest, ppDest
- IF "$stride"="s"
- M_LDR pScale, pStride
- ENDIF
- B v6_idct_row$_F
-
-v6OddZero$_F
- SSUB16 xi2, xi6, xi7 ;// (j2-j6)
- SHADD16 xi3, xi6, xi7 ;// (j2+j6)/2
-
- SMULBB xi0, xi2, LoopRR2
- SMULTB xi2, xi2, LoopRR2
-
- MOV xi2, xi2, LSL #1
- PKHTB xh2, xi2, xi0, ASR#15 ;// i2*sqrt(2)/4
- SSUB16 xh2, xh2, xi3
-
- ;// xi0, xi1 now free
- ;// IStage 4,3 rows 0to1 x 1/2
-
- SHADD16 xh0, xi4, xi5
- SHSUB16 xh1, xi4, xi5
-
- ;// IStage 2 rows 0to3 x 1/2
- SHSUB16 xg2, xh1, xh2
- SHADD16 xg1, xh1, xh2
- SHSUB16 xg3, xh0, xh3
- SHADD16 xg0, xh0, xh3
-
- ;// IStage 1 all rows
- MOV xf3, xg3
- MOV xf4, xg3
- MOV xf2, xg2
- MOV xf5, xg2
- MOV xf1, xg1
- MOV xf6, xg1
- MOV xf0, xg0
- MOV xf7, xg0
-
- ;// Transpose
- PKHBT ra01, xf0, xf1, LSL #16
- PKHTB rb01, xf1, xf0, ASR #16
-
- PKHBT ra23, xf2, xf3, LSL #16
- PKHTB rb23, xf3, xf2, ASR #16
-
- PKHBT ra45, xf4, xf5, LSL #16
- PKHTB rb45, xf5, xf4, ASR #16
-
- PKHBT ra67, xf6, xf7, LSL #16
- PKHTB rb67, xf7, xf6, ASR #16
-
- STMIA pDest!, {ra01, ra23, ra45, ra67}
- ADDS LoopRR2, LoopRR2, #2<<29 ;// done two rows
- STMIA pDest!, {rb01, rb23, rb45, rb67}
-
- BCC v6_idct_col$_F
- SUB pSrc, pDest, #(64*2)
- M_LDR pDest, ppDest
- IF "$stride"="s"
- M_LDR pScale, pStride
- ENDIF
-
-
-v6_idct_row$_F
- ;// IStage 4,3, rows4to7 x1/4
- LDR xit, =0x00010001 ;// rounding constant
- LDR xi0, [pSrc, #1*16] ;// j1
- LDR xi1, [pSrc, #7*16] ;// 4*j7
- LDR xi2, [pSrc, #5*16] ;// j5
- LDR xi3, [pSrc, #3*16] ;// j3
-
- SHADD16 xi1, xi1, xit ;// 2*j7
- SHADD16 xi1, xi1, xit ;// j7
-
- SHADD16 xi5, xi0, xi1 ;// (j1+j7)/2
- SSUB16 xi6, xi0, xi1 ;// j1-j7
- SHADD16 xi7, xi2, xi3 ;// (j5+j3)/2
- SSUB16 xi4, xi2, xi3 ;// j5-j3
-
- SSUB16 xi3, xi5, xi7 ;// (i5-i7)/2
-
- PKHBT xi0, xi6, xi4, LSL#16 ;// [i4,i6] row a
- PKHTB xi1, xi4, xi6, ASR#16 ;// [i4,i6] row b
-
- SMUADX xi2, xi0, csPiBy8 ;// rowa by [c,s]
- SMUADX xi4, xi1, csPiBy8 ;// rowb by [c,s]
- SMUSD xi0, xi0, csPiBy8 ;// rowa by [-s,c]
- SMUSD xi6, xi1, csPiBy8 ;// rowb by [-s,c]
-
- SMULBB xi1, xi3, LoopRR2
- SMULTB xi3, xi3, LoopRR2
-
- PKHTB xh4, xi4, xi2, ASR#16 ;// h4/4
- PKHTB xh6, xi6, xi0, ASR#16 ;// h6/4
- SHADD16 xh7, xi5, xi7 ;// (i5+i7)/4
-
- MOV xi3, xi3, LSL #1
- PKHTB xh5, xi3, xi1, ASR#15 ;// h5/4
-
- ;// xi0,xi1,xi2,xi3 now free
- ;// IStage 4,3, rows 2to3 x1/2
-
- LDR xi0, [pSrc, #2*16] ;// j2
- LDR xi1, [pSrc, #6*16] ;// 2*j6
-
- ;// IStage 2, rows4to7
- SSUB16 xg6, xh6, xh7
- SSUB16 xg5, xh5, xg6
- SSUB16 xg4, xh4, xg5
-
- SHADD16 xi1, xi1, xit ;// j6
- SSUB16 xi2, xi0, xi1 ;// (j2-j6)
- SHADD16 xi3, xi0, xi1 ;// (j2+j6)/2
-
- SMULBB xi0, xi2, LoopRR2
- SMULTB xi2, xi2, LoopRR2
-
- MOV xi2, xi2, LSL #1
-
- PKHTB xh2, xi2, xi0, ASR#15 ;// i2*sqrt(2)/4
-
- ;// xi0, xi1 now free
- ;// IStage 4,3 rows 0to1 x 1/2
- LDR xi1, [pSrc, #4*16] ;// j4
- LDR xi0, [pSrc], #4 ;// j0
-
- SSUB16 xh2, xh2, xi3
- ADDS LoopRR2, LoopRR2, #2<<29 ;// done two rows
-
- ADD xi0, xi0, xit, LSL #2 ;// ensure correct round
- SHADD16 xh0, xi0, xi1 ;// of DC result
- SHSUB16 xh1, xi0, xi1
-
- ;// IStage 2 rows 0to3 x 1/2
- SHSUB16 xg2, xh1, xh2
- SHADD16 xg1, xh1, xh2
- SHSUB16 xg3, xh0, xh3
- SHADD16 xg0, xh0, xh3
-
- ;// IStage 1 all rows
- SHADD16 xf3, xg3, xg4
- SHSUB16 xf4, xg3, xg4
- SHADD16 xf2, xg2, xg5
- SHSUB16 xf5, xg2, xg5
- SHADD16 xf1, xg1, xg6
- SHSUB16 xf6, xg1, xg6
- SHADD16 xf0, xg0, xg7
- SHSUB16 xf7, xg0, xg7
-
- ;// Saturate
- IF ("$outsize"="u8")
- USAT16 xf0, #8, xf0
- USAT16 xf1, #8, xf1
- USAT16 xf2, #8, xf2
- USAT16 xf3, #8, xf3
- USAT16 xf4, #8, xf4
- USAT16 xf5, #8, xf5
- USAT16 xf6, #8, xf6
- USAT16 xf7, #8, xf7
- ENDIF
- IF ("$outsize"="s9")
- SSAT16 xf0, #9, xf0
- SSAT16 xf1, #9, xf1
- SSAT16 xf2, #9, xf2
- SSAT16 xf3, #9, xf3
- SSAT16 xf4, #9, xf4
- SSAT16 xf5, #9, xf5
- SSAT16 xf6, #9, xf6
- SSAT16 xf7, #9, xf7
- ENDIF
-
- ;// Transpose to Row, Pack and store
- IF ("$outsize"="u8")
- ORR xf0, xf0, xf1, LSL #8 ;// [ b1 b0 a1 a0 ]
- ORR xf2, xf2, xf3, LSL #8 ;// [ b3 b2 a3 a2 ]
- ORR xf4, xf4, xf5, LSL #8 ;// [ b5 b4 a5 a4 ]
- ORR xf6, xf6, xf7, LSL #8 ;// [ b7 b6 a7 a6 ]
- PKHBT ra01, xf0, xf2, LSL #16
- PKHTB rb01, xf2, xf0, ASR #16
- PKHBT ra23, xf4, xf6, LSL #16
- PKHTB rb23, xf6, xf4, ASR #16
- STMIA pDest, {ra01, ra23}
- IF "$stride"="s"
- ADD pDest, pDest, pScale
- STMIA pDest, {rb01, rb23}
- ADD pDest, pDest, pScale
- ELSE
- ADD pDest, pDest, #($stride)
- STMIA pDest, {rb01, rb23}
- ADD pDest, pDest, #($stride)
- ENDIF
- ENDIF
- IF ("$outsize"="s9"):LOR:("$outsize"="s16")
- PKHBT ra01, xf0, xf1, LSL #16
- PKHTB rb01, xf1, xf0, ASR #16
-
- PKHBT ra23, xf2, xf3, LSL #16
- PKHTB rb23, xf3, xf2, ASR #16
-
- PKHBT ra45, xf4, xf5, LSL #16
- PKHTB rb45, xf5, xf4, ASR #16
-
- PKHBT ra67, xf6, xf7, LSL #16
- PKHTB rb67, xf7, xf6, ASR #16
-
- STMIA pDest, {ra01, ra23, ra45, ra67}
- IF "$stride"="s"
- ADD pDest, pDest, pScale
- STMIA pDest, {rb01, rb23, rb45, rb67}
- ADD pDest, pDest, pScale
- ELSE
- ADD pDest, pDest, #($stride)
- STMIA pDest, {rb01, rb23, rb45, rb67}
- ADD pDest, pDest, #($stride)
- ENDIF
- ENDIF
-
- BCC v6_idct_row$_F
- ENDIF ;// ARM1136JS
-
-
- IF CortexA8
-
-Src0 EQU 7
-Src1 EQU 8
-Src2 EQU 9
-Src3 EQU 10
-Src4 EQU 11
-Src5 EQU 12
-Src6 EQU 13
-Src7 EQU 14
-Tmp EQU 15
-
-qXj0 QN Src0.S16
-qXj1 QN Src1.S16
-qXj2 QN Src2.S16
-qXj3 QN Src3.S16
-qXj4 QN Src4.S16
-qXj5 QN Src5.S16
-qXj6 QN Src6.S16
-qXj7 QN Src7.S16
-qXjt QN Tmp.S16
-
-dXj0lo DN (Src0*2).S16
-dXj0hi DN (Src0*2+1).S16
-dXj1lo DN (Src1*2).S16
-dXj1hi DN (Src1*2+1).S16
-dXj2lo DN (Src2*2).S16
-dXj2hi DN (Src2*2+1).S16
-dXj3lo DN (Src3*2).S16
-dXj3hi DN (Src3*2+1).S16
-dXj4lo DN (Src4*2).S16
-dXj4hi DN (Src4*2+1).S16
-dXj5lo DN (Src5*2).S16
-dXj5hi DN (Src5*2+1).S16
-dXj6lo DN (Src6*2).S16
-dXj6hi DN (Src6*2+1).S16
-dXj7lo DN (Src7*2).S16
-dXj7hi DN (Src7*2+1).S16
-dXjtlo DN (Tmp*2).S16
-dXjthi DN (Tmp*2+1).S16
-
-qXi0 QN qXj0
-qXi1 QN qXj4
-qXi2 QN qXj2
-qXi3 QN qXj7
-qXi4 QN qXj5
-qXi5 QN qXjt
-qXi6 QN qXj1
-qXi7 QN qXj6
-qXit QN qXj3
-
-dXi0lo DN dXj0lo
-dXi0hi DN dXj0hi
-dXi1lo DN dXj4lo
-dXi1hi DN dXj4hi
-dXi2lo DN dXj2lo
-dXi2hi DN dXj2hi
-dXi3lo DN dXj7lo
-dXi3hi DN dXj7hi
-dXi4lo DN dXj5lo
-dXi4hi DN dXj5hi
-dXi5lo DN dXjtlo
-dXi5hi DN dXjthi
-dXi6lo DN dXj1lo
-dXi6hi DN dXj1hi
-dXi7lo DN dXj6lo
-dXi7hi DN dXj6hi
-dXitlo DN dXj3lo
-dXithi DN dXj3hi
-
-qXh0 QN qXit
-qXh1 QN qXi0
-qXh2 QN qXi2
-qXh3 QN qXi3
-qXh4 QN qXi7
-qXh5 QN qXi5
-qXh6 QN qXi4
-qXh7 QN qXi1
-qXht QN qXi6
-
-dXh0lo DN dXitlo
-dXh0hi DN dXithi
-dXh1lo DN dXi0lo
-dXh1hi DN dXi0hi
-dXh2lo DN dXi2lo
-dXh2hi DN dXi2hi
-dXh3lo DN dXi3lo
-dXh3hi DN dXi3hi
-dXh4lo DN dXi7lo
-dXh4hi DN dXi7hi
-dXh5lo DN dXi5lo
-dXh5hi DN dXi5hi
-dXh6lo DN dXi4lo
-dXh6hi DN dXi4hi
-dXh7lo DN dXi1lo
-dXh7hi DN dXi1hi
-dXhtlo DN dXi6lo
-dXhthi DN dXi6hi
-
-qXg0 QN qXh2
-qXg1 QN qXht
-qXg2 QN qXh1
-qXg3 QN qXh0
-qXg4 QN qXh4
-qXg5 QN qXh5
-qXg6 QN qXh6
-qXg7 QN qXh7
-qXgt QN qXh3
-
-qXf0 QN qXg6
-qXf1 QN qXg5
-qXf2 QN qXg4
-qXf3 QN qXgt
-qXf4 QN qXg3
-qXf5 QN qXg2
-qXf6 QN qXg1
-qXf7 QN qXg0
-qXft QN qXg7
-
-
-qXt0 QN 1.S32
-qXt1 QN 2.S32
-qT0lo QN 1.S32
-qT0hi QN 2.S32
-qT1lo QN 3.S32
-qT1hi QN 4.S32
-qScalelo QN 5.S32 ;// used to read post scale values
-qScalehi QN 6.S32
-qTemp0 QN 5.S32
-qTemp1 QN 6.S32
-
-
-Scale1 EQU 6
-Scale2 EQU 15
-qScale1 QN Scale1.S16
-qScale2 QN Scale2.S16
-dScale1lo DN (Scale1*2).S16
-dScale1hi DN (Scale1*2+1).S16
-dScale2lo DN (Scale2*2).S16
-dScale2hi DN (Scale2*2+1).S16
-
-dCoefs DN 0.S16 ;// Scale coefficients in format {[0] [C] [S] [InvSqrt2]}
-InvSqrt2 DN dCoefs[0] ;// 1/sqrt(2) in Q15
-S DN dCoefs[1] ;// Sin(PI/8) in Q15
-C DN dCoefs[2] ;// Cos(PI/8) in Q15
-
-pTemp RN 12
-
-
- IMPORT armCOMM_IDCTCoef
-
- VLD1 {qXj0,qXj1}, [pSrc @64]!
- VLD1 {qXj2,qXj3}, [pSrc @64]!
- VLD1 {qXj4,qXj5}, [pSrc @64]!
- VLD1 {qXj6,qXj7}, [pSrc @64]!
-
- ;// Load PreScale and multiply with Src
- ;// IStage 4
-
- IF "$inscale"="s16" ;// 16X16 Mul
- M_IDCT_PRESCALE16
- ENDIF
-
- IF "$inscale"="s32" ;// 32X32 ,ul
- M_IDCT_PRESCALE32
- ENDIF
-
- ;// IStage 3
- VQDMULH qXi2, qXi2, InvSqrt2 ;// i2/sqrt(2)
- VHADD qXh0, qXi0, qXi1 ;// (i0+i1)/2
- VHSUB qXh1, qXi0, qXi1 ;// (i0-i1)/2
- VHADD qXh7, qXi5, qXi7 ;// (i5+i7)/4
- VSUB qXh5, qXi5, qXi7 ;// (i5-i7)/2
- VQDMULH qXh5, qXh5, InvSqrt2 ;// h5/sqrt(2)
- VSUB qXh2, qXi2, qXi3 ;// h2, h3
-
- VMULL qXt0, dXi4lo, C ;// c*i4
- VMLAL qXt0, dXi6lo, S ;// c*i4+s*i6
- VMULL qXt1, dXi4hi, C
- VMLAL qXt1, dXi6hi, S
- VSHRN dXh4lo, qXt0, #16 ;// h4
- VSHRN dXh4hi, qXt1, #16
-
- VMULL qXt0, dXi6lo, C ;// c*i6
- VMLSL qXt0, dXi4lo, S ;// -s*i4 + c*h6
- VMULL qXt1, dXi6hi, C
- VMLSL qXt1, dXi4hi, S
- VSHRN dXh6lo, qXt0, #16 ;// h6
- VSHRN dXh6hi, qXt1, #16
-
- ;// IStage 2
- VSUB qXg6, qXh6, qXh7
- VSUB qXg5, qXh5, qXg6
- VSUB qXg4, qXh4, qXg5
- VHADD qXg1, qXh1, qXh2 ;// (h1+h2)/2
- VHSUB qXg2, qXh1, qXh2 ;// (h1-h2)/2
- VHADD qXg0, qXh0, qXh3 ;// (h0+h3)/2
- VHSUB qXg3, qXh0, qXh3 ;// (h0-h3)/2
-
- ;// IStage 1 all rows
- VADD qXf3, qXg3, qXg4
- VSUB qXf4, qXg3, qXg4
- VADD qXf2, qXg2, qXg5
- VSUB qXf5, qXg2, qXg5
- VADD qXf1, qXg1, qXg6
- VSUB qXf6, qXg1, qXg6
- VADD qXf0, qXg0, qXg7
- VSUB qXf7, qXg0, qXg7
-
- ;// Transpose, store and loop
-XTR0 EQU Src5
-XTR1 EQU Tmp
-XTR2 EQU Src6
-XTR3 EQU Src7
-XTR4 EQU Src3
-XTR5 EQU Src0
-XTR6 EQU Src1
-XTR7 EQU Src2
-XTRt EQU Src4
-
-qA0 QN XTR0.S32 ;// for XTRpose
-qA1 QN XTR1.S32
-qA2 QN XTR2.S32
-qA3 QN XTR3.S32
-qA4 QN XTR4.S32
-qA5 QN XTR5.S32
-qA6 QN XTR6.S32
-qA7 QN XTR7.S32
-
-dB0 DN XTR0*2+1 ;// for using VSWP
-dB1 DN XTR1*2+1
-dB2 DN XTR2*2+1
-dB3 DN XTR3*2+1
-dB4 DN XTR4*2
-dB5 DN XTR5*2
-dB6 DN XTR6*2
-dB7 DN XTR7*2
-
-
- VTRN qXf0, qXf1
- VTRN qXf2, qXf3
- VTRN qXf4, qXf5
- VTRN qXf6, qXf7
- VTRN qA0, qA2
- VTRN qA1, qA3
- VTRN qA4, qA6
- VTRN qA5, qA7
- VSWP dB0, dB4
- VSWP dB1, dB5
- VSWP dB2, dB6
- VSWP dB3, dB7
-
-
-qYj0 QN qXf0
-qYj1 QN qXf1
-qYj2 QN qXf2
-qYj3 QN qXf3
-qYj4 QN qXf4
-qYj5 QN qXf5
-qYj6 QN qXf6
-qYj7 QN qXf7
-qYjt QN qXft
-
-dYj0lo DN (XTR0*2).S16
-dYj0hi DN (XTR0*2+1).S16
-dYj1lo DN (XTR1*2).S16
-dYj1hi DN (XTR1*2+1).S16
-dYj2lo DN (XTR2*2).S16
-dYj2hi DN (XTR2*2+1).S16
-dYj3lo DN (XTR3*2).S16
-dYj3hi DN (XTR3*2+1).S16
-dYj4lo DN (XTR4*2).S16
-dYj4hi DN (XTR4*2+1).S16
-dYj5lo DN (XTR5*2).S16
-dYj5hi DN (XTR5*2+1).S16
-dYj6lo DN (XTR6*2).S16
-dYj6hi DN (XTR6*2+1).S16
-dYj7lo DN (XTR7*2).S16
-dYj7hi DN (XTR7*2+1).S16
-dYjtlo DN (XTRt*2).S16
-dYjthi DN (XTRt*2+1).S16
-
-qYi0 QN qYj0
-qYi1 QN qYj4
-qYi2 QN qYj2
-qYi3 QN qYj7
-qYi4 QN qYj5
-qYi5 QN qYjt
-qYi6 QN qYj1
-qYi7 QN qYj6
-qYit QN qYj3
-
-dYi0lo DN dYj0lo
-dYi0hi DN dYj0hi
-dYi1lo DN dYj4lo
-dYi1hi DN dYj4hi
-dYi2lo DN dYj2lo
-dYi2hi DN dYj2hi
-dYi3lo DN dYj7lo
-dYi3hi DN dYj7hi
-dYi4lo DN dYj5lo
-dYi4hi DN dYj5hi
-dYi5lo DN dYjtlo
-dYi5hi DN dYjthi
-dYi6lo DN dYj1lo
-dYi6hi DN dYj1hi
-dYi7lo DN dYj6lo
-dYi7hi DN dYj6hi
-dYitlo DN dYj3lo
-dYithi DN dYj3hi
-
-qYh0 QN qYit
-qYh1 QN qYi0
-qYh2 QN qYi2
-qYh3 QN qYi3
-qYh4 QN qYi7
-qYh5 QN qYi5
-qYh6 QN qYi4
-qYh7 QN qYi1
-qYht QN qYi6
-
-dYh0lo DN dYitlo
-dYh0hi DN dYithi
-dYh1lo DN dYi0lo
-dYh1hi DN dYi0hi
-dYh2lo DN dYi2lo
-dYh2hi DN dYi2hi
-dYh3lo DN dYi3lo
-dYh3hi DN dYi3hi
-dYh4lo DN dYi7lo
-dYh4hi DN dYi7hi
-dYh5lo DN dYi5lo
-dYh5hi DN dYi5hi
-dYh6lo DN dYi4lo
-dYh6hi DN dYi4hi
-dYh7lo DN dYi1lo
-dYh7hi DN dYi1hi
-dYhtlo DN dYi6lo
-dYhthi DN dYi6hi
-
-qYg0 QN qYh2
-qYg1 QN qYht
-qYg2 QN qYh1
-qYg3 QN qYh0
-qYg4 QN qYh4
-qYg5 QN qYh5
-qYg6 QN qYh6
-qYg7 QN qYh7
-qYgt QN qYh3
-
-qYf0 QN qYg6
-qYf1 QN qYg5
-qYf2 QN qYg4
-qYf3 QN qYgt
-qYf4 QN qYg3
-qYf5 QN qYg2
-qYf6 QN qYg1
-qYf7 QN qYg0
-qYft QN qYg7
-
- VRSHR qYj7, qYj7, #2
- VRSHR qYj6, qYj6, #1
-
- VHADD qYi5, qYj1, qYj7 ;// i5 = (j1+j7)/2
- VSUB qYi6, qYj1, qYj7 ;// i6 = j1-j7
- VHADD qYi3, qYj2, qYj6 ;// i3 = (j2+j6)/2
- VSUB qYi2, qYj2, qYj6 ;// i2 = j2-j6
- VHADD qYi7, qYj5, qYj3 ;// i7 = (j5+j3)/2
- VSUB qYi4, qYj5, qYj3 ;// i4 = j5-j3
-
- VQDMULH qYi2, qYi2, InvSqrt2 ;// i2/sqrt(2)
- ;// IStage 4,3 rows 0to1 x 1/2
-
- MOV pTemp, #0x4 ;// ensure correct round
- VDUP qScale1, pTemp ;// of DC result
- VADD qYi0, qYi0, qScale1
-
- VHADD qYh0, qYi0, qYi1 ;// (i0+i1)/2
- VHSUB qYh1, qYi0, qYi1 ;// (i0-i1)/2
-
- VHADD qYh7, qYi5, qYi7 ;// (i5+i7)/4
- VSUB qYh5, qYi5, qYi7 ;// (i5-i7)/2
- VSUB qYh2, qYi2, qYi3 ;// h2, h3
- VQDMULH qYh5, qYh5, InvSqrt2 ;// h5/sqrt(2)
-
- VMULL qXt0, dYi4lo, C ;// c*i4
- VMLAL qXt0, dYi6lo, S ;// c*i4+s*i6
- VMULL qXt1, dYi4hi, C
- VMLAL qXt1, dYi6hi, S
- VSHRN dYh4lo, qXt0, #16 ;// h4
- VSHRN dYh4hi, qXt1, #16
-
- VMULL qXt0, dYi6lo, C ;// c*i6
- VMLSL qXt0, dYi4lo, S ;// -s*i4 + c*h6
- VMULL qXt1, dYi6hi, C
- VMLSL qXt1, dYi4hi, S
- VSHRN dYh6lo, qXt0, #16 ;// h6
- VSHRN dYh6hi, qXt1, #16
-
- VSUB qYg6, qYh6, qYh7
- VSUB qYg5, qYh5, qYg6
- VSUB qYg4, qYh4, qYg5
-
- ;// IStage 2 rows 0to3 x 1/2
- VHADD qYg1, qYh1, qYh2 ;// (h1+h2)/2
- VHSUB qYg2, qYh1, qYh2 ;// (h1-h2)/2
- VHADD qYg0, qYh0, qYh3 ;// (h0+h3)/2
- VHSUB qYg3, qYh0, qYh3 ;// (h0-h3)/2
-
-
- ;// IStage 1 all rows
- VHADD qYf3, qYg3, qYg4
- VHSUB qYf4, qYg3, qYg4
- VHADD qYf2, qYg2, qYg5
- VHSUB qYf5, qYg2, qYg5
- VHADD qYf1, qYg1, qYg6
- VHSUB qYf6, qYg1, qYg6
- VHADD qYf0, qYg0, qYg7
- VHSUB qYf7, qYg0, qYg7
-
-YTR0 EQU Src0
-YTR1 EQU Src4
-YTR2 EQU Src1
-YTR3 EQU Src2
-YTR4 EQU Src7
-YTR5 EQU Src5
-YTR6 EQU Tmp
-YTR7 EQU Src6
-YTRt EQU Src3
-
-qC0 QN YTR0.S32 ;// for YTRpose
-qC1 QN YTR1.S32
-qC2 QN YTR2.S32
-qC3 QN YTR3.S32
-qC4 QN YTR4.S32
-qC5 QN YTR5.S32
-qC6 QN YTR6.S32
-qC7 QN YTR7.S32
-
-dD0 DN YTR0*2+1 ;// for using VSWP
-dD1 DN YTR1*2+1
-dD2 DN YTR2*2+1
-dD3 DN YTR3*2+1
-dD4 DN YTR4*2
-dD5 DN YTR5*2
-dD6 DN YTR6*2
-dD7 DN YTR7*2
-
- VTRN qYf0, qYf1
- VTRN qYf2, qYf3
- VTRN qYf4, qYf5
- VTRN qYf6, qYf7
- VTRN qC0, qC2
- VTRN qC1, qC3
- VTRN qC4, qC6
- VTRN qC5, qC7
- VSWP dD0, dD4
- VSWP dD1, dD5
- VSWP dD2, dD6
- VSWP dD3, dD7
-
-
-dYf0U8 DN YTR0*2.U8
-dYf1U8 DN YTR1*2.U8
-dYf2U8 DN YTR2*2.U8
-dYf3U8 DN YTR3*2.U8
-dYf4U8 DN YTR4*2.U8
-dYf5U8 DN YTR5*2.U8
-dYf6U8 DN YTR6*2.U8
-dYf7U8 DN YTR7*2.U8
-
- ;//
- ;// Do saturation if outsize is other than S16
- ;//
-
- IF ("$outsize"="u8")
- ;// Output range [0-255]
- VQMOVN dYf0U8, qYf0
- VQMOVN dYf1U8, qYf1
- VQMOVN dYf2U8, qYf2
- VQMOVN dYf3U8, qYf3
- VQMOVN dYf4U8, qYf4
- VQMOVN dYf5U8, qYf5
- VQMOVN dYf6U8, qYf6
- VQMOVN dYf7U8, qYf7
- ENDIF
-
- IF ("$outsize"="s9")
- ;// Output range [-256 to +255]
- VQSHL qYf0, qYf0, #16-9
- VQSHL qYf1, qYf1, #16-9
- VQSHL qYf2, qYf2, #16-9
- VQSHL qYf3, qYf3, #16-9
- VQSHL qYf4, qYf4, #16-9
- VQSHL qYf5, qYf5, #16-9
- VQSHL qYf6, qYf6, #16-9
- VQSHL qYf7, qYf7, #16-9
-
- VSHR qYf0, qYf0, #16-9
- VSHR qYf1, qYf1, #16-9
- VSHR qYf2, qYf2, #16-9
- VSHR qYf3, qYf3, #16-9
- VSHR qYf4, qYf4, #16-9
- VSHR qYf5, qYf5, #16-9
- VSHR qYf6, qYf6, #16-9
- VSHR qYf7, qYf7, #16-9
- ENDIF
-
- ;// Store output depending on the Stride size
- IF "$stride"="s"
- VST1 qYf0, [pDest @64], Stride
- VST1 qYf1, [pDest @64], Stride
- VST1 qYf2, [pDest @64], Stride
- VST1 qYf3, [pDest @64], Stride
- VST1 qYf4, [pDest @64], Stride
- VST1 qYf5, [pDest @64], Stride
- VST1 qYf6, [pDest @64], Stride
- VST1 qYf7, [pDest @64]
- ELSE
- IF ("$outsize"="u8")
- VST1 dYf0U8, [pDest @64], #8
- VST1 dYf1U8, [pDest @64], #8
- VST1 dYf2U8, [pDest @64], #8
- VST1 dYf3U8, [pDest @64], #8
- VST1 dYf4U8, [pDest @64], #8
- VST1 dYf5U8, [pDest @64], #8
- VST1 dYf6U8, [pDest @64], #8
- VST1 dYf7U8, [pDest @64]
- ELSE
- ;// ("$outsize"="s9") or ("$outsize"="s16")
- VST1 qYf0, [pDest @64], #16
- VST1 qYf1, [pDest @64], #16
- VST1 qYf2, [pDest @64], #16
- VST1 qYf3, [pDest @64], #16
- VST1 qYf4, [pDest @64], #16
- VST1 qYf5, [pDest @64], #16
- VST1 qYf6, [pDest @64], #16
- VST1 qYf7, [pDest @64]
- ENDIF
-
- ENDIF
-
-
-
- ENDIF ;// CortexA8
-
-
-
- MEND
-
- ;// Scale TWO input rows with TWO rows of 16 bit scale values
- ;//
- ;// This macro is used by M_IDCT_PRESCALE16 to pre-scale one row
- ;// input (Eight input values) with one row of scale values. Also
- ;// Loads next scale values from pScale, if $LastRow flag is not set.
- ;//
- ;// Input Registers:
- ;//
- ;// $dAlo - Input D register with first four S16 values of row n
- ;// $dAhi - Input D register with next four S16 values of row n
- ;// $dBlo - Input D register with first four S16 values of row n+1
- ;// $dBhi - Input D register with next four S16 values of row n+1
- ;// pScale - Pointer to next row of scale values
- ;// qT0lo - Temporary scratch register
- ;// qT0hi - Temporary scratch register
- ;// qT1lo - Temporary scratch register
- ;// qT1hi - Temporary scratch register
- ;// dScale1lo - Scale value of row n
- ;// dScale1hi - Scale value of row n
- ;// dScale2lo - Scale value of row n+1
- ;// dScale2hi - Scale value of row n+1
- ;//
- ;// Input Flag
- ;//
- ;// $LastRow - Flag to indicate whether current row is last row
- ;//
- ;// Output Registers:
- ;//
- ;// $dAlo - Scaled output values (first four S16 of row n)
- ;// $dAhi - Scaled output values (next four S16 of row n)
- ;// $dBlo - Scaled output values (first four S16 of row n+1)
- ;// $dBhi - Scaled output values (next four S16 of row n+1)
- ;// qScale1 - Scale values for next row
- ;// qScale2 - Scale values for next row+1
- ;// pScale - Pointer to next row of scale values
- ;//
- MACRO
- M_IDCT_SCALE16 $dAlo, $dAhi, $dBlo, $dBhi, $LastRow
- VMULL qT0lo, $dAlo, dScale1lo
- VMULL qT0hi, $dAhi, dScale1hi
- VMULL qT1lo, $dBlo, dScale2lo
- VMULL qT1hi, $dBhi, dScale2hi
- IF "$LastRow"="0"
- VLD1 qScale1, [pScale], #16 ;// Load scale for row n+1
- VLD1 qScale2, [pScale], #16 ;// Load scale for row n+2
- ENDIF
- VQRSHRN $dAlo, qT0lo, #12
- VQRSHRN $dAhi, qT0hi, #12
- VQRSHRN $dBlo, qT1lo, #12
- VQRSHRN $dBhi, qT1hi, #12
- MEND
-
- ;// Scale 8x8 block input values with 16 bit scale values
- ;//
- ;// This macro is used to pre-scale block of 8x8 input.
- ;// This also do the Ist stage transformations of IDCT.
- ;//
- ;// Input Registers:
- ;//
- ;// dXjnlo - n th input D register with first four S16 values
- ;// dXjnhi - n th input D register with next four S16 values
- ;// qXjn - n th input Q register with eight S16 values
- ;// pScale - Pointer to scale values
- ;//
- ;// Output Registers:
- ;//
- ;// qXin - n th output Q register with eight S16 output values of 1st stage
- ;//
- MACRO
- M_IDCT_PRESCALE16
- VLD1 qScale1, [pScale], #16 ;// Load Pre scale for row 0
- VLD1 qScale2, [pScale], #16 ;// Load Pre scale for row 0
- M_IDCT_SCALE16 dXj0lo, dXj0hi, dXj1lo, dXj1hi, 0 ;// Pre scale row 0 & 1
- M_IDCT_SCALE16 dXj2lo, dXj2hi, dXj3lo, dXj3hi, 0
- M_IDCT_SCALE16 dXj4lo, dXj4hi, dXj5lo, dXj5hi, 0
- M_IDCT_SCALE16 dXj6lo, dXj6hi, dXj7lo, dXj7hi, 1
- VHADD qXi5, qXj1, qXj7 ;// (j1+j7)/2
- VSUB qXi6, qXj1, qXj7 ;// j1-j7
- LDR pSrc, =armCOMM_IDCTCoef ;// Address of DCT inverse AAN constants
- VHADD qXi3, qXj2, qXj6 ;// (j2+j6)/2
- VSUB qXi2, qXj2, qXj6 ;// j2-j6
- VLDR dCoefs, [pSrc] ;// Load DCT inverse AAN constants
- VHADD qXi7, qXj5, qXj3 ;// (j5+j3)/2
- VSUB qXi4, qXj5, qXj3 ;// j5-j3
- MEND
-
-
- ;// Scale 8x8 block input values with 32 bit scale values
- ;//
- ;// This macro is used to pre-scale block of 8x8 input.
- ;// This also do the Ist stage transformations of IDCT.
- ;//
- ;// Input Registers:
- ;//
- ;// dXjnlo - n th input D register with first four S16 values
- ;// dXjnhi - n th input D register with next four S16 values
- ;// qXjn - n th input Q register with eight S16 values
- ;// pScale - Pointer to 32bit scale values in Q23 format
- ;//
- ;// Output Registers:
- ;//
- ;// dXinlo - n th output D register with first four S16 output values of 1st stage
- ;// dXinhi - n th output D register with next four S16 output values of 1st stage
- ;//
- MACRO
- M_IDCT_PRESCALE32
-qScale0lo QN 0.S32
-qScale0hi QN 1.S32
-qScale1lo QN 2.S32
-qScale1hi QN 3.S32
-qScale2lo QN qScale1lo
-qScale2hi QN qScale1hi
-qScale3lo QN qScale1lo
-qScale3hi QN qScale1hi
-qScale4lo QN qScale1lo
-qScale4hi QN qScale1hi
-qScale5lo QN qScale0lo
-qScale5hi QN qScale0hi
-qScale6lo QN qScale0lo
-qScale6hi QN qScale0hi
-qScale7lo QN qScale0lo
-qScale7hi QN qScale0hi
-
-qSrc0lo QN 4.S32
-qSrc0hi QN 5.S32
-qSrc1lo QN 6.S32
-qSrc1hi QN Src4.S32
-qSrc2lo QN qSrc0lo
-qSrc2hi QN qSrc0hi
-qSrc3lo QN qSrc0lo
-qSrc3hi QN qSrc0hi
-qSrc4lo QN qSrc0lo
-qSrc4hi QN qSrc0hi
-qSrc5lo QN qSrc1lo
-qSrc5hi QN qSrc1hi
-qSrc6lo QN qSrc1lo
-qSrc6hi QN qSrc1hi
-qSrc7lo QN qSrc0lo
-qSrc7hi QN qSrc0hi
-
-qRes17lo QN qScale0lo
-qRes17hi QN qScale0hi
-qRes26lo QN qScale0lo
-qRes26hi QN qScale0hi
-qRes53lo QN qScale0lo
-qRes53hi QN qScale0hi
-
- ADD pTemp, pScale, #4*8*7 ;// Address of pScale[7]
-
- ;// Row 0
- VLD1 {qScale0lo, qScale0hi}, [pScale]!
- VSHLL qSrc0lo, dXj0lo, #(12-1)
- VSHLL qSrc0hi, dXj0hi, #(12-1)
- VLD1 {qScale1lo, qScale1hi}, [pScale]!
- VQRDMULH qSrc0lo, qScale0lo, qSrc0lo
- VQRDMULH qSrc0hi, qScale0hi, qSrc0hi
- VLD1 {qScale7lo, qScale7hi}, [pTemp]!
- VSHLL qSrc1lo, dXj1lo, #(12-1)
- VSHLL qSrc1hi, dXj1hi, #(12-1)
- VMOVN dXi0lo, qSrc0lo ;// Output i0
- VMOVN dXi0hi, qSrc0hi
- VSHLL qSrc7lo, dXj7lo, #(12-1)
- VSHLL qSrc7hi, dXj7hi, #(12-1)
- SUB pTemp, pTemp, #((16*2)+(4*8*1))
- VQRDMULH qSrc1lo, qScale1lo, qSrc1lo
- VQRDMULH qSrc1hi, qScale1hi, qSrc1hi
- VQRDMULH qSrc7lo, qScale7lo, qSrc7lo
- VQRDMULH qSrc7hi, qScale7hi, qSrc7hi
- VLD1 {qScale2lo, qScale2hi}, [pScale]!
-
- ;// Row 1 & 7
- VHADD qRes17lo, qSrc1lo, qSrc7lo ;// (j1+j7)/2
- VHADD qRes17hi, qSrc1hi, qSrc7hi ;// (j1+j7)/2
- VMOVN dXi5lo, qRes17lo ;// Output i5
- VMOVN dXi5hi, qRes17hi
- VSUB qRes17lo, qSrc1lo, qSrc7lo ;// j1-j7
- VSUB qRes17hi, qSrc1hi, qSrc7hi ;// j1-j7
- VMOVN dXi6lo, qRes17lo ;// Output i6
- VMOVN dXi6hi, qRes17hi
- VSHLL qSrc2lo, dXj2lo, #(12-1)
- VSHLL qSrc2hi, dXj2hi, #(12-1)
- VLD1 {qScale6lo, qScale6hi}, [pTemp]!
- VSHLL qSrc6lo, dXj6lo, #(12-1)
- VSHLL qSrc6hi, dXj6hi, #(12-1)
- SUB pTemp, pTemp, #((16*2)+(4*8*1))
- VQRDMULH qSrc2lo, qScale2lo, qSrc2lo
- VQRDMULH qSrc2hi, qScale2hi, qSrc2hi
- VQRDMULH qSrc6lo, qScale6lo, qSrc6lo
- VQRDMULH qSrc6hi, qScale6hi, qSrc6hi
- VLD1 {qScale3lo, qScale3hi}, [pScale]!
-
- ;// Row 2 & 6
- VHADD qRes26lo, qSrc2lo, qSrc6lo ;// (j2+j6)/2
- VHADD qRes26hi, qSrc2hi, qSrc6hi ;// (j2+j6)/2
- VMOVN dXi3lo, qRes26lo ;// Output i3
- VMOVN dXi3hi, qRes26hi
- VSUB qRes26lo, qSrc2lo, qSrc6lo ;// j2-j6
- VSUB qRes26hi, qSrc2hi, qSrc6hi ;// j2-j6
- VMOVN dXi2lo, qRes26lo ;// Output i2
- VMOVN dXi2hi, qRes26hi
- VSHLL qSrc3lo, dXj3lo, #(12-1)
- VSHLL qSrc3hi, dXj3hi, #(12-1)
- VLD1 {qScale5lo, qScale5hi}, [pTemp]!
- VSHLL qSrc5lo, dXj5lo, #(12-1)
- VSHLL qSrc5hi, dXj5hi, #(12-1)
- VQRDMULH qSrc3lo, qScale3lo, qSrc3lo
- VQRDMULH qSrc3hi, qScale3hi, qSrc3hi
- VQRDMULH qSrc5lo, qScale5lo, qSrc5lo
- VQRDMULH qSrc5hi, qScale5hi, qSrc5hi
-
- ;// Row 3 & 5
- VHADD qRes53lo, qSrc5lo, qSrc3lo ;// (j5+j3)/2
- VHADD qRes53hi, qSrc5hi, qSrc3hi ;// (j5+j3)/2
- SUB pSrc, pSrc, #16*2*2
- VMOVN dXi7lo, qRes53lo ;// Output i7
- VMOVN dXi7hi, qRes53hi
- VSUB qRes53lo, qSrc5lo, qSrc3lo ;// j5-j3
- VSUB qRes53hi, qSrc5hi, qSrc3hi ;// j5-j3
- VLD1 qXj4, [pSrc @64]
- VMOVN dXi4lo, qRes53lo ;// Output i4
- VMOVN dXi4hi, qRes53hi
- VSHLL qSrc4lo, dXj4lo, #(12-1)
- VSHLL qSrc4hi, dXj4hi, #(12-1)
- VLD1 {qScale4lo, qScale4hi}, [pScale]
- LDR pSrc, =armCOMM_IDCTCoef ;// Address of DCT inverse AAN constants
- VQRDMULH qSrc4lo, qScale4lo, qSrc4lo
- VQRDMULH qSrc4hi, qScale4hi, qSrc4hi
- VLDR dCoefs, [pSrc] ;// Load DCT inverse AAN constants
- ;// Row 4
- VMOVN dXi1lo, qSrc4lo ;// Output i1
- VMOVN dXi1hi, qSrc4hi
-
- MEND
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_MaskTable.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_MaskTable.h
deleted file mode 100644
index 5ffc835..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_MaskTable.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armCOMM_MaskTable.h
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- * Mask Table to mask the end of array
- */
-
-
-
-#ifndef _ARMCOMM_MASKTABLE_H_
-#define _ARMCOMM_MASKTABLE_H_
-
-#define MaskTableSize 72
-
-/* Mask table */
-
-extern const OMX_U16 armCOMM_qMaskTable16[MaskTableSize];
-extern const OMX_U8 armCOMM_qMaskTable8[MaskTableSize];
-
-#endif
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_Version.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_Version.h
deleted file mode 100644
index 41b3e1e..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_Version.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Guard the header against multiple inclusion. */
-#ifndef __ARM_COMM_VERSION_H__
-#define __ARM_COMM_VERSION_H__
-
-
-/* The following line should be in omxtypes.h but hasn't been approved by OpenMAX yet */
-#define OMX_VERSION 102
-
-/* We need to define these macros in order to convert a #define number into a #define string. */
-#define ARM_QUOTE(a) #a
-#define ARM_INDIRECT(A) ARM_QUOTE(A)
-
-/* Convert the OMX_VERSION number into a string that can be used, for example, to print it out. */
-#define ARM_VERSION_STRING ARM_INDIRECT(OMX_VERSION)
-
-
-/* Define this in order to turn on ARM version/release/build strings in each domain */
-#define ARM_INCLUDE_VERSION_DESCRIPTIONS
-
-#ifdef ARM_INCLUDE_VERSION_DESCRIPTIONS
- extern const char * const omxAC_VersionDescription;
- extern const char * const omxIC_VersionDescription;
- extern const char * const omxIP_VersionDescription;
- extern const char * const omxSP_VersionDescription;
- extern const char * const omxVC_VersionDescription;
-#endif /* ARM_INCLUDE_VERSION_DESCRIPTIONS */
-
-
-/* The following entries should be automatically updated by the release script */
-/* They are used in the ARM version strings defined for each domain. */
-
-/* The release tag associated with this release of the library. - used for source and object releases */
-#define OMX_ARM_RELEASE_TAG "r1p0-00bet0"
-
-/* The ARM architecture used to build any objects or executables in this release. */
-#define OMX_ARM_BUILD_ARCHITECTURE "ARM Architecture V7 with NEON"
-
-/* The ARM Toolchain used to build any objects or executables in this release. */
-#define OMX_ARM_BUILD_TOOLCHAIN "ARM RVCT 3.1"
-
-
-#endif /* __ARM_COMM_VERSION_H__ */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_s.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_s.h
deleted file mode 100644
index 321d2d3..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armCOMM_s.h
+++ /dev/null
@@ -1,1171 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armCOMM_s.h
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-;// ARM optimized OpenMAX common header file
-;//
-
-;// Protect against multiple inclusion
- IF :LNOT::DEF:ARMCOMM_S_H
- GBLL ARMCOMM_S_H
-
- REQUIRE8 ;// Requires 8-byte stack alignment
- PRESERVE8 ;// Preserves 8-byte stack alignment
-
- GBLL ARM_ERRORCHECK
-ARM_ERRORCHECK SETL {FALSE}
-
-;// Globals
-
- GBLS _RRegList ;// R saved register list
- GBLS _DRegList ;// D saved register list
- GBLS _Variant ;// Selected processor variant
- GBLS _CPU ;// CPU name
- GBLS _Struct ;// Structure name
-
- GBLL _InFunc ;// Inside function assembly flag
- GBLL _SwLong ;// Long switch flag
-
- GBLA _RBytes ;// Number of register bytes on stack
- GBLA _SBytes ;// Number of scratch bytes on stack
- GBLA _ABytes ;// Stack offset of next argument
- GBLA _Workspace ;// Stack offset of scratch workspace
- GBLA _F ;// Function number
- GBLA _StOff ;// Struct offset
- GBLA _SwNum ;// Switch number
- GBLS _32 ;// Suffix for 32 byte alignmnet
- GBLS _16 ;// Suffix for 16 byte alignmnet
-
-_InFunc SETL {FALSE}
-_SBytes SETA 0
-_F SETA 0
-_SwNum SETA 0
-_32 SETS "ALIGN32"
-_16 SETS "ALIGN16"
-
-;/////////////////////////////////////////////////////////
-;// Override the tools settings of the CPU if the #define
-;// USECPU is set, otherwise use the CPU defined by the
-;// assembler settings.
-;/////////////////////////////////////////////////////////
-
- IF :DEF: OVERRIDECPU
-_CPU SETS OVERRIDECPU
- ELSE
-_CPU SETS {CPU}
- ENDIF
-
-
-
-;/////////////////////////////////////////////////////////
-;// Work out which code to build
-;/////////////////////////////////////////////////////////
-
- IF :DEF:ARM1136JS:LOR::DEF:CortexA8:LOR::DEF:ARM_GENERIC
- INFO 1,"Please switch to using M_VARIANTS"
- ENDIF
-
- ;// Define and reset all officially recongnised variants
- MACRO
- _M_DEF_VARIANTS
- _M_DEF_VARIANT ARM926EJS
- _M_DEF_VARIANT ARM1136JS
- _M_DEF_VARIANT ARM1136JS_U
- _M_DEF_VARIANT CortexA8
- _M_DEF_VARIANT ARM7TDMI
- MEND
-
- MACRO
- _M_DEF_VARIANT $var
- GBLL $var
- GBLL _ok$var
-$var SETL {FALSE}
- MEND
-
-
- ;// Variant declaration
- ;//
- ;// Define a list of code variants supported by this
- ;// source file. This macro then chooses the most
- ;// appropriate variant to build for the currently configured
- ;// core.
- ;//
- MACRO
- M_VARIANTS $v0,$v1,$v2,$v3,$v4,$v5,$v6,$v7
- ;// Set to TRUE variants that are supported
- _M_DEF_VARIANTS
- _M_VARIANT $v0
- _M_VARIANT $v1
- _M_VARIANT $v2
- _M_VARIANT $v3
- _M_VARIANT $v4
- _M_VARIANT $v5
- _M_VARIANT $v6
- _M_VARIANT $v7
-
- ;// Look for first available variant to match a CPU
- ;// _M_TRY cpu, variant fall back list
-_Variant SETS ""
- _M_TRY ARM926EJ-S, ARM926EJS
- _M_TRY ARM1176JZ-S, ARM1136JS
- _M_TRY ARM1176JZF-S, ARM1136JS
- _M_TRY ARM1156T2-S, ARM1136JS
- _M_TRY ARM1156T2F-S, ARM1136JS
- _M_TRY ARM1136J-S, ARM1136JS
- _M_TRY ARM1136JF-S, ARM1136JS
- _M_TRY MPCore, ARM1136JS
- _M_TRY falcon-vfp, ARM1136JS
- _M_TRY falcon-full-neon, CortexA8
- _M_TRY Cortex-A8NoNeon, ARM1136JS
- _M_TRY Cortex-A8, CortexA8, ARM1136JS
- _M_TRY Cortex-R4, ARM1136JS
- _M_TRY ARM7TDMI
-
- ;// Select the correct variant
- _M_DEF_VARIANTS
- IF _Variant=""
- INFO 1, "No match found for CPU '$_CPU'"
- ELSE
-$_Variant SETL {TRUE}
- ENDIF
- MEND
-
- ;// Register a variant as available
- MACRO
- _M_VARIANT $var
- IF "$var"=""
- MEXIT
- ENDIF
- IF :LNOT::DEF:_ok$var
- INFO 1, "Unrecognized variant '$var'"
- ENDIF
-$var SETL {TRUE}
- MEND
-
- ;// For a given CPU, see if any of the variants supporting
- ;// this CPU are available. The first available variant is
- ;// chosen
- MACRO
- _M_TRY $cpu, $v0,$v1,$v2,$v3,$v4,$v5,$v6,$v7
- IF "$cpu"<>_CPU
- MEXIT
- ENDIF
- _M_TRY1 $v0
- _M_TRY1 $v1
- _M_TRY1 $v2
- _M_TRY1 $v3
- _M_TRY1 $v4
- _M_TRY1 $v5
- _M_TRY1 $v6
- _M_TRY1 $v7
- ;// Check a match was found
- IF _Variant=""
- INFO 1, "No variant match found for CPU '$_CPU'"
- ENDIF
- MEND
-
- MACRO
- _M_TRY1 $var
- IF "$var"=""
- MEXIT
- ENDIF
- IF (_Variant=""):LAND:$var
-_Variant SETS "$var"
- ENDIF
- MEND
-
-;////////////////////////////////////////////////////////
-;// Structure definition
-;////////////////////////////////////////////////////////
-
- ;// Declare a structure of given name
- MACRO
- M_STRUCT $sname
-_Struct SETS "$sname"
-_StOff SETA 0
- MEND
-
- ;// Declare a structure field
- ;// The field is called $sname_$fname
- ;// $size = the size of each entry, must be power of 2
- ;// $number = (if provided) the number of entries for an array
- MACRO
- M_FIELD $fname, $size, $number
- IF (_StOff:AND:($size-1))!=0
-_StOff SETA _StOff + ($size - (_StOff:AND:($size-1)))
- ENDIF
-$_Struct._$fname EQU _StOff
- IF "$number"<>""
-_StOff SETA _StOff + $size*$number
- ELSE
-_StOff SETA _StOff + $size
- ENDIF
- MEND
-
-
- MACRO
- M_ENDSTRUCT
-sizeof_$_Struct EQU _StOff
-_Struct SETS ""
- MEND
-
-;//////////////////////////////////////////////////////////
-;// Switch and table macros
-;//////////////////////////////////////////////////////////
-
- ;// Start a relative switch table with register to switch on
- ;//
- ;// $v = the register to switch on
- ;// $s = if specified must be "L" to indicate long
- ;// this allows a greater range to the case code
- MACRO
- M_SWITCH $v, $s
- ASSERT "$s"="":LOR:"$s"="L"
-_SwLong SETL {FALSE}
- IF "$s"="L"
-_SwLong SETL {TRUE}
- ENDIF
-_SwNum SETA _SwNum+1
- IF {CONFIG}=16
- ;// Thumb
- IF _SwLong
- TBH [pc, $v, LSL#1]
- ELSE
- TBB [pc, $v]
- ENDIF
-_Switch$_SwNum
- ELSE
- ;// ARM
- ADD pc, pc, $v, LSL #2
- NOP
- ENDIF
- MEND
-
- ;// Add a case to the switch statement
- MACRO
- M_CASE $label
- IF {CONFIG}=16
- ;// Thumb
- IF _SwLong
- DCW ($label - _Switch$_SwNum)/2
- ELSE
- DCB ($label - _Switch$_SwNum)/2
- ENDIF
- ELSE
- ;// ARM
- B $label
- ENDIF
- MEND
-
- ;// End of switch statement
- MACRO
- M_ENDSWITCH
- ALIGN 2
- MEND
-
-
-;////////////////////////////////////////////////////////
-;// Data area allocation
-;////////////////////////////////////////////////////////
-
- ;// Constant table allocator macro
- ;//
- ;// Creates a new section for each constant table
- ;// $name is symbol through which the table can be accessed.
- ;// $align is the optional alignment of the table, log2 of
- ;// the byte alignment - $align=4 is 16 byte aligned
- MACRO
- M_TABLE $name, $align
- ASSERT :LNOT:_InFunc
- IF "$align"=""
- AREA |.constdata|, READONLY, DATA
- ELSE
- ;// AREAs inherit the alignment of the first declaration.
- ;// Therefore for each alignment size we must have an area
- ;// of a different name.
- AREA constdata_a$align, READONLY, DATA, ALIGN=$align
-
- ;// We also force alignment incase we are tagging onto
- ;// an already started area.
- ALIGN (1<<$align)
- ENDIF
-$name
- MEND
-
-;/////////////////////////////////////////////////////
-;// Macros to allocate space on the stack
-;//
-;// These all assume that the stack is 8-byte aligned
-;// at entry to the function, which means that the
-;// 32-byte alignment macro needs to work in a
-;// bit more of a special way...
-;/////////////////////////////////////////////////////
-
-
-
-
- ;// Allocate 1-byte aligned area of name
- ;// $name size $size bytes.
- MACRO
- M_ALLOC1 $name, $size
- ASSERT :LNOT:_InFunc
-$name$_F EQU _SBytes
-_SBytes SETA _SBytes + ($size)
- MEND
-
- ;// Allocate 2-byte aligned area of name
- ;// $name size $size bytes.
- MACRO
- M_ALLOC2 $name, $size
- ASSERT :LNOT:_InFunc
- IF (_SBytes:AND:1)!=0
-_SBytes SETA _SBytes + (2 - (_SBytes:AND:1))
- ENDIF
-$name$_F EQU _SBytes
-_SBytes SETA _SBytes + ($size)
- MEND
-
- ;// Allocate 4-byte aligned area of name
- ;// $name size $size bytes.
- MACRO
- M_ALLOC4 $name, $size
- ASSERT :LNOT:_InFunc
- IF (_SBytes:AND:3)!=0
-_SBytes SETA _SBytes + (4 - (_SBytes:AND:3))
- ENDIF
-$name$_F EQU _SBytes
-_SBytes SETA _SBytes + ($size)
- MEND
-
- ;// Allocate 8-byte aligned area of name
- ;// $name size $size bytes.
- MACRO
- M_ALLOC8 $name, $size
- ASSERT :LNOT:_InFunc
- IF (_SBytes:AND:7)!=0
-_SBytes SETA _SBytes + (8 - (_SBytes:AND:7))
- ENDIF
-$name$_F EQU _SBytes
-_SBytes SETA _SBytes + ($size)
- MEND
-
-
- ;// Allocate 8-byte aligned area of name
- ;// $name size ($size+16) bytes.
- ;// The extra 16 bytes are later used to align the pointer to 16 bytes
-
- MACRO
- M_ALLOC16 $name, $size
- ASSERT :LNOT:_InFunc
- IF (_SBytes:AND:7)!=0
-_SBytes SETA _SBytes + (8 - (_SBytes:AND:7))
- ENDIF
-$name$_F$_16 EQU (_SBytes + 8)
-_SBytes SETA _SBytes + ($size) + 8
- MEND
-
- ;// Allocate 8-byte aligned area of name
- ;// $name size ($size+32) bytes.
- ;// The extra 32 bytes are later used to align the pointer to 32 bytes
-
- MACRO
- M_ALLOC32 $name, $size
- ASSERT :LNOT:_InFunc
- IF (_SBytes:AND:7)!=0
-_SBytes SETA _SBytes + (8 - (_SBytes:AND:7))
- ENDIF
-$name$_F$_32 EQU (_SBytes + 24)
-_SBytes SETA _SBytes + ($size) + 24
- MEND
-
-
-
-
- ;// Argument Declaration Macro
- ;//
- ;// Allocate an argument name $name
- ;// size $size bytes
- MACRO
- M_ARG $name, $size
- ASSERT _InFunc
-$name$_F EQU _ABytes
-_ABytes SETA _ABytes + ($size)
- MEND
-
-;///////////////////////////////////////////////
-;// Macros to access stacked variables
-;///////////////////////////////////////////////
-
- ;// Macro to perform a data processing operation
- ;// with a constant second operand
- MACRO
- _M_OPC $op,$rd,$rn,$const
- LCLA _sh
- LCLA _cst
-_sh SETA 0
-_cst SETA $const
- IF _cst=0
- $op $rd, $rn, #_cst
- MEXIT
- ENDIF
- WHILE (_cst:AND:3)=0
-_cst SETA _cst>>2
-_sh SETA _sh+2
- WEND
- $op $rd, $rn, #(_cst:AND:0x000000FF)<<_sh
- IF _cst>=256
- $op $rd, $rd, #(_cst:AND:0xFFFFFF00)<<_sh
- ENDIF
- MEND
-
- ;// Macro to perform a data access operation
- ;// Such as LDR or STR
- ;// The addressing mode is modified such that
- ;// 1. If no address is given then the name is taken
- ;// as a stack offset
- ;// 2. If the addressing mode is not available for the
- ;// state being assembled for (eg Thumb) then a suitable
- ;// addressing mode is substituted.
- ;//
- ;// On Entry:
- ;// $i = Instruction to perform (eg "LDRB")
- ;// $a = Required byte alignment
- ;// $r = Register(s) to transfer (eg "r1")
- ;// $a0,$a1,$a2. Addressing mode and condition. One of:
- ;// label {,cc}
- ;// [base] {,,,cc}
- ;// [base, offset]{!} {,,cc}
- ;// [base, offset, shift]{!} {,cc}
- ;// [base], offset {,,cc}
- ;// [base], offset, shift {,cc}
- MACRO
- _M_DATA $i,$a,$r,$a0,$a1,$a2,$a3
- IF "$a0":LEFT:1="["
- IF "$a1"=""
- $i$a3 $r, $a0
- ELSE
- IF "$a0":RIGHT:1="]"
- IF "$a2"=""
- _M_POSTIND $i$a3, "$r", $a0, $a1
- ELSE
- _M_POSTIND $i$a3, "$r", $a0, "$a1,$a2"
- ENDIF
- ELSE
- IF "$a2"=""
- _M_PREIND $i$a3, "$r", $a0, $a1
- ELSE
- _M_PREIND $i$a3, "$r", $a0, "$a1,$a2"
- ENDIF
- ENDIF
- ENDIF
- ELSE
- LCLA _Offset
-_Offset SETA _Workspace + $a0$_F
- ASSERT (_Offset:AND:($a-1))=0
- $i$a1 $r, [sp, #_Offset]
- ENDIF
- MEND
-
- ;// Handle post indexed load/stores
- ;// op reg, [base], offset
- MACRO
- _M_POSTIND $i,$r,$a0,$a1
- LCLS _base
- LCLS _offset
- IF {CONFIG}=16 ;// Thumb
-_base SETS ("$a0":LEFT:(:LEN:"$a0"-1)):RIGHT:(:LEN:"$a0"-2) ;// remove []
-_offset SETS "$a1"
- IF _offset:LEFT:1="+"
-_offset SETS _offset:RIGHT:(:LEN:_offset-1)
- ENDIF
- $i $r, $a0
- IF _offset:LEFT:1="-"
-_offset SETS _offset:RIGHT:(:LEN:_offset-1)
- SUB $_base, $_base, $_offset
- ELSE
- ADD $_base, $_base, $_offset
- ENDIF
- ELSE ;// ARM
- $i $r, $a0, $a1
- ENDIF
- MEND
-
- ;// Handle pre indexed load/store
- ;// op reg, [base, offset]{!}
- MACRO
- _M_PREIND $i,$r,$a0,$a1
- LCLS _base
- LCLS _offset
- IF ({CONFIG}=16):LAND:(("$a1":RIGHT:2)="]!")
-_base SETS "$a0":RIGHT:(:LEN:("$a0")-1)
-_offset SETS "$a1":LEFT:(:LEN:("$a1")-2)
- $i $r, [$_base, $_offset]
- ADD $_base, $_base, $_offset
- ELSE
- $i $r, $a0, $a1
- ENDIF
- MEND
-
- ;// Load unsigned byte from stack
- MACRO
- M_LDRB $r,$a0,$a1,$a2,$a3
- _M_DATA "LDRB",1,$r,$a0,$a1,$a2,$a3
- MEND
-
- ;// Load signed byte from stack
- MACRO
- M_LDRSB $r,$a0,$a1,$a2,$a3
- _M_DATA "LDRSB",1,$r,$a0,$a1,$a2,$a3
- MEND
-
- ;// Store byte to stack
- MACRO
- M_STRB $r,$a0,$a1,$a2,$a3
- _M_DATA "STRB",1,$r,$a0,$a1,$a2,$a3
- MEND
-
- ;// Load unsigned half word from stack
- MACRO
- M_LDRH $r,$a0,$a1,$a2,$a3
- _M_DATA "LDRH",2,$r,$a0,$a1,$a2,$a3
- MEND
-
- ;// Load signed half word from stack
- MACRO
- M_LDRSH $r,$a0,$a1,$a2,$a3
- _M_DATA "LDRSH",2,$r,$a0,$a1,$a2,$a3
- MEND
-
- ;// Store half word to stack
- MACRO
- M_STRH $r,$a0,$a1,$a2,$a3
- _M_DATA "STRH",2,$r,$a0,$a1,$a2,$a3
- MEND
-
- ;// Load word from stack
- MACRO
- M_LDR $r,$a0,$a1,$a2,$a3
- _M_DATA "LDR",4,$r,$a0,$a1,$a2,$a3
- MEND
-
- ;// Store word to stack
- MACRO
- M_STR $r,$a0,$a1,$a2,$a3
- _M_DATA "STR",4,$r,$a0,$a1,$a2,$a3
- MEND
-
- ;// Load double word from stack
- MACRO
- M_LDRD $r0,$r1,$a0,$a1,$a2,$a3
- _M_DATA "LDRD",8,"$r0,$r1",$a0,$a1,$a2,$a3
- MEND
-
- ;// Store double word to stack
- MACRO
- M_STRD $r0,$r1,$a0,$a1,$a2,$a3
- _M_DATA "STRD",8,"$r0,$r1",$a0,$a1,$a2,$a3
- MEND
-
- ;// Get absolute address of stack allocated location
- MACRO
- M_ADR $a, $b, $cc
- _M_OPC ADD$cc, $a, sp, (_Workspace + $b$_F)
- MEND
-
- ;// Get absolute address of stack allocated location and align the address to 16 bytes
- MACRO
- M_ADR16 $a, $b, $cc
- _M_OPC ADD$cc, $a, sp, (_Workspace + $b$_F$_16)
-
- ;// Now align $a to 16 bytes
- BIC$cc $a,$a,#0x0F
- MEND
-
- ;// Get absolute address of stack allocated location and align the address to 32 bytes
- MACRO
- M_ADR32 $a, $b, $cc
- _M_OPC ADD$cc, $a, sp, (_Workspace + $b$_F$_32)
-
- ;// Now align $a to 32 bytes
- BIC$cc $a,$a,#0x1F
- MEND
-
-;//////////////////////////////////////////////////////////
-;// Function header and footer macros
-;//////////////////////////////////////////////////////////
-
- ;// Function Header Macro
- ;// Generates the function prologue
- ;// Note that functions should all be "stack-moves-once"
- ;// The FNSTART and FNEND macros should be the only places
- ;// where the stack moves.
- ;//
- ;// $name = function name
- ;// $rreg = "" don't stack any registers
- ;// "lr" stack "lr" only
- ;// "rN" stack registers "r4-rN,lr"
- ;// $dreg = "" don't stack any D registers
- ;// "dN" stack registers "d8-dN"
- ;//
- ;// Note: ARM Archicture procedure call standard AAPCS
- ;// states that r4-r11, sp, d8-d15 must be preserved by
- ;// a compliant function.
- MACRO
- M_START $name, $rreg, $dreg
- ASSERT :LNOT:_InFunc
- ASSERT "$name"!=""
-_InFunc SETL {TRUE}
-_RBytes SETA 0
-_Workspace SETA 0
-
- ;// Create an area for the function
- AREA |.text|, CODE
- EXPORT $name
-$name FUNCTION
-
- ;// Save R registers
- _M_GETRREGLIST $rreg
- IF _RRegList<>""
- STMFD sp!, {$_RRegList, lr}
- ENDIF
-
- ;// Save D registers
- _M_GETDREGLIST $dreg
- IF _DRegList<>""
- VSTMFD sp!, {$_DRegList}
- ENDIF
-
-
- ;// Ensure size claimed on stack is 8-byte aligned
- IF ((_SBytes:AND:7)!=0)
-_SBytes SETA _SBytes + (8 - (_SBytes:AND:7))
- ENDIF
-
- IF (_SBytes!=0)
- _M_OPC SUB, sp, sp, _SBytes
- ENDIF
-
-
-_ABytes SETA _SBytes + _RBytes - _Workspace
-
-
- ;// Print function name if debug enabled
- M_PRINTF "$name\n",
- MEND
-
- ;// Work out a list of R saved registers
- MACRO
- _M_GETRREGLIST $rreg
- IF "$rreg"=""
-_RRegList SETS ""
- MEXIT
- ENDIF
- IF "$rreg"="lr":LOR:"$rreg"="r4"
-_RRegList SETS "r4"
-_RBytes SETA _RBytes+8
- MEXIT
- ENDIF
- IF "$rreg"="r5":LOR:"$rreg"="r6"
-_RRegList SETS "r4-r6"
-_RBytes SETA _RBytes+16
- MEXIT
- ENDIF
- IF "$rreg"="r7":LOR:"$rreg"="r8"
-_RRegList SETS "r4-r8"
-_RBytes SETA _RBytes+24
- MEXIT
- ENDIF
- IF "$rreg"="r9":LOR:"$rreg"="r10"
-_RRegList SETS "r4-r10"
-_RBytes SETA _RBytes+32
- MEXIT
- ENDIF
- IF "$rreg"="r11":LOR:"$rreg"="r12"
-_RRegList SETS "r4-r12"
-_RBytes SETA _RBytes+40
- MEXIT
- ENDIF
- INFO 1, "Unrecognized saved r register limit '$rreg'"
- MEND
-
- ;// Work out a list of D saved registers
- MACRO
- _M_GETDREGLIST $dreg
- IF "$dreg"=""
-_DRegList SETS ""
- MEXIT
- ENDIF
- IF "$dreg"="d8"
-_DRegList SETS "d8"
-_RBytes SETA _RBytes+8
- MEXIT
- ENDIF
- IF "$dreg"="d9"
-_DRegList SETS "d8-d9"
-_RBytes SETA _RBytes+16
- MEXIT
- ENDIF
- IF "$dreg"="d10"
-_DRegList SETS "d8-d10"
-_RBytes SETA _RBytes+24
- MEXIT
- ENDIF
- IF "$dreg"="d11"
-_DRegList SETS "d8-d11"
-_RBytes SETA _RBytes+32
- MEXIT
- ENDIF
- IF "$dreg"="d12"
-_DRegList SETS "d8-d12"
-_RBytes SETA _RBytes+40
- MEXIT
- ENDIF
- IF "$dreg"="d13"
-_DRegList SETS "d8-d13"
-_RBytes SETA _RBytes+48
- MEXIT
- ENDIF
- IF "$dreg"="d14"
-_DRegList SETS "d8-d14"
-_RBytes SETA _RBytes+56
- MEXIT
- ENDIF
- IF "$dreg"="d15"
-_DRegList SETS "d8-d15"
-_RBytes SETA _RBytes+64
- MEXIT
- ENDIF
- INFO 1, "Unrecognized saved d register limit '$dreg'"
- MEND
-
- ;// Produce function return instructions
- MACRO
- _M_RET $cc
- IF _DRegList<>""
- VPOP$cc {$_DRegList}
- ENDIF
- IF _RRegList=""
- BX$cc lr
- ELSE
- LDM$cc.FD sp!, {$_RRegList, pc}
- ENDIF
- MEND
-
- ;// Early Function Exit Macro
- ;// $cc = condition to exit with
- ;// (Example: M_EXIT EQ)
- MACRO
- M_EXIT $cc
- ASSERT _InFunc
- IF _SBytes!=0
- ;// Restore stack frame and exit
- B$cc _End$_F
- ELSE
- ;// Can return directly
- _M_RET $cc
- ENDIF
- MEND
-
- ;// Function Footer Macro
- ;// Generates the function epilogue
- MACRO
- M_END
- ASSERT _InFunc
-_InFunc SETL {FALSE}
-_End$_F
-
- ;// Restore the stack pointer to its original value on function entry
- IF _SBytes!=0
- _M_OPC ADD, sp, sp, _SBytes
- ENDIF
- _M_RET
- ENDFUNC
-
- ;// Reset the global stack tracking variables back to their
- ;// initial values, and increment the function count
-_SBytes SETA 0
-_F SETA _F+1
- MEND
-
-
-;//==========================================================================
-;// Debug Macros
-;//==========================================================================
-
- GBLL DEBUG_ON
-DEBUG_ON SETL {FALSE}
- GBLL DEBUG_STALLS_ON
-DEBUG_STALLS_ON SETL {FALSE}
-
- ;//==========================================================================
- ;// Debug call to printf
- ;// M_PRINTF $format, $val0, $val1, $val2
- ;//
- ;// Examples:
- ;// M_PRINTF "x=%08x\n", r0
- ;//
- ;// This macro preserves the value of all registers including the
- ;// flags.
- ;//==========================================================================
-
- MACRO
- M_PRINTF $format, $val0, $val1, $val2
- IF DEBUG_ON
-
- IMPORT printf
- LCLA nArgs
-nArgs SETA 0
-
- ;// save registers so we don't corrupt them
- STMFD sp!, {r0-r12, lr}
-
- ;// Drop stack to give us some workspace
- SUB sp, sp, #16
-
- ;// Save registers we need to print to the stack
- IF "$val2" <> ""
- ASSERT "$val1" <> ""
- STR $val2, [sp, #8]
-nArgs SETA nArgs+1
- ENDIF
- IF "$val1" <> ""
- ASSERT "$val0" <> ""
- STR $val1, [sp, #4]
-nArgs SETA nArgs+1
- ENDIF
- IF "$val0"<>""
- STR $val0, [sp]
-nArgs SETA nArgs+1
- ENDIF
-
- ;// Now we are safe to corrupt registers
- ADR r0, %FT00
- IF nArgs=1
- LDR r1, [sp]
- ENDIF
- IF nArgs=2
- LDMIA sp, {r1,r2}
- ENDIF
- IF nArgs=3
- LDMIA sp, {r1,r2,r3}
- ENDIF
-
- ;// print the values
- MRS r4, cpsr ;// preserve flags
- BL printf
- MSR cpsr_f, r4 ;// restore flags
- B %FT01
-00 ;// string to print
- DCB "$format", 0
- ALIGN
-01 ;// Finished
- ADD sp, sp, #16
- ;// Restore registers
- LDMFD sp!, {r0-r12,lr}
-
- ENDIF ;// DEBUG_ON
- MEND
-
-
- ;// Stall Simulation Macro
- ;// Inserts a given number of NOPs for the currently
- ;// defined platform
- MACRO
- M_STALL $plat1stall, $plat2stall, $plat3stall, $plat4stall, $plat5stall, $plat6stall
- IF DEBUG_STALLS_ON
- _M_STALL_SUB $plat1stall
- _M_STALL_SUB $plat2stall
- _M_STALL_SUB $plat3stall
- _M_STALL_SUB $plat4stall
- _M_STALL_SUB $plat5stall
- _M_STALL_SUB $plat6stall
- ENDIF
- MEND
-
- MACRO
- _M_STALL_SUB $platstall
- IF "$platstall"!=""
- LCLA _pllen
- LCLS _pl
- LCLL _pllog
-_pllen SETA :LEN:"$platstall"
-_pl SETS "$platstall":LEFT:(_pllen - 2)
- IF :DEF:$_pl
- IF $_pl
- LCLS _st
- LCLA _stnum
-_st SETS "$platstall":RIGHT:1
-_stnum SETA $_st
- WHILE _stnum>0
- MOV sp, sp
-_stnum SETA _stnum - 1
- WEND
- ENDIF
- ENDIF
- ENDIF
- MEND
-
-
-
-;//==========================================================================
-;// Endian Invarience Macros
-;//
-;// The idea behind these macros is that if an array is
-;// loaded as words then the SMUL00 macro will multiply
-;// array elements 0 regardless of the endianess of the
-;// system. For little endian SMUL00=SMULBB, for big
-;// endian SMUL00=SMULTT and similarly for other packed operations.
-;//
-;//==========================================================================
-
- MACRO
- LIBI4 $comli, $combi, $a, $b, $c, $d, $cc
- IF {ENDIAN}="big"
- $combi.$cc $a, $b, $c, $d
- ELSE
- $comli.$cc $a, $b, $c, $d
- ENDIF
- MEND
-
- MACRO
- LIBI3 $comli, $combi, $a, $b, $c, $cc
- IF {ENDIAN}="big"
- $combi.$cc $a, $b, $c
- ELSE
- $comli.$cc $a, $b, $c
- ENDIF
- MEND
-
- ;// SMLAxy macros
-
- MACRO
- SMLA00 $a, $b, $c, $d, $cc
- LIBI4 SMLABB, SMLATT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLA01 $a, $b, $c, $d, $cc
- LIBI4 SMLABT, SMLATB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLA0B $a, $b, $c, $d, $cc
- LIBI4 SMLABB, SMLATB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLA0T $a, $b, $c, $d, $cc
- LIBI4 SMLABT, SMLATT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLA10 $a, $b, $c, $d, $cc
- LIBI4 SMLATB, SMLABT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLA11 $a, $b, $c, $d, $cc
- LIBI4 SMLATT, SMLABB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLA1B $a, $b, $c, $d, $cc
- LIBI4 SMLATB, SMLABB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLA1T $a, $b, $c, $d, $cc
- LIBI4 SMLATT, SMLABT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAB0 $a, $b, $c, $d, $cc
- LIBI4 SMLABB, SMLABT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAB1 $a, $b, $c, $d, $cc
- LIBI4 SMLABT, SMLABB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAT0 $a, $b, $c, $d, $cc
- LIBI4 SMLATB, SMLATT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAT1 $a, $b, $c, $d, $cc
- LIBI4 SMLATT, SMLATB, $a, $b, $c, $d, $cc
- MEND
-
- ;// SMULxy macros
-
- MACRO
- SMUL00 $a, $b, $c, $cc
- LIBI3 SMULBB, SMULTT, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMUL01 $a, $b, $c, $cc
- LIBI3 SMULBT, SMULTB, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMUL0B $a, $b, $c, $cc
- LIBI3 SMULBB, SMULTB, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMUL0T $a, $b, $c, $cc
- LIBI3 SMULBT, SMULTT, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMUL10 $a, $b, $c, $cc
- LIBI3 SMULTB, SMULBT, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMUL11 $a, $b, $c, $cc
- LIBI3 SMULTT, SMULBB, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMUL1B $a, $b, $c, $cc
- LIBI3 SMULTB, SMULBB, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMUL1T $a, $b, $c, $cc
- LIBI3 SMULTT, SMULBT, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMULB0 $a, $b, $c, $cc
- LIBI3 SMULBB, SMULBT, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMULB1 $a, $b, $c, $cc
- LIBI3 SMULBT, SMULBB, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMULT0 $a, $b, $c, $cc
- LIBI3 SMULTB, SMULTT, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMULT1 $a, $b, $c, $cc
- LIBI3 SMULTT, SMULTB, $a, $b, $c, $cc
- MEND
-
- ;// SMLAWx, SMULWx macros
-
- MACRO
- SMLAW0 $a, $b, $c, $d, $cc
- LIBI4 SMLAWB, SMLAWT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAW1 $a, $b, $c, $d, $cc
- LIBI4 SMLAWT, SMLAWB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMULW0 $a, $b, $c, $cc
- LIBI3 SMULWB, SMULWT, $a, $b, $c, $cc
- MEND
-
- MACRO
- SMULW1 $a, $b, $c, $cc
- LIBI3 SMULWT, SMULWB, $a, $b, $c, $cc
- MEND
-
- ;// SMLALxy macros
-
-
- MACRO
- SMLAL00 $a, $b, $c, $d, $cc
- LIBI4 SMLALBB, SMLALTT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAL01 $a, $b, $c, $d, $cc
- LIBI4 SMLALBT, SMLALTB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAL0B $a, $b, $c, $d, $cc
- LIBI4 SMLALBB, SMLALTB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAL0T $a, $b, $c, $d, $cc
- LIBI4 SMLALBT, SMLALTT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAL10 $a, $b, $c, $d, $cc
- LIBI4 SMLALTB, SMLALBT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAL11 $a, $b, $c, $d, $cc
- LIBI4 SMLALTT, SMLALBB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAL1B $a, $b, $c, $d, $cc
- LIBI4 SMLALTB, SMLALBB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLAL1T $a, $b, $c, $d, $cc
- LIBI4 SMLALTT, SMLALBT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLALB0 $a, $b, $c, $d, $cc
- LIBI4 SMLALBB, SMLALBT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLALB1 $a, $b, $c, $d, $cc
- LIBI4 SMLALBT, SMLALBB, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLALT0 $a, $b, $c, $d, $cc
- LIBI4 SMLALTB, SMLALTT, $a, $b, $c, $d, $cc
- MEND
-
- MACRO
- SMLALT1 $a, $b, $c, $d, $cc
- LIBI4 SMLALTT, SMLALTB, $a, $b, $c, $d, $cc
- MEND
-
- ENDIF ;// ARMCOMM_S_H
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armOMX.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armOMX.h
deleted file mode 100644
index 303abd9..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/armOMX.h
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- * File Name: armOMX_ReleaseVersion.h
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- * This file allows a version of the OMX DL libraries to be built where some or
- * all of the function names can be given a user specified suffix.
- *
- * You might want to use it where:
- *
- * - you want to rename a function "out of the way" so that you could replace
- * a function with a different version (the original version would still be
- * in the library just with a different name - so you could debug the new
- * version by comparing it to the output of the old)
- *
- * - you want to rename all the functions to versions with a suffix so that
- * you can include two versions of the library and choose between functions
- * at runtime.
- *
- * e.g. omxIPBM_Copy_U8_C1R could be renamed omxIPBM_Copy_U8_C1R_CortexA8
- *
- */
-
-
-#ifndef _armOMX_H_
-#define _armOMX_H_
-
-
-/* We need to define these two macros in order to expand and concatenate the names */
-#define OMXCAT2BAR(A, B) omx ## A ## B
-#define OMXCATBAR(A, B) OMXCAT2BAR(A, B)
-
-/* Define the suffix to add to all functions - the default is no suffix */
-#define BARE_SUFFIX
-
-
-
-/* Define what happens to the bare suffix-less functions, down to the sub-domain accuracy */
-#define OMXACAAC_SUFFIX BARE_SUFFIX
-#define OMXACMP3_SUFFIX BARE_SUFFIX
-#define OMXICJP_SUFFIX BARE_SUFFIX
-#define OMXIPBM_SUFFIX BARE_SUFFIX
-#define OMXIPCS_SUFFIX BARE_SUFFIX
-#define OMXIPPP_SUFFIX BARE_SUFFIX
-#define OMXSP_SUFFIX BARE_SUFFIX
-#define OMXVCCOMM_SUFFIX BARE_SUFFIX
-#define OMXVCM4P10_SUFFIX BARE_SUFFIX
-#define OMXVCM4P2_SUFFIX BARE_SUFFIX
-
-
-
-
-/* Define what the each bare, un-suffixed OpenMAX API function names is to be renamed */
-#define omxACAAC_DecodeChanPairElt OMXCATBAR(ACAAC_DecodeChanPairElt, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodeDatStrElt OMXCATBAR(ACAAC_DecodeDatStrElt, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodeFillElt OMXCATBAR(ACAAC_DecodeFillElt, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodeIsStereo_S32 OMXCATBAR(ACAAC_DecodeIsStereo_S32, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodeMsPNS_S32_I OMXCATBAR(ACAAC_DecodeMsPNS_S32_I, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodeMsStereo_S32_I OMXCATBAR(ACAAC_DecodeMsStereo_S32_I, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodePrgCfgElt OMXCATBAR(ACAAC_DecodePrgCfgElt, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodeTNS_S32_I OMXCATBAR(ACAAC_DecodeTNS_S32_I, OMXACAAC_SUFFIX)
-#define omxACAAC_DeinterleaveSpectrum_S32 OMXCATBAR(ACAAC_DeinterleaveSpectrum_S32, OMXACAAC_SUFFIX)
-#define omxACAAC_EncodeTNS_S32_I OMXCATBAR(ACAAC_EncodeTNS_S32_I, OMXACAAC_SUFFIX)
-#define omxACAAC_LongTermPredict_S32 OMXCATBAR(ACAAC_LongTermPredict_S32, OMXACAAC_SUFFIX)
-#define omxACAAC_LongTermReconstruct_S32_I OMXCATBAR(ACAAC_LongTermReconstruct_S32_I, OMXACAAC_SUFFIX)
-#define omxACAAC_MDCTFwd_S32 OMXCATBAR(ACAAC_MDCTFwd_S32, OMXACAAC_SUFFIX)
-#define omxACAAC_MDCTInv_S32_S16 OMXCATBAR(ACAAC_MDCTInv_S32_S16, OMXACAAC_SUFFIX)
-#define omxACAAC_NoiselessDecode OMXCATBAR(ACAAC_NoiselessDecode, OMXACAAC_SUFFIX)
-#define omxACAAC_QuantInv_S32_I OMXCATBAR(ACAAC_QuantInv_S32_I, OMXACAAC_SUFFIX)
-#define omxACAAC_UnpackADIFHeader OMXCATBAR(ACAAC_UnpackADIFHeader, OMXACAAC_SUFFIX)
-#define omxACAAC_UnpackADTSFrameHeader OMXCATBAR(ACAAC_UnpackADTSFrameHeader, OMXACAAC_SUFFIX)
-
-
-#define omxACMP3_HuffmanDecode_S32 OMXCATBAR(ACMP3_HuffmanDecode_S32, OMXACMP3_SUFFIX)
-#define omxACMP3_HuffmanDecodeSfb_S32 OMXCATBAR(ACMP3_HuffmanDecodeSfb_S32, OMXACMP3_SUFFIX)
-#define omxACMP3_HuffmanDecodeSfbMbp_S32 OMXCATBAR(ACMP3_HuffmanDecodeSfbMbp_S32, OMXACMP3_SUFFIX)
-#define omxACMP3_MDCTInv_S32 OMXCATBAR(ACMP3_MDCTInv_S32, OMXACMP3_SUFFIX)
-#define omxACMP3_ReQuantize_S32_I OMXCATBAR(ACMP3_ReQuantize_S32_I, OMXACMP3_SUFFIX)
-#define omxACMP3_ReQuantizeSfb_S32_I OMXCATBAR(ACMP3_ReQuantizeSfb_S32_I, OMXACMP3_SUFFIX)
-#define omxACMP3_SynthPQMF_S32_S16 OMXCATBAR(ACMP3_SynthPQMF_S32_S16, OMXACMP3_SUFFIX)
-#define omxACMP3_UnpackFrameHeader OMXCATBAR(ACMP3_UnpackFrameHeader, OMXACMP3_SUFFIX)
-#define omxACMP3_UnpackScaleFactors_S8 OMXCATBAR(ACMP3_UnpackScaleFactors_S8, OMXACMP3_SUFFIX)
-#define omxACMP3_UnpackSideInfo OMXCATBAR(ACMP3_UnpackSideInfo, OMXACMP3_SUFFIX)
-
-#define omxICJP_CopyExpand_U8_C3 OMXCATBAR(ICJP_CopyExpand_U8_C3, OMXICJP_SUFFIX)
-#define omxICJP_DCTFwd_S16 OMXCATBAR(ICJP_DCTFwd_S16, OMXICJP_SUFFIX)
-#define omxICJP_DCTFwd_S16_I OMXCATBAR(ICJP_DCTFwd_S16_I, OMXICJP_SUFFIX)
-#define omxICJP_DCTInv_S16 OMXCATBAR(ICJP_DCTInv_S16, OMXICJP_SUFFIX)
-#define omxICJP_DCTInv_S16_I OMXCATBAR(ICJP_DCTInv_S16_I, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantFwd_Multiple_S16 OMXCATBAR(ICJP_DCTQuantFwd_Multiple_S16, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantFwd_S16 OMXCATBAR(ICJP_DCTQuantFwd_S16, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantFwd_S16_I OMXCATBAR(ICJP_DCTQuantFwd_S16_I, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantFwdTableInit OMXCATBAR(ICJP_DCTQuantFwdTableInit, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantInv_Multiple_S16 OMXCATBAR(ICJP_DCTQuantInv_Multiple_S16, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantInv_S16 OMXCATBAR(ICJP_DCTQuantInv_S16, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantInv_S16_I OMXCATBAR(ICJP_DCTQuantInv_S16_I, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantInvTableInit OMXCATBAR(ICJP_DCTQuantInvTableInit, OMXICJP_SUFFIX)
-#define omxICJP_DecodeHuffman8x8_Direct_S16_C1 OMXCATBAR(ICJP_DecodeHuffman8x8_Direct_S16_C1, OMXICJP_SUFFIX)
-#define omxICJP_DecodeHuffmanSpecGetBufSize_U8 OMXCATBAR(ICJP_DecodeHuffmanSpecGetBufSize_U8, OMXICJP_SUFFIX)
-#define omxICJP_DecodeHuffmanSpecInit_U8 OMXCATBAR(ICJP_DecodeHuffmanSpecInit_U8, OMXICJP_SUFFIX)
-#define omxICJP_EncodeHuffman8x8_Direct_S16_U1_C1 OMXCATBAR(ICJP_EncodeHuffman8x8_Direct_S16_U1_C1, OMXICJP_SUFFIX)
-#define omxICJP_EncodeHuffmanSpecGetBufSize_U8 OMXCATBAR(ICJP_EncodeHuffmanSpecGetBufSize_U8, OMXICJP_SUFFIX)
-#define omxICJP_EncodeHuffmanSpecInit_U8 OMXCATBAR(ICJP_EncodeHuffmanSpecInit_U8, OMXICJP_SUFFIX)
-
-#define omxIPBM_AddC_U8_C1R_Sfs OMXCATBAR(IPBM_AddC_U8_C1R_Sfs, OMXIPBM_SUFFIX)
-#define omxIPBM_Copy_U8_C1R OMXCATBAR(IPBM_Copy_U8_C1R, OMXIPBM_SUFFIX)
-#define omxIPBM_Copy_U8_C3R OMXCATBAR(IPBM_Copy_U8_C3R, OMXIPBM_SUFFIX)
-#define omxIPBM_Mirror_U8_C1R OMXCATBAR(IPBM_Mirror_U8_C1R, OMXIPBM_SUFFIX)
-#define omxIPBM_MulC_U8_C1R_Sfs OMXCATBAR(IPBM_MulC_U8_C1R_Sfs, OMXIPBM_SUFFIX)
-
-#define omxIPCS_ColorTwistQ14_U8_C3R OMXCATBAR(IPCS_ColorTwistQ14_U8_C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_BGR565ToYCbCr420LS_MCU_U16_S16_C3P3R OMXCATBAR(IPCS_BGR565ToYCbCr420LS_MCU_U16_S16_C3P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_BGR565ToYCbCr422LS_MCU_U16_S16_C3P3R OMXCATBAR(IPCS_BGR565ToYCbCr422LS_MCU_U16_S16_C3P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_BGR565ToYCbCr444LS_MCU_U16_S16_C3P3R OMXCATBAR(IPCS_BGR565ToYCbCr444LS_MCU_U16_S16_C3P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_BGR888ToYCbCr420LS_MCU_U8_S16_C3P3R OMXCATBAR(IPCS_BGR888ToYCbCr420LS_MCU_U8_S16_C3P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_BGR888ToYCbCr422LS_MCU_U8_S16_C3P3R OMXCATBAR(IPCS_BGR888ToYCbCr422LS_MCU_U8_S16_C3P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_BGR888ToYCbCr444LS_MCU_U8_S16_C3P3R OMXCATBAR(IPCS_BGR888ToYCbCr444LS_MCU_U8_S16_C3P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr420RszCscRotBGR_U8_P3C3R OMXCATBAR(IPCS_YCbCr420RszCscRotBGR_U8_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr420RszRot_U8_P3R OMXCATBAR(IPCS_YCbCr420RszRot_U8_P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr420ToBGR565_U8_U16_P3C3R OMXCATBAR(IPCS_YCbCr420ToBGR565_U8_U16_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr420ToBGR565LS_MCU_S16_U16_P3C3R OMXCATBAR(IPCS_YCbCr420ToBGR565LS_MCU_S16_U16_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr420ToBGR888LS_MCU_S16_U8_P3C3R OMXCATBAR(IPCS_YCbCr420ToBGR888LS_MCU_S16_U8_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr422RszCscRotBGR_U8_P3C3R OMXCATBAR(IPCS_YCbCr422RszCscRotBGR_U8_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_CbYCrY422RszCscRotBGR_U8_U16_C2R OMXCATBAR(IPCS_CbYCrY422RszCscRotBGR_U8_U16_C2R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr422RszRot_U8_P3R OMXCATBAR(IPCS_YCbCr422RszRot_U8_P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbYCr422ToBGR565_U8_U16_C2C3R OMXCATBAR(IPCS_YCbYCr422ToBGR565_U8_U16_C2C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr422ToBGR565LS_MCU_S16_U16_P3C3R OMXCATBAR(IPCS_YCbCr422ToBGR565LS_MCU_S16_U16_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbYCr422ToBGR888_U8_C2C3R OMXCATBAR(IPCS_YCbYCr422ToBGR888_U8_C2C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr422ToBGR888LS_MCU_S16_U8_P3C3R OMXCATBAR(IPCS_YCbCr422ToBGR888LS_MCU_S16_U8_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr422ToBGR888LS_MCU_S16_U8_P3C3R OMXCATBAR(IPCS_YCbCr422ToBGR888LS_MCU_S16_U8_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_CbYCrY422ToYCbCr420Rotate_U8_C2P3R OMXCATBAR(IPCS_CbYCrY422ToYCbCr420Rotate_U8_C2P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr422ToYCbCr420Rotate_U8_P3R OMXCATBAR(IPCS_YCbCr422ToYCbCr420Rotate_U8_P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr444ToBGR565_U8_U16_C3R OMXCATBAR(IPCS_YCbCr444ToBGR565_U8_U16_C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr444ToBGR565_U8_U16_P3C3R OMXCATBAR(IPCS_YCbCr444ToBGR565_U8_U16_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr444ToBGR565LS_MCU_S16_U16_P3C3R OMXCATBAR(IPCS_YCbCr444ToBGR565LS_MCU_S16_U16_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr444ToBGR888_U8_C3R OMXCATBAR(IPCS_YCbCr444ToBGR888_U8_C3R, OMXIPCS_SUFFIX)
-
-#define omxIPPP_Deblock_HorEdge_U8_I OMXCATBAR(IPPP_Deblock_HorEdge_U8_I, OMXIPPP_SUFFIX)
-#define omxIPPP_Deblock_VerEdge_U8_I OMXCATBAR(IPPP_Deblock_VerEdge_U8_I, OMXIPPP_SUFFIX)
-#define omxIPPP_FilterFIR_U8_C1R OMXCATBAR(IPPP_FilterFIR_U8_C1R, OMXIPPP_SUFFIX)
-#define omxIPPP_FilterMedian_U8_C1R OMXCATBAR(IPPP_FilterMedian_U8_C1R, OMXIPPP_SUFFIX)
-#define omxIPPP_GetCentralMoment_S64 OMXCATBAR(IPPP_GetCentralMoment_S64, OMXIPPP_SUFFIX)
-#define omxIPPP_GetSpatialMoment_S64 OMXCATBAR(IPPP_GetSpatialMoment_S64, OMXIPPP_SUFFIX)
-#define omxIPPP_MomentGetStateSize OMXCATBAR(IPPP_MomentGetStateSize, OMXIPPP_SUFFIX)
-#define omxIPPP_MomentInit OMXCATBAR(IPPP_MomentInit, OMXIPPP_SUFFIX)
-#define omxIPPP_Moments_U8_C1R OMXCATBAR(IPPP_Moments_U8_C1R, OMXIPPP_SUFFIX)
-#define omxIPPP_Moments_U8_C3R OMXCATBAR(IPPP_Moments_U8_C3R, OMXIPPP_SUFFIX)
-
-#define omxSP_BlockExp_S16 OMXCATBAR(SP_BlockExp_S16, OMXSP_SUFFIX)
-#define omxSP_BlockExp_S32 OMXCATBAR(SP_BlockExp_S32, OMXSP_SUFFIX)
-#define omxSP_Copy_S16 OMXCATBAR(SP_Copy_S16, OMXSP_SUFFIX)
-#define omxSP_DotProd_S16 OMXCATBAR(SP_DotProd_S16, OMXSP_SUFFIX)
-#define omxSP_DotProd_S16_Sfs OMXCATBAR(SP_DotProd_S16_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTFwd_CToC_SC16_Sfs OMXCATBAR(SP_FFTFwd_CToC_SC16_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTFwd_CToC_SC32_Sfs OMXCATBAR(SP_FFTFwd_CToC_SC32_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTFwd_RToCCS_S16S32_Sfs OMXCATBAR(SP_FFTFwd_RToCCS_S16S32_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTFwd_RToCCS_S32_Sfs OMXCATBAR(SP_FFTFwd_RToCCS_S32_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTGetBufSize_C_SC16 OMXCATBAR(SP_FFTGetBufSize_C_SC16, OMXSP_SUFFIX)
-#define omxSP_FFTGetBufSize_C_SC32 OMXCATBAR(SP_FFTGetBufSize_C_SC32, OMXSP_SUFFIX)
-#define omxSP_FFTGetBufSize_R_S16S32 OMXCATBAR(SP_FFTGetBufSize_R_S16S32, OMXSP_SUFFIX)
-#define omxSP_FFTGetBufSize_R_S32 OMXCATBAR(SP_FFTGetBufSize_R_S32, OMXSP_SUFFIX)
-#define omxSP_FFTInit_C_SC16 OMXCATBAR(SP_FFTInit_C_SC16, OMXSP_SUFFIX)
-#define omxSP_FFTInit_C_SC32 OMXCATBAR(SP_FFTInit_C_SC32, OMXSP_SUFFIX)
-#define omxSP_FFTInit_R_S16S32 OMXCATBAR(SP_FFTInit_R_S16S32, OMXSP_SUFFIX)
-#define omxSP_FFTInit_R_S32 OMXCATBAR(SP_FFTInit_R_S32, OMXSP_SUFFIX)
-#define omxSP_FFTInv_CCSToR_S32_Sfs OMXCATBAR(SP_FFTInv_CCSToR_S32_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTInv_CCSToR_S32S16_Sfs OMXCATBAR(SP_FFTInv_CCSToR_S32S16_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTInv_CToC_SC16_Sfs OMXCATBAR(SP_FFTInv_CToC_SC16_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTInv_CToC_SC32_Sfs OMXCATBAR(SP_FFTInv_CToC_SC32_Sfs, OMXSP_SUFFIX)
-#define omxSP_FilterMedian_S32 OMXCATBAR(SP_FilterMedian_S32, OMXSP_SUFFIX)
-#define omxSP_FilterMedian_S32_I OMXCATBAR(SP_FilterMedian_S32_I, OMXSP_SUFFIX)
-#define omxSP_FIR_Direct_S16 OMXCATBAR(SP_FIR_Direct_S16, OMXSP_SUFFIX)
-#define omxSP_FIR_Direct_S16_I OMXCATBAR(SP_FIR_Direct_S16_I, OMXSP_SUFFIX)
-#define omxSP_FIR_Direct_S16_ISfs OMXCATBAR(SP_FIR_Direct_S16_ISfs, OMXSP_SUFFIX)
-#define omxSP_FIR_Direct_S16_Sfs OMXCATBAR(SP_FIR_Direct_S16_Sfs, OMXSP_SUFFIX)
-#define omxSP_FIROne_Direct_S16 OMXCATBAR(SP_FIROne_Direct_S16, OMXSP_SUFFIX)
-#define omxSP_FIROne_Direct_S16_I OMXCATBAR(SP_FIROne_Direct_S16_I, OMXSP_SUFFIX)
-#define omxSP_FIROne_Direct_S16_ISfs OMXCATBAR(SP_FIROne_Direct_S16_ISfs, OMXSP_SUFFIX)
-#define omxSP_FIROne_Direct_S16_Sfs OMXCATBAR(SP_FIROne_Direct_S16_Sfs, OMXSP_SUFFIX)
-#define omxSP_IIR_BiQuadDirect_S16 OMXCATBAR(SP_IIR_BiQuadDirect_S16, OMXSP_SUFFIX)
-#define omxSP_IIR_BiQuadDirect_S16_I OMXCATBAR(SP_IIR_BiQuadDirect_S16_I, OMXSP_SUFFIX)
-#define omxSP_IIR_Direct_S16 OMXCATBAR(SP_IIR_Direct_S16, OMXSP_SUFFIX)
-#define omxSP_IIR_Direct_S16_I OMXCATBAR(SP_IIR_Direct_S16_I, OMXSP_SUFFIX)
-#define omxSP_IIROne_BiQuadDirect_S16 OMXCATBAR(SP_IIROne_BiQuadDirect_S16, OMXSP_SUFFIX)
-#define omxSP_IIROne_BiQuadDirect_S16_I OMXCATBAR(SP_IIROne_BiQuadDirect_S16_I, OMXSP_SUFFIX)
-#define omxSP_IIROne_Direct_S16 OMXCATBAR(SP_IIROne_Direct_S16, OMXSP_SUFFIX)
-#define omxSP_IIROne_Direct_S16_I OMXCATBAR(SP_IIROne_Direct_S16_I, OMXSP_SUFFIX)
-
-#define omxVCCOMM_Average_16x OMXCATBAR(VCCOMM_Average_16x, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_Average_8x OMXCATBAR(VCCOMM_Average_8x, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_ComputeTextureErrorBlock OMXCATBAR(VCCOMM_ComputeTextureErrorBlock, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_ComputeTextureErrorBlock_SAD OMXCATBAR(VCCOMM_ComputeTextureErrorBlock_SAD, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_Copy16x16 OMXCATBAR(VCCOMM_Copy16x16, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_Copy8x8 OMXCATBAR(VCCOMM_Copy8x8, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_ExpandFrame_I OMXCATBAR(VCCOMM_ExpandFrame_I, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_LimitMVToRect OMXCATBAR(VCCOMM_LimitMVToRect, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_SAD_16x OMXCATBAR(VCCOMM_SAD_16x, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_SAD_8x OMXCATBAR(VCCOMM_SAD_8x, OMXVCCOMM_SUFFIX)
-
-#define omxVCM4P10_Average_4x OMXCATBAR(VCM4P10_Average_4x, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_BlockMatch_Half OMXCATBAR(VCM4P10_BlockMatch_Half, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_BlockMatch_Integer OMXCATBAR(VCM4P10_BlockMatch_Integer, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_BlockMatch_Quarter OMXCATBAR(VCM4P10_BlockMatch_Quarter, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_DeblockChroma_I OMXCATBAR(VCM4P10_DeblockChroma_I, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_DeblockLuma_I OMXCATBAR(VCM4P10_DeblockLuma_I, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC OMXCATBAR(VCM4P10_DecodeChromaDcCoeffsToPairCAVLC, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_DecodeCoeffsToPairCAVLC OMXCATBAR(VCM4P10_DecodeCoeffsToPairCAVLC, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_DequantTransformResidualFromPairAndAdd OMXCATBAR(VCM4P10_DequantTransformResidualFromPairAndAdd, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_FilterDeblockingChroma_HorEdge_I OMXCATBAR(VCM4P10_FilterDeblockingChroma_HorEdge_I, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_FilterDeblockingChroma_VerEdge_I OMXCATBAR(VCM4P10_FilterDeblockingChroma_VerEdge_I, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_FilterDeblockingLuma_HorEdge_I OMXCATBAR(VCM4P10_FilterDeblockingLuma_HorEdge_I, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_FilterDeblockingLuma_VerEdge_I OMXCATBAR(VCM4P10_FilterDeblockingLuma_VerEdge_I, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_GetVLCInfo OMXCATBAR(VCM4P10_GetVLCInfo, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InterpolateChroma OMXCATBAR(VCM4P10_InterpolateChroma, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InterpolateHalfHor_Luma OMXCATBAR(VCM4P10_InterpolateHalfHor_Luma, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InterpolateHalfVer_Luma OMXCATBAR(VCM4P10_InterpolateHalfVer_Luma, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InterpolateLuma OMXCATBAR(VCM4P10_InterpolateLuma, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InvTransformDequant_ChromaDC OMXCATBAR(VCM4P10_InvTransformDequant_ChromaDC, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InvTransformDequant_LumaDC OMXCATBAR(VCM4P10_InvTransformDequant_LumaDC, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InvTransformResidualAndAdd OMXCATBAR(VCM4P10_InvTransformResidualAndAdd, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_MEGetBufSize OMXCATBAR(VCM4P10_MEGetBufSize, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_MEInit OMXCATBAR(VCM4P10_MEInit, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_MotionEstimationMB OMXCATBAR(VCM4P10_MotionEstimationMB, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_PredictIntra_16x16 OMXCATBAR(VCM4P10_PredictIntra_16x16, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_PredictIntra_4x4 OMXCATBAR(VCM4P10_PredictIntra_4x4, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_PredictIntraChroma_8x8 OMXCATBAR(VCM4P10_PredictIntraChroma_8x8, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_SAD_4x OMXCATBAR(VCM4P10_SAD_4x, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_SADQuar_16x OMXCATBAR(VCM4P10_SADQuar_16x, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_SADQuar_4x OMXCATBAR(VCM4P10_SADQuar_4x, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_SADQuar_8x OMXCATBAR(VCM4P10_SADQuar_8x, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_SATD_4x4 OMXCATBAR(VCM4P10_SATD_4x4, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_SubAndTransformQDQResidual OMXCATBAR(VCM4P10_SubAndTransformQDQResidual, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_TransformDequantChromaDCFromPair OMXCATBAR(VCM4P10_TransformDequantChromaDCFromPair, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_TransformDequantLumaDCFromPair OMXCATBAR(VCM4P10_TransformDequantLumaDCFromPair, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_TransformQuant_ChromaDC OMXCATBAR(VCM4P10_TransformQuant_ChromaDC, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_TransformQuant_LumaDC OMXCATBAR(VCM4P10_TransformQuant_LumaDC, OMXVCM4P10_SUFFIX)
-
-#define omxVCM4P2_BlockMatch_Half_16x16 OMXCATBAR(VCM4P2_BlockMatch_Half_16x16, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_BlockMatch_Half_8x8 OMXCATBAR(VCM4P2_BlockMatch_Half_8x8, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_BlockMatch_Integer_16x16 OMXCATBAR(VCM4P2_BlockMatch_Integer_16x16, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_BlockMatch_Integer_8x8 OMXCATBAR(VCM4P2_BlockMatch_Integer_8x8, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DCT8x8blk OMXCATBAR(VCM4P2_DCT8x8blk, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DecodeBlockCoef_Inter OMXCATBAR(VCM4P2_DecodeBlockCoef_Inter, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DecodeBlockCoef_Intra OMXCATBAR(VCM4P2_DecodeBlockCoef_Intra, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DecodePadMV_PVOP OMXCATBAR(VCM4P2_DecodePadMV_PVOP, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DecodeVLCZigzag_Inter OMXCATBAR(VCM4P2_DecodeVLCZigzag_Inter, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DecodeVLCZigzag_IntraACVLC OMXCATBAR(VCM4P2_DecodeVLCZigzag_IntraACVLC, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DecodeVLCZigzag_IntraDCVLC OMXCATBAR(VCM4P2_DecodeVLCZigzag_IntraDCVLC, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_EncodeMV OMXCATBAR(VCM4P2_EncodeMV, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_EncodeVLCZigzag_Inter OMXCATBAR(VCM4P2_EncodeVLCZigzag_Inter, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_EncodeVLCZigzag_IntraACVLC OMXCATBAR(VCM4P2_EncodeVLCZigzag_IntraACVLC, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_EncodeVLCZigzag_IntraDCVLC OMXCATBAR(VCM4P2_EncodeVLCZigzag_IntraDCVLC, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_FindMVpred OMXCATBAR(VCM4P2_FindMVpred, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_IDCT8x8blk OMXCATBAR(VCM4P2_IDCT8x8blk, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_MCReconBlock OMXCATBAR(VCM4P2_MCReconBlock, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_MEGetBufSize OMXCATBAR(VCM4P2_MEGetBufSize, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_MEInit OMXCATBAR(VCM4P2_MEInit, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_MotionEstimationMB OMXCATBAR(VCM4P2_MotionEstimationMB, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_PredictReconCoefIntra OMXCATBAR(VCM4P2_PredictReconCoefIntra, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_QuantInter_I OMXCATBAR(VCM4P2_QuantInter_I, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_QuantIntra_I OMXCATBAR(VCM4P2_QuantIntra_I, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_QuantInvInter_I OMXCATBAR(VCM4P2_QuantInvInter_I, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_QuantInvIntra_I OMXCATBAR(VCM4P2_QuantInvIntra_I, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_TransRecBlockCoef_inter OMXCATBAR(VCM4P2_TransRecBlockCoef_inter, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_TransRecBlockCoef_intra OMXCATBAR(VCM4P2_TransRecBlockCoef_intra, OMXVCM4P2_SUFFIX)
-
-
-#endif /* _armOMX_h_ */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/omxtypes.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/omxtypes.h
deleted file mode 100644
index 912cb0d..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/omxtypes.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/**
- * File: omxtypes.h
- * Brief: Defines basic Data types used in OpenMAX v1.0.2 header files.
- *
- * Copyright © 2005-2008 The Khronos Group Inc. All Rights Reserved.
- *
- * These materials are protected by copyright laws and contain material
- * proprietary to the Khronos Group, Inc. You may use these materials
- * for implementing Khronos specifications, without altering or removing
- * any trademark, copyright or other notice from the specification.
- *
- * Khronos Group makes no, and expressly disclaims any, representations
- * or warranties, express or implied, regarding these materials, including,
- * without limitation, any implied warranties of merchantability or fitness
- * for a particular purpose or non-infringement of any intellectual property.
- * Khronos Group makes no, and expressly disclaims any, warranties, express
- * or implied, regarding the correctness, accuracy, completeness, timeliness,
- * and reliability of these materials.
- *
- * Under no circumstances will the Khronos Group, or any of its Promoters,
- * Contributors or Members or their respective partners, officers, directors,
- * employees, agents or representatives be liable for any damages, whether
- * direct, indirect, special or consequential damages for lost revenues,
- * lost profits, or otherwise, arising from or in connection with these
- * materials.
- *
- * Khronos and OpenMAX are trademarks of the Khronos Group Inc.
- *
- */
-
-#ifndef _OMXTYPES_H_
-#define _OMXTYPES_H_
-
-#include <limits.h>
-#include <stdint.h>
-
-#define OMX_IN
-#define OMX_OUT
-#define OMX_INOUT
-
-
-typedef enum {
-
- /* Mandatory return codes - use cases are explicitly described for each function */
- OMX_Sts_NoErr = 0, /* No error, the function completed successfully */
- OMX_Sts_Err = -2, /* Unknown/unspecified error */
- OMX_Sts_InvalidBitstreamValErr = -182, /* Invalid value detected during bitstream processing */
- OMX_Sts_MemAllocErr = -9, /* Not enough memory allocated for the operation */
- OMX_StsACAAC_GainCtrErr = -159, /* AAC: Unsupported gain control data detected */
- OMX_StsACAAC_PrgNumErr = -167, /* AAC: Invalid number of elements for one program */
- OMX_StsACAAC_CoefValErr = -163, /* AAC: Invalid quantized coefficient value */
- OMX_StsACAAC_MaxSfbErr = -162, /* AAC: Invalid maxSfb value in relation to numSwb */
- OMX_StsACAAC_PlsDataErr = -160, /* AAC: pulse escape sequence data error */
-
- /* Optional return codes - use cases are explicitly described for each function*/
- OMX_Sts_BadArgErr = -5, /* Bad Arguments */
-
- OMX_StsACAAC_TnsNumFiltErr = -157, /* AAC: Invalid number of TNS filters */
- OMX_StsACAAC_TnsLenErr = -156, /* AAC: Invalid TNS region length */
- OMX_StsACAAC_TnsOrderErr = -155, /* AAC: Invalid order of TNS filter */
- OMX_StsACAAC_TnsCoefResErr = -154, /* AAC: Invalid bit-resolution for TNS filter coefficients */
- OMX_StsACAAC_TnsCoefErr = -153, /* AAC: Invalid TNS filter coefficients */
- OMX_StsACAAC_TnsDirectErr = -152, /* AAC: Invalid TNS filter direction */
-
- OMX_StsICJP_JPEGMarkerErr = -183, /* JPEG marker encountered within an entropy-coded block; */
- /* Huffman decoding operation terminated early. */
- OMX_StsICJP_JPEGMarker = -181, /* JPEG marker encountered; Huffman decoding */
- /* operation terminated early. */
- OMX_StsIPPP_ContextMatchErr = -17, /* Context parameter doesn't match to the operation */
-
- OMX_StsSP_EvenMedianMaskSizeErr = -180, /* Even size of the Median Filter mask was replaced by the odd one */
-
- OMX_Sts_MaximumEnumeration = INT_MAX /*Placeholder, forces enum of size OMX_INT*/
-
- } OMXResult; /** Return value or error value returned from a function. Identical to OMX_INT */
-
-
-/* OMX_U8 */
-typedef uint8_t OMX_U8;
-
-/* OMX_S8 */
-typedef int8_t OMX_S8;
-
-/* OMX_U16 */
-typedef uint16_t OMX_U16;
-
-/* OMX_S16 */
-typedef int16_t OMX_S16;
-
-/* OMX_U32 */
-typedef uint32_t OMX_U32;
-
-/* OMX_S32 */
-typedef int32_t OMX_S32;
-
-/* OMX_U64 & OMX_S64 */
-#if defined( _WIN32 ) || defined ( _WIN64 )
- typedef __int64 OMX_S64; /** Signed 64-bit integer */
- typedef unsigned __int64 OMX_U64; /** Unsigned 64-bit integer */
- #define OMX_MIN_S64 (0x8000000000000000i64)
- #define OMX_MIN_U64 (0x0000000000000000i64)
- #define OMX_MAX_S64 (0x7FFFFFFFFFFFFFFFi64)
- #define OMX_MAX_U64 (0xFFFFFFFFFFFFFFFFi64)
-#else
- typedef int64_t OMX_S64; /** Signed 64-bit integer */
- typedef uint64_t OMX_U64; /** Unsigned 64-bit integer */
- #define OMX_MIN_S64 (0x8000000000000000LL)
- #define OMX_MIN_U64 (0x0000000000000000LL)
- #define OMX_MAX_S64 (0x7FFFFFFFFFFFFFFFLL)
- #define OMX_MAX_U64 (0xFFFFFFFFFFFFFFFFLL)
-#endif
-
-/* OMX_SC8 */
-typedef struct
-{
- OMX_S8 Re; /** Real part */
- OMX_S8 Im; /** Imaginary part */
-
-} OMX_SC8; /** Signed 8-bit complex number */
-
-
-/* OMX_SC16 */
-typedef struct
-{
- OMX_S16 Re; /** Real part */
- OMX_S16 Im; /** Imaginary part */
-
-} OMX_SC16; /** Signed 16-bit complex number */
-
-
-/* OMX_SC32 */
-typedef struct
-{
- OMX_S32 Re; /** Real part */
- OMX_S32 Im; /** Imaginary part */
-
-} OMX_SC32; /** Signed 32-bit complex number */
-
-
-/* OMX_SC64 */
-typedef struct
-{
- OMX_S64 Re; /** Real part */
- OMX_S64 Im; /** Imaginary part */
-
-} OMX_SC64; /** Signed 64-bit complex number */
-
-
-/* OMX_F32 */
-typedef float OMX_F32; /** Single precision floating point,IEEE 754 */
-
-
-/* OMX_F64 */
-typedef double OMX_F64; /** Double precision floating point,IEEE 754 */
-
-
-/* OMX_INT */
-typedef int OMX_INT; /** signed integer corresponding to machine word length, has maximum signed value INT_MAX*/
-
-
-#define OMX_MIN_S8 (-128)
-#define OMX_MIN_U8 0
-#define OMX_MIN_S16 (-32768)
-#define OMX_MIN_U16 0
-#define OMX_MIN_S32 (-2147483647-1)
-#define OMX_MIN_U32 0
-
-#define OMX_MAX_S8 (127)
-#define OMX_MAX_U8 (255)
-#define OMX_MAX_S16 (32767)
-#define OMX_MAX_U16 (0xFFFF)
-#define OMX_MAX_S32 (2147483647)
-#define OMX_MAX_U32 (0xFFFFFFFF)
-
-typedef void OMXVoid;
-
-#ifndef NULL
-#define NULL ((void*)0)
-#endif
-
-/** Defines the geometric position and size of a rectangle,
- * where x,y defines the coordinates of the top left corner
- * of the rectangle, with dimensions width in the x-direction
- * and height in the y-direction */
-typedef struct {
- OMX_INT x; /** x-coordinate of top left corner of rectangle */
- OMX_INT y; /** y-coordinate of top left corner of rectangle */
- OMX_INT width; /** Width in the x-direction. */
- OMX_INT height; /** Height in the y-direction. */
-}OMXRect;
-
-
-/** Defines the geometric position of a point, */
-typedef struct
-{
- OMX_INT x; /** x-coordinate */
- OMX_INT y; /** y-coordinate */
-
-} OMXPoint;
-
-
-/** Defines the dimensions of a rectangle, or region of interest in an image */
-typedef struct
-{
- OMX_INT width; /** Width of the rectangle, in the x-direction */
- OMX_INT height; /** Height of the rectangle, in the y-direction */
-
-} OMXSize;
-
-#endif /* _OMXTYPES_H_ */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/omxtypes_s.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/omxtypes_s.h
deleted file mode 100644
index 6e742c7..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/api/omxtypes_s.h
+++ /dev/null
@@ -1,91 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxtypes_s.h
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
-;// Mandatory return codes - use cases are explicitly described for each function
-OMX_Sts_NoErr EQU 0 ;// No error the function completed successfully
-OMX_Sts_Err EQU -2 ;// Unknown/unspecified error
-OMX_Sts_InvalidBitstreamValErr EQU -182 ;// Invalid value detected during bitstream processing
-OMX_Sts_MemAllocErr EQU -9 ;// Not enough memory allocated for the operation
-OMX_StsACAAC_GainCtrErr EQU -159 ;// AAC: Unsupported gain control data detected
-OMX_StsACAAC_PrgNumErr EQU -167 ;// AAC: Invalid number of elements for one program
-OMX_StsACAAC_CoefValErr EQU -163 ;// AAC: Invalid quantized coefficient value
-OMX_StsACAAC_MaxSfbErr EQU -162 ;// AAC: Invalid maxSfb value in relation to numSwb
-OMX_StsACAAC_PlsDataErr EQU -160 ;// AAC: pulse escape sequence data error
-
-;// Optional return codes - use cases are explicitly described for each function
-OMX_Sts_BadArgErr EQU -5 ;// Bad Arguments
-
-OMX_StsACAAC_TnsNumFiltErr EQU -157 ;// AAC: Invalid number of TNS filters
-OMX_StsACAAC_TnsLenErr EQU -156 ;// AAC: Invalid TNS region length
-OMX_StsACAAC_TnsOrderErr EQU -155 ;// AAC: Invalid order of TNS filter
-OMX_StsACAAC_TnsCoefResErr EQU -154 ;// AAC: Invalid bit-resolution for TNS filter coefficients
-OMX_StsACAAC_TnsCoefErr EQU -153 ;// AAC: Invalid TNS filter coefficients
-OMX_StsACAAC_TnsDirectErr EQU -152 ;// AAC: Invalid TNS filter direction
-
-OMX_StsICJP_JPEGMarkerErr EQU -183 ;// JPEG marker encountered within an entropy-coded block;
- ;// Huffman decoding operation terminated early.
-OMX_StsICJP_JPEGMarker EQU -181 ;// JPEG marker encountered; Huffman decoding
- ;// operation terminated early.
-OMX_StsIPPP_ContextMatchErr EQU -17 ;// Context parameter doesn't match to the operation
-
-OMX_StsSP_EvenMedianMaskSizeErr EQU -180 ;// Even size of the Median Filter mask was replaced by the odd one
-
-OMX_Sts_MaximumEnumeration EQU 0x7FFFFFFF
-
-
-
-OMX_MIN_S8 EQU (-128)
-OMX_MIN_U8 EQU 0
-OMX_MIN_S16 EQU (-32768)
-OMX_MIN_U16 EQU 0
-
-
-OMX_MIN_S32 EQU (-2147483647-1)
-OMX_MIN_U32 EQU 0
-
-OMX_MAX_S8 EQU (127)
-OMX_MAX_U8 EQU (255)
-OMX_MAX_S16 EQU (32767)
-OMX_MAX_U16 EQU (0xFFFF)
-OMX_MAX_S32 EQU (2147483647)
-OMX_MAX_U32 EQU (0xFFFFFFFF)
-
-OMX_VC_UPPER EQU 0x1 ;// Used by the PredictIntra functions
-OMX_VC_LEFT EQU 0x2 ;// Used by the PredictIntra functions
-OMX_VC_UPPER_RIGHT EQU 0x40 ;// Used by the PredictIntra functions
-
-NULL EQU 0
-
-;// Structures
-
- INCLUDE armCOMM_s.h
-
- M_STRUCT OMXPoint
- M_FIELD x, 4
- M_FIELD y, 4
- M_ENDSTRUCT
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/build_vc.pl b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/build_vc.pl
deleted file mode 100755
index 6a206c0..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/build_vc.pl
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-#!/usr/bin/perl
-#
-#
-# File Name: build_vc.pl
-# OpenMAX DL: v1.0.2
-# Revision: 12290
-# Date: Wednesday, April 9, 2008
-#
-#
-#
-#
-# This file builds the OpenMAX DL vc domain library omxVC.o.
-#
-
-use File::Spec;
-use strict;
-
-my ($CC, $CC_OPTS, $AS, $AS_OPTS, $LIB, $LIB_OPTS, $LIB_TYPE);
-
-$CC = 'armcc';
-$CC_OPTS = '--no_unaligned_access --cpu Cortex-A8 -c';
-$AS = 'armasm';
-$AS_OPTS = '--no_unaligned_access --cpu Cortex-A8';
-# $LIB = 'armlink';
-# $LIB_OPTS = '--partial -o';
-# $LIB_TYPE = '.o';
-$LIB = 'armar';
-$LIB_OPTS = '--create -r';
-$LIB_TYPE = '.a';
-
-#------------------------
-
-my (@headerlist, @filelist, $hd, $file, $ofile, $command, $objlist, $libfile, $h);
-
-# Define the list of directories containing included header files.
-@headerlist = qw(api vc/api vc/m4p2/api vc/m4p10/api);
-
-# Define the list of source files to compile.
-open(FILES, '<filelist_vc.txt') or die("Can't open source file list\n");
-@filelist = <FILES>;
-close(FILES);
-
-# Fix the file separators in the header paths
-foreach $h (@headerlist)
-{
- $h = File::Spec->canonpath($h);
-}
-
-# Create the include path to be passed to the compiler
-$hd = '-I' . join(' -I', @headerlist);
-
-# Create the build directories "/lib/" and "/obj/" (if they are not there already)
-mkdir "obj", 0777 if (! -d "obj");
-mkdir "lib", 0777 if (! -d "lib");
-
-$objlist = '';
-
-# Compile each file
-foreach $file (@filelist)
-{
- my $f;
- my $base;
- my $ext;
- my $objfile;
-
- chomp($file);
- $file = File::Spec->canonpath($file);
-
- (undef, undef, $f) = File::Spec->splitpath($file);
- $f=~s/[\n\f\r]//g; # Remove any end-of-line characters
-
- if(($base, $ext) = $f =~ /(.+)\.(\w)$/)
- {
- $objfile = File::Spec->catfile('obj', $base.'.o');
-
- if($ext eq 'c')
- {
- $objlist .= "$objfile ";
- $command = $CC.' '.$CC_OPTS.' '.$hd.' -o '.$objfile.' '.$file;
- print "$command\n";
- system($command);
- }
- elsif($ext eq 's')
- {
- $objlist .= "$objfile ";
- $command = $AS.' '.$AS_OPTS.' '.$hd.' -o '.$objfile.' '.$file;
- print "$command\n";
- system($command);
- }
- else
- {
- print "Ignoring file: $f\n";
- }
- }
- else
- {
- die "No file extension found: $f\n";
- }
-}
-
-# Do the final link stage to create the libraries.
-$libfile = File::Spec->catfile('lib', 'omxVC'.$LIB_TYPE);
-$command = $LIB.' '.$LIB_OPTS.' '.$libfile.' '.$objlist;
-print "$command\n";
-(system($command) == 0) and print "Build successful\n";
-
-
-
-
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/filelist_vc.txt b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/filelist_vc.txt
deleted file mode 100644
index 8db8eeb..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/filelist_vc.txt
+++ /dev/null
@@ -1,75 +0,0 @@
-./api/armCOMM.h
-./api/armCOMM_BitDec_s.h
-./api/armCOMM_Bitstream.h
-./api/armCOMM_IDCT_s.h
-./api/armCOMM_IDCTTable.h
-./api/armCOMM_MaskTable.h
-./api/armCOMM_s.h
-./api/armCOMM_Version.h
-./api/armOMX_ReleaseVersion.h
-./api/omxtypes.h
-./api/omxtypes_s.h
-./src/armCOMM_IDCTTable.c
-./src/armCOMM_MaskTable.c
-./vc/api/armVC.h
-./vc/api/armVCCOMM_s.h
-./vc/api/omxVC.h
-./vc/api/omxVC_s.h
-./vc/comm/src/omxVCCOMM_Copy16x16_s.s
-./vc/comm/src/omxVCCOMM_Copy8x8_s.s
-./vc/comm/src/omxVCCOMM_ExpandFrame_I_s.s
-./vc/m4p10/api/armVCM4P10_CAVLCTables.h
-./vc/m4p10/src/armVCM4P10_Average_4x_Align_unsafe_s.s
-./vc/m4p10/src/armVCM4P10_CAVLCTables.c
-./vc/m4p10/src/armVCM4P10_DeblockingChroma_unsafe_s.s
-./vc/m4p10/src/armVCM4P10_DeblockingLuma_unsafe_s.s
-./vc/m4p10/src/armVCM4P10_DecodeCoeffsToPair_s.s
-./vc/m4p10/src/armVCM4P10_DequantTables_s.s
-./vc/m4p10/src/armVCM4P10_Interpolate_Chroma_s.s
-./vc/m4p10/src/armVCM4P10_InterpolateLuma_Align_unsafe_s.s
-./vc/m4p10/src/armVCM4P10_InterpolateLuma_Copy_unsafe_s.s
-./vc/m4p10/src/armVCM4P10_InterpolateLuma_DiagCopy_unsafe_s.s
-./vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe_s.s
-./vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe_s.s
-./vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe_s.s
-./vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe_s.s
-./vc/m4p10/src/armVCM4P10_QuantTables_s.s
-./vc/m4p10/src/armVCM4P10_TransformResidual4x4_s.s
-./vc/m4p10/src/armVCM4P10_UnpackBlock4x4_s.s
-./vc/m4p10/src/omxVCM4P10_DeblockChroma_I.c
-./vc/m4p10/src/omxVCM4P10_DeblockLuma_I.c
-./vc/m4p10/src/omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC.c
-./vc/m4p10/src/omxVCM4P10_DecodeCoeffsToPairCAVLC.c
-./vc/m4p10/src/omxVCM4P10_DequantTransformResidualFromPairAndAdd_s.s
-./vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_HorEdge_I_s.s
-./vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_VerEdge_I_s.s
-./vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_HorEdge_I_s.s
-./vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_VerEdge_I_s.s
-./vc/m4p10/src/omxVCM4P10_InterpolateChroma.c
-./vc/m4p10/src/omxVCM4P10_InterpolateLuma_s.s
-./vc/m4p10/src/omxVCM4P10_PredictIntra_16x16_s.s
-./vc/m4p10/src/omxVCM4P10_PredictIntra_4x4_s.s
-./vc/m4p10/src/omxVCM4P10_PredictIntraChroma_8x8_s.s
-./vc/m4p10/src/omxVCM4P10_TransformDequantChromaDCFromPair_s.s
-./vc/m4p10/src/omxVCM4P10_TransformDequantLumaDCFromPair_s.s
-./vc/m4p2/api/armVCM4P2_Huff_Tables_VLC.h
-./vc/m4p2/api/armVCM4P2_ZigZag_Tables.h
-./vc/m4p2/src/armVCM4P2_Clip8_s.s
-./vc/m4p2/src/armVCM4P2_DecodeVLCZigzag_AC_unsafe_s.s
-./vc/m4p2/src/armVCM4P2_Huff_Tables_VLC.c
-./vc/m4p2/src/armVCM4P2_Lookup_Tables.c
-./vc/m4p2/src/armVCM4P2_SetPredDir_s.s
-./vc/m4p2/src/armVCM4P2_Zigzag_Tables.c
-./vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Inter.c
-./vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Intra.c
-./vc/m4p2/src/omxVCM4P2_DecodePadMV_PVOP_s.s
-./vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_Inter_s.s
-./vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraACVLC_s.s
-./vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraDCVLC_s.s
-./vc/m4p2/src/omxVCM4P2_FindMVpred_s.s
-./vc/m4p2/src/omxVCM4P2_IDCT8x8blk_s.s
-./vc/m4p2/src/omxVCM4P2_MCReconBlock_s.s
-./vc/m4p2/src/omxVCM4P2_PredictReconCoefIntra_s.s
-./vc/m4p2/src/omxVCM4P2_QuantInvInter_I_s.s
-./vc/m4p2/src/omxVCM4P2_QuantInvIntra_I_s.s
-./vc/src/armVC_Version.c
\ No newline at end of file
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/src/armCOMM.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/src/armCOMM.c
deleted file mode 100644
index e8dbf41..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/src/armCOMM.c
+++ /dev/null
@@ -1,951 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armCOMM.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Defines Common APIs used across OpenMAX API's
- */
-
-#include "omxtypes.h"
-#include "armCOMM.h"
-
-/***********************************************************************/
- /* Miscellaneous Arithmetic operations */
-
-/**
- * Function: armRoundFloatToS16
- *
- * Description:
- * Converts a double precision value into a short int after rounding
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S16 format
- *
- */
-
-OMX_S16 armRoundFloatToS16 (OMX_F64 Value)
-{
- if (Value > 0)
- {
- return (OMX_S16)(Value + .5);
- }
- else
- {
- return (OMX_S16)(Value - .5);
- }
-}
-
-/**
- * Function: armRoundFloatToS32
- *
- * Description:
- * Converts a double precision value into a int after rounding
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S32 format
- *
- */
-
-OMX_S32 armRoundFloatToS32 (OMX_F64 Value)
-{
- if (Value > 0)
- {
- return (OMX_S32)(Value + .5);
- }
- else
- {
- return (OMX_S32)(Value - .5);
- }
-}
-/**
- * Function: armSatRoundFloatToS16
- *
- * Description:
- * Converts a double precision value into a short int after rounding and saturation
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S16 format
- *
- */
-
-OMX_S16 armSatRoundFloatToS16 (OMX_F64 Value)
-{
- if (Value > 0)
- {
- Value += 0.5;
-
- if(Value > (OMX_S16)OMX_MAX_S16 )
- {
- return (OMX_S16)OMX_MAX_S16;
- }
- else
- {
- return (OMX_S16)Value;
- }
- }
- else
- {
- Value -= 0.5;
-
- if(Value < (OMX_S16)OMX_MIN_S16 )
- {
- return (OMX_S16)OMX_MIN_S16;
- }
- else
- {
- return (OMX_S16)Value;
- }
- }
-}
-
-/**
- * Function: armSatRoundFloatToS32
- *
- * Description:
- * Converts a double precision value into a int after rounding and saturation
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S32 format
- *
- */
-
-OMX_S32 armSatRoundFloatToS32 (OMX_F64 Value)
-{
- if (Value > 0)
- {
- Value += 0.5;
-
- if(Value > (OMX_S32)OMX_MAX_S32 )
- {
- return (OMX_S32)OMX_MAX_S32;
- }
- else
- {
- return (OMX_S32)Value;
- }
- }
- else
- {
- Value -= 0.5;
-
- if(Value < (OMX_S32)OMX_MIN_S32 )
- {
- return (OMX_S32)OMX_MIN_S32;
- }
- else
- {
- return (OMX_S32)Value;
- }
- }
-}
-
-/**
- * Function: armSatRoundFloatToU16
- *
- * Description:
- * Converts a double precision value into a unsigned short int after rounding and saturation
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_U16 format
- *
- */
-
-OMX_U16 armSatRoundFloatToU16 (OMX_F64 Value)
-{
- Value += 0.5;
-
- if(Value > (OMX_U16)OMX_MAX_U16 )
- {
- return (OMX_U16)OMX_MAX_U16;
- }
- else
- {
- return (OMX_U16)Value;
- }
-}
-
-/**
- * Function: armSatRoundFloatToU32
- *
- * Description:
- * Converts a double precision value into a unsigned int after rounding and saturation
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_U32 format
- *
- */
-
-OMX_U32 armSatRoundFloatToU32 (OMX_F64 Value)
-{
- Value += 0.5;
-
- if(Value > (OMX_U32)OMX_MAX_U32 )
- {
- return (OMX_U32)OMX_MAX_U32;
- }
- else
- {
- return (OMX_U32)Value;
- }
-}
-
-/**
- * Function: armRoundFloatToS64
- *
- * Description:
- * Converts a double precision value into a 64 bit int after rounding
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S64 format
- *
- */
-
-OMX_S64 armRoundFloatToS64 (OMX_F64 Value)
-{
- if (Value > 0)
- {
- return (OMX_S64)(Value + .5);
- }
- else
- {
- return (OMX_S64)(Value - .5);
- }
-}
-
-/**
- * Function: armSignCheck
- *
- * Description:
- * Checks the sign of a variable:
- * returns 1 if it is Positive
- * returns 0 if it is 0
- * returns -1 if it is Negative
- *
- * Remarks:
- *
- * Parameters:
- * [in] var Variable to be checked
- *
- * Return Value:
- * OMX_INT -- returns 1 if it is Positive
- * returns 0 if it is 0
- * returns -1 if it is Negative
- */
-
-OMX_INT armSignCheck (
- OMX_S16 var
-)
-
-{
- OMX_INT Sign;
-
- if (var < 0)
- {
- Sign = -1;
- }
- else if ( var > 0)
- {
- Sign = 1;
- }
- else
- {
- Sign = 0;
- }
-
- return Sign;
-}
-
-/**
- * Function: armClip
- *
- * Description: Clips the input between MAX and MIN value
- *
- *
- * Remarks:
- *
- * Parameters:
- * [in] Min lower bound
- * [in] Max upper bound
- * [in] src variable to the clipped
- *
- * Return Value:
- * OMX_S32 -- returns clipped value
- */
-
-OMX_S32 armClip (
- OMX_INT min,
- OMX_INT max,
- OMX_S32 src
-)
-
-{
- if (src > max)
- {
- src = max;
- }
- else if (src < min)
- {
- src = min;
- }
-
- return src;
-}
-
-/**
- * Function: armClip_F32
- *
- * Description: Clips the input between MAX and MIN value
- *
- *
- * Remarks:
- *
- * Parameters:
- * [in] Min lower bound
- * [in] Max upper bound
- * [in] src variable to the clipped
- *
- * Return Value:
- * OMX_F32 -- returns clipped value
- */
-
-OMX_F32 armClip_F32 (
- OMX_F32 min,
- OMX_F32 max,
- OMX_F32 src
-)
-
-{
- if (src > max)
- {
- src = max;
- }
- else if (src < min)
- {
- src = min;
- }
-
- return src;
-}
-
-/**
- * Function: armShiftSat_F32
- *
- * Description: Divides a float value by 2^shift and
- * saturates it for unsigned value range for satBits.
- * Second parameter is like "shifting" the corresponding
- * integer value. Takes care of rounding while clipping the final
- * value.
- *
- * Parameters:
- * [in] v Number to be operated upon
- * [in] shift Divides the input "v" by "2^shift"
- * [in] satBits Final range is [0, 2^satBits)
- *
- * Return Value:
- * OMX_S32 -- returns "shifted" saturated value
- */
-
-OMX_U32 armShiftSat_F32(OMX_F32 v, OMX_INT shift, OMX_INT satBits)
-{
- OMX_U32 allOnes = (OMX_U32)(-1);
- OMX_U32 maxV = allOnes >> (32-satBits);
- OMX_F32 vShifted, vRounded, shiftDiv = (OMX_F32)(1 << shift);
- OMX_U32 vInt;
- OMX_U32 vIntSat;
-
- if(v <= 0)
- return 0;
-
- vShifted = v / shiftDiv;
- vRounded = (OMX_F32)(vShifted + 0.5);
- vInt = (OMX_U32)vRounded;
- vIntSat = vInt;
- if(vIntSat > maxV)
- vIntSat = maxV;
- return vIntSat;
-}
-
-/**
- * Functions: armSwapElem
- *
- * Description:
- * These function swaps two elements at the specified pointer locations.
- * The size of each element could be anything as specified by <elemSize>
- *
- * Return Value:
- * OMXResult -- Error status from the function
- */
-OMXResult armSwapElem(
- OMX_U8 *pBuf1,
- OMX_U8 *pBuf2,
- OMX_INT elemSize
- )
-{
- OMX_INT i;
- OMX_U8 temp;
- armRetArgErrIf(!pBuf1 || !pBuf2, OMX_Sts_BadArgErr);
-
- for(i = 0; i < elemSize; i++)
- {
- temp = *(pBuf1 + i);
- *(pBuf1 + i) = *(pBuf2 + i);
- *(pBuf2 + i) = temp;
- }
- return OMX_Sts_NoErr;
-}
-
-/**
- * Function: armMedianOf3
- *
- * Description: Finds the median of three numbers
- *
- * Remarks:
- *
- * Parameters:
- * [in] fEntry First entry
- * [in] sEntry second entry
- * [in] tEntry Third entry
- *
- * Return Value:
- * OMX_S32 -- returns the median value
- */
-
-OMX_S32 armMedianOf3 (
- OMX_S32 fEntry,
- OMX_S32 sEntry,
- OMX_S32 tEntry
-)
-{
- OMX_S32 a, b, c;
-
- a = armMin (fEntry, sEntry);
- b = armMax (fEntry, sEntry);
- c = armMin (b, tEntry);
- return (armMax (a, c));
-}
-
-/**
- * Function: armLogSize
- *
- * Description: Finds the size of a positive value and returns the same
- *
- * Remarks:
- *
- * Parameters:
- * [in] value Positive value
- *
- * Return Value:
- * OMX_U8 -- Returns the minimum number of bits required to represent the positive value.
- This is the smallest k>=0 such that that value is less than (1<<k).
- */
-
-OMX_U8 armLogSize (
- OMX_U16 value
-)
-{
- OMX_U8 i;
- for ( i = 0; value > 0; value = value >> 1)
- {
- i++;
- }
- return i;
-}
-
-/***********************************************************************/
- /* Saturating Arithmetic operations */
-
-/**
- * Function :armSatAdd_S32()
- *
- * Description :
- * Returns the result of saturated addition of the two inputs Value1, Value2
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- *
- * Return:
- * [out] Result of operation
- *
- *
- **/
-
-OMX_S32 armSatAdd_S32(OMX_S32 Value1,OMX_S32 Value2)
-{
- OMX_S32 Result;
-
- Result = Value1 + Value2;
-
- if( (Value1^Value2) >= 0)
- {
- /*Same sign*/
- if( (Result^Value1) >= 0)
- {
- /*Result has not saturated*/
- return Result;
- }
- else
- {
- if(Value1 >= 0)
- {
- /*Result has saturated in positive side*/
- return OMX_MAX_S32;
- }
- else
- {
- /*Result has saturated in negative side*/
- return OMX_MIN_S32;
- }
-
- }
-
- }
- else
- {
- return Result;
- }
-
-}
-
-/**
- * Function :armSatAdd_S64()
- *
- * Description :
- * Returns the result of saturated addition of the two inputs Value1, Value2
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- *
- * Return:
- * [out] Result of operation
- *
- *
- **/
-
-OMX_S64 armSatAdd_S64(OMX_S64 Value1,OMX_S64 Value2)
-{
- OMX_S64 Result;
-
- Result = Value1 + Value2;
-
- if( (Value1^Value2) >= 0)
- {
- /*Same sign*/
- if( (Result^Value1) >= 0)
- {
- /*Result has not saturated*/
- return Result;
- }
- else
- {
- if(Value1 >= 0)
- {
- /*Result has saturated in positive side*/
- Result = OMX_MAX_S64;
- return Result;
- }
- else
- {
- /*Result has saturated in negative side*/
- return OMX_MIN_S64;
- }
-
- }
-
- }
- else
- {
- return Result;
- }
-
-}
-
-/** Function :armSatSub_S32()
- *
- * Description :
- * Returns the result of saturated substraction of the two inputs Value1, Value2
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S32 armSatSub_S32(OMX_S32 Value1,OMX_S32 Value2)
-{
- OMX_S32 Result;
-
- Result = Value1 - Value2;
-
- if( (Value1^Value2) < 0)
- {
- /*Opposite sign*/
- if( (Result^Value1) >= 0)
- {
- /*Result has not saturated*/
- return Result;
- }
- else
- {
- if(Value1 >= 0)
- {
- /*Result has saturated in positive side*/
- return OMX_MAX_S32;
- }
- else
- {
- /*Result has saturated in negative side*/
- return OMX_MIN_S32;
- }
-
- }
-
- }
- else
- {
- return Result;
- }
-
-}
-
-/**
- * Function :armSatMac_S32()
- *
- * Description :
- * Returns the result of Multiplication of Value1 and Value2 and subesquent saturated
- * accumulation with Mac
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- * [in] Mac Accumulator
- *
- * Return:
- * [out] Result of operation
- **/
-
-OMX_S32 armSatMac_S32(OMX_S32 Mac,OMX_S16 Value1,OMX_S16 Value2)
-{
- OMX_S32 Result;
-
- Result = (OMX_S32)(Value1*Value2);
- Result = armSatAdd_S32( Mac , Result );
-
- return Result;
-}
-
-/**
- * Function :armSatMac_S16S32_S32
- *
- * Description :
- * Returns the result of saturated MAC operation of the three inputs delayElem, filTap , mac
- *
- * mac = mac + Saturate_in_32Bits(delayElem * filTap)
- *
- * Parametrs:
- * [in] delayElem First 32 bit Operand
- * [in] filTap Second 16 bit Operand
- * [in] mac Result of MAC operation
- *
- * Return:
- * [out] mac Result of operation
- *
- **/
-
-OMX_S32 armSatMac_S16S32_S32(OMX_S32 mac, OMX_S32 delayElem, OMX_S16 filTap )
-{
-
- OMX_S32 result;
-
- result = armSatMulS16S32_S32(filTap,delayElem);
-
- if ( result > OMX_MAX_S16 )
- {
- result = OMX_MAX_S32;
- }
- else if( result < OMX_MIN_S16 )
- {
- result = OMX_MIN_S32;
- }
- else
- {
- result = delayElem * filTap;
- }
-
- mac = armSatAdd_S32(mac,result);
-
- return mac;
-}
-
-
-/**
- * Function :armSatRoundRightShift_S32_S16
- *
- * Description :
- * Returns the result of rounded right shift operation of input by the scalefactor
- *
- * output = Saturate_in_16Bits( ( Right/LeftShift( (Round(input) , shift ) )
- *
- * Parametrs:
- * [in] input The input to be operated on
- * [in] shift The shift number
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-
-OMX_S16 armSatRoundRightShift_S32_S16(OMX_S32 input, OMX_INT shift)
-{
- input = armSatRoundLeftShift_S32(input,-shift);
-
- if ( input > OMX_MAX_S16 )
- {
- return (OMX_S16)OMX_MAX_S16;
- }
- else if (input < OMX_MIN_S16)
- {
- return (OMX_S16)OMX_MIN_S16;
- }
- else
- {
- return (OMX_S16)input;
- }
-
-}
-
-/**
- * Function :armSatRoundLeftShift_S32()
- *
- * Description :
- * Returns the result of saturating left-shift operation on input
- * Or rounded Right shift if the input Shift is negative.
- *
- * Parametrs:
- * [in] Value Operand
- * [in] Shift Operand for shift operation
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S32 armSatRoundLeftShift_S32(OMX_S32 Value, OMX_INT Shift)
-{
- OMX_INT i;
-
- if (Shift < 0)
- {
- Shift = -Shift;
- Value = armSatAdd_S32(Value, (1 << (Shift - 1)));
- Value = Value >> Shift;
- }
- else
- {
- for (i = 0; i < Shift; i++)
- {
- Value = armSatAdd_S32(Value, Value);
- }
- }
- return Value;
-}
-
-/**
- * Function :armSatRoundLeftShift_S64()
- *
- * Description :
- * Returns the result of saturating left-shift operation on input
- * Or rounded Right shift if the input Shift is negative.
- *
- * Parametrs:
- * [in] Value Operand
- * [in] shift Operand for shift operation
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S64 armSatRoundLeftShift_S64(OMX_S64 Value, OMX_INT Shift)
-{
- OMX_INT i;
-
- if (Shift < 0)
- {
- Shift = -Shift;
- Value = armSatAdd_S64(Value, ((OMX_S64)1 << (Shift - 1)));
- Value = Value >> Shift;
- }
- else
- {
- for (i = 0; i < Shift; i++)
- {
- Value = armSatAdd_S64(Value, Value);
- }
- }
- return Value;
-}
-
-/**
- * Function :armSatMulS16S32_S32()
- *
- * Description :
- * Returns the result of a S16 data type multiplied with an S32 data type
- * in a S32 container
- *
- * Parametrs:
- * [in] input1 Operand 1
- * [in] input2 Operand 2
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-
-OMX_S32 armSatMulS16S32_S32(OMX_S16 input1,OMX_S32 input2)
-{
- OMX_S16 hi2,lo1;
- OMX_U16 lo2;
-
- OMX_S32 temp1,temp2;
- OMX_S32 result;
-
- lo1 = input1;
-
- hi2 = ( input2 >> 16 );
- lo2 = ( (OMX_U32)( input2 << 16 ) >> 16 );
-
- temp1 = hi2 * lo1;
- temp2 = ( lo2* lo1 ) >> 16;
-
- result = armSatAdd_S32(temp1,temp2);
-
- return result;
-}
-
-/**
- * Function :armSatMulS32S32_S32()
- *
- * Description :
- * Returns the result of a S32 data type multiplied with an S32 data type
- * in a S32 container
- *
- * Parametrs:
- * [in] input1 Operand 1
- * [in] input2 Operand 2
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S32 armSatMulS32S32_S32(OMX_S32 input1,OMX_S32 input2)
-{
- OMX_S16 hi1,hi2;
- OMX_U16 lo1,lo2;
-
- OMX_S32 temp1,temp2,temp3;
- OMX_S32 result;
-
- hi1 = ( input1 >> 16 );
- lo1 = ( (OMX_U32)( input1 << 16 ) >> 16 );
-
- hi2 = ( input2 >> 16 );
- lo2 = ( (OMX_U32)( input2 << 16 ) >> 16 );
-
- temp1 = hi1 * hi2;
- temp2 = ( hi1* lo2 ) >> 16;
- temp3 = ( hi2* lo1 ) >> 16;
-
- result = armSatAdd_S32(temp1,temp2);
- result = armSatAdd_S32(result,temp3);
-
- return result;
-}
-
-/**
- * Function :armIntDivAwayFromZero()
- *
- * Description : Integer division with rounding to the nearest integer.
- * Half-integer values are rounded away from zero
- * unless otherwise specified. For example 3//2 is rounded
- * to 2, and -3//2 is rounded to -2.
- *
- * Parametrs:
- * [in] Num Operand 1
- * [in] Deno Operand 2
- *
- * Return:
- * [out] Result of operation input1//input2
- *
- **/
-
-OMX_S32 armIntDivAwayFromZero (OMX_S32 Num, OMX_S32 Deno)
-{
- OMX_F64 result;
-
- result = ((OMX_F64)Num)/((OMX_F64)Deno);
-
- if (result >= 0)
- {
- result += 0.5;
- }
- else
- {
- result -= 0.5;
- }
-
- return (OMX_S32)(result);
-}
-
-
-/*End of File*/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/src/armCOMM_Bitstream.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/src/armCOMM_Bitstream.c
deleted file mode 100644
index 99f53ca..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/src/armCOMM_Bitstream.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armCOMM_Bitstream.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Defines bitstream encode and decode functions common to all codecs
- */
-
-#include "omxtypes.h"
-#include "armCOMM.h"
-#include "armCOMM_Bitstream.h"
-
-/***************************************
- * Fixed bit length Decode
- ***************************************/
-
-/**
- * Function: armLookAheadBits()
- *
- * Description:
- * Get the next N bits from the bitstream without advancing the bitstream pointer
- *
- * Parameters:
- * [in] **ppBitStream
- * [in] *pOffset
- * [in] N=1...32
- *
- * Returns Value
- */
-
-OMX_U32 armLookAheadBits(const OMX_U8 **ppBitStream, OMX_INT *pOffset, OMX_INT N)
-{
- const OMX_U8 *pBitStream = *ppBitStream;
- OMX_INT Offset = *pOffset;
- OMX_U32 Value;
-
- armAssert(Offset>=0 && Offset<=7);
- armAssert(N>=1 && N<=32);
-
- /* Read next 32 bits from stream */
- Value = (pBitStream[0] << 24 ) | ( pBitStream[1] << 16) | (pBitStream[2] << 8 ) | (pBitStream[3]) ;
- Value = (Value << Offset ) | (pBitStream[4] >> (8-Offset));
-
- /* Return N bits */
- return Value >> (32-N);
-}
-
-
-/**
- * Function: armGetBits()
- *
- * Description:
- * Read N bits from the bitstream
- *
- * Parameters:
- * [in] *ppBitStream
- * [in] *pOffset
- * [in] N=1..32
- *
- * [out] *ppBitStream
- * [out] *pOffset
- * Returns Value
- */
-
-
-OMX_U32 armGetBits(const OMX_U8 **ppBitStream, OMX_INT *pOffset, OMX_INT N)
-{
- const OMX_U8 *pBitStream = *ppBitStream;
- OMX_INT Offset = *pOffset;
- OMX_U32 Value;
-
- if(N == 0)
- {
- return 0;
- }
-
- armAssert(Offset>=0 && Offset<=7);
- armAssert(N>=1 && N<=32);
-
- /* Read next 32 bits from stream */
- Value = (pBitStream[0] << 24 ) | ( pBitStream[1] << 16) | (pBitStream[2] << 8 ) | (pBitStream[3]) ;
- Value = (Value << Offset ) | (pBitStream[4] >> (8-Offset));
-
- /* Advance bitstream pointer by N bits */
- Offset += N;
- *ppBitStream = pBitStream + (Offset>>3);
- *pOffset = Offset & 7;
-
- /* Return N bits */
- return Value >> (32-N);
-}
-
-/**
- * Function: armByteAlign()
- *
- * Description:
- * Align the pointer *ppBitStream to the next byte boundary
- *
- * Parameters:
- * [in] *ppBitStream
- * [in] *pOffset
- *
- * [out] *ppBitStream
- * [out] *pOffset
- *
- **/
-
-OMXVoid armByteAlign(const OMX_U8 **ppBitStream,OMX_INT *pOffset)
-{
- if(*pOffset > 0)
- {
- *ppBitStream += 1;
- *pOffset = 0;
- }
-}
-
-/**
- * Function: armSkipBits()
- *
- * Description:
- * Skip N bits from the value at *ppBitStream
- *
- * Parameters:
- * [in] *ppBitStream
- * [in] *pOffset
- * [in] N
- *
- * [out] *ppBitStream
- * [out] *pOffset
- *
- **/
-
-
-OMXVoid armSkipBits(const OMX_U8 **ppBitStream,OMX_INT *pOffset,OMX_INT N)
-{
- OMX_INT Offset = *pOffset;
- const OMX_U8 *pBitStream = *ppBitStream;
-
- /* Advance bitstream pointer by N bits */
- Offset += N;
- *ppBitStream = pBitStream + (Offset>>3);
- *pOffset = Offset & 7;
-}
-
-/***************************************
- * Variable bit length Decode
- ***************************************/
-
-/**
- * Function: armUnPackVLC32()
- *
- * Description:
- * Variable length decode of variable length symbol (max size 32 bits) read from
- * the bit stream pointed by *ppBitStream at *pOffset by using the table
- * pointed by pCodeBook
- *
- * Parameters:
- * [in] *pBitStream
- * [in] *pOffset
- * [in] pCodeBook
- *
- * [out] *pBitStream
- * [out] *pOffset
- *
- * Returns : Code Book Index if successfull.
- * : ARM_NO_CODEBOOK_INDEX = -1 if search fails.
- **/
-#ifndef C_OPTIMIZED_IMPLEMENTATION
-
-OMX_U16 armUnPackVLC32(
- const OMX_U8 **ppBitStream,
- OMX_INT *pOffset,
- const ARM_VLC32 *pCodeBook
-)
-{
- const OMX_U8 *pBitStream = *ppBitStream;
- OMX_INT Offset = *pOffset;
- OMX_U32 Value;
- OMX_INT Index;
-
- armAssert(Offset>=0 && Offset<=7);
-
- /* Read next 32 bits from stream */
- Value = (pBitStream[0] << 24 ) | ( pBitStream[1] << 16) | (pBitStream[2] << 8 ) | (pBitStream[3]) ;
- Value = (Value << Offset ) | (pBitStream[4] >> (8-Offset));
-
- /* Search through the codebook */
- for (Index=0; pCodeBook->codeLen != 0; Index++)
- {
- if (pCodeBook->codeWord == (Value >> (32 - pCodeBook->codeLen)))
- {
- Offset = Offset + pCodeBook->codeLen;
- *ppBitStream = pBitStream + (Offset >> 3) ;
- *pOffset = Offset & 7;
-
- return Index;
- }
- pCodeBook++;
- }
-
- /* No code match found */
- return ARM_NO_CODEBOOK_INDEX;
-}
-
-#endif
-
-/***************************************
- * Fixed bit length Encode
- ***************************************/
-
-/**
- * Function: armPackBits
- *
- * Description:
- * Pack a VLC code word into the bitstream
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte
- * in the bit stream.
- * [in] pOffset pointer to the bit position in the byte
- * pointed by *ppBitStream. Valid within 0
- * to 7.
- * [in] codeWord Code word that need to be inserted in to the
- * bitstream
- * [in] codeLength Length of the code word valid range 1...32
- *
- * [out] ppBitStream *ppBitStream is updated after the block is encoded,
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMX_RESULT result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armPackBits (
- OMX_U8 **ppBitStream,
- OMX_INT *pOffset,
- OMX_U32 codeWord,
- OMX_INT codeLength
-)
-{
- OMX_U8 *pBitStream = *ppBitStream;
- OMX_INT Offset = *pOffset;
- OMX_U32 Value;
-
- /* checking argument validity */
- armRetArgErrIf(Offset < 0, OMX_Sts_BadArgErr);
- armRetArgErrIf(Offset > 7, OMX_Sts_BadArgErr);
- armRetArgErrIf(codeLength < 1, OMX_Sts_BadArgErr);
- armRetArgErrIf(codeLength > 32, OMX_Sts_BadArgErr);
-
- /* Prepare the first byte */
- codeWord = codeWord << (32-codeLength);
- Value = (pBitStream[0] >> (8-Offset)) << (8-Offset);
- Value = Value | (codeWord >> (24+Offset));
-
- /* Write out whole bytes */
- while (8-Offset <= codeLength)
- {
- *pBitStream++ = (OMX_U8)Value;
- codeWord = codeWord << (8-Offset);
- codeLength = codeLength - (8-Offset);
- Offset = 0;
- Value = codeWord >> 24;
- }
-
- /* Write out final partial byte */
- *pBitStream = (OMX_U8)Value;
- *ppBitStream = pBitStream;
- *pOffset = Offset + codeLength;
-
- return OMX_Sts_NoErr;
-}
-
-/***************************************
- * Variable bit length Encode
- ***************************************/
-
-/**
- * Function: armPackVLC32
- *
- * Description:
- * Pack a VLC code word into the bitstream
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte
- * in the bit stream.
- * [in] pBitOffset pointer to the bit position in the byte
- * pointed by *ppBitStream. Valid within 0
- * to 7.
- * [in] code VLC code word that need to be inserted in to the
- * bitstream
- *
- * [out] ppBitStream *ppBitStream is updated after the block is encoded,
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMX_RESULT result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armPackVLC32 (
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- ARM_VLC32 code
-)
-{
- return (armPackBits(ppBitStream, pBitOffset, code.codeWord, code.codeLen));
-}
-
-/*End of File*/
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/src/armCOMM_IDCTTable.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/src/armCOMM_IDCTTable.c
deleted file mode 100644
index 85d4c67..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/src/armCOMM_IDCTTable.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armCOMM_IDCTTable.c
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- * File: armCOMM_IDCTTable.c
- * Brief: Defines Tables used in IDCT computation
- *
- */
-
-#include "armCOMM_IDCTTable.h"
-
- /* Table of s(u)*A(u)*A(v)/16 at Q15
- * s(u)=1.0 0 <= u <= 5
- * s(6)=2.0
- * s(7)=4.0
- * A(0) = 2*sqrt(2)
- * A(u) = 4*cos(u*pi/16) for (u!=0)
- */
-
-__align(4) const OMX_U16 armCOMM_IDCTPreScale [64] =
-{
- 0x4000, 0x58c5, 0x539f, 0x4b42, 0x4000, 0x3249, 0x4546, 0x46a1,
- 0x58c5, 0x7b21, 0x73fc, 0x6862, 0x58c5, 0x45bf, 0x6016, 0x61f8,
- 0x539f, 0x73fc, 0x6d41, 0x6254, 0x539f, 0x41b3, 0x5a82, 0x5c48,
- 0x4b42, 0x6862, 0x6254, 0x587e, 0x4b42, 0x3b21, 0x5175, 0x530d,
- 0x4000, 0x58c5, 0x539f, 0x4b42, 0x4000, 0x3249, 0x4546, 0x46a1,
- 0x3249, 0x45bf, 0x41b3, 0x3b21, 0x3249, 0x2782, 0x366d, 0x377e,
- 0x22a3, 0x300b, 0x2d41, 0x28ba, 0x22a3, 0x1b37, 0x257e, 0x263a,
- 0x11a8, 0x187e, 0x1712, 0x14c3, 0x11a8, 0x0de0, 0x131d, 0x137d
-};
- /* Above array armCOMM_IDCTPreScale, in Q23 format */
-const OMX_U32 armCOMM_IDCTPreScaleU32 [64] =
-{
- 0x400000, 0x58c543, 0x539eba, 0x4b418c, 0x400000, 0x3248d4, 0x4545ea, 0x46a157,
- 0x58c543, 0x7b20d8, 0x73fbfc, 0x686214, 0x58c543, 0x45bf1f, 0x6015a5, 0x61f78b,
- 0x539eba, 0x73fbfc, 0x6d413d, 0x6253a6, 0x539eba, 0x41b328, 0x5a827a, 0x5c4869,
- 0x4b418c, 0x686214, 0x6253a6, 0x587de3, 0x4b418c, 0x3b20d8, 0x5174e0, 0x530d69,
- 0x400000, 0x58c543, 0x539eba, 0x4b418c, 0x400000, 0x3248d4, 0x4545ea, 0x46a157,
- 0x3248d4, 0x45bf1f, 0x41b328, 0x3b20d8, 0x3248d4, 0x27821d, 0x366d72, 0x377e6b,
- 0x22a2f5, 0x300ad3, 0x2d413d, 0x28ba70, 0x22a2f5, 0x1b36b9, 0x257d86, 0x26398d,
- 0x11a856, 0x187de3, 0x17121a, 0x14c35a, 0x11a856, 0x0ddf9b, 0x131cc7, 0x137ca2
-};
-
-const OMX_U16 armCOMM_IDCTCoef [4] =
-{
- 0x5a82, /* InvSqrt2 */
- 0x30fc, /* SinPIBy8 */
- 0x7642, /* CosPIBy8 */
- 0x0000
-};
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/src/armCOMM_MaskTable.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/src/armCOMM_MaskTable.c
deleted file mode 100644
index f169a16..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/src/armCOMM_MaskTable.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: armCOMM_MaskTable.c
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- * Mask Table to mask the end of array.
- *
- */
-
-#include "omxtypes.h"
-
-#define MaskTableSize 72
-
-const OMX_U16 armCOMM_qMaskTable16[MaskTableSize] =
-{
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0xFFFF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0x0000,
- 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000,
- 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000,
- 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000,
- 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF
-};
-
-const OMX_U8 armCOMM_qMaskTable8[MaskTableSize] =
-{
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
-};
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/api/armVC.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/api/armVC.h
deleted file mode 100644
index 1d37a5d..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/api/armVC.h
+++ /dev/null
@@ -1,1168 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVC.h
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- * File: armVideo.h
- * Brief: Declares API's/Basic Data types used across the OpenMAX Video domain
- *
- */
-
-
-#ifndef _armVideo_H_
-#define _armVideo_H_
-
-#include "omxVC.h"
-#include "armCOMM_Bitstream.h"
-
-/**
- * ARM specific state structure to hold Motion Estimation information.
- */
-
-struct m4p2_MESpec
-{
- OMXVCM4P2MEParams MEParams;
- OMXVCM4P2MEMode MEMode;
-};
-
-struct m4p10_MESpec
-{
- OMXVCM4P10MEParams MEParams;
- OMXVCM4P10MEMode MEMode;
-};
-
-typedef struct m4p2_MESpec ARMVCM4P2_MESpec;
-typedef struct m4p10_MESpec ARMVCM4P10_MESpec;
-
-/**
- * Function: armVCM4P2_CompareMV
- *
- * Description:
- * Performs comparision of motion vectors and SAD's to decide the
- * best MV and SAD
- *
- * Remarks:
- *
- * Parameters:
- * [in] mvX x coordinate of the candidate motion vector
- * [in] mvY y coordinate of the candidate motion vector
- * [in] candSAD Candidate SAD
- * [in] bestMVX x coordinate of the best motion vector
- * [in] bestMVY y coordinate of the best motion vector
- * [in] bestSAD best SAD
- *
- * Return Value:
- * OMX_INT -- 1 to indicate that the current sad is the best
- * 0 to indicate that it is NOT the best SAD
- */
-
-OMX_INT armVCM4P2_CompareMV (
- OMX_S16 mvX,
- OMX_S16 mvY,
- OMX_INT candSAD,
- OMX_S16 bestMVX,
- OMX_S16 bestMVY,
- OMX_INT bestSAD);
-
-/**
- * Function: armVCM4P2_ACDCPredict
- *
- * Description:
- * Performs adaptive DC/AC coefficient prediction for an intra block. Prior
- * to the function call, prediction direction (predDir) should be selected
- * as specified in subclause 7.4.3.1 of ISO/IEC 14496-2.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcDst pointer to the coefficient buffer which contains
- * the quantized coefficient residuals (PQF) of the
- * current block
- * [in] pPredBufRow pointer to the coefficient row buffer
- * [in] pPredBufCol pointer to the coefficient column buffer
- * [in] curQP quantization parameter of the current block. curQP
- * may equal to predQP especially when the current
- * block and the predictor block are in the same
- * macroblock.
- * [in] predQP quantization parameter of the predictor block
- * [in] predDir indicates the prediction direction which takes one
- * of the following values:
- * OMX_VIDEO_HORIZONTAL predict horizontally
- * OMX_VIDEO_VERTICAL predict vertically
- * [in] ACPredFlag a flag indicating if AC prediction should be
- * performed. It is equal to ac_pred_flag in the bit
- * stream syntax of MPEG-4
- * [in] videoComp video component type (luminance, chrominance or
- * alpha) of the current block
- * [in] flag This flag defines the if one wants to use this functions to
- * calculate PQF (set 1, prediction) or QF (set 0, reconstruction)
- * [out] pPreACPredict pointer to the predicted coefficients buffer.
- * Filled ONLY if it is not NULL
- * [out] pSrcDst pointer to the coefficient buffer which contains
- * the quantized coefficients (QF) of the current
- * block
- * [out] pPredBufRow pointer to the updated coefficient row buffer
- * [out] pPredBufCol pointer to the updated coefficient column buffer
- * [out] pSumErr pointer to the updated sum of the difference
- * between predicted and unpredicted coefficients
- * If this is NULL, do not update
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_ACDCPredict(
- OMX_S16 * pSrcDst,
- OMX_S16 * pPreACPredict,
- OMX_S16 * pPredBufRow,
- OMX_S16 * pPredBufCol,
- OMX_INT curQP,
- OMX_INT predQP,
- OMX_INT predDir,
- OMX_INT ACPredFlag,
- OMXVCM4P2VideoComponent videoComp,
- OMX_U8 flag,
- OMX_INT *pSumErr
-);
-
-/**
- * Function: armVCM4P2_SetPredDir
- *
- * Description:
- * Performs detecting the prediction direction
- *
- * Remarks:
- *
- * Parameters:
- * [in] blockIndex block index indicating the component type and
- * position as defined in subclause 6.1.3.8, of ISO/IEC
- * 14496-2. Furthermore, indexes 6 to 9 indicate the
- * alpha blocks spatially corresponding to luminance
- * blocks 0 to 3 in the same macroblock.
- * [in] pCoefBufRow pointer to the coefficient row buffer
- * [in] pQpBuf pointer to the quantization parameter buffer
- * [out] predQP quantization parameter of the predictor block
- * [out] predDir indicates the prediction direction which takes one
- * of the following values:
- * OMX_VIDEO_HORIZONTAL predict horizontally
- * OMX_VIDEO_VERTICAL predict vertically
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_SetPredDir(
- OMX_INT blockIndex,
- OMX_S16 *pCoefBufRow,
- OMX_S16 *pCoefBufCol,
- OMX_INT *predDir,
- OMX_INT *predQP,
- const OMX_U8 *pQpBuf
-);
-
-/**
- * Function: armVCM4P2_EncodeVLCZigzag_Intra
- *
- * Description:
- * Performs zigzag scanning and VLC encoding for one intra block.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bit stream
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * by *ppBitStream. Valid within 0 to 7.
- * [in] pQDctBlkCoef pointer to the quantized DCT coefficient
- * [in] predDir AC prediction direction, which is used to decide
- * the zigzag scan pattern. This takes one of the
- * following values:
- * OMX_VIDEO_NONE AC prediction not used.
- * Performs classical zigzag
- * scan.
- * OMX_VIDEO_HORIZONTAL Horizontal prediction.
- * Performs alternate-vertical
- * zigzag scan.
- * OMX_VIDEO_VERTICAL Vertical prediction.
- * Performs alternate-horizontal
- * zigzag scan.
- * [in] pattern block pattern which is used to decide whether
- * this block is encoded
- * [in] start start indicates whether the encoding begins with 0th element
- * or 1st.
- * [out] ppBitStream *ppBitStream is updated after the block is encoded,
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_EncodeVLCZigzag_Intra(
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- const OMX_S16 *pQDctBlkCoef,
- OMX_U8 predDir,
- OMX_U8 pattern,
- OMX_INT shortVideoHeader,
- OMX_U8 start
-);
-
-/**
- * Function: armVCM4P2_DecodeVLCZigzag_Intra
- *
- * Description:
- * Performs VLC decoding and inverse zigzag scan for one intra coded block.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bitstream buffer
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * to by *ppBitStream. *pBitOffset is valid within
- * [0-7].
- * [in] predDir AC prediction direction which is used to decide
- * the zigzag scan pattern. It takes one of the
- * following values:
- * OMX_VIDEO_NONE AC prediction not used;
- * perform classical zigzag scan;
- * OMX_VIDEO_HORIZONTAL Horizontal prediction;
- * perform alternate-vertical
- * zigzag scan;
- * OMX_VIDEO_VERTICAL Vertical prediction;
- * thus perform
- * alternate-horizontal
- * zigzag scan.
- * [in] videoComp video component type (luminance, chrominance or
- * alpha) of the current block
- * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0,
- * and escape mode 4 is used when shortVideoHeader==1.
- * [in] start start indicates whether the encoding begins with 0th element
- * or 1st.
- * [out] ppBitStream *ppBitStream is updated after the block is
- * decoded, so that it points to the current byte
- * in the bit stream buffer
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream
- * [out] pDst pointer to the coefficient buffer of current
- * block. Should be 32-bit aligned
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_DecodeVLCZigzag_Intra(
- const OMX_U8 ** ppBitStream,
- OMX_INT * pBitOffset,
- OMX_S16 * pDst,
- OMX_U8 predDir,
- OMX_INT shortVideoHeader,
- OMX_U8 start
-);
-
-/**
- * Function: armVCM4P2_FillVLDBuffer
- *
- * Description:
- * Performs filling of the coefficient buffer according to the run, level
- * and sign, also updates the index
- *
- * Parameters:
- * [in] storeRun Stored Run value (count of zeros)
- * [in] storeLevel Stored Level value (non-zero value)
- * [in] sign Flag indicating the sign of level
- * [in] last status of the last flag
- * [in] pIndex pointer to coefficient index in 8x8 matrix
- * [out] pIndex pointer to updated coefficient index in 8x8
- * matrix
- * [in] pZigzagTable pointer to the zigzag tables
- * [out] pDst pointer to the coefficient buffer of current
- * block. Should be 32-bit aligned
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_FillVLDBuffer(
- OMX_U32 storeRun,
- OMX_S16 * pDst,
- OMX_S16 storeLevel,
- OMX_U8 sign,
- OMX_U8 last,
- OMX_U8 * index,
- const OMX_U8 * pZigzagTable
-);
-
-/**
- * Function: armVCM4P2_GetVLCBits
- *
- * Description:
- * Performs escape mode decision based on the run, run+, level, level+ and
- * last combinations.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bit stream
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * by *ppBitStream. Valid within 0 to 7
- * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0,
- * and escape mode 4 is used when shortVideoHeader==1.
- * [in] start start indicates whether the encoding begins with
- * 0th element or 1st.
- * [in/out] pLast pointer to last status flag
- * [in] runBeginSingleLevelEntriesL0 The run value from which level
- * will be equal to 1: last == 0
- * [in] IndexBeginSingleLevelEntriesL0 Array index in the VLC table
- * pointing to the
- * runBeginSingleLevelEntriesL0
- * [in] runBeginSingleLevelEntriesL1 The run value from which level
- * will be equal to 1: last == 1
- * [in] IndexBeginSingleLevelEntriesL1 Array index in the VLC table
- * pointing to the
- * runBeginSingleLevelEntriesL0
- * [in] pRunIndexTableL0 Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pVlcTableL0 VLC table for last == 0
- * [in] pRunIndexTableL1 Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [in] pVlcTableL1 VLC table for last == 1
- * [in] pLMAXTableL0 Level MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pLMAXTableL1 Level MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [in] pRMAXTableL0 Run MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pRMAXTableL1 Run MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [out]pDst pointer to the coefficient buffer of current
- * block. Should be 32-bit aligned
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_GetVLCBits (
- const OMX_U8 **ppBitStream,
- OMX_INT * pBitOffset,
- OMX_S16 * pDst,
- OMX_INT shortVideoHeader,
- OMX_U8 start,
- OMX_U8 * pLast,
- OMX_U8 runBeginSingleLevelEntriesL0,
- OMX_U8 maxIndexForMultipleEntriesL0,
- OMX_U8 maxRunForMultipleEntriesL1,
- OMX_U8 maxIndexForMultipleEntriesL1,
- const OMX_U8 * pRunIndexTableL0,
- const ARM_VLC32 *pVlcTableL0,
- const OMX_U8 * pRunIndexTableL1,
- const ARM_VLC32 *pVlcTableL1,
- const OMX_U8 * pLMAXTableL0,
- const OMX_U8 * pLMAXTableL1,
- const OMX_U8 * pRMAXTableL0,
- const OMX_U8 * pRMAXTableL1,
- const OMX_U8 * pZigzagTable
-);
-
-/**
- * Function: armVCM4P2_PutVLCBits
- *
- * Description:
- * Checks the type of Escape Mode and put encoded bits for
- * quantized DCT coefficients.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bit stream
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * by *ppBitStream. Valid within 0 to 7
- * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0,
- * and escape mode 4 is used when shortVideoHeader==1.
- * [in] start start indicates whether the encoding begins with
- * 0th element or 1st.
- * [in] maxStoreRunL0 Max store possible (considering last and inter/intra)
- * for last = 0
- * [in] maxStoreRunL1 Max store possible (considering last and inter/intra)
- * for last = 1
- * [in] maxRunForMultipleEntriesL0
- * The run value after which level
- * will be equal to 1:
- * (considering last and inter/intra status) for last = 0
- * [in] maxRunForMultipleEntriesL1
- * The run value after which level
- * will be equal to 1:
- * (considering last and inter/intra status) for last = 1
- * [in] pRunIndexTableL0 Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pVlcTableL0 VLC table for last == 0
- * [in] pRunIndexTableL1 Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [in] pVlcTableL1 VLC table for last == 1
- * [in] pLMAXTableL0 Level MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pLMAXTableL1 Level MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [in] pRMAXTableL0 Run MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pRMAXTableL1 Run MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [out] pQDctBlkCoef pointer to the quantized DCT coefficient
- * [out] ppBitStream *ppBitStream is updated after the block is encoded
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-
-OMXResult armVCM4P2_PutVLCBits (
- OMX_U8 **ppBitStream,
- OMX_INT * pBitOffset,
- const OMX_S16 *pQDctBlkCoef,
- OMX_INT shortVideoHeader,
- OMX_U8 start,
- OMX_U8 maxStoreRunL0,
- OMX_U8 maxStoreRunL1,
- OMX_U8 maxRunForMultipleEntriesL0,
- OMX_U8 maxRunForMultipleEntriesL1,
- const OMX_U8 * pRunIndexTableL0,
- const ARM_VLC32 *pVlcTableL0,
- const OMX_U8 * pRunIndexTableL1,
- const ARM_VLC32 *pVlcTableL1,
- const OMX_U8 * pLMAXTableL0,
- const OMX_U8 * pLMAXTableL1,
- const OMX_U8 * pRMAXTableL0,
- const OMX_U8 * pRMAXTableL1,
- const OMX_U8 * pZigzagTable
-);
-/**
- * Function: armVCM4P2_FillVLCBuffer
- *
- * Description:
- * Performs calculating the VLC bits depending on the escape type and insert
- * the same in the bitstream
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bit stream
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * by *ppBitStream. Valid within 0 to 7
- * [in] run Run value (count of zeros) to be encoded
- * [in] level Level value (non-zero value) to be encoded
- * [in] runPlus Calculated as runPlus = run - (RMAX + 1)
- * [in] levelPlus Calculated as
- * levelPlus = sign(level)*[abs(level) - LMAX]
- * [in] fMode Flag indicating the escape modes
- * [in] last status of the last flag
- * [in] maxRunForMultipleEntries
- * The run value after which level will be equal to 1:
- * (considering last and inter/intra status)
- * [in] pRunIndexTable Run Index table defined in
- * armVCM4P2_Huff_tables_VLC.h
- * [in] pVlcTable VLC table defined in armVCM4P2_Huff_tables_VLC.h
- * [out] ppBitStream *ppBitStream is updated after the block is encoded
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_FillVLCBuffer (
- OMX_U8 **ppBitStream,
- OMX_INT * pBitOffset,
- OMX_U32 run,
- OMX_S16 level,
- OMX_U32 runPlus,
- OMX_S16 levelPlus,
- OMX_U8 fMode,
- OMX_U8 last,
- OMX_U8 maxRunForMultipleEntries,
- const OMX_U8 *pRunIndexTable,
- const ARM_VLC32 *pVlcTable
-);
-
-/**
- * Function: armVCM4P2_CheckVLCEscapeMode
- *
- * Description:
- * Performs escape mode decision based on the run, run+, level, level+ and
- * last combinations.
- *
- * Remarks:
- *
- * Parameters:
- * [in] run Run value (count of zeros) to be encoded
- * [in] level Level value (non-zero value) to be encoded
- * [in] runPlus Calculated as runPlus = run - (RMAX + 1)
- * [in] levelPlus Calculated as
- * levelPlus = sign(level)*[abs(level) - LMAX]
- * [in] maxStoreRun Max store possible (considering last and inter/intra)
- * [in] maxRunForMultipleEntries
- * The run value after which level
- * will be equal to 1:
- * (considering last and inter/intra status)
- * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0,
- * and escape mode 4 is used when shortVideoHeader==1.
- * [in] pRunIndexTable Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.c
- * (considering last and inter/intra status)
- *
- *
- * Return Value:
- * Returns an Escape mode which can take values from 0 to 3
- * 0 --> no escape mode, 1 --> escape type 1,
- * 1 --> escape type 2, 3 --> escape type 3, check section 7.4.1.3
- * in the MPEG ISO standard.
- *
- */
-
-OMX_U8 armVCM4P2_CheckVLCEscapeMode(
- OMX_U32 run,
- OMX_U32 runPlus,
- OMX_S16 level,
- OMX_S16 levelPlus,
- OMX_U8 maxStoreRun,
- OMX_U8 maxRunForMultipleEntries,
- OMX_INT shortVideoHeader,
- const OMX_U8 *pRunIndexTable
-);
-
-
-/**
- * Function: armVCM4P2_BlockMatch_Integer
- *
- * Description:
- * Performs a 16x16 block search; estimates motion vector and associated minimum SAD.
- * Both the input and output motion vectors are represented using half-pixel units, and
- * therefore a shift left or right by 1 bit may be required, respectively, to match the
- * input or output MVs with other functions that either generate output MVs or expect
- * input MVs represented using integer pixel units.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcRefBuf pointer to the reference Y plane; points to the reference MB that
- * corresponds to the location of the current macroblock in the current
- * plane.
- * [in] refWidth width of the reference plane
- * [in] pRefRect pointer to the valid rectangular in reference plane. Relative to image origin.
- * It's not limited to the image boundary, but depended on the padding. For example,
- * if you pad 4 pixels outside the image border, then the value for left border
- * can be -4
- * [in] pSrcCurrBuf pointer to the current macroblock extracted from original plane (linear array,
- * 256 entries); must be aligned on an 8-byte boundary.
- * [in] pCurrPointPos position of the current macroblock in the current plane
- * [in] pSrcPreMV pointer to predicted motion vector; NULL indicates no predicted MV
- * [in] pSrcPreSAD pointer to SAD associated with the predicted MV (referenced by pSrcPreMV)
- * [in] searchRange search range for 16X16 integer block,the units of it is full pixel,the search range
- * is the same in all directions.It is in inclusive of the boundary and specified in
- * terms of integer pixel units.
- * [in] pMESpec vendor-specific motion estimation specification structure; must have been allocated
- * and then initialized using omxVCM4P2_MEInit prior to calling the block matching
- * function.
- * [in] BlockSize MacroBlock Size i.e either 16x16 or 8x8.
- * [out] pDstMV pointer to estimated MV
- * [out] pDstSAD pointer to minimum SAD
- *
- * Return Value:
- * OMX_Sts_NoErr ¨C no error.
- * OMX_Sts_BadArgErr ¨C bad arguments
- *
- */
-
-OMXResult armVCM4P2_BlockMatch_Integer(
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- const OMXVCMotionVector *pSrcPreMV,
- const OMX_INT *pSrcPreSAD,
- void *pMESpec,
- OMXVCMotionVector *pDstMV,
- OMX_INT *pDstSAD,
- OMX_U8 BlockSize
-);
-
-/**
- * Function: armVCM4P2_BlockMatch_Half
- *
- * Description:
- * Performs a 16x16 block match with half-pixel resolution. Returns the estimated
- * motion vector and associated minimum SAD. This function estimates the half-pixel
- * motion vector by interpolating the integer resolution motion vector referenced
- * by the input parameter pSrcDstMV, i.e., the initial integer MV is generated
- * externally. The input parameters pSrcRefBuf and pSearchPointRefPos should be
- * shifted by the winning MV of 16x16 integer search prior to calling BlockMatch_Half_16x16.
- * The function BlockMatch_Integer_16x16 may be used for integer motion estimation.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcRefBuf pointer to the reference Y plane; points to the reference MB
- * that corresponds to the location of the current macroblock in
- * the current plane.
- * [in] refWidth width of the reference plane
- * [in] pRefRect reference plane valid region rectangle
- * [in] pSrcCurrBuf pointer to the current macroblock extracted from original plane
- * (linear array, 256 entries); must be aligned on an 8-byte boundary.
- * [in] pSearchPointRefPos position of the starting point for half pixel search (specified
- * in terms of integer pixel units) in the reference plane.
- * [in] rndVal rounding control bit for half pixel motion estimation;
- * 0=rounding control disabled; 1=rounding control enabled
- * [in] pSrcDstMV pointer to the initial MV estimate; typically generated during a prior
- * 16X16 integer search and its unit is half pixel.
- * [in] BlockSize MacroBlock Size i.e either 16x16 or 8x8.
- * [out]pSrcDstMV pointer to estimated MV
- * [out]pDstSAD pointer to minimum SAD
- *
- * Return Value:
- * OMX_Sts_NoErr ¨C no error
- * OMX_Sts_BadArgErr ¨C bad arguments
- *
- */
-
-OMXResult armVCM4P2_BlockMatch_Half(
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pSearchPointRefPos,
- OMX_INT rndVal,
- OMXVCMotionVector *pSrcDstMV,
- OMX_INT *pDstSAD,
- OMX_U8 BlockSize
-);
-/**
- * Function: armVCM4P2_PadMV
- *
- * Description:
- * Performs motion vector padding for a macroblock.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcDstMV pointer to motion vector buffer of the current
- * macroblock
- * [in] pTransp pointer to transparent status buffer of the
- * current macroblock
- * [out] pSrcDstMV pointer to motion vector buffer in which the
- * motion vectors have been padded
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_PadMV(
- OMXVCMotionVector * pSrcDstMV,
- OMX_U8 * pTransp
-);
-
-/*
- * H.264 Specific Declarations
- */
-/* Defines */
-#define ARM_M4P10_Q_OFFSET (15)
-
-
-/* Dequant tables */
-
-extern const OMX_U8 armVCM4P10_PosToVCol4x4[16];
-extern const OMX_U8 armVCM4P10_PosToVCol2x2[4];
-extern const OMX_U8 armVCM4P10_VMatrix[6][3];
-extern const OMX_U32 armVCM4P10_MFMatrix[6][3];
-
-
-/*
- * Description:
- * This function perform the work required by the OpenMAX
- * DecodeCoeffsToPair function and DecodeChromaDCCoeffsToPair.
- * Since most of the code is common we share it here.
- *
- * Parameters:
- * [in] ppBitStream Double pointer to current byte in bit stream buffer
- * [in] pOffset Pointer to current bit position in the byte pointed
- * to by *ppBitStream
- * [in] sMaxNumCoeff Maximum number of non-zero coefficients in current
- * block (4,15 or 16)
- * [in] nTable Table number (0 to 4) according to the five columns
- * of Table 9-5 in the H.264 spec
- * [out] ppBitStream *ppBitStream is updated after each block is decoded
- * [out] pOffset *pOffset is updated after each block is decoded
- * [out] pNumCoeff Pointer to the number of nonzero coefficients in
- * this block
- * [out] ppPosCoefbuf Double pointer to destination residual
- * coefficient-position pair buffer
- * Return Value:
- * Standard omxError result. See enumeration for possible result codes.
-
- */
-
-OMXResult armVCM4P10_DecodeCoeffsToPair(
- const OMX_U8** ppBitStream,
- OMX_S32* pOffset,
- OMX_U8* pNumCoeff,
- OMX_U8**ppPosCoefbuf,
- OMX_INT nTable,
- OMX_INT sMaxNumCoeff
- );
-
-/*
- * Description:
- * Perform DC style intra prediction, averaging upper and left block
- *
- * Parameters:
- * [in] pSrcLeft Pointer to the buffer of 16 left coefficients:
- * p[x, y] (x = -1, y = 0..3)
- * [in] pSrcAbove Pointer to the buffer of 16 above coefficients:
- * p[x,y] (x = 0..3, y = -1)
- * [in] leftStep Step of left coefficient buffer
- * [in] dstStep Step of the destination buffer
- * [in] availability Neighboring 16x16 MB availability flag
- * [out] pDst Pointer to the destination buffer
- *
- * Return Value:
- * None
- */
-
-void armVCM4P10_PredictIntraDC4x4(
- const OMX_U8* pSrcLeft,
- const OMX_U8 *pSrcAbove,
- OMX_U8* pDst,
- OMX_INT leftStep,
- OMX_INT dstStep,
- OMX_S32 availability
-);
-
-/*
- * Description
- * Unpack a 4x4 block of coefficient-residual pair values
- *
- * Parameters:
- * [in] ppSrc Double pointer to residual coefficient-position pair
- * buffer output by CALVC decoding
- * [out] ppSrc *ppSrc is updated to the start of next non empty block
- * [out] pDst Pointer to unpacked 4x4 block
- */
-
-void armVCM4P10_UnpackBlock4x4(
- const OMX_U8 **ppSrc,
- OMX_S16* pDst
-);
-
-/*
- * Description
- * Unpack a 2x2 block of coefficient-residual pair values
- *
- * Parameters:
- * [in] ppSrc Double pointer to residual coefficient-position pair
- * buffer output by CALVC decoding
- * [out] ppSrc *ppSrc is updated to the start of next non empty block
- * [out] pDst Pointer to unpacked 4x4 block
- */
-
-void armVCM4P10_UnpackBlock2x2(
- const OMX_U8 **ppSrc,
- OMX_S16* pDst
-);
-
-/*
- * Description
- * Deblock one boundary pixel
- *
- * Parameters:
- * [in] pQ0 Pointer to pixel q0
- * [in] Step Step between pixels q0 and q1
- * [in] tC0 Edge threshold value
- * [in] alpha alpha threshold value
- * [in] beta beta threshold value
- * [in] bS deblocking strength
- * [in] ChromaFlag True for chroma blocks
- * [out] pQ0 Deblocked pixels
- *
- */
-
-void armVCM4P10_DeBlockPixel(
- OMX_U8 *pQ0, /* pointer to the pixel q0 */
- int Step, /* step between pixels q0 and q1 */
- int tC0, /* edge threshold value */
- int alpha, /* alpha */
- int beta, /* beta */
- int bS, /* deblocking strength */
- int ChromaFlag
-);
-
-/**
- * Function: armVCM4P10_InterpolateHalfHor_Luma
- *
- * Description:
- * This function performs interpolation for horizontal 1/2-pel positions
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block used to interpolate
- in the reconstructed frame plane
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination(interpolation) buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [out] pDst Pointer to the interpolation buffer of the 1/2-pel
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-
-OMXResult armVCM4P10_InterpolateHalfHor_Luma(
- const OMX_U8* pSrc,
- OMX_U32 iSrcStep,
- OMX_U8* pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-);
-
-/**
- * Function: armVCM4P10_InterpolateHalfVer_Luma
- *
- * Description:
- * This function performs interpolation for vertical 1/2-pel positions
- * around a full-pel position.
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block used to interpolate
- * in the reconstructed frame plane
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination(interpolation) buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [out] pDst Pointer to the interpolation buffer of the 1/2-pel
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-
-OMXResult armVCM4P10_InterpolateHalfVer_Luma(
- const OMX_U8* pSrc,
- OMX_U32 iSrcStep,
- OMX_U8* pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-);
-
-/**
- * Function: armVCM4P10_InterpolateHalfDiag_Luma
- *
- * Description:
- * This function performs interpolation for (1/2, 1/2) positions
- * around a full-pel position.
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block used to interpolate
- * in the reconstructed frame plane
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination(interpolation) buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [out] pDst Pointer to the interpolation buffer of the (1/2,1/2)-pel
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-
-OMXResult armVCM4P10_InterpolateHalfDiag_Luma(
- const OMX_U8* pSrc,
- OMX_U32 iSrcStep,
- OMX_U8* pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-);
-
-/*
- * Description:
- * Transform Residual 4x4 Coefficients
- *
- * Parameters:
- * [in] pSrc Source 4x4 block
- * [out] pDst Destination 4x4 block
- *
- */
-
-void armVCM4P10_TransformResidual4x4(OMX_S16* pDst, OMX_S16 *pSrc);
-
-/*
- * Description:
- * Forward Transform Residual 4x4 Coefficients
- *
- * Parameters:
- * [in] pSrc Source 4x4 block
- * [out] pDst Destination 4x4 block
- *
- */
-
-void armVCM4P10_FwdTransformResidual4x4(OMX_S16* pDst, OMX_S16 *pSrc);
-
-OMX_INT armVCM4P10_CompareMotionCostToMV (
- OMX_S16 mvX,
- OMX_S16 mvY,
- OMXVCMotionVector diffMV,
- OMX_INT candSAD,
- OMXVCMotionVector *bestMV,
- OMX_U32 nLamda,
- OMX_S32 *pBestCost);
-
-/**
- * Function: armVCCOMM_SAD
- *
- * Description:
- * This function calculate the SAD for NxM blocks.
- *
- * Remarks:
- *
- * [in] pSrcOrg Pointer to the original block
- * [in] iStepOrg Step of the original block buffer
- * [in] pSrcRef Pointer to the reference block
- * [in] iStepRef Step of the reference block buffer
- * [in] iHeight Height of the block
- * [in] iWidth Width of the block
- * [out] pDstSAD Pointer of result SAD
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-OMXResult armVCCOMM_SAD(
- const OMX_U8* pSrcOrg,
- OMX_U32 iStepOrg,
- const OMX_U8* pSrcRef,
- OMX_U32 iStepRef,
- OMX_S32* pDstSAD,
- OMX_U32 iHeight,
- OMX_U32 iWidth);
-
-/**
- * Function: armVCCOMM_Average
- *
- * Description:
- * This function calculates the average of two blocks and stores the result.
- *
- * Remarks:
- *
- * [in] pPred0 Pointer to the top-left corner of reference block 0
- * [in] pPred1 Pointer to the top-left corner of reference block 1
- * [in] iPredStep0 Step of reference block 0
- * [in] iPredStep1 Step of reference block 1
- * [in] iDstStep Step of the destination buffer
- * [in] iWidth Width of the blocks
- * [in] iHeight Height of the blocks
- * [out] pDstPred Pointer to the destination buffer
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
- OMXResult armVCCOMM_Average (
- const OMX_U8* pPred0,
- const OMX_U8* pPred1,
- OMX_U32 iPredStep0,
- OMX_U32 iPredStep1,
- OMX_U8* pDstPred,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-);
-
-/**
- * Function: armVCM4P10_SADQuar
- *
- * Description:
- * This function calculates the SAD between one block (pSrc) and the
- * average of the other two (pSrcRef0 and pSrcRef1)
- *
- * Remarks:
- *
- * [in] pSrc Pointer to the original block
- * [in] pSrcRef0 Pointer to reference block 0
- * [in] pSrcRef1 Pointer to reference block 1
- * [in] iSrcStep Step of the original block buffer
- * [in] iRefStep0 Step of reference block 0
- * [in] iRefStep1 Step of reference block 1
- * [in] iHeight Height of the block
- * [in] iWidth Width of the block
- * [out] pDstSAD Pointer of result SAD
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-OMXResult armVCM4P10_SADQuar(
- const OMX_U8* pSrc,
- const OMX_U8* pSrcRef0,
- const OMX_U8* pSrcRef1,
- OMX_U32 iSrcStep,
- OMX_U32 iRefStep0,
- OMX_U32 iRefStep1,
- OMX_U32* pDstSAD,
- OMX_U32 iHeight,
- OMX_U32 iWidth
-);
-
-/**
- * Function: armVCM4P10_Interpolate_Chroma
- *
- * Description:
- * This function performs interpolation for chroma components.
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block used to
- * interpolate in the reconstructed frame plane
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination(interpolation) buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [in] dx Fractional part of horizontal motion vector
- * component in 1/8 pixel unit (0~7)
- * [in] dy Fractional part of vertical motion vector
- * component in 1/8 pixel unit (0~7)
- * [out] pDst Pointer to the interpolation buffer
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
- OMXResult armVCM4P10_Interpolate_Chroma(
- OMX_U8 *pSrc,
- OMX_U32 iSrcStep,
- OMX_U8 *pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight,
- OMX_U32 dx,
- OMX_U32 dy
-);
-
-/**
- * Function: armVCM4P10_Interpolate_Luma
- *
- * Description:
- * This function performs interpolation for luma components.
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block used to
- * interpolate in the reconstructed frame plane
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination(interpolation) buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [in] dx Fractional part of horizontal motion vector
- * component in 1/4 pixel unit (0~3)
- * [in] dy Fractional part of vertical motion vector
- * component in 1/4 pixel unit (0~3)
- * [out] pDst Pointer to the interpolation buffer
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-
- OMXResult armVCM4P10_Interpolate_Luma(
- const OMX_U8 *pSrc,
- OMX_U32 iSrcStep,
- OMX_U8 *pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight,
- OMX_U32 dx,
- OMX_U32 dy
-);
-
-/**
- * Function: omxVCH264_DequantTransformACFromPair_U8_S16_C1_DLx
- *
- * Description:
- * Reconstruct the 4x4 residual block from coefficient-position pair buffer,
- * perform dequantisation and integer inverse transformation for 4x4 block of
- * residuals and update the pair buffer pointer to next non-empty block.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppSrc Double pointer to residual coefficient-position
- * pair buffer output by CALVC decoding
- * [in] pDC Pointer to the DC coefficient of this block, NULL
- * if it doesn't exist
- * [in] QP Quantization parameter
- * [in] AC Flag indicating if at least one non-zero coefficient exists
- * [out] pDst pointer to the reconstructed 4x4 block data
- *
- * Return Value:
- * Standard omxError result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P10_DequantTransformACFromPair_U8_S16_C1_DLx(
- OMX_U8 **ppSrc,
- OMX_S16 *pDst,
- OMX_INT QP,
- OMX_S16* pDC,
- int AC
-);
-
-#endif /*_armVideo_H_*/
-
-/*End of File*/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/api/armVCCOMM_s.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/api/armVCCOMM_s.h
deleted file mode 100644
index cfc2a3b..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/api/armVCCOMM_s.h
+++ /dev/null
@@ -1,86 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCCOMM_s.h
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-;// ARM optimized OpenMAX AC header file
-;//
-;// Formula used:
-;// MACRO for calculating median for three values.
-
-
-
- IF :LNOT::DEF:ARMVCCOMM_S_H
- INCLUDE armCOMM_s.h
- M_VARIANTS CortexA8, ARM1136JS
-
- IF ARM1136JS :LOR: CortexA8
-
- ;///*
- ;// * Macro: M_MEDIAN3
- ;// *
- ;// * Description: Finds the median of three numbers
- ;// *
- ;// * Remarks:
- ;// *
- ;// * Parameters:
- ;// * [in] x First entry for the list of three numbers.
- ;// * [in] y Second entry for the list of three numbers.
- ;// * Input value may be corrupted at the end of
- ;// * the execution of this macro.
- ;// * [in] z Third entry of the list of three numbers.
- ;// * Input value corrupted at the end of the
- ;// * execution of this macro.
- ;// * [in] t Temporary scratch register.
- ;// * [out]z Median of the three numbers.
- ;// */
-
- MACRO
-
- M_MEDIAN3 $x, $y, $z, $t
-
- SUBS $t, $y, $z; // if (y < z)
- ADDLT $z, $z, $t; // swap y and z
- SUBLT $y, $y, $t;
-
- ;// Now z' <= y', so there are three cases for the
- ;// median value, depending on x.
-
- ;// 1) x <= z' <= y' : median value is z'
- ;// 2) z' <= x <= y' : median value is x
- ;// 3) z' <= y' <= x : median value is y'
-
- CMP $z, $x; // if ( x > min(y,z) )
- MOVLT $z, $x; // ans = x
-
- CMP $x, $y; // if ( x > max(y,z) )
- MOVGT $z, $y; // ans = max(y,z)
-
- MEND
- ENDIF
-
-
-
- ENDIF ;// ARMACCOMM_S_H
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/api/omxVC.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/api/omxVC.h
deleted file mode 100644
index 7b3cc72..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/api/omxVC.h
+++ /dev/null
@@ -1,4381 +0,0 @@
-/**
- * File: omxVC.h
- * Brief: OpenMAX DL v1.0.2 - Video Coding library
- *
- * Copyright © 2005-2008 The Khronos Group Inc. All Rights Reserved.
- *
- * These materials are protected by copyright laws and contain material
- * proprietary to the Khronos Group, Inc. You may use these materials
- * for implementing Khronos specifications, without altering or removing
- * any trademark, copyright or other notice from the specification.
- *
- * Khronos Group makes no, and expressly disclaims any, representations
- * or warranties, express or implied, regarding these materials, including,
- * without limitation, any implied warranties of merchantability or fitness
- * for a particular purpose or non-infringement of any intellectual property.
- * Khronos Group makes no, and expressly disclaims any, warranties, express
- * or implied, regarding the correctness, accuracy, completeness, timeliness,
- * and reliability of these materials.
- *
- * Under no circumstances will the Khronos Group, or any of its Promoters,
- * Contributors or Members or their respective partners, officers, directors,
- * employees, agents or representatives be liable for any damages, whether
- * direct, indirect, special or consequential damages for lost revenues,
- * lost profits, or otherwise, arising from or in connection with these
- * materials.
- *
- * Khronos and OpenMAX are trademarks of the Khronos Group Inc.
- *
- */
-
-/* *****************************************************************************************/
-
-#ifndef _OMXVC_H_
-#define _OMXVC_H_
-
-#include "omxtypes.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* 6.1.1.1 Motion Vectors */
-/* In omxVC, motion vectors are represented as follows: */
-
-typedef struct {
- OMX_S16 dx;
- OMX_S16 dy;
-} OMXVCMotionVector;
-
-
-
-/**
- * Function: omxVCCOMM_Average_8x (6.1.3.1.1)
- *
- * Description:
- * This function calculates the average of two 8x4, 8x8, or 8x16 blocks. The
- * result is rounded according to (a+b+1)/2. The block average function can
- * be used in conjunction with half-pixel interpolation to obtain quarter
- * pixel motion estimates, as described in [ISO14496-10], subclause 8.4.2.2.1.
- *
- * Input Arguments:
- *
- * pPred0 - Pointer to the top-left corner of reference block 0
- * pPred1 - Pointer to the top-left corner of reference block 1
- * iPredStep0 - Step of reference block 0
- * iPredStep1 - Step of reference block 1
- * iDstStep - Step of the destination buffer.
- * iHeight - Height of the blocks
- *
- * Output Arguments:
- *
- * pDstPred - Pointer to the destination buffer. 8-byte aligned.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - one or more of the following pointers is NULL: pPred0, pPred1, or
- * pDstPred.
- * - pDstPred is not aligned on an 8-byte boundary.
- * - iPredStep0 <= 0 or iPredStep0 is not a multiple of 8.
- * - iPredStep1 <= 0 or iPredStep1 is not a multiple of 8.
- * - iDstStep <= 0 or iDstStep is not a multiple of 8.
- * - iHeight is not 4, 8, or 16.
- *
- */
-OMXResult omxVCCOMM_Average_8x (
- const OMX_U8 *pPred0,
- const OMX_U8 *pPred1,
- OMX_U32 iPredStep0,
- OMX_U32 iPredStep1,
- OMX_U8 *pDstPred,
- OMX_U32 iDstStep,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCCOMM_Average_16x (6.1.3.1.2)
- *
- * Description:
- * This function calculates the average of two 16x16 or 16x8 blocks. The
- * result is rounded according to (a+b+1)/2. The block average function can
- * be used in conjunction with half-pixel interpolation to obtain quarter
- * pixel motion estimates, as described in [ISO14496-10], subclause 8.4.2.2.1.
- *
- * Input Arguments:
- *
- * pPred0 - Pointer to the top-left corner of reference block 0
- * pPred1 - Pointer to the top-left corner of reference block 1
- * iPredStep0 - Step of reference block 0
- * iPredStep1 - Step of reference block 1
- * iDstStep - Step of the destination buffer
- * iHeight - Height of the blocks
- *
- * Output Arguments:
- *
- * pDstPred - Pointer to the destination buffer. 16-byte aligned.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - one or more of the following pointers is NULL: pPred0, pPred1, or
- * pDstPred.
- * - pDstPred is not aligned on a 16-byte boundary.
- * - iPredStep0 <= 0 or iPredStep0 is not a multiple of 16.
- * - iPredStep1 <= 0 or iPredStep1 is not a multiple of 16.
- * - iDstStep <= 0 or iDstStep is not a multiple of 16.
- * - iHeight is not 8 or 16.
- *
- */
-OMXResult omxVCCOMM_Average_16x (
- const OMX_U8 *pPred0,
- const OMX_U8 *pPred1,
- OMX_U32 iPredStep0,
- OMX_U32 iPredStep1,
- OMX_U8 *pDstPred,
- OMX_U32 iDstStep,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCCOMM_ExpandFrame_I (6.1.3.2.1)
- *
- * Description:
- * This function expands a reconstructed frame in-place. The unexpanded
- * source frame should be stored in a plane buffer with sufficient space
- * pre-allocated for edge expansion, and the input frame should be located in
- * the plane buffer center. This function executes the pixel expansion by
- * replicating source frame edge pixel intensities in the empty pixel
- * locations (expansion region) between the source frame edge and the plane
- * buffer edge. The width/height of the expansion regions on the
- * horizontal/vertical edges is controlled by the parameter iExpandPels.
- *
- * Input Arguments:
- *
- * pSrcDstPlane - pointer to the top-left corner of the frame to be
- * expanded; must be aligned on an 8-byte boundary.
- * iFrameWidth - frame width; must be a multiple of 8.
- * iFrameHeight -frame height; must be a multiple of 8.
- * iExpandPels - number of pixels to be expanded in the horizontal and
- * vertical directions; must be a multiple of 8.
- * iPlaneStep - distance, in bytes, between the start of consecutive lines
- * in the plane buffer; must be larger than or equal to
- * (iFrameWidth + 2 * iExpandPels).
- *
- * Output Arguments:
- *
- * pSrcDstPlane -Pointer to the top-left corner of the frame (NOT the
- * top-left corner of the plane); must be aligned on an 8-byte
- * boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - pSrcDstPlane is NULL.
- * - pSrcDstPlane is not aligned on an 8-byte boundary.
- * - one of the following parameters is either equal to zero or is a
- * non-multiple of 8: iFrameHeight, iFrameWidth, iPlaneStep, or
- * iExpandPels.
- * - iPlaneStep < (iFrameWidth + 2 * iExpandPels).
- *
- */
-OMXResult omxVCCOMM_ExpandFrame_I (
- OMX_U8 *pSrcDstPlane,
- OMX_U32 iFrameWidth,
- OMX_U32 iFrameHeight,
- OMX_U32 iExpandPels,
- OMX_U32 iPlaneStep
-);
-
-
-
-/**
- * Function: omxVCCOMM_Copy8x8 (6.1.3.3.1)
- *
- * Description:
- * Copies the reference 8x8 block to the current block.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the reference block in the source frame; must be
- * aligned on an 8-byte boundary.
- * step - distance between the starts of consecutive lines in the reference
- * frame, in bytes; must be a multiple of 8 and must be larger than
- * or equal to 8.
- *
- * Output Arguments:
- *
- * pDst - pointer to the destination block; must be aligned on an 8-byte
- * boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - one or more of the following pointers is NULL: pSrc, pDst
- * - one or more of the following pointers is not aligned on an 8-byte
- * boundary: pSrc, pDst
- * - step <8 or step is not a multiple of 8.
- *
- */
-OMXResult omxVCCOMM_Copy8x8 (
- const OMX_U8 *pSrc,
- OMX_U8 *pDst,
- OMX_INT step
-);
-
-
-
-/**
- * Function: omxVCCOMM_Copy16x16 (6.1.3.3.2)
- *
- * Description:
- * Copies the reference 16x16 macroblock to the current macroblock.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the reference macroblock in the source frame; must be
- * aligned on a 16-byte boundary.
- * step - distance between the starts of consecutive lines in the reference
- * frame, in bytes; must be a multiple of 16 and must be larger
- * than or equal to 16.
- *
- * Output Arguments:
- *
- * pDst - pointer to the destination macroblock; must be aligned on a
- * 16-byte boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - one or more of the following pointers is NULL: pSrc, pDst
- * - one or more of the following pointers is not aligned on a 16-byte
- * boundary: pSrc, pDst
- * - step <16 or step is not a multiple of 16.
- *
- */
-OMXResult omxVCCOMM_Copy16x16 (
- const OMX_U8 *pSrc,
- OMX_U8 *pDst,
- OMX_INT step
-);
-
-
-
-/**
- * Function: omxVCCOMM_ComputeTextureErrorBlock_SAD (6.1.4.1.1)
- *
- * Description:
- * Computes texture error of the block; also returns SAD.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the source plane; must be aligned on an 8-byte
- * boundary.
- * srcStep - step of the source plane
- * pSrcRef - pointer to the reference buffer, an 8x8 block; must be aligned
- * on an 8-byte boundary.
- *
- * Output Arguments:
- *
- * pDst - pointer to the destination buffer, an 8x8 block; must be aligned
- * on an 8-byte boundary.
- * pDstSAD - pointer to the Sum of Absolute Differences (SAD) value
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - At least one of the following
- * pointers is NULL: pSrc, pSrcRef, pDst and pDstSAD.
- * - pSrc is not 8-byte aligned.
- * - SrcStep <= 0 or srcStep is not a multiple of 8.
- * - pSrcRef is not 8-byte aligned.
- * - pDst is not 8-byte aligned.
- *
- */
-OMXResult omxVCCOMM_ComputeTextureErrorBlock_SAD (
- const OMX_U8 *pSrc,
- OMX_INT srcStep,
- const OMX_U8 *pSrcRef,
- OMX_S16 *pDst,
- OMX_INT *pDstSAD
-);
-
-
-
-/**
- * Function: omxVCCOMM_ComputeTextureErrorBlock (6.1.4.1.2)
- *
- * Description:
- * Computes the texture error of the block.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the source plane. This should be aligned on an 8-byte
- * boundary.
- * srcStep - step of the source plane
- * pSrcRef - pointer to the reference buffer, an 8x8 block. This should be
- * aligned on an 8-byte boundary.
- *
- * Output Arguments:
- *
- * pDst - pointer to the destination buffer, an 8x8 block. This should be
- * aligned on an 8-byte boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - At least one of the following pointers is NULL:
- * pSrc, pSrcRef, pDst.
- * - pSrc is not 8-byte aligned.
- * - SrcStep <= 0 or srcStep is not a multiple of 8.
- * - pSrcRef is not 8-byte aligned.
- * - pDst is not 8-byte aligned
- *
- */
-OMXResult omxVCCOMM_ComputeTextureErrorBlock (
- const OMX_U8 *pSrc,
- OMX_INT srcStep,
- const OMX_U8 *pSrcRef,
- OMX_S16 *pDst
-);
-
-
-
-/**
- * Function: omxVCCOMM_LimitMVToRect (6.1.4.1.3)
- *
- * Description:
- * Limits the motion vector associated with the current block/macroblock to
- * prevent the motion compensated block/macroblock from moving outside a
- * bounding rectangle as shown in Figure 6-1.
- *
- * Input Arguments:
- *
- * pSrcMV - pointer to the motion vector associated with the current block
- * or macroblock
- * pRectVOPRef - pointer to the bounding rectangle
- * Xcoord, Ycoord - coordinates of the current block or macroblock
- * size - size of the current block or macroblock; must be equal to 8 or
- * 16.
- *
- * Output Arguments:
- *
- * pDstMV - pointer to the limited motion vector
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one or more of the
- * following conditions is true:
- * - at least one of the following pointers is NULL:
- * pSrcMV, pDstMV, or pRectVOPRef.
- * - size is not equal to either 8 or 16.
- * - the width or height of the bounding rectangle is less than
- * twice the block size.
- */
-OMXResult omxVCCOMM_LimitMVToRect (
- const OMXVCMotionVector *pSrcMV,
- OMXVCMotionVector *pDstMV,
- const OMXRect *pRectVOPRef,
- OMX_INT Xcoord,
- OMX_INT Ycoord,
- OMX_INT size
-);
-
-
-
-/**
- * Function: omxVCCOMM_SAD_16x (6.1.4.1.4)
- *
- * Description:
- * This function calculates the SAD for 16x16 and 16x8 blocks.
- *
- * Input Arguments:
- *
- * pSrcOrg - Pointer to the original block; must be aligned on a 16-byte
- * boundary.
- * iStepOrg - Step of the original block buffer
- * pSrcRef - Pointer to the reference block
- * iStepRef - Step of the reference block buffer
- * iHeight - Height of the block
- *
- * Output Arguments:
- *
- * pDstSAD - Pointer of result SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one or more of the
- * following conditions is true:
- * - at least one of the following pointers is NULL:
- * pSrcOrg, pDstSAD, or pSrcRef
- * - pSrcOrg is not 16-byte aligned.
- * - iStepOrg <= 0 or iStepOrg is not a multiple of 16
- * - iStepRef <= 0 or iStepRef is not a multiple of 16
- * - iHeight is not 8 or 16
- *
- */
-OMXResult omxVCCOMM_SAD_16x (
- const OMX_U8 *pSrcOrg,
- OMX_U32 iStepOrg,
- const OMX_U8 *pSrcRef,
- OMX_U32 iStepRef,
- OMX_S32 *pDstSAD,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCCOMM_SAD_8x (6.1.4.1.5)
- *
- * Description:
- * This function calculates the SAD for 8x16, 8x8, 8x4 blocks.
- *
- * Input Arguments:
- *
- * pSrcOrg - Pointer to the original block; must be aligned on a 8-byte
- * boundary.
- * iStepOrg - Step of the original block buffer
- * pSrcRef - Pointer to the reference block
- * iStepRef - Step of the reference block buffer
- * iHeight - Height of the block
- *
- * Output Arguments:
- *
- * pDstSAD -Pointer of result SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one or more of the
- * following conditions is true:
- * - at least one of the following pointers is NULL:
- * pSrcOrg, pDstSAD, or pSrcRef
- * - pSrcOrg is not 8-byte aligned.
- * - iStepOrg <= 0 or iStepOrg is not a multiple of 8
- * - iStepRef <= 0 or iStepRef is not a multiple of 8
- * - iHeight is not 4, 8 or 16
- *
- */
-OMXResult omxVCCOMM_SAD_8x (
- const OMX_U8 *pSrcOrg,
- OMX_U32 iStepOrg,
- const OMX_U8 *pSrcRef,
- OMX_U32 iStepRef,
- OMX_S32*pDstSAD,
- OMX_U32 iHeight
-);
-
-
-
-/* 6.2.1.1 Direction */
-/* The direction enumerator is used with functions that perform AC/DC prediction and zig-zag scan. */
-
-enum {
- OMX_VC_NONE = 0,
- OMX_VC_HORIZONTAL = 1,
- OMX_VC_VERTICAL = 2
-};
-
-
-
-/* 6.2.1.2 Bilinear Interpolation */
-/* The bilinear interpolation enumerator is used with motion estimation, motion compensation, and reconstruction functions. */
-
-enum {
- OMX_VC_INTEGER_PIXEL = 0, /* case a */
- OMX_VC_HALF_PIXEL_X = 1, /* case b */
- OMX_VC_HALF_PIXEL_Y = 2, /* case c */
- OMX_VC_HALF_PIXEL_XY = 3 /* case d */
-};
-
-
-
-/* 6.2.1.3 Neighboring Macroblock Availability */
-/* Neighboring macroblock availability is indicated using the following flags: */
-
-enum {
- OMX_VC_UPPER = 1, /** above macroblock is available */
- OMX_VC_LEFT = 2, /** left macroblock is available */
- OMX_VC_CENTER = 4,
- OMX_VC_RIGHT = 8,
- OMX_VC_LOWER = 16,
- OMX_VC_UPPER_LEFT = 32, /** above-left macroblock is available */
- OMX_VC_UPPER_RIGHT = 64, /** above-right macroblock is available */
- OMX_VC_LOWER_LEFT = 128,
- OMX_VC_LOWER_RIGHT = 256
-};
-
-
-
-/* 6.2.1.4 Video Components */
-/* A data type that enumerates video components is defined as follows: */
-
-typedef enum {
- OMX_VC_LUMINANCE, /** Luminance component */
- OMX_VC_CHROMINANCE /** chrominance component */
-} OMXVCM4P2VideoComponent;
-
-
-
-/* 6.2.1.5 MacroblockTypes */
-/* A data type that enumerates macroblock types is defined as follows: */
-
-typedef enum {
- OMX_VC_INTER = 0, /** P picture or P-VOP */
- OMX_VC_INTER_Q = 1, /** P picture or P-VOP */
- OMX_VC_INTER4V = 2, /** P picture or P-VOP */
- OMX_VC_INTRA = 3, /** I and P picture, I- and P-VOP */
- OMX_VC_INTRA_Q = 4, /** I and P picture, I- and P-VOP */
- OMX_VC_INTER4V_Q = 5 /** P picture or P-VOP (H.263)*/
-} OMXVCM4P2MacroblockType;
-
-
-
-/* 6.2.1.6 Coordinates */
-/* Coordinates are represented as follows: */
-
-typedef struct {
- OMX_INT x;
- OMX_INT y;
-} OMXVCM4P2Coordinate;
-
-
-
-/* 6.2.1.7 Motion Estimation Algorithms */
-/* A data type that enumerates motion estimation search methods is defined as follows: */
-
-typedef enum {
- OMX_VC_M4P2_FAST_SEARCH = 0, /** Fast motion search */
- OMX_VC_M4P2_FULL_SEARCH = 1 /** Full motion search */
-} OMXVCM4P2MEMode;
-
-
-
-/* 6.2.1.8 Motion Estimation Parameters */
-/* A data structure containing control parameters for
- * motion estimation functions is defined as follows:
- */
-
-typedef struct {
- OMX_INT searchEnable8x8; /** enables 8x8 search */
- OMX_INT halfPelSearchEnable; /** enables half-pel resolution */
- OMX_INT searchRange; /** search range */
- OMX_INT rndVal; /** rounding control; 0-disabled, 1-enabled*/
-} OMXVCM4P2MEParams;
-
-
-
-/* 6.2.1.9 Macroblock Information */
-/* A data structure containing macroblock parameters for
- * motion estimation functions is defined as follows:
- */
-
-typedef struct {
- OMX_S32 sliceId; /* slice number */
- OMXVCM4P2MacroblockType mbType; /* MB type: OMX_VC_INTRA, OMX_VC_INTER, or OMX_VC_INTER4 */
- OMX_S32 qp; /* quantization parameter*/
- OMX_U32 cbpy; /* CBP Luma */
- OMX_U32 cbpc; /* CBP Chroma */
- OMXVCMotionVector pMV0[2][2]; /* motion vector, represented using 1/2-pel units,
- * pMV0[blocky][blockx] (blocky = 0~1, blockx =0~1)
- */
- OMXVCMotionVector pMVPred[2][2]; /* motion vector prediction, represented using 1/2-pel units,
- * pMVPred[blocky][blockx] (blocky = 0~1, blockx = 0~1)
- */
- OMX_U8 pPredDir[2][2]; /* AC prediction direction:
- * OMX_VC_NONE, OMX_VC_VERTICAL, OMX_VC_HORIZONTAL
- */
-} OMXVCM4P2MBInfo, *OMXVCM4P2MBInfoPtr;
-
-
-
-/**
- * Function: omxVCM4P2_FindMVpred (6.2.3.1.1)
- *
- * Description:
- * Predicts a motion vector for the current block using the procedure
- * specified in [ISO14496-2], subclause 7.6.5. The resulting predicted MV is
- * returned in pDstMVPred. If the parameter pDstMVPredME if is not NULL then
- * the set of three MV candidates used for prediction is also returned,
- * otherwise pDstMVPredMEis NULL upon return.
- *
- * Input Arguments:
- *
- * pSrcMVCurMB - pointer to the MV buffer associated with the current Y
- * macroblock; a value of NULL indicates unavailability.
- * pSrcCandMV1 - pointer to the MV buffer containing the 4 MVs associated
- * with the MB located to the left of the current MB; set to NULL
- * if there is no MB to the left.
- * pSrcCandMV2 - pointer to the MV buffer containing the 4 MVs associated
- * with the MB located above the current MB; set to NULL if there
- * is no MB located above the current MB.
- * pSrcCandMV3 - pointer to the MV buffer containing the 4 MVs associated
- * with the MB located to the right and above the current MB; set
- * to NULL if there is no MB located to the above-right.
- * iBlk - the index of block in the current macroblock
- * pDstMVPredME - MV candidate return buffer; if set to NULL then
- * prediction candidate MVs are not returned and pDstMVPredME will
- * be NULL upon function return; if pDstMVPredME is non-NULL then it
- * must point to a buffer containing sufficient space for three
- * return MVs.
- *
- * Output Arguments:
- *
- * pDstMVPred - pointer to the predicted motion vector
- * pDstMVPredME - if non-NULL upon input then pDstMVPredME points upon
- * return to a buffer containing the three motion vector candidates
- * used for prediction as specified in [ISO14496-2], subclause
- * 7.6.5, otherwise if NULL upon input then pDstMVPredME is NULL
- * upon output.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - the pointer pDstMVPred is NULL
- * - the parameter iBlk does not fall into the range 0 <= iBlk<=3
- *
- */
-OMXResult omxVCM4P2_FindMVpred (
- const OMXVCMotionVector *pSrcMVCurMB,
- const OMXVCMotionVector *pSrcCandMV1,
- const OMXVCMotionVector *pSrcCandMV2,
- const OMXVCMotionVector *pSrcCandMV3,
- OMXVCMotionVector *pDstMVPred,
- OMXVCMotionVector *pDstMVPredME,
- OMX_INT iBlk
-);
-
-
-
-/**
- * Function: omxVCM4P2_IDCT8x8blk (6.2.3.2.1)
- *
- * Description:
- * Computes a 2D inverse DCT for a single 8x8 block, as defined in
- * [ISO14496-2].
- *
- * Input Arguments:
- *
- * pSrc - pointer to the start of the linearly arranged IDCT input buffer;
- * must be aligned on a 16-byte boundary. According to
- * [ISO14496-2], the input coefficient values should lie within the
- * range [-2048, 2047].
- *
- * Output Arguments:
- *
- * pDst - pointer to the start of the linearly arranged IDCT output buffer;
- * must be aligned on a 16-byte boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - pSrc or pDst is NULL.
- * - pSrc or pDst is not 16-byte aligned.
- *
- */
-OMXResult omxVCM4P2_IDCT8x8blk (
- const OMX_S16 *pSrc,
- OMX_S16 *pDst
-);
-
-
-
-/**
- * Function: omxVCM4P2_MEGetBufSize (6.2.4.1.1)
- *
- * Description:
- * Computes the size, in bytes, of the vendor-specific specification
- * structure for the following motion estimation functions:
- * BlockMatch_Integer_8x8, BlockMatch_Integer_16x16, and MotionEstimationMB.
- *
- * Input Arguments:
- *
- * MEmode - motion estimation mode; available modes are defined by the
- * enumerated type OMXVCM4P2MEMode
- * pMEParams - motion estimation parameters
- *
- * Output Arguments:
- *
- * pSize - pointer to the number of bytes required for the specification
- * structure
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - one or more of the following is true:
- * - an invalid value was specified for the parameter MEmode
- * - a negative or zero value was specified for the
- * parameter pMEParams->searchRange
- *
- */
-OMXResult omxVCM4P2_MEGetBufSize (
- OMXVCM4P2MEMode MEmode,
- const OMXVCM4P2MEParams *pMEParams,
- OMX_U32 *pSize
-);
-
-
-
-/**
- * Function: omxVCM4P2_MEInit (6.2.4.1.2)
- *
- * Description:
- * Initializes the vendor-specific specification structure required for the
- * following motion estimation functions: BlockMatch_Integer_8x8,
- * BlockMatch_Integer_16x16, and MotionEstimationMB. Memory for the
- * specification structure *pMESpec must be allocated prior to calling the
- * function, and should be aligned on a 4-byte boundary. Following
- * initialization by this function, the vendor-specific structure *pMESpec
- * should contain an implementation-specific representation of all motion
- * estimation parameters received via the structure pMEParams, for example
- * rndVal, searchRange, etc. The number of bytes required for the
- * specification structure can be determined using the function
- * omxVCM4P2_MEGetBufSize.
- *
- * Input Arguments:
- *
- * MEmode - motion estimation mode; available modes are defined by the
- * enumerated type OMXVCM4P2MEMode
- * pMEParams - motion estimation parameters
- * pMESpec - pointer to the uninitialized ME specification structure
- *
- * Output Arguments:
- *
- * pMESpec - pointer to the initialized ME specification structure
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - one or more of the following is true:
- * - an invalid value was specified for the parameter MEmode
- * - a negative or zero value was specified for the
- * parameter pMEParams->searchRange
- *
- */
-OMXResult omxVCM4P2_MEInit (
- OMXVCM4P2MEMode MEmode,
- const OMXVCM4P2MEParams*pMEParams,
- void *pMESpec
-);
-
-
-
-/**
- * Function: omxVCM4P2_BlockMatch_Integer_16x16 (6.2.4.2.1)
- *
- * Description:
- * Performs a 16x16 block search; estimates motion vector and associated
- * minimum SAD. Both the input and output motion vectors are represented using
- * half-pixel units, and therefore a shift left or right by 1 bit may be
- * required, respectively, to match the input or output MVs with other
- * functions that either generate output MVs or expect input MVs represented
- * using integer pixel units.
- *
- * Input Arguments:
- *
- * pSrcRefBuf - pointer to the reference Y plane; points to the reference
- * MB that corresponds to the location of the current macroblock in
- * the current plane.
- * refWidth - width of the reference plane
- * pRefRect - pointer to the valid reference plane rectangle; coordinates
- * are specified relative to the image origin. Rectangle
- * boundaries may extend beyond image boundaries if the image has
- * been padded. For example, if padding extends 4 pixels beyond
- * frame border, then the value for the left border could be set to
- * -4.
- * pSrcCurrBuf - pointer to the current block in the current macroblock
- * buffer extracted from the original plane (linear array, 256
- * entries); must be aligned on a 16-byte boundary. The number of
- * bytes between lines (step) is 16.
- * pCurrPointPos - position of the current macroblock in the current plane
- * pSrcPreMV - pointer to predicted motion vector; NULL indicates no
- * predicted MV
- * pSrcPreSAD - pointer to SAD associated with the predicted MV (referenced
- * by pSrcPreMV); may be set to NULL if unavailable.
- * pMESpec - vendor-specific motion estimation specification structure;
- * must have been allocated and then initialized using
- * omxVCM4P2_MEInit prior to calling the block matching function.
- *
- * Output Arguments:
- *
- * pDstMV - pointer to estimated MV
- * pDstSAD - pointer to minimum SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following
- * conditions is true:
- * - at least one of the following pointers is NULL: pSrcRefBuf,
- * pRefRect, pSrcCurrBuff, pCurrPointPos, pDstMV, pDstSAD or
- * pMESpec, or
- * - pSrcCurrBuf is not 16-byte aligned
- *
- */
-OMXResult omxVCM4P2_BlockMatch_Integer_16x16 (
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- const OMXVCMotionVector*pSrcPreMV,
- const OMX_INT *pSrcPreSAD,
- void *pMESpec,
- OMXVCMotionVector*pDstMV,
- OMX_INT *pDstSAD
-);
-
-
-
-/**
- * Function: omxVCM4P2_BlockMatch_Integer_8x8 (6.2.4.2.2)
- *
- * Description:
- * Performs an 8x8 block search; estimates motion vector and associated
- * minimum SAD. Both the input and output motion vectors are represented
- * using half-pixel units, and therefore a shift left or right by 1 bit may be
- * required, respectively, to match the input or output MVs with other
- * functions that either generate output MVs or expect input MVs represented
- * using integer pixel units.
- *
- * Input Arguments:
- *
- * pSrcRefBuf - pointer to the reference Y plane; points to the reference
- * block that corresponds to the location of the current 8x8 block
- * in the current plane.
- * refWidth - width of the reference plane
- * pRefRect - pointer to the valid reference plane rectangle; coordinates
- * are specified relative to the image origin. Rectangle
- * boundaries may extend beyond image boundaries if the image has
- * been padded.
- * pSrcCurrBuf - pointer to the current block in the current macroblock
- * buffer extracted from the original plane (linear array, 128
- * entries); must be aligned on an 8-byte boundary. The number of
- * bytes between lines (step) is 16 bytes.
- * pCurrPointPos - position of the current block in the current plane
- * pSrcPreMV - pointer to predicted motion vector; NULL indicates no
- * predicted MV
- * pSrcPreSAD - pointer to SAD associated with the predicted MV (referenced
- * by pSrcPreMV); may be set to NULL if unavailable.
- * pMESpec - vendor-specific motion estimation specification structure;
- * must have been allocated and then initialized using
- * omxVCM4P2_MEInit prior to calling the block matching function.
- *
- * Output Arguments:
- *
- * pDstMV - pointer to estimated MV
- * pDstSAD - pointer to minimum SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following
- * conditions is true:
- * - at least one of the following pointers is NULL: pSrcRefBuf,
- * pRefRect, pSrcCurrBuff, pCurrPointPos, pDstMV, pDstSAD or
- * pMESpec, or
- * - pSrcCurrBuf is not 8-byte aligned
- *
- */
-OMXResult omxVCM4P2_BlockMatch_Integer_8x8 (
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- const OMXVCMotionVector *pSrcPreMV,
- const OMX_INT *pSrcPreSAD,
- void *pMESpec,
- OMXVCMotionVector *pDstMV,
- OMX_INT *pDstSAD
-);
-
-
-
-/**
- * Function: omxVCM4P2_BlockMatch_Half_16x16 (6.2.4.2.3)
- *
- * Description:
- * Performs a 16x16 block match with half-pixel resolution. Returns the
- * estimated motion vector and associated minimum SAD. This function
- * estimates the half-pixel motion vector by interpolating the integer
- * resolution motion vector referenced by the input parameter pSrcDstMV, i.e.,
- * the initial integer MV is generated externally. The input parameters
- * pSrcRefBuf and pSearchPointRefPos should be shifted by the winning MV of
- * 16x16 integer search prior to calling BlockMatch_Half_16x16. The function
- * BlockMatch_Integer_16x16 may be used for integer motion estimation.
- *
- * Input Arguments:
- *
- * pSrcRefBuf - pointer to the reference Y plane; points to the reference
- * macroblock that corresponds to the location of the current
- * macroblock in the current plane.
- * refWidth - width of the reference plane
- * pRefRect - reference plane valid region rectangle
- * pSrcCurrBuf - pointer to the current block in the current macroblock
- * buffer extracted from the original plane (linear array, 256
- * entries); must be aligned on a 16-byte boundary. The number of
- * bytes between lines (step) is 16.
- * pSearchPointRefPos - position of the starting point for half pixel
- * search (specified in terms of integer pixel units) in the
- * reference plane, i.e., the reference position pointed to by the
- * predicted motion vector.
- * rndVal - rounding control parameter: 0 - disabled; 1 - enabled.
- * pSrcDstMV - pointer to the initial MV estimate; typically generated
- * during a prior 16X16 integer search; specified in terms of
- * half-pixel units.
- *
- * Output Arguments:
- *
- * pSrcDstMV - pointer to estimated MV
- * pDstSAD - pointer to minimum SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following
- * conditions is true:
- * - at least one of the following pointers is NULL: pSrcRefBuf,
- * pRefRect, pSrcCurrBuff, pSearchPointRefPos, pSrcDstMV.
- * - pSrcCurrBuf is not 16-byte aligned, or
- *
- */
-OMXResult omxVCM4P2_BlockMatch_Half_16x16 (
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pSearchPointRefPos,
- OMX_INT rndVal,
- OMXVCMotionVector *pSrcDstMV,
- OMX_INT *pDstSAD
-);
-
-
-
-/**
- * Function: omxVCM4P2_BlockMatch_Half_8x8 (6.2.4.2.4)
- *
- * Description:
- * Performs an 8x8 block match with half-pixel resolution. Returns the
- * estimated motion vector and associated minimum SAD. This function
- * estimates the half-pixel motion vector by interpolating the integer
- * resolution motion vector referenced by the input parameter pSrcDstMV, i.e.,
- * the initial integer MV is generated externally. The input parameters
- * pSrcRefBuf and pSearchPointRefPos should be shifted by the winning MV of
- * 8x8 integer search prior to calling BlockMatch_Half_8x8. The function
- * BlockMatch_Integer_8x8 may be used for integer motion estimation.
- *
- * Input Arguments:
- *
- * pSrcRefBuf - pointer to the reference Y plane; points to the reference
- * block that corresponds to the location of the current 8x8 block
- * in the current plane.
- * refWidth - width of the reference plane
- * pRefRect - reference plane valid region rectangle
- * pSrcCurrBuf - pointer to the current block in the current macroblock
- * buffer extracted from the original plane (linear array, 128
- * entries); must be aligned on a 8-byte boundary. The number of
- * bytes between lines (step) is 16.
- * pSearchPointRefPos - position of the starting point for half pixel
- * search (specified in terms of integer pixel units) in the
- * reference plane.
- * rndVal - rounding control parameter: 0 - disabled; 1 - enabled.
- * pSrcDstMV - pointer to the initial MV estimate; typically generated
- * during a prior 8x8 integer search, specified in terms of
- * half-pixel units.
- *
- * Output Arguments:
- *
- * pSrcDstMV - pointer to estimated MV
- * pDstSAD - pointer to minimum SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following
- * conditions is true:
- * - at least one of the following pointers is NULL:
- * pSrcRefBuf, pRefRect, pSrcCurrBuff, pSearchPointRefPos, pSrcDstMV
- * - pSrcCurrBuf is not 8-byte aligned
- *
- */
-OMXResult omxVCM4P2_BlockMatch_Half_8x8 (
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pSearchPointRefPos,
- OMX_INT rndVal,
- OMXVCMotionVector *pSrcDstMV,
- OMX_INT *pDstSAD
-);
-
-
-
-/**
- * Function: omxVCM4P2_MotionEstimationMB (6.2.4.3.1)
- *
- * Description:
- * Performs motion search for a 16x16 macroblock. Selects best motion search
- * strategy from among inter-1MV, inter-4MV, and intra modes. Supports
- * integer and half pixel resolution.
- *
- * Input Arguments:
- *
- * pSrcCurrBuf - pointer to the top-left corner of the current MB in the
- * original picture plane; must be aligned on a 16-byte boundary.
- * The function does not expect source data outside the region
- * bounded by the MB to be available; for example it is not
- * necessary for the caller to guarantee the availability of
- * pSrcCurrBuf[-SrcCurrStep], i.e., the row of pixels above the MB
- * to be processed.
- * srcCurrStep - width of the original picture plane, in terms of full
- * pixels; must be a multiple of 16.
- * pSrcRefBuf - pointer to the reference Y plane; points to the reference
- * plane location corresponding to the location of the current
- * macroblock in the current plane; must be aligned on a 16-byte
- * boundary.
- * srcRefStep - width of the reference picture plane, in terms of full
- * pixels; must be a multiple of 16.
- * pRefRect - reference plane valid region rectangle, specified relative to
- * the image origin
- * pCurrPointPos - position of the current macroblock in the current plane
- * pMESpec - pointer to the vendor-specific motion estimation specification
- * structure; must be allocated and then initialized using
- * omxVCM4P2_MEInit prior to calling this function.
- * pMBInfo - array, of dimension four, containing pointers to information
- * associated with four nearby MBs:
- * - pMBInfo[0] - pointer to left MB information
- * - pMBInfo[1] - pointer to top MB information
- * - pMBInfo[2] - pointer to top-left MB information
- * - pMBInfo[3] - pointer to top-right MB information
- * Any pointer in the array may be set equal to NULL if the
- * corresponding MB doesn't exist. For each MB, the following structure
- * members are used:
- * - mbType - macroblock type, either OMX_VC_INTRA, OMX_VC_INTER, or
- * OMX_VC_INTER4V
- * - pMV0[2][2] - estimated motion vectors; represented
- * in 1/2 pixel units
- * - sliceID - number of the slice to which the MB belongs
- * pSrcDstMBCurr - pointer to information structure for the current MB.
- * The following entries should be set prior to calling the
- * function: sliceID - the number of the slice the to which the
- * current MB belongs. The structure elements cbpy and cbpc are
- * ignored.
- *
- * Output Arguments:
- *
- * pSrcDstMBCurr - pointer to updated information structure for the current
- * MB after MB-level motion estimation has been completed. The
- * following structure members are updated by the ME function:
- * - mbType - macroblock type: OMX_VC_INTRA, OMX_VC_INTER, or
- * OMX_VC_INTER4V.
- * - pMV0[2][2] - estimated motion vectors; represented in
- * terms of 1/2 pel units.
- * - pMVPred[2][2] - predicted motion vectors; represented
- * in terms of 1/2 pel units.
- * The structure members cbpy and cbpc are not updated by the function.
- * pDstSAD - pointer to the minimum SAD for INTER1V, or sum of minimum SADs
- * for INTER4V
- * pDstBlockSAD - pointer to an array of SAD values for each of the four
- * 8x8 luma blocks in the MB. The block SADs are in scan order for
- * each MB.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one or more of the
- * following conditions is true:
- * - at least one of the following pointers is NULL: pSrcCurrBuf,
- * pSrcRefBuf, pRefRect, pCurrPointPos, pMBInter, pMBIntra,
- * pSrcDstMBCurr, or pDstSAD.
- *
- */
-OMXResult omxVCM4P2_MotionEstimationMB (
- const OMX_U8 *pSrcCurrBuf,
- OMX_S32 srcCurrStep,
- const OMX_U8 *pSrcRefBuf,
- OMX_S32 srcRefStep,
- const OMXRect*pRefRect,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- void *pMESpec,
- const OMXVCM4P2MBInfoPtr *pMBInfo,
- OMXVCM4P2MBInfo *pSrcDstMBCurr,
- OMX_U16 *pDstSAD,
- OMX_U16 *pDstBlockSAD
-);
-
-
-
-/**
- * Function: omxVCM4P2_DCT8x8blk (6.2.4.4.1)
- *
- * Description:
- * Computes a 2D forward DCT for a single 8x8 block, as defined in
- * [ISO14496-2].
- *
- * Input Arguments:
- *
- * pSrc - pointer to the start of the linearly arranged input buffer; must
- * be aligned on a 16-byte boundary. Input values (pixel
- * intensities) are valid in the range [-255,255].
- *
- * Output Arguments:
- *
- * pDst - pointer to the start of the linearly arranged output buffer; must
- * be aligned on a 16-byte boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments, returned if:
- * - pSrc or pDst is NULL.
- * - pSrc or pDst is not 16-byte aligned.
- *
- */
-OMXResult omxVCM4P2_DCT8x8blk (
- const OMX_S16 *pSrc,
- OMX_S16 *pDst
-);
-
-
-
-/**
- * Function: omxVCM4P2_QuantIntra_I (6.2.4.4.2)
- *
- * Description:
- * Performs quantization on intra block coefficients. This function supports
- * bits_per_pixel == 8.
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input intra block coefficients; must be aligned
- * on a 16-byte boundary.
- * QP - quantization parameter (quantizer_scale).
- * blockIndex - block index indicating the component type and position,
- * valid in the range 0 to 5, as defined in [ISO14496-2], subclause
- * 6.1.3.8.
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; shortVideoHeader==1 selects linear intra DC
- * mode, and shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to the output (quantized) interblock coefficients.
- * When shortVideoHeader==1, AC coefficients are saturated on the
- * interval [-127, 127], and DC coefficients are saturated on the
- * interval [1, 254]. When shortVideoHeader==0, AC coefficients
- * are saturated on the interval [-2047, 2047].
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - pSrcDst is NULL.
- * - blockIndex < 0 or blockIndex >= 10
- * - QP <= 0 or QP >= 32.
- *
- */
-OMXResult omxVCM4P2_QuantIntra_I (
- OMX_S16 *pSrcDst,
- OMX_U8 QP,
- OMX_INT blockIndex,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_QuantInter_I (6.2.4.4.3)
- *
- * Description:
- * Performs quantization on an inter coefficient block; supports
- * bits_per_pixel == 8.
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input inter block coefficients; must be aligned
- * on a 16-byte boundary.
- * QP - quantization parameter (quantizer_scale)
- * shortVideoHeader - binary flag indicating presence of short_video_header;
- * shortVideoHeader==1 selects linear intra DC mode, and
- * shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to the output (quantized) interblock coefficients.
- * When shortVideoHeader==1, AC coefficients are saturated on the
- * interval [-127, 127], and DC coefficients are saturated on the
- * interval [1, 254]. When shortVideoHeader==0, AC coefficients
- * are saturated on the interval [-2047, 2047].
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - pSrcDst is NULL.
- * - QP <= 0 or QP >= 32.
- *
- */
-OMXResult omxVCM4P2_QuantInter_I (
- OMX_S16 *pSrcDst,
- OMX_U8 QP,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_TransRecBlockCoef_intra (6.2.4.4.4)
- *
- * Description:
- * Quantizes the DCT coefficients, implements intra block AC/DC coefficient
- * prediction, and reconstructs the current intra block texture for prediction
- * on the next frame. Quantized row and column coefficients are returned in
- * the updated coefficient buffers.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the pixels of current intra block; must be aligned on
- * an 8-byte boundary.
- * pPredBufRow - pointer to the coefficient row buffer containing
- * ((num_mb_per_row * 2 + 1) * 8) elements of type OMX_S16.
- * Coefficients are organized into blocks of eight as described
- * below (Internal Prediction Coefficient Update Procedures). The
- * DC coefficient is first, and the remaining buffer locations
- * contain the quantized AC coefficients. Each group of eight row
- * buffer elements combined with one element eight elements ahead
- * contains the coefficient predictors of the neighboring block
- * that is spatially above or to the left of the block currently to
- * be decoded. A negative-valued DC coefficient indicates that this
- * neighboring block is not INTRA-coded or out of bounds, and
- * therefore the AC and DC coefficients are invalid. Pointer must
- * be aligned on an 8-byte boundary.
- * pPredBufCol - pointer to the prediction coefficient column buffer
- * containing 16 elements of type OMX_S16. Coefficients are
- * organized as described in section 6.2.2.5. Pointer must be
- * aligned on an 8-byte boundary.
- * pSumErr - pointer to a flag indicating whether or not AC prediction is
- * required; AC prediction is enabled if *pSumErr >=0, but the
- * value is not used for coefficient prediction, i.e., the sum of
- * absolute differences starts from 0 for each call to this
- * function. Otherwise AC prediction is disabled if *pSumErr < 0 .
- * blockIndex - block index indicating the component type and position, as
- * defined in [ISO14496-2], subclause 6.1.3.8.
- * curQp - quantization parameter of the macroblock to which the current
- * block belongs
- * pQpBuf - pointer to a 2-element quantization parameter buffer; pQpBuf[0]
- * contains the quantization parameter associated with the 8x8
- * block left of the current block (QPa), and pQpBuf[1] contains
- * the quantization parameter associated with the 8x8 block above
- * the current block (QPc). In the event that the corresponding
- * block is outside of the VOP bound, the Qp value will not affect
- * the intra prediction process, as described in [ISO14496-2],
- * sub-clause 7.4.3.3, Adaptive AC Coefficient Prediction.
- * srcStep - width of the source buffer; must be a multiple of 8.
- * dstStep - width of the reconstructed destination buffer; must be a
- * multiple of 16.
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; shortVideoHeader==1 selects linear intra DC
- * mode, and shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * pDst - pointer to the quantized DCT coefficient buffer; pDst[0] contains
- * the predicted DC coefficient; the remaining entries contain the
- * quantized AC coefficients (without prediction). The pointer
- * pDstmust be aligned on a 16-byte boundary.
- * pRec - pointer to the reconstructed texture; must be aligned on an
- * 8-byte boundary.
- * pPredBufRow - pointer to the updated coefficient row buffer
- * pPredBufCol - pointer to the updated coefficient column buffer
- * pPreACPredict - if prediction is enabled, the parameter points to the
- * start of the buffer containing the coefficient differences for
- * VLC encoding. The entry pPreACPredict[0]indicates prediction
- * direction for the current block and takes one of the following
- * values: OMX_VC_NONE (prediction disabled), OMX_VC_HORIZONTAL, or
- * OMX_VC_VERTICAL. The entries
- * pPreACPredict[1]-pPreACPredict[7]contain predicted AC
- * coefficients. If prediction is disabled (*pSumErr<0) then the
- * contents of this buffer are undefined upon return from the
- * function
- * pSumErr - pointer to the value of the accumulated AC coefficient errors,
- * i.e., sum of the absolute differences between predicted and
- * unpredicted AC coefficients
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - Bad arguments:
- * - At least one of the following pointers is NULL: pSrc, pDst, pRec,
- * pCoefBufRow, pCoefBufCol, pQpBuf, pPreACPredict, pSumErr.
- * - blockIndex < 0 or blockIndex >= 10;
- * - curQP <= 0 or curQP >= 32.
- * - srcStep, or dstStep <= 0 or not a multiple of 8.
- * - pDst is not 16-byte aligned: .
- * - At least one of the following pointers is not 8-byte aligned:
- * pSrc, pRec.
- *
- * Note: The coefficient buffers must be updated in accordance with the
- * update procedures defined in section in 6.2.2.
- *
- */
-OMXResult omxVCM4P2_TransRecBlockCoef_intra (
- const OMX_U8 *pSrc,
- OMX_S16 *pDst,
- OMX_U8 *pRec,
- OMX_S16 *pPredBufRow,
- OMX_S16 *pPredBufCol,
- OMX_S16 *pPreACPredict,
- OMX_INT *pSumErr,
- OMX_INT blockIndex,
- OMX_U8 curQp,
- const OMX_U8 *pQpBuf,
- OMX_INT srcStep,
- OMX_INT dstStep,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_TransRecBlockCoef_inter (6.2.4.4.5)
- *
- * Description:
- * Implements DCT, and quantizes the DCT coefficients of the inter block
- * while reconstructing the texture residual. There is no boundary check for
- * the bit stream buffer.
- *
- * Input Arguments:
- *
- * pSrc -pointer to the residuals to be encoded; must be aligned on an
- * 16-byte boundary.
- * QP - quantization parameter.
- * shortVideoHeader - binary flag indicating presence of short_video_header;
- * shortVideoHeader==1 selects linear intra DC mode, and
- * shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * pDst - pointer to the quantized DCT coefficients buffer; must be aligned
- * on a 16-byte boundary.
- * pRec - pointer to the reconstructed texture residuals; must be aligned
- * on a 16-byte boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - At least one of the following pointers is either NULL or
- * not 16-byte aligned:
- * - pSrc
- * - pDst
- * - pRec
- * - QP <= 0 or QP >= 32.
- *
- */
-OMXResult omxVCM4P2_TransRecBlockCoef_inter (
- const OMX_S16 *pSrc,
- OMX_S16 *pDst,
- OMX_S16 *pRec,
- OMX_U8 QP,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_EncodeVLCZigzag_IntraDCVLC (6.2.4.5.2)
- *
- * Description:
- * Performs zigzag scan and VLC encoding of AC and DC coefficients for one
- * intra block. Two versions of the function (DCVLC and ACVLC) are provided
- * in order to support the two different methods of processing DC
- * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, "Intra DC
- * Coefficient Decoding for the Case of Switched VLC Encoding".
- *
- * Input Arguments:
- *
- * ppBitStream - double pointer to the current byte in the bitstream
- * pBitOffset - pointer to the bit position in the byte pointed by
- * *ppBitStream. Valid within 0 to 7.
- * pQDctBlkCoef - pointer to the quantized DCT coefficient
- * predDir - AC prediction direction, which is used to decide the zigzag
- * scan pattern; takes one of the following values:
- * - OMX_VC_NONE - AC prediction not used.
- * Performs classical zigzag scan.
- * - OMX_VC_HORIZONTAL - Horizontal prediction.
- * Performs alternate-vertical zigzag scan.
- * - OMX_VC_VERTICAL - Vertical prediction.
- * Performs alternate-horizontal zigzag scan.
- * pattern - block pattern which is used to decide whether this block is
- * encoded
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- * videoComp - video component type (luminance, chrominance) of the current
- * block
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is encoded, so
- * that it points to the current byte in the bit stream buffer.
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - Bad arguments:
- * - At least one of the following pointers is NULL: ppBitStream,
- * *ppBitStream, pBitOffset, pQDctBlkCoef.
- * - *pBitOffset < 0, or *pBitOffset >7.
- * - PredDir is not one of: OMX_VC_NONE, OMX_VC_HORIZONTAL, or
- * OMX_VC_VERTICAL.
- * - VideoComp is not one component of enum OMXVCM4P2VideoComponent.
- *
- */
-OMXResult omxVCM4P2_EncodeVLCZigzag_IntraDCVLC (
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- const OMX_S16 *pQDctBlkCoef,
- OMX_U8 predDir,
- OMX_U8 pattern,
- OMX_INT shortVideoHeader,
- OMXVCM4P2VideoComponent videoComp
-);
-
-
-
-/**
- * Function: omxVCM4P2_EncodeVLCZigzag_IntraACVLC (6.2.4.5.2)
- *
- * Description:
- * Performs zigzag scan and VLC encoding of AC and DC coefficients for one
- * intra block. Two versions of the function (DCVLC and ACVLC) are provided
- * in order to support the two different methods of processing DC
- * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, Intra DC
- * Coefficient Decoding for the Case of Switched VLC Encoding.
- *
- * Input Arguments:
- *
- * ppBitStream - double pointer to the current byte in the bitstream
- * pBitOffset - pointer to the bit position in the byte pointed by
- * *ppBitStream. Valid within 0 to 7.
- * pQDctBlkCoef - pointer to the quantized DCT coefficient
- * predDir - AC prediction direction, which is used to decide the zigzag
- * scan pattern; takes one of the following values:
- * - OMX_VC_NONE - AC prediction not used.
- * Performs classical zigzag scan.
- * - OMX_VC_HORIZONTAL - Horizontal prediction.
- * Performs alternate-vertical zigzag scan.
- * - OMX_VC_VERTICAL - Vertical prediction.
- * Performs alternate-horizontal zigzag scan.
- * pattern - block pattern which is used to decide whether this block is
- * encoded
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is encoded, so
- * that it points to the current byte in the bit stream buffer.
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - Bad arguments:
- * - At least one of the following pointers is NULL: ppBitStream,
- * *ppBitStream, pBitOffset, pQDctBlkCoef.
- * - *pBitOffset < 0, or *pBitOffset >7.
- * - PredDir is not one of: OMX_VC_NONE, OMX_VC_HORIZONTAL, or
- * OMX_VC_VERTICAL.
- * - VideoComp is not one component of enum OMXVCM4P2VideoComponent.
- *
- */
-OMXResult omxVCM4P2_EncodeVLCZigzag_IntraACVLC (
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- const OMX_S16 *pQDctBlkCoef,
- OMX_U8 predDir,
- OMX_U8 pattern,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_EncodeVLCZigzag_Inter (6.2.4.5.3)
- *
- * Description:
- * Performs classical zigzag scanning and VLC encoding for one inter block.
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the bit
- * stream
- * pBitOffset - pointer to the bit position in the byte pointed by
- * *ppBitStream. Valid within 0 to 7
- * pQDctBlkCoef - pointer to the quantized DCT coefficient
- * pattern - block pattern which is used to decide whether this block is
- * encoded
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is encoded so that
- * it points to the current byte in the bit stream buffer.
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - Bad arguments
- * - At least one of the pointers: is NULL: ppBitStream, *ppBitStream,
- * pBitOffset, pQDctBlkCoef
- * - *pBitOffset < 0, or *pBitOffset >7.
- *
- */
-OMXResult omxVCM4P2_EncodeVLCZigzag_Inter (
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- const OMX_S16 *pQDctBlkCoef,
- OMX_U8 pattern,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_EncodeMV (6.2.4.5.4)
- *
- * Description:
- * Predicts a motion vector for the current macroblock, encodes the
- * difference, and writes the output to the stream buffer. The input MVs
- * pMVCurMB, pSrcMVLeftMB, pSrcMVUpperMB, and pSrcMVUpperRightMB should lie
- * within the ranges associated with the input parameter fcodeForward, as
- * described in [ISO14496-2], subclause 7.6.3. This function provides a
- * superset of the functionality associated with the function
- * omxVCM4P2_FindMVpred.
- *
- * Input Arguments:
- *
- * ppBitStream - double pointer to the current byte in the bitstream buffer
- * pBitOffset - index of the first free (next available) bit in the stream
- * buffer referenced by *ppBitStream, valid in the range 0 to 7.
- * pMVCurMB - pointer to the current macroblock motion vector; a value of
- * NULL indicates unavailability.
- * pSrcMVLeftMB - pointer to the source left macroblock motion vector; a
- * value of NULLindicates unavailability.
- * pSrcMVUpperMB - pointer to source upper macroblock motion vector; a
- * value of NULL indicates unavailability.
- * pSrcMVUpperRightMB - pointer to source upper right MB motion vector; a
- * value of NULL indicates unavailability.
- * fcodeForward - an integer with values from 1 to 7; used in encoding
- * motion vectors related to search range, as described in
- * [ISO14496-2], subclause 7.6.3.
- * MBType - macro block type, valid in the range 0 to 5
- *
- * Output Arguments:
- *
- * ppBitStream - updated pointer to the current byte in the bit stream
- * buffer
- * pBitOffset - updated index of the next available bit position in stream
- * buffer referenced by *ppBitStream
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - At least one of the following pointers is NULL: ppBitStream,
- * *ppBitStream, pBitOffset, pMVCurMB
- * - *pBitOffset < 0, or *pBitOffset >7.
- * - fcodeForward <= 0, or fcodeForward > 7, or MBType < 0.
- *
- */
-OMXResult omxVCM4P2_EncodeMV (
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- const OMXVCMotionVector *pMVCurMB,
- const OMXVCMotionVector*pSrcMVLeftMB,
- const OMXVCMotionVector *pSrcMVUpperMB,
- const OMXVCMotionVector *pSrcMVUpperRightMB,
- OMX_INT fcodeForward,
- OMXVCM4P2MacroblockType MBType
-);
-
-
-
-/**
- * Function: omxVCM4P2_DecodePadMV_PVOP (6.2.5.1.1)
- *
- * Description:
- * Decodes and pads the four motion vectors associated with a non-intra P-VOP
- * macroblock. For macroblocks of type OMX_VC_INTER4V, the output MV is
- * padded as specified in [ISO14496-2], subclause 7.6.1.6. Otherwise, for
- * macroblocks of types other than OMX_VC_INTER4V, the decoded MV is copied to
- * all four output MV buffer entries.
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the bit
- * stream buffer
- * pBitOffset - pointer to the bit position in the byte pointed to by
- * *ppBitStream. *pBitOffset is valid within [0-7].
- * pSrcMVLeftMB, pSrcMVUpperMB, and pSrcMVUpperRightMB - pointers to the
- * motion vector buffers of the macroblocks specially at the left,
- * upper, and upper-right side of the current macroblock,
- * respectively; a value of NULL indicates unavailability. Note:
- * Any neighborhood macroblock outside the current VOP or video
- * packet or outside the current GOB (when short_video_header is
- * 1 ) for which gob_header_empty is 0 is treated as
- * transparent, according to [ISO14496-2], subclause 7.6.5.
- * fcodeForward - a code equal to vop_fcode_forward in MPEG-4 bit stream
- * syntax
- * MBType - the type of the current macroblock. If MBType is not equal to
- * OMX_VC_INTER4V, the destination motion vector buffer is still
- * filled with the same decoded vector.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded, so
- * that it points to the current byte in the bit stream buffer
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream
- * pDstMVCurMB - pointer to the motion vector buffer for the current
- * macroblock; contains four decoded motion vectors
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - At least one of the following pointers is NULL:
- * ppBitStream, *ppBitStream, pBitOffset, pDstMVCurMB
- * - *pBitOffset exceeds [0,7]
- * - fcodeForward exceeds (0,7]
- * - MBType less than zero
- * - motion vector buffer is not 4-byte aligned.
- * OMX_Sts_Err - status error
- *
- */
-OMXResult omxVCM4P2_DecodePadMV_PVOP (
- const OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- OMXVCMotionVector *pSrcMVLeftMB,
- OMXVCMotionVector*pSrcMVUpperMB,
- OMXVCMotionVector *pSrcMVUpperRightMB,
- OMXVCMotionVector*pDstMVCurMB,
- OMX_INT fcodeForward,
- OMXVCM4P2MacroblockType MBType
-);
-
-
-
-/**
- * Function: omxVCM4P2_DecodeVLCZigzag_IntraDCVLC (6.2.5.2.2)
- *
- * Description:
- * Performs VLC decoding and inverse zigzag scan of AC and DC coefficients
- * for one intra block. Two versions of the function (DCVLC and ACVLC) are
- * provided in order to support the two different methods of processing DC
- * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, Intra DC
- * Coefficient Decoding for the Case of Switched VLC Encoding.
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the
- * bitstream buffer
- * pBitOffset - pointer to the bit position in the current byte referenced
- * by *ppBitStream. The parameter *pBitOffset is valid in the
- * range [0-7].
- * Bit Position in one byte: |Most Least|
- * *pBitOffset |0 1 2 3 4 5 6 7|
- * predDir - AC prediction direction; used to select the zigzag scan
- * pattern; takes one of the following values:
- * - OMX_VC_NONE - AC prediction not used;
- * performs classical zigzag scan.
- * - OMX_VC_HORIZONTAL - Horizontal prediction;
- * performs alternate-vertical zigzag scan;
- * - OMX_VC_VERTICAL - Vertical prediction;
- * performs alternate-horizontal zigzag scan.
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- * videoComp - video component type (luminance or chrominance) of the
- * current block
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded such
- * that it points to the current byte in the bit stream buffer
- * pBitOffset - *pBitOffset is updated such that it points to the current
- * bit position in the byte pointed by *ppBitStream
- * pDst - pointer to the coefficient buffer of current block; must be
- * 4-byte aligned.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments, if:
- * - At least one of the following pointers is NULL:
- * ppBitStream, *ppBitStream, pBitOffset, pDst
- * - *pBitOffset exceeds [0,7]
- * - preDir exceeds [0,2]
- * - pDst is not 4-byte aligned
- * OMX_Sts_Err - if:
- * - In DecodeVLCZigzag_IntraDCVLC, dc_size > 12
- * - At least one of mark bits equals zero
- * - Illegal stream encountered; code cannot be located in VLC table
- * - Forbidden code encountered in the VLC FLC table.
- * - The number of coefficients is greater than 64
- *
- */
-OMXResult omxVCM4P2_DecodeVLCZigzag_IntraDCVLC (
- const OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- OMX_S16 *pDst,
- OMX_U8 predDir,
- OMX_INT shortVideoHeader,
- OMXVCM4P2VideoComponent videoComp
-);
-
-
-
-/**
- * Function: omxVCM4P2_DecodeVLCZigzag_IntraACVLC (6.2.5.2.2)
- *
- * Description:
- * Performs VLC decoding and inverse zigzag scan of AC and DC coefficients
- * for one intra block. Two versions of the function (DCVLC and ACVLC) are
- * provided in order to support the two different methods of processing DC
- * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, Intra DC
- * Coefficient Decoding for the Case of Switched VLC Encoding.
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the
- * bitstream buffer
- * pBitOffset - pointer to the bit position in the current byte referenced
- * by *ppBitStream. The parameter *pBitOffset is valid in the
- * range [0-7]. Bit Position in one byte: |Most Least| *pBitOffset
- * |0 1 2 3 4 5 6 7|
- * predDir - AC prediction direction; used to select the zigzag scan
- * pattern; takes one of the following values: OMX_VC_NONE - AC
- * prediction not used; performs classical zigzag scan.
- * OMX_VC_HORIZONTAL - Horizontal prediction; performs
- * alternate-vertical zigzag scan; OMX_VC_VERTICAL - Vertical
- * prediction; performs alternate-horizontal zigzag scan.
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- * videoComp - video component type (luminance or chrominance) of the
- * current block
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded such
- * that it points to the current byte in the bit stream buffer
- * pBitOffset - *pBitOffset is updated such that it points to the current
- * bit position in the byte pointed by *ppBitStream
- * pDst - pointer to the coefficient buffer of current block; must be
- * 4-byte aligned.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments At least one of the following
- * pointers is NULL: ppBitStream, *ppBitStream, pBitOffset, pDst,
- * or At least one of the following conditions is true:
- * *pBitOffset exceeds [0,7], preDir exceeds [0,2], or pDst is
- * not 4-byte aligned
- * OMX_Sts_Err In DecodeVLCZigzag_IntraDCVLC, dc_size > 12 At least one of
- * mark bits equals zero Illegal stream encountered; code cannot
- * be located in VLC table Forbidden code encountered in the VLC
- * FLC table The number of coefficients is greater than 64
- *
- */
-OMXResult omxVCM4P2_DecodeVLCZigzag_IntraACVLC (
- const OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- OMX_S16 *pDst,
- OMX_U8 predDir,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_DecodeVLCZigzag_Inter (6.2.5.2.3)
- *
- * Description:
- * Performs VLC decoding and inverse zigzag scan for one inter-coded block.
- *
- * Input Arguments:
- *
- * ppBitStream - double pointer to the current byte in the stream buffer
- * pBitOffset - pointer to the next available bit in the current stream
- * byte referenced by *ppBitStream. The parameter *pBitOffset is
- * valid within the range [0-7].
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded such
- * that it points to the current byte in the stream buffer
- * pBitOffset - *pBitOffset is updated after decoding such that it points
- * to the next available bit in the stream byte referenced by
- * *ppBitStream
- * pDst - pointer to the coefficient buffer of current block; must be
- * 4-byte aligned.
- *
- * Return Value:
- *
- * OMX_Sts_BadArgErr - bad arguments:
- * - At least one of the following pointers is NULL:
- * ppBitStream, *ppBitStream, pBitOffset, pDst
- * - pDst is not 4-byte aligned
- * - *pBitOffset exceeds [0,7]
- * OMX_Sts_Err - status error, if:
- * - At least one mark bit is equal to zero
- * - Encountered an illegal stream code that cannot be found in the VLC table
- * - Encountered an illegal code in the VLC FLC table
- * - The number of coefficients is greater than 64
- *
- */
-OMXResult omxVCM4P2_DecodeVLCZigzag_Inter (
- const OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- OMX_S16 *pDst,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_QuantInvIntra_I (6.2.5.3.2)
- *
- * Description:
- * Performs the second inverse quantization mode on an intra/inter coded
- * block. Supports bits_per_pixel = 8. The output coefficients are clipped to
- * the range [-2048, 2047].
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input (quantized) intra/inter block; must be
- * aligned on a 16-byte boundary.
- * QP - quantization parameter (quantizer_scale)
- * videoComp - video component type of the current block. Takes one of the
- * following flags: OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE (intra
- * version only).
- * shortVideoHeader - binary flag indicating presence of short_video_header
- * (intra version only).
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to the output (dequantized) intra/inter block
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; one or more of the following is
- * true:
- * - pSrcDst is NULL
- * - QP <= 0 or QP >=31
- * - videoComp is neither OMX_VC_LUMINANCE nor OMX_VC_CHROMINANCE.
- *
- */
-OMXResult omxVCM4P2_QuantInvIntra_I (
- OMX_S16 *pSrcDst,
- OMX_INT QP,
- OMXVCM4P2VideoComponent videoComp,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_QuantInvInter_I (6.2.5.3.2)
- *
- * Description:
- * Performs the second inverse quantization mode on an intra/inter coded
- * block. Supports bits_per_pixel = 8. The output coefficients are clipped to
- * the range [-2048, 2047].
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input (quantized) intra/inter block; must be
- * aligned on a 16-byte boundary.
- * QP - quantization parameter (quantizer_scale)
- * videoComp - video component type of the current block. Takes one of the
- * following flags: OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE (intra
- * version only).
- * shortVideoHeader - binary flag indicating presence of short_video_header
- * (intra version only).
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to the output (dequantized) intra/inter block
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; one or more of the following is
- * true:
- * - pSrcDst is NULL
- * - QP <= 0 or QP >=31
- * - videoComp is neither OMX_VC_LUMINANCE nor OMX_VC_CHROMINANCE.
- *
- */
-OMXResult omxVCM4P2_QuantInvInter_I (
- OMX_S16 *pSrcDst,
- OMX_INT QP
-);
-
-
-
-/**
- * Function: omxVCM4P2_DecodeBlockCoef_Intra (6.2.5.4.1)
- *
- * Description:
- * Decodes the INTRA block coefficients. Inverse quantization, inversely
- * zigzag positioning, and IDCT, with appropriate clipping on each step, are
- * performed on the coefficients. The results are then placed in the output
- * frame/plane on a pixel basis. Note: This function will be used only when
- * at least one non-zero AC coefficient of current block exists in the bit
- * stream. The DC only condition will be handled in another function.
- *
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the bit
- * stream buffer. There is no boundary check for the bit stream
- * buffer.
- * pBitOffset - pointer to the bit position in the byte pointed to by
- * *ppBitStream. *pBitOffset is valid within [0-7].
- * step - width of the destination plane
- * pCoefBufRow - pointer to the coefficient row buffer; must be aligned on
- * an 8-byte boundary.
- * pCoefBufCol - pointer to the coefficient column buffer; must be aligned
- * on an 8-byte boundary.
- * curQP - quantization parameter of the macroblock which the current block
- * belongs to
- * pQPBuf - pointer to the quantization parameter buffer
- * blockIndex - block index indicating the component type and position as
- * defined in [ISO14496-2], subclause 6.1.3.8, Figure 6-5.
- * intraDCVLC - a code determined by intra_dc_vlc_thr and QP. This allows a
- * mechanism to switch between two VLC for coding of Intra DC
- * coefficients as per [ISO14496-2], Table 6-21.
- * ACPredFlag - a flag equal to ac_pred_flag (of luminance) indicating if
- * the ac coefficients of the first row or first column are
- * differentially coded for intra coded macroblock.
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; shortVideoHeader==1 selects linear intra DC
- * mode, and shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded, so
- * that it points to the current byte in the bit stream buffer
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream
- * pDst - pointer to the block in the destination plane; must be aligned on
- * an 8-byte boundary.
- * pCoefBufRow - pointer to the updated coefficient row buffer.
- * pCoefBufCol - pointer to the updated coefficient column buffer Note:
- * The coefficient buffers must be updated in accordance with the
- * update procedure defined in section 6.2.2.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments, if:
- * - At least one of the following pointers is NULL:
- * ppBitStream, *ppBitStream, pBitOffset, pCoefBufRow, pCoefBufCol,
- * pQPBuf, pDst.
- * - *pBitOffset exceeds [0,7]
- * - curQP exceeds (1, 31)
- * - blockIndex exceeds [0,5]
- * - step is not the multiple of 8
- * - a pointer alignment requirement was violated.
- * OMX_Sts_Err - status error. Refer to OMX_Sts_Err of DecodeVLCZigzag_Intra.
- *
- */
-OMXResult omxVCM4P2_DecodeBlockCoef_Intra (
- const OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- OMX_U8 *pDst,
- OMX_INT step,
- OMX_S16 *pCoefBufRow,
- OMX_S16 *pCoefBufCol,
- OMX_U8 curQP,
- const OMX_U8 *pQPBuf,
- OMX_INT blockIndex,
- OMX_INT intraDCVLC,
- OMX_INT ACPredFlag,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_DecodeBlockCoef_Inter (6.2.5.4.2)
- *
- * Description:
- * Decodes the INTER block coefficients. This function performs inverse
- * quantization, inverse zigzag positioning, and IDCT (with appropriate
- * clipping on each step) on the coefficients. The results (residuals) are
- * placed in a contiguous array of 64 elements. For INTER block, the output
- * buffer holds the residuals for further reconstruction.
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the bit
- * stream buffer. There is no boundary check for the bit stream
- * buffer.
- * pBitOffset - pointer to the bit position in the byte pointed to by
- * *ppBitStream. *pBitOffset is valid within [0-7]
- * QP - quantization parameter
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; shortVideoHeader==1 selects linear intra DC
- * mode, and shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded, so
- * that it points to the current byte in the bit stream buffer
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream
- * pDst - pointer to the decoded residual buffer (a contiguous array of 64
- * elements of OMX_S16 data type); must be aligned on a 16-byte
- * boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments, if:
- * - At least one of the following pointers is Null:
- * ppBitStream, *ppBitStream, pBitOffset , pDst
- * - *pBitOffset exceeds [0,7]
- * - QP <= 0.
- * - pDst is not 16-byte aligned
- * OMX_Sts_Err - status error. Refer to OMX_Sts_Err of DecodeVLCZigzag_Inter .
- *
- */
-OMXResult omxVCM4P2_DecodeBlockCoef_Inter (
- const OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- OMX_S16 *pDst,
- OMX_INT QP,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_PredictReconCoefIntra (6.2.5.4.3)
- *
- * Description:
- * Performs adaptive DC/AC coefficient prediction for an intra block. Prior
- * to the function call, prediction direction (predDir) should be selected as
- * specified in [ISO14496-2], subclause 7.4.3.1.
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the coefficient buffer which contains the quantized
- * coefficient residuals (PQF) of the current block; must be
- * aligned on a 4-byte boundary. The output coefficients are
- * saturated to the range [-2048, 2047].
- * pPredBufRow - pointer to the coefficient row buffer; must be aligned on
- * a 4-byte boundary.
- * pPredBufCol - pointer to the coefficient column buffer; must be aligned
- * on a 4-byte boundary.
- * curQP - quantization parameter of the current block. curQP may equal to
- * predQP especially when the current block and the predictor block
- * are in the same macroblock.
- * predQP - quantization parameter of the predictor block
- * predDir - indicates the prediction direction which takes one of the
- * following values: OMX_VC_HORIZONTAL - predict horizontally
- * OMX_VC_VERTICAL - predict vertically
- * ACPredFlag - a flag indicating if AC prediction should be performed. It
- * is equal to ac_pred_flag in the bit stream syntax of MPEG-4
- * videoComp - video component type (luminance or chrominance) of the
- * current block
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to the coefficient buffer which contains the quantized
- * coefficients (QF) of the current block
- * pPredBufRow - pointer to the updated coefficient row buffer
- * pPredBufCol - pointer to the updated coefficient column buffer Note:
- * Buffer update: Update the AC prediction buffer (both row and
- * column buffer).
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments, if:
- * - At least one of the pointers is NULL:
- * pSrcDst, pPredBufRow, or pPredBufCol.
- * - curQP <= 0,
- * - predQP <= 0,
- * - curQP >31,
- * - predQP > 31,
- * - preDir exceeds [1,2]
- * - pSrcDst, pPredBufRow, or pPredBufCol is not 4-byte aligned.
- *
- */
-OMXResult omxVCM4P2_PredictReconCoefIntra (
- OMX_S16 *pSrcDst,
- OMX_S16 *pPredBufRow,
- OMX_S16 *pPredBufCol,
- OMX_INT curQP,
- OMX_INT predQP,
- OMX_INT predDir,
- OMX_INT ACPredFlag,
- OMXVCM4P2VideoComponent videoComp
-);
-
-
-
-/**
- * Function: omxVCM4P2_MCReconBlock (6.2.5.5.1)
- *
- * Description:
- * Performs motion compensation prediction for an 8x8 block using
- * interpolation described in [ISO14496-2], subclause 7.6.2.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the block in the reference plane.
- * srcStep - distance between the start of consecutive lines in the
- * reference plane, in bytes; must be a multiple of 8.
- * dstStep - distance between the start of consecutive lines in the
- * destination plane, in bytes; must be a multiple of 8.
- * pSrcResidue - pointer to a buffer containing the 16-bit prediction
- * residuals; must be 16-byte aligned. If the pointer is NULL, then
- * no prediction is done, only motion compensation, i.e., the block
- * is moved with interpolation.
- * predictType - bilinear interpolation type, as defined in section
- * 6.2.1.2.
- * rndVal - rounding control parameter: 0 - disabled; 1 - enabled.
- *
- * Output Arguments:
- *
- * pDst - pointer to the destination buffer; must be 8-byte aligned. If
- * prediction residuals are added then output intensities are
- * clipped to the range [0,255].
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - pDst is not 8-byte aligned.
- * - pSrcResidue is not 16-byte aligned.
- * - one or more of the following pointers is NULL: pSrc or pDst.
- * - either srcStep or dstStep is not a multiple of 8.
- * - invalid type specified for the parameter predictType.
- * - the parameter rndVal is not equal either to 0 or 1.
- *
- */
-OMXResult omxVCM4P2_MCReconBlock (
- const OMX_U8 *pSrc,
- OMX_INT srcStep,
- const OMX_S16 *pSrcResidue,
- OMX_U8 *pDst,
- OMX_INT dstStep,
- OMX_INT predictType,
- OMX_INT rndVal
-);
-
-
-
-/* 6.3.1.1 Intra 16x16 Prediction Modes */
-/* A data type that enumerates intra_16x16 macroblock prediction modes is defined as follows: */
-
-typedef enum {
- OMX_VC_16X16_VERT = 0, /** Intra_16x16_Vertical */
- OMX_VC_16X16_HOR = 1, /** Intra_16x16_Horizontal */
- OMX_VC_16X16_DC = 2, /** Intra_16x16_DC */
- OMX_VC_16X16_PLANE = 3 /** Intra_16x16_Plane */
-} OMXVCM4P10Intra16x16PredMode;
-
-
-
-/* 6.3.1.2 Intra 4x4 Prediction Modes */
-/* A data type that enumerates intra_4x4 macroblock prediction modes is defined as follows: */
-
-typedef enum {
- OMX_VC_4X4_VERT = 0, /** Intra_4x4_Vertical */
- OMX_VC_4X4_HOR = 1, /** Intra_4x4_Horizontal */
- OMX_VC_4X4_DC = 2, /** Intra_4x4_DC */
- OMX_VC_4X4_DIAG_DL = 3, /** Intra_4x4_Diagonal_Down_Left */
- OMX_VC_4X4_DIAG_DR = 4, /** Intra_4x4_Diagonal_Down_Right */
- OMX_VC_4X4_VR = 5, /** Intra_4x4_Vertical_Right */
- OMX_VC_4X4_HD = 6, /** Intra_4x4_Horizontal_Down */
- OMX_VC_4X4_VL = 7, /** Intra_4x4_Vertical_Left */
- OMX_VC_4X4_HU = 8 /** Intra_4x4_Horizontal_Up */
-} OMXVCM4P10Intra4x4PredMode;
-
-
-
-/* 6.3.1.3 Chroma Prediction Modes */
-/* A data type that enumerates intra chroma prediction modes is defined as follows: */
-
-typedef enum {
- OMX_VC_CHROMA_DC = 0, /** Intra_Chroma_DC */
- OMX_VC_CHROMA_HOR = 1, /** Intra_Chroma_Horizontal */
- OMX_VC_CHROMA_VERT = 2, /** Intra_Chroma_Vertical */
- OMX_VC_CHROMA_PLANE = 3 /** Intra_Chroma_Plane */
-} OMXVCM4P10IntraChromaPredMode;
-
-
-
-/* 6.3.1.4 Motion Estimation Modes */
-/* A data type that enumerates H.264 motion estimation modes is defined as follows: */
-
-typedef enum {
- OMX_VC_M4P10_FAST_SEARCH = 0, /** Fast motion search */
- OMX_VC_M4P10_FULL_SEARCH = 1 /** Full motion search */
-} OMXVCM4P10MEMode;
-
-
-
-/* 6.3.1.5 Macroblock Types */
-/* A data type that enumerates H.264 macroblock types is defined as follows: */
-
-typedef enum {
- OMX_VC_P_16x16 = 0, /* defined by [ISO14496-10] */
- OMX_VC_P_16x8 = 1,
- OMX_VC_P_8x16 = 2,
- OMX_VC_P_8x8 = 3,
- OMX_VC_PREF0_8x8 = 4,
- OMX_VC_INTER_SKIP = 5,
- OMX_VC_INTRA_4x4 = 8,
- OMX_VC_INTRA_16x16 = 9,
- OMX_VC_INTRA_PCM = 10
-} OMXVCM4P10MacroblockType;
-
-
-
-/* 6.3.1.6 Sub-Macroblock Types */
-/* A data type that enumerates H.264 sub-macroblock types is defined as follows: */
-
-typedef enum {
- OMX_VC_SUB_P_8x8 = 0, /* defined by [ISO14496-10] */
- OMX_VC_SUB_P_8x4 = 1,
- OMX_VC_SUB_P_4x8 = 2,
- OMX_VC_SUB_P_4x4 = 3
-} OMXVCM4P10SubMacroblockType;
-
-
-
-/* 6.3.1.7 Variable Length Coding (VLC) Information */
-
-typedef struct {
- OMX_U8 uTrailing_Ones; /* Trailing ones; 3 at most */
- OMX_U8 uTrailing_One_Signs; /* Trailing ones signal */
- OMX_U8 uNumCoeffs; /* Total number of non-zero coefs, including trailing ones */
- OMX_U8 uTotalZeros; /* Total number of zero coefs */
- OMX_S16 iLevels[16]; /* Levels of non-zero coefs, in reverse zig-zag order */
- OMX_U8 uRuns[16]; /* Runs for levels and trailing ones, in reverse zig-zag order */
-} OMXVCM4P10VLCInfo;
-
-
-
-/* 6.3.1.8 Macroblock Information */
-
-typedef struct {
- OMX_S32 sliceId; /* slice number */
- OMXVCM4P10MacroblockType mbType; /* MB type */
- OMXVCM4P10SubMacroblockType subMBType[4]; /* sub-block type */
- OMX_S32 qpy; /* qp for luma */
- OMX_S32 qpc; /* qp for chroma */
- OMX_U32 cbpy; /* CBP Luma */
- OMX_U32 cbpc; /* CBP Chroma */
- OMXVCMotionVector pMV0[4][4]; /* motion vector, represented using 1/4-pel units, pMV0[blocky][blockx] (blocky = 0~3, blockx =0~3) */
- OMXVCMotionVector pMVPred[4][4]; /* motion vector prediction, Represented using 1/4-pel units, pMVPred[blocky][blockx] (blocky = 0~3, blockx = 0~3) */
- OMX_U8 pRefL0Idx[4]; /* reference picture indices */
- OMXVCM4P10Intra16x16PredMode Intra16x16PredMode; /* best intra 16x16 prediction mode */
- OMXVCM4P10Intra4x4PredMode pIntra4x4PredMode[16]; /* best intra 4x4 prediction mode for each block, pMV0 indexed as above */
-} OMXVCM4P10MBInfo, *OMXVCM4P10MBInfoPtr;
-
-
-
-/* 6.3.1.9 Motion Estimation Parameters */
-
-typedef struct {
- OMX_S32 blockSplitEnable8x8; /* enables 16x8, 8x16, 8x8 */
- OMX_S32 blockSplitEnable4x4; /* enable splitting of 8x4, 4x8, 4x4 blocks */
- OMX_S32 halfSearchEnable;
- OMX_S32 quarterSearchEnable;
- OMX_S32 intraEnable4x4; /* 1=enable, 0=disable */
- OMX_S32 searchRange16x16; /* integer pixel units */
- OMX_S32 searchRange8x8;
- OMX_S32 searchRange4x4;
-} OMXVCM4P10MEParams;
-
-
-
-/**
- * Function: omxVCM4P10_PredictIntra_4x4 (6.3.3.1.1)
- *
- * Description:
- * Perform Intra_4x4 prediction for luma samples. If the upper-right block is
- * not available, then duplication work should be handled inside the function.
- * Users need not define them outside.
- *
- * Input Arguments:
- *
- * pSrcLeft - Pointer to the buffer of 4 left pixels:
- * p[x, y] (x = -1, y = 0..3)
- * pSrcAbove - Pointer to the buffer of 8 above pixels:
- * p[x,y] (x = 0..7, y =-1);
- * must be aligned on a 4-byte boundary.
- * pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1)
- * leftStep - Step of left pixel buffer; must be a multiple of 4.
- * dstStep - Step of the destination buffer; must be a multiple of 4.
- * predMode - Intra_4x4 prediction mode.
- * availability - Neighboring 4x4 block availability flag, refer to
- * "Neighboring Macroblock Availability" .
- *
- * Output Arguments:
- *
- * pDst - Pointer to the destination buffer; must be aligned on a 4-byte
- * boundary.
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * pDst is NULL.
- * dstStep < 4, or dstStep is not a multiple of 4.
- * leftStep is not a multiple of 4.
- * predMode is not in the valid range of enumeration
- * OMXVCM4P10Intra4x4PredMode.
- * predMode is OMX_VC_4x4_VERT, but availability doesn't set OMX_VC_UPPER
- * indicating p[x,-1] (x = 0..3) is not available.
- * predMode is OMX_VC_4x4_HOR, but availability doesn't set OMX_VC_LEFT
- * indicating p[-1,y] (y = 0..3) is not available.
- * predMode is OMX_VC_4x4_DIAG_DL, but availability doesn't set
- * OMX_VC_UPPER indicating p[x, -1] (x = 0..3) is not available.
- * predMode is OMX_VC_4x4_DIAG_DR, but availability doesn't set
- * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
- * p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not
- * available.
- * predMode is OMX_VC_4x4_VR, but availability doesn't set
- * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
- * p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not
- * available.
- * predMode is OMX_VC_4x4_HD, but availability doesn't set
- * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
- * p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not
- * available.
- * predMode is OMX_VC_4x4_VL, but availability doesn't set OMX_VC_UPPER
- * indicating p[x,-1] (x = 0..3) is not available.
- * predMode is OMX_VC_4x4_HU, but availability doesn't set OMX_VC_LEFT
- * indicating p[-1,y] (y = 0..3) is not available.
- * availability sets OMX_VC_UPPER, but pSrcAbove is NULL.
- * availability sets OMX_VC_LEFT, but pSrcLeft is NULL.
- * availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL.
- * either pSrcAbove or pDst is not aligned on a 4-byte boundary.
- *
- * Note:
- * pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointers if
- * they are not used by intra prediction as implied in predMode.
- *
- */
-OMXResult omxVCM4P10_PredictIntra_4x4 (
- const OMX_U8 *pSrcLeft,
- const OMX_U8 *pSrcAbove,
- const OMX_U8 *pSrcAboveLeft,
- OMX_U8 *pDst,
- OMX_INT leftStep,
- OMX_INT dstStep,
- OMXVCM4P10Intra4x4PredMode predMode,
- OMX_S32 availability
-);
-
-
-
-/**
- * Function: omxVCM4P10_PredictIntra_16x16 (6.3.3.1.2)
- *
- * Description:
- * Perform Intra_16x16 prediction for luma samples. If the upper-right block
- * is not available, then duplication work should be handled inside the
- * function. Users need not define them outside.
- *
- * Input Arguments:
- *
- * pSrcLeft - Pointer to the buffer of 16 left pixels: p[x, y] (x = -1, y =
- * 0..15)
- * pSrcAbove - Pointer to the buffer of 16 above pixels: p[x,y] (x = 0..15,
- * y= -1); must be aligned on a 16-byte boundary.
- * pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1)
- * leftStep - Step of left pixel buffer; must be a multiple of 16.
- * dstStep - Step of the destination buffer; must be a multiple of 16.
- * predMode - Intra_16x16 prediction mode, please refer to section 3.4.1.
- * availability - Neighboring 16x16 MB availability flag. Refer to
- * section 3.4.4.
- *
- * Output Arguments:
- *
- * pDst -Pointer to the destination buffer; must be aligned on a 16-byte
- * boundary.
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * pDst is NULL.
- * dstStep < 16. or dstStep is not a multiple of 16.
- * leftStep is not a multiple of 16.
- * predMode is not in the valid range of enumeration
- * OMXVCM4P10Intra16x16PredMode
- * predMode is OMX_VC_16X16_VERT, but availability doesn't set
- * OMX_VC_UPPER indicating p[x,-1] (x = 0..15) is not available.
- * predMode is OMX_VC_16X16_HOR, but availability doesn't set OMX_VC_LEFT
- * indicating p[-1,y] (y = 0..15) is not available.
- * predMode is OMX_VC_16X16_PLANE, but availability doesn't set
- * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
- * p[x,-1](x = 0..15), or p[-1,y] (y = 0..15), or p[-1,-1] is not
- * available.
- * availability sets OMX_VC_UPPER, but pSrcAbove is NULL.
- * availability sets OMX_VC_LEFT, but pSrcLeft is NULL.
- * availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL.
- * either pSrcAbove or pDst is not aligned on a 16-byte boundary.
- *
- * Note:
- * pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointers if
- * they are not used by intra prediction implied in predMode.
- * Note:
- * OMX_VC_UPPER_RIGHT is not used in intra_16x16 luma prediction.
- *
- */
-OMXResult omxVCM4P10_PredictIntra_16x16 (
- const OMX_U8 *pSrcLeft,
- const OMX_U8 *pSrcAbove,
- const OMX_U8 *pSrcAboveLeft,
- OMX_U8 *pDst,
- OMX_INT leftStep,
- OMX_INT dstStep,
- OMXVCM4P10Intra16x16PredMode predMode,
- OMX_S32 availability
-);
-
-
-
-/**
- * Function: omxVCM4P10_PredictIntraChroma_8x8 (6.3.3.1.3)
- *
- * Description:
- * Performs intra prediction for chroma samples.
- *
- * Input Arguments:
- *
- * pSrcLeft - Pointer to the buffer of 8 left pixels: p[x, y] (x = -1, y=
- * 0..7).
- * pSrcAbove - Pointer to the buffer of 8 above pixels: p[x,y] (x = 0..7, y
- * = -1); must be aligned on an 8-byte boundary.
- * pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1)
- * leftStep - Step of left pixel buffer; must be a multiple of 8.
- * dstStep - Step of the destination buffer; must be a multiple of 8.
- * predMode - Intra chroma prediction mode, please refer to section 3.4.3.
- * availability - Neighboring chroma block availability flag, please refer
- * to "Neighboring Macroblock Availability".
- *
- * Output Arguments:
- *
- * pDst - Pointer to the destination buffer; must be aligned on an 8-byte
- * boundary.
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If any of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * pDst is NULL.
- * dstStep < 8 or dstStep is not a multiple of 8.
- * leftStep is not a multiple of 8.
- * predMode is not in the valid range of enumeration
- * OMXVCM4P10IntraChromaPredMode.
- * predMode is OMX_VC_CHROMA_VERT, but availability doesn't set
- * OMX_VC_UPPER indicating p[x,-1] (x = 0..7) is not available.
- * predMode is OMX_VC_CHROMA_HOR, but availability doesn't set OMX_VC_LEFT
- * indicating p[-1,y] (y = 0..7) is not available.
- * predMode is OMX_VC_CHROMA_PLANE, but availability doesn't set
- * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
- * p[x,-1](x = 0..7), or p[-1,y] (y = 0..7), or p[-1,-1] is not
- * available.
- * availability sets OMX_VC_UPPER, but pSrcAbove is NULL.
- * availability sets OMX_VC_LEFT, but pSrcLeft is NULL.
- * availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL.
- * either pSrcAbove or pDst is not aligned on a 8-byte boundary.
- *
- * Note: pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointer if
- * they are not used by intra prediction implied in predMode.
- *
- * Note: OMX_VC_UPPER_RIGHT is not used in intra chroma prediction.
- *
- */
-OMXResult omxVCM4P10_PredictIntraChroma_8x8 (
- const OMX_U8 *pSrcLeft,
- const OMX_U8 *pSrcAbove,
- const OMX_U8 *pSrcAboveLeft,
- OMX_U8 *pDst,
- OMX_INT leftStep,
- OMX_INT dstStep,
- OMXVCM4P10IntraChromaPredMode predMode,
- OMX_S32 availability
-);
-
-
-
-/**
- * Function: omxVCM4P10_InterpolateLuma (6.3.3.2.1)
- *
- * Description:
- * Performs quarter-pixel interpolation for inter luma MB. It is assumed that
- * the frame is already padded when calling this function.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the source reference frame buffer
- * srcStep - reference frame step, in bytes; must be a multiple of roi.width
- * dstStep - destination frame step, in bytes; must be a multiple of
- * roi.width
- * dx - Fractional part of horizontal motion vector component in 1/4 pixel
- * unit; valid in the range [0,3]
- * dy - Fractional part of vertical motion vector y component in 1/4 pixel
- * unit; valid in the range [0,3]
- * roi - Dimension of the interpolation region; the parameters roi.width and
- * roi.height must be equal to either 4, 8, or 16.
- *
- * Output Arguments:
- *
- * pDst - Pointer to the destination frame buffer:
- * if roi.width==4, 4-byte alignment required
- * if roi.width==8, 8-byte alignment required
- * if roi.width==16, 16-byte alignment required
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * pSrc or pDst is NULL.
- * srcStep or dstStep < roi.width.
- * dx or dy is out of range [0,3].
- * roi.width or roi.height is out of range {4, 8, 16}.
- * roi.width is equal to 4, but pDst is not 4 byte aligned.
- * roi.width is equal to 8 or 16, but pDst is not 8 byte aligned.
- * srcStep or dstStep is not a multiple of 8.
- *
- */
-OMXResult omxVCM4P10_InterpolateLuma (
- const OMX_U8 *pSrc,
- OMX_S32 srcStep,
- OMX_U8 *pDst,
- OMX_S32 dstStep,
- OMX_S32 dx,
- OMX_S32 dy,
- OMXSize roi
-);
-
-
-
-/**
- * Function: omxVCM4P10_InterpolateChroma (6.3.3.2.2)
- *
- * Description:
- * Performs 1/8-pixel interpolation for inter chroma MB.
- *
- * Input Arguments:
- *
- * pSrc -Pointer to the source reference frame buffer
- * srcStep -Reference frame step in bytes
- * dstStep -Destination frame step in bytes; must be a multiple of
- * roi.width.
- * dx -Fractional part of horizontal motion vector component in 1/8 pixel
- * unit; valid in the range [0,7]
- * dy -Fractional part of vertical motion vector component in 1/8 pixel
- * unit; valid in the range [0,7]
- * roi -Dimension of the interpolation region; the parameters roi.width and
- * roi.height must be equal to either 2, 4, or 8.
- *
- * Output Arguments:
- *
- * pDst -Pointer to the destination frame buffer:
- * if roi.width==2, 2-byte alignment required
- * if roi.width==4, 4-byte alignment required
- * if roi.width==8, 8-byte alignment required
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * pSrc or pDst is NULL.
- * srcStep or dstStep < 8.
- * dx or dy is out of range [0-7].
- * roi.width or roi.height is out of range {2,4,8}.
- * roi.width is equal to 2, but pDst is not 2-byte aligned.
- * roi.width is equal to 4, but pDst is not 4-byte aligned.
- * roi.width is equal to 8, but pDst is not 8 byte aligned.
- * srcStep or dstStep is not a multiple of 8.
- *
- */
-OMXResult omxVCM4P10_InterpolateChroma (
- const OMX_U8 *pSrc,
- OMX_S32 srcStep,
- OMX_U8 *pDst,
- OMX_S32 dstStep,
- OMX_S32 dx,
- OMX_S32 dy,
- OMXSize roi
-);
-
-
-
-/**
- * Function: omxVCM4P10_FilterDeblockingLuma_VerEdge_I (6.3.3.3.1)
- *
- * Description:
- * Performs in-place deblock filtering on four vertical edges of the luma
- * macroblock (16x16).
- *
- * Input Arguments:
- *
- * pSrcDst - Pointer to the input macroblock; must be 16-byte aligned.
- * srcdstStep -Step of the arrays; must be a multiple of 16.
- * pAlpha -Array of size 2 of alpha thresholds (the first item is the alpha
- * threshold for the external vertical edge, and the second item is
- * for the internal vertical edge); per [ISO14496-10] alpha values
- * must be in the range [0,255].
- * pBeta -Array of size 2 of beta thresholds (the first item is the beta
- * threshold for the external vertical edge, and the second item is
- * for the internal vertical edge); per [ISO14496-10] beta values
- * must be in the range [0,18].
- * pThresholds -Array of size 16 of Thresholds (TC0) (values for the left
- * edge of each 4x4 block, arranged in vertical block order); must
- * be aligned on a 4-byte boundary.. Per [ISO14496-10] values must
- * be in the range [0,25].
- * pBS -Array of size 16 of BS parameters (arranged in vertical block
- * order); valid in the range [0,4] with the following
- * restrictions: i) pBS[i]== 4 may occur only for 0<=i<=3, ii)
- * pBS[i]== 4 if and only if pBS[i^3]== 4. Must be 4-byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst -Pointer to filtered output macroblock.
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * Either of the pointers in pSrcDst, pAlpha, pBeta, pThresholds, or pBS
- * is NULL.
- * Either pThresholds or pBS is not aligned on a 4-byte boundary.
- * pSrcDst is not 16-byte aligned.
- * srcdstStep is not a multiple of 16.
- * pAlpha[0] and/or pAlpha[1] is outside the range [0,255].
- * pBeta[0] and/or pBeta[1] is outside the range [0,18].
- * One or more entries in the table pThresholds[0..15]is outside of the
- * range [0,25].
- * pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or (pBS[i]==4 &&
- * pBS[i^3]!=4) for 0<=i<=3.
- *
- */
-OMXResult omxVCM4P10_FilterDeblockingLuma_VerEdge_I (
- OMX_U8 *pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8 *pAlpha,
- const OMX_U8 *pBeta,
- const OMX_U8 *pThresholds,
- const OMX_U8 *pBS
-);
-
-
-
-/**
- * Function: omxVCM4P10_FilterDeblockingLuma_HorEdge_I (6.3.3.3.2)
- *
- * Description:
- * Performs in-place deblock filtering on four horizontal edges of the luma
- * macroblock (16x16).
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input macroblock; must be 16-byte aligned.
- * srcdstStep - step of the arrays; must be a multiple of 16.
- * pAlpha - array of size 2 of alpha thresholds (the first item is the alpha
- * threshold for the external vertical edge, and the second item is
- * for the internal horizontal edge); per [ISO14496-10] alpha
- * values must be in the range [0,255].
- * pBeta - array of size 2 of beta thresholds (the first item is the beta
- * threshold for the external horizontal edge, and the second item
- * is for the internal horizontal edge). Per [ISO14496-10] beta
- * values must be in the range [0,18].
- * pThresholds - array of size 16 containing thresholds, TC0, for the top
- * horizontal edge of each 4x4 block, arranged in horizontal block
- * order; must be aligned on a 4-byte boundary. Per [ISO14496 10]
- * values must be in the range [0,25].
- * pBS - array of size 16 of BS parameters (arranged in horizontal block
- * order); valid in the range [0,4] with the following
- * restrictions: i) pBS[i]== 4 may occur only for 0<=i<=3, ii)
- * pBS[i]== 4 if and only if pBS[i^3]== 4. Must be 4-byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst -Pointer to filtered output macroblock.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr, if the function runs without error.
- *
- * OMX_Sts_BadArgErr, if one of the following cases occurs:
- * - one or more of the following pointers is NULL: pSrcDst, pAlpha,
- * pBeta, pThresholds, or pBS.
- * - either pThresholds or pBS is not aligned on a 4-byte boundary.
- * - pSrcDst is not 16-byte aligned.
- * - srcdstStep is not a multiple of 16.
- * - pAlpha[0] and/or pAlpha[1] is outside the range [0,255].
- * - pBeta[0] and/or pBeta[1] is outside the range [0,18].
- * - One or more entries in the table pThresholds[0..15] is
- * outside of the range [0,25].
- * - pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
- * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
- *
- */
-OMXResult omxVCM4P10_FilterDeblockingLuma_HorEdge_I (
- OMX_U8 *pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8 *pAlpha,
- const OMX_U8 *pBeta,
- const OMX_U8 *pThresholds,
- const OMX_U8 *pBS
-);
-
-
-
-/**
- * Function: omxVCM4P10_FilterDeblockingChroma_VerEdge_I (6.3.3.3.3)
- *
- * Description:
- * Performs in-place deblock filtering on four vertical edges of the chroma
- * macroblock (8x8).
- *
- * Input Arguments:
- *
- * pSrcDst - Pointer to the input macroblock; must be 8-byte aligned.
- * srcdstStep - Step of the arrays; must be a multiple of 8.
- * pAlpha - Array of size 2 of alpha thresholds (the first item is alpha
- * threshold for external vertical edge, and the second item is for
- * internal vertical edge); per [ISO14496-10] alpha values must be
- * in the range [0,255].
- * pBeta - Array of size 2 of beta thresholds (the first item is the beta
- * threshold for the external vertical edge, and the second item is
- * for the internal vertical edge); per [ISO14496-10] beta values
- * must be in the range [0,18].
- * pThresholds - Array of size 8 containing thresholds, TC0, for the left
- * vertical edge of each 4x2 chroma block, arranged in vertical
- * block order; must be aligned on a 4-byte boundary. Per
- * [ISO14496-10] values must be in the range [0,25].
- * pBS - Array of size 16 of BS parameters (values for each 2x2 chroma
- * block, arranged in vertical block order). This parameter is the
- * same as the pBS parameter passed into FilterDeblockLuma_VerEdge;
- * valid in the range [0,4] with the following restrictions: i)
- * pBS[i]== 4 may occur only for 0<=i<=3, ii) pBS[i]== 4 if and
- * only if pBS[i^3]== 4. Must be 4 byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst -Pointer to filtered output macroblock.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr, if the function runs without error.
- *
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - one or more of the following pointers is NULL: pSrcDst, pAlpha,
- * pBeta, pThresholds, or pBS.
- * - pSrcDst is not 8-byte aligned.
- * - srcdstStep is not a multiple of 8.
- * - pThresholds is not 4-byte aligned.
- * - pAlpha[0] and/or pAlpha[1] is outside the range [0,255].
- * - pBeta[0] and/or pBeta[1] is outside the range [0,18].
- * - One or more entries in the table pThresholds[0..7] is outside
- * of the range [0,25].
- * - pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
- * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
- * - pBS is not 4-byte aligned.
- *
- */
-OMXResult omxVCM4P10_FilterDeblockingChroma_VerEdge_I (
- OMX_U8 *pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8 *pAlpha,
- const OMX_U8 *pBeta,
- const OMX_U8 *pThresholds,
- const OMX_U8 *pBS
-);
-
-
-
-/**
- * Function: omxVCM4P10_FilterDeblockingChroma_HorEdge_I (6.3.3.3.4)
- *
- * Description:
- * Performs in-place deblock filtering on the horizontal edges of the chroma
- * macroblock (8x8).
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input macroblock; must be 8-byte aligned.
- * srcdstStep - array step; must be a multiple of 8.
- * pAlpha - array of size 2 containing alpha thresholds; the first element
- * contains the threshold for the external horizontal edge, and the
- * second element contains the threshold for internal horizontal
- * edge. Per [ISO14496-10] alpha values must be in the range
- * [0,255].
- * pBeta - array of size 2 containing beta thresholds; the first element
- * contains the threshold for the external horizontal edge, and the
- * second element contains the threshold for the internal
- * horizontal edge. Per [ISO14496-10] beta values must be in the
- * range [0,18].
- * pThresholds - array of size 8 containing thresholds, TC0, for the top
- * horizontal edge of each 2x4 chroma block, arranged in horizontal
- * block order; must be aligned on a 4-byte boundary. Per
- * [ISO14496-10] values must be in the range [0,25].
- * pBS - array of size 16 containing BS parameters for each 2x2 chroma
- * block, arranged in horizontal block order; valid in the range
- * [0,4] with the following restrictions: i) pBS[i]== 4 may occur
- * only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]== 4.
- * Must be 4-byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst -Pointer to filtered output macroblock.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr, if the function runs without error.
- *
- * OMX_Sts_BadArgErr, if one of the following cases occurs:
- * - any of the following pointers is NULL:
- * pSrcDst, pAlpha, pBeta, pThresholds, or pBS.
- * - pSrcDst is not 8-byte aligned.
- * - srcdstStep is not a multiple of 8.
- * - pThresholds is not 4-byte aligned.
- * - pAlpha[0] and/or pAlpha[1] is outside the range [0,255].
- * - pBeta[0] and/or pBeta[1] is outside the range [0,18].
- * - One or more entries in the table pThresholds[0..7] is outside
- * of the range [0,25].
- * - pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
- * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
- * - pBS is not 4-byte aligned.
- *
- */
-OMXResult omxVCM4P10_FilterDeblockingChroma_HorEdge_I (
- OMX_U8 *pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8 *pAlpha,
- const OMX_U8 *pBeta,
- const OMX_U8 *pThresholds,
- const OMX_U8 *pBS
-);
-
-
-
-/**
- * Function: omxVCM4P10_DeblockLuma_I (6.3.3.3.5)
- *
- * Description:
- * This function performs in-place deblock filtering the horizontal and
- * vertical edges of a luma macroblock (16x16).
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input macroblock; must be 16-byte aligned.
- * srcdstStep - image width; must be a multiple of 16.
- * pAlpha - pointer to a 2x2 table of alpha thresholds, organized as
- * follows: {external vertical edge, internal vertical edge,
- * external horizontal edge, internal horizontal edge }. Per
- * [ISO14496-10] alpha values must be in the range [0,255].
- * pBeta - pointer to a 2x2 table of beta thresholds, organized as follows:
- * {external vertical edge, internal vertical edge, external
- * horizontal edge, internal horizontal edge }. Per [ISO14496-10]
- * beta values must be in the range [0,18].
- * pThresholds - pointer to a 16x2 table of threshold (TC0), organized as
- * follows: {values for the left or above edge of each 4x4 block,
- * arranged in vertical block order and then in horizontal block
- * order}; must be aligned on a 4-byte boundary. Per [ISO14496-10]
- * values must be in the range [0,25].
- * pBS - pointer to a 16x2 table of BS parameters arranged in scan block
- * order for vertical edges and then horizontal edges; valid in the
- * range [0,4] with the following restrictions: i) pBS[i]== 4 may
- * occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]==
- * 4. Must be 4-byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to filtered output macroblock.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - one or more of the following pointers is NULL: pSrcDst, pAlpha,
- * pBeta, pThresholds or pBS.
- * - pSrcDst is not 16-byte aligned.
- * - either pThresholds or pBS is not aligned on a 4-byte boundary.
- * - one or more entries in the table pAlpha[0..3] is outside the range
- * [0,255].
- * - one or more entries in the table pBeta[0..3] is outside the range
- * [0,18].
- * - one or more entries in the table pThresholds[0..31]is outside of
- * the range [0,25].
- * - pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
- * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
- * - srcdstStep is not a multiple of 16.
- *
- */
-OMXResult omxVCM4P10_DeblockLuma_I (
- OMX_U8 *pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8 *pAlpha,
- const OMX_U8 *pBeta,
- const OMX_U8 *pThresholds,
- const OMX_U8 *pBS
-);
-
-
-
-/**
- * Function: omxVCM4P10_DeblockChroma_I (6.3.3.3.6)
- *
- * Description:
- * Performs in-place deblocking filtering on all edges of the chroma
- * macroblock (16x16).
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input macroblock; must be 8-byte aligned.
- * srcdstStep - step of the arrays; must be a multiple of 8.
- * pAlpha - pointer to a 2x2 array of alpha thresholds, organized as
- * follows: {external vertical edge, internal vertical edge,
- * external horizontal edge, internal horizontal edge }. Per
- * [ISO14496-10] alpha values must be in the range [0,255].
- * pBeta - pointer to a 2x2 array of Beta Thresholds, organized as follows:
- * { external vertical edge, internal vertical edge, external
- * horizontal edge, internal horizontal edge }. Per [ISO14496-10]
- * beta values must be in the range [0,18].
- * pThresholds - array of size 8x2 of Thresholds (TC0) (values for the left
- * or above edge of each 4x2 or 2x4 block, arranged in vertical
- * block order and then in horizontal block order); must be aligned
- * on a 4-byte boundary. Per [ISO14496-10] values must be in the
- * range [0,25].
- * pBS - array of size 16x2 of BS parameters (arranged in scan block order
- * for vertical edges and then horizontal edges); valid in the
- * range [0,4] with the following restrictions: i) pBS[i]== 4 may
- * occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]==
- * 4. Must be 4-byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to filtered output macroblock.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - one or more of the following pointers is NULL: pSrcDst, pAlpha,
- * pBeta, pThresholds, or pBS.
- * - pSrcDst is not 8-byte aligned.
- * - either pThresholds or pBS is not 4-byte aligned.
- * - one or more entries in the table pAlpha[0..3] is outside the range
- * [0,255].
- * - one or more entries in the table pBeta[0..3] is outside the range
- * [0,18].
- * - one or more entries in the table pThresholds[0..15]is outside of
- * the range [0,25].
- * - pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
- * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
- * - srcdstStep is not a multiple of 8.
- *
- */
-OMXResult omxVCM4P10_DeblockChroma_I (
- OMX_U8 *pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8 *pAlpha,
- const OMX_U8 *pBeta,
- const OMX_U8 *pThresholds,
- const OMX_U8 *pBS
-);
-
-
-
-/**
- * Function: omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC (6.3.4.1.1)
- *
- * Description:
- * Performs CAVLC decoding and inverse raster scan for a 2x2 block of
- * ChromaDCLevel. The decoded coefficients in the packed position-coefficient
- * buffer are stored in reverse zig-zag order, i.e., the first buffer element
- * contains the last non-zero postion-coefficient pair of the block. Within
- * each position-coefficient pair, the position entry indicates the
- * raster-scan position of the coefficient, while the coefficient entry
- * contains the coefficient value.
- *
- * Input Arguments:
- *
- * ppBitStream - Double pointer to current byte in bit stream buffer
- * pOffset - Pointer to current bit position in the byte pointed to by
- * *ppBitStream; valid in the range [0,7].
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after each block is decoded
- * pOffset - *pOffset is updated after each block is decoded
- * pNumCoeff - Pointer to the number of nonzero coefficients in this block
- * ppPosCoefBuf - Double pointer to destination residual
- * coefficient-position pair buffer. Buffer position
- * (*ppPosCoefBuf) is updated upon return, unless there are only
- * zero coefficients in the currently decoded block. In this case
- * the caller is expected to bypass the transform/dequantization of
- * the empty blocks.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr, if the function runs without error.
- *
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - ppBitStream or pOffset is NULL.
- * - ppPosCoefBuf or pNumCoeff is NULL.
- * OMX_Sts_Err - if one of the following is true:
- * - an illegal code is encountered in the bitstream
- *
- */
-OMXResult omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC (
- const OMX_U8 **ppBitStream,
- OMX_S32*pOffset,
- OMX_U8 *pNumCoeff,
- OMX_U8 **ppPosCoefbuf
-);
-
-
-
-/**
- * Function: omxVCM4P10_DecodeCoeffsToPairCAVLC (6.3.4.1.2)
- *
- * Description:
- * Performs CAVLC decoding and inverse zigzag scan for 4x4 block of
- * Intra16x16DCLevel, Intra16x16ACLevel, LumaLevel, and ChromaACLevel. Inverse
- * field scan is not supported. The decoded coefficients in the packed
- * position-coefficient buffer are stored in reverse zig-zag order, i.e., the
- * first buffer element contains the last non-zero postion-coefficient pair of
- * the block. Within each position-coefficient pair, the position entry
- * indicates the raster-scan position of the coefficient, while the
- * coefficient entry contains the coefficient value.
- *
- * Input Arguments:
- *
- * ppBitStream -Double pointer to current byte in bit stream buffer
- * pOffset - Pointer to current bit position in the byte pointed to by
- * *ppBitStream; valid in the range [0,7].
- * sMaxNumCoeff - Maximum the number of non-zero coefficients in current
- * block
- * sVLCSelect - VLC table selector, obtained from the number of non-zero
- * coefficients contained in the above and left 4x4 blocks. It is
- * equivalent to the variable nC described in H.264 standard table
- * 9 5, except its value can t be less than zero.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after each block is decoded.
- * Buffer position (*ppPosCoefBuf) is updated upon return, unless
- * there are only zero coefficients in the currently decoded block.
- * In this case the caller is expected to bypass the
- * transform/dequantization of the empty blocks.
- * pOffset - *pOffset is updated after each block is decoded
- * pNumCoeff - Pointer to the number of nonzero coefficients in this block
- * ppPosCoefBuf - Double pointer to destination residual
- * coefficient-position pair buffer
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- *
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - ppBitStream or pOffset is NULL.
- * - ppPosCoefBuf or pNumCoeff is NULL.
- * - sMaxNumCoeff is not equal to either 15 or 16.
- * - sVLCSelect is less than 0.
- *
- * OMX_Sts_Err - if one of the following is true:
- * - an illegal code is encountered in the bitstream
- *
- */
-OMXResult omxVCM4P10_DecodeCoeffsToPairCAVLC (
- const OMX_U8 **ppBitStream,
- OMX_S32 *pOffset,
- OMX_U8 *pNumCoeff,
- OMX_U8 **ppPosCoefbuf,
- OMX_INT sVLCSelect,
- OMX_INT sMaxNumCoeff
-);
-
-
-
-/**
- * Function: omxVCM4P10_TransformDequantLumaDCFromPair (6.3.4.2.1)
- *
- * Description:
- * Reconstructs the 4x4 LumaDC block from the coefficient-position pair
- * buffer, performs integer inverse, and dequantization for 4x4 LumaDC
- * coefficients, and updates the pair buffer pointer to the next non-empty
- * block.
- *
- * Input Arguments:
- *
- * ppSrc - Double pointer to residual coefficient-position pair buffer
- * output by CALVC decoding
- * QP - Quantization parameter QpY
- *
- * Output Arguments:
- *
- * ppSrc - *ppSrc is updated to the start of next non empty block
- * pDst - Pointer to the reconstructed 4x4 LumaDC coefficients buffer; must
- * be aligned on a 8-byte boundary.
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - ppSrc or pDst is NULL.
- * - pDst is not 8 byte aligned.
- * - QP is not in the range of [0-51].
- *
- */
-OMXResult omxVCM4P10_TransformDequantLumaDCFromPair (
- const OMX_U8 **ppSrc,
- OMX_S16 *pDst,
- OMX_INT QP
-);
-
-
-
-/**
- * Function: omxVCM4P10_TransformDequantChromaDCFromPair (6.3.4.2.2)
- *
- * Description:
- * Reconstruct the 2x2 ChromaDC block from coefficient-position pair buffer,
- * perform integer inverse transformation, and dequantization for 2x2 chroma
- * DC coefficients, and update the pair buffer pointer to next non-empty
- * block.
- *
- * Input Arguments:
- *
- * ppSrc - Double pointer to residual coefficient-position pair buffer
- * output by CALVC decoding
- * QP - Quantization parameter QpC
- *
- * Output Arguments:
- *
- * ppSrc - *ppSrc is updated to the start of next non empty block
- * pDst - Pointer to the reconstructed 2x2 ChromaDC coefficients buffer;
- * must be aligned on a 4-byte boundary.
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - ppSrc or pDst is NULL.
- * - pDst is not 4-byte aligned.
- * - QP is not in the range of [0-51].
- *
- */
-OMXResult omxVCM4P10_TransformDequantChromaDCFromPair (
- const OMX_U8 **ppSrc,
- OMX_S16 *pDst,
- OMX_INT QP
-);
-
-
-
-/**
- * Function: omxVCM4P10_DequantTransformResidualFromPairAndAdd (6.3.4.2.3)
- *
- * Description:
- * Reconstruct the 4x4 residual block from coefficient-position pair buffer,
- * perform dequantization and integer inverse transformation for 4x4 block of
- * residuals with previous intra prediction or motion compensation data, and
- * update the pair buffer pointer to next non-empty block. If pDC == NULL,
- * there re 16 non-zero AC coefficients at most in the packed buffer starting
- * from 4x4 block position 0; If pDC != NULL, there re 15 non-zero AC
- * coefficients at most in the packet buffer starting from 4x4 block position
- * 1.
- *
- * Input Arguments:
- *
- * ppSrc - Double pointer to residual coefficient-position pair buffer
- * output by CALVC decoding
- * pPred - Pointer to the predicted 4x4 block; must be aligned on a 4-byte
- * boundary
- * predStep - Predicted frame step size in bytes; must be a multiple of 4
- * dstStep - Destination frame step in bytes; must be a multiple of 4
- * pDC - Pointer to the DC coefficient of this block, NULL if it doesn't
- * exist
- * QP - QP Quantization parameter. It should be QpC in chroma 4x4 block
- * decoding, otherwise it should be QpY.
- * AC - Flag indicating if at least one non-zero AC coefficient exists
- *
- * Output Arguments:
- *
- * pDst - pointer to the reconstructed 4x4 block data; must be aligned on a
- * 4-byte boundary
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - pPred or pDst is NULL.
- * - pPred or pDst is not 4-byte aligned.
- * - predStep or dstStep is not a multiple of 4.
- * - AC !=0 and Qp is not in the range of [0-51] or ppSrc == NULL.
- * - AC ==0 && pDC ==NULL.
- *
- */
-OMXResult omxVCM4P10_DequantTransformResidualFromPairAndAdd (
- const OMX_U8 **ppSrc,
- const OMX_U8 *pPred,
- const OMX_S16 *pDC,
- OMX_U8 *pDst,
- OMX_INT predStep,
- OMX_INT dstStep,
- OMX_INT QP,
- OMX_INT AC
-);
-
-
-
-/**
- * Function: omxVCM4P10_MEGetBufSize (6.3.5.1.1)
- *
- * Description:
- * Computes the size, in bytes, of the vendor-specific specification
- * structure for the omxVCM4P10 motion estimation functions BlockMatch_Integer
- * and MotionEstimationMB.
- *
- * Input Arguments:
- *
- * MEmode - motion estimation mode; available modes are defined by the
- * enumerated type OMXVCM4P10MEMode
- * pMEParams -motion estimation parameters
- *
- * Output Arguments:
- *
- * pSize - pointer to the number of bytes required for the motion
- * estimation specification structure
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - pMEParams or pSize is NULL.
- * - an invalid MEMode is specified.
- *
- */
-OMXResult omxVCM4P10_MEGetBufSize (
- OMXVCM4P10MEMode MEmode,
- const OMXVCM4P10MEParams *pMEParams,
- OMX_U32 *pSize
-);
-
-
-
-/**
- * Function: omxVCM4P10_MEInit (6.3.5.1.2)
- *
- * Description:
- * Initializes the vendor-specific specification structure required for the
- * omxVCM4P10 motion estimation functions: BlockMatch_Integer and
- * MotionEstimationMB. Memory for the specification structure *pMESpec must be
- * allocated prior to calling the function, and should be aligned on a 4-byte
- * boundary. The number of bytes required for the specification structure can
- * be determined using the function omxVCM4P10_MEGetBufSize. Following
- * initialization by this function, the vendor-specific structure *pMESpec
- * should contain an implementation-specific representation of all motion
- * estimation parameters received via the structure pMEParams, for example
- * searchRange16x16, searchRange8x8, etc.
- *
- * Input Arguments:
- *
- * MEmode - motion estimation mode; available modes are defined by the
- * enumerated type OMXVCM4P10MEMode
- * pMEParams - motion estimation parameters
- * pMESpec - pointer to the uninitialized ME specification structure
- *
- * Output Arguments:
- *
- * pMESpec - pointer to the initialized ME specification structure
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - pMEParams or pSize is NULL.
- * - an invalid value was specified for the parameter MEmode
- * - a negative or zero value was specified for one of the search ranges
- * (e.g., pMBParams >searchRange8x8, pMEParams->searchRange16x16, etc.)
- * - either in isolation or in combination, one or more of the enables or
- * search ranges in the structure *pMEParams were configured such
- * that the requested behavior fails to comply with [ISO14496-10].
- *
- */
-OMXResult omxVCM4P10_MEInit (
- OMXVCM4P10MEMode MEmode,
- const OMXVCM4P10MEParams *pMEParams,
- void *pMESpec
-);
-
-
-
-/**
- * Function: omxVCM4P10_BlockMatch_Integer (6.3.5.2.1)
- *
- * Description:
- * Performs integer block match. Returns best MV and associated cost.
- *
- * Input Arguments:
- *
- * pSrcOrgY - Pointer to the top-left corner of the current block:
- * If iBlockWidth==4, 4-byte alignment required.
- * If iBlockWidth==8, 8-byte alignment required.
- * If iBlockWidth==16, 16-byte alignment required.
- * pSrcRefY - Pointer to the top-left corner of the co-located block in the
- * reference picture:
- * If iBlockWidth==4, 4-byte alignment required.
- * If iBlockWidth==8, 8-byte alignment required.
- * If iBlockWidth==16, 16-byte alignment required.
- * nSrcOrgStep - Stride of the original picture plane, expressed in terms
- * of integer pixels; must be a multiple of iBlockWidth.
- * nSrcRefStep - Stride of the reference picture plane, expressed in terms
- * of integer pixels
- * pRefRect - pointer to the valid reference rectangle inside the reference
- * picture plane
- * nCurrPointPos - position of the current block in the current plane
- * iBlockWidth - Width of the current block, expressed in terms of integer
- * pixels; must be equal to either 4, 8, or 16.
- * iBlockHeight - Height of the current block, expressed in terms of
- * integer pixels; must be equal to either 4, 8, or 16.
- * nLamda - Lamda factor; used to compute motion cost
- * pMVPred - Predicted MV; used to compute motion cost, expressed in terms
- * of 1/4-pel units
- * pMVCandidate - Candidate MV; used to initialize the motion search,
- * expressed in terms of integer pixels
- * pMESpec - pointer to the ME specification structure
- *
- * Output Arguments:
- *
- * pDstBestMV - Best MV resulting from integer search, expressed in terms
- * of 1/4-pel units
- * pBestCost - Motion cost associated with the best MV; computed as
- * SAD+Lamda*BitsUsedByMV
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - any of the following pointers are NULL:
- * pSrcOrgY, pSrcRefY, pRefRect, pMVPred, pMVCandidate, or pMESpec.
- * - Either iBlockWidth or iBlockHeight are values other than 4, 8, or 16.
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_BlockMatch_Integer (
- const OMX_U8 *pSrcOrgY,
- OMX_S32 nSrcOrgStep,
- const OMX_U8 *pSrcRefY,
- OMX_S32 nSrcRefStep,
- const OMXRect *pRefRect,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- OMX_U8 iBlockWidth,
- OMX_U8 iBlockHeight,
- OMX_U32 nLamda,
- const OMXVCMotionVector *pMVPred,
- const OMXVCMotionVector *pMVCandidate,
- OMXVCMotionVector *pBestMV,
- OMX_S32 *pBestCost,
- void *pMESpec
-);
-
-
-
-/**
- * Function: omxVCM4P10_BlockMatch_Half (6.3.5.2.2)
- *
- * Description:
- * Performs a half-pel block match using results from a prior integer search.
- * Returns the best MV and associated cost. This function estimates the
- * half-pixel motion vector by interpolating the integer resolution motion
- * vector referenced by the input parameter pSrcDstBestMV, i.e., the initial
- * integer MV is generated externally. The function
- * omxVCM4P10_BlockMatch_Integer may be used for integer motion estimation.
- *
- * Input Arguments:
- *
- * pSrcOrgY - Pointer to the current position in original picture plane:
- * If iBlockWidth==4, 4-byte alignment required.
- * If iBlockWidth==8, 8-byte alignment required.
- * If iBlockWidth==16, 16-byte alignment required.
- * pSrcRefY - Pointer to the top-left corner of the co-located block in the
- * reference picture:
- * If iBlockWidth==4, 4-byte alignment required.
- * If iBlockWidth==8, 8-byte alignment required.
- * If iBlockWidth==16, 16-byte alignment required.
- * nSrcOrgStep - Stride of the original picture plane in terms of full
- * pixels; must be a multiple of iBlockWidth.
- * nSrcRefStep - Stride of the reference picture plane in terms of full
- * pixels
- * iBlockWidth - Width of the current block in terms of full pixels; must
- * be equal to either 4, 8, or 16.
- * iBlockHeight - Height of the current block in terms of full pixels; must
- * be equal to either 4, 8, or 16.
- * nLamda - Lamda factor, used to compute motion cost
- * pMVPred - Predicted MV, represented in terms of 1/4-pel units; used to
- * compute motion cost
- * pSrcDstBestMV - The best MV resulting from a prior integer search,
- * represented in terms of 1/4-pel units
- *
- * Output Arguments:
- *
- * pSrcDstBestMV - Best MV resulting from the half-pel search, expressed in
- * terms of 1/4-pel units
- * pBestCost - Motion cost associated with the best MV; computed as
- * SAD+Lamda*BitsUsedByMV
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - any of the following pointers is NULL: pSrcOrgY, pSrcRefY,
- * pSrcDstBestMV, pMVPred, pBestCost
- * - iBlockWidth or iBlockHeight are equal to values other than 4, 8, or 16.
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_BlockMatch_Half (
- const OMX_U8 *pSrcOrgY,
- OMX_S32 nSrcOrgStep,
- const OMX_U8 *pSrcRefY,
- OMX_S32 nSrcRefStep,
- OMX_U8 iBlockWidth,
- OMX_U8 iBlockHeight,
- OMX_U32 nLamda,
- const OMXVCMotionVector *pMVPred,
- OMXVCMotionVector *pSrcDstBestMV,
- OMX_S32 *pBestCost
-);
-
-
-
-/**
- * Function: omxVCM4P10_BlockMatch_Quarter (6.3.5.2.3)
- *
- * Description:
- * Performs a quarter-pel block match using results from a prior half-pel
- * search. Returns the best MV and associated cost. This function estimates
- * the quarter-pixel motion vector by interpolating the half-pel resolution
- * motion vector referenced by the input parameter pSrcDstBestMV, i.e., the
- * initial half-pel MV is generated externally. The function
- * omxVCM4P10_BlockMatch_Half may be used for half-pel motion estimation.
- *
- * Input Arguments:
- *
- * pSrcOrgY - Pointer to the current position in original picture plane:
- * If iBlockWidth==4, 4-byte alignment required.
- * If iBlockWidth==8, 8-byte alignment required.
- * If iBlockWidth==16, 16-byte alignment required.
- * pSrcRefY - Pointer to the top-left corner of the co-located block in the
- * reference picture:
- * If iBlockWidth==4, 4-byte alignment required.
- * If iBlockWidth==8, 8-byte alignment required.
- * If iBlockWidth==16, 16-byte alignment required.
- * nSrcOrgStep - Stride of the original picture plane in terms of full
- * pixels; must be a multiple of iBlockWidth.
- * nSrcRefStep - Stride of the reference picture plane in terms of full
- * pixels
- * iBlockWidth - Width of the current block in terms of full pixels; must
- * be equal to either 4, 8, or 16.
- * iBlockHeight - Height of the current block in terms of full pixels; must
- * be equal to either 4, 8, or 16.
- * nLamda - Lamda factor, used to compute motion cost
- * pMVPred - Predicted MV, represented in terms of 1/4-pel units; used to
- * compute motion cost
- * pSrcDstBestMV - The best MV resulting from a prior half-pel search,
- * represented in terms of 1/4 pel units
- *
- * Output Arguments:
- *
- * pSrcDstBestMV - Best MV resulting from the quarter-pel search, expressed
- * in terms of 1/4-pel units
- * pBestCost - Motion cost associated with the best MV; computed as
- * SAD+Lamda*BitsUsedByMV
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - One or more of the following pointers is NULL:
- * pSrcOrgY, pSrcRefY, pSrcDstBestMV, pMVPred, pBestCost
- * - iBlockWidth or iBlockHeight are equal to values other than 4, 8, or 16.
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_BlockMatch_Quarter (
- const OMX_U8 *pSrcOrgY,
- OMX_S32 nSrcOrgStep,
- const OMX_U8 *pSrcRefY,
- OMX_S32 nSrcRefStep,
- OMX_U8 iBlockWidth,
- OMX_U8 iBlockHeight,
- OMX_U32 nLamda,
- const OMXVCMotionVector *pMVPred,
- OMXVCMotionVector *pSrcDstBestMV,
- OMX_S32 *pBestCost
-);
-
-
-
-/**
- * Function: omxVCM4P10_MotionEstimationMB (6.3.5.3.1)
- *
- * Description:
- * Performs MB-level motion estimation and selects best motion estimation
- * strategy from the set of modes supported in baseline profile [ISO14496-10].
- *
- * Input Arguments:
- *
- * pSrcCurrBuf - Pointer to the current position in original picture plane;
- * 16-byte alignment required
- * pSrcRefBufList - Pointer to an array with 16 entries. Each entry points
- * to the top-left corner of the co-located MB in a reference
- * picture. The array is filled from low-to-high with valid
- * reference frame pointers; the unused high entries should be set
- * to NULL. Ordering of the reference frames should follow
- * [ISO14496-10] subclause 8.2.4 Decoding Process for Reference
- * Picture Lists. The entries must be 16-byte aligned.
- * pSrcRecBuf - Pointer to the top-left corner of the co-located MB in the
- * reconstructed picture; must be 16-byte aligned.
- * SrcCurrStep - Width of the original picture plane in terms of full
- * pixels; must be a multiple of 16.
- * SrcRefStep - Width of the reference picture plane in terms of full
- * pixels; must be a multiple of 16.
- * SrcRecStep - Width of the reconstructed picture plane in terms of full
- * pixels; must be a multiple of 16.
- * pRefRect - Pointer to the valid reference rectangle; relative to the
- * image origin.
- * pCurrPointPos - Position of the current macroblock in the current plane.
- * Lambda - Lagrange factor for computing the cost function
- * pMESpec - Pointer to the motion estimation specification structure; must
- * have been allocated and initialized prior to calling this
- * function.
- * pMBInter - Array, of dimension four, containing pointers to information
- * associated with four adjacent type INTER MBs (Left, Top,
- * Top-Left, Top-Right). Any pointer in the array may be set equal
- * to NULL if the corresponding MB doesn t exist or is not of type
- * INTER.
- * - pMBInter[0] - Pointer to left MB information
- * - pMBInter[1] - Pointer to top MB information
- * - pMBInter[2] - Pointer to top-left MB information
- * - pMBInter[3] - Pointer to top-right MB information
- * pMBIntra - Array, of dimension four, containing pointers to information
- * associated with four adjacent type INTRA MBs (Left, Top,
- * Top-Left, Top-Right). Any pointer in the array may be set equal
- * to NULL if the corresponding MB doesn t exist or is not of type
- * INTRA.
- * - pMBIntra[0] - Pointer to left MB information
- * - pMBIntra[1] - Pointer to top MB information
- * - pMBIntra[2] - Pointer to top-left MB information
- * - pMBIntra[3] - Pointer to top-right MB information
- * pSrcDstMBCurr - Pointer to information structure for the current MB.
- * The following entries should be set prior to calling the
- * function: sliceID - the number of the slice the to which the
- * current MB belongs.
- *
- * Output Arguments:
- *
- * pDstCost - Pointer to the minimum motion cost for the current MB.
- * pDstBlockSAD - Pointer to the array of SADs for each of the sixteen luma
- * 4x4 blocks in each MB. The block SADs are in scan order for
- * each MB. For implementations that cannot compute the SAD values
- * individually, the maximum possible value (0xffff) is returned
- * for each of the 16 block SAD entries.
- * pSrcDstMBCurr - Pointer to updated information structure for the current
- * MB after MB-level motion estimation has been completed. The
- * following fields are updated by the ME function. The following
- * parameter set quantifies the MB-level ME search results:
- * - MbType
- * - subMBType[4]
- * - pMV0[4][4]
- * - pMVPred[4][4]
- * - pRefL0Idx[4]
- * - Intra16x16PredMode
- * - pIntra4x4PredMode[4][4]
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - One or more of the following pointers is NULL: pSrcCurrBuf,
- * pSrcRefBufList, pSrcRecBuf, pRefRect, pCurrPointPos, pMESpec,
- * pMBInter, pMBIntra,pSrcDstMBCurr, pDstCost, pSrcRefBufList[0]
- * - SrcRefStep, SrcRecStep are not multiples of 16
- * - iBlockWidth or iBlockHeight are values other than 4, 8, or 16.
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_MotionEstimationMB (
- const OMX_U8 *pSrcCurrBuf,
- OMX_S32 SrcCurrStep,
- const OMX_U8 *pSrcRefBufList[15],
- OMX_S32 SrcRefStep,
- const OMX_U8 *pSrcRecBuf,
- OMX_S32 SrcRecStep,
- const OMXRect *pRefRect,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- OMX_U32 Lambda,
- void *pMESpec,
- const OMXVCM4P10MBInfoPtr *pMBInter,
- const OMXVCM4P10MBInfoPtr *pMBIntra,
- OMXVCM4P10MBInfoPtr pSrcDstMBCurr,
- OMX_INT *pDstCost,
- OMX_U16 *pDstBlockSAD
-);
-
-
-
-/**
- * Function: omxVCM4P10_SAD_4x (6.3.5.4.1)
- *
- * Description:
- * This function calculates the SAD for 4x8 and 4x4 blocks.
- *
- * Input Arguments:
- *
- * pSrcOrg -Pointer to the original block; must be aligned on a 4-byte
- * boundary.
- * iStepOrg -Step of the original block buffer; must be a multiple of 4.
- * pSrcRef -Pointer to the reference block
- * iStepRef -Step of the reference block buffer
- * iHeight -Height of the block; must be equal to either 4 or 8.
- *
- * Output Arguments:
- *
- * pDstSAD -Pointer of result SAD
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - One or more of the following pointers is NULL:
- * pSrcOrg, pSrcRef, or pDstSAD
- * - iHeight is not equal to either 4 or 8.
- * - iStepOrg is not a multiple of 4
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_SAD_4x (
- const OMX_U8 *pSrcOrg,
- OMX_U32 iStepOrg,
- const OMX_U8 *pSrcRef,
- OMX_U32 iStepRef,
- OMX_S32 *pDstSAD,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_SADQuar_4x (6.3.5.4.2)
- *
- * Description:
- * This function calculates the SAD between one block (pSrc) and the average
- * of the other two (pSrcRef0 and pSrcRef1) for 4x8 or 4x4 blocks. Rounding
- * is applied according to the convention (a+b+1)>>1.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the original block; must be aligned on a 4-byte
- * boundary.
- * pSrcRef0 - Pointer to reference block 0
- * pSrcRef1 - Pointer to reference block 1
- * iSrcStep - Step of the original block buffer; must be a multiple of 4.
- * iRefStep0 - Step of reference block 0
- * iRefStep1 - Step of reference block 1
- * iHeight - Height of the block; must be equal to either 4 or 8.
- *
- * Output Arguments:
- *
- * pDstSAD - Pointer of result SAD
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - iHeight is not equal to either 4 or 8.
- * - One or more of the following pointers is NULL: pSrc, pSrcRef0,
- * pSrcRef1, pDstSAD.
- * - iSrcStep is not a multiple of 4
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_SADQuar_4x (
- const OMX_U8 *pSrc,
- const OMX_U8 *pSrcRef0,
- const OMX_U8 *pSrcRef1,
- OMX_U32 iSrcStep,
- OMX_U32 iRefStep0,
- OMX_U32 iRefStep1,
- OMX_U32 *pDstSAD,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_SADQuar_8x (6.3.5.4.3)
- *
- * Description:
- * This function calculates the SAD between one block (pSrc) and the average
- * of the other two (pSrcRef0 and pSrcRef1) for 8x16, 8x8, or 8x4 blocks.
- * Rounding is applied according to the convention (a+b+1)>>1.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the original block; must be aligned on an 8-byte
- * boundary.
- * pSrcRef0 - Pointer to reference block 0
- * pSrcRef1 - Pointer to reference block 1
- * iSrcStep - Step of the original block buffer; must be a multiple of 8.
- * iRefStep0 - Step of reference block 0
- * iRefStep1 - Step of reference block 1
- * iHeight - Height of the block; must be equal either 4, 8, or 16.
- *
- * Output Arguments:
- *
- * pDstSAD - Pointer of result SAD
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - iHeight is not equal to either 4, 8, or 16.
- * - One or more of the following pointers is NULL: pSrc, pSrcRef0,
- * pSrcRef1, pDstSAD.
- * - iSrcStep is not a multiple of 8
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_SADQuar_8x (
- const OMX_U8 *pSrc,
- const OMX_U8 *pSrcRef0,
- const OMX_U8 *pSrcRef1,
- OMX_U32 iSrcStep,
- OMX_U32 iRefStep0,
- OMX_U32 iRefStep1,
- OMX_U32 *pDstSAD,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_SADQuar_16x (6.3.5.4.4)
- *
- * Description:
- * This function calculates the SAD between one block (pSrc) and the average
- * of the other two (pSrcRef0 and pSrcRef1) for 16x16 or 16x8 blocks.
- * Rounding is applied according to the convention (a+b+1)>>1.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the original block; must be aligned on a 16-byte
- * boundary.
- * pSrcRef0 - Pointer to reference block 0
- * pSrcRef1 - Pointer to reference block 1
- * iSrcStep - Step of the original block buffer; must be a multiple of 16
- * iRefStep0 - Step of reference block 0
- * iRefStep1 - Step of reference block 1
- * iHeight - Height of the block; must be equal to either 8 or 16
- *
- * Output Arguments:
- *
- * pDstSAD -Pointer of result SAD
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - iHeight is not equal to either 8 or 16.
- * - One or more of the following pointers is NULL: pSrc, pSrcRef0,
- * pSrcRef1, pDstSAD.
- * - iSrcStep is not a multiple of 16
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_SADQuar_16x (
- const OMX_U8 *pSrc,
- const OMX_U8 *pSrcRef0,
- const OMX_U8 *pSrcRef1,
- OMX_U32 iSrcStep,
- OMX_U32 iRefStep0,
- OMX_U32 iRefStep1,
- OMX_U32 *pDstSAD,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_SATD_4x4 (6.3.5.4.5)
- *
- * Description:
- * This function calculates the sum of absolute transform differences (SATD)
- * for a 4x4 block by applying a Hadamard transform to the difference block
- * and then calculating the sum of absolute coefficient values.
- *
- * Input Arguments:
- *
- * pSrcOrg - Pointer to the original block; must be aligned on a 4-byte
- * boundary
- * iStepOrg - Step of the original block buffer; must be a multiple of 4
- * pSrcRef - Pointer to the reference block; must be aligned on a 4-byte
- * boundary
- * iStepRef - Step of the reference block buffer; must be a multiple of 4
- *
- * Output Arguments:
- *
- * pDstSAD - pointer to the resulting SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrcOrg, pSrcRef, or pDstSAD either pSrcOrg
- * - pSrcRef is not aligned on a 4-byte boundary
- * - iStepOrg <= 0 or iStepOrg is not a multiple of 4
- * - iStepRef <= 0 or iStepRef is not a multiple of 4
- *
- */
-OMXResult omxVCM4P10_SATD_4x4 (
- const OMX_U8 *pSrcOrg,
- OMX_U32 iStepOrg,
- const OMX_U8 *pSrcRef,
- OMX_U32 iStepRef,
- OMX_U32 *pDstSAD
-);
-
-
-
-/**
- * Function: omxVCM4P10_InterpolateHalfHor_Luma (6.3.5.5.1)
- *
- * Description:
- * This function performs interpolation for two horizontal 1/2-pel positions
- * (-1/2,0) and (1/2, 0) - around a full-pel position.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the top-left corner of the block used to interpolate in
- * the reconstruction frame plane.
- * iSrcStep - Step of the source buffer.
- * iDstStep - Step of the destination(interpolation) buffer; must be a
- * multiple of iWidth.
- * iWidth - Width of the current block; must be equal to either 4, 8, or 16
- * iHeight - Height of the current block; must be equal to 4, 8, or 16
- *
- * Output Arguments:
- *
- * pDstLeft -Pointer to the interpolation buffer of the left -pel position
- * (-1/2, 0)
- * If iWidth==4, 4-byte alignment required.
- * If iWidth==8, 8-byte alignment required.
- * If iWidth==16, 16-byte alignment required.
- * pDstRight -Pointer to the interpolation buffer of the right -pel
- * position (1/2, 0)
- * If iWidth==4, 4-byte alignment required.
- * If iWidth==8, 8-byte alignment required.
- * If iWidth==16, 16-byte alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrc, pDstLeft, or pDstRight
- * - iWidth or iHeight have values other than 4, 8, or 16
- * - iWidth==4 but pDstLeft and/or pDstRight is/are not aligned on a 4-byte boundary
- * - iWidth==8 but pDstLeft and/or pDstRight is/are not aligned on a 8-byte boundary
- * - iWidth==16 but pDstLeft and/or pDstRight is/are not aligned on a 16-byte boundary
- * - any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_InterpolateHalfHor_Luma (
- const OMX_U8 *pSrc,
- OMX_U32 iSrcStep,
- OMX_U8 *pDstLeft,
- OMX_U8 *pDstRight,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_InterpolateHalfVer_Luma (6.3.5.5.2)
- *
- * Description:
- * This function performs interpolation for two vertical 1/2-pel positions -
- * (0, -1/2) and (0, 1/2) - around a full-pel position.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to top-left corner of block used to interpolate in the
- * reconstructed frame plane
- * iSrcStep - Step of the source buffer.
- * iDstStep - Step of the destination (interpolation) buffer; must be a
- * multiple of iWidth.
- * iWidth - Width of the current block; must be equal to either 4, 8, or 16
- * iHeight - Height of the current block; must be equal to either 4, 8, or 16
- *
- * Output Arguments:
- *
- * pDstUp -Pointer to the interpolation buffer of the -pel position above
- * the current full-pel position (0, -1/2)
- * If iWidth==4, 4-byte alignment required.
- * If iWidth==8, 8-byte alignment required.
- * If iWidth==16, 16-byte alignment required.
- * pDstDown -Pointer to the interpolation buffer of the -pel position below
- * the current full-pel position (0, 1/2)
- * If iWidth==4, 4-byte alignment required.
- * If iWidth==8, 8-byte alignment required.
- * If iWidth==16, 16-byte alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrc, pDstUp, or pDstDown
- * - iWidth or iHeight have values other than 4, 8, or 16
- * - iWidth==4 but pDstUp and/or pDstDown is/are not aligned on a 4-byte boundary
- * - iWidth==8 but pDstUp and/or pDstDown is/are not aligned on a 8-byte boundary
- * - iWidth==16 but pDstUp and/or pDstDown is/are not aligned on a 16-byte boundary
- *
- */
-OMXResult omxVCM4P10_InterpolateHalfVer_Luma (
- const OMX_U8 *pSrc,
- OMX_U32 iSrcStep,
- OMX_U8 *pDstUp,
- OMX_U8 *pDstDown,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_Average_4x (6.3.5.5.3)
- *
- * Description:
- * This function calculates the average of two 4x4, 4x8 blocks. The result
- * is rounded according to (a+b+1)/2.
- *
- * Input Arguments:
- *
- * pPred0 - Pointer to the top-left corner of reference block 0
- * pPred1 - Pointer to the top-left corner of reference block 1
- * iPredStep0 - Step of reference block 0; must be a multiple of 4.
- * iPredStep1 - Step of reference block 1; must be a multiple of 4.
- * iDstStep - Step of the destination buffer; must be a multiple of 4.
- * iHeight - Height of the blocks; must be either 4 or 8.
- *
- * Output Arguments:
- *
- * pDstPred - Pointer to the destination buffer. 4-byte alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pPred0, pPred1, or pDstPred
- * - pDstPred is not aligned on a 4-byte boundary
- * - iPredStep0 <= 0 or iPredStep0 is not a multiple of 4
- * - iPredStep1 <= 0 or iPredStep1 is not a multiple of 4
- * - iDstStep <= 0 or iDstStep is not a multiple of 4
- * - iHeight is not equal to either 4 or 8
- *
- */
-OMXResult omxVCM4P10_Average_4x (
- const OMX_U8 *pPred0,
- const OMX_U8 *pPred1,
- OMX_U32 iPredStep0,
- OMX_U32 iPredStep1,
- OMX_U8 *pDstPred,
- OMX_U32 iDstStep,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_TransformQuant_ChromaDC (6.3.5.6.1)
- *
- * Description:
- * This function performs 2x2 Hadamard transform of chroma DC coefficients
- * and then quantizes the coefficients.
- *
- * Input Arguments:
- *
- * pSrcDst - Pointer to the 2x2 array of chroma DC coefficients. 8-byte
- * alignment required.
- * iQP - Quantization parameter; must be in the range [0,51].
- * bIntra - Indicate whether this is an INTRA block. 1-INTRA, 0-INTER
- *
- * Output Arguments:
- *
- * pSrcDst - Pointer to transformed and quantized coefficients. 8-byte
- * alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrcDst
- * - pSrcDst is not aligned on an 8-byte boundary
- *
- */
-OMXResult omxVCM4P10_TransformQuant_ChromaDC (
- OMX_S16 *pSrcDst,
- OMX_U32 iQP,
- OMX_U8 bIntra
-);
-
-
-
-/**
- * Function: omxVCM4P10_TransformQuant_LumaDC (6.3.5.6.2)
- *
- * Description:
- * This function performs a 4x4 Hadamard transform of luma DC coefficients
- * and then quantizes the coefficients.
- *
- * Input Arguments:
- *
- * pSrcDst - Pointer to the 4x4 array of luma DC coefficients. 16-byte
- * alignment required.
- * iQP - Quantization parameter; must be in the range [0,51].
- *
- * Output Arguments:
- *
- * pSrcDst - Pointer to transformed and quantized coefficients. 16-byte
- * alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL: pSrcDst
- * - pSrcDst is not aligned on an 16-byte boundary
- *
- */
-OMXResult omxVCM4P10_TransformQuant_LumaDC (
- OMX_S16 *pSrcDst,
- OMX_U32 iQP
-);
-
-
-
-/**
- * Function: omxVCM4P10_InvTransformDequant_LumaDC (6.3.5.6.3)
- *
- * Description:
- * This function performs inverse 4x4 Hadamard transform and then dequantizes
- * the coefficients.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the 4x4 array of the 4x4 Hadamard-transformed and
- * quantized coefficients. 16 byte alignment required.
- * iQP - Quantization parameter; must be in the range [0,51].
- *
- * Output Arguments:
- *
- * pDst - Pointer to inverse-transformed and dequantized coefficients.
- * 16-byte alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL: pSrc
- * - pSrc or pDst is not aligned on a 16-byte boundary
- *
- */
-OMXResult omxVCM4P10_InvTransformDequant_LumaDC (
- const OMX_S16 *pSrc,
- OMX_S16 *pDst,
- OMX_U32 iQP
-);
-
-
-
-/**
- * Function: omxVCM4P10_InvTransformDequant_ChromaDC (6.3.5.6.4)
- *
- * Description:
- * This function performs inverse 2x2 Hadamard transform and then dequantizes
- * the coefficients.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the 2x2 array of the 2x2 Hadamard-transformed and
- * quantized coefficients. 8 byte alignment required.
- * iQP - Quantization parameter; must be in the range [0,51].
- *
- * Output Arguments:
- *
- * pDst - Pointer to inverse-transformed and dequantized coefficients.
- * 8-byte alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL: pSrc
- * - pSrc or pDst is not aligned on an 8-byte boundary
- *
- */
-OMXResult omxVCM4P10_InvTransformDequant_ChromaDC (
- const OMX_S16 *pSrc,
- OMX_S16 *pDst,
- OMX_U32 iQP
-);
-
-
-
-/**
- * Function: omxVCM4P10_InvTransformResidualAndAdd (6.3.5.7.1)
- *
- * Description:
- * This function performs inverse an 4x4 integer transformation to produce
- * the difference signal and then adds the difference to the prediction to get
- * the reconstructed signal.
- *
- * Input Arguments:
- *
- * pSrcPred - Pointer to prediction signal. 4-byte alignment required.
- * pDequantCoeff - Pointer to the transformed coefficients. 8-byte
- * alignment required.
- * iSrcPredStep - Step of the prediction buffer; must be a multiple of 4.
- * iDstReconStep - Step of the destination reconstruction buffer; must be a
- * multiple of 4.
- * bAC - Indicate whether there is AC coefficients in the coefficients
- * matrix.
- *
- * Output Arguments:
- *
- * pDstRecon -Pointer to the destination reconstruction buffer. 4-byte
- * alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrcPred, pDequantCoeff, pDstRecon
- * - pSrcPred is not aligned on a 4-byte boundary
- * - iSrcPredStep or iDstReconStep is not a multiple of 4.
- * - pDequantCoeff is not aligned on an 8-byte boundary
- *
- */
-OMXResult omxVCM4P10_InvTransformResidualAndAdd (
- const OMX_U8 *pSrcPred,
- const OMX_S16 *pDequantCoeff,
- OMX_U8 *pDstRecon,
- OMX_U32 iSrcPredStep,
- OMX_U32 iDstReconStep,
- OMX_U8 bAC
-);
-
-
-
-/**
- * Function: omxVCM4P10_SubAndTransformQDQResidual (6.3.5.8.1)
- *
- * Description:
- * This function subtracts the prediction signal from the original signal to
- * produce the difference signal and then performs a 4x4 integer transform and
- * quantization. The quantized transformed coefficients are stored as
- * pDstQuantCoeff. This function can also output dequantized coefficients or
- * unquantized DC coefficients optionally by setting the pointers
- * pDstDeQuantCoeff, pDCCoeff.
- *
- * Input Arguments:
- *
- * pSrcOrg - Pointer to original signal. 4-byte alignment required.
- * pSrcPred - Pointer to prediction signal. 4-byte alignment required.
- * iSrcOrgStep - Step of the original signal buffer; must be a multiple of
- * 4.
- * iSrcPredStep - Step of the prediction signal buffer; must be a multiple
- * of 4.
- * pNumCoeff -Number of non-zero coefficients after quantization. If this
- * parameter is not required, it is set to NULL.
- * nThreshSAD - Zero-block early detection threshold. If this parameter is
- * not required, it is set to 0.
- * iQP - Quantization parameter; must be in the range [0,51].
- * bIntra - Indicates whether this is an INTRA block, either 1-INTRA or
- * 0-INTER
- *
- * Output Arguments:
- *
- * pDstQuantCoeff - Pointer to the quantized transformed coefficients.
- * 8-byte alignment required.
- * pDstDeQuantCoeff - Pointer to the dequantized transformed coefficients
- * if this parameter is not equal to NULL. 8-byte alignment
- * required.
- * pDCCoeff - Pointer to the unquantized DC coefficient if this parameter
- * is not equal to NULL.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrcOrg, pSrcPred, pNumCoeff, pDstQuantCoeff,
- * pDstDeQuantCoeff, pDCCoeff
- * - pSrcOrg is not aligned on a 4-byte boundary
- * - pSrcPred is not aligned on a 4-byte boundary
- * - iSrcOrgStep is not a multiple of 4
- * - iSrcPredStep is not a multiple of 4
- * - pDstQuantCoeff or pDstDeQuantCoeff is not aligned on an 8-byte boundary
- *
- */
-OMXResult omxVCM4P10_SubAndTransformQDQResidual (
- const OMX_U8 *pSrcOrg,
- const OMX_U8 *pSrcPred,
- OMX_U32 iSrcOrgStep,
- OMX_U32 iSrcPredStep,
- OMX_S16 *pDstQuantCoeff,
- OMX_S16 *pDstDeQuantCoeff,
- OMX_S16 *pDCCoeff,
- OMX_S8 *pNumCoeff,
- OMX_U32 nThreshSAD,
- OMX_U32 iQP,
- OMX_U8 bIntra
-);
-
-
-
-/**
- * Function: omxVCM4P10_GetVLCInfo (6.3.5.9.1)
- *
- * Description:
- * This function extracts run-length encoding (RLE) information from the
- * coefficient matrix. The results are returned in an OMXVCM4P10VLCInfo
- * structure.
- *
- * Input Arguments:
- *
- * pSrcCoeff - pointer to the transform coefficient matrix. 8-byte
- * alignment required.
- * pScanMatrix - pointer to the scan order definition matrix. For a luma
- * block the scan matrix should follow [ISO14496-10] section 8.5.4,
- * and should contain the values 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13,
- * 10, 7, 11, 14, 15. For a chroma block, the scan matrix should
- * contain the values 0, 1, 2, 3.
- * bAC - indicates presence of a DC coefficient; 0 = DC coefficient
- * present, 1= DC coefficient absent.
- * MaxNumCoef - specifies the number of coefficients contained in the
- * transform coefficient matrix, pSrcCoeff. The value should be 16
- * for blocks of type LUMADC, LUMAAC, LUMALEVEL, and CHROMAAC. The
- * value should be 4 for blocks of type CHROMADC.
- *
- * Output Arguments:
- *
- * pDstVLCInfo - pointer to structure that stores information for
- * run-length coding.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrcCoeff, pScanMatrix, pDstVLCInfo
- * - pSrcCoeff is not aligned on an 8-byte boundary
- *
- */
-OMXResult omxVCM4P10_GetVLCInfo (
- const OMX_S16 *pSrcCoeff,
- const OMX_U8 *pScanMatrix,
- OMX_U8 bAC,
- OMX_U32 MaxNumCoef,
- OMXVCM4P10VLCInfo*pDstVLCInfo
-);
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /** end of #define _OMXVC_H_ */
-
-/** EOF */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/api/omxVC_s.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/api/omxVC_s.h
deleted file mode 100644
index 89f3040..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/api/omxVC_s.h
+++ /dev/null
@@ -1,129 +0,0 @@
-;/******************************************************************************
-;// Copyright (c) 1999-2005 The Khronos Group Inc. All Rights Reserved
-;//
-;//
-;//
-;//
-;//
-;//
-;//
-;//
-;******************************************************************************/
-
-;/** =============== Structure Definition for Sample Generation ============== */
-;/** transparent status */
-
-;enum {
-OMX_VIDEO_TRANSPARENT EQU 0; /** Wholly transparent */
-OMX_VIDEO_PARTIAL EQU 1; /** Partially transparent */
-OMX_VIDEO_OPAQUE EQU 2; /** Opaque */
-;}
-
-;/** direction */
-;enum {
-OMX_VIDEO_NONE EQU 0;
-OMX_VIDEO_HORIZONTAL EQU 1;
-OMX_VIDEO_VERTICAL EQU 2;
-;}
-
-;/** bilinear interpolation type */
-;enum {
-OMX_VIDEO_INTEGER_PIXEL EQU 0; /** case a */
-OMX_VIDEO_HALF_PIXEL_X EQU 1; /** case b */
-OMX_VIDEO_HALF_PIXEL_Y EQU 2; /** case c */
-OMX_VIDEO_HALF_PIXEL_XY EQU 3; /** case d */
-;}
-
-;enum {
-OMX_UPPER EQU 1; /** set if the above macroblock is available */
-OMX_LEFT EQU 2; /** set if the left macroblock is available */
-OMX_CENTER EQU 4;
-OMX_RIGHT EQU 8;
-OMX_LOWER EQU 16;
-OMX_UPPER_LEFT EQU 32; /** set if the above-left macroblock is available */
-OMX_UPPER_RIGHT EQU 64; /** set if the above-right macroblock is available */
-OMX_LOWER_LEFT EQU 128;
-OMX_LOWER_RIGHT EQU 256
-;}
-
-;enum {
-OMX_VIDEO_LUMINANCE EQU 0; /** Luminance component */
-OMX_VIDEO_CHROMINANCE EQU 1; /** chrominance component */
-OMX_VIDEO_ALPHA EQU 2; /** Alpha component */
-;}
-
-;enum {
-OMX_VIDEO_INTER EQU 0; /** P picture or P-VOP */
-OMX_VIDEO_INTER_Q EQU 1; /** P picture or P-VOP */
-OMX_VIDEO_INTER4V EQU 2; /** P picture or P-VOP */
-OMX_VIDEO_INTRA EQU 3; /** I and P picture; I- and P-VOP */
-OMX_VIDEO_INTRA_Q EQU 4; /** I and P picture; I- and P-VOP */
-OMX_VIDEO_INTER4V_Q EQU 5; /** P picture or P-VOP (H.263)*/
-OMX_VIDEO_DIRECT EQU 6; /** B picture or B-VOP (MPEG-4 only) */
-OMX_VIDEO_INTERPOLATE EQU 7; /** B picture or B-VOP */
-OMX_VIDEO_BACKWARD EQU 8; /** B picture or B-VOP */
-OMX_VIDEO_FORWARD EQU 9; /** B picture or B-VOP */
-OMX_VIDEO_NOTCODED EQU 10; /** B picture or B-VOP */
-;}
-
-;enum {
-OMX_16X16_VERT EQU 0; /** Intra_16x16_Vertical (prediction mode) */
-OMX_16X16_HOR EQU 1; /** Intra_16x16_Horizontal (prediction mode) */
-OMX_16X16_DC EQU 2; /** Intra_16x16_DC (prediction mode) */
-OMX_16X16_PLANE EQU 3; /** Intra_16x16_Plane (prediction mode) */
-;}
-
-;enum {
-OMX_4x4_VERT EQU 0; /** Intra_4x4_Vertical (prediction mode) */
-OMX_4x4_HOR EQU 1; /** Intra_4x4_Horizontal (prediction mode) */
-OMX_4x4_DC EQU 2; /** Intra_4x4_DC (prediction mode) */
-OMX_4x4_DIAG_DL EQU 3; /** Intra_4x4_Diagonal_Down_Left (prediction mode) */
-OMX_4x4_DIAG_DR EQU 4; /** Intra_4x4_Diagonal_Down_Right (prediction mode) */
-OMX_4x4_VR EQU 5; /** Intra_4x4_Vertical_Right (prediction mode) */
-OMX_4x4_HD EQU 6; /** Intra_4x4_Horizontal_Down (prediction mode) */
-OMX_4x4_VL EQU 7; /** Intra_4x4_Vertical_Left (prediction mode) */
-OMX_4x4_HU EQU 8; /** Intra_4x4_Horizontal_Up (prediction mode) */
-;}
-
-;enum {
-OMX_CHROMA_DC EQU 0; /** Intra_Chroma_DC (prediction mode) */
-OMX_CHROMA_HOR EQU 1; /** Intra_Chroma_Horizontal (prediction mode) */
-OMX_CHROMA_VERT EQU 2; /** Intra_Chroma_Vertical (prediction mode) */
-OMX_CHROMA_PLANE EQU 3; /** Intra_Chroma_Plane (prediction mode) */
-;}
-
-;typedef struct {
-x EQU 0;
-y EQU 4;
-;}OMXCoordinate;
-
-;typedef struct {
-dx EQU 0;
-dy EQU 2;
-;}OMXMotionVector;
-
-;typedef struct {
-xx EQU 0;
-yy EQU 4;
-width EQU 8;
-height EQU 12;
-;}OMXiRect;
-
-;typedef enum {
-OMX_VC_INTER EQU 0; /** P picture or P-VOP */
-OMX_VC_INTER_Q EQU 1; /** P picture or P-VOP */
-OMX_VC_INTER4V EQU 2; /** P picture or P-VOP */
-OMX_VC_INTRA EQU 3; /** I and P picture, I- and P-VOP */
-OMX_VC_INTRA_Q EQU 4; /** I and P picture, I- and P-VOP */
-OMX_VC_INTER4V_Q EQU 5; /** P picture or P-VOP (H.263)*/
-;} OMXVCM4P2MacroblockType;
-
-;enum {
-OMX_VC_NONE EQU 0
-OMX_VC_HORIZONTAL EQU 1
-OMX_VC_VERTICAL EQU 2
-;};
-
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/comm/src/omxVCCOMM_Copy16x16_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/comm/src/omxVCCOMM_Copy16x16_s.s
deleted file mode 100644
index 296d59d..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/comm/src/omxVCCOMM_Copy16x16_s.s
+++ /dev/null
@@ -1,95 +0,0 @@
- ;/**
- ; * Function: omxVCCOMM_Copy16x16
- ; *
- ; * Description:
- ; * Copies the reference 16x16 block to the current block.
- ; * Parameters:
- ; * [in] pSrc - pointer to the reference block in the source frame; must be aligned on an 16-byte boundary.
- ; * [in] step - distance between the starts of consecutive lines in the reference frame, in bytes;
- ; * must be a multiple of 16 and must be larger than or equal to 16.
- ; * [out] pDst - pointer to the destination block; must be aligned on an 8-byte boundary.
- ; * Return Value:
- ; * OMX_Sts_NoErr - no error
- ; * OMX_Sts_BadArgErr - bad arguments; returned under any of the following conditions:
- ; * - one or more of the following pointers is NULL: pSrc, pDst
- ; * - one or more of the following pointers is not aligned on an 16-byte boundary: pSrc, pDst
- ; * - step <16 or step is not a multiple of 16.
- ; */
-
- INCLUDE omxtypes_s.h
-
-
- M_VARIANTS CortexA8
-
- IF CortexA8
-
-
- ;//Input Arguments
-pSrc RN 0
-pDst RN 1
-step RN 2
-
-;//Local Variables
-Return RN 0
-;// Neon Registers
-
-X0 DN D0.S8
-X1 DN D1.S8
-X2 DN D2.S8
-X3 DN D3.S8
-X4 DN D4.S8
-X5 DN D5.S8
-X6 DN D6.S8
-X7 DN D7.S8
-
- M_START omxVCCOMM_Copy16x16
-
-
- VLD1 {X0,X1},[pSrc@128],step ;// Load 16 bytes from 16 byte aligned pSrc and pSrc=pSrc + step after loading
- VLD1 {X2,X3},[pSrc@128],step
- VLD1 {X4,X5},[pSrc@128],step
- VLD1 {X6,X7},[pSrc@128],step
-
- VST1 {X0,X1,X2,X3},[pDst@128]! ;// Store 32 bytes to 16 byte aligned pDst
- VST1 {X4,X5,X6,X7},[pDst@128]!
-
-
- VLD1 {X0,X1},[pSrc@128],step
- VLD1 {X2,X3},[pSrc@128],step
- VLD1 {X4,X5},[pSrc@128],step
- VLD1 {X6,X7},[pSrc@128],step
-
- VST1 {X0,X1,X2,X3},[pDst@128]!
- VST1 {X4,X5,X6,X7},[pDst@128]!
-
-
- VLD1 {X0,X1},[pSrc@128],step
- VLD1 {X2,X3},[pSrc@128],step
- VLD1 {X4,X5},[pSrc@128],step
- VLD1 {X6,X7},[pSrc@128],step
-
- VST1 {X0,X1,X2,X3},[pDst@128]!
- VST1 {X4,X5,X6,X7},[pDst@128]!
-
-
- VLD1 {X0,X1},[pSrc@128],step
- VLD1 {X2,X3},[pSrc@128],step
- VLD1 {X4,X5},[pSrc@128],step
- VLD1 {X6,X7},[pSrc@128],step
-
- VST1 {X0,X1,X2,X3},[pDst@128]!
- VST1 {X4,X5,X6,X7},[pDst@128]!
-
-
- MOV Return,#OMX_Sts_NoErr
-
-
-
- M_END
- ENDIF
-
-
-
-
- END
-
\ No newline at end of file
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/comm/src/omxVCCOMM_Copy8x8_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/comm/src/omxVCCOMM_Copy8x8_s.s
deleted file mode 100644
index db9e5ef..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/comm/src/omxVCCOMM_Copy8x8_s.s
+++ /dev/null
@@ -1,70 +0,0 @@
- ;/**
- ; * Function: omxVCCOMM_Copy8x8
- ; *
- ; * Description:
- ; * Copies the reference 8x8 block to the current block.
- ; * Parameters:
- ; * [in] pSrc - pointer to the reference block in the source frame; must be aligned on an 8-byte boundary.
- ; * [in] step - distance between the starts of consecutive lines in the reference frame, in bytes;
- ; * must be a multiple of 8 and must be larger than or equal to 8.
- ; * [out] pDst - pointer to the destination block; must be aligned on an 8-byte boundary.
- ; * Return Value:
- ; * OMX_Sts_NoErr - no error
- ; * OMX_Sts_BadArgErr - bad arguments; returned under any of the following conditions:
- ; * - one or more of the following pointers is NULL: pSrc, pDst
- ; * - one or more of the following pointers is not aligned on an 8-byte boundary: pSrc, pDst
- ; * - step <8 or step is not a multiple of 8.
- ; */
-
- INCLUDE omxtypes_s.h
-
-
- M_VARIANTS CortexA8
-
- IF CortexA8
-
-
- ;//Input Arguments
-pSrc RN 0
-pDst RN 1
-step RN 2
-
-;//Local Variables
-Count RN 3
-Return RN 0
-;// Neon Registers
-
-X0 DN D0.S8
-X1 DN D1.S8
-X2 DN D2.S8
-X3 DN D3.S8
- M_START omxVCCOMM_Copy8x8
-
-
-
- VLD1 {X0},[pSrc],step ;// Load 8 bytes from 8 byte aligned pSrc, pSrc=pSrc+step after load
- VLD1 {X1},[pSrc],step
- VLD1 {X2},[pSrc],step
- VLD1 {X3},[pSrc],step
-
- VST1 {X0,X1},[pDst]! ;// Store 16 bytes to 8 byte aligned pDst
- VST1 {X2,X3},[pDst]!
-
- VLD1 {X0},[pSrc],step
- VLD1 {X1},[pSrc],step
- VLD1 {X2},[pSrc],step
- VLD1 {X3},[pSrc],step
-
- VST1 {X0,X1},[pDst]!
- VST1 {X2,X3},[pDst]!
-
- MOV Return,#OMX_Sts_NoErr
-
- M_END
- ENDIF
-
-
-
-
- END
-
\ No newline at end of file
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/comm/src/omxVCCOMM_ExpandFrame_I_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/comm/src/omxVCCOMM_ExpandFrame_I_s.s
deleted file mode 100644
index 3d6b669..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/comm/src/omxVCCOMM_ExpandFrame_I_s.s
+++ /dev/null
@@ -1,250 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCCOMM_ExpandFrame_I_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-;// Description:
-;// This function will Expand Frame boundary pixels into Plane
-;//
-;//
-
-;// Include standard headers
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS CortexA8
-
-;// Import symbols required from other files
-;// (For example tables)
-
-
-;// Set debugging level
-DEBUG_ON SETL {FALSE}
-
-
-
- IF CortexA8
-
- M_START omxVCCOMM_ExpandFrame_I,r11
-
-;//Input registers
-
-pSrcDstPlane RN 0
-iFrameWidth RN 1
-iFrameHeight RN 2
-iExpandPels RN 3
-iPlaneStep RN 4
-pTop RN 5
-pBot RN 6
-pDstTop RN 7
-pDstBot RN 8
-pLeft RN 5
-pRight RN 6
-pDstLeft RN 9
-pDstRight RN 10
-Offset RN 11
-Temp RN 14
-Counter RN 12
-Tmp RN 7
-;//Output registers
-
-result RN 0
-;// Neon registers
-qData0 QN 0.U8
-qData1 QN 1.U8
-dData0 DN 0.U8
-dData1 DN 1.U8
-dData2 DN 2.U8
-dData3 DN 3.U8
-
- ;// Define stack arguments
- M_ARG pPlaneStep, 4
-
- ;// Load argument from the stack
- M_LDR iPlaneStep, pPlaneStep
-
- SUB pTop, pSrcDstPlane, #0 ;// Top row pointer of the frame
- MUL Offset, iExpandPels, iPlaneStep ;// E*Step
- SUB Temp, iFrameHeight, #1 ;// H-1
- MUL Temp, iPlaneStep, Temp ;// (H-1)*Step
- ADD pBot, Temp, pSrcDstPlane ;// BPtr = TPtr + (H-1)*Step
- MOV Temp, iFrameWidth ;// Outer loop counter
-
- ;// Check if pSrcDstPlane and iPlaneStep are 16 byte aligned
- TST pSrcDstPlane, #0xf
- TSTEQ iPlaneStep, #0xf
- BNE Hor8Loop00
-
- ;//
- ;// Copy top and bottom region of the plane as follows
- ;// top region = top row elements from the frame
- ;// bottom region = last row elements from the frame
- ;//
-
- ;// Case for 16 byte alignment
-Hor16Loop00
- SUB pDstTop, pTop, Offset
- VLD1 qData0, [pTop @128]!
- MOV Counter, iExpandPels ;// Inner loop counter
- ADD pDstBot, pBot, iPlaneStep
- VLD1 qData1, [pBot @128]!
-Ver16Loop0
- VST1 qData0, [pDstTop @128], iPlaneStep
- VST1 qData0, [pDstTop @128], iPlaneStep
- VST1 qData0, [pDstTop @128], iPlaneStep
- VST1 qData0, [pDstTop @128], iPlaneStep
- VST1 qData0, [pDstTop @128], iPlaneStep
- VST1 qData0, [pDstTop @128], iPlaneStep
- VST1 qData0, [pDstTop @128], iPlaneStep
- VST1 qData0, [pDstTop @128], iPlaneStep
- SUBS Counter, Counter, #8
- VST1 qData1, [pDstBot @128], iPlaneStep
- VST1 qData1, [pDstBot @128], iPlaneStep
- VST1 qData1, [pDstBot @128], iPlaneStep
- VST1 qData1, [pDstBot @128], iPlaneStep
- VST1 qData1, [pDstBot @128], iPlaneStep
- VST1 qData1, [pDstBot @128], iPlaneStep
- VST1 qData1, [pDstBot @128], iPlaneStep
- VST1 qData1, [pDstBot @128], iPlaneStep
- BGT Ver16Loop0
-
- SUBS Temp, Temp, #16
- BGT Hor16Loop00
- B EndAlignedLoop
-
- ;// Case for 8 byte alignment
-Hor8Loop00
- SUB pDstTop, pTop, Offset
- VLD1 qData0, [pTop @64]!
- MOV Counter, iExpandPels ;// Inner loop counter
- ADD pDstBot, pBot, iPlaneStep
- VLD1 qData1, [pBot @64]!
-Ver8Loop0
- VST1 qData0, [pDstTop @64], iPlaneStep
- VST1 qData0, [pDstTop @64], iPlaneStep
- VST1 qData0, [pDstTop @64], iPlaneStep
- VST1 qData0, [pDstTop @64], iPlaneStep
- VST1 qData0, [pDstTop @64], iPlaneStep
- VST1 qData0, [pDstTop @64], iPlaneStep
- VST1 qData0, [pDstTop @64], iPlaneStep
- VST1 qData0, [pDstTop @64], iPlaneStep
- SUBS Counter, Counter, #8
- VST1 qData1, [pDstBot @64], iPlaneStep
- VST1 qData1, [pDstBot @64], iPlaneStep
- VST1 qData1, [pDstBot @64], iPlaneStep
- VST1 qData1, [pDstBot @64], iPlaneStep
- VST1 qData1, [pDstBot @64], iPlaneStep
- VST1 qData1, [pDstBot @64], iPlaneStep
- VST1 qData1, [pDstBot @64], iPlaneStep
- VST1 qData1, [pDstBot @64], iPlaneStep
- BGT Ver8Loop0
-
- SUBS Temp, Temp, #16
- BGT Hor8Loop00
-
-EndAlignedLoop
- ADD Temp, pSrcDstPlane, iFrameWidth
- SUB pDstRight, Temp, Offset
- SUB pRight, Temp, #1
- SUB pDstLeft, pSrcDstPlane, Offset
- SUB pDstLeft, pDstLeft, iExpandPels
- ADD pLeft, pSrcDstPlane, #0
-
- VLD1 {dData0 []}, [pLeft], iPlaneStep ;// Top-Left corner pixel from frame duplicated in dData0
- SUB Offset, iPlaneStep, iExpandPels
- VLD1 {dData1 []}, [pRight], iPlaneStep ;// Top-Right corner pixel from frame duplicated in dData1
- MOV Temp, iExpandPels
-
- ;//
- ;// Copy top-left and top-right region of the plane as follows
- ;// top-left region = top-left corner pixel from the frame
- ;// top-right region = top-right corner pixel from the frame
- ;//
-HorLoop11
- MOV Counter, iExpandPels
-VerLoop1
- VST1 dData0, [pDstLeft], #8
- SUBS Counter, Counter, #8
- VST1 dData1, [pDstRight], #8
- BGT VerLoop1
-
- SUBS Temp, Temp, #1
- ADD pDstLeft, pDstLeft, Offset
- ADD pDstRight, pDstRight, Offset
- BPL HorLoop11
-
- SUB iFrameHeight, iFrameHeight, #1
- ;//
- ;// Copy left and right region of the plane as follows
- ;// Left region = copy the row with left start pixel from the frame
- ;// Right region = copy the row with right end pixel from the frame
- ;//
-HorLoop22
- VLD1 {dData0 []}, [pLeft], iPlaneStep
- MOV Counter, iExpandPels
- VLD1 {dData1 []}, [pRight], iPlaneStep
-VerLoop2
- VST1 dData0, [pDstLeft], #8
- SUBS Counter, Counter, #8
- VST1 dData1, [pDstRight], #8
- BGT VerLoop2
-
- SUBS iFrameHeight, iFrameHeight, #1
- ADD pDstLeft, pDstLeft, Offset
- ADD pDstRight, pDstRight, Offset
- BGT HorLoop22
-
- MOV Temp, iExpandPels
- ;//
- ;// Copy bottom-left and bottom-right region of the plane as follows
- ;// bottom-left region = bottom-left corner pixel from the frame
- ;// bottom-right region = bottom-right corner pixel from the frame
- ;//
-HorLoop33
- MOV Counter, iExpandPels
-VerLoop3
- VST1 dData0, [pDstLeft], #8
- SUBS Counter, Counter, #8
- VST1 dData1, [pDstRight], #8
- BGT VerLoop3
-
- SUBS Temp, Temp, #1
- ADD pDstLeft, pDstLeft, Offset
- ADD pDstRight, pDstRight, Offset
- BGT HorLoop33
-End
- MOV r0, #OMX_Sts_NoErr
-
- M_END
-
- ENDIF
-
-
-
-
-;// Guarding implementation by the processor name
-
-
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/api/armVCM4P10_CAVLCTables.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/api/armVCM4P10_CAVLCTables.h
deleted file mode 100644
index 7dde9a7..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/api/armVCM4P10_CAVLCTables.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: armVCM4P10_CAVLCTables.h
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- * Header file for optimized H.264 CALVC tables
- *
- */
-
-#ifndef ARMVCM4P10_CAVLCTABLES_H
-#define ARMVCM4P10_CAVLCTABLES_H
-
-/* CAVLC tables */
-
-extern const OMX_U16 *armVCM4P10_CAVLCCoeffTokenTables[18];
-extern const OMX_U16 *armVCM4P10_CAVLCTotalZeroTables[15];
-extern const OMX_U16 *armVCM4P10_CAVLCTotalZeros2x2Tables[3];
-extern const OMX_U16 *armVCM4P10_CAVLCRunBeforeTables[15];
-extern const OMX_U8 armVCM4P10_ZigZag_4x4[16];
-extern const OMX_U8 armVCM4P10_ZigZag_2x2[4];
-extern const OMX_S8 armVCM4P10_SuffixToLevel[7];
-
-#endif
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_Average_4x_Align_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_Average_4x_Align_unsafe_s.s
deleted file mode 100644
index 5f3eb9b..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_Average_4x_Align_unsafe_s.s
+++ /dev/null
@@ -1,236 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_Average_4x_Align_unsafe_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
-
-;// Functions:
-;// armVCM4P10_Average_4x4_Align<ALIGNMENT>_unsafe
-;//
-;// Implements Average of 4x4 with equation c = (a+b+1)>>1.
-;// First operand will be at offset ALIGNMENT from aligned address
-;// Second operand will be at aligned location and will be used as output.
-;// destination pointed by (pDst) for vertical interpolation.
-;// This function needs to copy 4 bytes in horizontal direction
-;//
-;// Registers used as input for this function
-;// r0,r1,r2,r3 where r2 containings aligned memory pointer and r3 step size
-;//
-;// Registers preserved for top level function
-;// r4,r5,r6,r8,r9,r14
-;//
-;// Registers modified by the function
-;// r7,r10,r11,r12
-;//
-;// Output registers
-;// r2 - pointer to the aligned location
-;// r3 - step size to this aligned location
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
- EXPORT armVCM4P10_Average_4x4_Align0_unsafe
- EXPORT armVCM4P10_Average_4x4_Align2_unsafe
- EXPORT armVCM4P10_Average_4x4_Align3_unsafe
-
-DEBUG_ON SETL {FALSE}
-
-;// Declare input registers
-pPred0 RN 0
-iPredStep0 RN 1
-pPred1 RN 2
-iPredStep1 RN 3
-pDstPred RN 2
-iDstStep RN 3
-
-;// Declare other intermediate registers
-iPredA0 RN 10
-iPredA1 RN 11
-iPredB0 RN 12
-iPredB1 RN 14
-Temp1 RN 4
-Temp2 RN 5
-ResultA RN 5
-ResultB RN 4
-r0x80808080 RN 7
-
- IF ARM1136JS
-
- ;// This function calculates average of 4x4 block
- ;// pPred0 is at alignment offset 0 and pPred1 is alignment 4
-
- ;// Function header
- M_START armVCM4P10_Average_4x4_Align0_unsafe, r6
-
- ;// Code start
- LDR r0x80808080, =0x80808080
-
- ;// 1st load
- M_LDR iPredB0, [pPred1]
- M_LDR iPredA0, [pPred0], iPredStep0
- M_LDR iPredB1, [pPred1, iPredStep1]
- M_LDR iPredA1, [pPred0], iPredStep0
-
- ;// (a+b+1)/2 = (a+256-(255-b))/2 = (a-(255-b))/2 + 128
- MVN iPredB0, iPredB0
- MVN iPredB1, iPredB1
- UHSUB8 ResultA, iPredA0, iPredB0
- UHSUB8 ResultB, iPredA1, iPredB1
- EOR ResultA, ResultA, r0x80808080
- M_STR ResultA, [pDstPred], iDstStep
- EOR ResultB, ResultB, r0x80808080
- M_STR ResultB, [pDstPred], iDstStep
-
- ;// 2nd load
- M_LDR iPredA0, [pPred0], iPredStep0
- M_LDR iPredB0, [pPred1]
- M_LDR iPredA1, [pPred0], iPredStep0
- M_LDR iPredB1, [pPred1, iPredStep1]
-
- MVN iPredB0, iPredB0
- UHSUB8 ResultA, iPredA0, iPredB0
- MVN iPredB1, iPredB1
- UHSUB8 ResultB, iPredA1, iPredB1
- EOR ResultA, ResultA, r0x80808080
- M_STR ResultA, [pDstPred], iDstStep
- EOR ResultB, ResultB, r0x80808080
- M_STR ResultB, [pDstPred], iDstStep
-End0
- M_END
-
- ;// This function calculates average of 4x4 block
- ;// pPred0 is at alignment offset 2 and pPred1 is alignment 4
-
- ;// Function header
- M_START armVCM4P10_Average_4x4_Align2_unsafe, r6
-
- ;// Code start
- LDR r0x80808080, =0x80808080
-
- ;// 1st load
- LDR Temp1, [pPred0, #4]
- M_LDR iPredA0, [pPred0], iPredStep0
- M_LDR iPredB0, [pPred1]
- M_LDR iPredB1, [pPred1, iPredStep1]
- M_LDR Temp2, [pPred0, #4]
- M_LDR iPredA1, [pPred0], iPredStep0
- MVN iPredB0, iPredB0
- MVN iPredB1, iPredB1
- MOV iPredA0, iPredA0, LSR #16
- ORR iPredA0, iPredA0, Temp1, LSL #16
- MOV iPredA1, iPredA1, LSR #16
- ORR iPredA1, iPredA1, Temp2, LSL #16
-
- ;// (a+b+1)/2 = (a+256-(255-b))/2 = (a-(255-b))/2 + 128
- UHSUB8 ResultA, iPredA0, iPredB0
- UHSUB8 ResultB, iPredA1, iPredB1
- EOR ResultA, ResultA, r0x80808080
- M_STR ResultA, [pDstPred], iDstStep
- EOR ResultB, ResultB, r0x80808080
- M_STR ResultB, [pDstPred], iDstStep
-
- ;// 2nd load
- LDR Temp1, [pPred0, #4]
- M_LDR iPredA0, [pPred0], iPredStep0
- LDR iPredB0, [pPred1]
- LDR iPredB1, [pPred1, iPredStep1]
- LDR Temp2, [pPred0, #4]
- M_LDR iPredA1, [pPred0], iPredStep0
- MVN iPredB0, iPredB0
- MVN iPredB1, iPredB1
- MOV iPredA0, iPredA0, LSR #16
- ORR iPredA0, iPredA0, Temp1, LSL #16
- MOV iPredA1, iPredA1, LSR #16
- ORR iPredA1, iPredA1, Temp2, LSL #16
-
- UHSUB8 ResultA, iPredA0, iPredB0
- UHSUB8 ResultB, iPredA1, iPredB1
- EOR ResultA, ResultA, r0x80808080
- M_STR ResultA, [pDstPred], iDstStep
- EOR ResultB, ResultB, r0x80808080
- M_STR ResultB, [pDstPred], iDstStep
-End2
- M_END
-
-
- ;// This function calculates average of 4x4 block
- ;// pPred0 is at alignment offset 3 and pPred1 is alignment 4
-
- ;// Function header
- M_START armVCM4P10_Average_4x4_Align3_unsafe, r6
-
- ;// Code start
- LDR r0x80808080, =0x80808080
-
- ;// 1st load
- LDR Temp1, [pPred0, #4]
- M_LDR iPredA0, [pPred0], iPredStep0
- LDR iPredB0, [pPred1]
- LDR iPredB1, [pPred1, iPredStep1]
- LDR Temp2, [pPred0, #4]
- M_LDR iPredA1, [pPred0], iPredStep0
-
- MVN iPredB0, iPredB0
- MVN iPredB1, iPredB1
- MOV iPredA0, iPredA0, LSR #24
- ORR iPredA0, iPredA0, Temp1, LSL #8
- MOV iPredA1, iPredA1, LSR #24
- ORR iPredA1, iPredA1, Temp2, LSL #8
- UHSUB8 ResultA, iPredA0, iPredB0
- UHSUB8 ResultB, iPredA1, iPredB1
- EOR ResultA, ResultA, r0x80808080
- M_STR ResultA, [pDstPred], iDstStep
- EOR ResultB, ResultB, r0x80808080
- M_STR ResultB, [pDstPred], iDstStep
-
- ;// 2nd load
- LDR Temp1, [pPred0, #4]
- M_LDR iPredA0, [pPred0], iPredStep0
- LDR iPredB0, [pPred1]
- LDR iPredB1, [pPred1, iPredStep1]
- LDR Temp2, [pPred0, #4]
- M_LDR iPredA1, [pPred0], iPredStep0
-
- MVN iPredB0, iPredB0
- MVN iPredB1, iPredB1
- MOV iPredA0, iPredA0, LSR #24
- ORR iPredA0, iPredA0, Temp1, LSL #8
- MOV iPredA1, iPredA1, LSR #24
- ORR iPredA1, iPredA1, Temp2, LSL #8
-
- UHSUB8 ResultA, iPredA0, iPredB0
- UHSUB8 ResultB, iPredA1, iPredB1
- EOR ResultA, ResultA, r0x80808080
- M_STR ResultA, [pDstPred], iDstStep
- EOR ResultB, ResultB, r0x80808080
- M_STR ResultB, [pDstPred], iDstStep
-End3
- M_END
-
- ENDIF
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_CAVLCTables.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_CAVLCTables.c
deleted file mode 100644
index bb4bd9e..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_CAVLCTables.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: armVCM4P10_CAVLCTables.c
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- * Optimized CAVLC tables for H.264
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-
-#include "armVCM4P10_CAVLCTables.h"
-
-/* 4x4 DeZigZag table */
-
-const OMX_U8 armVCM4P10_ZigZag_4x4[16] =
-{
- 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15
-};
-
-/* 2x2 DeZigZag table */
-
-const OMX_U8 armVCM4P10_ZigZag_2x2[4] =
-{
- 0, 1, 2, 3
-};
-
-
-/*
- * Suffix To Level table
- * We increment the suffix length if
- * ((LevelCode>>1)+1)>(3<<(SuffixLength-1)) && SuffixLength<6
- * (LevelCode>>1)>=(3<<(SuffixLength-1)) && SuffixLength<6
- * LevelCode >= 3<<SuffixLength && SuffixLength<6
- * (LevelCode+2) >= (3<<SuffixLength)+2 && SuffixLength<6
- */
-const OMX_S8 armVCM4P10_SuffixToLevel[7] =
-{
- (3<<1)+2, /* SuffixLength=1 */
- (3<<1)+2, /* SuffixLength=1 */
- (3<<2)+2, /* SuffixLength=2 */
- (3<<3)+2, /* SuffixLength=3 */
- (3<<4)+2, /* SuffixLength=4 */
- (3<<5)+2, /* SuffixLength=5 */
- -1 /* SuffixLength=6 - never increment */
-};
-
-static const OMX_U16 armVCM4P10_CAVLCCoeffTokenTables_0[132] = {
- 0x0020, 0x0100, 0x2015, 0x2015, 0x400b, 0x400b, 0x400b, 0x400b,
- 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001,
- 0x0028, 0x00f0, 0x00f8, 0x0027, 0x0030, 0x00d8, 0x00e0, 0x00e8,
- 0x0038, 0x00a0, 0x00c8, 0x00d0, 0x0040, 0x0068, 0x0090, 0x0098,
- 0x0048, 0x0050, 0x0058, 0x0060, 0x27ff, 0x27ff, 0x206b, 0x206b,
- 0x0081, 0x0085, 0x0083, 0x0079, 0x0087, 0x007d, 0x007b, 0x0071,
- 0x007f, 0x0075, 0x0073, 0x0069, 0x0070, 0x0078, 0x0080, 0x0088,
- 0x2077, 0x2077, 0x206d, 0x206d, 0x2063, 0x2063, 0x2061, 0x2061,
- 0x206f, 0x206f, 0x2065, 0x2065, 0x205b, 0x205b, 0x2059, 0x2059,
- 0x0067, 0x005d, 0x0053, 0x0051, 0x005f, 0x0055, 0x004b, 0x0049,
- 0x00a8, 0x00b0, 0x00b8, 0x00c0, 0x2041, 0x2041, 0x204d, 0x204d,
- 0x2043, 0x2043, 0x2039, 0x2039, 0x2057, 0x2057, 0x2045, 0x2045,
- 0x203b, 0x203b, 0x2031, 0x2031, 0x204f, 0x204f, 0x203d, 0x203d,
- 0x2033, 0x2033, 0x2029, 0x2029, 0x0047, 0x0035, 0x002b, 0x0021,
- 0x203f, 0x203f, 0x202d, 0x202d, 0x2023, 0x2023, 0x2019, 0x2019,
- 0x0037, 0x0025, 0x001b, 0x0011, 0x202f, 0x202f, 0x201d, 0x201d,
- 0x0013, 0x0009, 0x201f, 0x201f
-};
-
-static const OMX_U16 armVCM4P10_CAVLCCoeffTokenTables_1[128] = {
- 0x0020, 0x00e8, 0x00f0, 0x00f8, 0x0027, 0x001f, 0x2015, 0x2015,
- 0x400b, 0x400b, 0x400b, 0x400b, 0x4001, 0x4001, 0x4001, 0x4001,
- 0x0028, 0x00d0, 0x00d8, 0x00e0, 0x0030, 0x0098, 0x00c0, 0x00c8,
- 0x0038, 0x0060, 0x0088, 0x0090, 0x0040, 0x0048, 0x0050, 0x0058,
- 0x27ff, 0x27ff, 0x207f, 0x207f, 0x0087, 0x0085, 0x0083, 0x0081,
- 0x007b, 0x0079, 0x007d, 0x0073, 0x2075, 0x2075, 0x2071, 0x2071,
- 0x0068, 0x0070, 0x0078, 0x0080, 0x2077, 0x2077, 0x206d, 0x206d,
- 0x206b, 0x206b, 0x2069, 0x2069, 0x206f, 0x206f, 0x2065, 0x2065,
- 0x2063, 0x2063, 0x2061, 0x2061, 0x0059, 0x005d, 0x005b, 0x0051,
- 0x0067, 0x0055, 0x0053, 0x0049, 0x00a0, 0x00a8, 0x00b0, 0x00b8,
- 0x205f, 0x205f, 0x204d, 0x204d, 0x204b, 0x204b, 0x2041, 0x2041,
- 0x2057, 0x2057, 0x2045, 0x2045, 0x2043, 0x2043, 0x2039, 0x2039,
- 0x204f, 0x204f, 0x203d, 0x203d, 0x203b, 0x203b, 0x2031, 0x2031,
- 0x0029, 0x0035, 0x0033, 0x0021, 0x2047, 0x2047, 0x202d, 0x202d,
- 0x202b, 0x202b, 0x2019, 0x2019, 0x003f, 0x0025, 0x0023, 0x0011,
- 0x0037, 0x001d, 0x001b, 0x0009, 0x202f, 0x202f, 0x2013, 0x2013
-};
-
-static const OMX_U16 armVCM4P10_CAVLCCoeffTokenTables_2[112] = {
- 0x0020, 0x0088, 0x00b0, 0x00b8, 0x00c0, 0x00c8, 0x00d0, 0x00d8,
- 0x003f, 0x0037, 0x002f, 0x0027, 0x001f, 0x0015, 0x000b, 0x0001,
- 0x0028, 0x0050, 0x0078, 0x0080, 0x0030, 0x0038, 0x0040, 0x0048,
- 0x07ff, 0x0081, 0x0087, 0x0085, 0x0083, 0x0079, 0x007f, 0x007d,
- 0x007b, 0x0071, 0x0077, 0x0075, 0x0073, 0x0069, 0x206b, 0x206b,
- 0x0058, 0x0060, 0x0068, 0x0070, 0x2061, 0x2061, 0x206d, 0x206d,
- 0x2063, 0x2063, 0x2059, 0x2059, 0x206f, 0x206f, 0x2065, 0x2065,
- 0x205b, 0x205b, 0x2051, 0x2051, 0x0067, 0x005d, 0x0053, 0x0049,
- 0x005f, 0x0055, 0x004b, 0x0041, 0x0090, 0x0098, 0x00a0, 0x00a8,
- 0x2039, 0x2039, 0x2031, 0x2031, 0x204d, 0x204d, 0x2029, 0x2029,
- 0x2057, 0x2057, 0x2045, 0x2045, 0x2043, 0x2043, 0x2021, 0x2021,
- 0x0019, 0x003d, 0x003b, 0x0011, 0x004f, 0x0035, 0x0033, 0x0009,
- 0x202b, 0x202b, 0x202d, 0x202d, 0x2023, 0x2023, 0x2025, 0x2025,
- 0x201b, 0x201b, 0x2047, 0x2047, 0x201d, 0x201d, 0x2013, 0x2013
-};
-
-static const OMX_U16 armVCM4P10_CAVLCCoeffTokenTables_3[80] = {
- 0x0020, 0x0028, 0x0030, 0x0038, 0x0040, 0x0048, 0x0050, 0x0058,
- 0x0060, 0x0068, 0x0070, 0x0078, 0x0080, 0x0088, 0x0090, 0x0098,
- 0x0009, 0x000b, 0x07ff, 0x0001, 0x0011, 0x0013, 0x0015, 0x07ff,
- 0x0019, 0x001b, 0x001d, 0x001f, 0x0021, 0x0023, 0x0025, 0x0027,
- 0x0029, 0x002b, 0x002d, 0x002f, 0x0031, 0x0033, 0x0035, 0x0037,
- 0x0039, 0x003b, 0x003d, 0x003f, 0x0041, 0x0043, 0x0045, 0x0047,
- 0x0049, 0x004b, 0x004d, 0x004f, 0x0051, 0x0053, 0x0055, 0x0057,
- 0x0059, 0x005b, 0x005d, 0x005f, 0x0061, 0x0063, 0x0065, 0x0067,
- 0x0069, 0x006b, 0x006d, 0x006f, 0x0071, 0x0073, 0x0075, 0x0077,
- 0x0079, 0x007b, 0x007d, 0x007f, 0x0081, 0x0083, 0x0085, 0x0087
-};
-
-static const OMX_U16 armVCM4P10_CAVLCCoeffTokenTables_4[32] = {
- 0x0020, 0x0038, 0x2015, 0x2015, 0x4001, 0x4001, 0x4001, 0x4001,
- 0x600b, 0x600b, 0x600b, 0x600b, 0x600b, 0x600b, 0x600b, 0x600b,
- 0x0028, 0x0030, 0x0021, 0x0019, 0x2027, 0x2027, 0x0025, 0x0023,
- 0x201d, 0x201d, 0x201b, 0x201b, 0x0011, 0x001f, 0x0013, 0x0009
-};
-
-const OMX_U16 * armVCM4P10_CAVLCCoeffTokenTables[18] = {
- armVCM4P10_CAVLCCoeffTokenTables_0, /* nC=0 */
- armVCM4P10_CAVLCCoeffTokenTables_0, /* nC=1 */
- armVCM4P10_CAVLCCoeffTokenTables_1, /* nC=2 */
- armVCM4P10_CAVLCCoeffTokenTables_1, /* nC=3 */
- armVCM4P10_CAVLCCoeffTokenTables_2, /* nC=4 */
- armVCM4P10_CAVLCCoeffTokenTables_2, /* nC=5 */
- armVCM4P10_CAVLCCoeffTokenTables_2, /* nC=6 */
- armVCM4P10_CAVLCCoeffTokenTables_2, /* nC=7 */
- armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=8 */
- armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=9 */
- armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=10 */
- armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=11 */
- armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=12 */
- armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=13 */
- armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=14 */
- armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=15 */
- armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=16 */
- armVCM4P10_CAVLCCoeffTokenTables_4 /* nC=-1 */
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_0[40] = {
- 0x0020, 0x0048, 0x0009, 0x0007, 0x2005, 0x2005, 0x2003, 0x2003,
- 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001,
- 0x0028, 0x0040, 0x0011, 0x000f, 0x0030, 0x0038, 0x0019, 0x0017,
- 0x27ff, 0x27ff, 0x201f, 0x201f, 0x201d, 0x201d, 0x201b, 0x201b,
- 0x2015, 0x2015, 0x2013, 0x2013, 0x200d, 0x200d, 0x200b, 0x200b
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_1[24] = {
- 0x0020, 0x0028, 0x0011, 0x000f, 0x000d, 0x000b, 0x2009, 0x2009,
- 0x2007, 0x2007, 0x2005, 0x2005, 0x2003, 0x2003, 0x2001, 0x2001,
- 0x001d, 0x001b, 0x0019, 0x0017, 0x2015, 0x2015, 0x2013, 0x2013
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_2[24] = {
- 0x0020, 0x0028, 0x0011, 0x000b, 0x0009, 0x0001, 0x200f, 0x200f,
- 0x200d, 0x200d, 0x2007, 0x2007, 0x2005, 0x2005, 0x2003, 0x2003,
- 0x001b, 0x0017, 0x2019, 0x2019, 0x2015, 0x2015, 0x2013, 0x2013
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_3[24] = {
- 0x0020, 0x0028, 0x0013, 0x000f, 0x0007, 0x0005, 0x2011, 0x2011,
- 0x200d, 0x200d, 0x200b, 0x200b, 0x2009, 0x2009, 0x2003, 0x2003,
- 0x2019, 0x2019, 0x2017, 0x2017, 0x2015, 0x2015, 0x2001, 0x2001
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_4[20] = {
- 0x0020, 0x0015, 0x0011, 0x0005, 0x0003, 0x0001, 0x200f, 0x200f,
- 0x200d, 0x200d, 0x200b, 0x200b, 0x2009, 0x2009, 0x2007, 0x2007,
- 0x2017, 0x2017, 0x2013, 0x2013
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_5[20] = {
- 0x0020, 0x0011, 0x2013, 0x2013, 0x200f, 0x200f, 0x200d, 0x200d,
- 0x200b, 0x200b, 0x2009, 0x2009, 0x2007, 0x2007, 0x2005, 0x2005,
- 0x0015, 0x0001, 0x2003, 0x2003
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_6[20] = {
- 0x0020, 0x000f, 0x2011, 0x2011, 0x200d, 0x200d, 0x2009, 0x2009,
- 0x2007, 0x2007, 0x2005, 0x2005, 0x400b, 0x400b, 0x400b, 0x400b,
- 0x0013, 0x0001, 0x2003, 0x2003
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_7[20] = {
- 0x0020, 0x0003, 0x200f, 0x200f, 0x200d, 0x200d, 0x2007, 0x2007,
- 0x400b, 0x400b, 0x400b, 0x400b, 0x4009, 0x4009, 0x4009, 0x4009,
- 0x0011, 0x0001, 0x2005, 0x2005
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_8[20] = {
- 0x0020, 0x0005, 0x200b, 0x200b, 0x400d, 0x400d, 0x400d, 0x400d,
- 0x4009, 0x4009, 0x4009, 0x4009, 0x4007, 0x4007, 0x4007, 0x4007,
- 0x0003, 0x0001, 0x200f, 0x200f
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_9[20] = {
- 0x0020, 0x000d, 0x2005, 0x2005, 0x400b, 0x400b, 0x400b, 0x400b,
- 0x4009, 0x4009, 0x4009, 0x4009, 0x4007, 0x4007, 0x4007, 0x4007,
- 0x2003, 0x2003, 0x2001, 0x2001
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_10[16] = {
- 0x0001, 0x0003, 0x2005, 0x2005, 0x2007, 0x2007, 0x200b, 0x200b,
- 0x6009, 0x6009, 0x6009, 0x6009, 0x6009, 0x6009, 0x6009, 0x6009
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_11[16] = {
- 0x0001, 0x0003, 0x2009, 0x2009, 0x4005, 0x4005, 0x4005, 0x4005,
- 0x6007, 0x6007, 0x6007, 0x6007, 0x6007, 0x6007, 0x6007, 0x6007
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_12[16] = {
- 0x2001, 0x2001, 0x2003, 0x2003, 0x4007, 0x4007, 0x4007, 0x4007,
- 0x6005, 0x6005, 0x6005, 0x6005, 0x6005, 0x6005, 0x6005, 0x6005
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_13[16] = {
- 0x4001, 0x4001, 0x4001, 0x4001, 0x4003, 0x4003, 0x4003, 0x4003,
- 0x6005, 0x6005, 0x6005, 0x6005, 0x6005, 0x6005, 0x6005, 0x6005
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_14[16] = {
- 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001,
- 0x6003, 0x6003, 0x6003, 0x6003, 0x6003, 0x6003, 0x6003, 0x6003
-};
-
-const OMX_U16 * armVCM4P10_CAVLCTotalZeroTables[15] = {
- armVCM4P10_CAVLCTotalZeroTables_0,
- armVCM4P10_CAVLCTotalZeroTables_1,
- armVCM4P10_CAVLCTotalZeroTables_2,
- armVCM4P10_CAVLCTotalZeroTables_3,
- armVCM4P10_CAVLCTotalZeroTables_4,
- armVCM4P10_CAVLCTotalZeroTables_5,
- armVCM4P10_CAVLCTotalZeroTables_6,
- armVCM4P10_CAVLCTotalZeroTables_7,
- armVCM4P10_CAVLCTotalZeroTables_8,
- armVCM4P10_CAVLCTotalZeroTables_9,
- armVCM4P10_CAVLCTotalZeroTables_10,
- armVCM4P10_CAVLCTotalZeroTables_11,
- armVCM4P10_CAVLCTotalZeroTables_12,
- armVCM4P10_CAVLCTotalZeroTables_13,
- armVCM4P10_CAVLCTotalZeroTables_14
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeros2x2Tables_0[16] = {
- 0x2007, 0x2007, 0x2005, 0x2005, 0x4003, 0x4003, 0x4003, 0x4003,
- 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeros2x2Tables_1[16] = {
- 0x4005, 0x4005, 0x4005, 0x4005, 0x4003, 0x4003, 0x4003, 0x4003,
- 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001
-};
-
-static const OMX_U16 armVCM4P10_CAVLCTotalZeros2x2Tables_2[16] = {
- 0x6003, 0x6003, 0x6003, 0x6003, 0x6003, 0x6003, 0x6003, 0x6003,
- 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001
-};
-
-const OMX_U16 * armVCM4P10_CAVLCTotalZeros2x2Tables[3] = {
- armVCM4P10_CAVLCTotalZeros2x2Tables_0,
- armVCM4P10_CAVLCTotalZeros2x2Tables_1,
- armVCM4P10_CAVLCTotalZeros2x2Tables_2
-};
-
-static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_0[8] = {
- 0x4003, 0x4003, 0x4003, 0x4003, 0x4001, 0x4001, 0x4001, 0x4001
-};
-
-static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_1[8] = {
- 0x2005, 0x2005, 0x2003, 0x2003, 0x4001, 0x4001, 0x4001, 0x4001
-};
-
-static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_2[8] = {
- 0x2007, 0x2007, 0x2005, 0x2005, 0x2003, 0x2003, 0x2001, 0x2001
-};
-
-static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_3[8] = {
- 0x0009, 0x0007, 0x2005, 0x2005, 0x2003, 0x2003, 0x2001, 0x2001
-};
-
-static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_4[8] = {
- 0x000b, 0x0009, 0x0007, 0x0005, 0x2003, 0x2003, 0x2001, 0x2001
-};
-
-static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_5[8] = {
- 0x0003, 0x0005, 0x0009, 0x0007, 0x000d, 0x000b, 0x2001, 0x2001
-};
-
-static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_6[24] = {
- 0x0010, 0x000d, 0x000b, 0x0009, 0x0007, 0x0005, 0x0003, 0x0001,
- 0x0018, 0x0011, 0x200f, 0x200f, 0x0020, 0x0015, 0x2013, 0x2013,
- 0x0028, 0x0019, 0x2017, 0x2017, 0x07ff, 0x001d, 0x201b, 0x201b
-};
-
-/* Tables 7 to 14 are duplicates of table 6 */
-
-const OMX_U16 * armVCM4P10_CAVLCRunBeforeTables[15] = {
- armVCM4P10_CAVLCRunBeforeTables_0, /* ZerosLeft=1 */
- armVCM4P10_CAVLCRunBeforeTables_1,
- armVCM4P10_CAVLCRunBeforeTables_2,
- armVCM4P10_CAVLCRunBeforeTables_3,
- armVCM4P10_CAVLCRunBeforeTables_4,
- armVCM4P10_CAVLCRunBeforeTables_5, /* ZerosLeft=6 */
- armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=7 */
- armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=8 */
- armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=9 */
- armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=10 */
- armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=11 */
- armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=12 */
- armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=13 */
- armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=14 */
- armVCM4P10_CAVLCRunBeforeTables_6 /* ZerosLeft=15 */
-};
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_DeblockingChroma_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_DeblockingChroma_unsafe_s.s
deleted file mode 100644
index e3813d3..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_DeblockingChroma_unsafe_s.s
+++ /dev/null
@@ -1,212 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_DeblockingChroma_unsafe_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS CortexA8
-
-
- IF CortexA8
-
-pAlpha RN 2
-pBeta RN 3
-
-pThresholds RN 5
-pBS RN 4
-bS3210 RN 6
-
-;// Pixels
-dP_0 DN D4.U8
-dP_1 DN D5.U8
-dP_2 DN D6.U8
-dP_3 DN D7.U8
-dQ_0 DN D8.U8
-dQ_1 DN D9.U8
-dQ_2 DN D10.U8
-dQ_3 DN D11.U8
-
-
-;// Filtering Decision
-dAlpha DN D0.U8
-dBeta DN D2.U8
-
-dFilt DN D16.U8
-dAqflg DN D12.U8
-dApflg DN D17.U8
-
-dAp0q0 DN D13.U8
-
-;// bSLT4
-dTC3210 DN D18.U8
-dTCs DN D31.S8
-dTC DN D31.U8
-
-dMask_0 DN D14.U8
-dMask_1 DN D15.U8
-dMask_4 DN D26.U16
-
-dTemp DN D28.U8
-dDummy DN D17.U8
-
-;// Computing P0,Q0
-qDq0p0 QN Q10.S16
-qDp1q1 QN Q11.S16
-qDelta QN Q10.S16 ; reuse qDq0p0
-dDelta DN D20.S8
-
-
-;// Computing P1,Q1
-qP_0n QN Q14.S16
-qQ_0n QN Q12.S16
-
-dQ_0n DN D24.U8
-dP_0n DN D29.U8
-
-;// bSGE4
-
-dHSp0q1 DN D13.U8
-dHSq0p1 DN D31.U8
-
-dBS3210 DN D28.U16
-
-dP_0t DN D13.U8 ;dHSp0q1
-dQ_0t DN D31.U8 ;Temp1
-
-dP_0n DN D29.U8
-dQ_0n DN D24.U8 ;Temp2
-
-;// Register usage for - armVCM4P10_DeblockingLumabSLT4_unsafe
-;//
-;// Inputs - Pixels - p0-p3: D4-D7, q0-q3: D8-D11
-;// - Filter masks - filt: D16, aqflg: D12, apflg: D17
-;// - Additional Params - pThresholds: r5
-;//
-;// Outputs - Pixels - P0-P1: D29-D30, Q0-Q1: D24-D25
-;// - Additional Params - pThresholds: r5
-
-;// Registers Corrupted - D18-D31
-
-
- M_START armVCM4P10_DeblockingChromabSLT4_unsafe
-
-
- ;dTC3210 -18
- ;dTemp-28
-
- VLD1 d18.U32[0], [pThresholds]! ;here
-
- ;// delta = (((q0-p0)<<2) + (p1-q1) + 4) >> 3;
- ;// dDelta = (qDp1q1 >> 2 + qDq0p0 + 1)>> 1
-
- ;// qDp1q1-11
- ;// qDq0p0-10
- VSUBL qDp1q1, dP_1, dQ_1
- VMOV dTemp, dTC3210
- VSUBL qDq0p0, dQ_0, dP_0
- VSHR qDp1q1, qDp1q1, #2
- VZIP.8 dTC3210, dTemp
-
- ;// qDelta-qDq0p0-10
-
- ;// dTC = dTC01 + (dAplg & 1) + (dAqflg & 1)
-
- ;// dTC3210-18
- ;// dTemp-28
- ;// dTC-31
- VBIF dTC3210, dMask_0, dFilt
- VRHADD qDelta, qDp1q1, qDq0p0
- VADD dTC, dTC3210, dMask_1
- VQMOVN dDelta, qDelta
- ;// dDelta-d20
-
- ;// dDelta = (OMX_U8)armClip(0, 255, q0 - delta);
- VLD1 {dAlpha[]}, [pAlpha]
- VMIN dDelta, dDelta, dTCs
- VNEG dTCs, dTCs
- VLD1 {dBeta[]}, [pBeta]
- ;1
- VMAX dDelta, dDelta, dTCs
-
- ;// dP_0n - 29
- ;// dQ_0n - 24
-
- ;// pQ0[-1*Step] = (OMX_U8)armClip(0, 255, dP_0 - delta);
- ;// pQ0[0*Step] = (OMX_U8)armClip(0, 255, dQ_0 - delta);
-
- ;// dP_0n = (OMX_U8)armClip(0, 255, dP_0 - dDelta);
- ;// dQ_0n = (OMX_U8)armClip(0, 255, dP_0 - dDelta);
-
- ;// qP_0n - 14
- ;// qQ_0n - 12
-
- VMOVL qP_0n, dP_0
- VMOVL qQ_0n, dQ_0
-
- ;1
- VADDW qP_0n, qP_0n, dDelta
- VSUBW qQ_0n, qQ_0n, dDelta
-
- VQMOVUN dP_0n, qP_0n
- VQMOVUN dQ_0n, qQ_0n
-
- M_END
-
-;// Register usage for - armVCM4P10_DeblockingLumabSGE4_unsafe()
-;//
-;// Inputs - Pixels - p0-p3: D4-D7, q0-q3: D8-D11
-;// - Filter masks - filt: D16, aqflg: D12, apflg: D17
-;// - Additional Params - alpha: D0, dMask_1: D15
-;//
-;// Outputs - Pixels - P0-P2: D29-D31, Q0-Q2: D24,D25,D28
-
-;// Registers Corrupted - D18-D31
-
- M_START armVCM4P10_DeblockingChromabSGE4_unsafe
-
- ;dHSq0p1 - 31
- ;dHSp0q1 - 13
- VHADD dHSp0q1, dP_0, dQ_1
- VHADD dHSq0p1, dQ_0, dP_1
-
- ;// Prepare the bS mask
-
- ;// dHSp0q1-13
- ;// dP_0t-dHSp0q1-13
- ;// dHSq0p1-31
- ;// dQ_0t-Temp1-31
- VLD1 {dAlpha[]}, [pAlpha]
- ADD pThresholds, pThresholds, #4
- VLD1 {dBeta[]}, [pBeta]
-
- VRHADD dP_0t, dHSp0q1, dP_1
- VRHADD dQ_0t, dHSq0p1, dQ_1
-
- M_END
-
- ENDIF
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_DeblockingLuma_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_DeblockingLuma_unsafe_s.s
deleted file mode 100644
index bcc01dd..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_DeblockingLuma_unsafe_s.s
+++ /dev/null
@@ -1,410 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_DeblockingLuma_unsafe_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS CortexA8
-
-
- IF CortexA8
-
-pThresholds RN 5
-
-;// Pixels
-dP_0 DN D4.U8
-dP_1 DN D5.U8
-dP_2 DN D6.U8
-dP_3 DN D7.U8
-dQ_0 DN D8.U8
-dQ_1 DN D9.U8
-dQ_2 DN D10.U8
-dQ_3 DN D11.U8
-
-
-;// Filtering Decision
-dAlpha DN D0.U8
-
-dFilt DN D16.U8
-dAqflg DN D12.U8
-dApflg DN D17.U8
-
-dAp0q0 DN D13.U8
-
-;// bSLT4
-dTC0 DN D18.U8
-dTC1 DN D19.U8
-dTC01 DN D18.U8
-
-dTCs DN D31.S8
-dTC DN D31.U8
-
-dMask_0 DN D14.U8
-dMask_1 DN D15.U8
-
-dTemp DN D19.U8
-
-;// Computing P0,Q0
-qDq0p0 QN Q10.S16
-qDp1q1 QN Q11.S16
-qDelta QN Q10.S16 ; reuse qDq0p0
-dDelta DN D20.S8
-
-
-;// Computing P1,Q1
-dRp0q0 DN D24.U8
-
-dMaxP DN D23.U8
-dMinP DN D22.U8
-
-dMaxQ DN D19.U8
-dMinQ DN D21.U8
-
-dDeltaP DN D26.U8
-dDeltaQ DN D27.U8
-
-qP_0n QN Q14.S16
-qQ_0n QN Q12.S16
-
-dQ_0n DN D24.U8
-dQ_1n DN D25.U8
-dP_0n DN D29.U8
-dP_1n DN D30.U8
-
-;// bSGE4
-
-qSp0q0 QN Q10.U16
-
-qSp2q1 QN Q11.U16
-qSp0q0p1 QN Q12.U16
-qSp3p2 QN Q13.U16
-dHSp0q1 DN D28.U8
-
-qSq2p1 QN Q11.U16
-qSp0q0q1 QN Q12.U16
-qSq3q2 QN Q13.U16 ;!!
-dHSq0p1 DN D28.U8 ;!!
-
-qTemp1 QN Q11.U16 ;!!;qSp2q1
-qTemp2 QN Q12.U16 ;!!;qSp0q0p1
-
-dP_0t DN D28.U8 ;!!;dHSp0q1
-dQ_0t DN D22.U8 ;!!;Temp1
-
-dP_0n DN D29.U8
-dP_1n DN D30.U8
-dP_2n DN D31.U8
-
-dQ_0n DN D24.U8 ;!!;Temp2
-dQ_1n DN D25.U8 ;!!;Temp2
-dQ_2n DN D28.U8 ;!!;dQ_0t
-
-;// Register usage for - armVCM4P10_DeblockingLumabSLT4_unsafe
-;//
-;// Inputs - Pixels - p0-p3: D4-D7, q0-q3: D8-D11
-;// - Filter masks - filt: D16, aqflg: D12, apflg: D17
-;// - Additional Params - pThresholds: r5
-;//
-;// Outputs - Pixels - P0-P1: D29-D30, Q0-Q1: D24-D25
-;// - Additional Params - pThresholds: r5
-
-;// Registers Corrupted - D18-D31
-
-
- M_START armVCM4P10_DeblockingLumabSLT4_unsafe
-
-
- ;// qDq0p0-10
- VSUBL qDp1q1, dP_1, dQ_1
- VLD1 {dTC0[]}, [pThresholds]!
- ;// qDp1q1-11
- VSUBL qDq0p0, dQ_0, dP_0
- VLD1 {dTC1[]}, [pThresholds]!
-
- ;// dRp0q0-24
- VSHR qDp1q1, qDp1q1, #2
-
- ;// dTC01 = (dTC1 << 4) | dTC0
- ;// dTC01-18
- VEXT dTC01, dTC0, dTC1, #4
- ;// dTemp-19
- VAND dTemp, dApflg, dMask_1
-
- VBIF dTC01, dMask_0, dFilt
-
-
- ;// delta = (((q0-p0)<<2) + (p1-q1) + 4) >> 3;
- ;// dDelta = (qDp1q1 >> 2 + qDq0p0 + 1)>> 1
-
- ;// qDelta-qDq0p0-10
- VRHADD qDelta, qDp1q1, qDq0p0
- VRHADD dRp0q0, dP_0, dQ_0
- VADD dTC, dTC01, dTemp
-
- ;// dTC = dTC01 + (dAplg & 1) + (dAqflg & 1)
-
- VAND dTemp, dAqflg, dMask_1
- VQADD dMaxP, dP_1, dTC01
- VQMOVN dDelta, qDelta
- VADD dTC, dTC, dTemp
-
- ;// dMaxP = QADD(dP_1, dTC01)
- ;// dMinP = QSUB(dP_1, dTC01)
-
- ;// dMaxP-d23
- ;// dMinP-d22
- VQSUB dMinP, dP_1, dTC01
-
- ;// dDelta-d20
-
- ;// dMaxQ = QADD(dQ_1, dTC01)
- ;// dMinQ = QSUB(dQ_1, dTC01)
-
- ;// dMaxQ-19
- ;// dMinQ-21
- VQADD dMaxQ, dQ_1, dTC01
- VHADD dDeltaP, dRp0q0, dP_2
- VMIN dDelta, dDelta, dTCs
-
- ;// dDelta = (OMX_U8)armClip(0, 255, q0 - delta);
- VNEG dTCs, dTCs
-
- VQSUB dMinQ, dQ_1, dTC01
-
- ;// delta = (p2 + ((p0+q0+1)>>1) - (p1<<1))>>1;
- ;// delta = armClip(-tC0, tC0, delta);
- ;// pQ0[-2*Step] = (OMX_U8)(p1 + delta);
-
- ;// dDeltaP = (dP_2 + dRp0q0)>>1;
- ;// dP_1n = armClip(dP_1 - dTC01, dP_1 + dTC01, dDeltaP);
- ;// dP_1n = armClip(MinP, MaxP, dDeltaP);
-
- ;// delta = (q2 + ((p0+q0+1)>>1) - (q1<<1))>>1;
- ;// delta = armClip(-tC0, tC0, delta);
- ;// pQ0[1*Step] = (OMX_U8)(q1 + delta);
-
- ;// dDeltaQ = (dQ_2 + dRp0q0)>>1;
- ;// dQ_1n = armClip(dQ_1 - dTC01, dQ_1 + dTC01, dDeltaQ);
- ;// dQ_1n = armClip(MinQ, MaxQ, dDeltaQ);
-
- ;// dDeltaP-26
- VHADD dDeltaQ, dRp0q0, dQ_2
-
- ;// dDeltaQ-27
-
- ;// dP_0n - 29
- ;// dP_1n - 30
- ;// dQ_0n - 24
- ;// dQ_1n - 25
-
- ;// delta = (q2 + ((p0+q0+1)>>1) - (q1<<1))>>1;
- ;// dDeltaQ = (dQ_2 + dRp0q0)>>1;
-
- VMAX dP_1n, dDeltaP, dMinP
- VMAX dDelta, dDelta, dTCs
-
- ;// pQ0[-1*Step] = (OMX_U8)armClip(0, 255, dP_0 - delta);
- ;// pQ0[0*Step] = (OMX_U8)armClip(0, 255, dQ_0 - delta);
-
- ;// dP_0n = (OMX_U8)armClip(0, 255, dP_0 - dDelta);
- ;// dQ_0n = (OMX_U8)armClip(0, 255, dP_0 - dDelta);
-
- ;// qP_0n - 14
- ;// qQ_0n - 12
-
- VMOVL qP_0n, dP_0
- VMOVL qQ_0n, dQ_0
-
- VADDW qP_0n, qP_0n, dDelta
- VSUBW qQ_0n, qQ_0n, dDelta
-
- VQMOVUN dP_0n, qP_0n
- VQMOVUN dQ_0n, qQ_0n
-
- VMAX dQ_1n, dDeltaQ, dMinQ
-
- VMIN dP_1n, dP_1n, dMaxP
- VMIN dQ_1n, dQ_1n, dMaxQ
- VBIF dP_0n, dP_0, dFilt
-
- VBIF dP_1n, dP_1, dApflg
- VBIF dQ_0n, dQ_0, dFilt
- VBIF dQ_1n, dQ_1, dAqflg
-
- M_END
-
-;// Register usage for - armVCM4P10_DeblockingLumabSGE4_unsafe()
-;//
-;// Inputs - Pixels - p0-p3: D4-D7, q0-q3: D8-D11
-;// - Filter masks - filt: D16, aqflg: D12, apflg: D17
-;// - Additional Params - alpha: D0, dMask_1: D15
-;//
-;// Outputs - Pixels - P0-P2: D29-D31, Q0-Q2: D24,D25,D28
-
-;// Registers Corrupted - D18-D31
-
- M_START armVCM4P10_DeblockingLumabSGE4_unsafe
-
-
- ;// ap<beta && armAbs(p0-q0)<((alpha>>2)+2)
- ;// aq<beta && armAbs(p0-q0)<((alpha>>2)+2)
-
- ;// ( dApflg & dAp0q0 < (dAlpha >> 2 + 2) )
- ;// ( dAqflg & dAp0q0 < (dAlpha >> 2 + 2) )
-
- ;// ( dApflg = dApflg & dAp0q0 < (dTemp + dMask_1 + dMask_1) )
- ;// ( dAqflg = dAqflg & dAp0q0 < (dTemp + dMask_1 + dMask_1) )
-
- ;// P Filter
-
- VSHR dTemp, dAlpha, #2
- VADD dTemp, dTemp, dMask_1
-
- ;// qSp0q0-10
- VADDL qSp0q0, dQ_0, dP_0
- VADD dTemp, dTemp, dMask_1
-
- ;// qSp2q1-11
- ;// qSp0q0p1-12
- VADDL qSp2q1, dP_2, dQ_1
- VADDW qSp0q0p1, qSp0q0, dP_1
-
- VCGT dTemp, dTemp, dAp0q0
- VSHR qSp2q1, #1
-
- ;// pQ0[-1*Step] = (OMX_U8)((p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4)>>3);
- ;// pQ0[-1*Step] = ( ( (p0 + q0 + p1) + (p2 + q1)>>1 ) >> 1 + 1 ) >> 1
-
- ;// dP_0n = ( ( (qSp0q0 + dP_1) + qSp2q1>>1 ) >> 1 + 1 ) >> 1
- ;// dP_0n = ( ( qSp0q0p1 + qSp2q1>>1 ) >> 1 + 1 ) >> 1
- ;// dP_0n = ( qTemp1 + 1 ) >> 1
-
- ;// pQ0[-2*Step] = (OMX_U8)((p2 + p1 + p0 + q0 + 2)>>2);
-
- ;// dP_1n = (OMX_U8)((dP_2 + qSp0q0p1 + 2)>>2);
- ;// dP_1n = (OMX_U8)((qTemp2 + 2)>>2);
-
- ;// pQ0[-3*Step] = (OMX_U8)((2*p3 + 3*p2 + p1 + p0 + q0 + 4)>>3);
- ;// pQ0[-3*Step] = (OMX_U8)(( (p3 + p2) + (p1 + p0 + q0 + p2) >> 1 + 2)>>2);
-
- ;// dP_2n = (OMX_U8)(( qSp3p2 + (dP_2 + qSp0q0p1) >> 1 + 2) >> 2);
- ;// dP_2n = (OMX_U8)(( qSp3p2 + qTemp2 >> 1 + 2) >> 2);
-
- ;// qTemp1-qSp2q1-11
- ;// qTemp2-qSp0q0p1-12
- VHADD qTemp1, qSp0q0p1, qSp2q1
- VADDW qTemp2, qSp0q0p1, dP_2
-
- ;// qSp3p2-13
- VADDL qSp3p2, dP_3, dP_2
-
- VAND dApflg, dApflg, dTemp
- VHADD dHSp0q1, dP_0, dQ_1
- VSRA qSp3p2, qTemp2, #1
- ;// dHSp0q1-28
- VAND dAqflg, dAqflg, dTemp
-
- ;// dP_0n-29
- ;// dP_0t-dHSp0q1-28
- VQRSHRN dP_0n, qTemp1, #1
- VRHADD dP_0t, dHSp0q1, dP_1
-
- ;// dP_1n-30
- VQRSHRN dP_1n, qTemp2, #2
-
- VADDL qSq2p1, dQ_2, dP_1
- VADDW qSp0q0q1, qSp0q0, dQ_1
-
- VBIF dP_0n, dP_0t, dApflg
-
- ;// Q Filter
-
- ;// pQ0[0*Step] = (OMX_U8)((q2 + 2*q1 + 2*q0 + 2*p0 + p1 + 4)>>3);
- ;// pQ0[0*Step] = ( ( (p0 + q0 + q1) + (q2 + p1)>>1 ) >> 1 + 1 ) >> 1
-
- ;// dQ_0n = ( ( (qSp0q0 + dQ_1) + qSq2p1>>1 ) >> 1 + 1 ) >> 1
- ;// dQ_0n = ( ( qSp0q0q1 + qSq2p1>>1 ) >> 1 + 1 ) >> 1
- ;// dQ_0n = ( qTemp1 + 1 ) >> 1
-
- ;// pQ0[1*Step] = (OMX_U8)((q2 + q1 + q0 + q0 + 2)>>2);
-
- ;// dQ_1n = (OMX_U8)((dQ_2 + qSp0q0q1 + 2)>>2);
- ;// dQ_1n = (OMX_U8)((qTemp2 + 2)>>2);
-
- ;// pQ0[2*Step] = (OMX_U8)((2*q3 + 3*q2 + q1 + q0 + p0 + 4)>>3);
- ;// pQ0[2*Step] = (OMX_U8)(( (q3 + q2) + (q1 + p0 + q0 + q2) >> 1 + 2)>>2);
-
- ;// dQ_2n = (OMX_U8)(( qSq3q2 + (dQ_2 + qSp0q0q1) >> 1 + 2) >> 2);
- ;// dQ_2n = (OMX_U8)(( qSq3q2 + qTemp2 >> 1 + 2) >> 2);
-
- ;// qTemp1-qSp2q1-11
- ;// qTemp2-qSp0q0p1-12
- ;// qSq2p1-11
- ;// qSp0q0q1-12
-
-
- ;// qTemp2-qSp0q0p1-12
- ;// qTemp1-qSq2p1-11
- ;// qSq3q2-13
- ;// dP_2n-31
-
- VQRSHRN dP_2n, qSp3p2, #2
- VADDL qSq3q2, dQ_3, dQ_2
-
- VSHR qSq2p1, #1
-
- VHADD qTemp1, qSp0q0q1, qSq2p1
- VADDW qTemp2, qSp0q0q1, dQ_2
-
- ;// dHSq0p1-28
- VHADD dHSq0p1, dQ_0, dP_1
-
- VBIF dP_0n, dP_0, dFilt
- VBIF dP_1n, dP_1, dApflg
-
- VSRA qSq3q2, qTemp2, #1
-
- ;// dQ_1-Temp2-25
- ;// dQ_0-Temp2-24
- VQRSHRN dQ_1n, qTemp2, #2
- VQRSHRN dQ_0n, qTemp1, #1
-
- ;// dQ_0t-Temp1-22
- VRHADD dQ_0t, dHSq0p1, dQ_1
- VBIF dQ_1n, dQ_1, dAqflg
-
- VBIF dP_2n, dP_2, dApflg
- VBIF dQ_0n, dQ_0t, dAqflg
- VQRSHRN dQ_2n, qSq3q2, #2
- VBIF dQ_0n, dQ_0, dFilt
- VBIF dQ_2n, dQ_2, dAqflg
-
- M_END
-
- ENDIF
-
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_DecodeCoeffsToPair_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_DecodeCoeffsToPair_s.s
deleted file mode 100644
index 6e3a0d5..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_DecodeCoeffsToPair_s.s
+++ /dev/null
@@ -1,339 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_DecodeCoeffsToPair_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
- INCLUDE armCOMM_BitDec_s.h
-
- IMPORT armVCM4P10_CAVLCCoeffTokenTables
- IMPORT armVCM4P10_CAVLCTotalZeroTables
- IMPORT armVCM4P10_CAVLCTotalZeros2x2Tables
- IMPORT armVCM4P10_CAVLCRunBeforeTables
- IMPORT armVCM4P10_SuffixToLevel
- IMPORT armVCM4P10_ZigZag_4x4
- IMPORT armVCM4P10_ZigZag_2x2
-
- M_VARIANTS ARM1136JS
-
-;//DEBUG_ON SETL {TRUE}
-
-LAST_COEFF EQU 0x20 ;// End of block flag
-TWO_BYTE_COEFF EQU 0x10
-
-;// Declare input registers
-
-ppBitStream RN 0
-pOffset RN 1
-pNumCoeff RN 2
-ppPosCoefbuf RN 3
-nC RN 4 ;// number of coeffs or 17 for chroma
-sMaxNumCoeff RN 5
-
-;// Declare inner loop registers
-
-;// Level loop
-Count RN 0
-TrailingOnes RN 1
-pLevel RN 2
-LevelSuffix RN 3
-SuffixLength RN 4
-TotalCoeff RN 5
-
-pVLDTable RN 6
-Symbol RN 7
-T1 RN 8
-T2 RN 9
-RBitStream RN 10
-RBitBuffer RN 11
-RBitCount RN 12
-lr RN 14
-
-;// Run loop
-Count RN 0
-ZerosLeft RN 1
-pLevel RN 2
-ppRunTable RN 3
-pRun RN 4
-TotalCoeff RN 5
-
-pVLDTable RN 6
-Symbol RN 7
-T1 RN 8
-T2 RN 9
-RBitStream RN 10
-RBitBuffer RN 11
-RBitCount RN 12
-lr RN 14
-
-;// Fill in coefficients loop
-pPosCoefbuf RN 0
-temp RN 1
-pLevel RN 2
-ppPosCoefbuf RN 3
-pRun RN 4
-TotalCoeff RN 5
-pZigZag RN 6
-
-T1 RN 8
-T2 RN 9
-RBitStream RN 10
-RBitBuffer RN 11
-RBitCount RN 12
-CoeffNum RN 14
-
-
-
- IF ARM1136JS
-
- ;// Allocate stack memory required by the function
- M_ALLOC4 pppBitStream, 4
- M_ALLOC4 ppOffset, 4
- M_ALLOC4 pppPosCoefbuf, 4
- M_ALLOC4 ppLevel, 16*2
- M_ALLOC4 ppRun, 16
-
- ;// Write function header
- M_START armVCM4P10_DecodeCoeffsToPair, r11
-
- ;// Define stack arguments
- M_ARG pNC, 4
- M_ARG pSMaxNumCoeff,4
-
- ;// Code start
- M_BD_INIT0 ppBitStream, pOffset, RBitStream, RBitBuffer, RBitCount
- LDR pVLDTable, =armVCM4P10_CAVLCCoeffTokenTables
- M_LDR nC, pNC
-
- M_BD_INIT1 T1, T2, lr
- LDR pVLDTable, [pVLDTable, nC, LSL #2] ;// Find VLD table
-
- M_BD_INIT2 T1, T2, lr
-
- ;// Decode Symbol = TotalCoeff*4 + TrailingOnes
- M_BD_VLD Symbol, T1, T2, pVLDTable, 4, 2
-
- MOVS TotalCoeff, Symbol, LSR #2
- STRB TotalCoeff, [pNumCoeff]
- M_PRINTF "TotalCoeff=%d\n", TotalCoeff
- BEQ.W EndNoError ;// Finished if no coefficients
-
- CMP Symbol, #17*4
- BGE.W EndBadSymbol ;// Error if bad symbol
-
- ;// Save bitstream pointers
- M_STR ppBitStream, pppBitStream
- M_STR pOffset, ppOffset
- M_STR ppPosCoefbuf, pppPosCoefbuf
-
- ;// Decode Trailing Ones
- ANDS TrailingOnes, Symbol, #3
- M_ADR pLevel, ppLevel
- M_PRINTF "TrailingOnes=%d\n", TrailingOnes
- BEQ TrailingOnesDone
- MOV Count, TrailingOnes
-TrailingOnesLoop
- M_BD_READ8 Symbol, 1, T1
- SUBS Count, Count, #1
- MOV T1, #1
- SUB T1, T1, Symbol, LSL #1
- M_PRINTF "Level=%d\n", T1
- STRH T1, [pLevel], #2
- BGT TrailingOnesLoop
-TrailingOnesDone
-
- ;// Decode level values
- SUBS Count, TotalCoeff, TrailingOnes ;// Number of levels to read
- BEQ DecodeRuns ;// None left
-
- MOV SuffixLength, #1
- CMP TotalCoeff, #10
- MOVLE SuffixLength, #0
- CMP TrailingOnes, #3 ;// if (TrailingOnes<3)
- MOVLT TrailingOnes, #4 ;// then TrailingOnes = +4
- MOVGE TrailingOnes, #2 ;// else TrailingOnes = +2
- MOVGE SuffixLength, #0 ;// SuffixLength = 0
-
-LevelLoop
- M_BD_CLZ16 Symbol, T1, T2 ;// Symbol=LevelPrefix
- CMP Symbol,#16
- BGE EndBadSymbol
-
- MOVS lr, SuffixLength ;// if LevelSuffixSize==0
- TEQEQ Symbol, #14 ;// and LevelPrefix==14
- MOVEQ lr, #4 ;// then LevelSuffixSize=4
- TEQ Symbol, #15 ;// if LevelSuffixSize==15
- MOVEQ lr, #12 ;// then LevelSuffixSize=12
-
- TEQEQ SuffixLength,#0
- ADDEQ Symbol,Symbol,#15
-
- TEQ lr, #0 ;// if LevelSuffixSize==0
- BEQ LevelCodeRead ;// LevelCode = LevelPrefix
-
- M_BD_VREAD16 LevelSuffix, lr, T1, T2 ;// Read Level Suffix
-
- MOV Symbol, Symbol, LSL SuffixLength
- ADD Symbol, LevelSuffix, Symbol
-
-LevelCodeRead
- ;// Symbol = LevelCode
- ADD Symbol, Symbol, TrailingOnes ;// +4 if level cannot be +/-1, +2 o/w
- MOV TrailingOnes, #2
- MOVS T1, Symbol, LSR #1
- RSBCS T1, T1, #0 ;// If Symbol odd then negate
- M_PRINTF "Level=%d\n", T1
- STRH T1, [pLevel], #2 ;// Store level.
-
- LDR T2, =armVCM4P10_SuffixToLevel
- LDRSB T1, [T2, SuffixLength] ;// Find increment level
- TEQ SuffixLength, #0
- MOVEQ SuffixLength, #1
- CMP Symbol, T1
- ADDCS SuffixLength, SuffixLength, #1
- SUBS Count, Count, #1
- BGT LevelLoop
-
-DecodeRuns
- ;// Find number of zeros
- M_LDR T1, pSMaxNumCoeff ;// sMaxNumCoeff
- SUB Count, TotalCoeff, #1 ;// Number of runs excluding last
- SUBS ZerosLeft, T1, TotalCoeff ;// Maximum number of zeros there could be
- M_ADR pRun, ppRun
- MOV CoeffNum,TotalCoeff
- SUB CoeffNum,CoeffNum,#1
- BEQ NoZerosLeft
-
- ;// Unpack number of zeros from bitstream
- TEQ T1, #4
- LDREQ pVLDTable, =(armVCM4P10_CAVLCTotalZeros2x2Tables-4)
- LDRNE pVLDTable, =(armVCM4P10_CAVLCTotalZeroTables-4)
- LDR pVLDTable, [pVLDTable, TotalCoeff, LSL #2]
-
- M_BD_VLD Symbol, T1, T2, pVLDTable, 4, 2 ;// Symbol = ZerosLeft
- CMP Symbol,#16
- BGE EndBadSymbol
-
- LDR ppRunTable, =(armVCM4P10_CAVLCRunBeforeTables-4)
- M_ADR pRun, ppRun
- MOVS ZerosLeft, Symbol
-
- ADD CoeffNum,CoeffNum,ZerosLeft
-
- BEQ NoZerosLeft
-
- ;// Decode runs while zeros are left and more than one coefficient
-RunLoop
- SUBS Count, Count, #1
- LDR pVLDTable, [ppRunTable, ZerosLeft, LSL#2]
- BLT LastRun
- M_BD_VLD Symbol, T1, T2, pVLDTable, 3, 2 ;// Symbol = Run
- CMP Symbol,#15
- BGE EndBadSymbol
-
- SUBS ZerosLeft, ZerosLeft, Symbol
- M_PRINTF "Run=%d\n", Symbol
- STRB Symbol, [pRun], #1
- BGT RunLoop
-
- ;// Decode runs while no zeros are left
-NoZerosLeft
- SUBS Count, Count, #1
- M_PRINTF "Run=%d\n", ZerosLeft
- STRGEB ZerosLeft, [pRun], #1
- BGT NoZerosLeft
-
-LastRun
- ;// Final run length is remaining zeros
- M_PRINTF "LastRun=%d\n", ZerosLeft
- STRB ZerosLeft, [pRun], #1
-
- ;// Write coefficients to output array
- M_LDR T1, pSMaxNumCoeff ;// sMaxNumCoeff
- TEQ T1, #15
- ADDEQ CoeffNum,CoeffNum,#1
-
-
- SUB pRun,pRun,TotalCoeff
- SUB pLevel,pLevel,TotalCoeff
- SUB pLevel,pLevel,TotalCoeff
-
- M_LDR ppPosCoefbuf, pppPosCoefbuf
- LDR pPosCoefbuf, [ppPosCoefbuf]
- TEQ T1, #4
- LDREQ pZigZag, =armVCM4P10_ZigZag_2x2
- LDRNE pZigZag, =armVCM4P10_ZigZag_4x4
-
-
-
-OutputLoop
-
- LDRB T2, [pRun],#1
- LDRB T1, [pZigZag, CoeffNum]
- SUB CoeffNum, CoeffNum, #1 ;// Skip Non zero
- SUB CoeffNum, CoeffNum, T2 ;// Skip Zero run
-
- LDRSH T2, [pLevel],#2
-
- SUBS TotalCoeff, TotalCoeff, #1
- ORREQ T1, T1, #LAST_COEFF
-
- ADD temp, T2, #128
- CMP temp, #256
- ORRCS T1, T1, #TWO_BYTE_COEFF
-
-
- TEQ TotalCoeff, #0 ;// Preserves carry
-
- M_PRINTF "Output=%02x %04x\n", T1, T2
- STRB T1, [pPosCoefbuf], #1
- STRB T2, [pPosCoefbuf], #1
- MOV T2, T2, LSR #8
- STRCSB T2, [pPosCoefbuf], #1
- BNE OutputLoop
-
- ;// Finished
- STR pPosCoefbuf, [ppPosCoefbuf]
- M_LDR ppBitStream, pppBitStream
- M_LDR pOffset, ppOffset
- B EndNoError
-
-EndBadSymbol
- MOV r0, #OMX_Sts_Err
- B End
-
-EndNoError
- ;// Finished reading from the bitstream
- M_BD_FINI ppBitStream, pOffset
-
- ;// Set return value
- MOV r0, #OMX_Sts_NoErr
-End
- M_END
-
- ENDIF
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_DequantTables_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_DequantTables_s.s
deleted file mode 100644
index dce8c89..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_DequantTables_s.s
+++ /dev/null
@@ -1,137 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_DequantTables_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- EXPORT armVCM4P10_QPDivTable
- EXPORT armVCM4P10_VMatrixQPModTable
- EXPORT armVCM4P10_PosToVCol4x4
- EXPORT armVCM4P10_PosToVCol2x2
- EXPORT armVCM4P10_VMatrix
- EXPORT armVCM4P10_QPModuloTable
- EXPORT armVCM4P10_VMatrixU16
-
-;// Define the processor variants supported by this file
-
- M_VARIANTS CortexA8
-
-
-;// Guarding implementation by the processor name
-
-
- IF CortexA8
-
-
- M_TABLE armVCM4P10_PosToVCol4x4
- DCB 0, 2, 0, 2
- DCB 2, 1, 2, 1
- DCB 0, 2, 0, 2
- DCB 2, 1, 2, 1
-
-
- M_TABLE armVCM4P10_PosToVCol2x2
- DCB 0, 2
- DCB 2, 1
-
-
- M_TABLE armVCM4P10_VMatrix
- DCB 10, 16, 13
- DCB 11, 18, 14
- DCB 13, 20, 16
- DCB 14, 23, 18
- DCB 16, 25, 20
- DCB 18, 29, 23
-
-;//-------------------------------------------------------
-;// This table evaluates the expression [(INT)(QP/6)],
-;// for values of QP from 0 to 51 (inclusive).
-;//-------------------------------------------------------
-
- M_TABLE armVCM4P10_QPDivTable
- DCB 0, 0, 0, 0, 0, 0
- DCB 1, 1, 1, 1, 1, 1
- DCB 2, 2, 2, 2, 2, 2
- DCB 3, 3, 3, 3, 3, 3
- DCB 4, 4, 4, 4, 4, 4
- DCB 5, 5, 5, 5, 5, 5
- DCB 6, 6, 6, 6, 6, 6
- DCB 7, 7, 7, 7, 7, 7
- DCB 8, 8, 8, 8, 8, 8
-
-;//----------------------------------------------------
-;// This table contains armVCM4P10_VMatrix[QP%6][0] entires,
-;// for values of QP from 0 to 51 (inclusive).
-;//----------------------------------------------------
-
- M_TABLE armVCM4P10_VMatrixQPModTable
- DCB 10, 11, 13, 14, 16, 18
- DCB 10, 11, 13, 14, 16, 18
- DCB 10, 11, 13, 14, 16, 18
- DCB 10, 11, 13, 14, 16, 18
- DCB 10, 11, 13, 14, 16, 18
- DCB 10, 11, 13, 14, 16, 18
- DCB 10, 11, 13, 14, 16, 18
- DCB 10, 11, 13, 14, 16, 18
- DCB 10, 11, 13, 14, 16, 18
-
-;//-------------------------------------------------------
-;// This table evaluates the modulus expression [QP%6]*6,
-;// for values of QP from 0 to 51 (inclusive).
-;//-------------------------------------------------------
-
- M_TABLE armVCM4P10_QPModuloTable
- DCB 0, 6, 12, 18, 24, 30
- DCB 0, 6, 12, 18, 24, 30
- DCB 0, 6, 12, 18, 24, 30
- DCB 0, 6, 12, 18, 24, 30
- DCB 0, 6, 12, 18, 24, 30
- DCB 0, 6, 12, 18, 24, 30
- DCB 0, 6, 12, 18, 24, 30
- DCB 0, 6, 12, 18, 24, 30
- DCB 0, 6, 12, 18, 24, 30
-
-;//-------------------------------------------------------
-;// This table contains the invidual byte values stored as
-;// halfwords. This avoids unpacking inside the function
-;//-------------------------------------------------------
-
- M_TABLE armVCM4P10_VMatrixU16
- DCW 10, 16, 13
- DCW 11, 18, 14
- DCW 13, 20, 16
- DCW 14, 23, 18
- DCW 16, 25, 20
- DCW 18, 29, 23
-
- ENDIF ;//ARM1136JS
-
-
-
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_Align_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_Align_unsafe_s.s
deleted file mode 100644
index 20b3e22..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_Align_unsafe_s.s
+++ /dev/null
@@ -1,250 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_InterpolateLuma_Align_unsafe_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
- EXPORT armVCM4P10_InterpolateLuma_HorAlign9x_unsafe
- EXPORT armVCM4P10_InterpolateLuma_VerAlign4x_unsafe
-
-DEBUG_ON SETL {FALSE}
-
- IF ARM1136JS
-
-;// Declare input registers
-pSrc RN 0
-srcStep RN 1
-pDst RN 8
-iHeight RN 9
-
-;// Declare inner loop registers
-x RN 7
-x0 RN 7
-x1 RN 10
-x2 RN 11
-Scratch RN 12
-
-;// Function:
-;// armVCM4P10_InterpolateLuma_HorAlign9x_unsafe
-;//
-;// Implements copy from an arbitrary aligned source memory location (pSrc) to a 4 byte aligned
-;// destination pointed by (pDst) for horizontal interpolation.
-;// This function needs to copy 9 bytes in horizontal direction.
-;//
-;// Registers used as input for this function
-;// r0,r1,r8,r9 where r8 containings aligned memory pointer and r9 no rows to copy
-;//
-;// Registers preserved for top level function
-;// r2,r3,r4,r5,r6
-;//
-;// Registers modified by the function
-;// r7,r8,r9,r10,r11,r12
-;//
-;// Output registers
-;// r0 - pointer to the new aligned location which will be used as pSrc
-;// r1 - step size to this aligned location
-
- ;// Function header
- M_START armVCM4P10_InterpolateLuma_HorAlign9x_unsafe
-
- ;// Copy pDst to scratch
- MOV Scratch, pDst
-
-StartAlignedStackCopy
- AND x, pSrc, #3
- BIC pSrc, pSrc, #3
-
- M_SWITCH x
- M_CASE Copy0toAligned
- M_CASE Copy1toAligned
- M_CASE Copy2toAligned
- M_CASE Copy3toAligned
- M_ENDSWITCH
-
-Copy0toAligned
- LDM pSrc, {x0, x1, x2}
- SUBS iHeight, iHeight, #1
- ADD pSrc, pSrc, srcStep
-
- ;// One cycle stall
-
- STM pDst!, {x0, x1, x2} ;// Store aligned output row
- BGT Copy0toAligned
- B CopyEnd
-
-Copy1toAligned
- LDM pSrc, {x0, x1, x2}
- SUBS iHeight, iHeight, #1
- ADD pSrc, pSrc, srcStep
-
- ;// One cycle stall
-
- MOV x0, x0, LSR #8
- ORR x0, x0, x1, LSL #24
- MOV x1, x1, LSR #8
- ORR x1, x1, x2, LSL #24
- MOV x2, x2, LSR #8
- STM pDst!, {x0, x1, x2} ;// Store aligned output row
- BGT Copy1toAligned
- B CopyEnd
-
-Copy2toAligned
- LDM pSrc, {x0, x1, x2}
- SUBS iHeight, iHeight, #1
- ADD pSrc, pSrc, srcStep
-
- ;// One cycle stall
-
- MOV x0, x0, LSR #16
- ORR x0, x0, x1, LSL #16
- MOV x1, x1, LSR #16
- ORR x1, x1, x2, LSL #16
- MOV x2, x2, LSR #16
- STM pDst!, {x0, x1, x2} ;// Store aligned output row
- BGT Copy2toAligned
- B CopyEnd
-
-Copy3toAligned
- LDM pSrc, {x0, x1, x2}
- SUBS iHeight, iHeight, #1
- ADD pSrc, pSrc, srcStep
-
- ;// One cycle stall
-
- MOV x0, x0, LSR #24
- ORR x0, x0, x1, LSL #8
- MOV x1, x1, LSR #24
- ORR x1, x1, x2, LSL #8
- MOV x2, x2, LSR #24
- STM pDst!, {x0, x1, x2} ;// Store aligned output row
- BGT Copy3toAligned
-
-CopyEnd
-
- MOV pSrc, Scratch
- MOV srcStep, #12
-
- M_END
-
-
-;// Function:
-;// armVCM4P10_InterpolateLuma_VerAlign4x_unsafe
-;//
-;// Implements copy from an arbitrary aligned source memory location (pSrc) to an aligned
-;// destination pointed by (pDst) for vertical interpolation.
-;// This function needs to copy 4 bytes in horizontal direction
-;//
-;// Registers used as input for this function
-;// r0,r1,r8,r9 where r8 containings aligned memory pointer and r9 no of rows to copy
-;//
-;// Registers preserved for top level function
-;// r2,r3,r4,r5,r6
-;//
-;// Registers modified by the function
-;// r7,r8,r9,r10,r11,r12
-;//
-;// Output registers
-;// r0 - pointer to the new aligned location which will be used as pSrc
-;// r1 - step size to this aligned location
-
- ;// Function header
- M_START armVCM4P10_InterpolateLuma_VerAlign4x_unsafe
-
- ;// Copy pSrc to stack
-StartVAlignedStackCopy
- AND x, pSrc, #3
- BIC pSrc, pSrc, #3
-
-
- M_SWITCH x
- M_CASE Copy0toVAligned
- M_CASE Copy1toVAligned
- M_CASE Copy2toVAligned
- M_CASE Copy3toVAligned
- M_ENDSWITCH
-
-Copy0toVAligned
- M_LDR x0, [pSrc], srcStep
- SUBS iHeight, iHeight, #1
-
- ;// One cycle stall
-
- STR x0, [pDst], #4 ;// Store aligned output row
- BGT Copy0toVAligned
- B CopyVEnd
-
-Copy1toVAligned
- LDR x1, [pSrc, #4]
- M_LDR x0, [pSrc], srcStep
- SUBS iHeight, iHeight, #1
-
- ;// One cycle stall
-
- MOV x1, x1, LSL #24
- ORR x0, x1, x0, LSR #8
- STR x0, [pDst], #4 ;// Store aligned output row
- BGT Copy1toVAligned
- B CopyVEnd
-
-Copy2toVAligned
- LDR x1, [pSrc, #4]
- M_LDR x0, [pSrc], srcStep
- SUBS iHeight, iHeight, #1
-
- ;// One cycle stall
-
- MOV x1, x1, LSL #16
- ORR x0, x1, x0, LSR #16
- STR x0, [pDst], #4 ;// Store aligned output row
- BGT Copy2toVAligned
- B CopyVEnd
-
-Copy3toVAligned
- LDR x1, [pSrc, #4]
- M_LDR x0, [pSrc], srcStep
- SUBS iHeight, iHeight, #1
-
- ;// One cycle stall
-
- MOV x1, x1, LSL #8
- ORR x0, x1, x0, LSR #24
- STR x0, [pDst], #4 ;// Store aligned output row
- BGT Copy3toVAligned
-
-CopyVEnd
-
- SUB pSrc, pDst, #28
- MOV srcStep, #4
-
- M_END
-
-
- ENDIF
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_Copy_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_Copy_unsafe_s.s
deleted file mode 100644
index 1415beb..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_Copy_unsafe_s.s
+++ /dev/null
@@ -1,163 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_InterpolateLuma_Copy_unsafe_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
-;// Function:
-;// armVCM4P10_InterpolateLuma_Copy4x4_unsafe
-;//
-;// Implements copy from an arbitrary aligned source memory location (pSrc) to an aligned
-;// destination pointed by (pDst)
-;//
-;// Registers preserved for top level function
-;// r1,r3,r4,r5,r6,r7,r10,r11,r14
-;//
-;// Registers modified by the function
-;// r0,r2,r8,r9,r12
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
- EXPORT armVCM4P10_InterpolateLuma_Copy4x4_unsafe
-
-;// Declare input registers
-pSrc RN 0
-srcStep RN 1
-pDst RN 2
-dstStep RN 3
-
-;// Declare other intermediate registers
-x0 RN 4
-x1 RN 5
-x2 RN 8
-x3 RN 9
-Temp RN 12
-
- IF ARM1136JS
-
- M_START armVCM4P10_InterpolateLuma_Copy4x4_unsafe, r6
-
-Copy4x4Start
- ;// Do Copy and branch to EndOfInterpolation
- AND Temp, pSrc, #3
- BIC pSrc, pSrc, #3
-
- M_SWITCH Temp
- M_CASE Copy4x4Align0
- M_CASE Copy4x4Align1
- M_CASE Copy4x4Align2
- M_CASE Copy4x4Align3
- M_ENDSWITCH
-
-Copy4x4Align0
- M_LDR x0, [pSrc], srcStep
- M_LDR x1, [pSrc], srcStep
- M_STR x0, [pDst], dstStep
- M_LDR x2, [pSrc], srcStep
- M_STR x1, [pDst], dstStep
- M_LDR x3, [pSrc], srcStep
- M_STR x2, [pDst], dstStep
- M_STR x3, [pDst], dstStep
- B Copy4x4End
-
-Copy4x4Align1
- LDR x1, [pSrc, #4]
- M_LDR x0, [pSrc], srcStep
- LDR x3, [pSrc, #4]
- M_LDR x2, [pSrc], srcStep
- MOV x0, x0, LSR #8
- ORR x0, x0, x1, LSL #24
- M_STR x0, [pDst], dstStep
- MOV x2, x2, LSR #8
- ORR x2, x2, x3, LSL #24
- LDR x1, [pSrc, #4]
- M_LDR x0, [pSrc], srcStep
- M_STR x2, [pDst], dstStep
- LDR x3, [pSrc, #4]
- M_LDR x2, [pSrc], srcStep
- MOV x0, x0, LSR #8
- ORR x0, x0, x1, LSL #24
- M_STR x0, [pDst], dstStep
- MOV x2, x2, LSR #8
- ORR x2, x2, x3, LSL #24
- M_STR x2, [pDst], dstStep
- B Copy4x4End
-
-Copy4x4Align2
- LDR x1, [pSrc, #4]
- M_LDR x0, [pSrc], srcStep
- LDR x3, [pSrc, #4]
- M_LDR x2, [pSrc], srcStep
- MOV x0, x0, LSR #16
- ORR x0, x0, x1, LSL #16
- M_STR x0, [pDst], dstStep
- MOV x2, x2, LSR #16
- ORR x2, x2, x3, LSL #16
- M_STR x2, [pDst], dstStep
-
- LDR x1, [pSrc, #4]
- M_LDR x0, [pSrc], srcStep
- LDR x3, [pSrc, #4]
- M_LDR x2, [pSrc], srcStep
- MOV x0, x0, LSR #16
- ORR x0, x0, x1, LSL #16
- M_STR x0, [pDst], dstStep
- MOV x2, x2, LSR #16
- ORR x2, x2, x3, LSL #16
- M_STR x2, [pDst], dstStep
- B Copy4x4End
-
-Copy4x4Align3
- LDR x1, [pSrc, #4]
- M_LDR x0, [pSrc], srcStep
- LDR x3, [pSrc, #4]
- M_LDR x2, [pSrc], srcStep
- MOV x0, x0, LSR #24
- ORR x0, x0, x1, LSL #8
- M_STR x0, [pDst], dstStep
- MOV x2, x2, LSR #24
- ORR x2, x2, x3, LSL #8
- M_STR x2, [pDst], dstStep
-
- LDR x1, [pSrc, #4]
- M_LDR x0, [pSrc], srcStep
- LDR x3, [pSrc, #4]
- M_LDR x2, [pSrc], srcStep
- MOV x0, x0, LSR #24
- ORR x0, x0, x1, LSL #8
- M_STR x0, [pDst], dstStep
- MOV x2, x2, LSR #24
- ORR x2, x2, x3, LSL #8
- M_STR x2, [pDst], dstStep
- B Copy4x4End
-
-Copy4x4End
- M_END
-
- ENDIF
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_DiagCopy_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_DiagCopy_unsafe_s.s
deleted file mode 100644
index f5a7326..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_DiagCopy_unsafe_s.s
+++ /dev/null
@@ -1,192 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_InterpolateLuma_DiagCopy_unsafe_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS ARM1136JS
-
- EXPORT armVCM4P10_InterpolateLuma_HorDiagCopy_unsafe
- EXPORT armVCM4P10_InterpolateLuma_VerDiagCopy_unsafe
-
-;// Functions:
-;// armVCM4P10_InterpolateLuma_HorDiagCopy_unsafe and
-;// armVCM4P10_InterpolateLuma_VerDiagCopy_unsafe
-;//
-;// Implements re-arrangement of data from temporary buffer to a buffer pointed by pBuf.
-;// This will do the convertion of data from 16 bit to 8 bit and it also
-;// remove offset and check for saturation.
-;//
-;// Registers used as input for this function
-;// r0,r1,r7 where r0 is input pointer and r2 its step size, r7 is output pointer
-;//
-;// Registers preserved for top level function
-;// r4,r5,r6,r8,r9,r14
-;//
-;// Registers modified by the function
-;// r7,r10,r11,r12
-;//
-;// Output registers
-;// r0 - pointer to the destination location
-;// r1 - step size to this destination location
-
-
-DEBUG_ON SETL {FALSE}
-
-MASK EQU 0x80808080 ;// Mask is used to implement (a+b+1)/2
-
-;// Declare input registers
-
-pSrc0 RN 0
-srcStep0 RN 1
-
-;// Declare other intermediate registers
-Temp1 RN 4
-Temp2 RN 5
-Temp3 RN 10
-Temp4 RN 11
-pBuf RN 7
-r0x0fe00fe0 RN 6
-r0x00ff00ff RN 12
-Count RN 14
-ValueA0 RN 10
-ValueA1 RN 11
-
- IF ARM1136JS
-
-
- ;// Function header
- M_START armVCM4P10_InterpolateLuma_HorDiagCopy_unsafe, r6
-
- ;// Code start
- MOV Count, #4
- LDR r0x0fe00fe0, =0x0fe00fe0
- LDR r0x00ff00ff, =0x00ff00ff
-LoopStart1
- LDR Temp4, [pSrc0, #12]
- LDR Temp3, [pSrc0, #8]
- LDR Temp2, [pSrc0, #4]
- M_LDR Temp1, [pSrc0], srcStep0
- UQSUB16 Temp4, Temp4, r0x0fe00fe0
- UQSUB16 Temp3, Temp3, r0x0fe00fe0
- UQSUB16 Temp2, Temp2, r0x0fe00fe0
- UQSUB16 Temp1, Temp1, r0x0fe00fe0
- USAT16 Temp4, #13, Temp4
- USAT16 Temp3, #13, Temp3
- USAT16 Temp2, #13, Temp2
- USAT16 Temp1, #13, Temp1
- AND Temp4, r0x00ff00ff, Temp4, LSR #5
- AND Temp3, r0x00ff00ff, Temp3, LSR #5
- AND Temp2, r0x00ff00ff, Temp2, LSR #5
- AND Temp1, r0x00ff00ff, Temp1, LSR #5
- ORR ValueA1, Temp3, Temp4, LSL #8
- ORR ValueA0, Temp1, Temp2, LSL #8
- SUBS Count, Count, #1
- STRD ValueA0, [pBuf], #8
- BGT LoopStart1
-End1
- SUB pSrc0, pBuf, #32
- MOV srcStep0, #8
-
- M_END
-
-
- ;// Function header
- M_START armVCM4P10_InterpolateLuma_VerDiagCopy_unsafe, r6
-
- ;// Code start
- LDR r0x0fe00fe0, =0x0fe00fe0
- LDR r0x00ff00ff, =0x00ff00ff
- MOV Count, #2
-
-LoopStart
- LDR Temp4, [pSrc0, #12]
- LDR Temp3, [pSrc0, #8]
- LDR Temp2, [pSrc0, #4]
- M_LDR Temp1, [pSrc0], srcStep0
-
- UQSUB16 Temp4, Temp4, r0x0fe00fe0
- UQSUB16 Temp3, Temp3, r0x0fe00fe0
- UQSUB16 Temp2, Temp2, r0x0fe00fe0
- UQSUB16 Temp1, Temp1, r0x0fe00fe0
-
- USAT16 Temp4, #13, Temp4
- USAT16 Temp3, #13, Temp3
- USAT16 Temp2, #13, Temp2
- USAT16 Temp1, #13, Temp1
-
- AND Temp4, r0x00ff00ff, Temp4, LSR #5
- AND Temp3, r0x00ff00ff, Temp3, LSR #5
- AND Temp2, r0x00ff00ff, Temp2, LSR #5
- AND Temp1, r0x00ff00ff, Temp1, LSR #5
- ORR ValueA1, Temp3, Temp4, LSL #8 ;// [d2 c2 d0 c0]
- ORR ValueA0, Temp1, Temp2, LSL #8 ;// [b2 a2 b0 a0]
-
- PKHBT Temp1, ValueA0, ValueA1, LSL #16 ;// [d0 c0 b0 a0]
-
- STR Temp1, [pBuf], #8
- PKHTB Temp2, ValueA1, ValueA0, ASR #16 ;// [d2 c2 b2 a2]
- STR Temp2, [pBuf], #-4
-
- LDR Temp4, [pSrc0, #12]
- LDR Temp3, [pSrc0, #8]
- LDR Temp2, [pSrc0, #4]
- M_LDR Temp1, [pSrc0], srcStep0
-
- UQSUB16 Temp4, Temp4, r0x0fe00fe0
- UQSUB16 Temp3, Temp3, r0x0fe00fe0
- UQSUB16 Temp2, Temp2, r0x0fe00fe0
- UQSUB16 Temp1, Temp1, r0x0fe00fe0
-
- USAT16 Temp4, #13, Temp4
- USAT16 Temp3, #13, Temp3
- USAT16 Temp2, #13, Temp2
- USAT16 Temp1, #13, Temp1
-
- AND Temp4, r0x00ff00ff, Temp4, LSR #5
- AND Temp3, r0x00ff00ff, Temp3, LSR #5
- AND Temp2, r0x00ff00ff, Temp2, LSR #5
- AND Temp1, r0x00ff00ff, Temp1, LSR #5
- ORR ValueA1, Temp3, Temp4, LSL #8 ;// [d2 c2 d0 c0]
- ORR ValueA0, Temp1, Temp2, LSL #8 ;// [b2 a2 b0 a0]
-
- PKHBT Temp1, ValueA0, ValueA1, LSL #16 ;// [d0 c0 b0 a0]
- SUBS Count, Count, #1
- STR Temp1, [pBuf], #8
- PKHTB Temp2, ValueA1, ValueA0, ASR #16 ;// [d2 c2 b2 a2]
- STR Temp2, [pBuf], #4
-
- BGT LoopStart
-End2
- SUB pSrc0, pBuf, #32-8
- MOV srcStep0, #4
-
- M_END
-
- ENDIF
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe_s.s
deleted file mode 100644
index 4d86782..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe_s.s
+++ /dev/null
@@ -1,327 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- EXPORT armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe
-
- M_VARIANTS CortexA8
-
- IF CortexA8
-
- M_START armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe, r11
-
-;// Declare input registers
-pSrc RN 0
-srcStep RN 1
-pDst RN 2
-dstStep RN 3
-
-;// Declare Neon registers
-dCoeff5 DN 30.S16
-dCoeff20 DN 31.S16
-qCoeff5 QN 14.S32
-qCoeff20 QN 15.S32
-
-qSrc01 QN 0.U8
-dSrc0 DN 0.U8
-dSrc1 DN 1.U8
-
-dSrcb DN 4.U8
-dSrcc DN 2.U8
-dSrcd DN 3.U8
-dSrce DN 5.U8
-dSrcf DN 1.U8
-
-qSrcb QN 2.S16
-qSrcc QN 1.S16
-dSrcB DN 4.S16
-dSrcC DN 2.S16
-
-qRes0 QN 5.S16
-qRes1 QN 6.S16
-qRes2 QN 7.S16
-qRes3 QN 8.S16
-qRes4 QN 9.S16
-qRes5 QN 10.S16
-qRes6 QN 11.S16
-qRes7 QN 12.S16
-qRes8 QN 13.S16
-
-dRes0 DN 10.S16
-dRes1 DN 12.S16
-dRes2 DN 14.S16
-dRes3 DN 16.S16
-dRes4 DN 18.S16
-dRes5 DN 20.S16
-dRes6 DN 22.S16
-dRes7 DN 24.S16
-dRes8 DN 26.S16
-
-qAcc01 QN 5.S32
-qAcc23 QN 6.S32
-qAcc45 QN 2.S32
-qAcc67 QN 3.S32
-qSumBE QN 0.S32
-qSumCD QN 1.S32
-
-dTempAcc0 DN 0.U16
-dTempAcc1 DN 2.U16
-dTempAcc2 DN 4.U16
-dTempAcc3 DN 6.U16
-
-qTAcc0 QN 0.U16
-qTAcc1 QN 1.U16
-qTAcc2 QN 2.U16
-qTAcc3 QN 3.U16
-
-dAcc0 DN 0.U8
-dAcc1 DN 2.U8
-dAcc2 DN 4.U8
-dAcc3 DN 6.U8
-
-dTmp0 DN 8.S16
-dTmp1 DN 9.S16
-qTmp0 QN 4.S32
-
- VLD1 qSrc01, [pSrc], srcStep ;// [a0 a1 a2 a3 ..]
- VMOV dCoeff20, #20
- VMOV dCoeff5, #5
-
- ;// Row0
- VEXT dSrcb, dSrc0, dSrc1, #1 ;// [b0 b1 b2 b3 ..]
- VEXT dSrcc, dSrc0, dSrc1, #2
- VEXT dSrcd, dSrc0, dSrc1, #3
- VEXT dSrce, dSrc0, dSrc1, #4
- VEXT dSrcf, dSrc0, dSrc1, #5 ;// [f0 f1 f2 f3 ..]
- VADDL qSrcc, dSrcc, dSrcd ;// c+d
- VADDL qSrcb, dSrcb, dSrce ;// b+e
- VADDL qRes0, dSrc0, dSrcf ;// Acc=a+f
- VLD1 qSrc01, [pSrc], srcStep ;// [a0 a1 a2 a3 ..]
- VMLA dRes0, dSrcC, dCoeff20 ;// Acc += 20*(c+d)
-; VMLS dRes0, dSrcB, dCoeff5 ;// Acc -= 5*(b+e)
- VMUL dTmp0, dSrcB, dCoeff5 ;// Acc -= 5*(b+e)
-
- ;// Row1
- VEXT dSrcb, dSrc0, dSrc1, #1 ;// [b0 b1 b2 b3 ..]
- VEXT dSrcc, dSrc0, dSrc1, #2
- VEXT dSrcd, dSrc0, dSrc1, #3
- VEXT dSrce, dSrc0, dSrc1, #4
- VEXT dSrcf, dSrc0, dSrc1, #5 ;// [f0 f1 f2 f3 ..]
- VADDL qSrcc, dSrcc, dSrcd ;// c+d
- VADDL qSrcb, dSrcb, dSrce ;// b+e
- VADDL qRes1, dSrc0, dSrcf ;// Acc=a+f
- VLD1 qSrc01, [pSrc], srcStep ;// [a0 a1 a2 a3 ..]
-
- VSUB dRes0, dRes0, dTmp0 ;// TeRi
-
- VMLA dRes1, dSrcC, dCoeff20 ;// Acc += 20*(c+d)
-; VMLS dRes1, dSrcB, dCoeff5 ;// Acc -= 5*(b+e)
- VMUL dTmp0, dSrcB, dCoeff5 ;// Acc -= 5*(b+e)
-
- ;// Row2
- VEXT dSrcb, dSrc0, dSrc1, #1 ;// [b0 b1 b2 b3 ..]
- VEXT dSrcc, dSrc0, dSrc1, #2
- VEXT dSrcd, dSrc0, dSrc1, #3
- VEXT dSrce, dSrc0, dSrc1, #4
- VEXT dSrcf, dSrc0, dSrc1, #5 ;// [f0 f1 f2 f3 ..]
- VADDL qSrcc, dSrcc, dSrcd ;// c+d
- VADDL qSrcb, dSrcb, dSrce ;// b+e
- VADDL qRes2, dSrc0, dSrcf ;// Acc=a+f
- VLD1 qSrc01, [pSrc], srcStep ;// [a0 a1 a2 a3 ..]
-
- VSUB dRes1, dRes1, dTmp0
-
- VMLA dRes2, dSrcC, dCoeff20 ;// Acc += 20*(c+d)
-; VMLS dRes2, dSrcB, dCoeff5 ;// Acc -= 5*(b+e)
- VMUL dTmp0, dSrcB, dCoeff5 ;// Acc -= 5*(b+e)
-
- ;// Row3
- VEXT dSrcb, dSrc0, dSrc1, #1 ;// [b0 b1 b2 b3 ..]
- VEXT dSrcc, dSrc0, dSrc1, #2
- VEXT dSrcd, dSrc0, dSrc1, #3
- VEXT dSrce, dSrc0, dSrc1, #4
- VEXT dSrcf, dSrc0, dSrc1, #5 ;// [f0 f1 f2 f3 ..]
- VADDL qSrcc, dSrcc, dSrcd ;// c+d
- VADDL qSrcb, dSrcb, dSrce ;// b+e
- VADDL qRes3, dSrc0, dSrcf ;// Acc=a+f
- VLD1 qSrc01, [pSrc], srcStep ;// [a0 a1 a2 a3 ..]
-
- VSUB dRes2, dRes2, dTmp0
-
- VMLA dRes3, dSrcC, dCoeff20 ;// Acc += 20*(c+d)
-; VMLS dRes3, dSrcB, dCoeff5 ;// Acc -= 5*(b+e)
- VMUL dTmp0, dSrcB, dCoeff5 ;// Acc -= 5*(b+e)
-
- ;// Row4
- VEXT dSrcb, dSrc0, dSrc1, #1 ;// [b0 b1 b2 b3 ..]
- VEXT dSrcc, dSrc0, dSrc1, #2
- VEXT dSrcd, dSrc0, dSrc1, #3
- VEXT dSrce, dSrc0, dSrc1, #4
- VEXT dSrcf, dSrc0, dSrc1, #5 ;// [f0 f1 f2 f3 ..]
- VADDL qSrcc, dSrcc, dSrcd ;// c+d
- VADDL qSrcb, dSrcb, dSrce ;// b+e
- VADDL qRes4, dSrc0, dSrcf ;// Acc=a+f
- VLD1 qSrc01, [pSrc], srcStep ;// [a0 a1 a2 a3 ..]
-
- VSUB dRes3, dRes3, dTmp0
-
- VMLA dRes4, dSrcC, dCoeff20 ;// Acc += 20*(c+d)
-; VMLS dRes4, dSrcB, dCoeff5 ;// Acc -= 5*(b+e)
- VMUL dTmp0, dSrcB, dCoeff5 ;// Acc -= 5*(b+e)
-
- ;// Row5
- VEXT dSrcb, dSrc0, dSrc1, #1 ;// [b0 b1 b2 b3 ..]
- VEXT dSrcc, dSrc0, dSrc1, #2
- VEXT dSrcd, dSrc0, dSrc1, #3
- VEXT dSrce, dSrc0, dSrc1, #4
- VEXT dSrcf, dSrc0, dSrc1, #5 ;// [f0 f1 f2 f3 ..]
- VADDL qSrcc, dSrcc, dSrcd ;// c+d
- VADDL qSrcb, dSrcb, dSrce ;// b+e
- VADDL qRes5, dSrc0, dSrcf ;// Acc=a+f
- VLD1 qSrc01, [pSrc], srcStep ;// [a0 a1 a2 a3 ..]
-
- VSUB dRes4, dRes4, dTmp0
-
- VMLA dRes5, dSrcC, dCoeff20 ;// Acc += 20*(c+d)
-; VMLS dRes5, dSrcB, dCoeff5 ;// Acc -= 5*(b+e)
- VMUL dTmp0, dSrcB, dCoeff5 ;// Acc -= 5*(b+e)
-
- ;// Row6
- VEXT dSrcb, dSrc0, dSrc1, #1 ;// [b0 b1 b2 b3 ..]
- VEXT dSrcc, dSrc0, dSrc1, #2
- VEXT dSrcd, dSrc0, dSrc1, #3
- VEXT dSrce, dSrc0, dSrc1, #4
- VEXT dSrcf, dSrc0, dSrc1, #5 ;// [f0 f1 f2 f3 ..]
- VADDL qSrcc, dSrcc, dSrcd ;// c+d
- VADDL qSrcb, dSrcb, dSrce ;// b+e
- VADDL qRes6, dSrc0, dSrcf ;// Acc=a+f
- VLD1 qSrc01, [pSrc], srcStep ;// [a0 a1 a2 a3 ..]
-
- VSUB dRes5, dRes5, dTmp0
-
- VMLA dRes6, dSrcC, dCoeff20 ;// Acc += 20*(c+d)
-; VMLS dRes6, dSrcB, dCoeff5 ;// Acc -= 5*(b+e)
- VMUL dTmp0, dSrcB, dCoeff5 ;// Acc -= 5*(b+e)
-
- ;// Row7
- VEXT dSrcb, dSrc0, dSrc1, #1 ;// [b0 b1 b2 b3 ..]
- VEXT dSrcc, dSrc0, dSrc1, #2
- VEXT dSrcd, dSrc0, dSrc1, #3
- VEXT dSrce, dSrc0, dSrc1, #4
- VEXT dSrcf, dSrc0, dSrc1, #5 ;// [f0 f1 f2 f3 ..]
- VADDL qSrcc, dSrcc, dSrcd ;// c+d
- VADDL qSrcb, dSrcb, dSrce ;// b+e
- VADDL qRes7, dSrc0, dSrcf ;// Acc=a+f
- VLD1 qSrc01, [pSrc], srcStep ;// [a0 a1 a2 a3 ..]
-
- VSUB dRes6, dRes6, dTmp0
-
- VMLA dRes7, dSrcC, dCoeff20 ;// Acc += 20*(c+d)
-; VMLS dRes7, dSrcB, dCoeff5 ;// Acc -= 5*(b+e)
- VMUL dTmp0, dSrcB, dCoeff5 ;// Acc -= 5*(b+e)
-
- ;// Row8
- VEXT dSrcb, dSrc0, dSrc1, #1 ;// [b0 b1 b2 b3 ..]
- VEXT dSrcc, dSrc0, dSrc1, #2
- VEXT dSrcd, dSrc0, dSrc1, #3
- VEXT dSrce, dSrc0, dSrc1, #4
- VEXT dSrcf, dSrc0, dSrc1, #5 ;// [f0 f1 f2 f3 ..]
- VADDL qSrcc, dSrcc, dSrcd ;// c+d
- VADDL qSrcb, dSrcb, dSrce ;// b+e
- VADDL qRes8, dSrc0, dSrcf ;// Acc=a+f
-
- VSUB dRes7, dRes7, dTmp0
-
- VMLA dRes8, dSrcC, dCoeff20 ;// Acc += 20*(c+d)
-; VMLS dRes8, dSrcB, dCoeff5 ;// Acc -= 5*(b+e)
- VMUL dTmp0, dSrcB, dCoeff5 ;// Acc -= 5*(b+e)
-
- VMOV qCoeff20, #20
- VMOV qCoeff5, #5
-
- ;// Col0
- VADDL qAcc01, dRes0, dRes5 ;// Acc = a+f
- VADDL qSumCD, dRes2, dRes3 ;// c+d
- VADDL qSumBE, dRes1, dRes4 ;// b+e
-
- VSUB dRes8, dRes8, dTmp0
-
- VMLA qAcc01, qSumCD, qCoeff20 ;// Acc += 20*(c+d)
-; VMLS qAcc01, qSumBE, qCoeff5 ;// Acc -= 20*(b+e)
- VMUL qTmp0, qSumBE, qCoeff5 ;// Acc -= 20*(b+e)
-
- ;// Col1
- VADDL qAcc23, dRes1, dRes6 ;// Acc = a+f
- VADDL qSumCD, dRes3, dRes4 ;// c+d
- VADDL qSumBE, dRes2, dRes5 ;// b+e
- VMLA qAcc23, qSumCD, qCoeff20 ;// Acc += 20*(c+d)
-
- VSUB qAcc01, qAcc01, qTmp0
-
-; VMLS qAcc23, qSumBE, qCoeff5 ;// Acc -= 20*(b+e)
- VMUL qTmp0, qSumBE, qCoeff5 ;// Acc -= 20*(b+e)
-
- ;// Col2
- VADDL qAcc45, dRes2, dRes7 ;// Acc = a+f
- VADDL qSumCD, dRes4, dRes5 ;// c+d
- VADDL qSumBE, dRes3, dRes6 ;// b+e
- VMLA qAcc45, qSumCD, qCoeff20 ;// Acc += 20*(c+d)
-
- VSUB qAcc23, qAcc23, qTmp0
-
-; VMLS qAcc45, qSumBE, qCoeff5 ;// Acc -= 20*(b+e)
- VMUL qTmp0, qSumBE, qCoeff5 ;// Acc -= 20*(b+e)
-
- ;// Col3
- VADDL qAcc67, dRes3, dRes8 ;// Acc = a+f
- VADDL qSumCD, dRes5, dRes6 ;// c+d
- VADDL qSumBE, dRes4, dRes7 ;// b+e
- VMLA qAcc67, qSumCD, qCoeff20 ;// Acc += 20*(c+d)
-
- VSUB qAcc45, qAcc45, qTmp0
-
- VMLS qAcc67, qSumBE, qCoeff5 ;// Acc -= 20*(b+e)
-
- VQRSHRUN dTempAcc0, qAcc01, #10
- VQRSHRUN dTempAcc1, qAcc23, #10
- VQRSHRUN dTempAcc2, qAcc45, #10
- VQRSHRUN dTempAcc3, qAcc67, #10
-
- VQMOVN dAcc0, qTAcc0
- VQMOVN dAcc1, qTAcc1
- VQMOVN dAcc2, qTAcc2
- VQMOVN dAcc3, qTAcc3
-
- M_END
-
- ENDIF
-
-
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe_s.s
deleted file mode 100644
index 3bc9534..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe_s.s
+++ /dev/null
@@ -1,280 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- EXPORT armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe
-
- M_VARIANTS CortexA8
-
- IF CortexA8
- M_START armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe, r11
-
-;// Declare input registers
-pSrc RN 0
-srcStep RN 1
-pDst RN 2
-dstStep RN 3
-
-;// Declare Neon registers
-dTCoeff5 DN 30.U8
-dTCoeff20 DN 31.U8
-dCoeff5 DN 30.S16
-dCoeff20 DN 31.S16
-
-qSrcA01 QN 0.U8
-qSrcB23 QN 1.U8
-qSrcC45 QN 2.U8
-qSrcD67 QN 3.U8
-qSrcE89 QN 4.U8
-qSrcF1011 QN 5.U8
-qSrcG1213 QN 6.U8
-qSrcH1415 QN 7.U8
-qSrcI1617 QN 8.U8
-
-dSrcA0 DN 0.U8
-dSrcB2 DN 2.U8
-dSrcC4 DN 4.U8
-dSrcD6 DN 6.U8
-dSrcE8 DN 8.U8
-dSrcF10 DN 10.U8
-dSrcG12 DN 12.U8
-dSrcH14 DN 14.U8
-dSrcI16 DN 16.U8
-
-dSrcA1 DN 1.U8
-dSrcB3 DN 3.U8
-dSrcC5 DN 5.U8
-dSrcD7 DN 7.U8
-dSrcE9 DN 9.U8
-dSrcF11 DN 11.U8
-dSrcG13 DN 13.U8
-dSrcH15 DN 15.U8
-dSrcI17 DN 17.U8
-
-qTempP01 QN 9.S16
-qTempQ01 QN 10.S16
-qTempR01 QN 11.S16
-qTempS01 QN 12.S16
-
-qTempP23 QN 0.S16
-qTempQ23 QN 1.S16
-qTempR23 QN 2.S16
-qTempS23 QN 3.S16
-
-dTempP0 DN 18.S16
-dTempP1 DN 19.S16
-dTempP2 DN 0.S16
-
-dTempQ0 DN 20.S16
-dTempQ1 DN 21.S16
-dTempQ2 DN 2.S16
-
-dTempR0 DN 22.S16
-dTempR1 DN 23.S16
-dTempR2 DN 4.S16
-
-dTempS0 DN 24.S16
-dTempS1 DN 25.S16
-dTempS2 DN 6.S16
-
-dTempB0 DN 26.S16
-dTempC0 DN 27.S16
-dTempD0 DN 28.S16
-dTempF0 DN 29.S16
-
-dTempAcc0 DN 0.U16
-dTempAcc1 DN 2.U16
-dTempAcc2 DN 4.U16
-dTempAcc3 DN 6.U16
-
-dAcc0 DN 0.U8
-dAcc1 DN 2.U8
-dAcc2 DN 4.U8
-dAcc3 DN 6.U8
-
-qAcc0 QN 0.S32
-qAcc1 QN 1.S32
-qAcc2 QN 2.S32
-qAcc3 QN 3.S32
-
-qTAcc0 QN 0.U16
-qTAcc1 QN 1.U16
-qTAcc2 QN 2.U16
-qTAcc3 QN 3.U16
-
-qTmp QN 4.S16
-dTmp DN 8.S16
-
- VLD1 qSrcA01, [pSrc], srcStep ;// [a0 a1 a2 a3 .. a15]
- ADD r12, pSrc, srcStep, LSL #2
- VMOV dTCoeff5, #5
- VMOV dTCoeff20, #20
- VLD1 qSrcF1011, [r12], srcStep
- VLD1 qSrcB23, [pSrc], srcStep ;// [b0 b1 b2 b3 .. b15]
-
- VLD1 qSrcG1213, [r12], srcStep
- VADDL qTempP01, dSrcA0, dSrcF10
- VLD1 qSrcC45, [pSrc], srcStep ;// [c0 c1 c2 c3 .. c15]
- VADDL qTempP23, dSrcA1, dSrcF11
- VLD1 qSrcD67, [pSrc], srcStep
- VADDL qTempQ01, dSrcB2, dSrcG12
- VLD1 qSrcE89, [pSrc], srcStep
-
- ;//t0
- VMLAL qTempP01, dSrcC4, dTCoeff20
-
- VLD1 qSrcH1415, [r12], srcStep
-
- VMLAL qTempP23, dSrcC5, dTCoeff20
-
- VLD1 qSrcI1617, [r12], srcStep ;// [i0 i1 i2 i3 .. ]
-
- VMLAL qTempP01, dSrcD6, dTCoeff20
- VMLAL qTempQ01, dSrcD6, dTCoeff20
- VMLSL qTempP23, dSrcB3, dTCoeff5
-
- VADDL qTempR01, dSrcC4, dSrcH14
-
- VMLSL qTempP01, dSrcB2, dTCoeff5
-
- VADDL qTempQ23, dSrcB3, dSrcG13
-
- VMLAL qTempP23, dSrcD7, dTCoeff20
- VMLAL qTempQ01, dSrcE8, dTCoeff20
-
- VMLSL qTempP01, dSrcE8, dTCoeff5
- VMLAL qTempQ23, dSrcD7, dTCoeff20
-
- VMLSL qTempP23, dSrcE9, dTCoeff5
-
- ;//t1
-
- VMLAL qTempR01, dSrcE8, dTCoeff20
- VMLSL qTempQ01, dSrcC4, dTCoeff5
- VMLSL qTempQ23, dSrcC5, dTCoeff5
- VADDL qTempR23, dSrcC5, dSrcH15
-
- VMLAL qTempR01, dSrcF10, dTCoeff20
- VMLSL qTempQ01, dSrcF10, dTCoeff5
- VMLAL qTempQ23, dSrcE9, dTCoeff20
- VMLAL qTempR23, dSrcE9, dTCoeff20
- VADDL qTempS01, dSrcD6, dSrcI16
-
-
- VMLSL qTempR01, dSrcD6, dTCoeff5
- VMLSL qTempQ23, dSrcF11, dTCoeff5
- VMLSL qTempR23, dSrcD7, dTCoeff5
-
- ;//t2
- VADDL qTempS23, dSrcD7, dSrcI17
- VMLAL qTempS01, dSrcF10, dTCoeff20
- VMLSL qTempR01, dSrcG12, dTCoeff5
- VMLSL qTempR23, dSrcG13, dTCoeff5
-
- VMLAL qTempS23, dSrcF11, dTCoeff20
- VMLAL qTempS01, dSrcG12, dTCoeff20
- VEXT dTempB0, dTempP0, dTempP1, #1
- VMLAL qTempR23, dSrcF11, dTCoeff20
-
-
- ;//t3
- VMLAL qTempS23, dSrcG13, dTCoeff20
- VMLSL qTempS01, dSrcE8, dTCoeff5
- VEXT dTempC0, dTempP0, dTempP1, #2
- VMOV dCoeff20, #20
- VMLSL qTempS23, dSrcE9, dTCoeff5
- VMLSL qTempS01, dSrcH14, dTCoeff5
- VEXT dTempF0, dTempP1, dTempP2, #1
- VEXT dTempD0, dTempP0, dTempP1, #3
- VMLSL qTempS23, dSrcH15, dTCoeff5
-
- VADDL qAcc0, dTempP0, dTempF0
- VADD dTempC0, dTempC0, dTempD0
- ;//h
- VMOV dCoeff5, #5
-
- ;// res0
- VADD dTempB0, dTempB0, dTempP1
- VMLAL qAcc0, dTempC0, dCoeff20
- VEXT dTempC0, dTempQ0, dTempQ1, #2
- VEXT dTempD0, dTempQ0, dTempQ1, #3
- VEXT dTempF0, dTempQ1, dTempQ2, #1
- VMLSL qAcc0, dTempB0, dCoeff5
-
- ;// res1
- VEXT dTempB0, dTempQ0, dTempQ1, #1
- VADDL qAcc1, dTempQ0, dTempF0
- VADD dTempC0, dTempC0, dTempD0
- VADD dTempB0, dTempB0, dTempQ1
- VEXT dTempD0, dTempR0, dTempR1, #3
- VMLAL qAcc1, dTempC0, dCoeff20
- VEXT dTempF0, dTempR1, dTempR2, #1
- VEXT dTempC0, dTempR0, dTempR1, #2
- VEXT dTmp, dTempR0, dTempR1, #1
- VADDL qAcc2, dTempR0, dTempF0
- VMLSL qAcc1, dTempB0, dCoeff5
-; VEXT dTempB0, dTempR0, dTempR1, #1
- VADD dTempC0, dTempC0, dTempD0
-
- ;// res2
- VADD dTempB0, dTmp, dTempR1
- VEXT dTempD0, dTempS0, dTempS1, #3
- VMLAL qAcc2, dTempC0, dCoeff20
-; VADD dTempB0, dTempB0, dTempR1
-
- ;// res3
- VEXT dTempC0, dTempS0, dTempS1, #2
- VEXT dTempF0, dTempS1, dTempS2, #1
- VADD dTempC0, dTempC0, dTempD0
- VEXT dTmp, dTempS0, dTempS1, #1
- VADDL qAcc3, dTempS0, dTempF0
- VMLSL qAcc2, dTempB0, dCoeff5
- VMLAL qAcc3, dTempC0, dCoeff20
- VADD dTmp, dTmp, dTempS1
- VMLSL qAcc3, dTmp, dCoeff5
-
- VQRSHRUN dTempAcc0, qAcc0, #10
- VQRSHRUN dTempAcc1, qAcc1, #10
- VQRSHRUN dTempAcc2, qAcc2, #10
- VQRSHRUN dTempAcc3, qAcc3, #10
-
- VQMOVN dAcc0, qTAcc0
- VQMOVN dAcc1, qTAcc1
- VQMOVN dAcc2, qTAcc2
- VQMOVN dAcc3, qTAcc3
-
- M_END
-
- ENDIF
-
-
-
-
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe_s.s
deleted file mode 100644
index ea1c345..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe_s.s
+++ /dev/null
@@ -1,242 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS CortexA8
-
- EXPORT armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
-
-DEBUG_ON SETL {FALSE}
-
- IF CortexA8
-
- M_START armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe, r11
-
-;// Declare input registers
-pSrc RN 0
-srcStep RN 1
-pDst RN 2
-dstStep RN 3
-
-;// Declare Neon registers
-dCoeff5 DN 30.S16
-dCoeff20 DN 31.S16
-
-qSrcA01 QN 11.U8
-qSrcB01 QN 12.U8
-qSrcC01 QN 13.U8
-qSrcD01 QN 14.U8
-
-dSrcA0 DN 22.U8
-dSrcA1 DN 23.U8
-dSrcB0 DN 24.U8
-dSrcB1 DN 25.U8
-dSrcC0 DN 26.U8
-dSrcC1 DN 27.U8
-dSrcD0 DN 28.U8
-dSrcD1 DN 29.U8
-
-dSrcb DN 12.U8
-dSrce DN 13.U8
-dSrcf DN 10.U8
-
-dSrc0c DN 14.U8
-dSrc1c DN 16.U8
-dSrc2c DN 18.U8
-dSrc3c DN 20.U8
-
-dSrc0d DN 15.U8
-dSrc1d DN 17.U8
-dSrc2d DN 19.U8
-dSrc3d DN 21.U8
-
-qTemp01 QN 4.S16
-qTemp23 QN 6.S16
-dTemp0 DN 8.S16
-dTemp2 DN 12.S16
-
-qRes01 QN 11.S16
-qRes23 QN 12.S16
-qRes45 QN 13.S16
-qRes67 QN 14.S16
-
-dRes0 DN 22.S16
-dRes2 DN 24.S16
-dRes4 DN 26.S16
-dRes6 DN 28.S16
-
-dAcc0 DN 22.U8
-dAcc2 DN 24.U8
-dAcc4 DN 26.U8
-dAcc6 DN 28.U8
-
-dResult0 DN 22.U32
-dResult2 DN 24.U32
-dResult4 DN 26.U32
-dResult6 DN 28.U32
-
- VLD1 qSrcA01, [pSrc], srcStep ;// Load A register [a0 a1 a2 a3 ..]
- ;// One cycle stall
- VEXT dSrcf, dSrcA0, dSrcA1, #5 ;// [f0 f1 f2 f3 ..]
- VEXT dSrcb, dSrcA0, dSrcA1, #1 ;// [b0 b1 b2 b3 ..]
-; VLD1 qSrcB01, [pSrc], srcStep ;// Load B register [a0 a1 a2 a3 ..]
- VEXT dSrc0c, dSrcA0, dSrcA1, #2
- VEXT dSrc0d, dSrcA0, dSrcA1, #3
- VEXT dSrce, dSrcA0, dSrcA1, #4
- VADDL qRes01, dSrcA0, dSrcf ;// Acc=a+f
- VADDL qTemp01, dSrc0c, dSrc0d ;// c+d
- VADDL qTemp23, dSrcb, dSrce ;// b+e
-
- VLD1 qSrcB01, [pSrc], srcStep ;// Load B register [a0 a1 a2 a3 ..]
-; VLD1 qSrcC01, [pSrc], srcStep ;// Load C register [a0 a1 a2 a3 ..]
- VMLA dRes0, dTemp0, dCoeff20 ;// Acc += 20*(c+d)
-; VMLS dRes0, dTemp2, dCoeff5 ;// Acc -= 5*(b+e)
- VMUL dTemp0, dTemp2, dCoeff5 ;// TeRi
-
- VEXT dSrcf, dSrcB0, dSrcB1, #5 ;// [f0 f1 f2 f3 ..]
- VEXT dSrcb, dSrcB0, dSrcB1, #1 ;// [b0 b1 b2 b3 ..]
- VEXT dSrc1c, dSrcB0, dSrcB1, #2
- VEXT dSrc1d, dSrcB0, dSrcB1, #3
- VEXT dSrce, dSrcB0, dSrcB1, #4
- VADDL qRes23, dSrcB0, dSrcf ;// Acc=a+f
-
- VSUB dRes0, dRes0, dTemp0 ;// TeRi
-
- VADDL qTemp01, dSrc1c, dSrc1d ;// c+d
- VADDL qTemp23, dSrcb, dSrce ;// b+e
-
- VLD1 qSrcC01, [pSrc], srcStep ;// Load C register [a0 a1 a2 a3 ..]
-; VLD1 qSrcD01, [pSrc], srcStep ;// Load D register [a0 a1 a2 a3 ..]
-
- VMLA dRes2, dTemp0, dCoeff20 ;// Acc += 20*(c+d)
-; VMLS dRes2, dTemp2, dCoeff5 ;// Acc -= 5*(b+e)
- VMUL dTemp0, dTemp2, dCoeff5 ;// TeRi
-
- VEXT dSrcf, dSrcC0, dSrcC1, #5 ;// [f0 f1 f2 f3 ..]
- VEXT dSrcb, dSrcC0, dSrcC1, #1 ;// [b0 b1 b2 b3 ..]
- VEXT dSrc2c, dSrcC0, dSrcC1, #2
- VEXT dSrc2d, dSrcC0, dSrcC1, #3
- VEXT dSrce, dSrcC0, dSrcC1, #4
- VADDL qRes45, dSrcC0, dSrcf ;// Acc=a+f
-
- VSUB dRes2, dRes2, dTemp0 ;// TeRi
-
- VADDL qTemp01, dSrc2c, dSrc2d ;// c+d
- VADDL qTemp23, dSrcb, dSrce ;// b+e
-
- VLD1 qSrcD01, [pSrc], srcStep ;// Load D register [a0 a1 a2 a3 ..]
-
- VMLA dRes4, dTemp0, dCoeff20 ;// Acc += 20*(c+d)
-; VMLS dRes4, dTemp2, dCoeff5 ;// Acc -= 5*(b+e)
- VMUL dTemp0, dTemp2, dCoeff5 ;// Acc -= 5*(b+e) TeRi
-
-
- VEXT dSrcf, dSrcD0, dSrcD1, #5 ;// [f0 f1 f2 f3 ..]
- VEXT dSrcb, dSrcD0, dSrcD1, #1 ;// [b0 b1 b2 b3 ..]
- VEXT dSrc3c, dSrcD0, dSrcD1, #2
- VEXT dSrc3d, dSrcD0, dSrcD1, #3
- VEXT dSrce, dSrcD0, dSrcD1, #4
- VADDL qRes67, dSrcD0, dSrcf ;// Acc=a+f
-
- VSUB dRes4, dRes4, dTemp0 ;// TeRi
-
- VADDL qTemp01, dSrc3c, dSrc3d ;// c+d
- VADDL qTemp23, dSrcb, dSrce ;// b+e
- VMLA dRes6, dTemp0, dCoeff20 ;// Acc += 20*(c+d)
- VMLS dRes6, dTemp2, dCoeff5 ;// Acc -= 5*(b+e)
-
- VQRSHRUN dAcc0, qRes01, #5 ;// Acc = Sat ((Acc + 16) / 32)
- VQRSHRUN dAcc2, qRes23, #5 ;// Acc = Sat ((Acc + 16) / 32)
- VQRSHRUN dAcc4, qRes45, #5 ;// Acc = Sat ((Acc + 16) / 32)
- VQRSHRUN dAcc6, qRes67, #5 ;// Acc = Sat ((Acc + 16) / 32)
-
- M_END
-
- ENDIF
-
-
- END
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe_s.s
deleted file mode 100644
index 5414d47..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe_s.s
+++ /dev/null
@@ -1,148 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS CortexA8
-
- EXPORT armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
-
- IF CortexA8
-
- M_START armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe, r11
-
-;// Declare input registers
-pSrc RN 0
-srcStep RN 1
-pDst RN 2
-dstStep RN 3
-
-Temp RN 12
-
-;// Declare Neon registers
-dCoeff5 DN 30.S16
-dCoeff20 DN 31.S16
-
-dSrc0 DN 7.U8
-dSrc1 DN 8.U8
-dSrc2 DN 9.U8
-dSrc3 DN 10.U8
-dSrc4 DN 11.U8
-dSrc5 DN 12.U8
-dSrc6 DN 13.U8
-dSrc7 DN 14.U8
-dSrc8 DN 15.U8
-
-qSumBE01 QN 8.S16
-qSumCD01 QN 9.S16
-dSumBE0 DN 16.S16
-dSumCD0 DN 18.S16
-
-qAcc01 QN 0.S16
-qAcc23 QN 1.S16
-qAcc45 QN 2.S16
-qAcc67 QN 3.S16
-
-dRes0 DN 0.S16
-dRes1 DN 2.S16
-dRes2 DN 4.S16
-dRes3 DN 6.S16
-
-dAcc0 DN 0.U8
-dAcc1 DN 2.U8
-dAcc2 DN 4.U8
-dAcc3 DN 6.U8
-
-
-dTmp0 DN 20.S16
-dTmp1 DN 21.S16
-dTmp2 DN 22.S16
-dTmp3 DN 23.S16
-
-
- VLD1 dSrc0, [pSrc], srcStep ;// [a0 a1 a2 a3 .. ]
- ADD Temp, pSrc, srcStep, LSL #2
- VLD1 dSrc1, [pSrc], srcStep ;// [b0 b1 b2 b3 .. ]
- ;// One cycle stall
- VLD1 dSrc5, [Temp], srcStep
- ;// One cycle stall
- VLD1 dSrc2, [pSrc], srcStep ;// [c0 c1 c2 c3 .. ]
- VADDL qAcc01, dSrc0, dSrc5 ;// Acc = a+f
- VLD1 dSrc3, [pSrc], srcStep
- ;// One cycle stall
- VLD1 dSrc6, [Temp], srcStep ;// TeRi
-
- VLD1 dSrc4, [pSrc], srcStep
- VLD1 dSrc7, [Temp], srcStep ;// TeRi
- VADDL qSumBE01, dSrc1, dSrc4 ;// b+e
- VADDL qSumCD01, dSrc2, dSrc3 ;// c+d
- VLD1 dSrc8, [Temp], srcStep ;// TeRi
- VMLS dRes0, dSumBE0, dCoeff5 ;// Acc -= 20*(b+e)
-; VMLA dRes0, dSumCD0, dCoeff20 ;// Acc += 20*(c+d)
- VMUL dTmp0, dSumCD0, dCoeff20 ;// Acc += 20*(c+d)
-
-; VLD1 dSrc6, [Temp], srcStep
- VADDL qSumBE01, dSrc2, dSrc5 ;// b+e
- VADDL qSumCD01, dSrc3, dSrc4 ;// c+d
- VADDL qAcc23, dSrc1, dSrc6 ;// Acc = a+f
- VMLS dRes1, dSumBE0, dCoeff5 ;// Acc -= 20*(b+e)
-; VMLA dRes1, dSumCD0, dCoeff20 ;// Acc += 20*(c+d)
- VMUL dTmp1, dSumCD0, dCoeff20 ;// Acc += 20*(c+d)
-
-; VLD1 dSrc7, [Temp], srcStep
- VADDL qSumBE01, dSrc3, dSrc6 ;// b+e
- VADDL qSumCD01, dSrc4, dSrc5 ;// c+d
- VADDL qAcc45, dSrc2, dSrc7 ;// Acc = a+f
- VMLS dRes2, dSumBE0, dCoeff5 ;// Acc -= 20*(b+e)
-; VMLA dRes2, dSumCD0, dCoeff20 ;// Acc += 20*(c+d)
- VMUL dTmp2, dSumCD0, dCoeff20 ;// Acc += 20*(c+d)
-
-; VLD1 dSrc8, [Temp], srcStep ;// [i0 i1 i2 i3 .. ]
- VADDL qSumBE01, dSrc4, dSrc7 ;// b+e
- VADDL qAcc67, dSrc3, dSrc8 ;// Acc = a+f
- VADDL qSumCD01, dSrc5, dSrc6 ;// c+d
- VMLS dRes3, dSumBE0, dCoeff5 ;// Acc -= 20*(b+e)
- VADD dRes0, dRes0, dTmp0
- VADD dRes1, dRes1, dTmp1
- VADD dRes2, dRes2, dTmp2
- VMLA dRes3, dSumCD0, dCoeff20 ;// Acc += 20*(c+d)
-; VMUL dTmp3, dSumCD0, dCoeff20 ;// Acc += 20*(c+d)
-; VADD dRes3, dRes3, dTmp3
-
- VQRSHRUN dAcc0, qAcc01, #5
- VQRSHRUN dAcc1, qAcc23, #5
- VQRSHRUN dAcc2, qAcc45, #5
- VQRSHRUN dAcc3, qAcc67, #5
-
- M_END
-
- ENDIF
-
-
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_Interpolate_Chroma_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_Interpolate_Chroma_s.s
deleted file mode 100644
index afb9565..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_Interpolate_Chroma_s.s
+++ /dev/null
@@ -1,332 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_Interpolate_Chroma_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 9641
-;// Date: Thursday, February 7, 2008
-;//
-;//
-;//
-;//
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS CortexA8
-
-
- IF CortexA8
-
- M_TABLE armVCM4P10_WidthBranchTableMVIsNotZero
-
- DCD WidthIs2MVIsNotZero, WidthIs2MVIsNotZero
- DCD WidthIs4MVIsNotZero, WidthIs4MVIsNotZero
- DCD WidthIs8MVIsNotZero
-
- M_TABLE armVCM4P10_WidthBranchTableMVIsZero
-
- DCD WidthIs2MVIsZero, WidthIs2MVIsZero
- DCD WidthIs4MVIsZero, WidthIs4MVIsZero
- DCD WidthIs8MVIsZero
-
-
-;// input registers
-
-pSrc RN 0
-iSrcStep RN 1
-pDst RN 2
-iDstStep RN 3
-iWidth RN 4
-iHeight RN 5
-dx RN 6
-dy RN 7
-
-;// local variable registers
-pc RN 15
-return RN 0
-EightMinusdx RN 8
-EightMinusdy RN 9
-
-ACoeff RN 12
-BCoeff RN 9
-CCoeff RN 8
-DCoeff RN 6
-
-pTable RN 11
-
-Step1 RN 10
-SrcStepMinus1 RN 14
-
-dACoeff DN D12.U8
-dBCoeff DN D13.U8
-dCCoeff DN D14.U8
-dDCoeff DN D15.U8
-
-dRow0a DN D0.U8
-dRow0b DN D1.U8
-dRow1a DN D2.U8
-dRow1b DN D3.U8
-
-qRow0a QN Q2.S16
-qRow0b QN Q3.S16
-
-;//dIndex DN D16.U8
-qRow1a QN Q11.S16
-qRow1b QN Q12.S16
-
-dRow2a DN D16.U8
-dRow2b DN D17.U8
-dRow3a DN D18.U8
-dRow3b DN D19.U8
-
-qOutRow2 QN Q11.U16
-qOutRow3 QN Q12.U16
-dOutRow2 DN D20.U8
-dOutRow3 DN D21.U8
-dOutRow2U64 DN D20.U64
-dOutRow3U64 DN D21.U64
-
-qOutRow0 QN Q2.U16
-qOutRow1 QN Q3.U16
-dOutRow0 DN D8.U8
-dOutRow1 DN D9.U8
-
-dOutRow0U64 DN D8.U64
-dOutRow1U64 DN D9.U64
-
-dOutRow0U32 DN D8.U32
-dOutRow1U32 DN D9.U32
-
-dOutRow0U16 DN D8.U16
-dOutRow1U16 DN D9.U16
-
-
-dOut0U64 DN D0.U64
-dOut1U64 DN D1.U64
-
-dOut00U32 DN D0.U32
-dOut01U32 DN D1.U32
-dOut10U32 DN D2.U32
-dOut11U32 DN D3.U32
-
-dOut0U16 DN D0.U16
-dOut1U16 DN D1.U16
-
-;//-----------------------------------------------------------------------------------------------
-;// armVCM4P10_Interpolate_Chroma_asm starts
-;//-----------------------------------------------------------------------------------------------
-
- ;// Write function header
- M_START armVCM4P10_Interpolate_Chroma, r11, d15
-
- ;// Define stack arguments
- M_ARG Width, 4
- M_ARG Height, 4
- M_ARG Dx, 4
- M_ARG Dy, 4
-
- ;// Load argument from the stack
- ;// M_STALL ARM1136JS=4
-
- M_LDRD dx, dy, Dx
- M_LDRD iWidth, iHeight, Width
-
- ;// EightMinusdx = 8 - dx
- ;// EightMinusdy = 8 - dy
-
- ;// ACoeff = EightMinusdx * EightMinusdy
- ;// BCoeff = dx * EightMinusdy
- ;// CCoeff = EightMinusdx * dy
- ;// DCoeff = dx * dy
-
- RSB EightMinusdx, dx, #8
- RSB EightMinusdy, dy, #8
- CMN dx,dy
- MOV Step1, #1
- LDREQ pTable, =armVCM4P10_WidthBranchTableMVIsZero
- SUB SrcStepMinus1, iSrcStep, Step1
- LDRNE pTable, =armVCM4P10_WidthBranchTableMVIsNotZero
-
- VLD1 dRow0a, [pSrc], Step1 ;// 0a
-
- SMULBB ACoeff, EightMinusdx, EightMinusdy
- SMULBB BCoeff, dx, EightMinusdy
- VLD1 dRow0b, [pSrc], SrcStepMinus1 ;// 0b
- SMULBB CCoeff, EightMinusdx, dy
- SMULBB DCoeff, dx, dy
-
- VDUP dACoeff, ACoeff
- VDUP dBCoeff, BCoeff
- VDUP dCCoeff, CCoeff
- VDUP dDCoeff, DCoeff
-
- LDR pc, [pTable, iWidth, LSL #1] ;// Branch to the case based on iWidth
-
-;// Pixel layout:
-;//
-;// x00 x01 x02
-;// x10 x11 x12
-;// x20 x21 x22
-
-;// If fractionl mv is not (0, 0)
-WidthIs8MVIsNotZero
-
- VLD1 dRow1a, [pSrc], Step1 ;// 1a
- VMULL qRow0a, dRow0a, dACoeff
- VLD1 dRow1b, [pSrc], SrcStepMinus1 ;// 1b
- VMULL qRow0b, dRow1a, dACoeff
- VLD1 dRow2a, [pSrc], Step1 ;// 2a
- VMLAL qRow0a, dRow0b, dBCoeff
- VLD1 dRow2b, [pSrc], SrcStepMinus1 ;// 2b
- VMULL qRow1a, dRow2a, dACoeff
- VMLAL qRow0b, dRow1b, dBCoeff
- VLD1 dRow3a, [pSrc], Step1 ;// 3a
- VMLAL qRow0a, dRow1a, dCCoeff
- VMLAL qRow1a, dRow2b, dBCoeff
- VMULL qRow1b, dRow3a, dACoeff
- VLD1 dRow3b, [pSrc], SrcStepMinus1 ;// 3b
- VMLAL qRow0b, dRow2a, dCCoeff
- VLD1 dRow0a, [pSrc], Step1 ;// 0a
- VMLAL qRow1b, dRow3b, dBCoeff
- VMLAL qRow1a, dRow3a, dCCoeff
- VMLAL qRow0a, dRow1b, dDCoeff
- VLD1 dRow0b, [pSrc], SrcStepMinus1 ;// 0b
- VMLAL qRow1b, dRow0a, dCCoeff
- VMLAL qRow0b, dRow2b, dDCoeff
- VMLAL qRow1a, dRow3b, dDCoeff
-
-
- SUBS iHeight, iHeight, #4
- VMLAL qRow1b, dRow0b, dDCoeff
-
- VQRSHRN dOutRow0, qOutRow0, #6
- VQRSHRN dOutRow1, qOutRow1, #6
- VQRSHRN dOutRow2, qOutRow2, #6
- VST1 dOutRow0U64, [pDst], iDstStep
- VQRSHRN dOutRow3, qOutRow3, #6
-
- VST1 dOutRow1U64, [pDst], iDstStep
- VST1 dOutRow2U64, [pDst], iDstStep
- VST1 dOutRow3U64, [pDst], iDstStep
-
-
- BGT WidthIs8MVIsNotZero
- MOV return, #OMX_Sts_NoErr
- M_EXIT
-
-WidthIs4MVIsNotZero
-
- VLD1 dRow1a, [pSrc], Step1
- VMULL qRow0a, dRow0a, dACoeff
- VMULL qRow0b, dRow1a, dACoeff
- VLD1 dRow1b, [pSrc], SrcStepMinus1
- VMLAL qRow0a, dRow0b, dBCoeff
- VMLAL qRow0b, dRow1b, dBCoeff
- VLD1 dRow0a, [pSrc], Step1
- VMLAL qRow0a, dRow1a, dCCoeff
- VMLAL qRow0b, dRow0a, dCCoeff
- VLD1 dRow0b, [pSrc], SrcStepMinus1
- SUBS iHeight, iHeight, #2
- VMLAL qRow0b, dRow0b, dDCoeff
- VMLAL qRow0a, dRow1b, dDCoeff
-
- VQRSHRN dOutRow1, qOutRow1, #6
- VQRSHRN dOutRow0, qOutRow0, #6
-
- VST1 dOutRow0U32[0], [pDst], iDstStep
- VST1 dOutRow1U32[0], [pDst], iDstStep
-
- BGT WidthIs4MVIsNotZero
- MOV return, #OMX_Sts_NoErr
- M_EXIT
-
-WidthIs2MVIsNotZero
-
- VLD1 dRow1a, [pSrc], Step1
- VMULL qRow0a, dRow0a, dACoeff
- VMULL qRow0b, dRow1a, dACoeff
- VLD1 dRow1b, [pSrc], SrcStepMinus1
- VMLAL qRow0a, dRow0b, dBCoeff
- VMLAL qRow0b, dRow1b, dBCoeff
- VLD1 dRow0a, [pSrc], Step1
- VMLAL qRow0a, dRow1a, dCCoeff
- VMLAL qRow0b, dRow0a, dCCoeff
- VLD1 dRow0b, [pSrc], SrcStepMinus1
- SUBS iHeight, iHeight, #2
- VMLAL qRow0b, dRow0b, dDCoeff
- VMLAL qRow0a, dRow1b, dDCoeff
-
- VQRSHRN dOutRow1, qOutRow1, #6
- VQRSHRN dOutRow0, qOutRow0, #6
-
- VST1 dOutRow0U16[0], [pDst], iDstStep
- VST1 dOutRow1U16[0], [pDst], iDstStep
-
- BGT WidthIs2MVIsNotZero
- MOV return, #OMX_Sts_NoErr
- M_EXIT
-
-;// If fractionl mv is (0, 0)
-WidthIs8MVIsZero
- SUB pSrc, pSrc, iSrcStep
-
-WidthIs8LoopMVIsZero
- VLD1 dRow0a, [pSrc], iSrcStep
- SUBS iHeight, iHeight, #2
- VLD1 dRow0b, [pSrc], iSrcStep
- VST1 dOut0U64, [pDst], iDstStep
- VST1 dOut1U64, [pDst], iDstStep
- BGT WidthIs8LoopMVIsZero
-
- MOV return, #OMX_Sts_NoErr
- M_EXIT
-
-WidthIs4MVIsZero
- VLD1 dRow0b, [pSrc], iSrcStep
-
- SUBS iHeight, iHeight, #2
-
- VST1 dOut00U32[0], [pDst], iDstStep
- VLD1 dRow0a, [pSrc], iSrcStep
- VST1 dOut01U32[0], [pDst], iDstStep
-
- BGT WidthIs4MVIsZero
- MOV return, #OMX_Sts_NoErr
- M_EXIT
-
-WidthIs2MVIsZero
- VLD1 dRow0b, [pSrc], iSrcStep
- SUBS iHeight, iHeight, #2
-
- VST1 dOut0U16[0], [pDst], iDstStep
- VLD1 dRow0a, [pSrc], iSrcStep
- VST1 dOut1U16[0], [pDst], iDstStep
-
- BGT WidthIs2MVIsZero
- MOV return, #OMX_Sts_NoErr
- M_END
-
- ENDIF ;// CortexA8
-
- END
-
-;//-----------------------------------------------------------------------------------------------
-;// armVCM4P10_Interpolate_Chroma_asm ends
-;//-----------------------------------------------------------------------------------------------
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_QuantTables_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_QuantTables_s.s
deleted file mode 100644
index 8cd33a4..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_QuantTables_s.s
+++ /dev/null
@@ -1,88 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_QuantTables_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;// Description:
-;// This file contains quantization tables
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
-
- EXPORT armVCM4P10_MFMatrixQPModTable
- EXPORT armVCM4P10_QPDivIntraTable
- EXPORT armVCM4P10_QPDivPlusOneTable
-
-;//--------------------------------------------------------------
-;// This table contains armVCM4P10_MFMatrix [iQP % 6][0] entires,
-;// for values of iQP from 0 to 51 (inclusive).
-;//--------------------------------------------------------------
-
- M_TABLE armVCM4P10_MFMatrixQPModTable
- DCW 13107, 11916, 10082, 9362, 8192, 7282
- DCW 13107, 11916, 10082, 9362, 8192, 7282
- DCW 13107, 11916, 10082, 9362, 8192, 7282
- DCW 13107, 11916, 10082, 9362, 8192, 7282
- DCW 13107, 11916, 10082, 9362, 8192, 7282
- DCW 13107, 11916, 10082, 9362, 8192, 7282
- DCW 13107, 11916, 10082, 9362, 8192, 7282
- DCW 13107, 11916, 10082, 9362, 8192, 7282
- DCW 13107, 11916, 10082, 9362, 8192, 7282
-
-;//---------------------------------------------------------------
-;// This table contains ARM_M4P10_Q_OFFSET + 1 + (iQP / 6) values,
-;// for values of iQP from 0 to 51 (inclusive).
-;//---------------------------------------------------------------
-
- M_TABLE armVCM4P10_QPDivPlusOneTable
- DCB 16, 16, 16, 16, 16, 16
- DCB 17, 17, 17, 17, 17, 17
- DCB 18, 18, 18, 18, 18, 18
- DCB 19, 19, 19, 19, 19, 19
- DCB 20, 20, 20, 20, 20, 20
- DCB 21, 21, 21, 21, 21, 21
- DCB 22, 22, 22, 22, 22, 22
- DCB 23, 23, 23, 23, 23, 23
- DCB 24, 24, 24, 24, 24, 24
-
-;//------------------------------------------------------------------
-;// This table contains (1 << QbitsPlusOne) / 3 Values (Intra case) ,
-;// for values of iQP from 0 to 51 (inclusive).
-;//------------------------------------------------------------------
-
- M_TABLE armVCM4P10_QPDivIntraTable, 2
- DCD 21845, 21845, 21845, 21845, 21845, 21845
- DCD 43690, 43690, 43690, 43690, 43690, 43690
- DCD 87381, 87381, 87381, 87381, 87381, 87381
- DCD 174762, 174762, 174762, 174762, 174762, 174762
- DCD 349525, 349525, 349525, 349525, 349525, 349525
- DCD 699050, 699050, 699050, 699050, 699050, 699050
- DCD 1398101, 1398101, 1398101, 1398101, 1398101, 1398101
- DCD 2796202, 2796202, 2796202, 2796202, 2796202, 2796202
- DCD 5592405, 5592405, 5592405, 5592405, 5592405, 5592405
-
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_TransformResidual4x4_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_TransformResidual4x4_s.s
deleted file mode 100644
index 9e16e49..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_TransformResidual4x4_s.s
+++ /dev/null
@@ -1,200 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_TransformResidual4x4_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-;// Description:
-;// Transform Residual 4x4 Coefficients
-;//
-;//
-
-
-;// Include standard headers
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS CortexA8
-
-;// Import symbols required from other files
-;// (For example tables)
-
-
-
-
-;// Set debugging level
-;//DEBUG_ON SETL {TRUE}
-
-
-
-;// Guarding implementation by the processor name
-
-
-
-
-
-
-
-
-;// Guarding implementation by the processor name
-
- IF CortexA8
-
-;// ARM Registers
-
-;//Input Registers
-pDst RN 0
-pSrc RN 1
-
-
-;// Neon Registers
-
-;// Packed Input pixels
-dIn0 DN D0.S16
-dIn1 DN D1.S16
-dIn2 DN D2.S16
-dIn3 DN D3.S16
-
-;// Intermediate calculations
-dZero DN D4.S16
-de0 DN D5.S16
-de1 DN D6.S16
-de2 DN D7.S16
-de3 DN D8.S16
-dIn1RS DN D7.S16
-dIn3RS DN D8.S16
-df0 DN D0.S16
-df1 DN D1.S16
-df2 DN D2.S16
-df3 DN D3.S16
-qf01 QN Q0.32
-qf23 QN Q1.32
-dg0 DN D5.S16
-dg1 DN D6.S16
-dg2 DN D7.S16
-dg3 DN D8.S16
-df1RS DN D7.S16
-df3RS DN D8.S16
-
-;// Output pixels
-dh0 DN D0.S16
-dh1 DN D1.S16
-dh2 DN D2.S16
-dh3 DN D3.S16
-
-
- ;// Allocate stack memory required by the function
-
-
- ;// Write function header
- M_START armVCM4P10_TransformResidual4x4, ,d8
-
- ;******************************************************************
- ;// The strategy used in implementing the transform is as follows:*
- ;// Load the 4x4 block into 8 registers *
- ;// Transpose the 4x4 matrix *
- ;// Perform the row operations (on columns) using SIMD *
- ;// Transpose the 4x4 result matrix *
- ;// Perform the coloumn operations *
- ;// Store the 4x4 block at one go *
- ;******************************************************************
-
- ;// Load all the 4x4 pixels in transposed form
-
- VLD4 {dIn0,dIn1,dIn2,dIn3},[pSrc]
-
- VMOV dZero,#0 ;// Used to right shift by 1
-
-
- ;****************************************
- ;// Row Operations (Performed on columns)
- ;****************************************
-
-
- VADD de0,dIn0,dIn2 ;// e0 = d0 + d2
- VSUB de1,dIn0,dIn2 ;// e1 = d0 - d2
- VHADD dIn1RS,dIn1,dZero ;// (f1>>1) constZero is a register holding 0
- VHADD dIn3RS,dIn3,dZero
- VSUB de2,dIn1RS,dIn3 ;// e2 = (d1>>1) - d3
- VADD de3,dIn1,dIn3RS ;// e3 = d1 + (d3>>1)
- VADD df0,de0,de3 ;// f0 = e0 + e3
- VADD df1,de1,de2 ;// f1 = e1 + e2
- VSUB df2,de1,de2 ;// f2 = e1 - e2
- VSUB df3,de0,de3 ;// f3 = e0 - e3
-
-
-
- ;*****************************************************************
- ;// Transpose the resultant matrix
- ;*****************************************************************
-
- VTRN df0,df1
- VTRN df2,df3
- VTRN qf01,qf23
-
-
- ;*******************************
- ;// Coloumn Operations
- ;*******************************
-
-
- VADD dg0,df0,df2 ;// e0 = d0 + d2
- VSUB dg1,df0,df2 ;// e1 = d0 - d2
- VHADD df1RS,df1,dZero ;// (f1>>1) constZero is a register holding 0
- VHADD df3RS,df3,dZero
- VSUB dg2,df1RS,df3 ;// e2 = (d1>>1) - d3
- VADD dg3,df1,df3RS ;// e3 = d1 + (d3>>1)
- VADD dh0,dg0,dg3 ;// f0 = e0 + e3
- VADD dh1,dg1,dg2 ;// f1 = e1 + e2
- VSUB dh2,dg1,dg2 ;// f2 = e1 - e2
- VSUB dh3,dg0,dg3 ;// f3 = e0 - e3
-
-
- ;************************************************
- ;// Calculate final value (colOp[i][j] + 32)>>6
- ;************************************************
-
- VRSHR dh0,#6
- VRSHR dh1,#6
- VRSHR dh2,#6
- VRSHR dh3,#6
-
-
- ;***************************
- ;// Store all the 4x4 pixels
- ;***************************
-
- VST1 {dh0,dh1,dh2,dh3},[pDst]
-
-
- ;// Set return value
-
-End
-
-
- ;// Write function tail
- M_END
-
- ENDIF ;//CortexA8
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_UnpackBlock4x4_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_UnpackBlock4x4_s.s
deleted file mode 100644
index a24c7d5..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/armVCM4P10_UnpackBlock4x4_s.s
+++ /dev/null
@@ -1,106 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P10_UnpackBlock4x4_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
-;// Define the processor variants supported by this file
-
- M_VARIANTS ARM1136JS
-
-
- IF ARM1136JS
-
-;//--------------------------------------
-;// Input Arguments and their scope/usage
-;//--------------------------------------
-ppSrc RN 0 ;// Persistent variable
-pDst RN 1 ;// Persistent variable
-
-;//--------------------------------
-;// Variables and their scope/usage
-;//--------------------------------
-pSrc RN 2 ;// Persistent variables
-Flag RN 3
-Value RN 4
-Value2 RN 5
-strOffset RN 6
-cstOffset RN 7
-
-
- M_START armVCM4P10_UnpackBlock4x4, r7
-
- LDR pSrc, [ppSrc] ;// Load pSrc
- MOV cstOffset, #31 ;// To be used in the loop, to compute offset
-
- ;//-----------------------------------------------------------------------
- ; Firstly, fill all the coefficient values on the <pDst> buffer by zero
- ;//-----------------------------------------------------------------------
-
- MOV Value, #0 ;// Initialize the zero value
- MOV Value2, #0 ;// Initialize the zero value
- LDRB Flag, [pSrc], #1 ;// Preload <Flag> before <unpackLoop>
-
- STRD Value, [pDst, #0] ;// pDst[0] = pDst[1] = pDst[2] = pDst[3] = 0
- STRD Value, [pDst, #8] ;// pDst[4] = pDst[5] = pDst[6] = pDst[7] = 0
- STRD Value, [pDst, #16] ;// pDst[8] = pDst[9] = pDst[10] = pDst[11] = 0
- STRD Value, [pDst, #24] ;// pDst[12] = pDst[13] = pDst[14] = pDst[15] = 0
-
- ;//----------------------------------------------------------------------------
- ;// The loop below parses and unpacks the input stream. The C-model has
- ;// a somewhat complicated logic for sign extension. But in the v6 version,
- ;// that can be easily taken care by loading the data from <pSrc> stream as
- ;// SIGNED byte/halfword. So, based on the first TST instruction, 8-bits or
- ;// 16-bits are read.
- ;//
- ;// Next, to compute the offset, where the unpacked value needs to be stored,
- ;// we modify the computation to perform [(Flag & 15) < 1] as [(Flag < 1) & 31]
- ;// This results in a saving of one cycle.
- ;//----------------------------------------------------------------------------
-
-unpackLoop
- TST Flag, #0x10 ;// Computing (Flag & 0x10)
- LDRSBNE Value2,[pSrc,#1] ;// Load byte wise to avoid unaligned access
- LDRBNE Value, [pSrc], #2
- AND strOffset, cstOffset, Flag, LSL #1 ;// strOffset = (Flag & 15) < 1;
- LDRSBEQ Value, [pSrc], #1 ;// Value = (OMX_U8) *pSrc++
- ORRNE Value,Value,Value2, LSL #8 ;// Value = (OMX_U16) *pSrc++
-
- TST Flag, #0x20 ;// Computing (Flag & 0x20) to check, if we're done
- LDRBEQ Flag, [pSrc], #1 ;// Flag = (OMX_U8) *pSrc++, for next iteration
- STRH Value, [pDst, strOffset] ;// Store <Value> at offset <strOffset>
- BEQ unpackLoop ;// Branch to the loop beginning
-
- STR pSrc, [ppSrc] ;// Update the bitstream pointer
- M_END
-
- ENDIF
-
-
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_DeblockChroma_I.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_DeblockChroma_I.c
deleted file mode 100644
index 0a6448d..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_DeblockChroma_I.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_DeblockChroma_I.c
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- * H.264 intra chroma deblock
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_DeblockChroma_I
- *
- * Description:
- * Performs deblocking filtering on all edges of the chroma macroblock (16x16).
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcDst pointer to the input macroblock. Must be 8-byte aligned.
- * [in] srcdstStep Step of the arrays
- * [in] pAlpha pointer to a 2x2 array of alpha thresholds, organized as follows: { external
- * vertical edge, internal vertical edge, external
- * horizontal edge, internal horizontal edge }
- * [in] pBeta pointer to a 2x2 array of beta thresholds, organized as follows: { external
- * vertical edge, internal vertical edge, external horizontal edge,
- * internal horizontal edge }
- * [in] pThresholds AArray of size 8x2 of Thresholds (TC0) (values for the left or
- * above edge of each 4x2 or 2x4 block, arranged in vertical block order
- * and then in horizontal block order)
- * [in] pBS array of size 16x2 of BS parameters (arranged in scan block order for vertical edges and then horizontal edges);
- * valid in the range [0,4] with the following restrictions: i) pBS[i]== 4 may occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^1]== 4. Must be 4-byte aligned.
- * [out] pSrcDst pointer to filtered output macroblock
- *
- * Return Value:
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - Either of the pointers in pSrcDst, pAlpha, pBeta, pTresholds, or pBS is NULL.
- * - pSrcDst is not 8-byte aligned.
- * - either pThresholds or pBS is not 4-byte aligned.
- * - pBS is out of range, i.e., one of the following conditions is true: pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or (pBS[i]==4 && pBS[i^1]!=4) for 0<=i<=3.
- * - srcdstStep is not a multiple of 8.
- *
- */
-OMXResult omxVCM4P10_DeblockChroma_I(
- OMX_U8* pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8* pAlpha,
- const OMX_U8* pBeta,
- const OMX_U8* pThresholds,
- const OMX_U8 *pBS
-)
-{
- OMXResult errorCode;
-
- armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot8ByteAligned(pSrcDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(srcdstStep & 7, OMX_Sts_BadArgErr);
- armRetArgErrIf(pAlpha == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBeta == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pThresholds == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pThresholds), OMX_Sts_BadArgErr);
- armRetArgErrIf(pBS == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pBS), OMX_Sts_BadArgErr);
-
- errorCode = omxVCM4P10_FilterDeblockingChroma_VerEdge_I(
- pSrcDst, srcdstStep, pAlpha, pBeta, pThresholds, pBS);
-
- armRetArgErrIf(errorCode != OMX_Sts_NoErr, errorCode)
-
- errorCode = omxVCM4P10_FilterDeblockingChroma_HorEdge_I(
- pSrcDst, srcdstStep, pAlpha+2, pBeta+2, pThresholds+8, pBS+16);
-
- return errorCode;
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_DeblockLuma_I.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_DeblockLuma_I.c
deleted file mode 100644
index 7b89be7..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_DeblockLuma_I.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_DeblockLuma_I.c
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- * H.264 luma deblock
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-
-/**
- * Function: omxVCM4P10_DeblockLuma_I
- *
- * Description:
- * This function performs deblock filtering the horizontal and vertical edges of a luma macroblock
- *(16x16).
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcDst pointer to the input macroblock. Must be 8-byte aligned.
- * [in] srcdstStep image width
- * [in] pAlpha pointer to a 2x2 table of alpha thresholds, organized as follows: { external
- * vertical edge, internal vertical edge, external horizontal
- * edge, internal horizontal edge }
- * [in] pBeta pointer to a 2x2 table of beta thresholds, organized as follows: { external
- * vertical edge, internal vertical edge, external horizontal edge,
- * internal horizontal edge }
- * [in] pThresholds pointer to a 16x2 table of threshold (TC0), organized as follows: { values for
- * the left or above edge of each 4x4 block, arranged in vertical block order
- * and then in horizontal block order)
- * [in] pBS pointer to a 16x2 table of BS parameters arranged in scan block order for vertical edges and then horizontal edges;
- * valid in the range [0,4] with the following restrictions: i) pBS[i]== 4 may occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^1]== 4. Must be 4-byte aligned.
- * [out] pSrcDst pointer to filtered output macroblock.
- *
- * Return Value:
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - Either of the pointers in pSrcDst, pAlpha, pBeta, pTresholds or pBS is NULL.
- * - pSrcDst is not 8-byte aligned.
- * - srcdstStep is not a multiple of 8
- * - pBS is out of range, i.e., one of the following conditions is true: pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or (pBS[i]==4 && pBS[i^1]!=4) for 0<=i<=3.
-.
- *
- */
-
-OMXResult omxVCM4P10_DeblockLuma_I(
- OMX_U8* pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8* pAlpha,
- const OMX_U8* pBeta,
- const OMX_U8* pThresholds,
- const OMX_U8 *pBS
-)
-{
- OMXResult errorCode;
-
- armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot8ByteAligned(pSrcDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(srcdstStep & 7, OMX_Sts_BadArgErr);
- armRetArgErrIf(pAlpha == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBeta == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pThresholds == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pThresholds), OMX_Sts_BadArgErr);
- armRetArgErrIf(pBS == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pBS), OMX_Sts_BadArgErr);
-
- errorCode = omxVCM4P10_FilterDeblockingLuma_VerEdge_I(
- pSrcDst, srcdstStep, pAlpha, pBeta, pThresholds, pBS);
-
- armRetArgErrIf(errorCode != OMX_Sts_NoErr, errorCode)
-
- errorCode = omxVCM4P10_FilterDeblockingLuma_HorEdge_I(
- pSrcDst, srcdstStep, pAlpha+2, pBeta+2, pThresholds+16, pBS+16);
-
- return errorCode;
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC.c
deleted file mode 100644
index 950f348..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC.c
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- * H.264 decode coefficients module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC
- *
- * Description:
- * Performs CAVLC decoding and inverse raster scan for 2x2 block of
- * ChromaDCLevel. The decoded coefficients in packed position-coefficient
- * buffer are stored in increasing raster scan order, namely position order.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream Double pointer to current byte in bit stream
- * buffer
- * [in] pOffset Pointer to current bit position in the byte
- * pointed to by *ppBitStream
- * [out] ppBitStream *ppBitStream is updated after each block is decoded
- * [out] pOffset *pOffset is updated after each block is decoded
- * [out] pNumCoeff Pointer to the number of nonzero coefficients
- * in this block
- * [out] ppPosCoefbuf Double pointer to destination residual
- * coefficient-position pair buffer
- *
- * Return Value:
- * Standard omxError result. See enumeration for possible result codes.
- *
- */
-
-OMXResult omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC (
- const OMX_U8** ppBitStream,
- OMX_S32* pOffset,
- OMX_U8* pNumCoeff,
- OMX_U8** ppPosCoefbuf
- )
-
-{
- return armVCM4P10_DecodeCoeffsToPair(ppBitStream, pOffset, pNumCoeff,
- ppPosCoefbuf, 17, 4);
-
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_DecodeCoeffsToPairCAVLC.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_DecodeCoeffsToPairCAVLC.c
deleted file mode 100644
index 5e78b4c..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_DecodeCoeffsToPairCAVLC.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_DecodeCoeffsToPairCAVLC.c
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- * H.264 decode coefficients module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_DecodeCoeffsToPairCAVLC
- *
- * Description:
- * Performs CAVLC decoding and inverse zigzag scan for 4x4 block of
- * Intra16x16DCLevel, Intra16x16ACLevel,LumaLevel, and ChromaACLevel.
- * Inverse field scan is not supported. The decoded coefficients in packed
- * position-coefficient buffer are stored in increasing zigzag order instead
- * of position order.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream Double pointer to current byte in bit stream buffer
- * [in] pOffset Pointer to current bit position in the byte pointed
- * to by *ppBitStream
- * [in] sMaxNumCoeff Maximum number of non-zero coefficients in current
- * block
- * [in] sVLCSelect VLC table selector, obtained from number of non-zero
- * AC coefficients of above and left 4x4 blocks. It is
- * equivalent to the variable nC described in H.264 standard
- * table 9-5, except its value can¡¯t be less than zero.
- * [out] ppBitStream *ppBitStream is updated after each block is decoded
- * [out] pOffset *pOffset is updated after each block is decoded
- * [out] pNumCoeff Pointer to the number of nonzero coefficients in
- * this block
- * [out] ppPosCoefbuf Double pointer to destination residual
- * coefficient-position pair buffer
- * Return Value:
- * Standard omxError result. See enumeration for possible result codes.
- *
- */
-
-OMXResult omxVCM4P10_DecodeCoeffsToPairCAVLC(
- const OMX_U8** ppBitStream,
- OMX_S32* pOffset,
- OMX_U8* pNumCoeff,
- OMX_U8**ppPosCoefbuf,
- OMX_INT sVLCSelect,
- OMX_INT sMaxNumCoeff
- )
-{
- return armVCM4P10_DecodeCoeffsToPair(ppBitStream, pOffset, pNumCoeff,
- ppPosCoefbuf, sVLCSelect, sMaxNumCoeff);
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_DequantTransformResidualFromPairAndAdd_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_DequantTransformResidualFromPairAndAdd_s.s
deleted file mode 100644
index 4787982..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_DequantTransformResidualFromPairAndAdd_s.s
+++ /dev/null
@@ -1,410 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_DequantTransformResidualFromPairAndAdd_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-;// Description:
-;// H.264 inverse quantize and transform module
-;//
-;//
-
-
-
-;// Include standard headers
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
-;// Import symbols required from other files
-;// (For example tables)
-
- IMPORT armVCM4P10_UnpackBlock4x4
- IMPORT armVCM4P10_TransformResidual4x4
- IMPORT armVCM4P10_QPDivTable
- IMPORT armVCM4P10_VMatrixU16
- IMPORT armVCM4P10_QPModuloTable
-
- M_VARIANTS CortexA8
-
-;// Set debugging level
-;//DEBUG_ON SETL {TRUE}
-
-
-;// Static Function: armVCM4P10_DequantLumaAC4x4
-
-;// Guarding implementation by the processor name
-
-
-
-;// Guarding implementation by the processor name
-
-
-
-
-
-
-;// Function: omxVCM4P10_DequantTransformResidualFromPairAndAdd
-
-;// Guarding implementation by the processor name
-
-
-
-;// Function: omxVCM4P10_DequantTransformResidualFromPairAndAdd
-
-;// Guarding implementation by the processor name
-
- IF CortexA8
-
-
-;// ARM Registers
-
-;//Input Registers
-ppSrc RN 0
-pPred RN 1
-pDC RN 2
-pDst RN 3
-
-
-;//Output Registers
-result RN 0
-
-;//Local Scratch Registers
-
-;//Registers used in armVCM4P10_DequantLumaAC4x4
-pQPdiv RN 10
-pQPmod RN 11
-pVRow RN 2
-QPmod RN 12
-shift RN 14
-index0 RN 1
-index1 RN 10
-
-;//Registers used in DequantTransformResidualFromPairAndAdd
-pDelta RN 4
-pDeltaTmp RN 6
-AC RN 5 ;//Load from stack
-pPredTemp RN 7
-pDCTemp RN 8
-pDstTemp RN 9
-pDeltaArg1 RN 1
-pDeltaArg0 RN 0
-QP RN 1 ;//Load from stack
-DCval RN 10
-predstep RN 1
-dstStep RN 10
-PredVal1 RN 3
-PredVal2 RN 5
-
-
-
-
-;// Neon Registers
-
-;// Registers used in armVCM4P10_DequantLumaAC4x4
-
-dVmatrix DN D6.8
-dindexRow0 DN D7.32
-dindexRow1 DN D9.32
-dByteIndexRow0 DN D7.8
-dByteIndexRow1 DN D9.8
-dVRow0 DN D8.8
-dVRow1 DN D4.8
-dVRow0U16 DN D8.U16
-dVRow1U16 DN D4.U16
-dVRow2U16 DN D8.U16
-dVRow3U16 DN D4.U16
-
-dShift DN D5.U16
-dSrcRow0 DN D0.I16
-dSrcRow1 DN D1.I16
-dSrcRow2 DN D2.I16
-dSrcRow3 DN D3.I16
-dDqntRow0 DN D0.I16
-dDqntRow1 DN D1.I16
-dDqntRow2 DN D2.I16
-dDqntRow3 DN D3.I16
-
-;// Registers used in TransformResidual4x4
-
-;// Packed Input pixels
-dIn0 DN D0.S16
-dIn1 DN D1.S16
-dIn2 DN D2.S16
-dIn3 DN D3.S16
-qIn01 QN Q0.32
-qIn23 QN Q1.32
-
-;// Intermediate calculations
-dZero DN D4.S16
-de0 DN D5.S16
-de1 DN D6.S16
-de2 DN D7.S16
-de3 DN D8.S16
-dIn1RS DN D7.S16
-dIn3RS DN D8.S16
-df0 DN D0.S16
-df1 DN D1.S16
-df2 DN D2.S16
-df3 DN D3.S16
-qf01 QN Q0.32
-qf23 QN Q1.32
-dg0 DN D5.S16
-dg1 DN D6.S16
-dg2 DN D7.S16
-dg3 DN D8.S16
-df1RS DN D7.S16
-df3RS DN D8.S16
-
-;// Output pixels
-dh0 DN D0.S16
-dh1 DN D1.S16
-dh2 DN D2.S16
-dh3 DN D3.S16
-
-;// Registers used in DequantTransformResidualFromPairAndAdd
-
-dDeltaRow0 DN D0.S16
-dDeltaRow1 DN D1.S16
-dDeltaRow2 DN D2.S16
-dDeltaRow3 DN D3.S16
-qDeltaRow01 QN Q0.S16
-qDeltaRow23 QN Q1.S16
-
-dPredValRow01 DN D4.U8
-dPredValRow23 DN D5.U8
-
-qSumRow01 QN Q3.S16
-qSumRow23 QN Q4.S16
-dDstRow01 DN D0.U8
-dDstRow23 DN D1.U8
-dDstRow0 DN D0.32[0]
-dDstRow1 DN D0.32[1]
-dDstRow2 DN D1.32[0]
-dDstRow3 DN D1.32[1]
-
-
- ;// Allocate stack memory required by the function
- M_ALLOC8 pBuffer, 32
-
-
- ;// Write function header
- M_START omxVCM4P10_DequantTransformResidualFromPairAndAdd,r11,d9
-
- ;// Define stack arguments
- M_ARG predStepOnStack, 4
- M_ARG dstStepOnStack,4
- M_ARG QPOnStack, 4
- M_ARG ACOnStack,4
-
-
- M_ADR pDelta,pBuffer
- M_LDR AC,ACOnStack
-
-
- ;// Save registers r1,r2,r3 before function call
- MOV pPredTemp,pPred
- MOV pDCTemp,pDC
- MOV pDstTemp,pDst
-
- CMP AC,#0
- BEQ DCcase
- MOV pDeltaArg1,pDelta ;// Set up r1 for armVCM4P10_UnpackBlock4x4
-
- BL armVCM4P10_UnpackBlock4x4
-
- ;//--------------------------------------------------------
- ;// armVCM4P10_DequantLumaAC4x4 : static function inlined
- ;//--------------------------------------------------------
-
- ;//BL armVCM4P10_DequantLumaAC4x4
- M_LDR QP,QPOnStack ;// Set up r1 for armVCM4P10_DequantLumaAC4x4
-
- LDR pQPmod,=armVCM4P10_QPModuloTable
- LDR pQPdiv,=armVCM4P10_QPDivTable
- LDR pVRow,=armVCM4P10_VMatrixU16
-
-
- LDRSB QPmod,[pQPmod,QP] ;// (QP%6) * 6
- LDRSB shift,[pQPdiv,QP] ;// Shift = QP / 6
-
- LDR index1,=0x03020504
- LDR index0,=0x05040100 ;// Indexes into dVmatrix
- ADD pVRow,pVRow,QPmod
- VDUP dindexRow0,index0
- VDUP dindexRow1,index1
- VDUP dShift,shift
-
- ;// Load all 4x4 pVRow[] values
- VLD1 dVmatrix,[pVRow] ;// dVmatrix = [0d|0c|0b|0a]
-
-
- VTBL dVRow0,dVmatrix,dByteIndexRow0 ;// row0 = row2 = [pVRow[2] | pVRow[0] | pVRow[2] | pVRow[0]]
- VTBL dVRow1,dVmatrix,dByteIndexRow1 ;// row1 = row3 = [pVRow[1] | pVRow[2] | pVRow[1] | pVRow[2]]
- CMP pDCTemp,#0
- ;// Load all the 4x4 'src' values
- VLD1 { dSrcRow0,dSrcRow1,dSrcRow2,dSrcRow3 },[pDelta]
-
- VSHL dVRow0U16,dVRow0U16,dShift
- VSHL dVRow1U16,dVRow1U16,dShift
- LDRSHNE DCval,[pDCTemp]
-
-
- ;// Multiply src[] with pVRow[]
- VMUL dDqntRow0,dSrcRow0,dVRow0U16
- VMUL dDqntRow1,dSrcRow1,dVRow1U16
- VMUL dDqntRow2,dSrcRow2,dVRow2U16
- VMUL dDqntRow3,dSrcRow3,dVRow3U16
-
-
-
- ;//-------------------------------------------------------------
- ;// TransformResidual4x4 : Inlined to avoid Load/Stores
- ;//-------------------------------------------------------------
-
-
- ;//BL armVCM4P10_TransformResidual4x4
- ;//STRHNE DCval,[pDelta]
- VMOVNE dIn0[0],DCval
-
-
-
- ;//*****************************************************************
- ;// Transpose the input pixels : perform Row ops as Col ops
- ;//*****************************************************************
-
- VTRN dIn0,dIn1
- VTRN dIn2,dIn3
- VTRN qIn01,qIn23
-
-
- VMOV dZero,#0 ;// Used to right shift by 1
-
-
- ;//****************************************
- ;// Row Operations (Performed on columns)
- ;//****************************************
-
-
- VADD de0,dIn0,dIn2 ;// e0 = d0 + d2
- VSUB de1,dIn0,dIn2 ;// e1 = d0 - d2
- VHADD dIn1RS,dIn1,dZero ;// (f1>>1) constZero is a register holding 0
- VHADD dIn3RS,dIn3,dZero
- VSUB de2,dIn1RS,dIn3 ;// e2 = (d1>>1) - d3
- VADD de3,dIn1,dIn3RS ;// e3 = d1 + (d3>>1)
- VADD df0,de0,de3 ;// f0 = e0 + e3
- VADD df1,de1,de2 ;// f1 = e1 + e2
- VSUB df2,de1,de2 ;// f2 = e1 - e2
- VSUB df3,de0,de3 ;// f3 = e0 - e3
-
-
-
- ;//*****************************************************************
- ;// Transpose the resultant matrix
- ;//*****************************************************************
-
- VTRN df0,df1
- VTRN df2,df3
- VTRN qf01,qf23
-
-
- ;//*******************************
- ;// Coloumn Operations
- ;//*******************************
-
-
- VADD dg0,df0,df2 ;// e0 = d0 + d2
- VSUB dg1,df0,df2 ;// e1 = d0 - d2
- VHADD df1RS,df1,dZero ;// (f1>>1) constZero is a register holding 0
- VHADD df3RS,df3,dZero
- VSUB dg2,df1RS,df3 ;// e2 = (d1>>1) - d3
- VADD dg3,df1,df3RS ;// e3 = d1 + (d3>>1)
- VADD dh0,dg0,dg3 ;// f0 = e0 + e3
- VADD dh1,dg1,dg2 ;// f1 = e1 + e2
- VSUB dh2,dg1,dg2 ;// f2 = e1 - e2
- VSUB dh3,dg0,dg3 ;// f3 = e0 - e3
-
-
- ;//************************************************
- ;// Calculate final value (colOp[i][j] + 32)>>6
- ;//************************************************
-
- VRSHR dh0,#6
- VRSHR dh1,#6
- VRSHR dh2,#6
- VRSHR dh3,#6
-
-
- B OutDCcase
-
-
-DCcase
- ;// Calculate the Transformed DCvalue : (DCval+32)>>6
- LDRSH DCval,[pDCTemp]
- ADD DCval,DCval,#32
- ASR DCval,DCval,#6
-
- VDUP dDeltaRow0, DCval ;// pDelta[0] = pDelta[1] = pDelta[2] = pDelta[3] = DCval
- VDUP dDeltaRow1, DCval ;// pDelta[4] = pDelta[5] = pDelta[6] = pDelta[7] = DCval
- VDUP dDeltaRow2, DCval ;// pDelta[8] = pDelta[9] = pDelta[10] = pDelta[11] = DCval
- VDUP dDeltaRow3, DCval
-
-
-OutDCcase
- M_LDR predstep,predStepOnStack
- M_LDR dstStep,dstStepOnStack
-
- LDR PredVal1,[pPredTemp],predstep
- LDR PredVal2,[pPredTemp],predstep
- VMOV dPredValRow01,PredVal1,PredVal2
-
- LDR PredVal1,[pPredTemp],predstep
- LDR PredVal2,[pPredTemp]
- VMOV dPredValRow23,PredVal1,PredVal2
-
-
- VADDW qSumRow01,qDeltaRow01,dPredValRow01
- VADDW qSumRow23,qDeltaRow23,dPredValRow23
- VQMOVUN dDstRow01,qSumRow01
- VQMOVUN dDstRow23,qSumRow23
-
-
- VST1 dDstRow0,[pDstTemp],dstStep
- VST1 dDstRow1,[pDstTemp],dstStep
- VST1 dDstRow2,[pDstTemp],dstStep
- VST1 dDstRow3,[pDstTemp]
-
- ;// Set return value
- MOV result,#OMX_Sts_NoErr
-
-End
-
-
- ;// Write function tail
-
- M_END
-
- ENDIF ;//CORTEXA8
-
-
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_HorEdge_I_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_HorEdge_I_s.s
deleted file mode 100644
index a099dcb..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_HorEdge_I_s.s
+++ /dev/null
@@ -1,216 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_FilterDeblockingChroma_HorEdge_I_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS CortexA8
-
- IF CortexA8
-
- IMPORT armVCM4P10_DeblockingChromabSGE4_unsafe
- IMPORT armVCM4P10_DeblockingChromabSLT4_unsafe
-
-LOOP_COUNT EQU 0x40000000
-MASK_3 EQU 0x03030303
-MASK_4 EQU 0x04040404
-
-;// Function arguments
-
-pSrcDst RN 0
-srcdstStep RN 1
-pAlpha RN 2
-pBeta RN 3
-
-pThresholds RN 5
-pBS RN 4
-bS3210 RN 6
-
-;// Loop
-
-XY RN 7
-
-;// Pixels
-dP_0 DN D4.U8
-dP_1 DN D5.U8
-dP_2 DN D6.U8
-dQ_0 DN D8.U8
-dQ_1 DN D9.U8
-dQ_2 DN D10.U8
-
-;// Filtering Decision
-dAlpha DN D0.U8
-dBeta DN D2.U8
-
-dFilt DN D16.U8
-dAqflg DN D12.U8
-dApflg DN D17.U8
-
-dAp0q0 DN D13.U8
-dAp1p0 DN D12.U8
-dAq1q0 DN D18.U8
-dAp2p0 DN D19.U8
-dAq2q0 DN D17.U8
-
-qBS3210 QN Q13.U16
-dBS3210 DN D26
-dMask_bs DN D27
-dFilt_bs DN D26.U16
-
-;// bSLT4
-dMask_0 DN D14.U8
-dMask_1 DN D15.U8
-dMask_4 DN D1.U16
-
-Mask_4 RN 8
-Mask_3 RN 9
-
-dTemp DN D19.U8
-
-;// Result
-dP_0t DN D13.U8
-dQ_0t DN D31.U8
-
-dP_0n DN D29.U8
-dQ_0n DN D24.U8
-
-
- ;// Function header
- M_START omxVCM4P10_FilterDeblockingChroma_HorEdge_I, r9, d15
-
- ;//Arguments on the stack
- M_ARG ppThresholds, 4
- M_ARG ppBS, 4
-
- ;// d0-dAlpha_0
- ;// d2-dBeta_0
-
- ;load alpha1,beta1 somewhere to avoid more loads
- VLD1 {dAlpha[]}, [pAlpha]!
- SUB pSrcDst, pSrcDst, srcdstStep, LSL #1 ;?
- SUB pSrcDst, pSrcDst, srcdstStep
- VLD1 {dBeta[]}, [pBeta]!
-
- M_LDR pBS, ppBS
- M_LDR pThresholds, ppThresholds
-
- LDR Mask_3, =MASK_3
- LDR Mask_4, =MASK_4
-
- VMOV dMask_0, #0
- VMOV dMask_1, #1
- VMOV dMask_4, #4
-
- LDR XY, =LOOP_COUNT
-
- ;// p0-p3 - d4-d7
- ;// q0-q3 - d8-d11
-LoopY
- LDR bS3210, [pBS], #8
-
- VLD1 dP_2, [pSrcDst], srcdstStep
- ;1
- VLD1 dP_1, [pSrcDst], srcdstStep
- CMP bS3210, #0
- VLD1 dP_0, [pSrcDst], srcdstStep
- ;1
- VLD1 dQ_0, [pSrcDst], srcdstStep
- VABD dAp2p0, dP_2, dP_0
- VLD1 dQ_1, [pSrcDst], srcdstStep
- VABD dAp0q0, dP_0, dQ_0
- VLD1 dQ_2, [pSrcDst], srcdstStep
- BEQ NoFilterBS0
-
- VABD dAp1p0, dP_1, dP_0
- VABD dAq1q0, dQ_1, dQ_0
-
- VCGT dFilt, dAlpha, dAp0q0
- VMOV.U32 dBS3210[0], bS3210
- VMAX dAp1p0, dAq1q0, dAp1p0
- VMOVL qBS3210, dBS3210.U8
- VABD dAq2q0, dQ_2, dQ_0
- VCGT dMask_bs.S16, dBS3210.S16, #0
-
- VCGT dAp1p0, dBeta, dAp1p0
- VCGT dAp2p0, dBeta, dAp2p0
-
- VAND dFilt, dMask_bs.U8
-
- TST bS3210, Mask_3
-
- VCGT dAq2q0, dBeta, dAq2q0
- VAND dFilt, dFilt, dAp1p0
-
- VAND dAqflg, dFilt, dAq2q0
- VAND dApflg, dFilt, dAp2p0
-
- ;// bS < 4 Filtering
- BLNE armVCM4P10_DeblockingChromabSLT4_unsafe
-
- TST bS3210, Mask_4
-
- SUB pSrcDst, pSrcDst, srcdstStep, LSL #2
- VTST dFilt_bs, dFilt_bs, dMask_4
-
- ;// bS == 4 Filtering
- BLNE armVCM4P10_DeblockingChromabSGE4_unsafe
-
- VBIT dP_0n, dP_0t, dFilt_bs
- VBIT dQ_0n, dQ_0t, dFilt_bs
-
- VBIF dP_0n, dP_0, dFilt
- VBIF dQ_0n, dQ_0, dFilt
-
- ;// Result Storage
- VST1 dP_0n, [pSrcDst], srcdstStep
- ADDS XY, XY, XY
- VST1 dQ_0n, [pSrcDst], srcdstStep
-
- BNE LoopY
-
- MOV r0, #OMX_Sts_NoErr
-
- M_EXIT
-
-NoFilterBS0
-
- VLD1 {dAlpha[]}, [pAlpha]
- SUB pSrcDst, pSrcDst, srcdstStep, LSL #1
- ADDS XY, XY, XY
- VLD1 {dBeta[]}, [pBeta]
- ADD pThresholds, pThresholds, #4
- BNE LoopY
-
- MOV r0, #OMX_Sts_NoErr
- M_END
-
- ENDIF
-
-
- END
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_VerEdge_I_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_VerEdge_I_s.s
deleted file mode 100644
index bf2152c..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_VerEdge_I_s.s
+++ /dev/null
@@ -1,296 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_FilterDeblockingChroma_VerEdge_I_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS CortexA8
-
- IF CortexA8
-
- IMPORT armVCM4P10_DeblockingChromabSGE4_unsafe
- IMPORT armVCM4P10_DeblockingChromabSLT4_unsafe
-
-LOOP_COUNT EQU 0x40000000
-MASK_3 EQU 0x03030303
-MASK_4 EQU 0x04040404
-
-;// Function arguments
-
-pSrcDst RN 0
-srcdstStep RN 1
-pAlpha RN 2
-pBeta RN 3
-
-pThresholds RN 5
-pBS RN 4
-bS3210 RN 6
-pSrcDst_P RN 10
-pSrcDst_Q RN 12
-
-pTmp RN 10
-pTmp2 RN 12
-step RN 14
-
-;// Loop
-
-XY RN 7
-
-;// Rows input
-dRow0 DN D7.U8
-dRow1 DN D8.U8
-dRow2 DN D5.U8
-dRow3 DN D10.U8
-dRow4 DN D6.U8
-dRow5 DN D9.U8
-dRow6 DN D4.U8
-dRow7 DN D11.U8
-
-
-;// Pixels
-dP_0 DN D4.U8
-dP_1 DN D5.U8
-dP_2 DN D6.U8
-dQ_0 DN D8.U8
-dQ_1 DN D9.U8
-dQ_2 DN D10.U8
-
-;// Filtering Decision
-dAlpha DN D0.U8
-dBeta DN D2.U8
-
-dFilt DN D16.U8
-dAqflg DN D12.U8
-dApflg DN D17.U8
-
-dAp0q0 DN D13.U8
-dAp1p0 DN D12.U8
-dAq1q0 DN D18.U8
-dAp2p0 DN D19.U8
-dAq2q0 DN D17.U8
-
-qBS3210 QN Q13.U16
-dBS3210 DN D26
-dMask_bs DN D27
-dFilt_bs DN D26.U16
-
-;// bSLT4
-dMask_0 DN D14.U8
-dMask_1 DN D15.U8
-dMask_4 DN D1.U16
-
-Mask_4 RN 8
-Mask_3 RN 9
-
-dTemp DN D19.U8
-
-;// Result
-dP_0t DN D13.U8
-dQ_0t DN D31.U8
-
-dP_0n DN D29.U8
-dQ_0n DN D24.U8
-
-
- ;// Function header
- M_START omxVCM4P10_FilterDeblockingChroma_VerEdge_I, r12, d15
-
- ;//Arguments on the stack
- M_ARG ppThresholds, 4
- M_ARG ppBS, 4
-
- ;// d0-dAlpha_0
- ;// d2-dBeta_0
-
- ;load alpha1,beta1 somewhere to avoid more loads
- VLD1 {dAlpha[]}, [pAlpha]!
- SUB pSrcDst, pSrcDst, #4
- VLD1 {dBeta[]}, [pBeta]!
-
- M_LDR pBS, ppBS
- M_LDR pThresholds, ppThresholds
-
- LDR Mask_4, =MASK_4
- LDR Mask_3, =MASK_3
-
- ;dMask_0-14
- ;dMask_1-15
- ;dMask_4-19
-
- VMOV dMask_0, #0
- VMOV dMask_1, #1
- VMOV dMask_4, #4
-
- LDR XY, =LOOP_COUNT
-
- ;// p0-p3 - d4-d7
- ;// q0-q3 - d8-d11
-
-
-LoopY
- LDR bS3210, [pBS], #8
- ADD pTmp, pSrcDst, srcdstStep
- ADD step, srcdstStep, srcdstStep
-
- ;1
- VLD1 dRow0, [pSrcDst], step
- ;1
- VLD1 dRow1, [pTmp], step
- VLD1 dRow2, [pSrcDst], step
- VLD1 dRow3, [pTmp], step
- VLD1 dRow4, [pSrcDst], step
- VLD1 dRow5, [pTmp], step
- VLD1 dRow6, [pSrcDst], step
- VLD1 dRow7, [pTmp], step
-
-
- ;// dRow0 = [q3r0 q2r0 q1r0 q0r0 p0r0 p1r0 p2r0 p3r0]
- ;// dRow1 = [q3r1 q2r1 q1r1 q0r1 p0r1 p1r1 p2r1 p3r1]
- ;// dRow2 = [q3r2 q2r2 q1r2 q0r2 p0r2 p1r2 p2r2 p3r2]
- ;// dRow3 = [q3r3 q2r3 q1r3 q0r3 p0r3 p1r3 p2r3 p3r3]
- ;// dRow4 = [q3r4 q2r4 q1r4 q0r4 p0r4 p1r4 p2r4 p3r4]
- ;// dRow5 = [q3r5 q2r5 q1r5 q0r5 p0r5 p1r5 p2r5 p3r5]
- ;// dRow6 = [q3r6 q2r6 q1r6 q0r6 p0r6 p1r6 p2r6 p3r6]
- ;// dRow7 = [q3r7 q2r7 q1r7 q0r7 p0r7 p1r7 p2r7 p3r7]
-
- ;// 8x8 Transpose
- VZIP.8 dRow0, dRow1
- VZIP.8 dRow2, dRow3
- VZIP.8 dRow4, dRow5
- VZIP.8 dRow6, dRow7
-
- VZIP.16 dRow0, dRow2
- VZIP.16 dRow1, dRow3
- VZIP.16 dRow4, dRow6
- VZIP.16 dRow5, dRow7
-
- VZIP.32 dRow0, dRow4
- VZIP.32 dRow2, dRow6
- VZIP.32 dRow3, dRow7
- VZIP.32 dRow1, dRow5
-
-
- ;Realign the pointers
-
- CMP bS3210, #0
- VABD dAp2p0, dP_2, dP_0
- VABD dAp0q0, dP_0, dQ_0
- BEQ NoFilterBS0
-
- VABD dAp1p0, dP_1, dP_0
- VABD dAq1q0, dQ_1, dQ_0
-
- VMOV.U32 dBS3210[0], bS3210
- VCGT dFilt, dAlpha, dAp0q0
- VMAX dAp1p0, dAq1q0, dAp1p0
- VMOVL qBS3210, dBS3210.U8
- VABD dAq2q0, dQ_2, dQ_0
- VCGT dMask_bs.S16, dBS3210.S16, #0
-
- VCGT dAp1p0, dBeta, dAp1p0
- VCGT dAp2p0, dBeta, dAp2p0
- VAND dFilt, dMask_bs.U8
-
- TST bS3210, Mask_3
-
- VCGT dAq2q0, dBeta, dAq2q0
- VAND dFilt, dFilt, dAp1p0
-
- VAND dAqflg, dFilt, dAq2q0
- VAND dApflg, dFilt, dAp2p0
-
- ;// bS < 4 Filtering
- BLNE armVCM4P10_DeblockingChromabSLT4_unsafe
-
- TST bS3210, Mask_4
-
- SUB pSrcDst, pSrcDst, srcdstStep, LSL #3
- VTST dFilt_bs, dFilt_bs, dMask_4
-
- ;// bS == 4 Filtering
- BLNE armVCM4P10_DeblockingChromabSGE4_unsafe
-
- VBIT dP_0n, dP_0t, dFilt_bs
- VBIT dQ_0n, dQ_0t, dFilt_bs
-
- ;// Result Storage
- ADD pSrcDst_P, pSrcDst, #3
- VBIF dP_0n, dP_0, dFilt
-
- ADD pTmp2, pSrcDst_P, srcdstStep
- ADD step, srcdstStep, srcdstStep
- VBIF dQ_0n, dQ_0, dFilt
-
- ADDS XY, XY, XY
-
- VST1 {dP_0n[0]}, [pSrcDst_P], step
- VST1 {dP_0n[1]}, [pTmp2], step
- VST1 {dP_0n[2]}, [pSrcDst_P], step
- VST1 {dP_0n[3]}, [pTmp2], step
- VST1 {dP_0n[4]}, [pSrcDst_P], step
- VST1 {dP_0n[5]}, [pTmp2], step
- VST1 {dP_0n[6]}, [pSrcDst_P], step
- VST1 {dP_0n[7]}, [pTmp2], step
-
- ADD pSrcDst_Q, pSrcDst, #4
- ADD pTmp, pSrcDst_Q, srcdstStep
-
- VST1 {dQ_0n[0]}, [pSrcDst_Q], step
- VST1 {dQ_0n[1]}, [pTmp], step
- VST1 {dQ_0n[2]}, [pSrcDst_Q], step
- VST1 {dQ_0n[3]}, [pTmp], step
- VST1 {dQ_0n[4]}, [pSrcDst_Q], step
- VST1 {dQ_0n[5]}, [pTmp], step
- VST1 {dQ_0n[6]}, [pSrcDst_Q], step
- VST1 {dQ_0n[7]}, [pTmp], step
-
- ADD pSrcDst, pSrcDst, #4
-
- BNE LoopY
-
- MOV r0, #OMX_Sts_NoErr
-
- M_EXIT
-
-NoFilterBS0
- VLD1 {dAlpha[]}, [pAlpha]
- ADD pSrcDst, pSrcDst, #4
- SUB pSrcDst, pSrcDst, srcdstStep, LSL #3
- ADDS XY, XY, XY
- VLD1 {dBeta[]}, [pBeta]
- ADD pThresholds, pThresholds, #4
- BNE LoopY
-
- MOV r0, #OMX_Sts_NoErr
-
- M_END
-
- ENDIF
-
-
- END
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_HorEdge_I_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_HorEdge_I_s.s
deleted file mode 100644
index 5678670..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_HorEdge_I_s.s
+++ /dev/null
@@ -1,302 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_FilterDeblockingLuma_HorEdge_I_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS CortexA8
-
- IMPORT armVCM4P10_DeblockingLumabSLT4_unsafe
- IMPORT armVCM4P10_DeblockingLumabSGE4_unsafe
-
- IF CortexA8
-
-LOOP_COUNT EQU 0x55000000
-
-
-;// Function arguments
-
-pSrcDst RN 0
-srcdstStep RN 1
-pAlpha RN 2
-pBeta RN 3
-
-pThresholds RN 5
-pBS RN 4
-bS10 RN 12
-
-pAlpha_0 RN 2
-pBeta_0 RN 3
-
-pAlpha_1 RN 7
-pBeta_1 RN 8
-
-
-
-;// Loop
-
-XY RN 9
-
-pTmp RN 6
-step RN 10
-
-;// Pixels
-dP_0 DN D4.U8
-dP_1 DN D5.U8
-dP_2 DN D6.U8
-dP_3 DN D7.U8
-dQ_0 DN D8.U8
-dQ_1 DN D9.U8
-dQ_2 DN D10.U8
-dQ_3 DN D11.U8
-
-
-;// Filtering Decision
-dAlpha DN D0.U8
-dBeta DN D2.U8
-
-dFilt DN D16.U8
-dAqflg DN D12.U8
-dApflg DN D17.U8
-
-dAp0q0 DN D13.U8
-dAp1p0 DN D12.U8
-dAq1q0 DN D18.U8
-dAp2p0 DN D19.U8
-dAq2q0 DN D17.U8
-
-;// bSLT4
-dTC0 DN D18.U8
-dTC1 DN D19.U8
-dTC01 DN D18.U8
-
-dTCs DN D31.S8
-dTC DN D31.U8
-
-dMask_0 DN D14.U8
-dMask_1 DN D15.U8
-
-Mask_0 RN 11
-
-dTemp DN D19.U8
-
-;// Computing P0,Q0
-qDq0p0 QN Q10.S16
-qDp1q1 QN Q11.S16
-qDelta QN Q10.S16 ; reuse qDq0p0
-dDelta DN D20.S8
-
-
-;// Computing P1,Q1
-dRp0q0 DN D24.U8
-
-dMaxP DN D23.U8
-dMinP DN D22.U8
-
-dMaxQ DN D19.U8
-dMinQ DN D21.U8
-
-dDeltaP DN D26.U8
-dDeltaQ DN D27.U8
-
-qP_0n QN Q14.S16
-qQ_0n QN Q12.S16
-
-dQ_0n DN D24.U8
-dQ_1n DN D25.U8
-dP_0n DN D29.U8
-dP_1n DN D30.U8
-
-;// bSGE4
-
-qSp0q0 QN Q10.U16
-
-qSp2q1 QN Q11.U16
-qSp0q0p1 QN Q12.U16
-qSp3p2 QN Q13.U16
-dHSp0q1 DN D28.U8
-
-qSq2p1 QN Q11.U16
-qSp0q0q1 QN Q12.U16
-qSq3q2 QN Q13.U16 ;!!
-dHSq0p1 DN D28.U8 ;!!
-
-qTemp1 QN Q11.U16 ;!!;qSp2q1
-qTemp2 QN Q12.U16 ;!!;qSp0q0p1
-
-dP_0t DN D28.U8 ;!!;dHSp0q1
-dQ_0t DN D22.U8 ;!!;Temp1
-
-dP_0n DN D29.U8
-dP_1n DN D30.U8
-dP_2n DN D31.U8
-
-dQ_0n DN D24.U8 ;!!;Temp2
-dQ_1n DN D25.U8 ;!!;Temp2
-dQ_2n DN D28.U8 ;!!;dQ_0t
-
-
- ;// Function header
- M_START omxVCM4P10_FilterDeblockingLuma_HorEdge_I, r11, d15
-
- ;//Arguments on the stack
- M_ARG ppThresholds, 4
- M_ARG ppBS, 4
-
- ;// d0-dAlpha_0
- ;// d2-dBeta_0
-
- ADD pAlpha_1, pAlpha_0, #1
- ADD pBeta_1, pBeta_0, #1
-
- VLD1 {dAlpha[]}, [pAlpha_0]
- SUB pSrcDst, pSrcDst, srcdstStep, LSL #2
- VLD1 {dBeta[]}, [pBeta_0]
-
- M_LDR pBS, ppBS
- M_LDR pThresholds, ppThresholds
-
- MOV Mask_0,#0
-
- ;dMask_0-14
- ;dMask_1-15
-
- VMOV dMask_0, #0
- VMOV dMask_1, #1
-
- ADD step, srcdstStep, srcdstStep
-
- LDR XY,=LOOP_COUNT
-
- ;// p0-p3 - d4-d7
- ;// q0-q3 - d8-d11
-LoopY
-LoopX
- LDRH bS10, [pBS], #2
- ADD pTmp, pSrcDst, srcdstStep
- CMP bS10, #0
- BEQ NoFilterBS0
-
- VLD1 dP_3, [pSrcDst], step
- VLD1 dP_2, [pTmp], step
- VLD1 dP_1, [pSrcDst], step
- VLD1 dP_0, [pTmp], step
- VLD1 dQ_0, [pSrcDst], step
- VABD dAp1p0, dP_0, dP_1
- VLD1 dQ_1, [pTmp]
- VABD dAp0q0, dQ_0, dP_0
- VLD1 dQ_2, [pSrcDst], srcdstStep
-
- VABD dAq1q0, dQ_1, dQ_0
- VABD dAp2p0, dP_2, dP_0
- VCGT dFilt, dAlpha, dAp0q0
-
- TST bS10, #0xff
- VMAX dAp1p0, dAq1q0, dAp1p0
- VABD dAq2q0, dQ_2, dQ_0
-
- VMOVEQ.U32 dFilt[0], Mask_0
- TST bS10, #0xff00
-
- VCGT dAp2p0, dBeta, dAp2p0
- VCGT dAp1p0, dBeta, dAp1p0
-
- VMOVEQ.U32 dFilt[1], Mask_0
-
- VCGT dAq2q0, dBeta, dAq2q0
- VLD1 dQ_3, [pSrcDst]
- VAND dFilt, dFilt, dAp1p0
- TST bS10, #4
-
- VAND dAqflg, dFilt, dAq2q0
- VAND dApflg, dFilt, dAp2p0
-
- BNE bSGE4
-bSLT4
- ;// bS < 4 Filtering
- SUB pSrcDst, pSrcDst, srcdstStep, LSL #2
- SUB pSrcDst, pSrcDst, srcdstStep
-
- BL armVCM4P10_DeblockingLumabSLT4_unsafe
-
- ;// Result Storage
- VST1 dP_1n, [pSrcDst], srcdstStep
- VST1 dP_0n, [pSrcDst], srcdstStep
- SUB pTmp, pSrcDst, srcdstStep, LSL #2
- VST1 dQ_0n, [pSrcDst], srcdstStep
- ADDS XY, XY, XY
- VST1 dQ_1n, [pSrcDst]
- ADD pSrcDst, pTmp, #8
-
- BCC LoopX
- B ExitLoopY
-
-NoFilterBS0
- ADD pSrcDst, pSrcDst, #8
- ADDS XY, XY, XY
- ADD pThresholds, pThresholds, #2
- BCC LoopX
- B ExitLoopY
-bSGE4
- ;// bS >= 4 Filtering
- SUB pSrcDst, pSrcDst, srcdstStep, LSL #2
- SUB pSrcDst, pSrcDst, srcdstStep, LSL #1
- BL armVCM4P10_DeblockingLumabSGE4_unsafe
-
- ;// Result Storage
- VST1 dP_2n, [pSrcDst], srcdstStep
- VST1 dP_1n, [pSrcDst], srcdstStep
- VST1 dP_0n, [pSrcDst], srcdstStep
- SUB pTmp, pSrcDst, srcdstStep, LSL #2
- VST1 dQ_0n, [pSrcDst], srcdstStep
- ADDS XY,XY,XY
- VST1 dQ_1n, [pSrcDst], srcdstStep
- ADD pThresholds, pThresholds, #2
- VST1 dQ_2n, [pSrcDst]
-
- ADD pSrcDst, pTmp, #8
- BCC LoopX
-
-ExitLoopY
-
- SUB pSrcDst, pSrcDst, #16
- VLD1 {dAlpha[]}, [pAlpha_1]
- ADD pSrcDst, pSrcDst, srcdstStep, LSL #2
- VLD1 {dBeta[]}, [pBeta_1]
- BNE LoopY
-
- MOV r0, #OMX_Sts_NoErr
-
- M_END
-
- ENDIF
-
-
-
-
- END
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_VerEdge_I_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_VerEdge_I_s.s
deleted file mode 100644
index d2a134e..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_VerEdge_I_s.s
+++ /dev/null
@@ -1,450 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_FilterDeblockingLuma_VerEdge_I_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS CortexA8
-
- IMPORT armVCM4P10_DeblockingLumabSLT4_unsafe
- IMPORT armVCM4P10_DeblockingLumabSGE4_unsafe
-
- IF CortexA8
-
-LOOP_COUNT EQU 0x11000000
-
-
-;// Function arguments
-
-pSrcDst RN 0
-srcdstStep RN 1
-pAlpha RN 2
-pBeta RN 3
-
-pThresholds RN 5
-pBS RN 4
-bS10 RN 12
-
-pAlpha_0 RN 2
-pBeta_0 RN 3
-
-pAlpha_1 RN 7
-pBeta_1 RN 8
-
-pTmp RN 10
-pTmpStep RN 11
-
-;// Loop
-
-XY RN 9
-
-;// Rows input
-dRow0 DN D7.U8
-dRow1 DN D8.U8
-dRow2 DN D5.U8
-dRow3 DN D10.U8
-dRow4 DN D6.U8
-dRow5 DN D9.U8
-dRow6 DN D4.U8
-dRow7 DN D11.U8
-
-;// dRow0 - dP_3, dRow1 - dQ_0, dRow2 - dP_1, dRow3 - dQ_2
-;// dRow4 - dP_2, dRow5 - dQ_1, dRow6 - dP_0, dRow7 - dQ_3
-
-;// Rows output
-dRown0 DN D7.U8
-dRown1 DN D24.U8
-dRown2 DN D30.U8
-dRown3 DN D10.U8
-dRown4 DN D6.U8
-dRown5 DN D25.U8
-dRown6 DN D29.U8
-dRown7 DN D11.U8
-
-;// dP_0n DN D29.U8
-;// dP_1n DN D30.U8
-;// dP_2n DN D31.U8
-;//
-;// dQ_0n DN D24.U8 ;!!;Temp2
-;// dQ_1n DN D25.U8 ;!!;Temp2
-;// dQ_2n DN D28.U8 ;!!;dQ_0t
-;//
-;// dRown0 - dP_3, dRown1 - dQ_0n
-;// dRown2 - dP_1n, dRown3 - dQ_2
-;// dRown4 - dP_2, dRown5 - dQ_1n
-;// dRown6 - dP_0n, dRown7 - dQ_3
-
-dRow0n DN D7.U8
-dRow1n DN D24.U8
-dRow2n DN D30.U8
-dRow3n DN D28.U8
-dRow4n DN D31.U8
-dRow5n DN D25.U8
-dRow6n DN D29.U8
-dRow7n DN D11.U8
-
-;// dRow0n - dP_3, dRow1n - dQ_0n, dRow2n - dP_1n, dRow3n - dQ_2n
-;// dRow4n - dP_2, dRow5n - dQ_1n, dRow6n - dP_0n, dRow7n - dQ_3
-
-;// Pixels
-dP_0 DN D4.U8
-dP_1 DN D5.U8
-dP_2 DN D6.U8
-dP_3 DN D7.U8
-dQ_0 DN D8.U8
-dQ_1 DN D9.U8
-dQ_2 DN D10.U8
-dQ_3 DN D11.U8
-
-
-;// Filtering Decision
-dAlpha DN D0.U8
-dBeta DN D2.U8
-
-dFilt DN D16.U8
-dAqflg DN D12.U8
-dApflg DN D17.U8
-
-dAp0q0 DN D13.U8
-dAp1p0 DN D12.U8
-dAq1q0 DN D18.U8
-dAp2p0 DN D19.U8
-dAq2q0 DN D17.U8
-
-;// bSLT4
-dTC0 DN D18.U8
-dTC1 DN D19.U8
-dTC01 DN D18.U8
-
-dTCs DN D31.S8
-dTC DN D31.U8
-
-dMask_0 DN D14.U8
-dMask_1 DN D15.U8
-
-Mask_0 RN 6
-
-dTemp DN D19.U8
-
-;// Computing P0,Q0
-qDq0p0 QN Q10.S16
-qDp1q1 QN Q11.S16
-qDelta QN Q10.S16 ; reuse qDq0p0
-dDelta DN D20.S8
-
-
-;// Computing P1,Q1
-dRp0q0 DN D24.U8
-
-dMaxP DN D23.U8
-dMinP DN D22.U8
-
-dMaxQ DN D19.U8
-dMinQ DN D21.U8
-
-dDeltaP DN D26.U8
-dDeltaQ DN D27.U8
-
-qP_0n QN Q14.S16
-qQ_0n QN Q12.S16
-
-dQ_0n DN D24.U8
-dQ_1n DN D25.U8
-dP_0n DN D29.U8
-dP_1n DN D30.U8
-
-;// bSGE4
-
-qSp0q0 QN Q10.U16
-
-qSp2q1 QN Q11.U16
-qSp0q0p1 QN Q12.U16
-qSp3p2 QN Q13.U16
-dHSp0q1 DN D28.U8
-
-qSq2p1 QN Q11.U16
-qSp0q0q1 QN Q12.U16
-qSq3q2 QN Q13.U16 ;!!
-dHSq0p1 DN D28.U8 ;!!
-
-qTemp1 QN Q11.U16 ;!!;qSp2q1
-qTemp2 QN Q12.U16 ;!!;qSp0q0p1
-
-dP_0t DN D28.U8 ;!!;dHSp0q1
-dQ_0t DN D22.U8 ;!!;Temp1
-
-dP_0n DN D29.U8
-dP_1n DN D30.U8
-dP_2n DN D31.U8
-
-dQ_0n DN D24.U8 ;!!;Temp2
-dQ_1n DN D25.U8 ;!!;Temp2
-dQ_2n DN D28.U8 ;!!;dQ_0t
-
-
- ;// Function header
- M_START omxVCM4P10_FilterDeblockingLuma_VerEdge_I, r11, d15
-
- ;//Arguments on the stack
- M_ARG ppThresholds, 4
- M_ARG ppBS, 4
-
- ;// d0-dAlpha_0
- ;// d2-dBeta_0
-
- ADD pAlpha_1, pAlpha_0, #1
- ADD pBeta_1, pBeta_0, #1
-
- VLD1 {dAlpha[]}, [pAlpha_0]
- SUB pSrcDst, pSrcDst, #4
- VLD1 {dBeta[]}, [pBeta_0]
-
- M_LDR pBS, ppBS
- M_LDR pThresholds, ppThresholds
-
- MOV Mask_0,#0
-
- ;dMask_0-14
- ;dMask_1-15
-
- VMOV dMask_0, #0
- VMOV dMask_1, #1
-
- LDR XY,=LOOP_COUNT
-
- ADD pTmpStep, srcdstStep, srcdstStep
-
- ;// p0-p3 - d4-d7
- ;// q0-q3 - d8-d11
-LoopY
-LoopX
- LDRH bS10, [pBS], #4
-
- CMP bS10, #0
- BEQ NoFilterBS0
-
- ;// Load 8 rows of data
- ADD pTmp, pSrcDst, srcdstStep
- VLD1 dRow0, [pSrcDst], pTmpStep
- VLD1 dRow1, [pTmp], pTmpStep
- VLD1 dRow2, [pSrcDst], pTmpStep
- VZIP.8 dRow0, dRow1
- VLD1 dRow3, [pTmp], pTmpStep
- VLD1 dRow4, [pSrcDst], pTmpStep
- VZIP.8 dRow2, dRow3
- VLD1 dRow5, [pTmp], pTmpStep
- VLD1 dRow6, [pSrcDst], pTmpStep
- VLD1 dRow7, [pTmp], pTmpStep
- VZIP.8 dRow4, dRow5
- VZIP.16 dRow1, dRow3
-
-
- ;// dRow0 = [q3r0 q2r0 q1r0 q0r0 p0r0 p1r0 p2r0 p3r0]
- ;// dRow1 = [q3r1 q2r1 q1r1 q0r1 p0r1 p1r1 p2r1 p3r1]
- ;// dRow2 = [q3r2 q2r2 q1r2 q0r2 p0r2 p1r2 p2r2 p3r2]
- ;// dRow3 = [q3r3 q2r3 q1r3 q0r3 p0r3 p1r3 p2r3 p3r3]
- ;// dRow4 = [q3r4 q2r4 q1r4 q0r4 p0r4 p1r4 p2r4 p3r4]
- ;// dRow5 = [q3r5 q2r5 q1r5 q0r5 p0r5 p1r5 p2r5 p3r5]
- ;// dRow6 = [q3r6 q2r6 q1r6 q0r6 p0r6 p1r6 p2r6 p3r6]
- ;// dRow7 = [q3r7 q2r7 q1r7 q0r7 p0r7 p1r7 p2r7 p3r7]
-
- ;// 8x8 Transpose
-
- VZIP.8 dRow6, dRow7
-
- SUB pSrcDst, pSrcDst, srcdstStep, LSL #3
- VZIP.16 dRow0, dRow2
- VZIP.16 dRow5, dRow7
-
-
- VZIP.16 dRow4, dRow6
- VZIP.32 dRow1, dRow5
- VZIP.32 dRow2, dRow6
- VZIP.32 dRow3, dRow7
- VZIP.32 dRow0, dRow4
-
-
- ;// dRow0 - dP_3, dRow1 - dQ_0, dRow2 - dP_1, dRow3 - dQ_2
- ;// dRow4 - dP_2, dRow5 - dQ_1, dRow6 - dP_0, dRow7 - dQ_3
-
- ;// dQ_0 = [q0r7 q0r6 q0r5 q0r4 q0r3 q0r2 q0r1 q0r0]
- ;// dQ_1 = [q1r7 q1r6 q1r5 q1r4 q1r3 q1r2 q1r1 q1r0]
- ;// dQ_2 = [q2r7 q2r6 q2r5 q2r4 q2r3 q2r2 q2r1 q2r0]
- ;// dQ_3 = [q3r7 q3r6 q3r5 q3r4 q3r3 q3r2 q3r1 q3r0]
-
- ;// dP_0 = [p0r7 p0r6 p0r5 p0r4 p0r3 p0r2 p0r1 p0r0]
- ;// dP_1 = [p1r7 p1r6 p1r5 p1r4 p1r3 p1r2 p1r1 p1r0]
- ;// dP_2 = [p2r7 p2r6 p2r5 p2r4 p2r3 p2r2 p2r1 p2r0]
- ;// dP_3 = [p3r7 p3r6 p3r5 p3r4 p3r3 p3r2 p3r1 p3r0]
-
- VABD dAp0q0, dP_0, dQ_0
- VABD dAp1p0, dP_1, dP_0
-
- VABD dAq1q0, dQ_1, dQ_0
- VABD dAp2p0, dP_2, dP_0
-
- TST bS10, #0xff
- VCGT dFilt, dAlpha, dAp0q0
-
- VMAX dAp1p0, dAq1q0, dAp1p0
- VABD dAq2q0, dQ_2, dQ_0
-
- VMOVEQ.U32 dFilt[0], Mask_0
- TST bS10, #0xff00
-
- VCGT dAp2p0, dBeta, dAp2p0
- VCGT dAp1p0, dBeta, dAp1p0
-
- VMOVEQ.U32 dFilt[1], Mask_0
-
- VCGT dAq2q0, dBeta, dAq2q0
- VAND dFilt, dFilt, dAp1p0
- TST bS10, #4
-
- VAND dAqflg, dFilt, dAq2q0
- VAND dApflg, dFilt, dAp2p0
-
- BNE bSGE4
-bSLT4
- ;// bS < 4 Filtering
-
- BL armVCM4P10_DeblockingLumabSLT4_unsafe
-
- ;// Transpose
-
- VZIP.8 dP_3, dP_2
- VZIP.8 dP_1n, dP_0n
- VZIP.8 dQ_0n, dQ_1n
- VZIP.8 dQ_2, dQ_3
-
-
- VZIP.16 dP_3, dP_1n
- ADD pTmp, pSrcDst, srcdstStep
- VZIP.16 dQ_0n, dQ_2
- VZIP.16 dQ_1n, dQ_3
- VZIP.16 dP_2, dP_0n
-
- VZIP.32 dP_3, dQ_0n
- VZIP.32 dP_1n, dQ_2
- VZIP.32 dP_2, dQ_1n
- VZIP.32 dP_0n, dQ_3
-
- ;// dRown0 - dP_3, dRown1 - dQ_0n
- ;// dRown2 - dP_1n, dRown3 - dQ_2
- ;// dRown4 - dP_2, dRown5 - dQ_1n
- ;// dRown6 - dP_0n, dRown7 - dQ_3
-
- VST1 dRown0, [pSrcDst], pTmpStep
- VST1 dRown1, [pTmp], pTmpStep
- VST1 dRown2, [pSrcDst], pTmpStep
- VST1 dRown3, [pTmp], pTmpStep
- ;1
- VST1 dRown4, [pSrcDst], pTmpStep
- VST1 dRown5, [pTmp], pTmpStep
- ADDS XY, XY, XY
- VST1 dRown6, [pSrcDst], pTmpStep
- ADD pThresholds, pThresholds, #2
- VST1 dRown7, [pTmp], srcdstStep
-
- SUB pSrcDst, pSrcDst, srcdstStep, LSL #3
- VLD1 {dAlpha[]}, [pAlpha_1]
- ADD pSrcDst, pSrcDst, #4
- VLD1 {dBeta[]}, [pBeta_1]
-
- BCC LoopX
- B ExitLoopY
-
-NoFilterBS0
- ADD pSrcDst, pSrcDst, #4
- ADDS XY, XY, XY
- VLD1 {dAlpha[]}, [pAlpha_1]
- ADD pThresholds, pThresholds, #4
- VLD1 {dBeta[]}, [pBeta_1]
- BCC LoopX
- B ExitLoopY
-bSGE4
- ;// bS >= 4 Filtering
-
- BL armVCM4P10_DeblockingLumabSGE4_unsafe
-
- ;// Transpose
-
- VZIP.8 dP_3, dP_2n
- VZIP.8 dP_1n, dP_0n
- VZIP.8 dQ_0n, dQ_1n
- VZIP.8 dQ_2n, dQ_3
-
- VZIP.16 dP_3, dP_1n
- ADD pTmp, pSrcDst, srcdstStep
- VZIP.16 dQ_0n, dQ_2n
- VZIP.16 dQ_1n, dQ_3
- VZIP.16 dP_2n, dP_0n
-
- VZIP.32 dP_3, dQ_0n
- VZIP.32 dP_1n, dQ_2n
- VZIP.32 dP_2n, dQ_1n
- VZIP.32 dP_0n, dQ_3
-
- ;// dRow0n - dP_3, dRow1n - dQ_0n, dRow2n - dP_1n, dRow3n - dQ_2n
- ;// dRow4n - dP_2, dRow5n - dQ_1n, dRow6n - dP_0n, dRow7n - dQ_3
-
- VST1 dRow0n, [pSrcDst], pTmpStep
- VST1 dRow1n, [pTmp], pTmpStep
- VST1 dRow2n, [pSrcDst], pTmpStep
- VST1 dRow3n, [pTmp], pTmpStep
- VST1 dRow4n, [pSrcDst], pTmpStep
- VST1 dRow5n, [pTmp], pTmpStep
- ADDS XY,XY,XY
- VST1 dRow6n, [pSrcDst], pTmpStep
- ADD pThresholds, pThresholds, #4
- VST1 dRow7n, [pTmp], pTmpStep
-
- SUB pSrcDst, pSrcDst, srcdstStep, LSL #3
- VLD1 {dAlpha[]}, [pAlpha_1]
- ADD pSrcDst, pSrcDst, #4
- VLD1 {dBeta[]}, [pBeta_1]
-
- BCC LoopX
-
-ExitLoopY
- SUB pBS, pBS, #14
- SUB pThresholds, pThresholds, #14
- SUB pSrcDst, pSrcDst, #16
- VLD1 {dAlpha[]}, [pAlpha_0]
- ADD pSrcDst, pSrcDst, srcdstStep, LSL #3
- VLD1 {dBeta[]}, [pBeta_0]
- BNE LoopY
-
- MOV r0, #OMX_Sts_NoErr
-
- M_END
-
- ENDIF
-
-
- END
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_InterpolateChroma.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_InterpolateChroma.c
deleted file mode 100644
index c6b3f41..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_InterpolateChroma.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_InterpolateChroma.c
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- * Description:
- * This function will calculate 1/8 Pixel interpolation for Chroma Block
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-
-/**
- * Function: omxVCM4P10_InterpolateChroma,
- *
- * Description:
- * Performs 1/8-pixel interpolation for inter chroma MB.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrc Pointer to the source reference frame buffer
- * [in] srcStep Reference frame step in byte
- * [in] dstStep Destination frame step in byte. Must be multiple of roi.width.
- * [in] dx Fractional part of horizontal motion vector component
- * in 1/8 pixel unit;valid in the range [0,7]
- * [in] dy Fractional part of vertical motion vector component
- * in 1/8 pixel unit;valid in the range [0,7]
- * [in] roi Dimension of the interpolation region;the parameters roi.width and roi.height must
- * be equal to either 2, 4, or 8.
- * [out] pDst Pointer to the destination frame buffer.
- * if roi.width==2, 2-byte alignment required
- * if roi.width==4, 4-byte alignment required
- * if roi.width==8, 8-byte alignment required
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns OMX_Sts_BadArgErr:
- * pSrc or pDst is NULL.
- * srcStep or dstStep < 8.
- * dx or dy is out of range [0-7].
- * roi.width or roi.height is out of range {2,4,8}.
- * roi.width is equal to 2, but pDst is not 2-byte aligned.
- * roi.width is equal to 4, but pDst is not 4-byte aligned.
- * roi.width is equal to 8, but pDst is not 8 byte aligned.
- * srcStep or dstStep is not a multiple of 8.
- *
- */
-
-OMXResult omxVCM4P10_InterpolateChroma (
- const OMX_U8* pSrc,
- OMX_S32 srcStep,
- OMX_U8* pDst,
- OMX_S32 dstStep,
- OMX_S32 dx,
- OMX_S32 dy,
- OMXSize roi
- )
-{
- return armVCM4P10_Interpolate_Chroma
- ((OMX_U8*)pSrc, srcStep, pDst, dstStep, roi.width, roi.height, dx, dy);
-}
-
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_InterpolateLuma_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_InterpolateLuma_s.s
deleted file mode 100644
index 9f8f69e..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_InterpolateLuma_s.s
+++ /dev/null
@@ -1,567 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_InterpolateLuma_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
-;// Function:
-;// omxVCM4P10_InterpolateLuma
-;//
-;// This function implements omxVCM4P10_InterpolateLuma in v6 assembly.
-;// Performs quarter pel interpolation of inter luma MB.
-;// It's assumed that the frame is already padded when calling this function.
-;// Parameters:
-;// [in] pSrc Pointer to the source reference frame buffer
-;// [in] srcStep Reference frame step in byte
-;// [in] dstStep Destination frame step in byte. Must be multiple of roi.width
-;// [in] dx Fractional part of horizontal motion vector
-;// component in 1/4 pixel unit; valid in the range [0,3]
-;// [in] dy Fractional part of vertical motion vector
-;// component in 1/4 pixel unit; valid in the range [0,3]
-;// [in] roi Dimension of the interpolation region;the parameters roi.width and roi.height must
-;// be equal to either 4, 8, or 16.
-;// [out] pDst Pointer to the destination frame buffer.
-;// if roi.width==4, 4-byte alignment required
-;// if roi.width==8, 8-byte alignment required
-;// if roi.width==16, 16-byte alignment required
-;//
-;// Return Value:
-;// If the function runs without error, it returns OMX_Sts_NoErr.
-;// It is assued that following cases are satisfied before calling this function:
-;// pSrc or pDst is not NULL.
-;// srcStep or dstStep >= roi.width.
-;// dx or dy is in the range [0-3].
-;// roi.width or roi.height is not out of range {4, 8, 16}.
-;// If roi.width is equal to 4, Dst is 4 byte aligned.
-;// If roi.width is equal to 8, pDst is 8 byte aligned.
-;// If roi.width is equal to 16, pDst is 16 byte aligned.
-;// srcStep and dstStep is multiple of 8.
-;//
-;//
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS CortexA8
-
- EXPORT omxVCM4P10_InterpolateLuma
-
-
- IF CortexA8
- IMPORT armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- IMPORT armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- IMPORT armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe
- IMPORT armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe
- ENDIF
-
-
-
-;// Declare input registers
-pSrc RN 0
-srcStep RN 1
-pDst RN 2
-dstStep RN 3
-iHeight RN 4
-iWidth RN 5
-
-;// Declare other intermediate registers
-idx RN 6
-idy RN 7
-index RN 6
-Temp RN 12
-pArgs RN 11
-
-
- IF CortexA8
-
- ;//
- ;// Interpolation of luma is implemented by processing block of pixels, size 4x4 at a time.
- ;//
- M_ALLOC4 ppArgs, 16
-
- ;// Function header
- M_START omxVCM4P10_InterpolateLuma, r11, d15
-
-pSrcBK RN 8
-
-;// Declare Neon registers
-dCoeff5 DN 30.S16
-dCoeff20 DN 31.S16
-
-;// Registers used for implementing Horizontal interpolation
-dSrc0c DN 14.U8
-dSrc1c DN 16.U8
-dSrc2c DN 18.U8
-dSrc3c DN 20.U8
-dSrc0d DN 15.U8
-dSrc1d DN 17.U8
-dSrc2d DN 19.U8
-dSrc3d DN 21.U8
-dAccH0 DN 22.U8
-dAccH1 DN 24.U8
-dAccH2 DN 26.U8
-dAccH3 DN 28.U8
-dResultH0 DN 22.U32
-dResultH1 DN 24.U32
-dResultH2 DN 26.U32
-dResultH3 DN 28.U32
-
-;// Registers used for implementing Vertical interpolation
-dSrc0 DN 9.U8
-dSrc1 DN 10.U8
-dSrc2 DN 11.U8
-dSrc3 DN 12.U8
-dSrc4 DN 13.U8
-dAccV0 DN 0.U8
-dAccV1 DN 2.U8
-dAccV2 DN 4.U8
-dAccV3 DN 6.U8
-dResultV0 DN 0.U32
-dResultV1 DN 2.U32
-dResultV2 DN 4.U32
-dResultV3 DN 6.U32
-
-;// Registers used for implementing Diagonal interpolation
-dTAcc0 DN 0.U8
-dTAcc1 DN 2.U8
-dTAcc2 DN 4.U8
-dTAcc3 DN 6.U8
-dTRes0 DN 0.32
-dTRes1 DN 2.32
-dTRes2 DN 4.32
-dTRes3 DN 6.32
-dTResult0 DN 14.U8
-dTResult1 DN 16.U8
-dTResult2 DN 18.U8
-dTResult3 DN 20.U8
-dTempP0 DN 18.S16
-dTempP1 DN 19.S16
-dTempQ0 DN 20.S16
-dTempQ1 DN 21.S16
-dTempR0 DN 22.S16
-dTempR1 DN 23.S16
-dTempS0 DN 24.S16
-dTempS1 DN 25.S16
-qTempP01 QN 9.S16
-qTempQ01 QN 10.S16
-qTempR01 QN 11.S16
-qTempS01 QN 12.S16
-
-;// Intermediate values for averaging
-qRes2 QN 7.S16
-qRes3 QN 8.S16
-qRes4 QN 9.S16
-qRes5 QN 10.S16
-qRes6 QN 11.S16
-
-;// For implementing copy
-dDst0 DN 9.32
-dDst1 DN 10.32
-dDst2 DN 11.32
-dDst3 DN 12.32
-
- ;// Define stack arguments
- M_ARG ptridx, 4
- M_ARG ptridy, 4
- M_ARG ptrWidth, 4
- M_ARG ptrHeight, 4
-
- ;// Load structure elements of roi
- M_LDR idx, ptridx
- M_LDR idy, ptridy
- M_LDR iWidth, ptrWidth
- M_LDR iHeight, ptrHeight
-
- ADD index, idx, idy, LSL #2 ;// [index] = [idy][idx]
- M_ADR pArgs, ppArgs
-
- ;// Move coefficients Neon registers
- VMOV dCoeff20, #20
- VMOV dCoeff5, #5
-
-Block4x4WidthLoop
-Block4x4HeightLoop
-
- STM pArgs, {pSrc,srcStep,pDst,dstStep}
-
- ;// switch table using motion vector as index
- ADD pc, pc, index, LSL #2
- B Case_f
- B Case_0
- B Case_1
- B Case_2
- B Case_3
- B Case_4
- B Case_5
- B Case_6
- B Case_7
- B Case_8
- B Case_9
- B Case_a
- B Case_b
- B Case_c
- B Case_d
- B Case_e
- B Case_f
-
-Case_0
- ;// Case G
- M_PRINTF "Case 0 \n"
-
- ;// Loads a 4x4 block of .8 and stores as .32
- ADD Temp, pSrc, srcStep, LSL #1
- VLD1 dSrc0, [pSrc], srcStep
- VLD1 dSrc2, [Temp], srcStep
- VLD1 dSrc1, [pSrc]
- VLD1 dSrc3, [Temp]
-
- ADD Temp, pDst, dstStep, LSL #1
- VST1 dDst0[0], [pDst], dstStep
- VST1 dDst2[0], [Temp], dstStep
- VST1 dDst1[0], [pDst]
- VST1 dDst3[0], [Temp]
- M_ADR pArgs, ppArgs
- B Block4x4LoopEnd
-Case_1
- ;// Case a
- M_PRINTF "Case 1 \n"
-
- SUB pSrc, pSrc, #2
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- VRHADD dAccH0, dAccH0, dSrc0c
- VRHADD dAccH2, dAccH2, dSrc2c
- VRHADD dAccH1, dAccH1, dSrc1c
- VRHADD dAccH3, dAccH3, dSrc3c
- ADD Temp, pDst, dstStep, LSL #1
- VST1 dResultH0[0], [pDst], dstStep
- VST1 dResultH2[0], [Temp], dstStep
- VST1 dResultH1[0], [pDst]
- VST1 dResultH3[0], [Temp]
- M_ADR pArgs, ppArgs
- B Block4x4LoopEnd
-Case_2
- ;// Case b
- M_PRINTF "Case 2 \n"
-
- SUB pSrc, pSrc, #2
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- ADD Temp, pDst, dstStep, LSL #1
- VST1 dResultH0[0], [pDst], dstStep
- VST1 dResultH2[0], [Temp], dstStep
- VST1 dResultH1[0], [pDst]
- VST1 dResultH3[0], [Temp]
- M_ADR pArgs, ppArgs
- B Block4x4LoopEnd
-Case_3
- ;// Case c
- M_PRINTF "Case 3 \n"
-
- SUB pSrc, pSrc, #2
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- VRHADD dAccH0, dAccH0, dSrc0d
- VRHADD dAccH2, dAccH2, dSrc2d
- VRHADD dAccH1, dAccH1, dSrc1d
- VRHADD dAccH3, dAccH3, dSrc3d
- ADD Temp, pDst, dstStep, LSL #1
- VST1 dResultH0[0], [pDst], dstStep
- VST1 dResultH2[0], [Temp], dstStep
- VST1 dResultH1[0], [pDst]
- VST1 dResultH3[0], [Temp]
- M_ADR pArgs, ppArgs
- B Block4x4LoopEnd
-Case_4
- ;// Case d
- M_PRINTF "Case 4 \n"
-
- SUB pSrc, pSrc, srcStep, LSL #1
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- VRHADD dAccV0, dAccV0, dSrc0
- VRHADD dAccV2, dAccV2, dSrc2
- VRHADD dAccV1, dAccV1, dSrc1
- VRHADD dAccV3, dAccV3, dSrc3
- ADD Temp, pDst, dstStep, LSL #1
- VST1 dResultV0[0], [pDst], dstStep
- VST1 dResultV2[0], [Temp], dstStep
- VST1 dResultV1[0], [pDst]
- VST1 dResultV3[0], [Temp]
- M_ADR pArgs, ppArgs
- B Block4x4LoopEnd
-Case_5
- ;// Case e
- M_PRINTF "Case 5 \n"
-
- MOV pSrcBK, pSrc
- SUB pSrc, pSrc, srcStep, LSL #1
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- SUB pSrc, pSrcBK, #2
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- VRHADD dAccH0, dAccH0, dAccV0
- VRHADD dAccH2, dAccH2, dAccV2
- VRHADD dAccH1, dAccH1, dAccV1
- VRHADD dAccH3, dAccH3, dAccV3
- ADD Temp, pDst, dstStep, LSL #1
- VST1 dResultH0[0], [pDst], dstStep
- VST1 dResultH2[0], [Temp], dstStep
- VST1 dResultH1[0], [pDst]
- VST1 dResultH3[0], [Temp]
-
- M_ADR pArgs, ppArgs
- B Block4x4LoopEnd
-Case_6
- ;// Case f
- M_PRINTF "Case 6 \n"
-
- SUB pSrc, pSrc, srcStep, LSL #1
- SUB pSrc, pSrc, #2
- BL armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe
- VQRSHRUN dTResult0, qRes2, #5
- VQRSHRUN dTResult1, qRes3, #5
- VQRSHRUN dTResult2, qRes4, #5
- VQRSHRUN dTResult3, qRes5, #5
- VRHADD dTAcc0, dTAcc0, dTResult0
- VRHADD dTAcc2, dTAcc2, dTResult2
- VRHADD dTAcc1, dTAcc1, dTResult1
- VRHADD dTAcc3, dTAcc3, dTResult3
- ADD Temp, pDst, dstStep, LSL #1
- VST1 dTRes0[0], [pDst], dstStep
- VST1 dTRes2[0], [Temp], dstStep
- VST1 dTRes1[0], [pDst]
- VST1 dTRes3[0], [Temp]
-
- M_ADR pArgs, ppArgs
- B Block4x4LoopEnd
-Case_7
- ;// Case g
- M_PRINTF "Case 7 \n"
- MOV pSrcBK, pSrc
- ADD pSrc, pSrc, #1
- SUB pSrc, pSrc, srcStep, LSL #1
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- SUB pSrc, pSrcBK, #2
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- VRHADD dAccH0, dAccH0, dAccV0
- VRHADD dAccH2, dAccH2, dAccV2
- VRHADD dAccH1, dAccH1, dAccV1
- VRHADD dAccH3, dAccH3, dAccV3
- ADD Temp, pDst, dstStep, LSL #1
- VST1 dResultH0[0], [pDst], dstStep
- VST1 dResultH2[0], [Temp], dstStep
- VST1 dResultH1[0], [pDst]
- VST1 dResultH3[0], [Temp]
-
- M_ADR pArgs, ppArgs
- B Block4x4LoopEnd
-Case_8
- ;// Case h
- M_PRINTF "Case 8 \n"
-
- SUB pSrc, pSrc, srcStep, LSL #1
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- ADD Temp, pDst, dstStep, LSL #1
- VST1 dResultV0[0], [pDst], dstStep
- VST1 dResultV2[0], [Temp], dstStep
- VST1 dResultV1[0], [pDst]
- VST1 dResultV3[0], [Temp]
- M_ADR pArgs, ppArgs
- B Block4x4LoopEnd
-Case_9
- ;// Case i
- M_PRINTF "Case 9 \n"
- SUB pSrc, pSrc, srcStep, LSL #1
- SUB pSrc, pSrc, #2
- BL armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe
- VEXT dTempP0, dTempP0, dTempP1, #2
- VEXT dTempQ0, dTempQ0, dTempQ1, #2
- VEXT dTempR0, dTempR0, dTempR1, #2
- VEXT dTempS0, dTempS0, dTempS1, #2
-
- VQRSHRUN dTResult0, qTempP01, #5
- VQRSHRUN dTResult1, qTempQ01, #5
- VQRSHRUN dTResult2, qTempR01, #5
- VQRSHRUN dTResult3, qTempS01, #5
-
- VRHADD dTAcc0, dTAcc0, dTResult0
- VRHADD dTAcc2, dTAcc2, dTResult2
- VRHADD dTAcc1, dTAcc1, dTResult1
- VRHADD dTAcc3, dTAcc3, dTResult3
- ADD Temp, pDst, dstStep, LSL #1
- VST1 dTRes0[0], [pDst], dstStep
- VST1 dTRes2[0], [Temp], dstStep
- VST1 dTRes1[0], [pDst]
- VST1 dTRes3[0], [Temp]
- M_ADR pArgs, ppArgs
- B Block4x4LoopEnd
-Case_a
- ;// Case j
- M_PRINTF "Case a \n"
-
- SUB pSrc, pSrc, srcStep, LSL #1
- SUB pSrc, pSrc, #2
- BL armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe
- ADD Temp, pDst, dstStep, LSL #1
- VST1 dTRes0[0], [pDst], dstStep
- VST1 dTRes2[0], [Temp], dstStep
- VST1 dTRes1[0], [pDst]
- VST1 dTRes3[0], [Temp]
- M_ADR pArgs, ppArgs
- B Block4x4LoopEnd
-Case_b
- ;// Case k
- M_PRINTF "Case b \n"
- SUB pSrc, pSrc, srcStep, LSL #1
- SUB pSrc, pSrc, #2
- BL armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe
- VEXT dTempP0, dTempP0, dTempP1, #3
- VEXT dTempQ0, dTempQ0, dTempQ1, #3
- VEXT dTempR0, dTempR0, dTempR1, #3
- VEXT dTempS0, dTempS0, dTempS1, #3
-
- VQRSHRUN dTResult0, qTempP01, #5
- VQRSHRUN dTResult1, qTempQ01, #5
- VQRSHRUN dTResult2, qTempR01, #5
- VQRSHRUN dTResult3, qTempS01, #5
-
- VRHADD dTAcc0, dTAcc0, dTResult0
- VRHADD dTAcc2, dTAcc2, dTResult2
- VRHADD dTAcc1, dTAcc1, dTResult1
- VRHADD dTAcc3, dTAcc3, dTResult3
- ADD Temp, pDst, dstStep, LSL #1
- VST1 dTRes0[0], [pDst], dstStep
- VST1 dTRes2[0], [Temp], dstStep
- VST1 dTRes1[0], [pDst]
- VST1 dTRes3[0], [Temp]
- M_ADR pArgs, ppArgs
- B Block4x4LoopEnd
-Case_c
- ;// Case n
- M_PRINTF "Case c \n"
-
- SUB pSrc, pSrc, srcStep, LSL #1
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- VRHADD dAccV0, dAccV0, dSrc1
- VRHADD dAccV2, dAccV2, dSrc3
- VRHADD dAccV1, dAccV1, dSrc2
- VRHADD dAccV3, dAccV3, dSrc4
- ADD Temp, pDst, dstStep, LSL #1
- VST1 dResultV0[0], [pDst], dstStep
- VST1 dResultV2[0], [Temp], dstStep
- VST1 dResultV1[0], [pDst]
- VST1 dResultV3[0], [Temp]
- M_ADR pArgs, ppArgs
- B Block4x4LoopEnd
-Case_d
- ;// Case p
- M_PRINTF "Case d \n"
-
- MOV pSrcBK, pSrc
- SUB pSrc, pSrc, srcStep, LSL #1
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- ADD pSrc, pSrcBK, srcStep
- SUB pSrc, pSrc, #2
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- VRHADD dAccH0, dAccH0, dAccV0
- VRHADD dAccH2, dAccH2, dAccV2
- VRHADD dAccH1, dAccH1, dAccV1
- VRHADD dAccH3, dAccH3, dAccV3
- ADD Temp, pDst, dstStep, LSL #1
- VST1 dResultH0[0], [pDst], dstStep
- VST1 dResultH2[0], [Temp], dstStep
- VST1 dResultH1[0], [pDst]
- VST1 dResultH3[0], [Temp]
- M_ADR pArgs, ppArgs
- B Block4x4LoopEnd
-Case_e
- ;// Case q
- M_PRINTF "Case e \n"
-
- SUB pSrc, pSrc, srcStep, LSL #1
- SUB pSrc, pSrc, #2
- BL armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe
- VQRSHRUN dTResult0, qRes3, #5
- VQRSHRUN dTResult1, qRes4, #5
- VQRSHRUN dTResult2, qRes5, #5
- VQRSHRUN dTResult3, qRes6, #5
-
- VRHADD dTAcc0, dTAcc0, dTResult0
- VRHADD dTAcc2, dTAcc2, dTResult2
- VRHADD dTAcc1, dTAcc1, dTResult1
- VRHADD dTAcc3, dTAcc3, dTResult3
- ADD Temp, pDst, dstStep, LSL #1
- VST1 dTRes0[0], [pDst], dstStep
- VST1 dTRes2[0], [Temp], dstStep
- VST1 dTRes1[0], [pDst]
- VST1 dTRes3[0], [Temp]
- M_ADR pArgs, ppArgs
- B Block4x4LoopEnd
-Case_f
- ;// Case r
- M_PRINTF "Case f \n"
- MOV pSrcBK, pSrc
- ADD pSrc, pSrc, #1
- SUB pSrc, pSrc, srcStep, LSL #1
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- ADD pSrc, pSrcBK, srcStep
- SUB pSrc, pSrc, #2
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- VRHADD dAccH0, dAccH0, dAccV0
- VRHADD dAccH2, dAccH2, dAccV2
- VRHADD dAccH1, dAccH1, dAccV1
- VRHADD dAccH3, dAccH3, dAccV3
- ADD Temp, pDst, dstStep, LSL #1
- VST1 dResultH0[0], [pDst], dstStep
- VST1 dResultH2[0], [Temp], dstStep
- VST1 dResultH1[0], [pDst]
- VST1 dResultH3[0], [Temp]
- M_ADR pArgs, ppArgs
-
-
-Block4x4LoopEnd
-
- ;// Width Loop
- ;//M_ADR pArgs, ppArgs
- LDM pArgs, {pSrc,srcStep,pDst,dstStep} ;// Load arguments
- SUBS iWidth, iWidth, #4
- ADD pSrc, pSrc, #4
- ADD pDst, pDst, #4
- BGT Block4x4WidthLoop
-
- ;// Height Loop
- SUBS iHeight, iHeight, #4
- M_LDR iWidth, ptrWidth
- M_ADR pArgs, ppArgs
- ADD pSrc, pSrc, srcStep, LSL #2
- ADD pDst, pDst, dstStep, LSL #2
- SUB pSrc, pSrc, iWidth
- SUB pDst, pDst, iWidth
- BGT Block4x4HeightLoop
-
-EndOfInterpolation
- MOV r0, #0
- M_END
-
- ENDIF
- ;// End of CortexA8
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_PredictIntraChroma_8x8_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_PredictIntraChroma_8x8_s.s
deleted file mode 100644
index 1ff418f..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_PredictIntraChroma_8x8_s.s
+++ /dev/null
@@ -1,450 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_PredictIntraChroma_8x8_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- EXPORT armVCM4P10_pIndexTable8x8
-
-;// Define the processor variants supported by this file
-
- M_VARIANTS CortexA8
-
- AREA table, DATA
-;//-------------------------------------------------------
-;// This table for implementing switch case of C in asm by
-;// the mehtod of two levels of indexing.
-;//-------------------------------------------------------
-
- M_TABLE armVCM4P10_pIndexTable8x8
- DCD OMX_VC_CHROMA_DC, OMX_VC_CHROMA_HOR
- DCD OMX_VC_CHROMA_VERT, OMX_VC_CHROMA_PLANE
-
- M_TABLE armVCM4P10_MultiplierTableChroma8x8,1
- DCW 3, 2, 1,4
- DCW -3,-2,-1,0
- DCW 1, 2, 3,4
-
-
-
- IF CortexA8
-
-;//--------------------------------------------
-;// Scratch variable
-;//--------------------------------------------
-
-pc RN 15
-return RN 0
-pTable RN 8
-
-;//--------------------------------------------
-;// Input Arguments
-;//--------------------------------------------
-pSrcLeft RN 0 ;// input pointer
-pSrcAbove RN 1 ;// input pointer
-pSrcAboveLeft RN 2 ;// input pointer
-pDst RN 3 ;// output pointer
-leftStep RN 4 ;// input variable
-dstStep RN 5 ;// input variable
-predMode RN 6 ;// input variable
-availability RN 7 ;// input variable
-pMultiplierTable RN 2
-
-pTmp RN 9
-step RN 10
-
-;//---------------------
-;// Neon Registers
-;//---------------------
-
-;// OMX_VC_CHROMA_HOR
-
-dLeftVal0 DN D0.8
-dLeftVal1 DN D1.8
-dLeftVal2 DN D2.8
-dLeftVal3 DN D3.8
-dLeftVal4 DN D4.8
-dLeftVal5 DN D5.8
-dLeftVal6 DN D6.8
-dLeftVal7 DN D7.8
-
-;// OMX_VC_CHROMA_VERT
-
-dAboveVal DN D0.U8
-
-;// OMX_VC_CHROMA_DC
-
-dLeftVal DN D1.U8
-dSumAboveValU16 DN D2.U16
-dSumAboveValU32 DN D3.U32
-dSumAboveValU8 DN D3.U8
-dSumLeftValU16 DN D2.U16
-dSumLeftValU32 DN D1.U32
-dSumLeftValU8 DN D1.U8
-dSumAboveLeft DN D2.U32
-dSumAboveLeftU8 DN D2.U8
-dIndexRow0U8 DN D5.U8
-dIndexRow0 DN D5.U64
-dIndexRow4U8 DN D6.U8
-dIndexRow4 DN D6.U64
-dDstRow0 DN D0.U8
-dDstRow4 DN D4.U8
-dConst128U8 DN D0.U8
-
-;// OMX_VC_CHROMA_PLANE
-
-dRevAboveVal DN D3.U8
-dRevAboveValU64 DN D3.U64
-dAboveLeftVal DN D2.U8
-qAbove7minus0 QN Q3.S16
-qAboveDiff QN Q2.S16
-dIndex DN D8.U8
-dDiffAboveU8 DN D9.U8
-dDiffAboveS16 DN D9.S16
-dAboveDiff0U8 DN D4.U8
-dAboveDiff0U64 DN D4.U64
-dAbove7minus0U8 DN D6.U8
-dMultiplier DN D10.S16
-dHorPred DN D11.S16
-dRevLeftVal DN D3.U8
-dRevLeftValU64 DN D3.U64
-qLeft7minus0 QN Q7.S16
-qLeftDiff QN Q6.S16
-dDiffLeftU8 DN D16.U8
-dDiffLeftS16 DN D16.S16
-dLeftDiff0U8 DN D12.U8
-dLeftDiff0U64 DN D12.U64
-dLeft7minus0U8 DN D14.U8
-dVerPred DN D3.S16
-dHVValS16 DN D3.S16
-dHVValS32 DN D3.S32
-dHVTempS32 DN D2.S32
-qA QN Q0.S16
-qB QN Q2.S16
-qC QN Q3.S16
-qMultiplier QN Q5.S16
-dMultiplier0 DN D10.S16
-dMultiplier1 DN D11.S16
-qC0 QN Q0.S16
-qC1 QN Q1.S16
-qC2 QN Q4.S16
-qC3 QN Q5.S16
-qC4 QN Q6.S16
-qC5 QN Q7.S16
-qC6 QN Q8.S16
-qC7 QN Q9.S16
-qSum0 QN Q0.S16
-qSum1 QN Q1.S16
-qSum2 QN Q4.S16
-qSum3 QN Q5.S16
-qSum4 QN Q6.S16
-qSum5 QN Q7.S16
-qSum6 QN Q8.S16
-qSum7 QN Q9.S16
-dSum0 DN D0.U8
-dSum1 DN D1.U8
-dSum2 DN D2.U8
-dSum3 DN D3.U8
-dSum4 DN D4.U8
-dSum5 DN D5.U8
-dSum6 DN D6.U8
-dSum7 DN D7.U8
-
-;//-----------------------------------------------------------------------------------------------
-;// omxVCM4P10_PredictIntraChroma_8x8 starts
-;//-----------------------------------------------------------------------------------------------
-
- ;// Write function header
- M_START omxVCM4P10_PredictIntraChroma_8x8, r10, d15
-
- ;// Define stack arguments
- M_ARG LeftStep, 4
- M_ARG DstStep, 4
- M_ARG PredMode, 4
- M_ARG Availability, 4
-
- LDR pTable,=armVCM4P10_pIndexTable8x8 ;// Load index table for switch case
-
- ;// Load argument from the stack
- M_LDR predMode, PredMode ;// Arg predMode loaded from stack to reg
- M_LDR leftStep, LeftStep ;// Arg leftStep loaded from stack to reg
- M_LDR dstStep, DstStep ;// Arg dstStep loaded from stack to reg
- M_LDR availability, Availability ;// Arg availability loaded from stack to reg
-
-
- LDR pc, [pTable, predMode, LSL #2] ;// Branch to the case based on preMode
-
-OMX_VC_CHROMA_DC
-
- TST availability, #OMX_VC_LEFT
- BEQ DCChroma8x8LeftNotAvailable
-
- ADD pTmp, pSrcLeft, leftStep
- ADD step, leftStep, leftStep
-
- ;// Load Left Edge
- VLD1 {dLeftVal[0]},[pSrcLeft],step ;// pSrcLeft[0*leftStep]
- VLD1 {dLeftVal[1]},[pTmp],step ;// pSrcLeft[1*leftStep]
- VLD1 {dLeftVal[2]},[pSrcLeft],step ;// pSrcLeft[2*leftStep]
- VLD1 {dLeftVal[3]},[pTmp],step ;// pSrcLeft[3*leftStep]
- VLD1 {dLeftVal[4]},[pSrcLeft],step ;// pSrcLeft[4*leftStep]
- VLD1 {dLeftVal[5]},[pTmp],step ;// pSrcLeft[5*leftStep]
- VLD1 {dLeftVal[6]},[pSrcLeft],step ;// pSrcLeft[6*leftStep]
- VLD1 {dLeftVal[7]},[pTmp] ;// pSrcLeft[7*leftStep]
-
- TST availability, #OMX_VC_UPPER
- BEQ DCChroma8x8LeftOnlyAvailable
-
- ;// Load Upper Edge also
- VLD1 dAboveVal,[pSrcAbove] ;// pSrcAbove[0 to 7]
-
- MOV return, #OMX_Sts_NoErr ;// returnNoError
-
- VPADDL dSumAboveValU16, dAboveVal ;// pSrcAbove[ 6+7 | 4+5 | 2+3 | 0+1 ]
- VPADDL dSumAboveValU32, dSumAboveValU16 ;// pSrcAbove[ 4+5+6+7 | 0+1+2+3 ]
-
- VPADDL dSumLeftValU16, dLeftVal ;// pSrcLeft[ 6+7 | 4+5 | 2+3 | 0+1 ]
- VPADDL dSumLeftValU32, dSumLeftValU16 ;// pSrcLeft[ 4+5+6+7 | 0+1+2+3 ]
-
- VADD dSumAboveLeft,dSumAboveValU32,dSumLeftValU32
- VRSHR dSumAboveLeft,dSumAboveLeft,#3 ;// Sum = (Sum + 4) >> 3
- VRSHR dSumAboveValU32,dSumAboveValU32,#2 ;// Sum = (Sum + 2) >> 2
- VRSHR dSumLeftValU32,dSumLeftValU32,#2 ;// Sum = (Sum + 2) >> 2
-
- VMOV dIndexRow0U8,#0x0c
- VMOV dIndexRow4U8,#0x04
- VSHL dIndexRow0,dIndexRow0,#32 ;// index0 = 0x0c0c0c0c00000000
- VSHR dIndexRow4,dIndexRow4,#32 ;// index4 = 0x0000000004040404
- VADD dIndexRow4U8,dIndexRow4U8,dIndexRow0U8 ;// index4 = 0x0c0c0c0c04040404
- VTBL dDstRow0,{dSumAboveLeftU8,dSumAboveValU8},dIndexRow0U8
- VTBL dDstRow4,{dSumLeftValU8,dSumAboveLeftU8},dIndexRow4U8
-
-DCChroma8x8LeftStore
- ADD pTmp, pDst, dstStep
- ADD step, dstStep, dstStep
-
- VST1 dDstRow0,[pDst],step ;// pDst[0*dstStep+x] :0<= x <= 7
- VST1 dDstRow0,[pTmp],step ;// pDst[1*dstStep+x] :0<= x <= 7
- VST1 dDstRow0,[pDst],step ;// pDst[2*dstStep+x] :0<= x <= 7
- VST1 dDstRow0,[pTmp],step ;// pDst[3*dstStep+x] :0<= x <= 7
- VST1 dDstRow4,[pDst],step ;// pDst[4*dstStep+x] :0<= x <= 7
- VST1 dDstRow4,[pTmp],step ;// pDst[5*dstStep+x] :0<= x <= 7
- VST1 dDstRow4,[pDst],step ;// pDst[6*dstStep+x] :0<= x <= 7
- VST1 dDstRow4,[pTmp] ;// pDst[7*dstStep+x] :0<= x <= 7
-
- M_EXIT
-
-
-DCChroma8x8LeftOnlyAvailable
-
- MOV return, #OMX_Sts_NoErr
-
- VPADDL dSumLeftValU16, dLeftVal ;// pSrcLeft[ 6+7 | 4+5 | 2+3 | 0+1 ]
- VPADDL dSumLeftValU32, dSumLeftValU16 ;// pSrcLeft[ 4+5+6+7 | 0+1+2+3 ]
- VRSHR dSumLeftValU32,dSumLeftValU32,#2 ;// Sum = (Sum + 2) >> 2
-
- VDUP dDstRow0,dSumLeftValU8[0]
- VDUP dDstRow4,dSumLeftValU8[4]
-
- B DCChroma8x8LeftStore
-
-
-DCChroma8x8LeftNotAvailable
-
- TST availability, #OMX_VC_UPPER
- BEQ DCChroma8x8NoneAvailable
-
- ;// Load Upper Edge
- VLD1 dAboveVal,[pSrcAbove] ;// pSrcAbove[0 to 7]
- MOV return, #OMX_Sts_NoErr ;// returnNoError
-
- VPADDL dSumAboveValU16, dAboveVal ;// pSrcAbove[ 6+7 | 4+5 | 2+3 | 0+1 ]
- VPADDL dSumAboveValU32, dSumAboveValU16 ;// pSrcAbove[ 4+5+6+7 | 0+1+2+3 ]
- VRSHR dSumAboveValU32,dSumAboveValU32,#2 ;// Sum = (Sum + 2) >> 2
- VMOV dIndexRow0U8,#0x04
- VSHL dIndexRow0,dIndexRow0,#32 ;// index = 0x0404040400000000
- VTBL dDstRow0,{dSumAboveValU8},dIndexRow0U8
-
- B DCChroma8x8UpperStore
-
-
-DCChroma8x8NoneAvailable
-
- VMOV dConst128U8,#0x80 ;// 0x8080808080808080 if(count == 0)
- MOV return, #OMX_Sts_NoErr ;// returnNoError
-
-DCChroma8x8UpperStore
-
- ADD pTmp, pDst, dstStep
- ADD step, dstStep, dstStep
-
- VST1 dDstRow0,[pDst],step ;// pDst[0*dstStep+x] :0<= x <= 7
- VST1 dDstRow0,[pTmp],step ;// pDst[1*dstStep+x] :0<= x <= 7
- VST1 dDstRow0,[pDst],step ;// pDst[2*dstStep+x] :0<= x <= 7
- VST1 dDstRow0,[pTmp],step ;// pDst[3*dstStep+x] :0<= x <= 7
- VST1 dDstRow0,[pDst],step ;// pDst[4*dstStep+x] :0<= x <= 7
- VST1 dDstRow0,[pTmp],step ;// pDst[5*dstStep+x] :0<= x <= 7
- VST1 dDstRow0,[pDst],step ;// pDst[6*dstStep+x] :0<= x <= 7
- VST1 dDstRow0,[pTmp] ;// pDst[7*dstStep+x] :0<= x <= 7
-
- M_EXIT
-
-
-OMX_VC_CHROMA_VERT
-
- VLD1 dAboveVal,[pSrcAbove] ;// pSrcAbove[x] :0<= x <= 7
- MOV return, #OMX_Sts_NoErr
-
- B DCChroma8x8UpperStore
-
-
-OMX_VC_CHROMA_HOR
-
- ADD pTmp, pSrcLeft, leftStep
- ADD step, leftStep, leftStep
-
- VLD1 {dLeftVal0[]},[pSrcLeft],step ;// pSrcLeft[0*leftStep]
- VLD1 {dLeftVal1[]},[pTmp],step ;// pSrcLeft[1*leftStep]
- VLD1 {dLeftVal2[]},[pSrcLeft],step ;// pSrcLeft[2*leftStep]
- VLD1 {dLeftVal3[]},[pTmp],step ;// pSrcLeft[3*leftStep]
- VLD1 {dLeftVal4[]},[pSrcLeft],step ;// pSrcLeft[4*leftStep]
- VLD1 {dLeftVal5[]},[pTmp],step ;// pSrcLeft[5*leftStep]
- VLD1 {dLeftVal6[]},[pSrcLeft],step ;// pSrcLeft[6*leftStep]
- VLD1 {dLeftVal7[]},[pTmp] ;// pSrcLeft[7*leftStep]
-
- B DCChroma8x8PlaneStore
-
-
-OMX_VC_CHROMA_PLANE
- ADD pTmp, pSrcLeft, leftStep
- ADD step, leftStep, leftStep
-
- VLD1 dAboveVal,[pSrcAbove] ;// pSrcAbove[x] :0<= x <= 7
- VLD1 dAboveLeftVal[0],[pSrcAboveLeft]
-
- VLD1 {dLeftVal[0]},[pSrcLeft],step ;// pSrcLeft[0*leftStep]
- VLD1 {dLeftVal[1]},[pTmp],step ;// pSrcLeft[1*leftStep]
- VLD1 {dLeftVal[2]},[pSrcLeft],step ;// pSrcLeft[2*leftStep]
- VLD1 {dLeftVal[3]},[pTmp],step ;// pSrcLeft[3*leftStep]
- VLD1 {dLeftVal[4]},[pSrcLeft],step ;// pSrcLeft[4*leftStep]
- VLD1 {dLeftVal[5]},[pTmp],step ;// pSrcLeft[5*leftStep]
- VLD1 {dLeftVal[6]},[pSrcLeft],step ;// pSrcLeft[6*leftStep]
- VLD1 {dLeftVal[7]},[pTmp] ;// pSrcLeft[7*leftStep]
-
-
- VREV64 dRevAboveVal,dAboveVal ;// Reverse order of bytes = pSrcAbove[0:1:2:3:4:5:6:7]
- VSUBL qAbove7minus0,dRevAboveVal,dAboveLeftVal ;// qAbove7minus0[0] = pSrcAbove[7] - pSrcAboveLeft[0]
- VSHR dRevAboveValU64,dRevAboveValU64,#8 ;// pSrcAbove[X:0:1:2:3:4:5:6]
- VSUBL qAboveDiff,dRevAboveVal,dAboveVal ;// pSrcAbove[6] - pSrcAbove[0]
- ;// pSrcAbove[5] - pSrcAbove[1]
- ;// pSrcAbove[4] - pSrcAbove[2]
-
- VREV64 dRevLeftVal,dLeftVal ;// Reverse order of bytes = pSrcLeft[0:1:2:3:4:5:6:7]
- VSUBL qLeft7minus0,dRevLeftVal,dAboveLeftVal ;// qAbove7minus0[0] = pSrcLeft[7] - pSrcAboveLeft[0]
- VSHR dRevLeftValU64,dRevLeftValU64,#8 ;// pSrcLeft[X:0:1:2:3:4:5:6]
- VSUBL qLeftDiff,dRevLeftVal,dLeftVal ;// pSrcLeft[6] - pSrcLeft[0]
- ;// pSrcLeft[5] - pSrcLeft[1]
- ;// pSrcLeft[4] - pSrcLeft[2]
-
- LDR pMultiplierTable,=armVCM4P10_MultiplierTableChroma8x8 ;// Used to calculate Hval & Vval
- VSHL dAboveDiff0U64,dAboveDiff0U64,#16
- VEXT dDiffAboveU8,dAboveDiff0U8,dAbove7minus0U8,#2 ;// pSrcAbove[ 7-0 | 4-2 | 5-1 | 6-0 ]
- VLD1 dMultiplier,[pMultiplierTable]!
- VSHL dLeftDiff0U64,dLeftDiff0U64,#16
- VEXT dDiffLeftU8,dLeftDiff0U8,dLeft7minus0U8,#2 ;// pSrcLeft[ 7-0 | 4-2 | 5-1 | 6-0 ]
-
-
- VMUL dHorPred,dDiffAboveS16,dMultiplier ;// pSrcAbove[ 4*(7-0) | 1*(4-2) | 2*(5-1) | 3*(6-0) ]
- VMUL dVerPred,dDiffLeftS16,dMultiplier
- VPADD dHVValS16,dHorPred,dVerPred
-
-
- VPADDL dHVValS32,dHVValS16 ;// [V|H] in 32 bits each
- VSHL dHVTempS32,dHVValS32,#4 ;// 17*H = 16*H + H = (H<<4)+H
- VADD dHVValS32,dHVValS32,dHVTempS32 ;// [ 17*V | 17*H ]in 32 bits each
- VLD1 {dMultiplier0,dMultiplier1},[pMultiplierTable] ;// qMultiplier = [ 4|3|2|1|0|-1|-2|-3 ]
- VRSHR dHVValS32,dHVValS32,#5 ;// [c|b] in 16bits each
- VADDL qA,dAboveVal,dLeftVal
- VDUP qA,qA[7]
- VSHL qA,qA,#4 ;// [a|a|a|a|a|a|a|a]
- VDUP qB,dHVValS16[0] ;// [b|b|b|b|b|b|b|b]
- VDUP qC,dHVValS16[2] ;// [c|c|c|c|c|c|c|c]
-
-
- VMUL qB,qB,qMultiplier
- VMUL qC,qC,qMultiplier
- VADD qB,qB,qA
-
- VDUP qC0,qC[0]
- VDUP qC1,qC[1]
- VDUP qC2,qC[2]
- VDUP qC3,qC[3]
- VDUP qC4,qC[4]
- VDUP qC5,qC[5]
- VDUP qC6,qC[6]
- VDUP qC7,qC[7]
-
- VADD qSum0,qB,qC0
- VADD qSum1,qB,qC1
- VADD qSum2,qB,qC2
- VADD qSum3,qB,qC3
- VADD qSum4,qB,qC4
- VADD qSum5,qB,qC5
- VADD qSum6,qB,qC6
- VADD qSum7,qB,qC7
-
- VQRSHRUN dSum0,qSum0,#5 ;// (OMX_U8)armClip(0,255,(Sum+16)>>5)
- VQRSHRUN dSum1,qSum1,#5
- VQRSHRUN dSum2,qSum2,#5
- VQRSHRUN dSum3,qSum3,#5
- VQRSHRUN dSum4,qSum4,#5
- VQRSHRUN dSum5,qSum5,#5
- VQRSHRUN dSum6,qSum6,#5
- VQRSHRUN dSum7,qSum7,#5
-
-DCChroma8x8PlaneStore
- ADD pTmp, pDst, dstStep
- ADD step, dstStep, dstStep
-
- VST1 dSum0,[pDst],step ;// pDst[0*dstStep+x] :0<= x <= 7
- VST1 dSum1,[pTmp],step ;// pDst[1*dstStep+x] :0<= x <= 7
- VST1 dSum2,[pDst],step ;// pDst[2*dstStep+x] :0<= x <= 7
- VST1 dSum3,[pTmp],step ;// pDst[3*dstStep+x] :0<= x <= 7
- VST1 dSum4,[pDst],step ;// pDst[4*dstStep+x] :0<= x <= 7
- VST1 dSum5,[pTmp],step ;// pDst[5*dstStep+x] :0<= x <= 7
- VST1 dSum6,[pDst],step ;// pDst[6*dstStep+x] :0<= x <= 7
- VST1 dSum7,[pTmp] ;// pDst[7*dstStep+x] :0<= x <= 7
-
- MOV return, #OMX_Sts_NoErr
- M_END
-
- ENDIF ;// CortexA8
-
- END
-;//-----------------------------------------------------------------------------------------------
-;// omxVCM4P10_PredictIntraChroma_8x8 ends
-;//-----------------------------------------------------------------------------------------------
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_PredictIntra_16x16_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_PredictIntra_16x16_s.s
deleted file mode 100644
index de331f4..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_PredictIntra_16x16_s.s
+++ /dev/null
@@ -1,438 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_PredictIntra_16x16_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS CortexA8
-
-
-;//-------------------------------------------------------
-;// This table for implementing switch case of C in asm by
-;// the mehtod of two levels of indexing.
-;//-------------------------------------------------------
-
- M_TABLE armVCM4P10_pIndexTable16x16
- DCD OMX_VC_16X16_VERT, OMX_VC_16X16_HOR
- DCD OMX_VC_16X16_DC, OMX_VC_16X16_PLANE
-
-
- IF CortexA8
-
- M_TABLE armVCM4P10_MultiplierTable16x16,1
- DCW 7, 6, 5, 4, 3, 2, 1, 8
- DCW 0, 1, 2, 3, 4, 5, 6, 7
- DCW 8, 9, 10, 11, 12, 13, 14, 15
-
-;//--------------------------------------------
-;// Constants
-;//--------------------------------------------
-BLK_SIZE EQU 0x10
-MUL_CONST0 EQU 0x01010101
-MUL_CONST1 EQU 0x00060004
-MUL_CONST2 EQU 0x00070005
-MUL_CONST3 EQU 0x00030001
-MASK_CONST EQU 0x00FF00FF
-
-;//--------------------------------------------
-;// Scratch variable
-;//--------------------------------------------
-y RN 12
-pc RN 15
-
-return RN 0
-pTable RN 9
-count RN 11
-pMultTable RN 9
-; ----------------------------------------------
-; Neon registers
-; ----------------------------------------------
-qAbove QN Q0.U8
-qLeft QN Q1.U8
-qSum8 QN Q0.U16
-dSum80 DN D0.U16
-dSum81 DN D1.U16
-dSum4 DN D0.U16
-dSum2 DN D0.U32
-dSum1 DN D0.U64
-qOut QN Q3.U8
-dSumLeft DN D6.U64
-dSumAbove DN D7.U64
-dSum DN D8.U64
-dSum0 DN D8.U8[0]
-
-qH QN Q11.S32
-qV QN Q12.S32
-qA QN Q11.S16
-qB QN Q6.S16
-qC QN Q7.S16
-
-qB0 QN Q5.S16
-qB1 QN Q6.S16
-dA1 DN D23.S16
-
-dH0 DN D22.S32
-dH1 DN D23.S32
-dV0 DN D24.S32
-dV1 DN D25.S32
-
-qHV QN Q11.S64
-qHV0 QN Q11.S32
-qHV1 QN Q12.S64
-
-dHV00 DN D22.S32
-dHV01 DN D23.S32
-
-dHV0 DN D22.S16[0]
-dHV1 DN D23.S16[0]
-dHV10 DN D24.S64
-dHV11 DN D25.S64
-
-qSum0 QN Q0.S16
-qSum1 QN Q1.S16
-
-dOut0 DN D6.U8
-dOut1 DN D7.U8
-
-dLeft0 DN D2.U8
-dLeft1 DN D3.U8
-qConst QN Q13.S16
-
-dAbove0 DN D0.U8
-dAbove1 DN D1.U8
-
-dRevLeft64 DN D12.U64
-dRevLeft DN D12.U8
-dRevAbove64 DN D5.U64
-dRevAbove DN D5.U8
-qLeftDiff QN Q8.S16
-dLeftDiff1 DN D17.S16
-dLeftDiff64 DN D17.S64
-qDiffLeft QN Q8.S16
-qDiffAbove QN Q4.S16
-dAboveDiff1 DN D9.S16
-dAboveDiff64 DN D9.S64
-qAboveDiff QN Q4.S16
-
-dAboveLeft DN D4.U8
-
-dDiffLeft0 DN D16.S16
-dDiffLeft1 DN D17.S16
-dDiffAbove0 DN D8.S16
-dDiffAbove1 DN D9.S16
-
-qLeft15minus0 QN Q7.S16
-dLeft15minus0 DN D14.S16
-qAbove15minus0 QN Q3.S16
-dAbove15minus0 DN D6.S16
-
-qMultiplier QN Q10.S16
-qMultiplier0 QN Q10.S16
-qMultiplier1 QN Q12.S16
-dMultiplier0 DN D20.S16
-dMultiplier1 DN D21.S16
-
-dBPlusCMult7 DN D1.S64
-dBPlusCMult7S16 DN D1.S16
-
-qTmp QN Q0.U8
-
-;//--------------------------------------------
-;// Declare input registers
-;//--------------------------------------------
-pSrcLeft RN 0 ;// input pointer
-pSrcAbove RN 1 ;// input pointer
-pSrcAboveLeft RN 2 ;// input pointer
-pDst RN 3 ;// output pointer
-leftStep RN 4 ;// input variable
-dstStep RN 5 ;// input variable
-predMode RN 6 ;// input variable
-availability RN 7 ;// input variable
-
-pTmp RN 8
-step RN 10
-pTmp2 RN 11
-
-;//-----------------------------------------------------------------------------------------------
-;// omxVCM4P10_PredictIntra_16x16 starts
-;//-----------------------------------------------------------------------------------------------
-
- ;// Write function header
- M_START omxVCM4P10_PredictIntra_16x16, r11, d15
-
- ;// Define stack arguments
- M_ARG LeftStep, 4
- M_ARG DstStep, 4
- M_ARG PredMode, 4
- M_ARG Availability, 4
-
- ;// M_STALL ARM1136JS=4
-
- LDR pTable,=armVCM4P10_pIndexTable16x16 ;// Load index table for switch case
-
- ;// Load argument from the stack
- M_LDR predMode, PredMode ;// Arg predMode loaded from stack to reg
- M_LDR leftStep, LeftStep ;// Arg leftStep loaded from stack to reg
- M_LDR dstStep, DstStep ;// Arg dstStep loaded from stack to reg
- M_LDR availability, Availability ;// Arg availability loaded from stack to reg
-
- MOV y, #BLK_SIZE ;// Outer Loop Count
- LDR pc, [pTable, predMode, LSL #2] ;// Branch to the case based on preMode
-
-OMX_VC_16X16_VERT
- VLD1 qAbove, [pSrcAbove]
- ADD pTmp, pDst, dstStep
- ADD step, dstStep, dstStep
- VST1 qAbove, [pDst], step
- VST1 qAbove, [pTmp], step
- VST1 qAbove, [pDst], step
- VST1 qAbove, [pTmp], step
- VST1 qAbove, [pDst], step
- VST1 qAbove, [pTmp], step
- VST1 qAbove, [pDst], step
- VST1 qAbove, [pTmp], step
- VST1 qAbove, [pDst], step
- VST1 qAbove, [pTmp], step
- VST1 qAbove, [pDst], step
- VST1 qAbove, [pTmp], step
- VST1 qAbove, [pDst], step
- VST1 qAbove, [pTmp], step
- VST1 qAbove, [pDst]
- VST1 qAbove, [pTmp]
- MOV return, #OMX_Sts_NoErr ;// returnNoError
- M_EXIT
-
-OMX_VC_16X16_HOR
- ADD pTmp, pSrcLeft, leftStep
- ADD leftStep, leftStep, leftStep
- ADD pTmp2, pDst, dstStep
- ADD dstStep, dstStep, dstStep
-LoopHor
- VLD1 {qLeft[]}, [pSrcLeft], leftStep
- VLD1 {qTmp[]}, [pTmp], leftStep
- SUBS y, y, #8
- VST1 qLeft, [pDst], dstStep
- VST1 qTmp, [pTmp2], dstStep
- VLD1 {qLeft[]}, [pSrcLeft], leftStep
- VLD1 {qTmp[]}, [pTmp], leftStep
- VST1 qLeft, [pDst], dstStep
- VST1 qTmp, [pTmp2], dstStep
- VLD1 {qLeft[]}, [pSrcLeft], leftStep
- VLD1 {qTmp[]}, [pTmp], leftStep
- VST1 qLeft, [pDst], dstStep
- VST1 qTmp, [pTmp2], dstStep
- VLD1 {qLeft[]}, [pSrcLeft], leftStep
- VLD1 {qTmp[]}, [pTmp], leftStep
- VST1 qLeft, [pDst], dstStep
- VST1 qTmp, [pTmp2], dstStep
-
- BNE LoopHor ;// Loop for 16 times
- MOV return, #OMX_Sts_NoErr
- M_EXIT
-
-OMX_VC_16X16_DC
- MOV count, #0 ;// count = 0
- TST availability, #OMX_VC_LEFT
- BEQ UpperOrNoneAvailable ;// Jump to Upper if not left
-
- ADD pTmp, pSrcLeft, leftStep
- ADD step, leftStep, leftStep
-
- VLD1 {qLeft[0]}, [pSrcLeft],step
- VLD1 {qLeft[1]}, [pTmp],step
- VLD1 {qLeft[2]}, [pSrcLeft],step
- VLD1 {qLeft[3]}, [pTmp],step
- VLD1 {qLeft[4]}, [pSrcLeft],step
- VLD1 {qLeft[5]}, [pTmp],step
- VLD1 {qLeft[6]}, [pSrcLeft],step
- VLD1 {qLeft[7]}, [pTmp],step
- VLD1 {qLeft[8]}, [pSrcLeft],step
- VLD1 {qLeft[9]}, [pTmp],step
- VLD1 {qLeft[10]},[pSrcLeft],step
- VLD1 {qLeft[11]},[pTmp],step
- VLD1 {qLeft[12]},[pSrcLeft],step
- VLD1 {qLeft[13]},[pTmp],step
- VLD1 {qLeft[14]},[pSrcLeft],step
- VLD1 {qLeft[15]},[pTmp]
-
- VPADDL qSum8, qLeft
- ADD count, count, #1
- VPADD dSum4, dSum80, dSum81
- VPADDL dSum2, dSum4
- VPADDL dSumLeft, dSum2
- VRSHR dSum, dSumLeft, #4
-
-UpperOrNoneAvailable
- TST availability, #OMX_VC_UPPER ;// if(availability & #OMX_VC_UPPER)
- BEQ BothOrNoneAvailable ;// Jump to Left if not upper
- VLD1 qAbove, [pSrcAbove]
- ADD count, count, #1 ;// if upper inc count by 1
- VPADDL qSum8, qAbove
- VPADD dSum4, dSum80, dSum81
- VPADDL dSum2, dSum4
- VPADDL dSumAbove, dSum2
- VRSHR dSum, dSumAbove, #4
-
-BothOrNoneAvailable
- CMP count, #2 ;// check if both available
- BNE NoneAvailable
- VADD dSum, dSumAbove, dSumLeft
- VRSHR dSum, dSum, #5
-
-
-NoneAvailable
- VDUP qOut, dSum0
- CMP count, #0 ;// check if none available
- ADD pTmp, pDst, dstStep
- ADD step, dstStep, dstStep
- BNE LoopDC
- VMOV qOut, #128
-LoopDC
- VST1 qOut, [pDst], step
- VST1 qOut, [pTmp], step
- VST1 qOut, [pDst], step
- VST1 qOut, [pTmp], step
- VST1 qOut, [pDst], step
- VST1 qOut, [pTmp], step
- VST1 qOut, [pDst], step
- VST1 qOut, [pTmp], step
- VST1 qOut, [pDst], step
- VST1 qOut, [pTmp], step
- VST1 qOut, [pDst], step
- VST1 qOut, [pTmp], step
- VST1 qOut, [pDst], step
- VST1 qOut, [pTmp], step
- VST1 qOut, [pDst], step
- VST1 qOut, [pTmp], step
- MOV return, #OMX_Sts_NoErr
- M_EXIT
-
-OMX_VC_16X16_PLANE
- LDR pMultTable, =armVCM4P10_MultiplierTable16x16
- VLD1 qAbove, [pSrcAbove] ;// pSrcAbove[x] :0<= x <= 7
- VLD1 dAboveLeft[0],[pSrcAboveLeft]
- ADD pTmp, pSrcLeft, leftStep
- ADD step, leftStep, leftStep
- VLD1 {qLeft[0]}, [pSrcLeft],step
- VLD1 {qLeft[1]}, [pTmp],step
- VLD1 {qLeft[2]}, [pSrcLeft],step
- VLD1 {qLeft[3]}, [pTmp],step
- VLD1 {qLeft[4]}, [pSrcLeft],step
- VLD1 {qLeft[5]}, [pTmp],step
- VLD1 {qLeft[6]}, [pSrcLeft],step
- VLD1 {qLeft[7]}, [pTmp],step
- VLD1 {qLeft[8]}, [pSrcLeft],step
- VLD1 {qLeft[9]}, [pTmp],step
- VLD1 {qLeft[10]}, [pSrcLeft],step
- VLD1 {qLeft[11]}, [pTmp],step
- VLD1 {qLeft[12]}, [pSrcLeft],step
- VLD1 {qLeft[13]}, [pTmp],step
- VLD1 {qLeft[14]}, [pSrcLeft],step
- VLD1 {qLeft[15]}, [pTmp]
-
- VREV64 dRevAbove, dAbove1 ;// pSrcAbove[15:14:13:12:11:10:9:8]
- VSUBL qAbove15minus0, dRevAbove, dAboveLeft ;// qAbove7minus0[0] = pSrcAbove[15] - pSrcAboveLeft[0]
- VSHR dRevAbove64, dRevAbove64, #8 ;// pSrcAbove[14:13:12:11:10:9:8:X]
- VSUBL qAboveDiff, dRevAbove, dAbove0
-
- VSHL dAboveDiff64, dAboveDiff64, #16
- VEXT dDiffAbove1, dAboveDiff1, dAbove15minus0, #1
-
- VREV64 dRevLeft,dLeft1 ;// pSrcLeft[15:14:13:12:11:10:9:8]
- VSUBL qLeft15minus0,dRevLeft, dAboveLeft ;// qAbove7minus0[0] = pSrcLeft[7] - pSrcAboveLeft[0]
- VSHR dRevLeft64, dRevLeft64, #8 ;// pSrcLeft[14:13:12:11:10:9:8:X]
- VSUBL qLeftDiff,dRevLeft, dLeft0
-
- ;// Multiplier = [8|1|2|...|6|7]
- VLD1 qMultiplier, [pMultTable]!
-
- VSHL dLeftDiff64, dLeftDiff64, #16
- VEXT dDiffLeft1, dLeftDiff1, dLeft15minus0, #1
-
- VMULL qH,dDiffAbove0, dMultiplier0
- VMULL qV,dDiffLeft0, dMultiplier0
- VMLAL qH,dDiffAbove1, dMultiplier1
- VMLAL qV,dDiffLeft1, dMultiplier1
-
- VPADD dHV00,dH1,dH0
- VPADD dHV01,dV1,dV0
- VPADDL qHV, qHV0
- VSHL qHV1,qHV,#2
- VADD qHV,qHV,qHV1
-
- ;// HV = [c = ((5*V+32)>>6) | b = ((5*H+32)>>6)]
- VRSHR qHV,qHV,#6
-
- ;// HV1 = [c*7|b*7]
- VSHL qHV1,qHV,#3
- VSUB qHV1,qHV1,qHV
-
- ;// Multiplier1 = [0|1|2|...|7]
- VLD1 qMultiplier0, [pMultTable]!
- VDUP qB, dHV0
- VDUP qC, dHV1
-
- VADDL qA,dAbove1,dLeft1
- VSHL qA,qA, #4
- VDUP qA,dA1[3]
- VADD dBPlusCMult7, dHV10, dHV11
-
- ;// Multiplier1 = [8|9|10|...|15]
- VLD1 qMultiplier1, [pMultTable]
- ;// Const = a - 7*(b+c)
- VDUP qConst, dBPlusCMult7S16[0]
- VSUB qConst, qA, qConst
-
- ;// B0 = [0*b|1*b|2*b|3*b|......|7*b]
- VMUL qB0,qB,qMultiplier0
-
- ;// B0 = [8*b|9*b|10*b|11*b|....|15*b]
- VMUL qB1,qB,qMultiplier1
-
- VADD qSum0, qB0, qConst
- VADD qSum1, qB1, qConst
-
- ;// Loops for 16 times
-LoopPlane
- ;// (b*x + c*y + C)>>5
- VQRSHRUN dOut0, qSum0,#5
- VQRSHRUN dOut1, qSum1,#5
- SUBS y, y, #1
- VST1 qOut,[pDst],dstStep
- VADD qSum0,qSum0,qC
- VADD qSum1,qSum1,qC
- BNE LoopPlane
-
- MOV return, #OMX_Sts_NoErr
-
- M_END
-
- ENDIF ;// CortexA8
-
- END
-;-----------------------------------------------------------------------------------------------
-; omxVCM4P10_PredictIntra_16x16 ends
-;-----------------------------------------------------------------------------------------------
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_PredictIntra_4x4_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_PredictIntra_4x4_s.s
deleted file mode 100644
index b5780ef..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_PredictIntra_4x4_s.s
+++ /dev/null
@@ -1,545 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_PredictIntra_4x4_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
-;// Define the processor variants supported by this file
-
- M_VARIANTS CortexA8
-
-;//-------------------------------------------------------
-;// This table for implementing switch case of C in asm by
-;// the mehtod of two levels of indexing.
-;//-------------------------------------------------------
-
- M_TABLE armVCM4P10_pSwitchTable4x4
- DCD OMX_VC_4x4_VERT, OMX_VC_4x4_HOR
- DCD OMX_VC_4x4_DC, OMX_VC_4x4_DIAG_DL
- DCD OMX_VC_4x4_DIAG_DR, OMX_VC_4x4_VR
- DCD OMX_VC_4x4_HD, OMX_VC_4x4_VL
- DCD OMX_VC_4x4_HU
-
-
- IF CortexA8
-
-;//--------------------------------------------
-;// Scratch variable
-;//--------------------------------------------
-return RN 0
-pTable RN 8
-pc RN 15
-
-;//--------------------------------------------
-;// Declare input registers
-;//--------------------------------------------
-pSrcLeft RN 0 ;// input pointer
-pSrcAbove RN 1 ;// input pointer
-pSrcAboveLeft RN 2 ;// input pointer
-pDst RN 3 ;// output pointer
-leftStep RN 4 ;// input variable
-dstStep RN 5 ;// input variable
-predMode RN 6 ;// input variable
-availability RN 7 ;// input variable
-pDst1 RN 1
-pDst2 RN 4
-pDst3 RN 6
-
-pSrcTmp RN 9
-srcStep RN 10
-pDstTmp RN 11
-dstep RN 12
-
-;//-------------------
-;// Neon registers
-;//-------------------
-
-;// OMX_VC_CHROMA_VERT
-dAboveU32 DN D0.U32
-
-;// OMX_VC_CHROMA_HOR
-dLeftVal0 DN D0.8
-dLeftVal1 DN D1.8
-dLeftVal2 DN D2.8
-dLeftVal3 DN D3.8
-dLeftVal0U32 DN D0.U32
-dLeftVal1U32 DN D1.U32
-dLeftVal2U32 DN D2.U32
-dLeftVal3U32 DN D3.U32
-
-;// OMX_VC_4x4_DC
-dLeftVal DN D0.U8
-dLeftValU32 DN D0.U32
-dSumAboveLeftU16 DN D1.U16
-dSumAboveLeftU32 DN D1.U32
-dSumAboveLeftU64 DN D1.U64
-dSumAboveLeftU8 DN D1.U8
-dSum DN D0.U8
-
-dSumLeftValU16 DN D1.U16
-dSumLeftValU32 DN D1.U32
-dSumLeftValU64 DN D1.U64
-dSumLeftValU8 DN D1.U8
-
-dAboveVal DN D0.U8
-dSumAboveValU16 DN D1.U16
-dSumAboveValU32 DN D1.U32
-dSumAboveValU64 DN D1.U64
-dSumAboveValU8 DN D1.U8
-dConst128U8 DN D0.U8
-
-
-;//OMX_VC_4x4_DIAG_DL
-
-dAbove DN D0.U8
-dU7 DN D2.U8
-dU3 DN D2.U8
-dAbove0 DN D3.U8
-dAbove1 DN D4.U8
-dAbove2 DN D5.U8
-dTmp DN D6.U8
-dTmp0 DN D7.U8
-dTmp1 DN D8.U8
-dTmp2 DN D9.U8
-dTmp3 DN D10.U8
-dTmpU32 DN D6.U32
-
-
-;//OMX_VC_4x4_DIAG_DR
-dLeft DN D1.U8
-dUL DN D2.U8
-
-;//OMX_VC_4x4_VR
-dLeft0 DN D1.U8
-dLeft1 DN D2.U8
-dEven0 DN D3.U8
-dEven1 DN D4.U8
-dEven2 DN D5.U8
-dOdd0 DN D6.U8
-dOdd1 DN D11.U8
-dOdd2 DN D12.U8
-dTmp3U32 DN D10.U32
-dTmp2U32 DN D9.U32
-
-
-;//OMX_VC_4x4_HD
-dTmp1U64 DN D8.U64
-dTmp0U64 DN D7.U64
-dTmpU64 DN D6.U64
-dTmpU32 DN D6.U32
-dTmp1U32 DN D8.U32
-
-;//OMX_VC_4x4_HU
-dL3 DN D2.U8
-dLeftHU0 DN D3.U8
-dLeftHU1 DN D4.U8
-dLeftHU2 DN D5.U8
-dTmp0U32 DN D7.U32
-
-
-
-
-;//-----------------------------------------------------------------------------------------------
-;// omxVCM4P10_PredictIntra_4x4 starts
-;//-----------------------------------------------------------------------------------------------
-
- ;// Write function header
- M_START omxVCM4P10_PredictIntra_4x4, r12,d12
-
- ;// Define stack arguments
- M_ARG LeftStep, 4
- M_ARG DstStep, 4
- M_ARG PredMode, 4
- M_ARG Availability, 4
-
-
- LDR pTable,=armVCM4P10_pSwitchTable4x4 ;// Load index table for switch case
-
- ;// Load argument from the stack
- M_LDRD predMode,availability,PredMode ;// Arg predMode & availability loaded from stack to reg
- M_LDRD leftStep,dstStep,LeftStep ;// Arg leftStep & dstStep loaded from stack to reg
-
-
- LDR pc, [pTable, predMode, LSL #2] ;// Branch to the case based on preMode
-
-
-OMX_VC_4x4_HOR
-
- ADD pSrcTmp, pSrcLeft, leftStep
- ADD srcStep, leftStep, leftStep
- ;// Load Left Edge
- VLD1 {dLeftVal0[]},[pSrcLeft],srcStep ;// pSrcLeft[0*leftStep]
- VLD1 {dLeftVal1[]},[pSrcTmp],srcStep ;// pSrcLeft[1*leftStep]
- VLD1 {dLeftVal2[]},[pSrcLeft] ;// pSrcLeft[2*leftStep]
- VLD1 {dLeftVal3[]},[pSrcTmp] ;// pSrcLeft[3*leftStep]
-
- ADD pDstTmp, pDst, dstStep
- ADD dstep, dstStep, dstStep
-
- VST1 dLeftVal0U32[0],[pDst],dstep ;// pDst[0*dstStep+x] :0<= x <= 7
- VST1 dLeftVal1U32[0],[pDstTmp],dstep ;// pDst[1*dstStep+x] :0<= x <= 7
- VST1 dLeftVal2U32[0],[pDst] ;// pDst[2*dstStep+x] :0<= x <= 7
- VST1 dLeftVal3U32[0],[pDstTmp] ;// pDst[3*dstStep+x] :0<= x <= 7
-
- B ExitPredict4x4 ;// Branch to exit code
-
-OMX_VC_4x4_VERT
-
- ;// Load Upper Edge
- VLD1 dAboveU32[0],[pSrcAbove]
- ADD pDstTmp, pDst, dstStep
- ADD dstep, dstStep, dstStep
-
-DCPredict4x4VertStore
-
- VST1 dAboveU32[0],[pDst],dstep
- VST1 dAboveU32[0],[pDstTmp],dstep
- VST1 dAboveU32[0],[pDst]
- VST1 dAboveU32[0],[pDstTmp]
-
- B ExitPredict4x4 ;// Branch to exit code
-
-OMX_VC_4x4_DC
-
-
- TST availability, #OMX_VC_LEFT
- BEQ DCPredict4x4LeftNotAvailable
-
- ADD pSrcTmp, pSrcLeft, leftStep
- ADD srcStep, leftStep, leftStep
- ;// Load Left Edge
- VLD1 {dLeftVal[0]},[pSrcLeft],srcStep ;// pSrcLeft[0*leftStep]
- VLD1 {dLeftVal[1]},[pSrcTmp],srcStep ;// pSrcLeft[1*leftStep]
- VLD1 {dLeftVal[2]},[pSrcLeft] ;// pSrcLeft[2*leftStep]
- VLD1 {dLeftVal[3]},[pSrcTmp] ;// pSrcLeft[3*leftStep]
-
- TST availability, #OMX_VC_UPPER
- BEQ DCPredict4x4LeftOnlyAvailable
-
- ;// Load Upper Edge also
- VLD1 dLeftValU32[1],[pSrcAbove] ;// pSrcAbove[0 to 3]
- MOV return, #OMX_Sts_NoErr
-
- VPADDL dSumAboveLeftU16, dLeftVal ;// [pSrcAbove[2+3 | 0+1] | pSrcLeft[2+3 | 0+1]]
- VPADDL dSumAboveLeftU32, dSumAboveLeftU16 ;// [pSrcAbove[2+3+0+1] | pSrcLeft[2+3+0+1]]
- VPADDL dSumAboveLeftU64, dSumAboveLeftU32 ;// [pSrcAbove[2+3+0+1] + pSrcLeft[2+3+0+1]]
- VRSHR dSumAboveLeftU64,dSumAboveLeftU64,#3 ;// Sum = (Sum + 4) >> 3
- ADD pDstTmp, pDst, dstStep
- ADD dstep, dstStep, dstStep
- VDUP dSum,dSumAboveLeftU8[0]
-
- B DCPredict4x4VertStore
-
-DCPredict4x4LeftOnlyAvailable
-
- MOV return, #OMX_Sts_NoErr ;// returnNoError
-
- VPADDL dSumLeftValU16, dLeftVal ;// [ XX | pSrcLeft[2+3 | 0+1]]
- VPADDL dSumLeftValU32, dSumLeftValU16 ;// [ XXXX | pSrcLeft[2+3+0+1]]
-
- VRSHR dSumLeftValU32,dSumLeftValU32,#2 ;// Sum = (Sum + 2) >> 2
- ADD pDstTmp, pDst, dstStep
- ADD dstep, dstStep, dstStep
- VDUP dSum,dSumLeftValU8[0]
-
- B DCPredict4x4VertStore
-
-DCPredict4x4LeftNotAvailable
-
- TST availability, #OMX_VC_UPPER
- BEQ DCPredict4x4NoneAvailable
-
- ;// Load Upper Edge
- VLD1 dAboveU32[0],[pSrcAbove] ;// pSrcAbove[0 to 3]
- MOV return, #OMX_Sts_NoErr
-
- VPADDL dSumAboveValU16, dAboveVal ;// [ XX | pSrcAbove[2+3 | 0+1]]
- VPADDL dSumAboveValU32, dSumAboveValU16 ;// [ XXXX | pSrcAbove[2+3+0+1]]
-
- VRSHR dSumAboveValU32,dSumAboveValU32,#2 ;// Sum = (Sum + 2) >> 2
- ADD pDstTmp, pDst, dstStep
- ADD dstep, dstStep, dstStep
- VDUP dSum,dSumAboveValU8[0]
-
- B DCPredict4x4VertStore
-
-DCPredict4x4NoneAvailable
-
- VMOV dConst128U8,#0x80 ;// 0x8080808080808080 if(count == 0)
- MOV return, #OMX_Sts_NoErr
-
- ADD pDstTmp, pDst, dstStep
- ADD dstep, dstStep, dstStep
- B DCPredict4x4VertStore
-
-
-
-OMX_VC_4x4_DIAG_DL
-
- TST availability, #OMX_VC_UPPER_RIGHT
- BEQ DiagDLUpperRightNotAvailable
-
- VLD1 dAbove0,[pSrcAbove] ;// [U7|U6|U5|U4|U3|U2|U1|U0]
- VDUP dU7, dAbove0[7] ;// [U7|U7|U7|U7|U7|U7|U7|U7]
- VEXT dAbove1, dAbove0, dU7, #1 ;// [U7|U7|U6|U5|U4|U3|U2|U1]
- VEXT dAbove2, dAbove0, dU7, #2 ;// [U7|U7|U7|U6|U5|U4|U3|U2]
- B DiagDLPredict4x4Store
-
-DiagDLUpperRightNotAvailable
- VLD1 dAboveU32[1],[pSrcAbove] ;// [U3|U2|U1|U0|-|-|-|-]
- VDUP dU3, dAbove[7] ;// [U3 U3 U3 U3 U3 U3 U3 U3]
-
- VEXT dAbove0, dAbove, dU3, #4 ;// [U3 U3 U3 U3 U3 U2 U1 U0]
- VEXT dAbove1, dAbove, dU3, #5 ;// [U3 U3 U3 U3 U3 U3 U2 U1]
- VEXT dAbove2, dAbove, dU3, #6 ;// [U3 U3 U3 U3 U3 U3 U3 U2]
-
-DiagDLPredict4x4Store
-
- VHADD dTmp, dAbove0, dAbove2
- VRHADD dTmp, dTmp, dAbove1 ;// (a+2*b+c+2)>>2
-
-
- VST1 dTmpU32[0],[pDst],dstStep
- VEXT dTmp,dTmp,dTmp,#1
- VST1 dTmpU32[0],[pDst],dstStep
- VEXT dTmp,dTmp,dTmp,#1
- VST1 dTmpU32[0],[pDst],dstStep
- VEXT dTmp,dTmp,dTmp,#1
- VST1 dTmpU32[0],[pDst]
-
- B ExitPredict4x4 ;// Branch to exit code
-
-
-OMX_VC_4x4_DIAG_DR
-
-
- ;// Load U0,U1,U2,U3
-
- VLD1 dAboveU32[0],[pSrcAbove] ;// [X|X|X|X|U3|U2|U1|U0]
-
- ;// Load UL,L0,L1,L2,L3 ;// dLeft = [UL|L0|L1|L2|L3|X|X|X]
- VLD1 {dLeft[7]},[pSrcAboveLeft]
- ADD pSrcTmp, pSrcLeft, leftStep
- ADD srcStep, leftStep, leftStep
- ADD pDst1,pDst,dstStep
-
- VLD1 {dLeft[6]},[pSrcLeft],srcStep ;// pSrcLeft[0*leftStep]
- VLD1 {dLeft[5]},[pSrcTmp],srcStep ;// pSrcLeft[1*leftStep]
- VLD1 {dLeft[4]},[pSrcLeft] ;// pSrcLeft[2*leftStep]
- VLD1 {dLeft[3]},[pSrcTmp] ;// pSrcLeft[3*leftStep]
-
-
- VEXT dAbove0,dLeft,dAbove,#3 ;// [U2|U1|U0|UL|L0|L1|L2|L3]
- ADD pDst2,pDst1,dstStep
- VEXT dAbove1,dLeft,dAbove,#4 ;// [U3|U2|U1|U0|UL|L0|L1|L2]
- ADD pDst3,pDst2,dstStep
- VEXT dAbove2,dLeft,dAbove,#5 ;// [ X|U3|U2|U1|U0|UL|L0|L1]
-
- VHADD dTmp, dAbove0, dAbove2
- VRHADD dTmp, dTmp, dAbove1 ;// (a+2*b+c+2)>>2
-
-
- VST1 dTmpU32[0],[pDst3] ;// Store pTmp[0],[1],[2],[3] @ pDst3
- VEXT dTmp,dTmp,dTmp,#1
- VST1 dTmpU32[0],[pDst2] ;// Store pTmp[1],[2],[3],[4] @ pDst2
- VEXT dTmp,dTmp,dTmp,#1
- VST1 dTmpU32[0],[pDst1] ;// Store pTmp[2],[3],[4],[5] @ pDst1
- VEXT dTmp,dTmp,dTmp,#1
- VST1 dTmpU32[0],[pDst] ;// Store pTmp[3],[4],[5],[6] @ pDst
-
- B ExitPredict4x4 ;// Branch to exit code
-
-OMX_VC_4x4_VR
-
-
- ;// Load UL,U0,U1,U2,U3
- VLD1 dAboveU32[0],[pSrcAbove]
- VLD1 dAbove[7],[pSrcAboveLeft] ;// [UL|X|X|X|U3|U2|U1|U0]
-
- ;// Load L0,L1,L2 ;// dLeft0 = [L0|L2|X|X|X|X|X|X]
- ;// dLeft1 = [L1| X|X|X|X|X|X|X]
- VLD1 {dLeft0[7]},[pSrcLeft],leftStep ;// pSrcLeft[0*leftStep]
- VLD1 {dLeft1[7]},[pSrcLeft],leftStep ;// pSrcLeft[1*leftStep]
- VLD1 {dLeft0[6]},[pSrcLeft] ;// pSrcLeft[2*leftStep]
-
-
- VEXT dOdd2,dAbove,dAbove,#7 ;// [ x x x U3 U2 U1 U0 UL ]
- VEXT dEven0,dLeft0,dOdd2,#6 ;// [ x x x U1 U0 UL L0 L2 ]
- VEXT dEven1,dLeft1,dOdd2,#7 ;// [ x x x U2 U1 U0 UL L1 ]
- VEXT dEven2,dLeft0,dAbove,#7 ;// [ x x x U3 U2 U1 U0 L0 ]
- VEXT dOdd0,dLeft1,dAbove,#7 ;// [ x x x U3 U2 U1 U0 L1 ]
- VEXT dOdd1,dLeft0,dOdd2,#7 ;// [ x x x U2 U1 U0 UL L0 ]
-
- VHADD dTmp1, dOdd0, dOdd2
- VRHADD dTmp1, dTmp1, dOdd1 ;// Tmp[ x x x 9 7 5 3 1 ]
-
- VHADD dTmp0, dEven0, dEven2
- VRHADD dTmp0, dTmp0, dEven1 ;// Tmp[ x x x 8 6 4 2 0 ]
-
-
- VEXT dTmp3,dTmp1,dTmp1,#1 ;// Tmp[ x x x x 9 7 5 3 ]
- ADD pDstTmp, pDst, dstStep
- ADD dstep, dstStep, dstStep
- VEXT dTmp2,dTmp0,dTmp0,#1 ;// Tmp[ x x x x 8 6 4 2 ]
-
-
- VST1 dTmp3U32[0],[pDst],dstep ;// Tmp[9],[7],[5],[3]
- VST1 dTmp2U32[0],[pDstTmp],dstep ;// Tmp[8],[6],[4],[2]
- VST1 dTmp1U32[0],[pDst],dstep ;// Tmp[7],[5],[3],[1]
- VST1 dTmp0U32[0],[pDstTmp] ;// Tmp[6],[4],[2],[0]
-
- B ExitPredict4x4 ;// Branch to exit code
-
-OMX_VC_4x4_HD
-
-
- ;// Load U0,U1,U2,U3
- VLD1 dAbove,[pSrcAbove] ;//dAboveLeftVal = [U7|U6|U5|U4|U3|U2|U1|U0]
-
- ;// Load UL,L0,L1,L2,L3 ;// dLeft = [UL|L0|L1|L2|L3|X|X|X]
- VLD1 {dLeft[7]},[pSrcAboveLeft]
- ADD pSrcTmp, pSrcLeft, leftStep
- ADD srcStep, leftStep, leftStep
-
- VLD1 {dLeft[6]},[pSrcLeft],srcStep ;// pSrcLeft[0*leftStep]
- VLD1 {dLeft[5]},[pSrcTmp],srcStep ;// pSrcLeft[1*leftStep]
- VLD1 {dLeft[4]},[pSrcLeft] ;// pSrcLeft[2*leftStep]
- VLD1 {dLeft[3]},[pSrcTmp] ;// pSrcLeft[3*leftStep]
-
- VEXT dAbove0,dLeft,dAbove,#3 ;// [ U2|U1|U0|UL|L0|L1|L2|L3 ]
- VEXT dAbove1,dLeft,dAbove,#2 ;// [ U1|U0|UL|L0|L1|L2|L3|X ]
- VEXT dAbove2,dLeft,dAbove,#1 ;// [ U0|UL|L0|L1|L2|L3|X|X ]
-
- VHADD dTmp0, dAbove0, dAbove2
- VRHADD dTmp0, dTmp0, dAbove1 ;// Tmp[ 0 | 1 | 2 | 4 | 6 | 8 | X | X ]
-
-
- VRHADD dTmp1, dAbove1, dAbove0 ;// (a+b+1)>>1
- VSHL dTmp1U64,dTmp1U64,#24 ;// Tmp[ 3|5| 7 |9 | X | X | X | X ]
-
-
- VSHL dTmpU64,dTmp0U64,#16 ;// Tmp[ 2|4|6|8| X | X | X | X ]
- VZIP dTmp1,dTmp ;// dTmp = [ 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 ]
- VEXT dTmp0,dTmp0,dTmp0,#6 ;// Tmp[ X| X| X| X| X| X| 0 | 1 ]
- VEXT dTmp1,dTmp,dTmp0,#2 ;// Tmp[ 0 | 1 | 2 | 3 | 4 | 5 | 6 |7 ]
-
- ADD pDstTmp, pDst, dstStep
- ADD dstep, dstStep, dstStep
-
- VST1 dTmp1U32[1],[pDst],dstep ;// Store pTmp[0|1|2|3]
- VST1 dTmpU32[1],[pDstTmp],dstep ;// Store pTmp[2|3|4|5]
- VST1 dTmp1U32[0],[pDst] ;// Store pTmp[4|5|6|7]
- VST1 dTmpU32[0],[pDstTmp] ;// Store pTmp[6|7|8|9]
-
- B ExitPredict4x4 ;// Branch to exit code
-
-OMX_VC_4x4_VL
-
-
- TST availability, #OMX_VC_UPPER_RIGHT
- BEQ DiagVLUpperRightNotAvailable
-
- VLD1 dAbove0,[pSrcAbove] ;// [U7|U6|U5|U4|U3|U2|U1|U0]
- VEXT dAbove1,dAbove0,dAbove0,#1 ;// [ X|U7|U6|U5|U4|U3|U2|U1]
- VEXT dAbove2,dAbove1,dAbove1,#1 ;// [ X| X|U7|U6|U5|U4|U3|U2]
-
- B DiagVLPredict4x4Store
-
-DiagVLUpperRightNotAvailable
- VLD1 dAboveU32[1],[pSrcAbove] ;// [U3|U2|U1|U0|-|-|-|-]
- VDUP dU3, dAbove[7] ;// [U3 U3 U3 U3 U3 U3 U3 U3]
-
- VEXT dAbove0, dAbove, dU3, #4 ;// [U3 U3 U3 U3 U3 U2 U1 U0]
- VEXT dAbove1, dAbove, dU3, #5 ;// [U3 U3 U3 U3 U3 U3 U2 U1]
- VEXT dAbove2, dAbove, dU3, #6 ;// [U3 U3 U3 U3 U3 U3 U3 U2]
-
-DiagVLPredict4x4Store
-
- VRHADD dTmp0, dAbove1, dAbove0 ;// (a+b+1)>>1
- ;// Tmp[ X| X| X| 8| 6| 4| 2| 0 ]
-
- VHADD dTmp3, dAbove0, dAbove2
- VRHADD dTmp3, dTmp3, dAbove1 ;// (a+2*b+c+2)>>2
- ;// Tmp[ X| X| X| 9| 7| 5| 3| 1 ]
-
- VEXT dTmp1,dTmp0,dTmp0,#1 ;// Tmp[ X| X| X| X| 8| 6| 4| 2 ]
- ADD pDstTmp, pDst, dstStep
- ADD dstep, dstStep, dstStep
- VEXT dTmp2,dTmp3,dTmp1,#1 ;// Tmp[ X| X| X| X| 9| 7| 5| 3 ]
-
- VST1 dTmp0U32[0],[pDst],dstep ;// Tmp[6],[4],[2],[0]
- VST1 dTmp3U32[0],[pDstTmp],dstep ;// Tmp[7],[5],[3],[1]
- VST1 dTmp1U32[0],[pDst] ;// Tmp[8],[6],[4],[2]
- VST1 dTmp2U32[0],[pDstTmp] ;// Tmp[9],[7],[5],[3]
-
- B ExitPredict4x4 ;// Branch to exit code
-
-OMX_VC_4x4_HU
- ADD pSrcTmp, pSrcLeft, leftStep
- ADD srcStep, leftStep, leftStep
-
- ;// Load Left Edge ;// [L3|L2|L1|L0|X|X|X|X]
- VLD1 {dLeft[4]},[pSrcLeft],srcStep ;// pSrcLeft[0*leftStep]
- VLD1 {dLeft[5]},[pSrcTmp],srcStep ;// pSrcLeft[1*leftStep]
- VLD1 {dLeft[6]},[pSrcLeft] ;// pSrcLeft[2*leftStep]
- VLD1 {dLeft[7]},[pSrcTmp] ;// pSrcLeft[3*leftStep]
-
- VDUP dL3,dLeft[7] ;// [L3|L3|L3|L3|L3|L3|L3|L3]
-
- VEXT dLeftHU0,dLeft,dL3,#4 ;// [L3|L3|L3|L3|L3|L2|L1|L0]
- VEXT dLeftHU1,dLeft,dL3,#5 ;// [L3|L3|L3|L3|L3|L3|L2|L1]
- VEXT dLeftHU2,dLeft,dL3,#6 ;// [L3|L3|L3|L3|L3|L3|L3|L2]
-
- VHADD dTmp0, dLeftHU0, dLeftHU2
- VRHADD dTmp0, dTmp0, dLeftHU1 ;// Tmp[ L3 | L3 | L3 | L3 | L3 | 5 | 3 | 1 ]
-
- VRHADD dTmp1, dLeftHU1, dLeftHU0 ;// (a+b+1)>>1
- ;// Tmp[ L3 | L3 | L3 | L3 | L3 | 4 | 2 | 0 ]
-
- VZIP dTmp1,dTmp0 ;// dTmp1 = Tmp[7| 6| 5| 4| 3| 2| 1| 0]
- ;// dTmp0 = [L3|L3|L3|L3|L3|L3|L3|L3]
-
-
- VST1 dTmp1U32[0],[pDst],dstStep ;// [3|2|1|0]
- VEXT dTmp1,dTmp1,dTmp1,#2
- VST1 dTmp1U32[0],[pDst],dstStep ;// [5|4|3|2]
- VEXT dTmp1,dTmp1,dTmp1,#2
- VST1 dTmp1U32[0],[pDst],dstStep ;// [7|6|5|4]
- VST1 dTmp0U32[0],[pDst] ;// [9|8|7|6]
-
-
-ExitPredict4x4
-
- MOV return, #OMX_Sts_NoErr
- M_END
-
- ENDIF ;// CortexA8
-
- END
-;//-----------------------------------------------------------------------------------------------
-;// omxVCM4P10_PredictIntra_4x4 ends
-;//-----------------------------------------------------------------------------------------------
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_TransformDequantChromaDCFromPair_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_TransformDequantChromaDCFromPair_s.s
deleted file mode 100644
index 5981795..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_TransformDequantChromaDCFromPair_s.s
+++ /dev/null
@@ -1,154 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_TransformDequantChromaDCFromPair_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- IMPORT armVCM4P10_QPDivTable
- IMPORT armVCM4P10_VMatrixQPModTable
-
- M_VARIANTS CortexA8
-
-
-
-
- IF CortexA8
-
-;// ARM Registers
-;//--------------------------------------
-;// Declare input registers
-;//--------------------------------------
-ppSrc RN 0
-pDst RN 1
-QP RN 2
-
-;//--------------------------------
-;// Scratch variable for Unpack2x2
-;//--------------------------------
-pSrc RN 9
-Value RN 4
-Value2 RN 5
-Flag RN 6
-strOffset RN 7
-cstOffset RN 8
-
-;//--------------------------------
-;// Scratch variable
-;//--------------------------------
-r0w0 RN 3
-r0w1 RN 4
-
-c0w0 RN 5
-c1w0 RN 6
-
-return RN 0
-pQPDivTable RN 5
-pQPModTable RN 6
-Shift RN 9
-Scale RN 2
-
-
-
-;// Neon Registers
-
-dZero DN D0.U16
-dInvTrCoeff DN D0.S16
-dScale DN D1.S16
-qDqntCoeff QN Q1.S32
-dDqntCoeff DN D2.S16
-
-
- ;// Write function header
- M_START omxVCM4P10_TransformDequantChromaDCFromPair, r9
-
- LDR pSrc, [ppSrc] ;// Load pSrc
- VMOV dZero, #0
- MOV cstOffset, #31 ;// To be used in the loop, to compute offset
-
- ;//-----------------------------------------------------------------------
- ;// Firstly, fill all the coefficient values on the <pDst> buffer by zero
- ;//-----------------------------------------------------------------------
-
- VST1 dZero,[pDst] ;// pDst[0] = pDst[1] = pDst[2] = pDst[3] = 0
- LDRB Flag, [pSrc], #1 ;// Preload <Flag> before <unpackLoop>
-
-
-unpackLoop
- TST Flag, #0x10 ;// Computing (Flag & 0x10)
- LDRSBNE Value2,[pSrc,#1]
- LDRBNE Value, [pSrc], #2 ;// Load byte wise to avoid unaligned access
- AND strOffset, cstOffset, Flag, LSL #1 ;// strOffset = (Flag & 15) < 1;
- LDRSBEQ Value, [pSrc], #1 ;// Value = (OMX_U8) *pSrc++
- ORRNE Value,Value,Value2, LSL #8 ;// Value = (OMX_U16) *pSrc++
-
- TST Flag, #0x20 ;// Computing (Flag & 0x20) to check, if we're done
- LDRBEQ Flag, [pSrc], #1 ;// Flag = (OMX_U8) *pSrc++, for next iteration
- STRH Value, [pDst, strOffset] ;// Store <Value> at offset <strOffset>
- BEQ unpackLoop ;// Branch to the loop beginning
-
- ;//--------------------------------------------------
- ;//InvTransformDC2x2: Inlined (Implemented in ARM V6)
- ;//--------------------------------------------------
-
- LDMIA pDst, {r0w0, r0w1} ;// r0w0 = |c1|c0| & r0w1 = |c3|c2|
-
- STR pSrc, [ppSrc] ;// Update the bitstream pointer
-
- LDR pQPDivTable, =armVCM4P10_QPDivTable ;// QP Division look-up-table base pointer
- LDR pQPModTable, =armVCM4P10_VMatrixQPModTable ;// QP Modulo look-up-table base pointer
-
- SADDSUBX r0w0, r0w0, r0w0 ;// [ c00+c01, c00-c01 ]
- SADDSUBX r0w1, r0w1, r0w1 ;// [ c10+c11, c10-c11 ]
-
- LDRSB Shift, [pQPDivTable, QP] ;// Shift = pQPDivTable[QP]
- LDRSB Scale, [pQPModTable, QP] ;// Scale = pQPModTable[QP]
-
- SADD16 c0w0, r0w0, r0w1 ;// [ d00+d10, d01+d11 ]
- SSUB16 c1w0, r0w0, r0w1 ;// [ d00-d10, d01-d11 ]
-
- ;//-------------------------------------------------
- ;//DequantChromaDC2x2: Inlined (Neon Implementation)
- ;//-------------------------------------------------
-
- LSL Scale, Scale, Shift ;// Scale = Scale << Shift
- VMOV dInvTrCoeff, c0w0, c1w0
- VREV32 dInvTrCoeff,dInvTrCoeff
- VDUP dScale,Scale
-
- VMULL qDqntCoeff,dInvTrCoeff,dScale
- VSHRN dDqntCoeff,qDqntCoeff,#1
-
-
- VST1 dDqntCoeff,[pDst] ;// Storing all the coefficients at once
-
- MOV return, #OMX_Sts_NoErr
- M_END
-
- ENDIF ;// CortexA8
-
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_TransformDequantLumaDCFromPair_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_TransformDequantLumaDCFromPair_s.s
deleted file mode 100644
index d8c2431..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src/omxVCM4P10_TransformDequantLumaDCFromPair_s.s
+++ /dev/null
@@ -1,278 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P10_TransformDequantLumaDCFromPair_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-;// Description:
-;// H.264 inverse quantize and transform module
-;//
-;//
-
-;// Include standard headers
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
-;// Import/Export symbols required from/to other files
-;// (For example tables)
-
- IMPORT armVCM4P10_UnpackBlock4x4
- IMPORT armVCM4P10_QPDivTable
- IMPORT armVCM4P10_VMatrixQPModTable
-
- M_VARIANTS CortexA8
-
-;// Set debugging level
-;//DEBUG_ON SETL {TRUE}
-
-
-;// Static Function: armVCM4P10_InvTransformDequantLumaDC4x4
-
-
-;// Guarding implementation by the processor name
-
-
-
-;// Static Function: armVCM4P10_InvTransformDequantLumaDC4x4
-
-;// Guarding implementation by the processor name
-
- IF CortexA8
-
-;//Input Registers
-pData RN 0
-QP RN 1
-
-
-;//Local Scratch Registers
-
-;// ARM Registers
-
-pQPDivTable RN 2
-pQPModTable RN 3
-Shift RN 4
-Scale RN 5
-
-;// NEON Registers
-
-;// Packed Input pixels
-dIn0 DN D0.S16
-dIn1 DN D1.S16
-dIn2 DN D2.S16
-dIn3 DN D3.S16
-
-;// Intermediate calculations
-dRowSum1 DN D4.S16
-dRowSum2 DN D5.S16
-dRowDiff1 DN D6.S16
-dRowDiff2 DN D7.S16
-
-;// Row operated pixels
-dRowOp0 DN D0.S16
-dRowOp1 DN D1.S16
-dRowOp2 DN D2.S16
-dRowOp3 DN D3.S16
-qRowOp01 QN Q0.32
-qRowOp23 QN Q1.32
-
-;// Intermediate calculations
-dColSum1 DN D4.S16
-dColSum2 DN D5.S16
-dColDiff1 DN D6.S16
-dColDiff2 DN D7.S16
-
-;// Coloumn operated pixels
-dColOp0 DN D0.S16
-dColOp1 DN D1.S16
-dColOp2 DN D2.S16
-dColOp3 DN D3.S16
-
-;// Temporary scratch varaibles
-
-dScale DN D5.S16
-qRound0 QN Q3.S32
-qRound1 QN Q4.S32
-qRound2 QN Q5.S32
-qRound3 QN Q6.S32
-
-;// InvTransformed and Dequantized pixels
-dOut0 DN D0.S16
-dOut1 DN D1.S16
-dOut2 DN D2.S16
-dOut3 DN D3.S16
-
-
- ;// Allocate stack memory required by the function
-
-
- ;// Write function header
- M_START armVCM4P10_InvTransformDequantLumaDC4x4,r5,d13
-
- ;******************************************************************
- ;// The strategy used in implementing the transform is as follows:*
- ;// Load the 4x4 block into 4 D-registers *
- ;// Transpose the 4x4 matrix *
- ;// Perform the row operations (on columns) using SIMD *
- ;// Transpose the 4x4 result matrix *
- ;// Perform the coloumn operations *
- ;******************************************************************
-
- ;// Load all the 4x4 pixels in Transposed form
-
- VLD4 {dIn0,dIn1,dIn2,dIn3},[pData]
- LDR pQPDivTable, =armVCM4P10_QPDivTable ;// QP Division look-up-table base pointer
- LDR pQPModTable, =armVCM4P10_VMatrixQPModTable ;// QP Modulo look-up-table base pointer
-
- ;****************************************
- ;// Row Operations (Performed on columns)
- ;****************************************
- ;// Scale factor calculation is done using ARM instructions
- ;// Interleaved with NEON instructions inorder to Dual issue
-
- VADD dRowSum1,dIn0,dIn1
- VADD dRowSum2,dIn2,dIn3
- VSUB dRowDiff1,dIn0,dIn1
- LDRSB Shift, [pQPDivTable, QP] ;// ARM CODE: Shift = pQPDivTable[QP]
- VSUB dRowDiff2,dIn2,dIn3
- LDRSB Scale, [pQPModTable, QP] ;// ARM CODE: Scale = pQPModTable[QP]
- VADD dRowOp0,dRowSum1,dRowSum2
- VSUB dRowOp1,dRowSum1,dRowSum2
- VSUB dRowOp2,dRowDiff1,dRowDiff2
- LSL Scale, Scale, Shift ;// ARM CODE: Scale = Scale << Shift
- VADD dRowOp3,dRowDiff1,dRowDiff2
-
- ;****************************************
- ;// Transpose the resultant matrix
- ;****************************************
-
- VTRN dRowOp0,dRowOp1
- VTRN dRowOp2,dRowOp3
- VTRN qRowOp01,qRowOp23
-
- ;****************************************
- ;// Coloumn Operations
- ;****************************************
-
- VADD dColSum1,dRowOp0,dRowOp1
- VADD dColSum2,dRowOp2,dRowOp3
- VSUB dColDiff1,dRowOp0,dRowOp1
- VSUB dColDiff2,dRowOp2,dRowOp3
- VADD dColOp0,dColSum1,dColSum2
- VSUB dColOp1,dColSum1,dColSum2
- VSUB dColOp2,dColDiff1,dColDiff2
- VADD dColOp3,dColDiff1,dColDiff2
-
- ;//----------------------------------------------------------------------
- ;//
- ;// <Dequantize> improves on the c-reference code
- ;// Both the cases i.e., Shift>=0 and Shift<0 cases are covered together
- ;// We do not subtract 2 from Shift as in C reference, instead perform a
- ;// Scale << Shift once in the beginning and do a right shift by a
- ;// constant 2 after the Multiplication. The value of Round would be 2
- ;//
- ;// By doing this we aviod the Branches required and also
- ;// reduce the code size substantially
- ;//
- ;//----------------------------------------------------------------------
-
-
- VDUP dScale, Scale ;// ARM -> NEON copy 'scale' to vector
-
-
- VMOV qRound0,#2 ;// Set the Round Value
- VMOV qRound1,#2
- VMOV qRound2,#2
- VMOV qRound3,#2
-
- VMLAL qRound0,dColOp0,dScale ;// pDst[i] * Scale + Round
- VMLAL qRound1,dColOp1,dScale
- VMLAL qRound2,dColOp2,dScale
- VMLAL qRound3,dColOp3,dScale
-
- VSHRN dOut0,qRound0,#2 ;// Right shift by 2 & (OMX_S16)Value
- VSHRN dOut1,qRound1,#2
- VSHRN dOut2,qRound2,#2
- VSHRN dOut3,qRound3,#2
-
- ;***************************
- ;// Store all the 4x4 pixels
- ;***************************
-
- VST1 {dOut0,dOut1,dOut2,dOut3}, [pData]
-
-
- ;// Set return value
-
- ;// Write function tail
- M_END
-
- ENDIF ;//CORTEXA8
-
-
-
-;// Function: omxVCM4P10_TransformDequantLumaDCFromPair
-
-;//Input Registers
-ppSrc RN 0
-pDst RN 1
-QPR2 RN 2
-
-;//Output Registers
-result RN 0
-
-;//Local Scratch Registers
-pDstR4 RN 4
-pDstR0 RN 0
-QPR1 RN 1
-QPR5 RN 5
-
-;// Guarding implementation by the processor name
-
- IF CortexA8
-
- ;// Allocate stack memory required by the function
-
-
- ;// Write function header
- M_START omxVCM4P10_TransformDequantLumaDCFromPair,r5
-
- MOV pDstR4,pDst ;// Saving register r1
- MOV QPR5,QPR2 ;// Saving register r2
- BL armVCM4P10_UnpackBlock4x4
-
- MOV pDstR0,pDstR4 ;// Setting up register r0
- MOV QPR1,QPR5 ;// Setting up register r1
- BL armVCM4P10_InvTransformDequantLumaDC4x4
-
-
- ;// Set return value
- MOV result,#OMX_Sts_NoErr
-
- ;// Write function tail
- M_END
-
-
- ENDIF ;//ARM1136JS
-
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_Average_4x_Align_unsafe_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_Average_4x_Align_unsafe_s.S
deleted file mode 100644
index e1ffb09..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_Average_4x_Align_unsafe_s.S
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
-
- .global armVCM4P10_Average_4x4_Align0_unsafe
-armVCM4P10_Average_4x4_Align0_unsafe:
- PUSH {r4-r6,lr}
- LDR r7, =0x80808080
- LDR r12,[r2,#0]
- LDR r10,[r0],r1
- LDR lr,[r2,r3]
- LDR r11,[r0],r1
- MVN r12,r12
- MVN lr,lr
- UHSUB8 r5,r10,r12
- UHSUB8 r4,r11,lr
- EOR r5,r5,r7
- STR r5,[r2],r3
- EOR r4,r4,r7
- STR r4,[r2],r3
- LDR r10,[r0],r1
- LDR r12,[r2,#0]
- LDR r11,[r0],r1
- LDR lr,[r2,r3]
- MVN r12,r12
- UHSUB8 r5,r10,r12
- MVN lr,lr
- UHSUB8 r4,r11,lr
- EOR r5,r5,r7
- STR r5,[r2],r3
- EOR r4,r4,r7
- STR r4,[r2],r3
- POP {r4-r6,pc}
-
- .global armVCM4P10_Average_4x4_Align2_unsafe
-armVCM4P10_Average_4x4_Align2_unsafe:
- PUSH {r4-r6,lr}
- LDR r7, =0x80808080
- LDR r4,[r0,#4]
- LDR r10,[r0],r1
- LDR r12,[r2,#0]
- LDR lr,[r2,r3]
- LDR r5,[r0,#4]
- LDR r11,[r0],r1
- MVN r12,r12
- MVN lr,lr
- LSR r10,r10,#16
- ORR r10,r10,r4,LSL #16
- LSR r11,r11,#16
- ORR r11,r11,r5,LSL #16
- UHSUB8 r5,r10,r12
- UHSUB8 r4,r11,lr
- EOR r5,r5,r7
- STR r5,[r2],r3
- EOR r4,r4,r7
- STR r4,[r2],r3
- LDR r4,[r0,#4]
- LDR r10,[r0],r1
- LDR r12,[r2,#0]
- LDR lr,[r2,r3]
- LDR r5,[r0,#4]
- LDR r11,[r0],r1
- MVN r12,r12
- MVN lr,lr
- LSR r10,r10,#16
- ORR r10,r10,r4,LSL #16
- LSR r11,r11,#16
- ORR r11,r11,r5,LSL #16
- UHSUB8 r5,r10,r12
- UHSUB8 r4,r11,lr
- EOR r5,r5,r7
- STR r5,[r2],r3
- EOR r4,r4,r7
- STR r4,[r2],r3
- POP {r4-r6,pc}
-
- .global armVCM4P10_Average_4x4_Align3_unsafe
-armVCM4P10_Average_4x4_Align3_unsafe:
- PUSH {r4-r6,lr}
- LDR r7, =0x80808080
- LDR r4,[r0,#4]
- LDR r10,[r0],r1
- LDR r12,[r2,#0]
- LDR lr,[r2,r3]
- LDR r5,[r0,#4]
- LDR r11,[r0],r1
- MVN r12,r12
- MVN lr,lr
- LSR r10,r10,#24
- ORR r10,r10,r4,LSL #8
- LSR r11,r11,#24
- ORR r11,r11,r5,LSL #8
- UHSUB8 r5,r10,r12
- UHSUB8 r4,r11,lr
- EOR r5,r5,r7
- STR r5,[r2],r3
- EOR r4,r4,r7
- STR r4,[r2],r3
- LDR r4,[r0,#4]
- LDR r10,[r0],r1
- LDR r12,[r2,#0]
- LDR lr,[r2,r3]
- LDR r5,[r0,#4]
- LDR r11,[r0],r1
- MVN r12,r12
- MVN lr,lr
- LSR r10,r10,#24
- ORR r10,r10,r4,LSL #8
- LSR r11,r11,#24
- ORR r11,r11,r5,LSL #8
- UHSUB8 r5,r10,r12
- UHSUB8 r4,r11,lr
- EOR r5,r5,r7
- STR r5,[r2],r3
- EOR r4,r4,r7
- STR r4,[r2],r3
- POP {r4-r6,pc}
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_DeblockingChroma_unsafe_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_DeblockingChroma_unsafe_s.S
deleted file mode 100644
index 40ea4a9..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_DeblockingChroma_unsafe_s.S
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
-
- .global armVCM4P10_DeblockingChromabSLT4_unsafe
-armVCM4P10_DeblockingChromabSLT4_unsafe:
- VLD1.32 {d18[0]},[r5]!
- VSUBL.U8 q11,d5,d9
- VMOV d28,d18
- VSUBL.U8 q10,d8,d4
- VSHR.S16 q11,q11,#2
- VZIP.8 d18,d28
- VBIF d18,d14,d16
- VRHADD.S16 q10,q11,q10
- VADD.I8 d31,d18,d15
- VQMOVN.S16 d20,q10
- VLD1.8 {d0[]},[r2]
- VMIN.S8 d20,d20,d31
- VNEG.S8 d31,d31
- VLD1.8 {d2[]},[r3]
- VMAX.S8 d20,d20,d31
- VMOVL.U8 q14,d4
- VMOVL.U8 q12,d8
- VADDW.S8 q14,q14,d20
- VSUBW.S8 q12,q12,d20
- VQMOVUN.S16 d29,q14
- VQMOVUN.S16 d24,q12
- BX lr
-
- .global armVCM4P10_DeblockingChromabSGE4_unsafe
-armVCM4P10_DeblockingChromabSGE4_unsafe:
- VHADD.U8 d13,d4,d9
- VHADD.U8 d31,d8,d5
- VLD1.8 {d0[]},[r2]
- ADD r5,r5,#4
- VLD1.8 {d2[]},[r3]
- VRHADD.U8 d13,d13,d5
- VRHADD.U8 d31,d31,d9
- BX lr
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_DeblockingLuma_unsafe_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_DeblockingLuma_unsafe_s.S
deleted file mode 100644
index 05fb2c5..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_DeblockingLuma_unsafe_s.S
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
-
- .global armVCM4P10_DeblockingLumabSLT4_unsafe
-armVCM4P10_DeblockingLumabSLT4_unsafe:
- VSUBL.U8 q11,d5,d9
- VLD1.8 {d18[]},[r5]!
- VSUBL.U8 q10,d8,d4
- VLD1.8 {d19[]},[r5]!
- VSHR.S16 q11,q11,#2
- VEXT.8 d18,d18,d19,#4
- VAND d19,d17,d15
- VBIF d18,d14,d16
- VRHADD.S16 q10,q11,q10
- VRHADD.U8 d24,d4,d8
- VADD.I8 d31,d18,d19
- VAND d19,d12,d15
- VQADD.U8 d23,d5,d18
- VQMOVN.S16 d20,q10
- VADD.I8 d31,d31,d19
- VQSUB.U8 d22,d5,d18
- VQADD.U8 d19,d9,d18
- VHADD.U8 d26,d24,d6
- VMIN.S8 d20,d20,d31
- VNEG.S8 d31,d31
- VQSUB.U8 d21,d9,d18
- VHADD.U8 d27,d24,d10
- VMAX.U8 d30,d26,d22
- VMAX.S8 d20,d20,d31
- VMOVL.U8 q14,d4
- VMOVL.U8 q12,d8
- VADDW.S8 q14,q14,d20
- VSUBW.S8 q12,q12,d20
- VQMOVUN.S16 d29,q14
- VQMOVUN.S16 d24,q12
- VMAX.U8 d25,d27,d21
- VMIN.U8 d30,d30,d23
- VMIN.U8 d25,d25,d19
- VBIF d29,d4,d16
- VBIF d30,d5,d17
- VBIF d24,d8,d16
- VBIF d25,d9,d12
- BX lr
-
- .global armVCM4P10_DeblockingLumabSGE4_unsafe
-armVCM4P10_DeblockingLumabSGE4_unsafe:
- VSHR.U8 d19,d0,#2
- VADD.I8 d19,d19,d15
- VADDL.U8 q10,d8,d4
- VADD.I8 d19,d19,d15
- VADDL.U8 q11,d6,d9
- VADDW.U8 q12,q10,d5
- VCGT.U8 d19,d19,d13
- VSHR.U16 q11,q11,#1
- VHADD.U16 q11,q12,q11
- VADDW.U8 q12,q12,d6
- VADDL.U8 q13,d7,d6
- VAND d17,d17,d19
- VHADD.U8 d28,d4,d9
- VSRA.U16 q13,q12,#1
- VAND d12,d12,d19
- VQRSHRN.U16 d29,q11,#1
- VRHADD.U8 d28,d28,d5
- VQRSHRN.U16 d30,q12,#2
- VADDL.U8 q11,d10,d5
- VADDW.U8 q12,q10,d9
- VBIF d29,d28,d17
- VQRSHRN.U16 d31,q13,#2
- VADDL.U8 q13,d11,d10
- VSHR.U16 q11,q11,#1
- VHADD.U16 q11,q12,q11
- VADDW.U8 q12,q12,d10
- VHADD.U8 d28,d8,d5
- VBIF d29,d4,d16
- VBIF d30,d5,d17
- VSRA.U16 q13,q12,#1
- VQRSHRN.U16 d25,q12,#2
- VQRSHRN.U16 d24,q11,#1
- VRHADD.U8 d22,d28,d9
- VBIF d25,d9,d12
- VBIF d31,d6,d17
- VBIF d24,d22,d12
- VQRSHRN.U16 d28,q13,#2
- VBIF d24,d8,d16
- VBIF d28,d10,d12
- BX lr
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_DecodeCoeffsToPair_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_DecodeCoeffsToPair_s.S
deleted file mode 100644
index 27c0452..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_DecodeCoeffsToPair_s.S
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
-
- .extern armVCM4P10_CAVLCCoeffTokenTables
- .extern armVCM4P10_SuffixToLevel
- .extern armVCM4P10_CAVLCTotalZeros2x2Tables
- .extern armVCM4P10_CAVLCTotalZeroTables
- .extern armVCM4P10_CAVLCRunBeforeTables
- .extern armVCM4P10_ZigZag_2x2
- .extern armVCM4P10_ZigZag_4x4
-
- .hidden armVCM4P10_CAVLCCoeffTokenTables
- .hidden armVCM4P10_SuffixToLevel
- .hidden armVCM4P10_CAVLCTotalZeros2x2Tables
- .hidden armVCM4P10_CAVLCTotalZeroTables
- .hidden armVCM4P10_CAVLCRunBeforeTables
- .hidden armVCM4P10_ZigZag_2x2
- .hidden armVCM4P10_ZigZag_4x4
-
- .global armVCM4P10_DecodeCoeffsToPair
-armVCM4P10_DecodeCoeffsToPair:
- PUSH {r4-r12,lr}
- SUB sp,sp,#0x40
- LDR r10,[r0,#0]
- LDR r12,[r1,#0]
- LDR r6, .LarmVCM4P10_CAVLCCoeffTokenTables
-P0: ADD r6, pc
- LDR r4,[sp,#0x68]
- LDRB r9,[r10,#2]
- LDRB r8,[r10,#1]
- LDRB r11,[r10],#3
- ADD r12,r12,#8
- LDR r6,[r6,r4,LSL #2]
- ORR r9,r9,r8,LSL #8
- ORR r11,r9,r11,LSL #16
- LSLS r8,r11,r12
- MOVS r7,#0x1e
- AND r7,r7,r8,LSR #27
- SUBS r12,r12,#8
-L0x44:
- BCC L1
- LDRB r8,[r10],#1
-L1:
- LDRH r7,[r6,r7]
- ADDCC r12,r12,#8
- ADD r12,r12,#4
- ORRCS r11,r8,r11,LSL #8
- LSRS r8,r7,#1
- BCS L0x74
- LSLS r8,r11,r12
- SUBS r12,r12,#0xa
- ADD r7,r7,r8,LSR #29
- BIC r7,r7,#1
- B L0x44
-L0x74:
- SUB r12,r12,r7,LSR #13
- BIC r7,r8,#0xf000
- LSRS r5,r7,#2
- STRB r5,[r2,#0]
- BEQ L0x344
- CMP r7,#0x44
- BGE L0x33c
- STR r0,[sp,#0]
- STR r1,[sp,#4]
- STR r3,[sp,#8]
- ANDS r1,r7,#3
- ADD r2,sp,#0xc
- BEQ L0xd8
- MOV r0,r1
-L0xac:
- LSLS r7,r11,r12
- SUBS r12,r12,#7
- BCC L2
- LDRB r8,[r10],#1
-L2:
- ADDCC r12,r12,#8
- LSR r7,r7,#31
- ORRCS r11,r8,r11,LSL #8
- SUBS r0,r0,#1
- MOV r8,#1
- SUB r8,r8,r7,LSL #1
- STRH r8,[r2],#2
- BGT L0xac
-L0xd8:
- SUBS r0,r5,r1
- BEQ L0x1b8
- MOV r4,#1
- CMP r5,#0xa
- MOVLE r4,#0
- CMP r1,#3
- MOVLT r1,#4
- MOVGE r1,#2
- MOVGE r4,#0
-L0xfc:
- LSLS r7,r11,r12
- CLZ r7,r7
- ADD r12,r12,r7
- SUBS r12,r12,#7
- BCC L3
- LDRB r8,[r10],#1
- ORR r11,r8,r11,LSL #8
- SUBS r12,r12,#8
- BCC L3
- LDRB r8,[r10],#1
-L3:
- ADDCC r12,r12,#8
- ORRCS r11,r8,r11,LSL #8
- CMP r7,#0x10
- BGE L0x33c
- MOVS lr,r4
- TEQEQ r7,#0xe
- MOVEQ lr,#4
- TEQ r7,#0xf
- MOVEQ lr,#0xc
- TEQEQ r4,#0
- ADDEQ r7,r7,#0xf
- TEQ lr,#0
- BEQ L0x184
- LSL r3,r11,r12
- ADD r12,r12,lr
- SUBS r12,r12,#8
- RSB r9,lr,#0x20
- BCC L4
- LDRB r8,[r10],#1
- ORR r11,r8,r11,LSL #8
- SUBS r12,r12,#8
- BCC L4
- LDRB r8,[r10],#1
-L4:
- ADDCC r12,r12,#8
- LSR r3,r3,r9
- ORRCS r11,r8,r11,LSL #8
- LSL r7,r7,r4
- ADD r7,r3,r7
-L0x184:
- ADD r7,r7,r1
- MOV r1,#2
- LSRS r8,r7,#1
- RSBCS r8,r8,#0
- STRH r8,[r2],#2
- LDR r9, .LarmVCM4P10_SuffixToLevel
-P1: ADD r9, pc
- LDRSB r8,[r9,r4]
- TEQ r4,#0
- MOVEQ r4,#1
- CMP r7,r8
- ADDCS r4,r4,#1
- SUBS r0,r0,#1
- BGT L0xfc
-L0x1b8:
- LDR r8,[sp,#0x6c]
- SUB r0,r5,#1
- SUBS r1,r8,r5
- ADD r4,sp,#0x2c
- MOV lr,r5
- SUB lr,lr,#1
- BEQ L0x2b0
- TEQ r8,#4
- LDREQ r6, .LarmVCM4P10_CAVLCTotalZeros2x2Tables
- LDRNE r6, .LarmVCM4P10_CAVLCTotalZeroTables
-P2: ADD r6, pc
- LDR r6,[r6,r5,LSL #2]
- LSLS r8,r11,r12
- MOVS r7,#0x1e
- AND r7,r7,r8,LSR #27
- SUBS r12,r12,#8
-L0x1f4:
- BCC L5
- LDRB r8,[r10],#1
-L5:
- LDRH r7,[r6,r7]
- ADDCC r12,r12,#8
- ADD r12,r12,#4
- ORRCS r11,r8,r11,LSL #8
- LSRS r8,r7,#1
- BCS L0x224
- LSLS r8,r11,r12
- SUBS r12,r12,#0xa
- ADD r7,r7,r8,LSR #29
- BIC r7,r7,#1
- B L0x1f4
-L0x224:
- SUB r12,r12,r7,LSR #13
- BIC r7,r8,#0xf000
- CMP r7,#0x10
- BGE L0x33c
- LDR r3, .LarmVCM4P10_CAVLCRunBeforeTables
-P3: ADD r3, pc
- ADD r4,sp,#0x2c
- MOVS r1,r7
- ADD lr,lr,r1
- BEQ L0x2b0
-L0x248:
- SUBS r0,r0,#1
- LDR r6,[r3,r1,LSL #2]
- BLT L0x2bc
- LSLS r8,r11,r12
- MOVS r7,#0xe
- AND r7,r7,r8,LSR #28
- SUBS r12,r12,#8
-L0x264:
- BCC L6
- LDRB r8,[r10],#1
-L6:
- LDRH r7,[r6,r7]
- ADDCC r12,r12,#8
- ADD r12,r12,#3
- ORRCS r11,r8,r11,LSL #8
- LSRS r8,r7,#1
- BCS L0x294
- LSLS r8,r11,r12
- SUBS r12,r12,#9
- ADD r7,r7,r8,LSR #29
- BIC r7,r7,#1
- B L0x264
-L0x294:
- SUB r12,r12,r7,LSR #13
- BIC r7,r8,#0xf000
- CMP r7,#0xf
- BGE L0x33c
- SUBS r1,r1,r7
- STRB r7,[r4],#1
- BGT L0x248
-L0x2b0:
- SUBS r0,r0,#1
- BLT L7
- STRB r1,[r4],#1
-L7:
- BGT L0x2b0
-L0x2bc:
- STRB r1,[r4],#1
- LDR r8,[sp,#0x6c]
- TEQ r8,#0xf
- ADDEQ lr,lr,#1
- SUB r4,r4,r5
- SUB r2,r2,r5
- SUB r2,r2,r5
- LDR r3,[sp,#8]
- LDR r0,[r3,#0]
- TEQ r8,#4
- LDREQ r6, .LarmVCM4P10_ZigZag_2x2
- LDRNE r6, .LarmVCM4P10_ZigZag_4x4
-P4: ADD r6, pc
-L0x2ec:
- LDRB r9,[r4],#1
- LDRB r8,[r6,lr]
- SUB lr,lr,#1
- SUB lr,lr,r9
- LDRSH r9,[r2],#2
- SUBS r5,r5,#1
- ORREQ r8,r8,#0x20
- ADD r1,r9,#0x80
- CMP r1,#0x100
- ORRCS r8,r8,#0x10
- TEQ r5,#0
- STRB r8,[r0],#1
- STRB r9,[r0],#1
- LSR r9,r9,#8
- BCC L8
- STRB r9,[r0],#1
-L8:
- BNE L0x2ec
- STR r0,[r3,#0]
- LDR r0,[sp,#0]
- LDR r1,[sp,#4]
- B L0x344
-L0x33c:
- MVN r0,#1
- B L0x35c
-L0x344:
- ADD r10,r10,r12,LSR #3
- AND r12,r12,#7
- SUB r10,r10,#4
- STR r12,[r1,#0]
- STR r10,[r0,#0]
- MOV r0,#0
-L0x35c:
- ADD sp,sp,#0x40
- POP {r4-r12,pc}
-
-.LarmVCM4P10_CAVLCCoeffTokenTables:
- .word armVCM4P10_CAVLCCoeffTokenTables-(P0+8)
-.LarmVCM4P10_SuffixToLevel:
- .word armVCM4P10_SuffixToLevel-(P1+8)
-.LarmVCM4P10_CAVLCTotalZeros2x2Tables:
- .word (armVCM4P10_CAVLCTotalZeros2x2Tables - 4)-(P2+8)
-.LarmVCM4P10_CAVLCTotalZeroTables:
- .word (armVCM4P10_CAVLCTotalZeroTables - 4)-(P2+8)
-.LarmVCM4P10_CAVLCRunBeforeTables:
- .word (armVCM4P10_CAVLCRunBeforeTables - 4)-(P3+8)
-.LarmVCM4P10_ZigZag_2x2:
- .word armVCM4P10_ZigZag_2x2-(P4+8)
-.LarmVCM4P10_ZigZag_4x4:
- .word armVCM4P10_ZigZag_4x4-(P4+8)
-
- .end
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_DequantTables_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_DequantTables_s.S
deleted file mode 100644
index 6febf2f..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_DequantTables_s.S
+++ /dev/null
@@ -1,125 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .section .rodata
- .align 4
-
-
- .global armVCM4P10_QPDivTable
- .global armVCM4P10_VMatrixQPModTable
- .global armVCM4P10_PosToVCol4x4
- .global armVCM4P10_PosToVCol2x2
- .global armVCM4P10_VMatrix
- .global armVCM4P10_QPModuloTable
- .global armVCM4P10_VMatrixU16
-
- .hidden armVCM4P10_QPDivTable
- .hidden armVCM4P10_VMatrixQPModTable
- .hidden armVCM4P10_PosToVCol4x4
- .hidden armVCM4P10_PosToVCol2x2
- .hidden armVCM4P10_VMatrix
- .hidden armVCM4P10_QPModuloTable
- .hidden armVCM4P10_VMatrixU16
-
-armVCM4P10_PosToVCol4x4:
- .byte 0, 2, 0, 2
- .byte 2, 1, 2, 1
- .byte 0, 2, 0, 2
- .byte 2, 1, 2, 1
-
-armVCM4P10_PosToVCol2x2:
- .byte 0, 2
- .byte 2, 1
-
-armVCM4P10_VMatrix:
- .byte 10, 16, 13
- .byte 11, 18, 14
- .byte 13, 20, 16
- .byte 14, 23, 18
- .byte 16, 25, 20
- .byte 18, 29, 23
-
-;//-------------------------------------------------------
-;// This table evaluates the expression [(INT)(QP/6)],
-;// for values of QP from 0 to 51 (inclusive).
-;//-------------------------------------------------------
-
-armVCM4P10_QPDivTable:
- .byte 0, 0, 0, 0, 0, 0
- .byte 1, 1, 1, 1, 1, 1
- .byte 2, 2, 2, 2, 2, 2
- .byte 3, 3, 3, 3, 3, 3
- .byte 4, 4, 4, 4, 4, 4
- .byte 5, 5, 5, 5, 5, 5
- .byte 6, 6, 6, 6, 6, 6
- .byte 7, 7, 7, 7, 7, 7
- .byte 8, 8, 8, 8, 8, 8
-
-;//----------------------------------------------------
-;// This table contains armVCM4P10_VMatrix[QP%6][0] entires,
-;// for values of QP from 0 to 51 (inclusive).
-;//----------------------------------------------------
-
-armVCM4P10_VMatrixQPModTable:
- .byte 10, 11, 13, 14, 16, 18
- .byte 10, 11, 13, 14, 16, 18
- .byte 10, 11, 13, 14, 16, 18
- .byte 10, 11, 13, 14, 16, 18
- .byte 10, 11, 13, 14, 16, 18
- .byte 10, 11, 13, 14, 16, 18
- .byte 10, 11, 13, 14, 16, 18
- .byte 10, 11, 13, 14, 16, 18
- .byte 10, 11, 13, 14, 16, 18
-
-;//-------------------------------------------------------
-;// This table evaluates the modulus expression [QP%6]*6,
-;// for values of QP from 0 to 51 (inclusive).
-;//-------------------------------------------------------
-
-armVCM4P10_QPModuloTable:
- .byte 0, 6, 12, 18, 24, 30
- .byte 0, 6, 12, 18, 24, 30
- .byte 0, 6, 12, 18, 24, 30
- .byte 0, 6, 12, 18, 24, 30
- .byte 0, 6, 12, 18, 24, 30
- .byte 0, 6, 12, 18, 24, 30
- .byte 0, 6, 12, 18, 24, 30
- .byte 0, 6, 12, 18, 24, 30
- .byte 0, 6, 12, 18, 24, 30
-
-;//-------------------------------------------------------
-;// This table contains the invidual byte values stored as
-;// halfwords. This avoids unpacking inside the function
-;//-------------------------------------------------------
-
-armVCM4P10_VMatrixU16:
- .hword 10, 16, 13
- .hword 11, 18, 14
- .hword 13, 20, 16
- .hword 14, 23, 18
- .hword 16, 25, 20
- .hword 18, 29, 23
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_Align_unsafe_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_Align_unsafe_s.S
deleted file mode 100644
index 1de9004..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_Align_unsafe_s.S
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
-
- .global armVCM4P10_InterpolateLuma_HorAlign9x_unsafe
-armVCM4P10_InterpolateLuma_HorAlign9x_unsafe:
- MOV r12,r8
- AND r7,r0,#3
- BIC r0,r0,#3
- ADD pc,pc,r7,LSL #2
- NOP
- B Copy0toAligned
- B Copy1toAligned
- B Copy2toAligned
- B Copy3toAligned
-Copy0toAligned:
- LDM r0,{r7,r10,r11}
- SUBS r9,r9,#1
- ADD r0,r0,r1
- STM r8!,{r7,r10,r11}
- BGT Copy0toAligned
- B CopyEnd
-Copy1toAligned:
- LDM r0,{r7,r10,r11}
- SUBS r9,r9,#1
- ADD r0,r0,r1
- LSR r7,r7,#8
- ORR r7,r7,r10,LSL #24
- LSR r10,r10,#8
- ORR r10,r10,r11,LSL #24
- LSR r11,r11,#8
- STM r8!,{r7,r10,r11}
- BGT Copy1toAligned
- B CopyEnd
-Copy2toAligned:
- LDM r0,{r7,r10,r11}
- SUBS r9,r9,#1
- ADD r0,r0,r1
- LSR r7,r7,#16
- ORR r7,r7,r10,LSL #16
- LSR r10,r10,#16
- ORR r10,r10,r11,LSL #16
- LSR r11,r11,#16
- STM r8!,{r7,r10,r11}
- BGT Copy2toAligned
- B CopyEnd
-Copy3toAligned:
- LDM r0,{r7,r10,r11}
- SUBS r9,r9,#1
- ADD r0,r0,r1
- LSR r7,r7,#24
- ORR r7,r7,r10,LSL #8
- LSR r10,r10,#24
- ORR r10,r10,r11,LSL #8
- LSR r11,r11,#24
- STM r8!,{r7,r10,r11}
- BGT Copy3toAligned
-CopyEnd:
- MOV r0,r12
- MOV r1,#0xc
- BX lr
-
- .global armVCM4P10_InterpolateLuma_VerAlign4x_unsafe
-armVCM4P10_InterpolateLuma_VerAlign4x_unsafe:
- AND r7,r0,#3
- BIC r0,r0,#3
- ADD pc,pc,r7,LSL #2
- NOP
- B Copy0toVAligned
- B Copy1toVAligned
- B Copy2toVAligned
- B Copy3toVAligned
-Copy0toVAligned:
- LDR r7,[r0],r1
- SUBS r9,r9,#1
- STR r7,[r8],#4
- BGT Copy0toVAligned
- B CopyVEnd
-Copy1toVAligned:
- LDR r10,[r0,#4]
- LDR r7,[r0],r1
- SUBS r9,r9,#1
- LSL r10,r10,#24
- ORR r7,r10,r7,LSR #8
- STR r7,[r8],#4
- BGT Copy1toVAligned
- B CopyVEnd
-Copy2toVAligned:
- LDR r10,[r0,#4]
- LDR r7,[r0],r1
- SUBS r9,r9,#1
- LSL r10,r10,#16
- ORR r7,r10,r7,LSR #16
- STR r7,[r8],#4
- BGT Copy2toVAligned
- B CopyVEnd
-Copy3toVAligned:
- LDR r10,[r0,#4]
- LDR r7,[r0],r1
- SUBS r9,r9,#1
- LSL r10,r10,#8
- ORR r7,r10,r7,LSR #24
- STR r7,[r8],#4
- BGT Copy3toVAligned
-CopyVEnd:
- SUB r0,r8,#0x1c
- MOV r1,#4
- BX lr
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_Copy_unsafe_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_Copy_unsafe_s.S
deleted file mode 100644
index 7ba2890..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_Copy_unsafe_s.S
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
-
- .global armVCM4P10_InterpolateLuma_Copy4x4_unsafe
-armVCM4P10_InterpolateLuma_Copy4x4_unsafe:
- PUSH {r4-r6,lr}
- AND r12,r0,#3
- BIC r0,r0,#3
- ADD pc,pc,r12,LSL #2
- NOP
- B Copy4x4Align0
- B Copy4x4Align1
- B Copy4x4Align2
- B Copy4x4Align3
-Copy4x4Align0:
- LDR r4,[r0],r1
- LDR r5,[r0],r1
- STR r4,[r2],r3
- LDR r8,[r0],r1
- STR r5,[r2],r3
- LDR r9,[r0],r1
- STR r8,[r2],r3
- STR r9,[r2],r3
- B Copy4x4End
-Copy4x4Align1:
- LDR r5,[r0,#4]
- LDR r4,[r0],r1
- LDR r9,[r0,#4]
- LDR r8,[r0],r1
- LSR r4,r4,#8
- ORR r4,r4,r5,LSL #24
- STR r4,[r2],r3
- LSR r8,r8,#8
- ORR r8,r8,r9,LSL #24
- LDR r5,[r0,#4]
- LDR r4,[r0],r1
- STR r8,[r2],r3
- LDR r9,[r0,#4]
- LDR r8,[r0],r1
- LSR r4,r4,#8
- ORR r4,r4,r5,LSL #24
- STR r4,[r2],r3
- LSR r8,r8,#8
- ORR r8,r8,r9,LSL #24
- STR r8,[r2],r3
- B Copy4x4End
-Copy4x4Align2:
- LDR r5,[r0,#4]
- LDR r4,[r0],r1
- LDR r9,[r0,#4]
- LDR r8,[r0],r1
- LSR r4,r4,#16
- ORR r4,r4,r5,LSL #16
- STR r4,[r2],r3
- LSR r8,r8,#16
- ORR r8,r8,r9,LSL #16
- STR r8,[r2],r3
- LDR r5,[r0,#4]
- LDR r4,[r0],r1
- LDR r9,[r0,#4]
- LDR r8,[r0],r1
- LSR r4,r4,#16
- ORR r4,r4,r5,LSL #16
- STR r4,[r2],r3
- LSR r8,r8,#16
- ORR r8,r8,r9,LSL #16
- STR r8,[r2],r3
- B Copy4x4End
-Copy4x4Align3:
- LDR r5,[r0,#4]
- LDR r4,[r0],r1
- LDR r9,[r0,#4]
- LDR r8,[r0],r1
- LSR r4,r4,#24
- ORR r4,r4,r5,LSL #8
- STR r4,[r2],r3
- LSR r8,r8,#24
- ORR r8,r8,r9,LSL #8
- STR r8,[r2],r3
- LDR r5,[r0,#4]
- LDR r4,[r0],r1
- LDR r9,[r0,#4]
- LDR r8,[r0],r1
- LSR r4,r4,#24
- ORR r4,r4,r5,LSL #8
- STR r4,[r2],r3
- LSR r8,r8,#24
- ORR r8,r8,r9,LSL #8
- STR r8,[r2],r3
-Copy4x4End:
- POP {r4-r6,pc}
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_DiagCopy_unsafe_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_DiagCopy_unsafe_s.S
deleted file mode 100644
index 8b2c678..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_DiagCopy_unsafe_s.S
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
-
- .global armVCM4P10_InterpolateLuma_HorDiagCopy_unsafe
-armVCM4P10_InterpolateLuma_HorDiagCopy_unsafe:
- PUSH {r4-r6,lr}
- MOV lr,#4
- LDR r6, =0xfe00fe0
- LDR r12, =0xff00ff
-LoopStart1:
- LDR r11,[r0,#0xc]
- LDR r10,[r0,#8]
- LDR r5,[r0,#4]
- LDR r4,[r0],r1
- UQSUB16 r11,r11,r6
- UQSUB16 r10,r10,r6
- UQSUB16 r5,r5,r6
- UQSUB16 r4,r4,r6
- USAT16 r11,#13,r11
- USAT16 r10,#13,r10
- USAT16 r5,#13,r5
- USAT16 r4,#13,r4
- AND r11,r12,r11,LSR #5
- AND r10,r12,r10,LSR #5
- AND r5,r12,r5,LSR #5
- AND r4,r12,r4,LSR #5
- ORR r11,r10,r11,LSL #8
- ORR r10,r4,r5,LSL #8
- SUBS lr,lr,#1
- STRD r10,r11,[r7],#8
- BGT LoopStart1
- SUB r0,r7,#0x20
- MOV r1,#8
- POP {r4-r6,pc}
-
- .global armVCM4P10_InterpolateLuma_VerDiagCopy_unsafe
-armVCM4P10_InterpolateLuma_VerDiagCopy_unsafe:
- PUSH {r4-r6,lr}
- LDR r6, =0xfe00fe0
- LDR r12, =0xff00ff
- MOV lr,#2
-LoopStart:
- LDR r11,[r0,#0xc]
- LDR r10,[r0,#8]
- LDR r5,[r0,#4]
- LDR r4,[r0],r1
- UQSUB16 r11,r11,r6
- UQSUB16 r10,r10,r6
- UQSUB16 r5,r5,r6
- UQSUB16 r4,r4,r6
- USAT16 r11,#13,r11
- USAT16 r10,#13,r10
- USAT16 r5,#13,r5
- USAT16 r4,#13,r4
- AND r11,r12,r11,LSR #5
- AND r10,r12,r10,LSR #5
- AND r5,r12,r5,LSR #5
- AND r4,r12,r4,LSR #5
- ORR r11,r10,r11,LSL #8
- ORR r10,r4,r5,LSL #8
- PKHBT r4,r10,r11,LSL #16
- STR r4,[r7],#8
- PKHTB r5,r11,r10,ASR #16
- STR r5,[r7],#-4
- LDR r11,[r0,#0xc]
- LDR r10,[r0,#8]
- LDR r5,[r0,#4]
- LDR r4,[r0],r1
- UQSUB16 r11,r11,r6
- UQSUB16 r10,r10,r6
- UQSUB16 r5,r5,r6
- UQSUB16 r4,r4,r6
- USAT16 r11,#13,r11
- USAT16 r10,#13,r10
- USAT16 r5,#13,r5
- USAT16 r4,#13,r4
- AND r11,r12,r11,LSR #5
- AND r10,r12,r10,LSR #5
- AND r5,r12,r5,LSR #5
- AND r4,r12,r4,LSR #5
- ORR r11,r10,r11,LSL #8
- ORR r10,r4,r5,LSL #8
- PKHBT r4,r10,r11,LSL #16
- SUBS lr,lr,#1
- STR r4,[r7],#8
- PKHTB r5,r11,r10,ASR #16
- STR r5,[r7],#4
- BGT LoopStart
- SUB r0,r7,#0x18
- MOV r1,#4
- POP {r4-r6,pc}
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe_s.S
deleted file mode 100644
index 77aa927..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe_s.S
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
-
- .global armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe
-armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe:
- PUSH {r4-r12,lr}
- VLD1.8 {d0,d1},[r0],r1
- VMOV.I16 d31,#0x14
- VMOV.I16 d30,#0x5
- VEXT.8 d4,d0,d1,#1
- VEXT.8 d2,d0,d1,#2
- VEXT.8 d3,d0,d1,#3
- VEXT.8 d5,d0,d1,#4
- VEXT.8 d1,d0,d1,#5
- VADDL.U8 q1,d2,d3
- VADDL.U8 q2,d4,d5
- VADDL.U8 q5,d0,d1
- VLD1.8 {d0,d1},[r0],r1
- VMLA.I16 d10,d2,d31
- VMUL.I16 d8,d4,d30
- VEXT.8 d4,d0,d1,#1
- VEXT.8 d2,d0,d1,#2
- VEXT.8 d3,d0,d1,#3
- VEXT.8 d5,d0,d1,#4
- VEXT.8 d1,d0,d1,#5
- VADDL.U8 q1,d2,d3
- VADDL.U8 q2,d4,d5
- VADDL.U8 q6,d0,d1
- VLD1.8 {d0,d1},[r0],r1
- VSUB.I16 d10,d10,d8
- VMLA.I16 d12,d2,d31
- VMUL.I16 d8,d4,d30
- VEXT.8 d4,d0,d1,#1
- VEXT.8 d2,d0,d1,#2
- VEXT.8 d3,d0,d1,#3
- VEXT.8 d5,d0,d1,#4
- VEXT.8 d1,d0,d1,#5
- VADDL.U8 q1,d2,d3
- VADDL.U8 q2,d4,d5
- VADDL.U8 q7,d0,d1
- VLD1.8 {d0,d1},[r0],r1
- VSUB.I16 d12,d12,d8
- VMLA.I16 d14,d2,d31
- VMUL.I16 d8,d4,d30
- VEXT.8 d4,d0,d1,#1
- VEXT.8 d2,d0,d1,#2
- VEXT.8 d3,d0,d1,#3
- VEXT.8 d5,d0,d1,#4
- VEXT.8 d1,d0,d1,#5
- VADDL.U8 q1,d2,d3
- VADDL.U8 q2,d4,d5
- VADDL.U8 q8,d0,d1
- VLD1.8 {d0,d1},[r0],r1
- VSUB.I16 d14,d14,d8
- VMLA.I16 d16,d2,d31
- VMUL.I16 d8,d4,d30
- VEXT.8 d4,d0,d1,#1
- VEXT.8 d2,d0,d1,#2
- VEXT.8 d3,d0,d1,#3
- VEXT.8 d5,d0,d1,#4
- VEXT.8 d1,d0,d1,#5
- VADDL.U8 q1,d2,d3
- VADDL.U8 q2,d4,d5
- VADDL.U8 q9,d0,d1
- VLD1.8 {d0,d1},[r0],r1
- VSUB.I16 d16,d16,d8
- VMLA.I16 d18,d2,d31
- VMUL.I16 d8,d4,d30
- VEXT.8 d4,d0,d1,#1
- VEXT.8 d2,d0,d1,#2
- VEXT.8 d3,d0,d1,#3
- VEXT.8 d5,d0,d1,#4
- VEXT.8 d1,d0,d1,#5
- VADDL.U8 q1,d2,d3
- VADDL.U8 q2,d4,d5
- VADDL.U8 q10,d0,d1
- VLD1.8 {d0,d1},[r0],r1
- VSUB.I16 d18,d18,d8
- VMLA.I16 d20,d2,d31
- VMUL.I16 d8,d4,d30
- VEXT.8 d4,d0,d1,#1
- VEXT.8 d2,d0,d1,#2
- VEXT.8 d3,d0,d1,#3
- VEXT.8 d5,d0,d1,#4
- VEXT.8 d1,d0,d1,#5
- VADDL.U8 q1,d2,d3
- VADDL.U8 q2,d4,d5
- VADDL.U8 q11,d0,d1
- VLD1.8 {d0,d1},[r0],r1
- VSUB.I16 d20,d20,d8
- VMLA.I16 d22,d2,d31
- VMUL.I16 d8,d4,d30
- VEXT.8 d4,d0,d1,#1
- VEXT.8 d2,d0,d1,#2
- VEXT.8 d3,d0,d1,#3
- VEXT.8 d5,d0,d1,#4
- VEXT.8 d1,d0,d1,#5
- VADDL.U8 q1,d2,d3
- VADDL.U8 q2,d4,d5
- VADDL.U8 q12,d0,d1
- VLD1.8 {d0,d1},[r0],r1
- VSUB.I16 d22,d22,d8
- VMLA.I16 d24,d2,d31
- VMUL.I16 d8,d4,d30
- VEXT.8 d4,d0,d1,#1
- VEXT.8 d2,d0,d1,#2
- VEXT.8 d3,d0,d1,#3
- VEXT.8 d5,d0,d1,#4
- VEXT.8 d1,d0,d1,#5
- VADDL.U8 q1,d2,d3
- VADDL.U8 q2,d4,d5
- VADDL.U8 q13,d0,d1
- VSUB.I16 d24,d24,d8
- VMLA.I16 d26,d2,d31
- VMUL.I16 d8,d4,d30
- VMOV.I32 q15,#0x14
- VMOV.I32 q14,#0x5
- VADDL.S16 q5,d10,d20
- VADDL.S16 q1,d14,d16
- VADDL.S16 q0,d12,d18
- VSUB.I16 d26,d26,d8
- VMLA.I32 q5,q1,q15
- VMUL.I32 q4,q0,q14
- VADDL.S16 q6,d12,d22
- VADDL.S16 q1,d16,d18
- VADDL.S16 q0,d14,d20
- VMLA.I32 q6,q1,q15
- VSUB.I32 q5,q5,q4
- VMUL.I32 q4,q0,q14
- VADDL.S16 q2,d14,d24
- VADDL.S16 q1,d18,d20
- VADDL.S16 q0,d16,d22
- VMLA.I32 q2,q1,q15
- VSUB.I32 q6,q6,q4
- VMUL.I32 q4,q0,q14
- VADDL.S16 q3,d16,d26
- VADDL.S16 q1,d20,d22
- VADDL.S16 q0,d18,d24
- VMLA.I32 q3,q1,q15
- VSUB.I32 q2,q2,q4
- VMLS.I32 q3,q0,q14
- VQRSHRUN.S32 d0,q5,#10
- VQRSHRUN.S32 d2,q6,#10
- VQRSHRUN.S32 d4,q2,#10
- VQRSHRUN.S32 d6,q3,#10
- VQMOVN.U16 d0,q0
- VQMOVN.U16 d2,q1
- VQMOVN.U16 d4,q2
- VQMOVN.U16 d6,q3
- POP {r4-r12,pc}
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe_s.S
deleted file mode 100644
index e5f7f1c..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe_s.S
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
-
- .global armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe
-armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe:
- PUSH {r4-r12,lr}
- VLD1.8 {d0,d1},[r0],r1
- ADD r12,r0,r1,LSL #2
- VMOV.I8 d30,#0x5
- VMOV.I8 d31,#0x14
- VLD1.8 {d10,d11},[r12],r1
- VLD1.8 {d2,d3},[r0],r1
- VLD1.8 {d12,d13},[r12],r1
- VADDL.U8 q9,d0,d10
- VLD1.8 {d4,d5},[r0],r1
- VADDL.U8 q0,d1,d11
- VLD1.8 {d6,d7},[r0],r1
- VADDL.U8 q10,d2,d12
- VLD1.8 {d8,d9},[r0],r1
- VMLAL.U8 q9,d4,d31
- VLD1.8 {d14,d15},[r12],r1
- VMLAL.U8 q0,d5,d31
- VLD1.8 {d16,d17},[r12],r1
- VMLAL.U8 q9,d6,d31
- VMLAL.U8 q10,d6,d31
- VMLSL.U8 q0,d3,d30
- VADDL.U8 q11,d4,d14
- VMLSL.U8 q9,d2,d30
- VADDL.U8 q1,d3,d13
- VMLAL.U8 q0,d7,d31
- VMLAL.U8 q10,d8,d31
- VMLSL.U8 q9,d8,d30
- VMLAL.U8 q1,d7,d31
- VMLSL.U8 q0,d9,d30
- VMLAL.U8 q11,d8,d31
- VMLSL.U8 q10,d4,d30
- VMLSL.U8 q1,d5,d30
- VADDL.U8 q2,d5,d15
- VMLAL.U8 q11,d10,d31
- VMLSL.U8 q10,d10,d30
- VMLAL.U8 q1,d9,d31
- VMLAL.U8 q2,d9,d31
- VADDL.U8 q12,d6,d16
- VMLSL.U8 q11,d6,d30
- VMLSL.U8 q1,d11,d30
- VMLSL.U8 q2,d7,d30
- VADDL.U8 q3,d7,d17
- VMLAL.U8 q12,d10,d31
- VMLSL.U8 q11,d12,d30
- VMLSL.U8 q2,d13,d30
- VMLAL.U8 q3,d11,d31
- VMLAL.U8 q12,d12,d31
- VEXT.8 d26,d18,d19,#2
- VMLAL.U8 q2,d11,d31
- VMLAL.U8 q3,d13,d31
- VMLSL.U8 q12,d8,d30
- VEXT.8 d27,d18,d19,#4
- VMOV.I16 d31,#0x14
- VMLSL.U8 q3,d9,d30
- VMLSL.U8 q12,d14,d30
- VEXT.8 d29,d19,d0,#2
- VEXT.8 d28,d18,d19,#6
- VMLSL.U8 q3,d15,d30
- VADDL.S16 q0,d18,d29
- VADD.I16 d27,d27,d28
- VMOV.I16 d30,#0x5
- VADD.I16 d26,d26,d19
- VMLAL.S16 q0,d27,d31
- VEXT.8 d27,d20,d21,#4
- VEXT.8 d28,d20,d21,#6
- VEXT.8 d29,d21,d2,#2
- VMLSL.S16 q0,d26,d30
- VEXT.8 d26,d20,d21,#2
- VADDL.S16 q1,d20,d29
- VADD.I16 d27,d27,d28
- VADD.I16 d26,d26,d21
- VEXT.8 d28,d22,d23,#6
- VMLAL.S16 q1,d27,d31
- VEXT.8 d29,d23,d4,#2
- VEXT.8 d27,d22,d23,#4
- VEXT.8 d8,d22,d23,#2
- VADDL.S16 q2,d22,d29
- VMLSL.S16 q1,d26,d30
- VADD.I16 d27,d27,d28
- VADD.I16 d26,d8,d23
- VEXT.8 d28,d24,d25,#6
- VMLAL.S16 q2,d27,d31
- VEXT.8 d27,d24,d25,#4
- VEXT.8 d29,d25,d6,#2
- VADD.I16 d27,d27,d28
- VEXT.8 d8,d24,d25,#2
- VADDL.S16 q3,d24,d29
- VMLSL.S16 q2,d26,d30
- VMLAL.S16 q3,d27,d31
- VADD.I16 d8,d8,d25
- VMLSL.S16 q3,d8,d30
- VQRSHRUN.S32 d0,q0,#10
- VQRSHRUN.S32 d2,q1,#10
- VQRSHRUN.S32 d4,q2,#10
- VQRSHRUN.S32 d6,q3,#10
- VQMOVN.U16 d0,q0
- VQMOVN.U16 d2,q1
- VQMOVN.U16 d4,q2
- VQMOVN.U16 d6,q3
- POP {r4-r12,pc}
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe_s.S
deleted file mode 100644
index 393d385..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe_s.S
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
-
- .global armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
-armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe:
- PUSH {r4-r12,lr}
- VLD1.8 {d22,d23},[r0],r1
- VEXT.8 d10,d22,d23,#5
- VEXT.8 d12,d22,d23,#1
- VEXT.8 d14,d22,d23,#2
- VEXT.8 d15,d22,d23,#3
- VEXT.8 d13,d22,d23,#4
- VADDL.U8 q11,d22,d10
- VADDL.U8 q4,d14,d15
- VADDL.U8 q6,d12,d13
- VLD1.8 {d24,d25},[r0],r1
- VMLA.I16 d22,d8,d31
- VMUL.I16 d8,d12,d30
- VEXT.8 d10,d24,d25,#5
- VEXT.8 d12,d24,d25,#1
- VEXT.8 d16,d24,d25,#2
- VEXT.8 d17,d24,d25,#3
- VEXT.8 d13,d24,d25,#4
- VADDL.U8 q12,d24,d10
- VSUB.I16 d22,d22,d8
- VADDL.U8 q4,d16,d17
- VADDL.U8 q6,d12,d13
- VLD1.8 {d26,d27},[r0],r1
- VMLA.I16 d24,d8,d31
- VMUL.I16 d8,d12,d30
- VEXT.8 d10,d26,d27,#5
- VEXT.8 d12,d26,d27,#1
- VEXT.8 d18,d26,d27,#2
- VEXT.8 d19,d26,d27,#3
- VEXT.8 d13,d26,d27,#4
- VADDL.U8 q13,d26,d10
- VSUB.I16 d24,d24,d8
- VADDL.U8 q4,d18,d19
- VADDL.U8 q6,d12,d13
- VLD1.8 {d28,d29},[r0],r1
- VMLA.I16 d26,d8,d31
- VMUL.I16 d8,d12,d30
- VEXT.8 d10,d28,d29,#5
- VEXT.8 d12,d28,d29,#1
- VEXT.8 d20,d28,d29,#2
- VEXT.8 d21,d28,d29,#3
- VEXT.8 d13,d28,d29,#4
- VADDL.U8 q14,d28,d10
- VSUB.I16 d26,d26,d8
- VADDL.U8 q4,d20,d21
- VADDL.U8 q6,d12,d13
- VMLA.I16 d28,d8,d31
- VMLS.I16 d28,d12,d30
- VQRSHRUN.S16 d22,q11,#5
- VQRSHRUN.S16 d24,q12,#5
- VQRSHRUN.S16 d26,q13,#5
- VQRSHRUN.S16 d28,q14,#5
- POP {r4-r12,pc}
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe_s.S
deleted file mode 100644
index 698e7b5..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe_s.S
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
-
- .global armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
-armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe:
- PUSH {r4-r12,lr}
- VLD1.8 {d7},[r0],r1
- ADD r12,r0,r1,LSL #2
- VLD1.8 {d8},[r0],r1
- VLD1.8 {d12},[r12],r1
- VLD1.8 {d9},[r0],r1
- VADDL.U8 q0,d7,d12
- VLD1.8 {d10},[r0],r1
- VLD1.8 {d13},[r12],r1
- VLD1.8 {d11},[r0],r1
- VLD1.8 {d14},[r12],r1
- VADDL.U8 q8,d8,d11
- VADDL.U8 q9,d9,d10
- VLD1.8 {d15},[r12],r1
- VMLS.I16 d0,d16,d30
- VMUL.I16 d20,d18,d31
- VADDL.U8 q8,d9,d12
- VADDL.U8 q9,d10,d11
- VADDL.U8 q1,d8,d13
- VMLS.I16 d2,d16,d30
- VMUL.I16 d21,d18,d31
- VADDL.U8 q8,d10,d13
- VADDL.U8 q9,d11,d12
- VADDL.U8 q2,d9,d14
- VMLS.I16 d4,d16,d30
- VMUL.I16 d22,d18,d31
- VADDL.U8 q8,d11,d14
- VADDL.U8 q3,d10,d15
- VADDL.U8 q9,d12,d13
- VMLS.I16 d6,d16,d30
- VADD.I16 d0,d0,d20
- VADD.I16 d2,d2,d21
- VADD.I16 d4,d4,d22
- VMLA.I16 d6,d18,d31
- VQRSHRUN.S16 d0,q0,#5
- VQRSHRUN.S16 d2,q1,#5
- VQRSHRUN.S16 d4,q2,#5
- VQRSHRUN.S16 d6,q3,#5
- POP {r4-r12,pc}
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_Interpolate_Chroma_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_Interpolate_Chroma_s.S
deleted file mode 100644
index e469516..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_Interpolate_Chroma_s.S
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
-
- .text
- .align 4
-
-armVCM4P10_WidthBranchTableMVIsNotZero:
- .word WidthIs2MVIsNotZero-(P0+8), WidthIs2MVIsNotZero-(P0+8)
- .word WidthIs4MVIsNotZero-(P0+8), WidthIs4MVIsNotZero-(P0+8)
- .word WidthIs8MVIsNotZero-(P0+8)
-
-armVCM4P10_WidthBranchTableMVIsZero:
- .word WidthIs2MVIsZero-(P0+8), WidthIs2MVIsZero-(P0+8)
- .word WidthIs4MVIsZero-(P0+8), WidthIs4MVIsZero-(P0+8)
- .word WidthIs8MVIsZero-(P0+8)
-
- .global armVCM4P10_Interpolate_Chroma
-armVCM4P10_Interpolate_Chroma:
- PUSH {r4-r12,lr}
- VPUSH {d8-d15}
- LDRD r6,r7,[sp,#0x70]
- LDRD r4,r5,[sp,#0x68]
- RSB r8,r6,#8
- RSB r9,r7,#8
- CMN r6,r7
- MOV r10,#1
- ADREQ r11, armVCM4P10_WidthBranchTableMVIsZero
- SUB lr,r1,r10
- ADRNE r11, armVCM4P10_WidthBranchTableMVIsNotZero
- VLD1.8 {d0},[r0],r10
- SMULBB r12,r8,r9
- SMULBB r9,r6,r9
- VLD1.8 {d1},[r0],lr
- SMULBB r8,r8,r7
- SMULBB r6,r6,r7
- VDUP.8 d12,r12
- VDUP.8 d13,r9
- VDUP.8 d14,r8
- VDUP.8 d15,r6
- LDR r11,[r11, r4, lsl #1]
-P0: ADD pc,r11
-
-WidthIs8MVIsNotZero:
- VLD1.8 {d2},[r0],r10
- VMULL.U8 q2,d0,d12
- VLD1.8 {d3},[r0],lr
- VMULL.U8 q3,d2,d12
- VLD1.8 {d16},[r0],r10
- VMLAL.U8 q2,d1,d13
- VLD1.8 {d17},[r0],lr
- VMULL.U8 q11,d16,d12
- VMLAL.U8 q3,d3,d13
- VLD1.8 {d18},[r0],r10
- VMLAL.U8 q2,d2,d14
- VMLAL.U8 q11,d17,d13
- VMULL.U8 q12,d18,d12
- VLD1.8 {d19},[r0],lr
- VMLAL.U8 q3,d16,d14
- VLD1.8 {d0},[r0],r10
- VMLAL.U8 q12,d19,d13
- VMLAL.U8 q11,d18,d14
- VMLAL.U8 q2,d3,d15
- VLD1.8 {d1},[r0],lr
- VMLAL.U8 q12,d0,d14
- VMLAL.U8 q3,d17,d15
- VMLAL.U8 q11,d19,d15
- SUBS r5,r5,#4
- VMLAL.U8 q12,d1,d15
- VQRSHRN.U16 d8,q2,#6
- VQRSHRN.U16 d9,q3,#6
- VQRSHRN.U16 d20,q11,#6
- VST1.64 {d8},[r2],r3
- VQRSHRN.U16 d21,q12,#6
- VST1.64 {d9},[r2],r3
- VST1.64 {d20},[r2],r3
- VST1.64 {d21},[r2],r3
- BGT WidthIs8MVIsNotZero
- MOV r0,#0
- VPOP {d8-d15}
- POP {r4-r12,pc}
-
-WidthIs4MVIsNotZero:
- VLD1.8 {d2},[r0],r10
- VMULL.U8 q2,d0,d12
- VMULL.U8 q3,d2,d12
- VLD1.8 {d3},[r0],lr
- VMLAL.U8 q2,d1,d13
- VMLAL.U8 q3,d3,d13
- VLD1.8 {d0},[r0],r10
- VMLAL.U8 q2,d2,d14
- VMLAL.U8 q3,d0,d14
- VLD1.8 {d1},[r0],lr
- SUBS r5,r5,#2
- VMLAL.U8 q3,d1,d15
- VMLAL.U8 q2,d3,d15
- VQRSHRN.U16 d9,q3,#6
- VQRSHRN.U16 d8,q2,#6
- VST1.32 {d8[0]},[r2],r3
- VST1.32 {d9[0]},[r2],r3
- BGT WidthIs4MVIsNotZero
- MOV r0,#0
- VPOP {d8-d15}
- POP {r4-r12,pc}
-
-WidthIs2MVIsNotZero:
- VLD1.8 {d2},[r0],r10
- VMULL.U8 q2,d0,d12
- VMULL.U8 q3,d2,d12
- VLD1.8 {d3},[r0],lr
- VMLAL.U8 q2,d1,d13
- VMLAL.U8 q3,d3,d13
- VLD1.8 {d0},[r0],r10
- VMLAL.U8 q2,d2,d14
- VMLAL.U8 q3,d0,d14
- VLD1.8 {d1},[r0],lr
- SUBS r5,r5,#2
- VMLAL.U8 q3,d1,d15
- VMLAL.U8 q2,d3,d15
- VQRSHRN.U16 d9,q3,#6
- VQRSHRN.U16 d8,q2,#6
- VST1.16 {d8[0]},[r2],r3
- VST1.16 {d9[0]},[r2],r3
- BGT WidthIs2MVIsNotZero
- MOV r0,#0
- VPOP {d8-d15}
- POP {r4-r12,pc}
-
-WidthIs8MVIsZero:
- SUB r0,r0,r1
-WidthIs8LoopMVIsZero:
- VLD1.8 {d0},[r0],r1
- SUBS r5,r5,#2
- VLD1.8 {d1},[r0],r1
- VST1.64 {d0},[r2],r3
- VST1.64 {d1},[r2],r3
- BGT WidthIs8LoopMVIsZero
- MOV r0,#0
- VPOP {d8-d15}
- POP {r4-r12,pc}
-
-WidthIs4MVIsZero:
- VLD1.8 {d1},[r0],r1
- SUBS r5,r5,#2
- VST1.32 {d0[0]},[r2],r3
- VLD1.8 {d0},[r0],r1
- VST1.32 {d1[0]},[r2],r3
- BGT WidthIs4MVIsZero
- MOV r0,#0
- VPOP {d8-d15}
- POP {r4-r12,pc}
-
-WidthIs2MVIsZero:
- VLD1.8 {d1},[r0],r1
- SUBS r5,r5,#2
- VST1.16 {d0[0]},[r2],r3
- VLD1.8 {d0},[r0],r1
- VST1.16 {d1[0]},[r2],r3
- BGT WidthIs2MVIsZero
- MOV r0,#0
- VPOP {d8-d15}
- POP {r4-r12,pc}
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_QuantTables_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_QuantTables_s.S
deleted file mode 100644
index f4e6010..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_QuantTables_s.S
+++ /dev/null
@@ -1,82 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .section .rodata
- .align 4
-
- .global armVCM4P10_MFMatrixQPModTable
- .global armVCM4P10_QPDivIntraTable
- .global armVCM4P10_QPDivPlusOneTable
-
-;//------------------------------------------------------------------
-;// This table contains (1 << QbitsPlusOne) / 3 Values (Intra case) ,
-;// for values of iQP from 0 to 51 (inclusive).
-;//------------------------------------------------------------------
-
-
-armVCM4P10_QPDivIntraTable:
- .word 21845, 21845, 21845, 21845, 21845, 21845
- .word 43690, 43690, 43690, 43690, 43690, 43690
- .word 87381, 87381, 87381, 87381, 87381, 87381
- .word 174762, 174762, 174762, 174762, 174762, 174762
- .word 349525, 349525, 349525, 349525, 349525, 349525
- .word 699050, 699050, 699050, 699050, 699050, 699050
- .word 1398101, 1398101, 1398101, 1398101, 1398101, 1398101
- .word 2796202, 2796202, 2796202, 2796202, 2796202, 2796202
-
-
-;//--------------------------------------------------------------
-;// This table contains armVCM4P10_MFMatrix [iQP % 6][0] entires,
-;// for values of iQP from 0 to 51 (inclusive).
-;//--------------------------------------------------------------
-
-armVCM4P10_MFMatrixQPModTable:
- .hword 13107, 11916, 10082, 9362, 8192, 7282
- .hword 13107, 11916, 10082, 9362, 8192, 7282
- .hword 13107, 11916, 10082, 9362, 8192, 7282
- .hword 13107, 11916, 10082, 9362, 8192, 7282
- .hword 13107, 11916, 10082, 9362, 8192, 7282
- .hword 13107, 11916, 10082, 9362, 8192, 7282
- .hword 13107, 11916, 10082, 9362, 8192, 7282
- .hword 13107, 11916, 10082, 9362, 8192, 7282
- .hword 13107, 11916, 10082, 9362, 8192, 7282
-
-;//---------------------------------------------------------------
-;// This table contains ARM_M4P10_Q_OFFSET + 1 + (iQP / 6) values,
-;// for values of iQP from 0 to 51 (inclusive).
-;//---------------------------------------------------------------
-
-armVCM4P10_QPDivPlusOneTable:
- .byte 16, 16, 16, 16, 16, 16
- .byte 17, 17, 17, 17, 17, 17
- .byte 18, 18, 18, 18, 18, 18
- .byte 19, 19, 19, 19, 19, 19
- .byte 20, 20, 20, 20, 20, 20
- .byte 21, 21, 21, 21, 21, 21
- .byte 22, 22, 22, 22, 22, 22
- .byte 23, 23, 23, 23, 23, 23
- .byte 24, 24, 24, 24, 24, 24
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_TransformResidual4x4_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_TransformResidual4x4_s.S
deleted file mode 100644
index e18bec7..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_TransformResidual4x4_s.S
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
-
- .global armVCM4P10_TransformResidual4x4
-armVCM4P10_TransformResidual4x4:
- VPUSH {d8}
- VLD4.16 {d0,d1,d2,d3},[r1]
- VMOV.I16 d4,#0
- VADD.I16 d5,d0,d2
- VSUB.I16 d6,d0,d2
- VHADD.S16 d7,d1,d4
- VHADD.S16 d8,d3,d4
- VSUB.I16 d7,d7,d3
- VADD.I16 d8,d1,d8
- VADD.I16 d0,d5,d8
- VADD.I16 d1,d6,d7
- VSUB.I16 d2,d6,d7
- VSUB.I16 d3,d5,d8
- VTRN.16 d0,d1
- VTRN.16 d2,d3
- VTRN.32 q0,q1
- VADD.I16 d5,d0,d2
- VSUB.I16 d6,d0,d2
- VHADD.S16 d7,d1,d4
- VHADD.S16 d8,d3,d4
- VSUB.I16 d7,d7,d3
- VADD.I16 d8,d1,d8
- VADD.I16 d0,d5,d8
- VADD.I16 d1,d6,d7
- VSUB.I16 d2,d6,d7
- VSUB.I16 d3,d5,d8
- VRSHR.S16 d0,d0,#6
- VRSHR.S16 d1,d1,#6
- VRSHR.S16 d2,d2,#6
- VRSHR.S16 d3,d3,#6
- VST1.16 {d0,d1,d2,d3},[r0]
- VPOP {d8}
- BX lr
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_UnpackBlock4x4_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_UnpackBlock4x4_s.S
deleted file mode 100644
index b97efcb..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_UnpackBlock4x4_s.S
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
- .syntax unified
-
- .global armVCM4P10_UnpackBlock4x4
-armVCM4P10_UnpackBlock4x4:
- PUSH {r4-r8,lr}
- LDR r2,[r0,#0]
- MOV r7,#0x1f
- MOV r4,#0
- MOV r5,#0
- LDRB r3,[r2],#1
- STRD r4,r5,[r1,#0]
- STRD r4,r5,[r1,#8]
- STRD r4,r5,[r1,#0x10]
- STRD r4,r5,[r1,#0x18]
-unpackLoop:
- TST r3,#0x10
- LDRSBNE r5,[r2,#1]
- LDRBNE r4,[r2],#2
- AND r6,r7,r3,LSL #1
- LDRSBEQ r4,[r2],#1
- ORRNE r4,r4,r5,LSL #8
- TST r3,#0x20
- LDRBEQ r3,[r2],#1
- STRH r4,[r1,r6]
- BEQ unpackLoop
- STR r2,[r0,#0]
- POP {r4-r8,pc}
- .end
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_DeblockLuma_I.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_DeblockLuma_I.S
deleted file mode 100644
index 6a99bde..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_DeblockLuma_I.S
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
-
- .global omxVCM4P10_DeblockLuma_I
-omxVCM4P10_DeblockLuma_I:
- PUSH {r4-r9,lr}
- MOVS r6,r0
- SUB sp,sp,#0xc
- MOV r9,r1
- MOV r7,r2
- MOV r8,r3
- LDR r4,[sp,#0x28]
- LDR r5,[sp,#0x2c]
- BEQ L0x58
- TST r6,#7
- TSTEQ r9,#7
- BNE L0x58
- CMP r7,#0
- CMPNE r8,#0
- CMPNE r4,#0
- BEQ L0x58
- TST r4,#3
- BNE L0x58
- CMP r5,#0
- BEQ L0x58
- TST r5,#3
- BEQ L0x64
-L0x58:
- MVN r0,#4
-L0x5c:
- ADD sp,sp,#0xc
- POP {r4-r9,pc}
-L0x64:
- STR r4,[sp,#0]
- MOV r3,r8
- STR r5,[sp,#4]
- MOV r2,r7
- MOV r1,r9
- MOV r0,r6
- BL omxVCM4P10_FilterDeblockingLuma_VerEdge_I
- CMP r0,#0
- BNE L0x5c
- ADD r3,r5,#0x10
- ADD r2,r4,#0x10
- STR r3,[sp,#4]
- STR r2,[sp,#0]
- ADD r3,r8,#2
- ADD r2,r7,#2
- MOV r1,r9
- MOV r0,r6
- BL omxVCM4P10_FilterDeblockingLuma_HorEdge_I
- ADD sp,sp,#0xc
- POP {r4-r9,pc}
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_DequantTransformResidualFromPairAndAdd_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_DequantTransformResidualFromPairAndAdd_s.S
deleted file mode 100644
index 17c5d8b..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_DequantTransformResidualFromPairAndAdd_s.S
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
-
- .global omxVCM4P10_DequantTransformResidualFromPairAndAdd
-omxVCM4P10_DequantTransformResidualFromPairAndAdd:
- PUSH {r4-r12,lr}
- VPUSH {d8-d9}
- SUB sp,sp,#0x20
- ADD r4,sp,#0
- LDR r5,[sp,#0x64]
- MOV r7,r1
- MOV r8,r2
- MOV r9,r3
- CMP r5,#0
- BEQ L0x114
- MOV r1,r4
- BL armVCM4P10_UnpackBlock4x4 ;//
- LDR r1,[sp,#0x60]
- LDR r11, .LarmVCM4P10_QPModuloTable
-P0: ADD r11, pc
- LDR r10, .LarmVCM4P10_QPDivTable
-P1: ADD r10, pc
- LDR r2, .LarmVCM4P10_VMatrixU16
-P2: ADD r2, pc
- LDRSB r12,[r11,r1]
- LDRSB lr,[r10,r1]
- LDR r10, =0x3020504
- LDR r1, =0x5040100
- ADD r2,r2,r12
- VDUP.32 d7,r1
- VDUP.32 d9,r10
- VDUP.16 d5,lr
- VLD1.8 {d6},[r2]
- VTBL.8 d8,{d6},d7
- VTBL.8 d4,{d6},d9
- CMP r8,#0
- VLD1.16 {d0,d1,d2,d3},[r4]
- VSHL.U16 d8,d8,d5
- VSHL.U16 d4,d4,d5
- BEQ L1
- LDRSH r10,[r8,#0]
-L1:
- VMUL.I16 d0,d0,d8
- VMUL.I16 d1,d1,d4
- VMUL.I16 d2,d2,d8
- VMUL.I16 d3,d3,d4
- VMOVNE.16 d0[0],r10
- VTRN.16 d0,d1
- VTRN.16 d2,d3
- VTRN.32 q0,q1
- VMOV.I16 d4,#0
- VADD.I16 d5,d0,d2
- VSUB.I16 d6,d0,d2
- VHADD.S16 d7,d1,d4
- VHADD.S16 d8,d3,d4
- VSUB.I16 d7,d7,d3
- VADD.I16 d8,d1,d8
- VADD.I16 d0,d5,d8
- VADD.I16 d1,d6,d7
- VSUB.I16 d2,d6,d7
- VSUB.I16 d3,d5,d8
- VTRN.16 d0,d1
- VTRN.16 d2,d3
- VTRN.32 q0,q1
- VADD.I16 d5,d0,d2
- VSUB.I16 d6,d0,d2
- VHADD.S16 d7,d1,d4
- VHADD.S16 d8,d3,d4
- VSUB.I16 d7,d7,d3
- VADD.I16 d8,d1,d8
- VADD.I16 d0,d5,d8
- VADD.I16 d1,d6,d7
- VSUB.I16 d2,d6,d7
- VSUB.I16 d3,d5,d8
- VRSHR.S16 d0,d0,#6
- VRSHR.S16 d1,d1,#6
- VRSHR.S16 d2,d2,#6
- VRSHR.S16 d3,d3,#6
- B L0x130
-L0x114:
- LDRSH r10,[r8,#0]
- ADD r10,r10,#0x20
- ASR r10,r10,#6
- VDUP.16 d0,r10
- VDUP.16 d1,r10
- VDUP.16 d2,r10
- VDUP.16 d3,r10
-L0x130:
- LDR r1,[sp,#0x58]
- LDR r10,[sp,#0x5c]
- LDR r3,[r7],r1
- LDR r5,[r7],r1
- VMOV d4,r3,r5
- LDR r3,[r7],r1
- LDR r5,[r7,#0]
- VMOV d5,r3,r5
- VADDW.U8 q3,q0,d4
- VADDW.U8 q4,q1,d5
- VQMOVUN.S16 d0,q3
- VQMOVUN.S16 d1,q4
- VST1.32 {d0[0]},[r9],r10
- VST1.32 {d0[1]},[r9],r10
- VST1.32 {d1[0]},[r9],r10
- VST1.32 {d1[1]},[r9]
- MOV r0,#0
- ADD sp,sp,#0x20
- VPOP {d8-d9}
- POP {r4-r12,pc}
-
-.LarmVCM4P10_QPModuloTable:
- .word armVCM4P10_QPModuloTable-(P0+8)
-.LarmVCM4P10_QPDivTable:
- .word armVCM4P10_QPDivTable-(P1+8)
-.LarmVCM4P10_VMatrixU16:
- .word armVCM4P10_VMatrixU16-(P2+8)
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_FilterDeblockingChroma_HorEdge_I_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_FilterDeblockingChroma_HorEdge_I_s.S
deleted file mode 100644
index 4a83516..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_FilterDeblockingChroma_HorEdge_I_s.S
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
-
- .global omxVCM4P10_FilterDeblockingChroma_HorEdge_I
-omxVCM4P10_FilterDeblockingChroma_HorEdge_I:
- PUSH {r4-r10,lr}
- VPUSH {d8-d15}
- VLD1.8 {d0[]},[r2]!
- SUB r0,r0,r1,LSL #1
- SUB r0,r0,r1
- VLD1.8 {d2[]},[r3]!
- LDR r4,[sp,#0x64]
- LDR r5,[sp,#0x60]
- LDR r9, =0x3030303
- LDR r8, =0x4040404
- VMOV.I8 d14,#0
- VMOV.I8 d15,#0x1
- VMOV.I16 d1,#0x4
- MOV r7,#0x40000000
-L0x38:
- LDR r6,[r4],#8
- VLD1.8 {d6},[r0],r1
- VLD1.8 {d5},[r0],r1
- CMP r6,#0
- VLD1.8 {d4},[r0],r1
- VLD1.8 {d8},[r0],r1
- VABD.U8 d19,d6,d4
- VLD1.8 {d9},[r0],r1
- VABD.U8 d13,d4,d8
- VLD1.8 {d10},[r0],r1
- BEQ L0xe4
- VABD.U8 d12,d5,d4
- VABD.U8 d18,d9,d8
- VCGT.U8 d16,d0,d13
- VMOV.32 d26[0],r6
- VMAX.U8 d12,d18,d12
- VMOVL.U8 q13,d26
- VABD.U8 d17,d10,d8
- VCGT.S16 d27,d26,#0
- VCGT.U8 d12,d2,d12
- VCGT.U8 d19,d2,d19
- VAND d16,d16,d27
- TST r6,r9
- VCGT.U8 d17,d2,d17
- VAND d16,d16,d12
- VAND d12,d16,d17
- VAND d17,d16,d19
- BLNE armVCM4P10_DeblockingChromabSLT4_unsafe
- TST r6,r8
- SUB r0,r0,r1,LSL #2
- VTST.16 d26,d26,d1
- BLNE armVCM4P10_DeblockingChromabSGE4_unsafe
- VBIT d29,d13,d26
- VBIT d24,d31,d26
- VBIF d29,d4,d16
- VBIF d24,d8,d16
- VST1.8 {d29},[r0],r1
- ADDS r7,r7,r7
- VST1.8 {d24},[r0],r1
- BNE L0x38
- MOV r0,#0
- VPOP {d8-d15}
- POP {r4-r10,pc}
-L0xe4:
- VLD1.8 {d0[]},[r2]
- SUB r0,r0,r1,LSL #1
- ADDS r7,r7,r7
- VLD1.8 {d2[]},[r3]
- ADD r5,r5,#4
- BNE L0x38
- MOV r0,#0
- VPOP {d8-d15}
- POP {r4-r10,pc}
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_FilterDeblockingChroma_VerEdge_I_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_FilterDeblockingChroma_VerEdge_I_s.S
deleted file mode 100644
index fe10931..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_FilterDeblockingChroma_VerEdge_I_s.S
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
-
- .global omxVCM4P10_FilterDeblockingChroma_VerEdge_I
-omxVCM4P10_FilterDeblockingChroma_VerEdge_I:
- PUSH {r4-r12,lr}
- VPUSH {d8-d15}
- VLD1.8 {d0[]},[r2]!
- SUB r0,r0,#4
- VLD1.8 {d2[]},[r3]!
- LDR r4,[sp,#0x6c]
- LDR r5,[sp,#0x68]
- LDR r8, =0x4040404
- LDR r9, =0x3030303
- VMOV.I8 d14,#0
- VMOV.I8 d15,#0x1
- VMOV.I16 d1,#0x4
- MOV r7,#0x40000000
-L0x34:
- LDR r6,[r4],#8
- ADD r10,r0,r1
- ADD lr,r1,r1
- VLD1.8 {d7},[r0],lr
- VLD1.8 {d8},[r10],lr
- VLD1.8 {d5},[r0],lr
- VLD1.8 {d10},[r10],lr
- VLD1.8 {d6},[r0],lr
- VLD1.8 {d9},[r10],lr
- VLD1.8 {d4},[r0],lr
- VLD1.8 {d11},[r10],lr
- VZIP.8 d7,d8
- VZIP.8 d5,d10
- VZIP.8 d6,d9
- VZIP.8 d4,d11
- VZIP.16 d7,d5
- VZIP.16 d8,d10
- VZIP.16 d6,d4
- VZIP.16 d9,d11
- VTRN.32 d7,d6
- VTRN.32 d5,d4
- VTRN.32 d10,d11
- VTRN.32 d8,d9
- CMP r6,#0
- VABD.U8 d19,d6,d4
- VABD.U8 d13,d4,d8
- BEQ L0x170
- VABD.U8 d12,d5,d4
- VABD.U8 d18,d9,d8
- VMOV.32 d26[0],r6
- VCGT.U8 d16,d0,d13
- VMAX.U8 d12,d18,d12
- VMOVL.U8 q13,d26
- VABD.U8 d17,d10,d8
- VCGT.S16 d27,d26,#0
- VCGT.U8 d12,d2,d12
- VCGT.U8 d19,d2,d19
- VAND d16,d16,d27
- TST r6,r9
- VCGT.U8 d17,d2,d17
- VAND d16,d16,d12
- VAND d12,d16,d17
- VAND d17,d16,d19
- BLNE armVCM4P10_DeblockingChromabSLT4_unsafe
- TST r6,r8
- SUB r0,r0,r1,LSL #3
- VTST.16 d26,d26,d1
- BLNE armVCM4P10_DeblockingChromabSGE4_unsafe
- VBIT d29,d13,d26
- VBIT d24,d31,d26
- ADD r10,r0,#3
- VBIF d29,d4,d16
- ADD r12,r10,r1
- ADD lr,r1,r1
- VBIF d24,d8,d16
- ADDS r7,r7,r7
- VST1.8 {d29[0]},[r10],lr
- VST1.8 {d29[1]},[r12],lr
- VST1.8 {d29[2]},[r10],lr
- VST1.8 {d29[3]},[r12],lr
- VST1.8 {d29[4]},[r10],lr
- VST1.8 {d29[5]},[r12],lr
- VST1.8 {d29[6]},[r10],lr
- VST1.8 {d29[7]},[r12],lr
- ADD r12,r0,#4
- ADD r10,r12,r1
- VST1.8 {d24[0]},[r12],lr
- VST1.8 {d24[1]},[r10],lr
- VST1.8 {d24[2]},[r12],lr
- VST1.8 {d24[3]},[r10],lr
- VST1.8 {d24[4]},[r12],lr
- VST1.8 {d24[5]},[r10],lr
- VST1.8 {d24[6]},[r12],lr
- VST1.8 {d24[7]},[r10],lr
- ADD r0,r0,#4
- BNE L0x34
- MOV r0,#0
- VPOP {d8-d15}
- POP {r4-r12,pc}
-L0x170:
- VLD1.8 {d0[]},[r2]
- ADD r0,r0,#4
- SUB r0,r0,r1,LSL #3
- ADDS r7,r7,r7
- VLD1.8 {d2[]},[r3]
- ADD r5,r5,#4
- BNE L0x34
- MOV r0,#0
- VPOP {d8-d15}
- POP {r4-r12,pc}
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_FilterDeblockingLuma_HorEdge_I_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_FilterDeblockingLuma_HorEdge_I_s.S
deleted file mode 100644
index 84ffad2..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_FilterDeblockingLuma_HorEdge_I_s.S
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
-
- .global omxVCM4P10_FilterDeblockingLuma_HorEdge_I
-omxVCM4P10_FilterDeblockingLuma_HorEdge_I:
- PUSH {r4-r12,lr}
- VPUSH {d8-d15}
- ADD r7,r2,#1
- ADD r8,r3,#1
- VLD1.8 {d0[]},[r2]
- SUB r0,r0,r1,LSL #2
- VLD1.8 {d2[]},[r3]
- LDR r4,[sp,#0x6c]
- LDR r5,[sp,#0x68]
- MOV r11,#0
- VMOV.I8 d14,#0
- VMOV.I8 d15,#0x1
- ADD r10,r1,r1
- MOV r9,#0x55000000
-L0x38:
- LDRH r12,[r4],#2
- ADD r6,r0,r1
- CMP r12,#0
- BEQ L0xe4
- VLD1.8 {d7},[r0],r10
- VLD1.8 {d6},[r6],r10
- VLD1.8 {d5},[r0],r10
- VLD1.8 {d4},[r6],r10
- VLD1.8 {d8},[r0],r10
- VABD.U8 d12,d4,d5
- VLD1.8 {d9},[r6]
- VABD.U8 d13,d8,d4
- VLD1.8 {d10},[r0],r1
- VABD.U8 d18,d9,d8
- VABD.U8 d19,d6,d4
- VCGT.U8 d16,d0,d13
- TST r12,#0xff
- VMAX.U8 d12,d18,d12
- VABD.U8 d17,d10,d8
- VMOVEQ.32 d16[0],r11
- TST r12,#0xff00
- VCGT.U8 d19,d2,d19
- VCGT.U8 d12,d2,d12
- VMOVEQ.32 d16[1],r11
- VCGT.U8 d17,d2,d17
- VLD1.8 {d11},[r0]
- VAND d16,d16,d12
- TST r12,#4
- VAND d12,d16,d17
- VAND d17,d16,d19
- BNE L0xf8
- SUB r0,r0,r1,LSL #2
- SUB r0,r0,r1
- BL armVCM4P10_DeblockingLumabSLT4_unsafe
- VST1.8 {d30},[r0],r1
- VST1.8 {d29},[r0],r1
- SUB r6,r0,r1,LSL #2
- VST1.8 {d24},[r0],r1
- ADDS r9,r9,r9
- VST1.8 {d25},[r0]
- ADD r0,r6,#8
- BCC L0x38
- B L0x130
-L0xe4:
- ADD r0,r0,#8
- ADDS r9,r9,r9
- ADD r5,r5,#2
- BCC L0x38
- B L0x130
-L0xf8:
- SUB r0,r0,r1,LSL #2
- SUB r0,r0,r1,LSL #1
- BL armVCM4P10_DeblockingLumabSGE4_unsafe
- VST1.8 {d31},[r0],r1
- VST1.8 {d30},[r0],r1
- VST1.8 {d29},[r0],r1
- SUB r6,r0,r1,LSL #2
- VST1.8 {d24},[r0],r1
- ADDS r9,r9,r9
- VST1.8 {d25},[r0],r1
- ADD r5,r5,#2
- VST1.8 {d28},[r0]
- ADD r0,r6,#8
- BCC L0x38
-L0x130:
- SUB r0,r0,#0x10
- VLD1.8 {d0[]},[r7]
- ADD r0,r0,r1,LSL #2
- VLD1.8 {d2[]},[r8]
- BNE L0x38
- MOV r0,#0
- VPOP {d8-d15}
- POP {r4-r12,pc}
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_FilterDeblockingLuma_VerEdge_I_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_FilterDeblockingLuma_VerEdge_I_s.S
deleted file mode 100644
index f2a3682..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_FilterDeblockingLuma_VerEdge_I_s.S
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
-
- .global omxVCM4P10_FilterDeblockingLuma_VerEdge_I
-omxVCM4P10_FilterDeblockingLuma_VerEdge_I:
- PUSH {r4-r12,lr}
- VPUSH {d8-d15}
- ADD r7,r2,#1
- ADD r8,r3,#1
- VLD1.8 {d0[]},[r2]
- SUB r0,r0,#4
- VLD1.8 {d2[]},[r3]
- LDR r4,[sp,#0x6c]
- LDR r5,[sp,#0x68]
- MOV r6,#0
- VMOV.I8 d14,#0
- VMOV.I8 d15,#0x1
- MOV r9,#0x11000000
- ADD r11,r1,r1
-L0x38:
- LDRH r12,[r4],#4
- CMP r12,#0
- BEQ L0x160
- ADD r10,r0,r1
- VLD1.8 {d7},[r0],r11
- VLD1.8 {d8},[r10],r11
- VLD1.8 {d5},[r0],r11
- VZIP.8 d7,d8
- VLD1.8 {d10},[r10],r11
- VLD1.8 {d6},[r0],r11
- VZIP.8 d5,d10
- VLD1.8 {d9},[r10],r11
- VLD1.8 {d4},[r0],r11
- VLD1.8 {d11},[r10],r11
- VZIP.8 d6,d9
- VZIP.16 d8,d10
- VZIP.8 d4,d11
- SUB r0,r0,r1,LSL #3
- VZIP.16 d7,d5
- VZIP.16 d9,d11
- VZIP.16 d6,d4
- VTRN.32 d8,d9
- VTRN.32 d5,d4
- VTRN.32 d10,d11
- VTRN.32 d7,d6
- VABD.U8 d13,d4,d8
- VABD.U8 d12,d5,d4
- VABD.U8 d18,d9,d8
- VABD.U8 d19,d6,d4
- TST r12,#0xff
- VCGT.U8 d16,d0,d13
- VMAX.U8 d12,d18,d12
- VABD.U8 d17,d10,d8
- VMOVEQ.32 d16[0],r6
- TST r12,#0xff00
- VCGT.U8 d19,d2,d19
- VCGT.U8 d12,d2,d12
- VMOVEQ.32 d16[1],r6
- VCGT.U8 d17,d2,d17
- VAND d16,d16,d12
- TST r12,#4
- VAND d12,d16,d17
- VAND d17,d16,d19
- BNE L0x17c
- BL armVCM4P10_DeblockingLumabSLT4_unsafe
- VZIP.8 d7,d6
- VZIP.8 d30,d29
- VZIP.8 d24,d25
- VZIP.8 d10,d11
- VZIP.16 d7,d30
- ADD r10,r0,r1
- VZIP.16 d24,d10
- VZIP.16 d25,d11
- VZIP.16 d6,d29
- VTRN.32 d7,d24
- VTRN.32 d30,d10
- VTRN.32 d6,d25
- VTRN.32 d29,d11
- VST1.8 {d7},[r0],r11
- VST1.8 {d24},[r10],r11
- VST1.8 {d30},[r0],r11
- VST1.8 {d10},[r10],r11
- VST1.8 {d6},[r0],r11
- VST1.8 {d25},[r10],r11
- ADDS r9,r9,r9
- VST1.8 {d29},[r0],r11
- ADD r5,r5,#2
- VST1.8 {d11},[r10],r1
- SUB r0,r0,r1,LSL #3
- VLD1.8 {d0[]},[r7]
- ADD r0,r0,#4
- VLD1.8 {d2[]},[r8]
- BCC L0x38
- B L0x1f0
-L0x160:
- ADD r0,r0,#4
- ADDS r9,r9,r9
- VLD1.8 {d0[]},[r7]
- ADD r5,r5,#4
- VLD1.8 {d2[]},[r8]
- BCC L0x38
- B L0x1f0
-L0x17c:
- BL armVCM4P10_DeblockingLumabSGE4_unsafe
- VZIP.8 d7,d31
- VZIP.8 d30,d29
- VZIP.8 d24,d25
- VZIP.8 d28,d11
- VZIP.16 d7,d30
- ADD r10,r0,r1
- VZIP.16 d24,d28
- VZIP.16 d25,d11
- VZIP.16 d31,d29
- VTRN.32 d7,d24
- VTRN.32 d30,d28
- VTRN.32 d31,d25
- VTRN.32 d29,d11
- VST1.8 {d7},[r0],r11
- VST1.8 {d24},[r10],r11
- VST1.8 {d30},[r0],r11
- VST1.8 {d28},[r10],r11
- VST1.8 {d31},[r0],r11
- VST1.8 {d25},[r10],r11
- ADDS r9,r9,r9
- VST1.8 {d29},[r0],r11
- ADD r5,r5,#4
- VST1.8 {d11},[r10],r11
- SUB r0,r0,r1,LSL #3
- VLD1.8 {d0[]},[r7]
- ADD r0,r0,#4
- VLD1.8 {d2[]},[r8]
- BCC L0x38
-L0x1f0:
- SUB r4,r4,#0xe
- SUB r5,r5,#0xe
- SUB r0,r0,#0x10
- VLD1.8 {d0[]},[r2]
- ADD r0,r0,r1,LSL #3
- VLD1.8 {d2[]},[r3]
- BNE L0x38
- MOV r0,#0
- VPOP {d8-d15}
- POP {r4-r12,pc}
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_InterpolateLuma_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_InterpolateLuma_s.S
deleted file mode 100644
index 314eabd..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_InterpolateLuma_s.S
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
-
- .global omxVCM4P10_InterpolateLuma
-omxVCM4P10_InterpolateLuma:
- PUSH {r4-r12,lr}
- VPUSH {d8-d15}
- SUB sp,sp,#0x10
- LDR r6,[sp,#0x78]
- LDR r7,[sp,#0x7c]
- LDR r5,[sp,#0x80]
- LDR r4,[sp,#0x84]
- ADD r6,r6,r7,LSL #2
- ADD r11,sp,#0
- VMOV.I16 d31,#0x14
- VMOV.I16 d30,#0x5
-L0x2c:
- STM r11,{r0-r3}
- ADD pc,pc,r6,LSL #2
- B L0x3f0
- B L0x78
- B L0xa8
- B L0xdc
- B L0x100
- B L0x134
- B L0x168
- B L0x1a8
- B L0x1f0
- B L0x234
- B L0x258
- B L0x2b0
- B L0x2d8
- B L0x330
- B L0x364
- B L0x3a8
- B L0x3f0
-L0x78:
- ADD r12,r0,r1,LSL #1
- VLD1.8 {d9},[r0],r1
- VLD1.8 {d11},[r12],r1
- VLD1.8 {d10},[r0]
- VLD1.8 {d12},[r12]
- ADD r12,r2,r3,LSL #1
- VST1.32 {d9[0]},[r2],r3
- VST1.32 {d11[0]},[r12],r3
- VST1.32 {d10[0]},[r2]
- VST1.32 {d12[0]},[r12]
- ADD r11,sp,#0
- B L0x434
-L0xa8:
- SUB r0,r0,#2
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- VRHADD.U8 d22,d22,d14
- VRHADD.U8 d26,d26,d18
- VRHADD.U8 d24,d24,d16
- VRHADD.U8 d28,d28,d20
- ADD r12,r2,r3,LSL #1
- VST1.32 {d22[0]},[r2],r3
- VST1.32 {d26[0]},[r12],r3
- VST1.32 {d24[0]},[r2]
- VST1.32 {d28[0]},[r12]
- ADD r11,sp,#0
- B L0x434
-L0xdc:
- SUB r0,r0,#2
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- ADD r12,r2,r3,LSL #1
- VST1.32 {d22[0]},[r2],r3
- VST1.32 {d26[0]},[r12],r3
- VST1.32 {d24[0]},[r2]
- VST1.32 {d28[0]},[r12]
- ADD r11,sp,#0
- B L0x434
-L0x100:
- SUB r0,r0,#2
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- VRHADD.U8 d22,d22,d15
- VRHADD.U8 d26,d26,d19
- VRHADD.U8 d24,d24,d17
- VRHADD.U8 d28,d28,d21
- ADD r12,r2,r3,LSL #1
- VST1.32 {d22[0]},[r2],r3
- VST1.32 {d26[0]},[r12],r3
- VST1.32 {d24[0]},[r2]
- VST1.32 {d28[0]},[r12]
- ADD r11,sp,#0
- B L0x434
-L0x134:
- SUB r0,r0,r1,LSL #1
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- VRHADD.U8 d0,d0,d9
- VRHADD.U8 d4,d4,d11
- VRHADD.U8 d2,d2,d10
- VRHADD.U8 d6,d6,d12
- ADD r12,r2,r3,LSL #1
- VST1.32 {d0[0]},[r2],r3
- VST1.32 {d4[0]},[r12],r3
- VST1.32 {d2[0]},[r2]
- VST1.32 {d6[0]},[r12]
- ADD r11,sp,#0
- B L0x434
-L0x168:
- MOV r8,r0
- SUB r0,r0,r1,LSL #1
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- SUB r0,r8,#2
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- VRHADD.U8 d22,d22,d0
- VRHADD.U8 d26,d26,d4
- VRHADD.U8 d24,d24,d2
- VRHADD.U8 d28,d28,d6
- ADD r12,r2,r3,LSL #1
- VST1.32 {d22[0]},[r2],r3
- VST1.32 {d26[0]},[r12],r3
- VST1.32 {d24[0]},[r2]
- VST1.32 {d28[0]},[r12]
- ADD r11,sp,#0
- B L0x434
-L0x1a8:
- SUB r0,r0,r1,LSL #1
- SUB r0,r0,#2
- BL armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe
- VQRSHRUN.S16 d14,q7,#5
- VQRSHRUN.S16 d16,q8,#5
- VQRSHRUN.S16 d18,q9,#5
- VQRSHRUN.S16 d20,q10,#5
- VRHADD.U8 d0,d0,d14
- VRHADD.U8 d4,d4,d18
- VRHADD.U8 d2,d2,d16
- VRHADD.U8 d6,d6,d20
- ADD r12,r2,r3,LSL #1
- VST1.32 {d0[0]},[r2],r3
- VST1.32 {d4[0]},[r12],r3
- VST1.32 {d2[0]},[r2]
- VST1.32 {d6[0]},[r12]
- ADD r11,sp,#0
- B L0x434
-L0x1f0:
- MOV r8,r0
- ADD r0,r0,#1
- SUB r0,r0,r1,LSL #1
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- SUB r0,r8,#2
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- VRHADD.U8 d22,d22,d0
- VRHADD.U8 d26,d26,d4
- VRHADD.U8 d24,d24,d2
- VRHADD.U8 d28,d28,d6
- ADD r12,r2,r3,LSL #1
- VST1.32 {d22[0]},[r2],r3
- VST1.32 {d26[0]},[r12],r3
- VST1.32 {d24[0]},[r2]
- VST1.32 {d28[0]},[r12]
- ADD r11,sp,#0
- B L0x434
-L0x234:
- SUB r0,r0,r1,LSL #1
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- ADD r12,r2,r3,LSL #1
- VST1.32 {d0[0]},[r2],r3
- VST1.32 {d4[0]},[r12],r3
- VST1.32 {d2[0]},[r2]
- VST1.32 {d6[0]},[r12]
- ADD r11,sp,#0
- B L0x434
-L0x258:
- SUB r0,r0,r1,LSL #1
- SUB r0,r0,#2
- BL armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe
- VEXT.8 d18,d18,d19,#4
- VEXT.8 d20,d20,d21,#4
- VEXT.8 d22,d22,d23,#4
- VEXT.8 d24,d24,d25,#4
- VQRSHRUN.S16 d14,q9,#5
- VQRSHRUN.S16 d16,q10,#5
- VQRSHRUN.S16 d18,q11,#5
- VQRSHRUN.S16 d20,q12,#5
- VRHADD.U8 d0,d0,d14
- VRHADD.U8 d4,d4,d18
- VRHADD.U8 d2,d2,d16
- VRHADD.U8 d6,d6,d20
- ADD r12,r2,r3,LSL #1
- VST1.32 {d0[0]},[r2],r3
- VST1.32 {d4[0]},[r12],r3
- VST1.32 {d2[0]},[r2]
- VST1.32 {d6[0]},[r12]
- ADD r11,sp,#0
- B L0x434
-L0x2b0:
- SUB r0,r0,r1,LSL #1
- SUB r0,r0,#2
- BL armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe
- ADD r12,r2,r3,LSL #1
- VST1.32 {d0[0]},[r2],r3
- VST1.32 {d4[0]},[r12],r3
- VST1.32 {d2[0]},[r2]
- VST1.32 {d6[0]},[r12]
- ADD r11,sp,#0
- B L0x434
-L0x2d8:
- SUB r0,r0,r1,LSL #1
- SUB r0,r0,#2
- BL armVCM4P10_InterpolateLuma_HalfDiagVerHor4x4_unsafe
- VEXT.8 d18,d18,d19,#6
- VEXT.8 d20,d20,d21,#6
- VEXT.8 d22,d22,d23,#6
- VEXT.8 d24,d24,d25,#6
- VQRSHRUN.S16 d14,q9,#5
- VQRSHRUN.S16 d16,q10,#5
- VQRSHRUN.S16 d18,q11,#5
- VQRSHRUN.S16 d20,q12,#5
- VRHADD.U8 d0,d0,d14
- VRHADD.U8 d4,d4,d18
- VRHADD.U8 d2,d2,d16
- VRHADD.U8 d6,d6,d20
- ADD r12,r2,r3,LSL #1
- VST1.32 {d0[0]},[r2],r3
- VST1.32 {d4[0]},[r12],r3
- VST1.32 {d2[0]},[r2]
- VST1.32 {d6[0]},[r12]
- ADD r11,sp,#0
- B L0x434
-L0x330:
- SUB r0,r0,r1,LSL #1
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- VRHADD.U8 d0,d0,d10
- VRHADD.U8 d4,d4,d12
- VRHADD.U8 d2,d2,d11
- VRHADD.U8 d6,d6,d13
- ADD r12,r2,r3,LSL #1
- VST1.32 {d0[0]},[r2],r3
- VST1.32 {d4[0]},[r12],r3
- VST1.32 {d2[0]},[r2]
- VST1.32 {d6[0]},[r12]
- ADD r11,sp,#0
- B L0x434
-L0x364:
- MOV r8,r0
- SUB r0,r0,r1,LSL #1
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- ADD r0,r8,r1
- SUB r0,r0,#2
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- VRHADD.U8 d22,d22,d0
- VRHADD.U8 d26,d26,d4
- VRHADD.U8 d24,d24,d2
- VRHADD.U8 d28,d28,d6
- ADD r12,r2,r3,LSL #1
- VST1.32 {d22[0]},[r2],r3
- VST1.32 {d26[0]},[r12],r3
- VST1.32 {d24[0]},[r2]
- VST1.32 {d28[0]},[r12]
- ADD r11,sp,#0
- B L0x434
-L0x3a8:
- SUB r0,r0,r1,LSL #1
- SUB r0,r0,#2
- BL armVCM4P10_InterpolateLuma_HalfDiagHorVer4x4_unsafe
- VQRSHRUN.S16 d14,q8,#5
- VQRSHRUN.S16 d16,q9,#5
- VQRSHRUN.S16 d18,q10,#5
- VQRSHRUN.S16 d20,q11,#5
- VRHADD.U8 d0,d0,d14
- VRHADD.U8 d4,d4,d18
- VRHADD.U8 d2,d2,d16
- VRHADD.U8 d6,d6,d20
- ADD r12,r2,r3,LSL #1
- VST1.32 {d0[0]},[r2],r3
- VST1.32 {d4[0]},[r12],r3
- VST1.32 {d2[0]},[r2]
- VST1.32 {d6[0]},[r12]
- ADD r11,sp,#0
- B L0x434
-L0x3f0:
- MOV r8,r0
- ADD r0,r0,#1
- SUB r0,r0,r1,LSL #1
- BL armVCM4P10_InterpolateLuma_HalfVer4x4_unsafe
- ADD r0,r8,r1
- SUB r0,r0,#2
- BL armVCM4P10_InterpolateLuma_HalfHor4x4_unsafe
- VRHADD.U8 d22,d22,d0
- VRHADD.U8 d26,d26,d4
- VRHADD.U8 d24,d24,d2
- VRHADD.U8 d28,d28,d6
- ADD r12,r2,r3,LSL #1
- VST1.32 {d22[0]},[r2],r3
- VST1.32 {d26[0]},[r12],r3
- VST1.32 {d24[0]},[r2]
- VST1.32 {d28[0]},[r12]
- ADD r11,sp,#0
-L0x434:
- LDM r11,{r0-r3}
- SUBS r5,r5,#4
- ADD r0,r0,#4
- ADD r2,r2,#4
- BGT L0x2c
- SUBS r4,r4,#4
- LDR r5,[sp,#0x80]
- ADD r11,sp,#0
- ADD r0,r0,r1,LSL #2
- ADD r2,r2,r3,LSL #2
- SUB r0,r0,r5
- SUB r2,r2,r5
- BGT L0x2c
- MOV r0,#0
- ADD sp,sp,#0x10
- VPOP {d8-d15}
- POP {r4-r12,pc}
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_PredictIntraChroma_8x8_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_PredictIntraChroma_8x8_s.S
deleted file mode 100644
index 50d1350..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_PredictIntraChroma_8x8_s.S
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
- .align 4
-
-armVCM4P10_pIndexTable8x8:
- .word OMX_VC_CHROMA_DC-(P0+8), OMX_VC_CHROMA_HOR-(P0+8)
- .word OMX_VC_CHROMA_VERT-(P0+8), OMX_VC_CHROMA_PLANE-(P0+8)
-
-armVCM4P10_MultiplierTableChroma8x8:
- .hword 3, 2, 1,4
- .hword -3,-2,-1,0
- .hword 1, 2, 3,4
-
- .global omxVCM4P10_PredictIntraChroma_8x8
-omxVCM4P10_PredictIntraChroma_8x8:
- PUSH {r4-r10,lr}
- VPUSH {d8-d15}
- ADR r8, armVCM4P10_pIndexTable8x8
- LDR r6,[sp,#0x68]
- LDR r4,[sp,#0x60]
- LDR r5,[sp,#0x64]
- LDR r7,[sp,#0x6c]
- LDR r8,[r8,r6,LSL #2]
-P0: ADD pc,r8
-
-OMX_VC_CHROMA_DC:
- TST r7,#2
- BEQ L0xe8
- ADD r9,r0,r4
- ADD r10,r4,r4
- VLD1.8 {d1[0]},[r0],r10
- VLD1.8 {d1[1]},[r9],r10
- VLD1.8 {d1[2]},[r0],r10
- VLD1.8 {d1[3]},[r9],r10
- VLD1.8 {d1[4]},[r0],r10
- VLD1.8 {d1[5]},[r9],r10
- VLD1.8 {d1[6]},[r0],r10
- VLD1.8 {d1[7]},[r9]
- TST r7,#1
- BEQ L0xcc
- VLD1.8 {d0},[r1]
- MOV r0,#0
- VPADDL.U8 d2,d0
- VPADDL.U16 d3,d2
- VPADDL.U8 d2,d1
- VPADDL.U16 d1,d2
- VADD.I32 d2,d3,d1
- VRSHR.U32 d2,d2,#3
- VRSHR.U32 d3,d3,#2
- VRSHR.U32 d1,d1,#2
- VMOV.I8 d5,#0xc
- VMOV.I8 d6,#0x4
- VSHL.I64 d5,d5,#32
- VSHR.U64 d6,d6,#32
- VADD.I8 d6,d6,d5
- VTBL.8 d0,{d2-d3},d5
- VTBL.8 d4,{d1-d2},d6
-L0x9c:
- ADD r9,r3,r5
- ADD r10,r5,r5
- VST1.8 {d0},[r3],r10
- VST1.8 {d0},[r9],r10
- VST1.8 {d0},[r3],r10
- VST1.8 {d0},[r9],r10
- VST1.8 {d4},[r3],r10
- VST1.8 {d4},[r9],r10
- VST1.8 {d4},[r3],r10
- VST1.8 {d4},[r9]
- VPOP {d8-d15}
- POP {r4-r10,pc}
-L0xcc:
- MOV r0,#0
- VPADDL.U8 d2,d1
- VPADDL.U16 d1,d2
- VRSHR.U32 d1,d1,#2
- VDUP.8 d0,d1[0]
- VDUP.8 d4,d1[4]
- B L0x9c
-L0xe8:
- TST r7,#1
- BEQ L0x114
- VLD1.8 {d0},[r1]
- MOV r0,#0
- VPADDL.U8 d2,d0
- VPADDL.U16 d3,d2
- VRSHR.U32 d3,d3,#2
- VMOV.I8 d5,#0x4
- VSHL.I64 d5,d5,#32
- VTBL.8 d0,{d3},d5
- B L0x11c
-L0x114:
- VMOV.I8 d0,#0x80
- MOV r0,#0
-L0x11c:
- ADD r9,r3,r5
- ADD r10,r5,r5
- VST1.8 {d0},[r3],r10
- VST1.8 {d0},[r9],r10
- VST1.8 {d0},[r3],r10
- VST1.8 {d0},[r9],r10
- VST1.8 {d0},[r3],r10
- VST1.8 {d0},[r9],r10
- VST1.8 {d0},[r3],r10
- VST1.8 {d0},[r9]
- VPOP {d8-d15}
- POP {r4-r10,pc}
-OMX_VC_CHROMA_VERT:
- VLD1.8 {d0},[r1]
- MOV r0,#0
- B L0x11c
-OMX_VC_CHROMA_HOR:
- ADD r9,r0,r4
- ADD r10,r4,r4
- VLD1.8 {d0[]},[r0],r10
- VLD1.8 {d1[]},[r9],r10
- VLD1.8 {d2[]},[r0],r10
- VLD1.8 {d3[]},[r9],r10
- VLD1.8 {d4[]},[r0],r10
- VLD1.8 {d5[]},[r9],r10
- VLD1.8 {d6[]},[r0],r10
- VLD1.8 {d7[]},[r9]
- B L0x28c
-OMX_VC_CHROMA_PLANE:
- ADD r9,r0,r4
- ADD r10,r4,r4
- VLD1.8 {d0},[r1]
- VLD1.8 {d2[0]},[r2]
- VLD1.8 {d1[0]},[r0],r10
- VLD1.8 {d1[1]},[r9],r10
- VLD1.8 {d1[2]},[r0],r10
- VLD1.8 {d1[3]},[r9],r10
- VLD1.8 {d1[4]},[r0],r10
- VLD1.8 {d1[5]},[r9],r10
- VLD1.8 {d1[6]},[r0],r10
- VLD1.8 {d1[7]},[r9]
- VREV64.8 d3,d0
- VSUBL.U8 q3,d3,d2
- VSHR.U64 d3,d3,#8
- VSUBL.U8 q2,d3,d0
- VREV64.8 d3,d1
- VSUBL.U8 q7,d3,d2
- VSHR.U64 d3,d3,#8
- VSUBL.U8 q6,d3,d1
- ADR r2, armVCM4P10_MultiplierTableChroma8x8
- VSHL.I64 d4,d4,#16
- VEXT.8 d9,d4,d6,#2
- VLD1.16 {d10},[r2]!
- VSHL.I64 d12,d12,#16
- VEXT.8 d16,d12,d14,#2
- VMUL.I16 d11,d9,d10
- VMUL.I16 d3,d16,d10
- VPADD.I16 d3,d11,d3
- VPADDL.S16 d3,d3
- VSHL.I32 d2,d3,#4
- VADD.I32 d3,d3,d2
- VLD1.16 {d10,d11},[r2]
- VRSHR.S32 d3,d3,#5
- VADDL.U8 q0,d0,d1
- VDUP.16 q0,d1[3]
- VSHL.I16 q0,q0,#4
- VDUP.16 q2,d3[0]
- VDUP.16 q3,d3[2]
- VMUL.I16 q2,q2,q5
- VMUL.I16 q3,q3,q5
- VADD.I16 q2,q2,q0
- VDUP.16 q0,d6[0]
- VDUP.16 q1,d6[1]
- VDUP.16 q4,d6[2]
- VDUP.16 q5,d6[3]
- VDUP.16 q6,d7[0]
- VDUP.16 q7,d7[1]
- VDUP.16 q8,d7[2]
- VDUP.16 q9,d7[3]
- VADD.I16 q0,q2,q0
- VADD.I16 q1,q2,q1
- VADD.I16 q4,q2,q4
- VADD.I16 q5,q2,q5
- VADD.I16 q6,q2,q6
- VADD.I16 q7,q2,q7
- VADD.I16 q8,q2,q8
- VADD.I16 q9,q2,q9
- VQRSHRUN.S16 d0,q0,#5
- VQRSHRUN.S16 d1,q1,#5
- VQRSHRUN.S16 d2,q4,#5
- VQRSHRUN.S16 d3,q5,#5
- VQRSHRUN.S16 d4,q6,#5
- VQRSHRUN.S16 d5,q7,#5
- VQRSHRUN.S16 d6,q8,#5
- VQRSHRUN.S16 d7,q9,#5
-L0x28c:
- ADD r9,r3,r5
- ADD r10,r5,r5
- VST1.8 {d0},[r3],r10
- VST1.8 {d1},[r9],r10
- VST1.8 {d2},[r3],r10
- VST1.8 {d3},[r9],r10
- VST1.8 {d4},[r3],r10
- VST1.8 {d5},[r9],r10
- VST1.8 {d6},[r3],r10
- VST1.8 {d7},[r9]
- MOV r0,#0
- VPOP {d8-d15}
- POP {r4-r10,pc}
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_PredictIntra_16x16_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_PredictIntra_16x16_s.S
deleted file mode 100644
index 0044636..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_PredictIntra_16x16_s.S
+++ /dev/null
@@ -1,250 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
-
- .text
- .align 4
-;//-------------------------------------------------------
-;// This table for implementing switch case of C in asm by
-;// the mehtod of two levels of indexing.
-;//-------------------------------------------------------
-
-armVCM4P10_pIndexTable16x16:
- .word OMX_VC_16X16_VERT-(P0+8), OMX_VC_16X16_HOR-(P0+8)
- .word OMX_VC_16X16_DC-(P0+8), OMX_VC_16X16_PLANE-(P0+8)
-
-
-armVCM4P10_MultiplierTable16x16:
- .hword 7, 6, 5, 4, 3, 2, 1, 8
- .hword 0, 1, 2, 3, 4, 5, 6, 7
- .hword 8, 9, 10, 11, 12, 13, 14, 15
-
-
- .global omxVCM4P10_PredictIntra_16x16
-omxVCM4P10_PredictIntra_16x16:
- PUSH {r4-r12,lr}
- VPUSH {d8-d15}
- ADR r9, armVCM4P10_pIndexTable16x16
- LDR r6,[sp,#0x70]
- LDR r4,[sp,#0x68]
- LDR r5,[sp,#0x6c]
- LDR r7,[sp,#0x74]
- MOV r12,#0x10
- LDR r9,[r9,r6,LSL #2]
-P0: ADD pc,r9
-OMX_VC_16X16_VERT:
- VLD1.8 {d0,d1},[r1]
- ADD r8,r3,r5
- ADD r10,r5,r5
- VST1.8 {d0,d1},[r3],r10
- VST1.8 {d0,d1},[r8],r10
- VST1.8 {d0,d1},[r3],r10
- VST1.8 {d0,d1},[r8],r10
- VST1.8 {d0,d1},[r3],r10
- VST1.8 {d0,d1},[r8],r10
- VST1.8 {d0,d1},[r3],r10
- VST1.8 {d0,d1},[r8],r10
- VST1.8 {d0,d1},[r3],r10
- VST1.8 {d0,d1},[r8],r10
- VST1.8 {d0,d1},[r3],r10
- VST1.8 {d0,d1},[r8],r10
- VST1.8 {d0,d1},[r3],r10
- VST1.8 {d0,d1},[r8],r10
- VST1.8 {d0,d1},[r3]
- VST1.8 {d0,d1},[r8]
- MOV r0,#0
- VPOP {d8-d15}
- POP {r4-r12,pc}
-OMX_VC_16X16_HOR:
- ADD r8,r0,r4
- ADD r4,r4,r4
- ADD r11,r3,r5
- ADD r5,r5,r5
-L0x8c:
- VLD1.8 {d2[],d3[]},[r0],r4
- VLD1.8 {d0[],d1[]},[r8],r4
- SUBS r12,r12,#8
- VST1.8 {d2,d3},[r3],r5
- VST1.8 {d0,d1},[r11],r5
- VLD1.8 {d2[],d3[]},[r0],r4
- VLD1.8 {d0[],d1[]},[r8],r4
- VST1.8 {d2,d3},[r3],r5
- VST1.8 {d0,d1},[r11],r5
- VLD1.8 {d2[],d3[]},[r0],r4
- VLD1.8 {d0[],d1[]},[r8],r4
- VST1.8 {d2,d3},[r3],r5
- VST1.8 {d0,d1},[r11],r5
- VLD1.8 {d2[],d3[]},[r0],r4
- VLD1.8 {d0[],d1[]},[r8],r4
- VST1.8 {d2,d3},[r3],r5
- VST1.8 {d0,d1},[r11],r5
- BNE L0x8c
- MOV r0,#0
- VPOP {d8-d15}
- POP {r4-r12,pc}
-OMX_VC_16X16_DC:
- MOV r11,#0
- TST r7,#2
- BEQ L0x14c
- ADD r8,r0,r4
- ADD r10,r4,r4
- VLD1.8 {d2[0]},[r0],r10
- VLD1.8 {d2[1]},[r8],r10
- VLD1.8 {d2[2]},[r0],r10
- VLD1.8 {d2[3]},[r8],r10
- VLD1.8 {d2[4]},[r0],r10
- VLD1.8 {d2[5]},[r8],r10
- VLD1.8 {d2[6]},[r0],r10
- VLD1.8 {d2[7]},[r8],r10
- VLD1.8 {d3[0]},[r0],r10
- VLD1.8 {d3[1]},[r8],r10
- VLD1.8 {d3[2]},[r0],r10
- VLD1.8 {d3[3]},[r8],r10
- VLD1.8 {d3[4]},[r0],r10
- VLD1.8 {d3[5]},[r8],r10
- VLD1.8 {d3[6]},[r0],r10
- VLD1.8 {d3[7]},[r8]
- VPADDL.U8 q0,q1
- ADD r11,r11,#1
- VPADD.I16 d0,d0,d1
- VPADDL.U16 d0,d0
- VPADDL.U32 d6,d0
- VRSHR.U64 d8,d6,#4
-L0x14c:
- TST r7,#1
- BEQ L0x170
- VLD1.8 {d0,d1},[r1]
- ADD r11,r11,#1
- VPADDL.U8 q0,q0
- VPADD.I16 d0,d0,d1
- VPADDL.U16 d0,d0
- VPADDL.U32 d7,d0
- VRSHR.U64 d8,d7,#4
-L0x170:
- CMP r11,#2
- BNE L0x180
- VADD.I64 d8,d7,d6
- VRSHR.U64 d8,d8,#5
-L0x180:
- VDUP.8 q3,d8[0]
- CMP r11,#0
- ADD r8,r3,r5
- ADD r10,r5,r5
- BNE L0x198
- VMOV.I8 q3,#0x80
-L0x198:
- VST1.8 {d6,d7},[r3],r10
- VST1.8 {d6,d7},[r8],r10
- VST1.8 {d6,d7},[r3],r10
- VST1.8 {d6,d7},[r8],r10
- VST1.8 {d6,d7},[r3],r10
- VST1.8 {d6,d7},[r8],r10
- VST1.8 {d6,d7},[r3],r10
- VST1.8 {d6,d7},[r8],r10
- VST1.8 {d6,d7},[r3],r10
- VST1.8 {d6,d7},[r8],r10
- VST1.8 {d6,d7},[r3],r10
- VST1.8 {d6,d7},[r8],r10
- VST1.8 {d6,d7},[r3],r10
- VST1.8 {d6,d7},[r8],r10
- VST1.8 {d6,d7},[r3],r10
- VST1.8 {d6,d7},[r8],r10
- MOV r0,#0
- VPOP {d8-d15}
- POP {r4-r12,pc}
-OMX_VC_16X16_PLANE:
- ADR r9, armVCM4P10_MultiplierTable16x16
- VLD1.8 {d0,d1},[r1]
- VLD1.8 {d4[0]},[r2]
- ADD r8,r0,r4
- ADD r10,r4,r4
- VLD1.8 {d2[0]},[r0],r10
- VLD1.8 {d2[1]},[r8],r10
- VLD1.8 {d2[2]},[r0],r10
- VLD1.8 {d2[3]},[r8],r10
- VLD1.8 {d2[4]},[r0],r10
- VLD1.8 {d2[5]},[r8],r10
- VLD1.8 {d2[6]},[r0],r10
- VLD1.8 {d2[7]},[r8],r10
- VLD1.8 {d3[0]},[r0],r10
- VLD1.8 {d3[1]},[r8],r10
- VLD1.8 {d3[2]},[r0],r10
- VLD1.8 {d3[3]},[r8],r10
- VLD1.8 {d3[4]},[r0],r10
- VLD1.8 {d3[5]},[r8],r10
- VLD1.8 {d3[6]},[r0],r10
- VLD1.8 {d3[7]},[r8]
- VREV64.8 d5,d1
- VSUBL.U8 q3,d5,d4
- VSHR.U64 d5,d5,#8
- VSUBL.U8 q4,d5,d0
- VSHL.I64 d9,d9,#16
- VEXT.8 d9,d9,d6,#2
- VREV64.8 d12,d3
- VSUBL.U8 q7,d12,d4
- VSHR.U64 d12,d12,#8
- VSUBL.U8 q8,d12,d2
- VLD1.16 {d20,d21},[r9]!
- VSHL.I64 d17,d17,#16
- VEXT.8 d17,d17,d14,#2
- VMULL.S16 q11,d8,d20
- VMULL.S16 q12,d16,d20
- VMLAL.S16 q11,d9,d21
- VMLAL.S16 q12,d17,d21
- VPADD.I32 d22,d23,d22
- VPADD.I32 d23,d25,d24
- VPADDL.S32 q11,q11
- VSHL.I64 q12,q11,#2
- VADD.I64 q11,q11,q12
- VRSHR.S64 q11,q11,#6
- VSHL.I64 q12,q11,#3
- VSUB.I64 q12,q12,q11
- VLD1.16 {d20,d21},[r9]!
- VDUP.16 q6,d22[0]
- VDUP.16 q7,d23[0]
- VADDL.U8 q11,d1,d3
- VSHL.I16 q11,q11,#4
- VDUP.16 q11,d23[3]
- VADD.I64 d1,d24,d25
- VLD1.16 {d24,d25},[r9]
- VDUP.16 q13,d1[0]
- VSUB.I16 q13,q11,q13
- VMUL.I16 q5,q6,q10
- VMUL.I16 q6,q6,q12
- VADD.I16 q0,q5,q13
- VADD.I16 q1,q6,q13
-L0x2d4:
- VQRSHRUN.S16 d6,q0,#5
- VQRSHRUN.S16 d7,q1,#5
- SUBS r12,r12,#1
- VST1.8 {d6,d7},[r3],r5
- VADD.I16 q0,q0,q7
- VADD.I16 q1,q1,q7
- BNE L0x2d4
- MOV r0,#0
- VPOP {d8-d15}
- POP {r4-r12,pc}
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_PredictIntra_4x4_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_PredictIntra_4x4_s.S
deleted file mode 100644
index d4c8485..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_PredictIntra_4x4_s.S
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
-
- .text
- .align 4
-
-armVCM4P10_pSwitchTable4x4:
- .word OMX_VC_4x4_VERT-(P0+8), OMX_VC_4x4_HOR-(P0+8)
- .word OMX_VC_4x4_DC-(P0+8), OMX_VC_4x4_DIAG_DL-(P0+8)
- .word OMX_VC_4x4_DIAG_DR-(P0+8), OMX_VC_4x4_VR-(P0+8)
- .word OMX_VC_4x4_HD-(P0+8), OMX_VC_4x4_VL-(P0+8)
- .word OMX_VC_4x4_HU-(P0+8)
-
- .global omxVCM4P10_PredictIntra_4x4
-omxVCM4P10_PredictIntra_4x4:
- PUSH {r4-r12,lr}
- VPUSH {d8-d12}
- ADR r8, armVCM4P10_pSwitchTable4x4
- LDRD r6,r7,[sp,#0x58]
- LDRD r4,r5,[sp,#0x50]
- LDR r8,[r8,r6,LSL #2]
-P0: ADD pc, r8
-
-OMX_VC_4x4_HOR:
- ADD r9,r0,r4
- ADD r10,r4,r4
- VLD1.8 {d0[]},[r0],r10
- VLD1.8 {d1[]},[r9],r10
- VLD1.8 {d2[]},[r0]
- VLD1.8 {d3[]},[r9]
- ADD r11,r3,r5
- ADD r12,r5,r5
- VST1.32 {d0[0]},[r3],r12
- VST1.32 {d1[0]},[r11],r12
- VST1.32 {d2[0]},[r3]
- VST1.32 {d3[0]},[r11]
- B L0x348
-OMX_VC_4x4_VERT:
- VLD1.32 {d0[0]},[r1]
- ADD r11,r3,r5
- ADD r12,r5,r5
-L0x58:
- VST1.32 {d0[0]},[r3],r12
- VST1.32 {d0[0]},[r11],r12
- VST1.32 {d0[0]},[r3]
- VST1.32 {d0[0]},[r11]
- B L0x348
-OMX_VC_4x4_DC:
- TST r7,#2
- BEQ L0xdc
- ADD r9,r0,r4
- ADD r10,r4,r4
- VLD1.8 {d0[0]},[r0],r10
- VLD1.8 {d0[1]},[r9],r10
- VLD1.8 {d0[2]},[r0]
- VLD1.8 {d0[3]},[r9]
- TST r7,#1
- BEQ L0xbc
- VLD1.32 {d0[1]},[r1]
- MOV r0,#0
- VPADDL.U8 d1,d0
- VPADDL.U16 d1,d1
- VPADDL.U32 d1,d1
- VRSHR.U64 d1,d1,#3
- ADD r11,r3,r5
- ADD r12,r5,r5
- VDUP.8 d0,d1[0]
- B L0x58
-L0xbc:
- MOV r0,#0
- VPADDL.U8 d1,d0
- VPADDL.U16 d1,d1
- VRSHR.U32 d1,d1,#2
- ADD r11,r3,r5
- ADD r12,r5,r5
- VDUP.8 d0,d1[0]
- B L0x58
-L0xdc:
- TST r7,#1
- BEQ L0x108
- VLD1.32 {d0[0]},[r1]
- MOV r0,#0
- VPADDL.U8 d1,d0
- VPADDL.U16 d1,d1
- VRSHR.U32 d1,d1,#2
- ADD r11,r3,r5
- ADD r12,r5,r5
- VDUP.8 d0,d1[0]
- B L0x58
-L0x108:
- VMOV.I8 d0,#0x80
- MOV r0,#0
- ADD r11,r3,r5
- ADD r12,r5,r5
- B L0x58
-OMX_VC_4x4_DIAG_DL:
- TST r7,#0x40
- BEQ L0x138
- VLD1.8 {d3},[r1]
- VDUP.8 d2,d3[7]
- VEXT.8 d4,d3,d2,#1
- VEXT.8 d5,d3,d2,#2
- B L0x14c
-L0x138:
- VLD1.32 {d0[1]},[r1]
- VDUP.8 d2,d0[7]
- VEXT.8 d3,d0,d2,#4
- VEXT.8 d4,d0,d2,#5
- VEXT.8 d5,d0,d2,#6
-L0x14c:
- VHADD.U8 d6,d3,d5
- VRHADD.U8 d6,d6,d4
- VST1.32 {d6[0]},[r3],r5
- VEXT.8 d6,d6,d6,#1
- VST1.32 {d6[0]},[r3],r5
- VEXT.8 d6,d6,d6,#1
- VST1.32 {d6[0]},[r3],r5
- VEXT.8 d6,d6,d6,#1
- VST1.32 {d6[0]},[r3]
- B L0x348
-OMX_VC_4x4_DIAG_DR:
- VLD1.32 {d0[0]},[r1]
- VLD1.8 {d1[7]},[r2]
- ADD r9,r0,r4
- ADD r10,r4,r4
- ADD r1,r3,r5
- VLD1.8 {d1[6]},[r0],r10
- VLD1.8 {d1[5]},[r9],r10
- VLD1.8 {d1[4]},[r0]
- VLD1.8 {d1[3]},[r9]
- VEXT.8 d3,d1,d0,#3
- ADD r4,r1,r5
- VEXT.8 d4,d1,d0,#4
- ADD r6,r4,r5
- VEXT.8 d5,d1,d0,#5
- VHADD.U8 d6,d3,d5
- VRHADD.U8 d6,d6,d4
- VST1.32 {d6[0]},[r6]
- VEXT.8 d6,d6,d6,#1
- VST1.32 {d6[0]},[r4]
- VEXT.8 d6,d6,d6,#1
- VST1.32 {d6[0]},[r1]
- VEXT.8 d6,d6,d6,#1
- VST1.32 {d6[0]},[r3]
- B L0x348
-OMX_VC_4x4_VR:
- VLD1.32 {d0[0]},[r1]
- VLD1.8 {d0[7]},[r2]
- VLD1.8 {d1[7]},[r0],r4
- VLD1.8 {d2[7]},[r0],r4
- VLD1.8 {d1[6]},[r0]
- VEXT.8 d12,d0,d0,#7
- VEXT.8 d3,d1,d12,#6
- VEXT.8 d4,d2,d12,#7
- VEXT.8 d5,d1,d0,#7
- VEXT.8 d6,d2,d0,#7
- VEXT.8 d11,d1,d12,#7
- VHADD.U8 d8,d6,d12
- VRHADD.U8 d8,d8,d11
- VHADD.U8 d7,d3,d5
- VRHADD.U8 d7,d7,d4
- VEXT.8 d10,d8,d8,#1
- ADD r11,r3,r5
- ADD r12,r5,r5
- VEXT.8 d9,d7,d7,#1
- VST1.32 {d10[0]},[r3],r12
- VST1.32 {d9[0]},[r11],r12
- VST1.32 {d8[0]},[r3],r12
- VST1.32 {d7[0]},[r11]
- B L0x348
-OMX_VC_4x4_HD:
- VLD1.8 {d0},[r1]
- VLD1.8 {d1[7]},[r2]
- ADD r9,r0,r4
- ADD r10,r4,r4
- VLD1.8 {d1[6]},[r0],r10
- VLD1.8 {d1[5]},[r9],r10
- VLD1.8 {d1[4]},[r0]
- VLD1.8 {d1[3]},[r9]
- VEXT.8 d3,d1,d0,#3
- VEXT.8 d4,d1,d0,#2
- VEXT.8 d5,d1,d0,#1
- VHADD.U8 d7,d3,d5
- VRHADD.U8 d7,d7,d4
- VRHADD.U8 d8,d4,d3
- VSHL.I64 d8,d8,#24
- VSHL.I64 d6,d7,#16
- VZIP.8 d8,d6
- VEXT.8 d7,d7,d7,#6
- VEXT.8 d8,d6,d7,#2
- ADD r11,r3,r5
- ADD r12,r5,r5
- VST1.32 {d8[1]},[r3],r12
- VST1.32 {d6[1]},[r11],r12
- VST1.32 {d8[0]},[r3]
- VST1.32 {d6[0]},[r11]
- B L0x348
-OMX_VC_4x4_VL:
- TST r7,#0x40
- BEQ L0x2b4
- VLD1.8 {d3},[r1]
- VEXT.8 d4,d3,d3,#1
- VEXT.8 d5,d4,d4,#1
- B L0x2c8
-L0x2b4:
- VLD1.32 {d0[1]},[r1]
- VDUP.8 d2,d0[7]
- VEXT.8 d3,d0,d2,#4
- VEXT.8 d4,d0,d2,#5
- VEXT.8 d5,d0,d2,#6
-L0x2c8:
- VRHADD.U8 d7,d4,d3
- VHADD.U8 d10,d3,d5
- VRHADD.U8 d10,d10,d4
- VEXT.8 d8,d7,d7,#1
- ADD r11,r3,r5
- ADD r12,r5,r5
- VEXT.8 d9,d10,d8,#1
- VST1.32 {d7[0]},[r3],r12
- VST1.32 {d10[0]},[r11],r12
- VST1.32 {d8[0]},[r3]
- VST1.32 {d9[0]},[r11]
- B L0x348
-OMX_VC_4x4_HU:
- ADD r9,r0,r4
- ADD r10,r4,r4
- VLD1.8 {d1[4]},[r0],r10
- VLD1.8 {d1[5]},[r9],r10
- VLD1.8 {d1[6]},[r0]
- VLD1.8 {d1[7]},[r9]
- VDUP.8 d2,d1[7]
- VEXT.8 d3,d1,d2,#4
- VEXT.8 d4,d1,d2,#5
- VEXT.8 d5,d1,d2,#6
- VHADD.U8 d7,d3,d5
- VRHADD.U8 d7,d7,d4
- VRHADD.U8 d8,d4,d3
- VZIP.8 d8,d7
- VST1.32 {d8[0]},[r3],r5
- VEXT.8 d8,d8,d8,#2
- VST1.32 {d8[0]},[r3],r5
- VEXT.8 d8,d8,d8,#2
- VST1.32 {d8[0]},[r3],r5
- VST1.32 {d7[0]},[r3]
-L0x348:
- MOV r0,#0
- VPOP {d8-d12}
- POP {r4-r12,pc}
-
- .end
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_TransformDequantChromaDCFromPair_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_TransformDequantChromaDCFromPair_s.S
deleted file mode 100644
index 74f5103..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_TransformDequantChromaDCFromPair_s.S
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
- .syntax unified
-
- .global omxVCM4P10_TransformDequantChromaDCFromPair
-omxVCM4P10_TransformDequantChromaDCFromPair:
- push {r4-r10, lr}
- ldr r9, [r0,#0]
- vmov.i16 d0, #0
- mov r8, #0x1f
- vst1.16 {d0}, [r1]
- ldrb r6, [r9], #1
-unpackLoop:
- tst r6, #0x10
- ldrsbne r5, [r9, #1]
- ldrbne r4, [r9], #2
- and r7, r8, r6, lsl #1
- ldrsbeq r4, [r9], #1
- orrne r4, r4, r5, lsl #8
- tst r6, #0x20
- ldrbeq r6, [r9], #1
- strh r4, [r1, r7]
- beq unpackLoop
- ldmia r1, {r3, r4}
- str r9, [r0, #0]
- ldr r5, .LarmVCM4P10_QPDivTable
-P0: add r5, pc
- ldr r6, .LarmVCM4P10_VMatrixQPModTable
-P1: add r6, pc
- saddsubx r3, r3, r3
- saddsubx r4, r4, r4
- ldrsb r9, [r5, r2]
- ldrsb r2, [r6, r2]
- sadd16 r5, r3, r4
- ssub16 r6, r3, r4
- lsl r2, r2, r9
- vmov d0, r5, r6
- vrev32.16 d0, d0
- vdup.16 d1, r2
- vmull.s16 q1, d0, d1
- vshrn.i32 d2, q1, #1
- vst1.16 {d2}, [r1]
- mov r0, #0
- pop {r4-r10, pc}
-
-.LarmVCM4P10_QPDivTable:
- .word armVCM4P10_QPDivTable-(P0+8)
-.LarmVCM4P10_VMatrixQPModTable:
- .word armVCM4P10_VMatrixQPModTable-(P1+8)
-
- .end
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_TransformDequantLumaDCFromPair_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_TransformDequantLumaDCFromPair_s.S
deleted file mode 100644
index a01030a..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_TransformDequantLumaDCFromPair_s.S
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- */
-
- .eabi_attribute 24, 1
- .eabi_attribute 25, 1
-
- .arm
- .fpu neon
- .text
-
- .global armVCM4P10_InvTransformDequantLumaDC4x4
-armVCM4P10_InvTransformDequantLumaDC4x4:
- PUSH {r4-r6,lr}
- VPUSH {d8-d13}
- VLD4.16 {d0,d1,d2,d3},[r0]
- LDR r2, .LarmVCM4P10_QPDivTable
-P0: ADD r2, pc
- LDR r3, .LarmVCM4P10_VMatrixQPModTable
-P1: ADD r3, pc
- VADD.I16 d4,d0,d1
- VADD.I16 d5,d2,d3
- VSUB.I16 d6,d0,d1
- LDRSB r4,[r2,r1]
- VSUB.I16 d7,d2,d3
- LDRSB r5,[r3,r1]
- VADD.I16 d0,d4,d5
- VSUB.I16 d1,d4,d5
- VSUB.I16 d2,d6,d7
- LSL r5,r5,r4
- VADD.I16 d3,d6,d7
- VTRN.16 d0,d1
- VTRN.16 d2,d3
- VTRN.32 q0,q1
- VADD.I16 d4,d0,d1
- VADD.I16 d5,d2,d3
- VSUB.I16 d6,d0,d1
- VSUB.I16 d7,d2,d3
- VADD.I16 d0,d4,d5
- VSUB.I16 d1,d4,d5
- VSUB.I16 d2,d6,d7
- VADD.I16 d3,d6,d7
- VDUP.16 d5,r5
- VMOV.I32 q3,#0x2
- VMOV.I32 q4,#0x2
- VMOV.I32 q5,#0x2
- VMOV.I32 q6,#0x2
- VMLAL.S16 q3,d0,d5
- VMLAL.S16 q4,d1,d5
- VMLAL.S16 q5,d2,d5
- VMLAL.S16 q6,d3,d5
- VSHRN.I32 d0,q3,#2
- VSHRN.I32 d1,q4,#2
- VSHRN.I32 d2,q5,#2
- VSHRN.I32 d3,q6,#2
- VST1.16 {d0,d1,d2,d3},[r0]
- VPOP {d8-d13}
- POP {r4-r6,pc}
-
-.LarmVCM4P10_QPDivTable:
- .word armVCM4P10_QPDivTable-(P0+8)
-.LarmVCM4P10_VMatrixQPModTable:
- .word armVCM4P10_VMatrixQPModTable-(P1+8)
-
-.global omxVCM4P10_TransformDequantLumaDCFromPair
-omxVCM4P10_TransformDequantLumaDCFromPair:
- PUSH {r4-r6,lr}
- MOV r4,r1
- MOV r5,r2
- BL armVCM4P10_UnpackBlock4x4
- MOV r0,r4
- MOV r1,r5
- BL armVCM4P10_InvTransformDequantLumaDC4x4
- MOV r0,#0
- POP {r4-r6,pc}
-
- .end
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/api/armVCM4P2_Huff_Tables_VLC.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/api/armVCM4P2_Huff_Tables_VLC.h
deleted file mode 100644
index 6cbc5ff..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/api/armVCM4P2_Huff_Tables_VLC.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_Huff_Tables_VLC.h
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- *
- * File: armVCM4P2_Huff_Tables.h
- * Description: Declares Tables used for Hufffman coding and decoding
- * in MP4P2 codec.
- *
- */
-
-#ifndef _OMXHUFFTAB_H_
-#define _OMXHUFFTAB_H_
-
-
-extern const OMX_U16 armVCM4P2_IntraVlcL0L1[200];
-
-
-extern const OMX_U16 armVCM4P2_InterVlcL0L1[200];
-
-extern const OMX_U16 armVCM4P2_aIntraDCLumaChromaIndex[64];
-//extern const OMX_U16 armVCM4P2_aIntraDCChromaIndex[32];
-extern const OMX_U16 armVCM4P2_aVlcMVD[124];
-
-extern const OMX_U8 armVCM4P2_InterL0L1LMAX[73];
-extern const OMX_U8 armVCM4P2_InterL0L1RMAX[35];
-extern const OMX_U8 armVCM4P2_IntraL0L1LMAX[53];
-extern const OMX_U8 armVCM4P2_IntraL0L1RMAX[40]
-
-#endif /* _OMXHUFFTAB_H_ */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/api/armVCM4P2_ZigZag_Tables.h b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/api/armVCM4P2_ZigZag_Tables.h
deleted file mode 100644
index 0d64a68..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/api/armVCM4P2_ZigZag_Tables.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_ZigZag_Tables.h
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- *
- * File: armVCM4P2_Zigzag_Tables.h
- * Description: Declares Tables used for Zigzag scan in MP4P2 codec.
- *
- */
-
-#ifndef _OMXZIGZAGTAB_H
-#define _OMXZIGZAGTAB_H
-
-extern const OMX_U8 armVCM4P2_aClassicalZigzagScan [192];
-//extern const OMX_U8 armVCM4P2_aHorizontalZigzagScan [64];
-//extern const OMX_U8 armVCM4P2_aVerticalZigzagScan [64];
-
-#endif /* _OMXZIGZAGTAB_H_ */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/armVCM4P2_Clip8_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/armVCM4P2_Clip8_s.s
deleted file mode 100644
index 2f830fc..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/armVCM4P2_Clip8_s.s
+++ /dev/null
@@ -1,96 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-; /**
-; *
-; * File Name: armVCM4P2_Clip8_s.s
-; * OpenMAX DL: v1.0.2
-; * Revision: 12290
-; * Date: Wednesday, April 9, 2008
-; *
-; *
-; *
-; *
-; * Description:
-; * Contains module for Clipping 16 bit value to [0,255] Range
-; */
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
-
- M_VARIANTS CortexA8
-
- IF CortexA8
-;//Input Arguments
-
-pSrc RN 0
-pDst RN 1
-step RN 2
-
-;// Neon Registers
-
-qx0 QN Q0.S16
-dx00 DN D0.S16
-dx01 DN D1.S16
-qx1 QN Q1.S16
-dx10 DN D2.S16
-dx11 DN D3.S16
-
-qx2 QN Q2.S16
-dx20 DN D4.S16
-dx21 DN D5.S16
-qx3 QN Q3.S16
-dx30 DN D6.S16
-dx31 DN D7.S16
-
-
-dclip0 DN D0.U8
-dclip1 DN D2.U8
-dclip2 DN D4.U8
-dclip3 DN D6.U8
-
- M_START armVCM4P2_Clip8
-
- VLD1 {dx00,dx01,dx10,dx11},[pSrc]! ;// Load 16 entries from pSrc
- VLD1 {dx20,dx21,dx30,dx31},[pSrc]! ;// Load next 16 entries from pSrc
- VQSHRUN dclip0,qx0,#0 ;// dclip0[i]=clip qx0[i] to [0,255]
- VQSHRUN dclip1,qx1,#0 ;// dclip1[i]=clip qx1[i] to [0,255]
- VST1 {dclip0},[pDst],step ;// store 8 bytes and pDst=pDst+step
- VST1 {dclip1},[pDst],step ;// store 8 bytes and pDst=pDst+step
- VQSHRUN dclip2,qx2,#0
- VQSHRUN dclip3,qx3,#0
- VST1 {dclip2},[pDst],step
- VST1 {dclip3},[pDst],step
-
- VLD1 {dx00,dx01,dx10,dx11},[pSrc]! ;// Load 16 entries from pSrc
- VLD1 {dx20,dx21,dx30,dx31},[pSrc]! ;// Load next 16 entries from pSrc
- VQSHRUN dclip0,qx0,#0 ;// dclip0[i]=clip qx0[i] to [0,255]
- VQSHRUN dclip1,qx1,#0 ;// dclip1[i]=clip qx1[i] to [0,255]
- VST1 {dclip0},[pDst],step ;// store 8 bytes and pDst=pDst+step
- VST1 {dclip1},[pDst],step ;// store 8 bytes and pDst=pDst+step
- VQSHRUN dclip2,qx2,#0
- VQSHRUN dclip3,qx3,#0
- VST1 {dclip2},[pDst],step
- VST1 {dclip3},[pDst],step
-
-
-
- M_END
- ENDIF
-
-
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/armVCM4P2_DecodeVLCZigzag_AC_unsafe_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/armVCM4P2_DecodeVLCZigzag_AC_unsafe_s.s
deleted file mode 100644
index 016e65b..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/armVCM4P2_DecodeVLCZigzag_AC_unsafe_s.s
+++ /dev/null
@@ -1,412 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;/**
-; *
-; * File Name: armVCM4P2_DecodeVLCZigzag_AC_unsafe_s.s
-; * OpenMAX DL: v1.0.2
-; * Revision: 12290
-; * Date: Wednesday, April 9, 2008
-; *
-; *
-; *
-; *
-; * Description:
-; * Contains modules for zigzag scanning and VLC decoding
-; * for inter, intra block.
-; *
-; *
-; *
-; * Function: omxVCM4P2_DecodeVLCZigzag_AC_unsafe
-; *
-; * Description:
-; * Performs VLC decoding and inverse zigzag scan
-; *
-; *
-; *
-; *
-; */
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
- INCLUDE armCOMM_BitDec_s.h
-
-
- M_VARIANTS ARM1136JS
-
-
-
-
-
- IF ARM1136JS
-
-
-
-
-
-;//Input Arguments
-
-ppBitStream RN 0
-pBitOffset RN 1
-pDst RN 2
-shortVideoHeader RN 3
-
-
-;//Local Variables
-
-Return RN 0
-
-pVlcTableL0L1 RN 4
-pLMAXTableL0L1 RN 4
-pRMAXTableL0L1 RN 4
-pZigzagTable RN 4
-
-ftype RN 0
-temp3 RN 4
-temp RN 5
-Count RN 6
-Escape RN 5
-
-;// armVCM4P2_FillVLDBuffer
-zigzag RN 0
-storeLevel RN 1
-temp2 RN 4
-temp1 RN 5
-sign RN 5
-Last RN 7
-storeRun RN 14
-
-
-packRetIndex RN 5
-
-
-markerbit RN 5
-
-;// Scratch Registers
-
-RBitStream RN 8
-RBitBuffer RN 9
-RBitCount RN 10
-
-T1 RN 11
-T2 RN 12
-LR RN 14
-
-
-
- M_ALLOC4 pppBitStream,4
- M_ALLOC4 ppOffset,4
- M_ALLOC4 pLinkRegister,4
-
- M_START armVCM4P2_DecodeVLCZigzag_AC_unsafe
-
- ;// get the table addresses from stack
- M_ARG ppVlcTableL0L1,4
- M_ARG ppLMAXTableL0L1,4
- M_ARG ppRMAXTableL0L1,4
- M_ARG ppZigzagTable,4
-
- ;// Store ALL zeros at pDst
-
- MOV temp1,#0 ;// Initialize Count to zero
- MOV Last,#0
- M_STR LR,pLinkRegister ;// Store Link Register on Stack
- MOV temp2,#0
- MOV LR,#0
-
- ;// Initialize the Macro and Store all zeros to pDst
-
- STM pDst!,{temp2,temp1,Last,LR}
- M_BD_INIT0 ppBitStream, pBitOffset, RBitStream, RBitBuffer, RBitCount
- STM pDst!,{temp2,temp1,Last,LR}
- M_BD_INIT1 T1, T2, T2
- STM pDst!,{temp2,temp1,Last,LR}
- M_BD_INIT2 T1, T2, T2
- STM pDst!,{temp2,temp1,Last,LR}
- M_STR ppBitStream,pppBitStream ;// Store ppBitstream on stack
- STM pDst!,{temp2,temp1,Last,LR}
- M_STR pBitOffset,ppOffset ;// Store pBitOffset on stack
- STM pDst!,{temp2,temp1,Last,LR}
-
- STM pDst!,{temp2,temp1,Last,LR}
- STM pDst!,{temp2,temp1,Last,LR}
-
-
- SUB pDst,pDst,#128 ;// Restore pDst
-
- ;// The armVCM4P2_GetVLCBits begins
-
-getVLCbits
-
- M_BD_LOOK8 Escape,7 ;// Load Escape Value
- LSR Escape,Escape,#25
- CMP Escape,#3 ;// check for escape mode
- MOVNE ftype,#0
- BNE notEscapemode ;// Branch if not in Escape mode 3
-
- M_BD_VSKIP8 #7,T1
- CMP shortVideoHeader,#0 ;// Check shortVideoHeader flag to know the type of Escape mode
- BEQ endFillVLD
-
- ;// Escape Mode 4
-
- M_BD_READ8 Last,1,T1
- M_BD_READ8 storeRun,6,T1
- M_BD_READ8 storeLevel,8,T1
-
-
- ;// Check whether the Reserved values for Level are used and Exit with an Error Message if it is so
-
- TEQ storeLevel,#0
- TEQNE storeLevel,#128
- BEQ ExitError
-
- ADD temp2,storeRun,Count
- CMP temp2,#64
- BGE ExitError ;// error if Count+storeRun >= 64
-
-
- ;// Load address of zigzagTable
-
- M_LDR pZigzagTable,ppZigzagTable ;// Loading the Address of Zigzag table
-
-
- ;// armVCM4P2_FillVLDBuffer
-
- SXTB storeLevel,storeLevel ;// Sign Extend storeLevel to 32 bits
-
-
- ;// To Reflect Runlength
-
- ADD Count,Count,storeRun
- LDRB zigzag,[pZigzagTable,Count]
- ADD Count,Count,#1
- STRH storeLevel,[pDst,zigzag] ;// store Level
-
- B ExitOk
-
-
-
-endFillVLD
-
-
- ;// Load Ftype( Escape Mode) value based on the two successive bits in the bitstream
-
- M_BD_READ8 temp1,1,T1
- CMP temp1,#0
- MOVEQ ftype,#1
- BEQ notEscapemode
- M_BD_READ8 temp1,1,T1
- CMP temp1,#1
- MOVEQ ftype,#3
- MOVNE ftype,#2
-
-
-notEscapemode
-
- ;// Load optimized packed VLC table with last=0 and Last=1
-
- M_LDR pVlcTableL0L1,ppVlcTableL0L1 ;// Load Combined VLC Table
-
-
- CMP ftype,#3 ;// If ftype >=3 get perform Fixed Length Decoding (Escape Mode 3)
- BGE EscapeMode3 ;// Else continue normal VLC Decoding
-
- ;// Variable lengh decoding, "armUnPackVLC32"
-
-
- M_BD_VLD packRetIndex,T1,T2,pVlcTableL0L1,4,2
-
-
- LDR temp3,=0xFFF
-
- CMP packRetIndex,temp3 ;// Check for invalid symbol
- BEQ ExitError ;// if invalid symbol occurs exit with an error message
-
- AND Last,packRetIndex,#2 ;// Get Last from packed Index
-
-
-
-
- LSR storeRun,packRetIndex,#7 ;// Get Run Value from Packed index
- AND storeLevel,packRetIndex,#0x7c ;// storeLevel=packRetIndex[2-6],storeLevel[0-1]=0
-
-
- M_LDR pLMAXTableL0L1,ppLMAXTableL0L1 ;// Load LMAX table
-
-
- LSR storeLevel,storeLevel,#2 ;// Level value
-
- CMP ftype,#1
- BNE ftype2
-
- ;// ftype==1; Escape mode =1
-
-
- ADD temp1, pLMAXTableL0L1, Last, LSL#4 ;// If the Last=1 add 32 to table address
- LDRB temp1,[temp1,storeRun]
-
-
- ADD storeLevel,temp1,storeLevel
-
-ftype2
-
- ;// ftype =2; Escape mode =2
-
- M_LDR pRMAXTableL0L1,ppRMAXTableL0L1 ;// Load RMAX Table
-
- CMP ftype,#2
- BNE FillVLDL1
-
- ADD temp1, pRMAXTableL0L1, Last, LSL#4 ;// If Last=1 add 32 to table address
- SUB temp2,storeLevel,#1
- LDRB temp1,[temp1,temp2]
-
-
- ADD storeRun,storeRun,#1
- ADD storeRun,temp1
-
-FillVLDL1
-
-
- ;// armVCM4P2_FillVLDBuffer
-
- M_LDR pZigzagTable,ppZigzagTable ;// Load address of zigzagTable
-
- M_BD_READ8 sign,1,T1
-
- CMP sign,#1
- RSBEQ storeLevel,storeLevel,#0
-
- ADD temp1,storeRun,Count ;// Exit with an error message if Run + Count exceeds 63
- CMP temp1,#64
- BGE ExitError
-
-
-
-
-
-
- ;// To Reflect Runlenght
-
- ADD Count,Count,storeRun
-
-storeLevelL1
-
- LDRB zigzag,[pZigzagTable,Count]
- CMP Last,#2 ;// Check if the Level val is Last non zero val
- ADD Count,Count,#1
- LSR Last,Last,#1
- STRH storeLevel,[pDst,zigzag]
-
- BNE end
-
- B ExitOk
-
-
-
- ;// Fixed Lengh Decoding Escape Mode 3
-
-EscapeMode3
-
- M_BD_READ8 Last,1,T1
- M_BD_READ8 storeRun,6,T1
-
- ADD temp2,storeRun,Count ;// Exit with an error message if Run + Count exceeds 63
- CMP temp2,#64
- BGE ExitError
-
- M_BD_READ8 markerbit,1,T1
- TEQ markerbit,#0 ;// Exit with an error message if marker bit is zero
- BEQ ExitError
-
- M_BD_READ16 storeLevel,12,T1
-
- TST storeLevel,#0x800 ;// test if the level is negative
- SUBNE storeLevel,storeLevel,#4096
- CMP storeLevel,#0
- CMPNE storeLevel,#-2048
- BEQ ExitError ;// Exit with an error message if Level==0 or -2048
-
- M_LDR pZigzagTable,ppZigzagTable ;// Load address of zigzagTable
-
- M_BD_READ8 markerbit,1,T1
-
-
- ;// armVCM4P2_FillVLDBuffer ( Sign not used as storeLevel is preprocessed)
-
-
-
- ;// To Reflect Run Length
-
- ADD Count,Count,storeRun
-
-
-
-storeLevelLast
-
- LDRB zigzag,[pZigzagTable,Count]
- CMP Last,#1
- ADD Count,Count,#1
- STRH storeLevel,[pDst,zigzag]
-
- BNE end
-
- B ExitOk
-
-end
-
- CMP Count,#64 ;//Run the Loop untill Count reaches 64
-
- BLT getVLCbits
-
-
-ExitOk
- ;// Exit When VLC Decoding is done Successfully
-
- ;// Loading ppBitStream and pBitOffset from stack
-
- CMP Last,#1
- M_LDR ppBitStream,pppBitStream
- M_LDR pBitOffset,ppOffset
-
- ;//Ending the macro
-
- M_BD_FINI ppBitStream,pBitOffset
-
- MOVEQ Return,#OMX_Sts_NoErr
- MOVNE Return,#OMX_Sts_Err
- M_LDR LR,pLinkRegister ;// Load the Link Register Back
- B exit2
-
-ExitError
- ;// Exit When an Error occurs
-
- M_LDR ppBitStream,pppBitStream
- M_LDR pBitOffset,ppOffset
- ;//Ending the macro
-
- M_BD_FINI ppBitStream,pBitOffset
- M_LDR LR,pLinkRegister
- MOV Return,#OMX_Sts_Err
-
-exit2
-
-
- M_END
- ENDIF
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/armVCM4P2_Huff_Tables_VLC.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/armVCM4P2_Huff_Tables_VLC.c
deleted file mode 100644
index 5a77832..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/armVCM4P2_Huff_Tables_VLC.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
- /**
- *
- * File Name: armVCM4P2_Huff_Tables_VLC.c
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- * File: armVCM4P2_Huff_Tables_VLC.c
- * Description: Contains all the Huffman tables used in MPEG4 codec
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-
-#include "armCOMM_Bitstream.h"
-
-
-
-
-// Contains optimized and Packed VLC tables with Last=0 and Last=1
-
-// optimized Packed VLC table Entry Format
-// ---------------------------------------
-//
-// 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
-// +------------------------------------------------+
-// | Len | Run | Level |L | 1 |
-// +------------------------------------------------+
-// | Offset | 0 |
-// +------------------------------------------------+
-// If the table entry is a leaf entry then bit 0 set:
-// Len = Number of bits overread (0 to 7) 3 bits
-// Run = RunLength of the Symbol (0 to 63) 6 bits
-// Level = Level of the Symbol (0 to 31) 5 bits
-// L = Last Value of the Symbol (0 or 1) 1 bit
-//
-// If the table entry is an internal node then bit 0 is clear:
-// Offset = Number of (16-bit) half words from the table
-// start to the next table node
-//
-// The table is accessed by successive lookup up on the
-// next Step bits of the input bitstream until a leaf node
-// is obtained. The Step sizes are supplied to the VLD macro.
-
-// The VLC tables used for Intra and non inta coefficients in non Escape mode
-// contains symbols with both Last=0 and Last=1.
-// If a symbol is not found in the table it will be coded as 0xFFF
-
-
-const OMX_U16 armVCM4P2_InterVlcL0L1[200] = {
- 0x0020, 0x0108, 0x0148, 0x0170, 0x0178, 0x0180, 0x0188, 0x1b09,
- 0x4009, 0x4009, 0x4009, 0x4009, 0x2109, 0x2109, 0x0209, 0x0011,
- 0x0028, 0x0060, 0x00b8, 0x00e0, 0x0030, 0x0048, 0x0050, 0x0058,
- 0x3fff, 0x3fff, 0x0038, 0x0040, 0x2115, 0x2115, 0x201d, 0x201d,
- 0x2059, 0x2059, 0x2051, 0x2051, 0x1c0d, 0x1b0d, 0x1a0d, 0x190d,
- 0x0911, 0x0811, 0x0711, 0x0611, 0x0511, 0x0319, 0x0219, 0x0121,
- 0x0068, 0x0090, 0x3fff, 0x3fff, 0x0070, 0x0078, 0x0080, 0x0088,
- 0x2061, 0x2061, 0x2129, 0x2129, 0x3709, 0x3709, 0x3809, 0x3809,
- 0x3d0d, 0x3d0d, 0x3e0d, 0x3e0d, 0x3f0d, 0x3f0d, 0x200d, 0x200d,
- 0x0098, 0x00a0, 0x00a8, 0x00b0, 0x0131, 0x0221, 0x0419, 0x0519,
- 0x0619, 0x0a11, 0x1909, 0x1a09, 0x210d, 0x220d, 0x230d, 0x240d,
- 0x250d, 0x260d, 0x270d, 0x280d, 0x00c0, 0x00c8, 0x00d0, 0x00d8,
- 0x0049, 0x0041, 0x380d, 0x380d, 0x370d, 0x370d, 0x360d, 0x360d,
- 0x350d, 0x350d, 0x340d, 0x340d, 0x330d, 0x330d, 0x320d, 0x320d,
- 0x00e8, 0x00f0, 0x00f8, 0x0100, 0x310d, 0x310d, 0x2015, 0x2015,
- 0x3609, 0x3609, 0x3509, 0x3509, 0x3409, 0x3409, 0x3309, 0x3309,
- 0x3209, 0x3209, 0x3109, 0x3109, 0x0110, 0x0130, 0x0138, 0x0140,
- 0x0118, 0x0120, 0x0128, 0x100d, 0x3009, 0x3009, 0x2f09, 0x2f09,
- 0x2411, 0x2411, 0x2311, 0x2311, 0x2039, 0x2039, 0x2031, 0x2031,
- 0x0f0d, 0x0e0d, 0x0d0d, 0x0c0d, 0x0b0d, 0x0a0d, 0x090d, 0x0e09,
- 0x0d09, 0x0211, 0x0119, 0x0029, 0x0150, 0x0158, 0x0160, 0x0168,
- 0x280d, 0x280d, 0x270d, 0x270d, 0x260d, 0x260d, 0x250d, 0x250d,
- 0x2c09, 0x2c09, 0xb759, 0xb759, 0x2a09, 0x2a09, 0x2021, 0x2021,
- 0x040d, 0x030d, 0x0b35, 0x010d, 0x0909, 0x0809, 0x0709, 0x0609,
- 0x0111, 0x0019, 0x2509, 0x2509, 0x2409, 0x2409, 0x2309, 0x2309
-};
-
-
-const OMX_U16 armVCM4P2_IntraVlcL0L1[200] = {
- 0x0020, 0x0108, 0x0148, 0x0170, 0x0178, 0x0180, 0x0188, 0x0f09,
- 0x4009, 0x4009, 0x4009, 0x4009, 0x2011, 0x2011, 0x0109, 0x0019,
- 0x0028, 0x0060, 0x00b8, 0x00e0, 0x0030, 0x0048, 0x0050, 0x0058,
- 0x3fff, 0x3fff, 0x0038, 0x0040, 0x203d, 0x203d, 0x2035, 0x2035,
- 0x20b1, 0x20b1, 0x20a9, 0x20a9, 0x0215, 0x011d, 0x002d, 0x0d09,
- 0x0519, 0x0811, 0x0419, 0x0321, 0x0221, 0x0139, 0x00a1, 0x0099,
- 0x0068, 0x0090, 0x3fff, 0x3fff, 0x0070, 0x0078, 0x0080, 0x0088,
- 0x20b9, 0x20b9, 0x20c1, 0x20c1, 0x2141, 0x2141, 0x2911, 0x2911,
- 0x2315, 0x2315, 0x2415, 0x2415, 0x2f0d, 0x2f0d, 0x300d, 0x300d,
- 0x0098, 0x00a0, 0x00a8, 0x00b0, 0x00c9, 0x00d1, 0x00d9, 0x0149,
- 0x0619, 0x0151, 0x0229, 0x0719, 0x0e09, 0x0045, 0x0515, 0x0615,
- 0x110d, 0x120d, 0x130d, 0x140d, 0x00c0, 0x00c8, 0x00d0, 0x00d8,
- 0x0091, 0x0089, 0x2e0d, 0x2e0d, 0x2d0d, 0x2d0d, 0x2c0d, 0x2c0d,
- 0x2b0d, 0x2b0d, 0x2a0d, 0x2a0d, 0x2115, 0x2115, 0x2025, 0x2025,
- 0x00e8, 0x00f0, 0x00f8, 0x0100, 0x2c09, 0x2c09, 0x2b09, 0x2b09,
- 0x2711, 0x2711, 0x2611, 0x2611, 0x2511, 0x2511, 0x2319, 0x2319,
- 0x2219, 0x2219, 0x2131, 0x2131, 0x0110, 0x0130, 0x0138, 0x0140,
- 0x0118, 0x0120, 0x0128, 0x080d, 0x2129, 0x2129, 0x2081, 0x2081,
- 0x2411, 0x2411, 0x2079, 0x2079, 0x2071, 0x2071, 0x2069, 0x2069,
- 0x1bb5, 0x060d, 0x001d, 0xd3f9, 0x0909, 0x0809, 0x090d, 0x0311,
- 0x0121, 0x0061, 0x0059, 0x0051, 0x0150, 0x0158, 0x0160, 0x0168,
- 0x240d, 0x240d, 0x230d, 0x230d, 0x2609, 0x2609, 0x250d, 0x250d,
- 0x2709, 0x2709, 0x2211, 0x2211, 0x2119, 0x2119, 0x2049, 0x2049,
- 0x0015, 0x0509, 0x020d, 0x010d, 0x0409, 0x0309, 0x0041, 0x0039,
- 0x0111, 0x0031, 0x2209, 0x2209, 0x2029, 0x2029, 0x2021, 0x2021
-};
-
-const OMX_U16 armVCM4P2_aIntraDCLumaChromaIndex[64] = {
- 0x0020, 0x000b, 0x2009, 0x2009, 0x2007, 0x2007, 0x2001, 0x2001,
- 0x4005, 0x4005, 0x4005, 0x4005, 0x4003, 0x4003, 0x4003, 0x4003,
- 0x0028, 0x000f, 0x200d, 0x200d, 0x0030, 0x0013, 0x2011, 0x2011,
- 0x0038, 0x0017, 0x2015, 0x2015, 0x3fff, 0x3fff, 0x2019, 0x2019,
-
- 0x0020, 0x0009, 0x2007, 0x2007, 0x4005, 0x4005, 0x4005, 0x4005,
- 0x4003, 0x4003, 0x4003, 0x4003, 0x4001, 0x4001, 0x4001, 0x4001,
- 0x0028, 0x000d, 0x200b, 0x200b, 0x0030, 0x0011, 0x200f, 0x200f,
- 0x0038, 0x0015, 0x2013, 0x2013, 0x1fff, 0x0019, 0x2017, 0x2017
-};
-
-
-const OMX_U16 armVCM4P2_aVlcMVD[124] = {
- 0x0010, 0x00f0, 0x0043, 0x003f, 0x4041, 0x4041, 0x4041, 0x4041,
- 0x0018, 0x00d8, 0x0047, 0x003b, 0x0020, 0x0080, 0x00a8, 0x00d0,
- 0x0028, 0x0048, 0x0070, 0x0078, 0x1fff, 0x0030, 0x0038, 0x0040,
- 0x0081, 0x0001, 0x007f, 0x0003, 0x207d, 0x207d, 0x2005, 0x2005,
- 0x207b, 0x207b, 0x2007, 0x2007, 0x0050, 0x0058, 0x0060, 0x0068,
- 0x2079, 0x2079, 0x2009, 0x2009, 0x2077, 0x2077, 0x200b, 0x200b,
- 0x2075, 0x2075, 0x200d, 0x200d, 0x2073, 0x2073, 0x200f, 0x200f,
- 0x0071, 0x0011, 0x006f, 0x0013, 0x006d, 0x0015, 0x006b, 0x0017,
- 0x0088, 0x0090, 0x0098, 0x00a0, 0x0069, 0x0019, 0x0067, 0x001b,
- 0x0065, 0x001d, 0x0063, 0x001f, 0x0061, 0x0021, 0x005f, 0x0023,
- 0x005d, 0x0025, 0x005b, 0x0027, 0x00b0, 0x00b8, 0x00c0, 0x00c8,
- 0x0059, 0x0029, 0x0057, 0x002b, 0x2055, 0x2055, 0x202d, 0x202d,
- 0x2053, 0x2053, 0x202f, 0x202f, 0x2051, 0x2051, 0x2031, 0x2031,
- 0x204f, 0x204f, 0x2033, 0x2033, 0x00e0, 0x00e8, 0x0049, 0x0039,
- 0x204d, 0x204d, 0x2035, 0x2035, 0x204b, 0x204b, 0x2037, 0x2037,
- 0x2045, 0x2045, 0x203d, 0x203d
-};
-
-/* LMAX table for non Inter (Last == 0 and Last=1)
- Level - 1 Indexed
- padded armVCM4P2_InterL0L1LMAX[27-31] with zeros to acess entries for Last=1 effectively
-
-*/
-const OMX_U8 armVCM4P2_InterL0L1LMAX[73] =
-{
- 12, 6, 4, 3, 3, 3, 3, 2,
- 2, 2, 2, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 0, 0, 0, 0, 0,
- 3, 2, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1
-};
-
-/* RMAX table for non Inter (Last == 0 and Last=1)
- Level - 1 Indexed
- padded armVCM4P2_InterL0L1RMAX[12-31] with zeros to access entries for Last=1 table effectively */
-
-
-const OMX_U8 armVCM4P2_InterL0L1RMAX[35] =
-{
- 26, 10, 6, 2, 1, 1,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0, 40, 1, 0
-};
-
-/* LMAX table for non Intra (Last == 0 and Last=1)
- Level - 1 Indexed
- padded armVCM4P2_IntraL0L1LMAX[15-31] with zeros to acess entries for Last=1 effectively
-
-*/
-const OMX_U8 armVCM4P2_IntraL0L1LMAX[53] =
-{
- 27, 10, 5, 4, 3, 3, 3,
- 3, 2, 2, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-
- 8, 3, 2, 2, 2, 2, 2, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1
-};
-
-
-/* RMAX table for non Inter (Last == 0 and Last=1)
- Level - 1 Indexed
- padded armVCM4P2_IntraL0L1RMAX[27-31] with zeros to access entries for Last=1 table effectively */
-
-
-const OMX_U8 armVCM4P2_IntraL0L1RMAX[40] =
-{
- 14, 9, 7, 3, 2, 1, 1,
- 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,
-
- 20, 6, 1, 0, 0, 0, 0, 0
-
-};
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/armVCM4P2_Lookup_Tables.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/armVCM4P2_Lookup_Tables.c
deleted file mode 100644
index e915d3c..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/armVCM4P2_Lookup_Tables.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
- /**
- *
- * File Name: armVCM4P2_Lookup_Tables.c
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- * File: armVCM4P2_Lookup_Tables.c
- * Description: Contains all the Lookup tables used in MPEG4 codec
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-
- /* * Table Entries contain Dc Scaler values
- * armVCM4P2_DCScaler[i]= 8 for i=1 to 4 and i=33 to 36
- * = 2*i for i=5 to 8
- * = i+8 for i=9 to 25
- * = 2*i-16 for i=26 to 31
- * = (i-32+13)/2 for i=37 to 59
- * = i-6-32 for i=60 to 63
- * = 255 for i=0 and i=32
- */
-
-const OMX_U8 armVCM4P2_DCScaler[64]={
- 0xff, 0x8, 0x8, 0x8, 0x8, 0xa, 0xc, 0xe,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
- 0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e,
- 0xff, 0x8, 0x8, 0x8, 0x8, 0x9, 0x9, 0xa,
- 0xa, 0xb, 0xb, 0xc, 0xc, 0xd, 0xd, 0xe,
- 0xe, 0xf, 0xf, 0x10, 0x10, 0x11, 0x11, 0x12,
- 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
-
-};
-
-
- /* Table Entries Contain reciprocal of 1 to 63
- * armVCM4P2_Reciprocal_QP_S16[i]=round(32767/i)
- * armVCM4P2_Reciprocal_QP_S16[0]= 0
- */
-
-const OMX_S16 armVCM4P2_Reciprocal_QP_S16[64]={
- 0x0000,0x7fff,0x4000,0x2aaa,0x2000,0x1999,0x1555,0x1249,
- 0x1000,0x0e39,0x0ccd,0x0ba3,0x0aab,0x09d9,0x0925,0x0888,
- 0x0800,0x0787,0x071c,0x06bd,0x0666,0x0618,0x05d1,0x0591,
- 0x0555,0x051f,0x04ec,0x04be,0x0492,0x046a,0x0444,0x0421,
- 0x0400,0x03e1,0x03c4,0x03a8,0x038e,0x0376,0x035e,0x0348,
- 0x0333,0x031f,0x030c,0x02fa,0x02e9,0x02d8,0x02c8,0x02b9,
- 0x02ab,0x029d,0x028f,0x0282,0x0276,0x026a,0x025f,0x0254,
- 0x0249,0x023f,0x0235,0x022b,0x0222,0x0219,0x0211,0x0208
-
-};
-
- /* Table Entries Contain reciprocal of 1 to 63
- * armVCM4P2_Reciprocal_QP_S32[i]=round(131071/i)
- * armVCM4P2_Reciprocal_QP_S32[0]= 0
- */
-
-const OMX_S32 armVCM4P2_Reciprocal_QP_S32[64]={
- 0x00000000,0x0001ffff,0x00010000,0x0000aaaa, 0x00008000, 0x00006666, 0x00005555, 0x00004924,
- 0x00004000,0x000038e3,0x00003333,0x00002e8c, 0x00002aab, 0x00002762, 0x00002492, 0x00002222,
- 0x00002000,0x00001e1e,0x00001c72,0x00001af2, 0x0000199a, 0x00001861, 0x00001746, 0x00001643,
- 0x00001555,0x0000147b,0x000013b1,0x000012f6, 0x00001249, 0x000011a8, 0x00001111, 0x00001084,
- 0x00001000,0x00000f84,0x00000f0f,0x00000ea1, 0x00000e39, 0x00000dd6, 0x00000d79, 0x00000d21,
- 0x00000ccd,0x00000c7d,0x00000c31,0x00000be8, 0x00000ba3, 0x00000b61, 0x00000b21, 0x00000ae5,
- 0x00000aab,0x00000a73,0x00000a3d,0x00000a0a, 0x000009d9, 0x000009a9, 0x0000097b, 0x0000094f,
- 0x00000925,0x000008fb,0x000008d4,0x000008ae, 0x00000889, 0x00000865, 0x00000842, 0x00000820
-
-};
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/armVCM4P2_SetPredDir_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/armVCM4P2_SetPredDir_s.s
deleted file mode 100644
index bf3f363..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/armVCM4P2_SetPredDir_s.s
+++ /dev/null
@@ -1,118 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: armVCM4P2_SetPredDir_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
-; **
-; * Function: armVCM4P2_SetPredDir
-; *
-; * Description:
-; * Performs detecting the prediction direction
-; *
-; * Remarks:
-; *
-; * Parameters:
-; * [in] blockIndex block index indicating the component type and
-; * position as defined in subclause 6.1.3.8, of ISO/IEC
-; * 14496-2. Furthermore, indexes 6 to 9 indicate the
-; * alpha blocks spatially corresponding to luminance
-; * blocks 0 to 3 in the same macroblock.
-; * [in] pCoefBufRow pointer to the coefficient row buffer
-; * [in] pQpBuf pointer to the quantization parameter buffer
-; * [out]predQP quantization parameter of the predictor block
-; * [out]predDir indicates the prediction direction which takes one
-; * of the following values:
-; * OMX_VC_HORIZONTAL predict horizontally
-; * OMX_VC_VERTICAL predict vertically
-; *
-; * Return Value:
-; * Standard OMXResult result. See enumeration for possible result codes.
-; *
-; */
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
- INCLUDE omxVC_s.h
-
-
- M_VARIANTS ARM1136JS
-
-
- IF ARM1136JS
-
-;// Input Arguments
-BlockIndex RN 0
-pCoefBufRow RN 1
-pCoefBufCol RN 2
-predDir RN 3
-predQP RN 4
-pQpBuf RN 5
-
-;// Local Variables
-
-Return RN 0
-blockDCLeft RN 6
-blockDCTop RN 7
-blockDCTopLeft RN 8
-temp1 RN 9
-temp2 RN 14
-
- M_START armVCM4P2_SetPredDir,r9
-
- M_ARG ppredQP,4
- M_ARG ppQpBuf,4
-
- LDRH blockDCTopLeft,[pCoefBufRow,#-16]
- LDRH blockDCLeft,[pCoefBufCol]
-
- TEQ BlockIndex,#3
- LDREQH blockDCTop,[pCoefBufCol,#-16]
- LDRNEH blockDCTop,[pCoefBufRow]
-
- SUBS temp1,blockDCLeft,blockDCTopLeft
- RSBLT temp1,temp1,#0
- SUBS temp2,blockDCTopLeft,blockDCTop
- RSBLT temp2,temp2,#0
-
- M_LDR pQpBuf,ppQpBuf
- M_LDR predQP,ppredQP
- CMP temp1,temp2
- MOV temp2,#OMX_VC_VERTICAL
- LDRLTB temp1,[pQpBuf,#1]
- STRLT temp2,[predDir]
- STRLT temp1,[predQP]
- MOV temp2,#OMX_VC_HORIZONTAL
- LDRGEB temp1,[pQpBuf]
- STRGE temp2,[predDir]
- MOV Return,#OMX_Sts_NoErr
- STRGE temp1,[predQP]
-
-
-
- M_END
-
- ENDIF
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/armVCM4P2_Zigzag_Tables.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/armVCM4P2_Zigzag_Tables.c
deleted file mode 100644
index 719b434..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/armVCM4P2_Zigzag_Tables.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_Zigzag_Tables.c
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- * File: armVCM4P2_ZigZag_Tables.c
- * Description: Contains the zigzag tables
- *
- */
-
-#include "omxtypes.h"
-
-/* Contains Double the values in the reference Zigzag Table
- * Contains Classical,Vetical and Horizontal Zigzagscan tables in one array
- */
-
-const OMX_U8 armVCM4P2_aClassicalZigzagScan [192] =
-{
- 0, 2, 16, 32, 18, 4, 6, 20,
- 34, 48, 64, 50, 36, 22, 8, 10,
- 24, 38, 52, 66, 80, 96, 82, 68,
- 54, 40, 26, 12, 14, 28, 42, 56,
- 70, 84, 98, 112, 114, 100, 86, 72,
- 58, 44, 30, 46, 60, 74, 88, 102,
- 116, 118, 104, 90, 76, 62, 78, 92,
- 106, 120, 122, 104, 94, 110, 124, 126,
-
- 0, 16, 32, 48, 2, 18, 4, 20,
- 34, 50, 64, 80, 96, 112, 114, 98,
- 82, 66, 52, 36, 6, 22, 8, 24,
- 38, 54, 68, 84, 100, 116, 70, 86,
- 102, 118, 40, 56, 10, 26, 12, 28,
- 42, 58, 72, 88, 104, 120, 74, 90,
- 106, 122, 44, 60, 14, 30, 46, 62,
- 76, 92, 108, 124, 78, 94, 110, 126,
-
- 0, 2, 4, 6, 16, 18, 32, 34,
- 20, 22, 8, 10, 12, 14, 30, 28,
- 26, 24, 38, 36, 48, 50, 64, 66,
- 52, 54, 40, 42, 44, 46, 56, 58,
- 60, 62, 68, 70, 80, 82, 96, 98,
- 84, 86, 72, 74, 76, 78, 88, 90,
- 92, 94, 100, 102, 112, 114, 116, 118,
- 104, 106, 108, 110, 120, 122, 124, 126
-
-
-};
-
-
-
-
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Inter.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Inter.c
deleted file mode 100644
index 95346ad..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Inter.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_DecodeBlockCoef_Inter.c
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for inter reconstruction
- *
- */
-
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-
-
-/**
- * Function: omxVCM4P2_DecodeBlockCoef_Inter
- *
- * Description:
- * Decodes the INTER block coefficients. Inverse quantization, inversely zigzag
- * positioning and IDCT, with appropriate clipping on each step, are performed
- * on the coefficients. The results (residuals) are placed in a contiguous array
- * of 64 elements. For INTER block, the output buffer holds the residuals for
- * further reconstruction.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bit stream buffer. There is no boundary
- * check for the bit stream buffer.
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * to by *ppBitStream. *pBitOffset is valid within
- * [0-7]
- * [in] QP quantization parameter
- * [in] shortVideoHeader a flag indicating presence of short_video_header;
- * shortVideoHeader==1 indicates using quantization method defined in short
- * video header mode, and shortVideoHeader==0 indicates normail quantization method.
- * [out] ppBitStream *ppBitStream is updated after the block is decoded, so that it points to the
- * current byte in the bit stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the current bit position in the
- * byte pointed by *ppBitStream
- * [out] pDst pointer to the decoded residual buffer (a contiguous array of 64 elements of
- * OMX_S16 data type). Must be 16-byte aligned.
- *
- * Return Value:
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - At least one of the following pointers is Null: ppBitStream, *ppBitStream, pBitOffset , pDst
- * - At least one of the below case:
- * - *pBitOffset exceeds [0,7], QP <= 0;
- * - pDst not 16-byte aligned
- * OMX_Sts_Err - status error
- *
- */
-OMXResult omxVCM4P2_DecodeBlockCoef_Inter(
- const OMX_U8 ** ppBitStream,
- OMX_INT * pBitOffset,
- OMX_S16 * pDst,
- OMX_INT QP,
- OMX_INT shortVideoHeader
-)
-{
- /* 64 elements are needed but to align it to 16 bytes need
- 15 more elements of padding */
- OMX_S16 tempBuf[79];
- OMX_S16 *pTempBuf1;
- OMXResult errorCode;
- /* Aligning the local buffers */
- pTempBuf1 = armAlignTo16Bytes(tempBuf);
-
-
- /* VLD and zigzag */
- errorCode = omxVCM4P2_DecodeVLCZigzag_Inter(ppBitStream, pBitOffset,
- pTempBuf1,shortVideoHeader);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- /* Dequantization */
- errorCode = omxVCM4P2_QuantInvInter_I(
- pTempBuf1,
- QP);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- /* Inverse transform */
- errorCode = omxVCM4P2_IDCT8x8blk(pTempBuf1, pDst);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Intra.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Intra.c
deleted file mode 100644
index 91ec5d2..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Intra.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_DecodeBlockCoef_Intra.c
- * OpenMAX DL: v1.0.2
- * Revision: 12290
- * Date: Wednesday, April 9, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for intra reconstruction
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/* Function for saturating 16 bit values to the [0,255] range and */
-/* writing out as 8 bit values. Does 64 entries */
-void armVCM4P2_Clip8(OMX_S16 *pSrc, OMX_U8 *pDst, OMX_INT dstStep );
-
-
-
-/**
- * Function: omxVCM4P2_DecodeBlockCoef_Intra
- *
- * Description:
- * Decodes the INTRA block coefficients. Inverse quantization, inversely zigzag
- * positioning, and IDCT, with appropriate clipping on each step, are performed
- * on the coefficients. The results are then placed in the output frame/plane on
- * a pixel basis. For INTRA block, the output values are clipped to [0, 255] and
- * written to corresponding block buffer within the destination plane.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bit stream buffer. There is no boundary
- * check for the bit stream buffer.
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * to by *ppBitStream. *pBitOffset is valid within
- * [0-7].
- * [in] step width of the destination plane
- * [in/out] pCoefBufRow [in] pointer to the coefficient row buffer
- * [out] updated coefficient rwo buffer
- * [in/out] pCoefBufCol [in] pointer to the coefficient column buffer
- * [out] updated coefficient column buffer
- * [in] curQP quantization parameter of the macroblock which
- * the current block belongs to
- * [in] pQpBuf Pointer to a 2-element QP array. pQpBuf[0] holds the QP of the 8x8 block left to
- * the current block(QPa). pQpBuf[1] holds the QP of the 8x8 block just above the
- * current block(QPc).
- * Note, in case the corresponding block is out of VOP bound, the QP value will have
- * no effect to the intra-prediction process. Refer to subclause "7.4.3.3 Adaptive
- * ac coefficient prediction" of ISO/IEC 14496-2(MPEG4 Part2) for accurate description.
- * [in] blockIndex block index indicating the component type and
- * position as defined in subclause 6.1.3.8,
- * Figure 6-5 of ISO/IEC 14496-2.
- * [in] intraDCVLC a code determined by intra_dc_vlc_thr and QP.
- * This allows a mechanism to switch between two VLC
- * for coding of Intra DC coefficients as per Table
- * 6-21 of ISO/IEC 14496-2.
- * [in] ACPredFlag a flag equal to ac_pred_flag (of luminance) indicating
- * if the ac coefficients of the first row or first
- * column are differentially coded for intra coded
- * macroblock.
- * [in] shortVideoHeader a flag indicating presence of short_video_header;
- * shortVideoHeader==1 selects linear intra DC mode,
- * and shortVideoHeader==0 selects nonlinear intra DC mode.
- * [out] ppBitStream *ppBitStream is updated after the block is
- * decoded, so that it points to the current byte
- * in the bit stream buffer
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream
- * [out] pDst pointer to the block in the destination plane.
- * pDst should be 16-byte aligned.
- * [out] pCoefBufRow pointer to the updated coefficient row buffer.
- *
- * Return Value:
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - At least one of the following pointers is NULL: ppBitStream, *ppBitStream, pBitOffset,
- * pCoefBufRow, pCoefBufCol, pQPBuf, pDst.
- * or
- * - At least one of the below case: *pBitOffset exceeds [0,7], curQP exceeds (1, 31),
- * blockIndex exceeds [0,9], step is not the multiple of 8, intraDCVLC is zero while
- * blockIndex greater than 5.
- * or
- * - pDst is not 16-byte aligned
- * OMX_Sts_Err - status error
- *
- */
-
-OMXResult omxVCM4P2_DecodeBlockCoef_Intra(
- const OMX_U8 ** ppBitStream,
- OMX_INT *pBitOffset,
- OMX_U8 *pDst,
- OMX_INT step,
- OMX_S16 *pCoefBufRow,
- OMX_S16 *pCoefBufCol,
- OMX_U8 curQP,
- const OMX_U8 *pQPBuf,
- OMX_INT blockIndex,
- OMX_INT intraDCVLC,
- OMX_INT ACPredFlag,
- OMX_INT shortVideoHeader
- )
-{
- OMX_S16 tempBuf1[79], tempBuf2[79];
- OMX_S16 *pTempBuf1, *pTempBuf2;
- OMX_INT predDir, predACDir;
- OMX_INT predQP;
- OMXVCM4P2VideoComponent videoComp;
- OMXResult errorCode;
-
-
- /* Aligning the local buffers */
- pTempBuf1 = armAlignTo16Bytes(tempBuf1);
- pTempBuf2 = armAlignTo16Bytes(tempBuf2);
-
- /* Setting the AC prediction direction and prediction direction */
- armVCM4P2_SetPredDir(
- blockIndex,
- pCoefBufRow,
- pCoefBufCol,
- &predDir,
- &predQP,
- pQPBuf);
-
- predACDir = predDir;
-
-
- if (ACPredFlag == 0)
- {
- predACDir = OMX_VC_NONE;
- }
-
- /* Setting the videoComp */
- if (blockIndex <= 3)
- {
- videoComp = OMX_VC_LUMINANCE;
- }
- else
- {
- videoComp = OMX_VC_CHROMINANCE;
- }
-
-
- /* VLD and zigzag */
- if (intraDCVLC == 1)
- {
- errorCode = omxVCM4P2_DecodeVLCZigzag_IntraDCVLC(
- ppBitStream,
- pBitOffset,
- pTempBuf1,
- predACDir,
- shortVideoHeader,
- videoComp);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
- }
- else
- {
- errorCode = omxVCM4P2_DecodeVLCZigzag_IntraACVLC(
- ppBitStream,
- pBitOffset,
- pTempBuf1,
- predACDir,
- shortVideoHeader);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
- }
-
- /* AC DC prediction */
- errorCode = omxVCM4P2_PredictReconCoefIntra(
- pTempBuf1,
- pCoefBufRow,
- pCoefBufCol,
- curQP,
- predQP,
- predDir,
- ACPredFlag,
- videoComp);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- /* Dequantization */
- errorCode = omxVCM4P2_QuantInvIntra_I(
- pTempBuf1,
- curQP,
- videoComp,
- shortVideoHeader);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- /* Inverse transform */
- errorCode = omxVCM4P2_IDCT8x8blk (pTempBuf1, pTempBuf2);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- /* Placing the linear array into the destination plane and clipping
- it to 0 to 255 */
-
- armVCM4P2_Clip8(pTempBuf2,pDst,step);
-
-
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_DecodePadMV_PVOP_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_DecodePadMV_PVOP_s.s
deleted file mode 100644
index 08e9538..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_DecodePadMV_PVOP_s.s
+++ /dev/null
@@ -1,378 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-; **********
-; *
-; * File Name: omxVCM4P2_DecodePadMV_PVOP_s.s
-; * OpenMAX DL: v1.0.2
-; * Revision: 12290
-; * Date: Wednesday, April 9, 2008
-; *
-; *
-; *
-; *
-; **
-; * Function: omxVCM4P2_DecodePadMV_PVOP
-; *
-; * Description:
-; * Decodes and pads four motion vectors of the non-intra macroblock in P-VOP.
-; * The motion vector padding process is specified in subclause 7.6.1.6 of
-; * ISO/IEC 14496-2.
-; *
-; * Remarks:
-; *
-; *
-; * Parameters:
-; * [in] ppBitStream pointer to the pointer to the current byte in
-; * the bit stream buffer
-; * [in] pBitOffset pointer to the bit position in the byte pointed
-; * to by *ppBitStream. *pBitOffset is valid within
-; * [0-7].
-; * [in] pSrcMVLeftMB pointers to the motion vector buffers of the
-; * macroblocks specially at the left side of the current macroblock
-; * respectively.
-; * [in] pSrcMVUpperMB pointers to the motion vector buffers of the
-; * macroblocks specially at the upper side of the current macroblock
-; * respectively.
-; * [in] pSrcMVUpperRightMB pointers to the motion vector buffers of the
-; * macroblocks specially at the upper-right side of the current macroblock
-; * respectively.
-; * [in] fcodeForward a code equal to vop_fcode_forward in MPEG-4
-; * bit stream syntax
-; * [in] MBType the type of the current macroblock. If MBType
-; * is not equal to OMX_VC_INTER4V, the destination
-; * motion vector buffer is still filled with the
-; * same decoded vector.
-; * [out] ppBitStream *ppBitStream is updated after the block is decoded,
-; * so that it points to the current byte in the bit
-; * stream buffer
-; * [out] pBitOffset *pBitOffset is updated so that it points to the
-; * current bit position in the byte pointed by
-; * *ppBitStream
-; * [out] pDstMVCurMB pointer to the motion vector buffer of the current
-; * macroblock which contains four decoded motion vectors
-; *
-; * Return Value:
-; * OMX_Sts_NoErr -no error
-; *
-; *
-; * OMX_Sts_Err - status error
-; *
-; *
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
- INCLUDE armCOMM_BitDec_s.h
- INCLUDE omxVC_s.h
-
- M_VARIANTS ARM1136JS
-
-
-
-
- IF ARM1136JS
-
-;//Input Arguments
-
-ppBitStream RN 0
-pBitOffset RN 1
-pSrcMVLeftMB RN 2
-pSrcMVUpperMB RN 3
-pSrcMVUpperRightMB RN 4
-pDstMVCurMB RN 5
-fcodeForward RN 6
-MBType RN 7
-
-;//Local Variables
-
-zero RN 4
-one RN 4
-scaleFactor RN 1
-
-
-Return RN 0
-
-VlcMVD RN 0
-index RN 4
-Count RN 7
-
-mvHorData RN 4
-mvHorResidual RN 0
-
-mvVerData RN 4
-mvVerResidual RN 0
-
-temp RN 1
-
-temp1 RN 3
-High RN 4
-Low RN 2
-Range RN 1
-
-BlkCount RN 14
-
-diffMVdx RN 0
-diffMVdy RN 1
-
-;// Scratch Registers
-
-RBitStream RN 8
-RBitCount RN 9
-RBitBuffer RN 10
-
-T1 RN 11
-T2 RN 12
-LR RN 14
-
- IMPORT armVCM4P2_aVlcMVD
- IMPORT omxVCM4P2_FindMVpred
-
- ;// Allocate stack memory
-
- M_ALLOC4 ppDstMVCurMB,4
- M_ALLOC4 pDstMVPredME,4
- M_ALLOC4 pBlkCount,4
-
- M_ALLOC4 pppBitStream,4
- M_ALLOC4 ppBitOffset,4
- M_ALLOC4 ppSrcMVLeftMB,4
- M_ALLOC4 ppSrcMVUpperMB,4
-
- M_ALLOC4 pdiffMVdx,4
- M_ALLOC4 pdiffMVdy,4
- M_ALLOC4 pHigh,4
-
-
-
-
- M_START omxVCM4P2_DecodePadMV_PVOP,r11
-
- M_ARG pSrcMVUpperRightMBonStack,4 ;// pointer to pSrcMVUpperRightMB on stack
- M_ARG pDstMVCurMBonStack,4 ;// pointer to pDstMVCurMB on stack
- M_ARG fcodeForwardonStack,4 ;// pointer to fcodeForward on stack
- M_ARG MBTypeonStack,4 ;// pointer to MBType on stack
-
-
-
-
-
- ;// Initializing the BitStream Macro
-
- M_BD_INIT0 ppBitStream, pBitOffset, RBitStream, RBitBuffer, RBitCount
- M_LDR MBType,MBTypeonStack ;// Load MBType from stack
- M_LDR pDstMVCurMB,pDstMVCurMBonStack ;// Load pDstMVCurMB from stack
- MOV zero,#0
-
- TEQ MBType,#OMX_VC_INTRA ;// Check if MBType=OMX_VC_INTRA
- TEQNE MBType,#OMX_VC_INTRA_Q ;// check if MBType=OMX_VC_INTRA_Q
- STREQ zero,[pDstMVCurMB]
- M_BD_INIT1 T1, T2, T2
- STREQ zero,[pDstMVCurMB,#4]
- M_BD_INIT2 T1, T2, T2
- STREQ zero,[pDstMVCurMB,#4]
- MOVEQ Return,#OMX_Sts_NoErr
- MOV BlkCount,#0
- STREQ zero,[pDstMVCurMB,#4]
-
- BEQ ExitOK
-
- TEQ MBType,#OMX_VC_INTER4V ;// Check if MBType=OMX_VC_INTER4V
- TEQNE MBType,#OMX_VC_INTER4V_Q ;// Check if MBType=OMX_VC_INTER4V_Q
- MOVEQ Count,#4
-
- TEQ MBType,#OMX_VC_INTER ;// Check if MBType=OMX_VC_INTER
- TEQNE MBType,#OMX_VC_INTER_Q ;// Check if MBType=OMX_VC_INTER_Q
- MOVEQ Count,#1
-
- M_LDR fcodeForward,fcodeForwardonStack ;// Load fcodeForward from stack
-
- ;// Storing the values temporarily on stack
-
- M_STR ppBitStream,pppBitStream
- M_STR pBitOffset,ppBitOffset
-
-
- SUB temp,fcodeForward,#1 ;// temp=fcodeForward-1
- MOV one,#1
- M_STR pSrcMVLeftMB,ppSrcMVLeftMB
- LSL scaleFactor,one,temp ;// scaleFactor=1<<(fcodeForward-1)
- M_STR pSrcMVUpperMB,ppSrcMVUpperMB
- LSL scaleFactor,scaleFactor,#5
- M_STR scaleFactor,pHigh ;// [pHigh]=32*scaleFactor
-
- ;// VLD Decoding
-
-
-Loop
-
- LDR VlcMVD, =armVCM4P2_aVlcMVD ;// Load the optimized MVD VLC table
-
- ;// Horizontal Data and Residual calculation
-
- LDR temp,=0xFFF
- M_BD_VLD index,T1,T2,VlcMVD,3,2 ;// variable lenght decoding using the macro
-
- TEQ index,temp
- BEQ ExitError ;// Exit with an Error Message if the decoded symbol is an invalied symbol
-
- SUB mvHorData,index,#32 ;// mvHorData=index-32
- MOV mvHorResidual,#1 ;// mvHorResidual=1
- CMP fcodeForward,#1
- TEQNE mvHorData,#0
- MOVEQ diffMVdx,mvHorData ;// if scaleFactor=1(fcodeForward=1) or mvHorData=0 diffMVdx=mvHorData
- BEQ VerticalData
-
- SUB temp,fcodeForward,#1
- M_BD_VREAD8 mvHorResidual,temp,T1,T2 ;// get mvHorResidual from bitstream if fcodeForward>1 and mvHorData!=0
-
- CMP mvHorData,#0
- RSBLT mvHorData,mvHorData,#0 ;// mvHorData=abs(mvHorData)
- SUB mvHorResidual,mvHorResidual,fcodeForward
- SMLABB diffMVdx,mvHorData,fcodeForward,mvHorResidual ;// diffMVdx=abs(mvHorData)*fcodeForward+mvHorResidual-fcodeForward
- ADD diffMVdx,diffMVdx,#1
- RSBLT diffMVdx,diffMVdx,#0
-
- ;// Vertical Data and Residual calculation
-
-VerticalData
-
- M_STR diffMVdx,pdiffMVdx ;// Store the diffMVdx on stack
- LDR VlcMVD, =armVCM4P2_aVlcMVD ;// Loading the address of optimized VLC tables
-
- LDR temp,=0xFFF
- M_BD_VLD index,T1,T2,VlcMVD,3,2 ;// VLC decoding using the macro
-
- TEQ index,temp
- BEQ ExitError ;// Exit with an Error Message if an Invalied Symbol occurs
-
- SUB mvVerData,index,#32 ;// mvVerData=index-32
- MOV mvVerResidual,#1
- CMP fcodeForward,#1
- TEQNE mvVerData,#0
- MOVEQ diffMVdy,mvVerData ;// diffMVdy = mvVerData if scaleFactor=1(fcodeForward=1) or mvVerData=0
- BEQ FindMVPred
-
- SUB temp,fcodeForward,#1
- M_BD_VREAD8 mvVerResidual,temp,T1,T2 ;// Get mvVerResidual from bit stream if fcodeForward>1 and mnVerData!=0
-
-
- CMP mvVerData,#0
- RSBLT mvVerData,mvVerData,#0
- SUB mvVerResidual,mvVerResidual,fcodeForward
- SMLABB diffMVdy,mvVerData,fcodeForward,mvVerResidual ;// diffMVdy=abs(mvVerData)*fcodeForward+mvVerResidual-fcodeForward
- ADD diffMVdy,diffMVdy,#1
- RSBLT diffMVdy,diffMVdy,#0
-
- ;//Calling the Function omxVCM4P2_FindMVpred
-
-FindMVPred
-
- M_STR diffMVdy,pdiffMVdy
- ADD temp,pDstMVCurMB,BlkCount,LSL #2 ;// temp=pDstMVCurMB[BlkCount]
- M_STR temp,ppDstMVCurMB ;// store temp on stack for passing as an argument to FindMVPred
-
- MOV temp,#0
- M_STR temp,pDstMVPredME ;// Pass pDstMVPredME=NULL as an argument
- M_STR BlkCount,pBlkCount ;// Passs BlkCount as Argument through stack
-
- MOV temp,pSrcMVLeftMB ;// temp (RN 1)=pSrcMVLeftMB
- M_LDR pSrcMVUpperRightMB,pSrcMVUpperRightMBonStack
- MOV pSrcMVLeftMB,pSrcMVUpperMB ;// pSrcMVLeftMB ( RN 2) = pSrcMVUpperMB
- MOV ppBitStream,pDstMVCurMB ;// ppBitStream ( RN 0) = pDstMVCurMB
- MOV pSrcMVUpperMB,pSrcMVUpperRightMB ;// pSrcMVUpperMB( RN 3) = pSrcMVUpperRightMB
- BL omxVCM4P2_FindMVpred ;// Branch to subroutine omxVCM4P2_FindMVpred
-
- ;// Store Horizontal Motion Vector
-
- M_LDR BlkCount,pBlkCount ;// Load BlkCount from stack
- M_LDR High,pHigh ;// High=32*scaleFactor
- LSL temp1,BlkCount,#2 ;// temp=BlkCount*4
- M_LDR diffMVdx,pdiffMVdx ;// Laad diffMVdx
-
- LDRSH temp,[pDstMVCurMB,temp1] ;// temp=pDstMVCurMB[BlkCount]
-
-
- RSB Low,High,#0 ;// Low = -32*scaleFactor
- ADD diffMVdx,temp,diffMVdx ;// diffMVdx=pDstMVCurMB[BlkCount]+diffMVdx
- ADD Range,High,High ;// Range=64*ScaleFactor
- SUB High,High,#1 ;// High= 32*scaleFactor-1
-
- CMP diffMVdx,Low ;// If diffMVdx<Low
- ADDLT diffMVdx,diffMVdx,Range ;// diffMVdx+=Range
-
- CMP diffMVdx,High
- SUBGT diffMVdx,diffMVdx,Range ;// If diffMVdx > High diffMVdx-=Range
- STRH diffMVdx,[pDstMVCurMB,temp1]
-
- ;// Store Vertical
-
- ADD temp1,temp1,#2 ;// temp1=4*BlkCount+2
- M_LDR diffMVdx,pdiffMVdy ;// Laad diffMVdy
- LDRSH temp,[pDstMVCurMB,temp1] ;// temp=pDstMVCurMB[BlkCount].diffMVdy
- ADD BlkCount,BlkCount,#1 ;// BlkCount=BlkCount+1
- ADD diffMVdx,temp,diffMVdx
- CMP diffMVdx,Low
- ADDLT diffMVdx,diffMVdx,Range ;// If diffMVdy<Low diffMVdy+=Range
- CMP diffMVdx,High
- SUBGT diffMVdx,diffMVdx,Range ;// If diffMVdy > High diffMVdy-=Range
- STRH diffMVdx,[pDstMVCurMB,temp1]
-
- CMP BlkCount,Count
- M_LDR pSrcMVLeftMB,ppSrcMVLeftMB
- M_LDR pSrcMVUpperMB,ppSrcMVUpperMB
-
- BLT Loop ;// If BlkCount<Count Continue the Loop
-
-
- ;// If MBType=OMX_VC_INTER or MBtype=OMX_VC_INTER_Q copy pDstMVCurMB[0] to
- ;// pDstMVCurMB[1], pDstMVCurMB[2], pDstMVCurMB[3]
-
- M_LDR MBType,MBTypeonStack
-
- TEQ MBType,#OMX_VC_INTER
- TEQNE MBType,#OMX_VC_INTER_Q
- LDREQ temp,[pDstMVCurMB]
- M_LDR ppBitStream,pppBitStream
- STREQ temp,[pDstMVCurMB,#4]
-
- STREQ temp,[pDstMVCurMB,#8]
- STREQ temp,[pDstMVCurMB,#12]
-
-
- M_LDR pBitOffset,ppBitOffset
- ;//Ending the macro
- M_BD_FINI ppBitStream,pBitOffset ;// Finishing the Macro
-
-
- MOV Return,#OMX_Sts_NoErr
- B ExitOK
-
-ExitError
-
- M_LDR ppBitStream,pppBitStream
- M_LDR pBitOffset,ppBitOffset
- ;//Ending the macro
- M_BD_FINI ppBitStream,pBitOffset
-
- MOV Return,#OMX_Sts_Err
-
-ExitOK
-
- M_END
- ENDIF
- END
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_Inter_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_Inter_s.s
deleted file mode 100644
index 636dfe4..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_Inter_s.s
+++ /dev/null
@@ -1,146 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;/**
-; *
-; * File Name: omxVCM4P2_DecodeVLCZigzag_Inter_s.s
-; * OpenMAX DL: v1.0.2
-; * Revision: 12290
-; * Date: Wednesday, April 9, 2008
-; *
-; *
-; *
-; *
-; * Description:
-; * Contains modules for zigzag scanning and VLC decoding
-; * for inter block.
-; *
-; *
-; *
-; * Function: omxVCM4P2_DecodeVLCZigzag_Inter
-; *
-; * Description:
-; * Performs VLC decoding and inverse zigzag scan for one inter coded block.
-; *
-; * Remarks:
-; *
-; * Parameters:
-; * [in] ppBitStream pointer to the pointer to the current byte in
-; * the bitstream buffer
-; * [in] pBitOffset pointer to the bit position in the byte pointed
-; * to by *ppBitStream. *pBitOffset is valid within [0-7].
-; * [in] shortVideoHeader binary flag indicating presence of short_video_header;
-; * escape modes 0-3 are used if shortVideoHeader==0,
-; * and escape mode 4 is used when shortVideoHeader==1.
-; * [out] ppBitStream *ppBitStream is updated after the block is
-; * decoded, so that it points to the current byte
-; * in the bit stream buffer
-; * [out] pBitOffset *pBitOffset is updated so that it points to the
-; * current bit position in the byte pointed by
-; * *ppBitStream
-; * [out] pDst pointer to the coefficient buffer of current
-; * block. Must be 16-byte aligned
-; *
-; * Return Value:
-; * OMX_Sts_BadArgErr - bad arguments
-; * -At least one of the following pointers is NULL: ppBitStream, *ppBitStream, pBitOffset, pDst, or
-; * -pDst is not 16-byte aligned, or
-; * -*pBitOffset exceeds [0,7].
-; * OMX_Sts_Err - status error
-; * -At least one mark bit is equal to zero
-; * -Encountered an illegal stream code that cannot be found in the VLC table
-; * -Encountered and illegal code in the VLC FLC table
-; * -The number of coefficients is greater than 64
-; *
-; */
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
- INCLUDE armCOMM_BitDec_s.h
-
-
- M_VARIANTS ARM1136JS
-
-
-
-
-
- IF ARM1136JS
-
- ;// Import various tables needed for the function
-
-
- IMPORT armVCM4P2_InterVlcL0L1 ;// Contains optimized and packed VLC Tables for both Last =1 and last=0
- ;// Packed in Run:Level:Last format
- IMPORT armVCM4P2_InterL0L1LMAX ;// Contains LMAX table entries with both Last=0 and Last=1
- IMPORT armVCM4P2_InterL0L1RMAX ;// Contains RMAX table entries with both Last=0 and Last=1
- IMPORT armVCM4P2_aClassicalZigzagScan ;// contains classical Zigzag table entries with double the original values
- IMPORT armVCM4P2_DecodeVLCZigzag_AC_unsafe
-
-
-
-;//Input Arguments
-
-ppBitStream RN 0
-pBitOffset RN 1
-pDst RN 2
-shortVideoHeader RN 3
-
-;//Local Variables
-
-Return RN 0
-
-pVlcTableL0L1 RN 4
-pLMAXTableL0L1 RN 4
-pRMAXTableL0L1 RN 4
-pZigzagTable RN 4
-Count RN 6
-
-
-
- ;// Allocate stack memory to store the VLC,Zigzag,LMAX and RMAX tables
-
-
- M_ALLOC4 ppVlcTableL0L1,4
- M_ALLOC4 ppLMAXTableL0L1,4
- M_ALLOC4 ppRMAXTableL0L1,4
- M_ALLOC4 ppZigzagTable,4
-
-
- M_START omxVCM4P2_DecodeVLCZigzag_Inter,r12
-
-
-
-
- LDR pZigzagTable, =armVCM4P2_aClassicalZigzagScan ;// Load zigzag table
- M_STR pZigzagTable,ppZigzagTable ;// Store zigzag table on stack to pass as argument to unsafe function
- LDR pVlcTableL0L1, =armVCM4P2_InterVlcL0L1 ;// Load optimized VLC table with both L=0 and L=1 entries
- M_STR pVlcTableL0L1,ppVlcTableL0L1 ;// Store optimized VLC table address on stack
- LDR pLMAXTableL0L1, =armVCM4P2_InterL0L1LMAX ;// Load Interleaved L=0 and L=1 LMAX Tables
- M_STR pLMAXTableL0L1,ppLMAXTableL0L1 ;// Store LMAX table address on stack
- LDR pRMAXTableL0L1, =armVCM4P2_InterL0L1RMAX ;// Load Interleaved L=0 and L=1 RMAX Tables
- MOV Count,#0 ;// set start=0
- M_STR pRMAXTableL0L1,ppRMAXTableL0L1 ;// store RMAX table address on stack
-
-
- BL armVCM4P2_DecodeVLCZigzag_AC_unsafe ;// call Unsafe Function for VLC Zigzag Decoding
-
-
-
- M_END
- ENDIF
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraACVLC_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraACVLC_s.s
deleted file mode 100644
index 15cc5b4..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraACVLC_s.s
+++ /dev/null
@@ -1,150 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;/**
-; *
-; * File Name: omxVCM4P2_DecodeVLCZigzag_IntraACVLC_s.s
-; * OpenMAX DL: v1.0.2
-; * Revision: 12290
-; * Date: Wednesday, April 9, 2008
-; *
-; *
-; *
-; *
-; * Description:
-; * Contains modules for zigzag scanning and VLC decoding
-; * for inter block.
-; *
-; *
-; *
-; * Function: omxVCM4P2_DecodeVLCZigzag_Inter
-; *
-; * Description:
-; * Performs VLC decoding and inverse zigzag scan for one intra coded block.
-; *
-; * Remarks:
-; *
-; * Parameters:
-; * [in] ppBitStream pointer to the pointer to the current byte in
-; * the bitstream buffer
-; * [in] pBitOffset pointer to the bit position in the byte pointed
-; * to by *ppBitStream. *pBitOffset is valid within [0-7].
-; * [in] shortVideoHeader binary flag indicating presence of short_video_header;
-; * escape modes 0-3 are used if shortVideoHeader==0,
-; * and escape mode 4 is used when shortVideoHeader==1.
-; * [out] ppBitStream *ppBitStream is updated after the block is
-; * decoded, so that it points to the current byte
-; * in the bit stream buffer
-; * [out] pBitOffset *pBitOffset is updated so that it points to the
-; * current bit position in the byte pointed by
-; * *ppBitStream
-; * [out] pDst pointer to the coefficient buffer of current
-; * block. Must be 16-byte aligned
-; *
-; * Return Value:
-; * OMX_Sts_BadArgErr - bad arguments
-; * -At least one of the following pointers is NULL: ppBitStream, *ppBitStream, pBitOffset, pDst, or
-; * -pDst is not 16-byte aligned, or
-; * -*pBitOffset exceeds [0,7].
-; * OMX_Sts_Err - status error
-; * -At least one mark bit is equal to zero
-; * -Encountered an illegal stream code that cannot be found in the VLC table
-; * -Encountered and illegal code in the VLC FLC table
-; * -The number of coefficients is greater than 64
-; *
-; */
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
- INCLUDE armCOMM_BitDec_s.h
-
-
- M_VARIANTS ARM1136JS
-
-
-
-
-
- IF ARM1136JS
-
- ;// Import various tables needed for the function
-
-
- IMPORT armVCM4P2_IntraVlcL0L1 ;// Contains optimized and packed VLC Tables for both Last =1 and last=0
- ;// Packed in Run:Level:Last format
- IMPORT armVCM4P2_IntraL0L1LMAX ;// Contains LMAX table entries with both Last=0 and Last=1
- IMPORT armVCM4P2_IntraL0L1RMAX ;// Contains RMAX table entries with both Last=0 and Last=1
- IMPORT armVCM4P2_aClassicalZigzagScan ;// contains classical Zigzag table entries with double the original values
- IMPORT armVCM4P2_DecodeVLCZigzag_AC_unsafe
-
-;//Input Arguments
-
-ppBitStream RN 0
-pBitOffset RN 1
-pDst RN 2
-PredDir RN 3
-shortVideoHeader RN 3
-
-;//Local Variables
-
-Return RN 0
-
-pVlcTableL0L1 RN 4
-pLMAXTableL0L1 RN 4
-pRMAXTableL0L1 RN 4
-pZigzagTable RN 4
-Count RN 6
-
-
-
- ;// Allocate stack memory to store optimized VLC,Zigzag, RMAX, LMAX Table Addresses
-
- M_ALLOC4 ppVlcTableL0L1,4
- M_ALLOC4 ppLMAXTableL0L1,4
- M_ALLOC4 ppRMAXTableL0L1,4
- M_ALLOC4 ppZigzagTable,4
-
-
- M_START omxVCM4P2_DecodeVLCZigzag_IntraACVLC,r12
-
- M_ARG shortVideoHeaderonStack,4 ;// pointer to Input Argument on stack
-
- LDR pZigzagTable, =armVCM4P2_aClassicalZigzagScan ;// Load Address of the Zigzag table
- ADD pZigzagTable, pZigzagTable, PredDir, LSL #6 ;// Loading Different type of zigzag tables based on PredDir
-
- M_STR pZigzagTable,ppZigzagTable ;// Store Zigzag table address on stack
- LDR pVlcTableL0L1, =armVCM4P2_IntraVlcL0L1 ;// Load optimized packed VLC Table with both L=0 and L=1 entries
- M_STR pVlcTableL0L1,ppVlcTableL0L1 ;// Store VLC Table address on stack
- LDR pLMAXTableL0L1, =armVCM4P2_IntraL0L1LMAX ;// Load LMAX Table
- M_STR pLMAXTableL0L1,ppLMAXTableL0L1 ;// Store LMAX Table address on Stack
- LDR pRMAXTableL0L1, =armVCM4P2_IntraL0L1RMAX ;// Load RMAX Table
- MOV Count,#0 ;// Set Start=0
-
- M_STR pRMAXTableL0L1,ppRMAXTableL0L1 ;// Store RMAX Table address on stack
-
-
-
- M_LDR shortVideoHeader,shortVideoHeaderonStack ;// get the Input Argument from stack
-
- BL armVCM4P2_DecodeVLCZigzag_AC_unsafe ;// Call Unsafe Function
-
-
-
-
- M_END
- ENDIF
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraDCVLC_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraDCVLC_s.s
deleted file mode 100644
index e9fed80..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraDCVLC_s.s
+++ /dev/null
@@ -1,238 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;/**
-; *
-; * File Name: omxVCM4P2_DecodeVLCZigzag_IntraDCVLC_s.s
-; * OpenMAX DL: v1.0.2
-; * Revision: 12290
-; * Date: Wednesday, April 9, 2008
-; *
-; *
-; *
-; *
-; * Description:
-; * Contains modules for zigzag scanning and VLC decoding
-; * for inter block.
-; *
-; *
-; *
-; * Function: omxVCM4P2_DecodeVLCZigzag_Inter
-; *
-; * Description:
-; * Performs VLC decoding and inverse zigzag scan for one intra coded block.
-; *
-; * Remarks:
-; *
-; * Parameters:
-; * [in] ppBitStream pointer to the pointer to the current byte in
-; * the bitstream buffer
-; * [in] pBitOffset pointer to the bit position in the byte pointed
-; * to by *ppBitStream. *pBitOffset is valid within [0-7].
-; * [in] shortVideoHeader binary flag indicating presence of short_video_header;
-; * escape modes 0-3 are used if shortVideoHeader==0,
-; * and escape mode 4 is used when shortVideoHeader==1.
-; * [out] ppBitStream *ppBitStream is updated after the block is
-; * decoded, so that it points to the current byte
-; * in the bit stream buffer
-; * [out] pBitOffset *pBitOffset is updated so that it points to the
-; * current bit position in the byte pointed by
-; * *ppBitStream
-; * [out] pDst pointer to the coefficient buffer of current
-; * block. Must be 16-byte aligned
-; *
-; * Return Value:
-; * OMX_Sts_BadArgErr - bad arguments
-; * -At least one of the following pointers is NULL: ppBitStream, *ppBitStream, pBitOffset, pDst, or
-; * -pDst is not 16-byte aligned, or
-; * -*pBitOffset exceeds [0,7].
-; * OMX_Sts_Err - status error
-; * -At least one mark bit is equal to zero
-; * -Encountered an illegal stream code that cannot be found in the VLC table
-; * -Encountered and illegal code in the VLC FLC table
-; * -The number of coefficients is greater than 64
-; *
-; */
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
- INCLUDE armCOMM_BitDec_s.h
-
-
- M_VARIANTS CortexA8
-
-
-
-
-
- IF CortexA8
-
-
- ;// Import various tables needed for the function
-
-
- IMPORT armVCM4P2_IntraVlcL0L1 ;// Contains optimized and packed VLC Tables for both Last =1 and last=0
- ;// Packed in Run:Level:Last format
- IMPORT armVCM4P2_IntraL0L1LMAX ;// Contains LMAX table entries with both Last=0 and Last=1
- IMPORT armVCM4P2_IntraL0L1RMAX ;// Contains RMAX table entries with both Last=0 and Last=1
- IMPORT armVCM4P2_aClassicalZigzagScan ;// contains CLassical, Horizontal, Vertical Zigzag table entries with double the original values
- IMPORT armVCM4P2_aIntraDCLumaChromaIndex ;// Contains Optimized DCLuma and DCChroma Index table Entries
-
-
- IMPORT armVCM4P2_DecodeVLCZigzag_AC_unsafe
-
-;//Input Arguments
-
-ppBitStream RN 0
-pBitOffset RN 1
-pDst RN 2
-PredDir RN 3
-shortVideoHeader RN 3
-videoComp RN 5
-;//Local Variables
-
-Return RN 0
-
-pDCLumaChromaIndex RN 4
-pDCChromaIndex RN 7
-pVlcTableL0L1 RN 4
-pLMAXTableL0L1 RN 4
-pRMAXTableL0L1 RN 4
-pZigzagTable RN 4
-Count RN 6
-DCValueSize RN 6
-powOfSize RN 7
-temp1 RN 5
-
-
-;// Scratch Registers
-
-RBitStream RN 8
-RBitBuffer RN 9
-RBitCount RN 10
-
-T1 RN 11
-T2 RN 12
-DCVal RN 14
-
-
- ;// Allocate stack memory to store optimized VLC,Zigzag, RMAX, LMAX Table Addresses
-
- M_ALLOC4 ppVlcTableL0L1,4
- M_ALLOC4 ppLMAXTableL0L1,4
- M_ALLOC4 ppRMAXTableL0L1,4
- M_ALLOC4 ppZigzagTable,4
- M_ALLOC4 pDCCoeff,4
-
-
-
- M_START omxVCM4P2_DecodeVLCZigzag_IntraDCVLC,r12
-
- M_ARG shortVideoHeaderonStack,4 ;// Pointer to argument on stack
- M_ARG videoComponstack,4 ;// Pointer to argument on stack
-
-
- ;// Decode DC Coefficient
-
-
- LDR pDCLumaChromaIndex, =armVCM4P2_aIntraDCLumaChromaIndex ;// Load Optimized VLC Table for Luminance and Chrominance
-
- ;// Initializing the Bitstream Macro
-
- M_BD_INIT0 ppBitStream, pBitOffset, RBitStream, RBitBuffer, RBitCount
- M_LDR videoComp,videoComponstack
- M_BD_INIT1 T1, T2, T2
- ADD pDCLumaChromaIndex,pDCLumaChromaIndex,videoComp, LSL #6
- M_BD_INIT2 T1, T2, T2
-
-
- M_BD_VLD DCValueSize,T1,T2,pDCLumaChromaIndex,4,2 ;// VLC Decode using optimized Luminance and Chrominance VLC Table
-
-
-
-
-DecodeDC
-
- CMP DCValueSize,#12
- BGT ExitError
-
- CMP DCValueSize,#0
- MOVEQ DCVal,#0 ;// If DCValueSize is zero then DC coeff =0
- BEQ ACDecode ;// Branch to perform AC Coeff Decoding
-
- M_BD_VREAD16 DCVal,DCValueSize,T1,T2 ;// Get DC Value From Bit stream
-
-
- MOV powOfSize,#1
- LSL powOfSize,DCValueSize ;// powOfSize=pow(2,DCValueSize)
- CMP DCVal,powOfSize,LSR #1 ;// Compare DCVal with powOfSize/2
- ADDLT DCVal,DCVal,#1
- SUBLT DCVal,DCVal,powOfSize ;// If Lessthan powOfSize/2 DCVal=DCVal-powOfSize+1
- ;// Else DCVal= fetchbits from bit stream
-
-CheckDCValueSize
-
- CMP DCValueSize,#8 ;// If DCValueSize greater than 8 check marker bit
-
- BLE ACDecode
-
- M_BD_READ8 temp1,1,T1
- TEQ temp1,#0 ;// If Marker bit is zero Exit with an Error Message
- BEQ ExitError
-
-
-
- ;// Decode AC Coefficient
-
-ACDecode
-
- M_STR DCVal,pDCCoeff ;// Store Decoded DC Coeff on Stack
- M_BD_FINI ppBitStream,pBitOffset ;// Terminating the Bit stream Macro
-
- LDR pZigzagTable, =armVCM4P2_aClassicalZigzagScan ;// Load Zigzag talbe address
- ADD pZigzagTable, pZigzagTable, PredDir, LSL #6 ;// Modify the Zigzag table adress based on PredDir
-
- M_STR pZigzagTable,ppZigzagTable ;// Store zigzag table on stack
- LDR pVlcTableL0L1, =armVCM4P2_IntraVlcL0L1 ;// Load Optimized VLC Table With both Last=0 and Last=1 Entries
- M_STR pVlcTableL0L1,ppVlcTableL0L1 ;// Store Optimized VLC Table on stack
- LDR pLMAXTableL0L1, =armVCM4P2_IntraL0L1LMAX ;// Load LMAX Table
- M_STR pLMAXTableL0L1,ppLMAXTableL0L1 ;// Store LMAX table on stack
- LDR pRMAXTableL0L1, =armVCM4P2_IntraL0L1RMAX ;// Load RMAX Table
- MOV Count,#1 ;// Set Start =1
-
- M_STR pRMAXTableL0L1,ppRMAXTableL0L1 ;// Store RMAX Table on Stack
-
-
- M_LDR shortVideoHeader,shortVideoHeaderonStack ;// Load the Input Argument From Stack
-
- BL armVCM4P2_DecodeVLCZigzag_AC_unsafe ;// Call the Unsafe Function
-
- M_LDR DCVal,pDCCoeff ;// Get the Decoded DC Value From Stack
- STRH DCVal,[pDst] ;// Store the DC Value
- B ExitOK
-
-
-
-ExitError
-
- M_BD_FINI ppBitStream,pBitOffset ;// Terminating the Bit Stream Macro in case of an Error
- MOV Return,#OMX_Sts_Err ;// Exit with an Error Message
-ExitOK
-
- M_END
- ENDIF
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_FindMVpred_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_FindMVpred_s.s
deleted file mode 100644
index 9344120..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_FindMVpred_s.s
+++ /dev/null
@@ -1,208 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P2_FindMVpred_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
-;// Function:
-;// omxVCM4P2_FindMVpred
-;//
- ;// Include headers
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
- INCLUDE armVCCOMM_s.h
-
- ;// Define cpu variants
- M_VARIANTS CortexA8
-
-
- IF CortexA8
-
- M_TABLE armVCM4P2_pBlkIndexTable
- DCD OMXVCBlk0, OMXVCBlk1
- DCD OMXVCBlk2, OMXVCBlk3
-
-;//--------------------------------------------
-;// Declare input registers
-;//--------------------------------------------
-
-pSrcMVCurMB RN 0
-pSrcCandMV1 RN 1
-pSrcCandMV2 RN 2
-pSrcCandMV3 RN 3
-pDstMVPred RN 4
-pDstMVPredME RN 5
-iBlk RN 6
-
-pTable RN 4
-CandMV RN 12
-
-pCandMV1 RN 7
-pCandMV2 RN 8
-pCandMV3 RN 9
-
-CandMV1dx RN 0
-CandMV1dy RN 1
-CandMV2dx RN 2
-CandMV2dy RN 3
-CandMV3dx RN 10
-CandMV3dy RN 11
-
-temp RN 14
-
-zero RN 14
-return RN 0
-
-; ----------------------------------------------
-; Main routine
-; ----------------------------------------------
-
- M_ALLOC4 MV, 4
-
- ;// Function header
- M_START omxVCM4P2_FindMVpred, r11
-
- ;// Define stack arguments
- M_ARG ppDstMVPred, 4
- M_ARG ppDstMVPredME, 4
- M_ARG Blk, 4
-
- M_ADR CandMV, MV
- MOV zero, #0
- M_LDR iBlk, Blk
-
- ;// Set the default value for these
- ;// to be used if pSrcCandMV[1|2|3] == NULL
- MOV pCandMV1, CandMV
- MOV pCandMV2, CandMV
- MOV pCandMV3, CandMV
-
- STR zero, [CandMV]
-
- ;// Branch to the case based on blk number
- M_SWITCH iBlk
- M_CASE OMXVCBlk0 ;// iBlk=0
- M_CASE OMXVCBlk1 ;// iBlk=0
- M_CASE OMXVCBlk2 ;// iBlk=0
- M_CASE OMXVCBlk3 ;// iBlk=0
- M_ENDSWITCH
-
-OMXVCBlk0
- CMP pSrcCandMV1, #0
- ADDNE pCandMV1, pSrcCandMV1, #4
-
- CMP pSrcCandMV2, #0
- ADDNE pCandMV2, pSrcCandMV2, #8
-
- CMP pSrcCandMV3, #0
- ADDNE pCandMV3, pSrcCandMV3, #8
- CMPEQ pSrcCandMV1, #0
-
- MOVEQ pCandMV3, pCandMV2
- MOVEQ pCandMV1, pCandMV2
-
- CMP pSrcCandMV1, #0
- CMPEQ pSrcCandMV2, #0
-
- MOVEQ pCandMV1, pCandMV3
- MOVEQ pCandMV2, pCandMV3
-
- CMP pSrcCandMV2, #0
- CMPEQ pSrcCandMV3, #0
-
- MOVEQ pCandMV2, pCandMV1
- MOVEQ pCandMV3, pCandMV1
-
- B BlkEnd
-
-OMXVCBlk1
- MOV pCandMV1, pSrcMVCurMB
- CMP pSrcCandMV3, #0
- ADDNE pCandMV3, pSrcCandMV3, #8
-
- CMP pSrcCandMV2, #0
- ADDNE pCandMV2, pSrcCandMV2, #12
-
- CMPEQ pSrcCandMV3, #0
-
- MOVEQ pCandMV2, pCandMV1
- MOVEQ pCandMV3, pCandMV1
-
- B BlkEnd
-
-OMXVCBlk2
- CMP pSrcCandMV1, #0
- MOV pCandMV2, pSrcMVCurMB
- ADD pCandMV3, pSrcMVCurMB, #4
- ADDNE pCandMV1, pSrcCandMV1, #12
- B BlkEnd
-
-OMXVCBlk3
- ADD pCandMV1, pSrcMVCurMB, #8
- MOV pCandMV2, pSrcMVCurMB
- ADD pCandMV3, pSrcMVCurMB, #4
-
-BlkEnd
-
- ;// Using the transperancy info, zero
- ;// out the candidate MV if neccesary
- LDRSH CandMV1dx, [pCandMV1], #2
- LDRSH CandMV2dx, [pCandMV2], #2
- LDRSH CandMV3dx, [pCandMV3], #2
-
- ;// Load argument from the stack
- M_LDR pDstMVPredME, ppDstMVPredME
-
- LDRSH CandMV1dy, [pCandMV1]
- LDRSH CandMV2dy, [pCandMV2]
- LDRSH CandMV3dy, [pCandMV3]
-
- CMP pDstMVPredME, #0
-
- ;// Store the candidate MV's into the pDstMVPredME,
- ;// these can be used in the fast algorithm if implemented
-
- STRHNE CandMV1dx, [pDstMVPredME], #2
- STRHNE CandMV1dy, [pDstMVPredME], #2
- STRHNE CandMV2dx, [pDstMVPredME], #2
- STRHNE CandMV2dy, [pDstMVPredME], #2
- STRHNE CandMV3dx, [pDstMVPredME], #2
- STRHNE CandMV3dy, [pDstMVPredME]
-
- ; Find the median of the 3 candidate MV's
- M_MEDIAN3 CandMV1dx, CandMV2dx, CandMV3dx, temp
-
- ;// Load argument from the stack
- M_LDR pDstMVPred, ppDstMVPred
-
- M_MEDIAN3 CandMV1dy, CandMV2dy, CandMV3dy, temp
-
- STRH CandMV3dx, [pDstMVPred], #2
- STRH CandMV3dy, [pDstMVPred]
-
- MOV return, #OMX_Sts_NoErr
-
- M_END
- ENDIF ;// ARM1136JS :LOR: CortexA8
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_IDCT8x8blk_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_IDCT8x8blk_s.s
deleted file mode 100644
index 01b925e..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_IDCT8x8blk_s.s
+++ /dev/null
@@ -1,87 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P2_IDCT8x8blk_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-
-;// Function:
-;// omxVCM4P2_IDCT8x8blk
-;//
- ;// Include headers
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- ;// Define cpu variants
- M_VARIANTS CortexA8
-
- INCLUDE armCOMM_IDCT_s.h
-
- IMPORT armCOMM_IDCTPreScale
- ;//
- ;// Function prototype
- ;//
- ;// OMXResult
- ;// omxVCM4P2_IDCT8x8blk(const OMX_S16* pSrc,
- ;// OMX_S16* pDst)
- ;//
-
- IF CortexA8
- M_ALLOC4 ppDest, 4
- M_ALLOC4 pStride, 4
- M_ALLOC8 pBlk, 2*8*8
- ENDIF
-
-
- IF CortexA8
- M_START omxVCM4P2_IDCT8x8blk, r11, d15
- ENDIF
-
- IF CortexA8
-
-;// Declare input registers
-pSrc RN 0
-pDst RN 1
-
-;// Declare other intermediate registers
-Result RN 0
-
-;// Prototype for macro M_IDCT
-;// pSrc RN 0 ;// source data buffer
-;// Stride RN 1 ;// destination stride in bytes
-;// pDest RN 2 ;// destination data buffer
-;// pScale RN 3 ;// pointer to scaling table
-
-pSrc RN 0
-Stride RN 1
-pDest RN 2
-pScale RN 3
-
- MOV pDest, pDst
- LDR pScale, =armCOMM_IDCTPreScale
- M_IDCT s9, s16, 16
- MOV Result, #OMX_Sts_NoErr
- M_END
- ENDIF
- ;// ARM1136JS :LOR: CortexA8
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_MCReconBlock_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_MCReconBlock_s.s
deleted file mode 100644
index 3c1aec3..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_MCReconBlock_s.s
+++ /dev/null
@@ -1,458 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;//
-;//
-;// File Name: omxVCM4P2_MCReconBlock_s.s
-;// OpenMAX DL: v1.0.2
-;// Revision: 12290
-;// Date: Wednesday, April 9, 2008
-;//
-;//
-;//
-;//
-;// Description:
-;//
-;//
-
-;// Include standard headers
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
-;// Import symbols required from other files
-
- M_VARIANTS CortexA8
-
-;// ***************************************************************************
-;// ARM1136JS implementation
-;// ***************************************************************************
-
-;// ***************************************************************************
-;// CortexA8 implementation
-;// ***************************************************************************
- IF CortexA8
-;// ***************************************************************************
-;// MACRO DEFINITIONS
-;// ***************************************************************************
- ;// Description:
- ;// Does interpolation for the case of "IntegerPixel" predictType. Both
- ;// rounding cases are handled. Just copies a block from pSrc to pDst
- ;//
- ;// Syntax:
- ;// M_MCRECONBLOCK_IntegerPixel
- ;//
- ;// Inputs: None
- ;// Outputs: None
-
- MACRO
- M_MCRECONBLOCK_IntegerPixel
-CaseIntegerPixel_Rnd0
-CaseIntegerPixel_Rnd1
-
- VLD1 dRow0, [pSrc], srcStep
- VLD1 dRow1, [pSrc], srcStep
- VLD1 dRow2, [pSrc], srcStep
- VLD1 dRow3, [pSrc], srcStep
- VLD1 dRow4, [pSrc], srcStep
- VLD1 dRow5, [pSrc], srcStep
- VLD1 dRow6, [pSrc], srcStep
- VLD1 dRow7, [pSrc], srcStep
-
- VST1 dRow0, [pDst@64], dstStep
- VST1 dRow1, [pDst@64], dstStep
- VST1 dRow2, [pDst@64], dstStep
- VST1 dRow3, [pDst@64], dstStep
- VST1 dRow4, [pDst@64], dstStep
- VST1 dRow5, [pDst@64], dstStep
- VST1 dRow6, [pDst@64], dstStep
- VST1 dRow7, [pDst@64], dstStep
-
- B SwitchPredictTypeEnd
- MEND
-;// ***************************************************************************
- ;// Description:
- ;// Does interpolation for the case of "HalfPixelX" predictType. The two
- ;// rounding cases are handled by the parameter "$rndVal". Averages between
- ;// a pixel and pixel right to it, rounding it based on $rndVal. The
- ;// rounding is implemented by using opCode switching between "VRHADD" and
- ;// "VHADD" instructions.
- ;//
- ;// Syntax:
- ;// M_MCRECONBLOCK_HalfPixelX $rndVal
- ;//
- ;// Inputs:
- ;// $rndVal: 0 for rounding and 1 for no rounding
- ;// Outputs: None
-
- MACRO
- M_MCRECONBLOCK_HalfPixelX $rndVal
-
- LCLS M_VHADDR
- IF $rndVal = 0
-M_VHADDR SETS "VRHADD"
- ELSE
-M_VHADDR SETS "VHADD"
- ENDIF
-
-CaseHalfPixelX_Rnd$rndVal
-
- VLD1 {dRow0, dRow0Shft}, [pSrc], srcStep
- VEXT dRow0Shft, dRow0, dRow0Shft, #1
- VLD1 {dRow1, dRow1Shft}, [pSrc], srcStep
- VEXT dRow1Shft, dRow1, dRow1Shft, #1
- VLD1 {dRow2, dRow2Shft}, [pSrc], srcStep
- VEXT dRow2Shft, dRow2, dRow2Shft, #1
- VLD1 {dRow3, dRow3Shft}, [pSrc], srcStep
- VEXT dRow3Shft, dRow3, dRow3Shft, #1
- VLD1 {dRow4, dRow4Shft}, [pSrc], srcStep
- VEXT dRow4Shft, dRow4, dRow4Shft, #1
- VLD1 {dRow5, dRow5Shft}, [pSrc], srcStep
- VEXT dRow5Shft, dRow5, dRow5Shft, #1
- VLD1 {dRow6, dRow6Shft}, [pSrc], srcStep
- VEXT dRow6Shft, dRow6, dRow6Shft, #1
- VLD1 {dRow7, dRow7Shft}, [pSrc], srcStep
- VEXT dRow7Shft, dRow7, dRow7Shft, #1
- $M_VHADDR dRow0, dRow0, dRow0Shft
- $M_VHADDR dRow1, dRow1, dRow1Shft
- VST1 dRow0, [pDst@64], dstStep
- $M_VHADDR dRow2, dRow2, dRow2Shft
- VST1 dRow1, [pDst@64], dstStep
- $M_VHADDR dRow3, dRow3, dRow3Shft
- VST1 dRow2, [pDst@64], dstStep
- $M_VHADDR dRow4, dRow4, dRow4Shft
- VST1 dRow3, [pDst@64], dstStep
- $M_VHADDR dRow5, dRow5, dRow5Shft
- VST1 dRow4, [pDst@64], dstStep
- $M_VHADDR dRow6, dRow6, dRow6Shft
- VST1 dRow5, [pDst@64], dstStep
- $M_VHADDR dRow7, dRow7, dRow7Shft
- VST1 dRow6, [pDst@64], dstStep
- VST1 dRow7, [pDst@64], dstStep
-
- B SwitchPredictTypeEnd
- MEND
-;// ***************************************************************************
- ;// Description:
- ;// Does interpolation for the case of "HalfPixelY" predictType. The two
- ;// rounding cases are handled by the parameter "$rndVal". Averages between
- ;// a pixel and pixel below it, rounding it based on $rndVal. The
- ;// rounding is implemented by using opCode switching between "VRHADD" and
- ;// "VHADD" instructions.
- ;//
- ;// Syntax:
- ;// M_MCRECONBLOCK_HalfPixelY $rndVal
- ;//
- ;// Inputs:
- ;// $rndVal: 0 for rounding and 1 for no rounding
- ;// Outputs: None
-
- MACRO
- M_MCRECONBLOCK_HalfPixelY $rndVal
-
- LCLS M_VHADDR
- IF $rndVal = 0
-M_VHADDR SETS "VRHADD"
- ELSE
-M_VHADDR SETS "VHADD"
- ENDIF
-
-CaseHalfPixelY_Rnd$rndVal
- VLD1 dRow0, [pSrc], srcStep
- VLD1 dRow1, [pSrc], srcStep
- VLD1 dRow2, [pSrc], srcStep
- VLD1 dRow3, [pSrc], srcStep
- VLD1 dRow4, [pSrc], srcStep
- VLD1 dRow5, [pSrc], srcStep
- VLD1 dRow6, [pSrc], srcStep
- VLD1 dRow7, [pSrc], srcStep
- $M_VHADDR dRow0, dRow0, dRow1
- VLD1 dRow8, [pSrc], srcStep
- $M_VHADDR dRow1, dRow1, dRow2
- VST1 dRow0, [pDst@64], dstStep
- $M_VHADDR dRow2, dRow2, dRow3
- VST1 dRow1, [pDst@64], dstStep
- $M_VHADDR dRow3, dRow3, dRow4
- VST1 dRow2, [pDst@64], dstStep
- $M_VHADDR dRow4, dRow4, dRow5
- VST1 dRow3, [pDst@64], dstStep
- $M_VHADDR dRow5, dRow5, dRow6
- VST1 dRow4, [pDst@64], dstStep
- $M_VHADDR dRow6, dRow6, dRow7
- VST1 dRow5, [pDst@64], dstStep
- $M_VHADDR dRow7, dRow7, dRow8
- VST1 dRow6, [pDst@64], dstStep
- VST1 dRow7, [pDst@64], dstStep
-
- B SwitchPredictTypeEnd
- MEND
-;// ***************************************************************************
- ;// Description:
- ;// Does interpolation for the case of "IntegerPixel" predictType. Both
- ;// rounding cases are handled.
- ;// Typical computation for a row goes like this
- ;// 1. VLD1 {dRow0, dRow0Shft}, [pSrc], srcStep ;// Load the row and next 8 bytes
- ;// 2. VEXT dRow0Shft, dRow0, dRow0Shft, #1 ;// Generate the shifted row
- ;// 3. VADDL qSum0, dRow0, dRow0Shft ;// Generate the sum of row and shifted row
- ;// 5. VADD qSum0, qSum0, qSum1 ;// Add to the sum of next row (odd row sum has rounding value added to it)
- ;// 6. VSHRN dRow0, qSum0, #2 ;// Divide by 4
- ;// 7. VST1 dRow0, [pDst@64], dstStep ;// Store
- ;// Odd rows undergo following computation after step 3
- ;// 4. VADD qSum1, qSum1, qRound
- ;// This saves for adding rounding value to each final sum (overall saves 4
- ;// instructions).
- ;// There is reuse of registers for qSum6, qSum7 & qSum8. Overall scheduling takes
- ;// care of this and also minimizes stalls. Rounding value was modified in
- ;// ARM register rndVal (originally used for rounding flag) before the switch.
- ;// It is then populated into all lanes in this macro. No branching out to
- ;// label "SwitchPredictTypeEnd" is required in the end of the macro as these
- ;// are the last of switch cases.
- ;//
- ;// Syntax:
- ;// M_MCRECONBLOCK_HalfPixelXY
- ;//
- ;// Inputs: None
- ;// Outputs: None
-
- MACRO
- M_MCRECONBLOCK_HalfPixelXY
-
-CaseHalfPixelXY_Rnd0
-CaseHalfPixelXY_Rnd1
- VLD1 {dRow0, dRow0Shft}, [pSrc], srcStep
- VDUP qRound, rndVal
- VLD1 {dRow1, dRow1Shft}, [pSrc], srcStep
- VEXT dRow0Shft, dRow0, dRow0Shft, #1
- VLD1 {dRow2, dRow2Shft}, [pSrc], srcStep
- VEXT dRow1Shft, dRow1, dRow1Shft, #1
- VLD1 {dRow3, dRow3Shft}, [pSrc], srcStep
- VEXT dRow2Shft, dRow2, dRow2Shft, #1
- VLD1 {dRow4, dRow4Shft}, [pSrc], srcStep
- VADDL qSum0, dRow0, dRow0Shft
- VLD1 {dRow5, dRow5Shft}, [pSrc], srcStep
- VADDL qSum1, dRow1, dRow1Shft
- VLD1 {dRow6, dRow6Shft}, [pSrc], srcStep
- VEXT dRow3Shft, dRow3, dRow3Shft, #1
- VLD1 {dRow7, dRow7Shft}, [pSrc], srcStep
- VEXT dRow4Shft, dRow4, dRow4Shft, #1
- VLD1 {dRow8, dRow8Shft}, [pSrc], srcStep
- VADD qSum1, qSum1, qRound
- VADDL qSum2, dRow2, dRow2Shft
- VEXT dRow5Shft, dRow5, dRow5Shft, #1
- VADD qSum0, qSum0, qSum1
- VADDL qSum3, dRow3, dRow3Shft
- VEXT dRow6Shft, dRow6, dRow6Shft, #1
- VADD qSum1, qSum1, qSum2
- VSHRN dRow0, qSum0, #2
- VADDL qSum4, dRow4, dRow4Shft
- VSHRN dRow1, qSum1, #2
- VADD qSum3, qSum3, qRound
- VADDL qSum5, dRow5, dRow5Shft
- VST1 dRow0, [pDst@64], dstStep
- VEXT dRow7Shft, dRow7, dRow7Shft, #1
- VST1 dRow1, [pDst@64], dstStep
- VEXT dRow8Shft, dRow8, dRow8Shft, #1
- VADD qSum5, qSum5, qRound
- VADD qSum2, qSum2, qSum3
- VADD qSum3, qSum3, qSum4
- VADD qSum4, qSum4, qSum5
- VSHRN dRow2, qSum2, #2
- VSHRN dRow3, qSum3, #2
- VSHRN dRow4, qSum4, #2
- VADDL qSum6, dRow6, dRow6Shft
- VADDL qSum7, dRow7, dRow7Shft
- VST1 dRow2, [pDst@64], dstStep
- VADDL qSum8, dRow8, dRow8Shft
- VADD qSum7, qSum7, qRound
- VST1 dRow3, [pDst@64], dstStep
- VST1 dRow4, [pDst@64], dstStep
- VADD qSum5, qSum5, qSum6
- VADD qSum6, qSum6, qSum7
- VADD qSum7, qSum7, qSum8
- VSHRN dRow5, qSum5, #2
- VSHRN dRow6, qSum6, #2
- VSHRN dRow7, qSum7, #2
- VST1 dRow5, [pDst@64], dstStep
- VST1 dRow6, [pDst@64], dstStep
- VST1 dRow7, [pDst@64], dstStep
-
- MEND
-;// ***************************************************************************
-
-;// Input/Output Registers
-pSrc RN 0
-srcStep RN 1
-pSrcResidue RN 2
-pDst RN 3
-dstStep RN 4
-predictType RN 5
-rndVal RN 6
-
-;// Local Scratch Registers
-pDstCopy RN 0
-return RN 0
-
-;// Neon Registers
-dRow0 DN D0.U8
-dRow0Shft DN D1.U8
-dRow1 DN D2.U8
-dRow1Shft DN D3.U8
-dRow2 DN D4.U8
-dRow2Shft DN D5.U8
-dRow3 DN D6.U8
-dRow3Shft DN D7.U8
-dRow4 DN D8.U8
-dRow4Shft DN D9.U8
-dRow5 DN D10.U8
-dRow5Shft DN D11.U8
-dRow6 DN D12.U8
-dRow6Shft DN D13.U8
-dRow7 DN D14.U8
-dRow7Shft DN D15.U8
-dRow8 DN D16.U8
-dRow8Shft DN D17.U8
-
-
-qSum0 QN Q9.U16
-qSum1 QN Q10.U16
-qSum2 QN Q11.U16
-qSum3 QN Q12.U16
-qSum4 QN Q13.U16
-qSum5 QN Q14.U16
-qSum6 QN Q0.U16
-qSum7 QN Q1.U16
-qSum8 QN Q2.U16
-
-qRound QN Q15.U16
-
-dDst0 DN D0.U8
-dDst1 DN D1.U8
-dDst2 DN D2.U8
-dDst3 DN D3.U8
-dDst4 DN D4.U8
-dDst5 DN D5.U8
-dDst6 DN D6.U8
-dDst7 DN D7.U8
-
-qRes0 QN Q4.S16
-qRes1 QN Q5.S16
-qRes2 QN Q6.S16
-qRes3 QN Q7.S16
-qRes4 QN Q8.S16
-qRes5 QN Q9.S16
-qRes6 QN Q10.S16
-qRes7 QN Q11.S16
-
- ;// Function header
- M_START omxVCM4P2_MCReconBlock, r6, d15
- ;// Define stack arguments
- M_ARG Arg_dstStep, 4
- M_ARG Arg_predictType, 4
- M_ARG Arg_rndVal, 4
- ;// Load argument from the stack
- M_LDR dstStep, Arg_dstStep
- M_LDR predictType, Arg_predictType
- M_LDR rndVal, Arg_rndVal
- ADD predictType, rndVal, predictType, LSL #1
- RSB rndVal, rndVal, #2 ;// preparing rndVal for HalfPixelXY
-
- ;// The following is implementation of switching to different code segments
- ;// based on different predictType and rndVal flags. The corresponding
- ;// labels (e.g. CaseIntegerPixel_Rnd0) are embedded in the macros following
- ;// M_ENDSWITCH (e.g. M_MCRECONBLOCK_IntegerPixel). While "M_MCRECONBLOCK_IntegerPixel"
- ;// and "M_MCRECONBLOCK_HalfPixelXY" handle for both rounding cases;
- ;// "M_MCRECONBLOCK_HalfPixelX" and "M_MCRECONBLOCK_HalfPixelY" macros handle
- ;// the two rounding cases in separate code bases.
- ;// All these together implement the interpolation functionality
-
- M_SWITCH predictType
- M_CASE CaseIntegerPixel_Rnd0
- M_CASE CaseIntegerPixel_Rnd1
- M_CASE CaseHalfPixelX_Rnd0
- M_CASE CaseHalfPixelX_Rnd1
- M_CASE CaseHalfPixelY_Rnd0
- M_CASE CaseHalfPixelY_Rnd1
- M_CASE CaseHalfPixelXY_Rnd0
- M_CASE CaseHalfPixelXY_Rnd1
- M_ENDSWITCH
-
- M_MCRECONBLOCK_IntegerPixel
- M_MCRECONBLOCK_HalfPixelX 0
- M_MCRECONBLOCK_HalfPixelX 1
- M_MCRECONBLOCK_HalfPixelY 0
- M_MCRECONBLOCK_HalfPixelY 1
- M_MCRECONBLOCK_HalfPixelXY
-SwitchPredictTypeEnd
-
- ;// After interpolation is done, residue needs to be added. This is done
- ;// only in case "pSrcResidue" parameter to the function is not NULL.
- ;// Following is a completely unrolled code to do so. Each row and
- ;// corresponding residue is loaded and residue is added and value
- ;// stored
-
- CMP pSrcResidue, #0
- SUBNE pDst, pDst, dstStep, LSL #3 ;// Restoring pDst
- MOVNE pDstCopy, pDst
- BEQ pSrcResidueConditionEnd
-pSrcResidueNotNull
- VLD1 dDst0, [pDst@64], dstStep
- VLD1 qRes0, [pSrcResidue@128]!
- VLD1 dDst1, [pDst@64], dstStep
- VLD1 qRes1, [pSrcResidue@128]!
- VLD1 dDst2, [pDst@64], dstStep
- VLD1 qRes2, [pSrcResidue@128]!
- VADDW qRes0, qRes0, dDst0
- VLD1 dDst3, [pDst@64], dstStep
- VADDW qRes1, qRes1, dDst1
- VLD1 qRes3, [pSrcResidue@128]!
- VADDW qRes2, qRes2, dDst2
- VLD1 dDst4, [pDst@64], dstStep
- VQMOVUN dDst0, qRes0
- VLD1 qRes4, [pSrcResidue@128]!
- VADDW qRes3, qRes3, dDst3
- VLD1 dDst5, [pDst@64], dstStep
- VQMOVUN dDst1, qRes1
- VLD1 qRes5, [pSrcResidue@128]!
- VADDW qRes4, qRes4, dDst4
- VLD1 dDst6, [pDst@64], dstStep
- VQMOVUN dDst2, qRes2
- VLD1 qRes6, [pSrcResidue@128]!
- VADDW qRes5, qRes5, dDst5
- VLD1 dDst7, [pDst@64], dstStep
- VQMOVUN dDst3, qRes3
- VLD1 qRes7, [pSrcResidue@128]!
- VADDW qRes6, qRes6, dDst6
- VST1 dDst0, [pDstCopy@64], dstStep
- VQMOVUN dDst4, qRes4
- VST1 dDst1, [pDstCopy@64], dstStep
- VADDW qRes7, qRes7, dDst7
- VST1 dDst2, [pDstCopy@64], dstStep
- VQMOVUN dDst5, qRes5
- VST1 dDst3, [pDstCopy@64], dstStep
- VQMOVUN dDst6, qRes6
- VST1 dDst4, [pDstCopy@64], dstStep
- VQMOVUN dDst7, qRes7
- VST1 dDst5, [pDstCopy@64], dstStep
- VST1 dDst6, [pDstCopy@64], dstStep
- VST1 dDst7, [pDstCopy@64], dstStep
-
-pSrcResidueConditionEnd
- MOV return, #OMX_Sts_NoErr
-
- M_END
- ENDIF ;// CortexA8
- END
-;// ***************************************************************************
-;// omxVCM4P2_MCReconBlock ends
-;// ***************************************************************************
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_PredictReconCoefIntra_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_PredictReconCoefIntra_s.s
deleted file mode 100644
index 6b4eb28..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_PredictReconCoefIntra_s.s
+++ /dev/null
@@ -1,334 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-; **********
-; *
-; * File Name: omxVCM4P2_PredictReconCoefIntra_s.s
-; * OpenMAX DL: v1.0.2
-; * Revision: 12290
-; * Date: Wednesday, April 9, 2008
-; *
-; *
-; *
-; *
-; * Description:
-; * Contains module for DC/AC coefficient prediction
-; *
-; *
-; * Function: omxVCM4P2_PredictReconCoefIntra
-; *
-; * Description:
-; * Performs adaptive DC/AC coefficient prediction for an intra block. Prior
-; * to the function call, prediction direction (predDir) should be selected
-; * as specified in subclause 7.4.3.1 of ISO/IEC 14496-2.
-; *
-; * Remarks:
-; *
-; * Parameters:
-; * [in] pSrcDst pointer to the coefficient buffer which contains the
-; * quantized coefficient residuals (PQF) of the current
-; * block; must be aligned on a 4-byte boundary. The
-; * output coefficients are saturated to the range
-; * [-2048, 2047].
-; * [in] pPredBufRow pointer to the coefficient row buffer; must be aligned
-; * on a 4-byte boundary.
-; * [in] pPredBufCol pointer to the coefficient column buffer; must be
-; * aligned on a 4-byte boundary.
-; * [in] curQP quantization parameter of the current block. curQP may
-; * equal to predQP especially when the current block and
-; * the predictor block are in the same macroblock.
-; * [in] predQP quantization parameter of the predictor block
-; * [in] predDir indicates the prediction direction which takes one
-; * of the following values:
-; * OMX_VIDEO_HORIZONTAL predict horizontally
-; * OMX_VIDEO_VERTICAL predict vertically
-; * [in] ACPredFlag a flag indicating if AC prediction should be
-; * performed. It is equal to ac_pred_flag in the bit
-; * stream syntax of MPEG-4
-; * [in] videoComp video component type (luminance, chrominance or
-; * alpha) of the current block
-; * [out] pSrcDst pointer to the coefficient buffer which contains
-; * the quantized coefficients (QF) of the current
-; * block
-; * [out] pPredBufRow pointer to the updated coefficient row buffer
-; * [out] pPredBufCol pointer to the updated coefficient column buffer
-; * Return Value:
-; * OMX_Sts_NoErr - no error
-; * OMX_Sts_BadArgErr - Bad arguments
-; * - At least one of the pointers is NULL: pSrcDst, pPredBufRow, or pPredBufCol.
-; * - At least one the following cases: curQP <= 0, predQP <= 0, curQP >31,
-; * predQP > 31, preDir exceeds [1,2].
-; * - At least one of the pointers pSrcDst, pPredBufRow, or pPredBufCol is not
-; * 4-byte aligned.
-; *
-; *********
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS CortexA8
-
-
-
- IMPORT armVCM4P2_Reciprocal_QP_S32
- IMPORT armVCM4P2_Reciprocal_QP_S16
- IMPORT armVCM4P2_DCScaler
-
- IF CortexA8
-;// Input Arguments
-
-pSrcDst RN 0
-pPredBufRow RN 1
-pPredBufCol RN 2
-curQP RN 3
-QP RN 3
-predQP RN 4
-predDir RN 5
-ACPredFlag RN 6
-videoComp RN 7
-
-;// Local Variables
-
-shortVideoHeader RN 4
-dcScaler RN 4
-index RN 6
-predCoeffTable RN 7
-temp1 RN 6
-temp2 RN 9
-temp RN 14
-Const RN 8
-temppPredColBuf RN 8
-tempPred RN 9
-
-absCoeffDC RN 8
-negdcScaler RN 10
-Rem RN 11
-temp3 RN 12
-
-dcRowbufCoeff RN 10
-dcColBuffCoeff RN 11
-Return RN 0
-
-;//NEON Registers
-
-qPredRowBuf QN Q0.S16
-dPredRowBuf0 DN D0.S16
-dPredRowBuf1 DN D1.S16
-
-
-
-
-qCoeffTab QN Q1.S32
-
-qPredQP QN Q2.S16
-dPredQP0 DN D4.S16
-dPredQP1 DN D5.S16
-
-
-qtemp1 QN Q3.S32
-qtemp QN Q3.S16
-
-dtemp0 DN D6.S16
-dtemp1 DN D7.S16
-
-dtemp2 DN D8.S16
-dtemp3 DN D9.S16
-
-dtemp4 DN D2.S16
-dtemp5 DN D3.S16
-dtemp6 DN D4.S16
-dtemp7 DN D5.S16
-
-qtempPred1 QN Q5.S32
-qtempPred QN Q5.S16
-
-dtempPred0 DN D10.S16
-dtempPred1 DN D11.S16
-
-
-
- M_START omxVCM4P2_PredictReconCoefIntra,r11,d11
-
- ;// Assigning pointers to Input arguments on Stack
-
- M_ARG predQPonStack,4
- M_ARG predDironStack,4
- M_ARG ACPredFlagonStack,4
- M_ARG videoComponStack,4
-
- ;// DC Prediction
-
- M_LDR videoComp,videoComponStack ;// Load videoComp From Stack
-
- M_LDR predDir,predDironStack ;// Load Prediction direction
- ;// DC Scaler calculation
- LDR index, =armVCM4P2_DCScaler
- ADD index,index,videoComp,LSL #5
- LDRB dcScaler,[index,QP]
-
-
- LDR predCoeffTable, =armVCM4P2_Reciprocal_QP_S16 ;// Loading the table with entries 32767/(1 to 63)
- CMP predDir,#2 ;// Check if the Prediction direction is vertical
-
- ;// Caulucate tempPred
-
- LDREQSH absCoeffDC,[pPredBufRow] ;// If vetical load the coeff from Row Prediction Buffer
- LDRNESH absCoeffDC,[pPredBufCol] ;// If horizontal load the coeff from column Prediction Buffer
-
- RSB negdcScaler,dcScaler,#0 ;// negdcScaler=-dcScaler
- MOV temp1,absCoeffDC ;// Load the Prediction coeff to temp for comparision
- CMP temp1,#0
- RSBLT absCoeffDC,temp1,#0 ;// calculate absolute val of prediction coeff
-
- ADD temp,dcScaler,dcScaler
- LDRH temp,[predCoeffTable,temp] ;// Load value from coeff table for performing division using multiplication
- SMULBB tempPred,temp,absCoeffDC ;// tempped=pPredBufRow(Col)[0]*32767/dcScaler
- ADD temp3,dcScaler,#1
- LSR tempPred,tempPred,#15 ;// tempped=pPredBufRow(Col)[0]/dcScaler
- LSR temp3,temp3,#1 ;// temp3=round(dcScaler/2)
- MLA Rem,negdcScaler,tempPred,absCoeffDC ;// Remainder Rem=abs(pPredBufRow(Col)[0])-tempPred*dcScaler
-
- LDRH dcRowbufCoeff,[pPredBufCol]
-
- CMP Rem,temp3 ;// compare Rem with (dcScaler/2)
- ADDGE tempPred,#1 ;// tempPred=tempPred+1 if Rem>=(dcScaler/2)
- CMP temp1,#0
- RSBLT tempPred,tempPred,#0 ;// tempPred=-tempPred if
-
- STRH dcRowbufCoeff,[pPredBufRow,#-16]
-
-
- LDRH temp,[pSrcDst] ;// temp=pSrcDst[0]
- ADD temp,temp,tempPred ;// temp=pSrcDst[0]+tempPred
- SSAT16 temp,#12,temp ;// clip temp to [-2048,2047]
- SMULBB dcColBuffCoeff,temp,dcScaler ;// temp1=clipped(pSrcDst[0])*dcScaler
- M_LDR ACPredFlag,ACPredFlagonStack
- STRH dcColBuffCoeff,[pPredBufCol]
-
-
- ;// AC Prediction
-
- M_LDR predQP,predQPonStack
-
- CMP ACPredFlag,#1 ;// Check if the AC prediction flag is set or not
- BNE Exit ;// If not set Exit
- CMP predDir,#2 ;// Check the Prediction direction
- LDR predCoeffTable, =armVCM4P2_Reciprocal_QP_S32 ;// Loading the table with entries 0x1ffff/(1 to 63)
- MOV Const,#4
- MUL curQP,curQP,Const ;// curQP=4*curQP
- VDUP dPredQP0,predQP
- LDR temp2,[predCoeffTable,curQP] ;// temp=0x1ffff/curQP
- VDUP qCoeffTab,temp2
- BNE Horizontal ;// If the Prediction direction is horizontal branch to Horizontal
-
-
-
- ;// Vertical
- ;//Calculating tempPred
-
- VLD1 {dPredRowBuf0,dPredRowBuf1},[pPredBufRow] ;// Loading pPredBufRow[i]:i=0 t0 7
-
- VMULL qtemp1,dPredRowBuf0,dPredQP0 ;//qtemp1[i]=pPredBufRow[i]*dPredQP[i]: i=0 t0 3
- VMUL qtempPred1,qtemp1,qCoeffTab ;//qtempPred1[i]=pPredBufRow[i]*dPredQP[i]*0x1ffff/curQP : i=0 t0 3
-
- VMULL qtemp1,dPredRowBuf1,dPredQP0 ;//qtemp1[i]=pPredBufRow[i]*dPredQP[i] : i=4 t0 7
-
- VRSHR qtempPred1,qtempPred1,#17 ;//qtempPred1[i]=round(pPredBufRow[i]*dPredQP[i]/curQP) : i=0 t0 3
- VSHRN dPredQP1,qtempPred1,#0 ;// narrow qtempPred1[i] to 16 bits
-
-
- VMUL qtempPred1,qtemp1,qCoeffTab ;//qtempPred1[i]=pPredBufRow[i]*dPredQP[i]*0x1ffff/curQP : i=4 t0 7
- VRSHR qtempPred1,qtempPred1,#17 ;//qtempPred1[i]=round(pPredBufRow[i]*dPredQP[i]/curQP) : i=4 t0 7
- VLD1 {dtemp0,dtemp1},[pSrcDst] ;//Loading pSrcDst[i] : i=0 to 7
- VSHRN dtempPred1,qtempPred1,#0 ;// narrow qtempPred1[i] to 16 bits
- VMOV dtempPred0,dPredQP1
-
- ;//updating source and row prediction buffer contents
- VADD qtemp,qtemp,qtempPred ;//pSrcDst[i]=pSrcDst[i]+qtempPred[i]: i=0 to 7
- VQSHL qtemp,qtemp,#4 ;//Clip to [-2048,2047]
- LDRH dcRowbufCoeff,[pPredBufRow] ;//Loading Dc Value of Row Prediction buffer
- VSHR qtemp,qtemp,#4
-
- VST1 {dtemp0,dtemp1},[pSrcDst] ;//storing back the updated values
- VST1 {dtemp0,dtemp1},[pPredBufRow] ;//storing back the updated row prediction values
- STRH dcRowbufCoeff,[pPredBufRow] ;// storing the updated DC Row Prediction coeff
-
- B Exit
-
-Horizontal
-
- ;// Calculating Temppred
-
-
-
- VLD1 {dPredRowBuf0,dPredRowBuf1},[pPredBufCol] ;// Loading pPredBufCol[i]:i=0 t0 7
- VMULL qtemp1,dPredRowBuf0,dPredQP0 ;//qtemp1[i]=pPredBufCol[i]*dPredQP[i]: i=0 t0 3
- VMUL qtempPred1,qtemp1,qCoeffTab ;//qtempPred1[i]=pPredBufCol[i]*dPredQP[i]*0x1ffff/curQP : i=0 t0 3
-
- VMULL qtemp1,dPredRowBuf1,dPredQP0 ;//qtemp1[i]=pPredBufCol[i]*dPredQP[i] : i=4 t0 7
-
- VRSHR qtempPred1,qtempPred1,#17 ;//qtempPred1[i]=round(pPredBufCol[i]*dPredQP[i]/curQP) : i=0 t0 3
- VSHRN dPredQP1,qtempPred1,#0 ;// narrow qtempPred1[i] to 16 bits
-
-
- VMUL qtempPred1,qtemp1,qCoeffTab ;//qtempPred1[i]=pPredBufCol[i]*dPredQP[i]*0x1ffff/curQP : i=4 t0 7
-
- MOV temppPredColBuf,pPredBufCol
- VRSHR qtempPred1,qtempPred1,#17 ;//qtempPred1[i]=round(pPredBufCol[i]*dPredQP[i]/curQP) : i=4 t0 7
- VLD4 {dtemp0,dtemp1,dtemp2,dtemp3},[pSrcDst] ;// Loading coefficients Interleaving by 4
- VSHRN dtempPred1,qtempPred1,#0 ;// narrow qtempPred1[i] to 16 bits
- VMOV dtempPred0,dPredQP1
-
- ;// Updating source and column prediction buffer contents
- ADD temp2,pSrcDst,#32
- VLD4 {dtemp4,dtemp5,dtemp6,dtemp7},[temp2] ;// Loading next 16 coefficients Interleaving by 4
- VUZP dtemp0,dtemp4 ;// Interleaving by 8
- VADD dtemp0,dtemp0,dtempPred0 ;// Adding tempPred to coeffs
- VQSHL dtemp0,dtemp0,#4 ;// Clip to [-2048,2047]
- VSHR dtemp0,dtemp0,#4
- VST1 {dtemp0},[pPredBufCol]! ;// Updating Pridiction column buffer
- VZIP dtemp0,dtemp4 ;// deinterleaving
- VST4 {dtemp0,dtemp1,dtemp2,dtemp3},[pSrcDst] ;// Updating source coeffs
- VST4 {dtemp4,dtemp5,dtemp6,dtemp7},[temp2]!
-
- MOV temp1,temp2
- VLD4 {dtemp0,dtemp1,dtemp2,dtemp3},[temp2]! ;// Loading coefficients Interleaving by 4
-
- VLD4 {dtemp4,dtemp5,dtemp6,dtemp7},[temp2]
- VUZP dtemp0,dtemp4 ;// Interleaving by 8
- VADD dtemp0,dtemp0,dtempPred1
- VQSHL dtemp0,dtemp0,#4 ;// Clip to [-2048,2047]
- VSHR dtemp0,dtemp0,#4
- VST1 {dtemp0},[pPredBufCol]!
- VZIP dtemp0,dtemp4
- VST4 {dtemp0,dtemp1,dtemp2,dtemp3},[temp1]
- STRH dcColBuffCoeff,[temppPredColBuf]
- VST4 {dtemp4,dtemp5,dtemp6,dtemp7},[temp2]
-
-Exit
-
- STRH temp,[pSrcDst]
-
-
- MOV Return,#OMX_Sts_NoErr
-
- M_END
- ENDIF
-
-
- END
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_QuantInvInter_I_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_QuantInvInter_I_s.s
deleted file mode 100644
index 744571f..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_QuantInvInter_I_s.s
+++ /dev/null
@@ -1,176 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;/**
-; *
-; * File Name: omxVCM4P2_QuantInvInter_I_s.s
-; * OpenMAX DL: v1.0.2
-; * Revision: 12290
-; * Date: Wednesday, April 9, 2008
-; *
-; *
-; *
-; *
-; * Description:
-; * Contains modules for inter reconstruction
-; *
-; *
-; *
-; *
-; *
-; * Function: omxVCM4P2_QuantInvInter_I
-; *
-; * Description:
-; * Performs inverse quantization on intra/inter coded block.
-; * This function supports bits_per_pixel = 8. Mismatch control
-; * is performed for the first MPEG-4 mode inverse quantization method.
-; * The output coefficients are clipped to the range: [-2048, 2047].
-; * Mismatch control is performed for the first inverse quantization method.
-; *
-; * Remarks:
-; *
-; * Parameters:
-; * [in] pSrcDst pointer to the input (quantized) intra/inter block. Must be 16-byte aligned.
-; * [in] QP quantization parameter (quantiser_scale)
-; * [in] videoComp (Intra version only.) Video component type of the
-; * current block. Takes one of the following flags:
-; * OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE,
-; * OMX_VC_ALPHA.
-; * [in] shortVideoHeader a flag indicating presence of short_video_header;
-; * shortVideoHeader==1 selects linear intra DC mode,
-; * and shortVideoHeader==0 selects nonlinear intra DC mode.
-; * [out] pSrcDst pointer to the output (dequantized) intra/inter block. Must be 16-byte aligned.
-; *
-; * Return Value:
-; * OMX_Sts_NoErr - no error
-; * OMX_Sts_BadArgErr - bad arguments
-; * - If pSrcDst is NULL or is not 16-byte aligned.
-; * or
-; * - If QP <= 0.
-; * or
-; * - videoComp is none of OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE and OMX_VC_ALPHA.
-; *
-; */
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS CortexA8
-
- IF CortexA8
-
-
-;//Input Arguments
-pSrcDst RN 0
-QP RN 1
-
-
-;//Local Variables
-Count RN 3
-doubleQP RN 4
-Return RN 0
-;// Neon registers
-
-
-dQP10 DN D0.S32[0]
-qQP1 QN Q0.S32
-
-dQP1 DN D0.S16
-dMinusQP1 DN D1.S16
-
-dCoeff0 DN D2.S16
-dCoeff1 DN D3.S16
-
-qResult0 QN Q3.S32
-dResult0 DN D7.S16
-qSign0 QN Q3.S32
-dSign0 DN D6.S16
-
-qResult1 QN Q4.S32
-dResult1 DN D8.S16
-qSign1 QN Q4.S32
-dSign1 DN D8.S16
-
-d2QP0 DN D10.S32[0]
-q2QP0 QN Q5.S32
-d2QP DN D10.S16
-
-dZero0 DN D11.S16
-dZero1 DN D12.S16
-dConst0 DN D13.S16
-
-
- M_START omxVCM4P2_QuantInvInter_I,r4,d13
-
-
-
- ADD doubleQP,QP,QP ;// doubleQP= 2*QP
- VMOV d2QP0,doubleQP
- VDUP q2QP0,d2QP0 ;// Move doubleQP in to a scalar
- TST QP,#1
- VLD1 {dCoeff0,dCoeff1},[pSrcDst] ;// Load first 8 values to Coeff0,Coeff1
- SUBEQ QP,QP,#1
- VMOV dQP10,QP ;// If QP is even then QP1=QP-1 else QP1=QP
- MOV Count,#64
- VDUP qQP1,dQP10 ;// Duplicate tempResult with QP1
- VSHRN d2QP,q2QP0,#0
- VEOR dConst0,dConst0,dConst0
- VSHRN dQP1,qQP1,#0 ;// QP1 truncated to 16 bits
- VSUB dMinusQP1,dConst0,dQP1 ;// dMinusQP1=-QP1
-
-Loop
-
- ;//Performing Inverse Quantization
-
- VCLT dSign0,dCoeff0, #0 ;// Compare Coefficient 0 against 0
- VCLT dSign1,dCoeff1, #0 ;// Compare Coefficient 1 against 0
- VCEQ dZero0,dCoeff0,#0 ;// Compare Coefficient 0 against zero
- VBSL dSign0,dMinusQP1,dQP1 ;// dSign0 = -QP1 if Coeff0< 0 else QP1
- VCEQ dZero1,dCoeff1,#0 ;// Compare Coefficient 1 against zero
- VBSL dSign1,dMinusQP1,dQP1 ;// dSign1 = -QP1 if Coeff1< 0 else QP1
- VMOVL qSign0,dSign0 ;// Sign extend qSign0 to 32 bits
- VMOVL qSign1,dSign1
- VMLAL qResult0,dCoeff0,d2QP ;// qResult0[i]= qCoeff0[i]+qCoeff0[i]*(-2) if Coeff <0
- ;// qResult0[i]= qCoeff0[i] if Coeff >=0
- VMLAL qResult1,dCoeff1,d2QP ;// qResult1[i]= qCoeff1[i]+qCoeff1[i]*(-2) if Coeff <0
- ;// qResult1[i]= qCoeff1[i] if Coeff >=0
- ;// Clip Result to [-2048,2047]
-
- VQSHL qResult0,qResult0,#20 ;// clip to [-2048,2047]
- VQSHL qResult1,qResult1,#20
-
- VSHR qResult0,qResult0,#4
- VSHR qResult1,qResult1,#4
- VSHRN dResult0,qResult0,#16 ;// Narrow the clipped Value to Halfword
- VSHRN dResult1,qResult1,#16
- VBIT dResult0,dConst0,dZero0
- VBIT dResult1,dConst0,dZero1
-
- VST1 {dResult0,dResult1},[pSrcDst]! ;// Store the result
- SUBS Count,Count,#8
- VLD1 {dCoeff0,dCoeff1},[pSrcDst]
-
-
- BGT Loop
-
- MOV Return,#OMX_Sts_NoErr
-
-
- M_END
- ENDIF
-
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_QuantInvIntra_I_s.s b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_QuantInvIntra_I_s.s
deleted file mode 100644
index 61a7fd4..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p2/src/omxVCM4P2_QuantInvIntra_I_s.s
+++ /dev/null
@@ -1,224 +0,0 @@
-;//
-;// Copyright (C) 2007-2008 ARM Limited
-;//
-;// Licensed under the Apache License, Version 2.0 (the "License");
-;// you may not use this file except in compliance with the License.
-;// You may obtain a copy of the License at
-;//
-;// http://www.apache.org/licenses/LICENSE-2.0
-;//
-;// Unless required by applicable law or agreed to in writing, software
-;// distributed under the License is distributed on an "AS IS" BASIS,
-;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;// See the License for the specific language governing permissions and
-;// limitations under the License.
-;//
-;/**
-; *
-; * File Name: omxVCM4P2_QuantInvIntra_I_s.s
-; * OpenMAX DL: v1.0.2
-; * Revision: 12290
-; * Date: Wednesday, April 9, 2008
-; *
-; *
-; *
-; *
-; * Description:
-; * Contains modules for inter reconstruction
-; *
-; *
-; *
-; *
-; *
-; *
-; * Function: omxVCM4P2_QuantInvIntra_I
-; *
-; * Description:
-; * Performs inverse quantization on intra/inter coded block.
-; * This function supports bits_per_pixel = 8. Mismatch control
-; * is performed for the first MPEG-4 mode inverse quantization method.
-; * The output coefficients are clipped to the range: [-2048, 2047].
-; * Mismatch control is performed for the first inverse quantization method.
-; *
-; * Remarks:
-; *
-; * Parameters:
-; * [in] pSrcDst pointer to the input (quantized) intra/inter block. Must be 16-byte aligned.
-; * [in] QP quantization parameter (quantiser_scale)
-; * [in] videoComp (Intra version only.) Video component type of the
-; * current block. Takes one of the following flags:
-; * OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE,
-; * OMX_VC_ALPHA.
-; * [in] shortVideoHeader a flag indicating presence of short_video_header;
-; * shortVideoHeader==1 selects linear intra DC mode,
-; * and shortVideoHeader==0 selects nonlinear intra DC mode.
-; * [out] pSrcDst pointer to the output (dequantized) intra/inter block. Must be 16-byte aligned.
-; *
-; * Return Value:
-; * OMX_Sts_NoErr - no error
-; * OMX_Sts_BadArgErr - bad arguments
-; * - If pSrcDst is NULL or is not 16-byte aligned.
-; * or
-; * - If QP <= 0.
-; * or
-; * - videoComp is none of OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE and OMX_VC_ALPHA.
-; *
-
-
- INCLUDE omxtypes_s.h
- INCLUDE armCOMM_s.h
-
- M_VARIANTS CortexA8
-
-
- IMPORT armVCM4P2_DCScaler
-
- IF CortexA8
-
-
-;//Input Arguments
-pSrcDst RN 0
-QP RN 1
-videoComp RN 2
-shortVideoHeader RN 3
-
-
-;//Local Variables
-
-dcScaler RN 4
-temp RN 14
-index RN 5
-
-
-Count RN 5
-doubleQP RN 4
-Return RN 0
-
-
-;// Neon registers
-
-
-dQP10 DN D0.S32[0]
-qQP1 QN Q0.S32
-
-dQP1 DN D0.S16
-dMinusQP1 DN D1.S16
-
-dCoeff0 DN D2.S16
-dCoeff1 DN D3.S16
-
-qResult0 QN Q3.S32
-dResult0 DN D7.S16
-qSign0 QN Q3.S32
-dSign0 DN D6.S16
-
-qResult1 QN Q4.S32
-dResult1 DN D8.S16
-qSign1 QN Q4.S32
-dSign1 DN D8.S16
-
-d2QP0 DN D10.S32[0]
-q2QP0 QN Q5.S32
-d2QP DN D10.S16
-
-dZero0 DN D11.S16
-dZero1 DN D4.S16
-dConst0 DN D5.S16
-
-
-
-
-
-
- M_START omxVCM4P2_QuantInvIntra_I,r5,d11
-
-
- ;// Perform Inverse Quantization for DC coefficient
-
- TEQ shortVideoHeader,#0 ;// Test if short Video Header flag =0
- MOVNE dcScaler,#8 ;// if shortVideoHeader is non zero dcScaler=8
- BNE calDCVal
-
- LDR index, =armVCM4P2_DCScaler
- ADD index,index,videoComp,LSL #5
- LDRB dcScaler,[index,QP]
-
- ;//M_CalDCScalar shortVideoHeader,videoComp, QP
-
-calDCVal
-
- LDRH temp,[pSrcDst]
- SMULBB temp,temp,dcScaler ;// dcCoeff = dcScaler * Quantized DC coefficient(from memory)
- SSAT temp,#12,temp ;// Saturating to 12 bits
-
-
-
- ;// Perform Inverse Quantization for Ac Coefficients
-
-
-
- ADD doubleQP,QP,QP ;// doubleQP= 2*QP
- VMOV d2QP0,doubleQP
- VDUP q2QP0,d2QP0 ;// Move doubleQP in to a scalar
- TST QP,#1
- VLD1 {dCoeff0,dCoeff1},[pSrcDst] ;// Load first 8 values to Coeff0,Coeff1
- SUBEQ QP,QP,#1
- VMOV dQP10,QP ;// If QP is even then QP1=QP-1 else QP1=QP
- MOV Count,#64
- VDUP qQP1,dQP10 ;// Duplicate tempResult with QP1
- VSHRN d2QP,q2QP0,#0
- VEOR dConst0,dConst0,dConst0
- VSHRN dQP1,qQP1,#0 ;// QP1 truncated to 16 bits
- VSUB dMinusQP1,dConst0,dQP1 ;// dMinusQP1=-QP1
-
-Loop
-
- ;//Performing Inverse Quantization
-
- VCLT dSign0,dCoeff0, #0 ;// Compare Coefficient 0 against 0
- VCLT dSign1,dCoeff1, #0 ;// Compare Coefficient 1 against 0
- VCEQ dZero0,dCoeff0,#0 ;// Compare Coefficient 0 against zero
- VBSL dSign0,dMinusQP1,dQP1 ;// dSign0 = -QP1 if Coeff0< 0 else QP1
- VCEQ dZero1,dCoeff1,#0 ;// Compare Coefficient 1 against zero
- VBSL dSign1,dMinusQP1,dQP1 ;// dSign1 = -QP1 if Coeff1< 0 else QP1
- VMOVL qSign0,dSign0 ;// Sign extend qSign0 to 32 bits
- VMOVL qSign1,dSign1
- VMLAL qResult0,dCoeff0,d2QP ;// qResult0[i]= qCoeff0[i]+qCoeff0[i]*(-2) if Coeff <0
- ;// qResult0[i]= qCoeff0[i] if Coeff >=0
- VMLAL qResult1,dCoeff1,d2QP ;// qResult1[i]= qCoeff1[i]+qCoeff1[i]*(-2) if Coeff <0
- ;// qResult1[i]= qCoeff1[i] if Coeff >=0
- ;// Clip Result to [-2048,2047]
-
- VQSHL qResult0,qResult0,#20 ;// clip to [-2048,2047]
- VQSHL qResult1,qResult1,#20
-
- VSHR qResult0,qResult0,#4
- VSHR qResult1,qResult1,#4
- VSHRN dResult0,qResult0,#16 ;// Narrow the clipped Value to Halfword
- VSHRN dResult1,qResult1,#16
- VBIT dResult0,dConst0,dZero0
- VBIT dResult1,dConst0,dZero1
-
- VST1 {dResult0,dResult1},[pSrcDst]! ;// Store the result
- SUBS Count,Count,#8
- VLD1 {dCoeff0,dCoeff1},[pSrcDst]
-
-
- BGT Loop
-
- SUB pSrcDst,pSrcDst,#128
-
- ;// Store the Inverse quantized Dc coefficient
-
- STRH temp,[pSrcDst],#2
-
- MOV Return,#OMX_Sts_NoErr
-
-
-
- M_END
- ENDIF
-
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/src/armVC_Version.c b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/src/armVC_Version.c
deleted file mode 100644
index 5d93681..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/src/armVC_Version.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "omxtypes.h"
-#include "armCOMM_Version.h"
-
-#ifdef ARM_INCLUDE_VERSION_DESCRIPTIONS
-const char * const omxVC_VersionDescription = "ARM OpenMAX DL v" ARM_VERSION_STRING " Rel=" OMX_ARM_RELEASE_TAG " Arch=" OMX_ARM_BUILD_ARCHITECTURE " Tools=" OMX_ARM_BUILD_TOOLCHAIN ;
-#endif /* ARM_INCLUDE_VERSION_DESCRIPTIONS */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/ARM_DELIVERY.TXT b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/ARM_DELIVERY.TXT
deleted file mode 100644
index 7801f3d..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/ARM_DELIVERY.TXT
+++ /dev/null
@@ -1,63 +0,0 @@
-The contents of this transaction was created by Hedley Francis
-of ARM on 19-Feb-2008.
-
-It contains the ARM data versions listed below.
-
-This data, unless otherwise stated, is ARM Proprietary and access to it
-is subject to the agreements indicated below.
-
-If you experience problems with this data, please contact ARM support
-quoting transaction reference <97412>.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-- OX000-SW-98010-r0p0-00bet1
- Video codecs - sample code
- Sample code release for Hantro (Ver 1.0.2)
- internal access
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-This transaction contains deliverables which are designated as being of
-beta release status (BET).
-
-Beta release status has a particular meaning to ARM of which the recipient
-must be aware. Beta is a pre-release status indicating that the deliverable
-so described is believed to robustly demonstrate specified behaviour, to be
-consistent across its included aspects and be ready for general deployment.
-But Beta also indicates that pre-release reliability trials are ongoing and
-that it is possible residual defects or errors in operation, consistency
-and documentation may still be encountered. The recipient should consider
-this position when using this Beta material supplied. ARM will normally
-attempt to provide fixes or a work-around for defects identified by the
-recipient, but the provision or timeliness of this support cannot be
-guaranteed. ARM shall not be responsible for direct or consequential
-damages as a result of encountering one or more of these residual defects.
-By accepting a Beta release, the recipient agrees to these constraints and
-to providing reasonable information to ARM to enable the replication of the
-defects identified by the recipient. The specific Beta version supplied
-will not be supported after release of a later or higher status version.
-It should be noted that Support for the Beta release of the deliverable
-will only be provided by ARM to a recipient who has a current support and
-maintenance contract for the deliverable.
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-In addition to the data versions listed above, this transaction contains
-two additional files at the top level.
-
-The first is this file, ARM_DELIVERY_97412.TXT, which is the delivery
-note.
-
-The second is ARM_MANIFEST_97412.TXT which contains a manifest of all the
-files included in this transaction, together with their checksums.
-
-The checksums provided are calculated using the RSA Data Security, Inc.
-MD5 Message-Digest Algorithm.
-
-The checksums can be used to verify the integrity of this data using the
-"md5sum" tool (which is part of the GNU "textutils" package) by running:
-
- % md5sum --check ARM_MANIFEST_97412.TXT
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/ARM_MANIFEST.TXT b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/ARM_MANIFEST.TXT
deleted file mode 100644
index 8e01b1e..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/ARM_MANIFEST.TXT
+++ /dev/null
@@ -1,140 +0,0 @@
- OX000-SW-98010-r0p0-00bet1/
- OX000-SW-98010-r0p0-00bet1/api/
-8971932d56eed6b1ad1ba507f0bff5f0 OX000-SW-98010-r0p0-00bet1/api/armCOMM_Bitstream.h
-e88ec84e122534092b90c67841549d6f OX000-SW-98010-r0p0-00bet1/api/armCOMM_Version.h
-43cf46c2cf2fe1f93c615b57bcbe4809 OX000-SW-98010-r0p0-00bet1/api/armCOMM.h
-f87fedd9ca432fefa757008176864ef8 OX000-SW-98010-r0p0-00bet1/api/armOMX.h
-8e49899a428822c36ef9dd94e0e05f18 OX000-SW-98010-r0p0-00bet1/api/omxtypes.h
-a06983abb39c476b081e87ea271361a5 OX000-SW-98010-r0p0-00bet1/build_vc.pl
-c01f8b93ab73d8c00ddf2499f01da5ff OX000-SW-98010-r0p0-00bet1/filelist_vc.txt
- OX000-SW-98010-r0p0-00bet1/src/
-26e2ff3f633764eb720deb340978dc2d OX000-SW-98010-r0p0-00bet1/src/armCOMM_Bitstream.c
-79aa23d9817efd11d0c4c2be36ec1e5c OX000-SW-98010-r0p0-00bet1/src/armCOMM.c
- OX000-SW-98010-r0p0-00bet1/vc/
- OX000-SW-98010-r0p0-00bet1/vc/m4p10/
- OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/
-e45297704d72302d4a947d0798c666fb OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_CAVLCTables.c
-205dfafe1fe7bb160bf36d2600e1100a OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_DeblockLuma_I.c
-bf92641e8548577b77e04e03ec04c358 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_MEGetBufSize.c
-f5ee6f7be822d87471cef3b1801dbfc2 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_VerEdge_I.c
-28110b3a13cecf4f216d10bcc761c401 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_Interpolate_Chroma.c
-9a1a25245c975d641e1c6378834aea4d OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_InterpolateHalfVer_Luma.c
-3a643eaaaeb12e8d274dc59a7357a586 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_HorEdge_I.c
-4c4de5973a6b74250ce91ac0b317a617 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_InvTransformDequant_LumaDC.c
-4ecdbe9193aaba1f9bb0e24c938b34f9 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_UnpackBlock2x2.c
-66e912f8c88f6019cba3ede27150a407 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_InterpolateLuma.c
-266da42f4e3015e67b2cbb58169d437f OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_InterpolateHalfDiag_Luma.c
-d905247eeaa52d4e2cf5f6bc3f61b348 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_DecodeCoeffsToPair.c
-5b29448db0495cd1717a4b925f13377c OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_PredictIntra_16x16.c
-f6451df27f6dcc99036b4b1253c23bb6 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_HorEdge_I.c
-892787d850eef09dc2148d45b416b062 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_TransformQuant_ChromaDC.c
-33da1c01a31f47c0f3aea9a7a5eaa9be OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_BlockMatch_Quarter.c
-e9fb11b066775283dcfeae8d12a6c97a OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_InterpolateHalfVer_Luma.c
-add97bec08e5e1a538aa8607168e61ba OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_PredictIntraChroma_8x8.c
-b695ecfc917b39470d1f40773b923972 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_PredictIntraDC4x4.c
-51bc596fd2ff61ad5450d7138461f4a1 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_MEInit.c
-dc6baa0a388dc5ea8ff65c24b179e670 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_GetVLCInfo.c
-a5499902996576f6712849db34d5ad65 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_VerEdge_I.c
-0c3b76745d53e74a8e64e80def31faba OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_PredictIntra_4x4.c
-4f2742ba5a3c2208f53bc0f6a443be14 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_SADQuar_4x.c
-b4ae2dc948e8ca64831fe3bbfbd89523 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_InterpolateChroma.c
-e15118cbe372db7cadba225c9456f189 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_SADQuar.c
-623cf336cfce7d0174f4e54072456f33 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_InvTransformResidualAndAdd.c
-89e452c80e30357cadfb04c05b6fe00c OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_InterpolateHalfHor_Luma.c
-3a5551cc54e85bbe34fc966c7dc00f1c OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_BlockMatch_Integer.c
-114030fa0d8f00af6d3289f47a5e85bf OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_DecodeCoeffsToPairCAVLC.c
-9e373ab296fb85bb45565a6c384f6ed8 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_DequantTables.c
-2d200f7cc230f302da48c589da42c02f OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_UnpackBlock4x4.c
-ea3f1d1d1507b55610b1349c7b5946e8 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_TransformDequantChromaDCFromPair.c
-bd2bf1743aef2a9396545ed025362be2 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_Average_4x.c
-ca68e809567bf89044631b67d228c7ce OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_DeblockChroma_I.c
-77caf2b5cbee96d360a919f27e1f14f4 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_QuantTables.c
-26081e384ec627fedad474a0e7dad877 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_SADQuar_8x.c
-1c83ae9207a54944936f4a63c665bd99 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_MotionEstimationMB.c
-4c36e04db20200f4ec72e5aba57446fd OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_SATD_4x4.c
-f75b7c5a80d8bf33e315380e4ef0ab8a OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_InterpolateHalfHor_Luma.c
-488925bb7aeeae0ccf93ec44af9fce35 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_SADQuar_16x.c
-c91a5345b5f877b3831ed1abcc60d579 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_BlockMatch_Half.c
-35515a115a32fcac8479072a9a5b0db9 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_Interpolate_Luma.c
-fdcf4622bc5f0ae75bdb0a51dcd03397 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_TransformQuant_LumaDC.c
-74c9278177400a1f7cc6d799a8c8ab34 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_SAD_4x.c
-56aa2d506d0cfdb4ebd366c07adb2d85 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_DeBlockPixel.c
-36b2165fd4d2a7f3f3e1f8daff4f94e5 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_SubAndTransformQDQResidual.c
-4b6b1b933fc7bc8f14a184c02c028085 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_TransformResidual4x4.c
-cf0ff093a9b372dd3271e3e5c28984d4 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_TransformDequantLumaDCFromPair.c
-9ccad9f894fbd32194f5b53da217072a OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_InvTransformDequant_ChromaDC.c
-4943a7a2df7e9d700675f8c1debf4d90 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_CompareMotionCostToMV.c
-29e4a7f38f8c2e8246ed756db03c012e OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/armVCM4P10_FwdTransformResidual4x4.c
-27bc64e7c18da0aab9c987a388f61608 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC.c
-859185614bb9d0013861e454d7b918f2 OX000-SW-98010-r0p0-00bet1/vc/m4p10/src/omxVCM4P10_DequantTransformResidualFromPairAndAdd.c
- OX000-SW-98010-r0p0-00bet1/vc/m4p10/api/
-63e3b64b96cc42a235c04f3a0f991316 OX000-SW-98010-r0p0-00bet1/vc/m4p10/api/armVCM4P10_CAVLCTables.h
- OX000-SW-98010-r0p0-00bet1/vc/m4p2/
- OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/
-0aae4f683d8903cba9956d3301ed9ffe OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_ACDCPredict.c
-8d6c1b44915329165df643081cc11a97 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_MCReconBlock.c
-0435eca930eacda0f2a59e843d405eff OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_MotionEstimationMB.c
-9a82dd0b1f05f798567436a009d02969 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_DecodePadMV_PVOP.c
-e1e24646c4bd03f5df78295452dd4eb2 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_BlockMatch_Integer_8x8.c
-746e6b334e4a26d4a9bfae6d735826f6 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_DCT8x8blk.c
-8b1d87b74d80ff13a16215b61d5e52ba OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_IDCT8x8blk.c
-309358d357baafc38d2b37bf1e9768a9 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_QuantInvInter_I.c
-cc77c7242b53c153f8d09527583f2771 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_FindMVpred.c
-7cd8e7796017e3dd00b494d34f629f3f OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_MEGetBufSize.c
-a4905cb5f8d4b244454ee4f60d18358b OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_PutVLCBits.c
-5596b31e433222c1e4860deebfa98ef2 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_DCT_Table.c
-365d072be6eab201f6e040058a3bacfc OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_BlockMatch_Integer.c
-78ed2212585b0cca75913a473b2ec430 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_EncodeVLCZigzag_IntraACVLC.c
-50b2d8da8f20f6b1d39b8d3df38af55d OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_EncodeMV.c
-4a851a2ad6d357cdc233d9c0bf475e02 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_BlockMatch_Half.c
-0d6d63878f2827e00e5f85b1e8e26017 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_Zigzag_Tables.c
-48b865a983fe5bf3075eddf652950722 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_PredictReconCoefIntra.c
-5f48fa7941835c46ac767e63fc29403b OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_EncodeVLCZigzag_IntraDCVLC.c
-bbaf454b64b32b2c42a76a7ec393d977 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_CompareMV.c
-eebff772f87a414436c5c5286f2cd213 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_MEInit.c
-65ae242eb8cb6d1027677c8ef8f77ca0 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_FillVLCBuffer.c
-125642b1ea0c1256d79af1e0ddecae93 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_QuantInter_I.c
-ce24ba3d83da4cb791485d3128268bf6 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_TransRecBlockCoef_intra.c
-09bc09a2e6fd962e719944582e38a8fd OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Intra.c
-6b0ee7a116471a4dadbe5bc8dbf425b0 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_FillVLDBuffer.c
-21322dca027c28353e3e7eb8f3620062 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_CheckVLCEscapeMode.c
-ef353d83244288d8c37e0f70249177cc OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_GetVLCBits.c
-541de824f8aebe4a5cac6f15da943efa OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_BlockMatch_Half_8x8.c
-0b40b154b591c7f8842cffe4042d17c5 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_Huff_Tables_VLC.c
-2ffcec88d3fcb372543a8f4508ea1ac6 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_QuantIntra_I.c
-e06d85ca000afcbb50580f98f0203ac8 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraACVLC.c
-ae82b6fcfcf731a61d70e1aa42e6277a OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_BlockMatch_Integer_16x16.c
-1d04395e231b597562257e98cda6cfb0 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Inter.c
-72c0a36327b6b9b436d3bce7c896c520 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraDCVLC.c
-1b65aa7f311124ea6fb47e384ec06a50 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_QuantInvIntra_I.c
-714957104a6ef71341fbe6a9ec65c136 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_SetPredDir.c
-86493f0ee853f653354a7389f1727f73 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_TransRecBlockCoef_inter.c
-5de8afcfb3052968794782a7c3a0b41a OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_EncodeVLCZigzag_Inter.c
-50bcc228cc660dbda037725309de3f8b OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_EncodeVLCZigzag_intra.c
-4f5cfa1ecc668913dde94e3caf97a2e1 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/armVCM4P2_DecodeVLCZigzag_intra.c
-c2ec804ddf64ee841146e39c3a783451 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_BlockMatch_Half_16x16.c
-4087f6a827912ee5b45ed4217f1a6d77 OX000-SW-98010-r0p0-00bet1/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_Inter.c
- OX000-SW-98010-r0p0-00bet1/vc/m4p2/api/
-5c711702dddcec85298003860d760cec OX000-SW-98010-r0p0-00bet1/vc/m4p2/api/armVCM4P2_DCT_Table.h
-1b92c94b785c03ec76d4fae2f2bbdb8a OX000-SW-98010-r0p0-00bet1/vc/m4p2/api/armVCM4P2_ZigZag_Tables.h
-ad9c6986d2a3200dd5e1f6103a54a99b OX000-SW-98010-r0p0-00bet1/vc/m4p2/api/armVCM4P2_Huff_Tables_VLC.h
- OX000-SW-98010-r0p0-00bet1/vc/src/
-e627b3346b0dc9aff14446005ce0fa43 OX000-SW-98010-r0p0-00bet1/vc/src/armVC_Version.c
- OX000-SW-98010-r0p0-00bet1/vc/api/
-7ca94b1c33ac0211e17d38baadd7d1dd OX000-SW-98010-r0p0-00bet1/vc/api/armVC.h
-12cf7596edbbf6048b626d15e8d0ed48 OX000-SW-98010-r0p0-00bet1/vc/api/omxVC.h
- OX000-SW-98010-r0p0-00bet1/vc/comm/
- OX000-SW-98010-r0p0-00bet1/vc/comm/src/
-3a6df0085736cbcbe2e3f45d08af4221 OX000-SW-98010-r0p0-00bet1/vc/comm/src/armVCCOMM_Average.c
-0bf3cb52863c829b28c0352835170211 OX000-SW-98010-r0p0-00bet1/vc/comm/src/omxVCCOMM_Copy8x8.c
-538b62f510b5a8bdced4a39fa12d9a23 OX000-SW-98010-r0p0-00bet1/vc/comm/src/omxVCCOMM_ComputeTextureErrorBlock_SAD.c
-66993edd9d441bf3b5b6c912f6400b6e OX000-SW-98010-r0p0-00bet1/vc/comm/src/omxVCCOMM_ExpandFrame_I.c
-8e526a9007eb0d43ebf362c498b37415 OX000-SW-98010-r0p0-00bet1/vc/comm/src/omxVCCOMM_LimitMVToRect.c
-87f8f26e6e9178df0ab7419334d5a3db OX000-SW-98010-r0p0-00bet1/vc/comm/src/omxVCCOMM_SAD_16x.c
-1a8577646132ad9b63a1477fdaec2464 OX000-SW-98010-r0p0-00bet1/vc/comm/src/omxVCCOMM_Average_16x.c
-48529c4f70c7e954e832eece1aee57bd OX000-SW-98010-r0p0-00bet1/vc/comm/src/omxVCCOMM_SAD_8x.c
-252977764d4f38282b6a56c59ccf4f09 OX000-SW-98010-r0p0-00bet1/vc/comm/src/armVCCOMM_SAD.c
-cc78cfaed9502c2e0282c91fb95eeac4 OX000-SW-98010-r0p0-00bet1/vc/comm/src/omxVCCOMM_Average_8x.c
-e468751c15a581ebd22da031e22117d1 OX000-SW-98010-r0p0-00bet1/vc/comm/src/omxVCCOMM_Copy16x16.c
-3f448d191eaeb82ecb7e27ef8ba27875 OX000-SW-98010-r0p0-00bet1/vc/comm/src/omxVCCOMM_ComputeTextureErrorBlock.c
-b1291c307808631fa833684abb9c34ce ARM_DELIVERY_97412.TXT
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/api/armCOMM.h b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/api/armCOMM.h
deleted file mode 100644
index 7304863..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/api/armCOMM.h
+++ /dev/null
@@ -1,800 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armCOMM.h
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * File: armCOMM.h
- * Brief: Declares Common APIs/Data Types used across OpenMAX API's
- *
- */
-
-
-#ifndef _armCommon_H_
-#define _armCommon_H_
-
-#include "omxtypes.h"
-
-typedef struct
-{
- OMX_F32 Re; /** Real part */
- OMX_F32 Im; /** Imaginary part */
-
-} OMX_FC32; /** single precision floating point complex number */
-
-typedef struct
-{
- OMX_F64 Re; /** Real part */
- OMX_F64 Im; /** Imaginary part */
-
-} OMX_FC64; /** double precision floating point complex number */
-
-
-/* Used by both IP and IC domains for 8x8 JPEG blocks. */
-typedef OMX_S16 ARM_BLOCK8x8[64];
-
-
-#include "armOMX.h"
-
-#define armPI (OMX_F64)(3.1415926535897932384626433832795)
-
-/***********************************************************************/
-
-/* Compiler extensions */
-#ifdef ARM_DEBUG
-/* debug version */
-#include <stdlib.h>
-#include <assert.h>
-#include <stdio.h>
-#define armError(str) {printf((str)); printf("\n"); exit(-1);}
-#define armWarn(str) {printf((str)); printf("\n");}
-#define armIgnore(a) ((void)a)
-#define armAssert(a) assert(a)
-#else
-/* release version */
-#define armError(str) ((void) (str))
-#define armWarn(str) ((void) (str))
-#define armIgnore(a) ((void) (a))
-#define armAssert(a) ((void) (a))
-#endif /* ARM_DEBUG */
-
-/* Arithmetic operations */
-
-#define armMin(a,b) ( (a) > (b) ? (b):(a) )
-#define armMax(a,b) ( (a) > (b) ? (a):(b) )
-#define armAbs(a) ( (a) < 0 ? -(a):(a) )
-
-/* Alignment operation */
-
-#define armAlignToBytes(Ptr,N) (Ptr + ( ((N-(intptr_t)Ptr)&(N-1)) / sizeof(*Ptr) ))
-#define armAlignTo2Bytes(Ptr) armAlignToBytes(Ptr,2)
-#define armAlignTo4Bytes(Ptr) armAlignToBytes(Ptr,4)
-#define armAlignTo8Bytes(Ptr) armAlignToBytes(Ptr,8)
-#define armAlignTo16Bytes(Ptr) armAlignToBytes(Ptr,16)
-
-/* Error and Alignment check */
-
-#define armRetArgErrIf(condition, code) if(condition) { return (code); }
-#define armRetDataErrIf(condition, code) if(condition) { return (code); }
-
-#ifndef ALIGNMENT_DOESNT_MATTER
-#define armIsByteAligned(Ptr,N) ((((intptr_t)(Ptr)) % N)==0)
-#define armNotByteAligned(Ptr,N) ((((intptr_t)(Ptr)) % N)!=0)
-#else
-#define armIsByteAligned(Ptr,N) (1)
-#define armNotByteAligned(Ptr,N) (0)
-#endif
-
-#define armIs2ByteAligned(Ptr) armIsByteAligned(Ptr,2)
-#define armIs4ByteAligned(Ptr) armIsByteAligned(Ptr,4)
-#define armIs8ByteAligned(Ptr) armIsByteAligned(Ptr,8)
-#define armIs16ByteAligned(Ptr) armIsByteAligned(Ptr,16)
-
-#define armNot2ByteAligned(Ptr) armNotByteAligned(Ptr,2)
-#define armNot4ByteAligned(Ptr) armNotByteAligned(Ptr,4)
-#define armNot8ByteAligned(Ptr) armNotByteAligned(Ptr,8)
-#define armNot16ByteAligned(Ptr) armNotByteAligned(Ptr,16)
-#define armNot32ByteAligned(Ptr) armNotByteAligned(Ptr,32)
-
-/**
- * Function: armRoundFloatToS16_ref/armRoundFloatToS32_ref/armRoundFloatToS64
- *
- * Description:
- * Converts a double precision value into a short int/int after rounding
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S16/OMX_S32 format
- *
- */
-
-OMX_S16 armRoundFloatToS16 (OMX_F64 Value);
-OMX_S32 armRoundFloatToS32 (OMX_F64 Value);
-OMX_S64 armRoundFloatToS64 (OMX_F64 Value);
-
-/**
- * Function: armSatRoundFloatToS16_ref/armSatRoundFloatToS32
- *
- * Description:
- * Converts a double precision value into a short int/int after rounding and saturation
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S16/OMX_S32 format
- *
- */
-
-OMX_S16 armSatRoundFloatToS16 (OMX_F64 Value);
-OMX_S32 armSatRoundFloatToS32 (OMX_F64 Value);
-
-/**
- * Function: armSatRoundFloatToU16_ref/armSatRoundFloatToU32
- *
- * Description:
- * Converts a double precision value into a unsigned short int/int after rounding and saturation
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_U16/OMX_U32 format
- *
- */
-
-OMX_U16 armSatRoundFloatToU16 (OMX_F64 Value);
-OMX_U32 armSatRoundFloatToU32 (OMX_F64 Value);
-
-/**
- * Function: armSignCheck
- *
- * Description:
- * Checks the sign of a variable:
- * returns 1 if it is Positive
- * returns 0 if it is 0
- * returns -1 if it is Negative
- *
- * Remarks:
- *
- * Parameters:
- * [in] var Variable to be checked
- *
- * Return Value:
- * OMX_INT -- returns 1 if it is Positive
- * returns 0 if it is 0
- * returns -1 if it is Negative
- */
-
-OMX_INT armSignCheck (OMX_S16 var);
-
-/**
- * Function: armClip
- *
- * Description: Clips the input between MAX and MIN value
- *
- *
- * Remarks:
- *
- * Parameters:
- * [in] Min lower bound
- * [in] Max upper bound
- * [in] src variable to the clipped
- *
- * Return Value:
- * OMX_S32 -- returns clipped value
- */
-
-OMX_S32 armClip (
- OMX_INT min,
- OMX_INT max,
- OMX_S32 src
- );
-
-/**
- * Function: armClip_F32
- *
- * Description: Clips the input between MAX and MIN value
- *
- *
- * Remarks:
- *
- * Parameters:
- * [in] Min lower bound
- * [in] Max upper bound
- * [in] src variable to the clipped
- *
- * Return Value:
- * OMX_F32 -- returns clipped value
- */
-
-OMX_F32 armClip_F32 (
- OMX_F32 min,
- OMX_F32 max,
- OMX_F32 src
- );
-
-/**
- * Function: armShiftSat_F32
- *
- * Description: Divides a float value by 2^shift and
- * saturates it for unsigned value range for satBits.
- * Second parameter is like "shifting" the corresponding
- * integer value. Takes care of rounding while clipping the final
- * value.
- *
- * Parameters:
- * [in] v Number to be operated upon
- * [in] shift Divides the input "v" by "2^shift"
- * [in] satBits Final range is [0, 2^satBits)
- *
- * Return Value:
- * OMX_S32 -- returns "shifted" saturated value
- */
-
-OMX_U32 armShiftSat_F32(
- OMX_F32 v,
- OMX_INT shift,
- OMX_INT satBits
- );
-
-/**
- * Functions: armSwapElem
- *
- * Description:
- * This function swaps two elements at the specified pointer locations.
- * The size of each element could be anything as specified by <elemSize>
- *
- * Return Value:
- * OMXResult -- Error status from the function
- */
-OMXResult armSwapElem(OMX_U8 *pBuf1, OMX_U8 *pBuf2, OMX_INT elemSize);
-
-
-/**
- * Function: armMedianOf3
- *
- * Description: Finds the median of three numbers
- *
- * Remarks:
- *
- * Parameters:
- * [in] fEntry First entry
- * [in] sEntry second entry
- * [in] tEntry Third entry
- *
- * Return Value:
- * OMX_S32 -- returns the median value
- */
-
-OMX_S32 armMedianOf3 (
- OMX_S32 fEntry,
- OMX_S32 sEntry,
- OMX_S32 tEntry
- );
-
-/**
- * Function: armLogSize
- *
- * Description: Finds the size of a positive value and returns the same
- *
- * Remarks:
- *
- * Parameters:
- * [in] value Positive value
- *
- * Return Value:
- * OMX_U8 -- returns the size of the positive value
- */
-
-OMX_U8 armLogSize (
- OMX_U16 value
- );
-
-/***********************************************************************/
- /* Saturating Arithmetic operations */
-
-/**
- * Function :armSatAdd_S32()
- *
- * Description :
- * Returns the result of saturated addition of the two inputs Value1, Value2
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- *
- * Return:
- * [out] Result of operation
- *
- *
- **/
-
-OMX_S32 armSatAdd_S32(
- OMX_S32 Value1,
- OMX_S32 Value2
- );
-
-/**
- * Function :armSatAdd_S64()
- *
- * Description :
- * Returns the result of saturated addition of the two inputs Value1, Value2
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- *
- * Return:
- * [out] Result of operation
- *
- *
- **/
-
-OMX_S64 armSatAdd_S64(
- OMX_S64 Value1,
- OMX_S64 Value2
- );
-
-/** Function :armSatSub_S32()
- *
- * Description :
- * Returns the result of saturated substraction of the two inputs Value1, Value2
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S32 armSatSub_S32(
- OMX_S32 Value1,
- OMX_S32 Value2
- );
-
-/**
- * Function :armSatMac_S32()
- *
- * Description :
- * Returns the result of Multiplication of Value1 and Value2 and subesquent saturated
- * accumulation with Mac
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- * [in] Mac Accumulator
- *
- * Return:
- * [out] Result of operation
- **/
-
-OMX_S32 armSatMac_S32(
- OMX_S32 Mac,
- OMX_S16 Value1,
- OMX_S16 Value2
- );
-
-/**
- * Function :armSatMac_S16S32_S32
- *
- * Description :
- * Returns the result of saturated MAC operation of the three inputs delayElem, filTap , mac
- *
- * mac = mac + Saturate_in_32Bits(delayElem * filTap)
- *
- * Parametrs:
- * [in] delayElem First 32 bit Operand
- * [in] filTap Second 16 bit Operand
- * [in] mac Result of MAC operation
- *
- * Return:
- * [out] mac Result of operation
- *
- **/
-
-OMX_S32 armSatMac_S16S32_S32(
- OMX_S32 mac,
- OMX_S32 delayElem,
- OMX_S16 filTap );
-
-/**
- * Function :armSatRoundRightShift_S32_S16
- *
- * Description :
- * Returns the result of rounded right shift operation of input by the scalefactor
- *
- * output = Saturate_in_16Bits( ( RightShift( (Round(input) , scaleFactor ) )
- *
- * Parametrs:
- * [in] input The input to be operated on
- * [in] scaleFactor The shift number
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-
-OMX_S16 armSatRoundRightShift_S32_S16(
- OMX_S32 input,
- OMX_INT scaleFactor);
-
-/**
- * Function :armSatRoundLeftShift_S32()
- *
- * Description :
- * Returns the result of saturating left-shift operation on input
- * Or rounded Right shift if the input Shift is negative.
- *
- * Parametrs:
- * [in] Value Operand
- * [in] shift Operand for shift operation
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S32 armSatRoundLeftShift_S32(
- OMX_S32 Value,
- OMX_INT shift
- );
-
-/**
- * Function :armSatRoundLeftShift_S64()
- *
- * Description :
- * Returns the result of saturating left-shift operation on input
- * Or rounded Right shift if the input Shift is negative.
- *
- * Parametrs:
- * [in] Value Operand
- * [in] shift Operand for shift operation
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S64 armSatRoundLeftShift_S64(
- OMX_S64 Value,
- OMX_INT shift
- );
-
-/**
- * Function :armSatMulS16S32_S32()
- *
- * Description :
- * Returns the result of a S16 data type multiplied with an S32 data type
- * in a S32 container
- *
- * Parametrs:
- * [in] input1 Operand 1
- * [in] input2 Operand 2
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-
-OMX_S32 armSatMulS16S32_S32(
- OMX_S16 input1,
- OMX_S32 input2);
-
-/**
- * Function :armSatMulS32S32_S32()
- *
- * Description :
- * Returns the result of a S32 data type multiplied with an S32 data type
- * in a S32 container
- *
- * Parametrs:
- * [in] input1 Operand 1
- * [in] input2 Operand 2
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S32 armSatMulS32S32_S32(
- OMX_S32 input1,
- OMX_S32 input2);
-
-
-/**
- * Function :armIntDivAwayFromZero()
- *
- * Description : Integer division with rounding to the nearest integer.
- * Half-integer values are rounded away from zero
- * unless otherwise specified. For example 3//2 is rounded
- * to 2, and -3//2 is rounded to -2.
- *
- * Parametrs:
- * [in] Num Operand 1
- * [in] Deno Operand 2
- *
- * Return:
- * [out] Result of operation input1//input2
- *
- **/
-
-OMX_S32 armIntDivAwayFromZero (OMX_S32 Num, OMX_S32 Deno);
-
-
-/***********************************************************************/
-/*
- * Debugging macros
- *
- */
-
-
-/*
- * Definition of output stream - change to stderr if necessary
- */
-#define DEBUG_STREAM stdout
-
-/*
- * Debug printf macros, one for each argument count.
- * Add more if needed.
- */
-#ifdef DEBUG_ON
-#include <stdio.h>
-
-#define DEBUG_PRINTF_0(a) fprintf(DEBUG_STREAM, a)
-#define DEBUG_PRINTF_1(a, b) fprintf(DEBUG_STREAM, a, b)
-#define DEBUG_PRINTF_2(a, b, c) fprintf(DEBUG_STREAM, a, b, c)
-#define DEBUG_PRINTF_3(a, b, c, d) fprintf(DEBUG_STREAM, a, b, c, d)
-#define DEBUG_PRINTF_4(a, b, c, d, e) fprintf(DEBUG_STREAM, a, b, c, d, e)
-#define DEBUG_PRINTF_5(a, b, c, d, e, f) fprintf(DEBUG_STREAM, a, b, c, d, e, f)
-#define DEBUG_PRINTF_6(a, b, c, d, e, f, g) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g)
-#define DEBUG_PRINTF_7(a, b, c, d, e, f, g, h) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h)
-#define DEBUG_PRINTF_8(a, b, c, d, e, f, g, h, i) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i)
-#define DEBUG_PRINTF_9(a, b, c, d, e, f, g, h, i, j) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i, j)
-#define DEBUG_PRINTF_10(a, b, c, d, e, f, g, h, i, j, k) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i, j, k)
-#define DEBUG_PRINTF_11(a, b, c, d, e, f, g, h, i, j, k, l) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i, j, k, l)
-#define DEBUG_PRINTF_12(a, b, c, d, e, f, g, h, i, j, k, l, m) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i, j, k, l, m)
-#define DEBUG_PRINTF_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i, j, k, l, m, n)
-#define DEBUG_PRINTF_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) fprintf(DEBUG_STREAM, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
-#else /* DEBUG_ON */
-#define DEBUG_PRINTF_0(a)
-#define DEBUG_PRINTF_1(a, b)
-#define DEBUG_PRINTF_2(a, b, c)
-#define DEBUG_PRINTF_3(a, b, c, d)
-#define DEBUG_PRINTF_4(a, b, c, d, e)
-#define DEBUG_PRINTF_5(a, b, c, d, e, f)
-#define DEBUG_PRINTF_6(a, b, c, d, e, f, g)
-#define DEBUG_PRINTF_7(a, b, c, d, e, f, g, h)
-#define DEBUG_PRINTF_8(a, b, c, d, e, f, g, h, i)
-#define DEBUG_PRINTF_9(a, b, c, d, e, f, g, h, i, j)
-#define DEBUG_PRINTF_10(a, b, c, d, e, f, g, h, i, j, k)
-#define DEBUG_PRINTF_11(a, b, c, d, e, f, g, h, i, j, k, l)
-#define DEBUG_PRINTF_12(a, b, c, d, e, f, g, h, i, j, k, l, m)
-#define DEBUG_PRINTF_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n)
-#define DEBUG_PRINTF_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
-#endif /* DEBUG_ON */
-
-
-/*
- * Domain and sub domain definitions
- *
- * In order to turn on debug for an entire domain or sub-domain
- * at compile time, one of the DEBUG_DOMAIN_* below may be defined,
- * which will activate debug in all of the defines it contains.
- */
-
-#ifdef DEBUG_DOMAIN_AC
-#define DEBUG_OMXACAAC_DECODECHANPAIRELT_MPEG4
-#define DEBUG_OMXACAAC_DECODECHANPAIRELT
-#define DEBUG_OMXACAAC_DECODEDATSTRELT
-#define DEBUG_OMXACAAC_DECODEFILLELT
-#define DEBUG_OMXACAAC_DECODEISSTEREO_S32
-#define DEBUG_OMXACAAC_DECODEMSPNS_S32
-#define DEBUG_OMXACAAC_DECODEMSSTEREO_S32_I
-#define DEBUG_OMXACAAC_DECODEPRGCFGELT
-#define DEBUG_OMXACAAC_DECODETNS_S32_I
-#define DEBUG_OMXACAAC_DEINTERLEAVESPECTRUM_S32
-#define DEBUG_OMXACAAC_ENCODETNS_S32_I
-#define DEBUG_OMXACAAC_LONGTERMPREDICT_S32
-#define DEBUG_OMXACAAC_LONGTERMRECONSTRUCT_S32
-#define DEBUG_OMXACAAC_MDCTFWD_S32
-#define DEBUG_OMXACAAC_MDCTINV_S32_S16
-#define DEBUG_OMXACAAC_NOISELESSDECODE
-#define DEBUG_OMXACAAC_QUANTINV_S32_I
-#define DEBUG_OMXACAAC_UNPACKADIFHEADER
-#define DEBUG_OMXACAAC_UNPACKADTSFRAMEHEADER
-#define DEBUG_OMXACMP3_HUFFMANDECODESFBMBP_S32
-#define DEBUG_OMXACMP3_HUFFMANDECODESFB_S32
-#define DEBUG_OMXACMP3_HUFFMANDECODE_S32
-#define DEBUG_OMXACMP3_MDCTINV_S32
-#define DEBUG_OMXACMP3_REQUANTIZESFB_S32_I
-#define DEBUG_OMXACMP3_REQUANTIZE_S32_I
-#define DEBUG_OMXACMP3_SYNTHPQMF_S32_S16
-#define DEBUG_OMXACMP3_UNPACKFRAMEHEADER
-#define DEBUG_OMXACMP3_UNPACKSCALEFACTORS_S8
-#define DEBUG_OMXACMP3_UNPACKSIDEINFO
-#endif /* DEBUG_DOMAIN_AC */
-
-
-#ifdef DEBUG_DOMAIN_VC
-#define DEBUG_OMXVCM4P10_AVERAGE_16X
-#define DEBUG_OMXVCM4P10_AVERAGE_4X
-#define DEBUG_OMXVCM4P10_AVERAGE_8X
-#define DEBUG_OMXVCM4P10_DEBLOCKCHROMA_U8_C1IR
-#define DEBUG_OMXVCM4P10_DEBLOCKLUMA_U8_C1IR
-#define DEBUG_OMXVCM4P10_DECODECHROMADCCOEFFSTOPAIRCAVLC_U8
-#define DEBUG_OMXVCM4P10_DECODECOEFFSTOPAIRCAVLC_U8
-#define DEBUG_OMXVCM4P10_DEQUANTTRANSFORMACFROMPAIR_U8_S16_C1_DLX
-#define DEBUG_OMXVCM4P10_EXPANDFRAME
-#define DEBUG_OMXVCM4P10_FILTERDEBLOCKINGCHROMA_HOREDGE_U8_C1IR
-#define DEBUG_OMXVCM4P10_FILTERDEBLOCKINGCHROMA_VEREDGE_U8_C1IR
-#define DEBUG_OMXVCM4P10_FILTERDEBLOCKINGLUMA_HOREDGE_U8_C1IR
-#define DEBUG_OMXVCM4P10_FILTERDEBLOCKINGLUMA_VEREDGE_U8_C1IR
-#define DEBUG_OMXVCM4P10_PREDICTINTRACHROMA8X8_U8_C1R
-#define DEBUG_OMXVCM4P10_PREDICTINTRA_16X16_U8_C1R
-#define DEBUG_OMXVCM4P10_PREDICTINTRA_4X4_U8_C1R
-#define DEBUG_OMXVCM4P10_SADQUAR_16X
-#define DEBUG_OMXVCM4P10_SADQUAR_4X
-#define DEBUG_OMXVCM4P10_SADQUAR_8X
-#define DEBUG_OMXVCM4P10_SAD_16X
-#define DEBUG_OMXVCM4P10_SAD_4X
-#define DEBUG_OMXVCM4P10_SAD_8X
-#define DEBUG_OMXVCM4P10_SATD_4X4
-#define DEBUG_OMXVCM4P10_TRANSFORMDEQUANTCHROMADCFROMPAIR_U8_S16_C1
-#define DEBUG_OMXVCM4P10_TRANSFORMDEQUANTLUMADCFROMPAIR_U8_S16_C1
-#define DEBUG_OMXVCM4P10_TRANSFORMQUANT_CHROMADC
-#define DEBUG_OMXVCM4P10_TRANSFORMQUANT_LUMADC
-#define DEBUG_OMXVCM4P2_BLOCKMATCH_HALF_16X16
-#define DEBUG_OMXVCM4P2_BLOCKMATCH_HALF_8X8
-#define DEBUG_OMXVCM4P2_BLOCKMATCH_INTEGER_16X16
-#define DEBUG_OMXVCM4P2_BLOCKMATCH_INTEGER_8X8
-#define DEBUG_OMXVCM4P2_COMPUTETEXTUREERRORBLOCK_SAD_U8_S16
-#define DEBUG_OMXVCM4P2_COMPUTETEXTUREERRORBLOCK_U8_S16
-#define DEBUG_OMXVCM4P2_DCT8X8BLKDLX
-#define DEBUG_OMXVCM4P2_DECODEBLOCKCOEF_INTER_S16
-#define DEBUG_OMXVCM4P2_DECODEPADMV_PVOP
-#define DEBUG_OMXVCM4P2_DECODEVLCZIGZAG_INTER_S16
-#define DEBUG_OMXVCM4P2_DECODEVLCZIGZAG_INTRAACVLC_S16
-#define DEBUG_OMXVCM4P2_DECODEVLCZIGZAG_INTRADCVLC_S16
-#define DEBUG_OMXVCM4P2_ENCODEMV_U8_S16
-#define DEBUG_OMXVCM4P2_ENCODEVLCZIGZAG_INTER_S16
-#define DEBUG_OMXVCM4P2_ENCODEVLCZIGZAG_INTRAACVLC_S16
-#define DEBUG_OMXVCM4P2_ENCODEVLCZIGZAG_INTRADCVLC_S16
-#define DEBUG_OMXVCM4P2_FINDMVPRED
-#define DEBUG_OMXVCM4P2_IDCT8X8BLKDLX
-#define DEBUG_OMXVCM4P2_LIMITMVTORECT
-#define DEBUG_OMXVCM4P2_MOTIONESTIMATIONMB
-#define DEBUG_OMXVCM4P2_PADMBGRAY_U8
-#define DEBUG_OMXVCM4P2_PADMBHORIZONTAL_U8
-#define DEBUG_OMXVCM4P2_PADMBVERTICAL_U8
-#define DEBUG_OMXVCM4P2_PADMV
-#define DEBUG_OMXVCM4P2_QUANTINTER_S16_I
-#define DEBUG_OMXVCM4P2_QUANTINTRA_S16_I
-#define DEBUG_OMXVCM4P2_QUANTINVINTER_S16_I
-#define DEBUG_OMXVCM4P2_QUANTINVINTRA_S16_I
-#define DEBUG_OMXVCM4P2_TRANSRECBLOCKCEOF_INTER
-#define DEBUG_OMXVCM4P2_TRANSRECBLOCKCEOF_INTRA
-#endif /* DEBUG_DOMAIN_VC */
-
-
-#ifdef DEBUG_DOMAIN_IC
-/* To be filled in */
-#endif /* DEBUG_DOMAIN_IC */
-
-
-#ifdef DEBUG_DOMAIN_SP
-#define DEBUG_OMXACSP_DOTPROD_S16
-#define DEBUG_OMXACSP_BLOCKEXP_S16
-#define DEBUG_OMXACSP_BLOCKEXP_S32
-#define DEBUG_OMXACSP_COPY_S16
-#define DEBUG_OMXACSP_DOTPROD_S16
-#define DEBUG_OMXACSP_DOTPROD_S16_SFS
-#define DEBUG_OMXACSP_FFTFWD_CTOC_SC16_SFS
-#define DEBUG_OMXACSP_FFTFWD_CTOC_SC32_SFS
-#define DEBUG_OMXACSP_FFTFWD_RTOCCS_S16S32_SFS
-#define DEBUG_OMXACSP_FFTFWD_RTOCCS_S32_SFS
-#define DEBUG_OMXACSP_FFTGETBUFSIZE_C_SC16
-#define DEBUG_OMXACSP_FFTGETBUFSIZE_C_SC32
-#define DEBUG_OMXACSP_FFTGETBUFSIZE_R_S16_S32
-#define DEBUG_OMXACSP_FFTGETBUFSIZE_R_S32
-#define DEBUG_OMXACSP_FFTINIT_C_SC16
-#define DEBUG_OMXACSP_FFTINIT_C_SC32
-#define DEBUG_OMXACSP_FFTINIT_R_S16_S32
-#define DEBUG_OMXACSP_FFTINIT_R_S32
-#define DEBUG_OMXACSP_FFTINV_CCSTOR_S32S16_SFS
-#define DEBUG_OMXACSP_FFTINV_CCSTOR_S32_SFS
-#define DEBUG_OMXACSP_FFTINV_CTOC_SC16_SFS
-#define DEBUG_OMXACSP_FFTINV_CTOC_SC32_SFS
-#define DEBUG_OMXACSP_FILTERMEDIAN_S32_I
-#define DEBUG_OMXACSP_FILTERMEDIAN_S32
-#define DEBUG_OMXACSP_FIRONE_DIRECT_S16_ISFS
-#define DEBUG_OMXACSP_FIRONE_DIRECT_S16_I
-#define DEBUG_OMXACSP_FIRONE_DIRECT_S16
-#define DEBUG_OMXACSP_FIRONE_DIRECT_S16_SFS
-#define DEBUG_OMXACSP_FIR_DIRECT_S16_ISFS
-#define DEBUG_OMXACSP_FIR_DIRECT_S16_I
-#define DEBUG_OMXACSP_FIR_DIRECT_S16
-#define DEBUG_OMXACSP_FIR_DIRECT_S16_SFS
-#define DEBUG_OMXACSP_IIRONE_BIQUADDIRECT_S16_I
-#define DEBUG_OMXACSP_IIRONE_BIQUADDIRECT_S16
-#define DEBUG_OMXACSP_IIRONE_DIRECT_S16_I
-#define DEBUG_OMXACSP_IIRONE_DIRECT_S16
-#define DEBUG_OMXACSP_IIR_BIQUADDIRECT_S16_I
-#define DEBUG_OMXACSP_IIR_BIQUADDIRECT_S16
-#define DEBUG_OMXACSP_IIR_DIRECT_S16_I
-#define DEBUG_OMXACSP_IIR_DIRECT_S16
-#endif /* DEBUG_DOMAIN_SP */
-
-
-#ifdef DEBUG_DOMAIN_IP
-#define DEBUG_OMXIPBM_ADDC_U8_C1R_SFS
-#define DEBUG_OMXIPBM_COPY_U8_C1R
-#define DEBUG_OMXIPBM_COPY_U8_C3R
-#define DEBUG_OMXIPBM_MIRROR_U8_C1R
-#define DEBUG_OMXIPBM_MULC_U8_C1R_SFS
-#define DEBUG_OMXIPCS_COLORTWISTQ14_U8_C3R
-#define DEBUG_OMXIPCS_RGB565TOYCBCR420LS_MCU_U16_S16_C3P3R
-#define DEBUG_OMXIPCS_RGB565TOYCBCR422LS_MCU_U16_S16_C3P3R
-#define DEBUG_OMXIPCS_RGB565TOYCBCR444LS_MCU_U16_S16_C3P3R
-#define DEBUG_OMXIPCS_RGBTOYCBCR420LS_MCU_U8_S16_C3P3R
-#define DEBUG_OMXIPCS_RGBTOYCBCR422LS_MCU_U8_S16_C3P3R
-#define DEBUG_OMXIPCS_RGBTOYCBCR444LS_MCU_U8_S16_C3P3R
-#define DEBUG_OMXIPCS_YCBCR420RSZROT_U8_P3R
-#define DEBUG_OMXIPCS_YCBCR420TORGB565LS_MCU_S16_U16_P3C3R
-#define DEBUG_OMXIPCS_YCBCR420TORGB565_U8_U16_P3C3R
-#define DEBUG_OMXIPCS_YCBCR420TORGBLS_MCU_S16_U8_P3C3R
-#define DEBUG_OMXIPCS_YCBCR422RSZCSCROTRGB_U8_C2R
-#define DEBUG_OMXIPCS_YCBCR422RSZROT_U8_P3R
-#define DEBUG_OMXIPCS_YCBCR422TORGB565LS_MCU_S16_U16_P3C3R
-#define DEBUG_OMXIPCS_YCBCR422TORGB565_U8_U16_C2C3R
-#define DEBUG_OMXIPCS_YCBCR422TORGBLS_MCU_S16_U8_P3C3R
-#define DEBUG_OMXIPCS_YCBCR422TORGB_U8_C2C3R
-#define DEBUG_OMXIPCS_YCBCR422TOYCBCR420ROTATE_U8_C2P3R
-#define DEBUG_OMXIPCS_YCBCR422TOYCBCR420ROTATE_U8_P3R
-#define DEBUG_OMXIPCS_YCBCR444TORGB565LS_MCU_S16_U16_P3C3R
-#define DEBUG_OMXIPCS_YCBCR444TORGBLS_MCU_S16_U8_P3C3R
-#define DEBUG_OMXIPCS_YCBCRTORGB565_U8_U16_C3R
-#define DEBUG_OMXIPCS_YCBCRTORGB565_U8_U16_P3C3R
-#define DEBUG_OMXIPCS_YCBCRTORGB_U8_C3R
-#define DEBUG_OMXIPPP_GETCENTRALMOMENT_S64
-#define DEBUG_OMXIPPP_GETSPATIALMOMENT_S64
-#define DEBUG_OMXIPPP_MOMENTGETSTATESIZE_S64
-#define DEBUG_OMXIPPP_MOMENTINIT_S64
-#define DEBUG_OMXIPPP_MOMENTS64S_U8_C1R
-#define DEBUG_OMXIPPP_MOMENTS64S_U8_C3R
-#endif /* DEBUG_DOMAIN_IP */
-
-
-#endif /* _armCommon_H_ */
-
-/*End of File*/
-
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/api/armCOMM_Bitstream.h b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/api/armCOMM_Bitstream.h
deleted file mode 100644
index 576b66d..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/api/armCOMM_Bitstream.h
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armCOMM_Bitstream.h
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * File: armCOMM_Bitstream.h
- * Brief: Declares common API's/Data types used across the OpenMax Encoders/Decoders.
- *
- */
-
-#ifndef _armCodec_H_
-#define _armCodec_H_
-
-#include "omxtypes.h"
-
-typedef struct {
- OMX_U8 codeLen;
- OMX_U32 codeWord;
-} ARM_VLC32;
-
-/* The above should be renamed as "ARM_VLC32" */
-
-/**
- * Function: armLookAheadBits()
- *
- * Description:
- * Get the next N bits from the bitstream without advancing the bitstream pointer
- *
- * Parameters:
- * [in] **ppBitStream
- * [in] *pOffset
- * [in] N=1...32
- *
- * Returns Value
- */
-
-OMX_U32 armLookAheadBits(const OMX_U8 **ppBitStream, OMX_INT *pOffset, OMX_INT N);
-
-/**
- * Function: armGetBits()
- *
- * Description:
- * Read N bits from the bitstream
- *
- * Parameters:
- * [in] *ppBitStream
- * [in] *pOffset
- * [in] N=1..32
- *
- * [out] *ppBitStream
- * [out] *pOffset
- * Returns Value
- */
-
-OMX_U32 armGetBits(const OMX_U8 **ppBitStream, OMX_INT *pOffset, OMX_INT N);
-
-/**
- * Function: armByteAlign()
- *
- * Description:
- * Align the pointer *ppBitStream to the next byte boundary
- *
- * Parameters:
- * [in] *ppBitStream
- * [in] *pOffset
- *
- * [out] *ppBitStream
- * [out] *pOffset
- *
- **/
-
-OMXVoid armByteAlign(const OMX_U8 **ppBitStream,OMX_INT *pOffset);
-
-/**
- * Function: armSkipBits()
- *
- * Description:
- * Skip N bits from the value at *ppBitStream
- *
- * Parameters:
- * [in] *ppBitStream
- * [in] *pOffset
- * [in] N
- *
- * [out] *ppBitStream
- * [out] *pOffset
- *
- **/
-
-OMXVoid armSkipBits(const OMX_U8 **ppBitStream,OMX_INT *pOffset,OMX_INT N);
-
-/***************************************
- * Variable bit length Decode
- ***************************************/
-
-/**
- * Function: armUnPackVLC32()
- *
- * Description:
- * Variable length decode of variable length symbol (max size 32 bits) read from
- * the bit stream pointed by *ppBitStream at *pOffset by using the table
- * pointed by pCodeBook
- *
- * Parameters:
- * [in] **ppBitStream
- * [in] *pOffset
- * [in] pCodeBook
- *
- * [out] **ppBitStream
- * [out] *pOffset
- *
- * Returns : Code Book Index if successfull.
- * : "ARM_NO_CODEBOOK_INDEX = 0xFFFF" if search fails.
- **/
-
-#define ARM_NO_CODEBOOK_INDEX (OMX_U16)(0xFFFF)
-
-OMX_U16 armUnPackVLC32(
- const OMX_U8 **ppBitStream,
- OMX_INT *pOffset,
- const ARM_VLC32 *pCodeBook
-);
-
-/***************************************
- * Fixed bit length Encode
- ***************************************/
-
-/**
- * Function: armPackBits
- *
- * Description:
- * Pack a VLC code word into the bitstream
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte
- * in the bit stream.
- * [in] pOffset pointer to the bit position in the byte
- * pointed by *ppBitStream. Valid within 0
- * to 7.
- * [in] codeWord Code word that need to be inserted in to the
- * bitstream
- * [in] codeLength Length of the code word valid range 1...32
- *
- * [out] ppBitStream *ppBitStream is updated after the block is encoded,
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMX_RESULT result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armPackBits (
- OMX_U8 **ppBitStream,
- OMX_INT *pOffset,
- OMX_U32 codeWord,
- OMX_INT codeLength
-);
-
-/***************************************
- * Variable bit length Encode
- ***************************************/
-
-/**
- * Function: armPackVLC32
- *
- * Description:
- * Pack a VLC code word into the bitstream
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte
- * in the bit stream.
- * [in] pBitOffset pointer to the bit position in the byte
- * pointed by *ppBitStream. Valid within 0
- * to 7.
- * [in] code VLC code word that need to be inserted in to the
- * bitstream
- *
- * [out] ppBitStream *ppBitStream is updated after the block is encoded,
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMX_RESULT result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armPackVLC32 (
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- ARM_VLC32 code
-);
-
-#endif /*_armCodec_H_*/
-
-/*End of File*/
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/api/armCOMM_Version.h b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/api/armCOMM_Version.h
deleted file mode 100644
index e99a450..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/api/armCOMM_Version.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Guard the header against multiple inclusion. */
-#ifndef __ARM_COMM_VERSION_H__
-#define __ARM_COMM_VERSION_H__
-
-
-/* The following line should be in omxtypes.h but hasn't been approved by OpenMAX yet */
-#define OMX_VERSION 102
-
-/* We need to define these macros in order to convert a #define number into a #define string. */
-#define ARM_QUOTE(a) #a
-#define ARM_INDIRECT(A) ARM_QUOTE(A)
-
-/* Convert the OMX_VERSION number into a string that can be used, for example, to print it out. */
-#define ARM_VERSION_STRING ARM_INDIRECT(OMX_VERSION)
-
-
-/* Define this in order to turn on ARM version/release/build strings in each domain */
-#define ARM_INCLUDE_VERSION_DESCRIPTIONS
-
-#ifdef ARM_INCLUDE_VERSION_DESCRIPTIONS
- extern const char * const omxAC_VersionDescription;
- extern const char * const omxIC_VersionDescription;
- extern const char * const omxIP_VersionDescription;
- extern const char * const omxSP_VersionDescription;
- extern const char * const omxVC_VersionDescription;
-#endif /* ARM_INCLUDE_VERSION_DESCRIPTIONS */
-
-
-/* The following entries should be automatically updated by the release script */
-/* They are used in the ARM version strings defined for each domain. */
-
-/* The release tag associated with this release of the library. - used for source and object releases */
-#define OMX_ARM_RELEASE_TAG "r0p0-00bet1"
-
-/* The ARM architecture used to build any objects or executables in this release. */
-#define OMX_ARM_BUILD_ARCHITECTURE "ANSI C"
-
-/* The ARM Toolchain used to build any objects or executables in this release. */
-#define OMX_ARM_BUILD_TOOLCHAIN "ARM RVCT 3.1"
-
-
-#endif /* __ARM_COMM_VERSION_H__ */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/api/armOMX.h b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/api/armOMX.h
deleted file mode 100644
index e7c0c26..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/api/armOMX.h
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*
- *
- * File Name: armOMX_ReleaseVersion.h
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * This file allows a version of the OMX DL libraries to be built where some or
- * all of the function names can be given a user specified suffix.
- *
- * You might want to use it where:
- *
- * - you want to rename a function "out of the way" so that you could replace
- * a function with a different version (the original version would still be
- * in the library just with a different name - so you could debug the new
- * version by comparing it to the output of the old)
- *
- * - you want to rename all the functions to versions with a suffix so that
- * you can include two versions of the library and choose between functions
- * at runtime.
- *
- * e.g. omxIPBM_Copy_U8_C1R could be renamed omxIPBM_Copy_U8_C1R_CortexA8
- *
- */
-
-
-#ifndef _armOMX_H_
-#define _armOMX_H_
-
-
-/* We need to define these two macros in order to expand and concatenate the names */
-#define OMXCAT2BAR(A, B) omx ## A ## B
-#define OMXCATBAR(A, B) OMXCAT2BAR(A, B)
-
-/* Define the suffix to add to all functions - the default is no suffix */
-#define BARE_SUFFIX
-
-
-
-/* Define what happens to the bare suffix-less functions, down to the sub-domain accuracy */
-#define OMXACAAC_SUFFIX BARE_SUFFIX
-#define OMXACMP3_SUFFIX BARE_SUFFIX
-#define OMXICJP_SUFFIX BARE_SUFFIX
-#define OMXIPBM_SUFFIX BARE_SUFFIX
-#define OMXIPCS_SUFFIX BARE_SUFFIX
-#define OMXIPPP_SUFFIX BARE_SUFFIX
-#define OMXSP_SUFFIX BARE_SUFFIX
-#define OMXVCCOMM_SUFFIX BARE_SUFFIX
-#define OMXVCM4P10_SUFFIX BARE_SUFFIX
-#define OMXVCM4P2_SUFFIX BARE_SUFFIX
-
-
-
-
-/* Define what the each bare, un-suffixed OpenMAX API function names is to be renamed */
-#define omxACAAC_DecodeChanPairElt OMXCATBAR(ACAAC_DecodeChanPairElt, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodeDatStrElt OMXCATBAR(ACAAC_DecodeDatStrElt, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodeFillElt OMXCATBAR(ACAAC_DecodeFillElt, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodeIsStereo_S32 OMXCATBAR(ACAAC_DecodeIsStereo_S32, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodeMsPNS_S32_I OMXCATBAR(ACAAC_DecodeMsPNS_S32_I, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodeMsStereo_S32_I OMXCATBAR(ACAAC_DecodeMsStereo_S32_I, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodePrgCfgElt OMXCATBAR(ACAAC_DecodePrgCfgElt, OMXACAAC_SUFFIX)
-#define omxACAAC_DecodeTNS_S32_I OMXCATBAR(ACAAC_DecodeTNS_S32_I, OMXACAAC_SUFFIX)
-#define omxACAAC_DeinterleaveSpectrum_S32 OMXCATBAR(ACAAC_DeinterleaveSpectrum_S32, OMXACAAC_SUFFIX)
-#define omxACAAC_EncodeTNS_S32_I OMXCATBAR(ACAAC_EncodeTNS_S32_I, OMXACAAC_SUFFIX)
-#define omxACAAC_LongTermPredict_S32 OMXCATBAR(ACAAC_LongTermPredict_S32, OMXACAAC_SUFFIX)
-#define omxACAAC_LongTermReconstruct_S32_I OMXCATBAR(ACAAC_LongTermReconstruct_S32_I, OMXACAAC_SUFFIX)
-#define omxACAAC_MDCTFwd_S32 OMXCATBAR(ACAAC_MDCTFwd_S32, OMXACAAC_SUFFIX)
-#define omxACAAC_MDCTInv_S32_S16 OMXCATBAR(ACAAC_MDCTInv_S32_S16, OMXACAAC_SUFFIX)
-#define omxACAAC_NoiselessDecode OMXCATBAR(ACAAC_NoiselessDecode, OMXACAAC_SUFFIX)
-#define omxACAAC_QuantInv_S32_I OMXCATBAR(ACAAC_QuantInv_S32_I, OMXACAAC_SUFFIX)
-#define omxACAAC_UnpackADIFHeader OMXCATBAR(ACAAC_UnpackADIFHeader, OMXACAAC_SUFFIX)
-#define omxACAAC_UnpackADTSFrameHeader OMXCATBAR(ACAAC_UnpackADTSFrameHeader, OMXACAAC_SUFFIX)
-
-
-#define omxACMP3_HuffmanDecode_S32 OMXCATBAR(ACMP3_HuffmanDecode_S32, OMXACMP3_SUFFIX)
-#define omxACMP3_HuffmanDecodeSfb_S32 OMXCATBAR(ACMP3_HuffmanDecodeSfb_S32, OMXACMP3_SUFFIX)
-#define omxACMP3_HuffmanDecodeSfbMbp_S32 OMXCATBAR(ACMP3_HuffmanDecodeSfbMbp_S32, OMXACMP3_SUFFIX)
-#define omxACMP3_MDCTInv_S32 OMXCATBAR(ACMP3_MDCTInv_S32, OMXACMP3_SUFFIX)
-#define omxACMP3_ReQuantize_S32_I OMXCATBAR(ACMP3_ReQuantize_S32_I, OMXACMP3_SUFFIX)
-#define omxACMP3_ReQuantizeSfb_S32_I OMXCATBAR(ACMP3_ReQuantizeSfb_S32_I, OMXACMP3_SUFFIX)
-#define omxACMP3_SynthPQMF_S32_S16 OMXCATBAR(ACMP3_SynthPQMF_S32_S16, OMXACMP3_SUFFIX)
-#define omxACMP3_UnpackFrameHeader OMXCATBAR(ACMP3_UnpackFrameHeader, OMXACMP3_SUFFIX)
-#define omxACMP3_UnpackScaleFactors_S8 OMXCATBAR(ACMP3_UnpackScaleFactors_S8, OMXACMP3_SUFFIX)
-#define omxACMP3_UnpackSideInfo OMXCATBAR(ACMP3_UnpackSideInfo, OMXACMP3_SUFFIX)
-
-#define omxICJP_CopyExpand_U8_C3 OMXCATBAR(ICJP_CopyExpand_U8_C3, OMXICJP_SUFFIX)
-#define omxICJP_DCTFwd_S16 OMXCATBAR(ICJP_DCTFwd_S16, OMXICJP_SUFFIX)
-#define omxICJP_DCTFwd_S16_I OMXCATBAR(ICJP_DCTFwd_S16_I, OMXICJP_SUFFIX)
-#define omxICJP_DCTInv_S16 OMXCATBAR(ICJP_DCTInv_S16, OMXICJP_SUFFIX)
-#define omxICJP_DCTInv_S16_I OMXCATBAR(ICJP_DCTInv_S16_I, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantFwd_Multiple_S16 OMXCATBAR(ICJP_DCTQuantFwd_Multiple_S16, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantFwd_S16 OMXCATBAR(ICJP_DCTQuantFwd_S16, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantFwd_S16_I OMXCATBAR(ICJP_DCTQuantFwd_S16_I, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantFwdTableInit OMXCATBAR(ICJP_DCTQuantFwdTableInit, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantInv_Multiple_S16 OMXCATBAR(ICJP_DCTQuantInv_Multiple_S16, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantInv_S16 OMXCATBAR(ICJP_DCTQuantInv_S16, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantInv_S16_I OMXCATBAR(ICJP_DCTQuantInv_S16_I, OMXICJP_SUFFIX)
-#define omxICJP_DCTQuantInvTableInit OMXCATBAR(ICJP_DCTQuantInvTableInit, OMXICJP_SUFFIX)
-#define omxICJP_DecodeHuffman8x8_Direct_S16_C1 OMXCATBAR(ICJP_DecodeHuffman8x8_Direct_S16_C1, OMXICJP_SUFFIX)
-#define omxICJP_DecodeHuffmanSpecGetBufSize_U8 OMXCATBAR(ICJP_DecodeHuffmanSpecGetBufSize_U8, OMXICJP_SUFFIX)
-#define omxICJP_DecodeHuffmanSpecInit_U8 OMXCATBAR(ICJP_DecodeHuffmanSpecInit_U8, OMXICJP_SUFFIX)
-#define omxICJP_EncodeHuffman8x8_Direct_S16_U1_C1 OMXCATBAR(ICJP_EncodeHuffman8x8_Direct_S16_U1_C1, OMXICJP_SUFFIX)
-#define omxICJP_EncodeHuffmanSpecGetBufSize_U8 OMXCATBAR(ICJP_EncodeHuffmanSpecGetBufSize_U8, OMXICJP_SUFFIX)
-#define omxICJP_EncodeHuffmanSpecInit_U8 OMXCATBAR(ICJP_EncodeHuffmanSpecInit_U8, OMXICJP_SUFFIX)
-
-#define omxIPBM_AddC_U8_C1R_Sfs OMXCATBAR(IPBM_AddC_U8_C1R_Sfs, OMXIPBM_SUFFIX)
-#define omxIPBM_Copy_U8_C1R OMXCATBAR(IPBM_Copy_U8_C1R, OMXIPBM_SUFFIX)
-#define omxIPBM_Copy_U8_C3R OMXCATBAR(IPBM_Copy_U8_C3R, OMXIPBM_SUFFIX)
-#define omxIPBM_Mirror_U8_C1R OMXCATBAR(IPBM_Mirror_U8_C1R, OMXIPBM_SUFFIX)
-#define omxIPBM_MulC_U8_C1R_Sfs OMXCATBAR(IPBM_MulC_U8_C1R_Sfs, OMXIPBM_SUFFIX)
-
-#define omxIPCS_ColorTwistQ14_U8_C3R OMXCATBAR(IPCS_ColorTwistQ14_U8_C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_BGR565ToYCbCr420LS_MCU_U16_S16_C3P3R OMXCATBAR(IPCS_BGR565ToYCbCr420LS_MCU_U16_S16_C3P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_BGR565ToYCbCr422LS_MCU_U16_S16_C3P3R OMXCATBAR(IPCS_BGR565ToYCbCr422LS_MCU_U16_S16_C3P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_BGR565ToYCbCr444LS_MCU_U16_S16_C3P3R OMXCATBAR(IPCS_BGR565ToYCbCr444LS_MCU_U16_S16_C3P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_BGR888ToYCbCr420LS_MCU_U8_S16_C3P3R OMXCATBAR(IPCS_BGR888ToYCbCr420LS_MCU_U8_S16_C3P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_BGR888ToYCbCr422LS_MCU_U8_S16_C3P3R OMXCATBAR(IPCS_BGR888ToYCbCr422LS_MCU_U8_S16_C3P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_BGR888ToYCbCr444LS_MCU_U8_S16_C3P3R OMXCATBAR(IPCS_BGR888ToYCbCr444LS_MCU_U8_S16_C3P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr420RszCscRotBGR_U8_P3C3R OMXCATBAR(IPCS_YCbCr420RszCscRotBGR_U8_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr420RszRot_U8_P3R OMXCATBAR(IPCS_YCbCr420RszRot_U8_P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr420ToBGR565_U8_U16_P3C3R OMXCATBAR(IPCS_YCbCr420ToBGR565_U8_U16_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr420ToBGR565LS_MCU_S16_U16_P3C3R OMXCATBAR(IPCS_YCbCr420ToBGR565LS_MCU_S16_U16_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr420ToBGR888LS_MCU_S16_U8_P3C3R OMXCATBAR(IPCS_YCbCr420ToBGR888LS_MCU_S16_U8_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr422RszCscRotBGR_U8_P3C3R OMXCATBAR(IPCS_YCbCr422RszCscRotBGR_U8_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_CbYCrY422RszCscRotBGR_U8_U16_C2R OMXCATBAR(IPCS_CbYCrY422RszCscRotBGR_U8_U16_C2R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr422RszRot_U8_P3R OMXCATBAR(IPCS_YCbCr422RszRot_U8_P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbYCr422ToBGR565_U8_U16_C2C3R OMXCATBAR(IPCS_YCbYCr422ToBGR565_U8_U16_C2C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr422ToBGR565LS_MCU_S16_U16_P3C3R OMXCATBAR(IPCS_YCbCr422ToBGR565LS_MCU_S16_U16_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbYCr422ToBGR888_U8_C2C3R OMXCATBAR(IPCS_YCbYCr422ToBGR888_U8_C2C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr422ToBGR888LS_MCU_S16_U8_P3C3R OMXCATBAR(IPCS_YCbCr422ToBGR888LS_MCU_S16_U8_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr422ToBGR888LS_MCU_S16_U8_P3C3R OMXCATBAR(IPCS_YCbCr422ToBGR888LS_MCU_S16_U8_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_CbYCrY422ToYCbCr420Rotate_U8_C2P3R OMXCATBAR(IPCS_CbYCrY422ToYCbCr420Rotate_U8_C2P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr422ToYCbCr420Rotate_U8_P3R OMXCATBAR(IPCS_YCbCr422ToYCbCr420Rotate_U8_P3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr444ToBGR565_U8_U16_C3R OMXCATBAR(IPCS_YCbCr444ToBGR565_U8_U16_C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr444ToBGR565_U8_U16_P3C3R OMXCATBAR(IPCS_YCbCr444ToBGR565_U8_U16_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr444ToBGR565LS_MCU_S16_U16_P3C3R OMXCATBAR(IPCS_YCbCr444ToBGR565LS_MCU_S16_U16_P3C3R, OMXIPCS_SUFFIX)
-#define omxIPCS_YCbCr444ToBGR888_U8_C3R OMXCATBAR(IPCS_YCbCr444ToBGR888_U8_C3R, OMXIPCS_SUFFIX)
-
-#define omxIPPP_Deblock_HorEdge_U8_I OMXCATBAR(IPPP_Deblock_HorEdge_U8_I, OMXIPPP_SUFFIX)
-#define omxIPPP_Deblock_VerEdge_U8_I OMXCATBAR(IPPP_Deblock_VerEdge_U8_I, OMXIPPP_SUFFIX)
-#define omxIPPP_FilterFIR_U8_C1R OMXCATBAR(IPPP_FilterFIR_U8_C1R, OMXIPPP_SUFFIX)
-#define omxIPPP_FilterMedian_U8_C1R OMXCATBAR(IPPP_FilterMedian_U8_C1R, OMXIPPP_SUFFIX)
-#define omxIPPP_GetCentralMoment_S64 OMXCATBAR(IPPP_GetCentralMoment_S64, OMXIPPP_SUFFIX)
-#define omxIPPP_GetSpatialMoment_S64 OMXCATBAR(IPPP_GetSpatialMoment_S64, OMXIPPP_SUFFIX)
-#define omxIPPP_MomentGetStateSize OMXCATBAR(IPPP_MomentGetStateSize, OMXIPPP_SUFFIX)
-#define omxIPPP_MomentInit OMXCATBAR(IPPP_MomentInit, OMXIPPP_SUFFIX)
-#define omxIPPP_Moments_U8_C1R OMXCATBAR(IPPP_Moments_U8_C1R, OMXIPPP_SUFFIX)
-#define omxIPPP_Moments_U8_C3R OMXCATBAR(IPPP_Moments_U8_C3R, OMXIPPP_SUFFIX)
-
-#define omxSP_BlockExp_S16 OMXCATBAR(SP_BlockExp_S16, OMXSP_SUFFIX)
-#define omxSP_BlockExp_S32 OMXCATBAR(SP_BlockExp_S32, OMXSP_SUFFIX)
-#define omxSP_Copy_S16 OMXCATBAR(SP_Copy_S16, OMXSP_SUFFIX)
-#define omxSP_DotProd_S16 OMXCATBAR(SP_DotProd_S16, OMXSP_SUFFIX)
-#define omxSP_DotProd_S16_Sfs OMXCATBAR(SP_DotProd_S16_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTFwd_CToC_SC16_Sfs OMXCATBAR(SP_FFTFwd_CToC_SC16_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTFwd_CToC_SC32_Sfs OMXCATBAR(SP_FFTFwd_CToC_SC32_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTFwd_RToCCS_S16S32_Sfs OMXCATBAR(SP_FFTFwd_RToCCS_S16S32_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTFwd_RToCCS_S32_Sfs OMXCATBAR(SP_FFTFwd_RToCCS_S32_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTGetBufSize_C_SC16 OMXCATBAR(SP_FFTGetBufSize_C_SC16, OMXSP_SUFFIX)
-#define omxSP_FFTGetBufSize_C_SC32 OMXCATBAR(SP_FFTGetBufSize_C_SC32, OMXSP_SUFFIX)
-#define omxSP_FFTGetBufSize_R_S16S32 OMXCATBAR(SP_FFTGetBufSize_R_S16S32, OMXSP_SUFFIX)
-#define omxSP_FFTGetBufSize_R_S32 OMXCATBAR(SP_FFTGetBufSize_R_S32, OMXSP_SUFFIX)
-#define omxSP_FFTInit_C_SC16 OMXCATBAR(SP_FFTInit_C_SC16, OMXSP_SUFFIX)
-#define omxSP_FFTInit_C_SC32 OMXCATBAR(SP_FFTInit_C_SC32, OMXSP_SUFFIX)
-#define omxSP_FFTInit_R_S16S32 OMXCATBAR(SP_FFTInit_R_S16S32, OMXSP_SUFFIX)
-#define omxSP_FFTInit_R_S32 OMXCATBAR(SP_FFTInit_R_S32, OMXSP_SUFFIX)
-#define omxSP_FFTInv_CCSToR_S32_Sfs OMXCATBAR(SP_FFTInv_CCSToR_S32_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTInv_CCSToR_S32S16_Sfs OMXCATBAR(SP_FFTInv_CCSToR_S32S16_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTInv_CToC_SC16_Sfs OMXCATBAR(SP_FFTInv_CToC_SC16_Sfs, OMXSP_SUFFIX)
-#define omxSP_FFTInv_CToC_SC32_Sfs OMXCATBAR(SP_FFTInv_CToC_SC32_Sfs, OMXSP_SUFFIX)
-#define omxSP_FilterMedian_S32 OMXCATBAR(SP_FilterMedian_S32, OMXSP_SUFFIX)
-#define omxSP_FilterMedian_S32_I OMXCATBAR(SP_FilterMedian_S32_I, OMXSP_SUFFIX)
-#define omxSP_FIR_Direct_S16 OMXCATBAR(SP_FIR_Direct_S16, OMXSP_SUFFIX)
-#define omxSP_FIR_Direct_S16_I OMXCATBAR(SP_FIR_Direct_S16_I, OMXSP_SUFFIX)
-#define omxSP_FIR_Direct_S16_ISfs OMXCATBAR(SP_FIR_Direct_S16_ISfs, OMXSP_SUFFIX)
-#define omxSP_FIR_Direct_S16_Sfs OMXCATBAR(SP_FIR_Direct_S16_Sfs, OMXSP_SUFFIX)
-#define omxSP_FIROne_Direct_S16 OMXCATBAR(SP_FIROne_Direct_S16, OMXSP_SUFFIX)
-#define omxSP_FIROne_Direct_S16_I OMXCATBAR(SP_FIROne_Direct_S16_I, OMXSP_SUFFIX)
-#define omxSP_FIROne_Direct_S16_ISfs OMXCATBAR(SP_FIROne_Direct_S16_ISfs, OMXSP_SUFFIX)
-#define omxSP_FIROne_Direct_S16_Sfs OMXCATBAR(SP_FIROne_Direct_S16_Sfs, OMXSP_SUFFIX)
-#define omxSP_IIR_BiQuadDirect_S16 OMXCATBAR(SP_IIR_BiQuadDirect_S16, OMXSP_SUFFIX)
-#define omxSP_IIR_BiQuadDirect_S16_I OMXCATBAR(SP_IIR_BiQuadDirect_S16_I, OMXSP_SUFFIX)
-#define omxSP_IIR_Direct_S16 OMXCATBAR(SP_IIR_Direct_S16, OMXSP_SUFFIX)
-#define omxSP_IIR_Direct_S16_I OMXCATBAR(SP_IIR_Direct_S16_I, OMXSP_SUFFIX)
-#define omxSP_IIROne_BiQuadDirect_S16 OMXCATBAR(SP_IIROne_BiQuadDirect_S16, OMXSP_SUFFIX)
-#define omxSP_IIROne_BiQuadDirect_S16_I OMXCATBAR(SP_IIROne_BiQuadDirect_S16_I, OMXSP_SUFFIX)
-#define omxSP_IIROne_Direct_S16 OMXCATBAR(SP_IIROne_Direct_S16, OMXSP_SUFFIX)
-#define omxSP_IIROne_Direct_S16_I OMXCATBAR(SP_IIROne_Direct_S16_I, OMXSP_SUFFIX)
-
-#define omxVCCOMM_Average_16x OMXCATBAR(VCCOMM_Average_16x, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_Average_8x OMXCATBAR(VCCOMM_Average_8x, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_ComputeTextureErrorBlock OMXCATBAR(VCCOMM_ComputeTextureErrorBlock, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_ComputeTextureErrorBlock_SAD OMXCATBAR(VCCOMM_ComputeTextureErrorBlock_SAD, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_Copy16x16 OMXCATBAR(VCCOMM_Copy16x16, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_Copy8x8 OMXCATBAR(VCCOMM_Copy8x8, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_ExpandFrame_I OMXCATBAR(VCCOMM_ExpandFrame_I, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_LimitMVToRect OMXCATBAR(VCCOMM_LimitMVToRect, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_SAD_16x OMXCATBAR(VCCOMM_SAD_16x, OMXVCCOMM_SUFFIX)
-#define omxVCCOMM_SAD_8x OMXCATBAR(VCCOMM_SAD_8x, OMXVCCOMM_SUFFIX)
-
-#define omxVCM4P10_Average_4x OMXCATBAR(VCM4P10_Average_4x, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_BlockMatch_Half OMXCATBAR(VCM4P10_BlockMatch_Half, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_BlockMatch_Integer OMXCATBAR(VCM4P10_BlockMatch_Integer, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_BlockMatch_Quarter OMXCATBAR(VCM4P10_BlockMatch_Quarter, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_DeblockChroma_I OMXCATBAR(VCM4P10_DeblockChroma_I, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_DeblockLuma_I OMXCATBAR(VCM4P10_DeblockLuma_I, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC OMXCATBAR(VCM4P10_DecodeChromaDcCoeffsToPairCAVLC, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_DecodeCoeffsToPairCAVLC OMXCATBAR(VCM4P10_DecodeCoeffsToPairCAVLC, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_DequantTransformResidualFromPairAndAdd OMXCATBAR(VCM4P10_DequantTransformResidualFromPairAndAdd, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_FilterDeblockingChroma_HorEdge_I OMXCATBAR(VCM4P10_FilterDeblockingChroma_HorEdge_I, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_FilterDeblockingChroma_VerEdge_I OMXCATBAR(VCM4P10_FilterDeblockingChroma_VerEdge_I, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_FilterDeblockingLuma_HorEdge_I OMXCATBAR(VCM4P10_FilterDeblockingLuma_HorEdge_I, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_FilterDeblockingLuma_VerEdge_I OMXCATBAR(VCM4P10_FilterDeblockingLuma_VerEdge_I, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_GetVLCInfo OMXCATBAR(VCM4P10_GetVLCInfo, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InterpolateChroma OMXCATBAR(VCM4P10_InterpolateChroma, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InterpolateHalfHor_Luma OMXCATBAR(VCM4P10_InterpolateHalfHor_Luma, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InterpolateHalfVer_Luma OMXCATBAR(VCM4P10_InterpolateHalfVer_Luma, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InterpolateLuma OMXCATBAR(VCM4P10_InterpolateLuma, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InvTransformDequant_ChromaDC OMXCATBAR(VCM4P10_InvTransformDequant_ChromaDC, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InvTransformDequant_LumaDC OMXCATBAR(VCM4P10_InvTransformDequant_LumaDC, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_InvTransformResidualAndAdd OMXCATBAR(VCM4P10_InvTransformResidualAndAdd, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_MEGetBufSize OMXCATBAR(VCM4P10_MEGetBufSize, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_MEInit OMXCATBAR(VCM4P10_MEInit, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_MotionEstimationMB OMXCATBAR(VCM4P10_MotionEstimationMB, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_PredictIntra_16x16 OMXCATBAR(VCM4P10_PredictIntra_16x16, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_PredictIntra_4x4 OMXCATBAR(VCM4P10_PredictIntra_4x4, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_PredictIntraChroma_8x8 OMXCATBAR(VCM4P10_PredictIntraChroma_8x8, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_SAD_4x OMXCATBAR(VCM4P10_SAD_4x, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_SADQuar_16x OMXCATBAR(VCM4P10_SADQuar_16x, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_SADQuar_4x OMXCATBAR(VCM4P10_SADQuar_4x, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_SADQuar_8x OMXCATBAR(VCM4P10_SADQuar_8x, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_SATD_4x4 OMXCATBAR(VCM4P10_SATD_4x4, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_SubAndTransformQDQResidual OMXCATBAR(VCM4P10_SubAndTransformQDQResidual, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_TransformDequantChromaDCFromPair OMXCATBAR(VCM4P10_TransformDequantChromaDCFromPair, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_TransformDequantLumaDCFromPair OMXCATBAR(VCM4P10_TransformDequantLumaDCFromPair, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_TransformQuant_ChromaDC OMXCATBAR(VCM4P10_TransformQuant_ChromaDC, OMXVCM4P10_SUFFIX)
-#define omxVCM4P10_TransformQuant_LumaDC OMXCATBAR(VCM4P10_TransformQuant_LumaDC, OMXVCM4P10_SUFFIX)
-
-#define omxVCM4P2_BlockMatch_Half_16x16 OMXCATBAR(VCM4P2_BlockMatch_Half_16x16, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_BlockMatch_Half_8x8 OMXCATBAR(VCM4P2_BlockMatch_Half_8x8, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_BlockMatch_Integer_16x16 OMXCATBAR(VCM4P2_BlockMatch_Integer_16x16, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_BlockMatch_Integer_8x8 OMXCATBAR(VCM4P2_BlockMatch_Integer_8x8, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DCT8x8blk OMXCATBAR(VCM4P2_DCT8x8blk, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DecodeBlockCoef_Inter OMXCATBAR(VCM4P2_DecodeBlockCoef_Inter, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DecodeBlockCoef_Intra OMXCATBAR(VCM4P2_DecodeBlockCoef_Intra, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DecodePadMV_PVOP OMXCATBAR(VCM4P2_DecodePadMV_PVOP, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DecodeVLCZigzag_Inter OMXCATBAR(VCM4P2_DecodeVLCZigzag_Inter, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DecodeVLCZigzag_IntraACVLC OMXCATBAR(VCM4P2_DecodeVLCZigzag_IntraACVLC, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_DecodeVLCZigzag_IntraDCVLC OMXCATBAR(VCM4P2_DecodeVLCZigzag_IntraDCVLC, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_EncodeMV OMXCATBAR(VCM4P2_EncodeMV, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_EncodeVLCZigzag_Inter OMXCATBAR(VCM4P2_EncodeVLCZigzag_Inter, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_EncodeVLCZigzag_IntraACVLC OMXCATBAR(VCM4P2_EncodeVLCZigzag_IntraACVLC, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_EncodeVLCZigzag_IntraDCVLC OMXCATBAR(VCM4P2_EncodeVLCZigzag_IntraDCVLC, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_FindMVpred OMXCATBAR(VCM4P2_FindMVpred, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_IDCT8x8blk OMXCATBAR(VCM4P2_IDCT8x8blk, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_MCReconBlock OMXCATBAR(VCM4P2_MCReconBlock, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_MEGetBufSize OMXCATBAR(VCM4P2_MEGetBufSize, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_MEInit OMXCATBAR(VCM4P2_MEInit, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_MotionEstimationMB OMXCATBAR(VCM4P2_MotionEstimationMB, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_PredictReconCoefIntra OMXCATBAR(VCM4P2_PredictReconCoefIntra, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_QuantInter_I OMXCATBAR(VCM4P2_QuantInter_I, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_QuantIntra_I OMXCATBAR(VCM4P2_QuantIntra_I, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_QuantInvInter_I OMXCATBAR(VCM4P2_QuantInvInter_I, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_QuantInvIntra_I OMXCATBAR(VCM4P2_QuantInvIntra_I, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_TransRecBlockCoef_inter OMXCATBAR(VCM4P2_TransRecBlockCoef_inter, OMXVCM4P2_SUFFIX)
-#define omxVCM4P2_TransRecBlockCoef_intra OMXCATBAR(VCM4P2_TransRecBlockCoef_intra, OMXVCM4P2_SUFFIX)
-
-
-#endif /* _armOMX_h_ */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/api/omxtypes.h b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/api/omxtypes.h
deleted file mode 100644
index 912cb0d..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/api/omxtypes.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/**
- * File: omxtypes.h
- * Brief: Defines basic Data types used in OpenMAX v1.0.2 header files.
- *
- * Copyright © 2005-2008 The Khronos Group Inc. All Rights Reserved.
- *
- * These materials are protected by copyright laws and contain material
- * proprietary to the Khronos Group, Inc. You may use these materials
- * for implementing Khronos specifications, without altering or removing
- * any trademark, copyright or other notice from the specification.
- *
- * Khronos Group makes no, and expressly disclaims any, representations
- * or warranties, express or implied, regarding these materials, including,
- * without limitation, any implied warranties of merchantability or fitness
- * for a particular purpose or non-infringement of any intellectual property.
- * Khronos Group makes no, and expressly disclaims any, warranties, express
- * or implied, regarding the correctness, accuracy, completeness, timeliness,
- * and reliability of these materials.
- *
- * Under no circumstances will the Khronos Group, or any of its Promoters,
- * Contributors or Members or their respective partners, officers, directors,
- * employees, agents or representatives be liable for any damages, whether
- * direct, indirect, special or consequential damages for lost revenues,
- * lost profits, or otherwise, arising from or in connection with these
- * materials.
- *
- * Khronos and OpenMAX are trademarks of the Khronos Group Inc.
- *
- */
-
-#ifndef _OMXTYPES_H_
-#define _OMXTYPES_H_
-
-#include <limits.h>
-#include <stdint.h>
-
-#define OMX_IN
-#define OMX_OUT
-#define OMX_INOUT
-
-
-typedef enum {
-
- /* Mandatory return codes - use cases are explicitly described for each function */
- OMX_Sts_NoErr = 0, /* No error, the function completed successfully */
- OMX_Sts_Err = -2, /* Unknown/unspecified error */
- OMX_Sts_InvalidBitstreamValErr = -182, /* Invalid value detected during bitstream processing */
- OMX_Sts_MemAllocErr = -9, /* Not enough memory allocated for the operation */
- OMX_StsACAAC_GainCtrErr = -159, /* AAC: Unsupported gain control data detected */
- OMX_StsACAAC_PrgNumErr = -167, /* AAC: Invalid number of elements for one program */
- OMX_StsACAAC_CoefValErr = -163, /* AAC: Invalid quantized coefficient value */
- OMX_StsACAAC_MaxSfbErr = -162, /* AAC: Invalid maxSfb value in relation to numSwb */
- OMX_StsACAAC_PlsDataErr = -160, /* AAC: pulse escape sequence data error */
-
- /* Optional return codes - use cases are explicitly described for each function*/
- OMX_Sts_BadArgErr = -5, /* Bad Arguments */
-
- OMX_StsACAAC_TnsNumFiltErr = -157, /* AAC: Invalid number of TNS filters */
- OMX_StsACAAC_TnsLenErr = -156, /* AAC: Invalid TNS region length */
- OMX_StsACAAC_TnsOrderErr = -155, /* AAC: Invalid order of TNS filter */
- OMX_StsACAAC_TnsCoefResErr = -154, /* AAC: Invalid bit-resolution for TNS filter coefficients */
- OMX_StsACAAC_TnsCoefErr = -153, /* AAC: Invalid TNS filter coefficients */
- OMX_StsACAAC_TnsDirectErr = -152, /* AAC: Invalid TNS filter direction */
-
- OMX_StsICJP_JPEGMarkerErr = -183, /* JPEG marker encountered within an entropy-coded block; */
- /* Huffman decoding operation terminated early. */
- OMX_StsICJP_JPEGMarker = -181, /* JPEG marker encountered; Huffman decoding */
- /* operation terminated early. */
- OMX_StsIPPP_ContextMatchErr = -17, /* Context parameter doesn't match to the operation */
-
- OMX_StsSP_EvenMedianMaskSizeErr = -180, /* Even size of the Median Filter mask was replaced by the odd one */
-
- OMX_Sts_MaximumEnumeration = INT_MAX /*Placeholder, forces enum of size OMX_INT*/
-
- } OMXResult; /** Return value or error value returned from a function. Identical to OMX_INT */
-
-
-/* OMX_U8 */
-typedef uint8_t OMX_U8;
-
-/* OMX_S8 */
-typedef int8_t OMX_S8;
-
-/* OMX_U16 */
-typedef uint16_t OMX_U16;
-
-/* OMX_S16 */
-typedef int16_t OMX_S16;
-
-/* OMX_U32 */
-typedef uint32_t OMX_U32;
-
-/* OMX_S32 */
-typedef int32_t OMX_S32;
-
-/* OMX_U64 & OMX_S64 */
-#if defined( _WIN32 ) || defined ( _WIN64 )
- typedef __int64 OMX_S64; /** Signed 64-bit integer */
- typedef unsigned __int64 OMX_U64; /** Unsigned 64-bit integer */
- #define OMX_MIN_S64 (0x8000000000000000i64)
- #define OMX_MIN_U64 (0x0000000000000000i64)
- #define OMX_MAX_S64 (0x7FFFFFFFFFFFFFFFi64)
- #define OMX_MAX_U64 (0xFFFFFFFFFFFFFFFFi64)
-#else
- typedef int64_t OMX_S64; /** Signed 64-bit integer */
- typedef uint64_t OMX_U64; /** Unsigned 64-bit integer */
- #define OMX_MIN_S64 (0x8000000000000000LL)
- #define OMX_MIN_U64 (0x0000000000000000LL)
- #define OMX_MAX_S64 (0x7FFFFFFFFFFFFFFFLL)
- #define OMX_MAX_U64 (0xFFFFFFFFFFFFFFFFLL)
-#endif
-
-/* OMX_SC8 */
-typedef struct
-{
- OMX_S8 Re; /** Real part */
- OMX_S8 Im; /** Imaginary part */
-
-} OMX_SC8; /** Signed 8-bit complex number */
-
-
-/* OMX_SC16 */
-typedef struct
-{
- OMX_S16 Re; /** Real part */
- OMX_S16 Im; /** Imaginary part */
-
-} OMX_SC16; /** Signed 16-bit complex number */
-
-
-/* OMX_SC32 */
-typedef struct
-{
- OMX_S32 Re; /** Real part */
- OMX_S32 Im; /** Imaginary part */
-
-} OMX_SC32; /** Signed 32-bit complex number */
-
-
-/* OMX_SC64 */
-typedef struct
-{
- OMX_S64 Re; /** Real part */
- OMX_S64 Im; /** Imaginary part */
-
-} OMX_SC64; /** Signed 64-bit complex number */
-
-
-/* OMX_F32 */
-typedef float OMX_F32; /** Single precision floating point,IEEE 754 */
-
-
-/* OMX_F64 */
-typedef double OMX_F64; /** Double precision floating point,IEEE 754 */
-
-
-/* OMX_INT */
-typedef int OMX_INT; /** signed integer corresponding to machine word length, has maximum signed value INT_MAX*/
-
-
-#define OMX_MIN_S8 (-128)
-#define OMX_MIN_U8 0
-#define OMX_MIN_S16 (-32768)
-#define OMX_MIN_U16 0
-#define OMX_MIN_S32 (-2147483647-1)
-#define OMX_MIN_U32 0
-
-#define OMX_MAX_S8 (127)
-#define OMX_MAX_U8 (255)
-#define OMX_MAX_S16 (32767)
-#define OMX_MAX_U16 (0xFFFF)
-#define OMX_MAX_S32 (2147483647)
-#define OMX_MAX_U32 (0xFFFFFFFF)
-
-typedef void OMXVoid;
-
-#ifndef NULL
-#define NULL ((void*)0)
-#endif
-
-/** Defines the geometric position and size of a rectangle,
- * where x,y defines the coordinates of the top left corner
- * of the rectangle, with dimensions width in the x-direction
- * and height in the y-direction */
-typedef struct {
- OMX_INT x; /** x-coordinate of top left corner of rectangle */
- OMX_INT y; /** y-coordinate of top left corner of rectangle */
- OMX_INT width; /** Width in the x-direction. */
- OMX_INT height; /** Height in the y-direction. */
-}OMXRect;
-
-
-/** Defines the geometric position of a point, */
-typedef struct
-{
- OMX_INT x; /** x-coordinate */
- OMX_INT y; /** y-coordinate */
-
-} OMXPoint;
-
-
-/** Defines the dimensions of a rectangle, or region of interest in an image */
-typedef struct
-{
- OMX_INT width; /** Width of the rectangle, in the x-direction */
- OMX_INT height; /** Height of the rectangle, in the y-direction */
-
-} OMXSize;
-
-#endif /* _OMXTYPES_H_ */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/build_vc.pl b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/build_vc.pl
deleted file mode 100755
index e59cded..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/build_vc.pl
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-#!/usr/bin/perl
-#
-#
-# File Name: build_vc.pl
-# OpenMAX DL: v1.0.2
-# Revision: 9641
-# Date: Thursday, February 7, 2008
-#
-#
-#
-#
-# This file builds the OpenMAX DL vc domain library omxVC.o.
-#
-
-use File::Spec;
-use strict;
-
-my ($CC, $CC_OPTS, $AS, $AS_OPTS, $LIB, $LIB_OPTS, $LIB_TYPE);
-
-$CC = 'armcc';
-$CC_OPTS = '--no_unaligned_access --cpu ARM7TDMI -c';
-$AS = 'armasm';
-$AS_OPTS = '--no_unaligned_access --cpu ARM7TDMI';
-# $LIB = 'armlink';
-# $LIB_OPTS = '--partial -o';
-# $LIB_TYPE = '.o';
-$LIB = 'armar';
-$LIB_OPTS = '--create -r';
-$LIB_TYPE = '.a';
-
-#------------------------
-
-my (@headerlist, @filelist, $hd, $file, $ofile, $command, $objlist, $libfile, $h);
-
-# Define the list of directories containing included header files.
-@headerlist = qw(api vc/api vc/m4p2/api vc/m4p10/api);
-
-# Define the list of source files to compile.
-open(FILES, '<filelist_vc.txt') or die("Can't open source file list\n");
-@filelist = <FILES>;
-close(FILES);
-
-# Fix the file separators in the header paths
-foreach $h (@headerlist)
-{
- $h = File::Spec->canonpath($h);
-}
-
-# Create the include path to be passed to the compiler
-$hd = '-I' . join(' -I', @headerlist);
-
-# Create the build directories "/lib/" and "/obj/" (if they are not there already)
-mkdir "obj", 0777 if (! -d "obj");
-mkdir "lib", 0777 if (! -d "lib");
-
-$objlist = '';
-
-# Compile each file
-foreach $file (@filelist)
-{
- my $f;
- my $base;
- my $ext;
- my $objfile;
-
- chomp($file);
- $file = File::Spec->canonpath($file);
-
- (undef, undef, $f) = File::Spec->splitpath($file);
- if(($base, $ext) = $f =~ /(.+)\.(\w)$/)
- {
- $objfile = File::Spec->catfile('obj', $base.'.o');
-
- if($ext eq 'c')
- {
- $objlist .= "$objfile ";
- $command = $CC.' '.$CC_OPTS.' '.$hd.' -o '.$objfile.' '.$file;
- print "$command\n";
- system($command);
- }
- elsif($ext eq 's')
- {
- $objlist .= "$objfile ";
- $command = $AS.' '.$AS_OPTS.' '.$hd.' -o '.$objfile.' '.$file;
- print "$command\n";
- system($command);
- }
- else
- {
- print "Ignoring file: $f\n";
- }
- }
- else
- {
- die "No file extension found: $f\n";
- }
-}
-
-# Do the final link stage to create the libraries.
-$libfile = File::Spec->catfile('lib', 'omxVC'.$LIB_TYPE);
-$command = $LIB.' '.$LIB_OPTS.' '.$libfile.' '.$objlist;
-print "$command\n";
-(system($command) == 0) and print "Build successful\n";
-
-
-
-
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/filelist_vc.txt b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/filelist_vc.txt
deleted file mode 100644
index 66f34ac..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/filelist_vc.txt
+++ /dev/null
@@ -1,123 +0,0 @@
-./api/armCOMM.h
-./api/armCOMM_Bitstream.h
-./api/armCOMM_Version.h
-./api/armOMX_ReleaseVersion.h
-./api/omxtypes.h
-./src/armCOMM.c
-./src/armCOMM_Bitstream.c
-./vc/api/armVC.h
-./vc/api/omxVC.h
-./vc/comm/src/armVCCOMM_Average.c
-./vc/comm/src/armVCCOMM_SAD.c
-./vc/comm/src/omxVCCOMM_Average_16x.c
-./vc/comm/src/omxVCCOMM_Average_8x.c
-./vc/comm/src/omxVCCOMM_ComputeTextureErrorBlock.c
-./vc/comm/src/omxVCCOMM_ComputeTextureErrorBlock_SAD.c
-./vc/comm/src/omxVCCOMM_Copy16x16.c
-./vc/comm/src/omxVCCOMM_Copy8x8.c
-./vc/comm/src/omxVCCOMM_ExpandFrame_I.c
-./vc/comm/src/omxVCCOMM_LimitMVToRect.c
-./vc/comm/src/omxVCCOMM_SAD_16x.c
-./vc/comm/src/omxVCCOMM_SAD_8x.c
-./vc/m4p10/api/armVCM4P10_CAVLCTables.h
-./vc/m4p10/src/armVCM4P10_CAVLCTables.c
-./vc/m4p10/src/armVCM4P10_CompareMotionCostToMV.c
-./vc/m4p10/src/armVCM4P10_DeBlockPixel.c
-./vc/m4p10/src/armVCM4P10_DecodeCoeffsToPair.c
-./vc/m4p10/src/armVCM4P10_DequantTables.c
-./vc/m4p10/src/armVCM4P10_FwdTransformResidual4x4.c
-./vc/m4p10/src/armVCM4P10_Interpolate_Chroma.c
-./vc/m4p10/src/armVCM4P10_Interpolate_Luma.c
-./vc/m4p10/src/armVCM4P10_InterpolateHalfDiag_Luma.c
-./vc/m4p10/src/armVCM4P10_InterpolateHalfHor_Luma.c
-./vc/m4p10/src/armVCM4P10_InterpolateHalfVer_Luma.c
-./vc/m4p10/src/armVCM4P10_PredictIntraDC4x4.c
-./vc/m4p10/src/armVCM4P10_QuantTables.c
-./vc/m4p10/src/armVCM4P10_SADQuar.c
-./vc/m4p10/src/armVCM4P10_TransformResidual4x4.c
-./vc/m4p10/src/armVCM4P10_UnpackBlock2x2.c
-./vc/m4p10/src/armVCM4P10_UnpackBlock4x4.c
-./vc/m4p10/src/omxVCM4P10_Average_4x.c
-./vc/m4p10/src/omxVCM4P10_BlockMatch_Half.c
-./vc/m4p10/src/omxVCM4P10_BlockMatch_Integer.c
-./vc/m4p10/src/omxVCM4P10_BlockMatch_Quarter.c
-./vc/m4p10/src/omxVCM4P10_DeblockChroma_I.c
-./vc/m4p10/src/omxVCM4P10_DeblockLuma_I.c
-./vc/m4p10/src/omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC.c
-./vc/m4p10/src/omxVCM4P10_DecodeCoeffsToPairCAVLC.c
-./vc/m4p10/src/omxVCM4P10_DequantTransformResidualFromPairAndAdd.c
-./vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_HorEdge_I.c
-./vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_VerEdge_I.c
-./vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_HorEdge_I.c
-./vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_VerEdge_I.c
-./vc/m4p10/src/omxVCM4P10_GetVLCInfo.c
-./vc/m4p10/src/omxVCM4P10_InterpolateChroma.c
-./vc/m4p10/src/omxVCM4P10_InterpolateHalfHor_Luma.c
-./vc/m4p10/src/omxVCM4P10_InterpolateHalfVer_Luma.c
-./vc/m4p10/src/omxVCM4P10_InterpolateLuma.c
-./vc/m4p10/src/omxVCM4P10_InvTransformDequant_ChromaDC.c
-./vc/m4p10/src/omxVCM4P10_InvTransformDequant_LumaDC.c
-./vc/m4p10/src/omxVCM4P10_InvTransformResidualAndAdd.c
-./vc/m4p10/src/omxVCM4P10_MEGetBufSize.c
-./vc/m4p10/src/omxVCM4P10_MEInit.c
-./vc/m4p10/src/omxVCM4P10_MotionEstimationMB.c
-./vc/m4p10/src/omxVCM4P10_PredictIntra_16x16.c
-./vc/m4p10/src/omxVCM4P10_PredictIntra_4x4.c
-./vc/m4p10/src/omxVCM4P10_PredictIntraChroma_8x8.c
-./vc/m4p10/src/omxVCM4P10_SAD_4x.c
-./vc/m4p10/src/omxVCM4P10_SADQuar_16x.c
-./vc/m4p10/src/omxVCM4P10_SADQuar_4x.c
-./vc/m4p10/src/omxVCM4P10_SADQuar_8x.c
-./vc/m4p10/src/omxVCM4P10_SATD_4x4.c
-./vc/m4p10/src/omxVCM4P10_SubAndTransformQDQResidual.c
-./vc/m4p10/src/omxVCM4P10_TransformDequantChromaDCFromPair.c
-./vc/m4p10/src/omxVCM4P10_TransformDequantLumaDCFromPair.c
-./vc/m4p10/src/omxVCM4P10_TransformQuant_ChromaDC.c
-./vc/m4p10/src/omxVCM4P10_TransformQuant_LumaDC.c
-./vc/m4p2/api/armVCM4P2_DCT_Table.h
-./vc/m4p2/api/armVCM4P2_Huff_Tables_VLC.h
-./vc/m4p2/api/armVCM4P2_ZigZag_Tables.h
-./vc/m4p2/src/armVCM4P2_ACDCPredict.c
-./vc/m4p2/src/armVCM4P2_BlockMatch_Half.c
-./vc/m4p2/src/armVCM4P2_BlockMatch_Integer.c
-./vc/m4p2/src/armVCM4P2_CheckVLCEscapeMode.c
-./vc/m4p2/src/armVCM4P2_CompareMV.c
-./vc/m4p2/src/armVCM4P2_DCT_Table.c
-./vc/m4p2/src/armVCM4P2_DecodeVLCZigzag_intra.c
-./vc/m4p2/src/armVCM4P2_EncodeVLCZigzag_intra.c
-./vc/m4p2/src/armVCM4P2_FillVLCBuffer.c
-./vc/m4p2/src/armVCM4P2_FillVLDBuffer.c
-./vc/m4p2/src/armVCM4P2_GetVLCBits.c
-./vc/m4p2/src/armVCM4P2_Huff_Tables_VLC.c
-./vc/m4p2/src/armVCM4P2_PutVLCBits.c
-./vc/m4p2/src/armVCM4P2_SetPredDir.c
-./vc/m4p2/src/armVCM4P2_Zigzag_Tables.c
-./vc/m4p2/src/omxVCM4P2_BlockMatch_Half_16x16.c
-./vc/m4p2/src/omxVCM4P2_BlockMatch_Half_8x8.c
-./vc/m4p2/src/omxVCM4P2_BlockMatch_Integer_16x16.c
-./vc/m4p2/src/omxVCM4P2_BlockMatch_Integer_8x8.c
-./vc/m4p2/src/omxVCM4P2_DCT8x8blk.c
-./vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Inter.c
-./vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Intra.c
-./vc/m4p2/src/omxVCM4P2_DecodePadMV_PVOP.c
-./vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_Inter.c
-./vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraACVLC.c
-./vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraDCVLC.c
-./vc/m4p2/src/omxVCM4P2_EncodeMV.c
-./vc/m4p2/src/omxVCM4P2_EncodeVLCZigzag_Inter.c
-./vc/m4p2/src/omxVCM4P2_EncodeVLCZigzag_IntraACVLC.c
-./vc/m4p2/src/omxVCM4P2_EncodeVLCZigzag_IntraDCVLC.c
-./vc/m4p2/src/omxVCM4P2_FindMVpred.c
-./vc/m4p2/src/omxVCM4P2_IDCT8x8blk.c
-./vc/m4p2/src/omxVCM4P2_MCReconBlock.c
-./vc/m4p2/src/omxVCM4P2_MEGetBufSize.c
-./vc/m4p2/src/omxVCM4P2_MEInit.c
-./vc/m4p2/src/omxVCM4P2_MotionEstimationMB.c
-./vc/m4p2/src/omxVCM4P2_PredictReconCoefIntra.c
-./vc/m4p2/src/omxVCM4P2_QuantInter_I.c
-./vc/m4p2/src/omxVCM4P2_QuantIntra_I.c
-./vc/m4p2/src/omxVCM4P2_QuantInvInter_I.c
-./vc/m4p2/src/omxVCM4P2_QuantInvIntra_I.c
-./vc/m4p2/src/omxVCM4P2_TransRecBlockCoef_inter.c
-./vc/m4p2/src/omxVCM4P2_TransRecBlockCoef_intra.c
-./vc/src/armVC_Version.c
\ No newline at end of file
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/src/armCOMM.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/src/armCOMM.c
deleted file mode 100644
index e8dbf41..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/src/armCOMM.c
+++ /dev/null
@@ -1,951 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armCOMM.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Defines Common APIs used across OpenMAX API's
- */
-
-#include "omxtypes.h"
-#include "armCOMM.h"
-
-/***********************************************************************/
- /* Miscellaneous Arithmetic operations */
-
-/**
- * Function: armRoundFloatToS16
- *
- * Description:
- * Converts a double precision value into a short int after rounding
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S16 format
- *
- */
-
-OMX_S16 armRoundFloatToS16 (OMX_F64 Value)
-{
- if (Value > 0)
- {
- return (OMX_S16)(Value + .5);
- }
- else
- {
- return (OMX_S16)(Value - .5);
- }
-}
-
-/**
- * Function: armRoundFloatToS32
- *
- * Description:
- * Converts a double precision value into a int after rounding
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S32 format
- *
- */
-
-OMX_S32 armRoundFloatToS32 (OMX_F64 Value)
-{
- if (Value > 0)
- {
- return (OMX_S32)(Value + .5);
- }
- else
- {
- return (OMX_S32)(Value - .5);
- }
-}
-/**
- * Function: armSatRoundFloatToS16
- *
- * Description:
- * Converts a double precision value into a short int after rounding and saturation
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S16 format
- *
- */
-
-OMX_S16 armSatRoundFloatToS16 (OMX_F64 Value)
-{
- if (Value > 0)
- {
- Value += 0.5;
-
- if(Value > (OMX_S16)OMX_MAX_S16 )
- {
- return (OMX_S16)OMX_MAX_S16;
- }
- else
- {
- return (OMX_S16)Value;
- }
- }
- else
- {
- Value -= 0.5;
-
- if(Value < (OMX_S16)OMX_MIN_S16 )
- {
- return (OMX_S16)OMX_MIN_S16;
- }
- else
- {
- return (OMX_S16)Value;
- }
- }
-}
-
-/**
- * Function: armSatRoundFloatToS32
- *
- * Description:
- * Converts a double precision value into a int after rounding and saturation
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S32 format
- *
- */
-
-OMX_S32 armSatRoundFloatToS32 (OMX_F64 Value)
-{
- if (Value > 0)
- {
- Value += 0.5;
-
- if(Value > (OMX_S32)OMX_MAX_S32 )
- {
- return (OMX_S32)OMX_MAX_S32;
- }
- else
- {
- return (OMX_S32)Value;
- }
- }
- else
- {
- Value -= 0.5;
-
- if(Value < (OMX_S32)OMX_MIN_S32 )
- {
- return (OMX_S32)OMX_MIN_S32;
- }
- else
- {
- return (OMX_S32)Value;
- }
- }
-}
-
-/**
- * Function: armSatRoundFloatToU16
- *
- * Description:
- * Converts a double precision value into a unsigned short int after rounding and saturation
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_U16 format
- *
- */
-
-OMX_U16 armSatRoundFloatToU16 (OMX_F64 Value)
-{
- Value += 0.5;
-
- if(Value > (OMX_U16)OMX_MAX_U16 )
- {
- return (OMX_U16)OMX_MAX_U16;
- }
- else
- {
- return (OMX_U16)Value;
- }
-}
-
-/**
- * Function: armSatRoundFloatToU32
- *
- * Description:
- * Converts a double precision value into a unsigned int after rounding and saturation
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_U32 format
- *
- */
-
-OMX_U32 armSatRoundFloatToU32 (OMX_F64 Value)
-{
- Value += 0.5;
-
- if(Value > (OMX_U32)OMX_MAX_U32 )
- {
- return (OMX_U32)OMX_MAX_U32;
- }
- else
- {
- return (OMX_U32)Value;
- }
-}
-
-/**
- * Function: armRoundFloatToS64
- *
- * Description:
- * Converts a double precision value into a 64 bit int after rounding
- *
- * Parameters:
- * [in] Value Float value to be converted
- *
- * Return Value:
- * [out] converted value in OMX_S64 format
- *
- */
-
-OMX_S64 armRoundFloatToS64 (OMX_F64 Value)
-{
- if (Value > 0)
- {
- return (OMX_S64)(Value + .5);
- }
- else
- {
- return (OMX_S64)(Value - .5);
- }
-}
-
-/**
- * Function: armSignCheck
- *
- * Description:
- * Checks the sign of a variable:
- * returns 1 if it is Positive
- * returns 0 if it is 0
- * returns -1 if it is Negative
- *
- * Remarks:
- *
- * Parameters:
- * [in] var Variable to be checked
- *
- * Return Value:
- * OMX_INT -- returns 1 if it is Positive
- * returns 0 if it is 0
- * returns -1 if it is Negative
- */
-
-OMX_INT armSignCheck (
- OMX_S16 var
-)
-
-{
- OMX_INT Sign;
-
- if (var < 0)
- {
- Sign = -1;
- }
- else if ( var > 0)
- {
- Sign = 1;
- }
- else
- {
- Sign = 0;
- }
-
- return Sign;
-}
-
-/**
- * Function: armClip
- *
- * Description: Clips the input between MAX and MIN value
- *
- *
- * Remarks:
- *
- * Parameters:
- * [in] Min lower bound
- * [in] Max upper bound
- * [in] src variable to the clipped
- *
- * Return Value:
- * OMX_S32 -- returns clipped value
- */
-
-OMX_S32 armClip (
- OMX_INT min,
- OMX_INT max,
- OMX_S32 src
-)
-
-{
- if (src > max)
- {
- src = max;
- }
- else if (src < min)
- {
- src = min;
- }
-
- return src;
-}
-
-/**
- * Function: armClip_F32
- *
- * Description: Clips the input between MAX and MIN value
- *
- *
- * Remarks:
- *
- * Parameters:
- * [in] Min lower bound
- * [in] Max upper bound
- * [in] src variable to the clipped
- *
- * Return Value:
- * OMX_F32 -- returns clipped value
- */
-
-OMX_F32 armClip_F32 (
- OMX_F32 min,
- OMX_F32 max,
- OMX_F32 src
-)
-
-{
- if (src > max)
- {
- src = max;
- }
- else if (src < min)
- {
- src = min;
- }
-
- return src;
-}
-
-/**
- * Function: armShiftSat_F32
- *
- * Description: Divides a float value by 2^shift and
- * saturates it for unsigned value range for satBits.
- * Second parameter is like "shifting" the corresponding
- * integer value. Takes care of rounding while clipping the final
- * value.
- *
- * Parameters:
- * [in] v Number to be operated upon
- * [in] shift Divides the input "v" by "2^shift"
- * [in] satBits Final range is [0, 2^satBits)
- *
- * Return Value:
- * OMX_S32 -- returns "shifted" saturated value
- */
-
-OMX_U32 armShiftSat_F32(OMX_F32 v, OMX_INT shift, OMX_INT satBits)
-{
- OMX_U32 allOnes = (OMX_U32)(-1);
- OMX_U32 maxV = allOnes >> (32-satBits);
- OMX_F32 vShifted, vRounded, shiftDiv = (OMX_F32)(1 << shift);
- OMX_U32 vInt;
- OMX_U32 vIntSat;
-
- if(v <= 0)
- return 0;
-
- vShifted = v / shiftDiv;
- vRounded = (OMX_F32)(vShifted + 0.5);
- vInt = (OMX_U32)vRounded;
- vIntSat = vInt;
- if(vIntSat > maxV)
- vIntSat = maxV;
- return vIntSat;
-}
-
-/**
- * Functions: armSwapElem
- *
- * Description:
- * These function swaps two elements at the specified pointer locations.
- * The size of each element could be anything as specified by <elemSize>
- *
- * Return Value:
- * OMXResult -- Error status from the function
- */
-OMXResult armSwapElem(
- OMX_U8 *pBuf1,
- OMX_U8 *pBuf2,
- OMX_INT elemSize
- )
-{
- OMX_INT i;
- OMX_U8 temp;
- armRetArgErrIf(!pBuf1 || !pBuf2, OMX_Sts_BadArgErr);
-
- for(i = 0; i < elemSize; i++)
- {
- temp = *(pBuf1 + i);
- *(pBuf1 + i) = *(pBuf2 + i);
- *(pBuf2 + i) = temp;
- }
- return OMX_Sts_NoErr;
-}
-
-/**
- * Function: armMedianOf3
- *
- * Description: Finds the median of three numbers
- *
- * Remarks:
- *
- * Parameters:
- * [in] fEntry First entry
- * [in] sEntry second entry
- * [in] tEntry Third entry
- *
- * Return Value:
- * OMX_S32 -- returns the median value
- */
-
-OMX_S32 armMedianOf3 (
- OMX_S32 fEntry,
- OMX_S32 sEntry,
- OMX_S32 tEntry
-)
-{
- OMX_S32 a, b, c;
-
- a = armMin (fEntry, sEntry);
- b = armMax (fEntry, sEntry);
- c = armMin (b, tEntry);
- return (armMax (a, c));
-}
-
-/**
- * Function: armLogSize
- *
- * Description: Finds the size of a positive value and returns the same
- *
- * Remarks:
- *
- * Parameters:
- * [in] value Positive value
- *
- * Return Value:
- * OMX_U8 -- Returns the minimum number of bits required to represent the positive value.
- This is the smallest k>=0 such that that value is less than (1<<k).
- */
-
-OMX_U8 armLogSize (
- OMX_U16 value
-)
-{
- OMX_U8 i;
- for ( i = 0; value > 0; value = value >> 1)
- {
- i++;
- }
- return i;
-}
-
-/***********************************************************************/
- /* Saturating Arithmetic operations */
-
-/**
- * Function :armSatAdd_S32()
- *
- * Description :
- * Returns the result of saturated addition of the two inputs Value1, Value2
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- *
- * Return:
- * [out] Result of operation
- *
- *
- **/
-
-OMX_S32 armSatAdd_S32(OMX_S32 Value1,OMX_S32 Value2)
-{
- OMX_S32 Result;
-
- Result = Value1 + Value2;
-
- if( (Value1^Value2) >= 0)
- {
- /*Same sign*/
- if( (Result^Value1) >= 0)
- {
- /*Result has not saturated*/
- return Result;
- }
- else
- {
- if(Value1 >= 0)
- {
- /*Result has saturated in positive side*/
- return OMX_MAX_S32;
- }
- else
- {
- /*Result has saturated in negative side*/
- return OMX_MIN_S32;
- }
-
- }
-
- }
- else
- {
- return Result;
- }
-
-}
-
-/**
- * Function :armSatAdd_S64()
- *
- * Description :
- * Returns the result of saturated addition of the two inputs Value1, Value2
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- *
- * Return:
- * [out] Result of operation
- *
- *
- **/
-
-OMX_S64 armSatAdd_S64(OMX_S64 Value1,OMX_S64 Value2)
-{
- OMX_S64 Result;
-
- Result = Value1 + Value2;
-
- if( (Value1^Value2) >= 0)
- {
- /*Same sign*/
- if( (Result^Value1) >= 0)
- {
- /*Result has not saturated*/
- return Result;
- }
- else
- {
- if(Value1 >= 0)
- {
- /*Result has saturated in positive side*/
- Result = OMX_MAX_S64;
- return Result;
- }
- else
- {
- /*Result has saturated in negative side*/
- return OMX_MIN_S64;
- }
-
- }
-
- }
- else
- {
- return Result;
- }
-
-}
-
-/** Function :armSatSub_S32()
- *
- * Description :
- * Returns the result of saturated substraction of the two inputs Value1, Value2
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S32 armSatSub_S32(OMX_S32 Value1,OMX_S32 Value2)
-{
- OMX_S32 Result;
-
- Result = Value1 - Value2;
-
- if( (Value1^Value2) < 0)
- {
- /*Opposite sign*/
- if( (Result^Value1) >= 0)
- {
- /*Result has not saturated*/
- return Result;
- }
- else
- {
- if(Value1 >= 0)
- {
- /*Result has saturated in positive side*/
- return OMX_MAX_S32;
- }
- else
- {
- /*Result has saturated in negative side*/
- return OMX_MIN_S32;
- }
-
- }
-
- }
- else
- {
- return Result;
- }
-
-}
-
-/**
- * Function :armSatMac_S32()
- *
- * Description :
- * Returns the result of Multiplication of Value1 and Value2 and subesquent saturated
- * accumulation with Mac
- *
- * Parametrs:
- * [in] Value1 First Operand
- * [in] Value2 Second Operand
- * [in] Mac Accumulator
- *
- * Return:
- * [out] Result of operation
- **/
-
-OMX_S32 armSatMac_S32(OMX_S32 Mac,OMX_S16 Value1,OMX_S16 Value2)
-{
- OMX_S32 Result;
-
- Result = (OMX_S32)(Value1*Value2);
- Result = armSatAdd_S32( Mac , Result );
-
- return Result;
-}
-
-/**
- * Function :armSatMac_S16S32_S32
- *
- * Description :
- * Returns the result of saturated MAC operation of the three inputs delayElem, filTap , mac
- *
- * mac = mac + Saturate_in_32Bits(delayElem * filTap)
- *
- * Parametrs:
- * [in] delayElem First 32 bit Operand
- * [in] filTap Second 16 bit Operand
- * [in] mac Result of MAC operation
- *
- * Return:
- * [out] mac Result of operation
- *
- **/
-
-OMX_S32 armSatMac_S16S32_S32(OMX_S32 mac, OMX_S32 delayElem, OMX_S16 filTap )
-{
-
- OMX_S32 result;
-
- result = armSatMulS16S32_S32(filTap,delayElem);
-
- if ( result > OMX_MAX_S16 )
- {
- result = OMX_MAX_S32;
- }
- else if( result < OMX_MIN_S16 )
- {
- result = OMX_MIN_S32;
- }
- else
- {
- result = delayElem * filTap;
- }
-
- mac = armSatAdd_S32(mac,result);
-
- return mac;
-}
-
-
-/**
- * Function :armSatRoundRightShift_S32_S16
- *
- * Description :
- * Returns the result of rounded right shift operation of input by the scalefactor
- *
- * output = Saturate_in_16Bits( ( Right/LeftShift( (Round(input) , shift ) )
- *
- * Parametrs:
- * [in] input The input to be operated on
- * [in] shift The shift number
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-
-OMX_S16 armSatRoundRightShift_S32_S16(OMX_S32 input, OMX_INT shift)
-{
- input = armSatRoundLeftShift_S32(input,-shift);
-
- if ( input > OMX_MAX_S16 )
- {
- return (OMX_S16)OMX_MAX_S16;
- }
- else if (input < OMX_MIN_S16)
- {
- return (OMX_S16)OMX_MIN_S16;
- }
- else
- {
- return (OMX_S16)input;
- }
-
-}
-
-/**
- * Function :armSatRoundLeftShift_S32()
- *
- * Description :
- * Returns the result of saturating left-shift operation on input
- * Or rounded Right shift if the input Shift is negative.
- *
- * Parametrs:
- * [in] Value Operand
- * [in] Shift Operand for shift operation
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S32 armSatRoundLeftShift_S32(OMX_S32 Value, OMX_INT Shift)
-{
- OMX_INT i;
-
- if (Shift < 0)
- {
- Shift = -Shift;
- Value = armSatAdd_S32(Value, (1 << (Shift - 1)));
- Value = Value >> Shift;
- }
- else
- {
- for (i = 0; i < Shift; i++)
- {
- Value = armSatAdd_S32(Value, Value);
- }
- }
- return Value;
-}
-
-/**
- * Function :armSatRoundLeftShift_S64()
- *
- * Description :
- * Returns the result of saturating left-shift operation on input
- * Or rounded Right shift if the input Shift is negative.
- *
- * Parametrs:
- * [in] Value Operand
- * [in] shift Operand for shift operation
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S64 armSatRoundLeftShift_S64(OMX_S64 Value, OMX_INT Shift)
-{
- OMX_INT i;
-
- if (Shift < 0)
- {
- Shift = -Shift;
- Value = armSatAdd_S64(Value, ((OMX_S64)1 << (Shift - 1)));
- Value = Value >> Shift;
- }
- else
- {
- for (i = 0; i < Shift; i++)
- {
- Value = armSatAdd_S64(Value, Value);
- }
- }
- return Value;
-}
-
-/**
- * Function :armSatMulS16S32_S32()
- *
- * Description :
- * Returns the result of a S16 data type multiplied with an S32 data type
- * in a S32 container
- *
- * Parametrs:
- * [in] input1 Operand 1
- * [in] input2 Operand 2
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-
-OMX_S32 armSatMulS16S32_S32(OMX_S16 input1,OMX_S32 input2)
-{
- OMX_S16 hi2,lo1;
- OMX_U16 lo2;
-
- OMX_S32 temp1,temp2;
- OMX_S32 result;
-
- lo1 = input1;
-
- hi2 = ( input2 >> 16 );
- lo2 = ( (OMX_U32)( input2 << 16 ) >> 16 );
-
- temp1 = hi2 * lo1;
- temp2 = ( lo2* lo1 ) >> 16;
-
- result = armSatAdd_S32(temp1,temp2);
-
- return result;
-}
-
-/**
- * Function :armSatMulS32S32_S32()
- *
- * Description :
- * Returns the result of a S32 data type multiplied with an S32 data type
- * in a S32 container
- *
- * Parametrs:
- * [in] input1 Operand 1
- * [in] input2 Operand 2
- *
- * Return:
- * [out] Result of operation
- *
- **/
-
-OMX_S32 armSatMulS32S32_S32(OMX_S32 input1,OMX_S32 input2)
-{
- OMX_S16 hi1,hi2;
- OMX_U16 lo1,lo2;
-
- OMX_S32 temp1,temp2,temp3;
- OMX_S32 result;
-
- hi1 = ( input1 >> 16 );
- lo1 = ( (OMX_U32)( input1 << 16 ) >> 16 );
-
- hi2 = ( input2 >> 16 );
- lo2 = ( (OMX_U32)( input2 << 16 ) >> 16 );
-
- temp1 = hi1 * hi2;
- temp2 = ( hi1* lo2 ) >> 16;
- temp3 = ( hi2* lo1 ) >> 16;
-
- result = armSatAdd_S32(temp1,temp2);
- result = armSatAdd_S32(result,temp3);
-
- return result;
-}
-
-/**
- * Function :armIntDivAwayFromZero()
- *
- * Description : Integer division with rounding to the nearest integer.
- * Half-integer values are rounded away from zero
- * unless otherwise specified. For example 3//2 is rounded
- * to 2, and -3//2 is rounded to -2.
- *
- * Parametrs:
- * [in] Num Operand 1
- * [in] Deno Operand 2
- *
- * Return:
- * [out] Result of operation input1//input2
- *
- **/
-
-OMX_S32 armIntDivAwayFromZero (OMX_S32 Num, OMX_S32 Deno)
-{
- OMX_F64 result;
-
- result = ((OMX_F64)Num)/((OMX_F64)Deno);
-
- if (result >= 0)
- {
- result += 0.5;
- }
- else
- {
- result -= 0.5;
- }
-
- return (OMX_S32)(result);
-}
-
-
-/*End of File*/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/src/armCOMM_Bitstream.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/src/armCOMM_Bitstream.c
deleted file mode 100644
index 99f53ca..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/src/armCOMM_Bitstream.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armCOMM_Bitstream.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Defines bitstream encode and decode functions common to all codecs
- */
-
-#include "omxtypes.h"
-#include "armCOMM.h"
-#include "armCOMM_Bitstream.h"
-
-/***************************************
- * Fixed bit length Decode
- ***************************************/
-
-/**
- * Function: armLookAheadBits()
- *
- * Description:
- * Get the next N bits from the bitstream without advancing the bitstream pointer
- *
- * Parameters:
- * [in] **ppBitStream
- * [in] *pOffset
- * [in] N=1...32
- *
- * Returns Value
- */
-
-OMX_U32 armLookAheadBits(const OMX_U8 **ppBitStream, OMX_INT *pOffset, OMX_INT N)
-{
- const OMX_U8 *pBitStream = *ppBitStream;
- OMX_INT Offset = *pOffset;
- OMX_U32 Value;
-
- armAssert(Offset>=0 && Offset<=7);
- armAssert(N>=1 && N<=32);
-
- /* Read next 32 bits from stream */
- Value = (pBitStream[0] << 24 ) | ( pBitStream[1] << 16) | (pBitStream[2] << 8 ) | (pBitStream[3]) ;
- Value = (Value << Offset ) | (pBitStream[4] >> (8-Offset));
-
- /* Return N bits */
- return Value >> (32-N);
-}
-
-
-/**
- * Function: armGetBits()
- *
- * Description:
- * Read N bits from the bitstream
- *
- * Parameters:
- * [in] *ppBitStream
- * [in] *pOffset
- * [in] N=1..32
- *
- * [out] *ppBitStream
- * [out] *pOffset
- * Returns Value
- */
-
-
-OMX_U32 armGetBits(const OMX_U8 **ppBitStream, OMX_INT *pOffset, OMX_INT N)
-{
- const OMX_U8 *pBitStream = *ppBitStream;
- OMX_INT Offset = *pOffset;
- OMX_U32 Value;
-
- if(N == 0)
- {
- return 0;
- }
-
- armAssert(Offset>=0 && Offset<=7);
- armAssert(N>=1 && N<=32);
-
- /* Read next 32 bits from stream */
- Value = (pBitStream[0] << 24 ) | ( pBitStream[1] << 16) | (pBitStream[2] << 8 ) | (pBitStream[3]) ;
- Value = (Value << Offset ) | (pBitStream[4] >> (8-Offset));
-
- /* Advance bitstream pointer by N bits */
- Offset += N;
- *ppBitStream = pBitStream + (Offset>>3);
- *pOffset = Offset & 7;
-
- /* Return N bits */
- return Value >> (32-N);
-}
-
-/**
- * Function: armByteAlign()
- *
- * Description:
- * Align the pointer *ppBitStream to the next byte boundary
- *
- * Parameters:
- * [in] *ppBitStream
- * [in] *pOffset
- *
- * [out] *ppBitStream
- * [out] *pOffset
- *
- **/
-
-OMXVoid armByteAlign(const OMX_U8 **ppBitStream,OMX_INT *pOffset)
-{
- if(*pOffset > 0)
- {
- *ppBitStream += 1;
- *pOffset = 0;
- }
-}
-
-/**
- * Function: armSkipBits()
- *
- * Description:
- * Skip N bits from the value at *ppBitStream
- *
- * Parameters:
- * [in] *ppBitStream
- * [in] *pOffset
- * [in] N
- *
- * [out] *ppBitStream
- * [out] *pOffset
- *
- **/
-
-
-OMXVoid armSkipBits(const OMX_U8 **ppBitStream,OMX_INT *pOffset,OMX_INT N)
-{
- OMX_INT Offset = *pOffset;
- const OMX_U8 *pBitStream = *ppBitStream;
-
- /* Advance bitstream pointer by N bits */
- Offset += N;
- *ppBitStream = pBitStream + (Offset>>3);
- *pOffset = Offset & 7;
-}
-
-/***************************************
- * Variable bit length Decode
- ***************************************/
-
-/**
- * Function: armUnPackVLC32()
- *
- * Description:
- * Variable length decode of variable length symbol (max size 32 bits) read from
- * the bit stream pointed by *ppBitStream at *pOffset by using the table
- * pointed by pCodeBook
- *
- * Parameters:
- * [in] *pBitStream
- * [in] *pOffset
- * [in] pCodeBook
- *
- * [out] *pBitStream
- * [out] *pOffset
- *
- * Returns : Code Book Index if successfull.
- * : ARM_NO_CODEBOOK_INDEX = -1 if search fails.
- **/
-#ifndef C_OPTIMIZED_IMPLEMENTATION
-
-OMX_U16 armUnPackVLC32(
- const OMX_U8 **ppBitStream,
- OMX_INT *pOffset,
- const ARM_VLC32 *pCodeBook
-)
-{
- const OMX_U8 *pBitStream = *ppBitStream;
- OMX_INT Offset = *pOffset;
- OMX_U32 Value;
- OMX_INT Index;
-
- armAssert(Offset>=0 && Offset<=7);
-
- /* Read next 32 bits from stream */
- Value = (pBitStream[0] << 24 ) | ( pBitStream[1] << 16) | (pBitStream[2] << 8 ) | (pBitStream[3]) ;
- Value = (Value << Offset ) | (pBitStream[4] >> (8-Offset));
-
- /* Search through the codebook */
- for (Index=0; pCodeBook->codeLen != 0; Index++)
- {
- if (pCodeBook->codeWord == (Value >> (32 - pCodeBook->codeLen)))
- {
- Offset = Offset + pCodeBook->codeLen;
- *ppBitStream = pBitStream + (Offset >> 3) ;
- *pOffset = Offset & 7;
-
- return Index;
- }
- pCodeBook++;
- }
-
- /* No code match found */
- return ARM_NO_CODEBOOK_INDEX;
-}
-
-#endif
-
-/***************************************
- * Fixed bit length Encode
- ***************************************/
-
-/**
- * Function: armPackBits
- *
- * Description:
- * Pack a VLC code word into the bitstream
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte
- * in the bit stream.
- * [in] pOffset pointer to the bit position in the byte
- * pointed by *ppBitStream. Valid within 0
- * to 7.
- * [in] codeWord Code word that need to be inserted in to the
- * bitstream
- * [in] codeLength Length of the code word valid range 1...32
- *
- * [out] ppBitStream *ppBitStream is updated after the block is encoded,
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMX_RESULT result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armPackBits (
- OMX_U8 **ppBitStream,
- OMX_INT *pOffset,
- OMX_U32 codeWord,
- OMX_INT codeLength
-)
-{
- OMX_U8 *pBitStream = *ppBitStream;
- OMX_INT Offset = *pOffset;
- OMX_U32 Value;
-
- /* checking argument validity */
- armRetArgErrIf(Offset < 0, OMX_Sts_BadArgErr);
- armRetArgErrIf(Offset > 7, OMX_Sts_BadArgErr);
- armRetArgErrIf(codeLength < 1, OMX_Sts_BadArgErr);
- armRetArgErrIf(codeLength > 32, OMX_Sts_BadArgErr);
-
- /* Prepare the first byte */
- codeWord = codeWord << (32-codeLength);
- Value = (pBitStream[0] >> (8-Offset)) << (8-Offset);
- Value = Value | (codeWord >> (24+Offset));
-
- /* Write out whole bytes */
- while (8-Offset <= codeLength)
- {
- *pBitStream++ = (OMX_U8)Value;
- codeWord = codeWord << (8-Offset);
- codeLength = codeLength - (8-Offset);
- Offset = 0;
- Value = codeWord >> 24;
- }
-
- /* Write out final partial byte */
- *pBitStream = (OMX_U8)Value;
- *ppBitStream = pBitStream;
- *pOffset = Offset + codeLength;
-
- return OMX_Sts_NoErr;
-}
-
-/***************************************
- * Variable bit length Encode
- ***************************************/
-
-/**
- * Function: armPackVLC32
- *
- * Description:
- * Pack a VLC code word into the bitstream
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte
- * in the bit stream.
- * [in] pBitOffset pointer to the bit position in the byte
- * pointed by *ppBitStream. Valid within 0
- * to 7.
- * [in] code VLC code word that need to be inserted in to the
- * bitstream
- *
- * [out] ppBitStream *ppBitStream is updated after the block is encoded,
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMX_RESULT result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armPackVLC32 (
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- ARM_VLC32 code
-)
-{
- return (armPackBits(ppBitStream, pBitOffset, code.codeWord, code.codeLen));
-}
-
-/*End of File*/
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/api/armVC.h b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/api/armVC.h
deleted file mode 100644
index 6dbe8b6..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/api/armVC.h
+++ /dev/null
@@ -1,1168 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVC.h
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * File: armVideo.h
- * Brief: Declares API's/Basic Data types used across the OpenMAX Video domain
- *
- */
-
-
-#ifndef _armVideo_H_
-#define _armVideo_H_
-
-#include "omxVC.h"
-#include "armCOMM_Bitstream.h"
-
-/**
- * ARM specific state structure to hold Motion Estimation information.
- */
-
-struct m4p2_MESpec
-{
- OMXVCM4P2MEParams MEParams;
- OMXVCM4P2MEMode MEMode;
-};
-
-struct m4p10_MESpec
-{
- OMXVCM4P10MEParams MEParams;
- OMXVCM4P10MEMode MEMode;
-};
-
-typedef struct m4p2_MESpec ARMVCM4P2_MESpec;
-typedef struct m4p10_MESpec ARMVCM4P10_MESpec;
-
-/**
- * Function: armVCM4P2_CompareMV
- *
- * Description:
- * Performs comparision of motion vectors and SAD's to decide the
- * best MV and SAD
- *
- * Remarks:
- *
- * Parameters:
- * [in] mvX x coordinate of the candidate motion vector
- * [in] mvY y coordinate of the candidate motion vector
- * [in] candSAD Candidate SAD
- * [in] bestMVX x coordinate of the best motion vector
- * [in] bestMVY y coordinate of the best motion vector
- * [in] bestSAD best SAD
- *
- * Return Value:
- * OMX_INT -- 1 to indicate that the current sad is the best
- * 0 to indicate that it is NOT the best SAD
- */
-
-OMX_INT armVCM4P2_CompareMV (
- OMX_S16 mvX,
- OMX_S16 mvY,
- OMX_INT candSAD,
- OMX_S16 bestMVX,
- OMX_S16 bestMVY,
- OMX_INT bestSAD);
-
-/**
- * Function: armVCM4P2_ACDCPredict
- *
- * Description:
- * Performs adaptive DC/AC coefficient prediction for an intra block. Prior
- * to the function call, prediction direction (predDir) should be selected
- * as specified in subclause 7.4.3.1 of ISO/IEC 14496-2.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcDst pointer to the coefficient buffer which contains
- * the quantized coefficient residuals (PQF) of the
- * current block
- * [in] pPredBufRow pointer to the coefficient row buffer
- * [in] pPredBufCol pointer to the coefficient column buffer
- * [in] curQP quantization parameter of the current block. curQP
- * may equal to predQP especially when the current
- * block and the predictor block are in the same
- * macroblock.
- * [in] predQP quantization parameter of the predictor block
- * [in] predDir indicates the prediction direction which takes one
- * of the following values:
- * OMX_VIDEO_HORIZONTAL predict horizontally
- * OMX_VIDEO_VERTICAL predict vertically
- * [in] ACPredFlag a flag indicating if AC prediction should be
- * performed. It is equal to ac_pred_flag in the bit
- * stream syntax of MPEG-4
- * [in] videoComp video component type (luminance, chrominance or
- * alpha) of the current block
- * [in] flag This flag defines the if one wants to use this functions to
- * calculate PQF (set 1, prediction) or QF (set 0, reconstruction)
- * [out] pPreACPredict pointer to the predicted coefficients buffer.
- * Filled ONLY if it is not NULL
- * [out] pSrcDst pointer to the coefficient buffer which contains
- * the quantized coefficients (QF) of the current
- * block
- * [out] pPredBufRow pointer to the updated coefficient row buffer
- * [out] pPredBufCol pointer to the updated coefficient column buffer
- * [out] pSumErr pointer to the updated sum of the difference
- * between predicted and unpredicted coefficients
- * If this is NULL, do not update
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_ACDCPredict(
- OMX_S16 * pSrcDst,
- OMX_S16 * pPreACPredict,
- OMX_S16 * pPredBufRow,
- OMX_S16 * pPredBufCol,
- OMX_INT curQP,
- OMX_INT predQP,
- OMX_INT predDir,
- OMX_INT ACPredFlag,
- OMXVCM4P2VideoComponent videoComp,
- OMX_U8 flag,
- OMX_INT *pSumErr
-);
-
-/**
- * Function: armVCM4P2_SetPredDir
- *
- * Description:
- * Performs detecting the prediction direction
- *
- * Remarks:
- *
- * Parameters:
- * [in] blockIndex block index indicating the component type and
- * position as defined in subclause 6.1.3.8, of ISO/IEC
- * 14496-2. Furthermore, indexes 6 to 9 indicate the
- * alpha blocks spatially corresponding to luminance
- * blocks 0 to 3 in the same macroblock.
- * [in] pCoefBufRow pointer to the coefficient row buffer
- * [in] pQpBuf pointer to the quantization parameter buffer
- * [out] predQP quantization parameter of the predictor block
- * [out] predDir indicates the prediction direction which takes one
- * of the following values:
- * OMX_VIDEO_HORIZONTAL predict horizontally
- * OMX_VIDEO_VERTICAL predict vertically
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_SetPredDir(
- OMX_INT blockIndex,
- OMX_S16 *pCoefBufRow,
- OMX_S16 *pCoefBufCol,
- OMX_INT *predDir,
- OMX_INT *predQP,
- const OMX_U8 *pQpBuf
-);
-
-/**
- * Function: armVCM4P2_EncodeVLCZigzag_Intra
- *
- * Description:
- * Performs zigzag scanning and VLC encoding for one intra block.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bit stream
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * by *ppBitStream. Valid within 0 to 7.
- * [in] pQDctBlkCoef pointer to the quantized DCT coefficient
- * [in] predDir AC prediction direction, which is used to decide
- * the zigzag scan pattern. This takes one of the
- * following values:
- * OMX_VIDEO_NONE AC prediction not used.
- * Performs classical zigzag
- * scan.
- * OMX_VIDEO_HORIZONTAL Horizontal prediction.
- * Performs alternate-vertical
- * zigzag scan.
- * OMX_VIDEO_VERTICAL Vertical prediction.
- * Performs alternate-horizontal
- * zigzag scan.
- * [in] pattern block pattern which is used to decide whether
- * this block is encoded
- * [in] start start indicates whether the encoding begins with 0th element
- * or 1st.
- * [out] ppBitStream *ppBitStream is updated after the block is encoded,
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_EncodeVLCZigzag_Intra(
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- const OMX_S16 *pQDctBlkCoef,
- OMX_U8 predDir,
- OMX_U8 pattern,
- OMX_INT shortVideoHeader,
- OMX_U8 start
-);
-
-/**
- * Function: armVCM4P2_DecodeVLCZigzag_Intra
- *
- * Description:
- * Performs VLC decoding and inverse zigzag scan for one intra coded block.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bitstream buffer
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * to by *ppBitStream. *pBitOffset is valid within
- * [0-7].
- * [in] predDir AC prediction direction which is used to decide
- * the zigzag scan pattern. It takes one of the
- * following values:
- * OMX_VIDEO_NONE AC prediction not used;
- * perform classical zigzag scan;
- * OMX_VIDEO_HORIZONTAL Horizontal prediction;
- * perform alternate-vertical
- * zigzag scan;
- * OMX_VIDEO_VERTICAL Vertical prediction;
- * thus perform
- * alternate-horizontal
- * zigzag scan.
- * [in] videoComp video component type (luminance, chrominance or
- * alpha) of the current block
- * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0,
- * and escape mode 4 is used when shortVideoHeader==1.
- * [in] start start indicates whether the encoding begins with 0th element
- * or 1st.
- * [out] ppBitStream *ppBitStream is updated after the block is
- * decoded, so that it points to the current byte
- * in the bit stream buffer
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream
- * [out] pDst pointer to the coefficient buffer of current
- * block. Should be 32-bit aligned
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_DecodeVLCZigzag_Intra(
- const OMX_U8 ** ppBitStream,
- OMX_INT * pBitOffset,
- OMX_S16 * pDst,
- OMX_U8 predDir,
- OMX_INT shortVideoHeader,
- OMX_U8 start
-);
-
-/**
- * Function: armVCM4P2_FillVLDBuffer
- *
- * Description:
- * Performs filling of the coefficient buffer according to the run, level
- * and sign, also updates the index
- *
- * Parameters:
- * [in] storeRun Stored Run value (count of zeros)
- * [in] storeLevel Stored Level value (non-zero value)
- * [in] sign Flag indicating the sign of level
- * [in] last status of the last flag
- * [in] pIndex pointer to coefficient index in 8x8 matrix
- * [out] pIndex pointer to updated coefficient index in 8x8
- * matrix
- * [in] pZigzagTable pointer to the zigzag tables
- * [out] pDst pointer to the coefficient buffer of current
- * block. Should be 32-bit aligned
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_FillVLDBuffer(
- OMX_U32 storeRun,
- OMX_S16 * pDst,
- OMX_S16 storeLevel,
- OMX_U8 sign,
- OMX_U8 last,
- OMX_U8 * index,
- const OMX_U8 * pZigzagTable
-);
-
-/**
- * Function: armVCM4P2_GetVLCBits
- *
- * Description:
- * Performs escape mode decision based on the run, run+, level, level+ and
- * last combinations.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bit stream
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * by *ppBitStream. Valid within 0 to 7
- * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0,
- * and escape mode 4 is used when shortVideoHeader==1.
- * [in] start start indicates whether the encoding begins with
- * 0th element or 1st.
- * [in/out] pLast pointer to last status flag
- * [in] runBeginSingleLevelEntriesL0 The run value from which level
- * will be equal to 1: last == 0
- * [in] IndexBeginSingleLevelEntriesL0 Array index in the VLC table
- * pointing to the
- * runBeginSingleLevelEntriesL0
- * [in] runBeginSingleLevelEntriesL1 The run value from which level
- * will be equal to 1: last == 1
- * [in] IndexBeginSingleLevelEntriesL1 Array index in the VLC table
- * pointing to the
- * runBeginSingleLevelEntriesL0
- * [in] pRunIndexTableL0 Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pVlcTableL0 VLC table for last == 0
- * [in] pRunIndexTableL1 Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [in] pVlcTableL1 VLC table for last == 1
- * [in] pLMAXTableL0 Level MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pLMAXTableL1 Level MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [in] pRMAXTableL0 Run MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pRMAXTableL1 Run MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [out]pDst pointer to the coefficient buffer of current
- * block. Should be 32-bit aligned
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_GetVLCBits (
- const OMX_U8 **ppBitStream,
- OMX_INT * pBitOffset,
- OMX_S16 * pDst,
- OMX_INT shortVideoHeader,
- OMX_U8 start,
- OMX_U8 * pLast,
- OMX_U8 runBeginSingleLevelEntriesL0,
- OMX_U8 maxIndexForMultipleEntriesL0,
- OMX_U8 maxRunForMultipleEntriesL1,
- OMX_U8 maxIndexForMultipleEntriesL1,
- const OMX_U8 * pRunIndexTableL0,
- const ARM_VLC32 *pVlcTableL0,
- const OMX_U8 * pRunIndexTableL1,
- const ARM_VLC32 *pVlcTableL1,
- const OMX_U8 * pLMAXTableL0,
- const OMX_U8 * pLMAXTableL1,
- const OMX_U8 * pRMAXTableL0,
- const OMX_U8 * pRMAXTableL1,
- const OMX_U8 * pZigzagTable
-);
-
-/**
- * Function: armVCM4P2_PutVLCBits
- *
- * Description:
- * Checks the type of Escape Mode and put encoded bits for
- * quantized DCT coefficients.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bit stream
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * by *ppBitStream. Valid within 0 to 7
- * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0,
- * and escape mode 4 is used when shortVideoHeader==1.
- * [in] start start indicates whether the encoding begins with
- * 0th element or 1st.
- * [in] maxStoreRunL0 Max store possible (considering last and inter/intra)
- * for last = 0
- * [in] maxStoreRunL1 Max store possible (considering last and inter/intra)
- * for last = 1
- * [in] maxRunForMultipleEntriesL0
- * The run value after which level
- * will be equal to 1:
- * (considering last and inter/intra status) for last = 0
- * [in] maxRunForMultipleEntriesL1
- * The run value after which level
- * will be equal to 1:
- * (considering last and inter/intra status) for last = 1
- * [in] pRunIndexTableL0 Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pVlcTableL0 VLC table for last == 0
- * [in] pRunIndexTableL1 Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [in] pVlcTableL1 VLC table for last == 1
- * [in] pLMAXTableL0 Level MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pLMAXTableL1 Level MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [in] pRMAXTableL0 Run MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pRMAXTableL1 Run MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [out] pQDctBlkCoef pointer to the quantized DCT coefficient
- * [out] ppBitStream *ppBitStream is updated after the block is encoded
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-
-OMXResult armVCM4P2_PutVLCBits (
- OMX_U8 **ppBitStream,
- OMX_INT * pBitOffset,
- const OMX_S16 *pQDctBlkCoef,
- OMX_INT shortVideoHeader,
- OMX_U8 start,
- OMX_U8 maxStoreRunL0,
- OMX_U8 maxStoreRunL1,
- OMX_U8 maxRunForMultipleEntriesL0,
- OMX_U8 maxRunForMultipleEntriesL1,
- const OMX_U8 * pRunIndexTableL0,
- const ARM_VLC32 *pVlcTableL0,
- const OMX_U8 * pRunIndexTableL1,
- const ARM_VLC32 *pVlcTableL1,
- const OMX_U8 * pLMAXTableL0,
- const OMX_U8 * pLMAXTableL1,
- const OMX_U8 * pRMAXTableL0,
- const OMX_U8 * pRMAXTableL1,
- const OMX_U8 * pZigzagTable
-);
-/**
- * Function: armVCM4P2_FillVLCBuffer
- *
- * Description:
- * Performs calculating the VLC bits depending on the escape type and insert
- * the same in the bitstream
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bit stream
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * by *ppBitStream. Valid within 0 to 7
- * [in] run Run value (count of zeros) to be encoded
- * [in] level Level value (non-zero value) to be encoded
- * [in] runPlus Calculated as runPlus = run - (RMAX + 1)
- * [in] levelPlus Calculated as
- * levelPlus = sign(level)*[abs(level) - LMAX]
- * [in] fMode Flag indicating the escape modes
- * [in] last status of the last flag
- * [in] maxRunForMultipleEntries
- * The run value after which level will be equal to 1:
- * (considering last and inter/intra status)
- * [in] pRunIndexTable Run Index table defined in
- * armVCM4P2_Huff_tables_VLC.h
- * [in] pVlcTable VLC table defined in armVCM4P2_Huff_tables_VLC.h
- * [out] ppBitStream *ppBitStream is updated after the block is encoded
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_FillVLCBuffer (
- OMX_U8 **ppBitStream,
- OMX_INT * pBitOffset,
- OMX_U32 run,
- OMX_S16 level,
- OMX_U32 runPlus,
- OMX_S16 levelPlus,
- OMX_U8 fMode,
- OMX_U8 last,
- OMX_U8 maxRunForMultipleEntries,
- const OMX_U8 *pRunIndexTable,
- const ARM_VLC32 *pVlcTable
-);
-
-/**
- * Function: armVCM4P2_CheckVLCEscapeMode
- *
- * Description:
- * Performs escape mode decision based on the run, run+, level, level+ and
- * last combinations.
- *
- * Remarks:
- *
- * Parameters:
- * [in] run Run value (count of zeros) to be encoded
- * [in] level Level value (non-zero value) to be encoded
- * [in] runPlus Calculated as runPlus = run - (RMAX + 1)
- * [in] levelPlus Calculated as
- * levelPlus = sign(level)*[abs(level) - LMAX]
- * [in] maxStoreRun Max store possible (considering last and inter/intra)
- * [in] maxRunForMultipleEntries
- * The run value after which level
- * will be equal to 1:
- * (considering last and inter/intra status)
- * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0,
- * and escape mode 4 is used when shortVideoHeader==1.
- * [in] pRunIndexTable Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.c
- * (considering last and inter/intra status)
- *
- *
- * Return Value:
- * Returns an Escape mode which can take values from 0 to 3
- * 0 --> no escape mode, 1 --> escape type 1,
- * 1 --> escape type 2, 3 --> escape type 3, check section 7.4.1.3
- * in the MPEG ISO standard.
- *
- */
-
-OMX_U8 armVCM4P2_CheckVLCEscapeMode(
- OMX_U32 run,
- OMX_U32 runPlus,
- OMX_S16 level,
- OMX_S16 levelPlus,
- OMX_U8 maxStoreRun,
- OMX_U8 maxRunForMultipleEntries,
- OMX_INT shortVideoHeader,
- const OMX_U8 *pRunIndexTable
-);
-
-
-/**
- * Function: armVCM4P2_BlockMatch_Integer
- *
- * Description:
- * Performs a 16x16 block search; estimates motion vector and associated minimum SAD.
- * Both the input and output motion vectors are represented using half-pixel units, and
- * therefore a shift left or right by 1 bit may be required, respectively, to match the
- * input or output MVs with other functions that either generate output MVs or expect
- * input MVs represented using integer pixel units.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcRefBuf pointer to the reference Y plane; points to the reference MB that
- * corresponds to the location of the current macroblock in the current
- * plane.
- * [in] refWidth width of the reference plane
- * [in] pRefRect pointer to the valid rectangular in reference plane. Relative to image origin.
- * It's not limited to the image boundary, but depended on the padding. For example,
- * if you pad 4 pixels outside the image border, then the value for left border
- * can be -4
- * [in] pSrcCurrBuf pointer to the current macroblock extracted from original plane (linear array,
- * 256 entries); must be aligned on an 8-byte boundary.
- * [in] pCurrPointPos position of the current macroblock in the current plane
- * [in] pSrcPreMV pointer to predicted motion vector; NULL indicates no predicted MV
- * [in] pSrcPreSAD pointer to SAD associated with the predicted MV (referenced by pSrcPreMV)
- * [in] searchRange search range for 16X16 integer block,the units of it is full pixel,the search range
- * is the same in all directions.It is in inclusive of the boundary and specified in
- * terms of integer pixel units.
- * [in] pMESpec vendor-specific motion estimation specification structure; must have been allocated
- * and then initialized using omxVCM4P2_MEInit prior to calling the block matching
- * function.
- * [in] BlockSize MacroBlock Size i.e either 16x16 or 8x8.
- * [out] pDstMV pointer to estimated MV
- * [out] pDstSAD pointer to minimum SAD
- *
- * Return Value:
- * OMX_Sts_NoErr ¨C no error.
- * OMX_Sts_BadArgErr ¨C bad arguments
- *
- */
-
-OMXResult armVCM4P2_BlockMatch_Integer(
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- const OMXVCMotionVector *pSrcPreMV,
- const OMX_INT *pSrcPreSAD,
- void *pMESpec,
- OMXVCMotionVector *pDstMV,
- OMX_INT *pDstSAD,
- OMX_U8 BlockSize
-);
-
-/**
- * Function: armVCM4P2_BlockMatch_Half
- *
- * Description:
- * Performs a 16x16 block match with half-pixel resolution. Returns the estimated
- * motion vector and associated minimum SAD. This function estimates the half-pixel
- * motion vector by interpolating the integer resolution motion vector referenced
- * by the input parameter pSrcDstMV, i.e., the initial integer MV is generated
- * externally. The input parameters pSrcRefBuf and pSearchPointRefPos should be
- * shifted by the winning MV of 16x16 integer search prior to calling BlockMatch_Half_16x16.
- * The function BlockMatch_Integer_16x16 may be used for integer motion estimation.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcRefBuf pointer to the reference Y plane; points to the reference MB
- * that corresponds to the location of the current macroblock in
- * the current plane.
- * [in] refWidth width of the reference plane
- * [in] pRefRect reference plane valid region rectangle
- * [in] pSrcCurrBuf pointer to the current macroblock extracted from original plane
- * (linear array, 256 entries); must be aligned on an 8-byte boundary.
- * [in] pSearchPointRefPos position of the starting point for half pixel search (specified
- * in terms of integer pixel units) in the reference plane.
- * [in] rndVal rounding control bit for half pixel motion estimation;
- * 0=rounding control disabled; 1=rounding control enabled
- * [in] pSrcDstMV pointer to the initial MV estimate; typically generated during a prior
- * 16X16 integer search and its unit is half pixel.
- * [in] BlockSize MacroBlock Size i.e either 16x16 or 8x8.
- * [out]pSrcDstMV pointer to estimated MV
- * [out]pDstSAD pointer to minimum SAD
- *
- * Return Value:
- * OMX_Sts_NoErr ¨C no error
- * OMX_Sts_BadArgErr ¨C bad arguments
- *
- */
-
-OMXResult armVCM4P2_BlockMatch_Half(
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pSearchPointRefPos,
- OMX_INT rndVal,
- OMXVCMotionVector *pSrcDstMV,
- OMX_INT *pDstSAD,
- OMX_U8 BlockSize
-);
-/**
- * Function: armVCM4P2_PadMV
- *
- * Description:
- * Performs motion vector padding for a macroblock.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcDstMV pointer to motion vector buffer of the current
- * macroblock
- * [in] pTransp pointer to transparent status buffer of the
- * current macroblock
- * [out] pSrcDstMV pointer to motion vector buffer in which the
- * motion vectors have been padded
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_PadMV(
- OMXVCMotionVector * pSrcDstMV,
- OMX_U8 * pTransp
-);
-
-/*
- * H.264 Specific Declarations
- */
-/* Defines */
-#define ARM_M4P10_Q_OFFSET (15)
-
-
-/* Dequant tables */
-
-extern const OMX_U8 armVCM4P10_PosToVCol4x4[16];
-extern const OMX_U8 armVCM4P10_PosToVCol2x2[4];
-extern const OMX_U8 armVCM4P10_VMatrix[6][3];
-extern const OMX_U32 armVCM4P10_MFMatrix[6][3];
-
-
-/*
- * Description:
- * This function perform the work required by the OpenMAX
- * DecodeCoeffsToPair function and DecodeChromaDCCoeffsToPair.
- * Since most of the code is common we share it here.
- *
- * Parameters:
- * [in] ppBitStream Double pointer to current byte in bit stream buffer
- * [in] pOffset Pointer to current bit position in the byte pointed
- * to by *ppBitStream
- * [in] sMaxNumCoeff Maximum number of non-zero coefficients in current
- * block (4,15 or 16)
- * [in] nTable Table number (0 to 4) according to the five columns
- * of Table 9-5 in the H.264 spec
- * [out] ppBitStream *ppBitStream is updated after each block is decoded
- * [out] pOffset *pOffset is updated after each block is decoded
- * [out] pNumCoeff Pointer to the number of nonzero coefficients in
- * this block
- * [out] ppPosCoefbuf Double pointer to destination residual
- * coefficient-position pair buffer
- * Return Value:
- * Standard omxError result. See enumeration for possible result codes.
-
- */
-
-OMXResult armVCM4P10_DecodeCoeffsToPair(
- const OMX_U8** ppBitStream,
- OMX_S32* pOffset,
- OMX_U8* pNumCoeff,
- OMX_U8**ppPosCoefbuf,
- OMX_INT nTable,
- OMX_INT sMaxNumCoeff
- );
-
-/*
- * Description:
- * Perform DC style intra prediction, averaging upper and left block
- *
- * Parameters:
- * [in] pSrcLeft Pointer to the buffer of 16 left coefficients:
- * p[x, y] (x = -1, y = 0..3)
- * [in] pSrcAbove Pointer to the buffer of 16 above coefficients:
- * p[x,y] (x = 0..3, y = -1)
- * [in] leftStep Step of left coefficient buffer
- * [in] dstStep Step of the destination buffer
- * [in] availability Neighboring 16x16 MB availability flag
- * [out] pDst Pointer to the destination buffer
- *
- * Return Value:
- * None
- */
-
-void armVCM4P10_PredictIntraDC4x4(
- const OMX_U8* pSrcLeft,
- const OMX_U8 *pSrcAbove,
- OMX_U8* pDst,
- OMX_INT leftStep,
- OMX_INT dstStep,
- OMX_S32 availability
-);
-
-/*
- * Description
- * Unpack a 4x4 block of coefficient-residual pair values
- *
- * Parameters:
- * [in] ppSrc Double pointer to residual coefficient-position pair
- * buffer output by CALVC decoding
- * [out] ppSrc *ppSrc is updated to the start of next non empty block
- * [out] pDst Pointer to unpacked 4x4 block
- */
-
-void armVCM4P10_UnpackBlock4x4(
- const OMX_U8 **ppSrc,
- OMX_S16* pDst
-);
-
-/*
- * Description
- * Unpack a 2x2 block of coefficient-residual pair values
- *
- * Parameters:
- * [in] ppSrc Double pointer to residual coefficient-position pair
- * buffer output by CALVC decoding
- * [out] ppSrc *ppSrc is updated to the start of next non empty block
- * [out] pDst Pointer to unpacked 4x4 block
- */
-
-void armVCM4P10_UnpackBlock2x2(
- const OMX_U8 **ppSrc,
- OMX_S16* pDst
-);
-
-/*
- * Description
- * Deblock one boundary pixel
- *
- * Parameters:
- * [in] pQ0 Pointer to pixel q0
- * [in] Step Step between pixels q0 and q1
- * [in] tC0 Edge threshold value
- * [in] alpha alpha threshold value
- * [in] beta beta threshold value
- * [in] bS deblocking strength
- * [in] ChromaFlag True for chroma blocks
- * [out] pQ0 Deblocked pixels
- *
- */
-
-void armVCM4P10_DeBlockPixel(
- OMX_U8 *pQ0, /* pointer to the pixel q0 */
- int Step, /* step between pixels q0 and q1 */
- int tC0, /* edge threshold value */
- int alpha, /* alpha */
- int beta, /* beta */
- int bS, /* deblocking strength */
- int ChromaFlag
-);
-
-/**
- * Function: armVCM4P10_InterpolateHalfHor_Luma
- *
- * Description:
- * This function performs interpolation for horizontal 1/2-pel positions
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block used to interpolate
- in the reconstructed frame plane
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination(interpolation) buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [out] pDst Pointer to the interpolation buffer of the 1/2-pel
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-
-OMXResult armVCM4P10_InterpolateHalfHor_Luma(
- const OMX_U8* pSrc,
- OMX_U32 iSrcStep,
- OMX_U8* pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-);
-
-/**
- * Function: armVCM4P10_InterpolateHalfVer_Luma
- *
- * Description:
- * This function performs interpolation for vertical 1/2-pel positions
- * around a full-pel position.
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block used to interpolate
- * in the reconstructed frame plane
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination(interpolation) buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [out] pDst Pointer to the interpolation buffer of the 1/2-pel
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-
-OMXResult armVCM4P10_InterpolateHalfVer_Luma(
- const OMX_U8* pSrc,
- OMX_U32 iSrcStep,
- OMX_U8* pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-);
-
-/**
- * Function: armVCM4P10_InterpolateHalfDiag_Luma
- *
- * Description:
- * This function performs interpolation for (1/2, 1/2) positions
- * around a full-pel position.
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block used to interpolate
- * in the reconstructed frame plane
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination(interpolation) buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [out] pDst Pointer to the interpolation buffer of the (1/2,1/2)-pel
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-
-OMXResult armVCM4P10_InterpolateHalfDiag_Luma(
- const OMX_U8* pSrc,
- OMX_U32 iSrcStep,
- OMX_U8* pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-);
-
-/*
- * Description:
- * Transform Residual 4x4 Coefficients
- *
- * Parameters:
- * [in] pSrc Source 4x4 block
- * [out] pDst Destination 4x4 block
- *
- */
-
-void armVCM4P10_TransformResidual4x4(OMX_S16* pDst, OMX_S16 *pSrc);
-
-/*
- * Description:
- * Forward Transform Residual 4x4 Coefficients
- *
- * Parameters:
- * [in] pSrc Source 4x4 block
- * [out] pDst Destination 4x4 block
- *
- */
-
-void armVCM4P10_FwdTransformResidual4x4(OMX_S16* pDst, OMX_S16 *pSrc);
-
-OMX_INT armVCM4P10_CompareMotionCostToMV (
- OMX_S16 mvX,
- OMX_S16 mvY,
- OMXVCMotionVector diffMV,
- OMX_INT candSAD,
- OMXVCMotionVector *bestMV,
- OMX_U32 nLamda,
- OMX_S32 *pBestCost);
-
-/**
- * Function: armVCCOMM_SAD
- *
- * Description:
- * This function calculate the SAD for NxM blocks.
- *
- * Remarks:
- *
- * [in] pSrcOrg Pointer to the original block
- * [in] iStepOrg Step of the original block buffer
- * [in] pSrcRef Pointer to the reference block
- * [in] iStepRef Step of the reference block buffer
- * [in] iHeight Height of the block
- * [in] iWidth Width of the block
- * [out] pDstSAD Pointer of result SAD
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-OMXResult armVCCOMM_SAD(
- const OMX_U8* pSrcOrg,
- OMX_U32 iStepOrg,
- const OMX_U8* pSrcRef,
- OMX_U32 iStepRef,
- OMX_S32* pDstSAD,
- OMX_U32 iHeight,
- OMX_U32 iWidth);
-
-/**
- * Function: armVCCOMM_Average
- *
- * Description:
- * This function calculates the average of two blocks and stores the result.
- *
- * Remarks:
- *
- * [in] pPred0 Pointer to the top-left corner of reference block 0
- * [in] pPred1 Pointer to the top-left corner of reference block 1
- * [in] iPredStep0 Step of reference block 0
- * [in] iPredStep1 Step of reference block 1
- * [in] iDstStep Step of the destination buffer
- * [in] iWidth Width of the blocks
- * [in] iHeight Height of the blocks
- * [out] pDstPred Pointer to the destination buffer
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
- OMXResult armVCCOMM_Average (
- const OMX_U8* pPred0,
- const OMX_U8* pPred1,
- OMX_U32 iPredStep0,
- OMX_U32 iPredStep1,
- OMX_U8* pDstPred,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-);
-
-/**
- * Function: armVCM4P10_SADQuar
- *
- * Description:
- * This function calculates the SAD between one block (pSrc) and the
- * average of the other two (pSrcRef0 and pSrcRef1)
- *
- * Remarks:
- *
- * [in] pSrc Pointer to the original block
- * [in] pSrcRef0 Pointer to reference block 0
- * [in] pSrcRef1 Pointer to reference block 1
- * [in] iSrcStep Step of the original block buffer
- * [in] iRefStep0 Step of reference block 0
- * [in] iRefStep1 Step of reference block 1
- * [in] iHeight Height of the block
- * [in] iWidth Width of the block
- * [out] pDstSAD Pointer of result SAD
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-OMXResult armVCM4P10_SADQuar(
- const OMX_U8* pSrc,
- const OMX_U8* pSrcRef0,
- const OMX_U8* pSrcRef1,
- OMX_U32 iSrcStep,
- OMX_U32 iRefStep0,
- OMX_U32 iRefStep1,
- OMX_U32* pDstSAD,
- OMX_U32 iHeight,
- OMX_U32 iWidth
-);
-
-/**
- * Function: armVCM4P10_Interpolate_Chroma
- *
- * Description:
- * This function performs interpolation for chroma components.
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block used to
- * interpolate in the reconstructed frame plane
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination(interpolation) buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [in] dx Fractional part of horizontal motion vector
- * component in 1/8 pixel unit (0~7)
- * [in] dy Fractional part of vertical motion vector
- * component in 1/8 pixel unit (0~7)
- * [out] pDst Pointer to the interpolation buffer
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
- OMXResult armVCM4P10_Interpolate_Chroma(
- OMX_U8 *pSrc,
- OMX_U32 iSrcStep,
- OMX_U8 *pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight,
- OMX_U32 dx,
- OMX_U32 dy
-);
-
-/**
- * Function: armVCM4P10_Interpolate_Luma
- *
- * Description:
- * This function performs interpolation for luma components.
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block used to
- * interpolate in the reconstructed frame plane
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination(interpolation) buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [in] dx Fractional part of horizontal motion vector
- * component in 1/4 pixel unit (0~3)
- * [in] dy Fractional part of vertical motion vector
- * component in 1/4 pixel unit (0~3)
- * [out] pDst Pointer to the interpolation buffer
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-
- OMXResult armVCM4P10_Interpolate_Luma(
- const OMX_U8 *pSrc,
- OMX_U32 iSrcStep,
- OMX_U8 *pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight,
- OMX_U32 dx,
- OMX_U32 dy
-);
-
-/**
- * Function: omxVCH264_DequantTransformACFromPair_U8_S16_C1_DLx
- *
- * Description:
- * Reconstruct the 4x4 residual block from coefficient-position pair buffer,
- * perform dequantisation and integer inverse transformation for 4x4 block of
- * residuals and update the pair buffer pointer to next non-empty block.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppSrc Double pointer to residual coefficient-position
- * pair buffer output by CALVC decoding
- * [in] pDC Pointer to the DC coefficient of this block, NULL
- * if it doesn't exist
- * [in] QP Quantization parameter
- * [in] AC Flag indicating if at least one non-zero coefficient exists
- * [out] pDst pointer to the reconstructed 4x4 block data
- *
- * Return Value:
- * Standard omxError result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P10_DequantTransformACFromPair_U8_S16_C1_DLx(
- OMX_U8 **ppSrc,
- OMX_S16 *pDst,
- OMX_INT QP,
- OMX_S16* pDC,
- int AC
-);
-
-#endif /*_armVideo_H_*/
-
-/*End of File*/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/api/omxVC.h b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/api/omxVC.h
deleted file mode 100644
index 7b3cc72..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/api/omxVC.h
+++ /dev/null
@@ -1,4381 +0,0 @@
-/**
- * File: omxVC.h
- * Brief: OpenMAX DL v1.0.2 - Video Coding library
- *
- * Copyright © 2005-2008 The Khronos Group Inc. All Rights Reserved.
- *
- * These materials are protected by copyright laws and contain material
- * proprietary to the Khronos Group, Inc. You may use these materials
- * for implementing Khronos specifications, without altering or removing
- * any trademark, copyright or other notice from the specification.
- *
- * Khronos Group makes no, and expressly disclaims any, representations
- * or warranties, express or implied, regarding these materials, including,
- * without limitation, any implied warranties of merchantability or fitness
- * for a particular purpose or non-infringement of any intellectual property.
- * Khronos Group makes no, and expressly disclaims any, warranties, express
- * or implied, regarding the correctness, accuracy, completeness, timeliness,
- * and reliability of these materials.
- *
- * Under no circumstances will the Khronos Group, or any of its Promoters,
- * Contributors or Members or their respective partners, officers, directors,
- * employees, agents or representatives be liable for any damages, whether
- * direct, indirect, special or consequential damages for lost revenues,
- * lost profits, or otherwise, arising from or in connection with these
- * materials.
- *
- * Khronos and OpenMAX are trademarks of the Khronos Group Inc.
- *
- */
-
-/* *****************************************************************************************/
-
-#ifndef _OMXVC_H_
-#define _OMXVC_H_
-
-#include "omxtypes.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* 6.1.1.1 Motion Vectors */
-/* In omxVC, motion vectors are represented as follows: */
-
-typedef struct {
- OMX_S16 dx;
- OMX_S16 dy;
-} OMXVCMotionVector;
-
-
-
-/**
- * Function: omxVCCOMM_Average_8x (6.1.3.1.1)
- *
- * Description:
- * This function calculates the average of two 8x4, 8x8, or 8x16 blocks. The
- * result is rounded according to (a+b+1)/2. The block average function can
- * be used in conjunction with half-pixel interpolation to obtain quarter
- * pixel motion estimates, as described in [ISO14496-10], subclause 8.4.2.2.1.
- *
- * Input Arguments:
- *
- * pPred0 - Pointer to the top-left corner of reference block 0
- * pPred1 - Pointer to the top-left corner of reference block 1
- * iPredStep0 - Step of reference block 0
- * iPredStep1 - Step of reference block 1
- * iDstStep - Step of the destination buffer.
- * iHeight - Height of the blocks
- *
- * Output Arguments:
- *
- * pDstPred - Pointer to the destination buffer. 8-byte aligned.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - one or more of the following pointers is NULL: pPred0, pPred1, or
- * pDstPred.
- * - pDstPred is not aligned on an 8-byte boundary.
- * - iPredStep0 <= 0 or iPredStep0 is not a multiple of 8.
- * - iPredStep1 <= 0 or iPredStep1 is not a multiple of 8.
- * - iDstStep <= 0 or iDstStep is not a multiple of 8.
- * - iHeight is not 4, 8, or 16.
- *
- */
-OMXResult omxVCCOMM_Average_8x (
- const OMX_U8 *pPred0,
- const OMX_U8 *pPred1,
- OMX_U32 iPredStep0,
- OMX_U32 iPredStep1,
- OMX_U8 *pDstPred,
- OMX_U32 iDstStep,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCCOMM_Average_16x (6.1.3.1.2)
- *
- * Description:
- * This function calculates the average of two 16x16 or 16x8 blocks. The
- * result is rounded according to (a+b+1)/2. The block average function can
- * be used in conjunction with half-pixel interpolation to obtain quarter
- * pixel motion estimates, as described in [ISO14496-10], subclause 8.4.2.2.1.
- *
- * Input Arguments:
- *
- * pPred0 - Pointer to the top-left corner of reference block 0
- * pPred1 - Pointer to the top-left corner of reference block 1
- * iPredStep0 - Step of reference block 0
- * iPredStep1 - Step of reference block 1
- * iDstStep - Step of the destination buffer
- * iHeight - Height of the blocks
- *
- * Output Arguments:
- *
- * pDstPred - Pointer to the destination buffer. 16-byte aligned.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - one or more of the following pointers is NULL: pPred0, pPred1, or
- * pDstPred.
- * - pDstPred is not aligned on a 16-byte boundary.
- * - iPredStep0 <= 0 or iPredStep0 is not a multiple of 16.
- * - iPredStep1 <= 0 or iPredStep1 is not a multiple of 16.
- * - iDstStep <= 0 or iDstStep is not a multiple of 16.
- * - iHeight is not 8 or 16.
- *
- */
-OMXResult omxVCCOMM_Average_16x (
- const OMX_U8 *pPred0,
- const OMX_U8 *pPred1,
- OMX_U32 iPredStep0,
- OMX_U32 iPredStep1,
- OMX_U8 *pDstPred,
- OMX_U32 iDstStep,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCCOMM_ExpandFrame_I (6.1.3.2.1)
- *
- * Description:
- * This function expands a reconstructed frame in-place. The unexpanded
- * source frame should be stored in a plane buffer with sufficient space
- * pre-allocated for edge expansion, and the input frame should be located in
- * the plane buffer center. This function executes the pixel expansion by
- * replicating source frame edge pixel intensities in the empty pixel
- * locations (expansion region) between the source frame edge and the plane
- * buffer edge. The width/height of the expansion regions on the
- * horizontal/vertical edges is controlled by the parameter iExpandPels.
- *
- * Input Arguments:
- *
- * pSrcDstPlane - pointer to the top-left corner of the frame to be
- * expanded; must be aligned on an 8-byte boundary.
- * iFrameWidth - frame width; must be a multiple of 8.
- * iFrameHeight -frame height; must be a multiple of 8.
- * iExpandPels - number of pixels to be expanded in the horizontal and
- * vertical directions; must be a multiple of 8.
- * iPlaneStep - distance, in bytes, between the start of consecutive lines
- * in the plane buffer; must be larger than or equal to
- * (iFrameWidth + 2 * iExpandPels).
- *
- * Output Arguments:
- *
- * pSrcDstPlane -Pointer to the top-left corner of the frame (NOT the
- * top-left corner of the plane); must be aligned on an 8-byte
- * boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - pSrcDstPlane is NULL.
- * - pSrcDstPlane is not aligned on an 8-byte boundary.
- * - one of the following parameters is either equal to zero or is a
- * non-multiple of 8: iFrameHeight, iFrameWidth, iPlaneStep, or
- * iExpandPels.
- * - iPlaneStep < (iFrameWidth + 2 * iExpandPels).
- *
- */
-OMXResult omxVCCOMM_ExpandFrame_I (
- OMX_U8 *pSrcDstPlane,
- OMX_U32 iFrameWidth,
- OMX_U32 iFrameHeight,
- OMX_U32 iExpandPels,
- OMX_U32 iPlaneStep
-);
-
-
-
-/**
- * Function: omxVCCOMM_Copy8x8 (6.1.3.3.1)
- *
- * Description:
- * Copies the reference 8x8 block to the current block.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the reference block in the source frame; must be
- * aligned on an 8-byte boundary.
- * step - distance between the starts of consecutive lines in the reference
- * frame, in bytes; must be a multiple of 8 and must be larger than
- * or equal to 8.
- *
- * Output Arguments:
- *
- * pDst - pointer to the destination block; must be aligned on an 8-byte
- * boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - one or more of the following pointers is NULL: pSrc, pDst
- * - one or more of the following pointers is not aligned on an 8-byte
- * boundary: pSrc, pDst
- * - step <8 or step is not a multiple of 8.
- *
- */
-OMXResult omxVCCOMM_Copy8x8 (
- const OMX_U8 *pSrc,
- OMX_U8 *pDst,
- OMX_INT step
-);
-
-
-
-/**
- * Function: omxVCCOMM_Copy16x16 (6.1.3.3.2)
- *
- * Description:
- * Copies the reference 16x16 macroblock to the current macroblock.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the reference macroblock in the source frame; must be
- * aligned on a 16-byte boundary.
- * step - distance between the starts of consecutive lines in the reference
- * frame, in bytes; must be a multiple of 16 and must be larger
- * than or equal to 16.
- *
- * Output Arguments:
- *
- * pDst - pointer to the destination macroblock; must be aligned on a
- * 16-byte boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - one or more of the following pointers is NULL: pSrc, pDst
- * - one or more of the following pointers is not aligned on a 16-byte
- * boundary: pSrc, pDst
- * - step <16 or step is not a multiple of 16.
- *
- */
-OMXResult omxVCCOMM_Copy16x16 (
- const OMX_U8 *pSrc,
- OMX_U8 *pDst,
- OMX_INT step
-);
-
-
-
-/**
- * Function: omxVCCOMM_ComputeTextureErrorBlock_SAD (6.1.4.1.1)
- *
- * Description:
- * Computes texture error of the block; also returns SAD.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the source plane; must be aligned on an 8-byte
- * boundary.
- * srcStep - step of the source plane
- * pSrcRef - pointer to the reference buffer, an 8x8 block; must be aligned
- * on an 8-byte boundary.
- *
- * Output Arguments:
- *
- * pDst - pointer to the destination buffer, an 8x8 block; must be aligned
- * on an 8-byte boundary.
- * pDstSAD - pointer to the Sum of Absolute Differences (SAD) value
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - At least one of the following
- * pointers is NULL: pSrc, pSrcRef, pDst and pDstSAD.
- * - pSrc is not 8-byte aligned.
- * - SrcStep <= 0 or srcStep is not a multiple of 8.
- * - pSrcRef is not 8-byte aligned.
- * - pDst is not 8-byte aligned.
- *
- */
-OMXResult omxVCCOMM_ComputeTextureErrorBlock_SAD (
- const OMX_U8 *pSrc,
- OMX_INT srcStep,
- const OMX_U8 *pSrcRef,
- OMX_S16 *pDst,
- OMX_INT *pDstSAD
-);
-
-
-
-/**
- * Function: omxVCCOMM_ComputeTextureErrorBlock (6.1.4.1.2)
- *
- * Description:
- * Computes the texture error of the block.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the source plane. This should be aligned on an 8-byte
- * boundary.
- * srcStep - step of the source plane
- * pSrcRef - pointer to the reference buffer, an 8x8 block. This should be
- * aligned on an 8-byte boundary.
- *
- * Output Arguments:
- *
- * pDst - pointer to the destination buffer, an 8x8 block. This should be
- * aligned on an 8-byte boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - At least one of the following pointers is NULL:
- * pSrc, pSrcRef, pDst.
- * - pSrc is not 8-byte aligned.
- * - SrcStep <= 0 or srcStep is not a multiple of 8.
- * - pSrcRef is not 8-byte aligned.
- * - pDst is not 8-byte aligned
- *
- */
-OMXResult omxVCCOMM_ComputeTextureErrorBlock (
- const OMX_U8 *pSrc,
- OMX_INT srcStep,
- const OMX_U8 *pSrcRef,
- OMX_S16 *pDst
-);
-
-
-
-/**
- * Function: omxVCCOMM_LimitMVToRect (6.1.4.1.3)
- *
- * Description:
- * Limits the motion vector associated with the current block/macroblock to
- * prevent the motion compensated block/macroblock from moving outside a
- * bounding rectangle as shown in Figure 6-1.
- *
- * Input Arguments:
- *
- * pSrcMV - pointer to the motion vector associated with the current block
- * or macroblock
- * pRectVOPRef - pointer to the bounding rectangle
- * Xcoord, Ycoord - coordinates of the current block or macroblock
- * size - size of the current block or macroblock; must be equal to 8 or
- * 16.
- *
- * Output Arguments:
- *
- * pDstMV - pointer to the limited motion vector
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one or more of the
- * following conditions is true:
- * - at least one of the following pointers is NULL:
- * pSrcMV, pDstMV, or pRectVOPRef.
- * - size is not equal to either 8 or 16.
- * - the width or height of the bounding rectangle is less than
- * twice the block size.
- */
-OMXResult omxVCCOMM_LimitMVToRect (
- const OMXVCMotionVector *pSrcMV,
- OMXVCMotionVector *pDstMV,
- const OMXRect *pRectVOPRef,
- OMX_INT Xcoord,
- OMX_INT Ycoord,
- OMX_INT size
-);
-
-
-
-/**
- * Function: omxVCCOMM_SAD_16x (6.1.4.1.4)
- *
- * Description:
- * This function calculates the SAD for 16x16 and 16x8 blocks.
- *
- * Input Arguments:
- *
- * pSrcOrg - Pointer to the original block; must be aligned on a 16-byte
- * boundary.
- * iStepOrg - Step of the original block buffer
- * pSrcRef - Pointer to the reference block
- * iStepRef - Step of the reference block buffer
- * iHeight - Height of the block
- *
- * Output Arguments:
- *
- * pDstSAD - Pointer of result SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one or more of the
- * following conditions is true:
- * - at least one of the following pointers is NULL:
- * pSrcOrg, pDstSAD, or pSrcRef
- * - pSrcOrg is not 16-byte aligned.
- * - iStepOrg <= 0 or iStepOrg is not a multiple of 16
- * - iStepRef <= 0 or iStepRef is not a multiple of 16
- * - iHeight is not 8 or 16
- *
- */
-OMXResult omxVCCOMM_SAD_16x (
- const OMX_U8 *pSrcOrg,
- OMX_U32 iStepOrg,
- const OMX_U8 *pSrcRef,
- OMX_U32 iStepRef,
- OMX_S32 *pDstSAD,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCCOMM_SAD_8x (6.1.4.1.5)
- *
- * Description:
- * This function calculates the SAD for 8x16, 8x8, 8x4 blocks.
- *
- * Input Arguments:
- *
- * pSrcOrg - Pointer to the original block; must be aligned on a 8-byte
- * boundary.
- * iStepOrg - Step of the original block buffer
- * pSrcRef - Pointer to the reference block
- * iStepRef - Step of the reference block buffer
- * iHeight - Height of the block
- *
- * Output Arguments:
- *
- * pDstSAD -Pointer of result SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one or more of the
- * following conditions is true:
- * - at least one of the following pointers is NULL:
- * pSrcOrg, pDstSAD, or pSrcRef
- * - pSrcOrg is not 8-byte aligned.
- * - iStepOrg <= 0 or iStepOrg is not a multiple of 8
- * - iStepRef <= 0 or iStepRef is not a multiple of 8
- * - iHeight is not 4, 8 or 16
- *
- */
-OMXResult omxVCCOMM_SAD_8x (
- const OMX_U8 *pSrcOrg,
- OMX_U32 iStepOrg,
- const OMX_U8 *pSrcRef,
- OMX_U32 iStepRef,
- OMX_S32*pDstSAD,
- OMX_U32 iHeight
-);
-
-
-
-/* 6.2.1.1 Direction */
-/* The direction enumerator is used with functions that perform AC/DC prediction and zig-zag scan. */
-
-enum {
- OMX_VC_NONE = 0,
- OMX_VC_HORIZONTAL = 1,
- OMX_VC_VERTICAL = 2
-};
-
-
-
-/* 6.2.1.2 Bilinear Interpolation */
-/* The bilinear interpolation enumerator is used with motion estimation, motion compensation, and reconstruction functions. */
-
-enum {
- OMX_VC_INTEGER_PIXEL = 0, /* case a */
- OMX_VC_HALF_PIXEL_X = 1, /* case b */
- OMX_VC_HALF_PIXEL_Y = 2, /* case c */
- OMX_VC_HALF_PIXEL_XY = 3 /* case d */
-};
-
-
-
-/* 6.2.1.3 Neighboring Macroblock Availability */
-/* Neighboring macroblock availability is indicated using the following flags: */
-
-enum {
- OMX_VC_UPPER = 1, /** above macroblock is available */
- OMX_VC_LEFT = 2, /** left macroblock is available */
- OMX_VC_CENTER = 4,
- OMX_VC_RIGHT = 8,
- OMX_VC_LOWER = 16,
- OMX_VC_UPPER_LEFT = 32, /** above-left macroblock is available */
- OMX_VC_UPPER_RIGHT = 64, /** above-right macroblock is available */
- OMX_VC_LOWER_LEFT = 128,
- OMX_VC_LOWER_RIGHT = 256
-};
-
-
-
-/* 6.2.1.4 Video Components */
-/* A data type that enumerates video components is defined as follows: */
-
-typedef enum {
- OMX_VC_LUMINANCE, /** Luminance component */
- OMX_VC_CHROMINANCE /** chrominance component */
-} OMXVCM4P2VideoComponent;
-
-
-
-/* 6.2.1.5 MacroblockTypes */
-/* A data type that enumerates macroblock types is defined as follows: */
-
-typedef enum {
- OMX_VC_INTER = 0, /** P picture or P-VOP */
- OMX_VC_INTER_Q = 1, /** P picture or P-VOP */
- OMX_VC_INTER4V = 2, /** P picture or P-VOP */
- OMX_VC_INTRA = 3, /** I and P picture, I- and P-VOP */
- OMX_VC_INTRA_Q = 4, /** I and P picture, I- and P-VOP */
- OMX_VC_INTER4V_Q = 5 /** P picture or P-VOP (H.263)*/
-} OMXVCM4P2MacroblockType;
-
-
-
-/* 6.2.1.6 Coordinates */
-/* Coordinates are represented as follows: */
-
-typedef struct {
- OMX_INT x;
- OMX_INT y;
-} OMXVCM4P2Coordinate;
-
-
-
-/* 6.2.1.7 Motion Estimation Algorithms */
-/* A data type that enumerates motion estimation search methods is defined as follows: */
-
-typedef enum {
- OMX_VC_M4P2_FAST_SEARCH = 0, /** Fast motion search */
- OMX_VC_M4P2_FULL_SEARCH = 1 /** Full motion search */
-} OMXVCM4P2MEMode;
-
-
-
-/* 6.2.1.8 Motion Estimation Parameters */
-/* A data structure containing control parameters for
- * motion estimation functions is defined as follows:
- */
-
-typedef struct {
- OMX_INT searchEnable8x8; /** enables 8x8 search */
- OMX_INT halfPelSearchEnable; /** enables half-pel resolution */
- OMX_INT searchRange; /** search range */
- OMX_INT rndVal; /** rounding control; 0-disabled, 1-enabled*/
-} OMXVCM4P2MEParams;
-
-
-
-/* 6.2.1.9 Macroblock Information */
-/* A data structure containing macroblock parameters for
- * motion estimation functions is defined as follows:
- */
-
-typedef struct {
- OMX_S32 sliceId; /* slice number */
- OMXVCM4P2MacroblockType mbType; /* MB type: OMX_VC_INTRA, OMX_VC_INTER, or OMX_VC_INTER4 */
- OMX_S32 qp; /* quantization parameter*/
- OMX_U32 cbpy; /* CBP Luma */
- OMX_U32 cbpc; /* CBP Chroma */
- OMXVCMotionVector pMV0[2][2]; /* motion vector, represented using 1/2-pel units,
- * pMV0[blocky][blockx] (blocky = 0~1, blockx =0~1)
- */
- OMXVCMotionVector pMVPred[2][2]; /* motion vector prediction, represented using 1/2-pel units,
- * pMVPred[blocky][blockx] (blocky = 0~1, blockx = 0~1)
- */
- OMX_U8 pPredDir[2][2]; /* AC prediction direction:
- * OMX_VC_NONE, OMX_VC_VERTICAL, OMX_VC_HORIZONTAL
- */
-} OMXVCM4P2MBInfo, *OMXVCM4P2MBInfoPtr;
-
-
-
-/**
- * Function: omxVCM4P2_FindMVpred (6.2.3.1.1)
- *
- * Description:
- * Predicts a motion vector for the current block using the procedure
- * specified in [ISO14496-2], subclause 7.6.5. The resulting predicted MV is
- * returned in pDstMVPred. If the parameter pDstMVPredME if is not NULL then
- * the set of three MV candidates used for prediction is also returned,
- * otherwise pDstMVPredMEis NULL upon return.
- *
- * Input Arguments:
- *
- * pSrcMVCurMB - pointer to the MV buffer associated with the current Y
- * macroblock; a value of NULL indicates unavailability.
- * pSrcCandMV1 - pointer to the MV buffer containing the 4 MVs associated
- * with the MB located to the left of the current MB; set to NULL
- * if there is no MB to the left.
- * pSrcCandMV2 - pointer to the MV buffer containing the 4 MVs associated
- * with the MB located above the current MB; set to NULL if there
- * is no MB located above the current MB.
- * pSrcCandMV3 - pointer to the MV buffer containing the 4 MVs associated
- * with the MB located to the right and above the current MB; set
- * to NULL if there is no MB located to the above-right.
- * iBlk - the index of block in the current macroblock
- * pDstMVPredME - MV candidate return buffer; if set to NULL then
- * prediction candidate MVs are not returned and pDstMVPredME will
- * be NULL upon function return; if pDstMVPredME is non-NULL then it
- * must point to a buffer containing sufficient space for three
- * return MVs.
- *
- * Output Arguments:
- *
- * pDstMVPred - pointer to the predicted motion vector
- * pDstMVPredME - if non-NULL upon input then pDstMVPredME points upon
- * return to a buffer containing the three motion vector candidates
- * used for prediction as specified in [ISO14496-2], subclause
- * 7.6.5, otherwise if NULL upon input then pDstMVPredME is NULL
- * upon output.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - the pointer pDstMVPred is NULL
- * - the parameter iBlk does not fall into the range 0 <= iBlk<=3
- *
- */
-OMXResult omxVCM4P2_FindMVpred (
- const OMXVCMotionVector *pSrcMVCurMB,
- const OMXVCMotionVector *pSrcCandMV1,
- const OMXVCMotionVector *pSrcCandMV2,
- const OMXVCMotionVector *pSrcCandMV3,
- OMXVCMotionVector *pDstMVPred,
- OMXVCMotionVector *pDstMVPredME,
- OMX_INT iBlk
-);
-
-
-
-/**
- * Function: omxVCM4P2_IDCT8x8blk (6.2.3.2.1)
- *
- * Description:
- * Computes a 2D inverse DCT for a single 8x8 block, as defined in
- * [ISO14496-2].
- *
- * Input Arguments:
- *
- * pSrc - pointer to the start of the linearly arranged IDCT input buffer;
- * must be aligned on a 16-byte boundary. According to
- * [ISO14496-2], the input coefficient values should lie within the
- * range [-2048, 2047].
- *
- * Output Arguments:
- *
- * pDst - pointer to the start of the linearly arranged IDCT output buffer;
- * must be aligned on a 16-byte boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - pSrc or pDst is NULL.
- * - pSrc or pDst is not 16-byte aligned.
- *
- */
-OMXResult omxVCM4P2_IDCT8x8blk (
- const OMX_S16 *pSrc,
- OMX_S16 *pDst
-);
-
-
-
-/**
- * Function: omxVCM4P2_MEGetBufSize (6.2.4.1.1)
- *
- * Description:
- * Computes the size, in bytes, of the vendor-specific specification
- * structure for the following motion estimation functions:
- * BlockMatch_Integer_8x8, BlockMatch_Integer_16x16, and MotionEstimationMB.
- *
- * Input Arguments:
- *
- * MEmode - motion estimation mode; available modes are defined by the
- * enumerated type OMXVCM4P2MEMode
- * pMEParams - motion estimation parameters
- *
- * Output Arguments:
- *
- * pSize - pointer to the number of bytes required for the specification
- * structure
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - one or more of the following is true:
- * - an invalid value was specified for the parameter MEmode
- * - a negative or zero value was specified for the
- * parameter pMEParams->searchRange
- *
- */
-OMXResult omxVCM4P2_MEGetBufSize (
- OMXVCM4P2MEMode MEmode,
- const OMXVCM4P2MEParams *pMEParams,
- OMX_U32 *pSize
-);
-
-
-
-/**
- * Function: omxVCM4P2_MEInit (6.2.4.1.2)
- *
- * Description:
- * Initializes the vendor-specific specification structure required for the
- * following motion estimation functions: BlockMatch_Integer_8x8,
- * BlockMatch_Integer_16x16, and MotionEstimationMB. Memory for the
- * specification structure *pMESpec must be allocated prior to calling the
- * function, and should be aligned on a 4-byte boundary. Following
- * initialization by this function, the vendor-specific structure *pMESpec
- * should contain an implementation-specific representation of all motion
- * estimation parameters received via the structure pMEParams, for example
- * rndVal, searchRange, etc. The number of bytes required for the
- * specification structure can be determined using the function
- * omxVCM4P2_MEGetBufSize.
- *
- * Input Arguments:
- *
- * MEmode - motion estimation mode; available modes are defined by the
- * enumerated type OMXVCM4P2MEMode
- * pMEParams - motion estimation parameters
- * pMESpec - pointer to the uninitialized ME specification structure
- *
- * Output Arguments:
- *
- * pMESpec - pointer to the initialized ME specification structure
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - one or more of the following is true:
- * - an invalid value was specified for the parameter MEmode
- * - a negative or zero value was specified for the
- * parameter pMEParams->searchRange
- *
- */
-OMXResult omxVCM4P2_MEInit (
- OMXVCM4P2MEMode MEmode,
- const OMXVCM4P2MEParams*pMEParams,
- void *pMESpec
-);
-
-
-
-/**
- * Function: omxVCM4P2_BlockMatch_Integer_16x16 (6.2.4.2.1)
- *
- * Description:
- * Performs a 16x16 block search; estimates motion vector and associated
- * minimum SAD. Both the input and output motion vectors are represented using
- * half-pixel units, and therefore a shift left or right by 1 bit may be
- * required, respectively, to match the input or output MVs with other
- * functions that either generate output MVs or expect input MVs represented
- * using integer pixel units.
- *
- * Input Arguments:
- *
- * pSrcRefBuf - pointer to the reference Y plane; points to the reference
- * MB that corresponds to the location of the current macroblock in
- * the current plane.
- * refWidth - width of the reference plane
- * pRefRect - pointer to the valid reference plane rectangle; coordinates
- * are specified relative to the image origin. Rectangle
- * boundaries may extend beyond image boundaries if the image has
- * been padded. For example, if padding extends 4 pixels beyond
- * frame border, then the value for the left border could be set to
- * -4.
- * pSrcCurrBuf - pointer to the current block in the current macroblock
- * buffer extracted from the original plane (linear array, 256
- * entries); must be aligned on a 16-byte boundary. The number of
- * bytes between lines (step) is 16.
- * pCurrPointPos - position of the current macroblock in the current plane
- * pSrcPreMV - pointer to predicted motion vector; NULL indicates no
- * predicted MV
- * pSrcPreSAD - pointer to SAD associated with the predicted MV (referenced
- * by pSrcPreMV); may be set to NULL if unavailable.
- * pMESpec - vendor-specific motion estimation specification structure;
- * must have been allocated and then initialized using
- * omxVCM4P2_MEInit prior to calling the block matching function.
- *
- * Output Arguments:
- *
- * pDstMV - pointer to estimated MV
- * pDstSAD - pointer to minimum SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following
- * conditions is true:
- * - at least one of the following pointers is NULL: pSrcRefBuf,
- * pRefRect, pSrcCurrBuff, pCurrPointPos, pDstMV, pDstSAD or
- * pMESpec, or
- * - pSrcCurrBuf is not 16-byte aligned
- *
- */
-OMXResult omxVCM4P2_BlockMatch_Integer_16x16 (
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- const OMXVCMotionVector*pSrcPreMV,
- const OMX_INT *pSrcPreSAD,
- void *pMESpec,
- OMXVCMotionVector*pDstMV,
- OMX_INT *pDstSAD
-);
-
-
-
-/**
- * Function: omxVCM4P2_BlockMatch_Integer_8x8 (6.2.4.2.2)
- *
- * Description:
- * Performs an 8x8 block search; estimates motion vector and associated
- * minimum SAD. Both the input and output motion vectors are represented
- * using half-pixel units, and therefore a shift left or right by 1 bit may be
- * required, respectively, to match the input or output MVs with other
- * functions that either generate output MVs or expect input MVs represented
- * using integer pixel units.
- *
- * Input Arguments:
- *
- * pSrcRefBuf - pointer to the reference Y plane; points to the reference
- * block that corresponds to the location of the current 8x8 block
- * in the current plane.
- * refWidth - width of the reference plane
- * pRefRect - pointer to the valid reference plane rectangle; coordinates
- * are specified relative to the image origin. Rectangle
- * boundaries may extend beyond image boundaries if the image has
- * been padded.
- * pSrcCurrBuf - pointer to the current block in the current macroblock
- * buffer extracted from the original plane (linear array, 128
- * entries); must be aligned on an 8-byte boundary. The number of
- * bytes between lines (step) is 16 bytes.
- * pCurrPointPos - position of the current block in the current plane
- * pSrcPreMV - pointer to predicted motion vector; NULL indicates no
- * predicted MV
- * pSrcPreSAD - pointer to SAD associated with the predicted MV (referenced
- * by pSrcPreMV); may be set to NULL if unavailable.
- * pMESpec - vendor-specific motion estimation specification structure;
- * must have been allocated and then initialized using
- * omxVCM4P2_MEInit prior to calling the block matching function.
- *
- * Output Arguments:
- *
- * pDstMV - pointer to estimated MV
- * pDstSAD - pointer to minimum SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following
- * conditions is true:
- * - at least one of the following pointers is NULL: pSrcRefBuf,
- * pRefRect, pSrcCurrBuff, pCurrPointPos, pDstMV, pDstSAD or
- * pMESpec, or
- * - pSrcCurrBuf is not 8-byte aligned
- *
- */
-OMXResult omxVCM4P2_BlockMatch_Integer_8x8 (
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- const OMXVCMotionVector *pSrcPreMV,
- const OMX_INT *pSrcPreSAD,
- void *pMESpec,
- OMXVCMotionVector *pDstMV,
- OMX_INT *pDstSAD
-);
-
-
-
-/**
- * Function: omxVCM4P2_BlockMatch_Half_16x16 (6.2.4.2.3)
- *
- * Description:
- * Performs a 16x16 block match with half-pixel resolution. Returns the
- * estimated motion vector and associated minimum SAD. This function
- * estimates the half-pixel motion vector by interpolating the integer
- * resolution motion vector referenced by the input parameter pSrcDstMV, i.e.,
- * the initial integer MV is generated externally. The input parameters
- * pSrcRefBuf and pSearchPointRefPos should be shifted by the winning MV of
- * 16x16 integer search prior to calling BlockMatch_Half_16x16. The function
- * BlockMatch_Integer_16x16 may be used for integer motion estimation.
- *
- * Input Arguments:
- *
- * pSrcRefBuf - pointer to the reference Y plane; points to the reference
- * macroblock that corresponds to the location of the current
- * macroblock in the current plane.
- * refWidth - width of the reference plane
- * pRefRect - reference plane valid region rectangle
- * pSrcCurrBuf - pointer to the current block in the current macroblock
- * buffer extracted from the original plane (linear array, 256
- * entries); must be aligned on a 16-byte boundary. The number of
- * bytes between lines (step) is 16.
- * pSearchPointRefPos - position of the starting point for half pixel
- * search (specified in terms of integer pixel units) in the
- * reference plane, i.e., the reference position pointed to by the
- * predicted motion vector.
- * rndVal - rounding control parameter: 0 - disabled; 1 - enabled.
- * pSrcDstMV - pointer to the initial MV estimate; typically generated
- * during a prior 16X16 integer search; specified in terms of
- * half-pixel units.
- *
- * Output Arguments:
- *
- * pSrcDstMV - pointer to estimated MV
- * pDstSAD - pointer to minimum SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following
- * conditions is true:
- * - at least one of the following pointers is NULL: pSrcRefBuf,
- * pRefRect, pSrcCurrBuff, pSearchPointRefPos, pSrcDstMV.
- * - pSrcCurrBuf is not 16-byte aligned, or
- *
- */
-OMXResult omxVCM4P2_BlockMatch_Half_16x16 (
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pSearchPointRefPos,
- OMX_INT rndVal,
- OMXVCMotionVector *pSrcDstMV,
- OMX_INT *pDstSAD
-);
-
-
-
-/**
- * Function: omxVCM4P2_BlockMatch_Half_8x8 (6.2.4.2.4)
- *
- * Description:
- * Performs an 8x8 block match with half-pixel resolution. Returns the
- * estimated motion vector and associated minimum SAD. This function
- * estimates the half-pixel motion vector by interpolating the integer
- * resolution motion vector referenced by the input parameter pSrcDstMV, i.e.,
- * the initial integer MV is generated externally. The input parameters
- * pSrcRefBuf and pSearchPointRefPos should be shifted by the winning MV of
- * 8x8 integer search prior to calling BlockMatch_Half_8x8. The function
- * BlockMatch_Integer_8x8 may be used for integer motion estimation.
- *
- * Input Arguments:
- *
- * pSrcRefBuf - pointer to the reference Y plane; points to the reference
- * block that corresponds to the location of the current 8x8 block
- * in the current plane.
- * refWidth - width of the reference plane
- * pRefRect - reference plane valid region rectangle
- * pSrcCurrBuf - pointer to the current block in the current macroblock
- * buffer extracted from the original plane (linear array, 128
- * entries); must be aligned on a 8-byte boundary. The number of
- * bytes between lines (step) is 16.
- * pSearchPointRefPos - position of the starting point for half pixel
- * search (specified in terms of integer pixel units) in the
- * reference plane.
- * rndVal - rounding control parameter: 0 - disabled; 1 - enabled.
- * pSrcDstMV - pointer to the initial MV estimate; typically generated
- * during a prior 8x8 integer search, specified in terms of
- * half-pixel units.
- *
- * Output Arguments:
- *
- * pSrcDstMV - pointer to estimated MV
- * pDstSAD - pointer to minimum SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following
- * conditions is true:
- * - at least one of the following pointers is NULL:
- * pSrcRefBuf, pRefRect, pSrcCurrBuff, pSearchPointRefPos, pSrcDstMV
- * - pSrcCurrBuf is not 8-byte aligned
- *
- */
-OMXResult omxVCM4P2_BlockMatch_Half_8x8 (
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pSearchPointRefPos,
- OMX_INT rndVal,
- OMXVCMotionVector *pSrcDstMV,
- OMX_INT *pDstSAD
-);
-
-
-
-/**
- * Function: omxVCM4P2_MotionEstimationMB (6.2.4.3.1)
- *
- * Description:
- * Performs motion search for a 16x16 macroblock. Selects best motion search
- * strategy from among inter-1MV, inter-4MV, and intra modes. Supports
- * integer and half pixel resolution.
- *
- * Input Arguments:
- *
- * pSrcCurrBuf - pointer to the top-left corner of the current MB in the
- * original picture plane; must be aligned on a 16-byte boundary.
- * The function does not expect source data outside the region
- * bounded by the MB to be available; for example it is not
- * necessary for the caller to guarantee the availability of
- * pSrcCurrBuf[-SrcCurrStep], i.e., the row of pixels above the MB
- * to be processed.
- * srcCurrStep - width of the original picture plane, in terms of full
- * pixels; must be a multiple of 16.
- * pSrcRefBuf - pointer to the reference Y plane; points to the reference
- * plane location corresponding to the location of the current
- * macroblock in the current plane; must be aligned on a 16-byte
- * boundary.
- * srcRefStep - width of the reference picture plane, in terms of full
- * pixels; must be a multiple of 16.
- * pRefRect - reference plane valid region rectangle, specified relative to
- * the image origin
- * pCurrPointPos - position of the current macroblock in the current plane
- * pMESpec - pointer to the vendor-specific motion estimation specification
- * structure; must be allocated and then initialized using
- * omxVCM4P2_MEInit prior to calling this function.
- * pMBInfo - array, of dimension four, containing pointers to information
- * associated with four nearby MBs:
- * - pMBInfo[0] - pointer to left MB information
- * - pMBInfo[1] - pointer to top MB information
- * - pMBInfo[2] - pointer to top-left MB information
- * - pMBInfo[3] - pointer to top-right MB information
- * Any pointer in the array may be set equal to NULL if the
- * corresponding MB doesn't exist. For each MB, the following structure
- * members are used:
- * - mbType - macroblock type, either OMX_VC_INTRA, OMX_VC_INTER, or
- * OMX_VC_INTER4V
- * - pMV0[2][2] - estimated motion vectors; represented
- * in 1/2 pixel units
- * - sliceID - number of the slice to which the MB belongs
- * pSrcDstMBCurr - pointer to information structure for the current MB.
- * The following entries should be set prior to calling the
- * function: sliceID - the number of the slice the to which the
- * current MB belongs. The structure elements cbpy and cbpc are
- * ignored.
- *
- * Output Arguments:
- *
- * pSrcDstMBCurr - pointer to updated information structure for the current
- * MB after MB-level motion estimation has been completed. The
- * following structure members are updated by the ME function:
- * - mbType - macroblock type: OMX_VC_INTRA, OMX_VC_INTER, or
- * OMX_VC_INTER4V.
- * - pMV0[2][2] - estimated motion vectors; represented in
- * terms of 1/2 pel units.
- * - pMVPred[2][2] - predicted motion vectors; represented
- * in terms of 1/2 pel units.
- * The structure members cbpy and cbpc are not updated by the function.
- * pDstSAD - pointer to the minimum SAD for INTER1V, or sum of minimum SADs
- * for INTER4V
- * pDstBlockSAD - pointer to an array of SAD values for each of the four
- * 8x8 luma blocks in the MB. The block SADs are in scan order for
- * each MB.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one or more of the
- * following conditions is true:
- * - at least one of the following pointers is NULL: pSrcCurrBuf,
- * pSrcRefBuf, pRefRect, pCurrPointPos, pMBInter, pMBIntra,
- * pSrcDstMBCurr, or pDstSAD.
- *
- */
-OMXResult omxVCM4P2_MotionEstimationMB (
- const OMX_U8 *pSrcCurrBuf,
- OMX_S32 srcCurrStep,
- const OMX_U8 *pSrcRefBuf,
- OMX_S32 srcRefStep,
- const OMXRect*pRefRect,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- void *pMESpec,
- const OMXVCM4P2MBInfoPtr *pMBInfo,
- OMXVCM4P2MBInfo *pSrcDstMBCurr,
- OMX_U16 *pDstSAD,
- OMX_U16 *pDstBlockSAD
-);
-
-
-
-/**
- * Function: omxVCM4P2_DCT8x8blk (6.2.4.4.1)
- *
- * Description:
- * Computes a 2D forward DCT for a single 8x8 block, as defined in
- * [ISO14496-2].
- *
- * Input Arguments:
- *
- * pSrc - pointer to the start of the linearly arranged input buffer; must
- * be aligned on a 16-byte boundary. Input values (pixel
- * intensities) are valid in the range [-255,255].
- *
- * Output Arguments:
- *
- * pDst - pointer to the start of the linearly arranged output buffer; must
- * be aligned on a 16-byte boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments, returned if:
- * - pSrc or pDst is NULL.
- * - pSrc or pDst is not 16-byte aligned.
- *
- */
-OMXResult omxVCM4P2_DCT8x8blk (
- const OMX_S16 *pSrc,
- OMX_S16 *pDst
-);
-
-
-
-/**
- * Function: omxVCM4P2_QuantIntra_I (6.2.4.4.2)
- *
- * Description:
- * Performs quantization on intra block coefficients. This function supports
- * bits_per_pixel == 8.
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input intra block coefficients; must be aligned
- * on a 16-byte boundary.
- * QP - quantization parameter (quantizer_scale).
- * blockIndex - block index indicating the component type and position,
- * valid in the range 0 to 5, as defined in [ISO14496-2], subclause
- * 6.1.3.8.
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; shortVideoHeader==1 selects linear intra DC
- * mode, and shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to the output (quantized) interblock coefficients.
- * When shortVideoHeader==1, AC coefficients are saturated on the
- * interval [-127, 127], and DC coefficients are saturated on the
- * interval [1, 254]. When shortVideoHeader==0, AC coefficients
- * are saturated on the interval [-2047, 2047].
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - pSrcDst is NULL.
- * - blockIndex < 0 or blockIndex >= 10
- * - QP <= 0 or QP >= 32.
- *
- */
-OMXResult omxVCM4P2_QuantIntra_I (
- OMX_S16 *pSrcDst,
- OMX_U8 QP,
- OMX_INT blockIndex,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_QuantInter_I (6.2.4.4.3)
- *
- * Description:
- * Performs quantization on an inter coefficient block; supports
- * bits_per_pixel == 8.
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input inter block coefficients; must be aligned
- * on a 16-byte boundary.
- * QP - quantization parameter (quantizer_scale)
- * shortVideoHeader - binary flag indicating presence of short_video_header;
- * shortVideoHeader==1 selects linear intra DC mode, and
- * shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to the output (quantized) interblock coefficients.
- * When shortVideoHeader==1, AC coefficients are saturated on the
- * interval [-127, 127], and DC coefficients are saturated on the
- * interval [1, 254]. When shortVideoHeader==0, AC coefficients
- * are saturated on the interval [-2047, 2047].
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - pSrcDst is NULL.
- * - QP <= 0 or QP >= 32.
- *
- */
-OMXResult omxVCM4P2_QuantInter_I (
- OMX_S16 *pSrcDst,
- OMX_U8 QP,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_TransRecBlockCoef_intra (6.2.4.4.4)
- *
- * Description:
- * Quantizes the DCT coefficients, implements intra block AC/DC coefficient
- * prediction, and reconstructs the current intra block texture for prediction
- * on the next frame. Quantized row and column coefficients are returned in
- * the updated coefficient buffers.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the pixels of current intra block; must be aligned on
- * an 8-byte boundary.
- * pPredBufRow - pointer to the coefficient row buffer containing
- * ((num_mb_per_row * 2 + 1) * 8) elements of type OMX_S16.
- * Coefficients are organized into blocks of eight as described
- * below (Internal Prediction Coefficient Update Procedures). The
- * DC coefficient is first, and the remaining buffer locations
- * contain the quantized AC coefficients. Each group of eight row
- * buffer elements combined with one element eight elements ahead
- * contains the coefficient predictors of the neighboring block
- * that is spatially above or to the left of the block currently to
- * be decoded. A negative-valued DC coefficient indicates that this
- * neighboring block is not INTRA-coded or out of bounds, and
- * therefore the AC and DC coefficients are invalid. Pointer must
- * be aligned on an 8-byte boundary.
- * pPredBufCol - pointer to the prediction coefficient column buffer
- * containing 16 elements of type OMX_S16. Coefficients are
- * organized as described in section 6.2.2.5. Pointer must be
- * aligned on an 8-byte boundary.
- * pSumErr - pointer to a flag indicating whether or not AC prediction is
- * required; AC prediction is enabled if *pSumErr >=0, but the
- * value is not used for coefficient prediction, i.e., the sum of
- * absolute differences starts from 0 for each call to this
- * function. Otherwise AC prediction is disabled if *pSumErr < 0 .
- * blockIndex - block index indicating the component type and position, as
- * defined in [ISO14496-2], subclause 6.1.3.8.
- * curQp - quantization parameter of the macroblock to which the current
- * block belongs
- * pQpBuf - pointer to a 2-element quantization parameter buffer; pQpBuf[0]
- * contains the quantization parameter associated with the 8x8
- * block left of the current block (QPa), and pQpBuf[1] contains
- * the quantization parameter associated with the 8x8 block above
- * the current block (QPc). In the event that the corresponding
- * block is outside of the VOP bound, the Qp value will not affect
- * the intra prediction process, as described in [ISO14496-2],
- * sub-clause 7.4.3.3, Adaptive AC Coefficient Prediction.
- * srcStep - width of the source buffer; must be a multiple of 8.
- * dstStep - width of the reconstructed destination buffer; must be a
- * multiple of 16.
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; shortVideoHeader==1 selects linear intra DC
- * mode, and shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * pDst - pointer to the quantized DCT coefficient buffer; pDst[0] contains
- * the predicted DC coefficient; the remaining entries contain the
- * quantized AC coefficients (without prediction). The pointer
- * pDstmust be aligned on a 16-byte boundary.
- * pRec - pointer to the reconstructed texture; must be aligned on an
- * 8-byte boundary.
- * pPredBufRow - pointer to the updated coefficient row buffer
- * pPredBufCol - pointer to the updated coefficient column buffer
- * pPreACPredict - if prediction is enabled, the parameter points to the
- * start of the buffer containing the coefficient differences for
- * VLC encoding. The entry pPreACPredict[0]indicates prediction
- * direction for the current block and takes one of the following
- * values: OMX_VC_NONE (prediction disabled), OMX_VC_HORIZONTAL, or
- * OMX_VC_VERTICAL. The entries
- * pPreACPredict[1]-pPreACPredict[7]contain predicted AC
- * coefficients. If prediction is disabled (*pSumErr<0) then the
- * contents of this buffer are undefined upon return from the
- * function
- * pSumErr - pointer to the value of the accumulated AC coefficient errors,
- * i.e., sum of the absolute differences between predicted and
- * unpredicted AC coefficients
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - Bad arguments:
- * - At least one of the following pointers is NULL: pSrc, pDst, pRec,
- * pCoefBufRow, pCoefBufCol, pQpBuf, pPreACPredict, pSumErr.
- * - blockIndex < 0 or blockIndex >= 10;
- * - curQP <= 0 or curQP >= 32.
- * - srcStep, or dstStep <= 0 or not a multiple of 8.
- * - pDst is not 16-byte aligned: .
- * - At least one of the following pointers is not 8-byte aligned:
- * pSrc, pRec.
- *
- * Note: The coefficient buffers must be updated in accordance with the
- * update procedures defined in section in 6.2.2.
- *
- */
-OMXResult omxVCM4P2_TransRecBlockCoef_intra (
- const OMX_U8 *pSrc,
- OMX_S16 *pDst,
- OMX_U8 *pRec,
- OMX_S16 *pPredBufRow,
- OMX_S16 *pPredBufCol,
- OMX_S16 *pPreACPredict,
- OMX_INT *pSumErr,
- OMX_INT blockIndex,
- OMX_U8 curQp,
- const OMX_U8 *pQpBuf,
- OMX_INT srcStep,
- OMX_INT dstStep,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_TransRecBlockCoef_inter (6.2.4.4.5)
- *
- * Description:
- * Implements DCT, and quantizes the DCT coefficients of the inter block
- * while reconstructing the texture residual. There is no boundary check for
- * the bit stream buffer.
- *
- * Input Arguments:
- *
- * pSrc -pointer to the residuals to be encoded; must be aligned on an
- * 16-byte boundary.
- * QP - quantization parameter.
- * shortVideoHeader - binary flag indicating presence of short_video_header;
- * shortVideoHeader==1 selects linear intra DC mode, and
- * shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * pDst - pointer to the quantized DCT coefficients buffer; must be aligned
- * on a 16-byte boundary.
- * pRec - pointer to the reconstructed texture residuals; must be aligned
- * on a 16-byte boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - At least one of the following pointers is either NULL or
- * not 16-byte aligned:
- * - pSrc
- * - pDst
- * - pRec
- * - QP <= 0 or QP >= 32.
- *
- */
-OMXResult omxVCM4P2_TransRecBlockCoef_inter (
- const OMX_S16 *pSrc,
- OMX_S16 *pDst,
- OMX_S16 *pRec,
- OMX_U8 QP,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_EncodeVLCZigzag_IntraDCVLC (6.2.4.5.2)
- *
- * Description:
- * Performs zigzag scan and VLC encoding of AC and DC coefficients for one
- * intra block. Two versions of the function (DCVLC and ACVLC) are provided
- * in order to support the two different methods of processing DC
- * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, "Intra DC
- * Coefficient Decoding for the Case of Switched VLC Encoding".
- *
- * Input Arguments:
- *
- * ppBitStream - double pointer to the current byte in the bitstream
- * pBitOffset - pointer to the bit position in the byte pointed by
- * *ppBitStream. Valid within 0 to 7.
- * pQDctBlkCoef - pointer to the quantized DCT coefficient
- * predDir - AC prediction direction, which is used to decide the zigzag
- * scan pattern; takes one of the following values:
- * - OMX_VC_NONE - AC prediction not used.
- * Performs classical zigzag scan.
- * - OMX_VC_HORIZONTAL - Horizontal prediction.
- * Performs alternate-vertical zigzag scan.
- * - OMX_VC_VERTICAL - Vertical prediction.
- * Performs alternate-horizontal zigzag scan.
- * pattern - block pattern which is used to decide whether this block is
- * encoded
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- * videoComp - video component type (luminance, chrominance) of the current
- * block
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is encoded, so
- * that it points to the current byte in the bit stream buffer.
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - Bad arguments:
- * - At least one of the following pointers is NULL: ppBitStream,
- * *ppBitStream, pBitOffset, pQDctBlkCoef.
- * - *pBitOffset < 0, or *pBitOffset >7.
- * - PredDir is not one of: OMX_VC_NONE, OMX_VC_HORIZONTAL, or
- * OMX_VC_VERTICAL.
- * - VideoComp is not one component of enum OMXVCM4P2VideoComponent.
- *
- */
-OMXResult omxVCM4P2_EncodeVLCZigzag_IntraDCVLC (
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- const OMX_S16 *pQDctBlkCoef,
- OMX_U8 predDir,
- OMX_U8 pattern,
- OMX_INT shortVideoHeader,
- OMXVCM4P2VideoComponent videoComp
-);
-
-
-
-/**
- * Function: omxVCM4P2_EncodeVLCZigzag_IntraACVLC (6.2.4.5.2)
- *
- * Description:
- * Performs zigzag scan and VLC encoding of AC and DC coefficients for one
- * intra block. Two versions of the function (DCVLC and ACVLC) are provided
- * in order to support the two different methods of processing DC
- * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, Intra DC
- * Coefficient Decoding for the Case of Switched VLC Encoding.
- *
- * Input Arguments:
- *
- * ppBitStream - double pointer to the current byte in the bitstream
- * pBitOffset - pointer to the bit position in the byte pointed by
- * *ppBitStream. Valid within 0 to 7.
- * pQDctBlkCoef - pointer to the quantized DCT coefficient
- * predDir - AC prediction direction, which is used to decide the zigzag
- * scan pattern; takes one of the following values:
- * - OMX_VC_NONE - AC prediction not used.
- * Performs classical zigzag scan.
- * - OMX_VC_HORIZONTAL - Horizontal prediction.
- * Performs alternate-vertical zigzag scan.
- * - OMX_VC_VERTICAL - Vertical prediction.
- * Performs alternate-horizontal zigzag scan.
- * pattern - block pattern which is used to decide whether this block is
- * encoded
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is encoded, so
- * that it points to the current byte in the bit stream buffer.
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - Bad arguments:
- * - At least one of the following pointers is NULL: ppBitStream,
- * *ppBitStream, pBitOffset, pQDctBlkCoef.
- * - *pBitOffset < 0, or *pBitOffset >7.
- * - PredDir is not one of: OMX_VC_NONE, OMX_VC_HORIZONTAL, or
- * OMX_VC_VERTICAL.
- * - VideoComp is not one component of enum OMXVCM4P2VideoComponent.
- *
- */
-OMXResult omxVCM4P2_EncodeVLCZigzag_IntraACVLC (
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- const OMX_S16 *pQDctBlkCoef,
- OMX_U8 predDir,
- OMX_U8 pattern,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_EncodeVLCZigzag_Inter (6.2.4.5.3)
- *
- * Description:
- * Performs classical zigzag scanning and VLC encoding for one inter block.
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the bit
- * stream
- * pBitOffset - pointer to the bit position in the byte pointed by
- * *ppBitStream. Valid within 0 to 7
- * pQDctBlkCoef - pointer to the quantized DCT coefficient
- * pattern - block pattern which is used to decide whether this block is
- * encoded
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is encoded so that
- * it points to the current byte in the bit stream buffer.
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - Bad arguments
- * - At least one of the pointers: is NULL: ppBitStream, *ppBitStream,
- * pBitOffset, pQDctBlkCoef
- * - *pBitOffset < 0, or *pBitOffset >7.
- *
- */
-OMXResult omxVCM4P2_EncodeVLCZigzag_Inter (
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- const OMX_S16 *pQDctBlkCoef,
- OMX_U8 pattern,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_EncodeMV (6.2.4.5.4)
- *
- * Description:
- * Predicts a motion vector for the current macroblock, encodes the
- * difference, and writes the output to the stream buffer. The input MVs
- * pMVCurMB, pSrcMVLeftMB, pSrcMVUpperMB, and pSrcMVUpperRightMB should lie
- * within the ranges associated with the input parameter fcodeForward, as
- * described in [ISO14496-2], subclause 7.6.3. This function provides a
- * superset of the functionality associated with the function
- * omxVCM4P2_FindMVpred.
- *
- * Input Arguments:
- *
- * ppBitStream - double pointer to the current byte in the bitstream buffer
- * pBitOffset - index of the first free (next available) bit in the stream
- * buffer referenced by *ppBitStream, valid in the range 0 to 7.
- * pMVCurMB - pointer to the current macroblock motion vector; a value of
- * NULL indicates unavailability.
- * pSrcMVLeftMB - pointer to the source left macroblock motion vector; a
- * value of NULLindicates unavailability.
- * pSrcMVUpperMB - pointer to source upper macroblock motion vector; a
- * value of NULL indicates unavailability.
- * pSrcMVUpperRightMB - pointer to source upper right MB motion vector; a
- * value of NULL indicates unavailability.
- * fcodeForward - an integer with values from 1 to 7; used in encoding
- * motion vectors related to search range, as described in
- * [ISO14496-2], subclause 7.6.3.
- * MBType - macro block type, valid in the range 0 to 5
- *
- * Output Arguments:
- *
- * ppBitStream - updated pointer to the current byte in the bit stream
- * buffer
- * pBitOffset - updated index of the next available bit position in stream
- * buffer referenced by *ppBitStream
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - At least one of the following pointers is NULL: ppBitStream,
- * *ppBitStream, pBitOffset, pMVCurMB
- * - *pBitOffset < 0, or *pBitOffset >7.
- * - fcodeForward <= 0, or fcodeForward > 7, or MBType < 0.
- *
- */
-OMXResult omxVCM4P2_EncodeMV (
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- const OMXVCMotionVector *pMVCurMB,
- const OMXVCMotionVector*pSrcMVLeftMB,
- const OMXVCMotionVector *pSrcMVUpperMB,
- const OMXVCMotionVector *pSrcMVUpperRightMB,
- OMX_INT fcodeForward,
- OMXVCM4P2MacroblockType MBType
-);
-
-
-
-/**
- * Function: omxVCM4P2_DecodePadMV_PVOP (6.2.5.1.1)
- *
- * Description:
- * Decodes and pads the four motion vectors associated with a non-intra P-VOP
- * macroblock. For macroblocks of type OMX_VC_INTER4V, the output MV is
- * padded as specified in [ISO14496-2], subclause 7.6.1.6. Otherwise, for
- * macroblocks of types other than OMX_VC_INTER4V, the decoded MV is copied to
- * all four output MV buffer entries.
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the bit
- * stream buffer
- * pBitOffset - pointer to the bit position in the byte pointed to by
- * *ppBitStream. *pBitOffset is valid within [0-7].
- * pSrcMVLeftMB, pSrcMVUpperMB, and pSrcMVUpperRightMB - pointers to the
- * motion vector buffers of the macroblocks specially at the left,
- * upper, and upper-right side of the current macroblock,
- * respectively; a value of NULL indicates unavailability. Note:
- * Any neighborhood macroblock outside the current VOP or video
- * packet or outside the current GOB (when short_video_header is
- * 1 ) for which gob_header_empty is 0 is treated as
- * transparent, according to [ISO14496-2], subclause 7.6.5.
- * fcodeForward - a code equal to vop_fcode_forward in MPEG-4 bit stream
- * syntax
- * MBType - the type of the current macroblock. If MBType is not equal to
- * OMX_VC_INTER4V, the destination motion vector buffer is still
- * filled with the same decoded vector.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded, so
- * that it points to the current byte in the bit stream buffer
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream
- * pDstMVCurMB - pointer to the motion vector buffer for the current
- * macroblock; contains four decoded motion vectors
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - At least one of the following pointers is NULL:
- * ppBitStream, *ppBitStream, pBitOffset, pDstMVCurMB
- * - *pBitOffset exceeds [0,7]
- * - fcodeForward exceeds (0,7]
- * - MBType less than zero
- * - motion vector buffer is not 4-byte aligned.
- * OMX_Sts_Err - status error
- *
- */
-OMXResult omxVCM4P2_DecodePadMV_PVOP (
- const OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- OMXVCMotionVector *pSrcMVLeftMB,
- OMXVCMotionVector*pSrcMVUpperMB,
- OMXVCMotionVector *pSrcMVUpperRightMB,
- OMXVCMotionVector*pDstMVCurMB,
- OMX_INT fcodeForward,
- OMXVCM4P2MacroblockType MBType
-);
-
-
-
-/**
- * Function: omxVCM4P2_DecodeVLCZigzag_IntraDCVLC (6.2.5.2.2)
- *
- * Description:
- * Performs VLC decoding and inverse zigzag scan of AC and DC coefficients
- * for one intra block. Two versions of the function (DCVLC and ACVLC) are
- * provided in order to support the two different methods of processing DC
- * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, Intra DC
- * Coefficient Decoding for the Case of Switched VLC Encoding.
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the
- * bitstream buffer
- * pBitOffset - pointer to the bit position in the current byte referenced
- * by *ppBitStream. The parameter *pBitOffset is valid in the
- * range [0-7].
- * Bit Position in one byte: |Most Least|
- * *pBitOffset |0 1 2 3 4 5 6 7|
- * predDir - AC prediction direction; used to select the zigzag scan
- * pattern; takes one of the following values:
- * - OMX_VC_NONE - AC prediction not used;
- * performs classical zigzag scan.
- * - OMX_VC_HORIZONTAL - Horizontal prediction;
- * performs alternate-vertical zigzag scan;
- * - OMX_VC_VERTICAL - Vertical prediction;
- * performs alternate-horizontal zigzag scan.
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- * videoComp - video component type (luminance or chrominance) of the
- * current block
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded such
- * that it points to the current byte in the bit stream buffer
- * pBitOffset - *pBitOffset is updated such that it points to the current
- * bit position in the byte pointed by *ppBitStream
- * pDst - pointer to the coefficient buffer of current block; must be
- * 4-byte aligned.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments, if:
- * - At least one of the following pointers is NULL:
- * ppBitStream, *ppBitStream, pBitOffset, pDst
- * - *pBitOffset exceeds [0,7]
- * - preDir exceeds [0,2]
- * - pDst is not 4-byte aligned
- * OMX_Sts_Err - if:
- * - In DecodeVLCZigzag_IntraDCVLC, dc_size > 12
- * - At least one of mark bits equals zero
- * - Illegal stream encountered; code cannot be located in VLC table
- * - Forbidden code encountered in the VLC FLC table.
- * - The number of coefficients is greater than 64
- *
- */
-OMXResult omxVCM4P2_DecodeVLCZigzag_IntraDCVLC (
- const OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- OMX_S16 *pDst,
- OMX_U8 predDir,
- OMX_INT shortVideoHeader,
- OMXVCM4P2VideoComponent videoComp
-);
-
-
-
-/**
- * Function: omxVCM4P2_DecodeVLCZigzag_IntraACVLC (6.2.5.2.2)
- *
- * Description:
- * Performs VLC decoding and inverse zigzag scan of AC and DC coefficients
- * for one intra block. Two versions of the function (DCVLC and ACVLC) are
- * provided in order to support the two different methods of processing DC
- * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, Intra DC
- * Coefficient Decoding for the Case of Switched VLC Encoding.
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the
- * bitstream buffer
- * pBitOffset - pointer to the bit position in the current byte referenced
- * by *ppBitStream. The parameter *pBitOffset is valid in the
- * range [0-7]. Bit Position in one byte: |Most Least| *pBitOffset
- * |0 1 2 3 4 5 6 7|
- * predDir - AC prediction direction; used to select the zigzag scan
- * pattern; takes one of the following values: OMX_VC_NONE - AC
- * prediction not used; performs classical zigzag scan.
- * OMX_VC_HORIZONTAL - Horizontal prediction; performs
- * alternate-vertical zigzag scan; OMX_VC_VERTICAL - Vertical
- * prediction; performs alternate-horizontal zigzag scan.
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- * videoComp - video component type (luminance or chrominance) of the
- * current block
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded such
- * that it points to the current byte in the bit stream buffer
- * pBitOffset - *pBitOffset is updated such that it points to the current
- * bit position in the byte pointed by *ppBitStream
- * pDst - pointer to the coefficient buffer of current block; must be
- * 4-byte aligned.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments At least one of the following
- * pointers is NULL: ppBitStream, *ppBitStream, pBitOffset, pDst,
- * or At least one of the following conditions is true:
- * *pBitOffset exceeds [0,7], preDir exceeds [0,2], or pDst is
- * not 4-byte aligned
- * OMX_Sts_Err In DecodeVLCZigzag_IntraDCVLC, dc_size > 12 At least one of
- * mark bits equals zero Illegal stream encountered; code cannot
- * be located in VLC table Forbidden code encountered in the VLC
- * FLC table The number of coefficients is greater than 64
- *
- */
-OMXResult omxVCM4P2_DecodeVLCZigzag_IntraACVLC (
- const OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- OMX_S16 *pDst,
- OMX_U8 predDir,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_DecodeVLCZigzag_Inter (6.2.5.2.3)
- *
- * Description:
- * Performs VLC decoding and inverse zigzag scan for one inter-coded block.
- *
- * Input Arguments:
- *
- * ppBitStream - double pointer to the current byte in the stream buffer
- * pBitOffset - pointer to the next available bit in the current stream
- * byte referenced by *ppBitStream. The parameter *pBitOffset is
- * valid within the range [0-7].
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded such
- * that it points to the current byte in the stream buffer
- * pBitOffset - *pBitOffset is updated after decoding such that it points
- * to the next available bit in the stream byte referenced by
- * *ppBitStream
- * pDst - pointer to the coefficient buffer of current block; must be
- * 4-byte aligned.
- *
- * Return Value:
- *
- * OMX_Sts_BadArgErr - bad arguments:
- * - At least one of the following pointers is NULL:
- * ppBitStream, *ppBitStream, pBitOffset, pDst
- * - pDst is not 4-byte aligned
- * - *pBitOffset exceeds [0,7]
- * OMX_Sts_Err - status error, if:
- * - At least one mark bit is equal to zero
- * - Encountered an illegal stream code that cannot be found in the VLC table
- * - Encountered an illegal code in the VLC FLC table
- * - The number of coefficients is greater than 64
- *
- */
-OMXResult omxVCM4P2_DecodeVLCZigzag_Inter (
- const OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- OMX_S16 *pDst,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_QuantInvIntra_I (6.2.5.3.2)
- *
- * Description:
- * Performs the second inverse quantization mode on an intra/inter coded
- * block. Supports bits_per_pixel = 8. The output coefficients are clipped to
- * the range [-2048, 2047].
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input (quantized) intra/inter block; must be
- * aligned on a 16-byte boundary.
- * QP - quantization parameter (quantizer_scale)
- * videoComp - video component type of the current block. Takes one of the
- * following flags: OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE (intra
- * version only).
- * shortVideoHeader - binary flag indicating presence of short_video_header
- * (intra version only).
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to the output (dequantized) intra/inter block
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; one or more of the following is
- * true:
- * - pSrcDst is NULL
- * - QP <= 0 or QP >=31
- * - videoComp is neither OMX_VC_LUMINANCE nor OMX_VC_CHROMINANCE.
- *
- */
-OMXResult omxVCM4P2_QuantInvIntra_I (
- OMX_S16 *pSrcDst,
- OMX_INT QP,
- OMXVCM4P2VideoComponent videoComp,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_QuantInvInter_I (6.2.5.3.2)
- *
- * Description:
- * Performs the second inverse quantization mode on an intra/inter coded
- * block. Supports bits_per_pixel = 8. The output coefficients are clipped to
- * the range [-2048, 2047].
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input (quantized) intra/inter block; must be
- * aligned on a 16-byte boundary.
- * QP - quantization parameter (quantizer_scale)
- * videoComp - video component type of the current block. Takes one of the
- * following flags: OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE (intra
- * version only).
- * shortVideoHeader - binary flag indicating presence of short_video_header
- * (intra version only).
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to the output (dequantized) intra/inter block
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; one or more of the following is
- * true:
- * - pSrcDst is NULL
- * - QP <= 0 or QP >=31
- * - videoComp is neither OMX_VC_LUMINANCE nor OMX_VC_CHROMINANCE.
- *
- */
-OMXResult omxVCM4P2_QuantInvInter_I (
- OMX_S16 *pSrcDst,
- OMX_INT QP
-);
-
-
-
-/**
- * Function: omxVCM4P2_DecodeBlockCoef_Intra (6.2.5.4.1)
- *
- * Description:
- * Decodes the INTRA block coefficients. Inverse quantization, inversely
- * zigzag positioning, and IDCT, with appropriate clipping on each step, are
- * performed on the coefficients. The results are then placed in the output
- * frame/plane on a pixel basis. Note: This function will be used only when
- * at least one non-zero AC coefficient of current block exists in the bit
- * stream. The DC only condition will be handled in another function.
- *
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the bit
- * stream buffer. There is no boundary check for the bit stream
- * buffer.
- * pBitOffset - pointer to the bit position in the byte pointed to by
- * *ppBitStream. *pBitOffset is valid within [0-7].
- * step - width of the destination plane
- * pCoefBufRow - pointer to the coefficient row buffer; must be aligned on
- * an 8-byte boundary.
- * pCoefBufCol - pointer to the coefficient column buffer; must be aligned
- * on an 8-byte boundary.
- * curQP - quantization parameter of the macroblock which the current block
- * belongs to
- * pQPBuf - pointer to the quantization parameter buffer
- * blockIndex - block index indicating the component type and position as
- * defined in [ISO14496-2], subclause 6.1.3.8, Figure 6-5.
- * intraDCVLC - a code determined by intra_dc_vlc_thr and QP. This allows a
- * mechanism to switch between two VLC for coding of Intra DC
- * coefficients as per [ISO14496-2], Table 6-21.
- * ACPredFlag - a flag equal to ac_pred_flag (of luminance) indicating if
- * the ac coefficients of the first row or first column are
- * differentially coded for intra coded macroblock.
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; shortVideoHeader==1 selects linear intra DC
- * mode, and shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded, so
- * that it points to the current byte in the bit stream buffer
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream
- * pDst - pointer to the block in the destination plane; must be aligned on
- * an 8-byte boundary.
- * pCoefBufRow - pointer to the updated coefficient row buffer.
- * pCoefBufCol - pointer to the updated coefficient column buffer Note:
- * The coefficient buffers must be updated in accordance with the
- * update procedure defined in section 6.2.2.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments, if:
- * - At least one of the following pointers is NULL:
- * ppBitStream, *ppBitStream, pBitOffset, pCoefBufRow, pCoefBufCol,
- * pQPBuf, pDst.
- * - *pBitOffset exceeds [0,7]
- * - curQP exceeds (1, 31)
- * - blockIndex exceeds [0,5]
- * - step is not the multiple of 8
- * - a pointer alignment requirement was violated.
- * OMX_Sts_Err - status error. Refer to OMX_Sts_Err of DecodeVLCZigzag_Intra.
- *
- */
-OMXResult omxVCM4P2_DecodeBlockCoef_Intra (
- const OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- OMX_U8 *pDst,
- OMX_INT step,
- OMX_S16 *pCoefBufRow,
- OMX_S16 *pCoefBufCol,
- OMX_U8 curQP,
- const OMX_U8 *pQPBuf,
- OMX_INT blockIndex,
- OMX_INT intraDCVLC,
- OMX_INT ACPredFlag,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_DecodeBlockCoef_Inter (6.2.5.4.2)
- *
- * Description:
- * Decodes the INTER block coefficients. This function performs inverse
- * quantization, inverse zigzag positioning, and IDCT (with appropriate
- * clipping on each step) on the coefficients. The results (residuals) are
- * placed in a contiguous array of 64 elements. For INTER block, the output
- * buffer holds the residuals for further reconstruction.
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the bit
- * stream buffer. There is no boundary check for the bit stream
- * buffer.
- * pBitOffset - pointer to the bit position in the byte pointed to by
- * *ppBitStream. *pBitOffset is valid within [0-7]
- * QP - quantization parameter
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; shortVideoHeader==1 selects linear intra DC
- * mode, and shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded, so
- * that it points to the current byte in the bit stream buffer
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream
- * pDst - pointer to the decoded residual buffer (a contiguous array of 64
- * elements of OMX_S16 data type); must be aligned on a 16-byte
- * boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments, if:
- * - At least one of the following pointers is Null:
- * ppBitStream, *ppBitStream, pBitOffset , pDst
- * - *pBitOffset exceeds [0,7]
- * - QP <= 0.
- * - pDst is not 16-byte aligned
- * OMX_Sts_Err - status error. Refer to OMX_Sts_Err of DecodeVLCZigzag_Inter .
- *
- */
-OMXResult omxVCM4P2_DecodeBlockCoef_Inter (
- const OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- OMX_S16 *pDst,
- OMX_INT QP,
- OMX_INT shortVideoHeader
-);
-
-
-
-/**
- * Function: omxVCM4P2_PredictReconCoefIntra (6.2.5.4.3)
- *
- * Description:
- * Performs adaptive DC/AC coefficient prediction for an intra block. Prior
- * to the function call, prediction direction (predDir) should be selected as
- * specified in [ISO14496-2], subclause 7.4.3.1.
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the coefficient buffer which contains the quantized
- * coefficient residuals (PQF) of the current block; must be
- * aligned on a 4-byte boundary. The output coefficients are
- * saturated to the range [-2048, 2047].
- * pPredBufRow - pointer to the coefficient row buffer; must be aligned on
- * a 4-byte boundary.
- * pPredBufCol - pointer to the coefficient column buffer; must be aligned
- * on a 4-byte boundary.
- * curQP - quantization parameter of the current block. curQP may equal to
- * predQP especially when the current block and the predictor block
- * are in the same macroblock.
- * predQP - quantization parameter of the predictor block
- * predDir - indicates the prediction direction which takes one of the
- * following values: OMX_VC_HORIZONTAL - predict horizontally
- * OMX_VC_VERTICAL - predict vertically
- * ACPredFlag - a flag indicating if AC prediction should be performed. It
- * is equal to ac_pred_flag in the bit stream syntax of MPEG-4
- * videoComp - video component type (luminance or chrominance) of the
- * current block
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to the coefficient buffer which contains the quantized
- * coefficients (QF) of the current block
- * pPredBufRow - pointer to the updated coefficient row buffer
- * pPredBufCol - pointer to the updated coefficient column buffer Note:
- * Buffer update: Update the AC prediction buffer (both row and
- * column buffer).
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments, if:
- * - At least one of the pointers is NULL:
- * pSrcDst, pPredBufRow, or pPredBufCol.
- * - curQP <= 0,
- * - predQP <= 0,
- * - curQP >31,
- * - predQP > 31,
- * - preDir exceeds [1,2]
- * - pSrcDst, pPredBufRow, or pPredBufCol is not 4-byte aligned.
- *
- */
-OMXResult omxVCM4P2_PredictReconCoefIntra (
- OMX_S16 *pSrcDst,
- OMX_S16 *pPredBufRow,
- OMX_S16 *pPredBufCol,
- OMX_INT curQP,
- OMX_INT predQP,
- OMX_INT predDir,
- OMX_INT ACPredFlag,
- OMXVCM4P2VideoComponent videoComp
-);
-
-
-
-/**
- * Function: omxVCM4P2_MCReconBlock (6.2.5.5.1)
- *
- * Description:
- * Performs motion compensation prediction for an 8x8 block using
- * interpolation described in [ISO14496-2], subclause 7.6.2.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the block in the reference plane.
- * srcStep - distance between the start of consecutive lines in the
- * reference plane, in bytes; must be a multiple of 8.
- * dstStep - distance between the start of consecutive lines in the
- * destination plane, in bytes; must be a multiple of 8.
- * pSrcResidue - pointer to a buffer containing the 16-bit prediction
- * residuals; must be 16-byte aligned. If the pointer is NULL, then
- * no prediction is done, only motion compensation, i.e., the block
- * is moved with interpolation.
- * predictType - bilinear interpolation type, as defined in section
- * 6.2.1.2.
- * rndVal - rounding control parameter: 0 - disabled; 1 - enabled.
- *
- * Output Arguments:
- *
- * pDst - pointer to the destination buffer; must be 8-byte aligned. If
- * prediction residuals are added then output intensities are
- * clipped to the range [0,255].
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - pDst is not 8-byte aligned.
- * - pSrcResidue is not 16-byte aligned.
- * - one or more of the following pointers is NULL: pSrc or pDst.
- * - either srcStep or dstStep is not a multiple of 8.
- * - invalid type specified for the parameter predictType.
- * - the parameter rndVal is not equal either to 0 or 1.
- *
- */
-OMXResult omxVCM4P2_MCReconBlock (
- const OMX_U8 *pSrc,
- OMX_INT srcStep,
- const OMX_S16 *pSrcResidue,
- OMX_U8 *pDst,
- OMX_INT dstStep,
- OMX_INT predictType,
- OMX_INT rndVal
-);
-
-
-
-/* 6.3.1.1 Intra 16x16 Prediction Modes */
-/* A data type that enumerates intra_16x16 macroblock prediction modes is defined as follows: */
-
-typedef enum {
- OMX_VC_16X16_VERT = 0, /** Intra_16x16_Vertical */
- OMX_VC_16X16_HOR = 1, /** Intra_16x16_Horizontal */
- OMX_VC_16X16_DC = 2, /** Intra_16x16_DC */
- OMX_VC_16X16_PLANE = 3 /** Intra_16x16_Plane */
-} OMXVCM4P10Intra16x16PredMode;
-
-
-
-/* 6.3.1.2 Intra 4x4 Prediction Modes */
-/* A data type that enumerates intra_4x4 macroblock prediction modes is defined as follows: */
-
-typedef enum {
- OMX_VC_4X4_VERT = 0, /** Intra_4x4_Vertical */
- OMX_VC_4X4_HOR = 1, /** Intra_4x4_Horizontal */
- OMX_VC_4X4_DC = 2, /** Intra_4x4_DC */
- OMX_VC_4X4_DIAG_DL = 3, /** Intra_4x4_Diagonal_Down_Left */
- OMX_VC_4X4_DIAG_DR = 4, /** Intra_4x4_Diagonal_Down_Right */
- OMX_VC_4X4_VR = 5, /** Intra_4x4_Vertical_Right */
- OMX_VC_4X4_HD = 6, /** Intra_4x4_Horizontal_Down */
- OMX_VC_4X4_VL = 7, /** Intra_4x4_Vertical_Left */
- OMX_VC_4X4_HU = 8 /** Intra_4x4_Horizontal_Up */
-} OMXVCM4P10Intra4x4PredMode;
-
-
-
-/* 6.3.1.3 Chroma Prediction Modes */
-/* A data type that enumerates intra chroma prediction modes is defined as follows: */
-
-typedef enum {
- OMX_VC_CHROMA_DC = 0, /** Intra_Chroma_DC */
- OMX_VC_CHROMA_HOR = 1, /** Intra_Chroma_Horizontal */
- OMX_VC_CHROMA_VERT = 2, /** Intra_Chroma_Vertical */
- OMX_VC_CHROMA_PLANE = 3 /** Intra_Chroma_Plane */
-} OMXVCM4P10IntraChromaPredMode;
-
-
-
-/* 6.3.1.4 Motion Estimation Modes */
-/* A data type that enumerates H.264 motion estimation modes is defined as follows: */
-
-typedef enum {
- OMX_VC_M4P10_FAST_SEARCH = 0, /** Fast motion search */
- OMX_VC_M4P10_FULL_SEARCH = 1 /** Full motion search */
-} OMXVCM4P10MEMode;
-
-
-
-/* 6.3.1.5 Macroblock Types */
-/* A data type that enumerates H.264 macroblock types is defined as follows: */
-
-typedef enum {
- OMX_VC_P_16x16 = 0, /* defined by [ISO14496-10] */
- OMX_VC_P_16x8 = 1,
- OMX_VC_P_8x16 = 2,
- OMX_VC_P_8x8 = 3,
- OMX_VC_PREF0_8x8 = 4,
- OMX_VC_INTER_SKIP = 5,
- OMX_VC_INTRA_4x4 = 8,
- OMX_VC_INTRA_16x16 = 9,
- OMX_VC_INTRA_PCM = 10
-} OMXVCM4P10MacroblockType;
-
-
-
-/* 6.3.1.6 Sub-Macroblock Types */
-/* A data type that enumerates H.264 sub-macroblock types is defined as follows: */
-
-typedef enum {
- OMX_VC_SUB_P_8x8 = 0, /* defined by [ISO14496-10] */
- OMX_VC_SUB_P_8x4 = 1,
- OMX_VC_SUB_P_4x8 = 2,
- OMX_VC_SUB_P_4x4 = 3
-} OMXVCM4P10SubMacroblockType;
-
-
-
-/* 6.3.1.7 Variable Length Coding (VLC) Information */
-
-typedef struct {
- OMX_U8 uTrailing_Ones; /* Trailing ones; 3 at most */
- OMX_U8 uTrailing_One_Signs; /* Trailing ones signal */
- OMX_U8 uNumCoeffs; /* Total number of non-zero coefs, including trailing ones */
- OMX_U8 uTotalZeros; /* Total number of zero coefs */
- OMX_S16 iLevels[16]; /* Levels of non-zero coefs, in reverse zig-zag order */
- OMX_U8 uRuns[16]; /* Runs for levels and trailing ones, in reverse zig-zag order */
-} OMXVCM4P10VLCInfo;
-
-
-
-/* 6.3.1.8 Macroblock Information */
-
-typedef struct {
- OMX_S32 sliceId; /* slice number */
- OMXVCM4P10MacroblockType mbType; /* MB type */
- OMXVCM4P10SubMacroblockType subMBType[4]; /* sub-block type */
- OMX_S32 qpy; /* qp for luma */
- OMX_S32 qpc; /* qp for chroma */
- OMX_U32 cbpy; /* CBP Luma */
- OMX_U32 cbpc; /* CBP Chroma */
- OMXVCMotionVector pMV0[4][4]; /* motion vector, represented using 1/4-pel units, pMV0[blocky][blockx] (blocky = 0~3, blockx =0~3) */
- OMXVCMotionVector pMVPred[4][4]; /* motion vector prediction, Represented using 1/4-pel units, pMVPred[blocky][blockx] (blocky = 0~3, blockx = 0~3) */
- OMX_U8 pRefL0Idx[4]; /* reference picture indices */
- OMXVCM4P10Intra16x16PredMode Intra16x16PredMode; /* best intra 16x16 prediction mode */
- OMXVCM4P10Intra4x4PredMode pIntra4x4PredMode[16]; /* best intra 4x4 prediction mode for each block, pMV0 indexed as above */
-} OMXVCM4P10MBInfo, *OMXVCM4P10MBInfoPtr;
-
-
-
-/* 6.3.1.9 Motion Estimation Parameters */
-
-typedef struct {
- OMX_S32 blockSplitEnable8x8; /* enables 16x8, 8x16, 8x8 */
- OMX_S32 blockSplitEnable4x4; /* enable splitting of 8x4, 4x8, 4x4 blocks */
- OMX_S32 halfSearchEnable;
- OMX_S32 quarterSearchEnable;
- OMX_S32 intraEnable4x4; /* 1=enable, 0=disable */
- OMX_S32 searchRange16x16; /* integer pixel units */
- OMX_S32 searchRange8x8;
- OMX_S32 searchRange4x4;
-} OMXVCM4P10MEParams;
-
-
-
-/**
- * Function: omxVCM4P10_PredictIntra_4x4 (6.3.3.1.1)
- *
- * Description:
- * Perform Intra_4x4 prediction for luma samples. If the upper-right block is
- * not available, then duplication work should be handled inside the function.
- * Users need not define them outside.
- *
- * Input Arguments:
- *
- * pSrcLeft - Pointer to the buffer of 4 left pixels:
- * p[x, y] (x = -1, y = 0..3)
- * pSrcAbove - Pointer to the buffer of 8 above pixels:
- * p[x,y] (x = 0..7, y =-1);
- * must be aligned on a 4-byte boundary.
- * pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1)
- * leftStep - Step of left pixel buffer; must be a multiple of 4.
- * dstStep - Step of the destination buffer; must be a multiple of 4.
- * predMode - Intra_4x4 prediction mode.
- * availability - Neighboring 4x4 block availability flag, refer to
- * "Neighboring Macroblock Availability" .
- *
- * Output Arguments:
- *
- * pDst - Pointer to the destination buffer; must be aligned on a 4-byte
- * boundary.
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * pDst is NULL.
- * dstStep < 4, or dstStep is not a multiple of 4.
- * leftStep is not a multiple of 4.
- * predMode is not in the valid range of enumeration
- * OMXVCM4P10Intra4x4PredMode.
- * predMode is OMX_VC_4x4_VERT, but availability doesn't set OMX_VC_UPPER
- * indicating p[x,-1] (x = 0..3) is not available.
- * predMode is OMX_VC_4x4_HOR, but availability doesn't set OMX_VC_LEFT
- * indicating p[-1,y] (y = 0..3) is not available.
- * predMode is OMX_VC_4x4_DIAG_DL, but availability doesn't set
- * OMX_VC_UPPER indicating p[x, -1] (x = 0..3) is not available.
- * predMode is OMX_VC_4x4_DIAG_DR, but availability doesn't set
- * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
- * p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not
- * available.
- * predMode is OMX_VC_4x4_VR, but availability doesn't set
- * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
- * p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not
- * available.
- * predMode is OMX_VC_4x4_HD, but availability doesn't set
- * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
- * p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not
- * available.
- * predMode is OMX_VC_4x4_VL, but availability doesn't set OMX_VC_UPPER
- * indicating p[x,-1] (x = 0..3) is not available.
- * predMode is OMX_VC_4x4_HU, but availability doesn't set OMX_VC_LEFT
- * indicating p[-1,y] (y = 0..3) is not available.
- * availability sets OMX_VC_UPPER, but pSrcAbove is NULL.
- * availability sets OMX_VC_LEFT, but pSrcLeft is NULL.
- * availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL.
- * either pSrcAbove or pDst is not aligned on a 4-byte boundary.
- *
- * Note:
- * pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointers if
- * they are not used by intra prediction as implied in predMode.
- *
- */
-OMXResult omxVCM4P10_PredictIntra_4x4 (
- const OMX_U8 *pSrcLeft,
- const OMX_U8 *pSrcAbove,
- const OMX_U8 *pSrcAboveLeft,
- OMX_U8 *pDst,
- OMX_INT leftStep,
- OMX_INT dstStep,
- OMXVCM4P10Intra4x4PredMode predMode,
- OMX_S32 availability
-);
-
-
-
-/**
- * Function: omxVCM4P10_PredictIntra_16x16 (6.3.3.1.2)
- *
- * Description:
- * Perform Intra_16x16 prediction for luma samples. If the upper-right block
- * is not available, then duplication work should be handled inside the
- * function. Users need not define them outside.
- *
- * Input Arguments:
- *
- * pSrcLeft - Pointer to the buffer of 16 left pixels: p[x, y] (x = -1, y =
- * 0..15)
- * pSrcAbove - Pointer to the buffer of 16 above pixels: p[x,y] (x = 0..15,
- * y= -1); must be aligned on a 16-byte boundary.
- * pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1)
- * leftStep - Step of left pixel buffer; must be a multiple of 16.
- * dstStep - Step of the destination buffer; must be a multiple of 16.
- * predMode - Intra_16x16 prediction mode, please refer to section 3.4.1.
- * availability - Neighboring 16x16 MB availability flag. Refer to
- * section 3.4.4.
- *
- * Output Arguments:
- *
- * pDst -Pointer to the destination buffer; must be aligned on a 16-byte
- * boundary.
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * pDst is NULL.
- * dstStep < 16. or dstStep is not a multiple of 16.
- * leftStep is not a multiple of 16.
- * predMode is not in the valid range of enumeration
- * OMXVCM4P10Intra16x16PredMode
- * predMode is OMX_VC_16X16_VERT, but availability doesn't set
- * OMX_VC_UPPER indicating p[x,-1] (x = 0..15) is not available.
- * predMode is OMX_VC_16X16_HOR, but availability doesn't set OMX_VC_LEFT
- * indicating p[-1,y] (y = 0..15) is not available.
- * predMode is OMX_VC_16X16_PLANE, but availability doesn't set
- * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
- * p[x,-1](x = 0..15), or p[-1,y] (y = 0..15), or p[-1,-1] is not
- * available.
- * availability sets OMX_VC_UPPER, but pSrcAbove is NULL.
- * availability sets OMX_VC_LEFT, but pSrcLeft is NULL.
- * availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL.
- * either pSrcAbove or pDst is not aligned on a 16-byte boundary.
- *
- * Note:
- * pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointers if
- * they are not used by intra prediction implied in predMode.
- * Note:
- * OMX_VC_UPPER_RIGHT is not used in intra_16x16 luma prediction.
- *
- */
-OMXResult omxVCM4P10_PredictIntra_16x16 (
- const OMX_U8 *pSrcLeft,
- const OMX_U8 *pSrcAbove,
- const OMX_U8 *pSrcAboveLeft,
- OMX_U8 *pDst,
- OMX_INT leftStep,
- OMX_INT dstStep,
- OMXVCM4P10Intra16x16PredMode predMode,
- OMX_S32 availability
-);
-
-
-
-/**
- * Function: omxVCM4P10_PredictIntraChroma_8x8 (6.3.3.1.3)
- *
- * Description:
- * Performs intra prediction for chroma samples.
- *
- * Input Arguments:
- *
- * pSrcLeft - Pointer to the buffer of 8 left pixels: p[x, y] (x = -1, y=
- * 0..7).
- * pSrcAbove - Pointer to the buffer of 8 above pixels: p[x,y] (x = 0..7, y
- * = -1); must be aligned on an 8-byte boundary.
- * pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1)
- * leftStep - Step of left pixel buffer; must be a multiple of 8.
- * dstStep - Step of the destination buffer; must be a multiple of 8.
- * predMode - Intra chroma prediction mode, please refer to section 3.4.3.
- * availability - Neighboring chroma block availability flag, please refer
- * to "Neighboring Macroblock Availability".
- *
- * Output Arguments:
- *
- * pDst - Pointer to the destination buffer; must be aligned on an 8-byte
- * boundary.
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If any of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * pDst is NULL.
- * dstStep < 8 or dstStep is not a multiple of 8.
- * leftStep is not a multiple of 8.
- * predMode is not in the valid range of enumeration
- * OMXVCM4P10IntraChromaPredMode.
- * predMode is OMX_VC_CHROMA_VERT, but availability doesn't set
- * OMX_VC_UPPER indicating p[x,-1] (x = 0..7) is not available.
- * predMode is OMX_VC_CHROMA_HOR, but availability doesn't set OMX_VC_LEFT
- * indicating p[-1,y] (y = 0..7) is not available.
- * predMode is OMX_VC_CHROMA_PLANE, but availability doesn't set
- * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
- * p[x,-1](x = 0..7), or p[-1,y] (y = 0..7), or p[-1,-1] is not
- * available.
- * availability sets OMX_VC_UPPER, but pSrcAbove is NULL.
- * availability sets OMX_VC_LEFT, but pSrcLeft is NULL.
- * availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL.
- * either pSrcAbove or pDst is not aligned on a 8-byte boundary.
- *
- * Note: pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointer if
- * they are not used by intra prediction implied in predMode.
- *
- * Note: OMX_VC_UPPER_RIGHT is not used in intra chroma prediction.
- *
- */
-OMXResult omxVCM4P10_PredictIntraChroma_8x8 (
- const OMX_U8 *pSrcLeft,
- const OMX_U8 *pSrcAbove,
- const OMX_U8 *pSrcAboveLeft,
- OMX_U8 *pDst,
- OMX_INT leftStep,
- OMX_INT dstStep,
- OMXVCM4P10IntraChromaPredMode predMode,
- OMX_S32 availability
-);
-
-
-
-/**
- * Function: omxVCM4P10_InterpolateLuma (6.3.3.2.1)
- *
- * Description:
- * Performs quarter-pixel interpolation for inter luma MB. It is assumed that
- * the frame is already padded when calling this function.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the source reference frame buffer
- * srcStep - reference frame step, in bytes; must be a multiple of roi.width
- * dstStep - destination frame step, in bytes; must be a multiple of
- * roi.width
- * dx - Fractional part of horizontal motion vector component in 1/4 pixel
- * unit; valid in the range [0,3]
- * dy - Fractional part of vertical motion vector y component in 1/4 pixel
- * unit; valid in the range [0,3]
- * roi - Dimension of the interpolation region; the parameters roi.width and
- * roi.height must be equal to either 4, 8, or 16.
- *
- * Output Arguments:
- *
- * pDst - Pointer to the destination frame buffer:
- * if roi.width==4, 4-byte alignment required
- * if roi.width==8, 8-byte alignment required
- * if roi.width==16, 16-byte alignment required
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * pSrc or pDst is NULL.
- * srcStep or dstStep < roi.width.
- * dx or dy is out of range [0,3].
- * roi.width or roi.height is out of range {4, 8, 16}.
- * roi.width is equal to 4, but pDst is not 4 byte aligned.
- * roi.width is equal to 8 or 16, but pDst is not 8 byte aligned.
- * srcStep or dstStep is not a multiple of 8.
- *
- */
-OMXResult omxVCM4P10_InterpolateLuma (
- const OMX_U8 *pSrc,
- OMX_S32 srcStep,
- OMX_U8 *pDst,
- OMX_S32 dstStep,
- OMX_S32 dx,
- OMX_S32 dy,
- OMXSize roi
-);
-
-
-
-/**
- * Function: omxVCM4P10_InterpolateChroma (6.3.3.2.2)
- *
- * Description:
- * Performs 1/8-pixel interpolation for inter chroma MB.
- *
- * Input Arguments:
- *
- * pSrc -Pointer to the source reference frame buffer
- * srcStep -Reference frame step in bytes
- * dstStep -Destination frame step in bytes; must be a multiple of
- * roi.width.
- * dx -Fractional part of horizontal motion vector component in 1/8 pixel
- * unit; valid in the range [0,7]
- * dy -Fractional part of vertical motion vector component in 1/8 pixel
- * unit; valid in the range [0,7]
- * roi -Dimension of the interpolation region; the parameters roi.width and
- * roi.height must be equal to either 2, 4, or 8.
- *
- * Output Arguments:
- *
- * pDst -Pointer to the destination frame buffer:
- * if roi.width==2, 2-byte alignment required
- * if roi.width==4, 4-byte alignment required
- * if roi.width==8, 8-byte alignment required
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * pSrc or pDst is NULL.
- * srcStep or dstStep < 8.
- * dx or dy is out of range [0-7].
- * roi.width or roi.height is out of range {2,4,8}.
- * roi.width is equal to 2, but pDst is not 2-byte aligned.
- * roi.width is equal to 4, but pDst is not 4-byte aligned.
- * roi.width is equal to 8, but pDst is not 8 byte aligned.
- * srcStep or dstStep is not a multiple of 8.
- *
- */
-OMXResult omxVCM4P10_InterpolateChroma (
- const OMX_U8 *pSrc,
- OMX_S32 srcStep,
- OMX_U8 *pDst,
- OMX_S32 dstStep,
- OMX_S32 dx,
- OMX_S32 dy,
- OMXSize roi
-);
-
-
-
-/**
- * Function: omxVCM4P10_FilterDeblockingLuma_VerEdge_I (6.3.3.3.1)
- *
- * Description:
- * Performs in-place deblock filtering on four vertical edges of the luma
- * macroblock (16x16).
- *
- * Input Arguments:
- *
- * pSrcDst - Pointer to the input macroblock; must be 16-byte aligned.
- * srcdstStep -Step of the arrays; must be a multiple of 16.
- * pAlpha -Array of size 2 of alpha thresholds (the first item is the alpha
- * threshold for the external vertical edge, and the second item is
- * for the internal vertical edge); per [ISO14496-10] alpha values
- * must be in the range [0,255].
- * pBeta -Array of size 2 of beta thresholds (the first item is the beta
- * threshold for the external vertical edge, and the second item is
- * for the internal vertical edge); per [ISO14496-10] beta values
- * must be in the range [0,18].
- * pThresholds -Array of size 16 of Thresholds (TC0) (values for the left
- * edge of each 4x4 block, arranged in vertical block order); must
- * be aligned on a 4-byte boundary.. Per [ISO14496-10] values must
- * be in the range [0,25].
- * pBS -Array of size 16 of BS parameters (arranged in vertical block
- * order); valid in the range [0,4] with the following
- * restrictions: i) pBS[i]== 4 may occur only for 0<=i<=3, ii)
- * pBS[i]== 4 if and only if pBS[i^3]== 4. Must be 4-byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst -Pointer to filtered output macroblock.
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * Either of the pointers in pSrcDst, pAlpha, pBeta, pThresholds, or pBS
- * is NULL.
- * Either pThresholds or pBS is not aligned on a 4-byte boundary.
- * pSrcDst is not 16-byte aligned.
- * srcdstStep is not a multiple of 16.
- * pAlpha[0] and/or pAlpha[1] is outside the range [0,255].
- * pBeta[0] and/or pBeta[1] is outside the range [0,18].
- * One or more entries in the table pThresholds[0..15]is outside of the
- * range [0,25].
- * pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or (pBS[i]==4 &&
- * pBS[i^3]!=4) for 0<=i<=3.
- *
- */
-OMXResult omxVCM4P10_FilterDeblockingLuma_VerEdge_I (
- OMX_U8 *pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8 *pAlpha,
- const OMX_U8 *pBeta,
- const OMX_U8 *pThresholds,
- const OMX_U8 *pBS
-);
-
-
-
-/**
- * Function: omxVCM4P10_FilterDeblockingLuma_HorEdge_I (6.3.3.3.2)
- *
- * Description:
- * Performs in-place deblock filtering on four horizontal edges of the luma
- * macroblock (16x16).
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input macroblock; must be 16-byte aligned.
- * srcdstStep - step of the arrays; must be a multiple of 16.
- * pAlpha - array of size 2 of alpha thresholds (the first item is the alpha
- * threshold for the external vertical edge, and the second item is
- * for the internal horizontal edge); per [ISO14496-10] alpha
- * values must be in the range [0,255].
- * pBeta - array of size 2 of beta thresholds (the first item is the beta
- * threshold for the external horizontal edge, and the second item
- * is for the internal horizontal edge). Per [ISO14496-10] beta
- * values must be in the range [0,18].
- * pThresholds - array of size 16 containing thresholds, TC0, for the top
- * horizontal edge of each 4x4 block, arranged in horizontal block
- * order; must be aligned on a 4-byte boundary. Per [ISO14496 10]
- * values must be in the range [0,25].
- * pBS - array of size 16 of BS parameters (arranged in horizontal block
- * order); valid in the range [0,4] with the following
- * restrictions: i) pBS[i]== 4 may occur only for 0<=i<=3, ii)
- * pBS[i]== 4 if and only if pBS[i^3]== 4. Must be 4-byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst -Pointer to filtered output macroblock.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr, if the function runs without error.
- *
- * OMX_Sts_BadArgErr, if one of the following cases occurs:
- * - one or more of the following pointers is NULL: pSrcDst, pAlpha,
- * pBeta, pThresholds, or pBS.
- * - either pThresholds or pBS is not aligned on a 4-byte boundary.
- * - pSrcDst is not 16-byte aligned.
- * - srcdstStep is not a multiple of 16.
- * - pAlpha[0] and/or pAlpha[1] is outside the range [0,255].
- * - pBeta[0] and/or pBeta[1] is outside the range [0,18].
- * - One or more entries in the table pThresholds[0..15] is
- * outside of the range [0,25].
- * - pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
- * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
- *
- */
-OMXResult omxVCM4P10_FilterDeblockingLuma_HorEdge_I (
- OMX_U8 *pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8 *pAlpha,
- const OMX_U8 *pBeta,
- const OMX_U8 *pThresholds,
- const OMX_U8 *pBS
-);
-
-
-
-/**
- * Function: omxVCM4P10_FilterDeblockingChroma_VerEdge_I (6.3.3.3.3)
- *
- * Description:
- * Performs in-place deblock filtering on four vertical edges of the chroma
- * macroblock (8x8).
- *
- * Input Arguments:
- *
- * pSrcDst - Pointer to the input macroblock; must be 8-byte aligned.
- * srcdstStep - Step of the arrays; must be a multiple of 8.
- * pAlpha - Array of size 2 of alpha thresholds (the first item is alpha
- * threshold for external vertical edge, and the second item is for
- * internal vertical edge); per [ISO14496-10] alpha values must be
- * in the range [0,255].
- * pBeta - Array of size 2 of beta thresholds (the first item is the beta
- * threshold for the external vertical edge, and the second item is
- * for the internal vertical edge); per [ISO14496-10] beta values
- * must be in the range [0,18].
- * pThresholds - Array of size 8 containing thresholds, TC0, for the left
- * vertical edge of each 4x2 chroma block, arranged in vertical
- * block order; must be aligned on a 4-byte boundary. Per
- * [ISO14496-10] values must be in the range [0,25].
- * pBS - Array of size 16 of BS parameters (values for each 2x2 chroma
- * block, arranged in vertical block order). This parameter is the
- * same as the pBS parameter passed into FilterDeblockLuma_VerEdge;
- * valid in the range [0,4] with the following restrictions: i)
- * pBS[i]== 4 may occur only for 0<=i<=3, ii) pBS[i]== 4 if and
- * only if pBS[i^3]== 4. Must be 4 byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst -Pointer to filtered output macroblock.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr, if the function runs without error.
- *
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - one or more of the following pointers is NULL: pSrcDst, pAlpha,
- * pBeta, pThresholds, or pBS.
- * - pSrcDst is not 8-byte aligned.
- * - srcdstStep is not a multiple of 8.
- * - pThresholds is not 4-byte aligned.
- * - pAlpha[0] and/or pAlpha[1] is outside the range [0,255].
- * - pBeta[0] and/or pBeta[1] is outside the range [0,18].
- * - One or more entries in the table pThresholds[0..7] is outside
- * of the range [0,25].
- * - pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
- * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
- * - pBS is not 4-byte aligned.
- *
- */
-OMXResult omxVCM4P10_FilterDeblockingChroma_VerEdge_I (
- OMX_U8 *pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8 *pAlpha,
- const OMX_U8 *pBeta,
- const OMX_U8 *pThresholds,
- const OMX_U8 *pBS
-);
-
-
-
-/**
- * Function: omxVCM4P10_FilterDeblockingChroma_HorEdge_I (6.3.3.3.4)
- *
- * Description:
- * Performs in-place deblock filtering on the horizontal edges of the chroma
- * macroblock (8x8).
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input macroblock; must be 8-byte aligned.
- * srcdstStep - array step; must be a multiple of 8.
- * pAlpha - array of size 2 containing alpha thresholds; the first element
- * contains the threshold for the external horizontal edge, and the
- * second element contains the threshold for internal horizontal
- * edge. Per [ISO14496-10] alpha values must be in the range
- * [0,255].
- * pBeta - array of size 2 containing beta thresholds; the first element
- * contains the threshold for the external horizontal edge, and the
- * second element contains the threshold for the internal
- * horizontal edge. Per [ISO14496-10] beta values must be in the
- * range [0,18].
- * pThresholds - array of size 8 containing thresholds, TC0, for the top
- * horizontal edge of each 2x4 chroma block, arranged in horizontal
- * block order; must be aligned on a 4-byte boundary. Per
- * [ISO14496-10] values must be in the range [0,25].
- * pBS - array of size 16 containing BS parameters for each 2x2 chroma
- * block, arranged in horizontal block order; valid in the range
- * [0,4] with the following restrictions: i) pBS[i]== 4 may occur
- * only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]== 4.
- * Must be 4-byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst -Pointer to filtered output macroblock.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr, if the function runs without error.
- *
- * OMX_Sts_BadArgErr, if one of the following cases occurs:
- * - any of the following pointers is NULL:
- * pSrcDst, pAlpha, pBeta, pThresholds, or pBS.
- * - pSrcDst is not 8-byte aligned.
- * - srcdstStep is not a multiple of 8.
- * - pThresholds is not 4-byte aligned.
- * - pAlpha[0] and/or pAlpha[1] is outside the range [0,255].
- * - pBeta[0] and/or pBeta[1] is outside the range [0,18].
- * - One or more entries in the table pThresholds[0..7] is outside
- * of the range [0,25].
- * - pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
- * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
- * - pBS is not 4-byte aligned.
- *
- */
-OMXResult omxVCM4P10_FilterDeblockingChroma_HorEdge_I (
- OMX_U8 *pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8 *pAlpha,
- const OMX_U8 *pBeta,
- const OMX_U8 *pThresholds,
- const OMX_U8 *pBS
-);
-
-
-
-/**
- * Function: omxVCM4P10_DeblockLuma_I (6.3.3.3.5)
- *
- * Description:
- * This function performs in-place deblock filtering the horizontal and
- * vertical edges of a luma macroblock (16x16).
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input macroblock; must be 16-byte aligned.
- * srcdstStep - image width; must be a multiple of 16.
- * pAlpha - pointer to a 2x2 table of alpha thresholds, organized as
- * follows: {external vertical edge, internal vertical edge,
- * external horizontal edge, internal horizontal edge }. Per
- * [ISO14496-10] alpha values must be in the range [0,255].
- * pBeta - pointer to a 2x2 table of beta thresholds, organized as follows:
- * {external vertical edge, internal vertical edge, external
- * horizontal edge, internal horizontal edge }. Per [ISO14496-10]
- * beta values must be in the range [0,18].
- * pThresholds - pointer to a 16x2 table of threshold (TC0), organized as
- * follows: {values for the left or above edge of each 4x4 block,
- * arranged in vertical block order and then in horizontal block
- * order}; must be aligned on a 4-byte boundary. Per [ISO14496-10]
- * values must be in the range [0,25].
- * pBS - pointer to a 16x2 table of BS parameters arranged in scan block
- * order for vertical edges and then horizontal edges; valid in the
- * range [0,4] with the following restrictions: i) pBS[i]== 4 may
- * occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]==
- * 4. Must be 4-byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to filtered output macroblock.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - one or more of the following pointers is NULL: pSrcDst, pAlpha,
- * pBeta, pThresholds or pBS.
- * - pSrcDst is not 16-byte aligned.
- * - either pThresholds or pBS is not aligned on a 4-byte boundary.
- * - one or more entries in the table pAlpha[0..3] is outside the range
- * [0,255].
- * - one or more entries in the table pBeta[0..3] is outside the range
- * [0,18].
- * - one or more entries in the table pThresholds[0..31]is outside of
- * the range [0,25].
- * - pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
- * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
- * - srcdstStep is not a multiple of 16.
- *
- */
-OMXResult omxVCM4P10_DeblockLuma_I (
- OMX_U8 *pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8 *pAlpha,
- const OMX_U8 *pBeta,
- const OMX_U8 *pThresholds,
- const OMX_U8 *pBS
-);
-
-
-
-/**
- * Function: omxVCM4P10_DeblockChroma_I (6.3.3.3.6)
- *
- * Description:
- * Performs in-place deblocking filtering on all edges of the chroma
- * macroblock (16x16).
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input macroblock; must be 8-byte aligned.
- * srcdstStep - step of the arrays; must be a multiple of 8.
- * pAlpha - pointer to a 2x2 array of alpha thresholds, organized as
- * follows: {external vertical edge, internal vertical edge,
- * external horizontal edge, internal horizontal edge }. Per
- * [ISO14496-10] alpha values must be in the range [0,255].
- * pBeta - pointer to a 2x2 array of Beta Thresholds, organized as follows:
- * { external vertical edge, internal vertical edge, external
- * horizontal edge, internal horizontal edge }. Per [ISO14496-10]
- * beta values must be in the range [0,18].
- * pThresholds - array of size 8x2 of Thresholds (TC0) (values for the left
- * or above edge of each 4x2 or 2x4 block, arranged in vertical
- * block order and then in horizontal block order); must be aligned
- * on a 4-byte boundary. Per [ISO14496-10] values must be in the
- * range [0,25].
- * pBS - array of size 16x2 of BS parameters (arranged in scan block order
- * for vertical edges and then horizontal edges); valid in the
- * range [0,4] with the following restrictions: i) pBS[i]== 4 may
- * occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]==
- * 4. Must be 4-byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to filtered output macroblock.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - one or more of the following pointers is NULL: pSrcDst, pAlpha,
- * pBeta, pThresholds, or pBS.
- * - pSrcDst is not 8-byte aligned.
- * - either pThresholds or pBS is not 4-byte aligned.
- * - one or more entries in the table pAlpha[0..3] is outside the range
- * [0,255].
- * - one or more entries in the table pBeta[0..3] is outside the range
- * [0,18].
- * - one or more entries in the table pThresholds[0..15]is outside of
- * the range [0,25].
- * - pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
- * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
- * - srcdstStep is not a multiple of 8.
- *
- */
-OMXResult omxVCM4P10_DeblockChroma_I (
- OMX_U8 *pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8 *pAlpha,
- const OMX_U8 *pBeta,
- const OMX_U8 *pThresholds,
- const OMX_U8 *pBS
-);
-
-
-
-/**
- * Function: omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC (6.3.4.1.1)
- *
- * Description:
- * Performs CAVLC decoding and inverse raster scan for a 2x2 block of
- * ChromaDCLevel. The decoded coefficients in the packed position-coefficient
- * buffer are stored in reverse zig-zag order, i.e., the first buffer element
- * contains the last non-zero postion-coefficient pair of the block. Within
- * each position-coefficient pair, the position entry indicates the
- * raster-scan position of the coefficient, while the coefficient entry
- * contains the coefficient value.
- *
- * Input Arguments:
- *
- * ppBitStream - Double pointer to current byte in bit stream buffer
- * pOffset - Pointer to current bit position in the byte pointed to by
- * *ppBitStream; valid in the range [0,7].
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after each block is decoded
- * pOffset - *pOffset is updated after each block is decoded
- * pNumCoeff - Pointer to the number of nonzero coefficients in this block
- * ppPosCoefBuf - Double pointer to destination residual
- * coefficient-position pair buffer. Buffer position
- * (*ppPosCoefBuf) is updated upon return, unless there are only
- * zero coefficients in the currently decoded block. In this case
- * the caller is expected to bypass the transform/dequantization of
- * the empty blocks.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr, if the function runs without error.
- *
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - ppBitStream or pOffset is NULL.
- * - ppPosCoefBuf or pNumCoeff is NULL.
- * OMX_Sts_Err - if one of the following is true:
- * - an illegal code is encountered in the bitstream
- *
- */
-OMXResult omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC (
- const OMX_U8 **ppBitStream,
- OMX_S32*pOffset,
- OMX_U8 *pNumCoeff,
- OMX_U8 **ppPosCoefbuf
-);
-
-
-
-/**
- * Function: omxVCM4P10_DecodeCoeffsToPairCAVLC (6.3.4.1.2)
- *
- * Description:
- * Performs CAVLC decoding and inverse zigzag scan for 4x4 block of
- * Intra16x16DCLevel, Intra16x16ACLevel, LumaLevel, and ChromaACLevel. Inverse
- * field scan is not supported. The decoded coefficients in the packed
- * position-coefficient buffer are stored in reverse zig-zag order, i.e., the
- * first buffer element contains the last non-zero postion-coefficient pair of
- * the block. Within each position-coefficient pair, the position entry
- * indicates the raster-scan position of the coefficient, while the
- * coefficient entry contains the coefficient value.
- *
- * Input Arguments:
- *
- * ppBitStream -Double pointer to current byte in bit stream buffer
- * pOffset - Pointer to current bit position in the byte pointed to by
- * *ppBitStream; valid in the range [0,7].
- * sMaxNumCoeff - Maximum the number of non-zero coefficients in current
- * block
- * sVLCSelect - VLC table selector, obtained from the number of non-zero
- * coefficients contained in the above and left 4x4 blocks. It is
- * equivalent to the variable nC described in H.264 standard table
- * 9 5, except its value can t be less than zero.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after each block is decoded.
- * Buffer position (*ppPosCoefBuf) is updated upon return, unless
- * there are only zero coefficients in the currently decoded block.
- * In this case the caller is expected to bypass the
- * transform/dequantization of the empty blocks.
- * pOffset - *pOffset is updated after each block is decoded
- * pNumCoeff - Pointer to the number of nonzero coefficients in this block
- * ppPosCoefBuf - Double pointer to destination residual
- * coefficient-position pair buffer
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- *
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - ppBitStream or pOffset is NULL.
- * - ppPosCoefBuf or pNumCoeff is NULL.
- * - sMaxNumCoeff is not equal to either 15 or 16.
- * - sVLCSelect is less than 0.
- *
- * OMX_Sts_Err - if one of the following is true:
- * - an illegal code is encountered in the bitstream
- *
- */
-OMXResult omxVCM4P10_DecodeCoeffsToPairCAVLC (
- const OMX_U8 **ppBitStream,
- OMX_S32 *pOffset,
- OMX_U8 *pNumCoeff,
- OMX_U8 **ppPosCoefbuf,
- OMX_INT sVLCSelect,
- OMX_INT sMaxNumCoeff
-);
-
-
-
-/**
- * Function: omxVCM4P10_TransformDequantLumaDCFromPair (6.3.4.2.1)
- *
- * Description:
- * Reconstructs the 4x4 LumaDC block from the coefficient-position pair
- * buffer, performs integer inverse, and dequantization for 4x4 LumaDC
- * coefficients, and updates the pair buffer pointer to the next non-empty
- * block.
- *
- * Input Arguments:
- *
- * ppSrc - Double pointer to residual coefficient-position pair buffer
- * output by CALVC decoding
- * QP - Quantization parameter QpY
- *
- * Output Arguments:
- *
- * ppSrc - *ppSrc is updated to the start of next non empty block
- * pDst - Pointer to the reconstructed 4x4 LumaDC coefficients buffer; must
- * be aligned on a 8-byte boundary.
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - ppSrc or pDst is NULL.
- * - pDst is not 8 byte aligned.
- * - QP is not in the range of [0-51].
- *
- */
-OMXResult omxVCM4P10_TransformDequantLumaDCFromPair (
- const OMX_U8 **ppSrc,
- OMX_S16 *pDst,
- OMX_INT QP
-);
-
-
-
-/**
- * Function: omxVCM4P10_TransformDequantChromaDCFromPair (6.3.4.2.2)
- *
- * Description:
- * Reconstruct the 2x2 ChromaDC block from coefficient-position pair buffer,
- * perform integer inverse transformation, and dequantization for 2x2 chroma
- * DC coefficients, and update the pair buffer pointer to next non-empty
- * block.
- *
- * Input Arguments:
- *
- * ppSrc - Double pointer to residual coefficient-position pair buffer
- * output by CALVC decoding
- * QP - Quantization parameter QpC
- *
- * Output Arguments:
- *
- * ppSrc - *ppSrc is updated to the start of next non empty block
- * pDst - Pointer to the reconstructed 2x2 ChromaDC coefficients buffer;
- * must be aligned on a 4-byte boundary.
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - ppSrc or pDst is NULL.
- * - pDst is not 4-byte aligned.
- * - QP is not in the range of [0-51].
- *
- */
-OMXResult omxVCM4P10_TransformDequantChromaDCFromPair (
- const OMX_U8 **ppSrc,
- OMX_S16 *pDst,
- OMX_INT QP
-);
-
-
-
-/**
- * Function: omxVCM4P10_DequantTransformResidualFromPairAndAdd (6.3.4.2.3)
- *
- * Description:
- * Reconstruct the 4x4 residual block from coefficient-position pair buffer,
- * perform dequantization and integer inverse transformation for 4x4 block of
- * residuals with previous intra prediction or motion compensation data, and
- * update the pair buffer pointer to next non-empty block. If pDC == NULL,
- * there re 16 non-zero AC coefficients at most in the packed buffer starting
- * from 4x4 block position 0; If pDC != NULL, there re 15 non-zero AC
- * coefficients at most in the packet buffer starting from 4x4 block position
- * 1.
- *
- * Input Arguments:
- *
- * ppSrc - Double pointer to residual coefficient-position pair buffer
- * output by CALVC decoding
- * pPred - Pointer to the predicted 4x4 block; must be aligned on a 4-byte
- * boundary
- * predStep - Predicted frame step size in bytes; must be a multiple of 4
- * dstStep - Destination frame step in bytes; must be a multiple of 4
- * pDC - Pointer to the DC coefficient of this block, NULL if it doesn't
- * exist
- * QP - QP Quantization parameter. It should be QpC in chroma 4x4 block
- * decoding, otherwise it should be QpY.
- * AC - Flag indicating if at least one non-zero AC coefficient exists
- *
- * Output Arguments:
- *
- * pDst - pointer to the reconstructed 4x4 block data; must be aligned on a
- * 4-byte boundary
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - pPred or pDst is NULL.
- * - pPred or pDst is not 4-byte aligned.
- * - predStep or dstStep is not a multiple of 4.
- * - AC !=0 and Qp is not in the range of [0-51] or ppSrc == NULL.
- * - AC ==0 && pDC ==NULL.
- *
- */
-OMXResult omxVCM4P10_DequantTransformResidualFromPairAndAdd (
- const OMX_U8 **ppSrc,
- const OMX_U8 *pPred,
- const OMX_S16 *pDC,
- OMX_U8 *pDst,
- OMX_INT predStep,
- OMX_INT dstStep,
- OMX_INT QP,
- OMX_INT AC
-);
-
-
-
-/**
- * Function: omxVCM4P10_MEGetBufSize (6.3.5.1.1)
- *
- * Description:
- * Computes the size, in bytes, of the vendor-specific specification
- * structure for the omxVCM4P10 motion estimation functions BlockMatch_Integer
- * and MotionEstimationMB.
- *
- * Input Arguments:
- *
- * MEmode - motion estimation mode; available modes are defined by the
- * enumerated type OMXVCM4P10MEMode
- * pMEParams -motion estimation parameters
- *
- * Output Arguments:
- *
- * pSize - pointer to the number of bytes required for the motion
- * estimation specification structure
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - pMEParams or pSize is NULL.
- * - an invalid MEMode is specified.
- *
- */
-OMXResult omxVCM4P10_MEGetBufSize (
- OMXVCM4P10MEMode MEmode,
- const OMXVCM4P10MEParams *pMEParams,
- OMX_U32 *pSize
-);
-
-
-
-/**
- * Function: omxVCM4P10_MEInit (6.3.5.1.2)
- *
- * Description:
- * Initializes the vendor-specific specification structure required for the
- * omxVCM4P10 motion estimation functions: BlockMatch_Integer and
- * MotionEstimationMB. Memory for the specification structure *pMESpec must be
- * allocated prior to calling the function, and should be aligned on a 4-byte
- * boundary. The number of bytes required for the specification structure can
- * be determined using the function omxVCM4P10_MEGetBufSize. Following
- * initialization by this function, the vendor-specific structure *pMESpec
- * should contain an implementation-specific representation of all motion
- * estimation parameters received via the structure pMEParams, for example
- * searchRange16x16, searchRange8x8, etc.
- *
- * Input Arguments:
- *
- * MEmode - motion estimation mode; available modes are defined by the
- * enumerated type OMXVCM4P10MEMode
- * pMEParams - motion estimation parameters
- * pMESpec - pointer to the uninitialized ME specification structure
- *
- * Output Arguments:
- *
- * pMESpec - pointer to the initialized ME specification structure
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - pMEParams or pSize is NULL.
- * - an invalid value was specified for the parameter MEmode
- * - a negative or zero value was specified for one of the search ranges
- * (e.g., pMBParams >searchRange8x8, pMEParams->searchRange16x16, etc.)
- * - either in isolation or in combination, one or more of the enables or
- * search ranges in the structure *pMEParams were configured such
- * that the requested behavior fails to comply with [ISO14496-10].
- *
- */
-OMXResult omxVCM4P10_MEInit (
- OMXVCM4P10MEMode MEmode,
- const OMXVCM4P10MEParams *pMEParams,
- void *pMESpec
-);
-
-
-
-/**
- * Function: omxVCM4P10_BlockMatch_Integer (6.3.5.2.1)
- *
- * Description:
- * Performs integer block match. Returns best MV and associated cost.
- *
- * Input Arguments:
- *
- * pSrcOrgY - Pointer to the top-left corner of the current block:
- * If iBlockWidth==4, 4-byte alignment required.
- * If iBlockWidth==8, 8-byte alignment required.
- * If iBlockWidth==16, 16-byte alignment required.
- * pSrcRefY - Pointer to the top-left corner of the co-located block in the
- * reference picture:
- * If iBlockWidth==4, 4-byte alignment required.
- * If iBlockWidth==8, 8-byte alignment required.
- * If iBlockWidth==16, 16-byte alignment required.
- * nSrcOrgStep - Stride of the original picture plane, expressed in terms
- * of integer pixels; must be a multiple of iBlockWidth.
- * nSrcRefStep - Stride of the reference picture plane, expressed in terms
- * of integer pixels
- * pRefRect - pointer to the valid reference rectangle inside the reference
- * picture plane
- * nCurrPointPos - position of the current block in the current plane
- * iBlockWidth - Width of the current block, expressed in terms of integer
- * pixels; must be equal to either 4, 8, or 16.
- * iBlockHeight - Height of the current block, expressed in terms of
- * integer pixels; must be equal to either 4, 8, or 16.
- * nLamda - Lamda factor; used to compute motion cost
- * pMVPred - Predicted MV; used to compute motion cost, expressed in terms
- * of 1/4-pel units
- * pMVCandidate - Candidate MV; used to initialize the motion search,
- * expressed in terms of integer pixels
- * pMESpec - pointer to the ME specification structure
- *
- * Output Arguments:
- *
- * pDstBestMV - Best MV resulting from integer search, expressed in terms
- * of 1/4-pel units
- * pBestCost - Motion cost associated with the best MV; computed as
- * SAD+Lamda*BitsUsedByMV
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - any of the following pointers are NULL:
- * pSrcOrgY, pSrcRefY, pRefRect, pMVPred, pMVCandidate, or pMESpec.
- * - Either iBlockWidth or iBlockHeight are values other than 4, 8, or 16.
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_BlockMatch_Integer (
- const OMX_U8 *pSrcOrgY,
- OMX_S32 nSrcOrgStep,
- const OMX_U8 *pSrcRefY,
- OMX_S32 nSrcRefStep,
- const OMXRect *pRefRect,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- OMX_U8 iBlockWidth,
- OMX_U8 iBlockHeight,
- OMX_U32 nLamda,
- const OMXVCMotionVector *pMVPred,
- const OMXVCMotionVector *pMVCandidate,
- OMXVCMotionVector *pBestMV,
- OMX_S32 *pBestCost,
- void *pMESpec
-);
-
-
-
-/**
- * Function: omxVCM4P10_BlockMatch_Half (6.3.5.2.2)
- *
- * Description:
- * Performs a half-pel block match using results from a prior integer search.
- * Returns the best MV and associated cost. This function estimates the
- * half-pixel motion vector by interpolating the integer resolution motion
- * vector referenced by the input parameter pSrcDstBestMV, i.e., the initial
- * integer MV is generated externally. The function
- * omxVCM4P10_BlockMatch_Integer may be used for integer motion estimation.
- *
- * Input Arguments:
- *
- * pSrcOrgY - Pointer to the current position in original picture plane:
- * If iBlockWidth==4, 4-byte alignment required.
- * If iBlockWidth==8, 8-byte alignment required.
- * If iBlockWidth==16, 16-byte alignment required.
- * pSrcRefY - Pointer to the top-left corner of the co-located block in the
- * reference picture:
- * If iBlockWidth==4, 4-byte alignment required.
- * If iBlockWidth==8, 8-byte alignment required.
- * If iBlockWidth==16, 16-byte alignment required.
- * nSrcOrgStep - Stride of the original picture plane in terms of full
- * pixels; must be a multiple of iBlockWidth.
- * nSrcRefStep - Stride of the reference picture plane in terms of full
- * pixels
- * iBlockWidth - Width of the current block in terms of full pixels; must
- * be equal to either 4, 8, or 16.
- * iBlockHeight - Height of the current block in terms of full pixels; must
- * be equal to either 4, 8, or 16.
- * nLamda - Lamda factor, used to compute motion cost
- * pMVPred - Predicted MV, represented in terms of 1/4-pel units; used to
- * compute motion cost
- * pSrcDstBestMV - The best MV resulting from a prior integer search,
- * represented in terms of 1/4-pel units
- *
- * Output Arguments:
- *
- * pSrcDstBestMV - Best MV resulting from the half-pel search, expressed in
- * terms of 1/4-pel units
- * pBestCost - Motion cost associated with the best MV; computed as
- * SAD+Lamda*BitsUsedByMV
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - any of the following pointers is NULL: pSrcOrgY, pSrcRefY,
- * pSrcDstBestMV, pMVPred, pBestCost
- * - iBlockWidth or iBlockHeight are equal to values other than 4, 8, or 16.
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_BlockMatch_Half (
- const OMX_U8 *pSrcOrgY,
- OMX_S32 nSrcOrgStep,
- const OMX_U8 *pSrcRefY,
- OMX_S32 nSrcRefStep,
- OMX_U8 iBlockWidth,
- OMX_U8 iBlockHeight,
- OMX_U32 nLamda,
- const OMXVCMotionVector *pMVPred,
- OMXVCMotionVector *pSrcDstBestMV,
- OMX_S32 *pBestCost
-);
-
-
-
-/**
- * Function: omxVCM4P10_BlockMatch_Quarter (6.3.5.2.3)
- *
- * Description:
- * Performs a quarter-pel block match using results from a prior half-pel
- * search. Returns the best MV and associated cost. This function estimates
- * the quarter-pixel motion vector by interpolating the half-pel resolution
- * motion vector referenced by the input parameter pSrcDstBestMV, i.e., the
- * initial half-pel MV is generated externally. The function
- * omxVCM4P10_BlockMatch_Half may be used for half-pel motion estimation.
- *
- * Input Arguments:
- *
- * pSrcOrgY - Pointer to the current position in original picture plane:
- * If iBlockWidth==4, 4-byte alignment required.
- * If iBlockWidth==8, 8-byte alignment required.
- * If iBlockWidth==16, 16-byte alignment required.
- * pSrcRefY - Pointer to the top-left corner of the co-located block in the
- * reference picture:
- * If iBlockWidth==4, 4-byte alignment required.
- * If iBlockWidth==8, 8-byte alignment required.
- * If iBlockWidth==16, 16-byte alignment required.
- * nSrcOrgStep - Stride of the original picture plane in terms of full
- * pixels; must be a multiple of iBlockWidth.
- * nSrcRefStep - Stride of the reference picture plane in terms of full
- * pixels
- * iBlockWidth - Width of the current block in terms of full pixels; must
- * be equal to either 4, 8, or 16.
- * iBlockHeight - Height of the current block in terms of full pixels; must
- * be equal to either 4, 8, or 16.
- * nLamda - Lamda factor, used to compute motion cost
- * pMVPred - Predicted MV, represented in terms of 1/4-pel units; used to
- * compute motion cost
- * pSrcDstBestMV - The best MV resulting from a prior half-pel search,
- * represented in terms of 1/4 pel units
- *
- * Output Arguments:
- *
- * pSrcDstBestMV - Best MV resulting from the quarter-pel search, expressed
- * in terms of 1/4-pel units
- * pBestCost - Motion cost associated with the best MV; computed as
- * SAD+Lamda*BitsUsedByMV
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - One or more of the following pointers is NULL:
- * pSrcOrgY, pSrcRefY, pSrcDstBestMV, pMVPred, pBestCost
- * - iBlockWidth or iBlockHeight are equal to values other than 4, 8, or 16.
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_BlockMatch_Quarter (
- const OMX_U8 *pSrcOrgY,
- OMX_S32 nSrcOrgStep,
- const OMX_U8 *pSrcRefY,
- OMX_S32 nSrcRefStep,
- OMX_U8 iBlockWidth,
- OMX_U8 iBlockHeight,
- OMX_U32 nLamda,
- const OMXVCMotionVector *pMVPred,
- OMXVCMotionVector *pSrcDstBestMV,
- OMX_S32 *pBestCost
-);
-
-
-
-/**
- * Function: omxVCM4P10_MotionEstimationMB (6.3.5.3.1)
- *
- * Description:
- * Performs MB-level motion estimation and selects best motion estimation
- * strategy from the set of modes supported in baseline profile [ISO14496-10].
- *
- * Input Arguments:
- *
- * pSrcCurrBuf - Pointer to the current position in original picture plane;
- * 16-byte alignment required
- * pSrcRefBufList - Pointer to an array with 16 entries. Each entry points
- * to the top-left corner of the co-located MB in a reference
- * picture. The array is filled from low-to-high with valid
- * reference frame pointers; the unused high entries should be set
- * to NULL. Ordering of the reference frames should follow
- * [ISO14496-10] subclause 8.2.4 Decoding Process for Reference
- * Picture Lists. The entries must be 16-byte aligned.
- * pSrcRecBuf - Pointer to the top-left corner of the co-located MB in the
- * reconstructed picture; must be 16-byte aligned.
- * SrcCurrStep - Width of the original picture plane in terms of full
- * pixels; must be a multiple of 16.
- * SrcRefStep - Width of the reference picture plane in terms of full
- * pixels; must be a multiple of 16.
- * SrcRecStep - Width of the reconstructed picture plane in terms of full
- * pixels; must be a multiple of 16.
- * pRefRect - Pointer to the valid reference rectangle; relative to the
- * image origin.
- * pCurrPointPos - Position of the current macroblock in the current plane.
- * Lambda - Lagrange factor for computing the cost function
- * pMESpec - Pointer to the motion estimation specification structure; must
- * have been allocated and initialized prior to calling this
- * function.
- * pMBInter - Array, of dimension four, containing pointers to information
- * associated with four adjacent type INTER MBs (Left, Top,
- * Top-Left, Top-Right). Any pointer in the array may be set equal
- * to NULL if the corresponding MB doesn t exist or is not of type
- * INTER.
- * - pMBInter[0] - Pointer to left MB information
- * - pMBInter[1] - Pointer to top MB information
- * - pMBInter[2] - Pointer to top-left MB information
- * - pMBInter[3] - Pointer to top-right MB information
- * pMBIntra - Array, of dimension four, containing pointers to information
- * associated with four adjacent type INTRA MBs (Left, Top,
- * Top-Left, Top-Right). Any pointer in the array may be set equal
- * to NULL if the corresponding MB doesn t exist or is not of type
- * INTRA.
- * - pMBIntra[0] - Pointer to left MB information
- * - pMBIntra[1] - Pointer to top MB information
- * - pMBIntra[2] - Pointer to top-left MB information
- * - pMBIntra[3] - Pointer to top-right MB information
- * pSrcDstMBCurr - Pointer to information structure for the current MB.
- * The following entries should be set prior to calling the
- * function: sliceID - the number of the slice the to which the
- * current MB belongs.
- *
- * Output Arguments:
- *
- * pDstCost - Pointer to the minimum motion cost for the current MB.
- * pDstBlockSAD - Pointer to the array of SADs for each of the sixteen luma
- * 4x4 blocks in each MB. The block SADs are in scan order for
- * each MB. For implementations that cannot compute the SAD values
- * individually, the maximum possible value (0xffff) is returned
- * for each of the 16 block SAD entries.
- * pSrcDstMBCurr - Pointer to updated information structure for the current
- * MB after MB-level motion estimation has been completed. The
- * following fields are updated by the ME function. The following
- * parameter set quantifies the MB-level ME search results:
- * - MbType
- * - subMBType[4]
- * - pMV0[4][4]
- * - pMVPred[4][4]
- * - pRefL0Idx[4]
- * - Intra16x16PredMode
- * - pIntra4x4PredMode[4][4]
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - One or more of the following pointers is NULL: pSrcCurrBuf,
- * pSrcRefBufList, pSrcRecBuf, pRefRect, pCurrPointPos, pMESpec,
- * pMBInter, pMBIntra,pSrcDstMBCurr, pDstCost, pSrcRefBufList[0]
- * - SrcRefStep, SrcRecStep are not multiples of 16
- * - iBlockWidth or iBlockHeight are values other than 4, 8, or 16.
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_MotionEstimationMB (
- const OMX_U8 *pSrcCurrBuf,
- OMX_S32 SrcCurrStep,
- const OMX_U8 *pSrcRefBufList[15],
- OMX_S32 SrcRefStep,
- const OMX_U8 *pSrcRecBuf,
- OMX_S32 SrcRecStep,
- const OMXRect *pRefRect,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- OMX_U32 Lambda,
- void *pMESpec,
- const OMXVCM4P10MBInfoPtr *pMBInter,
- const OMXVCM4P10MBInfoPtr *pMBIntra,
- OMXVCM4P10MBInfoPtr pSrcDstMBCurr,
- OMX_INT *pDstCost,
- OMX_U16 *pDstBlockSAD
-);
-
-
-
-/**
- * Function: omxVCM4P10_SAD_4x (6.3.5.4.1)
- *
- * Description:
- * This function calculates the SAD for 4x8 and 4x4 blocks.
- *
- * Input Arguments:
- *
- * pSrcOrg -Pointer to the original block; must be aligned on a 4-byte
- * boundary.
- * iStepOrg -Step of the original block buffer; must be a multiple of 4.
- * pSrcRef -Pointer to the reference block
- * iStepRef -Step of the reference block buffer
- * iHeight -Height of the block; must be equal to either 4 or 8.
- *
- * Output Arguments:
- *
- * pDstSAD -Pointer of result SAD
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - One or more of the following pointers is NULL:
- * pSrcOrg, pSrcRef, or pDstSAD
- * - iHeight is not equal to either 4 or 8.
- * - iStepOrg is not a multiple of 4
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_SAD_4x (
- const OMX_U8 *pSrcOrg,
- OMX_U32 iStepOrg,
- const OMX_U8 *pSrcRef,
- OMX_U32 iStepRef,
- OMX_S32 *pDstSAD,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_SADQuar_4x (6.3.5.4.2)
- *
- * Description:
- * This function calculates the SAD between one block (pSrc) and the average
- * of the other two (pSrcRef0 and pSrcRef1) for 4x8 or 4x4 blocks. Rounding
- * is applied according to the convention (a+b+1)>>1.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the original block; must be aligned on a 4-byte
- * boundary.
- * pSrcRef0 - Pointer to reference block 0
- * pSrcRef1 - Pointer to reference block 1
- * iSrcStep - Step of the original block buffer; must be a multiple of 4.
- * iRefStep0 - Step of reference block 0
- * iRefStep1 - Step of reference block 1
- * iHeight - Height of the block; must be equal to either 4 or 8.
- *
- * Output Arguments:
- *
- * pDstSAD - Pointer of result SAD
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - iHeight is not equal to either 4 or 8.
- * - One or more of the following pointers is NULL: pSrc, pSrcRef0,
- * pSrcRef1, pDstSAD.
- * - iSrcStep is not a multiple of 4
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_SADQuar_4x (
- const OMX_U8 *pSrc,
- const OMX_U8 *pSrcRef0,
- const OMX_U8 *pSrcRef1,
- OMX_U32 iSrcStep,
- OMX_U32 iRefStep0,
- OMX_U32 iRefStep1,
- OMX_U32 *pDstSAD,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_SADQuar_8x (6.3.5.4.3)
- *
- * Description:
- * This function calculates the SAD between one block (pSrc) and the average
- * of the other two (pSrcRef0 and pSrcRef1) for 8x16, 8x8, or 8x4 blocks.
- * Rounding is applied according to the convention (a+b+1)>>1.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the original block; must be aligned on an 8-byte
- * boundary.
- * pSrcRef0 - Pointer to reference block 0
- * pSrcRef1 - Pointer to reference block 1
- * iSrcStep - Step of the original block buffer; must be a multiple of 8.
- * iRefStep0 - Step of reference block 0
- * iRefStep1 - Step of reference block 1
- * iHeight - Height of the block; must be equal either 4, 8, or 16.
- *
- * Output Arguments:
- *
- * pDstSAD - Pointer of result SAD
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - iHeight is not equal to either 4, 8, or 16.
- * - One or more of the following pointers is NULL: pSrc, pSrcRef0,
- * pSrcRef1, pDstSAD.
- * - iSrcStep is not a multiple of 8
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_SADQuar_8x (
- const OMX_U8 *pSrc,
- const OMX_U8 *pSrcRef0,
- const OMX_U8 *pSrcRef1,
- OMX_U32 iSrcStep,
- OMX_U32 iRefStep0,
- OMX_U32 iRefStep1,
- OMX_U32 *pDstSAD,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_SADQuar_16x (6.3.5.4.4)
- *
- * Description:
- * This function calculates the SAD between one block (pSrc) and the average
- * of the other two (pSrcRef0 and pSrcRef1) for 16x16 or 16x8 blocks.
- * Rounding is applied according to the convention (a+b+1)>>1.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the original block; must be aligned on a 16-byte
- * boundary.
- * pSrcRef0 - Pointer to reference block 0
- * pSrcRef1 - Pointer to reference block 1
- * iSrcStep - Step of the original block buffer; must be a multiple of 16
- * iRefStep0 - Step of reference block 0
- * iRefStep1 - Step of reference block 1
- * iHeight - Height of the block; must be equal to either 8 or 16
- *
- * Output Arguments:
- *
- * pDstSAD -Pointer of result SAD
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - iHeight is not equal to either 8 or 16.
- * - One or more of the following pointers is NULL: pSrc, pSrcRef0,
- * pSrcRef1, pDstSAD.
- * - iSrcStep is not a multiple of 16
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_SADQuar_16x (
- const OMX_U8 *pSrc,
- const OMX_U8 *pSrcRef0,
- const OMX_U8 *pSrcRef1,
- OMX_U32 iSrcStep,
- OMX_U32 iRefStep0,
- OMX_U32 iRefStep1,
- OMX_U32 *pDstSAD,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_SATD_4x4 (6.3.5.4.5)
- *
- * Description:
- * This function calculates the sum of absolute transform differences (SATD)
- * for a 4x4 block by applying a Hadamard transform to the difference block
- * and then calculating the sum of absolute coefficient values.
- *
- * Input Arguments:
- *
- * pSrcOrg - Pointer to the original block; must be aligned on a 4-byte
- * boundary
- * iStepOrg - Step of the original block buffer; must be a multiple of 4
- * pSrcRef - Pointer to the reference block; must be aligned on a 4-byte
- * boundary
- * iStepRef - Step of the reference block buffer; must be a multiple of 4
- *
- * Output Arguments:
- *
- * pDstSAD - pointer to the resulting SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrcOrg, pSrcRef, or pDstSAD either pSrcOrg
- * - pSrcRef is not aligned on a 4-byte boundary
- * - iStepOrg <= 0 or iStepOrg is not a multiple of 4
- * - iStepRef <= 0 or iStepRef is not a multiple of 4
- *
- */
-OMXResult omxVCM4P10_SATD_4x4 (
- const OMX_U8 *pSrcOrg,
- OMX_U32 iStepOrg,
- const OMX_U8 *pSrcRef,
- OMX_U32 iStepRef,
- OMX_U32 *pDstSAD
-);
-
-
-
-/**
- * Function: omxVCM4P10_InterpolateHalfHor_Luma (6.3.5.5.1)
- *
- * Description:
- * This function performs interpolation for two horizontal 1/2-pel positions
- * (-1/2,0) and (1/2, 0) - around a full-pel position.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the top-left corner of the block used to interpolate in
- * the reconstruction frame plane.
- * iSrcStep - Step of the source buffer.
- * iDstStep - Step of the destination(interpolation) buffer; must be a
- * multiple of iWidth.
- * iWidth - Width of the current block; must be equal to either 4, 8, or 16
- * iHeight - Height of the current block; must be equal to 4, 8, or 16
- *
- * Output Arguments:
- *
- * pDstLeft -Pointer to the interpolation buffer of the left -pel position
- * (-1/2, 0)
- * If iWidth==4, 4-byte alignment required.
- * If iWidth==8, 8-byte alignment required.
- * If iWidth==16, 16-byte alignment required.
- * pDstRight -Pointer to the interpolation buffer of the right -pel
- * position (1/2, 0)
- * If iWidth==4, 4-byte alignment required.
- * If iWidth==8, 8-byte alignment required.
- * If iWidth==16, 16-byte alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrc, pDstLeft, or pDstRight
- * - iWidth or iHeight have values other than 4, 8, or 16
- * - iWidth==4 but pDstLeft and/or pDstRight is/are not aligned on a 4-byte boundary
- * - iWidth==8 but pDstLeft and/or pDstRight is/are not aligned on a 8-byte boundary
- * - iWidth==16 but pDstLeft and/or pDstRight is/are not aligned on a 16-byte boundary
- * - any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_InterpolateHalfHor_Luma (
- const OMX_U8 *pSrc,
- OMX_U32 iSrcStep,
- OMX_U8 *pDstLeft,
- OMX_U8 *pDstRight,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_InterpolateHalfVer_Luma (6.3.5.5.2)
- *
- * Description:
- * This function performs interpolation for two vertical 1/2-pel positions -
- * (0, -1/2) and (0, 1/2) - around a full-pel position.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to top-left corner of block used to interpolate in the
- * reconstructed frame plane
- * iSrcStep - Step of the source buffer.
- * iDstStep - Step of the destination (interpolation) buffer; must be a
- * multiple of iWidth.
- * iWidth - Width of the current block; must be equal to either 4, 8, or 16
- * iHeight - Height of the current block; must be equal to either 4, 8, or 16
- *
- * Output Arguments:
- *
- * pDstUp -Pointer to the interpolation buffer of the -pel position above
- * the current full-pel position (0, -1/2)
- * If iWidth==4, 4-byte alignment required.
- * If iWidth==8, 8-byte alignment required.
- * If iWidth==16, 16-byte alignment required.
- * pDstDown -Pointer to the interpolation buffer of the -pel position below
- * the current full-pel position (0, 1/2)
- * If iWidth==4, 4-byte alignment required.
- * If iWidth==8, 8-byte alignment required.
- * If iWidth==16, 16-byte alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrc, pDstUp, or pDstDown
- * - iWidth or iHeight have values other than 4, 8, or 16
- * - iWidth==4 but pDstUp and/or pDstDown is/are not aligned on a 4-byte boundary
- * - iWidth==8 but pDstUp and/or pDstDown is/are not aligned on a 8-byte boundary
- * - iWidth==16 but pDstUp and/or pDstDown is/are not aligned on a 16-byte boundary
- *
- */
-OMXResult omxVCM4P10_InterpolateHalfVer_Luma (
- const OMX_U8 *pSrc,
- OMX_U32 iSrcStep,
- OMX_U8 *pDstUp,
- OMX_U8 *pDstDown,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_Average_4x (6.3.5.5.3)
- *
- * Description:
- * This function calculates the average of two 4x4, 4x8 blocks. The result
- * is rounded according to (a+b+1)/2.
- *
- * Input Arguments:
- *
- * pPred0 - Pointer to the top-left corner of reference block 0
- * pPred1 - Pointer to the top-left corner of reference block 1
- * iPredStep0 - Step of reference block 0; must be a multiple of 4.
- * iPredStep1 - Step of reference block 1; must be a multiple of 4.
- * iDstStep - Step of the destination buffer; must be a multiple of 4.
- * iHeight - Height of the blocks; must be either 4 or 8.
- *
- * Output Arguments:
- *
- * pDstPred - Pointer to the destination buffer. 4-byte alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pPred0, pPred1, or pDstPred
- * - pDstPred is not aligned on a 4-byte boundary
- * - iPredStep0 <= 0 or iPredStep0 is not a multiple of 4
- * - iPredStep1 <= 0 or iPredStep1 is not a multiple of 4
- * - iDstStep <= 0 or iDstStep is not a multiple of 4
- * - iHeight is not equal to either 4 or 8
- *
- */
-OMXResult omxVCM4P10_Average_4x (
- const OMX_U8 *pPred0,
- const OMX_U8 *pPred1,
- OMX_U32 iPredStep0,
- OMX_U32 iPredStep1,
- OMX_U8 *pDstPred,
- OMX_U32 iDstStep,
- OMX_U32 iHeight
-);
-
-
-
-/**
- * Function: omxVCM4P10_TransformQuant_ChromaDC (6.3.5.6.1)
- *
- * Description:
- * This function performs 2x2 Hadamard transform of chroma DC coefficients
- * and then quantizes the coefficients.
- *
- * Input Arguments:
- *
- * pSrcDst - Pointer to the 2x2 array of chroma DC coefficients. 8-byte
- * alignment required.
- * iQP - Quantization parameter; must be in the range [0,51].
- * bIntra - Indicate whether this is an INTRA block. 1-INTRA, 0-INTER
- *
- * Output Arguments:
- *
- * pSrcDst - Pointer to transformed and quantized coefficients. 8-byte
- * alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrcDst
- * - pSrcDst is not aligned on an 8-byte boundary
- *
- */
-OMXResult omxVCM4P10_TransformQuant_ChromaDC (
- OMX_S16 *pSrcDst,
- OMX_U32 iQP,
- OMX_U8 bIntra
-);
-
-
-
-/**
- * Function: omxVCM4P10_TransformQuant_LumaDC (6.3.5.6.2)
- *
- * Description:
- * This function performs a 4x4 Hadamard transform of luma DC coefficients
- * and then quantizes the coefficients.
- *
- * Input Arguments:
- *
- * pSrcDst - Pointer to the 4x4 array of luma DC coefficients. 16-byte
- * alignment required.
- * iQP - Quantization parameter; must be in the range [0,51].
- *
- * Output Arguments:
- *
- * pSrcDst - Pointer to transformed and quantized coefficients. 16-byte
- * alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL: pSrcDst
- * - pSrcDst is not aligned on an 16-byte boundary
- *
- */
-OMXResult omxVCM4P10_TransformQuant_LumaDC (
- OMX_S16 *pSrcDst,
- OMX_U32 iQP
-);
-
-
-
-/**
- * Function: omxVCM4P10_InvTransformDequant_LumaDC (6.3.5.6.3)
- *
- * Description:
- * This function performs inverse 4x4 Hadamard transform and then dequantizes
- * the coefficients.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the 4x4 array of the 4x4 Hadamard-transformed and
- * quantized coefficients. 16 byte alignment required.
- * iQP - Quantization parameter; must be in the range [0,51].
- *
- * Output Arguments:
- *
- * pDst - Pointer to inverse-transformed and dequantized coefficients.
- * 16-byte alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL: pSrc
- * - pSrc or pDst is not aligned on a 16-byte boundary
- *
- */
-OMXResult omxVCM4P10_InvTransformDequant_LumaDC (
- const OMX_S16 *pSrc,
- OMX_S16 *pDst,
- OMX_U32 iQP
-);
-
-
-
-/**
- * Function: omxVCM4P10_InvTransformDequant_ChromaDC (6.3.5.6.4)
- *
- * Description:
- * This function performs inverse 2x2 Hadamard transform and then dequantizes
- * the coefficients.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the 2x2 array of the 2x2 Hadamard-transformed and
- * quantized coefficients. 8 byte alignment required.
- * iQP - Quantization parameter; must be in the range [0,51].
- *
- * Output Arguments:
- *
- * pDst - Pointer to inverse-transformed and dequantized coefficients.
- * 8-byte alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL: pSrc
- * - pSrc or pDst is not aligned on an 8-byte boundary
- *
- */
-OMXResult omxVCM4P10_InvTransformDequant_ChromaDC (
- const OMX_S16 *pSrc,
- OMX_S16 *pDst,
- OMX_U32 iQP
-);
-
-
-
-/**
- * Function: omxVCM4P10_InvTransformResidualAndAdd (6.3.5.7.1)
- *
- * Description:
- * This function performs inverse an 4x4 integer transformation to produce
- * the difference signal and then adds the difference to the prediction to get
- * the reconstructed signal.
- *
- * Input Arguments:
- *
- * pSrcPred - Pointer to prediction signal. 4-byte alignment required.
- * pDequantCoeff - Pointer to the transformed coefficients. 8-byte
- * alignment required.
- * iSrcPredStep - Step of the prediction buffer; must be a multiple of 4.
- * iDstReconStep - Step of the destination reconstruction buffer; must be a
- * multiple of 4.
- * bAC - Indicate whether there is AC coefficients in the coefficients
- * matrix.
- *
- * Output Arguments:
- *
- * pDstRecon -Pointer to the destination reconstruction buffer. 4-byte
- * alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrcPred, pDequantCoeff, pDstRecon
- * - pSrcPred is not aligned on a 4-byte boundary
- * - iSrcPredStep or iDstReconStep is not a multiple of 4.
- * - pDequantCoeff is not aligned on an 8-byte boundary
- *
- */
-OMXResult omxVCM4P10_InvTransformResidualAndAdd (
- const OMX_U8 *pSrcPred,
- const OMX_S16 *pDequantCoeff,
- OMX_U8 *pDstRecon,
- OMX_U32 iSrcPredStep,
- OMX_U32 iDstReconStep,
- OMX_U8 bAC
-);
-
-
-
-/**
- * Function: omxVCM4P10_SubAndTransformQDQResidual (6.3.5.8.1)
- *
- * Description:
- * This function subtracts the prediction signal from the original signal to
- * produce the difference signal and then performs a 4x4 integer transform and
- * quantization. The quantized transformed coefficients are stored as
- * pDstQuantCoeff. This function can also output dequantized coefficients or
- * unquantized DC coefficients optionally by setting the pointers
- * pDstDeQuantCoeff, pDCCoeff.
- *
- * Input Arguments:
- *
- * pSrcOrg - Pointer to original signal. 4-byte alignment required.
- * pSrcPred - Pointer to prediction signal. 4-byte alignment required.
- * iSrcOrgStep - Step of the original signal buffer; must be a multiple of
- * 4.
- * iSrcPredStep - Step of the prediction signal buffer; must be a multiple
- * of 4.
- * pNumCoeff -Number of non-zero coefficients after quantization. If this
- * parameter is not required, it is set to NULL.
- * nThreshSAD - Zero-block early detection threshold. If this parameter is
- * not required, it is set to 0.
- * iQP - Quantization parameter; must be in the range [0,51].
- * bIntra - Indicates whether this is an INTRA block, either 1-INTRA or
- * 0-INTER
- *
- * Output Arguments:
- *
- * pDstQuantCoeff - Pointer to the quantized transformed coefficients.
- * 8-byte alignment required.
- * pDstDeQuantCoeff - Pointer to the dequantized transformed coefficients
- * if this parameter is not equal to NULL. 8-byte alignment
- * required.
- * pDCCoeff - Pointer to the unquantized DC coefficient if this parameter
- * is not equal to NULL.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrcOrg, pSrcPred, pNumCoeff, pDstQuantCoeff,
- * pDstDeQuantCoeff, pDCCoeff
- * - pSrcOrg is not aligned on a 4-byte boundary
- * - pSrcPred is not aligned on a 4-byte boundary
- * - iSrcOrgStep is not a multiple of 4
- * - iSrcPredStep is not a multiple of 4
- * - pDstQuantCoeff or pDstDeQuantCoeff is not aligned on an 8-byte boundary
- *
- */
-OMXResult omxVCM4P10_SubAndTransformQDQResidual (
- const OMX_U8 *pSrcOrg,
- const OMX_U8 *pSrcPred,
- OMX_U32 iSrcOrgStep,
- OMX_U32 iSrcPredStep,
- OMX_S16 *pDstQuantCoeff,
- OMX_S16 *pDstDeQuantCoeff,
- OMX_S16 *pDCCoeff,
- OMX_S8 *pNumCoeff,
- OMX_U32 nThreshSAD,
- OMX_U32 iQP,
- OMX_U8 bIntra
-);
-
-
-
-/**
- * Function: omxVCM4P10_GetVLCInfo (6.3.5.9.1)
- *
- * Description:
- * This function extracts run-length encoding (RLE) information from the
- * coefficient matrix. The results are returned in an OMXVCM4P10VLCInfo
- * structure.
- *
- * Input Arguments:
- *
- * pSrcCoeff - pointer to the transform coefficient matrix. 8-byte
- * alignment required.
- * pScanMatrix - pointer to the scan order definition matrix. For a luma
- * block the scan matrix should follow [ISO14496-10] section 8.5.4,
- * and should contain the values 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13,
- * 10, 7, 11, 14, 15. For a chroma block, the scan matrix should
- * contain the values 0, 1, 2, 3.
- * bAC - indicates presence of a DC coefficient; 0 = DC coefficient
- * present, 1= DC coefficient absent.
- * MaxNumCoef - specifies the number of coefficients contained in the
- * transform coefficient matrix, pSrcCoeff. The value should be 16
- * for blocks of type LUMADC, LUMAAC, LUMALEVEL, and CHROMAAC. The
- * value should be 4 for blocks of type CHROMADC.
- *
- * Output Arguments:
- *
- * pDstVLCInfo - pointer to structure that stores information for
- * run-length coding.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrcCoeff, pScanMatrix, pDstVLCInfo
- * - pSrcCoeff is not aligned on an 8-byte boundary
- *
- */
-OMXResult omxVCM4P10_GetVLCInfo (
- const OMX_S16 *pSrcCoeff,
- const OMX_U8 *pScanMatrix,
- OMX_U8 bAC,
- OMX_U32 MaxNumCoef,
- OMXVCM4P10VLCInfo*pDstVLCInfo
-);
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /** end of #define _OMXVC_H_ */
-
-/** EOF */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/armVCCOMM_Average.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/armVCCOMM_Average.c
deleted file mode 100644
index b7b37bf..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/armVCCOMM_Average.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCCOMM_Average.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate Average of two blocks if size iWidth X iHeight
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: armVCCOMM_Average
- *
- * Description:
- * This function calculates the average of two blocks and stores the result.
- *
- * Remarks:
- *
- * [in] pPred0 Pointer to the top-left corner of reference block 0
- * [in] pPred1 Pointer to the top-left corner of reference block 1
- * [in] iPredStep0 Step of reference block 0
- * [in] iPredStep1 Step of reference block 1
- * [in] iDstStep Step of the destination buffer
- * [in] iWidth Width of the blocks
- * [in] iHeight Height of the blocks
- * [out] pDstPred Pointer to the destination buffer
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
- OMXResult armVCCOMM_Average (
- const OMX_U8* pPred0,
- const OMX_U8* pPred1,
- OMX_U32 iPredStep0,
- OMX_U32 iPredStep1,
- OMX_U8* pDstPred,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-)
-{
- OMX_U32 x, y;
-
- /* check for argument error */
- armRetArgErrIf(pPred0 == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pPred1 == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstPred == NULL, OMX_Sts_BadArgErr)
-
- for (y = 0; y < iHeight; y++)
- {
- for (x = 0; x < iWidth; x++)
- {
- pDstPred [y * iDstStep + x] =
- (OMX_U8)(((OMX_U32)pPred0 [y * iPredStep0 + x] +
- pPred1 [y * iPredStep1 + x] + 1) >> 1);
- }
- }
-
- return OMX_Sts_NoErr;
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/armVCCOMM_SAD.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/armVCCOMM_SAD.c
deleted file mode 100644
index 05b96dc..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/armVCCOMM_SAD.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCCOMM_SAD.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate SAD for NxM blocks
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-
-/**
- * Function: armVCCOMM_SAD
- *
- * Description:
- * This function calculate the SAD for NxM blocks.
- *
- * Remarks:
- *
- * [in] pSrcOrg Pointer to the original block
- * [in] iStepOrg Step of the original block buffer
- * [in] pSrcRef Pointer to the reference block
- * [in] iStepRef Step of the reference block buffer
- * [in] iHeight Height of the block
- * [in] iWidth Width of the block
- * [out] pDstSAD Pointer of result SAD
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-OMXResult armVCCOMM_SAD(
- const OMX_U8* pSrcOrg,
- OMX_U32 iStepOrg,
- const OMX_U8* pSrcRef,
- OMX_U32 iStepRef,
- OMX_S32* pDstSAD,
- OMX_U32 iHeight,
- OMX_U32 iWidth
-)
-{
- OMX_INT x, y;
-
- /* check for argument error */
- armRetArgErrIf(pSrcOrg == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pSrcRef == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstSAD == NULL, OMX_Sts_BadArgErr)
-
- *pDstSAD = 0;
- for (y = 0; y < iHeight; y++)
- {
- for (x = 0; x < iWidth; x++)
- {
- *pDstSAD += armAbs(pSrcOrg [(y * iStepOrg) + x] -
- pSrcRef [(y * iStepRef) + x]);
- }
- }
-
- return OMX_Sts_NoErr;
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_Average_16x.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_Average_16x.c
deleted file mode 100644
index 175bca8..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_Average_16x.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCCOMM_Average_16x.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate Average of two 16x16 or 16x8 blocks
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCCOMM_Average_16x (6.1.3.1.2)
- *
- * Description:
- * This function calculates the average of two 16x16 or 16x8 blocks. The
- * result is rounded according to (a+b+1)/2. The block average function can
- * be used in conjunction with half-pixel interpolation to obtain quarter
- * pixel motion estimates, as described in [ISO14496-10], subclause 8.4.2.2.1.
- *
- * Input Arguments:
- *
- * pPred0 - Pointer to the top-left corner of reference block 0
- * pPred1 - Pointer to the top-left corner of reference block 1
- * iPredStep0 - Step of reference block 0
- * iPredStep1 - Step of reference block 1
- * iDstStep - Step of the destination buffer
- * iHeight - Height of the blocks
- *
- * Output Arguments:
- *
- * pDstPred - Pointer to the destination buffer. 16-byte aligned.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - one or more of the following pointers is NULL: pPred0, pPred1, or
- * pDstPred.
- * - pDstPred is not aligned on a 16-byte boundary.
- * - iPredStep0 <= 0 or iPredStep0 is not a multiple of 16.
- * - iPredStep1 <= 0 or iPredStep1 is not a multiple of 16.
- * - iDstStep <= 0 or iDstStep is not a multiple of 16.
- * - iHeight is not 8 or 16.
- *
- */
- OMXResult omxVCCOMM_Average_16x (
- const OMX_U8* pPred0,
- const OMX_U8* pPred1,
- OMX_U32 iPredStep0,
- OMX_U32 iPredStep1,
- OMX_U8* pDstPred,
- OMX_U32 iDstStep,
- OMX_U32 iHeight
-)
-{
- /* check for argument error */
- armRetArgErrIf(pPred0 == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pPred1 == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstPred == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf((iHeight != 8) && (iHeight != 16), OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot16ByteAligned(pDstPred), OMX_Sts_BadArgErr)
- armRetArgErrIf((iPredStep0 == 0) || (iPredStep0 & 15), OMX_Sts_BadArgErr)
- armRetArgErrIf((iPredStep1 == 0) || (iPredStep1 & 15), OMX_Sts_BadArgErr)
- armRetArgErrIf((iDstStep == 0) || (iDstStep & 15), OMX_Sts_BadArgErr)
-
- return armVCCOMM_Average
- (pPred0, pPred1, iPredStep0, iPredStep1, pDstPred, iDstStep, 16, iHeight);
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_Average_8x.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_Average_8x.c
deleted file mode 100644
index 2c14f43..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_Average_8x.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCCOMM_Average_8x.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate Average of two 8x4 or 8x8 or 8x16 blocks
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCCOMM_Average_8x (6.1.3.1.1)
- *
- * Description:
- * This function calculates the average of two 8x4, 8x8, or 8x16 blocks. The
- * result is rounded according to (a+b+1)/2. The block average function can
- * be used in conjunction with half-pixel interpolation to obtain quarter
- * pixel motion estimates, as described in [ISO14496-10], subclause 8.4.2.2.1.
- *
- * Input Arguments:
- *
- * pPred0 - Pointer to the top-left corner of reference block 0
- * pPred1 - Pointer to the top-left corner of reference block 1
- * iPredStep0 - Step of reference block 0
- * iPredStep1 - Step of reference block 1
- * iDstStep - Step of the destination buffer.
- * iHeight - Height of the blocks
- *
- * Output Arguments:
- *
- * pDstPred - Pointer to the destination buffer. 8-byte aligned.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - one or more of the following pointers is NULL: pPred0, pPred1, or
- * pDstPred.
- * - pDstPred is not aligned on an 8-byte boundary.
- * - iPredStep0 <= 0 or iPredStep0 is not a multiple of 8.
- * - iPredStep1 <= 0 or iPredStep1 is not a multiple of 8.
- * - iDstStep <= 0 or iDstStep is not a multiple of 8.
- * - iHeight is not 4, 8, or 16.
- *
- */
- OMXResult omxVCCOMM_Average_8x (
- const OMX_U8* pPred0,
- const OMX_U8* pPred1,
- OMX_U32 iPredStep0,
- OMX_U32 iPredStep1,
- OMX_U8* pDstPred,
- OMX_U32 iDstStep,
- OMX_U32 iHeight
-)
-{
- /* check for argument error */
- armRetArgErrIf(pPred0 == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pPred1 == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstPred == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf((iPredStep0 == 0) || (iPredStep0 & 7), OMX_Sts_BadArgErr)
- armRetArgErrIf((iPredStep1 == 0) || (iPredStep1 & 7), OMX_Sts_BadArgErr)
- armRetArgErrIf((iDstStep == 0) || (iDstStep & 7), OMX_Sts_BadArgErr)
- armRetArgErrIf((iHeight != 4) && (iHeight != 8) && (iHeight != 16), OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot8ByteAligned(pDstPred), OMX_Sts_BadArgErr)
-
- return armVCCOMM_Average
- (pPred0, pPred1, iPredStep0, iPredStep1, pDstPred, iDstStep, 8, iHeight);
-}
-
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_ComputeTextureErrorBlock.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_ComputeTextureErrorBlock.c
deleted file mode 100644
index a1f5240..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_ComputeTextureErrorBlock.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCCOMM_ComputeTextureErrorBlock.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains module computing the error for a MB of size 8x8
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: omxVCCOMM_ComputeTextureErrorBlock (6.1.4.1.2)
- *
- * Description:
- * Computes the texture error of the block.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the source plane. This should be aligned on an 8-byte
- * boundary.
- * srcStep - step of the source plane
- * pSrcRef - pointer to the reference buffer, an 8x8 block. This should be
- * aligned on an 8-byte boundary.
- *
- * Output Arguments:
- *
- * pDst - pointer to the destination buffer, an 8x8 block. This should be
- * aligned on an 8-byte boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - At least one of the following pointers is NULL:
- * pSrc, pSrcRef, pDst.
- * - pSrc is not 8-byte aligned.
- * - SrcStep <= 0 or srcStep is not a multiple of 8.
- * - pSrcRef is not 8-byte aligned.
- * - pDst is not 8-byte aligned
- *
- */
-
-OMXResult omxVCCOMM_ComputeTextureErrorBlock(
- const OMX_U8 *pSrc,
- OMX_INT srcStep,
- const OMX_U8 *pSrcRef,
- OMX_S16 * pDst
-)
-{
-
- OMX_INT x, y, count;
-
- /* Argument error checks */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcRef == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs8ByteAligned(pSrc), OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs8ByteAligned(pSrcRef), OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs8ByteAligned(pDst), OMX_Sts_BadArgErr);
- armRetArgErrIf((srcStep <= 0) || (srcStep & 7), OMX_Sts_BadArgErr);
-
- /* Calculate the error block */
- for (y = 0, count = 0;
- y < 8;
- y++, pSrc += srcStep)
- {
- for (x = 0; x < 8; x++, count++)
- {
- pDst[count] = pSrc[x] - pSrcRef[count];
- }
- }
-
- return OMX_Sts_NoErr;
-
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_ComputeTextureErrorBlock_SAD.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_ComputeTextureErrorBlock_SAD.c
deleted file mode 100644
index a7f48c9..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_ComputeTextureErrorBlock_SAD.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCCOMM_ComputeTextureErrorBlock_SAD.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains module computing the error for a MB of size 8x8
- *
- */
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-
-
-/**
- * Function: omxVCCOMM_ComputeTextureErrorBlock_SAD (6.1.4.1.1)
- *
- * Description:
- * Computes texture error of the block; also returns SAD.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the source plane; must be aligned on an 8-byte
- * boundary.
- * srcStep - step of the source plane
- * pSrcRef - pointer to the reference buffer, an 8x8 block; must be aligned
- * on an 8-byte boundary.
- *
- * Output Arguments:
- *
- * pDst - pointer to the destination buffer, an 8x8 block; must be aligned
- * on an 8-byte boundary.
- * pDstSAD - pointer to the Sum of Absolute Differences (SAD) value
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - At least one of the following
- * pointers is NULL: pSrc, pSrcRef, pDst and pDstSAD.
- * - pSrc is not 8-byte aligned.
- * - SrcStep <= 0 or srcStep is not a multiple of 8.
- * - pSrcRef is not 8-byte aligned.
- * - pDst is not 8-byte aligned.
- *
- */
-
-OMXResult omxVCCOMM_ComputeTextureErrorBlock_SAD(
- const OMX_U8 *pSrc,
- OMX_INT srcStep,
- const OMX_U8 *pSrcRef,
- OMX_S16 * pDst,
- OMX_INT *pDstSAD
-)
-{
-
- OMX_INT x, y, count;
-
- /* Argument error checks */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcRef == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDstSAD == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs8ByteAligned(pSrc), OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs8ByteAligned(pSrcRef), OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs8ByteAligned(pDst), OMX_Sts_BadArgErr);
- armRetArgErrIf((srcStep <= 0) || (srcStep & 7), OMX_Sts_BadArgErr);
-
- /* Calculate the error block */
- for (y = 0, count = 0, *pDstSAD = 0;
- y < 8;
- y++, pSrc += srcStep)
- {
- for (x = 0; x < 8; x++, count++)
- {
- pDst[count] = pSrc[x] - pSrcRef[count];
- *pDstSAD += armAbs(pDst[count]);
- }
- }
-
- return OMX_Sts_NoErr;
-
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_Copy16x16.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_Copy16x16.c
deleted file mode 100644
index 8e467a4..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_Copy16x16.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCCOMM_Copy16x16.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * MPEG4 16x16 Copy module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-
-/**
- * Function: omxVCCOMM_Copy16x16 (6.1.3.3.2)
- *
- * Description:
- * Copies the reference 16x16 macroblock to the current macroblock.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the reference macroblock in the source frame; must be
- * aligned on a 16-byte boundary.
- * step - distance between the starts of consecutive lines in the reference
- * frame, in bytes; must be a multiple of 16 and must be larger
- * than or equal to 16.
- *
- * Output Arguments:
- *
- * pDst - pointer to the destination macroblock; must be aligned on a
- * 16-byte boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - one or more of the following pointers is NULL: pSrc, pDst
- * - one or more of the following pointers is not aligned on a 16-byte
- * boundary: pSrc, pDst
- * - step <16 or step is not a multiple of 16.
- *
- */
-
-OMXResult omxVCCOMM_Copy16x16(
- const OMX_U8 *pSrc,
- OMX_U8 *pDst,
- OMX_INT step)
- {
- /* Definitions and Initializations*/
-
- OMX_INT count,index, x, y;
-
- /* Argument error checks */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs16ByteAligned(pSrc), OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs16ByteAligned(pDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(((step < 16) || (step % 16)), OMX_Sts_BadArgErr);
-
-
- /* Copying the ref 16x16 blk to the curr blk */
- for (y = 0, count = 0, index = 0; y < 16; y++, count = count + step - 16)
- {
- for (x = 0; x < 16; x++, count++, index++)
- {
- pDst[index] = pSrc[count];
- }
- }
- return OMX_Sts_NoErr;
- }
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_Copy8x8.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_Copy8x8.c
deleted file mode 100644
index 3f5969b..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_Copy8x8.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCCOMM_Copy8x8.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * MPEG4 8x8 Copy module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-
-/**
- * Function: omxVCCOMM_Copy8x8 (6.1.3.3.1)
- *
- * Description:
- * Copies the reference 8x8 block to the current block.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the reference block in the source frame; must be
- * aligned on an 8-byte boundary.
- * step - distance between the starts of consecutive lines in the reference
- * frame, in bytes; must be a multiple of 8 and must be larger than
- * or equal to 8.
- *
- * Output Arguments:
- *
- * pDst - pointer to the destination block; must be aligned on an 8-byte
- * boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - one or more of the following pointers is NULL: pSrc, pDst
- * - one or more of the following pointers is not aligned on an 8-byte
- * boundary: pSrc, pDst
- * - step <8 or step is not a multiple of 8.
- *
- */
-
-OMXResult omxVCCOMM_Copy8x8(
- const OMX_U8 *pSrc,
- OMX_U8 *pDst,
- OMX_INT step)
- {
- /* Definitions and Initializations*/
-
- OMX_INT count,index, x, y;
-
- /* Argument error checks */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs8ByteAligned(pSrc), OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs8ByteAligned(pDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(((step < 8) || (step % 8)), OMX_Sts_BadArgErr);
-
-
- /* Copying the ref 8x8 blk to the curr blk */
- for (y = 0, count = 0, index = 0; y < 8; y++, count = count + step - 8)
- {
- for (x = 0; x < 8; x++, count++, index++)
- {
- pDst[index] = pSrc[count];
- }
- }
- return OMX_Sts_NoErr;
- }
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_ExpandFrame_I.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_ExpandFrame_I.c
deleted file mode 100644
index 5379fd0..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_ExpandFrame_I.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCCOMM_ExpandFrame_I.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will Expand Frame boundary pixels into Plane
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-
-/**
- * Function: omxVCCOMM_ExpandFrame_I (6.1.3.2.1)
- *
- * Description:
- * This function expands a reconstructed frame in-place. The unexpanded
- * source frame should be stored in a plane buffer with sufficient space
- * pre-allocated for edge expansion, and the input frame should be located in
- * the plane buffer center. This function executes the pixel expansion by
- * replicating source frame edge pixel intensities in the empty pixel
- * locations (expansion region) between the source frame edge and the plane
- * buffer edge. The width/height of the expansion regions on the
- * horizontal/vertical edges is controlled by the parameter iExpandPels.
- *
- * Input Arguments:
- *
- * pSrcDstPlane - pointer to the top-left corner of the frame to be
- * expanded; must be aligned on an 8-byte boundary.
- * iFrameWidth - frame width; must be a multiple of 8.
- * iFrameHeight -frame height; must be a multiple of 8.
- * iExpandPels - number of pixels to be expanded in the horizontal and
- * vertical directions; must be a multiple of 8.
- * iPlaneStep - distance, in bytes, between the start of consecutive lines
- * in the plane buffer; must be larger than or equal to
- * (iFrameWidth + 2 * iExpandPels).
- *
- * Output Arguments:
- *
- * pSrcDstPlane -Pointer to the top-left corner of the frame (NOT the
- * top-left corner of the plane); must be aligned on an 8-byte
- * boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - pSrcDstPlane is NULL.
- * - pSrcDstPlane is not aligned on an 8-byte boundary.
- * - one of the following parameters is either equal to zero or is a
- * non-multiple of 8: iFrameHeight, iFrameWidth, iPlaneStep, or
- * iExpandPels.
- * - iPlaneStep < (iFrameWidth + 2 * iExpandPels).
- *
- */
-OMXResult omxVCCOMM_ExpandFrame_I(
- OMX_U8* pSrcDstPlane,
- OMX_U32 iFrameWidth,
- OMX_U32 iFrameHeight,
- OMX_U32 iExpandPels,
- OMX_U32 iPlaneStep
-)
-{
- OMX_INT x, y;
- OMX_U8* pLeft;
- OMX_U8* pRight;
- OMX_U8* pTop;
- OMX_U8* pBottom;
-
- /* check for argument error */
- armRetArgErrIf(pSrcDstPlane == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot8ByteAligned(pSrcDstPlane), OMX_Sts_BadArgErr)
- armRetArgErrIf(iFrameWidth == 0 || iFrameWidth & 7, OMX_Sts_BadArgErr)
- armRetArgErrIf(iFrameHeight== 0 || iFrameHeight & 7, OMX_Sts_BadArgErr)
- armRetArgErrIf(iExpandPels == 0 || iExpandPels & 7, OMX_Sts_BadArgErr)
- armRetArgErrIf(iPlaneStep == 0 || iPlaneStep & 7, OMX_Sts_BadArgErr)
- armRetArgErrIf(iPlaneStep < (iFrameWidth + 2 * iExpandPels),
- OMX_Sts_BadArgErr)
-
- /* Top and Bottom */
- pTop = pSrcDstPlane - (iExpandPels * iPlaneStep);
- pBottom = pSrcDstPlane + (iFrameHeight * iPlaneStep);
-
- for (y = 0; y < (OMX_INT)iExpandPels; y++)
- {
- for (x = 0; x < (OMX_INT)iFrameWidth; x++)
- {
- pTop [y * iPlaneStep + x] =
- pSrcDstPlane [x];
- pBottom [y * iPlaneStep + x] =
- pSrcDstPlane [(iFrameHeight - 1) * iPlaneStep + x];
- }
- }
-
- /* Left, Right and Corners */
- pLeft = pSrcDstPlane - iExpandPels;
- pRight = pSrcDstPlane + iFrameWidth;
-
- for (y = -(OMX_INT)iExpandPels; y < (OMX_INT)(iFrameHeight + iExpandPels); y++)
- {
- for (x = 0; x < (OMX_INT)iExpandPels; x++)
- {
- pLeft [y * iPlaneStep + x] =
- pSrcDstPlane [y * iPlaneStep + 0];
- pRight [y * iPlaneStep + x] =
- pSrcDstPlane [y * iPlaneStep + (iFrameWidth - 1)];
- }
- }
-
- return OMX_Sts_NoErr;
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_LimitMVToRect.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_LimitMVToRect.c
deleted file mode 100644
index 9ba9093..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_LimitMVToRect.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCCOMM_LimitMVToRect.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains module for limiting the MV
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-
-/**
- * Function: omxVCCOMM_LimitMVToRect (6.1.4.1.3)
- *
- * Description:
- * Limits the motion vector associated with the current block/macroblock to
- * prevent the motion compensated block/macroblock from moving outside a
- * bounding rectangle as shown in Figure 6-1.
- *
- * Input Arguments:
- *
- * pSrcMV - pointer to the motion vector associated with the current block
- * or macroblock
- * pRectVOPRef - pointer to the bounding rectangle
- * Xcoord, Ycoord - coordinates of the current block or macroblock
- * size - size of the current block or macroblock; must be equal to 8 or
- * 16.
- *
- * Output Arguments:
- *
- * pDstMV - pointer to the limited motion vector
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one or more of the
- * following conditions is true:
- * - at least one of the following pointers is NULL:
- * pSrcMV, pDstMV, or pRectVOPRef.
- * - size is not equal to either 8 or 16.
- * - the width or height of the bounding rectangle is less than
- * twice the block size.
- */
-OMXResult omxVCCOMM_LimitMVToRect(
- const OMXVCMotionVector * pSrcMV,
- OMXVCMotionVector *pDstMV,
- const OMXRect * pRectVOPRef,
- OMX_INT Xcoord,
- OMX_INT Ycoord,
- OMX_INT size
-)
-{
- /* Argument error checks */
- armRetArgErrIf(pSrcMV == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDstMV == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pRectVOPRef == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf((size != 8) && (size != 16), OMX_Sts_BadArgErr);
- armRetArgErrIf((pRectVOPRef->width < (2* size)), OMX_Sts_BadArgErr);
- armRetArgErrIf((pRectVOPRef->height < (2* size)), OMX_Sts_BadArgErr);
-
- pDstMV->dx = armMin (armMax (pSrcMV->dx, 2*pRectVOPRef->x - Xcoord),
- (2*pRectVOPRef->x + pRectVOPRef->width - Xcoord - size));
- pDstMV->dy = armMin (armMax (pSrcMV->dy, 2*pRectVOPRef->y - Ycoord),
- (2*pRectVOPRef->y + pRectVOPRef->height - Ycoord - size));
-
-
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_SAD_16x.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_SAD_16x.c
deleted file mode 100644
index 83dbbd0..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_SAD_16x.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCCOMM_SAD_16x.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate SAD for 16x16 and 16x8 blocks
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: omxVCCOMM_SAD_16x (6.1.4.1.4)
- *
- * Description:
- * This function calculates the SAD for 16x16 and 16x8 blocks.
- *
- * Input Arguments:
- *
- * pSrcOrg - Pointer to the original block; must be aligned on a 16-byte
- * boundary.
- * iStepOrg - Step of the original block buffer
- * pSrcRef - Pointer to the reference block
- * iStepRef - Step of the reference block buffer
- * iHeight - Height of the block
- *
- * Output Arguments:
- *
- * pDstSAD - Pointer of result SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one or more of the
- * following conditions is true:
- * - at least one of the following pointers is NULL:
- * pSrcOrg, pDstSAD, or pSrcRef
- * - pSrcOrg is not 16-byte aligned.
- * - iStepOrg <= 0 or iStepOrg is not a multiple of 16
- * - iStepRef <= 0 or iStepRef is not a multiple of 16
- * - iHeight is not 8 or 16
- *
- */
-OMXResult omxVCCOMM_SAD_16x(
- const OMX_U8* pSrcOrg,
- OMX_U32 iStepOrg,
- const OMX_U8* pSrcRef,
- OMX_U32 iStepRef,
- OMX_S32* pDstSAD,
- OMX_U32 iHeight
-)
-{
- /* check for argument error */
- armRetArgErrIf(pSrcOrg == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pSrcRef == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstSAD == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf((iHeight != 16) && (iHeight != 8), OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot16ByteAligned(pSrcOrg), OMX_Sts_BadArgErr)
- armRetArgErrIf((iStepOrg == 0) || (iStepOrg & 15), OMX_Sts_BadArgErr)
- armRetArgErrIf((iStepRef == 0) || (iStepRef & 15), OMX_Sts_BadArgErr)
-
- return armVCCOMM_SAD
- (pSrcOrg, iStepOrg, pSrcRef, iStepRef, pDstSAD, iHeight, 16);
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_SAD_8x.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_SAD_8x.c
deleted file mode 100644
index 7bfd1ec..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/comm/src/omxVCCOMM_SAD_8x.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCCOMM_SAD_8x.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate SAD for 8x16, 8x8, 8x4 blocks
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: omxVCCOMM_SAD_8x (6.1.4.1.5)
- *
- * Description:
- * This function calculates the SAD for 8x16, 8x8, 8x4 blocks.
- *
- * Input Arguments:
- *
- * pSrcOrg - Pointer to the original block; must be aligned on a 8-byte
- * boundary.
- * iStepOrg - Step of the original block buffer
- * pSrcRef - Pointer to the reference block
- * iStepRef - Step of the reference block buffer
- * iHeight - Height of the block
- *
- * Output Arguments:
- *
- * pDstSAD -Pointer of result SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one or more of the
- * following conditions is true:
- * - at least one of the following pointers is NULL:
- * pSrcOrg, pDstSAD, or pSrcRef
- * - pSrcOrg is not 8-byte aligned.
- * - iStepOrg <= 0 or iStepOrg is not a multiple of 8
- * - iStepRef <= 0 or iStepRef is not a multiple of 8
- * - iHeight is not 4, 8 or 16
- *
- */
-OMXResult omxVCCOMM_SAD_8x(
- const OMX_U8* pSrcOrg,
- OMX_U32 iStepOrg,
- const OMX_U8* pSrcRef,
- OMX_U32 iStepRef,
- OMX_S32* pDstSAD,
- OMX_U32 iHeight
-)
-{
- /* check for argument error */
- armRetArgErrIf(pSrcOrg == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pSrcRef == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstSAD == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf((iHeight != 16) && (iHeight != 8) && (iHeight != 4), OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot8ByteAligned(pSrcOrg), OMX_Sts_BadArgErr)
- armRetArgErrIf((iStepOrg == 0) || (iStepOrg & 7), OMX_Sts_BadArgErr)
- armRetArgErrIf((iStepRef == 0) || (iStepRef & 7), OMX_Sts_BadArgErr)
-
- return armVCCOMM_SAD
- (pSrcOrg, iStepOrg, pSrcRef, iStepRef, pDstSAD, iHeight, 8);
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/api/armVCM4P10_CAVLCTables.h b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/api/armVCM4P10_CAVLCTables.h
deleted file mode 100644
index 37241ca..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/api/armVCM4P10_CAVLCTables.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: armVCM4P10_CAVLCTables.h
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * ----------------------------------------------------------------
- * File: armVCM4P10_CAVLCTables.h
- * ----------------------------------------------------------------
- *
- * Header file for ARM implementation of OpenMAX VCM4P10
- *
- */
-
-#ifndef ARMVCM4P10_CAVLCTABLES_H
-#define ARMVCM4P10_CAVLCTABLES_H
-
-/* CAVLC tables */
-
-extern const OMX_U8 armVCM4P10_CAVLCTrailingOnes[62];
-extern const OMX_U8 armVCM4P10_CAVLCTotalCoeff[62];
-extern const ARM_VLC32 *armVCM4P10_CAVLCCoeffTokenTables[5];
-extern const ARM_VLC32 armVCM4P10_CAVLCLevelPrefix[17];
-extern const ARM_VLC32 *armVCM4P10_CAVLCTotalZeroTables[15];
-extern const ARM_VLC32 *armVCM4P10_CAVLCTotalZeros2x2Tables[3];
-extern const ARM_VLC32 *armVCM4P10_CAVLCRunBeforeTables[7];
-
-#endif
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_CAVLCTables.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_CAVLCTables.c
deleted file mode 100644
index c4a3074..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_CAVLCTables.c
+++ /dev/null
@@ -1,718 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: armVCM4P10_CAVLCTables.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * CAVLC tables for H.264
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM_Bitstream.h"
-#include "armVC.h"
-#include "armVCM4P10_CAVLCTables.h"
-
-/* Tables mapping a code to TrailingOnes and TotalCoeff */
-
-const OMX_U8 armVCM4P10_CAVLCTrailingOnes[62] = {
- 0,
- 0, 1,
- 0, 1, 2,
- 0, 1, 2, 3,
- 0, 1, 2, 3,
- 0, 1, 2, 3,
- 0, 1, 2, 3,
- 0, 1, 2, 3,
- 0, 1, 2, 3,
- 0, 1, 2, 3,
- 0, 1, 2, 3,
- 0, 1, 2, 3,
- 0, 1, 2, 3,
- 0, 1, 2, 3,
- 0, 1, 2, 3,
- 0, 1, 2, 3,
- 0, 1, 2, 3
-};
-
-const OMX_U8 armVCM4P10_CAVLCTotalCoeff[62] = {
- 0,
- 1, 1,
- 2, 2, 2,
- 3, 3, 3, 3,
- 4, 4, 4, 4,
- 5, 5, 5, 5,
- 6, 6, 6, 6,
- 7, 7, 7, 7,
- 8, 8, 8, 8,
- 9, 9, 9, 9,
- 10, 10, 10, 10,
- 11, 11, 11, 11,
- 12, 12, 12, 12,
- 13, 13, 13, 13,
- 14, 14, 14, 14,
- 15, 15, 15, 15,
- 16, 16, 16, 16
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCCoeffToken0[63] = {
- { 1, 0x0001 },
- { 6, 0x0005 },
- { 2, 0x0001 },
- { 8, 0x0007 },
- { 6, 0x0004 },
- { 3, 0x0001 },
- { 9, 0x0007 },
- { 8, 0x0006 },
- { 7, 0x0005 },
- { 5, 0x0003 },
- { 10, 0x0007 },
- { 9, 0x0006 },
- { 8, 0x0005 },
- { 6, 0x0003 },
- { 11, 0x0007 },
- { 10, 0x0006 },
- { 9, 0x0005 },
- { 7, 0x0004 },
- { 13, 0x000f },
- { 11, 0x0006 },
- { 10, 0x0005 },
- { 8, 0x0004 },
- { 13, 0x000b },
- { 13, 0x000e },
- { 11, 0x0005 },
- { 9, 0x0004 },
- { 13, 0x0008 },
- { 13, 0x000a },
- { 13, 0x000d },
- { 10, 0x0004 },
- { 14, 0x000f },
- { 14, 0x000e },
- { 13, 0x0009 },
- { 11, 0x0004 },
- { 14, 0x000b },
- { 14, 0x000a },
- { 14, 0x000d },
- { 13, 0x000c },
- { 15, 0x000f },
- { 15, 0x000e },
- { 14, 0x0009 },
- { 14, 0x000c },
- { 15, 0x000b },
- { 15, 0x000a },
- { 15, 0x000d },
- { 14, 0x0008 },
- { 16, 0x000f },
- { 15, 0x0001 },
- { 15, 0x0009 },
- { 15, 0x000c },
- { 16, 0x000b },
- { 16, 0x000e },
- { 16, 0x000d },
- { 15, 0x0008 },
- { 16, 0x0007 },
- { 16, 0x000a },
- { 16, 0x0009 },
- { 16, 0x000c },
- { 16, 0x0004 },
- { 16, 0x0006 },
- { 16, 0x0005 },
- { 16, 0x0008 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCCoeffToken1[63] = {
- { 2, 0x0003 },
- { 6, 0x000b },
- { 2, 0x0002 },
- { 6, 0x0007 },
- { 5, 0x0007 },
- { 3, 0x0003 },
- { 7, 0x0007 },
- { 6, 0x000a },
- { 6, 0x0009 },
- { 4, 0x0005 },
- { 8, 0x0007 },
- { 6, 0x0006 },
- { 6, 0x0005 },
- { 4, 0x0004 },
- { 8, 0x0004 },
- { 7, 0x0006 },
- { 7, 0x0005 },
- { 5, 0x0006 },
- { 9, 0x0007 },
- { 8, 0x0006 },
- { 8, 0x0005 },
- { 6, 0x0008 },
- { 11, 0x000f },
- { 9, 0x0006 },
- { 9, 0x0005 },
- { 6, 0x0004 },
- { 11, 0x000b },
- { 11, 0x000e },
- { 11, 0x000d },
- { 7, 0x0004 },
- { 12, 0x000f },
- { 11, 0x000a },
- { 11, 0x0009 },
- { 9, 0x0004 },
- { 12, 0x000b },
- { 12, 0x000e },
- { 12, 0x000d },
- { 11, 0x000c },
- { 12, 0x0008 },
- { 12, 0x000a },
- { 12, 0x0009 },
- { 11, 0x0008 },
- { 13, 0x000f },
- { 13, 0x000e },
- { 13, 0x000d },
- { 12, 0x000c },
- { 13, 0x000b },
- { 13, 0x000a },
- { 13, 0x0009 },
- { 13, 0x000c },
- { 13, 0x0007 },
- { 14, 0x000b },
- { 13, 0x0006 },
- { 13, 0x0008 },
- { 14, 0x0009 },
- { 14, 0x0008 },
- { 14, 0x000a },
- { 13, 0x0001 },
- { 14, 0x0007 },
- { 14, 0x0006 },
- { 14, 0x0005 },
- { 14, 0x0004 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCCoeffToken2[63] = {
- { 4, 0x000f },
- { 6, 0x000f },
- { 4, 0x000e },
- { 6, 0x000b },
- { 5, 0x000f },
- { 4, 0x000d },
- { 6, 0x0008 },
- { 5, 0x000c },
- { 5, 0x000e },
- { 4, 0x000c },
- { 7, 0x000f },
- { 5, 0x000a },
- { 5, 0x000b },
- { 4, 0x000b },
- { 7, 0x000b },
- { 5, 0x0008 },
- { 5, 0x0009 },
- { 4, 0x000a },
- { 7, 0x0009 },
- { 6, 0x000e },
- { 6, 0x000d },
- { 4, 0x0009 },
- { 7, 0x0008 },
- { 6, 0x000a },
- { 6, 0x0009 },
- { 4, 0x0008 },
- { 8, 0x000f },
- { 7, 0x000e },
- { 7, 0x000d },
- { 5, 0x000d },
- { 8, 0x000b },
- { 8, 0x000e },
- { 7, 0x000a },
- { 6, 0x000c },
- { 9, 0x000f },
- { 8, 0x000a },
- { 8, 0x000d },
- { 7, 0x000c },
- { 9, 0x000b },
- { 9, 0x000e },
- { 8, 0x0009 },
- { 8, 0x000c },
- { 9, 0x0008 },
- { 9, 0x000a },
- { 9, 0x000d },
- { 8, 0x0008 },
- { 10, 0x000d },
- { 9, 0x0007 },
- { 9, 0x0009 },
- { 9, 0x000c },
- { 10, 0x0009 },
- { 10, 0x000c },
- { 10, 0x000b },
- { 10, 0x000a },
- { 10, 0x0005 },
- { 10, 0x0008 },
- { 10, 0x0007 },
- { 10, 0x0006 },
- { 10, 0x0001 },
- { 10, 0x0004 },
- { 10, 0x0003 },
- { 10, 0x0002 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCCoeffToken3[63] = {
- { 6, 0x0003 },
- { 6, 0x0000 },
- { 6, 0x0001 },
- { 6, 0x0004 },
- { 6, 0x0005 },
- { 6, 0x0006 },
- { 6, 0x0008 },
- { 6, 0x0009 },
- { 6, 0x000a },
- { 6, 0x000b },
- { 6, 0x000c },
- { 6, 0x000d },
- { 6, 0x000e },
- { 6, 0x000f },
- { 6, 0x0010 },
- { 6, 0x0011 },
- { 6, 0x0012 },
- { 6, 0x0013 },
- { 6, 0x0014 },
- { 6, 0x0015 },
- { 6, 0x0016 },
- { 6, 0x0017 },
- { 6, 0x0018 },
- { 6, 0x0019 },
- { 6, 0x001a },
- { 6, 0x001b },
- { 6, 0x001c },
- { 6, 0x001d },
- { 6, 0x001e },
- { 6, 0x001f },
- { 6, 0x0020 },
- { 6, 0x0021 },
- { 6, 0x0022 },
- { 6, 0x0023 },
- { 6, 0x0024 },
- { 6, 0x0025 },
- { 6, 0x0026 },
- { 6, 0x0027 },
- { 6, 0x0028 },
- { 6, 0x0029 },
- { 6, 0x002a },
- { 6, 0x002b },
- { 6, 0x002c },
- { 6, 0x002d },
- { 6, 0x002e },
- { 6, 0x002f },
- { 6, 0x0030 },
- { 6, 0x0031 },
- { 6, 0x0032 },
- { 6, 0x0033 },
- { 6, 0x0034 },
- { 6, 0x0035 },
- { 6, 0x0036 },
- { 6, 0x0037 },
- { 6, 0x0038 },
- { 6, 0x0039 },
- { 6, 0x003a },
- { 6, 0x003b },
- { 6, 0x003c },
- { 6, 0x003d },
- { 6, 0x003e },
- { 6, 0x003f },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCCoeffToken4[15] = {
- { 2, 0x0001 },
- { 6, 0x0007 },
- { 1, 0x0001 },
- { 6, 0x0004 },
- { 6, 0x0006 },
- { 3, 0x0001 },
- { 6, 0x0003 },
- { 7, 0x0003 },
- { 7, 0x0002 },
- { 6, 0x0005 },
- { 6, 0x0002 },
- { 8, 0x0003 },
- { 8, 0x0002 },
- { 7, 0x0000 },
- { 0, 0x0000 }
-};
-
-
-const ARM_VLC32 *armVCM4P10_CAVLCCoeffTokenTables[5] = {
- armVCM4P10_CAVLCCoeffToken0,
- armVCM4P10_CAVLCCoeffToken1,
- armVCM4P10_CAVLCCoeffToken2,
- armVCM4P10_CAVLCCoeffToken3,
- armVCM4P10_CAVLCCoeffToken4
-};
-
-/* Table for level_prefix */
-
-const ARM_VLC32 armVCM4P10_CAVLCLevelPrefix[17] = {
- { 1, 1},
- { 2, 1},
- { 3, 1},
- { 4, 1},
- { 5, 1},
- { 6, 1},
- { 7, 1},
- { 8, 1},
- { 9, 1},
- { 10, 1},
- { 11, 1},
- { 12, 1},
- { 13, 1},
- { 14, 1},
- { 15, 1},
- { 16, 1},
- { 0, 0}
-};
-
-/* Tables for total_zeros */
-
-static const ARM_VLC32 armVCM4P10_CAVLCTotalZeros1[17] = {
- { 1, 0x0001 },
- { 3, 0x0003 },
- { 3, 0x0002 },
- { 4, 0x0003 },
- { 4, 0x0002 },
- { 5, 0x0003 },
- { 5, 0x0002 },
- { 6, 0x0003 },
- { 6, 0x0002 },
- { 7, 0x0003 },
- { 7, 0x0002 },
- { 8, 0x0003 },
- { 8, 0x0002 },
- { 9, 0x0003 },
- { 9, 0x0002 },
- { 9, 0x0001 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCTotalZeros2[16] = {
- { 3, 0x0007 },
- { 3, 0x0006 },
- { 3, 0x0005 },
- { 3, 0x0004 },
- { 3, 0x0003 },
- { 4, 0x0005 },
- { 4, 0x0004 },
- { 4, 0x0003 },
- { 4, 0x0002 },
- { 5, 0x0003 },
- { 5, 0x0002 },
- { 6, 0x0003 },
- { 6, 0x0002 },
- { 6, 0x0001 },
- { 6, 0x0000 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCTotalZeros3[15] = {
- { 4, 0x0005 },
- { 3, 0x0007 },
- { 3, 0x0006 },
- { 3, 0x0005 },
- { 4, 0x0004 },
- { 4, 0x0003 },
- { 3, 0x0004 },
- { 3, 0x0003 },
- { 4, 0x0002 },
- { 5, 0x0003 },
- { 5, 0x0002 },
- { 6, 0x0001 },
- { 5, 0x0001 },
- { 6, 0x0000 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCTotalZeros4[14] = {
- { 5, 0x0003 },
- { 3, 0x0007 },
- { 4, 0x0005 },
- { 4, 0x0004 },
- { 3, 0x0006 },
- { 3, 0x0005 },
- { 3, 0x0004 },
- { 4, 0x0003 },
- { 3, 0x0003 },
- { 4, 0x0002 },
- { 5, 0x0002 },
- { 5, 0x0001 },
- { 5, 0x0000 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCTotalZeros5[13] = {
- { 4, 0x0005 },
- { 4, 0x0004 },
- { 4, 0x0003 },
- { 3, 0x0007 },
- { 3, 0x0006 },
- { 3, 0x0005 },
- { 3, 0x0004 },
- { 3, 0x0003 },
- { 4, 0x0002 },
- { 5, 0x0001 },
- { 4, 0x0001 },
- { 5, 0x0000 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCTotalZeros6[12] = {
- { 6, 0x0001 },
- { 5, 0x0001 },
- { 3, 0x0007 },
- { 3, 0x0006 },
- { 3, 0x0005 },
- { 3, 0x0004 },
- { 3, 0x0003 },
- { 3, 0x0002 },
- { 4, 0x0001 },
- { 3, 0x0001 },
- { 6, 0x0000 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCTotalZeros7[11] = {
- { 6, 0x0001 },
- { 5, 0x0001 },
- { 3, 0x0005 },
- { 3, 0x0004 },
- { 3, 0x0003 },
- { 2, 0x0003 },
- { 3, 0x0002 },
- { 4, 0x0001 },
- { 3, 0x0001 },
- { 6, 0x0000 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCTotalZeros8[10] = {
- { 6, 0x0001 },
- { 4, 0x0001 },
- { 5, 0x0001 },
- { 3, 0x0003 },
- { 2, 0x0003 },
- { 2, 0x0002 },
- { 3, 0x0002 },
- { 3, 0x0001 },
- { 6, 0x0000 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCTotalZeros9[9] = {
- { 6, 0x0001 },
- { 6, 0x0000 },
- { 4, 0x0001 },
- { 2, 0x0003 },
- { 2, 0x0002 },
- { 3, 0x0001 },
- { 2, 0x0001 },
- { 5, 0x0001 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCTotalZeros10[8] = {
- { 5, 0x0001 },
- { 5, 0x0000 },
- { 3, 0x0001 },
- { 2, 0x0003 },
- { 2, 0x0002 },
- { 2, 0x0001 },
- { 4, 0x0001 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCTotalZeros11[7] = {
- { 4, 0x0000 },
- { 4, 0x0001 },
- { 3, 0x0001 },
- { 3, 0x0002 },
- { 1, 0x0001 },
- { 3, 0x0003 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCTotalZeros12[6] = {
- { 4, 0x0000 },
- { 4, 0x0001 },
- { 2, 0x0001 },
- { 1, 0x0001 },
- { 3, 0x0001 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCTotalZeros13[5] = {
- { 3, 0x0000 },
- { 3, 0x0001 },
- { 1, 0x0001 },
- { 2, 0x0001 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCTotalZeros14[4] = {
- { 2, 0x0000 },
- { 2, 0x0001 },
- { 1, 0x0001 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCTotalZeros15[3] = {
- { 1, 0x0000 },
- { 1, 0x0001 },
- { 0, 0x0000 }
-};
-
-const ARM_VLC32 *armVCM4P10_CAVLCTotalZeroTables[15] = {
- armVCM4P10_CAVLCTotalZeros1,
- armVCM4P10_CAVLCTotalZeros2,
- armVCM4P10_CAVLCTotalZeros3,
- armVCM4P10_CAVLCTotalZeros4,
- armVCM4P10_CAVLCTotalZeros5,
- armVCM4P10_CAVLCTotalZeros6,
- armVCM4P10_CAVLCTotalZeros7,
- armVCM4P10_CAVLCTotalZeros8,
- armVCM4P10_CAVLCTotalZeros9,
- armVCM4P10_CAVLCTotalZeros10,
- armVCM4P10_CAVLCTotalZeros11,
- armVCM4P10_CAVLCTotalZeros12,
- armVCM4P10_CAVLCTotalZeros13,
- armVCM4P10_CAVLCTotalZeros14,
- armVCM4P10_CAVLCTotalZeros15
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCTotalZeros2x2_1[5] = {
- { 1, 1 },
- { 2, 1 },
- { 3, 1 },
- { 3, 0 },
- { 0, 0 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCTotalZeros2x2_2[4] = {
- { 1, 1 },
- { 2, 1 },
- { 2, 0 },
- { 0, 0 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCTotalZeros2x2_3[3] = {
- { 1, 1 },
- { 1, 0 },
- { 0, 0 }
-};
-
-const ARM_VLC32 *armVCM4P10_CAVLCTotalZeros2x2Tables[3] = {
- armVCM4P10_CAVLCTotalZeros2x2_1,
- armVCM4P10_CAVLCTotalZeros2x2_2,
- armVCM4P10_CAVLCTotalZeros2x2_3
-};
-
-
-/* Tables for run_before */
-
-static const ARM_VLC32 armVCM4P10_CAVLCRunBefore1[3] = {
- { 1, 0x0001 },
- { 1, 0x0000 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCRunBefore2[4] = {
- { 1, 0x0001 },
- { 2, 0x0001 },
- { 2, 0x0000 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCRunBefore3[5] = {
- { 2, 0x0003 },
- { 2, 0x0002 },
- { 2, 0x0001 },
- { 2, 0x0000 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCRunBefore4[6] = {
- { 2, 0x0003 },
- { 2, 0x0002 },
- { 2, 0x0001 },
- { 3, 0x0001 },
- { 3, 0x0000 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCRunBefore5[7] = {
- { 2, 0x0003 },
- { 2, 0x0002 },
- { 3, 0x0003 },
- { 3, 0x0002 },
- { 3, 0x0001 },
- { 3, 0x0000 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCRunBefore6[8] = {
- { 2, 0x0003 },
- { 3, 0x0000 },
- { 3, 0x0001 },
- { 3, 0x0003 },
- { 3, 0x0002 },
- { 3, 0x0005 },
- { 3, 0x0004 },
- { 0, 0x0000 }
-};
-
-static const ARM_VLC32 armVCM4P10_CAVLCRunBefore7[16] = {
- { 3, 0x0007 },
- { 3, 0x0006 },
- { 3, 0x0005 },
- { 3, 0x0004 },
- { 3, 0x0003 },
- { 3, 0x0002 },
- { 3, 0x0001 },
- { 4, 0x0001 },
- { 5, 0x0001 },
- { 6, 0x0001 },
- { 7, 0x0001 },
- { 8, 0x0001 },
- { 9, 0x0001 },
- { 10, 0x0001 },
- { 11, 0x0001 },
- { 0, 0x0000 }
-};
-
-const ARM_VLC32 *armVCM4P10_CAVLCRunBeforeTables[7] = {
- armVCM4P10_CAVLCRunBefore1,
- armVCM4P10_CAVLCRunBefore2,
- armVCM4P10_CAVLCRunBefore3,
- armVCM4P10_CAVLCRunBefore4,
- armVCM4P10_CAVLCRunBefore5,
- armVCM4P10_CAVLCRunBefore6,
- armVCM4P10_CAVLCRunBefore7
-};
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_CompareMotionCostToMV.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_CompareMotionCostToMV.c
deleted file mode 100644
index 6611a37..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_CompareMotionCostToMV.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P10_CompareMotionCostToMV.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains module for comparing motion vectors and SAD's to decide
- * the best MV and SAD
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: armVCM4P10_ExpGolBitsUsed
- *
- * Description:
- * Performs calculating Exp-Golomb code length for a given values
- *
- * Remarks:
- *
- * Parameters:
- * [in] val Signed number for which Exp-Golomb code length has
- * to be calculated
- *
- * Return Value:
- * Returns the length of the Exp-Golomb code for val
- */
-
-static OMX_U16 armVCM4P10_ExpGolBitsUsed (OMX_S16 val)
-{
- OMX_U16 sizeCodeNum, codeNum;
-
- /* Mapping val to codeNum */
- codeNum = armAbs (val);
- if (val > 0)
- {
- codeNum = (2 * codeNum) - 1;
- }
- else
- {
- codeNum = 2 * codeNum;
- }
-
- /* Size of the exp-golomb code */
- sizeCodeNum = (2 * armLogSize (codeNum + 1)) - 1;
-
- return sizeCodeNum;
-}
-
-
-/**
- * Function: armVCM4P10_CompareMotionCostToMV
- *
- * Description:
- * Performs comparision of motion vectors and Motion cost to decide the
- * best MV and best MC
- *
- * Remarks:
- *
- * Parameters:
- * [in] mvX x coordinate of the candidate motion vector in 1/4 pel units
- * [in] mvY y coordinate of the candidate motion vector in 1/4 pel units
- * [in] diffMV differential MV
- * [in] candSAD Candidate SAD
- * [in] bestMV Best MV, contains best MV till the previous interation.
- * [in] nLamda Lamda factor; used to compute motion cost
- * [in] *pBestCost Contains the current best motion cost.
- * [out] *pBestCost pBestCost Motion cost will be associated with the best MV
- * after judgement;
- * computed as SAD+Lamda*BitsUsedByMV, if the candCost is less
- * than the best cost passed then the *pBestCost will be equal to candCost
- * [out] bestMV Finally will have the best MV after the judgement.
- *
- * Return Value:
- * OMX_INT -- 1 to indicate that the current motion cost is the best
- * 0 to indicate that it is NOT the best motion cost
- */
-
-OMX_INT armVCM4P10_CompareMotionCostToMV (
- OMX_S16 mvX,
- OMX_S16 mvY,
- OMXVCMotionVector diffMV,
- OMX_INT candSAD,
- OMXVCMotionVector *bestMV,
- OMX_U32 nLamda,
- OMX_S32 *pBestCost
-)
-{
- OMX_S32 candCost;
- OMX_U16 sizeCodeNum;
-
- sizeCodeNum = armVCM4P10_ExpGolBitsUsed (diffMV.dx);
- sizeCodeNum += armVCM4P10_ExpGolBitsUsed (diffMV.dy);
-
- /* Motion cost = SAD + lamda * ((bitsused(diffMVx) + (bitsused(diffMVy))*/
- candCost = candSAD + (nLamda * sizeCodeNum);
-
- /* Calculate candCost */
- if (candCost < *pBestCost)
- {
- *pBestCost = candCost;
- bestMV->dx = mvX;
- bestMV->dy = mvY;
- return 1;
- }
- if (candCost > *pBestCost)
- {
- return 0;
- }
- /* shorter motion vector */
- if ( (mvX * mvX + mvY * mvY) < ((bestMV->dx * bestMV->dx) + (bestMV->dy * bestMV->dy)) )
- {
- *pBestCost = candCost;
- bestMV->dx = mvX;
- bestMV->dy = mvY;
- return 1;
- }
-
- return 0;
-}
-
-/*End of File*/
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_DeBlockPixel.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_DeBlockPixel.c
deleted file mode 100644
index c6da8ab..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_DeBlockPixel.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: armVCM4P10_DeBlockPixel.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 luma deblock module
- *
- */
-
-#ifdef DEBUG_ARMVCM4P10_DEBLOCKPIXEL
-#undef DEBUG_ON
-#define DEBUG_ON
-#endif /* DEBUG_ARMVCM4P10_DEBLOCKPIXEL */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/*
- * Description
- * Deblock one boundary pixel
- *
- * Parameters:
- * [in] pQ0 Pointer to pixel q0
- * [in] Step Step between pixels q0 and q1
- * [in] tC0 Edge threshold value
- * [in] alpha alpha threshold value
- * [in] beta beta threshold value
- * [in] bS deblocking strength
- * [in] ChromaFlag True for chroma blocks
- * [out] pQ0 Deblocked pixels
- *
- */
-
-void armVCM4P10_DeBlockPixel(
- OMX_U8 *pQ0, /* pointer to the pixel q0 */
- int Step, /* step between pixels q0 and q1 */
- int tC0, /* edge threshold value */
- int alpha, /* alpha */
- int beta, /* beta */
- int bS, /* deblocking strength */
- int ChromaFlag
-)
-{
- int p3, p2, p1, p0, q0, q1, q2, q3;
- int ap, aq, delta;
-
- if (bS==0)
- {
- return;
- }
-
- p3 = pQ0[-4*Step];
- p2 = pQ0[-3*Step];
- p1 = pQ0[-2*Step];
- p0 = pQ0[-1*Step];
- q0 = pQ0[ 0*Step];
- q1 = pQ0[ 1*Step];
- q2 = pQ0[ 2*Step];
- q3 = pQ0[ 3*Step];
-
- if (armAbs(p0-q0)>=alpha || armAbs(p1-p0)>=beta || armAbs(q1-q0)>=beta)
- {
- DEBUG_PRINTF_10("DeBlockPixel: %02x %02x %02x %02x | %02x %02x %02x %02x alpha=%d beta=%d\n",
- p3, p2, p1, p0, q0, q1, q2, q3, alpha, beta);
- return;
- }
-
- ap = armAbs(p2 - p0);
- aq = armAbs(q2 - q0);
-
- if (bS < 4)
- {
- int tC = tC0;
-
- if (ChromaFlag)
- {
- tC++;
- }
- else
- {
- if (ap < beta)
- {
- tC++;
- }
- if (aq < beta)
- {
- tC++;
- }
- }
-
- delta = (((q0-p0)<<2) + (p1-q1) + 4) >> 3;
- delta = armClip(-tC, tC, delta);
-
- pQ0[-1*Step] = (OMX_U8)armClip(0, 255, p0 + delta);
- pQ0[ 0*Step] = (OMX_U8)armClip(0, 255, q0 - delta);
-
- if (ChromaFlag==0 && ap<beta)
- {
- delta = (p2 + ((p0+q0+1)>>1) - (p1<<1))>>1;
- delta = armClip(-tC0, tC0, delta);
- pQ0[-2*Step] = (OMX_U8)(p1 + delta);
- }
-
- if (ChromaFlag==0 && aq<beta)
- {
- delta = (q2 + ((p0+q0+1)>>1) - (q1<<1))>>1;
- delta = armClip(-tC0, tC0, delta);
- pQ0[ 1*Step] = (OMX_U8)(q1 + delta);
- }
- }
- else /* bS==4 */
- {
- if (ChromaFlag==0 && ap<beta && armAbs(p0-q0)<((alpha>>2)+2))
- {
- pQ0[-1*Step] = (OMX_U8)((p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4)>>3);
- pQ0[-2*Step] = (OMX_U8)((p2 + p1 + p0 + q0 + 2)>>2);
- pQ0[-3*Step] = (OMX_U8)((2*p3 + 3*p2 + p1 + p0 + q0 + 4)>>3);
- }
- else
- {
- pQ0[-1*Step] = (OMX_U8)((2*p1 + p0 + q1 + 2)>>2);
- }
-
- if (ChromaFlag==0 && aq<beta && armAbs(p0-q0)<((alpha>>2)+2))
- {
- pQ0[ 0*Step] = (OMX_U8)((q2 + 2*q1 + 2*q0 + 2*p0 + p1 + 4)>>3);
- pQ0[ 1*Step] = (OMX_U8)((q2 + q1 + p0 + q0 + 2)>>2);
- pQ0[ 2*Step] = (OMX_U8)((2*q3 + 3*q2 + q1 + q0 + p0 + 4)>>3);
- }
- else
- {
- pQ0[ 0*Step] = (OMX_U8)((2*q1 + q0 + p1 + 2)>>2);
- }
- }
-
- DEBUG_PRINTF_13("DeBlockPixel: %02x %02x %02x %02x | %02x %02x %02x %02x bS=%d -> %02x %02x %02x %02x\n",
- p3, p2, p1, p0, q0, q1, q2, q3, bS,
- pQ0[-2*Step], pQ0[-1*Step],pQ0[0*Step],pQ0[1*Step]);
-
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_DecodeCoeffsToPair.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_DecodeCoeffsToPair.c
deleted file mode 100644
index 831d53b..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_DecodeCoeffsToPair.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: armVCM4P10_DecodeCoeffsToPair.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 decode coefficients module
- *
- */
-
-#ifdef DEBUG_ARMVCM4P10_DECODECOEFFSTOPAIR
-#undef DEBUG_ON
-#define DEBUG_ON
-#endif
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armCOMM_Bitstream.h"
-#include "armVCM4P10_CAVLCTables.h"
-
-/* 4x4 DeZigZag table */
-
-static const OMX_U8 armVCM4P10_ZigZag[16] =
-{
- 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15
-};
-
-/*
- * Description:
- * This function perform the work required by the OpenMAX
- * DecodeCoeffsToPair function and DecodeChromaDCCoeffsToPair.
- * Since most of the code is common we share it here.
- *
- * Parameters:
- * [in] ppBitStream Double pointer to current byte in bit stream buffer
- * [in] pOffset Pointer to current bit position in the byte pointed
- * to by *ppBitStream
- * [in] sMaxNumCoeff Maximum number of non-zero coefficients in current
- * block (4,15 or 16)
- * [in] nTable Table number (0 to 4) according to the five columns
- * of Table 9-5 in the H.264 spec
- * [out] ppBitStream *ppBitStream is updated after each block is decoded
- * [out] pOffset *pOffset is updated after each block is decoded
- * [out] pNumCoeff Pointer to the number of nonzero coefficients in
- * this block
- * [out] ppPosCoefbuf Double pointer to destination residual
- * coefficient-position pair buffer
- * Return Value:
- * Standard omxError result. See enumeration for possible result codes.
-
- */
-
-OMXResult armVCM4P10_DecodeCoeffsToPair(
- const OMX_U8** ppBitStream,
- OMX_S32* pOffset,
- OMX_U8* pNumCoeff,
- OMX_U8 **ppPosCoefbuf,
- OMX_INT nTable,
- OMX_INT sMaxNumCoeff
- )
-{
- int CoeffToken, TotalCoeff, TrailingOnes;
- int Level, LevelCode, LevelPrefix, LevelSuffix, LevelSuffixSize;
- int SuffixLength, Run, ZerosLeft,CoeffNum;
- int i, Flags;
- OMX_U8 *pPosCoefbuf = *ppPosCoefbuf;
- OMX_S16 pLevel[16];
- OMX_U8 pRun[16];
-
- CoeffToken = armUnPackVLC32(ppBitStream, pOffset, armVCM4P10_CAVLCCoeffTokenTables[nTable]);
- armRetDataErrIf(CoeffToken == ARM_NO_CODEBOOK_INDEX, OMX_Sts_Err);
-
- TrailingOnes = armVCM4P10_CAVLCTrailingOnes[CoeffToken];
- TotalCoeff = armVCM4P10_CAVLCTotalCoeff[CoeffToken];
- *pNumCoeff = (OMX_U8)TotalCoeff;
-
- DEBUG_PRINTF_2("TotalCoeff = %d, TrailingOnes = %d\n", TotalCoeff, TrailingOnes);
-
- if (TotalCoeff == 0)
- {
- /* Nothing to do */
- return OMX_Sts_NoErr;
- }
-
- /* Decode trailing ones */
- for (i=TotalCoeff-1; i>=TotalCoeff-TrailingOnes; i--)
- {
- if (armGetBits(ppBitStream, pOffset, 1))
- {
- Level = -1;
- }
- else
- {
- Level = +1;
- }
- pLevel[i] = (OMX_S16)Level;
-
- DEBUG_PRINTF_2("Level[%d] = %d\n", i, pLevel[i]);
- }
-
- /* Decode (non zero) level values */
- SuffixLength = 0;
- if (TotalCoeff>10 && TrailingOnes<3)
- {
- SuffixLength=1;
- }
- for ( ; i>=0; i--)
- {
- LevelPrefix = armUnPackVLC32(ppBitStream, pOffset, armVCM4P10_CAVLCLevelPrefix);
- armRetDataErrIf(LevelPrefix == ARM_NO_CODEBOOK_INDEX, OMX_Sts_Err);
-
- LevelSuffixSize = SuffixLength;
- if (LevelPrefix==14 && SuffixLength==0)
- {
- LevelSuffixSize = 4;
- }
- if (LevelPrefix==15)
- {
- LevelSuffixSize = 12;
- }
-
- LevelSuffix = 0;
- if (LevelSuffixSize > 0)
- {
- LevelSuffix = armGetBits(ppBitStream, pOffset, LevelSuffixSize);
- }
-
- LevelCode = (LevelPrefix << SuffixLength) + LevelSuffix;
-
-
- if (LevelPrefix==15 && SuffixLength==0)
- {
- LevelCode += 15;
- }
-
- /* LevelCode = 2*(magnitude-1) + sign */
-
- if (i==TotalCoeff-1-TrailingOnes && TrailingOnes<3)
- {
- /* Level magnitude can't be 1 */
- LevelCode += 2;
- }
- if (LevelCode & 1)
- {
- /* 2a+1 maps to -a-1 */
- Level = (-LevelCode-1)>>1;
- }
- else
- {
- /* 2a+0 maps to +a+1 */
- Level = (LevelCode+2)>>1;
- }
- pLevel[i] = (OMX_S16)Level;
-
- DEBUG_PRINTF_2("Level[%d] = %d\n", i, pLevel[i]);
-
- if (SuffixLength==0)
- {
- SuffixLength=1;
- }
- if ( ((LevelCode>>1)+1)>(3<<(SuffixLength-1)) && SuffixLength<6 )
- {
- SuffixLength++;
- }
- }
-
- /* Decode run values */
- ZerosLeft = 0;
- if (TotalCoeff < sMaxNumCoeff)
- {
- /* Decode TotalZeros VLC */
- if (sMaxNumCoeff==4)
- {
- ZerosLeft = armUnPackVLC32(ppBitStream, pOffset, armVCM4P10_CAVLCTotalZeros2x2Tables[TotalCoeff-1]);
- armRetDataErrIf(ZerosLeft ==ARM_NO_CODEBOOK_INDEX , OMX_Sts_Err);
- }
- else
- {
- ZerosLeft = armUnPackVLC32(ppBitStream, pOffset, armVCM4P10_CAVLCTotalZeroTables[TotalCoeff-1]);
- armRetDataErrIf(ZerosLeft ==ARM_NO_CODEBOOK_INDEX , OMX_Sts_Err);
- }
- }
-
- DEBUG_PRINTF_1("TotalZeros = %d\n", ZerosLeft);
-
- CoeffNum=ZerosLeft+TotalCoeff-1;
-
- for (i=TotalCoeff-1; i>0; i--)
- {
- Run = 0;
- if (ZerosLeft > 0)
- {
- int Table = ZerosLeft;
- if (Table > 6)
- {
- Table = 7;
- }
- Run = armUnPackVLC32(ppBitStream, pOffset, armVCM4P10_CAVLCRunBeforeTables[Table-1]);
- armRetDataErrIf(Run == ARM_NO_CODEBOOK_INDEX, OMX_Sts_Err);
- }
- pRun[i] = (OMX_U8)Run;
-
- DEBUG_PRINTF_2("Run[%d] = %d\n", i, pRun[i]);
-
- ZerosLeft -= Run;
- }
- pRun[0] = (OMX_U8)ZerosLeft;
-
- DEBUG_PRINTF_1("Run[0] = %d\n", pRun[i]);
-
-
- /* Fill in coefficients */
-
- if (sMaxNumCoeff==15)
- {
- CoeffNum++; /* Skip the DC position */
- }
-
- /*for (i=0;i<TotalCoeff;i++)
- CoeffNum += pRun[i]+1;*/
-
- for (i=(TotalCoeff-1); i>=0; i--)
- {
- /*CoeffNum += pRun[i]+1;*/
- Level = pLevel[i];
-
- DEBUG_PRINTF_2("Coef[%d] = %d\n", CoeffNum, Level);
-
- Flags = CoeffNum;
- CoeffNum -= (pRun[i]+1);
- if (sMaxNumCoeff>4)
- {
- /* Perform 4x4 DeZigZag */
- Flags = armVCM4P10_ZigZag[Flags];
- }
- if (i==0)
- {
- /* End of block flag */
- Flags += 0x20;
- }
- if (Level<-128 || Level>127)
- {
- /* Overflow flag */
- Flags += 0x10;
- }
-
- *pPosCoefbuf++ = (OMX_U8)(Flags);
- *pPosCoefbuf++ = (OMX_U8)(Level & 0xFF);
- if (Flags & 0x10)
- {
- *pPosCoefbuf++ = (OMX_U8)(Level>>8);
- }
- }
-
- *ppPosCoefbuf = pPosCoefbuf;
-
- return OMX_Sts_NoErr;
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_DequantTables.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_DequantTables.c
deleted file mode 100644
index ad6cef3..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_DequantTables.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: armVCM4P10_DequantTables.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 inverse quantize tables
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-#include "armVC.h"
-
-
-const OMX_U8 armVCM4P10_PosToVCol4x4[16] =
-{
- 0, 2, 0, 2,
- 2, 1, 2, 1,
- 0, 2, 0, 2,
- 2, 1, 2, 1
-};
-
-const OMX_U8 armVCM4P10_PosToVCol2x2[4] =
-{
- 0, 2,
- 2, 1
-};
-
-const OMX_U8 armVCM4P10_VMatrix[6][3] =
-{
- { 10, 16, 13 },
- { 11, 18, 14 },
- { 13, 20, 16 },
- { 14, 23, 18 },
- { 16, 25, 20 },
- { 18, 29, 23 }
-};
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_FwdTransformResidual4x4.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_FwdTransformResidual4x4.c
deleted file mode 100644
index 17d6c0f..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_FwdTransformResidual4x4.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: armVCM4P10_FwdTransformResidual4x4.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 transform module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/*
- * Description:
- * Forward Transform Residual 4x4 Coefficients
- *
- * Parameters:
- * [in] pSrc Source 4x4 block
- * [out] pDst Destination 4x4 block
- *
- */
-void armVCM4P10_FwdTransformResidual4x4(OMX_S16* pDst, OMX_S16 *pSrc)
-{
- int i;
-
- /* Transform rows */
- for (i=0; i<16; i+=4)
- {
- int d0 = pSrc[i+0];
- int d1 = pSrc[i+1];
- int d2 = pSrc[i+2];
- int d3 = pSrc[i+3];
- int e0 = d0 + d3;
- int e1 = d0 - d3;
- int e2 = d1 + d2;
- int e3 = d1 - d2;
- int f0 = e0 + e2;
- int f1 = (e1 << 1) + e3;
- int f2 = e0 - e2;
- int f3 = e1 - (e3 << 1);
- pDst[i+0] = (OMX_S16)f0;
- pDst[i+1] = (OMX_S16)f1;
- pDst[i+2] = (OMX_S16)f2;
- pDst[i+3] = (OMX_S16)f3;
- }
-
- /* Transform columns */
- for (i=0; i<4; i++)
- {
- int f0 = pDst[i+0];
- int f1 = pDst[i+4];
- int f2 = pDst[i+8];
- int f3 = pDst[i+12];
- int g0 = f0 + f3;
- int g1 = f0 - f3;
- int g2 = f1 + f2;
- int g3 = f1 - f2;
- int h0 = g0 + g2;
- int h1 = (g1 << 1) + g3;
- int h2 = g0 - g2;
- int h3 = g1 - (g3 << 1);
- pDst[i+0] = (OMX_S16) h0;
- pDst[i+4] = (OMX_S16) h1;
- pDst[i+8] = (OMX_S16) h2;
- pDst[i+12] = (OMX_S16) h3;
- }
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_InterpolateHalfDiag_Luma.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_InterpolateHalfDiag_Luma.c
deleted file mode 100644
index ce9df49..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_InterpolateHalfDiag_Luma.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P10_InterpolateHalfDiag_Luma.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This functions will help to calculate Half Pel luma interpolation
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-
-/**
- * Function: armVCM4P10_InterpolateHalfDiag_Luma
- *
- * Description:
- * This function performs interpolation for (1/2, 1/2) positions
- * around a full-pel position.
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block used to interpolate
- * in the reconstructed frame plane
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination(interpolation) buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [out] pDst Pointer to the interpolation buffer of the (1/2,1/2)-pel
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-
-OMXResult armVCM4P10_InterpolateHalfDiag_Luma(
- const OMX_U8* pSrc,
- OMX_U32 iSrcStep,
- OMX_U8* pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-)
-{
- OMX_S32 HalfCoeff, pos;
- OMX_S16 Buf [21 * 16]; /* 21 rows by 16 pixels per row */
- OMX_U32 y, x;
-
- /* check for argument error */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr)
-
- /*
- * Intermediate values will be 1/2 pel at Horizontal direction
- * Starting at (0.5, -2) at top extending to (0.5, height + 3) at bottom
- * Buf contains a 2D array of size (iWidth)X(iHeight + 5)
- */
- for (y = 0; y < iHeight + 5; y++)
- {
- for (x = 0; x < iWidth; x++)
- {
- pos = (y-2) * iSrcStep + x;
- HalfCoeff =
- pSrc [pos - 2] -
- 5 * pSrc [pos - 1] +
- 20 * pSrc [pos] +
- 20 * pSrc [pos + 1] -
- 5 * pSrc [pos + 2] +
- pSrc [pos + 3];
- Buf [y * iWidth + x] = (OMX_S16)HalfCoeff;
- } /* x */
- } /* y */
-
- /* Vertical interpolate */
- for (y = 0; y < iHeight; y++)
- {
- for (x = 0; x < iWidth; x++)
- {
- pos = y * iWidth + x;
- HalfCoeff =
- Buf [pos] -
- 5 * Buf [pos + 1 * iWidth] +
- 20 * Buf [pos + 2 * iWidth] +
- 20 * Buf [pos + 3 * iWidth] -
- 5 * Buf [pos + 4 * iWidth] +
- Buf [pos + 5 * iWidth];
-
- HalfCoeff = (HalfCoeff + 512) >> 10;
- HalfCoeff = armClip(0, 255, HalfCoeff);
-
- pDst [y * iDstStep + x] = (OMX_U8) HalfCoeff;
- }
- }
-
- return OMX_Sts_NoErr;
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_InterpolateHalfHor_Luma.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_InterpolateHalfHor_Luma.c
deleted file mode 100644
index 15462b2..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_InterpolateHalfHor_Luma.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P10_InterpolateHalfHor_Luma.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This functions will help to calculate Half Pel luma interpolation
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: armVCM4P10_InterpolateHalfHor_Luma
- *
- * Description:
- * This function performs interpolation for horizontal 1/2-pel positions
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block used to interpolate
- * in the reconstructed frame plane
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination(interpolation) buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [out] pDst Pointer to the interpolation buffer of the 1/2-pel
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-
-OMXResult armVCM4P10_InterpolateHalfHor_Luma(
- const OMX_U8* pSrc,
- OMX_U32 iSrcStep,
- OMX_U8* pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-)
-{
- OMX_INT x, y;
- OMX_S32 HalfCoeff, pos;
-
- /* check for argument error */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr)
-
- for (y = 0; y < iHeight; y++)
- {
- for (x = 0; x < iWidth; x++)
- {
- pos = y * iSrcStep + x;
- HalfCoeff =
- pSrc [pos - 2] -
- 5 * pSrc [pos - 1] +
- 20 * pSrc [pos] +
- 20 * pSrc [pos + 1] -
- 5 * pSrc [pos + 2] +
- pSrc [pos + 3];
-
- HalfCoeff = (HalfCoeff + 16) >> 5;
- HalfCoeff = armClip(0, 255, HalfCoeff);
-
- pDst [y * iDstStep + x] = HalfCoeff;
- } /* x */
- } /* y */
-
- return OMX_Sts_NoErr;
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_InterpolateHalfVer_Luma.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_InterpolateHalfVer_Luma.c
deleted file mode 100644
index e8adf45..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_InterpolateHalfVer_Luma.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P10_InterpolateHalfVer_Luma.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This functions will help to calculate Half Pel luma interpolation
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: armVCM4P10_InterpolateHalfVer_Luma
- *
- * Description:
- * This function performs interpolation for vertical 1/2-pel positions
- * around a full-pel position.
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block used to interpolate
- * in the reconstructed frame plane
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination(interpolation) buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [out] pDst Pointer to the interpolation buffer of the 1/2-pel
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-
-OMXResult armVCM4P10_InterpolateHalfVer_Luma(
- const OMX_U8* pSrc,
- OMX_U32 iSrcStep,
- OMX_U8* pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-)
-{
- OMX_S32 HalfCoeff, pos;
- OMX_INT y, x;
-
- /* check for argument error */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr)
-
-
- for (y = 0; y < iHeight; y++)
- {
- for (x = 0; x < iWidth; x++)
- {
- pos = y * iSrcStep + x;
- HalfCoeff =
- pSrc [pos - 2 * iSrcStep] -
- 5 * pSrc [pos - 1 * iSrcStep] +
- 20 * pSrc [pos] +
- 20 * pSrc [pos + 1 * iSrcStep] -
- 5 * pSrc [pos + 2 * iSrcStep] +
- pSrc [pos + 3 * iSrcStep];
-
- HalfCoeff = (HalfCoeff + 16) >> 5;
- HalfCoeff = armClip(0, 255, HalfCoeff);
-
- pDst [y * iDstStep + x] = (OMX_U8) HalfCoeff;
- }
- }
-
- return OMX_Sts_NoErr;
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_Interpolate_Chroma.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_Interpolate_Chroma.c
deleted file mode 100644
index 26730f8..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_Interpolate_Chroma.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P10_Interpolate_Chroma.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate interpolation for chroma components
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-
-#include "armCOMM.h"
-
-/**
- * Function: armVCM4P10_Interpolate_Chroma
- *
- * Description:
- * This function performs interpolation for chroma components.
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block used to
- * interpolate in the reconstructed frame plane
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination(interpolation) buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [in] dx Fractional part of horizontal motion vector
- * component in 1/8 pixel unit (0~7)
- * [in] dy Fractional part of vertical motion vector
- * component in 1/8 pixel unit (0~7)
- * [out] pDst Pointer to the interpolation buffer
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
- OMXResult armVCM4P10_Interpolate_Chroma(
- OMX_U8 *pSrc,
- OMX_U32 iSrcStep,
- OMX_U8 *pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight,
- OMX_U32 dx,
- OMX_U32 dy
-)
-{
- OMX_U32 EightMinusdx = 8 - dx;
- OMX_U32 EightMinusdy = 8 - dy;
- OMX_U32 ACoeff, BCoeff, CCoeff, DCoeff;
- OMX_U32 x, y;
-
- /* check for argument error */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(dx > 7, OMX_Sts_BadArgErr)
- armRetArgErrIf(dy > 7, OMX_Sts_BadArgErr)
- armRetArgErrIf(iSrcStep == 0, OMX_Sts_BadArgErr)
- armRetArgErrIf(iDstStep == 0, OMX_Sts_BadArgErr)
- armRetArgErrIf(iWidth == 0, OMX_Sts_BadArgErr)
- armRetArgErrIf(iHeight == 0, OMX_Sts_BadArgErr)
-
- /* if fractionl mv is not (0, 0) */
- if (dx != 0 || dy != 0)
- {
- ACoeff = EightMinusdx * EightMinusdy;
- BCoeff = dx * EightMinusdy;
- CCoeff = EightMinusdx * dy;
- DCoeff = dx * dy;
-
- for (y = 0; y < iHeight; y++)
- {
- for (x = 0; x < iWidth; x++)
- {
- pDst [y * iDstStep + x] = (
- ACoeff * pSrc [y * iSrcStep + x] +
- BCoeff * pSrc [y * iSrcStep + x + 1] +
- CCoeff * pSrc [(y + 1) * iSrcStep + x] +
- DCoeff * pSrc [(y + 1) * iSrcStep + x + 1] +
- 32) >> 6;
- }
- }
- }
- else
- {
- for (y = 0; y < iHeight; y++)
- {
- for (x = 0; x < iWidth; x++)
- {
- pDst [y * iDstStep + x] = pSrc [y * iSrcStep + x];
- }
- }
- }
-
- return OMX_Sts_NoErr;
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_Interpolate_Luma.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_Interpolate_Luma.c
deleted file mode 100644
index 538d62e..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_Interpolate_Luma.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P10_Interpolate_Luma.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate interpolation for luma components
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: armM4P10_Copy
- *
- * Description:
- * This function performs copy a block of data from source to destination
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [out] pDst Pointer to the interpolation buffer
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-static OMXResult armM4P10_Copy(
- const OMX_U8* pSrc,
- OMX_U32 iSrcStep,
- OMX_U8* pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-)
-{
- OMX_U32 x, y;
-
- for (y = 0; y < iHeight; y++)
- {
- for (x = 0; x < iWidth; x++)
- {
- pDst [y * iDstStep + x] = pSrc [y * iSrcStep + x];
- }
- }
-
- return OMX_Sts_NoErr;
-}
-
-/**
- * Function: armVCM4P10_Interpolate_Luma
- *
- * Description:
- * This function performs interpolation for luma components.
- *
- * Remarks:
- *
- * [in] pSrc Pointer to top-left corner of block used to
- * interpolate in the reconstructed frame plane
- * [in] iSrcStep Step of the source buffer.
- * [in] iDstStep Step of the destination(interpolation) buffer.
- * [in] iWidth Width of the current block
- * [in] iHeight Height of the current block
- * [in] dx Fractional part of horizontal motion vector
- * component in 1/4 pixel unit (0~3)
- * [in] dy Fractional part of vertical motion vector
- * component in 1/4 pixel unit (0~3)
- * [out] pDst Pointer to the interpolation buffer
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-
- OMXResult armVCM4P10_Interpolate_Luma(
- const OMX_U8 *pSrc,
- OMX_U32 iSrcStep,
- OMX_U8 *pDst,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight,
- OMX_U32 dx,
- OMX_U32 dy
-)
-{
- OMX_U8 pBuf1 [16*16];
- const OMX_U8 *pSrcHalfHor = pSrc;
- const OMX_U8 *pSrcHalfVer = pSrc;
-
- /* check for argument error */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(dx > 3, OMX_Sts_BadArgErr)
- armRetArgErrIf(dy > 3, OMX_Sts_BadArgErr)
-
- /* Work out positions for half pixel interpolation */
- if (dx == 3)
- {
- pSrcHalfVer += 1;
- }
- if (dy == 3)
- {
- pSrcHalfHor += iSrcStep;
- }
-
- /* Switch on type of pixel
- * Pixels are named 'a' to 's' as in the H.264 standard
- */
- if (dx == 0 && dy == 0)
- {
- /* G */
- armM4P10_Copy(pSrc, iSrcStep, pDst, iDstStep, iWidth, iHeight);
- }
- else if (dy == 0)
- {
- /* a, b, c */
- armVCM4P10_InterpolateHalfHor_Luma
- (pSrcHalfHor, iSrcStep, pDst, iDstStep, iWidth, iHeight);
-
- if (dx == 1 || dx == 3)
- {
- armVCCOMM_Average
- (pDst, pSrcHalfVer, iDstStep, iSrcStep, pDst, iDstStep, iWidth, iHeight);
- }
- }
- else if (dx == 0)
- {
- /* d, h, n */
- armVCM4P10_InterpolateHalfVer_Luma
- (pSrcHalfVer, iSrcStep, pDst, iDstStep, iWidth, iHeight);
-
- if (dy == 1 || dy == 3)
- {
- armVCCOMM_Average
- (pDst, pSrcHalfHor, iDstStep, iSrcStep, pDst, iDstStep, iWidth, iHeight);
- }
- }
- else if (dx == 2 || dy == 2)
- {
- /* j */
- armVCM4P10_InterpolateHalfDiag_Luma
- (pSrc, iSrcStep, pDst, iDstStep, iWidth, iHeight);
-
- if (dx == 1 || dx == 3)
- {
- /* i, k */
- armVCM4P10_InterpolateHalfVer_Luma
- (pSrcHalfVer, iSrcStep, pBuf1, iWidth, iWidth, iHeight);
-
- armVCCOMM_Average
- (pDst, pBuf1, iDstStep, iWidth, pDst, iDstStep, iWidth, iHeight);
- }
- if (dy == 1 || dy == 3)
- {
- /* f,q */
- armVCM4P10_InterpolateHalfHor_Luma
- (pSrcHalfHor, iSrcStep, pBuf1, iWidth, iWidth, iHeight);
-
- armVCCOMM_Average
- (pDst, pBuf1, iDstStep, iWidth, pDst, iDstStep, iWidth, iHeight);
- }
- }
- else /* dx=1,3 and dy=1,3 */
- {
- /* e, g, p, r */
- armVCM4P10_InterpolateHalfHor_Luma
- (pSrcHalfHor, iSrcStep, pBuf1, iWidth, iWidth, iHeight);
-
- armVCM4P10_InterpolateHalfVer_Luma
- (pSrcHalfVer, iSrcStep, pDst, iDstStep, iWidth, iHeight);
-
- armVCCOMM_Average
- (pBuf1, pDst, iWidth, iDstStep, pDst, iDstStep, iWidth, iHeight);
- }
-
- return OMX_Sts_NoErr;
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_PredictIntraDC4x4.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_PredictIntraDC4x4.c
deleted file mode 100644
index a200d55..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_PredictIntraDC4x4.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: armVCM4P10_PredictIntraDC4x4.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 4x4 intra prediction module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/*
- * Description:
- * Perform DC style intra prediction, averaging upper and left block
- *
- * Parameters:
- * [in] pSrcLeft Pointer to the buffer of 16 left coefficients:
- * p[x, y] (x = -1, y = 0..3)
- * [in] pSrcAbove Pointer to the buffer of 16 above coefficients:
- * p[x,y] (x = 0..3, y = -1)
- * [in] leftStep Step of left coefficient buffer
- * [in] dstStep Step of the destination buffer
- * [in] availability Neighboring 16x16 MB availability flag
- * [out] pDst Pointer to the destination buffer
- *
- * Return Value:
- * None
- */
-
-void armVCM4P10_PredictIntraDC4x4(
- const OMX_U8* pSrcLeft,
- const OMX_U8 *pSrcAbove,
- OMX_U8* pDst,
- OMX_INT leftStep,
- OMX_INT dstStep,
- OMX_S32 availability
-)
-{
- int x, y, Sum=0, Count = 0;
-
- if (availability & OMX_VC_LEFT)
- {
- for (y=0; y<4; y++)
- {
- Sum += pSrcLeft[y*leftStep];
- }
- Count++;
- }
- if (availability & OMX_VC_UPPER)
- {
- for (x=0; x<4; x++)
- {
- Sum += pSrcAbove[x];
- }
- Count++;
- }
- if (Count==0)
- {
- Sum = 128;
- }
- else if (Count==1)
- {
- Sum = (Sum + 2) >> 2;
- }
- else /* Count = 2 */
- {
- Sum = (Sum + 4) >> 3;
- }
- for (y=0; y<4; y++)
- {
- for (x=0; x<4; x++)
- {
- pDst[y*dstStep+x] = (OMX_U8)Sum;
- }
- }
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_QuantTables.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_QuantTables.c
deleted file mode 100644
index c01d4f6..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_QuantTables.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: armVCM4P10_QuantTables.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 inverse quantize tables
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-
-const OMX_U32 armVCM4P10_MFMatrix[6][3] =
-{
- {13107, 5243, 8066},
- {11916, 4660, 7490},
- {10082, 4194, 6554},
- { 9362, 3647, 5825},
- { 8192, 3355, 5243},
- { 7282, 2893, 4559}
-};
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_SADQuar.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_SADQuar.c
deleted file mode 100644
index 6ef8af5..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_SADQuar.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P10_SADQuar.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate SAD of pSrc with average of two Ref blocks
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: armVCM4P10_SADQuar
- *
- * Description:
- * This function calculates the SAD between one block (pSrc) and the
- * average of the other two (pSrcRef0 and pSrcRef1)
- *
- * Remarks:
- *
- * [in] pSrc Pointer to the original block
- * [in] pSrcRef0 Pointer to reference block 0
- * [in] pSrcRef1 Pointer to reference block 1
- * [in] iSrcStep Step of the original block buffer
- * [in] iRefStep0 Step of reference block 0
- * [in] iRefStep1 Step of reference block 1
- * [in] iHeight Height of the block
- * [in] iWidth Width of the block
- * [out] pDstSAD Pointer of result SAD
- *
- * Return Value:
- * Standard OMXResult value.
- *
- */
-OMXResult armVCM4P10_SADQuar(
- const OMX_U8* pSrc,
- const OMX_U8* pSrcRef0,
- const OMX_U8* pSrcRef1,
- OMX_U32 iSrcStep,
- OMX_U32 iRefStep0,
- OMX_U32 iRefStep1,
- OMX_U32* pDstSAD,
- OMX_U32 iHeight,
- OMX_U32 iWidth
-)
-{
- OMX_INT x, y;
- OMX_S32 SAD = 0;
-
- /* check for argument error */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pSrcRef0 == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pSrcRef1 == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstSAD == NULL, OMX_Sts_BadArgErr)
-
- for (y = 0; y < iHeight; y++)
- {
- for (x = 0; x < iWidth; x++)
- {
- SAD += armAbs(pSrc [y * iSrcStep + x] - ((
- pSrcRef0 [y * iRefStep0 + x] +
- pSrcRef1 [y * iRefStep1 + x] + 1) >> 1));
- }
- }
-
- *pDstSAD = SAD;
-
- return OMX_Sts_NoErr;
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_TransformResidual4x4.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_TransformResidual4x4.c
deleted file mode 100644
index 6c53731..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_TransformResidual4x4.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: armVCM4P10_TransformResidual4x4.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 transform module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/*
- * Description:
- * Transform Residual 4x4 Coefficients
- *
- * Parameters:
- * [in] pSrc Source 4x4 block
- * [out] pDst Destination 4x4 block
- *
- */
-
-void armVCM4P10_TransformResidual4x4(OMX_S16* pDst, OMX_S16 *pSrc)
-{
- int i;
-
- /* Transform rows */
- for (i=0; i<16; i+=4)
- {
- int d0 = pSrc[i+0];
- int d1 = pSrc[i+1];
- int d2 = pSrc[i+2];
- int d3 = pSrc[i+3];
- int e0 = d0 + d2;
- int e1 = d0 - d2;
- int e2 = (d1>>1) - d3;
- int e3 = d1 + (d3>>1);
- int f0 = e0 + e3;
- int f1 = e1 + e2;
- int f2 = e1 - e2;
- int f3 = e0 - e3;
- pDst[i+0] = (OMX_S16)f0;
- pDst[i+1] = (OMX_S16)f1;
- pDst[i+2] = (OMX_S16)f2;
- pDst[i+3] = (OMX_S16)f3;
- }
-
- /* Transform columns */
- for (i=0; i<4; i++)
- {
- int f0 = pDst[i+0];
- int f1 = pDst[i+4];
- int f2 = pDst[i+8];
- int f3 = pDst[i+12];
- int g0 = f0 + f2;
- int g1 = f0 - f2;
- int g2 = (f1>>1) - f3;
- int g3 = f1 + (f3>>1);
- int h0 = g0 + g3;
- int h1 = g1 + g2;
- int h2 = g1 - g2;
- int h3 = g0 - g3;
- pDst[i+0] = (OMX_S16)((h0+32)>>6);
- pDst[i+4] = (OMX_S16)((h1+32)>>6);
- pDst[i+8] = (OMX_S16)((h2+32)>>6);
- pDst[i+12] = (OMX_S16)((h3+32)>>6);
- }
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_UnpackBlock2x2.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_UnpackBlock2x2.c
deleted file mode 100644
index fb004e5..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_UnpackBlock2x2.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: armVCM4P10_UnpackBlock2x2.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 inverse quantize and transform helper module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-
-/*
- * Description
- * Unpack a 2x2 block of coefficient-residual pair values
- *
- * Parameters:
- * [in] ppSrc Double pointer to residual coefficient-position pair
- * buffer output by CALVC decoding
- * [out] ppSrc *ppSrc is updated to the start of next non empty block
- * [out] pDst Pointer to unpacked 4x4 block
- */
-
-void armVCM4P10_UnpackBlock2x2(
- const OMX_U8 **ppSrc,
- OMX_S16* pDst
-)
-{
- const OMX_U8 *pSrc = *ppSrc;
- int i;
- int Flag, Value;
-
- for (i=0; i<4; i++)
- {
- pDst[i] = 0;
- }
-
- do
- {
- Flag = *pSrc++;
- if (Flag & 0x10)
- {
- /* 16 bit */
- Value = *pSrc++;
- Value = Value | ((*pSrc++)<<8);
- if (Value & 0x8000)
- {
- Value -= 0x10000;
- }
- }
- else
- {
- /* 8 bit */
- Value = *pSrc++;
- if (Value & 0x80)
- {
- Value -= 0x100;
- }
- }
- i = Flag & 15;
- pDst[i] = (OMX_S16)Value;
- }
- while ((Flag & 0x20)==0);
-
- *ppSrc = pSrc;
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_UnpackBlock4x4.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_UnpackBlock4x4.c
deleted file mode 100644
index b40c933..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/armVCM4P10_UnpackBlock4x4.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: armVCM4P10_UnpackBlock4x4.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 inverse quantize and transform helper module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-
-/*
- * Description
- * Unpack a 4x4 block of coefficient-residual pair values
- *
- * Parameters:
- * [in] ppSrc Double pointer to residual coefficient-position pair
- * buffer output by CALVC decoding
- * [out] ppSrc *ppSrc is updated to the start of next non empty block
- * [out] pDst Pointer to unpacked 4x4 block
- */
-
-void armVCM4P10_UnpackBlock4x4(
- const OMX_U8 **ppSrc,
- OMX_S16* pDst
-)
-{
- const OMX_U8 *pSrc = *ppSrc;
- int i;
- int Flag, Value;
-
- for (i=0; i<16; i++)
- {
- pDst[i] = 0;
- }
-
- do
- {
- Flag = *pSrc++;
- if (Flag & 0x10)
- {
- /* 16 bit */
- Value = *pSrc++;
- Value = Value | ((*pSrc++)<<8);
- if (Value & 0x8000)
- {
- Value -= 0x10000;
- }
- }
- else
- {
- /* 8 bit */
- Value = *pSrc++;
- if (Value & 0x80)
- {
- Value -= 0x100;
- }
- }
- i = Flag & 15;
- pDst[i] = (OMX_S16)Value;
- }
- while ((Flag & 0x20)==0);
-
- *ppSrc = pSrc;
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_Average_4x.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_Average_4x.c
deleted file mode 100644
index 638605e..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_Average_4x.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_Average_4x.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate Average of two 4x4 or 4x8 blocks
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_Average_4x (6.3.5.5.3)
- *
- * Description:
- * This function calculates the average of two 4x4, 4x8 blocks. The result
- * is rounded according to (a+b+1)/2.
- *
- * Input Arguments:
- *
- * pPred0 - Pointer to the top-left corner of reference block 0
- * pPred1 - Pointer to the top-left corner of reference block 1
- * iPredStep0 - Step of reference block 0; must be a multiple of 4.
- * iPredStep1 - Step of reference block 1; must be a multiple of 4.
- * iDstStep - Step of the destination buffer; must be a multiple of 4.
- * iHeight - Height of the blocks; must be either 4 or 8.
- *
- * Output Arguments:
- *
- * pDstPred - Pointer to the destination buffer. 4-byte alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pPred0, pPred1, or pDstPred
- * - pDstPred is not aligned on a 4-byte boundary
- * - iPredStep0 <= 0 or iPredStep0 is not a multiple of 4
- * - iPredStep1 <= 0 or iPredStep1 is not a multiple of 4
- * - iDstStep <= 0 or iDstStep is not a multiple of 4
- * - iHeight is not equal to either 4 or 8
- *
- */
- OMXResult omxVCM4P10_Average_4x (
- const OMX_U8* pPred0,
- const OMX_U8* pPred1,
- OMX_U32 iPredStep0,
- OMX_U32 iPredStep1,
- OMX_U8* pDstPred,
- OMX_U32 iDstStep,
- OMX_U32 iHeight
-)
-{
- /* check for argument error */
- armRetArgErrIf(pPred0 == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pPred1 == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstPred == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf((iHeight != 4) && (iHeight != 8), OMX_Sts_BadArgErr)
- armRetArgErrIf((iPredStep0 == 0) || (iPredStep0 & 3), OMX_Sts_BadArgErr)
- armRetArgErrIf((iPredStep1 == 0) || (iPredStep1 & 3), OMX_Sts_BadArgErr)
- armRetArgErrIf((iDstStep == 0) || (iDstStep & 3), OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot4ByteAligned(pDstPred), OMX_Sts_BadArgErr)
-
- return armVCCOMM_Average
- (pPred0, pPred1, iPredStep0, iPredStep1, pDstPred, iDstStep, 4, iHeight);
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_BlockMatch_Half.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_BlockMatch_Half.c
deleted file mode 100644
index 6cfdb64..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_BlockMatch_Half.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_BlockMatch_Half.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for half pel Block matching,
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-
-/**
- * Function: omxVCM4P10_BlockMatch_Half (6.3.5.2.2)
- *
- * Description:
- * Performs a half-pel block match using results from a prior integer search.
- * Returns the best MV and associated cost. This function estimates the
- * half-pixel motion vector by interpolating the integer resolution motion
- * vector referenced by the input parameter pSrcDstBestMV, i.e., the initial
- * integer MV is generated externally. The function
- * omxVCM4P10_BlockMatch_Integer may be used for integer motion estimation.
- *
- * Input Arguments:
- *
- * pSrcOrgY - Pointer to the current position in original picture plane. If
- * iBlockWidth==4, 4-byte alignment required. If iBlockWidth==8,
- * 8-byte alignment required. If iBlockWidth==16, 16-byte alignment
- * required.
- * pSrcRefY - Pointer to the top-left corner of the co-located block in the
- * reference picture If iBlockWidth==4, 4-byte alignment
- * required. If iBlockWidth==8, 8-byte alignment required. If
- * iBlockWidth==16, 16-byte alignment required.
- * nSrcOrgStep - Stride of the original picture plane in terms of full
- * pixels; must be a multiple of iBlockWidth.
- * nSrcRefStep - Stride of the reference picture plane in terms of full
- * pixels
- * iBlockWidth - Width of the current block in terms of full pixels; must
- * be equal to either 4, 8, or 16.
- * iBlockHeight - Height of the current block in terms of full pixels; must
- * be equal to either 4, 8, or 16.
- * nLamda - Lamda factor, used to compute motion cost
- * pMVPred - Predicted MV, represented in terms of 1/4-pel units; used to
- * compute motion cost
- * pSrcDstBestMV - The best MV resulting from a prior integer search,
- * represented in terms of 1/4-pel units
- *
- * Output Arguments:
- *
- * pSrcDstBestMV - Best MV resulting from the half-pel search, expressed in
- * terms of 1/4-pel units
- * pBestCost - Motion cost associated with the best MV; computed as
- * SAD+Lamda*BitsUsedByMV
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - any of the following pointers is NULL: pSrcOrgY, pSrcRefY,
- * pSrcDstBestMV, pMVPred, pBestCost
- * - iBlockWidth or iBlockHeight are equal to values other than 4, 8, or 16.
- * - Any alignment restrictions are violated
- *
- */
-
-OMXResult omxVCM4P10_BlockMatch_Half(
- const OMX_U8* pSrcOrgY,
- OMX_S32 nSrcOrgStep,
- const OMX_U8* pSrcRefY,
- OMX_S32 nSrcRefStep,
- OMX_U8 iBlockWidth,
- OMX_U8 iBlockHeight,
- OMX_U32 nLamda,
- const OMXVCMotionVector* pMVPred,
- OMXVCMotionVector* pSrcDstBestMV,
- OMX_S32* pBestCost
-)
-{
- /* Definitions and Initializations*/
- OMX_INT candSAD;
- OMX_INT fromX, toX, fromY, toY;
- /* Offset to the reference at the begining of the bounding box */
- const OMX_U8 *pTempSrcRefY, *pTempSrcOrgY;
- OMX_S16 x, y;
- OMXVCMotionVector diffMV, candMV, integerMV;
- OMX_U8 interpolY[256];
-
- /* Argument error checks */
- armRetArgErrIf((iBlockWidth == 4) && (!armIs4ByteAligned(pSrcOrgY)), OMX_Sts_BadArgErr);
- armRetArgErrIf((iBlockWidth == 8) && (!armIs8ByteAligned(pSrcOrgY)), OMX_Sts_BadArgErr);
- armRetArgErrIf((iBlockWidth == 16) && (!armIs16ByteAligned(pSrcOrgY)), OMX_Sts_BadArgErr);
- armRetArgErrIf((iBlockWidth == 4) && (!armIs4ByteAligned(pSrcRefY)), OMX_Sts_BadArgErr);
- armRetArgErrIf((iBlockWidth == 8) && (!armIs8ByteAligned(pSrcRefY)), OMX_Sts_BadArgErr);
- armRetArgErrIf((iBlockWidth == 16) && (!armIs16ByteAligned(pSrcRefY)), OMX_Sts_BadArgErr);
- armRetArgErrIf((nSrcOrgStep % iBlockWidth), OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcOrgY == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcRefY == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pMVPred == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcDstBestMV == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBestCost == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(((iBlockWidth!=4)&&(iBlockWidth!=8)&&(iBlockWidth!=16)) , OMX_Sts_BadArgErr);
- armRetArgErrIf(((iBlockHeight!=4)&&(iBlockHeight!=8)&&(iBlockHeight!=16)) , OMX_Sts_BadArgErr);
-
-
- /* Check for valid region */
- fromX = 1;
- toX = 1;
- fromY = 1;
- toY = 1;
-
- /* Initialize to max value as a start point */
- *pBestCost = 0x7fffffff;
-
- integerMV.dx = pSrcDstBestMV->dx;
- integerMV.dy = pSrcDstBestMV->dy;
-
- /* Looping on y- axis */
- for (y = -fromY; y <= toY; y++)
- {
- /* Looping on x- axis */
- for (x = -fromX; x <= toX; x++)
- {
- /* Positioning the pointer */
- pTempSrcRefY = pSrcRefY + (nSrcRefStep * (integerMV.dy/4)) + (integerMV.dx/4);
- if (x < 0)
- {
- pTempSrcRefY = pTempSrcRefY + x;
- }
- if (y < 0)
- {
- pTempSrcRefY = pTempSrcRefY + (y * nSrcRefStep);
- }
- pTempSrcOrgY = pSrcOrgY;
-
- /* Prepare cand MV */
- candMV.dx = integerMV.dx + x * 2;
- candMV.dy = integerMV.dy + y * 2;
-
- /* Interpolate half pel for the current position*/
- armVCM4P10_Interpolate_Luma(
- pTempSrcRefY,
- nSrcRefStep,
- interpolY,
- iBlockWidth,
- iBlockWidth,
- iBlockHeight,
- armAbs(x) * 2,
- armAbs(y) * 2);
-
- /* Calculate the SAD */
- armVCCOMM_SAD(
- pTempSrcOrgY,
- nSrcOrgStep,
- interpolY,
- iBlockWidth,
- &candSAD,
- iBlockHeight,
- iBlockWidth);
-
- diffMV.dx = candMV.dx - pMVPred->dx;
- diffMV.dy = candMV.dy - pMVPred->dy;
-
- /* Result calculations */
- armVCM4P10_CompareMotionCostToMV (
- candMV.dx,
- candMV.dy,
- diffMV,
- candSAD,
- pSrcDstBestMV,
- nLamda,
- pBestCost);
-
- } /* End of x- axis */
- } /* End of y-axis */
-
- return OMX_Sts_NoErr;
-
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_BlockMatch_Integer.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_BlockMatch_Integer.c
deleted file mode 100644
index 050200f..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_BlockMatch_Integer.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_BlockMatch_Integer.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for Block matching, a full search algorithm
- * is implemented
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: omxVCM4P10_BlockMatch_Integer (6.3.5.2.1)
- *
- * Description:
- * Performs integer block match. Returns best MV and associated cost.
- *
- * Input Arguments:
- *
- * pSrcOrgY - Pointer to the top-left corner of the current block. If
- * iBlockWidth==4, 4-byte alignment required. If iBlockWidth==8,
- * 8-byte alignment required. If iBlockWidth==16, 16-byte alignment
- * required.
- * pSrcRefY - Pointer to the top-left corner of the co-located block in the
- * reference picture. If iBlockWidth==4, 4-byte alignment
- * required. If iBlockWidth==8, 8-byte alignment required. If
- * iBlockWidth==16, 16-byte alignment required.
- * nSrcOrgStep - Stride of the original picture plane, expressed in terms
- * of integer pixels; must be a multiple of iBlockWidth.
- * nSrcRefStep - Stride of the reference picture plane, expressed in terms
- * of integer pixels
- * pRefRect - pointer to the valid reference rectangle inside the reference
- * picture plane
- * nCurrPointPos - position of the current block in the current plane
- * iBlockWidth - Width of the current block, expressed in terms of integer
- * pixels; must be equal to either 4, 8, or 16.
- * iBlockHeight - Height of the current block, expressed in terms of
- * integer pixels; must be equal to either 4, 8, or 16.
- * nLamda - Lamda factor; used to compute motion cost
- * pMVPred - Predicted MV; used to compute motion cost, expressed in terms
- * of 1/4-pel units
- * pMVCandidate - Candidate MV; used to initialize the motion search,
- * expressed in terms of integer pixels
- * pMESpec - pointer to the ME specification structure
- *
- * Output Arguments:
- *
- * pDstBestMV - Best MV resulting from integer search, expressed in terms
- * of 1/4-pel units
- * pBestCost - Motion cost associated with the best MV; computed as
- * SAD+Lamda*BitsUsedByMV
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - any of the following poitners are NULL:
- * pSrcOrgY, pSrcRefY, pRefRect, pMVPred, pMVCandidate, or pMESpec.
- * - Either iBlockWidth or iBlockHeight are values other than 4, 8, or 16.
- * - Any alignment restrictions are violated
- *
- */
-
- OMXResult omxVCM4P10_BlockMatch_Integer (
- const OMX_U8 *pSrcOrgY,
- OMX_S32 nSrcOrgStep,
- const OMX_U8 *pSrcRefY,
- OMX_S32 nSrcRefStep,
- const OMXRect *pRefRect,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- OMX_U8 iBlockWidth,
- OMX_U8 iBlockHeight,
- OMX_U32 nLamda,
- const OMXVCMotionVector *pMVPred,
- const OMXVCMotionVector *pMVCandidate,
- OMXVCMotionVector *pBestMV,
- OMX_S32 *pBestCost,
- void *pMESpec
-)
-{
- /* Definitions and Initializations*/
- OMX_INT candSAD;
- OMX_INT fromX, toX, fromY, toY;
- /* Offset to the reference at the begining of the bounding box */
- const OMX_U8 *pTempSrcRefY, *pTempSrcOrgY;
- OMX_S16 x, y;
- OMXVCMotionVector diffMV;
- OMX_S32 nSearchRange;
- ARMVCM4P10_MESpec *armMESpec = (ARMVCM4P10_MESpec *) pMESpec;
-
- /* Argument error checks */
- armRetArgErrIf((iBlockWidth == 4) && (!armIs4ByteAligned(pSrcOrgY)), OMX_Sts_BadArgErr);
- armRetArgErrIf((iBlockWidth == 8) && (!armIs8ByteAligned(pSrcOrgY)), OMX_Sts_BadArgErr);
- armRetArgErrIf((iBlockWidth == 16) && (!armIs16ByteAligned(pSrcOrgY)), OMX_Sts_BadArgErr);
- armRetArgErrIf((iBlockWidth == 4) && (!armIs4ByteAligned(pSrcRefY)), OMX_Sts_BadArgErr);
- armRetArgErrIf((iBlockWidth == 8) && (!armIs8ByteAligned(pSrcRefY)), OMX_Sts_BadArgErr);
- armRetArgErrIf((iBlockWidth == 16) && (!armIs16ByteAligned(pSrcRefY)), OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcOrgY == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcRefY == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pMVPred == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pMVCandidate == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBestMV == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBestCost == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(((iBlockWidth!=4)&&(iBlockWidth!=8)&&(iBlockWidth!=16)) , OMX_Sts_BadArgErr);
- armRetArgErrIf(((iBlockHeight!=4)&&(iBlockHeight!=8)&&(iBlockHeight!=16)) , OMX_Sts_BadArgErr);
- armIgnore (pMESpec);
-
- if(iBlockWidth == 4)
- {
- nSearchRange = armMESpec->MEParams.searchRange4x4;
- }
- else if(iBlockWidth == 8)
- {
- nSearchRange = armMESpec->MEParams.searchRange8x8;
- }
- else
- {
- nSearchRange = armMESpec->MEParams.searchRange16x16;
- }
- /* Check for valid region */
- fromX = nSearchRange;
- toX = nSearchRange;
- fromY = nSearchRange;
- toY = nSearchRange;
-
- if ((pCurrPointPos->x - nSearchRange) < pRefRect->x)
- {
- fromX = pCurrPointPos->x - pRefRect->x;
- }
-
- if ((pCurrPointPos->x + iBlockWidth + nSearchRange) > (pRefRect->x + pRefRect->width))
- {
- toX = pRefRect->width - (pCurrPointPos->x - pRefRect->x) - iBlockWidth;
- }
-
- if ((pCurrPointPos->y - nSearchRange) < pRefRect->y)
- {
- fromY = pCurrPointPos->y - pRefRect->y;
- }
-
- if ((pCurrPointPos->y + iBlockWidth + nSearchRange) > (pRefRect->y + pRefRect->height))
- {
- toY = pRefRect->width - (pCurrPointPos->y - pRefRect->y) - iBlockWidth;
- }
-
- pBestMV->dx = -fromX * 4;
- pBestMV->dy = -fromY * 4;
- /* Initialize to max value as a start point */
- *pBestCost = 0x7fffffff;
-
- /* Looping on y- axis */
- for (y = -fromY; y <= toY; y++)
- {
- /* Looping on x- axis */
- for (x = -fromX; x <= toX; x++)
- {
- /* Positioning the pointer */
- pTempSrcRefY = pSrcRefY + (nSrcRefStep * y) + x;
- pTempSrcOrgY = pSrcOrgY;
-
- /* Calculate the SAD */
- armVCCOMM_SAD(
- pTempSrcOrgY,
- nSrcOrgStep,
- pTempSrcRefY,
- nSrcRefStep,
- &candSAD,
- iBlockHeight,
- iBlockWidth);
-
- diffMV.dx = (x * 4) - pMVPred->dx;
- diffMV.dy = (y * 4) - pMVPred->dy;
-
- /* Result calculations */
- armVCM4P10_CompareMotionCostToMV ((x * 4), (y * 4), diffMV, candSAD, pBestMV, nLamda, pBestCost);
-
- } /* End of x- axis */
- } /* End of y-axis */
-
- return OMX_Sts_NoErr;
-
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_BlockMatch_Quarter.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_BlockMatch_Quarter.c
deleted file mode 100644
index f450d2c..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_BlockMatch_Quarter.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_BlockMatch_Quarter.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for quater pel Block matching,
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-
-/**
- * Function: omxVCM4P10_BlockMatch_Quarter (6.3.5.2.3)
- *
- * Description:
- * Performs a quarter-pel block match using results from a prior half-pel
- * search. Returns the best MV and associated cost. This function estimates
- * the quarter-pixel motion vector by interpolating the half-pel resolution
- * motion vector referenced by the input parameter pSrcDstBestMV, i.e., the
- * initial half-pel MV is generated externally. The function
- * omxVCM4P10_BlockMatch_Half may be used for half-pel motion estimation.
- *
- * Input Arguments:
- *
- * pSrcOrgY - Pointer to the current position in original picture plane. If
- * iBlockWidth==4, 4-byte alignment required. If iBlockWidth==8,
- * 8-byte alignment required. If iBlockWidth==16, 16-byte alignment
- * required.
- * pSrcRefY - Pointer to the top-left corner of the co-located block in the
- * reference picture If iBlockWidth==4, 4-byte alignment
- * required. If iBlockWidth==8, 8-byte alignment required. If
- * iBlockWidth==16, 16-byte alignment required.
- * nSrcOrgStep - Stride of the original picture plane in terms of full
- * pixels; must be a multiple of iBlockWidth.
- * nSrcRefStep - Stride of the reference picture plane in terms of full
- * pixels
- * iBlockWidth - Width of the current block in terms of full pixels; must
- * be equal to either 4, 8, or 16.
- * iBlockHeight - Height of the current block in terms of full pixels; must
- * be equal to either 4, 8, or 16.
- * nLamda - Lamda factor, used to compute motion cost
- * pMVPred - Predicted MV, represented in terms of 1/4-pel units; used to
- * compute motion cost
- * pSrcDstBestMV - The best MV resulting from a prior half-pel search,
- * represented in terms of 1/4 pel units
- *
- * Output Arguments:
- *
- * pSrcDstBestMV - Best MV resulting from the quarter-pel search, expressed
- * in terms of 1/4-pel units
- * pBestCost - Motion cost associated with the best MV; computed as
- * SAD+Lamda*BitsUsedByMV
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - One of more of the following pointers is NULL:
- * pSrcOrgY, pSrcRefY, pSrcDstBestMV, pMVPred, pBestCost
- * - iBlockWidth or iBlockHeight are equal to values other than 4, 8, or 16.
- * - Any alignment restrictions are violated
- *
- */
-
-OMXResult omxVCM4P10_BlockMatch_Quarter(
- const OMX_U8* pSrcOrgY,
- OMX_S32 nSrcOrgStep,
- const OMX_U8* pSrcRefY,
- OMX_S32 nSrcRefStep,
- OMX_U8 iBlockWidth,
- OMX_U8 iBlockHeight,
- OMX_U32 nLamda,
- const OMXVCMotionVector* pMVPred,
- OMXVCMotionVector* pSrcDstBestMV,
- OMX_S32* pBestCost
-)
-{
- /* Definitions and Initializations*/
- OMX_INT candSAD;
- OMX_INT fromX, toX, fromY, toY;
- /* Offset to the reference at the begining of the bounding box */
- const OMX_U8 *pTempSrcRefY, *pTempSrcOrgY;
- OMX_S16 x, y;
- OMXVCMotionVector diffMV, candMV, initialMV;
- OMX_U8 interpolY[256];
- OMX_S32 pelPosX, pelPosY;
-
- /* Argument error checks */
- armRetArgErrIf((iBlockWidth == 4) && (!armIs4ByteAligned(pSrcOrgY)), OMX_Sts_BadArgErr);
- armRetArgErrIf((iBlockWidth == 8) && (!armIs8ByteAligned(pSrcOrgY)), OMX_Sts_BadArgErr);
- armRetArgErrIf((iBlockWidth == 16) && (!armIs16ByteAligned(pSrcOrgY)), OMX_Sts_BadArgErr);
- armRetArgErrIf((iBlockWidth == 4) && (!armIs4ByteAligned(pSrcRefY)), OMX_Sts_BadArgErr);
- armRetArgErrIf((iBlockWidth == 8) && (!armIs8ByteAligned(pSrcRefY)), OMX_Sts_BadArgErr);
- armRetArgErrIf((iBlockWidth == 16) && (!armIs16ByteAligned(pSrcRefY)), OMX_Sts_BadArgErr);
- armRetArgErrIf((nSrcOrgStep % iBlockWidth), OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcOrgY == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcRefY == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pMVPred == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcDstBestMV == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBestCost == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(((iBlockWidth!=4)&&(iBlockWidth!=8)&&(iBlockWidth!=16)) , OMX_Sts_BadArgErr);
- armRetArgErrIf(((iBlockHeight!=4)&&(iBlockHeight!=8)&&(iBlockHeight!=16)) , OMX_Sts_BadArgErr);
-
-
- /* Check for valid region */
- fromX = 1;
- toX = 1;
- fromY = 1;
- toY = 1;
-
- /* Initialize to max value as a start point */
- *pBestCost = 0x7fffffff;
-
- initialMV.dx = pSrcDstBestMV->dx;
- initialMV.dy = pSrcDstBestMV->dy;
-
- /* Looping on y- axis */
- for (y = -fromY; y <= toY; y++)
- {
- /* Looping on x- axis */
- for (x = -fromX; x <= toX; x++)
- {
- /* Positioning the pointer */
- pTempSrcRefY = pSrcRefY + (nSrcRefStep * (initialMV.dy/4)) + (initialMV.dx/4);
-
- /* Calculating the fract pel position */
- pelPosX = (initialMV.dx % 4) + x;
- if (pelPosX < 0)
- {
- pTempSrcRefY = pTempSrcRefY - 1;
- pelPosX += 4;
- }
- pelPosY = (initialMV.dy % 4) + y;
- if (pelPosY < 0)
- {
- pTempSrcRefY = pTempSrcRefY - (1 * nSrcRefStep);
- pelPosY += 4;
- }
-
- pTempSrcOrgY = pSrcOrgY;
-
- /* Prepare cand MV */
- candMV.dx = initialMV.dx + x;
- candMV.dy = initialMV.dy + y;
-
- /* Interpolate Quater pel for the current position*/
- armVCM4P10_Interpolate_Luma(
- pTempSrcRefY,
- nSrcRefStep,
- interpolY,
- iBlockWidth,
- iBlockWidth,
- iBlockHeight,
- pelPosX,
- pelPosY);
-
- /* Calculate the SAD */
- armVCCOMM_SAD(
- pTempSrcOrgY,
- nSrcOrgStep,
- interpolY,
- iBlockWidth,
- &candSAD,
- iBlockHeight,
- iBlockWidth);
-
- diffMV.dx = candMV.dx - pMVPred->dx;
- diffMV.dy = candMV.dy - pMVPred->dy;
-
- /* Result calculations */
- armVCM4P10_CompareMotionCostToMV (
- candMV.dx,
- candMV.dy,
- diffMV,
- candSAD,
- pSrcDstBestMV,
- nLamda,
- pBestCost);
-
- } /* End of x- axis */
- } /* End of y-axis */
-
- return OMX_Sts_NoErr;
-
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_DeblockChroma_I.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_DeblockChroma_I.c
deleted file mode 100644
index 9aecf3f..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_DeblockChroma_I.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_DeblockChroma_I.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 intra chroma deblock
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_DeblockChroma_I (6.3.3.3.6)
- *
- * Description:
- * Performs in-place deblocking filtering on all edges of the chroma
- * macroblock (16x16).
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input macroblock; must be 8-byte aligned.
- * srcdstStep - step of the arrays; must be a multiple of 8.
- * pAlpha - pointer to a 2x2 array of alpha thresholds, organized as
- * follows: {external vertical edge, internal vertical edge,
- * external horizontal edge, internal horizontal edge }. Per
- * [ISO14496-10] alpha values must be in the range [0,255].
- * pBeta - pointer to a 2x2 array of Beta Thresholds, organized as follows:
- * { external vertical edge, internal vertical edge, external
- * horizontal edge, internal horizontal edge }. Per [ISO14496-10]
- * beta values must be in the range [0,18].
- * pThresholds - array of size 8x2 of Thresholds (TC0) (values for the left
- * or above edge of each 4x2 or 2x4 block, arranged in vertical
- * block order and then in horizontal block order); must be aligned
- * on a 4-byte boundary. Per [ISO14496-10] values must be in the
- * range [0,25].
- * pBS - array of size 16x2 of BS parameters (arranged in scan block order
- * for vertical edges and then horizontal edges); valid in the
- * range [0,4] with the following restrictions: i) pBS[i]== 4 may
- * occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]==
- * 4. Must be 4-byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to filtered output macroblock.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - one or more of the following pointers is NULL: pSrcDst, pAlpha,
- * pBeta, pThresholds, or pBS. pSrcDst is not 8-byte aligned.
- * either pThresholds or pBS is not 4-byte aligned.
- * - one or more entries in the table pAlpha[0..3] is outside the range
- * [0,255].
- * - one or more entries in the table pBeta[0..3] is outside the range
- * [0,18].
- * - one or more entries in the table pThresholds[0..15]is outside of
- * the range [0,25].
- * - pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
- * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
- * - srcdstStep is not a multiple of 8.
- *
- */
-OMXResult omxVCM4P10_DeblockChroma_I(
- OMX_U8* pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8* pAlpha,
- const OMX_U8* pBeta,
- const OMX_U8* pThresholds,
- const OMX_U8 *pBS
-)
-{
- OMXResult errorCode;
-
- armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot8ByteAligned(pSrcDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(srcdstStep & 7, OMX_Sts_BadArgErr);
- armRetArgErrIf(pAlpha == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBeta == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pThresholds == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pThresholds), OMX_Sts_BadArgErr);
- armRetArgErrIf(pBS == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pBS), OMX_Sts_BadArgErr);
-
- errorCode = omxVCM4P10_FilterDeblockingChroma_VerEdge_I(
- pSrcDst, srcdstStep, pAlpha, pBeta, pThresholds, pBS);
-
- armRetArgErrIf(errorCode != OMX_Sts_NoErr, errorCode)
-
- errorCode = omxVCM4P10_FilterDeblockingChroma_HorEdge_I(
- pSrcDst, srcdstStep, pAlpha+2, pBeta+2, pThresholds+8, pBS+16);
-
- return errorCode;
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_DeblockLuma_I.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_DeblockLuma_I.c
deleted file mode 100644
index a159631..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_DeblockLuma_I.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_DeblockLuma_I.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 luma deblock
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-
-/**
- * Function: omxVCM4P10_DeblockLuma_I (6.3.3.3.5)
- *
- * Description:
- * This function performs in-place deblock filtering the horizontal and
- * vertical edges of a luma macroblock (16x16).
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input macroblock; must be 16-byte aligned.
- * srcdstStep - image width; must be a multiple of 16.
- * pAlpha - pointer to a 2x2 table of alpha thresholds, organized as
- * follows: {external vertical edge, internal vertical edge,
- * external horizontal edge, internal horizontal edge }. Per
- * [ISO14496-10] alpha values must be in the range [0,255].
- * pBeta - pointer to a 2x2 table of beta thresholds, organized as follows:
- * {external vertical edge, internal vertical edge, external
- * horizontal edge, internal horizontal edge }. Per [ISO14496-10]
- * beta values must be in the range [0,18].
- * pThresholds - pointer to a 16x2 table of threshold (TC0), organized as
- * follows: {values for the left or above edge of each 4x4 block,
- * arranged in vertical block order and then in horizontal block
- * order}; must be aligned on a 4-byte boundary. Per [ISO14496-10]
- * values must be in the range [0,25].
- * pBS - pointer to a 16x2 table of BS parameters arranged in scan block
- * order for vertical edges and then horizontal edges; valid in the
- * range [0,4] with the following restrictions: i) pBS[i]== 4 may
- * occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]==
- * 4. Must be 4-byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to filtered output macroblock.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - one or more of the following pointers is NULL: pSrcDst, pAlpha,
- * pBeta, pThresholds or pBS. pSrcDst is not 16-byte aligned.
- * either pThresholds or pBS is not aligned on a 4-byte boundary.
- * - one or more entries in the table pAlpha[0..3] is outside the range
- * [0,255].
- * - one or more entries in the table pBeta[0..3] is outside the range
- * [0,18].
- * - one or more entries in the table pThresholds[0..31]is outside of
- * the range [0,25].
- * - pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
- * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
- * - srcdstStep is not a multiple of 16.
- *
- */
-
-OMXResult omxVCM4P10_DeblockLuma_I(
- OMX_U8* pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8* pAlpha,
- const OMX_U8* pBeta,
- const OMX_U8* pThresholds,
- const OMX_U8 *pBS
-)
-{
- OMXResult errorCode;
-
- armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot16ByteAligned(pSrcDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(srcdstStep & 15, OMX_Sts_BadArgErr);
- armRetArgErrIf(pAlpha == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBeta == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pThresholds == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pThresholds), OMX_Sts_BadArgErr);
- armRetArgErrIf(pBS == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pBS), OMX_Sts_BadArgErr);
-
- errorCode = omxVCM4P10_FilterDeblockingLuma_VerEdge_I(
- pSrcDst, srcdstStep, pAlpha, pBeta, pThresholds, pBS);
-
- armRetArgErrIf(errorCode != OMX_Sts_NoErr, errorCode)
-
- errorCode = omxVCM4P10_FilterDeblockingLuma_HorEdge_I(
- pSrcDst, srcdstStep, pAlpha+2, pBeta+2, pThresholds+16, pBS+16);
-
- return errorCode;
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC.c
deleted file mode 100644
index f931eeb..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 decode coefficients module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC (6.3.4.1.1)
- *
- * Description:
- * Performs CAVLC decoding and inverse raster scan for a 2x2 block of
- * ChromaDCLevel. The decoded coefficients in the packed position-coefficient
- * buffer are stored in reverse zig-zag order, i.e., the first buffer element
- * contains the last non-zero postion-coefficient pair of the block. Within
- * each position-coefficient pair, the position entry indicates the
- * raster-scan position of the coefficient, while the coefficient entry
- * contains the coefficient value.
- *
- * Input Arguments:
- *
- * ppBitStream - Double pointer to current byte in bit stream buffer
- * pOffset - Pointer to current bit position in the byte pointed to by
- * *ppBitStream; valid in the range [0,7].
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after each block is decoded
- * pOffset - *pOffset is updated after each block is decoded
- * pNumCoeff - Pointer to the number of nonzero coefficients in this block
- * ppPosCoefBuf - Double pointer to destination residual
- * coefficient-position pair buffer. Buffer position
- * (*ppPosCoefBuf) is updated upon return, unless there are only
- * zero coefficients in the currently decoded block. In this case
- * the caller is expected to bypass the transform/dequantization of
- * the empty blocks.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr, if the function runs without error.
- *
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - ppBitStream or pOffset is NULL.
- * - ppPosCoefBuf or pNumCoeff is NULL.
- * OMX_Sts_Err - if one of the following is true:
- * - an illegal code is encountered in the bitstream
- *
- */
-
-OMXResult omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC (
- const OMX_U8** ppBitStream,
- OMX_S32* pOffset,
- OMX_U8* pNumCoeff,
- OMX_U8** ppPosCoefbuf
- )
-
-{
- armRetArgErrIf(ppBitStream==NULL , OMX_Sts_BadArgErr);
- armRetArgErrIf(*ppBitStream==NULL , OMX_Sts_BadArgErr);
- armRetArgErrIf(pOffset==NULL , OMX_Sts_BadArgErr);
- armRetArgErrIf(*pOffset<0 , OMX_Sts_BadArgErr);
- armRetArgErrIf(*pOffset>7 , OMX_Sts_BadArgErr);
- armRetArgErrIf(pNumCoeff==NULL , OMX_Sts_BadArgErr);
- armRetArgErrIf(ppPosCoefbuf==NULL , OMX_Sts_BadArgErr);
- armRetArgErrIf(*ppPosCoefbuf==NULL , OMX_Sts_BadArgErr);
-
- return armVCM4P10_DecodeCoeffsToPair(ppBitStream, pOffset, pNumCoeff,
- ppPosCoefbuf, 4, 4);
-
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_DecodeCoeffsToPairCAVLC.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_DecodeCoeffsToPairCAVLC.c
deleted file mode 100644
index e8ab819..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_DecodeCoeffsToPairCAVLC.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_DecodeCoeffsToPairCAVLC.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 decode coefficients module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_DecodeCoeffsToPairCAVLC (6.3.4.1.2)
- *
- * Description:
- * Performs CAVLC decoding and inverse zigzag scan for 4x4 block of
- * Intra16x16DCLevel, Intra16x16ACLevel, LumaLevel, and ChromaACLevel. Inverse
- * field scan is not supported. The decoded coefficients in the packed
- * position-coefficient buffer are stored in reverse zig-zag order, i.e., the
- * first buffer element contains the last non-zero postion-coefficient pair of
- * the block. Within each position-coefficient pair, the position entry
- * indicates the raster-scan position of the coefficient, while the
- * coefficient entry contains the coefficient value.
- *
- * Input Arguments:
- *
- * ppBitStream -Double pointer to current byte in bit stream buffer
- * pOffset - Pointer to current bit position in the byte pointed to by
- * *ppBitStream; valid in the range [0,7].
- * sMaxNumCoeff - Maximum the number of non-zero coefficients in current
- * block
- * sVLCSelect - VLC table selector, obtained from the number of non-zero
- * coefficients contained in the above and left 4x4 blocks. It is
- * equivalent to the variable nC described in H.264 standard table
- * 9 5, except its value can t be less than zero.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after each block is decoded.
- * Buffer position (*ppPosCoefBuf) is updated upon return, unless
- * there are only zero coefficients in the currently decoded block.
- * In this case the caller is expected to bypass the
- * transform/dequantization of the empty blocks.
- * pOffset - *pOffset is updated after each block is decoded
- * pNumCoeff - Pointer to the number of nonzero coefficients in this block
- * ppPosCoefBuf - Double pointer to destination residual
- * coefficient-position pair buffer
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- *
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - ppBitStream or pOffset is NULL.
- * - ppPosCoefBuf or pNumCoeff is NULL.
- * - sMaxNumCoeff is not equal to either 15 or 16.
- * - sVLCSelect is less than 0.
- *
- * OMX_Sts_Err - if one of the following is true:
- * - an illegal code is encountered in the bitstream
- *
- */
-
-OMXResult omxVCM4P10_DecodeCoeffsToPairCAVLC(
- const OMX_U8** ppBitStream,
- OMX_S32* pOffset,
- OMX_U8* pNumCoeff,
- OMX_U8**ppPosCoefbuf,
- OMX_INT sVLCSelect,
- OMX_INT sMaxNumCoeff
- )
-{
- int nTable;
-
- armRetArgErrIf(ppBitStream==NULL , OMX_Sts_BadArgErr);
- armRetArgErrIf(*ppBitStream==NULL , OMX_Sts_BadArgErr);
- armRetArgErrIf(pOffset==NULL , OMX_Sts_BadArgErr);
- armRetArgErrIf(*pOffset<0 , OMX_Sts_BadArgErr);
- armRetArgErrIf(*pOffset>7 , OMX_Sts_BadArgErr);
- armRetArgErrIf(pNumCoeff==NULL , OMX_Sts_BadArgErr);
- armRetArgErrIf(ppPosCoefbuf==NULL , OMX_Sts_BadArgErr);
- armRetArgErrIf(*ppPosCoefbuf==NULL , OMX_Sts_BadArgErr);
- armRetArgErrIf(sVLCSelect<0 , OMX_Sts_BadArgErr);
- armRetArgErrIf(sMaxNumCoeff<15 , OMX_Sts_BadArgErr);
- armRetArgErrIf(sMaxNumCoeff>16 , OMX_Sts_BadArgErr);
-
- /* Find VLC table number */
- if (sVLCSelect<2)
- {
- nTable = 0;
- }
- else if (sVLCSelect<4)
- {
- nTable = 1;
- }
- else if (sVLCSelect<8)
- {
- nTable = 2;
- }
- else /* sVLCSelect >= 8 */
- {
- nTable = 3;
- }
-
- return armVCM4P10_DecodeCoeffsToPair(ppBitStream, pOffset, pNumCoeff,
- ppPosCoefbuf, nTable, sMaxNumCoeff);
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_DequantTransformResidualFromPairAndAdd.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_DequantTransformResidualFromPairAndAdd.c
deleted file mode 100644
index 8a022ba..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_DequantTransformResidualFromPairAndAdd.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_DequantTransformResidualFromPairAndAdd.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 inverse quantize and transform module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/*
- * Description:
- * Dequantize Luma AC block
- */
-
-static void DequantLumaAC4x4(
- OMX_S16* pSrcDst,
- OMX_INT QP
-)
-{
- const OMX_U8 *pVRow = &armVCM4P10_VMatrix[QP%6][0];
- int Shift = QP / 6;
- int i;
- OMX_S32 Value;
-
- for (i=0; i<16; i++)
- {
-
- Value = (pSrcDst[i] * pVRow[armVCM4P10_PosToVCol4x4[i]]) << Shift;
- pSrcDst[i] = (OMX_S16)Value;
- }
-}
-
-/**
- * Function: omxVCM4P10_DequantTransformResidualFromPairAndAdd (6.3.4.2.3)
- *
- * Description:
- * Reconstruct the 4x4 residual block from coefficient-position pair buffer,
- * perform dequantization and integer inverse transformation for 4x4 block of
- * residuals with previous intra prediction or motion compensation data, and
- * update the pair buffer pointer to next non-empty block. If pDC == NULL,
- * there re 16 non-zero AC coefficients at most in the packed buffer starting
- * from 4x4 block position 0; If pDC != NULL, there re 15 non-zero AC
- * coefficients at most in the packet buffer starting from 4x4 block position
- * 1.
- *
- * Input Arguments:
- *
- * ppSrc - Double pointer to residual coefficient-position pair buffer
- * output by CALVC decoding
- * pPred - Pointer to the predicted 4x4 block; must be aligned on a 4-byte
- * boundary
- * predStep - Predicted frame step size in bytes; must be a multiple of 4
- * dstStep - Destination frame step in bytes; must be a multiple of 4
- * pDC - Pointer to the DC coefficient of this block, NULL if it doesn't
- * exist
- * QP - QP Quantization parameter. It should be QpC in chroma 4x4 block
- * decoding, otherwise it should be QpY.
- * AC - Flag indicating if at least one non-zero AC coefficient exists
- *
- * Output Arguments:
- *
- * pDst - pointer to the reconstructed 4x4 block data; must be aligned on a
- * 4-byte boundary
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - pPred or pDst is NULL.
- * - pPred or pDst is not 4-byte aligned.
- * - predStep or dstStep is not a multiple of 4.
- * - AC !=0 and Qp is not in the range of [0-51] or ppSrc == NULL.
- * - AC ==0 && pDC ==NULL.
- *
- */
-
-OMXResult omxVCM4P10_DequantTransformResidualFromPairAndAdd(
- const OMX_U8 **ppSrc,
- const OMX_U8 *pPred,
- const OMX_S16 *pDC,
- OMX_U8 *pDst,
- OMX_INT predStep,
- OMX_INT dstStep,
- OMX_INT QP,
- OMX_INT AC
-)
-{
- OMX_S16 pBuffer[16+4];
- OMX_S16 *pDelta;
- int i,x,y;
-
- armRetArgErrIf(pPred == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pPred),OMX_Sts_BadArgErr);
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(predStep & 3, OMX_Sts_BadArgErr);
- armRetArgErrIf(dstStep & 3, OMX_Sts_BadArgErr);
- armRetArgErrIf(AC!=0 && (QP<0), OMX_Sts_BadArgErr);
- armRetArgErrIf(AC!=0 && (QP>51), OMX_Sts_BadArgErr);
- armRetArgErrIf(AC!=0 && ppSrc==NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(AC!=0 && *ppSrc==NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(AC==0 && pDC==NULL, OMX_Sts_BadArgErr);
-
- pDelta = armAlignTo8Bytes(pBuffer);
-
- for (i=0; i<16; i++)
- {
- pDelta[i] = 0;
- }
- if (AC)
- {
- armVCM4P10_UnpackBlock4x4(ppSrc, pDelta);
- DequantLumaAC4x4(pDelta, QP);
- }
- if (pDC)
- {
- pDelta[0] = pDC[0];
- }
- armVCM4P10_TransformResidual4x4(pDelta,pDelta);
-
- for (y=0; y<4; y++)
- {
- for (x=0; x<4; x++)
- {
- pDst[y*dstStep+x] = (OMX_U8)armClip(0,255,pPred[y*predStep+x] + pDelta[4*y+x]);
- }
- }
-
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_HorEdge_I.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_HorEdge_I.c
deleted file mode 100644
index 4f34a96..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_HorEdge_I.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_FilterDeblockingChroma_HorEdge_I.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 chroma deblock module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_FilterDeblockingChroma_HorEdge_I (6.3.3.3.4)
- *
- * Description:
- * Performs in-place deblock filtering on the horizontal edges of the chroma
- * macroblock (8x8).
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input macroblock; must be 8-byte aligned.
- * srcdstStep - array step; must be a multiple of 8.
- * pAlpha - array of size 2 containing alpha thresholds; the first element
- * contains the threshold for the external horizontal edge, and the
- * second element contains the threshold for internal horizontal
- * edge. Per [ISO14496-10] alpha values must be in the range
- * [0,255].
- * pBeta - array of size 2 containing beta thresholds; the first element
- * contains the threshold for the external horizontal edge, and the
- * second element contains the threshold for the internal
- * horizontal edge. Per [ISO14496-10] beta values must be in the
- * range [0,18].
- * pThresholds - array of size 8 containing thresholds, TC0, for the top
- * horizontal edge of each 2x4 chroma block, arranged in horizontal
- * block order; must be aligned on a 4-byte boundary. Per
- * [ISO14496-10] values must be in the range [0,25].
- * pBS - array of size 16 containing BS parameters for each 2x2 chroma
- * block, arranged in horizontal block order; valid in the range
- * [0,4] with the following restrictions: i) pBS[i]== 4 may occur
- * only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]== 4.
- * Must be 4-byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst -Pointer to filtered output macroblock.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr, if the function runs without error.
- *
- * OMX_Sts_BadArgErr, if one of the following cases occurs:
- * - any of the following pointers is NULL:
- * pSrcDst, pAlpha, pBeta, pThresholds, or pBS.
- * - pSrcDst is not 8-byte aligned.
- * - srcdstStep is not a multiple of 8.
- * - pThresholds is not 4-byte aligned.
- * - pAlpha[0] and/or pAlpha[1] is outside the range [0,255].
- * - pBeta[0] and/or pBeta[1] is outside the range [0,18].
- * - One or more entries in the table pThresholds[0..7] is outside
- * of the range [0,25].
- * - pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
- * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
- * - pBS is not 4-byte aligned.
- *
- */
-
-OMXResult omxVCM4P10_FilterDeblockingChroma_HorEdge_I(
- OMX_U8* pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8* pAlpha,
- const OMX_U8* pBeta,
- const OMX_U8* pThresholds,
- const OMX_U8 *pBS
- )
-{
- int I, X, Y, Internal=0;
-
- armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot8ByteAligned(pSrcDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(srcdstStep & 7, OMX_Sts_BadArgErr);
- armRetArgErrIf(pAlpha == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBeta == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pThresholds == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pThresholds), OMX_Sts_BadArgErr);
- armRetArgErrIf(pBS == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pBS), OMX_Sts_BadArgErr);
-
- for (Y=0; Y<8; Y+=4, Internal=1)
- {
- for (X=0; X<8; X++)
- {
- I = (X>>1)+4*(Y>>1);
-
- armRetArgErrIf(pBS[I] > 4, OMX_Sts_BadArgErr)
-
- armRetArgErrIf( (I > 3) && (pBS[I] == 4),
- OMX_Sts_BadArgErr)
-
- armRetArgErrIf( (I < 4) &&
- ( (pBS[I] == 4) && (pBS[I^1] != 4) ),
- OMX_Sts_BadArgErr)
-
-
- /* Filter horizontal edge with q0 at (X,Y) */
- armVCM4P10_DeBlockPixel(
- pSrcDst + Y*srcdstStep + X,
- srcdstStep,
- pThresholds[(X>>1)+4*(Y>>2)],
- pAlpha[Internal],
- pBeta[Internal],
- pBS[I],
- 1);
- }
- }
-
- return OMX_Sts_NoErr;
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_VerEdge_I.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_VerEdge_I.c
deleted file mode 100644
index 70b0e87..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_FilterDeblockingChroma_VerEdge_I.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_FilterDeblockingChroma_VerEdge_I.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 deblocking module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_FilterDeblockingChroma_VerEdge_I (6.3.3.3.3)
- *
- * Description:
- * Performs in-place deblock filtering on four vertical edges of the chroma
- * macroblock (8x8).
- *
- * Input Arguments:
- *
- * pSrcDst - Pointer to the input macroblock; must be 8-byte aligned.
- * srcdstStep - Step of the arrays; must be a multiple of 8.
- * pAlpha - Array of size 2 of alpha thresholds (the first item is alpha
- * threshold for external vertical edge, and the second item is for
- * internal vertical edge); per [ISO14496-10] alpha values must be
- * in the range [0,255].
- * pBeta - Array of size 2 of beta thresholds (the first item is the beta
- * threshold for the external vertical edge, and the second item is
- * for the internal vertical edge); per [ISO14496-10] beta values
- * must be in the range [0,18].
- * pThresholds - Array of size 8 containing thresholds, TC0, for the left
- * vertical edge of each 4x2 chroma block, arranged in vertical
- * block order; must be aligned on a 4-byte boundary. Per
- * [ISO14496-10] values must be in the range [0,25].
- * pBS - Array of size 16 of BS parameters (values for each 2x2 chroma
- * block, arranged in vertical block order). This parameter is the
- * same as the pBSparameter passed into FilterDeblockLuma_VerEdge;
- * valid in the range [0,4] with the following restrictions: i)
- * pBS[i]== 4 may occur only for 0<=i<=3, ii) pBS[i]== 4 if and
- * only if pBS[i^3]== 4. Must be 4 byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst -Pointer to filtered output macroblock.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr, if the function runs without error.
- *
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - one or more of the following pointers is NULL: pSrcDst, pAlpha,
- * pBeta, pThresholds, or pBS.
- * - pSrcDst is not 8-byte aligned.
- * - srcdstStep is not a multiple of 8.
- * - pThresholds is not 4-byte aligned.
- * - pAlpha[0] and/or pAlpha[1] is outside the range [0,255].
- * - pBeta[0] and/or pBeta[1] is outside the range [0,18].
- * - One or more entries in the table pThresholds[0..7] is outside
- * of the range [0,25].
- * - pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
- * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
- * - pBS is not 4-byte aligned.
- *
- */
-
-OMXResult omxVCM4P10_FilterDeblockingChroma_VerEdge_I(
- OMX_U8* pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8* pAlpha,
- const OMX_U8* pBeta,
- const OMX_U8* pThresholds,
- const OMX_U8 *pBS
- )
-{
- int I, X, Y, Internal=0;
-
- armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot8ByteAligned(pSrcDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(srcdstStep & 7, OMX_Sts_BadArgErr);
- armRetArgErrIf(pAlpha == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBeta == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pThresholds == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pThresholds), OMX_Sts_BadArgErr);
- armRetArgErrIf(pBS == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pBS), OMX_Sts_BadArgErr);
- armRetArgErrIf(pBeta[0] > 18, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBeta[1] > 18, OMX_Sts_BadArgErr);
-
- for (X=0; X<8; X+=4, Internal=1)
- {
- for (Y=0; Y<8; Y++)
- {
- I = (Y>>1)+4*(X>>1);
-
- armRetArgErrIf(pBS[I] > 4, OMX_Sts_BadArgErr);
-
- armRetArgErrIf( (I > 3) && (pBS[I] == 4),
- OMX_Sts_BadArgErr);
-
- armRetArgErrIf( ( (pBS[I] == 4) && (pBS[I^3] != 4) ),
- OMX_Sts_BadArgErr);
- armRetArgErrIf(pThresholds[Y] > 25, OMX_Sts_BadArgErr);
-
-
- /* Filter vertical edge with q0 at (X,Y) */
- armVCM4P10_DeBlockPixel(
- pSrcDst + Y*srcdstStep + X,
- 1,
- pThresholds[(Y>>1)+4*(X>>2)],
- pAlpha[Internal],
- pBeta[Internal],
- pBS[I],
- 1);
- }
- }
-
- return OMX_Sts_NoErr;
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_HorEdge_I.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_HorEdge_I.c
deleted file mode 100644
index 19294f8..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_HorEdge_I.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_FilterDeblockingLuma_HorEdge_I.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 luma deblock module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_FilterDeblockingLuma_HorEdge_I (6.3.3.3.2)
- *
- * Description:
- * Performs in-place deblock filtering on four horizontal edges of the luma
- * macroblock (16x16).
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input macroblock; must be 16-byte aligned.
- * srcdstStep -s tep of the arrays; must be a multiple of 16.
- * pAlpha - array of size 2 of alpha thresholds (the first item is the alpha
- * threshold for the external vertical edge, and the second item is
- * for the internal horizontal edge); per [ISO14496-10] alpha
- * values must be in the range [0,255].
- * pBeta - array of size 2 of beta thresholds (the first item is the beta
- * threshold for the external horizontal edge, and the second item
- * is for the internal horizontal edge). Per [ISO14496-10] beta
- * values must be in the range [0,18].
- * pThresholds - array of size 16 containing thresholds, TC0, for the top
- * horizontal edge of each 4x4 block, arranged in horizontal block
- * order; must be aligned on a 4-byte boundary. Per [ISO14496 10]
- * values must be in the range [0,25].
- * pBS - array of size 16 of BS parameters (arranged in horizontal block
- * order); valid in the range [0,4] with the following
- * restrictions: i) pBS[i]== 4 may occur only for 0<=i<=3, ii)
- * pBS[i]== 4 if and only if pBS[i^3]== 4. Must be 4-byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst -Pointer to filtered output macroblock.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr, if the function runs without error.
- *
- * OMX_Sts_BadArgErr, if one of the following cases occurs:
- * - one or more of the following pointers is NULL: pSrcDst, pAlpha,
- * pBeta, pThresholds, or pBS.
- * - either pThresholds or pBS is not aligned on a 4-byte boundary.
- * - pSrcDst is not 16-byte aligned.
- * - srcdstStep is not a multiple of 16.
- * - pAlpha[0] and/or pAlpha[1] is outside the range [0,255].
- * - pBeta[0] and/or pBeta[1] is outside the range [0,18].
- * - One or more entries in the table pThresholds[0..15] is
- * outside of the range [0,25].
- * - pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
- * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
- *
- */
-
-OMXResult omxVCM4P10_FilterDeblockingLuma_HorEdge_I(
- OMX_U8* pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8* pAlpha,
- const OMX_U8* pBeta,
- const OMX_U8* pThresholds,
- const OMX_U8 *pBS
- )
-{
- int I, X, Y, Internal=0;
-
- armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot8ByteAligned(pSrcDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(srcdstStep & 7, OMX_Sts_BadArgErr);
- armRetArgErrIf(pAlpha == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBeta == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pThresholds == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pThresholds), OMX_Sts_BadArgErr);
- armRetArgErrIf(pBS == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pBS), OMX_Sts_BadArgErr);
-
- for (Y=0; Y<16; Y+=4, Internal=1)
- {
- for (X=0; X<16; X++)
- {
- I = (X>>2)+4*(Y>>2);
-
- armRetArgErrIf(pBS[I] > 4, OMX_Sts_BadArgErr)
-
- armRetArgErrIf( (I > 3) && (pBS[I] == 4),
- OMX_Sts_BadArgErr)
-
- armRetArgErrIf( (I < 4) &&
- ( (pBS[I] == 4) && (pBS[I^1] != 4) ),
- OMX_Sts_BadArgErr)
-
- /* Filter horizontal edge with q0 at (X,Y) */
- armVCM4P10_DeBlockPixel(
- pSrcDst + Y*srcdstStep + X,
- srcdstStep,
- pThresholds[I],
- pAlpha[Internal],
- pBeta[Internal],
- pBS[I],
- 0);
- }
- }
-
- return OMX_Sts_NoErr;
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_VerEdge_I.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_VerEdge_I.c
deleted file mode 100644
index 53e232a..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_FilterDeblockingLuma_VerEdge_I.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_FilterDeblockingLuma_VerEdge_I.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 luma deblock module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_FilterDeblockingLuma_VerEdge_I (6.3.3.3.1)
- *
- * Description:
- * Performs in-place deblock filtering on four vertical edges of the luma
- * macroblock (16x16).
- *
- * Input Arguments:
- *
- * pSrcDst - Pointer to the input macroblock; must be 16-byte aligned.
- * srcdstStep -Step of the arrays; must be a multiple of 16.
- * pAlpha -Array of size 2 of alpha thresholds (the first item is the alpha
- * threshold for the external vertical edge, and the second item is
- * for the internal vertical edge); per [ISO14496-10] alpha values
- * must be in the range [0,255].
- * pBeta -Array of size 2 of beta thresholds (the first item is the beta
- * threshold for the external vertical edge, and the second item is
- * for the internal vertical edge); per [ISO14496-10] beta values
- * must be in the range [0,18].
- * pThresholds -Array of size 16 of Thresholds (TC0) (values for the left
- * edge of each 4x4 block, arranged in vertical block order); must
- * be aligned on a 4-byte boundary.. Per [ISO14496-10] values must
- * be in the range [0,25].
- * pBS -Array of size 16 of BS parameters (arranged in vertical block
- * order); valid in the range [0,4] with the following
- * restrictions: i) pBS[i]== 4 may occur only for 0<=i<=3, ii)
- * pBS[i]== 4 if and only if pBS[i^3]== 4. Must be 4-byte aligned.
- *
- * Output Arguments:
- *
- * pSrcDst -Pointer to filtered output macroblock.
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * Either of the pointers in pSrcDst, pAlpha, pBeta, pThresholds, or pBS
- * is NULL.
- * Either pThresholds or pBS is not aligned on a 4-byte boundary.
- * pSrcDst is not 16-byte aligned.
- * srcdstStep is not a multiple of 16.
- * pAlpha[0] and/or pAlpha[1] is outside the range [0,255].
- * pBeta[0] and/or pBeta[1] is outside the range [0,18].
- * One or more entries in the table pThresholds[0..15]is outside of the
- * range [0,25].
- * pBS is out of range, i.e., one of the following conditions is true:
- * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or (pBS[i]==4 &&
- * pBS[i^3]!=4) for 0<=i<=3.
- *
- */
-
-OMXResult omxVCM4P10_FilterDeblockingLuma_VerEdge_I(
- OMX_U8* pSrcDst,
- OMX_S32 srcdstStep,
- const OMX_U8* pAlpha,
- const OMX_U8* pBeta,
- const OMX_U8* pThresholds,
- const OMX_U8 *pBS
- )
-{
- int X, Y, I, Internal=0;
-
- armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot16ByteAligned(pSrcDst),OMX_Sts_BadArgErr);
- armRetArgErrIf(srcdstStep & 15, OMX_Sts_BadArgErr);
- armRetArgErrIf(pAlpha == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBeta == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pThresholds == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pThresholds), OMX_Sts_BadArgErr);
- armRetArgErrIf(pBS == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pBS), OMX_Sts_BadArgErr);
- armRetArgErrIf(pBeta[0] > 18, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBeta[1] > 18, OMX_Sts_BadArgErr);
-
-
- for (X=0; X<16; X+=4, Internal=1)
- {
- for (Y=0; Y<16; Y++)
- {
- I = (Y>>2)+4*(X>>2);
-
- armRetArgErrIf(pBS[Y] > 4, OMX_Sts_BadArgErr);
-
- armRetArgErrIf((pBS[Y] == 4) && (Y > 3),
- OMX_Sts_BadArgErr);
-
- armRetArgErrIf(( (pBS[Y] == 4) && (pBS[Y^3] != 4) ),
- OMX_Sts_BadArgErr);
-
- armRetArgErrIf(pThresholds[Y] > 25, OMX_Sts_BadArgErr);
-
- /* Filter vertical edge with q0 at (X,Y) */
- armVCM4P10_DeBlockPixel(
- pSrcDst + Y*srcdstStep + X,
- 1,
- pThresholds[I],
- pAlpha[Internal],
- pBeta[Internal],
- pBS[I],
- 0);
- }
- }
-
- return OMX_Sts_NoErr;
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_GetVLCInfo.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_GetVLCInfo.c
deleted file mode 100644
index c80552a..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_GetVLCInfo.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_GetVLCInfo.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- *
- * This function extracts run-length encoding (RLE) information
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_GetVLCInfo (6.3.5.9.1)
- *
- * Description:
- * This function extracts run-length encoding (RLE) information from the
- * coefficient matrix. The results are returned in an OMXVCM4P10VLCInfo
- * structure.
- *
- * Input Arguments:
- *
- * pSrcCoeff - pointer to the transform coefficient matrix. 8-byte
- * alignment required.
- * pScanMatrix - pointer to the scan order definition matrix. For a luma
- * block the scan matrix should follow [ISO14496-10] section 8.5.4,
- * and should contain the values 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13,
- * 10, 7, 11, 14, 15. For a chroma block, the scan matrix should
- * contain the values 0, 1, 2, 3.
- * bAC - indicates presence of a DC coefficient; 0 = DC coefficient
- * present, 1= DC coefficient absent.
- * MaxNumCoef - specifies the number of coefficients contained in the
- * transform coefficient matrix, pSrcCoeff. The value should be 16
- * for blocks of type LUMADC, LUMAAC, LUMALEVEL, and CHROMAAC. The
- * value should be 4 for blocks of type CHROMADC.
- *
- * Output Arguments:
- *
- * pDstVLCInfo - pointer to structure that stores information for
- * run-length coding.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrcCoeff, pScanMatrix, pDstVLCInfo
- * - pSrcCoeff is not aligned on an 8-byte boundary
- *
- */
-OMXResult omxVCM4P10_GetVLCInfo (
- const OMX_S16* pSrcCoeff,
- const OMX_U8* pScanMatrix,
- OMX_U8 bAC,
- OMX_U32 MaxNumCoef,
- OMXVCM4P10VLCInfo* pDstVLCInfo
-)
-{
- OMX_INT i, MinIndex;
- OMX_S32 Value;
- OMX_U32 Mask = 4, RunBefore;
- OMX_S16 *pLevel;
- OMX_U8 *pRun;
- OMX_S16 Buf [16];
-
- /* check for argument error */
- armRetArgErrIf(pSrcCoeff == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot8ByteAligned(pSrcCoeff), OMX_Sts_BadArgErr)
- armRetArgErrIf(pScanMatrix == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstVLCInfo == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(bAC > 1, OMX_Sts_BadArgErr)
- armRetArgErrIf(MaxNumCoef > 16, OMX_Sts_BadArgErr)
-
- /* Initialize RLE Info structure */
- pDstVLCInfo->uTrailing_Ones = 0;
- pDstVLCInfo->uTrailing_One_Signs = 0;
- pDstVLCInfo->uNumCoeffs = 0;
- pDstVLCInfo->uTotalZeros = 0;
-
- for (i = 0; i < 16; i++)
- {
- pDstVLCInfo->iLevels [i] = 0;
- pDstVLCInfo->uRuns [i] = 0;
- }
-
- MinIndex = (bAC == 0 && MaxNumCoef == 15) ? 1 : 0;
- for (i = MinIndex; i < (MaxNumCoef + MinIndex); i++)
- {
- /* Scan */
- Buf [i - MinIndex] = pSrcCoeff [pScanMatrix [i]];
- }
-
- /* skip zeros at the end */
- i = MaxNumCoef - 1;
- while (!Buf [i] && i >= 0)
- {
- i--;
- }
-
- if (i < 0)
- {
- return OMX_Sts_NoErr;
- }
-
- /* Fill RLE Info structure */
- pLevel = pDstVLCInfo->iLevels;
- pRun = pDstVLCInfo->uRuns;
- RunBefore = 0;
-
- /* Handle first non zero separate */
- pDstVLCInfo->uNumCoeffs++;
- Value = Buf [i];
- if (Value == 1 || Value == -1)
- {
- pDstVLCInfo->uTrailing_Ones++;
-
- pDstVLCInfo->uTrailing_One_Signs |=
- Value == -1 ? Mask : 0;
- Mask >>= 1;
- }
- else
- {
- Value -= (Value > 0 ? 1 : -1);
- *pLevel++ = Value;
- Mask = 0;
- }
-
- /* Remaining non zero */
- while (--i >= 0)
- {
- Value = Buf [i];
- if (Value)
- {
- pDstVLCInfo->uNumCoeffs++;
-
- /* Mask becomes zero after entering */
- if (Mask &&
- (Value == 1 ||
- Value == -1))
- {
- pDstVLCInfo->uTrailing_Ones++;
-
- pDstVLCInfo->uTrailing_One_Signs |=
- Value == -1 ? Mask : 0;
- Mask >>= 1;
- *pRun++ = RunBefore;
- RunBefore = 0;
- }
- else
- {
- /* If 3 trailing ones are not completed */
- if (Mask)
- {
- Mask = 0;
- Value -= (Value > 0 ? 1 : -1);
- }
- *pLevel++ = Value;
- *pRun++ = RunBefore;
- RunBefore = 0;
- }
- }
- else
- {
- pDstVLCInfo->uTotalZeros++;
- RunBefore++;
- }
- }
-
- /* Update last run */
- if (RunBefore)
- {
- *pRun++ = RunBefore;
- }
-
- return OMX_Sts_NoErr;
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InterpolateChroma.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InterpolateChroma.c
deleted file mode 100644
index 18824d8..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InterpolateChroma.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_InterpolateChroma.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate 1/8 Pixel interpolation for Chroma Block
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-
-/**
- * Function: omxVCM4P10_InterpolateChroma (6.3.3.2.2)
- *
- * Description:
- * Performs 1/8-pixel interpolation for inter chroma MB.
- *
- * Input Arguments:
- *
- * pSrc -Pointer to the source reference frame buffer
- * srcStep -Reference frame step in bytes
- * dstStep -Destination frame step in bytes; must be a multiple of
- * roi.width.
- * dx -Fractional part of horizontal motion vector component in 1/8 pixel
- * unit; valid in the range [0,7]
- * dy -Fractional part of vertical motion vector component in 1/8 pixel
- * unit; valid in the range [0,7]
- * roi -Dimension of the interpolation region; the parameters roi.width and
- * roi.height must be equal to either 2, 4, or 8.
- *
- * Output Arguments:
- *
- * pDst -Pointer to the destination frame buffer if roi.width==2, 2-byte
- * alignment required if roi.width==4, 4-byte alignment required
- * if roi.width==8, 8-byte alignment required
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * pSrc or pDst is NULL.
- * srcStep or dstStep < 8.
- * dx or dy is out of range [0-7].
- * roi.width or roi.height is out of range {2,4,8}.
- * roi.width is equal to 2, but pDst is not 2-byte aligned.
- * roi.width is equal to 4, but pDst is not 4-byte aligned.
- * roi.width is equal to 8, but pDst is not 8 byte aligned.
- * srcStep or dstStep is not a multiple of 8.
- *
- */
-
-OMXResult omxVCM4P10_InterpolateChroma (
- const OMX_U8* pSrc,
- OMX_S32 srcStep,
- OMX_U8* pDst,
- OMX_S32 dstStep,
- OMX_S32 dx,
- OMX_S32 dy,
- OMXSize roi
- )
-{
- /* check for argument error */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(srcStep < 8, OMX_Sts_BadArgErr)
- armRetArgErrIf(dstStep < 8, OMX_Sts_BadArgErr)
- armRetArgErrIf(dx < 0, OMX_Sts_BadArgErr)
- armRetArgErrIf(dx > 7, OMX_Sts_BadArgErr)
- armRetArgErrIf(dy < 0, OMX_Sts_BadArgErr)
- armRetArgErrIf(dy > 7, OMX_Sts_BadArgErr)
- armRetArgErrIf((roi.width != 2) && (roi.width != 4) && (roi.width != 8), OMX_Sts_BadArgErr)
- armRetArgErrIf((roi.height != 2) && (roi.height != 4) && (roi.height != 8), OMX_Sts_BadArgErr)
- armRetArgErrIf((roi.width == 2) && armNot2ByteAligned(pDst), OMX_Sts_BadArgErr)
- armRetArgErrIf((roi.width == 4) && armNot4ByteAligned(pDst), OMX_Sts_BadArgErr)
- armRetArgErrIf((roi.width == 8) && armNot8ByteAligned(pDst), OMX_Sts_BadArgErr)
- armRetArgErrIf(srcStep & 7, OMX_Sts_BadArgErr)
- armRetArgErrIf(dstStep & 7, OMX_Sts_BadArgErr)
-
- return armVCM4P10_Interpolate_Chroma
- ((OMX_U8*)pSrc, srcStep, pDst, dstStep, roi.width, roi.height, dx, dy);
-}
-
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InterpolateHalfHor_Luma.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InterpolateHalfHor_Luma.c
deleted file mode 100644
index 26c8208..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InterpolateHalfHor_Luma.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_InterpolateHalfHor_Luma.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate Half horizontal luma interpolation
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_InterpolateHalfHor_Luma (6.3.5.5.1)
- *
- * Description:
- * This function performs interpolation for two horizontal 1/2-pel positions
- * (-1/2,0) and (1/2, 0) - around a full-pel position.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the top-left corner of the block used to interpolate in
- * the reconstruction frame plane.
- * iSrcStep - Step of the source buffer.
- * iDstStep - Step of the destination(interpolation) buffer; must be a
- * multiple of iWidth.
- * iWidth - Width of the current block; must be equal to either 4, 8, or 16
- * iHeight - Height of the current block; must be equal to 4, 8, or 16
- *
- * Output Arguments:
- *
- * pDstLeft -Pointer to the interpolation buffer of the left -pel position
- * (-1/2, 0)
- * If iWidth==4, 4-byte alignment required.
- * If iWidth==8, 8-byte alignment required.
- * If iWidth==16, 16-byte alignment required.
- * pDstRight -Pointer to the interpolation buffer of the right -pel
- * position (1/2, 0)
- * If iWidth==4, 4-byte alignment required.
- * If iWidth==8, 8-byte alignment required.
- * If iWidth==16, 16-byte alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrc, pDstLeft, or pDstRight
- * - iWidth or iHeight have values other than 4, 8, or 16
- * - iWidth==4 but pDstLeft and/or pDstRight is/are not aligned on a 4-byte boundary
- * - iWidth==8 but pDstLeft and/or pDstRight is/are not aligned on a 8-byte boundary
- * - iWidth==16 but pDstLeft and/or pDstRight is/are not aligned on a 16-byte boundary
- * - any alignment restrictions are violated
- *
- */
-
-OMXResult omxVCM4P10_InterpolateHalfHor_Luma(
- const OMX_U8* pSrc,
- OMX_U32 iSrcStep,
- OMX_U8* pDstLeft,
- OMX_U8* pDstRight,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-)
-{
- OMXResult RetValue;
-
- /* check for argument error */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstLeft == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstRight == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf((iWidth == 4) &&
- armNot4ByteAligned(pDstLeft) &&
- armNot4ByteAligned(pDstRight), OMX_Sts_BadArgErr)
- armRetArgErrIf((iWidth == 8) &&
- armNot8ByteAligned(pDstLeft) &&
- armNot8ByteAligned(pDstRight), OMX_Sts_BadArgErr)
- armRetArgErrIf((iWidth == 16) &&
- armNot16ByteAligned(pDstLeft) &&
- armNot16ByteAligned(pDstRight), OMX_Sts_BadArgErr)
-
- armRetArgErrIf((iHeight != 16) && (iHeight != 8)&& (iHeight != 4), OMX_Sts_BadArgErr)
- armRetArgErrIf((iWidth != 16) && (iWidth != 8)&& (iWidth != 4), OMX_Sts_BadArgErr)
-
- RetValue = armVCM4P10_InterpolateHalfHor_Luma (
- pSrc - 1,
- iSrcStep,
- pDstLeft,
- iDstStep,
- iWidth,
- iHeight);
-
- if (RetValue != OMX_Sts_NoErr)
- {
- return RetValue;
- }
-
- RetValue = armVCM4P10_InterpolateHalfHor_Luma (
- pSrc,
- iSrcStep,
- pDstRight,
- iDstStep,
- iWidth,
- iHeight);
-
- return RetValue;
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InterpolateHalfVer_Luma.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InterpolateHalfVer_Luma.c
deleted file mode 100644
index 96c186b..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InterpolateHalfVer_Luma.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_InterpolateHalfVer_Luma.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate SAD for 4x4 blocks
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-
-/**
- * Function: omxVCM4P10_InterpolateHalfVer_Luma (6.3.5.5.2)
- *
- * Description:
- * This function performs interpolation for two vertical 1/2-pel positions -
- * (0, -1/2) and (0, 1/2) - around a full-pel position.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to top-left corner of block used to interpolate in the
- * reconstructed frame plane
- * iSrcStep - Step of the source buffer.
- * iDstStep - Step of the destination (interpolation) buffer; must be a
- * multiple of iWidth.
- * iWidth - Width of the current block; must be equal to either 4, 8, or 16
- * iHeight - Height of the current block; must be equal to either 4, 8, or 16
- *
- * Output Arguments:
- *
- * pDstUp -Pointer to the interpolation buffer of the -pel position above
- * the current full-pel position (0, -1/2)
- * If iWidth==4, 4-byte alignment required.
- * If iWidth==8, 8-byte alignment required.
- * If iWidth==16, 16-byte alignment required.
- * pDstDown -Pointer to the interpolation buffer of the -pel position below
- * the current full-pel position (0, 1/2)
- * If iWidth==4, 4-byte alignment required.
- * If iWidth==8, 8-byte alignment required.
- * If iWidth==16, 16-byte alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrc, pDstUp, or pDstDown
- * - iWidth or iHeight have values other than 4, 8, or 16
- * - iWidth==4 but pDstUp and/or pDstDown is/are not aligned on a 4-byte boundary
- * - iWidth==8 but pDstUp and/or pDstDown is/are not aligned on a 8-byte boundary
- * - iWidth==16 but pDstUp and/or pDstDown is/are not aligned on a 16-byte boundary
- *
- */
- OMXResult omxVCM4P10_InterpolateHalfVer_Luma(
- const OMX_U8* pSrc,
- OMX_U32 iSrcStep,
- OMX_U8* pDstUp,
- OMX_U8* pDstDown,
- OMX_U32 iDstStep,
- OMX_U32 iWidth,
- OMX_U32 iHeight
-)
-{
- OMXResult RetValue;
-
- /* check for argument error */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstUp == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstDown == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf((iWidth == 4) &&
- armNot4ByteAligned(pDstUp) &&
- armNot4ByteAligned(pDstDown), OMX_Sts_BadArgErr)
- armRetArgErrIf((iWidth == 8) &&
- armNot8ByteAligned(pDstUp) &&
- armNot8ByteAligned(pDstDown), OMX_Sts_BadArgErr)
- armRetArgErrIf((iWidth == 16) &&
- armNot16ByteAligned(pDstUp) &&
- armNot16ByteAligned(pDstDown), OMX_Sts_BadArgErr)
-
- armRetArgErrIf((iHeight != 16) && (iHeight != 8)&& (iHeight != 4), OMX_Sts_BadArgErr)
- armRetArgErrIf((iWidth != 16) && (iWidth != 8)&& (iWidth != 4), OMX_Sts_BadArgErr)
-
- RetValue = armVCM4P10_InterpolateHalfVer_Luma(
- pSrc - iSrcStep,
- iSrcStep,
- pDstUp,
- iDstStep,
- iWidth,
- iHeight);
-
- if (RetValue != OMX_Sts_NoErr)
- {
- return RetValue;
- }
-
- RetValue = armVCM4P10_InterpolateHalfVer_Luma(
- pSrc,
- iSrcStep,
- pDstDown,
- iDstStep,
- iWidth,
- iHeight);
-
- return RetValue;
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InterpolateLuma.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InterpolateLuma.c
deleted file mode 100644
index e2a8163..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InterpolateLuma.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_InterpolateLuma.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate Performs quarter-pixel interpolation
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: omxVCM4P10_InterpolateLuma (6.3.3.2.1)
- *
- * Description:
- * Performs quarter-pixel interpolation for inter luma MB. It is assumed that
- * the frame is already padded when calling this function.
- *
- * Input Arguments:
- *
- * pSrc -Pointer to the source reference frame buffer
- * srcStep -reference frame step, in bytes; must be a multiple of roi.width
- * dstStep -destination frame step, in bytes; must be a multiple of
- * roi.width
- * dx -Fractional part of horizontal motion vector component in 1/4 pixel
- * unit; valid in the range [0,3]
- * dy -Fractional part of vertical motion vector y component in 1/4 pixel
- * unit; valid in the range [0,3]
- * roi -Dimension of the interpolation region; the parameters roi.width and
- * roi.height must be equal to either 4, 8, or 16.
- *
- * Output Arguments:
- *
- * pDst -Pointer to the destination frame buffer if roi.width==4, 4-byte
- * alignment required if roi.width==8, 8-byte alignment required
- * if roi.width==16, 16-byte alignment required
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * pSrc or pDst is NULL.
- * srcStep or dstStep < roi.width.
- * dx or dy is out of range [0,3].
- * roi.width or roi.height is out of range {4, 8, 16}.
- * roi.width is equal to 4, but pDst is not 4 byte aligned.
- * roi.width is equal to 8 or 16, but pDst is not 8 byte aligned.
- * srcStep or dstStep is not a multiple of 8.
- *
- */
-
-OMXResult omxVCM4P10_InterpolateLuma (
- const OMX_U8* pSrc,
- OMX_S32 srcStep,
- OMX_U8* pDst,
- OMX_S32 dstStep,
- OMX_S32 dx,
- OMX_S32 dy,
- OMXSize roi
- )
-{
- /* check for argument error */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(srcStep < roi.width, OMX_Sts_BadArgErr)
- armRetArgErrIf(dstStep < roi.width, OMX_Sts_BadArgErr)
- armRetArgErrIf(dx < 0, OMX_Sts_BadArgErr)
- armRetArgErrIf(dx > 3, OMX_Sts_BadArgErr)
- armRetArgErrIf(dy < 0, OMX_Sts_BadArgErr)
- armRetArgErrIf(dy > 3, OMX_Sts_BadArgErr)
- armRetArgErrIf((roi.width != 4) && (roi.width != 8) && (roi.width != 16), OMX_Sts_BadArgErr)
- armRetArgErrIf((roi.height != 4) && (roi.height != 8) && (roi.height != 16), OMX_Sts_BadArgErr)
- armRetArgErrIf((roi.width == 4) && armNot4ByteAligned(pDst), OMX_Sts_BadArgErr)
- armRetArgErrIf((roi.width == 8) && armNot8ByteAligned(pDst), OMX_Sts_BadArgErr)
- armRetArgErrIf((roi.width == 16) && armNot16ByteAligned(pDst), OMX_Sts_BadArgErr)
- armRetArgErrIf(srcStep & 7, OMX_Sts_BadArgErr)
- armRetArgErrIf(dstStep & 7, OMX_Sts_BadArgErr)
-
- return armVCM4P10_Interpolate_Luma
- (pSrc, srcStep, pDst, dstStep, roi.width, roi.height, dx, dy);
-
-}
-
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InvTransformDequant_ChromaDC.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InvTransformDequant_ChromaDC.c
deleted file mode 100644
index 869e768..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InvTransformDequant_ChromaDC.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_InvTransformDequant_ChromaDC.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate 4x4 hadamard transform of chroma DC
- * coefficients and quantization
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: omxVCM4P10_InvTransformDequant_ChromaDC (6.3.5.6.4)
- *
- * Description:
- * This function performs inverse 2x2 Hadamard transform and then dequantizes
- * the coefficients.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the 2x2 array of the 2x2 Hadamard-transformed and
- * quantized coefficients. 8 byte alignment required.
- * iQP - Quantization parameter; must be in the range [0,51].
- *
- * Output Arguments:
- *
- * pDst - Pointer to inverse-transformed and dequantized coefficients.
- * 8-byte alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL: pSrc
- * - pSrc or pDst is not aligned on an 8-byte boundary
- *
- */
-OMXResult omxVCM4P10_InvTransformDequant_ChromaDC(
- const OMX_S16* pSrc,
- OMX_S16* pDst,
- OMX_U32 iQP
-)
-{
- OMX_INT i, j;
- OMX_S32 m[2][2];
- OMX_S32 QPer, V00, Value;
-
- /* check for argument error */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot8ByteAligned(pSrc), OMX_Sts_BadArgErr);
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot8ByteAligned(pDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(iQP > 51, OMX_Sts_BadArgErr)
-
- /* Inv Hadamard Transform for 2x2 block */
- m[0][0] = pSrc[0] + pSrc[1] + pSrc[2] + pSrc[3];
- m[0][1] = pSrc[0] - pSrc[1] + pSrc[2] - pSrc[3];
- m[1][0] = pSrc[0] + pSrc[1] - pSrc[2] - pSrc[3];
- m[1][1] = pSrc[0] - pSrc[1] - pSrc[2] + pSrc[3];
-
- /* Quantization */
- /* Scaling */
- QPer = iQP / 6;
- V00 = armVCM4P10_VMatrix [iQP % 6][0];
-
- for (j = 0; j < 2; j++)
- {
- for (i = 0; i < 2; i++)
- {
- if (QPer < 1)
- {
- Value = (m[j][i] * V00) >> 1;
- }
- else
- {
- Value = (m[j][i] * V00) << (QPer - 1);
- }
-
- pDst[j * 2 + i] = (OMX_S16) Value;
- }
- }
-
- return OMX_Sts_NoErr;
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InvTransformDequant_LumaDC.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InvTransformDequant_LumaDC.c
deleted file mode 100644
index 75f15cf..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InvTransformDequant_LumaDC.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_InvTransformDequant_LumaDC.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate 4x4 hadamard transform of luma DC coefficients
- * and quantization
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_InvTransformDequant_LumaDC (6.3.5.6.3)
- *
- * Description:
- * This function performs inverse 4x4 Hadamard transform and then dequantizes
- * the coefficients.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the 4x4 array of the 4x4 Hadamard-transformed and
- * quantized coefficients. 16 byte alignment required.
- * iQP - Quantization parameter; must be in the range [0,51].
- *
- * Output Arguments:
- *
- * pDst - Pointer to inverse-transformed and dequantized coefficients.
- * 16-byte alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL: pSrc
- * - pSrc or pDst is not aligned on a 16-byte boundary
- *
- */
-OMXResult omxVCM4P10_InvTransformDequant_LumaDC(
- const OMX_S16* pSrc,
- OMX_S16* pDst,
- OMX_U32 iQP
-)
-{
- OMX_INT i, j;
- OMX_S32 m1[4][4], m2[4][4], Value;
- OMX_S32 QPer, V;
-
- /* check for argument error */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(iQP > 51, OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot16ByteAligned(pSrc), OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot16ByteAligned(pDst), OMX_Sts_BadArgErr)
-
- /* Inv Hadamard Transform for DC Luma 4x4 block */
- /* Horizontal */
- for (i = 0; i < 4; i++)
- {
- j = i * 4;
-
- m1[i][0] = pSrc[j + 0] + pSrc[j + 2]; /* a+c */
- m1[i][1] = pSrc[j + 1] + pSrc[j + 3]; /* b+d */
- m1[i][2] = pSrc[j + 0] - pSrc[j + 2]; /* a-c */
- m1[i][3] = pSrc[j + 1] - pSrc[j + 3]; /* b-d */
-
- m2[i][0] = m1[i][0] + m1[i][1]; /* a+b+c+d */
- m2[i][1] = m1[i][2] + m1[i][3]; /* a+b-c-d */
- m2[i][2] = m1[i][2] - m1[i][3]; /* a-b-c+d */
- m2[i][3] = m1[i][0] - m1[i][1]; /* a-b+c-d */
-
- }
-
- /* Vertical */
- for (i = 0; i < 4; i++)
- {
- m1[0][i] = m2[0][i] + m2[2][i];
- m1[1][i] = m2[1][i] + m2[3][i];
- m1[2][i] = m2[0][i] - m2[2][i];
- m1[3][i] = m2[1][i] - m2[3][i];
-
- m2[0][i] = m1[0][i] + m1[1][i];
- m2[1][i] = m1[2][i] + m1[3][i];
- m2[2][i] = m1[2][i] - m1[3][i];
- m2[3][i] = m1[0][i] - m1[1][i];
- }
-
-
- /* Scaling */
- QPer = iQP / 6;
- V = armVCM4P10_VMatrix [iQP % 6][0];
-
- for (j = 0; j < 4; j++)
- {
- for (i = 0; i < 4; i++)
- {
- if (QPer < 2)
- {
- Value = (m2[j][i] * V + (1 << (1 - QPer))) >> (2 - QPer);
- }
- else
- {
- Value = m2[j][i] * V * (1 << (QPer - 2));
- }
-
- pDst[j * 4 + i] = (OMX_S16) Value;
-
- }
- }
- return OMX_Sts_NoErr;
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InvTransformResidualAndAdd.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InvTransformResidualAndAdd.c
deleted file mode 100644
index e3e4519..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InvTransformResidualAndAdd.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_InvTransformResidualAndAdd.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will inverse integer 4x4 transform
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_InvTransformResidualAndAdd (6.3.5.7.1)
- *
- * Description:
- * This function performs inverse an 4x4 integer transformation to produce
- * the difference signal and then adds the difference to the prediction to get
- * the reconstructed signal.
- *
- * Input Arguments:
- *
- * pSrcPred - Pointer to prediction signal. 4-byte alignment required.
- * pDequantCoeff - Pointer to the transformed coefficients. 8-byte
- * alignment required.
- * iSrcPredStep - Step of the prediction buffer; must be a multiple of 4.
- * iDstReconStep - Step of the destination reconstruction buffer; must be a
- * multiple of 4.
- * bAC - Indicate whether there is AC coefficients in the coefficients
- * matrix.
- *
- * Output Arguments:
- *
- * pDstRecon -Pointer to the destination reconstruction buffer. 4-byte
- * alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrcPred, pDequantCoeff, pDstRecon
- * - pSrcPred is not aligned on a 4-byte boundary
- * - iSrcPredStep or iDstReconStep is not a multiple of 4.
- * - pDequantCoeff is not aligned on an 8-byte boundary
- *
- */
-OMXResult omxVCM4P10_InvTransformResidualAndAdd(
- const OMX_U8* pSrcPred,
- const OMX_S16* pDequantCoeff,
- OMX_U8* pDstRecon,
- OMX_U32 iSrcPredStep,
- OMX_U32 iDstReconStep,
- OMX_U8 bAC
-)
-{
- OMX_INT i, j;
- OMX_S16 In[16], Out[16];
- OMX_S32 Value;
-
- /* check for argument error */
- armRetArgErrIf(pSrcPred == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot4ByteAligned(pSrcPred), OMX_Sts_BadArgErr)
- armRetArgErrIf(pDequantCoeff == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot8ByteAligned(pDequantCoeff), OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstRecon == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot4ByteAligned(pDstRecon), OMX_Sts_BadArgErr)
- armRetArgErrIf(bAC > 1, OMX_Sts_BadArgErr)
- armRetArgErrIf(iSrcPredStep == 0 || iSrcPredStep & 3, OMX_Sts_BadArgErr)
- armRetArgErrIf(iDstReconStep == 0 || iDstReconStep & 3, OMX_Sts_BadArgErr)
-
- if (bAC)
- {
- for (i = 0; i < 16; i++)
- {
- In[i] = pDequantCoeff [i];
- }
- }
- else
- {
- /* Copy DC */
- In[0] = pDequantCoeff [0];
-
- for (i = 1; i < 16; i++)
- {
- In[i] = 0;
- }
- }
-
- /* Residual Transform */
- armVCM4P10_TransformResidual4x4 (Out, In);
-
- for (j = 0; j < 4; j++)
- {
- for (i = 0; i < 4; i++)
- {
- /* Add predition */
- Value = (OMX_S32) Out [j * 4 + i] + pSrcPred [j * iSrcPredStep + i];
-
- /* Saturate Value to OMX_U8 */
- Value = armClip (0, 255, Value);
-
- pDstRecon[j * iDstReconStep + i] = (OMX_U8) Value;
- }
- }
-
- return OMX_Sts_NoErr;
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_MEGetBufSize.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_MEGetBufSize.c
deleted file mode 100644
index 7a245e1..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_MEGetBufSize.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_MEGetBufSize.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Initialization modules for the vendor specific Motion Estimation structure.
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: omxVCM4P10_MEGetBufSize (6.3.5.1.1)
- *
- * Description:
- * Computes the size, in bytes, of the vendor-specific specification
- * structure for the omxVCM4P10 motion estimation functions BlockMatch_Integer
- * and MotionEstimationMB.
- *
- * Input Arguments:
- *
- * MEmode - motion estimation mode; available modes are defined by the
- * enumerated type OMXVCM4P10MEMode
- * pMEParams -motion estimation parameters
- *
- * Output Arguments:
- *
- * pSize - pointer to the number of bytes required for the motion
- * estimation specification structure
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - pMEParams or pSize is NULL.
- * - an invalid MEMode is specified.
- *
- */
-
-OMXResult omxVCM4P10_MEGetBufSize(
- OMXVCM4P10MEMode MEMode,
- const OMXVCM4P10MEParams *pMEParams,
- OMX_U32 *pSize
- )
-{
- armRetArgErrIf(!pMEParams, OMX_Sts_BadArgErr);
- armRetArgErrIf(!pSize, OMX_Sts_BadArgErr);
- armRetArgErrIf((MEMode != OMX_VC_M4P10_FAST_SEARCH) &&
- (MEMode != OMX_VC_M4P10_FULL_SEARCH), OMX_Sts_BadArgErr);
- armRetArgErrIf((pMEParams->searchRange16x16 <= 0) ||
- (pMEParams->searchRange8x8 <= 0) ||
- (pMEParams->searchRange4x4 <= 0), OMX_Sts_BadArgErr);
-
- *pSize = (OMX_INT) sizeof(ARMVCM4P10_MESpec);
-
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_MEInit.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_MEInit.c
deleted file mode 100644
index e463353..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_MEInit.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_MEInit.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Initialization modules for the vendor specific Motion Estimation structure.
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: omxVCM4P10_MEInit (6.3.5.1.2)
- *
- * Description:
- * Initializes the vendor-specific specification structure required for the
- * omxVCM4P10 motion estimation functions: BlockMatch_Integer and
- * MotionEstimationMB. Memory for the specification structure *pMESpec must be
- * allocated prior to calling the function, and should be aligned on a 4-byte
- * boundary. The number of bytes required for the specification structure can
- * be determined using the function omxVCM4P10_MEGetBufSize. Following
- * initialization by this function, the vendor-specific structure *pMESpec
- * should contain an implementation-specific representation of all motion
- * estimation parameters received via the structure pMEParams, for example
- * searchRange16x16, searchRange8x8, etc.
- *
- * Input Arguments:
- *
- * MEmode - motion estimation mode; available modes are defined by the
- * enumerated type OMXVCM4P10MEMode
- * pMEParams - motion estimation parameters
- * pMESpec - pointer to the uninitialized ME specification structure
- *
- * Output Arguments:
- *
- * pMESpec - pointer to the initialized ME specification structure
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - pMEParams or pSize is NULL.
- * - an invalid value was specified for the parameter MEmode
- * - a negative or zero value was specified for one of the search ranges
- * (e.g., pMBParams >searchRange8x8, pMEParams->searchRange16x16, etc.)
- * - either in isolation or in combination, one or more of the enables or
- * search ranges in the structure *pMEParams were configured such
- * that the requested behavior fails to comply with [ISO14496-10].
- *
- */
-
-OMXResult omxVCM4P10_MEInit(
- OMXVCM4P10MEMode MEMode,
- const OMXVCM4P10MEParams *pMEParams,
- void *pMESpec
- )
-{
- ARMVCM4P10_MESpec *armMESpec = (ARMVCM4P10_MESpec *) pMESpec;
-
- armRetArgErrIf(!pMEParams, OMX_Sts_BadArgErr);
- armRetArgErrIf(!pMESpec, OMX_Sts_BadArgErr);
- armRetArgErrIf((MEMode != OMX_VC_M4P10_FAST_SEARCH) &&
- (MEMode != OMX_VC_M4P10_FULL_SEARCH), OMX_Sts_BadArgErr);
- armRetArgErrIf((pMEParams->searchRange16x16 <= 0) ||
- (pMEParams->searchRange8x8 <= 0) ||
- (pMEParams->searchRange4x4 <= 0), OMX_Sts_BadArgErr);
-
- armMESpec->MEParams.blockSplitEnable8x8 = pMEParams->blockSplitEnable8x8;
- armMESpec->MEParams.blockSplitEnable4x4 = pMEParams->blockSplitEnable4x4;
- armMESpec->MEParams.halfSearchEnable = pMEParams->halfSearchEnable;
- armMESpec->MEParams.quarterSearchEnable = pMEParams->quarterSearchEnable;
- armMESpec->MEParams.intraEnable4x4 = pMEParams->intraEnable4x4;
- armMESpec->MEParams.searchRange16x16 = pMEParams->searchRange16x16;
- armMESpec->MEParams.searchRange8x8 = pMEParams->searchRange8x8;
- armMESpec->MEParams.searchRange4x4 = pMEParams->searchRange4x4;
- armMESpec->MEMode = MEMode;
-
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_MotionEstimationMB.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_MotionEstimationMB.c
deleted file mode 100644
index 5264394..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_MotionEstimationMB.c
+++ /dev/null
@@ -1,1907 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/** x
- *
- * File Name: omxVCM4P10_MotionEstimationMB.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function perform MB level motion estimation
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-#define ARM_VCM4P10_MAX_FRAMES (15)
-#define ARM_VCM4P10_MAX_4x4_SAD (0xffff)
-#define ARM_VCM4P10_MAX_MODE_VALUE (0xffffffff)
-#define ARM_VCM4P10_MAX_MODES (16)
-#define ARM_VCM4P10_MB_BLOCK_SIZE (16)
-#define ARM_VCM4P10_MEDIAN(a,b,c) (a>b?a>c?b>c?b:c:a:b>c?a>c?a:c:b)
-#define ARM_VCM4P10_SHIFT_QP (12)
-
-#define ARM_VCM4P10_MVPRED_MEDIAN (0)
-#define ARM_VCM4P10_MVPRED_L (1)
-#define ARM_VCM4P10_MVPRED_U (2)
-#define ARM_VCM4P10_MVPRED_UR (3)
-
-#define ARM_VCM4P10_MB_BLOCK_SIZE (16)
-#define ARM_VCM4P10_BLOCK_SIZE (4)
-#define ARM_VCM4P10_MAX_COST (1 << 30)
-#define ARM_VCM4P10_INVALID_BLOCK (-2)
-
-
-/**
- * Function: armVCM4P10_CalculateBlockSAD
- *
- * Description:
- * Calculate SAD value for the selected MB encoding mode and update
- * pDstBlockSAD parameter. These SAD values are calculated 4x4 blocks at
- * a time and in the scan order.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcMBInfo -
- * [in] pSrcCurrBuf -
- * [in] SrcCurrStep -
- * [in] pSrcRefBufList-
- * [in] SrcRefStep -
- * [in] pSrcRecBuf -
- * [in] SrcRecStep -
- * [in] pRefRect -
- * [in] pCurrPointPos -
- * [in] Lambda -
- * [in] pMESpec -
- * [in] pMBInter -
- * [in] pMBIntra -
- * [out] pDstBlockSAD - pointer to 16 element array for SAD corresponding to 4x4 blocks
- * Return Value:
- * None
- *
- */
-
-static OMXResult armVCM4P10_CalculateBlockSAD(
- OMXVCM4P10MBInfo *pSrcMBInfo,
- const OMX_U8 *pSrcCurrBuf,
- OMX_S32 SrcCurrStep,
- const OMX_U8 *pSrcRefBufList[ARM_VCM4P10_MAX_FRAMES],
- OMX_S32 SrcRefStep,
- const OMX_U8 *pSrcRecBuf,
- OMX_S32 SrcRecStep,
- const OMXRect *pRefRect,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- const OMXVCM4P10MBInfoPtr *pMBInter,
- const OMXVCM4P10MBInfoPtr *pMBIntra,
- OMX_U16 *pDstBlockSAD)
-{
- OMX_INT InvalidSAD = 0;
- OMX_INT i;
-
- OMX_U8 Buffer [16*16 + 15];
- OMX_U8 *pTempDstBuf;
- OMX_S32 TempDstStep;
- OMX_U8 *pTempRefBuf;
- OMX_S32 TempRefStep;
-
- /* Temporary buffer to store the predicted mb coefficients */
- pTempDstBuf = armAlignTo16Bytes(Buffer);
- TempDstStep = 16;
-
- /* Update pDstBlockSAD if MB is a valid type */
- if (pSrcMBInfo)
- {
- OMX_U32 Width=0, Height=0, MaxXPart, MaxYPart,MaxSubXPart,MaxSubYPart;
-
- /* Depending on type of MB, do prediction and fill temp buffer */
- switch (pSrcMBInfo->mbType)
- {
- case OMX_VC_P_16x16:
- Width = 16;
- Height = 16;
- break;
- case OMX_VC_P_16x8:
- Width = 16;
- Height = 8;
- break;
- case OMX_VC_P_8x16:
- Width = 8;
- Height = 16;
- break;
- case OMX_VC_P_8x8:
- Width = 8;
- Height = 8;
- break;
- case OMX_VC_INTRA_4x4:
- {
- /* Create predicted MB Intra4x4 mode */
- OMX_S32 PredIntra4x4Mode [5][9];
- OMX_S32 x, y, Block8x8, Block4x4, BlockX, BlockY;
- OMX_U8 pSrcYBuff [(16*3)*(16*2)];
- OMX_U8 *pSrcY;
- OMX_S32 StepSrcY;
- OMX_S32 availability;
-
- for (y = 0; y < 5; y++)
- {
- for (x = 0; x < 9; x++)
- {
- /*
- * Initialize with value of ARM_VCM4P10_INVALID_BLOCK, to mean this
- * 4x4 block is not available
- */
- PredIntra4x4Mode [y][x] = ARM_VCM4P10_INVALID_BLOCK;
- }
- }
-
- /* Replace ARM_VCM4P10_INVALID_BLOCK value with available MBs values*/
- for (x = 0; x < 4; x++)
- {
- /* Store values of b0, b1, b2, b3 */
- if (pMBIntra[1] != NULL)
- {
- PredIntra4x4Mode [0][x + 1] =
- pMBIntra[1]->pIntra4x4PredMode[3*4 + x];
- }
-
- /* Store values of d0, d1, d2, d3 */
- if (pMBIntra[3] != NULL)
- {
- PredIntra4x4Mode [0][x + 5] =
- pMBIntra[3]->pIntra4x4PredMode[3*4 + x];
- }
- }
-
- /* Store values of c3 */
- if (pMBIntra[2] != NULL)
- {
- PredIntra4x4Mode [0][0] = pMBIntra[2]->pIntra4x4PredMode[15];
- }
-
- for (y = 0; y < 4; y++)
- {
- /* Store values of a0, a1, a2, a3 */
- if (pMBIntra[0] != NULL)
- {
- PredIntra4x4Mode [y + 1][0] =
- pMBIntra[0]->pIntra4x4PredMode[y*4 + 3];
- }
- }
-
- /*
- * Update neighbouring Pred mode array which will be used for
- * prediction of Intra4x4 modes.
- */
-
- pSrcY = pSrcYBuff;
- StepSrcY = 16 * 3;
- for (y = 0; y < (16 * 2); y++)
- {
- for (x = 0; x < (16 * 3); x++)
- {
- pSrcY [StepSrcY * y + x] =
- pSrcRecBuf [SrcRecStep * (y - 16) + x - 16];
- }
- }
-
-
- /* for each 8x8 block */
- for (Block8x8 = 0; Block8x8 < 4; Block8x8++)
- {
- /* for each 4x4 block inside 8x8 block */
- for (Block4x4 = 0; Block4x4 < 4; Block4x4++)
- {
- /* Get block cordinates from 8x8 block index and 4x4 block index */
- BlockX = ((Block8x8 & 1) << 1) + (Block4x4 & 1);
- BlockY = ((Block8x8 >> 1) << 1) + (Block4x4 >> 1);
-
- /* Add offset to point to start of current MB in the array pIntra4x4PredMode */
- x = BlockX + 1;
- y = BlockY + 1;
-
- availability = 0;
-
- /* Check for availability of LEFT Block */
- if (PredIntra4x4Mode [y][x - 1] != ARM_VCM4P10_INVALID_BLOCK)
- {
- availability |= OMX_VC_LEFT;
- }
-
- /* Check for availability of UPPER Block */
- if (PredIntra4x4Mode [y - 1][x] != ARM_VCM4P10_INVALID_BLOCK)
- {
- availability |= OMX_VC_UPPER;
- }
-
- /* Check for availability of UPPER LEFT Block */
- if (PredIntra4x4Mode [y - 1][x - 1] != ARM_VCM4P10_INVALID_BLOCK)
- {
- availability |= OMX_VC_UPPER_LEFT;
- }
-
- PredIntra4x4Mode [y][x] = pSrcMBInfo->pIntra4x4PredMode[BlockY*4+BlockX];
- x = BlockX * 4;
- y = BlockY * 4;
-
- pSrcY = pSrcYBuff + 16 * StepSrcY + 16 + y * StepSrcY + x;
-
- omxVCM4P10_PredictIntra_4x4(
- pSrcY - 1,
- pSrcY - StepSrcY,
- pSrcY - StepSrcY - 1,
- pTempDstBuf + x + y * TempDstStep,
- StepSrcY,
- TempDstStep,
- pSrcMBInfo->pIntra4x4PredMode[BlockY*4+BlockX],
- availability);
-
- for (BlockY=0;BlockY<4;BlockY++)
- {
- for(BlockX=0;BlockX<4;BlockX++)
- {
- pSrcY [BlockY * StepSrcY + BlockX] =
- (OMX_U8)(*(pTempDstBuf + x + y * TempDstStep + BlockY * TempDstStep + BlockX));
- }
- }
-
- }
- }
- break;
- }
- case OMX_VC_INTRA_16x16:
- {
- OMX_U32 MBPosX = pCurrPointPos->x >> 4;
- OMX_U32 MBPosY = pCurrPointPos->y >> 4;
- OMX_U32 availability = 0;
-
- /* Check for availability of LEFT MB */
- if ((MBPosX != 0) && (pMBIntra [0] != 0 || pMBInter [0] != 0))
- {
- availability |= OMX_VC_LEFT;
- }
-
- /* Check for availability of UP MB */
- if ((MBPosY != 0) && (pMBIntra [1] != 0 || pMBInter [1] != 0))
- {
- availability |= OMX_VC_UPPER;
- }
-
- /* Check for availability of UP-LEFT MB */
- if ((MBPosX > 0) && (MBPosY > 0) &&
- (pMBIntra [2] != 0 || pMBInter [2] != 0))
- {
- availability |= OMX_VC_UPPER_LEFT;
- }
-
- omxVCM4P10_PredictIntra_16x16(
- pSrcRecBuf - 1,
- pSrcRecBuf - SrcRecStep,
- pSrcRecBuf - SrcRecStep - 1,
- pTempDstBuf,
- SrcRecStep,
- TempDstStep,
- pSrcMBInfo->Intra16x16PredMode,
- availability);
-
- break;
- }
-
- case OMX_VC_INTER_SKIP:
- case OMX_VC_PREF0_8x8:
- case OMX_VC_INTRA_PCM:
- default:
- /* These cases will update pDstBlockSAD with MAX value */
- InvalidSAD = 1;
- break;
- }
-
- /* INTER MB */
- if ((pSrcMBInfo->mbType == OMX_VC_P_16x16) ||
- (pSrcMBInfo->mbType == OMX_VC_P_8x16) ||
- (pSrcMBInfo->mbType == OMX_VC_P_16x8) ||
- (pSrcMBInfo->mbType == OMX_VC_P_8x8))
- {
- const OMX_U8 *pTempSrcBuf;
- OMX_S32 TempSrcStep;
- OMX_S32 mvx,mvy;
- OMX_U32 PartX, PartY, SubPartX, SubPartY;
-
- TempSrcStep = SrcRefStep;
-
- MaxXPart = 16/Width;
- MaxYPart = 16/Height;
-
-
- for (PartY = 0; PartY < MaxYPart; PartY++)
- {
- for (PartX = 0; PartX < MaxXPart; PartX++)
- {
-
- pTempSrcBuf = pSrcRefBufList[pSrcMBInfo->pRefL0Idx[PartY * 2 + PartX]];
-
- if (MaxXPart == 2 && MaxYPart == 2)
- {
- switch (pSrcMBInfo->subMBType[PartY*2+PartX])
- {
- case OMX_VC_SUB_P_8x8:
- Width = 8;
- Height = 8;
- break;
- case OMX_VC_SUB_P_8x4:
- Width = 8;
- Height = 4;
- break;
- case OMX_VC_SUB_P_4x8:
- Width = 4;
- Height = 8;
- break;
- case OMX_VC_SUB_P_4x4:
- Width = 4;
- Height = 4;
- break;
- default:
- /* Default */
- Width = 4;
- Height = 4;
- break;
- }
-
- MaxSubXPart = 8/Width;
- MaxSubYPart = 8/Height;
-
- for (SubPartY = 0; SubPartY < MaxSubYPart; SubPartY++)
- {
- for (SubPartX = 0; SubPartX < MaxSubXPart; SubPartX++)
- {
- mvx = pSrcMBInfo->pMV0 [2*PartY + SubPartY][2*PartX + SubPartX].dx;
- mvy = pSrcMBInfo->pMV0 [2*PartY + SubPartY][2*PartX + SubPartX].dy;
- armVCM4P10_Interpolate_Luma(
- pTempSrcBuf + (8*PartX + 4*SubPartX + (mvx/4)) + (8*PartY + 4*SubPartY + (mvy/4)) * TempSrcStep,
- TempSrcStep,
- pTempDstBuf + (8*PartX + 4*SubPartX) + (8*PartY + 4*SubPartY) * TempDstStep,
- TempDstStep,
- Width,
- Height,
- mvx & 3,
- mvy & 3
- );
- }
- }
- }
- else
- {
-
- mvx = pSrcMBInfo->pMV0 [2*PartY][2*PartX].dx;
- mvy = pSrcMBInfo->pMV0 [2*PartY][2*PartX].dy;
- armVCM4P10_Interpolate_Luma(
- pTempSrcBuf + (8*PartX + (mvx/4)) + (8*PartY + (mvy/4)) * TempSrcStep,
- TempSrcStep,
- pTempDstBuf + (8*PartX) + (8*PartY) * TempDstStep,
- TempDstStep,
- Width,
- Height,
- mvx & 3,
- mvy & 3
- );
-
- }
- }
- }
- }
- }
- else
- {
- InvalidSAD = 1;
- }
-
- /* Calculate SAD from predicted buffer */
- if (!InvalidSAD)
- {
- OMX_U32 x8x8, y8x8, x4x4, y4x4, Block8x8, Block4x4;
- OMX_S32 SAD;
-
- pTempRefBuf = pTempDstBuf;
- TempRefStep = 16;
-
- /* SAD for each 4x4 block in scan order */
- for (Block8x8 = 0; Block8x8 < 4; Block8x8++)
- {
- x8x8 = 8*(Block8x8 & 1);
- y8x8 = 8*(Block8x8 >> 1);
- for (Block4x4 = 0; Block4x4 < 4; Block4x4++)
- {
- x4x4 = 4*(Block4x4 & 1);
- y4x4 = 4*(Block4x4 >> 1);
-
- armVCCOMM_SAD(
- pSrcCurrBuf + (x8x8 + x4x4) + (y8x8 + y4x4) * SrcCurrStep,
- SrcCurrStep,
- pTempRefBuf + (x8x8 + x4x4) + (y8x8 + y4x4) * TempRefStep,
- TempRefStep,
- &SAD,
- 4, /* Height */
- 4); /* Width */
- *(pDstBlockSAD + 4 * Block8x8 + Block4x4) = (SAD < 0x7fff) ? (OMX_U16) SAD : ARM_VCM4P10_MAX_MODE_VALUE;
- }
- }
- }
- else
- {
- /* Fill SADs with max values and return*/
- for (i = 0; i < 16; i++)
- {
- pDstBlockSAD [i] = ARM_VCM4P10_MAX_4x4_SAD;
- }
- }
- return OMX_Sts_NoErr;
-}
-
-
-
-/**
- * Function: armVCM4P10_Mode4x4Decision
- *
- * Description:
- * Intra 4x4 Mode decision by calculating cost for all possible modes and
- * choosing the best mode
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcCurrBuf - Pointer to the start of current Macroblock
- * [in] SrcCurrStep - Step size of the pointer pSrcCurrBuf
- * [in/out] pSrcDstMBCurr - Pointer to the OMXVCM4P10MBInfo which will be updated for
- * field pIntra4x4PredMode of the current block.
- * [in] Block8x8 - Index 8x8 block in which current 4x4 block belongs
- * [in] Block4x4 - Index of current 4x4 block
- * [in/out] pPredIntra4x4SrcY - Pointer to current block location in buffer
- * with reconstructed values. This will be modified by this
- * function with best mode predicted values
- * [in] StepPredIntra4x4SrcY - Step size of the pointer pPredIntra4x4SrcY
- * [in] pIntra4x4PredMode - Array of Intra 4x4 prediction mode for the MB.
- * Current MB modes starts at [1,1].
- * [in] pBestCost - Cost for the Best Intra 4x4 mode
- * Return Value:
- * None
- *
- */
-static OMXVoid armVCM4P10_Mode4x4Decision (
- const OMX_U8* pSrcCurrBuf,
- OMX_S32 SrcCurrStep,
- OMXVCM4P10MBInfo *pSrcDstMBCurr,
- OMX_S32 Block8x8,
- OMX_S32 Block4x4,
- OMX_U8 *pPredIntra4x4SrcY,
- OMX_S32 StepPredIntra4x4SrcY,
- OMX_S32 pIntra4x4PredMode [][9],
- OMX_S32 *pBestCost
-)
-{
- OMX_S32 i, j, x, y, BlockX, BlockY, mode;
- OMX_S32 Cost, BestCost;
- OMX_U8 *pSrcY;
- OMX_S32 StepSrcY;
- OMX_S32 availability = 0;
- OMX_U8 pPredBlock [4*4];
- OMXResult Ret = OMX_Sts_Err;
-
- /* Get block cordinates from 8x8 block index and 4x4 block index */
- BlockX = ((Block8x8 & 1) << 1) + (Block4x4 & 1);
- BlockY = ((Block8x8 >> 1) << 1) + (Block4x4 >> 1);
-
- /* Add offset to point to start of current MB in the array pIntra4x4PredMode */
- x = BlockX + 1;
- y = BlockY + 1;
-
- /* Check for availability of LEFT Block */
- if (pIntra4x4PredMode [y][x - 1] != ARM_VCM4P10_INVALID_BLOCK)
- {
- availability |= OMX_VC_LEFT;
- }
-
- /* Check for availability of UPPER Block */
- if (pIntra4x4PredMode [y - 1][x] != ARM_VCM4P10_INVALID_BLOCK)
- {
- availability |= OMX_VC_UPPER;
- }
-
- /* Check for availability of UPPER LEFT Block */
- if (pIntra4x4PredMode [y - 1][x - 1] != ARM_VCM4P10_INVALID_BLOCK)
- {
- availability |= OMX_VC_UPPER_LEFT;
- }
-
- pSrcY = pPredIntra4x4SrcY +
- StepPredIntra4x4SrcY * (BlockY << 2) +
- (BlockX << 2);
-
- StepSrcY = StepPredIntra4x4SrcY;
-
- x = BlockX * 4;
- y = BlockY * 4;
-
- Cost = BestCost = ARM_VCM4P10_MAX_COST;
-
- /* Go through each mode for minim cost */
- for (mode = 0; mode < 9; mode++)
- {
- Ret = omxVCM4P10_PredictIntra_4x4(
- pSrcY - 1,
- pSrcY - StepSrcY,
- pSrcY - StepSrcY - 1,
- pPredBlock,
- StepSrcY,
- 4,
- (OMXVCM4P10Intra4x4PredMode) mode,
- availability);
-
- if (Ret == OMX_Sts_NoErr)
- {
- armVCCOMM_SAD(
- pSrcCurrBuf + (y * SrcCurrStep) + x,
- SrcCurrStep,
- pPredBlock,
- 4,
- &Cost,
- 4,
- 4);
-
- if (Cost < BestCost)
- {
- BestCost = Cost;
-
- pIntra4x4PredMode [BlockY + 1][BlockX + 1] =
- (OMXVCM4P10Intra4x4PredMode) mode;
- pSrcDstMBCurr->pIntra4x4PredMode [BlockY * 4 + BlockX] =
- (OMXVCM4P10Intra4x4PredMode) mode;
-
- for (j = 0; j < 4; j++)
- {
- for (i = 0; i < 4; i++)
- {
- pSrcY [StepSrcY * j + i] = pPredBlock [4 * j + i];
- }
- }
- }
- }
- }
-
- *pBestCost = BestCost;
- return;
-}
-
-/**
- * Function: armVCM4P10_SetMotionVectorPredictor
- *
- * Description:
- * This function will do the MV Prediction for Inter MBs
- *
- * Parameters:
- * [in] BlockStartX - Start X index in integer pels in current Block
- * [in] BlockStartY - Start Y index in integer pels in current Block
- * [in] BlockSizeX - Width of current block
- * [in] BlockSizeY - Height of current block
- * [in] RefFrame - Index of the reference frame for prediction
- * [in] pRefFrArr - Pointer to Ref array storing neighbouring MVs for MV prediction
- * [in] pMVArr - Pointer to MV array storing neighbouring MVs for MV prediction
- * [out] pMVPred - Pointer to predicted MVs
- * Remarks:
- *
- * Return Value:
- * None
- *
- */
-static OMXVoid armVCM4P10_SetMotionVectorPredictor(
- OMX_U32 BlockStartX,
- OMX_U32 BlockStartY,
- OMX_U32 BlockSizex,
- OMX_U32 BlockSizey,
- OMX_S32 RefFrame,
- OMX_S32 pRefFrArr[][6],
- OMXVCMotionVector pMVArr[][12],
- OMXVCMotionVector *pMVPred
-)
-{
- OMX_S32 RFrameL; /* Left */
- OMX_S32 RFrameU; /* Up */
- OMX_S32 RFrameUR; /* Up-Right */
-
- OMX_S32 BlockX, BlockY, BlockXFr, BlockYFr, MVPredType;
- OMX_S32 BlockXPlusOff, BlockXPlusOffFr, BlockXMin1Fr, BlockYMin1Fr;
-
- BlockX = 4 + (BlockStartX >> 2);
- BlockY = 4 + (BlockStartY >> 2);
- BlockXPlusOff = BlockX + (BlockSizex >> 2);
-
- BlockXFr = BlockX >> 1;
- BlockYFr = BlockY >> 1;
- BlockXMin1Fr = (BlockX - 1) >> 1;
- BlockYMin1Fr = (BlockY - 1) >> 1;
- BlockXPlusOffFr = BlockXPlusOff >> 1;
-
- MVPredType = ARM_VCM4P10_MVPRED_MEDIAN;
-
- RFrameL = pRefFrArr [BlockYFr][BlockXMin1Fr];
- RFrameU = pRefFrArr [BlockYMin1Fr][BlockXFr];
- RFrameUR = pRefFrArr [BlockYMin1Fr][BlockXPlusOffFr];
-
- if (RFrameUR == ARM_VCM4P10_INVALID_BLOCK)
- {
- RFrameUR = pRefFrArr [BlockYMin1Fr][BlockXMin1Fr];
- }
-
- /*
- * Prediction if only one of the neighbors uses the reference frame
- * we are checking
- */
-
- if (RFrameL == RefFrame && RFrameU != RefFrame && RFrameUR != RefFrame)
- {
- MVPredType = ARM_VCM4P10_MVPRED_L;
- }
- else if(RFrameL != RefFrame && RFrameU == RefFrame && RFrameUR != RefFrame)
- {
- MVPredType = ARM_VCM4P10_MVPRED_U;
- }
- else if(RFrameL != RefFrame && RFrameU != RefFrame && RFrameUR == RefFrame)
- {
- MVPredType = ARM_VCM4P10_MVPRED_UR;
- }
-
- /* Directional predictions */
- else if(BlockSizex == 8 && BlockSizey == 16)
- {
- if(BlockStartX == 0)
- {
- if(RFrameL == RefFrame)
- {
- MVPredType = ARM_VCM4P10_MVPRED_L;
- }
- }
- else
- {
- if (RFrameUR == RefFrame)
- {
- MVPredType = ARM_VCM4P10_MVPRED_UR;
- }
- }
- }
- else if(BlockSizex == 16 && BlockSizey == 8)
- {
- if(BlockStartY == 0)
- {
- if(RFrameU == RefFrame)
- {
- MVPredType = ARM_VCM4P10_MVPRED_U;
- }
- }
- else
- {
- if(RFrameL == RefFrame)
- {
- MVPredType = ARM_VCM4P10_MVPRED_L;
- }
- }
- }
-
- switch (MVPredType)
- {
- case ARM_VCM4P10_MVPRED_MEDIAN:
- if (!(pRefFrArr [BlockYMin1Fr][BlockXMin1Fr] == ARM_VCM4P10_INVALID_BLOCK ||
- pRefFrArr [BlockYMin1Fr][BlockXFr] == ARM_VCM4P10_INVALID_BLOCK ||
- pRefFrArr [BlockYMin1Fr][BlockXPlusOffFr] == ARM_VCM4P10_INVALID_BLOCK))
- {
- pMVPred->dx = pMVArr [BlockY][BlockX - 1].dx;
- pMVPred->dy = pMVArr [BlockY][BlockX - 1].dy;
- }
- else
- {
- pMVPred->dx =
- ARM_VCM4P10_MEDIAN(pMVArr [BlockY][BlockX - 1].dx,
- pMVArr [BlockY - 1][BlockX].dx,
- pMVArr [BlockY - 1][BlockXPlusOff].dx);
- pMVPred->dy =
- ARM_VCM4P10_MEDIAN(pMVArr [BlockY][BlockX - 1].dy,
- pMVArr [BlockY - 1][BlockX].dy,
- pMVArr [BlockY - 1][BlockXPlusOff].dy);
- }
- break;
-
- case ARM_VCM4P10_MVPRED_L:
- pMVPred->dx = pMVArr [BlockY][BlockX - 1].dx;
- pMVPred->dy = pMVArr [BlockY][BlockX - 1].dy;
- break;
- case ARM_VCM4P10_MVPRED_U:
- pMVPred->dx = pMVArr [BlockY - 1][BlockX].dx;
- pMVPred->dy = pMVArr [BlockY - 1][BlockX].dy;
- break;
- case ARM_VCM4P10_MVPRED_UR:
- if (pRefFrArr [BlockYMin1Fr][BlockXPlusOffFr] != ARM_VCM4P10_INVALID_BLOCK)
- {
- pMVPred->dx = pMVArr [BlockY - 1][BlockXPlusOff].dx;
- pMVPred->dy = pMVArr [BlockY - 1][BlockXPlusOff].dy;
- }
- else
- {
- pMVPred->dx = pMVArr [BlockY - 1][BlockX - 1].dx;
- pMVPred->dy = pMVArr [BlockY - 1][BlockX - 1].dy;
- }
- break;
- default:
- break;
- }
-
- return;
-}
-
-/**
- * Function: armVCM4P10_BlockMotionSearch
- *
- * Description:
- * Gets best MV for the current block
- *
- * Parameters:
- * [in] pSrcCurrBuf - Pointer to the start of luma component of current Macroblock
- * [in] SrcCurrStep - Step size for the pointer pSrcCurrBuf
- * [in] pSrcRefY - Pointer to the start of luma component of co-located reference MB
- * [in] nSrcRefStep - Step size for the pointer pSrcRefY
- * [in] pRefRect Pointer to the valid reference rectangle; relative to the image origin.
- * [in] pCurrPointPos Position of the current macroblock in the current plane.
- * [in] pMESpec - Motion estimation structure
- * [in] pMBInter - Array, of dimension four, containing pointers to information associated with four
- * adjacent type INTER MBs (Left, Top, Top-Left, Top-Right).
- * [in] nLamda - For calculating the cost
- * [out] pBestCost - Minimum cost for encoding current block
- * [out] pBestMV - MV corresponding to best cost
- * [in] BlockStartX - Block start X index in integer pels
- * [in] BlockStartY - Block start Y index in integer pels
- * [in] BlockSizeX - Width of current block
- * [in] BlockSizeY - Height of current block
- * [in] RefFrame - Index of the reference frame for prediction
- * [in] pRefFrArr - Pointer to reference frame array storing neighbouring MVs for prediction
- * [in] pMVArr - Pointer to MV array storing neighbouring MVs for MV prediction
- * [in] pMVPred - Pointer to MV predicted from neighbour MVs
- * Remarks:
- *
- * Return Value:
- * OMXResult
- *
- */
-static OMXResult armVCM4P10_BlockMotionSearch(
- const OMX_U8* pSrcCurrBuf,
- OMX_S32 SrcCurrStep,
- const OMX_U8* pSrcRefY,
- OMX_S32 nSrcRefStep,
- const OMXRect *pRefRect,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- void* pMESpec,
-
- OMX_S32 nLamda,
- OMX_S32* pBestCost,
- OMXVCMotionVector *pBestMV,
-
- OMX_U32 BlockStartX,
- OMX_U32 BlockStartY,
- OMX_U32 BlockSizeX,
- OMX_U32 BlockSizeY,
- OMX_S32 RefFrame,
- OMX_S32 pRefFrArr [][6],
- OMXVCMotionVector pMVArr [][12],
- OMXVCMotionVector *pMVPred
- )
-{
-
- OMXVCMotionVector MVCalculated, MVCandidate;
- OMX_S32 Cost;
- OMXResult RetValue;
- OMXVCM4P10MEParams *pMEParams;
- OMXVCM4P2Coordinate CurrBlockPos;
-
- /* Get Predicted Motion Vectors */
- armVCM4P10_SetMotionVectorPredictor (
- BlockStartX,
- BlockStartY,
- BlockSizeX,
- BlockSizeY,
- RefFrame,
- pRefFrArr,
- pMVArr,
- pMVPred);
-
- /* Initialize candidate MV */
- MVCandidate.dx = 0;
- MVCandidate.dy = 0;
-
- CurrBlockPos.x = pCurrPointPos->x + BlockStartX;
- CurrBlockPos.y = pCurrPointPos->y + BlockStartY;
-
- /* Block Match Integer */
- RetValue = omxVCM4P10_BlockMatch_Integer (
- pSrcCurrBuf,
- SrcCurrStep,
- pSrcRefY,
- nSrcRefStep,
- pRefRect,
- &CurrBlockPos,
- BlockSizeX,
- BlockSizeY,
- nLamda,
- pMVPred,
- &MVCandidate,
- &MVCalculated,
- &Cost,
- pMESpec);
-
- /* updated BestMV*/
- /**pBestCost = Cost;
- pBestMV->dx = MVCalculated.dx;
- pBestMV->dy = MVCalculated.dy;*/
-
- pMEParams = (OMXVCM4P10MEParams *) pMESpec;
-
- /* Block Match Half pel */
- if (pMEParams->halfSearchEnable)
- {
- RetValue = omxVCM4P10_BlockMatch_Half(
- pSrcCurrBuf,
- SrcCurrStep,
- pSrcRefY,
- nSrcRefStep,
- BlockSizeX,
- BlockSizeY,
- nLamda,
- pMVPred,
- &MVCalculated, /* input/output*/
- &Cost);
- }
-
- /* Block Match Quarter pel */
- if (pMEParams->quarterSearchEnable)
- {
- RetValue = omxVCM4P10_BlockMatch_Quarter(
- pSrcCurrBuf,
- SrcCurrStep,
- pSrcRefY,
- nSrcRefStep,
- BlockSizeX,
- BlockSizeY,
- nLamda,
- pMVPred,
- &MVCalculated,
- &Cost);
- }
-
- /* updated Best Cost and Best MV */
- *pBestCost = Cost;
- pBestMV->dx = MVCalculated.dx;
- pBestMV->dy = MVCalculated.dy;
-
- /*
- * Skip MB cost calculations of 16x16 inter mode
- */
- return RetValue;
-}
-
-/**
- * Function: armVCM4P10_PartitionME
- *
- * Description:
- * Gets best cost for the current partition
- *
- * Parameters:
- * [in] pSrcCurrBuf - Pointer to the start of luma component of current Macroblock
- * [in] SrcCurrStep - Step size for the pointer pSrcCurrBuf
- * [in] pSrcRefBufList - Pointer to List of ref buffer of co-located reference MB
- * [in] nSrcRefStep - Step size for the pointer pSrcRefY
- * [in] pRefRect Pointer to the valid reference rectangle; relative to the image origin.
- * [in] pCurrPointPos Position of the current macroblock in the current plane.
- * [in] pMESpec - Motion estimation structure
- * [in] PartWidth - Width of current partition
- * [in] PartHeight - Height of current partition
- * [in] BlockWidth - Width of current block
- * [in] BlockHeight - Height of current block
- * [in] PartStartX - Partition start X index in integer pels
- * [in] PartStartY - Partition start Y index in integer pels
- * [in] pMVArr - Pointer to MV array storing neighbouring MVs for MV prediction
- * [in] pRefFrArr - Pointer to reference frame array storing neighbouring MVs for prediction
- * [in] Lambda - For calculating the cost
- * [out] pCost - Pointer to cost for Inter MB
- *
- * Return Value:
- * OMXResult
- *
- */
-static OMXResult armVCM4P10_PartitionME (
- const OMX_U8* pSrcCurrBuf,
- OMX_S32 SrcCurrStep,
- const OMX_U8 *pSrcRefBufList[ARM_VCM4P10_MAX_FRAMES],
- OMX_S32 SrcRefStep,
- const OMXRect *pRefRect,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- void* pMESpec,
-
- OMX_S32 PartWidth,
- OMX_S32 PartHeight,
- OMX_S32 BlockWidth,
- OMX_S32 BlockHeight,
- OMX_S32 PartStartX,
- OMX_S32 PartStartY,
-
- OMXVCMotionVector pMVArr [][12],
- OMX_S32 pRefFrArr [][6],
- OMXVCMotionVector pMVPredArr [][4],
-
- OMX_S32 Lambda,
- OMX_S32 *pCost
-)
-{
- OMX_U32 x, y, i, j, ref, OffX, OffY, OffSrc, OffRef;
- OMX_S32 BlockCost, PartitionCost, BestCost;
- OMX_S32 BestRefFrame=0;
- OMXVCMotionVector BestMV [4][4];
- OMXVCMotionVector BestMVPred [4][4];
- OMXVCMotionVector MVPred;
- OMXVCMotionVector DstMV;
-
- BestCost = ARM_VCM4P10_MAX_COST;
-
- for (ref = 0; ref < ARM_VCM4P10_MAX_FRAMES; ref++)
- {
- if (pSrcRefBufList [ref] == NULL)
- {
- /* No reference frame, continue */
- continue;
- }
-
- PartitionCost = 0;
-
- for (y = 0; y < PartHeight; y += BlockHeight)
- {
- for (x = 0; x < PartWidth; x += BlockWidth)
- {
- OffSrc = SrcCurrStep * (PartStartY + y) + PartStartX + x;
- OffRef = SrcRefStep * (PartStartY + y) + PartStartX + x;
- armVCM4P10_BlockMotionSearch (
- pSrcCurrBuf + OffSrc,
- SrcCurrStep,
- pSrcRefBufList [ref] + OffRef,
- SrcRefStep,
- pRefRect,
- pCurrPointPos,
- pMESpec,
-
- Lambda,
- &BlockCost,
- &DstMV,
-
- x + PartStartX,
- y + PartStartY,
- BlockWidth,
- BlockHeight,
- ref,
- pRefFrArr,
- pMVArr,
- &MVPred);
-
- PartitionCost += BlockCost;
-
- OffX = (PartStartX + x) >> 2;
- OffY = (PartStartY + y) >> 2;
-
- for (j = 0; j < (BlockHeight >> 2); j++)
- {
- for (i = 0; i < (BlockWidth >> 2); i++)
- {
- pMVArr [4 + OffY + j][4 + OffX + i].dx = DstMV.dx;
- pMVArr [4 + OffY + j][4 + OffX + i].dy = DstMV.dy;
- pMVPredArr [OffY + j][OffX + i].dx = MVPred.dx;
- pMVPredArr [OffY + j][OffX + i].dy = MVPred.dy;
- }
- }
-
- pRefFrArr [2 + (OffY >> 1)][2 + (OffX >> 1)] = ref;
- for (j = 0; j < (BlockHeight >> 3); j++)
- {
- for (i = 0; i < (BlockWidth >> 3); i++)
- {
- pRefFrArr [2 + (OffY >> 1) + j][2 + (OffX >> 1) + i] = ref;
- }
- }
-
- }
- }
-
- /*
- * If PartitionCost is less for this reference frame, motion vectors needs to be backedup
- */
- if (PartitionCost <= BestCost)
- {
- BestCost = PartitionCost;
- BestRefFrame = ref;
-
- for (y = 0; y < (PartHeight/BlockHeight); y++)
- {
- for (x = 0; x < (PartWidth/BlockWidth); x++)
- {
- OffX = (PartStartX + x * BlockWidth) >> 2;
- OffY = (PartStartY + y * BlockHeight) >> 2;
-
- BestMV[y][x].dx = pMVArr [4 + OffY][4 + OffX].dx;
- BestMV[y][x].dy = pMVArr [4 + OffY][4 + OffX].dy;
- BestMVPred[y][x].dx = pMVPredArr [OffY][OffX].dx;
- BestMVPred[y][x].dy = pMVPredArr [OffY][OffX].dy;
- }
- }
- }
-
- }
-
- /*
- * Copy back best reference frame, motion vectors and cost.
- */
- for (y = 0; y < (PartHeight/BlockHeight); y++)
- {
- for (x = 0; x < (PartWidth/BlockWidth); x++)
- {
- OffX = (PartStartX + x * BlockWidth) >> 2;
- OffY = (PartStartY + y * BlockHeight) >> 2;
-
- for (j = 0; j < (BlockHeight >> 2); j++)
- {
- for (i = 0; i < (BlockWidth >> 2); i++)
- {
- pMVArr [4 + OffY + j][4 + OffX + i].dx = BestMV[y][x].dx;
- pMVArr [4 + OffY + j][4 + OffX + i].dy = BestMV[y][x].dy;
- pMVPredArr [OffY + j][OffX + i].dx = BestMVPred[y][x].dx;
- pMVPredArr [OffY + j][OffX + i].dy = BestMVPred[y][x].dy;
- }
- }
-
- for (j = 0; j < (BlockHeight >> 3); j++)
- {
- for (i = 0; i < (BlockWidth >> 3); i++)
- {
- pRefFrArr [2 + (OffY >> 1) + j][2 + (OffX >> 1) + i] = BestRefFrame;
- }
- }
- }
- }
-
- *pCost = BestCost;
- return OMX_Sts_NoErr;
-
-}
-
-/**
- * Function: armVCM4P10_Intra16x16Estimation
- *
- * Description:
- * Performs MB-level motion estimation for INTER MB type and selects best motion estimation strategy from
- * the set of modes supported in baseline profile ISO/IEC 14496-10.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcCurrBuf - Pointer to the start of luma component of current Macroblock
- * [in] SrcCurrStep - Step size for the pointer pSrcCurrBuf
- * [in] pSrcRecBuf - Pointer to the start of luma component of co-located reconstructed MB
- * [in] SrcRecStep - Step size for the pointer pSrcRecBuf
- * [in] nMBPosX - Position of MB in the frame w.r.t X axis
- * [in] nMBPosY - Position of MB in the frame w.r.t Y axis
- * [in] pMBInter - Array, of dimension four, containing pointers to information associated with four
- * adjacent type INTER MBs (Left, Top, Top-Left, Top-Right).
- * [in] pMBIntra - Array, of dimension four, containing pointers to information associated with four
- * adjacent type INTRA MBs (Left, Top, Top-Left, Top-Right).
- * [in/out] pSrcDstMBCurr - Pointer to information structure for the current MB. Following member should be set
- * before calling this function
- * [in] Lambda - For calculating the cost
- * [out] pCost - Pointer to cost for Intra16x16
- * Return Value:
- * OMX_Sts_NoErr - No Error
- * OMX_Sts_BadArgErr - Bad arguments:
- *
- */
-
-static OMXResult armVCM4P10_Intra16x16Estimation(
- const OMX_U8* pSrcCurrBuf,
- OMX_S32 SrcCurrStep,
- const OMX_U8* pSrcRecBuf,
- OMX_S32 SrcRecStep,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- const OMXVCM4P10MBInfoPtr *pMBInter,
- const OMXVCM4P10MBInfoPtr *pMBIntra,
- OMXVCM4P10MBInfo *pSrcDstMBCurr,
- OMX_U32 *pCost)
-{
- OMX_U8 PredBuf [16*16 + 16];
- OMX_U8 *pPred;
- OMX_S32 mode;
- OMX_S32 Cost;
- OMX_S32 availability = 0;
- OMXResult Ret;
- OMXVCM4P10Intra16x16PredMode IntraMode16x16 [4] =
- {OMX_VC_16X16_VERT, OMX_VC_16X16_HOR,
- OMX_VC_16X16_DC, OMX_VC_16X16_PLANE};
- OMX_U32 MBPosX = pCurrPointPos->x >> 4;
- OMX_U32 MBPosY = pCurrPointPos->y >> 4;
-
- pPred = armAlignTo16Bytes(PredBuf);
-
- /* Check for availability of LEFT MB */
- if ((MBPosX != 0) && (pMBIntra [0] != 0 || pMBInter [0] != 0))
- {
- availability |= OMX_VC_LEFT;
- }
-
- /* Check for availability of UP MB */
- if ((MBPosY != 0) && (pMBIntra [1] != 0 || pMBInter [1] != 0))
- {
- availability |= OMX_VC_UPPER;
- }
-
- /* Check for availability of UP-LEFT MB */
- if ((MBPosX > 0) && (MBPosY > 0) &&
- (pMBIntra [2] != 0 || pMBInter [2] != 0))
- {
- availability |= OMX_VC_UPPER_LEFT;
- }
-
- *pCost = ARM_VCM4P10_MAX_COST;
- for (mode = 0; mode < 4; mode++)
- {
- Ret = omxVCM4P10_PredictIntra_16x16(
- pSrcRecBuf - 1,
- pSrcRecBuf - SrcRecStep,
- pSrcRecBuf - SrcRecStep - 1,
- pPred,
- SrcRecStep,
- 16,
- IntraMode16x16 [mode],
- availability);
- if (Ret == OMX_Sts_NoErr)
- {
- armVCCOMM_SAD(
- pSrcCurrBuf,
- SrcCurrStep,
- pPred,
- 16,
- &Cost,
- 16,
- 16);
- if (Cost < *pCost)
- {
- *pCost = Cost;
- pSrcDstMBCurr->Intra16x16PredMode = IntraMode16x16 [mode];
- }
-
- }
-
- }
-
- return OMX_Sts_NoErr;
-}
-
-/**
- * Function: armVCM4P10_Intra4x4Estimation
- *
- * Description:
- * Performs MB-level motion estimation for Intra 4x4 MB type and selects
- * the best set of modes supported in baseline profile.
- *
- * Parameters:
- * [in] pSrcCurrBuf - Pointer to the start of luma component of current Macroblock
- * [in] SrcCurrStep - Step size for the pointer pSrcCurrBuf
- * [in] pSrcRecBuf - Pointer to the start of luma component of co-located reconstructed MB
- * [in] SrcRecStep - Step size for the pointer pSrcRecBuf
- * [in] nMBPosX - Position of MB in the frame w.r.t X axis
- * [in] nMBPosY - Position of MB in the frame w.r.t Y axis
- * [in] pMBIntra - Array, of dimension four, containing pointers to information associated with four
- * adjacent type INTRA MBs (Left, Top, Top-Left, Top-Right).
- * [in/out] pSrcDstMBCurr - Pointer to information structure for the current MB. Following member should be set
- * before calling this function
- * [in] Lambda - For calculating the cost
- * [out] pCost - Pointer to cost for Intra4x4
- * Return Value:
- * OMX_Sts_NoErr - No Error
- * OMX_Sts_BadArgErr - Bad arguments:
- *
- */
-
-static OMXResult armVCM4P10_Intra4x4Estimation(
- const OMX_U8* pSrcCurrBuf,
- OMX_S32 SrcCurrStep,
- const OMX_U8* pSrcRecBuf,
- OMX_S32 SrcRecStep,
- const OMXVCM4P10MBInfoPtr *pMBIntra,
- OMXVCM4P10MBInfo *pSrcDstMBCurr,
- OMX_U32 *pCost)
-{
- OMX_S32 x, y, Block4x4, Block8x8;
- OMX_S32 Cost;
-
- /*
- * PredIntra4x4Mode will store prediction modes of 4x4 blocks.
- * Modes for current MB starts at index [1][1].
- * Modes of nighbouring MB's will be as shown below
- * A value of ARM_VCM4P10_INVALID_BLOCK for any block in this array means
- * that block is not available for prediction.
- *
- * c3 b0 b1 b2 b3 d0 d1 d2 d3
- * a0 xx xx xx xx - - - -
- * a1 xx xx xx xx - - - -
- * a2 xx xx xx xx - - - -
- * a3 xx xx xx xx - - - -
- *
- */
- OMX_S32 PredIntra4x4Mode [5][9];
-
- /*
- * pSrcY stores re-construsted source array of size 3MB X 2MB as below
- *
- * MB11 MB12 MB13
- * MB21 MB22 MB23
- *
- * This array will be used for local reconstruction of 4x4 blocks
- * with best prediction mode within an MB
- */
- OMX_U8 pSrcY [(16*3)*(16*2)];
- OMX_S32 StepSrcY;
-
- /* init */
- *pCost = 0;
-
- for (y = 0; y < 5; y++)
- {
- for (x = 0; x < 9; x++)
- {
- /*
- * Initialize with value of ARM_VCM4P10_INVALID_BLOCK, to mean this
- * 4x4 block is not available
- */
- PredIntra4x4Mode [y][x] = ARM_VCM4P10_INVALID_BLOCK;
- }
- }
-
- /* Replace ARM_VCM4P10_INVALID_BLOCK value with available MBs values*/
- for (x = 0; x < 4; x++)
- {
- /* Store values of b0, b1, b2, b3 */
- if (pMBIntra[1] != NULL)
- {
- PredIntra4x4Mode [0][x + 1] =
- pMBIntra[1]->pIntra4x4PredMode[3*4 + x];
- }
-
- /* Store values of d0, d1, d2, d3 */
- if (pMBIntra[3] != NULL)
- {
- PredIntra4x4Mode [0][x + 5] =
- pMBIntra[3]->pIntra4x4PredMode[3*4 + x];
- }
- }
-
- /* Store values of c3 */
- if (pMBIntra[2] != NULL)
- {
- PredIntra4x4Mode [0][0] = pMBIntra[2]->pIntra4x4PredMode[15];
- }
-
- for (y = 0; y < 4; y++)
- {
- /* Store values of a0, a1, a2, a3 */
- if (pMBIntra[0] != NULL)
- {
- PredIntra4x4Mode [y + 1][0] =
- pMBIntra[0]->pIntra4x4PredMode[y*4 + 3];
- }
- }
-
- /*
- * Update neighbouring Pred mode array which will be used for
- * prediction of Intra4x4 modes.
- */
-
- StepSrcY = 16 * 3;
- for (y = 0; y < (16 * 2); y++)
- {
- for (x = 0; x < (16 * 3); x++)
- {
- pSrcY [StepSrcY * y + x] =
- pSrcRecBuf [SrcRecStep * (y - 16) + x - 16];
- }
- }
-
- /* for each 8x8 block */
- for (Block8x8 = 0; Block8x8 < 4; Block8x8++)
- {
- /* for each 4x4 block inside 8x8 block */
- for (Block4x4 = 0; Block4x4 < 4; Block4x4++)
- {
- armVCM4P10_Mode4x4Decision (
- pSrcCurrBuf,
- SrcCurrStep,
- pSrcDstMBCurr,
- Block8x8,
- Block4x4,
- pSrcY + 16 * StepSrcY + 16,
- StepSrcY,
- PredIntra4x4Mode,
- &Cost);
-
- *pCost += Cost;
- }
- }
- return OMX_Sts_NoErr;
-}
-
-/**
- * Function: armVCM4P10_InterMEMB
- *
- * Description:
- * Performs MB-level motion estimation for INTER MB type and selects best motion estimation strategy from
- * the set of modes supported in baseline profile ISO/IEC 14496-10.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcCurrBuf - Pointer to the start of luma component of current Macroblock
- * [in] SrcCurrStep - Step size for the pointer pSrcCurrBuf
- * [in] pSrcRefBufList - Pointer to the start of luma component of co-located reference MB
- * [in] SrcRefStep - Step size for the pointer pSrcRefY
- * [in] pRefRect Pointer to the valid reference rectangle; relative to the image origin.
- * [in] pCurrPointPos Position of the current macroblock in the current plane.
- * [in] pMESpec - Motion estimation structure
- * [in] pMBInter - Array, of dimension four, containing pointers to information associated with four
- * adjacent type INTER MBs (Left, Top, Top-Left, Top-Right).
- * [in/out] pSrcDstMBCurr - Pointer to information structure for the current MB. Following member should be set
- * before calling this function
- * [in] Lambda - For calculating the cost
- * [out] pDstCost - Pointer to cost for Inter MB
- * Return Value:
- * OMX_Sts_NoErr - No Error
- * OMX_Sts_BadArgErr - Bad arguments:
- *
- */
-
-static OMXResult armVCM4P10_InterMEMB(
- const OMX_U8 *pSrcCurrBuf,
- OMX_S32 SrcCurrStep,
- const OMX_U8 *pSrcRefBufList[ARM_VCM4P10_MAX_FRAMES],
- OMX_S32 SrcRefStep,
- const OMXRect *pRefRect,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- OMX_U32 Lambda,
- void *pMESpec,
- const OMXVCM4P10MBInfoPtr *pMBInter,
- OMXVCM4P10MBInfoPtr pSrcDstMBCurr,
- OMX_U32 *pDstCost)
-{
- OMX_S32 i, j, x, y, mode;
- OMX_U32 Block8x8, XPerMB, YPerMB, Block2x, Block2y;
- OMX_S32 PartStartX = 0, PartStartY = 0;
- OMX_S32 PartWidth = 8, PartHeight = 8, BlockWidth = 4, BlockHeight = 4;
- const OMX_U32 BlkSz [4][2] = {{4,4}, {4,8}, {8,4}};
- const OMX_U32 PartSz [4][2] = {{8,8}, {8,16}, {16,8}, {16,16}};
- const OMXVCM4P10SubMacroblockType
- ModeSubMBType4x4 [] = {OMX_VC_SUB_P_4x4, OMX_VC_SUB_P_4x8,
- OMX_VC_SUB_P_8x4, OMX_VC_SUB_P_8x8};
- const OMXVCM4P10MacroblockType
- ModeMBType [] = {OMX_VC_P_8x8, OMX_VC_P_8x16, OMX_VC_P_16x8, OMX_VC_P_16x16};
-
- OMXVCM4P10MEParams *pMBOptions;
- /*
- * RefFrArr and MVArr will be used for temporary storage of Reference frame index and MVs
- * It will store RefIndex and MVs of 6 MBs as shown below
- *
- * |------|------|------|
- * |Tp-Lt |Top |Tp-R |
- * | MB | MB | MB |
- * |------|------|------|
- * |Left | Curr | |
- * | MB | MB | |
- * |------|------|------|
- */
- OMX_S32 RefFrArr [4][6];
- OMXVCMotionVector MVArr [8][12];
- OMXVCMotionVector MVPredArr [4][4];
-
- /*
- * IndexToLoc will translate pMBInter index into spacial arrangement of MBs
- */
- OMX_S32 IndexToLoc [] = {2,1,3,0};
- OMX_U32 part, MaxPart;
- OMX_S32 Cost, MotionCost8x8 [4], MBCost, BestCost;
-
- /*
- * Update neighbouring MV array and Ref frame array which will be used for
- * prediction of MVs and Ref frames.
- */
-
- /* Set cost to a high value */
- Cost = BestCost = ARM_VCM4P10_MAX_COST;
-
- for (y = 0; y < 8; y++)
- {
- for (x = 0; x < 12; x++)
- {
- i = 3 * (y >> 2) + (x >> 2);
- if ((y < 4 || x < 4) && (pMBInter[IndexToLoc[i]] != NULL))
- {
- MVArr [y][x].dx =
- pMBInter[IndexToLoc[i]]->pMV0[y % 4][x % 4].dx;
- MVArr [y][x].dy =
- pMBInter[IndexToLoc[i]]->pMV0[y % 4][x % 4].dy;
- }
- else
- {
- MVArr [y][x].dx = 0;
- MVArr [y][x].dy = 0;
- }
- }
- }
-
- for (y = 0; y < 4; y++)
- {
- for (x = 0; x < 6; x++)
- {
- i = 3 * (y >> 1) + (x >> 1);
- if ((y < 2 || x < 2) && (pMBInter[IndexToLoc[i]] != NULL))
- {
- RefFrArr [y][x] =
- pMBInter[IndexToLoc[i]]->pRefL0Idx [(y % 2) * 2 + (x % 2)];
- }
- else
- {
- RefFrArr [y][x] = ARM_VCM4P10_INVALID_BLOCK;
- }
- }
- }
-
- for (y = 0; y < 4; y++)
- {
- for (x = 0; x < 4; x++)
- {
- MVPredArr [y][x].dx = 0;
- MVPredArr [y][x].dy = 0;
- }
- }
- /*
- * Motion Estimation for 8x8 MB Partition
- */
-
- for (i = 0; i < 4; i++)
- {
- MotionCost8x8 [i] = 0;
- }
-
- pMBOptions = (OMXVCM4P10MEParams *) pMESpec;
-
- if (pMBOptions->blockSplitEnable8x8 == 1 &&
- pMBOptions->blockSplitEnable4x4 == 1)
- {
- pSrcDstMBCurr->mbType = OMX_VC_P_8x8;
-
- PartWidth = PartSz [0][0];
- PartHeight = PartSz [0][1];
-
- /* For each 8x8 partitions */
- for (Block8x8 = 0; Block8x8 < 4; Block8x8++)
- {
- PartStartX = (Block8x8 % 2) << 3;
- PartStartY = (Block8x8 / 2) << 3;
-
- Block2x = (Block8x8 & 1) << 1;
- Block2y = (Block8x8 >> 1) << 1;
-
- BestCost = ARM_VCM4P10_MAX_COST;
- for (mode = 0; mode < 3; mode++)
- {
- BlockWidth = BlkSz [mode][0];
- BlockHeight = BlkSz [mode][1];
-
- armVCM4P10_PartitionME (
- pSrcCurrBuf,
- SrcCurrStep,
- pSrcRefBufList,
- SrcRefStep,
- pRefRect,
- pCurrPointPos,
- pMESpec,
-
- PartWidth,
- PartHeight,
- BlockWidth,
- BlockHeight,
- PartStartX,
- PartStartY,
-
- MVArr,
- RefFrArr,
- MVPredArr,
-
- Lambda,
- &Cost);
-
- if (Cost <= BestCost)
- {
- /* Update cost */
- BestCost = Cost;
-
- /* Update MBCurr struct */
- pSrcDstMBCurr->subMBType [Block8x8] = ModeSubMBType4x4 [mode];
-
- pSrcDstMBCurr->pRefL0Idx [Block8x8] = RefFrArr [2 + (PartStartY >> 3)][2 + (PartStartX >> 3)];
-
- /* Update pMV0 and pMVPred of MBCurr struct */
- for (j = 0; j < 2; j++)
- {
- for (i = 0; i < 2; i++)
- {
- pSrcDstMBCurr->pMV0 [Block2y + j][Block2x + i].dx =
- MVArr [4 + Block2y + j][4 + Block2x + i].dx;
- pSrcDstMBCurr->pMV0 [Block2y + j][Block2x + i].dy =
- MVArr [4 + Block2y + j][4 + Block2x + i].dy;
-
- pSrcDstMBCurr->pMVPred [Block2y + j][Block2x + i].dx =
- MVPredArr [Block2y + j][Block2x + i].dx;
- pSrcDstMBCurr->pMVPred [Block2y + j][Block2x + i].dy =
- MVPredArr [Block2y + j][Block2x + i].dy;
- }
- }
- }
- }
-
- /* Update cost */
- MotionCost8x8 [Block8x8] = BestCost;
- }
-
- /* Cost for mbType OMX_VC_P_8x8 */
- BestCost = 0;
- for (i = 0; i < 4; i++)
- {
- BestCost += MotionCost8x8 [i];
- }
- }
- else
- {
- /* Set sub MB type to 8x8 */
- for (i = 0; i < 4; i++)
- {
- pSrcDstMBCurr->subMBType [i] = OMX_VC_SUB_P_8x8;
- }
- }
-
- /*
- * Motion Estimation for 8x8, 8x16, 16x8 and 16x16 MB Partition
- * If pMBOptions->b8x8BlockSplitEnable is 0, do only 16x16 ME (mode 3)
- */
- for (mode = (pMBOptions->blockSplitEnable8x8 == 1 ? 0 : 3); mode < 4; mode++)
- {
- BlockWidth = PartWidth = PartSz [mode][0];
- BlockHeight = PartHeight = PartSz [mode][1];
-
- XPerMB = 16 / PartWidth;
- YPerMB = 16 / PartHeight;
- MaxPart = XPerMB * YPerMB;
-
- MBCost = 0;
-
- /* part size 4, 2, 2 and 1 corresponding to 8x8, 8x16, 16x8 and 16x16 MB */
- for (part = 0; part < MaxPart; part++)
- {
- PartStartX = (part % XPerMB) * PartWidth;
- PartStartY = (part / XPerMB) * PartHeight;
-
- armVCM4P10_PartitionME (
- pSrcCurrBuf,
- SrcCurrStep,
- pSrcRefBufList,
- SrcRefStep,
- pRefRect,
- pCurrPointPos,
- pMESpec,
-
- PartWidth,
- PartHeight,
- BlockWidth,
- BlockHeight,
- PartStartX,
- PartStartY,
-
- MVArr,
- RefFrArr,
- MVPredArr,
-
- Lambda,
- &Cost);
-
- MBCost += Cost;
- }
-
- if (MBCost <= BestCost)
- {
- /* Update cost */
- BestCost = MBCost;
-
- /* Update mbType of MBCurr struct */
- pSrcDstMBCurr->mbType = ModeMBType [mode];
-
- /* Update pMV0 and pMVPred of MBCurr struct */
- for (j = 0; j < 4; j++)
- {
- for (i = 0; i < 4; i++)
- {
- pSrcDstMBCurr->pMV0 [j][i].dx = MVArr [4+j][4+i].dx;
- pSrcDstMBCurr->pMV0 [j][i].dy = MVArr [4+j][4+i].dy;
- pSrcDstMBCurr->pMVPred [j][i].dx = MVPredArr [j][i].dx;
- pSrcDstMBCurr->pMVPred [j][i].dy = MVPredArr [j][i].dy;
- }
- }
- for (j = 0; j < 2; j++)
- {
- for (i = 0; i < 2; i++)
- {
- pSrcDstMBCurr->pRefL0Idx [j*2+i] = RefFrArr [2+j][2+i];
- }
- }
- }
-
- }
-
- /* Update Best Cost */
- *pDstCost = BestCost;
-
- return OMX_Sts_NoErr;
-}
-
-/**
- * Function: omxVCM4P10_MotionEstimationMB (6.3.5.3.1)
- *
- * Description:
- * Performs MB-level motion estimation and selects best motion estimation
- * strategy from the set of modes supported in baseline profile [ISO14496-10].
- *
- * Input Arguments:
- *
- * pSrcCurrBuf - Pointer to the current position in original picture plane;
- * 16-byte alignment required
- * pSrcRefBufList - Pointer to an array with 16 entries. Each entry points
- * to the top-left corner of the co-located MB in a reference
- * picture. The array is filled from low-to-high with valid
- * reference frame pointers; the unused high entries should be set
- * to NULL. Ordering of the reference frames should follow
- * [ISO14496-10] subclause 8.2.4 Decoding Process for Reference
- * Picture Lists. The entries must be 16-byte aligned.
- * pSrcRecBuf - Pointer to the top-left corner of the co-located MB in the
- * reconstructed picture; must be 16-byte aligned.
- * SrcCurrStep - Width of the original picture plane in terms of full
- * pixels; must be a multiple of 16.
- * SrcRefStep - Width of the reference picture plane in terms of full
- * pixels; must be a multiple of 16.
- * SrcRecStep - Width of the reconstructed picture plane in terms of full
- * pixels; must be a multiple of 16.
- * pRefRect - Pointer to the valid reference rectangle; relative to the
- * image origin.
- * pCurrPointPos - Position of the current macroblock in the current plane.
- * Lambda - Lagrange factor for computing the cost function
- * pMESpec - Pointer to the motion estimation specification structure; must
- * have been allocated and initialized prior to calling this
- * function.
- * pMBInter - Array, of dimension four, containing pointers to information
- * associated with four adjacent type INTER MBs (Left, Top,
- * Top-Left, Top-Right). Any pointer in the array may be set equal
- * to NULL if the corresponding MB doesn t exist or is not of type
- * INTER. pMBInter[0] - Pointer to left MB information pMBInter[1]
- * - Pointer to top MB information pMBInter[2] - Pointer to
- * top-left MB information pMBInter[3] - Pointer to top-right MB
- * information
- * pMBIntra - Array, of dimension four, containing pointers to information
- * associated with four adjacent type INTRA MBs (Left, Top,
- * Top-Left, Top-Right). Any pointer in the array may be set equal
- * to NULL if the corresponding MB doesn t exist or is not of type
- * INTRA. pMBIntra[0] - Pointer to left MB information pMBIntra[1]
- * - Pointer to top MB information pMBIntra[2] - Pointer to
- * top-left MB information pMBIntra[3] - Pointer to top-right MB
- * information
- * pSrcDstMBCurr - Pointer to information structure for the current MB.
- * The following entries should be set prior to calling the
- * function: sliceID - the number of the slice the to which the
- * current MB belongs.
- *
- * Output Arguments:
- *
- * pDstCost - Pointer to the minimum motion cost for the current MB.
- * pDstBlockSAD - Pointer to the array of SADs for each of the sixteen luma
- * 4x4 blocks in each MB. The block SADs are in scan order for
- * each MB. For implementations that cannot compute the SAD values
- * individually, the maximum possible value (0xffff) is returned
- * for each of the 16 block SAD entries.
- * pSrcDstMBCurr - Pointer to updated information structure for the current
- * MB after MB-level motion estimation has been completed. The
- * following fields are updated by the ME function. The following
- * parameter set quantifies the MB-level ME search results: MbType
- * subMBType[4] pMV0[4][4] pMVPred[4][4] pRefL0Idx[4]
- * Intra16x16PredMode pIntra4x4PredMode[4][4]
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - One of more of the following pointers is NULL: pSrcCurrBuf,
- * pSrcRefBufList, pSrcRecBuf, pRefRect, pCurrPointPos, pMESpec,
- * pMBInter, pMBIntra,pSrcDstMBCurr, pDstCost, pSrcRefBufList[0]
- * - SrcRefStep, SrcRecStep are not multiples of 16
- * - iBlockWidth or iBlockHeight are values other than 4, 8, or 16.
- * - Any alignment restrictions are violated
- *
- */
-
-OMXResult omxVCM4P10_MotionEstimationMB(
- const OMX_U8 *pSrcCurrBuf,
- OMX_S32 SrcCurrStep,
- const OMX_U8 *pSrcRefBufList[ARM_VCM4P10_MAX_FRAMES],
- OMX_S32 SrcRefStep,
- const OMX_U8 *pSrcRecBuf,
- OMX_S32 SrcRecStep,
- const OMXRect *pRefRect,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- OMX_U32 Lambda,
- void *pMESpec,
- const OMXVCM4P10MBInfoPtr *pMBInter,
- const OMXVCM4P10MBInfoPtr *pMBIntra,
- OMXVCM4P10MBInfo *pSrcDstMBCurr,
- OMX_INT *pDstCost,
- OMX_U16 *pDstBlockSAD)
-{
- OMX_U32 Cost, i, IntraFlag = 1;
- OMXVCM4P10MEParams *pMEParams;
-
- /* check for argument error */
- armRetArgErrIf(pSrcCurrBuf == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pSrcRefBufList == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pSrcRecBuf == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pRefRect == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pCurrPointPos == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pMESpec == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pMBInter == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pMBIntra == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pSrcDstMBCurr == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstCost == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(SrcRefStep <= 0 || SrcRefStep & 15, OMX_Sts_BadArgErr)
- armRetArgErrIf(SrcRecStep <= 0 || SrcRecStep & 15, OMX_Sts_BadArgErr)
- armRetArgErrIf(SrcCurrStep <= 0 || SrcCurrStep & 15, OMX_Sts_BadArgErr)
-
- armRetArgErrIf(armNot16ByteAligned(pSrcCurrBuf), OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot16ByteAligned(pSrcRecBuf), OMX_Sts_BadArgErr)
-
- for (i = 0; i < ARM_VCM4P10_MAX_FRAMES; i++)
- {
- armRetArgErrIf(pSrcRefBufList [i] != NULL &&
- armNot16ByteAligned(pSrcRefBufList [i]), OMX_Sts_BadArgErr)
-
- /* Check if current MB needs INTER cost calculations */
- if (pSrcRefBufList [i] != NULL && IntraFlag == 1)
- {
- IntraFlag = 0;
- }
- }
-
- *pDstCost = ARM_VCM4P10_MAX_COST;
- /*
- * Inter cost calculations
- */
-
- /* check this MB can be Inter */
- if (IntraFlag != 1)
- {
- armVCM4P10_InterMEMB(
- pSrcCurrBuf,
- SrcCurrStep,
- pSrcRefBufList,
- SrcRefStep,
- pRefRect,
- pCurrPointPos,
- Lambda,
- pMESpec,
- pMBInter,
- pSrcDstMBCurr,
- &Cost
- );
-
- *pDstCost = Cost;
- }
-
- pMEParams = (OMXVCM4P10MEParams *)pMESpec;
-
- if (pMEParams->intraEnable4x4 == 1)
- {
- /*
- * Intra 4x4 cost calculations
- */
- armVCM4P10_Intra4x4Estimation(
- pSrcCurrBuf,
- SrcCurrStep,
- pSrcRecBuf,
- SrcRecStep,
- pMBIntra,
- pSrcDstMBCurr,
- &Cost
- );
-
- if (Cost <= *pDstCost)
- {
- *pDstCost = Cost;
- pSrcDstMBCurr->mbType = OMX_VC_INTRA_4x4;
-
- }
-
- }
-
- /*
- * Cost for Intra 16x16 mode
- */
-
- armVCM4P10_Intra16x16Estimation(
- pSrcCurrBuf,
- SrcCurrStep,
- pSrcRecBuf,
- SrcRecStep,
- pCurrPointPos,
- pMBInter,
- pMBIntra,
- pSrcDstMBCurr,
- &Cost
- );
-
- if (Cost <= *pDstCost)
- {
- *pDstCost = Cost;
- pSrcDstMBCurr->mbType = OMX_VC_INTRA_16x16;
- }
-
- /*
- * Update pDstBlockSAD to max value
- */
- armVCM4P10_CalculateBlockSAD( pSrcDstMBCurr,
- pSrcCurrBuf,
- SrcCurrStep,
- pSrcRefBufList,
- SrcRefStep,
- pSrcRecBuf,
- SrcRecStep,
- pRefRect,
- pCurrPointPos,
- pMBInter,
- pMBIntra,
- pDstBlockSAD);
-
-
- return OMX_Sts_NoErr;
-}
-
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_PredictIntraChroma_8x8.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_PredictIntraChroma_8x8.c
deleted file mode 100644
index e850771..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_PredictIntraChroma_8x8.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_PredictIntraChroma_8x8.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 Chroma 8x8 intra prediction module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/*
- * Description:
- * Perform DC style intra prediction, upper block has priority
- *
- * Parameters:
- * [in] pSrcLeft Pointer to the buffer of 16 left coefficients:
- * p[x, y] (x = -1, y = 0..3)
- * [in] pSrcAbove Pointer to the buffer of 16 above coefficients:
- * p[x,y] (x = 0..3, y = -1)
- * [in] leftStep Step of left coefficient buffer
- * [in] dstStep Step of the destination buffer
- * [in] availability Neighboring 16x16 MB availability flag
- * [out] pDst Pointer to the destination buffer
- *
- * Return Value:
- * None
- */
-
-static void armVCM4P10_PredictIntraDCUp4x4(
- const OMX_U8* pSrcLeft,
- const OMX_U8 *pSrcAbove,
- OMX_U8* pDst,
- OMX_INT leftStep,
- OMX_INT dstStep,
- OMX_S32 availability
-)
-{
- int x, y, Sum=0, Count = 0;
-
- if (availability & OMX_VC_UPPER)
- {
- for (x=0; x<4; x++)
- {
- Sum += pSrcAbove[x];
- }
- Count++;
- }
- else if (availability & OMX_VC_LEFT)
- {
- for (y=0; y<4; y++)
- {
- Sum += pSrcLeft[y*leftStep];
- }
- Count++;
- }
- if (Count==0)
- {
- Sum = 128;
- }
- else
- {
- Sum = (Sum + 2) >> 2;
- }
- for (y=0; y<4; y++)
- {
- for (x=0; x<4; x++)
- {
- pDst[y*dstStep+x] = (OMX_U8)Sum;
- }
- }
-}
-
-/*
- * Description:
- * Perform DC style intra prediction, left block has priority
- *
- * Parameters:
- * [in] pSrcLeft Pointer to the buffer of 16 left coefficients:
- * p[x, y] (x = -1, y = 0..3)
- * [in] pSrcAbove Pointer to the buffer of 16 above coefficients:
- * p[x,y] (x = 0..3, y = -1)
- * [in] leftStep Step of left coefficient buffer
- * [in] dstStep Step of the destination buffer
- * [in] availability Neighboring 16x16 MB availability flag
- * [out] pDst Pointer to the destination buffer
- *
- * Return Value:
- * None
- */
-
-static void armVCM4P10_PredictIntraDCLeft4x4(
- const OMX_U8* pSrcLeft,
- const OMX_U8 *pSrcAbove,
- OMX_U8* pDst,
- OMX_INT leftStep,
- OMX_INT dstStep,
- OMX_S32 availability
-)
-{
- int x, y, Sum=0, Count = 0;
-
- if (availability & OMX_VC_LEFT)
- {
- for (y=0; y<4; y++)
- {
- Sum += pSrcLeft[y*leftStep];
- }
- Count++;
- }
- else if (availability & OMX_VC_UPPER)
- {
- for (x=0; x<4; x++)
- {
- Sum += pSrcAbove[x];
- }
- Count++;
- }
- if (Count==0)
- {
- Sum = 128;
- }
- else
- {
- Sum = (Sum + 2) >> 2;
- }
- for (y=0; y<4; y++)
- {
- for (x=0; x<4; x++)
- {
- pDst[y*dstStep+x] = (OMX_U8)Sum;
- }
- }
-}
-
-/**
- * Function: omxVCM4P10_PredictIntraChroma_8x8 (6.3.3.1.3)
- *
- * Description:
- * Performs intra prediction for chroma samples.
- *
- * Input Arguments:
- *
- * pSrcLeft - Pointer to the buffer of 8 left pixels: p[x, y] (x = -1, y=
- * 0..7).
- * pSrcAbove - Pointer to the buffer of 8 above pixels: p[x,y] (x = 0..7, y
- * = -1); must be aligned on an 8-byte boundary.
- * pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1)
- * leftStep - Step of left pixel buffer; must be a multiple of 8.
- * dstStep - Step of the destination buffer; must be a multiple of 8.
- * predMode - Intra chroma prediction mode, please refer to section 3.4.3.
- * availability - Neighboring chroma block availability flag, please refer
- * to "Neighboring Macroblock Availability".
- *
- * Output Arguments:
- *
- * pDst - Pointer to the destination buffer; must be aligned on an 8-byte
- * boundary.
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If any of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * pDst is NULL.
- * dstStep < 8 or dstStep is not a multiple of 8.
- * leftStep is not a multiple of 8.
- * predMode is not in the valid range of enumeration
- * OMXVCM4P10IntraChromaPredMode.
- * predMode is OMX_VC_CHROMA_VERT, but availability doesn't set
- * OMX_VC_UPPER indicating p[x,-1] (x = 0..7) is not available.
- * predMode is OMX_VC_CHROMA_HOR, but availability doesn't set OMX_VC_LEFT
- * indicating p[-1,y] (y = 0..7) is not available.
- * predMode is OMX_VC_CHROMA_PLANE, but availability doesn't set
- * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
- * p[x,-1](x = 0..7), or p[-1,y] (y = 0..7), or p[-1,-1] is not
- * available.
- * availability sets OMX_VC_UPPER, but pSrcAbove is NULL.
- * availability sets OMX_VC_LEFT, but pSrcLeft is NULL.
- * availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL.
- * either pSrcAbove or pDst is not aligned on a 8-byte boundary. Note:
- * pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointer if
- * they are not used by intra prediction implied in predMode.
- * Note: OMX_VC_UPPER_RIGHT is not used in intra chroma
- * prediction.
- *
- */
-OMXResult omxVCM4P10_PredictIntraChroma_8x8(
- const OMX_U8* pSrcLeft,
- const OMX_U8 *pSrcAbove,
- const OMX_U8 *pSrcAboveLeft,
- OMX_U8* pDst,
- OMX_INT leftStep,
- OMX_INT dstStep,
- OMXVCM4P10IntraChromaPredMode predMode,
- OMX_S32 availability
- )
-{
- int x, y, Sum;
- int H, V, a, b, c;
-
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(dstStep < 8, OMX_Sts_BadArgErr);
- armRetArgErrIf((dstStep % 8) != 0, OMX_Sts_BadArgErr);
- armRetArgErrIf((leftStep % 8) != 0, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot8ByteAligned(pSrcAbove), OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot8ByteAligned(pDst), OMX_Sts_BadArgErr);
- armRetArgErrIf((availability & OMX_VC_UPPER) && pSrcAbove == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf((availability & OMX_VC_LEFT ) && pSrcLeft == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf((availability & OMX_VC_UPPER_LEFT) && pSrcAboveLeft == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_CHROMA_VERT && !(availability & OMX_VC_UPPER), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_CHROMA_HOR && !(availability & OMX_VC_LEFT), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_CHROMA_PLANE && !(availability & OMX_VC_UPPER), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_CHROMA_PLANE && !(availability & OMX_VC_UPPER_LEFT), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_CHROMA_PLANE && !(availability & OMX_VC_LEFT), OMX_Sts_BadArgErr);
- armRetArgErrIf((unsigned)predMode > OMX_VC_CHROMA_PLANE, OMX_Sts_BadArgErr);
-
- switch (predMode)
- {
- case OMX_VC_CHROMA_DC:
- armVCM4P10_PredictIntraDC4x4( pSrcLeft, pSrcAbove, pDst, leftStep, dstStep, availability);
- armVCM4P10_PredictIntraDCUp4x4( pSrcLeft, pSrcAbove+4, pDst+4, leftStep, dstStep, availability);
- armVCM4P10_PredictIntraDCLeft4x4( pSrcLeft+4*leftStep, pSrcAbove, pDst+4*dstStep, leftStep, dstStep, availability);
- armVCM4P10_PredictIntraDC4x4( pSrcLeft+4*leftStep, pSrcAbove+4, pDst+4+4*dstStep, leftStep, dstStep, availability);
- break;
-
- case OMX_VC_CHROMA_HOR:
- for (y=0; y<8; y++)
- {
- for (x=0; x<8; x++)
- {
- pDst[y*dstStep+x] = pSrcLeft[y*leftStep];
- }
- }
- break;
-
- case OMX_VC_CHROMA_VERT:
- for (y=0; y<8; y++)
- {
- for (x=0; x<8; x++)
- {
- pDst[y*dstStep+x] = pSrcAbove[x];
- }
- }
- break;
-
- case OMX_VC_CHROMA_PLANE:
- H = 4*(pSrcAbove[7] - pSrcAboveLeft[0]);
- for (x=2; x>=0; x--)
- {
- H += (x+1)*(pSrcAbove[4+x] - pSrcAbove[2-x]);
- }
- V = 4*(pSrcLeft[7*leftStep] - pSrcAboveLeft[0]);
- for (y=2; y>=0; y--)
- {
- V += (y+1)*(pSrcLeft[(4+y)*leftStep] - pSrcLeft[(2-y)*leftStep]);
- }
- a = 16*(pSrcAbove[7] + pSrcLeft[7*leftStep]);
- b = (17*H+16)>>5;
- c = (17*V+16)>>5;
- for (y=0; y<8; y++)
- {
- for (x=0; x<8; x++)
- {
- Sum = (a + b*(x-3) + c*(y-3) + 16)>>5;
- pDst[y*dstStep+x] = (OMX_U8)armClip(0,255,Sum);
- }
- }
- break;
- }
-
- return OMX_Sts_NoErr;
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_PredictIntra_16x16.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_PredictIntra_16x16.c
deleted file mode 100644
index ec44526..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_PredictIntra_16x16.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_PredictIntra_16x16.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 16x16 intra prediction module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_PredictIntra_16x16 (6.3.3.1.2)
- *
- * Description:
- * Perform Intra_16x16 prediction for luma samples. If the upper-right block
- * is not available, then duplication work should be handled inside the
- * function. Users need not define them outside.
- *
- * Input Arguments:
- *
- * pSrcLeft - Pointer to the buffer of 16 left pixels: p[x, y] (x = -1, y =
- * 0..15)
- * pSrcAbove - Pointer to the buffer of 16 above pixels: p[x,y] (x = 0..15,
- * y= -1); must be aligned on a 16-byte boundary.
- * pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1)
- * leftStep - Step of left pixel buffer; must be a multiple of 16.
- * dstStep - Step of the destination buffer; must be a multiple of 16.
- * predMode - Intra_16x16 prediction mode, please refer to section 3.4.1.
- * availability - Neighboring 16x16 MB availability flag. Refer to
- * section 3.4.4.
- *
- * Output Arguments:
- *
- * pDst -Pointer to the destination buffer; must be aligned on a 16-byte
- * boundary.
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * pDst is NULL.
- * dstStep < 16. or dstStep is not a multiple of 16.
- * leftStep is not a multiple of 16.
- * predMode is not in the valid range of enumeration
- * OMXVCM4P10Intra16x16PredMode
- * predMode is OMX_VC_16X16_VERT, but availability doesn't set
- * OMX_VC_UPPER indicating p[x,-1] (x = 0..15) is not available.
- * predMode is OMX_VC_16X16_HOR, but availability doesn't set OMX_VC_LEFT
- * indicating p[-1,y] (y = 0..15) is not available.
- * predMode is OMX_VC_16X16_PLANE, but availability doesn't set
- * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
- * p[x,-1](x = 0..15), or p[-1,y] (y = 0..15), or p[-1,-1] is not
- * available.
- * availability sets OMX_VC_UPPER, but pSrcAbove is NULL.
- * availability sets OMX_VC_LEFT, but pSrcLeft is NULL.
- * availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL.
- * either pSrcAbove or pDst is not aligned on a 16-byte boundary.
- *
- * Note:
- * pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointers if
- * they are not used by intra prediction implied in predMode.
- * Note:
- * OMX_VC_UPPER_RIGHT is not used in intra_16x16 luma prediction.
- *
- */
-OMXResult omxVCM4P10_PredictIntra_16x16(
- const OMX_U8* pSrcLeft,
- const OMX_U8 *pSrcAbove,
- const OMX_U8 *pSrcAboveLeft,
- OMX_U8* pDst,
- OMX_INT leftStep,
- OMX_INT dstStep,
- OMXVCM4P10Intra16x16PredMode predMode,
- OMX_S32 availability)
-{
- int x,y,Sum,Count;
- int H,V,a,b,c;
-
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(dstStep < 16, OMX_Sts_BadArgErr);
- armRetArgErrIf((dstStep % 16) != 0, OMX_Sts_BadArgErr);
- armRetArgErrIf((leftStep % 16) != 0, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot16ByteAligned(pSrcAbove), OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot16ByteAligned(pDst), OMX_Sts_BadArgErr);
- armRetArgErrIf((availability & OMX_VC_UPPER) && pSrcAbove == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf((availability & OMX_VC_LEFT ) && pSrcLeft == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf((availability & OMX_VC_UPPER_LEFT) && pSrcAboveLeft == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_16X16_VERT && !(availability & OMX_VC_UPPER), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_16X16_HOR && !(availability & OMX_VC_LEFT), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_16X16_PLANE && !(availability & OMX_VC_UPPER), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_16X16_PLANE && !(availability & OMX_VC_UPPER_LEFT), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_16X16_PLANE && !(availability & OMX_VC_LEFT), OMX_Sts_BadArgErr);
- armRetArgErrIf((unsigned)predMode > OMX_VC_16X16_PLANE, OMX_Sts_BadArgErr);
-
- switch (predMode)
- {
- case OMX_VC_16X16_VERT:
- for (y=0; y<16; y++)
- {
- for (x=0; x<16; x++)
- {
- pDst[y*dstStep+x] = pSrcAbove[x];
- }
- }
- break;
-
- case OMX_VC_16X16_HOR:
- for (y=0; y<16; y++)
- {
- for (x=0; x<16; x++)
- {
- pDst[y*dstStep+x] = pSrcLeft[y*leftStep];
- }
- }
- break;
-
- case OMX_VC_16X16_DC:
- /* This can always be used even if no blocks available */
- Sum = 0;
- Count = 0;
- if (availability & OMX_VC_LEFT)
- {
- for (y=0; y<16; y++)
- {
- Sum += pSrcLeft[y*leftStep];
- }
- Count++;
- }
- if (availability & OMX_VC_UPPER)
- {
- for (x=0; x<16; x++)
- {
- Sum += pSrcAbove[x];
- }
- Count++;
- }
- if (Count==0)
- {
- Sum = 128;
- }
- else if (Count==1)
- {
- Sum = (Sum + 8) >> 4;
- }
- else /* Count = 2 */
- {
- Sum = (Sum + 16) >> 5;
- }
- for (y=0; y<16; y++)
- {
- for (x=0; x<16; x++)
- {
- pDst[y*dstStep+x] = (OMX_U8)Sum;
- }
- }
- break;
-
- case OMX_VC_16X16_PLANE:
- H = 8*(pSrcAbove[15] - pSrcAboveLeft[0]);
- for (x=6; x>=0; x--)
- {
- H += (x+1)*(pSrcAbove[8+x] - pSrcAbove[6-x]);
- }
- V = 8*(pSrcLeft[15*leftStep] - pSrcAboveLeft[0]);
- for (y=6; y>=0; y--)
- {
- V += (y+1)*(pSrcLeft[(8+y)*leftStep] - pSrcLeft[(6-y)*leftStep]);
- }
- a = 16*(pSrcAbove[15] + pSrcLeft[15*leftStep]);
- b = (5*H+32)>>6;
- c = (5*V+32)>>6;
- for (y=0; y<16; y++)
- {
- for (x=0; x<16; x++)
- {
- Sum = (a + b*(x-7) + c*(y-7) + 16)>>5;
- pDst[y*dstStep+x] = (OMX_U8)armClip(0,255,Sum);
- }
- }
- break;
- }
-
- return OMX_Sts_NoErr;
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_PredictIntra_4x4.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_PredictIntra_4x4.c
deleted file mode 100644
index 44c25f6..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_PredictIntra_4x4.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_PredictIntra_4x4.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 4x4 intra prediction module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_PredictIntra_4x4 (6.3.3.1.1)
- *
- * Description:
- * Perform Intra_4x4 prediction for luma samples. If the upper-right block is
- * not available, then duplication work should be handled inside the function.
- * Users need not define them outside.
- *
- * Input Arguments:
- *
- * pSrcLeft - Pointer to the buffer of 4 left pixels:
- * p[x, y] (x = -1, y = 0..3)
- * pSrcAbove - Pointer to the buffer of 8 above pixels:
- * p[x,y] (x = 0..7, y =-1);
- * must be aligned on a 4-byte boundary.
- * pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1)
- * leftStep - Step of left pixel buffer; must be a multiple of 4.
- * dstStep - Step of the destination buffer; must be a multiple of 4.
- * predMode - Intra_4x4 prediction mode.
- * availability - Neighboring 4x4 block availability flag, refer to
- * "Neighboring Macroblock Availability" .
- *
- * Output Arguments:
- *
- * pDst - Pointer to the destination buffer; must be aligned on a 4-byte
- * boundary.
- *
- * Return Value:
- * If the function runs without error, it returns OMX_Sts_NoErr.
- * If one of the following cases occurs, the function returns
- * OMX_Sts_BadArgErr:
- * pDst is NULL.
- * dstStep < 4, or dstStep is not a multiple of 4.
- * leftStep is not a multiple of 4.
- * predMode is not in the valid range of enumeration
- * OMXVCM4P10Intra4x4PredMode.
- * predMode is OMX_VC_4x4_VERT, but availability doesn't set OMX_VC_UPPER
- * indicating p[x,-1] (x = 0..3) is not available.
- * predMode is OMX_VC_4x4_HOR, but availability doesn't set OMX_VC_LEFT
- * indicating p[-1,y] (y = 0..3) is not available.
- * predMode is OMX_VC_4x4_DIAG_DL, but availability doesn't set
- * OMX_VC_UPPER indicating p[x, 1] (x = 0..3) is not available.
- * predMode is OMX_VC_4x4_DIAG_DR, but availability doesn't set
- * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
- * p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not
- * available.
- * predMode is OMX_VC_4x4_VR, but availability doesn't set
- * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
- * p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not
- * available.
- * predMode is OMX_VC_4x4_HD, but availability doesn't set
- * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
- * p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not
- * available.
- * predMode is OMX_VC_4x4_VL, but availability doesn't set OMX_VC_UPPER
- * indicating p[x,-1] (x = 0..3) is not available.
- * predMode is OMX_VC_4x4_HU, but availability doesn't set OMX_VC_LEFT
- * indicating p[-1,y] (y = 0..3) is not available.
- * availability sets OMX_VC_UPPER, but pSrcAbove is NULL.
- * availability sets OMX_VC_LEFT, but pSrcLeft is NULL.
- * availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL.
- * either pSrcAbove or pDst is not aligned on a 4-byte boundary.
- *
- * Note:
- * pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointers if
- * they are not used by intra prediction as implied in predMode.
- *
- */
-
-OMXResult omxVCM4P10_PredictIntra_4x4(
- const OMX_U8* pSrcLeft,
- const OMX_U8 *pSrcAbove,
- const OMX_U8 *pSrcAboveLeft,
- OMX_U8* pDst,
- OMX_INT leftStep,
- OMX_INT dstStep,
- OMXVCM4P10Intra4x4PredMode predMode,
- OMX_S32 availability
- )
-{
- int x, y;
- OMX_U8 pTmp[10];
-
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf((leftStep % 4) != 0, OMX_Sts_BadArgErr);
- armRetArgErrIf((dstStep % 4) != 0, OMX_Sts_BadArgErr);
- armRetArgErrIf((dstStep < 4), OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pSrcAbove), OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pDst), OMX_Sts_BadArgErr);
- armRetArgErrIf((availability & OMX_VC_UPPER) && pSrcAbove == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf((availability & OMX_VC_LEFT ) && pSrcLeft == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf((availability & OMX_VC_UPPER_LEFT) && pSrcAboveLeft == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_4X4_VERT && !(availability & OMX_VC_UPPER), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_4X4_HOR && !(availability & OMX_VC_LEFT), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_4X4_DIAG_DL && !(availability & OMX_VC_UPPER), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_4X4_DIAG_DR && !(availability & OMX_VC_UPPER), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_4X4_DIAG_DR && !(availability & OMX_VC_UPPER_LEFT), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_4X4_DIAG_DR && !(availability & OMX_VC_LEFT), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_4X4_VR && !(availability & OMX_VC_UPPER), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_4X4_VR && !(availability & OMX_VC_UPPER_LEFT), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_4X4_VR && !(availability & OMX_VC_LEFT), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_4X4_HD && !(availability & OMX_VC_UPPER), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_4X4_HD && !(availability & OMX_VC_UPPER_LEFT), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_4X4_HD && !(availability & OMX_VC_LEFT), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_4X4_VL && !(availability & OMX_VC_UPPER), OMX_Sts_BadArgErr);
- armRetArgErrIf(predMode==OMX_VC_4X4_HU && !(availability & OMX_VC_LEFT), OMX_Sts_BadArgErr);
- armRetArgErrIf((unsigned)predMode > OMX_VC_4X4_HU, OMX_Sts_BadArgErr);
-
- /* Note: This code must not read the pSrc arrays unless the corresponding
- * block is marked as available. If the block is not avaibable then pSrc
- * may not be a valid pointer.
- *
- * Note: To make the code more readable we refer to the neighbouring pixels
- * in variables named as below:
- *
- * UL U0 U1 U2 U3 U4 U5 U6 U7
- * L0 xx xx xx xx
- * L1 xx xx xx xx
- * L2 xx xx xx xx
- * L3 xx xx xx xx
- */
-
-#define UL pSrcAboveLeft[0]
-#define U0 pSrcAbove[0]
-#define U1 pSrcAbove[1]
-#define U2 pSrcAbove[2]
-#define U3 pSrcAbove[3]
-#define U4 pSrcAbove[4]
-#define U5 pSrcAbove[5]
-#define U6 pSrcAbove[6]
-#define U7 pSrcAbove[7]
-#define L0 pSrcLeft[0*leftStep]
-#define L1 pSrcLeft[1*leftStep]
-#define L2 pSrcLeft[2*leftStep]
-#define L3 pSrcLeft[3*leftStep]
-
- switch (predMode)
- {
- case OMX_VC_4X4_VERT:
- for (y=0; y<4; y++)
- {
- pDst[y*dstStep+0] = U0;
- pDst[y*dstStep+1] = U1;
- pDst[y*dstStep+2] = U2;
- pDst[y*dstStep+3] = U3;
- }
- break;
-
- case OMX_VC_4X4_HOR:
- for (x=0; x<4; x++)
- {
- pDst[0*dstStep+x] = L0;
- pDst[1*dstStep+x] = L1;
- pDst[2*dstStep+x] = L2;
- pDst[3*dstStep+x] = L3;
- }
- break;
-
- case OMX_VC_4X4_DC:
- /* This can always be used even if no blocks available */
- armVCM4P10_PredictIntraDC4x4(pSrcLeft, pSrcAbove, pDst, leftStep, dstStep, availability);
- break;
-
- case OMX_VC_4X4_DIAG_DL:
- pTmp[0] = (OMX_U8)((U0 + 2*U1 + U2 + 2)>>2);
- pTmp[1] = (OMX_U8)((U1 + 2*U2 + U3 + 2)>>2);
- if (availability & OMX_VC_UPPER_RIGHT)
- {
- pTmp[2] = (OMX_U8)((U2 + 2*U3 + U4 + 2)>>2);
- pTmp[3] = (OMX_U8)((U3 + 2*U4 + U5 + 2)>>2);
- pTmp[4] = (OMX_U8)((U4 + 2*U5 + U6 + 2)>>2);
- pTmp[5] = (OMX_U8)((U5 + 2*U6 + U7 + 2)>>2);
- pTmp[6] = (OMX_U8)((U6 + 3*U7 + 2)>>2);
- }
- else
- {
- pTmp[2] = (OMX_U8)((U2 + 3*U3 + 2)>>2);
- pTmp[3] = U3;
- pTmp[4] = U3;
- pTmp[5] = U3;
- pTmp[6] = U3;
- }
- for (y=0; y<4; y++)
- {
- for (x=0; x<4; x++)
- {
- pDst[y*dstStep+x] = pTmp[x+y];
- }
- }
- break;
-
- case OMX_VC_4X4_DIAG_DR:
- /* x-y = -3, -2, -1, 0, 1, 2, 3 */
- pTmp[0] = (OMX_U8)((L1 + 2*L2 + L3 + 2)>>2);
- pTmp[1] = (OMX_U8)((L0 + 2*L1 + L2 + 2)>>2);
- pTmp[2] = (OMX_U8)((UL + 2*L0 + L1 + 2)>>2);
- pTmp[3] = (OMX_U8)((U0 + 2*UL + L0 + 2)>>2);
- pTmp[4] = (OMX_U8)((U1 + 2*U0 + UL + 2)>>2);
- pTmp[5] = (OMX_U8)((U2 + 2*U1 + U0 + 2)>>2);
- pTmp[6] = (OMX_U8)((U3 + 2*U2 + U1 + 2)>>2);
- for (y=0; y<4; y++)
- {
- for (x=0; x<4; x++)
- {
- pDst[y*dstStep+x] = pTmp[3+x-y];
- }
- }
- break;
-
- case OMX_VC_4X4_VR:
- /* zVR=2x-y = -3, -2, -1, 0, 1, 2, 3, 4, 5, 6
- * x-(y>>1) = -1, -1, 0, 0, 1, 1, 2, 2, 3, 3
- * y = 3, 2, ?, ?, ?, ?, ?, ?, 1, 0
- */
- pTmp[0] = (OMX_U8)((L2 + 2*L1 + L0 + 2)>>2);
- pTmp[1] = (OMX_U8)((L1 + 2*L0 + UL + 2)>>2);
- pTmp[2] = (OMX_U8)((L0 + 2*UL + U0 + 2)>>2);
- pTmp[3] = (OMX_U8)((UL + U0 + 1)>>1);
- pTmp[4] = (OMX_U8)((UL + 2*U0 + U1 + 2)>>2);
- pTmp[5] = (OMX_U8)((U0 + U1 + 1)>>1);
- pTmp[6] = (OMX_U8)((U0 + 2*U1 + U2 + 2)>>2);
- pTmp[7] = (OMX_U8)((U1 + U2 + 1)>>1);
- pTmp[8] = (OMX_U8)((U1 + 2*U2 + U3 + 2)>>2);
- pTmp[9] = (OMX_U8)((U2 + U3 + 1)>>1);
- for (y=0; y<4; y++)
- {
- for (x=0; x<4; x++)
- {
- pDst[y*dstStep+x] = pTmp[3+2*x-y];
- }
- }
- break;
-
- case OMX_VC_4X4_HD:
- /* zHD=2y-x = -3 -2 -1 0 1 2 3 4 5 6
- * y-(x>>1) = -1 -1 0 0 1 1 2 2 3 3
- * x = 3 2 1 0
- */
- pTmp[0] = (OMX_U8)((U2 + 2*U1 + U0 + 2)>>2);
- pTmp[1] = (OMX_U8)((U1 + 2*U0 + UL + 2)>>2);
- pTmp[2] = (OMX_U8)((U0 + 2*UL + L0 + 2)>>2);
- pTmp[3] = (OMX_U8)((UL + L0 + 1)>>1);
- pTmp[4] = (OMX_U8)((UL + 2*L0 + L1 + 2)>>2);
- pTmp[5] = (OMX_U8)((L0 + L1 + 1)>>1);
- pTmp[6] = (OMX_U8)((L0 + 2*L1 + L2 + 2)>>2);
- pTmp[7] = (OMX_U8)((L1 + L2 + 1)>>1);
- pTmp[8] = (OMX_U8)((L1 + 2*L2 + L3 + 2)>>2);
- pTmp[9] = (OMX_U8)((L2 + L3 + 1)>>1);
- for (y=0; y<4; y++)
- {
- for (x=0; x<4; x++)
- {
- pDst[y*dstStep+x] = pTmp[3+2*y-x];
- }
- }
- break;
-
- case OMX_VC_4X4_VL:
- /* Note: x+(y>>1) = (2*x+y)>>1
- * 2x+y = 0 1 2 3 4 5 6 7 8 9
- */
- pTmp[0] = (OMX_U8)((U0 + U1 + 1)>>1);
- pTmp[1] = (OMX_U8)((U0 + 2*U1 + U2 + 2)>>2);
- pTmp[2] = (OMX_U8)((U1 + U2 + 1)>>1);
- pTmp[3] = (OMX_U8)((U1 + 2*U2 + U3 + 2)>>2);
- pTmp[4] = (OMX_U8)((U2 + U3 + 1)>>1);
- if (availability & OMX_VC_UPPER_RIGHT)
- {
- pTmp[5] = (OMX_U8)((U2 + 2*U3 + U4 + 2)>>2);
- pTmp[6] = (OMX_U8)((U3 + U4 + 1)>>1);
- pTmp[7] = (OMX_U8)((U3 + 2*U4 + U5 + 2)>>2);
- pTmp[8] = (OMX_U8)((U4 + U5 + 1)>>1);
- pTmp[9] = (OMX_U8)((U4 + 2*U5 + U6 + 2)>>2);
- }
- else
- {
- pTmp[5] = (OMX_U8)((U2 + 3*U3 + 2)>>2);
- pTmp[6] = U3;
- pTmp[7] = U3;
- pTmp[8] = U3;
- pTmp[9] = U3;
- }
- for (y=0; y<4; y++)
- {
- for (x=0; x<4; x++)
- {
- pDst[y*dstStep+x] = pTmp[2*x+y];
- }
- }
- break;
-
- case OMX_VC_4X4_HU:
- /* zHU = x+2*y */
- pTmp[0] = (OMX_U8)((L0 + L1 + 1)>>1);
- pTmp[1] = (OMX_U8)((L0 + 2*L1 + L2 + 2)>>2);
- pTmp[2] = (OMX_U8)((L1 + L2 + 1)>>1);
- pTmp[3] = (OMX_U8)((L1 + 2*L2 + L3 + 2)>>2);
- pTmp[4] = (OMX_U8)((L2 + L3 + 1)>>1);
- pTmp[5] = (OMX_U8)((L2 + 3*L3 + 2)>>2);
- pTmp[6] = L3;
- pTmp[7] = L3;
- pTmp[8] = L3;
- pTmp[9] = L3;
- for (y=0; y<4; y++)
- {
- for (x=0; x<4; x++)
- {
- pDst[y*dstStep+x] = pTmp[x+2*y];
- }
- }
- break;
- }
-
- return OMX_Sts_NoErr;
-}
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_SADQuar_16x.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_SADQuar_16x.c
deleted file mode 100644
index 140a785..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_SADQuar_16x.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_SADQuar_16x.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate SAD of pSrc with average of two Ref blocks
- * of 16x16 or 16x8
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: omxVCM4P10_SADQuar_16x (6.3.5.4.4)
- *
- * Description:
- * This function calculates the SAD between one block (pSrc) and the average
- * of the other two (pSrcRef0 and pSrcRef1) for 16x16 or 16x8 blocks.
- * Rounding is applied according to the convention (a+b+1)>>1.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the original block; must be aligned on a 16-byte
- * boundary.
- * pSrcRef0 - Pointer to reference block 0
- * pSrcRef1 - Pointer to reference block 1
- * iSrcStep - Step of the original block buffer; must be a multiple of 16
- * iRefStep0 - Step of reference block 0
- * iRefStep1 - Step of reference block 1
- * iHeight - Height of the block; must be equal to either 8 or 16
- *
- * Output Arguments:
- *
- * pDstSAD -Pointer of result SAD
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - iHeight is not equal to either 8 or 16.
- * - One of more of the following pointers is NULL: pSrc, pSrcRef0,
- * pSrcRef1, pDstSAD.
- * - iSrcStep is not a multiple of 16
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_SADQuar_16x(
- const OMX_U8* pSrc,
- const OMX_U8* pSrcRef0,
- const OMX_U8* pSrcRef1,
- OMX_U32 iSrcStep,
- OMX_U32 iRefStep0,
- OMX_U32 iRefStep1,
- OMX_U32* pDstSAD,
- OMX_U32 iHeight
-)
-{
- /* check for argument error */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pSrcRef0 == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pSrcRef1 == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstSAD == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf((iHeight != 16) && (iHeight != 8), OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot16ByteAligned(pSrc), OMX_Sts_BadArgErr)
- armRetArgErrIf((iSrcStep == 0) || (iSrcStep & 15), OMX_Sts_BadArgErr)
-
-
- return armVCM4P10_SADQuar
- (pSrc, pSrcRef0, pSrcRef1, iSrcStep,
- iRefStep0, iRefStep1, pDstSAD, iHeight, 16);
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_SADQuar_4x.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_SADQuar_4x.c
deleted file mode 100644
index 4b60d34..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_SADQuar_4x.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_SADQuar_4x.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate SAD of pSrc with average of two Ref blocks
- * of 4x8 or 4x4 blocks
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: omxVCM4P10_SADQuar_4x (6.3.5.4.2)
- *
- * Description:
- * This function calculates the SAD between one block (pSrc) and the average
- * of the other two (pSrcRef0 and pSrcRef1) for 4x8 or 4x4 blocks. Rounding
- * is applied according to the convention (a+b+1)>>1.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the original block; must be aligned on a 4-byte
- * boundary.
- * pSrcRef0 - Pointer to reference block 0
- * pSrcRef1 - Pointer to reference block 1
- * iSrcStep - Step of the original block buffer; must be a multiple of 4.
- * iRefStep0 - Step of reference block 0
- * iRefStep1 - Step of reference block 1
- * iHeight - Height of the block; must be equal to either 4 or 8.
- *
- * Output Arguments:
- *
- * pDstSAD - Pointer of result SAD
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - iHeight is not equal to either 4 or 8.
- * - One of more of the following pointers is NULL: pSrc, pSrcRef0,
- * pSrcRef1, pDstSAD.
- * - iSrcStep is not a multiple of 4
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_SADQuar_4x(
- const OMX_U8* pSrc,
- const OMX_U8* pSrcRef0,
- const OMX_U8* pSrcRef1,
- OMX_U32 iSrcStep,
- OMX_U32 iRefStep0,
- OMX_U32 iRefStep1,
- OMX_U32* pDstSAD,
- OMX_U32 iHeight
-)
-{
- /* check for argument error */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcRef0 == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcRef1 == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDstSAD == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf((iHeight != 8) && (iHeight != 4), OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pSrc), OMX_Sts_BadArgErr);
- armRetArgErrIf((iSrcStep == 0) || (iSrcStep & 3), OMX_Sts_BadArgErr);
-
- return armVCM4P10_SADQuar
- (pSrc, pSrcRef0, pSrcRef1, iSrcStep,
- iRefStep0, iRefStep1, pDstSAD, iHeight, 4);
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_SADQuar_8x.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_SADQuar_8x.c
deleted file mode 100644
index 6c8cdf3..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_SADQuar_8x.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_SADQuar_8x.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate SAD of pSrc with average of two Ref blocks
- * of 8x16 or 8x8 or 8x4
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: omxVCM4P10_SADQuar_8x (6.3.5.4.3)
- *
- * Description:
- * This function calculates the SAD between one block (pSrc) and the average
- * of the other two (pSrcRef0 and pSrcRef1) for 8x16, 8x8, or 8x4 blocks.
- * Rounding is applied according to the convention (a+b+1)>>1.
- *
- * Input Arguments:
- *
- * pSrc - Pointer to the original block; must be aligned on an 8-byte
- * boundary.
- * pSrcRef0 - Pointer to reference block 0
- * pSrcRef1 - Pointer to reference block 1
- * iSrcStep - Step of the original block buffer; must be a multiple of 8.
- * iRefStep0 - Step of reference block 0
- * iRefStep1 - Step of reference block 1
- * iHeight - Height of the block; must be equal either 4, 8, or 16.
- *
- * Output Arguments:
- *
- * pDstSAD - Pointer of result SAD
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - iHeight is not equal to either 4, 8, or 16.
- * - One of more of the following pointers is NULL: pSrc, pSrcRef0,
- * pSrcRef1, pDstSAD.
- * - iSrcStep is not a multiple of 8
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_SADQuar_8x(
- const OMX_U8* pSrc,
- const OMX_U8* pSrcRef0,
- const OMX_U8* pSrcRef1,
- OMX_U32 iSrcStep,
- OMX_U32 iRefStep0,
- OMX_U32 iRefStep1,
- OMX_U32* pDstSAD,
- OMX_U32 iHeight
-)
-{
- /* check for argument error */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pSrcRef0 == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pSrcRef1 == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstSAD == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf((iHeight != 16) && (iHeight != 8) &&
- (iHeight != 4), OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot8ByteAligned(pSrc), OMX_Sts_BadArgErr)
- armRetArgErrIf((iSrcStep == 0) || (iSrcStep & 7), OMX_Sts_BadArgErr)
-
-
- return armVCM4P10_SADQuar
- (pSrc, pSrcRef0, pSrcRef1, iSrcStep,
- iRefStep0, iRefStep1, pDstSAD, iHeight, 8);
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_SAD_4x.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_SAD_4x.c
deleted file mode 100644
index e22d8dd..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_SAD_4x.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_SAD_4x.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate SAD for 4x8 and 4x4 blocks
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: omxVCM4P10_SAD_4x (6.3.5.4.1)
- *
- * Description:
- * This function calculates the SAD for 4x8 and 4x4 blocks.
- *
- * Input Arguments:
- *
- * pSrcOrg -Pointer to the original block; must be aligned on a 4-byte
- * boundary.
- * iStepOrg -Step of the original block buffer; must be a multiple of 4.
- * pSrcRef -Pointer to the reference block
- * iStepRef -Step of the reference block buffer
- * iHeight -Height of the block; must be equal to either 4 or 8.
- *
- * Output Arguments:
- *
- * pDstSAD -Pointer of result SAD
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - One of more of the following pointers is NULL:
- * pSrcOrg, pSrcRef, or pDstSAD
- * - iHeight is not equal to either 4 or 8.
- * - iStepOrg is not a multiple of 4
- * - Any alignment restrictions are violated
- *
- */
-OMXResult omxVCM4P10_SAD_4x(
- const OMX_U8* pSrcOrg,
- OMX_U32 iStepOrg,
- const OMX_U8* pSrcRef,
- OMX_U32 iStepRef,
- OMX_S32* pDstSAD,
- OMX_U32 iHeight
-)
-{
- /* check for argument error */
- armRetArgErrIf(pSrcOrg == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pSrcRef == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstSAD == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf((iHeight != 8) && (iHeight != 4), OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot4ByteAligned(pSrcOrg), OMX_Sts_BadArgErr)
- armRetArgErrIf((iStepOrg == 0) || (iStepOrg & 3), OMX_Sts_BadArgErr)
- armRetArgErrIf((iStepRef == 0) || (iStepRef & 3), OMX_Sts_BadArgErr)
-
- return armVCCOMM_SAD
- (pSrcOrg, iStepOrg, pSrcRef, iStepRef, pDstSAD, iHeight, 4);
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_SATD_4x4.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_SATD_4x4.c
deleted file mode 100644
index 6f74499..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_SATD_4x4.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_SATD_4x4.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate SAD for 4x4 blocks
- *
- */
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-
-/**
- * Function: omxVCM4P10_SATD_4x4 (6.3.5.4.5)
- *
- * Description:
- * This function calculates the sum of absolute transform differences (SATD)
- * for a 4x4 block by applying a Hadamard transform to the difference block
- * and then calculating the sum of absolute coefficient values.
- *
- * Input Arguments:
- *
- * pSrcOrg - Pointer to the original block; must be aligned on a 4-byte
- * boundary
- * iStepOrg - Step of the original block buffer; must be a multiple of 4
- * pSrcRef - Pointer to the reference block; must be aligned on a 4-byte
- * boundary
- * iStepRef - Step of the reference block buffer; must be a multiple of 4
- *
- * Output Arguments:
- *
- * pDstSAD - pointer to the resulting SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrcOrg, pSrcRef, or pDstSAD either pSrcOrg
- * - pSrcRef is not aligned on a 4-byte boundary
- * - iStepOrg <= 0 or iStepOrg is not a multiple of 4
- * - iStepRef <= 0 or iStepRef is not a multiple of 4
- *
- */
-OMXResult omxVCM4P10_SATD_4x4(
- const OMX_U8* pSrcOrg,
- OMX_U32 iStepOrg,
- const OMX_U8* pSrcRef,
- OMX_U32 iStepRef,
- OMX_U32* pDstSAD
-)
-{
- OMX_INT i, j;
- OMX_S32 SATD = 0;
- OMX_S32 d [4][4], m1[4][4], m2[4][4];
-
- /* check for argument error */
- armRetArgErrIf(pSrcOrg == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pSrcRef == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstSAD == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf((iStepOrg == 0) || (iStepOrg & 3), OMX_Sts_BadArgErr)
- armRetArgErrIf((iStepRef == 0) || (iStepRef & 3), OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot4ByteAligned(pSrcOrg), OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot4ByteAligned(pSrcRef), OMX_Sts_BadArgErr)
-
- /* Calculate the difference */
- for (j = 0; j < 4; j++)
- {
- for (i = 0; i < 4; i++)
- {
- d [j][i] = pSrcOrg [j * iStepOrg + i] - pSrcRef [j * iStepRef + i];
- }
- }
-
- /* Hadamard Transfor for 4x4 block */
-
- /* Horizontal */
- for (i = 0; i < 4; i++)
- {
- m1[i][0] = d[i][0] + d[i][2]; /* a+c */
- m1[i][1] = d[i][1] + d[i][3]; /* b+d */
- m1[i][2] = d[i][0] - d[i][2]; /* a-c */
- m1[i][3] = d[i][1] - d[i][3]; /* b-d */
-
- m2[i][0] = m1[i][0] + m1[i][1]; /* a+b+c+d */
- m2[i][1] = m1[i][2] + m1[i][3]; /* a+b-c-d */
- m2[i][2] = m1[i][2] - m1[i][3]; /* a-b-c+d */
- m2[i][3] = m1[i][0] - m1[i][1]; /* a-b+c-d */
-
- }
-
- /* Vertical */
- for (i = 0; i < 4; i++)
- {
- m1[0][i] = m2[0][i] + m2[2][i];
- m1[1][i] = m2[1][i] + m2[3][i];
- m1[2][i] = m2[0][i] - m2[2][i];
- m1[3][i] = m2[1][i] - m2[3][i];
-
- m2[0][i] = m1[0][i] + m1[1][i];
- m2[1][i] = m1[2][i] + m1[3][i];
- m2[2][i] = m1[2][i] - m1[3][i];
- m2[3][i] = m1[0][i] - m1[1][i];
- }
-
- /* calculate SAD for Transformed coefficients */
- for (j = 0; j < 4; j++)
- {
- for (i = 0; i < 4; i++)
- {
- SATD += armAbs(m2 [j][i]);
- }
- }
-
- *pDstSAD = (SATD + 1) / 2;
-
- return OMX_Sts_NoErr;
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_SubAndTransformQDQResidual.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_SubAndTransformQDQResidual.c
deleted file mode 100644
index f184d7c..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_SubAndTransformQDQResidual.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_SubAndTransformQDQResidual.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate SAD for 4x4 blocks
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_SubAndTransformQDQResidual (6.3.5.8.1)
- *
- * Description:
- * This function subtracts the prediction signal from the original signal to
- * produce the difference signal and then performs a 4x4 integer transform and
- * quantization. The quantized transformed coefficients are stored as
- * pDstQuantCoeff. This function can also output dequantized coefficients or
- * unquantized DC coefficients optionally by setting the pointers
- * pDstDeQuantCoeff, pDCCoeff.
- *
- * Input Arguments:
- *
- * pSrcOrg - Pointer to original signal. 4-byte alignment required.
- * pSrcPred - Pointer to prediction signal. 4-byte alignment required.
- * iSrcOrgStep - Step of the original signal buffer; must be a multiple of
- * 4.
- * iSrcPredStep - Step of the prediction signal buffer; must be a multiple
- * of 4.
- * pNumCoeff -Number of non-zero coefficients after quantization. If this
- * parameter is not required, it is set to NULL.
- * nThreshSAD - Zero-block early detection threshold. If this parameter is
- * not required, it is set to 0.
- * iQP - Quantization parameter; must be in the range [0,51].
- * bIntra - Indicates whether this is an INTRA block, either 1-INTRA or
- * 0-INTER
- *
- * Output Arguments:
- *
- * pDstQuantCoeff - Pointer to the quantized transformed coefficients.
- * 8-byte alignment required.
- * pDstDeQuantCoeff - Pointer to the dequantized transformed coefficients
- * if this parameter is not equal to NULL. 8-byte alignment
- * required.
- * pDCCoeff - Pointer to the unquantized DC coefficient if this parameter
- * is not equal to NULL.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrcOrg, pSrcPred, pNumCoeff, pDstQuantCoeff,
- * pDstDeQuantCoeff, pDCCoeff
- * - pSrcOrg is not aligned on a 4-byte boundary
- * - pSrcPred is not aligned on a 4-byte boundary
- * - iSrcOrgStep is not a multiple of 4
- * - iSrcPredStep is not a multiple of 4
- * - pDstQuantCoeff or pDstDeQuantCoeff is not aligned on an 8-byte boundary
- *
- */
- OMXResult omxVCM4P10_SubAndTransformQDQResidual (
- const OMX_U8* pSrcOrg,
- const OMX_U8* pSrcPred,
- OMX_U32 iSrcOrgStep,
- OMX_U32 iSrcPredStep,
- OMX_S16* pDstQuantCoeff,
- OMX_S16* pDstDeQuantCoeff,
- OMX_S16* pDCCoeff,
- OMX_S8* pNumCoeff,
- OMX_U32 nThreshSAD,
- OMX_U32 iQP,
- OMX_U8 bIntra
-)
-{
- OMX_INT i, j;
- OMX_S8 NumCoeff = 0;
- OMX_S16 Buf[16], m[16];
- OMX_U32 QBits, QPper, QPmod, f;
- OMX_S32 Value, MF, ThreshDC;
-
- /* check for argument error */
- armRetArgErrIf(pSrcOrg == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstDeQuantCoeff == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pNumCoeff == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(pDCCoeff == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot4ByteAligned(pSrcOrg), OMX_Sts_BadArgErr)
- armRetArgErrIf(pSrcPred == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot4ByteAligned(pSrcPred), OMX_Sts_BadArgErr)
- armRetArgErrIf(pDstQuantCoeff == NULL, OMX_Sts_BadArgErr)
- armRetArgErrIf(armNot8ByteAligned(pDstQuantCoeff), OMX_Sts_BadArgErr)
- armRetArgErrIf((pDstDeQuantCoeff != NULL) &&
- armNot8ByteAligned(pDstDeQuantCoeff), OMX_Sts_BadArgErr)
- armRetArgErrIf((bIntra != 0) && (bIntra != 1), OMX_Sts_BadArgErr)
- armRetArgErrIf(iQP > 51, OMX_Sts_BadArgErr)
- armRetArgErrIf(iSrcOrgStep == 0, OMX_Sts_BadArgErr)
- armRetArgErrIf(iSrcPredStep == 0, OMX_Sts_BadArgErr)
- armRetArgErrIf(iSrcOrgStep & 3, OMX_Sts_BadArgErr)
- armRetArgErrIf(iSrcPredStep & 3, OMX_Sts_BadArgErr)
-
- /*
- * Zero-Block Early detection using nThreshSAD param
- */
-
- QPper = iQP / 6;
- QPmod = iQP % 6;
- QBits = 15 + QPper;
-
- f = (1 << QBits) / (bIntra ? 3 : 6);
-
- /* Do Zero-Block Early detection if enabled */
- if (nThreshSAD)
- {
- ThreshDC = ((1 << QBits) - f) / armVCM4P10_MFMatrix[QPmod][0];
- if (nThreshSAD < ThreshDC)
- {
- /* Set block to zero */
- if (pDCCoeff != NULL)
- {
- *pDCCoeff = 0;
- }
-
- for (j = 0; j < 4; j++)
- {
- for (i = 0; i < 4; i++)
- {
- pDstQuantCoeff [4 * j + i] = 0;
- if (pDstDeQuantCoeff != NULL)
- {
- pDstDeQuantCoeff [4 * j + i] = 0;
- }
- }
- }
-
- if (pNumCoeff != NULL)
- {
- *pNumCoeff = 0;
- }
- return OMX_Sts_NoErr;
- }
- }
-
-
- /* Calculate difference */
- for (j = 0; j < 4; j++)
- {
- for (i = 0; i < 4; i++)
- {
- Buf [j * 4 + i] =
- pSrcOrg [j * iSrcOrgStep + i] - pSrcPred [j * iSrcPredStep + i];
- }
- }
-
- /* Residual Transform */
- armVCM4P10_FwdTransformResidual4x4 (m, Buf);
-
- if (pDCCoeff != NULL)
- {
- /* Copy unquantized DC value into pointer */
- *pDCCoeff = m[0];
- }
-
- /* Quantization */
- for (j = 0; j < 4; j++)
- {
- for (i = 0; i < 4; i++)
- {
- MF = armVCM4P10_MFMatrix[QPmod][armVCM4P10_PosToVCol4x4[j * 4 + i]];
- Value = armAbs(m[j * 4 + i]) * MF + f;
- Value >>= QBits;
- Value = m[j * 4 + i] < 0 ? -Value : Value;
- Buf[4 * j + i] = pDstQuantCoeff [4 * j + i] = (OMX_S16)Value;
- if ((pNumCoeff != NULL) && Value)
- {
- NumCoeff++;
- }
- }
- }
-
- /* Output number of non-zero Coeffs */
- if (pNumCoeff != NULL)
- {
- *pNumCoeff = NumCoeff;
- }
-
- /* Residual Inv Transform */
- if (pDstDeQuantCoeff != NULL)
- {
- /* Re Scale */
- for (j = 0; j < 4; j++)
- {
- for (i = 0; i < 4; i++)
- {
- m [j * 4 + i] = Buf [j * 4 + i] * (1 << QPper) *
- armVCM4P10_VMatrix[QPmod][armVCM4P10_PosToVCol4x4[j * 4 + i]];
- }
- }
- armVCM4P10_TransformResidual4x4 (pDstDeQuantCoeff, m);
- }
-
- return OMX_Sts_NoErr;
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_TransformDequantChromaDCFromPair.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_TransformDequantChromaDCFromPair.c
deleted file mode 100644
index dd9f5a7..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_TransformDequantChromaDCFromPair.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_TransformDequantChromaDCFromPair.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 inverse quantize and transform module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/*
- * Description:
- * Dequantize Chroma 2x2 DC block
- */
-
-static void DequantChromaDC2x2(
- OMX_S16* pDst,
- OMX_INT QP
-)
-{
- int Shift = (QP/6)-1 ;
- int Scale = armVCM4P10_VMatrix[QP%6][0];
- int i, Value;
-
- if (Shift >= 0)
- {
- for (i=0; i<4; i++)
- {
- Value = (pDst[i] * Scale) << Shift;
- pDst[i] = (OMX_S16)Value;
- }
- }
- else
- {
- for (i=0; i<4; i++)
- {
- Value = (pDst[i] * Scale) >> 1;
- pDst[i] = (OMX_S16)Value;
- }
- }
-}
-
-
-/*
- * Description:
- * Inverse Transform DC 2x2 Coefficients
- */
-
-static void InvTransformDC2x2(OMX_S16* pData)
-{
- int c00 = pData[0];
- int c01 = pData[1];
- int c10 = pData[2];
- int c11 = pData[3];
-
- int d00 = c00 + c01;
- int d01 = c00 - c01;
- int d10 = c10 + c11;
- int d11 = c10 - c11;
-
- pData[0] = (OMX_S16)(d00 + d10);
- pData[1] = (OMX_S16)(d01 + d11);
- pData[2] = (OMX_S16)(d00 - d10);
- pData[3] = (OMX_S16)(d01 - d11);
-}
-
-
-/**
- * Function: omxVCM4P10_TransformDequantChromaDCFromPair (6.3.4.2.2)
- *
- * Description:
- * Reconstruct the 2x2 ChromaDC block from coefficient-position pair buffer,
- * perform integer inverse transformation, and dequantization for 2x2 chroma
- * DC coefficients, and update the pair buffer pointer to next non-empty
- * block.
- *
- * Input Arguments:
- *
- * ppSrc - Double pointer to residual coefficient-position pair buffer
- * output by CALVC decoding
- * QP - Quantization parameter QpC
- *
- * Output Arguments:
- *
- * ppSrc - *ppSrc is updated to the start of next non empty block
- * pDst - Pointer to the reconstructed 2x2 ChromaDC coefficients buffer;
- * must be aligned on a 4-byte boundary.
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - ppSrc or pDst is NULL.
- * - pDst is not 4-byte aligned.
- * - QP is not in the range of [0-51].
- *
- */
-
-OMXResult omxVCM4P10_TransformDequantChromaDCFromPair(
- const OMX_U8 **ppSrc,
- OMX_S16* pDst,
- OMX_INT QP
- )
-{
- armRetArgErrIf(ppSrc == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(*ppSrc == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot4ByteAligned(pDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(QP<0, OMX_Sts_BadArgErr);
- armRetArgErrIf(QP>51, OMX_Sts_BadArgErr);
-
- armVCM4P10_UnpackBlock2x2(ppSrc, pDst);
- InvTransformDC2x2(pDst);
- DequantChromaDC2x2(pDst, QP);
-
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_TransformDequantLumaDCFromPair.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_TransformDequantLumaDCFromPair.c
deleted file mode 100644
index d333d49..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_TransformDequantLumaDCFromPair.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/* ----------------------------------------------------------------
- *
- *
- * File Name: omxVCM4P10_TransformDequantLumaDCFromPair.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * H.264 inverse quantize and transform module
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/*
- * Description:
- * Dequantize Luma DC block
- */
-
-static void DequantLumaDC4x4(
- OMX_S16* pDst,
- OMX_INT QP
-)
-{
- int Shift = (QP/6)-2 ;
- int Scale = armVCM4P10_VMatrix[QP%6][0];
- int i, Round, Value;
-
- if (Shift >= 0)
- {
- for (i=0; i<16; i++)
- {
- Value = (pDst[i] * Scale) << Shift;
- pDst[i] = (OMX_S16)Value;
- }
- }
- else
- {
- Shift = -Shift;;
- Round = 1<<(Shift-1);
-
- for (i=0; i<16; i++)
- {
- Value = (pDst[i] * Scale + Round) >> Shift;
- pDst[i] = (OMX_S16)Value;
- }
- }
-}
-
-
-
-/*
- * Description:
- * Inverse Transform DC 4x4 Coefficients
- */
-static void InvTransformDC4x4(OMX_S16* pData)
-{
- int i;
-
- /* Transform rows */
- for (i=0; i<16; i+=4)
- {
- int c0 = pData[i+0];
- int c1 = pData[i+1];
- int c2 = pData[i+2];
- int c3 = pData[i+3];
- pData[i+0] = (OMX_S16)(c0+c1+c2+c3);
- pData[i+1] = (OMX_S16)(c0+c1-c2-c3);
- pData[i+2] = (OMX_S16)(c0-c1-c2+c3);
- pData[i+3] = (OMX_S16)(c0-c1+c2-c3);
- }
-
- /* Transform columns */
- for (i=0; i<4; i++)
- {
- int c0 = pData[i+0];
- int c1 = pData[i+4];
- int c2 = pData[i+8];
- int c3 = pData[i+12];
- pData[i+0] = (OMX_S16)(c0+c1+c2+c3);
- pData[i+4] = (OMX_S16)(c0+c1-c2-c3);
- pData[i+8] = (OMX_S16)(c0-c1-c2+c3);
- pData[i+12] = (OMX_S16)(c0-c1+c2-c3);
- }
-}
-
-
-/**
- * Function: omxVCM4P10_TransformDequantLumaDCFromPair (6.3.4.2.1)
- *
- * Description:
- * Reconstructs the 4x4 LumaDC block from the coefficient-position pair
- * buffer, performs integer inverse, and dequantization for 4x4 LumaDC
- * coefficients, and updates the pair buffer pointer to the next non-empty
- * block.
- *
- * Input Arguments:
- *
- * ppSrc - Double pointer to residual coefficient-position pair buffer
- * output by CALVC decoding
- * QP - Quantization parameter QpY
- *
- * Output Arguments:
- *
- * ppSrc - *ppSrc is updated to the start of next non empty block
- * pDst - Pointer to the reconstructed 4x4 LumaDC coefficients buffer; must
- * be aligned on a 8-byte boundary.
- *
- * Return Value:
- * OMX_Sts_NoErr, if the function runs without error.
- * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
- * - ppSrc or pDst is NULL.
- * - pDst is not 8 byte aligned.
- * - QP is not in the range of [0-51].
- *
- */
-
-OMXResult omxVCM4P10_TransformDequantLumaDCFromPair(
- const OMX_U8 **ppSrc,
- OMX_S16* pDst,
- OMX_INT QP
- )
-{
- armRetArgErrIf(ppSrc == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(*ppSrc == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot8ByteAligned(pDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(QP<0, OMX_Sts_BadArgErr);
- armRetArgErrIf(QP>51, OMX_Sts_BadArgErr);
-
- armVCM4P10_UnpackBlock4x4(ppSrc, pDst);
- /*InvTransformDequantLumaDC4x4(pDst, QP);*/
- InvTransformDC4x4(pDst);
- DequantLumaDC4x4(pDst, QP);
-
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_TransformQuant_ChromaDC.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_TransformQuant_ChromaDC.c
deleted file mode 100644
index 1b6a3d0..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_TransformQuant_ChromaDC.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_TransformQuant_ChromaDC.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate 4x4 hadamard transform of chroma DC
- * coefficients and quantization
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: omxVCM4P10_TransformQuant_ChromaDC (6.3.5.6.1)
- *
- * Description:
- * This function performs 2x2 Hadamard transform of chroma DC coefficients
- * and then quantizes the coefficients.
- *
- * Input Arguments:
- *
- * pSrcDst - Pointer to the 2x2 array of chroma DC coefficients. 8-byte
- * alignment required.
- * iQP - Quantization parameter; must be in the range [0,51].
- * bIntra - Indicate whether this is an INTRA block. 1-INTRA, 0-INTER
- *
- * Output Arguments:
- *
- * pSrcDst - Pointer to transformed and quantized coefficients. 8-byte
- * alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL:
- * pSrcDst
- * - pSrcDst is not aligned on an 8-byte boundary
- *
- */
-OMXResult omxVCM4P10_TransformQuant_ChromaDC(
- OMX_S16* pSrcDst,
- OMX_U32 iQP,
- OMX_U8 bIntra
-)
-{
- OMX_INT i, j;
- OMX_S32 m[2][2];
- OMX_S32 Value;
- OMX_S32 QbitsPlusOne, Two_f, MF00;
-
- /* Check for argument error */
- armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot8ByteAligned(pSrcDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(iQP > 51, OMX_Sts_BadArgErr);
-
- /* Hadamard Transform for 2x2 block */
- m[0][0] = pSrcDst[0] + pSrcDst[1] + pSrcDst[2] + pSrcDst[3];
- m[0][1] = pSrcDst[0] - pSrcDst[1] + pSrcDst[2] - pSrcDst[3];
- m[1][0] = pSrcDst[0] + pSrcDst[1] - pSrcDst[2] - pSrcDst[3];
- m[1][1] = pSrcDst[0] - pSrcDst[1] - pSrcDst[2] + pSrcDst[3];
-
- /* Quantization */
- QbitsPlusOne = ARM_M4P10_Q_OFFSET + 1 + (iQP / 6); /*floor (QP/6)*/
- MF00 = armVCM4P10_MFMatrix [iQP % 6][0];
-
- Two_f = (1 << QbitsPlusOne) / (bIntra ? 3 : 6); /* 3->INTRA, 6->INTER */
-
- /* Scaling */
- for (j = 0; j < 2; j++)
- {
- for (i = 0; i < 2; i++)
- {
- Value = (armAbs(m[j][i]) * MF00 + Two_f) >> QbitsPlusOne;
- pSrcDst[j * 2 + i] = (OMX_S16)((m[j][i] < 0) ? -Value : Value);
- }
- }
-
- return OMX_Sts_NoErr;
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_TransformQuant_LumaDC.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_TransformQuant_LumaDC.c
deleted file mode 100644
index ea99a2d..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_TransformQuant_LumaDC.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P10_TransformQuant_LumaDC.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * This function will calculate 4x4 hadamard transform of luma DC coefficients
- * and quantization
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P10_TransformQuant_LumaDC (6.3.5.6.2)
- *
- * Description:
- * This function performs a 4x4 Hadamard transform of luma DC coefficients
- * and then quantizes the coefficients.
- *
- * Input Arguments:
- *
- * pSrcDst - Pointer to the 4x4 array of luma DC coefficients. 16-byte
- * alignment required.
- * iQP - Quantization parameter; must be in the range [0,51].
- *
- * Output Arguments:
- *
- * pSrcDst - Pointer to transformed and quantized coefficients. 16-byte
- * alignment required.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
- * conditions are true:
- * - at least one of the following pointers is NULL: pSrcDst
- * - pSrcDst is not aligned on an 16-byte boundary
- *
- */
-OMXResult omxVCM4P10_TransformQuant_LumaDC(
- OMX_S16* pSrcDst,
- OMX_U32 iQP
-)
-{
- OMX_INT i, j;
- OMX_S32 m1[4][4], m2[4][4];
- OMX_S32 Value;
- OMX_U32 QbitsPlusOne, Two_f, MF;
-
- /* Check for argument error */
- armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(armNot16ByteAligned(pSrcDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(iQP > 51, OMX_Sts_BadArgErr);
-
- /* Hadamard Transform for 4x4 block */
- /* Horizontal Hadamard */
- for (i = 0; i < 4; i++)
- {
- j = i * 4;
-
- m1[i][0] = pSrcDst[j + 0] + pSrcDst[j + 2]; /* a+c */
- m1[i][1] = pSrcDst[j + 1] + pSrcDst[j + 3]; /* b+d */
- m1[i][2] = pSrcDst[j + 0] - pSrcDst[j + 2]; /* a-c */
- m1[i][3] = pSrcDst[j + 1] - pSrcDst[j + 3]; /* b-d */
-
- m2[i][0] = m1[i][0] + m1[i][1]; /* a+b+c+d */
- m2[i][1] = m1[i][2] + m1[i][3]; /* a+b-c-d */
- m2[i][2] = m1[i][2] - m1[i][3]; /* a-b-c+d */
- m2[i][3] = m1[i][0] - m1[i][1]; /* a-b+c-d */
-
- }
-
- /* Vertical */
- for (i = 0; i < 4; i++)
- {
- m1[0][i] = m2[0][i] + m2[2][i];
- m1[1][i] = m2[1][i] + m2[3][i];
- m1[2][i] = m2[0][i] - m2[2][i];
- m1[3][i] = m2[1][i] - m2[3][i];
-
- m2[0][i] = m1[0][i] + m1[1][i];
- m2[1][i] = m1[2][i] + m1[3][i];
- m2[2][i] = m1[2][i] - m1[3][i];
- m2[3][i] = m1[0][i] - m1[1][i];
- }
-
-
- /* Quantization */
- QbitsPlusOne = ARM_M4P10_Q_OFFSET + 1 + (iQP / 6); /*floor (QP/6)*/
- Two_f = (1 << QbitsPlusOne) / 3; /* 3->INTRA, 6->INTER */
- MF = armVCM4P10_MFMatrix [iQP % 6][0];
-
- /* Scaling */
- for (j = 0; j < 4; j++)
- {
- for (i = 0; i < 4; i++)
- {
- Value = (armAbs((m2[j][i]/* + 1*/) / 2) * MF + Two_f) >> QbitsPlusOne;
- pSrcDst[j * 4 + i] = (OMX_S16)((m2[j][i] < 0) ? -Value : Value);
- }
- }
- return OMX_Sts_NoErr;
-}
-
-/*****************************************************************************
- * END OF FILE
- *****************************************************************************/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/api/armVCM4P2_DCT_Table.h b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/api/armVCM4P2_DCT_Table.h
deleted file mode 100644
index a72da13..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/api/armVCM4P2_DCT_Table.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_DCT_Table.h
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- *
- * File: armVCM4P2_DCT_Table.h
- * Description: Declares Tables used for DCT/IDCT module
- * in MP4P2 codec.
- *
- */
-
-#ifndef _OMXDCTTAB_H_
-#define _OMXDCTTAB_H_
-
-extern const OMX_F64 armVCM4P2_preCalcDCTCos[8][8];
-
-#endif /* _OMXDCTTAB_H_ */
-
-
-/* End of file */
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/api/armVCM4P2_Huff_Tables_VLC.h b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/api/armVCM4P2_Huff_Tables_VLC.h
deleted file mode 100644
index a88bdbc..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/api/armVCM4P2_Huff_Tables_VLC.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_Huff_Tables_VLC.h
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- *
- * File: armVCM4P2_Huff_Tables.h
- * Description: Declares Tables used for Hufffman coding and decoding
- * in MP4P2 codec.
- *
- */
-
-#ifndef _OMXHUFFTAB_H_
-#define _OMXHUFFTAB_H_
-
-extern const OMX_U8 armVCM4P2_IntraL0RunIdx[11];
-extern const ARM_VLC32 armVCM4P2_IntraVlcL0[68];
-extern const OMX_U8 armVCM4P2_IntraL1RunIdx[7];
-extern const ARM_VLC32 armVCM4P2_IntraVlcL1[36];
-extern const OMX_U8 armVCM4P2_IntraL0LMAX[15];
-extern const OMX_U8 armVCM4P2_IntraL1LMAX[21];
-extern const OMX_U8 armVCM4P2_IntraL0RMAX[27];
-extern const OMX_U8 armVCM4P2_IntraL1RMAX[8];
-extern const OMX_U8 armVCM4P2_InterL0RunIdx[12];
-extern const ARM_VLC32 armVCM4P2_InterVlcL0[59];
-extern const OMX_U8 armVCM4P2_InterL1RunIdx[3];
-extern const ARM_VLC32 armVCM4P2_InterVlcL1[45];
-extern const OMX_U8 armVCM4P2_InterL0LMAX[27];
-extern const OMX_U8 armVCM4P2_InterL1LMAX[41];
-extern const OMX_U8 armVCM4P2_InterL0RMAX[12];
-extern const OMX_U8 armVCM4P2_InterL1RMAX[3];
-extern const ARM_VLC32 armVCM4P2_aIntraDCLumaIndex[14];
-extern const ARM_VLC32 armVCM4P2_aIntraDCChromaIndex[14];
-extern const ARM_VLC32 armVCM4P2_aVlcMVD[66];
-
-#endif /* _OMXHUFFTAB_H_ */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/api/armVCM4P2_ZigZag_Tables.h b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/api/armVCM4P2_ZigZag_Tables.h
deleted file mode 100644
index 90c163f..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/api/armVCM4P2_ZigZag_Tables.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_ZigZag_Tables.h
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- *
- * File: armVCM4P2_Zigzag_Tables.h
- * Description: Declares Tables used for Zigzag scan in MP4P2 codec.
- *
- */
-
-#ifndef _OMXZIGZAGTAB_H_
-#define _OMXZIGZAGTAB_H_
-
-extern const OMX_U8 armVCM4P2_aClassicalZigzagScan [64];
-extern const OMX_U8 armVCM4P2_aHorizontalZigzagScan [64];
-extern const OMX_U8 armVCM4P2_aVerticalZigzagScan [64];
-
-#endif /* _OMXZIGZAGTAB_H_ */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_ACDCPredict.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_ACDCPredict.c
deleted file mode 100644
index c993f73..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_ACDCPredict.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_ACDCPredict.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains module for DC/AC coefficient prediction
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: armVCM4P2_ACDCPredict
- *
- * Description:
- * Performs adaptive DC/AC coefficient prediction for an intra block. Prior
- * to the function call, prediction direction (predDir) should be selected
- * as specified in subclause 7.4.3.1 of ISO/IEC 14496-2.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcDst pointer to the coefficient buffer which contains
- * the quantized coefficient residuals (PQF) of the
- * current block
- * [in] pPredBufRow pointer to the coefficient row buffer
- * [in] pPredBufCol pointer to the coefficient column buffer
- * [in] curQP quantization parameter of the current block. curQP
- * may equal to predQP especially when the current
- * block and the predictor block are in the same
- * macroblock.
- * [in] predQP quantization parameter of the predictor block
- * [in] predDir indicates the prediction direction which takes one
- * of the following values:
- * OMX_VC_HORIZONTAL predict horizontally
- * OMX_VC_VERTICAL predict vertically
- * [in] ACPredFlag a flag indicating if AC prediction should be
- * performed. It is equal to ac_pred_flag in the bit
- * stream syntax of MPEG-4
- * [in] videoComp video component type (luminance, chrominance or
- * alpha) of the current block
- * [in] flag This flag defines the if one wants to use this functions to
- * calculate PQF (set 1, prediction) or QF (set 0, reconstruction)
- * [out] pPreACPredict pointer to the predicted coefficients buffer.
- * Filled ONLY if it is not NULL
- * [out] pSrcDst pointer to the coefficient buffer which contains
- * the quantized coefficients (QF) of the current
- * block
- * [out] pPredBufRow pointer to the updated coefficient row buffer
- * [out] pPredBufCol pointer to the updated coefficient column buffer
- * [out] pSumErr pointer to the updated sum of the difference
- * between predicted and unpredicted coefficients
- * If this is NULL, do not update
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_ACDCPredict(
- OMX_S16 * pSrcDst,
- OMX_S16 * pPreACPredict,
- OMX_S16 * pPredBufRow,
- OMX_S16 * pPredBufCol,
- OMX_INT curQP,
- OMX_INT predQP,
- OMX_INT predDir,
- OMX_INT ACPredFlag,
- OMXVCM4P2VideoComponent videoComp,
- OMX_U8 flag,
- OMX_INT *pSumErr
-)
-{
- OMX_INT dcScaler, i;
- OMX_S16 tempPred;
-
- /* Argument error checks */
- armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pPredBufRow == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pPredBufCol == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(curQP <= 0, OMX_Sts_BadArgErr);
- armRetArgErrIf(predQP <= 0, OMX_Sts_BadArgErr);
- armRetArgErrIf((predDir != 1) && (predDir != 2), OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs4ByteAligned(pSrcDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs4ByteAligned(pPredBufRow), OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs4ByteAligned(pPredBufCol), OMX_Sts_BadArgErr);
-
-
- /* Set DC scaler value to avoid some compilers giving a warning. */
- dcScaler=0;
-
- /* Calculate the DC scaler value */
- if (videoComp == OMX_VC_LUMINANCE)
- {
- if (curQP >= 1 && curQP <= 4)
- {
- dcScaler = 8;
- }
- else if (curQP >= 5 && curQP <= 8)
- {
- dcScaler = 2 * curQP;
- }
- else if (curQP >= 9 && curQP <= 24)
- {
- dcScaler = curQP + 8;
- }
- else
- {
- dcScaler = (2 * curQP) - 16;
- }
- }
- else if (videoComp == OMX_VC_CHROMINANCE)
- {
- if (curQP >= 1 && curQP <= 4)
- {
- dcScaler = 8;
- }
- else if (curQP >= 5 && curQP <= 24)
- {
- dcScaler = (curQP + 13)/2;
- }
- else
- {
- dcScaler = curQP - 6;
- }
- }
-
- if (pPreACPredict != NULL)
- {
- pPreACPredict[0] = predDir;
- }
-
- if (predDir == OMX_VC_VERTICAL)
- {
- /* F[0][0]//dc_scaler */
- tempPred = armIntDivAwayFromZero(pPredBufRow[0], dcScaler);
- }
- else
- {
- /* F[0][0]//dc_scaler */
- tempPred = armIntDivAwayFromZero(pPredBufCol[0], dcScaler);
- }
-
- /* Updating the DC value to the row and col buffer */
- *(pPredBufRow - 8) = *pPredBufCol;
-
- if (flag)
- {
- /* Cal and store F[0][0] into the col buffer */
- *pPredBufCol = pSrcDst[0] * dcScaler;
-
- /* PQF = QF - F[0][0]//dc_scaler */
- pSrcDst[0] -= tempPred;
- }
- else
- {
- /* QF = PQF + F[0][0]//dc_scaler */
- pSrcDst[0] += tempPred;
-
- /* Saturate */
- pSrcDst[0] = armClip (-2048, 2047, pSrcDst[0]);
-
- /* Cal and store F[0][0] into the col buffer */
- *pPredBufCol = pSrcDst[0] * dcScaler;
- }
-
-
- if (ACPredFlag == 1)
- {
- if (predDir == OMX_VC_VERTICAL)
- {
- for (i = 1; i < 8; i++)
- {
- tempPred = armIntDivAwayFromZero \
- (pPredBufRow[i] * predQP, curQP);
- if (flag)
- {
- /* Updating QF to the row buff */
- pPredBufRow[i] = pSrcDst[i];
- /*PQFX[v][0] = QFX[v][0] - (QFA[v][0] * QPA) // QPX */
- pSrcDst[i] -= tempPred;
- /* Sum of absolute values of AC prediction error, this can
- be used as a reference to choose whether to use
- AC prediction */
- *pSumErr += armAbs(pSrcDst[i]);
- /* pPreACPredict[1~7] store the error signal
- after AC prediction */
- pPreACPredict[i] = pSrcDst[i];
- }
- else
- {
- /*QFX[v][0] = PQFX[v][0] + (QFA[v][0] * QPA) // QPX */
- pSrcDst[i] += tempPred;
-
- /* Saturate */
- pSrcDst[i] = armClip (-2048, 2047, pSrcDst[i]);
-
- /* Updating QF to the row buff */
- pPredBufRow[i] = pSrcDst[i];
- }
- }
- }
- else
- {
- for (i = 8; i < 64; i += 8)
- {
- tempPred = armIntDivAwayFromZero \
- (pPredBufCol[i>>3] * predQP, curQP);
- if (flag)
- {
- /* Updating QF to col buff */
- pPredBufCol[i>>3] = pSrcDst[i];
- /*PQFX[0][u] = QFX[0][u] - (QFA[0][u] * QPA) // QPX */
- pSrcDst[i] -= tempPred;
- /* Sum of absolute values of AC prediction error, this can
- be used as a reference to choose whether to use AC
- prediction */
- *pSumErr += armAbs(pSrcDst[i]);
- /* pPreACPredict[1~7] store the error signal
- after AC prediction */
- pPreACPredict[i>>3] = pSrcDst[i];
- }
- else
- {
- /*QFX[0][u] = PQFX[0][u] + (QFA[0][u] * QPA) // QPX */
- pSrcDst[i] += tempPred;
-
- /* Saturate */
- pSrcDst[i] = armClip (-2048, 2047, pSrcDst[i]);
-
- /* Updating QF to col buff */
- pPredBufCol[i>>3] = pSrcDst[i];
- }
- }
- }
- }
-
- return OMX_Sts_NoErr;
-}
-
-/*End of File*/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_BlockMatch_Half.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_BlockMatch_Half.c
deleted file mode 100644
index 4ffda10..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_BlockMatch_Half.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_BlockMatch_Half.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for Block matching, a full search algorithm
- * is implemented
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: armVCM4P2_BlockMatch_Half
- *
- * Description:
- * Performs a 16x16 block match with half-pixel resolution. Returns the estimated
- * motion vector and associated minimum SAD. This function estimates the half-pixel
- * motion vector by interpolating the integer resolution motion vector referenced
- * by the input parameter pSrcDstMV, i.e., the initial integer MV is generated
- * externally. The input parameters pSrcRefBuf and pSearchPointRefPos should be
- * shifted by the winning MV of 16x16 integer search prior to calling BlockMatch_Half_16x16.
- * The function BlockMatch_Integer_16x16 may be used for integer motion estimation.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcRefBuf pointer to the reference Y plane; points to the reference MB
- * that corresponds to the location of the current macroblock in
- * the current plane.
- * [in] refWidth width of the reference plane
- * [in] pRefRect reference plane valid region rectangle
- * [in] pSrcCurrBuf pointer to the current macroblock extracted from original plane
- * (linear array, 256 entries); must be aligned on an 8-byte boundary.
- * [in] pSearchPointRefPos position of the starting point for half pixel search (specified
- * in terms of integer pixel units) in the reference plane.
- * [in] rndVal rounding control bit for half pixel motion estimation;
- * 0=rounding control disabled; 1=rounding control enabled
- * [in] pSrcDstMV pointer to the initial MV estimate; typically generated during a prior
- * 16X16 integer search and its unit is half pixel.
- * [in] BlockSize MacroBlock Size i.e either 16x16 or 8x8.
- * [out]pSrcDstMV pointer to estimated MV
- * [out]pDstSAD pointer to minimum SAD
- *
- * Return Value:
- * OMX_Sts_NoErr ¨C no error
- * OMX_Sts_BadArgErr ¨C bad arguments
- *
- */
-
-OMXResult armVCM4P2_BlockMatch_Half(
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pSearchPointRefPos,
- OMX_INT rndVal,
- OMXVCMotionVector *pSrcDstMV,
- OMX_INT *pDstSAD,
- OMX_U8 BlockSize
-)
-{
- OMX_INT outer, inner, count, index;
- OMX_S16 halfPelX = 0, halfPelY = 0, x, y;
- OMX_INT candSAD, refSAD = 0;
- OMX_INT minSAD, fromX, toX, fromY, toY;
- /* Offset to the reference at the begining of the bounding box */
- const OMX_U8 *pTempSrcRefBuf;
- OMX_U8 tempPel;
-
- /* Argument error checks */
- armRetArgErrIf(pSrcRefBuf == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pRefRect == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcCurrBuf == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSearchPointRefPos == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcDstMV == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDstSAD == NULL, OMX_Sts_BadArgErr);
-
- /* Positioning the pointer */
- pTempSrcRefBuf = pSrcRefBuf + (refWidth * (pSrcDstMV->dy/2)) + (pSrcDstMV->dx/2);
-
- /* Copy the candidate to the temporary linear array */
- for (outer = 0, count = 0,index = 0;
- outer < BlockSize;
- outer++, index += refWidth - BlockSize)
- {
- for (inner = 0; inner < BlockSize; inner++, count++, index++)
- {
- refSAD += armAbs (pTempSrcRefBuf[index] - pSrcCurrBuf[count]);
- }
- }
-
- /* Set the minSad as reference SAD */
- minSAD = refSAD;
- *pDstSAD = refSAD;
-
- /* Check for valid region */
- fromX = 1;
- toX = 1;
- fromY = 1;
- toY = 1;
- if ((pSearchPointRefPos->x - 1) < pRefRect->x)
- {
- fromX = 0;
- }
-
- if ((pSearchPointRefPos->x + BlockSize + 1) > (pRefRect->x + pRefRect->width))
- {
- toX = 0;
- }
-
- if ((pSearchPointRefPos->y - 1) < pRefRect->y)
- {
- fromY = 0;
- }
-
- if ((pSearchPointRefPos->y + BlockSize + 1) > (pRefRect->y + pRefRect->height))
- {
- toY = 0;
- }
-
- /* Looping on y- axis */
- for (y = -fromY; y <= toY; y++)
- {
- /* Looping on x- axis */
- for (x = -fromX; x <= toX; x++)
- {
- /* check for integer position */
- if ( x == 0 && y == 0)
- {
- continue;
- }
- /* Positioning the pointer */
- pTempSrcRefBuf = pSrcRefBuf + (refWidth * (pSrcDstMV->dy/2))
- + (pSrcDstMV->dx/2);
-
- /* Interpolate the pixel and calculate the SAD*/
- for (outer = 0, count = 0, candSAD = 0,index = 0;
- outer < BlockSize;
- outer++, index += refWidth - BlockSize)
- {
- for (inner = 0; inner < BlockSize; inner++, count++,index++)
- {
- tempPel = (
- pTempSrcRefBuf[index]
- + pTempSrcRefBuf[index + x] * armAbs(x)
- + pTempSrcRefBuf[index + refWidth * y] * armAbs(y)
- + pTempSrcRefBuf[index + refWidth * y + x]
- * armAbs(x*y)
- + armAbs (x) + armAbs (y) - rndVal
- ) / (2 * (armAbs (x) + armAbs (y)));
- candSAD += armAbs (tempPel - pSrcCurrBuf[count]);
- }
- }
-
- /* Result calculations */
- if (armVCM4P2_CompareMV (x, y, candSAD, halfPelX, halfPelY, minSAD))
- {
- *pDstSAD = candSAD;
- minSAD = candSAD;
- halfPelX = x;
- halfPelY = y;
- }
-
- } /* End of x- axis */
- } /* End of y-axis */
-
- pSrcDstMV->dx += halfPelX;
- pSrcDstMV->dy += halfPelY;
-
- return OMX_Sts_NoErr;
-
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_BlockMatch_Integer.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_BlockMatch_Integer.c
deleted file mode 100644
index 2b05660..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_BlockMatch_Integer.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_BlockMatch_Integer.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for Block matching, a full search algorithm
- * is implemented
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: armVCM4P2_BlockMatch_Integer
- *
- * Description:
- * Performs a 16x16 block search; estimates motion vector and associated minimum SAD.
- * Both the input and output motion vectors are represented using half-pixel units, and
- * therefore a shift left or right by 1 bit may be required, respectively, to match the
- * input or output MVs with other functions that either generate output MVs or expect
- * input MVs represented using integer pixel units.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcRefBuf pointer to the reference Y plane; points to the reference MB that
- * corresponds to the location of the current macroblock in the current
- * plane.
- * [in] refWidth width of the reference plane
- * [in] pRefRect pointer to the valid rectangular in reference plane. Relative to image origin.
- * It's not limited to the image boundary, but depended on the padding. For example,
- * if you pad 4 pixels outside the image border, then the value for left border
- * can be -4
- * [in] pSrcCurrBuf pointer to the current macroblock extracted from original plane (linear array,
- * 256 entries); must be aligned on an 8-byte boundary.
- * [in] pCurrPointPos position of the current macroblock in the current plane
- * [in] pSrcPreMV pointer to predicted motion vector; NULL indicates no predicted MV
- * [in] pSrcPreSAD pointer to SAD associated with the predicted MV (referenced by pSrcPreMV)
- * [in] searchRange search range for 16X16 integer block,the units of it is full pixel,the search range
- * is the same in all directions.It is in inclusive of the boundary and specified in
- * terms of integer pixel units.
- * [in] pMESpec vendor-specific motion estimation specification structure; must have been allocated
- * and then initialized using omxVCM4P2_MEInit prior to calling the block matching
- * function.
- * [out] pDstMV pointer to estimated MV
- * [out] pDstSAD pointer to minimum SAD
- *
- * Return Value:
- * OMX_Sts_NoErr ¨C no error.
- * OMX_Sts_BadArgErr ¨C bad arguments
- *
- */
-
-OMXResult armVCM4P2_BlockMatch_Integer(
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- const OMXVCMotionVector *pSrcPreMV,
- const OMX_INT *pSrcPreSAD,
- void *pMESpec,
- OMXVCMotionVector *pDstMV,
- OMX_INT *pDstSAD,
- OMX_U8 BlockSize
-)
-{
-
- /* Definitions and Initializations*/
-
- OMX_INT outer, inner, count,index;
- OMX_INT candSAD;
- /*(256*256 +1) this is to make the SAD max initially*/
- OMX_INT minSAD = 0x10001, fromX, toX, fromY, toY;
- /* Offset to the reference at the begining of the bounding box */
- const OMX_U8 *pTempSrcRefBuf;
- OMX_S16 x, y;
- OMX_INT searchRange;
-
- /* Argument error checks */
- armRetArgErrIf(pSrcRefBuf == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pRefRect == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcCurrBuf == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pCurrPointPos == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pMESpec == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDstMV == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDstSAD == NULL, OMX_Sts_BadArgErr);
-
- searchRange = ((OMXVCM4P2MEParams *)pMESpec)->searchRange;
- /* Check for valid region */
- fromX = searchRange;
- toX = searchRange;
- fromY = searchRange;
- toY = searchRange;
-
- if ((pCurrPointPos->x - searchRange) < pRefRect->x)
- {
- fromX = pCurrPointPos->x - pRefRect->x;
- }
-
- if ((pCurrPointPos->x + BlockSize + searchRange) > (pRefRect->x + pRefRect->width))
- {
- toX = pRefRect->width - (pCurrPointPos->x - pRefRect->x) - BlockSize;
- }
-
- if ((pCurrPointPos->y - searchRange) < pRefRect->y)
- {
- fromY = pCurrPointPos->y - pRefRect->y;
- }
-
- if ((pCurrPointPos->y + BlockSize + searchRange) > (pRefRect->y + pRefRect->height))
- {
- toY = pRefRect->width - (pCurrPointPos->y - pRefRect->y) - BlockSize;
- }
-
- pDstMV->dx = -fromX;
- pDstMV->dy = -fromY;
- /* Looping on y- axis */
- for (y = -fromY; y <= toY; y++)
- {
-
- /* Looping on x- axis */
- for (x = -fromX; x <= toX; x++)
- {
- /* Positioning the pointer */
- pTempSrcRefBuf = pSrcRefBuf + (refWidth * y) + x;
-
- /* Calculate the SAD */
- for (outer = 0, count = 0, index = 0, candSAD = 0;
- outer < BlockSize;
- outer++, index += refWidth - BlockSize)
- {
- for (inner = 0; inner < BlockSize; inner++, count++, index++)
- {
- candSAD += armAbs (pTempSrcRefBuf[index] - pSrcCurrBuf[count]);
- }
- }
-
- /* Result calculations */
- if (armVCM4P2_CompareMV (x, y, candSAD, pDstMV->dx/2, pDstMV->dy/2, minSAD))
- {
- *pDstSAD = candSAD;
- minSAD = candSAD;
- pDstMV->dx = x*2;
- pDstMV->dy = y*2;
- }
-
- } /* End of x- axis */
- } /* End of y-axis */
-
- return OMX_Sts_NoErr;
-
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_CheckVLCEscapeMode.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_CheckVLCEscapeMode.c
deleted file mode 100644
index 5e510e7..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_CheckVLCEscapeMode.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_CheckVLCEscapeMode.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains module for VLC escape mode check
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: armVCM4P2_CheckVLCEscapeMode
- *
- * Description:
- * Performs escape mode decision based on the run, run+, level, level+ and
- * last combinations.
- *
- * Remarks:
- *
- * Parameters:
- * [in] run Run value (count of zeros) to be encoded
- * [in] level Level value (non-zero value) to be encoded
- * [in] runPlus Calculated as runPlus = run - (RMAX + 1)
- * [in] levelPlus Calculated as
- * levelPlus = sign(level)*[abs(level) - LMAX]
- * [in] maxStoreRun Max store possible (considering last and inter/intra)
- * [in] maxRunForMultipleEntries
- * The run value after which level
- * will be equal to 1:
- * (considering last and inter/intra status)
- * [in] pRunIndexTable Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.c
- * (considering last and inter/intra status)
- *
- *
- * Return Value:
- * Returns an Escape mode which can take values from 0 to 3
- * 0 --> no escape mode, 1 --> escape type 1,
- * 1 --> escape type 2, 3 --> escape type 3, check section 7.4.1.3
- * in the MPEG ISO standard.
- *
- */
-
-OMX_U8 armVCM4P2_CheckVLCEscapeMode(
- OMX_U32 run,
- OMX_U32 runPlus,
- OMX_S16 level,
- OMX_S16 levelPlus,
- OMX_U8 maxStoreRun,
- OMX_U8 maxRunForMultipleEntries,
- OMX_INT shortVideoHeader,
- const OMX_U8 *pRunIndexTable
-)
-{
- OMX_U8 escape = 0, fMode = 0, entries;
-
- level = armAbs (level);
- levelPlus = armAbs (levelPlus);
-
- /* Check for a valid entry with run, level and Last combination
- Mode 0 check */
- if (run <= maxStoreRun)
- {
- entries = pRunIndexTable[run + 1]
- - pRunIndexTable[run];
- if (run > maxRunForMultipleEntries)
- {
- entries = 1;
- }
- if (level > entries)
- {
- escape = 1;
- }
- }
- else
- {
- escape = 1;
- }
- if(escape && shortVideoHeader)
- {
- escape = 0;
- fMode = 4;
- }
- /* Check for a valid entry with run, levelPlus and Last combination
- Mode 1 check */
- if (escape)
- {
- escape = 0;
- fMode = 1;
- if (run <= maxStoreRun)
- {
- entries = pRunIndexTable[run + 1]
- - pRunIndexTable[run];
- if (run > maxRunForMultipleEntries)
- {
- entries = 1;
- }
- if (levelPlus > entries)
- {
- escape = 1;
- }
- }
- else
- {
- escape = 1;
- }
- }
-
- /* Check for a valid entry with runPlus, level and Last combination
- Mode 2 check */
- if (escape)
- {
- escape = 0;
- fMode = 2;
- if (runPlus <= maxStoreRun)
- {
- entries = pRunIndexTable[runPlus + 1]
- - pRunIndexTable[runPlus];
- if (runPlus > maxRunForMultipleEntries)
- {
- entries = 1;
- }
- if (level > entries)
- {
- escape = 1;
- }
- }
- else
- {
- escape = 1;
- }
- }
-
- /* select mode 3 --> FLC */
- if (escape)
- {
- fMode = 3;
- }
-
- return fMode;
-}
-
-/*End of File*/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_CompareMV.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_CompareMV.c
deleted file mode 100644
index 3b621a3..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_CompareMV.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_CompareMV.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains module for comparing motion vectors and SAD's to decide
- * the best MV and SAD
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: armVCM4P2_CompareMV
- *
- * Description:
- * Performs comparision of motion vectors and SAD's to decide the
- * best MV and SAD
- *
- * Remarks:
- *
- * Parameters:
- * [in] mvX x coordinate of the candidate motion vector
- * [in] mvY y coordinate of the candidate motion vector
- * [in] candSAD Candidate SAD
- * [in] bestMVX x coordinate of the best motion vector
- * [in] bestMVY y coordinate of the best motion vector
- * [in] bestSAD best SAD
- *
- * Return Value:
- * OMX_INT -- 1 to indicate that the current sad is the best
- * 0 to indicate that it is NOT the best SAD
- */
-
-OMX_INT armVCM4P2_CompareMV (
- OMX_S16 mvX,
- OMX_S16 mvY,
- OMX_INT candSAD,
- OMX_S16 bestMVX,
- OMX_S16 bestMVY,
- OMX_INT bestSAD
-)
-{
- if (candSAD < bestSAD)
- {
- return 1;
- }
- if (candSAD > bestSAD)
- {
- return 0;
- }
- /* shorter motion vector */
- if ( (mvX * mvX + mvY * mvY) < (bestMVX*bestMVX+bestMVY*bestMVY) )
- {
- return 1;
- }
- return 0;
-}
-
-/*End of File*/
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_DCT_Table.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_DCT_Table.c
deleted file mode 100644
index 7d055d9..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_DCT_Table.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
- /**
- *
- * File Name: armVCM4P2_DCT_Table.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * File: armVCM4P2_DCT_Table.c
- * Description: Contains the DCT/IDCT coefficent matrix
- *
- */
-
-#ifndef _OMXDCTCOSTAB_C_
-#define _OMXDCTCOSTAB_C_
-
-#include "omxtypes.h"
-#include "armOMX.h"
-
-const OMX_F64 armVCM4P2_preCalcDCTCos[8][8] =
-{
- {
- 0.353553390593273730,
- 0.490392640201615220,
- 0.461939766255643370,
- 0.415734806151272620,
- 0.353553390593273790,
- 0.277785116509801140,
- 0.191341716182544920,
- 0.097545161008064152
- },
- {
- 0.353553390593273730,
- 0.415734806151272620,
- 0.191341716182544920,
- -0.097545161008064096,
- -0.353553390593273730,
- -0.490392640201615220,
- -0.461939766255643420,
- -0.277785116509801090
- },
- {
- 0.353553390593273730,
- 0.277785116509801140,
- -0.191341716182544860,
- -0.490392640201615220,
- -0.353553390593273840,
- 0.097545161008064138,
- 0.461939766255643260,
- 0.415734806151272730
- },
- {
- 0.353553390593273730,
- 0.097545161008064152,
- -0.461939766255643370,
- -0.277785116509801090,
- 0.353553390593273680,
- 0.415734806151272730,
- -0.191341716182544920,
- -0.490392640201615330
- },
- {
- 0.353553390593273730,
- -0.097545161008064096,
- -0.461939766255643420,
- 0.277785116509800920,
- 0.353553390593273840,
- -0.415734806151272620,
- -0.191341716182545280,
- 0.490392640201615220
- },
- {
- 0.353553390593273730,
- -0.277785116509800980,
- -0.191341716182545170,
- 0.490392640201615220,
- -0.353553390593273340,
- -0.097545161008064013,
- 0.461939766255643370,
- -0.415734806151272510
- },
- {
- 0.353553390593273730,
- -0.415734806151272670,
- 0.191341716182545000,
- 0.097545161008064388,
- -0.353553390593273620,
- 0.490392640201615330,
- -0.461939766255643200,
- 0.277785116509800760
- },
- {
- 0.353553390593273730,
- -0.490392640201615220,
- 0.461939766255643260,
- -0.415734806151272620,
- 0.353553390593273290,
- -0.277785116509800760,
- 0.191341716182544780,
- -0.097545161008064277
- }
-};
-
-#endif /*_OMXDCTCOSTAB_C_*/
-
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_DecodeVLCZigzag_intra.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_DecodeVLCZigzag_intra.c
deleted file mode 100644
index a5aa198..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_DecodeVLCZigzag_intra.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_DecodeVLCZigzag_intra.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for filling of the coefficient buffer
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM_Bitstream.h"
-#include "armCOMM.h"
-#include "armVCM4P2_Huff_Tables_VLC.h"
-#include "armVCM4P2_ZigZag_Tables.h"
-
-
-
-/**
- * Function: armVCM4P2_DecodeVLCZigzag_Intra
- *
- * Description:
- * Performs VLC decoding and inverse zigzag scan for one intra coded block.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bitstream buffer
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * to by *ppBitStream. *pBitOffset is valid within
- * [0-7].
- * [in] predDir AC prediction direction which is used to decide
- * the zigzag scan pattern. It takes one of the
- * following values:
- * OMX_VC_NONE AC prediction not used;
- * perform classical zigzag scan;
- * OMX_VC_HORIZONTAL Horizontal prediction;
- * perform alternate-vertical
- * zigzag scan;
- * OMX_VC_VERTICAL Vertical prediction;
- * thus perform
- * alternate-horizontal
- * zigzag scan.
- * [in] start start indicates whether the encoding begins with 0th element
- * or 1st.
- * [out] ppBitStream *ppBitStream is updated after the block is
- * decoded, so that it points to the current byte
- * in the bit stream buffer
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream
- * [out] pDst pointer to the coefficient buffer of current
- * block. Should be 32-bit aligned
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_DecodeVLCZigzag_Intra(
- const OMX_U8 ** ppBitStream,
- OMX_INT * pBitOffset,
- OMX_S16 * pDst,
- OMX_U8 predDir,
- OMX_INT shortVideoHeader,
- OMX_U8 start
-)
-{
- OMX_U8 last = 0;
- const OMX_U8 *pZigzagTable = armVCM4P2_aClassicalZigzagScan;
- OMXResult errorCode;
-
- /* Argument error checks */
- armRetArgErrIf(ppBitStream == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(*ppBitStream == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBitOffset == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs4ByteAligned(pDst), OMX_Sts_BadArgErr);
- armRetArgErrIf((*pBitOffset < 0) || (*pBitOffset >7), OMX_Sts_BadArgErr);
- armRetArgErrIf((predDir > 2), OMX_Sts_BadArgErr);
-
- switch (predDir)
- {
- case OMX_VC_NONE:
- {
- pZigzagTable = armVCM4P2_aClassicalZigzagScan;
- break;
- }
-
- case OMX_VC_HORIZONTAL:
- {
- pZigzagTable = armVCM4P2_aVerticalZigzagScan;
- break;
- }
-
- case OMX_VC_VERTICAL:
- {
- pZigzagTable = armVCM4P2_aHorizontalZigzagScan;
- break;
- }
- }
-
- errorCode = armVCM4P2_GetVLCBits (
- ppBitStream,
- pBitOffset,
- pDst,
- shortVideoHeader,
- start,
- &last,
- 10,
- 62,
- 7,
- 21,
- armVCM4P2_IntraL0RunIdx,
- armVCM4P2_IntraVlcL0,
- armVCM4P2_IntraL1RunIdx,
- armVCM4P2_IntraVlcL1,
- armVCM4P2_IntraL0LMAX,
- armVCM4P2_IntraL1LMAX,
- armVCM4P2_IntraL0RMAX,
- armVCM4P2_IntraL1RMAX,
- pZigzagTable );
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- if (last == 0)
- {
- return OMX_Sts_Err;
- }
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_EncodeVLCZigzag_intra.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_EncodeVLCZigzag_intra.c
deleted file mode 100644
index b61c547..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_EncodeVLCZigzag_intra.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_EncodeVLCZigzag_intra.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for zigzag scanning and VLC encoding
- * for intra block.
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM_Bitstream.h"
-#include "armCOMM.h"
-#include "armVCM4P2_Huff_Tables_VLC.h"
-#include "armVCM4P2_ZigZag_Tables.h"
-
-
-
-/**
- * Function: armVCM4P2_EncodeVLCZigzag_Intra
- *
- * Description:
- * Performs zigzag scanning and VLC encoding for one intra block.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bit stream
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * by *ppBitStream. Valid within 0 to 7.
- * [in] pQDctBlkCoef pointer to the quantized DCT coefficient
- * [in] predDir AC prediction direction, which is used to decide
- * the zigzag scan pattern. This takes one of the
- * following values:
- * OMX_VC_NONE AC prediction not used.
- * Performs classical zigzag
- * scan.
- * OMX_VC_HORIZONTAL Horizontal prediction.
- * Performs alternate-vertical
- * zigzag scan.
- * OMX_VC_VERTICAL Vertical prediction.
- * Performs alternate-horizontal
- * zigzag scan.
- * [in] pattern block pattern which is used to decide whether
- * this block is encoded
- * [in] start start indicates whether the encoding begins with 0th element
- * or 1st.
- * [out] ppBitStream *ppBitStream is updated after the block is encoded,
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_EncodeVLCZigzag_Intra(
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- const OMX_S16 *pQDctBlkCoef,
- OMX_U8 predDir,
- OMX_U8 pattern,
- OMX_INT shortVideoHeader,
- OMX_U8 start
-)
-{
- const OMX_U8 *pZigzagTable = armVCM4P2_aClassicalZigzagScan;
- OMXResult errorCode;
-
- /* Argument error checks */
- armRetArgErrIf(ppBitStream == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(*ppBitStream == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBitOffset == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pQDctBlkCoef == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf((*pBitOffset < 0) || (*pBitOffset >7), OMX_Sts_BadArgErr);
- armRetArgErrIf(start > 1, OMX_Sts_BadArgErr);
- armRetArgErrIf(predDir > 2, OMX_Sts_BadArgErr);
-
- if (pattern)
- {
- switch (predDir)
- {
- case OMX_VC_NONE:
- {
- pZigzagTable = armVCM4P2_aClassicalZigzagScan;
- break;
- }
-
- case OMX_VC_HORIZONTAL:
- {
- pZigzagTable = armVCM4P2_aVerticalZigzagScan;
- break;
- }
-
- case OMX_VC_VERTICAL:
- {
- pZigzagTable = armVCM4P2_aHorizontalZigzagScan;
- break;
- }
- }
-
- errorCode = armVCM4P2_PutVLCBits (
- ppBitStream,
- pBitOffset,
- pQDctBlkCoef,
- shortVideoHeader,
- start,
- 14,
- 20,
- 9,
- 6,
- armVCM4P2_IntraL0RunIdx,
- armVCM4P2_IntraVlcL0,
- armVCM4P2_IntraL1RunIdx,
- armVCM4P2_IntraVlcL1,
- armVCM4P2_IntraL0LMAX,
- armVCM4P2_IntraL1LMAX,
- armVCM4P2_IntraL0RMAX,
- armVCM4P2_IntraL1RMAX,
- pZigzagTable
- );
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- } /* Pattern check ends*/
-
- return (OMX_Sts_NoErr);
-
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_FillVLCBuffer.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_FillVLCBuffer.c
deleted file mode 100644
index aeb7714..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_FillVLCBuffer.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_FillVLCBuffer.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains module for putting VLC bits
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-#include "armCOMM_Bitstream.h"
-
-/**
- * Function: armVCM4P2_FillVLCBuffer
- *
- * Description:
- * Performs calculating the VLC bits depending on the escape type and insert
- * the same in the bitstream
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bit stream
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * by *ppBitStream. Valid within 0 to 7
- * [in] run Run value (count of zeros) to be encoded
- * [in] level Level value (non-zero value) to be encoded
- * [in] runPlus Calculated as runPlus = run - (RMAX + 1)
- * [in] levelPlus Calculated as
- * levelPlus = sign(level)*[abs(level) - LMAX]
- * [in] fMode Flag indicating the escape modes
- * [in] last status of the last flag
- * [in] maxRunForMultipleEntries
- * The run value after which level will be equal to 1:
- * (considering last and inter/intra status)
- * [in] pRunIndexTable Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.h
- * [in] pVlcTable VLC table defined in armVCM4P2_Huff_Tables_VLC.h
- * [out] ppBitStream *ppBitStream is updated after the block is encoded
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_FillVLCBuffer (
- OMX_U8 **ppBitStream,
- OMX_INT * pBitOffset,
- OMX_U32 run,
- OMX_S16 level,
- OMX_U32 runPlus,
- OMX_S16 levelPlus,
- OMX_U8 fMode,
- OMX_U8 last,
- OMX_U8 maxRunForMultipleEntries,
- const OMX_U8 *pRunIndexTable,
- const ARM_VLC32 *pVlcTable
-)
-{
- OMX_INT tempIndex;
- OMX_U32 tempRun = run, sign = 0;
- OMX_S16 tempLevel = level;
-
- /* Escape sequence addition */
- if (fMode == 1)
- {
- armPackBits(ppBitStream, pBitOffset, 3, 7);
- armPackBits(ppBitStream, pBitOffset, 0, 1);
- tempLevel = levelPlus;
-
- }
- else if(fMode == 2)
- {
- armPackBits(ppBitStream, pBitOffset, 3, 7);
- armPackBits(ppBitStream, pBitOffset, 2, 2);
- tempRun = runPlus;
- }
- else if (fMode == 3)
- {
- armPackBits(ppBitStream, pBitOffset, 3, 7);
- armPackBits(ppBitStream, pBitOffset, 3, 2);
- }
- else if (fMode == 4)
- {
- armPackBits(ppBitStream, pBitOffset, 3, 7);
- armPackBits(ppBitStream, pBitOffset, (OMX_U32)last, 1);
- armPackBits(ppBitStream, pBitOffset, tempRun, 6);
- if((tempLevel != 0) && (tempLevel != -128))
- {
- armPackBits(ppBitStream, pBitOffset,
- (OMX_U32) tempLevel, 8);
- }
- return OMX_Sts_NoErr;
- }
-
- if (tempLevel < 0)
- {
- sign = 1;
- tempLevel = armAbs(tempLevel);
- }
- /* Putting VLC bits in the stream */
- if (fMode < 3)
- {
- if (tempRun > maxRunForMultipleEntries)
- {
- tempIndex = pRunIndexTable [maxRunForMultipleEntries + 1] +
- (tempRun - maxRunForMultipleEntries - 1);
- }
- else
- {
- tempIndex = pRunIndexTable [tempRun] + (tempLevel -1);
- }
-
- armPackVLC32 (ppBitStream, pBitOffset,
- pVlcTable [tempIndex]);
- armPackBits(ppBitStream, pBitOffset, (OMX_U32)sign, 1);
- }
- else
- {
- if (sign)
- {
- tempLevel = -tempLevel;
- }
- tempRun = run;
- armPackBits(ppBitStream, pBitOffset, (OMX_U32)last, 1);
- armPackBits(ppBitStream, pBitOffset, tempRun, 6);
- armPackBits(ppBitStream, pBitOffset, 1, 1);
- armPackBits(ppBitStream, pBitOffset,
- (OMX_U32) tempLevel, 12);
- armPackBits(ppBitStream, pBitOffset, 1, 1);
- }
- return OMX_Sts_NoErr;
-}
-
-/*End of File*/
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_FillVLDBuffer.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_FillVLDBuffer.c
deleted file mode 100644
index f09f5d5..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_FillVLDBuffer.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_FillVLDBuffer.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains module for VLC get bits from the stream
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-
-#include "armVCM4P2_ZigZag_Tables.h"
-
-
-/**
- * Function: armVCM4P2_FillVLDBuffer
- *
- * Description:
- * Performs filling of the coefficient buffer according to the run, level
- * and sign, also updates the index
- *
- * Parameters:
- * [in] storeRun Stored Run value (count of zeros)
- * [in] storeLevel Stored Level value (non-zero value)
- * [in] sign Flag indicating the sign of level
- * [in] last status of the last flag
- * [in] pIndex pointer to coefficient index in 8x8 matrix
- * [out] pIndex pointer to updated coefficient index in 8x8
- * matrix
- * [in] pZigzagTable pointer to the zigzag tables
- * [out] pDst pointer to the coefficient buffer of current
- * block. Should be 32-bit aligned
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_FillVLDBuffer(
- OMX_U32 storeRun,
- OMX_S16 * pDst,
- OMX_S16 storeLevel,
- OMX_U8 sign,
- OMX_U8 last,
- OMX_U8 * pIndex,
- const OMX_U8 * pZigzagTable
-)
-{
- /* Store the zero's as per the run length count */
- for (;storeRun > 0; storeRun--, (*pIndex)++)
- {
- pDst[pZigzagTable[*pIndex]] = 0;
- }
- /* Store the level depending on the sign*/
- if (sign == 1)
- {
- pDst[pZigzagTable[*pIndex]] = -storeLevel;
- }
- else
- {
- pDst[pZigzagTable[*pIndex]] = storeLevel;
- }
- (*pIndex)++;
-
- /* If last is 1, fill the remaining elments of the buffer with zeros */
- if (last == 1)
- {
- while (*pIndex < 64)
- {
- pDst[pZigzagTable[*pIndex]] = 0;
- (*pIndex)++;
- }
- }
-
- return OMX_Sts_NoErr;
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_GetVLCBits.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_GetVLCBits.c
deleted file mode 100644
index 8eb1411..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_GetVLCBits.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_GetVLCBits.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains module for VLC get bits from the stream
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-#include "armCOMM_Bitstream.h"
-#include "armVCM4P2_ZigZag_Tables.h"
-#include "armVCM4P2_Huff_Tables_VLC.h"
-
-
-/**
- * Function: armVCM4P2_GetVLCBits
- *
- * Description:
- * Performs escape mode decision based on the run, run+, level, level+ and
- * last combinations.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bit stream
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * by *ppBitStream. Valid within 0 to 7
- * [in] start start indicates whether the encoding begins with
- * 0th element or 1st.
- * [in/out] pLast pointer to last status flag
- * [in] runBeginSingleLevelEntriesL0 The run value from which level
- * will be equal to 1: last == 0
- * [in] IndexBeginSingleLevelEntriesL0 Array index in the VLC table
- * pointing to the
- * runBeginSingleLevelEntriesL0
- * [in] runBeginSingleLevelEntriesL1 The run value from which level
- * will be equal to 1: last == 1
- * [in] IndexBeginSingleLevelEntriesL1 Array index in the VLC table
- * pointing to the
- * runBeginSingleLevelEntriesL0
- * [in] pRunIndexTableL0 Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pVlcTableL0 VLC table for last == 0
- * [in] pRunIndexTableL1 Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [in] pVlcTableL1 VLC table for last == 1
- * [in] pLMAXTableL0 Level MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pLMAXTableL1 Level MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [in] pRMAXTableL0 Run MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pRMAXTableL1 Run MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [out]pDst pointer to the coefficient buffer of current
- * block. Should be 32-bit aligned
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_GetVLCBits (
- const OMX_U8 **ppBitStream,
- OMX_INT * pBitOffset,
- OMX_S16 * pDst,
- OMX_INT shortVideoHeader,
- OMX_U8 start,
- OMX_U8 * pLast,
- OMX_U8 runBeginSingleLevelEntriesL0,
- OMX_U8 maxIndexForMultipleEntriesL0,
- OMX_U8 maxRunForMultipleEntriesL1,
- OMX_U8 maxIndexForMultipleEntriesL1,
- const OMX_U8 * pRunIndexTableL0,
- const ARM_VLC32 *pVlcTableL0,
- const OMX_U8 * pRunIndexTableL1,
- const ARM_VLC32 *pVlcTableL1,
- const OMX_U8 * pLMAXTableL0,
- const OMX_U8 * pLMAXTableL1,
- const OMX_U8 * pRMAXTableL0,
- const OMX_U8 * pRMAXTableL1,
- const OMX_U8 * pZigzagTable
-)
-{
- OMX_U32 storeRun;
- OMX_U8 tabIndex, markerBit;
- OMX_S16 storeLevel;
- OMX_U16 unpackRetIndex;
- OMX_U8 i, fType, escape;
- OMX_U8 sign = 0;
-
- /* Unpacking the bitstream and RLD */
- for (i = start; i < 64;)
- {
- escape = armLookAheadBits(ppBitStream, pBitOffset, 7);
- if (escape != 3)
- {
- fType = 0; /* Not in escape mode */
- }
- else
- {
- armSkipBits (ppBitStream, pBitOffset, 7);
- if(shortVideoHeader)
- {
- *pLast = armGetBits(ppBitStream, pBitOffset, 1);
- storeRun = armGetBits(ppBitStream, pBitOffset, 6);
- storeLevel = armGetBits(ppBitStream, pBitOffset, 8);
-
- /* Ref to Table B-18 (c) in MPEG4 Standard- FLC code for */
- /* LEVEL when short_video_header is 1, the storeLevel is */
- /* a signed value and the sign and the unsigned value for */
- /* storeLevel need to be extracted and passed to arm */
- /* FillVLDBuffer function */
-
- sign = (storeLevel & 0x80);
- if(sign==0x80)
- {
- storeLevel=(storeLevel^0xff)+1;
- sign=1;
-
- }
-
- armRetDataErrIf( storeLevel == 0 || sign*storeLevel == 128 , OMX_Sts_Err); /* Invalid FLC */
- armRetDataErrIf((i + storeRun) >= 64, OMX_Sts_Err);
- armVCM4P2_FillVLDBuffer(
- storeRun,
- pDst,
- storeLevel,
- sign,
- *pLast,
- &i,
- pZigzagTable);
- return OMX_Sts_NoErr;
-
- }
- if (armGetBits(ppBitStream, pBitOffset, 1))
- {
- if (armGetBits(ppBitStream, pBitOffset, 1))
- {
- fType = 3;
- }
- else
- {
- fType = 2;
- }
- }
- else
- {
- fType = 1;
- }
- }
-
- if (fType < 3)
- {
- unpackRetIndex = armUnPackVLC32(ppBitStream, pBitOffset,
- pVlcTableL0);
- if (unpackRetIndex != ARM_NO_CODEBOOK_INDEX)
- {
- /* Decode run and level from the index */
- /* last = 0 */
- *pLast = 0;
- if (unpackRetIndex > maxIndexForMultipleEntriesL0)
- {
- storeLevel = 1;
- storeRun = (unpackRetIndex - maxIndexForMultipleEntriesL0)
- + runBeginSingleLevelEntriesL0;
- }
- else
- {
- tabIndex = 1;
- while (pRunIndexTableL0[tabIndex] <= unpackRetIndex)
- {
- tabIndex++;
- }
- storeRun = tabIndex - 1;
- storeLevel = unpackRetIndex - pRunIndexTableL0[tabIndex - 1] + 1;
- }
- sign = (OMX_U8) armGetBits(ppBitStream, pBitOffset, 1);
-
- if (fType == 1)
- {
- storeLevel = (armAbs(storeLevel) + pLMAXTableL0[storeRun]);
- }
- else if (fType == 2)
- {
- storeRun = storeRun + pRMAXTableL0[storeLevel-1] + 1;
- }
- }
- else
- {
- unpackRetIndex = armUnPackVLC32(ppBitStream, pBitOffset,
- pVlcTableL1);
-
- armRetDataErrIf(unpackRetIndex == ARM_NO_CODEBOOK_INDEX, OMX_Sts_Err);
-
- /* Decode run and level from the index */
- /* last = 1 */
- *pLast = 1;
- if (unpackRetIndex > maxIndexForMultipleEntriesL1)
- {
- storeLevel = 1;
- storeRun = (unpackRetIndex - maxIndexForMultipleEntriesL1)
- + maxRunForMultipleEntriesL1;
- }
- else
- {
- tabIndex = 1;
- while (pRunIndexTableL1[tabIndex] <= unpackRetIndex)
- {
- tabIndex++;
- }
- storeRun = tabIndex - 1;
- storeLevel = unpackRetIndex - pRunIndexTableL1[tabIndex - 1] + 1;
- }
- sign = (OMX_U8) armGetBits(ppBitStream, pBitOffset, 1);
-
- if (fType == 1)
- {
- storeLevel = (armAbs(storeLevel) + pLMAXTableL1[storeRun]);
- }
- else if (fType == 2)
- {
- storeRun = storeRun + pRMAXTableL1[storeLevel-1] + 1;
- }
- }
- armRetDataErrIf((i + storeRun) >= 64, OMX_Sts_Err);
- armVCM4P2_FillVLDBuffer(
- storeRun,
- pDst,
- storeLevel,
- sign,
- *pLast,
- &i,
- pZigzagTable);
- }
- else
- {
- *pLast = armGetBits(ppBitStream, pBitOffset, 1);
- storeRun = armGetBits(ppBitStream, pBitOffset, 6);
- armRetDataErrIf((i + storeRun) >= 64, OMX_Sts_Err);
- markerBit = armGetBits(ppBitStream, pBitOffset, 1);
- armRetDataErrIf( markerBit == 0, OMX_Sts_Err);
- storeLevel = armGetBits(ppBitStream, pBitOffset, 12);
- if (storeLevel & 0x800)
- {
- storeLevel -= 4096;
- }
- armRetDataErrIf( storeLevel == 0 || storeLevel == -2048 , OMX_Sts_Err); /* Invalid FLC */
- armGetBits(ppBitStream, pBitOffset, 1);
- armVCM4P2_FillVLDBuffer(
- storeRun,
- pDst,
- storeLevel,
- 0, /* Sign is not used, preprocessing done */
- *pLast,
- &i,
- pZigzagTable);
-
- }
- } /* End of forloop for i */
- return OMX_Sts_NoErr;
-}
-
-/* End of File */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_Huff_Tables_VLC.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_Huff_Tables_VLC.c
deleted file mode 100644
index b101d48..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_Huff_Tables_VLC.c
+++ /dev/null
@@ -1,510 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
- /**
- *
- * File Name: armVCM4P2_Huff_Tables_VLC.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * File: armVCM4P2_Huff_Tables_VLC.c
- * Description: Contains all the Huffman tables used in MPEG4 codec
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-
-#include "armCOMM_Bitstream.h"
-
-/*
-* For Intra
-* last = 0
-*/
-const OMX_U8 armVCM4P2_IntraL0RunIdx[11] =
-{
- 0, 27, 37, 42, 46, 49, 52,
- 55, 58, 60, 62
-};
-
-/* Entry defined for all values
-* for run = 0 to 14
-* Note: the last entry is to terminate while decoding
-*/
-const ARM_VLC32 armVCM4P2_IntraVlcL0[68] =
-{
- {2, 2},
- {3, 6},
- {4, 15},
- {5, 13},
- {5, 12},
- {6, 21},
- {6, 19},
- {6, 18},
- {7, 23},
- {8, 31},
- {8, 30},
- {8, 29},
- {9, 37},
- {9, 36},
- {9, 35},
- {9, 33},
- {10, 33},
- {10, 32},
- {10, 15},
- {10, 14},
- {11, 7},
- {11, 6},
- {11, 32},
- {11, 33},
- {12, 80},
- {12, 81},
- {12, 82},
- {4, 14},
- {6, 20},
- {7, 22},
- {8, 28},
- {9, 32},
- {9, 31},
- {10, 13},
- {11, 34},
- {12, 83},
- {12, 85},
- {5, 11},
- {7, 21},
- {9, 30},
- {10, 12},
- {12, 86},
- {6, 17},
- {8, 27},
- {9, 29},
- {10, 11},
- {6, 16},
- {9, 34},
- {10, 10},
- {6, 13},
- {9, 28},
- {10, 8},
- {7, 18},
- {9, 27},
- {12, 84},
- {7, 20},
- {9, 26},
- {12, 87},
- {8, 25},
- {10, 9},
- {8, 24},
- {11, 35},
- {8, 23},
- {9, 25},
- {9, 24},
- {10, 7},
- {12, 88},
- {0, 0}
-};
-
-/*
-* For Intra
-* last = 1
-*/
-
-const OMX_U8 armVCM4P2_IntraL1RunIdx[8] =
-{
- 0, 8, 11, 13, 15, 17, 19, 21
-};
-
-/* Entry defined for all values
-* for run = 0 to 20
-* * Note: the last entry is to terminate while decoding
-*/
-const ARM_VLC32 armVCM4P2_IntraVlcL1[36] =
-{
- {4, 7},
- {6, 12},
- {8, 22},
- {9, 23},
- {10, 6},
- {11, 5},
- {11, 4},
- {12, 89},
- {6, 15},
- {9, 22},
- {10, 5},
- {6, 14},
- {10, 4},
- {7, 17},
- {11, 36},
- {7, 16},
- {11, 37},
- {7, 19},
- {12, 90},
- {8, 21},
- {12, 91},
- {8, 20},
- {8, 19},
- {8, 26},
- {9, 21},
- {9, 20},
- {9, 19},
- {9, 18},
- {9, 17},
- {11, 38},
- {11, 39},
- {12, 92},
- {12, 93},
- {12, 94},
- {12, 95},
- {0, 0}
-};
-
-/* LMAX table for Intra (Last == 0)*/
-const OMX_U8 armVCM4P2_IntraL0LMAX[15] =
-{
- 27, 10, 5, 4, 3, 3, 3,
- 3, 2, 2, 1, 1, 1, 1, 1
-};
-
-/* LMAX table for Intra (Last == 1)*/
-const OMX_U8 armVCM4P2_IntraL1LMAX[21] =
-{
- 8, 3, 2, 2, 2, 2, 2, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1
-};
-
-/* RMAX table for Intra (Last == 0)
- Level - 1 Indexed
-*/
-const OMX_U8 armVCM4P2_IntraL0RMAX[27] =
-{
- 14, 9, 7, 3, 2, 1, 1,
- 1, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0
-};
-
-/* RMAX table for Intra (Last == 1)
- Level - 1 Indexed
-*/
-const OMX_U8 armVCM4P2_IntraL1RMAX[8] =
-{
- 20, 6, 1, 0, 0, 0, 0, 0
-};
-
-/*
-* For Inter
-* last = 0
-*/
-const OMX_U8 armVCM4P2_InterL0RunIdx[12] =
-{
- 0, 12, 18, 22, 25, 28,
- 31, 34, 36, 38, 40, 42
-};
-
-/* Entry defined for all values
-* for run = 0 to 26
-* Note: the last entry is to terminate while decoding
-*/
-const ARM_VLC32 armVCM4P2_InterVlcL0[59] =
-{
- {2, 2},
- {4, 15},
- {6, 21},
- {7, 23},
- {8, 31},
- {9, 37},
- {9, 36},
- {10, 33},
- {10, 32},
- {11, 7},
- {11, 6},
- {11, 32},
- {3, 6},
- {6, 20},
- {8, 30},
- {10, 15},
- {11, 33},
- {12, 80},
- {4, 14},
- {8, 29},
- {10, 14},
- {12, 81},
- {5, 13},
- {9, 35},
- {10, 13},
- {5, 12},
- {9, 34},
- {12, 82},
- {5, 11},
- {10, 12},
- {12, 83},
- {6, 19},
- {10, 11},
- {12, 84},
- {6, 18},
- {10, 10},
- {6, 17},
- {10, 9},
- {6, 16},
- {10, 8},
- {7, 22},
- {12, 85},
- {7, 21},
- {7, 20},
- {8, 28},
- {8, 27},
- {9, 33},
- {9, 32},
- {9, 31},
- {9, 30},
- {9, 29},
- {9, 28},
- {9, 27},
- {9, 26},
- {11, 34},
- {11, 35},
- {12, 86},
- {12, 87},
- {0, 0}
-};
-
-
-/*
-* For Intra
-* last = 1
-*/
-
-const OMX_U8 armVCM4P2_InterL1RunIdx[3] =
-{
- 0, 3, 5
-};
-
-/* Entry defined for all values
-* for run = 0 to 40
-* Note: the last entry is to terminate while decoding
-*/
-const ARM_VLC32 armVCM4P2_InterVlcL1[45] =
-{
- {4, 7},
- {9, 25},
- {11, 5},
- {6, 15},
- {11, 4},
- {6, 14},
- {6, 13},
- {6, 12},
- {7, 19},
- {7, 18},
- {7, 17},
- {7, 16},
- {8, 26},
- {8, 25},
- {8, 24},
- {8, 23},
- {8, 22},
- {8, 21},
- {8, 20},
- {8, 19},
- {9, 24},
- {9, 23},
- {9, 22},
- {9, 21},
- {9, 20},
- {9, 19},
- {9, 18},
- {9, 17},
- {10, 7},
- {10, 6},
- {10, 5},
- {10, 4},
- {11, 36},
- {11, 37},
- {11, 38},
- {11, 39},
- {12, 88},
- {12, 89},
- {12, 90},
- {12, 91},
- {12, 92},
- {12, 93},
- {12, 94},
- {12, 95},
- { 0, 0}
-};
-
-/* LMAX table for Intra (Last == 0)*/
-const OMX_U8 armVCM4P2_InterL0LMAX[27] =
-{
- 12, 6, 4, 3, 3, 3, 3, 2,
- 2, 2, 2, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1,
-};
-
-/* LMAX table for Intra (Last == 1)*/
-const OMX_U8 armVCM4P2_InterL1LMAX[41] =
-{
- 3, 2, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1,
-};
-
-/* RMAX table for Intra (Last == 0)
- Level - 1 Indexed
-*/
-const OMX_U8 armVCM4P2_InterL0RMAX[12] =
-{
- 26, 10, 6, 2, 1, 1,
- 0, 0, 0, 0, 0, 0
-};
-
-/* RMAX table for Intra (Last == 1)
- Level - 1 Indexed
-*/
-const OMX_U8 armVCM4P2_InterL1RMAX[3] =
-{
- 40, 1, 0
-};
-
-/*
-* For Intra - Luminance
-*/
-
-const ARM_VLC32 armVCM4P2_aIntraDCLumaIndex[14] =
-{
- {3, 3},
- {2, 3},
- {2, 2},
- {3, 2},
- {3, 1},
- {4, 1},
- {5, 1},
- {6, 1},
- {7, 1},
- {8, 1},
- {9, 1},
- {10, 1},
- {11, 1},
- {0, 0}
-};
-
-/*
-* For Intra - Chrominance
-*/
-
-const ARM_VLC32 armVCM4P2_aIntraDCChromaIndex[14] =
-{
- {2, 3},
- {2, 2},
- {2, 1},
- {3, 1},
- {4, 1},
- {5, 1},
- {6, 1},
- {7, 1},
- {8, 1},
- {9, 1},
- {10, 1},
- {11, 1},
- {12, 1},
- {0, 0}
-};
-
-/*
- * Motion vector decoding table
- */
-
-const ARM_VLC32 armVCM4P2_aVlcMVD[66] =
-{
- {13, 5},
- {13, 7},
- {12, 5},
- {12, 7},
- {12, 9},
- {12, 11},
- {12, 13},
- {12, 15},
- {11, 9},
- {11, 11},
- {11, 13},
- {11, 15},
- {11, 17},
- {11, 19},
- {11, 21},
- {11, 23},
- {11, 25},
- {11, 27},
- {11, 29},
- {11, 31},
- {11, 33},
- {11, 35},
- {10, 19},
- {10, 21},
- {10, 23},
- {8, 7},
- {8, 9},
- {8, 11},
- {7, 7},
- {5, 3},
- {4, 3},
- {3, 3},
- {1, 1},
- {3, 2},
- {4, 2},
- {5, 2},
- {7, 6},
- {8, 10},
- {8, 8},
- {8, 6},
- {10, 22},
- {10, 20},
- {10, 18},
- {11, 34},
- {11, 32},
- {11, 30},
- {11, 28},
- {11, 26},
- {11, 24},
- {11, 22},
- {11, 20},
- {11, 18},
- {11, 16},
- {11, 14},
- {11, 12},
- {11, 10},
- {11, 8},
- {12, 14},
- {12, 12},
- {12, 10},
- {12, 8},
- {12, 6},
- {12, 4},
- {13, 6},
- {13, 4},
- { 0, 0}
-};
-
-/* End of file */
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_PutVLCBits.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_PutVLCBits.c
deleted file mode 100644
index 21d5494..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_PutVLCBits.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_PutVLCBits.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains module for VLC put bits to bitstream
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-#include "armCOMM_Bitstream.h"
-#include "armVCM4P2_ZigZag_Tables.h"
-#include "armVCM4P2_Huff_Tables_VLC.h"
-
-
-/**
- * Function: armVCM4P2_PutVLCBits
- *
- * Description:
- * Checks the type of Escape Mode and put encoded bits for
- * quantized DCT coefficients.
- *
- * Remarks:
- *
- * Parameters:
- * [in] ppBitStream pointer to the pointer to the current byte in
- * the bit stream
- * [in] pBitOffset pointer to the bit position in the byte pointed
- * by *ppBitStream. Valid within 0 to 7
- * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0,
- * and escape mode 4 is used when shortVideoHeader==1.
- * [in] start start indicates whether the encoding begins with
- * 0th element or 1st.
- * [in] maxStoreRunL0 Max store possible (considering last and inter/intra)
- * for last = 0
- * [in] maxStoreRunL1 Max store possible (considering last and inter/intra)
- * for last = 1
- * [in] maxRunForMultipleEntriesL0
- * The run value after which level
- * will be equal to 1:
- * (considering last and inter/intra status) for last = 0
- * [in] maxRunForMultipleEntriesL1
- * The run value after which level
- * will be equal to 1:
- * (considering last and inter/intra status) for last = 1
- * [in] pRunIndexTableL0 Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pVlcTableL0 VLC table for last == 0
- * [in] pRunIndexTableL1 Run Index table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [in] pVlcTableL1 VLC table for last == 1
- * [in] pLMAXTableL0 Level MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pLMAXTableL1 Level MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [in] pRMAXTableL0 Run MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 0
- * [in] pRMAXTableL1 Run MAX table defined in
- * armVCM4P2_Huff_Tables_VLC.c for last == 1
- * [out] pQDctBlkCoef pointer to the quantized DCT coefficient
- * [out] ppBitStream *ppBitStream is updated after the block is encoded
- * so that it points to the current byte in the bit
- * stream buffer.
- * [out] pBitOffset *pBitOffset is updated so that it points to the
- * current bit position in the byte pointed by
- * *ppBitStream.
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-
-OMXResult armVCM4P2_PutVLCBits (
- OMX_U8 **ppBitStream,
- OMX_INT * pBitOffset,
- const OMX_S16 *pQDctBlkCoef,
- OMX_INT shortVideoHeader,
- OMX_U8 start,
- OMX_U8 maxStoreRunL0,
- OMX_U8 maxStoreRunL1,
- OMX_U8 maxRunForMultipleEntriesL0,
- OMX_U8 maxRunForMultipleEntriesL1,
- const OMX_U8 * pRunIndexTableL0,
- const ARM_VLC32 *pVlcTableL0,
- const OMX_U8 * pRunIndexTableL1,
- const ARM_VLC32 *pVlcTableL1,
- const OMX_U8 * pLMAXTableL0,
- const OMX_U8 * pLMAXTableL1,
- const OMX_U8 * pRMAXTableL0,
- const OMX_U8 * pRMAXTableL1,
- const OMX_U8 * pZigzagTable
-)
-{
-
- OMX_U32 storeRun = 0, run, storeRunPlus;
- OMX_U8 last = 0, first = 1, fMode;
- OMX_S16 level, storeLevel = 0, storeLevelPlus;
- OMX_INT i;
-
- /* RLE encoding and packing the bits into the streams */
- for (i = start, run=0; i < 64; i++)
- {
- level = pQDctBlkCoef[pZigzagTable[i]];
-
- /* Counting the run */
- if (level == 0)
- {
- run++;
- }
-
- /* Found a non-zero coeff */
- else
- {
- if (first == 0)
- {
- last = 0;
-
- /* Check for a valid entry in the VLC table */
- storeLevelPlus = armSignCheck(storeLevel) *
- (armAbs(storeLevel) - pLMAXTableL0[storeRun]);
- storeRunPlus = storeRun -
- (pRMAXTableL0[armAbs(storeLevel) - 1] + 1);
-
- fMode = armVCM4P2_CheckVLCEscapeMode(
- storeRun,
- storeRunPlus,
- storeLevel,
- storeLevelPlus,
- maxStoreRunL0,
- maxRunForMultipleEntriesL0,
- shortVideoHeader,
- pRunIndexTableL0);
-
- armVCM4P2_FillVLCBuffer (
- ppBitStream,
- pBitOffset,
- storeRun,
- storeLevel,
- storeRunPlus,
- storeLevelPlus,
- fMode,
- last,
- maxRunForMultipleEntriesL0,
- pRunIndexTableL0,
- pVlcTableL0);
- }
- storeLevel = level;
- storeRun = run;
- first = 0;
- run = 0;
- }
-
- } /* end of for loop for 64 elements */
-
- /* writing the last element */
- last = 1;
-
- /* Check for a valid entry in the VLC table */
- storeLevelPlus = armSignCheck(storeLevel) *
- (armAbs(storeLevel) - pLMAXTableL1[run]);
- storeRunPlus = storeRun -
- (pRMAXTableL1[armAbs(storeLevel) - 1] + 1);
- fMode = armVCM4P2_CheckVLCEscapeMode(
- storeRun,
- storeRunPlus,
- storeLevel,
- storeLevelPlus,
- maxStoreRunL1,
- maxRunForMultipleEntriesL1,
- shortVideoHeader,
- pRunIndexTableL1);
-
- armVCM4P2_FillVLCBuffer (
- ppBitStream,
- pBitOffset,
- storeRun,
- storeLevel,
- storeRunPlus,
- storeLevelPlus,
- fMode,
- last,
- maxRunForMultipleEntriesL1,
- pRunIndexTableL1,
- pVlcTableL1);
- return OMX_Sts_NoErr;
-}
-
-/* End of File */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_SetPredDir.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_SetPredDir.c
deleted file mode 100644
index 61d44d4..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_SetPredDir.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: armVCM4P2_SetPredDir.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains module for detecting the prediction direction
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: armVCM4P2_SetPredDir
- *
- * Description:
- * Performs detecting the prediction direction
- *
- * Remarks:
- *
- * Parameters:
- * [in] blockIndex block index indicating the component type and
- * position as defined in subclause 6.1.3.8, of ISO/IEC
- * 14496-2. Furthermore, indexes 6 to 9 indicate the
- * alpha blocks spatially corresponding to luminance
- * blocks 0 to 3 in the same macroblock.
- * [in] pCoefBufRow pointer to the coefficient row buffer
- * [in] pQpBuf pointer to the quantization parameter buffer
- * [out] predQP quantization parameter of the predictor block
- * [out] predDir indicates the prediction direction which takes one
- * of the following values:
- * OMX_VC_HORIZONTAL predict horizontally
- * OMX_VC_VERTICAL predict vertically
- *
- * Return Value:
- * Standard OMXResult result. See enumeration for possible result codes.
- *
- */
-
-OMXResult armVCM4P2_SetPredDir(
- OMX_INT blockIndex,
- OMX_S16 *pCoefBufRow,
- OMX_S16 *pCoefBufCol,
- OMX_INT *predDir,
- OMX_INT *predQP,
- const OMX_U8 *pQpBuf
-)
-{
- OMX_U8 blockDCLeft;
- OMX_U8 blockDCTop;
- OMX_U8 blockDCTopLeft;
-
- if (blockIndex == 3)
- {
- blockDCTop = *(pCoefBufCol - 8);
- }
- else
- {
- blockDCTop = *pCoefBufRow;
- }
- blockDCLeft = *pCoefBufCol;
- blockDCTopLeft = *(pCoefBufRow - 8);
-
- if (armAbs(blockDCLeft - blockDCTopLeft) < armAbs(blockDCTopLeft \
- - blockDCTop))
- {
- *predDir = OMX_VC_VERTICAL;
- *predQP = pQpBuf[1];
- }
- else
- {
- *predDir = OMX_VC_HORIZONTAL;
- *predQP = pQpBuf[0];
- }
- return OMX_Sts_NoErr;
-}
-
-
-/*End of File*/
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_Zigzag_Tables.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_Zigzag_Tables.c
deleted file mode 100644
index bcfc0ef..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/armVCM4P2_Zigzag_Tables.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
- /**
- *
- * File Name: armVCM4P2_Zigzag_Tables.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * File: armVCM4P2_ZigZag_Tables.c
- * Description: Contains the zigzag tables
- *
- */
-
-#include "omxtypes.h"
-
-const OMX_U8 armVCM4P2_aClassicalZigzagScan [64] =
-{
- 0, 1, 8, 16, 9, 2, 3, 10,
- 17, 24, 32, 25, 18, 11, 4, 5,
- 12, 19, 26, 33, 40, 48, 41, 34,
- 27, 20, 13, 6, 7, 14, 21, 28,
- 35, 42, 49, 56, 57, 50, 43, 36,
- 29, 22, 15, 23, 30, 37, 44, 51,
- 58, 59, 52, 45, 38, 31, 39, 46,
- 53, 60, 61, 54, 47, 55, 62, 63
-};
-
-const OMX_U8 armVCM4P2_aHorizontalZigzagScan [64] =
-{
- 0, 1, 2, 3, 8, 9, 16, 17,
- 10, 11, 4, 5, 6, 7, 15, 14,
- 13, 12, 19, 18, 24, 25, 32, 33,
- 26, 27, 20, 21, 22, 23, 28, 29,
- 30, 31, 34, 35, 40, 41, 48, 49,
- 42, 43, 36, 37, 38, 39, 44, 45,
- 46, 47, 50, 51, 56, 57, 58, 59,
- 52, 53, 54, 55, 60, 61, 62, 63
-};
-
-const OMX_U8 armVCM4P2_aVerticalZigzagScan [64] =
-{
- 0, 8, 16, 24, 1, 9, 2, 10,
- 17, 25, 32, 40, 48, 56, 57, 49,
- 41, 33, 26, 18, 3, 11, 4, 12,
- 19, 27, 34, 42, 50, 58, 35, 43,
- 51, 59, 20, 28, 5, 13, 6, 14,
- 21, 29, 36, 44, 52, 60, 37, 45,
- 53, 61, 22, 30, 7, 15, 23, 31,
- 38, 46, 54, 62, 39, 47, 55, 63
-};
-
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_BlockMatch_Half_16x16.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_BlockMatch_Half_16x16.c
deleted file mode 100644
index f23c533..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_BlockMatch_Half_16x16.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_BlockMatch_Half_16x16.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for Block matching, a full search algorithm
- * is implemented
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: omxVCM4P2_BlockMatch_Half_16x16 (6.2.4.2.3)
- *
- * Description:
- * Performs a 16x16 block match with half-pixel resolution. Returns the
- * estimated motion vector and associated minimum SAD. This function
- * estimates the half-pixel motion vector by interpolating the integer
- * resolution motion vector referenced by the input parameter pSrcDstMV, i.e.,
- * the initial integer MV is generated externally. The input parameters
- * pSrcRefBuf and pSearchPointRefPos should be shifted by the winning MV of
- * 16x16 integer search prior to calling BlockMatch_Half_16x16. The function
- * BlockMatch_Integer_16x16 may be used for integer motion estimation.
- *
- * Input Arguments:
- *
- * pSrcRefBuf - pointer to the reference Y plane; points to the reference
- * macroblock that corresponds to the location of the current
- * macroblock in the current plane.
- * refWidth - width of the reference plane
- * pRefRect - reference plane valid region rectangle
- * pSrcCurrBuf - pointer to the current block in the current macroblock
- * buffer extracted from the original plane (linear array, 256
- * entries); must be aligned on a 16-byte boundary. The number of
- * bytes between lines (step) is 16.
- * pSearchPointRefPos - position of the starting point for half pixel
- * search (specified in terms of integer pixel units) in the
- * reference plane, i.e., the reference position pointed to by the
- * predicted motion vector.
- * rndVal - rounding control parameter: 0 - disabled; 1 - enabled.
- * pSrcDstMV - pointer to the initial MV estimate; typically generated
- * during a prior 16X16 integer search; specified in terms of
- * half-pixel units.
- *
- * Output Arguments:
- *
- * pSrcDstMV - pointer to estimated MV
- * pDstSAD - pointer to minimum SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following
- * conditions is true:
- * - at least one of the following pointers is NULL: pSrcRefBuf,
- * pRefRect, pSrcCurrBuff, pSearchPointRefPos, pSrcDstMV.
- * - pSrcCurrBuf is not 16-byte aligned, or
- *
- */
-
-OMXResult omxVCM4P2_BlockMatch_Half_16x16(
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pSearchPointRefPos,
- OMX_INT rndVal,
- OMXVCMotionVector *pSrcDstMV,
- OMX_INT *pDstSAD
-)
-{
-
- /* For a blocksize of 16x16 */
- OMX_U8 BlockSize = 16;
-
- /* Argument error checks */
- armRetArgErrIf(pSrcRefBuf == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pRefRect == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcCurrBuf == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSearchPointRefPos == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcDstMV == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs16ByteAligned(pSrcCurrBuf), OMX_Sts_BadArgErr);
-
- return (armVCM4P2_BlockMatch_Half(
- pSrcRefBuf,
- refWidth,
- pRefRect,
- pSrcCurrBuf,
- pSearchPointRefPos,
- rndVal,
- pSrcDstMV,
- pDstSAD,
- BlockSize));
-
-
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_BlockMatch_Half_8x8.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_BlockMatch_Half_8x8.c
deleted file mode 100644
index 83da79f..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_BlockMatch_Half_8x8.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_BlockMatch_Half_8x8.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for Block matching, a full search algorithm
- * is implemented
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-
-/**
- * Function: omxVCM4P2_BlockMatch_Half_8x8 (6.2.4.2.4)
- *
- * Description:
- * Performs an 8x8 block match with half-pixel resolution. Returns the
- * estimated motion vector and associated minimum SAD. This function
- * estimates the half-pixel motion vector by interpolating the integer
- * resolution motion vector referenced by the input parameter pSrcDstMV, i.e.,
- * the initial integer MV is generated externally. The input parameters
- * pSrcRefBuf and pSearchPointRefPos should be shifted by the winning MV of
- * 8x8 integer search prior to calling BlockMatch_Half_8x8. The function
- * BlockMatch_Integer_8x8 may be used for integer motion estimation.
- *
- * Input Arguments:
- *
- * pSrcRefBuf - pointer to the reference Y plane; points to the reference
- * block that corresponds to the location of the current 8x8 block
- * in the current plane.
- * refWidth - width of the reference plane
- * pRefRect - reference plane valid region rectangle
- * pSrcCurrBuf - pointer to the current block in the current macroblock
- * buffer extracted from the original plane (linear array, 128
- * entries); must be aligned on a 8-byte boundary. The number of
- * bytes between lines (step) is 16.
- * pSearchPointRefPos - position of the starting point for half pixel
- * search (specified in terms of integer pixel units) in the
- * reference plane.
- * rndVal - rounding control parameter: 0 - disabled; 1 - enabled.
- * pSrcDstMV - pointer to the initial MV estimate; typically generated
- * during a prior 8x8 integer search, specified in terms of
- * half-pixel units.
- *
- * Output Arguments:
- *
- * pSrcDstMV - pointer to estimated MV
- * pDstSAD - pointer to minimum SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following
- * conditions is true:
- * - at least one of the following pointers is NULL:
- * pSrcRefBuf, pRefRect, pSrcCurrBuff, pSearchPointRefPos, pSrcDstMV
- * - pSrcCurrBuf is not 8-byte aligned
- *
- */
-
-OMXResult omxVCM4P2_BlockMatch_Half_8x8(
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pSearchPointRefPos,
- OMX_INT rndVal,
- OMXVCMotionVector *pSrcDstMV,
- OMX_INT *pDstSAD
-)
-{
- /* For a blocksize of 8x8 */
- OMX_U8 BlockSize = 8;
-
- /* Argument error checks */
- armRetArgErrIf(pSrcRefBuf == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pRefRect == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcCurrBuf == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSearchPointRefPos == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcDstMV == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs8ByteAligned(pSrcCurrBuf), OMX_Sts_BadArgErr);
-
- return (armVCM4P2_BlockMatch_Half(
- pSrcRefBuf,
- refWidth,
- pRefRect,
- pSrcCurrBuf,
- pSearchPointRefPos,
- rndVal,
- pSrcDstMV,
- pDstSAD,
- BlockSize));
-
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_BlockMatch_Integer_16x16.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_BlockMatch_Integer_16x16.c
deleted file mode 100644
index e224016..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_BlockMatch_Integer_16x16.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_BlockMatch_Integer_16x16.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for Block matching, a full search algorithm
- * is implemented
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: omxVCM4P2_BlockMatch_Integer_16x16 (6.2.4.2.1)
- *
- * Description:
- * Performs a 16x16 block search; estimates motion vector and associated
- * minimum SAD. Both the input and output motion vectors are represented using
- * half-pixel units, and therefore a shift left or right by 1 bit may be
- * required, respectively, to match the input or output MVs with other
- * functions that either generate output MVs or expect input MVs represented
- * using integer pixel units.
- *
- * Input Arguments:
- *
- * pSrcRefBuf - pointer to the reference Y plane; points to the reference
- * MB that corresponds to the location of the current macroblock in
- * the current plane.
- * refWidth - width of the reference plane
- * pRefRect - pointer to the valid reference plane rectangle; coordinates
- * are specified relative to the image origin. Rectangle
- * boundaries may extend beyond image boundaries if the image has
- * been padded. For example, if padding extends 4 pixels beyond
- * frame border, then the value for the left border could be set to
- * -4.
- * pSrcCurrBuf - pointer to the current block in the current macroblock
- * buffer extracted from the original plane (linear array, 256
- * entries); must be aligned on a 16-byte boundary. The number of
- * bytes between lines (step) is 16.
- * pCurrPointPos - position of the current macroblock in the current plane
- * pSrcPreMV - pointer to predicted motion vector; NULL indicates no
- * predicted MV
- * pSrcPreSAD - pointer to SAD associated with the predicted MV (referenced
- * by pSrcPreMV); may be set to NULL if unavailable.
- * pMESpec - vendor-specific motion estimation specification structure;
- * must have been allocated and then initialized using
- * omxVCM4P2_MEInit prior to calling the block matching function.
- *
- * Output Arguments:
- *
- * pDstMV - pointer to estimated MV
- * pDstSAD - pointer to minimum SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following
- * conditions is true:
- * - at least one of the following pointers is NULL: pSrcRefBuf,
- * pRefRect, pSrcCurrBuff, pCurrPointPos, pDstMV, pDstSAD or
- * pMESpec, or
- * - pSrcCurrBuf is not 16-byte aligned
- *
- */
-
-OMXResult omxVCM4P2_BlockMatch_Integer_16x16(
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- const OMXVCMotionVector *pSrcPreMV,
- const OMX_INT *pSrcPreSAD,
- void *pMESpec,
- OMXVCMotionVector *pDstMV,
- OMX_INT *pDstSAD
-)
-{
-
- OMX_U8 BlockSize = 16;
-
- /* Argument error checks */
- armRetArgErrIf(!armIs16ByteAligned(pSrcCurrBuf), OMX_Sts_BadArgErr);
-
- return ( armVCM4P2_BlockMatch_Integer(
- pSrcRefBuf,
- refWidth,
- pRefRect,
- pSrcCurrBuf,
- pCurrPointPos,
- pSrcPreMV,
- pSrcPreSAD,
- pMESpec,
- pDstMV,
- pDstSAD,
- BlockSize)
- );
-
-
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_BlockMatch_Integer_8x8.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_BlockMatch_Integer_8x8.c
deleted file mode 100644
index 73a99bd..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_BlockMatch_Integer_8x8.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_BlockMatch_Integer_8x8.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for Block matching, a full search algorithm
- * is implemented
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: omxVCM4P2_BlockMatch_Integer_8x8 (6.2.4.2.2)
- *
- * Description:
- * Performs an 8x8 block search; estimates motion vector and associated
- * minimum SAD. Both the input and output motion vectors are represented
- * using half-pixel units, and therefore a shift left or right by 1 bit may be
- * required, respectively, to match the input or output MVs with other
- * functions that either generate output MVs or expect input MVs represented
- * using integer pixel units.
- *
- * Input Arguments:
- *
- * pSrcRefBuf - pointer to the reference Y plane; points to the reference
- * block that corresponds to the location of the current 8x8 block
- * in the current plane.
- * refWidth - width of the reference plane
- * pRefRect - pointer to the valid reference plane rectangle; coordinates
- * are specified relative to the image origin. Rectangle
- * boundaries may extend beyond image boundaries if the image has
- * been padded.
- * pSrcCurrBuf - pointer to the current block in the current macroblock
- * buffer extracted from the original plane (linear array, 128
- * entries); must be aligned on an 8-byte boundary. The number of
- * bytes between lines (step) is 16 bytes.
- * pCurrPointPos - position of the current block in the current plane
- * pSrcPreMV - pointer to predicted motion vector; NULL indicates no
- * predicted MV
- * pSrcPreSAD - pointer to SAD associated with the predicted MV (referenced
- * by pSrcPreMV); may be set to NULL if unavailable.
- * pMESpec - vendor-specific motion estimation specification structure;
- * must have been allocated and then initialized using
- * omxVCM4P2_MEInit prior to calling the block matching function.
- *
- * Output Arguments:
- *
- * pDstMV - pointer to estimated MV
- * pDstSAD - pointer to minimum SAD
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following
- * conditions is true:
- * - at least one of the following pointers is NULL: pSrcRefBuf,
- * pRefRect, pSrcCurrBuff, pCurrPointPos, pDstMV, pDstSAD or
- * pMESpec, or
- * - pSrcCurrBuf is not 8-byte aligned
- *
- */
-
-OMXResult omxVCM4P2_BlockMatch_Integer_8x8(
- const OMX_U8 *pSrcRefBuf,
- OMX_INT refWidth,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- const OMXVCMotionVector *pSrcPreMV,
- const OMX_INT *pSrcPreSAD,
- void *pMESpec,
- OMXVCMotionVector *pDstMV,
- OMX_INT *pDstSAD
-)
-{
- OMX_U8 BlockSize = 8;
-
- /* Argument error checks */
- armRetArgErrIf(!armIs8ByteAligned(pSrcCurrBuf), OMX_Sts_BadArgErr);
-
- return ( armVCM4P2_BlockMatch_Integer(
- pSrcRefBuf,
- refWidth,
- pRefRect,
- pSrcCurrBuf,
- pCurrPointPos,
- pSrcPreMV,
- pSrcPreSAD,
- pMESpec,
- pDstMV,
- pDstSAD,
- BlockSize)
- );
-
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DCT8x8blk.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DCT8x8blk.c
deleted file mode 100644
index c73e24a..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DCT8x8blk.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_DCT8x8blk.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for 8x8 block DCT
- *
- */
-
-#include <math.h>
-#include "omxtypes.h"
-#include "armOMX.h"
-
-#include "armCOMM.h"
-#include "armVCM4P2_DCT_Table.h"
-
-/**
- * Function: omxVCM4P2_DCT8x8blk (6.2.4.4.1)
- *
- * Description:
- * Computes a 2D forward DCT for a single 8x8 block, as defined in
- * [ISO14496-2].
- *
- * Input Arguments:
- *
- * pSrc - pointer to the start of the linearly arranged input buffer; must
- * be aligned on a 16-byte boundary. Input values (pixel
- * intensities) are valid in the range [-255,255].
- *
- * Output Arguments:
- *
- * pDst - pointer to the start of the linearly arranged output buffer; must
- * be aligned on a 16-byte boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments, returned if:
- * - pSrc or pDst is NULL.
- * - pSrc or pDst is not 16-byte aligned.
- *
- */
-
-OMXResult omxVCM4P2_DCT8x8blk (const OMX_S16 *pSrc, OMX_S16 *pDst)
-{
- OMX_INT x, y, u, v;
-
- /* Argument error checks */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs16ByteAligned(pSrc), OMX_Sts_BadArgErr);
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs16ByteAligned(pDst), OMX_Sts_BadArgErr);
-
-
- for (u = 0; u < 8; u++)
- {
- for (v = 0; v < 8; v++)
- {
- OMX_F64 sum = 0.0;
- for (x = 0; x < 8; x++)
- {
- for (y = 0; y < 8; y++)
- {
- sum += pSrc[(x * 8) + y] *
- armVCM4P2_preCalcDCTCos[x][u] *
- armVCM4P2_preCalcDCTCos[y][v];
- }
- }
- pDst[(u * 8) + v]= armRoundFloatToS16 (sum);
- }
- }
-
- return OMX_Sts_NoErr;
-}
-
-
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Inter.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Inter.c
deleted file mode 100644
index 9c9a7f6..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Inter.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_DecodeBlockCoef_Inter.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for inter reconstruction
- *
- */
-
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-
-
-/**
- * Function: omxVCM4P2_DecodeBlockCoef_Inter (6.2.5.4.2)
- *
- * Description:
- * Decodes the INTER block coefficients. This function performs inverse
- * quantization, inverse zigzag positioning, and IDCT (with appropriate
- * clipping on each step) on the coefficients. The results (residuals) are
- * placed in a contiguous array of 64 elements. For INTER block, the output
- * buffer holds the residuals for further reconstruction.
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the bit
- * stream buffer. There is no boundary check for the bit stream
- * buffer.
- * pBitOffset - pointer to the bit position in the byte pointed to by
- * *ppBitStream. *pBitOffset is valid within [0-7]
- * QP - quantization parameter
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; shortVideoHeader==1 selects linear intra DC
- * mode, and shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded, so
- * that it points to the current byte in the bit stream buffer
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream
- * pDst - pointer to the decoded residual buffer (a contiguous array of 64
- * elements of OMX_S16 data type); must be aligned on a 16-byte
- * boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments, if:
- * - At least one of the following pointers is Null:
- * ppBitStream, *ppBitStream, pBitOffset , pDst
- * - *pBitOffset exceeds [0,7]
- * - QP <= 0.
- * - pDst is not 16-byte aligned
- * OMX_Sts_Err - status error. Refer to OMX_Sts_Err of DecodeVLCZigzag_Inter .
- *
- */
-OMXResult omxVCM4P2_DecodeBlockCoef_Inter(
- const OMX_U8 ** ppBitStream,
- OMX_INT * pBitOffset,
- OMX_S16 * pDst,
- OMX_INT QP,
- OMX_INT shortVideoHeader
-)
-{
- /* 64 elements are needed but to align it to 16 bytes need
- 15 more elements of padding */
- OMX_S16 tempBuf[79];
- OMX_S16 *pTempBuf1;
- OMXResult errorCode;
- /* Aligning the local buffers */
- pTempBuf1 = armAlignTo16Bytes(tempBuf);
-
- /* Argument error checks */
- armRetArgErrIf(ppBitStream == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(*ppBitStream == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBitOffset == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs16ByteAligned(pDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(((QP <= 0) || (QP >= 32)), OMX_Sts_BadArgErr);
- armRetArgErrIf(((*pBitOffset < 0) || (*pBitOffset > 7)), OMX_Sts_BadArgErr);
-
-
- /* VLD and zigzag */
- errorCode = omxVCM4P2_DecodeVLCZigzag_Inter(ppBitStream, pBitOffset,
- pTempBuf1,shortVideoHeader);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- /* Dequantization */
- errorCode = omxVCM4P2_QuantInvInter_I(
- pTempBuf1,
- QP);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- /* Inverse transform */
- errorCode = omxVCM4P2_IDCT8x8blk(pTempBuf1, pDst);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Intra.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Intra.c
deleted file mode 100644
index 970da6c..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DecodeBlockCoef_Intra.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_DecodeBlockCoef_Intra.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for intra reconstruction
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P2_DecodeBlockCoef_Intra (6.2.5.4.1)
- *
- * Description:
- * Decodes the INTRA block coefficients. Inverse quantization, inversely
- * zigzag positioning, and IDCT, with appropriate clipping on each step, are
- * performed on the coefficients. The results are then placed in the output
- * frame/plane on a pixel basis. Note: This function will be used only when
- * at least one non-zero AC coefficient of current block exists in the bit
- * stream. The DC only condition will be handled in another function.
- *
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the bit
- * stream buffer. There is no boundary check for the bit stream
- * buffer.
- * pBitOffset - pointer to the bit position in the byte pointed to by
- * *ppBitStream. *pBitOffset is valid within [0-7].
- * step - width of the destination plane
- * pCoefBufRow - pointer to the coefficient row buffer; must be aligned on
- * an 8-byte boundary.
- * pCoefBufCol - pointer to the coefficient column buffer; must be aligned
- * on an 8-byte boundary.
- * curQP - quantization parameter of the macroblock which the current block
- * belongs to
- * pQPBuf - pointer to the quantization parameter buffer
- * blockIndex - block index indicating the component type and position as
- * defined in [ISO14496-2], subclause 6.1.3.8, Figure 6-5.
- * intraDCVLC - a code determined by intra_dc_vlc_thr and QP. This allows a
- * mechanism to switch between two VLC for coding of Intra DC
- * coefficients as per [ISO14496-2], Table 6-21.
- * ACPredFlag - a flag equal to ac_pred_flag (of luminance) indicating if
- * the ac coefficients of the first row or first column are
- * differentially coded for intra coded macroblock.
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; shortVideoHeader==1 selects linear intra DC
- * mode, and shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded, so
- * that it points to the current byte in the bit stream buffer
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream
- * pDst - pointer to the block in the destination plane; must be aligned on
- * an 8-byte boundary.
- * pCoefBufRow - pointer to the updated coefficient row buffer.
- * pCoefBufCol - pointer to the updated coefficient column buffer Note:
- * The coefficient buffers must be updated in accordance with the
- * update procedure defined in section 6.2.2.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments, if:
- * - At least one of the following pointers is NULL:
- * ppBitStream, *ppBitStream, pBitOffset, pCoefBufRow, pCoefBufCol,
- * pQPBuf, pDst.
- * - *pBitOffset exceeds [0,7]
- * - curQP exceeds (1, 31)
- * - blockIndex exceeds [0,5]
- * - step is not the multiple of 8
- * - a pointer alignment requirement was violated.
- * OMX_Sts_Err - status error. Refer to OMX_Sts_Err of DecodeVLCZigzag_Intra.
- *
- */
-
-OMXResult omxVCM4P2_DecodeBlockCoef_Intra(
- const OMX_U8 ** ppBitStream,
- OMX_INT *pBitOffset,
- OMX_U8 *pDst,
- OMX_INT step,
- OMX_S16 *pCoefBufRow,
- OMX_S16 *pCoefBufCol,
- OMX_U8 curQP,
- const OMX_U8 *pQPBuf,
- OMX_INT blockIndex,
- OMX_INT intraDCVLC,
- OMX_INT ACPredFlag,
- OMX_INT shortVideoHeader
- )
-{
- OMX_S16 tempBuf1[79], tempBuf2[79];
- OMX_S16 *pTempBuf1, *pTempBuf2;
- OMX_INT predDir, predACDir, i, j, count;
- OMX_INT predQP;
- OMXVCM4P2VideoComponent videoComp;
- OMXResult errorCode;
-
- /* Argument error checks */
- armRetArgErrIf(ppBitStream == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(*ppBitStream == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBitOffset == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pCoefBufRow == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pCoefBufCol == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pQPBuf == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs8ByteAligned(pDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(((curQP <= 0) || (curQP >= 32)), OMX_Sts_BadArgErr);
- armRetArgErrIf((*pBitOffset < 0) || (*pBitOffset >7), OMX_Sts_BadArgErr);
- armRetArgErrIf((blockIndex < 0) || (blockIndex > 5), OMX_Sts_BadArgErr);
- armRetArgErrIf((step % 8) != 0, OMX_Sts_BadArgErr);
-
-
- /* Aligning the local buffers */
- pTempBuf1 = armAlignTo16Bytes(tempBuf1);
- pTempBuf2 = armAlignTo16Bytes(tempBuf2);
-
- /* Setting the AC prediction direction and prediction direction */
- armVCM4P2_SetPredDir(
- blockIndex,
- pCoefBufRow,
- pCoefBufCol,
- &predDir,
- &predQP,
- pQPBuf);
-
- predACDir = predDir;
-
- armRetArgErrIf(((predQP <= 0) || (predQP >= 32)), OMX_Sts_BadArgErr);
-
- if (ACPredFlag == 0)
- {
- predACDir = OMX_VC_NONE;
- }
-
- /* Setting the videoComp */
- if (blockIndex <= 3)
- {
- videoComp = OMX_VC_LUMINANCE;
- }
- else
- {
- videoComp = OMX_VC_CHROMINANCE;
- }
-
-
- /* VLD and zigzag */
- if (intraDCVLC == 1)
- {
- errorCode = omxVCM4P2_DecodeVLCZigzag_IntraDCVLC(
- ppBitStream,
- pBitOffset,
- pTempBuf1,
- predACDir,
- shortVideoHeader,
- videoComp);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
- }
- else
- {
- errorCode = omxVCM4P2_DecodeVLCZigzag_IntraACVLC(
- ppBitStream,
- pBitOffset,
- pTempBuf1,
- predACDir,
- shortVideoHeader);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
- }
-
- /* AC DC prediction */
- errorCode = omxVCM4P2_PredictReconCoefIntra(
- pTempBuf1,
- pCoefBufRow,
- pCoefBufCol,
- curQP,
- predQP,
- predDir,
- ACPredFlag,
- videoComp);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- /* Dequantization */
- errorCode = omxVCM4P2_QuantInvIntra_I(
- pTempBuf1,
- curQP,
- videoComp,
- shortVideoHeader);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- /* Inverse transform */
- errorCode = omxVCM4P2_IDCT8x8blk (pTempBuf1, pTempBuf2);
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- /* Placing the linear array into the destination plane and clipping
- it to 0 to 255 */
- for (j = 0, count = 0; j < 8; j++)
- {
- for(i = 0; i < 8; i++, count++)
- {
- pDst[i] = armClip (0, 255, pTempBuf2[count]);
- }
- pDst += step;
- }
-
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DecodePadMV_PVOP.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DecodePadMV_PVOP.c
deleted file mode 100644
index ae2c220..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DecodePadMV_PVOP.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_DecodePadMV_PVOP.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains module for decoding MV and padding the same
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM_Bitstream.h"
-#include "armCOMM.h"
-#include "armVCM4P2_Huff_Tables_VLC.h"
-
-
-
-/**
- * Function: omxVCM4P2_DecodePadMV_PVOP (6.2.5.1.1)
- *
- * Description:
- * Decodes and pads the four motion vectors associated with a non-intra P-VOP
- * macroblock. For macroblocks of type OMX_VC_INTER4V, the output MV is
- * padded as specified in [ISO14496-2], subclause 7.6.1.6. Otherwise, for
- * macroblocks of types other than OMX_VC_INTER4V, the decoded MV is copied to
- * all four output MV buffer entries.
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the bit
- * stream buffer
- * pBitOffset - pointer to the bit position in the byte pointed to by
- * *ppBitStream. *pBitOffset is valid within [0-7].
- * pSrcMVLeftMB, pSrcMVUpperMB, and pSrcMVUpperRightMB - pointers to the
- * motion vector buffers of the macroblocks specially at the left,
- * upper, and upper-right side of the current macroblock,
- * respectively; a value of NULL indicates unavailability. Note:
- * Any neighborhood macroblock outside the current VOP or video
- * packet or outside the current GOB (when short_video_header is
- * 1 ) for which gob_header_empty is 0 is treated as
- * transparent, according to [ISO14496-2], subclause 7.6.5.
- * fcodeForward - a code equal to vop_fcode_forward in MPEG-4 bit stream
- * syntax
- * MBType - the type of the current macroblock. If MBType is not equal to
- * OMX_VC_INTER4V, the destination motion vector buffer is still
- * filled with the same decoded vector.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded, so
- * that it points to the current byte in the bit stream buffer
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream
- * pDstMVCurMB - pointer to the motion vector buffer for the current
- * macroblock; contains four decoded motion vectors
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - At least one of the following pointers is NULL:
- * ppBitStream, *ppBitStream, pBitOffset, pDstMVCurMB
- * - *pBitOffset exceeds [0,7]
- * - fcodeForward exceeds (0,7]
- * - MBType less than zero
- * - motion vector buffer is not 4-byte aligned.
- * OMX_Sts_Err - status error
- *
- */
-
-OMXResult omxVCM4P2_DecodePadMV_PVOP(
- const OMX_U8 ** ppBitStream,
- OMX_INT * pBitOffset,
- OMXVCMotionVector * pSrcMVLeftMB,
- OMXVCMotionVector *pSrcMVUpperMB,
- OMXVCMotionVector * pSrcMVUpperRightMB,
- OMXVCMotionVector * pDstMVCurMB,
- OMX_INT fcodeForward,
- OMXVCM4P2MacroblockType MBType
- )
-{
- OMXVCMotionVector diffMV;
- OMXVCMotionVector dstMVPredME[12];
- OMX_INT iBlk, i, count = 1;
- OMX_S32 mvHorResidual = 1, mvVerResidual = 1, mvHorData, mvVerData;
- OMX_S8 scaleFactor, index;
- OMX_S16 high, low, range;
-
-
- /* Argument error checks */
- armRetArgErrIf(ppBitStream == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(*ppBitStream == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBitOffset == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDstMVCurMB == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(((*pBitOffset < 0) || (*pBitOffset > 7)), OMX_Sts_BadArgErr);
- armRetArgErrIf(((fcodeForward < 1) || (fcodeForward > 7)), \
- OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs4ByteAligned(pDstMVCurMB), OMX_Sts_BadArgErr);
-
- if ((MBType == OMX_VC_INTRA) ||
- (MBType == OMX_VC_INTRA_Q)
- )
- {
- /* All MV's are zero */
- for (i = 0; i < 4; i++)
- {
- pDstMVCurMB[i].dx = 0;
- pDstMVCurMB[i].dy = 0;
- }
-
- return OMX_Sts_NoErr;
- }
-
- if ((MBType == OMX_VC_INTER4V) || (MBType == OMX_VC_INTER4V_Q))
- {
- count = 4;
- }
- else if ((MBType == OMX_VC_INTER) || (MBType == OMX_VC_INTER_Q))
- {
- count = 1;
- }
-
- /* Calculating the scale factor */
- scaleFactor = 1 << (fcodeForward -1);
- high = ( 32 * scaleFactor) - 1;
- low = ( (-32) * scaleFactor);
- range = ( 64 * scaleFactor);
-
- /* Huffman decoding and MV reconstruction */
- for (iBlk = 0; iBlk < count; iBlk++)
- {
-
- /* Huffman decoding to get Horizontal data and residual */
- index = armUnPackVLC32(ppBitStream, pBitOffset,
- armVCM4P2_aVlcMVD);
- armRetDataErrIf(index == -1, OMX_Sts_Err);
-
- mvHorData = index - 32;
-
- if ((fcodeForward > 1) && (mvHorData != 0))
- {
- mvHorResidual = (OMX_S32) armGetBits(ppBitStream,
- pBitOffset, (fcodeForward -1));
- }
-
- /* Huffman decoding to get Vertical data and residual */
- index = armUnPackVLC32(ppBitStream, pBitOffset, armVCM4P2_aVlcMVD);
- armRetDataErrIf(index == -1, OMX_Sts_Err);
-
- mvVerData = index - 32;
-
- if ((fcodeForward > 1) && (mvVerData != 0))
- {
- mvVerResidual = (OMX_S32) armGetBits(ppBitStream,
- pBitOffset, (fcodeForward -1));
- }
-
- /* Calculating the differtial MV */
- if ( (scaleFactor == 1) || (mvHorData == 0) )
- {
- diffMV.dx = mvHorData;
- }
- else
- {
- diffMV.dx = ((armAbs(mvHorData) - 1) * fcodeForward)
- + mvHorResidual + 1;
- if (mvHorData < 0)
- {
- diffMV.dx = -diffMV.dx;
- }
- }
-
- if ( (scaleFactor == 1) || (mvVerData == 0) )
- {
- diffMV.dy = mvVerData;
- }
- else
- {
- diffMV.dy = ((armAbs(mvVerData) - 1) * fcodeForward)
- + mvVerResidual + 1;
- if (mvVerData < 0)
- {
- diffMV.dy = -diffMV.dy;
- }
- }
-
- /* Find the predicted vector */
- omxVCM4P2_FindMVpred (
- pDstMVCurMB,
- pSrcMVLeftMB,
- pSrcMVUpperMB,
- pSrcMVUpperRightMB,
- &pDstMVCurMB[iBlk],
- dstMVPredME,
- iBlk);
-
- /* Adding the difference to the predicted MV to reconstruct MV */
- pDstMVCurMB[iBlk].dx += diffMV.dx;
- pDstMVCurMB[iBlk].dy += diffMV.dy;
-
- /* Checking the range and keeping it within the limits */
- if ( pDstMVCurMB[iBlk].dx < low )
- {
- pDstMVCurMB[iBlk].dx += range;
- }
- if (pDstMVCurMB[iBlk].dx > high)
- {
- pDstMVCurMB[iBlk].dx -= range;
- }
-
- if ( pDstMVCurMB[iBlk].dy < low )
- {
- pDstMVCurMB[iBlk].dy += range;
- }
- if (pDstMVCurMB[iBlk].dy > high)
- {
- pDstMVCurMB[iBlk].dy -= range;
- }
- }
-
- if ((MBType == OMX_VC_INTER) || (MBType == OMX_VC_INTER_Q))
- {
- pDstMVCurMB[1] = pDstMVCurMB[0];
- pDstMVCurMB[2] = pDstMVCurMB[0];
- pDstMVCurMB[3] = pDstMVCurMB[0];
- }
-
- return OMX_Sts_NoErr;
-}
-
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_Inter.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_Inter.c
deleted file mode 100644
index 2d3cf6e..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_Inter.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_DecodeVLCZigzag_Inter.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for zigzag scanning and VLC decoding
- * for inter block.
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM_Bitstream.h"
-#include "armCOMM.h"
-#include "armVCM4P2_Huff_Tables_VLC.h"
-#include "armVCM4P2_ZigZag_Tables.h"
-
-
-
-/**
- * Function: omxVCM4P2_DecodeVLCZigzag_Inter (6.2.5.2.3)
- *
- * Description:
- * Performs VLC decoding and inverse zigzag scan for one inter-coded block.
- *
- * Input Arguments:
- *
- * ppBitStream - double pointer to the current byte in the stream buffer
- * pBitOffset - pointer to the next available bit in the current stream
- * byte referenced by *ppBitStream. The parameter *pBitOffset is
- * valid within the range [0-7].
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded such
- * that it points to the current byte in the stream buffer
- * pBitOffset - *pBitOffset is updated after decoding such that it points
- * to the next available bit in the stream byte referenced by
- * *ppBitStream
- * pDst - pointer to the coefficient buffer of current block; must be
- * 4-byte aligned.
- *
- * Return Value:
- *
- * OMX_Sts_BadArgErr - bad arguments:
- * - At least one of the following pointers is NULL:
- * ppBitStream, *ppBitStream, pBitOffset, pDst
- * - pDst is not 4-byte aligned
- * - *pBitOffset exceeds [0,7]
- * OMX_Sts_Err - status error, if:
- * - At least one mark bit is equal to zero
- * - Encountered an illegal stream code that cannot be found in the VLC table
- * - Encountered an illegal code in the VLC FLC table
- * - The number of coefficients is greater than 64
- *
- */
-
-OMXResult omxVCM4P2_DecodeVLCZigzag_Inter(
- const OMX_U8 ** ppBitStream,
- OMX_INT * pBitOffset,
- OMX_S16 * pDst,
- OMX_INT shortVideoHeader
-)
-{
- OMX_U8 last,start = 0;
- const OMX_U8 *pZigzagTable = armVCM4P2_aClassicalZigzagScan;
- OMXResult errorCode;
-
- /* Argument error checks */
- armRetArgErrIf(ppBitStream == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(*ppBitStream == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBitOffset == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs4ByteAligned(pDst), OMX_Sts_BadArgErr);
-
- errorCode = armVCM4P2_GetVLCBits (
- ppBitStream,
- pBitOffset,
- pDst,
- shortVideoHeader,
- start,
- &last,
- 11,
- 42,
- 2,
- 5,
- armVCM4P2_InterL0RunIdx,
- armVCM4P2_InterVlcL0,
- armVCM4P2_InterL1RunIdx,
- armVCM4P2_InterVlcL1,
- armVCM4P2_InterL0LMAX,
- armVCM4P2_InterL1LMAX,
- armVCM4P2_InterL0RMAX,
- armVCM4P2_InterL1RMAX,
- pZigzagTable );
- armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
-
- if (last == 0)
- {
- return OMX_Sts_Err;
- }
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraACVLC.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraACVLC.c
deleted file mode 100644
index 6dddaf0..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraACVLC.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_DecodeVLCZigzag_IntraACVLC.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for zigzag scanning and VLC decoding
- * for intra block.
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-
-
-/**
- * Function: omxVCM4P2_DecodeVLCZigzag_IntraACVLC (6.2.5.2.2)
- *
- * Description:
- * Performs VLC decoding and inverse zigzag scan of AC and DC coefficients
- * for one intra block. Two versions of the function (DCVLC and ACVLC) are
- * provided in order to support the two different methods of processing DC
- * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, Intra DC
- * Coefficient Decoding for the Case of Switched VLC Encoding.
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the
- * bitstream buffer
- * pBitOffset - pointer to the bit position in the current byte referenced
- * by *ppBitStream. The parameter *pBitOffset is valid in the
- * range [0-7]. Bit Position in one byte: |Most Least| *pBitOffset
- * |0 1 2 3 4 5 6 7|
- * predDir - AC prediction direction; used to select the zigzag scan
- * pattern; takes one of the following values: OMX_VC_NONE - AC
- * prediction not used; performs classical zigzag scan.
- * OMX_VC_HORIZONTAL - Horizontal prediction; performs
- * alternate-vertical zigzag scan; OMX_VC_VERTICAL - Vertical
- * prediction; performs alternate-horizontal zigzag scan.
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- * videoComp - video component type (luminance or chrominance) of the
- * current block
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded such
- * that it points to the current byte in the bit stream buffer
- * pBitOffset - *pBitOffset is updated such that it points to the current
- * bit position in the byte pointed by *ppBitStream
- * pDst - pointer to the coefficient buffer of current block; must be
- * 4-byte aligned.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments At least one of the following
- * pointers is NULL: ppBitStream, *ppBitStream, pBitOffset, pDst,
- * or At least one of the following conditions is true:
- * *pBitOffset exceeds [0,7], preDir exceeds [0,2], or pDst is
- * not 4-byte aligned
- * OMX_Sts_Err In DecodeVLCZigzag_IntraDCVLC, dc_size > 12 At least one of
- * mark bits equals zero Illegal stream encountered; code cannot
- * be located in VLC table Forbidden code encountered in the VLC
- * FLC table The number of coefficients is greater than 64
- *
- */
-
-
-OMXResult omxVCM4P2_DecodeVLCZigzag_IntraACVLC(
- const OMX_U8 ** ppBitStream,
- OMX_INT * pBitOffset,
- OMX_S16 * pDst,
- OMX_U8 predDir,
- OMX_INT shortVideoHeader
-)
-{
- OMX_U8 start = 0;
-
- return armVCM4P2_DecodeVLCZigzag_Intra(
- ppBitStream,
- pBitOffset,
- pDst,
- predDir,
- shortVideoHeader,
- start);
-}
-
-/* End of file */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraDCVLC.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraDCVLC.c
deleted file mode 100644
index 9c76ed1..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_DecodeVLCZigzag_IntraDCVLC.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_DecodeVLCZigzag_IntraDCVLC.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for zigzag scanning and VLC decoding
- * for intra block.
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM_Bitstream.h"
-#include "armCOMM.h"
-#include "armVCM4P2_Huff_Tables_VLC.h"
-#include "armVCM4P2_ZigZag_Tables.h"
-
-
-
-
-/**
- * Function: omxVCM4P2_DecodeVLCZigzag_IntraDCVLC (6.2.5.2.2)
- *
- * Description:
- * Performs VLC decoding and inverse zigzag scan of AC and DC coefficients
- * for one intra block. Two versions of the function (DCVLC and ACVLC) are
- * provided in order to support the two different methods of processing DC
- * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, Intra DC
- * Coefficient Decoding for the Case of Switched VLC Encoding.
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the
- * bitstream buffer
- * pBitOffset - pointer to the bit position in the current byte referenced
- * by *ppBitStream. The parameter *pBitOffset is valid in the
- * range [0-7].
- * Bit Position in one byte: |Most Least|
- * *pBitOffset |0 1 2 3 4 5 6 7|
- * predDir - AC prediction direction; used to select the zigzag scan
- * pattern; takes one of the following values:
- * - OMX_VC_NONE - AC prediction not used;
- * performs classical zigzag scan.
- * - OMX_VC_HORIZONTAL - Horizontal prediction;
- * performs alternate-vertical zigzag scan;
- * - OMX_VC_VERTICAL - Vertical prediction;
- * performs alternate-horizontal zigzag scan.
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- * videoComp - video component type (luminance or chrominance) of the
- * current block
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is decoded such
- * that it points to the current byte in the bit stream buffer
- * pBitOffset - *pBitOffset is updated such that it points to the current
- * bit position in the byte pointed by *ppBitStream
- * pDst - pointer to the coefficient buffer of current block; must be
- * 4-byte aligned.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments, if:
- * - At least one of the following pointers is NULL:
- * ppBitStream, *ppBitStream, pBitOffset, pDst
- * - *pBitOffset exceeds [0,7]
- * - preDir exceeds [0,2]
- * - pDst is not 4-byte aligned
- * OMX_Sts_Err - if:
- * - In DecodeVLCZigzag_IntraDCVLC, dc_size > 12
- * - At least one of mark bits equals zero
- * - Illegal stream encountered; code cannot be located in VLC table
- * - Forbidden code encountered in the VLC FLC table.
- * - The number of coefficients is greater than 64
- *
- */
-
-OMXResult omxVCM4P2_DecodeVLCZigzag_IntraDCVLC(
- const OMX_U8 ** ppBitStream,
- OMX_INT * pBitOffset,
- OMX_S16 * pDst,
- OMX_U8 predDir,
- OMX_INT shortVideoHeader,
- OMXVCM4P2VideoComponent videoComp
-)
-{
- /* Dummy initilaization to remove compilation error */
- OMX_S8 DCValueSize = 0;
- OMX_U16 powOfSize, fetchDCbits;
- OMX_U8 start = 1;
-
- /* Argument error checks */
- armRetArgErrIf(ppBitStream == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(*ppBitStream == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBitOffset == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs4ByteAligned(pDst), OMX_Sts_BadArgErr);
- armRetArgErrIf((*pBitOffset < 0) || (*pBitOffset > 7), OMX_Sts_BadArgErr);
- armRetArgErrIf((predDir > 2), OMX_Sts_BadArgErr);
-
- /* Insert the code into the bitstream */
- if (videoComp == OMX_VC_LUMINANCE)
- {
- DCValueSize = armUnPackVLC32(ppBitStream,
- pBitOffset, armVCM4P2_aIntraDCLumaIndex);
- }
- else if (videoComp == OMX_VC_CHROMINANCE)
- {
- DCValueSize = armUnPackVLC32(ppBitStream,
- pBitOffset, armVCM4P2_aIntraDCChromaIndex);
- }
- armRetDataErrIf(DCValueSize == -1, OMX_Sts_Err);
- armRetDataErrIf(DCValueSize > 12, OMX_Sts_Err);
-
-
- if (DCValueSize == 0)
- {
- pDst[0] = 0;
- }
- else
- {
- fetchDCbits = (OMX_U16) armGetBits(ppBitStream, pBitOffset, \
- DCValueSize);
-
- if ( (fetchDCbits >> (DCValueSize - 1)) == 0)
- {
- /* calulate pow */
- powOfSize = (1 << DCValueSize);
-
- pDst[0] = (OMX_S16) (fetchDCbits ^ (powOfSize - 1));
- pDst[0] = -pDst[0];
- }
- else
- {
- pDst[0] = fetchDCbits;
- }
-
- if (DCValueSize > 8)
- {
- /* reading and checking the marker bit*/
- armRetDataErrIf (armGetBits(ppBitStream, pBitOffset, 1) == 0, \
- OMX_Sts_Err);
- }
- }
-
- return armVCM4P2_DecodeVLCZigzag_Intra(
- ppBitStream,
- pBitOffset,
- pDst,
- predDir,
- shortVideoHeader,
- start);
-}
-
-/* End of file */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_EncodeMV.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_EncodeMV.c
deleted file mode 100644
index c04a236..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_EncodeMV.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_EncodeMV.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains module for predicting MV of MB
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armCOMM_Bitstream.h"
-#include "armVCM4P2_Huff_Tables_VLC.h"
-
-
-
-/**
- * Function: omxVCM4P2_EncodeMV (6.2.4.5.4)
- *
- * Description:
- * Predicts a motion vector for the current macroblock, encodes the
- * difference, and writes the output to the stream buffer. The input MVs
- * pMVCurMB, pSrcMVLeftMB, pSrcMVUpperMB, and pSrcMVUpperRightMB should lie
- * within the ranges associated with the input parameter fcodeForward, as
- * described in [ISO14496-2], subclause 7.6.3. This function provides a
- * superset of the functionality associated with the function
- * omxVCM4P2_FindMVpred.
- *
- * Input Arguments:
- *
- * ppBitStream - double pointer to the current byte in the bitstream buffer
- * pBitOffset - index of the first free (next available) bit in the stream
- * buffer referenced by *ppBitStream, valid in the range 0 to 7.
- * pMVCurMB - pointer to the current macroblock motion vector; a value of
- * NULL indicates unavailability.
- * pSrcMVLeftMB - pointer to the source left macroblock motion vector; a
- * value of NULLindicates unavailability.
- * pSrcMVUpperMB - pointer to source upper macroblock motion vector; a
- * value of NULL indicates unavailability.
- * pSrcMVUpperRightMB - pointer to source upper right MB motion vector; a
- * value of NULL indicates unavailability.
- * fcodeForward - an integer with values from 1 to 7; used in encoding
- * motion vectors related to search range, as described in
- * [ISO14496-2], subclause 7.6.3.
- * MBType - macro block type, valid in the range 0 to 5
- *
- * Output Arguments:
- *
- * ppBitStream - updated pointer to the current byte in the bit stream
- * buffer
- * pBitOffset - updated index of the next available bit position in stream
- * buffer referenced by *ppBitStream
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- * - At least one of the following pointers is NULL: ppBitStream,
- * *ppBitStream, pBitOffset, pMVCurMB
- * - *pBitOffset < 0, or *pBitOffset >7.
- * - fcodeForward <= 0, or fcodeForward > 7, or MBType < 0.
- *
- */
-
-OMXResult omxVCM4P2_EncodeMV(
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- const OMXVCMotionVector * pMVCurMB,
- const OMXVCMotionVector * pSrcMVLeftMB,
- const OMXVCMotionVector * pSrcMVUpperMB,
- const OMXVCMotionVector * pSrcMVUpperRightMB,
- OMX_INT fcodeForward,
- OMXVCM4P2MacroblockType MBType
-)
-{
- OMXVCMotionVector dstMVPred, diffMV;
- OMXVCMotionVector dstMVPredME[12];
- /* Initialized to remove compilation warning */
- OMX_INT iBlk, i, count = 1;
- OMX_S32 mvHorResidual, mvVerResidual, mvHorData, mvVerData;
- OMX_U8 scaleFactor, index;
-
- /* Argument error checks */
- armRetArgErrIf(ppBitStream == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(*ppBitStream == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBitOffset == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pMVCurMB == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(((*pBitOffset < 0) || (*pBitOffset > 7)), OMX_Sts_BadArgErr);
- armRetArgErrIf(((fcodeForward < 1) || (fcodeForward > 7)), \
- OMX_Sts_BadArgErr);
-
- if ((MBType == OMX_VC_INTRA) ||
- (MBType == OMX_VC_INTRA_Q)
- )
- {
- /* No candidate vectors hence make them zero */
- for (i = 0; i < 12; i++)
- {
- dstMVPredME[i].dx = 0;
- dstMVPredME[i].dy = 0;
- }
-
- return OMX_Sts_NoErr;
- }
-
- if ((MBType == OMX_VC_INTER4V) || (MBType == OMX_VC_INTER4V_Q))
- {
- count = 4;
- }
- else if ((MBType == OMX_VC_INTER) || (MBType == OMX_VC_INTER_Q))
- {
- count = 1;
- }
-
- /* Calculating the scale factor */
- scaleFactor = 1 << (fcodeForward -1);
-
- for (iBlk = 0; iBlk < count; iBlk++)
- {
-
- /* Find the predicted vector */
- omxVCM4P2_FindMVpred (
- pMVCurMB,
- pSrcMVLeftMB,
- pSrcMVUpperMB,
- pSrcMVUpperRightMB,
- &dstMVPred,
- dstMVPredME,
- iBlk );
-
- /* Calculating the differential motion vector (diffMV) */
- diffMV.dx = pMVCurMB[iBlk].dx - dstMVPred.dx;
- diffMV.dy = pMVCurMB[iBlk].dy - dstMVPred.dy;
-
- /* Calculating the mv_data and mv_residual for Horizantal MV */
- if (diffMV.dx == 0)
- {
- mvHorResidual = 0;
- mvHorData = 0;
- }
- else
- {
- mvHorResidual = ( armAbs(diffMV.dx) - 1) % scaleFactor;
- mvHorData = (armAbs(diffMV.dx) - mvHorResidual + (scaleFactor - 1))
- / scaleFactor;
- if (diffMV.dx < 0)
- {
- mvHorData = -mvHorData;
- }
- }
-
- /* Calculating the mv_data and mv_residual for Vertical MV */
- if (diffMV.dy == 0)
- {
- mvVerResidual = 0;
- mvVerData = 0;
- }
- else
- {
- mvVerResidual = ( armAbs(diffMV.dy) - 1) % scaleFactor;
- mvVerData = (armAbs(diffMV.dy) - mvVerResidual + (scaleFactor - 1))
- / scaleFactor;
- if (diffMV.dy < 0)
- {
- mvVerData = -mvVerData;
- }
- }
-
- /* Huffman encoding */
-
- /* The index is actually calculate as
- index = ((float) (mvHorData/2) + 16) * 2,
- meaning the MV data is halfed and then normalized
- to begin with zero and then doubled to take care of indexing
- the fractional part included */
- index = mvHorData + 32;
- armPackVLC32 (ppBitStream, pBitOffset, armVCM4P2_aVlcMVD[index]);
- if ((fcodeForward > 1) && (diffMV.dx != 0))
- {
- armPackBits (ppBitStream, pBitOffset, mvHorResidual, (fcodeForward -1));
- }
-
- /* The index is actually calculate as
- index = ((float) (mvVerData/2) + 16) * 2,
- meaning the MV data is halfed and then normalized
- to begin with zero and then doubled to take care of indexing
- the fractional part included */
- index = mvVerData + 32;
- armPackVLC32 (ppBitStream, pBitOffset, armVCM4P2_aVlcMVD[index]);
- if ((fcodeForward > 1) && (diffMV.dy != 0))
- {
- armPackBits (ppBitStream, pBitOffset, mvVerResidual, (fcodeForward -1));
- }
- }
-
- return OMX_Sts_NoErr;
-}
-
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_EncodeVLCZigzag_Inter.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_EncodeVLCZigzag_Inter.c
deleted file mode 100644
index 2158f88..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_EncodeVLCZigzag_Inter.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_EncodeVLCZigzag_Inter.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for zigzag scanning and VLC encoding
- * for inter block.
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM_Bitstream.h"
-#include "armCOMM.h"
-#include "armVCM4P2_Huff_Tables_VLC.h"
-#include "armVCM4P2_ZigZag_Tables.h"
-
-
-
-/**
- * Function: omxVCM4P2_EncodeVLCZigzag_Inter (6.2.4.5.3)
- *
- * Description:
- * Performs classical zigzag scanning and VLC encoding for one inter block.
- *
- * Input Arguments:
- *
- * ppBitStream - pointer to the pointer to the current byte in the bit
- * stream
- * pBitOffset - pointer to the bit position in the byte pointed by
- * *ppBitStream. Valid within 0 to 7
- * pQDctBlkCoef - pointer to the quantized DCT coefficient
- * pattern - block pattern which is used to decide whether this block is
- * encoded
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is encoded so that
- * it points to the current byte in the bit stream buffer.
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - Bad arguments
- * - At least one of the pointers: is NULL: ppBitStream, *ppBitStream,
- * pBitOffset, pQDctBlkCoef
- * - *pBitOffset < 0, or *pBitOffset >7.
- *
- */
-OMXResult omxVCM4P2_EncodeVLCZigzag_Inter(
- OMX_U8 **ppBitStream,
- OMX_INT * pBitOffset,
- const OMX_S16 *pQDctBlkCoef,
- OMX_U8 pattern,
- OMX_INT shortVideoHeader
-)
-{
- OMX_U8 start = 0;
- const OMX_U8 *pZigzagTable = armVCM4P2_aClassicalZigzagScan;
-
- /* Argument error checks */
- armRetArgErrIf(ppBitStream == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(*ppBitStream == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBitOffset == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pQDctBlkCoef == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf((*pBitOffset < 0) || (*pBitOffset >7), OMX_Sts_BadArgErr);
-
- if (pattern)
- {
- armVCM4P2_PutVLCBits (
- ppBitStream,
- pBitOffset,
- pQDctBlkCoef,
- shortVideoHeader,
- start,
- 26,
- 40,
- 10,
- 1,
- armVCM4P2_InterL0RunIdx,
- armVCM4P2_InterVlcL0,
- armVCM4P2_InterL1RunIdx,
- armVCM4P2_InterVlcL1,
- armVCM4P2_InterL0LMAX,
- armVCM4P2_InterL1LMAX,
- armVCM4P2_InterL0RMAX,
- armVCM4P2_InterL1RMAX,
- pZigzagTable
- );
- } /* Pattern check ends*/
-
- return OMX_Sts_NoErr;
-
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_EncodeVLCZigzag_IntraACVLC.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_EncodeVLCZigzag_IntraACVLC.c
deleted file mode 100644
index 63b6d97..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_EncodeVLCZigzag_IntraACVLC.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_EncodeVLCZigzag_IntraACVLC.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for zigzag scanning and VLC encoding
- * for intra block.
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-
-
-/**
- * Function: omxVCM4P2_EncodeVLCZigzag_IntraACVLC (6.2.4.5.2)
- *
- * Description:
- * Performs zigzag scan and VLC encoding of AC and DC coefficients for one
- * intra block. Two versions of the function (DCVLC and ACVLC) are provided
- * in order to support the two different methods of processing DC
- * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, Intra DC
- * Coefficient Decoding for the Case of Switched VLC Encoding.
- *
- * Input Arguments:
- *
- * ppBitStream - double pointer to the current byte in the bitstream
- * pBitOffset - pointer to the bit position in the byte pointed by
- * *ppBitStream. Valid within 0 to 7.
- * pQDctBlkCoef - pointer to the quantized DCT coefficient
- * predDir - AC prediction direction, which is used to decide the zigzag
- * scan pattern; takes one of the following values:
- * - OMX_VC_NONE - AC prediction not used.
- * Performs classical zigzag scan.
- * - OMX_VC_HORIZONTAL - Horizontal prediction.
- * Performs alternate-vertical zigzag scan.
- * - OMX_VC_VERTICAL - Vertical prediction.
- * Performs alternate-horizontal zigzag scan.
- * pattern - block pattern which is used to decide whether this block is
- * encoded
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is encoded, so
- * that it points to the current byte in the bit stream buffer.
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - Bad arguments:
- * - At least one of the following pointers is NULL: ppBitStream,
- * *ppBitStream, pBitOffset, pQDctBlkCoef.
- * - *pBitOffset < 0, or *pBitOffset >7.
- * - PredDir is not one of: OMX_VC_NONE, OMX_VC_HORIZONTAL, or
- * OMX_VC_VERTICAL.
- * - VideoComp is not one component of enum OMXVCM4P2VideoComponent.
- *
- */
-
-OMXResult omxVCM4P2_EncodeVLCZigzag_IntraACVLC(
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- const OMX_S16 *pQDctBlkCoef,
- OMX_U8 predDir,
- OMX_U8 pattern,
- OMX_INT shortVideoHeader
-)
-{
- OMX_U8 start = 0;
-
- return armVCM4P2_EncodeVLCZigzag_Intra(
- ppBitStream,
- pBitOffset,
- pQDctBlkCoef,
- predDir,
- pattern,
- shortVideoHeader,
- start);
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_EncodeVLCZigzag_IntraDCVLC.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_EncodeVLCZigzag_IntraDCVLC.c
deleted file mode 100644
index 7bdda19..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_EncodeVLCZigzag_IntraDCVLC.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_EncodeVLCZigzag_IntraDCVLC.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for zigzag scanning and VLC encoding
- * for intra block.
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM_Bitstream.h"
-#include "armCOMM.h"
-#include "armVCM4P2_Huff_Tables_VLC.h"
-#include "armVCM4P2_ZigZag_Tables.h"
-
-
-
-/**
- * Function: omxVCM4P2_EncodeVLCZigzag_IntraDCVLC (6.2.4.5.2)
- *
- * Description:
- * Performs zigzag scan and VLC encoding of AC and DC coefficients for one
- * intra block. Two versions of the function (DCVLC and ACVLC) are provided
- * in order to support the two different methods of processing DC
- * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, "Intra DC
- * Coefficient Decoding for the Case of Switched VLC Encoding".
- *
- * Input Arguments:
- *
- * ppBitStream - double pointer to the current byte in the bitstream
- * pBitOffset - pointer to the bit position in the byte pointed by
- * *ppBitStream. Valid within 0 to 7.
- * pQDctBlkCoef - pointer to the quantized DCT coefficient
- * predDir - AC prediction direction, which is used to decide the zigzag
- * scan pattern; takes one of the following values:
- * - OMX_VC_NONE - AC prediction not used.
- * Performs classical zigzag scan.
- * - OMX_VC_HORIZONTAL - Horizontal prediction.
- * Performs alternate-vertical zigzag scan.
- * - OMX_VC_VERTICAL - Vertical prediction.
- * Performs alternate-horizontal zigzag scan.
- * pattern - block pattern which is used to decide whether this block is
- * encoded
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; escape modes 0-3 are used if
- * shortVideoHeader==0, and escape mode 4 is used when
- * shortVideoHeader==1.
- * videoComp - video component type (luminance, chrominance) of the current
- * block
- *
- * Output Arguments:
- *
- * ppBitStream - *ppBitStream is updated after the block is encoded, so
- * that it points to the current byte in the bit stream buffer.
- * pBitOffset - *pBitOffset is updated so that it points to the current bit
- * position in the byte pointed by *ppBitStream.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - Bad arguments:
- * - At least one of the following pointers is NULL: ppBitStream,
- * *ppBitStream, pBitOffset, pQDctBlkCoef.
- * - *pBitOffset < 0, or *pBitOffset >7.
- * - PredDir is not one of: OMX_VC_NONE, OMX_VC_HORIZONTAL, or
- * OMX_VC_VERTICAL.
- * - VideoComp is not one component of enum OMXVCM4P2VideoComponent.
- *
- */
-
-OMXResult omxVCM4P2_EncodeVLCZigzag_IntraDCVLC(
- OMX_U8 **ppBitStream,
- OMX_INT *pBitOffset,
- const OMX_S16 *pQDctBlkCoef,
- OMX_U8 predDir,
- OMX_U8 pattern,
- OMX_INT shortVideoHeader,
- OMXVCM4P2VideoComponent videoComp
-)
-{
- OMX_S16 dcValue, powOfSize;
- OMX_U8 DCValueSize, start = 1;
- OMX_U16 absDCValue;
-
- /* Argument error checks */
- armRetArgErrIf(ppBitStream == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(*ppBitStream == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pBitOffset == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pQDctBlkCoef == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf((*pBitOffset < 0) || (*pBitOffset >7), OMX_Sts_BadArgErr);
- armRetArgErrIf((videoComp != OMX_VC_LUMINANCE) && (videoComp != OMX_VC_CHROMINANCE), OMX_Sts_BadArgErr);
- armRetArgErrIf((predDir != OMX_VC_NONE) && (predDir != OMX_VC_HORIZONTAL) && (predDir != OMX_VC_VERTICAL) , OMX_Sts_BadArgErr);
-
- if (pattern)
- {
- dcValue = pQDctBlkCoef[0];
- absDCValue = armAbs(dcValue);
-
- /* Find the size */
- DCValueSize = armLogSize (absDCValue);
- absDCValue = armAbs(dcValue);
-
- /* Insert the code into the bitstream */
- if (videoComp == OMX_VC_LUMINANCE)
- {
-
- armPackVLC32 (ppBitStream, pBitOffset,
- armVCM4P2_aIntraDCLumaIndex[DCValueSize]);
- }
- else if (videoComp == OMX_VC_CHROMINANCE)
- {
-
- armPackVLC32 (ppBitStream, pBitOffset,
- armVCM4P2_aIntraDCChromaIndex[DCValueSize]);
- }
-
- /* Additional code generation in case of negative
- dc value the additional */
- if (DCValueSize > 0)
- {
- if (dcValue < 0)
- {
- /* calulate 2 pow */
- powOfSize = (1 << DCValueSize);
-
- absDCValue = absDCValue ^ (powOfSize - 1);
- }
- armPackBits(ppBitStream, pBitOffset, (OMX_U32)absDCValue, \
- DCValueSize);
-
- if (DCValueSize > 8)
- {
- armPackBits(ppBitStream, pBitOffset, 1, 1);
- }
- }
- }
-
- return armVCM4P2_EncodeVLCZigzag_Intra(
- ppBitStream,
- pBitOffset,
- pQDctBlkCoef,
- predDir,
- pattern,
- shortVideoHeader,
- start);
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_FindMVpred.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_FindMVpred.c
deleted file mode 100644
index 054b486..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_FindMVpred.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_FindMVpred.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains module for predicting MV of MB
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-
-/**
- * Function: omxVCM4P2_FindMVpred (6.2.3.1.1)
- *
- * Description:
- * Predicts a motion vector for the current block using the procedure
- * specified in [ISO14496-2], subclause 7.6.5. The resulting predicted MV is
- * returned in pDstMVPred. If the parameter pDstMVPredME if is not NULL then
- * the set of three MV candidates used for prediction is also returned,
- * otherwise pDstMVPredMEis NULL upon return.
- *
- * Input Arguments:
- *
- * pSrcMVCurMB - pointer to the MV buffer associated with the current Y
- * macroblock; a value of NULL indicates unavailability.
- * pSrcCandMV1 - pointer to the MV buffer containing the 4 MVs associated
- * with the MB located to the left of the current MB; set to NULL
- * if there is no MB to the left.
- * pSrcCandMV2 - pointer to the MV buffer containing the 4 MVs associated
- * with the MB located above the current MB; set to NULL if there
- * is no MB located above the current MB.
- * pSrcCandMV3 - pointer to the MV buffer containing the 4 MVs associated
- * with the MB located to the right and above the current MB; set
- * to NULL if there is no MB located to the above-right.
- * iBlk - the index of block in the current macroblock
- * pDstMVPredME - MV candidate return buffer; if set to NULL then
- * prediction candidate MVs are not returned and pDstMVPredME will
- * be NULL upon function return; if pDstMVPredME is non-NULL then it
- * must point to a buffer containing sufficient space for three
- * return MVs.
- *
- * Output Arguments:
- *
- * pDstMVPred - pointer to the predicted motion vector
- * pDstMVPredME - if non-NULL upon input then pDstMVPredME points upon
- * return to a buffer containing the three motion vector candidates
- * used for prediction as specified in [ISO14496-2], subclause
- * 7.6.5, otherwise if NULL upon input then pDstMVPredME is NULL
- * upon output.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - the pointer pDstMVPred is NULL
- * - the parameter iBlk does not fall into the range 0 <= iBlk<=3
- *
- */
-
-OMXResult omxVCM4P2_FindMVpred(
- const OMXVCMotionVector* pSrcMVCurMB,
- const OMXVCMotionVector* pSrcCandMV1,
- const OMXVCMotionVector* pSrcCandMV2,
- const OMXVCMotionVector* pSrcCandMV3,
- OMXVCMotionVector* pDstMVPred,
- OMXVCMotionVector* pDstMVPredME,
- OMX_INT iBlk
- )
-{
- OMXVCMotionVector CandMV;
- const OMXVCMotionVector *pCandMV1;
- const OMXVCMotionVector *pCandMV2;
- const OMXVCMotionVector *pCandMV3;
-
- /* Argument error checks */
- armRetArgErrIf(iBlk!=0 && pSrcMVCurMB == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDstMVPred == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf((iBlk < 0) || (iBlk > 3), OMX_Sts_BadArgErr);
-
- CandMV.dx = CandMV.dy = 0;
- /* Based on the position of the block extract the motion vectors and
- the tranperancy status */
-
-
- /* Set the default value for these to be used if pSrcCandMV[1|2|3] == NULL */
- pCandMV1 = pCandMV2 = pCandMV3 = &CandMV;
-
-
- switch (iBlk)
- {
- case 0:
- {
- if(pSrcCandMV1 != NULL)
- {
- pCandMV1 = &pSrcCandMV1[1];
- }
- if(pSrcCandMV2 != NULL)
- {
- pCandMV2 = &pSrcCandMV2[2];
- }
- if(pSrcCandMV3 != NULL)
- {
- pCandMV3 = &pSrcCandMV3[2];
- }
- if ((pSrcCandMV1 == NULL) && (pSrcCandMV2 == NULL))
- {
- pCandMV1 = pCandMV2 = pCandMV3;
- }
- else if((pSrcCandMV1 == NULL) && (pSrcCandMV3 == NULL))
- {
- pCandMV1 = pCandMV3 = pCandMV2;
- }
- else if((pSrcCandMV2 == NULL) && (pSrcCandMV3 == NULL))
- {
- pCandMV2 = pCandMV3 = pCandMV1;
- }
- break;
- }
- case 1:
- {
- pCandMV1 = &pSrcMVCurMB[0];
- if(pSrcCandMV2 != NULL)
- {
- pCandMV2 = &pSrcCandMV2[3];
- }
- if(pSrcCandMV3 != NULL)
- {
- pCandMV3 = &pSrcCandMV3[2];
- }
- if((pSrcCandMV2 == NULL) && (pSrcCandMV3 == NULL))
- {
- pCandMV2 = pCandMV3 = pCandMV1;
- }
- break;
- }
- case 2:
- {
- if(pSrcCandMV1 != NULL)
- {
- pCandMV1 = &pSrcCandMV1[3];
- }
- pCandMV2 = &pSrcMVCurMB[0];
- pCandMV3 = &pSrcMVCurMB[1];
- break;
- }
- case 3:
- {
- pCandMV1 = &pSrcMVCurMB[2];
- pCandMV2 = &pSrcMVCurMB[0];
- pCandMV3 = &pSrcMVCurMB[1];
- break;
- }
- }
-
- /* Find the median of the 3 candidate MV's */
- pDstMVPred->dx = armMedianOf3 (pCandMV1->dx, pCandMV2->dx, pCandMV3->dx);
- pDstMVPred->dy = armMedianOf3 (pCandMV1->dy, pCandMV2->dy, pCandMV3->dy);
-
- if (pDstMVPredME != NULL)
- {
- /* Store the candidate MV's into the pDstMVPredME, these can be used
- in the fast algorithm if implemented */
- pDstMVPredME[0].dx = pCandMV1->dx;
- pDstMVPredME[0].dy = pCandMV1->dy;
- pDstMVPredME[1].dx = pCandMV2->dx;
- pDstMVPredME[1].dy = pCandMV2->dy;
- pDstMVPredME[2].dx = pCandMV3->dx;
- pDstMVPredME[2].dy = pCandMV3->dy;
- }
-
- return OMX_Sts_NoErr;
-}
-
-
-/* End of file */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_IDCT8x8blk.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_IDCT8x8blk.c
deleted file mode 100644
index c512458..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_IDCT8x8blk.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_IDCT8x8blk.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for 8x8 block IDCT
- *
- */
-
-
-#include <math.h>
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVCM4P2_DCT_Table.h"
-
-/**
- * Function: omxVCM4P2_IDCT8x8blk (6.2.3.2.1)
- *
- * Description:
- * Computes a 2D inverse DCT for a single 8x8 block, as defined in
- * [ISO14496-2].
- *
- * Input Arguments:
- *
- * pSrc - pointer to the start of the linearly arranged IDCT input buffer;
- * must be aligned on a 16-byte boundary. According to
- * [ISO14496-2], the input coefficient values should lie within the
- * range [-2048, 2047].
- *
- * Output Arguments:
- *
- * pDst - pointer to the start of the linearly arranged IDCT output buffer;
- * must be aligned on a 16-byte boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - pSrc or pDst is NULL.
- * - pSrc or pDst is not 16-byte aligned.
- *
- */
-OMXResult omxVCM4P2_IDCT8x8blk (const OMX_S16 *pSrc, OMX_S16 *pDst)
-{
- OMX_INT x, y, u, v;
-
- /* Argument error checks */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs16ByteAligned(pSrc), OMX_Sts_BadArgErr);
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs16ByteAligned(pDst), OMX_Sts_BadArgErr);
-
- for (x = 0; x < 8; x++)
- {
- for (y = 0; y < 8; y++)
- {
- OMX_F64 sum = 0.0;
- for (u = 0; u < 8; u++)
- {
- for (v = 0; v < 8; v++)
- {
- sum += pSrc[(u * 8) + v] *
- armVCM4P2_preCalcDCTCos[x][u] *
- armVCM4P2_preCalcDCTCos[y][v];
- }
- }
- pDst[(x * 8) + y] = (OMX_S16) floor(sum + 0.5);
-
- /* Saturate to [-256, 255] */
- pDst[(x * 8) + y] = armClip (
- -256,
- 255,
- pDst[(x * 8) + y]);
- }
- }
-
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_MCReconBlock.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_MCReconBlock.c
deleted file mode 100644
index 33f0cf5..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_MCReconBlock.c
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_MCReconBlock.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- * Description:
- * MPEG4 motion compensation prediction for an 8x8 block using
- * interpolation
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-
-/**
- * Function: armVCM4P2_HalfPelVer
- *
- * Description:
- * Performs half pel motion compensation for an 8x8 block using vertical
- * interpolation described in ISO/IEC 14496-2, subclause 7.6.2.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrc pointer to the block in the reference plane.
- * [in] srcStep distance between the start of consecutive lines
- * in the reference plane, in bytes; must be a multiple
- * of 8.
- * [in] rndVal rounding control parameter: 0 - disabled; 1 - enabled.
- * [out] pDst pointer to the linaer 8x8 destination buffer;
- *
- */
-static OMXVoid armVCM4P2_HalfPelVer(
- const OMX_U8 *pSrc,
- OMX_INT srcStep,
- OMX_U8 *pDst,
- OMX_INT rndVal)
-{
- const OMX_U8 *pTempSrc1;
- const OMX_U8 *pTempSrc2;
- OMX_INT y, x;
-
- pTempSrc1 = pSrc;
- pTempSrc2 = pSrc + srcStep;
- srcStep -= 8;
- for (y = 0; y < 8; y++)
- {
- for (x = 0; x < 8; x++)
- {
- *pDst++ = ((*pTempSrc1++ + *pTempSrc2++) + 1 - rndVal) >> 1;
- }
- pTempSrc1 += srcStep;
- pTempSrc2 += srcStep;
- }
-}
-
-/**
- * Function: armVCM4P2_HalfPelHor
- *
- * Description:
- * Performs half pel motion compensation for an 8x8 block using horizontal
- * interpolation described in ISO/IEC 14496-2, subclause 7.6.2.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrc pointer to the block in the reference plane.
- * [in] srcStep distance between the start of consecutive lines
- * in the reference plane, in bytes; must be a multiple
- * of 8.
- * [in] rndVal rounding control parameter: 0 - disabled; 1 - enabled.
- * [out] pDst pointer to the linaer 8x8 destination buffer;
- *
- */
-static OMXVoid armVCM4P2_HalfPelHor(
- const OMX_U8 *pSrc,
- OMX_INT srcStep,
- OMX_U8 *pDst,
- OMX_INT rndVal)
-{
- const OMX_U8 *pTempSrc1;
- const OMX_U8 *pTempSrc2;
- OMX_INT y, x;
-
- pTempSrc1 = pSrc;
- pTempSrc2 = pTempSrc1 + 1;
-
- srcStep -= 8;
- for (y=0; y<8; y++)
- {
- for (x=0; x<8; x++)
- {
- *pDst++ = ((*pTempSrc1++ + *pTempSrc2++) + 1 - rndVal) >> 1;
- }
- pTempSrc1 += srcStep;
- pTempSrc2 += srcStep;
- }
-}
-
-
-/**
- * Function: armVCM4P2_HalfPelVerHor
- *
- * Description:
- * Performs half pel motion compensation for an 8x8 block using both
- * horizontal and vertical interpolation described in ISO/IEC 14496-2,
- * subclause 7.6.2.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrc pointer to the block in the reference plane.
- * [in] srcStep distance between the start of consecutive lines
- * in the reference plane, in bytes; must be a multiple
- * of 8.
- * [in] rndVal rounding control parameter: 0 - disabled; 1 - enabled.
- * [out] pDst pointer to the linaer 8x8 destination buffer;
- *
- */
-static OMXVoid armVCM4P2_HalfPelVerHor(
- const OMX_U8 *pSrc,
- OMX_INT srcStep,
- OMX_U8 *pDst,
- OMX_INT rndVal)
-{
- const OMX_U8 *pTempSrc1;
- const OMX_U8 *pTempSrc2;
- const OMX_U8 *pTempSrc3;
- const OMX_U8 *pTempSrc4;
- OMX_INT y, x;
-
- pTempSrc1 = pSrc;
- pTempSrc2 = pSrc + srcStep;
- pTempSrc3 = pSrc + 1;
- pTempSrc4 = pSrc + srcStep + 1;
-
- srcStep -= 8;
- for (y=0; y<8; y++)
- {
- for (x=0; x<8; x++)
- {
- *pDst++ = ((*pTempSrc1++ + *pTempSrc2++ + *pTempSrc3++ + *pTempSrc4++) +
- 2 - rndVal) >> 2;
- }
- pTempSrc1 += srcStep;
- pTempSrc2 += srcStep;
- pTempSrc3 += srcStep;
- pTempSrc4 += srcStep;
- }
-}
-
-/**
- * Function: armVCM4P2_MCReconBlock_NoRes
- *
- * Description:
- * Do motion compensation and copy the result to the current block.
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrc pointer to the block in the reference plane.
- * [in] srcStep distance between the start of consecutive lines
- * in the reference plane, in bytes; must be a multiple
- * of 8.
- * [in] dstStep distance between the start of consecutive lines in the
- * destination plane, in bytes; must be a multiple of 8.
- * [in] predictType bilinear interpolation type, as defined in section 6.2.1.2.
- * [in] rndVal rounding control parameter: 0 - disabled; 1 - enabled.
- * [out] pDst pointer to the destination buffer; must be 8-byte aligned.
- * If prediction residuals are added then output intensities
- * are clipped to the range [0,255].
- *
- */
-static OMXVoid armVCM4P2_MCReconBlock_NoRes(
- const OMX_U8 *pSrc,
- OMX_INT srcStep,
- OMX_U8 *pDst,
- OMX_INT dstStep)
-{
- OMX_U8 x,y,count,index;
-
- /* Copying the ref 8x8 blk to the curr blk */
- for (y = 0, count = 0, index = 0; y < 8; y++,index += (srcStep -8), count += (dstStep - 8))
- {
- for (x = 0; x < 8; x++, count++,index++)
- {
- pDst[count] = pSrc[index];
- }
- }
-}
-
-/**
- * Function: armVCM4P2_MCReconBlock_Res
- *
- * Description:
- * Reconstructs INTER block by summing the motion compensation results
- * and the results of the inverse transformation (prediction residuals).
- * Output intensities are clipped to the range [0,255].
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrc pointer to the block in the reference plane.
- * [in] pSrcResidue pointer to a buffer containing the 16-bit prediction
- * residuals. If the pointer is NULL,then no prediction
- * is done, only motion compensation, i.e., the block is
- * moved with interpolation.
- * [in] dstStep distance between the start of consecutive lines in the
- * destination plane, in bytes; must be a multiple of 8.
- * [out] pDst pointer to the destination buffer; must be 8-byte aligned.
- * If prediction residuals are added then output intensities
- * are clipped to the range [0,255].
- *
- */
-static OMXVoid armVCM4P2_MCReconBlock_Res(
- const OMX_U8 *pSrc,
- const OMX_S16 *pSrcResidue,
- OMX_U8 *pDst,
- OMX_INT dstStep)
-{
-
- OMX_U8 x,y;
- OMX_INT temp;
-
- for(y = 0; y < 8; y++)
- {
- for(x = 0; x < 8; x++)
- {
- temp = pSrc[x] + pSrcResidue[x];
- pDst[x] = armClip(0,255,temp);
- }
- pDst += dstStep;
- pSrc += 8;
- pSrcResidue += 8;
- }
-}
-
-/**
- * Function: omxVCM4P2_MCReconBlock (6.2.5.5.1)
- *
- * Description:
- * Performs motion compensation prediction for an 8x8 block using
- * interpolation described in [ISO14496-2], subclause 7.6.2.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the block in the reference plane.
- * srcStep - distance between the start of consecutive lines in the
- * reference plane, in bytes; must be a multiple of 8.
- * dstStep - distance between the start of consecutive lines in the
- * destination plane, in bytes; must be a multiple of 8.
- * pSrcResidue - pointer to a buffer containing the 16-bit prediction
- * residuals; must be 16-byte aligned. If the pointer is NULL, then
- * no prediction is done, only motion compensation, i.e., the block
- * is moved with interpolation.
- * predictType - bilinear interpolation type, as defined in section
- * 6.2.1.2.
- * rndVal - rounding control parameter: 0 - disabled; 1 - enabled.
- *
- * Output Arguments:
- *
- * pDst - pointer to the destination buffer; must be 8-byte aligned. If
- * prediction residuals are added then output intensities are
- * clipped to the range [0,255].
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; returned under any of the following
- * conditions:
- * - pDst is not 8-byte aligned.
- * - pSrcResidue is not 16-byte aligned.
- * - one or more of the following pointers is NULL: pSrc or pDst.
- * - either srcStep or dstStep is not a multiple of 8.
- * - invalid type specified for the parameter predictType.
- * - the parameter rndVal is not equal either to 0 or 1.
- *
- */
-OMXResult omxVCM4P2_MCReconBlock(
- const OMX_U8 *pSrc,
- OMX_INT srcStep,
- const OMX_S16 *pSrcResidue,
- OMX_U8 *pDst,
- OMX_INT dstStep,
- OMX_INT predictType,
- OMX_INT rndVal)
-{
- /* Definitions and Initializations*/
- OMX_U8 pTempDst[64];
-
- /* Argument error checks */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs8ByteAligned(pDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs16ByteAligned(pSrcResidue), OMX_Sts_BadArgErr);
- armRetArgErrIf(((dstStep % 8) || (srcStep % 8)), OMX_Sts_BadArgErr);
- armRetArgErrIf(((predictType != OMX_VC_INTEGER_PIXEL) &&
- (predictType != OMX_VC_HALF_PIXEL_X) &&
- (predictType != OMX_VC_HALF_PIXEL_Y) &&
- (predictType != OMX_VC_HALF_PIXEL_XY)
- ),OMX_Sts_BadArgErr);
- armRetArgErrIf(((rndVal != 0) && (rndVal != 1)),OMX_Sts_BadArgErr);
-
- switch(predictType)
- {
- case OMX_VC_INTEGER_PIXEL:
- armVCM4P2_MCReconBlock_NoRes(pSrc,
- srcStep,
- &(pTempDst[0]),
- 8);
- break;
- case OMX_VC_HALF_PIXEL_X:
- armVCM4P2_HalfPelHor(pSrc,
- srcStep,
- &(pTempDst[0]),
- rndVal);
- break;
- case OMX_VC_HALF_PIXEL_Y:
- armVCM4P2_HalfPelVer(pSrc,
- srcStep,
- &(pTempDst[0]),
- rndVal);
- break;
- case OMX_VC_HALF_PIXEL_XY:
- armVCM4P2_HalfPelVerHor(pSrc,
- srcStep,
- &(pTempDst[0]),
- rndVal);
- break;
- }
-
- if(pSrcResidue == NULL)
- {
- armVCM4P2_MCReconBlock_NoRes(&(pTempDst[0]),
- 8,
- pDst,
- dstStep);
- }
- else
- {
- armVCM4P2_MCReconBlock_Res(&(pTempDst[0]),
- pSrcResidue,
- pDst,
- dstStep);
- }
-
- return OMX_Sts_NoErr;
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_MEGetBufSize.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_MEGetBufSize.c
deleted file mode 100644
index dda852e..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_MEGetBufSize.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_MEGetBufSize.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Initialization modules for the vendor specific Motion Estimation structure.
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: omxVCM4P2_MEGetBufSize (6.2.4.1.1)
- *
- * Description:
- * Computes the size, in bytes, of the vendor-specific specification
- * structure for the following motion estimation functions:
- * BlockMatch_Integer_8x8, BlockMatch_Integer_16x16, and MotionEstimationMB.
- *
- * Input Arguments:
- *
- * MEmode - motion estimation mode; available modes are defined by the
- * enumerated type OMXVCM4P2MEMode
- * pMEParams - motion estimation parameters
- *
- * Output Arguments:
- *
- * pSize - pointer to the number of bytes required for the specification
- * structure
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - one or more of the following is true:
- * - an invalid value was specified for the parameter MEmode
- * - a negative or zero value was specified for the
- * parameter pMEParams->searchRange
- *
- */
-
-OMXResult omxVCM4P2_MEGetBufSize(
- OMXVCM4P2MEMode MEMode,
- const OMXVCM4P2MEParams *pMEParams,
- OMX_U32 *pSize
- )
-{
- armRetArgErrIf(!pMEParams, OMX_Sts_BadArgErr);
- armRetArgErrIf(!pSize, OMX_Sts_BadArgErr);
- armRetArgErrIf(pMEParams->searchRange <= 0, OMX_Sts_BadArgErr);
- armRetArgErrIf((MEMode != OMX_VC_M4P10_FAST_SEARCH) &&
- (MEMode != OMX_VC_M4P10_FULL_SEARCH), OMX_Sts_BadArgErr);
-
- *pSize = (OMX_INT) sizeof(ARMVCM4P2_MESpec);
-
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_MEInit.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_MEInit.c
deleted file mode 100644
index 59c57c2..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_MEInit.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_MEInit.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Initialization modules for the vendor specific Motion Estimation structure.
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: omxVCM4P2_MEInit (6.2.4.1.2)
- *
- * Description:
- * Initializes the vendor-specific specification structure required for the
- * following motion estimation functions: BlockMatch_Integer_8x8,
- * BlockMatch_Integer_16x16, and MotionEstimationMB. Memory for the
- * specification structure *pMESpec must be allocated prior to calling the
- * function, and should be aligned on a 4-byte boundary. Following
- * initialization by this function, the vendor-specific structure *pMESpec
- * should contain an implementation-specific representation of all motion
- * estimation parameters received via the structure pMEParams, for example
- * rndVal, searchRange, etc. The number of bytes required for the
- * specification structure can be determined using the function
- * omxVCM4P2_MEGetBufSize.
- *
- * Input Arguments:
- *
- * MEmode - motion estimation mode; available modes are defined by the
- * enumerated type OMXVCM4P2MEMode
- * pMEParams - motion estimation parameters
- * pMESpec - pointer to the uninitialized ME specification structure
- *
- * Output Arguments:
- *
- * pMESpec - pointer to the initialized ME specification structure
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - one or more of the following is true:
- * - an invalid value was specified for the parameter MEmode
- * - a negative or zero value was specified for the
- * parameter pMEParams->searchRange
- *
- */
-
-OMXResult omxVCM4P2_MEInit(
- OMXVCM4P2MEMode MEMode,
- const OMXVCM4P2MEParams *pMEParams,
- void *pMESpec
- )
-{
- ARMVCM4P2_MESpec *armMESpec = (ARMVCM4P2_MESpec *) pMESpec;
-
- armRetArgErrIf(!pMEParams, OMX_Sts_BadArgErr);
- armRetArgErrIf(!pMESpec, OMX_Sts_BadArgErr);
- armRetArgErrIf((MEMode != OMX_VC_M4P2_FAST_SEARCH) &&
- (MEMode != OMX_VC_M4P2_FULL_SEARCH), OMX_Sts_BadArgErr);
- armRetArgErrIf(pMEParams->searchRange <= 0, OMX_Sts_BadArgErr);
-
- armMESpec->MEParams.searchEnable8x8 = pMEParams->searchEnable8x8;
- armMESpec->MEParams.halfPelSearchEnable = pMEParams->halfPelSearchEnable;
- armMESpec->MEParams.searchRange = pMEParams->searchRange;
- armMESpec->MEParams.rndVal = pMEParams->rndVal;
- armMESpec->MEMode = MEMode;
-
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_MotionEstimationMB.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_MotionEstimationMB.c
deleted file mode 100644
index f9bb297..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_MotionEstimationMB.c
+++ /dev/null
@@ -1,645 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_MotionEstimationMB.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains module for motion search 16x16 macroblock
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armVC.h"
-#include "armCOMM.h"
-
-/**
- * Function: armVCM4P2_BlockMatch_16x16
- *
- * Description:
- * 16x16 block match wrapper function, calls omxVCM4P2_BlockMatch_Integer_16x16.
- * If half pel search is enabled it also calls omxVCM4P2_BlockMatch_Half_16x16
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcRefBuf pointer to the reference Y plane; points to the reference MB that
- * corresponds to the location of the current macroblock in the current
- * plane.
- * [in] srcRefStep width of the reference plane
- * [in] pRefRect pointer to the valid rectangular in reference plane. Relative to image origin.
- * It's not limited to the image boundary, but depended on the padding. For example,
- * if you pad 4 pixels outside the image border, then the value for left border
- * can be -4
- * [in] pSrcCurrBuf pointer to the current macroblock extracted from original plane (linear array,
- * 256 entries); must be aligned on an 16-byte boundary.
- * [in] pCurrPointPos position of the current macroblock in the current plane
- * [in] pSrcPreMV pointer to predicted motion vector; NULL indicates no predicted MV
- * [in] pSrcPreSAD pointer to SAD associated with the predicted MV (referenced by pSrcPreMV); may be set to NULL if unavailable.
- * [in] pMESpec vendor-specific motion estimation specification structure; must have been allocated
- * and then initialized using omxVCM4P2_MEInit prior to calling the block matching
- * function.
- * [out] pDstMV pointer to estimated MV
- * [out] pDstSAD pointer to minimum SAD
- * *
- * Return Value:
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- *
- */
-static OMXResult armVCM4P2_BlockMatch_16x16(
- const OMX_U8 *pSrcRefBuf,
- const OMX_INT srcRefStep,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- OMXVCMotionVector *pSrcPreMV,
- OMX_INT *pSrcPreSAD,
- void *pMESpec,
- OMXVCMotionVector *pDstMV,
- OMX_INT *pDstSAD
-)
-{
- OMXVCM4P2MEParams *pMEParams = (OMXVCM4P2MEParams *)pMESpec;
- OMX_INT rndVal;
-
- rndVal = pMEParams->rndVal;
-
- omxVCM4P2_BlockMatch_Integer_16x16(
- pSrcRefBuf,
- srcRefStep,
- pRefRect,
- pSrcCurrBuf,
- pCurrPointPos,
- pSrcPreMV,
- pSrcPreSAD,
- pMEParams,
- pDstMV,
- pDstSAD);
-
- if (pMEParams->halfPelSearchEnable)
- {
- omxVCM4P2_BlockMatch_Half_16x16(
- pSrcRefBuf,
- srcRefStep,
- pRefRect,
- pSrcCurrBuf,
- pCurrPointPos,
- rndVal,
- pDstMV,
- pDstSAD);
- }
-
- return OMX_Sts_NoErr;
-}
-
-/**
- * Function: armVCM4P2_BlockMatch_8x8
- *
- * Description:
- * 8x8 block match wrapper function, calls omxVCM4P2_BlockMatch_Integer_8x8.
- * If half pel search is enabled it also calls omxVCM4P2_BlockMatch_Half_8x8
- *
- * Remarks:
- *
- * Parameters:
- * [in] pSrcRefBuf pointer to the reference Y plane; points to the reference MB that
- * corresponds to the location of the current macroblock in the current
- * plane.
- * [in] srcRefStep width of the reference plane
- * [in] pRefRect pointer to the valid rectangular in reference plane. Relative to image origin.
- * It's not limited to the image boundary, but depended on the padding. For example,
- * if you pad 4 pixels outside the image border, then the value for left border
- * can be -4
- * [in] pSrcCurrBuf pointer to the current macroblock extracted from original plane (linear array,
- * 256 entries); must be aligned on an 16-byte boundary.
- * [in] pCurrPointPos position of the current macroblock in the current plane
- * [in] pSrcPreMV pointer to predicted motion vector; NULL indicates no predicted MV
- * [in] pSrcPreSAD pointer to SAD associated with the predicted MV (referenced by pSrcPreMV); may be set to NULL if unavailable.
- * [in] pMESpec vendor-specific motion estimation specification structure; must have been allocated
- * and then initialized using omxVCM4P2_MEInit prior to calling the block matching
- * function.
- * [out] pDstMV pointer to estimated MV
- * [out] pDstSAD pointer to minimum SAD
- * *
- * Return Value:
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments
- *
- */
-static OMXResult armVCM4P2_BlockMatch_8x8(
- const OMX_U8 *pSrcRefBuf,
- OMX_INT srcRefStep,
- const OMXRect *pRefRect,
- const OMX_U8 *pSrcCurrBuf,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- OMXVCMotionVector *pSrcPreMV,
- OMX_INT *pSrcPreSAD,
- void *pMESpec,
- OMXVCMotionVector *pSrcDstMV,
- OMX_INT *pDstSAD
-)
-{
- OMXVCM4P2MEParams *pMEParams = (OMXVCM4P2MEParams *)pMESpec;
- OMX_INT rndVal;
-
- rndVal = pMEParams->rndVal;
-
- omxVCM4P2_BlockMatch_Integer_8x8(
- pSrcRefBuf,
- srcRefStep,
- pRefRect,
- pSrcCurrBuf,
- pCurrPointPos,
- pSrcPreMV,
- pSrcPreSAD,
- pMEParams,
- pSrcDstMV,
- pDstSAD);
-
- if (pMEParams->halfPelSearchEnable)
- {
- omxVCM4P2_BlockMatch_Half_8x8(
- pSrcRefBuf,
- srcRefStep,
- pRefRect,
- pSrcCurrBuf,
- pCurrPointPos,
- rndVal,
- pSrcDstMV,
- pDstSAD);
- }
-
- return OMX_Sts_NoErr;
-}
-
-
-/**
- * Function: omxVCM4P2_MotionEstimationMB (6.2.4.3.1)
- *
- * Description:
- * Performs motion search for a 16x16 macroblock. Selects best motion search
- * strategy from among inter-1MV, inter-4MV, and intra modes. Supports
- * integer and half pixel resolution.
- *
- * Input Arguments:
- *
- * pSrcCurrBuf - pointer to the top-left corner of the current MB in the
- * original picture plane; must be aligned on a 16-byte boundary.
- * The function does not expect source data outside the region
- * bounded by the MB to be available; for example it is not
- * necessary for the caller to guarantee the availability of
- * pSrcCurrBuf[-SrcCurrStep], i.e., the row of pixels above the MB
- * to be processed.
- * srcCurrStep - width of the original picture plane, in terms of full
- * pixels; must be a multiple of 16.
- * pSrcRefBuf - pointer to the reference Y plane; points to the reference
- * plane location corresponding to the location of the current
- * macroblock in the current plane; must be aligned on a 16-byte
- * boundary.
- * srcRefStep - width of the reference picture plane, in terms of full
- * pixels; must be a multiple of 16.
- * pRefRect - reference plane valid region rectangle, specified relative to
- * the image origin
- * pCurrPointPos - position of the current macroblock in the current plane
- * pMESpec - pointer to the vendor-specific motion estimation specification
- * structure; must be allocated and then initialized using
- * omxVCM4P2_MEInit prior to calling this function.
- * pMBInfo - array, of dimension four, containing pointers to information
- * associated with four nearby MBs:
- * - pMBInfo[0] - pointer to left MB information
- * - pMBInfo[1] - pointer to top MB information
- * - pMBInfo[2] - pointer to top-left MB information
- * - pMBInfo[3] - pointer to top-right MB information
- * Any pointer in the array may be set equal to NULL if the
- * corresponding MB doesn't exist. For each MB, the following structure
- * members are used:
- * - mbType - macroblock type, either OMX_VC_INTRA, OMX_VC_INTER, or
- * OMX_VC_INTER4V
- * - pMV0[2][2] - estimated motion vectors; represented
- * in 1/2 pixel units
- * - sliceID - number of the slice to which the MB belongs
- * pSrcDstMBCurr - pointer to information structure for the current MB.
- * The following entries should be set prior to calling the
- * function: sliceID - the number of the slice the to which the
- * current MB belongs. The structure elements cbpy and cbpc are
- * ignored.
- *
- * Output Arguments:
- *
- * pSrcDstMBCurr - pointer to updated information structure for the current
- * MB after MB-level motion estimation has been completed. The
- * following structure members are updated by the ME function:
- * - mbType - macroblock type: OMX_VC_INTRA, OMX_VC_INTER, or
- * OMX_VC_INTER4V.
- * - pMV0[2][2] - estimated motion vectors; represented in
- * terms of 1/2 pel units.
- * - pMVPred[2][2] - predicted motion vectors; represented
- * in terms of 1/2 pel units.
- * The structure members cbpy and cbpc are not updated by the function.
- * pDstSAD - pointer to the minimum SAD for INTER1V, or sum of minimum SADs
- * for INTER4V
- * pDstBlockSAD - pointer to an array of SAD values for each of the four
- * 8x8 luma blocks in the MB. The block SADs are in scan order for
- * each MB.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments. Returned if one or more of the
- * following conditions is true:
- * - at least one of the following pointers is NULL: pSrcCurrBuf,
- * pSrcRefBuf, pRefRect, pCurrPointPos, pMBInter, pMBIntra,
- * pSrcDstMBCurr, or pDstSAD.
- *
- */
-
-OMXResult omxVCM4P2_MotionEstimationMB (
- const OMX_U8 *pSrcCurrBuf,
- OMX_S32 srcCurrStep,
- const OMX_U8 *pSrcRefBuf,
- OMX_S32 srcRefStep,
- const OMXRect*pRefRect,
- const OMXVCM4P2Coordinate *pCurrPointPos,
- void *pMESpec,
- const OMXVCM4P2MBInfoPtr *pMBInfo,
- OMXVCM4P2MBInfo *pSrcDstMBCurr,
- OMX_U16 *pDstSAD,
- OMX_U16 *pDstBlockSAD
-)
-{
-
- OMX_INT intraSAD, average, count, index, x, y;
- OMXVCMotionVector dstMV16x16;
- OMX_INT dstSAD16x16;
- OMX_INT dstSAD8x8;
- OMXVCM4P2MEParams *pMEParams;
- OMXVCM4P2Coordinate TempCurrPointPos;
- OMXVCM4P2Coordinate *pTempCurrPointPos;
- OMX_U8 aTempSrcCurrBuf[271];
- OMX_U8 *pTempSrcCurrBuf;
- OMX_U8 *pDst;
- OMX_U8 aDst[71];
- OMX_S32 dstStep = 8;
- OMX_INT predictType;
- OMX_S32 Sad;
- const OMX_U8 *pTempSrcRefBuf;
- OMXVCMotionVector* pSrcCandMV1[4];
- OMXVCMotionVector* pSrcCandMV2[4];
- OMXVCMotionVector* pSrcCandMV3[4];
-
- /* Argument error checks */
- armRetArgErrIf(!armIs16ByteAligned(pSrcCurrBuf), OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs16ByteAligned(pSrcRefBuf), OMX_Sts_BadArgErr);
- armRetArgErrIf(((srcCurrStep % 16) || (srcRefStep % 16)), OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcCurrBuf == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcRefBuf == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pRefRect == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pCurrPointPos == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSrcDstMBCurr == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDstSAD == NULL, OMX_Sts_BadArgErr);
-
-
- pTempCurrPointPos = &(TempCurrPointPos);
- pTempSrcCurrBuf = armAlignTo16Bytes(aTempSrcCurrBuf);
- pMEParams = (OMXVCM4P2MEParams *)pMESpec;
- pTempCurrPointPos->x = pCurrPointPos->x;
- pTempCurrPointPos->y = pCurrPointPos->y;
- pSrcDstMBCurr->mbType = OMX_VC_INTER;
-
- /* Preparing a linear buffer for block match */
- for (y = 0, index = count = 0; y < 16; y++, index += srcCurrStep - 16)
- {
- for(x = 0; x < 16; x++, count++, index++)
- {
- pTempSrcCurrBuf[count] = pSrcCurrBuf[index];
- }
- }
- for(y = 0, index = 0; y < 2; y++)
- {
- for(x = 0; x < 2; x++,index++)
- {
- if((pMBInfo[0] != NULL) && (pMBInfo[0]->mbType != OMX_VC_INTRA))
- {
- pSrcCandMV1[index] = &(pMBInfo[0]->pMV0[y][x]);
- }
- else
- {
- pSrcCandMV1[index] = NULL;
- }
- if((pMBInfo[1] != NULL) && (pMBInfo[1]->mbType != OMX_VC_INTRA))
- {
- pSrcCandMV2[index] = &(pMBInfo[1]->pMV0[y][x]);
- }
- else
- {
- pSrcCandMV2[index] = NULL;
- }
- if((pMBInfo[3] != NULL) && (pMBInfo[3]->mbType != OMX_VC_INTRA))
- {
- pSrcCandMV3[index] = &(pMBInfo[3]->pMV0[y][x]);
- }
- else
- {
- pSrcCandMV3[index] = NULL;
- }
- }
- }
- /* Calculating SAD at MV(0,0) */
- armVCCOMM_SAD(pTempSrcCurrBuf,
- 16,
- pSrcRefBuf,
- srcRefStep,
- &Sad,
- 16,
- 16);
- *pDstSAD = Sad;
-
- /* Mode decision for NOT_CODED MB */
- if(*pDstSAD == 0)
- {
- pSrcDstMBCurr->pMV0[0][0].dx = 0;
- pSrcDstMBCurr->pMV0[0][0].dy = 0;
- *pDstSAD = 0;
- return OMX_Sts_NoErr;
- }
-
- omxVCM4P2_FindMVpred(
- &(pSrcDstMBCurr->pMV0[0][0]),
- pSrcCandMV1[0],
- pSrcCandMV2[0],
- pSrcCandMV3[0],
- &(pSrcDstMBCurr->pMVPred[0][0]),
- NULL,
- 0);
-
- /* Inter 1 MV */
- armVCM4P2_BlockMatch_16x16(
- pSrcRefBuf,
- srcRefStep,
- pRefRect,
- pTempSrcCurrBuf,
- pCurrPointPos,
- &(pSrcDstMBCurr->pMVPred[0][0]),
- NULL,
- pMEParams,
- &dstMV16x16,
- &dstSAD16x16);
-
- /* Initialize all with 1 MV values */
- pSrcDstMBCurr->pMV0[0][0].dx = dstMV16x16.dx;
- pSrcDstMBCurr->pMV0[0][0].dy = dstMV16x16.dy;
- pSrcDstMBCurr->pMV0[0][1].dx = dstMV16x16.dx;
- pSrcDstMBCurr->pMV0[0][1].dy = dstMV16x16.dy;
- pSrcDstMBCurr->pMV0[1][0].dx = dstMV16x16.dx;
- pSrcDstMBCurr->pMV0[1][0].dy = dstMV16x16.dy;
- pSrcDstMBCurr->pMV0[1][1].dx = dstMV16x16.dx;
- pSrcDstMBCurr->pMV0[1][1].dy = dstMV16x16.dy;
-
- *pDstSAD = dstSAD16x16;
-
- if (pMEParams->searchEnable8x8)
- {
- /* Inter 4MV */
- armVCM4P2_BlockMatch_8x8 (pSrcRefBuf,
- srcRefStep, pRefRect,
- pTempSrcCurrBuf, pTempCurrPointPos,
- &(pSrcDstMBCurr->pMVPred[0][0]), NULL,
- pMEParams, &(pSrcDstMBCurr->pMV0[0][0]),
- &dstSAD8x8
- );
- pDstBlockSAD[0] = dstSAD8x8;
- *pDstSAD = dstSAD8x8;
- pTempCurrPointPos->x += 8;
- pSrcRefBuf += 8;
- omxVCM4P2_FindMVpred(
- &(pSrcDstMBCurr->pMV0[0][1]),
- pSrcCandMV1[1],
- pSrcCandMV2[1],
- pSrcCandMV3[1],
- &(pSrcDstMBCurr->pMVPred[0][1]),
- NULL,
- 1);
-
- armVCM4P2_BlockMatch_8x8 (pSrcRefBuf,
- srcRefStep, pRefRect,
- pTempSrcCurrBuf, pTempCurrPointPos,
- &(pSrcDstMBCurr->pMVPred[0][1]), NULL,
- pMEParams, &(pSrcDstMBCurr->pMV0[0][1]),
- &dstSAD8x8
- );
- pDstBlockSAD[1] = dstSAD8x8;
- *pDstSAD += dstSAD8x8;
- pTempCurrPointPos->x -= 8;
- pTempCurrPointPos->y += 8;
- pSrcRefBuf += (srcRefStep * 8) - 8;
-
- omxVCM4P2_FindMVpred(
- &(pSrcDstMBCurr->pMV0[1][0]),
- pSrcCandMV1[2],
- pSrcCandMV2[2],
- pSrcCandMV3[2],
- &(pSrcDstMBCurr->pMVPred[1][0]),
- NULL,
- 2);
- armVCM4P2_BlockMatch_8x8 (pSrcRefBuf,
- srcRefStep, pRefRect,
- pTempSrcCurrBuf, pTempCurrPointPos,
- &(pSrcDstMBCurr->pMVPred[1][0]), NULL,
- pMEParams, &(pSrcDstMBCurr->pMV0[1][0]),
- &dstSAD8x8
- );
- pDstBlockSAD[2] = dstSAD8x8;
- *pDstSAD += dstSAD8x8;
- pTempCurrPointPos->x += 8;
- pSrcRefBuf += 8;
- omxVCM4P2_FindMVpred(
- &(pSrcDstMBCurr->pMV0[1][1]),
- pSrcCandMV1[3],
- pSrcCandMV2[3],
- pSrcCandMV3[3],
- &(pSrcDstMBCurr->pMVPred[1][1]),
- NULL,
- 3);
- armVCM4P2_BlockMatch_8x8 (pSrcRefBuf,
- srcRefStep, pRefRect,
- pTempSrcCurrBuf, pTempCurrPointPos,
- &(pSrcDstMBCurr->pMVPred[1][1]), NULL,
- pMEParams, &(pSrcDstMBCurr->pMV0[1][1]),
- &dstSAD8x8
- );
- pDstBlockSAD[3] = dstSAD8x8;
- *pDstSAD += dstSAD8x8;
-
-
- /* Checking if 4MV is equal to 1MV */
- if (
- (pSrcDstMBCurr->pMV0[0][0].dx != dstMV16x16.dx) ||
- (pSrcDstMBCurr->pMV0[0][0].dy != dstMV16x16.dy) ||
- (pSrcDstMBCurr->pMV0[0][1].dx != dstMV16x16.dx) ||
- (pSrcDstMBCurr->pMV0[0][1].dy != dstMV16x16.dy) ||
- (pSrcDstMBCurr->pMV0[1][0].dx != dstMV16x16.dx) ||
- (pSrcDstMBCurr->pMV0[1][0].dy != dstMV16x16.dy) ||
- (pSrcDstMBCurr->pMV0[1][1].dx != dstMV16x16.dx) ||
- (pSrcDstMBCurr->pMV0[1][1].dy != dstMV16x16.dy)
- )
- {
- /* select the 4 MV */
- pSrcDstMBCurr->mbType = OMX_VC_INTER4V;
- }
- }
-
- /* finding the error in intra mode */
- for (count = 0, average = 0; count < 256 ; count++)
- {
- average = average + pTempSrcCurrBuf[count];
- }
- average = average/256;
-
- intraSAD = 0;
-
- /* Intra SAD calculation */
- for (count = 0; count < 256 ; count++)
- {
- intraSAD += armAbs ((pTempSrcCurrBuf[count]) - (average));
- }
-
- /* Using the MPEG4 VM formula for intra/inter mode decision
- Var < (SAD - 2*NB) where NB = N^2 is the number of pixels
- of the macroblock.*/
-
- if (intraSAD <= (*pDstSAD - 512))
- {
- pSrcDstMBCurr->mbType = OMX_VC_INTRA;
- pSrcDstMBCurr->pMV0[0][0].dx = 0;
- pSrcDstMBCurr->pMV0[0][0].dy = 0;
- *pDstSAD = intraSAD;
- pDstBlockSAD[0] = 0xFFFF;
- pDstBlockSAD[1] = 0xFFFF;
- pDstBlockSAD[2] = 0xFFFF;
- pDstBlockSAD[3] = 0xFFFF;
- }
-
- if(pSrcDstMBCurr->mbType == OMX_VC_INTER)
- {
- pTempSrcRefBuf = pSrcRefBuf + (srcRefStep * dstMV16x16.dy) + dstMV16x16.dx;
-
- if((dstMV16x16.dx & 0x1) && (dstMV16x16.dy & 0x1))
- {
- predictType = OMX_VC_HALF_PIXEL_XY;
- }
- else if(dstMV16x16.dx & 0x1)
- {
- predictType = OMX_VC_HALF_PIXEL_X;
- }
- else if(dstMV16x16.dy & 0x1)
- {
- predictType = OMX_VC_HALF_PIXEL_Y;
- }
- else
- {
- predictType = OMX_VC_INTEGER_PIXEL;
- }
-
- pDst = armAlignTo8Bytes(&(aDst[0]));
- /* Calculating Block SAD at MV(dstMV16x16.dx,dstMV16x16.dy) */
- /* Block 0 */
- omxVCM4P2_MCReconBlock(pTempSrcRefBuf,
- srcRefStep,
- NULL,
- pDst,
- dstStep,
- predictType,
- pMEParams->rndVal);
-
- armVCCOMM_SAD(pTempSrcCurrBuf,
- 16,
- pDst,
- dstStep,
- &Sad,
- 8,
- 8);
- pDstBlockSAD[0] = Sad;
-
- /* Block 1 */
- omxVCM4P2_MCReconBlock(pTempSrcRefBuf + 8,
- srcRefStep,
- NULL,
- pDst,
- dstStep,
- predictType,
- pMEParams->rndVal);
-
- armVCCOMM_SAD(pTempSrcCurrBuf + 8,
- 16,
- pDst,
- dstStep,
- &Sad,
- 8,
- 8);
- pDstBlockSAD[1] = Sad;
-
- /* Block 2 */
- omxVCM4P2_MCReconBlock(pTempSrcRefBuf + (srcRefStep*8),
- srcRefStep,
- NULL,
- pDst,
- dstStep,
- predictType,
- pMEParams->rndVal);
-
- armVCCOMM_SAD(pTempSrcCurrBuf + (16*8),
- 16,
- pDst,
- dstStep,
- &Sad,
- 8,
- 8);
- pDstBlockSAD[2] = Sad;
-
- /* Block 3 */
- omxVCM4P2_MCReconBlock(pTempSrcRefBuf + (srcRefStep*8) + 8,
- srcRefStep,
- NULL,
- pDst,
- dstStep,
- predictType,
- pMEParams->rndVal);
-
- armVCCOMM_SAD(pTempSrcCurrBuf + (16*8) + 8,
- 16,
- pDst,
- dstStep,
- &Sad,
- 8,
- 8);
- pDstBlockSAD[3] = Sad;
- }
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_PredictReconCoefIntra.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_PredictReconCoefIntra.c
deleted file mode 100644
index e091f31..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_PredictReconCoefIntra.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
- /**
- *
- * File Name: omxVCM4P2_PredictReconCoefIntra.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * File: omxVCM4P2_PredictReconCoefIntra_S16.c
- * Description: Contains modules for AC DC prediction
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-/**
- * Function: omxVCM4P2_PredictReconCoefIntra (6.2.5.4.3)
- *
- * Description:
- * Performs adaptive DC/AC coefficient prediction for an intra block. Prior
- * to the function call, prediction direction (predDir) should be selected as
- * specified in [ISO14496-2], subclause 7.4.3.1.
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the coefficient buffer which contains the quantized
- * coefficient residuals (PQF) of the current block; must be
- * aligned on a 4-byte boundary. The output coefficients are
- * saturated to the range [-2048, 2047].
- * pPredBufRow - pointer to the coefficient row buffer; must be aligned on
- * a 4-byte boundary.
- * pPredBufCol - pointer to the coefficient column buffer; must be aligned
- * on a 4-byte boundary.
- * curQP - quantization parameter of the current block. curQP may equal to
- * predQP especially when the current block and the predictor block
- * are in the same macroblock.
- * predQP - quantization parameter of the predictor block
- * predDir - indicates the prediction direction which takes one of the
- * following values: OMX_VC_HORIZONTAL - predict horizontally
- * OMX_VC_VERTICAL - predict vertically
- * ACPredFlag - a flag indicating if AC prediction should be performed. It
- * is equal to ac_pred_flag in the bit stream syntax of MPEG-4
- * videoComp - video component type (luminance or chrominance) of the
- * current block
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to the coefficient buffer which contains the quantized
- * coefficients (QF) of the current block
- * pPredBufRow - pointer to the updated coefficient row buffer
- * pPredBufCol - pointer to the updated coefficient column buffer Note:
- * Buffer update: Update the AC prediction buffer (both row and
- * column buffer).
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments, if:
- * - At least one of the pointers is NULL:
- * pSrcDst, pPredBufRow, or pPredBufCol.
- * - curQP <= 0,
- * - predQP <= 0,
- * - curQP >31,
- * - predQP > 31,
- * - preDir exceeds [1,2]
- * - pSrcDst, pPredBufRow, or pPredBufCol is not 4-byte aligned.
- *
- */
-
-OMXResult omxVCM4P2_PredictReconCoefIntra(
- OMX_S16 * pSrcDst,
- OMX_S16 * pPredBufRow,
- OMX_S16 * pPredBufCol,
- OMX_INT curQP,
- OMX_INT predQP,
- OMX_INT predDir,
- OMX_INT ACPredFlag,
- OMXVCM4P2VideoComponent videoComp
- )
-{
- OMX_U8 flag;
- /* Argument error checks */
- armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pPredBufRow == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pPredBufCol == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(curQP <= 0, OMX_Sts_BadArgErr);
- armRetArgErrIf(predQP <= 0, OMX_Sts_BadArgErr);
- armRetArgErrIf(curQP > 31, OMX_Sts_BadArgErr);
- armRetArgErrIf(predQP > 31, OMX_Sts_BadArgErr);
- armRetArgErrIf((predDir != 1) && (predDir != 2), OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs4ByteAligned(pSrcDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs4ByteAligned(pPredBufRow), OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs4ByteAligned(pPredBufCol), OMX_Sts_BadArgErr);
-
- flag = 0;
- return armVCM4P2_ACDCPredict(
- pSrcDst,
- NULL,
- pPredBufRow,
- pPredBufCol,
- curQP,
- predQP,
- predDir,
- ACPredFlag,
- videoComp,
- flag,
- NULL);
-
-}
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_QuantInter_I.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_QuantInter_I.c
deleted file mode 100644
index 9055b66..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_QuantInter_I.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_QuantInter_I.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for inter Quantization
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-
-/**
- * Function: omxVCM4P2_QuantInter_I (6.2.4.4.3)
- *
- * Description:
- * Performs quantization on an inter coefficient block; supports
- * bits_per_pixel == 8.
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input inter block coefficients; must be aligned
- * on a 16-byte boundary.
- * QP - quantization parameter (quantizer_scale)
- * shortVideoHeader - binary flag indicating presence of short_video_header;
- * shortVideoHeader==1 selects linear intra DC mode, and
- * shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to the output (quantized) interblock coefficients.
- * When shortVideoHeader==1, AC coefficients are saturated on the
- * interval [-127, 127], and DC coefficients are saturated on the
- * interval [1, 254]. When shortVideoHeader==0, AC coefficients
- * are saturated on the interval [-2047, 2047].
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - pSrcDst is NULL.
- * - QP <= 0 or QP >= 32.
- *
- */
-
-OMXResult omxVCM4P2_QuantInter_I(
- OMX_S16 * pSrcDst,
- OMX_U8 QP,
- OMX_INT shortVideoHeader
-)
-{
-
- /* Definitions and Initializations*/
- OMX_INT coeffCount;
- OMX_INT fSign;
- OMX_INT maxClpAC = 0, minClpAC = 0;
- OMX_INT maxClpDC = 0, minClpDC = 0;
-
- /* Argument error checks */
- armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(((QP <= 0) || (QP >= 32)), OMX_Sts_BadArgErr);
- /* One argument check is delayed until we have ascertained that */
- /* pQMatrix is not NULL. */
-
- /* Set the Clip Range based on SVH on/off */
- if(shortVideoHeader == 1)
- {
- maxClpDC = 254;
- minClpDC = 1;
- maxClpAC = 127;
- minClpAC = -127;
- }
- else
- {
- maxClpDC = 2047;
- minClpDC = -2047;
- maxClpAC = 2047;
- minClpAC = -2047;
- }
-
- /* Second Inverse quantisation method */
- for (coeffCount = 0; coeffCount < 64; coeffCount++)
- {
- fSign = armSignCheck (pSrcDst[coeffCount]);
- pSrcDst[coeffCount] = (armAbs(pSrcDst[coeffCount])
- - (QP/2))/(2 * QP);
- pSrcDst[coeffCount] *= fSign;
-
- /* Clip */
- if (coeffCount == 0)
- {
- pSrcDst[coeffCount] =
- (OMX_S16) armClip (minClpDC, maxClpDC, pSrcDst[coeffCount]);
- }
- else
- {
- pSrcDst[coeffCount] =
- (OMX_S16) armClip (minClpAC, maxClpAC, pSrcDst[coeffCount]);
- }
- }
- return OMX_Sts_NoErr;
-
-}
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_QuantIntra_I.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_QuantIntra_I.c
deleted file mode 100644
index 795b802..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_QuantIntra_I.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_QuantIntra_I.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for intra Quantization
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-/**
- * Function: omxVCM4P2_QuantIntra_I (6.2.4.4.2)
- *
- * Description:
- * Performs quantization on intra block coefficients. This function supports
- * bits_per_pixel == 8.
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input intra block coefficients; must be aligned
- * on a 16-byte boundary.
- * QP - quantization parameter (quantizer_scale).
- * blockIndex - block index indicating the component type and position,
- * valid in the range 0 to 5, as defined in [ISO14496-2], subclause
- * 6.1.3.8.
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; shortVideoHeader==1 selects linear intra DC
- * mode, and shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to the output (quantized) interblock coefficients.
- * When shortVideoHeader==1, AC coefficients are saturated on the
- * interval [-127, 127], and DC coefficients are saturated on the
- * interval [1, 254]. When shortVideoHeader==0, AC coefficients
- * are saturated on the interval [-2047, 2047].
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - pSrcDst is NULL.
- * - blockIndex < 0 or blockIndex >= 10
- * - QP <= 0 or QP >= 32.
- *
- */
-
-OMXResult omxVCM4P2_QuantIntra_I(
- OMX_S16 * pSrcDst,
- OMX_U8 QP,
- OMX_INT blockIndex,
- OMX_INT shortVideoHeader
- )
-{
-
- /* Definitions and Initializations*/
- /* Initialized to remove compilation error */
- OMX_INT dcScaler = 0, coeffCount,fSign;
- OMX_INT maxClpAC, minClpAC;
-
- /* Argument error checks */
- armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(((blockIndex < 0) || (blockIndex >= 10)), OMX_Sts_BadArgErr);
- armRetArgErrIf(((QP <= 0) || (QP >= 32)), OMX_Sts_BadArgErr);
- /* One argument check is delayed until we have ascertained that */
- /* pQMatrix is not NULL. */
-
-
- /* Set the Clip Range based on SVH on/off */
- if(shortVideoHeader == 1)
- {
- maxClpAC = 127;
- minClpAC = -127;
- dcScaler = 8;
- /* Dequant the DC value, this applies to both the methods */
- pSrcDst[0] = armIntDivAwayFromZero (pSrcDst[0], dcScaler);
-
- /* Clip between 1 and 254 */
- pSrcDst[0] = (OMX_S16) armClip (1, 254, pSrcDst[0]);
- }
- else
- {
- maxClpAC = 2047;
- minClpAC = -2047;
- /* Calculate the DC scaler value */
- if ((blockIndex < 4) || (blockIndex > 5))
- {
- if (QP >= 1 && QP <= 4)
- {
- dcScaler = 8;
- }
- else if (QP >= 5 && QP <= 8)
- {
- dcScaler = 2 * QP;
- }
- else if (QP >= 9 && QP <= 24)
- {
- dcScaler = QP + 8;
- }
- else
- {
- dcScaler = (2 * QP) - 16;
- }
- }
- else if (blockIndex < 6)
- {
- if (QP >= 1 && QP <= 4)
- {
- dcScaler = 8;
- }
- else if (QP >= 5 && QP <= 24)
- {
- dcScaler = (QP + 13)/2;
- }
- else
- {
- dcScaler = QP - 6;
- }
- }
-
- /* Dequant the DC value, this applies to both the methods */
- pSrcDst[0] = armIntDivAwayFromZero (pSrcDst[0], dcScaler);
- }
-
- /* Second Inverse quantisation method */
- for (coeffCount = 1; coeffCount < 64; coeffCount++)
- {
- fSign = armSignCheck (pSrcDst[coeffCount]);
- pSrcDst[coeffCount] = armAbs(pSrcDst[coeffCount])/(2 * QP);
- pSrcDst[coeffCount] *= fSign;
-
- /* Clip */
- pSrcDst[coeffCount] =
- (OMX_S16) armClip (minClpAC, maxClpAC, pSrcDst[coeffCount]);
- }
- return OMX_Sts_NoErr;
-
-}
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_QuantInvInter_I.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_QuantInvInter_I.c
deleted file mode 100644
index 189e244..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_QuantInvInter_I.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_QuantInvInter_I.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for inter inverse Quantization
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-
-
-/**
- * Function: omxVCM4P2_QuantInvInter_I (6.2.5.3.2)
- *
- * Description:
- * Performs the second inverse quantization mode on an intra/inter coded
- * block. Supports bits_per_pixel = 8. The output coefficients are clipped to
- * the range [-2048, 2047].
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input (quantized) intra/inter block; must be
- * aligned on a 16-byte boundary.
- * QP - quantization parameter (quantizer_scale)
- * videoComp - video component type of the current block. Takes one of the
- * following flags: OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE (intra
- * version only).
- * shortVideoHeader - binary flag indicating presence of short_video_header
- * (intra version only).
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to the output (dequantized) intra/inter block
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; one or more of the following is
- * true:
- * - pSrcDst is NULL
- * - QP <= 0 or QP >=31
- * - videoComp is neither OMX_VC_LUMINANCE nor OMX_VC_CHROMINANCE.
- *
- */
-
-OMXResult omxVCM4P2_QuantInvInter_I(
- OMX_S16 * pSrcDst,
- OMX_INT QP
- )
-{
-
- OMX_INT coeffCount, Sign;
-
- /* Argument error checks */
- armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(((QP <= 0) || (QP >= 32)), OMX_Sts_BadArgErr);
-
- /* Second Inverse quantisation method */
- for (coeffCount = 0; coeffCount < 64; coeffCount++)
- {
- /* check sign */
- Sign = armSignCheck (pSrcDst[coeffCount]);
-
- /* Quantize the coeff */
- if (QP & 0x1)
- {
- pSrcDst[coeffCount] = (2* armAbs(pSrcDst[coeffCount]) + 1) * QP;
- pSrcDst[coeffCount] *= Sign;
- }
- else
- {
- pSrcDst[coeffCount] = (2* armAbs(pSrcDst[coeffCount]) + 1)
- * QP - 1;
- pSrcDst[coeffCount] *= Sign;
- }
- /* Saturate */
- pSrcDst[coeffCount] = armClip (-2048, 2047, pSrcDst[coeffCount]);
- }
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_QuantInvIntra_I.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_QuantInvIntra_I.c
deleted file mode 100644
index 2f24cc7..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_QuantInvIntra_I.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_QuantInvIntra_I.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules for intra inverse Quantization
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-
-/**
- * Function: omxVCM4P2_QuantInvIntra_I (6.2.5.3.2)
- *
- * Description:
- * Performs the second inverse quantization mode on an intra/inter coded
- * block. Supports bits_per_pixel = 8. The output coefficients are clipped to
- * the range [-2048, 2047].
- *
- * Input Arguments:
- *
- * pSrcDst - pointer to the input (quantized) intra/inter block; must be
- * aligned on a 16-byte boundary.
- * QP - quantization parameter (quantizer_scale)
- * videoComp - video component type of the current block. Takes one of the
- * following flags: OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE (intra
- * version only).
- * shortVideoHeader - binary flag indicating presence of short_video_header
- * (intra version only).
- *
- * Output Arguments:
- *
- * pSrcDst - pointer to the output (dequantized) intra/inter block
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments; one or more of the following is
- * true:
- * - pSrcDst is NULL
- * - QP <= 0 or QP >=31
- * - videoComp is neither OMX_VC_LUMINANCE nor OMX_VC_CHROMINANCE.
- *
- */
-
-OMXResult omxVCM4P2_QuantInvIntra_I(
- OMX_S16 * pSrcDst,
- OMX_INT QP,
- OMXVCM4P2VideoComponent videoComp,
- OMX_INT shortVideoHeader
-)
-{
-
- /* Initialized to remove compilation error */
- OMX_INT dcScaler = 0, coeffCount, Sign;
-
- /* Argument error checks */
- armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(((QP <= 0) || (QP >= 32)), OMX_Sts_BadArgErr);
- armRetArgErrIf(((videoComp != OMX_VC_LUMINANCE) && (videoComp != OMX_VC_CHROMINANCE)), OMX_Sts_BadArgErr);
-
- /* Calculate the DC scaler value */
-
- /* linear intra DC mode */
- if(shortVideoHeader)
- {
- dcScaler = 8;
- }
- /* nonlinear intra DC mode */
- else
- {
-
- if (videoComp == OMX_VC_LUMINANCE)
- {
- if (QP >= 1 && QP <= 4)
- {
- dcScaler = 8;
- }
- else if (QP >= 5 && QP <= 8)
- {
- dcScaler = 2 * QP;
- }
- else if (QP >= 9 && QP <= 24)
- {
- dcScaler = QP + 8;
- }
- else
- {
- dcScaler = (2 * QP) - 16;
- }
- }
-
- else if (videoComp == OMX_VC_CHROMINANCE)
- {
- if (QP >= 1 && QP <= 4)
- {
- dcScaler = 8;
- }
- else if (QP >= 5 && QP <= 24)
- {
- dcScaler = (QP + 13)/2;
- }
- else
- {
- dcScaler = QP - 6;
- }
- }
- }
- /* Dequant the DC value, this applies to both the methods */
- pSrcDst[0] = pSrcDst[0] * dcScaler;
-
- /* Saturate */
- pSrcDst[0] = armClip (-2048, 2047, pSrcDst[0]);
-
- /* Second Inverse quantisation method */
- for (coeffCount = 1; coeffCount < 64; coeffCount++)
- {
- /* check sign */
- Sign = armSignCheck (pSrcDst[coeffCount]);
-
- if (QP & 0x1)
- {
- pSrcDst[coeffCount] = (2* armAbs(pSrcDst[coeffCount]) + 1) * QP;
- pSrcDst[coeffCount] *= Sign;
- }
- else
- {
- pSrcDst[coeffCount] =
- (2* armAbs(pSrcDst[coeffCount]) + 1) * QP - 1;
- pSrcDst[coeffCount] *= Sign;
- }
-
- /* Saturate */
- pSrcDst[coeffCount] = armClip (-2048, 2047, pSrcDst[coeffCount]);
- }
- return OMX_Sts_NoErr;
-
-}
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_TransRecBlockCoef_inter.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_TransRecBlockCoef_inter.c
deleted file mode 100644
index 9615a77..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_TransRecBlockCoef_inter.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_TransRecBlockCoef_inter.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules DCT->quant and reconstructing the inter texture data
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-
-
-/**
- * Function: omxVCM4P2_TransRecBlockCoef_inter (6.2.4.4.5)
- *
- * Description:
- * Implements DCT, and quantizes the DCT coefficients of the inter block
- * while reconstructing the texture residual. There is no boundary check for
- * the bit stream buffer.
- *
- * Input Arguments:
- *
- * pSrc -pointer to the residuals to be encoded; must be aligned on an
- * 16-byte boundary.
- * QP - quantization parameter.
- * shortVideoHeader - binary flag indicating presence of short_video_header;
- * shortVideoHeader==1 selects linear intra DC mode, and
- * shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * pDst - pointer to the quantized DCT coefficients buffer; must be aligned
- * on a 16-byte boundary.
- * pRec - pointer to the reconstructed texture residuals; must be aligned
- * on a 16-byte boundary.
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - bad arguments:
- * - At least one of the following pointers is either NULL or
- * not 16-byte aligned:
- * - pSrc
- * - pDst
- * - pRec
- * - QP <= 0 or QP >= 32.
- *
- */
-
-OMXResult omxVCM4P2_TransRecBlockCoef_inter(
- const OMX_S16 *pSrc,
- OMX_S16 * pDst,
- OMX_S16 * pRec,
- OMX_U8 QP,
- OMX_INT shortVideoHeader
-)
-{
- /* 64 elements are needed but to align it to 16 bytes need
- 8 more elements of padding */
- OMX_S16 tempBuffer[72];
- OMX_S16 *pTempBuffer;
- OMX_INT i;
-
- /* Aligning the local buffers */
- pTempBuffer = armAlignTo16Bytes(tempBuffer);
-
- /* Argument error checks */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pRec == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs16ByteAligned(pSrc), OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs16ByteAligned(pRec), OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs16ByteAligned(pDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(((QP <= 0) || (QP >= 32)), OMX_Sts_BadArgErr);
-
- omxVCM4P2_DCT8x8blk (pSrc, pDst);
- omxVCM4P2_QuantInter_I(
- pDst,
- QP,
- shortVideoHeader);
-
- for (i = 0; i < 64; i++)
- {
- pTempBuffer[i] = pDst[i];
- }
-
- omxVCM4P2_QuantInvInter_I(
- pTempBuffer,
- QP);
- omxVCM4P2_IDCT8x8blk (pTempBuffer, pRec);
-
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_TransRecBlockCoef_intra.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_TransRecBlockCoef_intra.c
deleted file mode 100644
index 4923e3f..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p2/src/omxVCM4P2_TransRecBlockCoef_intra.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Copyright (C) 2007-2008 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
- *
- * File Name: omxVCM4P2_TransRecBlockCoef_intra.c
- * OpenMAX DL: v1.0.2
- * Revision: 9641
- * Date: Thursday, February 7, 2008
- *
- *
- *
- *
- * Description:
- * Contains modules DCT->quant and reconstructing the intra texture data
- *
- */
-
-#include "omxtypes.h"
-#include "armOMX.h"
-#include "omxVC.h"
-
-#include "armCOMM.h"
-#include "armVC.h"
-
-
-/**
- * Function: omxVCM4P2_TransRecBlockCoef_intra (6.2.4.4.4)
- *
- * Description:
- * Quantizes the DCT coefficients, implements intra block AC/DC coefficient
- * prediction, and reconstructs the current intra block texture for prediction
- * on the next frame. Quantized row and column coefficients are returned in
- * the updated coefficient buffers.
- *
- * Input Arguments:
- *
- * pSrc - pointer to the pixels of current intra block; must be aligned on
- * an 8-byte boundary.
- * pPredBufRow - pointer to the coefficient row buffer containing
- * ((num_mb_per_row * 2 + 1) * 8) elements of type OMX_S16.
- * Coefficients are organized into blocks of eight as described
- * below (Internal Prediction Coefficient Update Procedures). The
- * DC coefficient is first, and the remaining buffer locations
- * contain the quantized AC coefficients. Each group of eight row
- * buffer elements combined with one element eight elements ahead
- * contains the coefficient predictors of the neighboring block
- * that is spatially above or to the left of the block currently to
- * be decoded. A negative-valued DC coefficient indicates that this
- * neighboring block is not INTRA-coded or out of bounds, and
- * therefore the AC and DC coefficients are invalid. Pointer must
- * be aligned on an 8-byte boundary.
- * pPredBufCol - pointer to the prediction coefficient column buffer
- * containing 16 elements of type OMX_S16. Coefficients are
- * organized as described in section 6.2.2.5. Pointer must be
- * aligned on an 8-byte boundary.
- * pSumErr - pointer to a flag indicating whether or not AC prediction is
- * required; AC prediction is enabled if *pSumErr >=0, but the
- * value is not used for coefficient prediction, i.e., the sum of
- * absolute differences starts from 0 for each call to this
- * function. Otherwise AC prediction is disabled if *pSumErr < 0 .
- * blockIndex - block index indicating the component type and position, as
- * defined in [ISO14496-2], subclause 6.1.3.8.
- * curQp - quantization parameter of the macroblock to which the current
- * block belongs
- * pQpBuf - pointer to a 2-element quantization parameter buffer; pQpBuf[0]
- * contains the quantization parameter associated with the 8x8
- * block left of the current block (QPa), and pQpBuf[1] contains
- * the quantization parameter associated with the 8x8 block above
- * the current block (QPc). In the event that the corresponding
- * block is outside of the VOP bound, the Qp value will not affect
- * the intra prediction process, as described in [ISO14496-2],
- * sub-clause 7.4.3.3, Adaptive AC Coefficient Prediction.
- * srcStep - width of the source buffer; must be a multiple of 8.
- * dstStep - width of the reconstructed destination buffer; must be a
- * multiple of 16.
- * shortVideoHeader - binary flag indicating presence of
- * short_video_header; shortVideoHeader==1 selects linear intra DC
- * mode, and shortVideoHeader==0 selects non linear intra DC mode.
- *
- * Output Arguments:
- *
- * pDst - pointer to the quantized DCT coefficient buffer; pDst[0] contains
- * the predicted DC coefficient; the remaining entries contain the
- * quantized AC coefficients (without prediction). The pointer
- * pDstmust be aligned on a 16-byte boundary.
- * pRec - pointer to the reconstructed texture; must be aligned on an
- * 8-byte boundary.
- * pPredBufRow - pointer to the updated coefficient row buffer
- * pPredBufCol - pointer to the updated coefficient column buffer
- * pPreACPredict - if prediction is enabled, the parameter points to the
- * start of the buffer containing the coefficient differences for
- * VLC encoding. The entry pPreACPredict[0]indicates prediction
- * direction for the current block and takes one of the following
- * values: OMX_VC_NONE (prediction disabled), OMX_VC_HORIZONTAL, or
- * OMX_VC_VERTICAL. The entries
- * pPreACPredict[1]-pPreACPredict[7]contain predicted AC
- * coefficients. If prediction is disabled (*pSumErr<0) then the
- * contents of this buffer are undefined upon return from the
- * function
- * pSumErr - pointer to the value of the accumulated AC coefficient errors,
- * i.e., sum of the absolute differences between predicted and
- * unpredicted AC coefficients
- *
- * Return Value:
- *
- * OMX_Sts_NoErr - no error
- * OMX_Sts_BadArgErr - Bad arguments:
- * - At least one of the following pointers is NULL: pSrc, pDst, pRec,
- * pCoefBufRow, pCoefBufCol, pQpBuf, pPreACPredict, pSumErr.
- * - blockIndex < 0 or blockIndex >= 10;
- * - curQP <= 0 or curQP >= 32.
- * - srcStep, or dstStep <= 0 or not a multiple of 8.
- * - pDst is not 16-byte aligned: .
- * - At least one of the following pointers is not 8-byte aligned:
- * pSrc, pRec.
- *
- * Note: The coefficient buffers must be updated in accordance with the
- * update procedures defined in section in 6.2.2.
- *
- */
-
-OMXResult omxVCM4P2_TransRecBlockCoef_intra(
- const OMX_U8 *pSrc,
- OMX_S16 * pDst,
- OMX_U8 * pRec,
- OMX_S16 *pPredBufRow,
- OMX_S16 *pPredBufCol,
- OMX_S16 * pPreACPredict,
- OMX_INT *pSumErr,
- OMX_INT blockIndex,
- OMX_U8 curQp,
- const OMX_U8 *pQpBuf,
- OMX_INT srcStep,
- OMX_INT dstStep,
- OMX_INT shortVideoHeader
-)
-{
- /* 64 elements are needed but to align it to 16 bytes need
- 8 more elements of padding */
- OMX_S16 tempBuf1[79], tempBuf2[79];
- OMX_S16 tempBuf3[79];
- OMX_S16 *pTempBuf1, *pTempBuf2,*pTempBuf3;
- OMXVCM4P2VideoComponent videoComp;
- OMX_U8 flag;
- OMX_INT x, y, count, predDir;
- OMX_INT predQP, ACPredFlag;
-
-
- /* Aligning the local buffers */
- pTempBuf1 = armAlignTo16Bytes(tempBuf1);
- pTempBuf2 = armAlignTo16Bytes(tempBuf2);
- pTempBuf3 = armAlignTo16Bytes(tempBuf3);
-
- /* Argument error checks */
- armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pRec == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs8ByteAligned(pSrc), OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs8ByteAligned(pRec), OMX_Sts_BadArgErr);
- armRetArgErrIf(!armIs16ByteAligned(pDst), OMX_Sts_BadArgErr);
- armRetArgErrIf(pPredBufRow == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pPredBufCol == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pPreACPredict == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pSumErr == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf(pQpBuf == NULL, OMX_Sts_BadArgErr);
- armRetArgErrIf((srcStep <= 0) || (dstStep <= 0) ||
- (dstStep & 7) || (srcStep & 7)
- , OMX_Sts_BadArgErr);
- armRetArgErrIf((blockIndex < 0) || (blockIndex > 9), OMX_Sts_BadArgErr);
-
- armRetArgErrIf((curQp <= 0) || (curQp >=32), OMX_Sts_BadArgErr);
-
-
- /* Setting the videoComp */
- if (blockIndex <= 3)
- {
- videoComp = OMX_VC_LUMINANCE;
- }
- else
- {
- videoComp = OMX_VC_CHROMINANCE;
- }
- /* Converting from 2-d to 1-d buffer */
- for (y = 0, count = 0; y < 8; y++)
- {
- for(x= 0; x < 8; x++, count++)
- {
- pTempBuf1[count] = pSrc[(y*srcStep) + x];
- }
- }
-
- omxVCM4P2_DCT8x8blk (pTempBuf1, pTempBuf2);
- omxVCM4P2_QuantIntra_I(
- pTempBuf2,
- curQp,
- blockIndex,
- shortVideoHeader);
-
- /* Converting from 1-D to 2-D buffer */
- for (y = 0, count = 0; y < 8; y++)
- {
- for(x = 0; x < 8; x++, count++)
- {
- /* storing tempbuf2 to tempbuf1 */
- pTempBuf1[count] = pTempBuf2[count];
- pDst[(y*dstStep) + x] = pTempBuf2[count];
- }
- }
-
- /* AC and DC prediction */
- armVCM4P2_SetPredDir(
- blockIndex,
- pPredBufRow,
- pPredBufCol,
- &predDir,
- &predQP,
- pQpBuf);
-
- armRetDataErrIf(((predQP <= 0) || (predQP >= 32)), OMX_Sts_BadArgErr);
-
- flag = 1;
- if (*pSumErr < 0)
- {
- ACPredFlag = 0;
- }
- else
- {
- ACPredFlag = 1;
- }
-
- armVCM4P2_ACDCPredict(
- pTempBuf2,
- pPreACPredict,
- pPredBufRow,
- pPredBufCol,
- curQp,
- predQP,
- predDir,
- ACPredFlag,
- videoComp,
- flag,
- pSumErr);
-
- /* Reconstructing the texture data */
- omxVCM4P2_QuantInvIntra_I(
- pTempBuf1,
- curQp,
- videoComp,
- shortVideoHeader);
- omxVCM4P2_IDCT8x8blk (pTempBuf1, pTempBuf3);
- for(count = 0; count < 64; count++)
- {
- pRec[count] = armMax(0,pTempBuf3[count]);
- }
-
- return OMX_Sts_NoErr;
-}
-
-/* End of file */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/src/armVC_Version.c b/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/src/armVC_Version.c
deleted file mode 100644
index 5d93681..0000000
--- a/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/src/armVC_Version.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "omxtypes.h"
-#include "armCOMM_Version.h"
-
-#ifdef ARM_INCLUDE_VERSION_DESCRIPTIONS
-const char * const omxVC_VersionDescription = "ARM OpenMAX DL v" ARM_VERSION_STRING " Rel=" OMX_ARM_RELEASE_TAG " Arch=" OMX_ARM_BUILD_ARCHITECTURE " Tools=" OMX_ARM_BUILD_TOOLCHAIN ;
-#endif /* ARM_INCLUDE_VERSION_DESCRIPTIONS */
diff --git a/media/libstagefright/codecs/on2/h264dec/source/DecTestBench.c b/media/libstagefright/codecs/on2/h264dec/source/DecTestBench.c
deleted file mode 100644
index 55c0065..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/DecTestBench.c
+++ /dev/null
@@ -1,764 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "H264SwDecApi.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-/*------------------------------------------------------------------------------
- Module defines
-------------------------------------------------------------------------------*/
-
-/* CHECK_MEMORY_USAGE prints and sums the memory allocated in calls to
- * H264SwDecMalloc() */
-/* #define CHECK_MEMORY_USAGE */
-
-/* _NO_OUT disables output file writing */
-/* #define _NO_OUT */
-
-/* Debug prints */
-#define DEBUG(argv) printf argv
-
-/* CVS tag name for identification */
-const char tagName[256] = "$Name: FIRST_ANDROID_COPYRIGHT $";
-
-void WriteOutput(char *filename, u8 *data, u32 picSize);
-u32 NextPacket(u8 **pStrm);
-u32 CropPicture(u8 *pOutImage, u8 *pInImage,
- u32 picWidth, u32 picHeight, CropParams *pCropParams);
-
-/* Global variables for stream handling */
-u8 *streamStop = NULL;
-u32 packetize = 0;
-u32 nalUnitStream = 0;
-FILE *foutput = NULL;
-
-#ifdef SOC_DESIGNER
-
-// Initialisation function defined in InitCache.s
-extern void cache_init(void);
-
-/*------------------------------------------------------------------------------
-
- Function name: $Sub$$main
-
- Purpose:
- This function is called at the end of the C library initialisation and
- before main. Its purpose is to do any further initialisation before the
- application start.
-
-------------------------------------------------------------------------------*/
-int $Sub$$main(char argc, char * argv[])
-{
- cache_init(); // does some extra setup work setting up caches
- return $Super$$main(argc, argv); // calls the original function
-}
-#endif
-
-/*------------------------------------------------------------------------------
-
- Function name: main
-
- Purpose:
- main function of decoder testbench. Provides command line interface
- with file I/O for H.264 decoder. Prints out the usage information
- when executed without arguments.
-
-------------------------------------------------------------------------------*/
-
-int main(int argc, char **argv)
-{
-
- u32 i, tmp;
- u32 maxNumPics = 0;
- u8 *byteStrmStart;
- u8 *imageData;
- u8 *tmpImage = NULL;
- u32 strmLen;
- u32 picSize;
- H264SwDecInst decInst;
- H264SwDecRet ret;
- H264SwDecInput decInput;
- H264SwDecOutput decOutput;
- H264SwDecPicture decPicture;
- H264SwDecInfo decInfo;
- H264SwDecApiVersion decVer;
- u32 picDecodeNumber;
- u32 picDisplayNumber;
- u32 numErrors = 0;
- u32 cropDisplay = 0;
- u32 disableOutputReordering = 0;
-
- FILE *finput;
-
- char outFileName[256] = "";
-
- /* Print API version number */
- decVer = H264SwDecGetAPIVersion();
- DEBUG(("H.264 Decoder API v%d.%d\n", decVer.major, decVer.minor));
-
- /* Print tag name if '-T' argument present */
- if ( argc > 1 && strcmp(argv[1], "-T") == 0 )
- {
- DEBUG(("%s\n", tagName));
- return 0;
- }
-
- /* Check that enough command line arguments given, if not -> print usage
- * information out */
- if (argc < 2)
- {
- DEBUG((
- "Usage: %s [-Nn] [-Ooutfile] [-P] [-U] [-C] [-R] [-T] file.h264\n",
- argv[0]));
- DEBUG(("\t-Nn forces decoding to stop after n pictures\n"));
-#if defined(_NO_OUT)
- DEBUG(("\t-Ooutfile output writing disabled at compile time\n"));
-#else
- DEBUG(("\t-Ooutfile write output to \"outfile\" (default out_wxxxhyyy.yuv)\n"));
- DEBUG(("\t-Onone does not write output\n"));
-#endif
- DEBUG(("\t-P packet-by-packet mode\n"));
- DEBUG(("\t-U NAL unit stream mode\n"));
- DEBUG(("\t-C display cropped image (default decoded image)\n"));
- DEBUG(("\t-R disable DPB output reordering\n"));
- DEBUG(("\t-T to print tag name and exit\n"));
- return 0;
- }
-
- /* read command line arguments */
- for (i = 1; i < (u32)(argc-1); i++)
- {
- if ( strncmp(argv[i], "-N", 2) == 0 )
- {
- maxNumPics = (u32)atoi(argv[i]+2);
- }
- else if ( strncmp(argv[i], "-O", 2) == 0 )
- {
- strcpy(outFileName, argv[i]+2);
- }
- else if ( strcmp(argv[i], "-P") == 0 )
- {
- packetize = 1;
- }
- else if ( strcmp(argv[i], "-U") == 0 )
- {
- nalUnitStream = 1;
- }
- else if ( strcmp(argv[i], "-C") == 0 )
- {
- cropDisplay = 1;
- }
- else if ( strcmp(argv[i], "-R") == 0 )
- {
- disableOutputReordering = 1;
- }
- }
-
- /* open input file for reading, file name given by user. If file open
- * fails -> exit */
- finput = fopen(argv[argc-1],"rb");
- if (finput == NULL)
- {
- DEBUG(("UNABLE TO OPEN INPUT FILE\n"));
- return -1;
- }
-
- /* check size of the input file -> length of the stream in bytes */
- fseek(finput,0L,SEEK_END);
- strmLen = (u32)ftell(finput);
- rewind(finput);
-
- /* allocate memory for stream buffer. if unsuccessful -> exit */
- byteStrmStart = (u8 *)malloc(sizeof(u8)*strmLen);
- if (byteStrmStart == NULL)
- {
- DEBUG(("UNABLE TO ALLOCATE MEMORY\n"));
- return -1;
- }
-
- /* read input stream from file to buffer and close input file */
- fread(byteStrmStart, sizeof(u8), strmLen, finput);
- fclose(finput);
-
- /* initialize decoder. If unsuccessful -> exit */
- ret = H264SwDecInit(&decInst, disableOutputReordering);
- if (ret != H264SWDEC_OK)
- {
- DEBUG(("DECODER INITIALIZATION FAILED\n"));
- free(byteStrmStart);
- return -1;
- }
-
- /* initialize H264SwDecDecode() input structure */
- streamStop = byteStrmStart + strmLen;
- decInput.pStream = byteStrmStart;
- decInput.dataLen = strmLen;
- decInput.intraConcealmentMethod = 0;
-
- /* get pointer to next packet and the size of packet
- * (for packetize or nalUnitStream modes) */
- if ( (tmp = NextPacket(&decInput.pStream)) != 0 )
- decInput.dataLen = tmp;
-
- picDecodeNumber = picDisplayNumber = 1;
- /* main decoding loop */
- do
- {
- /* Picture ID is the picture number in decoding order */
- decInput.picId = picDecodeNumber;
-
- /* call API function to perform decoding */
- ret = H264SwDecDecode(decInst, &decInput, &decOutput);
-
- switch(ret)
- {
-
- case H264SWDEC_HDRS_RDY_BUFF_NOT_EMPTY:
- /* Stream headers were successfully decoded
- * -> stream information is available for query now */
-
- ret = H264SwDecGetInfo(decInst, &decInfo);
- if (ret != H264SWDEC_OK)
- return -1;
-
- DEBUG(("Profile %d\n", decInfo.profile));
-
- DEBUG(("Width %d Height %d\n",
- decInfo.picWidth, decInfo.picHeight));
-
- if (cropDisplay && decInfo.croppingFlag)
- {
- DEBUG(("Cropping params: (%d, %d) %dx%d\n",
- decInfo.cropParams.cropLeftOffset,
- decInfo.cropParams.cropTopOffset,
- decInfo.cropParams.cropOutWidth,
- decInfo.cropParams.cropOutHeight));
-
- /* Cropped frame size in planar YUV 4:2:0 */
- picSize = decInfo.cropParams.cropOutWidth *
- decInfo.cropParams.cropOutHeight;
- picSize = (3 * picSize)/2;
- tmpImage = malloc(picSize);
- if (tmpImage == NULL)
- return -1;
- }
- else
- {
- /* Decoder output frame size in planar YUV 4:2:0 */
- picSize = decInfo.picWidth * decInfo.picHeight;
- picSize = (3 * picSize)/2;
- }
-
- DEBUG(("videoRange %d, matrixCoefficients %d\n",
- decInfo.videoRange, decInfo.matrixCoefficients));
-
- /* update H264SwDecDecode() input structure, number of bytes
- * "consumed" is computed as difference between the new stream
- * pointer and old stream pointer */
- decInput.dataLen -=
- (u32)(decOutput.pStrmCurrPos - decInput.pStream);
- decInput.pStream = decOutput.pStrmCurrPos;
-
- /* If -O option not used, generate default file name */
- if (outFileName[0] == 0)
- sprintf(outFileName, "out_w%dh%d.yuv",
- decInfo.picWidth, decInfo.picHeight);
- break;
-
- case H264SWDEC_PIC_RDY_BUFF_NOT_EMPTY:
- /* Picture is ready and more data remains in input buffer
- * -> update H264SwDecDecode() input structure, number of bytes
- * "consumed" is computed as difference between the new stream
- * pointer and old stream pointer */
- decInput.dataLen -=
- (u32)(decOutput.pStrmCurrPos - decInput.pStream);
- decInput.pStream = decOutput.pStrmCurrPos;
- /* fall through */
-
- case H264SWDEC_PIC_RDY:
-
- /*lint -esym(644,tmpImage,picSize) variable initialized at
- * H264SWDEC_HDRS_RDY_BUFF_NOT_EMPTY case */
-
- if (ret == H264SWDEC_PIC_RDY)
- decInput.dataLen = NextPacket(&decInput.pStream);
-
- /* If enough pictures decoded -> force decoding to end
- * by setting that no more stream is available */
- if (maxNumPics && picDecodeNumber == maxNumPics)
- decInput.dataLen = 0;
-
- /* Increment decoding number for every decoded picture */
- picDecodeNumber++;
-
- /* use function H264SwDecNextPicture() to obtain next picture
- * in display order. Function is called until no more images
- * are ready for display */
- while ( H264SwDecNextPicture(decInst, &decPicture, 0) ==
- H264SWDEC_PIC_RDY )
- {
- DEBUG(("PIC %d, type %s", picDisplayNumber,
- decPicture.isIdrPicture ? "IDR" : "NON-IDR"));
- if (picDisplayNumber != decPicture.picId)
- DEBUG((", decoded pic %d", decPicture.picId));
- if (decPicture.nbrOfErrMBs)
- {
- DEBUG((", concealed %d\n", decPicture.nbrOfErrMBs));
- }
- else
- DEBUG(("\n"));
- fflush(stdout);
-
- numErrors += decPicture.nbrOfErrMBs;
-
- /* Increment display number for every displayed picture */
- picDisplayNumber++;
-
- /*lint -esym(644,decInfo) always initialized if pictures
- * available for display */
-
- /* Write output picture to file */
- imageData = (u8*)decPicture.pOutputPicture;
- if (cropDisplay && decInfo.croppingFlag)
- {
- tmp = CropPicture(tmpImage, imageData,
- decInfo.picWidth, decInfo.picHeight,
- &decInfo.cropParams);
- if (tmp)
- return -1;
- WriteOutput(outFileName, tmpImage, picSize);
- }
- else
- {
- WriteOutput(outFileName, imageData, picSize);
- }
- }
-
- break;
-
- case H264SWDEC_STRM_PROCESSED:
- case H264SWDEC_STRM_ERR:
- /* Input stream was decoded but no picture is ready
- * -> Get more data */
- decInput.dataLen = NextPacket(&decInput.pStream);
- break;
-
- default:
- DEBUG(("FATAL ERROR\n"));
- return -1;
-
- }
- /* keep decoding until all data from input stream buffer consumed */
- } while (decInput.dataLen > 0);
-
- /* if output in display order is preferred, the decoder shall be forced
- * to output pictures remaining in decoded picture buffer. Use function
- * H264SwDecNextPicture() to obtain next picture in display order. Function
- * is called until no more images are ready for display. Second parameter
- * for the function is set to '1' to indicate that this is end of the
- * stream and all pictures shall be output */
- while (H264SwDecNextPicture(decInst, &decPicture, 1) == H264SWDEC_PIC_RDY)
- {
- DEBUG(("PIC %d, type %s", picDisplayNumber,
- decPicture.isIdrPicture ? "IDR" : "NON-IDR"));
- if (picDisplayNumber != decPicture.picId)
- DEBUG((", decoded pic %d", decPicture.picId));
- if (decPicture.nbrOfErrMBs)
- {
- DEBUG((", concealed %d\n", decPicture.nbrOfErrMBs));
- }
- else
- DEBUG(("\n"));
- fflush(stdout);
-
- numErrors += decPicture.nbrOfErrMBs;
-
- /* Increment display number for every displayed picture */
- picDisplayNumber++;
-
- /* Write output picture to file */
- imageData = (u8*)decPicture.pOutputPicture;
- if (cropDisplay && decInfo.croppingFlag)
- {
- tmp = CropPicture(tmpImage, imageData,
- decInfo.picWidth, decInfo.picHeight,
- &decInfo.cropParams);
- if (tmp)
- return -1;
- WriteOutput(outFileName, tmpImage, picSize);
- }
- else
- {
- WriteOutput(outFileName, imageData, picSize);
- }
- }
-
- /* release decoder instance */
- H264SwDecRelease(decInst);
-
- if (foutput)
- fclose(foutput);
-
- /* free allocated buffers */
- free(byteStrmStart);
- free(tmpImage);
-
- DEBUG(("Output file: %s\n", outFileName));
-
- DEBUG(("DECODING DONE\n"));
- if (numErrors || picDecodeNumber == 1)
- {
- DEBUG(("ERRORS FOUND\n"));
- return 1;
- }
-
- return 0;
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: WriteOutput
-
- Purpose:
- Write picture pointed by data to file. Size of the
- picture in pixels is indicated by picSize.
-
-------------------------------------------------------------------------------*/
-void WriteOutput(char *filename, u8 *data, u32 picSize)
-{
-
- /* foutput is global file pointer */
- if (foutput == NULL)
- {
- /* open output file for writing, can be disabled with define.
- * If file open fails -> exit */
- if (strcmp(filename, "none") != 0)
- {
-#if !defined(_NO_OUT)
- foutput = fopen(filename, "wb");
- if (foutput == NULL)
- {
- DEBUG(("UNABLE TO OPEN OUTPUT FILE\n"));
- exit(100);
- }
-#endif
- }
- }
-
- if (foutput && data)
- fwrite(data, 1, picSize, foutput);
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: NextPacket
-
- Purpose:
- Get the pointer to start of next packet in input stream. Uses
- global variables 'packetize' and 'nalUnitStream' to determine the
- decoder input stream mode and 'streamStop' to determine the end
- of stream. There are three possible stream modes:
- default - the whole stream at once
- packetize - a single NAL-unit with start code prefix
- nalUnitStream - a single NAL-unit without start code prefix
-
- pStrm stores pointer to the start of previous decoder input and is
- replaced with pointer to the start of the next decoder input.
-
- Returns the packet size in bytes
-
-------------------------------------------------------------------------------*/
-u32 NextPacket(u8 **pStrm)
-{
-
- u32 index;
- u32 maxIndex;
- u32 zeroCount;
- u8 *stream;
- u8 byte;
- static u32 prevIndex=0;
-
- /* For default stream mode all the stream is in first packet */
- if (!packetize && !nalUnitStream)
- return 0;
-
- index = 0;
- stream = *pStrm + prevIndex;
- maxIndex = (u32)(streamStop - stream);
-
- if (maxIndex == 0)
- return(0);
-
- /* leading zeros of first NAL unit */
- do
- {
- byte = stream[index++];
- } while (byte != 1 && index < maxIndex);
-
- /* invalid start code prefix */
- if (index == maxIndex || index < 3)
- {
- DEBUG(("INVALID BYTE STREAM\n"));
- exit(100);
- }
-
- /* nalUnitStream is without start code prefix */
- if (nalUnitStream)
- {
- stream += index;
- maxIndex -= index;
- index = 0;
- }
-
- zeroCount = 0;
-
- /* Search stream for next start code prefix */
- /*lint -e(716) while(1) used consciously */
- while (1)
- {
- byte = stream[index++];
- if (!byte)
- zeroCount++;
-
- if ( (byte == 0x01) && (zeroCount >= 2) )
- {
- /* Start code prefix has two zeros
- * Third zero is assumed to be leading zero of next packet
- * Fourth and more zeros are assumed to be trailing zeros of this
- * packet */
- if (zeroCount > 3)
- {
- index -= 4;
- zeroCount -= 3;
- }
- else
- {
- index -= zeroCount+1;
- zeroCount = 0;
- }
- break;
- }
- else if (byte)
- zeroCount = 0;
-
- if (index == maxIndex)
- {
- break;
- }
-
- }
-
- /* Store pointer to the beginning of the packet */
- *pStrm = stream;
- prevIndex = index;
-
- /* nalUnitStream is without trailing zeros */
- if (nalUnitStream)
- index -= zeroCount;
-
- return(index);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: CropPicture
-
- Purpose:
- Perform cropping for picture. Input picture pInImage with dimensions
- picWidth x picHeight is cropped with pCropParams and the resulting
- picture is stored in pOutImage.
-
-------------------------------------------------------------------------------*/
-u32 CropPicture(u8 *pOutImage, u8 *pInImage,
- u32 picWidth, u32 picHeight, CropParams *pCropParams)
-{
-
- u32 i, j;
- u32 outWidth, outHeight;
- u8 *pOut, *pIn;
-
- if (pOutImage == NULL || pInImage == NULL || pCropParams == NULL ||
- !picWidth || !picHeight)
- {
- /* just to prevent lint warning, returning non-zero will result in
- * return without freeing the memory */
- free(pOutImage);
- return(1);
- }
-
- if ( ((pCropParams->cropLeftOffset + pCropParams->cropOutWidth) >
- picWidth ) ||
- ((pCropParams->cropTopOffset + pCropParams->cropOutHeight) >
- picHeight ) )
- {
- /* just to prevent lint warning, returning non-zero will result in
- * return without freeing the memory */
- free(pOutImage);
- return(1);
- }
-
- outWidth = pCropParams->cropOutWidth;
- outHeight = pCropParams->cropOutHeight;
-
- /* Calculate starting pointer for luma */
- pIn = pInImage + pCropParams->cropTopOffset*picWidth +
- pCropParams->cropLeftOffset;
- pOut = pOutImage;
-
- /* Copy luma pixel values */
- for (i = outHeight; i; i--)
- {
- for (j = outWidth; j; j--)
- {
- *pOut++ = *pIn++;
- }
- pIn += picWidth - outWidth;
- }
-
- outWidth >>= 1;
- outHeight >>= 1;
-
- /* Calculate starting pointer for cb */
- pIn = pInImage + picWidth*picHeight +
- pCropParams->cropTopOffset*picWidth/4 + pCropParams->cropLeftOffset/2;
-
- /* Copy cb pixel values */
- for (i = outHeight; i; i--)
- {
- for (j = outWidth; j; j--)
- {
- *pOut++ = *pIn++;
- }
- pIn += picWidth/2 - outWidth;
- }
-
- /* Calculate starting pointer for cr */
- pIn = pInImage + 5*picWidth*picHeight/4 +
- pCropParams->cropTopOffset*picWidth/4 + pCropParams->cropLeftOffset/2;
-
- /* Copy cr pixel values */
- for (i = outHeight; i; i--)
- {
- for (j = outWidth; j; j--)
- {
- *pOut++ = *pIn++;
- }
- pIn += picWidth/2 - outWidth;
- }
-
- return (0);
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: H264SwDecTrace
-
- Purpose:
- Example implementation of H264SwDecTrace function. Prototype of this
- function is given in H264SwDecApi.h. This implementation appends
- trace messages to file named 'dec_api.trc'.
-
-------------------------------------------------------------------------------*/
-void H264SwDecTrace(char *string)
-{
- FILE *fp;
-
- fp = fopen("dec_api.trc", "at");
-
- if (!fp)
- return;
-
- fwrite(string, 1, strlen(string), fp);
- fwrite("\n", 1,1, fp);
-
- fclose(fp);
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: H264SwDecMalloc
-
- Purpose:
- Example implementation of H264SwDecMalloc function. Prototype of this
- function is given in H264SwDecApi.h. This implementation uses
- library function malloc for allocation of memory.
-
-------------------------------------------------------------------------------*/
-void* H264SwDecMalloc(u32 size, u32 num)
-{
- if (size > UINT32_MAX / num) {
- return NULL;
- }
-
-#if defined(CHECK_MEMORY_USAGE)
- /* Note that if the decoder has to free and reallocate some of the buffers
- * the total value will be invalid */
- static u32 numBytes = 0;
- numBytes += size * num;
- DEBUG(("Allocated %d bytes, total %d\n", size, numBytes));
-#endif
-
- return malloc(size * num);
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: H264SwDecFree
-
- Purpose:
- Example implementation of H264SwDecFree function. Prototype of this
- function is given in H264SwDecApi.h. This implementation uses
- library function free for freeing of memory.
-
-------------------------------------------------------------------------------*/
-void H264SwDecFree(void *ptr)
-{
- free(ptr);
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: H264SwDecMemcpy
-
- Purpose:
- Example implementation of H264SwDecMemcpy function. Prototype of this
- function is given in H264SwDecApi.h. This implementation uses
- library function memcpy to copy src to dest.
-
-------------------------------------------------------------------------------*/
-void H264SwDecMemcpy(void *dest, void *src, u32 count)
-{
- memcpy(dest, src, count);
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: H264SwDecMemset
-
- Purpose:
- Example implementation of H264SwDecMemset function. Prototype of this
- function is given in H264SwDecApi.h. This implementation uses
- library function memset to set content of memory area pointed by ptr.
-
-------------------------------------------------------------------------------*/
-void H264SwDecMemset(void *ptr, i32 value, u32 count)
-{
- memset(ptr, value, count);
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/EvaluationTestBench.c b/media/libstagefright/codecs/on2/h264dec/source/EvaluationTestBench.c
deleted file mode 100644
index e756a1f..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/EvaluationTestBench.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "H264SwDecApi.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-void WriteOutput(FILE *fid, u8 *data, u32 picSize);
-
-/*------------------------------------------------------------------------------
-
- Function name: main
-
- Purpose:
- main function. Assuming that executable is named 'decoder' the usage
- is as follows
-
- decoder inputFileName
-
- , where inputFileName shall be name of file containing h264 stream
- data.
-
-------------------------------------------------------------------------------*/
-int main(int argc, char **argv)
-{
-
- u8 *byteStrmStart;
- u8 *byteStrm;
- u32 strmLen;
- u32 picSize;
- H264SwDecInst decInst;
- H264SwDecRet ret;
- H264SwDecInput decInput;
- H264SwDecOutput decOutput;
- H264SwDecPicture decPicture;
- H264SwDecInfo decInfo;
- u32 picNumber;
-
- FILE *finput;
- FILE *foutput;
-
- /* Check that enough command line arguments given, if not -> print usage
- * information out */
- if (argc < 2)
- {
- printf( "Usage: %s file.h264\n", argv[0]);
- return -1;
- }
-
- /* open output file for writing, output file named out.yuv. If file open
- * fails -> exit */
- foutput = fopen("out.yuv", "wb");
- if (foutput == NULL)
- {
- printf("UNABLE TO OPEN OUTPUT FILE\n");
- return -1;
- }
-
- /* open input file for reading, file name given by user. If file open
- * fails -> exit */
- finput = fopen(argv[argc-1], "rb");
- if (finput == NULL)
- {
- printf("UNABLE TO OPEN INPUT FILE\n");
- return -1;
- }
-
- /* check size of the input file -> length of the stream in bytes */
- fseek(finput, 0L, SEEK_END);
- strmLen = (u32)ftell(finput);
- rewind(finput);
-
- /* allocate memory for stream buffer, exit if unsuccessful */
- byteStrm = byteStrmStart = (u8 *)H264SwDecMalloc(sizeof(u8), strmLen);
- if (byteStrm == NULL)
- {
- printf("UNABLE TO ALLOCATE MEMORY\n");
- return -1;
- }
-
- /* read input stream from file to buffer and close input file */
- fread(byteStrm, sizeof(u8), strmLen, finput);
- fclose(finput);
-
- /* initialize decoder. If unsuccessful -> exit */
- ret = H264SwDecInit(&decInst, 0);
- if (ret != H264SWDEC_OK)
- {
- printf("DECODER INITIALIZATION FAILED\n");
- return -1;
- }
-
- /* initialize H264SwDecDecode() input structure */
- decInput.pStream = byteStrmStart;
- decInput.dataLen = strmLen;
- decInput.intraConcealmentMethod = 0;
-
- picNumber = 0;
-
- /* For performance measurements, read the start time (in seconds) here.
- * The decoding time should be measured over several frames and after
- * that average fps (frames/second) can be calculated.
- *
- * startTime = GetTime();
- *
- * To prevent calculating file I/O latensies as a decoding time,
- * comment out WriteOutput function call. Also prints to stdout might
- * consume considerable amount of cycles during measurement */
-
- /* main decoding loop */
- do
- {
- /* call API function to perform decoding */
- ret = H264SwDecDecode(decInst, &decInput, &decOutput);
-
- switch(ret)
- {
-
- case H264SWDEC_HDRS_RDY_BUFF_NOT_EMPTY:
-
- /* picture dimensions are available for query now */
- ret = H264SwDecGetInfo(decInst, &decInfo);
- if (ret != H264SWDEC_OK)
- return -1;
-
- /* picture size in pixels */
- picSize = decInfo.picWidth * decInfo.picHeight;
- /* memory needed for YCbCr 4:2:0 picture in bytes */
- picSize = (3 * picSize)/2;
- /* memory needed for 16-bit RGB picture in bytes
- * picSize = (decInfo.picWidth * decInfo.picHeight) * 2; */
-
- printf("Width %d Height %d\n",
- decInfo.picWidth, decInfo.picHeight);
-
- /* update H264SwDecDecode() input structure, number of bytes
- * "consumed" is computed as difference between the new stream
- * pointer and old stream pointer */
- decInput.dataLen -=
- (u32)(decOutput.pStrmCurrPos - decInput.pStream);
- decInput.pStream = decOutput.pStrmCurrPos;
- break;
-
- case H264SWDEC_PIC_RDY_BUFF_NOT_EMPTY:
- case H264SWDEC_PIC_RDY:
-
- /* update H264SwDecDecode() input structure, number of bytes
- * "consumed" is computed as difference between the new stream
- * pointer and old stream pointer */
- decInput.dataLen -=
- (u32)(decOutput.pStrmCurrPos - decInput.pStream);
- decInput.pStream = decOutput.pStrmCurrPos;
-
- /* use function H264SwDecNextPicture() to obtain next picture
- * in display order. Function is called until no more images
- * are ready for display */
- while (H264SwDecNextPicture(decInst, &decPicture, 0) ==
- H264SWDEC_PIC_RDY) { picNumber++;
-
- printf("PIC %d, type %s, concealed %d\n", picNumber,
- decPicture.isIdrPicture ? "IDR" : "NON-IDR",
- decPicture.nbrOfErrMBs);
- fflush(stdout);
-
- /* Do color conversion if needed to get display image
- * in RGB-format
- *
- * YuvToRgb( decPicture.pOutputPicture, pRgbPicture ); */
-
- /* write next display image to output file */
- WriteOutput(foutput, (u8*)decPicture.pOutputPicture,
- picSize);
- }
-
- break;
-
- case H264SWDEC_EVALUATION_LIMIT_EXCEEDED:
- /* evaluation version of the decoder has limited decoding
- * capabilities */
- printf("EVALUATION LIMIT REACHED\n");
- goto end;
-
- default:
- printf("UNRECOVERABLE ERROR\n");
- return -1;
- }
- /* keep decoding until all data from input stream buffer consumed */
- } while (decInput.dataLen > 0);
-
-end:
-
- /* if output in display order is preferred, the decoder shall be forced
- * to output pictures remaining in decoded picture buffer. Use function
- * H264SwDecNextPicture() to obtain next picture in display order. Function
- * is called until no more images are ready for display. Second parameter
- * for the function is set to '1' to indicate that this is end of the
- * stream and all pictures shall be output */
- while (H264SwDecNextPicture(decInst, &decPicture, 1) ==
- H264SWDEC_PIC_RDY) {
-
- picNumber++;
-
- printf("PIC %d, type %s, concealed %d\n", picNumber,
- decPicture.isIdrPicture ? "IDR" : "NON-IDR",
- decPicture.nbrOfErrMBs);
- fflush(stdout);
-
- /* Do color conversion if needed to get display image
- * in RGB-format
- *
- * YuvToRgb( decPicture.pOutputPicture, pRgbPicture ); */
-
- /* write next display image to output file */
- WriteOutput(foutput, (u8*)decPicture.pOutputPicture, picSize);
- }
-
- /* For performance measurements, read the end time (in seconds) here.
- *
- * endTime = GetTime();
- *
- * Now the performance can be calculated as frames per second:
- * fps = picNumber / (endTime - startTime); */
-
-
- /* release decoder instance */
- H264SwDecRelease(decInst);
-
- /* close output file */
- fclose(foutput);
-
- /* free byte stream buffer */
- free(byteStrmStart);
-
- return 0;
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: WriteOutput
-
- Purpose:
- Write picture pointed by data to file pointed by fid. Size of the
- picture in pixels is indicated by picSize.
-
-------------------------------------------------------------------------------*/
-void WriteOutput(FILE *fid, u8 *data, u32 picSize)
-{
- fwrite(data, 1, picSize, fid);
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: H264SwDecTrace
-
- Purpose:
- Example implementation of H264SwDecTrace function. Prototype of this
- function is given in H264SwDecApi.h. This implementation appends
- trace messages to file named 'dec_api.trc'.
-
-------------------------------------------------------------------------------*/
-void H264SwDecTrace(char *string)
-{
- FILE *fp;
-
- fp = fopen("dec_api.trc", "at");
-
- if (!fp)
- return;
-
- fwrite(string, 1, strlen(string), fp);
- fwrite("\n", 1,1, fp);
-
- fclose(fp);
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: H264SwDecmalloc
-
- Purpose:
- Example implementation of H264SwDecMalloc function. Prototype of this
- function is given in H264SwDecApi.h. This implementation uses
- library function malloc for allocation of memory.
-
-------------------------------------------------------------------------------*/
-void* H264SwDecMalloc(u32 size, u32 num)
-{
- if (size > UINT32_MAX / num) {
- return NULL;
- }
- return malloc(size * num);
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: H264SwDecFree
-
- Purpose:
- Example implementation of H264SwDecFree function. Prototype of this
- function is given in H264SwDecApi.h. This implementation uses
- library function free for freeing of memory.
-
-------------------------------------------------------------------------------*/
-void H264SwDecFree(void *ptr)
-{
- free(ptr);
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: H264SwDecMemcpy
-
- Purpose:
- Example implementation of H264SwDecMemcpy function. Prototype of this
- function is given in H264SwDecApi.h. This implementation uses
- library function memcpy to copy src to dest.
-
-------------------------------------------------------------------------------*/
-void H264SwDecMemcpy(void *dest, void *src, u32 count)
-{
- memcpy(dest, src, count);
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: H264SwDecMemset
-
- Purpose:
- Example implementation of H264SwDecMemset function. Prototype of this
- function is given in H264SwDecApi.h. This implementation uses
- library function memset to set content of memory area pointed by ptr.
-
-------------------------------------------------------------------------------*/
-void H264SwDecMemset(void *ptr, i32 value, u32 count)
-{
- memset(ptr, value, count);
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/H264SwDecApi.c b/media/libstagefright/codecs/on2/h264dec/source/H264SwDecApi.c
deleted file mode 100644
index a9b38e5..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/H264SwDecApi.c
+++ /dev/null
@@ -1,580 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- H264SwDecInit
- H264SwDecGetInfo
- H264SwDecRelease
- H264SwDecDecode
- H264SwDecGetAPIVersion
- H264SwDecNextPicture
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <log/log.h>
-
-#include "basetype.h"
-#include "h264bsd_container.h"
-#include "H264SwDecApi.h"
-#include "h264bsd_decoder.h"
-#include "h264bsd_util.h"
-
-#define UNUSED(x) (void)(x)
-
-/*------------------------------------------------------------------------------
- Version Information
-------------------------------------------------------------------------------*/
-
-#define H264SWDEC_MAJOR_VERSION 2
-#define H264SWDEC_MINOR_VERSION 3
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
-H264DEC_TRACE Trace H264 Decoder API function calls.
-H264DEC_EVALUATION Compile evaluation version, restricts number of frames
- that can be decoded
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-#ifdef H264DEC_TRACE
-#include <stdio.h>
-#define DEC_API_TRC(str) H264SwDecTrace(str)
-#else
-#define DEC_API_TRC(str)
-#endif
-
-#ifdef H264DEC_EVALUATION
-#define H264DEC_EVALUATION_LIMIT 500
-#endif
-
-void H264SwDecTrace(char *string) {
- UNUSED(string);
-}
-
-void* H264SwDecMalloc(u32 size, u32 num) {
- if (size > UINT32_MAX / num) {
- ALOGE("can't allocate %u * %u bytes", size, num);
- android_errorWriteLog(0x534e4554, "27855419");
- return NULL;
- }
- return malloc(size * num);
-}
-
-void H264SwDecFree(void *ptr) {
- free(ptr);
-}
-
-void H264SwDecMemcpy(void *dest, void *src, u32 count) {
- memcpy(dest, src, count);
-}
-
-void H264SwDecMemset(void *ptr, i32 value, u32 count) {
- memset(ptr, value, count);
-}
-
-
-/*------------------------------------------------------------------------------
-
- Function: H264SwDecInit()
-
- Functional description:
- Initialize decoder software. Function reserves memory for the
- decoder instance and calls h264bsdInit to initialize the
- instance data.
-
- Inputs:
- noOutputReordering flag to indicate decoder that it doesn't have
- to try to provide output pictures in display
- order, saves memory
-
- Outputs:
- decInst pointer to initialized instance is stored here
-
- Returns:
- H264SWDEC_OK successfully initialized the instance
- H264SWDEC_INITFAIL initialization failed
- H264SWDEC_PARAM_ERR invalid parameters
- H264SWDEC_MEM_FAIL memory allocation failed
-
-------------------------------------------------------------------------------*/
-
-H264SwDecRet H264SwDecInit(H264SwDecInst *decInst, u32 noOutputReordering)
-{
- u32 rv = 0;
-
- decContainer_t *pDecCont;
-
- DEC_API_TRC("H264SwDecInit#");
-
- /* check that right shift on negative numbers is performed signed */
- /*lint -save -e* following check causes multiple lint messages */
- if ( ((-1)>>1) != (-1) )
- {
- DEC_API_TRC("H264SwDecInit# ERROR: Right shift is not signed");
- return(H264SWDEC_INITFAIL);
- }
- /*lint -restore */
-
- if (decInst == NULL)
- {
- DEC_API_TRC("H264SwDecInit# ERROR: decInst == NULL");
- return(H264SWDEC_PARAM_ERR);
- }
-
- pDecCont = (decContainer_t *)H264SwDecMalloc(sizeof(decContainer_t), 1);
-
- if (pDecCont == NULL)
- {
- DEC_API_TRC("H264SwDecInit# ERROR: Memory allocation failed");
- return(H264SWDEC_MEMFAIL);
- }
-
-#ifdef H264DEC_TRACE
- sprintf(pDecCont->str, "H264SwDecInit# decInst %p noOutputReordering %d",
- (void*)decInst, noOutputReordering);
- DEC_API_TRC(pDecCont->str);
-#endif
-
- rv = h264bsdInit(&pDecCont->storage, noOutputReordering);
- if (rv != HANTRO_OK)
- {
- H264SwDecRelease(pDecCont);
- return(H264SWDEC_MEMFAIL);
- }
-
- pDecCont->decStat = INITIALIZED;
- pDecCont->picNumber = 0;
-
-#ifdef H264DEC_TRACE
- sprintf(pDecCont->str, "H264SwDecInit# OK: return %p", (void*)pDecCont);
- DEC_API_TRC(pDecCont->str);
-#endif
-
- *decInst = (decContainer_t *)pDecCont;
-
- return(H264SWDEC_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: H264SwDecGetInfo()
-
- Functional description:
- This function provides read access to decoder information. This
- function should not be called before H264SwDecDecode function has
- indicated that headers are ready.
-
- Inputs:
- decInst decoder instance
-
- Outputs:
- pDecInfo pointer to info struct where data is written
-
- Returns:
- H264SWDEC_OK success
- H264SWDEC_PARAM_ERR invalid parameters
- H264SWDEC_HDRS_NOT_RDY information not available yet
-
-------------------------------------------------------------------------------*/
-
-H264SwDecRet H264SwDecGetInfo(H264SwDecInst decInst, H264SwDecInfo *pDecInfo)
-{
-
- storage_t *pStorage;
-
- DEC_API_TRC("H264SwDecGetInfo#");
-
- if (decInst == NULL || pDecInfo == NULL)
- {
- DEC_API_TRC("H264SwDecGetInfo# ERROR: decInst or pDecInfo is NULL");
- return(H264SWDEC_PARAM_ERR);
- }
-
- pStorage = &(((decContainer_t *)decInst)->storage);
-
- if (pStorage->activeSps == NULL || pStorage->activePps == NULL)
- {
- DEC_API_TRC("H264SwDecGetInfo# ERROR: Headers not decoded yet");
- return(H264SWDEC_HDRS_NOT_RDY);
- }
-
-#ifdef H264DEC_TRACE
- sprintf(((decContainer_t*)decInst)->str,
- "H264SwDecGetInfo# decInst %p pDecInfo %p", decInst, (void*)pDecInfo);
- DEC_API_TRC(((decContainer_t*)decInst)->str);
-#endif
-
- /* h264bsdPicWidth and -Height return dimensions in macroblock units,
- * picWidth and -Height in pixels */
- pDecInfo->picWidth = h264bsdPicWidth(pStorage) << 4;
- pDecInfo->picHeight = h264bsdPicHeight(pStorage) << 4;
- pDecInfo->videoRange = h264bsdVideoRange(pStorage);
- pDecInfo->matrixCoefficients = h264bsdMatrixCoefficients(pStorage);
-
- h264bsdCroppingParams(pStorage,
- &pDecInfo->croppingFlag,
- &pDecInfo->cropParams.cropLeftOffset,
- &pDecInfo->cropParams.cropOutWidth,
- &pDecInfo->cropParams.cropTopOffset,
- &pDecInfo->cropParams.cropOutHeight);
-
- /* sample aspect ratio */
- h264bsdSampleAspectRatio(pStorage,
- &pDecInfo->parWidth,
- &pDecInfo->parHeight);
-
- /* profile */
- pDecInfo->profile = h264bsdProfile(pStorage);
-
- DEC_API_TRC("H264SwDecGetInfo# OK");
-
- return(H264SWDEC_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: H264SwDecRelease()
-
- Functional description:
- Release the decoder instance. Function calls h264bsdShutDown to
- release instance data and frees the memory allocated for the
- instance.
-
- Inputs:
- decInst Decoder instance
-
- Outputs:
- none
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-
-void H264SwDecRelease(H264SwDecInst decInst)
-{
-
- decContainer_t *pDecCont;
-
- DEC_API_TRC("H264SwDecRelease#");
-
- if (decInst == NULL)
- {
- DEC_API_TRC("H264SwDecRelease# ERROR: decInst == NULL");
- return;
- }
-
- pDecCont = (decContainer_t*)decInst;
-
-#ifdef H264DEC_TRACE
- sprintf(pDecCont->str, "H264SwDecRelease# decInst %p",decInst);
- DEC_API_TRC(pDecCont->str);
-#endif
-
- h264bsdShutdown(&pDecCont->storage);
-
- H264SwDecFree(pDecCont);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: H264SwDecDecode
-
- Functional description:
- Decode stream data. Calls h264bsdDecode to do the actual decoding.
-
- Input:
- decInst decoder instance
- pInput pointer to input struct
-
- Outputs:
- pOutput pointer to output struct
-
- Returns:
- H264SWDEC_NOT_INITIALIZED decoder instance not initialized yet
- H264SWDEC_PARAM_ERR invalid parameters
-
- H264SWDEC_STRM_PROCESSED stream buffer decoded
- H264SWDEC_HDRS_RDY_BUFF_NOT_EMPTY headers decoded,
- stream buffer not finished
- H264SWDEC_PIC_RDY decoding of a picture finished
- H264SWDEC_PIC_RDY_BUFF_NOT_EMPTY decoding of a picture finished,
- stream buffer not finished
- H264SWDEC_STRM_ERR serious error in decoding, no
- valid parameter sets available
- to decode picture data
- H264SWDEC_EVALUATION_LIMIT_EXCEEDED this can only occur when
- evaluation version is used,
- max number of frames reached
-
-------------------------------------------------------------------------------*/
-
-H264SwDecRet H264SwDecDecode(H264SwDecInst decInst, H264SwDecInput *pInput,
- H264SwDecOutput *pOutput)
-{
-
- decContainer_t *pDecCont;
- u32 strmLen;
- u32 numReadBytes;
- u8 *tmpStream;
- u32 decResult = 0;
- H264SwDecRet returnValue = H264SWDEC_STRM_PROCESSED;
-
- DEC_API_TRC("H264SwDecDecode#");
-
- /* Check that function input parameters are valid */
- if (pInput == NULL || pOutput == NULL)
- {
- DEC_API_TRC("H264SwDecDecode# ERROR: pInput or pOutput is NULL");
- return(H264SWDEC_PARAM_ERR);
- }
-
- if ((pInput->pStream == NULL) || (pInput->dataLen == 0))
- {
- DEC_API_TRC("H264SwDecDecode# ERROR: Invalid input parameters");
- return(H264SWDEC_PARAM_ERR);
- }
-
- pDecCont = (decContainer_t *)decInst;
-
- /* Check if decoder is in an incorrect mode */
- if (decInst == NULL || pDecCont->decStat == UNINITIALIZED)
- {
- DEC_API_TRC("H264SwDecDecode# ERROR: Decoder not initialized");
- return(H264SWDEC_NOT_INITIALIZED);
- }
-
-#ifdef H264DEC_EVALUATION
- if (pDecCont->picNumber >= H264DEC_EVALUATION_LIMIT)
- return(H264SWDEC_EVALUATION_LIMIT_EXCEEDED);
-#endif
-
-#ifdef H264DEC_TRACE
- sprintf(pDecCont->str, "H264SwDecDecode# decInst %p pInput %p pOutput %p",
- decInst, (void*)pInput, (void*)pOutput);
- DEC_API_TRC(pDecCont->str);
-#endif
-
- pOutput->pStrmCurrPos = NULL;
-
- numReadBytes = 0;
- strmLen = pInput->dataLen;
- tmpStream = pInput->pStream;
- pDecCont->storage.intraConcealmentFlag = pInput->intraConcealmentMethod;
-
- do
- {
- /* Return HDRS_RDY after DPB flush caused by new SPS */
- if (pDecCont->decStat == NEW_HEADERS)
- {
- decResult = H264BSD_HDRS_RDY;
- pDecCont->decStat = INITIALIZED;
- }
- else /* Continue decoding normally */
- {
- decResult = h264bsdDecode(&pDecCont->storage, tmpStream, strmLen,
- pInput->picId, &numReadBytes);
- }
- tmpStream += numReadBytes;
- /* check if too many bytes are read from stream */
- if ( (i32)(strmLen - numReadBytes) >= 0 )
- strmLen -= numReadBytes;
- else
- strmLen = 0;
-
- pOutput->pStrmCurrPos = tmpStream;
-
- switch (decResult)
- {
- case H264BSD_HDRS_RDY:
-
- if(pDecCont->storage.dpb->flushed &&
- pDecCont->storage.dpb->numOut !=
- pDecCont->storage.dpb->outIndex)
- {
- /* output first all DPB stored pictures
- * DPB flush caused by new SPS */
- pDecCont->storage.dpb->flushed = 0;
- pDecCont->decStat = NEW_HEADERS;
- returnValue = H264SWDEC_PIC_RDY_BUFF_NOT_EMPTY;
- strmLen = 0;
- }
- else
- {
- returnValue = H264SWDEC_HDRS_RDY_BUFF_NOT_EMPTY;
- strmLen = 0;
- }
- break;
-
- case H264BSD_PIC_RDY:
- pDecCont->picNumber++;
-
- if (strmLen == 0)
- returnValue = H264SWDEC_PIC_RDY;
- else
- returnValue = H264SWDEC_PIC_RDY_BUFF_NOT_EMPTY;
-
- strmLen = 0;
- break;
-
- case H264BSD_PARAM_SET_ERROR:
- if ( !h264bsdCheckValidParamSets(&pDecCont->storage) &&
- strmLen == 0 )
- {
- returnValue = H264SWDEC_STRM_ERR;
- }
- break;
- case H264BSD_MEMALLOC_ERROR:
- {
- returnValue = H264SWDEC_MEMFAIL;
- strmLen = 0;
- }
- break;
- default:
- break;
- }
-
- } while (strmLen);
-
-#ifdef H264DEC_TRACE
- sprintf(pDecCont->str, "H264SwDecDecode# OK: DecResult %d",
- returnValue);
- DEC_API_TRC(pDecCont->str);
-#endif
-
- return(returnValue);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: H264SwDecGetAPIVersion
-
- Functional description:
- Return version information of the API
-
- Inputs:
- none
-
- Outputs:
- none
-
- Returns:
- API version
-
-------------------------------------------------------------------------------*/
-
-H264SwDecApiVersion H264SwDecGetAPIVersion()
-{
- H264SwDecApiVersion ver;
-
- ver.major = H264SWDEC_MAJOR_VERSION;
- ver.minor = H264SWDEC_MINOR_VERSION;
-
- return(ver);
-}
-
-/*------------------------------------------------------------------------------
-
- Function: H264SwDecNextPicture
-
- Functional description:
- Get next picture in display order if any available.
-
- Input:
- decInst decoder instance.
- flushBuffer force output of all buffered pictures
-
- Output:
- pOutput pointer to output structure
-
- Returns:
- H264SWDEC_OK no pictures available for display
- H264SWDEC_PIC_RDY picture available for display
- H264SWDEC_PARAM_ERR invalid parameters
-
-------------------------------------------------------------------------------*/
-
-H264SwDecRet H264SwDecNextPicture(H264SwDecInst decInst,
- H264SwDecPicture *pOutput, u32 flushBuffer)
-{
-
- decContainer_t *pDecCont;
- u32 numErrMbs, isIdrPic, picId;
- u32 *pOutPic;
-
- DEC_API_TRC("H264SwDecNextPicture#");
-
- if (decInst == NULL || pOutput == NULL)
- {
- DEC_API_TRC("H264SwDecNextPicture# ERROR: decInst or pOutput is NULL");
- return(H264SWDEC_PARAM_ERR);
- }
-
- pDecCont = (decContainer_t*)decInst;
-
-#ifdef H264DEC_TRACE
- sprintf(pDecCont->str, "H264SwDecNextPicture# decInst %p pOutput %p %s %d",
- decInst, (void*)pOutput, "flushBuffer", flushBuffer);
- DEC_API_TRC(pDecCont->str);
-#endif
-
- if (flushBuffer)
- h264bsdFlushBuffer(&pDecCont->storage);
-
- pOutPic = (u32*)h264bsdNextOutputPicture(&pDecCont->storage, &picId,
- &isIdrPic, &numErrMbs);
-
- if (pOutPic == NULL)
- {
- DEC_API_TRC("H264SwDecNextPicture# OK: return H264SWDEC_OK");
- return(H264SWDEC_OK);
- }
- else
- {
- pOutput->pOutputPicture = pOutPic;
- pOutput->picId = picId;
- pOutput->isIdrPicture = isIdrPic;
- pOutput->nbrOfErrMBs = numErrMbs;
- DEC_API_TRC("H264SwDecNextPicture# OK: return H264SWDEC_PIC_RDY");
- return(H264SWDEC_PIC_RDY);
- }
-
-}
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/TestBenchMultipleInstance.c b/media/libstagefright/codecs/on2/h264dec/source/TestBenchMultipleInstance.c
deleted file mode 100644
index 9a386bb..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/TestBenchMultipleInstance.c
+++ /dev/null
@@ -1,534 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* CVS tag name for identification */
-const char tagName[256] = "$Name: FIRST_ANDROID_COPYRIGHT $";
-
-#include "H264SwDecApi.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define DEBUG(argv) printf argv
-
-/* _NO_OUT disables output file writing */
-#ifdef __arm
-#define _NO_OUT
-#endif
-
-/*------------------------------------------------------------------------------
-
-------------------------------------------------------------------------------*/
-void WriteOutput(FILE *fid, u8 *data, u32 picSize);
-
-u32 CropPicture(u8 *pOutImage, u8 *pInImage,
- u32 picWidth, u32 picHeight, CropParams *pCropParams);
-
-void CropWriteOutput(FILE *fid, u8 *imageData, u32 cropDisplay,
- H264SwDecInfo *decInfo);
-
-typedef struct
-{
- H264SwDecInst decInst;
- H264SwDecInput decInput;
- H264SwDecOutput decOutput;
- H264SwDecPicture decPicture;
- H264SwDecInfo decInfo;
- FILE *foutput;
- char outFileName[256];
- u8 *byteStrmStart;
- u32 picNumber;
-} Decoder;
-
-
-/*------------------------------------------------------------------------------
-
-------------------------------------------------------------------------------*/
-int main(int argc, char **argv)
-{
-
- i32 instCount, instRunning;
- i32 i;
- u32 maxNumPics;
- u32 strmLen;
- H264SwDecRet ret;
- u32 numErrors = 0;
- u32 cropDisplay = 0;
- u32 disableOutputReordering = 0;
- FILE *finput;
- Decoder **decoder;
- char outFileName[256] = "out.yuv";
-
-
- if ( argc > 1 && strcmp(argv[1], "-T") == 0 )
- {
- fprintf(stderr, "%s\n", tagName);
- return 0;
- }
-
- if (argc < 2)
- {
- DEBUG((
- "Usage: %s [-Nn] [-Ooutfile] [-P] [-U] [-C] [-R] [-T] file1.264 [file2.264] .. [fileN.264]\n",
- argv[0]));
- DEBUG(("\t-Nn forces decoding to stop after n pictures\n"));
-#if defined(_NO_OUT)
- DEBUG(("\t-Ooutfile output writing disabled at compile time\n"));
-#else
- DEBUG(("\t-Ooutfile write output to \"outfile\" (default out.yuv)\n"));
- DEBUG(("\t-Onone does not write output\n"));
-#endif
- DEBUG(("\t-C display cropped image (default decoded image)\n"));
- DEBUG(("\t-R disable DPB output reordering\n"));
- DEBUG(("\t-T to print tag name and exit\n"));
- exit(100);
- }
-
- instCount = argc - 1;
-
- /* read command line arguments */
- maxNumPics = 0;
- for (i = 1; i < (argc-1); i++)
- {
- if ( strncmp(argv[i], "-N", 2) == 0 )
- {
- maxNumPics = (u32)atoi(argv[i]+2);
- instCount--;
- }
- else if ( strncmp(argv[i], "-O", 2) == 0 )
- {
- strcpy(outFileName, argv[i]+2);
- instCount--;
- }
- else if ( strcmp(argv[i], "-C") == 0 )
- {
- cropDisplay = 1;
- instCount--;
- }
- else if ( strcmp(argv[i], "-R") == 0 )
- {
- disableOutputReordering = 1;
- instCount--;
- }
- }
-
- if (instCount < 1)
- {
- DEBUG(("No input files\n"));
- exit(100);
- }
-
- /* allocate memory for multiple decoder instances
- * one instance for every stream file */
- decoder = (Decoder **)malloc(sizeof(Decoder*)*(u32)instCount);
- if (decoder == NULL)
- {
- DEBUG(("Unable to allocate memory\n"));
- exit(100);
- }
-
- /* prepare each decoder instance */
- for (i = 0; i < instCount; i++)
- {
- decoder[i] = (Decoder *)calloc(1, sizeof(Decoder));
-
- /* open input file */
- finput = fopen(argv[argc-instCount+i],"rb");
- if (finput == NULL)
- {
- DEBUG(("Unable to open input file <%s>\n", argv[argc-instCount+i]));
- exit(100);
- }
-
- DEBUG(("Reading input file[%d] %s\n", i, argv[argc-instCount+i]));
-
- /* read input stream to buffer */
- fseek(finput,0L,SEEK_END);
- strmLen = (u32)ftell(finput);
- rewind(finput);
- decoder[i]->byteStrmStart = (u8 *)malloc(sizeof(u8)*strmLen);
- if (decoder[i]->byteStrmStart == NULL)
- {
- DEBUG(("Unable to allocate memory\n"));
- exit(100);
- }
- fread(decoder[i]->byteStrmStart, sizeof(u8), strmLen, finput);
- fclose(finput);
-
- /* open output file */
- if (strcmp(outFileName, "none") != 0)
- {
-#if defined(_NO_OUT)
- decoder[i]->foutput = NULL;
-#else
- sprintf(decoder[i]->outFileName, "%s%i", outFileName, i);
- decoder[i]->foutput = fopen(decoder[i]->outFileName, "wb");
- if (decoder[i]->foutput == NULL)
- {
- DEBUG(("Unable to open output file\n"));
- exit(100);
- }
-#endif
- }
-
- ret = H264SwDecInit(&(decoder[i]->decInst), disableOutputReordering);
-
- if (ret != H264SWDEC_OK)
- {
- DEBUG(("Init failed %d\n", ret));
- exit(100);
- }
-
- decoder[i]->decInput.pStream = decoder[i]->byteStrmStart;
- decoder[i]->decInput.dataLen = strmLen;
- decoder[i]->decInput.intraConcealmentMethod = 0;
-
- }
-
- /* main decoding loop */
- do
- {
- /* decode once using each instance */
- for (i = 0; i < instCount; i++)
- {
- ret = H264SwDecDecode(decoder[i]->decInst,
- &(decoder[i]->decInput),
- &(decoder[i]->decOutput));
-
- switch(ret)
- {
-
- case H264SWDEC_HDRS_RDY_BUFF_NOT_EMPTY:
-
- ret = H264SwDecGetInfo(decoder[i]->decInst,
- &(decoder[i]->decInfo));
- if (ret != H264SWDEC_OK)
- exit(1);
-
- if (cropDisplay && decoder[i]->decInfo.croppingFlag)
- {
- DEBUG(("Decoder[%d] Cropping params: (%d, %d) %dx%d\n",
- i,
- decoder[i]->decInfo.cropParams.cropLeftOffset,
- decoder[i]->decInfo.cropParams.cropTopOffset,
- decoder[i]->decInfo.cropParams.cropOutWidth,
- decoder[i]->decInfo.cropParams.cropOutHeight));
- }
-
- DEBUG(("Decoder[%d] Width %d Height %d\n", i,
- decoder[i]->decInfo.picWidth,
- decoder[i]->decInfo.picHeight));
-
- DEBUG(("Decoder[%d] videoRange %d, matricCoefficients %d\n",
- i, decoder[i]->decInfo.videoRange,
- decoder[i]->decInfo.matrixCoefficients));
- decoder[i]->decInput.dataLen -=
- (u32)(decoder[i]->decOutput.pStrmCurrPos -
- decoder[i]->decInput.pStream);
- decoder[i]->decInput.pStream =
- decoder[i]->decOutput.pStrmCurrPos;
- break;
-
- case H264SWDEC_PIC_RDY_BUFF_NOT_EMPTY:
- decoder[i]->decInput.dataLen -=
- (u32)(decoder[i]->decOutput.pStrmCurrPos -
- decoder[i]->decInput.pStream);
- decoder[i]->decInput.pStream =
- decoder[i]->decOutput.pStrmCurrPos;
- /* fall through */
- case H264SWDEC_PIC_RDY:
- if (ret == H264SWDEC_PIC_RDY)
- decoder[i]->decInput.dataLen = 0;
-
- ret = H264SwDecGetInfo(decoder[i]->decInst,
- &(decoder[i]->decInfo));
- if (ret != H264SWDEC_OK)
- exit(1);
-
- while (H264SwDecNextPicture(decoder[i]->decInst,
- &(decoder[i]->decPicture), 0) == H264SWDEC_PIC_RDY)
- {
- decoder[i]->picNumber++;
-
- numErrors += decoder[i]->decPicture.nbrOfErrMBs;
-
- DEBUG(("Decoder[%d] PIC %d, type %s, concealed %d\n",
- i, decoder[i]->picNumber,
- decoder[i]->decPicture.isIdrPicture
- ? "IDR" : "NON-IDR",
- decoder[i]->decPicture.nbrOfErrMBs));
- fflush(stdout);
-
- CropWriteOutput(decoder[i]->foutput,
- (u8*)decoder[i]->decPicture.pOutputPicture,
- cropDisplay, &(decoder[i]->decInfo));
- }
-
- if (maxNumPics && decoder[i]->picNumber == maxNumPics)
- decoder[i]->decInput.dataLen = 0;
- break;
-
- case H264SWDEC_STRM_PROCESSED:
- case H264SWDEC_STRM_ERR:
- case H264SWDEC_PARAM_ERR:
- decoder[i]->decInput.dataLen = 0;
- break;
-
- default:
- DEBUG(("Decoder[%d] FATAL ERROR\n", i));
- exit(10);
- break;
-
- }
- }
-
- /* check if any of the instances is still running (=has more data) */
- instRunning = instCount;
- for (i = 0; i < instCount; i++)
- {
- if (decoder[i]->decInput.dataLen == 0)
- instRunning--;
- }
-
- } while (instRunning);
-
-
- /* get last frames and close each instance */
- for (i = 0; i < instCount; i++)
- {
- while (H264SwDecNextPicture(decoder[i]->decInst,
- &(decoder[i]->decPicture), 1) == H264SWDEC_PIC_RDY)
- {
- decoder[i]->picNumber++;
-
- DEBUG(("Decoder[%d] PIC %d, type %s, concealed %d\n",
- i, decoder[i]->picNumber,
- decoder[i]->decPicture.isIdrPicture
- ? "IDR" : "NON-IDR",
- decoder[i]->decPicture.nbrOfErrMBs));
- fflush(stdout);
-
- CropWriteOutput(decoder[i]->foutput,
- (u8*)decoder[i]->decPicture.pOutputPicture,
- cropDisplay, &(decoder[i]->decInfo));
- }
-
- H264SwDecRelease(decoder[i]->decInst);
-
- if (decoder[i]->foutput)
- fclose(decoder[i]->foutput);
-
- free(decoder[i]->byteStrmStart);
-
- free(decoder[i]);
- }
-
- free(decoder);
-
- if (numErrors)
- return 1;
- else
- return 0;
-
-}
-
-/*------------------------------------------------------------------------------
-
-------------------------------------------------------------------------------*/
-void CropWriteOutput(FILE *foutput, u8 *imageData, u32 cropDisplay,
- H264SwDecInfo *decInfo)
-{
- u8 *tmpImage = NULL;
- u32 tmp, picSize;
-
- if (cropDisplay && decInfo->croppingFlag)
- {
- picSize = decInfo->cropParams.cropOutWidth *
- decInfo->cropParams.cropOutHeight;
- picSize = (3 * picSize)/2;
- tmpImage = malloc(picSize);
- if (tmpImage == NULL)
- exit(1);
- tmp = CropPicture(tmpImage, imageData,
- decInfo->picWidth, decInfo->picHeight,
- &(decInfo->cropParams));
- if (tmp)
- exit(1);
- WriteOutput(foutput, tmpImage, picSize);
- free(tmpImage);
- }
- else
- {
- picSize = decInfo->picWidth * decInfo->picHeight;
- picSize = (3 * picSize)/2;
- WriteOutput(foutput, imageData, picSize);
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
-------------------------------------------------------------------------------*/
-void WriteOutput(FILE *fid, u8 *data, u32 picSize)
-{
- if (fid)
- fwrite(data, 1, picSize, fid);
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: H264SwDecTrace
-
-------------------------------------------------------------------------------*/
-void H264SwDecTrace(char *string)
-{
- FILE *fp;
-
- fp = fopen("dec_api.trc", "at");
-
- if (!fp)
- return;
-
- fwrite(string, 1, strlen(string), fp);
- fwrite("\n", 1,1, fp);
-
- fclose(fp);
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: H264SwDecmalloc
-
-------------------------------------------------------------------------------*/
-void* H264SwDecMalloc(u32 size, u32 num)
-{
- if (size > UINT32_MAX / num) {
- return NULL;
- }
- return malloc(size * num);
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: H264SwDecFree
-
-------------------------------------------------------------------------------*/
-void H264SwDecFree(void *ptr)
-{
- free(ptr);
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: H264SwDecMemcpy
-
-------------------------------------------------------------------------------*/
-void H264SwDecMemcpy(void *dest, void *src, u32 count)
-{
- memcpy(dest, src, count);
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: H264SwDecMemset
-
-------------------------------------------------------------------------------*/
-void H264SwDecMemset(void *ptr, i32 value, u32 count)
-{
- memset(ptr, value, count);
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: CropPicture
-
-------------------------------------------------------------------------------*/
-u32 CropPicture(u8 *pOutImage, u8 *pInImage,
- u32 picWidth, u32 picHeight, CropParams *pCropParams)
-{
-
- u32 i, j;
- u32 outWidth, outHeight;
- u8 *pOut, *pIn;
-
- if (pOutImage == NULL || pInImage == NULL || pCropParams == NULL ||
- !picWidth || !picHeight)
- {
- /* due to lint warning */
- free(pOutImage);
- return(1);
- }
-
- if ( ((pCropParams->cropLeftOffset + pCropParams->cropOutWidth) >
- picWidth ) ||
- ((pCropParams->cropTopOffset + pCropParams->cropOutHeight) >
- picHeight ) )
- {
- /* due to lint warning */
- free(pOutImage);
- return(1);
- }
-
- outWidth = pCropParams->cropOutWidth;
- outHeight = pCropParams->cropOutHeight;
-
- pIn = pInImage + pCropParams->cropTopOffset*picWidth +
- pCropParams->cropLeftOffset;
- pOut = pOutImage;
-
- /* luma */
- for (i = outHeight; i; i--)
- {
- for (j = outWidth; j; j--)
- {
- *pOut++ = *pIn++;
- }
- pIn += picWidth - outWidth;
- }
-
- outWidth >>= 1;
- outHeight >>= 1;
-
- pIn = pInImage + picWidth*picHeight +
- pCropParams->cropTopOffset*picWidth/4 + pCropParams->cropLeftOffset/2;
-
- /* cb */
- for (i = outHeight; i; i--)
- {
- for (j = outWidth; j; j--)
- {
- *pOut++ = *pIn++;
- }
- pIn += picWidth/2 - outWidth;
- }
-
- pIn = pInImage + 5*picWidth*picHeight/4 +
- pCropParams->cropTopOffset*picWidth/4 + pCropParams->cropLeftOffset/2;
-
- /* cr */
- for (i = outHeight; i; i--)
- {
- for (j = outWidth; j; j--)
- {
- *pOut++ = *pIn++;
- }
- pIn += picWidth/2 - outWidth;
- }
-
- return (0);
-
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_chroma_hor.s b/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_chroma_hor.s
deleted file mode 100644
index 634a484..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_chroma_hor.s
+++ /dev/null
@@ -1,298 +0,0 @@
-; Copyright (C) 2009 The Android Open Source Project
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-
-;-------------------------------------------------------------------------------
-;--
-;-- Abstract : ARMv6 optimized version of h264bsdInterpolateChromaHor function
-;--
-;-------------------------------------------------------------------------------
-
-
- IF :DEF: H264DEC_WINASM
- ;// We dont use REQUIRE8 and PRESERVE8 for winasm
- ELSE
- REQUIRE8
- PRESERVE8
- ENDIF
-
- AREA |.text|, CODE
-
-
-;// h264bsdInterpolateChromaHor register allocation
-
-ref RN 0
-ptrA RN 0
-
-mb RN 1
-block RN 1
-
-x0 RN 2
-count RN 2
-
-y0 RN 3
-valX RN 3
-
-width RN 4
-
-height RN 5
-tmp7 RN 5
-
-chrPW RN 6
-tmp8 RN 6
-
-tmp1 RN 7
-chrPH RN 7
-
-tmp2 RN 8
-
-tmp3 RN 9
-
-tmp4 RN 10
-
-tmp5 RN 11
-
-tmp6 RN 12
-
-c32 RN 14
-xFrac RN 14
-
-;// Function exports and imports
-
- IMPORT h264bsdFillBlock
-
- EXPORT h264bsdInterpolateChromaHor
-
-;// Function arguments
-;//
-;// u8 *ref, : 0xc4
-;// u8 *predPartChroma, : 0xc8
-;// i32 x0, : 0xcc
-;// i32 y0, : 0xd0
-;// u32 width, : 0xf8
-;// u32 height, : 0xfc
-;// u32 xFrac, : 0x100
-;// u32 chromaPartWidth, : 0x104
-;// u32 chromaPartHeight : 0x108
-
-h264bsdInterpolateChromaHor
- STMFD sp!, {r0-r11,lr}
- SUB sp, sp, #0xc4
-
- LDR chrPW, [sp, #0x104] ;// chromaPartWidth
- LDR width, [sp, #0xf8] ;// width
- CMP x0, #0
- BLT do_fill
-
- ADD tmp6, x0, chrPW ;// tmp6 = x0+ chromaPartWidth
- ADD tmp6, tmp6, #1 ;// tmp6 = x0 + chromaPartWidth + 1
- CMP tmp6, width ;// x0+chromaPartWidth+1 > width
- BHI do_fill
-
- CMP y0, #0
- BLT do_fill
- LDR chrPH, [sp, #0x108] ;// chromaPartHeight
- LDR height, [sp, #0xfc] ;// height
- ADD tmp6, y0, chrPH ;// tmp6 = y0 + chromaPartHeight
- CMP tmp6, height
- BLS skip_fill
-
-do_fill
- LDR chrPH, [sp, #0x108] ;// chromaPartHeight
- LDR height, [sp, #0xfc] ;// height
- ADD tmp8, chrPW, #1 ;// tmp8 = chromaPartWidth+1
- MOV tmp2, tmp8 ;// tmp2 = chromaPartWidth+1
- STMIA sp,{width,height,tmp8,chrPH,tmp2}
- ADD block, sp, #0x1c ;// block
- BL h264bsdFillBlock
-
- LDR x0, [sp, #0xcc]
- LDR y0, [sp, #0xd0]
- LDR ref, [sp, #0xc4] ;// ref
- STMIA sp,{width,height,tmp8,chrPH,tmp2}
- ADD block, sp, #0x1c ;// block
- MLA ref, height, width, ref ;// ref += width * height;
- MLA block, chrPH, tmp8, block;// block + (chromaPH)*(chromaPW+1)
- BL h264bsdFillBlock
-
- MOV x0, #0 ;// x0 = 0
- MOV y0, #0 ;// y0 = 0
- STR x0, [sp, #0xcc]
- STR y0, [sp, #0xd0]
- ADD ref, sp, #0x1c ;// ref = block
- STR ref, [sp, #0xc4] ;// ref
-
- STR chrPH, [sp, #0xfc] ;// height
- STR tmp8, [sp, #0xf8] ;// width
- MOV width, tmp8
- SUB chrPW, chrPW, #1
-
-skip_fill
- MLA tmp3, y0, width, x0 ;// tmp3 = y0*width+x0
- LDR xFrac, [sp, #0x100] ;// xFrac
- ADD ptrA, ref, tmp3 ;// ptrA = ref + y0*width+x0
- RSB valX, xFrac, #8 ;// valX = 8-xFrac
-
- LDR mb, [sp, #0xc8] ;// predPartChroma
-
-
- ;// pack values to count register
- ;// [31:28] loop_x (chromaPartWidth-1)
- ;// [27:24] loop_y (chromaPartHeight-1)
- ;// [23:20] chromaPartWidth-1
- ;// [19:16] chromaPartHeight-1
- ;// [15:00] nothing
-
- SUB tmp2, chrPH, #1 ;// chromaPartHeight-1
- SUB tmp1, chrPW, #1 ;// chromaPartWidth-1
- ADD count, count, tmp2, LSL #16 ;// chromaPartHeight-1
- ADD count, count, tmp2, LSL #24 ;// loop_y
- ADD count, count, tmp1, LSL #20 ;// chromaPartWidth-1
- AND tmp2, count, #0x00F00000 ;// loop_x
- PKHBT valX, valX, xFrac, LSL #16 ;// |xFrac|valX |
- MOV valX, valX, LSL #3 ;// multiply by 8 in advance
- MOV c32, #32
-
-
- ;///////////////////////////////////////////////////////////////////////////
- ;// Cb
- ;///////////////////////////////////////////////////////////////////////////
-
- ;// 2x2 pels per iteration
- ;// bilinear vertical interpolation
-
-loop1_y
- ADD count, count, tmp2, LSL #8
- LDRB tmp1, [ptrA, width]
- LDRB tmp2, [ptrA], #1
-
-loop1_x
- LDRB tmp3, [ptrA, width]
- LDRB tmp4, [ptrA], #1
-
- PKHBT tmp5, tmp1, tmp3, LSL #16
- PKHBT tmp6, tmp2, tmp4, LSL #16
-
- LDRB tmp1, [ptrA, width]
- LDRB tmp2, [ptrA], #1
-
- SMLAD tmp5, tmp5, valX, c32 ;// multiply
- SMLAD tmp6, tmp6, valX, c32 ;// multiply
-
- PKHBT tmp7, tmp3, tmp1, LSL #16
- PKHBT tmp8, tmp4, tmp2, LSL #16
-
- SMLAD tmp7, tmp7, valX, c32 ;// multiply
- SMLAD tmp8, tmp8, valX, c32 ;// multiply
-
- MOV tmp5, tmp5, LSR #6 ;// scale down
- STRB tmp5, [mb,#8] ;// store row 2 col 1
-
- MOV tmp6, tmp6, LSR #6 ;// scale down
- STRB tmp6, [mb],#1 ;// store row 1 col 1
-
- MOV tmp7, tmp7, LSR #6 ;// scale down
- STRB tmp7, [mb,#8] ;// store row 2 col 2
-
- MOV tmp8, tmp8, LSR #6 ;// scale down
- STRB tmp8, [mb],#1 ;// store row 1 col 2
-
- SUBS count, count, #2<<28
- BCS loop1_x
-
- AND tmp2, count, #0x00F00000
-
- ADDS mb, mb, #16
- SBC mb, mb, tmp2, LSR #20
- ADD ptrA, ptrA, width, LSL #1
- SBC ptrA, ptrA, tmp2, LSR #20
- SUB ptrA, ptrA, #1
-
- ADDS count, count, #0xE << 24
- BGE loop1_y
-
- ;///////////////////////////////////////////////////////////////////////////
- ;// Cr
- ;///////////////////////////////////////////////////////////////////////////
- LDR height, [sp,#0xfc] ;// height
- LDR ref, [sp, #0xc4] ;// ref
- LDR tmp1, [sp, #0xd0] ;// y0
- LDR tmp2, [sp, #0xcc] ;// x0
- LDR mb, [sp, #0xc8] ;// predPartChroma
-
- ADD tmp1, height, tmp1
- MLA tmp3, tmp1, width, tmp2
- ADD ptrA, ref, tmp3
- ADD mb, mb, #64
-
- AND count, count, #0x00FFFFFF
- AND tmp1, count, #0x000F0000
- ADD count, count, tmp1, LSL #8
- AND tmp2, count, #0x00F00000
-
- ;// 2x2 pels per iteration
- ;// bilinear vertical interpolation
-loop2_y
- ADD count, count, tmp2, LSL #8
- LDRB tmp1, [ptrA, width]
- LDRB tmp2, [ptrA], #1
-
-loop2_x
- LDRB tmp3, [ptrA, width]
- LDRB tmp4, [ptrA], #1
-
- PKHBT tmp5, tmp1, tmp3, LSL #16
- PKHBT tmp6, tmp2, tmp4, LSL #16
-
- LDRB tmp1, [ptrA, width]
- LDRB tmp2, [ptrA], #1
-
- SMLAD tmp5, tmp5, valX, c32 ;// multiply
- SMLAD tmp6, tmp6, valX, c32 ;// multiply
-
- PKHBT tmp7, tmp3, tmp1, LSL #16
- PKHBT tmp8, tmp4, tmp2, LSL #16
-
- SMLAD tmp7, tmp7, valX, c32 ;// multiply
- SMLAD tmp8, tmp8, valX, c32 ;// multiply
-
- MOV tmp5, tmp5, LSR #6 ;// scale down
- STRB tmp5, [mb,#8] ;// store row 2 col 1
-
- MOV tmp6, tmp6, LSR #6 ;// scale down
- STRB tmp6, [mb],#1 ;// store row 1 col 1
-
- MOV tmp7, tmp7, LSR #6 ;// scale down
- STRB tmp7, [mb,#8] ;// store row 2 col 2
-
- MOV tmp8, tmp8, LSR #6 ;// scale down
- STRB tmp8, [mb],#1 ;// store row 1 col 2
-
- SUBS count, count, #2<<28
- BCS loop2_x
-
- AND tmp2, count, #0x00F00000
-
- ADDS mb, mb, #16
- SBC mb, mb, tmp2, LSR #20
- ADD ptrA, ptrA, width, LSL #1
- SBC ptrA, ptrA, tmp2, LSR #20
- SUB ptrA, ptrA, #1
-
- ADDS count, count, #0xE << 24
- BGE loop2_y
-
- ADD sp,sp,#0xd4
- LDMFD sp!, {r4-r11,pc}
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_chroma_hor_ver.s b/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_chroma_hor_ver.s
deleted file mode 100644
index 7420ad3..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_chroma_hor_ver.s
+++ /dev/null
@@ -1,339 +0,0 @@
-; Copyright (C) 2009 The Android Open Source Project
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-
-;-------------------------------------------------------------------------------
-;--
-;-- Abstract : ARMv6 optimized version of h264bsdInterpolateChromaHorVer
-;-- function
-;--
-;-------------------------------------------------------------------------------
-
-
- IF :DEF: H264DEC_WINASM
- ;// We dont use REQUIRE8 and PRESERVE8 for winasm
- ELSE
- REQUIRE8
- PRESERVE8
- ENDIF
-
- AREA |.text|, CODE
-
-
-;// h264bsdInterpolateChromaHorVer register allocation
-
-ref RN 0
-ptrA RN 0
-
-mb RN 1
-block RN 1
-
-x0 RN 2
-count RN 2
-
-y0 RN 3
-valY RN 3
-
-width RN 4
-
-tmp4 RN 5
-height RN 5
-
-tmp1 RN 6
-
-tmp2 RN 7
-
-tmp3 RN 8
-
-valX RN 9
-
-tmp5 RN 10
-chrPW RN 10
-
-tmp6 RN 11
-chrPH RN 11
-
-xFrac RN 12
-
-c32 RN 14
-yFrac RN 14
-
-;// function exports and imports
-
- IMPORT h264bsdFillBlock
-
- EXPORT h264bsdInterpolateChromaHorVer
-
-;// Function arguments
-;//
-;// u8 *ref, : 0xc4
-;// u8 *predPartChroma, : 0xc8
-;// i32 x0, : 0xcc
-;// i32 y0, : 0xd0
-;// u32 width, : 0xf8
-;// u32 height, : 0xfc
-;// u32 xFrac, : 0x100
-;// u32 yFrac, : 0x104
-;// u32 chromaPartWidth, : 0x108
-;// u32 chromaPartHeight : 0x10c
-
-h264bsdInterpolateChromaHorVer
- STMFD sp!, {r0-r11,lr}
- SUB sp, sp, #0xc4
-
- LDR chrPW, [sp, #0x108] ;// chromaPartWidth
- LDR xFrac, [sp, #0x100] ;// xFrac
- LDR width, [sp, #0xf8] ;// width
- CMP x0, #0
- BLT do_fill
-
- ADD tmp1, x0, chrPW ;// tmp1 = x0+ chromaPartWidth
- ADD tmp1, tmp1, #1 ;// tmp1 = x0+ chromaPartWidth+1
- CMP tmp1, width ;// x0+chromaPartWidth+1 > width
- BHI do_fill
-
- CMP y0, #0
- BLT do_fill
- LDR chrPH, [sp, #0x10c] ;// chromaPartHeight
- LDR height, [sp, #0xfc] ;// height
- ADD tmp1, y0, chrPH ;// tmp1 = y0 + chromaPartHeight
- ADD tmp1, tmp1, #1 ;// tmp1 = y0 + chromaPartHeight + 1
- CMP tmp1, height
- BLS skip_fill
-
-do_fill
- LDR chrPH, [sp, #0x10c] ;// chromaPartHeight
- LDR height, [sp, #0xfc] ;// height
- ADD tmp3, chrPW, #1 ;// tmp3 = chromaPartWidth+1
- ADD tmp1, chrPW, #1 ;// tmp1 = chromaPartWidth+1
- ADD tmp2, chrPH, #1 ;// tmp2 = chromaPartHeight+1
- STMIA sp,{width,height,tmp1,tmp2,tmp3}
- ADD block, sp, #0x1c ;// block
- BL h264bsdFillBlock
-
- LDR x0, [sp, #0xcc]
- LDR y0, [sp, #0xd0]
- LDR ref, [sp, #0xc4] ;// ref
- STMIA sp,{width,height,tmp1,tmp2,tmp3}
- ADD block, sp, #0x1c ;// block
- MLA ref, height, width, ref ;// ref += width * height;
- MLA block, tmp2, tmp1, block;// block + (chromaPW+1)*(chromaPH+1)
- BL h264bsdFillBlock
-
- MOV x0, #0 ;// x0 = 0
- MOV y0, #0 ;// y0 = 0
- STR x0, [sp, #0xcc]
- STR y0, [sp, #0xd0]
- ADD ref, sp, #0x1c ;// ref = block
- STR ref, [sp, #0xc4] ;// ref
-
- STR tmp2, [sp, #0xfc] ;// height
- STR tmp1, [sp, #0xf8] ;// width
- MOV width, tmp1
-
-skip_fill
- MLA tmp3, y0, width, x0 ;// tmp3 = y0*width+x0
- LDR yFrac, [sp, #0x104] ;// yFrac
- LDR xFrac, [sp, #0x100]
- ADD ptrA, ref, tmp3 ;// ptrA = ref + y0*width+x0
- RSB valX, xFrac, #8 ;// valX = 8-xFrac
- RSB valY, yFrac, #8 ;// valY = 8-yFrac
-
- LDR mb, [sp, #0xc8] ;// predPartChroma
-
-
- ;// pack values to count register
- ;// [31:28] loop_x (chromaPartWidth-1)
- ;// [27:24] loop_y (chromaPartHeight-1)
- ;// [23:20] chromaPartWidth-1
- ;// [19:16] chromaPartHeight-1
- ;// [15:00] nothing
-
- SUB tmp2, chrPH, #1 ;// chromaPartHeight-1
- SUB tmp1, chrPW, #1 ;// chromaPartWidth-1
- ADD count, count, tmp2, LSL #16 ;// chromaPartHeight-1
- ADD count, count, tmp2, LSL #24 ;// loop_y
- ADD count, count, tmp1, LSL #20 ;// chromaPartWidth-1
- AND tmp2, count, #0x00F00000 ;// loop_x
- PKHBT valY, valY, yFrac, LSL #16 ;// |yFrac|valY |
- MOV c32, #32
-
-
- ;///////////////////////////////////////////////////////////////////////////
- ;// Cb
- ;///////////////////////////////////////////////////////////////////////////
-
- ;// 2x2 pels per iteration
- ;// bilinear vertical and horizontal interpolation
-
-loop1_y
- LDRB tmp1, [ptrA]
- LDRB tmp3, [ptrA, width]
- LDRB tmp5, [ptrA, width, LSL #1]
-
- PKHBT tmp1, tmp1, tmp3, LSL #16 ;// |t3|t1|
- PKHBT tmp3, tmp3, tmp5, LSL #16 ;// |t5|t3|
-
- SMUAD tmp1, tmp1, valY ;// t1=(t1*valY + t3*yFrac)
- SMUAD tmp3, tmp3, valY ;// t3=(t3*valY + t5*yFrac)
-
- ADD count, count, tmp2, LSL #8
-loop1_x
- ;// first
- LDRB tmp2, [ptrA, #1]!
- LDRB tmp4, [ptrA, width]
- LDRB tmp6, [ptrA, width, LSL #1]
-
- PKHBT tmp2, tmp2, tmp4, LSL #16 ;// |t4|t2|
- PKHBT tmp4, tmp4, tmp6, LSL #16 ;// |t6|t4|
-
- SMUAD tmp2, tmp2, valY ;// t2=(t2*valY + t4*yFrac)
- MLA tmp5, tmp1, valX, c32 ;// t5=t1*valX+32
- MLA tmp5, tmp2, xFrac, tmp5 ;// t5=t2*xFrac+t5
-
- SMUAD tmp4, tmp4, valY ;// t4=(t4*valY + t6*yFrac)
- MLA tmp6, tmp3, valX, c32 ;// t3=t3*valX+32
- MLA tmp6, tmp4, xFrac, tmp6 ;// t6=t4*xFrac+t6
-
- MOV tmp6, tmp6, LSR #6 ;// scale down
- STRB tmp6, [mb, #8] ;// store pixel
- MOV tmp5, tmp5, LSR #6 ;// scale down
- STRB tmp5, [mb], #1 ;// store pixel
-
- ;// second
- LDRB tmp1, [ptrA, #1]!
- LDRB tmp3, [ptrA, width]
- LDRB tmp5, [ptrA, width, LSL #1]
-
- PKHBT tmp1, tmp1, tmp3, LSL #16 ;// |t3|t1|
- PKHBT tmp3, tmp3, tmp5, LSL #16 ;// |t5|t3|
-
- SMUAD tmp1, tmp1, valY ;// t1=(t1*valY + t3*yFrac)
- MLA tmp5, tmp1, xFrac, c32 ;// t1=t1*xFrac+32
- MLA tmp5, tmp2, valX, tmp5 ;// t5=t2*valX+t5
-
- SMUAD tmp3, tmp3, valY ;// t3=(t3*valY + t5*yFrac)
- MLA tmp6, tmp3, xFrac, c32 ;// t3=t3*xFrac+32
- MLA tmp6, tmp4, valX, tmp6 ;// t6=t4*valX+t6
-
- MOV tmp6, tmp6, LSR #6 ;// scale down
- STRB tmp6, [mb, #8] ;// store pixel
- MOV tmp5, tmp5, LSR #6 ;// scale down
- STRB tmp5, [mb], #1 ;// store pixel
-
- SUBS count, count, #2<<28
- BCS loop1_x
-
- AND tmp2, count, #0x00F00000
-
- ADDS mb, mb, #16
- SBC mb, mb, tmp2, LSR #20
- ADD ptrA, ptrA, width, LSL #1
- SBC ptrA, ptrA, tmp2, LSR #20
-
- ADDS count, count, #0xE << 24
- BGE loop1_y
-
- ;///////////////////////////////////////////////////////////////////////////
- ;// Cr
- ;///////////////////////////////////////////////////////////////////////////
- LDR height, [sp,#0xfc] ;// height
- LDR ref, [sp, #0xc4] ;// ref
- LDR tmp1, [sp, #0xd0] ;// y0
- LDR tmp2, [sp, #0xcc] ;// x0
- LDR mb, [sp, #0xc8] ;// predPartChroma
-
- ADD tmp1, height, tmp1
- MLA tmp3, tmp1, width, tmp2
- ADD ptrA, ref, tmp3
- ADD mb, mb, #64
-
- AND count, count, #0x00FFFFFF
- AND tmp1, count, #0x000F0000
- ADD count, count, tmp1, LSL #8
- AND tmp2, count, #0x00F00000
-
- ;// 2x2 pels per iteration
- ;// bilinear vertical and horizontal interpolation
-loop2_y
- LDRB tmp1, [ptrA]
- LDRB tmp3, [ptrA, width]
- LDRB tmp5, [ptrA, width, LSL #1]
-
- PKHBT tmp1, tmp1, tmp3, LSL #16 ;// |t3|t1|
- PKHBT tmp3, tmp3, tmp5, LSL #16 ;// |t5|t3|
-
- SMUAD tmp1, tmp1, valY ;// t1=(t1*valY + t3*yFrac)
- SMUAD tmp3, tmp3, valY ;// t3=(t3*valY + t5*yFrac)
-
- ADD count, count, tmp2, LSL #8
-loop2_x
- ;// first
- LDRB tmp2, [ptrA, #1]!
- LDRB tmp4, [ptrA, width]
- LDRB tmp6, [ptrA, width, LSL #1]
-
- PKHBT tmp2, tmp2, tmp4, LSL #16 ;// |t4|t2|
- PKHBT tmp4, tmp4, tmp6, LSL #16 ;// |t6|t4|
-
- SMUAD tmp2, tmp2, valY ;// t2=(t2*valY + t4*yFrac)
- MLA tmp5, tmp1, valX, c32 ;// t5=t1*valX+32
- MLA tmp5, tmp2, xFrac, tmp5 ;// t5=t2*xFrac+t5
-
- SMUAD tmp4, tmp4, valY ;// t4=(t4*valY + t6*yFrac)
- MLA tmp6, tmp3, valX, c32 ;// t3=t3*valX+32
- MLA tmp6, tmp4, xFrac, tmp6 ;// t6=t4*xFrac+t6
-
- MOV tmp6, tmp6, LSR #6 ;// scale down
- STRB tmp6, [mb, #8] ;// store pixel
- MOV tmp5, tmp5, LSR #6 ;// scale down
- STRB tmp5, [mb], #1 ;// store pixel
-
- ;// second
- LDRB tmp1, [ptrA, #1]!
- LDRB tmp3, [ptrA, width]
- LDRB tmp5, [ptrA, width, LSL #1]
-
- PKHBT tmp1, tmp1, tmp3, LSL #16 ;// |t3|t1|
- PKHBT tmp3, tmp3, tmp5, LSL #16 ;// |t5|t3|
-
- SMUAD tmp1, tmp1, valY ;// t1=(t1*valY + t3*yFrac)
- MLA tmp5, tmp1, xFrac, c32 ;// t1=t1*xFrac+32
- MLA tmp5, tmp2, valX, tmp5 ;// t5=t2*valX+t5
-
- SMUAD tmp3, tmp3, valY ;// t3=(t3*valY + t5*yFrac)
- MLA tmp6, tmp3, xFrac, c32 ;// t3=t3*xFrac+32
- MLA tmp6, tmp4, valX, tmp6 ;// t6=t4*valX+t6
-
- MOV tmp6, tmp6, LSR #6 ;// scale down
- STRB tmp6, [mb, #8] ;// store pixel
- MOV tmp5, tmp5, LSR #6 ;// scale down
- STRB tmp5, [mb], #1 ;// store pixel
-
- SUBS count, count, #2<<28
- BCS loop2_x
-
- AND tmp2, count, #0x00F00000
-
- ADDS mb, mb, #16
- SBC mb, mb, tmp2, LSR #20
- ADD ptrA, ptrA, width, LSL #1
- SBC ptrA, ptrA, tmp2, LSR #20
-
- ADDS count, count, #0xE << 24
- BGE loop2_y
-
- ADD sp,sp,#0xd4
- LDMFD sp!,{r4-r11,pc}
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_chroma_ver.s b/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_chroma_ver.s
deleted file mode 100644
index af9df1b..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_chroma_ver.s
+++ /dev/null
@@ -1,288 +0,0 @@
-; Copyright (C) 2009 The Android Open Source Project
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-
-;-------------------------------------------------------------------------------
-;--
-;-- Abstract : ARMv6 optimized version of h264bsdInterpolateChromaVer function
-;--
-;-------------------------------------------------------------------------------
-
-
- IF :DEF: H264DEC_WINASM
- ;// We dont use REQUIRE8 and PRESERVE8 for winasm
- ELSE
- REQUIRE8
- PRESERVE8
- ENDIF
-
- AREA |.text|, CODE
-
-;// h264bsdInterpolateChromaVer register allocation
-
-ref RN 0
-ptrA RN 0
-
-mb RN 1
-block RN 1
-
-x0 RN 2
-count RN 2
-
-y0 RN 3
-valY RN 3
-
-width RN 4
-
-height RN 5
-tmp7 RN 5
-
-chrPW RN 6
-tmp8 RN 6
-
-tmp1 RN 7
-
-tmp2 RN 8
-
-tmp3 RN 9
-
-tmp4 RN 10
-
-tmp5 RN 11
-chrPH RN 11
-
-tmp6 RN 12
-
-c32 RN 14
-yFrac RN 14
-
-;// Function exports and imports
-
- IMPORT h264bsdFillBlock
-
- EXPORT h264bsdInterpolateChromaVer
-
-;// Function arguments
-;//
-;// u8 *ref, : 0xc4
-;// u8 *predPartChroma, : 0xc8
-;// i32 x0, : 0xcc
-;// i32 y0, : 0xd0
-;// u32 width, : 0xf8
-;// u32 height, : 0xfc
-;// u32 yFrac, : 0x100
-;// u32 chromaPartWidth, : 0x104
-;// u32 chromaPartHeight : 0x108
-
-h264bsdInterpolateChromaVer
- STMFD sp!, {r0-r11,lr}
- SUB sp, sp, #0xc4
-
- LDR chrPW, [sp, #0x104] ;// chromaPartWidth
- LDR width, [sp, #0xf8] ;// width
- CMP x0, #0
- BLT do_fill
-
- ADD tmp1, x0, chrPW ;// tmp1 = x0+ chromaPartWidth
- CMP tmp1, width ;// x0+chromaPartWidth > width
- BHI do_fill
-
- CMP y0, #0
- BLT do_fill
- LDR chrPH, [sp, #0x108] ;// chromaPartHeight
- LDR height, [sp, #0xfc] ;// height
- ADD tmp1, y0, chrPH ;// tmp1 = y0 + chromaPartHeight
- ADD tmp1, tmp1, #1 ;// tmp1 = y0 + chromaPartHeight + 1
- CMP tmp1, height
- BLS skip_fill
-
-do_fill
- LDR chrPH, [sp, #0x108] ;// chromaPartHeight
- LDR height, [sp, #0xfc] ;// height
- ADD tmp1, chrPH, #1 ;// tmp1 = chromaPartHeight+1
- MOV tmp2, chrPW ;// tmp2 = chromaPartWidth
- STMIA sp,{width,height,chrPW,tmp1,tmp2}
- ADD block, sp, #0x1c ;// block
- BL h264bsdFillBlock
-
- LDR x0, [sp, #0xcc]
- LDR y0, [sp, #0xd0]
- LDR ref, [sp, #0xc4] ;// ref
- STMIA sp,{width,height,chrPW,tmp1,tmp2}
- ADD block, sp, #0x1c ;// block
- MLA ref, height, width, ref ;// ref += width * height;
- MLA block, chrPW, tmp1, block;// block + (chromaPW)*(chromaPH+1)
- BL h264bsdFillBlock
-
- MOV x0, #0 ;// x0 = 0
- MOV y0, #0 ;// y0 = 0
- STR x0, [sp, #0xcc]
- STR y0, [sp, #0xd0]
- ADD ref, sp, #0x1c ;// ref = block
- STR ref, [sp, #0xc4] ;// ref
-
- STR tmp1, [sp, #0xfc] ;// height
- STR chrPW, [sp, #0xf8] ;// width
- MOV width, chrPW
-
-skip_fill
- MLA tmp3, y0, width, x0 ;// tmp3 = y0*width+x0
- LDR yFrac, [sp, #0x100] ;// yFrac
- ADD ptrA, ref, tmp3 ;// ptrA = ref + y0*width+x0
- RSB valY, yFrac, #8 ;// valY = 8-yFrac
-
- LDR mb, [sp, #0xc8] ;// predPartChroma
-
-
- ;// pack values to count register
- ;// [31:28] loop_x (chromaPartWidth-1)
- ;// [27:24] loop_y (chromaPartHeight-1)
- ;// [23:20] chromaPartWidth-1
- ;// [19:16] chromaPartHeight-1
- ;// [15:00] nothing
-
- SUB tmp2, chrPH, #1 ;// chromaPartHeight-1
- SUB tmp1, chrPW, #1 ;// chromaPartWidth-1
- ADD count, count, tmp2, LSL #16 ;// chromaPartHeight-1
- ADD count, count, tmp2, LSL #24 ;// loop_y
- ADD count, count, tmp1, LSL #20 ;// chromaPartWidth-1
- AND tmp2, count, #0x00F00000 ;// loop_x
- PKHBT valY, valY, yFrac, LSL #16 ;// |yFrac|valY |
- MOV valY, valY, LSL #3 ;// multiply by 8 in advance
- MOV c32, #32
-
-
- ;///////////////////////////////////////////////////////////////////////////
- ;// Cb
- ;///////////////////////////////////////////////////////////////////////////
-
- ;// 2x2 pels per iteration
- ;// bilinear vertical interpolation
-
-loop1_y
- ADD count, count, tmp2, LSL #8
-loop1_x
- ;// Process 2x2 block
- LDRB tmp2, [ptrA,width] ;// 2 row, 1 col
- LDRB tmp3, [ptrA,width, LSL #1] ;// 3 row, 1 col
- LDRB tmp1, [ptrA],#1 ;// 1 row, 1 col
-
- LDRB tmp5, [ptrA,width] ;// 2 row, 2 col
- LDRB tmp6, [ptrA,width, LSL #1] ;// 3 row, 2 col
- LDRB tmp4, [ptrA],#1 ;// 1 row, 2 col
-
- PKHBT tmp1, tmp1, tmp2, LSL #16 ;// |B|A|
- PKHBT tmp2, tmp2, tmp3, LSL #16 ;// |C|B|
- PKHBT tmp4, tmp4, tmp5, LSL #16 ;// |B|A|
-
- SMLAD tmp7, tmp2, valY, c32 ;// multiply
- PKHBT tmp5, tmp5, tmp6, LSL #16 ;// |C|B|
- SMLAD tmp2, tmp1, valY, c32 ;// multiply
- SMLAD tmp8, tmp5, valY, c32 ;// multiply
- SMLAD tmp5, tmp4, valY, c32 ;// multiply
-
- MOV tmp7, tmp7, LSR #6 ;// scale down
- STRB tmp7, [mb,#8] ;// store row 2 col 1
- MOV tmp2, tmp2, LSR #6 ;// scale down
- STRB tmp2, [mb],#1 ;// store row 1 col 1
-
- MOV tmp8, tmp8, LSR #6 ;// scale down
- STRB tmp8, [mb,#8] ;// store row 2 col 2
- MOV tmp5, tmp5, LSR #6 ;// scale down
- STRB tmp5, [mb],#1 ;// store row 1 col 2
-
-
- SUBS count, count, #2<<28
- BCS loop1_x
-
- AND tmp2, count, #0x00F00000
-
- ADDS mb, mb, #16
- SBC mb, mb, tmp2, LSR #20
- ADD ptrA, ptrA, width, LSL #1
- SBC ptrA, ptrA, tmp2, LSR #20
-
- ADDS count, count, #0xE << 24
- BGE loop1_y
-
- ;///////////////////////////////////////////////////////////////////////////
- ;// Cr
- ;///////////////////////////////////////////////////////////////////////////
- LDR height, [sp,#0xfc] ;// height
- LDR ref, [sp, #0xc4] ;// ref
- LDR tmp1, [sp, #0xd0] ;// y0
- LDR tmp2, [sp, #0xcc] ;// x0
- LDR mb, [sp, #0xc8] ;// predPartChroma
-
- ADD tmp1, height, tmp1
- MLA tmp3, tmp1, width, tmp2
- ADD ptrA, ref, tmp3
- ADD mb, mb, #64
-
- AND count, count, #0x00FFFFFF
- AND tmp1, count, #0x000F0000
- ADD count, count, tmp1, LSL #8
- AND tmp2, count, #0x00F00000
-
- ;// 2x2 pels per iteration
- ;// bilinear vertical interpolation
-loop2_y
- ADD count, count, tmp2, LSL #8
-loop2_x
- ;// Process 2x2 block
- LDRB tmp2, [ptrA,width] ;// 2 row, 1 col
- LDRB tmp3, [ptrA,width, LSL #1] ;// 3 row, 1 col
- LDRB tmp1, [ptrA],#1 ;// 1 row, 1 col
-
- LDRB tmp5, [ptrA,width] ;// 2 row, 2 col
- LDRB tmp6, [ptrA,width, LSL #1] ;// 3 row, 2 col
- LDRB tmp4, [ptrA],#1 ;// 1 row, 2 col
-
- PKHBT tmp1, tmp1, tmp2, LSL #16 ;// |B|A|
- PKHBT tmp2, tmp2, tmp3, LSL #16 ;// |C|B|
- PKHBT tmp4, tmp4, tmp5, LSL #16 ;// |B|A|
-
- SMLAD tmp7, tmp2, valY, c32 ;// multiply
- PKHBT tmp5, tmp5, tmp6, LSL #16 ;// |C|B|
- SMLAD tmp2, tmp1, valY, c32 ;// multiply
- SMLAD tmp8, tmp5, valY, c32 ;// multiply
- SMLAD tmp5, tmp4, valY, c32 ;// multiply
-
- MOV tmp7, tmp7, LSR #6 ;// scale down
- STRB tmp7, [mb,#8] ;// store row 2 col 1
- MOV tmp2, tmp2, LSR #6 ;// scale down
- STRB tmp2, [mb],#1 ;// store row 1 col 1
-
- MOV tmp8, tmp8, LSR #6 ;// scale down
- STRB tmp8, [mb,#8] ;// store row 2 col 2
- MOV tmp5, tmp5, LSR #6 ;// scale down
- STRB tmp5, [mb],#1 ;// store row 1 col 2
-
-
- SUBS count, count, #2<<28
- BCS loop2_x
-
- AND tmp2, count, #0x00F00000
-
- ADDS mb, mb, #16
- SBC mb, mb, tmp2, LSR #20
- ADD ptrA, ptrA, width, LSL #1
- SBC ptrA, ptrA, tmp2, LSR #20
-
- ADDS count, count, #0xE << 24
- BGE loop2_y
-
- ADD sp,sp,#0xd4
- LDMFD sp!, {r4-r11,pc}
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_hor_half.s b/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_hor_half.s
deleted file mode 100644
index 93968b6..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_hor_half.s
+++ /dev/null
@@ -1,251 +0,0 @@
-; Copyright (C) 2009 The Android Open Source Project
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-
-;-------------------------------------------------------------------------------
-;--
-;-- Abstract : ARMv6 optimized version of h264bsdInterpolateHorHalf function
-;--
-;-------------------------------------------------------------------------------
-
-
- IF :DEF: H264DEC_WINASM
- ;// We dont use REQUIRE8 and PRESERVE8 for winasm
- ELSE
- REQUIRE8
- PRESERVE8
- ENDIF
-
- AREA |.text|, CODE
-
-;// h264bsdInterpolateHorHalf register allocation
-
-ref RN 0
-
-mb RN 1
-buff RN 1
-
-count RN 2
-x0 RN 2
-
-y0 RN 3
-x_2_0 RN 3
-
-width RN 4
-x_3_1 RN 4
-
-height RN 5
-x_6_4 RN 5
-
-partW RN 6
-x_7_5 RN 6
-
-partH RN 7
-tmp1 RN 7
-
-tmp2 RN 8
-
-tmp3 RN 9
-
-tmp4 RN 10
-
-mult_20_01 RN 11
-mult_20_m5 RN 12
-
-plus16 RN 14
-
-
-;// function exports and imports
-
- IMPORT h264bsdFillBlock
-
- EXPORT h264bsdInterpolateHorHalf
-
-;// Horizontal filter approach
-;//
-;// Basic idea in horizontal filtering is to adjust coefficients
-;// like below. Calculation is done with 16-bit maths.
-;//
-;// Reg x_2_0 x_3_1 x_6_4 x_7_5 x_2_0
-;// [ 2 0 ] [ 3 1 ] [ 6 4 ] [ 7 5 ] [ 10 8 ] ...
-;// y_0 = 20 1 20 -5 -5 1
-;// y_1 = -5 20 1 1 20 -5
-;// y_2 = 1 -5 -5 20 1 20
-;// y_3 = 1 20 -5 -5 20 1
-
-
-h264bsdInterpolateHorHalf
- STMFD sp!, {r0-r11, lr}
- SUB sp, sp, #0x1e4
-
- CMP x0, #0
- BLT do_fill ;// (x0 < 0)
- LDR partW, [sp,#0x220] ;// partWidth
- ADD tmp4, x0, partW ;// (x0+partWidth)
- ADD tmp4, tmp4, #5 ;// (y0+partW+5)
- LDR width, [sp,#0x218] ;// width
- CMP tmp4, width
- BHI do_fill ;// (x0+partW)>width
-
- CMP y0, #0
- BLT do_fill ;// (y0 < 0)
- LDR partH, [sp,#0x224] ;// partHeight
- ADD tmp2, y0, partH ;// (y0+partHeight)
- LDR height, [sp,#0x21c] ;// height
- CMP tmp2, height
- BLS skip_fill ;// no overfill needed
-
-
-do_fill
- LDR partH, [sp,#0x224] ;// partHeight
- LDR height, [sp,#0x21c] ;// height
- LDR partW, [sp,#0x220] ;// partWidth
- ADD tmp4, partW, #5 ;// tmp4 = partW + 5;
- STMIB sp, {height, tmp4} ;// sp+4 = height, sp+8 = partWidth+5
- STR partH, [sp,#0xc] ;// sp+c = partHeight
- STR tmp4, [sp,#0x10] ;// sp+10 = partWidth+5
- LDR width, [sp,#0x218] ;// width
- STR width, [sp,#0] ;// sp+0 = width
- ADD buff, sp, #0x28 ;// buff = p1[21*21/4+1]
- BL h264bsdFillBlock
-
- MOV x0, #0
- STR x0,[sp,#0x1ec] ;// x0 = 0
- STR x0,[sp,#0x1f0] ;// y0 = 0
- ADD ref,sp,#0x28 ;// ref = p1
- STR tmp4, [sp,#0x218] ;// width = partWidth+5
-
-
-skip_fill
- LDR x0 ,[sp,#0x1ec] ;// x0
- LDR y0 ,[sp,#0x1f0] ;// y0
- LDR width, [sp,#0x218] ;// width
- MLA tmp2, width, y0, x0 ;// y0*width+x0
- ADD ref, ref, tmp2 ;// ref += y0*width+x0
- ADD ref, ref, #8 ;// ref = ref+8
- LDR mb, [sp, #0x1e8] ;// mb
-
- ;// pack values to count register
- ;// [31:28] loop_x (partWidth-1)
- ;// [27:24] loop_y (partHeight-1)
- ;// [23:20] partWidth-1
- ;// [19:16] partHeight-1
- ;// [15:00] width
- MOV count, width
- SUB partW, partW, #1;
- SUB partH, partH, #1;
- ADD tmp2, partH, partW, LSL #4
- ADD count, count, tmp2, LSL #16
-
-
- LDR mult_20_01, = 0x00140001
- LDR mult_20_m5, = 0x0014FFFB
- MOV plus16, #16
- AND tmp1, count, #0x000F0000 ;// partHeight-1
- AND tmp3, count, #0x00F00000 ;// partWidth-1
- ADD count, count, tmp1, LSL #8
-loop_y
- LDR x_3_1, [ref, #-8]
- ADD count, count, tmp3, LSL #8
- LDR x_7_5, [ref, #-4]
- UXTB16 x_2_0, x_3_1
- UXTB16 x_3_1, x_3_1, ROR #8
- UXTB16 x_6_4, x_7_5
-
-loop_x
- UXTB16 x_7_5, x_7_5, ROR #8
-
- SMLAD tmp1, x_2_0, mult_20_01, plus16
- SMLATB tmp3, x_2_0, mult_20_01, plus16
- SMLATB tmp2, x_2_0, mult_20_m5, plus16
- SMLATB tmp4, x_3_1, mult_20_01, plus16
-
- SMLAD tmp1, x_3_1, mult_20_m5, tmp1
- SMLATB tmp3, x_3_1, mult_20_m5, tmp3
- SMLAD tmp2, x_3_1, mult_20_01, tmp2
- LDR x_3_1, [ref], #4
- SMLAD tmp4, x_6_4, mult_20_m5, tmp4
-
- SMLABB tmp1, x_6_4, mult_20_m5, tmp1
- SMLADX tmp3, x_6_4, mult_20_m5, tmp3
- SMLADX tmp2, x_6_4, mult_20_01, tmp2
- SMLADX tmp4, x_7_5, mult_20_m5, tmp4
-
- SMLABB tmp1, x_7_5, mult_20_01, tmp1
- UXTB16 x_2_0, x_3_1
- SMLABB tmp2, x_7_5, mult_20_m5, tmp2
- SMLADX tmp3, x_7_5, mult_20_01, tmp3
- SMLABB tmp4, x_2_0, mult_20_01, tmp4
-
- MOV tmp2, tmp2, ASR #5
- MOV tmp1, tmp1, ASR #5
- PKHBT tmp2, tmp2, tmp4, LSL #(16-5)
- PKHBT tmp1, tmp1, tmp3, LSL #(16-5)
- USAT16 tmp2, #8, tmp2
- USAT16 tmp1, #8, tmp1
-
- SUBS count, count, #4<<28
- ORR tmp1, tmp1, tmp2, LSL #8
- STR tmp1, [mb], #4
- BCC next_y
-
- UXTB16 x_3_1, x_3_1, ROR #8
-
- SMLAD tmp1, x_6_4, mult_20_01, plus16
- SMLATB tmp3, x_6_4, mult_20_01, plus16
- SMLATB tmp2, x_6_4, mult_20_m5, plus16
- SMLATB tmp4, x_7_5, mult_20_01, plus16
-
- SMLAD tmp1, x_7_5, mult_20_m5, tmp1
- SMLATB tmp3, x_7_5, mult_20_m5, tmp3
- SMLAD tmp2, x_7_5, mult_20_01, tmp2
- LDR x_7_5, [ref], #4
- SMLAD tmp4, x_2_0, mult_20_m5, tmp4
-
- SMLABB tmp1, x_2_0, mult_20_m5, tmp1
- SMLADX tmp3, x_2_0, mult_20_m5, tmp3
- SMLADX tmp2, x_2_0, mult_20_01, tmp2
- SMLADX tmp4, x_3_1, mult_20_m5, tmp4
-
- SMLABB tmp1, x_3_1, mult_20_01, tmp1
- UXTB16 x_6_4, x_7_5
- SMLABB tmp2, x_3_1, mult_20_m5, tmp2
- SMLADX tmp3, x_3_1, mult_20_01, tmp3
- SMLABB tmp4, x_6_4, mult_20_01, tmp4
-
- MOV tmp2, tmp2, ASR #5
- MOV tmp1, tmp1, ASR #5
- PKHBT tmp2, tmp2, tmp4, LSL #(16-5)
- PKHBT tmp1, tmp1, tmp3, LSL #(16-5)
- USAT16 tmp2, #8, tmp2
- USAT16 tmp1, #8, tmp1
-
- SUBS count, count, #4<<28
- ORR tmp1, tmp1, tmp2, LSL #8
- STR tmp1, [mb], #4
- BCS loop_x
-
-next_y
- AND tmp3, count, #0x00F00000 ;// partWidth-1
- SMLABB ref, count, mult_20_01, ref ;// +width
- ADDS mb, mb, #16 ;// +16, Carry=0
- SBC mb, mb, tmp3, LSR #20 ;// -(partWidth-1)-1
- SBC ref, ref, tmp3, LSR #20 ;// -(partWidth-1)-1
- ADDS count, count, #(1<<28)-(1<<24)
- BGE loop_y
-
- ADD sp,sp,#0x1f4
- LDMFD sp!, {r4-r11, pc}
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_hor_quarter.s b/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_hor_quarter.s
deleted file mode 100644
index de243d4..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_hor_quarter.s
+++ /dev/null
@@ -1,273 +0,0 @@
-; Copyright (C) 2009 The Android Open Source Project
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-
-;-------------------------------------------------------------------------------
-;--
-;-- Abstract : ARMv6 optimized version of h264bsdInterpolateHorQuarter function
-;--
-;-------------------------------------------------------------------------------
-
-
- IF :DEF: H264DEC_WINASM
- ;// We dont use REQUIRE8 and PRESERVE8 for winasm
- ELSE
- REQUIRE8
- PRESERVE8
- ENDIF
-
- AREA |.text|, CODE
-
-;// h264bsdInterpolateHorQuarter register allocation
-
-ref RN 0
-
-mb RN 1
-buff RN 1
-
-count RN 2
-x0 RN 2
-
-y0 RN 3
-x_2_0 RN 3
-
-width RN 4
-x_3_1 RN 4
-
-height RN 5
-x_6_4 RN 5
-
-partW RN 6
-x_7_5 RN 6
-
-partH RN 7
-tmp1 RN 7
-
-tmp2 RN 8
-
-tmp3 RN 9
-
-tmp4 RN 10
-
-mult_20_01 RN 11
-
-mult_20_m5 RN 12
-
-plus16 RN 14
-
-
-;// function exports and imports
-
- IMPORT h264bsdFillBlock
-
- EXPORT h264bsdInterpolateHorQuarter
-
-
-;// Horizontal filter approach
-;//
-;// Basic idea in horizontal filtering is to adjust coefficients
-;// like below. Calculation is done with 16-bit maths.
-;//
-;// Reg x_2_0 x_3_1 x_6_4 x_7_5 x_2_0
-;// [ 2 0 ] [ 3 1 ] [ 6 4 ] [ 7 5 ] [ 10 8 ] ...
-;// y_0 = 20 1 20 -5 -5 1
-;// y_1 = -5 20 1 1 20 -5
-;// y_2 = 1 -5 -5 20 1 20
-;// y_3 = 1 20 -5 -5 20 1
-
-
-h264bsdInterpolateHorQuarter
- STMFD sp!, {r0-r11, lr}
- SUB sp, sp, #0x1e4
-
- CMP x0, #0
- BLT do_fill ;// (x0 < 0)
- LDR partW, [sp,#0x220] ;// partWidth
- ADD tmp4, x0, partW ;// (x0+partWidth)
- ADD tmp4, tmp4, #5 ;// (y0+partW+5)
- LDR width, [sp,#0x218] ;// width
- CMP tmp4, width
- BHI do_fill ;// (x0+partW)>width
-
- CMP y0, #0
- BLT do_fill ;// (y0 < 0)
- LDR partH, [sp,#0x224] ;// partHeight
- ADD tmp2, y0, partH ;// (y0+partHeight)
- LDR height, [sp,#0x21c] ;// height
- CMP tmp2, height
- BLS skip_fill ;// no overfill needed
-
-
-do_fill
- LDR partH, [sp,#0x224] ;// partHeight
- LDR height, [sp,#0x21c] ;// height
- LDR partW, [sp,#0x220] ;// partWidth
- ADD tmp4, partW, #5 ;// tmp4 = partW + 5;
- STMIB sp, {height, tmp4} ;// sp+4 = height, sp+8 = partWidth+5
- STR partH, [sp,#0xc] ;// sp+c = partHeight
- STR tmp4, [sp,#0x10] ;// sp+10 = partWidth+5
- LDR width, [sp,#0x218] ;// width
- STR width, [sp,#0] ;// sp+0 = width
- ADD buff, sp, #0x28 ;// buff = p1[21*21/4+1]
- BL h264bsdFillBlock
-
- MOV x0, #0
- STR x0,[sp,#0x1ec] ;// x0 = 0
- STR x0,[sp,#0x1f0] ;// y0 = 0
- ADD ref,sp,#0x28 ;// ref = p1
- STR tmp4, [sp,#0x218] ;// width = partWidth+5
-
-
-skip_fill
- LDR x0 ,[sp,#0x1ec] ;// x0
- LDR y0 ,[sp,#0x1f0] ;// y0
- LDR width, [sp,#0x218] ;// width
- MLA tmp2, width, y0, x0 ;// y0*width+x0
- ADD ref, ref, tmp2 ;// ref += y0*width+x0
- ADD ref, ref, #8 ;// ref = ref+8
- LDR mb, [sp, #0x1e8] ;// mb
-
- ;// pack values to count register
- ;// [31:28] loop_x (partWidth-1)
- ;// [27:24] loop_y (partHeight-1)
- ;// [23:20] partWidth-1
- ;// [19:16] partHeight-1
- ;// [15:00] width
- MOV count, width
- SUB partW, partW, #1;
- SUB partH, partH, #1;
- ADD tmp2, partH, partW, LSL #4
- ADD count, count, tmp2, LSL #16
-
-
- LDR mult_20_01, = 0x00140001
- LDR mult_20_m5, = 0x0014FFFB
- MOV plus16, #16
- AND tmp1, count, #0x000F0000 ;// partHeight-1
- AND tmp3, count, #0x00F00000 ;// partWidth-1
- ADD count, count, tmp1, LSL #8
-loop_y
- LDR x_3_1, [ref, #-8]
- ADD count, count, tmp3, LSL #8
- LDR x_7_5, [ref, #-4]
- UXTB16 x_2_0, x_3_1
- UXTB16 x_3_1, x_3_1, ROR #8
- UXTB16 x_6_4, x_7_5
-
-loop_x
- UXTB16 x_7_5, x_7_5, ROR #8
-
- SMLAD tmp1, x_2_0, mult_20_01, plus16
- SMLATB tmp3, x_2_0, mult_20_01, plus16
- SMLATB tmp2, x_2_0, mult_20_m5, plus16
- SMLATB tmp4, x_3_1, mult_20_01, plus16
-
- SMLAD tmp1, x_3_1, mult_20_m5, tmp1
- SMLATB tmp3, x_3_1, mult_20_m5, tmp3
- SMLAD tmp2, x_3_1, mult_20_01, tmp2
- LDR x_3_1, [ref], #4
- SMLAD tmp4, x_6_4, mult_20_m5, tmp4
-
- SMLABB tmp1, x_6_4, mult_20_m5, tmp1
- SMLADX tmp3, x_6_4, mult_20_m5, tmp3
- SMLADX tmp2, x_6_4, mult_20_01, tmp2
- SMLADX tmp4, x_7_5, mult_20_m5, tmp4
-
- SMLABB tmp1, x_7_5, mult_20_01, tmp1
- UXTB16 x_2_0, x_3_1
- SMLABB tmp2, x_7_5, mult_20_m5, tmp2
- SMLADX tmp3, x_7_5, mult_20_01, tmp3
- SMLABB tmp4, x_2_0, mult_20_01, tmp4
-
- MOV tmp2, tmp2, ASR #5
- MOV tmp1, tmp1, ASR #5
- PKHBT tmp2, tmp2, tmp4, LSL #(16-5)
- PKHBT tmp1, tmp1, tmp3, LSL #(16-5)
- LDR tmp4, [sp, #0x228]
- USAT16 tmp2, #8, tmp2
- USAT16 tmp1, #8, tmp1
- SUB tmp4, tmp4, #10
-
- SUBS count, count, #4<<28
- LDR tmp3, [ref, tmp4]
- ORR tmp1, tmp1, tmp2, LSL #8
-
-;// quarter pel position
- LDR tmp2, = 0x80808080
- MVN tmp3, tmp3
- UHSUB8 tmp1, tmp1, tmp3
- EOR tmp1, tmp1, tmp2
- STR tmp1, [mb], #4
-
- BCC next_y
-
- UXTB16 x_3_1, x_3_1, ROR #8
-
- SMLAD tmp1, x_6_4, mult_20_01, plus16
- SMLATB tmp3, x_6_4, mult_20_01, plus16
- SMLATB tmp2, x_6_4, mult_20_m5, plus16
- SMLATB tmp4, x_7_5, mult_20_01, plus16
-
- SMLAD tmp1, x_7_5, mult_20_m5, tmp1
- SMLATB tmp3, x_7_5, mult_20_m5, tmp3
- SMLAD tmp2, x_7_5, mult_20_01, tmp2
- LDR x_7_5, [ref], #4
- SMLAD tmp4, x_2_0, mult_20_m5, tmp4
-
- SMLABB tmp1, x_2_0, mult_20_m5, tmp1
- SMLADX tmp3, x_2_0, mult_20_m5, tmp3
- SMLADX tmp2, x_2_0, mult_20_01, tmp2
- SMLADX tmp4, x_3_1, mult_20_m5, tmp4
-
- SMLABB tmp1, x_3_1, mult_20_01, tmp1
- UXTB16 x_6_4, x_7_5
- SMLABB tmp2, x_3_1, mult_20_m5, tmp2
- SMLADX tmp3, x_3_1, mult_20_01, tmp3
- SMLABB tmp4, x_6_4, mult_20_01, tmp4
-
- MOV tmp2, tmp2, ASR #5
- MOV tmp1, tmp1, ASR #5
- PKHBT tmp2, tmp2, tmp4, LSL #(16-5)
- PKHBT tmp1, tmp1, tmp3, LSL #(16-5)
- LDR tmp4, [sp, #0x228]
- USAT16 tmp2, #8, tmp2
- USAT16 tmp1, #8, tmp1
- SUB tmp4, tmp4, #10
-
- SUBS count, count, #4<<28
- LDR tmp3, [ref, tmp4]
- ORR tmp1, tmp1, tmp2, LSL #8
-
-;// quarter pel
- LDR tmp2, = 0x80808080
- MVN tmp3, tmp3
- UHSUB8 tmp1, tmp1, tmp3
- EOR tmp1, tmp1, tmp2
-
- STR tmp1, [mb], #4
- BCS loop_x
-
-next_y
- AND tmp3, count, #0x00F00000 ;// partWidth-1
- SMLABB ref, count, mult_20_01, ref ;// +width
- ADDS mb, mb, #16 ;// +16, Carry=0
- SBC mb, mb, tmp3, LSR #20 ;// -(partWidth-1)-1
- SBC ref, ref, tmp3, LSR #20 ;// -(partWidth-1)-1
- ADDS count, count, #(1<<28)-(1<<24)
- BGE loop_y
-
- ADD sp,sp,#0x1f4
- LDMFD sp!, {r4-r11, pc}
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_hor_ver_quarter.s b/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_hor_ver_quarter.s
deleted file mode 100644
index 1c79b39..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_hor_ver_quarter.s
+++ /dev/null
@@ -1,536 +0,0 @@
-; Copyright (C) 2009 The Android Open Source Project
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-
-;-------------------------------------------------------------------------------
-;--
-;-- Abstract : ARMv6 optimized version of h264bsdInterpolateHorVerQuarter
-;-- function
-;--
-;-------------------------------------------------------------------------------
-
-
- IF :DEF: H264DEC_WINASM
- ;// We dont use REQUIRE8 and PRESERVE8 for winasm
- ELSE
- REQUIRE8
- PRESERVE8
- ENDIF
-
- AREA |.text|, CODE
-
-;// h264bsdInterpolateHorVerQuarter register allocation
-
-ref RN 0
-
-mb RN 1
-buff RN 1
-
-count RN 2
-x0 RN 2
-
-y0 RN 3
-x_2_0 RN 3
-res RN 3
-
-x_3_1 RN 4
-tmp1 RN 4
-
-height RN 5
-x_6_4 RN 5
-tmp2 RN 5
-
-partW RN 6
-x_7_5 RN 6
-tmp3 RN 6
-
-partH RN 7
-tmp4 RN 7
-
-tmp5 RN 8
-
-tmp6 RN 9
-
-tmpa RN 10
-
-mult_20_01 RN 11
-tmpb RN 11
-
-mult_20_m5 RN 12
-width RN 12
-
-plus16 RN 14
-
-
-;// function exports and imports
-
- IMPORT h264bsdFillBlock
-
- EXPORT h264bsdInterpolateHorVerQuarter
-
-;// Horizontal filter approach
-;//
-;// Basic idea in horizontal filtering is to adjust coefficients
-;// like below. Calculation is done with 16-bit maths.
-;//
-;// Reg x_2_0 x_3_1 x_6_4 x_7_5 x_2_0
-;// [ 2 0 ] [ 3 1 ] [ 6 4 ] [ 7 5 ] [ 10 8 ] ...
-;// y_0 = 20 1 20 -5 -5 1
-;// y_1 = -5 20 1 1 20 -5
-;// y_2 = 1 -5 -5 20 1 20
-;// y_3 = 1 20 -5 -5 20 1
-
-
-h264bsdInterpolateHorVerQuarter
- STMFD sp!, {r0-r11, lr}
- SUB sp, sp, #0x1e4
-
- CMP x0, #0
- BLT do_fill ;// (x0 < 0)
- LDR partW, [sp,#0x220] ;// partWidth
- LDR width, [sp,#0x218] ;// width
- ADD tmpa, x0, partW ;// (x0+partWidth)
- ADD tmpa, tmpa, #5 ;// (x0+partW+5)
- CMP tmpa, width
- BHI do_fill ;// (x0+partW)>width
-
- CMP y0, #0
- BLT do_fill ;// (y0 < 0)
- LDR partH, [sp,#0x224] ;// partHeight
- LDR height, [sp,#0x21c] ;// height
- ADD tmp5, y0, partH ;// (y0+partHeight)
- ADD tmp5, tmp5, #5 ;// (y0+partH+5)
- CMP tmp5, height
- BLS skip_fill ;// no overfill needed
-
-
-do_fill
- LDR partH, [sp,#0x224] ;// partHeight
- LDR partW, [sp,#0x220] ;// partWidth
- LDR height, [sp,#0x21c] ;// height
- ADD tmp5, partH, #5 ;// tmp5 = partH + 5
- ADD tmpa, partW, #5 ;// tmpa = partW + 5
- STMIB sp, {height, tmpa} ;// sp+4 = height, sp+8 = partWidth+5
- LDR width, [sp,#0x218] ;// width
- STR tmp5, [sp,#0xc] ;// sp+c = partHeight+5
- STR tmpa, [sp,#0x10] ;// sp+10 = partWidth+5
- STR width, [sp,#0] ;// sp+0 = width
- ADD buff, sp, #0x28 ;// buff = p1[21*21/4+1]
- BL h264bsdFillBlock
-
- MOV x0, #0
- STR x0,[sp,#0x1ec] ;// x0 = 0
- STR x0,[sp,#0x1f0] ;// y0 = 0
- ADD ref,sp,#0x28 ;// ref = p1
- STR tmpa, [sp,#0x218] ;// width = partWidth+5
-
-
-skip_fill
- LDR x0 ,[sp,#0x1ec] ;// x0
- LDR y0 ,[sp,#0x1f0] ;// y0
- LDR width, [sp,#0x218] ;// width
- LDR tmp6, [sp,#0x228] ;// horVerOffset
- LDR mb, [sp, #0x1e8] ;// mb
- MLA tmp5, width, y0, x0 ;// y0*width+x0
- ADD ref, ref, tmp5 ;// ref += y0*width+x0
- STR ref, [sp, #0x1e4] ;// store "ref" for vertical filtering
- AND tmp6, tmp6, #2 ;// calculate ref for horizontal filter
- MOV tmpa, #2
- ADD tmp6, tmpa, tmp6, LSR #1
- MLA ref, tmp6, width, ref
- ADD ref, ref, #8 ;// ref = ref+8
-
- ;// pack values to count register
- ;// [31:28] loop_x (partWidth-1)
- ;// [27:24] loop_y (partHeight-1)
- ;// [23:20] partWidth-1
- ;// [19:16] partHeight-1
- ;// [15:00] width
- MOV count, width
- SUB partW, partW, #1;
- SUB partH, partH, #1;
- ADD tmp5, partH, partW, LSL #4
- ADD count, count, tmp5, LSL #16
-
-
- LDR mult_20_01, = 0x00140001 ;// constant multipliers
- LDR mult_20_m5, = 0x0014FFFB ;// constant multipliers
- MOV plus16, #16 ;// constant for add
- AND tmp4, count, #0x000F0000 ;// partHeight-1
- AND tmp6, count, #0x00F00000 ;// partWidth-1
- ADD count, count, tmp4, LSL #8 ;// partH-1 to lower part of top byte
-
-;// HORIZONTAL PART
-
-loop_y_hor
- LDR x_3_1, [ref, #-8]
- ADD count, count, tmp6, LSL #8 ;// partW-1 to upper part of top byte
- LDR x_7_5, [ref, #-4]
- UXTB16 x_2_0, x_3_1
- UXTB16 x_3_1, x_3_1, ROR #8
- UXTB16 x_6_4, x_7_5
-
-loop_x_hor
- UXTB16 x_7_5, x_7_5, ROR #8
-
- SMLAD tmp4, x_2_0, mult_20_01, plus16
- SMLATB tmp6, x_2_0, mult_20_01, plus16
- SMLATB tmp5, x_2_0, mult_20_m5, plus16
- SMLATB tmpa, x_3_1, mult_20_01, plus16
-
- SMLAD tmp4, x_3_1, mult_20_m5, tmp4
- SMLATB tmp6, x_3_1, mult_20_m5, tmp6
- SMLAD tmp5, x_3_1, mult_20_01, tmp5
- LDR x_3_1, [ref], #4
- SMLAD tmpa, x_6_4, mult_20_m5, tmpa
-
- SMLABB tmp4, x_6_4, mult_20_m5, tmp4
- SMLADX tmp6, x_6_4, mult_20_m5, tmp6
- SMLADX tmp5, x_6_4, mult_20_01, tmp5
- SMLADX tmpa, x_7_5, mult_20_m5, tmpa
-
- SMLABB tmp4, x_7_5, mult_20_01, tmp4
- UXTB16 x_2_0, x_3_1
- SMLABB tmp5, x_7_5, mult_20_m5, tmp5
- SMLADX tmp6, x_7_5, mult_20_01, tmp6
- SMLABB tmpa, x_2_0, mult_20_01, tmpa
-
- MOV tmp5, tmp5, ASR #5
- MOV tmp4, tmp4, ASR #5
- PKHBT tmp5, tmp5, tmpa, LSL #(16-5)
- PKHBT tmp4, tmp4, tmp6, LSL #(16-5)
- USAT16 tmp5, #8, tmp5
- USAT16 tmp4, #8, tmp4
-
- SUBS count, count, #4<<28
- ORR tmp4, tmp4, tmp5, LSL #8
- STR tmp4, [mb], #4
- BCC next_y_hor
-
- UXTB16 x_3_1, x_3_1, ROR #8
-
- SMLAD tmp4, x_6_4, mult_20_01, plus16
- SMLATB tmp6, x_6_4, mult_20_01, plus16
- SMLATB tmp5, x_6_4, mult_20_m5, plus16
- SMLATB tmpa, x_7_5, mult_20_01, plus16
-
- SMLAD tmp4, x_7_5, mult_20_m5, tmp4
- SMLATB tmp6, x_7_5, mult_20_m5, tmp6
- SMLAD tmp5, x_7_5, mult_20_01, tmp5
- LDR x_7_5, [ref], #4
- SMLAD tmpa, x_2_0, mult_20_m5, tmpa
-
- SMLABB tmp4, x_2_0, mult_20_m5, tmp4
- SMLADX tmp6, x_2_0, mult_20_m5, tmp6
- SMLADX tmp5, x_2_0, mult_20_01, tmp5
- SMLADX tmpa, x_3_1, mult_20_m5, tmpa
-
- SMLABB tmp4, x_3_1, mult_20_01, tmp4
- UXTB16 x_6_4, x_7_5
- SMLABB tmp5, x_3_1, mult_20_m5, tmp5
- SMLADX tmp6, x_3_1, mult_20_01, tmp6
- SMLABB tmpa, x_6_4, mult_20_01, tmpa
-
- MOV tmp5, tmp5, ASR #5
- MOV tmp4, tmp4, ASR #5
- PKHBT tmp5, tmp5, tmpa, LSL #(16-5)
- PKHBT tmp4, tmp4, tmp6, LSL #(16-5)
- USAT16 tmp5, #8, tmp5
- USAT16 tmp4, #8, tmp4
-
- SUBS count, count, #4<<28
- ORR tmp4, tmp4, tmp5, LSL #8
- STR tmp4, [mb], #4
- BCS loop_x_hor
-
-next_y_hor
- AND tmp6, count, #0x00F00000 ;// partWidth-1
- SMLABB ref, count, mult_20_01, ref ;// +width
- ADDS mb, mb, #16 ;// +16, Carry=0
- SBC mb, mb, tmp6, LSR #20 ;// -(partWidth-1)-1
- SBC ref, ref, tmp6, LSR #20 ;// -(partWidth-1)-1
- ADDS count, count, #(1<<28)-(1<<24) ;// decrement counter (partW)
- BGE loop_y_hor
-
-
-
-;// VERTICAL PART
-;//
-;// Approach to vertical interpolation
-;//
-;// Interpolation is done by using 32-bit loads and stores
-;// and by using 16 bit arithmetic. 4x4 block is processed
-;// in each round.
-;//
-;// |a_11|a_11|a_11|a_11|...|a_1n|a_1n|a_1n|a_1n|
-;// |b_11|b_11|b_11|b_11|...|b_1n|b_1n|b_1n|b_1n|
-;// |c_11|c_11|c_11|c_11|...|c_1n|c_1n|c_1n|c_1n|
-;// |d_11|d_11|d_11|d_11|...|d_1n|d_1n|d_1n|d_1n|
-;// ..
-;// ..
-;// |a_m1|a_m1|a_m1|a_m1|...
-;// |b_m1|b_m1|b_m1|b_m1|...
-;// |c_m1|c_m1|c_m1|c_m1|...
-;// |d_m1|d_m1|d_m1|d_m1|...
-
-;// Approach to bilinear interpolation to quarter pel position.
-;// 4 bytes are processed parallel
-;//
-;// algorithm (a+b+1)/2. Rouding upwards +1 can be achieved by
-;// negating second operand to get one's complement (instead of 2's)
-;// and using subtraction, EOR is used to correct sign.
-;//
-;// MVN b, b
-;// UHSUB8 a, a, b
-;// EOR a, a, 0x80808080
-
-
- LDR ref, [sp, #0x1e4] ;// ref
- LDR tmpa, [sp, #0x228] ;// horVerOffset
- LDR mb, [sp, #0x1e8] ;// mb
- LDR width, [sp, #0x218] ;// width
- ADD ref, ref, #2 ;// calculate correct position
- AND tmpa, tmpa, #1
- ADD ref, ref, tmpa
- LDR plus16, = 0x00100010 ;// +16 to lower and upperf halfwords
- AND count, count, #0x00FFFFFF ;// partWidth-1
-
- AND tmpa, count, #0x000F0000 ;// partHeight-1
- ADD count, count, tmpa, LSL #8
-
-loop_y
- ADD count, count, tmp6, LSL #8 ;// partWidth-1
-
-loop_x
- LDR tmp1, [ref], width ;// |a4|a3|a2|a1|
- LDR tmp2, [ref], width ;// |c4|c3|c2|c1|
- LDR tmp3, [ref], width ;// |g4|g3|g2|g1|
- LDR tmp4, [ref], width ;// |m4|m3|m2|m1|
- LDR tmp5, [ref], width ;// |r4|r3|r2|r1|
- LDR tmp6, [ref], width ;// |t4|t3|t2|t1|
-
- ;// first four pixels
- UXTB16 tmpa, tmp3 ;// |g3|g1|
- UXTAB16 tmpa, tmpa, tmp4 ;// |g3+m3|g1+m1|
- UXTB16 tmpb, tmp2 ;// |c3|c1|
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
-
- UXTAB16 tmpb, tmpb, tmp5 ;// |c3+r3|c1+r1|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpa, tmpa, tmp1 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp6 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR res, = 0x00FF00FF
- UXTB16 tmpa, tmp3, ROR #8 ;// |g4|g2|
- UXTAB16 tmpa, tmpa, tmp4, ROR #8 ;// |g4+m4|g2+m2|
- AND res, res, tmpb, LSR #5 ;// mask and divide by 32
-
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTB16 tmpb, tmp2, ROR #8 ;// |c4|c2|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpb, tmpb, tmp5, ROR #8 ;// |c4+r4|c2+r2|
- UXTAB16 tmpa, tmpa, tmp1, ROR #8 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp6, ROR #8 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR tmp1, [mb]
- LDR tmpa, = 0xFF00FF00
- MVN tmp1, tmp1
- AND tmpa, tmpa, tmpb, LSL #3 ;// mask and divede by 32
- ORR res, res, tmpa
-
- LDR tmpa, = 0x80808080
- UHSUB8 res, res, tmp1 ;// bilinear interpolation
- LDR tmp1, [ref], width ;// load next row
- EOR res, res, tmpa ;// correct sign
-
- STR res, [mb], #16 ;// next row (mb)
-
-
- ;// tmp2 = |a4|a3|a2|a1|
- ;// tmp3 = |c4|c3|c2|c1|
- ;// tmp4 = |g4|g3|g2|g1|
- ;// tmp5 = |m4|m3|m2|m1|
- ;// tmp6 = |r4|r3|r2|r1|
- ;// tmp1 = |t4|t3|t2|t1|
-
- ;// second four pixels
- UXTB16 tmpa, tmp4 ;// |g3|g1|
- UXTAB16 tmpa, tmpa, tmp5 ;// |g3+m3|g1+m1|
- UXTB16 tmpb, tmp3 ;// |c3|c1|
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTAB16 tmpb, tmpb, tmp6 ;// |c3+r3|c1+r1|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpa, tmpa, tmp2 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp1 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR res, = 0x00FF00FF
- UXTB16 tmpa, tmp4, ROR #8 ;// |g4|g2|
- UXTAB16 tmpa, tmpa, tmp5, ROR #8 ;// |g4+m4|g2+m2|
- AND res, res, tmpb, LSR #5 ;// mask and divide by 32
-
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTB16 tmpb, tmp3, ROR #8 ;// |c4|c2|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpb, tmpb, tmp6, ROR #8 ;// |c4+r4|c2+r2|
- UXTAB16 tmpa, tmpa, tmp2, ROR #8 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp1, ROR #8 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR tmp2, [mb]
- LDR tmpa, = 0xFF00FF00
- MVN tmp2, tmp2
-
- AND tmpa, tmpa, tmpb, LSL #3 ;// mask and divide by 32
- ORR res, res, tmpa
- LDR tmpa, = 0x80808080
- UHSUB8 res, res, tmp2 ;// bilinear interpolation
- LDR tmp2, [ref], width ;// load next row
- EOR res, res, tmpa ;// correct sign
- STR res, [mb], #16 ;// next row
-
- ;// tmp3 = |a4|a3|a2|a1|
- ;// tmp4 = |c4|c3|c2|c1|
- ;// tmp5 = |g4|g3|g2|g1|
- ;// tmp6 = |m4|m3|m2|m1|
- ;// tmp1 = |r4|r3|r2|r1|
- ;// tmp2 = |t4|t3|t2|t1|
-
- ;// third four pixels
- UXTB16 tmpa, tmp5 ;// |g3|g1|
- UXTAB16 tmpa, tmpa, tmp6 ;// |g3+m3|g1+m1|
- UXTB16 tmpb, tmp4 ;// |c3|c1|
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTAB16 tmpb, tmpb, tmp1 ;// |c3+r3|c1+r1|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpa, tmpa, tmp3 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp2 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR res, = 0x00FF00FF
- UXTB16 tmpa, tmp5, ROR #8 ;// |g4|g2|
- UXTAB16 tmpa, tmpa, tmp6, ROR #8 ;// |g4+m4|g2+m2|
- AND res, res, tmpb, LSR #5 ;// mask and divide by 32
-
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTB16 tmpb, tmp4, ROR #8 ;// |c4|c2|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpb, tmpb, tmp1, ROR #8 ;// |c4+r4|c2+r2|
- UXTAB16 tmpa, tmpa, tmp3, ROR #8 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp2, ROR #8 ;// 16+20(G+M)+A+T
-
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR tmp3, [mb]
- LDR tmpa, = 0xFF00FF00
- MVN tmp3, tmp3
-
- AND tmpa, tmpa, tmpb, LSL #3 ;// mask and divide by 32
- ORR res, res, tmpa
- LDR tmpa, = 0x80808080
- UHSUB8 res, res, tmp3 ;// bilinear interpolation
- LDR tmp3, [ref] ;// load next row
- EOR res, res, tmpa ;// correct sign
- STR res, [mb], #16 ;// next row
-
- ;// tmp4 = |a4|a3|a2|a1|
- ;// tmp5 = |c4|c3|c2|c1|
- ;// tmp6 = |g4|g3|g2|g1|
- ;// tmp1 = |m4|m3|m2|m1|
- ;// tmp2 = |r4|r3|r2|r1|
- ;// tmp3 = |t4|t3|t2|t1|
-
- ;// fourth four pixels
- UXTB16 tmpa, tmp6 ;// |g3|g1|
- UXTAB16 tmpa, tmpa, tmp1 ;// |g3+m3|g1+m1|
- UXTB16 tmpb, tmp5 ;// |c3|c1|
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTAB16 tmpb, tmpb, tmp2 ;// |c3+r3|c1+r1|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpa, tmpa, tmp4 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp3 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR res, = 0x00FF00FF
- UXTB16 tmpa, tmp6, ROR #8 ;// |g4|g2|
- UXTAB16 tmpa, tmpa, tmp1, ROR #8 ;// |g4+m4|g2+m2|
- AND res, res, tmpb, LSR #5 ;// mask and divide by 32
-
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTB16 tmpb, tmp5, ROR #8 ;// |c4|c2|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpb, tmpb, tmp2, ROR #8 ;// |c4+r4|c2+r2|
- UXTAB16 tmpa, tmpa, tmp4, ROR #8 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp3, ROR #8 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR tmp5, [mb]
- LDR tmp4, = 0xFF00FF00
- MVN tmp5, tmp5
-
- AND tmpa, tmp4, tmpb, LSL #3 ;// mask and divide by 32
- ORR res, res, tmpa
- LDR tmpa, = 0x80808080
- UHSUB8 res, res, tmp5 ;// bilinear interpolation
-
- ;// decrement loop_x counter
- SUBS count, count, #4<<28 ;// decrement x loop counter
-
- ;// calculate "ref" address for next round
- SUB ref, ref, width, LSL #3 ;// ref -= 8*width;
- ADD ref, ref, #4 ;// next column (4 pixels)
-
- EOR res, res, tmpa ;// correct sign
- STR res, [mb], #-44
-
- BCS loop_x
-
- ADDS mb, mb, #64 ;// set Carry=0
- ADD ref, ref, width, LSL #2 ;// ref += 4*width
- AND tmp6, count, #0x00F00000 ;// partWidth-1
- SBC ref, ref, tmp6, LSR #20 ;// -(partWidth-1)-1
- SBC mb, mb, tmp6, LSR #20 ;// -(partWidth-1)-1
-
- ADDS count, count, #0xC << 24 ;// decrement y loop counter
- BGE loop_y
-
- ADD sp, sp, #0x1f4
- LDMFD sp!, {r4-r11, pc}
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_mid_hor.s b/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_mid_hor.s
deleted file mode 100644
index a81aed7..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_mid_hor.s
+++ /dev/null
@@ -1,163 +0,0 @@
-; Copyright (C) 2009 The Android Open Source Project
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-
-;-------------------------------------------------------------------------------
-;--
-;-- Abstract : ARMv6 optimized version horizontal part of
-;-- h264bsdInterpolateMid functions
-;--
-;-------------------------------------------------------------------------------
-
-
- IF :DEF: H264DEC_WINASM
- ;// We dont use REQUIRE8 and PRESERVE8 for winasm
- ELSE
- REQUIRE8
- PRESERVE8
- ENDIF
-
- AREA |.text|, CODE
-
-
-;// Register allocation
-
-ref RN 0 ;// pointer to current position in reference image
-mb RN 1 ;// pointer to current position in interpolated mb
-count RN 2 ;// bit-packed width and count values
-
-x_2_0 RN 4
-x_3_1 RN 5
-x_6_4 RN 6
-x_7_5 RN 7
-
-tmp1 RN 8
-tmp2 RN 9
-tmp3 RN 10
-tmp4 RN 11
-
-mult_20_01 RN 12 ;// [20, 1]
-mult_20_m5 RN 14 ;// [20, -5]
-
-
- EXPORT h264bsdInterpolateMidHorPart
-
-;// Horizontal filter approach
-;//
-;// Basic idea in horizontal filtering is to adjust coefficients
-;// like below. Calculation is done with 16-bit maths.
-;//
-;// Reg x_2_0 x_3_1 x_6_4 x_7_5 x_2_0
-;// [ 2 0 ] [ 3 1 ] [ 6 4 ] [ 7 5 ] [ 10 8 ] ...
-;// y_0 = 20 1 20 -5 -5 1
-;// y_1 = -5 20 1 1 20 -5
-;// y_2 = 1 -5 -5 20 1 20
-;// y_3 = 1 20 -5 -5 20 1
-
-
-h264bsdInterpolateMidHorPart
- STMFD sp!, {r4-r11, lr}
-
- ;// pack values to count register
- ;// [31:28] loop_x (partWidth-1)
- ;// [27:24] loop_y (partHeight-1)
- ;// [23:20] partWidth-1
- ;// [19:16] partHeight-1
- ;// [15:00] width
-
-
- LDR mult_20_01, = 0x00140001
- LDR mult_20_m5, = 0x0014FFFB
- AND tmp3, count, #0x000F0000 ;// partWidth-1
-loop_y
- LDR x_3_1, [ref, #-8]
- ADD count, count, tmp3, LSL #12
- LDR x_7_5, [ref, #-4]
- UXTB16 x_2_0, x_3_1
- UXTB16 x_3_1, x_3_1, ROR #8
- UXTB16 x_6_4, x_7_5
-
-loop_x
- UXTB16 x_7_5, x_7_5, ROR #8
-
- SMUAD tmp1, x_2_0, mult_20_01
- SMULTB tmp2, x_2_0, mult_20_m5
- SMULTB tmp3, x_2_0, mult_20_01
- SMULTB tmp4, x_3_1, mult_20_01
-
- SMLAD tmp1, x_3_1, mult_20_m5, tmp1
- SMLAD tmp2, x_3_1, mult_20_01, tmp2
- SMLATB tmp3, x_3_1, mult_20_m5, tmp3
- LDR x_3_1, [ref], #4
- SMLAD tmp4, x_6_4, mult_20_m5, tmp4
-
- SMLABB tmp1, x_6_4, mult_20_m5, tmp1
- SMLADX tmp2, x_6_4, mult_20_01, tmp2
- SMLADX tmp3, x_6_4, mult_20_m5, tmp3
- SMLADX tmp4, x_7_5, mult_20_m5, tmp4
-
- SMLABB tmp1, x_7_5, mult_20_01, tmp1
- SMLABB tmp2, x_7_5, mult_20_m5, tmp2
- UXTB16 x_2_0, x_3_1
- SMLADX tmp3, x_7_5, mult_20_01, tmp3
- SMLABB tmp4, x_2_0, mult_20_01, tmp4
-
- SUBS count, count, #4<<28
- STR tmp1, [mb], #4
- STR tmp2, [mb], #4
- STR tmp3, [mb], #4
- STR tmp4, [mb], #4
- BCC next_y
-
- UXTB16 x_3_1, x_3_1, ROR #8
-
- SMUAD tmp1, x_6_4, mult_20_01
- SMULTB tmp2, x_6_4, mult_20_m5
- SMULTB tmp3, x_6_4, mult_20_01
- SMULTB tmp4, x_7_5, mult_20_01
-
- SMLAD tmp1, x_7_5, mult_20_m5, tmp1
- SMLAD tmp2, x_7_5, mult_20_01, tmp2
- SMLATB tmp3, x_7_5, mult_20_m5, tmp3
- LDR x_7_5, [ref], #4
- SMLAD tmp4, x_2_0, mult_20_m5, tmp4
-
- SMLABB tmp1, x_2_0, mult_20_m5, tmp1
- SMLADX tmp2, x_2_0, mult_20_01, tmp2
- SMLADX tmp3, x_2_0, mult_20_m5, tmp3
- SMLADX tmp4, x_3_1, mult_20_m5, tmp4
-
- SMLABB tmp1, x_3_1, mult_20_01, tmp1
- SMLABB tmp2, x_3_1, mult_20_m5, tmp2
- UXTB16 x_6_4, x_7_5
- SMLADX tmp3, x_3_1, mult_20_01, tmp3
- SMLABB tmp4, x_6_4, mult_20_01, tmp4
-
- SUBS count, count, #4<<28
- STR tmp1, [mb], #4
- STR tmp2, [mb], #4
- STR tmp3, [mb], #4
- STR tmp4, [mb], #4
- BCS loop_x
-
-next_y
- AND tmp3, count, #0x000F0000 ;// partWidth-1
- SMLABB ref, count, mult_20_01, ref ;// +width
- SBC ref, ref, tmp3, LSR #16 ;// -(partWidth-1)-1
- ADDS count, count, #(1<<28)-(1<<20)
- BGE loop_y
-
- LDMFD sp!, {r4-r11, pc}
-
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_ver_half.s b/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_ver_half.s
deleted file mode 100644
index 244fc6f..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_ver_half.s
+++ /dev/null
@@ -1,347 +0,0 @@
-; Copyright (C) 2009 The Android Open Source Project
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-
-;-------------------------------------------------------------------------------
-;--
-;-- Abstract : ARMv6 optimized version of h264bsdInterpolateVerHalf function
-;--
-;-------------------------------------------------------------------------------
-
-
- IF :DEF: H264DEC_WINASM
- ;// We dont use REQUIRE8 and PRESERVE8 for winasm
- ELSE
- REQUIRE8
- PRESERVE8
- ENDIF
-
- AREA |.text|, CODE
-
-;// h264bsdInterpolateVerHalf register allocation
-
-ref RN 0
-
-mb RN 1
-buff RN 1
-
-count RN 2
-x0 RN 2
-
-res RN 3
-y0 RN 3
-
-tmp1 RN 4
-
-tmp2 RN 5
-height RN 5
-
-tmp3 RN 6
-partW RN 6
-
-tmp4 RN 7
-partH RN 7
-
-tmp5 RN 8
-tmp6 RN 9
-
-tmpa RN 10
-tmpb RN 11
-width RN 12
-
-plus16 RN 14
-
-
-;// function exports and imports
-
- IMPORT h264bsdFillBlock
-
- EXPORT h264bsdInterpolateVerHalf
-
-;// Approach to vertical interpolation
-;//
-;// Interpolation is done by using 32-bit loads and stores
-;// and by using 16 bit arithmetic. 4x4 block is processed
-;// in each round.
-;//
-;// |a_11|a_11|a_11|a_11|...|a_1n|a_1n|a_1n|a_1n|
-;// |b_11|b_11|b_11|b_11|...|b_1n|b_1n|b_1n|b_1n|
-;// |c_11|c_11|c_11|c_11|...|c_1n|c_1n|c_1n|c_1n|
-;// |d_11|d_11|d_11|d_11|...|d_1n|d_1n|d_1n|d_1n|
-;// ..
-;// ..
-;// |a_m1|a_m1|a_m1|a_m1|...
-;// |b_m1|b_m1|b_m1|b_m1|...
-;// |c_m1|c_m1|c_m1|c_m1|...
-;// |d_m1|d_m1|d_m1|d_m1|...
-
-h264bsdInterpolateVerHalf
- STMFD sp!, {r0-r11, lr}
- SUB sp, sp, #0x1e4
-
- CMP x0, #0
- BLT do_fill ;// (x0 < 0)
- LDR partW, [sp,#0x220] ;// partWidth
- ADD tmp5, x0, partW ;// (x0+partWidth)
- LDR width, [sp,#0x218] ;// width
- CMP tmp5, width
- BHI do_fill ;// (x0+partW)>width
-
- CMP y0, #0
- BLT do_fill ;// (y0 < 0)
- LDR partH, [sp,#0x224] ;// partHeight
- ADD tmp6, y0, partH ;// (y0+partHeight)
- ADD tmp6, tmp6, #5 ;// (y0+partH+5)
- LDR height, [sp,#0x21c] ;// height
- CMP tmp6, height
- BLS skip_fill ;// no overfill needed
-
-
-do_fill
- LDR partH, [sp,#0x224] ;// partHeight
- ADD tmp5, partH, #5 ;// r2 = partH + 5;
- LDR height, [sp,#0x21c] ;// height
- LDR partW, [sp,#0x220] ;// partWidth
- STMIB sp, {height, partW} ;// sp+4 = height, sp+8 = partWidth
- STR tmp5, [sp,#0xc] ;// sp+c partHeight+5
- STR partW, [sp,#0x10] ;// sp+10 = partWidth
- LDR width, [sp,#0x218] ;// width
- STR width, [sp,#0] ;// sp+0 = width
- ADD buff, sp, #0x28 ;// buff = p1[21*21/4+1]
- BL h264bsdFillBlock
-
- MOV x0, #0
- STR x0,[sp,#0x1ec] ;// x0 = 0
- STR x0,[sp,#0x1f0] ;// y0 = 0
- ADD ref,sp,#0x28 ;// ref = p1
- STR partW, [sp,#0x218]
-
-
-skip_fill
- LDR x0 ,[sp,#0x1ec] ;// x0
- LDR y0 ,[sp,#0x1f0] ;// y0
- LDR width, [sp,#0x218] ;// width
- MLA tmp6, width, y0, x0 ;// y0*width+x0
- ADD ref, ref, tmp6 ;// ref += y0*width+x0
- LDR mb, [sp, #0x1e8] ;// mb
-
- ADD count, partW, partH, LSL #16 ;// |partH|partW|
- LDR tmp5, = 0x00010001
- SSUB16 count, count, tmp5; ;// |partH-1|partW-1|
- LDR plus16, = 0x00100010
-
- AND tmp1, count, #0x000000FF ;// partWidth
-
-
-loop_y
- ADD count, count, tmp1, LSL #24 ;// partWidth-1 to top byte
-
-loop_x
- LDR tmp1, [ref], width ;// |a4|a3|a2|a1|
- LDR tmp2, [ref], width ;// |c4|c3|c2|c1|
- LDR tmp3, [ref], width ;// |g4|g3|g2|g1|
- LDR tmp4, [ref], width ;// |m4|m3|m2|m1|
- LDR tmp5, [ref], width ;// |r4|r3|r2|r1|
- LDR tmp6, [ref], width ;// |t4|t3|t2|t1|
-
- ;// first four pixels
- UXTB16 tmpa, tmp3 ;// |g3|g1|
- UXTAB16 tmpa, tmpa, tmp4 ;// |g3+m3|g1+m1|
- UXTB16 tmpb, tmp2 ;// |c3|c1|
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
-
- UXTAB16 tmpb, tmpb, tmp5 ;// |c3+r3|c1+r1|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpa, tmpa, tmp1 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp6 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR res, = 0x00FF00FF
- UXTB16 tmpa, tmp3, ROR #8 ;// |g4|g2|
- UXTAB16 tmpa, tmpa, tmp4, ROR #8 ;// |g4+m4|g2+m2|
- AND res, res, tmpb, LSR #5 ;// mask and divide by 32
-
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTB16 tmpb, tmp2, ROR #8 ;// |c4|c2|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpb, tmpb, tmp5, ROR #8 ;// |c4+r4|c2+r2|
- UXTAB16 tmpa, tmpa, tmp1, ROR #8 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp6, ROR #8 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR tmp1, [ref], width
- LDR tmpa, = 0xFF00FF00
-
- AND tmpa, tmpa, tmpb, LSL #3 ;// mask and divede by 32
- ORR res, res, tmpa
- STR res, [mb], #16 ;// next row (mb)
-
- ;// tmp2 = |a4|a3|a2|a1|
- ;// tmp3 = |c4|c3|c2|c1|
- ;// tmp4 = |g4|g3|g2|g1|
- ;// tmp5 = |m4|m3|m2|m1|
- ;// tmp6 = |r4|r3|r2|r1|
- ;// tmp1 = |t4|t3|t2|t1|
-
- ;// second four pixels
- UXTB16 tmpa, tmp4 ;// |g3|g1|
- UXTAB16 tmpa, tmpa, tmp5 ;// |g3+m3|g1+m1|
- UXTB16 tmpb, tmp3 ;// |c3|c1|
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTAB16 tmpb, tmpb, tmp6 ;// |c3+r3|c1+r1|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpa, tmpa, tmp2 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp1 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR res, = 0x00FF00FF
- UXTB16 tmpa, tmp4, ROR #8 ;// |g4|g2|
- UXTAB16 tmpa, tmpa, tmp5, ROR #8 ;// |g4+m4|g2+m2|
- AND res, res, tmpb, LSR #5 ;// mask and divide by 32
-
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTB16 tmpb, tmp3, ROR #8 ;// |c4|c2|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpb, tmpb, tmp6, ROR #8 ;// |c4+r4|c2+r2|
- UXTAB16 tmpa, tmpa, tmp2, ROR #8 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp1, ROR #8 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR tmp2, [ref], width
- LDR tmpa, = 0xFF00FF00
-
- AND tmpa, tmpa, tmpb, LSL #3 ;// mask and divide by 32
- ORR res, res, tmpa
- STR res, [mb], #16 ;// next row
-
- ;// tmp3 = |a4|a3|a2|a1|
- ;// tmp4 = |c4|c3|c2|c1|
- ;// tmp5 = |g4|g3|g2|g1|
- ;// tmp6 = |m4|m3|m2|m1|
- ;// tmp1 = |r4|r3|r2|r1|
- ;// tmp2 = |t4|t3|t2|t1|
-
- ;// third four pixels
- UXTB16 tmpa, tmp5 ;// |g3|g1|
- UXTAB16 tmpa, tmpa, tmp6 ;// |g3+m3|g1+m1|
- UXTB16 tmpb, tmp4 ;// |c3|c1|
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTAB16 tmpb, tmpb, tmp1 ;// |c3+r3|c1+r1|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpa, tmpa, tmp3 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp2 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR res, = 0x00FF00FF
- UXTB16 tmpa, tmp5, ROR #8 ;// |g4|g2|
- UXTAB16 tmpa, tmpa, tmp6, ROR #8 ;// |g4+m4|g2+m2|
- AND res, res, tmpb, LSR #5 ;// mask and divide by 32
-
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTB16 tmpb, tmp4, ROR #8 ;// |c4|c2|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpb, tmpb, tmp1, ROR #8 ;// |c4+r4|c2+r2|
- UXTAB16 tmpa, tmpa, tmp3, ROR #8 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp2, ROR #8 ;// 16+20(G+M)+A+T
-
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR tmp3, [ref]
- LDR tmpa, = 0xFF00FF00
-
- ;// decrement loop_x counter
- SUBS count, count, #4<<24 ;// (partWidth-1) -= 4;
-
- AND tmpa, tmpa, tmpb, LSL #3 ;// mask and divide by 32
- ORR res, res, tmpa
- STR res, [mb], #16 ;// next row
-
- ;// tmp4 = |a4|a3|a2|a1|
- ;// tmp5 = |c4|c3|c2|c1|
- ;// tmp6 = |g4|g3|g2|g1|
- ;// tmp1 = |m4|m3|m2|m1|
- ;// tmp2 = |r4|r3|r2|r1|
- ;// tmp3 = |t4|t3|t2|t1|
-
- ;// fourth four pixels
- UXTB16 tmpa, tmp6 ;// |g3|g1|
- UXTAB16 tmpa, tmpa, tmp1 ;// |g3+m3|g1+m1|
- UXTB16 tmpb, tmp5 ;// |c3|c1|
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTAB16 tmpb, tmpb, tmp2 ;// |c3+r3|c1+r1|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpa, tmpa, tmp4 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp3 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR res, = 0x00FF00FF
- UXTB16 tmpa, tmp6, ROR #8 ;// |g4|g2|
- UXTAB16 tmpa, tmpa, tmp1, ROR #8 ;// |g4+m4|g2+m2|
- AND res, res, tmpb, LSR #5 ;// mask and divide by 32
-
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTB16 tmpb, tmp5, ROR #8 ;// |c4|c2|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpb, tmpb, tmp2, ROR #8 ;// |c4+r4|c2+r2|
- UXTAB16 tmpa, tmpa, tmp4, ROR #8 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp3, ROR #8 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR tmp4, = 0xFF00FF00
-
- ;// calculate "ref" address for next round
- SUB ref, ref, width, LSL #3 ;// ref -= 8*width;
- ADD ref, ref, #4; ;// next column (4 pixels)
- AND tmpa, tmp4, tmpb, LSL #3 ;// mask and divide by 32
- ORR res, res, tmpa
- STR res, [mb], #-44
-
- BCS loop_x
-
- ADDS count, count, #252<<16 ;// (partHeight-1) -= 4;
- ADD ref, ref, width, LSL #2 ;// ref += 4*width
- AND tmp1, count, #0x000000FF ;// partWidth-1
- ADD tmp2, tmp1, #1 ;// partWidth
- SUB ref, ref, tmp2 ;// ref -= partWidth
- ADD mb, mb, #64;
- SUB mb, mb, tmp2; ;// mb -= partWidth
- BGE loop_y
-
- ADD sp,sp,#0x1f4
- LDMFD sp!, {r4-r11, pc}
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_ver_quarter.s b/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_ver_quarter.s
deleted file mode 100644
index 5266c85..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/h264bsd_interpolate_ver_quarter.s
+++ /dev/null
@@ -1,374 +0,0 @@
-; Copyright (C) 2009 The Android Open Source Project
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-
-;-------------------------------------------------------------------------------
-;--
-;-- Abstract : ARMv6 optimized version of h264bsdInterpolateVerQuarter function
-;--
-;-------------------------------------------------------------------------------
-
- IF :DEF: H264DEC_WINASM
- ;// We dont use REQUIRE8 and PRESERVE8 for winasm
- ELSE
- REQUIRE8
- PRESERVE8
- ENDIF
-
- AREA |.text|, CODE
-
-;// h264bsdInterpolateVerQuarter register allocation
-
-ref RN 0
-
-mb RN 1
-buff RN 1
-
-count RN 2
-x0 RN 2
-
-res RN 3
-y0 RN 3
-
-tmp1 RN 4
-
-tmp2 RN 5
-height RN 5
-
-tmp3 RN 6
-partW RN 6
-
-tmp4 RN 7
-partH RN 7
-
-tmp5 RN 8
-tmp6 RN 9
-
-tmpa RN 10
-tmpb RN 11
-width RN 12
-
-plus16 RN 14
-
-
-;// function exports and imports
-
- IMPORT h264bsdFillBlock
-
- EXPORT h264bsdInterpolateVerQuarter
-
-;// Approach to vertical interpolation
-;//
-;// Interpolation is done by using 32-bit loads and stores
-;// and by using 16 bit arithmetic. 4x4 block is processed
-;// in each round.
-;//
-;// |a_11|a_11|a_11|a_11|...|a_1n|a_1n|a_1n|a_1n|
-;// |b_11|b_11|b_11|b_11|...|b_1n|b_1n|b_1n|b_1n|
-;// |c_11|c_11|c_11|c_11|...|c_1n|c_1n|c_1n|c_1n|
-;// |d_11|d_11|d_11|d_11|...|d_1n|d_1n|d_1n|d_1n|
-;// ..
-;// ..
-;// |a_m1|a_m1|a_m1|a_m1|...
-;// |b_m1|b_m1|b_m1|b_m1|...
-;// |c_m1|c_m1|c_m1|c_m1|...
-;// |d_m1|d_m1|d_m1|d_m1|...
-
-h264bsdInterpolateVerQuarter
- STMFD sp!, {r0-r11, lr}
- SUB sp, sp, #0x1e4
-
- CMP x0, #0
- BLT do_fill ;// (x0 < 0)
- LDR partW, [sp,#0x220] ;// partWidth
- ADD tmp5, x0, partW ;// (x0+partWidth)
- LDR width, [sp,#0x218] ;// width
- CMP tmp5, width
- BHI do_fill ;// (x0+partW)>width
-
- CMP y0, #0
- BLT do_fill ;// (y0 < 0)
- LDR partH, [sp,#0x224] ;// partHeight
- ADD tmp6, y0, partH ;// (y0+partHeight)
- ADD tmp6, tmp6, #5 ;// (y0+partH+5)
- LDR height, [sp,#0x21c] ;// height
- CMP tmp6, height
- BLS skip_fill ;// no overfill needed
-
-
-do_fill
- LDR partH, [sp,#0x224] ;// partHeight
- ADD tmp5, partH, #5 ;// r2 = partH + 5;
- LDR height, [sp,#0x21c] ;// height
- LDR partW, [sp,#0x220] ;// partWidth
- STMIB sp, {height, partW} ;// sp+4 = height, sp+8 = partWidth
- STR tmp5, [sp,#0xc] ;// sp+c partHeight+5
- STR partW, [sp,#0x10] ;// sp+10 = partWidth
- LDR width, [sp,#0x218] ;// width
- STR width, [sp,#0] ;// sp+0 = width
- ADD buff, sp, #0x28 ;// buff = p1[21*21/4+1]
- BL h264bsdFillBlock
-
- MOV x0, #0
- STR x0,[sp,#0x1ec] ;// x0 = 0
- STR x0,[sp,#0x1f0] ;// y0 = 0
- ADD ref,sp,#0x28 ;// ref = p1
- STR partW, [sp,#0x218]
-
-
-skip_fill
- LDR x0 ,[sp,#0x1ec] ;// x0
- LDR y0 ,[sp,#0x1f0] ;// y0
- LDR width, [sp,#0x218] ;// width
- MLA tmp6, width, y0, x0 ;// y0*width+x0
- ADD ref, ref, tmp6 ;// ref += y0*width+x0
- LDR mb, [sp, #0x1e8] ;// mb
-
- ADD count, partW, partH, LSL #8 ;// |xx|xx|partH|partW|
- LDR tmp5, = 0x00010100
- RSB count, tmp5, count, LSL #8 ;// |xx|partH-1|partW-1|xx|
- LDR tmp2, [sp, #0x228] ;// verOffset
- ADD count, count, tmp2 ;// |xx|partH-1|partW-1|verOffset|
- LDR plus16, = 0x00100010
-
- AND tmp1, count, #0x0000FF00 ;// partWidth
-
-
-loop_y
- ADD count, count, tmp1, LSL #16 ;// partWidth-1 to top byte
-
-loop_x
- LDR tmp1, [ref], width ;// |a4|a3|a2|a1|
- LDR tmp2, [ref], width ;// |c4|c3|c2|c1|
- LDR tmp3, [ref], width ;// |g4|g3|g2|g1|
- LDR tmp4, [ref], width ;// |m4|m3|m2|m1|
- LDR tmp5, [ref], width ;// |r4|r3|r2|r1|
- LDR tmp6, [ref], width ;// |t4|t3|t2|t1|
-
- ;// first four pixels
- UXTB16 tmpa, tmp3 ;// |g3|g1|
- UXTAB16 tmpa, tmpa, tmp4 ;// |g3+m3|g1+m1|
- UXTB16 tmpb, tmp2 ;// |c3|c1|
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
-
- UXTAB16 tmpb, tmpb, tmp5 ;// |c3+r3|c1+r1|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpa, tmpa, tmp1 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp6 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR res, = 0x00FF00FF
- UXTB16 tmpa, tmp3, ROR #8 ;// |g4|g2|
- UXTAB16 tmpa, tmpa, tmp4, ROR #8 ;// |g4+m4|g2+m2|
- AND res, res, tmpb, LSR #5 ;// mask and divide by 32
-
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTB16 tmpb, tmp2, ROR #8 ;// |c4|c2|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpb, tmpb, tmp5, ROR #8 ;// |c4+r4|c2+r2|
- UXTAB16 tmpa, tmpa, tmp1, ROR #8 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp6, ROR #8 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- MOVS tmp1, count, LSL #31 ;// update flags (verOffset)
- LDR tmpa, = 0xFF00FF00
- MVNEQ tmp1, tmp3 ;// select verOffset=0
- MVNNE tmp1, tmp4 ;// select verOffset=1
- AND tmpa, tmpa, tmpb, LSL #3 ;// mask and divede by 32
- ORR res, res, tmpa
-
- LDR tmpa, = 0x80808080
- UHSUB8 res, res, tmp1 ;// bilinear interpolation
- LDR tmp1, [ref], width ;// load next row
- EOR res, res, tmpa ;// correct sign
-
- STR res, [mb], #16 ;// next row (mb)
-
-
- ;// tmp2 = |a4|a3|a2|a1|
- ;// tmp3 = |c4|c3|c2|c1|
- ;// tmp4 = |g4|g3|g2|g1|
- ;// tmp5 = |m4|m3|m2|m1|
- ;// tmp6 = |r4|r3|r2|r1|
- ;// tmp1 = |t4|t3|t2|t1|
-
- ;// second four pixels
- UXTB16 tmpa, tmp4 ;// |g3|g1|
- UXTAB16 tmpa, tmpa, tmp5 ;// |g3+m3|g1+m1|
- UXTB16 tmpb, tmp3 ;// |c3|c1|
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTAB16 tmpb, tmpb, tmp6 ;// |c3+r3|c1+r1|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpa, tmpa, tmp2 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp1 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR res, = 0x00FF00FF
- UXTB16 tmpa, tmp4, ROR #8 ;// |g4|g2|
- UXTAB16 tmpa, tmpa, tmp5, ROR #8 ;// |g4+m4|g2+m2|
- AND res, res, tmpb, LSR #5 ;// mask and divide by 32
-
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTB16 tmpb, tmp3, ROR #8 ;// |c4|c2|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpb, tmpb, tmp6, ROR #8 ;// |c4+r4|c2+r2|
- UXTAB16 tmpa, tmpa, tmp2, ROR #8 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp1, ROR #8 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR tmpa, = 0xFF00FF00
- MVNEQ tmp2, tmp4 ;// select verOffset=0
- MVNNE tmp2, tmp5 ;// select verOffset=1
-
- AND tmpa, tmpa, tmpb, LSL #3 ;// mask and divide by 32
- ORR res, res, tmpa
- LDR tmpa, = 0x80808080
- UHSUB8 res, res, tmp2 ;// bilinear interpolation
- LDR tmp2, [ref], width ;// load next row
- EOR res, res, tmpa ;// correct sign
- STR res, [mb], #16 ;// next row
-
- ;// tmp3 = |a4|a3|a2|a1|
- ;// tmp4 = |c4|c3|c2|c1|
- ;// tmp5 = |g4|g3|g2|g1|
- ;// tmp6 = |m4|m3|m2|m1|
- ;// tmp1 = |r4|r3|r2|r1|
- ;// tmp2 = |t4|t3|t2|t1|
-
- ;// third four pixels
- UXTB16 tmpa, tmp5 ;// |g3|g1|
- UXTAB16 tmpa, tmpa, tmp6 ;// |g3+m3|g1+m1|
- UXTB16 tmpb, tmp4 ;// |c3|c1|
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTAB16 tmpb, tmpb, tmp1 ;// |c3+r3|c1+r1|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpa, tmpa, tmp3 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp2 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR res, = 0x00FF00FF
- UXTB16 tmpa, tmp5, ROR #8 ;// |g4|g2|
- UXTAB16 tmpa, tmpa, tmp6, ROR #8 ;// |g4+m4|g2+m2|
- AND res, res, tmpb, LSR #5 ;// mask and divide by 32
-
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTB16 tmpb, tmp4, ROR #8 ;// |c4|c2|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpb, tmpb, tmp1, ROR #8 ;// |c4+r4|c2+r2|
- UXTAB16 tmpa, tmpa, tmp3, ROR #8 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp2, ROR #8 ;// 16+20(G+M)+A+T
-
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR tmpa, = 0xFF00FF00
- MVNEQ tmp3, tmp5 ;// select verOffset=0
- MVNNE tmp3, tmp6 ;// select verOffset=1
-
- AND tmpa, tmpa, tmpb, LSL #3 ;// mask and divide by 32
- ORR res, res, tmpa
- LDR tmpa, = 0x80808080
- UHSUB8 res, res, tmp3 ;// bilinear interpolation
- LDR tmp3, [ref] ;// load next row
- EOR res, res, tmpa ;// correct sign
- STR res, [mb], #16 ;// next row
-
- ;// tmp4 = |a4|a3|a2|a1|
- ;// tmp5 = |c4|c3|c2|c1|
- ;// tmp6 = |g4|g3|g2|g1|
- ;// tmp1 = |m4|m3|m2|m1|
- ;// tmp2 = |r4|r3|r2|r1|
- ;// tmp3 = |t4|t3|t2|t1|
-
- ;// fourth four pixels
- UXTB16 tmpa, tmp6 ;// |g3|g1|
- UXTAB16 tmpa, tmpa, tmp1 ;// |g3+m3|g1+m1|
- UXTB16 tmpb, tmp5 ;// |c3|c1|
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTAB16 tmpb, tmpb, tmp2 ;// |c3+r3|c1+r1|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpa, tmpa, tmp4 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp3 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR res, = 0x00FF00FF
- UXTB16 tmpa, tmp6, ROR #8 ;// |g4|g2|
- UXTAB16 tmpa, tmpa, tmp1, ROR #8 ;// |g4+m4|g2+m2|
- AND res, res, tmpb, LSR #5 ;// mask and divide by 32
-
- ADD tmpa, tmpa, tmpa, LSL #2 ;// 5(G+M)
- UXTB16 tmpb, tmp5, ROR #8 ;// |c4|c2|
- ADD tmpa, plus16, tmpa, LSL #2 ;// 16+20(G+M)
- UXTAB16 tmpb, tmpb, tmp2, ROR #8 ;// |c4+r4|c2+r2|
- UXTAB16 tmpa, tmpa, tmp4, ROR #8 ;// 16+20(G+M)+A
- UXTAB16 tmpa, tmpa, tmp3, ROR #8 ;// 16+20(G+M)+A+T
-
- ADD tmpb, tmpb, tmpb, LSL #2 ;// 5(C+R)
- SSUB16 tmpa, tmpa, tmpb ;// 16+20(G+M)+(A+T)-5(C+R)
-
- USAT16 tmpb, #13, tmpa ;// saturate
- LDR tmp4, = 0xFF00FF00
- MVNEQ tmp5, tmp6 ;// select verOffset=0
- MVNNE tmp5, tmp1 ;// select verOffset=1
-
- AND tmpa, tmp4, tmpb, LSL #3 ;// mask and divide by 32
- ORR res, res, tmpa
- LDR tmpa, = 0x80808080
- UHSUB8 res, res, tmp5 ;// bilinear interpolation
-
- ;// decrement loop_x counter
- SUBS count, count, #4<<24 ;// (partWidth-1) -= 4;
-
- ;// calculate "ref" address for next round
- SUB ref, ref, width, LSL #3 ;// ref -= 8*width;
- ADD ref, ref, #4; ;// next column (4 pixels)
-
- EOR res, res, tmpa ;// correct sign
- STR res, [mb], #-44
-
- BCS loop_x
-
- ADDS count, count, #252<<16 ;// (partHeight-1) -= 4;
- ADD ref, ref, width, LSL #2 ;// ref += 4*width
- AND tmp1, count, #0x0000FF00 ;// partWidth-1
- MOV tmp2, #1
- ADD tmp2, tmp2, tmp1, LSR #8 ;// partWidth
- SUB ref, ref, tmp2 ;// ref -= partWidth
- ADD mb, mb, #64;
- SUB mb, mb, tmp2; ;// mb -= partWidth
- BGE loop_y
-
- ADD sp,sp,#0x1f4
- LDMFD sp!, {r4-r11, pc}
-
- END
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/win_asm.bat b/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/win_asm.bat
deleted file mode 100644
index 1b8d88c..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm11_asm/win_asm.bat
+++ /dev/null
@@ -1,15 +0,0 @@
-echo off
-set ASMFLAGS= -checkreglist -CPU ARM1136 -PreDefine "H264DEC_WINASM SETL {TRUE}"
-set ASM="D:\Program Files\Microsoft Visual Studio 8\VC\ce\bin\x86_arm\armasm"
-echo on
-
-%ASM% %ASMFLAGS% h264bsd_interpolate_chroma_ver.s
-%ASM% %ASMFLAGS% h264bsd_interpolate_chroma_hor.s
-%ASM% %ASMFLAGS% h264bsd_interpolate_hor_half.s
-%ASM% %ASMFLAGS% h264bsd_interpolate_hor_quarter.s
-%ASM% %ASMFLAGS% h264bsd_interpolate_hor_ver_quarter.s
-%ASM% %ASMFLAGS% h264bsd_interpolate_ver_half.s
-%ASM% %ASMFLAGS% h264bsd_interpolate_ver_quarter.s
-
-rem %ASM% %ASMFLAGS% h264bsd_interpolate_chroma_hor_ver.s
-rem %ASM% %ASMFLAGS% h264bsd_interpolate_mid_hor.s
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm/h264bsdClearMbLayer.s b/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm/h264bsdClearMbLayer.s
deleted file mode 100644
index db11654..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm/h264bsdClearMbLayer.s
+++ /dev/null
@@ -1,66 +0,0 @@
-;
-; Copyright (C) 2009 The Android Open Source Project
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-;
-
- REQUIRE8
- PRESERVE8
-
- AREA |.text|, CODE
-
- EXPORT h264bsdClearMbLayer
-
-; Input / output registers
-pMbLayer RN 0
-size RN 1
-pTmp RN 2
-step RN 3
-
-; -- NEON registers --
-
-qZero QN Q0.U8
-
-;/*------------------------------------------------------------------------------
-;
-; Function: h264bsdClearMbLayer
-;
-; Functional description:
-;
-; Inputs:
-;
-; Outputs:
-;
-; Returns:
-;
-;------------------------------------------------------------------------------*/
-
-h264bsdClearMbLayer
-
- VMOV qZero, #0
- ADD pTmp, pMbLayer, #16
- MOV step, #32
- SUBS size, size, #64
-
-loop
- VST1 qZero, [pMbLayer], step
- SUBS size, size, #64
- VST1 qZero, [pTmp], step
- VST1 qZero, [pMbLayer], step
- VST1 qZero, [pTmp], step
- BCS loop
-
- BX lr
- END
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm/h264bsdCountLeadingZeros.s b/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm/h264bsdCountLeadingZeros.s
deleted file mode 100644
index c7bd73e..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm/h264bsdCountLeadingZeros.s
+++ /dev/null
@@ -1,49 +0,0 @@
-;
-; Copyright (C) 2009 The Android Open Source Project
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-;
-
- REQUIRE8
- PRESERVE8
-
- AREA |.text|, CODE
-
- EXPORT h264bsdCountLeadingZeros
-
-; Input / output registers
-value RN 0
-
-; -- NEON registers --
-
-;/*------------------------------------------------------------------------------
-;
-; Function: h264bsdCountLeadingZeros
-;
-; Functional description:
-;
-; Inputs:
-;
-; Outputs:
-;
-; Returns:
-;
-;------------------------------------------------------------------------------*/
-
-h264bsdCountLeadingZeros
-
- CLZ value, value
- BX lr
- END
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm/h264bsdFillRow7.s b/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm/h264bsdFillRow7.s
deleted file mode 100644
index 5bfac92..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm/h264bsdFillRow7.s
+++ /dev/null
@@ -1,180 +0,0 @@
-;
-; Copyright (C) 2009 The Android Open Source Project
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-;
-
- REQUIRE8
- PRESERVE8
-
- AREA |.text|, CODE
-
- EXPORT h264bsdFillRow7
-
-; Input / output registers
-
-ref RN 0
-fill RN 1
-left RN 2
-tmp2 RN 2
-center RN 3
-right RN 4
-tmp1 RN 5
-
-; -- NEON registers --
-
-qTmp0 QN Q0.U8
-qTmp1 QN Q1.U8
-dTmp0 DN D0.U8
-dTmp1 DN D1.U8
-dTmp2 DN D2.U8
-dTmp3 DN D3.U8
-
-
-;/*------------------------------------------------------------------------------
-;
-; Function: h264bsdFillRow7
-;
-; Functional description:
-;
-; Inputs:
-;
-; Outputs:
-;
-; Returns:
-;
-;------------------------------------------------------------------------------*/
-
-h264bsdFillRow7
- PUSH {r4-r6,lr}
- CMP left, #0
- LDR right, [sp,#0x10]
- BEQ switch_center
- LDRB tmp1, [ref,#0]
-
-loop_left
- SUBS left, left, #1
- STRB tmp1, [fill], #1
- BNE loop_left
-
-switch_center
- ASR tmp2,center,#2
- CMP tmp2,#9
- ADDCC pc,pc,tmp2,LSL #2
- B loop_center
- B loop_center
- B case_1
- B case_2
- B case_3
- B case_4
- B case_5
- B case_6
- B case_7
- B case_8
-;case_8
-; LDR tmp2, [ref], #4
-; SUB center, center, #4
-; STR tmp2, [fill], #4
-;case_7
-; LDR tmp2, [ref], #4
-; SUB center, center, #4
-; STR tmp2, [fill], #4
-;case_6
-; LDR tmp2, [ref], #4
-; SUB center, center, #4
-; STR tmp2, [fill],#4
-;case_5
-; LDR tmp2, [ref], #4
-; SUB center, center, #4
-; STR tmp2, [fill],#4
-;case_4
-; LDR tmp2, [ref],#4
-; SUB center, center, #4
-; STR tmp2, [fill], #4
-;case_3
-; LDR tmp2, [ref],#4
-; SUB center, center, #4
-; STR tmp2, [fill], #4
-;case_2
-; LDR tmp2, [ref],#4
-; SUB center, center, #4
-; STR tmp2, [fill], #4
-;case_1
-; LDR tmp2, [ref],#4
-; SUB center, center, #4
-; STR tmp2, [fill], #4
-
-case_8
- VLD1 {qTmp0, qTmp1}, [ref]!
- SUB center, center, #32
- VST1 qTmp0, [fill]!
- VST1 qTmp1, [fill]!
- B loop_center
-case_7
- VLD1 {dTmp0,dTmp1,dTmp2}, [ref]!
- SUB center, center, #28
- LDR tmp2, [ref], #4
- VST1 {dTmp0,dTmp1,dTmp2}, [fill]!
- STR tmp2, [fill],#4
- B loop_center
-case_6
- VLD1 {dTmp0,dTmp1,dTmp2}, [ref]!
- SUB center, center, #24
- VST1 {dTmp0,dTmp1,dTmp2}, [fill]!
- B loop_center
-case_5
- VLD1 qTmp0, [ref]!
- SUB center, center, #20
- LDR tmp2, [ref], #4
- VST1 qTmp0, [fill]!
- STR tmp2, [fill],#4
- B loop_center
-case_4
- VLD1 qTmp0, [ref]!
- SUB center, center, #16
- VST1 qTmp0, [fill]!
- B loop_center
-case_3
- VLD1 dTmp0, [ref]!
- SUB center, center, #12
- LDR tmp2, [ref], #4
- VST1 dTmp0, [fill]!
- STR tmp2, [fill],#4
- B loop_center
-case_2
- LDR tmp2, [ref],#4
- SUB center, center, #4
- STR tmp2, [fill], #4
-case_1
- LDR tmp2, [ref],#4
- SUB center, center, #4
- STR tmp2, [fill], #4
-
-loop_center
- CMP center, #0
- LDRBNE tmp2, [ref], #1
- SUBNE center, center, #1
- STRBNE tmp2, [fill], #1
- BNE loop_center
- CMP right,#0
- POPEQ {r4-r6,pc}
- LDRB tmp2, [ref,#-1]
-
-loop_right
- STRB tmp2, [fill], #1
- SUBS right, right, #1
- BNE loop_right
-
- POP {r4-r6,pc}
- END
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm/h264bsdFlushBits.s b/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm/h264bsdFlushBits.s
deleted file mode 100644
index 21335b8..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm/h264bsdFlushBits.s
+++ /dev/null
@@ -1,82 +0,0 @@
-;
-; Copyright (C) 2009 The Android Open Source Project
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-;
-
- REQUIRE8
- PRESERVE8
-
- AREA |.text|, CODE
-
- EXPORT h264bsdFlushBits
-
-; Input / output registers
-pStrmData RN 0
-numBits RN 1
-readBits RN 2
-strmBuffSize RN 3
-pStrmBuffStart RN 1
-pStrmCurrPos RN 2
-bitPosInWord RN 1
-
-; -- NEON registers --
-
-
-
-;/*------------------------------------------------------------------------------
-;
-; Function: h264bsdFlushBits
-;
-; Functional description:
-;
-; Inputs:
-;
-; Outputs:
-;
-; Returns:
-;
-;------------------------------------------------------------------------------*/
-
-h264bsdFlushBits
-;// PUSH {r4-r6,lr}
-
- LDR readBits, [pStrmData, #0x10]
- LDR strmBuffSize, [pStrmData, #0xC]
-
- ADD readBits, readBits, numBits
- AND bitPosInWord, readBits, #7
-
- STR readBits, [pStrmData, #0x10]
- STR bitPosInWord, [pStrmData, #0x8]
-
- LDR pStrmBuffStart, [pStrmData, #0x0]
-
- CMP readBits, strmBuffSize, LSL #3
-
- BHI end_of_stream
-
- ADD pStrmCurrPos, pStrmBuffStart, readBits, LSR #3
- STR pStrmCurrPos, [pStrmData, #0x4]
- MOV r0, #0
- BX lr
-;// POP {r4-r6,pc}
-
-end_of_stream
- MVN r0, #0
- BX lr
-;// POP {r4-r6,pc}
-
- END
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm/h264bsdWriteMacroblock.s b/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm/h264bsdWriteMacroblock.s
deleted file mode 100644
index 38a0781..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm/h264bsdWriteMacroblock.s
+++ /dev/null
@@ -1,152 +0,0 @@
-;
-; Copyright (C) 2009 The Android Open Source Project
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-;
-
- REQUIRE8
- PRESERVE8
-
- AREA |.text|, CODE
-
- EXPORT h264bsdWriteMacroblock
-
-; Input / output registers
-image RN 0
-data RN 1
-width RN 2
-luma RN 3
-cb RN 4
-cr RN 5
-cwidth RN 6
-
-; -- NEON registers --
-
-qRow0 QN Q0.U8
-qRow1 QN Q1.U8
-qRow2 QN Q2.U8
-qRow3 QN Q3.U8
-qRow4 QN Q4.U8
-qRow5 QN Q5.U8
-qRow6 QN Q6.U8
-qRow7 QN Q7.U8
-qRow8 QN Q8.U8
-qRow9 QN Q9.U8
-qRow10 QN Q10.U8
-qRow11 QN Q11.U8
-qRow12 QN Q12.U8
-qRow13 QN Q13.U8
-qRow14 QN Q14.U8
-qRow15 QN Q15.U8
-
-dRow0 DN D0.U8
-dRow1 DN D1.U8
-dRow2 DN D2.U8
-dRow3 DN D3.U8
-dRow4 DN D4.U8
-dRow5 DN D5.U8
-dRow6 DN D6.U8
-dRow7 DN D7.U8
-dRow8 DN D8.U8
-dRow9 DN D9.U8
-dRow10 DN D10.U8
-dRow11 DN D11.U8
-dRow12 DN D12.U8
-dRow13 DN D13.U8
-dRow14 DN D14.U8
-dRow15 DN D15.U8
-
-;/*------------------------------------------------------------------------------
-;
-; Function: h264bsdWriteMacroblock
-;
-; Functional description:
-; Write one macroblock into the image. Both luma and chroma
-; components will be written at the same time.
-;
-; Inputs:
-; data pointer to macroblock data to be written, 256 values for
-; luma followed by 64 values for both chroma components
-;
-; Outputs:
-; image pointer to the image where the macroblock will be written
-;
-; Returns:
-; none
-;
-;------------------------------------------------------------------------------*/
-
-h264bsdWriteMacroblock
- PUSH {r4-r6,lr}
- VPUSH {q4-q7}
-
- LDR width, [image, #4]
- LDR luma, [image, #0xC]
- LDR cb, [image, #0x10]
- LDR cr, [image, #0x14]
-
-
-; Write luma
- VLD1 {qRow0, qRow1}, [data]!
- LSL width, width, #4
- VLD1 {qRow2, qRow3}, [data]!
- LSR cwidth, width, #1
- VST1 {qRow0}, [luma@128], width
- VLD1 {qRow4, qRow5}, [data]!
- VST1 {qRow1}, [luma@128], width
- VLD1 {qRow6, qRow7}, [data]!
- VST1 {qRow2}, [luma@128], width
- VLD1 {qRow8, qRow9}, [data]!
- VST1 {qRow3}, [luma@128], width
- VLD1 {qRow10, qRow11}, [data]!
- VST1 {qRow4}, [luma@128], width
- VLD1 {qRow12, qRow13}, [data]!
- VST1 {qRow5}, [luma@128], width
- VLD1 {qRow14, qRow15}, [data]!
- VST1 {qRow6}, [luma@128], width
-
- VLD1 {qRow0, qRow1}, [data]! ;cb rows 0,1,2,3
- VST1 {qRow7}, [luma@128], width
- VLD1 {qRow2, qRow3}, [data]! ;cb rows 4,5,6,7
- VST1 {qRow8}, [luma@128], width
- VLD1 {qRow4, qRow5}, [data]! ;cr rows 0,1,2,3
- VST1 {qRow9}, [luma@128], width
- VLD1 {qRow6, qRow7}, [data]! ;cr rows 4,5,6,7
- VST1 {qRow10}, [luma@128], width
- VST1 {dRow0}, [cb@64], cwidth
- VST1 {dRow8}, [cr@64], cwidth
- VST1 {qRow11}, [luma@128], width
- VST1 {dRow1}, [cb@64], cwidth
- VST1 {dRow9}, [cr@64], cwidth
- VST1 {qRow12}, [luma@128], width
- VST1 {dRow2}, [cb@64], cwidth
- VST1 {dRow10}, [cr@64], cwidth
- VST1 {qRow13}, [luma@128], width
- VST1 {dRow3}, [cb@64], cwidth
- VST1 {dRow11}, [cr@64], cwidth
- VST1 {qRow14}, [luma@128], width
- VST1 {dRow4}, [cb@64], cwidth
- VST1 {dRow12}, [cr@64], cwidth
- VST1 {qRow15}, [luma]
- VST1 {dRow5}, [cb@64], cwidth
- VST1 {dRow13}, [cr@64], cwidth
- VST1 {dRow6}, [cb@64], cwidth
- VST1 {dRow14}, [cr@64], cwidth
- VST1 {dRow7}, [cb@64]
- VST1 {dRow15}, [cr@64]
-
- VPOP {q4-q7}
- POP {r4-r6,pc}
- END
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm_gcc/asm_common.S b/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm_gcc/asm_common.S
deleted file mode 100644
index 969a75c..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm_gcc/asm_common.S
+++ /dev/null
@@ -1,39 +0,0 @@
-@
-@ Copyright (C) 2009 The Android Open Source Project
-@
-@ Licensed under the Apache License, Version 2.0 (the "License");
-@ you may not use this file except in compliance with the License.
-@ You may obtain a copy of the License at
-@
-@ http://www.apache.org/licenses/LICENSE-2.0
-@
-@ Unless required by applicable law or agreed to in writing, software
-@ distributed under the License is distributed on an "AS IS" BASIS,
-@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@ See the License for the specific language governing permissions and
-@ limitations under the License.
-@
-
-
-
-
- .macro REQUIRE8
- .eabi_attribute 24, 1
- .endm
-
- .macro PRESERVE8
- .eabi_attribute 25, 1
- .endm
-
-
- .macro function name, export=0
-.if \export
- .global \name
-.endif
- .type \name, %function
-\name:
- .endm
-
- .macro endfunction
- .endm
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm_gcc/h264bsdClearMbLayer.S b/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm_gcc/h264bsdClearMbLayer.S
deleted file mode 100644
index 3c2752f..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm_gcc/h264bsdClearMbLayer.S
+++ /dev/null
@@ -1,68 +0,0 @@
-@
-@ Copyright (C) 2009 The Android Open Source Project
-@
-@ Licensed under the Apache License, Version 2.0 (the "License");
-@ you may not use this file except in compliance with the License.
-@ You may obtain a copy of the License at
-@
-@ http://www.apache.org/licenses/LICENSE-2.0
-@
-@ Unless required by applicable law or agreed to in writing, software
-@ distributed under the License is distributed on an "AS IS" BASIS,
-@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@ See the License for the specific language governing permissions and
-@ limitations under the License.
-@
-
-#include "asm_common.S"
-
- PRESERVE8
-
- .fpu neon
- .text
-
-/* Input / output registers */
-#define pMbLayer r0
-#define size r1
-#define pTmp r2
-#define step r3
-
-/* -- NEON registers -- */
-
-#define qZero Q0
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdClearMbLayer
-
- Functional description:
-
- Inputs:
-
- Outputs:
-
- Returns:
-
-------------------------------------------------------------------------------*/
-
-function h264bsdClearMbLayer, export=1
-
- VMOV.I8 qZero, #0
- ADD pTmp, pMbLayer, #16
- MOV step, #32
- SUBS size, size, #64
-
-loop:
- VST1.8 {qZero}, [pMbLayer], step
- SUBS size, size, #64
- VST1.8 {qZero}, [pTmp], step
- VST1.8 {qZero}, [pMbLayer], step
- VST1.8 {qZero}, [pTmp], step
- BCS loop
-
- BX lr
-
-endfunction
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm_gcc/h264bsdCountLeadingZeros.S b/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm_gcc/h264bsdCountLeadingZeros.S
deleted file mode 100644
index b1c9f60..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm_gcc/h264bsdCountLeadingZeros.S
+++ /dev/null
@@ -1,48 +0,0 @@
-@
-@ Copyright (C) 2009 The Android Open Source Project
-@
-@ Licensed under the Apache License, Version 2.0 (the "License");
-@ you may not use this file except in compliance with the License.
-@ You may obtain a copy of the License at
-@
-@ http://www.apache.org/licenses/LICENSE-2.0
-@
-@ Unless required by applicable law or agreed to in writing, software
-@ distributed under the License is distributed on an "AS IS" BASIS,
-@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@ See the License for the specific language governing permissions and
-@ limitations under the License.
-@
-#include "asm_common.S"
-
- PRESERVE8
- .arm
- .text
-
-
-/* Input / output registers */
-#define value r0
-
-/* -- NEON registers -- */
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdCountLeadingZeros
-
- Functional description:
-
- Inputs:
-
- Outputs:
-
- Returns:
-
-------------------------------------------------------------------------------*/
-
-function h264bsdCountLeadingZeros, export=1
-
- CLZ value, value
- BX lr
-
-endfunction
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm_gcc/h264bsdFillRow7.S b/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm_gcc/h264bsdFillRow7.S
deleted file mode 100644
index 6ed6227..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm_gcc/h264bsdFillRow7.S
+++ /dev/null
@@ -1,143 +0,0 @@
-@
-@ Copyright (C) 2009 The Android Open Source Project
-@
-@ Licensed under the Apache License, Version 2.0 (the "License");
-@ you may not use this file except in compliance with the License.
-@ You may obtain a copy of the License at
-@
-@ http://www.apache.org/licenses/LICENSE-2.0
-@
-@ Unless required by applicable law or agreed to in writing, software
-@ distributed under the License is distributed on an "AS IS" BASIS,
-@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@ See the License for the specific language governing permissions and
-@ limitations under the License.
-@
-
-#include "asm_common.S"
-
- PRESERVE8
-
- .fpu neon
- .text
-
-/* Input / output registers */
-
-#define ref r0
-#define fill r1
-#define left r2
-#define tmp2 r2
-#define center r3
-#define right r4
-#define tmp1 r5
-
-/* -- NEON registers -- */
-
-#define qTmp0 Q0
-#define qTmp1 Q1
-#define dTmp0 D0
-#define dTmp1 D1
-#define dTmp2 D2
-#define dTmp3 D3
-
-/*
-void h264bsdFillRow7(const u8 * ref, u8 * fill, i32 left, i32 center,
- i32 right);
-*/
-
-function h264bsdFillRow7, export=1
-
- PUSH {r4-r6,lr}
- CMP left, #0
- LDR right, [sp,#0x10]
- BEQ switch_center
- LDRB tmp1, [ref,#0]
-
-loop_left:
- SUBS left, left, #1
- STRB tmp1, [fill], #1
- BNE loop_left
-
-switch_center:
- ASR tmp2,center,#2
- CMP tmp2,#9
- ADDCC pc,pc,tmp2,LSL #2
- B loop_center
- B loop_center
- B case_1
- B case_2
- B case_3
- B case_4
- B case_5
- B case_6
- B case_7
- B case_8
-
-case_8:
- VLD1.8 {qTmp0, qTmp1}, [ref]!
- SUB center, center, #32
- VST1.8 {qTmp0}, [fill]!
- VST1.8 {qTmp1}, [fill]!
- B loop_center
-case_7:
- VLD1.8 {dTmp0,dTmp1,dTmp2}, [ref]!
- SUB center, center, #28
- LDR tmp2, [ref], #4
- VST1.8 {dTmp0,dTmp1,dTmp2}, [fill]!
- STR tmp2, [fill],#4
- B loop_center
-case_6:
- VLD1.8 {dTmp0,dTmp1,dTmp2}, [ref]!
- SUB center, center, #24
- VST1.8 {dTmp0,dTmp1,dTmp2}, [fill]!
- B loop_center
-case_5:
- VLD1.8 {qTmp0}, [ref]!
- SUB center, center, #20
- LDR tmp2, [ref], #4
- VST1.8 {qTmp0}, [fill]!
- STR tmp2, [fill],#4
- B loop_center
-case_4:
- VLD1.8 {qTmp0}, [ref]!
- SUB center, center, #16
- VST1.8 {qTmp0}, [fill]!
- B loop_center
-case_3:
- VLD1.8 {dTmp0}, [ref]!
- SUB center, center, #12
- LDR tmp2, [ref], #4
- VST1.8 dTmp0, [fill]!
- STR tmp2, [fill],#4
- B loop_center
-case_2:
- LDR tmp2, [ref],#4
- SUB center, center, #4
- STR tmp2, [fill], #4
-case_1:
- LDR tmp2, [ref],#4
- SUB center, center, #4
- STR tmp2, [fill], #4
-
-loop_center:
- CMP center, #0
- BEQ jump
- LDRB tmp2, [ref], #1
- SUB center, center, #1
- STRB tmp2, [fill], #1
- BNE loop_center
-jump:
- CMP right,#0
- POPEQ {r4-r6,pc}
- LDRB tmp2, [ref,#-1]
-
-loop_right:
- STRB tmp2, [fill], #1
- SUBS right, right, #1
- BNE loop_right
-
- POP {r4-r6,pc}
-
-endfunction
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm_gcc/h264bsdFlushBits.S b/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm_gcc/h264bsdFlushBits.S
deleted file mode 100644
index aa88471..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm_gcc/h264bsdFlushBits.S
+++ /dev/null
@@ -1,78 +0,0 @@
-@
-@ Copyright (C) 2009 The Android Open Source Project
-@
-@ Licensed under the Apache License, Version 2.0 (the "License");
-@ you may not use this file except in compliance with the License.
-@ You may obtain a copy of the License at
-@
-@ http://www.apache.org/licenses/LICENSE-2.0
-@
-@ Unless required by applicable law or agreed to in writing, software
-@ distributed under the License is distributed on an "AS IS" BASIS,
-@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@ See the License for the specific language governing permissions and
-@ limitations under the License.
-@
-
-#include "asm_common.S"
-
- PRESERVE8
-
- .arm
- .text
-
-/* Input / output registers */
-#define pStrmData r0
-#define numBits r1
-#define readBits r2
-#define strmBuffSize r3
-#define pStrmBuffStart r1
-#define pStrmCurrPos r2
-#define bitPosInWord r1
-
-/* Input / output registers */
-
-
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdFlushBits
-
- Functional description:
-
- Inputs:
-
- Outputs:
-
- Returns:
-
-------------------------------------------------------------------------------*/
-function h264bsdFlushBits, export=1
-
- LDR readBits, [pStrmData, #0x10]
- LDR strmBuffSize, [pStrmData, #0xC]
-
- ADD readBits, readBits, numBits
- AND bitPosInWord, readBits, #7
-
- STR readBits, [pStrmData, #0x10]
- STR bitPosInWord, [pStrmData, #0x8]
-
- LDR pStrmBuffStart, [pStrmData, #0x0]
-
- CMP readBits, strmBuffSize, LSL #3
-
- BHI end_of_stream
-
- ADD pStrmCurrPos, pStrmBuffStart, readBits, LSR #3
- STR pStrmCurrPos, [pStrmData, #0x4]
- MOV r0, #0
- BX lr
-
-end_of_stream:
- MVN r0, #0
- BX lr
-
-endfunction
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm_gcc/h264bsdWriteMacroblock.S b/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm_gcc/h264bsdWriteMacroblock.S
deleted file mode 100644
index 4093b92..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/arm_neon_asm_gcc/h264bsdWriteMacroblock.S
+++ /dev/null
@@ -1,156 +0,0 @@
-@
-@ Copyright (C) 2009 The Android Open Source Project
-@
-@ Licensed under the Apache License, Version 2.0 (the "License");
-@ you may not use this file except in compliance with the License.
-@ You may obtain a copy of the License at
-@
-@ http://www.apache.org/licenses/LICENSE-2.0
-@
-@ Unless required by applicable law or agreed to in writing, software
-@ distributed under the License is distributed on an "AS IS" BASIS,
-@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@ See the License for the specific language governing permissions and
-@ limitations under the License.
-@
-
-#include "asm_common.S"
-
- REQUIRE8
- PRESERVE8
-
- .arm
- .fpu neon
- .text
-
-/* Input / output registers */
-#define image r0
-#define data r1
-#define width r2
-#define luma r3
-#define cb r4
-#define cr r5
-#define cwidth r6
-
-/* -- NEON registers -- */
-
-#define qRow0 Q0
-#define qRow1 Q1
-#define qRow2 Q2
-#define qRow3 Q3
-#define qRow4 Q4
-#define qRow5 Q5
-#define qRow6 Q6
-#define qRow7 Q7
-#define qRow8 Q8
-#define qRow9 Q9
-#define qRow10 Q10
-#define qRow11 Q11
-#define qRow12 Q12
-#define qRow13 Q13
-#define qRow14 Q14
-#define qRow15 Q15
-
-#define dRow0 D0
-#define dRow1 D1
-#define dRow2 D2
-#define dRow3 D3
-#define dRow4 D4
-#define dRow5 D5
-#define dRow6 D6
-#define dRow7 D7
-#define dRow8 D8
-#define dRow9 D9
-#define dRow10 D10
-#define dRow11 D11
-#define dRow12 D12
-#define dRow13 D13
-#define dRow14 D14
-#define dRow15 D15
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdWriteMacroblock
-
- Functional description:
- Write one macroblock into the image. Both luma and chroma
- components will be written at the same time.
-
- Inputs:
- data pointer to macroblock data to be written, 256 values for
- luma followed by 64 values for both chroma components
-
- Outputs:
- image pointer to the image where the macroblock will be written
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-
-function h264bsdWriteMacroblock, export=1
- PUSH {r4-r6,lr}
- VPUSH {q4-q7}
-
- LDR width, [image, #4]
- LDR luma, [image, #0xC]
- LDR cb, [image, #0x10]
- LDR cr, [image, #0x14]
-
-
-@ Write luma
- VLD1.8 {qRow0, qRow1}, [data]!
- LSL width, width, #4
- VLD1.8 {qRow2, qRow3}, [data]!
- LSR cwidth, width, #1
- VST1.8 {qRow0}, [luma,:128], width
- VLD1.8 {qRow4, qRow5}, [data]!
- VST1.8 {qRow1}, [luma,:128], width
- VLD1.8 {qRow6, qRow7}, [data]!
- VST1.8 {qRow2}, [luma,:128], width
- VLD1.8 {qRow8, qRow9}, [data]!
- VST1.8 {qRow3}, [luma,:128], width
- VLD1.8 {qRow10, qRow11}, [data]!
- VST1.8 {qRow4}, [luma,:128], width
- VLD1.8 {qRow12, qRow13}, [data]!
- VST1.8 {qRow5}, [luma,:128], width
- VLD1.8 {qRow14, qRow15}, [data]!
- VST1.8 {qRow6}, [luma,:128], width
-
- VLD1.8 {qRow0, qRow1}, [data]! ;//cb rows 0,1,2,3
- VST1.8 {qRow7}, [luma,:128], width
- VLD1.8 {qRow2, qRow3}, [data]! ;//cb rows 4,5,6,7
- VST1.8 {qRow8}, [luma,:128], width
- VLD1.8 {qRow4, qRow5}, [data]! ;//cr rows 0,1,2,3
- VST1.8 {qRow9}, [luma,:128], width
- VLD1.8 {qRow6, qRow7}, [data]! ;//cr rows 4,5,6,7
- VST1.8 {qRow10}, [luma,:128], width
- VST1.8 {dRow0}, [cb,:64], cwidth
- VST1.8 {dRow8}, [cr,:64], cwidth
- VST1.8 {qRow11}, [luma,:128], width
- VST1.8 {dRow1}, [cb,:64], cwidth
- VST1.8 {dRow9}, [cr,:64], cwidth
- VST1.8 {qRow12}, [luma,:128], width
- VST1.8 {dRow2}, [cb,:64], cwidth
- VST1.8 {dRow10}, [cr,:64], cwidth
- VST1.8 {qRow13}, [luma,:128], width
- VST1.8 {dRow3}, [cb,:64], cwidth
- VST1.8 {dRow11}, [cr,:64], cwidth
- VST1.8 {qRow14}, [luma,:128], width
- VST1.8 {dRow4}, [cb,:64], cwidth
- VST1.8 {dRow12}, [cr,:64], cwidth
- VST1.8 {qRow15}, [luma]
- VST1.8 {dRow5}, [cb,:64], cwidth
- VST1.8 {dRow13}, [cr,:64], cwidth
- VST1.8 {dRow6}, [cb,:64], cwidth
- VST1.8 {dRow14}, [cr,:64], cwidth
- VST1.8 {dRow7}, [cb,:64]
- VST1.8 {dRow15}, [cr,:64]
-
- VPOP {q4-q7}
- POP {r4-r6,pc}
-@ BX lr
-
-
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_byte_stream.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_byte_stream.c
deleted file mode 100644
index db77f8c..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_byte_stream.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- ExtractNalUnit
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_byte_stream.h"
-#include "h264bsd_util.h"
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-#define BYTE_STREAM_ERROR 0xFFFFFFFF
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
-
- Function name: ExtractNalUnit
-
- Functional description:
- Extracts one NAL unit from the byte stream buffer. Removes
- emulation prevention bytes if present. The original stream buffer
- is used directly and is therefore modified if emulation prevention
- bytes are present in the stream.
-
- Stream buffer is assumed to contain either exactly one NAL unit
- and nothing else, or one or more NAL units embedded in byte
- stream format described in the Annex B of the standard. Function
- detects which one is used based on the first bytes in the buffer.
-
- Inputs:
- pByteStream pointer to byte stream buffer
- len length of the stream buffer (in bytes)
-
- Outputs:
- pStrmData stream information is stored here
- readBytes number of bytes "consumed" from the stream buffer
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK error in byte stream
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdExtractNalUnit(u8 *pByteStream, u32 len, strmData_t *pStrmData,
- u32 *readBytes)
-{
-
-/* Variables */
-
- u32 i, tmp;
- u32 byteCount,initByteCount;
- u32 zeroCount;
- u8 byte;
- u32 hasEmulation = HANTRO_FALSE;
- u32 invalidStream = HANTRO_FALSE;
- u8 *readPtr, *writePtr;
-
-/* Code */
-
- ASSERT(pByteStream);
- ASSERT(len);
- ASSERT(len < BYTE_STREAM_ERROR);
- ASSERT(pStrmData);
-
- /* byte stream format if starts with 0x000001 or 0x000000 */
- if (len > 3 && pByteStream[0] == 0x00 && pByteStream[1] == 0x00 &&
- (pByteStream[2]&0xFE) == 0x00)
- {
- /* search for NAL unit start point, i.e. point after first start code
- * prefix in the stream */
- zeroCount = byteCount = 2;
- readPtr = pByteStream + 2;
- /*lint -e(716) while(1) used consciously */
- while (1)
- {
- byte = *readPtr++;
- byteCount++;
-
- if (byteCount == len)
- {
- /* no start code prefix found -> error */
- *readBytes = len;
- return(HANTRO_NOK);
- }
-
- if (!byte)
- zeroCount++;
- else if ((byte == 0x01) && (zeroCount >= 2))
- break;
- else
- zeroCount = 0;
- }
-
- initByteCount = byteCount;
-
- /* determine size of the NAL unit. Search for next start code prefix
- * or end of stream and ignore possible trailing zero bytes */
- zeroCount = 0;
- /*lint -e(716) while(1) used consciously */
- while (1)
- {
- byte = *readPtr++;
- byteCount++;
- if (!byte)
- zeroCount++;
-
- if ( (byte == 0x03) && (zeroCount == 2) )
- {
- hasEmulation = HANTRO_TRUE;
- }
-
- if ( (byte == 0x01) && (zeroCount >= 2 ) )
- {
- pStrmData->strmBuffSize =
- byteCount - initByteCount - zeroCount - 1;
- zeroCount -= MIN(zeroCount, 3);
- break;
- }
- else if (byte)
- {
- if (zeroCount >= 3)
- invalidStream = HANTRO_TRUE;
- zeroCount = 0;
- }
-
- if (byteCount == len)
- {
- pStrmData->strmBuffSize = byteCount - initByteCount - zeroCount;
- break;
- }
-
- }
- }
- /* separate NAL units as input -> just set stream params */
- else
- {
- initByteCount = 0;
- zeroCount = 0;
- pStrmData->strmBuffSize = len;
- hasEmulation = HANTRO_TRUE;
- }
-
- pStrmData->pStrmBuffStart = pByteStream + initByteCount;
- pStrmData->pStrmCurrPos = pStrmData->pStrmBuffStart;
- pStrmData->bitPosInWord = 0;
- pStrmData->strmBuffReadBits = 0;
-
- /* return number of bytes "consumed" */
- *readBytes = pStrmData->strmBuffSize + initByteCount + zeroCount;
-
- if (invalidStream)
- {
- return(HANTRO_NOK);
- }
-
- /* remove emulation prevention bytes before rbsp processing */
- if (hasEmulation)
- {
- tmp = pStrmData->strmBuffSize;
- readPtr = writePtr = pStrmData->pStrmBuffStart;
- zeroCount = 0;
- for (i = tmp; i--;)
- {
- if ((zeroCount == 2) && (*readPtr == 0x03))
- {
- /* emulation prevention byte shall be followed by one of the
- * following bytes: 0x00, 0x01, 0x02, 0x03. This implies that
- * emulation prevention 0x03 byte shall not be the last byte
- * of the stream. */
- if ( (i == 0) || (*(readPtr+1) > 0x03) )
- return(HANTRO_NOK);
-
- /* do not write emulation prevention byte */
- readPtr++;
- zeroCount = 0;
- }
- else
- {
- /* NAL unit shall not contain byte sequences 0x000000,
- * 0x000001 or 0x000002 */
- if ( (zeroCount == 2) && (*readPtr <= 0x02) )
- return(HANTRO_NOK);
-
- if (*readPtr == 0)
- zeroCount++;
- else
- zeroCount = 0;
-
- *writePtr++ = *readPtr++;
- }
- }
-
- /* (readPtr - writePtr) indicates number of "removed" emulation
- * prevention bytes -> subtract from stream buffer size */
- pStrmData->strmBuffSize -= (u32)(readPtr - writePtr);
- }
-
- return(HANTRO_OK);
-
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_byte_stream.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_byte_stream.h
deleted file mode 100644
index 36aec76..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_byte_stream.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_BYTE_STREAM_H
-#define H264SWDEC_BYTE_STREAM_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_stream.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-u32 h264bsdExtractNalUnit(u8 *pByteStream, u32 len, strmData_t *pStrmData,
- u32 *readBytes);
-
-#endif /* #ifdef H264SWDEC_BYTE_STREAM_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_cavlc.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_cavlc.c
deleted file mode 100644
index 422d7ba..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_cavlc.c
+++ /dev/null
@@ -1,916 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- DecodeCoeffToken
- DecodeLevelPrefix
- DecodeTotalZeros
- DecodeRunBefore
- DecodeResidualBlockCavlc
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_cavlc.h"
-#include "h264bsd_util.h"
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-/* Following descriptions use term "information field" to represent combination
- * of certain decoded symbol value and the length of the corresponding variable
- * length code word. For example, total_zeros information field consists of
- * 4 bits symbol value (bits [4,7]) along with four bits to represent length
- * of the VLC code word (bits [0,3]) */
-
-/* macro to obtain length of the coeff token information field, bits [0,4] */
-#define LENGTH_TC(vlc) ((vlc) & 0x1F)
-/* macro to obtain length of the other information fields, bits [0,3] */
-#define LENGTH(vlc) ((vlc) & 0xF)
-/* macro to obtain code word from the information fields, bits [4,7] */
-#define INFO(vlc) (((vlc) >> 4) & 0xF) /* 4 MSB bits contain information */
-/* macro to obtain trailing ones from the coeff token information word,
- * bits [5,10] */
-#define TRAILING_ONES(coeffToken) (((coeffToken)>>5) & 0x3F)
-/* macro to obtain total coeff from the coeff token information word,
- * bits [11,15] */
-#define TOTAL_COEFF(coeffToken) (((coeffToken) >> 11) & 0x1F)
-
-#define VLC_NOT_FOUND 0xFFFFFFFEU
-
-/* VLC tables for coeff_token. Because of long codes (max. 16 bits) some of the
- * tables have been splitted into multiple separate tables. Each array/table
- * element has the following structure:
- * [5 bits for tot.coeff.] [6 bits for tr.ones] [5 bits for VLC length]
- * If there is a 0x0000 value, it means that there is not corresponding VLC
- * codeword for that index. */
-
-/* VLC lengths up to 6 bits, 0 <= nC < 2 */
-static const u16 coeffToken0_0[32] = {
- 0x0000,0x0000,0x0000,0x2066,0x1026,0x0806,0x1865,0x1865,
- 0x1043,0x1043,0x1043,0x1043,0x1043,0x1043,0x1043,0x1043,
- 0x0822,0x0822,0x0822,0x0822,0x0822,0x0822,0x0822,0x0822,
- 0x0822,0x0822,0x0822,0x0822,0x0822,0x0822,0x0822,0x0822};
-
-/* VLC lengths up to 10 bits, 0 <= nC < 2 */
-static const u16 coeffToken0_1[48] = {
- 0x0000,0x0000,0x0000,0x0000,0x406a,0x304a,0x282a,0x200a,
- 0x3869,0x3869,0x2849,0x2849,0x2029,0x2029,0x1809,0x1809,
- 0x3068,0x3068,0x3068,0x3068,0x2048,0x2048,0x2048,0x2048,
- 0x1828,0x1828,0x1828,0x1828,0x1008,0x1008,0x1008,0x1008,
- 0x2867,0x2867,0x2867,0x2867,0x2867,0x2867,0x2867,0x2867,
- 0x1847,0x1847,0x1847,0x1847,0x1847,0x1847,0x1847,0x1847};
-
-/* VLC lengths up to 14 bits, 0 <= nC < 2 */
-static const u16 coeffToken0_2[56] = {
- 0x606e,0x584e,0x502e,0x500e,0x586e,0x504e,0x482e,0x480e,
- 0x400d,0x400d,0x484d,0x484d,0x402d,0x402d,0x380d,0x380d,
- 0x506d,0x506d,0x404d,0x404d,0x382d,0x382d,0x300d,0x300d,
- 0x486b,0x486b,0x486b,0x486b,0x486b,0x486b,0x486b,0x486b,
- 0x384b,0x384b,0x384b,0x384b,0x384b,0x384b,0x384b,0x384b,
- 0x302b,0x302b,0x302b,0x302b,0x302b,0x302b,0x302b,0x302b,
- 0x280b,0x280b,0x280b,0x280b,0x280b,0x280b,0x280b,0x280b};
-
-/* VLC lengths up to 16 bits, 0 <= nC < 2 */
-static const u16 coeffToken0_3[32] = {
- 0x0000,0x0000,0x682f,0x682f,0x8010,0x8050,0x8030,0x7810,
- 0x8070,0x7850,0x7830,0x7010,0x7870,0x7050,0x7030,0x6810,
- 0x706f,0x706f,0x684f,0x684f,0x602f,0x602f,0x600f,0x600f,
- 0x686f,0x686f,0x604f,0x604f,0x582f,0x582f,0x580f,0x580f};
-
-/* VLC lengths up to 6 bits, 2 <= nC < 4 */
-static const u16 coeffToken2_0[32] = {
- 0x0000,0x0000,0x0000,0x0000,0x3866,0x2046,0x2026,0x1006,
- 0x3066,0x1846,0x1826,0x0806,0x2865,0x2865,0x1025,0x1025,
- 0x2064,0x2064,0x2064,0x2064,0x1864,0x1864,0x1864,0x1864,
- 0x1043,0x1043,0x1043,0x1043,0x1043,0x1043,0x1043,0x1043};
-
-/* VLC lengths up to 9 bits, 2 <= nC < 4 */
-static const u16 coeffToken2_1[32] = {
- 0x0000,0x0000,0x0000,0x0000,0x4869,0x3849,0x3829,0x3009,
- 0x2808,0x2808,0x3048,0x3048,0x3028,0x3028,0x2008,0x2008,
- 0x4067,0x4067,0x4067,0x4067,0x2847,0x2847,0x2847,0x2847,
- 0x2827,0x2827,0x2827,0x2827,0x1807,0x1807,0x1807,0x1807};
-
-/* VLC lengths up to 14 bits, 2 <= nC < 4 */
-static const u16 coeffToken2_2[128] = {
- 0x0000,0x0000,0x786d,0x786d,0x806e,0x804e,0x802e,0x800e,
- 0x782e,0x780e,0x784e,0x702e,0x704d,0x704d,0x700d,0x700d,
- 0x706d,0x706d,0x684d,0x684d,0x682d,0x682d,0x680d,0x680d,
- 0x686d,0x686d,0x604d,0x604d,0x602d,0x602d,0x600d,0x600d,
- 0x580c,0x580c,0x580c,0x580c,0x584c,0x584c,0x584c,0x584c,
- 0x582c,0x582c,0x582c,0x582c,0x500c,0x500c,0x500c,0x500c,
- 0x606c,0x606c,0x606c,0x606c,0x504c,0x504c,0x504c,0x504c,
- 0x502c,0x502c,0x502c,0x502c,0x480c,0x480c,0x480c,0x480c,
- 0x586b,0x586b,0x586b,0x586b,0x586b,0x586b,0x586b,0x586b,
- 0x484b,0x484b,0x484b,0x484b,0x484b,0x484b,0x484b,0x484b,
- 0x482b,0x482b,0x482b,0x482b,0x482b,0x482b,0x482b,0x482b,
- 0x400b,0x400b,0x400b,0x400b,0x400b,0x400b,0x400b,0x400b,
- 0x506b,0x506b,0x506b,0x506b,0x506b,0x506b,0x506b,0x506b,
- 0x404b,0x404b,0x404b,0x404b,0x404b,0x404b,0x404b,0x404b,
- 0x402b,0x402b,0x402b,0x402b,0x402b,0x402b,0x402b,0x402b,
- 0x380b,0x380b,0x380b,0x380b,0x380b,0x380b,0x380b,0x380b};
-
-/* VLC lengths up to 6 bits, 4 <= nC < 8 */
-static const u16 coeffToken4_0[64] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x1806,0x3846,0x3826,0x1006,0x4866,0x3046,0x3026,0x0806,
- 0x2825,0x2825,0x2845,0x2845,0x2025,0x2025,0x2045,0x2045,
- 0x1825,0x1825,0x4065,0x4065,0x1845,0x1845,0x1025,0x1025,
- 0x3864,0x3864,0x3864,0x3864,0x3064,0x3064,0x3064,0x3064,
- 0x2864,0x2864,0x2864,0x2864,0x2064,0x2064,0x2064,0x2064,
- 0x1864,0x1864,0x1864,0x1864,0x1044,0x1044,0x1044,0x1044,
- 0x0824,0x0824,0x0824,0x0824,0x0004,0x0004,0x0004,0x0004};
-
-/* VLC lengths up to 10 bits, 4 <= nC < 8 */
-static const u16 coeffToken4_1[128] = {
- 0x0000,0x800a,0x806a,0x804a,0x802a,0x780a,0x786a,0x784a,
- 0x782a,0x700a,0x706a,0x704a,0x702a,0x680a,0x6829,0x6829,
- 0x6009,0x6009,0x6849,0x6849,0x6029,0x6029,0x5809,0x5809,
- 0x6869,0x6869,0x6049,0x6049,0x5829,0x5829,0x5009,0x5009,
- 0x6068,0x6068,0x6068,0x6068,0x5848,0x5848,0x5848,0x5848,
- 0x5028,0x5028,0x5028,0x5028,0x4808,0x4808,0x4808,0x4808,
- 0x5868,0x5868,0x5868,0x5868,0x5048,0x5048,0x5048,0x5048,
- 0x4828,0x4828,0x4828,0x4828,0x4008,0x4008,0x4008,0x4008,
- 0x3807,0x3807,0x3807,0x3807,0x3807,0x3807,0x3807,0x3807,
- 0x3007,0x3007,0x3007,0x3007,0x3007,0x3007,0x3007,0x3007,
- 0x4847,0x4847,0x4847,0x4847,0x4847,0x4847,0x4847,0x4847,
- 0x2807,0x2807,0x2807,0x2807,0x2807,0x2807,0x2807,0x2807,
- 0x5067,0x5067,0x5067,0x5067,0x5067,0x5067,0x5067,0x5067,
- 0x4047,0x4047,0x4047,0x4047,0x4047,0x4047,0x4047,0x4047,
- 0x4027,0x4027,0x4027,0x4027,0x4027,0x4027,0x4027,0x4027,
- 0x2007,0x2007,0x2007,0x2007,0x2007,0x2007,0x2007,0x2007};
-
-/* fixed 6 bit length VLC, nC <= 8 */
-static const u16 coeffToken8[64] = {
- 0x0806,0x0826,0x0000,0x0006,0x1006,0x1026,0x1046,0x0000,
- 0x1806,0x1826,0x1846,0x1866,0x2006,0x2026,0x2046,0x2066,
- 0x2806,0x2826,0x2846,0x2866,0x3006,0x3026,0x3046,0x3066,
- 0x3806,0x3826,0x3846,0x3866,0x4006,0x4026,0x4046,0x4066,
- 0x4806,0x4826,0x4846,0x4866,0x5006,0x5026,0x5046,0x5066,
- 0x5806,0x5826,0x5846,0x5866,0x6006,0x6026,0x6046,0x6066,
- 0x6806,0x6826,0x6846,0x6866,0x7006,0x7026,0x7046,0x7066,
- 0x7806,0x7826,0x7846,0x7866,0x8006,0x8026,0x8046,0x8066};
-
-/* VLC lengths up to 3 bits, nC == -1 */
-static const u16 coeffTokenMinus1_0[8] = {
- 0x0000,0x1043,0x0002,0x0002,0x0821,0x0821,0x0821,0x0821};
-
-/* VLC lengths up to 8 bits, nC == -1 */
-static const u16 coeffTokenMinus1_1[32] = {
- 0x2067,0x2067,0x2048,0x2028,0x1847,0x1847,0x1827,0x1827,
- 0x2006,0x2006,0x2006,0x2006,0x1806,0x1806,0x1806,0x1806,
- 0x1006,0x1006,0x1006,0x1006,0x1866,0x1866,0x1866,0x1866,
- 0x1026,0x1026,0x1026,0x1026,0x0806,0x0806,0x0806,0x0806};
-
-/* VLC tables for total_zeros. One table containing longer code, totalZeros_1,
- * has been broken into two separate tables. Table elements have the
- * following structure:
- * [4 bits for info] [4 bits for VLC length] */
-
-/* VLC lengths up to 5 bits */
-static const u8 totalZeros_1_0[32] = {
- 0x00,0x00,0x65,0x55,0x44,0x44,0x34,0x34,
- 0x23,0x23,0x23,0x23,0x13,0x13,0x13,0x13,
- 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
- 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01};
-
-/* VLC lengths up to 9 bits */
-static const u8 totalZeros_1_1[32] = {
- 0x00,0xf9,0xe9,0xd9,0xc8,0xc8,0xb8,0xb8,
- 0xa7,0xa7,0xa7,0xa7,0x97,0x97,0x97,0x97,
- 0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,
- 0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x76};
-
-static const u8 totalZeros_2[64] = {
- 0xe6,0xd6,0xc6,0xb6,0xa5,0xa5,0x95,0x95,
- 0x84,0x84,0x84,0x84,0x74,0x74,0x74,0x74,
- 0x64,0x64,0x64,0x64,0x54,0x54,0x54,0x54,
- 0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,
- 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,
- 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
- 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,
- 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03};
-
-static const u8 totalZeros_3[64] = {
- 0xd6,0xb6,0xc5,0xc5,0xa5,0xa5,0x95,0x95,
- 0x84,0x84,0x84,0x84,0x54,0x54,0x54,0x54,
- 0x44,0x44,0x44,0x44,0x04,0x04,0x04,0x04,
- 0x73,0x73,0x73,0x73,0x73,0x73,0x73,0x73,
- 0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,
- 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,
- 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
- 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13};
-
-static const u8 totalZeros_4[32] = {
- 0xc5,0xb5,0xa5,0x05,0x94,0x94,0x74,0x74,
- 0x34,0x34,0x24,0x24,0x83,0x83,0x83,0x83,
- 0x63,0x63,0x63,0x63,0x53,0x53,0x53,0x53,
- 0x43,0x43,0x43,0x43,0x13,0x13,0x13,0x13};
-
-static const u8 totalZeros_5[32] = {
- 0xb5,0x95,0xa4,0xa4,0x84,0x84,0x24,0x24,
- 0x14,0x14,0x04,0x04,0x73,0x73,0x73,0x73,
- 0x63,0x63,0x63,0x63,0x53,0x53,0x53,0x53,
- 0x43,0x43,0x43,0x43,0x33,0x33,0x33,0x33};
-
-static const u8 totalZeros_6[64] = {
- 0xa6,0x06,0x15,0x15,0x84,0x84,0x84,0x84,
- 0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,
- 0x73,0x73,0x73,0x73,0x73,0x73,0x73,0x73,
- 0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,
- 0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,
- 0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,
- 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,
- 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23};
-
-static const u8 totalZeros_7[64] = {
- 0x96,0x06,0x15,0x15,0x74,0x74,0x74,0x74,
- 0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,
- 0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,
- 0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,
- 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,
- 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
- 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,
- 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52};
-
-static const u8 totalZeros_8[64] = {
- 0x86,0x06,0x25,0x25,0x14,0x14,0x14,0x14,
- 0x73,0x73,0x73,0x73,0x73,0x73,0x73,0x73,
- 0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,
- 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,
- 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,
- 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,
- 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,
- 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42};
-
-static const u8 totalZeros_9[64] = {
- 0x16,0x06,0x75,0x75,0x24,0x24,0x24,0x24,
- 0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,
- 0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,
- 0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,
- 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,
- 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,
- 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,
- 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32};
-
-static const u8 totalZeros_10[32] = {
- 0x15,0x05,0x64,0x64,0x23,0x23,0x23,0x23,
- 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,
- 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,
- 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32};
-
-static const u8 totalZeros_11[16] = {
- 0x04,0x14,0x23,0x23,0x33,0x33,0x53,0x53,
- 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41};
-
-static const u8 totalZeros_12[16] = {
- 0x04,0x14,0x43,0x43,0x22,0x22,0x22,0x22,
- 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31};
-
-static const u8 totalZeros_13[8] = {0x03,0x13,0x32,0x32,0x21,0x21,0x21,0x21};
-
-static const u8 totalZeros_14[4] = {0x02,0x12,0x21,0x21};
-
-/* VLC tables for run_before. Table elements have the following structure:
- * [4 bits for info] [4bits for VLC length]
- */
-
-static const u8 runBefore_6[8] = {0x13,0x23,0x43,0x33,0x63,0x53,0x02,0x02};
-
-static const u8 runBefore_5[8] = {0x53,0x43,0x33,0x23,0x12,0x12,0x02,0x02};
-
-static const u8 runBefore_4[8] = {0x43,0x33,0x22,0x22,0x12,0x12,0x02,0x02};
-
-static const u8 runBefore_3[4] = {0x32,0x22,0x12,0x02};
-
-static const u8 runBefore_2[4] = {0x22,0x12,0x01,0x01};
-
-static const u8 runBefore_1[2] = {0x11,0x01};
-
-/* following four macros are used to handle stream buffer "cache" in the CAVLC
- * decoding function */
-
-/* macro to initialize stream buffer cache, fills the buffer (32 bits) */
-#define BUFFER_INIT(value, bits) \
-{ \
- (bits) = 32; \
- (value) = h264bsdShowBits32(pStrmData); \
-}
-
-/* macro to read numBits bits from the buffer, bits will be written to
- * outVal. Refills the buffer if not enough bits left */
-#define BUFFER_SHOW(value, bits, outVal, numBits) \
-{ \
- if ((bits) < (numBits)) \
- { \
- if(h264bsdFlushBits(pStrmData,32-(bits)) == END_OF_STREAM) \
- return(HANTRO_NOK); \
- (value) = h264bsdShowBits32(pStrmData); \
- (bits) = 32; \
- } \
- (outVal) = (value) >> (32 - (numBits)); \
-}
-
-/* macro to flush numBits bits from the buffer */
-#define BUFFER_FLUSH(value, bits, numBits) \
-{ \
- (value) <<= (numBits); \
- (bits) -= (numBits); \
-}
-
-/* macro to read and flush numBits bits from the buffer, bits will be written
- * to outVal. Refills the buffer if not enough bits left */
-#define BUFFER_GET(value, bits, outVal, numBits) \
-{ \
- if ((bits) < (numBits)) \
- { \
- if(h264bsdFlushBits(pStrmData,32-(bits)) == END_OF_STREAM) \
- return(HANTRO_NOK); \
- (value) = h264bsdShowBits32(pStrmData); \
- (bits) = 32; \
- } \
- (outVal) = (value) >> (32 - (numBits)); \
- (value) <<= (numBits); \
- (bits) -= (numBits); \
-}
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-static u32 DecodeCoeffToken(u32 bits, u32 nc);
-
-static u32 DecodeLevelPrefix(u32 bits);
-
-static u32 DecodeTotalZeros(u32 bits, u32 totalCoeff, u32 isChromaDC);
-
-static u32 DecodeRunBefore(u32 bits,u32 zerosLeft);
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeCoeffToken
-
- Functional description:
- Function to decode coeff_token information field from the stream.
-
- Inputs:
- u32 bits next 16 stream bits
- u32 nc nC, see standard for details
-
- Outputs:
- u32 information field (11 bits for value, 5 bits for length)
-
-------------------------------------------------------------------------------*/
-
-u32 DecodeCoeffToken(u32 bits, u32 nc)
-{
-
-/* Variables */
-
- u32 value;
-
-/* Code */
-
- /* standard defines that nc for decoding of chroma dc coefficients is -1,
- * represented by u32 here -> -1 maps to 2^32 - 1 */
- ASSERT(nc <= 16 || nc == (u32)(-1));
-
- if (nc < 2)
- {
- if (bits >= 0x8000)
- {
- value = 0x0001;
- }
- else if (bits >= 0x0C00)
- value = coeffToken0_0[bits >> 10];
- else if (bits >= 0x0100)
- value = coeffToken0_1[bits >> 6];
- else if (bits >= 0x0020)
- value = coeffToken0_2[(bits>>2)-8];
- else
- value = coeffToken0_3[bits];
- }
- else if (nc < 4)
- {
- if (bits >= 0x8000)
- {
- value = bits & 0x4000 ? 0x0002 : 0x0822;
- }
- else if (bits >= 0x1000)
- value = coeffToken2_0[bits >> 10];
- else if (bits >= 0x0200)
- value = coeffToken2_1[bits >> 7];
- else
- value = coeffToken2_2[bits>>2];
- }
- else if (nc < 8)
- {
- value = coeffToken4_0[bits >> 10];
- if (!value)
- value = coeffToken4_1[bits>>6];
- }
- else if (nc <= 16)
- {
- value = coeffToken8[bits>>10];
- }
- else
- {
- value = coeffTokenMinus1_0[bits >> 13];
- if (!value)
- value = coeffTokenMinus1_1[bits>>8];
- }
-
- return(value);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeLevelPrefix
-
- Functional description:
- Function to decode level_prefix information field from the stream
-
- Inputs:
- u32 bits next 16 stream bits
-
- Outputs:
- u32 level_prefix information field or VLC_NOT_FOUND
-
-------------------------------------------------------------------------------*/
-
-u32 DecodeLevelPrefix(u32 bits)
-{
-
-/* Variables */
-
- u32 numZeros;
-
-/* Code */
-
- if (bits >= 0x8000)
- numZeros = 0;
- else if (bits >= 0x4000)
- numZeros = 1;
- else if (bits >= 0x2000)
- numZeros = 2;
- else if (bits >= 0x1000)
- numZeros = 3;
- else if (bits >= 0x0800)
- numZeros = 4;
- else if (bits >= 0x0400)
- numZeros = 5;
- else if (bits >= 0x0200)
- numZeros = 6;
- else if (bits >= 0x0100)
- numZeros = 7;
- else if (bits >= 0x0080)
- numZeros = 8;
- else if (bits >= 0x0040)
- numZeros = 9;
- else if (bits >= 0x0020)
- numZeros = 10;
- else if (bits >= 0x0010)
- numZeros = 11;
- else if (bits >= 0x0008)
- numZeros = 12;
- else if (bits >= 0x0004)
- numZeros = 13;
- else if (bits >= 0x0002)
- numZeros = 14;
- else if (bits >= 0x0001)
- numZeros = 15;
- else /* more than 15 zeros encountered which is an error */
- return(VLC_NOT_FOUND);
-
- return(numZeros);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeTotalZeros
-
- Functional description:
- Function to decode total_zeros information field from the stream
-
- Inputs:
- u32 bits next 9 stream bits
- u32 totalCoeff total number of coefficients for the block
- being decoded
- u32 isChromaDC flag to indicate chroma DC block
-
- Outputs:
- u32 information field (4 bits value, 4 bits length)
-
-------------------------------------------------------------------------------*/
-
-u32 DecodeTotalZeros(u32 bits, u32 totalCoeff, u32 isChromaDC)
-{
-
-/* Variables */
-
- u32 value = 0x0;
-
-/* Code */
-
- ASSERT(totalCoeff);
-
- if (!isChromaDC)
- {
- ASSERT(totalCoeff < 16);
- switch (totalCoeff)
- {
- case 1:
- value = totalZeros_1_0[bits >> 4];
- if (!value)
- value = totalZeros_1_1[bits];
- break;
-
- case 2:
- value = totalZeros_2[bits >> 3];
- break;
-
- case 3:
- value = totalZeros_3[bits >> 3];
- break;
-
- case 4:
- value = totalZeros_4[bits >> 4];
- break;
-
- case 5:
- value = totalZeros_5[bits >> 4];
- break;
-
- case 6:
- value = totalZeros_6[bits >> 3];
- break;
-
- case 7:
- value = totalZeros_7[bits >> 3];
- break;
-
- case 8:
- value = totalZeros_8[bits >> 3];
- break;
-
- case 9:
- value = totalZeros_9[bits >> 3];
- break;
-
- case 10:
- value = totalZeros_10[bits >> 4];
- break;
-
- case 11:
- value = totalZeros_11[bits >> 5];
- break;
-
- case 12:
- value = totalZeros_12[bits >> 5];
- break;
-
- case 13:
- value = totalZeros_13[bits >> 6];
- break;
-
- case 14:
- value = totalZeros_14[bits >> 7];
- break;
-
- default: /* case 15 */
- value = (bits >> 8) ? 0x11 : 0x01;
- break;
- }
- }
- else
- {
- ASSERT(totalCoeff < 4);
- bits >>= 6;
- if (bits > 3)
- value = 0x01;
- else
- {
- if (totalCoeff == 3)
- value = 0x11;
- else if (bits > 1)
- {
- value = 0x12;
- }
- else if (totalCoeff == 2)
- value = 0x22;
- else if (bits)
- value = 0x23;
- else
- value = 0x33;
- }
- }
-
- return(value);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeRunBefore
-
- Functional description:
- Function to decode run_before information field from the stream
-
- Inputs:
- u32 bits next 11 stream bits
- u32 zerosLeft number of zeros left for the current block
-
- Outputs:
- u32 information field (4 bits value, 4 bits length)
-
-------------------------------------------------------------------------------*/
-
-u32 DecodeRunBefore(u32 bits, u32 zerosLeft)
-{
-
-/* Variables */
-
- u32 value = 0x0;
-
-/* Code */
-
- switch (zerosLeft)
- {
- case 1:
- value = runBefore_1[bits>>10];
- break;
-
- case 2:
- value = runBefore_2[bits>>9];
- break;
-
- case 3:
- value = runBefore_3[bits>>9];
- break;
-
- case 4:
- value = runBefore_4[bits>>8];
- break;
-
- case 5:
- value = runBefore_5[bits>>8];
- break;
-
- case 6:
- value = runBefore_6[bits>>8];
- break;
-
- default:
- if (bits >= 0x100)
- value = ((7-(bits>>8))<<4)+0x3;
- else if (bits >= 0x80)
- value = 0x74;
- else if (bits >= 0x40)
- value = 0x85;
- else if (bits >= 0x20)
- value = 0x96;
- else if (bits >= 0x10)
- value = 0xa7;
- else if (bits >= 0x8)
- value = 0xb8;
- else if (bits >= 0x4)
- value = 0xc9;
- else if (bits >= 0x2)
- value = 0xdA;
- else if (bits)
- value = 0xeB;
- if (INFO(value) > zerosLeft)
- value = 0;
- break;
- }
-
- return(value);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeResidualBlockCavlc
-
- Functional description:
- Function to decode one CAVLC coded block. This corresponds to
- syntax elements residual_block_cavlc() in the standard.
-
- Inputs:
- pStrmData pointer to stream data structure
- nc nC value
- maxNumCoeff maximum number of residual coefficients
-
- Outputs:
- coeffLevel stores decoded coefficient levels
-
- Returns:
- numCoeffs on bits [4,11] if successful
- coeffMap on bits [16,31] if successful, this is bit map
- where each bit indicates if the corresponding
- coefficient was zero (0) or non-zero (1)
- HANTRO_NOK end of stream or error in stream
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeResidualBlockCavlc(
- strmData_t *pStrmData,
- i32 *coeffLevel,
- i32 nc,
- u32 maxNumCoeff)
-{
-
-/* Variables */
-
- u32 i, tmp, totalCoeff, trailingOnes, suffixLength, levelPrefix;
- u32 levelSuffix, zerosLeft, bit;
- i32 level[16];
- u32 run[16];
- /* stream "cache" */
- u32 bufferValue;
- u32 bufferBits;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(coeffLevel);
- ASSERT(nc > -2);
- ASSERT(maxNumCoeff == 4 || maxNumCoeff == 15 || maxNumCoeff == 16);
- ASSERT(VLC_NOT_FOUND != END_OF_STREAM);
-
- /* assume that coeffLevel array has been "cleaned" by caller */
-
- BUFFER_INIT(bufferValue, bufferBits);
-
- /*lint -e774 disable lint warning on always false comparison */
- BUFFER_SHOW(bufferValue, bufferBits, bit, 16);
- /*lint +e774 */
- tmp = DecodeCoeffToken(bit, (u32)nc);
- if (!tmp)
- return(HANTRO_NOK);
- BUFFER_FLUSH(bufferValue, bufferBits, LENGTH_TC(tmp));
-
- totalCoeff = TOTAL_COEFF(tmp);
- if (totalCoeff > maxNumCoeff)
- return(HANTRO_NOK);
- trailingOnes = TRAILING_ONES(tmp);
-
- if (totalCoeff != 0)
- {
- i = 0;
- /* nonzero coefficients: +/- 1 */
- if (trailingOnes)
- {
- BUFFER_GET(bufferValue, bufferBits, bit, trailingOnes);
- tmp = 1 << (trailingOnes - 1);
- for (; tmp; i++)
- {
- level[i] = bit & tmp ? -1 : 1;
- tmp >>= 1;
- }
- }
-
- /* other levels */
- if (totalCoeff > 10 && trailingOnes < 3)
- suffixLength = 1;
- else
- suffixLength = 0;
-
- for (; i < totalCoeff; i++)
- {
- BUFFER_SHOW(bufferValue, bufferBits, bit, 16);
- levelPrefix = DecodeLevelPrefix(bit);
- if (levelPrefix == VLC_NOT_FOUND)
- return(HANTRO_NOK);
- BUFFER_FLUSH(bufferValue, bufferBits, levelPrefix+1);
-
- if (levelPrefix < 14)
- tmp = suffixLength;
- else if (levelPrefix == 14)
- {
- tmp = suffixLength ? suffixLength : 4;
- }
- else
- {
- /* setting suffixLength to 1 here corresponds to adding 15
- * to levelCode value if levelPrefix == 15 and
- * suffixLength == 0 */
- if (!suffixLength)
- suffixLength = 1;
- tmp = 12;
- }
-
- if (suffixLength)
- levelPrefix <<= suffixLength;
-
- if (tmp)
- {
- BUFFER_GET(bufferValue, bufferBits, levelSuffix, tmp);
- levelPrefix += levelSuffix;
- }
-
- tmp = levelPrefix;
-
- if (i == trailingOnes && trailingOnes < 3)
- tmp += 2;
-
- level[i] = (tmp+2)>>1;
-
- if (suffixLength == 0)
- suffixLength = 1;
-
- if ((level[i] > (3 << (suffixLength - 1))) && suffixLength < 6)
- suffixLength++;
-
- if (tmp & 0x1)
- level[i] = -level[i];
- }
-
- /* zero runs */
- if (totalCoeff < maxNumCoeff)
- {
- BUFFER_SHOW(bufferValue, bufferBits, bit,9);
- zerosLeft = DecodeTotalZeros(bit, totalCoeff,
- (u32)(maxNumCoeff == 4));
- if (!zerosLeft)
- return(HANTRO_NOK);
- BUFFER_FLUSH(bufferValue, bufferBits, LENGTH(zerosLeft));
- zerosLeft = INFO(zerosLeft);
- }
- else
- zerosLeft = 0;
-
- for (i = 0; i < totalCoeff - 1; i++)
- {
- if (zerosLeft > 0)
- {
- BUFFER_SHOW(bufferValue, bufferBits, bit,11);
- tmp = DecodeRunBefore(bit, zerosLeft);
- if (!tmp)
- return(HANTRO_NOK);
- BUFFER_FLUSH(bufferValue, bufferBits, LENGTH(tmp));
- run[i] = INFO(tmp);
- zerosLeft -= run[i]++;
- }
- else
- {
- run[i] = 1;
- }
- }
-
- /* combining level and run, levelSuffix variable used to hold coeffMap,
- * i.e. bit map indicating which coefficients had non-zero value. */
-
- /*lint -esym(771,level,run) level and run are always initialized */
- tmp = zerosLeft;
- coeffLevel[tmp] = level[totalCoeff-1];
- levelSuffix = 1 << tmp;
- for (i = totalCoeff-1; i--;)
- {
- tmp += run[i];
- levelSuffix |= 1 << tmp;
- coeffLevel[tmp] = level[i];
- }
-
- }
- else
- levelSuffix = 0;
-
- if (h264bsdFlushBits(pStrmData, 32-bufferBits) != HANTRO_OK)
- return(HANTRO_NOK);
-
- return((totalCoeff << 4) | (levelSuffix << 16));
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_cavlc.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_cavlc.h
deleted file mode 100644
index 80353d3..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_cavlc.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_CAVLC_H
-#define H264SWDEC_CAVLC_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_stream.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeResidualBlockCavlc(
- strmData_t *pStrmData,
- i32 *coeffLevel,
- i32 nc,
- u32 maxNumCoeff);
-
-#endif /* #ifdef H264SWDEC_CAVLC_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_cfg.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_cfg.h
deleted file mode 100644
index 2baba5a..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_cfg.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_CFG_H
-#define H264SWDEC_CFG_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-#define MAX_NUM_REF_PICS 16
-#define MAX_NUM_SLICE_GROUPS 8
-#define MAX_NUM_SEQ_PARAM_SETS 32
-#define MAX_NUM_PIC_PARAM_SETS 256
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-#endif /* #ifdef H264SWDEC_CFG_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_conceal.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_conceal.c
deleted file mode 100644
index 7a262ed..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_conceal.c
+++ /dev/null
@@ -1,626 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdConceal
- ConcealMb
- Transform
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_conceal.h"
-#include "h264bsd_util.h"
-#include "h264bsd_reconstruct.h"
-#include "h264bsd_dpb.h"
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-/*lint -e702 disable lint warning on right shift of signed quantity */
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-static u32 ConcealMb(mbStorage_t *pMb, image_t *currImage, u32 row, u32 col,
- u32 sliceType, u8 *data);
-
-static void Transform(i32 *data);
-
-/*------------------------------------------------------------------------------
-
- Function name: h264bsdConceal
-
- Functional description:
- Perform error concealment for a picture. Two types of concealment
- is performed based on sliceType:
- 1) copy from previous picture for P-slices.
- 2) concealment from neighbour pixels for I-slices
-
- I-type concealment is based on ideas presented by Jarno Tulkki.
- The concealment algorithm determines frequency domain coefficients
- from the neighbour pixels, applies integer transform (the same
- transform used in the residual processing) and uses the results as
- pixel values for concealed macroblocks. Transform produces 4x4
- array and one pixel value has to be used for 4x4 luma blocks and
- 2x2 chroma blocks.
-
- Similar concealment is performed for whole picture (the choise
- of the type is based on last successfully decoded slice header of
- the picture but it is handled by the calling function). It is
- acknowledged that this may result in wrong type of concealment
- when a picture contains both types of slices. However,
- determination of slice type macroblock-by-macroblock cannot
- be done due to the fact that it is impossible to know to which
- slice each corrupted (not successfully decoded) macroblock
- belongs.
-
- The error concealment is started by searching the first propoerly
- decoded macroblock and concealing the row containing the macroblock
- in question. After that all macroblocks above the row in question
- are concealed. Finally concealment of rows below is performed.
- The order of concealment for 4x4 picture where macroblock 9 is the
- first properly decoded one is as follows (properly decoded
- macroblocks marked with 'x', numbers indicating the order of
- concealment):
-
- 4 6 8 10
- 3 5 7 9
- 1 x x 2
- 11 12 13 14
-
- If all macroblocks of the picture are lost, the concealment is
- copy of previous picture for P-type and setting the image to
- constant gray (pixel value 128) for I-type.
-
- Concealment sets quantization parameter of the concealed
- macroblocks to value 40 and macroblock type to intra to enable
- deblocking filter to smooth the edges of the concealed areas.
-
- Inputs:
- pStorage pointer to storage structure
- currImage pointer to current image structure
- sliceType type of the slice
-
- Outputs:
- currImage concealed macroblocks will be written here
-
- Returns:
- HANTRO_OK
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdConceal(storage_t *pStorage, image_t *currImage, u32 sliceType)
-{
-
-/* Variables */
-
- u32 i, j;
- u32 row, col;
- u32 width, height;
- u8 *refData;
- mbStorage_t *mb;
-
-/* Code */
-
- ASSERT(pStorage);
- ASSERT(currImage);
-
- DEBUG(("Concealing %s slice\n", IS_I_SLICE(sliceType) ?
- "intra" : "inter"));
-
- width = currImage->width;
- height = currImage->height;
- refData = NULL;
- /* use reference picture with smallest available index */
- if (IS_P_SLICE(sliceType) || (pStorage->intraConcealmentFlag != 0))
- {
- i = 0;
- do
- {
- refData = h264bsdGetRefPicData(pStorage->dpb, i);
- i++;
- if (i >= 16)
- break;
- } while (refData == NULL);
- }
-
- i = row = col = 0;
- /* find first properly decoded macroblock -> start point for concealment */
- while (i < pStorage->picSizeInMbs && !pStorage->mb[i].decoded)
- {
- i++;
- col++;
- if (col == width)
- {
- row++;
- col = 0;
- }
- }
-
- /* whole picture lost -> copy previous or set grey */
- if (i == pStorage->picSizeInMbs)
- {
- if ( (IS_I_SLICE(sliceType) && (pStorage->intraConcealmentFlag == 0)) ||
- refData == NULL)
- H264SwDecMemset(currImage->data, 128, width*height*384);
- else
- H264SwDecMemcpy(currImage->data, refData, width*height*384);
-
- pStorage->numConcealedMbs = pStorage->picSizeInMbs;
-
- /* no filtering if whole picture concealed */
- for (i = 0; i < pStorage->picSizeInMbs; i++)
- pStorage->mb[i].disableDeblockingFilterIdc = 1;
-
- return(HANTRO_OK);
- }
-
- /* start from the row containing the first correct macroblock, conceal the
- * row in question, all rows above that row and then continue downwards */
- mb = pStorage->mb + row * width;
- for (j = col; j--;)
- {
- ConcealMb(mb+j, currImage, row, j, sliceType, refData);
- mb[j].decoded = 1;
- pStorage->numConcealedMbs++;
- }
- for (j = col + 1; j < width; j++)
- {
- if (!mb[j].decoded)
- {
- ConcealMb(mb+j, currImage, row, j, sliceType, refData);
- mb[j].decoded = 1;
- pStorage->numConcealedMbs++;
- }
- }
- /* if previous row(s) could not be concealed -> conceal them now */
- if (row)
- {
- for (j = 0; j < width; j++)
- {
- i = row - 1;
- mb = pStorage->mb + i*width + j;
- do
- {
- ConcealMb(mb, currImage, i, j, sliceType, refData);
- mb->decoded = 1;
- pStorage->numConcealedMbs++;
- mb -= width;
- } while(i--);
- }
- }
-
- /* process rows below the one containing the first correct macroblock */
- for (i = row + 1; i < height; i++)
- {
- mb = pStorage->mb + i * width;
-
- for (j = 0; j < width; j++)
- {
- if (!mb[j].decoded)
- {
- ConcealMb(mb+j, currImage, i, j, sliceType, refData);
- mb[j].decoded = 1;
- pStorage->numConcealedMbs++;
- }
- }
- }
-
- return(HANTRO_OK);
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: ConcealMb
-
- Functional description:
- Perform error concealment for one macroblock, location of the
- macroblock in the picture indicated by row and col
-
-------------------------------------------------------------------------------*/
-
-u32 ConcealMb(mbStorage_t *pMb, image_t *currImage, u32 row, u32 col,
- u32 sliceType, u8 *refData)
-{
-
-/* Variables */
-
- u32 i, j, comp;
- u32 hor, ver;
- u32 mbNum;
- u32 width, height;
- u8 *mbPos;
- u8 data[384];
- u8 *pData;
- i32 tmp;
- i32 firstPhase[16];
- i32 *pTmp;
- /* neighbours above, below, left and right */
- i32 a[4] = { 0,0,0,0 }, b[4], l[4] = { 0,0,0,0 }, r[4];
- u32 A, B, L, R;
-#ifdef H264DEC_OMXDL
- u8 fillBuff[32*21 + 15 + 32];
- u8 *pFill;
-#endif
-/* Code */
-
- ASSERT(pMb);
- ASSERT(!pMb->decoded);
- ASSERT(currImage);
- ASSERT(col < currImage->width);
- ASSERT(row < currImage->height);
-
-#ifdef H264DEC_OMXDL
- pFill = ALIGN(fillBuff, 16);
-#endif
- width = currImage->width;
- height = currImage->height;
- mbNum = row * width + col;
-
- h264bsdSetCurrImageMbPointers(currImage, mbNum);
-
- mbPos = currImage->data + row * 16 * width * 16 + col * 16;
- A = B = L = R = HANTRO_FALSE;
-
- /* set qpY to 40 to enable some filtering in deblocking (stetson value) */
- pMb->qpY = 40;
- pMb->disableDeblockingFilterIdc = 0;
- /* mbType set to intra to perform filtering despite the values of other
- * boundary strength determination fields */
- pMb->mbType = I_4x4;
- pMb->filterOffsetA = 0;
- pMb->filterOffsetB = 0;
- pMb->chromaQpIndexOffset = 0;
-
- if (IS_I_SLICE(sliceType))
- H264SwDecMemset(data, 0, sizeof(data));
- else
- {
- mv_t mv = {0,0};
- image_t refImage;
- refImage.width = width;
- refImage.height = height;
- refImage.data = refData;
- if (refImage.data)
- {
-#ifndef H264DEC_OMXDL
- h264bsdPredictSamples(data, &mv, &refImage, col*16, row*16,
- 0, 0, 16, 16);
-#else
- h264bsdPredictSamples(data, &mv, &refImage,
- ((row*16) + ((col*16)<<16)),
- 0x00001010, pFill);
-#endif
- h264bsdWriteMacroblock(currImage, data);
-
- return(HANTRO_OK);
- }
- else
- H264SwDecMemset(data, 0, sizeof(data));
- }
-
- H264SwDecMemset(firstPhase, 0, sizeof(firstPhase));
-
- /* counter for number of neighbours used */
- j = 0;
- hor = ver = 0;
- if (row && (pMb-width)->decoded)
- {
- A = HANTRO_TRUE;
- pData = mbPos - width*16;
- a[0] = *pData++; a[0] += *pData++; a[0] += *pData++; a[0] += *pData++;
- a[1] = *pData++; a[1] += *pData++; a[1] += *pData++; a[1] += *pData++;
- a[2] = *pData++; a[2] += *pData++; a[2] += *pData++; a[2] += *pData++;
- a[3] = *pData++; a[3] += *pData++; a[3] += *pData++; a[3] += *pData++;
- j++;
- hor++;
- firstPhase[0] += a[0] + a[1] + a[2] + a[3];
- firstPhase[1] += a[0] + a[1] - a[2] - a[3];
- }
- if ((row != height - 1) && (pMb+width)->decoded)
- {
- B = HANTRO_TRUE;
- pData = mbPos + 16*width*16;
- b[0] = *pData++; b[0] += *pData++; b[0] += *pData++; b[0] += *pData++;
- b[1] = *pData++; b[1] += *pData++; b[1] += *pData++; b[1] += *pData++;
- b[2] = *pData++; b[2] += *pData++; b[2] += *pData++; b[2] += *pData++;
- b[3] = *pData++; b[3] += *pData++; b[3] += *pData++; b[3] += *pData++;
- j++;
- hor++;
- firstPhase[0] += b[0] + b[1] + b[2] + b[3];
- firstPhase[1] += b[0] + b[1] - b[2] - b[3];
- }
- if (col && (pMb-1)->decoded)
- {
- L = HANTRO_TRUE;
- pData = mbPos - 1;
- l[0] = pData[0]; l[0] += pData[16*width];
- l[0] += pData[32*width]; l[0] += pData[48*width];
- pData += 64*width;
- l[1] = pData[0]; l[1] += pData[16*width];
- l[1] += pData[32*width]; l[1] += pData[48*width];
- pData += 64*width;
- l[2] = pData[0]; l[2] += pData[16*width];
- l[2] += pData[32*width]; l[2] += pData[48*width];
- pData += 64*width;
- l[3] = pData[0]; l[3] += pData[16*width];
- l[3] += pData[32*width]; l[3] += pData[48*width];
- j++;
- ver++;
- firstPhase[0] += l[0] + l[1] + l[2] + l[3];
- firstPhase[4] += l[0] + l[1] - l[2] - l[3];
- }
- if ((col != width - 1) && (pMb+1)->decoded)
- {
- R = HANTRO_TRUE;
- pData = mbPos + 16;
- r[0] = pData[0]; r[0] += pData[16*width];
- r[0] += pData[32*width]; r[0] += pData[48*width];
- pData += 64*width;
- r[1] = pData[0]; r[1] += pData[16*width];
- r[1] += pData[32*width]; r[1] += pData[48*width];
- pData += 64*width;
- r[2] = pData[0]; r[2] += pData[16*width];
- r[2] += pData[32*width]; r[2] += pData[48*width];
- pData += 64*width;
- r[3] = pData[0]; r[3] += pData[16*width];
- r[3] += pData[32*width]; r[3] += pData[48*width];
- j++;
- ver++;
- firstPhase[0] += r[0] + r[1] + r[2] + r[3];
- firstPhase[4] += r[0] + r[1] - r[2] - r[3];
- }
-
- /* at least one properly decoded neighbour available */
- ASSERT(j);
-
- /*lint -esym(644,l,r,a,b) variable initialized above */
- if (!hor && L && R)
- firstPhase[1] = (l[0]+l[1]+l[2]+l[3]-r[0]-r[1]-r[2]-r[3]) >> 5;
- else if (hor)
- firstPhase[1] >>= (3+hor);
-
- if (!ver && A && B)
- firstPhase[4] = (a[0]+a[1]+a[2]+a[3]-b[0]-b[1]-b[2]-b[3]) >> 5;
- else if (ver)
- firstPhase[4] >>= (3+ver);
-
- switch (j)
- {
- case 1:
- firstPhase[0] >>= 4;
- break;
-
- case 2:
- firstPhase[0] >>= 5;
- break;
-
- case 3:
- /* approximate (firstPhase[0]*4/3)>>6 */
- firstPhase[0] = (21 * firstPhase[0]) >> 10;
- break;
-
- default: /* 4 */
- firstPhase[0] >>= 6;
- break;
-
- }
-
-
- Transform(firstPhase);
-
- for (i = 0, pData = data, pTmp = firstPhase; i < 256;)
- {
- tmp = pTmp[(i & 0xF)>>2];
- /*lint -e734 CLIP1 macro results in value that fits into 8 bits */
- *pData++ = CLIP1(tmp);
- /*lint +e734 */
-
- i++;
- if (!(i & 0x3F))
- pTmp += 4;
- }
-
- /* chroma components */
- mbPos = currImage->data + width * height * 256 +
- row * 8 * width * 8 + col * 8;
- for (comp = 0; comp < 2; comp++)
- {
-
- H264SwDecMemset(firstPhase, 0, sizeof(firstPhase));
-
- /* counter for number of neighbours used */
- j = 0;
- hor = ver = 0;
- if (A)
- {
- pData = mbPos - width*8;
- a[0] = *pData++; a[0] += *pData++;
- a[1] = *pData++; a[1] += *pData++;
- a[2] = *pData++; a[2] += *pData++;
- a[3] = *pData++; a[3] += *pData++;
- j++;
- hor++;
- firstPhase[0] += a[0] + a[1] + a[2] + a[3];
- firstPhase[1] += a[0] + a[1] - a[2] - a[3];
- }
- if (B)
- {
- pData = mbPos + 8*width*8;
- b[0] = *pData++; b[0] += *pData++;
- b[1] = *pData++; b[1] += *pData++;
- b[2] = *pData++; b[2] += *pData++;
- b[3] = *pData++; b[3] += *pData++;
- j++;
- hor++;
- firstPhase[0] += b[0] + b[1] + b[2] + b[3];
- firstPhase[1] += b[0] + b[1] - b[2] - b[3];
- }
- if (L)
- {
- pData = mbPos - 1;
- l[0] = pData[0]; l[0] += pData[8*width];
- pData += 16*width;
- l[1] = pData[0]; l[1] += pData[8*width];
- pData += 16*width;
- l[2] = pData[0]; l[2] += pData[8*width];
- pData += 16*width;
- l[3] = pData[0]; l[3] += pData[8*width];
- j++;
- ver++;
- firstPhase[0] += l[0] + l[1] + l[2] + l[3];
- firstPhase[4] += l[0] + l[1] - l[2] - l[3];
- }
- if (R)
- {
- pData = mbPos + 8;
- r[0] = pData[0]; r[0] += pData[8*width];
- pData += 16*width;
- r[1] = pData[0]; r[1] += pData[8*width];
- pData += 16*width;
- r[2] = pData[0]; r[2] += pData[8*width];
- pData += 16*width;
- r[3] = pData[0]; r[3] += pData[8*width];
- j++;
- ver++;
- firstPhase[0] += r[0] + r[1] + r[2] + r[3];
- firstPhase[4] += r[0] + r[1] - r[2] - r[3];
- }
- if (!hor && L && R)
- firstPhase[1] = (l[0]+l[1]+l[2]+l[3]-r[0]-r[1]-r[2]-r[3]) >> 4;
- else if (hor)
- firstPhase[1] >>= (2+hor);
-
- if (!ver && A && B)
- firstPhase[4] = (a[0]+a[1]+a[2]+a[3]-b[0]-b[1]-b[2]-b[3]) >> 4;
- else if (ver)
- firstPhase[4] >>= (2+ver);
-
- switch (j)
- {
- case 1:
- firstPhase[0] >>= 3;
- break;
-
- case 2:
- firstPhase[0] >>= 4;
- break;
-
- case 3:
- /* approximate (firstPhase[0]*4/3)>>5 */
- firstPhase[0] = (21 * firstPhase[0]) >> 9;
- break;
-
- default: /* 4 */
- firstPhase[0] >>= 5;
- break;
-
- }
-
- Transform(firstPhase);
-
- pData = data + 256 + comp*64;
- for (i = 0, pTmp = firstPhase; i < 64;)
- {
- tmp = pTmp[(i & 0x7)>>1];
- /*lint -e734 CLIP1 macro results in value that fits into 8 bits */
- *pData++ = CLIP1(tmp);
- /*lint +e734 */
-
- i++;
- if (!(i & 0xF))
- pTmp += 4;
- }
-
- /* increment pointers for cr */
- mbPos += width * height * 64;
- }
-
- h264bsdWriteMacroblock(currImage, data);
-
- return(HANTRO_OK);
-
-}
-
-
-/*------------------------------------------------------------------------------
-
- Function name: Transform
-
- Functional description:
- Simplified transform, assuming that only dc component and lowest
- horizontal and lowest vertical component may be non-zero
-
-------------------------------------------------------------------------------*/
-
-void Transform(i32 *data)
-{
-
- u32 col;
- i32 tmp0, tmp1;
-
- if (!data[1] && !data[4])
- {
- data[1] = data[2] = data[3] = data[4] = data[5] =
- data[6] = data[7] = data[8] = data[9] = data[10] =
- data[11] = data[12] = data[13] = data[14] = data[15] = data[0];
- return;
- }
- /* first horizontal transform for rows 0 and 1 */
- tmp0 = data[0];
- tmp1 = data[1];
- data[0] = tmp0 + tmp1;
- data[1] = tmp0 + (tmp1>>1);
- data[2] = tmp0 - (tmp1>>1);
- data[3] = tmp0 - tmp1;
-
- tmp0 = data[4];
- data[5] = tmp0;
- data[6] = tmp0;
- data[7] = tmp0;
-
- /* then vertical transform */
- for (col = 4; col--; data++)
- {
- tmp0 = data[0];
- tmp1 = data[4];
- data[0] = tmp0 + tmp1;
- data[4] = tmp0 + (tmp1>>1);
- data[8] = tmp0 - (tmp1>>1);
- data[12] = tmp0 - tmp1;
- }
-
-}
-/*lint +e702 */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_conceal.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_conceal.h
deleted file mode 100644
index 3134670..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_conceal.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_CONCEAL_H
-#define H264SWDEC_CONCEAL_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_slice_header.h"
-#include "h264bsd_storage.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-u32 h264bsdConceal(storage_t *pStorage, image_t *currImage, u32 sliceType);
-
-#endif /* #ifdef H264SWDEC_CONCEAL_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_container.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_container.h
deleted file mode 100644
index 99b74a0..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_container.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_CONTAINER_H
-#define H264SWDEC_CONTAINER_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_storage.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-/* String length for tracing */
-#define H264DEC_TRACE_STR_LEN 100
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-typedef struct
-{
- enum {
- UNINITIALIZED,
- INITIALIZED,
- NEW_HEADERS
- } decStat;
-
- u32 picNumber;
- storage_t storage;
-#ifdef H264DEC_TRACE
- char str[H264DEC_TRACE_STR_LEN];
-#endif
-} decContainer_t;
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-#endif /* #ifdef H264SWDEC_DECCONTAINER_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_deblocking.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_deblocking.c
deleted file mode 100644
index f8c1f76..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_deblocking.c
+++ /dev/null
@@ -1,2417 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdFilterPicture
- FilterVerLumaEdge
- FilterHorLumaEdge
- FilterHorLuma
- FilterVerChromaEdge
- FilterHorChromaEdge
- FilterHorChroma
- InnerBoundaryStrength
- EdgeBoundaryStrength
- GetBoundaryStrengths
- IsSliceBoundaryOnLeft
- IsSliceBoundaryOnTop
- GetMbFilteringFlags
- GetLumaEdgeThresholds
- GetChromaEdgeThresholds
- FilterLuma
- FilterChroma
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_util.h"
-#include "h264bsd_macroblock_layer.h"
-#include "h264bsd_deblocking.h"
-#include "h264bsd_dpb.h"
-
-#ifdef H264DEC_OMXDL
-#include "omxtypes.h"
-#include "omxVC.h"
-#include "armVC.h"
-#endif /* H264DEC_OMXDL */
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-/* Switch off the following Lint messages for this file:
- * Info 701: Shift left of signed quantity (int)
- * Info 702: Shift right of signed quantity (int)
- */
-/*lint -e701 -e702 */
-
-/* array of alpha values, from the standard */
-static const u8 alphas[52] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,5,6,7,8,9,10,
- 12,13,15,17,20,22,25,28,32,36,40,45,50,56,63,71,80,90,101,113,127,144,162,
- 182,203,226,255,255};
-
-/* array of beta values, from the standard */
-static const u8 betas[52] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,3,3,3,3,4,4,
- 4,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18};
-
-
-
-#ifndef H264DEC_OMXDL
-/* array of tc0 values, from the standard, each triplet corresponds to a
- * column in the table. Indexing goes as tc0[indexA][bS-1] */
-static const u8 tc0[52][3] = {
- {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},
- {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},
- {0,0,0},{0,0,1},{0,0,1},{0,0,1},{0,0,1},{0,1,1},{0,1,1},{1,1,1},
- {1,1,1},{1,1,1},{1,1,1},{1,1,2},{1,1,2},{1,1,2},{1,1,2},{1,2,3},
- {1,2,3},{2,2,3},{2,2,4},{2,3,4},{2,3,4},{3,3,5},{3,4,6},{3,4,6},
- {4,5,7},{4,5,8},{4,6,9},{5,7,10},{6,8,11},{6,8,13},{7,10,14},{8,11,16},
- {9,12,18},{10,13,20},{11,15,23},{13,17,25}
-};
-#else
-/* array of tc0 values, from the standard, each triplet corresponds to a
- * column in the table. Indexing goes as tc0[indexA][bS] */
-static const u8 tc0[52][5] = {
- {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 1, 0},
- {0, 0, 0, 1, 0}, {0, 0, 1, 1, 0}, {0, 0, 1, 1, 0}, {0, 1, 1, 1, 0},
- {0, 1, 1, 1, 0}, {0, 1, 1, 1, 0}, {0, 1, 1, 1, 0}, {0, 1, 1, 2, 0},
- {0, 1, 1, 2, 0}, {0, 1, 1, 2, 0}, {0, 1, 1, 2, 0}, {0, 1, 2, 3, 0},
- {0, 1, 2, 3, 0}, {0, 2, 2, 3, 0}, {0, 2, 2, 4, 0}, {0, 2, 3, 4, 0},
- {0, 2, 3, 4, 0}, {0, 3, 3, 5, 0}, {0, 3, 4, 6, 0}, {0, 3, 4, 6, 0},
- {0, 4, 5, 7, 0}, {0, 4, 5, 8, 0}, {0, 4, 6, 9, 0}, {0, 5, 7, 10, 0},
- {0, 6, 8, 11, 0}, {0, 6, 8, 13, 0}, {0, 7, 10, 14, 0},
- {0, 8, 11, 16, 0}, {0, 9, 12, 18, 0}, {0, 10, 13, 20, 0},
- {0, 11, 15, 23, 0}, {0, 13, 17, 25, 0}
-};
-#endif
-
-
-#ifndef H264DEC_OMXDL
-/* mapping of raster scan block index to 4x4 block index */
-static const u32 mb4x4Index[16] =
- {0, 1, 4, 5, 2, 3, 6, 7, 8, 9, 12, 13, 10, 11, 14, 15};
-
-typedef struct {
- const u8 *tc0;
- u32 alpha;
- u32 beta;
-} edgeThreshold_t;
-
-typedef struct {
- u32 top;
- u32 left;
-} bS_t;
-
-enum { TOP = 0, LEFT = 1, INNER = 2 };
-#endif /* H264DEC_OMXDL */
-
-#define FILTER_LEFT_EDGE 0x04
-#define FILTER_TOP_EDGE 0x02
-#define FILTER_INNER_EDGE 0x01
-
-
-/* clipping table defined in intra_prediction.c */
-extern const u8 h264bsdClip[];
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-static u32 InnerBoundaryStrength(mbStorage_t *mb1, u32 i1, u32 i2);
-
-#ifndef H264DEC_OMXDL
-static u32 EdgeBoundaryStrength(mbStorage_t *mb1, mbStorage_t *mb2,
- u32 i1, u32 i2);
-#else
-static u32 InnerBoundaryStrength2(mbStorage_t *mb1, u32 i1, u32 i2);
-static u32 EdgeBoundaryStrengthLeft(mbStorage_t *mb1, mbStorage_t *mb2);
-static u32 EdgeBoundaryStrengthTop(mbStorage_t *mb1, mbStorage_t *mb2);
-#endif
-
-static u32 IsSliceBoundaryOnLeft(mbStorage_t *mb);
-
-static u32 IsSliceBoundaryOnTop(mbStorage_t *mb);
-
-static u32 GetMbFilteringFlags(mbStorage_t *mb);
-
-#ifndef H264DEC_OMXDL
-
-static u32 GetBoundaryStrengths(mbStorage_t *mb, bS_t *bs, u32 flags);
-
-static void FilterLuma(u8 *data, bS_t *bS, edgeThreshold_t *thresholds,
- u32 imageWidth);
-
-static void FilterChroma(u8 *cb, u8 *cr, bS_t *bS, edgeThreshold_t *thresholds,
- u32 imageWidth);
-
-static void FilterVerLumaEdge( u8 *data, u32 bS, edgeThreshold_t *thresholds,
- u32 imageWidth);
-static void FilterHorLumaEdge( u8 *data, u32 bS, edgeThreshold_t *thresholds,
- i32 imageWidth);
-static void FilterHorLuma( u8 *data, u32 bS, edgeThreshold_t *thresholds,
- i32 imageWidth);
-
-static void FilterVerChromaEdge( u8 *data, u32 bS, edgeThreshold_t *thresholds,
- u32 imageWidth);
-static void FilterHorChromaEdge( u8 *data, u32 bS, edgeThreshold_t *thresholds,
- i32 imageWidth);
-static void FilterHorChroma( u8 *data, u32 bS, edgeThreshold_t *thresholds,
- i32 imageWidth);
-
-static void GetLumaEdgeThresholds(
- edgeThreshold_t *thresholds,
- mbStorage_t *mb,
- u32 filteringFlags);
-
-static void GetChromaEdgeThresholds(
- edgeThreshold_t *thresholds,
- mbStorage_t *mb,
- u32 filteringFlags,
- i32 chromaQpIndexOffset);
-
-#else /* H264DEC_OMXDL */
-
-static u32 GetBoundaryStrengths(mbStorage_t *mb, u8 (*bs)[16], u32 flags);
-
-static void GetLumaEdgeThresholds(
- mbStorage_t *mb,
- u8 (*alpha)[2],
- u8 (*beta)[2],
- u8 (*threshold)[16],
- u8 (*bs)[16],
- u32 filteringFlags );
-
-static void GetChromaEdgeThresholds(
- mbStorage_t *mb,
- u8 (*alpha)[2],
- u8 (*beta)[2],
- u8 (*threshold)[8],
- u8 (*bs)[16],
- u32 filteringFlags,
- i32 chromaQpIndexOffset);
-
-#endif /* H264DEC_OMXDL */
-
-/*------------------------------------------------------------------------------
-
- Function: IsSliceBoundaryOnLeft
-
- Functional description:
- Function to determine if there is a slice boundary on the left side
- of a macroblock.
-
-------------------------------------------------------------------------------*/
-u32 IsSliceBoundaryOnLeft(mbStorage_t *mb)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(mb && mb->mbA);
-
- if (mb->sliceId != mb->mbA->sliceId)
- return(HANTRO_TRUE);
- else
- return(HANTRO_FALSE);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: IsSliceBoundaryOnTop
-
- Functional description:
- Function to determine if there is a slice boundary above the
- current macroblock.
-
-------------------------------------------------------------------------------*/
-u32 IsSliceBoundaryOnTop(mbStorage_t *mb)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(mb && mb->mbB);
-
- if (mb->sliceId != mb->mbB->sliceId)
- return(HANTRO_TRUE);
- else
- return(HANTRO_FALSE);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: GetMbFilteringFlags
-
- Functional description:
- Function to determine which edges of a macroblock has to be
- filtered. Output is a bit-wise OR of FILTER_LEFT_EDGE,
- FILTER_TOP_EDGE and FILTER_INNER_EDGE, depending on which edges
- shall be filtered.
-
-------------------------------------------------------------------------------*/
-u32 GetMbFilteringFlags(mbStorage_t *mb)
-{
-
-/* Variables */
-
- u32 flags = 0;
-
-/* Code */
-
- ASSERT(mb);
-
- /* nothing will be filtered if disableDeblockingFilterIdc == 1 */
- if (mb->disableDeblockingFilterIdc != 1)
- {
- flags |= FILTER_INNER_EDGE;
-
- /* filterLeftMbEdgeFlag, left mb is MB_A */
- if (mb->mbA &&
- ((mb->disableDeblockingFilterIdc != 2) ||
- !IsSliceBoundaryOnLeft(mb)))
- flags |= FILTER_LEFT_EDGE;
-
- /* filterTopMbEdgeFlag */
- if (mb->mbB &&
- ((mb->disableDeblockingFilterIdc != 2) ||
- !IsSliceBoundaryOnTop(mb)))
- flags |= FILTER_TOP_EDGE;
- }
-
- return(flags);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: InnerBoundaryStrength
-
- Functional description:
- Function to calculate boundary strength value bs for an inner
- edge of a macroblock. Macroblock type is checked before this is
- called -> no intra mb condition here.
-
-------------------------------------------------------------------------------*/
-u32 InnerBoundaryStrength(mbStorage_t *mb1, u32 ind1, u32 ind2)
-{
- i32 tmp1, tmp2;
- i32 mv1, mv2, mv3, mv4;
-
- tmp1 = mb1->totalCoeff[ind1];
- tmp2 = mb1->totalCoeff[ind2];
- mv1 = mb1->mv[ind1].hor;
- mv2 = mb1->mv[ind2].hor;
- mv3 = mb1->mv[ind1].ver;
- mv4 = mb1->mv[ind2].ver;
-
- if (tmp1 || tmp2)
- {
- return 2;
- }
- else if ( (ABS(mv1 - mv2) >= 4) || (ABS(mv3 - mv4) >= 4) ||
- (mb1->refAddr[ind1 >> 2] != mb1->refAddr[ind2 >> 2]) )
- {
- return 1;
- }
- else
- return 0;
-}
-
-/*------------------------------------------------------------------------------
-
- Function: InnerBoundaryStrength2
-
- Functional description:
- Function to calculate boundary strength value bs for an inner
- edge of a macroblock. The function is the same as
- InnerBoundaryStrength but without checking totalCoeff.
-
-------------------------------------------------------------------------------*/
-u32 InnerBoundaryStrength2(mbStorage_t *mb1, u32 ind1, u32 ind2)
-{
- i32 tmp1, tmp2, tmp3, tmp4;
-
- tmp1 = mb1->mv[ind1].hor;
- tmp2 = mb1->mv[ind2].hor;
- tmp3 = mb1->mv[ind1].ver;
- tmp4 = mb1->mv[ind2].ver;
-
- if ( (ABS(tmp1 - tmp2) >= 4) || (ABS(tmp3 - tmp4) >= 4) ||
- (mb1->refAddr[ind1 >> 2] != mb1->refAddr[ind2 >> 2]))
- {
- return 1;
- }
- else
- return 0;
-}
-#ifndef H264DEC_OMXDL
-/*------------------------------------------------------------------------------
-
- Function: EdgeBoundaryStrength
-
- Functional description:
- Function to calculate boundary strength value bs for left- or
- top-most edge of a macroblock. Macroblock types are checked
- before this is called -> no intra mb conditions here.
-
-------------------------------------------------------------------------------*/
-u32 EdgeBoundaryStrength(mbStorage_t *mb1, mbStorage_t *mb2,
- u32 ind1, u32 ind2)
-{
-
- if (mb1->totalCoeff[ind1] || mb2->totalCoeff[ind2])
- {
- return 2;
- }
- else if ((mb1->refAddr[ind1 >> 2] != mb2->refAddr[ind2 >> 2]) ||
- (ABS(mb1->mv[ind1].hor - mb2->mv[ind2].hor) >= 4) ||
- (ABS(mb1->mv[ind1].ver - mb2->mv[ind2].ver) >= 4))
- {
- return 1;
- }
- else
- return 0;
-}
-
-#else /* H264DEC_OMXDL */
-
-/*------------------------------------------------------------------------------
-
- Function: EdgeBoundaryStrengthTop
-
- Functional description:
- Function to calculate boundary strength value bs for
- top-most edge of a macroblock. Macroblock types are checked
- before this is called -> no intra mb conditions here.
-
-------------------------------------------------------------------------------*/
-u32 EdgeBoundaryStrengthTop(mbStorage_t *mb1, mbStorage_t *mb2)
-{
- u32 topBs = 0;
- u32 tmp1, tmp2, tmp3, tmp4;
-
- tmp1 = mb1->totalCoeff[0];
- tmp2 = mb2->totalCoeff[10];
- tmp3 = mb1->totalCoeff[1];
- tmp4 = mb2->totalCoeff[11];
- if (tmp1 || tmp2)
- {
- topBs = 2<<0;
- }
- else if ((ABS(mb1->mv[0].hor - mb2->mv[10].hor) >= 4) ||
- (ABS(mb1->mv[0].ver - mb2->mv[10].ver) >= 4) ||
- (mb1->refAddr[0] != mb2->refAddr[10 >> 2]))
- {
- topBs = 1<<0;
- }
- tmp1 = mb1->totalCoeff[4];
- tmp2 = mb2->totalCoeff[14];
- if (tmp3 || tmp4)
- {
- topBs += 2<<8;
- }
- else if ((ABS(mb1->mv[1].hor - mb2->mv[11].hor) >= 4) ||
- (ABS(mb1->mv[1].ver - mb2->mv[11].ver) >= 4) ||
- (mb1->refAddr[0] != mb2->refAddr[11 >> 2]))
- {
- topBs += 1<<8;
- }
- tmp3 = mb1->totalCoeff[5];
- tmp4 = mb2->totalCoeff[15];
- if (tmp1 || tmp2)
- {
- topBs += 2<<16;
- }
- else if ((ABS(mb1->mv[4].hor - mb2->mv[14].hor) >= 4) ||
- (ABS(mb1->mv[4].ver - mb2->mv[14].ver) >= 4) ||
- (mb1->refAddr[4 >> 2] != mb2->refAddr[14 >> 2]))
- {
- topBs += 1<<16;
- }
- if (tmp3 || tmp4)
- {
- topBs += 2<<24;
- }
- else if ((ABS(mb1->mv[5].hor - mb2->mv[15].hor) >= 4) ||
- (ABS(mb1->mv[5].ver - mb2->mv[15].ver) >= 4) ||
- (mb1->refAddr[5 >> 2] != mb2->refAddr[15 >> 2]))
- {
- topBs += 1<<24;
- }
-
- return topBs;
-}
-
-/*------------------------------------------------------------------------------
-
- Function: EdgeBoundaryStrengthLeft
-
- Functional description:
- Function to calculate boundary strength value bs for left-
- edge of a macroblock. Macroblock types are checked
- before this is called -> no intra mb conditions here.
-
-------------------------------------------------------------------------------*/
-u32 EdgeBoundaryStrengthLeft(mbStorage_t *mb1, mbStorage_t *mb2)
-{
- u32 leftBs = 0;
- u32 tmp1, tmp2, tmp3, tmp4;
-
- tmp1 = mb1->totalCoeff[0];
- tmp2 = mb2->totalCoeff[5];
- tmp3 = mb1->totalCoeff[2];
- tmp4 = mb2->totalCoeff[7];
-
- if (tmp1 || tmp2)
- {
- leftBs = 2<<0;
- }
- else if ((ABS(mb1->mv[0].hor - mb2->mv[5].hor) >= 4) ||
- (ABS(mb1->mv[0].ver - mb2->mv[5].ver) >= 4) ||
- (mb1->refAddr[0] != mb2->refAddr[5 >> 2]))
- {
- leftBs = 1<<0;
- }
- tmp1 = mb1->totalCoeff[8];
- tmp2 = mb2->totalCoeff[13];
- if (tmp3 || tmp4)
- {
- leftBs += 2<<8;
- }
- else if ((ABS(mb1->mv[2].hor - mb2->mv[7].hor) >= 4) ||
- (ABS(mb1->mv[2].ver - mb2->mv[7].ver) >= 4) ||
- (mb1->refAddr[0] != mb2->refAddr[7 >> 2]))
- {
- leftBs += 1<<8;
- }
- tmp3 = mb1->totalCoeff[10];
- tmp4 = mb2->totalCoeff[15];
- if (tmp1 || tmp2)
- {
- leftBs += 2<<16;
- }
- else if ((ABS(mb1->mv[8].hor - mb2->mv[13].hor) >= 4) ||
- (ABS(mb1->mv[8].ver - mb2->mv[13].ver) >= 4) ||
- (mb1->refAddr[8 >> 2] != mb2->refAddr[13 >> 2]))
- {
- leftBs += 1<<16;
- }
- if (tmp3 || tmp4)
- {
- leftBs += 2<<24;
- }
- else if ((ABS(mb1->mv[10].hor - mb2->mv[15].hor) >= 4) ||
- (ABS(mb1->mv[10].ver - mb2->mv[15].ver) >= 4) ||
- (mb1->refAddr[10 >> 2] != mb2->refAddr[15 >> 2]))
- {
- leftBs += 1<<24;
- }
-
- return leftBs;
-}
-#endif /* H264DEC_OMXDL */
-/*------------------------------------------------------------------------------
-
- Function: h264bsdFilterPicture
-
- Functional description:
- Perform deblocking filtering for a picture. Filter does not copy
- the original picture anywhere but filtering is performed directly
- on the original image. Parameters controlling the filtering process
- are computed based on information in macroblock structures of the
- filtered macroblock, macroblock above and macroblock on the left of
- the filtered one.
-
- Inputs:
- image pointer to image to be filtered
- mb pointer to macroblock data structure of the top-left
- macroblock of the picture
-
- Outputs:
- image filtered image stored here
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-#ifndef H264DEC_OMXDL
-void h264bsdFilterPicture(
- image_t *image,
- mbStorage_t *mb)
-{
-
-/* Variables */
-
- u32 flags;
- u32 picSizeInMbs, mbRow, mbCol;
- u32 picWidthInMbs;
- u8 *data;
- mbStorage_t *pMb;
- bS_t bS[16];
- edgeThreshold_t thresholds[3];
-
-/* Code */
-
- ASSERT(image);
- ASSERT(mb);
- ASSERT(image->data);
- ASSERT(image->width);
- ASSERT(image->height);
-
- picWidthInMbs = image->width;
- data = image->data;
- picSizeInMbs = picWidthInMbs * image->height;
-
- pMb = mb;
-
- for (mbRow = 0, mbCol = 0; mbRow < image->height; pMb++)
- {
- flags = GetMbFilteringFlags(pMb);
-
- if (flags)
- {
- /* GetBoundaryStrengths function returns non-zero value if any of
- * the bS values for the macroblock being processed was non-zero */
- if (GetBoundaryStrengths(pMb, bS, flags))
- {
- /* luma */
- GetLumaEdgeThresholds(thresholds, pMb, flags);
- data = image->data + mbRow * picWidthInMbs * 256 + mbCol * 16;
-
- FilterLuma((u8*)data, bS, thresholds, picWidthInMbs*16);
-
- /* chroma */
- GetChromaEdgeThresholds(thresholds, pMb, flags,
- pMb->chromaQpIndexOffset);
- data = image->data + picSizeInMbs * 256 +
- mbRow * picWidthInMbs * 64 + mbCol * 8;
-
- FilterChroma((u8*)data, data + 64*picSizeInMbs, bS,
- thresholds, picWidthInMbs*8);
-
- }
- }
-
- mbCol++;
- if (mbCol == picWidthInMbs)
- {
- mbCol = 0;
- mbRow++;
- }
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: FilterVerLumaEdge
-
- Functional description:
- Filter one vertical 4-pixel luma edge.
-
-------------------------------------------------------------------------------*/
-void FilterVerLumaEdge(
- u8 *data,
- u32 bS,
- edgeThreshold_t *thresholds,
- u32 imageWidth)
-{
-
-/* Variables */
-
- i32 delta, tc, tmp;
- u32 i;
- u8 p0, q0, p1, q1, p2, q2;
- u32 tmpFlag;
- const u8 *clp = h264bsdClip + 512;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(bS && bS <= 4);
- ASSERT(thresholds);
-
- if (bS < 4)
- {
- tc = thresholds->tc0[bS-1];
- tmp = tc;
- for (i = 4; i; i--, data += imageWidth)
- {
- p1 = data[-2]; p0 = data[-1];
- q0 = data[0]; q1 = data[1];
- if ( ((unsigned)ABS(p0-q0) < thresholds->alpha) &&
- ((unsigned)ABS(p1-p0) < thresholds->beta) &&
- ((unsigned)ABS(q1-q0) < thresholds->beta) )
- {
- p2 = data[-3];
- q2 = data[2];
-
- if ((unsigned)ABS(p2-p0) < thresholds->beta)
- {
- data[-2] = (u8)(p1 + CLIP3(-tc,tc,
- (p2 + ((p0 + q0 + 1) >> 1) - (p1 << 1)) >> 1));
- tmp++;
- }
-
- if ((unsigned)ABS(q2-q0) < thresholds->beta)
- {
- data[1] = (u8)(q1 + CLIP3(-tc,tc,
- (q2 + ((p0 + q0 + 1) >> 1) - (q1 << 1)) >> 1));
- tmp++;
- }
-
- delta = CLIP3(-tmp, tmp, ((((q0 - p0) << 2) +
- (p1 - q1) + 4) >> 3));
-
- p0 = clp[p0 + delta];
- q0 = clp[q0 - delta];
- tmp = tc;
- data[-1] = p0;
- data[ 0] = q0;
- }
- }
- }
- else
- {
- for (i = 4; i; i--, data += imageWidth)
- {
- p1 = data[-2]; p0 = data[-1];
- q0 = data[0]; q1 = data[1];
- if ( ((unsigned)ABS(p0-q0) < thresholds->alpha) &&
- ((unsigned)ABS(p1-p0) < thresholds->beta) &&
- ((unsigned)ABS(q1-q0) < thresholds->beta) )
- {
- tmpFlag =
- ((unsigned)ABS(p0-q0) < ((thresholds->alpha >> 2) +2)) ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- p2 = data[-3];
- q2 = data[2];
-
- if (tmpFlag && (unsigned)ABS(p2-p0) < thresholds->beta)
- {
- tmp = p1 + p0 + q0;
- data[-1] = (u8)((p2 + 2 * tmp + q1 + 4) >> 3);
- data[-2] = (u8)((p2 + tmp + 2) >> 2);
- data[-3] = (u8)((2 * data[-4] + 3 * p2 + tmp + 4) >> 3);
- }
- else
- data[-1] = (2 * p1 + p0 + q1 + 2) >> 2;
-
- if (tmpFlag && (unsigned)ABS(q2-q0) < thresholds->beta)
- {
- tmp = p0 + q0 + q1;
- data[0] = (u8)((p1 + 2 * tmp + q2 + 4) >> 3);
- data[1] = (u8)((tmp + q2 + 2) >> 2);
- data[2] = (u8)((2 * data[3] + 3 * q2 + tmp + 4) >> 3);
- }
- else
- data[0] = (u8)((2 * q1 + q0 + p1 + 2) >> 2);
- }
- }
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: FilterHorLumaEdge
-
- Functional description:
- Filter one horizontal 4-pixel luma edge
-
-------------------------------------------------------------------------------*/
-void FilterHorLumaEdge(
- u8 *data,
- u32 bS,
- edgeThreshold_t *thresholds,
- i32 imageWidth)
-{
-
-/* Variables */
-
- i32 delta, tc, tmp;
- u32 i;
- u8 p0, q0, p1, q1, p2, q2;
- const u8 *clp = h264bsdClip + 512;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(bS < 4);
- ASSERT(thresholds);
-
- tc = thresholds->tc0[bS-1];
- tmp = tc;
- for (i = 4; i; i--, data++)
- {
- p1 = data[-imageWidth*2]; p0 = data[-imageWidth];
- q0 = data[0]; q1 = data[imageWidth];
- if ( ((unsigned)ABS(p0-q0) < thresholds->alpha) &&
- ((unsigned)ABS(p1-p0) < thresholds->beta) &&
- ((unsigned)ABS(q1-q0) < thresholds->beta) )
- {
- p2 = data[-imageWidth*3];
-
- if ((unsigned)ABS(p2-p0) < thresholds->beta)
- {
- data[-imageWidth*2] = (u8)(p1 + CLIP3(-tc,tc,
- (p2 + ((p0 + q0 + 1) >> 1) - (p1 << 1)) >> 1));
- tmp++;
- }
-
- q2 = data[imageWidth*2];
-
- if ((unsigned)ABS(q2-q0) < thresholds->beta)
- {
- data[imageWidth] = (u8)(q1 + CLIP3(-tc,tc,
- (q2 + ((p0 + q0 + 1) >> 1) - (q1 << 1)) >> 1));
- tmp++;
- }
-
- delta = CLIP3(-tmp, tmp, ((((q0 - p0) << 2) +
- (p1 - q1) + 4) >> 3));
-
- p0 = clp[p0 + delta];
- q0 = clp[q0 - delta];
- tmp = tc;
- data[-imageWidth] = p0;
- data[ 0] = q0;
- }
- }
-}
-
-/*------------------------------------------------------------------------------
-
- Function: FilterHorLuma
-
- Functional description:
- Filter all four successive horizontal 4-pixel luma edges. This can
- be done when bS is equal to all four edges.
-
-------------------------------------------------------------------------------*/
-void FilterHorLuma(
- u8 *data,
- u32 bS,
- edgeThreshold_t *thresholds,
- i32 imageWidth)
-{
-
-/* Variables */
-
- i32 delta, tc, tmp;
- u32 i;
- u8 p0, q0, p1, q1, p2, q2;
- u32 tmpFlag;
- const u8 *clp = h264bsdClip + 512;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(bS <= 4);
- ASSERT(thresholds);
-
- if (bS < 4)
- {
- tc = thresholds->tc0[bS-1];
- tmp = tc;
- for (i = 16; i; i--, data++)
- {
- p1 = data[-imageWidth*2]; p0 = data[-imageWidth];
- q0 = data[0]; q1 = data[imageWidth];
- if ( ((unsigned)ABS(p0-q0) < thresholds->alpha) &&
- ((unsigned)ABS(p1-p0) < thresholds->beta) &&
- ((unsigned)ABS(q1-q0) < thresholds->beta) )
- {
- p2 = data[-imageWidth*3];
-
- if ((unsigned)ABS(p2-p0) < thresholds->beta)
- {
- data[-imageWidth*2] = (u8)(p1 + CLIP3(-tc,tc,
- (p2 + ((p0 + q0 + 1) >> 1) - (p1 << 1)) >> 1));
- tmp++;
- }
-
- q2 = data[imageWidth*2];
-
- if ((unsigned)ABS(q2-q0) < thresholds->beta)
- {
- data[imageWidth] = (u8)(q1 + CLIP3(-tc,tc,
- (q2 + ((p0 + q0 + 1) >> 1) - (q1 << 1)) >> 1));
- tmp++;
- }
-
- delta = CLIP3(-tmp, tmp, ((((q0 - p0) << 2) +
- (p1 - q1) + 4) >> 3));
-
- p0 = clp[p0 + delta];
- q0 = clp[q0 - delta];
- tmp = tc;
- data[-imageWidth] = p0;
- data[ 0] = q0;
- }
- }
- }
- else
- {
- for (i = 16; i; i--, data++)
- {
- p1 = data[-imageWidth*2]; p0 = data[-imageWidth];
- q0 = data[0]; q1 = data[imageWidth];
- if ( ((unsigned)ABS(p0-q0) < thresholds->alpha) &&
- ((unsigned)ABS(p1-p0) < thresholds->beta) &&
- ((unsigned)ABS(q1-q0) < thresholds->beta) )
- {
- tmpFlag = ((unsigned)ABS(p0-q0) < ((thresholds->alpha >> 2) +2))
- ? HANTRO_TRUE : HANTRO_FALSE;
-
- p2 = data[-imageWidth*3];
- q2 = data[imageWidth*2];
-
- if (tmpFlag && (unsigned)ABS(p2-p0) < thresholds->beta)
- {
- tmp = p1 + p0 + q0;
- data[-imageWidth] = (u8)((p2 + 2 * tmp + q1 + 4) >> 3);
- data[-imageWidth*2] = (u8)((p2 + tmp + 2) >> 2);
- data[-imageWidth*3] = (u8)((2 * data[-imageWidth*4] +
- 3 * p2 + tmp + 4) >> 3);
- }
- else
- data[-imageWidth] = (u8)((2 * p1 + p0 + q1 + 2) >> 2);
-
- if (tmpFlag && (unsigned)ABS(q2-q0) < thresholds->beta)
- {
- tmp = p0 + q0 + q1;
- data[ 0] = (u8)((p1 + 2 * tmp + q2 + 4) >> 3);
- data[imageWidth] = (u8)((tmp + q2 + 2) >> 2);
- data[imageWidth*2] = (u8)((2 * data[imageWidth*3] +
- 3 * q2 + tmp + 4) >> 3);
- }
- else
- data[0] = (2 * q1 + q0 + p1 + 2) >> 2;
- }
- }
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: FilterVerChromaEdge
-
- Functional description:
- Filter one vertical 2-pixel chroma edge
-
-------------------------------------------------------------------------------*/
-void FilterVerChromaEdge(
- u8 *data,
- u32 bS,
- edgeThreshold_t *thresholds,
- u32 width)
-{
-
-/* Variables */
-
- i32 delta, tc;
- u8 p0, q0, p1, q1;
- const u8 *clp = h264bsdClip + 512;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(bS <= 4);
- ASSERT(thresholds);
-
- p1 = data[-2]; p0 = data[-1];
- q0 = data[0]; q1 = data[1];
- if ( ((unsigned)ABS(p0-q0) < thresholds->alpha) &&
- ((unsigned)ABS(p1-p0) < thresholds->beta) &&
- ((unsigned)ABS(q1-q0) < thresholds->beta) )
- {
- if (bS < 4)
- {
- tc = thresholds->tc0[bS-1] + 1;
- delta = CLIP3(-tc, tc, ((((q0 - p0) << 2) +
- (p1 - q1) + 4) >> 3));
- p0 = clp[p0 + delta];
- q0 = clp[q0 - delta];
- data[-1] = p0;
- data[ 0] = q0;
- }
- else
- {
- data[-1] = (2 * p1 + p0 + q1 + 2) >> 2;
- data[ 0] = (2 * q1 + q0 + p1 + 2) >> 2;
- }
- }
- data += width;
- p1 = data[-2]; p0 = data[-1];
- q0 = data[0]; q1 = data[1];
- if ( ((unsigned)ABS(p0-q0) < thresholds->alpha) &&
- ((unsigned)ABS(p1-p0) < thresholds->beta) &&
- ((unsigned)ABS(q1-q0) < thresholds->beta) )
- {
- if (bS < 4)
- {
- tc = thresholds->tc0[bS-1] + 1;
- delta = CLIP3(-tc, tc, ((((q0 - p0) << 2) +
- (p1 - q1) + 4) >> 3));
- p0 = clp[p0 + delta];
- q0 = clp[q0 - delta];
- data[-1] = p0;
- data[ 0] = q0;
- }
- else
- {
- data[-1] = (2 * p1 + p0 + q1 + 2) >> 2;
- data[ 0] = (2 * q1 + q0 + p1 + 2) >> 2;
- }
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: FilterHorChromaEdge
-
- Functional description:
- Filter one horizontal 2-pixel chroma edge
-
-------------------------------------------------------------------------------*/
-void FilterHorChromaEdge(
- u8 *data,
- u32 bS,
- edgeThreshold_t *thresholds,
- i32 width)
-{
-
-/* Variables */
-
- i32 delta, tc;
- u32 i;
- u8 p0, q0, p1, q1;
- const u8 *clp = h264bsdClip + 512;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(bS < 4);
- ASSERT(thresholds);
-
- tc = thresholds->tc0[bS-1] + 1;
- for (i = 2; i; i--, data++)
- {
- p1 = data[-width*2]; p0 = data[-width];
- q0 = data[0]; q1 = data[width];
- if ( ((unsigned)ABS(p0-q0) < thresholds->alpha) &&
- ((unsigned)ABS(p1-p0) < thresholds->beta) &&
- ((unsigned)ABS(q1-q0) < thresholds->beta) )
- {
- delta = CLIP3(-tc, tc, ((((q0 - p0) << 2) +
- (p1 - q1) + 4) >> 3));
- p0 = clp[p0 + delta];
- q0 = clp[q0 - delta];
- data[-width] = p0;
- data[ 0] = q0;
- }
- }
-}
-
-/*------------------------------------------------------------------------------
-
- Function: FilterHorChroma
-
- Functional description:
- Filter all four successive horizontal 2-pixel chroma edges. This
- can be done if bS is equal for all four edges.
-
-------------------------------------------------------------------------------*/
-void FilterHorChroma(
- u8 *data,
- u32 bS,
- edgeThreshold_t *thresholds,
- i32 width)
-{
-
-/* Variables */
-
- i32 delta, tc;
- u32 i;
- u8 p0, q0, p1, q1;
- const u8 *clp = h264bsdClip + 512;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(bS <= 4);
- ASSERT(thresholds);
-
- if (bS < 4)
- {
- tc = thresholds->tc0[bS-1] + 1;
- for (i = 8; i; i--, data++)
- {
- p1 = data[-width*2]; p0 = data[-width];
- q0 = data[0]; q1 = data[width];
- if ( ((unsigned)ABS(p0-q0) < thresholds->alpha) &&
- ((unsigned)ABS(p1-p0) < thresholds->beta) &&
- ((unsigned)ABS(q1-q0) < thresholds->beta) )
- {
- delta = CLIP3(-tc, tc, ((((q0 - p0) << 2) +
- (p1 - q1) + 4) >> 3));
- p0 = clp[p0 + delta];
- q0 = clp[q0 - delta];
- data[-width] = p0;
- data[ 0] = q0;
- }
- }
- }
- else
- {
- for (i = 8; i; i--, data++)
- {
- p1 = data[-width*2]; p0 = data[-width];
- q0 = data[0]; q1 = data[width];
- if ( ((unsigned)ABS(p0-q0) < thresholds->alpha) &&
- ((unsigned)ABS(p1-p0) < thresholds->beta) &&
- ((unsigned)ABS(q1-q0) < thresholds->beta) )
- {
- data[-width] = (2 * p1 + p0 + q1 + 2) >> 2;
- data[ 0] = (2 * q1 + q0 + p1 + 2) >> 2;
- }
- }
- }
-
-}
-
-
-/*------------------------------------------------------------------------------
-
- Function: GetBoundaryStrengths
-
- Functional description:
- Function to calculate boundary strengths for all edges of a
- macroblock. Function returns HANTRO_TRUE if any of the bS values for
- the macroblock had non-zero value, HANTRO_FALSE otherwise.
-
-------------------------------------------------------------------------------*/
-u32 GetBoundaryStrengths(mbStorage_t *mb, bS_t *bS, u32 flags)
-{
-
-/* Variables */
-
- /* this flag is set HANTRO_TRUE as soon as any boundary strength value is
- * non-zero */
- u32 nonZeroBs = HANTRO_FALSE;
-
-/* Code */
-
- ASSERT(mb);
- ASSERT(bS);
- ASSERT(flags);
-
- /* top edges */
- if (flags & FILTER_TOP_EDGE)
- {
- if (IS_INTRA_MB(*mb) || IS_INTRA_MB(*mb->mbB))
- {
- bS[0].top = bS[1].top = bS[2].top = bS[3].top = 4;
- nonZeroBs = HANTRO_TRUE;
- }
- else
- {
- bS[0].top = EdgeBoundaryStrength(mb, mb->mbB, 0, 10);
- bS[1].top = EdgeBoundaryStrength(mb, mb->mbB, 1, 11);
- bS[2].top = EdgeBoundaryStrength(mb, mb->mbB, 4, 14);
- bS[3].top = EdgeBoundaryStrength(mb, mb->mbB, 5, 15);
- if (bS[0].top || bS[1].top || bS[2].top || bS[3].top)
- nonZeroBs = HANTRO_TRUE;
- }
- }
- else
- {
- bS[0].top = bS[1].top = bS[2].top = bS[3].top = 0;
- }
-
- /* left edges */
- if (flags & FILTER_LEFT_EDGE)
- {
- if (IS_INTRA_MB(*mb) || IS_INTRA_MB(*mb->mbA))
- {
- bS[0].left = bS[4].left = bS[8].left = bS[12].left = 4;
- nonZeroBs = HANTRO_TRUE;
- }
- else
- {
- bS[0].left = EdgeBoundaryStrength(mb, mb->mbA, 0, 5);
- bS[4].left = EdgeBoundaryStrength(mb, mb->mbA, 2, 7);
- bS[8].left = EdgeBoundaryStrength(mb, mb->mbA, 8, 13);
- bS[12].left = EdgeBoundaryStrength(mb, mb->mbA, 10, 15);
- if (!nonZeroBs &&
- (bS[0].left || bS[4].left || bS[8].left || bS[12].left))
- nonZeroBs = HANTRO_TRUE;
- }
- }
- else
- {
- bS[0].left = bS[4].left = bS[8].left = bS[12].left = 0;
- }
-
- /* inner edges */
- if (IS_INTRA_MB(*mb))
- {
- bS[4].top = bS[5].top = bS[6].top = bS[7].top =
- bS[8].top = bS[9].top = bS[10].top = bS[11].top =
- bS[12].top = bS[13].top = bS[14].top = bS[15].top = 3;
-
- bS[1].left = bS[2].left = bS[3].left =
- bS[5].left = bS[6].left = bS[7].left =
- bS[9].left = bS[10].left = bS[11].left =
- bS[13].left = bS[14].left = bS[15].left = 3;
- nonZeroBs = HANTRO_TRUE;
- }
- else
- {
- /* 16x16 inter mb -> ref addresses or motion vectors cannot differ,
- * only check if either of the blocks contain coefficients */
- if (h264bsdNumMbPart(mb->mbType) == 1)
- {
- bS[4].top = mb->totalCoeff[2] || mb->totalCoeff[0] ? 2 : 0;
- bS[5].top = mb->totalCoeff[3] || mb->totalCoeff[1] ? 2 : 0;
- bS[6].top = mb->totalCoeff[6] || mb->totalCoeff[4] ? 2 : 0;
- bS[7].top = mb->totalCoeff[7] || mb->totalCoeff[5] ? 2 : 0;
- bS[8].top = mb->totalCoeff[8] || mb->totalCoeff[2] ? 2 : 0;
- bS[9].top = mb->totalCoeff[9] || mb->totalCoeff[3] ? 2 : 0;
- bS[10].top = mb->totalCoeff[12] || mb->totalCoeff[6] ? 2 : 0;
- bS[11].top = mb->totalCoeff[13] || mb->totalCoeff[7] ? 2 : 0;
- bS[12].top = mb->totalCoeff[10] || mb->totalCoeff[8] ? 2 : 0;
- bS[13].top = mb->totalCoeff[11] || mb->totalCoeff[9] ? 2 : 0;
- bS[14].top = mb->totalCoeff[14] || mb->totalCoeff[12] ? 2 : 0;
- bS[15].top = mb->totalCoeff[15] || mb->totalCoeff[13] ? 2 : 0;
-
- bS[1].left = mb->totalCoeff[1] || mb->totalCoeff[0] ? 2 : 0;
- bS[2].left = mb->totalCoeff[4] || mb->totalCoeff[1] ? 2 : 0;
- bS[3].left = mb->totalCoeff[5] || mb->totalCoeff[4] ? 2 : 0;
- bS[5].left = mb->totalCoeff[3] || mb->totalCoeff[2] ? 2 : 0;
- bS[6].left = mb->totalCoeff[6] || mb->totalCoeff[3] ? 2 : 0;
- bS[7].left = mb->totalCoeff[7] || mb->totalCoeff[6] ? 2 : 0;
- bS[9].left = mb->totalCoeff[9] || mb->totalCoeff[8] ? 2 : 0;
- bS[10].left = mb->totalCoeff[12] || mb->totalCoeff[9] ? 2 : 0;
- bS[11].left = mb->totalCoeff[13] || mb->totalCoeff[12] ? 2 : 0;
- bS[13].left = mb->totalCoeff[11] || mb->totalCoeff[10] ? 2 : 0;
- bS[14].left = mb->totalCoeff[14] || mb->totalCoeff[11] ? 2 : 0;
- bS[15].left = mb->totalCoeff[15] || mb->totalCoeff[14] ? 2 : 0;
- }
- /* 16x8 inter mb -> ref addresses and motion vectors can be different
- * only for the middle horizontal edge, for the other top edges it is
- * enough to check whether the blocks contain coefficients or not. The
- * same applies to all internal left edges. */
- else if (mb->mbType == P_L0_L0_16x8)
- {
- bS[4].top = mb->totalCoeff[2] || mb->totalCoeff[0] ? 2 : 0;
- bS[5].top = mb->totalCoeff[3] || mb->totalCoeff[1] ? 2 : 0;
- bS[6].top = mb->totalCoeff[6] || mb->totalCoeff[4] ? 2 : 0;
- bS[7].top = mb->totalCoeff[7] || mb->totalCoeff[5] ? 2 : 0;
- bS[12].top = mb->totalCoeff[10] || mb->totalCoeff[8] ? 2 : 0;
- bS[13].top = mb->totalCoeff[11] || mb->totalCoeff[9] ? 2 : 0;
- bS[14].top = mb->totalCoeff[14] || mb->totalCoeff[12] ? 2 : 0;
- bS[15].top = mb->totalCoeff[15] || mb->totalCoeff[13] ? 2 : 0;
- bS[8].top = InnerBoundaryStrength(mb, 8, 2);
- bS[9].top = InnerBoundaryStrength(mb, 9, 3);
- bS[10].top = InnerBoundaryStrength(mb, 12, 6);
- bS[11].top = InnerBoundaryStrength(mb, 13, 7);
-
- bS[1].left = mb->totalCoeff[1] || mb->totalCoeff[0] ? 2 : 0;
- bS[2].left = mb->totalCoeff[4] || mb->totalCoeff[1] ? 2 : 0;
- bS[3].left = mb->totalCoeff[5] || mb->totalCoeff[4] ? 2 : 0;
- bS[5].left = mb->totalCoeff[3] || mb->totalCoeff[2] ? 2 : 0;
- bS[6].left = mb->totalCoeff[6] || mb->totalCoeff[3] ? 2 : 0;
- bS[7].left = mb->totalCoeff[7] || mb->totalCoeff[6] ? 2 : 0;
- bS[9].left = mb->totalCoeff[9] || mb->totalCoeff[8] ? 2 : 0;
- bS[10].left = mb->totalCoeff[12] || mb->totalCoeff[9] ? 2 : 0;
- bS[11].left = mb->totalCoeff[13] || mb->totalCoeff[12] ? 2 : 0;
- bS[13].left = mb->totalCoeff[11] || mb->totalCoeff[10] ? 2 : 0;
- bS[14].left = mb->totalCoeff[14] || mb->totalCoeff[11] ? 2 : 0;
- bS[15].left = mb->totalCoeff[15] || mb->totalCoeff[14] ? 2 : 0;
- }
- /* 8x16 inter mb -> ref addresses and motion vectors can be different
- * only for the middle vertical edge, for the other left edges it is
- * enough to check whether the blocks contain coefficients or not. The
- * same applies to all internal top edges. */
- else if (mb->mbType == P_L0_L0_8x16)
- {
- bS[4].top = mb->totalCoeff[2] || mb->totalCoeff[0] ? 2 : 0;
- bS[5].top = mb->totalCoeff[3] || mb->totalCoeff[1] ? 2 : 0;
- bS[6].top = mb->totalCoeff[6] || mb->totalCoeff[4] ? 2 : 0;
- bS[7].top = mb->totalCoeff[7] || mb->totalCoeff[5] ? 2 : 0;
- bS[8].top = mb->totalCoeff[8] || mb->totalCoeff[2] ? 2 : 0;
- bS[9].top = mb->totalCoeff[9] || mb->totalCoeff[3] ? 2 : 0;
- bS[10].top = mb->totalCoeff[12] || mb->totalCoeff[6] ? 2 : 0;
- bS[11].top = mb->totalCoeff[13] || mb->totalCoeff[7] ? 2 : 0;
- bS[12].top = mb->totalCoeff[10] || mb->totalCoeff[8] ? 2 : 0;
- bS[13].top = mb->totalCoeff[11] || mb->totalCoeff[9] ? 2 : 0;
- bS[14].top = mb->totalCoeff[14] || mb->totalCoeff[12] ? 2 : 0;
- bS[15].top = mb->totalCoeff[15] || mb->totalCoeff[13] ? 2 : 0;
-
- bS[1].left = mb->totalCoeff[1] || mb->totalCoeff[0] ? 2 : 0;
- bS[3].left = mb->totalCoeff[5] || mb->totalCoeff[4] ? 2 : 0;
- bS[5].left = mb->totalCoeff[3] || mb->totalCoeff[2] ? 2 : 0;
- bS[7].left = mb->totalCoeff[7] || mb->totalCoeff[6] ? 2 : 0;
- bS[9].left = mb->totalCoeff[9] || mb->totalCoeff[8] ? 2 : 0;
- bS[11].left = mb->totalCoeff[13] || mb->totalCoeff[12] ? 2 : 0;
- bS[13].left = mb->totalCoeff[11] || mb->totalCoeff[10] ? 2 : 0;
- bS[15].left = mb->totalCoeff[15] || mb->totalCoeff[14] ? 2 : 0;
- bS[2].left = InnerBoundaryStrength(mb, 4, 1);
- bS[6].left = InnerBoundaryStrength(mb, 6, 3);
- bS[10].left = InnerBoundaryStrength(mb, 12, 9);
- bS[14].left = InnerBoundaryStrength(mb, 14, 11);
- }
- else
- {
- bS[4].top =
- InnerBoundaryStrength(mb, mb4x4Index[4], mb4x4Index[0]);
- bS[5].top =
- InnerBoundaryStrength(mb, mb4x4Index[5], mb4x4Index[1]);
- bS[6].top =
- InnerBoundaryStrength(mb, mb4x4Index[6], mb4x4Index[2]);
- bS[7].top =
- InnerBoundaryStrength(mb, mb4x4Index[7], mb4x4Index[3]);
- bS[8].top =
- InnerBoundaryStrength(mb, mb4x4Index[8], mb4x4Index[4]);
- bS[9].top =
- InnerBoundaryStrength(mb, mb4x4Index[9], mb4x4Index[5]);
- bS[10].top =
- InnerBoundaryStrength(mb, mb4x4Index[10], mb4x4Index[6]);
- bS[11].top =
- InnerBoundaryStrength(mb, mb4x4Index[11], mb4x4Index[7]);
- bS[12].top =
- InnerBoundaryStrength(mb, mb4x4Index[12], mb4x4Index[8]);
- bS[13].top =
- InnerBoundaryStrength(mb, mb4x4Index[13], mb4x4Index[9]);
- bS[14].top =
- InnerBoundaryStrength(mb, mb4x4Index[14], mb4x4Index[10]);
- bS[15].top =
- InnerBoundaryStrength(mb, mb4x4Index[15], mb4x4Index[11]);
-
- bS[1].left =
- InnerBoundaryStrength(mb, mb4x4Index[1], mb4x4Index[0]);
- bS[2].left =
- InnerBoundaryStrength(mb, mb4x4Index[2], mb4x4Index[1]);
- bS[3].left =
- InnerBoundaryStrength(mb, mb4x4Index[3], mb4x4Index[2]);
- bS[5].left =
- InnerBoundaryStrength(mb, mb4x4Index[5], mb4x4Index[4]);
- bS[6].left =
- InnerBoundaryStrength(mb, mb4x4Index[6], mb4x4Index[5]);
- bS[7].left =
- InnerBoundaryStrength(mb, mb4x4Index[7], mb4x4Index[6]);
- bS[9].left =
- InnerBoundaryStrength(mb, mb4x4Index[9], mb4x4Index[8]);
- bS[10].left =
- InnerBoundaryStrength(mb, mb4x4Index[10], mb4x4Index[9]);
- bS[11].left =
- InnerBoundaryStrength(mb, mb4x4Index[11], mb4x4Index[10]);
- bS[13].left =
- InnerBoundaryStrength(mb, mb4x4Index[13], mb4x4Index[12]);
- bS[14].left =
- InnerBoundaryStrength(mb, mb4x4Index[14], mb4x4Index[13]);
- bS[15].left =
- InnerBoundaryStrength(mb, mb4x4Index[15], mb4x4Index[14]);
- }
- if (!nonZeroBs &&
- (bS[4].top || bS[5].top || bS[6].top || bS[7].top ||
- bS[8].top || bS[9].top || bS[10].top || bS[11].top ||
- bS[12].top || bS[13].top || bS[14].top || bS[15].top ||
- bS[1].left || bS[2].left || bS[3].left ||
- bS[5].left || bS[6].left || bS[7].left ||
- bS[9].left || bS[10].left || bS[11].left ||
- bS[13].left || bS[14].left || bS[15].left))
- nonZeroBs = HANTRO_TRUE;
- }
-
- return(nonZeroBs);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: GetLumaEdgeThresholds
-
- Functional description:
- Compute alpha, beta and tc0 thresholds for inner, left and top
- luma edges of a macroblock.
-
-------------------------------------------------------------------------------*/
-void GetLumaEdgeThresholds(
- edgeThreshold_t *thresholds,
- mbStorage_t *mb,
- u32 filteringFlags)
-{
-
-/* Variables */
-
- u32 indexA, indexB;
- u32 qpAv, qp, qpTmp;
-
-/* Code */
-
- ASSERT(thresholds);
- ASSERT(mb);
-
- qp = mb->qpY;
-
- indexA = (u32)CLIP3(0, 51, (i32)qp + mb->filterOffsetA);
- indexB = (u32)CLIP3(0, 51, (i32)qp + mb->filterOffsetB);
-
- thresholds[INNER].alpha = alphas[indexA];
- thresholds[INNER].beta = betas[indexB];
- thresholds[INNER].tc0 = tc0[indexA];
-
- if (filteringFlags & FILTER_TOP_EDGE)
- {
- qpTmp = mb->mbB->qpY;
- if (qpTmp != qp)
- {
- qpAv = (qp + qpTmp + 1) >> 1;
-
- indexA = (u32)CLIP3(0, 51, (i32)qpAv + mb->filterOffsetA);
- indexB = (u32)CLIP3(0, 51, (i32)qpAv + mb->filterOffsetB);
-
- thresholds[TOP].alpha = alphas[indexA];
- thresholds[TOP].beta = betas[indexB];
- thresholds[TOP].tc0 = tc0[indexA];
- }
- else
- {
- thresholds[TOP].alpha = thresholds[INNER].alpha;
- thresholds[TOP].beta = thresholds[INNER].beta;
- thresholds[TOP].tc0 = thresholds[INNER].tc0;
- }
- }
- if (filteringFlags & FILTER_LEFT_EDGE)
- {
- qpTmp = mb->mbA->qpY;
- if (qpTmp != qp)
- {
- qpAv = (qp + qpTmp + 1) >> 1;
-
- indexA = (u32)CLIP3(0, 51, (i32)qpAv + mb->filterOffsetA);
- indexB = (u32)CLIP3(0, 51, (i32)qpAv + mb->filterOffsetB);
-
- thresholds[LEFT].alpha = alphas[indexA];
- thresholds[LEFT].beta = betas[indexB];
- thresholds[LEFT].tc0 = tc0[indexA];
- }
- else
- {
- thresholds[LEFT].alpha = thresholds[INNER].alpha;
- thresholds[LEFT].beta = thresholds[INNER].beta;
- thresholds[LEFT].tc0 = thresholds[INNER].tc0;
- }
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: GetChromaEdgeThresholds
-
- Functional description:
- Compute alpha, beta and tc0 thresholds for inner, left and top
- chroma edges of a macroblock.
-
-------------------------------------------------------------------------------*/
-void GetChromaEdgeThresholds(
- edgeThreshold_t *thresholds,
- mbStorage_t *mb,
- u32 filteringFlags,
- i32 chromaQpIndexOffset)
-{
-
-/* Variables */
-
- u32 indexA, indexB;
- u32 qpAv, qp, qpTmp;
-
-/* Code */
-
- ASSERT(thresholds);
- ASSERT(mb);
-
- qp = mb->qpY;
- qp = h264bsdQpC[CLIP3(0, 51, (i32)qp + chromaQpIndexOffset)];
-
- indexA = (u32)CLIP3(0, 51, (i32)qp + mb->filterOffsetA);
- indexB = (u32)CLIP3(0, 51, (i32)qp + mb->filterOffsetB);
-
- thresholds[INNER].alpha = alphas[indexA];
- thresholds[INNER].beta = betas[indexB];
- thresholds[INNER].tc0 = tc0[indexA];
-
- if (filteringFlags & FILTER_TOP_EDGE)
- {
- qpTmp = mb->mbB->qpY;
- if (qpTmp != mb->qpY)
- {
- qpTmp = h264bsdQpC[CLIP3(0, 51, (i32)qpTmp + chromaQpIndexOffset)];
- qpAv = (qp + qpTmp + 1) >> 1;
-
- indexA = (u32)CLIP3(0, 51, (i32)qpAv + mb->filterOffsetA);
- indexB = (u32)CLIP3(0, 51, (i32)qpAv + mb->filterOffsetB);
-
- thresholds[TOP].alpha = alphas[indexA];
- thresholds[TOP].beta = betas[indexB];
- thresholds[TOP].tc0 = tc0[indexA];
- }
- else
- {
- thresholds[TOP].alpha = thresholds[INNER].alpha;
- thresholds[TOP].beta = thresholds[INNER].beta;
- thresholds[TOP].tc0 = thresholds[INNER].tc0;
- }
- }
- if (filteringFlags & FILTER_LEFT_EDGE)
- {
- qpTmp = mb->mbA->qpY;
- if (qpTmp != mb->qpY)
- {
- qpTmp = h264bsdQpC[CLIP3(0, 51, (i32)qpTmp + chromaQpIndexOffset)];
- qpAv = (qp + qpTmp + 1) >> 1;
-
- indexA = (u32)CLIP3(0, 51, (i32)qpAv + mb->filterOffsetA);
- indexB = (u32)CLIP3(0, 51, (i32)qpAv + mb->filterOffsetB);
-
- thresholds[LEFT].alpha = alphas[indexA];
- thresholds[LEFT].beta = betas[indexB];
- thresholds[LEFT].tc0 = tc0[indexA];
- }
- else
- {
- thresholds[LEFT].alpha = thresholds[INNER].alpha;
- thresholds[LEFT].beta = thresholds[INNER].beta;
- thresholds[LEFT].tc0 = thresholds[INNER].tc0;
- }
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: FilterLuma
-
- Functional description:
- Function to filter all luma edges of a macroblock
-
-------------------------------------------------------------------------------*/
-void FilterLuma(
- u8 *data,
- bS_t *bS,
- edgeThreshold_t *thresholds,
- u32 width)
-{
-
-/* Variables */
-
- u32 vblock;
- bS_t *tmp;
- u8 *ptr;
- u32 offset;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(bS);
- ASSERT(thresholds);
-
- ptr = data;
- tmp = bS;
-
- offset = TOP;
-
- /* loop block rows, perform filtering for all vertical edges of the block
- * row first, then filter each horizontal edge of the row */
- for (vblock = 4; vblock--;)
- {
- /* only perform filtering if bS is non-zero, first of the four
- * FilterVerLumaEdge handles the left edge of the macroblock, others
- * filter inner edges */
- if (tmp[0].left)
- FilterVerLumaEdge(ptr, tmp[0].left, thresholds + LEFT, width);
- if (tmp[1].left)
- FilterVerLumaEdge(ptr+4, tmp[1].left, thresholds + INNER, width);
- if (tmp[2].left)
- FilterVerLumaEdge(ptr+8, tmp[2].left, thresholds + INNER, width);
- if (tmp[3].left)
- FilterVerLumaEdge(ptr+12, tmp[3].left, thresholds + INNER, width);
-
- /* if bS is equal for all horizontal edges of the row -> perform
- * filtering with FilterHorLuma, otherwise use FilterHorLumaEdge for
- * each edge separately. offset variable indicates top macroblock edge
- * on the first loop round, inner edge for the other rounds */
- if (tmp[0].top == tmp[1].top && tmp[1].top == tmp[2].top &&
- tmp[2].top == tmp[3].top)
- {
- if(tmp[0].top)
- FilterHorLuma(ptr, tmp[0].top, thresholds + offset, (i32)width);
- }
- else
- {
- if(tmp[0].top)
- FilterHorLumaEdge(ptr, tmp[0].top, thresholds+offset,
- (i32)width);
- if(tmp[1].top)
- FilterHorLumaEdge(ptr+4, tmp[1].top, thresholds+offset,
- (i32)width);
- if(tmp[2].top)
- FilterHorLumaEdge(ptr+8, tmp[2].top, thresholds+offset,
- (i32)width);
- if(tmp[3].top)
- FilterHorLumaEdge(ptr+12, tmp[3].top, thresholds+offset,
- (i32)width);
- }
-
- /* four pixel rows ahead, i.e. next row of 4x4-blocks */
- ptr += width*4;
- tmp += 4;
- offset = INNER;
- }
-}
-
-/*------------------------------------------------------------------------------
-
- Function: FilterChroma
-
- Functional description:
- Function to filter all chroma edges of a macroblock
-
-------------------------------------------------------------------------------*/
-void FilterChroma(
- u8 *dataCb,
- u8 *dataCr,
- bS_t *bS,
- edgeThreshold_t *thresholds,
- u32 width)
-{
-
-/* Variables */
-
- u32 vblock;
- bS_t *tmp;
- u32 offset;
-
-/* Code */
-
- ASSERT(dataCb);
- ASSERT(dataCr);
- ASSERT(bS);
- ASSERT(thresholds);
-
- tmp = bS;
- offset = TOP;
-
- /* loop block rows, perform filtering for all vertical edges of the block
- * row first, then filter each horizontal edge of the row */
- for (vblock = 0; vblock < 2; vblock++)
- {
- /* only perform filtering if bS is non-zero, first two of the four
- * FilterVerChromaEdge calls handle the left edge of the macroblock,
- * others filter the inner edge. Note that as chroma uses bS values
- * determined for luma edges, each bS is used only for 2 pixels of
- * a 4-pixel edge */
- if (tmp[0].left)
- {
- FilterVerChromaEdge(dataCb, tmp[0].left, thresholds + LEFT, width);
- FilterVerChromaEdge(dataCr, tmp[0].left, thresholds + LEFT, width);
- }
- if (tmp[4].left)
- {
- FilterVerChromaEdge(dataCb+2*width, tmp[4].left, thresholds + LEFT,
- width);
- FilterVerChromaEdge(dataCr+2*width, tmp[4].left, thresholds + LEFT,
- width);
- }
- if (tmp[2].left)
- {
- FilterVerChromaEdge(dataCb+4, tmp[2].left, thresholds + INNER,
- width);
- FilterVerChromaEdge(dataCr+4, tmp[2].left, thresholds + INNER,
- width);
- }
- if (tmp[6].left)
- {
- FilterVerChromaEdge(dataCb+2*width+4, tmp[6].left,
- thresholds + INNER, width);
- FilterVerChromaEdge(dataCr+2*width+4, tmp[6].left,
- thresholds + INNER, width);
- }
-
- /* if bS is equal for all horizontal edges of the row -> perform
- * filtering with FilterHorChroma, otherwise use FilterHorChromaEdge
- * for each edge separately. offset variable indicates top macroblock
- * edge on the first loop round, inner edge for the second */
- if (tmp[0].top == tmp[1].top && tmp[1].top == tmp[2].top &&
- tmp[2].top == tmp[3].top)
- {
- if(tmp[0].top)
- {
- FilterHorChroma(dataCb, tmp[0].top, thresholds+offset,
- (i32)width);
- FilterHorChroma(dataCr, tmp[0].top, thresholds+offset,
- (i32)width);
- }
- }
- else
- {
- if (tmp[0].top)
- {
- FilterHorChromaEdge(dataCb, tmp[0].top, thresholds+offset,
- (i32)width);
- FilterHorChromaEdge(dataCr, tmp[0].top, thresholds+offset,
- (i32)width);
- }
- if (tmp[1].top)
- {
- FilterHorChromaEdge(dataCb+2, tmp[1].top, thresholds+offset,
- (i32)width);
- FilterHorChromaEdge(dataCr+2, tmp[1].top, thresholds+offset,
- (i32)width);
- }
- if (tmp[2].top)
- {
- FilterHorChromaEdge(dataCb+4, tmp[2].top, thresholds+offset,
- (i32)width);
- FilterHorChromaEdge(dataCr+4, tmp[2].top, thresholds+offset,
- (i32)width);
- }
- if (tmp[3].top)
- {
- FilterHorChromaEdge(dataCb+6, tmp[3].top, thresholds+offset,
- (i32)width);
- FilterHorChromaEdge(dataCr+6, tmp[3].top, thresholds+offset,
- (i32)width);
- }
- }
-
- tmp += 8;
- dataCb += width*4;
- dataCr += width*4;
- offset = INNER;
- }
-}
-
-#else /* H264DEC_OMXDL */
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdFilterPicture
-
- Functional description:
- Perform deblocking filtering for a picture. Filter does not copy
- the original picture anywhere but filtering is performed directly
- on the original image. Parameters controlling the filtering process
- are computed based on information in macroblock structures of the
- filtered macroblock, macroblock above and macroblock on the left of
- the filtered one.
-
- Inputs:
- image pointer to image to be filtered
- mb pointer to macroblock data structure of the top-left
- macroblock of the picture
-
- Outputs:
- image filtered image stored here
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-
-/*lint --e{550} Symbol not accessed */
-void h264bsdFilterPicture(
- image_t *image,
- mbStorage_t *mb)
-{
-
-/* Variables */
-
- u32 flags;
- u32 picSizeInMbs, mbRow, mbCol;
- u32 picWidthInMbs;
- u8 *data;
- mbStorage_t *pMb;
- u8 bS[2][16];
- u8 thresholdLuma[2][16];
- u8 thresholdChroma[2][8];
- u8 alpha[2][2];
- u8 beta[2][2];
- OMXResult res;
-
-/* Code */
-
- ASSERT(image);
- ASSERT(mb);
- ASSERT(image->data);
- ASSERT(image->width);
- ASSERT(image->height);
-
- picWidthInMbs = image->width;
- data = image->data;
- picSizeInMbs = picWidthInMbs * image->height;
-
- pMb = mb;
-
- for (mbRow = 0, mbCol = 0; mbRow < image->height; pMb++)
- {
- flags = GetMbFilteringFlags(pMb);
-
- if (flags)
- {
- /* GetBoundaryStrengths function returns non-zero value if any of
- * the bS values for the macroblock being processed was non-zero */
- if (GetBoundaryStrengths(pMb, bS, flags))
- {
-
- /* Luma */
- GetLumaEdgeThresholds(pMb,alpha,beta,thresholdLuma,bS,flags);
- data = image->data + mbRow * picWidthInMbs * 256 + mbCol * 16;
-
- res = omxVCM4P10_FilterDeblockingLuma_VerEdge_I( data,
- (OMX_S32)(picWidthInMbs*16),
- (const OMX_U8*)alpha,
- (const OMX_U8*)beta,
- (const OMX_U8*)thresholdLuma,
- (const OMX_U8*)bS );
-
- res = omxVCM4P10_FilterDeblockingLuma_HorEdge_I( data,
- (OMX_S32)(picWidthInMbs*16),
- (const OMX_U8*)alpha+2,
- (const OMX_U8*)beta+2,
- (const OMX_U8*)thresholdLuma+16,
- (const OMX_U8*)bS+16 );
- /* Cb */
- GetChromaEdgeThresholds(pMb, alpha, beta, thresholdChroma,
- bS, flags, pMb->chromaQpIndexOffset);
- data = image->data + picSizeInMbs * 256 +
- mbRow * picWidthInMbs * 64 + mbCol * 8;
-
- res = omxVCM4P10_FilterDeblockingChroma_VerEdge_I( data,
- (OMX_S32)(picWidthInMbs*8),
- (const OMX_U8*)alpha,
- (const OMX_U8*)beta,
- (const OMX_U8*)thresholdChroma,
- (const OMX_U8*)bS );
- res = omxVCM4P10_FilterDeblockingChroma_HorEdge_I( data,
- (OMX_S32)(picWidthInMbs*8),
- (const OMX_U8*)alpha+2,
- (const OMX_U8*)beta+2,
- (const OMX_U8*)thresholdChroma+8,
- (const OMX_U8*)bS+16 );
- /* Cr */
- data += (picSizeInMbs * 64);
- res = omxVCM4P10_FilterDeblockingChroma_VerEdge_I( data,
- (OMX_S32)(picWidthInMbs*8),
- (const OMX_U8*)alpha,
- (const OMX_U8*)beta,
- (const OMX_U8*)thresholdChroma,
- (const OMX_U8*)bS );
- res = omxVCM4P10_FilterDeblockingChroma_HorEdge_I( data,
- (OMX_S32)(picWidthInMbs*8),
- (const OMX_U8*)alpha+2,
- (const OMX_U8*)beta+2,
- (const OMX_U8*)thresholdChroma+8,
- (const OMX_U8*)bS+16 );
- }
- }
-
- mbCol++;
- if (mbCol == picWidthInMbs)
- {
- mbCol = 0;
- mbRow++;
- }
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: GetBoundaryStrengths
-
- Functional description:
- Function to calculate boundary strengths for all edges of a
- macroblock. Function returns HANTRO_TRUE if any of the bS values for
- the macroblock had non-zero value, HANTRO_FALSE otherwise.
-
-------------------------------------------------------------------------------*/
-u32 GetBoundaryStrengths(mbStorage_t *mb, u8 (*bS)[16], u32 flags)
-{
-
-/* Variables */
-
- /* this flag is set HANTRO_TRUE as soon as any boundary strength value is
- * non-zero */
- u32 nonZeroBs = HANTRO_FALSE;
- u32 *pTmp;
- u32 tmp1, tmp2, isIntraMb;
-
-/* Code */
-
- ASSERT(mb);
- ASSERT(bS);
- ASSERT(flags);
-
- isIntraMb = IS_INTRA_MB(*mb);
-
- /* top edges */
- pTmp = (u32*)&bS[1][0];
- if (flags & FILTER_TOP_EDGE)
- {
- if (isIntraMb || IS_INTRA_MB(*mb->mbB))
- {
- *pTmp = 0x04040404;
- nonZeroBs = HANTRO_TRUE;
- }
- else
- {
- *pTmp = EdgeBoundaryStrengthTop(mb, mb->mbB);
- if (*pTmp)
- nonZeroBs = HANTRO_TRUE;
- }
- }
- else
- {
- *pTmp = 0;
- }
-
- /* left edges */
- pTmp = (u32*)&bS[0][0];
- if (flags & FILTER_LEFT_EDGE)
- {
- if (isIntraMb || IS_INTRA_MB(*mb->mbA))
- {
- /*bS[0][0] = bS[0][1] = bS[0][2] = bS[0][3] = 4;*/
- *pTmp = 0x04040404;
- nonZeroBs = HANTRO_TRUE;
- }
- else
- {
- *pTmp = EdgeBoundaryStrengthLeft(mb, mb->mbA);
- if (!nonZeroBs && *pTmp)
- nonZeroBs = HANTRO_TRUE;
- }
- }
- else
- {
- *pTmp = 0;
- }
-
- /* inner edges */
- if (isIntraMb)
- {
- pTmp++;
- *pTmp++ = 0x03030303;
- *pTmp++ = 0x03030303;
- *pTmp++ = 0x03030303;
- pTmp++;
- *pTmp++ = 0x03030303;
- *pTmp++ = 0x03030303;
- *pTmp = 0x03030303;
-
- nonZeroBs = HANTRO_TRUE;
- }
- else
- {
- pTmp = (u32*)mb->totalCoeff;
-
- /* 16x16 inter mb -> ref addresses or motion vectors cannot differ,
- * only check if either of the blocks contain coefficients */
- if (h264bsdNumMbPart(mb->mbType) == 1)
- {
- tmp1 = *pTmp++;
- tmp2 = *pTmp++;
- bS[1][4] = (tmp1 & 0x00FF00FF) ? 2 : 0; /* [2] || [0] */
- bS[1][5] = (tmp1 & 0xFF00FF00) ? 2 : 0; /* [3] || [1] */
- bS[0][4] = (tmp1 & 0x0000FFFF) ? 2 : 0; /* [1] || [0] */
- bS[0][5] = (tmp1 & 0xFFFF0000) ? 2 : 0; /* [3] || [2] */
-
- tmp1 = *pTmp++;
- bS[1][6] = (tmp2 & 0x00FF00FF) ? 2 : 0; /* [6] || [4] */
- bS[1][7] = (tmp2 & 0xFF00FF00) ? 2 : 0; /* [7] || [5] */
- bS[0][12] = (tmp2 & 0x0000FFFF) ? 2 : 0; /* [5] || [4] */
- bS[0][13] = (tmp2 & 0xFFFF0000) ? 2 : 0; /* [7] || [6] */
- tmp2 = *pTmp;
- bS[1][12] = (tmp1 & 0x00FF00FF) ? 2 : 0; /* [10] || [8] */
- bS[1][13] = (tmp1 & 0xFF00FF00) ? 2 : 0; /* [11] || [9] */
- bS[0][6] = (tmp1 & 0x0000FFFF) ? 2 : 0; /* [9] || [8] */
- bS[0][7] = (tmp1 & 0xFFFF0000) ? 2 : 0; /* [11] || [10] */
-
- bS[1][14] = (tmp2 & 0x00FF00FF) ? 2 : 0; /* [14] || [12] */
- bS[1][15] = (tmp2 & 0xFF00FF00) ? 2 : 0; /* [15] || [13] */
- bS[0][14] = (tmp2 & 0x0000FFFF) ? 2 : 0; /* [13] || [12] */
- bS[0][15] = (tmp2 & 0xFFFF0000) ? 2 : 0; /* [15] || [14] */
-
- {
- u32 tmp3, tmp4;
-
- tmp1 = mb->totalCoeff[8];
- tmp2 = mb->totalCoeff[2];
- tmp3 = mb->totalCoeff[9];
- tmp4 = mb->totalCoeff[3];
-
- bS[1][8] = tmp1 || tmp2 ? 2 : 0;
- tmp1 = mb->totalCoeff[12];
- tmp2 = mb->totalCoeff[6];
- bS[1][9] = tmp3 || tmp4 ? 2 : 0;
- tmp3 = mb->totalCoeff[13];
- tmp4 = mb->totalCoeff[7];
- bS[1][10] = tmp1 || tmp2 ? 2 : 0;
- tmp1 = mb->totalCoeff[4];
- tmp2 = mb->totalCoeff[1];
- bS[1][11] = tmp3 || tmp4 ? 2 : 0;
- tmp3 = mb->totalCoeff[6];
- tmp4 = mb->totalCoeff[3];
- bS[0][8] = tmp1 || tmp2 ? 2 : 0;
- tmp1 = mb->totalCoeff[12];
- tmp2 = mb->totalCoeff[9];
- bS[0][9] = tmp3 || tmp4 ? 2 : 0;
- tmp3 = mb->totalCoeff[14];
- tmp4 = mb->totalCoeff[11];
- bS[0][10] = tmp1 || tmp2 ? 2 : 0;
- bS[0][11] = tmp3 || tmp4 ? 2 : 0;
- }
- }
-
- /* 16x8 inter mb -> ref addresses and motion vectors can be different
- * only for the middle horizontal edge, for the other top edges it is
- * enough to check whether the blocks contain coefficients or not. The
- * same applies to all internal left edges. */
- else if (mb->mbType == P_L0_L0_16x8)
- {
- tmp1 = *pTmp++;
- tmp2 = *pTmp++;
- bS[1][4] = (tmp1 & 0x00FF00FF) ? 2 : 0; /* [2] || [0] */
- bS[1][5] = (tmp1 & 0xFF00FF00) ? 2 : 0; /* [3] || [1] */
- bS[0][4] = (tmp1 & 0x0000FFFF) ? 2 : 0; /* [1] || [0] */
- bS[0][5] = (tmp1 & 0xFFFF0000) ? 2 : 0; /* [3] || [2] */
- tmp1 = *pTmp++;
- bS[1][6] = (tmp2 & 0x00FF00FF) ? 2 : 0; /* [6] || [4] */
- bS[1][7] = (tmp2 & 0xFF00FF00) ? 2 : 0; /* [7] || [5] */
- bS[0][12] = (tmp2 & 0x0000FFFF) ? 2 : 0; /* [5] || [4] */
- bS[0][13] = (tmp2 & 0xFFFF0000) ? 2 : 0; /* [7] || [6] */
- tmp2 = *pTmp;
- bS[1][12] = (tmp1 & 0x00FF00FF) ? 2 : 0; /* [10] || [8] */
- bS[1][13] = (tmp1 & 0xFF00FF00) ? 2 : 0; /* [11] || [9] */
- bS[0][6] = (tmp1 & 0x0000FFFF) ? 2 : 0; /* [9] || [8] */
- bS[0][7] = (tmp1 & 0xFFFF0000) ? 2 : 0; /* [11] || [10] */
-
- bS[1][14] = (tmp2 & 0x00FF00FF) ? 2 : 0; /* [14] || [12] */
- bS[1][15] = (tmp2 & 0xFF00FF00) ? 2 : 0; /* [15] || [13] */
- bS[0][14] = (tmp2 & 0x0000FFFF) ? 2 : 0; /* [13] || [12] */
- bS[0][15] = (tmp2 & 0xFFFF0000) ? 2 : 0; /* [15] || [14] */
-
- bS[1][8] = (u8)InnerBoundaryStrength(mb, 8, 2);
- bS[1][9] = (u8)InnerBoundaryStrength(mb, 9, 3);
- bS[1][10] = (u8)InnerBoundaryStrength(mb, 12, 6);
- bS[1][11] = (u8)InnerBoundaryStrength(mb, 13, 7);
-
- {
- u32 tmp3, tmp4;
-
- tmp1 = mb->totalCoeff[4];
- tmp2 = mb->totalCoeff[1];
- tmp3 = mb->totalCoeff[6];
- tmp4 = mb->totalCoeff[3];
- bS[0][8] = tmp1 || tmp2 ? 2 : 0;
- tmp1 = mb->totalCoeff[12];
- tmp2 = mb->totalCoeff[9];
- bS[0][9] = tmp3 || tmp4 ? 2 : 0;
- tmp3 = mb->totalCoeff[14];
- tmp4 = mb->totalCoeff[11];
- bS[0][10] = tmp1 || tmp2 ? 2 : 0;
- bS[0][11] = tmp3 || tmp4 ? 2 : 0;
- }
- }
- /* 8x16 inter mb -> ref addresses and motion vectors can be different
- * only for the middle vertical edge, for the other left edges it is
- * enough to check whether the blocks contain coefficients or not. The
- * same applies to all internal top edges. */
- else if (mb->mbType == P_L0_L0_8x16)
- {
- tmp1 = *pTmp++;
- tmp2 = *pTmp++;
- bS[1][4] = (tmp1 & 0x00FF00FF) ? 2 : 0; /* [2] || [0] */
- bS[1][5] = (tmp1 & 0xFF00FF00) ? 2 : 0; /* [3] || [1] */
- bS[0][4] = (tmp1 & 0x0000FFFF) ? 2 : 0; /* [1] || [0] */
- bS[0][5] = (tmp1 & 0xFFFF0000) ? 2 : 0; /* [3] || [2] */
- tmp1 = *pTmp++;
- bS[1][6] = (tmp2 & 0x00FF00FF) ? 2 : 0; /* [6] || [4] */
- bS[1][7] = (tmp2 & 0xFF00FF00) ? 2 : 0; /* [7] || [5] */
- bS[0][12] = (tmp2 & 0x0000FFFF) ? 2 : 0; /* [5] || [4] */
- bS[0][13] = (tmp2 & 0xFFFF0000) ? 2 : 0; /* [7] || [6] */
- tmp2 = *pTmp;
- bS[1][12] = (tmp1 & 0x00FF00FF) ? 2 : 0; /* [10] || [8] */
- bS[1][13] = (tmp1 & 0xFF00FF00) ? 2 : 0; /* [11] || [9] */
- bS[0][6] = (tmp1 & 0x0000FFFF) ? 2 : 0; /* [9] || [8] */
- bS[0][7] = (tmp1 & 0xFFFF0000) ? 2 : 0; /* [11] || [10] */
-
- bS[1][14] = (tmp2 & 0x00FF00FF) ? 2 : 0; /* [14] || [12] */
- bS[1][15] = (tmp2 & 0xFF00FF00) ? 2 : 0; /* [15] || [13] */
- bS[0][14] = (tmp2 & 0x0000FFFF) ? 2 : 0; /* [13] || [12] */
- bS[0][15] = (tmp2 & 0xFFFF0000) ? 2 : 0; /* [15] || [14] */
-
- bS[0][8] = (u8)InnerBoundaryStrength(mb, 4, 1);
- bS[0][9] = (u8)InnerBoundaryStrength(mb, 6, 3);
- bS[0][10] = (u8)InnerBoundaryStrength(mb, 12, 9);
- bS[0][11] = (u8)InnerBoundaryStrength(mb, 14, 11);
-
- {
- u32 tmp3, tmp4;
-
- tmp1 = mb->totalCoeff[8];
- tmp2 = mb->totalCoeff[2];
- tmp3 = mb->totalCoeff[9];
- tmp4 = mb->totalCoeff[3];
- bS[1][8] = tmp1 || tmp2 ? 2 : 0;
- tmp1 = mb->totalCoeff[12];
- tmp2 = mb->totalCoeff[6];
- bS[1][9] = tmp3 || tmp4 ? 2 : 0;
- tmp3 = mb->totalCoeff[13];
- tmp4 = mb->totalCoeff[7];
- bS[1][10] = tmp1 || tmp2 ? 2 : 0;
- bS[1][11] = tmp3 || tmp4 ? 2 : 0;
- }
- }
- else
- {
- tmp1 = *pTmp++;
- bS[1][4] = (tmp1 & 0x00FF00FF) ? 2 : (u8)InnerBoundaryStrength2(mb, 2, 0);
- bS[1][5] = (tmp1 & 0xFF00FF00) ? 2 : (u8)InnerBoundaryStrength2(mb, 3, 1);
- bS[0][4] = (tmp1 & 0x0000FFFF) ? 2 : (u8)InnerBoundaryStrength2(mb, 1, 0);
- bS[0][5] = (tmp1 & 0xFFFF0000) ? 2 : (u8)InnerBoundaryStrength2(mb, 3, 2);
- tmp1 = *pTmp++;
- bS[1][6] = (tmp1 & 0x00FF00FF) ? 2 : (u8)InnerBoundaryStrength2(mb, 6, 4);
- bS[1][7] = (tmp1 & 0xFF00FF00) ? 2 : (u8)InnerBoundaryStrength2(mb, 7, 5);
- bS[0][12] = (tmp1 & 0x0000FFFF) ? 2 : (u8)InnerBoundaryStrength2(mb, 5, 4);
- bS[0][13] = (tmp1 & 0xFFFF0000) ? 2 : (u8)InnerBoundaryStrength2(mb, 7, 6);
- tmp1 = *pTmp++;
- bS[1][12] = (tmp1 & 0x00FF00FF) ? 2 : (u8)InnerBoundaryStrength2(mb, 10, 8);
- bS[1][13] = (tmp1 & 0xFF00FF00) ? 2 : (u8)InnerBoundaryStrength2(mb, 11, 9);
- bS[0][6] = (tmp1 & 0x0000FFFF) ? 2 : (u8)InnerBoundaryStrength2(mb, 9, 8);
- bS[0][7] = (tmp1 & 0xFFFF0000) ? 2 : (u8)InnerBoundaryStrength2(mb, 11, 10);
- tmp1 = *pTmp;
- bS[1][14] = (tmp1 & 0x00FF00FF) ? 2 : (u8)InnerBoundaryStrength2(mb, 14, 12);
- bS[1][15] = (tmp1 & 0xFF00FF00) ? 2 : (u8)InnerBoundaryStrength2(mb, 15, 13);
- bS[0][14] = (tmp1 & 0x0000FFFF) ? 2 : (u8)InnerBoundaryStrength2(mb, 13, 12);
- bS[0][15] = (tmp1 & 0xFFFF0000) ? 2 : (u8)InnerBoundaryStrength2(mb, 15, 14);
-
- bS[1][8] = (u8)InnerBoundaryStrength(mb, 8, 2);
- bS[1][9] = (u8)InnerBoundaryStrength(mb, 9, 3);
- bS[1][10] = (u8)InnerBoundaryStrength(mb, 12, 6);
- bS[1][11] = (u8)InnerBoundaryStrength(mb, 13, 7);
-
- bS[0][8] = (u8)InnerBoundaryStrength(mb, 4, 1);
- bS[0][9] = (u8)InnerBoundaryStrength(mb, 6, 3);
- bS[0][10] = (u8)InnerBoundaryStrength(mb, 12, 9);
- bS[0][11] = (u8)InnerBoundaryStrength(mb, 14, 11);
- }
- pTmp = (u32*)&bS[0][0];
- if (!nonZeroBs && (pTmp[1] || pTmp[2] || pTmp[3] ||
- pTmp[5] || pTmp[6] || pTmp[7]) )
- {
- nonZeroBs = HANTRO_TRUE;
- }
- }
-
- return(nonZeroBs);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: GetLumaEdgeThresholds
-
- Functional description:
- Compute alpha, beta and tc0 thresholds for inner, left and top
- luma edges of a macroblock.
-
-------------------------------------------------------------------------------*/
-void GetLumaEdgeThresholds(
- mbStorage_t *mb,
- u8 (*alpha)[2],
- u8 (*beta)[2],
- u8 (*threshold)[16],
- u8 (*bs)[16],
- u32 filteringFlags )
-{
-
-/* Variables */
-
- u32 indexA, indexB;
- u32 qpAv, qp, qpTmp;
- u32 i;
-
-/* Code */
-
- ASSERT(threshold);
- ASSERT(bs);
- ASSERT(beta);
- ASSERT(alpha);
- ASSERT(mb);
-
- qp = mb->qpY;
-
- indexA = (u32)CLIP3(0, 51, (i32)qp + mb->filterOffsetA);
- indexB = (u32)CLIP3(0, 51, (i32)qp + mb->filterOffsetB);
-
- /* Internal edge values */
- alpha[0][1] = alphas[indexA];
- alpha[1][1] = alphas[indexA];
- alpha[1][0] = alphas[indexA];
- alpha[0][0] = alphas[indexA];
- beta[0][1] = betas[indexB];
- beta[1][1] = betas[indexB];
- beta[1][0] = betas[indexB];
- beta[0][0] = betas[indexB];
-
- /* vertical scan order */
- for (i = 0; i < 2; i++)
- {
- u32 t1, t2;
-
- t1 = bs[i][0];
- t2 = bs[i][1];
- threshold[i][0] = (t1) ? tc0[indexA][t1] : 0;
- t1 = bs[i][2];
- threshold[i][1] = (t2) ? tc0[indexA][t2] : 0;
- t2 = bs[i][3];
- threshold[i][2] = (t1) ? tc0[indexA][t1] : 0;
- t1 = bs[i][4];
- threshold[i][3] = (t2) ? tc0[indexA][t2] : 0;
- t2 = bs[i][5];
- threshold[i][4] = (t1) ? tc0[indexA][t1] : 0;
- t1 = bs[i][6];
- threshold[i][5] = (t2) ? tc0[indexA][t2] : 0;
- t2 = bs[i][7];
- threshold[i][6] = (t1) ? tc0[indexA][t1] : 0;
- t1 = bs[i][8];
- threshold[i][7] = (t2) ? tc0[indexA][t2] : 0;
- t2 = bs[i][9];
- threshold[i][8] = (t1) ? tc0[indexA][t1] : 0;
- t1 = bs[i][10];
- threshold[i][9] = (t2) ? tc0[indexA][t2] : 0;
- t2 = bs[i][11];
- threshold[i][10] = (t1) ? tc0[indexA][t1] : 0;
- t1 = bs[i][12];
- threshold[i][11] = (t2) ? tc0[indexA][t2] : 0;
- t2 = bs[i][13];
- threshold[i][12] = (t1) ? tc0[indexA][t1] : 0;
- t1 = bs[i][14];
- threshold[i][13] = (t2) ? tc0[indexA][t2] : 0;
- t2 = bs[i][15];
- threshold[i][14] = (t1) ? tc0[indexA][t1] : 0;
- threshold[i][15] = (t2) ? tc0[indexA][t2] : 0;
- }
-
- if (filteringFlags & FILTER_TOP_EDGE)
- {
- qpTmp = mb->mbB->qpY;
- if (qpTmp != qp)
- {
- u32 t1, t2, t3, t4;
- qpAv = (qp + qpTmp + 1) >> 1;
-
- indexA = (u32)CLIP3(0, 51, (i32)qpAv + mb->filterOffsetA);
- indexB = (u32)CLIP3(0, 51, (i32)qpAv + mb->filterOffsetB);
-
- alpha[1][0] = alphas[indexA];
- beta[1][0] = betas[indexB];
- t1 = bs[1][0];
- t2 = bs[1][1];
- t3 = bs[1][2];
- t4 = bs[1][3];
- threshold[1][0] = (t1 && (t1 < 4)) ? tc0[indexA][t1] : 0;
- threshold[1][1] = (t2 && (t2 < 4)) ? tc0[indexA][t2] : 0;
- threshold[1][2] = (t3 && (t3 < 4)) ? tc0[indexA][t3] : 0;
- threshold[1][3] = (t4 && (t4 < 4)) ? tc0[indexA][t4] : 0;
- }
- }
- if (filteringFlags & FILTER_LEFT_EDGE)
- {
- qpTmp = mb->mbA->qpY;
- if (qpTmp != qp)
- {
- qpAv = (qp + qpTmp + 1) >> 1;
-
- indexA = (u32)CLIP3(0, 51, (i32)qpAv + mb->filterOffsetA);
- indexB = (u32)CLIP3(0, 51, (i32)qpAv + mb->filterOffsetB);
-
- alpha[0][0] = alphas[indexA];
- beta[0][0] = betas[indexB];
- threshold[0][0] = (bs[0][0] && (bs[0][0] < 4)) ? tc0[indexA][bs[0][0]] : 0;
- threshold[0][1] = (bs[0][1] && (bs[0][1] < 4)) ? tc0[indexA][bs[0][1]] : 0;
- threshold[0][2] = (bs[0][2] && (bs[0][2] < 4)) ? tc0[indexA][bs[0][2]] : 0;
- threshold[0][3] = (bs[0][3] && (bs[0][3] < 4)) ? tc0[indexA][bs[0][3]] : 0;
- }
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: GetChromaEdgeThresholds
-
- Functional description:
- Compute alpha, beta and tc0 thresholds for inner, left and top
- chroma edges of a macroblock.
-
-------------------------------------------------------------------------------*/
-void GetChromaEdgeThresholds(
- mbStorage_t *mb,
- u8 (*alpha)[2],
- u8 (*beta)[2],
- u8 (*threshold)[8],
- u8 (*bs)[16],
- u32 filteringFlags,
- i32 chromaQpIndexOffset)
-{
-
-/* Variables */
-
- u32 indexA, indexB;
- u32 qpAv, qp, qpTmp;
- u32 i;
-
-/* Code */
-
- ASSERT(threshold);
- ASSERT(bs);
- ASSERT(beta);
- ASSERT(alpha);
- ASSERT(mb);
- ASSERT(mb);
-
- qp = mb->qpY;
- qp = h264bsdQpC[CLIP3(0, 51, (i32)qp + chromaQpIndexOffset)];
-
- indexA = (u32)CLIP3(0, 51, (i32)qp + mb->filterOffsetA);
- indexB = (u32)CLIP3(0, 51, (i32)qp + mb->filterOffsetB);
-
- alpha[0][1] = alphas[indexA];
- alpha[1][1] = alphas[indexA];
- alpha[1][0] = alphas[indexA];
- alpha[0][0] = alphas[indexA];
- beta[0][1] = betas[indexB];
- beta[1][1] = betas[indexB];
- beta[1][0] = betas[indexB];
- beta[0][0] = betas[indexB];
-
- for (i = 0; i < 2; i++)
- {
- u32 t1, t2;
-
- t1 = bs[i][0];
- t2 = bs[i][1];
- threshold[i][0] = (t1) ? tc0[indexA][t1] : 0;
- t1 = bs[i][2];
- threshold[i][1] = (t2) ? tc0[indexA][t2] : 0;
- t2 = bs[i][3];
- threshold[i][2] = (t1) ? tc0[indexA][t1] : 0;
- t1 = bs[i][8];
- threshold[i][3] = (t2) ? tc0[indexA][t2] : 0;
- t2 = bs[i][9];
- threshold[i][4] = (t1) ? tc0[indexA][t1] : 0;
- t1 = bs[i][10];
- threshold[i][5] = (t2) ? tc0[indexA][t2] : 0;
- t2 = bs[i][11];
- threshold[i][6] = (t1) ? tc0[indexA][t1] : 0;
- threshold[i][7] = (t2) ? tc0[indexA][t2] : 0;
- }
-
- if (filteringFlags & FILTER_TOP_EDGE)
- {
- qpTmp = mb->mbB->qpY;
- if (qpTmp != mb->qpY)
- {
- u32 t1, t2, t3, t4;
- qpTmp = h264bsdQpC[CLIP3(0, 51, (i32)qpTmp + chromaQpIndexOffset)];
- qpAv = (qp + qpTmp + 1) >> 1;
-
- indexA = (u32)CLIP3(0, 51, (i32)qpAv + mb->filterOffsetA);
- indexB = (u32)CLIP3(0, 51, (i32)qpAv + mb->filterOffsetB);
-
- alpha[1][0] = alphas[indexA];
- beta[1][0] = betas[indexB];
-
- t1 = bs[1][0];
- t2 = bs[1][1];
- t3 = bs[1][2];
- t4 = bs[1][3];
- threshold[1][0] = (t1) ? tc0[indexA][t1] : 0;
- threshold[1][1] = (t2) ? tc0[indexA][t2] : 0;
- threshold[1][2] = (t3) ? tc0[indexA][t3] : 0;
- threshold[1][3] = (t4) ? tc0[indexA][t4] : 0;
- }
- }
- if (filteringFlags & FILTER_LEFT_EDGE)
- {
- qpTmp = mb->mbA->qpY;
- if (qpTmp != mb->qpY)
- {
-
- qpTmp = h264bsdQpC[CLIP3(0, 51, (i32)qpTmp + chromaQpIndexOffset)];
- qpAv = (qp + qpTmp + 1) >> 1;
-
- indexA = (u32)CLIP3(0, 51, (i32)qpAv + mb->filterOffsetA);
- indexB = (u32)CLIP3(0, 51, (i32)qpAv + mb->filterOffsetB);
-
- alpha[0][0] = alphas[indexA];
- beta[0][0] = betas[indexB];
- threshold[0][0] = (bs[0][0]) ? tc0[indexA][bs[0][0]] : 0;
- threshold[0][1] = (bs[0][1]) ? tc0[indexA][bs[0][1]] : 0;
- threshold[0][2] = (bs[0][2]) ? tc0[indexA][bs[0][2]] : 0;
- threshold[0][3] = (bs[0][3]) ? tc0[indexA][bs[0][3]] : 0;
- }
- }
-
-}
-
-#endif /* H264DEC_OMXDL */
-
-/*lint +e701 +e702 */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_deblocking.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_deblocking.h
deleted file mode 100644
index 2571dda..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_deblocking.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_DEBLOCKING_H
-#define H264SWDEC_DEBLOCKING_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_image.h"
-#include "h264bsd_macroblock_layer.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-void h264bsdFilterPicture(
- image_t *image,
- mbStorage_t *mb);
-
-#endif /* #ifdef H264SWDEC_DEBLOCKING_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_decoder.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_decoder.c
deleted file mode 100644
index 0ac480f..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_decoder.c
+++ /dev/null
@@ -1,961 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdInit
- h264bsdDecode
- h264bsdShutdown
- h264bsdCurrentImage
- h264bsdNextOutputPicture
- h264bsdPicWidth
- h264bsdPicHeight
- h264bsdFlushBuffer
- h264bsdCheckValidParamSets
- h264bsdVideoRange
- h264bsdMatrixCoefficients
- h264bsdCroppingParams
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_decoder.h"
-#include "h264bsd_nal_unit.h"
-#include "h264bsd_byte_stream.h"
-#include "h264bsd_seq_param_set.h"
-#include "h264bsd_pic_param_set.h"
-#include "h264bsd_slice_header.h"
-#include "h264bsd_slice_data.h"
-#include "h264bsd_neighbour.h"
-#include "h264bsd_util.h"
-#include "h264bsd_dpb.h"
-#include "h264bsd_deblocking.h"
-#include "h264bsd_conceal.h"
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
-
- Function name: h264bsdInit
-
- Functional description:
- Initialize the decoder.
-
- Inputs:
- noOutputReordering flag to indicate the decoder that it does not
- have to perform reordering of display images.
-
- Outputs:
- pStorage pointer to initialized storage structure
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdInit(storage_t *pStorage, u32 noOutputReordering)
-{
-
-/* Variables */
- u32 size;
-/* Code */
-
- ASSERT(pStorage);
-
- h264bsdInitStorage(pStorage);
-
- /* allocate mbLayer to be next multiple of 64 to enable use of
- * specific NEON optimized "memset" for clearing the structure */
- size = (sizeof(macroblockLayer_t) + 63) & ~0x3F;
-
- pStorage->mbLayer = (macroblockLayer_t*)H264SwDecMalloc(size, 1);
- if (!pStorage->mbLayer)
- return HANTRO_NOK;
-
- if (noOutputReordering)
- pStorage->noReordering = HANTRO_TRUE;
-
- return HANTRO_OK;
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdDecode
-
- Functional description:
- Decode a NAL unit. This function calls other modules to perform
- tasks like
- * extract and decode NAL unit from the byte stream
- * decode parameter sets
- * decode slice header and slice data
- * conceal errors in the picture
- * perform deblocking filtering
-
- This function contains top level control logic of the decoder.
-
- Inputs:
- pStorage pointer to storage data structure
- byteStrm pointer to stream buffer given by application
- len length of the buffer in bytes
- picId identifier for a picture, assigned by the
- application
-
- Outputs:
- readBytes number of bytes read from the stream is stored
- here
-
- Returns:
- H264BSD_RDY decoding finished, nothing special
- H264BSD_PIC_RDY decoding of a picture finished
- H264BSD_HDRS_RDY param sets activated, information like
- picture dimensions etc can be read
- H264BSD_ERROR error in decoding
- H264BSD_PARAM_SET_ERROR serius error in decoding, failed to
- activate param sets
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecode(storage_t *pStorage, u8 *byteStrm, u32 len, u32 picId,
- u32 *readBytes)
-{
-
-/* Variables */
-
- u32 tmp, ppsId, spsId;
- i32 picOrderCnt;
- nalUnit_t nalUnit;
- seqParamSet_t seqParamSet;
- picParamSet_t picParamSet;
- strmData_t strm;
- u32 accessUnitBoundaryFlag = HANTRO_FALSE;
- u32 picReady = HANTRO_FALSE;
-
-/* Code */
-
- ASSERT(pStorage);
- ASSERT(byteStrm);
- ASSERT(len);
- ASSERT(readBytes);
-
- /* if previous buffer was not finished and same pointer given -> skip NAL
- * unit extraction */
- if (pStorage->prevBufNotFinished && byteStrm == pStorage->prevBufPointer)
- {
- strm = pStorage->strm[0];
- strm.pStrmCurrPos = strm.pStrmBuffStart;
- strm.strmBuffReadBits = strm.bitPosInWord = 0;
- *readBytes = pStorage->prevBytesConsumed;
- }
- else
- {
- tmp = h264bsdExtractNalUnit(byteStrm, len, &strm, readBytes);
- if (tmp != HANTRO_OK)
- {
- EPRINT("BYTE_STREAM");
- return(H264BSD_ERROR);
- }
- /* store stream */
- pStorage->strm[0] = strm;
- pStorage->prevBytesConsumed = *readBytes;
- pStorage->prevBufPointer = byteStrm;
- }
- pStorage->prevBufNotFinished = HANTRO_FALSE;
-
- tmp = h264bsdDecodeNalUnit(&strm, &nalUnit);
- if (tmp != HANTRO_OK)
- {
- EPRINT("NAL_UNIT");
- return(H264BSD_ERROR);
- }
-
- /* Discard unspecified, reserved, SPS extension and auxiliary picture slices */
- if(nalUnit.nalUnitType == 0 || nalUnit.nalUnitType >= 13)
- {
- DEBUG(("DISCARDED NAL (UNSPECIFIED, REGISTERED, SPS ext or AUX slice)\n"));
- return(H264BSD_RDY);
- }
-
- tmp = h264bsdCheckAccessUnitBoundary(
- &strm,
- &nalUnit,
- pStorage,
- &accessUnitBoundaryFlag);
- if (tmp != HANTRO_OK)
- {
- EPRINT("ACCESS UNIT BOUNDARY CHECK");
- if (tmp == PARAM_SET_ERROR)
- return(H264BSD_PARAM_SET_ERROR);
- else
- return(H264BSD_ERROR);
- }
-
- if ( accessUnitBoundaryFlag )
- {
- DEBUG(("Access unit boundary\n"));
- /* conceal if picture started and param sets activated */
- if (pStorage->picStarted && pStorage->activeSps != NULL)
- {
- DEBUG(("CONCEALING..."));
-
- /* return error if second phase of
- * initialization is not completed */
- if (pStorage->pendingActivation)
- {
- EPRINT("Pending activation not completed");
- return (H264BSD_ERROR);
- }
-
- if (!pStorage->validSliceInAccessUnit)
- {
- pStorage->currImage->data =
- h264bsdAllocateDpbImage(pStorage->dpb);
- h264bsdInitRefPicList(pStorage->dpb);
- tmp = h264bsdConceal(pStorage, pStorage->currImage, P_SLICE);
- }
- else
- tmp = h264bsdConceal(pStorage, pStorage->currImage,
- pStorage->sliceHeader->sliceType);
-
- picReady = HANTRO_TRUE;
-
- /* current NAL unit should be decoded on next activation -> set
- * readBytes to 0 */
- *readBytes = 0;
- pStorage->prevBufNotFinished = HANTRO_TRUE;
- DEBUG(("...DONE\n"));
- }
- else
- {
- pStorage->validSliceInAccessUnit = HANTRO_FALSE;
- }
- pStorage->skipRedundantSlices = HANTRO_FALSE;
- }
-
- if (!picReady)
- {
- switch (nalUnit.nalUnitType)
- {
- case NAL_SEQ_PARAM_SET:
- DEBUG(("SEQ PARAM SET\n"));
- tmp = h264bsdDecodeSeqParamSet(&strm, &seqParamSet);
- if (tmp != HANTRO_OK)
- {
- EPRINT("SEQ_PARAM_SET");
- FREE(seqParamSet.offsetForRefFrame);
- FREE(seqParamSet.vuiParameters);
- return(H264BSD_ERROR);
- }
- tmp = h264bsdStoreSeqParamSet(pStorage, &seqParamSet);
- break;
-
- case NAL_PIC_PARAM_SET:
- DEBUG(("PIC PARAM SET\n"));
- tmp = h264bsdDecodePicParamSet(&strm, &picParamSet);
- if (tmp != HANTRO_OK)
- {
- EPRINT("PIC_PARAM_SET");
- FREE(picParamSet.runLength);
- FREE(picParamSet.topLeft);
- FREE(picParamSet.bottomRight);
- FREE(picParamSet.sliceGroupId);
- return(H264BSD_ERROR);
- }
- tmp = h264bsdStorePicParamSet(pStorage, &picParamSet);
- break;
-
- case NAL_CODED_SLICE_IDR:
- DEBUG(("IDR "));
- /* fall through */
- case NAL_CODED_SLICE:
- DEBUG(("SLICE HEADER\n"));
-
- /* picture successfully finished and still decoding same old
- * access unit -> no need to decode redundant slices */
- if (pStorage->skipRedundantSlices)
- return(H264BSD_RDY);
-
- pStorage->picStarted = HANTRO_TRUE;
-
- if (h264bsdIsStartOfPicture(pStorage))
- {
- pStorage->numConcealedMbs = 0;
- pStorage->currentPicId = picId;
-
- tmp = h264bsdCheckPpsId(&strm, &ppsId);
- ASSERT(tmp == HANTRO_OK);
- /* store old activeSpsId and return headers ready
- * indication if activeSps changes */
- spsId = pStorage->activeSpsId;
- tmp = h264bsdActivateParamSets(pStorage, ppsId,
- IS_IDR_NAL_UNIT(&nalUnit) ?
- HANTRO_TRUE : HANTRO_FALSE);
- if (tmp != HANTRO_OK)
- {
- EPRINT("Param set activation");
- pStorage->activePpsId = MAX_NUM_PIC_PARAM_SETS;
- pStorage->activePps = NULL;
- pStorage->activeSpsId = MAX_NUM_SEQ_PARAM_SETS;
- pStorage->activeSps = NULL;
- pStorage->pendingActivation = HANTRO_FALSE;
-
- if(tmp == MEMORY_ALLOCATION_ERROR)
- {
- return H264BSD_MEMALLOC_ERROR;
- }
- else
- return(H264BSD_PARAM_SET_ERROR);
- }
-
- if (spsId != pStorage->activeSpsId)
- {
- seqParamSet_t *oldSPS = NULL;
- seqParamSet_t *newSPS = pStorage->activeSps;
- u32 noOutputOfPriorPicsFlag = 1;
-
- if(pStorage->oldSpsId < MAX_NUM_SEQ_PARAM_SETS)
- {
- oldSPS = pStorage->sps[pStorage->oldSpsId];
- }
-
- *readBytes = 0;
- pStorage->prevBufNotFinished = HANTRO_TRUE;
-
-
- if(nalUnit.nalUnitType == NAL_CODED_SLICE_IDR)
- {
- tmp =
- h264bsdCheckPriorPicsFlag(&noOutputOfPriorPicsFlag,
- &strm, newSPS,
- pStorage->activePps,
- nalUnit.nalUnitType);
- }
- else
- {
- tmp = HANTRO_NOK;
- }
-
- if((tmp != HANTRO_OK) ||
- (noOutputOfPriorPicsFlag != 0) ||
- (pStorage->dpb->noReordering) ||
- (oldSPS == NULL) ||
- (oldSPS->picWidthInMbs != newSPS->picWidthInMbs) ||
- (oldSPS->picHeightInMbs != newSPS->picHeightInMbs) ||
- (oldSPS->maxDpbSize != newSPS->maxDpbSize))
- {
- pStorage->dpb->flushed = 0;
- }
- else
- {
- h264bsdFlushDpb(pStorage->dpb);
- }
-
- pStorage->oldSpsId = pStorage->activeSpsId;
-
- return(H264BSD_HDRS_RDY);
- }
- }
-
- /* return error if second phase of
- * initialization is not completed */
- if (pStorage->pendingActivation)
- {
- EPRINT("Pending activation not completed");
- return (H264BSD_ERROR);
- }
- tmp = h264bsdDecodeSliceHeader(&strm, pStorage->sliceHeader + 1,
- pStorage->activeSps, pStorage->activePps, &nalUnit);
- if (tmp != HANTRO_OK)
- {
- EPRINT("SLICE_HEADER");
- return(H264BSD_ERROR);
- }
- if (h264bsdIsStartOfPicture(pStorage))
- {
- if (!IS_IDR_NAL_UNIT(&nalUnit))
- {
- tmp = h264bsdCheckGapsInFrameNum(pStorage->dpb,
- pStorage->sliceHeader[1].frameNum,
- nalUnit.nalRefIdc != 0 ?
- HANTRO_TRUE : HANTRO_FALSE,
- pStorage->activeSps->
- gapsInFrameNumValueAllowedFlag);
- if (tmp != HANTRO_OK)
- {
- EPRINT("Gaps in frame num");
- return(H264BSD_ERROR);
- }
- }
- pStorage->currImage->data =
- h264bsdAllocateDpbImage(pStorage->dpb);
- }
-
- /* store slice header to storage if successfully decoded */
- pStorage->sliceHeader[0] = pStorage->sliceHeader[1];
- pStorage->validSliceInAccessUnit = HANTRO_TRUE;
- pStorage->prevNalUnit[0] = nalUnit;
-
- h264bsdComputeSliceGroupMap(pStorage,
- pStorage->sliceHeader->sliceGroupChangeCycle);
-
- h264bsdInitRefPicList(pStorage->dpb);
- tmp = h264bsdReorderRefPicList(pStorage->dpb,
- &pStorage->sliceHeader->refPicListReordering,
- pStorage->sliceHeader->frameNum,
- pStorage->sliceHeader->numRefIdxL0Active);
- if (tmp != HANTRO_OK)
- {
- EPRINT("Reordering");
- return(H264BSD_ERROR);
- }
-
- DEBUG(("SLICE DATA, FIRST %d\n",
- pStorage->sliceHeader->firstMbInSlice));
- tmp = h264bsdDecodeSliceData(&strm, pStorage,
- pStorage->currImage, pStorage->sliceHeader);
- if (tmp != HANTRO_OK)
- {
- EPRINT("SLICE_DATA");
- h264bsdMarkSliceCorrupted(pStorage,
- pStorage->sliceHeader->firstMbInSlice);
- return(H264BSD_ERROR);
- }
-
- if (h264bsdIsEndOfPicture(pStorage))
- {
- picReady = HANTRO_TRUE;
- pStorage->skipRedundantSlices = HANTRO_TRUE;
- }
- break;
-
- case NAL_SEI:
- DEBUG(("SEI MESSAGE, NOT DECODED"));
- break;
-
- default:
- DEBUG(("NOT IMPLEMENTED YET %d\n",nalUnit.nalUnitType));
- }
- }
-
- if (picReady)
- {
- h264bsdFilterPicture(pStorage->currImage, pStorage->mb);
-
- h264bsdResetStorage(pStorage);
-
- picOrderCnt = h264bsdDecodePicOrderCnt(pStorage->poc,
- pStorage->activeSps, pStorage->sliceHeader, pStorage->prevNalUnit);
-
- if (pStorage->validSliceInAccessUnit)
- {
- if (pStorage->prevNalUnit->nalRefIdc)
- {
- tmp = h264bsdMarkDecRefPic(pStorage->dpb,
- &pStorage->sliceHeader->decRefPicMarking,
- pStorage->currImage, pStorage->sliceHeader->frameNum,
- picOrderCnt,
- IS_IDR_NAL_UNIT(pStorage->prevNalUnit) ?
- HANTRO_TRUE : HANTRO_FALSE,
- pStorage->currentPicId, pStorage->numConcealedMbs);
- }
- /* non-reference picture, just store for possible display
- * reordering */
- else
- {
- tmp = h264bsdMarkDecRefPic(pStorage->dpb, NULL,
- pStorage->currImage, pStorage->sliceHeader->frameNum,
- picOrderCnt,
- IS_IDR_NAL_UNIT(pStorage->prevNalUnit) ?
- HANTRO_TRUE : HANTRO_FALSE,
- pStorage->currentPicId, pStorage->numConcealedMbs);
- }
- }
-
- pStorage->picStarted = HANTRO_FALSE;
- pStorage->validSliceInAccessUnit = HANTRO_FALSE;
-
- return(H264BSD_PIC_RDY);
- }
- else
- return(H264BSD_RDY);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdShutdown
-
- Functional description:
- Shutdown a decoder instance. Function frees all the memories
- allocated for the decoder instance.
-
- Inputs:
- pStorage pointer to storage data structure
-
- Returns:
- none
-
-
-------------------------------------------------------------------------------*/
-
-void h264bsdShutdown(storage_t *pStorage)
-{
-
-/* Variables */
-
- u32 i;
-
-/* Code */
-
- ASSERT(pStorage);
-
- for (i = 0; i < MAX_NUM_SEQ_PARAM_SETS; i++)
- {
- if (pStorage->sps[i])
- {
- FREE(pStorage->sps[i]->offsetForRefFrame);
- FREE(pStorage->sps[i]->vuiParameters);
- FREE(pStorage->sps[i]);
- }
- }
-
- for (i = 0; i < MAX_NUM_PIC_PARAM_SETS; i++)
- {
- if (pStorage->pps[i])
- {
- FREE(pStorage->pps[i]->runLength);
- FREE(pStorage->pps[i]->topLeft);
- FREE(pStorage->pps[i]->bottomRight);
- FREE(pStorage->pps[i]->sliceGroupId);
- FREE(pStorage->pps[i]);
- }
- }
-
- FREE(pStorage->mbLayer);
- FREE(pStorage->mb);
- FREE(pStorage->sliceGroupMap);
-
- h264bsdFreeDpb(pStorage->dpb);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdNextOutputPicture
-
- Functional description:
- Get next output picture in display order.
-
- Inputs:
- pStorage pointer to storage data structure
-
- Outputs:
- picId identifier of the picture will be stored here
- isIdrPic IDR flag of the picture will be stored here
- numErrMbs number of concealed macroblocks in the picture
- will be stored here
-
- Returns:
- pointer to the picture data
- NULL if no pictures available for display
-
-------------------------------------------------------------------------------*/
-
-u8* h264bsdNextOutputPicture(storage_t *pStorage, u32 *picId, u32 *isIdrPic,
- u32 *numErrMbs)
-{
-
-/* Variables */
-
- dpbOutPicture_t *pOut;
-
-/* Code */
-
- ASSERT(pStorage);
-
- pOut = h264bsdDpbOutputPicture(pStorage->dpb);
-
- if (pOut != NULL)
- {
- *picId = pOut->picId;
- *isIdrPic = pOut->isIdr;
- *numErrMbs = pOut->numErrMbs;
- return (pOut->data);
- }
- else
- return(NULL);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdPicWidth
-
- Functional description:
- Get width of the picture in macroblocks
-
- Inputs:
- pStorage pointer to storage data structure
-
- Outputs:
- none
-
- Returns:
- picture width
- 0 if parameters sets not yet activated
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdPicWidth(storage_t *pStorage)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(pStorage);
-
- if (pStorage->activeSps)
- return(pStorage->activeSps->picWidthInMbs);
- else
- return(0);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdPicHeight
-
- Functional description:
- Get height of the picture in macroblocks
-
- Inputs:
- pStorage pointer to storage data structure
-
- Outputs:
- none
-
- Returns:
- picture width
- 0 if parameters sets not yet activated
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdPicHeight(storage_t *pStorage)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(pStorage);
-
- if (pStorage->activeSps)
- return(pStorage->activeSps->picHeightInMbs);
- else
- return(0);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdFlushBuffer
-
- Functional description:
- Flush the decoded picture buffer, see dpb.c for details
-
- Inputs:
- pStorage pointer to storage data structure
-
-------------------------------------------------------------------------------*/
-
-void h264bsdFlushBuffer(storage_t *pStorage)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(pStorage);
-
- h264bsdFlushDpb(pStorage->dpb);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdCheckValidParamSets
-
- Functional description:
- Check if any valid parameter set combinations (SPS/PPS) exists.
-
- Inputs:
- pStorage pointer to storage structure
-
- Returns:
- 1 at least one valid SPS/PPS combination found
- 0 no valid param set combinations found
-
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdCheckValidParamSets(storage_t *pStorage)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(pStorage);
-
- return(h264bsdValidParamSets(pStorage) == HANTRO_OK ? 1 : 0);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdVideoRange
-
- Functional description:
- Get value of video_full_range_flag received in the VUI data.
-
- Inputs:
- pStorage pointer to storage structure
-
- Returns:
- 1 video_full_range_flag received and value is 1
- 0 otherwise
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdVideoRange(storage_t *pStorage)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(pStorage);
-
- if (pStorage->activeSps && pStorage->activeSps->vuiParametersPresentFlag &&
- pStorage->activeSps->vuiParameters &&
- pStorage->activeSps->vuiParameters->videoSignalTypePresentFlag &&
- pStorage->activeSps->vuiParameters->videoFullRangeFlag)
- return(1);
- else /* default value of video_full_range_flag is 0 */
- return(0);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdMatrixCoefficients
-
- Functional description:
- Get value of matrix_coefficients received in the VUI data
-
- Inputs:
- pStorage pointer to storage structure
-
- Outputs:
- value of matrix_coefficients if received
- 2 otherwise (this is the default value)
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdMatrixCoefficients(storage_t *pStorage)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(pStorage);
-
- if (pStorage->activeSps && pStorage->activeSps->vuiParametersPresentFlag &&
- pStorage->activeSps->vuiParameters &&
- pStorage->activeSps->vuiParameters->videoSignalTypePresentFlag &&
- pStorage->activeSps->vuiParameters->colourDescriptionPresentFlag)
- return(pStorage->activeSps->vuiParameters->matrixCoefficients);
- else /* default unspecified */
- return(2);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: hh264bsdCroppingParams
-
- Functional description:
- Get cropping parameters of the active SPS
-
- Inputs:
- pStorage pointer to storage structure
-
- Outputs:
- croppingFlag flag indicating if cropping params present is
- stored here
- leftOffset cropping left offset in pixels is stored here
- width width of the image after cropping is stored here
- topOffset cropping top offset in pixels is stored here
- height height of the image after cropping is stored here
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-
-void h264bsdCroppingParams(storage_t *pStorage, u32 *croppingFlag,
- u32 *leftOffset, u32 *width, u32 *topOffset, u32 *height)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(pStorage);
-
- if (pStorage->activeSps && pStorage->activeSps->frameCroppingFlag)
- {
- *croppingFlag = 1;
- *leftOffset = 2 * pStorage->activeSps->frameCropLeftOffset;
- *width = 16 * pStorage->activeSps->picWidthInMbs -
- 2 * (pStorage->activeSps->frameCropLeftOffset +
- pStorage->activeSps->frameCropRightOffset);
- *topOffset = 2 * pStorage->activeSps->frameCropTopOffset;
- *height = 16 * pStorage->activeSps->picHeightInMbs -
- 2 * (pStorage->activeSps->frameCropTopOffset +
- pStorage->activeSps->frameCropBottomOffset);
- }
- else
- {
- *croppingFlag = 0;
- *leftOffset = 0;
- *width = 0;
- *topOffset = 0;
- *height = 0;
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdSampleAspectRatio
-
- Functional description:
- Get aspect ratio received in the VUI data
-
- Inputs:
- pStorage pointer to storage structure
-
- Outputs:
- sarWidth sample aspect ratio height
- sarHeight sample aspect ratio width
-
-------------------------------------------------------------------------------*/
-
-void h264bsdSampleAspectRatio(storage_t *pStorage, u32 *sarWidth, u32 *sarHeight)
-{
-
-/* Variables */
- u32 w = 1;
- u32 h = 1;
-/* Code */
-
- ASSERT(pStorage);
-
-
- if (pStorage->activeSps &&
- pStorage->activeSps->vuiParametersPresentFlag &&
- pStorage->activeSps->vuiParameters &&
- pStorage->activeSps->vuiParameters->aspectRatioPresentFlag )
- {
- switch (pStorage->activeSps->vuiParameters->aspectRatioIdc)
- {
- case ASPECT_RATIO_UNSPECIFIED: w = 0; h = 0; break;
- case ASPECT_RATIO_1_1: w = 1; h = 1; break;
- case ASPECT_RATIO_12_11: w = 12; h = 11; break;
- case ASPECT_RATIO_10_11: w = 10; h = 11; break;
- case ASPECT_RATIO_16_11: w = 16; h = 11; break;
- case ASPECT_RATIO_40_33: w = 40; h = 33; break;
- case ASPECT_RATIO_24_11: w = 24; h = 11; break;
- case ASPECT_RATIO_20_11: w = 20; h = 11; break;
- case ASPECT_RATIO_32_11: w = 32; h = 11; break;
- case ASPECT_RATIO_80_33: w = 80; h = 33; break;
- case ASPECT_RATIO_18_11: w = 18; h = 11; break;
- case ASPECT_RATIO_15_11: w = 15; h = 11; break;
- case ASPECT_RATIO_64_33: w = 64; h = 33; break;
- case ASPECT_RATIO_160_99: w = 160; h = 99; break;
- case ASPECT_RATIO_EXTENDED_SAR:
- w = pStorage->activeSps->vuiParameters->sarWidth;
- h = pStorage->activeSps->vuiParameters->sarHeight;
- if ((w == 0) || (h == 0))
- w = h = 0;
- break;
- default:
- w = 0;
- h = 0;
- break;
- }
- }
-
- /* set aspect ratio*/
- *sarWidth = w;
- *sarHeight = h;
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdProfile
-
- Functional description:
- Get profile information from active SPS
-
- Inputs:
- pStorage pointer to storage structure
-
- Outputs:
- profile current profile
-
-------------------------------------------------------------------------------*/
-u32 h264bsdProfile(storage_t *pStorage)
-{
- if (pStorage->activeSps)
- return pStorage->activeSps->profileIdc;
- else
- return 0;
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_decoder.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_decoder.h
deleted file mode 100644
index 8336523..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_decoder.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_DECODER_H
-#define H264SWDEC_DECODER_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_storage.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-/* enumerated return values of the functions */
-enum {
- H264BSD_RDY,
- H264BSD_PIC_RDY,
- H264BSD_HDRS_RDY,
- H264BSD_ERROR,
- H264BSD_PARAM_SET_ERROR,
- H264BSD_MEMALLOC_ERROR
-};
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-u32 h264bsdInit(storage_t *pStorage, u32 noOutputReordering);
-u32 h264bsdDecode(storage_t *pStorage, u8 *byteStrm, u32 len, u32 picId,
- u32 *readBytes);
-void h264bsdShutdown(storage_t *pStorage);
-
-u8* h264bsdNextOutputPicture(storage_t *pStorage, u32 *picId, u32 *isIdrPic,
- u32 *numErrMbs);
-
-u32 h264bsdPicWidth(storage_t *pStorage);
-u32 h264bsdPicHeight(storage_t *pStorage);
-u32 h264bsdVideoRange(storage_t *pStorage);
-u32 h264bsdMatrixCoefficients(storage_t *pStorage);
-void h264bsdCroppingParams(storage_t *pStorage, u32 *croppingFlag,
- u32 *left, u32 *width, u32 *top, u32 *height);
-void h264bsdSampleAspectRatio(storage_t *pStorage,
- u32 *sarWidth, u32 *sarHeight);
-u32 h264bsdCheckValidParamSets(storage_t *pStorage);
-
-void h264bsdFlushBuffer(storage_t *pStorage);
-
-u32 h264bsdProfile(storage_t *pStorage);
-
-#endif /* #ifdef H264SWDEC_DECODER_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_dpb.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_dpb.c
deleted file mode 100644
index bd9eee9..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_dpb.c
+++ /dev/null
@@ -1,1593 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- ComparePictures
- h264bsdReorderRefPicList
- Mmcop1
- Mmcop2
- Mmcop3
- Mmcop4
- Mmcop5
- Mmcop6
- h264bsdMarkDecRefPic
- h264bsdGetRefPicData
- h264bsdAllocateDpbImage
- SlidingWindowRefPicMarking
- h264bsdInitDpb
- h264bsdResetDpb
- h264bsdInitRefPicList
- FindDpbPic
- SetPicNums
- h264bsdCheckGapsInFrameNum
- FindSmallestPicOrderCnt
- OutputPicture
- h264bsdDpbOutputPicture
- h264bsdFlushDpb
- h264bsdFreeDpb
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_cfg.h"
-#include "h264bsd_dpb.h"
-#include "h264bsd_slice_header.h"
-#include "h264bsd_image.h"
-#include "h264bsd_util.h"
-#include "basetype.h"
-
-#include <log/log.h>
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-/* macros to determine picture status. Note that IS_SHORT_TERM macro returns
- * true also for non-existing pictures because non-existing pictures are
- * regarded short term pictures according to H.264 standard */
-#define IS_REFERENCE(a) ((a).status)
-#define IS_EXISTING(a) ((a).status > NON_EXISTING)
-#define IS_SHORT_TERM(a) \
- ((a).status == NON_EXISTING || (a).status == SHORT_TERM)
-#define IS_LONG_TERM(a) ((a).status == LONG_TERM)
-
-/* macro to set a picture unused for reference */
-#define SET_UNUSED(a) (a).status = UNUSED;
-
-#define MAX_NUM_REF_IDX_L0_ACTIVE 16
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-static i32 ComparePictures(const void *ptr1, const void *ptr2);
-
-static u32 Mmcop1(dpbStorage_t *dpb, u32 currPicNum, u32 differenceOfPicNums);
-
-static u32 Mmcop2(dpbStorage_t *dpb, u32 longTermPicNum);
-
-static u32 Mmcop3(dpbStorage_t *dpb, u32 currPicNum, u32 differenceOfPicNums,
- u32 longTermFrameIdx);
-
-static u32 Mmcop4(dpbStorage_t *dpb, u32 maxLongTermFrameIdx);
-
-static u32 Mmcop5(dpbStorage_t *dpb);
-
-static u32 Mmcop6(dpbStorage_t *dpb, u32 frameNum, i32 picOrderCnt,
- u32 longTermFrameIdx);
-
-static u32 SlidingWindowRefPicMarking(dpbStorage_t *dpb);
-
-static i32 FindDpbPic(dpbStorage_t *dpb, i32 picNum, u32 isShortTerm);
-
-static void SetPicNums(dpbStorage_t *dpb, u32 currFrameNum);
-
-static dpbPicture_t* FindSmallestPicOrderCnt(dpbStorage_t *dpb);
-
-static u32 OutputPicture(dpbStorage_t *dpb);
-
-static void ShellSort(dpbPicture_t *pPic, u32 num);
-
-/*------------------------------------------------------------------------------
-
- Function: ComparePictures
-
- Functional description:
- Function to compare dpb pictures, used by the ShellSort() function.
- Order of the pictures after sorting shall be as follows:
- 1) short term reference pictures starting with the largest
- picNum
- 2) long term reference pictures starting with the smallest
- longTermPicNum
- 3) pictures unused for reference but needed for display
- 4) other pictures
-
- Returns:
- -1 pic 1 is greater than pic 2
- 0 equal from comparison point of view
- 1 pic 2 is greater then pic 1
-
-------------------------------------------------------------------------------*/
-
-static i32 ComparePictures(const void *ptr1, const void *ptr2)
-{
-
-/* Variables */
-
- dpbPicture_t *pic1, *pic2;
-
-/* Code */
-
- ASSERT(ptr1);
- ASSERT(ptr2);
-
- pic1 = (dpbPicture_t*)ptr1;
- pic2 = (dpbPicture_t*)ptr2;
-
- /* both are non-reference pictures, check if needed for display */
- if (!IS_REFERENCE(*pic1) && !IS_REFERENCE(*pic2))
- {
- if (pic1->toBeDisplayed && !pic2->toBeDisplayed)
- return(-1);
- else if (!pic1->toBeDisplayed && pic2->toBeDisplayed)
- return(1);
- else
- return(0);
- }
- /* only pic 1 needed for reference -> greater */
- else if (!IS_REFERENCE(*pic2))
- return(-1);
- /* only pic 2 needed for reference -> greater */
- else if (!IS_REFERENCE(*pic1))
- return(1);
- /* both are short term reference pictures -> check picNum */
- else if (IS_SHORT_TERM(*pic1) && IS_SHORT_TERM(*pic2))
- {
- if (pic1->picNum > pic2->picNum)
- return(-1);
- else if (pic1->picNum < pic2->picNum)
- return(1);
- else
- return(0);
- }
- /* only pic 1 is short term -> greater */
- else if (IS_SHORT_TERM(*pic1))
- return(-1);
- /* only pic 2 is short term -> greater */
- else if (IS_SHORT_TERM(*pic2))
- return(1);
- /* both are long term reference pictures -> check picNum (contains the
- * longTermPicNum */
- else
- {
- if (pic1->picNum > pic2->picNum)
- return(1);
- else if (pic1->picNum < pic2->picNum)
- return(-1);
- else
- return(0);
- }
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdReorderRefPicList
-
- Functional description:
- Function to perform reference picture list reordering based on
- reordering commands received in the slice header. See details
- of the process in the H.264 standard.
-
- Inputs:
- dpb pointer to dpb storage structure
- order pointer to reordering commands
- currFrameNum current frame number
- numRefIdxActive number of active reference indices for current
- picture
-
- Outputs:
- dpb 'list' field of the structure reordered
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK if non-existing pictures referred to in the
- reordering commands
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdReorderRefPicList(
- dpbStorage_t *dpb,
- refPicListReordering_t *order,
- u32 currFrameNum,
- u32 numRefIdxActive)
-{
-
-/* Variables */
-
- u32 i, j, k, picNumPred, refIdx;
- i32 picNum, picNumNoWrap, index;
- u32 isShortTerm;
-
-/* Code */
-
- ASSERT(order);
- ASSERT(currFrameNum <= dpb->maxFrameNum);
- ASSERT(numRefIdxActive <= MAX_NUM_REF_IDX_L0_ACTIVE);
-
- /* set dpb picture numbers for sorting */
- SetPicNums(dpb, currFrameNum);
-
- if (!order->refPicListReorderingFlagL0)
- return(HANTRO_OK);
-
- refIdx = 0;
- picNumPred = currFrameNum;
-
- i = 0;
- while (order->command[i].reorderingOfPicNumsIdc < 3)
- {
- /* short term */
- if (order->command[i].reorderingOfPicNumsIdc < 2)
- {
- if (order->command[i].reorderingOfPicNumsIdc == 0)
- {
- picNumNoWrap =
- (i32)picNumPred - (i32)order->command[i].absDiffPicNum;
- if (picNumNoWrap < 0)
- picNumNoWrap += (i32)dpb->maxFrameNum;
- }
- else
- {
- picNumNoWrap =
- (i32)(picNumPred + order->command[i].absDiffPicNum);
- if (picNumNoWrap >= (i32)dpb->maxFrameNum)
- picNumNoWrap -= (i32)dpb->maxFrameNum;
- }
- picNumPred = (u32)picNumNoWrap;
- picNum = picNumNoWrap;
- if ((u32)picNumNoWrap > currFrameNum)
- picNum -= (i32)dpb->maxFrameNum;
- isShortTerm = HANTRO_TRUE;
- }
- /* long term */
- else
- {
- picNum = (i32)order->command[i].longTermPicNum;
- isShortTerm = HANTRO_FALSE;
-
- }
- /* find corresponding picture from dpb */
- index = FindDpbPic(dpb, picNum, isShortTerm);
- if (index < 0 || !IS_EXISTING(dpb->buffer[index]))
- return(HANTRO_NOK);
-
- /* shift pictures */
- for (j = numRefIdxActive; j > refIdx; j--)
- dpb->list[j] = dpb->list[j-1];
- /* put picture into the list */
- dpb->list[refIdx++] = &dpb->buffer[index];
- /* remove later references to the same picture */
- for (j = k = refIdx; j <= numRefIdxActive; j++)
- if(dpb->list[j] != &dpb->buffer[index])
- dpb->list[k++] = dpb->list[j];
-
- i++;
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: Mmcop1
-
- Functional description:
- Function to mark a short-term reference picture unused for
- reference, memory_management_control_operation equal to 1
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK failure, picture does not exist in the buffer
-
-------------------------------------------------------------------------------*/
-
-static u32 Mmcop1(dpbStorage_t *dpb, u32 currPicNum, u32 differenceOfPicNums)
-{
-
-/* Variables */
-
- i32 index, picNum;
-
-/* Code */
-
- ASSERT(currPicNum < dpb->maxFrameNum);
-
- picNum = (i32)currPicNum - (i32)differenceOfPicNums;
-
- index = FindDpbPic(dpb, picNum, HANTRO_TRUE);
- if (index < 0)
- return(HANTRO_NOK);
-
- SET_UNUSED(dpb->buffer[index]);
- dpb->numRefFrames--;
- if (!dpb->buffer[index].toBeDisplayed)
- dpb->fullness--;
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: Mmcop2
-
- Functional description:
- Function to mark a long-term reference picture unused for
- reference, memory_management_control_operation equal to 2
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK failure, picture does not exist in the buffer
-
-------------------------------------------------------------------------------*/
-
-static u32 Mmcop2(dpbStorage_t *dpb, u32 longTermPicNum)
-{
-
-/* Variables */
-
- i32 index;
-
-/* Code */
-
- index = FindDpbPic(dpb, (i32)longTermPicNum, HANTRO_FALSE);
- if (index < 0)
- return(HANTRO_NOK);
-
- SET_UNUSED(dpb->buffer[index]);
- dpb->numRefFrames--;
- if (!dpb->buffer[index].toBeDisplayed)
- dpb->fullness--;
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: Mmcop3
-
- Functional description:
- Function to assing a longTermFrameIdx to a short-term reference
- frame (i.e. to change it to a long-term reference picture),
- memory_management_control_operation equal to 3
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK failure, short-term picture does not exist in the
- buffer or is a non-existing picture, or invalid
- longTermFrameIdx given
-
-------------------------------------------------------------------------------*/
-
-static u32 Mmcop3(dpbStorage_t *dpb, u32 currPicNum, u32 differenceOfPicNums,
- u32 longTermFrameIdx)
-{
-
-/* Variables */
-
- i32 index, picNum;
- u32 i;
-
-/* Code */
-
- ASSERT(dpb);
- ASSERT(currPicNum < dpb->maxFrameNum);
-
- if ( (dpb->maxLongTermFrameIdx == NO_LONG_TERM_FRAME_INDICES) ||
- (longTermFrameIdx > dpb->maxLongTermFrameIdx) )
- return(HANTRO_NOK);
-
- /* check if a long term picture with the same longTermFrameIdx already
- * exist and remove it if necessary */
- for (i = 0; i < dpb->maxRefFrames; i++)
- if (IS_LONG_TERM(dpb->buffer[i]) &&
- (u32)dpb->buffer[i].picNum == longTermFrameIdx)
- {
- SET_UNUSED(dpb->buffer[i]);
- dpb->numRefFrames--;
- if (!dpb->buffer[i].toBeDisplayed)
- dpb->fullness--;
- break;
- }
-
- picNum = (i32)currPicNum - (i32)differenceOfPicNums;
-
- index = FindDpbPic(dpb, picNum, HANTRO_TRUE);
- if (index < 0)
- return(HANTRO_NOK);
- if (!IS_EXISTING(dpb->buffer[index]))
- return(HANTRO_NOK);
-
- dpb->buffer[index].status = LONG_TERM;
- dpb->buffer[index].picNum = (i32)longTermFrameIdx;
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: Mmcop4
-
- Functional description:
- Function to set maxLongTermFrameIdx,
- memory_management_control_operation equal to 4
-
- Returns:
- HANTRO_OK success
-
-------------------------------------------------------------------------------*/
-
-static u32 Mmcop4(dpbStorage_t *dpb, u32 maxLongTermFrameIdx)
-{
-
-/* Variables */
-
- u32 i;
-
-/* Code */
-
- dpb->maxLongTermFrameIdx = maxLongTermFrameIdx;
-
- for (i = 0; i < dpb->maxRefFrames; i++)
- if (IS_LONG_TERM(dpb->buffer[i]) &&
- ( ((u32)dpb->buffer[i].picNum > maxLongTermFrameIdx) ||
- (dpb->maxLongTermFrameIdx == NO_LONG_TERM_FRAME_INDICES) ) )
- {
- SET_UNUSED(dpb->buffer[i]);
- dpb->numRefFrames--;
- if (!dpb->buffer[i].toBeDisplayed)
- dpb->fullness--;
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: Mmcop5
-
- Functional description:
- Function to mark all reference pictures unused for reference and
- set maxLongTermFrameIdx to NO_LONG_TERM_FRAME_INDICES,
- memory_management_control_operation equal to 5. Function flushes
- the buffer and places all pictures that are needed for display into
- the output buffer.
-
- Returns:
- HANTRO_OK success
-
-------------------------------------------------------------------------------*/
-
-static u32 Mmcop5(dpbStorage_t *dpb)
-{
-
-/* Variables */
-
- u32 i;
-
-/* Code */
-
- for (i = 0; i < 16; i++)
- {
- if (IS_REFERENCE(dpb->buffer[i]))
- {
- SET_UNUSED(dpb->buffer[i]);
- if (!dpb->buffer[i].toBeDisplayed)
- dpb->fullness--;
- }
- }
-
- /* output all pictures */
- while (OutputPicture(dpb) == HANTRO_OK)
- ;
- dpb->numRefFrames = 0;
- dpb->maxLongTermFrameIdx = NO_LONG_TERM_FRAME_INDICES;
- dpb->prevRefFrameNum = 0;
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: Mmcop6
-
- Functional description:
- Function to assign longTermFrameIdx to the current picture,
- memory_management_control_operation equal to 6
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK invalid longTermFrameIdx or no room for current
- picture in the buffer
-
-------------------------------------------------------------------------------*/
-
-static u32 Mmcop6(dpbStorage_t *dpb, u32 frameNum, i32 picOrderCnt,
- u32 longTermFrameIdx)
-{
-
-/* Variables */
-
- u32 i;
-
-/* Code */
-
- ASSERT(frameNum < dpb->maxFrameNum);
-
- if ( (dpb->maxLongTermFrameIdx == NO_LONG_TERM_FRAME_INDICES) ||
- (longTermFrameIdx > dpb->maxLongTermFrameIdx) )
- return(HANTRO_NOK);
-
- /* check if a long term picture with the same longTermFrameIdx already
- * exist and remove it if necessary */
- for (i = 0; i < dpb->maxRefFrames; i++)
- if (IS_LONG_TERM(dpb->buffer[i]) &&
- (u32)dpb->buffer[i].picNum == longTermFrameIdx)
- {
- SET_UNUSED(dpb->buffer[i]);
- dpb->numRefFrames--;
- if (!dpb->buffer[i].toBeDisplayed)
- dpb->fullness--;
- break;
- }
-
- if (dpb->numRefFrames < dpb->maxRefFrames)
- {
- dpb->currentOut->frameNum = frameNum;
- dpb->currentOut->picNum = (i32)longTermFrameIdx;
- dpb->currentOut->picOrderCnt = picOrderCnt;
- dpb->currentOut->status = LONG_TERM;
- if (dpb->noReordering)
- dpb->currentOut->toBeDisplayed = HANTRO_FALSE;
- else
- dpb->currentOut->toBeDisplayed = HANTRO_TRUE;
- dpb->numRefFrames++;
- dpb->fullness++;
- return(HANTRO_OK);
- }
- /* if there is no room, return an error */
- else
- return(HANTRO_NOK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdMarkDecRefPic
-
- Functional description:
- Function to perform reference picture marking process. This
- function should be called both for reference and non-reference
- pictures. Non-reference pictures shall have mark pointer set to
- NULL.
-
- Inputs:
- dpb pointer to the DPB data structure
- mark pointer to reference picture marking commands
- image pointer to current picture to be placed in the buffer
- frameNum frame number of the current picture
- picOrderCnt picture order count for the current picture
- isIdr flag to indicate if the current picture is an
- IDR picture
- currentPicId identifier for the current picture, from the
- application, stored along with the picture
- numErrMbs number of concealed macroblocks in the current
- picture, stored along with the picture
-
- Outputs:
- dpb 'buffer' modified, possible output frames placed into
- 'outBuf'
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK failure
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdMarkDecRefPic(
- dpbStorage_t *dpb,
- decRefPicMarking_t *mark,
- image_t *image,
- u32 frameNum,
- i32 picOrderCnt,
- u32 isIdr,
- u32 currentPicId,
- u32 numErrMbs)
-{
-
-/* Variables */
-
- u32 i, status;
- u32 markedAsLongTerm;
- u32 toBeDisplayed;
-
-/* Code */
-
- ASSERT(dpb);
- ASSERT(mark || !isIdr);
- ASSERT(!isIdr || (frameNum == 0 && picOrderCnt == 0));
- ASSERT(frameNum < dpb->maxFrameNum);
-
- if (image->data != dpb->currentOut->data)
- {
- EPRINT("TRYING TO MARK NON-ALLOCATED IMAGE");
- return(HANTRO_NOK);
- }
-
- dpb->lastContainsMmco5 = HANTRO_FALSE;
- status = HANTRO_OK;
-
- toBeDisplayed = dpb->noReordering ? HANTRO_FALSE : HANTRO_TRUE;
-
- /* non-reference picture, stored for display reordering purposes */
- if (mark == NULL)
- {
- dpb->currentOut->status = UNUSED;
- dpb->currentOut->frameNum = frameNum;
- dpb->currentOut->picNum = (i32)frameNum;
- dpb->currentOut->picOrderCnt = picOrderCnt;
- dpb->currentOut->toBeDisplayed = toBeDisplayed;
- if (!dpb->noReordering)
- dpb->fullness++;
- }
- /* IDR picture */
- else if (isIdr)
- {
-
- /* h264bsdCheckGapsInFrameNum not called for IDR pictures -> have to
- * reset numOut and outIndex here */
- dpb->numOut = dpb->outIndex = 0;
-
- /* flush the buffer */
- Mmcop5(dpb);
- /* if noOutputOfPriorPicsFlag was set -> the pictures preceding the
- * IDR picture shall not be output -> set output buffer empty */
- if (mark->noOutputOfPriorPicsFlag || dpb->noReordering)
- {
- dpb->numOut = 0;
- dpb->outIndex = 0;
- }
-
- if (mark->longTermReferenceFlag)
- {
- dpb->currentOut->status = LONG_TERM;
- dpb->maxLongTermFrameIdx = 0;
- }
- else
- {
- dpb->currentOut->status = SHORT_TERM;
- dpb->maxLongTermFrameIdx = NO_LONG_TERM_FRAME_INDICES;
- }
- dpb->currentOut->frameNum = 0;
- dpb->currentOut->picNum = 0;
- dpb->currentOut->picOrderCnt = 0;
- dpb->currentOut->toBeDisplayed = toBeDisplayed;
- dpb->fullness = 1;
- dpb->numRefFrames = 1;
- }
- /* reference picture */
- else
- {
- markedAsLongTerm = HANTRO_FALSE;
- if (mark->adaptiveRefPicMarkingModeFlag)
- {
- i = 0;
- while (mark->operation[i].memoryManagementControlOperation)
- {
- switch (mark->operation[i].memoryManagementControlOperation)
- {
- case 1:
- status = Mmcop1(
- dpb,
- frameNum,
- mark->operation[i].differenceOfPicNums);
- break;
-
- case 2:
- status = Mmcop2(dpb, mark->operation[i].longTermPicNum);
- break;
-
- case 3:
- status = Mmcop3(
- dpb,
- frameNum,
- mark->operation[i].differenceOfPicNums,
- mark->operation[i].longTermFrameIdx);
- break;
-
- case 4:
- status = Mmcop4(
- dpb,
- mark->operation[i].maxLongTermFrameIdx);
- break;
-
- case 5:
- status = Mmcop5(dpb);
- dpb->lastContainsMmco5 = HANTRO_TRUE;
- frameNum = 0;
- break;
-
- case 6:
- status = Mmcop6(
- dpb,
- frameNum,
- picOrderCnt,
- mark->operation[i].longTermFrameIdx);
- if (status == HANTRO_OK)
- markedAsLongTerm = HANTRO_TRUE;
- break;
-
- default: /* invalid memory management control operation */
- status = HANTRO_NOK;
- break;
- }
- if (status != HANTRO_OK)
- {
- break;
- }
- i++;
- }
- }
- else
- {
- status = SlidingWindowRefPicMarking(dpb);
- }
- /* if current picture was not marked as long-term reference by
- * memory management control operation 6 -> mark current as short
- * term and insert it into dpb (if there is room) */
- if (!markedAsLongTerm)
- {
- if (dpb->numRefFrames < dpb->maxRefFrames)
- {
- dpb->currentOut->frameNum = frameNum;
- dpb->currentOut->picNum = (i32)frameNum;
- dpb->currentOut->picOrderCnt = picOrderCnt;
- dpb->currentOut->status = SHORT_TERM;
- dpb->currentOut->toBeDisplayed = toBeDisplayed;
- dpb->fullness++;
- dpb->numRefFrames++;
- }
- /* no room */
- else
- {
- status = HANTRO_NOK;
- }
- }
- }
-
- dpb->currentOut->isIdr = isIdr;
- dpb->currentOut->picId = currentPicId;
- dpb->currentOut->numErrMbs = numErrMbs;
-
- /* dpb was initialized to not to reorder the pictures -> output current
- * picture immediately */
- if (dpb->noReordering)
- {
- ASSERT(dpb->numOut == 0);
- ASSERT(dpb->outIndex == 0);
- dpb->outBuf[dpb->numOut].data = dpb->currentOut->data;
- dpb->outBuf[dpb->numOut].isIdr = dpb->currentOut->isIdr;
- dpb->outBuf[dpb->numOut].picId = dpb->currentOut->picId;
- dpb->outBuf[dpb->numOut].numErrMbs = dpb->currentOut->numErrMbs;
- dpb->numOut++;
- }
- else
- {
- /* output pictures if buffer full */
- while (dpb->fullness > dpb->dpbSize)
- {
- i = OutputPicture(dpb);
- ASSERT(i == HANTRO_OK);
- }
- }
-
- /* sort dpb */
- ShellSort(dpb->buffer, dpb->dpbSize+1);
-
- return(status);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdGetRefPicData
-
- Functional description:
- Function to get reference picture data from the reference picture
- list
-
- Returns:
- pointer to desired reference picture data
- NULL if invalid index or non-existing picture referred
-
-------------------------------------------------------------------------------*/
-
-u8* h264bsdGetRefPicData(dpbStorage_t *dpb, u32 index)
-{
-
-/* Variables */
-
-/* Code */
-
- if(index > 16 || dpb->list[index] == NULL)
- return(NULL);
- else if(!IS_EXISTING(*dpb->list[index]))
- return(NULL);
- else
- return(dpb->list[index]->data);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdAllocateDpbImage
-
- Functional description:
- function to allocate memory for a image. This function does not
- really allocate any memory but reserves one of the buffer
- positions for decoding of current picture
-
- Returns:
- pointer to memory area for the image
-
-
-------------------------------------------------------------------------------*/
-
-u8* h264bsdAllocateDpbImage(dpbStorage_t *dpb)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT( !dpb->buffer[dpb->dpbSize].toBeDisplayed &&
- !IS_REFERENCE(dpb->buffer[dpb->dpbSize]) );
- ASSERT(dpb->fullness <= dpb->dpbSize);
-
- dpb->currentOut = dpb->buffer + dpb->dpbSize;
-
- return(dpb->currentOut->data);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: SlidingWindowRefPicMarking
-
- Functional description:
- Function to perform sliding window refence picture marking process.
-
- Outputs:
- HANTRO_OK success
- HANTRO_NOK failure, no short-term reference frame found that
- could be marked unused
-
-
-------------------------------------------------------------------------------*/
-
-static u32 SlidingWindowRefPicMarking(dpbStorage_t *dpb)
-{
-
-/* Variables */
-
- i32 index, picNum;
- u32 i;
-
-/* Code */
-
- if (dpb->numRefFrames < dpb->maxRefFrames)
- {
- return(HANTRO_OK);
- }
- else
- {
- index = -1;
- picNum = 0;
- /* find the oldest short term picture */
- for (i = 0; i < dpb->numRefFrames; i++)
- if (IS_SHORT_TERM(dpb->buffer[i]))
- if (dpb->buffer[i].picNum < picNum || index == -1)
- {
- index = (i32)i;
- picNum = dpb->buffer[i].picNum;
- }
- if (index >= 0)
- {
- SET_UNUSED(dpb->buffer[index]);
- dpb->numRefFrames--;
- if (!dpb->buffer[index].toBeDisplayed)
- dpb->fullness--;
-
- return(HANTRO_OK);
- }
- }
-
- return(HANTRO_NOK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdInitDpb
-
- Functional description:
- Function to initialize DPB. Reserves memories for the buffer,
- reference picture list and output buffer. dpbSize indicates
- the maximum DPB size indicated by the levelIdc in the stream.
- If noReordering flag is FALSE the DPB stores dpbSize pictures
- for display reordering purposes. On the other hand, if the
- flag is TRUE the DPB only stores maxRefFrames reference pictures
- and outputs all the pictures immediately.
-
- Inputs:
- picSizeInMbs picture size in macroblocks
- dpbSize size of the DPB (number of pictures)
- maxRefFrames max number of reference frames
- maxFrameNum max frame number
- noReordering flag to indicate that DPB does not have to
- prepare to reorder frames for display
-
- Outputs:
- dpb pointer to dpb data storage
-
- Returns:
- HANTRO_OK success
- MEMORY_ALLOCATION_ERROR if memory allocation failed
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdInitDpb(
- dpbStorage_t *dpb,
- u32 picSizeInMbs,
- u32 dpbSize,
- u32 maxRefFrames,
- u32 maxFrameNum,
- u32 noReordering)
-{
-
-/* Variables */
-
- u32 i;
-
-/* Code */
-
- ASSERT(picSizeInMbs);
- ASSERT(maxRefFrames <= MAX_NUM_REF_PICS);
- ASSERT(maxRefFrames <= dpbSize);
- ASSERT(maxFrameNum);
- ASSERT(dpbSize);
-
- // see comment in loop below about size calculation
- if (picSizeInMbs > (UINT32_MAX - 32 - 15) / 384) {
- ALOGE("b/28533562");
- android_errorWriteLog(0x534e4554, "28533562");
- return(MEMORY_ALLOCATION_ERROR);
- }
-
- dpb->maxLongTermFrameIdx = NO_LONG_TERM_FRAME_INDICES;
- dpb->maxRefFrames = MAX(maxRefFrames, 1);
- if (noReordering)
- dpb->dpbSize = dpb->maxRefFrames;
- else
- dpb->dpbSize = dpbSize;
- dpb->maxFrameNum = maxFrameNum;
- dpb->noReordering = noReordering;
- dpb->fullness = 0;
- dpb->numRefFrames = 0;
- dpb->prevRefFrameNum = 0;
-
- ALLOCATE(dpb->buffer, MAX_NUM_REF_IDX_L0_ACTIVE + 1, dpbPicture_t);
- if (dpb->buffer == NULL)
- return(MEMORY_ALLOCATION_ERROR);
- H264SwDecMemset(dpb->buffer, 0,
- (MAX_NUM_REF_IDX_L0_ACTIVE + 1)*sizeof(dpbPicture_t));
- for (i = 0; i < dpb->dpbSize + 1; i++)
- {
- /* Allocate needed amount of memory, which is:
- * image size + 32 + 15, where 32 cames from the fact that in ARM OpenMax
- * DL implementation Functions may read beyond the end of an array,
- * by a maximum of 32 bytes. And +15 cames for the need to align memory
- * to 16-byte boundary */
- ALLOCATE(dpb->buffer[i].pAllocatedData, (picSizeInMbs*384 + 32+15), u8);
- if (dpb->buffer[i].pAllocatedData == NULL)
- return(MEMORY_ALLOCATION_ERROR);
-
- dpb->buffer[i].data = ALIGN(dpb->buffer[i].pAllocatedData, 16);
- }
-
- ALLOCATE(dpb->list, MAX_NUM_REF_IDX_L0_ACTIVE + 1, dpbPicture_t*);
- ALLOCATE(dpb->outBuf, dpb->dpbSize+1, dpbOutPicture_t);
-
- if (dpb->list == NULL || dpb->outBuf == NULL)
- return(MEMORY_ALLOCATION_ERROR);
-
- H264SwDecMemset(dpb->list, 0,
- ((MAX_NUM_REF_IDX_L0_ACTIVE + 1) * sizeof(dpbPicture_t*)) );
-
- dpb->numOut = dpb->outIndex = 0;
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdResetDpb
-
- Functional description:
- Function to reset DPB. This function should be called when an IDR
- slice (other than the first) activates new sequence parameter set.
- Function calls h264bsdFreeDpb to free old allocated memories and
- h264bsdInitDpb to re-initialize the DPB. Same inputs, outputs and
- returns as for h264bsdInitDpb.
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdResetDpb(
- dpbStorage_t *dpb,
- u32 picSizeInMbs,
- u32 dpbSize,
- u32 maxRefFrames,
- u32 maxFrameNum,
- u32 noReordering)
-{
-
-/* Code */
-
- ASSERT(picSizeInMbs);
- ASSERT(maxRefFrames <= MAX_NUM_REF_PICS);
- ASSERT(maxRefFrames <= dpbSize);
- ASSERT(maxFrameNum);
- ASSERT(dpbSize);
-
- h264bsdFreeDpb(dpb);
-
- return h264bsdInitDpb(dpb, picSizeInMbs, dpbSize, maxRefFrames,
- maxFrameNum, noReordering);
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdInitRefPicList
-
- Functional description:
- Function to initialize reference picture list. Function just
- sets pointers in the list according to pictures in the buffer.
- The buffer is assumed to contain pictures sorted according to
- what the H.264 standard says about initial reference picture list.
-
- Inputs:
- dpb pointer to dpb data structure
-
- Outputs:
- dpb 'list' field initialized
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-
-void h264bsdInitRefPicList(dpbStorage_t *dpb)
-{
-
-/* Variables */
-
- u32 i;
-
-/* Code */
-
- for (i = 0; i < dpb->numRefFrames; i++)
- dpb->list[i] = &dpb->buffer[i];
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: FindDpbPic
-
- Functional description:
- Function to find a reference picture from the buffer. The picture
- to be found is identified by picNum and isShortTerm flag.
-
- Returns:
- index of the picture in the buffer
- -1 if the specified picture was not found in the buffer
-
-------------------------------------------------------------------------------*/
-
-static i32 FindDpbPic(dpbStorage_t *dpb, i32 picNum, u32 isShortTerm)
-{
-
-/* Variables */
-
- u32 i = 0;
- u32 found = HANTRO_FALSE;
-
-/* Code */
-
- if (isShortTerm)
- {
- while (i < dpb->maxRefFrames && !found)
- {
- if (IS_SHORT_TERM(dpb->buffer[i]) &&
- dpb->buffer[i].picNum == picNum)
- found = HANTRO_TRUE;
- else
- i++;
- }
- }
- else
- {
- ASSERT(picNum >= 0);
- while (i < dpb->maxRefFrames && !found)
- {
- if (IS_LONG_TERM(dpb->buffer[i]) &&
- dpb->buffer[i].picNum == picNum)
- found = HANTRO_TRUE;
- else
- i++;
- }
- }
-
- if (found)
- return((i32)i);
- else
- return(-1);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: SetPicNums
-
- Functional description:
- Function to set picNum values for short-term pictures in the
- buffer. Numbering of pictures is based on frame numbers and as
- frame numbers are modulo maxFrameNum -> frame numbers of older
- pictures in the buffer may be bigger than the currFrameNum.
- picNums will be set so that current frame has the largest picNum
- and all the short-term frames in the buffer will get smaller picNum
- representing their "distance" from the current frame. This
- function kind of maps the modulo arithmetic back to normal.
-
-------------------------------------------------------------------------------*/
-
-static void SetPicNums(dpbStorage_t *dpb, u32 currFrameNum)
-{
-
-/* Variables */
-
- u32 i;
- i32 frameNumWrap;
-
-/* Code */
-
- ASSERT(dpb);
- ASSERT(currFrameNum < dpb->maxFrameNum);
-
- for (i = 0; i < dpb->numRefFrames; i++)
- if (IS_SHORT_TERM(dpb->buffer[i]))
- {
- if (dpb->buffer[i].frameNum > currFrameNum)
- frameNumWrap =
- (i32)dpb->buffer[i].frameNum - (i32)dpb->maxFrameNum;
- else
- frameNumWrap = (i32)dpb->buffer[i].frameNum;
- dpb->buffer[i].picNum = frameNumWrap;
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdCheckGapsInFrameNum
-
- Functional description:
- Function to check gaps in frame_num and generate non-existing
- (short term) reference pictures if necessary. This function should
- be called only for non-IDR pictures.
-
- Inputs:
- dpb pointer to dpb data structure
- frameNum frame number of the current picture
- isRefPic flag to indicate if current picture is a reference or
- non-reference picture
- gapsAllowed Flag which indicates active SPS stance on whether
- to allow gaps
-
- Outputs:
- dpb 'buffer' possibly modified by inserting non-existing
- pictures with sliding window marking process
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK error in sliding window reference picture marking or
- frameNum equal to previous reference frame used for
- a reference picture
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdCheckGapsInFrameNum(dpbStorage_t *dpb, u32 frameNum, u32 isRefPic,
- u32 gapsAllowed)
-{
-
-/* Variables */
-
- u32 unUsedShortTermFrameNum;
- u8 *tmp;
-
-/* Code */
-
- ASSERT(dpb);
- ASSERT(dpb->fullness <= dpb->dpbSize);
- ASSERT(frameNum < dpb->maxFrameNum);
-
- dpb->numOut = 0;
- dpb->outIndex = 0;
-
- if(!gapsAllowed)
- return(HANTRO_OK);
-
- if ( (frameNum != dpb->prevRefFrameNum) &&
- (frameNum != ((dpb->prevRefFrameNum + 1) % dpb->maxFrameNum)))
- {
-
- unUsedShortTermFrameNum = (dpb->prevRefFrameNum + 1) % dpb->maxFrameNum;
-
- /* store data pointer of last buffer position to be used as next
- * "allocated" data pointer if last buffer position after this process
- * contains data pointer located in outBuf (buffer placed in the output
- * shall not be overwritten by the current picture) */
- tmp = dpb->buffer[dpb->dpbSize].data;
- do
- {
- SetPicNums(dpb, unUsedShortTermFrameNum);
-
- if (SlidingWindowRefPicMarking(dpb) != HANTRO_OK)
- {
- return(HANTRO_NOK);
- }
-
- /* output pictures if buffer full */
- while (dpb->fullness >= dpb->dpbSize)
- {
-#ifdef _ASSERT_USED
- ASSERT(!dpb->noReordering);
- ASSERT(OutputPicture(dpb) == HANTRO_OK);
-#else
- OutputPicture(dpb);
-#endif
- }
-
- /* add to end of list */
- ASSERT( !dpb->buffer[dpb->dpbSize].toBeDisplayed &&
- !IS_REFERENCE(dpb->buffer[dpb->dpbSize]) );
- dpb->buffer[dpb->dpbSize].status = NON_EXISTING;
- dpb->buffer[dpb->dpbSize].frameNum = unUsedShortTermFrameNum;
- dpb->buffer[dpb->dpbSize].picNum = (i32)unUsedShortTermFrameNum;
- dpb->buffer[dpb->dpbSize].picOrderCnt = 0;
- dpb->buffer[dpb->dpbSize].toBeDisplayed = HANTRO_FALSE;
- dpb->fullness++;
- dpb->numRefFrames++;
-
- /* sort the buffer */
- ShellSort(dpb->buffer, dpb->dpbSize+1);
-
- unUsedShortTermFrameNum = (unUsedShortTermFrameNum + 1) %
- dpb->maxFrameNum;
-
- } while (unUsedShortTermFrameNum != frameNum);
-
- /* pictures placed in output buffer -> check that 'data' in
- * buffer position dpbSize is not in the output buffer (this will be
- * "allocated" by h264bsdAllocateDpbImage). If it is -> exchange data
- * pointer with the one stored in the beginning */
- if (dpb->numOut)
- {
- u32 i;
-
- for (i = 0; i < dpb->numOut; i++)
- {
- if (dpb->outBuf[i].data == dpb->buffer[dpb->dpbSize].data)
- {
- /* find buffer position containing data pointer stored in
- * tmp */
- for (i = 0; i < dpb->dpbSize; i++)
- {
- if (dpb->buffer[i].data == tmp)
- {
- dpb->buffer[i].data =
- dpb->buffer[dpb->dpbSize].data;
- dpb->buffer[dpb->dpbSize].data = tmp;
- break;
- }
- }
- ASSERT(i < dpb->dpbSize);
- break;
- }
- }
- }
- }
- /* frameNum for reference pictures shall not be the same as for previous
- * reference picture, otherwise accesses to pictures in the buffer cannot
- * be solved unambiguously */
- else if (isRefPic && frameNum == dpb->prevRefFrameNum)
- {
- return(HANTRO_NOK);
- }
-
- /* save current frame_num in prevRefFrameNum. For non-reference frame
- * prevFrameNum is set to frame number of last non-existing frame above */
- if (isRefPic)
- dpb->prevRefFrameNum = frameNum;
- else if (frameNum != dpb->prevRefFrameNum)
- {
- dpb->prevRefFrameNum =
- (frameNum + dpb->maxFrameNum - 1) % dpb->maxFrameNum;
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: FindSmallestPicOrderCnt
-
- Functional description:
- Function to find picture with smallest picture order count. This
- will be the next picture in display order.
-
- Returns:
- pointer to the picture, NULL if no pictures to be displayed
-
-------------------------------------------------------------------------------*/
-
-dpbPicture_t* FindSmallestPicOrderCnt(dpbStorage_t *dpb)
-{
-
-/* Variables */
-
- u32 i;
- i32 picOrderCnt;
- dpbPicture_t *tmp;
-
-/* Code */
-
- ASSERT(dpb);
-
- picOrderCnt = 0x7FFFFFFF;
- tmp = NULL;
-
- for (i = 0; i <= dpb->dpbSize; i++)
- {
- if (dpb->buffer[i].toBeDisplayed &&
- (dpb->buffer[i].picOrderCnt < picOrderCnt))
- {
- tmp = dpb->buffer + i;
- picOrderCnt = dpb->buffer[i].picOrderCnt;
- }
- }
-
- return(tmp);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: OutputPicture
-
- Functional description:
- Function to put next display order picture into the output buffer.
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK no pictures to display
-
-------------------------------------------------------------------------------*/
-
-u32 OutputPicture(dpbStorage_t *dpb)
-{
-
-/* Variables */
-
- dpbPicture_t *tmp;
-
-/* Code */
-
- ASSERT(dpb);
-
- if (dpb->noReordering)
- return(HANTRO_NOK);
-
- tmp = FindSmallestPicOrderCnt(dpb);
-
- /* no pictures to be displayed */
- if (tmp == NULL)
- return(HANTRO_NOK);
-
- dpb->outBuf[dpb->numOut].data = tmp->data;
- dpb->outBuf[dpb->numOut].isIdr = tmp->isIdr;
- dpb->outBuf[dpb->numOut].picId = tmp->picId;
- dpb->outBuf[dpb->numOut].numErrMbs = tmp->numErrMbs;
- dpb->numOut++;
-
- tmp->toBeDisplayed = HANTRO_FALSE;
- if (!IS_REFERENCE(*tmp))
- {
- dpb->fullness--;
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdDpbOutputPicture
-
- Functional description:
- Function to get next display order picture from the output buffer.
-
- Return:
- pointer to output picture structure, NULL if no pictures to
- display
-
-------------------------------------------------------------------------------*/
-
-dpbOutPicture_t* h264bsdDpbOutputPicture(dpbStorage_t *dpb)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(dpb);
-
- if (dpb->outIndex < dpb->numOut)
- return(dpb->outBuf + dpb->outIndex++);
- else
- return(NULL);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdFlushDpb
-
- Functional description:
- Function to flush the DPB. Function puts all pictures needed for
- display into the output buffer. This function shall be called in
- the end of the stream to obtain pictures buffered for display
- re-ordering purposes.
-
-------------------------------------------------------------------------------*/
-
-void h264bsdFlushDpb(dpbStorage_t *dpb)
-{
-
- /* don't do anything if buffer not reserved */
- if (dpb->buffer)
- {
- dpb->flushed = 1;
- /* output all pictures */
- while (OutputPicture(dpb) == HANTRO_OK)
- ;
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdFreeDpb
-
- Functional description:
- Function to free memories reserved for the DPB.
-
-------------------------------------------------------------------------------*/
-
-void h264bsdFreeDpb(dpbStorage_t *dpb)
-{
-
-/* Variables */
-
- u32 i;
-
-/* Code */
-
- ASSERT(dpb);
-
- if (dpb->buffer)
- {
- for (i = 0; i < dpb->dpbSize+1; i++)
- {
- FREE(dpb->buffer[i].pAllocatedData);
- }
- }
- FREE(dpb->buffer);
- FREE(dpb->list);
- FREE(dpb->outBuf);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: ShellSort
-
- Functional description:
- Sort pictures in the buffer. Function implements Shell's method,
- i.e. diminishing increment sort. See e.g. "Numerical Recipes in C"
- for more information.
-
-------------------------------------------------------------------------------*/
-
-static void ShellSort(dpbPicture_t *pPic, u32 num)
-{
-
- u32 i, j;
- u32 step;
- dpbPicture_t tmpPic;
-
- step = 7;
-
- while (step)
- {
- for (i = step; i < num; i++)
- {
- tmpPic = pPic[i];
- j = i;
- while (j >= step && ComparePictures(pPic + j - step, &tmpPic) > 0)
- {
- pPic[j] = pPic[j-step];
- j -= step;
- }
- pPic[j] = tmpPic;
- }
- step >>= 1;
- }
-
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_dpb.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_dpb.h
deleted file mode 100644
index 0e25084..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_dpb.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_DPB_H
-#define H264SWDEC_DPB_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_slice_header.h"
-#include "h264bsd_image.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-/* enumeration to represent status of buffered image */
-typedef enum {
- UNUSED = 0,
- NON_EXISTING,
- SHORT_TERM,
- LONG_TERM
-} dpbPictureStatus_e;
-
-/* structure to represent a buffered picture */
-typedef struct {
- u8 *data; /* 16-byte aligned pointer of pAllocatedData */
- u8 *pAllocatedData; /* allocated picture pointer; (size + 15) bytes */
- i32 picNum;
- u32 frameNum;
- i32 picOrderCnt;
- dpbPictureStatus_e status;
- u32 toBeDisplayed;
- u32 picId;
- u32 numErrMbs;
- u32 isIdr;
-} dpbPicture_t;
-
-/* structure to represent display image output from the buffer */
-typedef struct {
- u8 *data;
- u32 picId;
- u32 numErrMbs;
- u32 isIdr;
-} dpbOutPicture_t;
-
-/* structure to represent DPB */
-typedef struct {
- dpbPicture_t *buffer;
- dpbPicture_t **list;
- dpbPicture_t *currentOut;
- dpbOutPicture_t *outBuf;
- u32 numOut;
- u32 outIndex;
- u32 maxRefFrames;
- u32 dpbSize;
- u32 maxFrameNum;
- u32 maxLongTermFrameIdx;
- u32 numRefFrames;
- u32 fullness;
- u32 prevRefFrameNum;
- u32 lastContainsMmco5;
- u32 noReordering;
- u32 flushed;
-} dpbStorage_t;
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-u32 h264bsdInitDpb(
- dpbStorage_t *dpb,
- u32 picSizeInMbs,
- u32 dpbSize,
- u32 numRefFrames,
- u32 maxFrameNum,
- u32 noReordering);
-
-u32 h264bsdResetDpb(
- dpbStorage_t *dpb,
- u32 picSizeInMbs,
- u32 dpbSize,
- u32 numRefFrames,
- u32 maxFrameNum,
- u32 noReordering);
-
-void h264bsdInitRefPicList(dpbStorage_t *dpb);
-
-u8* h264bsdAllocateDpbImage(dpbStorage_t *dpb);
-
-u8* h264bsdGetRefPicData(dpbStorage_t *dpb, u32 index);
-
-u32 h264bsdReorderRefPicList(
- dpbStorage_t *dpb,
- refPicListReordering_t *order,
- u32 currFrameNum,
- u32 numRefIdxActive);
-
-u32 h264bsdMarkDecRefPic(
- dpbStorage_t *dpb,
- decRefPicMarking_t *mark,
- image_t *image,
- u32 frameNum,
- i32 picOrderCnt,
- u32 isIdr,
- u32 picId,
- u32 numErrMbs);
-
-u32 h264bsdCheckGapsInFrameNum(dpbStorage_t *dpb, u32 frameNum, u32 isRefPic,
- u32 gapsAllowed);
-
-dpbOutPicture_t* h264bsdDpbOutputPicture(dpbStorage_t *dpb);
-
-void h264bsdFlushDpb(dpbStorage_t *dpb);
-
-void h264bsdFreeDpb(dpbStorage_t *dpb);
-
-#endif /* #ifdef H264SWDEC_DPB_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_image.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_image.c
deleted file mode 100644
index 7b92870..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_image.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdWriteMacroblock
- h264bsdWriteOutputBlocks
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_image.h"
-#include "h264bsd_util.h"
-#include "h264bsd_neighbour.h"
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-/* x- and y-coordinates for each block, defined in h264bsd_intra_prediction.c */
-extern const u32 h264bsdBlockX[];
-extern const u32 h264bsdBlockY[];
-
-/* clipping table, defined in h264bsd_intra_prediction.c */
-extern const u8 h264bsdClip[];
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdWriteMacroblock
-
- Functional description:
- Write one macroblock into the image. Both luma and chroma
- components will be written at the same time.
-
- Inputs:
- data pointer to macroblock data to be written, 256 values for
- luma followed by 64 values for both chroma components
-
- Outputs:
- image pointer to the image where the macroblock will be written
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-#ifndef H264DEC_NEON
-void h264bsdWriteMacroblock(image_t *image, u8 *data)
-{
-
-/* Variables */
-
- u32 i;
- u32 width;
- u32 *lum, *cb, *cr;
- u32 *ptr;
- u32 tmp1, tmp2;
-
-/* Code */
-
- ASSERT(image);
- ASSERT(data);
- ASSERT(!((u32)data&0x3));
-
- width = image->width;
-
- /*lint -save -e826 lum, cb and cr used to copy 4 bytes at the time, disable
- * "area too small" info message */
- lum = (u32*)image->luma;
- cb = (u32*)image->cb;
- cr = (u32*)image->cr;
- ASSERT(!((u32)lum&0x3));
- ASSERT(!((u32)cb&0x3));
- ASSERT(!((u32)cr&0x3));
-
- ptr = (u32*)data;
-
- width *= 4;
- for (i = 16; i ; i--)
- {
- tmp1 = *ptr++;
- tmp2 = *ptr++;
- *lum++ = tmp1;
- *lum++ = tmp2;
- tmp1 = *ptr++;
- tmp2 = *ptr++;
- *lum++ = tmp1;
- *lum++ = tmp2;
- lum += width-4;
- }
-
- width >>= 1;
- for (i = 8; i ; i--)
- {
- tmp1 = *ptr++;
- tmp2 = *ptr++;
- *cb++ = tmp1;
- *cb++ = tmp2;
- cb += width-2;
- }
-
- for (i = 8; i ; i--)
- {
- tmp1 = *ptr++;
- tmp2 = *ptr++;
- *cr++ = tmp1;
- *cr++ = tmp2;
- cr += width-2;
- }
-
-}
-#endif
-#ifndef H264DEC_OMXDL
-/*------------------------------------------------------------------------------
-
- Function: h264bsdWriteOutputBlocks
-
- Functional description:
- Write one macroblock into the image. Prediction for the macroblock
- and the residual are given separately and will be combined while
- writing the data to the image
-
- Inputs:
- data pointer to macroblock prediction data, 256 values for
- luma followed by 64 values for both chroma components
- mbNum number of the macroblock
- residual pointer to residual data, 16 16-element arrays for luma
- followed by 4 16-element arrays for both chroma
- components
-
- Outputs:
- image pointer to the image where the data will be written
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-
-void h264bsdWriteOutputBlocks(image_t *image, u32 mbNum, u8 *data,
- i32 residual[][16])
-{
-
-/* Variables */
-
- u32 i;
- u32 picWidth, picSize;
- u8 *lum, *cb, *cr;
- u8 *imageBlock;
- u8 *tmp;
- u32 row, col;
- u32 block;
- u32 x, y;
- i32 *pRes;
- i32 tmp1, tmp2, tmp3, tmp4;
- const u8 *clp = h264bsdClip + 512;
-
-/* Code */
-
- ASSERT(image);
- ASSERT(data);
- ASSERT(mbNum < image->width * image->height);
- ASSERT(!((u32)data&0x3));
-
- /* Image size in macroblocks */
- picWidth = image->width;
- picSize = picWidth * image->height;
- row = mbNum / picWidth;
- col = mbNum % picWidth;
-
- /* Output macroblock position in output picture */
- lum = (image->data + row * picWidth * 256 + col * 16);
- cb = (image->data + picSize * 256 + row * picWidth * 64 + col * 8);
- cr = (cb + picSize * 64);
-
- picWidth *= 16;
-
- for (block = 0; block < 16; block++)
- {
- x = h264bsdBlockX[block];
- y = h264bsdBlockY[block];
-
- pRes = residual[block];
-
- ASSERT(pRes);
-
- tmp = data + y*16 + x;
- imageBlock = lum + y*picWidth + x;
-
- ASSERT(!((u32)tmp&0x3));
- ASSERT(!((u32)imageBlock&0x3));
-
- if (IS_RESIDUAL_EMPTY(pRes))
- {
- /*lint -e826 */
- i32 *in32 = (i32*)tmp;
- i32 *out32 = (i32*)imageBlock;
-
- /* Residual is zero => copy prediction block to output */
- tmp1 = *in32; in32 += 4;
- tmp2 = *in32; in32 += 4;
- *out32 = tmp1; out32 += picWidth/4;
- *out32 = tmp2; out32 += picWidth/4;
- tmp1 = *in32; in32 += 4;
- tmp2 = *in32;
- *out32 = tmp1; out32 += picWidth/4;
- *out32 = tmp2;
- }
- else
- {
-
- RANGE_CHECK_ARRAY(pRes, -512, 511, 16);
-
- /* Calculate image = prediction + residual
- * Process four pixels in a loop */
- for (i = 4; i; i--)
- {
- tmp1 = tmp[0];
- tmp2 = *pRes++;
- tmp3 = tmp[1];
- tmp1 = clp[tmp1 + tmp2];
- tmp4 = *pRes++;
- imageBlock[0] = (u8)tmp1;
- tmp3 = clp[tmp3 + tmp4];
- tmp1 = tmp[2];
- tmp2 = *pRes++;
- imageBlock[1] = (u8)tmp3;
- tmp1 = clp[tmp1 + tmp2];
- tmp3 = tmp[3];
- tmp4 = *pRes++;
- imageBlock[2] = (u8)tmp1;
- tmp3 = clp[tmp3 + tmp4];
- tmp += 16;
- imageBlock[3] = (u8)tmp3;
- imageBlock += picWidth;
- }
- }
-
- }
-
- picWidth /= 2;
-
- for (block = 16; block <= 23; block++)
- {
- x = h264bsdBlockX[block & 0x3];
- y = h264bsdBlockY[block & 0x3];
-
- pRes = residual[block];
-
- ASSERT(pRes);
-
- tmp = data + 256;
- imageBlock = cb;
-
- if (block >= 20)
- {
- imageBlock = cr;
- tmp += 64;
- }
-
- tmp += y*8 + x;
- imageBlock += y*picWidth + x;
-
- ASSERT(!((u32)tmp&0x3));
- ASSERT(!((u32)imageBlock&0x3));
-
- if (IS_RESIDUAL_EMPTY(pRes))
- {
- /*lint -e826 */
- i32 *in32 = (i32*)tmp;
- i32 *out32 = (i32*)imageBlock;
-
- /* Residual is zero => copy prediction block to output */
- tmp1 = *in32; in32 += 2;
- tmp2 = *in32; in32 += 2;
- *out32 = tmp1; out32 += picWidth/4;
- *out32 = tmp2; out32 += picWidth/4;
- tmp1 = *in32; in32 += 2;
- tmp2 = *in32;
- *out32 = tmp1; out32 += picWidth/4;
- *out32 = tmp2;
- }
- else
- {
-
- RANGE_CHECK_ARRAY(pRes, -512, 511, 16);
-
- for (i = 4; i; i--)
- {
- tmp1 = tmp[0];
- tmp2 = *pRes++;
- tmp3 = tmp[1];
- tmp1 = clp[tmp1 + tmp2];
- tmp4 = *pRes++;
- imageBlock[0] = (u8)tmp1;
- tmp3 = clp[tmp3 + tmp4];
- tmp1 = tmp[2];
- tmp2 = *pRes++;
- imageBlock[1] = (u8)tmp3;
- tmp1 = clp[tmp1 + tmp2];
- tmp3 = tmp[3];
- tmp4 = *pRes++;
- imageBlock[2] = (u8)tmp1;
- tmp3 = clp[tmp3 + tmp4];
- tmp += 8;
- imageBlock[3] = (u8)tmp3;
- imageBlock += picWidth;
- }
- }
- }
-
-}
-#endif /* H264DEC_OMXDL */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_image.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_image.h
deleted file mode 100644
index ed7c18c..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_image.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_IMAGE_H
-#define H264SWDEC_IMAGE_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-typedef struct
-{
- u8 *data;
- u32 width;
- u32 height;
- /* current MB's components */
- u8 *luma;
- u8 *cb;
- u8 *cr;
-} image_t;
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-void h264bsdWriteMacroblock(image_t *image, u8 *data);
-
-#ifndef H264DEC_OMXDL
-void h264bsdWriteOutputBlocks(image_t *image, u32 mbNum, u8 *data,
- i32 residual[][16]);
-#endif
-
-#endif /* #ifdef H264SWDEC_IMAGE_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_inter_prediction.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_inter_prediction.c
deleted file mode 100644
index 2a81c4a..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_inter_prediction.c
+++ /dev/null
@@ -1,1027 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdInterPrediction
- MvPrediction16x16
- MvPrediction16x8
- MvPrediction8x16
- MvPrediction8x8
- MvPrediction
- MedianFilter
- GetInterNeighbour
- GetPredictionMv
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_inter_prediction.h"
-#include "h264bsd_neighbour.h"
-#include "h264bsd_util.h"
-#include "h264bsd_reconstruct.h"
-#include "h264bsd_dpb.h"
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-typedef struct
-{
- u32 available;
- u32 refIndex;
- mv_t mv;
-} interNeighbour_t;
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-static u32 MvPrediction16x16(mbStorage_t *pMb, mbPred_t *mbPred,
- dpbStorage_t *dpb);
-static u32 MvPrediction16x8(mbStorage_t *pMb, mbPred_t *mbPred,
- dpbStorage_t *dpb);
-static u32 MvPrediction8x16(mbStorage_t *pMb, mbPred_t *mbPred,
- dpbStorage_t *dpb);
-static u32 MvPrediction8x8(mbStorage_t *pMb, subMbPred_t *subMbPred,
- dpbStorage_t *dpb);
-static u32 MvPrediction(mbStorage_t *pMb, subMbPred_t *subMbPred,
- u32 mbPartIdx, u32 subMbPartIdx);
-static i32 MedianFilter(i32 a, i32 b, i32 c);
-
-static void GetInterNeighbour(u32 sliceId, mbStorage_t *nMb,
- interNeighbour_t *n, u32 index);
-static void GetPredictionMv(mv_t *mv, interNeighbour_t *a, u32 refIndex);
-
-static const neighbour_t N_A_SUB_PART[4][4][4] = {
- { { {MB_A,5}, {MB_NA,0}, {MB_NA,0}, {MB_NA,0} },
- { {MB_A,5}, {MB_A,7}, {MB_NA,0}, {MB_NA,0} },
- { {MB_A,5}, {MB_CURR,0}, {MB_NA,0}, {MB_NA,0} },
- { {MB_A,5}, {MB_CURR,0}, {MB_A,7}, {MB_CURR,2} } },
-
- { { {MB_CURR,1}, {MB_NA,0}, {MB_NA,0}, {MB_NA,0} },
- { {MB_CURR,1}, {MB_CURR,3}, {MB_NA,0}, {MB_NA,0} },
- { {MB_CURR,1}, {MB_CURR,4}, {MB_NA,0}, {MB_NA,0} },
- { {MB_CURR,1}, {MB_CURR,4}, {MB_CURR,3}, {MB_CURR,6} } },
-
- { { {MB_A,13}, {MB_NA,0}, {MB_NA,0}, {MB_NA,0} },
- { {MB_A,13}, {MB_A,15}, {MB_NA,0}, {MB_NA,0} },
- { {MB_A,13}, {MB_CURR,8}, {MB_NA,0}, {MB_NA,0} },
- { {MB_A,13}, {MB_CURR,8}, {MB_A,15}, {MB_CURR,10} } },
-
- { { {MB_CURR,9}, {MB_NA,0}, {MB_NA,0}, {MB_NA,0} },
- { {MB_CURR,9}, {MB_CURR,11}, {MB_NA,0}, {MB_NA,0} },
- { {MB_CURR,9}, {MB_CURR,12}, {MB_NA,0}, {MB_NA,0} },
- { {MB_CURR,9}, {MB_CURR,12}, {MB_CURR,11}, {MB_CURR,14} } } };
-
-static const neighbour_t N_B_SUB_PART[4][4][4] = {
- { { {MB_B,10}, {MB_NA,0}, {MB_NA,0}, {MB_NA,0} },
- { {MB_B,10}, {MB_CURR,0}, {MB_NA,0}, {MB_NA,0} },
- { {MB_B,10}, {MB_B,11}, {MB_NA,0}, {MB_NA,0} },
- { {MB_B,10}, {MB_B,11}, {MB_CURR,0}, {MB_CURR,1} } },
-
- { { {MB_B,14}, {MB_NA,0}, {MB_NA,0}, {MB_NA,0} },
- { {MB_B,14}, {MB_CURR,4}, {MB_NA,0}, {MB_NA,0} },
- { {MB_B,14}, {MB_B,15}, {MB_NA,0}, {MB_NA,0} },
- { {MB_B,14}, {MB_B,15}, {MB_CURR,4}, {MB_CURR,5} } },
-
- { { {MB_CURR,2}, {MB_NA,0}, {MB_NA,0}, {MB_NA,0} },
- { {MB_CURR,2}, {MB_CURR,8}, {MB_NA,0}, {MB_NA,0} },
- { {MB_CURR,2}, {MB_CURR,3}, {MB_NA,0}, {MB_NA,0} },
- { {MB_CURR,2}, {MB_CURR,3}, {MB_CURR,8}, {MB_CURR,9} } },
-
- { { {MB_CURR,6}, {MB_NA,0}, {MB_NA,0}, {MB_NA,0} },
- { {MB_CURR,6}, {MB_CURR,12}, {MB_NA,0}, {MB_NA,0} },
- { {MB_CURR,6}, {MB_CURR,7}, {MB_NA,0}, {MB_NA,0} },
- { {MB_CURR,6}, {MB_CURR,7}, {MB_CURR,12}, {MB_CURR,13} } } };
-
-static const neighbour_t N_C_SUB_PART[4][4][4] = {
- { { {MB_B,14}, {MB_NA,0}, {MB_NA,0}, {MB_NA,0} },
- { {MB_B,14}, {MB_NA,4}, {MB_NA,0}, {MB_NA,0} },
- { {MB_B,11}, {MB_B,14}, {MB_NA,0}, {MB_NA,0} },
- { {MB_B,11}, {MB_B,14}, {MB_CURR,1}, {MB_NA,4} } },
-
- { { {MB_C,10}, {MB_NA,0}, {MB_NA,0}, {MB_NA,0} },
- { {MB_C,10}, {MB_NA,0}, {MB_NA,0}, {MB_NA,0} },
- { {MB_B,15}, {MB_C,10}, {MB_NA,0}, {MB_NA,0} },
- { {MB_B,15}, {MB_C,10}, {MB_CURR,5}, {MB_NA,0} } },
-
- { { {MB_CURR,6}, {MB_NA,0}, {MB_NA,0}, {MB_NA,0} },
- { {MB_CURR,6}, {MB_NA,12}, {MB_NA,0}, {MB_NA,0} },
- { {MB_CURR,3}, {MB_CURR,6}, {MB_NA,0}, {MB_NA,0} },
- { {MB_CURR,3}, {MB_CURR,6}, {MB_CURR,9}, {MB_NA,12} } },
-
- { { {MB_NA,2}, {MB_NA,0}, {MB_NA,0}, {MB_NA,0} },
- { {MB_NA,2}, {MB_NA,8}, {MB_NA,0}, {MB_NA,0} },
- { {MB_CURR,7}, {MB_NA,2}, {MB_NA,0}, {MB_NA,0} },
- { {MB_CURR,7}, {MB_NA,2}, {MB_CURR,13}, {MB_NA,8} } } };
-
-static const neighbour_t N_D_SUB_PART[4][4][4] = {
- { { {MB_D,15}, {MB_NA,0}, {MB_NA,0}, {MB_NA,0} },
- { {MB_D,15}, {MB_A,5}, {MB_NA,0}, {MB_NA,0} },
- { {MB_D,15}, {MB_B,10}, {MB_NA,0}, {MB_NA,0} },
- { {MB_D,15}, {MB_B,10}, {MB_A,5}, {MB_CURR,0} } },
-
- { { {MB_B,11}, {MB_NA,0}, {MB_NA,0}, {MB_NA,0} },
- { {MB_B,11}, {MB_CURR,1}, {MB_NA,0}, {MB_NA,0} },
- { {MB_B,11}, {MB_B,14}, {MB_NA,0}, {MB_NA,0} },
- { {MB_B,11}, {MB_B,14}, {MB_CURR,1}, {MB_CURR,4} } },
-
- { { {MB_A,7}, {MB_NA,0}, {MB_NA,0}, {MB_NA,0} },
- { {MB_A,7}, {MB_A,13}, {MB_NA,0}, {MB_NA,0} },
- { {MB_A,7}, {MB_CURR,2}, {MB_NA,0}, {MB_NA,0} },
- { {MB_A,7}, {MB_CURR,2}, {MB_A,13}, {MB_CURR,8} } },
-
- { { {MB_CURR,3}, {MB_NA,0}, {MB_NA,0}, {MB_NA,0} },
- { {MB_CURR,3}, {MB_CURR,9}, {MB_NA,0}, {MB_NA,0} },
- { {MB_CURR,3}, {MB_CURR,6}, {MB_NA,0}, {MB_NA,0} },
- { {MB_CURR,3}, {MB_CURR,6}, {MB_CURR,9}, {MB_CURR,12} } } };
-
-
-#ifdef H264DEC_OMXDL
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdInterPrediction
-
- Functional description:
- Processes one inter macroblock. Performs motion vector prediction
- and reconstructs prediction macroblock. Writes the final macroblock
- (prediction + residual) into the output image (currImage)
-
- Inputs:
- pMb pointer to macroblock specific information
- pMbLayer pointer to current macroblock data from stream
- dpb pointer to decoded picture buffer
- mbNum current macroblock number
- currImage pointer to output image
- data pointer where predicted macroblock will be stored
-
- Outputs:
- pMb structure is updated with current macroblock
- currImage current macroblock is written into image
- data prediction is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK error in motion vector prediction
-
-------------------------------------------------------------------------------*/
-u32 h264bsdInterPrediction(mbStorage_t *pMb, macroblockLayer_t *pMbLayer,
- dpbStorage_t *dpb, u32 mbNum, image_t *currImage, u8 *data)
-{
-
-/* Variables */
-
- u32 i;
- u32 x, y;
- u32 colAndRow;
- subMbPartMode_e subPartMode;
- image_t refImage;
- u8 fillBuff[32*21 + 15 + 32];
- u8 *pFill;
- u32 tmp;
-/* Code */
-
- ASSERT(pMb);
- ASSERT(h264bsdMbPartPredMode(pMb->mbType) == PRED_MODE_INTER);
- ASSERT(pMbLayer);
-
- /* 16-byte alignment */
- pFill = ALIGN(fillBuff, 16);
-
- /* set row bits 15:0 */
- colAndRow = mbNum / currImage->width;
- /*set col to bits 31:16 */
- colAndRow += (mbNum - colAndRow * currImage->width) << 16;
- colAndRow <<= 4;
-
- refImage.width = currImage->width;
- refImage.height = currImage->height;
-
- switch (pMb->mbType)
- {
- case P_Skip:
- case P_L0_16x16:
- if (MvPrediction16x16(pMb, &pMbLayer->mbPred, dpb) != HANTRO_OK)
- return(HANTRO_NOK);
- refImage.data = pMb->refAddr[0];
- tmp = (0<<24) + (0<<16) + (16<<8) + 16;
- h264bsdPredictSamples(data, pMb->mv, &refImage,
- colAndRow, tmp, pFill);
- break;
-
- case P_L0_L0_16x8:
- if ( MvPrediction16x8(pMb, &pMbLayer->mbPred, dpb) != HANTRO_OK)
- return(HANTRO_NOK);
- refImage.data = pMb->refAddr[0];
- tmp = (0<<24) + (0<<16) + (16<<8) + 8;
- h264bsdPredictSamples(data, pMb->mv, &refImage,
- colAndRow, tmp, pFill);
-
- refImage.data = pMb->refAddr[2];
- tmp = (0<<24) + (8<<16) + (16<<8) + 8;
- h264bsdPredictSamples(data, pMb->mv+8, &refImage,
- colAndRow, tmp, pFill);
- break;
-
- case P_L0_L0_8x16:
- if ( MvPrediction8x16(pMb, &pMbLayer->mbPred, dpb) != HANTRO_OK)
- return(HANTRO_NOK);
- refImage.data = pMb->refAddr[0];
- tmp = (0<<24) + (0<<16) + (8<<8) + 16;
- h264bsdPredictSamples(data, pMb->mv, &refImage,
- colAndRow, tmp, pFill);
- refImage.data = pMb->refAddr[1];
- tmp = (8<<24) + (0<<16) + (8<<8) + 16;
- h264bsdPredictSamples(data, pMb->mv+4, &refImage,
- colAndRow, tmp, pFill);
- break;
-
- default: /* P_8x8 and P_8x8ref0 */
- if ( MvPrediction8x8(pMb, &pMbLayer->subMbPred, dpb) != HANTRO_OK)
- return(HANTRO_NOK);
- for (i = 0; i < 4; i++)
- {
- refImage.data = pMb->refAddr[i];
- subPartMode =
- h264bsdSubMbPartMode(pMbLayer->subMbPred.subMbType[i]);
- x = i & 0x1 ? 8 : 0;
- y = i < 2 ? 0 : 8;
- switch (subPartMode)
- {
- case MB_SP_8x8:
- tmp = (x<<24) + (y<<16) + (8<<8) + 8;
- h264bsdPredictSamples(data, pMb->mv+4*i, &refImage,
- colAndRow, tmp, pFill);
- break;
-
- case MB_SP_8x4:
- tmp = (x<<24) + (y<<16) + (8<<8) + 4;
- h264bsdPredictSamples(data, pMb->mv+4*i, &refImage,
- colAndRow, tmp, pFill);
- tmp = (x<<24) + ((y+4)<<16) + (8<<8) + 4;
- h264bsdPredictSamples(data, pMb->mv+4*i+2, &refImage,
- colAndRow, tmp, pFill);
- break;
-
- case MB_SP_4x8:
- tmp = (x<<24) + (y<<16) + (4<<8) + 8;
- h264bsdPredictSamples(data, pMb->mv+4*i, &refImage,
- colAndRow, tmp, pFill);
- tmp = ((x+4)<<24) + (y<<16) + (4<<8) + 8;
- h264bsdPredictSamples(data, pMb->mv+4*i+1, &refImage,
- colAndRow, tmp, pFill);
- break;
-
- default:
- tmp = (x<<24) + (y<<16) + (4<<8) + 4;
- h264bsdPredictSamples(data, pMb->mv+4*i, &refImage,
- colAndRow, tmp, pFill);
- tmp = ((x+4)<<24) + (y<<16) + (4<<8) + 4;
- h264bsdPredictSamples(data, pMb->mv+4*i+1, &refImage,
- colAndRow, tmp, pFill);
- tmp = (x<<24) + ((y+4)<<16) + (4<<8) + 4;
- h264bsdPredictSamples(data, pMb->mv+4*i+2, &refImage,
- colAndRow, tmp, pFill);
- tmp = ((x+4)<<24) + ((y+4)<<16) + (4<<8) + 4;
- h264bsdPredictSamples(data, pMb->mv+4*i+3, &refImage,
- colAndRow, tmp, pFill);
- break;
- }
- }
- break;
- }
-
- /* if decoded flag > 1 -> mb has already been successfully decoded and
- * written to output -> do not write again */
- if (pMb->decoded > 1)
- return HANTRO_OK;
-
- return(HANTRO_OK);
-}
-
-#else /* H264DEC_OMXDL */
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdInterPrediction
-
- Functional description:
- Processes one inter macroblock. Performs motion vector prediction
- and reconstructs prediction macroblock. Writes the final macroblock
- (prediction + residual) into the output image (currImage)
-
- Inputs:
- pMb pointer to macroblock specific information
- pMbLayer pointer to current macroblock data from stream
- dpb pointer to decoded picture buffer
- mbNum current macroblock number
- currImage pointer to output image
- data pointer where predicted macroblock will be stored
-
- Outputs:
- pMb structure is updated with current macroblock
- currImage current macroblock is written into image
- data prediction is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK error in motion vector prediction
-
-------------------------------------------------------------------------------*/
-u32 h264bsdInterPrediction(mbStorage_t *pMb, macroblockLayer_t *pMbLayer,
- dpbStorage_t *dpb, u32 mbNum, image_t *currImage, u8 *data)
-{
-
-/* Variables */
-
- u32 i;
- u32 x, y;
- u32 row, col;
- subMbPartMode_e subPartMode;
- image_t refImage;
-
-/* Code */
-
- ASSERT(pMb);
- ASSERT(h264bsdMbPartPredMode(pMb->mbType) == PRED_MODE_INTER);
- ASSERT(pMbLayer);
-
- row = mbNum / currImage->width;
- col = mbNum - row * currImage->width;
- row *= 16;
- col *= 16;
-
- refImage.width = currImage->width;
- refImage.height = currImage->height;
-
- switch (pMb->mbType)
- {
- case P_Skip:
- case P_L0_16x16:
- if (MvPrediction16x16(pMb, &pMbLayer->mbPred, dpb) != HANTRO_OK)
- return(HANTRO_NOK);
- refImage.data = pMb->refAddr[0];
- h264bsdPredictSamples(data, pMb->mv, &refImage, col, row, 0, 0,
- 16, 16);
- break;
-
- case P_L0_L0_16x8:
- if ( MvPrediction16x8(pMb, &pMbLayer->mbPred, dpb) != HANTRO_OK)
- return(HANTRO_NOK);
- refImage.data = pMb->refAddr[0];
- h264bsdPredictSamples(data, pMb->mv, &refImage, col, row, 0, 0,
- 16, 8);
- refImage.data = pMb->refAddr[2];
- h264bsdPredictSamples(data, pMb->mv+8, &refImage, col, row, 0, 8,
- 16, 8);
- break;
-
- case P_L0_L0_8x16:
- if ( MvPrediction8x16(pMb, &pMbLayer->mbPred, dpb) != HANTRO_OK)
- return(HANTRO_NOK);
- refImage.data = pMb->refAddr[0];
- h264bsdPredictSamples(data, pMb->mv, &refImage, col, row, 0, 0,
- 8, 16);
- refImage.data = pMb->refAddr[1];
- h264bsdPredictSamples(data, pMb->mv+4, &refImage, col, row, 8, 0,
- 8, 16);
- break;
-
- default: /* P_8x8 and P_8x8ref0 */
- if ( MvPrediction8x8(pMb, &pMbLayer->subMbPred, dpb) != HANTRO_OK)
- return(HANTRO_NOK);
- for (i = 0; i < 4; i++)
- {
- refImage.data = pMb->refAddr[i];
- subPartMode =
- h264bsdSubMbPartMode(pMbLayer->subMbPred.subMbType[i]);
- x = i & 0x1 ? 8 : 0;
- y = i < 2 ? 0 : 8;
- switch (subPartMode)
- {
- case MB_SP_8x8:
- h264bsdPredictSamples(data, pMb->mv+4*i, &refImage,
- col, row, x, y, 8, 8);
- break;
-
- case MB_SP_8x4:
- h264bsdPredictSamples(data, pMb->mv+4*i, &refImage,
- col, row, x, y, 8, 4);
- h264bsdPredictSamples(data, pMb->mv+4*i+2, &refImage,
- col, row, x, y+4, 8, 4);
- break;
-
- case MB_SP_4x8:
- h264bsdPredictSamples(data, pMb->mv+4*i, &refImage,
- col, row, x, y, 4, 8);
- h264bsdPredictSamples(data, pMb->mv+4*i+1, &refImage,
- col, row, x+4, y, 4, 8);
- break;
-
- default:
- h264bsdPredictSamples(data, pMb->mv+4*i, &refImage,
- col, row, x, y, 4, 4);
- h264bsdPredictSamples(data, pMb->mv+4*i+1, &refImage,
- col, row, x+4, y, 4, 4);
- h264bsdPredictSamples(data, pMb->mv+4*i+2, &refImage,
- col, row, x, y+4, 4, 4);
- h264bsdPredictSamples(data, pMb->mv+4*i+3, &refImage,
- col, row, x+4, y+4, 4, 4);
- break;
- }
- }
- break;
- }
-
- /* if decoded flag > 1 -> mb has already been successfully decoded and
- * written to output -> do not write again */
- if (pMb->decoded > 1)
- return HANTRO_OK;
-
- if (pMb->mbType != P_Skip)
- {
- h264bsdWriteOutputBlocks(currImage, mbNum, data,
- pMbLayer->residual.level);
- }
- else
- {
- h264bsdWriteMacroblock(currImage, data);
- }
-
- return(HANTRO_OK);
-}
-#endif /* H264DEC_OMXDL */
-
-/*------------------------------------------------------------------------------
-
- Function: MvPrediction16x16
-
- Functional description:
- Motion vector prediction for 16x16 partition mode
-
-------------------------------------------------------------------------------*/
-
-u32 MvPrediction16x16(mbStorage_t *pMb, mbPred_t *mbPred, dpbStorage_t *dpb)
-{
-
-/* Variables */
-
- mv_t mv;
- mv_t mvPred;
- interNeighbour_t a[3]; /* A, B, C */
- u32 refIndex;
- u8 *tmp;
- u32 *tmpMv1, *tmpMv2;
-
-/* Code */
-
- refIndex = mbPred->refIdxL0[0];
-
- GetInterNeighbour(pMb->sliceId, pMb->mbA, a, 5);
- GetInterNeighbour(pMb->sliceId, pMb->mbB, a+1, 10);
- /*lint --e(740) Unusual pointer cast (incompatible indirect types) */
- tmpMv1 = (u32*)(&a[0].mv); /* we test just that both MVs are zero */
- /*lint --e(740) */
- tmpMv2 = (u32*)(&a[1].mv); /* i.e. a[0].mv.hor == 0 && a[0].mv.ver == 0 */
- if (pMb->mbType == P_Skip &&
- (!a[0].available || !a[1].available ||
- ( a[0].refIndex == 0 && ((u32)(*tmpMv1) == 0) ) ||
- ( a[1].refIndex == 0 && ((u32)(*tmpMv2) == 0) )))
- {
- mv.hor = mv.ver = 0;
- }
- else
- {
- mv = mbPred->mvdL0[0];
- GetInterNeighbour(pMb->sliceId, pMb->mbC, a+2, 10);
- if (!a[2].available)
- {
- GetInterNeighbour(pMb->sliceId, pMb->mbD, a+2, 15);
- }
-
- GetPredictionMv(&mvPred, a, refIndex);
-
- mv.hor += mvPred.hor;
- mv.ver += mvPred.ver;
-
- /* horizontal motion vector range [-2048, 2047.75] */
- if ((u32)(i32)(mv.hor+8192) >= (16384))
- return(HANTRO_NOK);
-
- /* vertical motion vector range [-512, 511.75]
- * (smaller for low levels) */
- if ((u32)(i32)(mv.ver+2048) >= (4096))
- return(HANTRO_NOK);
- }
-
- tmp = h264bsdGetRefPicData(dpb, refIndex);
- if (tmp == NULL)
- return(HANTRO_NOK);
-
- pMb->mv[0] = pMb->mv[1] = pMb->mv[2] = pMb->mv[3] =
- pMb->mv[4] = pMb->mv[5] = pMb->mv[6] = pMb->mv[7] =
- pMb->mv[8] = pMb->mv[9] = pMb->mv[10] = pMb->mv[11] =
- pMb->mv[12] = pMb->mv[13] = pMb->mv[14] = pMb->mv[15] = mv;
-
- pMb->refPic[0] = refIndex;
- pMb->refPic[1] = refIndex;
- pMb->refPic[2] = refIndex;
- pMb->refPic[3] = refIndex;
- pMb->refAddr[0] = tmp;
- pMb->refAddr[1] = tmp;
- pMb->refAddr[2] = tmp;
- pMb->refAddr[3] = tmp;
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: MvPrediction16x8
-
- Functional description:
- Motion vector prediction for 16x8 partition mode
-
-------------------------------------------------------------------------------*/
-
-u32 MvPrediction16x8(mbStorage_t *pMb, mbPred_t *mbPred, dpbStorage_t *dpb)
-{
-
-/* Variables */
-
- mv_t mv;
- mv_t mvPred;
- interNeighbour_t a[3]; /* A, B, C */
- u32 refIndex;
- u8 *tmp;
-
-/* Code */
-
- mv = mbPred->mvdL0[0];
- refIndex = mbPred->refIdxL0[0];
-
- GetInterNeighbour(pMb->sliceId, pMb->mbB, a+1, 10);
-
- if (a[1].refIndex == refIndex)
- mvPred = a[1].mv;
- else
- {
- GetInterNeighbour(pMb->sliceId, pMb->mbA, a, 5);
- GetInterNeighbour(pMb->sliceId, pMb->mbC, a+2, 10);
- if (!a[2].available)
- {
- GetInterNeighbour(pMb->sliceId, pMb->mbD, a+2, 15);
- }
-
- GetPredictionMv(&mvPred, a, refIndex);
-
- }
- mv.hor += mvPred.hor;
- mv.ver += mvPred.ver;
-
- /* horizontal motion vector range [-2048, 2047.75] */
- if ((u32)(i32)(mv.hor+8192) >= (16384))
- return(HANTRO_NOK);
-
- /* vertical motion vector range [-512, 511.75] (smaller for low levels) */
- if ((u32)(i32)(mv.ver+2048) >= (4096))
- return(HANTRO_NOK);
-
- tmp = h264bsdGetRefPicData(dpb, refIndex);
- if (tmp == NULL)
- return(HANTRO_NOK);
-
- pMb->mv[0] = pMb->mv[1] = pMb->mv[2] = pMb->mv[3] =
- pMb->mv[4] = pMb->mv[5] = pMb->mv[6] = pMb->mv[7] = mv;
- pMb->refPic[0] = refIndex;
- pMb->refPic[1] = refIndex;
- pMb->refAddr[0] = tmp;
- pMb->refAddr[1] = tmp;
-
- mv = mbPred->mvdL0[1];
- refIndex = mbPred->refIdxL0[1];
-
- GetInterNeighbour(pMb->sliceId, pMb->mbA, a, 13);
- if (a[0].refIndex == refIndex)
- mvPred = a[0].mv;
- else
- {
- a[1].available = HANTRO_TRUE;
- a[1].refIndex = pMb->refPic[0];
- a[1].mv = pMb->mv[0];
-
- /* c is not available */
- GetInterNeighbour(pMb->sliceId, pMb->mbA, a+2, 7);
-
- GetPredictionMv(&mvPred, a, refIndex);
-
- }
- mv.hor += mvPred.hor;
- mv.ver += mvPred.ver;
-
- /* horizontal motion vector range [-2048, 2047.75] */
- if ((u32)(i32)(mv.hor+8192) >= (16384))
- return(HANTRO_NOK);
-
- /* vertical motion vector range [-512, 511.75] (smaller for low levels) */
- if ((u32)(i32)(mv.ver+2048) >= (4096))
- return(HANTRO_NOK);
-
- tmp = h264bsdGetRefPicData(dpb, refIndex);
- if (tmp == NULL)
- return(HANTRO_NOK);
-
- pMb->mv[8] = pMb->mv[9] = pMb->mv[10] = pMb->mv[11] =
- pMb->mv[12] = pMb->mv[13] = pMb->mv[14] = pMb->mv[15] = mv;
- pMb->refPic[2] = refIndex;
- pMb->refPic[3] = refIndex;
- pMb->refAddr[2] = tmp;
- pMb->refAddr[3] = tmp;
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: MvPrediction8x16
-
- Functional description:
- Motion vector prediction for 8x16 partition mode
-
-------------------------------------------------------------------------------*/
-
-u32 MvPrediction8x16(mbStorage_t *pMb, mbPred_t *mbPred, dpbStorage_t *dpb)
-{
-
-/* Variables */
-
- mv_t mv;
- mv_t mvPred;
- interNeighbour_t a[3]; /* A, B, C */
- u32 refIndex;
- u8 *tmp;
-
-/* Code */
-
- mv = mbPred->mvdL0[0];
- refIndex = mbPred->refIdxL0[0];
-
- GetInterNeighbour(pMb->sliceId, pMb->mbA, a, 5);
-
- if (a[0].refIndex == refIndex)
- mvPred = a[0].mv;
- else
- {
- GetInterNeighbour(pMb->sliceId, pMb->mbB, a+1, 10);
- GetInterNeighbour(pMb->sliceId, pMb->mbB, a+2, 14);
- if (!a[2].available)
- {
- GetInterNeighbour(pMb->sliceId, pMb->mbD, a+2, 15);
- }
-
- GetPredictionMv(&mvPred, a, refIndex);
-
- }
- mv.hor += mvPred.hor;
- mv.ver += mvPred.ver;
-
- /* horizontal motion vector range [-2048, 2047.75] */
- if ((u32)(i32)(mv.hor+8192) >= (16384))
- return(HANTRO_NOK);
-
- /* vertical motion vector range [-512, 511.75] (smaller for low levels) */
- if ((u32)(i32)(mv.ver+2048) >= (4096))
- return(HANTRO_NOK);
-
- tmp = h264bsdGetRefPicData(dpb, refIndex);
- if (tmp == NULL)
- return(HANTRO_NOK);
-
- pMb->mv[0] = pMb->mv[1] = pMb->mv[2] = pMb->mv[3] =
- pMb->mv[8] = pMb->mv[9] = pMb->mv[10] = pMb->mv[11] = mv;
- pMb->refPic[0] = refIndex;
- pMb->refPic[2] = refIndex;
- pMb->refAddr[0] = tmp;
- pMb->refAddr[2] = tmp;
-
- mv = mbPred->mvdL0[1];
- refIndex = mbPred->refIdxL0[1];
-
- GetInterNeighbour(pMb->sliceId, pMb->mbC, a+2, 10);
- if (!a[2].available)
- {
- GetInterNeighbour(pMb->sliceId, pMb->mbB, a+2, 11);
- }
- if (a[2].refIndex == refIndex)
- mvPred = a[2].mv;
- else
- {
- a[0].available = HANTRO_TRUE;
- a[0].refIndex = pMb->refPic[0];
- a[0].mv = pMb->mv[0];
-
- GetInterNeighbour(pMb->sliceId, pMb->mbB, a+1, 14);
-
- GetPredictionMv(&mvPred, a, refIndex);
-
- }
- mv.hor += mvPred.hor;
- mv.ver += mvPred.ver;
-
- /* horizontal motion vector range [-2048, 2047.75] */
- if ((u32)(i32)(mv.hor+8192) >= (16384))
- return(HANTRO_NOK);
-
- /* vertical motion vector range [-512, 511.75] (smaller for low levels) */
- if ((u32)(i32)(mv.ver+2048) >= (4096))
- return(HANTRO_NOK);
-
- tmp = h264bsdGetRefPicData(dpb, refIndex);
- if (tmp == NULL)
- return(HANTRO_NOK);
-
- pMb->mv[4] = pMb->mv[5] = pMb->mv[6] = pMb->mv[7] =
- pMb->mv[12] = pMb->mv[13] = pMb->mv[14] = pMb->mv[15] = mv;
- pMb->refPic[1] = refIndex;
- pMb->refPic[3] = refIndex;
- pMb->refAddr[1] = tmp;
- pMb->refAddr[3] = tmp;
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: MvPrediction8x8
-
- Functional description:
- Motion vector prediction for 8x8 partition mode
-
-------------------------------------------------------------------------------*/
-
-u32 MvPrediction8x8(mbStorage_t *pMb, subMbPred_t *subMbPred, dpbStorage_t *dpb)
-{
-
-/* Variables */
-
- u32 i, j;
- u32 numSubMbPart;
-
-/* Code */
-
- for (i = 0; i < 4; i++)
- {
- numSubMbPart = h264bsdNumSubMbPart(subMbPred->subMbType[i]);
- pMb->refPic[i] = subMbPred->refIdxL0[i];
- pMb->refAddr[i] = h264bsdGetRefPicData(dpb, subMbPred->refIdxL0[i]);
- if (pMb->refAddr[i] == NULL)
- return(HANTRO_NOK);
- for (j = 0; j < numSubMbPart; j++)
- {
- if (MvPrediction(pMb, subMbPred, i, j) != HANTRO_OK)
- return(HANTRO_NOK);
- }
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: MvPrediction
-
- Functional description:
- Perform motion vector prediction for sub-partition
-
-------------------------------------------------------------------------------*/
-
-u32 MvPrediction(mbStorage_t *pMb, subMbPred_t *subMbPred, u32 mbPartIdx,
- u32 subMbPartIdx)
-{
-
-/* Variables */
-
- mv_t mv, mvPred;
- u32 refIndex;
- subMbPartMode_e subMbPartMode;
- const neighbour_t *n;
- mbStorage_t *nMb;
- interNeighbour_t a[3]; /* A, B, C */
-
-/* Code */
-
- mv = subMbPred->mvdL0[mbPartIdx][subMbPartIdx];
- subMbPartMode = h264bsdSubMbPartMode(subMbPred->subMbType[mbPartIdx]);
- refIndex = subMbPred->refIdxL0[mbPartIdx];
-
- n = N_A_SUB_PART[mbPartIdx][subMbPartMode]+subMbPartIdx;
- nMb = h264bsdGetNeighbourMb(pMb, n->mb);
- GetInterNeighbour(pMb->sliceId, nMb, a, n->index);
-
- n = N_B_SUB_PART[mbPartIdx][subMbPartMode]+subMbPartIdx;
- nMb = h264bsdGetNeighbourMb(pMb, n->mb);
- GetInterNeighbour(pMb->sliceId, nMb, a+1, n->index);
-
- n = N_C_SUB_PART[mbPartIdx][subMbPartMode]+subMbPartIdx;
- nMb = h264bsdGetNeighbourMb(pMb, n->mb);
- GetInterNeighbour(pMb->sliceId, nMb, a+2, n->index);
-
- if (!a[2].available)
- {
- n = N_D_SUB_PART[mbPartIdx][subMbPartMode]+subMbPartIdx;
- nMb = h264bsdGetNeighbourMb(pMb, n->mb);
- GetInterNeighbour(pMb->sliceId, nMb, a+2, n->index);
- }
-
- GetPredictionMv(&mvPred, a, refIndex);
-
- mv.hor += mvPred.hor;
- mv.ver += mvPred.ver;
-
- /* horizontal motion vector range [-2048, 2047.75] */
- if (((u32)(i32)(mv.hor+8192) >= (16384)))
- return(HANTRO_NOK);
-
- /* vertical motion vector range [-512, 511.75] (smaller for low levels) */
- if (((u32)(i32)(mv.ver+2048) >= (4096)))
- return(HANTRO_NOK);
-
- switch (subMbPartMode)
- {
- case MB_SP_8x8:
- pMb->mv[4*mbPartIdx] = mv;
- pMb->mv[4*mbPartIdx + 1] = mv;
- pMb->mv[4*mbPartIdx + 2] = mv;
- pMb->mv[4*mbPartIdx + 3] = mv;
- break;
-
- case MB_SP_8x4:
- pMb->mv[4*mbPartIdx + 2*subMbPartIdx] = mv;
- pMb->mv[4*mbPartIdx + 2*subMbPartIdx + 1] = mv;
- break;
-
- case MB_SP_4x8:
- pMb->mv[4*mbPartIdx + subMbPartIdx] = mv;
- pMb->mv[4*mbPartIdx + subMbPartIdx + 2] = mv;
- break;
-
- case MB_SP_4x4:
- pMb->mv[4*mbPartIdx + subMbPartIdx] = mv;
- break;
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: MedianFilter
-
- Functional description:
- Median filtering for motion vector prediction
-
-------------------------------------------------------------------------------*/
-
-i32 MedianFilter(i32 a, i32 b, i32 c)
-{
-
-/* Variables */
-
- i32 max,min,med;
-
-/* Code */
-
- max = min = med = a;
- if (b > max)
- {
- max = b;
- }
- else if (b < min)
- {
- min = b;
- }
- if (c > max)
- {
- med = max;
- }
- else if (c < min)
- {
- med = min;
- }
- else
- {
- med = c;
- }
-
- return(med);
-}
-
-/*------------------------------------------------------------------------------
-
- Function: GetInterNeighbour
-
- Functional description:
- Get availability, reference index and motion vector of a neighbour
-
-------------------------------------------------------------------------------*/
-
-void GetInterNeighbour(u32 sliceId, mbStorage_t *nMb,
- interNeighbour_t *n, u32 index)
-{
-
- n->available = HANTRO_FALSE;
- n->refIndex = 0xFFFFFFFF;
- n->mv.hor = n->mv.ver = 0;
-
- if (nMb && (sliceId == nMb->sliceId))
- {
- u32 tmp;
- mv_t tmpMv;
-
- tmp = nMb->mbType;
- n->available = HANTRO_TRUE;
- /* MbPartPredMode "inlined" */
- if (tmp <= P_8x8ref0)
- {
- tmpMv = nMb->mv[index];
- tmp = nMb->refPic[index>>2];
- n->refIndex = tmp;
- n->mv = tmpMv;
- }
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: GetPredictionMv
-
- Functional description:
- Compute motion vector predictor based on neighbours A, B and C
-
-------------------------------------------------------------------------------*/
-
-void GetPredictionMv(mv_t *mv, interNeighbour_t *a, u32 refIndex)
-{
-
- if ( a[1].available || a[2].available || !a[0].available)
- {
- u32 isA, isB, isC;
- isA = (a[0].refIndex == refIndex) ? HANTRO_TRUE : HANTRO_FALSE;
- isB = (a[1].refIndex == refIndex) ? HANTRO_TRUE : HANTRO_FALSE;
- isC = (a[2].refIndex == refIndex) ? HANTRO_TRUE : HANTRO_FALSE;
-
- if (((u32)isA+(u32)isB+(u32)isC) != 1)
- {
- mv->hor = (i16)MedianFilter(a[0].mv.hor, a[1].mv.hor, a[2].mv.hor);
- mv->ver = (i16)MedianFilter(a[0].mv.ver, a[1].mv.ver, a[2].mv.ver);
- }
- else if (isA)
- *mv = a[0].mv;
- else if (isB)
- *mv = a[1].mv;
- else
- *mv = a[2].mv;
- }
- else
- {
- *mv = a[0].mv;
- }
-
-}
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_inter_prediction.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_inter_prediction.h
deleted file mode 100644
index 94dee25..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_inter_prediction.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_INTER_PREDICTION_H
-#define H264SWDEC_INTER_PREDICTION_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_image.h"
-#include "h264bsd_macroblock_layer.h"
-#include "h264bsd_dpb.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-u32 h264bsdInterPrediction(mbStorage_t *pMb, macroblockLayer_t *pMbLayer,
- dpbStorage_t *dpb, u32 mbNum, image_t *image, u8 *data);
-
-#endif /* #ifdef H264SWDEC_INTER_PREDICTION_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_intra_prediction.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_intra_prediction.c
deleted file mode 100644
index 52c85e5..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_intra_prediction.c
+++ /dev/null
@@ -1,1937 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdIntraPrediction
- h264bsdGetNeighbourPels
- h264bsdIntra16x16Prediction
- h264bsdIntra4x4Prediction
- h264bsdIntraChromaPrediction
- h264bsdAddResidual
- Intra16x16VerticalPrediction
- Intra16x16HorizontalPrediction
- Intra16x16DcPrediction
- Intra16x16PlanePrediction
- IntraChromaDcPrediction
- IntraChromaHorizontalPrediction
- IntraChromaVerticalPrediction
- IntraChromaPlanePrediction
- Get4x4NeighbourPels
- Write4x4To16x16
- Intra4x4VerticalPrediction
- Intra4x4HorizontalPrediction
- Intra4x4DcPrediction
- Intra4x4DiagonalDownLeftPrediction
- Intra4x4DiagonalDownRightPrediction
- Intra4x4VerticalRightPrediction
- Intra4x4HorizontalDownPrediction
- Intra4x4VerticalLeftPrediction
- Intra4x4HorizontalUpPrediction
- DetermineIntra4x4PredMode
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_intra_prediction.h"
-#include "h264bsd_util.h"
-#include "h264bsd_macroblock_layer.h"
-#include "h264bsd_neighbour.h"
-#include "h264bsd_image.h"
-
-#ifdef H264DEC_OMXDL
-#include "omxtypes.h"
-#include "omxVC.h"
-#endif /* H264DEC_OMXDL */
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-/* Switch off the following Lint messages for this file:
- * Info 702: Shift right of signed quantity (int)
- */
-/*lint -e702 */
-
-
-/* x- and y-coordinates for each block */
-const u32 h264bsdBlockX[16] =
- { 0, 4, 0, 4, 8, 12, 8, 12, 0, 4, 0, 4, 8, 12, 8, 12 };
-const u32 h264bsdBlockY[16] =
- { 0, 0, 4, 4, 0, 0, 4, 4, 8, 8, 12, 12, 8, 8, 12, 12 };
-
-const u8 h264bsdClip[1280] =
-{
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
- 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
- 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
- 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
- 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
- 80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
- 96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
- 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
- 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
- 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
- 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
- 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
- 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
- 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
- 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
- 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
-};
-
-#ifndef H264DEC_OMXDL
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-static void Get4x4NeighbourPels(u8 *a, u8 *l, u8 *data, u8 *above, u8 *left,
- u32 blockNum);
-static void Intra16x16VerticalPrediction(u8 *data, u8 *above);
-static void Intra16x16HorizontalPrediction(u8 *data, u8 *left);
-static void Intra16x16DcPrediction(u8 *data, u8 *above, u8 *left,
- u32 A, u32 B);
-static void Intra16x16PlanePrediction(u8 *data, u8 *above, u8 *left);
-static void IntraChromaDcPrediction(u8 *data, u8 *above, u8 *left,
- u32 A, u32 B);
-static void IntraChromaHorizontalPrediction(u8 *data, u8 *left);
-static void IntraChromaVerticalPrediction(u8 *data, u8 *above);
-static void IntraChromaPlanePrediction(u8 *data, u8 *above, u8 *left);
-
-static void Intra4x4VerticalPrediction(u8 *data, u8 *above);
-static void Intra4x4HorizontalPrediction(u8 *data, u8 *left);
-static void Intra4x4DcPrediction(u8 *data, u8 *above, u8 *left, u32 A, u32 B);
-static void Intra4x4DiagonalDownLeftPrediction(u8 *data, u8 *above);
-static void Intra4x4DiagonalDownRightPrediction(u8 *data, u8 *above, u8 *left);
-static void Intra4x4VerticalRightPrediction(u8 *data, u8 *above, u8 *left);
-static void Intra4x4HorizontalDownPrediction(u8 *data, u8 *above, u8 *left);
-static void Intra4x4VerticalLeftPrediction(u8 *data, u8 *above);
-static void Intra4x4HorizontalUpPrediction(u8 *data, u8 *left);
-void h264bsdAddResidual(u8 *data, i32 *residual, u32 blockNum);
-
-static void Write4x4To16x16(u8 *data, u8 *data4x4, u32 blockNum);
-#endif /* H264DEC_OMXDL */
-
-static u32 DetermineIntra4x4PredMode(macroblockLayer_t *pMbLayer,
- u32 available, neighbour_t *nA, neighbour_t *nB, u32 index,
- mbStorage_t *nMbA, mbStorage_t *nMbB);
-
-
-#ifdef H264DEC_OMXDL
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdIntra16x16Prediction
-
- Functional description:
- Perform intra 16x16 prediction mode for luma pixels and add
- residual into prediction. The resulting luma pixels are
- stored in macroblock array 'data'.
-
-------------------------------------------------------------------------------*/
-u32 h264bsdIntra16x16Prediction(mbStorage_t *pMb, u8 *data, u8 *ptr,
- u32 width, u32 constrainedIntraPred)
-{
-
-/* Variables */
-
- u32 availableA, availableB, availableD;
- OMXResult omxRes;
-
-/* Code */
- ASSERT(pMb);
- ASSERT(data);
- ASSERT(ptr);
- ASSERT(h264bsdPredModeIntra16x16(pMb->mbType) < 4);
-
- availableA = h264bsdIsNeighbourAvailable(pMb, pMb->mbA);
- if (availableA && constrainedIntraPred &&
- (h264bsdMbPartPredMode(pMb->mbA->mbType) == PRED_MODE_INTER))
- availableA = HANTRO_FALSE;
- availableB = h264bsdIsNeighbourAvailable(pMb, pMb->mbB);
- if (availableB && constrainedIntraPred &&
- (h264bsdMbPartPredMode(pMb->mbB->mbType) == PRED_MODE_INTER))
- availableB = HANTRO_FALSE;
- availableD = h264bsdIsNeighbourAvailable(pMb, pMb->mbD);
- if (availableD && constrainedIntraPred &&
- (h264bsdMbPartPredMode(pMb->mbD->mbType) == PRED_MODE_INTER))
- availableD = HANTRO_FALSE;
-
- omxRes = omxVCM4P10_PredictIntra_16x16( (ptr-1),
- (ptr - width),
- (ptr - width-1),
- data,
- (i32)width,
- 16,
- (OMXVCM4P10Intra16x16PredMode)
- h264bsdPredModeIntra16x16(pMb->mbType),
- (i32)(availableB + (availableA<<1) +
- (availableD<<5)) );
- if (omxRes != OMX_Sts_NoErr)
- return HANTRO_NOK;
- else
- return(HANTRO_OK);
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdIntra4x4Prediction
-
- Functional description:
- Perform intra 4x4 prediction for luma pixels and add residual
- into prediction. The resulting luma pixels are stored in
- macroblock array 'data'. The intra 4x4 prediction mode for each
- block is stored in 'pMb' structure.
-
-------------------------------------------------------------------------------*/
-u32 h264bsdIntra4x4Prediction(mbStorage_t *pMb, u8 *data,
- macroblockLayer_t *mbLayer,
- u8 *ptr, u32 width,
- u32 constrainedIntraPred, u32 block)
-{
-
-/* Variables */
- u32 mode;
- neighbour_t neighbour, neighbourB;
- mbStorage_t *nMb, *nMb2;
- u32 availableA, availableB, availableC, availableD;
-
- OMXResult omxRes;
- u32 x, y;
- u8 *l, *a, *al;
-/* Code */
- ASSERT(pMb);
- ASSERT(data);
- ASSERT(mbLayer);
- ASSERT(ptr);
- ASSERT(pMb->intra4x4PredMode[block] < 9);
-
- neighbour = *h264bsdNeighbour4x4BlockA(block);
- nMb = h264bsdGetNeighbourMb(pMb, neighbour.mb);
- availableA = h264bsdIsNeighbourAvailable(pMb, nMb);
- if (availableA && constrainedIntraPred &&
- ( h264bsdMbPartPredMode(nMb->mbType) == PRED_MODE_INTER) )
- {
- availableA = HANTRO_FALSE;
- }
-
- neighbourB = *h264bsdNeighbour4x4BlockB(block);
- nMb2 = h264bsdGetNeighbourMb(pMb, neighbourB.mb);
- availableB = h264bsdIsNeighbourAvailable(pMb, nMb2);
- if (availableB && constrainedIntraPred &&
- ( h264bsdMbPartPredMode(nMb2->mbType) == PRED_MODE_INTER) )
- {
- availableB = HANTRO_FALSE;
- }
-
- mode = DetermineIntra4x4PredMode(mbLayer,
- (u32)(availableA && availableB),
- &neighbour, &neighbourB, block, nMb, nMb2);
- pMb->intra4x4PredMode[block] = (u8)mode;
-
- neighbour = *h264bsdNeighbour4x4BlockC(block);
- nMb = h264bsdGetNeighbourMb(pMb, neighbour.mb);
- availableC = h264bsdIsNeighbourAvailable(pMb, nMb);
- if (availableC && constrainedIntraPred &&
- ( h264bsdMbPartPredMode(nMb->mbType) == PRED_MODE_INTER) )
- {
- availableC = HANTRO_FALSE;
- }
-
- neighbour = *h264bsdNeighbour4x4BlockD(block);
- nMb = h264bsdGetNeighbourMb(pMb, neighbour.mb);
- availableD = h264bsdIsNeighbourAvailable(pMb, nMb);
- if (availableD && constrainedIntraPred &&
- ( h264bsdMbPartPredMode(nMb->mbType) == PRED_MODE_INTER) )
- {
- availableD = HANTRO_FALSE;
- }
-
- x = h264bsdBlockX[block];
- y = h264bsdBlockY[block];
-
- if (y == 0)
- a = ptr - width + x;
- else
- a = data-16;
-
- if (x == 0)
- l = ptr + y * width -1;
- else
- {
- l = data-1;
- width = 16;
- }
-
- if (x == 0)
- al = l-width;
- else
- al = a-1;
-
- omxRes = omxVCM4P10_PredictIntra_4x4( l,
- a,
- al,
- data,
- (i32)width,
- 16,
- (OMXVCM4P10Intra4x4PredMode)mode,
- (i32)(availableB +
- (availableA<<1) +
- (availableD<<5) +
- (availableC<<6)) );
- if (omxRes != OMX_Sts_NoErr)
- return HANTRO_NOK;
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdIntraChromaPrediction
-
- Functional description:
- Perform intra prediction for chroma pixels and add residual
- into prediction. The resulting chroma pixels are stored in 'data'.
-
-------------------------------------------------------------------------------*/
-u32 h264bsdIntraChromaPrediction(mbStorage_t *pMb, u8 *data, image_t *image,
- u32 predMode, u32 constrainedIntraPred)
-{
-
-/* Variables */
-
- u32 availableA, availableB, availableD;
- OMXResult omxRes;
- u8 *ptr;
- u32 width;
-
-/* Code */
- ASSERT(pMb);
- ASSERT(data);
- ASSERT(image);
- ASSERT(predMode < 4);
-
- availableA = h264bsdIsNeighbourAvailable(pMb, pMb->mbA);
- if (availableA && constrainedIntraPred &&
- (h264bsdMbPartPredMode(pMb->mbA->mbType) == PRED_MODE_INTER))
- availableA = HANTRO_FALSE;
- availableB = h264bsdIsNeighbourAvailable(pMb, pMb->mbB);
- if (availableB && constrainedIntraPred &&
- (h264bsdMbPartPredMode(pMb->mbB->mbType) == PRED_MODE_INTER))
- availableB = HANTRO_FALSE;
- availableD = h264bsdIsNeighbourAvailable(pMb, pMb->mbD);
- if (availableD && constrainedIntraPred &&
- (h264bsdMbPartPredMode(pMb->mbD->mbType) == PRED_MODE_INTER))
- availableD = HANTRO_FALSE;
-
- ptr = image->cb;
- width = image->width*8;
-
- omxRes = omxVCM4P10_PredictIntraChroma_8x8( (ptr-1),
- (ptr - width),
- (ptr - width -1),
- data,
- (i32)width,
- 8,
- (OMXVCM4P10IntraChromaPredMode)
- predMode,
- (i32)(availableB +
- (availableA<<1) +
- (availableD<<5)) );
- if (omxRes != OMX_Sts_NoErr)
- return HANTRO_NOK;
-
- /* advance pointers */
- data += 64;
- ptr = image->cr;
-
- omxRes = omxVCM4P10_PredictIntraChroma_8x8( (ptr-1),
- (ptr - width),
- (ptr - width -1),
- data,
- (i32)width,
- 8,
- (OMXVCM4P10IntraChromaPredMode)
- predMode,
- (i32)(availableB +
- (availableA<<1) +
- (availableD<<5)) );
- if (omxRes != OMX_Sts_NoErr)
- return HANTRO_NOK;
-
- return(HANTRO_OK);
-
-}
-
-
-#else /* H264DEC_OMXDL */
-
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdIntraPrediction
-
- Functional description:
- Processes one intra macroblock. Performs intra prediction using
- specified prediction mode. Writes the final macroblock
- (prediction + residual) into the output image (image)
-
- Inputs:
- pMb pointer to macroblock specific information
- mbLayer pointer to current macroblock data from stream
- image pointer to output image
- mbNum current macroblock number
- constrainedIntraPred flag specifying if neighbouring inter
- macroblocks are used in intra prediction
- data pointer where output macroblock will be stored
-
- Outputs:
- pMb structure is updated with current macroblock
- image current macroblock is written into image
- data current macroblock is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK error in intra prediction
-
-------------------------------------------------------------------------------*/
-u32 h264bsdIntraPrediction(mbStorage_t *pMb, macroblockLayer_t *mbLayer,
- image_t *image, u32 mbNum, u32 constrainedIntraPred, u8 *data)
-{
-
-/* Variables */
-
- /* pelAbove and pelLeft contain samples above and left to the current
- * macroblock. Above array contains also sample above-left to the current
- * mb as well as 4 samples above-right to the current mb (latter only for
- * luma) */
- /* lumD + lumB + lumC + cbD + cbB + crD + crB */
- u8 pelAbove[1 + 16 + 4 + 1 + 8 + 1 + 8];
- /* lumA + cbA + crA */
- u8 pelLeft[16 + 8 + 8];
- u32 tmp;
-
-/* Code */
-
- ASSERT(pMb);
- ASSERT(image);
- ASSERT(mbNum < image->width * image->height);
- ASSERT(h264bsdMbPartPredMode(pMb->mbType) != PRED_MODE_INTER);
-
- h264bsdGetNeighbourPels(image, pelAbove, pelLeft, mbNum);
-
- if (h264bsdMbPartPredMode(pMb->mbType) == PRED_MODE_INTRA16x16)
- {
- tmp = h264bsdIntra16x16Prediction(pMb, data, mbLayer->residual.level,
- pelAbove, pelLeft, constrainedIntraPred);
- if (tmp != HANTRO_OK)
- return(tmp);
- }
- else
- {
- tmp = h264bsdIntra4x4Prediction(pMb, data, mbLayer,
- pelAbove, pelLeft, constrainedIntraPred);
- if (tmp != HANTRO_OK)
- return(tmp);
- }
-
- tmp = h264bsdIntraChromaPrediction(pMb, data + 256,
- mbLayer->residual.level+16, pelAbove + 21, pelLeft + 16,
- mbLayer->mbPred.intraChromaPredMode, constrainedIntraPred);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* if decoded flag > 1 -> mb has already been successfully decoded and
- * written to output -> do not write again */
- if (pMb->decoded > 1)
- return HANTRO_OK;
-
- h264bsdWriteMacroblock(image, data);
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdGetNeighbourPels
-
- Functional description:
- Get pixel values from neighbouring macroblocks into 'above'
- and 'left' arrays.
-
-------------------------------------------------------------------------------*/
-
-void h264bsdGetNeighbourPels(image_t *image, u8 *above, u8 *left, u32 mbNum)
-{
-
-/* Variables */
-
- u32 i;
- u32 width, picSize;
- u8 *ptr, *tmp;
- u32 row, col;
-
-/* Code */
-
- ASSERT(image);
- ASSERT(above);
- ASSERT(left);
- ASSERT(mbNum < image->width * image->height);
-
- if (!mbNum)
- return;
-
- width = image->width;
- picSize = width * image->height;
- row = mbNum / width;
- col = mbNum - row * width;
-
- width *= 16;
- ptr = image->data + row * 16 * width + col * 16;
-
- /* note that luma samples above-right to current macroblock do not make
- * sense when current mb is the right-most mb in a row. Same applies to
- * sample above-left if col is zero. However, usage of pels in prediction
- * is controlled by neighbour availability information in actual prediction
- * process */
- if (row)
- {
- tmp = ptr - (width + 1);
- for (i = 21; i--;)
- *above++ = *tmp++;
- }
-
- if (col)
- {
- ptr--;
- for (i = 16; i--; ptr+=width)
- *left++ = *ptr;
- }
-
- width >>= 1;
- ptr = image->data + picSize * 256 + row * 8 * width + col * 8;
-
- if (row)
- {
- tmp = ptr - (width + 1);
- for (i = 9; i--;)
- *above++ = *tmp++;
- tmp += (picSize * 64) - 9;
- for (i = 9; i--;)
- *above++ = *tmp++;
- }
-
- if (col)
- {
- ptr--;
- for (i = 8; i--; ptr+=width)
- *left++ = *ptr;
- ptr += (picSize * 64) - 8 * width;
- for (i = 8; i--; ptr+=width)
- *left++ = *ptr;
- }
-}
-
-/*------------------------------------------------------------------------------
-
- Function: Intra16x16Prediction
-
- Functional description:
- Perform intra 16x16 prediction mode for luma pixels and add
- residual into prediction. The resulting luma pixels are
- stored in macroblock array 'data'.
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdIntra16x16Prediction(mbStorage_t *pMb, u8 *data, i32 residual[][16],
- u8 *above, u8 *left, u32 constrainedIntraPred)
-{
-
-/* Variables */
-
- u32 i;
- u32 availableA, availableB, availableD;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(residual);
- ASSERT(above);
- ASSERT(left);
- ASSERT(h264bsdPredModeIntra16x16(pMb->mbType) < 4);
-
- availableA = h264bsdIsNeighbourAvailable(pMb, pMb->mbA);
- if (availableA && constrainedIntraPred &&
- (h264bsdMbPartPredMode(pMb->mbA->mbType) == PRED_MODE_INTER))
- availableA = HANTRO_FALSE;
- availableB = h264bsdIsNeighbourAvailable(pMb, pMb->mbB);
- if (availableB && constrainedIntraPred &&
- (h264bsdMbPartPredMode(pMb->mbB->mbType) == PRED_MODE_INTER))
- availableB = HANTRO_FALSE;
- availableD = h264bsdIsNeighbourAvailable(pMb, pMb->mbD);
- if (availableD && constrainedIntraPred &&
- (h264bsdMbPartPredMode(pMb->mbD->mbType) == PRED_MODE_INTER))
- availableD = HANTRO_FALSE;
-
- switch(h264bsdPredModeIntra16x16(pMb->mbType))
- {
- case 0: /* Intra_16x16_Vertical */
- if (!availableB)
- return(HANTRO_NOK);
- Intra16x16VerticalPrediction(data, above+1);
- break;
-
- case 1: /* Intra_16x16_Horizontal */
- if (!availableA)
- return(HANTRO_NOK);
- Intra16x16HorizontalPrediction(data, left);
- break;
-
- case 2: /* Intra_16x16_DC */
- Intra16x16DcPrediction(data, above+1, left, availableA, availableB);
- break;
-
- default: /* case 3: Intra_16x16_Plane */
- if (!availableA || !availableB || !availableD)
- return(HANTRO_NOK);
- Intra16x16PlanePrediction(data, above+1, left);
- break;
- }
- /* add residual */
- for (i = 0; i < 16; i++)
- h264bsdAddResidual(data, residual[i], i);
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: Intra4x4Prediction
-
- Functional description:
- Perform intra 4x4 prediction for luma pixels and add residual
- into prediction. The resulting luma pixels are stored in
- macroblock array 'data'. The intra 4x4 prediction mode for each
- block is stored in 'pMb' structure.
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdIntra4x4Prediction(mbStorage_t *pMb, u8 *data,
- macroblockLayer_t *mbLayer, u8 *above,
- u8 *left, u32 constrainedIntraPred)
-{
-
-/* Variables */
-
- u32 block;
- u32 mode;
- neighbour_t neighbour, neighbourB;
- mbStorage_t *nMb, *nMb2;
- u8 a[1 + 4 + 4], l[1 + 4];
- u32 data4x4[4];
- u32 availableA, availableB, availableC, availableD;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(mbLayer);
- ASSERT(above);
- ASSERT(left);
-
- for (block = 0; block < 16; block++)
- {
-
- ASSERT(pMb->intra4x4PredMode[block] < 9);
-
- neighbour = *h264bsdNeighbour4x4BlockA(block);
- nMb = h264bsdGetNeighbourMb(pMb, neighbour.mb);
- availableA = h264bsdIsNeighbourAvailable(pMb, nMb);
- if (availableA && constrainedIntraPred &&
- ( h264bsdMbPartPredMode(nMb->mbType) == PRED_MODE_INTER) )
- {
- availableA = HANTRO_FALSE;
- }
-
- neighbourB = *h264bsdNeighbour4x4BlockB(block);
- nMb2 = h264bsdGetNeighbourMb(pMb, neighbourB.mb);
- availableB = h264bsdIsNeighbourAvailable(pMb, nMb2);
- if (availableB && constrainedIntraPred &&
- ( h264bsdMbPartPredMode(nMb2->mbType) == PRED_MODE_INTER) )
- {
- availableB = HANTRO_FALSE;
- }
-
- mode = DetermineIntra4x4PredMode(mbLayer,
- (u32)(availableA && availableB),
- &neighbour, &neighbourB, block, nMb, nMb2);
- pMb->intra4x4PredMode[block] = (u8)mode;
-
- neighbour = *h264bsdNeighbour4x4BlockC(block);
- nMb = h264bsdGetNeighbourMb(pMb, neighbour.mb);
- availableC = h264bsdIsNeighbourAvailable(pMb, nMb);
- if (availableC && constrainedIntraPred &&
- ( h264bsdMbPartPredMode(nMb->mbType) == PRED_MODE_INTER) )
- {
- availableC = HANTRO_FALSE;
- }
-
- neighbour = *h264bsdNeighbour4x4BlockD(block);
- nMb = h264bsdGetNeighbourMb(pMb, neighbour.mb);
- availableD = h264bsdIsNeighbourAvailable(pMb, nMb);
- if (availableD && constrainedIntraPred &&
- ( h264bsdMbPartPredMode(nMb->mbType) == PRED_MODE_INTER) )
- {
- availableD = HANTRO_FALSE;
- }
-
- Get4x4NeighbourPels(a, l, data, above, left, block);
-
- switch(mode)
- {
- case 0: /* Intra_4x4_Vertical */
- if (!availableB)
- return(HANTRO_NOK);
- Intra4x4VerticalPrediction((u8*)data4x4, a + 1);
- break;
- case 1: /* Intra_4x4_Horizontal */
- if (!availableA)
- return(HANTRO_NOK);
- Intra4x4HorizontalPrediction((u8*)data4x4, l + 1);
- break;
- case 2: /* Intra_4x4_DC */
- Intra4x4DcPrediction((u8*)data4x4, a + 1, l + 1,
- availableA, availableB);
- break;
- case 3: /* Intra_4x4_Diagonal_Down_Left */
- if (!availableB)
- return(HANTRO_NOK);
- if (!availableC)
- {
- a[5] = a[6] = a[7] = a[8] = a[4];
- }
- Intra4x4DiagonalDownLeftPrediction((u8*)data4x4, a + 1);
- break;
- case 4: /* Intra_4x4_Diagonal_Down_Right */
- if (!availableA || !availableB || !availableD)
- return(HANTRO_NOK);
- Intra4x4DiagonalDownRightPrediction((u8*)data4x4, a + 1, l + 1);
- break;
- case 5: /* Intra_4x4_Vertical_Right */
- if (!availableA || !availableB || !availableD)
- return(HANTRO_NOK);
- Intra4x4VerticalRightPrediction((u8*)data4x4, a + 1, l + 1);
- break;
- case 6: /* Intra_4x4_Horizontal_Down */
- if (!availableA || !availableB || !availableD)
- return(HANTRO_NOK);
- Intra4x4HorizontalDownPrediction((u8*)data4x4, a + 1, l + 1);
- break;
- case 7: /* Intra_4x4_Vertical_Left */
- if (!availableB)
- return(HANTRO_NOK);
- if (!availableC)
- {
- a[5] = a[6] = a[7] = a[8] = a[4];
- }
- Intra4x4VerticalLeftPrediction((u8*)data4x4, a + 1);
- break;
- default: /* case 8 Intra_4x4_Horizontal_Up */
- if (!availableA)
- return(HANTRO_NOK);
- Intra4x4HorizontalUpPrediction((u8*)data4x4, l + 1);
- break;
- }
-
- Write4x4To16x16(data, (u8*)data4x4, block);
- h264bsdAddResidual(data, mbLayer->residual.level[block], block);
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: IntraChromaPrediction
-
- Functional description:
- Perform intra prediction for chroma pixels and add residual
- into prediction. The resulting chroma pixels are stored in 'data'.
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdIntraChromaPrediction(mbStorage_t *pMb, u8 *data, i32 residual[][16],
- u8 *above, u8 *left, u32 predMode, u32 constrainedIntraPred)
-{
-
-/* Variables */
-
- u32 i, comp, block;
- u32 availableA, availableB, availableD;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(residual);
- ASSERT(above);
- ASSERT(left);
- ASSERT(predMode < 4);
-
- availableA = h264bsdIsNeighbourAvailable(pMb, pMb->mbA);
- if (availableA && constrainedIntraPred &&
- (h264bsdMbPartPredMode(pMb->mbA->mbType) == PRED_MODE_INTER))
- availableA = HANTRO_FALSE;
- availableB = h264bsdIsNeighbourAvailable(pMb, pMb->mbB);
- if (availableB && constrainedIntraPred &&
- (h264bsdMbPartPredMode(pMb->mbB->mbType) == PRED_MODE_INTER))
- availableB = HANTRO_FALSE;
- availableD = h264bsdIsNeighbourAvailable(pMb, pMb->mbD);
- if (availableD && constrainedIntraPred &&
- (h264bsdMbPartPredMode(pMb->mbD->mbType) == PRED_MODE_INTER))
- availableD = HANTRO_FALSE;
-
- for (comp = 0, block = 16; comp < 2; comp++)
- {
- switch(predMode)
- {
- case 0: /* Intra_Chroma_DC */
- IntraChromaDcPrediction(data, above+1, left, availableA,
- availableB);
- break;
-
- case 1: /* Intra_Chroma_Horizontal */
- if (!availableA)
- return(HANTRO_NOK);
- IntraChromaHorizontalPrediction(data, left);
- break;
-
- case 2: /* Intra_Chroma_Vertical */
- if (!availableB)
- return(HANTRO_NOK);
- IntraChromaVerticalPrediction(data, above+1);
-
- break;
-
- default: /* case 3: Intra_Chroma_Plane */
- if (!availableA || !availableB || !availableD)
- return(HANTRO_NOK);
- IntraChromaPlanePrediction(data, above+1, left);
- break;
- }
- for (i = 0; i < 4; i++, block++)
- h264bsdAddResidual(data, residual[i], block);
-
- /* advance pointers */
- data += 64;
- above += 9;
- left += 8;
- residual += 4;
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdAddResidual
-
- Functional description:
- Add residual of a block into prediction in macroblock array 'data'.
- The result (residual + prediction) is stored in 'data'.
-
-------------------------------------------------------------------------------*/
-#ifndef H264DEC_OMXDL
-void h264bsdAddResidual(u8 *data, i32 *residual, u32 blockNum)
-{
-
-/* Variables */
-
- u32 i;
- u32 x, y;
- u32 width;
- i32 tmp1, tmp2, tmp3, tmp4;
- u8 *tmp;
- const u8 *clp = h264bsdClip + 512;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(residual);
- ASSERT(blockNum < 16 + 4 + 4);
-
- if (IS_RESIDUAL_EMPTY(residual))
- return;
-
- RANGE_CHECK_ARRAY(residual, -512, 511, 16);
-
- if (blockNum < 16)
- {
- width = 16;
- x = h264bsdBlockX[blockNum];
- y = h264bsdBlockY[blockNum];
- }
- else
- {
- width = 8;
- x = h264bsdBlockX[blockNum & 0x3];
- y = h264bsdBlockY[blockNum & 0x3];
- }
-
- tmp = data + y*width + x;
- for (i = 4; i; i--)
- {
- tmp1 = *residual++;
- tmp2 = tmp[0];
- tmp3 = *residual++;
- tmp4 = tmp[1];
-
- tmp[0] = clp[tmp1 + tmp2];
-
- tmp1 = *residual++;
- tmp2 = tmp[2];
-
- tmp[1] = clp[tmp3 + tmp4];
-
- tmp3 = *residual++;
- tmp4 = tmp[3];
-
- tmp1 = clp[tmp1 + tmp2];
- tmp3 = clp[tmp3 + tmp4];
- tmp[2] = (u8)tmp1;
- tmp[3] = (u8)tmp3;
-
- tmp += width;
- }
-
-}
-#endif
-/*------------------------------------------------------------------------------
-
- Function: Intra16x16VerticalPrediction
-
- Functional description:
- Perform intra 16x16 vertical prediction mode.
-
-------------------------------------------------------------------------------*/
-
-void Intra16x16VerticalPrediction(u8 *data, u8 *above)
-{
-
-/* Variables */
-
- u32 i, j;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(above);
-
- for (i = 0; i < 16; i++)
- {
- for (j = 0; j < 16; j++)
- {
- *data++ = above[j];
- }
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: Intra16x16HorizontalPrediction
-
- Functional description:
- Perform intra 16x16 horizontal prediction mode.
-
-------------------------------------------------------------------------------*/
-
-void Intra16x16HorizontalPrediction(u8 *data, u8 *left)
-{
-
-/* Variables */
-
- u32 i, j;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(left);
-
- for (i = 0; i < 16; i++)
- {
- for (j = 0; j < 16; j++)
- {
- *data++ = left[i];
- }
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: Intra16x16DcPrediction
-
- Functional description:
- Perform intra 16x16 DC prediction mode.
-
-------------------------------------------------------------------------------*/
-
-void Intra16x16DcPrediction(u8 *data, u8 *above, u8 *left, u32 availableA,
- u32 availableB)
-{
-
-/* Variables */
-
- u32 i, tmp;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(above);
- ASSERT(left);
-
- if (availableA && availableB)
- {
- for (i = 0, tmp = 0; i < 16; i++)
- tmp += above[i] + left[i];
- tmp = (tmp + 16) >> 5;
- }
- else if (availableA)
- {
- for (i = 0, tmp = 0; i < 16; i++)
- tmp += left[i];
- tmp = (tmp + 8) >> 4;
- }
- else if (availableB)
- {
- for (i = 0, tmp = 0; i < 16; i++)
- tmp += above[i];
- tmp = (tmp + 8) >> 4;
- }
- /* neither A nor B available */
- else
- {
- tmp = 128;
- }
- for (i = 0; i < 256; i++)
- data[i] = (u8)tmp;
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: Intra16x16PlanePrediction
-
- Functional description:
- Perform intra 16x16 plane prediction mode.
-
-------------------------------------------------------------------------------*/
-
-void Intra16x16PlanePrediction(u8 *data, u8 *above, u8 *left)
-{
-
-/* Variables */
-
- i32 i, j;
- i32 a, b, c;
- i32 tmp;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(above);
- ASSERT(left);
-
- a = 16 * (above[15] + left[15]);
-
- for (i = 0, b = 0; i < 8; i++)
- b += (i + 1) * (above[8+i] - above[6-i]);
- b = (5 * b + 32) >> 6;
-
- for (i = 0, c = 0; i < 7; i++)
- c += (i + 1) * (left[8+i] - left[6-i]);
- /* p[-1,-1] has to be accessed through above pointer */
- c += (i + 1) * (left[8+i] - above[-1]);
- c = (5 * c + 32) >> 6;
-
- for (i = 0; i < 16; i++)
- {
- for (j = 0; j < 16; j++)
- {
- tmp = (a + b * (j - 7) + c * (i - 7) + 16) >> 5;
- data[i*16+j] = (u8)CLIP1(tmp);
- }
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: IntraChromaDcPrediction
-
- Functional description:
- Perform intra chroma DC prediction mode.
-
-------------------------------------------------------------------------------*/
-
-void IntraChromaDcPrediction(u8 *data, u8 *above, u8 *left, u32 availableA,
- u32 availableB)
-{
-
-/* Variables */
-
- u32 i;
- u32 tmp1, tmp2;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(above);
- ASSERT(left);
-
- /* y = 0..3 */
- if (availableA && availableB)
- {
- tmp1 = above[0] + above[1] + above[2] + above[3] +
- left[0] + left[1] + left[2] + left[3];
- tmp1 = (tmp1 + 4) >> 3;
- tmp2 = (above[4] + above[5] + above[6] + above[7] + 2) >> 2;
- }
- else if (availableB)
- {
- tmp1 = (above[0] + above[1] + above[2] + above[3] + 2) >> 2;
- tmp2 = (above[4] + above[5] + above[6] + above[7] + 2) >> 2;
- }
- else if (availableA)
- {
- tmp1 = (left[0] + left[1] + left[2] + left[3] + 2) >> 2;
- tmp2 = tmp1;
- }
- /* neither A nor B available */
- else
- {
- tmp1 = tmp2 = 128;
- }
-
- ASSERT(tmp1 < 256 && tmp2 < 256);
- for (i = 4; i--;)
- {
- *data++ = (u8)tmp1;
- *data++ = (u8)tmp1;
- *data++ = (u8)tmp1;
- *data++ = (u8)tmp1;
- *data++ = (u8)tmp2;
- *data++ = (u8)tmp2;
- *data++ = (u8)tmp2;
- *data++ = (u8)tmp2;
- }
-
- /* y = 4...7 */
- if (availableA)
- {
- tmp1 = (left[4] + left[5] + left[6] + left[7] + 2) >> 2;
- if (availableB)
- {
- tmp2 = above[4] + above[5] + above[6] + above[7] +
- left[4] + left[5] + left[6] + left[7];
- tmp2 = (tmp2 + 4) >> 3;
- }
- else
- tmp2 = tmp1;
- }
- else if (availableB)
- {
- tmp1 = (above[0] + above[1] + above[2] + above[3] + 2) >> 2;
- tmp2 = (above[4] + above[5] + above[6] + above[7] + 2) >> 2;
- }
- else
- {
- tmp1 = tmp2 = 128;
- }
-
- ASSERT(tmp1 < 256 && tmp2 < 256);
- for (i = 4; i--;)
- {
- *data++ = (u8)tmp1;
- *data++ = (u8)tmp1;
- *data++ = (u8)tmp1;
- *data++ = (u8)tmp1;
- *data++ = (u8)tmp2;
- *data++ = (u8)tmp2;
- *data++ = (u8)tmp2;
- *data++ = (u8)tmp2;
- }
-}
-
-/*------------------------------------------------------------------------------
-
- Function: IntraChromaHorizontalPrediction
-
- Functional description:
- Perform intra chroma horizontal prediction mode.
-
-------------------------------------------------------------------------------*/
-
-void IntraChromaHorizontalPrediction(u8 *data, u8 *left)
-{
-
-/* Variables */
-
- u32 i;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(left);
-
- for (i = 8; i--;)
- {
- *data++ = *left;
- *data++ = *left;
- *data++ = *left;
- *data++ = *left;
- *data++ = *left;
- *data++ = *left;
- *data++ = *left;
- *data++ = *left++;
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: IntraChromaVerticalPrediction
-
- Functional description:
- Perform intra chroma vertical prediction mode.
-
-------------------------------------------------------------------------------*/
-
-void IntraChromaVerticalPrediction(u8 *data, u8 *above)
-{
-
-/* Variables */
-
- u32 i;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(above);
-
- for (i = 8; i--;data++/*above-=8*/)
- {
- data[0] = *above;
- data[8] = *above;
- data[16] = *above;
- data[24] = *above;
- data[32] = *above;
- data[40] = *above;
- data[48] = *above;
- data[56] = *above++;
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: IntraChromaPlanePrediction
-
- Functional description:
- Perform intra chroma plane prediction mode.
-
-------------------------------------------------------------------------------*/
-
-void IntraChromaPlanePrediction(u8 *data, u8 *above, u8 *left)
-{
-
-/* Variables */
-
- u32 i;
- i32 a, b, c;
- i32 tmp;
- const u8 *clp = h264bsdClip + 512;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(above);
- ASSERT(left);
-
- a = 16 * (above[7] + left[7]);
-
- b = (above[4] - above[2]) + 2 * (above[5] - above[1])
- + 3 * (above[6] - above[0]) + 4 * (above[7] - above[-1]);
- b = (17 * b + 16) >> 5;
-
- /* p[-1,-1] has to be accessed through above pointer */
- c = (left[4] - left[2]) + 2 * (left[5] - left[1])
- + 3 * (left[6] - left[0]) + 4 * (left[7] - above[-1]);
- c = (17 * c + 16) >> 5;
-
- /*a += 16;*/
- a = a - 3 * c + 16;
- for (i = 8; i--; a += c)
- {
- tmp = (a - 3 * b);
- *data++ = clp[tmp>>5];
- tmp += b;
- *data++ = clp[tmp>>5];
- tmp += b;
- *data++ = clp[tmp>>5];
- tmp += b;
- *data++ = clp[tmp>>5];
- tmp += b;
- *data++ = clp[tmp>>5];
- tmp += b;
- *data++ = clp[tmp>>5];
- tmp += b;
- *data++ = clp[tmp>>5];
- tmp += b;
- *data++ = clp[tmp>>5];
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: Get4x4NeighbourPels
-
- Functional description:
- Get neighbouring pixels of a 4x4 block into 'a' and 'l'.
-
-------------------------------------------------------------------------------*/
-
-void Get4x4NeighbourPels(u8 *a, u8 *l, u8 *data, u8 *above, u8 *left,
- u32 blockNum)
-{
-
-/* Variables */
-
- u32 x, y;
- u8 t1, t2;
-
-/* Code */
-
- ASSERT(a);
- ASSERT(l);
- ASSERT(data);
- ASSERT(above);
- ASSERT(left);
- ASSERT(blockNum < 16);
-
- x = h264bsdBlockX[blockNum];
- y = h264bsdBlockY[blockNum];
-
- /* A and D */
- if (x == 0)
- {
- t1 = left[y ];
- t2 = left[y + 1];
- l[1] = t1;
- l[2] = t2;
- t1 = left[y + 2];
- t2 = left[y + 3];
- l[3] = t1;
- l[4] = t2;
- }
- else
- {
- t1 = data[y * 16 + x - 1 ];
- t2 = data[y * 16 + x - 1 + 16];
- l[1] = t1;
- l[2] = t2;
- t1 = data[y * 16 + x - 1 + 32];
- t2 = data[y * 16 + x - 1 + 48];
- l[3] = t1;
- l[4] = t2;
- }
-
- /* B, C and D */
- if (y == 0)
- {
- t1 = above[x ];
- t2 = above[x ];
- l[0] = t1;
- a[0] = t2;
- t1 = above[x + 1];
- t2 = above[x + 2];
- a[1] = t1;
- a[2] = t2;
- t1 = above[x + 3];
- t2 = above[x + 4];
- a[3] = t1;
- a[4] = t2;
- t1 = above[x + 5];
- t2 = above[x + 6];
- a[5] = t1;
- a[6] = t2;
- t1 = above[x + 7];
- t2 = above[x + 8];
- a[7] = t1;
- a[8] = t2;
- }
- else
- {
- t1 = data[(y - 1) * 16 + x ];
- t2 = data[(y - 1) * 16 + x + 1];
- a[1] = t1;
- a[2] = t2;
- t1 = data[(y - 1) * 16 + x + 2];
- t2 = data[(y - 1) * 16 + x + 3];
- a[3] = t1;
- a[4] = t2;
- t1 = data[(y - 1) * 16 + x + 4];
- t2 = data[(y - 1) * 16 + x + 5];
- a[5] = t1;
- a[6] = t2;
- t1 = data[(y - 1) * 16 + x + 6];
- t2 = data[(y - 1) * 16 + x + 7];
- a[7] = t1;
- a[8] = t2;
-
- if (x == 0)
- l[0] = a[0] = left[y-1];
- else
- l[0] = a[0] = data[(y - 1) * 16 + x - 1];
- }
-}
-
-
-/*------------------------------------------------------------------------------
-
- Function: Intra4x4VerticalPrediction
-
- Functional description:
- Perform intra 4x4 vertical prediction mode.
-
-------------------------------------------------------------------------------*/
-
-void Intra4x4VerticalPrediction(u8 *data, u8 *above)
-{
-
-/* Variables */
-
- u8 t1, t2;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(above);
-
- t1 = above[0];
- t2 = above[1];
- data[0] = data[4] = data[8] = data[12] = t1;
- data[1] = data[5] = data[9] = data[13] = t2;
- t1 = above[2];
- t2 = above[3];
- data[2] = data[6] = data[10] = data[14] = t1;
- data[3] = data[7] = data[11] = data[15] = t2;
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: Intra4x4HorizontalPrediction
-
- Functional description:
- Perform intra 4x4 horizontal prediction mode.
-
-------------------------------------------------------------------------------*/
-
-void Intra4x4HorizontalPrediction(u8 *data, u8 *left)
-{
-
-/* Variables */
-
- u8 t1, t2;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(left);
-
- t1 = left[0];
- t2 = left[1];
- data[0] = data[1] = data[2] = data[3] = t1;
- data[4] = data[5] = data[6] = data[7] = t2;
- t1 = left[2];
- t2 = left[3];
- data[8] = data[9] = data[10] = data[11] = t1;
- data[12] = data[13] = data[14] = data[15] = t2;
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: Intra4x4DcPrediction
-
- Functional description:
- Perform intra 4x4 DC prediction mode.
-
-------------------------------------------------------------------------------*/
-
-void Intra4x4DcPrediction(u8 *data, u8 *above, u8 *left, u32 availableA,
- u32 availableB)
-{
-
-/* Variables */
-
- u32 tmp;
- u8 t1, t2, t3, t4;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(above);
- ASSERT(left);
-
- if (availableA && availableB)
- {
- t1 = above[0]; t2 = above[1]; t3 = above[2]; t4 = above[3];
- tmp = t1 + t2 + t3 + t4;
- t1 = left[0]; t2 = left[1]; t3 = left[2]; t4 = left[3];
- tmp += t1 + t2 + t3 + t4;
- tmp = (tmp + 4) >> 3;
- }
- else if (availableA)
- {
- t1 = left[0]; t2 = left[1]; t3 = left[2]; t4 = left[3];
- tmp = (t1 + t2 + t3 + t4 + 2) >> 2;
- }
- else if (availableB)
- {
- t1 = above[0]; t2 = above[1]; t3 = above[2]; t4 = above[3];
- tmp = (t1 + t2 + t3 + t4 + 2) >> 2;
- }
- else
- {
- tmp = 128;
- }
-
- ASSERT(tmp < 256);
- data[0] = data[1] = data[2] = data[3] =
- data[4] = data[5] = data[6] = data[7] =
- data[8] = data[9] = data[10] = data[11] =
- data[12] = data[13] = data[14] = data[15] = (u8)tmp;
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: Intra4x4DiagonalDownLeftPrediction
-
- Functional description:
- Perform intra 4x4 diagonal down-left prediction mode.
-
-------------------------------------------------------------------------------*/
-
-void Intra4x4DiagonalDownLeftPrediction(u8 *data, u8 *above)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(data);
- ASSERT(above);
-
- data[ 0] = (above[0] + 2 * above[1] + above[2] + 2) >> 2;
- data[ 1] = (above[1] + 2 * above[2] + above[3] + 2) >> 2;
- data[ 4] = (above[1] + 2 * above[2] + above[3] + 2) >> 2;
- data[ 2] = (above[2] + 2 * above[3] + above[4] + 2) >> 2;
- data[ 5] = (above[2] + 2 * above[3] + above[4] + 2) >> 2;
- data[ 8] = (above[2] + 2 * above[3] + above[4] + 2) >> 2;
- data[ 3] = (above[3] + 2 * above[4] + above[5] + 2) >> 2;
- data[ 6] = (above[3] + 2 * above[4] + above[5] + 2) >> 2;
- data[ 9] = (above[3] + 2 * above[4] + above[5] + 2) >> 2;
- data[12] = (above[3] + 2 * above[4] + above[5] + 2) >> 2;
- data[ 7] = (above[4] + 2 * above[5] + above[6] + 2) >> 2;
- data[10] = (above[4] + 2 * above[5] + above[6] + 2) >> 2;
- data[13] = (above[4] + 2 * above[5] + above[6] + 2) >> 2;
- data[11] = (above[5] + 2 * above[6] + above[7] + 2) >> 2;
- data[14] = (above[5] + 2 * above[6] + above[7] + 2) >> 2;
- data[15] = (above[6] + 3 * above[7] + 2) >> 2;
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: Intra4x4DiagonalDownRightPrediction
-
- Functional description:
- Perform intra 4x4 diagonal down-right prediction mode.
-
-------------------------------------------------------------------------------*/
-
-void Intra4x4DiagonalDownRightPrediction(u8 *data, u8 *above, u8 *left)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(data);
- ASSERT(above);
- ASSERT(left);
-
- data[ 0] = (above[0] + 2 * above[-1] + left[0] + 2) >> 2;
- data[ 5] = (above[0] + 2 * above[-1] + left[0] + 2) >> 2;
- data[10] = (above[0] + 2 * above[-1] + left[0] + 2) >> 2;
- data[15] = (above[0] + 2 * above[-1] + left[0] + 2) >> 2;
- data[ 1] = (above[-1] + 2 * above[0] + above[1] + 2) >> 2;
- data[ 6] = (above[-1] + 2 * above[0] + above[1] + 2) >> 2;
- data[11] = (above[-1] + 2 * above[0] + above[1] + 2) >> 2;
- data[ 2] = (above[0] + 2 * above[1] + above[2] + 2) >> 2;
- data[ 7] = (above[0] + 2 * above[1] + above[2] + 2) >> 2;
- data[ 3] = (above[1] + 2 * above[2] + above[3] + 2) >> 2;
- data[ 4] = (left[-1] + 2 * left[0] + left[1] + 2) >> 2;
- data[ 9] = (left[-1] + 2 * left[0] + left[1] + 2) >> 2;
- data[14] = (left[-1] + 2 * left[0] + left[1] + 2) >> 2;
- data[ 8] = (left[0] + 2 * left[1] + left[2] + 2) >> 2;
- data[13] = (left[0] + 2 * left[1] + left[2] + 2) >> 2;
- data[12] = (left[1] + 2 * left[2] + left[3] + 2) >> 2;
-}
-
-/*------------------------------------------------------------------------------
-
- Function: Intra4x4VerticalRightPrediction
-
- Functional description:
- Perform intra 4x4 vertical right prediction mode.
-
-------------------------------------------------------------------------------*/
-
-void Intra4x4VerticalRightPrediction(u8 *data, u8 *above, u8 *left)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(data);
- ASSERT(above);
- ASSERT(left);
-
- data[ 0] = (above[-1] + above[0] + 1) >> 1;
- data[ 9] = (above[-1] + above[0] + 1) >> 1;
- data[ 5] = (above[-1] + 2 * above[0] + above[1] + 2) >> 2;
- data[14] = (above[-1] + 2 * above[0] + above[1] + 2) >> 2;
- data[ 4] = (above[0] + 2 * above[-1] + left[0] + 2) >> 2;
- data[13] = (above[0] + 2 * above[-1] + left[0] + 2) >> 2;
- data[ 1] = (above[0] + above[1] + 1) >> 1;
- data[10] = (above[0] + above[1] + 1) >> 1;
- data[ 6] = (above[0] + 2 * above[1] + above[2] + 2) >> 2;
- data[15] = (above[0] + 2 * above[1] + above[2] + 2) >> 2;
- data[ 2] = (above[1] + above[2] + 1) >> 1;
- data[11] = (above[1] + above[2] + 1) >> 1;
- data[ 7] = (above[1] + 2 * above[2] + above[3] + 2) >> 2;
- data[ 3] = (above[2] + above[3] + 1) >> 1;
- data[ 8] = (left[1] + 2 * left[0] + left[-1] + 2) >> 2;
- data[12] = (left[2] + 2 * left[1] + left[0] + 2) >> 2;
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: Intra4x4HorizontalDownPrediction
-
- Functional description:
- Perform intra 4x4 horizontal down prediction mode.
-
-------------------------------------------------------------------------------*/
-
-void Intra4x4HorizontalDownPrediction(u8 *data, u8 *above, u8 *left)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(data);
- ASSERT(above);
- ASSERT(left);
-
- data[ 0] = (left[-1] + left[0] + 1) >> 1;
- data[ 6] = (left[-1] + left[0] + 1) >> 1;
- data[ 5] = (left[-1] + 2 * left[0] + left[1] + 2) >> 2;
- data[11] = (left[-1] + 2 * left[0] + left[1] + 2) >> 2;
- data[ 4] = (left[0] + left[1] + 1) >> 1;
- data[10] = (left[0] + left[1] + 1) >> 1;
- data[ 9] = (left[0] + 2 * left[1] + left[2] + 2) >> 2;
- data[15] = (left[0] + 2 * left[1] + left[2] + 2) >> 2;
- data[ 8] = (left[1] + left[2] + 1) >> 1;
- data[14] = (left[1] + left[2] + 1) >> 1;
- data[13] = (left[1] + 2 * left[2] + left[3] + 2) >> 2;
- data[12] = (left[2] + left[3] + 1) >> 1;
- data[ 1] = (above[0] + 2 * above[-1] + left[0] + 2) >> 2;
- data[ 7] = (above[0] + 2 * above[-1] + left[0] + 2) >> 2;
- data[ 2] = (above[1] + 2 * above[0] + above[-1] + 2) >> 2;
- data[ 3] = (above[2] + 2 * above[1] + above[0] + 2) >> 2;
-}
-
-/*------------------------------------------------------------------------------
-
- Function: Intra4x4VerticalLeftPrediction
-
- Functional description:
- Perform intra 4x4 vertical left prediction mode.
-
-------------------------------------------------------------------------------*/
-
-void Intra4x4VerticalLeftPrediction(u8 *data, u8 *above)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(data);
- ASSERT(above);
-
- data[ 0] = (above[0] + above[1] + 1) >> 1;
- data[ 1] = (above[1] + above[2] + 1) >> 1;
- data[ 2] = (above[2] + above[3] + 1) >> 1;
- data[ 3] = (above[3] + above[4] + 1) >> 1;
- data[ 4] = (above[0] + 2 * above[1] + above[2] + 2) >> 2;
- data[ 5] = (above[1] + 2 * above[2] + above[3] + 2) >> 2;
- data[ 6] = (above[2] + 2 * above[3] + above[4] + 2) >> 2;
- data[ 7] = (above[3] + 2 * above[4] + above[5] + 2) >> 2;
- data[ 8] = (above[1] + above[2] + 1) >> 1;
- data[ 9] = (above[2] + above[3] + 1) >> 1;
- data[10] = (above[3] + above[4] + 1) >> 1;
- data[11] = (above[4] + above[5] + 1) >> 1;
- data[12] = (above[1] + 2 * above[2] + above[3] + 2) >> 2;
- data[13] = (above[2] + 2 * above[3] + above[4] + 2) >> 2;
- data[14] = (above[3] + 2 * above[4] + above[5] + 2) >> 2;
- data[15] = (above[4] + 2 * above[5] + above[6] + 2) >> 2;
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: Intra4x4HorizontalUpPrediction
-
- Functional description:
- Perform intra 4x4 horizontal up prediction mode.
-
-------------------------------------------------------------------------------*/
-
-void Intra4x4HorizontalUpPrediction(u8 *data, u8 *left)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(data);
- ASSERT(left);
-
- data[ 0] = (left[0] + left[1] + 1) >> 1;
- data[ 1] = (left[0] + 2 * left[1] + left[2] + 2) >> 2;
- data[ 2] = (left[1] + left[2] + 1) >> 1;
- data[ 3] = (left[1] + 2 * left[2] + left[3] + 2) >> 2;
- data[ 4] = (left[1] + left[2] + 1) >> 1;
- data[ 5] = (left[1] + 2 * left[2] + left[3] + 2) >> 2;
- data[ 6] = (left[2] + left[3] + 1) >> 1;
- data[ 7] = (left[2] + 3 * left[3] + 2) >> 2;
- data[ 8] = (left[2] + left[3] + 1) >> 1;
- data[ 9] = (left[2] + 3 * left[3] + 2) >> 2;
- data[10] = left[3];
- data[11] = left[3];
- data[12] = left[3];
- data[13] = left[3];
- data[14] = left[3];
- data[15] = left[3];
-
-}
-
-#endif /* H264DEC_OMXDL */
-
-/*------------------------------------------------------------------------------
-
- Function: Write4x4To16x16
-
- Functional description:
- Write a 4x4 block (data4x4) into correct position
- in 16x16 macroblock (data).
-
-------------------------------------------------------------------------------*/
-
-void Write4x4To16x16(u8 *data, u8 *data4x4, u32 blockNum)
-{
-
-/* Variables */
-
- u32 x, y;
- u32 *in32, *out32;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(data4x4);
- ASSERT(blockNum < 16);
-
- x = h264bsdBlockX[blockNum];
- y = h264bsdBlockY[blockNum];
-
- data += y*16+x;
-
- ASSERT(((u32)data&0x3) == 0);
-
- /*lint --e(826) */
- out32 = (u32 *)data;
- /*lint --e(826) */
- in32 = (u32 *)data4x4;
-
- out32[0] = *in32++;
- out32[4] = *in32++;
- out32[8] = *in32++;
- out32[12] = *in32++;
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DetermineIntra4x4PredMode
-
- Functional description:
- Returns the intra 4x4 prediction mode of a block based on the
- neighbouring macroblocks and information parsed from stream.
-
-------------------------------------------------------------------------------*/
-
-u32 DetermineIntra4x4PredMode(macroblockLayer_t *pMbLayer,
- u32 available, neighbour_t *nA, neighbour_t *nB, u32 index,
- mbStorage_t *nMbA, mbStorage_t *nMbB)
-{
-
-/* Variables */
-
- u32 mode1, mode2;
- mbStorage_t *pMb;
-
-/* Code */
-
- ASSERT(pMbLayer);
-
- /* dc only prediction? */
- if (!available)
- mode1 = 2;
- else
- {
- pMb = nMbA;
- if (h264bsdMbPartPredMode(pMb->mbType) == PRED_MODE_INTRA4x4)
- {
- mode1 = pMb->intra4x4PredMode[nA->index];
- }
- else
- mode1 = 2;
-
- pMb = nMbB;
- if (h264bsdMbPartPredMode(pMb->mbType) == PRED_MODE_INTRA4x4)
- {
- mode2 = pMb->intra4x4PredMode[nB->index];
- }
- else
- mode2 = 2;
-
- mode1 = MIN(mode1, mode2);
- }
-
- if (!pMbLayer->mbPred.prevIntra4x4PredModeFlag[index])
- {
- if (pMbLayer->mbPred.remIntra4x4PredMode[index] < mode1)
- {
- mode1 = pMbLayer->mbPred.remIntra4x4PredMode[index];
- }
- else
- {
- mode1 = pMbLayer->mbPred.remIntra4x4PredMode[index] + 1;
- }
- }
-
- return(mode1);
-}
-
-
-/*lint +e702 */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_intra_prediction.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_intra_prediction.h
deleted file mode 100644
index 4652bd5..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_intra_prediction.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_INTRA_PREDICTION_H
-#define H264SWDEC_INTRA_PREDICTION_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_image.h"
-#include "h264bsd_macroblock_layer.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-#ifndef H264DEC_OMXDL
-u32 h264bsdIntraPrediction(mbStorage_t *pMb, macroblockLayer_t *mbLayer,
- image_t *image, u32 mbNum, u32 constrainedIntraPred, u8 *data);
-
-u32 h264bsdIntra4x4Prediction(mbStorage_t *pMb, u8 *data,
- macroblockLayer_t *mbLayer,
- u8 *above, u8 *left, u32 constrainedIntraPred);
-u32 h264bsdIntra16x16Prediction(mbStorage_t *pMb, u8 *data, i32 residual[][16],
- u8 *above, u8 *left, u32 constrainedIntraPred);
-
-u32 h264bsdIntraChromaPrediction(mbStorage_t *pMb, u8 *data, i32 residual[][16],
- u8 *above, u8 *left, u32 predMode, u32 constrainedIntraPred);
-
-void h264bsdGetNeighbourPels(image_t *image, u8 *above, u8 *left, u32 mbNum);
-
-#else
-
-u32 h264bsdIntra4x4Prediction(mbStorage_t *pMb, u8 *data,
- macroblockLayer_t *mbLayer,
- u8 *pImage, u32 width,
- u32 constrainedIntraPred, u32 block);
-
-u32 h264bsdIntra16x16Prediction(mbStorage_t *pMb, u8 *data, u8 *pImage,
- u32 width, u32 constrainedIntraPred);
-
-u32 h264bsdIntraChromaPrediction(mbStorage_t *pMb, u8 *data, image_t *image,
- u32 predMode, u32 constrainedIntraPred);
-
-#endif
-
-#endif /* #ifdef H264SWDEC_INTRA_PREDICTION_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_macroblock_layer.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_macroblock_layer.c
deleted file mode 100644
index 2b3e7f0..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_macroblock_layer.c
+++ /dev/null
@@ -1,1446 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdDecodeMacroblockLayer
- h264bsdMbPartPredMode
- h264bsdNumMbPart
- h264bsdNumSubMbPart
- DecodeMbPred
- DecodeSubMbPred
- DecodeResidual
- DetermineNc
- CbpIntra16x16
- h264bsdPredModeIntra16x16
- h264bsdDecodeMacroblock
- ProcessResidual
- h264bsdSubMbPartMode
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_macroblock_layer.h"
-#include "h264bsd_slice_header.h"
-#include "h264bsd_util.h"
-#include "h264bsd_vlc.h"
-#include "h264bsd_cavlc.h"
-#include "h264bsd_nal_unit.h"
-#include "h264bsd_neighbour.h"
-#include "h264bsd_transform.h"
-#include "h264bsd_intra_prediction.h"
-#include "h264bsd_inter_prediction.h"
-
-#ifdef H264DEC_OMXDL
-#include "omxtypes.h"
-#include "omxVC.h"
-#include "armVC.h"
-#endif /* H264DEC_OMXDL */
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-#ifdef H264DEC_OMXDL
-static const u32 chromaIndex[8] = { 256, 260, 288, 292, 320, 324, 352, 356 };
-static const u32 lumaIndex[16] = { 0, 4, 64, 68,
- 8, 12, 72, 76,
- 128, 132, 192, 196,
- 136, 140, 200, 204 };
-#endif
-/* mapping of dc coefficients array to luma blocks */
-static const u32 dcCoeffIndex[16] =
- {0, 1, 4, 5, 2, 3, 6, 7, 8, 9, 12, 13, 10, 11, 14, 15};
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-static u32 DecodeMbPred(strmData_t *pStrmData, mbPred_t *pMbPred,
- mbType_e mbType, u32 numRefIdxActive);
-static u32 DecodeSubMbPred(strmData_t *pStrmData, subMbPred_t *pSubMbPred,
- mbType_e mbType, u32 numRefIdxActive);
-static u32 DecodeResidual(strmData_t *pStrmData, residual_t *pResidual,
- mbStorage_t *pMb, mbType_e mbType, u32 codedBlockPattern);
-
-#ifdef H264DEC_OMXDL
-static u32 DetermineNc(mbStorage_t *pMb, u32 blockIndex, u8 *pTotalCoeff);
-#else
-static u32 DetermineNc(mbStorage_t *pMb, u32 blockIndex, i16 *pTotalCoeff);
-#endif
-
-static u32 CbpIntra16x16(mbType_e mbType);
-#ifdef H264DEC_OMXDL
-static u32 ProcessIntra4x4Residual(mbStorage_t *pMb, u8 *data, u32 constrainedIntraPred,
- macroblockLayer_t *mbLayer, const u8 **pSrc, image_t *image);
-static u32 ProcessChromaResidual(mbStorage_t *pMb, u8 *data, const u8 **pSrc );
-static u32 ProcessIntra16x16Residual(mbStorage_t *pMb, u8 *data, u32 constrainedIntraPred,
- u32 intraChromaPredMode, const u8 **pSrc, image_t *image);
-
-
-#else
-static u32 ProcessResidual(mbStorage_t *pMb, i32 residualLevel[][16], u32 *);
-#endif
-
-/*------------------------------------------------------------------------------
-
- Function name: h264bsdDecodeMacroblockLayer
-
- Functional description:
- Parse macroblock specific information from bit stream.
-
- Inputs:
- pStrmData pointer to stream data structure
- pMb pointer to macroblock storage structure
- sliceType type of the current slice
- numRefIdxActive maximum reference index
-
- Outputs:
- pMbLayer stores the macroblock data parsed from stream
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK end of stream or error in stream
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeMacroblockLayer(strmData_t *pStrmData,
- macroblockLayer_t *pMbLayer, mbStorage_t *pMb, u32 sliceType,
- u32 numRefIdxActive)
-{
-
-/* Variables */
-
- u32 tmp, i, value;
- i32 itmp;
- mbPartPredMode_e partMode;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pMbLayer);
-
-#ifdef H264DEC_NEON
- h264bsdClearMbLayer(pMbLayer, ((sizeof(macroblockLayer_t) + 63) & ~0x3F));
-#else
- H264SwDecMemset(pMbLayer, 0, sizeof(macroblockLayer_t));
-#endif
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
-
- if (IS_I_SLICE(sliceType))
- {
- if ((value + 6) > 31 || tmp != HANTRO_OK)
- return(HANTRO_NOK);
- pMbLayer->mbType = (mbType_e)(value + 6);
- }
- else
- {
- if ((value + 1) > 31 || tmp != HANTRO_OK)
- return(HANTRO_NOK);
- pMbLayer->mbType = (mbType_e)(value + 1);
- }
-
- if (pMbLayer->mbType == I_PCM)
- {
- i32 *level;
- while( !h264bsdIsByteAligned(pStrmData) )
- {
- /* pcm_alignment_zero_bit */
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp)
- return(HANTRO_NOK);
- }
-
- level = pMbLayer->residual.level[0];
- for (i = 0; i < 384; i++)
- {
- value = h264bsdGetBits(pStrmData, 8);
- if (value == END_OF_STREAM)
- return(HANTRO_NOK);
- *level++ = (i32)value;
- }
- }
- else
- {
- partMode = h264bsdMbPartPredMode(pMbLayer->mbType);
- if ( (partMode == PRED_MODE_INTER) &&
- (h264bsdNumMbPart(pMbLayer->mbType) == 4) )
- {
- tmp = DecodeSubMbPred(pStrmData, &pMbLayer->subMbPred,
- pMbLayer->mbType, numRefIdxActive);
- }
- else
- {
- tmp = DecodeMbPred(pStrmData, &pMbLayer->mbPred,
- pMbLayer->mbType, numRefIdxActive);
- }
- if (tmp != HANTRO_OK)
- return(tmp);
-
- if (partMode != PRED_MODE_INTRA16x16)
- {
- tmp = h264bsdDecodeExpGolombMapped(pStrmData, &value,
- (u32)(partMode == PRED_MODE_INTRA4x4));
- if (tmp != HANTRO_OK)
- return(tmp);
- pMbLayer->codedBlockPattern = value;
- }
- else
- {
- pMbLayer->codedBlockPattern = CbpIntra16x16(pMbLayer->mbType);
- }
-
- if ( pMbLayer->codedBlockPattern ||
- (partMode == PRED_MODE_INTRA16x16) )
- {
- tmp = h264bsdDecodeExpGolombSigned(pStrmData, &itmp);
- if (tmp != HANTRO_OK || (itmp < -26) || (itmp > 25) )
- return(HANTRO_NOK);
- pMbLayer->mbQpDelta = itmp;
-
- tmp = DecodeResidual(pStrmData, &pMbLayer->residual, pMb,
- pMbLayer->mbType, pMbLayer->codedBlockPattern);
-
- pStrmData->strmBuffReadBits =
- (u32)(pStrmData->pStrmCurrPos - pStrmData->pStrmBuffStart) * 8 +
- pStrmData->bitPosInWord;
-
- if (tmp != HANTRO_OK)
- return(tmp);
- }
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdMbPartPredMode
-
- Functional description:
- Returns the prediction mode of a macroblock type
-
-------------------------------------------------------------------------------*/
-
-mbPartPredMode_e h264bsdMbPartPredMode(mbType_e mbType)
-{
-
-/* Variables */
-
-
-/* Code */
-
- ASSERT(mbType <= 31);
-
- if ((mbType <= P_8x8ref0))
- return(PRED_MODE_INTER);
- else if (mbType == I_4x4)
- return(PRED_MODE_INTRA4x4);
- else
- return(PRED_MODE_INTRA16x16);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdNumMbPart
-
- Functional description:
- Returns the amount of macroblock partitions in a macroblock type
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdNumMbPart(mbType_e mbType)
-{
-
-/* Variables */
-
-
-/* Code */
-
- ASSERT(h264bsdMbPartPredMode(mbType) == PRED_MODE_INTER);
-
- switch (mbType)
- {
- case P_L0_16x16:
- case P_Skip:
- return(1);
-
- case P_L0_L0_16x8:
- case P_L0_L0_8x16:
- return(2);
-
- /* P_8x8 or P_8x8ref0 */
- default:
- return(4);
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdNumSubMbPart
-
- Functional description:
- Returns the amount of sub-partitions in a sub-macroblock type
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdNumSubMbPart(subMbType_e subMbType)
-{
-
-/* Variables */
-
-
-/* Code */
-
- ASSERT(subMbType <= P_L0_4x4);
-
- switch (subMbType)
- {
- case P_L0_8x8:
- return(1);
-
- case P_L0_8x4:
- case P_L0_4x8:
- return(2);
-
- /* P_L0_4x4 */
- default:
- return(4);
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeMbPred
-
- Functional description:
- Parse macroblock prediction information from bit stream and store
- in 'pMbPred'.
-
-------------------------------------------------------------------------------*/
-
-u32 DecodeMbPred(strmData_t *pStrmData, mbPred_t *pMbPred, mbType_e mbType,
- u32 numRefIdxActive)
-{
-
-/* Variables */
-
- u32 tmp, i, j, value;
- i32 itmp;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pMbPred);
-
- switch (h264bsdMbPartPredMode(mbType))
- {
- case PRED_MODE_INTER: /* PRED_MODE_INTER */
- if (numRefIdxActive > 1)
- {
- for (i = h264bsdNumMbPart(mbType), j = 0; i--; j++)
- {
- tmp = h264bsdDecodeExpGolombTruncated(pStrmData, &value,
- (u32)(numRefIdxActive > 2));
- if (tmp != HANTRO_OK || value >= numRefIdxActive)
- return(HANTRO_NOK);
-
- pMbPred->refIdxL0[j] = value;
- }
- }
-
- for (i = h264bsdNumMbPart(mbType), j = 0; i--; j++)
- {
- tmp = h264bsdDecodeExpGolombSigned(pStrmData, &itmp);
- if (tmp != HANTRO_OK)
- return(tmp);
- pMbPred->mvdL0[j].hor = (i16)itmp;
-
- tmp = h264bsdDecodeExpGolombSigned(pStrmData, &itmp);
- if (tmp != HANTRO_OK)
- return(tmp);
- pMbPred->mvdL0[j].ver = (i16)itmp;
- }
- break;
-
- case PRED_MODE_INTRA4x4:
- for (itmp = 0, i = 0; itmp < 2; itmp++)
- {
- value = h264bsdShowBits32(pStrmData);
- tmp = 0;
- for (j = 8; j--; i++)
- {
- pMbPred->prevIntra4x4PredModeFlag[i] =
- value & 0x80000000 ? HANTRO_TRUE : HANTRO_FALSE;
- value <<= 1;
- if (!pMbPred->prevIntra4x4PredModeFlag[i])
- {
- pMbPred->remIntra4x4PredMode[i] = value>>29;
- value <<= 3;
- tmp++;
- }
- }
- if (h264bsdFlushBits(pStrmData, 8 + 3*tmp) == END_OF_STREAM)
- return(HANTRO_NOK);
- }
- /* fall-through */
-
- case PRED_MODE_INTRA16x16:
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK || value > 3)
- return(HANTRO_NOK);
- pMbPred->intraChromaPredMode = value;
- break;
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeSubMbPred
-
- Functional description:
- Parse sub-macroblock prediction information from bit stream and
- store in 'pMbPred'.
-
-------------------------------------------------------------------------------*/
-
-u32 DecodeSubMbPred(strmData_t *pStrmData, subMbPred_t *pSubMbPred,
- mbType_e mbType, u32 numRefIdxActive)
-{
-
-/* Variables */
-
- u32 tmp, i, j, value;
- i32 itmp;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pSubMbPred);
- ASSERT(h264bsdMbPartPredMode(mbType) == PRED_MODE_INTER);
-
- for (i = 0; i < 4; i++)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK || value > 3)
- return(HANTRO_NOK);
- pSubMbPred->subMbType[i] = (subMbType_e)value;
- }
-
- if ( (numRefIdxActive > 1) && (mbType != P_8x8ref0) )
- {
- for (i = 0; i < 4; i++)
- {
- tmp = h264bsdDecodeExpGolombTruncated(pStrmData, &value,
- (u32)(numRefIdxActive > 2));
- if (tmp != HANTRO_OK || value >= numRefIdxActive)
- return(HANTRO_NOK);
- pSubMbPred->refIdxL0[i] = value;
- }
- }
-
- for (i = 0; i < 4; i++)
- {
- j = 0;
- for (value = h264bsdNumSubMbPart(pSubMbPred->subMbType[i]);
- value--; j++)
- {
- tmp = h264bsdDecodeExpGolombSigned(pStrmData, &itmp);
- if (tmp != HANTRO_OK)
- return(tmp);
- pSubMbPred->mvdL0[i][j].hor = (i16)itmp;
-
- tmp = h264bsdDecodeExpGolombSigned(pStrmData, &itmp);
- if (tmp != HANTRO_OK)
- return(tmp);
- pSubMbPred->mvdL0[i][j].ver = (i16)itmp;
- }
- }
-
- return(HANTRO_OK);
-
-}
-
-#ifdef H264DEC_OMXDL
-/*------------------------------------------------------------------------------
-
- Function: DecodeResidual
-
- Functional description:
- Parse residual information from bit stream and store in 'pResidual'.
-
-------------------------------------------------------------------------------*/
-
-u32 DecodeResidual(strmData_t *pStrmData, residual_t *pResidual,
- mbStorage_t *pMb, mbType_e mbType, u32 codedBlockPattern)
-{
-
-/* Variables */
-
- u32 i, j;
- u32 blockCoded;
- u32 blockIndex;
- u32 is16x16;
- OMX_INT nc;
- OMXResult omxRes;
- OMX_U8 *pPosCoefBuf;
-
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pResidual);
-
- pPosCoefBuf = pResidual->posCoefBuf;
-
- /* luma DC is at index 24 */
- if (h264bsdMbPartPredMode(mbType) == PRED_MODE_INTRA16x16)
- {
- nc = (OMX_INT)DetermineNc(pMb, 0, pResidual->totalCoeff);
-#ifndef H264DEC_NEON
- omxRes = omxVCM4P10_DecodeCoeffsToPairCAVLC(
- (const OMX_U8 **) (&pStrmData->pStrmCurrPos),
- (OMX_S32*) (&pStrmData->bitPosInWord),
- &pResidual->totalCoeff[24],
- &pPosCoefBuf,
- nc,
- 16);
-#else
- omxRes = armVCM4P10_DecodeCoeffsToPair(
- (const OMX_U8 **) (&pStrmData->pStrmCurrPos),
- (OMX_S32*) (&pStrmData->bitPosInWord),
- &pResidual->totalCoeff[24],
- &pPosCoefBuf,
- nc,
- 16);
-#endif
- if (omxRes != OMX_Sts_NoErr)
- return(HANTRO_NOK);
- is16x16 = HANTRO_TRUE;
- }
- else
- is16x16 = HANTRO_FALSE;
-
- for (i = 4, blockIndex = 0; i--;)
- {
- /* luma cbp in bits 0-3 */
- blockCoded = codedBlockPattern & 0x1;
- codedBlockPattern >>= 1;
- if (blockCoded)
- {
- for (j = 4; j--; blockIndex++)
- {
- nc = (OMX_INT)DetermineNc(pMb,blockIndex,pResidual->totalCoeff);
- if (is16x16)
- {
-#ifndef H264DEC_NEON
- omxRes = omxVCM4P10_DecodeCoeffsToPairCAVLC(
- (const OMX_U8 **) (&pStrmData->pStrmCurrPos),
- (OMX_S32*) (&pStrmData->bitPosInWord),
- &pResidual->totalCoeff[blockIndex],
- &pPosCoefBuf,
- nc,
- 15);
-#else
- omxRes = armVCM4P10_DecodeCoeffsToPair(
- (const OMX_U8 **) (&pStrmData->pStrmCurrPos),
- (OMX_S32*) (&pStrmData->bitPosInWord),
- &pResidual->totalCoeff[blockIndex],
- &pPosCoefBuf,
- nc,
- 15);
-#endif
- }
- else
- {
-#ifndef H264DEC_NEON
- omxRes = omxVCM4P10_DecodeCoeffsToPairCAVLC(
- (const OMX_U8 **) (&pStrmData->pStrmCurrPos),
- (OMX_S32*) (&pStrmData->bitPosInWord),
- &pResidual->totalCoeff[blockIndex],
- &pPosCoefBuf,
- nc,
- 16);
-#else
- omxRes = armVCM4P10_DecodeCoeffsToPair(
- (const OMX_U8 **) (&pStrmData->pStrmCurrPos),
- (OMX_S32*) (&pStrmData->bitPosInWord),
- &pResidual->totalCoeff[blockIndex],
- &pPosCoefBuf,
- nc,
- 16);
-#endif
- }
- if (omxRes != OMX_Sts_NoErr)
- return(HANTRO_NOK);
- }
- }
- else
- blockIndex += 4;
- }
-
- /* chroma DC block are at indices 25 and 26 */
- blockCoded = codedBlockPattern & 0x3;
- if (blockCoded)
- {
-#ifndef H264DEC_NEON
- omxRes = omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC(
- (const OMX_U8**) (&pStrmData->pStrmCurrPos),
- (OMX_S32*) (&pStrmData->bitPosInWord),
- &pResidual->totalCoeff[25],
- &pPosCoefBuf);
-#else
- omxRes = armVCM4P10_DecodeCoeffsToPair(
- (const OMX_U8**) (&pStrmData->pStrmCurrPos),
- (OMX_S32*) (&pStrmData->bitPosInWord),
- &pResidual->totalCoeff[25],
- &pPosCoefBuf,
- 17,
- 4);
-#endif
- if (omxRes != OMX_Sts_NoErr)
- return(HANTRO_NOK);
-#ifndef H264DEC_NEON
- omxRes = omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC(
- (const OMX_U8**) (&pStrmData->pStrmCurrPos),
- (OMX_S32*) (&pStrmData->bitPosInWord),
- &pResidual->totalCoeff[26],
- &pPosCoefBuf);
-#else
- omxRes = armVCM4P10_DecodeCoeffsToPair(
- (const OMX_U8**) (&pStrmData->pStrmCurrPos),
- (OMX_S32*) (&pStrmData->bitPosInWord),
- &pResidual->totalCoeff[26],
- &pPosCoefBuf,
- 17,
- 4);
-#endif
- if (omxRes != OMX_Sts_NoErr)
- return(HANTRO_NOK);
- }
-
- /* chroma AC */
- blockCoded = codedBlockPattern & 0x2;
- if (blockCoded)
- {
- for (i = 8; i--;blockIndex++)
- {
- nc = (OMX_INT)DetermineNc(pMb, blockIndex, pResidual->totalCoeff);
-#ifndef H264DEC_NEON
- omxRes = omxVCM4P10_DecodeCoeffsToPairCAVLC(
- (const OMX_U8 **) (&pStrmData->pStrmCurrPos),
- (OMX_S32*) (&pStrmData->bitPosInWord),
- &pResidual->totalCoeff[blockIndex],
- &pPosCoefBuf,
- nc,
- 15);
-#else
- omxRes = armVCM4P10_DecodeCoeffsToPair(
- (const OMX_U8 **) (&pStrmData->pStrmCurrPos),
- (OMX_S32*) (&pStrmData->bitPosInWord),
- &pResidual->totalCoeff[blockIndex],
- &pPosCoefBuf,
- nc,
- 15);
-#endif
- if (omxRes != OMX_Sts_NoErr)
- return(HANTRO_NOK);
- }
- }
-
- return(HANTRO_OK);
-
-}
-
-#else
-/*------------------------------------------------------------------------------
-
- Function: DecodeResidual
-
- Functional description:
- Parse residual information from bit stream and store in 'pResidual'.
-
-------------------------------------------------------------------------------*/
-
-u32 DecodeResidual(strmData_t *pStrmData, residual_t *pResidual,
- mbStorage_t *pMb, mbType_e mbType, u32 codedBlockPattern)
-{
-
-/* Variables */
-
- u32 i, j, tmp;
- i32 nc;
- u32 blockCoded;
- u32 blockIndex;
- u32 is16x16;
- i32 (*level)[16];
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pResidual);
-
- level = pResidual->level;
-
- /* luma DC is at index 24 */
- if (h264bsdMbPartPredMode(mbType) == PRED_MODE_INTRA16x16)
- {
- nc = (i32)DetermineNc(pMb, 0, pResidual->totalCoeff);
- tmp = h264bsdDecodeResidualBlockCavlc(pStrmData, level[24], nc, 16);
- if ((tmp & 0xF) != HANTRO_OK)
- return(tmp);
- pResidual->totalCoeff[24] = (tmp >> 4) & 0xFF;
- is16x16 = HANTRO_TRUE;
- }
- else
- is16x16 = HANTRO_FALSE;
-
- for (i = 4, blockIndex = 0; i--;)
- {
- /* luma cbp in bits 0-3 */
- blockCoded = codedBlockPattern & 0x1;
- codedBlockPattern >>= 1;
- if (blockCoded)
- {
- for (j = 4; j--; blockIndex++)
- {
- nc = (i32)DetermineNc(pMb, blockIndex, pResidual->totalCoeff);
- if (is16x16)
- {
- tmp = h264bsdDecodeResidualBlockCavlc(pStrmData,
- level[blockIndex] + 1, nc, 15);
- pResidual->coeffMap[blockIndex] = tmp >> 15;
- }
- else
- {
- tmp = h264bsdDecodeResidualBlockCavlc(pStrmData,
- level[blockIndex], nc, 16);
- pResidual->coeffMap[blockIndex] = tmp >> 16;
- }
- if ((tmp & 0xF) != HANTRO_OK)
- return(tmp);
- pResidual->totalCoeff[blockIndex] = (tmp >> 4) & 0xFF;
- }
- }
- else
- blockIndex += 4;
- }
-
- /* chroma DC block are at indices 25 and 26 */
- blockCoded = codedBlockPattern & 0x3;
- if (blockCoded)
- {
- tmp = h264bsdDecodeResidualBlockCavlc(pStrmData, level[25], -1, 4);
- if ((tmp & 0xF) != HANTRO_OK)
- return(tmp);
- pResidual->totalCoeff[25] = (tmp >> 4) & 0xFF;
- tmp = h264bsdDecodeResidualBlockCavlc(pStrmData, level[25]+4, -1, 4);
- if ((tmp & 0xF) != HANTRO_OK)
- return(tmp);
- pResidual->totalCoeff[26] = (tmp >> 4) & 0xFF;
- }
-
- /* chroma AC */
- blockCoded = codedBlockPattern & 0x2;
- if (blockCoded)
- {
- for (i = 8; i--;blockIndex++)
- {
- nc = (i32)DetermineNc(pMb, blockIndex, pResidual->totalCoeff);
- tmp = h264bsdDecodeResidualBlockCavlc(pStrmData,
- level[blockIndex] + 1, nc, 15);
- if ((tmp & 0xF) != HANTRO_OK)
- return(tmp);
- pResidual->totalCoeff[blockIndex] = (tmp >> 4) & 0xFF;
- pResidual->coeffMap[blockIndex] = (tmp >> 15);
- }
- }
-
- return(HANTRO_OK);
-
-}
-#endif
-
-/*------------------------------------------------------------------------------
-
- Function: DetermineNc
-
- Functional description:
- Returns the nC of a block.
-
-------------------------------------------------------------------------------*/
-#ifdef H264DEC_OMXDL
-u32 DetermineNc(mbStorage_t *pMb, u32 blockIndex, u8 *pTotalCoeff)
-#else
-u32 DetermineNc(mbStorage_t *pMb, u32 blockIndex, i16 *pTotalCoeff)
-#endif
-{
-/*lint -e702 */
-/* Variables */
-
- u32 tmp;
- i32 n;
- const neighbour_t *neighbourA, *neighbourB;
- u8 neighbourAindex, neighbourBindex;
-
-/* Code */
-
- ASSERT(blockIndex < 24);
-
- /* if neighbour block belongs to current macroblock totalCoeff array
- * mbStorage has not been set/updated yet -> use pTotalCoeff */
- neighbourA = h264bsdNeighbour4x4BlockA(blockIndex);
- neighbourB = h264bsdNeighbour4x4BlockB(blockIndex);
- neighbourAindex = neighbourA->index;
- neighbourBindex = neighbourB->index;
- if (neighbourA->mb == MB_CURR && neighbourB->mb == MB_CURR)
- {
- n = (pTotalCoeff[neighbourAindex] +
- pTotalCoeff[neighbourBindex] + 1)>>1;
- }
- else if (neighbourA->mb == MB_CURR)
- {
- n = pTotalCoeff[neighbourAindex];
- if (h264bsdIsNeighbourAvailable(pMb, pMb->mbB))
- {
- n = (n + pMb->mbB->totalCoeff[neighbourBindex] + 1) >> 1;
- }
- }
- else if (neighbourB->mb == MB_CURR)
- {
- n = pTotalCoeff[neighbourBindex];
- if (h264bsdIsNeighbourAvailable(pMb, pMb->mbA))
- {
- n = (n + pMb->mbA->totalCoeff[neighbourAindex] + 1) >> 1;
- }
- }
- else
- {
- n = tmp = 0;
- if (h264bsdIsNeighbourAvailable(pMb, pMb->mbA))
- {
- n = pMb->mbA->totalCoeff[neighbourAindex];
- tmp = 1;
- }
- if (h264bsdIsNeighbourAvailable(pMb, pMb->mbB))
- {
- if (tmp)
- n = (n + pMb->mbB->totalCoeff[neighbourBindex] + 1) >> 1;
- else
- n = pMb->mbB->totalCoeff[neighbourBindex];
- }
- }
- return((u32)n);
-/*lint +e702 */
-}
-
-/*------------------------------------------------------------------------------
-
- Function: CbpIntra16x16
-
- Functional description:
- Returns the coded block pattern for intra 16x16 macroblock.
-
-------------------------------------------------------------------------------*/
-
-u32 CbpIntra16x16(mbType_e mbType)
-{
-
-/* Variables */
-
- u32 cbp;
- u32 tmp;
-
-/* Code */
-
- ASSERT(mbType >= I_16x16_0_0_0 && mbType <= I_16x16_3_2_1);
-
- if (mbType >= I_16x16_0_0_1)
- cbp = 15;
- else
- cbp = 0;
-
- /* tmp is 0 for I_16x16_0_0_0 mb type */
- /* ignore lint warning on arithmetic on enum's */
- tmp = /*lint -e(656)*/(mbType - I_16x16_0_0_0) >> 2;
- if (tmp > 2)
- tmp -= 3;
-
- cbp += tmp << 4;
-
- return(cbp);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdPredModeIntra16x16
-
- Functional description:
- Returns the prediction mode for intra 16x16 macroblock.
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdPredModeIntra16x16(mbType_e mbType)
-{
-
-/* Variables */
-
- u32 tmp;
-
-/* Code */
-
- ASSERT(mbType >= I_16x16_0_0_0 && mbType <= I_16x16_3_2_1);
-
- /* tmp is 0 for I_16x16_0_0_0 mb type */
- /* ignore lint warning on arithmetic on enum's */
- tmp = /*lint -e(656)*/(mbType - I_16x16_0_0_0);
-
- return(tmp & 0x3);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdDecodeMacroblock
-
- Functional description:
- Decode one macroblock and write into output image.
-
- Inputs:
- pMb pointer to macroblock specific information
- mbLayer pointer to current macroblock data from stream
- currImage pointer to output image
- dpb pointer to decoded picture buffer
- qpY pointer to slice QP
- mbNum current macroblock number
- constrainedIntraPred flag specifying if neighbouring inter
- macroblocks are used in intra prediction
-
- Outputs:
- pMb structure is updated with current macroblock
- currImage decoded macroblock is written into output image
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK error in macroblock decoding
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeMacroblock(mbStorage_t *pMb, macroblockLayer_t *pMbLayer,
- image_t *currImage, dpbStorage_t *dpb, i32 *qpY, u32 mbNum,
- u32 constrainedIntraPredFlag, u8* data)
-{
-
-/* Variables */
-
- u32 i, tmp;
- mbType_e mbType;
-#ifdef H264DEC_OMXDL
- const u8 *pSrc;
-#endif
-/* Code */
-
- ASSERT(pMb);
- ASSERT(pMbLayer);
- ASSERT(currImage);
- ASSERT(qpY && *qpY < 52);
- ASSERT(mbNum < currImage->width*currImage->height);
-
- mbType = pMbLayer->mbType;
- pMb->mbType = mbType;
-
- pMb->decoded++;
-
- h264bsdSetCurrImageMbPointers(currImage, mbNum);
-
- if (mbType == I_PCM)
- {
- u8 *pData = (u8*)data;
-#ifdef H264DEC_OMXDL
- u8 *tot = pMb->totalCoeff;
-#else
- i16 *tot = pMb->totalCoeff;
-#endif
- i32 *lev = pMbLayer->residual.level[0];
-
- pMb->qpY = 0;
-
- /* if decoded flag > 1 -> mb has already been successfully decoded and
- * written to output -> do not write again */
- if (pMb->decoded > 1)
- {
- for (i = 24; i--;)
- *tot++ = 16;
- return HANTRO_OK;
- }
-
- for (i = 24; i--;)
- {
- *tot++ = 16;
- for (tmp = 16; tmp--;)
- *pData++ = (u8)(*lev++);
- }
- h264bsdWriteMacroblock(currImage, (u8*)data);
-
- return(HANTRO_OK);
- }
- else
- {
-#ifdef H264DEC_OMXDL
- if (h264bsdMbPartPredMode(mbType) == PRED_MODE_INTER)
- {
- tmp = h264bsdInterPrediction(pMb, pMbLayer, dpb, mbNum,
- currImage, (u8*)data);
- if (tmp != HANTRO_OK) return (tmp);
- }
-#endif
- if (mbType != P_Skip)
- {
- H264SwDecMemcpy(pMb->totalCoeff,
- pMbLayer->residual.totalCoeff,
- 27*sizeof(*pMb->totalCoeff));
-
- /* update qpY */
- if (pMbLayer->mbQpDelta)
- {
- *qpY = *qpY + pMbLayer->mbQpDelta;
- if (*qpY < 0) *qpY += 52;
- else if (*qpY >= 52) *qpY -= 52;
- }
- pMb->qpY = (u32)*qpY;
-
-#ifdef H264DEC_OMXDL
- pSrc = pMbLayer->residual.posCoefBuf;
-
- if (h264bsdMbPartPredMode(mbType) == PRED_MODE_INTER)
- {
- OMXResult res;
- u8 *p;
- u8 *totalCoeff = pMb->totalCoeff;
-
- for (i = 0; i < 16; i++, totalCoeff++)
- {
- p = data + lumaIndex[i];
- if (*totalCoeff)
- {
- res = omxVCM4P10_DequantTransformResidualFromPairAndAdd(
- &pSrc, p, 0, p, 16, 16, *qpY, *totalCoeff);
- if (res != OMX_Sts_NoErr)
- return (HANTRO_NOK);
- }
- }
-
- }
- else if (h264bsdMbPartPredMode(mbType) == PRED_MODE_INTRA4x4)
- {
- tmp = ProcessIntra4x4Residual(pMb,
- data,
- constrainedIntraPredFlag,
- pMbLayer,
- &pSrc,
- currImage);
- if (tmp != HANTRO_OK)
- return (tmp);
- }
- else if (h264bsdMbPartPredMode(mbType) == PRED_MODE_INTRA16x16)
- {
- tmp = ProcessIntra16x16Residual(pMb,
- data,
- constrainedIntraPredFlag,
- pMbLayer->mbPred.intraChromaPredMode,
- &pSrc,
- currImage);
- if (tmp != HANTRO_OK)
- return (tmp);
- }
-
- tmp = ProcessChromaResidual(pMb, data, &pSrc);
-
-#else
- tmp = ProcessResidual(pMb, pMbLayer->residual.level,
- pMbLayer->residual.coeffMap);
-#endif
- if (tmp != HANTRO_OK)
- return (tmp);
- }
- else
- {
- H264SwDecMemset(pMb->totalCoeff, 0, 27*sizeof(*pMb->totalCoeff));
- pMb->qpY = (u32)*qpY;
- }
-#ifdef H264DEC_OMXDL
- /* if decoded flag > 1 -> mb has already been successfully decoded and
- * written to output -> do not write again */
- if (pMb->decoded > 1)
- return HANTRO_OK;
-
- h264bsdWriteMacroblock(currImage, data);
-#else
- if (h264bsdMbPartPredMode(mbType) != PRED_MODE_INTER)
- {
- tmp = h264bsdIntraPrediction(pMb, pMbLayer, currImage, mbNum,
- constrainedIntraPredFlag, (u8*)data);
- if (tmp != HANTRO_OK) return (tmp);
- }
- else
- {
- tmp = h264bsdInterPrediction(pMb, pMbLayer, dpb, mbNum,
- currImage, (u8*)data);
- if (tmp != HANTRO_OK) return (tmp);
- }
-#endif
- }
-
- return HANTRO_OK;
-}
-
-
-#ifdef H264DEC_OMXDL
-
-/*------------------------------------------------------------------------------
-
- Function: ProcessChromaResidual
-
- Functional description:
- Process the residual data of chroma with
- inverse quantization and inverse transform.
-
-------------------------------------------------------------------------------*/
-u32 ProcessChromaResidual(mbStorage_t *pMb, u8 *data, const u8 **pSrc )
-{
- u32 i;
- u32 chromaQp;
- i16 *pDc;
- i16 dc[4 + 4] = {0,0,0,0,0,0,0,0};
- u8 *totalCoeff;
- OMXResult result;
- u8 *p;
-
- /* chroma DC processing. First chroma dc block is block with index 25 */
- chromaQp =
- h264bsdQpC[CLIP3(0, 51, (i32)pMb->qpY + pMb->chromaQpIndexOffset)];
-
- if (pMb->totalCoeff[25])
- {
- pDc = dc;
- result = omxVCM4P10_TransformDequantChromaDCFromPair(
- pSrc,
- pDc,
- (i32)chromaQp);
- if (result != OMX_Sts_NoErr)
- return (HANTRO_NOK);
- }
- if (pMb->totalCoeff[26])
- {
- pDc = dc+4;
- result = omxVCM4P10_TransformDequantChromaDCFromPair(
- pSrc,
- pDc,
- (i32)chromaQp);
- if (result != OMX_Sts_NoErr)
- return (HANTRO_NOK);
- }
-
- pDc = dc;
- totalCoeff = pMb->totalCoeff + 16;
- for (i = 0; i < 8; i++, pDc++, totalCoeff++)
- {
- /* chroma prediction */
- if (*totalCoeff || *pDc)
- {
- p = data + chromaIndex[i];
- result = omxVCM4P10_DequantTransformResidualFromPairAndAdd(
- pSrc,
- p,
- pDc,
- p,
- 8,
- 8,
- (i32)chromaQp,
- *totalCoeff);
- if (result != OMX_Sts_NoErr)
- return (HANTRO_NOK);
- }
- }
-
- return(HANTRO_OK);
-}
-
-/*------------------------------------------------------------------------------
-
- Function: ProcessIntra16x16Residual
-
- Functional description:
- Process the residual data of luma with
- inverse quantization and inverse transform.
-
-------------------------------------------------------------------------------*/
-u32 ProcessIntra16x16Residual(mbStorage_t *pMb,
- u8 *data,
- u32 constrainedIntraPred,
- u32 intraChromaPredMode,
- const u8** pSrc,
- image_t *image)
-{
- u32 i;
- i16 *pDc;
- i16 dc[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
- u8 *totalCoeff;
- OMXResult result;
- u8 *p;
-
- totalCoeff = pMb->totalCoeff;
-
- if (totalCoeff[24])
- {
- pDc = dc;
- result = omxVCM4P10_TransformDequantLumaDCFromPair(
- pSrc,
- pDc,
- (i32)pMb->qpY);
- if (result != OMX_Sts_NoErr)
- return (HANTRO_NOK);
- }
- /* Intra 16x16 pred */
- if (h264bsdIntra16x16Prediction(pMb, data, image->luma,
- image->width*16, constrainedIntraPred) != HANTRO_OK)
- return(HANTRO_NOK);
- for (i = 0; i < 16; i++, totalCoeff++)
- {
- p = data + lumaIndex[i];
- pDc = &dc[dcCoeffIndex[i]];
- if (*totalCoeff || *pDc)
- {
- result = omxVCM4P10_DequantTransformResidualFromPairAndAdd(
- pSrc,
- p,
- pDc,
- p,
- 16,
- 16,
- (i32)pMb->qpY,
- *totalCoeff);
- if (result != OMX_Sts_NoErr)
- return (HANTRO_NOK);
- }
- }
-
- if (h264bsdIntraChromaPrediction(pMb, data + 256,
- image,
- intraChromaPredMode,
- constrainedIntraPred) != HANTRO_OK)
- return(HANTRO_NOK);
-
- return HANTRO_OK;
-}
-
-/*------------------------------------------------------------------------------
-
- Function: ProcessIntra4x4Residual
-
- Functional description:
- Process the residual data of luma with
- inverse quantization and inverse transform.
-
-------------------------------------------------------------------------------*/
-u32 ProcessIntra4x4Residual(mbStorage_t *pMb,
- u8 *data,
- u32 constrainedIntraPred,
- macroblockLayer_t *mbLayer,
- const u8 **pSrc,
- image_t *image)
-{
- u32 i;
- u8 *totalCoeff;
- OMXResult result;
- u8 *p;
-
- totalCoeff = pMb->totalCoeff;
-
- for (i = 0; i < 16; i++, totalCoeff++)
- {
- p = data + lumaIndex[i];
- if (h264bsdIntra4x4Prediction(pMb, p, mbLayer, image->luma,
- image->width*16, constrainedIntraPred, i) != HANTRO_OK)
- return(HANTRO_NOK);
-
- if (*totalCoeff)
- {
- result = omxVCM4P10_DequantTransformResidualFromPairAndAdd(
- pSrc,
- p,
- NULL,
- p,
- 16,
- 16,
- (i32)pMb->qpY,
- *totalCoeff);
- if (result != OMX_Sts_NoErr)
- return (HANTRO_NOK);
- }
- }
-
- if (h264bsdIntraChromaPrediction(pMb, data + 256,
- image,
- mbLayer->mbPred.intraChromaPredMode,
- constrainedIntraPred) != HANTRO_OK)
- return(HANTRO_NOK);
-
- return HANTRO_OK;
-}
-
-#else /* H264DEC_OMXDL */
-
-/*------------------------------------------------------------------------------
-
- Function: ProcessResidual
-
- Functional description:
- Process the residual data of one macroblock with
- inverse quantization and inverse transform.
-
-------------------------------------------------------------------------------*/
-
-u32 ProcessResidual(mbStorage_t *pMb, i32 residualLevel[][16], u32 *coeffMap)
-{
-
-/* Variables */
-
- u32 i;
- u32 chromaQp;
- i32 (*blockData)[16];
- i32 (*blockDc)[16];
- i16 *totalCoeff;
- i32 *chromaDc;
- const u32 *dcCoeffIdx;
-
-/* Code */
-
- ASSERT(pMb);
- ASSERT(residualLevel);
-
- /* set pointers to DC coefficient blocks */
- blockDc = residualLevel + 24;
-
- blockData = residualLevel;
- totalCoeff = pMb->totalCoeff;
- if (h264bsdMbPartPredMode(pMb->mbType) == PRED_MODE_INTRA16x16)
- {
- if (totalCoeff[24])
- {
- h264bsdProcessLumaDc(*blockDc, pMb->qpY);
- }
- dcCoeffIdx = dcCoeffIndex;
-
- for (i = 16; i--; blockData++, totalCoeff++, coeffMap++)
- {
- /* set dc coefficient of luma block */
- (*blockData)[0] = (*blockDc)[*dcCoeffIdx++];
- if ((*blockData)[0] || *totalCoeff)
- {
- if (h264bsdProcessBlock(*blockData, pMb->qpY, 1, *coeffMap) !=
- HANTRO_OK)
- return(HANTRO_NOK);
- }
- else
- MARK_RESIDUAL_EMPTY(*blockData);
- }
- }
- else
- {
- for (i = 16; i--; blockData++, totalCoeff++, coeffMap++)
- {
- if (*totalCoeff)
- {
- if (h264bsdProcessBlock(*blockData, pMb->qpY, 0, *coeffMap) !=
- HANTRO_OK)
- return(HANTRO_NOK);
- }
- else
- MARK_RESIDUAL_EMPTY(*blockData);
- }
- }
-
- /* chroma DC processing. First chroma dc block is block with index 25 */
- chromaQp =
- h264bsdQpC[CLIP3(0, 51, (i32)pMb->qpY + pMb->chromaQpIndexOffset)];
- if (pMb->totalCoeff[25] || pMb->totalCoeff[26])
- h264bsdProcessChromaDc(residualLevel[25], chromaQp);
- chromaDc = residualLevel[25];
- for (i = 8; i--; blockData++, totalCoeff++, coeffMap++)
- {
- /* set dc coefficient of chroma block */
- (*blockData)[0] = *chromaDc++;
- if ((*blockData)[0] || *totalCoeff)
- {
- if (h264bsdProcessBlock(*blockData, chromaQp, 1,*coeffMap) !=
- HANTRO_OK)
- return(HANTRO_NOK);
- }
- else
- MARK_RESIDUAL_EMPTY(*blockData);
- }
-
- return(HANTRO_OK);
-}
-#endif /* H264DEC_OMXDL */
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdSubMbPartMode
-
- Functional description:
- Returns the macroblock's sub-partition mode.
-
-------------------------------------------------------------------------------*/
-
-subMbPartMode_e h264bsdSubMbPartMode(subMbType_e subMbType)
-{
-
-/* Variables */
-
-
-/* Code */
-
- ASSERT(subMbType < 4);
-
- return((subMbPartMode_e)subMbType);
-
-}
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_macroblock_layer.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_macroblock_layer.h
deleted file mode 100644
index 32bc340..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_macroblock_layer.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_MACROBLOCK_LAYER_H
-#define H264SWDEC_MACROBLOCK_LAYER_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_stream.h"
-#include "h264bsd_image.h"
-#include "h264bsd_dpb.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-/* Macro to determine if a mb is an intra mb */
-#define IS_INTRA_MB(a) ((a).mbType > 5)
-
-/* Macro to determine if a mb is an I_PCM mb */
-#define IS_I_PCM_MB(a) ((a).mbType == 31)
-
-typedef enum {
- P_Skip = 0,
- P_L0_16x16 = 1,
- P_L0_L0_16x8 = 2,
- P_L0_L0_8x16 = 3,
- P_8x8 = 4,
- P_8x8ref0 = 5,
- I_4x4 = 6,
- I_16x16_0_0_0 = 7,
- I_16x16_1_0_0 = 8,
- I_16x16_2_0_0 = 9,
- I_16x16_3_0_0 = 10,
- I_16x16_0_1_0 = 11,
- I_16x16_1_1_0 = 12,
- I_16x16_2_1_0 = 13,
- I_16x16_3_1_0 = 14,
- I_16x16_0_2_0 = 15,
- I_16x16_1_2_0 = 16,
- I_16x16_2_2_0 = 17,
- I_16x16_3_2_0 = 18,
- I_16x16_0_0_1 = 19,
- I_16x16_1_0_1 = 20,
- I_16x16_2_0_1 = 21,
- I_16x16_3_0_1 = 22,
- I_16x16_0_1_1 = 23,
- I_16x16_1_1_1 = 24,
- I_16x16_2_1_1 = 25,
- I_16x16_3_1_1 = 26,
- I_16x16_0_2_1 = 27,
- I_16x16_1_2_1 = 28,
- I_16x16_2_2_1 = 29,
- I_16x16_3_2_1 = 30,
- I_PCM = 31
-} mbType_e;
-
-typedef enum {
- P_L0_8x8 = 0,
- P_L0_8x4 = 1,
- P_L0_4x8 = 2,
- P_L0_4x4 = 3
-} subMbType_e;
-
-typedef enum {
- MB_P_16x16 = 0,
- MB_P_16x8,
- MB_P_8x16,
- MB_P_8x8
-} mbPartMode_e;
-
-typedef enum {
- MB_SP_8x8 = 0,
- MB_SP_8x4,
- MB_SP_4x8,
- MB_SP_4x4
-} subMbPartMode_e;
-
-typedef enum {
- PRED_MODE_INTRA4x4 = 0,
- PRED_MODE_INTRA16x16 ,
- PRED_MODE_INTER
-} mbPartPredMode_e;
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-typedef struct
-{
- /* MvPrediction16x16 assumes that MVs are 16bits */
- i16 hor;
- i16 ver;
-} mv_t;
-
-typedef struct
-{
- u32 prevIntra4x4PredModeFlag[16];
- u32 remIntra4x4PredMode[16];
- u32 intraChromaPredMode;
- u32 refIdxL0[4];
- mv_t mvdL0[4];
-} mbPred_t;
-
-typedef struct
-{
- subMbType_e subMbType[4];
- u32 refIdxL0[4];
- mv_t mvdL0[4][4];
-} subMbPred_t;
-
-typedef struct
-{
-#ifdef H264DEC_OMXDL
- u8 posCoefBuf[27*16*3];
- u8 totalCoeff[27];
-#else
- i16 totalCoeff[27];
-#endif
- i32 level[26][16];
- u32 coeffMap[24];
-} residual_t;
-
-typedef struct
-{
- mbType_e mbType;
- u32 codedBlockPattern;
- i32 mbQpDelta;
- mbPred_t mbPred;
- subMbPred_t subMbPred;
- residual_t residual;
-} macroblockLayer_t;
-
-typedef struct mbStorage
-{
- mbType_e mbType;
- u32 sliceId;
- u32 disableDeblockingFilterIdc;
- i32 filterOffsetA;
- i32 filterOffsetB;
- u32 qpY;
- i32 chromaQpIndexOffset;
-#ifdef H264DEC_OMXDL
- u8 totalCoeff[27];
-#else
- i16 totalCoeff[27];
-#endif
- u8 intra4x4PredMode[16];
- u32 refPic[4];
- u8* refAddr[4];
- mv_t mv[16];
- u32 decoded;
- struct mbStorage *mbA;
- struct mbStorage *mbB;
- struct mbStorage *mbC;
- struct mbStorage *mbD;
-} mbStorage_t;
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeMacroblockLayer(strmData_t *pStrmData,
- macroblockLayer_t *pMbLayer, mbStorage_t *pMb, u32 sliceType,
- u32 numRefIdxActive);
-
-u32 h264bsdNumMbPart(mbType_e mbType);
-u32 h264bsdNumSubMbPart(subMbType_e subMbType);
-
-subMbPartMode_e h264bsdSubMbPartMode(subMbType_e subMbType);
-
-u32 h264bsdDecodeMacroblock(mbStorage_t *pMb, macroblockLayer_t *pMbLayer,
- image_t *currImage, dpbStorage_t *dpb, i32 *qpY, u32 mbNum,
- u32 constrainedIntraPredFlag, u8* data);
-
-u32 h264bsdPredModeIntra16x16(mbType_e mbType);
-
-mbPartPredMode_e h264bsdMbPartPredMode(mbType_e mbType);
-#ifdef H264DEC_NEON
-u32 h264bsdClearMbLayer(macroblockLayer_t *pMbLayer, u32 size);
-#endif
-
-#endif /* #ifdef H264SWDEC_MACROBLOCK_LAYER_H */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_nal_unit.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_nal_unit.c
deleted file mode 100644
index e44c43a..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_nal_unit.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdDecodeNalUnit
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_nal_unit.h"
-#include "h264bsd_util.h"
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
-
- Function name: h264bsdDecodeNalUnit
-
- Functional description:
- Decode NAL unit header information
-
- Inputs:
- pStrmData pointer to stream data structure
-
- Outputs:
- pNalUnit NAL unit header information is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK invalid NAL unit header information
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeNalUnit(strmData_t *pStrmData, nalUnit_t *pNalUnit)
-{
-
-/* Variables */
-
- u32 tmp;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pNalUnit);
- ASSERT(pStrmData->bitPosInWord == 0);
-
- /* forbidden_zero_bit (not checked to be zero, errors ignored) */
- tmp = h264bsdGetBits(pStrmData, 1);
- /* Assuming that NAL unit starts from byte boundary > don't have to check
- * following 7 bits for END_OF_STREAM */
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
-
- tmp = h264bsdGetBits(pStrmData, 2);
- pNalUnit->nalRefIdc = tmp;
-
- tmp = h264bsdGetBits(pStrmData, 5);
- pNalUnit->nalUnitType = (nalUnitType_e)tmp;
-
- /* data partitioning NAL units not supported */
- if ( (tmp == 2) || (tmp == 3) || (tmp == 4) )
- {
- return(HANTRO_NOK);
- }
-
- /* nal_ref_idc shall not be zero for these nal_unit_types */
- if ( ( (tmp == NAL_SEQ_PARAM_SET) || (tmp == NAL_PIC_PARAM_SET) ||
- (tmp == NAL_CODED_SLICE_IDR) ) && (pNalUnit->nalRefIdc == 0) )
- {
- return(HANTRO_NOK);
- }
- /* nal_ref_idc shall be zero for these nal_unit_types */
- else if ( ( (tmp == NAL_SEI) || (tmp == NAL_ACCESS_UNIT_DELIMITER) ||
- (tmp == NAL_END_OF_SEQUENCE) || (tmp == NAL_END_OF_STREAM) ||
- (tmp == NAL_FILLER_DATA) ) && (pNalUnit->nalRefIdc != 0) )
- {
- return(HANTRO_NOK);
- }
-
- return(HANTRO_OK);
-
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_nal_unit.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_nal_unit.h
deleted file mode 100644
index 38957bf..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_nal_unit.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_NAL_UNIT_H
-#define H264SWDEC_NAL_UNIT_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_stream.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-/* macro to determine if NAL unit pointed by pNalUnit contains an IDR slice */
-#define IS_IDR_NAL_UNIT(pNalUnit) \
- ((pNalUnit)->nalUnitType == NAL_CODED_SLICE_IDR)
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-typedef enum {
- NAL_CODED_SLICE = 1,
- NAL_CODED_SLICE_IDR = 5,
- NAL_SEI = 6,
- NAL_SEQ_PARAM_SET = 7,
- NAL_PIC_PARAM_SET = 8,
- NAL_ACCESS_UNIT_DELIMITER = 9,
- NAL_END_OF_SEQUENCE = 10,
- NAL_END_OF_STREAM = 11,
- NAL_FILLER_DATA = 12,
- NAL_MAX_TYPE_VALUE = 31
-} nalUnitType_e;
-
-typedef struct
-{
- nalUnitType_e nalUnitType;
- u32 nalRefIdc;
-} nalUnit_t;
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeNalUnit(strmData_t *pStrmData, nalUnit_t *pNalUnit);
-
-#endif /* #ifdef H264SWDEC_NAL_UNIT_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_neighbour.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_neighbour.c
deleted file mode 100644
index ce5eeff..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_neighbour.c
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdInitMbNeighbours
- h264bsdGetNeighbourMb
- h264bsdNeighbour4x4BlockA
- h264bsdNeighbour4x4BlockB
- h264bsdNeighbour4x4BlockC
- h264bsdNeighbour4x4BlockD
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_neighbour.h"
-#include "h264bsd_util.h"
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-/* Following four tables indicate neighbours of each block of a macroblock.
- * First 16 values are for luma blocks, next 4 values for Cb and last 4
- * values for Cr. Elements of the table indicate to which macroblock the
- * neighbour block belongs and the index of the neighbour block in question.
- * Indexing of the blocks goes as follows
- *
- * Y Cb Cr
- * 0 1 4 5 16 17 20 21
- * 2 3 6 7 18 19 22 23
- * 8 9 12 13
- * 10 11 14 15
- */
-
-/* left neighbour for each block */
-static const neighbour_t N_A_4x4B[24] = {
- {MB_A,5}, {MB_CURR,0}, {MB_A,7}, {MB_CURR,2},
- {MB_CURR,1}, {MB_CURR,4}, {MB_CURR,3}, {MB_CURR,6},
- {MB_A,13}, {MB_CURR,8}, {MB_A,15}, {MB_CURR,10},
- {MB_CURR,9}, {MB_CURR,12},{MB_CURR,11},{MB_CURR,14},
- {MB_A,17}, {MB_CURR,16},{MB_A,19}, {MB_CURR,18},
- {MB_A,21}, {MB_CURR,20},{MB_A,23}, {MB_CURR,22} };
-
-/* above neighbour for each block */
-static const neighbour_t N_B_4x4B[24] = {
- {MB_B,10}, {MB_B,11}, {MB_CURR,0}, {MB_CURR,1},
- {MB_B,14}, {MB_B,15}, {MB_CURR,4}, {MB_CURR,5},
- {MB_CURR,2}, {MB_CURR,3}, {MB_CURR,8}, {MB_CURR,9},
- {MB_CURR,6}, {MB_CURR,7}, {MB_CURR,12},{MB_CURR,13},
- {MB_B,18}, {MB_B,19}, {MB_CURR,16},{MB_CURR,17},
- {MB_B,22}, {MB_B,23}, {MB_CURR,20},{MB_CURR,21} };
-
-/* above-right neighbour for each block */
-static const neighbour_t N_C_4x4B[24] = {
- {MB_B,11}, {MB_B,14}, {MB_CURR,1}, {MB_NA,4},
- {MB_B,15}, {MB_C,10}, {MB_CURR,5}, {MB_NA,0},
- {MB_CURR,3}, {MB_CURR,6}, {MB_CURR,9}, {MB_NA,12},
- {MB_CURR,7}, {MB_NA,2}, {MB_CURR,13},{MB_NA,8},
- {MB_B,19}, {MB_C,18}, {MB_CURR,17},{MB_NA,16},
- {MB_B,23}, {MB_C,22}, {MB_CURR,21},{MB_NA,20} };
-
-/* above-left neighbour for each block */
-static const neighbour_t N_D_4x4B[24] = {
- {MB_D,15}, {MB_B,10}, {MB_A,5}, {MB_CURR,0},
- {MB_B,11}, {MB_B,14}, {MB_CURR,1}, {MB_CURR,4},
- {MB_A,7}, {MB_CURR,2}, {MB_A,13}, {MB_CURR,8},
- {MB_CURR,3}, {MB_CURR,6}, {MB_CURR,9}, {MB_CURR,12},
- {MB_D,19}, {MB_B,18}, {MB_A,17}, {MB_CURR,16},
- {MB_D,23}, {MB_B,22}, {MB_A,21}, {MB_CURR,20} };
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdInitMbNeighbours
-
- Functional description:
- Initialize macroblock neighbours. Function sets neighbour
- macroblock pointers in macroblock structures to point to
- macroblocks on the left, above, above-right and above-left.
- Pointers are set NULL if the neighbour does not fit into the
- picture.
-
- Inputs:
- picWidth width of the picture in macroblocks
- picSizeInMbs no need to clarify
-
- Outputs:
- pMbStorage neighbour pointers of each mbStorage structure
- stored here
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-
-void h264bsdInitMbNeighbours(mbStorage_t *pMbStorage, u32 picWidth,
- u32 picSizeInMbs)
-{
-
-/* Variables */
-
- u32 i, row, col;
-
-/* Code */
-
- ASSERT(pMbStorage);
- ASSERT(picWidth);
- ASSERT(picWidth <= picSizeInMbs);
- ASSERT(((picSizeInMbs / picWidth) * picWidth) == picSizeInMbs);
-
- row = col = 0;
-
- for (i = 0; i < picSizeInMbs; i++)
- {
-
- if (col)
- pMbStorage[i].mbA = pMbStorage + i - 1;
- else
- pMbStorage[i].mbA = NULL;
-
- if (row)
- pMbStorage[i].mbB = pMbStorage + i - picWidth;
- else
- pMbStorage[i].mbB = NULL;
-
- if (row && (col < picWidth - 1))
- pMbStorage[i].mbC = pMbStorage + i - (picWidth - 1);
- else
- pMbStorage[i].mbC = NULL;
-
- if (row && col)
- pMbStorage[i].mbD = pMbStorage + i - (picWidth + 1);
- else
- pMbStorage[i].mbD = NULL;
-
- col++;
- if (col == picWidth)
- {
- col = 0;
- row++;
- }
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdGetNeighbourMb
-
- Functional description:
- Get pointer to neighbour macroblock.
-
- Inputs:
- pMb pointer to macroblock structure of the macroblock
- whose neighbour is wanted
- neighbour indicates which neighbour is wanted
-
- Outputs:
- none
-
- Returns:
- pointer to neighbour macroblock
- NULL if not available
-
-------------------------------------------------------------------------------*/
-
-mbStorage_t* h264bsdGetNeighbourMb(mbStorage_t *pMb, neighbourMb_e neighbour)
-{
-
-/* Variables */
-
-
-/* Code */
-
- ASSERT((neighbour <= MB_CURR) || (neighbour == MB_NA));
-
- if (neighbour == MB_A)
- return(pMb->mbA);
- else if (neighbour == MB_B)
- return(pMb->mbB);
- else if (neighbour == MB_C)
- return(pMb->mbC);
- else if (neighbour == MB_D)
- return(pMb->mbD);
- else if (neighbour == MB_CURR)
- return(pMb);
- else
- return(NULL);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdNeighbour4x4BlockA
-
- Functional description:
- Get left neighbour of the block. Function returns pointer to
- the table defined in the beginning of the file.
-
- Inputs:
- blockIndex indicates the block whose neighbours are wanted
-
- Outputs:
-
- Returns:
- pointer to neighbour structure
-
-------------------------------------------------------------------------------*/
-
-const neighbour_t* h264bsdNeighbour4x4BlockA(u32 blockIndex)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(blockIndex < 24);
-
- return(N_A_4x4B+blockIndex);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdNeighbour4x4BlockB
-
- Functional description:
- Get above neighbour of the block. Function returns pointer to
- the table defined in the beginning of the file.
-
- Inputs:
- blockIndex indicates the block whose neighbours are wanted
-
- Outputs:
-
- Returns:
- pointer to neighbour structure
-
-------------------------------------------------------------------------------*/
-
-const neighbour_t* h264bsdNeighbour4x4BlockB(u32 blockIndex)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(blockIndex < 24);
-
- return(N_B_4x4B+blockIndex);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdNeighbour4x4BlockC
-
- Functional description:
- Get above-right neighbour of the block. Function returns pointer
- to the table defined in the beginning of the file.
-
- Inputs:
- blockIndex indicates the block whose neighbours are wanted
-
- Outputs:
-
- Returns:
- pointer to neighbour structure
-
-------------------------------------------------------------------------------*/
-
-const neighbour_t* h264bsdNeighbour4x4BlockC(u32 blockIndex)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(blockIndex < 24);
-
- return(N_C_4x4B+blockIndex);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdNeighbour4x4BlockD
-
- Functional description:
- Get above-left neighbour of the block. Function returns pointer to
- the table defined in the beginning of the file.
-
- Inputs:
- blockIndex indicates the block whose neighbours are wanted
-
- Outputs:
-
- Returns:
- pointer to neighbour structure
-
-------------------------------------------------------------------------------*/
-
-const neighbour_t* h264bsdNeighbour4x4BlockD(u32 blockIndex)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(blockIndex < 24);
-
- return(N_D_4x4B+blockIndex);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdIsNeighbourAvailable
-
- Functional description:
- Check if neighbour macroblock is available. Neighbour macroblock
- is considered available if it is within the picture and belongs
- to the same slice as the current macroblock.
-
- Inputs:
- pMb pointer to the current macroblock
- pNeighbour pointer to the neighbour macroblock
-
- Outputs:
- none
-
- Returns:
- TRUE neighbour is available
- FALSE neighbour is not available
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdIsNeighbourAvailable(mbStorage_t *pMb, mbStorage_t *pNeighbour)
-{
-
-/* Variables */
-
-/* Code */
-
- if ( (pNeighbour == NULL) || (pMb->sliceId != pNeighbour->sliceId) )
- return(HANTRO_FALSE);
- else
- return(HANTRO_TRUE);
-
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_neighbour.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_neighbour.h
deleted file mode 100644
index fce0ad1..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_neighbour.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_NEIGHBOUR_H
-#define H264SWDEC_NEIGHBOUR_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_macroblock_layer.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-typedef enum {
- MB_A = 0,
- MB_B,
- MB_C,
- MB_D,
- MB_CURR,
- MB_NA = 0xFF
-} neighbourMb_e;
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-typedef struct
-{
- neighbourMb_e mb;
- u8 index;
-} neighbour_t;
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-void h264bsdInitMbNeighbours(mbStorage_t *pMbStorage, u32 picWidth,
- u32 picSizeInMbs);
-
-mbStorage_t* h264bsdGetNeighbourMb(mbStorage_t *pMb, neighbourMb_e neighbour);
-
-u32 h264bsdIsNeighbourAvailable(mbStorage_t *pMb, mbStorage_t *pNeighbour);
-
-const neighbour_t* h264bsdNeighbour4x4BlockA(u32 blockIndex);
-const neighbour_t* h264bsdNeighbour4x4BlockB(u32 blockIndex);
-const neighbour_t* h264bsdNeighbour4x4BlockC(u32 blockIndex);
-const neighbour_t* h264bsdNeighbour4x4BlockD(u32 blockIndex);
-
-#endif /* #ifdef H264SWDEC_NEIGHBOUR_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_pic_order_cnt.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_pic_order_cnt.c
deleted file mode 100644
index fb23352..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_pic_order_cnt.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdDecodePicOrderCnt
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_util.h"
-#include "h264bsd_pic_order_cnt.h"
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdDecodePicOrderCnt
-
- Functional description:
- Compute picture order count for a picture. Function implements
- computation of all POC types (0, 1 and 2), type is obtained from
- sps. See standard for description of the POC types and how POC is
- computed for each type.
-
- Function returns the minimum of top field and bottom field pic
- order counts.
-
- Inputs:
- poc pointer to previous results
- sps pointer to sequence parameter set
- slicHeader pointer to current slice header, frame number and
- other params needed for POC computation
- pNalUnit pointer to current NAL unit structrue, function needs
- to know if this is an IDR picture and also if this is
- a reference picture
-
- Outputs:
- poc results stored here for computation of next POC
-
- Returns:
- picture order count
-
-------------------------------------------------------------------------------*/
-
-i32 h264bsdDecodePicOrderCnt(pocStorage_t *poc, seqParamSet_t *sps,
- sliceHeader_t *pSliceHeader, nalUnit_t *pNalUnit)
-{
-
-/* Variables */
-
- u32 i;
- i32 picOrderCnt;
- u32 frameNumOffset, absFrameNum, picOrderCntCycleCnt;
- u32 frameNumInPicOrderCntCycle;
- i32 expectedDeltaPicOrderCntCycle;
- u32 containsMmco5;
-
-/* Code */
-
- ASSERT(poc);
- ASSERT(sps);
- ASSERT(pSliceHeader);
- ASSERT(pNalUnit);
- ASSERT(sps->picOrderCntType <= 2);
-
-#if 0
- /* JanSa: I don't think this is necessary, don't see any reason to
- * increment prevFrameNum one by one instead of one big increment.
- * However, standard specifies that this should be done -> if someone
- * figures out any case when the outcome would be different for step by
- * step increment, this part of the code should be enabled */
-
- /* if there was a gap in frame numbering and picOrderCntType is 1 or 2 ->
- * "compute" pic order counts for non-existing frames. These are not
- * actually computed, but process needs to be done to update the
- * prevFrameNum and prevFrameNumOffset */
- if ( sps->picOrderCntType > 0 &&
- pSliceHeader->frameNum != poc->prevFrameNum &&
- pSliceHeader->frameNum != ((poc->prevFrameNum + 1) % sps->maxFrameNum))
- {
-
- /* use variable i for unUsedShortTermFrameNum */
- i = (poc->prevFrameNum + 1) % sps->maxFrameNum;
-
- do
- {
- if (poc->prevFrameNum > i)
- frameNumOffset = poc->prevFrameNumOffset + sps->maxFrameNum;
- else
- frameNumOffset = poc->prevFrameNumOffset;
-
- poc->prevFrameNumOffset = frameNumOffset;
- poc->prevFrameNum = i;
-
- i = (i + 1) % sps->maxFrameNum;
-
- } while (i != pSliceHeader->frameNum);
- }
-#endif
-
- /* check if current slice includes mmco equal to 5 */
- containsMmco5 = HANTRO_FALSE;
- if (pSliceHeader->decRefPicMarking.adaptiveRefPicMarkingModeFlag)
- {
- i = 0;
- while (pSliceHeader->decRefPicMarking.operation[i].
- memoryManagementControlOperation)
- {
- if (pSliceHeader->decRefPicMarking.operation[i].
- memoryManagementControlOperation == 5)
- {
- containsMmco5 = HANTRO_TRUE;
- break;
- }
- i++;
- }
- }
- switch (sps->picOrderCntType)
- {
-
- case 0:
- /* set prevPicOrderCnt values for IDR frame */
- if (IS_IDR_NAL_UNIT(pNalUnit))
- {
- poc->prevPicOrderCntMsb = 0;
- poc->prevPicOrderCntLsb = 0;
- }
-
- /* compute picOrderCntMsb (stored in picOrderCnt variable) */
- if ( (pSliceHeader->picOrderCntLsb < poc->prevPicOrderCntLsb) &&
- ((poc->prevPicOrderCntLsb - pSliceHeader->picOrderCntLsb) >=
- sps->maxPicOrderCntLsb/2) )
- {
- picOrderCnt = poc->prevPicOrderCntMsb +
- (i32)sps->maxPicOrderCntLsb;
- }
- else if ((pSliceHeader->picOrderCntLsb > poc->prevPicOrderCntLsb) &&
- ((pSliceHeader->picOrderCntLsb - poc->prevPicOrderCntLsb) >
- sps->maxPicOrderCntLsb/2) )
- {
- picOrderCnt = poc->prevPicOrderCntMsb -
- (i32)sps->maxPicOrderCntLsb;
- }
- else
- picOrderCnt = poc->prevPicOrderCntMsb;
-
- /* standard specifies that prevPicOrderCntMsb is from previous
- * rererence frame -> replace old value only if current frame is
- * rererence frame */
- if (pNalUnit->nalRefIdc)
- poc->prevPicOrderCntMsb = picOrderCnt;
-
- /* compute top field order cnt (stored in picOrderCnt) */
- picOrderCnt += (i32)pSliceHeader->picOrderCntLsb;
-
- /* if delta for bottom field is negative -> bottom will be the
- * minimum pic order count */
- if (pSliceHeader->deltaPicOrderCntBottom < 0)
- picOrderCnt += pSliceHeader->deltaPicOrderCntBottom;
-
- /* standard specifies that prevPicOrderCntLsb is from previous
- * rererence frame -> replace old value only if current frame is
- * rererence frame */
- if (pNalUnit->nalRefIdc)
- {
- /* if current frame contains mmco5 -> modify values to be
- * stored */
- if (containsMmco5)
- {
- poc->prevPicOrderCntMsb = 0;
- /* prevPicOrderCntLsb should be the top field picOrderCnt
- * if previous frame included mmco5. Top field picOrderCnt
- * for frames containing mmco5 is obtained by subtracting
- * the picOrderCnt from original top field order count ->
- * value is zero if top field was the minimum, i.e. delta
- * for bottom was positive, otherwise value is
- * -deltaPicOrderCntBottom */
- if (pSliceHeader->deltaPicOrderCntBottom < 0)
- poc->prevPicOrderCntLsb =
- (u32)(-pSliceHeader->deltaPicOrderCntBottom);
- else
- poc->prevPicOrderCntLsb = 0;
- picOrderCnt = 0;
- }
- else
- {
- poc->prevPicOrderCntLsb = pSliceHeader->picOrderCntLsb;
- }
- }
-
- break;
-
- case 1:
-
- /* step 1 (in the description in the standard) */
- if (IS_IDR_NAL_UNIT(pNalUnit))
- frameNumOffset = 0;
- else if (poc->prevFrameNum > pSliceHeader->frameNum)
- frameNumOffset = poc->prevFrameNumOffset + sps->maxFrameNum;
- else
- frameNumOffset = poc->prevFrameNumOffset;
-
- /* step 2 */
- if (sps->numRefFramesInPicOrderCntCycle)
- absFrameNum = frameNumOffset + pSliceHeader->frameNum;
- else
- absFrameNum = 0;
-
- if (pNalUnit->nalRefIdc == 0 && absFrameNum > 0)
- absFrameNum -= 1;
-
- /* step 3 */
- if (absFrameNum > 0)
- {
- picOrderCntCycleCnt =
- (absFrameNum - 1)/sps->numRefFramesInPicOrderCntCycle;
- frameNumInPicOrderCntCycle =
- (absFrameNum - 1)%sps->numRefFramesInPicOrderCntCycle;
- }
-
- /* step 4 */
- expectedDeltaPicOrderCntCycle = 0;
- for (i = 0; i < sps->numRefFramesInPicOrderCntCycle; i++)
- expectedDeltaPicOrderCntCycle += sps->offsetForRefFrame[i];
-
- /* step 5 (picOrderCnt used to store expectedPicOrderCnt) */
- /*lint -esym(644,picOrderCntCycleCnt) always initialized */
- /*lint -esym(644,frameNumInPicOrderCntCycle) always initialized */
- if (absFrameNum > 0)
- {
- picOrderCnt =
- (i32)picOrderCntCycleCnt * expectedDeltaPicOrderCntCycle;
- for (i = 0; i <= frameNumInPicOrderCntCycle; i++)
- picOrderCnt += sps->offsetForRefFrame[i];
- }
- else
- picOrderCnt = 0;
-
- if (pNalUnit->nalRefIdc == 0)
- picOrderCnt += sps->offsetForNonRefPic;
-
- /* step 6 (picOrderCnt is top field order cnt if delta for bottom
- * is positive, otherwise it is bottom field order cnt) */
- picOrderCnt += pSliceHeader->deltaPicOrderCnt[0];
-
- if ( (sps->offsetForTopToBottomField +
- pSliceHeader->deltaPicOrderCnt[1]) < 0 )
- {
- picOrderCnt += sps->offsetForTopToBottomField +
- pSliceHeader->deltaPicOrderCnt[1];
- }
-
- /* if current picture contains mmco5 -> set prevFrameNumOffset and
- * prevFrameNum to 0 for computation of picOrderCnt of next
- * frame, otherwise store frameNum and frameNumOffset to poc
- * structure */
- if (!containsMmco5)
- {
- poc->prevFrameNumOffset = frameNumOffset;
- poc->prevFrameNum = pSliceHeader->frameNum;
- }
- else
- {
- poc->prevFrameNumOffset = 0;
- poc->prevFrameNum = 0;
- picOrderCnt = 0;
- }
- break;
-
- default: /* case 2 */
- /* derive frameNumOffset */
- if (IS_IDR_NAL_UNIT(pNalUnit))
- frameNumOffset = 0;
- else if (poc->prevFrameNum > pSliceHeader->frameNum)
- frameNumOffset = poc->prevFrameNumOffset + sps->maxFrameNum;
- else
- frameNumOffset = poc->prevFrameNumOffset;
-
- /* derive picOrderCnt (type 2 has same value for top and bottom
- * field order cnts) */
- if (IS_IDR_NAL_UNIT(pNalUnit))
- picOrderCnt = 0;
- else if (pNalUnit->nalRefIdc == 0)
- picOrderCnt =
- 2 * (i32)(frameNumOffset + pSliceHeader->frameNum) - 1;
- else
- picOrderCnt =
- 2 * (i32)(frameNumOffset + pSliceHeader->frameNum);
-
- /* if current picture contains mmco5 -> set prevFrameNumOffset and
- * prevFrameNum to 0 for computation of picOrderCnt of next
- * frame, otherwise store frameNum and frameNumOffset to poc
- * structure */
- if (!containsMmco5)
- {
- poc->prevFrameNumOffset = frameNumOffset;
- poc->prevFrameNum = pSliceHeader->frameNum;
- }
- else
- {
- poc->prevFrameNumOffset = 0;
- poc->prevFrameNum = 0;
- picOrderCnt = 0;
- }
- break;
-
- }
-
- /*lint -esym(644,picOrderCnt) always initialized */
- return(picOrderCnt);
-
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_pic_order_cnt.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_pic_order_cnt.h
deleted file mode 100644
index 19741eb..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_pic_order_cnt.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_PIC_ORDER_CNT_H
-#define H264SWDEC_PIC_ORDER_CNT_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_seq_param_set.h"
-#include "h264bsd_slice_header.h"
-#include "h264bsd_nal_unit.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-/* structure to store information computed for previous picture, needed for
- * POC computation of a picture. Two first fields for POC type 0, last two
- * for types 1 and 2 */
-typedef struct
-{
- u32 prevPicOrderCntLsb;
- i32 prevPicOrderCntMsb;
- u32 prevFrameNum;
- u32 prevFrameNumOffset;
-} pocStorage_t;
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-i32 h264bsdDecodePicOrderCnt(pocStorage_t *poc, seqParamSet_t *sps,
- sliceHeader_t *sliceHeader, nalUnit_t *pNalUnit);
-
-#endif /* #ifdef H264SWDEC_PIC_ORDER_CNT_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_pic_param_set.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_pic_param_set.c
deleted file mode 100644
index e04dea4..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_pic_param_set.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdDecodePicParamSet
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_pic_param_set.h"
-#include "h264bsd_util.h"
-#include "h264bsd_vlc.h"
-#include "h264bsd_cfg.h"
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-/* lookup table for ceil(log2(numSliceGroups)), i.e. number of bits needed to
- * represent range [0, numSliceGroups)
- *
- * NOTE: if MAX_NUM_SLICE_GROUPS is higher than 8 this table has to be resized
- * accordingly */
-static const u32 CeilLog2NumSliceGroups[8] = {1, 1, 2, 2, 3, 3, 3, 3};
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
-
- Function name: h264bsdDecodePicParamSet
-
- Functional description:
- Decode picture parameter set information from the stream.
-
- Function allocates memory for
- - run lengths if slice group map type is 0
- - top-left and bottom-right arrays if map type is 2
- - for slice group ids if map type is 6
-
- Validity of some of the slice group mapping information depends
- on the image dimensions which are not known here. Therefore the
- validity has to be checked afterwards, currently in the parameter
- set activation phase.
-
- Inputs:
- pStrmData pointer to stream data structure
-
- Outputs:
- pPicParamSet decoded information is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK failure, invalid information or end of stream
- MEMORY_ALLOCATION_ERROR for memory allocation failure
-
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodePicParamSet(strmData_t *pStrmData, picParamSet_t *pPicParamSet)
-{
-
-/* Variables */
-
- u32 tmp, i, value;
- i32 itmp;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pPicParamSet);
-
-
- H264SwDecMemset(pPicParamSet, 0, sizeof(picParamSet_t));
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pPicParamSet->picParameterSetId);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pPicParamSet->picParameterSetId >= MAX_NUM_PIC_PARAM_SETS)
- {
- EPRINT("pic_parameter_set_id");
- return(HANTRO_NOK);
- }
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pPicParamSet->seqParameterSetId);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pPicParamSet->seqParameterSetId >= MAX_NUM_SEQ_PARAM_SETS)
- {
- EPRINT("seq_param_set_id");
- return(HANTRO_NOK);
- }
-
- /* entropy_coding_mode_flag, shall be 0 for baseline profile */
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp)
- {
- EPRINT("entropy_coding_mode_flag");
- return(HANTRO_NOK);
- }
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pPicParamSet->picOrderPresentFlag = (tmp == 1) ? HANTRO_TRUE : HANTRO_FALSE;
-
- /* num_slice_groups_minus1 */
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- pPicParamSet->numSliceGroups = value + 1;
- if (pPicParamSet->numSliceGroups > MAX_NUM_SLICE_GROUPS)
- {
- EPRINT("num_slice_groups_minus1");
- return(HANTRO_NOK);
- }
-
- /* decode slice group mapping information if more than one slice groups */
- if (pPicParamSet->numSliceGroups > 1)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pPicParamSet->sliceGroupMapType);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pPicParamSet->sliceGroupMapType > 6)
- {
- EPRINT("slice_group_map_type");
- return(HANTRO_NOK);
- }
-
- if (pPicParamSet->sliceGroupMapType == 0)
- {
- ALLOCATE(pPicParamSet->runLength,
- pPicParamSet->numSliceGroups, u32);
- if (pPicParamSet->runLength == NULL)
- return(MEMORY_ALLOCATION_ERROR);
- for (i = 0; i < pPicParamSet->numSliceGroups; i++)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- pPicParamSet->runLength[i] = value+1;
- /* param values checked in CheckPps() */
- }
- }
- else if (pPicParamSet->sliceGroupMapType == 2)
- {
- ALLOCATE(pPicParamSet->topLeft,
- pPicParamSet->numSliceGroups - 1, u32);
- ALLOCATE(pPicParamSet->bottomRight,
- pPicParamSet->numSliceGroups - 1, u32);
- if (pPicParamSet->topLeft == NULL ||
- pPicParamSet->bottomRight == NULL)
- return(MEMORY_ALLOCATION_ERROR);
- for (i = 0; i < pPicParamSet->numSliceGroups - 1; i++)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- pPicParamSet->topLeft[i] = value;
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- pPicParamSet->bottomRight[i] = value;
- /* param values checked in CheckPps() */
- }
- }
- else if ( (pPicParamSet->sliceGroupMapType == 3) ||
- (pPicParamSet->sliceGroupMapType == 4) ||
- (pPicParamSet->sliceGroupMapType == 5) )
- {
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pPicParamSet->sliceGroupChangeDirectionFlag =
- (tmp == 1) ? HANTRO_TRUE : HANTRO_FALSE;
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- pPicParamSet->sliceGroupChangeRate = value + 1;
- /* param value checked in CheckPps() */
- }
- else if (pPicParamSet->sliceGroupMapType == 6)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- pPicParamSet->picSizeInMapUnits = value + 1;
-
- ALLOCATE(pPicParamSet->sliceGroupId,
- pPicParamSet->picSizeInMapUnits, u32);
- if (pPicParamSet->sliceGroupId == NULL)
- return(MEMORY_ALLOCATION_ERROR);
-
- /* determine number of bits needed to represent range
- * [0, numSliceGroups) */
- tmp = CeilLog2NumSliceGroups[pPicParamSet->numSliceGroups-1];
-
- for (i = 0; i < pPicParamSet->picSizeInMapUnits; i++)
- {
- pPicParamSet->sliceGroupId[i] = h264bsdGetBits(pStrmData, tmp);
- if ( pPicParamSet->sliceGroupId[i] >=
- pPicParamSet->numSliceGroups )
- {
- EPRINT("slice_group_id");
- return(HANTRO_NOK);
- }
- }
- }
- }
-
- /* num_ref_idx_l0_active_minus1 */
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (value > 31)
- {
- EPRINT("num_ref_idx_l0_active_minus1");
- return(HANTRO_NOK);
- }
- pPicParamSet->numRefIdxL0Active = value + 1;
-
- /* num_ref_idx_l1_active_minus1 */
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (value > 31)
- {
- EPRINT("num_ref_idx_l1_active_minus1");
- return(HANTRO_NOK);
- }
-
- /* weighted_pred_flag, this shall be 0 for baseline profile */
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp)
- {
- EPRINT("weighted_pred_flag");
- return(HANTRO_NOK);
- }
-
- /* weighted_bipred_idc */
- tmp = h264bsdGetBits(pStrmData, 2);
- if (tmp > 2)
- {
- EPRINT("weighted_bipred_idc");
- return(HANTRO_NOK);
- }
-
- /* pic_init_qp_minus26 */
- tmp = h264bsdDecodeExpGolombSigned(pStrmData, &itmp);
- if (tmp != HANTRO_OK)
- return(tmp);
- if ((itmp < -26) || (itmp > 25))
- {
- EPRINT("pic_init_qp_minus26");
- return(HANTRO_NOK);
- }
- pPicParamSet->picInitQp = (u32)(itmp + 26);
-
- /* pic_init_qs_minus26 */
- tmp = h264bsdDecodeExpGolombSigned(pStrmData, &itmp);
- if (tmp != HANTRO_OK)
- return(tmp);
- if ((itmp < -26) || (itmp > 25))
- {
- EPRINT("pic_init_qs_minus26");
- return(HANTRO_NOK);
- }
-
- tmp = h264bsdDecodeExpGolombSigned(pStrmData, &itmp);
- if (tmp != HANTRO_OK)
- return(tmp);
- if ((itmp < -12) || (itmp > 12))
- {
- EPRINT("chroma_qp_index_offset");
- return(HANTRO_NOK);
- }
- pPicParamSet->chromaQpIndexOffset = itmp;
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pPicParamSet->deblockingFilterControlPresentFlag =
- (tmp == 1) ? HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pPicParamSet->constrainedIntraPredFlag = (tmp == 1) ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pPicParamSet->redundantPicCntPresentFlag = (tmp == 1) ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdRbspTrailingBits(pStrmData);
-
- /* ignore possible errors in trailing bits of parameters sets */
- return(HANTRO_OK);
-
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_pic_param_set.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_pic_param_set.h
deleted file mode 100644
index 6328638..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_pic_param_set.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_PIC_PARAM_SET_H
-#define H264SWDEC_PIC_PARAM_SET_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_stream.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-/* data structure to store PPS information decoded from the stream */
-typedef struct
-{
- u32 picParameterSetId;
- u32 seqParameterSetId;
- u32 picOrderPresentFlag;
- u32 numSliceGroups;
- u32 sliceGroupMapType;
- u32 *runLength;
- u32 *topLeft;
- u32 *bottomRight;
- u32 sliceGroupChangeDirectionFlag;
- u32 sliceGroupChangeRate;
- u32 picSizeInMapUnits;
- u32 *sliceGroupId;
- u32 numRefIdxL0Active;
- u32 picInitQp;
- i32 chromaQpIndexOffset;
- u32 deblockingFilterControlPresentFlag;
- u32 constrainedIntraPredFlag;
- u32 redundantPicCntPresentFlag;
-} picParamSet_t;
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodePicParamSet(strmData_t *pStrmData,
- picParamSet_t *pPicParamSet);
-
-#endif /* #ifdef H264SWDEC_PIC_PARAM_SET_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_reconstruct.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_reconstruct.c
deleted file mode 100644
index b409a06..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_reconstruct.c
+++ /dev/null
@@ -1,2318 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_reconstruct.h"
-#include "h264bsd_macroblock_layer.h"
-#include "h264bsd_image.h"
-#include "h264bsd_util.h"
-
-#ifdef H264DEC_OMXDL
-#include "omxtypes.h"
-#include "omxVC.h"
-#include "armVC.h"
-#endif /* H264DEC_OMXDL */
-
-#define UNUSED(x) (void)(x)
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-/* Switch off the following Lint messages for this file:
- * Info 701: Shift left of signed quantity (int)
- * Info 702: Shift right of signed quantity (int)
- */
-/*lint -e701 -e702 */
-
-/* Luma fractional-sample positions
- *
- * G a b c H
- * d e f g
- * h i j k m
- * n p q r
- * M s N
- *
- * G, H, M and N are integer sample positions
- * a-s are fractional samples that need to be interpolated.
- */
-#ifndef H264DEC_OMXDL
-static const u32 lumaFracPos[4][4] = {
- /* G d h n a e i p b f j q c g k r */
- {0, 1, 2, 3}, {4, 5, 6, 7}, {8, 9, 10, 11}, {12, 13, 14, 15}};
-#endif /* H264DEC_OMXDL */
-
-/* clipping table, defined in h264bsd_intra_prediction.c */
-extern const u8 h264bsdClip[];
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-#ifndef H264DEC_OMXDL
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdInterpolateChromaHor
-
- Functional description:
- This function performs chroma interpolation in horizontal direction.
- Overfilling is done only if needed. Reference image (pRef) is
- read at correct position and the predicted part is written to
- macroblock's chrominance (predPartChroma)
- Inputs:
- pRef pointer to reference frame Cb top-left corner
- x0 integer x-coordinate for prediction
- y0 integer y-coordinate for prediction
- width width of the reference frame chrominance in pixels
- height height of the reference frame chrominance in pixels
- xFrac horizontal fraction for prediction in 1/8 pixels
- chromaPartWidth width of the predicted part in pixels
- chromaPartHeight height of the predicted part in pixels
- Outputs:
- predPartChroma pointer where predicted part is written
-
-------------------------------------------------------------------------------*/
-#ifndef H264DEC_ARM11
-void h264bsdInterpolateChromaHor(
- u8 *pRef,
- u8 *predPartChroma,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 xFrac,
- u32 chromaPartWidth,
- u32 chromaPartHeight)
-{
-
-/* Variables */
-
- u32 x, y, tmp1, tmp2, tmp3, tmp4, c, val;
- u8 *ptrA, *cbr;
- u32 comp;
- u8 block[9*8*2];
-
-/* Code */
-
- ASSERT(predPartChroma);
- ASSERT(chromaPartWidth);
- ASSERT(chromaPartHeight);
- ASSERT(xFrac < 8);
- ASSERT(pRef);
-
- if ((x0 < 0) || ((u32)x0+chromaPartWidth+1 > width) ||
- (y0 < 0) || ((u32)y0+chromaPartHeight > height))
- {
- h264bsdFillBlock(pRef, block, x0, y0, width, height,
- chromaPartWidth + 1, chromaPartHeight, chromaPartWidth + 1);
- pRef += width * height;
- h264bsdFillBlock(pRef, block + (chromaPartWidth+1)*chromaPartHeight,
- x0, y0, width, height, chromaPartWidth + 1,
- chromaPartHeight, chromaPartWidth + 1);
-
- pRef = block;
- x0 = 0;
- y0 = 0;
- width = chromaPartWidth+1;
- height = chromaPartHeight;
- }
-
- val = 8 - xFrac;
-
- for (comp = 0; comp <= 1; comp++)
- {
-
- ptrA = pRef + (comp * height + (u32)y0) * width + x0;
- cbr = predPartChroma + comp * 8 * 8;
-
- /* 2x2 pels per iteration
- * bilinear horizontal interpolation */
- for (y = (chromaPartHeight >> 1); y; y--)
- {
- for (x = (chromaPartWidth >> 1); x; x--)
- {
- tmp1 = ptrA[width];
- tmp2 = *ptrA++;
- tmp3 = ptrA[width];
- tmp4 = *ptrA++;
- c = ((val * tmp1 + xFrac * tmp3) << 3) + 32;
- c >>= 6;
- cbr[8] = (u8)c;
- c = ((val * tmp2 + xFrac * tmp4) << 3) + 32;
- c >>= 6;
- *cbr++ = (u8)c;
- tmp1 = ptrA[width];
- tmp2 = *ptrA;
- c = ((val * tmp3 + xFrac * tmp1) << 3) + 32;
- c >>= 6;
- cbr[8] = (u8)c;
- c = ((val * tmp4 + xFrac * tmp2) << 3) + 32;
- c >>= 6;
- *cbr++ = (u8)c;
- }
- cbr += 2*8 - chromaPartWidth;
- ptrA += 2*width - chromaPartWidth;
- }
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdInterpolateChromaVer
-
- Functional description:
- This function performs chroma interpolation in vertical direction.
- Overfilling is done only if needed. Reference image (pRef) is
- read at correct position and the predicted part is written to
- macroblock's chrominance (predPartChroma)
-
-------------------------------------------------------------------------------*/
-
-void h264bsdInterpolateChromaVer(
- u8 *pRef,
- u8 *predPartChroma,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 yFrac,
- u32 chromaPartWidth,
- u32 chromaPartHeight)
-{
-
-/* Variables */
-
- u32 x, y, tmp1, tmp2, tmp3, c, val;
- u8 *ptrA, *cbr;
- u32 comp;
- u8 block[9*8*2];
-
-/* Code */
-
- ASSERT(predPartChroma);
- ASSERT(chromaPartWidth);
- ASSERT(chromaPartHeight);
- ASSERT(yFrac < 8);
- ASSERT(pRef);
-
- if ((x0 < 0) || ((u32)x0+chromaPartWidth > width) ||
- (y0 < 0) || ((u32)y0+chromaPartHeight+1 > height))
- {
- h264bsdFillBlock(pRef, block, x0, y0, width, height, chromaPartWidth,
- chromaPartHeight + 1, chromaPartWidth);
- pRef += width * height;
- h264bsdFillBlock(pRef, block + chromaPartWidth*(chromaPartHeight+1),
- x0, y0, width, height, chromaPartWidth,
- chromaPartHeight + 1, chromaPartWidth);
-
- pRef = block;
- x0 = 0;
- y0 = 0;
- width = chromaPartWidth;
- height = chromaPartHeight+1;
- }
-
- val = 8 - yFrac;
-
- for (comp = 0; comp <= 1; comp++)
- {
-
- ptrA = pRef + (comp * height + (u32)y0) * width + x0;
- cbr = predPartChroma + comp * 8 * 8;
-
- /* 2x2 pels per iteration
- * bilinear vertical interpolation */
- for (y = (chromaPartHeight >> 1); y; y--)
- {
- for (x = (chromaPartWidth >> 1); x; x--)
- {
- tmp3 = ptrA[width*2];
- tmp2 = ptrA[width];
- tmp1 = *ptrA++;
- c = ((val * tmp2 + yFrac * tmp3) << 3) + 32;
- c >>= 6;
- cbr[8] = (u8)c;
- c = ((val * tmp1 + yFrac * tmp2) << 3) + 32;
- c >>= 6;
- *cbr++ = (u8)c;
- tmp3 = ptrA[width*2];
- tmp2 = ptrA[width];
- tmp1 = *ptrA++;
- c = ((val * tmp2 + yFrac * tmp3) << 3) + 32;
- c >>= 6;
- cbr[8] = (u8)c;
- c = ((val * tmp1 + yFrac * tmp2) << 3) + 32;
- c >>= 6;
- *cbr++ = (u8)c;
- }
- cbr += 2*8 - chromaPartWidth;
- ptrA += 2*width - chromaPartWidth;
- }
- }
-
-}
-#endif
-/*------------------------------------------------------------------------------
-
- Function: h264bsdInterpolateChromaHorVer
-
- Functional description:
- This function performs chroma interpolation in horizontal and
- vertical direction. Overfilling is done only if needed. Reference
- image (ref) is read at correct position and the predicted part
- is written to macroblock's chrominance (predPartChroma)
-
-------------------------------------------------------------------------------*/
-
-void h264bsdInterpolateChromaHorVer(
- u8 *ref,
- u8 *predPartChroma,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 xFrac,
- u32 yFrac,
- u32 chromaPartWidth,
- u32 chromaPartHeight)
-{
- u8 block[9*9*2];
- u32 x, y, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, valX, valY, plus32 = 32;
- u32 comp;
- u8 *ptrA, *cbr;
-
-/* Code */
-
- ASSERT(predPartChroma);
- ASSERT(chromaPartWidth);
- ASSERT(chromaPartHeight);
- ASSERT(xFrac < 8);
- ASSERT(yFrac < 8);
- ASSERT(ref);
-
- if ((x0 < 0) || ((u32)x0+chromaPartWidth+1 > width) ||
- (y0 < 0) || ((u32)y0+chromaPartHeight+1 > height))
- {
- h264bsdFillBlock(ref, block, x0, y0, width, height,
- chromaPartWidth + 1, chromaPartHeight + 1, chromaPartWidth + 1);
- ref += width * height;
- h264bsdFillBlock(ref, block + (chromaPartWidth+1)*(chromaPartHeight+1),
- x0, y0, width, height, chromaPartWidth + 1,
- chromaPartHeight + 1, chromaPartWidth + 1);
-
- ref = block;
- x0 = 0;
- y0 = 0;
- width = chromaPartWidth+1;
- height = chromaPartHeight+1;
- }
-
- valX = 8 - xFrac;
- valY = 8 - yFrac;
-
- for (comp = 0; comp <= 1; comp++)
- {
-
- ptrA = ref + (comp * height + (u32)y0) * width + x0;
- cbr = predPartChroma + comp * 8 * 8;
-
- /* 2x2 pels per iteration
- * bilinear vertical and horizontal interpolation */
- for (y = (chromaPartHeight >> 1); y; y--)
- {
- tmp1 = *ptrA;
- tmp3 = ptrA[width];
- tmp5 = ptrA[width*2];
- tmp1 *= valY;
- tmp1 += tmp3 * yFrac;
- tmp3 *= valY;
- tmp3 += tmp5 * yFrac;
- for (x = (chromaPartWidth >> 1); x; x--)
- {
- tmp2 = *++ptrA;
- tmp4 = ptrA[width];
- tmp6 = ptrA[width*2];
- tmp2 *= valY;
- tmp2 += tmp4 * yFrac;
- tmp4 *= valY;
- tmp4 += tmp6 * yFrac;
- tmp1 = tmp1 * valX + plus32;
- tmp3 = tmp3 * valX + plus32;
- tmp1 += tmp2 * xFrac;
- tmp1 >>= 6;
- tmp3 += tmp4 * xFrac;
- tmp3 >>= 6;
- cbr[8] = (u8)tmp3;
- *cbr++ = (u8)tmp1;
-
- tmp1 = *++ptrA;
- tmp3 = ptrA[width];
- tmp5 = ptrA[width*2];
- tmp1 *= valY;
- tmp1 += tmp3 * yFrac;
- tmp3 *= valY;
- tmp3 += tmp5 * yFrac;
- tmp2 = tmp2 * valX + plus32;
- tmp4 = tmp4 * valX + plus32;
- tmp2 += tmp1 * xFrac;
- tmp2 >>= 6;
- tmp4 += tmp3 * xFrac;
- tmp4 >>= 6;
- cbr[8] = (u8)tmp4;
- *cbr++ = (u8)tmp2;
- }
- cbr += 2*8 - chromaPartWidth;
- ptrA += 2*width - chromaPartWidth;
- }
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: PredictChroma
-
- Functional description:
- Top level chroma prediction function that calls the appropriate
- interpolation function. The output is written to macroblock array.
-
-------------------------------------------------------------------------------*/
-
-static void PredictChroma(
- u8 *mbPartChroma,
- u32 xAL,
- u32 yAL,
- u32 partWidth,
- u32 partHeight,
- mv_t *mv,
- image_t *refPic)
-{
-
-/* Variables */
-
- u32 xFrac, yFrac, width, height, chromaPartWidth, chromaPartHeight;
- i32 xInt, yInt;
- u8 *ref;
-
-/* Code */
-
- ASSERT(mv);
- ASSERT(refPic);
- ASSERT(refPic->data);
- ASSERT(refPic->width);
- ASSERT(refPic->height);
-
- width = 8 * refPic->width;
- height = 8 * refPic->height;
-
- xInt = (xAL >> 1) + (mv->hor >> 3);
- yInt = (yAL >> 1) + (mv->ver >> 3);
- xFrac = mv->hor & 0x7;
- yFrac = mv->ver & 0x7;
-
- chromaPartWidth = partWidth >> 1;
- chromaPartHeight = partHeight >> 1;
- ref = refPic->data + 256 * refPic->width * refPic->height;
-
- if (xFrac && yFrac)
- {
- h264bsdInterpolateChromaHorVer(ref, mbPartChroma, xInt, yInt, width,
- height, xFrac, yFrac, chromaPartWidth, chromaPartHeight);
- }
- else if (xFrac)
- {
- h264bsdInterpolateChromaHor(ref, mbPartChroma, xInt, yInt, width,
- height, xFrac, chromaPartWidth, chromaPartHeight);
- }
- else if (yFrac)
- {
- h264bsdInterpolateChromaVer(ref, mbPartChroma, xInt, yInt, width,
- height, yFrac, chromaPartWidth, chromaPartHeight);
- }
- else
- {
- h264bsdFillBlock(ref, mbPartChroma, xInt, yInt, width, height,
- chromaPartWidth, chromaPartHeight, 8);
- ref += width * height;
- h264bsdFillBlock(ref, mbPartChroma + 8*8, xInt, yInt, width, height,
- chromaPartWidth, chromaPartHeight, 8);
- }
-
-}
-
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdInterpolateVerHalf
-
- Functional description:
- Function to perform vertical interpolation of pixel position 'h'
- for a block. Overfilling is done only if needed. Reference
- image (ref) is read at correct position and the predicted part
- is written to macroblock array (mb)
-
-------------------------------------------------------------------------------*/
-#ifndef H264DEC_ARM11
-void h264bsdInterpolateVerHalf(
- u8 *ref,
- u8 *mb,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 partWidth,
- u32 partHeight)
-{
- u32 p1[21*21/4+1];
- u32 i, j;
- i32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- u8 *ptrC, *ptrV;
- const u8 *clp = h264bsdClip + 512;
-
- /* Code */
-
- ASSERT(ref);
- ASSERT(mb);
-
- if ((x0 < 0) || ((u32)x0+partWidth > width) ||
- (y0 < 0) || ((u32)y0+partHeight+5 > height))
- {
- h264bsdFillBlock(ref, (u8*)p1, x0, y0, width, height,
- partWidth, partHeight+5, partWidth);
-
- x0 = 0;
- y0 = 0;
- ref = (u8*)p1;
- width = partWidth;
- }
-
- ref += (u32)y0 * width + (u32)x0;
-
- ptrC = ref + width;
- ptrV = ptrC + 5*width;
-
- /* 4 pixels per iteration, interpolate using 5 vertical samples */
- for (i = (partHeight >> 2); i; i--)
- {
- /* h1 = (16 + A + 16(G+M) + 4(G+M) - 4(C+R) - (C+R) + T) >> 5 */
- for (j = partWidth; j; j--)
- {
- tmp4 = ptrV[-(i32)width*2];
- tmp5 = ptrV[-(i32)width];
- tmp1 = ptrV[width];
- tmp2 = ptrV[width*2];
- tmp6 = *ptrV++;
-
- tmp7 = tmp4 + tmp1;
- tmp2 -= (tmp7 << 2);
- tmp2 -= tmp7;
- tmp2 += 16;
- tmp7 = tmp5 + tmp6;
- tmp3 = ptrC[width*2];
- tmp2 += (tmp7 << 4);
- tmp2 += (tmp7 << 2);
- tmp2 += tmp3;
- tmp2 = clp[tmp2>>5];
- tmp1 += 16;
- mb[48] = (u8)tmp2;
-
- tmp7 = tmp3 + tmp6;
- tmp1 -= (tmp7 << 2);
- tmp1 -= tmp7;
- tmp7 = tmp4 + tmp5;
- tmp2 = ptrC[width];
- tmp1 += (tmp7 << 4);
- tmp1 += (tmp7 << 2);
- tmp1 += tmp2;
- tmp1 = clp[tmp1>>5];
- tmp6 += 16;
- mb[32] = (u8)tmp1;
-
- tmp7 = tmp2 + tmp5;
- tmp6 -= (tmp7 << 2);
- tmp6 -= tmp7;
- tmp7 = tmp4 + tmp3;
- tmp1 = *ptrC;
- tmp6 += (tmp7 << 4);
- tmp6 += (tmp7 << 2);
- tmp6 += tmp1;
- tmp6 = clp[tmp6>>5];
- tmp5 += 16;
- mb[16] = (u8)tmp6;
-
- tmp1 += tmp4;
- tmp5 -= (tmp1 << 2);
- tmp5 -= tmp1;
- tmp3 += tmp2;
- tmp6 = ptrC[-(i32)width];
- tmp5 += (tmp3 << 4);
- tmp5 += (tmp3 << 2);
- tmp5 += tmp6;
- tmp5 = clp[tmp5>>5];
- *mb++ = (u8)tmp5;
- ptrC++;
- }
- ptrC += 4*width - partWidth;
- ptrV += 4*width - partWidth;
- mb += 4*16 - partWidth;
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdInterpolateVerQuarter
-
- Functional description:
- Function to perform vertical interpolation of pixel position 'd'
- or 'n' for a block. Overfilling is done only if needed. Reference
- image (ref) is read at correct position and the predicted part
- is written to macroblock array (mb)
-
-------------------------------------------------------------------------------*/
-
-void h264bsdInterpolateVerQuarter(
- u8 *ref,
- u8 *mb,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 partWidth,
- u32 partHeight,
- u32 verOffset) /* 0 for pixel d, 1 for pixel n */
-{
- u32 p1[21*21/4+1];
- u32 i, j;
- i32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- u8 *ptrC, *ptrV, *ptrInt;
- const u8 *clp = h264bsdClip + 512;
-
- /* Code */
-
- ASSERT(ref);
- ASSERT(mb);
-
- if ((x0 < 0) || ((u32)x0+partWidth > width) ||
- (y0 < 0) || ((u32)y0+partHeight+5 > height))
- {
- h264bsdFillBlock(ref, (u8*)p1, x0, y0, width, height,
- partWidth, partHeight+5, partWidth);
-
- x0 = 0;
- y0 = 0;
- ref = (u8*)p1;
- width = partWidth;
- }
-
- ref += (u32)y0 * width + (u32)x0;
-
- ptrC = ref + width;
- ptrV = ptrC + 5*width;
-
- /* Pointer to integer sample position, either M or R */
- ptrInt = ptrC + (2+verOffset)*width;
-
- /* 4 pixels per iteration
- * interpolate using 5 vertical samples and average between
- * interpolated value and integer sample value */
- for (i = (partHeight >> 2); i; i--)
- {
- /* h1 = (16 + A + 16(G+M) + 4(G+M) - 4(C+R) - (C+R) + T) >> 5 */
- for (j = partWidth; j; j--)
- {
- tmp4 = ptrV[-(i32)width*2];
- tmp5 = ptrV[-(i32)width];
- tmp1 = ptrV[width];
- tmp2 = ptrV[width*2];
- tmp6 = *ptrV++;
-
- tmp7 = tmp4 + tmp1;
- tmp2 -= (tmp7 << 2);
- tmp2 -= tmp7;
- tmp2 += 16;
- tmp7 = tmp5 + tmp6;
- tmp3 = ptrC[width*2];
- tmp2 += (tmp7 << 4);
- tmp2 += (tmp7 << 2);
- tmp2 += tmp3;
- tmp2 = clp[tmp2>>5];
- tmp7 = ptrInt[width*2];
- tmp1 += 16;
- tmp2++;
- mb[48] = (u8)((tmp2 + tmp7) >> 1);
-
- tmp7 = tmp3 + tmp6;
- tmp1 -= (tmp7 << 2);
- tmp1 -= tmp7;
- tmp7 = tmp4 + tmp5;
- tmp2 = ptrC[width];
- tmp1 += (tmp7 << 4);
- tmp1 += (tmp7 << 2);
- tmp1 += tmp2;
- tmp1 = clp[tmp1>>5];
- tmp7 = ptrInt[width];
- tmp6 += 16;
- tmp1++;
- mb[32] = (u8)((tmp1 + tmp7) >> 1);
-
- tmp7 = tmp2 + tmp5;
- tmp6 -= (tmp7 << 2);
- tmp6 -= tmp7;
- tmp7 = tmp4 + tmp3;
- tmp1 = *ptrC;
- tmp6 += (tmp7 << 4);
- tmp6 += (tmp7 << 2);
- tmp6 += tmp1;
- tmp6 = clp[tmp6>>5];
- tmp7 = *ptrInt;
- tmp5 += 16;
- tmp6++;
- mb[16] = (u8)((tmp6 + tmp7) >> 1);
-
- tmp1 += tmp4;
- tmp5 -= (tmp1 << 2);
- tmp5 -= tmp1;
- tmp3 += tmp2;
- tmp6 = ptrC[-(i32)width];
- tmp5 += (tmp3 << 4);
- tmp5 += (tmp3 << 2);
- tmp5 += tmp6;
- tmp5 = clp[tmp5>>5];
- tmp7 = ptrInt[-(i32)width];
- tmp5++;
- *mb++ = (u8)((tmp5 + tmp7) >> 1);
- ptrC++;
- ptrInt++;
- }
- ptrC += 4*width - partWidth;
- ptrV += 4*width - partWidth;
- ptrInt += 4*width - partWidth;
- mb += 4*16 - partWidth;
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdInterpolateHorHalf
-
- Functional description:
- Function to perform horizontal interpolation of pixel position 'b'
- for a block. Overfilling is done only if needed. Reference
- image (ref) is read at correct position and the predicted part
- is written to macroblock array (mb)
-
-------------------------------------------------------------------------------*/
-
-void h264bsdInterpolateHorHalf(
- u8 *ref,
- u8 *mb,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 partWidth,
- u32 partHeight)
-{
- u32 p1[21*21/4+1];
- u8 *ptrJ;
- u32 x, y;
- i32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- const u8 *clp = h264bsdClip + 512;
-
- /* Code */
-
- ASSERT(ref);
- ASSERT(mb);
- ASSERT((partWidth&0x3) == 0);
- ASSERT((partHeight&0x3) == 0);
-
- if ((x0 < 0) || ((u32)x0+partWidth+5 > width) ||
- (y0 < 0) || ((u32)y0+partHeight > height))
- {
- h264bsdFillBlock(ref, (u8*)p1, x0, y0, width, height,
- partWidth+5, partHeight, partWidth+5);
-
- x0 = 0;
- y0 = 0;
- ref = (u8*)p1;
- width = partWidth + 5;
- }
-
- ref += (u32)y0 * width + (u32)x0;
-
- ptrJ = ref + 5;
-
- for (y = partHeight; y; y--)
- {
- tmp6 = *(ptrJ - 5);
- tmp5 = *(ptrJ - 4);
- tmp4 = *(ptrJ - 3);
- tmp3 = *(ptrJ - 2);
- tmp2 = *(ptrJ - 1);
-
- /* calculate 4 pels per iteration */
- for (x = (partWidth >> 2); x; x--)
- {
- /* First pixel */
- tmp6 += 16;
- tmp7 = tmp3 + tmp4;
- tmp6 += (tmp7 << 4);
- tmp6 += (tmp7 << 2);
- tmp7 = tmp2 + tmp5;
- tmp1 = *ptrJ++;
- tmp6 -= (tmp7 << 2);
- tmp6 -= tmp7;
- tmp6 += tmp1;
- tmp6 = clp[tmp6>>5];
- /* Second pixel */
- tmp5 += 16;
- tmp7 = tmp2 + tmp3;
- *mb++ = (u8)tmp6;
- tmp5 += (tmp7 << 4);
- tmp5 += (tmp7 << 2);
- tmp7 = tmp1 + tmp4;
- tmp6 = *ptrJ++;
- tmp5 -= (tmp7 << 2);
- tmp5 -= tmp7;
- tmp5 += tmp6;
- tmp5 = clp[tmp5>>5];
- /* Third pixel */
- tmp4 += 16;
- tmp7 = tmp1 + tmp2;
- *mb++ = (u8)tmp5;
- tmp4 += (tmp7 << 4);
- tmp4 += (tmp7 << 2);
- tmp7 = tmp6 + tmp3;
- tmp5 = *ptrJ++;
- tmp4 -= (tmp7 << 2);
- tmp4 -= tmp7;
- tmp4 += tmp5;
- tmp4 = clp[tmp4>>5];
- /* Fourth pixel */
- tmp3 += 16;
- tmp7 = tmp6 + tmp1;
- *mb++ = (u8)tmp4;
- tmp3 += (tmp7 << 4);
- tmp3 += (tmp7 << 2);
- tmp7 = tmp5 + tmp2;
- tmp4 = *ptrJ++;
- tmp3 -= (tmp7 << 2);
- tmp3 -= tmp7;
- tmp3 += tmp4;
- tmp3 = clp[tmp3>>5];
- tmp7 = tmp4;
- tmp4 = tmp6;
- tmp6 = tmp2;
- tmp2 = tmp7;
- *mb++ = (u8)tmp3;
- tmp3 = tmp5;
- tmp5 = tmp1;
- }
- ptrJ += width - partWidth;
- mb += 16 - partWidth;
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdInterpolateHorQuarter
-
- Functional description:
- Function to perform horizontal interpolation of pixel position 'a'
- or 'c' for a block. Overfilling is done only if needed. Reference
- image (ref) is read at correct position and the predicted part
- is written to macroblock array (mb)
-
-------------------------------------------------------------------------------*/
-
-void h264bsdInterpolateHorQuarter(
- u8 *ref,
- u8 *mb,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 partWidth,
- u32 partHeight,
- u32 horOffset) /* 0 for pixel a, 1 for pixel c */
-{
- u32 p1[21*21/4+1];
- u8 *ptrJ;
- u32 x, y;
- i32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- const u8 *clp = h264bsdClip + 512;
-
- /* Code */
-
- ASSERT(ref);
- ASSERT(mb);
-
- if ((x0 < 0) || ((u32)x0+partWidth+5 > width) ||
- (y0 < 0) || ((u32)y0+partHeight > height))
- {
- h264bsdFillBlock(ref, (u8*)p1, x0, y0, width, height,
- partWidth+5, partHeight, partWidth+5);
-
- x0 = 0;
- y0 = 0;
- ref = (u8*)p1;
- width = partWidth + 5;
- }
-
- ref += (u32)y0 * width + (u32)x0;
-
- ptrJ = ref + 5;
-
- for (y = partHeight; y; y--)
- {
- tmp6 = *(ptrJ - 5);
- tmp5 = *(ptrJ - 4);
- tmp4 = *(ptrJ - 3);
- tmp3 = *(ptrJ - 2);
- tmp2 = *(ptrJ - 1);
-
- /* calculate 4 pels per iteration */
- for (x = (partWidth >> 2); x; x--)
- {
- /* First pixel */
- tmp6 += 16;
- tmp7 = tmp3 + tmp4;
- tmp6 += (tmp7 << 4);
- tmp6 += (tmp7 << 2);
- tmp7 = tmp2 + tmp5;
- tmp1 = *ptrJ++;
- tmp6 -= (tmp7 << 2);
- tmp6 -= tmp7;
- tmp6 += tmp1;
- tmp6 = clp[tmp6>>5];
- tmp5 += 16;
- if (!horOffset)
- tmp6 += tmp4;
- else
- tmp6 += tmp3;
- *mb++ = (u8)((tmp6 + 1) >> 1);
- /* Second pixel */
- tmp7 = tmp2 + tmp3;
- tmp5 += (tmp7 << 4);
- tmp5 += (tmp7 << 2);
- tmp7 = tmp1 + tmp4;
- tmp6 = *ptrJ++;
- tmp5 -= (tmp7 << 2);
- tmp5 -= tmp7;
- tmp5 += tmp6;
- tmp5 = clp[tmp5>>5];
- tmp4 += 16;
- if (!horOffset)
- tmp5 += tmp3;
- else
- tmp5 += tmp2;
- *mb++ = (u8)((tmp5 + 1) >> 1);
- /* Third pixel */
- tmp7 = tmp1 + tmp2;
- tmp4 += (tmp7 << 4);
- tmp4 += (tmp7 << 2);
- tmp7 = tmp6 + tmp3;
- tmp5 = *ptrJ++;
- tmp4 -= (tmp7 << 2);
- tmp4 -= tmp7;
- tmp4 += tmp5;
- tmp4 = clp[tmp4>>5];
- tmp3 += 16;
- if (!horOffset)
- tmp4 += tmp2;
- else
- tmp4 += tmp1;
- *mb++ = (u8)((tmp4 + 1) >> 1);
- /* Fourth pixel */
- tmp7 = tmp6 + tmp1;
- tmp3 += (tmp7 << 4);
- tmp3 += (tmp7 << 2);
- tmp7 = tmp5 + tmp2;
- tmp4 = *ptrJ++;
- tmp3 -= (tmp7 << 2);
- tmp3 -= tmp7;
- tmp3 += tmp4;
- tmp3 = clp[tmp3>>5];
- if (!horOffset)
- tmp3 += tmp1;
- else
- tmp3 += tmp6;
- *mb++ = (u8)((tmp3 + 1) >> 1);
- tmp3 = tmp5;
- tmp5 = tmp1;
- tmp7 = tmp4;
- tmp4 = tmp6;
- tmp6 = tmp2;
- tmp2 = tmp7;
- }
- ptrJ += width - partWidth;
- mb += 16 - partWidth;
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdInterpolateHorVerQuarter
-
- Functional description:
- Function to perform horizontal and vertical interpolation of pixel
- position 'e', 'g', 'p' or 'r' for a block. Overfilling is done only
- if needed. Reference image (ref) is read at correct position and
- the predicted part is written to macroblock array (mb)
-
-------------------------------------------------------------------------------*/
-
-void h264bsdInterpolateHorVerQuarter(
- u8 *ref,
- u8 *mb,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 partWidth,
- u32 partHeight,
- u32 horVerOffset) /* 0 for pixel e, 1 for pixel g,
- 2 for pixel p, 3 for pixel r */
-{
- u32 p1[21*21/4+1];
- u8 *ptrC, *ptrJ, *ptrV;
- u32 x, y;
- i32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- const u8 *clp = h264bsdClip + 512;
-
- /* Code */
-
- ASSERT(ref);
- ASSERT(mb);
-
- if ((x0 < 0) || ((u32)x0+partWidth+5 > width) ||
- (y0 < 0) || ((u32)y0+partHeight+5 > height))
- {
- h264bsdFillBlock(ref, (u8*)p1, x0, y0, width, height,
- partWidth+5, partHeight+5, partWidth+5);
-
- x0 = 0;
- y0 = 0;
- ref = (u8*)p1;
- width = partWidth+5;
- }
-
- /* Ref points to G + (-2, -2) */
- ref += (u32)y0 * width + (u32)x0;
-
- /* ptrJ points to either J or Q, depending on vertical offset */
- ptrJ = ref + (((horVerOffset & 0x2) >> 1) + 2) * width + 5;
-
- /* ptrC points to either C or D, depending on horizontal offset */
- ptrC = ref + width + 2 + (horVerOffset & 0x1);
-
- for (y = partHeight; y; y--)
- {
- tmp6 = *(ptrJ - 5);
- tmp5 = *(ptrJ - 4);
- tmp4 = *(ptrJ - 3);
- tmp3 = *(ptrJ - 2);
- tmp2 = *(ptrJ - 1);
-
- /* Horizontal interpolation, calculate 4 pels per iteration */
- for (x = (partWidth >> 2); x; x--)
- {
- /* First pixel */
- tmp6 += 16;
- tmp7 = tmp3 + tmp4;
- tmp6 += (tmp7 << 4);
- tmp6 += (tmp7 << 2);
- tmp7 = tmp2 + tmp5;
- tmp1 = *ptrJ++;
- tmp6 -= (tmp7 << 2);
- tmp6 -= tmp7;
- tmp6 += tmp1;
- tmp6 = clp[tmp6>>5];
- /* Second pixel */
- tmp5 += 16;
- tmp7 = tmp2 + tmp3;
- *mb++ = (u8)tmp6;
- tmp5 += (tmp7 << 4);
- tmp5 += (tmp7 << 2);
- tmp7 = tmp1 + tmp4;
- tmp6 = *ptrJ++;
- tmp5 -= (tmp7 << 2);
- tmp5 -= tmp7;
- tmp5 += tmp6;
- tmp5 = clp[tmp5>>5];
- /* Third pixel */
- tmp4 += 16;
- tmp7 = tmp1 + tmp2;
- *mb++ = (u8)tmp5;
- tmp4 += (tmp7 << 4);
- tmp4 += (tmp7 << 2);
- tmp7 = tmp6 + tmp3;
- tmp5 = *ptrJ++;
- tmp4 -= (tmp7 << 2);
- tmp4 -= tmp7;
- tmp4 += tmp5;
- tmp4 = clp[tmp4>>5];
- /* Fourth pixel */
- tmp3 += 16;
- tmp7 = tmp6 + tmp1;
- *mb++ = (u8)tmp4;
- tmp3 += (tmp7 << 4);
- tmp3 += (tmp7 << 2);
- tmp7 = tmp5 + tmp2;
- tmp4 = *ptrJ++;
- tmp3 -= (tmp7 << 2);
- tmp3 -= tmp7;
- tmp3 += tmp4;
- tmp3 = clp[tmp3>>5];
- tmp7 = tmp4;
- tmp4 = tmp6;
- tmp6 = tmp2;
- tmp2 = tmp7;
- *mb++ = (u8)tmp3;
- tmp3 = tmp5;
- tmp5 = tmp1;
- }
- ptrJ += width - partWidth;
- mb += 16 - partWidth;
- }
-
- mb -= 16*partHeight;
- ptrV = ptrC + 5*width;
-
- for (y = (partHeight >> 2); y; y--)
- {
- /* Vertical interpolation and averaging, 4 pels per iteration */
- for (x = partWidth; x; x--)
- {
- tmp4 = ptrV[-(i32)width*2];
- tmp5 = ptrV[-(i32)width];
- tmp1 = ptrV[width];
- tmp2 = ptrV[width*2];
- tmp6 = *ptrV++;
-
- tmp7 = tmp4 + tmp1;
- tmp2 -= (tmp7 << 2);
- tmp2 -= tmp7;
- tmp2 += 16;
- tmp7 = tmp5 + tmp6;
- tmp3 = ptrC[width*2];
- tmp2 += (tmp7 << 4);
- tmp2 += (tmp7 << 2);
- tmp2 += tmp3;
- tmp7 = clp[tmp2>>5];
- tmp2 = mb[48];
- tmp1 += 16;
- tmp7++;
- mb[48] = (u8)((tmp2 + tmp7) >> 1);
-
- tmp7 = tmp3 + tmp6;
- tmp1 -= (tmp7 << 2);
- tmp1 -= tmp7;
- tmp7 = tmp4 + tmp5;
- tmp2 = ptrC[width];
- tmp1 += (tmp7 << 4);
- tmp1 += (tmp7 << 2);
- tmp1 += tmp2;
- tmp7 = clp[tmp1>>5];
- tmp1 = mb[32];
- tmp6 += 16;
- tmp7++;
- mb[32] = (u8)((tmp1 + tmp7) >> 1);
-
- tmp1 = *ptrC;
- tmp7 = tmp2 + tmp5;
- tmp6 -= (tmp7 << 2);
- tmp6 -= tmp7;
- tmp7 = tmp4 + tmp3;
- tmp6 += (tmp7 << 4);
- tmp6 += (tmp7 << 2);
- tmp6 += tmp1;
- tmp7 = clp[tmp6>>5];
- tmp6 = mb[16];
- tmp5 += 16;
- tmp7++;
- mb[16] = (u8)((tmp6 + tmp7) >> 1);
-
- tmp6 = ptrC[-(i32)width];
- tmp1 += tmp4;
- tmp5 -= (tmp1 << 2);
- tmp5 -= tmp1;
- tmp3 += tmp2;
- tmp5 += (tmp3 << 4);
- tmp5 += (tmp3 << 2);
- tmp5 += tmp6;
- tmp7 = clp[tmp5>>5];
- tmp5 = *mb;
- tmp7++;
- *mb++ = (u8)((tmp5 + tmp7) >> 1);
- ptrC++;
-
- }
- ptrC += 4*width - partWidth;
- ptrV += 4*width - partWidth;
- mb += 4*16 - partWidth;
- }
-
-}
-#endif
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdInterpolateMidHalf
-
- Functional description:
- Function to perform horizontal and vertical interpolation of pixel
- position 'j' for a block. Overfilling is done only if needed.
- Reference image (ref) is read at correct position and the predicted
- part is written to macroblock array (mb)
-
-------------------------------------------------------------------------------*/
-
-void h264bsdInterpolateMidHalf(
- u8 *ref,
- u8 *mb,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 partWidth,
- u32 partHeight)
-{
- u32 p1[21*21/4+1];
- u32 x, y;
- i32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- i32 *ptrC, *ptrV, *b1;
- u8 *ptrJ;
- i32 table[21*16];
- const u8 *clp = h264bsdClip + 512;
-
- /* Code */
-
- ASSERT(ref);
- ASSERT(mb);
-
- if ((x0 < 0) || ((u32)x0+partWidth+5 > width) ||
- (y0 < 0) || ((u32)y0+partHeight+5 > height))
- {
- h264bsdFillBlock(ref, (u8*)p1, x0, y0, width, height,
- partWidth+5, partHeight+5, partWidth+5);
-
- x0 = 0;
- y0 = 0;
- ref = (u8*)p1;
- width = partWidth+5;
- }
-
- ref += (u32)y0 * width + (u32)x0;
-
- b1 = table;
- ptrJ = ref + 5;
-
- /* First step: calculate intermediate values for
- * horizontal interpolation */
- for (y = partHeight + 5; y; y--)
- {
- tmp6 = *(ptrJ - 5);
- tmp5 = *(ptrJ - 4);
- tmp4 = *(ptrJ - 3);
- tmp3 = *(ptrJ - 2);
- tmp2 = *(ptrJ - 1);
-
- /* 4 pels per iteration */
- for (x = (partWidth >> 2); x; x--)
- {
- /* First pixel */
- tmp7 = tmp3 + tmp4;
- tmp6 += (tmp7 << 4);
- tmp6 += (tmp7 << 2);
- tmp7 = tmp2 + tmp5;
- tmp1 = *ptrJ++;
- tmp6 -= (tmp7 << 2);
- tmp6 -= tmp7;
- tmp6 += tmp1;
- *b1++ = tmp6;
- /* Second pixel */
- tmp7 = tmp2 + tmp3;
- tmp5 += (tmp7 << 4);
- tmp5 += (tmp7 << 2);
- tmp7 = tmp1 + tmp4;
- tmp6 = *ptrJ++;
- tmp5 -= (tmp7 << 2);
- tmp5 -= tmp7;
- tmp5 += tmp6;
- *b1++ = tmp5;
- /* Third pixel */
- tmp7 = tmp1 + tmp2;
- tmp4 += (tmp7 << 4);
- tmp4 += (tmp7 << 2);
- tmp7 = tmp6 + tmp3;
- tmp5 = *ptrJ++;
- tmp4 -= (tmp7 << 2);
- tmp4 -= tmp7;
- tmp4 += tmp5;
- *b1++ = tmp4;
- /* Fourth pixel */
- tmp7 = tmp6 + tmp1;
- tmp3 += (tmp7 << 4);
- tmp3 += (tmp7 << 2);
- tmp7 = tmp5 + tmp2;
- tmp4 = *ptrJ++;
- tmp3 -= (tmp7 << 2);
- tmp3 -= tmp7;
- tmp3 += tmp4;
- *b1++ = tmp3;
- tmp7 = tmp4;
- tmp4 = tmp6;
- tmp6 = tmp2;
- tmp2 = tmp7;
- tmp3 = tmp5;
- tmp5 = tmp1;
- }
- ptrJ += width - partWidth;
- }
-
- /* Second step: calculate vertical interpolation */
- ptrC = table + partWidth;
- ptrV = ptrC + 5*partWidth;
- for (y = (partHeight >> 2); y; y--)
- {
- /* 4 pels per iteration */
- for (x = partWidth; x; x--)
- {
- tmp4 = ptrV[-(i32)partWidth*2];
- tmp5 = ptrV[-(i32)partWidth];
- tmp1 = ptrV[partWidth];
- tmp2 = ptrV[partWidth*2];
- tmp6 = *ptrV++;
-
- tmp7 = tmp4 + tmp1;
- tmp2 -= (tmp7 << 2);
- tmp2 -= tmp7;
- tmp2 += 512;
- tmp7 = tmp5 + tmp6;
- tmp3 = ptrC[partWidth*2];
- tmp2 += (tmp7 << 4);
- tmp2 += (tmp7 << 2);
- tmp2 += tmp3;
- tmp7 = clp[tmp2>>10];
- tmp1 += 512;
- mb[48] = (u8)tmp7;
-
- tmp7 = tmp3 + tmp6;
- tmp1 -= (tmp7 << 2);
- tmp1 -= tmp7;
- tmp7 = tmp4 + tmp5;
- tmp2 = ptrC[partWidth];
- tmp1 += (tmp7 << 4);
- tmp1 += (tmp7 << 2);
- tmp1 += tmp2;
- tmp7 = clp[tmp1>>10];
- tmp6 += 512;
- mb[32] = (u8)tmp7;
-
- tmp1 = *ptrC;
- tmp7 = tmp2 + tmp5;
- tmp6 -= (tmp7 << 2);
- tmp6 -= tmp7;
- tmp7 = tmp4 + tmp3;
- tmp6 += (tmp7 << 4);
- tmp6 += (tmp7 << 2);
- tmp6 += tmp1;
- tmp7 = clp[tmp6>>10];
- tmp5 += 512;
- mb[16] = (u8)tmp7;
-
- tmp6 = ptrC[-(i32)partWidth];
- tmp1 += tmp4;
- tmp5 -= (tmp1 << 2);
- tmp5 -= tmp1;
- tmp3 += tmp2;
- tmp5 += (tmp3 << 4);
- tmp5 += (tmp3 << 2);
- tmp5 += tmp6;
- tmp7 = clp[tmp5>>10];
- *mb++ = (u8)tmp7;
- ptrC++;
- }
- mb += 4*16 - partWidth;
- ptrC += 3*partWidth;
- ptrV += 3*partWidth;
- }
-
-}
-
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdInterpolateMidVerQuarter
-
- Functional description:
- Function to perform horizontal and vertical interpolation of pixel
- position 'f' or 'q' for a block. Overfilling is done only if needed.
- Reference image (ref) is read at correct position and the predicted
- part is written to macroblock array (mb)
-
-------------------------------------------------------------------------------*/
-
-void h264bsdInterpolateMidVerQuarter(
- u8 *ref,
- u8 *mb,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 partWidth,
- u32 partHeight,
- u32 verOffset) /* 0 for pixel f, 1 for pixel q */
-{
- u32 p1[21*21/4+1];
- u32 x, y;
- i32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- i32 *ptrC, *ptrV, *ptrInt, *b1;
- u8 *ptrJ;
- i32 table[21*16];
- const u8 *clp = h264bsdClip + 512;
-
- /* Code */
-
- ASSERT(ref);
- ASSERT(mb);
-
- if ((x0 < 0) || ((u32)x0+partWidth+5 > width) ||
- (y0 < 0) || ((u32)y0+partHeight+5 > height))
- {
- h264bsdFillBlock(ref, (u8*)p1, x0, y0, width, height,
- partWidth+5, partHeight+5, partWidth+5);
-
- x0 = 0;
- y0 = 0;
- ref = (u8*)p1;
- width = partWidth+5;
- }
-
- ref += (u32)y0 * width + (u32)x0;
-
- b1 = table;
- ptrJ = ref + 5;
-
- /* First step: calculate intermediate values for
- * horizontal interpolation */
- for (y = partHeight + 5; y; y--)
- {
- tmp6 = *(ptrJ - 5);
- tmp5 = *(ptrJ - 4);
- tmp4 = *(ptrJ - 3);
- tmp3 = *(ptrJ - 2);
- tmp2 = *(ptrJ - 1);
- for (x = (partWidth >> 2); x; x--)
- {
- /* First pixel */
- tmp7 = tmp3 + tmp4;
- tmp6 += (tmp7 << 4);
- tmp6 += (tmp7 << 2);
- tmp7 = tmp2 + tmp5;
- tmp1 = *ptrJ++;
- tmp6 -= (tmp7 << 2);
- tmp6 -= tmp7;
- tmp6 += tmp1;
- *b1++ = tmp6;
- /* Second pixel */
- tmp7 = tmp2 + tmp3;
- tmp5 += (tmp7 << 4);
- tmp5 += (tmp7 << 2);
- tmp7 = tmp1 + tmp4;
- tmp6 = *ptrJ++;
- tmp5 -= (tmp7 << 2);
- tmp5 -= tmp7;
- tmp5 += tmp6;
- *b1++ = tmp5;
- /* Third pixel */
- tmp7 = tmp1 + tmp2;
- tmp4 += (tmp7 << 4);
- tmp4 += (tmp7 << 2);
- tmp7 = tmp6 + tmp3;
- tmp5 = *ptrJ++;
- tmp4 -= (tmp7 << 2);
- tmp4 -= tmp7;
- tmp4 += tmp5;
- *b1++ = tmp4;
- /* Fourth pixel */
- tmp7 = tmp6 + tmp1;
- tmp3 += (tmp7 << 4);
- tmp3 += (tmp7 << 2);
- tmp7 = tmp5 + tmp2;
- tmp4 = *ptrJ++;
- tmp3 -= (tmp7 << 2);
- tmp3 -= tmp7;
- tmp3 += tmp4;
- *b1++ = tmp3;
- tmp7 = tmp4;
- tmp4 = tmp6;
- tmp6 = tmp2;
- tmp2 = tmp7;
- tmp3 = tmp5;
- tmp5 = tmp1;
- }
- ptrJ += width - partWidth;
- }
-
- /* Second step: calculate vertical interpolation and average */
- ptrC = table + partWidth;
- ptrV = ptrC + 5*partWidth;
- /* Pointer to integer sample position, either M or R */
- ptrInt = ptrC + (2+verOffset)*partWidth;
- for (y = (partHeight >> 2); y; y--)
- {
- for (x = partWidth; x; x--)
- {
- tmp4 = ptrV[-(i32)partWidth*2];
- tmp5 = ptrV[-(i32)partWidth];
- tmp1 = ptrV[partWidth];
- tmp2 = ptrV[partWidth*2];
- tmp6 = *ptrV++;
-
- tmp7 = tmp4 + tmp1;
- tmp2 -= (tmp7 << 2);
- tmp2 -= tmp7;
- tmp2 += 512;
- tmp7 = tmp5 + tmp6;
- tmp3 = ptrC[partWidth*2];
- tmp2 += (tmp7 << 4);
- tmp2 += (tmp7 << 2);
- tmp7 = ptrInt[partWidth*2];
- tmp2 += tmp3;
- tmp2 = clp[tmp2>>10];
- tmp7 += 16;
- tmp7 = clp[tmp7>>5];
- tmp1 += 512;
- tmp2++;
- mb[48] = (u8)((tmp7 + tmp2) >> 1);
-
- tmp7 = tmp3 + tmp6;
- tmp1 -= (tmp7 << 2);
- tmp1 -= tmp7;
- tmp7 = tmp4 + tmp5;
- tmp2 = ptrC[partWidth];
- tmp1 += (tmp7 << 4);
- tmp1 += (tmp7 << 2);
- tmp7 = ptrInt[partWidth];
- tmp1 += tmp2;
- tmp1 = clp[tmp1>>10];
- tmp7 += 16;
- tmp7 = clp[tmp7>>5];
- tmp6 += 512;
- tmp1++;
- mb[32] = (u8)((tmp7 + tmp1) >> 1);
-
- tmp1 = *ptrC;
- tmp7 = tmp2 + tmp5;
- tmp6 -= (tmp7 << 2);
- tmp6 -= tmp7;
- tmp7 = tmp4 + tmp3;
- tmp6 += (tmp7 << 4);
- tmp6 += (tmp7 << 2);
- tmp7 = *ptrInt;
- tmp6 += tmp1;
- tmp6 = clp[tmp6>>10];
- tmp7 += 16;
- tmp7 = clp[tmp7>>5];
- tmp5 += 512;
- tmp6++;
- mb[16] = (u8)((tmp7 + tmp6) >> 1);
-
- tmp6 = ptrC[-(i32)partWidth];
- tmp1 += tmp4;
- tmp5 -= (tmp1 << 2);
- tmp5 -= tmp1;
- tmp3 += tmp2;
- tmp5 += (tmp3 << 4);
- tmp5 += (tmp3 << 2);
- tmp7 = ptrInt[-(i32)partWidth];
- tmp5 += tmp6;
- tmp5 = clp[tmp5>>10];
- tmp7 += 16;
- tmp7 = clp[tmp7>>5];
- tmp5++;
- *mb++ = (u8)((tmp7 + tmp5) >> 1);
- ptrC++;
- ptrInt++;
- }
- mb += 4*16 - partWidth;
- ptrC += 3*partWidth;
- ptrV += 3*partWidth;
- ptrInt += 3*partWidth;
- }
-
-}
-
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdInterpolateMidHorQuarter
-
- Functional description:
- Function to perform horizontal and vertical interpolation of pixel
- position 'i' or 'k' for a block. Overfilling is done only if needed.
- Reference image (ref) is read at correct position and the predicted
- part is written to macroblock array (mb)
-
-------------------------------------------------------------------------------*/
-
-void h264bsdInterpolateMidHorQuarter(
- u8 *ref,
- u8 *mb,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 partWidth,
- u32 partHeight,
- u32 horOffset) /* 0 for pixel i, 1 for pixel k */
-{
- u32 p1[21*21/4+1];
- u32 x, y;
- i32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- i32 *ptrJ, *ptrInt, *h1;
- u8 *ptrC, *ptrV;
- i32 table[21*16];
- i32 tableWidth = (i32)partWidth+5;
- const u8 *clp = h264bsdClip + 512;
-
- /* Code */
-
- ASSERT(ref);
- ASSERT(mb);
-
- if ((x0 < 0) || ((u32)x0+partWidth+5 > width) ||
- (y0 < 0) || ((u32)y0+partHeight+5 > height))
- {
- h264bsdFillBlock(ref, (u8*)p1, x0, y0, width, height,
- partWidth+5, partHeight+5, partWidth+5);
-
- x0 = 0;
- y0 = 0;
- ref = (u8*)p1;
- width = partWidth+5;
- }
-
- ref += (u32)y0 * width + (u32)x0;
-
- h1 = table + tableWidth;
- ptrC = ref + width;
- ptrV = ptrC + 5*width;
-
- /* First step: calculate intermediate values for
- * vertical interpolation */
- for (y = (partHeight >> 2); y; y--)
- {
- for (x = (u32)tableWidth; x; x--)
- {
- tmp4 = ptrV[-(i32)width*2];
- tmp5 = ptrV[-(i32)width];
- tmp1 = ptrV[width];
- tmp2 = ptrV[width*2];
- tmp6 = *ptrV++;
-
- tmp7 = tmp4 + tmp1;
- tmp2 -= (tmp7 << 2);
- tmp2 -= tmp7;
- tmp7 = tmp5 + tmp6;
- tmp3 = ptrC[width*2];
- tmp2 += (tmp7 << 4);
- tmp2 += (tmp7 << 2);
- tmp2 += tmp3;
- h1[tableWidth*2] = tmp2;
-
- tmp7 = tmp3 + tmp6;
- tmp1 -= (tmp7 << 2);
- tmp1 -= tmp7;
- tmp7 = tmp4 + tmp5;
- tmp2 = ptrC[width];
- tmp1 += (tmp7 << 4);
- tmp1 += (tmp7 << 2);
- tmp1 += tmp2;
- h1[tableWidth] = tmp1;
-
- tmp1 = *ptrC;
- tmp7 = tmp2 + tmp5;
- tmp6 -= (tmp7 << 2);
- tmp6 -= tmp7;
- tmp7 = tmp4 + tmp3;
- tmp6 += (tmp7 << 4);
- tmp6 += (tmp7 << 2);
- tmp6 += tmp1;
- *h1 = tmp6;
-
- tmp6 = ptrC[-(i32)width];
- tmp1 += tmp4;
- tmp5 -= (tmp1 << 2);
- tmp5 -= tmp1;
- tmp3 += tmp2;
- tmp5 += (tmp3 << 4);
- tmp5 += (tmp3 << 2);
- tmp5 += tmp6;
- h1[-tableWidth] = tmp5;
- h1++;
- ptrC++;
- }
- ptrC += 4*width - partWidth - 5;
- ptrV += 4*width - partWidth - 5;
- h1 += 3*tableWidth;
- }
-
- /* Second step: calculate horizontal interpolation and average */
- ptrJ = table + 5;
- /* Pointer to integer sample position, either G or H */
- ptrInt = table + 2 + horOffset;
- for (y = partHeight; y; y--)
- {
- tmp6 = *(ptrJ - 5);
- tmp5 = *(ptrJ - 4);
- tmp4 = *(ptrJ - 3);
- tmp3 = *(ptrJ - 2);
- tmp2 = *(ptrJ - 1);
- for (x = (partWidth>>2); x; x--)
- {
- /* First pixel */
- tmp6 += 512;
- tmp7 = tmp3 + tmp4;
- tmp6 += (tmp7 << 4);
- tmp6 += (tmp7 << 2);
- tmp7 = tmp2 + tmp5;
- tmp1 = *ptrJ++;
- tmp6 -= (tmp7 << 2);
- tmp6 -= tmp7;
- tmp7 = *ptrInt++;
- tmp6 += tmp1;
- tmp6 = clp[tmp6 >> 10];
- tmp7 += 16;
- tmp7 = clp[tmp7 >> 5];
- tmp5 += 512;
- tmp6++;
- *mb++ = (u8)((tmp6 + tmp7) >> 1);
- /* Second pixel */
- tmp7 = tmp2 + tmp3;
- tmp5 += (tmp7 << 4);
- tmp5 += (tmp7 << 2);
- tmp7 = tmp1 + tmp4;
- tmp6 = *ptrJ++;
- tmp5 -= (tmp7 << 2);
- tmp5 -= tmp7;
- tmp7 = *ptrInt++;
- tmp5 += tmp6;
- tmp5 = clp[tmp5 >> 10];
- tmp7 += 16;
- tmp7 = clp[tmp7 >> 5];
- tmp4 += 512;
- tmp5++;
- *mb++ = (u8)((tmp5 + tmp7) >> 1);
- /* Third pixel */
- tmp7 = tmp1 + tmp2;
- tmp4 += (tmp7 << 4);
- tmp4 += (tmp7 << 2);
- tmp7 = tmp6 + tmp3;
- tmp5 = *ptrJ++;
- tmp4 -= (tmp7 << 2);
- tmp4 -= tmp7;
- tmp7 = *ptrInt++;
- tmp4 += tmp5;
- tmp4 = clp[tmp4 >> 10];
- tmp7 += 16;
- tmp7 = clp[tmp7 >> 5];
- tmp3 += 512;
- tmp4++;
- *mb++ = (u8)((tmp4 + tmp7) >> 1);
- /* Fourth pixel */
- tmp7 = tmp6 + tmp1;
- tmp3 += (tmp7 << 4);
- tmp3 += (tmp7 << 2);
- tmp7 = tmp5 + tmp2;
- tmp4 = *ptrJ++;
- tmp3 -= (tmp7 << 2);
- tmp3 -= tmp7;
- tmp7 = *ptrInt++;
- tmp3 += tmp4;
- tmp3 = clp[tmp3 >> 10];
- tmp7 += 16;
- tmp7 = clp[tmp7 >> 5];
- tmp3++;
- *mb++ = (u8)((tmp3 + tmp7) >> 1);
- tmp3 = tmp5;
- tmp5 = tmp1;
- tmp7 = tmp4;
- tmp4 = tmp6;
- tmp6 = tmp2;
- tmp2 = tmp7;
- }
- ptrJ += 5;
- ptrInt += 5;
- mb += 16 - partWidth;
- }
-
-}
-
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdPredictSamples
-
- Functional description:
- This function reconstructs a prediction for a macroblock partition.
- The prediction is either copied or interpolated using the reference
- frame and the motion vector. Both luminance and chrominance parts are
- predicted. The prediction is stored in given macroblock array (data).
- Inputs:
- data pointer to macroblock array (384 bytes) for output
- mv pointer to motion vector used for prediction
- refPic pointer to reference picture structure
- xA x-coordinate for current macroblock
- yA y-coordinate for current macroblock
- partX x-offset for partition in macroblock
- partY y-offset for partition in macroblock
- partWidth width of partition
- partHeight height of partition
- Outputs:
- data macroblock array (16x16+8x8+8x8) where predicted
- partition is stored at correct position
-
-------------------------------------------------------------------------------*/
-
-void h264bsdPredictSamples(
- u8 *data,
- mv_t *mv,
- image_t *refPic,
- u32 xA,
- u32 yA,
- u32 partX,
- u32 partY,
- u32 partWidth,
- u32 partHeight)
-
-{
-
-/* Variables */
-
- u32 xFrac, yFrac, width, height;
- i32 xInt, yInt;
- u8 *lumaPartData;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(mv);
- ASSERT(partWidth);
- ASSERT(partHeight);
- ASSERT(refPic);
- ASSERT(refPic->data);
- ASSERT(refPic->width);
- ASSERT(refPic->height);
-
- /* luma */
- lumaPartData = data + 16*partY + partX;
-
- xFrac = mv->hor & 0x3;
- yFrac = mv->ver & 0x3;
-
- width = 16 * refPic->width;
- height = 16 * refPic->height;
-
- xInt = (i32)xA + (i32)partX + (mv->hor >> 2);
- yInt = (i32)yA + (i32)partY + (mv->ver >> 2);
-
- ASSERT(lumaFracPos[xFrac][yFrac] < 16);
-
- switch (lumaFracPos[xFrac][yFrac])
- {
- case 0: /* G */
- h264bsdFillBlock(refPic->data, lumaPartData,
- xInt,yInt,width,height,partWidth,partHeight,16);
- break;
- case 1: /* d */
- h264bsdInterpolateVerQuarter(refPic->data, lumaPartData,
- xInt, yInt-2, width, height, partWidth, partHeight, 0);
- break;
- case 2: /* h */
- h264bsdInterpolateVerHalf(refPic->data, lumaPartData,
- xInt, yInt-2, width, height, partWidth, partHeight);
- break;
- case 3: /* n */
- h264bsdInterpolateVerQuarter(refPic->data, lumaPartData,
- xInt, yInt-2, width, height, partWidth, partHeight, 1);
- break;
- case 4: /* a */
- h264bsdInterpolateHorQuarter(refPic->data, lumaPartData,
- xInt-2, yInt, width, height, partWidth, partHeight, 0);
- break;
- case 5: /* e */
- h264bsdInterpolateHorVerQuarter(refPic->data, lumaPartData,
- xInt-2, yInt-2, width, height, partWidth, partHeight, 0);
- break;
- case 6: /* i */
- h264bsdInterpolateMidHorQuarter(refPic->data, lumaPartData,
- xInt-2, yInt-2, width, height, partWidth, partHeight, 0);
- break;
- case 7: /* p */
- h264bsdInterpolateHorVerQuarter(refPic->data, lumaPartData,
- xInt-2, yInt-2, width, height, partWidth, partHeight, 2);
- break;
- case 8: /* b */
- h264bsdInterpolateHorHalf(refPic->data, lumaPartData,
- xInt-2, yInt, width, height, partWidth, partHeight);
- break;
- case 9: /* f */
- h264bsdInterpolateMidVerQuarter(refPic->data, lumaPartData,
- xInt-2, yInt-2, width, height, partWidth, partHeight, 0);
- break;
- case 10: /* j */
- h264bsdInterpolateMidHalf(refPic->data, lumaPartData,
- xInt-2, yInt-2, width, height, partWidth, partHeight);
- break;
- case 11: /* q */
- h264bsdInterpolateMidVerQuarter(refPic->data, lumaPartData,
- xInt-2, yInt-2, width, height, partWidth, partHeight, 1);
- break;
- case 12: /* c */
- h264bsdInterpolateHorQuarter(refPic->data, lumaPartData,
- xInt-2, yInt, width, height, partWidth, partHeight, 1);
- break;
- case 13: /* g */
- h264bsdInterpolateHorVerQuarter(refPic->data, lumaPartData,
- xInt-2, yInt-2, width, height, partWidth, partHeight, 1);
- break;
- case 14: /* k */
- h264bsdInterpolateMidHorQuarter(refPic->data, lumaPartData,
- xInt-2, yInt-2, width, height, partWidth, partHeight, 1);
- break;
- default: /* case 15, r */
- h264bsdInterpolateHorVerQuarter(refPic->data, lumaPartData,
- xInt-2, yInt-2, width, height, partWidth, partHeight, 3);
- break;
- }
-
- /* chroma */
- PredictChroma(
- data + 16*16 + (partY>>1)*8 + (partX>>1),
- xA + partX,
- yA + partY,
- partWidth,
- partHeight,
- mv,
- refPic);
-
-}
-
-#else /* H264DEC_OMXDL */
-/*------------------------------------------------------------------------------
-
- Function: h264bsdPredictSamples
-
- Functional description:
- This function reconstructs a prediction for a macroblock partition.
- The prediction is either copied or interpolated using the reference
- frame and the motion vector. Both luminance and chrominance parts are
- predicted. The prediction is stored in given macroblock array (data).
- Inputs:
- data pointer to macroblock array (384 bytes) for output
- mv pointer to motion vector used for prediction
- refPic pointer to reference picture structure
- xA x-coordinate for current macroblock
- yA y-coordinate for current macroblock
- partX x-offset for partition in macroblock
- partY y-offset for partition in macroblock
- partWidth width of partition
- partHeight height of partition
- Outputs:
- data macroblock array (16x16+8x8+8x8) where predicted
- partition is stored at correct position
-
-------------------------------------------------------------------------------*/
-
-/*lint -e{550} Symbol 'res' not accessed */
-void h264bsdPredictSamples(
- u8 *data,
- mv_t *mv,
- image_t *refPic,
- u32 colAndRow,
- u32 part,
- u8 *pFill)
-
-{
-
-/* Variables */
-
- u32 xFrac, yFrac;
- u32 width, height;
- i32 xInt, yInt, x0, y0;
- u8 *partData, *ref;
- OMXSize roi;
- u32 fillWidth;
- u32 fillHeight;
- OMXResult res;
- u32 xA, yA;
- u32 partX, partY;
- u32 partWidth, partHeight;
-
-/* Code */
-
- ASSERT(data);
- ASSERT(mv);
- ASSERT(refPic);
- ASSERT(refPic->data);
- ASSERT(refPic->width);
- ASSERT(refPic->height);
-
- xA = (colAndRow & 0xFFFF0000) >> 16;
- yA = (colAndRow & 0x0000FFFF);
-
- partX = (part & 0xFF000000) >> 24;
- partY = (part & 0x00FF0000) >> 16;
- partWidth = (part & 0x0000FF00) >> 8;
- partHeight = (part & 0x000000FF);
-
- ASSERT(partWidth);
- ASSERT(partHeight);
-
- /* luma */
- partData = data + 16*partY + partX;
-
- xFrac = mv->hor & 0x3;
- yFrac = mv->ver & 0x3;
-
- width = 16 * refPic->width;
- height = 16 * refPic->height;
-
- xInt = (i32)xA + (i32)partX + (mv->hor >> 2);
- yInt = (i32)yA + (i32)partY + (mv->ver >> 2);
-
- x0 = (xFrac) ? xInt-2 : xInt;
- y0 = (yFrac) ? yInt-2 : yInt;
-
- if (xFrac)
- {
- if (partWidth == 16)
- fillWidth = 32;
- else
- fillWidth = 16;
- }
- else
- fillWidth = (partWidth*2);
- if (yFrac)
- fillHeight = partHeight+5;
- else
- fillHeight = partHeight;
-
-
- if ((x0 < 0) || ((u32)x0+fillWidth > width) ||
- (y0 < 0) || ((u32)y0+fillHeight > height))
- {
- h264bsdFillBlock(refPic->data, (u8*)pFill, x0, y0, width, height,
- fillWidth, fillHeight, fillWidth);
-
- x0 = 0;
- y0 = 0;
- ref = pFill;
- width = fillWidth;
- if (yFrac)
- ref += 2*width;
- if (xFrac)
- ref += 2;
- }
- else
- {
- /*lint --e(737) Loss of sign */
- ref = refPic->data + yInt*width + xInt;
- }
- /* Luma interpolation */
- roi.width = (i32)partWidth;
- roi.height = (i32)partHeight;
-
- res = omxVCM4P10_InterpolateLuma(ref, (i32)width, partData, 16,
- (i32)xFrac, (i32)yFrac, roi);
- ASSERT(res == 0);
-
- /* Chroma */
- width = 8 * refPic->width;
- height = 8 * refPic->height;
-
- x0 = ((xA + partX) >> 1) + (mv->hor >> 3);
- y0 = ((yA + partY) >> 1) + (mv->ver >> 3);
- xFrac = mv->hor & 0x7;
- yFrac = mv->ver & 0x7;
-
- ref = refPic->data + 256 * refPic->width * refPic->height;
-
- roi.width = (i32)(partWidth >> 1);
- fillWidth = ((partWidth >> 1) + 8) & ~0x7;
- roi.height = (i32)(partHeight >> 1);
- fillHeight = (partHeight >> 1) + 1;
-
- if ((x0 < 0) || ((u32)x0+fillWidth > width) ||
- (y0 < 0) || ((u32)y0+fillHeight > height))
- {
- h264bsdFillBlock(ref, pFill, x0, y0, width, height,
- fillWidth, fillHeight, fillWidth);
- ref += width * height;
- h264bsdFillBlock(ref, pFill + fillWidth*fillHeight,
- x0, y0, width, height, fillWidth,
- fillHeight, fillWidth);
-
- ref = pFill;
- x0 = 0;
- y0 = 0;
- width = fillWidth;
- height = fillHeight;
- }
-
- partData = data + 16*16 + (partY>>1)*8 + (partX>>1);
-
- /* Chroma interpolation */
- /*lint --e(737) Loss of sign */
- ref += y0 * width + x0;
- res = armVCM4P10_Interpolate_Chroma(ref, width, partData, 8,
- (u32)roi.width, (u32)roi.height, xFrac, yFrac);
- ASSERT(res == 0);
- partData += 8 * 8;
- ref += height * width;
- res = armVCM4P10_Interpolate_Chroma(ref, width, partData, 8,
- (u32)roi.width, (u32)roi.height, xFrac, yFrac);
- ASSERT(res == 0);
-
-}
-
-#endif /* H264DEC_OMXDL */
-
-
-/*------------------------------------------------------------------------------
-
- Function: FillRow1
-
- Functional description:
- This function gets a row of reference pels in a 'normal' case when no
- overfilling is necessary.
-
-------------------------------------------------------------------------------*/
-
-static void FillRow1(
- u8 *ref,
- u8 *fill,
- i32 left,
- i32 center,
- i32 right)
-{
- UNUSED(left);
- UNUSED(right);
- ASSERT(ref);
- ASSERT(fill);
-
- H264SwDecMemcpy(fill, ref, (u32)center);
-
- /*lint -e(715) */
-}
-
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdFillRow7
-
- Functional description:
- This function gets a row of reference pels when horizontal coordinate
- is partly negative or partly greater than reference picture width
- (overfilling some pels on left and/or right edge).
- Inputs:
- ref pointer to reference samples
- left amount of pixels to overfill on left-edge
- center amount of pixels to copy
- right amount of pixels to overfill on right-edge
- Outputs:
- fill pointer where samples are stored
-
-------------------------------------------------------------------------------*/
-#ifndef H264DEC_NEON
-void h264bsdFillRow7(
- u8 *ref,
- u8 *fill,
- i32 left,
- i32 center,
- i32 right)
-{
- u8 tmp;
-
- ASSERT(ref);
- ASSERT(fill);
-
- if (left)
- tmp = *ref;
-
- for ( ; left; left--)
- /*lint -esym(644,tmp) tmp is initialized if used */
- *fill++ = tmp;
-
- for ( ; center; center--)
- *fill++ = *ref++;
-
- if (right)
- tmp = ref[-1];
-
- for ( ; right; right--)
- /*lint -esym(644,tmp) tmp is initialized if used */
- *fill++ = tmp;
-}
-#endif
-/*------------------------------------------------------------------------------
-
- Function: h264bsdFillBlock
-
- Functional description:
- This function gets a block of reference pels. It determines whether
- overfilling is needed or not and repeatedly calls an appropriate
- function (by using a function pointer) that fills one row the block.
- Inputs:
- ref pointer to reference frame
- x0 x-coordinate for block
- y0 y-coordinate for block
- width width of reference frame
- height height of reference frame
- blockWidth width of block
- blockHeight height of block
- fillScanLength length of a line in output array (pixels)
- Outputs:
- fill pointer to array where output block is written
-
-------------------------------------------------------------------------------*/
-
-void h264bsdFillBlock(
- u8 *ref,
- u8 *fill,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 blockWidth,
- u32 blockHeight,
- u32 fillScanLength)
-
-{
-
-/* Variables */
-
- i32 xstop, ystop;
- void (*fp)(u8*, u8*, i32, i32, i32);
- i32 left, x, right;
- i32 top, y, bottom;
-
-/* Code */
-
- ASSERT(ref);
- ASSERT(fill);
- ASSERT(width);
- ASSERT(height);
- ASSERT(fill);
- ASSERT(blockWidth);
- ASSERT(blockHeight);
-
- xstop = x0 + (i32)blockWidth;
- ystop = y0 + (i32)blockHeight;
-
- /* Choose correct function whether overfilling on left-edge or right-edge
- * is needed or not */
- if (x0 >= 0 && xstop <= (i32)width)
- fp = FillRow1;
- else
- fp = h264bsdFillRow7;
-
- if (ystop < 0)
- y0 = -(i32)blockHeight;
-
- if (xstop < 0)
- x0 = -(i32)blockWidth;
-
- if (y0 > (i32)height)
- y0 = (i32)height;
-
- if (x0 > (i32)width)
- x0 = (i32)width;
-
- xstop = x0 + (i32)blockWidth;
- ystop = y0 + (i32)blockHeight;
-
- if (x0 > 0)
- ref += x0;
-
- if (y0 > 0)
- ref += y0 * (i32)width;
-
- left = x0 < 0 ? -x0 : 0;
- right = xstop > (i32)width ? xstop - (i32)width : 0;
- x = (i32)blockWidth - left - right;
-
- top = y0 < 0 ? -y0 : 0;
- bottom = ystop > (i32)height ? ystop - (i32)height : 0;
- y = (i32)blockHeight - top - bottom;
-
- /* Top-overfilling */
- for ( ; top; top-- )
- {
- (*fp)(ref, fill, left, x, right);
- fill += fillScanLength;
- }
-
- /* Lines inside reference image */
- for ( ; y; y-- )
- {
- (*fp)(ref, fill, left, x, right);
- ref += width;
- fill += fillScanLength;
- }
-
- ref -= width;
-
- /* Bottom-overfilling */
- for ( ; bottom; bottom-- )
- {
- (*fp)(ref, fill, left, x, right);
- fill += fillScanLength;
- }
-}
-
-/*lint +e701 +e702 */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_reconstruct.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_reconstruct.h
deleted file mode 100644
index 5a1a140..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_reconstruct.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_RECONSTRUCT_H
-#define H264SWDEC_RECONSTRUCT_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_macroblock_layer.h"
-#include "h264bsd_image.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-#ifndef H264DEC_OMXDL
-void h264bsdPredictSamples(
- u8 *data,
- mv_t *mv,
- image_t *refPic,
- u32 xA,
- u32 yA,
- u32 partX,
- u32 partY,
- u32 partWidth,
- u32 partHeight);
-#else
-void h264bsdPredictSamples(
- u8 *data,
- mv_t *mv,
- image_t *refPic,
- u32 colAndRow,/* packaged data | column | row |*/
- u32 part, /* packaged data |partX|partY|partWidth|partHeight|*/
- u8 *pFill);
-#endif
-
-void h264bsdFillBlock(
- u8 * ref,
- u8 * fill,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 blockWidth,
- u32 blockHeight,
- u32 fillScanLength);
-
-void h264bsdInterpolateChromaHor(
- u8 *pRef,
- u8 *predPartChroma,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 xFrac,
- u32 chromaPartWidth,
- u32 chromaPartHeight);
-
-void h264bsdInterpolateChromaVer(
- u8 *pRef,
- u8 *predPartChroma,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 yFrac,
- u32 chromaPartWidth,
- u32 chromaPartHeight);
-
-void h264bsdInterpolateChromaHorVer(
- u8 *ref,
- u8 *predPartChroma,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 xFrac,
- u32 yFrac,
- u32 chromaPartWidth,
- u32 chromaPartHeight);
-
-void h264bsdInterpolateVerHalf(
- u8 *ref,
- u8 *mb,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 partWidth,
- u32 partHeight);
-
-void h264bsdInterpolateVerQuarter(
- u8 *ref,
- u8 *mb,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 partWidth,
- u32 partHeight,
- u32 verOffset);
-
-void h264bsdInterpolateHorHalf(
- u8 *ref,
- u8 *mb,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 partWidth,
- u32 partHeight);
-
-void h264bsdInterpolateHorQuarter(
- u8 *ref,
- u8 *mb,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 partWidth,
- u32 partHeight,
- u32 horOffset);
-
-void h264bsdInterpolateHorVerQuarter(
- u8 *ref,
- u8 *mb,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 partWidth,
- u32 partHeight,
- u32 horVerOffset);
-
-void h264bsdInterpolateMidHalf(
- u8 *ref,
- u8 *mb,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 partWidth,
- u32 partHeight);
-
-void h264bsdInterpolateMidVerQuarter(
- u8 *ref,
- u8 *mb,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 partWidth,
- u32 partHeight,
- u32 verOffset);
-
-void h264bsdInterpolateMidHorQuarter(
- u8 *ref,
- u8 *mb,
- i32 x0,
- i32 y0,
- u32 width,
- u32 height,
- u32 partWidth,
- u32 partHeight,
- u32 horOffset);
-
-
-void h264bsdFillRow7(
- u8 *ref,
- u8 *fill,
- i32 left,
- i32 center,
- i32 right);
-
-#endif /* #ifdef H264SWDEC_RECONSTRUCT_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_sei.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_sei.c
deleted file mode 100644
index 0756c47..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_sei.c
+++ /dev/null
@@ -1,1692 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdDecodeSeiMessage
- DecodeBufferingPeriod
- DecodePictureTiming
- DecodePanScanRectangle
- DecodeFillerPayload
- DecodeUserDataRegisteredITuTT35
- DecodeUserDataUnregistered
- DecodeRecoveryPoint
- DecodeDecRefPicMarkingRepetition
- DecodeSparePic
- DecodeSceneInfo
- DecodeSubSeqInfo
- DecodeSubSeqLayerCharacteristics
- DecodeSubSeqCharacteristics
- DecodeFullFrameFreeze
- DecodeFullFrameSnapshot
- DecodeProgressiveRefinementSegmentStart
- DecodeProgressiveRefinementSegmentEnd
- DecodeMotionConstrainedSliceGroupSet
- DecodeReservedSeiMessage
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_sei.h"
-#include "basetype.h"
-#include "h264bsd_util.h"
-#include "h264bsd_stream.h"
-#include "h264bsd_vlc.h"
-#include "h264bsd_seq_param_set.h"
-#include "h264bsd_slice_header.h"
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-static const u32 numClockTS[9] = {1,1,1,2,2,3,3,2,3};
-static const u32 ceilLog2NumSliceGroups[9] = {0,1,1,2,2,3,3,3,3};
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-static u32 DecodeBufferingPeriod(
- strmData_t *pStrmData,
- seiBufferingPeriod_t *pBufferingPeriod,
- u32 cpbCnt,
- u32 initialCpbRemovalDelayLength,
- u32 nalHrdBpPresentFlag,
- u32 vclHrdBpPresentFlag);
-
-static u32 DecodePictureTiming(
- strmData_t *pStrmData,
- seiPicTiming_t *pPicTiming,
- u32 cpbRemovalDelayLength,
- u32 dpbOutputDelayLength,
- u32 timeOffsetLength,
- u32 cpbDpbDelaysPresentFlag,
- u32 picStructPresentFlag);
-
-static u32 DecodePanScanRectangle(
- strmData_t *pStrmData,
- seiPanScanRect_t *pPanScanRectangle);
-
-static u32 DecodeFillerPayload(strmData_t *pStrmData, u32 payloadSize);
-
-static u32 DecodeUserDataRegisteredITuTT35(
- strmData_t *pStrmData,
- seiUserDataRegisteredItuTT35_t *pUserDataRegisteredItuTT35,
- u32 payloadSize);
-
-static u32 DecodeUserDataUnregistered(
- strmData_t *pStrmData,
- seiUserDataUnregistered_t *pUserDataUnregistered,
- u32 payloadSize);
-
-static u32 DecodeRecoveryPoint(
- strmData_t *pStrmData,
- seiRecoveryPoint_t *pRecoveryPoint);
-
-static u32 DecodeDecRefPicMarkingRepetition(
- strmData_t *pStrmData,
- seiDecRefPicMarkingRepetition_t *pDecRefPicMarkingRepetition,
- u32 numRefFrames);
-
-static u32 DecodeSparePic(
- strmData_t *pStrmData,
- seiSparePic_t *pSparePic,
- u32 picSizeInMapUnits);
-
-static u32 DecodeSceneInfo(
- strmData_t *pStrmData,
- seiSceneInfo_t *pSceneInfo);
-
-static u32 DecodeSubSeqInfo(
- strmData_t *pStrmData,
- seiSubSeqInfo_t *pSubSeqInfo);
-
-static u32 DecodeSubSeqLayerCharacteristics(
- strmData_t *pStrmData,
- seiSubSeqLayerCharacteristics_t *pSubSeqLayerCharacteristics);
-
-static u32 DecodeSubSeqCharacteristics(
- strmData_t *pStrmData,
- seiSubSeqCharacteristics_t *pSubSeqCharacteristics);
-
-static u32 DecodeFullFrameFreeze(
- strmData_t *pStrmData,
- seiFullFrameFreeze_t *pFullFrameFreeze);
-
-static u32 DecodeFullFrameSnapshot(
- strmData_t *pStrmData,
- seiFullFrameSnapshot_t *pFullFrameSnapshot);
-
-static u32 DecodeProgressiveRefinementSegmentStart(
- strmData_t *pStrmData,
- seiProgressiveRefinementSegmentStart_t *pProgressiveRefinementSegmentStart);
-
-static u32 DecodeProgressiveRefinementSegmentEnd(
- strmData_t *pStrmData,
- seiProgressiveRefinementSegmentEnd_t *pProgressiveRefinementSegmentEnd);
-
-static u32 DecodeMotionConstrainedSliceGroupSet(
- strmData_t *pStrmData,
- seiMotionConstrainedSliceGroupSet_t *pMotionConstrainedSliceGroupSet,
- u32 numSliceGroups);
-
-static u32 DecodeReservedSeiMessage(
- strmData_t *pStrmData,
- seiReservedSeiMessage_t *pReservedSeiMessage,
- u32 payloadSize);
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdDecodeSeiMessage
-
- Functional description:
- <++>
- Inputs:
- <++>
- Outputs:
- <++>
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeSeiMessage(
- strmData_t *pStrmData,
- seqParamSet_t *pSeqParamSet,
- seiMessage_t *pSeiMessage,
- u32 numSliceGroups)
-{
-
-/* Variables */
-
- u32 tmp, payloadType, payloadSize, status;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pSeiMessage);
-
-
- H264SwDecMemset(pSeiMessage, 0, sizeof(seiMessage_t));
-
- do
- {
- payloadType = 0;
- while((tmp = h264bsdGetBits(pStrmData, 8)) == 0xFF)
- {
- payloadType += 255;
- }
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- payloadType += tmp;
-
- payloadSize = 0;
- while((tmp = h264bsdGetBits(pStrmData, 8)) == 0xFF)
- {
- payloadSize += 255;
- }
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- payloadSize += tmp;
-
- pSeiMessage->payloadType = payloadType;
-
- switch (payloadType)
- {
- case 0:
- ASSERT(pSeqParamSet);
- status = DecodeBufferingPeriod(
- pStrmData,
- &pSeiMessage->bufferingPeriod,
- pSeqParamSet->vuiParameters->vclHrdParameters.cpbCnt,
- pSeqParamSet->vuiParameters->vclHrdParameters.
- initialCpbRemovalDelayLength,
- pSeqParamSet->vuiParameters->nalHrdParametersPresentFlag,
- pSeqParamSet->vuiParameters->vclHrdParametersPresentFlag);
- break;
-
- case 1:
- ASSERT(pSeqParamSet->vuiParametersPresentFlag);
- status = DecodePictureTiming(
- pStrmData,
- &pSeiMessage->picTiming,
- pSeqParamSet->vuiParameters->vclHrdParameters.
- cpbRemovalDelayLength,
- pSeqParamSet->vuiParameters->vclHrdParameters.
- dpbOutputDelayLength,
- pSeqParamSet->vuiParameters->vclHrdParameters.
- timeOffsetLength,
- pSeqParamSet->vuiParameters->nalHrdParametersPresentFlag ||
- pSeqParamSet->vuiParameters->vclHrdParametersPresentFlag ?
- HANTRO_TRUE : HANTRO_FALSE,
- pSeqParamSet->vuiParameters->picStructPresentFlag);
- break;
-
- case 2:
- status = DecodePanScanRectangle(
- pStrmData,
- &pSeiMessage->panScanRect);
- break;
-
- case 3:
- status = DecodeFillerPayload(pStrmData, payloadSize);
- break;
-
- case 4:
- status = DecodeUserDataRegisteredITuTT35(
- pStrmData,
- &pSeiMessage->userDataRegisteredItuTT35,
- payloadSize);
- break;
-
- case 5:
- status = DecodeUserDataUnregistered(
- pStrmData,
- &pSeiMessage->userDataUnregistered,
- payloadSize);
- break;
-
- case 6:
- status = DecodeRecoveryPoint(
- pStrmData,
- &pSeiMessage->recoveryPoint);
- break;
-
- case 7:
- status = DecodeDecRefPicMarkingRepetition(
- pStrmData,
- &pSeiMessage->decRefPicMarkingRepetition,
- pSeqParamSet->numRefFrames);
- break;
-
- case 8:
- ASSERT(pSeqParamSet);
- status = DecodeSparePic(
- pStrmData,
- &pSeiMessage->sparePic,
- pSeqParamSet->picWidthInMbs * pSeqParamSet->picHeightInMbs);
- break;
-
- case 9:
- status = DecodeSceneInfo(
- pStrmData,
- &pSeiMessage->sceneInfo);
- break;
-
- case 10:
- status = DecodeSubSeqInfo(
- pStrmData,
- &pSeiMessage->subSeqInfo);
- break;
-
- case 11:
- status = DecodeSubSeqLayerCharacteristics(
- pStrmData,
- &pSeiMessage->subSeqLayerCharacteristics);
- break;
-
- case 12:
- status = DecodeSubSeqCharacteristics(
- pStrmData,
- &pSeiMessage->subSeqCharacteristics);
- break;
-
- case 13:
- status = DecodeFullFrameFreeze(
- pStrmData,
- &pSeiMessage->fullFrameFreeze);
- break;
-
- case 14: /* This SEI does not contain data, what to do ??? */
- status = HANTRO_OK;
- break;
-
- case 15:
- status = DecodeFullFrameSnapshot(
- pStrmData,
- &pSeiMessage->fullFrameSnapshot);
- break;
-
- case 16:
- status = DecodeProgressiveRefinementSegmentStart(
- pStrmData,
- &pSeiMessage->progressiveRefinementSegmentStart);
- break;
-
- case 17:
- status = DecodeProgressiveRefinementSegmentEnd(
- pStrmData,
- &pSeiMessage->progressiveRefinementSegmentEnd);
- break;
-
- case 18:
- ASSERT(numSliceGroups);
- status = DecodeMotionConstrainedSliceGroupSet(
- pStrmData,
- &pSeiMessage->motionConstrainedSliceGroupSet,
- numSliceGroups);
- break;
-
- default:
- status = DecodeReservedSeiMessage(
- pStrmData,
- &pSeiMessage->reservedSeiMessage,
- payloadSize);
- break;
- }
-
- if (status != HANTRO_OK)
- return(status);
-
- while (!h264bsdIsByteAligned(pStrmData))
- {
- if (h264bsdGetBits(pStrmData, 1) != 1)
- return(HANTRO_NOK);
- while (!h264bsdIsByteAligned(pStrmData))
- {
- if (h264bsdGetBits(pStrmData, 1) != 0)
- return(HANTRO_NOK);
- }
- }
- } while (h264bsdMoreRbspData(pStrmData));
-
- return(h264bsdRbspTrailingBits(pStrmData));
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeBufferingPeriod
-
- Functional description:
- <++>
- Inputs:
- <++>
- Outputs:
- <++>
-
-------------------------------------------------------------------------------*/
-
-static u32 DecodeBufferingPeriod(
- strmData_t *pStrmData,
- seiBufferingPeriod_t *pBufferingPeriod,
- u32 cpbCnt,
- u32 initialCpbRemovalDelayLength,
- u32 nalHrdBpPresentFlag,
- u32 vclHrdBpPresentFlag)
-{
-
-/* Variables */
-
- u32 tmp, i;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pBufferingPeriod);
- ASSERT(cpbCnt);
- ASSERT(initialCpbRemovalDelayLength);
-
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pBufferingPeriod->seqParameterSetId);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pBufferingPeriod->seqParameterSetId > 31)
- return(HANTRO_NOK);
-
- if (nalHrdBpPresentFlag)
- {
- for (i = 0; i < cpbCnt; i++)
- {
- tmp = h264bsdGetBits(pStrmData, initialCpbRemovalDelayLength);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- if (tmp == 0)
- return(HANTRO_NOK);
- pBufferingPeriod->initialCpbRemovalDelay[i] = tmp;
-
- tmp = h264bsdGetBits(pStrmData, initialCpbRemovalDelayLength);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pBufferingPeriod->initialCpbRemovalDelayOffset[i] = tmp;
- }
- }
-
- if (vclHrdBpPresentFlag)
- {
- for (i = 0; i < cpbCnt; i++)
- {
- tmp = h264bsdGetBits(pStrmData, initialCpbRemovalDelayLength);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pBufferingPeriod->initialCpbRemovalDelay[i] = tmp;
-
- tmp = h264bsdGetBits(pStrmData, initialCpbRemovalDelayLength);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pBufferingPeriod->initialCpbRemovalDelayOffset[i] = tmp;
- }
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodePictureTiming
-
- Functional description:
- <++>
- Inputs:
- <++>
- Outputs:
- <++>
-
-------------------------------------------------------------------------------*/
-
-static u32 DecodePictureTiming(
- strmData_t *pStrmData,
- seiPicTiming_t *pPicTiming,
- u32 cpbRemovalDelayLength,
- u32 dpbOutputDelayLength,
- u32 timeOffsetLength,
- u32 cpbDpbDelaysPresentFlag,
- u32 picStructPresentFlag)
-{
-
-/* Variables */
-
- u32 tmp, i;
- i32 itmp;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pPicTiming);
-
-
- if (cpbDpbDelaysPresentFlag)
- {
- tmp = h264bsdGetBits(pStrmData, cpbRemovalDelayLength);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pPicTiming->cpbRemovalDelay = tmp;
-
- tmp = h264bsdGetBits(pStrmData, dpbOutputDelayLength);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pPicTiming->dpbOutputDelay = tmp;
- }
-
- if (picStructPresentFlag)
- {
- tmp = h264bsdGetBits(pStrmData, 4);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- if (tmp > 8)
- return(HANTRO_NOK);
- pPicTiming->picStruct = tmp;
-
- for (i = 0; i < numClockTS[pPicTiming->picStruct]; i++)
- {
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pPicTiming->clockTimeStampFlag[i] = tmp == 1 ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- if (pPicTiming->clockTimeStampFlag[i])
- {
- tmp = h264bsdGetBits(pStrmData, 2);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pPicTiming->ctType[i] = tmp;
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pPicTiming->nuitFieldBasedFlag[i] = tmp == 1 ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdGetBits(pStrmData, 5);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- if (tmp > 6)
- return(HANTRO_NOK);
- pPicTiming->countingType[i] = tmp;
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pPicTiming->fullTimeStampFlag[i] = tmp == 1 ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pPicTiming->discontinuityFlag[i] = tmp == 1 ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pPicTiming->cntDroppedFlag[i] = tmp == 1 ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdGetBits(pStrmData, 8);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pPicTiming->nFrames[i] = tmp;
-
- if (pPicTiming->fullTimeStampFlag[i])
- {
- tmp = h264bsdGetBits(pStrmData, 6);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- if (tmp > 59)
- return(HANTRO_NOK);
- pPicTiming->secondsValue[i] = tmp;
-
- tmp = h264bsdGetBits(pStrmData, 6);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- if (tmp > 59)
- return(HANTRO_NOK);
- pPicTiming->minutesValue[i] = tmp;
-
- tmp = h264bsdGetBits(pStrmData, 5);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- if (tmp > 23)
- return(HANTRO_NOK);
- pPicTiming->hoursValue[i] = tmp;
- }
- else
- {
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pPicTiming->secondsFlag[i] = tmp == 1 ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- if (pPicTiming->secondsFlag[i])
- {
- tmp = h264bsdGetBits(pStrmData, 6);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- if (tmp > 59)
- return(HANTRO_NOK);
- pPicTiming->secondsValue[i] = tmp;
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pPicTiming->minutesFlag[i] = tmp == 1 ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- if (pPicTiming->minutesFlag[i])
- {
- tmp = h264bsdGetBits(pStrmData, 6);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- if (tmp > 59)
- return(HANTRO_NOK);
- pPicTiming->minutesValue[i] = tmp;
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pPicTiming->hoursFlag[i] = tmp == 1 ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- if (pPicTiming->hoursFlag[i])
- {
- tmp = h264bsdGetBits(pStrmData, 5);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- if (tmp > 23)
- return(HANTRO_NOK);
- pPicTiming->hoursValue[i] = tmp;
- }
- }
- }
- }
- if (timeOffsetLength)
- {
- tmp = h264bsdGetBits(pStrmData, timeOffsetLength);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- itmp = (i32)tmp;
- /* following "converts" timeOffsetLength-bit signed
- * integer into i32 */
- /*lint -save -e701 -e702 */
- itmp <<= (32 - timeOffsetLength);
- itmp >>= (32 - timeOffsetLength);
- /*lint -restore */
- pPicTiming->timeOffset[i] = itmp;
- }
- else
- pPicTiming->timeOffset[i] = 0;
- }
- }
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodePanScanRectangle
-
- Functional description:
- <++>
- Inputs:
- <++>
- Outputs:
- <++>
-
-------------------------------------------------------------------------------*/
-
-static u32 DecodePanScanRectangle(
- strmData_t *pStrmData,
- seiPanScanRect_t *pPanScanRectangle)
-{
-
-/* Variables */
-
- u32 tmp, i;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pPanScanRectangle);
-
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pPanScanRectangle->panScanRectId);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pPanScanRectangle->panScanRectCancelFlag = tmp == 1 ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- if (!pPanScanRectangle->panScanRectCancelFlag)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pPanScanRectangle->panScanCnt);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pPanScanRectangle->panScanCnt > 2)
- return(HANTRO_NOK);
- pPanScanRectangle->panScanCnt++;
-
- for (i = 0; i < pPanScanRectangle->panScanCnt; i++)
- {
- tmp = h264bsdDecodeExpGolombSigned(pStrmData,
- &pPanScanRectangle->panScanRectLeftOffset[i]);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- tmp = h264bsdDecodeExpGolombSigned(pStrmData,
- &pPanScanRectangle->panScanRectRightOffset[i]);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- tmp = h264bsdDecodeExpGolombSigned(pStrmData,
- &pPanScanRectangle->panScanRectTopOffset[i]);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- tmp = h264bsdDecodeExpGolombSigned(pStrmData,
- &pPanScanRectangle->panScanRectBottomOffset[i]);
- if (tmp != HANTRO_OK)
- return(tmp);
- }
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pPanScanRectangle->panScanRectRepetitionPeriod);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pPanScanRectangle->panScanRectRepetitionPeriod > 16384)
- return(HANTRO_NOK);
- if (pPanScanRectangle->panScanCnt > 1 &&
- pPanScanRectangle->panScanRectRepetitionPeriod > 1)
- return(HANTRO_NOK);
- }
-
- return(HANTRO_OK);
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeFillerPayload
-
- Functional description:
- <++>
- Inputs:
- <++>
- Outputs:
- <++>
-
-------------------------------------------------------------------------------*/
-
-static u32 DecodeFillerPayload(strmData_t *pStrmData, u32 payloadSize)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(pStrmData);
-
-
- if (payloadSize)
- if (h264bsdFlushBits(pStrmData, 8 * payloadSize) == END_OF_STREAM)
- return(HANTRO_NOK);
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeUserDataRegisteredITuTT35
-
- Functional description:
- <++>
- Inputs:
- <++>
- Outputs:
- <++>
-
-------------------------------------------------------------------------------*/
-
-static u32 DecodeUserDataRegisteredITuTT35(
- strmData_t *pStrmData,
- seiUserDataRegisteredItuTT35_t *pUserDataRegisteredItuTT35,
- u32 payloadSize)
-{
-
-/* Variables */
-
- u32 tmp, i, j;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pUserDataRegisteredItuTT35);
- ASSERT(payloadSize);
-
- tmp = h264bsdGetBits(pStrmData, 8);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pUserDataRegisteredItuTT35->ituTT35CountryCode = tmp;
-
- if (pUserDataRegisteredItuTT35->ituTT35CountryCode != 0xFF)
- i = 1;
- else
- {
- tmp = h264bsdGetBits(pStrmData, 8);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pUserDataRegisteredItuTT35->ituTT35CountryCodeExtensionByte = tmp;
- i = 2;
- }
-
- /* where corresponding FREE() ??? */
- ALLOCATE(pUserDataRegisteredItuTT35->ituTT35PayloadByte,payloadSize-i,u8);
- pUserDataRegisteredItuTT35->numPayloadBytes = payloadSize - i;
- if (pUserDataRegisteredItuTT35->ituTT35PayloadByte == NULL)
- return(MEMORY_ALLOCATION_ERROR);
-
- j = 0;
- do
- {
- tmp = h264bsdGetBits(pStrmData, 8);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pUserDataRegisteredItuTT35->ituTT35PayloadByte[j] = (u8)tmp;
- i++;
- j++;
- } while (i < payloadSize);
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeUserDataUnregistered
-
- Functional description:
- <++>
- Inputs:
- <++>
- Outputs:
- <++>
-
-------------------------------------------------------------------------------*/
-
-static u32 DecodeUserDataUnregistered(
- strmData_t *pStrmData,
- seiUserDataUnregistered_t *pUserDataUnregistered,
- u32 payloadSize)
-{
-
-/* Variables */
-
- u32 i, tmp;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pUserDataUnregistered);
-
-
- for (i = 0; i < 4; i++)
- {
- pUserDataUnregistered->uuidIsoIec11578[i] = h264bsdShowBits32(pStrmData);
- if (h264bsdFlushBits(pStrmData,32) == END_OF_STREAM)
- return(HANTRO_NOK);
- }
-
- /* where corresponding FREE() ??? */
- ALLOCATE(pUserDataUnregistered->userDataPayloadByte, payloadSize - 16, u8);
- if (pUserDataUnregistered->userDataPayloadByte == NULL)
- return(MEMORY_ALLOCATION_ERROR);
-
- pUserDataUnregistered->numPayloadBytes = payloadSize - 16;
-
- for (i = 0; i < payloadSize - 16; i++)
- {
- tmp = h264bsdGetBits(pStrmData, 8);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pUserDataUnregistered->userDataPayloadByte[i] = (u8)tmp;
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeRecoveryPoint
-
- Functional description:
- <++>
- Inputs:
- <++>
- Outputs:
- <++>
-
-------------------------------------------------------------------------------*/
-
-static u32 DecodeRecoveryPoint(
- strmData_t *pStrmData,
- seiRecoveryPoint_t *pRecoveryPoint)
-{
-
-/* Variables */
-
- u32 tmp;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pRecoveryPoint);
-
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pRecoveryPoint->recoveryFrameCnt);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pRecoveryPoint->exactMatchFlag = tmp == 1 ? HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pRecoveryPoint->brokenLinkFlag = tmp == 1 ? HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdGetBits(pStrmData, 2);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- if (tmp > 2)
- return(HANTRO_NOK);
- pRecoveryPoint->changingSliceGroupIdc = tmp;
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeDecRefPicMarkingRepetition
-
- Functional description:
- <++>
- Inputs:
- <++>
- Outputs:
- <++>
-
-------------------------------------------------------------------------------*/
-
-static u32 DecodeDecRefPicMarkingRepetition(
- strmData_t *pStrmData,
- seiDecRefPicMarkingRepetition_t *pDecRefPicMarkingRepetition,
- u32 numRefFrames)
-{
-
-/* Variables */
-
- u32 tmp;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pDecRefPicMarkingRepetition);
-
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pDecRefPicMarkingRepetition->originalIdrFlag = tmp == 1 ? HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pDecRefPicMarkingRepetition->originalFrameNum);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* frame_mbs_only_flag assumed always true so some field related syntax
- * elements are skipped, see H.264 standard */
- tmp = h264bsdDecRefPicMarking(pStrmData,
- &pDecRefPicMarkingRepetition->decRefPicMarking, NAL_SEI, numRefFrames);
-
- return(tmp);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeSparePic
-
- Functional description:
- <++>
- Inputs:
- <++>
- Outputs:
- <++>
-
-------------------------------------------------------------------------------*/
-
-static u32 DecodeSparePic(
- strmData_t *pStrmData,
- seiSparePic_t *pSparePic,
- u32 picSizeInMapUnits)
-{
-
-/* Variables */
-
- u32 tmp, i, j, mapUnitCnt;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pSparePic);
-
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSparePic->targetFrameNum);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSparePic->spareFieldFlag = tmp == 1 ? HANTRO_TRUE : HANTRO_FALSE;
- /* do not accept fields */
- if (pSparePic->spareFieldFlag)
- return(HANTRO_NOK);
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &pSparePic->numSparePics);
- if (tmp != HANTRO_OK)
- return(tmp);
- pSparePic->numSparePics++;
- if (pSparePic->numSparePics > MAX_NUM_SPARE_PICS)
- return(HANTRO_NOK);
-
- for (i = 0; i < pSparePic->numSparePics; i++)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSparePic->deltaSpareFrameNum[i]);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSparePic->spareAreaIdc[i]);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pSparePic->spareAreaIdc[i] > 2)
- return(HANTRO_NOK);
-
- if (pSparePic->spareAreaIdc[i] == 1)
- {
- /* where corresponding FREE() ??? */
- ALLOCATE(pSparePic->spareUnitFlag[i], picSizeInMapUnits, u32);
- if (pSparePic->spareUnitFlag[i] == NULL)
- return(MEMORY_ALLOCATION_ERROR);
- pSparePic->zeroRunLength[i] = NULL;
-
- for (j = 0; j < picSizeInMapUnits; j++)
- {
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSparePic->spareUnitFlag[i][j] = tmp == 1 ?
- HANTRO_TRUE : HANTRO_FALSE;
- }
- }
- else if (pSparePic->spareAreaIdc[i] == 2)
- {
- /* where corresponding FREE() ??? */
- ALLOCATE(pSparePic->zeroRunLength[i], picSizeInMapUnits, u32);
- if (pSparePic->zeroRunLength[i] == NULL)
- return(MEMORY_ALLOCATION_ERROR);
- pSparePic->spareUnitFlag[i] = NULL;
-
- for (j = 0, mapUnitCnt = 0; mapUnitCnt < picSizeInMapUnits; j++)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSparePic->zeroRunLength[i][j]);
- if (tmp != HANTRO_OK)
- return(tmp);
- mapUnitCnt += pSparePic->zeroRunLength[i][j] + 1;
- }
- }
- }
-
- /* set rest to null */
- for (i = pSparePic->numSparePics; i < MAX_NUM_SPARE_PICS; i++)
- {
- pSparePic->spareUnitFlag[i] = NULL;
- pSparePic->zeroRunLength[i] = NULL;
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeSceneInfo
-
- Functional description:
- <++>
- Inputs:
- <++>
- Outputs:
- <++>
-
-------------------------------------------------------------------------------*/
-
-static u32 DecodeSceneInfo(
- strmData_t *pStrmData,
- seiSceneInfo_t *pSceneInfo)
-{
-
-/* Variables */
-
- u32 tmp;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pSceneInfo);
-
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSceneInfo->sceneInfoPresentFlag = tmp == 1 ? HANTRO_TRUE : HANTRO_FALSE;
-
- if (pSceneInfo->sceneInfoPresentFlag)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &pSceneInfo->sceneId);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSceneInfo->sceneTransitionType);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pSceneInfo->sceneTransitionType > 6)
- return(HANTRO_NOK);
-
- if (pSceneInfo->sceneTransitionType)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSceneInfo->secondSceneId);
- if (tmp != HANTRO_OK)
- return(tmp);
- }
-
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeSubSeqInfo
-
- Functional description:
- <++>
- Inputs:
- <++>
- Outputs:
- <++>
-
------------------------------------------------------------------------------*/
-
-static u32 DecodeSubSeqInfo(
- strmData_t *pStrmData,
- seiSubSeqInfo_t *pSubSeqInfo)
-{
-
-/* Variables */
-
- u32 tmp;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pSubSeqInfo);
-
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSubSeqInfo->subSeqLayerNum);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pSubSeqInfo->subSeqLayerNum > 255)
- return(HANTRO_NOK);
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &pSubSeqInfo->subSeqId);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pSubSeqInfo->subSeqId > 65535)
- return(HANTRO_NOK);
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSubSeqInfo->firstRefPicFlag = tmp == 1 ? HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSubSeqInfo->leadingNonRefPicFlag = tmp == 1 ? HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSubSeqInfo->lastPicFlag = tmp == 1 ? HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSubSeqInfo->subSeqFrameNumFlag = tmp == 1 ? HANTRO_TRUE : HANTRO_FALSE;
-
- if (pSubSeqInfo->subSeqFrameNumFlag)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSubSeqInfo->subSeqFrameNum);
- if (tmp != HANTRO_OK)
- return(tmp);
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeSubSeqLayerCharacteristics
-
- Functional description:
- <++>
- Inputs:
- <++>
- Outputs:
- <++>
-
-------------------------------------------------------------------------------*/
-
-static u32 DecodeSubSeqLayerCharacteristics(
- strmData_t *pStrmData,
- seiSubSeqLayerCharacteristics_t *pSubSeqLayerCharacteristics)
-{
-
-/* Variables */
-
- u32 tmp, i;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pSubSeqLayerCharacteristics);
-
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSubSeqLayerCharacteristics->numSubSeqLayers);
- if (tmp != HANTRO_OK)
- return(tmp);
- pSubSeqLayerCharacteristics->numSubSeqLayers++;
- if (pSubSeqLayerCharacteristics->numSubSeqLayers > MAX_NUM_SUB_SEQ_LAYERS)
- return(HANTRO_NOK);
-
- for (i = 0; i < pSubSeqLayerCharacteristics->numSubSeqLayers; i++)
- {
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSubSeqLayerCharacteristics->accurateStatisticsFlag[i] =
- tmp == 1 ? HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdGetBits(pStrmData, 16);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSubSeqLayerCharacteristics->averageBitRate[i] = tmp;
-
- tmp = h264bsdGetBits(pStrmData, 16);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSubSeqLayerCharacteristics->averageFrameRate[i] = tmp;
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeSubSeqCharacteristics
-
- Functional description:
- <++>
- Inputs:
- <++>
- Outputs:
- <++>
-
-------------------------------------------------------------------------------*/
-
-static u32 DecodeSubSeqCharacteristics(
- strmData_t *pStrmData,
- seiSubSeqCharacteristics_t *pSubSeqCharacteristics)
-{
-
-/* Variables */
-
- u32 tmp, i;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pSubSeqCharacteristics);
-
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSubSeqCharacteristics->subSeqLayerNum);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pSubSeqCharacteristics->subSeqLayerNum > MAX_NUM_SUB_SEQ_LAYERS-1)
- return(HANTRO_NOK);
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSubSeqCharacteristics->subSeqId);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pSubSeqCharacteristics->subSeqId > 65535)
- return(HANTRO_NOK);
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSubSeqCharacteristics->durationFlag = tmp == 1 ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- if (pSubSeqCharacteristics->durationFlag)
- {
- pSubSeqCharacteristics->subSeqDuration = h264bsdShowBits32(pStrmData);
- if (h264bsdFlushBits(pStrmData,32) == END_OF_STREAM)
- return(HANTRO_NOK);
- }
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSubSeqCharacteristics->averageRateFlag = tmp == 1 ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- if (pSubSeqCharacteristics->averageRateFlag)
- {
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSubSeqCharacteristics->accurateStatisticsFlag =
- tmp == 1 ? HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdGetBits(pStrmData, 16);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSubSeqCharacteristics->averageBitRate = tmp;
-
- tmp = h264bsdGetBits(pStrmData, 16);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSubSeqCharacteristics->averageFrameRate = tmp;
- }
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSubSeqCharacteristics->numReferencedSubseqs);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pSubSeqCharacteristics->numReferencedSubseqs > MAX_NUM_SUB_SEQ_LAYERS-1)
- return(HANTRO_NOK);
-
- for (i = 0; i < pSubSeqCharacteristics->numReferencedSubseqs; i++)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSubSeqCharacteristics->refSubSeqLayerNum[i]);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSubSeqCharacteristics->refSubSeqId[i]);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSubSeqCharacteristics->refSubSeqDirection[i] = tmp;
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeFullFrameFreeze
-
- Functional description:
- <++>
- Inputs:
- <++>
- Outputs:
- <++>
-
-------------------------------------------------------------------------------*/
-
-static u32 DecodeFullFrameFreeze(
- strmData_t *pStrmData,
- seiFullFrameFreeze_t *pFullFrameFreeze)
-{
-
-/* Variables */
-
- u32 tmp;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pFullFrameFreeze);
-
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pFullFrameFreeze->fullFrameFreezeRepetitionPeriod);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pFullFrameFreeze->fullFrameFreezeRepetitionPeriod > 16384)
- return(HANTRO_NOK);
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeFullFrameSnapshot
-
- Functional description:
- <++>
- Inputs:
- <++>
- Outputs:
- <++>
-
-------------------------------------------------------------------------------*/
-
-static u32 DecodeFullFrameSnapshot(
- strmData_t *pStrmData,
- seiFullFrameSnapshot_t *pFullFrameSnapshot)
-{
-
-/* Variables */
-
- u32 tmp;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pFullFrameSnapshot);
-
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pFullFrameSnapshot->snapShotId);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeProgressiveRefinementSegmentStart
-
- Functional description:
- <++>
- Inputs:
- <++>
- Outputs:
- <++>
-
-------------------------------------------------------------------------------*/
-
-static u32 DecodeProgressiveRefinementSegmentStart(
- strmData_t *pStrmData,
- seiProgressiveRefinementSegmentStart_t *pProgressiveRefinementSegmentStart)
-{
-
-/* Variables */
-
- u32 tmp;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pProgressiveRefinementSegmentStart);
-
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pProgressiveRefinementSegmentStart->progressiveRefinementId);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pProgressiveRefinementSegmentStart->numRefinementSteps);
- if (tmp != HANTRO_OK)
- return(tmp);
- pProgressiveRefinementSegmentStart->numRefinementSteps++;
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeProgressiveRefinementSegmentEnd
-
- Functional description:
- <++>
- Inputs:
- <++>
- Outputs:
- <++>
-
-------------------------------------------------------------------------------*/
-
-static u32 DecodeProgressiveRefinementSegmentEnd(
- strmData_t *pStrmData,
- seiProgressiveRefinementSegmentEnd_t *pProgressiveRefinementSegmentEnd)
-{
-
-/* Variables */
-
- u32 tmp;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pProgressiveRefinementSegmentEnd);
-
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pProgressiveRefinementSegmentEnd->progressiveRefinementId);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeMotionConstrainedSliceGroupSet
-
- Functional description:
- <++>
- Inputs:
- <++>
- Outputs:
- <++>
-
-------------------------------------------------------------------------------*/
-
-static u32 DecodeMotionConstrainedSliceGroupSet(
- strmData_t *pStrmData,
- seiMotionConstrainedSliceGroupSet_t *pMotionConstrainedSliceGroupSet,
- u32 numSliceGroups)
-{
-
-/* Variables */
-
- u32 tmp,i;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pMotionConstrainedSliceGroupSet);
- ASSERT(numSliceGroups < MAX_NUM_SLICE_GROUPS);
-
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pMotionConstrainedSliceGroupSet->numSliceGroupsInSet);
- if (tmp != HANTRO_OK)
- return(tmp);
- pMotionConstrainedSliceGroupSet->numSliceGroupsInSet++;
- if (pMotionConstrainedSliceGroupSet->numSliceGroupsInSet > numSliceGroups)
- return(HANTRO_NOK);
-
- for (i = 0; i < pMotionConstrainedSliceGroupSet->numSliceGroupsInSet; i++)
- {
- tmp = h264bsdGetBits(pStrmData,
- ceilLog2NumSliceGroups[numSliceGroups]);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pMotionConstrainedSliceGroupSet->sliceGroupId[i] = tmp;
- if (pMotionConstrainedSliceGroupSet->sliceGroupId[i] >
- pMotionConstrainedSliceGroupSet->numSliceGroupsInSet-1)
- return(HANTRO_NOK);
- }
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pMotionConstrainedSliceGroupSet->exactSampleValueMatchFlag =
- tmp == 1 ? HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pMotionConstrainedSliceGroupSet->panScanRectFlag = tmp == 1 ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- if (pMotionConstrainedSliceGroupSet->panScanRectFlag)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pMotionConstrainedSliceGroupSet->panScanRectId);
- if (tmp != HANTRO_OK)
- return(tmp);
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeReservedSeiMessage
-
- Functional description:
- <++>
- Inputs:
- <++>
- Outputs:
- <++>
-
-------------------------------------------------------------------------------*/
-
-static u32 DecodeReservedSeiMessage(
- strmData_t *pStrmData,
- seiReservedSeiMessage_t *pReservedSeiMessage,
- u32 payloadSize)
-{
-
-/* Variables */
-
- u32 i, tmp;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pReservedSeiMessage);
-
-
- /* where corresponding FREE() ??? */
- ALLOCATE(pReservedSeiMessage->reservedSeiMessagePayloadByte,payloadSize,u8);
- if (pReservedSeiMessage->reservedSeiMessagePayloadByte == NULL)
- return(MEMORY_ALLOCATION_ERROR);
-
- pReservedSeiMessage->numPayloadBytes = payloadSize;
-
- for (i = 0; i < payloadSize; i++)
- {
- tmp = h264bsdGetBits(pStrmData,8);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pReservedSeiMessage->reservedSeiMessagePayloadByte[i] = (u8)tmp;
- }
-
- return(HANTRO_OK);
-
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_sei.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_sei.h
deleted file mode 100644
index efe543a..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_sei.h
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_SEI_H
-#define H264SWDEC_SEI_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_stream.h"
-#include "h264bsd_slice_header.h"
-#include "h264bsd_seq_param_set.h"
-#include "h264bsd_vui.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-#define MAX_PAN_SCAN_CNT 32
-#define MAX_NUM_SPARE_PICS 16
-#define MAX_NUM_CLOCK_TS 3
-#define MAX_NUM_SUB_SEQ_LAYERS 256
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-typedef struct
-{
- u32 seqParameterSetId;
- u32 initialCpbRemovalDelay[MAX_CPB_CNT];
- u32 initialCpbRemovalDelayOffset[MAX_CPB_CNT];
-} seiBufferingPeriod_t;
-
-typedef struct
-{
- u32 cpbRemovalDelay;
- u32 dpbOutputDelay;
- u32 picStruct;
- u32 clockTimeStampFlag[MAX_NUM_CLOCK_TS];
- u32 clockTimeStamp[MAX_NUM_CLOCK_TS];
- u32 ctType[MAX_NUM_CLOCK_TS];
- u32 nuitFieldBasedFlag[MAX_NUM_CLOCK_TS];
- u32 countingType[MAX_NUM_CLOCK_TS];
- u32 fullTimeStampFlag[MAX_NUM_CLOCK_TS];
- u32 discontinuityFlag[MAX_NUM_CLOCK_TS];
- u32 cntDroppedFlag[MAX_NUM_CLOCK_TS];
- u32 nFrames[MAX_NUM_CLOCK_TS];
- u32 secondsFlag[MAX_NUM_CLOCK_TS];
- u32 secondsValue[MAX_NUM_CLOCK_TS];
- u32 minutesFlag[MAX_NUM_CLOCK_TS];
- u32 minutesValue[MAX_NUM_CLOCK_TS];
- u32 hoursFlag[MAX_NUM_CLOCK_TS];
- u32 hoursValue[MAX_NUM_CLOCK_TS];
- i32 timeOffset[MAX_NUM_CLOCK_TS];
-} seiPicTiming_t;
-
-typedef struct
-{
- u32 panScanRectId;
- u32 panScanRectCancelFlag;
- u32 panScanCnt;
- i32 panScanRectLeftOffset[MAX_PAN_SCAN_CNT];
- i32 panScanRectRightOffset[MAX_PAN_SCAN_CNT];
- i32 panScanRectTopOffset[MAX_PAN_SCAN_CNT];
- i32 panScanRectBottomOffset[MAX_PAN_SCAN_CNT];
- u32 panScanRectRepetitionPeriod;
-} seiPanScanRect_t;
-
-typedef struct
-{
- u32 ituTT35CountryCode;
- u32 ituTT35CountryCodeExtensionByte;
- u8 *ituTT35PayloadByte;
- u32 numPayloadBytes;
-} seiUserDataRegisteredItuTT35_t;
-
-typedef struct
-{
- u32 uuidIsoIec11578[4];
- u8 *userDataPayloadByte;
- u32 numPayloadBytes;
-} seiUserDataUnregistered_t;
-
-typedef struct
-{
- u32 recoveryFrameCnt;
- u32 exactMatchFlag;
- u32 brokenLinkFlag;
- u32 changingSliceGroupIdc;
-} seiRecoveryPoint_t;
-
-typedef struct
-{
- u32 originalIdrFlag;
- u32 originalFrameNum;
- decRefPicMarking_t decRefPicMarking;
-} seiDecRefPicMarkingRepetition_t;
-
-typedef struct
-{
- u32 targetFrameNum;
- u32 spareFieldFlag;
- u32 targetBottomFieldFlag;
- u32 numSparePics;
- u32 deltaSpareFrameNum[MAX_NUM_SPARE_PICS];
- u32 spareBottomFieldFlag[MAX_NUM_SPARE_PICS];
- u32 spareAreaIdc[MAX_NUM_SPARE_PICS];
- u32 *spareUnitFlag[MAX_NUM_SPARE_PICS];
- u32 *zeroRunLength[MAX_NUM_SPARE_PICS];
-} seiSparePic_t;
-
-typedef struct
-{
- u32 sceneInfoPresentFlag;
- u32 sceneId;
- u32 sceneTransitionType;
- u32 secondSceneId;
-} seiSceneInfo_t;
-
-typedef struct
-{
- u32 subSeqLayerNum;
- u32 subSeqId;
- u32 firstRefPicFlag;
- u32 leadingNonRefPicFlag;
- u32 lastPicFlag;
- u32 subSeqFrameNumFlag;
- u32 subSeqFrameNum;
-} seiSubSeqInfo_t;
-
-typedef struct
-{
- u32 numSubSeqLayers;
- u32 accurateStatisticsFlag[MAX_NUM_SUB_SEQ_LAYERS];
- u32 averageBitRate[MAX_NUM_SUB_SEQ_LAYERS];
- u32 averageFrameRate[MAX_NUM_SUB_SEQ_LAYERS];
-} seiSubSeqLayerCharacteristics_t;
-
-typedef struct
-{
- u32 subSeqLayerNum;
- u32 subSeqId;
- u32 durationFlag;
- u32 subSeqDuration;
- u32 averageRateFlag;
- u32 accurateStatisticsFlag;
- u32 averageBitRate;
- u32 averageFrameRate;
- u32 numReferencedSubseqs;
- u32 refSubSeqLayerNum[MAX_NUM_SUB_SEQ_LAYERS];
- u32 refSubSeqId[MAX_NUM_SUB_SEQ_LAYERS];
- u32 refSubSeqDirection[MAX_NUM_SUB_SEQ_LAYERS];
-} seiSubSeqCharacteristics_t;
-
-typedef struct
-{
- u32 fullFrameFreezeRepetitionPeriod;
-} seiFullFrameFreeze_t;
-
-typedef struct
-{
- u32 snapShotId;
-} seiFullFrameSnapshot_t;
-
-typedef struct
-{
- u32 progressiveRefinementId;
- u32 numRefinementSteps;
-} seiProgressiveRefinementSegmentStart_t;
-
-typedef struct
-{
- u32 progressiveRefinementId;
-} seiProgressiveRefinementSegmentEnd_t;
-
-typedef struct
-{
- u32 numSliceGroupsInSet;
- u32 sliceGroupId[MAX_NUM_SLICE_GROUPS];
- u32 exactSampleValueMatchFlag;
- u32 panScanRectFlag;
- u32 panScanRectId;
-} seiMotionConstrainedSliceGroupSet_t;
-
-typedef struct
-{
- u8 *reservedSeiMessagePayloadByte;
- u32 numPayloadBytes;
-} seiReservedSeiMessage_t;
-
-typedef struct
-{
- u32 payloadType;
- seiBufferingPeriod_t bufferingPeriod;
- seiPicTiming_t picTiming;
- seiPanScanRect_t panScanRect;
- seiUserDataRegisteredItuTT35_t userDataRegisteredItuTT35;
- seiUserDataUnregistered_t userDataUnregistered;
- seiRecoveryPoint_t recoveryPoint;
- seiDecRefPicMarkingRepetition_t decRefPicMarkingRepetition;
- seiSparePic_t sparePic;
- seiSceneInfo_t sceneInfo;
- seiSubSeqInfo_t subSeqInfo;
- seiSubSeqLayerCharacteristics_t subSeqLayerCharacteristics;
- seiSubSeqCharacteristics_t subSeqCharacteristics;
- seiFullFrameFreeze_t fullFrameFreeze;
- seiFullFrameSnapshot_t fullFrameSnapshot;
- seiProgressiveRefinementSegmentStart_t progressiveRefinementSegmentStart;
- seiProgressiveRefinementSegmentEnd_t progressiveRefinementSegmentEnd;
- seiMotionConstrainedSliceGroupSet_t motionConstrainedSliceGroupSet;
- seiReservedSeiMessage_t reservedSeiMessage;
-} seiMessage_t;
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeSeiMessage(
- strmData_t *pStrmData,
- seqParamSet_t *pSeqParamSet,
- seiMessage_t *pSeiMessage,
- u32 numSliceGroups);
-
-#endif /* #ifdef H264SWDEC_SEI_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_seq_param_set.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_seq_param_set.c
deleted file mode 100644
index 751051a..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_seq_param_set.c
+++ /dev/null
@@ -1,577 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdDecodeSeqParamSet
- GetDpbSize
- h264bsdCompareSeqParamSets
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_seq_param_set.h"
-#include "h264bsd_util.h"
-#include "h264bsd_vlc.h"
-#include "h264bsd_vui.h"
-#include "h264bsd_cfg.h"
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-/* enumeration to indicate invalid return value from the GetDpbSize function */
-enum {INVALID_DPB_SIZE = 0x7FFFFFFF};
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-static u32 GetDpbSize(u32 picSizeInMbs, u32 levelIdc);
-
-/*------------------------------------------------------------------------------
-
- Function name: h264bsdDecodeSeqParamSet
-
- Functional description:
- Decode sequence parameter set information from the stream.
-
- Function allocates memory for offsetForRefFrame array if
- picture order count type is 1 and numRefFramesInPicOrderCntCycle
- is greater than zero.
-
- Inputs:
- pStrmData pointer to stream data structure
-
- Outputs:
- pSeqParamSet decoded information is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK failure, invalid information or end of stream
- MEMORY_ALLOCATION_ERROR for memory allocation failure
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeSeqParamSet(strmData_t *pStrmData, seqParamSet_t *pSeqParamSet)
-{
-
-/* Variables */
-
- u32 tmp, i, value;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pSeqParamSet);
-
- H264SwDecMemset(pSeqParamSet, 0, sizeof(seqParamSet_t));
-
- /* profile_idc */
- tmp = h264bsdGetBits(pStrmData, 8);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- if (tmp != 66)
- {
- DEBUG(("NOT BASELINE PROFILE %d\n", tmp));
- }
- pSeqParamSet->profileIdc = tmp;
-
- /* constrained_set0_flag */
- tmp = h264bsdGetBits(pStrmData, 1);
- /* constrained_set1_flag */
- tmp = h264bsdGetBits(pStrmData, 1);
- /* constrained_set2_flag */
- tmp = h264bsdGetBits(pStrmData, 1);
-
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
-
- /* reserved_zero_5bits, values of these bits shall be ignored */
- tmp = h264bsdGetBits(pStrmData, 5);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
-
- tmp = h264bsdGetBits(pStrmData, 8);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSeqParamSet->levelIdc = tmp;
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSeqParamSet->seqParameterSetId);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pSeqParamSet->seqParameterSetId >= MAX_NUM_SEQ_PARAM_SETS)
- {
- EPRINT("seq_param_set_id");
- return(HANTRO_NOK);
- }
-
- /* log2_max_frame_num_minus4 */
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (value > 12)
- {
- EPRINT("log2_max_frame_num_minus4");
- return(HANTRO_NOK);
- }
- /* maxFrameNum = 2^(log2_max_frame_num_minus4 + 4) */
- pSeqParamSet->maxFrameNum = 1 << (value+4);
-
- /* valid POC types are 0, 1 and 2 */
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (value > 2)
- {
- EPRINT("pic_order_cnt_type");
- return(HANTRO_NOK);
- }
- pSeqParamSet->picOrderCntType = value;
-
- if (pSeqParamSet->picOrderCntType == 0)
- {
- /* log2_max_pic_order_cnt_lsb_minus4 */
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (value > 12)
- {
- EPRINT("log2_max_pic_order_cnt_lsb_minus4");
- return(HANTRO_NOK);
- }
- /* maxPicOrderCntLsb = 2^(log2_max_pic_order_cnt_lsb_minus4 + 4) */
- pSeqParamSet->maxPicOrderCntLsb = 1 << (value+4);
- }
- else if (pSeqParamSet->picOrderCntType == 1)
- {
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSeqParamSet->deltaPicOrderAlwaysZeroFlag = (tmp == 1) ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdDecodeExpGolombSigned(pStrmData,
- &pSeqParamSet->offsetForNonRefPic);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- tmp = h264bsdDecodeExpGolombSigned(pStrmData,
- &pSeqParamSet->offsetForTopToBottomField);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSeqParamSet->numRefFramesInPicOrderCntCycle);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pSeqParamSet->numRefFramesInPicOrderCntCycle > 255)
- {
- EPRINT("num_ref_frames_in_pic_order_cnt_cycle");
- return(HANTRO_NOK);
- }
-
- if (pSeqParamSet->numRefFramesInPicOrderCntCycle)
- {
- /* NOTE: This has to be freed somewhere! */
- ALLOCATE(pSeqParamSet->offsetForRefFrame,
- pSeqParamSet->numRefFramesInPicOrderCntCycle, i32);
- if (pSeqParamSet->offsetForRefFrame == NULL)
- return(MEMORY_ALLOCATION_ERROR);
-
- for (i = 0; i < pSeqParamSet->numRefFramesInPicOrderCntCycle; i++)
- {
- tmp = h264bsdDecodeExpGolombSigned(pStrmData,
- pSeqParamSet->offsetForRefFrame + i);
- if (tmp != HANTRO_OK)
- return(tmp);
- }
- }
- else
- {
- pSeqParamSet->offsetForRefFrame = NULL;
- }
- }
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSeqParamSet->numRefFrames);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pSeqParamSet->numRefFrames > MAX_NUM_REF_PICS)
- {
- EPRINT("num_ref_frames");
- return(HANTRO_NOK);
- }
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSeqParamSet->gapsInFrameNumValueAllowedFlag = (tmp == 1) ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- pSeqParamSet->picWidthInMbs = value + 1;
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- pSeqParamSet->picHeightInMbs = value + 1;
-
- /* frame_mbs_only_flag, shall be 1 for baseline profile */
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- if (!tmp)
- {
- EPRINT("frame_mbs_only_flag");
- return(HANTRO_NOK);
- }
-
- /* direct_8x8_inference_flag */
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSeqParamSet->frameCroppingFlag = (tmp == 1) ? HANTRO_TRUE : HANTRO_FALSE;
-
- if (pSeqParamSet->frameCroppingFlag)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSeqParamSet->frameCropLeftOffset);
- if (tmp != HANTRO_OK)
- return(tmp);
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSeqParamSet->frameCropRightOffset);
- if (tmp != HANTRO_OK)
- return(tmp);
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSeqParamSet->frameCropTopOffset);
- if (tmp != HANTRO_OK)
- return(tmp);
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pSeqParamSet->frameCropBottomOffset);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* check that frame cropping params are valid, parameters shall
- * specify non-negative area within the original picture */
- if ( ( (i32)pSeqParamSet->frameCropLeftOffset >
- ( 8 * (i32)pSeqParamSet->picWidthInMbs -
- ((i32)pSeqParamSet->frameCropRightOffset + 1) ) ) ||
- ( (i32)pSeqParamSet->frameCropTopOffset >
- ( 8 * (i32)pSeqParamSet->picHeightInMbs -
- ((i32)pSeqParamSet->frameCropBottomOffset + 1) ) ) )
- {
- EPRINT("frame_cropping");
- return(HANTRO_NOK);
- }
- }
-
- /* check that image dimensions and levelIdc match */
- tmp = pSeqParamSet->picWidthInMbs * pSeqParamSet->picHeightInMbs;
- value = GetDpbSize(tmp, pSeqParamSet->levelIdc);
- if (value == INVALID_DPB_SIZE || pSeqParamSet->numRefFrames > value)
- {
- DEBUG(("WARNING! Invalid DPB size based on SPS Level!\n"));
- DEBUG(("WARNING! Using num_ref_frames =%d for DPB size!\n",
- pSeqParamSet->numRefFrames));
- value = pSeqParamSet->numRefFrames;
- }
- pSeqParamSet->maxDpbSize = value;
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSeqParamSet->vuiParametersPresentFlag = (tmp == 1) ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- /* VUI */
- if (pSeqParamSet->vuiParametersPresentFlag)
- {
- ALLOCATE(pSeqParamSet->vuiParameters, 1, vuiParameters_t);
- if (pSeqParamSet->vuiParameters == NULL)
- return(MEMORY_ALLOCATION_ERROR);
- tmp = h264bsdDecodeVuiParameters(pStrmData,
- pSeqParamSet->vuiParameters);
- if (tmp != HANTRO_OK)
- return(tmp);
- /* check numReorderFrames and maxDecFrameBuffering */
- if (pSeqParamSet->vuiParameters->bitstreamRestrictionFlag)
- {
- if (pSeqParamSet->vuiParameters->numReorderFrames >
- pSeqParamSet->vuiParameters->maxDecFrameBuffering ||
- pSeqParamSet->vuiParameters->maxDecFrameBuffering <
- pSeqParamSet->numRefFrames ||
- pSeqParamSet->vuiParameters->maxDecFrameBuffering >
- pSeqParamSet->maxDpbSize)
- {
- return(HANTRO_NOK);
- }
-
- /* standard says that "the sequence shall not require a DPB with
- * size of more than max(1, maxDecFrameBuffering) */
- pSeqParamSet->maxDpbSize =
- MAX(1, pSeqParamSet->vuiParameters->maxDecFrameBuffering);
- }
- }
-
- tmp = h264bsdRbspTrailingBits(pStrmData);
-
- /* ignore possible errors in trailing bits of parameters sets */
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: GetDpbSize
-
- Functional description:
- Get size of the DPB in frames. Size is determined based on the
- picture size and MaxDPB for the specified level. These determine
- how many pictures may fit into to the buffer. However, the size
- is also limited to a maximum of 16 frames and therefore function
- returns the minimum of the determined size and 16.
-
- Inputs:
- picSizeInMbs number of macroblocks in the picture
- levelIdc indicates the level
-
- Outputs:
- none
-
- Returns:
- size of the DPB in frames
- INVALID_DPB_SIZE when invalid levelIdc specified or picSizeInMbs
- is higher than supported by the level in question
-
-------------------------------------------------------------------------------*/
-
-u32 GetDpbSize(u32 picSizeInMbs, u32 levelIdc)
-{
-
-/* Variables */
-
- u32 tmp;
- u32 maxPicSizeInMbs;
-
-/* Code */
-
- ASSERT(picSizeInMbs);
-
- /* use tmp as the size of the DPB in bytes, computes as 1024 * MaxDPB
- * (from table A-1 in Annex A) */
- switch (levelIdc)
- {
- case 10:
- tmp = 152064;
- maxPicSizeInMbs = 99;
- break;
-
- case 11:
- tmp = 345600;
- maxPicSizeInMbs = 396;
- break;
-
- case 12:
- tmp = 912384;
- maxPicSizeInMbs = 396;
- break;
-
- case 13:
- tmp = 912384;
- maxPicSizeInMbs = 396;
- break;
-
- case 20:
- tmp = 912384;
- maxPicSizeInMbs = 396;
- break;
-
- case 21:
- tmp = 1824768;
- maxPicSizeInMbs = 792;
- break;
-
- case 22:
- tmp = 3110400;
- maxPicSizeInMbs = 1620;
- break;
-
- case 30:
- tmp = 3110400;
- maxPicSizeInMbs = 1620;
- break;
-
- case 31:
- tmp = 6912000;
- maxPicSizeInMbs = 3600;
- break;
-
- case 32:
- tmp = 7864320;
- maxPicSizeInMbs = 5120;
- break;
-
- case 40:
- tmp = 12582912;
- maxPicSizeInMbs = 8192;
- break;
-
- case 41:
- tmp = 12582912;
- maxPicSizeInMbs = 8192;
- break;
-
- case 42:
- tmp = 34816*384;
- maxPicSizeInMbs = 8704;
- break;
-
- case 50:
- /* standard says 42301440 here, but corrigendum "corrects" this to
- * 42393600 */
- tmp = 42393600;
- maxPicSizeInMbs = 22080;
- break;
-
- case 51:
- tmp = 70778880;
- maxPicSizeInMbs = 36864;
- break;
-
- default:
- return(INVALID_DPB_SIZE);
- }
-
- /* this is not "correct" return value! However, it results in error in
- * decoding and this was easiest place to check picture size */
- if (picSizeInMbs > maxPicSizeInMbs)
- return(INVALID_DPB_SIZE);
-
- tmp /= (picSizeInMbs*384);
-
- return(MIN(tmp, 16));
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: h264bsdCompareSeqParamSets
-
- Functional description:
- Compare two sequence parameter sets.
-
- Inputs:
- pSps1 pointer to a sequence parameter set
- pSps2 pointer to another sequence parameter set
-
- Outputs:
- 0 sequence parameter sets are equal
- 1 otherwise
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdCompareSeqParamSets(seqParamSet_t *pSps1, seqParamSet_t *pSps2)
-{
-
-/* Variables */
-
- u32 i;
-
-/* Code */
-
- ASSERT(pSps1);
- ASSERT(pSps2);
-
- /* first compare parameters whose existence does not depend on other
- * parameters and only compare the rest of the params if these are equal */
- if (pSps1->profileIdc == pSps2->profileIdc &&
- pSps1->levelIdc == pSps2->levelIdc &&
- pSps1->maxFrameNum == pSps2->maxFrameNum &&
- pSps1->picOrderCntType == pSps2->picOrderCntType &&
- pSps1->numRefFrames == pSps2->numRefFrames &&
- pSps1->gapsInFrameNumValueAllowedFlag ==
- pSps2->gapsInFrameNumValueAllowedFlag &&
- pSps1->picWidthInMbs == pSps2->picWidthInMbs &&
- pSps1->picHeightInMbs == pSps2->picHeightInMbs &&
- pSps1->frameCroppingFlag == pSps2->frameCroppingFlag &&
- pSps1->vuiParametersPresentFlag == pSps2->vuiParametersPresentFlag)
- {
- if (pSps1->picOrderCntType == 0)
- {
- if (pSps1->maxPicOrderCntLsb != pSps2->maxPicOrderCntLsb)
- return 1;
- }
- else if (pSps1->picOrderCntType == 1)
- {
- if (pSps1->deltaPicOrderAlwaysZeroFlag !=
- pSps2->deltaPicOrderAlwaysZeroFlag ||
- pSps1->offsetForNonRefPic != pSps2->offsetForNonRefPic ||
- pSps1->offsetForTopToBottomField !=
- pSps2->offsetForTopToBottomField ||
- pSps1->numRefFramesInPicOrderCntCycle !=
- pSps2->numRefFramesInPicOrderCntCycle)
- {
- return 1;
- }
- else
- {
- for (i = 0; i < pSps1->numRefFramesInPicOrderCntCycle; i++)
- if (pSps1->offsetForRefFrame[i] !=
- pSps2->offsetForRefFrame[i])
- {
- return 1;
- }
- }
- }
- if (pSps1->frameCroppingFlag)
- {
- if (pSps1->frameCropLeftOffset != pSps2->frameCropLeftOffset ||
- pSps1->frameCropRightOffset != pSps2->frameCropRightOffset ||
- pSps1->frameCropTopOffset != pSps2->frameCropTopOffset ||
- pSps1->frameCropBottomOffset != pSps2->frameCropBottomOffset)
- {
- return 1;
- }
- }
-
- return 0;
- }
-
- return 1;
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_seq_param_set.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_seq_param_set.h
deleted file mode 100644
index e18df94..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_seq_param_set.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_SEQ_PARAM_SET_H
-#define H264SWDEC_SEQ_PARAM_SET_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_stream.h"
-#include "h264bsd_vui.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-/* structure to store sequence parameter set information decoded from the
- * stream */
-typedef struct
-{
- u32 profileIdc;
- u32 levelIdc;
- u32 seqParameterSetId;
- u32 maxFrameNum;
- u32 picOrderCntType;
- u32 maxPicOrderCntLsb;
- u32 deltaPicOrderAlwaysZeroFlag;
- i32 offsetForNonRefPic;
- i32 offsetForTopToBottomField;
- u32 numRefFramesInPicOrderCntCycle;
- i32 *offsetForRefFrame;
- u32 numRefFrames;
- u32 gapsInFrameNumValueAllowedFlag;
- u32 picWidthInMbs;
- u32 picHeightInMbs;
- u32 frameCroppingFlag;
- u32 frameCropLeftOffset;
- u32 frameCropRightOffset;
- u32 frameCropTopOffset;
- u32 frameCropBottomOffset;
- u32 vuiParametersPresentFlag;
- vuiParameters_t *vuiParameters;
- u32 maxDpbSize;
-} seqParamSet_t;
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeSeqParamSet(strmData_t *pStrmData,
- seqParamSet_t *pSeqParamSet);
-
-u32 h264bsdCompareSeqParamSets(seqParamSet_t *pSps1, seqParamSet_t *pSps2);
-
-#endif /* #ifdef H264SWDEC_SEQ_PARAM_SET_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_slice_data.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_slice_data.c
deleted file mode 100644
index c288d4b..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_slice_data.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdDecodeSliceData
- SetMbParams
- h264bsdMarkSliceCorrupted
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_slice_data.h"
-#include "h264bsd_util.h"
-#include "h264bsd_vlc.h"
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-static void SetMbParams(mbStorage_t *pMb, sliceHeader_t *pSlice, u32 sliceId,
- i32 chromaQpIndexOffset);
-
-/*------------------------------------------------------------------------------
-
- 5.1 Function name: h264bsdDecodeSliceData
-
- Functional description:
- Decode one slice. Function decodes stream data, i.e. macroblocks
- and possible skip_run fields. h264bsdDecodeMacroblock function is
- called to handle all other macroblock related processing.
- Macroblock to slice group mapping is considered when next
- macroblock to process is determined (h264bsdNextMbAddress function)
- map
-
- Inputs:
- pStrmData pointer to stream data structure
- pStorage pointer to storage structure
- currImage pointer to current processed picture, needed for
- intra prediction of the macroblocks
- pSliceHeader pointer to slice header of the current slice
-
- Outputs:
- currImage processed macroblocks are written to current image
- pStorage mbStorage structure of each processed macroblock
- is updated here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK invalid stream data
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeSliceData(strmData_t *pStrmData, storage_t *pStorage,
- image_t *currImage, sliceHeader_t *pSliceHeader)
-{
-
-/* Variables */
-
- u8 mbData[384 + 15 + 32];
- u8 *data;
- u32 tmp;
- u32 skipRun;
- u32 prevSkipped;
- u32 currMbAddr;
- u32 moreMbs;
- u32 mbCount;
- i32 qpY;
- macroblockLayer_t *mbLayer;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pSliceHeader);
- ASSERT(pStorage);
- ASSERT(pSliceHeader->firstMbInSlice < pStorage->picSizeInMbs);
-
- /* ensure 16-byte alignment */
- data = (u8*)ALIGN(mbData, 16);
-
- mbLayer = pStorage->mbLayer;
-
- currMbAddr = pSliceHeader->firstMbInSlice;
- skipRun = 0;
- prevSkipped = HANTRO_FALSE;
-
- /* increment slice index, will be one for decoding of the first slice of
- * the picture */
- pStorage->slice->sliceId++;
-
- /* lastMbAddr stores address of the macroblock that was last successfully
- * decoded, needed for error handling */
- pStorage->slice->lastMbAddr = 0;
-
- mbCount = 0;
- /* initial quantization parameter for the slice is obtained as the sum of
- * initial QP for the picture and sliceQpDelta for the current slice */
- qpY = (i32)pStorage->activePps->picInitQp + pSliceHeader->sliceQpDelta;
- do
- {
- /* primary picture and already decoded macroblock -> error */
- if (!pSliceHeader->redundantPicCnt && pStorage->mb[currMbAddr].decoded)
- {
- EPRINT("Primary and already decoded");
- return(HANTRO_NOK);
- }
-
- SetMbParams(pStorage->mb + currMbAddr, pSliceHeader,
- pStorage->slice->sliceId, pStorage->activePps->chromaQpIndexOffset);
-
- if (!IS_I_SLICE(pSliceHeader->sliceType))
- {
- if (!prevSkipped)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &skipRun);
- if (tmp != HANTRO_OK)
- return(tmp);
- /* skip_run shall be less than or equal to number of
- * macroblocks left */
- if (skipRun > (pStorage->picSizeInMbs - currMbAddr))
- {
- EPRINT("skip_run");
- return(HANTRO_NOK);
- }
- if (skipRun)
- {
- prevSkipped = HANTRO_TRUE;
- H264SwDecMemset(&mbLayer->mbPred, 0, sizeof(mbPred_t));
- /* mark current macroblock skipped */
- mbLayer->mbType = P_Skip;
- }
- }
- }
-
- if (skipRun)
- {
- DEBUG(("Skipping macroblock %d\n", currMbAddr));
- skipRun--;
- }
- else
- {
- prevSkipped = HANTRO_FALSE;
- tmp = h264bsdDecodeMacroblockLayer(pStrmData, mbLayer,
- pStorage->mb + currMbAddr, pSliceHeader->sliceType,
- pSliceHeader->numRefIdxL0Active);
- if (tmp != HANTRO_OK)
- {
- EPRINT("macroblock_layer");
- return(tmp);
- }
- }
-
- tmp = h264bsdDecodeMacroblock(pStorage->mb + currMbAddr, mbLayer,
- currImage, pStorage->dpb, &qpY, currMbAddr,
- pStorage->activePps->constrainedIntraPredFlag, data);
- if (tmp != HANTRO_OK)
- {
- EPRINT("MACRO_BLOCK");
- return(tmp);
- }
-
- /* increment macroblock count only for macroblocks that were decoded
- * for the first time (redundant slices) */
- if (pStorage->mb[currMbAddr].decoded == 1)
- mbCount++;
-
- /* keep on processing as long as there is stream data left or
- * processing of macroblocks to be skipped based on the last skipRun is
- * not finished */
- moreMbs = (h264bsdMoreRbspData(pStrmData) || skipRun) ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- /* lastMbAddr is only updated for intra slices (all macroblocks of
- * inter slices will be lost in case of an error) */
- if (IS_I_SLICE(pSliceHeader->sliceType))
- pStorage->slice->lastMbAddr = currMbAddr;
-
- currMbAddr = h264bsdNextMbAddress(pStorage->sliceGroupMap,
- pStorage->picSizeInMbs, currMbAddr);
- /* data left in the buffer but no more macroblocks for current slice
- * group -> error */
- if (moreMbs && !currMbAddr)
- {
- EPRINT("Next mb address");
- return(HANTRO_NOK);
- }
-
- } while (moreMbs);
-
- if ((pStorage->slice->numDecodedMbs + mbCount) > pStorage->picSizeInMbs)
- {
- EPRINT("Num decoded mbs");
- return(HANTRO_NOK);
- }
-
- pStorage->slice->numDecodedMbs += mbCount;
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- 5.2 Function: SetMbParams
-
- Functional description:
- Set macroblock parameters that remain constant for this slice
-
- Inputs:
- pSlice pointer to current slice header
- sliceId id of the current slice
- chromaQpIndexOffset
-
- Outputs:
- pMb pointer to macroblock structure which is updated
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-
-void SetMbParams(mbStorage_t *pMb, sliceHeader_t *pSlice, u32 sliceId,
- i32 chromaQpIndexOffset)
-{
-
-/* Variables */
- u32 tmp1;
- i32 tmp2, tmp3;
-
-/* Code */
-
- tmp1 = pSlice->disableDeblockingFilterIdc;
- tmp2 = pSlice->sliceAlphaC0Offset;
- tmp3 = pSlice->sliceBetaOffset;
- pMb->sliceId = sliceId;
- pMb->disableDeblockingFilterIdc = tmp1;
- pMb->filterOffsetA = tmp2;
- pMb->filterOffsetB = tmp3;
- pMb->chromaQpIndexOffset = chromaQpIndexOffset;
-
-}
-
-/*------------------------------------------------------------------------------
-
- 5.3 Function name: h264bsdMarkSliceCorrupted
-
- Functional description:
- Mark macroblocks of the slice corrupted. If lastMbAddr in the slice
- storage is set -> picWidhtInMbs (or at least 10) macroblocks back
- from the lastMbAddr are marked corrupted. However, if lastMbAddr
- is not set -> all macroblocks of the slice are marked.
-
- Inputs:
- pStorage pointer to storage structure
- firstMbInSlice address of the first macroblock in the slice, this
- identifies the slice to be marked corrupted
-
- Outputs:
- pStorage mbStorage for the corrupted macroblocks updated
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-
-void h264bsdMarkSliceCorrupted(storage_t *pStorage, u32 firstMbInSlice)
-{
-
-/* Variables */
-
- u32 tmp, i;
- u32 sliceId;
- u32 currMbAddr;
-
-/* Code */
-
- ASSERT(pStorage);
- ASSERT(firstMbInSlice < pStorage->picSizeInMbs);
-
- currMbAddr = firstMbInSlice;
-
- sliceId = pStorage->slice->sliceId;
-
- /* DecodeSliceData sets lastMbAddr for I slices -> if it was set, go back
- * MAX(picWidthInMbs, 10) macroblocks and start marking from there */
- if (pStorage->slice->lastMbAddr)
- {
- ASSERT(pStorage->mb[pStorage->slice->lastMbAddr].sliceId == sliceId);
- i = pStorage->slice->lastMbAddr - 1;
- tmp = 0;
- while (i > currMbAddr)
- {
- if (pStorage->mb[i].sliceId == sliceId)
- {
- tmp++;
- if (tmp >= MAX(pStorage->activeSps->picWidthInMbs, 10))
- break;
- }
- i--;
- }
- currMbAddr = i;
- }
-
- do
- {
-
- if ( (pStorage->mb[currMbAddr].sliceId == sliceId) &&
- (pStorage->mb[currMbAddr].decoded) )
- {
- pStorage->mb[currMbAddr].decoded--;
- }
- else
- {
- break;
- }
-
- currMbAddr = h264bsdNextMbAddress(pStorage->sliceGroupMap,
- pStorage->picSizeInMbs, currMbAddr);
-
- } while (currMbAddr);
-
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_slice_data.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_slice_data.h
deleted file mode 100644
index f23d49e..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_slice_data.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_SLICE_DATA_H
-#define H264SWDEC_SLICE_DATA_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_stream.h"
-#include "h264bsd_cfg.h"
-#include "h264bsd_slice_header.h"
-#include "h264bsd_storage.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeSliceData(strmData_t *pStrmData, storage_t *pStorage,
- image_t *currImage, sliceHeader_t *pSliceHeader);
-
-void h264bsdMarkSliceCorrupted(storage_t *pStorage, u32 firstMbInSlice);
-
-#endif /* #ifdef H264SWDEC_SLICE_DATA_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_slice_group_map.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_slice_group_map.c
deleted file mode 100644
index 7cbb534..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_slice_group_map.c
+++ /dev/null
@@ -1,589 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- DecodeInterleavedMap
- DecodeDispersedMap
- DecodeForegroundLeftOverMap
- DecodeBoxOutMap
- DecodeRasterScanMap
- DecodeWipeMap
- h264bsdDecodeSliceGroupMap
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_slice_group_map.h"
-#include "h264bsd_cfg.h"
-#include "h264bsd_pic_param_set.h"
-#include "h264bsd_util.h"
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-static void DecodeInterleavedMap(
- u32 *map,
- u32 numSliceGroups,
- u32 *runLength,
- u32 picSize);
-
-static void DecodeDispersedMap(
- u32 *map,
- u32 numSliceGroups,
- u32 picWidth,
- u32 picHeight);
-
-static void DecodeForegroundLeftOverMap(
- u32 *map,
- u32 numSliceGroups,
- u32 *topLeft,
- u32 *bottomRight,
- u32 picWidth,
- u32 picHeight);
-
-static void DecodeBoxOutMap(
- u32 *map,
- u32 sliceGroupChangeDirectionFlag,
- u32 unitsInSliceGroup0,
- u32 picWidth,
- u32 picHeight);
-
-static void DecodeRasterScanMap(
- u32 *map,
- u32 sliceGroupChangeDirectionFlag,
- u32 sizeOfUpperLeftGroup,
- u32 picSize);
-
-static void DecodeWipeMap(
- u32 *map,
- u32 sliceGroupChangeDirectionFlag,
- u32 sizeOfUpperLeftGroup,
- u32 picWidth,
- u32 picHeight);
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeInterleavedMap
-
- Functional description:
- Function to decode interleaved slice group map type, i.e. slice
- group map type 0.
-
- Inputs:
- map pointer to the map
- numSliceGroups number of slice groups
- runLength run_length[] values for each slice group
- picSize picture size in macroblocks
-
- Outputs:
- map slice group map is stored here
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-
-void DecodeInterleavedMap(
- u32 *map,
- u32 numSliceGroups,
- u32 *runLength,
- u32 picSize)
-{
-
-/* Variables */
-
- u32 i,j, group;
-
-/* Code */
-
- ASSERT(map);
- ASSERT(numSliceGroups >= 1 && numSliceGroups <= MAX_NUM_SLICE_GROUPS);
- ASSERT(runLength);
-
- i = 0;
-
- do {
- for (group = 0; group < numSliceGroups && i < picSize;
- i += runLength[group++])
- {
- ASSERT(runLength[group] <= picSize);
- for (j = 0; j < runLength[group] && i + j < picSize; j++)
- map[i+j] = group;
- }
- } while (i < picSize);
-
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeDispersedMap
-
- Functional description:
- Function to decode dispersed slice group map type, i.e. slice
- group map type 1.
-
- Inputs:
- map pointer to the map
- numSliceGroups number of slice groups
- picWidth picture width in macroblocks
- picHeight picture height in macroblocks
-
- Outputs:
- map slice group map is stored here
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-
-void DecodeDispersedMap(
- u32 *map,
- u32 numSliceGroups,
- u32 picWidth,
- u32 picHeight)
-{
-
-/* Variables */
-
- u32 i, picSize;
-
-/* Code */
-
- ASSERT(map);
- ASSERT(numSliceGroups >= 1 && numSliceGroups <= MAX_NUM_SLICE_GROUPS);
- ASSERT(picWidth);
- ASSERT(picHeight);
-
- picSize = picWidth * picHeight;
-
- for (i = 0; i < picSize; i++)
- map[i] = ((i % picWidth) + (((i / picWidth) * numSliceGroups) >> 1)) %
- numSliceGroups;
-
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeForegroundLeftOverMap
-
- Functional description:
- Function to decode foreground with left-over slice group map type,
- i.e. slice group map type 2.
-
- Inputs:
- map pointer to the map
- numSliceGroups number of slice groups
- topLeft top_left[] values
- bottomRight bottom_right[] values
- picWidth picture width in macroblocks
- picHeight picture height in macroblocks
-
- Outputs:
- map slice group map is stored here
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-
-void DecodeForegroundLeftOverMap(
- u32 *map,
- u32 numSliceGroups,
- u32 *topLeft,
- u32 *bottomRight,
- u32 picWidth,
- u32 picHeight)
-{
-
-/* Variables */
-
- u32 i,y,x,yTopLeft,yBottomRight,xTopLeft,xBottomRight, picSize;
- u32 group;
-
-/* Code */
-
- ASSERT(map);
- ASSERT(numSliceGroups >= 1 && numSliceGroups <= MAX_NUM_SLICE_GROUPS);
- ASSERT(topLeft);
- ASSERT(bottomRight);
- ASSERT(picWidth);
- ASSERT(picHeight);
-
- picSize = picWidth * picHeight;
-
- for (i = 0; i < picSize; i++)
- map[i] = numSliceGroups - 1;
-
- for (group = numSliceGroups - 1; group--; )
- {
- ASSERT( topLeft[group] <= bottomRight[group] &&
- bottomRight[group] < picSize );
- yTopLeft = topLeft[group] / picWidth;
- xTopLeft = topLeft[group] % picWidth;
- yBottomRight = bottomRight[group] / picWidth;
- xBottomRight = bottomRight[group] % picWidth;
- ASSERT(xTopLeft <= xBottomRight);
-
- for (y = yTopLeft; y <= yBottomRight; y++)
- for (x = xTopLeft; x <= xBottomRight; x++)
- map[ y * picWidth + x ] = group;
- }
-
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeBoxOutMap
-
- Functional description:
- Function to decode box-out slice group map type, i.e. slice group
- map type 3.
-
- Inputs:
- map pointer to the map
- sliceGroupChangeDirectionFlag slice_group_change_direction_flag
- unitsInSliceGroup0 mbs on slice group 0
- picWidth picture width in macroblocks
- picHeight picture height in macroblocks
-
- Outputs:
- map slice group map is stored here
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-
-void DecodeBoxOutMap(
- u32 *map,
- u32 sliceGroupChangeDirectionFlag,
- u32 unitsInSliceGroup0,
- u32 picWidth,
- u32 picHeight)
-{
-
-/* Variables */
-
- u32 i, k, picSize;
- i32 x, y, xDir, yDir, leftBound, topBound, rightBound, bottomBound;
- u32 mapUnitVacant;
-
-/* Code */
-
- ASSERT(map);
- ASSERT(picWidth);
- ASSERT(picHeight);
-
- picSize = picWidth * picHeight;
- ASSERT(unitsInSliceGroup0 <= picSize);
-
- for (i = 0; i < picSize; i++)
- map[i] = 1;
-
- x = (picWidth - (u32)sliceGroupChangeDirectionFlag) >> 1;
- y = (picHeight - (u32)sliceGroupChangeDirectionFlag) >> 1;
-
- leftBound = x;
- topBound = y;
-
- rightBound = x;
- bottomBound = y;
-
- xDir = (i32)sliceGroupChangeDirectionFlag - 1;
- yDir = (i32)sliceGroupChangeDirectionFlag;
-
- for (k = 0; k < unitsInSliceGroup0; k += mapUnitVacant ? 1 : 0)
- {
- mapUnitVacant = (map[ (u32)y * picWidth + (u32)x ] == 1) ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- if (mapUnitVacant)
- map[ (u32)y * picWidth + (u32)x ] = 0;
-
- if (xDir == -1 && x == leftBound)
- {
- leftBound = MAX(leftBound - 1, 0);
- x = leftBound;
- xDir = 0;
- yDir = 2 * (i32)sliceGroupChangeDirectionFlag - 1;
- }
- else if (xDir == 1 && x == rightBound)
- {
- rightBound = MIN(rightBound + 1, (i32)picWidth - 1);
- x = rightBound;
- xDir = 0;
- yDir = 1 - 2 * (i32)sliceGroupChangeDirectionFlag;
- }
- else if (yDir == -1 && y == topBound)
- {
- topBound = MAX(topBound - 1, 0);
- y = topBound;
- xDir = 1 - 2 * (i32)sliceGroupChangeDirectionFlag;
- yDir = 0;
- }
- else if (yDir == 1 && y == bottomBound)
- {
- bottomBound = MIN(bottomBound + 1, (i32)picHeight - 1);
- y = bottomBound;
- xDir = 2 * (i32)sliceGroupChangeDirectionFlag - 1;
- yDir = 0;
- }
- else
- {
- x += xDir;
- y += yDir;
- }
- }
-
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeRasterScanMap
-
- Functional description:
- Function to decode raster scan slice group map type, i.e. slice
- group map type 4.
-
- Inputs:
- map pointer to the map
- sliceGroupChangeDirectionFlag slice_group_change_direction_flag
- sizeOfUpperLeftGroup mbs in upperLeftGroup
- picSize picture size in macroblocks
-
- Outputs:
- map slice group map is stored here
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-
-void DecodeRasterScanMap(
- u32 *map,
- u32 sliceGroupChangeDirectionFlag,
- u32 sizeOfUpperLeftGroup,
- u32 picSize)
-{
-
-/* Variables */
-
- u32 i;
-
-/* Code */
-
- ASSERT(map);
- ASSERT(picSize);
- ASSERT(sizeOfUpperLeftGroup <= picSize);
-
- for (i = 0; i < picSize; i++)
- if (i < sizeOfUpperLeftGroup)
- map[i] = (u32)sliceGroupChangeDirectionFlag;
- else
- map[i] = 1 - (u32)sliceGroupChangeDirectionFlag;
-
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeWipeMap
-
- Functional description:
- Function to decode wipe slice group map type, i.e. slice group map
- type 5.
-
- Inputs:
- sliceGroupChangeDirectionFlag slice_group_change_direction_flag
- sizeOfUpperLeftGroup mbs in upperLeftGroup
- picWidth picture width in macroblocks
- picHeight picture height in macroblocks
-
- Outputs:
- map slice group map is stored here
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-
-void DecodeWipeMap(
- u32 *map,
- u32 sliceGroupChangeDirectionFlag,
- u32 sizeOfUpperLeftGroup,
- u32 picWidth,
- u32 picHeight)
-{
-
-/* Variables */
-
- u32 i,j,k;
-
-/* Code */
-
- ASSERT(map);
- ASSERT(picWidth);
- ASSERT(picHeight);
- ASSERT(sizeOfUpperLeftGroup <= picWidth * picHeight);
-
- k = 0;
- for (j = 0; j < picWidth; j++)
- for (i = 0; i < picHeight; i++)
- if (k++ < sizeOfUpperLeftGroup)
- map[ i * picWidth + j ] = (u32)sliceGroupChangeDirectionFlag;
- else
- map[ i * picWidth + j ] = 1 -
- (u32)sliceGroupChangeDirectionFlag;
-
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdDecodeSliceGroupMap
-
- Functional description:
- Function to decode macroblock to slice group map. Construction
- of different slice group map types is handled by separate
- functions defined above. See standard for details how slice group
- maps are computed.
-
- Inputs:
- pps active picture parameter set
- sliceGroupChangeCycle slice_group_change_cycle
- picWidth picture width in macroblocks
- picHeight picture height in macroblocks
-
- Outputs:
- map slice group map is stored here
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-
-void h264bsdDecodeSliceGroupMap(
- u32 *map,
- picParamSet_t *pps,
- u32 sliceGroupChangeCycle,
- u32 picWidth,
- u32 picHeight)
-{
-
-/* Variables */
-
- u32 i, picSize, unitsInSliceGroup0 = 0, sizeOfUpperLeftGroup = 0;
-
-/* Code */
-
- ASSERT(map);
- ASSERT(pps);
- ASSERT(picWidth);
- ASSERT(picHeight);
- ASSERT(pps->sliceGroupMapType < 7);
-
- picSize = picWidth * picHeight;
-
- /* just one slice group -> all macroblocks belong to group 0 */
- if (pps->numSliceGroups == 1)
- {
- H264SwDecMemset(map, 0, picSize * sizeof(u32));
- return;
- }
-
- if (pps->sliceGroupMapType > 2 && pps->sliceGroupMapType < 6)
- {
- ASSERT(pps->sliceGroupChangeRate &&
- pps->sliceGroupChangeRate <= picSize);
-
- unitsInSliceGroup0 =
- MIN(sliceGroupChangeCycle * pps->sliceGroupChangeRate, picSize);
-
- if (pps->sliceGroupMapType == 4 || pps->sliceGroupMapType == 5)
- sizeOfUpperLeftGroup = pps->sliceGroupChangeDirectionFlag ?
- (picSize - unitsInSliceGroup0) : unitsInSliceGroup0;
- }
-
- switch (pps->sliceGroupMapType)
- {
- case 0:
- DecodeInterleavedMap(map, pps->numSliceGroups,
- pps->runLength, picSize);
- break;
-
- case 1:
- DecodeDispersedMap(map, pps->numSliceGroups, picWidth,
- picHeight);
- break;
-
- case 2:
- DecodeForegroundLeftOverMap(map, pps->numSliceGroups,
- pps->topLeft, pps->bottomRight, picWidth, picHeight);
- break;
-
- case 3:
- DecodeBoxOutMap(map, pps->sliceGroupChangeDirectionFlag,
- unitsInSliceGroup0, picWidth, picHeight);
- break;
-
- case 4:
- DecodeRasterScanMap(map,
- pps->sliceGroupChangeDirectionFlag, sizeOfUpperLeftGroup,
- picSize);
- break;
-
- case 5:
- DecodeWipeMap(map, pps->sliceGroupChangeDirectionFlag,
- sizeOfUpperLeftGroup, picWidth, picHeight);
- break;
-
- default:
- ASSERT(pps->sliceGroupId);
- for (i = 0; i < picSize; i++)
- {
- ASSERT(pps->sliceGroupId[i] < pps->numSliceGroups);
- map[i] = pps->sliceGroupId[i];
- }
- break;
- }
-
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_slice_group_map.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_slice_group_map.h
deleted file mode 100644
index 4bcb6f2..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_slice_group_map.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_SLICE_GROUP_MAP_H
-#define H264SWDEC_SLICE_GROUP_MAP_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_pic_param_set.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-void h264bsdDecodeSliceGroupMap(
- u32 *map,
- picParamSet_t *pps,
- u32 sliceGroupChangeCycle,
- u32 picWidth,
- u32 picHeight);
-
-#endif /* #ifdef H264SWDEC_SLICE_GROUP_MAP_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_slice_header.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_slice_header.c
deleted file mode 100644
index 23401c6..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_slice_header.c
+++ /dev/null
@@ -1,1514 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdDecodeSliceHeader
- NumSliceGroupChangeCycleBits
- RefPicListReordering
- DecRefPicMarking
- CheckPpsId
- CheckFrameNum
- CheckIdrPicId
- CheckPicOrderCntLsb
- CheckDeltaPicOrderCntBottom
- CheckDeltaPicOrderCnt
- CheckRedundantPicCnt
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_slice_header.h"
-#include "h264bsd_util.h"
-#include "h264bsd_vlc.h"
-#include "h264bsd_nal_unit.h"
-#include "h264bsd_dpb.h"
-
-#define UNUSED(x) (void)(x)
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-static u32 RefPicListReordering(strmData_t *, refPicListReordering_t *,
- u32, u32);
-
-static u32 NumSliceGroupChangeCycleBits(u32 picSizeInMbs,
- u32 sliceGroupChangeRate);
-
-static u32 DecRefPicMarking(strmData_t *pStrmData,
- decRefPicMarking_t *pDecRefPicMarking, nalUnitType_e nalUnitType,
- u32 numRefFrames);
-
-
-/*------------------------------------------------------------------------------
-
- Function name: h264bsdDecodeSliceHeader
-
- Functional description:
- Decode slice header data from the stream.
-
- Inputs:
- pStrmData pointer to stream data structure
- pSeqParamSet pointer to active sequence parameter set
- pPicParamSet pointer to active picture parameter set
- pNalUnit pointer to current NAL unit structure
-
- Outputs:
- pSliceHeader decoded data is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK invalid stream data or end of stream
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeSliceHeader(strmData_t *pStrmData, sliceHeader_t *pSliceHeader,
- seqParamSet_t *pSeqParamSet, picParamSet_t *pPicParamSet,
- nalUnit_t *pNalUnit)
-{
-
-/* Variables */
-
- u32 tmp, i, value;
- i32 itmp;
- u32 picSizeInMbs;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pSliceHeader);
- ASSERT(pSeqParamSet);
- ASSERT(pPicParamSet);
- ASSERT( pNalUnit->nalUnitType == NAL_CODED_SLICE ||
- pNalUnit->nalUnitType == NAL_CODED_SLICE_IDR );
-
-
- H264SwDecMemset(pSliceHeader, 0, sizeof(sliceHeader_t));
-
- picSizeInMbs = pSeqParamSet->picWidthInMbs * pSeqParamSet->picHeightInMbs;
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- pSliceHeader->firstMbInSlice = value;
- if (value >= picSizeInMbs)
- {
- EPRINT("first_mb_in_slice");
- return(HANTRO_NOK);
- }
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- pSliceHeader->sliceType = value;
- /* slice type has to be either I or P slice. P slice is not allowed when
- * current NAL unit is an IDR NAL unit or num_ref_frames is 0 */
- if ( !IS_I_SLICE(pSliceHeader->sliceType) &&
- ( !IS_P_SLICE(pSliceHeader->sliceType) ||
- IS_IDR_NAL_UNIT(pNalUnit) ||
- !pSeqParamSet->numRefFrames ) )
- {
- EPRINT("slice_type");
- return(HANTRO_NOK);
- }
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- pSliceHeader->picParameterSetId = value;
- if (pSliceHeader->picParameterSetId != pPicParamSet->picParameterSetId)
- {
- EPRINT("pic_parameter_set_id");
- return(HANTRO_NOK);
- }
-
- /* log2(maxFrameNum) -> num bits to represent frame_num */
- i = 0;
- while (pSeqParamSet->maxFrameNum >> i)
- i++;
- i--;
-
- tmp = h264bsdGetBits(pStrmData, i);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- if (IS_IDR_NAL_UNIT(pNalUnit) && tmp != 0)
- {
- EPRINT("frame_num");
- return(HANTRO_NOK);
- }
- pSliceHeader->frameNum = tmp;
-
- if (IS_IDR_NAL_UNIT(pNalUnit))
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- pSliceHeader->idrPicId = value;
- if (value > 65535)
- {
- EPRINT("idr_pic_id");
- return(HANTRO_NOK);
- }
- }
-
- if (pSeqParamSet->picOrderCntType == 0)
- {
- /* log2(maxPicOrderCntLsb) -> num bits to represent pic_order_cnt_lsb */
- i = 0;
- while (pSeqParamSet->maxPicOrderCntLsb >> i)
- i++;
- i--;
-
- tmp = h264bsdGetBits(pStrmData, i);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSliceHeader->picOrderCntLsb = tmp;
-
- if (pPicParamSet->picOrderPresentFlag)
- {
- tmp = h264bsdDecodeExpGolombSigned(pStrmData, &itmp);
- if (tmp != HANTRO_OK)
- return(tmp);
- pSliceHeader->deltaPicOrderCntBottom = itmp;
- }
-
- /* check that picOrderCnt for IDR picture will be zero. See
- * DecodePicOrderCnt function to understand the logic here */
- if ( IS_IDR_NAL_UNIT(pNalUnit) &&
- ( (pSliceHeader->picOrderCntLsb >
- pSeqParamSet->maxPicOrderCntLsb/2) ||
- MIN((i32)pSliceHeader->picOrderCntLsb,
- (i32)pSliceHeader->picOrderCntLsb +
- pSliceHeader->deltaPicOrderCntBottom) != 0 ) )
- {
- return(HANTRO_NOK);
- }
- }
-
- if ( (pSeqParamSet->picOrderCntType == 1) &&
- !pSeqParamSet->deltaPicOrderAlwaysZeroFlag )
- {
- tmp = h264bsdDecodeExpGolombSigned(pStrmData, &itmp);
- if (tmp != HANTRO_OK)
- return(tmp);
- pSliceHeader->deltaPicOrderCnt[0] = itmp;
-
- if (pPicParamSet->picOrderPresentFlag)
- {
- tmp = h264bsdDecodeExpGolombSigned(pStrmData, &itmp);
- if (tmp != HANTRO_OK)
- return(tmp);
- pSliceHeader->deltaPicOrderCnt[1] = itmp;
- }
-
- /* check that picOrderCnt for IDR picture will be zero. See
- * DecodePicOrderCnt function to understand the logic here */
- if ( IS_IDR_NAL_UNIT(pNalUnit) &&
- MIN(pSliceHeader->deltaPicOrderCnt[0],
- pSliceHeader->deltaPicOrderCnt[0] +
- pSeqParamSet->offsetForTopToBottomField +
- pSliceHeader->deltaPicOrderCnt[1]) != 0)
- {
- return(HANTRO_NOK);
- }
- }
-
- if (pPicParamSet->redundantPicCntPresentFlag)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- pSliceHeader->redundantPicCnt = value;
- if (value > 127)
- {
- EPRINT("redundant_pic_cnt");
- return(HANTRO_NOK);
- }
- }
-
- if (IS_P_SLICE(pSliceHeader->sliceType))
- {
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pSliceHeader->numRefIdxActiveOverrideFlag = tmp;
-
- if (pSliceHeader->numRefIdxActiveOverrideFlag)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (value > 15)
- {
- EPRINT("num_ref_idx_l0_active_minus1");
- return(HANTRO_NOK);
- }
- pSliceHeader->numRefIdxL0Active = value + 1;
- }
- /* set numRefIdxL0Active from pic param set */
- else
- {
- /* if value (minus1) in picture parameter set exceeds 15 it should
- * have been overridden here */
- if (pPicParamSet->numRefIdxL0Active > 16)
- {
- EPRINT("num_ref_idx_active_override_flag");
- return(HANTRO_NOK);
- }
- pSliceHeader->numRefIdxL0Active = pPicParamSet->numRefIdxL0Active;
- }
- }
-
- if (IS_P_SLICE(pSliceHeader->sliceType))
- {
- tmp = RefPicListReordering(pStrmData,
- &pSliceHeader->refPicListReordering,
- pSliceHeader->numRefIdxL0Active,
- pSeqParamSet->maxFrameNum);
- if (tmp != HANTRO_OK)
- return(tmp);
- }
-
- if (pNalUnit->nalRefIdc != 0)
- {
- tmp = DecRefPicMarking(pStrmData, &pSliceHeader->decRefPicMarking,
- pNalUnit->nalUnitType, pSeqParamSet->numRefFrames);
- if (tmp != HANTRO_OK)
- return(tmp);
- }
-
- /* decode sliceQpDelta and check that initial QP for the slice will be on
- * the range [0, 51] */
- tmp = h264bsdDecodeExpGolombSigned(pStrmData, &itmp);
- if (tmp != HANTRO_OK)
- return(tmp);
- pSliceHeader->sliceQpDelta = itmp;
- itmp += (i32)pPicParamSet->picInitQp;
- if ( (itmp < 0) || (itmp > 51) )
- {
- EPRINT("slice_qp_delta");
- return(HANTRO_NOK);
- }
-
- if (pPicParamSet->deblockingFilterControlPresentFlag)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- pSliceHeader->disableDeblockingFilterIdc = value;
- if (pSliceHeader->disableDeblockingFilterIdc > 2)
- {
- EPRINT("disable_deblocking_filter_idc");
- return(HANTRO_NOK);
- }
-
- if (pSliceHeader->disableDeblockingFilterIdc != 1)
- {
- tmp = h264bsdDecodeExpGolombSigned(pStrmData, &itmp);
- if (tmp != HANTRO_OK)
- return(tmp);
- if ( (itmp < -6) || (itmp > 6) )
- {
- EPRINT("slice_alpha_c0_offset_div2");
- return(HANTRO_NOK);
- }
- pSliceHeader->sliceAlphaC0Offset = itmp * 2;
-
- tmp = h264bsdDecodeExpGolombSigned(pStrmData, &itmp);
- if (tmp != HANTRO_OK)
- return(tmp);
- if ( (itmp < -6) || (itmp > 6) )
- {
- EPRINT("slice_beta_offset_div2");
- return(HANTRO_NOK);
- }
- pSliceHeader->sliceBetaOffset = itmp * 2;
- }
- }
-
- if ( (pPicParamSet->numSliceGroups > 1) &&
- (pPicParamSet->sliceGroupMapType >= 3) &&
- (pPicParamSet->sliceGroupMapType <= 5) )
- {
- /* set tmp to number of bits used to represent slice_group_change_cycle
- * in the stream */
- tmp = NumSliceGroupChangeCycleBits(picSizeInMbs,
- pPicParamSet->sliceGroupChangeRate);
- value = h264bsdGetBits(pStrmData, tmp);
- if (value == END_OF_STREAM)
- return(HANTRO_NOK);
- pSliceHeader->sliceGroupChangeCycle = value;
-
- /* corresponds to tmp = Ceil(picSizeInMbs / sliceGroupChangeRate) */
- tmp = (picSizeInMbs + pPicParamSet->sliceGroupChangeRate - 1) /
- pPicParamSet->sliceGroupChangeRate;
- if (pSliceHeader->sliceGroupChangeCycle > tmp)
- {
- EPRINT("slice_group_change_cycle");
- return(HANTRO_NOK);
- }
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: NumSliceGroupChangeCycleBits
-
- Functional description:
- Determine number of bits needed to represent
- slice_group_change_cycle in the stream. The standard states that
- slice_group_change_cycle is represented by
- Ceil( Log2( (picSizeInMbs / sliceGroupChangeRate) + 1) )
-
- bits. Division "/" in the equation is non-truncating division.
-
- Inputs:
- picSizeInMbs picture size in macroblocks
- sliceGroupChangeRate
-
- Outputs:
- none
-
- Returns:
- number of bits needed
-
-------------------------------------------------------------------------------*/
-
-u32 NumSliceGroupChangeCycleBits(u32 picSizeInMbs, u32 sliceGroupChangeRate)
-{
-
-/* Variables */
-
- u32 tmp,numBits,mask;
-
-/* Code */
-
- ASSERT(picSizeInMbs);
- ASSERT(sliceGroupChangeRate);
- ASSERT(sliceGroupChangeRate <= picSizeInMbs);
-
- /* compute (picSizeInMbs / sliceGroupChangeRate + 1), rounded up */
- if (picSizeInMbs % sliceGroupChangeRate)
- tmp = 2 + picSizeInMbs/sliceGroupChangeRate;
- else
- tmp = 1 + picSizeInMbs/sliceGroupChangeRate;
-
- numBits = 0;
- mask = ~0U;
-
- /* set numBits to position of right-most non-zero bit */
- while (tmp & (mask<<++numBits))
- ;
- numBits--;
-
- /* add one more bit if value greater than 2^numBits */
- if (tmp & ((1<<numBits)-1))
- numBits++;
-
- return(numBits);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: RefPicListReordering
-
- Functional description:
- Decode reference picture list reordering syntax elements from
- the stream. Max number of reordering commands is numRefIdxActive.
-
- Inputs:
- pStrmData pointer to stream data structure
- numRefIdxActive number of active reference indices to be used for
- current slice
- maxPicNum maxFrameNum from the active SPS
-
- Outputs:
- pRefPicListReordering decoded data is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK invalid stream data
-
-------------------------------------------------------------------------------*/
-
-u32 RefPicListReordering(strmData_t *pStrmData,
- refPicListReordering_t *pRefPicListReordering, u32 numRefIdxActive,
- u32 maxPicNum)
-{
-
-/* Variables */
-
- u32 tmp, value, i;
- u32 command;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pRefPicListReordering);
- ASSERT(numRefIdxActive);
- ASSERT(maxPicNum);
-
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
-
- pRefPicListReordering->refPicListReorderingFlagL0 = tmp;
-
- if (pRefPicListReordering->refPicListReorderingFlagL0)
- {
- i = 0;
-
- do
- {
- if (i > numRefIdxActive)
- {
- EPRINT("Too many reordering commands");
- return(HANTRO_NOK);
- }
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &command);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (command > 3)
- {
- EPRINT("reordering_of_pic_nums_idc");
- return(HANTRO_NOK);
- }
-
- pRefPicListReordering->command[i].reorderingOfPicNumsIdc = command;
-
- if ((command == 0) || (command == 1))
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (value >= maxPicNum)
- {
- EPRINT("abs_diff_pic_num_minus1");
- return(HANTRO_NOK);
- }
- pRefPicListReordering->command[i].absDiffPicNum = value + 1;
- }
- else if (command == 2)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- pRefPicListReordering->command[i].longTermPicNum = value;
- }
- i++;
- } while (command != 3);
-
- /* there shall be at least one reordering command if
- * refPicListReorderingFlagL0 was set */
- if (i == 1)
- {
- EPRINT("ref_pic_list_reordering");
- return(HANTRO_NOK);
- }
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecRefPicMarking
-
- Functional description:
- Decode decoded reference picture marking syntax elements from
- the stream.
-
- Inputs:
- pStrmData pointer to stream data structure
- nalUnitType type of the current NAL unit
- numRefFrames max number of reference frames from the active SPS
-
- Outputs:
- pDecRefPicMarking decoded data is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK invalid stream data
-
-------------------------------------------------------------------------------*/
-
-u32 DecRefPicMarking(strmData_t *pStrmData,
- decRefPicMarking_t *pDecRefPicMarking, nalUnitType_e nalUnitType,
- u32 numRefFrames)
-{
-
-/* Variables */
-
- u32 tmp, value;
- u32 i;
- u32 operation;
- /* variables for error checking purposes, store number of memory
- * management operations of certain type */
- u32 num4 = 0, num5 = 0, num6 = 0, num1to3 = 0;
-
-/* Code */
-
- ASSERT( nalUnitType == NAL_CODED_SLICE_IDR ||
- nalUnitType == NAL_CODED_SLICE ||
- nalUnitType == NAL_SEI );
-
-
- if (nalUnitType == NAL_CODED_SLICE_IDR)
- {
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pDecRefPicMarking->noOutputOfPriorPicsFlag = tmp;
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pDecRefPicMarking->longTermReferenceFlag = tmp;
- if (!numRefFrames && pDecRefPicMarking->longTermReferenceFlag)
- {
- EPRINT("long_term_reference_flag");
- return(HANTRO_NOK);
- }
- }
- else
- {
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pDecRefPicMarking->adaptiveRefPicMarkingModeFlag = tmp;
- if (pDecRefPicMarking->adaptiveRefPicMarkingModeFlag)
- {
- i = 0;
- do
- {
- /* see explanation of the MAX_NUM_MMC_OPERATIONS in
- * slice_header.h */
- if (i > (2 * numRefFrames + 2))
- {
- EPRINT("Too many management operations");
- return(HANTRO_NOK);
- }
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &operation);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (operation > 6)
- {
- EPRINT("memory_management_control_operation");
- return(HANTRO_NOK);
- }
-
- pDecRefPicMarking->operation[i].
- memoryManagementControlOperation = operation;
- if ((operation == 1) || (operation == 3))
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- pDecRefPicMarking->operation[i].differenceOfPicNums =
- value + 1;
- }
- if (operation == 2)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- pDecRefPicMarking->operation[i].longTermPicNum = value;
- }
- if ((operation == 3) || (operation == 6))
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- pDecRefPicMarking->operation[i].longTermFrameIdx =
- value;
- }
- if (operation == 4)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- /* value shall be in range [0, numRefFrames] */
- if (value > numRefFrames)
- {
- EPRINT("max_long_term_frame_idx_plus1");
- return(HANTRO_NOK);
- }
- if (value == 0)
- {
- pDecRefPicMarking->operation[i].
- maxLongTermFrameIdx =
- NO_LONG_TERM_FRAME_INDICES;
- }
- else
- {
- pDecRefPicMarking->operation[i].
- maxLongTermFrameIdx = value - 1;
- }
- num4++;
- }
- if (operation == 5)
- {
- num5++;
- }
- if (operation && operation <= 3)
- num1to3++;
- if (operation == 6)
- num6++;
-
- i++;
- } while (operation != 0);
-
- /* error checking */
- if (num4 > 1 || num5 > 1 || num6 > 1 || (num1to3 && num5))
- return(HANTRO_NOK);
-
- }
- }
-
- return(HANTRO_OK);
-}
-
-/*------------------------------------------------------------------------------
-
- Function name: h264bsdCheckPpsId
-
- Functional description:
- Peek value of pic_parameter_set_id from the slice header. Function
- does not modify current stream positions but copies the stream
- data structure to tmp structure which is used while accessing
- stream data.
-
- Inputs:
- pStrmData pointer to stream data structure
-
- Outputs:
- picParamSetId value is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK invalid stream data
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdCheckPpsId(strmData_t *pStrmData, u32 *picParamSetId)
-{
-
-/* Variables */
-
- u32 tmp, value;
- strmData_t tmpStrmData[1];
-
-/* Code */
-
- ASSERT(pStrmData);
-
- /* don't touch original stream position params */
- *tmpStrmData = *pStrmData;
-
- /* first_mb_in_slice */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* slice_type */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (value >= MAX_NUM_PIC_PARAM_SETS)
- return(HANTRO_NOK);
-
- *picParamSetId = value;
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdCheckFrameNum
-
- Functional description:
- Peek value of frame_num from the slice header. Function does not
- modify current stream positions but copies the stream data
- structure to tmp structure which is used while accessing stream
- data.
-
- Inputs:
- pStrmData pointer to stream data structure
- maxFrameNum
-
- Outputs:
- frameNum value is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK invalid stream data
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdCheckFrameNum(
- strmData_t *pStrmData,
- u32 maxFrameNum,
- u32 *frameNum)
-{
-
-/* Variables */
-
- u32 tmp, value, i;
- strmData_t tmpStrmData[1];
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(maxFrameNum);
- ASSERT(frameNum);
-
- /* don't touch original stream position params */
- *tmpStrmData = *pStrmData;
-
- /* skip first_mb_in_slice */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* skip slice_type */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* skip pic_parameter_set_id */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* log2(maxFrameNum) -> num bits to represent frame_num */
- i = 0;
- while (maxFrameNum >> i)
- i++;
- i--;
-
- /* frame_num */
- tmp = h264bsdGetBits(tmpStrmData, i);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- *frameNum = tmp;
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdCheckIdrPicId
-
- Functional description:
- Peek value of idr_pic_id from the slice header. Function does not
- modify current stream positions but copies the stream data
- structure to tmp structure which is used while accessing stream
- data.
-
- Inputs:
- pStrmData pointer to stream data structure
- maxFrameNum max frame number from active SPS
- nalUnitType type of the current NAL unit
-
- Outputs:
- idrPicId value is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK invalid stream data
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdCheckIdrPicId(
- strmData_t *pStrmData,
- u32 maxFrameNum,
- nalUnitType_e nalUnitType,
- u32 *idrPicId)
-{
-
-/* Variables */
-
- u32 tmp, value, i;
- strmData_t tmpStrmData[1];
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(maxFrameNum);
- ASSERT(idrPicId);
-
- /* nalUnitType must be equal to 5 because otherwise idrPicId is not
- * present */
- if (nalUnitType != NAL_CODED_SLICE_IDR)
- return(HANTRO_NOK);
-
- /* don't touch original stream position params */
- *tmpStrmData = *pStrmData;
-
- /* skip first_mb_in_slice */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* skip slice_type */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* skip pic_parameter_set_id */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* log2(maxFrameNum) -> num bits to represent frame_num */
- i = 0;
- while (maxFrameNum >> i)
- i++;
- i--;
-
- /* skip frame_num */
- tmp = h264bsdGetBits(tmpStrmData, i);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
-
- /* idr_pic_id */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, idrPicId);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdCheckPicOrderCntLsb
-
- Functional description:
- Peek value of pic_order_cnt_lsb from the slice header. Function
- does not modify current stream positions but copies the stream
- data structure to tmp structure which is used while accessing
- stream data.
-
- Inputs:
- pStrmData pointer to stream data structure
- pSeqParamSet pointer to active SPS
- nalUnitType type of the current NAL unit
-
- Outputs:
- picOrderCntLsb value is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK invalid stream data
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdCheckPicOrderCntLsb(
- strmData_t *pStrmData,
- seqParamSet_t *pSeqParamSet,
- nalUnitType_e nalUnitType,
- u32 *picOrderCntLsb)
-{
-
-/* Variables */
-
- u32 tmp, value, i;
- strmData_t tmpStrmData[1];
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pSeqParamSet);
- ASSERT(picOrderCntLsb);
-
- /* picOrderCntType must be equal to 0 */
- ASSERT(pSeqParamSet->picOrderCntType == 0);
- ASSERT(pSeqParamSet->maxFrameNum);
- ASSERT(pSeqParamSet->maxPicOrderCntLsb);
-
- /* don't touch original stream position params */
- *tmpStrmData = *pStrmData;
-
- /* skip first_mb_in_slice */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* skip slice_type */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* skip pic_parameter_set_id */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* log2(maxFrameNum) -> num bits to represent frame_num */
- i = 0;
- while (pSeqParamSet->maxFrameNum >> i)
- i++;
- i--;
-
- /* skip frame_num */
- tmp = h264bsdGetBits(tmpStrmData, i);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
-
- /* skip idr_pic_id when necessary */
- if (nalUnitType == NAL_CODED_SLICE_IDR)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- }
-
- /* log2(maxPicOrderCntLsb) -> num bits to represent pic_order_cnt_lsb */
- i = 0;
- while (pSeqParamSet->maxPicOrderCntLsb >> i)
- i++;
- i--;
-
- /* pic_order_cnt_lsb */
- tmp = h264bsdGetBits(tmpStrmData, i);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- *picOrderCntLsb = tmp;
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdCheckDeltaPicOrderCntBottom
-
- Functional description:
- Peek value of delta_pic_order_cnt_bottom from the slice header.
- Function does not modify current stream positions but copies the
- stream data structure to tmp structure which is used while
- accessing stream data.
-
- Inputs:
- pStrmData pointer to stream data structure
- pSeqParamSet pointer to active SPS
- nalUnitType type of the current NAL unit
-
- Outputs:
- deltaPicOrderCntBottom value is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK invalid stream data
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdCheckDeltaPicOrderCntBottom(
- strmData_t *pStrmData,
- seqParamSet_t *pSeqParamSet,
- nalUnitType_e nalUnitType,
- i32 *deltaPicOrderCntBottom)
-{
-
-/* Variables */
-
- u32 tmp, value, i;
- strmData_t tmpStrmData[1];
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pSeqParamSet);
- ASSERT(deltaPicOrderCntBottom);
-
- /* picOrderCntType must be equal to 0 and picOrderPresentFlag must be TRUE
- * */
- ASSERT(pSeqParamSet->picOrderCntType == 0);
- ASSERT(pSeqParamSet->maxFrameNum);
- ASSERT(pSeqParamSet->maxPicOrderCntLsb);
-
- /* don't touch original stream position params */
- *tmpStrmData = *pStrmData;
-
- /* skip first_mb_in_slice */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* skip slice_type */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* skip pic_parameter_set_id */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* log2(maxFrameNum) -> num bits to represent frame_num */
- i = 0;
- while (pSeqParamSet->maxFrameNum >> i)
- i++;
- i--;
-
- /* skip frame_num */
- tmp = h264bsdGetBits(tmpStrmData, i);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
-
- /* skip idr_pic_id when necessary */
- if (nalUnitType == NAL_CODED_SLICE_IDR)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- }
-
- /* log2(maxPicOrderCntLsb) -> num bits to represent pic_order_cnt_lsb */
- i = 0;
- while (pSeqParamSet->maxPicOrderCntLsb >> i)
- i++;
- i--;
-
- /* skip pic_order_cnt_lsb */
- tmp = h264bsdGetBits(tmpStrmData, i);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
-
- /* delta_pic_order_cnt_bottom */
- tmp = h264bsdDecodeExpGolombSigned(tmpStrmData, deltaPicOrderCntBottom);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdCheckDeltaPicOrderCnt
-
- Functional description:
- Peek values delta_pic_order_cnt[0] and delta_pic_order_cnt[1]
- from the slice header. Function does not modify current stream
- positions but copies the stream data structure to tmp structure
- which is used while accessing stream data.
-
- Inputs:
- pStrmData pointer to stream data structure
- pSeqParamSet pointer to active SPS
- nalUnitType type of the current NAL unit
- picOrderPresentFlag flag indicating if delta_pic_order_cnt[1]
- is present in the stream
-
- Outputs:
- deltaPicOrderCnt values are stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK invalid stream data
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdCheckDeltaPicOrderCnt(
- strmData_t *pStrmData,
- seqParamSet_t *pSeqParamSet,
- nalUnitType_e nalUnitType,
- u32 picOrderPresentFlag,
- i32 *deltaPicOrderCnt)
-{
-
-/* Variables */
-
- u32 tmp, value, i;
- strmData_t tmpStrmData[1];
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pSeqParamSet);
- ASSERT(deltaPicOrderCnt);
-
- /* picOrderCntType must be equal to 1 and deltaPicOrderAlwaysZeroFlag must
- * be FALSE */
- ASSERT(pSeqParamSet->picOrderCntType == 1);
- ASSERT(!pSeqParamSet->deltaPicOrderAlwaysZeroFlag);
- ASSERT(pSeqParamSet->maxFrameNum);
-
- /* don't touch original stream position params */
- *tmpStrmData = *pStrmData;
-
- /* skip first_mb_in_slice */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* skip slice_type */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* skip pic_parameter_set_id */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* log2(maxFrameNum) -> num bits to represent frame_num */
- i = 0;
- while (pSeqParamSet->maxFrameNum >> i)
- i++;
- i--;
-
- /* skip frame_num */
- tmp = h264bsdGetBits(tmpStrmData, i);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
-
- /* skip idr_pic_id when necessary */
- if (nalUnitType == NAL_CODED_SLICE_IDR)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- }
-
- /* delta_pic_order_cnt[0] */
- tmp = h264bsdDecodeExpGolombSigned(tmpStrmData, &deltaPicOrderCnt[0]);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* delta_pic_order_cnt[1] if present */
- if (picOrderPresentFlag)
- {
- tmp = h264bsdDecodeExpGolombSigned(tmpStrmData, &deltaPicOrderCnt[1]);
- if (tmp != HANTRO_OK)
- return(tmp);
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdCheckRedundantPicCnt
-
- Functional description:
- Peek value of redundant_pic_cnt from the slice header. Function
- does not modify current stream positions but copies the stream
- data structure to tmp structure which is used while accessing
- stream data.
-
- Inputs:
- pStrmData pointer to stream data structure
- pSeqParamSet pointer to active SPS
- pPicParamSet pointer to active PPS
- nalUnitType type of the current NAL unit
-
- Outputs:
- redundantPicCnt value is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK invalid stream data
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdCheckRedundantPicCnt(
- strmData_t *pStrmData,
- seqParamSet_t *pSeqParamSet,
- picParamSet_t *pPicParamSet,
- nalUnitType_e nalUnitType,
- u32 *redundantPicCnt)
-{
-
-/* Variables */
-
- u32 tmp, value, i;
- i32 ivalue;
- strmData_t tmpStrmData[1];
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pSeqParamSet);
- ASSERT(pPicParamSet);
- ASSERT(redundantPicCnt);
-
- /* redundant_pic_cnt_flag must be TRUE */
- ASSERT(pPicParamSet->redundantPicCntPresentFlag);
- ASSERT(pSeqParamSet->maxFrameNum);
- ASSERT(pSeqParamSet->picOrderCntType > 0 ||
- pSeqParamSet->maxPicOrderCntLsb);
-
- /* don't touch original stream position params */
- *tmpStrmData = *pStrmData;
-
- /* skip first_mb_in_slice */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* skip slice_type */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* skip pic_parameter_set_id */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* log2(maxFrameNum) -> num bits to represent frame_num */
- i = 0;
- while (pSeqParamSet->maxFrameNum >> i)
- i++;
- i--;
-
- /* skip frame_num */
- tmp = h264bsdGetBits(tmpStrmData, i);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
-
- /* skip idr_pic_id when necessary */
- if (nalUnitType == NAL_CODED_SLICE_IDR)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if (tmp != HANTRO_OK)
- return(tmp);
- }
-
- if (pSeqParamSet->picOrderCntType == 0)
- {
- /* log2(maxPicOrderCntLsb) -> num bits to represent pic_order_cnt_lsb */
- i = 0;
- while (pSeqParamSet->maxPicOrderCntLsb >> i)
- i++;
- i--;
-
- /* pic_order_cnt_lsb */
- tmp = h264bsdGetBits(tmpStrmData, i);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
-
- if (pPicParamSet->picOrderPresentFlag)
- {
- /* skip delta_pic_order_cnt_bottom */
- tmp = h264bsdDecodeExpGolombSigned(tmpStrmData, &ivalue);
- if (tmp != HANTRO_OK)
- return(tmp);
- }
- }
-
- if (pSeqParamSet->picOrderCntType == 1 &&
- !pSeqParamSet->deltaPicOrderAlwaysZeroFlag)
- {
- /* delta_pic_order_cnt[0] */
- tmp = h264bsdDecodeExpGolombSigned(tmpStrmData, &ivalue);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* delta_pic_order_cnt[1] if present */
- if (pPicParamSet->picOrderPresentFlag)
- {
- tmp = h264bsdDecodeExpGolombSigned(tmpStrmData, &ivalue);
- if (tmp != HANTRO_OK)
- return(tmp);
- }
- }
-
- /* redundant_pic_cnt */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, redundantPicCnt);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- return(HANTRO_OK);
-
-}
-
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdCheckPriorPicsFlag
-
- Functional description:
- Peek value of no_output_of_prior_pics_flag from the slice header.
- Function does not modify current stream positions but copies
- the stream data structure to tmp structure which is used while
- accessing stream data.
-
- Inputs:
- pStrmData pointer to stream data structure
- pSeqParamSet pointer to active SPS
- pPicParamSet pointer to active PPS
- nalUnitType type of the current NAL unit
-
- Outputs:
- noOutputOfPriorPicsFlag value is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK invalid stream data
-
-------------------------------------------------------------------------------*/
-/*lint -e715 disable lint info nalUnitType not referenced */
-u32 h264bsdCheckPriorPicsFlag(u32 * noOutputOfPriorPicsFlag,
- const strmData_t * pStrmData,
- const seqParamSet_t * pSeqParamSet,
- const picParamSet_t * pPicParamSet,
- nalUnitType_e nalUnitType)
-{
-/* Variables */
-
- u32 tmp, value, i;
- i32 ivalue;
- strmData_t tmpStrmData[1];
- UNUSED(nalUnitType);
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pSeqParamSet);
- ASSERT(pPicParamSet);
- ASSERT(noOutputOfPriorPicsFlag);
-
- /* must be IDR lsice */
- ASSERT(nalUnitType == NAL_CODED_SLICE_IDR);
-
- /* don't touch original stream position params */
- *tmpStrmData = *pStrmData;
-
- /* skip first_mb_in_slice */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if(tmp != HANTRO_OK)
- return (tmp);
-
- /* slice_type */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if(tmp != HANTRO_OK)
- return (tmp);
-
- /* skip pic_parameter_set_id */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if(tmp != HANTRO_OK)
- return (tmp);
-
- /* log2(maxFrameNum) -> num bits to represent frame_num */
- i = 0;
- while(pSeqParamSet->maxFrameNum >> i)
- i++;
- i--;
-
- /* skip frame_num */
- tmp = h264bsdGetBits(tmpStrmData, i);
- if(tmp == END_OF_STREAM)
- return (HANTRO_NOK);
-
- /* skip idr_pic_id */
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if(tmp != HANTRO_OK)
- return (tmp);
-
- if(pSeqParamSet->picOrderCntType == 0)
- {
- /* log2(maxPicOrderCntLsb) -> num bits to represent pic_order_cnt_lsb */
- i = 0;
- while(pSeqParamSet->maxPicOrderCntLsb >> i)
- i++;
- i--;
-
- /* skip pic_order_cnt_lsb */
- tmp = h264bsdGetBits(tmpStrmData, i);
- if(tmp == END_OF_STREAM)
- return (HANTRO_NOK);
-
- if(pPicParamSet->picOrderPresentFlag)
- {
- /* skip delta_pic_order_cnt_bottom */
- tmp = h264bsdDecodeExpGolombSigned(tmpStrmData, &ivalue);
- if(tmp != HANTRO_OK)
- return (tmp);
- }
- }
-
- if(pSeqParamSet->picOrderCntType == 1 &&
- !pSeqParamSet->deltaPicOrderAlwaysZeroFlag)
- {
- /* skip delta_pic_order_cnt[0] */
- tmp = h264bsdDecodeExpGolombSigned(tmpStrmData, &ivalue);
- if(tmp != HANTRO_OK)
- return (tmp);
-
- /* skip delta_pic_order_cnt[1] if present */
- if(pPicParamSet->picOrderPresentFlag)
- {
- tmp = h264bsdDecodeExpGolombSigned(tmpStrmData, &ivalue);
- if(tmp != HANTRO_OK)
- return (tmp);
- }
- }
-
- /* skip redundant_pic_cnt */
- if(pPicParamSet->redundantPicCntPresentFlag)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(tmpStrmData, &value);
- if(tmp != HANTRO_OK)
- return (tmp);
- }
-
- *noOutputOfPriorPicsFlag = h264bsdGetBits(tmpStrmData, 1);
- if(*noOutputOfPriorPicsFlag == END_OF_STREAM)
- return (HANTRO_NOK);
-
- return (HANTRO_OK);
-
-}
-/*lint +e715 */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_slice_header.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_slice_header.h
deleted file mode 100644
index 198898a..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_slice_header.h
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_SLICE_HEADER_H
-#define H264SWDEC_SLICE_HEADER_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_stream.h"
-#include "h264bsd_cfg.h"
-#include "h264bsd_seq_param_set.h"
-#include "h264bsd_pic_param_set.h"
-#include "h264bsd_nal_unit.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-enum {
- P_SLICE = 0,
- I_SLICE = 2
-};
-
-enum {NO_LONG_TERM_FRAME_INDICES = 0xFFFF};
-
-/* macro to determine if slice is an inter slice, sliceTypes 0 and 5 */
-#define IS_P_SLICE(sliceType) (((sliceType) == P_SLICE) || \
- ((sliceType) == P_SLICE + 5))
-
-/* macro to determine if slice is an intra slice, sliceTypes 2 and 7 */
-#define IS_I_SLICE(sliceType) (((sliceType) == I_SLICE) || \
- ((sliceType) == I_SLICE + 5))
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-/* structure to store data of one reference picture list reordering operation */
-typedef struct
-{
- u32 reorderingOfPicNumsIdc;
- u32 absDiffPicNum;
- u32 longTermPicNum;
-} refPicListReorderingOperation_t;
-
-/* structure to store reference picture list reordering operations */
-typedef struct
-{
- u32 refPicListReorderingFlagL0;
- refPicListReorderingOperation_t command[MAX_NUM_REF_PICS+1];
-} refPicListReordering_t;
-
-/* structure to store data of one DPB memory management control operation */
-typedef struct
-{
- u32 memoryManagementControlOperation;
- u32 differenceOfPicNums;
- u32 longTermPicNum;
- u32 longTermFrameIdx;
- u32 maxLongTermFrameIdx;
-} memoryManagementOperation_t;
-
-/* worst case scenario: all MAX_NUM_REF_PICS pictures in the buffer are
- * short term pictures, each one of them is first marked as long term
- * reference picture which is then marked as unused for reference.
- * Additionally, max long-term frame index is set and current picture is
- * marked as long term reference picture. Last position reserved for
- * end memory_management_control_operation command */
-#define MAX_NUM_MMC_OPERATIONS (2*MAX_NUM_REF_PICS+2+1)
-
-/* structure to store decoded reference picture marking data */
-typedef struct
-{
- u32 noOutputOfPriorPicsFlag;
- u32 longTermReferenceFlag;
- u32 adaptiveRefPicMarkingModeFlag;
- memoryManagementOperation_t operation[MAX_NUM_MMC_OPERATIONS];
-} decRefPicMarking_t;
-
-/* structure to store slice header data decoded from the stream */
-typedef struct
-{
- u32 firstMbInSlice;
- u32 sliceType;
- u32 picParameterSetId;
- u32 frameNum;
- u32 idrPicId;
- u32 picOrderCntLsb;
- i32 deltaPicOrderCntBottom;
- i32 deltaPicOrderCnt[2];
- u32 redundantPicCnt;
- u32 numRefIdxActiveOverrideFlag;
- u32 numRefIdxL0Active;
- i32 sliceQpDelta;
- u32 disableDeblockingFilterIdc;
- i32 sliceAlphaC0Offset;
- i32 sliceBetaOffset;
- u32 sliceGroupChangeCycle;
- refPicListReordering_t refPicListReordering;
- decRefPicMarking_t decRefPicMarking;
-} sliceHeader_t;
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeSliceHeader(strmData_t *pStrmData,
- sliceHeader_t *pSliceHeader,
- seqParamSet_t *pSeqParamSet,
- picParamSet_t *pPicParamSet,
- nalUnit_t *pNalUnit);
-
-u32 h264bsdCheckPpsId(strmData_t *pStrmData, u32 *ppsId);
-
-u32 h264bsdCheckFrameNum(
- strmData_t *pStrmData,
- u32 maxFrameNum,
- u32 *frameNum);
-
-u32 h264bsdCheckIdrPicId(
- strmData_t *pStrmData,
- u32 maxFrameNum,
- nalUnitType_e nalUnitType,
- u32 *idrPicId);
-
-u32 h264bsdCheckPicOrderCntLsb(
- strmData_t *pStrmData,
- seqParamSet_t *pSeqParamSet,
- nalUnitType_e nalUnitType,
- u32 *picOrderCntLsb);
-
-u32 h264bsdCheckDeltaPicOrderCntBottom(
- strmData_t *pStrmData,
- seqParamSet_t *pSeqParamSet,
- nalUnitType_e nalUnitType,
- i32 *deltaPicOrderCntBottom);
-
-u32 h264bsdCheckDeltaPicOrderCnt(
- strmData_t *pStrmData,
- seqParamSet_t *pSeqParamSet,
- nalUnitType_e nalUnitType,
- u32 picOrderPresentFlag,
- i32 *deltaPicOrderCnt);
-
-u32 h264bsdCheckRedundantPicCnt(
- strmData_t *pStrmData,
- seqParamSet_t *pSeqParamSet,
- picParamSet_t *pPicParamSet,
- nalUnitType_e nalUnitType,
- u32 *redundantPicCnt);
-
-u32 h264bsdCheckPriorPicsFlag(u32 * noOutputOfPriorPicsFlag,
- const strmData_t * pStrmData,
- const seqParamSet_t * pSeqParamSet,
- const picParamSet_t * pPicParamSet,
- nalUnitType_e nalUnitType);
-
-#endif /* #ifdef H264SWDEC_SLICE_HEADER_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_storage.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_storage.c
deleted file mode 100644
index ff7a42a..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_storage.c
+++ /dev/null
@@ -1,906 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdInitStorage
- h264bsdStoreSeqParamSet
- h264bsdStorePicParamSet
- h264bsdActivateParamSets
- h264bsdResetStorage
- h264bsdIsStartOfPicture
- h264bsdIsEndOfPicture
- h264bsdComputeSliceGroupMap
- h264bsdCheckAccessUnitBoundary
- CheckPps
- h264bsdValidParamSets
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_storage.h"
-#include "h264bsd_util.h"
-#include "h264bsd_neighbour.h"
-#include "h264bsd_slice_group_map.h"
-#include "h264bsd_dpb.h"
-#include "h264bsd_nal_unit.h"
-#include "h264bsd_slice_header.h"
-#include "h264bsd_seq_param_set.h"
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-#ifndef UINT32_MAX
-#define UINT32_MAX (4294967295U)
-#endif
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-static u32 CheckPps(picParamSet_t *pps, seqParamSet_t *sps);
-
-/*------------------------------------------------------------------------------
-
- Function name: h264bsdInitStorage
-
- Functional description:
- Initialize storage structure. Sets contents of the storage to '0'
- except for the active parameter set ids, which are initialized
- to invalid values.
-
- Inputs:
-
- Outputs:
- pStorage initialized data stored here
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-
-void h264bsdInitStorage(storage_t *pStorage)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(pStorage);
-
- H264SwDecMemset(pStorage, 0, sizeof(storage_t));
-
- pStorage->activeSpsId = MAX_NUM_SEQ_PARAM_SETS;
- pStorage->activePpsId = MAX_NUM_PIC_PARAM_SETS;
-
- pStorage->aub->firstCallFlag = HANTRO_TRUE;
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdStoreSeqParamSet
-
- Functional description:
- Store sequence parameter set into the storage. If active SPS is
- overwritten -> check if contents changes and if it does, set
- parameters to force reactivation of parameter sets
-
- Inputs:
- pStorage pointer to storage structure
- pSeqParamSet pointer to param set to be stored
-
- Outputs:
- none
-
- Returns:
- HANTRO_OK success
- MEMORY_ALLOCATION_ERROR failure in memory allocation
-
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdStoreSeqParamSet(storage_t *pStorage, seqParamSet_t *pSeqParamSet)
-{
-
-/* Variables */
-
- u32 id;
-
-/* Code */
-
- ASSERT(pStorage);
- ASSERT(pSeqParamSet);
- ASSERT(pSeqParamSet->seqParameterSetId < MAX_NUM_SEQ_PARAM_SETS);
-
- id = pSeqParamSet->seqParameterSetId;
-
- /* seq parameter set with id not used before -> allocate memory */
- if (pStorage->sps[id] == NULL)
- {
- ALLOCATE(pStorage->sps[id], 1, seqParamSet_t);
- if (pStorage->sps[id] == NULL)
- return(MEMORY_ALLOCATION_ERROR);
- }
- /* sequence parameter set with id equal to id of active sps */
- else if (id == pStorage->activeSpsId)
- {
- /* if seq parameter set contents changes
- * -> overwrite and re-activate when next IDR picture decoded
- * ids of active param sets set to invalid values to force
- * re-activation. Memories allocated for old sps freed
- * otherwise free memeries allocated for just decoded sps and
- * continue */
- if (h264bsdCompareSeqParamSets(pSeqParamSet, pStorage->activeSps) != 0)
- {
- FREE(pStorage->sps[id]->offsetForRefFrame);
- FREE(pStorage->sps[id]->vuiParameters);
- pStorage->activeSpsId = MAX_NUM_SEQ_PARAM_SETS + 1;
- pStorage->activePpsId = MAX_NUM_PIC_PARAM_SETS + 1;
- pStorage->activeSps = NULL;
- pStorage->activePps = NULL;
- }
- else
- {
- FREE(pSeqParamSet->offsetForRefFrame);
- FREE(pSeqParamSet->vuiParameters);
- return(HANTRO_OK);
- }
- }
- /* overwrite seq param set other than active one -> free memories
- * allocated for old param set */
- else
- {
- FREE(pStorage->sps[id]->offsetForRefFrame);
- FREE(pStorage->sps[id]->vuiParameters);
- }
-
- *pStorage->sps[id] = *pSeqParamSet;
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdStorePicParamSet
-
- Functional description:
- Store picture parameter set into the storage. If active PPS is
- overwritten -> check if active SPS changes and if it does -> set
- parameters to force reactivation of parameter sets
-
- Inputs:
- pStorage pointer to storage structure
- pPicParamSet pointer to param set to be stored
-
- Outputs:
- none
-
- Returns:
- HANTRO_OK success
- MEMORY_ALLOCATION_ERROR failure in memory allocation
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdStorePicParamSet(storage_t *pStorage, picParamSet_t *pPicParamSet)
-{
-
-/* Variables */
-
- u32 id;
-
-/* Code */
-
- ASSERT(pStorage);
- ASSERT(pPicParamSet);
- ASSERT(pPicParamSet->picParameterSetId < MAX_NUM_PIC_PARAM_SETS);
- ASSERT(pPicParamSet->seqParameterSetId < MAX_NUM_SEQ_PARAM_SETS);
-
- id = pPicParamSet->picParameterSetId;
-
- /* pic parameter set with id not used before -> allocate memory */
- if (pStorage->pps[id] == NULL)
- {
- ALLOCATE(pStorage->pps[id], 1, picParamSet_t);
- if (pStorage->pps[id] == NULL)
- return(MEMORY_ALLOCATION_ERROR);
- }
- /* picture parameter set with id equal to id of active pps */
- else if (id == pStorage->activePpsId)
- {
- /* check whether seq param set changes, force re-activation of
- * param set if it does. Set activeSpsId to invalid value to
- * accomplish this */
- if (pPicParamSet->seqParameterSetId != pStorage->activeSpsId)
- {
- pStorage->activePpsId = MAX_NUM_PIC_PARAM_SETS + 1;
- }
- /* free memories allocated for old param set */
- FREE(pStorage->pps[id]->runLength);
- FREE(pStorage->pps[id]->topLeft);
- FREE(pStorage->pps[id]->bottomRight);
- FREE(pStorage->pps[id]->sliceGroupId);
- }
- /* overwrite pic param set other than active one -> free memories
- * allocated for old param set */
- else
- {
- FREE(pStorage->pps[id]->runLength);
- FREE(pStorage->pps[id]->topLeft);
- FREE(pStorage->pps[id]->bottomRight);
- FREE(pStorage->pps[id]->sliceGroupId);
- }
-
- *pStorage->pps[id] = *pPicParamSet;
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdActivateParamSets
-
- Functional description:
- Activate certain SPS/PPS combination. This function shall be
- called in the beginning of each picture. Picture parameter set
- can be changed as wanted, but sequence parameter set may only be
- changed when the starting picture is an IDR picture.
-
- When new SPS is activated the function allocates memory for
- macroblock storages and slice group map and (re-)initializes the
- decoded picture buffer. If this is not the first activation the old
- allocations are freed and FreeDpb called before new allocations.
-
- Inputs:
- pStorage pointer to storage data structure
- ppsId identifies the PPS to be activated, SPS id obtained
- from the PPS
- isIdr flag to indicate if the picture is an IDR picture
-
- Outputs:
- none
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK non-existing or invalid param set combination,
- trying to change SPS with non-IDR picture
- MEMORY_ALLOCATION_ERROR failure in memory allocation
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdActivateParamSets(storage_t *pStorage, u32 ppsId, u32 isIdr)
-{
-
-/* Variables */
-
- u32 tmp;
- u32 flag;
-
-/* Code */
-
- ASSERT(pStorage);
- ASSERT(ppsId < MAX_NUM_PIC_PARAM_SETS);
-
- /* check that pps and corresponding sps exist */
- if ( (pStorage->pps[ppsId] == NULL) ||
- (pStorage->sps[pStorage->pps[ppsId]->seqParameterSetId] == NULL) )
- {
- return(HANTRO_NOK);
- }
-
- /* check that pps parameters do not violate picture size constraints */
- tmp = CheckPps(pStorage->pps[ppsId],
- pStorage->sps[pStorage->pps[ppsId]->seqParameterSetId]);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* first activation part1 */
- if (pStorage->activePpsId == MAX_NUM_PIC_PARAM_SETS)
- {
- pStorage->activePpsId = ppsId;
- pStorage->activePps = pStorage->pps[ppsId];
- pStorage->activeSpsId = pStorage->activePps->seqParameterSetId;
- pStorage->activeSps = pStorage->sps[pStorage->activeSpsId];
-
- /* report error before multiplication to prevent integer overflow */
- if (pStorage->activeSps->picWidthInMbs == 0)
- {
- pStorage->picSizeInMbs = 0;
- }
- else if (pStorage->activeSps->picHeightInMbs >
- UINT32_MAX / pStorage->activeSps->picWidthInMbs)
- {
- return(MEMORY_ALLOCATION_ERROR);
- }
- else
- {
- pStorage->picSizeInMbs =
- pStorage->activeSps->picWidthInMbs *
- pStorage->activeSps->picHeightInMbs;
- }
-
- pStorage->currImage->width = pStorage->activeSps->picWidthInMbs;
- pStorage->currImage->height = pStorage->activeSps->picHeightInMbs;
-
- pStorage->pendingActivation = HANTRO_TRUE;
- }
- /* first activation part2 */
- else if (pStorage->pendingActivation)
- {
- pStorage->pendingActivation = HANTRO_FALSE;
-
- FREE(pStorage->mb);
- FREE(pStorage->sliceGroupMap);
-
- ALLOCATE(pStorage->mb, pStorage->picSizeInMbs, mbStorage_t);
- ALLOCATE(pStorage->sliceGroupMap, pStorage->picSizeInMbs, u32);
- if (pStorage->mb == NULL || pStorage->sliceGroupMap == NULL)
- return(MEMORY_ALLOCATION_ERROR);
-
- H264SwDecMemset(pStorage->mb, 0,
- pStorage->picSizeInMbs * sizeof(mbStorage_t));
-
- h264bsdInitMbNeighbours(pStorage->mb,
- pStorage->activeSps->picWidthInMbs,
- pStorage->picSizeInMbs);
-
- /* dpb output reordering disabled if
- * 1) application set noReordering flag
- * 2) POC type equal to 2
- * 3) num_reorder_frames in vui equal to 0 */
- if ( pStorage->noReordering ||
- pStorage->activeSps->picOrderCntType == 2 ||
- (pStorage->activeSps->vuiParametersPresentFlag &&
- pStorage->activeSps->vuiParameters->bitstreamRestrictionFlag &&
- !pStorage->activeSps->vuiParameters->numReorderFrames) )
- flag = HANTRO_TRUE;
- else
- flag = HANTRO_FALSE;
-
- tmp = h264bsdResetDpb(pStorage->dpb,
- pStorage->activeSps->picWidthInMbs *
- pStorage->activeSps->picHeightInMbs,
- pStorage->activeSps->maxDpbSize,
- pStorage->activeSps->numRefFrames,
- pStorage->activeSps->maxFrameNum,
- flag);
- if (tmp != HANTRO_OK)
- return(tmp);
- }
- else if (ppsId != pStorage->activePpsId)
- {
- /* sequence parameter set shall not change but before an IDR picture */
- if (pStorage->pps[ppsId]->seqParameterSetId != pStorage->activeSpsId)
- {
- DEBUG(("SEQ PARAM SET CHANGING...\n"));
- if (isIdr)
- {
- pStorage->activePpsId = ppsId;
- pStorage->activePps = pStorage->pps[ppsId];
- pStorage->activeSpsId = pStorage->activePps->seqParameterSetId;
- pStorage->activeSps = pStorage->sps[pStorage->activeSpsId];
- pStorage->picSizeInMbs =
- pStorage->activeSps->picWidthInMbs *
- pStorage->activeSps->picHeightInMbs;
-
- pStorage->currImage->width = pStorage->activeSps->picWidthInMbs;
- pStorage->currImage->height =
- pStorage->activeSps->picHeightInMbs;
-
- pStorage->pendingActivation = HANTRO_TRUE;
- }
- else
- {
- DEBUG(("TRYING TO CHANGE SPS IN NON-IDR SLICE\n"));
- return(HANTRO_NOK);
- }
- }
- else
- {
- pStorage->activePpsId = ppsId;
- pStorage->activePps = pStorage->pps[ppsId];
- }
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdResetStorage
-
- Functional description:
- Reset contents of the storage. This should be called before
- processing of new image is started.
-
- Inputs:
- pStorage pointer to storage structure
-
- Outputs:
- none
-
- Returns:
- none
-
-
-------------------------------------------------------------------------------*/
-
-void h264bsdResetStorage(storage_t *pStorage)
-{
-
-/* Variables */
-
- u32 i;
-
-/* Code */
-
- ASSERT(pStorage);
-
- pStorage->slice->numDecodedMbs = 0;
- pStorage->slice->sliceId = 0;
-
- for (i = 0; i < pStorage->picSizeInMbs; i++)
- {
- pStorage->mb[i].sliceId = 0;
- pStorage->mb[i].decoded = 0;
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdIsStartOfPicture
-
- Functional description:
- Determine if the decoder is in the start of a picture. This
- information is needed to decide if h264bsdActivateParamSets and
- h264bsdCheckGapsInFrameNum functions should be called. Function
- considers that new picture is starting if no slice headers
- have been successfully decoded for the current access unit.
-
- Inputs:
- pStorage pointer to storage structure
-
- Outputs:
- none
-
- Returns:
- HANTRO_TRUE new picture is starting
- HANTRO_FALSE not starting
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdIsStartOfPicture(storage_t *pStorage)
-{
-
-/* Variables */
-
-
-/* Code */
-
- if (pStorage->validSliceInAccessUnit == HANTRO_FALSE)
- return(HANTRO_TRUE);
- else
- return(HANTRO_FALSE);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdIsEndOfPicture
-
- Functional description:
- Determine if the decoder is in the end of a picture. This
- information is needed to determine when deblocking filtering
- and reference picture marking processes should be performed.
-
- If the decoder is processing primary slices the return value
- is determined by checking the value of numDecodedMbs in the
- storage. On the other hand, if the decoder is processing
- redundant slices the numDecodedMbs may not contain valid
- informationa and each macroblock has to be checked separately.
-
- Inputs:
- pStorage pointer to storage structure
-
- Outputs:
- none
-
- Returns:
- HANTRO_TRUE end of picture
- HANTRO_FALSE noup
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdIsEndOfPicture(storage_t *pStorage)
-{
-
-/* Variables */
-
- u32 i, tmp;
-
-/* Code */
-
- /* primary picture */
- if (!pStorage->sliceHeader[0].redundantPicCnt)
- {
- if (pStorage->slice->numDecodedMbs == pStorage->picSizeInMbs)
- return(HANTRO_TRUE);
- }
- else
- {
- for (i = 0, tmp = 0; i < pStorage->picSizeInMbs; i++)
- tmp += pStorage->mb[i].decoded ? 1 : 0;
-
- if (tmp == pStorage->picSizeInMbs)
- return(HANTRO_TRUE);
- }
-
- return(HANTRO_FALSE);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdComputeSliceGroupMap
-
- Functional description:
- Compute slice group map. Just call h264bsdDecodeSliceGroupMap with
- appropriate parameters.
-
- Inputs:
- pStorage pointer to storage structure
- sliceGroupChangeCycle
-
- Outputs:
- none
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-
-void h264bsdComputeSliceGroupMap(storage_t *pStorage, u32 sliceGroupChangeCycle)
-{
-
-/* Variables */
-
-
-/* Code */
-
- h264bsdDecodeSliceGroupMap(pStorage->sliceGroupMap,
- pStorage->activePps, sliceGroupChangeCycle,
- pStorage->activeSps->picWidthInMbs,
- pStorage->activeSps->picHeightInMbs);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdCheckAccessUnitBoundary
-
- Functional description:
- Check if next NAL unit starts a new access unit. Following
- conditions specify start of a new access unit:
-
- -NAL unit types 6-11, 13-18 (e.g. SPS, PPS)
-
- following conditions checked only for slice NAL units, values
- compared to ones obtained from previous slice:
-
- -NAL unit type differs (slice / IDR slice)
- -frame_num differs
- -nal_ref_idc differs and one of the values is 0
- -POC information differs
- -both are IDR slices and idr_pic_id differs
-
- Inputs:
- strm pointer to stream data structure
- nuNext pointer to NAL unit structure
- storage pointer to storage structure
-
- Outputs:
- accessUnitBoundaryFlag the result is stored here, TRUE for
- access unit boundary, FALSE otherwise
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK failure, invalid stream data
- PARAM_SET_ERROR invalid param set usage
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdCheckAccessUnitBoundary(
- strmData_t *strm,
- nalUnit_t *nuNext,
- storage_t *storage,
- u32 *accessUnitBoundaryFlag)
-{
-
-/* Variables */
-
- u32 tmp, ppsId, frameNum, idrPicId, picOrderCntLsb;
- i32 deltaPicOrderCntBottom, deltaPicOrderCnt[2];
- seqParamSet_t *sps;
- picParamSet_t *pps;
-
-/* Code */
-
- ASSERT(strm);
- ASSERT(nuNext);
- ASSERT(storage);
- ASSERT(storage->sps);
- ASSERT(storage->pps);
-
- /* initialize default output to FALSE */
- *accessUnitBoundaryFlag = HANTRO_FALSE;
-
- if ( ( (nuNext->nalUnitType > 5) && (nuNext->nalUnitType < 12) ) ||
- ( (nuNext->nalUnitType > 12) && (nuNext->nalUnitType <= 18) ) )
- {
- *accessUnitBoundaryFlag = HANTRO_TRUE;
- return(HANTRO_OK);
- }
- else if ( nuNext->nalUnitType != NAL_CODED_SLICE &&
- nuNext->nalUnitType != NAL_CODED_SLICE_IDR )
- {
- return(HANTRO_OK);
- }
-
- /* check if this is the very first call to this function */
- if (storage->aub->firstCallFlag)
- {
- *accessUnitBoundaryFlag = HANTRO_TRUE;
- storage->aub->firstCallFlag = HANTRO_FALSE;
- }
-
- /* get picture parameter set id */
- tmp = h264bsdCheckPpsId(strm, &ppsId);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- /* store sps and pps in separate pointers just to make names shorter */
- pps = storage->pps[ppsId];
- if ( pps == NULL || storage->sps[pps->seqParameterSetId] == NULL ||
- (storage->activeSpsId != MAX_NUM_SEQ_PARAM_SETS &&
- pps->seqParameterSetId != storage->activeSpsId &&
- nuNext->nalUnitType != NAL_CODED_SLICE_IDR) )
- return(PARAM_SET_ERROR);
- sps = storage->sps[pps->seqParameterSetId];
-
- if (storage->aub->nuPrev->nalRefIdc != nuNext->nalRefIdc &&
- (storage->aub->nuPrev->nalRefIdc == 0 || nuNext->nalRefIdc == 0))
- *accessUnitBoundaryFlag = HANTRO_TRUE;
-
- if ((storage->aub->nuPrev->nalUnitType == NAL_CODED_SLICE_IDR &&
- nuNext->nalUnitType != NAL_CODED_SLICE_IDR) ||
- (storage->aub->nuPrev->nalUnitType != NAL_CODED_SLICE_IDR &&
- nuNext->nalUnitType == NAL_CODED_SLICE_IDR))
- *accessUnitBoundaryFlag = HANTRO_TRUE;
-
- tmp = h264bsdCheckFrameNum(strm, sps->maxFrameNum, &frameNum);
- if (tmp != HANTRO_OK)
- return(HANTRO_NOK);
-
- if (storage->aub->prevFrameNum != frameNum)
- {
- storage->aub->prevFrameNum = frameNum;
- *accessUnitBoundaryFlag = HANTRO_TRUE;
- }
-
- if (nuNext->nalUnitType == NAL_CODED_SLICE_IDR)
- {
- tmp = h264bsdCheckIdrPicId(strm, sps->maxFrameNum, nuNext->nalUnitType,
- &idrPicId);
- if (tmp != HANTRO_OK)
- return(HANTRO_NOK);
-
- if (storage->aub->nuPrev->nalUnitType == NAL_CODED_SLICE_IDR &&
- storage->aub->prevIdrPicId != idrPicId)
- *accessUnitBoundaryFlag = HANTRO_TRUE;
-
- storage->aub->prevIdrPicId = idrPicId;
- }
-
- if (sps->picOrderCntType == 0)
- {
- tmp = h264bsdCheckPicOrderCntLsb(strm, sps, nuNext->nalUnitType,
- &picOrderCntLsb);
- if (tmp != HANTRO_OK)
- return(HANTRO_NOK);
-
- if (storage->aub->prevPicOrderCntLsb != picOrderCntLsb)
- {
- storage->aub->prevPicOrderCntLsb = picOrderCntLsb;
- *accessUnitBoundaryFlag = HANTRO_TRUE;
- }
-
- if (pps->picOrderPresentFlag)
- {
- tmp = h264bsdCheckDeltaPicOrderCntBottom(strm, sps,
- nuNext->nalUnitType, &deltaPicOrderCntBottom);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- if (storage->aub->prevDeltaPicOrderCntBottom !=
- deltaPicOrderCntBottom)
- {
- storage->aub->prevDeltaPicOrderCntBottom =
- deltaPicOrderCntBottom;
- *accessUnitBoundaryFlag = HANTRO_TRUE;
- }
- }
- }
- else if (sps->picOrderCntType == 1 && !sps->deltaPicOrderAlwaysZeroFlag)
- {
- tmp = h264bsdCheckDeltaPicOrderCnt(strm, sps, nuNext->nalUnitType,
- pps->picOrderPresentFlag, deltaPicOrderCnt);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- if (storage->aub->prevDeltaPicOrderCnt[0] != deltaPicOrderCnt[0])
- {
- storage->aub->prevDeltaPicOrderCnt[0] = deltaPicOrderCnt[0];
- *accessUnitBoundaryFlag = HANTRO_TRUE;
- }
-
- if (pps->picOrderPresentFlag)
- if (storage->aub->prevDeltaPicOrderCnt[1] != deltaPicOrderCnt[1])
- {
- storage->aub->prevDeltaPicOrderCnt[1] = deltaPicOrderCnt[1];
- *accessUnitBoundaryFlag = HANTRO_TRUE;
- }
- }
-
- *storage->aub->nuPrev = *nuNext;
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: CheckPps
-
- Functional description:
- Check picture parameter set. Contents of the picture parameter
- set information that depends on the image dimensions is checked
- against the dimensions in the sps.
-
- Inputs:
- pps pointer to picture paramter set
- sps pointer to sequence parameter set
-
- Outputs:
- none
-
- Returns:
- HANTRO_OK everything ok
- HANTRO_NOK invalid data in picture parameter set
-
-------------------------------------------------------------------------------*/
-u32 CheckPps(picParamSet_t *pps, seqParamSet_t *sps)
-{
-
- u32 i;
- u32 picSize;
-
- picSize = sps->picWidthInMbs * sps->picHeightInMbs;
-
- /* check slice group params */
- if (pps->numSliceGroups > 1)
- {
- if (pps->sliceGroupMapType == 0)
- {
- ASSERT(pps->runLength);
- for (i = 0; i < pps->numSliceGroups; i++)
- {
- if (pps->runLength[i] > picSize)
- return(HANTRO_NOK);
- }
- }
- else if (pps->sliceGroupMapType == 2)
- {
- ASSERT(pps->topLeft);
- ASSERT(pps->bottomRight);
- for (i = 0; i < pps->numSliceGroups-1; i++)
- {
- if (pps->topLeft[i] > pps->bottomRight[i] ||
- pps->bottomRight[i] >= picSize)
- return(HANTRO_NOK);
-
- if ( (pps->topLeft[i] % sps->picWidthInMbs) >
- (pps->bottomRight[i] % sps->picWidthInMbs) )
- return(HANTRO_NOK);
- }
- }
- else if (pps->sliceGroupMapType > 2 && pps->sliceGroupMapType < 6)
- {
- if (pps->sliceGroupChangeRate > picSize)
- return(HANTRO_NOK);
- }
- else if (pps->sliceGroupMapType == 6 &&
- pps->picSizeInMapUnits < picSize)
- return(HANTRO_NOK);
- }
-
- return(HANTRO_OK);
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdValidParamSets
-
- Functional description:
- Check if any valid SPS/PPS combination exists in the storage.
- Function tries each PPS in the buffer and checks if corresponding
- SPS exists and calls CheckPps to determine if the PPS conforms
- to image dimensions of the SPS.
-
- Inputs:
- pStorage pointer to storage structure
-
- Outputs:
- HANTRO_OK there is at least one valid combination
- HANTRO_NOK no valid combinations found
-
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdValidParamSets(storage_t *pStorage)
-{
-
-/* Variables */
-
- u32 i;
-
-/* Code */
-
- ASSERT(pStorage);
-
- for (i = 0; i < MAX_NUM_PIC_PARAM_SETS; i++)
- {
- if ( pStorage->pps[i] &&
- pStorage->sps[pStorage->pps[i]->seqParameterSetId] &&
- CheckPps(pStorage->pps[i],
- pStorage->sps[pStorage->pps[i]->seqParameterSetId]) ==
- HANTRO_OK)
- {
- return(HANTRO_OK);
- }
- }
-
- return(HANTRO_NOK);
-
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_storage.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_storage.h
deleted file mode 100644
index ba3b2da..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_storage.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_STORAGE_H
-#define H264SWDEC_STORAGE_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_cfg.h"
-#include "h264bsd_seq_param_set.h"
-#include "h264bsd_pic_param_set.h"
-#include "h264bsd_macroblock_layer.h"
-#include "h264bsd_nal_unit.h"
-#include "h264bsd_slice_header.h"
-#include "h264bsd_seq_param_set.h"
-#include "h264bsd_dpb.h"
-#include "h264bsd_pic_order_cnt.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-typedef struct
-{
- u32 sliceId;
- u32 numDecodedMbs;
- u32 lastMbAddr;
-} sliceStorage_t;
-
-/* structure to store parameters needed for access unit boundary checking */
-typedef struct
-{
- nalUnit_t nuPrev[1];
- u32 prevFrameNum;
- u32 prevIdrPicId;
- u32 prevPicOrderCntLsb;
- i32 prevDeltaPicOrderCntBottom;
- i32 prevDeltaPicOrderCnt[2];
- u32 firstCallFlag;
-} aubCheck_t;
-
-/* storage data structure, holds all data of a decoder instance */
-typedef struct
-{
- /* active paramet set ids and pointers */
- u32 oldSpsId;
- u32 activePpsId;
- u32 activeSpsId;
- picParamSet_t *activePps;
- seqParamSet_t *activeSps;
- seqParamSet_t *sps[MAX_NUM_SEQ_PARAM_SETS];
- picParamSet_t *pps[MAX_NUM_PIC_PARAM_SETS];
-
- /* current slice group map, recomputed for each slice */
- u32 *sliceGroupMap;
-
- u32 picSizeInMbs;
-
- /* this flag is set after all macroblocks of a picture successfully
- * decoded -> redundant slices not decoded */
- u32 skipRedundantSlices;
- u32 picStarted;
-
- /* flag to indicate if current access unit contains any valid slices */
- u32 validSliceInAccessUnit;
-
- /* store information needed for handling of slice decoding */
- sliceStorage_t slice[1];
-
- /* number of concealed macroblocks in the current image */
- u32 numConcealedMbs;
-
- /* picId given by application */
- u32 currentPicId;
-
- /* macroblock specific storages, size determined by image dimensions */
- mbStorage_t *mb;
-
- /* flag to store noOutputReordering flag set by the application */
- u32 noReordering;
-
- /* DPB */
- dpbStorage_t dpb[1];
-
- /* structure to store picture order count related information */
- pocStorage_t poc[1];
-
- /* access unit boundary checking related data */
- aubCheck_t aub[1];
-
- /* current processed image */
- image_t currImage[1];
-
- /* last valid NAL unit header is stored here */
- nalUnit_t prevNalUnit[1];
-
- /* slice header, second structure used as a temporary storage while
- * decoding slice header, first one stores last successfully decoded
- * slice header */
- sliceHeader_t sliceHeader[2];
-
- /* fields to store old stream buffer pointers, needed when only part of
- * a stream buffer is processed by h264bsdDecode function */
- u32 prevBufNotFinished;
- u8 *prevBufPointer;
- u32 prevBytesConsumed;
- strmData_t strm[1];
-
- /* macroblock layer structure, there is no need to store this but it
- * would have increased the stack size excessively and needed to be
- * allocated from head -> easiest to put it here */
- macroblockLayer_t *mbLayer;
-
- u32 pendingActivation; /* Activate parameter sets after returning
- HEADERS_RDY to the user */
- u32 intraConcealmentFlag; /* 0 gray picture for corrupted intra
- 1 previous frame used if available */
-} storage_t;
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-void h264bsdInitStorage(storage_t *pStorage);
-void h264bsdResetStorage(storage_t *pStorage);
-u32 h264bsdIsStartOfPicture(storage_t *pStorage);
-u32 h264bsdIsEndOfPicture(storage_t *pStorage);
-u32 h264bsdStoreSeqParamSet(storage_t *pStorage, seqParamSet_t *pSeqParamSet);
-u32 h264bsdStorePicParamSet(storage_t *pStorage, picParamSet_t *pPicParamSet);
-u32 h264bsdActivateParamSets(storage_t *pStorage, u32 ppsId, u32 isIdr);
-void h264bsdComputeSliceGroupMap(storage_t *pStorage,
- u32 sliceGroupChangeCycle);
-
-u32 h264bsdCheckAccessUnitBoundary(
- strmData_t *strm,
- nalUnit_t *nuNext,
- storage_t *storage,
- u32 *accessUnitBoundaryFlag);
-
-u32 h264bsdValidParamSets(storage_t *pStorage);
-
-#endif /* #ifdef H264SWDEC_STORAGE_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_stream.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_stream.c
deleted file mode 100644
index 20d1083..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_stream.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdGetBits
- h264bsdShowBits32
- h264bsdFlushBits
- h264bsdIsByteAligned
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_util.h"
-#include "h264bsd_stream.h"
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdGetBits
-
- Functional description:
- Read and remove bits from the stream buffer.
-
- Input:
- pStrmData pointer to stream data structure
- numBits number of bits to read
-
- Output:
- none
-
- Returns:
- bits read from stream
- END_OF_STREAM if not enough bits left
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdGetBits(strmData_t *pStrmData, u32 numBits)
-{
-
- u32 out;
-
- ASSERT(pStrmData);
- ASSERT(numBits < 32);
-
- out = h264bsdShowBits32(pStrmData) >> (32 - numBits);
-
- if (h264bsdFlushBits(pStrmData, numBits) == HANTRO_OK)
- {
- return(out);
- }
- else
- {
- return(END_OF_STREAM);
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdShowBits32
-
- Functional description:
- Read 32 bits from the stream buffer. Buffer is left as it is, i.e.
- no bits are removed. First bit read from the stream is the MSB of
- the return value. If there is not enough bits in the buffer ->
- bits beyong the end of the stream are set to '0' in the return
- value.
-
- Input:
- pStrmData pointer to stream data structure
-
- Output:
- none
-
- Returns:
- bits read from stream
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdShowBits32(strmData_t *pStrmData)
-{
-
- i32 bits, shift;
- u32 out;
- u8 *pStrm;
-
- ASSERT(pStrmData);
- ASSERT(pStrmData->pStrmCurrPos);
- ASSERT(pStrmData->bitPosInWord < 8);
- ASSERT(pStrmData->bitPosInWord ==
- (pStrmData->strmBuffReadBits & 0x7));
-
- pStrm = pStrmData->pStrmCurrPos;
-
- /* number of bits left in the buffer */
- bits = (i32)pStrmData->strmBuffSize*8 - (i32)pStrmData->strmBuffReadBits;
-
- /* at least 32-bits in the buffer */
- if (bits >= 32)
- {
- u32 bitPosInWord = pStrmData->bitPosInWord;
- out = ((u32)pStrm[0] << 24) | ((u32)pStrm[1] << 16) |
- ((u32)pStrm[2] << 8) | ((u32)pStrm[3]);
-
- if (bitPosInWord)
- {
- u32 byte = (u32)pStrm[4];
- u32 tmp = (8-bitPosInWord);
- out <<= bitPosInWord;
- out |= byte>>tmp;
- }
- return (out);
- }
- /* at least one bit in the buffer */
- else if (bits > 0)
- {
- shift = (i32)(24 + pStrmData->bitPosInWord);
- out = (u32)(*pStrm++) << shift;
- bits -= (i32)(8 - pStrmData->bitPosInWord);
- while (bits > 0)
- {
- shift -= 8;
- out |= (u32)(*pStrm++) << shift;
- bits -= 8;
- }
- return (out);
- }
- else
- return (0);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdFlushBits
-
- Functional description:
- Remove bits from the stream buffer
-
- Input:
- pStrmData pointer to stream data structure
- numBits number of bits to remove
-
- Output:
- none
-
- Returns:
- HANTRO_OK success
- END_OF_STREAM not enough bits left
-
-------------------------------------------------------------------------------*/
-#ifndef H264DEC_NEON
-u32 h264bsdFlushBits(strmData_t *pStrmData, u32 numBits)
-{
-
- ASSERT(pStrmData);
- ASSERT(pStrmData->pStrmBuffStart);
- ASSERT(pStrmData->pStrmCurrPos);
- ASSERT(pStrmData->bitPosInWord < 8);
- ASSERT(pStrmData->bitPosInWord == (pStrmData->strmBuffReadBits & 0x7));
-
- pStrmData->strmBuffReadBits += numBits;
- pStrmData->bitPosInWord = pStrmData->strmBuffReadBits & 0x7;
- if ( (pStrmData->strmBuffReadBits ) <= (8*pStrmData->strmBuffSize) )
- {
- pStrmData->pStrmCurrPos = pStrmData->pStrmBuffStart +
- (pStrmData->strmBuffReadBits >> 3);
- return(HANTRO_OK);
- }
- else
- return(END_OF_STREAM);
-
-}
-#endif
-/*------------------------------------------------------------------------------
-
- Function: h264bsdIsByteAligned
-
- Functional description:
- Check if current stream position is byte aligned.
-
- Inputs:
- pStrmData pointer to stream data structure
-
- Outputs:
- none
-
- Returns:
- TRUE stream is byte aligned
- FALSE stream is not byte aligned
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdIsByteAligned(strmData_t *pStrmData)
-{
-
-/* Variables */
-
-/* Code */
-
- if (!pStrmData->bitPosInWord)
- return(HANTRO_TRUE);
- else
- return(HANTRO_FALSE);
-
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_stream.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_stream.h
deleted file mode 100644
index 4404b66..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_stream.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_STREAM_H
-#define H264SWDEC_STREAM_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-typedef struct
-{
- u8 *pStrmBuffStart; /* pointer to start of stream buffer */
- u8 *pStrmCurrPos; /* current read address in stream buffer */
- u32 bitPosInWord; /* bit position in stream buffer byte */
- u32 strmBuffSize; /* size of stream buffer (bytes) */
- u32 strmBuffReadBits; /* number of bits read from stream buffer */
-} strmData_t;
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-u32 h264bsdGetBits(strmData_t *pStrmData, u32 numBits);
-
-u32 h264bsdShowBits32(strmData_t *pStrmData);
-
-u32 h264bsdFlushBits(strmData_t *pStrmData, u32 numBits);
-
-u32 h264bsdIsByteAligned(strmData_t *);
-
-#endif /* #ifdef H264SWDEC_STREAM_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_transform.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_transform.c
deleted file mode 100644
index 4eb6dd0..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_transform.c
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdProcessBlock
- h264bsdProcessLumaDc
- h264bsdProcessChromaDc
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_transform.h"
-#include "h264bsd_util.h"
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-/* Switch off the following Lint messages for this file:
- * Info 701: Shift left of signed quantity (int)
- * Info 702: Shift right of signed quantity (int)
- */
-/*lint -e701 -e702 */
-
-/* LevelScale function */
-static const i32 levelScale[6][3] = {
- {10,13,16}, {11,14,18}, {13,16,20}, {14,18,23}, {16,20,25}, {18,23,29}};
-
-/* qp % 6 as a function of qp */
-static const u8 qpMod6[52] = {0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,
- 0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3};
-
-/* qp / 6 as a function of qp */
-static const u8 qpDiv6[52] = {0,0,0,0,0,0,1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,
- 4,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7,8,8,8,8};
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdProcessBlock
-
- Functional description:
- Function performs inverse zig-zag scan, inverse scaling and
- inverse transform for a luma or a chroma residual block
-
- Inputs:
- data pointer to data to be processed
- qp quantization parameter
- skip skip processing of data[0], set to non-zero value
- if dc coeff hanled separately
- coeffMap 16 lsb's indicate which coeffs are non-zero,
- bit 0 (lsb) for coeff 0, bit 1 for coeff 1 etc.
-
- Outputs:
- data processed data
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK processed data not in valid range [-512, 511]
-
-------------------------------------------------------------------------------*/
-u32 h264bsdProcessBlock(i32 *data, u32 qp, u32 skip, u32 coeffMap)
-{
-
-/* Variables */
-
- i32 tmp0, tmp1, tmp2, tmp3;
- i32 d1, d2, d3;
- u32 row,col;
- u32 qpDiv;
- i32 *ptr;
-
-/* Code */
-
- qpDiv = qpDiv6[qp];
- tmp1 = levelScale[qpMod6[qp]][0] << qpDiv;
- tmp2 = levelScale[qpMod6[qp]][1] << qpDiv;
- tmp3 = levelScale[qpMod6[qp]][2] << qpDiv;
-
- if (!skip)
- data[0] = (data[0] * tmp1);
-
- /* at least one of the rows 1, 2 or 3 contain non-zero coeffs, mask takes
- * the scanning order into account */
- if (coeffMap & 0xFF9C)
- {
- /* do the zig-zag scan and inverse quantization */
- d1 = data[1];
- d2 = data[14];
- d3 = data[15];
- data[1] = (d1 * tmp2);
- data[14] = (d2 * tmp2);
- data[15] = (d3 * tmp3);
-
- d1 = data[2];
- d2 = data[5];
- d3 = data[4];
- data[4] = (d1 * tmp2);
- data[2] = (d2 * tmp1);
- data[5] = (d3 * tmp3);
-
- d1 = data[8];
- d2 = data[3];
- d3 = data[6];
- tmp0 = (d1 * tmp2);
- data[8] = (d2 * tmp1);
- data[3] = (d3 * tmp2);
- d1 = data[7];
- d2 = data[12];
- d3 = data[9];
- data[6] = (d1 * tmp2);
- data[7] = (d2 * tmp3);
- data[12] = (d3 * tmp2);
- data[9] = tmp0;
-
- d1 = data[10];
- d2 = data[11];
- d3 = data[13];
- data[13] = (d1 * tmp3);
- data[10] = (d2 * tmp1);
- data[11] = (d3 * tmp2);
-
- /* horizontal transform */
- for (row = 4, ptr = data; row--; ptr += 4)
- {
- tmp0 = ptr[0] + ptr[2];
- tmp1 = ptr[0] - ptr[2];
- tmp2 = (ptr[1] >> 1) - ptr[3];
- tmp3 = ptr[1] + (ptr[3] >> 1);
- ptr[0] = tmp0 + tmp3;
- ptr[1] = tmp1 + tmp2;
- ptr[2] = tmp1 - tmp2;
- ptr[3] = tmp0 - tmp3;
- }
-
- /*lint +e661 +e662*/
- /* then vertical transform */
- for (col = 4; col--; data++)
- {
- tmp0 = data[0] + data[8];
- tmp1 = data[0] - data[8];
- tmp2 = (data[4] >> 1) - data[12];
- tmp3 = data[4] + (data[12] >> 1);
- data[0 ] = (tmp0 + tmp3 + 32)>>6;
- data[4 ] = (tmp1 + tmp2 + 32)>>6;
- data[8 ] = (tmp1 - tmp2 + 32)>>6;
- data[12] = (tmp0 - tmp3 + 32)>>6;
- /* check that each value is in the range [-512,511] */
- if (((u32)(data[0] + 512) > 1023) ||
- ((u32)(data[4] + 512) > 1023) ||
- ((u32)(data[8] + 512) > 1023) ||
- ((u32)(data[12] + 512) > 1023) )
- return(HANTRO_NOK);
- }
- }
- else /* rows 1, 2 and 3 are zero */
- {
- /* only dc-coeff is non-zero, i.e. coeffs at original positions
- * 1, 5 and 6 are zero */
- if ((coeffMap & 0x62) == 0)
- {
- tmp0 = (data[0] + 32) >> 6;
- /* check that value is in the range [-512,511] */
- if ((u32)(tmp0 + 512) > 1023)
- return(HANTRO_NOK);
- data[0] = data[1] = data[2] = data[3] = data[4] = data[5] =
- data[6] = data[7] = data[8] = data[9] = data[10] =
- data[11] = data[12] = data[13] = data[14] = data[15] =
- tmp0;
- }
- else /* at least one of the coeffs 1, 5 or 6 is non-zero */
- {
- data[1] = (data[1] * tmp2);
- data[2] = (data[5] * tmp1);
- data[3] = (data[6] * tmp2);
- tmp0 = data[0] + data[2];
- tmp1 = data[0] - data[2];
- tmp2 = (data[1] >> 1) - data[3];
- tmp3 = data[1] + (data[3] >> 1);
- data[0] = (tmp0 + tmp3 + 32)>>6;
- data[1] = (tmp1 + tmp2 + 32)>>6;
- data[2] = (tmp1 - tmp2 + 32)>>6;
- data[3] = (tmp0 - tmp3 + 32)>>6;
- data[4] = data[8] = data[12] = data[0];
- data[5] = data[9] = data[13] = data[1];
- data[6] = data[10] = data[14] = data[2];
- data[7] = data[11] = data[15] = data[3];
- /* check that each value is in the range [-512,511] */
- if (((u32)(data[0] + 512) > 1023) ||
- ((u32)(data[1] + 512) > 1023) ||
- ((u32)(data[2] + 512) > 1023) ||
- ((u32)(data[3] + 512) > 1023) )
- return(HANTRO_NOK);
- }
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdProcessLumaDc
-
- Functional description:
- Function performs inverse zig-zag scan, inverse transform and
- inverse scaling for a luma DC coefficients block
-
- Inputs:
- data pointer to data to be processed
- qp quantization parameter
-
- Outputs:
- data processed data
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-void h264bsdProcessLumaDc(i32 *data, u32 qp)
-{
-
-/* Variables */
-
- i32 tmp0, tmp1, tmp2, tmp3;
- u32 row,col;
- u32 qpMod, qpDiv;
- i32 levScale;
- i32 *ptr;
-
-/* Code */
-
- qpMod = qpMod6[qp];
- qpDiv = qpDiv6[qp];
-
- /* zig-zag scan */
- tmp0 = data[2];
- data[2] = data[5];
- data[5] = data[4];
- data[4] = tmp0;
-
- tmp0 = data[8];
- data[8] = data[3];
- data[3] = data[6];
- data[6] = data[7];
- data[7] = data[12];
- data[12] = data[9];
- data[9] = tmp0;
-
- tmp0 = data[10];
- data[10] = data[11];
- data[11] = data[13];
- data[13] = tmp0;
-
- /* horizontal transform */
- for (row = 4, ptr = data; row--; ptr += 4)
- {
- tmp0 = ptr[0] + ptr[2];
- tmp1 = ptr[0] - ptr[2];
- tmp2 = ptr[1] - ptr[3];
- tmp3 = ptr[1] + ptr[3];
- ptr[0] = tmp0 + tmp3;
- ptr[1] = tmp1 + tmp2;
- ptr[2] = tmp1 - tmp2;
- ptr[3] = tmp0 - tmp3;
- }
-
- /*lint +e661 +e662*/
- /* then vertical transform and inverse scaling */
- levScale = levelScale[ qpMod ][0];
- if (qp >= 12)
- {
- levScale <<= (qpDiv-2);
- for (col = 4; col--; data++)
- {
- tmp0 = data[0] + data[8 ];
- tmp1 = data[0] - data[8 ];
- tmp2 = data[4] - data[12];
- tmp3 = data[4] + data[12];
- data[0 ] = ((tmp0 + tmp3)*levScale);
- data[4 ] = ((tmp1 + tmp2)*levScale);
- data[8 ] = ((tmp1 - tmp2)*levScale);
- data[12] = ((tmp0 - tmp3)*levScale);
- }
- }
- else
- {
- i32 tmp;
- tmp = ((1 - qpDiv) == 0) ? 1 : 2;
- for (col = 4; col--; data++)
- {
- tmp0 = data[0] + data[8 ];
- tmp1 = data[0] - data[8 ];
- tmp2 = data[4] - data[12];
- tmp3 = data[4] + data[12];
- data[0 ] = ((tmp0 + tmp3)*levScale+tmp) >> (2-qpDiv);
- data[4 ] = ((tmp1 + tmp2)*levScale+tmp) >> (2-qpDiv);
- data[8 ] = ((tmp1 - tmp2)*levScale+tmp) >> (2-qpDiv);
- data[12] = ((tmp0 - tmp3)*levScale+tmp) >> (2-qpDiv);
- }
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdProcessChromaDc
-
- Functional description:
- Function performs inverse transform and inverse scaling for a
- chroma DC coefficients block
-
- Inputs:
- data pointer to data to be processed
- qp quantization parameter
-
- Outputs:
- data processed data
-
- Returns:
- none
-
-------------------------------------------------------------------------------*/
-void h264bsdProcessChromaDc(i32 *data, u32 qp)
-{
-
-/* Variables */
-
- i32 tmp0, tmp1, tmp2, tmp3;
- u32 qpDiv;
- i32 levScale;
- u32 levShift;
-
-/* Code */
-
- qpDiv = qpDiv6[qp];
- levScale = levelScale[ qpMod6[qp] ][0];
-
- if (qp >= 6)
- {
- levScale <<= (qpDiv-1);
- levShift = 0;
- }
- else
- {
- levShift = 1;
- }
-
- tmp0 = data[0] + data[2];
- tmp1 = data[0] - data[2];
- tmp2 = data[1] - data[3];
- tmp3 = data[1] + data[3];
- data[0] = ((tmp0 + tmp3) * levScale) >> levShift;
- data[1] = ((tmp0 - tmp3) * levScale) >> levShift;
- data[2] = ((tmp1 + tmp2) * levScale) >> levShift;
- data[3] = ((tmp1 - tmp2) * levScale) >> levShift;
- tmp0 = data[4] + data[6];
- tmp1 = data[4] - data[6];
- tmp2 = data[5] - data[7];
- tmp3 = data[5] + data[7];
- data[4] = ((tmp0 + tmp3) * levScale) >> levShift;
- data[5] = ((tmp0 - tmp3) * levScale) >> levShift;
- data[6] = ((tmp1 + tmp2) * levScale) >> levShift;
- data[7] = ((tmp1 - tmp2) * levScale) >> levShift;
-
-}
-
-/*lint +e701 +e702 */
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_transform.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_transform.h
deleted file mode 100644
index 4f41a23..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_transform.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_TRANSFORM_H
-#define H264SWDEC_TRANSFORM_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-u32 h264bsdProcessBlock(i32 *data, u32 qp, u32 skip, u32 coeffMap);
-void h264bsdProcessLumaDc(i32 *data, u32 qp);
-void h264bsdProcessChromaDc(i32 *data, u32 qp);
-
-#endif /* #ifdef H264SWDEC_TRANSFORM_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_util.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_util.c
deleted file mode 100644
index fb97a28..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_util.c
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdCountLeadingZeros
- h264bsdRbspTrailingBits
- h264bsdMoreRbspData
- h264bsdNextMbAddress
- h264bsdSetCurrImageMbPointers
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_util.h"
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-/* look-up table for expected values of stuffing bits */
-static const u32 stuffingTable[8] = {0x1,0x2,0x4,0x8,0x10,0x20,0x40,0x80};
-
-/* look-up table for chroma quantization parameter as a function of luma QP */
-const u32 h264bsdQpC[52] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
- 20,21,22,23,24,25,26,27,28,29,29,30,31,32,32,33,34,34,35,35,36,36,37,37,37,
- 38,38,38,39,39,39,39};
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
-
- 5.1 Function: h264bsdCountLeadingZeros
-
- Functional description:
- Count leading zeros in a code word. Code word is assumed to be
- right-aligned, last bit of the code word in the lsb of the value.
-
- Inputs:
- value code word
- length number of bits in the code word
-
- Outputs:
- none
-
- Returns:
- number of leading zeros in the code word
-
-------------------------------------------------------------------------------*/
-#ifndef H264DEC_NEON
-u32 h264bsdCountLeadingZeros(u32 value, u32 length)
-{
-
-/* Variables */
-
- u32 zeros = 0;
- u32 mask = 1 << (length - 1);
-
-/* Code */
-
- ASSERT(length <= 32);
-
- while (mask && !(value & mask))
- {
- zeros++;
- mask >>= 1;
- }
- return(zeros);
-
-}
-#endif
-/*------------------------------------------------------------------------------
-
- 5.2 Function: h264bsdRbspTrailingBits
-
- Functional description:
- Check Raw Byte Stream Payload (RBSP) trailing bits, i.e. stuffing.
- Rest of the current byte (whole byte if allready byte aligned)
- in the stream buffer shall contain a '1' bit followed by zero or
- more '0' bits.
-
- Inputs:
- pStrmData pointer to stream data structure
-
- Outputs:
- none
-
- Returns:
- HANTRO_OK RBSP trailing bits found
- HANTRO_NOK otherwise
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdRbspTrailingBits(strmData_t *pStrmData)
-{
-
-/* Variables */
-
- u32 stuffing;
- u32 stuffingLength;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pStrmData->bitPosInWord < 8);
-
- stuffingLength = 8 - pStrmData->bitPosInWord;
-
- stuffing = h264bsdGetBits(pStrmData, stuffingLength);
- if (stuffing == END_OF_STREAM)
- return(HANTRO_NOK);
-
- if (stuffing != stuffingTable[stuffingLength - 1])
- return(HANTRO_NOK);
- else
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- 5.3 Function: h264bsdMoreRbspData
-
- Functional description:
- Check if there is more data in the current RBSP. The standard
- defines this function so that there is more data if
- -more than 8 bits left or
- -last bits are not RBSP trailing bits
-
- Inputs:
- pStrmData pointer to stream data structure
-
- Outputs:
- none
-
- Returns:
- HANTRO_TRUE there is more data
- HANTRO_FALSE no more data
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdMoreRbspData(strmData_t *pStrmData)
-{
-
-/* Variables */
-
- u32 bits;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pStrmData->strmBuffReadBits <= 8 * pStrmData->strmBuffSize);
-
- bits = pStrmData->strmBuffSize * 8 - pStrmData->strmBuffReadBits;
-
- if (bits == 0)
- return(HANTRO_FALSE);
-
- if ( (bits > 8) ||
- ((h264bsdShowBits32(pStrmData)>>(32-bits)) != (1ul << (bits-1))) )
- return(HANTRO_TRUE);
- else
- return(HANTRO_FALSE);
-
-}
-
-/*------------------------------------------------------------------------------
-
- 5.4 Function: h264bsdNextMbAddress
-
- Functional description:
- Get address of the next macroblock in the current slice group.
-
- Inputs:
- pSliceGroupMap slice group for each macroblock
- picSizeInMbs size of the picture
- currMbAddr where to start
-
- Outputs:
- none
-
- Returns:
- address of the next macroblock
- 0 if none of the following macroblocks belong to same slice
- group as currMbAddr
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdNextMbAddress(u32 *pSliceGroupMap, u32 picSizeInMbs, u32 currMbAddr)
-{
-
-/* Variables */
-
- u32 i, sliceGroup;
-
-/* Code */
-
- ASSERT(pSliceGroupMap);
- ASSERT(picSizeInMbs);
- ASSERT(currMbAddr < picSizeInMbs);
-
- sliceGroup = pSliceGroupMap[currMbAddr];
-
- i = currMbAddr + 1;
- while ((i < picSizeInMbs) && (pSliceGroupMap[i] != sliceGroup))
- {
- i++;
- }
-
- if (i == picSizeInMbs)
- i = 0;
-
- return(i);
-
-}
-
-
-/*------------------------------------------------------------------------------
-
- 5.5 Function: h264bsdSetCurrImageMbPointers
-
- Functional description:
- Set luma and chroma pointers in image_t for current MB
-
- Inputs:
- image Current image
- mbNum number of current MB
-
- Outputs:
- none
-
- Returns:
- none
-------------------------------------------------------------------------------*/
-void h264bsdSetCurrImageMbPointers(image_t *image, u32 mbNum)
-{
- u32 width, height;
- u32 picSize;
- u32 row, col;
- u32 tmp;
-
- width = image->width;
- height = image->height;
- row = mbNum / width;
- col = mbNum % width;
-
- tmp = row * width;
- picSize = width * height;
-
- image->luma = (u8*)(image->data + col * 16 + tmp * 256);
- image->cb = (u8*)(image->data + picSize * 256 + tmp * 64 + col * 8);
- image->cr = (u8*)(image->cb + picSize * 64);
-}
-
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_util.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_util.h
deleted file mode 100644
index f43cf82..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_util.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_UTIL_H
-#define H264SWDEC_UTIL_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#ifdef _ASSERT_USED
-#include <assert.h>
-#endif
-
-#include "H264SwDecApi.h"
-
-#if defined(_RANGE_CHECK) || defined(_DEBUG_PRINT) || defined(_ERROR_PRINT)
-#include <stdio.h>
-#endif
-
-#include <stdint.h>
-#include "basetype.h"
-#include "h264bsd_stream.h"
-#include "h264bsd_image.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-#define HANTRO_OK 0
-#define HANTRO_NOK 1
-
-#define HANTRO_TRUE (1)
-#define HANTRO_FALSE (0)
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#define MEMORY_ALLOCATION_ERROR 0xFFFF
-#define PARAM_SET_ERROR 0xFFF0
-
-/* value to be returned by GetBits if stream buffer is empty */
-#define END_OF_STREAM 0xFFFFFFFFU
-
-#define EMPTY_RESIDUAL_INDICATOR 0xFFFFFF
-
-/* macro to mark a residual block empty, i.e. contain zero coefficients */
-#define MARK_RESIDUAL_EMPTY(residual) ((residual)[0] = EMPTY_RESIDUAL_INDICATOR)
-/* macro to check if residual block is empty */
-#define IS_RESIDUAL_EMPTY(residual) ((residual)[0] == EMPTY_RESIDUAL_INDICATOR)
-
-/* macro for assertion, used only if compiler flag _ASSERT_USED is defined */
-#ifdef _ASSERT_USED
-#define ASSERT(expr) assert(expr)
-#else
-#define ASSERT(expr)
-#endif
-
-/* macro for range checking an value, used only if compiler flag _RANGE_CHECK
- * is defined */
-#ifdef _RANGE_CHECK
-#define RANGE_CHECK(value, minBound, maxBound) \
-{ \
- if ((value) < (minBound) || (value) > (maxBound)) \
- fprintf(stderr, "Warning: Value exceeds given limit(s)!\n"); \
-}
-#else
-#define RANGE_CHECK(value, minBound, maxBound)
-#endif
-
-/* macro for range checking an array, used only if compiler flag _RANGE_CHECK
- * is defined */
-#ifdef _RANGE_CHECK
-#define RANGE_CHECK_ARRAY(array, minBound, maxBound, length) \
-{ \
- i32 i; \
- for (i = 0; i < (length); i++) \
- if ((array)[i] < (minBound) || (array)[i] > (maxBound)) \
- fprintf(stderr,"Warning: Value [%d] exceeds given limit(s)!\n",i); \
-}
-#else
-#define RANGE_CHECK_ARRAY(array, minBound, maxBound, length)
-#endif
-
-/* macro for debug printing, used only if compiler flag _DEBUG_PRINT is
- * defined */
-#ifdef _DEBUG_PRINT
-#define DEBUG(args) printf args
-#else
-#define DEBUG(args)
-#endif
-
-/* macro for error printing, used only if compiler flag _ERROR_PRINT is
- * defined */
-#ifdef _ERROR_PRINT
-#define EPRINT(msg) fprintf(stderr,"ERROR: %s\n",msg)
-#else
-#define EPRINT(msg)
-#endif
-
-/* macro to get smaller of two values */
-#define MIN(a, b) (((a) < (b)) ? (a) : (b))
-
-/* macro to get greater of two values */
-#define MAX(a, b) (((a) > (b)) ? (a) : (b))
-
-/* macro to get absolute value */
-#define ABS(a) (((a) < 0) ? -(a) : (a))
-
-/* macro to clip a value z, so that x <= z =< y */
-#define CLIP3(x,y,z) (((z) < (x)) ? (x) : (((z) > (y)) ? (y) : (z)))
-
-/* macro to clip a value z, so that 0 <= z =< 255 */
-#define CLIP1(z) (((z) < 0) ? 0 : (((z) > 255) ? 255 : (z)))
-
-/* macro to allocate memory */
-#define ALLOCATE(ptr, count, type) \
-{ \
- (ptr) = H264SwDecMalloc(sizeof(type), (count)); \
-}
-
-/* macro to free allocated memory */
-#define FREE(ptr) \
-{ \
- H264SwDecFree((ptr)); (ptr) = NULL; \
-}
-
-#define ALIGN(ptr, bytePos) \
- ((ptr) + ( (((bytePos) - (uintptr_t)(ptr)) & ((bytePos) - 1)) / sizeof(*(ptr)) ))
-
-extern const u32 h264bsdQpC[52];
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-#ifndef H264DEC_NEON
-u32 h264bsdCountLeadingZeros(u32 value, u32 length);
-#else
-u32 h264bsdCountLeadingZeros(u32 value);
-#endif
-u32 h264bsdRbspTrailingBits(strmData_t *strmData);
-
-u32 h264bsdMoreRbspData(strmData_t *strmData);
-
-u32 h264bsdNextMbAddress(u32 *pSliceGroupMap, u32 picSizeInMbs, u32 currMbAddr);
-
-void h264bsdSetCurrImageMbPointers(image_t *image, u32 mbNum);
-
-#endif /* #ifdef H264SWDEC_UTIL_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_vlc.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_vlc.c
deleted file mode 100644
index 060f35e..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_vlc.c
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdDecodeExpGolombUnsigned
- h264bsdDecodeExpGolombSigned
- h264bsdDecodeExpGolombMapped
- h264bsdDecodeExpGolombTruncated
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_vlc.h"
-#include "basetype.h"
-#include "h264bsd_stream.h"
-#include "h264bsd_util.h"
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-/* definition of special code num, this along with the return value is used
- * to handle code num in the range [0, 2^32] in the DecodeExpGolombUnsigned
- * function */
-#define BIG_CODE_NUM 0xFFFFFFFFU
-
-/* Mapping tables for coded_block_pattern, used for decoding of mapped
- * Exp-Golomb codes */
-static const u8 codedBlockPatternIntra4x4[48] = {
- 47,31,15,0,23,27,29,30,7,11,13,14,39,43,45,46,16,3,5,10,12,19,21,26,28,35,
- 37,42,44,1,2,4,8,17,18,20,24,6,9,22,25,32,33,34,36,40,38,41};
-
-static const u8 codedBlockPatternInter[48] = {
- 0,16,1,2,4,8,32,3,5,10,12,15,47,7,11,13,14,6,9,31,35,37,42,44,33,34,36,40,
- 39,43,45,46,17,18,20,24,19,21,26,28,23,27,29,30,22,25,38,41};
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
-
- 5.1 Function: h264bsdDecodeExpGolombUnsigned
-
- Functional description:
- Decode unsigned Exp-Golomb code. This is the same as codeNum used
- in other Exp-Golomb code mappings. Code num (i.e. the decoded
- symbol) is determined as
-
- codeNum = 2^leadingZeros - 1 + GetBits(leadingZeros)
-
- Normal decoded symbols are in the range [0, 2^32 - 2]. Symbol
- 2^32-1 is indicated by BIG_CODE_NUM with return value HANTRO_OK
- while symbol 2^32 is indicated by BIG_CODE_NUM with return value
- HANTRO_NOK. These two symbols are special cases with code length
- of 65, i.e. 32 '0' bits, a '1' bit, and either 0 or 1 represented
- by 32 bits.
-
- Symbol 2^32 is out of unsigned 32-bit range but is needed for
- DecodeExpGolombSigned to express value -2^31.
-
- Inputs:
- pStrmData pointer to stream data structure
-
- Outputs:
- codeNum decoded code word is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK failure, no valid code word found, note exception
- with BIG_CODE_NUM
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeExpGolombUnsigned(strmData_t *pStrmData, u32 *codeNum)
-{
-
-/* Variables */
-
- u32 bits, numZeros;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(codeNum);
-
- bits = h264bsdShowBits32(pStrmData);
-
- /* first bit is 1 -> code length 1 */
- if (bits >= 0x80000000)
- {
- h264bsdFlushBits(pStrmData, 1);
- *codeNum = 0;
- return(HANTRO_OK);
- }
- /* second bit is 1 -> code length 3 */
- else if (bits >= 0x40000000)
- {
- if (h264bsdFlushBits(pStrmData, 3) == END_OF_STREAM)
- return(HANTRO_NOK);
- *codeNum = 1 + ((bits >> 29) & 0x1);
- return(HANTRO_OK);
- }
- /* third bit is 1 -> code length 5 */
- else if (bits >= 0x20000000)
- {
- if (h264bsdFlushBits(pStrmData, 5) == END_OF_STREAM)
- return(HANTRO_NOK);
- *codeNum = 3 + ((bits >> 27) & 0x3);
- return(HANTRO_OK);
- }
- /* fourth bit is 1 -> code length 7 */
- else if (bits >= 0x10000000)
- {
- if (h264bsdFlushBits(pStrmData, 7) == END_OF_STREAM)
- return(HANTRO_NOK);
- *codeNum = 7 + ((bits >> 25) & 0x7);
- return(HANTRO_OK);
- }
- /* other code lengths */
- else
- {
-#ifndef H264DEC_NEON
- numZeros = 4 + h264bsdCountLeadingZeros(bits, 28);
-#else
- numZeros = h264bsdCountLeadingZeros(bits);
-#endif
- /* all 32 bits are zero */
- if (numZeros == 32)
- {
- *codeNum = 0;
- h264bsdFlushBits(pStrmData,32);
- bits = h264bsdGetBits(pStrmData, 1);
- /* check 33rd bit, must be 1 */
- if (bits == 1)
- {
- /* cannot use h264bsdGetBits, limited to 31 bits */
- bits = h264bsdShowBits32(pStrmData);
- if (h264bsdFlushBits(pStrmData, 32) == END_OF_STREAM)
- return(HANTRO_NOK);
- /* code num 2^32 - 1, needed for unsigned mapping */
- if (bits == 0)
- {
- *codeNum = BIG_CODE_NUM;
- return(HANTRO_OK);
- }
- /* code num 2^32, needed for unsigned mapping
- * (results in -2^31) */
- else if (bits == 1)
- {
- *codeNum = BIG_CODE_NUM;
- return(HANTRO_NOK);
- }
- }
- /* if more zeros than 32, it is an error */
- return(HANTRO_NOK);
- }
- else
- h264bsdFlushBits(pStrmData,numZeros+1);
-
- bits = h264bsdGetBits(pStrmData, numZeros);
- if (bits == END_OF_STREAM)
- return(HANTRO_NOK);
-
- *codeNum = (1 << numZeros) - 1 + bits;
-
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- 5.2 Function: h264bsdDecodeExpGolombSigned
-
- Functional description:
- Decode signed Exp-Golomb code. Code num is determined by
- h264bsdDecodeExpGolombUnsigned and then mapped to signed
- representation as
-
- symbol = (-1)^(codeNum+1) * (codeNum+1)/2
-
- Signed symbols shall be in the range [-2^31, 2^31 - 1]. Symbol
- -2^31 is obtained when codeNum is 2^32, which cannot be expressed
- by unsigned 32-bit value. This is signaled as a special case from
- the h264bsdDecodeExpGolombUnsigned by setting codeNum to
- BIG_CODE_NUM and returning HANTRO_NOK status.
-
- Inputs:
- pStrmData pointer to stream data structure
-
- Outputs:
- value decoded code word is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK failure, no valid code word found
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeExpGolombSigned(strmData_t *pStrmData, i32 *value)
-{
-
-/* Variables */
-
- u32 status, codeNum = 0;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(value);
-
- status = h264bsdDecodeExpGolombUnsigned(pStrmData, &codeNum);
-
- if (codeNum == BIG_CODE_NUM)
- {
- /* BIG_CODE_NUM and HANTRO_OK status means codeNum 2^32-1 which would
- * result in signed integer valued 2^31 (i.e. out of 32-bit signed
- * integer range) */
- if (status == HANTRO_OK)
- return(HANTRO_NOK);
- /* BIG_CODE_NUM and HANTRO_NOK status means codeNum 2^32 which results
- * in signed integer valued -2^31 */
- else
- {
- *value = (i32)(2147483648U);
- return (HANTRO_OK);
- }
- }
- else if (status == HANTRO_OK)
- {
- /* (-1)^(codeNum+1) results in positive sign if codeNum is odd,
- * negative when it is even. (codeNum+1)/2 is obtained as
- * (codeNum+1)>>1 when value is positive and as (-codeNum)>>1 for
- * negative value */
- /*lint -e702 */
- *value = (codeNum & 0x1) ? (i32)((codeNum + 1) >> 1) :
- -(i32)((codeNum + 1) >> 1);
- /*lint +e702 */
- return(HANTRO_OK);
- }
-
- return(HANTRO_NOK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- 5.3 Function: h264bsdDecodeExpGolombMapped
-
- Functional description:
- Decode mapped Exp-Golomb code. Code num is determined by
- h264bsdDecodeExpGolombUnsigned and then mapped to codedBlockPattern
- either for intra or inter macroblock. The mapping is implemented by
- look-up tables defined in the beginning of the file.
-
- Inputs:
- pStrmData pointer to stream data structure
- isIntra flag to indicate if intra or inter mapping is to
- be used
-
- Outputs:
- value decoded code word is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK failure, no valid code word found
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeExpGolombMapped(strmData_t *pStrmData, u32 *value,
- u32 isIntra)
-{
-
-/* Variables */
-
- u32 status, codeNum;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(value);
-
- status = h264bsdDecodeExpGolombUnsigned(pStrmData, &codeNum);
-
- if (status != HANTRO_OK)
- return (HANTRO_NOK);
- else
- {
- /* range of valid codeNums [0,47] */
- if (codeNum > 47)
- return (HANTRO_NOK);
- if (isIntra)
- *value = codedBlockPatternIntra4x4[codeNum];
- else
- *value = codedBlockPatternInter[codeNum];
- return(HANTRO_OK);
- }
-
-}
-
-/*------------------------------------------------------------------------------
-
- 5.4 Function: h264bsdDecodeExpGolombTruncated
-
- Functional description:
- Decode truncated Exp-Golomb code. greaterThanOne flag indicates
- the range of the symbol to be decoded as follows:
- FALSE -> [0,1]
- TRUE -> [0,2^32-1]
-
- If flag is false the decoding is performed by reading one bit
- from the stream with h264bsdGetBits and mapping this to decoded
- symbol as
- symbol = bit ? 0 : 1
-
- Otherwise, i.e. when flag is TRUE, code num is determined by
- h264bsdDecodeExpGolombUnsigned and this is used as the decoded
- symbol.
-
- Inputs:
- pStrmData pointer to stream data structure
- greaterThanOne flag to indicate if range is wider than [0,1]
-
- Outputs:
- value decoded code word is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK failure, no valid code word found
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeExpGolombTruncated(
- strmData_t *pStrmData,
- u32 *value,
- u32 greaterThanOne)
-{
-
-/* Variables */
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(value);
-
- if (greaterThanOne)
- {
- return(h264bsdDecodeExpGolombUnsigned(pStrmData, value));
- }
- else
- {
- *value = h264bsdGetBits(pStrmData,1);
- if (*value == END_OF_STREAM)
- return (HANTRO_NOK);
- *value ^= 0x1;
- }
-
- return (HANTRO_OK);
-
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_vlc.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_vlc.h
deleted file mode 100644
index 4c16773..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_vlc.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_VLC_H
-#define H264SWDEC_VLC_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_stream.h"
-#include "h264bsd_transform.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeExpGolombUnsigned(strmData_t *pStrmData, u32 *value);
-
-u32 h264bsdDecodeExpGolombSigned(strmData_t *pStrmData, i32 *value);
-
-u32 h264bsdDecodeExpGolombMapped(strmData_t *pStrmData, u32 *value,
- u32 isIntra);
-
-u32 h264bsdDecodeExpGolombTruncated(strmData_t *pStrmData, u32 *value,
- u32 greaterThanOne);
-
-#endif /* #ifdef H264SWDEC_VLC_H */
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_vui.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_vui.c
deleted file mode 100644
index 4a9335a..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_vui.c
+++ /dev/null
@@ -1,490 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. External compiler flags
- 3. Module defines
- 4. Local function prototypes
- 5. Functions
- h264bsdDecodeVuiParameters
- DecodeHrdParameters
-
-------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "h264bsd_vui.h"
-#include "basetype.h"
-#include "h264bsd_vlc.h"
-#include "h264bsd_stream.h"
-#include "h264bsd_util.h"
-
-/*------------------------------------------------------------------------------
- 2. External compiler flags
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
- 3. Module defines
-------------------------------------------------------------------------------*/
-
-#define MAX_DPB_SIZE 16
-#define MAX_BR 240000 /* for level 5.1 */
-#define MAX_CPB 240000 /* for level 5.1 */
-
-/*------------------------------------------------------------------------------
- 4. Local function prototypes
-------------------------------------------------------------------------------*/
-
-static u32 DecodeHrdParameters(
- strmData_t *pStrmData,
- hrdParameters_t *pHrdParameters);
-
-/*------------------------------------------------------------------------------
-
- Function: h264bsdDecodeVuiParameters
-
- Functional description:
- Decode VUI parameters from the stream. See standard for details.
-
- Inputs:
- pStrmData pointer to stream data structure
-
- Outputs:
- pVuiParameters decoded information is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK invalid stream data or end of stream
-
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeVuiParameters(strmData_t *pStrmData,
- vuiParameters_t *pVuiParameters)
-{
-
-/* Variables */
-
- u32 tmp;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pVuiParameters);
-
- H264SwDecMemset(pVuiParameters, 0, sizeof(vuiParameters_t));
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->aspectRatioPresentFlag = (tmp == 1) ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- if (pVuiParameters->aspectRatioPresentFlag)
- {
- tmp = h264bsdGetBits(pStrmData, 8);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->aspectRatioIdc = tmp;
-
- if (pVuiParameters->aspectRatioIdc == ASPECT_RATIO_EXTENDED_SAR)
- {
- tmp = h264bsdGetBits(pStrmData, 16);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->sarWidth = tmp;
-
- tmp = h264bsdGetBits(pStrmData, 16);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->sarHeight = tmp;
- }
- }
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->overscanInfoPresentFlag = (tmp == 1) ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- if (pVuiParameters->overscanInfoPresentFlag)
- {
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->overscanAppropriateFlag = (tmp == 1) ?
- HANTRO_TRUE : HANTRO_FALSE;
- }
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->videoSignalTypePresentFlag = (tmp == 1) ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- if (pVuiParameters->videoSignalTypePresentFlag)
- {
- tmp = h264bsdGetBits(pStrmData, 3);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->videoFormat = tmp;
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->videoFullRangeFlag = (tmp == 1) ?
- HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->colourDescriptionPresentFlag =
- (tmp == 1) ? HANTRO_TRUE : HANTRO_FALSE;
-
- if (pVuiParameters->colourDescriptionPresentFlag)
- {
- tmp = h264bsdGetBits(pStrmData, 8);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->colourPrimaries = tmp;
-
- tmp = h264bsdGetBits(pStrmData, 8);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->transferCharacteristics = tmp;
-
- tmp = h264bsdGetBits(pStrmData, 8);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->matrixCoefficients = tmp;
- }
- else
- {
- pVuiParameters->colourPrimaries = 2;
- pVuiParameters->transferCharacteristics = 2;
- pVuiParameters->matrixCoefficients = 2;
- }
- }
- else
- {
- pVuiParameters->videoFormat = 5;
- pVuiParameters->colourPrimaries = 2;
- pVuiParameters->transferCharacteristics = 2;
- pVuiParameters->matrixCoefficients = 2;
- }
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->chromaLocInfoPresentFlag =
- (tmp == 1) ? HANTRO_TRUE : HANTRO_FALSE;
-
- if (pVuiParameters->chromaLocInfoPresentFlag)
- {
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pVuiParameters->chromaSampleLocTypeTopField);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pVuiParameters->chromaSampleLocTypeTopField > 5)
- return(HANTRO_NOK);
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pVuiParameters->chromaSampleLocTypeBottomField);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pVuiParameters->chromaSampleLocTypeBottomField > 5)
- return(HANTRO_NOK);
- }
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->timingInfoPresentFlag =
- (tmp == 1) ? HANTRO_TRUE : HANTRO_FALSE;
-
- if (pVuiParameters->timingInfoPresentFlag)
- {
- tmp = h264bsdShowBits32(pStrmData);
- if (h264bsdFlushBits(pStrmData, 32) == END_OF_STREAM)
- return(HANTRO_NOK);
- if (tmp == 0)
- return(HANTRO_NOK);
- pVuiParameters->numUnitsInTick = tmp;
-
- tmp = h264bsdShowBits32(pStrmData);
- if (h264bsdFlushBits(pStrmData, 32) == END_OF_STREAM)
- return(HANTRO_NOK);
- if (tmp == 0)
- return(HANTRO_NOK);
- pVuiParameters->timeScale = tmp;
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->fixedFrameRateFlag =
- (tmp == 1) ? HANTRO_TRUE : HANTRO_FALSE;
- }
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->nalHrdParametersPresentFlag =
- (tmp == 1) ? HANTRO_TRUE : HANTRO_FALSE;
-
- if (pVuiParameters->nalHrdParametersPresentFlag)
- {
- tmp = DecodeHrdParameters(pStrmData, &pVuiParameters->nalHrdParameters);
- if (tmp != HANTRO_OK)
- return(tmp);
- }
- else
- {
- pVuiParameters->nalHrdParameters.cpbCnt = 1;
- /* MaxBR and MaxCPB should be the values correspondig to the levelIdc
- * in the SPS containing these VUI parameters. However, these values
- * are not used anywhere and maximum for any level will be used here */
- pVuiParameters->nalHrdParameters.bitRateValue[0] = 1200 * MAX_BR + 1;
- pVuiParameters->nalHrdParameters.cpbSizeValue[0] = 1200 * MAX_CPB + 1;
- pVuiParameters->nalHrdParameters.initialCpbRemovalDelayLength = 24;
- pVuiParameters->nalHrdParameters.cpbRemovalDelayLength = 24;
- pVuiParameters->nalHrdParameters.dpbOutputDelayLength = 24;
- pVuiParameters->nalHrdParameters.timeOffsetLength = 24;
- }
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->vclHrdParametersPresentFlag =
- (tmp == 1) ? HANTRO_TRUE : HANTRO_FALSE;
-
- if (pVuiParameters->vclHrdParametersPresentFlag)
- {
- tmp = DecodeHrdParameters(pStrmData, &pVuiParameters->vclHrdParameters);
- if (tmp != HANTRO_OK)
- return(tmp);
- }
- else
- {
- pVuiParameters->vclHrdParameters.cpbCnt = 1;
- /* MaxBR and MaxCPB should be the values correspondig to the levelIdc
- * in the SPS containing these VUI parameters. However, these values
- * are not used anywhere and maximum for any level will be used here */
- pVuiParameters->vclHrdParameters.bitRateValue[0] = 1000 * MAX_BR + 1;
- pVuiParameters->vclHrdParameters.cpbSizeValue[0] = 1000 * MAX_CPB + 1;
- pVuiParameters->vclHrdParameters.initialCpbRemovalDelayLength = 24;
- pVuiParameters->vclHrdParameters.cpbRemovalDelayLength = 24;
- pVuiParameters->vclHrdParameters.dpbOutputDelayLength = 24;
- pVuiParameters->vclHrdParameters.timeOffsetLength = 24;
- }
-
- if (pVuiParameters->nalHrdParametersPresentFlag ||
- pVuiParameters->vclHrdParametersPresentFlag)
- {
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->lowDelayHrdFlag =
- (tmp == 1) ? HANTRO_TRUE : HANTRO_FALSE;
- }
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->picStructPresentFlag =
- (tmp == 1) ? HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->bitstreamRestrictionFlag =
- (tmp == 1) ? HANTRO_TRUE : HANTRO_FALSE;
-
- if (pVuiParameters->bitstreamRestrictionFlag)
- {
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pVuiParameters->motionVectorsOverPicBoundariesFlag =
- (tmp == 1) ? HANTRO_TRUE : HANTRO_FALSE;
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pVuiParameters->maxBytesPerPicDenom);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pVuiParameters->maxBytesPerPicDenom > 16)
- return(HANTRO_NOK);
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pVuiParameters->maxBitsPerMbDenom);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pVuiParameters->maxBitsPerMbDenom > 16)
- return(HANTRO_NOK);
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pVuiParameters->log2MaxMvLengthHorizontal);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pVuiParameters->log2MaxMvLengthHorizontal > 16)
- return(HANTRO_NOK);
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pVuiParameters->log2MaxMvLengthVertical);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pVuiParameters->log2MaxMvLengthVertical > 16)
- return(HANTRO_NOK);
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pVuiParameters->numReorderFrames);
- if (tmp != HANTRO_OK)
- return(tmp);
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pVuiParameters->maxDecFrameBuffering);
- if (tmp != HANTRO_OK)
- return(tmp);
- }
- else
- {
- pVuiParameters->motionVectorsOverPicBoundariesFlag = HANTRO_TRUE;
- pVuiParameters->maxBytesPerPicDenom = 2;
- pVuiParameters->maxBitsPerMbDenom = 1;
- pVuiParameters->log2MaxMvLengthHorizontal = 16;
- pVuiParameters->log2MaxMvLengthVertical = 16;
- pVuiParameters->numReorderFrames = MAX_DPB_SIZE;
- pVuiParameters->maxDecFrameBuffering = MAX_DPB_SIZE;
- }
-
- return(HANTRO_OK);
-
-}
-
-/*------------------------------------------------------------------------------
-
- Function: DecodeHrdParameters
-
- Functional description:
- Decode HRD parameters from the stream. See standard for details.
-
- Inputs:
- pStrmData pointer to stream data structure
-
- Outputs:
- pHrdParameters decoded information is stored here
-
- Returns:
- HANTRO_OK success
- HANTRO_NOK invalid stream data
-
-------------------------------------------------------------------------------*/
-
-static u32 DecodeHrdParameters(
- strmData_t *pStrmData,
- hrdParameters_t *pHrdParameters)
-{
-
-/* Variables */
-
- u32 tmp, i;
-
-/* Code */
-
- ASSERT(pStrmData);
- ASSERT(pHrdParameters);
-
-
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData, &pHrdParameters->cpbCnt);
- if (tmp != HANTRO_OK)
- return(tmp);
- /* cpbCount = cpb_cnt_minus1 + 1 */
- pHrdParameters->cpbCnt++;
- if (pHrdParameters->cpbCnt > MAX_CPB_CNT)
- return(HANTRO_NOK);
-
- tmp = h264bsdGetBits(pStrmData, 4);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pHrdParameters->bitRateScale = tmp;
-
- tmp = h264bsdGetBits(pStrmData, 4);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pHrdParameters->cpbSizeScale = tmp;
-
- for (i = 0; i < pHrdParameters->cpbCnt; i++)
- {
- /* bit_rate_value_minus1 in the range [0, 2^32 - 2] */
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pHrdParameters->bitRateValue[i]);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pHrdParameters->bitRateValue[i] > 4294967294U)
- return(HANTRO_NOK);
- pHrdParameters->bitRateValue[i]++;
- /* this may result in overflow, but this value is not used for
- * anything */
- pHrdParameters->bitRateValue[i] *=
- 1 << (6 + pHrdParameters->bitRateScale);
-
- /* cpb_size_value_minus1 in the range [0, 2^32 - 2] */
- tmp = h264bsdDecodeExpGolombUnsigned(pStrmData,
- &pHrdParameters->cpbSizeValue[i]);
- if (tmp != HANTRO_OK)
- return(tmp);
- if (pHrdParameters->cpbSizeValue[i] > 4294967294U)
- return(HANTRO_NOK);
- pHrdParameters->cpbSizeValue[i]++;
- /* this may result in overflow, but this value is not used for
- * anything */
- pHrdParameters->cpbSizeValue[i] *=
- 1 << (4 + pHrdParameters->cpbSizeScale);
-
- tmp = h264bsdGetBits(pStrmData, 1);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pHrdParameters->cbrFlag[i] = (tmp == 1) ? HANTRO_TRUE : HANTRO_FALSE;
- }
-
- tmp = h264bsdGetBits(pStrmData, 5);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pHrdParameters->initialCpbRemovalDelayLength = tmp + 1;
-
- tmp = h264bsdGetBits(pStrmData, 5);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pHrdParameters->cpbRemovalDelayLength = tmp + 1;
-
- tmp = h264bsdGetBits(pStrmData, 5);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pHrdParameters->dpbOutputDelayLength = tmp + 1;
-
- tmp = h264bsdGetBits(pStrmData, 5);
- if (tmp == END_OF_STREAM)
- return(HANTRO_NOK);
- pHrdParameters->timeOffsetLength = tmp;
-
- return(HANTRO_OK);
-
-}
-
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_vui.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_vui.h
deleted file mode 100644
index 05d52a4..0000000
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_vui.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------------------
-
- Table of contents
-
- 1. Include headers
- 2. Module defines
- 3. Data types
- 4. Function prototypes
-
-------------------------------------------------------------------------------*/
-
-#ifndef H264SWDEC_VUI_H
-#define H264SWDEC_VUI_H
-
-/*------------------------------------------------------------------------------
- 1. Include headers
-------------------------------------------------------------------------------*/
-
-#include "basetype.h"
-#include "h264bsd_stream.h"
-
-/*------------------------------------------------------------------------------
- 2. Module defines
-------------------------------------------------------------------------------*/
-
-#define MAX_CPB_CNT 32
-
-/*------------------------------------------------------------------------------
- 3. Data types
-------------------------------------------------------------------------------*/
-
-/* enumerated sample aspect ratios, ASPECT_RATIO_M_N means M:N */
-enum
-{
- ASPECT_RATIO_UNSPECIFIED = 0,
- ASPECT_RATIO_1_1,
- ASPECT_RATIO_12_11,
- ASPECT_RATIO_10_11,
- ASPECT_RATIO_16_11,
- ASPECT_RATIO_40_33,
- ASPECT_RATIO_24_11,
- ASPECT_RATIO_20_11,
- ASPECT_RATIO_32_11,
- ASPECT_RATIO_80_33,
- ASPECT_RATIO_18_11,
- ASPECT_RATIO_15_11,
- ASPECT_RATIO_64_33,
- ASPECT_RATIO_160_99,
- ASPECT_RATIO_EXTENDED_SAR = 255
-};
-
-/* structure to store Hypothetical Reference Decoder (HRD) parameters */
-typedef struct
-{
- u32 cpbCnt;
- u32 bitRateScale;
- u32 cpbSizeScale;
- u32 bitRateValue[MAX_CPB_CNT];
- u32 cpbSizeValue[MAX_CPB_CNT];
- u32 cbrFlag[MAX_CPB_CNT];
- u32 initialCpbRemovalDelayLength;
- u32 cpbRemovalDelayLength;
- u32 dpbOutputDelayLength;
- u32 timeOffsetLength;
-} hrdParameters_t;
-
-/* storage for VUI parameters */
-typedef struct
-{
- u32 aspectRatioPresentFlag;
- u32 aspectRatioIdc;
- u32 sarWidth;
- u32 sarHeight;
- u32 overscanInfoPresentFlag;
- u32 overscanAppropriateFlag;
- u32 videoSignalTypePresentFlag;
- u32 videoFormat;
- u32 videoFullRangeFlag;
- u32 colourDescriptionPresentFlag;
- u32 colourPrimaries;
- u32 transferCharacteristics;
- u32 matrixCoefficients;
- u32 chromaLocInfoPresentFlag;
- u32 chromaSampleLocTypeTopField;
- u32 chromaSampleLocTypeBottomField;
- u32 timingInfoPresentFlag;
- u32 numUnitsInTick;
- u32 timeScale;
- u32 fixedFrameRateFlag;
- u32 nalHrdParametersPresentFlag;
- hrdParameters_t nalHrdParameters;
- u32 vclHrdParametersPresentFlag;
- hrdParameters_t vclHrdParameters;
- u32 lowDelayHrdFlag;
- u32 picStructPresentFlag;
- u32 bitstreamRestrictionFlag;
- u32 motionVectorsOverPicBoundariesFlag;
- u32 maxBytesPerPicDenom;
- u32 maxBitsPerMbDenom;
- u32 log2MaxMvLengthHorizontal;
- u32 log2MaxMvLengthVertical;
- u32 numReorderFrames;
- u32 maxDecFrameBuffering;
-} vuiParameters_t;
-
-/*------------------------------------------------------------------------------
- 4. Function prototypes
-------------------------------------------------------------------------------*/
-
-u32 h264bsdDecodeVuiParameters(strmData_t *pStrmData,
- vuiParameters_t *pVuiParameters);
-
-#endif /* #ifdef H264SWDEC_VUI_H */
-
diff --git a/media/libstagefright/codecs/opus/dec/Android.bp b/media/libstagefright/codecs/opus/dec/Android.bp
index ecd73f6..88d6ec4 100644
--- a/media/libstagefright/codecs/opus/dec/Android.bp
+++ b/media/libstagefright/codecs/opus/dec/Android.bp
@@ -1,5 +1,9 @@
cc_library_shared {
name: "libstagefright_soft_opusdec",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: ["SoftOpus.cpp"],
@@ -10,7 +14,7 @@
shared_libs: [
"libopus",
- "libmedia",
+ "libmedia_omx",
"libstagefright_omx",
"libstagefright_foundation",
"libutils",
@@ -29,4 +33,5 @@
cfi: true,
},
},
+ compile_multilib: "32",
}
diff --git a/media/libstagefright/codecs/opus/dec/SoftOpus.cpp b/media/libstagefright/codecs/opus/dec/SoftOpus.cpp
index 2ac6ce0..813004b 100644
--- a/media/libstagefright/codecs/opus/dec/SoftOpus.cpp
+++ b/media/libstagefright/codecs/opus/dec/SoftOpus.cpp
@@ -62,6 +62,7 @@
mSeekPreRoll(0),
mAnchorTimeUs(0),
mNumFramesOutput(0),
+ mHaveEOS(false),
mOutputPortSettingsChange(NONE) {
initPorts();
CHECK_EQ(initDecoder(), (status_t)OK);
@@ -129,6 +130,31 @@
OMX_ERRORTYPE SoftOpus::internalGetParameter(
OMX_INDEXTYPE index, OMX_PTR params) {
switch ((int)index) {
+ case OMX_IndexParamAudioPortFormat:
+ {
+ OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
+ (OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
+
+ if (!isValidOMXParam(formatParams)) {
+ return OMX_ErrorBadParameter;
+ }
+
+ if (formatParams->nPortIndex > 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ if (formatParams->nIndex > 0) {
+ return OMX_ErrorNoMore;
+ }
+
+ formatParams->eEncoding =
+ (formatParams->nPortIndex == 0)
+ ? (OMX_AUDIO_CODINGTYPE)OMX_AUDIO_CodingAndroidOPUS :
+ OMX_AUDIO_CodingPCM;
+
+ return OMX_ErrorNone;
+ }
+
case OMX_IndexParamAudioAndroidOpus:
{
OMX_AUDIO_PARAM_ANDROID_OPUSTYPE *opusParams =
@@ -212,6 +238,30 @@
return OMX_ErrorNone;
}
+ case OMX_IndexParamAudioPortFormat:
+ {
+ const OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
+ (const OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
+
+ if (!isValidOMXParam(formatParams)) {
+ return OMX_ErrorBadParameter;
+ }
+
+ if (formatParams->nPortIndex > 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ if ((formatParams->nPortIndex == 0
+ && formatParams->eEncoding !=
+ (OMX_AUDIO_CODINGTYPE)OMX_AUDIO_CodingAndroidOPUS)
+ || (formatParams->nPortIndex == 1
+ && formatParams->eEncoding != OMX_AUDIO_CodingPCM)) {
+ return OMX_ErrorUndefined;
+ }
+
+ return OMX_ErrorNone;
+ }
+
case OMX_IndexParamAudioAndroidOpus:
{
const OMX_AUDIO_PARAM_ANDROID_OPUSTYPE *opusParams =
@@ -335,7 +385,31 @@
return static_cast<double>(ns) * kRate / 1000000000;
}
-void SoftOpus::onQueueFilled(OMX_U32 portIndex) {
+void SoftOpus::handleEOS() {
+ List<BufferInfo *> &inQueue = getPortQueue(0);
+ List<BufferInfo *> &outQueue = getPortQueue(1);
+ CHECK(!inQueue.empty() && !outQueue.empty());
+
+ BufferInfo *outInfo = *outQueue.begin();
+ OMX_BUFFERHEADERTYPE *outHeader = outInfo->mHeader;
+ outHeader->nFilledLen = 0;
+ outHeader->nFlags = OMX_BUFFERFLAG_EOS;
+ mHaveEOS = true;
+
+ outQueue.erase(outQueue.begin());
+ outInfo->mOwnedByUs = false;
+ notifyFillBufferDone(outHeader);
+
+ BufferInfo *inInfo = *inQueue.begin();
+ OMX_BUFFERHEADERTYPE *inHeader = inInfo->mHeader;
+ inQueue.erase(inQueue.begin());
+ inInfo->mOwnedByUs = false;
+ notifyEmptyBufferDone(inHeader);
+
+ ++mInputBufferCount;
+}
+
+void SoftOpus::onQueueFilled(OMX_U32 /* portIndex */) {
List<BufferInfo *> &inQueue = getPortQueue(0);
List<BufferInfo *> &outQueue = getPortQueue(1);
@@ -343,104 +417,108 @@
return;
}
- if (portIndex == 0 && mInputBufferCount < 3) {
- BufferInfo *info = *inQueue.begin();
- OMX_BUFFERHEADERTYPE *header = info->mHeader;
-
- const uint8_t *data = header->pBuffer + header->nOffset;
- size_t size = header->nFilledLen;
-
- if (mInputBufferCount == 0) {
- CHECK(mHeader == NULL);
- mHeader = new OpusHeader();
- memset(mHeader, 0, sizeof(*mHeader));
- if (!ParseOpusHeader(data, size, mHeader)) {
- ALOGV("Parsing Opus Header failed.");
- notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
- return;
- }
-
- uint8_t channel_mapping[kMaxChannels] = {0};
- if (mHeader->channels <= kMaxChannelsWithDefaultLayout) {
- memcpy(&channel_mapping,
- kDefaultOpusChannelLayout,
- kMaxChannelsWithDefaultLayout);
- } else {
- memcpy(&channel_mapping,
- mHeader->stream_map,
- mHeader->channels);
- }
-
- int status = OPUS_INVALID_STATE;
- mDecoder = opus_multistream_decoder_create(kRate,
- mHeader->channels,
- mHeader->num_streams,
- mHeader->num_coupled,
- channel_mapping,
- &status);
- if (!mDecoder || status != OPUS_OK) {
- ALOGV("opus_multistream_decoder_create failed status=%s",
- opus_strerror(status));
- notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
- return;
- }
- status =
- opus_multistream_decoder_ctl(mDecoder,
- OPUS_SET_GAIN(mHeader->gain_db));
- if (status != OPUS_OK) {
- ALOGV("Failed to set OPUS header gain; status=%s",
- opus_strerror(status));
- notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
- return;
- }
- } else if (mInputBufferCount == 1) {
- mCodecDelay = ns_to_samples(
- *(reinterpret_cast<int64_t*>(header->pBuffer +
- header->nOffset)),
- kRate);
- mSamplesToDiscard = mCodecDelay;
- } else {
- mSeekPreRoll = ns_to_samples(
- *(reinterpret_cast<int64_t*>(header->pBuffer +
- header->nOffset)),
- kRate);
- notify(OMX_EventPortSettingsChanged, 1, 0, NULL);
- mOutputPortSettingsChange = AWAITING_DISABLED;
- }
-
- inQueue.erase(inQueue.begin());
- info->mOwnedByUs = false;
- notifyEmptyBufferDone(header);
- ++mInputBufferCount;
- return;
- }
-
- while (!inQueue.empty() && !outQueue.empty()) {
+ while (!mHaveEOS && !inQueue.empty() && !outQueue.empty()) {
BufferInfo *inInfo = *inQueue.begin();
OMX_BUFFERHEADERTYPE *inHeader = inInfo->mHeader;
- // Ignore CSD re-submissions.
- if (inHeader->nFlags & OMX_BUFFERFLAG_CODECCONFIG) {
+ if (mInputBufferCount < 3) {
+ const uint8_t *data = inHeader->pBuffer + inHeader->nOffset;
+ size_t size = inHeader->nFilledLen;
+
+ if ((inHeader->nFlags & OMX_BUFFERFLAG_EOS) && size == 0) {
+ handleEOS();
+ return;
+ }
+
+ if (mInputBufferCount == 0) {
+ CHECK(mHeader == NULL);
+ mHeader = new OpusHeader();
+ memset(mHeader, 0, sizeof(*mHeader));
+ if (!ParseOpusHeader(data, size, mHeader)) {
+ ALOGV("Parsing Opus Header failed.");
+ notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
+ return;
+ }
+
+ uint8_t channel_mapping[kMaxChannels] = {0};
+ if (mHeader->channels <= kMaxChannelsWithDefaultLayout) {
+ memcpy(&channel_mapping,
+ kDefaultOpusChannelLayout,
+ kMaxChannelsWithDefaultLayout);
+ } else {
+ memcpy(&channel_mapping,
+ mHeader->stream_map,
+ mHeader->channels);
+ }
+
+ int status = OPUS_INVALID_STATE;
+ mDecoder = opus_multistream_decoder_create(kRate,
+ mHeader->channels,
+ mHeader->num_streams,
+ mHeader->num_coupled,
+ channel_mapping,
+ &status);
+ if (!mDecoder || status != OPUS_OK) {
+ ALOGV("opus_multistream_decoder_create failed status=%s",
+ opus_strerror(status));
+ notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
+ return;
+ }
+ status =
+ opus_multistream_decoder_ctl(mDecoder,
+ OPUS_SET_GAIN(mHeader->gain_db));
+ if (status != OPUS_OK) {
+ ALOGV("Failed to set OPUS header gain; status=%s",
+ opus_strerror(status));
+ notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
+ return;
+ }
+ } else if (mInputBufferCount == 1) {
+ mCodecDelay = ns_to_samples(
+ *(reinterpret_cast<int64_t*>(inHeader->pBuffer +
+ inHeader->nOffset)),
+ kRate);
+ mSamplesToDiscard = mCodecDelay;
+ } else {
+ mSeekPreRoll = ns_to_samples(
+ *(reinterpret_cast<int64_t*>(inHeader->pBuffer +
+ inHeader->nOffset)),
+ kRate);
+ notify(OMX_EventPortSettingsChanged, 1, 0, NULL);
+ mOutputPortSettingsChange = AWAITING_DISABLED;
+ }
+
+ if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) {
+ handleEOS();
+ return;
+ }
+
inQueue.erase(inQueue.begin());
inInfo->mOwnedByUs = false;
notifyEmptyBufferDone(inHeader);
- return;
+ ++mInputBufferCount;
+
+ continue;
+ }
+
+ // Ignore CSD re-submissions.
+ if (mInputBufferCount >= 3 && (inHeader->nFlags & OMX_BUFFERFLAG_CODECCONFIG)) {
+ if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) {
+ handleEOS();
+ return;
+ }
+
+ inQueue.erase(inQueue.begin());
+ inInfo->mOwnedByUs = false;
+ notifyEmptyBufferDone(inHeader);
+ continue;
}
BufferInfo *outInfo = *outQueue.begin();
OMX_BUFFERHEADERTYPE *outHeader = outInfo->mHeader;
if ((inHeader->nFlags & OMX_BUFFERFLAG_EOS) && inHeader->nFilledLen == 0) {
- inQueue.erase(inQueue.begin());
- inInfo->mOwnedByUs = false;
- notifyEmptyBufferDone(inHeader);
-
- outHeader->nFilledLen = 0;
- outHeader->nFlags = OMX_BUFFERFLAG_EOS;
-
- outQueue.erase(outQueue.begin());
- outInfo->mOwnedByUs = false;
- notifyFillBufferDone(outHeader);
+ handleEOS();
return;
}
@@ -490,7 +568,6 @@
}
outHeader->nFilledLen = numFrames * sizeof(int16_t) * mHeader->channels;
- outHeader->nFlags = 0;
outHeader->nTimeStamp = mAnchorTimeUs +
(mNumFramesOutput * 1000000ll) /
@@ -499,22 +576,20 @@
mNumFramesOutput += numFrames;
if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) {
- inHeader->nFilledLen = 0;
+ outHeader->nFlags = OMX_BUFFERFLAG_EOS;
+ mHaveEOS = true;
} else {
- inInfo->mOwnedByUs = false;
- inQueue.erase(inQueue.begin());
- inInfo = NULL;
- notifyEmptyBufferDone(inHeader);
- inHeader = NULL;
+ outHeader->nFlags = 0;
}
+ inInfo->mOwnedByUs = false;
+ inQueue.erase(inQueue.begin());
+ notifyEmptyBufferDone(inHeader);
+ ++mInputBufferCount;
+
outInfo->mOwnedByUs = false;
outQueue.erase(outQueue.begin());
- outInfo = NULL;
notifyFillBufferDone(outHeader);
- outHeader = NULL;
-
- ++mInputBufferCount;
}
}
@@ -526,6 +601,7 @@
opus_multistream_decoder_ctl(mDecoder, OPUS_RESET_STATE);
mAnchorTimeUs = 0;
mSamplesToDiscard = mSeekPreRoll;
+ mHaveEOS = false;
}
}
@@ -542,6 +618,7 @@
}
mOutputPortSettingsChange = NONE;
+ mHaveEOS = false;
}
void SoftOpus::onPortEnableCompleted(OMX_U32 portIndex, bool enabled) {
diff --git a/media/libstagefright/codecs/opus/dec/SoftOpus.h b/media/libstagefright/codecs/opus/dec/SoftOpus.h
index 97f6561..91cafa1 100644
--- a/media/libstagefright/codecs/opus/dec/SoftOpus.h
+++ b/media/libstagefright/codecs/opus/dec/SoftOpus.h
@@ -23,7 +23,7 @@
#define SOFT_OPUS_H_
-#include "SimpleSoftOMXComponent.h"
+#include <media/stagefright/omx/SimpleSoftOMXComponent.h>
struct OpusMSDecoder;
@@ -75,6 +75,7 @@
int64_t mSamplesToDiscard;
int64_t mAnchorTimeUs;
int64_t mNumFramesOutput;
+ bool mHaveEOS;
enum {
NONE,
@@ -85,6 +86,7 @@
void initPorts();
status_t initDecoder();
bool isConfigured() const;
+ void handleEOS();
DISALLOW_EVIL_CONSTRUCTORS(SoftOpus);
};
diff --git a/media/libstagefright/codecs/raw/Android.bp b/media/libstagefright/codecs/raw/Android.bp
index c64027b..f21d46f 100644
--- a/media/libstagefright/codecs/raw/Android.bp
+++ b/media/libstagefright/codecs/raw/Android.bp
@@ -1,5 +1,9 @@
cc_library_shared {
name: "libstagefright_soft_rawdec",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: ["SoftRaw.cpp"],
@@ -27,4 +31,5 @@
"libutils",
"liblog",
],
+ compile_multilib: "32",
}
diff --git a/media/libstagefright/codecs/raw/SoftRaw.cpp b/media/libstagefright/codecs/raw/SoftRaw.cpp
index acb2b37..1a527b3 100644
--- a/media/libstagefright/codecs/raw/SoftRaw.cpp
+++ b/media/libstagefright/codecs/raw/SoftRaw.cpp
@@ -60,7 +60,7 @@
def.eDir = OMX_DirInput;
def.nBufferCountMin = kNumBuffers;
def.nBufferCountActual = def.nBufferCountMin;
- def.nBufferSize = 32 * 1024;
+ def.nBufferSize = 64 * 1024;
def.bEnabled = OMX_TRUE;
def.bPopulated = OMX_FALSE;
def.eDomain = OMX_PortDomainAudio;
@@ -78,7 +78,7 @@
def.eDir = OMX_DirOutput;
def.nBufferCountMin = kNumBuffers;
def.nBufferCountActual = def.nBufferCountMin;
- def.nBufferSize = 32 * 1024;
+ def.nBufferSize = 64 * 1024;
def.bEnabled = OMX_TRUE;
def.bPopulated = OMX_FALSE;
def.eDomain = OMX_PortDomainAudio;
@@ -100,6 +100,28 @@
OMX_ERRORTYPE SoftRaw::internalGetParameter(
OMX_INDEXTYPE index, OMX_PTR params) {
switch (index) {
+ case OMX_IndexParamAudioPortFormat:
+ {
+ OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
+ (OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
+
+ if (!isValidOMXParam(formatParams)) {
+ return OMX_ErrorBadParameter;
+ }
+
+ if (formatParams->nPortIndex > 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ if (formatParams->nIndex > 0) {
+ return OMX_ErrorNoMore;
+ }
+
+ formatParams->eEncoding = OMX_AUDIO_CodingPCM;
+
+ return OMX_ErrorNone;
+ }
+
case OMX_IndexParamAudioPcm:
{
OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =
@@ -153,6 +175,26 @@
return OMX_ErrorNone;
}
+ case OMX_IndexParamAudioPortFormat:
+ {
+ const OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
+ (const OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
+
+ if (!isValidOMXParam(formatParams)) {
+ return OMX_ErrorBadParameter;
+ }
+
+ if (formatParams->nPortIndex > 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ if (formatParams->eEncoding != OMX_AUDIO_CodingPCM) {
+ return OMX_ErrorUndefined;
+ }
+
+ return OMX_ErrorNone;
+ }
+
case OMX_IndexParamAudioPcm:
{
const OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =
diff --git a/media/libstagefright/codecs/raw/SoftRaw.h b/media/libstagefright/codecs/raw/SoftRaw.h
index 80906b4..ebc2741 100644
--- a/media/libstagefright/codecs/raw/SoftRaw.h
+++ b/media/libstagefright/codecs/raw/SoftRaw.h
@@ -18,7 +18,7 @@
#define SOFT_RAW_H_
-#include "SimpleSoftOMXComponent.h"
+#include <media/stagefright/omx/SimpleSoftOMXComponent.h>
struct tPVMP4AudioDecoderExternal;
diff --git a/media/libstagefright/codecs/vorbis/dec/Android.bp b/media/libstagefright/codecs/vorbis/dec/Android.bp
index 1a4de60..628b36c 100644
--- a/media/libstagefright/codecs/vorbis/dec/Android.bp
+++ b/media/libstagefright/codecs/vorbis/dec/Android.bp
@@ -1,5 +1,9 @@
cc_library_shared {
name: "libstagefright_soft_vorbisdec",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: ["SoftVorbis.cpp"],
@@ -10,7 +14,7 @@
shared_libs: [
"libvorbisidec",
- "libmedia",
+ "libmedia_omx",
"libstagefright_omx",
"libstagefright_foundation",
"libutils",
@@ -25,4 +29,5 @@
"unsigned-integer-overflow",
],
},
+ compile_multilib: "32",
}
diff --git a/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp b/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp
index 14dd250..8912f8a 100644
--- a/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp
+++ b/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp
@@ -129,6 +129,30 @@
OMX_ERRORTYPE SoftVorbis::internalGetParameter(
OMX_INDEXTYPE index, OMX_PTR params) {
switch (index) {
+ case OMX_IndexParamAudioPortFormat:
+ {
+ OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
+ (OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
+
+ if (!isValidOMXParam(formatParams)) {
+ return OMX_ErrorBadParameter;
+ }
+
+ if (formatParams->nPortIndex > 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ if (formatParams->nIndex > 0) {
+ return OMX_ErrorNoMore;
+ }
+
+ formatParams->eEncoding =
+ (formatParams->nPortIndex == 0)
+ ? OMX_AUDIO_CodingVORBIS : OMX_AUDIO_CodingPCM;
+
+ return OMX_ErrorNone;
+ }
+
case OMX_IndexParamAudioVorbis:
{
OMX_AUDIO_PARAM_VORBISTYPE *vorbisParams =
@@ -221,6 +245,29 @@
return OMX_ErrorNone;
}
+ case OMX_IndexParamAudioPortFormat:
+ {
+ const OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
+ (const OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
+
+ if (!isValidOMXParam(formatParams)) {
+ return OMX_ErrorBadParameter;
+ }
+
+ if (formatParams->nPortIndex > 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ if ((formatParams->nPortIndex == 0
+ && formatParams->eEncoding != OMX_AUDIO_CodingVORBIS)
+ || (formatParams->nPortIndex == 1
+ && formatParams->eEncoding != OMX_AUDIO_CodingPCM)) {
+ return OMX_ErrorUndefined;
+ }
+
+ return OMX_ErrorNone;
+ }
+
case OMX_IndexParamAudioVorbis:
{
const OMX_AUDIO_PARAM_VORBISTYPE *vorbisParams =
@@ -262,7 +309,33 @@
oggpack_readinit(bits, ref);
}
-void SoftVorbis::onQueueFilled(OMX_U32 portIndex) {
+void SoftVorbis::handleEOS() {
+ List<BufferInfo *> &inQueue = getPortQueue(0);
+ List<BufferInfo *> &outQueue = getPortQueue(1);
+
+ CHECK(!inQueue.empty() && !outQueue.empty());
+
+ mSawInputEos = true;
+
+ BufferInfo *outInfo = *outQueue.begin();
+ OMX_BUFFERHEADERTYPE *outHeader = outInfo->mHeader;
+ outHeader->nFilledLen = 0;
+ outHeader->nFlags = OMX_BUFFERFLAG_EOS;
+
+ outQueue.erase(outQueue.begin());
+ outInfo->mOwnedByUs = false;
+ notifyFillBufferDone(outHeader);
+ mSignalledOutputEos = true;
+
+ BufferInfo *inInfo = *inQueue.begin();
+ OMX_BUFFERHEADERTYPE *inHeader = inInfo->mHeader;
+ inQueue.erase(inQueue.begin());
+ inInfo->mOwnedByUs = false;
+ notifyEmptyBufferDone(inHeader);
+ ++mInputBufferCount;
+}
+
+void SoftVorbis::onQueueFilled(OMX_U32 /* portIndex */) {
List<BufferInfo *> &inQueue = getPortQueue(0);
List<BufferInfo *> &outQueue = getPortQueue(1);
@@ -270,69 +343,7 @@
return;
}
- if (portIndex == 0 && mInputBufferCount < 2) {
- BufferInfo *info = *inQueue.begin();
- OMX_BUFFERHEADERTYPE *header = info->mHeader;
-
- const uint8_t *data = header->pBuffer + header->nOffset;
- size_t size = header->nFilledLen;
- if (size < 7) {
- ALOGE("Too small input buffer: %zu bytes", size);
- android_errorWriteLog(0x534e4554, "27833616");
- notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
- mSignalledError = true;
- return;
- }
-
- ogg_buffer buf;
- ogg_reference ref;
- oggpack_buffer bits;
-
- makeBitReader(
- (const uint8_t *)data + 7, size - 7,
- &buf, &ref, &bits);
-
- if (mInputBufferCount == 0) {
- CHECK(mVi == NULL);
- mVi = new vorbis_info;
- vorbis_info_init(mVi);
-
- int ret = _vorbis_unpack_info(mVi, &bits);
- if (ret != 0) {
- notify(OMX_EventError, OMX_ErrorUndefined, ret, NULL);
- mSignalledError = true;
- return;
- }
- } else {
- int ret = _vorbis_unpack_books(mVi, &bits);
- if (ret != 0) {
- notify(OMX_EventError, OMX_ErrorUndefined, ret, NULL);
- mSignalledError = true;
- return;
- }
-
- CHECK(mState == NULL);
- mState = new vorbis_dsp_state;
- CHECK_EQ(0, vorbis_dsp_init(mState, mVi));
-
- if (mVi->rate != kDefaultSamplingRate ||
- mVi->channels != kDefaultChannelCount) {
- ALOGV("vorbis: rate/channels changed: %ld/%d", mVi->rate, mVi->channels);
- notify(OMX_EventPortSettingsChanged, 1, 0, NULL);
- mOutputPortSettingsChange = AWAITING_DISABLED;
- }
- }
-
- inQueue.erase(inQueue.begin());
- info->mOwnedByUs = false;
- notifyEmptyBufferDone(header);
-
- ++mInputBufferCount;
-
- return;
- }
-
- while ((!inQueue.empty() || (mSawInputEos && !mSignalledOutputEos)) && !outQueue.empty()) {
+ while (!mSignalledOutputEos && (!inQueue.empty() || mSawInputEos) && !outQueue.empty()) {
BufferInfo *inInfo = NULL;
OMX_BUFFERHEADERTYPE *inHeader = NULL;
if (!inQueue.empty()) {
@@ -346,6 +357,73 @@
int32_t numPageSamples = 0;
if (inHeader) {
+ if (mInputBufferCount < 2) {
+ const uint8_t *data = inHeader->pBuffer + inHeader->nOffset;
+ size_t size = inHeader->nFilledLen;
+
+ if ((inHeader->nFlags & OMX_BUFFERFLAG_EOS) && size == 0) {
+ handleEOS();
+ return;
+ }
+
+ if (size < 7) {
+ ALOGE("Too small input buffer: %zu bytes", size);
+ android_errorWriteLog(0x534e4554, "27833616");
+ notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
+ mSignalledError = true;
+ return;
+ }
+
+ ogg_buffer buf;
+ ogg_reference ref;
+ oggpack_buffer bits;
+
+ makeBitReader((const uint8_t *)data + 7, size - 7, &buf, &ref, &bits);
+
+ if (mInputBufferCount == 0) {
+ CHECK(mVi == NULL);
+ mVi = new vorbis_info;
+ vorbis_info_init(mVi);
+
+ int ret = _vorbis_unpack_info(mVi, &bits);
+ if (ret != 0) {
+ notify(OMX_EventError, OMX_ErrorUndefined, ret, NULL);
+ mSignalledError = true;
+ return;
+ }
+ } else {
+ int ret = _vorbis_unpack_books(mVi, &bits);
+ if (ret != 0) {
+ notify(OMX_EventError, OMX_ErrorUndefined, ret, NULL);
+ mSignalledError = true;
+ return;
+ }
+
+ CHECK(mState == NULL);
+ mState = new vorbis_dsp_state;
+ CHECK_EQ(0, vorbis_dsp_init(mState, mVi));
+
+ if (mVi->rate != kDefaultSamplingRate ||
+ mVi->channels != kDefaultChannelCount) {
+ ALOGV("vorbis: rate/channels changed: %ld/%d", mVi->rate, mVi->channels);
+ notify(OMX_EventPortSettingsChanged, 1, 0, NULL);
+ mOutputPortSettingsChange = AWAITING_DISABLED;
+ }
+ }
+
+ if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) {
+ handleEOS();
+ return;
+ }
+
+ inQueue.erase(inQueue.begin());
+ inInfo->mOwnedByUs = false;
+ notifyEmptyBufferDone(inHeader);
+ ++mInputBufferCount;
+
+ continue;
+ }
+
if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) {
mSawInputEos = true;
}
@@ -359,8 +437,7 @@
return;
}
memcpy(&numPageSamples,
- inHeader->pBuffer
- + inHeader->nOffset + inHeader->nFilledLen - 4,
+ inHeader->pBuffer + inHeader->nOffset + inHeader->nFilledLen - 4,
sizeof(numPageSamples));
if (inHeader->nOffset == 0) {
@@ -399,6 +476,14 @@
int numFrames = 0;
outHeader->nFlags = 0;
+
+ if (mState == nullptr || mVi == nullptr) {
+ notify(OMX_EventError, OMX_ErrorStreamCorrupt, 0, NULL);
+ mSignalledError = true;
+ ALOGE("onQueueFilled, input does not have CSD");
+ return;
+ }
+
int err = vorbis_dsp_synthesis(mState, &pack, 1);
if (err != 0) {
// FIXME temporary workaround for log spam
@@ -448,18 +533,13 @@
if (inHeader) {
inInfo->mOwnedByUs = false;
inQueue.erase(inQueue.begin());
- inInfo = NULL;
notifyEmptyBufferDone(inHeader);
- inHeader = NULL;
+ ++mInputBufferCount;
}
outInfo->mOwnedByUs = false;
outQueue.erase(outQueue.begin());
- outInfo = NULL;
notifyFillBufferDone(outHeader);
- outHeader = NULL;
-
- ++mInputBufferCount;
}
}
diff --git a/media/libstagefright/codecs/vorbis/dec/SoftVorbis.h b/media/libstagefright/codecs/vorbis/dec/SoftVorbis.h
index 30d137b..5ff8ea4 100644
--- a/media/libstagefright/codecs/vorbis/dec/SoftVorbis.h
+++ b/media/libstagefright/codecs/vorbis/dec/SoftVorbis.h
@@ -18,7 +18,7 @@
#define SOFT_VORBIS_H_
-#include "SimpleSoftOMXComponent.h"
+#include <media/stagefright/omx/SimpleSoftOMXComponent.h>
struct vorbis_dsp_state;
struct vorbis_info;
@@ -72,6 +72,7 @@
void initPorts();
status_t initDecoder();
bool isConfigured() const;
+ void handleEOS();
DISALLOW_EVIL_CONSTRUCTORS(SoftVorbis);
};
diff --git a/media/libstagefright/colorconversion/ColorConverter.cpp b/media/libstagefright/colorconversion/ColorConverter.cpp
index 3ca7cc0..0982006 100644
--- a/media/libstagefright/colorconversion/ColorConverter.cpp
+++ b/media/libstagefright/colorconversion/ColorConverter.cpp
@@ -23,6 +23,7 @@
#include <media/stagefright/MediaErrors.h>
#include "libyuv/convert_from.h"
+#include "libyuv/video_common.h"
#define USE_LIBYUV
@@ -41,17 +42,17 @@
}
bool ColorConverter::isValid() const {
- if (mDstFormat != OMX_COLOR_Format16bitRGB565) {
- return false;
- }
-
switch (mSrcFormat) {
case OMX_COLOR_FormatYUV420Planar:
+ return mDstFormat == OMX_COLOR_Format16bitRGB565
+ || mDstFormat == OMX_COLOR_Format32BitRGBA8888
+ || mDstFormat == OMX_COLOR_Format32bitBGRA8888;
+
case OMX_COLOR_FormatCbYCrY:
case OMX_QCOM_COLOR_FormatYVU420SemiPlanar:
case OMX_COLOR_FormatYUV420SemiPlanar:
case OMX_TI_COLOR_FormatYUV420PackedSemiPlanar:
- return true;
+ return mDstFormat == OMX_COLOR_Format16bitRGB565;
default:
return false;
@@ -62,14 +63,43 @@
void *bits,
size_t width, size_t height,
size_t cropLeft, size_t cropTop,
- size_t cropRight, size_t cropBottom)
+ size_t cropRight, size_t cropBottom,
+ OMX_COLOR_FORMATTYPE colorFromat)
: mBits(bits),
+ mColorFormat(colorFromat),
mWidth(width),
mHeight(height),
mCropLeft(cropLeft),
mCropTop(cropTop),
mCropRight(cropRight),
mCropBottom(cropBottom) {
+ switch(mColorFormat) {
+ case OMX_COLOR_Format16bitRGB565:
+ mBpp = 2;
+ mStride = 2 * mWidth;
+ break;
+
+ case OMX_COLOR_Format32bitBGRA8888:
+ case OMX_COLOR_Format32BitRGBA8888:
+ mBpp = 4;
+ mStride = 4 * mWidth;
+ break;
+
+ case OMX_COLOR_FormatYUV420Planar:
+ case OMX_COLOR_FormatCbYCrY:
+ case OMX_QCOM_COLOR_FormatYVU420SemiPlanar:
+ case OMX_COLOR_FormatYUV420SemiPlanar:
+ case OMX_TI_COLOR_FormatYUV420PackedSemiPlanar:
+ mBpp = 1;
+ mStride = mWidth;
+ break;
+
+ default:
+ ALOGE("Unsupported color format %d", mColorFormat);
+ mBpp = 1;
+ mStride = mWidth;
+ break;
+ }
}
size_t ColorConverter::BitmapParams::cropWidth() const {
@@ -89,19 +119,15 @@
size_t dstWidth, size_t dstHeight,
size_t dstCropLeft, size_t dstCropTop,
size_t dstCropRight, size_t dstCropBottom) {
- if (mDstFormat != OMX_COLOR_Format16bitRGB565) {
- return ERROR_UNSUPPORTED;
- }
-
BitmapParams src(
const_cast<void *>(srcBits),
srcWidth, srcHeight,
- srcCropLeft, srcCropTop, srcCropRight, srcCropBottom);
+ srcCropLeft, srcCropTop, srcCropRight, srcCropBottom, mSrcFormat);
BitmapParams dst(
dstBits,
dstWidth, dstHeight,
- dstCropLeft, dstCropTop, dstCropRight, dstCropBottom);
+ dstCropLeft, dstCropTop, dstCropRight, dstCropBottom, mDstFormat);
status_t err;
@@ -212,26 +238,104 @@
return ERROR_UNSUPPORTED;
}
- uint16_t *dst_ptr = (uint16_t *)dst.mBits
- + dst.mCropTop * dst.mWidth + dst.mCropLeft;
+ uint8_t *dst_ptr = (uint8_t *)dst.mBits
+ + dst.mCropTop * dst.mStride + dst.mCropLeft * dst.mBpp;
const uint8_t *src_y =
- (const uint8_t *)src.mBits + src.mCropTop * src.mWidth + src.mCropLeft;
+ (const uint8_t *)src.mBits + src.mCropTop * src.mStride + src.mCropLeft;
const uint8_t *src_u =
- (const uint8_t *)src_y + src.mWidth * src.mHeight
- + src.mCropTop * (src.mWidth / 2) + src.mCropLeft / 2;
+ (const uint8_t *)src.mBits + src.mStride * src.mHeight
+ + (src.mCropTop / 2) * (src.mStride / 2) + (src.mCropLeft / 2);
const uint8_t *src_v =
- src_u + (src.mWidth / 2) * (src.mHeight / 2);
+ src_u + (src.mStride / 2) * (src.mHeight / 2);
+ switch (mDstFormat) {
+ case OMX_COLOR_Format16bitRGB565:
+ libyuv::I420ToRGB565(src_y, src.mStride, src_u, src.mStride / 2, src_v, src.mStride / 2,
+ (uint8 *)dst_ptr, dst.mStride, src.cropWidth(), src.cropHeight());
+ break;
- libyuv::I420ToRGB565(src_y, src.mWidth, src_u, src.mWidth / 2, src_v, src.mWidth / 2,
- (uint8 *)dst_ptr, dst.mWidth * 2, dst.mWidth, dst.mHeight);
+ case OMX_COLOR_Format32BitRGBA8888:
+ libyuv::ConvertFromI420(src_y, src.mStride, src_u, src.mStride / 2, src_v, src.mStride / 2,
+ (uint8 *)dst_ptr, dst.mStride, src.cropWidth(), src.cropHeight(), libyuv::FOURCC_ABGR);
+ break;
+
+ case OMX_COLOR_Format32bitBGRA8888:
+ libyuv::ConvertFromI420(src_y, src.mStride, src_u, src.mStride / 2, src_v, src.mStride / 2,
+ (uint8 *)dst_ptr, dst.mStride, src.cropWidth(), src.cropHeight(), libyuv::FOURCC_ARGB);
+ break;
+
+ default:
+ return ERROR_UNSUPPORTED;
+ }
return OK;
}
+void ColorConverter::writeToDst(
+ void *dst_ptr, uint8_t *kAdjustedClip, bool uncropped,
+ signed r1, signed g1, signed b1,
+ signed r2, signed g2, signed b2) {
+ switch (mDstFormat) {
+ case OMX_COLOR_Format16bitRGB565:
+ {
+ uint32_t rgb1 =
+ ((kAdjustedClip[r1] >> 3) << 11)
+ | ((kAdjustedClip[g1] >> 2) << 5)
+ | (kAdjustedClip[b1] >> 3);
+
+ if (uncropped) {
+ uint32_t rgb2 =
+ ((kAdjustedClip[r2] >> 3) << 11)
+ | ((kAdjustedClip[g2] >> 2) << 5)
+ | (kAdjustedClip[b2] >> 3);
+
+ *(uint32_t *)dst_ptr = (rgb2 << 16) | rgb1;
+ } else {
+ *(uint16_t *)dst_ptr = rgb1;
+ }
+ break;
+ }
+ case OMX_COLOR_Format32BitRGBA8888:
+ {
+ ((uint32_t *)dst_ptr)[0] =
+ (kAdjustedClip[r1])
+ | (kAdjustedClip[g1] << 8)
+ | (kAdjustedClip[b1] << 16)
+ | (0xFF << 24);
+
+ if (uncropped) {
+ ((uint32_t *)dst_ptr)[1] =
+ (kAdjustedClip[r2])
+ | (kAdjustedClip[g2] << 8)
+ | (kAdjustedClip[b2] << 16)
+ | (0xFF << 24);
+ }
+ break;
+ }
+ case OMX_COLOR_Format32bitBGRA8888:
+ {
+ ((uint32_t *)dst_ptr)[0] =
+ (kAdjustedClip[b1])
+ | (kAdjustedClip[g1] << 8)
+ | (kAdjustedClip[r1] << 16)
+ | (0xFF << 24);
+
+ if (uncropped) {
+ ((uint32_t *)dst_ptr)[1] =
+ (kAdjustedClip[b2])
+ | (kAdjustedClip[g2] << 8)
+ | (kAdjustedClip[r2] << 16)
+ | (0xFF << 24);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+}
status_t ColorConverter::convertYUV420Planar(
const BitmapParams &src, const BitmapParams &dst) {
if (!((src.mCropLeft & 1) == 0
@@ -242,18 +346,18 @@
uint8_t *kAdjustedClip = initClip();
- uint16_t *dst_ptr = (uint16_t *)dst.mBits
- + dst.mCropTop * dst.mWidth + dst.mCropLeft;
+ uint8_t *dst_ptr = (uint8_t *)dst.mBits
+ + dst.mCropTop * dst.mStride + dst.mCropLeft * dst.mBpp;
const uint8_t *src_y =
- (const uint8_t *)src.mBits + src.mCropTop * src.mWidth + src.mCropLeft;
+ (const uint8_t *)src.mBits + src.mCropTop * src.mStride + src.mCropLeft;
const uint8_t *src_u =
- (const uint8_t *)src_y + src.mWidth * src.mHeight
- + src.mCropTop * (src.mWidth / 2) + src.mCropLeft / 2;
+ (const uint8_t *)src.mBits + src.mStride * src.mHeight
+ + (src.mCropTop / 2) * (src.mStride / 2) + src.mCropLeft / 2;
const uint8_t *src_v =
- src_u + (src.mWidth / 2) * (src.mHeight / 2);
+ src_u + (src.mStride / 2) * (src.mHeight / 2);
for (size_t y = 0; y < src.cropHeight(); ++y) {
for (size_t x = 0; x < src.cropWidth(); x += 2) {
@@ -296,31 +400,19 @@
signed g2 = (tmp2 + v_g + u_g) / 256;
signed r2 = (tmp2 + v_r) / 256;
- uint32_t rgb1 =
- ((kAdjustedClip[r1] >> 3) << 11)
- | ((kAdjustedClip[g1] >> 2) << 5)
- | (kAdjustedClip[b1] >> 3);
-
- uint32_t rgb2 =
- ((kAdjustedClip[r2] >> 3) << 11)
- | ((kAdjustedClip[g2] >> 2) << 5)
- | (kAdjustedClip[b2] >> 3);
-
- if (x + 1 < src.cropWidth()) {
- *(uint32_t *)(&dst_ptr[x]) = (rgb2 << 16) | rgb1;
- } else {
- dst_ptr[x] = rgb1;
- }
+ bool uncropped = x + 1 < src.cropWidth();
+ (void)writeToDst(dst_ptr + x * dst.mBpp,
+ kAdjustedClip, uncropped, r1, g1, b1, r2, g2, b2);
}
- src_y += src.mWidth;
+ src_y += src.mStride;
if (y & 1) {
- src_u += src.mWidth / 2;
- src_v += src.mWidth / 2;
+ src_u += src.mStride / 2;
+ src_v += src.mStride / 2;
}
- dst_ptr += dst.mWidth;
+ dst_ptr += dst.mStride;
}
return OK;
diff --git a/media/libstagefright/data/media_codecs_google_video.xml b/media/libstagefright/data/media_codecs_google_video.xml
index ce164a2..829f403 100644
--- a/media/libstagefright/data/media_codecs_google_video.xml
+++ b/media/libstagefright/data/media_codecs_google_video.xml
@@ -34,20 +34,21 @@
<Feature name="adaptive-playback" />
</MediaCodec>
<MediaCodec name="OMX.google.h264.decoder" type="video/avc">
- <!-- profiles and levels: ProfileHigh : Level41 -->
- <Limit name="size" min="16x16" max="1920x1088" />
+ <!-- profiles and levels: ProfileHigh : Level52 -->
+ <Limit name="size" min="2x2" max="4080x4080" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
- <Limit name="blocks-per-second" range="1-244800" />
- <Limit name="bitrate" range="1-12000000" />
+ <Limit name="block-count" range="1-32768" /> <!-- max 4096x2048 equivalent -->
+ <Limit name="blocks-per-second" range="1-1966080" />
+ <Limit name="bitrate" range="1-48000000" />
<Feature name="adaptive-playback" />
</MediaCodec>
<MediaCodec name="OMX.google.hevc.decoder" type="video/hevc">
<!-- profiles and levels: ProfileMain : MainTierLevel51 -->
- <Limit name="size" min="2x2" max="2048x2048" />
+ <Limit name="size" min="2x2" max="4096x4096" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="8x8" />
- <Limit name="block-count" range="1-139264" />
+ <Limit name="block-count" range="1-196608" /> <!-- max 4096x3072 -->
<Limit name="blocks-per-second" range="1-2000000" />
<Limit name="bitrate" range="1-10000000" />
<Feature name="adaptive-playback" />
@@ -56,6 +57,7 @@
<Limit name="size" min="2x2" max="2048x2048" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
+ <Limit name="block-count" range="1-16384" />
<Limit name="blocks-per-second" range="1-1000000" />
<Limit name="bitrate" range="1-40000000" />
<Feature name="adaptive-playback" />
@@ -64,6 +66,7 @@
<Limit name="size" min="2x2" max="2048x2048" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
+ <Limit name="block-count" range="1-16384" />
<Limit name="blocks-per-second" range="1-500000" />
<Limit name="bitrate" range="1-40000000" />
<Feature name="adaptive-playback" />
@@ -79,10 +82,11 @@
</MediaCodec>
<MediaCodec name="OMX.google.h264.encoder" type="video/avc">
<!-- profiles and levels: ProfileBaseline : Level41 -->
- <Limit name="size" min="16x16" max="1920x1088" />
+ <Limit name="size" min="16x16" max="2048x2048" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
- <Limit name="blocks-per-second" range="1-244800" />
+ <Limit name="block-count" range="1-8192" /> <!-- max 2048x1024 -->
+ <Limit name="blocks-per-second" range="1-245760" />
<Limit name="bitrate" range="1-12000000" />
<Feature name="intra-refresh" />
</MediaCodec>
@@ -98,6 +102,9 @@
<!-- profiles and levels: ProfileMain : Level_Version0-3 -->
<Limit name="size" min="2x2" max="2048x2048" />
<Limit name="alignment" value="2x2" />
+ <Limit name="block-size" value="16x16" />
+ <!-- 2016 devices can encode at about 10fps at this block count -->
+ <Limit name="block-count" range="1-16384" />
<Limit name="bitrate" range="1-40000000" />
<Feature name="bitrate-modes" value="VBR,CBR" />
</MediaCodec>
@@ -105,6 +112,9 @@
<!-- profiles and levels: ProfileMain : Level_Version0-3 -->
<Limit name="size" min="2x2" max="2048x2048" />
<Limit name="alignment" value="2x2" />
+ <Limit name="block-size" value="16x16" />
+ <!-- 2016 devices can encode at about 8fps at this block count -->
+ <Limit name="block-count" range="1-3600" /> <!-- max 1280x720 -->
<Limit name="bitrate" range="1-40000000" />
<Feature name="bitrate-modes" value="VBR,CBR" />
</MediaCodec>
diff --git a/media/libstagefright/data/media_codecs_google_video_le.xml b/media/libstagefright/data/media_codecs_google_video_le.xml
index 034a038..d7c6570 100644
--- a/media/libstagefright/data/media_codecs_google_video_le.xml
+++ b/media/libstagefright/data/media_codecs_google_video_le.xml
@@ -34,22 +34,22 @@
<Feature name="adaptive-playback" />
</MediaCodec>
<MediaCodec name="OMX.google.h264.decoder" type="video/avc">
- <!-- profiles and levels: ProfileBaseline : Level51 -->
+ <!-- profiles and levels: ProfileHigh : Level51 -->
<Limit name="size" min="2x2" max="2048x2048" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
- <Limit name="block-count" range="1-8160" />
- <Limit name="blocks-per-second" range="1-489600" />
+ <Limit name="block-count" range="1-16384" />
+ <Limit name="blocks-per-second" range="1-491520" />
<Limit name="bitrate" range="1-40000000" />
<Feature name="adaptive-playback" />
</MediaCodec>
<MediaCodec name="OMX.google.hevc.decoder" type="video/hevc">
<!-- profiles and levels: ProfileMain : MainTierLevel51 -->
- <Limit name="size" min="2x2" max="1280x1280" />
+ <Limit name="size" min="2x2" max="2048x2048" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="8x8" />
- <Limit name="block-count" range="1-139264" />
- <Limit name="blocks-per-second" range="1-432000" />
+ <Limit name="block-count" range="1-65536" />
+ <Limit name="blocks-per-second" range="1-491520" />
<Limit name="bitrate" range="1-5000000" />
<Feature name="adaptive-playback" />
</MediaCodec>
@@ -57,7 +57,7 @@
<Limit name="size" min="2x2" max="2048x2048" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
- <Limit name="block-count" range="1-8160" />
+ <Limit name="block-count" range="1-8192" /> <!-- max 2048x1024 -->
<Limit name="blocks-per-second" range="1-500000" />
<Limit name="bitrate" range="1-40000000" />
<Feature name="adaptive-playback" />
@@ -66,7 +66,7 @@
<Limit name="size" min="2x2" max="1280x1280" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
- <Limit name="block-count" range="1-3600" />
+ <Limit name="block-count" range="1-3600" /> <!-- max 1280x720 -->
<Limit name="blocks-per-second" range="1-108000" />
<Limit name="bitrate" range="1-5000000" />
<Feature name="adaptive-playback" />
@@ -81,12 +81,14 @@
<Limit name="bitrate" range="1-128000" />
</MediaCodec>
<MediaCodec name="OMX.google.h264.encoder" type="video/avc">
- <!-- profiles and levels: ProfileBaseline : Level2 -->
- <Limit name="size" min="16x16" max="896x896" />
- <Limit name="alignment" value="16x16" />
+ <!-- profiles and levels: ProfileBaseline : Level3 -->
+ <Limit name="size" min="16x16" max="1808x1808" />
+ <Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
- <Limit name="blocks-per-second" range="1-11880" />
+ <Limit name="block-count" range="1-1620" />
+ <Limit name="blocks-per-second" range="1-40500" />
<Limit name="bitrate" range="1-2000000" />
+ <Feature name="intra-refresh" />
</MediaCodec>
<MediaCodec name="OMX.google.mpeg4.encoder" type="video/mp4v-es">
<!-- profiles and levels: ProfileCore : Level2 -->
@@ -100,7 +102,8 @@
<!-- profiles and levels: ProfileMain : Level_Version0-3 -->
<Limit name="size" min="2x2" max="1280x1280" />
<Limit name="alignment" value="2x2" />
- <Limit name="block-count" range="1-3600" />
+ <Limit name="block-size" value="16x16" />
+ <Limit name="block-count" range="1-3600" /> <!-- max 1280x720 -->
<Limit name="bitrate" range="1-20000000" />
<Feature name="bitrate-modes" value="VBR,CBR" />
</MediaCodec>
diff --git a/media/libstagefright/flac/dec/Android.bp b/media/libstagefright/flac/dec/Android.bp
index 284c25f..1b9fe0f 100644
--- a/media/libstagefright/flac/dec/Android.bp
+++ b/media/libstagefright/flac/dec/Android.bp
@@ -1,5 +1,9 @@
cc_library_shared {
name: "libstagefright_flacdec",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: [
"FLACDecoder.cpp",
@@ -31,4 +35,5 @@
"libstagefright_foundation",
"libutils",
],
+ header_libs: ["libmedia_headers"],
}
diff --git a/media/libstagefright/foundation/Android.bp b/media/libstagefright/foundation/Android.bp
index 657f02c..221af1d 100644
--- a/media/libstagefright/foundation/Android.bp
+++ b/media/libstagefright/foundation/Android.bp
@@ -1,3 +1,9 @@
+cc_library_headers {
+ name: "libstagefright_foundation_headers",
+ export_include_dirs: ["include"],
+ vendor_available: true,
+}
+
cc_library_shared {
name: "libstagefright_foundation",
vendor_available: true,
@@ -13,12 +19,13 @@
"include/media/stagefright/foundation",
],
- export_include_dirs: [
- "include",
- ],
-
header_libs: [
"libhardware_headers",
+ "libstagefright_foundation_headers",
+ ],
+
+ export_header_lib_headers: [
+ "libstagefright_foundation_headers",
],
export_shared_lib_headers: [
diff --git a/media/libstagefright/foundation/base64.cpp b/media/libstagefright/foundation/base64.cpp
index cc89064..8f32582 100644
--- a/media/libstagefright/foundation/base64.cpp
+++ b/media/libstagefright/foundation/base64.cpp
@@ -23,6 +23,7 @@
sp<ABuffer> decodeBase64(const AString &s) {
size_t n = s.size();
+
if ((n % 4) != 0) {
return NULL;
}
@@ -45,7 +46,6 @@
size_t outLen = (n / 4) * 3 - padding;
sp<ABuffer> buffer = new ABuffer(outLen);
-
uint8_t *out = buffer->data();
if (out == NULL || buffer->size() < outLen) {
return NULL;
@@ -61,9 +61,9 @@
value = 26 + c - 'a';
} else if (c >= '0' && c <= '9') {
value = 52 + c - '0';
- } else if (c == '+') {
+ } else if (c == '+' || c == '-') {
value = 62;
- } else if (c == '/') {
+ } else if (c == '/' || c == '_') {
value = 63;
} else if (c != '=') {
return NULL;
@@ -144,4 +144,26 @@
}
}
+void encodeBase64Url(
+ const void *_data, size_t size, AString *out) {
+ encodeBase64(_data, size, out);
+
+ if ((-1 != out->find("+")) || (-1 != out->find("/"))) {
+ size_t outLen = out->size();
+ char *base64url = new char[outLen];
+ for (size_t i = 0; i < outLen; ++i) {
+ if (out->c_str()[i] == '+')
+ base64url[i] = '-';
+ else if (out->c_str()[i] == '/')
+ base64url[i] = '_';
+ else
+ base64url[i] = out->c_str()[i];
+ }
+
+ out->setTo(base64url, outLen);
+ delete[] base64url;
+ }
+}
+
+
} // namespace android
diff --git a/media/libstagefright/foundation/include/media/stagefright/foundation/ADebug.h b/media/libstagefright/foundation/include/media/stagefright/foundation/ADebug.h
index b498c91..bac8fa9 100644
--- a/media/libstagefright/foundation/include/media/stagefright/foundation/ADebug.h
+++ b/media/libstagefright/foundation/include/media/stagefright/foundation/ADebug.h
@@ -82,6 +82,10 @@
MAKE_COMPARATOR(LT,<)
MAKE_COMPARATOR(GT,>)
+#ifdef CHECK_OP
+#undef CHECK_OP
+#endif
+
#define CHECK_OP(x,y,suffix,op) \
do { \
AString ___res = Compare_##suffix(x, y); \
diff --git a/media/libstagefright/foundation/include/media/stagefright/foundation/base64.h b/media/libstagefright/foundation/include/media/stagefright/foundation/base64.h
index e340b89..abc95e0 100644
--- a/media/libstagefright/foundation/include/media/stagefright/foundation/base64.h
+++ b/media/libstagefright/foundation/include/media/stagefright/foundation/base64.h
@@ -28,6 +28,8 @@
sp<ABuffer> decodeBase64(const AString &s);
void encodeBase64(const void *data, size_t size, AString *out);
+void encodeBase64Url(const void *data, size_t size, AString *out);
+
} // namespace android
#endif // BASE_64_H_
diff --git a/media/libstagefright/foundation/tests/Android.mk b/media/libstagefright/foundation/tests/Android.mk
index d741c6f..a9e3c76 100644
--- a/media/libstagefright/foundation/tests/Android.mk
+++ b/media/libstagefright/foundation/tests/Android.mk
@@ -9,11 +9,13 @@
LOCAL_SRC_FILES := \
AData_test.cpp \
+ Base64_test.cpp \
Flagged_test.cpp \
TypeTraits_test.cpp \
Utils_test.cpp \
LOCAL_SHARED_LIBRARIES := \
+ liblog \
libstagefright_foundation \
libutils \
diff --git a/media/libstagefright/foundation/tests/Base64_test.cpp b/media/libstagefright/foundation/tests/Base64_test.cpp
new file mode 100644
index 0000000..7a4289e
--- /dev/null
+++ b/media/libstagefright/foundation/tests/Base64_test.cpp
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <utils/Log.h>
+
+#include "gtest/gtest.h"
+
+#include <media/stagefright/foundation/ABuffer.h>
+#include <media/stagefright/foundation/AString.h>
+#include <media/stagefright/foundation/AStringUtils.h>
+#include <media/stagefright/foundation/base64.h>
+
+#include <utils/RefBase.h>
+#include <utils/String8.h>
+
+namespace {
+const android::String8 kBase64Padding("=");
+};
+
+namespace android {
+
+class Base64Test : public ::testing::Test {
+};
+
+void verifyDecode(const AString* expected, const AString* in) {
+ size_t numTests = 0;
+ while (!expected[numTests].empty())
+ ++numTests;
+
+ for (size_t i = 0; i < numTests; ++i) {
+ // Since android::decodeBase64() requires padding characters,
+ // add them so length of encoded text is exactly a multiple of 4.
+ int remainder = in[i].size() % 4;
+ String8 paddedText(in[i].c_str());
+ if (remainder > 0) {
+ for (int i = 0; i < 4 - remainder; ++i) {
+ paddedText.append(kBase64Padding);
+ }
+ }
+ sp<ABuffer> result = decodeBase64(AString(paddedText.string()));
+
+ ASSERT_EQ(AStringUtils::Compare(expected[i].c_str(),
+ reinterpret_cast<char*>(result->data()),
+ expected[i].size(), false), 0);
+ }
+}
+
+void verifyEncode(const AString* expected, const AString* in) {
+ size_t numTests = 0;
+ while (!expected[numTests].empty())
+ ++numTests;
+
+ AString out = AString("");
+ for (size_t i = 0; i < numTests; ++i) {
+ encodeBase64Url(in[i].c_str(), in[i].size(), &out);
+
+ ASSERT_EQ(AStringUtils::Compare(expected[i].c_str(), out.c_str(),
+ expected[i].size(), false), 0);
+ }
+}
+
+TEST_F(Base64Test, TestDecodeBase64) {
+ const AString base64[] = {
+ AString("SGVsbG8gRnJpZW5kIQ"),
+ AString("R29vZCBkYXkh"),
+ AString("") // string to signal end of array
+ };
+
+ const AString clearText[] = {
+ AString("Hello Friend!"),
+ AString("Good day!"),
+ AString("")
+ };
+
+ verifyDecode(clearText, base64);
+}
+
+TEST_F(Base64Test, TestDecodeBase64Url) {
+ const AString base64Url[] = {
+ AString("SGVsbG8gRnJpZW5kICE-Pw"),
+ AString("SGVsbG8gRnJpZW5kICE_"),
+ AString("SGVsbG8gPz4-IEZyaWVuZCA_Pg"),
+ AString("")
+ };
+
+ const AString clearText[] = {
+ AString("Hello Friend !>?"),
+ AString("Hello Friend !?"),
+ AString("Hello ?>> Friend ?>"),
+ AString("")
+ };
+
+ verifyDecode(clearText, base64Url);
+}
+
+TEST_F(Base64Test, TestDecodeMalformedBase64) {
+ const AString base64Url[] = {
+ AString("1?GawgguFyGrWKav7AX4VKUg"), // fail on parsing
+ AString("GawgguFyGrWKav7AX4V???"), // fail on length not multiple of 4
+ AString("GawgguFyGrWKav7AX4VKUg"), // ditto
+ };
+
+ for (size_t i = 0; i < 3; ++i) {
+ sp<ABuffer> result = decodeBase64(AString(base64Url[i]));
+ EXPECT_TRUE(result == nullptr);
+ }
+}
+
+TEST_F(Base64Test, TestEncodeBase64) {
+ const AString clearText[] = {
+ AString("Hello Friend!"),
+ AString("Good day!"),
+ AString("")
+ };
+
+ const AString base64[] = {
+ AString("SGVsbG8gRnJpZW5kIQ=="),
+ AString("R29vZCBkYXkh"),
+ AString("")
+ };
+
+ verifyEncode(base64, clearText);
+}
+
+TEST_F(Base64Test, TestEncodeBase64Url) {
+ const AString clearText[] = {
+ AString("Hello Friend !>?"),
+ AString("Hello Friend !?"),
+ AString("Hello ?>> Friend ?>"),
+ AString("")
+ };
+
+ const AString base64Url[] = {
+ AString("SGVsbG8gRnJpZW5kICE-Pw=="),
+ AString("SGVsbG8gRnJpZW5kICE_"),
+ AString("SGVsbG8gPz4-IEZyaWVuZCA_Pg"),
+ AString("")
+ };
+
+ verifyEncode(base64Url, clearText);
+}
+
+} // namespace android
diff --git a/media/libstagefright/include/ACodecBufferChannel.h b/media/libstagefright/include/ACodecBufferChannel.h
index 0da2e81..f253a52 100644
--- a/media/libstagefright/include/ACodecBufferChannel.h
+++ b/media/libstagefright/include/ACodecBufferChannel.h
@@ -30,6 +30,8 @@
namespace android {
+using hardware::hidl_memory;
+
/**
* BufferChannelBase implementation for ACodec.
*/
@@ -117,6 +119,7 @@
sp<MemoryDealer> mDealer;
sp<IMemory> mDecryptDestination;
int32_t mHeapSeqNum;
+ hidl_memory mHidlMemory;
// These should only be accessed via std::atomic_* functions.
//
diff --git a/media/libstagefright/include/AVIExtractor.h b/media/libstagefright/include/AVIExtractor.h
deleted file mode 100644
index 3be505c..0000000
--- a/media/libstagefright/include/AVIExtractor.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef AVI_EXTRACTOR_H_
-
-#define AVI_EXTRACTOR_H_
-
-#include <media/stagefright/foundation/ABase.h>
-#include <media/stagefright/MediaExtractor.h>
-#include <media/stagefright/MediaSource.h>
-#include <utils/Vector.h>
-
-namespace android {
-
-struct AVIExtractor : public MediaExtractor {
- AVIExtractor(const sp<DataSource> &dataSource);
-
- virtual size_t countTracks();
-
- virtual sp<MediaSource> getTrack(size_t index);
-
- virtual sp<MetaData> getTrackMetaData(
- size_t index, uint32_t flags);
-
- virtual sp<MetaData> getMetaData();
- virtual const char * name() { return "AVIExtractor"; }
-
-protected:
- virtual ~AVIExtractor();
-
-private:
- struct AVISource;
- struct MP3Splitter;
-
- struct SampleInfo {
- uint32_t mOffset;
- bool mIsKey;
- };
-
- struct Track {
- sp<MetaData> mMeta;
- Vector<SampleInfo> mSamples;
- uint32_t mRate;
- uint32_t mScale;
-
- // If bytes per sample == 0, each chunk represents a single sample,
- // otherwise each chunk should me a multiple of bytes-per-sample in
- // size.
- uint32_t mBytesPerSample;
-
- enum Kind {
- AUDIO,
- VIDEO,
- OTHER
-
- } mKind;
-
- size_t mNumSyncSamples;
- size_t mThumbnailSampleSize;
- ssize_t mThumbnailSampleIndex;
- size_t mMaxSampleSize;
-
- // If mBytesPerSample > 0:
- double mAvgChunkSize;
- size_t mFirstChunkSize;
- };
-
- sp<DataSource> mDataSource;
- status_t mInitCheck;
- Vector<Track> mTracks;
-
- off64_t mMovieOffset;
- bool mFoundIndex;
- bool mOffsetsAreAbsolute;
-
- ssize_t parseChunk(off64_t offset, off64_t size, int depth = 0);
- status_t parseStreamHeader(off64_t offset, size_t size);
- status_t parseStreamFormat(off64_t offset, size_t size);
- status_t parseIndex(off64_t offset, size_t size);
-
- status_t parseHeaders();
-
- status_t getSampleInfo(
- size_t trackIndex, size_t sampleIndex,
- off64_t *offset, size_t *size, bool *isKey,
- int64_t *sampleTimeUs);
-
- status_t getSampleTime(
- size_t trackIndex, size_t sampleIndex, int64_t *sampleTimeUs);
-
- status_t getSampleIndexAtTime(
- size_t trackIndex,
- int64_t timeUs, MediaSource::ReadOptions::SeekMode mode,
- size_t *sampleIndex) const;
-
- status_t addMPEG4CodecSpecificData(size_t trackIndex);
- status_t addH264CodecSpecificData(size_t trackIndex);
-
- static bool IsCorrectChunkType(
- ssize_t trackIndex, Track::Kind kind, uint32_t chunkType);
-
- DISALLOW_EVIL_CONSTRUCTORS(AVIExtractor);
-};
-
-class String8;
-struct AMessage;
-
-bool SniffAVI(
- const sp<DataSource> &source, String8 *mimeType, float *confidence,
- sp<AMessage> *);
-
-} // namespace android
-
-#endif // AVI_EXTRACTOR_H_
diff --git a/media/libstagefright/include/ItemTable.h b/media/libstagefright/include/ItemTable.h
new file mode 100644
index 0000000..5a6af5e
--- /dev/null
+++ b/media/libstagefright/include/ItemTable.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ITEM_TABLE_H_
+#define ITEM_TABLE_H_
+
+#include <set>
+
+#include <media/stagefright/foundation/ADebug.h>
+#include <utils/KeyedVector.h>
+#include <utils/RefBase.h>
+
+namespace android {
+
+class DataSource;
+class MetaData;
+
+namespace heif {
+
+struct AssociationEntry;
+struct ImageItem;
+struct ItemLoc;
+struct ItemInfo;
+struct ItemProperty;
+struct ItemReference;
+
+/*
+ * ItemTable keeps track of all image items (including coded images, grids and
+ * tiles) inside a HEIF still image (ISO/IEC FDIS 23008-12.2:2017(E)).
+ */
+
+class ItemTable : public RefBase {
+public:
+ explicit ItemTable(const sp<DataSource> &source);
+
+ status_t parse(uint32_t type, off64_t offset, size_t size);
+
+ bool isValid() { return mImageItemsValid; }
+ sp<MetaData> getImageMeta();
+ uint32_t countImages() const;
+ status_t findPrimaryImage(uint32_t *imageIndex);
+ status_t findThumbnail(uint32_t *thumbnailIndex);
+ status_t getImageOffsetAndSize(
+ uint32_t *imageIndex, off64_t *offset, size_t *size);
+
+protected:
+ ~ItemTable();
+
+private:
+ sp<DataSource> mDataSource;
+
+ KeyedVector<uint32_t, ItemLoc> mItemLocs;
+ Vector<ItemInfo> mItemInfos;
+ Vector<AssociationEntry> mAssociations;
+ Vector<sp<ItemProperty> > mItemProperties;
+ Vector<sp<ItemReference> > mItemReferences;
+
+ uint32_t mPrimaryItemId;
+ off64_t mIdatOffset;
+ size_t mIdatSize;
+
+ std::set<uint32_t> mRequiredBoxes;
+ std::set<uint32_t> mBoxesSeen;
+
+ bool mImageItemsValid;
+ uint32_t mCurrentImageIndex;
+ KeyedVector<uint32_t, ImageItem> mItemIdToImageMap;
+
+ status_t parseIlocBox(off64_t offset, size_t size);
+ status_t parseIinfBox(off64_t offset, size_t size);
+ status_t parsePitmBox(off64_t offset, size_t size);
+ status_t parseIprpBox(off64_t offset, size_t size);
+ status_t parseIdatBox(off64_t offset, size_t size);
+ status_t parseIrefBox(off64_t offset, size_t size);
+
+ void attachProperty(const AssociationEntry &association);
+ status_t buildImageItemsIfPossible(uint32_t type);
+
+ DISALLOW_EVIL_CONSTRUCTORS(ItemTable);
+};
+
+} // namespace heif
+} // namespace android
+
+#endif // ITEM_TABLE_H_
diff --git a/media/libstagefright/include/MPEG2TSExtractor.h b/media/libstagefright/include/MPEG2TSExtractor.h
index 2a75298..ac93b5e 100644
--- a/media/libstagefright/include/MPEG2TSExtractor.h
+++ b/media/libstagefright/include/MPEG2TSExtractor.h
@@ -45,7 +45,7 @@
virtual sp<MetaData> getMetaData();
- virtual status_t setMediaCas(const sp<ICas> &cas) override;
+ virtual status_t setMediaCas(const HInterfaceToken &casToken) override;
virtual uint32_t flags() const;
virtual const char * name() { return "MPEG2TSExtractor"; }
diff --git a/media/libstagefright/include/MPEG4Extractor.h b/media/libstagefright/include/MPEG4Extractor.h
index 1efe6b9..214a3de 100644
--- a/media/libstagefright/include/MPEG4Extractor.h
+++ b/media/libstagefright/include/MPEG4Extractor.h
@@ -28,11 +28,14 @@
#include <utils/String8.h>
namespace android {
-
struct AMessage;
class DataSource;
class SampleTable;
class String8;
+namespace heif {
+class ItemTable;
+}
+using heif::ItemTable;
struct SidxEntry {
size_t mSize;
@@ -59,6 +62,7 @@
virtual sp<MetaData> getMetaData();
virtual uint32_t flags() const;
virtual const char * name() { return "MPEG4Extractor"; }
+ virtual void release();
// for DRM
virtual char* getDrmTrackInfo(size_t trackID, int *len);
@@ -100,6 +104,7 @@
status_t mInitCheck;
uint32_t mHeaderTimescale;
bool mIsQT;
+ bool mIsHEIF;
Track *mFirstTrack, *mLastTrack;
@@ -137,6 +142,8 @@
SINF *mFirstSINF;
bool mIsDrm;
+ sp<ItemTable> mItemTable;
+
status_t parseDrmSINF(off64_t *offset, off64_t data_offset);
status_t parseTrackHeader(off64_t data_offset, off64_t data_size);
diff --git a/media/libstagefright/include/OMX.h b/media/libstagefright/include/OMX.h
deleted file mode 100644
index 4af3d39..0000000
--- a/media/libstagefright/include/OMX.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_OMX_H_
-#define ANDROID_OMX_H_
-
-#include <media/IOMX.h>
-#include <utils/threads.h>
-#include <utils/KeyedVector.h>
-#include <media/vndk/xmlparser/1.0/MediaCodecsXmlParser.h>
-#include "OmxNodeOwner.h"
-
-namespace android {
-
-struct OMXMaster;
-struct OMXNodeInstance;
-
-class OMX : public BnOMX,
- public OmxNodeOwner,
- public IBinder::DeathRecipient {
-public:
- OMX();
-
- virtual status_t listNodes(List<ComponentInfo> *list);
-
- virtual status_t allocateNode(
- const char *name, const sp<IOMXObserver> &observer,
- sp<IOMXNode> *omxNode);
-
- virtual status_t createInputSurface(
- sp<IGraphicBufferProducer> *bufferProducer,
- sp<IGraphicBufferSource> *bufferSource);
-
- virtual void binderDied(const wp<IBinder> &the_late_who);
-
- virtual status_t freeNode(const sp<OMXNodeInstance>& instance);
-
-protected:
- virtual ~OMX();
-
-private:
- Mutex mLock;
- OMXMaster *mMaster;
- MediaCodecsXmlParser mParser;
-
- KeyedVector<wp<IBinder>, sp<OMXNodeInstance> > mLiveNodes;
-
- OMX(const OMX &);
- OMX &operator=(const OMX &);
-};
-
-} // namespace android
-
-#endif // ANDROID_OMX_H_
diff --git a/media/libstagefright/include/OMXNodeInstance.h b/media/libstagefright/include/OMXNodeInstance.h
deleted file mode 100644
index 8e08d15..0000000
--- a/media/libstagefright/include/OMXNodeInstance.h
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef OMX_NODE_INSTANCE_H_
-
-#define OMX_NODE_INSTANCE_H_
-
-#include <atomic>
-
-#include <media/IOMX.h>
-#include <utils/RefBase.h>
-#include <utils/threads.h>
-#include <utils/KeyedVector.h>
-#include <utils/SortedVector.h>
-#include "OmxNodeOwner.h"
-
-#include <android/hidl/memory/1.0/IMemory.h>
-
-namespace android {
-class GraphicBuffer;
-class IOMXBufferSource;
-class IOMXObserver;
-struct OMXMaster;
-class OMXBuffer;
-typedef hidl::memory::V1_0::IMemory IHidlMemory;
-
-struct OMXNodeInstance : public BnOMXNode {
- OMXNodeInstance(
- OmxNodeOwner *owner, const sp<IOMXObserver> &observer, const char *name);
-
- void setHandle(OMX_HANDLETYPE handle);
-
- OMX_HANDLETYPE handle();
- sp<IOMXObserver> observer();
-
- status_t freeNode() override;
-
- status_t sendCommand(OMX_COMMANDTYPE cmd, OMX_S32 param);
- status_t getParameter(OMX_INDEXTYPE index, void *params, size_t size);
-
- status_t setParameter(
- OMX_INDEXTYPE index, const void *params, size_t size);
-
- status_t getConfig(OMX_INDEXTYPE index, void *params, size_t size);
- status_t setConfig(OMX_INDEXTYPE index, const void *params, size_t size);
-
- status_t setPortMode(OMX_U32 port_index, IOMX::PortMode mode);
-
- status_t getGraphicBufferUsage(OMX_U32 portIndex, OMX_U32* usage);
-
- status_t prepareForAdaptivePlayback(
- OMX_U32 portIndex, OMX_BOOL enable,
- OMX_U32 maxFrameWidth, OMX_U32 maxFrameHeight);
-
- status_t configureVideoTunnelMode(
- OMX_U32 portIndex, OMX_BOOL tunneled,
- OMX_U32 audioHwSync, native_handle_t **sidebandHandle);
-
- status_t setInputSurface(
- const sp<IOMXBufferSource> &bufferSource);
-
- status_t allocateSecureBuffer(
- OMX_U32 portIndex, size_t size, IOMX::buffer_id *buffer,
- void **buffer_data, sp<NativeHandle> *native_handle);
-
- status_t useBuffer(
- OMX_U32 portIndex, const OMXBuffer &omxBuf, buffer_id *buffer);
-
- status_t freeBuffer(
- OMX_U32 portIndex, buffer_id buffer);
-
- status_t fillBuffer(
- buffer_id buffer, const OMXBuffer &omxBuf, int fenceFd = -1);
-
- status_t emptyBuffer(
- buffer_id buffer, const OMXBuffer &omxBuf,
- OMX_U32 flags, OMX_TICKS timestamp, int fenceFd = -1);
-
- status_t getExtensionIndex(
- const char *parameterName, OMX_INDEXTYPE *index);
-
- status_t setQuirks(OMX_U32 quirks);
-
- bool isSecure() const {
- return mIsSecure;
- }
-
- status_t dispatchMessage(const omx_message &msg) override;
-
- // handles messages and removes them from the list
- void onMessages(std::list<omx_message> &messages);
- void onObserverDied();
- void onEvent(OMX_EVENTTYPE event, OMX_U32 arg1, OMX_U32 arg2);
-
- static OMX_CALLBACKTYPE kCallbacks;
-
-private:
- struct CallbackDispatcherThread;
- struct CallbackDispatcher;
-
- Mutex mLock;
-
- OmxNodeOwner *mOwner;
- OMX_HANDLETYPE mHandle;
- sp<IOMXObserver> mObserver;
- sp<CallbackDispatcher> mDispatcher;
- std::atomic_bool mDying;
- bool mSailed; // configuration is set (no more meta-mode changes)
- bool mQueriedProhibitedExtensions;
- SortedVector<OMX_INDEXTYPE> mProhibitedExtensions;
- bool mIsSecure;
- uint32_t mQuirks;
-
- // Lock only covers mOMXBufferSource and mOMXOutputListener. We can't always
- // use mLock because of rare instances where we'd end up locking it recursively.
- Mutex mOMXBufferSourceLock;
- // Access these through getBufferSource().
- sp<IOMXBufferSource> mOMXBufferSource;
-
- struct ActiveBuffer {
- OMX_U32 mPortIndex;
- IOMX::buffer_id mID;
- };
- Vector<ActiveBuffer> mActiveBuffers;
- // for buffer ptr to buffer id translation
- Mutex mBufferIDLock;
- uint32_t mBufferIDCount;
- KeyedVector<IOMX::buffer_id, OMX_BUFFERHEADERTYPE *> mBufferIDToBufferHeader;
- KeyedVector<OMX_BUFFERHEADERTYPE *, IOMX::buffer_id> mBufferHeaderToBufferID;
-
- bool mLegacyAdaptiveExperiment;
- IOMX::PortMode mPortMode[2];
- // metadata and secure buffer type tracking
- MetadataBufferType mMetadataType[2];
- enum SecureBufferType {
- kSecureBufferTypeUnknown,
- kSecureBufferTypeOpaque,
- kSecureBufferTypeNativeHandle,
- };
- SecureBufferType mSecureBufferType[2];
-
- // Following are OMX parameters managed by us (instead of the component)
- // OMX_IndexParamMaxFrameDurationForBitrateControl
- KeyedVector<int64_t, int64_t> mOriginalTimeUs;
- bool mRestorePtsFailed;
- int64_t mMaxTimestampGapUs;
- int64_t mPrevOriginalTimeUs;
- int64_t mPrevModifiedTimeUs;
-
- // For debug support
- char *mName;
- int DEBUG;
- size_t mNumPortBuffers[2]; // modified under mLock, read outside for debug
- Mutex mDebugLock;
- // following are modified and read under mDebugLock
- int DEBUG_BUMP;
- SortedVector<OMX_BUFFERHEADERTYPE *> mInputBuffersWithCodec, mOutputBuffersWithCodec;
- size_t mDebugLevelBumpPendingBuffers[2];
- void bumpDebugLevel_l(size_t numInputBuffers, size_t numOutputBuffers);
- void unbumpDebugLevel_l(size_t portIndex);
-
- ~OMXNodeInstance();
-
- void addActiveBuffer(OMX_U32 portIndex, IOMX::buffer_id id);
- void removeActiveBuffer(OMX_U32 portIndex, IOMX::buffer_id id);
- void freeActiveBuffers();
-
- // For buffer id management
- IOMX::buffer_id makeBufferID(OMX_BUFFERHEADERTYPE *bufferHeader);
- OMX_BUFFERHEADERTYPE *findBufferHeader(IOMX::buffer_id buffer, OMX_U32 portIndex);
- IOMX::buffer_id findBufferID(OMX_BUFFERHEADERTYPE *bufferHeader);
- void invalidateBufferID(IOMX::buffer_id buffer);
-
- bool isProhibitedIndex_l(OMX_INDEXTYPE index);
-
- status_t useBuffer_l(
- OMX_U32 portIndex, const sp<IMemory> ¶ms,
- const sp<IHidlMemory> &hParams, IOMX::buffer_id *buffer);
-
- status_t useGraphicBuffer_l(
- OMX_U32 portIndex, const sp<GraphicBuffer> &graphicBuffer,
- IOMX::buffer_id *buffer);
-
- status_t useGraphicBufferWithMetadata_l(
- OMX_U32 portIndex, const sp<GraphicBuffer> &graphicBuffer,
- IOMX::buffer_id *buffer);
-
- status_t useGraphicBuffer2_l(
- OMX_U32 portIndex, const sp<GraphicBuffer> &graphicBuffer,
- IOMX::buffer_id *buffer);
-
- status_t emptyBuffer_l(
- IOMX::buffer_id buffer,
- OMX_U32 rangeOffset, OMX_U32 rangeLength,
- OMX_U32 flags, OMX_TICKS timestamp, int fenceFd);
-
- status_t emptyGraphicBuffer_l(
- IOMX::buffer_id buffer, const sp<GraphicBuffer> &graphicBuffer,
- OMX_U32 flags, OMX_TICKS timestamp, int fenceFd);
-
- status_t emptyNativeHandleBuffer_l(
- IOMX::buffer_id buffer, const sp<NativeHandle> &nativeHandle,
- OMX_U32 flags, OMX_TICKS timestamp, int fenceFd);
-
- status_t emptyBuffer_l(
- OMX_BUFFERHEADERTYPE *header,
- OMX_U32 flags, OMX_TICKS timestamp, intptr_t debugAddr, int fenceFd);
-
- static OMX_ERRORTYPE OnEvent(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_PTR pAppData,
- OMX_IN OMX_EVENTTYPE eEvent,
- OMX_IN OMX_U32 nData1,
- OMX_IN OMX_U32 nData2,
- OMX_IN OMX_PTR pEventData);
-
- static OMX_ERRORTYPE OnEmptyBufferDone(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_PTR pAppData,
- OMX_IN OMX_BUFFERHEADERTYPE *pBuffer);
-
- static OMX_ERRORTYPE OnFillBufferDone(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_PTR pAppData,
- OMX_IN OMX_BUFFERHEADERTYPE *pBuffer);
-
- status_t enableNativeBuffers_l(
- OMX_U32 portIndex, OMX_BOOL graphic, OMX_BOOL enable);
-
- status_t storeMetaDataInBuffers_l(
- OMX_U32 portIndex, OMX_BOOL enable, MetadataBufferType *type);
-
- // Stores fence into buffer if it is ANWBuffer type and has enough space.
- // otherwise, waits for the fence to signal. Takes ownership of |fenceFd|.
- status_t storeFenceInMeta_l(
- OMX_BUFFERHEADERTYPE *header, int fenceFd, OMX_U32 portIndex);
-
- // Retrieves the fence from buffer if ANWBuffer type and has enough space. Otherwise, returns -1
- int retrieveFenceFromMeta_l(
- OMX_BUFFERHEADERTYPE *header, OMX_U32 portIndex);
-
- // Updates the graphic buffer handle in the metadata buffer for |buffer| and |header| to
- // |graphicBuffer|'s handle. If |updateCodecBuffer| is true, the update will happen in
- // the actual codec buffer (use this if not using emptyBuffer (with no _l) later to
- // pass the buffer to the codec, as only emptyBuffer copies the backup buffer to the codec
- // buffer.)
- status_t updateGraphicBufferInMeta_l(
- OMX_U32 portIndex, const sp<GraphicBuffer> &graphicBuffer,
- IOMX::buffer_id buffer, OMX_BUFFERHEADERTYPE *header);
-
- status_t updateNativeHandleInMeta_l(
- OMX_U32 portIndex, const sp<NativeHandle> &nativeHandle,
- IOMX::buffer_id buffer, OMX_BUFFERHEADERTYPE *header);
-
- sp<IOMXBufferSource> getBufferSource();
- void setBufferSource(const sp<IOMXBufferSource> &bufferSource);
- // Called when omx_message::FILL_BUFFER_DONE is received. (Currently the
- // buffer source will fix timestamp in the header if needed.)
- void codecBufferFilled(omx_message &msg);
-
- // Handles |msg|, and may modify it. Returns true iff completely handled it and
- // |msg| does not need to be sent to the event listener.
- bool handleMessage(omx_message &msg);
-
- bool handleDataSpaceChanged(omx_message &msg);
-
- status_t setMaxPtsGapUs(const void *params, size_t size);
- int64_t getCodecTimestamp(OMX_TICKS timestamp);
-
- OMXNodeInstance(const OMXNodeInstance &);
- OMXNodeInstance &operator=(const OMXNodeInstance &);
-};
-
-} // namespace android
-
-#endif // OMX_NODE_INSTANCE_H_
diff --git a/media/libstagefright/include/StagefrightMetadataRetriever.h b/media/libstagefright/include/StagefrightMetadataRetriever.h
index b7ac718..277eb3e 100644
--- a/media/libstagefright/include/StagefrightMetadataRetriever.h
+++ b/media/libstagefright/include/StagefrightMetadataRetriever.h
@@ -38,9 +38,9 @@
const KeyedVector<String8, String8> *headers);
virtual status_t setDataSource(int fd, int64_t offset, int64_t length);
- virtual status_t setDataSource(const sp<DataSource>& source);
+ virtual status_t setDataSource(const sp<DataSource>& source, const char *mime);
- virtual VideoFrame *getFrameAtTime(int64_t timeUs, int option);
+ virtual VideoFrame *getFrameAtTime(int64_t timeUs, int option, int colorFormat, bool metaOnly);
virtual MediaAlbumArt *extractAlbumArt();
virtual const char *extractMetadata(int keyCode);
diff --git a/media/libstagefright/include/media/stagefright/ACodec.h b/media/libstagefright/include/media/stagefright/ACodec.h
index d049df5..424246d 100644
--- a/media/libstagefright/include/media/stagefright/ACodec.h
+++ b/media/libstagefright/include/media/stagefright/ACodec.h
@@ -20,6 +20,7 @@
#include <stdint.h>
#include <android/native_window.h>
#include <media/hardware/MetadataBufferType.h>
+#include <media/MediaCodecInfo.h>
#include <media/IOMX.h>
#include <media/stagefright/foundation/AHierarchicalStateMachine.h>
#include <media/stagefright/CodecBase.h>
@@ -30,6 +31,8 @@
#include <OMX_Audio.h>
#include <hardware/gralloc.h>
#include <nativebase/nativebase.h>
+#include <android/hidl/allocator/1.0/IAllocator.h>
+#include <android/hidl/memory/1.0/IMemory.h>
#define TRACK_BUFFER_TIMING 0
@@ -42,20 +45,6 @@
struct DescribeColorFormat2Params;
struct DataConverter;
-// Treble shared memory
-namespace hidl {
-namespace allocator {
-namespace V1_0 {
-struct IAllocator;
-} // V1_0
-} // allocator
-namespace memory {
-namespace V1_0 {
-struct IMemory;
-} // V1_0
-} // memory
-} // hidl
-
typedef hidl::allocator::V1_0::IAllocator TAllocator;
typedef hidl::memory::V1_0::IMemory TMemory;
@@ -72,9 +61,10 @@
virtual void initiateStart();
virtual void initiateShutdown(bool keepComponentAllocated = false);
- virtual status_t queryCapabilities(
- const AString &name, const AString &mime, bool isEncoder,
- sp<MediaCodecInfo::Capabilities> *caps);
+ status_t queryCapabilities(
+ const char* owner, const char* name,
+ const char* mime, bool isEncoder,
+ MediaCodecInfo::CapabilitiesWriter* caps);
virtual status_t setSurface(const sp<Surface> &surface);
@@ -94,7 +84,8 @@
// some OMX components as auto level, and by others as invalid level.
static int /* OMX_VIDEO_AVCLEVELTYPE */ getAVCLevelFor(
int width, int height, int rate, int bitrate,
- OMX_VIDEO_AVCPROFILETYPE profile = OMX_VIDEO_AVCProfileBaseline);
+ OMX_VIDEO_AVCPROFILEEXTTYPE profile =
+ (OMX_VIDEO_AVCPROFILEEXTTYPE)OMX_VIDEO_AVCProfileBaseline);
// Quirk still supported, even though deprecated
enum Quirks {
diff --git a/media/libstagefright/include/media/stagefright/CameraSource.h b/media/libstagefright/include/media/stagefright/CameraSource.h
index 2aaa884..d6149c0 100644
--- a/media/libstagefright/include/media/stagefright/CameraSource.h
+++ b/media/libstagefright/include/media/stagefright/CameraSource.h
@@ -29,7 +29,7 @@
#include <utils/List.h>
#include <utils/RefBase.h>
#include <utils/String16.h>
-#include <MetadataBufferType.h>
+#include <media/hardware/MetadataBufferType.h>
namespace android {
diff --git a/media/libstagefright/include/media/stagefright/CodecBase.h b/media/libstagefright/include/media/stagefright/CodecBase.h
index 0dd77ba..9197f7b 100644
--- a/media/libstagefright/include/media/stagefright/CodecBase.h
+++ b/media/libstagefright/include/media/stagefright/CodecBase.h
@@ -24,27 +24,31 @@
#define STRINGIFY_ENUMS
-#include <media/ICrypto.h>
+#include <media/hardware/CryptoAPI.h>
+#include <media/hardware/HardwareAPI.h>
#include <media/IOMX.h>
#include <media/MediaCodecInfo.h>
-#include <media/stagefright/MediaErrors.h>
#include <media/stagefright/foundation/AHandler.h>
#include <media/stagefright/foundation/ColorUtils.h>
-#include <media/hardware/HardwareAPI.h>
-
+#include <media/stagefright/MediaErrors.h>
+#include <system/graphics.h>
#include <utils/NativeHandle.h>
-#include <system/graphics.h>
-#include <android/media/IDescrambler.h>
-
namespace android {
-using namespace media;
class BufferChannelBase;
struct BufferProducerWrapper;
class MediaCodecBuffer;
struct PersistentSurface;
struct RenderedFrameInfo;
class Surface;
+struct ICrypto;
+namespace hardware {
+namespace cas {
+namespace native {
+namespace V1_0 {
+struct IDescrambler;
+}}}}
+using hardware::cas::native::V1_0::IDescrambler;
struct CodecBase : public AHandler, /* static */ ColorUtils {
/**
@@ -209,10 +213,6 @@
// require an explicit message handler
virtual void onMessageReceived(const sp<AMessage> &msg) = 0;
- virtual status_t queryCapabilities(
- const AString& /*name*/, const AString& /*mime*/, bool /*isEncoder*/,
- sp<MediaCodecInfo::Capabilities>* /*caps*/ /* nonnull */) { return INVALID_OPERATION; }
-
virtual status_t setSurface(const sp<Surface>& /*surface*/) { return INVALID_OPERATION; }
virtual void signalFlush() = 0;
@@ -256,13 +256,9 @@
mCallback = std::move(callback);
}
- inline void setCrypto(const sp<ICrypto> &crypto) {
- mCrypto = crypto;
- }
+ void setCrypto(const sp<ICrypto> &crypto);
- inline void setDescrambler(const sp<IDescrambler> &descrambler) {
- mDescrambler = descrambler;
- }
+ void setDescrambler(const sp<IDescrambler> &descrambler);
/**
* Queue an input buffer into the buffer channel.
diff --git a/media/libstagefright/include/media/stagefright/ColorConverter.h b/media/libstagefright/include/media/stagefright/ColorConverter.h
index 270c809..7ac9b37 100644
--- a/media/libstagefright/include/media/stagefright/ColorConverter.h
+++ b/media/libstagefright/include/media/stagefright/ColorConverter.h
@@ -49,14 +49,17 @@
void *bits,
size_t width, size_t height,
size_t cropLeft, size_t cropTop,
- size_t cropRight, size_t cropBottom);
+ size_t cropRight, size_t cropBottom,
+ OMX_COLOR_FORMATTYPE colorFromat);
size_t cropWidth() const;
size_t cropHeight() const;
void *mBits;
+ OMX_COLOR_FORMATTYPE mColorFormat;
size_t mWidth, mHeight;
size_t mCropLeft, mCropTop, mCropRight, mCropBottom;
+ size_t mBpp, mStride;
};
OMX_COLOR_FORMATTYPE mSrcFormat, mDstFormat;
@@ -82,6 +85,10 @@
status_t convertTIYUV420PackedSemiPlanar(
const BitmapParams &src, const BitmapParams &dst);
+ void writeToDst(void *dst_ptr, uint8_t *kAdjustedClip, bool uncropped,
+ signed r1, signed g1, signed b1,
+ signed r2, signed g2, signed b2);
+
ColorConverter(const ColorConverter &);
ColorConverter &operator=(const ColorConverter &);
};
diff --git a/media/libstagefright/include/media/stagefright/DataSource.h b/media/libstagefright/include/media/stagefright/DataSource.h
index 63eccea..bd863ba 100644
--- a/media/libstagefright/include/media/stagefright/DataSource.h
+++ b/media/libstagefright/include/media/stagefright/DataSource.h
@@ -73,6 +73,11 @@
bool getUInt32(off64_t offset, uint32_t *x);
bool getUInt64(off64_t offset, uint64_t *x);
+ // read either int<N> or int<2N> into a uint<2N>_t, size is the int size in bytes.
+ bool getUInt16Var(off64_t offset, uint16_t *x, size_t size);
+ bool getUInt32Var(off64_t offset, uint32_t *x, size_t size);
+ bool getUInt64Var(off64_t offset, uint64_t *x, size_t size);
+
// Reads in "count" entries of type T into vector *x.
// Returns true if "count" entries can be read.
// If fewer than "count" entries can be read, return false. In this case,
diff --git a/media/libstagefright/include/media/stagefright/FrameRenderTracker.h b/media/libstagefright/include/media/stagefright/FrameRenderTracker.h
index 044699c..c14755a 100644
--- a/media/libstagefright/include/media/stagefright/FrameRenderTracker.h
+++ b/media/libstagefright/include/media/stagefright/FrameRenderTracker.h
@@ -23,6 +23,8 @@
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/AString.h>
+#include <ui/Fence.h>
+#include <ui/GraphicBuffer.h>
#include <list>
@@ -30,9 +32,6 @@
namespace android {
-class Fence;
-class GraphicBuffer;
-
// Tracks the render information about a frame. Frames go through several states while
// the render information is tracked:
//
diff --git a/media/libstagefright/include/media/stagefright/MPEG4Writer.h b/media/libstagefright/include/media/stagefright/MPEG4Writer.h
index dd357cc..1c7b4a6 100644
--- a/media/libstagefright/include/media/stagefright/MPEG4Writer.h
+++ b/media/libstagefright/include/media/stagefright/MPEG4Writer.h
@@ -204,7 +204,10 @@
void lock();
void unlock();
- void initInternal(int fd);
+ // Init all the internal variables for each recording session. Some variables
+ // will only need to be set for the first recording session and they will stay
+ // the same across all the recording sessions.
+ void initInternal(int fd, bool isFirstSession);
// Acquire lock before calling these methods
off64_t addSample_l(MediaBuffer *buffer);
diff --git a/media/libstagefright/include/media/stagefright/MediaCodec.h b/media/libstagefright/include/media/stagefright/MediaCodec.h
index 4140266..1030407 100644
--- a/media/libstagefright/include/media/stagefright/MediaCodec.h
+++ b/media/libstagefright/include/media/stagefright/MediaCodec.h
@@ -47,10 +47,13 @@
struct PersistentSurface;
class SoftwareRenderer;
class Surface;
-namespace media {
-class IDescrambler;
-};
-using namespace media;
+namespace hardware {
+namespace cas {
+namespace native {
+namespace V1_0 {
+struct IDescrambler;
+}}}}
+using hardware::cas::native::V1_0::IDescrambler;
struct MediaCodec : public AHandler {
enum ConfigureFlags {
@@ -84,11 +87,6 @@
static sp<PersistentSurface> CreatePersistentInputSurface();
- // utility method to query capabilities
- static status_t QueryCapabilities(
- const AString &name, const AString &mime, bool isEncoder,
- sp<MediaCodecInfo::Capabilities> *caps /* nonnull */);
-
status_t configure(
const sp<AMessage> &format,
const sp<Surface> &nativeWindow,
@@ -316,6 +314,8 @@
SoftwareRenderer *mSoftRenderer;
MediaAnalyticsItem *mAnalyticsItem;
+ void initAnalyticsItem();
+ void flushAnalyticsItem();
sp<AMessage> mOutputFormat;
sp<AMessage> mInputFormat;
diff --git a/media/libstagefright/include/media/stagefright/MediaCodecList.h b/media/libstagefright/include/media/stagefright/MediaCodecList.h
index 430bc16..f2bd496 100644
--- a/media/libstagefright/include/media/stagefright/MediaCodecList.h
+++ b/media/libstagefright/include/media/stagefright/MediaCodecList.h
@@ -21,7 +21,6 @@
#include <media/stagefright/foundation/ABase.h>
#include <media/stagefright/foundation/AString.h>
#include <media/IMediaCodecList.h>
-#include <media/IOMX.h>
#include <media/MediaCodecInfo.h>
#include <sys/types.h>
@@ -36,6 +35,8 @@
struct AMessage;
+struct MediaCodecListBuilderBase;
+
struct MediaCodecList : public BnMediaCodecList {
static sp<IMediaCodecList> getInstance();
@@ -51,7 +52,7 @@
ALOGE("b/24445127");
return NULL;
}
- return mCodecInfos.itemAt(index);
+ return mCodecInfos[index];
}
virtual const sp<AMessage> getGlobalSettings() const;
@@ -62,9 +63,6 @@
// only to be used by getLocalInstance
static void *profilerThreadWrapper(void * /*arg*/);
- // only to be used by MediaPlayerService
- void parseTopLevelXMLFile(const char *path, bool ignore_errors = false);
-
enum Flags {
kPreferSoftwareCodecs = 1,
kHardwareCodecsOnly = 2,
@@ -74,13 +72,11 @@
const char *mime,
bool createEncoder,
uint32_t flags,
- Vector<AString> *matching);
-
- static uint32_t getQuirksFor(const char *mComponentName);
+ Vector<AString> *matchingCodecs,
+ Vector<AString> *owners = nullptr);
static bool isSoftwareCodec(const AString &componentName);
-
private:
class BinderDeathObserver : public IBinder::DeathRecipient {
void binderDied(const wp<IBinder> &the_late_who __unused);
@@ -88,64 +84,86 @@
static sp<BinderDeathObserver> sBinderDeathObserver;
- enum Section {
- SECTION_TOPLEVEL,
- SECTION_SETTINGS,
- SECTION_DECODERS,
- SECTION_DECODER,
- SECTION_DECODER_TYPE,
- SECTION_ENCODERS,
- SECTION_ENCODER,
- SECTION_ENCODER_TYPE,
- SECTION_INCLUDE,
- };
-
static sp<IMediaCodecList> sCodecList;
static sp<IMediaCodecList> sRemoteList;
status_t mInitCheck;
- Section mCurrentSection;
- bool mUpdate;
- Vector<Section> mPastSections;
- int32_t mDepth;
- AString mHrefBase;
sp<AMessage> mGlobalSettings;
- KeyedVector<AString, CodecSettings> mOverrides;
+ std::vector<sp<MediaCodecInfo> > mCodecInfos;
- Vector<sp<MediaCodecInfo> > mCodecInfos;
- sp<MediaCodecInfo> mCurrentInfo;
+ /**
+ * This constructor will call `buildMediaCodecList()` from the given
+ * `MediaCodecListBuilderBase` object.
+ */
+ MediaCodecList(MediaCodecListBuilderBase* builder);
- MediaCodecList();
~MediaCodecList();
status_t initCheck() const;
- void parseXMLFile(const char *path);
- static void StartElementHandlerWrapper(
- void *me, const char *name, const char **attrs);
+ MediaCodecList(const MediaCodecList&) = delete;
+ MediaCodecList& operator=(const MediaCodecList&) = delete;
- static void EndElementHandlerWrapper(void *me, const char *name);
+ friend MediaCodecListWriter;
+};
- void startElementHandler(const char *name, const char **attrs);
- void endElementHandler(const char *name);
+/**
+ * This class is to be used by a `MediaCodecListBuilderBase` instance to add
+ * information to the associated `MediaCodecList` object.
+ */
+struct MediaCodecListWriter {
+ /**
+ * Add a key-value pair to a `MediaCodecList`'s global settings.
+ *
+ * @param key Key.
+ * @param value Value.
+ */
+ void addGlobalSetting(const char* key, const char* value);
+ /**
+ * Create an add a new `MediaCodecInfo` object to a `MediaCodecList`, and
+ * return a `MediaCodecInfoWriter` object associated with the newly added
+ * `MediaCodecInfo`.
+ *
+ * @return The `MediaCodecInfoWriter` object associated with the newly
+ * added `MediaCodecInfo` object.
+ */
+ std::unique_ptr<MediaCodecInfoWriter> addMediaCodecInfo();
+private:
+ /**
+ * The associated `MediaCodecList` object.
+ */
+ MediaCodecList* mList;
- status_t includeXMLFile(const char **attrs);
- status_t addSettingFromAttributes(const char **attrs);
- status_t addMediaCodecFromAttributes(bool encoder, const char **attrs);
- void addMediaCodec(bool encoder, const char *name, const char *type = NULL);
+ /**
+ * Construct this writer object associated with the given `MediaCodecList`
+ * object.
+ *
+ * @param list The "base" `MediaCodecList` object.
+ */
+ MediaCodecListWriter(MediaCodecList* list);
- void setCurrentCodecInfo(bool encoder, const char *name, const char *type);
+ friend MediaCodecList;
+};
- status_t addQuirk(const char **attrs);
- status_t addTypeFromAttributes(const char **attrs);
- status_t addLimit(const char **attrs);
- status_t addFeature(const char **attrs);
- void addType(const char *name);
+/**
+ * This interface is to be used by `MediaCodecList` to fill its members with
+ * appropriate information. `buildMediaCodecList()` will be called from a
+ * `MediaCodecList` object during its construction.
+ */
+struct MediaCodecListBuilderBase {
+ /**
+ * Build the `MediaCodecList` via the given `MediaCodecListWriter` interface.
+ *
+ * @param writer The writer interface.
+ * @return The status of the construction. `NO_ERROR` means success.
+ */
+ virtual status_t buildMediaCodecList(MediaCodecListWriter* writer) = 0;
- status_t initializeCapabilities(const char *type);
-
- DISALLOW_EVIL_CONSTRUCTORS(MediaCodecList);
+ /**
+ * The default destructor does nothing.
+ */
+ virtual ~MediaCodecListBuilderBase();
};
} // namespace android
diff --git a/media/libstagefright/include/media/stagefright/MediaErrors.h b/media/libstagefright/include/media/stagefright/MediaErrors.h
index 2e663ec..6a5c6b6 100644
--- a/media/libstagefright/include/media/stagefright/MediaErrors.h
+++ b/media/libstagefright/include/media/stagefright/MediaErrors.h
@@ -79,6 +79,26 @@
HEARTBEAT_ERROR_BASE = -3000,
ERROR_HEARTBEAT_TERMINATE_REQUESTED = HEARTBEAT_ERROR_BASE,
+ // CAS-related error codes
+ CAS_ERROR_BASE = -4000,
+
+ ERROR_CAS_UNKNOWN = CAS_ERROR_BASE,
+ ERROR_CAS_NO_LICENSE = CAS_ERROR_BASE - 1,
+ ERROR_CAS_LICENSE_EXPIRED = CAS_ERROR_BASE - 2,
+ ERROR_CAS_SESSION_NOT_OPENED = CAS_ERROR_BASE - 3,
+ ERROR_CAS_DECRYPT_UNIT_NOT_INITIALIZED = CAS_ERROR_BASE - 4,
+ ERROR_CAS_DECRYPT = CAS_ERROR_BASE - 5,
+ ERROR_CAS_CANNOT_HANDLE = CAS_ERROR_BASE - 6,
+ ERROR_CAS_TAMPER_DETECTED = CAS_ERROR_BASE - 7,
+ ERROR_CAS_NOT_PROVISIONED = CAS_ERROR_BASE - 8,
+ ERROR_CAS_DEVICE_REVOKED = CAS_ERROR_BASE - 9,
+ ERROR_CAS_RESOURCE_BUSY = CAS_ERROR_BASE - 10,
+ ERROR_CAS_INSUFFICIENT_OUTPUT_PROTECTION = CAS_ERROR_BASE - 11,
+ ERROR_CAS_LAST_USED_ERRORCODE = CAS_ERROR_BASE - 11,
+
+ ERROR_CAS_VENDOR_MAX = CAS_ERROR_BASE - 500,
+ ERROR_CAS_VENDOR_MIN = CAS_ERROR_BASE - 999,
+
// NDK Error codes
// frameworks/av/include/ndk/NdkMediaError.h
// from -10000 (0xFFFFD8F0 - 0xFFFFD8EC)
diff --git a/media/libstagefright/include/media/stagefright/MediaExtractor.h b/media/libstagefright/include/media/stagefright/MediaExtractor.h
index a856b2b..6ec7eaf 100644
--- a/media/libstagefright/include/media/stagefright/MediaExtractor.h
+++ b/media/libstagefright/include/media/stagefright/MediaExtractor.h
@@ -23,10 +23,6 @@
#include <media/MediaAnalyticsItem.h>
namespace android {
-namespace media {
-class ICas;
-};
-using namespace media;
class DataSource;
struct MediaSource;
class MetaData;
@@ -70,12 +66,14 @@
}
virtual void setUID(uid_t /*uid*/) {
}
- virtual status_t setMediaCas(const sp<ICas>& /*cas*/) override {
+ virtual status_t setMediaCas(const HInterfaceToken &/*casToken*/) override {
return INVALID_OPERATION;
}
virtual const char * name() { return "<unspecified>"; }
+ virtual void release() {}
+
protected:
MediaExtractor();
virtual ~MediaExtractor();
diff --git a/media/libstagefright/include/media/stagefright/MetaData.h b/media/libstagefright/include/media/stagefright/MetaData.h
index 9676b97..6cfde9c 100644
--- a/media/libstagefright/include/media/stagefright/MetaData.h
+++ b/media/libstagefright/include/media/stagefright/MetaData.h
@@ -38,6 +38,8 @@
kKeyDisplayHeight = 'dHgt', // int32_t, display/presentation
kKeySARWidth = 'sarW', // int32_t, sampleAspectRatio width
kKeySARHeight = 'sarH', // int32_t, sampleAspectRatio height
+ kKeyThumbnailWidth = 'thbW', // int32_t, thumbnail width
+ kKeyThumbnailHeight = 'thbH', // int32_t, thumbnail height
// a rectangle, if absent assumed to be (0, 0, width - 1, height - 1)
kKeyCropRect = 'crop',
@@ -58,6 +60,7 @@
kKeyAACProfile = 'aacp', // int32_t
kKeyAVCC = 'avcc', // raw data
kKeyHVCC = 'hvcc', // raw data
+ kKeyThumbnailHVCC = 'thvc', // raw data
kKeyD263 = 'd263', // raw data
kKeyVorbisInfo = 'vinf', // raw data
kKeyVorbisBooks = 'vboo', // raw data
@@ -209,6 +212,10 @@
// color Matrix, value defined by ColorAspects.MatrixCoeffs.
kKeyTemporalLayerId = 'iLyr', // int32_t, temporal layer-id. 0-based (0 => base layer)
kKeyTemporalLayerCount = 'cLyr', // int32_t, number of temporal layers encoded
+
+ kKeyGridWidth = 'grdW', // int32_t, HEIF grid width
+ kKeyGridHeight = 'grdH', // int32_t, HEIF grid height
+ kKeyIccProfile = 'prof', // raw data, ICC prifile data
};
enum {
diff --git a/media/libstagefright/include/media/stagefright/NuMediaExtractor.h b/media/libstagefright/include/media/stagefright/NuMediaExtractor.h
index 3e3cc17..6a93bd5 100644
--- a/media/libstagefright/include/media/stagefright/NuMediaExtractor.h
+++ b/media/libstagefright/include/media/stagefright/NuMediaExtractor.h
@@ -28,10 +28,6 @@
#include <utils/Vector.h>
namespace android {
-namespace media {
-class ICas;
-}
-using namespace media;
struct ABuffer;
struct AMessage;
@@ -64,7 +60,7 @@
status_t setDataSource(const sp<DataSource> &datasource);
- status_t setMediaCas(const sp<ICas> &cas);
+ status_t setMediaCas(const HInterfaceToken &casToken);
size_t countTracks() const;
status_t getTrackFormat(size_t index, sp<AMessage> *format, uint32_t flags = 0) const;
@@ -115,7 +111,7 @@
sp<DataSource> mDataSource;
sp<IMediaExtractor> mImpl;
- sp<ICas> mCas;
+ HInterfaceToken mCasToken;
Vector<TrackInfo> mSelectedTracks;
int64_t mTotalBitrate; // in bits/sec
diff --git a/media/libstagefright/include/media/stagefright/OMXClient.h b/media/libstagefright/include/media/stagefright/OMXClient.h
index 203a181..2f159b0 100644
--- a/media/libstagefright/include/media/stagefright/OMXClient.h
+++ b/media/libstagefright/include/media/stagefright/OMXClient.h
@@ -28,9 +28,10 @@
status_t connect();
status_t connect(bool* trebleFlag);
+ status_t connect(const char* name, bool* trebleFlag = nullptr);
status_t connectLegacy();
- status_t connectTreble();
+ status_t connectTreble(const char* name = "default");
void disconnect();
sp<IOMX> interface() {
@@ -40,8 +41,8 @@
private:
sp<IOMX> mOMX;
- OMXClient(const OMXClient &);
- OMXClient &operator=(const OMXClient &);
+ OMXClient(const OMXClient &) = delete;
+ OMXClient &operator=(const OMXClient &) = delete;
};
} // namespace android
diff --git a/media/libstagefright/include/media/stagefright/OmxInfoBuilder.h b/media/libstagefright/include/media/stagefright/OmxInfoBuilder.h
new file mode 100644
index 0000000..1b4d873
--- /dev/null
+++ b/media/libstagefright/include/media/stagefright/OmxInfoBuilder.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OMX_INFO_BUILDER_H_
+#define OMX_INFO_BUILDER_H_
+
+#include <media/stagefright/MediaCodecList.h>
+#include <utils/Errors.h>
+
+namespace android {
+
+class OmxInfoBuilder : public MediaCodecListBuilderBase {
+public:
+ OmxInfoBuilder();
+ status_t buildMediaCodecList(MediaCodecListWriter* writer) override;
+};
+
+} // namespace android
+
+#endif // OMX_INFO_BUILDER_H_
diff --git a/media/libstagefright/include/media/stagefright/SurfaceMediaSource.h b/media/libstagefright/include/media/stagefright/SurfaceMediaSource.h
index d38c337..d1677fa 100644
--- a/media/libstagefright/include/media/stagefright/SurfaceMediaSource.h
+++ b/media/libstagefright/include/media/stagefright/SurfaceMediaSource.h
@@ -25,7 +25,7 @@
#include <media/stagefright/MediaSource.h>
#include <media/stagefright/MediaBuffer.h>
-#include <MetadataBufferType.h>
+#include <media/hardware/MetadataBufferType.h>
#include "foundation/ABase.h"
diff --git a/media/libstagefright/include/media/stagefright/Utils.h b/media/libstagefright/include/media/stagefright/Utils.h
index 88a416a..77cbd4c 100644
--- a/media/libstagefright/include/media/stagefright/Utils.h
+++ b/media/libstagefright/include/media/stagefright/Utils.h
@@ -95,7 +95,7 @@
void readFromAMessage(const sp<AMessage> &msg, BufferingSettings *buffering /* nonnull */);
AString nameForFd(int fd);
-
+void MakeFourCCString(uint32_t x, char *s);
} // namespace android
#endif // UTILS_H_
diff --git a/media/libstagefright/mpeg2ts/ATSParser.cpp b/media/libstagefright/mpeg2ts/ATSParser.cpp
index 31edb21..a256a4d 100644
--- a/media/libstagefright/mpeg2ts/ATSParser.cpp
+++ b/media/libstagefright/mpeg2ts/ATSParser.cpp
@@ -23,8 +23,8 @@
#include "ESQueue.h"
#include "include/avc_utils.h"
-#include <android/media/IDescrambler.h>
-#include <binder/MemoryDealer.h>
+#include <android/hardware/cas/native/1.0/IDescrambler.h>
+#include <cutils/native_handle.h>
#include <media/stagefright/foundation/ABitReader.h>
#include <media/stagefright/foundation/ABuffer.h>
#include <media/stagefright/foundation/ADebug.h>
@@ -41,8 +41,12 @@
#include <inttypes.h>
namespace android {
-using binder::Status;
-using MediaDescrambler::DescrambleInfo;
+using hardware::hidl_handle;
+using hardware::hidl_memory;
+using hardware::hidl_string;
+using hardware::hidl_vec;
+using namespace hardware::cas::V1_0;
+using namespace hardware::cas::native::V1_0;
// I want the expression "y" evaluated even if verbose logging is off.
#define MY_LOGV(x, y) \
@@ -203,6 +207,7 @@
sp<AMessage> mSampleAesKeyItem;
sp<IMemory> mMem;
sp<MemoryDealer> mDealer;
+ hardware::cas::native::V1_0::SharedBuffer mDescramblerSrcBuffer;
sp<ABuffer> mDescrambledBuffer;
List<SubSampleInfo> mSubSamples;
sp<IDescrambler> mDescrambler;
@@ -235,7 +240,7 @@
// Ensure internal buffers can hold specified size, and will re-allocate
// as needed.
- void ensureBufferCapacity(size_t size);
+ bool ensureBufferCapacity(size_t size);
DISALLOW_EVIL_CONSTRUCTORS(Stream);
};
@@ -807,9 +812,9 @@
mQueue = NULL;
}
-void ATSParser::Stream::ensureBufferCapacity(size_t neededSize) {
+bool ATSParser::Stream::ensureBufferCapacity(size_t neededSize) {
if (mBuffer != NULL && mBuffer->capacity() >= neededSize) {
- return;
+ return true;
}
ALOGV("ensureBufferCapacity: current size %zu, new size %zu, scrambled %d",
@@ -837,6 +842,26 @@
mMem = newMem;
mDealer = newDealer;
mDescrambledBuffer = newScrambledBuffer;
+
+ ssize_t offset;
+ size_t size;
+ sp<IMemoryHeap> heap = newMem->getMemory(&offset, &size);
+ if (heap == NULL) {
+ return false;
+ }
+ native_handle_t* nativeHandle = native_handle_create(1, 0);
+ if (!nativeHandle) {
+ ALOGE("[stream %d] failed to create native handle", mElementaryPID);
+ return false;
+ }
+ nativeHandle->data[0] = heap->getHeapID();
+ mDescramblerSrcBuffer.heapBase = hidl_memory("ashmem",
+ hidl_handle(nativeHandle), heap->getSize());
+ mDescramblerSrcBuffer.offset = (uint64_t) offset;
+ mDescramblerSrcBuffer.size = (uint64_t) size;
+
+ ALOGD("[stream %d] created shared buffer for descrambling, offset %zd, size %zu",
+ mElementaryPID, offset, size);
} else {
// Align to multiples of 64K.
neededSize = (neededSize + 65535) & ~65535;
@@ -850,6 +875,7 @@
newBuffer->setRange(0, 0);
}
mBuffer = newBuffer;
+ return true;
}
status_t ATSParser::Stream::parse(
@@ -923,7 +949,9 @@
}
size_t neededSize = mBuffer->size() + payloadSizeBits / 8;
- ensureBufferCapacity(neededSize);
+ if (!ensureBufferCapacity(neededSize)) {
+ return NO_MEMORY;
+ }
memcpy(mBuffer->data() + mBuffer->size(), br->data(), payloadSizeBits / 8);
mBuffer->setRange(0, mBuffer->size() + payloadSizeBits / 8);
@@ -1365,47 +1393,59 @@
memcpy(mDescrambledBuffer->data(), mBuffer->data(), descrambleBytes);
mDescrambledBuffer->setRange(0, descrambleBytes);
- sp<ABuffer> subSamples = new ABuffer(
- sizeof(DescramblerPlugin::SubSample) * descrambleSubSamples);
-
- DescrambleInfo info;
- info.dstType = DescrambleInfo::kDestinationTypeVmPointer;
- info.scramblingControl = (DescramblerPlugin::ScramblingControl)sctrl;
- info.numSubSamples = descrambleSubSamples;
- info.subSamples = (DescramblerPlugin::SubSample *)subSamples->data();
- info.srcMem = mMem;
- info.srcOffset = 0;
- info.dstPtr = NULL; // in-place descrambling into srcMem
- info.dstOffset = 0;
+ hidl_vec<SubSample> subSamples;
+ subSamples.resize(descrambleSubSamples);
int32_t i = 0;
for (auto it = mSubSamples.begin();
it != mSubSamples.end() && i < descrambleSubSamples; it++, i++) {
if (it->transport_scrambling_mode != 0 || pesScramblingControl != 0) {
- info.subSamples[i].mNumBytesOfClearData = 0;
- info.subSamples[i].mNumBytesOfEncryptedData = it->subSampleSize;
+ subSamples[i].numBytesOfClearData = 0;
+ subSamples[i].numBytesOfEncryptedData = it->subSampleSize;
} else {
- info.subSamples[i].mNumBytesOfClearData = it->subSampleSize;
- info.subSamples[i].mNumBytesOfEncryptedData = 0;
+ subSamples[i].numBytesOfClearData = it->subSampleSize;
+ subSamples[i].numBytesOfEncryptedData = 0;
}
}
+
+ uint64_t srcOffset = 0, dstOffset = 0;
// If scrambled at PES-level, PES header should be skipped
if (pesScramblingControl != 0) {
- info.srcOffset = info.dstOffset = pesOffset;
- info.subSamples[0].mNumBytesOfEncryptedData -= pesOffset;
+ srcOffset = dstOffset = pesOffset;
+ subSamples[0].numBytesOfEncryptedData -= pesOffset;
}
- int32_t result;
- Status status = mDescrambler->descramble(info, &result);
+ Status status = Status::OK;
+ uint32_t bytesWritten = 0;
+ hidl_string detailedError;
- if (!status.isOk()) {
- ALOGE("[stream %d] descramble failed, exceptionCode=%d",
- mElementaryPID, status.exceptionCode());
+ DestinationBuffer dstBuffer;
+ dstBuffer.type = BufferType::SHARED_MEMORY;
+ dstBuffer.nonsecureMemory = mDescramblerSrcBuffer;
+
+ auto returnVoid = mDescrambler->descramble(
+ (ScramblingControl) sctrl,
+ subSamples,
+ mDescramblerSrcBuffer,
+ srcOffset,
+ dstBuffer,
+ dstOffset,
+ [&status, &bytesWritten, &detailedError] (
+ Status _status, uint32_t _bytesWritten,
+ const hidl_string& _detailedError) {
+ status = _status;
+ bytesWritten = _bytesWritten;
+ detailedError = _detailedError;
+ });
+
+ if (!returnVoid.isOk()) {
+ ALOGE("[stream %d] descramble failed, trans=%s",
+ mElementaryPID, returnVoid.description().c_str());
return UNKNOWN_ERROR;
}
ALOGV("[stream %d] descramble succeeded, %d bytes",
- mElementaryPID, result);
+ mElementaryPID, bytesWritten);
memcpy(mBuffer->data(), mDescrambledBuffer->data(), descrambleBytes);
}
diff --git a/media/libstagefright/mpeg2ts/ATSParser.h b/media/libstagefright/mpeg2ts/ATSParser.h
index 374e011..41c19cd 100644
--- a/media/libstagefright/mpeg2ts/ATSParser.h
+++ b/media/libstagefright/mpeg2ts/ATSParser.h
@@ -29,11 +29,13 @@
#include <vector>
namespace android {
-namespace media {
-class ICas;
-class IDescrambler;
-};
-using namespace media;
+namespace hardware {
+namespace cas {
+namespace V1_0 {
+struct ICas;
+}}}
+using hardware::cas::V1_0::ICas;
+
class ABitReader;
struct ABuffer;
struct AnotherPacketSource;
diff --git a/media/libstagefright/mpeg2ts/Android.bp b/media/libstagefright/mpeg2ts/Android.bp
index 96eb5bf..21259c4 100644
--- a/media/libstagefright/mpeg2ts/Android.bp
+++ b/media/libstagefright/mpeg2ts/Android.bp
@@ -35,5 +35,8 @@
shared_libs: [
"libcrypto",
"libmedia",
+ "libhidlmemory",
+ "android.hardware.cas.native@1.0",
+ "android.hidl.memory@1.0",
],
}
diff --git a/media/libstagefright/mpeg2ts/CasManager.cpp b/media/libstagefright/mpeg2ts/CasManager.cpp
index 047b1b3..9ff4521 100644
--- a/media/libstagefright/mpeg2ts/CasManager.cpp
+++ b/media/libstagefright/mpeg2ts/CasManager.cpp
@@ -18,15 +18,19 @@
#define LOG_TAG "CasManager"
#include "CasManager.h"
-#include <android/media/ICas.h>
-#include <android/media/IDescrambler.h>
-#include <android/media/IMediaCasService.h>
-#include <binder/IServiceManager.h>
+#include <android/hardware/cas/1.0/ICas.h>
+#include <android/hardware/cas/1.0/IMediaCasService.h>
+#include <android/hardware/cas/native/1.0/IDescrambler.h>
+#include <hidl/HidlSupport.h>
#include <media/stagefright/foundation/ABitReader.h>
#include <utils/Log.h>
namespace android {
-using binder::Status;
+
+using hardware::hidl_vec;
+using hardware::Return;
+using namespace hardware::cas::V1_0;
+using namespace hardware::cas::native::V1_0;
struct ATSParser::CasManager::ProgramCasManager : public RefBase {
ProgramCasManager(unsigned programNumber, const CADescriptor &descriptor);
@@ -125,45 +129,60 @@
const sp<ICas>& cas,
PidToSessionMap &sessionMap,
CasSession *session) {
- sp<IServiceManager> sm = defaultServiceManager();
- sp<IBinder> casServiceBinder = sm->getService(String16("media.cas"));
- sp<IMediaCasService> casService =
- interface_cast<IMediaCasService>(casServiceBinder);
-
+ sp<IMediaCasService> casService = IMediaCasService::getService("default");
if (casService == NULL) {
ALOGE("Cannot obtain IMediaCasService");
return NO_INIT;
}
+ Status status;
sp<IDescrambler> descrambler;
+ sp<IDescramblerBase> descramblerBase;
+ Return<Status> returnStatus(Status::OK);
+ Return<sp<IDescramblerBase> > returnDescrambler(NULL);
std::vector<uint8_t> sessionId;
const CADescriptor &descriptor = session->mCADescriptor;
- Status status = cas->openSession(&sessionId);
- if (!status.isOk()) {
- ALOGE("Failed to open session: exception=%d, error=%d",
- status.exceptionCode(), status.serviceSpecificErrorCode());
+ auto returnVoid = cas->openSession(
+ [&status, &sessionId] (Status _status, const hidl_vec<uint8_t>& _sessionId) {
+ status = _status;
+ sessionId = _sessionId;
+ });
+ if (!returnVoid.isOk() || status != Status::OK) {
+ ALOGE("Failed to open session: trans=%s, status=%d",
+ returnVoid.description().c_str(), status);
goto l_fail;
}
- cas->setSessionPrivateData(sessionId, descriptor.mPrivateData);
- if (!status.isOk()) {
- ALOGE("Failed to set private data: exception=%d, error=%d",
- status.exceptionCode(), status.serviceSpecificErrorCode());
+ returnStatus = cas->setSessionPrivateData(sessionId, descriptor.mPrivateData);
+ if (!returnStatus.isOk() || returnStatus != Status::OK) {
+ ALOGE("Failed to set private data: trans=%s, status=%d",
+ returnStatus.description().c_str(), (Status)returnStatus);
goto l_fail;
}
- status = casService->createDescrambler(descriptor.mSystemID, &descrambler);
- if (!status.isOk() || descrambler == NULL) {
- ALOGE("Failed to create descrambler: : exception=%d, error=%d",
- status.exceptionCode(), status.serviceSpecificErrorCode());
+ returnDescrambler = casService->createDescrambler(descriptor.mSystemID);
+ if (!returnDescrambler.isOk()) {
+ ALOGE("Failed to create descrambler: trans=%s",
+ returnDescrambler.description().c_str());
+ goto l_fail;
+ }
+ descramblerBase = (sp<IDescramblerBase>) returnDescrambler;
+ if (descramblerBase == NULL) {
+ ALOGE("Failed to create descrambler: null ptr");
goto l_fail;
}
- status = descrambler->setMediaCasSession(sessionId);
- if (!status.isOk()) {
- ALOGE("Failed to init descrambler: : exception=%d, error=%d",
- status.exceptionCode(), status.serviceSpecificErrorCode());
+ returnStatus = descramblerBase->setMediaCasSession(sessionId);
+ if (!returnStatus.isOk() || (Status) returnStatus != Status::OK) {
+ ALOGE("Failed to init descrambler: : trans=%s, status=%d",
+ returnStatus.description().c_str(), (Status) returnStatus);
+ goto l_fail;
+ }
+
+ descrambler = IDescrambler::castFrom(descramblerBase);
+ if (descrambler == NULL) {
+ ALOGE("Failed to cast from IDescramblerBase to IDescrambler");
goto l_fail;
}
@@ -177,8 +196,8 @@
if (!sessionId.empty()) {
cas->closeSession(sessionId);
}
- if (descrambler != NULL) {
- descrambler->release();
+ if (descramblerBase != NULL) {
+ descramblerBase->release();
}
return NO_INIT;
}
@@ -316,11 +335,12 @@
if (index < 0) {
return false;
}
- MediaCas::ParcelableCasData ecm(br->data(), br->numBitsLeft() / 8);
- Status status = mICas->processEcm(mCAPidToSessionIdMap[index], ecm);
- if (!status.isOk()) {
- ALOGE("Failed to process ECM: exception=%d, error=%d",
- status.exceptionCode(), status.serviceSpecificErrorCode());
+ hidl_vec<uint8_t> ecm;
+ ecm.setToExternal((uint8_t*)br->data(), br->numBitsLeft() / 8);
+ auto returnStatus = mICas->processEcm(mCAPidToSessionIdMap[index], ecm);
+ if (!returnStatus.isOk() || (Status) returnStatus != Status::OK) {
+ ALOGE("Failed to process ECM: trans=%s, status=%d",
+ returnStatus.description().c_str(), (Status) returnStatus);
}
return true; // handled
}
diff --git a/media/libstagefright/mpeg2ts/CasManager.h b/media/libstagefright/mpeg2ts/CasManager.h
index 8088dec..81f6546 100644
--- a/media/libstagefright/mpeg2ts/CasManager.h
+++ b/media/libstagefright/mpeg2ts/CasManager.h
@@ -21,10 +21,13 @@
#include <set>
namespace android {
-namespace media {
-class ICas;
-class IDescrambler;
-}
+namespace hardware {
+namespace cas {
+namespace native {
+namespace V1_0 {
+struct IDescrambler;
+}}}}
+using hardware::cas::native::V1_0::IDescrambler;
struct ATSParser::CasManager : public RefBase {
CasManager();
diff --git a/media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp b/media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp
index c3f1274..9d684e0 100644
--- a/media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp
+++ b/media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp
@@ -38,8 +38,13 @@
#include "AnotherPacketSource.h"
#include "ATSParser.h"
+#include <hidl/HybridInterface.h>
+#include <android/hardware/cas/1.0/ICas.h>
+
namespace android {
+using hardware::cas::V1_0::ICas;
+
static const size_t kTSPacketSize = 188;
static const int kMaxDurationReadSize = 250000LL;
static const int kMaxDurationRetry = 6;
@@ -156,7 +161,10 @@
|| !strcasecmp(MEDIA_MIMETYPE_AUDIO_SCRAMBLED, mime));
}
-status_t MPEG2TSExtractor::setMediaCas(const sp<ICas> &cas) {
+status_t MPEG2TSExtractor::setMediaCas(const HInterfaceToken &casToken) {
+ HalToken halToken;
+ halToken.setToExternal((uint8_t*)casToken.data(), casToken.size());
+ sp<ICas> cas = ICas::castFrom(retrieveHalInterface(halToken));
ALOGD("setMediaCas: %p", cas.get());
status_t err = mParser->setMediaCas(cas);
diff --git a/media/libstagefright/omx/1.0/Conversion.h b/media/libstagefright/omx/1.0/Conversion.h
deleted file mode 100644
index fd91574..0000000
--- a/media/libstagefright/omx/1.0/Conversion.h
+++ /dev/null
@@ -1,2179 +0,0 @@
-/*
- * Copyright 2016, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_MEDIA_OMX_V1_0__CONVERSION_H
-#define ANDROID_HARDWARE_MEDIA_OMX_V1_0__CONVERSION_H
-
-#include <vector>
-#include <list>
-
-#include <unistd.h>
-
-#include <hidl/MQDescriptor.h>
-#include <hidl/Status.h>
-#include <hidlmemory/mapping.h>
-
-#include <binder/Binder.h>
-#include <binder/Status.h>
-#include <ui/FenceTime.h>
-#include <media/OMXFenceParcelable.h>
-#include <cutils/native_handle.h>
-#include <gui/IGraphicBufferProducer.h>
-
-#include <media/OMXBuffer.h>
-#include <VideoAPI.h>
-
-#include <android/hidl/memory/1.0/IMemory.h>
-#include <android/hardware/graphics/bufferqueue/1.0/IProducerListener.h>
-#include <android/hardware/media/omx/1.0/types.h>
-#include <android/hardware/media/omx/1.0/IOmx.h>
-#include <android/hardware/media/omx/1.0/IOmxNode.h>
-#include <android/hardware/media/omx/1.0/IOmxBufferSource.h>
-#include <android/hardware/media/omx/1.0/IGraphicBufferSource.h>
-#include <android/hardware/media/omx/1.0/IOmxObserver.h>
-
-#include <android/IGraphicBufferSource.h>
-#include <android/IOMXBufferSource.h>
-
-namespace android {
-namespace hardware {
-namespace media {
-namespace omx {
-namespace V1_0 {
-namespace implementation {
-
-using ::android::hardware::hidl_array;
-using ::android::hardware::hidl_string;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_handle;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::sp;
-
-using ::android::String8;
-using ::android::OMXFenceParcelable;
-
-using ::android::hardware::media::omx::V1_0::Message;
-using ::android::omx_message;
-
-using ::android::hardware::media::omx::V1_0::ColorAspects;
-using ::android::hardware::media::V1_0::Rect;
-using ::android::hardware::media::V1_0::Region;
-
-using ::android::hardware::graphics::common::V1_0::Dataspace;
-
-using ::android::hardware::graphics::common::V1_0::PixelFormat;
-
-using ::android::OMXBuffer;
-
-using ::android::hardware::media::V1_0::AnwBuffer;
-using ::android::GraphicBuffer;
-
-using ::android::hardware::media::omx::V1_0::IOmx;
-using ::android::IOMX;
-
-using ::android::hardware::media::omx::V1_0::IOmxNode;
-using ::android::IOMXNode;
-
-using ::android::hardware::media::omx::V1_0::IOmxObserver;
-using ::android::IOMXObserver;
-
-using ::android::hardware::media::omx::V1_0::IOmxBufferSource;
-using ::android::IOMXBufferSource;
-
-typedef ::android::hardware::graphics::bufferqueue::V1_0::IGraphicBufferProducer
- HGraphicBufferProducer;
-typedef ::android::IGraphicBufferProducer
- BGraphicBufferProducer;
-
-// native_handle_t helper functions.
-
-/**
- * \brief Take an fd and create a native handle containing only the given fd.
- * The created handle will need to be deleted manually with
- * `native_handle_delete()`.
- *
- * \param[in] fd The source file descriptor (of type `int`).
- * \return The create `native_handle_t*` that contains the given \p fd. If the
- * supplied \p fd is negative, the created native handle will contain no file
- * descriptors.
- *
- * If the native handle cannot be created, the return value will be
- * `nullptr`.
- *
- * This function does not duplicate the file descriptor.
- */
-inline native_handle_t* native_handle_create_from_fd(int fd) {
- if (fd < 0) {
- return native_handle_create(0, 0);
- }
- native_handle_t* nh = native_handle_create(1, 0);
- if (nh == nullptr) {
- return nullptr;
- }
- nh->data[0] = fd;
- return nh;
-}
-
-/**
- * \brief Extract a file descriptor from a native handle.
- *
- * \param[in] nh The source `native_handle_t*`.
- * \param[in] index The index of the file descriptor in \p nh to read from. This
- * input has the default value of `0`.
- * \return The `index`-th file descriptor in \p nh. If \p nh does not have
- * enough file descriptors, the returned value will be `-1`.
- *
- * This function does not duplicate the file descriptor.
- */
-inline int native_handle_read_fd(native_handle_t const* nh, int index = 0) {
- return ((nh == nullptr) || (nh->numFds == 0) ||
- (nh->numFds <= index) || (index < 0)) ?
- -1 : nh->data[index];
-}
-
-/**
- * Conversion functions
- * ====================
- *
- * There are two main directions of conversion:
- * - `inTargetType(...)`: Create a wrapper whose lifetime depends on the
- * input. The wrapper has type `TargetType`.
- * - `toTargetType(...)`: Create a standalone object of type `TargetType` that
- * corresponds to the input. The lifetime of the output does not depend on the
- * lifetime of the input.
- * - `wrapIn(TargetType*, ...)`: Same as `inTargetType()`, but for `TargetType`
- * that cannot be copied and/or moved efficiently, or when there are multiple
- * output arguments.
- * - `convertTo(TargetType*, ...)`: Same as `toTargetType()`, but for
- * `TargetType` that cannot be copied and/or moved efficiently, or when there
- * are multiple output arguments.
- *
- * `wrapIn()` and `convertTo()` functions will take output arguments before
- * input arguments. Some of these functions might return a value to indicate
- * success or error.
- *
- * In converting or wrapping something as a Treble type that contains a
- * `hidl_handle`, `native_handle_t*` will need to be created and returned as
- * an additional output argument, hence only `wrapIn()` or `convertTo()` would
- * be available. The caller must call `native_handle_delete()` to deallocate the
- * returned native handle when it is no longer needed.
- *
- * For types that contain file descriptors, `inTargetType()` and `wrapAs()` do
- * not perform duplication of file descriptors, while `toTargetType()` and
- * `convertTo()` do.
- */
-
-/**
- * \brief Convert `Return<void>` to `binder::Status`.
- *
- * \param[in] t The source `Return<void>`.
- * \return The corresponding `binder::Status`.
- */
-// convert: Return<void> -> ::android::binder::Status
-inline ::android::binder::Status toBinderStatus(
- Return<void> const& t) {
- return ::android::binder::Status::fromExceptionCode(
- t.isOk() ? OK : UNKNOWN_ERROR,
- t.description().c_str());
-}
-
-/**
- * \brief Convert `Return<Status>` to `status_t`. This is for legacy binder
- * calls.
- *
- * \param[in] t The source `Return<Status>`.
- * \return The corresponding `status_t`.
- *
- * This function first check if \p t has a transport error. If it does, then the
- * return value is the transport error code. Otherwise, the return value is
- * converted from `Status` contained inside \p t.
- *
- * Note:
- * - This `Status` is omx-specific. It is defined in `types.hal`.
- * - The name of this function is not `convert`.
- */
-// convert: Status -> status_t
-inline status_t toStatusT(Return<Status> const& t) {
- return t.isOk() ? static_cast<status_t>(static_cast<Status>(t)) : UNKNOWN_ERROR;
-}
-
-/**
- * \brief Convert `Return<void>` to `status_t`. This is for legacy binder calls.
- *
- * \param[in] t The source `Return<void>`.
- * \return The corresponding `status_t`.
- */
-// convert: Return<void> -> status_t
-inline status_t toStatusT(Return<void> const& t) {
- return t.isOk() ? OK : UNKNOWN_ERROR;
-}
-
-/**
- * \brief Convert `Status` to `status_t`. This is for legacy binder calls.
- *
- * \param[in] t The source `Status`.
- * \return the corresponding `status_t`.
- */
-// convert: Status -> status_t
-inline status_t toStatusT(Status const& t) {
- return static_cast<status_t>(t);
-}
-
-/**
- * \brief Convert `status_t` to `Status`.
- *
- * \param[in] l The source `status_t`.
- * \return The corresponding `Status`.
- */
-// convert: status_t -> Status
-inline Status toStatus(status_t l) {
- return static_cast<Status>(l);
-}
-
-/**
- * \brief Wrap `native_handle_t*` in `hidl_handle`.
- *
- * \param[in] nh The source `native_handle_t*`.
- * \return The `hidl_handle` that points to \p nh.
- */
-// wrap: native_handle_t* -> hidl_handle
-inline hidl_handle inHidlHandle(native_handle_t const* nh) {
- return hidl_handle(nh);
-}
-
-/**
- * \brief Wrap an `omx_message` and construct the corresponding `Message`.
- *
- * \param[out] t The wrapper of type `Message`.
- * \param[out] nh The native_handle_t referred to by `t->fence`.
- * \param[in] l The source `omx_message`.
- * \return `true` if the wrapping is successful; `false` otherwise.
- *
- * Upon success, \p nh will be created to hold the file descriptor stored in
- * `l.fenceFd`, and `t->fence` will point to \p nh. \p nh will need to be
- * destroyed manually by `native_handle_delete()` when \p t is no longer needed.
- *
- * Upon failure, \p nh will not be created and will not need to be deleted. \p t
- * will be invalid.
- */
-// wrap, omx_message -> Message, native_handle_t*
-inline bool wrapAs(Message* t, native_handle_t** nh, omx_message const& l) {
- *nh = native_handle_create_from_fd(l.fenceFd);
- if (!*nh) {
- return false;
- }
- t->fence = *nh;
- switch (l.type) {
- case omx_message::EVENT:
- t->type = Message::Type::EVENT;
- t->data.eventData.event = uint32_t(l.u.event_data.event);
- t->data.eventData.data1 = l.u.event_data.data1;
- t->data.eventData.data2 = l.u.event_data.data2;
- t->data.eventData.data3 = l.u.event_data.data3;
- t->data.eventData.data4 = l.u.event_data.data4;
- break;
- case omx_message::EMPTY_BUFFER_DONE:
- t->type = Message::Type::EMPTY_BUFFER_DONE;
- t->data.bufferData.buffer = l.u.buffer_data.buffer;
- break;
- case omx_message::FILL_BUFFER_DONE:
- t->type = Message::Type::FILL_BUFFER_DONE;
- t->data.extendedBufferData.buffer = l.u.extended_buffer_data.buffer;
- t->data.extendedBufferData.rangeOffset =
- l.u.extended_buffer_data.range_offset;
- t->data.extendedBufferData.rangeLength =
- l.u.extended_buffer_data.range_length;
- t->data.extendedBufferData.flags = l.u.extended_buffer_data.flags;
- t->data.extendedBufferData.timestampUs =
- l.u.extended_buffer_data.timestamp;
- break;
- case omx_message::FRAME_RENDERED:
- t->type = Message::Type::FRAME_RENDERED;
- t->data.renderData.timestampUs = l.u.render_data.timestamp;
- t->data.renderData.systemTimeNs = l.u.render_data.nanoTime;
- break;
- default:
- native_handle_delete(*nh);
- return false;
- }
- return true;
-}
-
-/**
- * \brief Wrap a `Message` inside an `omx_message`.
- *
- * \param[out] l The wrapper of type `omx_message`.
- * \param[in] t The source `Message`.
- * \return `true` if the wrapping is successful; `false` otherwise.
- */
-// wrap: Message -> omx_message
-inline bool wrapAs(omx_message* l, Message const& t) {
- l->fenceFd = native_handle_read_fd(t.fence);
- switch (t.type) {
- case Message::Type::EVENT:
- l->type = omx_message::EVENT;
- l->u.event_data.event = OMX_EVENTTYPE(t.data.eventData.event);
- l->u.event_data.data1 = t.data.eventData.data1;
- l->u.event_data.data2 = t.data.eventData.data2;
- l->u.event_data.data3 = t.data.eventData.data3;
- l->u.event_data.data4 = t.data.eventData.data4;
- break;
- case Message::Type::EMPTY_BUFFER_DONE:
- l->type = omx_message::EMPTY_BUFFER_DONE;
- l->u.buffer_data.buffer = t.data.bufferData.buffer;
- break;
- case Message::Type::FILL_BUFFER_DONE:
- l->type = omx_message::FILL_BUFFER_DONE;
- l->u.extended_buffer_data.buffer = t.data.extendedBufferData.buffer;
- l->u.extended_buffer_data.range_offset =
- t.data.extendedBufferData.rangeOffset;
- l->u.extended_buffer_data.range_length =
- t.data.extendedBufferData.rangeLength;
- l->u.extended_buffer_data.flags = t.data.extendedBufferData.flags;
- l->u.extended_buffer_data.timestamp =
- t.data.extendedBufferData.timestampUs;
- break;
- case Message::Type::FRAME_RENDERED:
- l->type = omx_message::FRAME_RENDERED;
- l->u.render_data.timestamp = t.data.renderData.timestampUs;
- l->u.render_data.nanoTime = t.data.renderData.systemTimeNs;
- break;
- default:
- return false;
- }
- return true;
-}
-
-/**
- * \brief Similar to `wrapTo(omx_message*, Message const&)`, but the output will
- * have an extended lifetime.
- *
- * \param[out] l The output `omx_message`.
- * \param[in] t The source `Message`.
- * \return `true` if the conversion is successful; `false` otherwise.
- *
- * This function calls `wrapto()`, then attempts to duplicate the file
- * descriptor for the fence if it is not `-1`. If duplication fails, `false`
- * will be returned.
- */
-// convert: Message -> omx_message
-inline bool convertTo(omx_message* l, Message const& t) {
- if (!wrapAs(l, t)) {
- return false;
- }
- if (l->fenceFd == -1) {
- return true;
- }
- l->fenceFd = dup(l->fenceFd);
- return l->fenceFd != -1;
-}
-
-/**
- * \brief Wrap an `OMXFenceParcelable` inside a `hidl_handle`.
- *
- * \param[out] t The wrapper of type `hidl_handle`.
- * \param[out] nh The native handle created to hold the file descriptor inside
- * \p l.
- * \param[in] l The source `OMXFenceParcelable`, which essentially contains one
- * file descriptor.
- * \return `true` if \p t and \p nh are successfully created to wrap around \p
- * l; `false` otherwise.
- *
- * On success, \p nh needs to be deleted by the caller with
- * `native_handle_delete()` after \p t and \p nh are no longer needed.
- *
- * On failure, \p nh will not need to be deleted, and \p t will hold an invalid
- * value.
- */
-// wrap: OMXFenceParcelable -> hidl_handle, native_handle_t*
-inline bool wrapAs(hidl_handle* t, native_handle_t** nh,
- OMXFenceParcelable const& l) {
- *nh = native_handle_create_from_fd(l.get());
- if (!*nh) {
- return false;
- }
- *t = *nh;
- return true;
-}
-
-/**
- * \brief Wrap a `hidl_handle` inside an `OMXFenceParcelable`.
- *
- * \param[out] l The wrapper of type `OMXFenceParcelable`.
- * \param[in] t The source `hidl_handle`.
- */
-// wrap: hidl_handle -> OMXFenceParcelable
-inline void wrapAs(OMXFenceParcelable* l, hidl_handle const& t) {
- l->mFenceFd = native_handle_read_fd(t);
-}
-
-/**
- * \brief Convert a `hidl_handle` to `OMXFenceParcelable`. If `hidl_handle`
- * contains file descriptors, the first file descriptor will be duplicated and
- * stored in the output `OMXFenceParcelable`.
- *
- * \param[out] l The output `OMXFenceParcelable`.
- * \param[in] t The input `hidl_handle`.
- * \return `false` if \p t contains a valid file descriptor but duplication
- * fails; `true` otherwise.
- */
-// convert: hidl_handle -> OMXFenceParcelable
-inline bool convertTo(OMXFenceParcelable* l, hidl_handle const& t) {
- int fd = native_handle_read_fd(t);
- if (fd != -1) {
- fd = dup(fd);
- if (fd == -1) {
- return false;
- }
- }
- l->mFenceFd = fd;
- return true;
-}
-
-/**
- * \brief Convert `::android::ColorAspects` to `ColorAspects`.
- *
- * \param[in] l The source `::android::ColorAspects`.
- * \return The corresponding `ColorAspects`.
- */
-// convert: ::android::ColorAspects -> ColorAspects
-inline ColorAspects toHardwareColorAspects(::android::ColorAspects const& l) {
- return ColorAspects{
- static_cast<ColorAspects::Range>(l.mRange),
- static_cast<ColorAspects::Primaries>(l.mPrimaries),
- static_cast<ColorAspects::Transfer>(l.mTransfer),
- static_cast<ColorAspects::MatrixCoeffs>(l.mMatrixCoeffs)};
-}
-
-/**
- * \brief Convert `int32_t` to `ColorAspects`.
- *
- * \param[in] l The source `int32_t`.
- * \return The corresponding `ColorAspects`.
- */
-// convert: int32_t -> ColorAspects
-inline ColorAspects toHardwareColorAspects(int32_t l) {
- return ColorAspects{
- static_cast<ColorAspects::Range>((l >> 24) & 0xFF),
- static_cast<ColorAspects::Primaries>((l >> 16) & 0xFF),
- static_cast<ColorAspects::Transfer>(l & 0xFF),
- static_cast<ColorAspects::MatrixCoeffs>((l >> 8) & 0xFF)};
-}
-
-/**
- * \brief Convert `ColorAspects` to `::android::ColorAspects`.
- *
- * \param[in] t The source `ColorAspects`.
- * \return The corresponding `::android::ColorAspects`.
- */
-// convert: ColorAspects -> ::android::ColorAspects
-inline int32_t toCompactColorAspects(ColorAspects const& t) {
- return static_cast<int32_t>(
- (static_cast<uint32_t>(t.range) << 24) |
- (static_cast<uint32_t>(t.primaries) << 16) |
- (static_cast<uint32_t>(t.transfer)) |
- (static_cast<uint32_t>(t.matrixCoeffs) << 8));
-}
-
-/**
- * \brief Convert `int32_t` to `Dataspace`.
- *
- * \param[in] l The source `int32_t`.
- * \result The corresponding `Dataspace`.
- */
-// convert: int32_t -> Dataspace
-inline Dataspace toHardwareDataspace(int32_t l) {
- return static_cast<Dataspace>(l);
-}
-
-/**
- * \brief Convert `Dataspace` to `int32_t`.
- *
- * \param[in] t The source `Dataspace`.
- * \result The corresponding `int32_t`.
- */
-// convert: Dataspace -> int32_t
-inline int32_t toRawDataspace(Dataspace const& t) {
- return static_cast<int32_t>(t);
-}
-
-/**
- * \brief Wrap an opaque buffer inside a `hidl_vec<uint8_t>`.
- *
- * \param[in] l The pointer to the beginning of the opaque buffer.
- * \param[in] size The size of the buffer.
- * \return A `hidl_vec<uint8_t>` that points to the buffer.
- */
-// wrap: void*, size_t -> hidl_vec<uint8_t>
-inline hidl_vec<uint8_t> inHidlBytes(void const* l, size_t size) {
- hidl_vec<uint8_t> t;
- t.setToExternal(static_cast<uint8_t*>(const_cast<void*>(l)), size, false);
- return t;
-}
-
-/**
- * \brief Create a `hidl_vec<uint8_t>` that is a copy of an opaque buffer.
- *
- * \param[in] l The pointer to the beginning of the opaque buffer.
- * \param[in] size The size of the buffer.
- * \return A `hidl_vec<uint8_t>` that is a copy of the input buffer.
- */
-// convert: void*, size_t -> hidl_vec<uint8_t>
-inline hidl_vec<uint8_t> toHidlBytes(void const* l, size_t size) {
- hidl_vec<uint8_t> t;
- t.resize(size);
- uint8_t const* src = static_cast<uint8_t const*>(l);
- std::copy(src, src + size, t.data());
- return t;
-}
-
-/**
- * \brief Wrap `GraphicBuffer` in `AnwBuffer`.
- *
- * \param[out] t The wrapper of type `AnwBuffer`.
- * \param[in] l The source `GraphicBuffer`.
- */
-// wrap: GraphicBuffer -> AnwBuffer
-inline void wrapAs(AnwBuffer* t, GraphicBuffer const& l) {
- t->attr.width = l.getWidth();
- t->attr.height = l.getHeight();
- t->attr.stride = l.getStride();
- t->attr.format = static_cast<PixelFormat>(l.getPixelFormat());
- t->attr.layerCount = l.getLayerCount();
- t->attr.usage = l.getUsage();
- t->attr.id = l.getId();
- t->attr.generationNumber = l.getGenerationNumber();
- t->nativeHandle = hidl_handle(l.handle);
-}
-
-/**
- * \brief Convert `AnwBuffer` to `GraphicBuffer`.
- *
- * \param[out] l The destination `GraphicBuffer`.
- * \param[in] t The source `AnwBuffer`.
- *
- * This function will duplicate all file descriptors in \p t.
- */
-// convert: AnwBuffer -> GraphicBuffer
-// Ref: frameworks/native/libs/ui/GraphicBuffer.cpp: GraphicBuffer::flatten
-inline bool convertTo(GraphicBuffer* l, AnwBuffer const& t) {
- native_handle_t* handle = t.nativeHandle == nullptr ?
- nullptr : native_handle_clone(t.nativeHandle);
-
- size_t const numInts = 12 + (handle ? handle->numInts : 0);
- int32_t* ints = new int32_t[numInts];
-
- size_t numFds = static_cast<size_t>(handle ? handle->numFds : 0);
- int* fds = new int[numFds];
-
- ints[0] = 'GBFR';
- ints[1] = static_cast<int32_t>(t.attr.width);
- ints[2] = static_cast<int32_t>(t.attr.height);
- ints[3] = static_cast<int32_t>(t.attr.stride);
- ints[4] = static_cast<int32_t>(t.attr.format);
- ints[5] = static_cast<int32_t>(t.attr.layerCount);
- ints[6] = static_cast<int32_t>(t.attr.usage);
- ints[7] = static_cast<int32_t>(t.attr.id >> 32);
- ints[8] = static_cast<int32_t>(t.attr.id & 0xFFFFFFFF);
- ints[9] = static_cast<int32_t>(t.attr.generationNumber);
- ints[10] = 0;
- ints[11] = 0;
- if (handle) {
- ints[10] = static_cast<int32_t>(handle->numFds);
- ints[11] = static_cast<int32_t>(handle->numInts);
- int* intsStart = handle->data + handle->numFds;
- std::copy(handle->data, intsStart, fds);
- std::copy(intsStart, intsStart + handle->numInts, &ints[12]);
- }
-
- void const* constBuffer = static_cast<void const*>(ints);
- size_t size = numInts * sizeof(int32_t);
- int const* constFds = static_cast<int const*>(fds);
- status_t status = l->unflatten(constBuffer, size, constFds, numFds);
-
- delete [] fds;
- delete [] ints;
- native_handle_delete(handle);
- return status == NO_ERROR;
-}
-
-/**
- * \brief Wrap `GraphicBuffer` in `CodecBuffer`.
- *
- * \param[out] t The wrapper of type `CodecBuffer`.
- * \param[in] l The source `GraphicBuffer`.
- */
-// wrap: OMXBuffer -> CodecBuffer
-inline CodecBuffer *wrapAs(CodecBuffer *t, sp<GraphicBuffer> const& graphicBuffer) {
- t->sharedMemory = hidl_memory();
- t->nativeHandle = hidl_handle();
- t->type = CodecBuffer::Type::ANW_BUFFER;
- if (graphicBuffer == nullptr) {
- t->attr.anwBuffer.width = 0;
- t->attr.anwBuffer.height = 0;
- t->attr.anwBuffer.stride = 0;
- t->attr.anwBuffer.format = static_cast<PixelFormat>(1);
- t->attr.anwBuffer.layerCount = 0;
- t->attr.anwBuffer.usage = 0;
- return t;
- }
- t->attr.anwBuffer.width = graphicBuffer->getWidth();
- t->attr.anwBuffer.height = graphicBuffer->getHeight();
- t->attr.anwBuffer.stride = graphicBuffer->getStride();
- t->attr.anwBuffer.format = static_cast<PixelFormat>(
- graphicBuffer->getPixelFormat());
- t->attr.anwBuffer.layerCount = graphicBuffer->getLayerCount();
- t->attr.anwBuffer.usage = graphicBuffer->getUsage();
- t->nativeHandle = graphicBuffer->handle;
- return t;
-}
-
-/**
- * \brief Wrap `OMXBuffer` in `CodecBuffer`.
- *
- * \param[out] t The wrapper of type `CodecBuffer`.
- * \param[in] l The source `OMXBuffer`.
- * \return `true` if the wrapping is successful; `false` otherwise.
- */
-// wrap: OMXBuffer -> CodecBuffer
-inline bool wrapAs(CodecBuffer* t, OMXBuffer const& l) {
- t->sharedMemory = hidl_memory();
- t->nativeHandle = hidl_handle();
- switch (l.mBufferType) {
- case OMXBuffer::kBufferTypeInvalid: {
- t->type = CodecBuffer::Type::INVALID;
- return true;
- }
- case OMXBuffer::kBufferTypePreset: {
- t->type = CodecBuffer::Type::PRESET;
- t->attr.preset.rangeLength = static_cast<uint32_t>(l.mRangeLength);
- t->attr.preset.rangeOffset = static_cast<uint32_t>(l.mRangeOffset);
- return true;
- }
- case OMXBuffer::kBufferTypeHidlMemory: {
- t->type = CodecBuffer::Type::SHARED_MEM;
- t->sharedMemory = l.mHidlMemory;
- return true;
- }
- case OMXBuffer::kBufferTypeSharedMem: {
- // This is not supported.
- return false;
- }
- case OMXBuffer::kBufferTypeANWBuffer: {
- wrapAs(t, l.mGraphicBuffer);
- return true;
- }
- case OMXBuffer::kBufferTypeNativeHandle: {
- t->type = CodecBuffer::Type::NATIVE_HANDLE;
- t->nativeHandle = l.mNativeHandle->handle();
- return true;
- }
- }
- return false;
-}
-
-/**
- * \brief Convert `CodecBuffer` to `OMXBuffer`.
- *
- * \param[out] l The destination `OMXBuffer`.
- * \param[in] t The source `CodecBuffer`.
- * \return `true` if successful; `false` otherwise.
- */
-// convert: CodecBuffer -> OMXBuffer
-inline bool convertTo(OMXBuffer* l, CodecBuffer const& t) {
- switch (t.type) {
- case CodecBuffer::Type::INVALID: {
- *l = OMXBuffer();
- return true;
- }
- case CodecBuffer::Type::PRESET: {
- *l = OMXBuffer(
- t.attr.preset.rangeOffset,
- t.attr.preset.rangeLength);
- return true;
- }
- case CodecBuffer::Type::SHARED_MEM: {
- *l = OMXBuffer(t.sharedMemory);
- return true;
- }
- case CodecBuffer::Type::ANW_BUFFER: {
- if (t.nativeHandle.getNativeHandle() == nullptr) {
- *l = OMXBuffer(sp<GraphicBuffer>(nullptr));
- return true;
- }
- AnwBuffer anwBuffer;
- anwBuffer.nativeHandle = t.nativeHandle;
- anwBuffer.attr = t.attr.anwBuffer;
- sp<GraphicBuffer> graphicBuffer = new GraphicBuffer();
- if (!convertTo(graphicBuffer.get(), anwBuffer)) {
- return false;
- }
- *l = OMXBuffer(graphicBuffer);
- return true;
- }
- case CodecBuffer::Type::NATIVE_HANDLE: {
- *l = OMXBuffer(NativeHandle::create(
- native_handle_clone(t.nativeHandle), true));
- return true;
- }
- }
- return false;
-}
-
-/**
- * \brief Convert `IOMX::ComponentInfo` to `IOmx::ComponentInfo`.
- *
- * \param[out] t The destination `IOmx::ComponentInfo`.
- * \param[in] l The source `IOMX::ComponentInfo`.
- */
-// convert: IOMX::ComponentInfo -> IOmx::ComponentInfo
-inline bool convertTo(IOmx::ComponentInfo* t, IOMX::ComponentInfo const& l) {
- t->mName = l.mName.string();
- t->mRoles.resize(l.mRoles.size());
- size_t i = 0;
- for (auto& role : l.mRoles) {
- t->mRoles[i++] = role.string();
- }
- return true;
-}
-
-/**
- * \brief Convert `IOmx::ComponentInfo` to `IOMX::ComponentInfo`.
- *
- * \param[out] l The destination `IOMX::ComponentInfo`.
- * \param[in] t The source `IOmx::ComponentInfo`.
- */
-// convert: IOmx::ComponentInfo -> IOMX::ComponentInfo
-inline bool convertTo(IOMX::ComponentInfo* l, IOmx::ComponentInfo const& t) {
- l->mName = t.mName.c_str();
- l->mRoles.clear();
- for (size_t i = 0; i < t.mRoles.size(); ++i) {
- l->mRoles.push_back(String8(t.mRoles[i].c_str()));
- }
- return true;
-}
-
-/**
- * \brief Convert `OMX_BOOL` to `bool`.
- *
- * \param[in] l The source `OMX_BOOL`.
- * \return The destination `bool`.
- */
-// convert: OMX_BOOL -> bool
-inline bool toRawBool(OMX_BOOL l) {
- return l == OMX_FALSE ? false : true;
-}
-
-/**
- * \brief Convert `bool` to `OMX_BOOL`.
- *
- * \param[in] t The source `bool`.
- * \return The destination `OMX_BOOL`.
- */
-// convert: bool -> OMX_BOOL
-inline OMX_BOOL toEnumBool(bool t) {
- return t ? OMX_TRUE : OMX_FALSE;
-}
-
-/**
- * \brief Convert `OMX_COMMANDTYPE` to `uint32_t`.
- *
- * \param[in] l The source `OMX_COMMANDTYPE`.
- * \return The underlying value of type `uint32_t`.
- *
- * `OMX_COMMANDTYPE` is an enum type whose underlying type is `uint32_t`.
- */
-// convert: OMX_COMMANDTYPE -> uint32_t
-inline uint32_t toRawCommandType(OMX_COMMANDTYPE l) {
- return static_cast<uint32_t>(l);
-}
-
-/**
- * \brief Convert `uint32_t` to `OMX_COMMANDTYPE`.
- *
- * \param[in] t The source `uint32_t`.
- * \return The corresponding enum value of type `OMX_COMMANDTYPE`.
- *
- * `OMX_COMMANDTYPE` is an enum type whose underlying type is `uint32_t`.
- */
-// convert: uint32_t -> OMX_COMMANDTYPE
-inline OMX_COMMANDTYPE toEnumCommandType(uint32_t t) {
- return static_cast<OMX_COMMANDTYPE>(t);
-}
-
-/**
- * \brief Convert `OMX_INDEXTYPE` to `uint32_t`.
- *
- * \param[in] l The source `OMX_INDEXTYPE`.
- * \return The underlying value of type `uint32_t`.
- *
- * `OMX_INDEXTYPE` is an enum type whose underlying type is `uint32_t`.
- */
-// convert: OMX_INDEXTYPE -> uint32_t
-inline uint32_t toRawIndexType(OMX_INDEXTYPE l) {
- return static_cast<uint32_t>(l);
-}
-
-/**
- * \brief Convert `uint32_t` to `OMX_INDEXTYPE`.
- *
- * \param[in] t The source `uint32_t`.
- * \return The corresponding enum value of type `OMX_INDEXTYPE`.
- *
- * `OMX_INDEXTYPE` is an enum type whose underlying type is `uint32_t`.
- */
-// convert: uint32_t -> OMX_INDEXTYPE
-inline OMX_INDEXTYPE toEnumIndexType(uint32_t t) {
- return static_cast<OMX_INDEXTYPE>(t);
-}
-
-/**
- * \brief Convert `IOMX::PortMode` to `PortMode`.
- *
- * \param[in] l The source `IOMX::PortMode`.
- * \return The destination `PortMode`.
- */
-// convert: IOMX::PortMode -> PortMode
-inline PortMode toHardwarePortMode(IOMX::PortMode l) {
- return static_cast<PortMode>(l);
-}
-
-/**
- * \brief Convert `PortMode` to `IOMX::PortMode`.
- *
- * \param[in] t The source `PortMode`.
- * \return The destination `IOMX::PortMode`.
- */
-// convert: PortMode -> IOMX::PortMode
-inline IOMX::PortMode toIOMXPortMode(PortMode t) {
- return static_cast<IOMX::PortMode>(t);
-}
-
-/**
- * \brief Convert `OMX_TICKS` to `uint64_t`.
- *
- * \param[in] l The source `OMX_TICKS`.
- * \return The destination `uint64_t`.
- */
-// convert: OMX_TICKS -> uint64_t
-inline uint64_t toRawTicks(OMX_TICKS l) {
-#ifndef OMX_SKIP64BIT
- return static_cast<uint64_t>(l);
-#else
- return static_cast<uint64_t>(l.nLowPart) |
- static_cast<uint64_t>(l.nHighPart << 32);
-#endif
-}
-
-/**
- * \brief Convert `uint64_t` to `OMX_TICKS`.
- *
- * \param[in] l The source `uint64_t`.
- * \return The destination `OMX_TICKS`.
- */
-// convert: uint64_t -> OMX_TICKS
-inline OMX_TICKS toOMXTicks(uint64_t t) {
-#ifndef OMX_SKIP64BIT
- return static_cast<OMX_TICKS>(t);
-#else
- return OMX_TICKS{
- static_cast<uint32_t>(t & 0xFFFFFFFF),
- static_cast<uint32_t>(t >> 32)};
-#endif
-}
-
-/**
- * Conversion functions for types outside media
- * ============================================
- *
- * Some objects in libui and libgui that were made to go through binder calls do
- * not expose ways to read or write their fields to the public. To pass an
- * object of this kind through the HIDL boundary, translation functions need to
- * work around the access restriction by using the publicly available
- * `flatten()` and `unflatten()` functions.
- *
- * All `flatten()` and `unflatten()` overloads follow the same convention as
- * follows:
- *
- * status_t flatten(ObjectType const& object,
- * [OtherType const& other, ...]
- * void*& buffer, size_t& size,
- * int*& fds, size_t& numFds)
- *
- * status_t unflatten(ObjectType* object,
- * [OtherType* other, ...,]
- * void*& buffer, size_t& size,
- * int*& fds, size_t& numFds)
- *
- * The number of `other` parameters varies depending on the `ObjectType`. For
- * example, in the process of unflattening an object that contains
- * `hidl_handle`, `other` is needed to hold `native_handle_t` objects that will
- * be created.
- *
- * The last four parameters always work the same way in all overloads of
- * `flatten()` and `unflatten()`:
- * - For `flatten()`, `buffer` is the pointer to the non-fd buffer to be filled,
- * `size` is the size (in bytes) of the non-fd buffer pointed to by `buffer`,
- * `fds` is the pointer to the fd buffer to be filled, and `numFds` is the
- * size (in ints) of the fd buffer pointed to by `fds`.
- * - For `unflatten()`, `buffer` is the pointer to the non-fd buffer to be read
- * from, `size` is the size (in bytes) of the non-fd buffer pointed to by
- * `buffer`, `fds` is the pointer to the fd buffer to be read from, and
- * `numFds` is the size (in ints) of the fd buffer pointed to by `fds`.
- * - After a successful call to `flatten()` or `unflatten()`, `buffer` and `fds`
- * will be advanced, while `size` and `numFds` will be decreased to reflect
- * how much storage/data of the two buffers (fd and non-fd) have been used.
- * - After an unsuccessful call, the values of `buffer`, `size`, `fds` and
- * `numFds` are invalid.
- *
- * The return value of a successful `flatten()` or `unflatten()` call will be
- * `OK` (also aliased as `NO_ERROR`). Any other values indicate a failure.
- *
- * For each object type that supports flattening, there will be two accompanying
- * functions: `getFlattenedSize()` and `getFdCount()`. `getFlattenedSize()` will
- * return the size of the non-fd buffer that the object will need for
- * flattening. `getFdCount()` will return the size of the fd buffer that the
- * object will need for flattening.
- *
- * The set of these four functions, `getFlattenedSize()`, `getFdCount()`,
- * `flatten()` and `unflatten()`, are similar to functions of the same name in
- * the abstract class `Flattenable`. The only difference is that functions in
- * this file are not member functions of the object type. For example, we write
- *
- * flatten(x, buffer, size, fds, numFds)
- *
- * instead of
- *
- * x.flatten(buffer, size, fds, numFds)
- *
- * because we cannot modify the type of `x`.
- *
- * There is one exception to the naming convention: `hidl_handle` that
- * represents a fence. The four functions for this "Fence" type have the word
- * "Fence" attched to their names because the object type, which is
- * `hidl_handle`, does not carry the special meaning that the object itself can
- * only contain zero or one file descriptor.
- */
-
-// Ref: frameworks/native/libs/ui/Fence.cpp
-
-/**
- * \brief Return the size of the non-fd buffer required to flatten a fence.
- *
- * \param[in] fence The input fence of type `hidl_handle`.
- * \return The required size of the flat buffer.
- *
- * The current version of this function always returns 4, which is the number of
- * bytes required to store the number of file descriptors contained in the fd
- * part of the flat buffer.
- */
-inline size_t getFenceFlattenedSize(hidl_handle const& /* fence */) {
- return 4;
-};
-
-/**
- * \brief Return the number of file descriptors contained in a fence.
- *
- * \param[in] fence The input fence of type `hidl_handle`.
- * \return `0` if \p fence does not contain a valid file descriptor, or `1`
- * otherwise.
- */
-inline size_t getFenceFdCount(hidl_handle const& fence) {
- return native_handle_read_fd(fence) == -1 ? 0 : 1;
-}
-
-/**
- * \brief Unflatten `Fence` to `hidl_handle`.
- *
- * \param[out] fence The destination `hidl_handle`.
- * \param[out] nh The underlying native handle.
- * \param[in,out] buffer The pointer to the flat non-fd buffer.
- * \param[in,out] size The size of the flat non-fd buffer.
- * \param[in,out] fds The pointer to the flat fd buffer.
- * \param[in,out] numFds The size of the flat fd buffer.
- * \return `NO_ERROR` on success; other value on failure.
- *
- * If the return value is `NO_ERROR`, \p nh will point to a newly created
- * native handle, which needs to be deleted with `native_handle_delete()`
- * afterwards.
- */
-inline status_t unflattenFence(hidl_handle* fence, native_handle_t** nh,
- void const*& buffer, size_t& size, int const*& fds, size_t& numFds) {
- if (size < 4) {
- return NO_MEMORY;
- }
-
- uint32_t numFdsInHandle;
- FlattenableUtils::read(buffer, size, numFdsInHandle);
-
- if (numFdsInHandle > 1) {
- return BAD_VALUE;
- }
-
- if (numFds < numFdsInHandle) {
- return NO_MEMORY;
- }
-
- if (numFdsInHandle) {
- *nh = native_handle_create_from_fd(*fds);
- if (*nh == nullptr) {
- return NO_MEMORY;
- }
- *fence = *nh;
- ++fds;
- --numFds;
- } else {
- *nh = nullptr;
- *fence = hidl_handle();
- }
-
- return NO_ERROR;
-}
-
-/**
- * \brief Flatten `hidl_handle` as `Fence`.
- *
- * \param[in] t The source `hidl_handle`.
- * \param[in,out] buffer The pointer to the flat non-fd buffer.
- * \param[in,out] size The size of the flat non-fd buffer.
- * \param[in,out] fds The pointer to the flat fd buffer.
- * \param[in,out] numFds The size of the flat fd buffer.
- * \return `NO_ERROR` on success; other value on failure.
- */
-inline status_t flattenFence(hidl_handle const& fence,
- void*& buffer, size_t& size, int*& fds, size_t& numFds) {
- if (size < getFenceFlattenedSize(fence) ||
- numFds < getFenceFdCount(fence)) {
- return NO_MEMORY;
- }
- // Cast to uint32_t since the size of a size_t can vary between 32- and
- // 64-bit processes
- FlattenableUtils::write(buffer, size,
- static_cast<uint32_t>(getFenceFdCount(fence)));
- int fd = native_handle_read_fd(fence);
- if (fd != -1) {
- *fds = fd;
- ++fds;
- --numFds;
- }
- return NO_ERROR;
-}
-
-/**
- * \brief Wrap `Fence` in `hidl_handle`.
- *
- * \param[out] t The wrapper of type `hidl_handle`.
- * \param[out] nh The native handle pointed to by \p t.
- * \param[in] l The source `Fence`.
- *
- * On success, \p nh will hold a newly created native handle, which must be
- * deleted manually with `native_handle_delete()` afterwards.
- */
-// wrap: Fence -> hidl_handle
-inline bool wrapAs(hidl_handle* t, native_handle_t** nh, Fence const& l) {
- size_t const baseSize = l.getFlattenedSize();
- std::unique_ptr<uint8_t[]> baseBuffer(
- new (std::nothrow) uint8_t[baseSize]);
- if (!baseBuffer) {
- return false;
- }
-
- size_t const baseNumFds = l.getFdCount();
- std::unique_ptr<int[]> baseFds(
- new (std::nothrow) int[baseNumFds]);
- if (!baseFds) {
- return false;
- }
-
- void* buffer = static_cast<void*>(baseBuffer.get());
- size_t size = baseSize;
- int* fds = static_cast<int*>(baseFds.get());
- size_t numFds = baseNumFds;
- if (l.flatten(buffer, size, fds, numFds) != NO_ERROR) {
- return false;
- }
-
- void const* constBuffer = static_cast<void const*>(baseBuffer.get());
- size = baseSize;
- int const* constFds = static_cast<int const*>(baseFds.get());
- numFds = baseNumFds;
- if (unflattenFence(t, nh, constBuffer, size, constFds, numFds)
- != NO_ERROR) {
- return false;
- }
-
- return true;
-}
-
-/**
- * \brief Convert `hidl_handle` to `Fence`.
- *
- * \param[out] l The destination `Fence`. `l` must not have been used
- * (`l->isValid()` must return `false`) before this function is called.
- * \param[in] t The source `hidl_handle`.
- *
- * If \p t contains a valid file descriptor, it will be duplicated.
- */
-// convert: hidl_handle -> Fence
-inline bool convertTo(Fence* l, hidl_handle const& t) {
- int fd = native_handle_read_fd(t);
- if (fd != -1) {
- fd = dup(fd);
- if (fd == -1) {
- return false;
- }
- }
- native_handle_t* nh = native_handle_create_from_fd(fd);
- if (nh == nullptr) {
- if (fd != -1) {
- close(fd);
- }
- return false;
- }
-
- size_t const baseSize = getFenceFlattenedSize(t);
- std::unique_ptr<uint8_t[]> baseBuffer(
- new (std::nothrow) uint8_t[baseSize]);
- if (!baseBuffer) {
- native_handle_delete(nh);
- return false;
- }
-
- size_t const baseNumFds = getFenceFdCount(t);
- std::unique_ptr<int[]> baseFds(
- new (std::nothrow) int[baseNumFds]);
- if (!baseFds) {
- native_handle_delete(nh);
- return false;
- }
-
- void* buffer = static_cast<void*>(baseBuffer.get());
- size_t size = baseSize;
- int* fds = static_cast<int*>(baseFds.get());
- size_t numFds = baseNumFds;
- if (flattenFence(hidl_handle(nh), buffer, size, fds, numFds) != NO_ERROR) {
- native_handle_delete(nh);
- return false;
- }
- native_handle_delete(nh);
-
- void const* constBuffer = static_cast<void const*>(baseBuffer.get());
- size = baseSize;
- int const* constFds = static_cast<int const*>(baseFds.get());
- numFds = baseNumFds;
- if (l->unflatten(constBuffer, size, constFds, numFds) != NO_ERROR) {
- return false;
- }
-
- return true;
-}
-
-// Ref: frameworks/native/libs/ui/FenceTime.cpp: FenceTime::Snapshot
-
-/**
- * \brief Return the size of the non-fd buffer required to flatten
- * `FenceTimeSnapshot`.
- *
- * \param[in] t The input `FenceTimeSnapshot`.
- * \return The required size of the flat buffer.
- */
-inline size_t getFlattenedSize(
- HGraphicBufferProducer::FenceTimeSnapshot const& t) {
- constexpr size_t min = sizeof(t.state);
- switch (t.state) {
- case HGraphicBufferProducer::FenceTimeSnapshot::State::EMPTY:
- return min;
- case HGraphicBufferProducer::FenceTimeSnapshot::State::FENCE:
- return min + getFenceFlattenedSize(t.fence);
- case HGraphicBufferProducer::FenceTimeSnapshot::State::SIGNAL_TIME:
- return min + sizeof(
- ::android::FenceTime::Snapshot::signalTime);
- }
- return 0;
-}
-
-/**
- * \brief Return the number of file descriptors contained in
- * `FenceTimeSnapshot`.
- *
- * \param[in] t The input `FenceTimeSnapshot`.
- * \return The number of file descriptors contained in \p snapshot.
- */
-inline size_t getFdCount(
- HGraphicBufferProducer::FenceTimeSnapshot const& t) {
- return t.state ==
- HGraphicBufferProducer::FenceTimeSnapshot::State::FENCE ?
- getFenceFdCount(t.fence) : 0;
-}
-
-/**
- * \brief Flatten `FenceTimeSnapshot`.
- *
- * \param[in] t The source `FenceTimeSnapshot`.
- * \param[in,out] buffer The pointer to the flat non-fd buffer.
- * \param[in,out] size The size of the flat non-fd buffer.
- * \param[in,out] fds The pointer to the flat fd buffer.
- * \param[in,out] numFds The size of the flat fd buffer.
- * \return `NO_ERROR` on success; other value on failure.
- *
- * This function will duplicate the file descriptor in `t.fence` if `t.state ==
- * FENCE`.
- */
-inline status_t flatten(HGraphicBufferProducer::FenceTimeSnapshot const& t,
- void*& buffer, size_t& size, int*& fds, size_t& numFds) {
- if (size < getFlattenedSize(t)) {
- return NO_MEMORY;
- }
-
- switch (t.state) {
- case HGraphicBufferProducer::FenceTimeSnapshot::State::EMPTY:
- FlattenableUtils::write(buffer, size,
- ::android::FenceTime::Snapshot::State::EMPTY);
- return NO_ERROR;
- case HGraphicBufferProducer::FenceTimeSnapshot::State::FENCE:
- FlattenableUtils::write(buffer, size,
- ::android::FenceTime::Snapshot::State::FENCE);
- return flattenFence(t.fence, buffer, size, fds, numFds);
- case HGraphicBufferProducer::FenceTimeSnapshot::State::SIGNAL_TIME:
- FlattenableUtils::write(buffer, size,
- ::android::FenceTime::Snapshot::State::SIGNAL_TIME);
- FlattenableUtils::write(buffer, size, t.signalTimeNs);
- return NO_ERROR;
- }
- return NO_ERROR;
-}
-
-/**
- * \brief Unflatten `FenceTimeSnapshot`.
- *
- * \param[out] t The destination `FenceTimeSnapshot`.
- * \param[out] nh The underlying native handle.
- * \param[in,out] buffer The pointer to the flat non-fd buffer.
- * \param[in,out] size The size of the flat non-fd buffer.
- * \param[in,out] fds The pointer to the flat fd buffer.
- * \param[in,out] numFds The size of the flat fd buffer.
- * \return `NO_ERROR` on success; other value on failure.
- *
- * If the return value is `NO_ERROR` and the constructed snapshot contains a
- * file descriptor, \p nh will be created to hold that file descriptor. In this
- * case, \p nh needs to be deleted with `native_handle_delete()` afterwards.
- */
-inline status_t unflatten(
- HGraphicBufferProducer::FenceTimeSnapshot* t, native_handle_t** nh,
- void const*& buffer, size_t& size, int const*& fds, size_t& numFds) {
- if (size < sizeof(t->state)) {
- return NO_MEMORY;
- }
-
- *nh = nullptr;
- ::android::FenceTime::Snapshot::State state;
- FlattenableUtils::read(buffer, size, state);
- switch (state) {
- case ::android::FenceTime::Snapshot::State::EMPTY:
- t->state = HGraphicBufferProducer::FenceTimeSnapshot::State::EMPTY;
- return NO_ERROR;
- case ::android::FenceTime::Snapshot::State::FENCE:
- t->state = HGraphicBufferProducer::FenceTimeSnapshot::State::FENCE;
- return unflattenFence(&t->fence, nh, buffer, size, fds, numFds);
- case ::android::FenceTime::Snapshot::State::SIGNAL_TIME:
- t->state = HGraphicBufferProducer::FenceTimeSnapshot::State::SIGNAL_TIME;
- if (size < sizeof(t->signalTimeNs)) {
- return NO_MEMORY;
- }
- FlattenableUtils::read(buffer, size, t->signalTimeNs);
- return NO_ERROR;
- }
- return NO_ERROR;
-}
-
-// Ref: frameworks/native/libs/gui/FrameTimestamps.cpp: FrameEventsDelta
-
-/**
- * \brief Return a lower bound on the size of the non-fd buffer required to
- * flatten `FrameEventsDelta`.
- *
- * \param[in] t The input `FrameEventsDelta`.
- * \return A lower bound on the size of the flat buffer.
- */
-constexpr size_t minFlattenedSize(
- HGraphicBufferProducer::FrameEventsDelta const& /* t */) {
- return sizeof(uint64_t) + // mFrameNumber
- sizeof(uint8_t) + // mIndex
- sizeof(uint8_t) + // mAddPostCompositeCalled
- sizeof(uint8_t) + // mAddRetireCalled
- sizeof(uint8_t) + // mAddReleaseCalled
- sizeof(nsecs_t) + // mPostedTime
- sizeof(nsecs_t) + // mRequestedPresentTime
- sizeof(nsecs_t) + // mLatchTime
- sizeof(nsecs_t) + // mFirstRefreshStartTime
- sizeof(nsecs_t); // mLastRefreshStartTime
-}
-
-/**
- * \brief Return the size of the non-fd buffer required to flatten
- * `FrameEventsDelta`.
- *
- * \param[in] t The input `FrameEventsDelta`.
- * \return The required size of the flat buffer.
- */
-inline size_t getFlattenedSize(
- HGraphicBufferProducer::FrameEventsDelta const& t) {
- return minFlattenedSize(t) +
- getFlattenedSize(t.gpuCompositionDoneFence) +
- getFlattenedSize(t.displayPresentFence) +
- getFlattenedSize(t.displayRetireFence) +
- getFlattenedSize(t.releaseFence);
-};
-
-/**
- * \brief Return the number of file descriptors contained in
- * `FrameEventsDelta`.
- *
- * \param[in] t The input `FrameEventsDelta`.
- * \return The number of file descriptors contained in \p t.
- */
-inline size_t getFdCount(
- HGraphicBufferProducer::FrameEventsDelta const& t) {
- return getFdCount(t.gpuCompositionDoneFence) +
- getFdCount(t.displayPresentFence) +
- getFdCount(t.displayRetireFence) +
- getFdCount(t.releaseFence);
-};
-
-/**
- * \brief Unflatten `FrameEventsDelta`.
- *
- * \param[out] t The destination `FrameEventsDelta`.
- * \param[out] nh The underlying array of native handles.
- * \param[in,out] buffer The pointer to the flat non-fd buffer.
- * \param[in,out] size The size of the flat non-fd buffer.
- * \param[in,out] fds The pointer to the flat fd buffer.
- * \param[in,out] numFds The size of the flat fd buffer.
- * \return `NO_ERROR` on success; other value on failure.
- *
- * If the return value is `NO_ERROR`, \p nh will have length 4, and it will be
- * populated with `nullptr` or newly created handles. Each non-null slot in \p
- * nh will need to be deleted manually with `native_handle_delete()`.
- */
-inline status_t unflatten(HGraphicBufferProducer::FrameEventsDelta* t,
- std::vector<native_handle_t*>* nh,
- void const*& buffer, size_t& size, int const*& fds, size_t& numFds) {
- if (size < minFlattenedSize(*t)) {
- return NO_MEMORY;
- }
- FlattenableUtils::read(buffer, size, t->frameNumber);
-
- // These were written as uint8_t for alignment.
- uint8_t temp = 0;
- FlattenableUtils::read(buffer, size, temp);
- size_t index = static_cast<size_t>(temp);
- if (index >= ::android::FrameEventHistory::MAX_FRAME_HISTORY) {
- return BAD_VALUE;
- }
- t->index = static_cast<uint32_t>(index);
-
- FlattenableUtils::read(buffer, size, temp);
- t->addPostCompositeCalled = static_cast<bool>(temp);
- FlattenableUtils::read(buffer, size, temp);
- t->addRetireCalled = static_cast<bool>(temp);
- FlattenableUtils::read(buffer, size, temp);
- t->addReleaseCalled = static_cast<bool>(temp);
-
- FlattenableUtils::read(buffer, size, t->postedTimeNs);
- FlattenableUtils::read(buffer, size, t->requestedPresentTimeNs);
- FlattenableUtils::read(buffer, size, t->latchTimeNs);
- FlattenableUtils::read(buffer, size, t->firstRefreshStartTimeNs);
- FlattenableUtils::read(buffer, size, t->lastRefreshStartTimeNs);
- FlattenableUtils::read(buffer, size, t->dequeueReadyTime);
-
- // Fences
- HGraphicBufferProducer::FenceTimeSnapshot* tSnapshot[4];
- tSnapshot[0] = &t->gpuCompositionDoneFence;
- tSnapshot[1] = &t->displayPresentFence;
- tSnapshot[2] = &t->displayRetireFence;
- tSnapshot[3] = &t->releaseFence;
- nh->resize(4);
- for (size_t snapshotIndex = 0; snapshotIndex < 4; ++snapshotIndex) {
- status_t status = unflatten(
- tSnapshot[snapshotIndex], &((*nh)[snapshotIndex]),
- buffer, size, fds, numFds);
- if (status != NO_ERROR) {
- while (snapshotIndex > 0) {
- --snapshotIndex;
- if ((*nh)[snapshotIndex] != nullptr) {
- native_handle_delete((*nh)[snapshotIndex]);
- }
- }
- return status;
- }
- }
- return NO_ERROR;
-}
-
-/**
- * \brief Flatten `FrameEventsDelta`.
- *
- * \param[in] t The source `FrameEventsDelta`.
- * \param[in,out] buffer The pointer to the flat non-fd buffer.
- * \param[in,out] size The size of the flat non-fd buffer.
- * \param[in,out] fds The pointer to the flat fd buffer.
- * \param[in,out] numFds The size of the flat fd buffer.
- * \return `NO_ERROR` on success; other value on failure.
- *
- * This function will duplicate file descriptors contained in \p t.
- */
-// Ref: frameworks/native/libs/gui/FrameTimestamp.cpp:
-// FrameEventsDelta::flatten
-inline status_t flatten(HGraphicBufferProducer::FrameEventsDelta const& t,
- void*& buffer, size_t& size, int*& fds, size_t numFds) {
- // Check that t.index is within a valid range.
- if (t.index >= static_cast<uint32_t>(FrameEventHistory::MAX_FRAME_HISTORY)
- || t.index > std::numeric_limits<uint8_t>::max()) {
- return BAD_VALUE;
- }
-
- FlattenableUtils::write(buffer, size, t.frameNumber);
-
- // These are static_cast to uint8_t for alignment.
- FlattenableUtils::write(buffer, size, static_cast<uint8_t>(t.index));
- FlattenableUtils::write(
- buffer, size, static_cast<uint8_t>(t.addPostCompositeCalled));
- FlattenableUtils::write(
- buffer, size, static_cast<uint8_t>(t.addRetireCalled));
- FlattenableUtils::write(
- buffer, size, static_cast<uint8_t>(t.addReleaseCalled));
-
- FlattenableUtils::write(buffer, size, t.postedTimeNs);
- FlattenableUtils::write(buffer, size, t.requestedPresentTimeNs);
- FlattenableUtils::write(buffer, size, t.latchTimeNs);
- FlattenableUtils::write(buffer, size, t.firstRefreshStartTimeNs);
- FlattenableUtils::write(buffer, size, t.lastRefreshStartTimeNs);
- FlattenableUtils::write(buffer, size, t.dequeueReadyTime);
-
- // Fences
- HGraphicBufferProducer::FenceTimeSnapshot const* tSnapshot[4];
- tSnapshot[0] = &t.gpuCompositionDoneFence;
- tSnapshot[1] = &t.displayPresentFence;
- tSnapshot[2] = &t.displayRetireFence;
- tSnapshot[3] = &t.releaseFence;
- for (size_t snapshotIndex = 0; snapshotIndex < 4; ++snapshotIndex) {
- status_t status = flatten(
- *(tSnapshot[snapshotIndex]), buffer, size, fds, numFds);
- if (status != NO_ERROR) {
- return status;
- }
- }
- return NO_ERROR;
-}
-
-// Ref: frameworks/native/libs/gui/FrameTimestamps.cpp: FrameEventHistoryDelta
-
-/**
- * \brief Return the size of the non-fd buffer required to flatten
- * `HGraphicBufferProducer::FrameEventHistoryDelta`.
- *
- * \param[in] t The input `HGraphicBufferProducer::FrameEventHistoryDelta`.
- * \return The required size of the flat buffer.
- */
-inline size_t getFlattenedSize(
- HGraphicBufferProducer::FrameEventHistoryDelta const& t) {
- size_t size = 4 + // mDeltas.size()
- sizeof(t.compositorTiming);
- for (size_t i = 0; i < t.deltas.size(); ++i) {
- size += getFlattenedSize(t.deltas[i]);
- }
- return size;
-}
-
-/**
- * \brief Return the number of file descriptors contained in
- * `HGraphicBufferProducer::FrameEventHistoryDelta`.
- *
- * \param[in] t The input `HGraphicBufferProducer::FrameEventHistoryDelta`.
- * \return The number of file descriptors contained in \p t.
- */
-inline size_t getFdCount(
- HGraphicBufferProducer::FrameEventHistoryDelta const& t) {
- size_t numFds = 0;
- for (size_t i = 0; i < t.deltas.size(); ++i) {
- numFds += getFdCount(t.deltas[i]);
- }
- return numFds;
-}
-
-/**
- * \brief Unflatten `FrameEventHistoryDelta`.
- *
- * \param[out] t The destination `FrameEventHistoryDelta`.
- * \param[out] nh The underlying array of arrays of native handles.
- * \param[in,out] buffer The pointer to the flat non-fd buffer.
- * \param[in,out] size The size of the flat non-fd buffer.
- * \param[in,out] fds The pointer to the flat fd buffer.
- * \param[in,out] numFds The size of the flat fd buffer.
- * \return `NO_ERROR` on success; other value on failure.
- *
- * If the return value is `NO_ERROR`, \p nh will be populated with `nullptr` or
- * newly created handles. The second dimension of \p nh will be 4. Each non-null
- * slot in \p nh will need to be deleted manually with `native_handle_delete()`.
- */
-inline status_t unflatten(
- HGraphicBufferProducer::FrameEventHistoryDelta* t,
- std::vector<std::vector<native_handle_t*> >* nh,
- void const*& buffer, size_t& size, int const*& fds, size_t& numFds) {
- if (size < 4) {
- return NO_MEMORY;
- }
-
- FlattenableUtils::read(buffer, size, t->compositorTiming);
-
- uint32_t deltaCount = 0;
- FlattenableUtils::read(buffer, size, deltaCount);
- if (static_cast<size_t>(deltaCount) >
- ::android::FrameEventHistory::MAX_FRAME_HISTORY) {
- return BAD_VALUE;
- }
- t->deltas.resize(deltaCount);
- nh->resize(deltaCount);
- for (size_t deltaIndex = 0; deltaIndex < deltaCount; ++deltaIndex) {
- status_t status = unflatten(
- &(t->deltas[deltaIndex]), &((*nh)[deltaIndex]),
- buffer, size, fds, numFds);
- if (status != NO_ERROR) {
- return status;
- }
- }
- return NO_ERROR;
-}
-
-/**
- * \brief Flatten `FrameEventHistoryDelta`.
- *
- * \param[in] t The source `FrameEventHistoryDelta`.
- * \param[in,out] buffer The pointer to the flat non-fd buffer.
- * \param[in,out] size The size of the flat non-fd buffer.
- * \param[in,out] fds The pointer to the flat fd buffer.
- * \param[in,out] numFds The size of the flat fd buffer.
- * \return `NO_ERROR` on success; other value on failure.
- *
- * This function will duplicate file descriptors contained in \p t.
- */
-inline status_t flatten(
- HGraphicBufferProducer::FrameEventHistoryDelta const& t,
- void*& buffer, size_t& size, int*& fds, size_t& numFds) {
- if (t.deltas.size() > ::android::FrameEventHistory::MAX_FRAME_HISTORY) {
- return BAD_VALUE;
- }
- if (size < getFlattenedSize(t)) {
- return NO_MEMORY;
- }
-
- FlattenableUtils::write(buffer, size, t.compositorTiming);
-
- FlattenableUtils::write(buffer, size, static_cast<uint32_t>(t.deltas.size()));
- for (size_t deltaIndex = 0; deltaIndex < t.deltas.size(); ++deltaIndex) {
- status_t status = flatten(t.deltas[deltaIndex], buffer, size, fds, numFds);
- if (status != NO_ERROR) {
- return status;
- }
- }
- return NO_ERROR;
-}
-
-/**
- * \brief Wrap `::android::FrameEventHistoryData` in
- * `HGraphicBufferProducer::FrameEventHistoryDelta`.
- *
- * \param[out] t The wrapper of type
- * `HGraphicBufferProducer::FrameEventHistoryDelta`.
- * \param[out] nh The array of array of native handles that are referred to by
- * members of \p t.
- * \param[in] l The source `::android::FrameEventHistoryDelta`.
- *
- * On success, each member of \p nh will be either `nullptr` or a newly created
- * native handle. All the non-`nullptr` elements must be deleted individually
- * with `native_handle_delete()`.
- */
-inline bool wrapAs(HGraphicBufferProducer::FrameEventHistoryDelta* t,
- std::vector<std::vector<native_handle_t*> >* nh,
- ::android::FrameEventHistoryDelta const& l) {
-
- size_t const baseSize = l.getFlattenedSize();
- std::unique_ptr<uint8_t[]> baseBuffer(
- new (std::nothrow) uint8_t[baseSize]);
- if (!baseBuffer) {
- return false;
- }
-
- size_t const baseNumFds = l.getFdCount();
- std::unique_ptr<int[]> baseFds(
- new (std::nothrow) int[baseNumFds]);
- if (!baseFds) {
- return false;
- }
-
- void* buffer = static_cast<void*>(baseBuffer.get());
- size_t size = baseSize;
- int* fds = baseFds.get();
- size_t numFds = baseNumFds;
- if (l.flatten(buffer, size, fds, numFds) != NO_ERROR) {
- return false;
- }
-
- void const* constBuffer = static_cast<void const*>(baseBuffer.get());
- size = baseSize;
- int const* constFds = static_cast<int const*>(baseFds.get());
- numFds = baseNumFds;
- if (unflatten(t, nh, constBuffer, size, constFds, numFds) != NO_ERROR) {
- return false;
- }
-
- return true;
-}
-
-/**
- * \brief Convert `HGraphicBufferProducer::FrameEventHistoryDelta` to
- * `::android::FrameEventHistoryDelta`.
- *
- * \param[out] l The destination `::android::FrameEventHistoryDelta`.
- * \param[in] t The source `HGraphicBufferProducer::FrameEventHistoryDelta`.
- *
- * This function will duplicate all file descriptors contained in \p t.
- */
-inline bool convertTo(
- ::android::FrameEventHistoryDelta* l,
- HGraphicBufferProducer::FrameEventHistoryDelta const& t) {
-
- size_t const baseSize = getFlattenedSize(t);
- std::unique_ptr<uint8_t[]> baseBuffer(
- new (std::nothrow) uint8_t[baseSize]);
- if (!baseBuffer) {
- return false;
- }
-
- size_t const baseNumFds = getFdCount(t);
- std::unique_ptr<int[]> baseFds(
- new (std::nothrow) int[baseNumFds]);
- if (!baseFds) {
- return false;
- }
-
- void* buffer = static_cast<void*>(baseBuffer.get());
- size_t size = baseSize;
- int* fds = static_cast<int*>(baseFds.get());
- size_t numFds = baseNumFds;
- if (flatten(t, buffer, size, fds, numFds) != NO_ERROR) {
- return false;
- }
-
- void const* constBuffer = static_cast<void const*>(baseBuffer.get());
- size = baseSize;
- int const* constFds = static_cast<int const*>(baseFds.get());
- numFds = baseNumFds;
- if (l->unflatten(constBuffer, size, constFds, numFds) != NO_ERROR) {
- return false;
- }
-
- return true;
-}
-
-// Ref: frameworks/native/libs/ui/Region.cpp
-
-/**
- * \brief Return the size of the buffer required to flatten `Region`.
- *
- * \param[in] t The input `Region`.
- * \return The required size of the flat buffer.
- */
-inline size_t getFlattenedSize(Region const& t) {
- return sizeof(uint32_t) + t.size() * sizeof(::android::Rect);
-}
-
-/**
- * \brief Unflatten `Region`.
- *
- * \param[out] t The destination `Region`.
- * \param[in,out] buffer The pointer to the flat buffer.
- * \param[in,out] size The size of the flat buffer.
- * \return `NO_ERROR` on success; other value on failure.
- */
-inline status_t unflatten(Region* t, void const*& buffer, size_t& size) {
- if (size < sizeof(uint32_t)) {
- return NO_MEMORY;
- }
-
- uint32_t numRects = 0;
- FlattenableUtils::read(buffer, size, numRects);
- if (size < numRects * sizeof(Rect)) {
- return NO_MEMORY;
- }
- if (numRects > (UINT32_MAX / sizeof(Rect))) {
- return NO_MEMORY;
- }
-
- t->resize(numRects);
- for (size_t r = 0; r < numRects; ++r) {
- ::android::Rect rect(::android::Rect::EMPTY_RECT);
- status_t status = rect.unflatten(buffer, size);
- if (status != NO_ERROR) {
- return status;
- }
- FlattenableUtils::advance(buffer, size, sizeof(rect));
- (*t)[r] = Rect{
- static_cast<int32_t>(rect.left),
- static_cast<int32_t>(rect.top),
- static_cast<int32_t>(rect.right),
- static_cast<int32_t>(rect.bottom)};
- }
- return NO_ERROR;
-}
-
-/**
- * \brief Flatten `Region`.
- *
- * \param[in] t The source `Region`.
- * \param[in,out] buffer The pointer to the flat buffer.
- * \param[in,out] size The size of the flat buffer.
- * \return `NO_ERROR` on success; other value on failure.
- */
-inline status_t flatten(Region const& t, void*& buffer, size_t& size) {
- if (size < getFlattenedSize(t)) {
- return NO_MEMORY;
- }
-
- FlattenableUtils::write(buffer, size, static_cast<uint32_t>(t.size()));
- for (size_t r = 0; r < t.size(); ++r) {
- ::android::Rect rect(
- static_cast<int32_t>(t[r].left),
- static_cast<int32_t>(t[r].top),
- static_cast<int32_t>(t[r].right),
- static_cast<int32_t>(t[r].bottom));
- status_t status = rect.flatten(buffer, size);
- if (status != NO_ERROR) {
- return status;
- }
- FlattenableUtils::advance(buffer, size, sizeof(rect));
- }
- return NO_ERROR;
-}
-
-/**
- * \brief Convert `::android::Region` to `Region`.
- *
- * \param[out] t The destination `Region`.
- * \param[in] l The source `::android::Region`.
- */
-// convert: ::android::Region -> Region
-inline bool convertTo(Region* t, ::android::Region const& l) {
- size_t const baseSize = l.getFlattenedSize();
- std::unique_ptr<uint8_t[]> baseBuffer(
- new (std::nothrow) uint8_t[baseSize]);
- if (!baseBuffer) {
- return false;
- }
-
- void* buffer = static_cast<void*>(baseBuffer.get());
- size_t size = baseSize;
- if (l.flatten(buffer, size) != NO_ERROR) {
- return false;
- }
-
- void const* constBuffer = static_cast<void const*>(baseBuffer.get());
- size = baseSize;
- if (unflatten(t, constBuffer, size) != NO_ERROR) {
- return false;
- }
-
- return true;
-}
-
-/**
- * \brief Convert `Region` to `::android::Region`.
- *
- * \param[out] l The destination `::android::Region`.
- * \param[in] t The source `Region`.
- */
-// convert: Region -> ::android::Region
-inline bool convertTo(::android::Region* l, Region const& t) {
- size_t const baseSize = getFlattenedSize(t);
- std::unique_ptr<uint8_t[]> baseBuffer(
- new (std::nothrow) uint8_t[baseSize]);
- if (!baseBuffer) {
- return false;
- }
-
- void* buffer = static_cast<void*>(baseBuffer.get());
- size_t size = baseSize;
- if (flatten(t, buffer, size) != NO_ERROR) {
- return false;
- }
-
- void const* constBuffer = static_cast<void const*>(baseBuffer.get());
- size = baseSize;
- if (l->unflatten(constBuffer, size) != NO_ERROR) {
- return false;
- }
-
- return true;
-}
-
-// Ref: frameworks/native/libs/gui/BGraphicBufferProducer.cpp:
-// BGraphicBufferProducer::QueueBufferInput
-
-/**
- * \brief Return a lower bound on the size of the buffer required to flatten
- * `HGraphicBufferProducer::QueueBufferInput`.
- *
- * \param[in] t The input `HGraphicBufferProducer::QueueBufferInput`.
- * \return A lower bound on the size of the flat buffer.
- */
-constexpr size_t minFlattenedSize(
- HGraphicBufferProducer::QueueBufferInput const& /* t */) {
- return sizeof(int64_t) + // timestamp
- sizeof(int) + // isAutoTimestamp
- sizeof(android_dataspace) + // dataSpace
- sizeof(::android::Rect) + // crop
- sizeof(int) + // scalingMode
- sizeof(uint32_t) + // transform
- sizeof(uint32_t) + // stickyTransform
- sizeof(bool); // getFrameTimestamps
-}
-
-/**
- * \brief Return the size of the buffer required to flatten
- * `HGraphicBufferProducer::QueueBufferInput`.
- *
- * \param[in] t The input `HGraphicBufferProducer::QueueBufferInput`.
- * \return The required size of the flat buffer.
- */
-inline size_t getFlattenedSize(HGraphicBufferProducer::QueueBufferInput const& t) {
- return minFlattenedSize(t) +
- getFenceFlattenedSize(t.fence) +
- getFlattenedSize(t.surfaceDamage);
-}
-
-/**
- * \brief Return the number of file descriptors contained in
- * `HGraphicBufferProducer::QueueBufferInput`.
- *
- * \param[in] t The input `HGraphicBufferProducer::QueueBufferInput`.
- * \return The number of file descriptors contained in \p t.
- */
-inline size_t getFdCount(
- HGraphicBufferProducer::QueueBufferInput const& t) {
- return getFenceFdCount(t.fence);
-}
-
-/**
- * \brief Flatten `HGraphicBufferProducer::QueueBufferInput`.
- *
- * \param[in] t The source `HGraphicBufferProducer::QueueBufferInput`.
- * \param[out] nh The native handle cloned from `t.fence`.
- * \param[in,out] buffer The pointer to the flat non-fd buffer.
- * \param[in,out] size The size of the flat non-fd buffer.
- * \param[in,out] fds The pointer to the flat fd buffer.
- * \param[in,out] numFds The size of the flat fd buffer.
- * \return `NO_ERROR` on success; other value on failure.
- *
- * This function will duplicate the file descriptor in `t.fence`. */
-inline status_t flatten(HGraphicBufferProducer::QueueBufferInput const& t,
- native_handle_t** nh,
- void*& buffer, size_t& size, int*& fds, size_t& numFds) {
- if (size < getFlattenedSize(t)) {
- return NO_MEMORY;
- }
-
- FlattenableUtils::write(buffer, size, t.timestamp);
- FlattenableUtils::write(buffer, size, static_cast<int>(t.isAutoTimestamp));
- FlattenableUtils::write(buffer, size,
- static_cast<android_dataspace_t>(t.dataSpace));
- FlattenableUtils::write(buffer, size, ::android::Rect(
- static_cast<int32_t>(t.crop.left),
- static_cast<int32_t>(t.crop.top),
- static_cast<int32_t>(t.crop.right),
- static_cast<int32_t>(t.crop.bottom)));
- FlattenableUtils::write(buffer, size, static_cast<int>(t.scalingMode));
- FlattenableUtils::write(buffer, size, t.transform);
- FlattenableUtils::write(buffer, size, t.stickyTransform);
- FlattenableUtils::write(buffer, size, t.getFrameTimestamps);
-
- *nh = t.fence.getNativeHandle() == nullptr ?
- nullptr : native_handle_clone(t.fence);
- status_t status = flattenFence(hidl_handle(*nh), buffer, size, fds, numFds);
- if (status != NO_ERROR) {
- return status;
- }
- return flatten(t.surfaceDamage, buffer, size);
-}
-
-/**
- * \brief Unflatten `HGraphicBufferProducer::QueueBufferInput`.
- *
- * \param[out] t The destination `HGraphicBufferProducer::QueueBufferInput`.
- * \param[out] nh The underlying native handle for `t->fence`.
- * \param[in,out] buffer The pointer to the flat non-fd buffer.
- * \param[in,out] size The size of the flat non-fd buffer.
- * \param[in,out] fds The pointer to the flat fd buffer.
- * \param[in,out] numFds The size of the flat fd buffer.
- * \return `NO_ERROR` on success; other value on failure.
- *
- * If the return value is `NO_ERROR` and `t->fence` contains a valid file
- * descriptor, \p nh will be a newly created native handle holding that file
- * descriptor. \p nh needs to be deleted with `native_handle_delete()`
- * afterwards.
- */
-inline status_t unflatten(
- HGraphicBufferProducer::QueueBufferInput* t, native_handle_t** nh,
- void const*& buffer, size_t& size, int const*& fds, size_t& numFds) {
- if (size < minFlattenedSize(*t)) {
- return NO_MEMORY;
- }
-
- FlattenableUtils::read(buffer, size, t->timestamp);
- int lIsAutoTimestamp;
- FlattenableUtils::read(buffer, size, lIsAutoTimestamp);
- t->isAutoTimestamp = static_cast<int32_t>(lIsAutoTimestamp);
- android_dataspace_t lDataSpace;
- FlattenableUtils::read(buffer, size, lDataSpace);
- t->dataSpace = static_cast<Dataspace>(lDataSpace);
- Rect lCrop;
- FlattenableUtils::read(buffer, size, lCrop);
- t->crop = Rect{
- static_cast<int32_t>(lCrop.left),
- static_cast<int32_t>(lCrop.top),
- static_cast<int32_t>(lCrop.right),
- static_cast<int32_t>(lCrop.bottom)};
- int lScalingMode;
- FlattenableUtils::read(buffer, size, lScalingMode);
- t->scalingMode = static_cast<int32_t>(lScalingMode);
- FlattenableUtils::read(buffer, size, t->transform);
- FlattenableUtils::read(buffer, size, t->stickyTransform);
- FlattenableUtils::read(buffer, size, t->getFrameTimestamps);
-
- status_t status = unflattenFence(&(t->fence), nh,
- buffer, size, fds, numFds);
- if (status != NO_ERROR) {
- return status;
- }
- return unflatten(&(t->surfaceDamage), buffer, size);
-}
-
-/**
- * \brief Wrap `BGraphicBufferProducer::QueueBufferInput` in
- * `HGraphicBufferProducer::QueueBufferInput`.
- *
- * \param[out] t The wrapper of type
- * `HGraphicBufferProducer::QueueBufferInput`.
- * \param[out] nh The underlying native handle for `t->fence`.
- * \param[in] l The source `BGraphicBufferProducer::QueueBufferInput`.
- *
- * If the return value is `true` and `t->fence` contains a valid file
- * descriptor, \p nh will be a newly created native handle holding that file
- * descriptor. \p nh needs to be deleted with `native_handle_delete()`
- * afterwards.
- */
-inline bool wrapAs(
- HGraphicBufferProducer::QueueBufferInput* t,
- native_handle_t** nh,
- BGraphicBufferProducer::QueueBufferInput const& l) {
-
- size_t const baseSize = l.getFlattenedSize();
- std::unique_ptr<uint8_t[]> baseBuffer(
- new (std::nothrow) uint8_t[baseSize]);
- if (!baseBuffer) {
- return false;
- }
-
- size_t const baseNumFds = l.getFdCount();
- std::unique_ptr<int[]> baseFds(
- new (std::nothrow) int[baseNumFds]);
- if (!baseFds) {
- return false;
- }
-
- void* buffer = static_cast<void*>(baseBuffer.get());
- size_t size = baseSize;
- int* fds = baseFds.get();
- size_t numFds = baseNumFds;
- if (l.flatten(buffer, size, fds, numFds) != NO_ERROR) {
- return false;
- }
-
- void const* constBuffer = static_cast<void const*>(baseBuffer.get());
- size = baseSize;
- int const* constFds = static_cast<int const*>(baseFds.get());
- numFds = baseNumFds;
- if (unflatten(t, nh, constBuffer, size, constFds, numFds) != NO_ERROR) {
- return false;
- }
-
- return true;
-}
-
-/**
- * \brief Convert `HGraphicBufferProducer::QueueBufferInput` to
- * `BGraphicBufferProducer::QueueBufferInput`.
- *
- * \param[out] l The destination `BGraphicBufferProducer::QueueBufferInput`.
- * \param[in] t The source `HGraphicBufferProducer::QueueBufferInput`.
- *
- * If `t.fence` has a valid file descriptor, it will be duplicated.
- */
-inline bool convertTo(
- BGraphicBufferProducer::QueueBufferInput* l,
- HGraphicBufferProducer::QueueBufferInput const& t) {
-
- size_t const baseSize = getFlattenedSize(t);
- std::unique_ptr<uint8_t[]> baseBuffer(
- new (std::nothrow) uint8_t[baseSize]);
- if (!baseBuffer) {
- return false;
- }
-
- size_t const baseNumFds = getFdCount(t);
- std::unique_ptr<int[]> baseFds(
- new (std::nothrow) int[baseNumFds]);
- if (!baseFds) {
- return false;
- }
-
- void* buffer = static_cast<void*>(baseBuffer.get());
- size_t size = baseSize;
- int* fds = baseFds.get();
- size_t numFds = baseNumFds;
- native_handle_t* nh;
- if (flatten(t, &nh, buffer, size, fds, numFds) != NO_ERROR) {
- return false;
- }
-
- void const* constBuffer = static_cast<void const*>(baseBuffer.get());
- size = baseSize;
- int const* constFds = static_cast<int const*>(baseFds.get());
- numFds = baseNumFds;
- if (l->unflatten(constBuffer, size, constFds, numFds) != NO_ERROR) {
- native_handle_close(nh);
- native_handle_delete(nh);
- return false;
- }
-
- native_handle_delete(nh);
- return true;
-}
-
-// Ref: frameworks/native/libs/gui/BGraphicBufferProducer.cpp:
-// BGraphicBufferProducer::QueueBufferOutput
-
-/**
- * \brief Wrap `BGraphicBufferProducer::QueueBufferOutput` in
- * `HGraphicBufferProducer::QueueBufferOutput`.
- *
- * \param[out] t The wrapper of type
- * `HGraphicBufferProducer::QueueBufferOutput`.
- * \param[out] nh The array of array of native handles that are referred to by
- * members of \p t.
- * \param[in] l The source `BGraphicBufferProducer::QueueBufferOutput`.
- *
- * On success, each member of \p nh will be either `nullptr` or a newly created
- * native handle. All the non-`nullptr` elements must be deleted individually
- * with `native_handle_delete()`.
- */
-// wrap: BGraphicBufferProducer::QueueBufferOutput ->
-// HGraphicBufferProducer::QueueBufferOutput
-inline bool wrapAs(HGraphicBufferProducer::QueueBufferOutput* t,
- std::vector<std::vector<native_handle_t*> >* nh,
- BGraphicBufferProducer::QueueBufferOutput const& l) {
- if (!wrapAs(&(t->frameTimestamps), nh, l.frameTimestamps)) {
- return false;
- }
- t->width = l.width;
- t->height = l.height;
- t->transformHint = l.transformHint;
- t->numPendingBuffers = l.numPendingBuffers;
- t->nextFrameNumber = l.nextFrameNumber;
- t->bufferReplaced = l.bufferReplaced;
- return true;
-}
-
-/**
- * \brief Convert `HGraphicBufferProducer::QueueBufferOutput` to
- * `BGraphicBufferProducer::QueueBufferOutput`.
- *
- * \param[out] l The destination `BGraphicBufferProducer::QueueBufferOutput`.
- * \param[in] t The source `HGraphicBufferProducer::QueueBufferOutput`.
- *
- * This function will duplicate all file descriptors contained in \p t.
- */
-// convert: HGraphicBufferProducer::QueueBufferOutput ->
-// BGraphicBufferProducer::QueueBufferOutput
-inline bool convertTo(
- BGraphicBufferProducer::QueueBufferOutput* l,
- HGraphicBufferProducer::QueueBufferOutput const& t) {
- if (!convertTo(&(l->frameTimestamps), t.frameTimestamps)) {
- return false;
- }
- l->width = t.width;
- l->height = t.height;
- l->transformHint = t.transformHint;
- l->numPendingBuffers = t.numPendingBuffers;
- l->nextFrameNumber = t.nextFrameNumber;
- l->bufferReplaced = t.bufferReplaced;
- return true;
-}
-
-/**
- * \brief Convert `BGraphicBufferProducer::DisconnectMode` to
- * `HGraphicBufferProducer::DisconnectMode`.
- *
- * \param[in] l The source `BGraphicBufferProducer::DisconnectMode`.
- * \return The corresponding `HGraphicBufferProducer::DisconnectMode`.
- */
-inline HGraphicBufferProducer::DisconnectMode toOmxDisconnectMode(
- BGraphicBufferProducer::DisconnectMode l) {
- switch (l) {
- case BGraphicBufferProducer::DisconnectMode::Api:
- return HGraphicBufferProducer::DisconnectMode::API;
- case BGraphicBufferProducer::DisconnectMode::AllLocal:
- return HGraphicBufferProducer::DisconnectMode::ALL_LOCAL;
- }
- return HGraphicBufferProducer::DisconnectMode::API;
-}
-
-/**
- * \brief Convert `HGraphicBufferProducer::DisconnectMode` to
- * `BGraphicBufferProducer::DisconnectMode`.
- *
- * \param[in] l The source `HGraphicBufferProducer::DisconnectMode`.
- * \return The corresponding `BGraphicBufferProducer::DisconnectMode`.
- */
-inline BGraphicBufferProducer::DisconnectMode toGuiDisconnectMode(
- HGraphicBufferProducer::DisconnectMode t) {
- switch (t) {
- case HGraphicBufferProducer::DisconnectMode::API:
- return BGraphicBufferProducer::DisconnectMode::Api;
- case HGraphicBufferProducer::DisconnectMode::ALL_LOCAL:
- return BGraphicBufferProducer::DisconnectMode::AllLocal;
- }
- return BGraphicBufferProducer::DisconnectMode::Api;
-}
-
-} // namespace implementation
-} // namespace V1_0
-} // namespace omx
-} // namespace media
-} // namespace hardware
-} // namespace android
-
-#endif // ANDROID_HARDWARE_MEDIA_OMX_V1_0__CONVERSION_H
diff --git a/media/libstagefright/omx/1.0/Omx.cpp b/media/libstagefright/omx/1.0/Omx.cpp
index 789379a..fe50656 100644
--- a/media/libstagefright/omx/1.0/Omx.cpp
+++ b/media/libstagefright/omx/1.0/Omx.cpp
@@ -19,20 +19,19 @@
#include <android-base/logging.h>
#include <gui/IGraphicBufferProducer.h>
-#include <OMX_Core.h>
-#include <OMX_AsString.h>
+#include <media/openmax/OMX_Core.h>
+#include <media/openmax/OMX_AsString.h>
-#include "../OMXUtils.h"
-#include "../OMXMaster.h"
-#include "../GraphicBufferSource.h"
+#include <media/stagefright/omx/OMXUtils.h>
+#include <media/stagefright/omx/OMXMaster.h>
+#include <media/stagefright/omx/GraphicBufferSource.h>
-#include "WOmxNode.h"
-#include "WOmxObserver.h"
-#include "WGraphicBufferProducer.h"
-#include "WGraphicBufferSource.h"
-#include "Conversion.h"
-
-#include "Omx.h"
+#include <media/stagefright/omx/1.0/WOmxNode.h>
+#include <media/stagefright/omx/1.0/WOmxObserver.h>
+#include <media/stagefright/omx/1.0/WGraphicBufferProducer.h>
+#include <media/stagefright/omx/1.0/WGraphicBufferSource.h>
+#include <media/stagefright/omx/1.0/Conversion.h>
+#include <media/stagefright/omx/1.0/Omx.h>
namespace android {
namespace hardware {
@@ -115,15 +114,23 @@
return Void();
}
instance->setHandle(handle);
- std::vector<AString> quirkVector;
- if (mParser.getQuirks(name.c_str(), &quirkVector) == OK) {
+
+ // Find quirks from mParser
+ const auto& codec = mParser.getCodecMap().find(name.c_str());
+ if (codec == mParser.getCodecMap().cend()) {
+ LOG(WARNING) << "Failed to obtain quirks for omx component "
+ "'" << name.c_str() << "' "
+ "from XML files";
+ } else {
uint32_t quirks = 0;
- for (const AString quirk : quirkVector) {
+ for (const auto& quirk : codec->second.quirkSet) {
if (quirk == "requires-allocate-on-input-ports") {
- quirks |= kRequiresAllocateBufferOnInputPorts;
+ quirks |= OMXNodeInstance::
+ kRequiresAllocateBufferOnInputPorts;
}
if (quirk == "requires-allocate-on-output-ports") {
- quirks |= kRequiresAllocateBufferOnOutputPorts;
+ quirks |= OMXNodeInstance::
+ kRequiresAllocateBufferOnOutputPorts;
}
}
instance->setQuirks(quirks);
diff --git a/media/libstagefright/omx/1.0/Omx.h b/media/libstagefright/omx/1.0/Omx.h
deleted file mode 100644
index 23784aa..0000000
--- a/media/libstagefright/omx/1.0/Omx.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2016, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_MEDIA_OMX_V1_0_OMX_H
-#define ANDROID_HARDWARE_MEDIA_OMX_V1_0_OMX_H
-
-#include <hidl/MQDescriptor.h>
-#include <hidl/Status.h>
-
-#include "../../include/OMXNodeInstance.h"
-
-#include <android/hardware/media/omx/1.0/IOmx.h>
-#include <media/vndk/xmlparser/1.0/MediaCodecsXmlParser.h>
-
-namespace android {
-
-struct OMXMaster;
-
-namespace hardware {
-namespace media {
-namespace omx {
-namespace V1_0 {
-namespace implementation {
-
-using ::android::hardware::media::omx::V1_0::IOmx;
-using ::android::hardware::media::omx::V1_0::IOmxNode;
-using ::android::hardware::media::omx::V1_0::IOmxObserver;
-using ::android::hardware::media::omx::V1_0::Status;
-using ::android::hidl::base::V1_0::IBase;
-using ::android::hardware::hidl_death_recipient;
-using ::android::hardware::hidl_array;
-using ::android::hardware::hidl_memory;
-using ::android::hardware::hidl_string;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::sp;
-using ::android::wp;
-
-using ::android::OMXMaster;
-using ::android::OmxNodeOwner;
-using ::android::OMXNodeInstance;
-
-struct Omx : public IOmx, public hidl_death_recipient, public OmxNodeOwner {
- Omx();
- virtual ~Omx();
-
- // Methods from IOmx
- Return<void> listNodes(listNodes_cb _hidl_cb) override;
- Return<void> allocateNode(
- const hidl_string& name,
- const sp<IOmxObserver>& observer,
- allocateNode_cb _hidl_cb) override;
- Return<void> createInputSurface(createInputSurface_cb _hidl_cb) override;
-
- // Method from hidl_death_recipient
- void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
-
- // Method from OmxNodeOwner
- virtual status_t freeNode(sp<OMXNodeInstance> const& instance) override;
-
-protected:
- OMXMaster* mMaster;
- Mutex mLock;
- KeyedVector<wp<IBase>, sp<OMXNodeInstance> > mLiveNodes;
- KeyedVector<OMXNodeInstance*, wp<IBase> > mNode2Observer;
- MediaCodecsXmlParser mParser;
-};
-
-extern "C" IOmx* HIDL_FETCH_IOmx(const char* name);
-
-} // namespace implementation
-} // namespace V1_0
-} // namespace omx
-} // namespace media
-} // namespace hardware
-} // namespace android
-
-#endif // ANDROID_HARDWARE_MEDIA_OMX_V1_0_OMX_H
diff --git a/media/libstagefright/omx/1.0/OmxStore.cpp b/media/libstagefright/omx/1.0/OmxStore.cpp
index 0e37af9..447af6f 100644
--- a/media/libstagefright/omx/1.0/OmxStore.cpp
+++ b/media/libstagefright/omx/1.0/OmxStore.cpp
@@ -19,8 +19,9 @@
#include <android-base/logging.h>
-#include "Conversion.h"
-#include "OmxStore.h"
+#include <media/stagefright/omx/1.0/Conversion.h>
+#include <media/stagefright/omx/1.0/OmxStore.h>
+#include <media/stagefright/xmlparser/MediaCodecsXmlParser.h>
namespace android {
namespace hardware {
@@ -29,24 +30,87 @@
namespace V1_0 {
namespace implementation {
-OmxStore::OmxStore() {
+OmxStore::OmxStore(
+ const char* owner,
+ const char* const* searchDirs,
+ const char* mainXmlName,
+ const char* performanceXmlName,
+ const char* profilingResultsXmlPath) {
+ MediaCodecsXmlParser parser(searchDirs,
+ mainXmlName,
+ performanceXmlName,
+ profilingResultsXmlPath);
+ mParsingStatus = toStatus(parser.getParsingStatus());
+
+ const auto& serviceAttributeMap = parser.getServiceAttributeMap();
+ mServiceAttributeList.resize(serviceAttributeMap.size());
+ size_t i = 0;
+ for (const auto& attributePair : serviceAttributeMap) {
+ ServiceAttribute attribute;
+ attribute.key = attributePair.first;
+ attribute.value = attributePair.second;
+ mServiceAttributeList[i] = std::move(attribute);
+ ++i;
+ }
+
+ const auto& roleMap = parser.getRoleMap();
+ mRoleList.resize(roleMap.size());
+ i = 0;
+ for (const auto& rolePair : roleMap) {
+ RoleInfo role;
+ role.role = rolePair.first;
+ role.type = rolePair.second.type;
+ role.isEncoder = rolePair.second.isEncoder;
+ // TODO: Currently, preferPlatformNodes information is not available in
+ // the xml file. Once we have a way to provide this information, it
+ // should be parsed properly.
+ role.preferPlatformNodes = rolePair.first.compare(0, 5, "audio") == 0;
+ hidl_vec<NodeInfo>& nodeList = role.nodes;
+ nodeList.resize(rolePair.second.nodeList.size());
+ size_t j = 0;
+ for (const auto& nodePair : rolePair.second.nodeList) {
+ NodeInfo node;
+ node.name = nodePair.second.name;
+ node.owner = owner;
+ hidl_vec<NodeAttribute>& attributeList = node.attributes;
+ attributeList.resize(nodePair.second.attributeList.size());
+ size_t k = 0;
+ for (const auto& attributePair : nodePair.second.attributeList) {
+ NodeAttribute attribute;
+ attribute.key = attributePair.first;
+ attribute.value = attributePair.second;
+ attributeList[k] = std::move(attribute);
+ ++k;
+ }
+ nodeList[j] = std::move(node);
+ ++j;
+ }
+ mRoleList[i] = std::move(role);
+ ++i;
+ }
+
+ mPrefix = parser.getCommonPrefix();
}
OmxStore::~OmxStore() {
}
Return<void> OmxStore::listServiceAttributes(listServiceAttributes_cb _hidl_cb) {
- _hidl_cb(toStatus(NO_ERROR), hidl_vec<ServiceAttribute>());
+ if (mParsingStatus == Status::NO_ERROR) {
+ _hidl_cb(Status::NO_ERROR, mServiceAttributeList);
+ } else {
+ _hidl_cb(mParsingStatus, hidl_vec<ServiceAttribute>());
+ }
return Void();
}
Return<void> OmxStore::getNodePrefix(getNodePrefix_cb _hidl_cb) {
- _hidl_cb(hidl_string());
+ _hidl_cb(mPrefix);
return Void();
}
Return<void> OmxStore::listRoles(listRoles_cb _hidl_cb) {
- _hidl_cb(hidl_vec<RoleInfo>());
+ _hidl_cb(mRoleList);
return Void();
}
@@ -54,12 +118,6 @@
return IOmx::tryGetService(omxName);
}
-// Methods from ::android::hidl::base::V1_0::IBase follow.
-
-IOmxStore* HIDL_FETCH_IOmxStore(const char* /* name */) {
- return new OmxStore();
-}
-
} // namespace implementation
} // namespace V1_0
} // namespace omx
diff --git a/media/libstagefright/omx/1.0/OmxStore.h b/media/libstagefright/omx/1.0/OmxStore.h
deleted file mode 100644
index f377f5a..0000000
--- a/media/libstagefright/omx/1.0/OmxStore.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2017, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_MEDIA_OMX_V1_0_OMXSTORE_H
-#define ANDROID_HARDWARE_MEDIA_OMX_V1_0_OMXSTORE_H
-
-#include <hidl/MQDescriptor.h>
-#include <hidl/Status.h>
-
-#include <android/hardware/media/omx/1.0/IOmxStore.h>
-
-namespace android {
-namespace hardware {
-namespace media {
-namespace omx {
-namespace V1_0 {
-namespace implementation {
-
-using ::android::hardware::media::omx::V1_0::IOmxStore;
-using ::android::hardware::media::omx::V1_0::IOmx;
-using ::android::hardware::media::omx::V1_0::Status;
-using ::android::hidl::base::V1_0::IBase;
-using ::android::hardware::hidl_string;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::sp;
-using ::android::wp;
-
-struct OmxStore : public IOmxStore {
- OmxStore();
- virtual ~OmxStore();
-
- // Methods from IOmx
- Return<void> listServiceAttributes(listServiceAttributes_cb) override;
- Return<void> getNodePrefix(getNodePrefix_cb) override;
- Return<void> listRoles(listRoles_cb) override;
- Return<sp<IOmx>> getOmx(hidl_string const&) override;
-};
-
-extern "C" IOmxStore* HIDL_FETCH_IOmxStore(const char* name);
-
-} // namespace implementation
-} // namespace V1_0
-} // namespace omx
-} // namespace media
-} // namespace hardware
-} // namespace android
-
-#endif // ANDROID_HARDWARE_MEDIA_OMX_V1_0_OMXSTORE_H
diff --git a/media/libstagefright/omx/1.0/WGraphicBufferProducer.cpp b/media/libstagefright/omx/1.0/WGraphicBufferProducer.cpp
index acda060..c4499dc 100644
--- a/media/libstagefright/omx/1.0/WGraphicBufferProducer.cpp
+++ b/media/libstagefright/omx/1.0/WGraphicBufferProducer.cpp
@@ -18,9 +18,9 @@
#include <android-base/logging.h>
-#include "WGraphicBufferProducer.h"
-#include "WProducerListener.h"
-#include "Conversion.h"
+#include <media/stagefright/omx/1.0/WGraphicBufferProducer.h>
+#include <media/stagefright/omx/1.0/WProducerListener.h>
+#include <media/stagefright/omx/1.0/Conversion.h>
#include <system/window.h>
namespace android {
@@ -41,7 +41,9 @@
sp<GraphicBuffer> buf;
status_t status = mBase->requestBuffer(slot, &buf);
AnwBuffer anwBuffer;
- wrapAs(&anwBuffer, *buf);
+ if (buf != nullptr) {
+ wrapAs(&anwBuffer, *buf);
+ }
_hidl_cb(static_cast<int32_t>(status), anwBuffer);
return Void();
}
@@ -64,10 +66,9 @@
sp<Fence> fence;
::android::FrameEventHistoryDelta outTimestamps;
status_t status = mBase->dequeueBuffer(
- &slot, &fence,
- width, height,
- static_cast<::android::PixelFormat>(format), usage,
- getFrameTimestamps ? &outTimestamps : nullptr);
+ &slot, &fence, width, height,
+ static_cast<::android::PixelFormat>(format), usage, nullptr,
+ getFrameTimestamps ? &outTimestamps : nullptr);
hidl_handle tFence;
FrameEventHistoryDelta tOutTimestamps;
diff --git a/media/libstagefright/omx/1.0/WGraphicBufferSource.cpp b/media/libstagefright/omx/1.0/WGraphicBufferSource.cpp
index d8540f8..3201c32 100644
--- a/media/libstagefright/omx/1.0/WGraphicBufferSource.cpp
+++ b/media/libstagefright/omx/1.0/WGraphicBufferSource.cpp
@@ -17,15 +17,14 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "TWGraphicBufferSource"
+#include <media/stagefright/omx/1.0/WGraphicBufferSource.h>
+#include <media/stagefright/omx/1.0/WOmxNode.h>
+#include <media/stagefright/omx/1.0/Conversion.h>
+#include <media/stagefright/omx/OMXUtils.h>
#include <android/hardware/media/omx/1.0/IOmxBufferSource.h>
#include <android/hardware/media/omx/1.0/IOmxNode.h>
-#include <OMX_Component.h>
-#include <OMX_IndexExt.h>
-
-#include "omx/OMXUtils.h"
-#include "WGraphicBufferSource.h"
-#include "WOmxNode.h"
-#include "Conversion.h"
+#include <media/openmax/OMX_Component.h>
+#include <media/openmax/OMX_IndexExt.h>
namespace android {
namespace hardware {
@@ -68,7 +67,14 @@
tMsg.data.eventData.data1 = dataSpace;
tMsg.data.eventData.data2 = aspects;
tMsg.data.eventData.data3 = pixelFormat;
- mOmxNode->dispatchMessage(tMsg);
+ if (!mOmxNode->dispatchMessage(tMsg).isOk()) {
+ ALOGE("TWOmxNodeWrapper failed to dispatch message "
+ "OMX_EventDataSpaceChanged: "
+ "dataSpace = %ld, aspects = %ld, pixelFormat = %ld",
+ static_cast<long>(dataSpace),
+ static_cast<long>(aspects),
+ static_cast<long>(pixelFormat));
+ }
}
};
@@ -144,10 +150,13 @@
outParams.data() + outParams.size(),
params);
});
- omxNode->getParameter(
+ auto transStatus = omxNode->getParameter(
static_cast<uint32_t>(OMX_IndexParamConsumerUsageBits),
inHidlBytes(&consumerUsage, sizeof(consumerUsage)),
_hidl_cb);
+ if (!transStatus.isOk()) {
+ return toStatus(FAILED_TRANSACTION);
+ }
if (fnStatus != OK) {
consumerUsage = 0;
}
@@ -158,10 +167,13 @@
_params = &def;
params = static_cast<uint8_t*>(_params);
- omxNode->getParameter(
+ transStatus = omxNode->getParameter(
static_cast<uint32_t>(OMX_IndexParamPortDefinition),
inHidlBytes(&def, sizeof(def)),
_hidl_cb);
+ if (!transStatus.isOk()) {
+ return toStatus(FAILED_TRANSACTION);
+ }
if (fnStatus != NO_ERROR) {
ALOGE("Failed to get port definition: %d", fnStatus);
return toStatus(fnStatus);
diff --git a/media/libstagefright/omx/1.0/WGraphicBufferSource.h b/media/libstagefright/omx/1.0/WGraphicBufferSource.h
deleted file mode 100644
index 4549c97..0000000
--- a/media/libstagefright/omx/1.0/WGraphicBufferSource.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright 2016, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_MEDIA_OMX_V1_0_WGRAPHICBUFFERSOURCE_H
-#define ANDROID_HARDWARE_MEDIA_OMX_V1_0_WGRAPHICBUFFERSOURCE_H
-
-#include <hidl/MQDescriptor.h>
-#include <hidl/Status.h>
-
-#include <android/hardware/media/omx/1.0/IGraphicBufferSource.h>
-#include <android/hardware/media/omx/1.0/IOmxNode.h>
-#include <android/hardware/graphics/common/1.0/types.h>
-#include <android/hardware/media/omx/1.0/IOmxNode.h>
-#include <android/hardware/media/omx/1.0/IGraphicBufferSource.h>
-
-#include <android/BnGraphicBufferSource.h>
-
-#include "../GraphicBufferSource.h"
-
-namespace android {
-namespace hardware {
-namespace media {
-namespace omx {
-namespace V1_0 {
-namespace implementation {
-
-using ::android::GraphicBufferSource;
-using ::android::hardware::graphics::common::V1_0::Dataspace;
-using ::android::hardware::media::omx::V1_0::ColorAspects;
-using ::android::hardware::media::omx::V1_0::IGraphicBufferSource;
-using ::android::hardware::media::omx::V1_0::IOmxNode;
-using ::android::hardware::media::omx::V1_0::Status;
-using ::android::hidl::base::V1_0::IBase;
-using ::android::hardware::hidl_array;
-using ::android::hardware::hidl_memory;
-using ::android::hardware::hidl_string;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::sp;
-
-using ::android::IOMXNode;
-
-/**
- * Wrapper classes for conversion
- * ==============================
- *
- * Naming convention:
- * - LW = Legacy Wrapper --- It wraps a Treble object inside a legacy object.
- * - TW = Treble Wrapper --- It wraps a legacy object inside a Treble object.
- */
-
-typedef ::android::hardware::media::omx::V1_0::IGraphicBufferSource
- TGraphicBufferSource;
-
-struct TWGraphicBufferSource : public TGraphicBufferSource {
- struct TWOmxNodeWrapper;
- struct TWOmxBufferSource;
- sp<GraphicBufferSource> mBase;
- sp<IOmxBufferSource> mOmxBufferSource;
-
- TWGraphicBufferSource(sp<GraphicBufferSource> const& base);
- Return<Status> configure(
- const sp<IOmxNode>& omxNode, Dataspace dataspace) override;
- Return<Status> setSuspend(bool suspend, int64_t timeUs) override;
- Return<Status> setRepeatPreviousFrameDelayUs(int64_t repeatAfterUs) override;
- Return<Status> setMaxFps(float maxFps) override;
- Return<Status> setTimeLapseConfig(double fps, double captureFps) override;
- Return<Status> setStartTimeUs(int64_t startTimeUs) override;
- Return<Status> setStopTimeUs(int64_t stopTimeUs) override;
- Return<void> getStopTimeOffsetUs(getStopTimeOffsetUs_cb _hidl_cb) override;
- Return<Status> setColorAspects(const ColorAspects& aspects) override;
- Return<Status> setTimeOffsetUs(int64_t timeOffsetUs) override;
- Return<Status> signalEndOfInputStream() override;
-};
-
-} // namespace implementation
-} // namespace V1_0
-} // namespace omx
-} // namespace media
-} // namespace hardware
-} // namespace android
-
-#endif // ANDROID_HARDWARE_MEDIA_OMX_V1_0_WGRAPHICBUFFERSOURCE_H
diff --git a/media/libstagefright/omx/1.0/WOmxBufferSource.cpp b/media/libstagefright/omx/1.0/WOmxBufferSource.cpp
index 803283a..c8c963f 100644
--- a/media/libstagefright/omx/1.0/WOmxBufferSource.cpp
+++ b/media/libstagefright/omx/1.0/WOmxBufferSource.cpp
@@ -16,8 +16,8 @@
#include <utils/String8.h>
-#include "WOmxBufferSource.h"
-#include "Conversion.h"
+#include <media/stagefright/omx/1.0/WOmxBufferSource.h>
+#include <media/stagefright/omx/1.0/Conversion.h>
namespace android {
namespace hardware {
diff --git a/media/libstagefright/omx/1.0/WOmxNode.cpp b/media/libstagefright/omx/1.0/WOmxNode.cpp
index 91d1010..9f82283 100644
--- a/media/libstagefright/omx/1.0/WOmxNode.cpp
+++ b/media/libstagefright/omx/1.0/WOmxNode.cpp
@@ -16,9 +16,9 @@
#include <algorithm>
-#include "WOmxNode.h"
-#include "WOmxBufferSource.h"
-#include "Conversion.h"
+#include <media/stagefright/omx/1.0/WOmxNode.h>
+#include <media/stagefright/omx/1.0/WOmxBufferSource.h>
+#include <media/stagefright/omx/1.0/Conversion.h>
namespace android {
namespace hardware {
diff --git a/media/libstagefright/omx/1.0/WOmxNode.h b/media/libstagefright/omx/1.0/WOmxNode.h
deleted file mode 100644
index d715374..0000000
--- a/media/libstagefright/omx/1.0/WOmxNode.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright 2016, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_MEDIA_OMX_V1_0_WOMXNODE_H
-#define ANDROID_HARDWARE_MEDIA_OMX_V1_0_WOMXNODE_H
-
-#include <hidl/MQDescriptor.h>
-#include <hidl/Status.h>
-
-#include <utils/Errors.h>
-
-#include "../../include/OMXNodeInstance.h"
-
-#include <android/hardware/media/omx/1.0/IOmxNode.h>
-#include <android/hardware/media/omx/1.0/IOmxObserver.h>
-
-namespace android {
-namespace hardware {
-namespace media {
-namespace omx {
-namespace V1_0 {
-namespace implementation {
-
-using ::android::hardware::media::omx::V1_0::CodecBuffer;
-using ::android::hardware::media::omx::V1_0::IOmxBufferSource;
-using ::android::hardware::media::omx::V1_0::IOmxNode;
-using ::android::hardware::media::omx::V1_0::IOmxObserver;
-using ::android::hardware::media::omx::V1_0::Message;
-using ::android::hardware::media::omx::V1_0::PortMode;
-using ::android::hardware::media::omx::V1_0::Status;
-using ::android::hidl::base::V1_0::IBase;
-using ::android::hardware::hidl_array;
-using ::android::hardware::hidl_memory;
-using ::android::hardware::hidl_string;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::sp;
-
-/**
- * Wrapper classes for conversion
- * ==============================
- *
- * Naming convention:
- * - LW = Legacy Wrapper --- It wraps a Treble object inside a legacy object.
- * - TW = Treble Wrapper --- It wraps a legacy object inside a Treble object.
- */
-
-struct LWOmxNode : public BnOMXNode {
- sp<IOmxNode> mBase;
- LWOmxNode(sp<IOmxNode> const& base);
- status_t freeNode() override;
- status_t sendCommand(
- OMX_COMMANDTYPE cmd, OMX_S32 param) override;
- status_t getParameter(
- OMX_INDEXTYPE index, void *params, size_t size) override;
- status_t setParameter(
- OMX_INDEXTYPE index, const void *params, size_t size) override;
- status_t getConfig(
- OMX_INDEXTYPE index, void *params, size_t size) override;
- status_t setConfig(
- OMX_INDEXTYPE index, const void *params, size_t size) override;
- status_t setPortMode(
- OMX_U32 port_index, IOMX::PortMode mode) override;
- status_t prepareForAdaptivePlayback(
- OMX_U32 portIndex, OMX_BOOL enable,
- OMX_U32 maxFrameWidth, OMX_U32 maxFrameHeight) override;
- status_t configureVideoTunnelMode(
- OMX_U32 portIndex, OMX_BOOL tunneled,
- OMX_U32 audioHwSync, native_handle_t **sidebandHandle) override;
- status_t getGraphicBufferUsage(
- OMX_U32 port_index, OMX_U32* usage) override;
- status_t setInputSurface(
- const sp<IOMXBufferSource> &bufferSource) override;
- status_t allocateSecureBuffer(
- OMX_U32 port_index, size_t size, buffer_id *buffer,
- void **buffer_data, sp<NativeHandle> *native_handle) override;
- status_t useBuffer(
- OMX_U32 port_index, const OMXBuffer &omxBuf,
- buffer_id *buffer) override;
- status_t freeBuffer(
- OMX_U32 port_index, buffer_id buffer) override;
- status_t fillBuffer(
- buffer_id buffer, const OMXBuffer &omxBuf,
- int fenceFd = -1) override;
- status_t emptyBuffer(
- buffer_id buffer, const OMXBuffer &omxBuf,
- OMX_U32 flags, OMX_TICKS timestamp, int fenceFd = -1) override;
- status_t getExtensionIndex(
- const char *parameter_name,
- OMX_INDEXTYPE *index) override;
- status_t dispatchMessage(const omx_message &msg) override;
-};
-
-struct TWOmxNode : public IOmxNode {
- sp<IOMXNode> mBase;
- TWOmxNode(sp<IOMXNode> const& base);
-
- Return<Status> freeNode() override;
- Return<Status> sendCommand(uint32_t cmd, int32_t param) override;
- Return<void> getParameter(
- uint32_t index, hidl_vec<uint8_t> const& inParams,
- getParameter_cb _hidl_cb) override;
- Return<Status> setParameter(
- uint32_t index, hidl_vec<uint8_t> const& params) override;
- Return<void> getConfig(
- uint32_t index, hidl_vec<uint8_t> const& inConfig,
- getConfig_cb _hidl_cb) override;
- Return<Status> setConfig(
- uint32_t index, hidl_vec<uint8_t> const& config) override;
- Return<Status> setPortMode(uint32_t portIndex, PortMode mode) override;
- Return<Status> prepareForAdaptivePlayback(
- uint32_t portIndex, bool enable,
- uint32_t maxFrameWidth, uint32_t maxFrameHeight) override;
- Return<void> configureVideoTunnelMode(
- uint32_t portIndex, bool tunneled, uint32_t audioHwSync,
- configureVideoTunnelMode_cb _hidl_cb) override;
- Return<void> getGraphicBufferUsage(
- uint32_t portIndex,
- getGraphicBufferUsage_cb _hidl_cb) override;
- Return<Status> setInputSurface(
- sp<IOmxBufferSource> const& bufferSource) override;
- Return<void> allocateSecureBuffer(
- uint32_t portIndex, uint64_t size,
- allocateSecureBuffer_cb _hidl_cb) override;
- Return<void> useBuffer(
- uint32_t portIndex, CodecBuffer const& codecBuffer,
- useBuffer_cb _hidl_cb) override;
- Return<Status> freeBuffer(uint32_t portIndex, uint32_t buffer) override;
- Return<Status> fillBuffer(
- uint32_t buffer, CodecBuffer const& codecBuffer,
- const hidl_handle& fence) override;
- Return<Status> emptyBuffer(
- uint32_t buffer, CodecBuffer const& codecBuffer,
- uint32_t flags, uint64_t timestampUs,
- hidl_handle const& fence) override;
- Return<void> getExtensionIndex(
- hidl_string const& parameterName,
- getExtensionIndex_cb _hidl_cb) override;
- Return<Status> dispatchMessage(Message const& msg) override;
-};
-
-} // namespace implementation
-} // namespace V1_0
-} // namespace omx
-} // namespace media
-} // namespace hardware
-} // namespace android
-
-#endif // ANDROID_HARDWARE_MEDIA_OMX_V1_0_WOMXNODE_H
diff --git a/media/libstagefright/omx/1.0/WOmxObserver.cpp b/media/libstagefright/omx/1.0/WOmxObserver.cpp
index 354db29..ccbe25c 100644
--- a/media/libstagefright/omx/1.0/WOmxObserver.cpp
+++ b/media/libstagefright/omx/1.0/WOmxObserver.cpp
@@ -16,14 +16,14 @@
#define LOG_TAG "WOmxObserver-impl"
-#include <vector>
-
#include <android-base/logging.h>
#include <cutils/native_handle.h>
#include <binder/Binder.h>
-#include "WOmxObserver.h"
-#include "Conversion.h"
+#include <media/stagefright/omx/1.0/WOmxObserver.h>
+#include <media/stagefright/omx/1.0/Conversion.h>
+
+#include <vector>
namespace android {
namespace hardware {
diff --git a/media/libstagefright/omx/1.0/WProducerListener.cpp b/media/libstagefright/omx/1.0/WProducerListener.cpp
index be0d4d5..bdc3aa1 100644
--- a/media/libstagefright/omx/1.0/WProducerListener.cpp
+++ b/media/libstagefright/omx/1.0/WProducerListener.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "WProducerListener.h"
+#include <media/stagefright/omx/1.0/WProducerListener.h>
namespace android {
namespace hardware {
diff --git a/media/libstagefright/omx/Android.bp b/media/libstagefright/omx/Android.bp
index 69ede3d..bd3c1c6 100644
--- a/media/libstagefright/omx/Android.bp
+++ b/media/libstagefright/omx/Android.bp
@@ -1,12 +1,16 @@
cc_library_shared {
name: "libstagefright_omx",
vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: [
"FrameDropper.cpp",
"GraphicBufferSource.cpp",
"BWGraphicBufferSource.cpp",
"OMX.cpp",
+ "OMXStore.cpp",
"OMXMaster.cpp",
"OMXNodeInstance.cpp",
"OMXUtils.cpp",
@@ -25,14 +29,16 @@
"1.0/WOmxBufferSource.cpp",
],
- include_dirs: [
- "frameworks/av/include", // for media/vndk/xmlparser/1.0/MediaCodecsXmlParser.h
- "frameworks/av/include/media/",
- "frameworks/av/media/libstagefright",
- "frameworks/av/media/libstagefright/include",
- "frameworks/native/include", // for media/hardware/MetadataBufferType.h
- "frameworks/native/include/media/hardware",
- "frameworks/native/include/media/openmax",
+ export_include_dirs: [
+ "include",
+ ],
+
+ header_libs: [
+ "media_plugin_headers",
+ ],
+
+ export_header_lib_headers: [
+ "media_plugin_headers",
],
shared_libs: [
@@ -45,12 +51,12 @@
"libgui",
"libcutils",
"libstagefright_foundation",
+ "libstagefright_xmlparser",
"libdl",
"libhidlbase",
"libhidlmemory",
"libhidltransport",
"libnativewindow", // TODO(b/62923479): use header library
- "libstagefright_xmlparser@1.0",
"android.hidl.memory@1.0",
"android.hidl.token@1.0-utils",
"android.hardware.media@1.0",
@@ -59,7 +65,12 @@
"android.hardware.graphics.bufferqueue@1.0",
],
- export_shared_lib_headers: ["android.hidl.memory@1.0"],
+ export_shared_lib_headers: [
+ "android.hidl.memory@1.0",
+ "libmedia_omx",
+ "libstagefright_foundation",
+ "libstagefright_xmlparser",
+ ],
cflags: [
"-Werror",
@@ -80,15 +91,29 @@
},
}
-cc_library_static {
+cc_library_shared {
name: "libstagefright_omx_utils",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: ["OMXUtils.cpp"],
- include_dirs: [
- "frameworks/av/media/libstagefright",
- "frameworks/native/include/media/hardware",
- "frameworks/native/include/media/openmax",
+ export_include_dirs: [
+ "include",
],
- shared_libs: ["libmedia"],
+ header_libs: [
+ "media_plugin_headers",
+ ],
+ export_header_lib_headers: [
+ "media_plugin_headers",
+ ],
+ shared_libs: [
+ "libmedia_omx",
+ "liblog",
+ ],
+ export_shared_lib_headers: [
+ "libmedia_omx",
+ ],
sanitize: {
misc_undefined: [
"signed-integer-overflow",
diff --git a/media/libstagefright/omx/BWGraphicBufferSource.cpp b/media/libstagefright/omx/BWGraphicBufferSource.cpp
index 79f6d93..94ef598 100644
--- a/media/libstagefright/omx/BWGraphicBufferSource.cpp
+++ b/media/libstagefright/omx/BWGraphicBufferSource.cpp
@@ -17,15 +17,13 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "BWGraphicBufferSource"
-#include <OMX_Component.h>
-#include <OMX_IndexExt.h>
-
+#include <media/stagefright/omx/BWGraphicBufferSource.h>
+#include <media/stagefright/omx/OMXUtils.h>
+#include <media/openmax/OMX_Component.h>
+#include <media/openmax/OMX_IndexExt.h>
#include <media/OMXBuffer.h>
#include <media/IOMX.h>
-#include "OMXUtils.h"
-#include "BWGraphicBufferSource.h"
-
namespace android {
static const OMX_U32 kPortIndexInput = 0;
diff --git a/media/libstagefright/omx/FrameDropper.cpp b/media/libstagefright/omx/FrameDropper.cpp
index 9a4952e..0c50c58 100644
--- a/media/libstagefright/omx/FrameDropper.cpp
+++ b/media/libstagefright/omx/FrameDropper.cpp
@@ -18,8 +18,7 @@
#define LOG_TAG "FrameDropper"
#include <utils/Log.h>
-#include "FrameDropper.h"
-
+#include <media/stagefright/omx/FrameDropper.h>
#include <media/stagefright/foundation/ADebug.h>
namespace android {
diff --git a/media/libstagefright/omx/GraphicBufferSource.cpp b/media/libstagefright/omx/GraphicBufferSource.cpp
index d85ef89..1917d2a 100644
--- a/media/libstagefright/omx/GraphicBufferSource.cpp
+++ b/media/libstagefright/omx/GraphicBufferSource.cpp
@@ -22,7 +22,9 @@
#define STRINGIFY_ENUMS // for asString in HardwareAPI.h/VideoAPI.h
-#include "GraphicBufferSource.h"
+#include <media/stagefright/omx/GraphicBufferSource.h>
+#include <media/stagefright/omx/FrameDropper.h>
+#include <media/stagefright/omx/OMXUtils.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/AMessage.h>
#include <media/stagefright/foundation/ColorUtils.h>
@@ -31,14 +33,12 @@
#include <media/hardware/MetadataBufferType.h>
#include <ui/GraphicBuffer.h>
#include <gui/BufferItem.h>
-#include <HardwareAPI.h>
-#include "omx/OMXUtils.h"
-#include <OMX_Component.h>
-#include <OMX_IndexExt.h>
-#include "media/OMXBuffer.h"
+#include <media/hardware/HardwareAPI.h>
+#include <media/openmax/OMX_Component.h>
+#include <media/openmax/OMX_IndexExt.h>
+#include <media/OMXBuffer.h>
#include <inttypes.h>
-#include "FrameDropper.h"
#include <functional>
#include <memory>
@@ -733,7 +733,7 @@
} else {
// snap to nearest capture point
int64_t nFrames = std::llround(
- (timeUs - mPrevCaptureUs) * mCaptureFps);
+ (timeUs - mPrevCaptureUs) * mCaptureFps / 1000000);
if (nFrames <= 0) {
// skip this frame as it's too close to previous capture
ALOGV("skipping frame, timeUs %lld", static_cast<long long>(timeUs));
@@ -741,9 +741,9 @@
}
mFrameCount += nFrames;
mPrevCaptureUs = mBaseCaptureUs + std::llround(
- mFrameCount / mCaptureFps);
+ mFrameCount * 1000000 / mCaptureFps);
mPrevFrameUs = mBaseFrameUs + std::llround(
- mFrameCount / mFps);
+ mFrameCount * 1000000 / mFps);
}
ALOGV("timeUs %lld, captureUs %lld, frameUs %lld",
diff --git a/media/libstagefright/omx/GraphicBufferSource.h b/media/libstagefright/omx/GraphicBufferSource.h
deleted file mode 100644
index 009691d..0000000
--- a/media/libstagefright/omx/GraphicBufferSource.h
+++ /dev/null
@@ -1,485 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef GRAPHIC_BUFFER_SOURCE_H_
-
-#define GRAPHIC_BUFFER_SOURCE_H_
-
-#include <gui/IGraphicBufferProducer.h>
-#include <gui/BufferQueue.h>
-#include <utils/RefBase.h>
-
-#include <VideoAPI.h>
-#include <media/IOMX.h>
-#include <media/OMXFenceParcelable.h>
-#include <media/stagefright/foundation/ABase.h>
-#include <media/stagefright/foundation/AHandlerReflector.h>
-#include <media/stagefright/foundation/ALooper.h>
-
-#include <android/BnGraphicBufferSource.h>
-#include <android/BnOMXBufferSource.h>
-
-#include "IOmxNodeWrapper.h"
-
-namespace android {
-
-using ::android::binder::Status;
-
-struct FrameDropper;
-
-/*
- * This class is used to feed OMX codecs from a Surface via BufferQueue or
- * HW producer.
- *
- * Instances of the class don't run on a dedicated thread. Instead,
- * various events trigger data movement:
- *
- * - Availability of a new frame of data from the BufferQueue (notified
- * via the onFrameAvailable callback).
- * - The return of a codec buffer (via OnEmptyBufferDone).
- * - Application signaling end-of-stream.
- * - Transition to or from "executing" state.
- *
- * Frames of data (and, perhaps, the end-of-stream indication) can arrive
- * before the codec is in the "executing" state, so we need to queue
- * things up until we're ready to go.
- *
- * The GraphicBufferSource can be configure dynamically to discard frames
- * from the source:
- *
- * - if their timestamp is less than a start time
- * - if the source is suspended or stopped and the suspend/stop-time is reached
- * - if EOS was signaled
- * - if there is no encoder connected to it
- *
- * The source, furthermore, may choose to not encode (drop) frames if:
- *
- * - to throttle the frame rate (keep it under a certain limit)
- *
- * Finally the source may optionally hold onto the last non-discarded frame
- * (even if it was dropped) to reencode it after an interval if no further
- * frames are sent by the producer.
- */
-class GraphicBufferSource : public BufferQueue::ConsumerListener {
-public:
- GraphicBufferSource();
-
- virtual ~GraphicBufferSource();
-
- // We can't throw an exception if the constructor fails, so we just set
- // this and require that the caller test the value.
- status_t initCheck() const {
- return mInitCheck;
- }
-
- // Returns the handle to the producer side of the BufferQueue. Buffers
- // queued on this will be received by GraphicBufferSource.
- sp<IGraphicBufferProducer> getIGraphicBufferProducer() const {
- return mProducer;
- }
-
- // OmxBufferSource interface
- // ------------------------------
-
- // This is called when OMX transitions to OMX_StateExecuting, which means
- // we can start handing it buffers. If we already have buffers of data
- // sitting in the BufferQueue, this will send them to the codec.
- Status onOmxExecuting();
-
- // This is called when OMX transitions to OMX_StateIdle, indicating that
- // the codec is meant to return all buffers back to the client for them
- // to be freed. Do NOT submit any more buffers to the component.
- Status onOmxIdle();
-
- // This is called when OMX transitions to OMX_StateLoaded, indicating that
- // we are shutting down.
- Status onOmxLoaded();
-
- // A "codec buffer", i.e. a buffer that can be used to pass data into
- // the encoder, has been allocated. (This call does not call back into
- // OMXNodeInstance.)
- Status onInputBufferAdded(int32_t bufferId);
-
- // Called from OnEmptyBufferDone. If we have a BQ buffer available,
- // fill it with a new frame of data; otherwise, just mark it as available.
- Status onInputBufferEmptied(int32_t bufferId, int fenceFd);
-
- // IGraphicBufferSource interface
- // ------------------------------
-
- // Configure the buffer source to be used with an OMX node with the default
- // data space.
- status_t configure(
- const sp<IOmxNodeWrapper> &omxNode,
- int32_t dataSpace,
- int32_t bufferCount,
- uint32_t frameWidth,
- uint32_t frameHeight,
- uint32_t consumerUsage);
-
- // This is called after the last input frame has been submitted or buffer
- // timestamp is greater or equal than stopTimeUs. We need to submit an empty
- // buffer with the EOS flag set. If we don't have a codec buffer ready,
- // we just set the mEndOfStream flag.
- status_t signalEndOfInputStream();
-
- // If suspend is true, all incoming buffers (including those currently
- // in the BufferQueue) with timestamp larger than timeUs will be discarded
- // until the suspension is lifted. If suspend is false, all incoming buffers
- // including those currently in the BufferQueue) with timestamp larger than
- // timeUs will be processed. timeUs uses SYSTEM_TIME_MONOTONIC time base.
- status_t setSuspend(bool suspend, int64_t timeUs);
-
- // Specifies the interval after which we requeue the buffer previously
- // queued to the encoder. This is useful in the case of surface flinger
- // providing the input surface if the resulting encoded stream is to
- // be displayed "live". If we were not to push through the extra frame
- // the decoder on the remote end would be unable to decode the latest frame.
- // This API must be called before transitioning the encoder to "executing"
- // state and once this behaviour is specified it cannot be reset.
- status_t setRepeatPreviousFrameDelayUs(int64_t repeatAfterUs);
-
- // Sets the input buffer timestamp offset.
- // When set, the sample's timestamp will be adjusted with the timeOffsetUs.
- status_t setTimeOffsetUs(int64_t timeOffsetUs);
-
- // When set, the max frame rate fed to the encoder will be capped at maxFps.
- status_t setMaxFps(float maxFps);
-
- // Sets the time lapse (or slow motion) parameters.
- // When set, the sample's timestamp will be modified to playback framerate,
- // and capture timestamp will be modified to capture rate.
- status_t setTimeLapseConfig(double fps, double captureFps);
-
- // Sets the start time us (in system time), samples before which should
- // be dropped and not submitted to encoder
- status_t setStartTimeUs(int64_t startTimeUs);
-
- // Sets the stop time us (in system time), samples after which should be dropped
- // and not submitted to encoder. timeUs uses SYSTEM_TIME_MONOTONIC time base.
- status_t setStopTimeUs(int64_t stopTimeUs);
-
- // Gets the stop time offset in us. This is the time offset between latest buffer
- // time and the stopTimeUs. If stop time is not set, INVALID_OPERATION will be returned.
- // If return is OK, *stopTimeOffsetUs will contain the valid offset. Otherwise,
- // *stopTimeOffsetUs will not be modified. Positive stopTimeOffsetUs means buffer time
- // larger than stopTimeUs.
- status_t getStopTimeOffsetUs(int64_t *stopTimeOffsetUs);
-
- // Sets the desired color aspects, e.g. to be used when producer does not specify a dataspace.
- status_t setColorAspects(int32_t aspectsPacked);
-
-protected:
- // BQ::ConsumerListener interface
- // ------------------------------
-
- // BufferQueue::ConsumerListener interface, called when a new frame of
- // data is available. If we're executing and a codec buffer is
- // available, we acquire the buffer, copy the GraphicBuffer reference
- // into the codec buffer, and call Empty[This]Buffer. If we're not yet
- // executing or there's no codec buffer available, we just increment
- // mNumFramesAvailable and return.
- void onFrameAvailable(const BufferItem& item) override;
-
- // BufferQueue::ConsumerListener interface, called when the client has
- // released one or more GraphicBuffers. We clear out the appropriate
- // set of mBufferSlot entries.
- void onBuffersReleased() override;
-
- // BufferQueue::ConsumerListener interface, called when the client has
- // changed the sideband stream. GraphicBufferSource doesn't handle sideband
- // streams so this is a no-op (and should never be called).
- void onSidebandStreamChanged() override;
-
-private:
- // Lock, covers all member variables.
- mutable Mutex mMutex;
-
- // Used to report constructor failure.
- status_t mInitCheck;
-
- // Graphic buffer reference objects
- // --------------------------------
-
- // These are used to keep a shared reference to GraphicBuffers and gralloc handles owned by the
- // GraphicBufferSource as well as to manage the cache slots. Separate references are owned by
- // the buffer cache (controlled by the buffer queue/buffer producer) and the codec.
-
- // When we get a buffer from the producer (BQ) it designates them to be cached into specific
- // slots. Each slot owns a shared reference to the graphic buffer (we track these using
- // CachedBuffer) that is in that slot, but the producer controls the slots.
- struct CachedBuffer;
-
- // When we acquire a buffer, we must release it back to the producer once we (or the codec)
- // no longer uses it (as long as the buffer is still in the cache slot). We use shared
- // AcquiredBuffer instances for this purpose - and we call release buffer when the last
- // reference is relinquished.
- struct AcquiredBuffer;
-
- // We also need to keep some extra metadata (other than the buffer reference) for acquired
- // buffers. These are tracked in VideoBuffer struct.
- struct VideoBuffer {
- std::shared_ptr<AcquiredBuffer> mBuffer;
- nsecs_t mTimestampNs;
- android_dataspace_t mDataspace;
- };
-
- // Cached and aquired buffers
- // --------------------------------
-
- typedef int slot_id;
-
- // Maps a slot to the cached buffer in that slot
- KeyedVector<slot_id, std::shared_ptr<CachedBuffer>> mBufferSlots;
-
- // Queue of buffers acquired in chronological order that are not yet submitted to the codec
- List<VideoBuffer> mAvailableBuffers;
-
- // Number of buffers that have been signaled by the producer that they are available, but
- // we've been unable to acquire them due to our max acquire count
- int32_t mNumAvailableUnacquiredBuffers;
-
- // Number of frames acquired from consumer (debug only)
- // (as in aquireBuffer called, and release needs to be called)
- int32_t mNumOutstandingAcquires;
-
- // Acquire a buffer from the BQ and store it in |item| if successful
- // \return OK on success, or error on failure.
- status_t acquireBuffer_l(VideoBuffer *item);
-
- // Called when a buffer was acquired from the producer
- void onBufferAcquired_l(const VideoBuffer &buffer);
-
- // marks the buffer at the slot no longer cached, and accounts for the outstanding
- // acquire count. Returns true if the slot was populated; otherwise, false.
- bool discardBufferInSlot_l(slot_id i);
-
- // marks the buffer at the slot index no longer cached, and accounts for the outstanding
- // acquire count
- void discardBufferAtSlotIndex_l(ssize_t bsi);
-
- // release all acquired and unacquired available buffers
- // This method will return if it fails to acquire an unacquired available buffer, which will
- // leave mNumAvailableUnacquiredBuffers positive on return.
- void releaseAllAvailableBuffers_l();
-
- // returns whether we have any available buffers (acquired or not-yet-acquired)
- bool haveAvailableBuffers_l() const {
- return !mAvailableBuffers.empty() || mNumAvailableUnacquiredBuffers > 0;
- }
-
- // Codec buffers
- // -------------
-
- // When we queue buffers to the encoder, we must hold the references to the graphic buffers
- // in those buffers - as the producer may free the slots.
-
- typedef int32_t codec_buffer_id;
-
- // set of codec buffer ID-s of buffers available to fill
- List<codec_buffer_id> mFreeCodecBuffers;
-
- // maps codec buffer ID-s to buffer info submitted to the codec. Used to keep a reference for
- // the graphics buffer.
- KeyedVector<codec_buffer_id, std::shared_ptr<AcquiredBuffer>> mSubmittedCodecBuffers;
-
- // Processes the next acquired frame. If there is no available codec buffer, it returns false
- // without any further action.
- //
- // Otherwise, it consumes the next acquired frame and determines if it needs to be discarded or
- // dropped. If neither are needed, it submits it to the codec. It also saves the latest
- // non-dropped frame and submits it for repeat encoding (if this is enabled).
- //
- // \require there must be an acquired frame (i.e. we're in the onFrameAvailable callback,
- // or if we're in codecBufferEmptied and mNumFramesAvailable is nonzero).
- // \require codec must be executing
- // \returns true if acquired (and handled) the next frame. Otherwise, false.
- bool fillCodecBuffer_l();
-
- // Calculates the media timestamp for |item| and on success it submits the buffer to the codec,
- // while also keeping a reference for it in mSubmittedCodecBuffers.
- // Returns UNKNOWN_ERROR if the buffer was not submitted due to buffer timestamp. Otherwise,
- // it returns any submit success or error value returned by the codec.
- status_t submitBuffer_l(const VideoBuffer &item);
-
- // Submits an empty buffer, with the EOS flag set if there is an available codec buffer and
- // sets mEndOfStreamSent flag. Does nothing if there is no codec buffer available.
- void submitEndOfInputStream_l();
-
- // Set to true if we want to send end-of-stream after we run out of available frames from the
- // producer
- bool mEndOfStream;
-
- // Flag that the EOS was submitted to the encoder
- bool mEndOfStreamSent;
-
- // Dataspace for the last frame submitted to the codec
- android_dataspace mLastDataspace;
-
- // Default color aspects for this source
- int32_t mDefaultColorAspectsPacked;
-
- // called when the data space of the input buffer changes
- void onDataspaceChanged_l(android_dataspace dataspace, android_pixel_format pixelFormat);
-
- // Pointer back to the Omx node that created us. We send buffers here.
- sp<IOmxNodeWrapper> mOMXNode;
-
- // Set by omxExecuting() / omxIdling().
- bool mExecuting;
-
- bool mSuspended;
-
- // returns true if this source is unconditionally discarding acquired buffers at the moment
- // regardless of the metadata of those buffers
- bool areWeDiscardingAvailableBuffers_l();
-
- int64_t mLastFrameTimestampUs;
-
- // Our BufferQueue interfaces. mProducer is passed to the producer through
- // getIGraphicBufferProducer, and mConsumer is used internally to retrieve
- // the buffers queued by the producer.
- sp<IGraphicBufferProducer> mProducer;
- sp<IGraphicBufferConsumer> mConsumer;
-
- // The time to stop sending buffers.
- int64_t mStopTimeUs;
-
- struct ActionItem {
- typedef enum {
- PAUSE,
- RESUME,
- STOP
- } ActionType;
- ActionType mAction;
- int64_t mActionTimeUs;
- };
-
- // Maintain last action timestamp to ensure all the action timestamps are
- // monotonically increasing.
- int64_t mLastActionTimeUs;
-
- // An action queue that queue up all the actions sent to GraphicBufferSource.
- // STOP action should only show up at the end of the list as all the actions
- // after a STOP action will be discarded. mActionQueue is protected by mMutex.
- List<ActionItem> mActionQueue;
-
- ////
- friend struct AHandlerReflector<GraphicBufferSource>;
-
- enum {
- kWhatRepeatLastFrame, ///< queue last frame for reencoding
- };
- enum {
- kRepeatLastFrameCount = 10,
- };
-
- int64_t mSkipFramesBeforeNs;
-
- sp<FrameDropper> mFrameDropper;
-
- sp<ALooper> mLooper;
- sp<AHandlerReflector<GraphicBufferSource> > mReflector;
-
- // Repeat last frame feature
- // -------------------------
- // configuration parameter: repeat interval for frame repeating (<0 if repeating is disabled)
- int64_t mFrameRepeatIntervalUs;
-
- // current frame repeat generation - used to cancel a pending frame repeat
- int32_t mRepeatLastFrameGeneration;
-
- // number of times to repeat latest frame (0 = none)
- int32_t mOutstandingFrameRepeatCount;
-
- // The previous buffer should've been repeated but
- // no codec buffer was available at the time.
- bool mFrameRepeatBlockedOnCodecBuffer;
-
- // hold a reference to the last acquired (and not discarded) frame for frame repeating
- VideoBuffer mLatestBuffer;
-
- // queue last frame for reencode after the repeat interval.
- void queueFrameRepeat_l();
-
- // save |item| as the latest buffer and queue it for reencode (repeat)
- void setLatestBuffer_l(const VideoBuffer &item);
-
- // submit last frame to encoder and queue it for reencode
- // \return true if buffer was submitted, false if it wasn't (e.g. source is suspended, there
- // is no available codec buffer)
- bool repeatLatestBuffer_l();
-
- // Time lapse / slow motion configuration
- // --------------------------------------
-
- // desired frame rate for encoding - value <= 0 if undefined
- double mFps;
-
- // desired frame rate for capture - value <= 0 if undefined
- double mCaptureFps;
-
- // Time lapse mode is enabled if the capture frame rate is defined and it is
- // smaller than half the encoding frame rate (if defined). In this mode,
- // frames that come in between the capture interval (the reciprocal of the
- // capture frame rate) are dropped and the encoding timestamp is adjusted to
- // match the desired encoding frame rate.
- //
- // Slow motion mode is enabled if both encoding and capture frame rates are
- // defined and the encoding frame rate is less than half the capture frame
- // rate. In this mode, the source is expected to produce frames with an even
- // timestamp interval (after rounding) with the configured capture fps. The
- // first source timestamp is used as the source base time. Afterwards, the
- // timestamp of each source frame is snapped to the nearest expected capture
- // timestamp and scaled to match the configured encoding frame rate.
-
- // These modes must be enabled before using this source.
-
- // adjusted capture timestamp of the base frame
- int64_t mBaseCaptureUs;
-
- // adjusted encoding timestamp of the base frame
- int64_t mBaseFrameUs;
-
- // number of frames from the base time
- int64_t mFrameCount;
-
- // adjusted capture timestamp for previous frame (negative if there were
- // none)
- int64_t mPrevCaptureUs;
-
- // adjusted media timestamp for previous frame (negative if there were none)
- int64_t mPrevFrameUs;
-
- // desired offset between media time and capture time
- int64_t mInputBufferTimeOffsetUs;
-
- // Calculates and outputs the timestamp to use for a buffer with a specific buffer timestamp
- // |bufferTimestampNs|. Returns false on failure (buffer too close or timestamp is moving
- // backwards). Otherwise, stores the media timestamp in |*codecTimeUs| and returns true.
- //
- // This method takes into account the start time offset and any time lapse or slow motion time
- // adjustment requests.
- bool calculateCodecTimestamp_l(nsecs_t bufferTimeNs, int64_t *codecTimeUs);
-
- void onMessageReceived(const sp<AMessage> &msg);
-
- DISALLOW_EVIL_CONSTRUCTORS(GraphicBufferSource);
-};
-
-} // namespace android
-
-#endif // GRAPHIC_BUFFER_SOURCE_H_
diff --git a/media/libstagefright/omx/OMX.cpp b/media/libstagefright/omx/OMX.cpp
index 8c1141d..09c4019 100644
--- a/media/libstagefright/omx/OMX.cpp
+++ b/media/libstagefright/omx/OMX.cpp
@@ -22,15 +22,12 @@
#include <dlfcn.h>
-#include "../include/OMX.h"
-
-#include "../include/OMXNodeInstance.h"
-
+#include <media/stagefright/omx/OMX.h>
+#include <media/stagefright/omx/OMXNodeInstance.h>
+#include <media/stagefright/omx/BWGraphicBufferSource.h>
+#include <media/stagefright/omx/OMXMaster.h>
+#include <media/stagefright/omx/OMXUtils.h>
#include <media/stagefright/foundation/ADebug.h>
-#include "BWGraphicBufferSource.h"
-
-#include "OMXMaster.h"
-#include "OMXUtils.h"
namespace android {
@@ -118,15 +115,22 @@
return StatusFromOMXError(err);
}
instance->setHandle(handle);
- std::vector<AString> quirkVector;
- if (mParser.getQuirks(name, &quirkVector) == OK) {
+
+ // Find quirks from mParser
+ const auto& codec = mParser.getCodecMap().find(name);
+ if (codec == mParser.getCodecMap().cend()) {
+ ALOGW("Failed to obtain quirks for omx component '%s' from XML files",
+ name);
+ } else {
uint32_t quirks = 0;
- for (const AString quirk : quirkVector) {
+ for (const auto& quirk : codec->second.quirkSet) {
if (quirk == "requires-allocate-on-input-ports") {
- quirks |= kRequiresAllocateBufferOnInputPorts;
+ quirks |= OMXNodeInstance::
+ kRequiresAllocateBufferOnInputPorts;
}
if (quirk == "requires-allocate-on-output-ports") {
- quirks |= kRequiresAllocateBufferOnOutputPorts;
+ quirks |= OMXNodeInstance::
+ kRequiresAllocateBufferOnOutputPorts;
}
}
instance->setQuirks(quirks);
diff --git a/media/libstagefright/omx/OMXMaster.cpp b/media/libstagefright/omx/OMXMaster.cpp
index ac9b0c3..fd97fdc 100644
--- a/media/libstagefright/omx/OMXMaster.cpp
+++ b/media/libstagefright/omx/OMXMaster.cpp
@@ -18,15 +18,13 @@
#define LOG_TAG "OMXMaster"
#include <utils/Log.h>
-#include "OMXMaster.h"
-
-#include "SoftOMXPlugin.h"
+#include <media/stagefright/omx/OMXMaster.h>
+#include <media/stagefright/omx/SoftOMXPlugin.h>
+#include <media/stagefright/foundation/ADebug.h>
#include <dlfcn.h>
#include <fcntl.h>
-#include <media/stagefright/foundation/ADebug.h>
-
namespace android {
OMXMaster::OMXMaster()
diff --git a/media/libstagefright/omx/OMXMaster.h b/media/libstagefright/omx/OMXMaster.h
deleted file mode 100644
index 3f9c0ca..0000000
--- a/media/libstagefright/omx/OMXMaster.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef OMX_MASTER_H_
-
-#define OMX_MASTER_H_
-
-#include <OMXPluginBase.h>
-
-#include <utils/threads.h>
-#include <utils/KeyedVector.h>
-#include <utils/List.h>
-#include <utils/String8.h>
-
-namespace android {
-
-struct OMXMaster : public OMXPluginBase {
- OMXMaster();
- virtual ~OMXMaster();
-
- virtual OMX_ERRORTYPE makeComponentInstance(
- const char *name,
- const OMX_CALLBACKTYPE *callbacks,
- OMX_PTR appData,
- OMX_COMPONENTTYPE **component);
-
- virtual OMX_ERRORTYPE destroyComponentInstance(
- OMX_COMPONENTTYPE *component);
-
- virtual OMX_ERRORTYPE enumerateComponents(
- OMX_STRING name,
- size_t size,
- OMX_U32 index);
-
- virtual OMX_ERRORTYPE getRolesOfComponent(
- const char *name,
- Vector<String8> *roles);
-
-private:
- char mProcessName[16];
- Mutex mLock;
- List<OMXPluginBase *> mPlugins;
- KeyedVector<String8, OMXPluginBase *> mPluginByComponentName;
- KeyedVector<OMX_COMPONENTTYPE *, OMXPluginBase *> mPluginByInstance;
-
- void *mVendorLibHandle;
-
- void addVendorPlugin();
- void addPlugin(const char *libname);
- void addPlugin(OMXPluginBase *plugin);
- void clearPlugins();
-
- OMXMaster(const OMXMaster &);
- OMXMaster &operator=(const OMXMaster &);
-};
-
-} // namespace android
-
-#endif // OMX_MASTER_H_
diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp
index 22d7d27..015a148 100644
--- a/media/libstagefright/omx/OMXNodeInstance.cpp
+++ b/media/libstagefright/omx/OMXNodeInstance.cpp
@@ -20,20 +20,20 @@
#include <inttypes.h>
-#include "../include/OMXNodeInstance.h"
-#include "OMXMaster.h"
-#include "OMXUtils.h"
+#include <media/stagefright/omx/OMXNodeInstance.h>
+#include <media/stagefright/omx/OMXMaster.h>
+#include <media/stagefright/omx/OMXUtils.h>
#include <android/IOMXBufferSource.h>
-#include <OMX_Component.h>
-#include <OMX_IndexExt.h>
-#include <OMX_VideoExt.h>
-#include <OMX_AsString.h>
+#include <media/openmax/OMX_Component.h>
+#include <media/openmax/OMX_IndexExt.h>
+#include <media/openmax/OMX_VideoExt.h>
+#include <media/openmax/OMX_AsString.h>
#include <binder/IMemory.h>
#include <cutils/properties.h>
#include <gui/BufferQueue.h>
-#include <HardwareAPI.h>
+#include <media/hardware/HardwareAPI.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/ABuffer.h>
#include <media/stagefright/foundation/ColorUtils.h>
@@ -41,7 +41,7 @@
#include <utils/misc.h>
#include <utils/NativeHandle.h>
#include <media/OMXBuffer.h>
-#include <media/vndk/xmlparser/1.0/MediaCodecsXmlParser.h>
+#include <media/stagefright/xmlparser/MediaCodecsXmlParser.h>
#include <hidlmemory/mapping.h>
@@ -246,6 +246,15 @@
virtual ~CallbackDispatcher();
private:
+ enum {
+ // This is used for frame_rendered message batching, which will eventually end up in a
+ // single AMessage in MediaCodec when it is signaled to the app. AMessage can contain
+ // up-to 64 key-value pairs, and each frame_rendered message uses 2 keys, so the max
+ // value for this would be 32. Nonetheless, limit this to 12 to which gives at least 10
+ // mseconds of batching at 120Hz.
+ kMaxQueueSize = 12,
+ };
+
Mutex mLock;
sp<OMXNodeInstance> const mOwner;
@@ -290,7 +299,7 @@
Mutex::Autolock autoLock(mLock);
mQueue.push_back(msg);
- if (realTime) {
+ if (realTime || mQueue.size() >= kMaxQueueSize) {
mQueueChanged.signal();
}
}
@@ -363,6 +372,8 @@
mPortMode[1] = IOMX::kPortModePresetByteBuffer;
mSecureBufferType[0] = kSecureBufferTypeUnknown;
mSecureBufferType[1] = kSecureBufferTypeUnknown;
+ mGraphicBufferEnabled[0] = false;
+ mGraphicBufferEnabled[1] = false;
mIsSecure = AString(name).endsWith(".secure");
mLegacyAdaptiveExperiment = ADebug::isExperimentEnabled("legacy-adaptive");
}
@@ -486,6 +497,9 @@
LOG_ALWAYS_FATAL("unknown state %s(%#x).", asString(state), state);
break;
}
+
+ Mutex::Autolock _l(mLock);
+
status_t err = mOwner->freeNode(this);
mDispatcher.clear();
@@ -665,6 +679,11 @@
return BAD_VALUE;
}
+ if (mSailed || mNumPortBuffers[portIndex] > 0) {
+ android_errorWriteLog(0x534e4554, "29422020");
+ return INVALID_OPERATION;
+ }
+
CLOG_CONFIG(setPortMode, "%s(%d), port %d", asString(mode), mode, portIndex);
switch (mode) {
@@ -796,6 +815,12 @@
} else if (mSecureBufferType[portIndex] == kSecureBufferTypeUnknown) {
mSecureBufferType[portIndex] = kSecureBufferTypeOpaque;
}
+ } else {
+ if (err == OMX_ErrorNone) {
+ mGraphicBufferEnabled[portIndex] = enable;
+ } else if (enable) {
+ mGraphicBufferEnabled[portIndex] = false;
+ }
}
} else {
CLOG_ERROR_IF(enable, getExtensionIndex, err, "%s", name);
@@ -1064,6 +1089,12 @@
OMX_ERRORTYPE err = OMX_ErrorNone;
bool isMetadata = mMetadataType[portIndex] != kMetadataBufferTypeInvalid;
+ if (!isMetadata && mGraphicBufferEnabled[portIndex]) {
+ ALOGE("b/62948670");
+ android_errorWriteLog(0x534e4554, "62948670");
+ return INVALID_OPERATION;
+ }
+
size_t paramsSize;
void* paramsPointer;
if (params != NULL && hParams != NULL) {
@@ -1249,6 +1280,13 @@
portIndex, graphicBuffer, buffer);
}
+ if (!mGraphicBufferEnabled[portIndex]) {
+ // Report error if this is not in graphic buffer mode.
+ ALOGE("b/62948670");
+ android_errorWriteLog(0x534e4554, "62948670");
+ return INVALID_OPERATION;
+ }
+
// See if the newer version of the extension is present.
OMX_INDEXTYPE index;
if (OMX_GetExtensionIndex(
@@ -2168,8 +2206,8 @@
msg.fenceFd = -1;
msg.u.render_data.timestamp = renderData[i].nMediaTimeUs;
msg.u.render_data.nanoTime = renderData[i].nSystemTimeNs;
-
- instance->mDispatcher->post(msg, false /* realTime */);
+ bool realTime = msg.u.render_data.timestamp == INT64_MAX;
+ instance->mDispatcher->post(msg, realTime);
}
return OMX_ErrorNone;
}
diff --git a/media/libstagefright/omx/OMXStore.cpp b/media/libstagefright/omx/OMXStore.cpp
new file mode 100644
index 0000000..345336d
--- /dev/null
+++ b/media/libstagefright/omx/OMXStore.cpp
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "OMXStore"
+#include <utils/Log.h>
+
+#include <media/stagefright/omx/OMXUtils.h>
+#include <media/stagefright/omx/OMX.h>
+#include <media/stagefright/omx/OMXStore.h>
+#include <media/stagefright/xmlparser/MediaCodecsXmlParser.h>
+
+#include <map>
+#include <string>
+
+namespace android {
+
+namespace {
+ struct RoleProperties {
+ std::string type;
+ bool isEncoder;
+ bool preferPlatformNodes;
+ std::multimap<size_t, IOMXStore::NodeInfo> nodeList;
+ };
+} // Unnamed namespace
+
+OMXStore::OMXStore(
+ const char* owner,
+ const char* const* searchDirs,
+ const char* mainXmlName,
+ const char* performanceXmlName,
+ const char* profilingResultsXmlPath) {
+ MediaCodecsXmlParser parser(
+ searchDirs,
+ mainXmlName,
+ performanceXmlName,
+ profilingResultsXmlPath);
+ mParsingStatus = parser.getParsingStatus();
+
+ const auto& serviceAttributeMap = parser.getServiceAttributeMap();
+ mServiceAttributeList.reserve(serviceAttributeMap.size());
+ for (const auto& attributePair : serviceAttributeMap) {
+ Attribute attribute;
+ attribute.key = attributePair.first;
+ attribute.value = attributePair.second;
+ mServiceAttributeList.push_back(std::move(attribute));
+ }
+
+ const auto& roleMap = parser.getRoleMap();
+ mRoleList.reserve(roleMap.size());
+ for (const auto& rolePair : roleMap) {
+ RoleInfo role;
+ role.role = rolePair.first;
+ role.type = rolePair.second.type;
+ role.isEncoder = rolePair.second.isEncoder;
+ // TODO: Currently, preferPlatformNodes information is not available in
+ // the xml file. Once we have a way to provide this information, it
+ // should be parsed properly.
+ role.preferPlatformNodes = rolePair.first.compare(0, 5, "audio") == 0;
+ std::vector<NodeInfo>& nodeList = role.nodes;
+ nodeList.reserve(rolePair.second.nodeList.size());
+ for (const auto& nodePair : rolePair.second.nodeList) {
+ NodeInfo node;
+ node.name = nodePair.second.name;
+ node.owner = owner;
+ std::vector<Attribute>& attributeList = node.attributes;
+ attributeList.reserve(nodePair.second.attributeList.size());
+ for (const auto& attributePair : nodePair.second.attributeList) {
+ Attribute attribute;
+ attribute.key = attributePair.first;
+ attribute.value = attributePair.second;
+ attributeList.push_back(std::move(attribute));
+ }
+ nodeList.push_back(std::move(node));
+ }
+ mRoleList.push_back(std::move(role));
+ }
+
+ mPrefix = parser.getCommonPrefix();
+}
+
+status_t OMXStore::listServiceAttributes(std::vector<Attribute>* attributes) {
+ *attributes = mServiceAttributeList;
+ return mParsingStatus;
+}
+
+status_t OMXStore::getNodePrefix(std::string* prefix) {
+ *prefix = mPrefix;
+ return mParsingStatus;
+}
+
+status_t OMXStore::listRoles(std::vector<RoleInfo>* roleList) {
+ *roleList = mRoleList;
+ return mParsingStatus;
+}
+
+status_t OMXStore::getOmx(const std::string& name, sp<IOMX>* omx) {
+ *omx = new OMX();
+ return NO_ERROR;
+}
+
+OMXStore::~OMXStore() {
+}
+
+} // namespace android
+
diff --git a/media/libstagefright/omx/OMXUtils.cpp b/media/libstagefright/omx/OMXUtils.cpp
index a66d565..5894837 100644
--- a/media/libstagefright/omx/OMXUtils.cpp
+++ b/media/libstagefright/omx/OMXUtils.cpp
@@ -19,13 +19,13 @@
#include <string.h>
-#include <media/hardware/HardwareAPI.h>
+#include <media/stagefright/omx/OMXUtils.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/AUtils.h>
#include <media/stagefright/MediaErrors.h>
+#include <media/hardware/HardwareAPI.h>
#include <media/MediaDefs.h>
#include <system/graphics-base.h>
-#include "OMXUtils.h"
namespace android {
diff --git a/media/libstagefright/omx/SimpleSoftOMXComponent.cpp b/media/libstagefright/omx/SimpleSoftOMXComponent.cpp
index 5bae7e8..1ba5852 100644
--- a/media/libstagefright/omx/SimpleSoftOMXComponent.cpp
+++ b/media/libstagefright/omx/SimpleSoftOMXComponent.cpp
@@ -18,8 +18,7 @@
#define LOG_TAG "SimpleSoftOMXComponent"
#include <utils/Log.h>
-#include "include/SimpleSoftOMXComponent.h"
-
+#include <media/stagefright/omx/SimpleSoftOMXComponent.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/ALooper.h>
#include <media/stagefright/foundation/AMessage.h>
diff --git a/media/libstagefright/omx/SoftOMXComponent.cpp b/media/libstagefright/omx/SoftOMXComponent.cpp
index df978f8..ee269e1 100644
--- a/media/libstagefright/omx/SoftOMXComponent.cpp
+++ b/media/libstagefright/omx/SoftOMXComponent.cpp
@@ -18,8 +18,7 @@
#define LOG_TAG "SoftOMXComponent"
#include <utils/Log.h>
-#include "include/SoftOMXComponent.h"
-
+#include <media/stagefright/omx/SoftOMXComponent.h>
#include <media/stagefright/foundation/ADebug.h>
namespace android {
diff --git a/media/libstagefright/omx/SoftOMXPlugin.cpp b/media/libstagefright/omx/SoftOMXPlugin.cpp
index fccb12b..4946ada 100644
--- a/media/libstagefright/omx/SoftOMXPlugin.cpp
+++ b/media/libstagefright/omx/SoftOMXPlugin.cpp
@@ -18,8 +18,8 @@
#define LOG_TAG "SoftOMXPlugin"
#include <utils/Log.h>
-#include "SoftOMXPlugin.h"
-#include "include/SoftOMXComponent.h"
+#include <media/stagefright/omx/SoftOMXPlugin.h>
+#include <media/stagefright/omx/SoftOMXComponent.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/AString.h>
@@ -85,7 +85,21 @@
libName.append(kComponents[i].mLibNameSuffix);
libName.append(".so");
- void *libHandle = dlopen(libName.c_str(), RTLD_NOW);
+ // RTLD_NODELETE means we keep the shared library around forever.
+ // this eliminates thrashing during sequences like loading soundpools.
+ // It also leaves the rest of the logic around the dlopen()/dlclose()
+ // calls in this file unchanged.
+ //
+ // Implications of the change:
+ // -- the codec process (where this happens) will have a slightly larger
+ // long-term memory footprint as it accumulates the loaded shared libraries.
+ // This is expected to be a small amount of memory.
+ // -- plugin codecs can no longer (and never should have) depend on a
+ // free reset of any static data as the library would have crossed
+ // a dlclose/dlopen cycle.
+ //
+
+ void *libHandle = dlopen(libName.c_str(), RTLD_NOW|RTLD_NODELETE);
if (libHandle == NULL) {
ALOGE("unable to dlopen %s: %s", libName.c_str(), dlerror());
diff --git a/media/libstagefright/omx/SoftOMXPlugin.h b/media/libstagefright/omx/SoftOMXPlugin.h
deleted file mode 100644
index c89cd87..0000000
--- a/media/libstagefright/omx/SoftOMXPlugin.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SOFT_OMX_PLUGIN_H_
-
-#define SOFT_OMX_PLUGIN_H_
-
-#include <media/stagefright/foundation/ABase.h>
-#include <OMXPluginBase.h>
-
-namespace android {
-
-struct SoftOMXPlugin : public OMXPluginBase {
- SoftOMXPlugin();
-
- virtual OMX_ERRORTYPE makeComponentInstance(
- const char *name,
- const OMX_CALLBACKTYPE *callbacks,
- OMX_PTR appData,
- OMX_COMPONENTTYPE **component);
-
- virtual OMX_ERRORTYPE destroyComponentInstance(
- OMX_COMPONENTTYPE *component);
-
- virtual OMX_ERRORTYPE enumerateComponents(
- OMX_STRING name,
- size_t size,
- OMX_U32 index);
-
- virtual OMX_ERRORTYPE getRolesOfComponent(
- const char *name,
- Vector<String8> *roles);
-
-private:
- DISALLOW_EVIL_CONSTRUCTORS(SoftOMXPlugin);
-};
-
-} // namespace android
-
-#endif // SOFT_OMX_PLUGIN_H_
diff --git a/media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp b/media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp
index 920dd18..cb811a0 100644
--- a/media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp
+++ b/media/libstagefright/omx/SoftVideoDecoderOMXComponent.cpp
@@ -20,14 +20,14 @@
#define LOG_TAG "SoftVideoDecoderOMXComponent"
#include <utils/Log.h>
-#include "include/SoftVideoDecoderOMXComponent.h"
+#include <media/stagefright/omx/SoftVideoDecoderOMXComponent.h>
-#include <media/hardware/HardwareAPI.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/ALooper.h>
#include <media/stagefright/foundation/AMessage.h>
#include <media/stagefright/foundation/AUtils.h>
-#include <media/stagefright/MediaDefs.h>
+#include <media/hardware/HardwareAPI.h>
+#include <media/MediaDefs.h>
namespace android {
@@ -182,11 +182,11 @@
uint32_t SoftVideoDecoderOMXComponent::outputBufferWidth() {
- return mIsAdaptive ? mAdaptiveMaxWidth : mWidth;
+ return max(mIsAdaptive ? mAdaptiveMaxWidth : 0, mWidth);
}
uint32_t SoftVideoDecoderOMXComponent::outputBufferHeight() {
- return mIsAdaptive ? mAdaptiveMaxHeight : mHeight;
+ return max(mIsAdaptive ? mAdaptiveMaxHeight : 0, mHeight);
}
void SoftVideoDecoderOMXComponent::handlePortSettingsChange(
diff --git a/media/libstagefright/omx/SoftVideoEncoderOMXComponent.cpp b/media/libstagefright/omx/SoftVideoEncoderOMXComponent.cpp
index 7ecfbbb..f33bdc0 100644
--- a/media/libstagefright/omx/SoftVideoEncoderOMXComponent.cpp
+++ b/media/libstagefright/omx/SoftVideoEncoderOMXComponent.cpp
@@ -21,25 +21,22 @@
#include <utils/Log.h>
#include <utils/misc.h>
-#include "include/SoftVideoEncoderOMXComponent.h"
-
-#include <media/hardware/HardwareAPI.h>
+#include <media/stagefright/omx/SoftVideoEncoderOMXComponent.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/ALooper.h>
#include <media/stagefright/foundation/AMessage.h>
#include <media/stagefright/foundation/AUtils.h>
-#include <media/stagefright/MediaDefs.h>
+#include <media/hardware/HardwareAPI.h>
+#include <media/openmax/OMX_IndexExt.h>
+#include <media/MediaDefs.h>
#include <ui/Fence.h>
#include <ui/GraphicBufferMapper.h>
#include <ui/Rect.h>
#include <hardware/gralloc.h>
-
#include <nativebase/nativebase.h>
-#include <OMX_IndexExt.h>
-
namespace android {
const static OMX_COLOR_FORMATTYPE kSupportedColorFormats[] = {
diff --git a/media/libstagefright/omx/include/media/stagefright/omx/1.0/Conversion.h b/media/libstagefright/omx/include/media/stagefright/omx/1.0/Conversion.h
new file mode 100644
index 0000000..8d8a2d9
--- /dev/null
+++ b/media/libstagefright/omx/include/media/stagefright/omx/1.0/Conversion.h
@@ -0,0 +1,2181 @@
+/*
+ * Copyright 2016, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_MEDIA_OMX_V1_0__CONVERSION_H
+#define ANDROID_HARDWARE_MEDIA_OMX_V1_0__CONVERSION_H
+
+#include <vector>
+#include <list>
+
+#include <unistd.h>
+
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+#include <hidlmemory/mapping.h>
+
+#include <binder/Binder.h>
+#include <binder/Status.h>
+#include <ui/FenceTime.h>
+#include <cutils/native_handle.h>
+#include <gui/IGraphicBufferProducer.h>
+
+#include <media/OMXFenceParcelable.h>
+#include <media/OMXBuffer.h>
+#include <media/hardware/VideoAPI.h>
+
+#include <android/hidl/memory/1.0/IMemory.h>
+#include <android/hardware/graphics/bufferqueue/1.0/IProducerListener.h>
+#include <android/hardware/media/omx/1.0/types.h>
+#include <android/hardware/media/omx/1.0/IOmx.h>
+#include <android/hardware/media/omx/1.0/IOmxNode.h>
+#include <android/hardware/media/omx/1.0/IOmxBufferSource.h>
+#include <android/hardware/media/omx/1.0/IGraphicBufferSource.h>
+#include <android/hardware/media/omx/1.0/IOmxObserver.h>
+
+#include <android/IGraphicBufferSource.h>
+#include <android/IOMXBufferSource.h>
+
+namespace android {
+namespace hardware {
+namespace media {
+namespace omx {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_handle;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+
+using ::android::String8;
+using ::android::OMXFenceParcelable;
+
+using ::android::hardware::media::omx::V1_0::Message;
+using ::android::omx_message;
+
+using ::android::hardware::media::omx::V1_0::ColorAspects;
+using ::android::hardware::media::V1_0::Rect;
+using ::android::hardware::media::V1_0::Region;
+
+using ::android::hardware::graphics::common::V1_0::Dataspace;
+
+using ::android::hardware::graphics::common::V1_0::PixelFormat;
+
+using ::android::OMXBuffer;
+
+using ::android::hardware::media::V1_0::AnwBuffer;
+using ::android::GraphicBuffer;
+
+using ::android::hardware::media::omx::V1_0::IOmx;
+using ::android::IOMX;
+
+using ::android::hardware::media::omx::V1_0::IOmxNode;
+using ::android::IOMXNode;
+
+using ::android::hardware::media::omx::V1_0::IOmxObserver;
+using ::android::IOMXObserver;
+
+using ::android::hardware::media::omx::V1_0::IOmxBufferSource;
+using ::android::IOMXBufferSource;
+
+typedef ::android::hardware::graphics::bufferqueue::V1_0::IGraphicBufferProducer
+ HGraphicBufferProducer;
+typedef ::android::IGraphicBufferProducer
+ BGraphicBufferProducer;
+
+// native_handle_t helper functions.
+
+/**
+ * \brief Take an fd and create a native handle containing only the given fd.
+ * The created handle will need to be deleted manually with
+ * `native_handle_delete()`.
+ *
+ * \param[in] fd The source file descriptor (of type `int`).
+ * \return The create `native_handle_t*` that contains the given \p fd. If the
+ * supplied \p fd is negative, the created native handle will contain no file
+ * descriptors.
+ *
+ * If the native handle cannot be created, the return value will be
+ * `nullptr`.
+ *
+ * This function does not duplicate the file descriptor.
+ */
+inline native_handle_t* native_handle_create_from_fd(int fd) {
+ if (fd < 0) {
+ return native_handle_create(0, 0);
+ }
+ native_handle_t* nh = native_handle_create(1, 0);
+ if (nh == nullptr) {
+ return nullptr;
+ }
+ nh->data[0] = fd;
+ return nh;
+}
+
+/**
+ * \brief Extract a file descriptor from a native handle.
+ *
+ * \param[in] nh The source `native_handle_t*`.
+ * \param[in] index The index of the file descriptor in \p nh to read from. This
+ * input has the default value of `0`.
+ * \return The `index`-th file descriptor in \p nh. If \p nh does not have
+ * enough file descriptors, the returned value will be `-1`.
+ *
+ * This function does not duplicate the file descriptor.
+ */
+inline int native_handle_read_fd(native_handle_t const* nh, int index = 0) {
+ return ((nh == nullptr) || (nh->numFds == 0) ||
+ (nh->numFds <= index) || (index < 0)) ?
+ -1 : nh->data[index];
+}
+
+/**
+ * Conversion functions
+ * ====================
+ *
+ * There are two main directions of conversion:
+ * - `inTargetType(...)`: Create a wrapper whose lifetime depends on the
+ * input. The wrapper has type `TargetType`.
+ * - `toTargetType(...)`: Create a standalone object of type `TargetType` that
+ * corresponds to the input. The lifetime of the output does not depend on the
+ * lifetime of the input.
+ * - `wrapIn(TargetType*, ...)`: Same as `inTargetType()`, but for `TargetType`
+ * that cannot be copied and/or moved efficiently, or when there are multiple
+ * output arguments.
+ * - `convertTo(TargetType*, ...)`: Same as `toTargetType()`, but for
+ * `TargetType` that cannot be copied and/or moved efficiently, or when there
+ * are multiple output arguments.
+ *
+ * `wrapIn()` and `convertTo()` functions will take output arguments before
+ * input arguments. Some of these functions might return a value to indicate
+ * success or error.
+ *
+ * In converting or wrapping something as a Treble type that contains a
+ * `hidl_handle`, `native_handle_t*` will need to be created and returned as
+ * an additional output argument, hence only `wrapIn()` or `convertTo()` would
+ * be available. The caller must call `native_handle_delete()` to deallocate the
+ * returned native handle when it is no longer needed.
+ *
+ * For types that contain file descriptors, `inTargetType()` and `wrapAs()` do
+ * not perform duplication of file descriptors, while `toTargetType()` and
+ * `convertTo()` do.
+ */
+
+/**
+ * \brief Convert `Return<void>` to `binder::Status`.
+ *
+ * \param[in] t The source `Return<void>`.
+ * \return The corresponding `binder::Status`.
+ */
+// convert: Return<void> -> ::android::binder::Status
+inline ::android::binder::Status toBinderStatus(
+ Return<void> const& t) {
+ return ::android::binder::Status::fromExceptionCode(
+ t.isOk() ? OK : UNKNOWN_ERROR,
+ t.description().c_str());
+}
+
+/**
+ * \brief Convert `Return<Status>` to `status_t`. This is for legacy binder
+ * calls.
+ *
+ * \param[in] t The source `Return<Status>`.
+ * \return The corresponding `status_t`.
+ *
+ * This function first check if \p t has a transport error. If it does, then the
+ * return value is the transport error code. Otherwise, the return value is
+ * converted from `Status` contained inside \p t.
+ *
+ * Note:
+ * - This `Status` is omx-specific. It is defined in `types.hal`.
+ * - The name of this function is not `convert`.
+ */
+// convert: Status -> status_t
+inline status_t toStatusT(Return<Status> const& t) {
+ return t.isOk() ? static_cast<status_t>(static_cast<Status>(t)) : UNKNOWN_ERROR;
+}
+
+/**
+ * \brief Convert `Return<void>` to `status_t`. This is for legacy binder calls.
+ *
+ * \param[in] t The source `Return<void>`.
+ * \return The corresponding `status_t`.
+ */
+// convert: Return<void> -> status_t
+inline status_t toStatusT(Return<void> const& t) {
+ return t.isOk() ? OK : UNKNOWN_ERROR;
+}
+
+/**
+ * \brief Convert `Status` to `status_t`. This is for legacy binder calls.
+ *
+ * \param[in] t The source `Status`.
+ * \return the corresponding `status_t`.
+ */
+// convert: Status -> status_t
+inline status_t toStatusT(Status const& t) {
+ return static_cast<status_t>(t);
+}
+
+/**
+ * \brief Convert `status_t` to `Status`.
+ *
+ * \param[in] l The source `status_t`.
+ * \return The corresponding `Status`.
+ */
+// convert: status_t -> Status
+inline Status toStatus(status_t l) {
+ return static_cast<Status>(l);
+}
+
+/**
+ * \brief Wrap `native_handle_t*` in `hidl_handle`.
+ *
+ * \param[in] nh The source `native_handle_t*`.
+ * \return The `hidl_handle` that points to \p nh.
+ */
+// wrap: native_handle_t* -> hidl_handle
+inline hidl_handle inHidlHandle(native_handle_t const* nh) {
+ return hidl_handle(nh);
+}
+
+/**
+ * \brief Wrap an `omx_message` and construct the corresponding `Message`.
+ *
+ * \param[out] t The wrapper of type `Message`.
+ * \param[out] nh The native_handle_t referred to by `t->fence`.
+ * \param[in] l The source `omx_message`.
+ * \return `true` if the wrapping is successful; `false` otherwise.
+ *
+ * Upon success, \p nh will be created to hold the file descriptor stored in
+ * `l.fenceFd`, and `t->fence` will point to \p nh. \p nh will need to be
+ * destroyed manually by `native_handle_delete()` when \p t is no longer needed.
+ *
+ * Upon failure, \p nh will not be created and will not need to be deleted. \p t
+ * will be invalid.
+ */
+// wrap, omx_message -> Message, native_handle_t*
+inline bool wrapAs(Message* t, native_handle_t** nh, omx_message const& l) {
+ *nh = native_handle_create_from_fd(l.fenceFd);
+ if (!*nh) {
+ return false;
+ }
+ t->fence = *nh;
+ switch (l.type) {
+ case omx_message::EVENT:
+ t->type = Message::Type::EVENT;
+ t->data.eventData.event = uint32_t(l.u.event_data.event);
+ t->data.eventData.data1 = l.u.event_data.data1;
+ t->data.eventData.data2 = l.u.event_data.data2;
+ t->data.eventData.data3 = l.u.event_data.data3;
+ t->data.eventData.data4 = l.u.event_data.data4;
+ break;
+ case omx_message::EMPTY_BUFFER_DONE:
+ t->type = Message::Type::EMPTY_BUFFER_DONE;
+ t->data.bufferData.buffer = l.u.buffer_data.buffer;
+ break;
+ case omx_message::FILL_BUFFER_DONE:
+ t->type = Message::Type::FILL_BUFFER_DONE;
+ t->data.extendedBufferData.buffer = l.u.extended_buffer_data.buffer;
+ t->data.extendedBufferData.rangeOffset =
+ l.u.extended_buffer_data.range_offset;
+ t->data.extendedBufferData.rangeLength =
+ l.u.extended_buffer_data.range_length;
+ t->data.extendedBufferData.flags = l.u.extended_buffer_data.flags;
+ t->data.extendedBufferData.timestampUs =
+ l.u.extended_buffer_data.timestamp;
+ break;
+ case omx_message::FRAME_RENDERED:
+ t->type = Message::Type::FRAME_RENDERED;
+ t->data.renderData.timestampUs = l.u.render_data.timestamp;
+ t->data.renderData.systemTimeNs = l.u.render_data.nanoTime;
+ break;
+ default:
+ native_handle_delete(*nh);
+ return false;
+ }
+ return true;
+}
+
+/**
+ * \brief Wrap a `Message` inside an `omx_message`.
+ *
+ * \param[out] l The wrapper of type `omx_message`.
+ * \param[in] t The source `Message`.
+ * \return `true` if the wrapping is successful; `false` otherwise.
+ */
+// wrap: Message -> omx_message
+inline bool wrapAs(omx_message* l, Message const& t) {
+ l->fenceFd = native_handle_read_fd(t.fence);
+ switch (t.type) {
+ case Message::Type::EVENT:
+ l->type = omx_message::EVENT;
+ l->u.event_data.event = OMX_EVENTTYPE(t.data.eventData.event);
+ l->u.event_data.data1 = t.data.eventData.data1;
+ l->u.event_data.data2 = t.data.eventData.data2;
+ l->u.event_data.data3 = t.data.eventData.data3;
+ l->u.event_data.data4 = t.data.eventData.data4;
+ break;
+ case Message::Type::EMPTY_BUFFER_DONE:
+ l->type = omx_message::EMPTY_BUFFER_DONE;
+ l->u.buffer_data.buffer = t.data.bufferData.buffer;
+ break;
+ case Message::Type::FILL_BUFFER_DONE:
+ l->type = omx_message::FILL_BUFFER_DONE;
+ l->u.extended_buffer_data.buffer = t.data.extendedBufferData.buffer;
+ l->u.extended_buffer_data.range_offset =
+ t.data.extendedBufferData.rangeOffset;
+ l->u.extended_buffer_data.range_length =
+ t.data.extendedBufferData.rangeLength;
+ l->u.extended_buffer_data.flags = t.data.extendedBufferData.flags;
+ l->u.extended_buffer_data.timestamp =
+ t.data.extendedBufferData.timestampUs;
+ break;
+ case Message::Type::FRAME_RENDERED:
+ l->type = omx_message::FRAME_RENDERED;
+ l->u.render_data.timestamp = t.data.renderData.timestampUs;
+ l->u.render_data.nanoTime = t.data.renderData.systemTimeNs;
+ break;
+ default:
+ return false;
+ }
+ return true;
+}
+
+/**
+ * \brief Similar to `wrapTo(omx_message*, Message const&)`, but the output will
+ * have an extended lifetime.
+ *
+ * \param[out] l The output `omx_message`.
+ * \param[in] t The source `Message`.
+ * \return `true` if the conversion is successful; `false` otherwise.
+ *
+ * This function calls `wrapto()`, then attempts to duplicate the file
+ * descriptor for the fence if it is not `-1`. If duplication fails, `false`
+ * will be returned.
+ */
+// convert: Message -> omx_message
+inline bool convertTo(omx_message* l, Message const& t) {
+ if (!wrapAs(l, t)) {
+ return false;
+ }
+ if (l->fenceFd == -1) {
+ return true;
+ }
+ l->fenceFd = dup(l->fenceFd);
+ return l->fenceFd != -1;
+}
+
+/**
+ * \brief Wrap an `OMXFenceParcelable` inside a `hidl_handle`.
+ *
+ * \param[out] t The wrapper of type `hidl_handle`.
+ * \param[out] nh The native handle created to hold the file descriptor inside
+ * \p l.
+ * \param[in] l The source `OMXFenceParcelable`, which essentially contains one
+ * file descriptor.
+ * \return `true` if \p t and \p nh are successfully created to wrap around \p
+ * l; `false` otherwise.
+ *
+ * On success, \p nh needs to be deleted by the caller with
+ * `native_handle_delete()` after \p t and \p nh are no longer needed.
+ *
+ * On failure, \p nh will not need to be deleted, and \p t will hold an invalid
+ * value.
+ */
+// wrap: OMXFenceParcelable -> hidl_handle, native_handle_t*
+inline bool wrapAs(hidl_handle* t, native_handle_t** nh,
+ OMXFenceParcelable const& l) {
+ *nh = native_handle_create_from_fd(l.get());
+ if (!*nh) {
+ return false;
+ }
+ *t = *nh;
+ return true;
+}
+
+/**
+ * \brief Wrap a `hidl_handle` inside an `OMXFenceParcelable`.
+ *
+ * \param[out] l The wrapper of type `OMXFenceParcelable`.
+ * \param[in] t The source `hidl_handle`.
+ */
+// wrap: hidl_handle -> OMXFenceParcelable
+inline void wrapAs(OMXFenceParcelable* l, hidl_handle const& t) {
+ l->mFenceFd = native_handle_read_fd(t);
+}
+
+/**
+ * \brief Convert a `hidl_handle` to `OMXFenceParcelable`. If `hidl_handle`
+ * contains file descriptors, the first file descriptor will be duplicated and
+ * stored in the output `OMXFenceParcelable`.
+ *
+ * \param[out] l The output `OMXFenceParcelable`.
+ * \param[in] t The input `hidl_handle`.
+ * \return `false` if \p t contains a valid file descriptor but duplication
+ * fails; `true` otherwise.
+ */
+// convert: hidl_handle -> OMXFenceParcelable
+inline bool convertTo(OMXFenceParcelable* l, hidl_handle const& t) {
+ int fd = native_handle_read_fd(t);
+ if (fd != -1) {
+ fd = dup(fd);
+ if (fd == -1) {
+ return false;
+ }
+ }
+ l->mFenceFd = fd;
+ return true;
+}
+
+/**
+ * \brief Convert `::android::ColorAspects` to `ColorAspects`.
+ *
+ * \param[in] l The source `::android::ColorAspects`.
+ * \return The corresponding `ColorAspects`.
+ */
+// convert: ::android::ColorAspects -> ColorAspects
+inline ColorAspects toHardwareColorAspects(::android::ColorAspects const& l) {
+ return ColorAspects{
+ static_cast<ColorAspects::Range>(l.mRange),
+ static_cast<ColorAspects::Primaries>(l.mPrimaries),
+ static_cast<ColorAspects::Transfer>(l.mTransfer),
+ static_cast<ColorAspects::MatrixCoeffs>(l.mMatrixCoeffs)};
+}
+
+/**
+ * \brief Convert `int32_t` to `ColorAspects`.
+ *
+ * \param[in] l The source `int32_t`.
+ * \return The corresponding `ColorAspects`.
+ */
+// convert: int32_t -> ColorAspects
+inline ColorAspects toHardwareColorAspects(int32_t l) {
+ return ColorAspects{
+ static_cast<ColorAspects::Range>((l >> 24) & 0xFF),
+ static_cast<ColorAspects::Primaries>((l >> 16) & 0xFF),
+ static_cast<ColorAspects::Transfer>(l & 0xFF),
+ static_cast<ColorAspects::MatrixCoeffs>((l >> 8) & 0xFF)};
+}
+
+/**
+ * \brief Convert `ColorAspects` to `::android::ColorAspects`.
+ *
+ * \param[in] t The source `ColorAspects`.
+ * \return The corresponding `::android::ColorAspects`.
+ */
+// convert: ColorAspects -> ::android::ColorAspects
+inline int32_t toCompactColorAspects(ColorAspects const& t) {
+ return static_cast<int32_t>(
+ (static_cast<uint32_t>(t.range) << 24) |
+ (static_cast<uint32_t>(t.primaries) << 16) |
+ (static_cast<uint32_t>(t.transfer)) |
+ (static_cast<uint32_t>(t.matrixCoeffs) << 8));
+}
+
+/**
+ * \brief Convert `int32_t` to `Dataspace`.
+ *
+ * \param[in] l The source `int32_t`.
+ * \result The corresponding `Dataspace`.
+ */
+// convert: int32_t -> Dataspace
+inline Dataspace toHardwareDataspace(int32_t l) {
+ return static_cast<Dataspace>(l);
+}
+
+/**
+ * \brief Convert `Dataspace` to `int32_t`.
+ *
+ * \param[in] t The source `Dataspace`.
+ * \result The corresponding `int32_t`.
+ */
+// convert: Dataspace -> int32_t
+inline int32_t toRawDataspace(Dataspace const& t) {
+ return static_cast<int32_t>(t);
+}
+
+/**
+ * \brief Wrap an opaque buffer inside a `hidl_vec<uint8_t>`.
+ *
+ * \param[in] l The pointer to the beginning of the opaque buffer.
+ * \param[in] size The size of the buffer.
+ * \return A `hidl_vec<uint8_t>` that points to the buffer.
+ */
+// wrap: void*, size_t -> hidl_vec<uint8_t>
+inline hidl_vec<uint8_t> inHidlBytes(void const* l, size_t size) {
+ hidl_vec<uint8_t> t;
+ t.setToExternal(static_cast<uint8_t*>(const_cast<void*>(l)), size, false);
+ return t;
+}
+
+/**
+ * \brief Create a `hidl_vec<uint8_t>` that is a copy of an opaque buffer.
+ *
+ * \param[in] l The pointer to the beginning of the opaque buffer.
+ * \param[in] size The size of the buffer.
+ * \return A `hidl_vec<uint8_t>` that is a copy of the input buffer.
+ */
+// convert: void*, size_t -> hidl_vec<uint8_t>
+inline hidl_vec<uint8_t> toHidlBytes(void const* l, size_t size) {
+ hidl_vec<uint8_t> t;
+ t.resize(size);
+ uint8_t const* src = static_cast<uint8_t const*>(l);
+ std::copy(src, src + size, t.data());
+ return t;
+}
+
+/**
+ * \brief Wrap `GraphicBuffer` in `AnwBuffer`.
+ *
+ * \param[out] t The wrapper of type `AnwBuffer`.
+ * \param[in] l The source `GraphicBuffer`.
+ */
+// wrap: GraphicBuffer -> AnwBuffer
+inline void wrapAs(AnwBuffer* t, GraphicBuffer const& l) {
+ t->attr.width = l.getWidth();
+ t->attr.height = l.getHeight();
+ t->attr.stride = l.getStride();
+ t->attr.format = static_cast<PixelFormat>(l.getPixelFormat());
+ t->attr.layerCount = l.getLayerCount();
+ t->attr.usage = l.getUsage();
+ t->attr.id = l.getId();
+ t->attr.generationNumber = l.getGenerationNumber();
+ t->nativeHandle = hidl_handle(l.handle);
+}
+
+/**
+ * \brief Convert `AnwBuffer` to `GraphicBuffer`.
+ *
+ * \param[out] l The destination `GraphicBuffer`.
+ * \param[in] t The source `AnwBuffer`.
+ *
+ * This function will duplicate all file descriptors in \p t.
+ */
+// convert: AnwBuffer -> GraphicBuffer
+// Ref: frameworks/native/libs/ui/GraphicBuffer.cpp: GraphicBuffer::flatten
+inline bool convertTo(GraphicBuffer* l, AnwBuffer const& t) {
+ native_handle_t* handle = t.nativeHandle == nullptr ?
+ nullptr : native_handle_clone(t.nativeHandle);
+
+ size_t const numInts = 12 + (handle ? handle->numInts : 0);
+ int32_t* ints = new int32_t[numInts];
+
+ size_t numFds = static_cast<size_t>(handle ? handle->numFds : 0);
+ int* fds = new int[numFds];
+
+ ints[0] = 'GBFR';
+ ints[1] = static_cast<int32_t>(t.attr.width);
+ ints[2] = static_cast<int32_t>(t.attr.height);
+ ints[3] = static_cast<int32_t>(t.attr.stride);
+ ints[4] = static_cast<int32_t>(t.attr.format);
+ ints[5] = static_cast<int32_t>(t.attr.layerCount);
+ ints[6] = static_cast<int32_t>(t.attr.usage);
+ ints[7] = static_cast<int32_t>(t.attr.id >> 32);
+ ints[8] = static_cast<int32_t>(t.attr.id & 0xFFFFFFFF);
+ ints[9] = static_cast<int32_t>(t.attr.generationNumber);
+ ints[10] = 0;
+ ints[11] = 0;
+ if (handle) {
+ ints[10] = static_cast<int32_t>(handle->numFds);
+ ints[11] = static_cast<int32_t>(handle->numInts);
+ int* intsStart = handle->data + handle->numFds;
+ std::copy(handle->data, intsStart, fds);
+ std::copy(intsStart, intsStart + handle->numInts, &ints[12]);
+ }
+
+ void const* constBuffer = static_cast<void const*>(ints);
+ size_t size = numInts * sizeof(int32_t);
+ int const* constFds = static_cast<int const*>(fds);
+ status_t status = l->unflatten(constBuffer, size, constFds, numFds);
+
+ delete [] fds;
+ delete [] ints;
+ native_handle_delete(handle);
+ return status == NO_ERROR;
+}
+
+/**
+ * \brief Wrap `GraphicBuffer` in `CodecBuffer`.
+ *
+ * \param[out] t The wrapper of type `CodecBuffer`.
+ * \param[in] l The source `GraphicBuffer`.
+ */
+// wrap: OMXBuffer -> CodecBuffer
+inline CodecBuffer *wrapAs(CodecBuffer *t, sp<GraphicBuffer> const& graphicBuffer) {
+ t->sharedMemory = hidl_memory();
+ t->nativeHandle = hidl_handle();
+ t->type = CodecBuffer::Type::ANW_BUFFER;
+ if (graphicBuffer == nullptr) {
+ t->attr.anwBuffer.width = 0;
+ t->attr.anwBuffer.height = 0;
+ t->attr.anwBuffer.stride = 0;
+ t->attr.anwBuffer.format = static_cast<PixelFormat>(1);
+ t->attr.anwBuffer.layerCount = 0;
+ t->attr.anwBuffer.usage = 0;
+ return t;
+ }
+ t->attr.anwBuffer.width = graphicBuffer->getWidth();
+ t->attr.anwBuffer.height = graphicBuffer->getHeight();
+ t->attr.anwBuffer.stride = graphicBuffer->getStride();
+ t->attr.anwBuffer.format = static_cast<PixelFormat>(
+ graphicBuffer->getPixelFormat());
+ t->attr.anwBuffer.layerCount = graphicBuffer->getLayerCount();
+ t->attr.anwBuffer.usage = graphicBuffer->getUsage();
+ t->nativeHandle = graphicBuffer->handle;
+ return t;
+}
+
+/**
+ * \brief Wrap `OMXBuffer` in `CodecBuffer`.
+ *
+ * \param[out] t The wrapper of type `CodecBuffer`.
+ * \param[in] l The source `OMXBuffer`.
+ * \return `true` if the wrapping is successful; `false` otherwise.
+ */
+// wrap: OMXBuffer -> CodecBuffer
+inline bool wrapAs(CodecBuffer* t, OMXBuffer const& l) {
+ t->sharedMemory = hidl_memory();
+ t->nativeHandle = hidl_handle();
+ switch (l.mBufferType) {
+ case OMXBuffer::kBufferTypeInvalid: {
+ t->type = CodecBuffer::Type::INVALID;
+ return true;
+ }
+ case OMXBuffer::kBufferTypePreset: {
+ t->type = CodecBuffer::Type::PRESET;
+ t->attr.preset.rangeLength = static_cast<uint32_t>(l.mRangeLength);
+ t->attr.preset.rangeOffset = static_cast<uint32_t>(l.mRangeOffset);
+ return true;
+ }
+ case OMXBuffer::kBufferTypeHidlMemory: {
+ t->type = CodecBuffer::Type::SHARED_MEM;
+ t->sharedMemory = l.mHidlMemory;
+ return true;
+ }
+ case OMXBuffer::kBufferTypeSharedMem: {
+ // This is not supported.
+ return false;
+ }
+ case OMXBuffer::kBufferTypeANWBuffer: {
+ wrapAs(t, l.mGraphicBuffer);
+ return true;
+ }
+ case OMXBuffer::kBufferTypeNativeHandle: {
+ t->type = CodecBuffer::Type::NATIVE_HANDLE;
+ t->nativeHandle = l.mNativeHandle->handle();
+ return true;
+ }
+ }
+ return false;
+}
+
+/**
+ * \brief Convert `CodecBuffer` to `OMXBuffer`.
+ *
+ * \param[out] l The destination `OMXBuffer`.
+ * \param[in] t The source `CodecBuffer`.
+ * \return `true` if successful; `false` otherwise.
+ */
+// convert: CodecBuffer -> OMXBuffer
+inline bool convertTo(OMXBuffer* l, CodecBuffer const& t) {
+ switch (t.type) {
+ case CodecBuffer::Type::INVALID: {
+ *l = OMXBuffer();
+ return true;
+ }
+ case CodecBuffer::Type::PRESET: {
+ *l = OMXBuffer(
+ t.attr.preset.rangeOffset,
+ t.attr.preset.rangeLength);
+ return true;
+ }
+ case CodecBuffer::Type::SHARED_MEM: {
+ *l = OMXBuffer(t.sharedMemory);
+ return true;
+ }
+ case CodecBuffer::Type::ANW_BUFFER: {
+ if (t.nativeHandle.getNativeHandle() == nullptr) {
+ *l = OMXBuffer(sp<GraphicBuffer>(nullptr));
+ return true;
+ }
+ AnwBuffer anwBuffer;
+ anwBuffer.nativeHandle = t.nativeHandle;
+ anwBuffer.attr = t.attr.anwBuffer;
+ sp<GraphicBuffer> graphicBuffer = new GraphicBuffer();
+ if (!convertTo(graphicBuffer.get(), anwBuffer)) {
+ return false;
+ }
+ *l = OMXBuffer(graphicBuffer);
+ return true;
+ }
+ case CodecBuffer::Type::NATIVE_HANDLE: {
+ *l = OMXBuffer(NativeHandle::create(
+ native_handle_clone(t.nativeHandle), true));
+ return true;
+ }
+ }
+ return false;
+}
+
+/**
+ * \brief Convert `IOMX::ComponentInfo` to `IOmx::ComponentInfo`.
+ *
+ * \param[out] t The destination `IOmx::ComponentInfo`.
+ * \param[in] l The source `IOMX::ComponentInfo`.
+ */
+// convert: IOMX::ComponentInfo -> IOmx::ComponentInfo
+inline bool convertTo(IOmx::ComponentInfo* t, IOMX::ComponentInfo const& l) {
+ t->mName = l.mName.string();
+ t->mRoles.resize(l.mRoles.size());
+ size_t i = 0;
+ for (auto& role : l.mRoles) {
+ t->mRoles[i++] = role.string();
+ }
+ return true;
+}
+
+/**
+ * \brief Convert `IOmx::ComponentInfo` to `IOMX::ComponentInfo`.
+ *
+ * \param[out] l The destination `IOMX::ComponentInfo`.
+ * \param[in] t The source `IOmx::ComponentInfo`.
+ */
+// convert: IOmx::ComponentInfo -> IOMX::ComponentInfo
+inline bool convertTo(IOMX::ComponentInfo* l, IOmx::ComponentInfo const& t) {
+ l->mName = t.mName.c_str();
+ l->mRoles.clear();
+ for (size_t i = 0; i < t.mRoles.size(); ++i) {
+ l->mRoles.push_back(String8(t.mRoles[i].c_str()));
+ }
+ return true;
+}
+
+/**
+ * \brief Convert `OMX_BOOL` to `bool`.
+ *
+ * \param[in] l The source `OMX_BOOL`.
+ * \return The destination `bool`.
+ */
+// convert: OMX_BOOL -> bool
+inline bool toRawBool(OMX_BOOL l) {
+ return l == OMX_FALSE ? false : true;
+}
+
+/**
+ * \brief Convert `bool` to `OMX_BOOL`.
+ *
+ * \param[in] t The source `bool`.
+ * \return The destination `OMX_BOOL`.
+ */
+// convert: bool -> OMX_BOOL
+inline OMX_BOOL toEnumBool(bool t) {
+ return t ? OMX_TRUE : OMX_FALSE;
+}
+
+/**
+ * \brief Convert `OMX_COMMANDTYPE` to `uint32_t`.
+ *
+ * \param[in] l The source `OMX_COMMANDTYPE`.
+ * \return The underlying value of type `uint32_t`.
+ *
+ * `OMX_COMMANDTYPE` is an enum type whose underlying type is `uint32_t`.
+ */
+// convert: OMX_COMMANDTYPE -> uint32_t
+inline uint32_t toRawCommandType(OMX_COMMANDTYPE l) {
+ return static_cast<uint32_t>(l);
+}
+
+/**
+ * \brief Convert `uint32_t` to `OMX_COMMANDTYPE`.
+ *
+ * \param[in] t The source `uint32_t`.
+ * \return The corresponding enum value of type `OMX_COMMANDTYPE`.
+ *
+ * `OMX_COMMANDTYPE` is an enum type whose underlying type is `uint32_t`.
+ */
+// convert: uint32_t -> OMX_COMMANDTYPE
+inline OMX_COMMANDTYPE toEnumCommandType(uint32_t t) {
+ return static_cast<OMX_COMMANDTYPE>(t);
+}
+
+/**
+ * \brief Convert `OMX_INDEXTYPE` to `uint32_t`.
+ *
+ * \param[in] l The source `OMX_INDEXTYPE`.
+ * \return The underlying value of type `uint32_t`.
+ *
+ * `OMX_INDEXTYPE` is an enum type whose underlying type is `uint32_t`.
+ */
+// convert: OMX_INDEXTYPE -> uint32_t
+inline uint32_t toRawIndexType(OMX_INDEXTYPE l) {
+ return static_cast<uint32_t>(l);
+}
+
+/**
+ * \brief Convert `uint32_t` to `OMX_INDEXTYPE`.
+ *
+ * \param[in] t The source `uint32_t`.
+ * \return The corresponding enum value of type `OMX_INDEXTYPE`.
+ *
+ * `OMX_INDEXTYPE` is an enum type whose underlying type is `uint32_t`.
+ */
+// convert: uint32_t -> OMX_INDEXTYPE
+inline OMX_INDEXTYPE toEnumIndexType(uint32_t t) {
+ return static_cast<OMX_INDEXTYPE>(t);
+}
+
+/**
+ * \brief Convert `IOMX::PortMode` to `PortMode`.
+ *
+ * \param[in] l The source `IOMX::PortMode`.
+ * \return The destination `PortMode`.
+ */
+// convert: IOMX::PortMode -> PortMode
+inline PortMode toHardwarePortMode(IOMX::PortMode l) {
+ return static_cast<PortMode>(l);
+}
+
+/**
+ * \brief Convert `PortMode` to `IOMX::PortMode`.
+ *
+ * \param[in] t The source `PortMode`.
+ * \return The destination `IOMX::PortMode`.
+ */
+// convert: PortMode -> IOMX::PortMode
+inline IOMX::PortMode toIOMXPortMode(PortMode t) {
+ return static_cast<IOMX::PortMode>(t);
+}
+
+/**
+ * \brief Convert `OMX_TICKS` to `uint64_t`.
+ *
+ * \param[in] l The source `OMX_TICKS`.
+ * \return The destination `uint64_t`.
+ */
+// convert: OMX_TICKS -> uint64_t
+inline uint64_t toRawTicks(OMX_TICKS l) {
+#ifndef OMX_SKIP64BIT
+ return static_cast<uint64_t>(l);
+#else
+ return static_cast<uint64_t>(l.nLowPart) |
+ static_cast<uint64_t>(l.nHighPart << 32);
+#endif
+}
+
+/**
+ * \brief Convert `uint64_t` to `OMX_TICKS`.
+ *
+ * \param[in] l The source `uint64_t`.
+ * \return The destination `OMX_TICKS`.
+ */
+// convert: uint64_t -> OMX_TICKS
+inline OMX_TICKS toOMXTicks(uint64_t t) {
+#ifndef OMX_SKIP64BIT
+ return static_cast<OMX_TICKS>(t);
+#else
+ return OMX_TICKS{
+ static_cast<uint32_t>(t & 0xFFFFFFFF),
+ static_cast<uint32_t>(t >> 32)};
+#endif
+}
+
+/**
+ * Conversion functions for types outside media
+ * ============================================
+ *
+ * Some objects in libui and libgui that were made to go through binder calls do
+ * not expose ways to read or write their fields to the public. To pass an
+ * object of this kind through the HIDL boundary, translation functions need to
+ * work around the access restriction by using the publicly available
+ * `flatten()` and `unflatten()` functions.
+ *
+ * All `flatten()` and `unflatten()` overloads follow the same convention as
+ * follows:
+ *
+ * status_t flatten(ObjectType const& object,
+ * [OtherType const& other, ...]
+ * void*& buffer, size_t& size,
+ * int*& fds, size_t& numFds)
+ *
+ * status_t unflatten(ObjectType* object,
+ * [OtherType* other, ...,]
+ * void*& buffer, size_t& size,
+ * int*& fds, size_t& numFds)
+ *
+ * The number of `other` parameters varies depending on the `ObjectType`. For
+ * example, in the process of unflattening an object that contains
+ * `hidl_handle`, `other` is needed to hold `native_handle_t` objects that will
+ * be created.
+ *
+ * The last four parameters always work the same way in all overloads of
+ * `flatten()` and `unflatten()`:
+ * - For `flatten()`, `buffer` is the pointer to the non-fd buffer to be filled,
+ * `size` is the size (in bytes) of the non-fd buffer pointed to by `buffer`,
+ * `fds` is the pointer to the fd buffer to be filled, and `numFds` is the
+ * size (in ints) of the fd buffer pointed to by `fds`.
+ * - For `unflatten()`, `buffer` is the pointer to the non-fd buffer to be read
+ * from, `size` is the size (in bytes) of the non-fd buffer pointed to by
+ * `buffer`, `fds` is the pointer to the fd buffer to be read from, and
+ * `numFds` is the size (in ints) of the fd buffer pointed to by `fds`.
+ * - After a successful call to `flatten()` or `unflatten()`, `buffer` and `fds`
+ * will be advanced, while `size` and `numFds` will be decreased to reflect
+ * how much storage/data of the two buffers (fd and non-fd) have been used.
+ * - After an unsuccessful call, the values of `buffer`, `size`, `fds` and
+ * `numFds` are invalid.
+ *
+ * The return value of a successful `flatten()` or `unflatten()` call will be
+ * `OK` (also aliased as `NO_ERROR`). Any other values indicate a failure.
+ *
+ * For each object type that supports flattening, there will be two accompanying
+ * functions: `getFlattenedSize()` and `getFdCount()`. `getFlattenedSize()` will
+ * return the size of the non-fd buffer that the object will need for
+ * flattening. `getFdCount()` will return the size of the fd buffer that the
+ * object will need for flattening.
+ *
+ * The set of these four functions, `getFlattenedSize()`, `getFdCount()`,
+ * `flatten()` and `unflatten()`, are similar to functions of the same name in
+ * the abstract class `Flattenable`. The only difference is that functions in
+ * this file are not member functions of the object type. For example, we write
+ *
+ * flatten(x, buffer, size, fds, numFds)
+ *
+ * instead of
+ *
+ * x.flatten(buffer, size, fds, numFds)
+ *
+ * because we cannot modify the type of `x`.
+ *
+ * There is one exception to the naming convention: `hidl_handle` that
+ * represents a fence. The four functions for this "Fence" type have the word
+ * "Fence" attched to their names because the object type, which is
+ * `hidl_handle`, does not carry the special meaning that the object itself can
+ * only contain zero or one file descriptor.
+ */
+
+// Ref: frameworks/native/libs/ui/Fence.cpp
+
+/**
+ * \brief Return the size of the non-fd buffer required to flatten a fence.
+ *
+ * \param[in] fence The input fence of type `hidl_handle`.
+ * \return The required size of the flat buffer.
+ *
+ * The current version of this function always returns 4, which is the number of
+ * bytes required to store the number of file descriptors contained in the fd
+ * part of the flat buffer.
+ */
+inline size_t getFenceFlattenedSize(hidl_handle const& /* fence */) {
+ return 4;
+};
+
+/**
+ * \brief Return the number of file descriptors contained in a fence.
+ *
+ * \param[in] fence The input fence of type `hidl_handle`.
+ * \return `0` if \p fence does not contain a valid file descriptor, or `1`
+ * otherwise.
+ */
+inline size_t getFenceFdCount(hidl_handle const& fence) {
+ return native_handle_read_fd(fence) == -1 ? 0 : 1;
+}
+
+/**
+ * \brief Unflatten `Fence` to `hidl_handle`.
+ *
+ * \param[out] fence The destination `hidl_handle`.
+ * \param[out] nh The underlying native handle.
+ * \param[in,out] buffer The pointer to the flat non-fd buffer.
+ * \param[in,out] size The size of the flat non-fd buffer.
+ * \param[in,out] fds The pointer to the flat fd buffer.
+ * \param[in,out] numFds The size of the flat fd buffer.
+ * \return `NO_ERROR` on success; other value on failure.
+ *
+ * If the return value is `NO_ERROR`, \p nh will point to a newly created
+ * native handle, which needs to be deleted with `native_handle_delete()`
+ * afterwards.
+ */
+inline status_t unflattenFence(hidl_handle* fence, native_handle_t** nh,
+ void const*& buffer, size_t& size, int const*& fds, size_t& numFds) {
+ if (size < 4) {
+ return NO_MEMORY;
+ }
+
+ uint32_t numFdsInHandle;
+ FlattenableUtils::read(buffer, size, numFdsInHandle);
+
+ if (numFdsInHandle > 1) {
+ return BAD_VALUE;
+ }
+
+ if (numFds < numFdsInHandle) {
+ return NO_MEMORY;
+ }
+
+ if (numFdsInHandle) {
+ *nh = native_handle_create_from_fd(*fds);
+ if (*nh == nullptr) {
+ return NO_MEMORY;
+ }
+ *fence = *nh;
+ ++fds;
+ --numFds;
+ } else {
+ *nh = nullptr;
+ *fence = hidl_handle();
+ }
+
+ return NO_ERROR;
+}
+
+/**
+ * \brief Flatten `hidl_handle` as `Fence`.
+ *
+ * \param[in] t The source `hidl_handle`.
+ * \param[in,out] buffer The pointer to the flat non-fd buffer.
+ * \param[in,out] size The size of the flat non-fd buffer.
+ * \param[in,out] fds The pointer to the flat fd buffer.
+ * \param[in,out] numFds The size of the flat fd buffer.
+ * \return `NO_ERROR` on success; other value on failure.
+ */
+inline status_t flattenFence(hidl_handle const& fence,
+ void*& buffer, size_t& size, int*& fds, size_t& numFds) {
+ if (size < getFenceFlattenedSize(fence) ||
+ numFds < getFenceFdCount(fence)) {
+ return NO_MEMORY;
+ }
+ // Cast to uint32_t since the size of a size_t can vary between 32- and
+ // 64-bit processes
+ FlattenableUtils::write(buffer, size,
+ static_cast<uint32_t>(getFenceFdCount(fence)));
+ int fd = native_handle_read_fd(fence);
+ if (fd != -1) {
+ *fds = fd;
+ ++fds;
+ --numFds;
+ }
+ return NO_ERROR;
+}
+
+/**
+ * \brief Wrap `Fence` in `hidl_handle`.
+ *
+ * \param[out] t The wrapper of type `hidl_handle`.
+ * \param[out] nh The native handle pointed to by \p t.
+ * \param[in] l The source `Fence`.
+ *
+ * On success, \p nh will hold a newly created native handle, which must be
+ * deleted manually with `native_handle_delete()` afterwards.
+ */
+// wrap: Fence -> hidl_handle
+inline bool wrapAs(hidl_handle* t, native_handle_t** nh, Fence const& l) {
+ size_t const baseSize = l.getFlattenedSize();
+ std::unique_ptr<uint8_t[]> baseBuffer(
+ new (std::nothrow) uint8_t[baseSize]);
+ if (!baseBuffer) {
+ return false;
+ }
+
+ size_t const baseNumFds = l.getFdCount();
+ std::unique_ptr<int[]> baseFds(
+ new (std::nothrow) int[baseNumFds]);
+ if (!baseFds) {
+ return false;
+ }
+
+ void* buffer = static_cast<void*>(baseBuffer.get());
+ size_t size = baseSize;
+ int* fds = static_cast<int*>(baseFds.get());
+ size_t numFds = baseNumFds;
+ if (l.flatten(buffer, size, fds, numFds) != NO_ERROR) {
+ return false;
+ }
+
+ void const* constBuffer = static_cast<void const*>(baseBuffer.get());
+ size = baseSize;
+ int const* constFds = static_cast<int const*>(baseFds.get());
+ numFds = baseNumFds;
+ if (unflattenFence(t, nh, constBuffer, size, constFds, numFds)
+ != NO_ERROR) {
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * \brief Convert `hidl_handle` to `Fence`.
+ *
+ * \param[out] l The destination `Fence`. `l` must not have been used
+ * (`l->isValid()` must return `false`) before this function is called.
+ * \param[in] t The source `hidl_handle`.
+ *
+ * If \p t contains a valid file descriptor, it will be duplicated.
+ */
+// convert: hidl_handle -> Fence
+inline bool convertTo(Fence* l, hidl_handle const& t) {
+ int fd = native_handle_read_fd(t);
+ if (fd != -1) {
+ fd = dup(fd);
+ if (fd == -1) {
+ return false;
+ }
+ }
+ native_handle_t* nh = native_handle_create_from_fd(fd);
+ if (nh == nullptr) {
+ if (fd != -1) {
+ close(fd);
+ }
+ return false;
+ }
+
+ size_t const baseSize = getFenceFlattenedSize(t);
+ std::unique_ptr<uint8_t[]> baseBuffer(
+ new (std::nothrow) uint8_t[baseSize]);
+ if (!baseBuffer) {
+ native_handle_delete(nh);
+ return false;
+ }
+
+ size_t const baseNumFds = getFenceFdCount(t);
+ std::unique_ptr<int[]> baseFds(
+ new (std::nothrow) int[baseNumFds]);
+ if (!baseFds) {
+ native_handle_delete(nh);
+ return false;
+ }
+
+ void* buffer = static_cast<void*>(baseBuffer.get());
+ size_t size = baseSize;
+ int* fds = static_cast<int*>(baseFds.get());
+ size_t numFds = baseNumFds;
+ if (flattenFence(hidl_handle(nh), buffer, size, fds, numFds) != NO_ERROR) {
+ native_handle_delete(nh);
+ return false;
+ }
+ native_handle_delete(nh);
+
+ void const* constBuffer = static_cast<void const*>(baseBuffer.get());
+ size = baseSize;
+ int const* constFds = static_cast<int const*>(baseFds.get());
+ numFds = baseNumFds;
+ if (l->unflatten(constBuffer, size, constFds, numFds) != NO_ERROR) {
+ return false;
+ }
+
+ return true;
+}
+
+// Ref: frameworks/native/libs/ui/FenceTime.cpp: FenceTime::Snapshot
+
+/**
+ * \brief Return the size of the non-fd buffer required to flatten
+ * `FenceTimeSnapshot`.
+ *
+ * \param[in] t The input `FenceTimeSnapshot`.
+ * \return The required size of the flat buffer.
+ */
+inline size_t getFlattenedSize(
+ HGraphicBufferProducer::FenceTimeSnapshot const& t) {
+ constexpr size_t min = sizeof(t.state);
+ switch (t.state) {
+ case HGraphicBufferProducer::FenceTimeSnapshot::State::EMPTY:
+ return min;
+ case HGraphicBufferProducer::FenceTimeSnapshot::State::FENCE:
+ return min + getFenceFlattenedSize(t.fence);
+ case HGraphicBufferProducer::FenceTimeSnapshot::State::SIGNAL_TIME:
+ return min + sizeof(
+ ::android::FenceTime::Snapshot::signalTime);
+ }
+ return 0;
+}
+
+/**
+ * \brief Return the number of file descriptors contained in
+ * `FenceTimeSnapshot`.
+ *
+ * \param[in] t The input `FenceTimeSnapshot`.
+ * \return The number of file descriptors contained in \p snapshot.
+ */
+inline size_t getFdCount(
+ HGraphicBufferProducer::FenceTimeSnapshot const& t) {
+ return t.state ==
+ HGraphicBufferProducer::FenceTimeSnapshot::State::FENCE ?
+ getFenceFdCount(t.fence) : 0;
+}
+
+/**
+ * \brief Flatten `FenceTimeSnapshot`.
+ *
+ * \param[in] t The source `FenceTimeSnapshot`.
+ * \param[in,out] buffer The pointer to the flat non-fd buffer.
+ * \param[in,out] size The size of the flat non-fd buffer.
+ * \param[in,out] fds The pointer to the flat fd buffer.
+ * \param[in,out] numFds The size of the flat fd buffer.
+ * \return `NO_ERROR` on success; other value on failure.
+ *
+ * This function will duplicate the file descriptor in `t.fence` if `t.state ==
+ * FENCE`.
+ */
+inline status_t flatten(HGraphicBufferProducer::FenceTimeSnapshot const& t,
+ void*& buffer, size_t& size, int*& fds, size_t& numFds) {
+ if (size < getFlattenedSize(t)) {
+ return NO_MEMORY;
+ }
+
+ switch (t.state) {
+ case HGraphicBufferProducer::FenceTimeSnapshot::State::EMPTY:
+ FlattenableUtils::write(buffer, size,
+ ::android::FenceTime::Snapshot::State::EMPTY);
+ return NO_ERROR;
+ case HGraphicBufferProducer::FenceTimeSnapshot::State::FENCE:
+ FlattenableUtils::write(buffer, size,
+ ::android::FenceTime::Snapshot::State::FENCE);
+ return flattenFence(t.fence, buffer, size, fds, numFds);
+ case HGraphicBufferProducer::FenceTimeSnapshot::State::SIGNAL_TIME:
+ FlattenableUtils::write(buffer, size,
+ ::android::FenceTime::Snapshot::State::SIGNAL_TIME);
+ FlattenableUtils::write(buffer, size, t.signalTimeNs);
+ return NO_ERROR;
+ }
+ return NO_ERROR;
+}
+
+/**
+ * \brief Unflatten `FenceTimeSnapshot`.
+ *
+ * \param[out] t The destination `FenceTimeSnapshot`.
+ * \param[out] nh The underlying native handle.
+ * \param[in,out] buffer The pointer to the flat non-fd buffer.
+ * \param[in,out] size The size of the flat non-fd buffer.
+ * \param[in,out] fds The pointer to the flat fd buffer.
+ * \param[in,out] numFds The size of the flat fd buffer.
+ * \return `NO_ERROR` on success; other value on failure.
+ *
+ * If the return value is `NO_ERROR` and the constructed snapshot contains a
+ * file descriptor, \p nh will be created to hold that file descriptor. In this
+ * case, \p nh needs to be deleted with `native_handle_delete()` afterwards.
+ */
+inline status_t unflatten(
+ HGraphicBufferProducer::FenceTimeSnapshot* t, native_handle_t** nh,
+ void const*& buffer, size_t& size, int const*& fds, size_t& numFds) {
+ if (size < sizeof(t->state)) {
+ return NO_MEMORY;
+ }
+
+ *nh = nullptr;
+ ::android::FenceTime::Snapshot::State state;
+ FlattenableUtils::read(buffer, size, state);
+ switch (state) {
+ case ::android::FenceTime::Snapshot::State::EMPTY:
+ t->state = HGraphicBufferProducer::FenceTimeSnapshot::State::EMPTY;
+ return NO_ERROR;
+ case ::android::FenceTime::Snapshot::State::FENCE:
+ t->state = HGraphicBufferProducer::FenceTimeSnapshot::State::FENCE;
+ return unflattenFence(&t->fence, nh, buffer, size, fds, numFds);
+ case ::android::FenceTime::Snapshot::State::SIGNAL_TIME:
+ t->state = HGraphicBufferProducer::FenceTimeSnapshot::State::SIGNAL_TIME;
+ if (size < sizeof(t->signalTimeNs)) {
+ return NO_MEMORY;
+ }
+ FlattenableUtils::read(buffer, size, t->signalTimeNs);
+ return NO_ERROR;
+ }
+ return NO_ERROR;
+}
+
+// Ref: frameworks/native/libs/gui/FrameTimestamps.cpp: FrameEventsDelta
+
+/**
+ * \brief Return a lower bound on the size of the non-fd buffer required to
+ * flatten `FrameEventsDelta`.
+ *
+ * \param[in] t The input `FrameEventsDelta`.
+ * \return A lower bound on the size of the flat buffer.
+ */
+constexpr size_t minFlattenedSize(
+ HGraphicBufferProducer::FrameEventsDelta const& /* t */) {
+ return sizeof(uint64_t) + // mFrameNumber
+ sizeof(uint8_t) + // mIndex
+ sizeof(uint8_t) + // mAddPostCompositeCalled
+ sizeof(uint8_t) + // mAddRetireCalled
+ sizeof(uint8_t) + // mAddReleaseCalled
+ sizeof(nsecs_t) + // mPostedTime
+ sizeof(nsecs_t) + // mRequestedPresentTime
+ sizeof(nsecs_t) + // mLatchTime
+ sizeof(nsecs_t) + // mFirstRefreshStartTime
+ sizeof(nsecs_t); // mLastRefreshStartTime
+}
+
+/**
+ * \brief Return the size of the non-fd buffer required to flatten
+ * `FrameEventsDelta`.
+ *
+ * \param[in] t The input `FrameEventsDelta`.
+ * \return The required size of the flat buffer.
+ */
+inline size_t getFlattenedSize(
+ HGraphicBufferProducer::FrameEventsDelta const& t) {
+ return minFlattenedSize(t) +
+ getFlattenedSize(t.gpuCompositionDoneFence) +
+ getFlattenedSize(t.displayPresentFence) +
+ getFlattenedSize(t.displayRetireFence) +
+ getFlattenedSize(t.releaseFence);
+};
+
+/**
+ * \brief Return the number of file descriptors contained in
+ * `FrameEventsDelta`.
+ *
+ * \param[in] t The input `FrameEventsDelta`.
+ * \return The number of file descriptors contained in \p t.
+ */
+inline size_t getFdCount(
+ HGraphicBufferProducer::FrameEventsDelta const& t) {
+ return getFdCount(t.gpuCompositionDoneFence) +
+ getFdCount(t.displayPresentFence) +
+ getFdCount(t.displayRetireFence) +
+ getFdCount(t.releaseFence);
+};
+
+/**
+ * \brief Unflatten `FrameEventsDelta`.
+ *
+ * \param[out] t The destination `FrameEventsDelta`.
+ * \param[out] nh The underlying array of native handles.
+ * \param[in,out] buffer The pointer to the flat non-fd buffer.
+ * \param[in,out] size The size of the flat non-fd buffer.
+ * \param[in,out] fds The pointer to the flat fd buffer.
+ * \param[in,out] numFds The size of the flat fd buffer.
+ * \return `NO_ERROR` on success; other value on failure.
+ *
+ * If the return value is `NO_ERROR`, \p nh will have length 4, and it will be
+ * populated with `nullptr` or newly created handles. Each non-null slot in \p
+ * nh will need to be deleted manually with `native_handle_delete()`.
+ */
+inline status_t unflatten(HGraphicBufferProducer::FrameEventsDelta* t,
+ std::vector<native_handle_t*>* nh,
+ void const*& buffer, size_t& size, int const*& fds, size_t& numFds) {
+ if (size < minFlattenedSize(*t)) {
+ return NO_MEMORY;
+ }
+ FlattenableUtils::read(buffer, size, t->frameNumber);
+
+ // These were written as uint8_t for alignment.
+ uint8_t temp = 0;
+ FlattenableUtils::read(buffer, size, temp);
+ size_t index = static_cast<size_t>(temp);
+ if (index >= ::android::FrameEventHistory::MAX_FRAME_HISTORY) {
+ return BAD_VALUE;
+ }
+ t->index = static_cast<uint32_t>(index);
+
+ FlattenableUtils::read(buffer, size, temp);
+ t->addPostCompositeCalled = static_cast<bool>(temp);
+ FlattenableUtils::read(buffer, size, temp);
+ t->addRetireCalled = static_cast<bool>(temp);
+ FlattenableUtils::read(buffer, size, temp);
+ t->addReleaseCalled = static_cast<bool>(temp);
+
+ FlattenableUtils::read(buffer, size, t->postedTimeNs);
+ FlattenableUtils::read(buffer, size, t->requestedPresentTimeNs);
+ FlattenableUtils::read(buffer, size, t->latchTimeNs);
+ FlattenableUtils::read(buffer, size, t->firstRefreshStartTimeNs);
+ FlattenableUtils::read(buffer, size, t->lastRefreshStartTimeNs);
+ FlattenableUtils::read(buffer, size, t->dequeueReadyTime);
+
+ // Fences
+ HGraphicBufferProducer::FenceTimeSnapshot* tSnapshot[4];
+ tSnapshot[0] = &t->gpuCompositionDoneFence;
+ tSnapshot[1] = &t->displayPresentFence;
+ tSnapshot[2] = &t->displayRetireFence;
+ tSnapshot[3] = &t->releaseFence;
+ nh->resize(4);
+ for (size_t snapshotIndex = 0; snapshotIndex < 4; ++snapshotIndex) {
+ status_t status = unflatten(
+ tSnapshot[snapshotIndex], &((*nh)[snapshotIndex]),
+ buffer, size, fds, numFds);
+ if (status != NO_ERROR) {
+ while (snapshotIndex > 0) {
+ --snapshotIndex;
+ if ((*nh)[snapshotIndex] != nullptr) {
+ native_handle_delete((*nh)[snapshotIndex]);
+ }
+ }
+ return status;
+ }
+ }
+ return NO_ERROR;
+}
+
+/**
+ * \brief Flatten `FrameEventsDelta`.
+ *
+ * \param[in] t The source `FrameEventsDelta`.
+ * \param[in,out] buffer The pointer to the flat non-fd buffer.
+ * \param[in,out] size The size of the flat non-fd buffer.
+ * \param[in,out] fds The pointer to the flat fd buffer.
+ * \param[in,out] numFds The size of the flat fd buffer.
+ * \return `NO_ERROR` on success; other value on failure.
+ *
+ * This function will duplicate file descriptors contained in \p t.
+ */
+// Ref: frameworks/native/libs/gui/FrameTimestamp.cpp:
+// FrameEventsDelta::flatten
+inline status_t flatten(HGraphicBufferProducer::FrameEventsDelta const& t,
+ void*& buffer, size_t& size, int*& fds, size_t numFds) {
+ // Check that t.index is within a valid range.
+ if (t.index >= static_cast<uint32_t>(FrameEventHistory::MAX_FRAME_HISTORY)
+ || t.index > std::numeric_limits<uint8_t>::max()) {
+ return BAD_VALUE;
+ }
+
+ FlattenableUtils::write(buffer, size, t.frameNumber);
+
+ // These are static_cast to uint8_t for alignment.
+ FlattenableUtils::write(buffer, size, static_cast<uint8_t>(t.index));
+ FlattenableUtils::write(
+ buffer, size, static_cast<uint8_t>(t.addPostCompositeCalled));
+ FlattenableUtils::write(
+ buffer, size, static_cast<uint8_t>(t.addRetireCalled));
+ FlattenableUtils::write(
+ buffer, size, static_cast<uint8_t>(t.addReleaseCalled));
+
+ FlattenableUtils::write(buffer, size, t.postedTimeNs);
+ FlattenableUtils::write(buffer, size, t.requestedPresentTimeNs);
+ FlattenableUtils::write(buffer, size, t.latchTimeNs);
+ FlattenableUtils::write(buffer, size, t.firstRefreshStartTimeNs);
+ FlattenableUtils::write(buffer, size, t.lastRefreshStartTimeNs);
+ FlattenableUtils::write(buffer, size, t.dequeueReadyTime);
+
+ // Fences
+ HGraphicBufferProducer::FenceTimeSnapshot const* tSnapshot[4];
+ tSnapshot[0] = &t.gpuCompositionDoneFence;
+ tSnapshot[1] = &t.displayPresentFence;
+ tSnapshot[2] = &t.displayRetireFence;
+ tSnapshot[3] = &t.releaseFence;
+ for (size_t snapshotIndex = 0; snapshotIndex < 4; ++snapshotIndex) {
+ status_t status = flatten(
+ *(tSnapshot[snapshotIndex]), buffer, size, fds, numFds);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ }
+ return NO_ERROR;
+}
+
+// Ref: frameworks/native/libs/gui/FrameTimestamps.cpp: FrameEventHistoryDelta
+
+/**
+ * \brief Return the size of the non-fd buffer required to flatten
+ * `HGraphicBufferProducer::FrameEventHistoryDelta`.
+ *
+ * \param[in] t The input `HGraphicBufferProducer::FrameEventHistoryDelta`.
+ * \return The required size of the flat buffer.
+ */
+inline size_t getFlattenedSize(
+ HGraphicBufferProducer::FrameEventHistoryDelta const& t) {
+ size_t size = 4 + // mDeltas.size()
+ sizeof(t.compositorTiming);
+ for (size_t i = 0; i < t.deltas.size(); ++i) {
+ size += getFlattenedSize(t.deltas[i]);
+ }
+ return size;
+}
+
+/**
+ * \brief Return the number of file descriptors contained in
+ * `HGraphicBufferProducer::FrameEventHistoryDelta`.
+ *
+ * \param[in] t The input `HGraphicBufferProducer::FrameEventHistoryDelta`.
+ * \return The number of file descriptors contained in \p t.
+ */
+inline size_t getFdCount(
+ HGraphicBufferProducer::FrameEventHistoryDelta const& t) {
+ size_t numFds = 0;
+ for (size_t i = 0; i < t.deltas.size(); ++i) {
+ numFds += getFdCount(t.deltas[i]);
+ }
+ return numFds;
+}
+
+/**
+ * \brief Unflatten `FrameEventHistoryDelta`.
+ *
+ * \param[out] t The destination `FrameEventHistoryDelta`.
+ * \param[out] nh The underlying array of arrays of native handles.
+ * \param[in,out] buffer The pointer to the flat non-fd buffer.
+ * \param[in,out] size The size of the flat non-fd buffer.
+ * \param[in,out] fds The pointer to the flat fd buffer.
+ * \param[in,out] numFds The size of the flat fd buffer.
+ * \return `NO_ERROR` on success; other value on failure.
+ *
+ * If the return value is `NO_ERROR`, \p nh will be populated with `nullptr` or
+ * newly created handles. The second dimension of \p nh will be 4. Each non-null
+ * slot in \p nh will need to be deleted manually with `native_handle_delete()`.
+ */
+inline status_t unflatten(
+ HGraphicBufferProducer::FrameEventHistoryDelta* t,
+ std::vector<std::vector<native_handle_t*> >* nh,
+ void const*& buffer, size_t& size, int const*& fds, size_t& numFds) {
+ if (size < 4) {
+ return NO_MEMORY;
+ }
+
+ FlattenableUtils::read(buffer, size, t->compositorTiming);
+
+ uint32_t deltaCount = 0;
+ FlattenableUtils::read(buffer, size, deltaCount);
+ if (static_cast<size_t>(deltaCount) >
+ ::android::FrameEventHistory::MAX_FRAME_HISTORY) {
+ return BAD_VALUE;
+ }
+ t->deltas.resize(deltaCount);
+ nh->resize(deltaCount);
+ for (size_t deltaIndex = 0; deltaIndex < deltaCount; ++deltaIndex) {
+ status_t status = unflatten(
+ &(t->deltas[deltaIndex]), &((*nh)[deltaIndex]),
+ buffer, size, fds, numFds);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ }
+ return NO_ERROR;
+}
+
+/**
+ * \brief Flatten `FrameEventHistoryDelta`.
+ *
+ * \param[in] t The source `FrameEventHistoryDelta`.
+ * \param[in,out] buffer The pointer to the flat non-fd buffer.
+ * \param[in,out] size The size of the flat non-fd buffer.
+ * \param[in,out] fds The pointer to the flat fd buffer.
+ * \param[in,out] numFds The size of the flat fd buffer.
+ * \return `NO_ERROR` on success; other value on failure.
+ *
+ * This function will duplicate file descriptors contained in \p t.
+ */
+inline status_t flatten(
+ HGraphicBufferProducer::FrameEventHistoryDelta const& t,
+ void*& buffer, size_t& size, int*& fds, size_t& numFds) {
+ if (t.deltas.size() > ::android::FrameEventHistory::MAX_FRAME_HISTORY) {
+ return BAD_VALUE;
+ }
+ if (size < getFlattenedSize(t)) {
+ return NO_MEMORY;
+ }
+
+ FlattenableUtils::write(buffer, size, t.compositorTiming);
+
+ FlattenableUtils::write(buffer, size, static_cast<uint32_t>(t.deltas.size()));
+ for (size_t deltaIndex = 0; deltaIndex < t.deltas.size(); ++deltaIndex) {
+ status_t status = flatten(t.deltas[deltaIndex], buffer, size, fds, numFds);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ }
+ return NO_ERROR;
+}
+
+/**
+ * \brief Wrap `::android::FrameEventHistoryData` in
+ * `HGraphicBufferProducer::FrameEventHistoryDelta`.
+ *
+ * \param[out] t The wrapper of type
+ * `HGraphicBufferProducer::FrameEventHistoryDelta`.
+ * \param[out] nh The array of array of native handles that are referred to by
+ * members of \p t.
+ * \param[in] l The source `::android::FrameEventHistoryDelta`.
+ *
+ * On success, each member of \p nh will be either `nullptr` or a newly created
+ * native handle. All the non-`nullptr` elements must be deleted individually
+ * with `native_handle_delete()`.
+ */
+inline bool wrapAs(HGraphicBufferProducer::FrameEventHistoryDelta* t,
+ std::vector<std::vector<native_handle_t*> >* nh,
+ ::android::FrameEventHistoryDelta const& l) {
+
+ size_t const baseSize = l.getFlattenedSize();
+ std::unique_ptr<uint8_t[]> baseBuffer(
+ new (std::nothrow) uint8_t[baseSize]);
+ if (!baseBuffer) {
+ return false;
+ }
+
+ size_t const baseNumFds = l.getFdCount();
+ std::unique_ptr<int[]> baseFds(
+ new (std::nothrow) int[baseNumFds]);
+ if (!baseFds) {
+ return false;
+ }
+
+ void* buffer = static_cast<void*>(baseBuffer.get());
+ size_t size = baseSize;
+ int* fds = baseFds.get();
+ size_t numFds = baseNumFds;
+ if (l.flatten(buffer, size, fds, numFds) != NO_ERROR) {
+ return false;
+ }
+
+ void const* constBuffer = static_cast<void const*>(baseBuffer.get());
+ size = baseSize;
+ int const* constFds = static_cast<int const*>(baseFds.get());
+ numFds = baseNumFds;
+ if (unflatten(t, nh, constBuffer, size, constFds, numFds) != NO_ERROR) {
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * \brief Convert `HGraphicBufferProducer::FrameEventHistoryDelta` to
+ * `::android::FrameEventHistoryDelta`.
+ *
+ * \param[out] l The destination `::android::FrameEventHistoryDelta`.
+ * \param[in] t The source `HGraphicBufferProducer::FrameEventHistoryDelta`.
+ *
+ * This function will duplicate all file descriptors contained in \p t.
+ */
+inline bool convertTo(
+ ::android::FrameEventHistoryDelta* l,
+ HGraphicBufferProducer::FrameEventHistoryDelta const& t) {
+
+ size_t const baseSize = getFlattenedSize(t);
+ std::unique_ptr<uint8_t[]> baseBuffer(
+ new (std::nothrow) uint8_t[baseSize]);
+ if (!baseBuffer) {
+ return false;
+ }
+
+ size_t const baseNumFds = getFdCount(t);
+ std::unique_ptr<int[]> baseFds(
+ new (std::nothrow) int[baseNumFds]);
+ if (!baseFds) {
+ return false;
+ }
+
+ void* buffer = static_cast<void*>(baseBuffer.get());
+ size_t size = baseSize;
+ int* fds = static_cast<int*>(baseFds.get());
+ size_t numFds = baseNumFds;
+ if (flatten(t, buffer, size, fds, numFds) != NO_ERROR) {
+ return false;
+ }
+
+ void const* constBuffer = static_cast<void const*>(baseBuffer.get());
+ size = baseSize;
+ int const* constFds = static_cast<int const*>(baseFds.get());
+ numFds = baseNumFds;
+ if (l->unflatten(constBuffer, size, constFds, numFds) != NO_ERROR) {
+ return false;
+ }
+
+ return true;
+}
+
+// Ref: frameworks/native/libs/ui/Region.cpp
+
+/**
+ * \brief Return the size of the buffer required to flatten `Region`.
+ *
+ * \param[in] t The input `Region`.
+ * \return The required size of the flat buffer.
+ */
+inline size_t getFlattenedSize(Region const& t) {
+ return sizeof(uint32_t) + t.size() * sizeof(::android::Rect);
+}
+
+/**
+ * \brief Unflatten `Region`.
+ *
+ * \param[out] t The destination `Region`.
+ * \param[in,out] buffer The pointer to the flat buffer.
+ * \param[in,out] size The size of the flat buffer.
+ * \return `NO_ERROR` on success; other value on failure.
+ */
+inline status_t unflatten(Region* t, void const*& buffer, size_t& size) {
+ if (size < sizeof(uint32_t)) {
+ return NO_MEMORY;
+ }
+
+ uint32_t numRects = 0;
+ FlattenableUtils::read(buffer, size, numRects);
+ if (size < numRects * sizeof(Rect)) {
+ return NO_MEMORY;
+ }
+ if (numRects > (UINT32_MAX / sizeof(Rect))) {
+ return NO_MEMORY;
+ }
+
+ t->resize(numRects);
+ for (size_t r = 0; r < numRects; ++r) {
+ ::android::Rect rect(::android::Rect::EMPTY_RECT);
+ status_t status = rect.unflatten(buffer, size);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ FlattenableUtils::advance(buffer, size, sizeof(rect));
+ (*t)[r] = Rect{
+ static_cast<int32_t>(rect.left),
+ static_cast<int32_t>(rect.top),
+ static_cast<int32_t>(rect.right),
+ static_cast<int32_t>(rect.bottom)};
+ }
+ return NO_ERROR;
+}
+
+/**
+ * \brief Flatten `Region`.
+ *
+ * \param[in] t The source `Region`.
+ * \param[in,out] buffer The pointer to the flat buffer.
+ * \param[in,out] size The size of the flat buffer.
+ * \return `NO_ERROR` on success; other value on failure.
+ */
+inline status_t flatten(Region const& t, void*& buffer, size_t& size) {
+ if (size < getFlattenedSize(t)) {
+ return NO_MEMORY;
+ }
+
+ FlattenableUtils::write(buffer, size, static_cast<uint32_t>(t.size()));
+ for (size_t r = 0; r < t.size(); ++r) {
+ ::android::Rect rect(
+ static_cast<int32_t>(t[r].left),
+ static_cast<int32_t>(t[r].top),
+ static_cast<int32_t>(t[r].right),
+ static_cast<int32_t>(t[r].bottom));
+ status_t status = rect.flatten(buffer, size);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ FlattenableUtils::advance(buffer, size, sizeof(rect));
+ }
+ return NO_ERROR;
+}
+
+/**
+ * \brief Convert `::android::Region` to `Region`.
+ *
+ * \param[out] t The destination `Region`.
+ * \param[in] l The source `::android::Region`.
+ */
+// convert: ::android::Region -> Region
+inline bool convertTo(Region* t, ::android::Region const& l) {
+ size_t const baseSize = l.getFlattenedSize();
+ std::unique_ptr<uint8_t[]> baseBuffer(
+ new (std::nothrow) uint8_t[baseSize]);
+ if (!baseBuffer) {
+ return false;
+ }
+
+ void* buffer = static_cast<void*>(baseBuffer.get());
+ size_t size = baseSize;
+ if (l.flatten(buffer, size) != NO_ERROR) {
+ return false;
+ }
+
+ void const* constBuffer = static_cast<void const*>(baseBuffer.get());
+ size = baseSize;
+ if (unflatten(t, constBuffer, size) != NO_ERROR) {
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * \brief Convert `Region` to `::android::Region`.
+ *
+ * \param[out] l The destination `::android::Region`.
+ * \param[in] t The source `Region`.
+ */
+// convert: Region -> ::android::Region
+inline bool convertTo(::android::Region* l, Region const& t) {
+ size_t const baseSize = getFlattenedSize(t);
+ std::unique_ptr<uint8_t[]> baseBuffer(
+ new (std::nothrow) uint8_t[baseSize]);
+ if (!baseBuffer) {
+ return false;
+ }
+
+ void* buffer = static_cast<void*>(baseBuffer.get());
+ size_t size = baseSize;
+ if (flatten(t, buffer, size) != NO_ERROR) {
+ return false;
+ }
+
+ void const* constBuffer = static_cast<void const*>(baseBuffer.get());
+ size = baseSize;
+ if (l->unflatten(constBuffer, size) != NO_ERROR) {
+ return false;
+ }
+
+ return true;
+}
+
+// Ref: frameworks/native/libs/gui/BGraphicBufferProducer.cpp:
+// BGraphicBufferProducer::QueueBufferInput
+
+/**
+ * \brief Return a lower bound on the size of the buffer required to flatten
+ * `HGraphicBufferProducer::QueueBufferInput`.
+ *
+ * \param[in] t The input `HGraphicBufferProducer::QueueBufferInput`.
+ * \return A lower bound on the size of the flat buffer.
+ */
+constexpr size_t minFlattenedSize(
+ HGraphicBufferProducer::QueueBufferInput const& /* t */) {
+ return sizeof(int64_t) + // timestamp
+ sizeof(int) + // isAutoTimestamp
+ sizeof(android_dataspace) + // dataSpace
+ sizeof(::android::Rect) + // crop
+ sizeof(int) + // scalingMode
+ sizeof(uint32_t) + // transform
+ sizeof(uint32_t) + // stickyTransform
+ sizeof(bool); // getFrameTimestamps
+}
+
+/**
+ * \brief Return the size of the buffer required to flatten
+ * `HGraphicBufferProducer::QueueBufferInput`.
+ *
+ * \param[in] t The input `HGraphicBufferProducer::QueueBufferInput`.
+ * \return The required size of the flat buffer.
+ */
+inline size_t getFlattenedSize(HGraphicBufferProducer::QueueBufferInput const& t) {
+ return minFlattenedSize(t) +
+ getFenceFlattenedSize(t.fence) +
+ getFlattenedSize(t.surfaceDamage);
+}
+
+/**
+ * \brief Return the number of file descriptors contained in
+ * `HGraphicBufferProducer::QueueBufferInput`.
+ *
+ * \param[in] t The input `HGraphicBufferProducer::QueueBufferInput`.
+ * \return The number of file descriptors contained in \p t.
+ */
+inline size_t getFdCount(
+ HGraphicBufferProducer::QueueBufferInput const& t) {
+ return getFenceFdCount(t.fence);
+}
+
+/**
+ * \brief Flatten `HGraphicBufferProducer::QueueBufferInput`.
+ *
+ * \param[in] t The source `HGraphicBufferProducer::QueueBufferInput`.
+ * \param[out] nh The native handle cloned from `t.fence`.
+ * \param[in,out] buffer The pointer to the flat non-fd buffer.
+ * \param[in,out] size The size of the flat non-fd buffer.
+ * \param[in,out] fds The pointer to the flat fd buffer.
+ * \param[in,out] numFds The size of the flat fd buffer.
+ * \return `NO_ERROR` on success; other value on failure.
+ *
+ * This function will duplicate the file descriptor in `t.fence`. */
+inline status_t flatten(HGraphicBufferProducer::QueueBufferInput const& t,
+ native_handle_t** nh,
+ void*& buffer, size_t& size, int*& fds, size_t& numFds) {
+ if (size < getFlattenedSize(t)) {
+ return NO_MEMORY;
+ }
+
+ FlattenableUtils::write(buffer, size, t.timestamp);
+ FlattenableUtils::write(buffer, size, static_cast<int>(t.isAutoTimestamp));
+ FlattenableUtils::write(buffer, size,
+ static_cast<android_dataspace_t>(t.dataSpace));
+ FlattenableUtils::write(buffer, size, ::android::Rect(
+ static_cast<int32_t>(t.crop.left),
+ static_cast<int32_t>(t.crop.top),
+ static_cast<int32_t>(t.crop.right),
+ static_cast<int32_t>(t.crop.bottom)));
+ FlattenableUtils::write(buffer, size, static_cast<int>(t.scalingMode));
+ FlattenableUtils::write(buffer, size, t.transform);
+ FlattenableUtils::write(buffer, size, t.stickyTransform);
+ FlattenableUtils::write(buffer, size, t.getFrameTimestamps);
+
+ *nh = t.fence.getNativeHandle() == nullptr ?
+ nullptr : native_handle_clone(t.fence);
+ status_t status = flattenFence(hidl_handle(*nh), buffer, size, fds, numFds);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ return flatten(t.surfaceDamage, buffer, size);
+}
+
+/**
+ * \brief Unflatten `HGraphicBufferProducer::QueueBufferInput`.
+ *
+ * \param[out] t The destination `HGraphicBufferProducer::QueueBufferInput`.
+ * \param[out] nh The underlying native handle for `t->fence`.
+ * \param[in,out] buffer The pointer to the flat non-fd buffer.
+ * \param[in,out] size The size of the flat non-fd buffer.
+ * \param[in,out] fds The pointer to the flat fd buffer.
+ * \param[in,out] numFds The size of the flat fd buffer.
+ * \return `NO_ERROR` on success; other value on failure.
+ *
+ * If the return value is `NO_ERROR` and `t->fence` contains a valid file
+ * descriptor, \p nh will be a newly created native handle holding that file
+ * descriptor. \p nh needs to be deleted with `native_handle_delete()`
+ * afterwards.
+ */
+inline status_t unflatten(
+ HGraphicBufferProducer::QueueBufferInput* t, native_handle_t** nh,
+ void const*& buffer, size_t& size, int const*& fds, size_t& numFds) {
+ if (size < minFlattenedSize(*t)) {
+ return NO_MEMORY;
+ }
+
+ FlattenableUtils::read(buffer, size, t->timestamp);
+ int lIsAutoTimestamp;
+ FlattenableUtils::read(buffer, size, lIsAutoTimestamp);
+ t->isAutoTimestamp = static_cast<int32_t>(lIsAutoTimestamp);
+ android_dataspace_t lDataSpace;
+ FlattenableUtils::read(buffer, size, lDataSpace);
+ t->dataSpace = static_cast<Dataspace>(lDataSpace);
+ Rect lCrop;
+ FlattenableUtils::read(buffer, size, lCrop);
+ t->crop = Rect{
+ static_cast<int32_t>(lCrop.left),
+ static_cast<int32_t>(lCrop.top),
+ static_cast<int32_t>(lCrop.right),
+ static_cast<int32_t>(lCrop.bottom)};
+ int lScalingMode;
+ FlattenableUtils::read(buffer, size, lScalingMode);
+ t->scalingMode = static_cast<int32_t>(lScalingMode);
+ FlattenableUtils::read(buffer, size, t->transform);
+ FlattenableUtils::read(buffer, size, t->stickyTransform);
+ FlattenableUtils::read(buffer, size, t->getFrameTimestamps);
+
+ status_t status = unflattenFence(&(t->fence), nh,
+ buffer, size, fds, numFds);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ return unflatten(&(t->surfaceDamage), buffer, size);
+}
+
+/**
+ * \brief Wrap `BGraphicBufferProducer::QueueBufferInput` in
+ * `HGraphicBufferProducer::QueueBufferInput`.
+ *
+ * \param[out] t The wrapper of type
+ * `HGraphicBufferProducer::QueueBufferInput`.
+ * \param[out] nh The underlying native handle for `t->fence`.
+ * \param[in] l The source `BGraphicBufferProducer::QueueBufferInput`.
+ *
+ * If the return value is `true` and `t->fence` contains a valid file
+ * descriptor, \p nh will be a newly created native handle holding that file
+ * descriptor. \p nh needs to be deleted with `native_handle_delete()`
+ * afterwards.
+ */
+inline bool wrapAs(
+ HGraphicBufferProducer::QueueBufferInput* t,
+ native_handle_t** nh,
+ BGraphicBufferProducer::QueueBufferInput const& l) {
+
+ size_t const baseSize = l.getFlattenedSize();
+ std::unique_ptr<uint8_t[]> baseBuffer(
+ new (std::nothrow) uint8_t[baseSize]);
+ if (!baseBuffer) {
+ return false;
+ }
+
+ size_t const baseNumFds = l.getFdCount();
+ std::unique_ptr<int[]> baseFds(
+ new (std::nothrow) int[baseNumFds]);
+ if (!baseFds) {
+ return false;
+ }
+
+ void* buffer = static_cast<void*>(baseBuffer.get());
+ size_t size = baseSize;
+ int* fds = baseFds.get();
+ size_t numFds = baseNumFds;
+ if (l.flatten(buffer, size, fds, numFds) != NO_ERROR) {
+ return false;
+ }
+
+ void const* constBuffer = static_cast<void const*>(baseBuffer.get());
+ size = baseSize;
+ int const* constFds = static_cast<int const*>(baseFds.get());
+ numFds = baseNumFds;
+ if (unflatten(t, nh, constBuffer, size, constFds, numFds) != NO_ERROR) {
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * \brief Convert `HGraphicBufferProducer::QueueBufferInput` to
+ * `BGraphicBufferProducer::QueueBufferInput`.
+ *
+ * \param[out] l The destination `BGraphicBufferProducer::QueueBufferInput`.
+ * \param[in] t The source `HGraphicBufferProducer::QueueBufferInput`.
+ *
+ * If `t.fence` has a valid file descriptor, it will be duplicated.
+ */
+inline bool convertTo(
+ BGraphicBufferProducer::QueueBufferInput* l,
+ HGraphicBufferProducer::QueueBufferInput const& t) {
+
+ size_t const baseSize = getFlattenedSize(t);
+ std::unique_ptr<uint8_t[]> baseBuffer(
+ new (std::nothrow) uint8_t[baseSize]);
+ if (!baseBuffer) {
+ return false;
+ }
+
+ size_t const baseNumFds = getFdCount(t);
+ std::unique_ptr<int[]> baseFds(
+ new (std::nothrow) int[baseNumFds]);
+ if (!baseFds) {
+ return false;
+ }
+
+ void* buffer = static_cast<void*>(baseBuffer.get());
+ size_t size = baseSize;
+ int* fds = baseFds.get();
+ size_t numFds = baseNumFds;
+ native_handle_t* nh;
+ if (flatten(t, &nh, buffer, size, fds, numFds) != NO_ERROR) {
+ return false;
+ }
+
+ void const* constBuffer = static_cast<void const*>(baseBuffer.get());
+ size = baseSize;
+ int const* constFds = static_cast<int const*>(baseFds.get());
+ numFds = baseNumFds;
+ if (l->unflatten(constBuffer, size, constFds, numFds) != NO_ERROR) {
+ if (nh != nullptr) {
+ native_handle_close(nh);
+ native_handle_delete(nh);
+ }
+ return false;
+ }
+
+ native_handle_delete(nh);
+ return true;
+}
+
+// Ref: frameworks/native/libs/gui/BGraphicBufferProducer.cpp:
+// BGraphicBufferProducer::QueueBufferOutput
+
+/**
+ * \brief Wrap `BGraphicBufferProducer::QueueBufferOutput` in
+ * `HGraphicBufferProducer::QueueBufferOutput`.
+ *
+ * \param[out] t The wrapper of type
+ * `HGraphicBufferProducer::QueueBufferOutput`.
+ * \param[out] nh The array of array of native handles that are referred to by
+ * members of \p t.
+ * \param[in] l The source `BGraphicBufferProducer::QueueBufferOutput`.
+ *
+ * On success, each member of \p nh will be either `nullptr` or a newly created
+ * native handle. All the non-`nullptr` elements must be deleted individually
+ * with `native_handle_delete()`.
+ */
+// wrap: BGraphicBufferProducer::QueueBufferOutput ->
+// HGraphicBufferProducer::QueueBufferOutput
+inline bool wrapAs(HGraphicBufferProducer::QueueBufferOutput* t,
+ std::vector<std::vector<native_handle_t*> >* nh,
+ BGraphicBufferProducer::QueueBufferOutput const& l) {
+ if (!wrapAs(&(t->frameTimestamps), nh, l.frameTimestamps)) {
+ return false;
+ }
+ t->width = l.width;
+ t->height = l.height;
+ t->transformHint = l.transformHint;
+ t->numPendingBuffers = l.numPendingBuffers;
+ t->nextFrameNumber = l.nextFrameNumber;
+ t->bufferReplaced = l.bufferReplaced;
+ return true;
+}
+
+/**
+ * \brief Convert `HGraphicBufferProducer::QueueBufferOutput` to
+ * `BGraphicBufferProducer::QueueBufferOutput`.
+ *
+ * \param[out] l The destination `BGraphicBufferProducer::QueueBufferOutput`.
+ * \param[in] t The source `HGraphicBufferProducer::QueueBufferOutput`.
+ *
+ * This function will duplicate all file descriptors contained in \p t.
+ */
+// convert: HGraphicBufferProducer::QueueBufferOutput ->
+// BGraphicBufferProducer::QueueBufferOutput
+inline bool convertTo(
+ BGraphicBufferProducer::QueueBufferOutput* l,
+ HGraphicBufferProducer::QueueBufferOutput const& t) {
+ if (!convertTo(&(l->frameTimestamps), t.frameTimestamps)) {
+ return false;
+ }
+ l->width = t.width;
+ l->height = t.height;
+ l->transformHint = t.transformHint;
+ l->numPendingBuffers = t.numPendingBuffers;
+ l->nextFrameNumber = t.nextFrameNumber;
+ l->bufferReplaced = t.bufferReplaced;
+ return true;
+}
+
+/**
+ * \brief Convert `BGraphicBufferProducer::DisconnectMode` to
+ * `HGraphicBufferProducer::DisconnectMode`.
+ *
+ * \param[in] l The source `BGraphicBufferProducer::DisconnectMode`.
+ * \return The corresponding `HGraphicBufferProducer::DisconnectMode`.
+ */
+inline HGraphicBufferProducer::DisconnectMode toOmxDisconnectMode(
+ BGraphicBufferProducer::DisconnectMode l) {
+ switch (l) {
+ case BGraphicBufferProducer::DisconnectMode::Api:
+ return HGraphicBufferProducer::DisconnectMode::API;
+ case BGraphicBufferProducer::DisconnectMode::AllLocal:
+ return HGraphicBufferProducer::DisconnectMode::ALL_LOCAL;
+ }
+ return HGraphicBufferProducer::DisconnectMode::API;
+}
+
+/**
+ * \brief Convert `HGraphicBufferProducer::DisconnectMode` to
+ * `BGraphicBufferProducer::DisconnectMode`.
+ *
+ * \param[in] l The source `HGraphicBufferProducer::DisconnectMode`.
+ * \return The corresponding `BGraphicBufferProducer::DisconnectMode`.
+ */
+inline BGraphicBufferProducer::DisconnectMode toGuiDisconnectMode(
+ HGraphicBufferProducer::DisconnectMode t) {
+ switch (t) {
+ case HGraphicBufferProducer::DisconnectMode::API:
+ return BGraphicBufferProducer::DisconnectMode::Api;
+ case HGraphicBufferProducer::DisconnectMode::ALL_LOCAL:
+ return BGraphicBufferProducer::DisconnectMode::AllLocal;
+ }
+ return BGraphicBufferProducer::DisconnectMode::Api;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace omx
+} // namespace media
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_MEDIA_OMX_V1_0__CONVERSION_H
diff --git a/media/libstagefright/omx/include/media/stagefright/omx/1.0/Omx.h b/media/libstagefright/omx/include/media/stagefright/omx/1.0/Omx.h
new file mode 100644
index 0000000..a6a9d3e
--- /dev/null
+++ b/media/libstagefright/omx/include/media/stagefright/omx/1.0/Omx.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2016, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_MEDIA_OMX_V1_0_OMX_H
+#define ANDROID_HARDWARE_MEDIA_OMX_V1_0_OMX_H
+
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+#include <media/stagefright/omx/OMXNodeInstance.h>
+#include <media/stagefright/xmlparser/MediaCodecsXmlParser.h>
+#include <android/hardware/media/omx/1.0/IOmx.h>
+
+namespace android {
+
+struct OMXMaster;
+
+namespace hardware {
+namespace media {
+namespace omx {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::media::omx::V1_0::IOmx;
+using ::android::hardware::media::omx::V1_0::IOmxNode;
+using ::android::hardware::media::omx::V1_0::IOmxObserver;
+using ::android::hardware::media::omx::V1_0::Status;
+using ::android::hidl::base::V1_0::IBase;
+using ::android::hardware::hidl_death_recipient;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+using ::android::wp;
+
+using ::android::OMXMaster;
+using ::android::OmxNodeOwner;
+using ::android::OMXNodeInstance;
+
+struct Omx : public IOmx, public hidl_death_recipient, public OmxNodeOwner {
+ Omx();
+ virtual ~Omx();
+
+ // Methods from IOmx
+ Return<void> listNodes(listNodes_cb _hidl_cb) override;
+ Return<void> allocateNode(
+ const hidl_string& name,
+ const sp<IOmxObserver>& observer,
+ allocateNode_cb _hidl_cb) override;
+ Return<void> createInputSurface(createInputSurface_cb _hidl_cb) override;
+
+ // Method from hidl_death_recipient
+ void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
+
+ // Method from OmxNodeOwner
+ virtual status_t freeNode(sp<OMXNodeInstance> const& instance) override;
+
+protected:
+ OMXMaster* mMaster;
+ Mutex mLock;
+ KeyedVector<wp<IBase>, sp<OMXNodeInstance> > mLiveNodes;
+ KeyedVector<OMXNodeInstance*, wp<IBase> > mNode2Observer;
+ MediaCodecsXmlParser mParser;
+};
+
+extern "C" IOmx* HIDL_FETCH_IOmx(const char* name);
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace omx
+} // namespace media
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_MEDIA_OMX_V1_0_OMX_H
diff --git a/media/libstagefright/omx/include/media/stagefright/omx/1.0/OmxStore.h b/media/libstagefright/omx/include/media/stagefright/omx/1.0/OmxStore.h
new file mode 100644
index 0000000..006d2d9
--- /dev/null
+++ b/media/libstagefright/omx/include/media/stagefright/omx/1.0/OmxStore.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2017, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_MEDIA_OMX_V1_0_OMXSTORE_H
+#define ANDROID_HARDWARE_MEDIA_OMX_V1_0_OMXSTORE_H
+
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+#include <android/hardware/media/omx/1.0/IOmxStore.h>
+#include <media/stagefright/xmlparser/MediaCodecsXmlParser.h>
+
+namespace android {
+namespace hardware {
+namespace media {
+namespace omx {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::media::omx::V1_0::IOmxStore;
+using ::android::hardware::media::omx::V1_0::IOmx;
+using ::android::hardware::media::omx::V1_0::Status;
+using ::android::hidl::base::V1_0::IBase;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+using ::android::wp;
+
+struct OmxStore : public IOmxStore {
+ OmxStore(
+ const char* owner = "default",
+ const char* const* searchDirs
+ = MediaCodecsXmlParser::defaultSearchDirs,
+ const char* mainXmlName
+ = MediaCodecsXmlParser::defaultMainXmlName,
+ const char* performanceXmlName
+ = MediaCodecsXmlParser::defaultPerformanceXmlName,
+ const char* profilingResultsXmlPath
+ = MediaCodecsXmlParser::defaultProfilingResultsXmlPath);
+
+ virtual ~OmxStore();
+
+ // Methods from IOmxStore
+ Return<void> listServiceAttributes(listServiceAttributes_cb) override;
+ Return<void> getNodePrefix(getNodePrefix_cb) override;
+ Return<void> listRoles(listRoles_cb) override;
+ Return<sp<IOmx>> getOmx(hidl_string const&) override;
+
+protected:
+ Status mParsingStatus;
+ hidl_string mPrefix;
+ hidl_vec<ServiceAttribute> mServiceAttributeList;
+ hidl_vec<RoleInfo> mRoleList;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace omx
+} // namespace media
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_MEDIA_OMX_V1_0_OMXSTORE_H
diff --git a/media/libstagefright/omx/1.0/WGraphicBufferProducer.h b/media/libstagefright/omx/include/media/stagefright/omx/1.0/WGraphicBufferProducer.h
similarity index 100%
rename from media/libstagefright/omx/1.0/WGraphicBufferProducer.h
rename to media/libstagefright/omx/include/media/stagefright/omx/1.0/WGraphicBufferProducer.h
diff --git a/media/libstagefright/omx/include/media/stagefright/omx/1.0/WGraphicBufferSource.h b/media/libstagefright/omx/include/media/stagefright/omx/1.0/WGraphicBufferSource.h
new file mode 100644
index 0000000..b9f22ab
--- /dev/null
+++ b/media/libstagefright/omx/include/media/stagefright/omx/1.0/WGraphicBufferSource.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2016, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_MEDIA_OMX_V1_0_WGRAPHICBUFFERSOURCE_H
+#define ANDROID_HARDWARE_MEDIA_OMX_V1_0_WGRAPHICBUFFERSOURCE_H
+
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+#include <android/hardware/media/omx/1.0/IGraphicBufferSource.h>
+#include <android/hardware/media/omx/1.0/IOmxNode.h>
+#include <android/hardware/graphics/common/1.0/types.h>
+#include <android/hardware/media/omx/1.0/IOmxNode.h>
+#include <android/hardware/media/omx/1.0/IGraphicBufferSource.h>
+
+#include <android/BnGraphicBufferSource.h>
+
+#include <media/stagefright/omx/GraphicBufferSource.h>
+
+namespace android {
+namespace hardware {
+namespace media {
+namespace omx {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::GraphicBufferSource;
+using ::android::hardware::graphics::common::V1_0::Dataspace;
+using ::android::hardware::media::omx::V1_0::ColorAspects;
+using ::android::hardware::media::omx::V1_0::IGraphicBufferSource;
+using ::android::hardware::media::omx::V1_0::IOmxNode;
+using ::android::hardware::media::omx::V1_0::Status;
+using ::android::hidl::base::V1_0::IBase;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+
+using ::android::IOMXNode;
+
+/**
+ * Wrapper classes for conversion
+ * ==============================
+ *
+ * Naming convention:
+ * - LW = Legacy Wrapper --- It wraps a Treble object inside a legacy object.
+ * - TW = Treble Wrapper --- It wraps a legacy object inside a Treble object.
+ */
+
+typedef ::android::hardware::media::omx::V1_0::IGraphicBufferSource
+ TGraphicBufferSource;
+
+struct TWGraphicBufferSource : public TGraphicBufferSource {
+ struct TWOmxNodeWrapper;
+ struct TWOmxBufferSource;
+ sp<GraphicBufferSource> mBase;
+ sp<IOmxBufferSource> mOmxBufferSource;
+
+ TWGraphicBufferSource(sp<GraphicBufferSource> const& base);
+ Return<Status> configure(
+ const sp<IOmxNode>& omxNode, Dataspace dataspace) override;
+ Return<Status> setSuspend(bool suspend, int64_t timeUs) override;
+ Return<Status> setRepeatPreviousFrameDelayUs(int64_t repeatAfterUs) override;
+ Return<Status> setMaxFps(float maxFps) override;
+ Return<Status> setTimeLapseConfig(double fps, double captureFps) override;
+ Return<Status> setStartTimeUs(int64_t startTimeUs) override;
+ Return<Status> setStopTimeUs(int64_t stopTimeUs) override;
+ Return<void> getStopTimeOffsetUs(getStopTimeOffsetUs_cb _hidl_cb) override;
+ Return<Status> setColorAspects(const ColorAspects& aspects) override;
+ Return<Status> setTimeOffsetUs(int64_t timeOffsetUs) override;
+ Return<Status> signalEndOfInputStream() override;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace omx
+} // namespace media
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_MEDIA_OMX_V1_0_WGRAPHICBUFFERSOURCE_H
diff --git a/media/libstagefright/omx/1.0/WOmxBufferSource.h b/media/libstagefright/omx/include/media/stagefright/omx/1.0/WOmxBufferSource.h
similarity index 100%
rename from media/libstagefright/omx/1.0/WOmxBufferSource.h
rename to media/libstagefright/omx/include/media/stagefright/omx/1.0/WOmxBufferSource.h
diff --git a/media/libstagefright/omx/include/media/stagefright/omx/1.0/WOmxNode.h b/media/libstagefright/omx/include/media/stagefright/omx/1.0/WOmxNode.h
new file mode 100644
index 0000000..38d5885
--- /dev/null
+++ b/media/libstagefright/omx/include/media/stagefright/omx/1.0/WOmxNode.h
@@ -0,0 +1,163 @@
+/*
+ * Copyright 2016, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_MEDIA_OMX_V1_0_WOMXNODE_H
+#define ANDROID_HARDWARE_MEDIA_OMX_V1_0_WOMXNODE_H
+
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+#include <utils/Errors.h>
+
+#include <media/stagefright/omx/OMXNodeInstance.h>
+
+#include <android/hardware/media/omx/1.0/IOmxNode.h>
+#include <android/hardware/media/omx/1.0/IOmxObserver.h>
+
+namespace android {
+namespace hardware {
+namespace media {
+namespace omx {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::media::omx::V1_0::CodecBuffer;
+using ::android::hardware::media::omx::V1_0::IOmxBufferSource;
+using ::android::hardware::media::omx::V1_0::IOmxNode;
+using ::android::hardware::media::omx::V1_0::IOmxObserver;
+using ::android::hardware::media::omx::V1_0::Message;
+using ::android::hardware::media::omx::V1_0::PortMode;
+using ::android::hardware::media::omx::V1_0::Status;
+using ::android::hidl::base::V1_0::IBase;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+
+/**
+ * Wrapper classes for conversion
+ * ==============================
+ *
+ * Naming convention:
+ * - LW = Legacy Wrapper --- It wraps a Treble object inside a legacy object.
+ * - TW = Treble Wrapper --- It wraps a legacy object inside a Treble object.
+ */
+
+struct LWOmxNode : public BnOMXNode {
+ sp<IOmxNode> mBase;
+ LWOmxNode(sp<IOmxNode> const& base);
+ status_t freeNode() override;
+ status_t sendCommand(
+ OMX_COMMANDTYPE cmd, OMX_S32 param) override;
+ status_t getParameter(
+ OMX_INDEXTYPE index, void *params, size_t size) override;
+ status_t setParameter(
+ OMX_INDEXTYPE index, const void *params, size_t size) override;
+ status_t getConfig(
+ OMX_INDEXTYPE index, void *params, size_t size) override;
+ status_t setConfig(
+ OMX_INDEXTYPE index, const void *params, size_t size) override;
+ status_t setPortMode(
+ OMX_U32 port_index, IOMX::PortMode mode) override;
+ status_t prepareForAdaptivePlayback(
+ OMX_U32 portIndex, OMX_BOOL enable,
+ OMX_U32 maxFrameWidth, OMX_U32 maxFrameHeight) override;
+ status_t configureVideoTunnelMode(
+ OMX_U32 portIndex, OMX_BOOL tunneled,
+ OMX_U32 audioHwSync, native_handle_t **sidebandHandle) override;
+ status_t getGraphicBufferUsage(
+ OMX_U32 port_index, OMX_U32* usage) override;
+ status_t setInputSurface(
+ const sp<IOMXBufferSource> &bufferSource) override;
+ status_t allocateSecureBuffer(
+ OMX_U32 port_index, size_t size, buffer_id *buffer,
+ void **buffer_data, sp<NativeHandle> *native_handle) override;
+ status_t useBuffer(
+ OMX_U32 port_index, const OMXBuffer &omxBuf,
+ buffer_id *buffer) override;
+ status_t freeBuffer(
+ OMX_U32 port_index, buffer_id buffer) override;
+ status_t fillBuffer(
+ buffer_id buffer, const OMXBuffer &omxBuf,
+ int fenceFd = -1) override;
+ status_t emptyBuffer(
+ buffer_id buffer, const OMXBuffer &omxBuf,
+ OMX_U32 flags, OMX_TICKS timestamp, int fenceFd = -1) override;
+ status_t getExtensionIndex(
+ const char *parameter_name,
+ OMX_INDEXTYPE *index) override;
+ status_t dispatchMessage(const omx_message &msg) override;
+};
+
+struct TWOmxNode : public IOmxNode {
+ sp<IOMXNode> mBase;
+ TWOmxNode(sp<IOMXNode> const& base);
+
+ Return<Status> freeNode() override;
+ Return<Status> sendCommand(uint32_t cmd, int32_t param) override;
+ Return<void> getParameter(
+ uint32_t index, hidl_vec<uint8_t> const& inParams,
+ getParameter_cb _hidl_cb) override;
+ Return<Status> setParameter(
+ uint32_t index, hidl_vec<uint8_t> const& params) override;
+ Return<void> getConfig(
+ uint32_t index, hidl_vec<uint8_t> const& inConfig,
+ getConfig_cb _hidl_cb) override;
+ Return<Status> setConfig(
+ uint32_t index, hidl_vec<uint8_t> const& config) override;
+ Return<Status> setPortMode(uint32_t portIndex, PortMode mode) override;
+ Return<Status> prepareForAdaptivePlayback(
+ uint32_t portIndex, bool enable,
+ uint32_t maxFrameWidth, uint32_t maxFrameHeight) override;
+ Return<void> configureVideoTunnelMode(
+ uint32_t portIndex, bool tunneled, uint32_t audioHwSync,
+ configureVideoTunnelMode_cb _hidl_cb) override;
+ Return<void> getGraphicBufferUsage(
+ uint32_t portIndex,
+ getGraphicBufferUsage_cb _hidl_cb) override;
+ Return<Status> setInputSurface(
+ sp<IOmxBufferSource> const& bufferSource) override;
+ Return<void> allocateSecureBuffer(
+ uint32_t portIndex, uint64_t size,
+ allocateSecureBuffer_cb _hidl_cb) override;
+ Return<void> useBuffer(
+ uint32_t portIndex, CodecBuffer const& codecBuffer,
+ useBuffer_cb _hidl_cb) override;
+ Return<Status> freeBuffer(uint32_t portIndex, uint32_t buffer) override;
+ Return<Status> fillBuffer(
+ uint32_t buffer, CodecBuffer const& codecBuffer,
+ const hidl_handle& fence) override;
+ Return<Status> emptyBuffer(
+ uint32_t buffer, CodecBuffer const& codecBuffer,
+ uint32_t flags, uint64_t timestampUs,
+ hidl_handle const& fence) override;
+ Return<void> getExtensionIndex(
+ hidl_string const& parameterName,
+ getExtensionIndex_cb _hidl_cb) override;
+ Return<Status> dispatchMessage(Message const& msg) override;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace omx
+} // namespace media
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_MEDIA_OMX_V1_0_WOMXNODE_H
diff --git a/media/libstagefright/omx/1.0/WOmxObserver.h b/media/libstagefright/omx/include/media/stagefright/omx/1.0/WOmxObserver.h
similarity index 100%
rename from media/libstagefright/omx/1.0/WOmxObserver.h
rename to media/libstagefright/omx/include/media/stagefright/omx/1.0/WOmxObserver.h
diff --git a/media/libstagefright/omx/1.0/WProducerListener.h b/media/libstagefright/omx/include/media/stagefright/omx/1.0/WProducerListener.h
similarity index 100%
rename from media/libstagefright/omx/1.0/WProducerListener.h
rename to media/libstagefright/omx/include/media/stagefright/omx/1.0/WProducerListener.h
diff --git a/media/libstagefright/omx/BWGraphicBufferSource.h b/media/libstagefright/omx/include/media/stagefright/omx/BWGraphicBufferSource.h
similarity index 100%
rename from media/libstagefright/omx/BWGraphicBufferSource.h
rename to media/libstagefright/omx/include/media/stagefright/omx/BWGraphicBufferSource.h
diff --git a/media/libstagefright/omx/FrameDropper.h b/media/libstagefright/omx/include/media/stagefright/omx/FrameDropper.h
similarity index 100%
rename from media/libstagefright/omx/FrameDropper.h
rename to media/libstagefright/omx/include/media/stagefright/omx/FrameDropper.h
diff --git a/media/libstagefright/omx/include/media/stagefright/omx/GraphicBufferSource.h b/media/libstagefright/omx/include/media/stagefright/omx/GraphicBufferSource.h
new file mode 100644
index 0000000..84fee6f
--- /dev/null
+++ b/media/libstagefright/omx/include/media/stagefright/omx/GraphicBufferSource.h
@@ -0,0 +1,485 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef GRAPHIC_BUFFER_SOURCE_H_
+
+#define GRAPHIC_BUFFER_SOURCE_H_
+
+#include <gui/IGraphicBufferProducer.h>
+#include <gui/BufferQueue.h>
+#include <utils/RefBase.h>
+
+#include <media/hardware/VideoAPI.h>
+#include <media/IOMX.h>
+#include <media/OMXFenceParcelable.h>
+#include <media/stagefright/foundation/ABase.h>
+#include <media/stagefright/foundation/AHandlerReflector.h>
+#include <media/stagefright/foundation/ALooper.h>
+
+#include <android/BnGraphicBufferSource.h>
+#include <android/BnOMXBufferSource.h>
+
+#include "IOmxNodeWrapper.h"
+
+namespace android {
+
+using ::android::binder::Status;
+
+struct FrameDropper;
+
+/*
+ * This class is used to feed OMX codecs from a Surface via BufferQueue or
+ * HW producer.
+ *
+ * Instances of the class don't run on a dedicated thread. Instead,
+ * various events trigger data movement:
+ *
+ * - Availability of a new frame of data from the BufferQueue (notified
+ * via the onFrameAvailable callback).
+ * - The return of a codec buffer (via OnEmptyBufferDone).
+ * - Application signaling end-of-stream.
+ * - Transition to or from "executing" state.
+ *
+ * Frames of data (and, perhaps, the end-of-stream indication) can arrive
+ * before the codec is in the "executing" state, so we need to queue
+ * things up until we're ready to go.
+ *
+ * The GraphicBufferSource can be configure dynamically to discard frames
+ * from the source:
+ *
+ * - if their timestamp is less than a start time
+ * - if the source is suspended or stopped and the suspend/stop-time is reached
+ * - if EOS was signaled
+ * - if there is no encoder connected to it
+ *
+ * The source, furthermore, may choose to not encode (drop) frames if:
+ *
+ * - to throttle the frame rate (keep it under a certain limit)
+ *
+ * Finally the source may optionally hold onto the last non-discarded frame
+ * (even if it was dropped) to reencode it after an interval if no further
+ * frames are sent by the producer.
+ */
+class GraphicBufferSource : public BufferQueue::ConsumerListener {
+public:
+ GraphicBufferSource();
+
+ virtual ~GraphicBufferSource();
+
+ // We can't throw an exception if the constructor fails, so we just set
+ // this and require that the caller test the value.
+ status_t initCheck() const {
+ return mInitCheck;
+ }
+
+ // Returns the handle to the producer side of the BufferQueue. Buffers
+ // queued on this will be received by GraphicBufferSource.
+ sp<IGraphicBufferProducer> getIGraphicBufferProducer() const {
+ return mProducer;
+ }
+
+ // OmxBufferSource interface
+ // ------------------------------
+
+ // This is called when OMX transitions to OMX_StateExecuting, which means
+ // we can start handing it buffers. If we already have buffers of data
+ // sitting in the BufferQueue, this will send them to the codec.
+ Status onOmxExecuting();
+
+ // This is called when OMX transitions to OMX_StateIdle, indicating that
+ // the codec is meant to return all buffers back to the client for them
+ // to be freed. Do NOT submit any more buffers to the component.
+ Status onOmxIdle();
+
+ // This is called when OMX transitions to OMX_StateLoaded, indicating that
+ // we are shutting down.
+ Status onOmxLoaded();
+
+ // A "codec buffer", i.e. a buffer that can be used to pass data into
+ // the encoder, has been allocated. (This call does not call back into
+ // OMXNodeInstance.)
+ Status onInputBufferAdded(int32_t bufferId);
+
+ // Called from OnEmptyBufferDone. If we have a BQ buffer available,
+ // fill it with a new frame of data; otherwise, just mark it as available.
+ Status onInputBufferEmptied(int32_t bufferId, int fenceFd);
+
+ // IGraphicBufferSource interface
+ // ------------------------------
+
+ // Configure the buffer source to be used with an OMX node with the default
+ // data space.
+ status_t configure(
+ const sp<IOmxNodeWrapper> &omxNode,
+ int32_t dataSpace,
+ int32_t bufferCount,
+ uint32_t frameWidth,
+ uint32_t frameHeight,
+ uint32_t consumerUsage);
+
+ // This is called after the last input frame has been submitted or buffer
+ // timestamp is greater or equal than stopTimeUs. We need to submit an empty
+ // buffer with the EOS flag set. If we don't have a codec buffer ready,
+ // we just set the mEndOfStream flag.
+ status_t signalEndOfInputStream();
+
+ // If suspend is true, all incoming buffers (including those currently
+ // in the BufferQueue) with timestamp larger than timeUs will be discarded
+ // until the suspension is lifted. If suspend is false, all incoming buffers
+ // including those currently in the BufferQueue) with timestamp larger than
+ // timeUs will be processed. timeUs uses SYSTEM_TIME_MONOTONIC time base.
+ status_t setSuspend(bool suspend, int64_t timeUs);
+
+ // Specifies the interval after which we requeue the buffer previously
+ // queued to the encoder. This is useful in the case of surface flinger
+ // providing the input surface if the resulting encoded stream is to
+ // be displayed "live". If we were not to push through the extra frame
+ // the decoder on the remote end would be unable to decode the latest frame.
+ // This API must be called before transitioning the encoder to "executing"
+ // state and once this behaviour is specified it cannot be reset.
+ status_t setRepeatPreviousFrameDelayUs(int64_t repeatAfterUs);
+
+ // Sets the input buffer timestamp offset.
+ // When set, the sample's timestamp will be adjusted with the timeOffsetUs.
+ status_t setTimeOffsetUs(int64_t timeOffsetUs);
+
+ // When set, the max frame rate fed to the encoder will be capped at maxFps.
+ status_t setMaxFps(float maxFps);
+
+ // Sets the time lapse (or slow motion) parameters.
+ // When set, the sample's timestamp will be modified to playback framerate,
+ // and capture timestamp will be modified to capture rate.
+ status_t setTimeLapseConfig(double fps, double captureFps);
+
+ // Sets the start time us (in system time), samples before which should
+ // be dropped and not submitted to encoder
+ status_t setStartTimeUs(int64_t startTimeUs);
+
+ // Sets the stop time us (in system time), samples after which should be dropped
+ // and not submitted to encoder. timeUs uses SYSTEM_TIME_MONOTONIC time base.
+ status_t setStopTimeUs(int64_t stopTimeUs);
+
+ // Gets the stop time offset in us. This is the time offset between latest buffer
+ // time and the stopTimeUs. If stop time is not set, INVALID_OPERATION will be returned.
+ // If return is OK, *stopTimeOffsetUs will contain the valid offset. Otherwise,
+ // *stopTimeOffsetUs will not be modified. Positive stopTimeOffsetUs means buffer time
+ // larger than stopTimeUs.
+ status_t getStopTimeOffsetUs(int64_t *stopTimeOffsetUs);
+
+ // Sets the desired color aspects, e.g. to be used when producer does not specify a dataspace.
+ status_t setColorAspects(int32_t aspectsPacked);
+
+protected:
+ // BQ::ConsumerListener interface
+ // ------------------------------
+
+ // BufferQueue::ConsumerListener interface, called when a new frame of
+ // data is available. If we're executing and a codec buffer is
+ // available, we acquire the buffer, copy the GraphicBuffer reference
+ // into the codec buffer, and call Empty[This]Buffer. If we're not yet
+ // executing or there's no codec buffer available, we just increment
+ // mNumFramesAvailable and return.
+ void onFrameAvailable(const BufferItem& item) override;
+
+ // BufferQueue::ConsumerListener interface, called when the client has
+ // released one or more GraphicBuffers. We clear out the appropriate
+ // set of mBufferSlot entries.
+ void onBuffersReleased() override;
+
+ // BufferQueue::ConsumerListener interface, called when the client has
+ // changed the sideband stream. GraphicBufferSource doesn't handle sideband
+ // streams so this is a no-op (and should never be called).
+ void onSidebandStreamChanged() override;
+
+private:
+ // Lock, covers all member variables.
+ mutable Mutex mMutex;
+
+ // Used to report constructor failure.
+ status_t mInitCheck;
+
+ // Graphic buffer reference objects
+ // --------------------------------
+
+ // These are used to keep a shared reference to GraphicBuffers and gralloc handles owned by the
+ // GraphicBufferSource as well as to manage the cache slots. Separate references are owned by
+ // the buffer cache (controlled by the buffer queue/buffer producer) and the codec.
+
+ // When we get a buffer from the producer (BQ) it designates them to be cached into specific
+ // slots. Each slot owns a shared reference to the graphic buffer (we track these using
+ // CachedBuffer) that is in that slot, but the producer controls the slots.
+ struct CachedBuffer;
+
+ // When we acquire a buffer, we must release it back to the producer once we (or the codec)
+ // no longer uses it (as long as the buffer is still in the cache slot). We use shared
+ // AcquiredBuffer instances for this purpose - and we call release buffer when the last
+ // reference is relinquished.
+ struct AcquiredBuffer;
+
+ // We also need to keep some extra metadata (other than the buffer reference) for acquired
+ // buffers. These are tracked in VideoBuffer struct.
+ struct VideoBuffer {
+ std::shared_ptr<AcquiredBuffer> mBuffer;
+ nsecs_t mTimestampNs;
+ android_dataspace_t mDataspace;
+ };
+
+ // Cached and aquired buffers
+ // --------------------------------
+
+ typedef int slot_id;
+
+ // Maps a slot to the cached buffer in that slot
+ KeyedVector<slot_id, std::shared_ptr<CachedBuffer>> mBufferSlots;
+
+ // Queue of buffers acquired in chronological order that are not yet submitted to the codec
+ List<VideoBuffer> mAvailableBuffers;
+
+ // Number of buffers that have been signaled by the producer that they are available, but
+ // we've been unable to acquire them due to our max acquire count
+ int32_t mNumAvailableUnacquiredBuffers;
+
+ // Number of frames acquired from consumer (debug only)
+ // (as in aquireBuffer called, and release needs to be called)
+ int32_t mNumOutstandingAcquires;
+
+ // Acquire a buffer from the BQ and store it in |item| if successful
+ // \return OK on success, or error on failure.
+ status_t acquireBuffer_l(VideoBuffer *item);
+
+ // Called when a buffer was acquired from the producer
+ void onBufferAcquired_l(const VideoBuffer &buffer);
+
+ // marks the buffer at the slot no longer cached, and accounts for the outstanding
+ // acquire count. Returns true if the slot was populated; otherwise, false.
+ bool discardBufferInSlot_l(slot_id i);
+
+ // marks the buffer at the slot index no longer cached, and accounts for the outstanding
+ // acquire count
+ void discardBufferAtSlotIndex_l(ssize_t bsi);
+
+ // release all acquired and unacquired available buffers
+ // This method will return if it fails to acquire an unacquired available buffer, which will
+ // leave mNumAvailableUnacquiredBuffers positive on return.
+ void releaseAllAvailableBuffers_l();
+
+ // returns whether we have any available buffers (acquired or not-yet-acquired)
+ bool haveAvailableBuffers_l() const {
+ return !mAvailableBuffers.empty() || mNumAvailableUnacquiredBuffers > 0;
+ }
+
+ // Codec buffers
+ // -------------
+
+ // When we queue buffers to the encoder, we must hold the references to the graphic buffers
+ // in those buffers - as the producer may free the slots.
+
+ typedef int32_t codec_buffer_id;
+
+ // set of codec buffer ID-s of buffers available to fill
+ List<codec_buffer_id> mFreeCodecBuffers;
+
+ // maps codec buffer ID-s to buffer info submitted to the codec. Used to keep a reference for
+ // the graphics buffer.
+ KeyedVector<codec_buffer_id, std::shared_ptr<AcquiredBuffer>> mSubmittedCodecBuffers;
+
+ // Processes the next acquired frame. If there is no available codec buffer, it returns false
+ // without any further action.
+ //
+ // Otherwise, it consumes the next acquired frame and determines if it needs to be discarded or
+ // dropped. If neither are needed, it submits it to the codec. It also saves the latest
+ // non-dropped frame and submits it for repeat encoding (if this is enabled).
+ //
+ // \require there must be an acquired frame (i.e. we're in the onFrameAvailable callback,
+ // or if we're in codecBufferEmptied and mNumFramesAvailable is nonzero).
+ // \require codec must be executing
+ // \returns true if acquired (and handled) the next frame. Otherwise, false.
+ bool fillCodecBuffer_l();
+
+ // Calculates the media timestamp for |item| and on success it submits the buffer to the codec,
+ // while also keeping a reference for it in mSubmittedCodecBuffers.
+ // Returns UNKNOWN_ERROR if the buffer was not submitted due to buffer timestamp. Otherwise,
+ // it returns any submit success or error value returned by the codec.
+ status_t submitBuffer_l(const VideoBuffer &item);
+
+ // Submits an empty buffer, with the EOS flag set if there is an available codec buffer and
+ // sets mEndOfStreamSent flag. Does nothing if there is no codec buffer available.
+ void submitEndOfInputStream_l();
+
+ // Set to true if we want to send end-of-stream after we run out of available frames from the
+ // producer
+ bool mEndOfStream;
+
+ // Flag that the EOS was submitted to the encoder
+ bool mEndOfStreamSent;
+
+ // Dataspace for the last frame submitted to the codec
+ android_dataspace mLastDataspace;
+
+ // Default color aspects for this source
+ int32_t mDefaultColorAspectsPacked;
+
+ // called when the data space of the input buffer changes
+ void onDataspaceChanged_l(android_dataspace dataspace, android_pixel_format pixelFormat);
+
+ // Pointer back to the Omx node that created us. We send buffers here.
+ sp<IOmxNodeWrapper> mOMXNode;
+
+ // Set by omxExecuting() / omxIdling().
+ bool mExecuting;
+
+ bool mSuspended;
+
+ // returns true if this source is unconditionally discarding acquired buffers at the moment
+ // regardless of the metadata of those buffers
+ bool areWeDiscardingAvailableBuffers_l();
+
+ int64_t mLastFrameTimestampUs;
+
+ // Our BufferQueue interfaces. mProducer is passed to the producer through
+ // getIGraphicBufferProducer, and mConsumer is used internally to retrieve
+ // the buffers queued by the producer.
+ sp<IGraphicBufferProducer> mProducer;
+ sp<IGraphicBufferConsumer> mConsumer;
+
+ // The time to stop sending buffers.
+ int64_t mStopTimeUs;
+
+ struct ActionItem {
+ typedef enum {
+ PAUSE,
+ RESUME,
+ STOP
+ } ActionType;
+ ActionType mAction;
+ int64_t mActionTimeUs;
+ };
+
+ // Maintain last action timestamp to ensure all the action timestamps are
+ // monotonically increasing.
+ int64_t mLastActionTimeUs;
+
+ // An action queue that queue up all the actions sent to GraphicBufferSource.
+ // STOP action should only show up at the end of the list as all the actions
+ // after a STOP action will be discarded. mActionQueue is protected by mMutex.
+ List<ActionItem> mActionQueue;
+
+ ////
+ friend struct AHandlerReflector<GraphicBufferSource>;
+
+ enum {
+ kWhatRepeatLastFrame, ///< queue last frame for reencoding
+ };
+ enum {
+ kRepeatLastFrameCount = 10,
+ };
+
+ int64_t mSkipFramesBeforeNs;
+
+ sp<FrameDropper> mFrameDropper;
+
+ sp<ALooper> mLooper;
+ sp<AHandlerReflector<GraphicBufferSource> > mReflector;
+
+ // Repeat last frame feature
+ // -------------------------
+ // configuration parameter: repeat interval for frame repeating (<0 if repeating is disabled)
+ int64_t mFrameRepeatIntervalUs;
+
+ // current frame repeat generation - used to cancel a pending frame repeat
+ int32_t mRepeatLastFrameGeneration;
+
+ // number of times to repeat latest frame (0 = none)
+ int32_t mOutstandingFrameRepeatCount;
+
+ // The previous buffer should've been repeated but
+ // no codec buffer was available at the time.
+ bool mFrameRepeatBlockedOnCodecBuffer;
+
+ // hold a reference to the last acquired (and not discarded) frame for frame repeating
+ VideoBuffer mLatestBuffer;
+
+ // queue last frame for reencode after the repeat interval.
+ void queueFrameRepeat_l();
+
+ // save |item| as the latest buffer and queue it for reencode (repeat)
+ void setLatestBuffer_l(const VideoBuffer &item);
+
+ // submit last frame to encoder and queue it for reencode
+ // \return true if buffer was submitted, false if it wasn't (e.g. source is suspended, there
+ // is no available codec buffer)
+ bool repeatLatestBuffer_l();
+
+ // Time lapse / slow motion configuration
+ // --------------------------------------
+
+ // desired frame rate for encoding - value <= 0 if undefined
+ double mFps;
+
+ // desired frame rate for capture - value <= 0 if undefined
+ double mCaptureFps;
+
+ // Time lapse mode is enabled if the capture frame rate is defined and it is
+ // smaller than half the encoding frame rate (if defined). In this mode,
+ // frames that come in between the capture interval (the reciprocal of the
+ // capture frame rate) are dropped and the encoding timestamp is adjusted to
+ // match the desired encoding frame rate.
+ //
+ // Slow motion mode is enabled if both encoding and capture frame rates are
+ // defined and the encoding frame rate is less than half the capture frame
+ // rate. In this mode, the source is expected to produce frames with an even
+ // timestamp interval (after rounding) with the configured capture fps. The
+ // first source timestamp is used as the source base time. Afterwards, the
+ // timestamp of each source frame is snapped to the nearest expected capture
+ // timestamp and scaled to match the configured encoding frame rate.
+
+ // These modes must be enabled before using this source.
+
+ // adjusted capture timestamp of the base frame
+ int64_t mBaseCaptureUs;
+
+ // adjusted encoding timestamp of the base frame
+ int64_t mBaseFrameUs;
+
+ // number of frames from the base time
+ int64_t mFrameCount;
+
+ // adjusted capture timestamp for previous frame (negative if there were
+ // none)
+ int64_t mPrevCaptureUs;
+
+ // adjusted media timestamp for previous frame (negative if there were none)
+ int64_t mPrevFrameUs;
+
+ // desired offset between media time and capture time
+ int64_t mInputBufferTimeOffsetUs;
+
+ // Calculates and outputs the timestamp to use for a buffer with a specific buffer timestamp
+ // |bufferTimestampNs|. Returns false on failure (buffer too close or timestamp is moving
+ // backwards). Otherwise, stores the media timestamp in |*codecTimeUs| and returns true.
+ //
+ // This method takes into account the start time offset and any time lapse or slow motion time
+ // adjustment requests.
+ bool calculateCodecTimestamp_l(nsecs_t bufferTimeNs, int64_t *codecTimeUs);
+
+ void onMessageReceived(const sp<AMessage> &msg);
+
+ DISALLOW_EVIL_CONSTRUCTORS(GraphicBufferSource);
+};
+
+} // namespace android
+
+#endif // GRAPHIC_BUFFER_SOURCE_H_
diff --git a/media/libstagefright/omx/IOmxNodeWrapper.h b/media/libstagefright/omx/include/media/stagefright/omx/IOmxNodeWrapper.h
similarity index 100%
rename from media/libstagefright/omx/IOmxNodeWrapper.h
rename to media/libstagefright/omx/include/media/stagefright/omx/IOmxNodeWrapper.h
diff --git a/media/libstagefright/omx/include/media/stagefright/omx/OMX.h b/media/libstagefright/omx/include/media/stagefright/omx/OMX.h
new file mode 100644
index 0000000..594b4c0
--- /dev/null
+++ b/media/libstagefright/omx/include/media/stagefright/omx/OMX.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_OMX_H_
+#define ANDROID_OMX_H_
+
+#include <media/IOMX.h>
+#include <utils/threads.h>
+#include <utils/KeyedVector.h>
+#include <media/stagefright/xmlparser/MediaCodecsXmlParser.h>
+#include "OmxNodeOwner.h"
+
+namespace android {
+
+struct OMXMaster;
+struct OMXNodeInstance;
+
+class OMX : public BnOMX,
+ public OmxNodeOwner,
+ public IBinder::DeathRecipient {
+public:
+ OMX();
+
+ virtual status_t listNodes(List<ComponentInfo> *list);
+
+ virtual status_t allocateNode(
+ const char *name, const sp<IOMXObserver> &observer,
+ sp<IOMXNode> *omxNode);
+
+ virtual status_t createInputSurface(
+ sp<IGraphicBufferProducer> *bufferProducer,
+ sp<IGraphicBufferSource> *bufferSource);
+
+ virtual void binderDied(const wp<IBinder> &the_late_who);
+
+ virtual status_t freeNode(const sp<OMXNodeInstance>& instance);
+
+protected:
+ virtual ~OMX();
+
+private:
+ Mutex mLock;
+ OMXMaster *mMaster;
+ MediaCodecsXmlParser mParser;
+
+ KeyedVector<wp<IBinder>, sp<OMXNodeInstance> > mLiveNodes;
+
+ OMX(const OMX &);
+ OMX &operator=(const OMX &);
+};
+
+} // namespace android
+
+#endif // ANDROID_OMX_H_
diff --git a/media/libstagefright/omx/include/media/stagefright/omx/OMXMaster.h b/media/libstagefright/omx/include/media/stagefright/omx/OMXMaster.h
new file mode 100644
index 0000000..897f287
--- /dev/null
+++ b/media/libstagefright/omx/include/media/stagefright/omx/OMXMaster.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OMX_MASTER_H_
+
+#define OMX_MASTER_H_
+
+#include <media/hardware/OMXPluginBase.h>
+
+#include <utils/threads.h>
+#include <utils/KeyedVector.h>
+#include <utils/List.h>
+#include <utils/String8.h>
+
+namespace android {
+
+struct OMXMaster : public OMXPluginBase {
+ OMXMaster();
+ virtual ~OMXMaster();
+
+ virtual OMX_ERRORTYPE makeComponentInstance(
+ const char *name,
+ const OMX_CALLBACKTYPE *callbacks,
+ OMX_PTR appData,
+ OMX_COMPONENTTYPE **component);
+
+ virtual OMX_ERRORTYPE destroyComponentInstance(
+ OMX_COMPONENTTYPE *component);
+
+ virtual OMX_ERRORTYPE enumerateComponents(
+ OMX_STRING name,
+ size_t size,
+ OMX_U32 index);
+
+ virtual OMX_ERRORTYPE getRolesOfComponent(
+ const char *name,
+ Vector<String8> *roles);
+
+private:
+ char mProcessName[16];
+ Mutex mLock;
+ List<OMXPluginBase *> mPlugins;
+ KeyedVector<String8, OMXPluginBase *> mPluginByComponentName;
+ KeyedVector<OMX_COMPONENTTYPE *, OMXPluginBase *> mPluginByInstance;
+
+ void *mVendorLibHandle;
+
+ void addVendorPlugin();
+ void addPlugin(const char *libname);
+ void addPlugin(OMXPluginBase *plugin);
+ void clearPlugins();
+
+ OMXMaster(const OMXMaster &);
+ OMXMaster &operator=(const OMXMaster &);
+};
+
+} // namespace android
+
+#endif // OMX_MASTER_H_
diff --git a/media/libstagefright/omx/include/media/stagefright/omx/OMXNodeInstance.h b/media/libstagefright/omx/include/media/stagefright/omx/OMXNodeInstance.h
new file mode 100644
index 0000000..1065ca5
--- /dev/null
+++ b/media/libstagefright/omx/include/media/stagefright/omx/OMXNodeInstance.h
@@ -0,0 +1,299 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OMX_NODE_INSTANCE_H_
+
+#define OMX_NODE_INSTANCE_H_
+
+#include <atomic>
+
+#include <media/IOMX.h>
+#include <utils/RefBase.h>
+#include <utils/threads.h>
+#include <utils/KeyedVector.h>
+#include <utils/SortedVector.h>
+#include "OmxNodeOwner.h"
+
+#include <android/hidl/memory/1.0/IMemory.h>
+
+namespace android {
+class GraphicBuffer;
+class IOMXBufferSource;
+class IOMXObserver;
+struct OMXMaster;
+class OMXBuffer;
+typedef hidl::memory::V1_0::IMemory IHidlMemory;
+
+struct OMXNodeInstance : public BnOMXNode {
+ OMXNodeInstance(
+ OmxNodeOwner *owner, const sp<IOMXObserver> &observer, const char *name);
+
+ void setHandle(OMX_HANDLETYPE handle);
+
+ OMX_HANDLETYPE handle();
+ sp<IOMXObserver> observer();
+
+ status_t freeNode() override;
+
+ status_t sendCommand(OMX_COMMANDTYPE cmd, OMX_S32 param);
+ status_t getParameter(OMX_INDEXTYPE index, void *params, size_t size);
+
+ status_t setParameter(
+ OMX_INDEXTYPE index, const void *params, size_t size);
+
+ status_t getConfig(OMX_INDEXTYPE index, void *params, size_t size);
+ status_t setConfig(OMX_INDEXTYPE index, const void *params, size_t size);
+
+ status_t setPortMode(OMX_U32 port_index, IOMX::PortMode mode);
+
+ status_t getGraphicBufferUsage(OMX_U32 portIndex, OMX_U32* usage);
+
+ status_t prepareForAdaptivePlayback(
+ OMX_U32 portIndex, OMX_BOOL enable,
+ OMX_U32 maxFrameWidth, OMX_U32 maxFrameHeight);
+
+ status_t configureVideoTunnelMode(
+ OMX_U32 portIndex, OMX_BOOL tunneled,
+ OMX_U32 audioHwSync, native_handle_t **sidebandHandle);
+
+ status_t setInputSurface(
+ const sp<IOMXBufferSource> &bufferSource);
+
+ status_t allocateSecureBuffer(
+ OMX_U32 portIndex, size_t size, IOMX::buffer_id *buffer,
+ void **buffer_data, sp<NativeHandle> *native_handle);
+
+ status_t useBuffer(
+ OMX_U32 portIndex, const OMXBuffer &omxBuf, buffer_id *buffer);
+
+ status_t freeBuffer(
+ OMX_U32 portIndex, buffer_id buffer);
+
+ status_t fillBuffer(
+ buffer_id buffer, const OMXBuffer &omxBuf, int fenceFd = -1);
+
+ status_t emptyBuffer(
+ buffer_id buffer, const OMXBuffer &omxBuf,
+ OMX_U32 flags, OMX_TICKS timestamp, int fenceFd = -1);
+
+ status_t getExtensionIndex(
+ const char *parameterName, OMX_INDEXTYPE *index);
+
+ // Quirk still supported, even though deprecated
+ enum Quirks {
+ kRequiresAllocateBufferOnInputPorts = 1,
+ kRequiresAllocateBufferOnOutputPorts = 2,
+
+ kQuirksMask = kRequiresAllocateBufferOnInputPorts
+ | kRequiresAllocateBufferOnOutputPorts,
+ };
+
+ status_t setQuirks(OMX_U32 quirks);
+
+ bool isSecure() const {
+ return mIsSecure;
+ }
+
+ status_t dispatchMessage(const omx_message &msg) override;
+
+ // handles messages and removes them from the list
+ void onMessages(std::list<omx_message> &messages);
+ void onObserverDied();
+ void onEvent(OMX_EVENTTYPE event, OMX_U32 arg1, OMX_U32 arg2);
+
+ static OMX_CALLBACKTYPE kCallbacks;
+
+private:
+ struct CallbackDispatcherThread;
+ struct CallbackDispatcher;
+
+ Mutex mLock;
+
+ OmxNodeOwner *mOwner;
+ OMX_HANDLETYPE mHandle;
+ sp<IOMXObserver> mObserver;
+ sp<CallbackDispatcher> mDispatcher;
+ std::atomic_bool mDying;
+ bool mSailed; // configuration is set (no more meta-mode changes)
+ bool mQueriedProhibitedExtensions;
+ SortedVector<OMX_INDEXTYPE> mProhibitedExtensions;
+ bool mIsSecure;
+ uint32_t mQuirks;
+
+ // Lock only covers mOMXBufferSource and mOMXOutputListener. We can't always
+ // use mLock because of rare instances where we'd end up locking it recursively.
+ Mutex mOMXBufferSourceLock;
+ // Access these through getBufferSource().
+ sp<IOMXBufferSource> mOMXBufferSource;
+
+ struct ActiveBuffer {
+ OMX_U32 mPortIndex;
+ IOMX::buffer_id mID;
+ };
+ Vector<ActiveBuffer> mActiveBuffers;
+ // for buffer ptr to buffer id translation
+ Mutex mBufferIDLock;
+ uint32_t mBufferIDCount;
+ KeyedVector<IOMX::buffer_id, OMX_BUFFERHEADERTYPE *> mBufferIDToBufferHeader;
+ KeyedVector<OMX_BUFFERHEADERTYPE *, IOMX::buffer_id> mBufferHeaderToBufferID;
+
+ bool mLegacyAdaptiveExperiment;
+ IOMX::PortMode mPortMode[2];
+ // metadata and secure buffer types and graphic buffer mode tracking
+ MetadataBufferType mMetadataType[2];
+ enum SecureBufferType {
+ kSecureBufferTypeUnknown,
+ kSecureBufferTypeOpaque,
+ kSecureBufferTypeNativeHandle,
+ };
+ SecureBufferType mSecureBufferType[2];
+ bool mGraphicBufferEnabled[2];
+
+ // Following are OMX parameters managed by us (instead of the component)
+ // OMX_IndexParamMaxFrameDurationForBitrateControl
+ KeyedVector<int64_t, int64_t> mOriginalTimeUs;
+ bool mRestorePtsFailed;
+ int64_t mMaxTimestampGapUs;
+ int64_t mPrevOriginalTimeUs;
+ int64_t mPrevModifiedTimeUs;
+
+ // For debug support
+ char *mName;
+ int DEBUG;
+ size_t mNumPortBuffers[2]; // modified under mLock, read outside for debug
+ Mutex mDebugLock;
+ // following are modified and read under mDebugLock
+ int DEBUG_BUMP;
+ SortedVector<OMX_BUFFERHEADERTYPE *> mInputBuffersWithCodec, mOutputBuffersWithCodec;
+ size_t mDebugLevelBumpPendingBuffers[2];
+ void bumpDebugLevel_l(size_t numInputBuffers, size_t numOutputBuffers);
+ void unbumpDebugLevel_l(size_t portIndex);
+
+ ~OMXNodeInstance();
+
+ void addActiveBuffer(OMX_U32 portIndex, IOMX::buffer_id id);
+ void removeActiveBuffer(OMX_U32 portIndex, IOMX::buffer_id id);
+ void freeActiveBuffers();
+
+ // For buffer id management
+ IOMX::buffer_id makeBufferID(OMX_BUFFERHEADERTYPE *bufferHeader);
+ OMX_BUFFERHEADERTYPE *findBufferHeader(IOMX::buffer_id buffer, OMX_U32 portIndex);
+ IOMX::buffer_id findBufferID(OMX_BUFFERHEADERTYPE *bufferHeader);
+ void invalidateBufferID(IOMX::buffer_id buffer);
+
+ bool isProhibitedIndex_l(OMX_INDEXTYPE index);
+
+ status_t useBuffer_l(
+ OMX_U32 portIndex, const sp<IMemory> ¶ms,
+ const sp<IHidlMemory> &hParams, IOMX::buffer_id *buffer);
+
+ status_t useGraphicBuffer_l(
+ OMX_U32 portIndex, const sp<GraphicBuffer> &graphicBuffer,
+ IOMX::buffer_id *buffer);
+
+ status_t useGraphicBufferWithMetadata_l(
+ OMX_U32 portIndex, const sp<GraphicBuffer> &graphicBuffer,
+ IOMX::buffer_id *buffer);
+
+ status_t useGraphicBuffer2_l(
+ OMX_U32 portIndex, const sp<GraphicBuffer> &graphicBuffer,
+ IOMX::buffer_id *buffer);
+
+ status_t emptyBuffer_l(
+ IOMX::buffer_id buffer,
+ OMX_U32 rangeOffset, OMX_U32 rangeLength,
+ OMX_U32 flags, OMX_TICKS timestamp, int fenceFd);
+
+ status_t emptyGraphicBuffer_l(
+ IOMX::buffer_id buffer, const sp<GraphicBuffer> &graphicBuffer,
+ OMX_U32 flags, OMX_TICKS timestamp, int fenceFd);
+
+ status_t emptyNativeHandleBuffer_l(
+ IOMX::buffer_id buffer, const sp<NativeHandle> &nativeHandle,
+ OMX_U32 flags, OMX_TICKS timestamp, int fenceFd);
+
+ status_t emptyBuffer_l(
+ OMX_BUFFERHEADERTYPE *header,
+ OMX_U32 flags, OMX_TICKS timestamp, intptr_t debugAddr, int fenceFd);
+
+ static OMX_ERRORTYPE OnEvent(
+ OMX_IN OMX_HANDLETYPE hComponent,
+ OMX_IN OMX_PTR pAppData,
+ OMX_IN OMX_EVENTTYPE eEvent,
+ OMX_IN OMX_U32 nData1,
+ OMX_IN OMX_U32 nData2,
+ OMX_IN OMX_PTR pEventData);
+
+ static OMX_ERRORTYPE OnEmptyBufferDone(
+ OMX_IN OMX_HANDLETYPE hComponent,
+ OMX_IN OMX_PTR pAppData,
+ OMX_IN OMX_BUFFERHEADERTYPE *pBuffer);
+
+ static OMX_ERRORTYPE OnFillBufferDone(
+ OMX_IN OMX_HANDLETYPE hComponent,
+ OMX_IN OMX_PTR pAppData,
+ OMX_IN OMX_BUFFERHEADERTYPE *pBuffer);
+
+ status_t enableNativeBuffers_l(
+ OMX_U32 portIndex, OMX_BOOL graphic, OMX_BOOL enable);
+
+ status_t storeMetaDataInBuffers_l(
+ OMX_U32 portIndex, OMX_BOOL enable, MetadataBufferType *type);
+
+ // Stores fence into buffer if it is ANWBuffer type and has enough space.
+ // otherwise, waits for the fence to signal. Takes ownership of |fenceFd|.
+ status_t storeFenceInMeta_l(
+ OMX_BUFFERHEADERTYPE *header, int fenceFd, OMX_U32 portIndex);
+
+ // Retrieves the fence from buffer if ANWBuffer type and has enough space. Otherwise, returns -1
+ int retrieveFenceFromMeta_l(
+ OMX_BUFFERHEADERTYPE *header, OMX_U32 portIndex);
+
+ // Updates the graphic buffer handle in the metadata buffer for |buffer| and |header| to
+ // |graphicBuffer|'s handle. If |updateCodecBuffer| is true, the update will happen in
+ // the actual codec buffer (use this if not using emptyBuffer (with no _l) later to
+ // pass the buffer to the codec, as only emptyBuffer copies the backup buffer to the codec
+ // buffer.)
+ status_t updateGraphicBufferInMeta_l(
+ OMX_U32 portIndex, const sp<GraphicBuffer> &graphicBuffer,
+ IOMX::buffer_id buffer, OMX_BUFFERHEADERTYPE *header);
+
+ status_t updateNativeHandleInMeta_l(
+ OMX_U32 portIndex, const sp<NativeHandle> &nativeHandle,
+ IOMX::buffer_id buffer, OMX_BUFFERHEADERTYPE *header);
+
+ sp<IOMXBufferSource> getBufferSource();
+ void setBufferSource(const sp<IOMXBufferSource> &bufferSource);
+ // Called when omx_message::FILL_BUFFER_DONE is received. (Currently the
+ // buffer source will fix timestamp in the header if needed.)
+ void codecBufferFilled(omx_message &msg);
+
+ // Handles |msg|, and may modify it. Returns true iff completely handled it and
+ // |msg| does not need to be sent to the event listener.
+ bool handleMessage(omx_message &msg);
+
+ bool handleDataSpaceChanged(omx_message &msg);
+
+ status_t setMaxPtsGapUs(const void *params, size_t size);
+ int64_t getCodecTimestamp(OMX_TICKS timestamp);
+
+ OMXNodeInstance(const OMXNodeInstance &);
+ OMXNodeInstance &operator=(const OMXNodeInstance &);
+};
+
+} // namespace android
+
+#endif // OMX_NODE_INSTANCE_H_
diff --git a/media/libstagefright/omx/include/media/stagefright/omx/OMXStore.h b/media/libstagefright/omx/include/media/stagefright/omx/OMXStore.h
new file mode 100644
index 0000000..e00d713
--- /dev/null
+++ b/media/libstagefright/omx/include/media/stagefright/omx/OMXStore.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_OMXSTORE_H_
+#define ANDROID_OMXSTORE_H_
+
+#include <media/IOMXStore.h>
+#include <media/IOMX.h>
+#include <media/stagefright/xmlparser/MediaCodecsXmlParser.h>
+
+#include <vector>
+#include <string>
+
+namespace android {
+
+class OMXStore : public BnOMXStore {
+public:
+ OMXStore(
+ const char* owner = "default",
+ const char* const* searchDirs
+ = MediaCodecsXmlParser::defaultSearchDirs,
+ const char* mainXmlName
+ = MediaCodecsXmlParser::defaultMainXmlName,
+ const char* performanceXmlName
+ = MediaCodecsXmlParser::defaultPerformanceXmlName,
+ const char* profilingResultsXmlPath
+ = MediaCodecsXmlParser::defaultProfilingResultsXmlPath);
+
+ status_t listServiceAttributes(
+ std::vector<Attribute>* attributes) override;
+
+ status_t getNodePrefix(std::string* prefix) override;
+
+ status_t listRoles(std::vector<RoleInfo>* roleList) override;
+
+ status_t getOmx(const std::string& name, sp<IOMX>* omx) override;
+
+ ~OMXStore() override;
+
+protected:
+ status_t mParsingStatus;
+ std::string mPrefix;
+ std::vector<Attribute> mServiceAttributeList;
+ std::vector<RoleInfo> mRoleList;
+};
+
+} // namespace android
+
+#endif // ANDROID_OMXSTORE_H_
diff --git a/media/libstagefright/omx/OMXUtils.h b/media/libstagefright/omx/include/media/stagefright/omx/OMXUtils.h
similarity index 100%
rename from media/libstagefright/omx/OMXUtils.h
rename to media/libstagefright/omx/include/media/stagefright/omx/OMXUtils.h
diff --git a/media/libstagefright/include/SimpleSoftOMXComponent.h b/media/libstagefright/omx/include/media/stagefright/omx/SimpleSoftOMXComponent.h
similarity index 100%
rename from media/libstagefright/include/SimpleSoftOMXComponent.h
rename to media/libstagefright/omx/include/media/stagefright/omx/SimpleSoftOMXComponent.h
diff --git a/media/libstagefright/include/SoftOMXComponent.h b/media/libstagefright/omx/include/media/stagefright/omx/SoftOMXComponent.h
similarity index 100%
rename from media/libstagefright/include/SoftOMXComponent.h
rename to media/libstagefright/omx/include/media/stagefright/omx/SoftOMXComponent.h
diff --git a/media/libstagefright/omx/include/media/stagefright/omx/SoftOMXPlugin.h b/media/libstagefright/omx/include/media/stagefright/omx/SoftOMXPlugin.h
new file mode 100644
index 0000000..8ec717e
--- /dev/null
+++ b/media/libstagefright/omx/include/media/stagefright/omx/SoftOMXPlugin.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SOFT_OMX_PLUGIN_H_
+
+#define SOFT_OMX_PLUGIN_H_
+
+#include <media/stagefright/foundation/ABase.h>
+#include <media/hardware/OMXPluginBase.h>
+
+namespace android {
+
+struct SoftOMXPlugin : public OMXPluginBase {
+ SoftOMXPlugin();
+
+ virtual OMX_ERRORTYPE makeComponentInstance(
+ const char *name,
+ const OMX_CALLBACKTYPE *callbacks,
+ OMX_PTR appData,
+ OMX_COMPONENTTYPE **component);
+
+ virtual OMX_ERRORTYPE destroyComponentInstance(
+ OMX_COMPONENTTYPE *component);
+
+ virtual OMX_ERRORTYPE enumerateComponents(
+ OMX_STRING name,
+ size_t size,
+ OMX_U32 index);
+
+ virtual OMX_ERRORTYPE getRolesOfComponent(
+ const char *name,
+ Vector<String8> *roles);
+
+private:
+ DISALLOW_EVIL_CONSTRUCTORS(SoftOMXPlugin);
+};
+
+} // namespace android
+
+#endif // SOFT_OMX_PLUGIN_H_
diff --git a/media/libstagefright/include/SoftVideoDecoderOMXComponent.h b/media/libstagefright/omx/include/media/stagefright/omx/SoftVideoDecoderOMXComponent.h
similarity index 100%
rename from media/libstagefright/include/SoftVideoDecoderOMXComponent.h
rename to media/libstagefright/omx/include/media/stagefright/omx/SoftVideoDecoderOMXComponent.h
diff --git a/media/libstagefright/include/SoftVideoEncoderOMXComponent.h b/media/libstagefright/omx/include/media/stagefright/omx/SoftVideoEncoderOMXComponent.h
similarity index 100%
rename from media/libstagefright/include/SoftVideoEncoderOMXComponent.h
rename to media/libstagefright/omx/include/media/stagefright/omx/SoftVideoEncoderOMXComponent.h
diff --git a/media/libstagefright/omx/tests/FrameDropper_test.cpp b/media/libstagefright/omx/tests/FrameDropper_test.cpp
index f966b5e..a925da6 100644
--- a/media/libstagefright/omx/tests/FrameDropper_test.cpp
+++ b/media/libstagefright/omx/tests/FrameDropper_test.cpp
@@ -20,7 +20,7 @@
#include <gtest/gtest.h>
-#include "FrameDropper.h"
+#include <media/stagefright/omx/FrameDropper.h>
#include <media/stagefright/foundation/ADebug.h>
namespace android {
diff --git a/media/libstagefright/tests/MediaCodecListOverrides_test.cpp b/media/libstagefright/tests/MediaCodecListOverrides_test.cpp
index 2599608..0c22a42 100644
--- a/media/libstagefright/tests/MediaCodecListOverrides_test.cpp
+++ b/media/libstagefright/tests/MediaCodecListOverrides_test.cpp
@@ -26,6 +26,8 @@
#include <media/stagefright/foundation/AMessage.h>
#include <media/stagefright/MediaCodecList.h>
+#include <vector>
+
namespace android {
static const char kTestOverridesStr[] =
@@ -117,7 +119,7 @@
// TODO: the codec component never returns OMX_EventCmdComplete in unit test.
TEST_F(MediaCodecListOverridesTest, DISABLED_profileCodecs) {
sp<IMediaCodecList> list = MediaCodecList::getInstance();
- Vector<sp<MediaCodecInfo>> infos;
+ std::vector<sp<MediaCodecInfo>> infos;
for (size_t i = 0; i < list->countCodecs(); ++i) {
infos.push_back(list->getCodecInfo(i));
}
diff --git a/media/libstagefright/xmlparser/Android.bp b/media/libstagefright/xmlparser/Android.bp
new file mode 100644
index 0000000..3507284
--- /dev/null
+++ b/media/libstagefright/xmlparser/Android.bp
@@ -0,0 +1,44 @@
+cc_library_shared {
+ name: "libstagefright_xmlparser",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
+
+ srcs: [
+ "MediaCodecsXmlParser.cpp",
+ ],
+
+ export_include_dirs: [
+ "include",
+ ],
+
+ shared_libs: [
+ "libexpat",
+ "libutils",
+ "liblog",
+ "libcutils",
+ "libstagefright_foundation",
+ "libstagefright_omx_utils",
+ ],
+
+ cflags: [
+ "-Werror",
+ "-Wall",
+ ],
+
+ clang: true,
+
+ sanitize: {
+ misc_undefined: [
+ "unsigned-integer-overflow",
+ "signed-integer-overflow",
+ ],
+ cfi: true,
+ diag: {
+ cfi: true,
+ },
+ },
+
+}
+
diff --git a/media/libstagefright/xmlparser/MediaCodecsXmlParser.cpp b/media/libstagefright/xmlparser/MediaCodecsXmlParser.cpp
new file mode 100644
index 0000000..ffd30ea
--- /dev/null
+++ b/media/libstagefright/xmlparser/MediaCodecsXmlParser.cpp
@@ -0,0 +1,1054 @@
+/*
+ * Copyright 2017, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "MediaCodecsXmlParser"
+
+#include <media/stagefright/xmlparser/MediaCodecsXmlParser.h>
+
+#include <utils/Log.h>
+#include <media/stagefright/MediaErrors.h>
+#include <media/stagefright/omx/OMXUtils.h>
+#include <sys/stat.h>
+#include <expat.h>
+
+#include <cctype>
+#include <algorithm>
+
+namespace android {
+
+namespace {
+
+/**
+ * Search for a file in a list of search directories.
+ *
+ * For each string `searchDir` in `searchDirs`, `searchDir/fileName` will be
+ * tested whether it is a valid file name or not. If it is a valid file name,
+ * the concatenated name (`searchDir/fileName`) will be stored in the output
+ * variable `outPath`, and the function will return `true`. Otherwise, the
+ * search continues until the `nullptr` element in `searchDirs` is reached, at
+ * which point the function returns `false`.
+ *
+ * \param[in] searchDirs Null-terminated array of search paths.
+ * \param[in] fileName Name of the file to search.
+ * \param[out] outPath Full path of the file. `outPath` will hold a valid file
+ * name if the return value of this function is `true`.
+ * \return `true` if some element in `searchDirs` combined with `fileName` is a
+ * valid file name; `false` otherwise.
+ */
+bool findFileInDirs(
+ const char* const* searchDirs,
+ const char *fileName,
+ std::string *outPath) {
+ for (; *searchDirs != nullptr; ++searchDirs) {
+ *outPath = std::string(*searchDirs) + "/" + fileName;
+ struct stat fileStat;
+ if (stat(outPath->c_str(), &fileStat) == 0 &&
+ S_ISREG(fileStat.st_mode)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool strnEq(const char* s1, const char* s2, size_t count) {
+ return strncmp(s1, s2, count) == 0;
+}
+
+bool strEq(const char* s1, const char* s2) {
+ return strcmp(s1, s2) == 0;
+}
+
+bool striEq(const char* s1, const char* s2) {
+ return strcasecmp(s1, s2) == 0;
+}
+
+bool strHasPrefix(const char* test, const char* prefix) {
+ return strnEq(test, prefix, strlen(prefix));
+}
+
+bool parseBoolean(const char* s) {
+ return striEq(s, "y") ||
+ striEq(s, "yes") ||
+ striEq(s, "t") ||
+ striEq(s, "true") ||
+ striEq(s, "1");
+}
+
+status_t limitFoundMissingAttr(const char* name, const char *attr, bool found = true) {
+ ALOGE("limit '%s' with %s'%s' attribute", name,
+ (found ? "" : "no "), attr);
+ return -EINVAL;
+}
+
+status_t limitError(const char* name, const char *msg) {
+ ALOGE("limit '%s' %s", name, msg);
+ return -EINVAL;
+}
+
+status_t limitInvalidAttr(const char* name, const char* attr, const char* value) {
+ ALOGE("limit '%s' with invalid '%s' attribute (%s)", name,
+ attr, value);
+ return -EINVAL;
+}
+
+}; // unnamed namespace
+
+constexpr char const* MediaCodecsXmlParser::defaultSearchDirs[];
+constexpr char const* MediaCodecsXmlParser::defaultMainXmlName;
+constexpr char const* MediaCodecsXmlParser::defaultPerformanceXmlName;
+constexpr char const* MediaCodecsXmlParser::defaultProfilingResultsXmlPath;
+
+MediaCodecsXmlParser::MediaCodecsXmlParser(
+ const char* const* searchDirs,
+ const char* mainXmlName,
+ const char* performanceXmlName,
+ const char* profilingResultsXmlPath) :
+ mParsingStatus(NO_INIT),
+ mUpdate(false),
+ mCodecCounter(0) {
+ std::string path;
+ if (findFileInDirs(searchDirs, mainXmlName, &path)) {
+ parseTopLevelXMLFile(path.c_str(), false);
+ } else {
+ ALOGE("Cannot find %s", mainXmlName);
+ mParsingStatus = NAME_NOT_FOUND;
+ }
+ if (findFileInDirs(searchDirs, performanceXmlName, &path)) {
+ parseTopLevelXMLFile(path.c_str(), true);
+ }
+ if (profilingResultsXmlPath != nullptr) {
+ parseTopLevelXMLFile(profilingResultsXmlPath, true);
+ }
+}
+
+bool MediaCodecsXmlParser::parseTopLevelXMLFile(
+ const char *codecs_xml,
+ bool ignore_errors) {
+ // get href_base
+ const char *href_base_end = strrchr(codecs_xml, '/');
+ if (href_base_end != nullptr) {
+ mHrefBase = std::string(codecs_xml, href_base_end - codecs_xml + 1);
+ }
+
+ mParsingStatus = OK; // keeping this here for safety
+ mCurrentSection = SECTION_TOPLEVEL;
+
+ parseXMLFile(codecs_xml);
+
+ if (mParsingStatus != OK) {
+ ALOGW("parseTopLevelXMLFile(%s) failed", codecs_xml);
+ if (ignore_errors) {
+ mParsingStatus = OK;
+ return false;
+ }
+ mCodecMap.clear();
+ return false;
+ }
+ return true;
+}
+
+MediaCodecsXmlParser::~MediaCodecsXmlParser() {
+}
+
+void MediaCodecsXmlParser::parseXMLFile(const char *path) {
+ FILE *file = fopen(path, "r");
+
+ if (file == nullptr) {
+ ALOGW("unable to open media codecs configuration xml file: %s", path);
+ mParsingStatus = NAME_NOT_FOUND;
+ return;
+ }
+
+ XML_Parser parser = ::XML_ParserCreate(nullptr);
+ LOG_FATAL_IF(parser == nullptr, "XML_MediaCodecsXmlParserCreate() failed.");
+
+ ::XML_SetUserData(parser, this);
+ ::XML_SetElementHandler(
+ parser, StartElementHandlerWrapper, EndElementHandlerWrapper);
+
+ static constexpr int BUFF_SIZE = 512;
+ while (mParsingStatus == OK) {
+ void *buff = ::XML_GetBuffer(parser, BUFF_SIZE);
+ if (buff == nullptr) {
+ ALOGE("failed in call to XML_GetBuffer()");
+ mParsingStatus = UNKNOWN_ERROR;
+ break;
+ }
+
+ int bytes_read = ::fread(buff, 1, BUFF_SIZE, file);
+ if (bytes_read < 0) {
+ ALOGE("failed in call to read");
+ mParsingStatus = ERROR_IO;
+ break;
+ }
+
+ XML_Status status = ::XML_ParseBuffer(parser, bytes_read, bytes_read == 0);
+ if (status != XML_STATUS_OK) {
+ ALOGE("malformed (%s)", ::XML_ErrorString(::XML_GetErrorCode(parser)));
+ mParsingStatus = ERROR_MALFORMED;
+ break;
+ }
+
+ if (bytes_read == 0) {
+ break;
+ }
+ }
+
+ ::XML_ParserFree(parser);
+
+ fclose(file);
+ file = nullptr;
+}
+
+// static
+void MediaCodecsXmlParser::StartElementHandlerWrapper(
+ void *me, const char *name, const char **attrs) {
+ static_cast<MediaCodecsXmlParser*>(me)->startElementHandler(name, attrs);
+}
+
+// static
+void MediaCodecsXmlParser::EndElementHandlerWrapper(void *me, const char *name) {
+ static_cast<MediaCodecsXmlParser*>(me)->endElementHandler(name);
+}
+
+status_t MediaCodecsXmlParser::includeXMLFile(const char **attrs) {
+ const char *href = nullptr;
+ size_t i = 0;
+ while (attrs[i] != nullptr) {
+ if (strEq(attrs[i], "href")) {
+ if (attrs[++i] == nullptr) {
+ return -EINVAL;
+ }
+ href = attrs[i];
+ } else {
+ ALOGE("includeXMLFile: unrecognized attribute: %s", attrs[i]);
+ return -EINVAL;
+ }
+ ++i;
+ }
+
+ // For security reasons and for simplicity, file names can only contain
+ // [a-zA-Z0-9_.] and must start with media_codecs_ and end with .xml
+ for (i = 0; href[i] != '\0'; i++) {
+ if (href[i] == '.' || href[i] == '_' ||
+ (href[i] >= '0' && href[i] <= '9') ||
+ (href[i] >= 'A' && href[i] <= 'Z') ||
+ (href[i] >= 'a' && href[i] <= 'z')) {
+ continue;
+ }
+ ALOGE("invalid include file name: %s", href);
+ return -EINVAL;
+ }
+
+ std::string filename = href;
+ if (filename.compare(0, 13, "media_codecs_") != 0 ||
+ filename.compare(filename.size() - 4, 4, ".xml") != 0) {
+ ALOGE("invalid include file name: %s", href);
+ return -EINVAL;
+ }
+ filename.insert(0, mHrefBase);
+
+ parseXMLFile(filename.c_str());
+ return mParsingStatus;
+}
+
+void MediaCodecsXmlParser::startElementHandler(
+ const char *name, const char **attrs) {
+ if (mParsingStatus != OK) {
+ return;
+ }
+
+ bool inType = true;
+
+ if (strEq(name, "Include")) {
+ mParsingStatus = includeXMLFile(attrs);
+ if (mParsingStatus == OK) {
+ mSectionStack.push_back(mCurrentSection);
+ mCurrentSection = SECTION_INCLUDE;
+ }
+ return;
+ }
+
+ switch (mCurrentSection) {
+ case SECTION_TOPLEVEL:
+ {
+ if (strEq(name, "Decoders")) {
+ mCurrentSection = SECTION_DECODERS;
+ } else if (strEq(name, "Encoders")) {
+ mCurrentSection = SECTION_ENCODERS;
+ } else if (strEq(name, "Settings")) {
+ mCurrentSection = SECTION_SETTINGS;
+ }
+ break;
+ }
+
+ case SECTION_SETTINGS:
+ {
+ if (strEq(name, "Setting")) {
+ mParsingStatus = addSettingFromAttributes(attrs);
+ }
+ break;
+ }
+
+ case SECTION_DECODERS:
+ {
+ if (strEq(name, "MediaCodec")) {
+ mParsingStatus =
+ addMediaCodecFromAttributes(false /* encoder */, attrs);
+
+ mCurrentSection = SECTION_DECODER;
+ }
+ break;
+ }
+
+ case SECTION_ENCODERS:
+ {
+ if (strEq(name, "MediaCodec")) {
+ mParsingStatus =
+ addMediaCodecFromAttributes(true /* encoder */, attrs);
+
+ mCurrentSection = SECTION_ENCODER;
+ }
+ break;
+ }
+
+ case SECTION_DECODER:
+ case SECTION_ENCODER:
+ {
+ if (strEq(name, "Quirk")) {
+ mParsingStatus = addQuirk(attrs);
+ } else if (strEq(name, "Type")) {
+ mParsingStatus = addTypeFromAttributes(attrs,
+ (mCurrentSection == SECTION_ENCODER));
+ mCurrentSection =
+ (mCurrentSection == SECTION_DECODER ?
+ SECTION_DECODER_TYPE : SECTION_ENCODER_TYPE);
+ }
+ }
+ inType = false;
+ // fall through
+
+ case SECTION_DECODER_TYPE:
+ case SECTION_ENCODER_TYPE:
+ {
+ // ignore limits and features specified outside of type
+ bool outside = !inType &&
+ mCurrentType == mCurrentCodec->second.typeMap.end();
+ if (outside &&
+ (strEq(name, "Limit") || strEq(name, "Feature"))) {
+ ALOGW("ignoring %s specified outside of a Type", name);
+ } else if (strEq(name, "Limit")) {
+ mParsingStatus = addLimit(attrs);
+ } else if (strEq(name, "Feature")) {
+ mParsingStatus = addFeature(attrs);
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+
+}
+
+void MediaCodecsXmlParser::endElementHandler(const char *name) {
+ if (mParsingStatus != OK) {
+ return;
+ }
+
+ switch (mCurrentSection) {
+ case SECTION_SETTINGS:
+ {
+ if (strEq(name, "Settings")) {
+ mCurrentSection = SECTION_TOPLEVEL;
+ }
+ break;
+ }
+
+ case SECTION_DECODERS:
+ {
+ if (strEq(name, "Decoders")) {
+ mCurrentSection = SECTION_TOPLEVEL;
+ }
+ break;
+ }
+
+ case SECTION_ENCODERS:
+ {
+ if (strEq(name, "Encoders")) {
+ mCurrentSection = SECTION_TOPLEVEL;
+ }
+ break;
+ }
+
+ case SECTION_DECODER_TYPE:
+ case SECTION_ENCODER_TYPE:
+ {
+ if (strEq(name, "Type")) {
+ mCurrentSection =
+ (mCurrentSection == SECTION_DECODER_TYPE ?
+ SECTION_DECODER : SECTION_ENCODER);
+
+ mCurrentType = mCurrentCodec->second.typeMap.end();
+ }
+ break;
+ }
+
+ case SECTION_DECODER:
+ {
+ if (strEq(name, "MediaCodec")) {
+ mCurrentSection = SECTION_DECODERS;
+ mCurrentName.clear();
+ }
+ break;
+ }
+
+ case SECTION_ENCODER:
+ {
+ if (strEq(name, "MediaCodec")) {
+ mCurrentSection = SECTION_ENCODERS;
+ mCurrentName.clear();
+ }
+ break;
+ }
+
+ case SECTION_INCLUDE:
+ {
+ if (strEq(name, "Include") && (mSectionStack.size() > 0)) {
+ mCurrentSection = mSectionStack.back();
+ mSectionStack.pop_back();
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+
+}
+
+status_t MediaCodecsXmlParser::addSettingFromAttributes(const char **attrs) {
+ const char *name = nullptr;
+ const char *value = nullptr;
+ const char *update = nullptr;
+
+ size_t i = 0;
+ while (attrs[i] != nullptr) {
+ if (strEq(attrs[i], "name")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addSettingFromAttributes: name is null");
+ return -EINVAL;
+ }
+ name = attrs[i];
+ } else if (strEq(attrs[i], "value")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addSettingFromAttributes: value is null");
+ return -EINVAL;
+ }
+ value = attrs[i];
+ } else if (strEq(attrs[i], "update")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addSettingFromAttributes: update is null");
+ return -EINVAL;
+ }
+ update = attrs[i];
+ } else {
+ ALOGE("addSettingFromAttributes: unrecognized attribute: %s", attrs[i]);
+ return -EINVAL;
+ }
+ ++i;
+ }
+
+ if (name == nullptr || value == nullptr) {
+ ALOGE("addSettingFromAttributes: name or value unspecified");
+ return -EINVAL;
+ }
+
+ // Boolean values are converted to "0" or "1".
+ if (strHasPrefix(name, "supports-")) {
+ value = parseBoolean(value) ? "1" : "0";
+ }
+
+ mUpdate = (update != nullptr) && parseBoolean(update);
+ auto attribute = mServiceAttributeMap.find(name);
+ if (attribute == mServiceAttributeMap.end()) { // New attribute name
+ if (mUpdate) {
+ ALOGE("addSettingFromAttributes: updating non-existing setting");
+ return -EINVAL;
+ }
+ mServiceAttributeMap.insert(Attribute(name, value));
+ } else { // Existing attribute name
+ if (!mUpdate) {
+ ALOGE("addSettingFromAttributes: adding existing setting");
+ }
+ attribute->second = value;
+ }
+
+ return OK;
+}
+
+status_t MediaCodecsXmlParser::addMediaCodecFromAttributes(
+ bool encoder, const char **attrs) {
+ const char *name = nullptr;
+ const char *type = nullptr;
+ const char *update = nullptr;
+
+ size_t i = 0;
+ while (attrs[i] != nullptr) {
+ if (strEq(attrs[i], "name")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addMediaCodecFromAttributes: name is null");
+ return -EINVAL;
+ }
+ name = attrs[i];
+ } else if (strEq(attrs[i], "type")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addMediaCodecFromAttributes: type is null");
+ return -EINVAL;
+ }
+ type = attrs[i];
+ } else if (strEq(attrs[i], "update")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addMediaCodecFromAttributes: update is null");
+ return -EINVAL;
+ }
+ update = attrs[i];
+ } else {
+ ALOGE("addMediaCodecFromAttributes: unrecognized attribute: %s", attrs[i]);
+ return -EINVAL;
+ }
+ ++i;
+ }
+
+ if (name == nullptr) {
+ ALOGE("addMediaCodecFromAttributes: name not found");
+ return -EINVAL;
+ }
+
+ mUpdate = (update != nullptr) && parseBoolean(update);
+ mCurrentCodec = mCodecMap.find(name);
+ if (mCurrentCodec == mCodecMap.end()) { // New codec name
+ if (mUpdate) {
+ ALOGE("addMediaCodecFromAttributes: updating non-existing codec");
+ return -EINVAL;
+ }
+ // Create a new codec in mCodecMap
+ mCurrentCodec = mCodecMap.insert(
+ Codec(name, CodecProperties())).first;
+ if (type != nullptr) {
+ mCurrentType = mCurrentCodec->second.typeMap.insert(
+ Type(type, AttributeMap())).first;
+ } else {
+ mCurrentType = mCurrentCodec->second.typeMap.end();
+ }
+ mCurrentCodec->second.isEncoder = encoder;
+ mCurrentCodec->second.order = mCodecCounter++;
+ } else { // Existing codec name
+ if (!mUpdate) {
+ ALOGE("addMediaCodecFromAttributes: adding existing codec");
+ return -EINVAL;
+ }
+ if (type != nullptr) {
+ mCurrentType = mCurrentCodec->second.typeMap.find(type);
+ if (mCurrentType == mCurrentCodec->second.typeMap.end()) {
+ ALOGE("addMediaCodecFromAttributes: updating non-existing type");
+ return -EINVAL;
+ }
+ } else {
+ // This should happen only when the codec has at most one type.
+ mCurrentType = mCurrentCodec->second.typeMap.begin();
+ }
+ }
+
+ return OK;
+}
+
+status_t MediaCodecsXmlParser::addQuirk(const char **attrs) {
+ const char *name = nullptr;
+
+ size_t i = 0;
+ while (attrs[i] != nullptr) {
+ if (strEq(attrs[i], "name")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addQuirk: name is null");
+ return -EINVAL;
+ }
+ name = attrs[i];
+ } else {
+ ALOGE("addQuirk: unrecognized attribute: %s", attrs[i]);
+ return -EINVAL;
+ }
+ ++i;
+ }
+
+ if (name == nullptr) {
+ ALOGE("addQuirk: name not found");
+ return -EINVAL;
+ }
+
+ mCurrentCodec->second.quirkSet.emplace(name);
+ return OK;
+}
+
+status_t MediaCodecsXmlParser::addTypeFromAttributes(const char **attrs, bool encoder) {
+ const char *name = nullptr;
+ const char *update = nullptr;
+
+ size_t i = 0;
+ while (attrs[i] != nullptr) {
+ if (strEq(attrs[i], "name")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addTypeFromAttributes: name is null");
+ return -EINVAL;
+ }
+ name = attrs[i];
+ } else if (strEq(attrs[i], "update")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addTypeFromAttributes: update is null");
+ return -EINVAL;
+ }
+ update = attrs[i];
+ } else {
+ ALOGE("addTypeFromAttributes: unrecognized attribute: %s", attrs[i]);
+ return -EINVAL;
+ }
+ ++i;
+ }
+
+ if (name == nullptr) {
+ return -EINVAL;
+ }
+
+ mCurrentCodec->second.isEncoder = encoder;
+ mCurrentType = mCurrentCodec->second.typeMap.find(name);
+ if (!mUpdate) {
+ if (mCurrentType != mCurrentCodec->second.typeMap.end()) {
+ ALOGE("addTypeFromAttributes: re-defining existing type without update");
+ return -EINVAL;
+ }
+ mCurrentType = mCurrentCodec->second.typeMap.insert(
+ Type(name, AttributeMap())).first;
+ } else if (mCurrentType == mCurrentCodec->second.typeMap.end()) {
+ ALOGE("addTypeFromAttributes: updating non-existing type");
+ }
+ return OK;
+}
+
+status_t MediaCodecsXmlParser::addLimit(const char **attrs) {
+ const char* a_name = nullptr;
+ const char* a_default = nullptr;
+ const char* a_in = nullptr;
+ const char* a_max = nullptr;
+ const char* a_min = nullptr;
+ const char* a_range = nullptr;
+ const char* a_ranges = nullptr;
+ const char* a_scale = nullptr;
+ const char* a_value = nullptr;
+
+ size_t i = 0;
+ while (attrs[i] != nullptr) {
+ if (strEq(attrs[i], "name")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addLimit: name is null");
+ return -EINVAL;
+ }
+ a_name = attrs[i];
+ } else if (strEq(attrs[i], "default")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addLimit: default is null");
+ return -EINVAL;
+ }
+ a_default = attrs[i];
+ } else if (strEq(attrs[i], "in")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addLimit: in is null");
+ return -EINVAL;
+ }
+ a_in = attrs[i];
+ } else if (strEq(attrs[i], "max")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addLimit: max is null");
+ return -EINVAL;
+ }
+ a_max = attrs[i];
+ } else if (strEq(attrs[i], "min")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addLimit: min is null");
+ return -EINVAL;
+ }
+ a_min = attrs[i];
+ } else if (strEq(attrs[i], "range")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addLimit: range is null");
+ return -EINVAL;
+ }
+ a_range = attrs[i];
+ } else if (strEq(attrs[i], "ranges")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addLimit: ranges is null");
+ return -EINVAL;
+ }
+ a_ranges = attrs[i];
+ } else if (strEq(attrs[i], "scale")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addLimit: scale is null");
+ return -EINVAL;
+ }
+ a_scale = attrs[i];
+ } else if (strEq(attrs[i], "value")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addLimit: value is null");
+ return -EINVAL;
+ }
+ a_value = attrs[i];
+ } else {
+ ALOGE("addLimit: unrecognized limit: %s", attrs[i]);
+ return -EINVAL;
+ }
+ ++i;
+ }
+
+ if (a_name == nullptr) {
+ ALOGE("limit with no 'name' attribute");
+ return -EINVAL;
+ }
+
+ // size, blocks, bitrate, frame-rate, blocks-per-second, aspect-ratio,
+ // measured-frame-rate, measured-blocks-per-second: range
+ // quality: range + default + [scale]
+ // complexity: range + default
+ if (mCurrentType == mCurrentCodec->second.typeMap.end()) {
+ ALOGW("ignoring null type");
+ return OK;
+ }
+
+ std::string range;
+ if (strEq(a_name, "aspect-ratio") ||
+ strEq(a_name, "bitrate") ||
+ strEq(a_name, "block-count") ||
+ strEq(a_name, "blocks-per-second") ||
+ strEq(a_name, "complexity") ||
+ strEq(a_name, "frame-rate") ||
+ strEq(a_name, "quality") ||
+ strEq(a_name, "size") ||
+ strEq(a_name, "measured-blocks-per-second") ||
+ strHasPrefix(a_name, "measured-frame-rate-")) {
+ // "range" is specified in exactly one of the following forms:
+ // 1) min-max
+ // 2) value-value
+ // 3) range
+ if (a_min != nullptr && a_max != nullptr) {
+ // min-max
+ if (a_range != nullptr || a_value != nullptr) {
+ return limitError(a_name, "has 'min' and 'max' as well as 'range' or "
+ "'value' attributes");
+ }
+ range = a_min;
+ range += '-';
+ range += a_max;
+ } else if (a_min != nullptr || a_max != nullptr) {
+ return limitError(a_name, "has only 'min' or 'max' attribute");
+ } else if (a_value != nullptr) {
+ // value-value
+ if (a_range != nullptr) {
+ return limitError(a_name, "has both 'range' and 'value' attributes");
+ }
+ range = a_value;
+ range += '-';
+ range += a_value;
+ } else if (a_range == nullptr) {
+ return limitError(a_name, "with no 'range', 'value' or 'min'/'max' attributes");
+ } else {
+ // range
+ range = a_range;
+ }
+
+ // "aspect-ratio" requires some special treatment.
+ if (strEq(a_name, "aspect-ratio")) {
+ // "aspect-ratio" must have "in".
+ if (a_in == nullptr) {
+ return limitFoundMissingAttr(a_name, "in", false);
+ }
+ // "in" must be either "pixels" or "blocks".
+ if (!strEq(a_in, "pixels") && !strEq(a_in, "blocks")) {
+ return limitInvalidAttr(a_name, "in", a_in);
+ }
+ // name will be "pixel-aspect-ratio-range" or
+ // "block-aspect-ratio-range".
+ mCurrentType->second[
+ std::string(a_in).substr(0, strlen(a_in) - 1) +
+ "-aspect-ratio-range"] = range;
+ } else {
+ // For everything else (apart from "aspect-ratio"), simply append
+ // "-range" to the name for the range-type property.
+ mCurrentType->second[std::string(a_name) + "-range"] = range;
+
+ // Only "quality" may have "scale".
+ if (!strEq(a_name, "quality") && a_scale != nullptr) {
+ return limitFoundMissingAttr(a_name, "scale");
+ } else if (strEq(a_name, "quality")) {
+ // The default value of "quality-scale" is "linear".
+ mCurrentType->second["quality-scale"] = a_scale == nullptr ?
+ "linear" : a_scale;
+ }
+
+ // "quality" and "complexity" must have "default".
+ // Other limits must not have "default".
+ if (strEq(a_name, "quality") || strEq(a_name, "complexity")) {
+ if (a_default == nullptr) {
+ return limitFoundMissingAttr(a_name, "default", false);
+ }
+ // name will be "quality-default" or "complexity-default".
+ mCurrentType->second[std::string(a_name) + "-default"] = a_default;
+ } else if (a_default != nullptr) {
+ return limitFoundMissingAttr(a_name, "default", true);
+ }
+ }
+ } else {
+ if (a_default != nullptr) {
+ return limitFoundMissingAttr(a_name, "default");
+ }
+ if (a_in != nullptr) {
+ return limitFoundMissingAttr(a_name, "in");
+ }
+ if (a_scale != nullptr) {
+ return limitFoundMissingAttr(a_name, "scale");
+ }
+ if (a_range != nullptr) {
+ return limitFoundMissingAttr(a_name, "range");
+ }
+ if (a_min != nullptr) {
+ return limitFoundMissingAttr(a_name, "min");
+ }
+
+ if (a_max != nullptr) {
+ // "max" must exist if and only if name is "channel-count" or
+ // "concurrent-instances".
+ // "min" is not ncessary.
+ if (strEq(a_name, "channel-count") ||
+ strEq(a_name, "concurrent-instances")) {
+ mCurrentType->second[std::string("max-") + a_name] = a_max;
+ } else {
+ return limitFoundMissingAttr(a_name, "max", false);
+ }
+ } else if (strEq(a_name, "channel-count") ||
+ strEq(a_name, "concurrent-instances")) {
+ return limitFoundMissingAttr(a_name, "max");
+ }
+
+ if (a_ranges != nullptr) {
+ // "ranges" must exist if and only if name is "sample-rate".
+ if (strEq(a_name, "sample-rate")) {
+ mCurrentType->second["sample-rate-ranges"] = a_ranges;
+ } else {
+ return limitFoundMissingAttr(a_name, "ranges", false);
+ }
+ } else if (strEq(a_name, "sample-rate")) {
+ return limitFoundMissingAttr(a_name, "ranges");
+ }
+
+ if (a_value != nullptr) {
+ // "value" must exist if and only if name is "alignment" or
+ // "block-size".
+ if (strEq(a_name, "alignment") || strEq(a_name, "block-size")) {
+ mCurrentType->second[a_name] = a_value;
+ } else {
+ return limitFoundMissingAttr(a_name, "value", false);
+ }
+ } else if (strEq(a_name, "alignment") || strEq(a_name, "block-size")) {
+ return limitFoundMissingAttr(a_name, "value", false);
+ }
+
+ }
+
+ return OK;
+}
+
+status_t MediaCodecsXmlParser::addFeature(const char **attrs) {
+ size_t i = 0;
+ const char *name = nullptr;
+ int32_t optional = -1;
+ int32_t required = -1;
+ const char *value = nullptr;
+
+ while (attrs[i] != nullptr) {
+ if (strEq(attrs[i], "name")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addFeature: name is null");
+ return -EINVAL;
+ }
+ name = attrs[i];
+ } else if (strEq(attrs[i], "optional")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addFeature: optional is null");
+ return -EINVAL;
+ }
+ optional = parseBoolean(attrs[i]) ? 1 : 0;
+ } else if (strEq(attrs[i], "required")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addFeature: required is null");
+ return -EINVAL;
+ }
+ required = parseBoolean(attrs[i]) ? 1 : 0;
+ } else if (strEq(attrs[i], "value")) {
+ if (attrs[++i] == nullptr) {
+ ALOGE("addFeature: value is null");
+ return -EINVAL;
+ }
+ value = attrs[i];
+ } else {
+ ALOGE("addFeature: unrecognized attribute: %s", attrs[i]);
+ return -EINVAL;
+ }
+ ++i;
+ }
+
+ // Every feature must have a name.
+ if (name == nullptr) {
+ ALOGE("feature with no 'name' attribute");
+ return -EINVAL;
+ }
+
+ if (mCurrentType == mCurrentCodec->second.typeMap.end()) {
+ ALOGW("ignoring null type");
+ return OK;
+ }
+
+ if ((optional != -1) || (required != -1)) {
+ if (optional == required) {
+ ALOGE("feature '%s' is both/neither optional and required", name);
+ return -EINVAL;
+ }
+ if ((optional == 1) || (required == 1)) {
+ if (value != nullptr) {
+ ALOGE("feature '%s' cannot have extra 'value'", name);
+ return -EINVAL;
+ }
+ mCurrentType->second[std::string("feature-") + name] =
+ optional == 1 ? "0" : "1";
+ return OK;
+ }
+ }
+ mCurrentType->second[std::string("feature-") + name] = value == nullptr ?
+ "0" : value;
+ return OK;
+}
+
+const MediaCodecsXmlParser::AttributeMap&
+ MediaCodecsXmlParser::getServiceAttributeMap() const {
+ return mServiceAttributeMap;
+}
+
+const MediaCodecsXmlParser::CodecMap&
+ MediaCodecsXmlParser::getCodecMap() const {
+ return mCodecMap;
+}
+
+const MediaCodecsXmlParser::RoleMap&
+ MediaCodecsXmlParser::getRoleMap() const {
+ if (mRoleMap.empty()) {
+ generateRoleMap();
+ }
+ return mRoleMap;
+}
+
+const char* MediaCodecsXmlParser::getCommonPrefix() const {
+ if (mCommonPrefix.empty()) {
+ generateCommonPrefix();
+ }
+ return mCommonPrefix.data();
+}
+
+status_t MediaCodecsXmlParser::getParsingStatus() const {
+ return mParsingStatus;
+}
+
+void MediaCodecsXmlParser::generateRoleMap() const {
+ for (const auto& codec : mCodecMap) {
+ const auto& codecName = codec.first;
+ bool isEncoder = codec.second.isEncoder;
+ size_t order = codec.second.order;
+ const auto& typeMap = codec.second.typeMap;
+ for (const auto& type : typeMap) {
+ const auto& typeName = type.first;
+ const char* roleName = GetComponentRole(isEncoder, typeName.data());
+ if (roleName == nullptr) {
+ ALOGE("Cannot find the role for %s of type %s",
+ isEncoder ? "an encoder" : "a decoder",
+ typeName.data());
+ continue;
+ }
+ const auto& typeAttributeMap = type.second;
+
+ auto roleIterator = mRoleMap.find(roleName);
+ std::multimap<size_t, NodeInfo>* nodeList;
+ if (roleIterator == mRoleMap.end()) {
+ RoleProperties roleProperties;
+ roleProperties.type = typeName;
+ roleProperties.isEncoder = isEncoder;
+ auto insertResult = mRoleMap.insert(
+ std::make_pair(roleName, roleProperties));
+ if (!insertResult.second) {
+ ALOGE("Cannot add role %s", roleName);
+ continue;
+ }
+ nodeList = &insertResult.first->second.nodeList;
+ } else {
+ if (roleIterator->second.type != typeName) {
+ ALOGE("Role %s has mismatching types: %s and %s",
+ roleName,
+ roleIterator->second.type.data(),
+ typeName.data());
+ continue;
+ }
+ if (roleIterator->second.isEncoder != isEncoder) {
+ ALOGE("Role %s cannot be both an encoder and a decoder",
+ roleName);
+ continue;
+ }
+ nodeList = &roleIterator->second.nodeList;
+ }
+
+ NodeInfo nodeInfo;
+ nodeInfo.name = codecName;
+ nodeInfo.attributeList.reserve(typeAttributeMap.size());
+ for (const auto& attribute : typeAttributeMap) {
+ nodeInfo.attributeList.push_back(
+ Attribute{attribute.first, attribute.second});
+ }
+ nodeList->insert(std::make_pair(
+ std::move(order), std::move(nodeInfo)));
+ }
+ }
+}
+
+void MediaCodecsXmlParser::generateCommonPrefix() const {
+ if (mCodecMap.empty()) {
+ return;
+ }
+ auto i = mCodecMap.cbegin();
+ auto first = i->first.cbegin();
+ auto last = i->first.cend();
+ for (++i; i != mCodecMap.cend(); ++i) {
+ last = std::mismatch(
+ first, last, i->first.cbegin(), i->first.cend()).first;
+ }
+ mCommonPrefix.insert(mCommonPrefix.begin(), first, last);
+}
+
+} // namespace android
+
diff --git a/media/libstagefright/xmlparser/include/media/stagefright/xmlparser/MediaCodecsXmlParser.h b/media/libstagefright/xmlparser/include/media/stagefright/xmlparser/MediaCodecsXmlParser.h
new file mode 100644
index 0000000..cc69e52
--- /dev/null
+++ b/media/libstagefright/xmlparser/include/media/stagefright/xmlparser/MediaCodecsXmlParser.h
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2017, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef MEDIA_STAGEFRIGHT_XMLPARSER_H_
+#define MEDIA_STAGEFRIGHT_XMLPARSER_H_
+
+#include <sys/types.h>
+#include <utils/Errors.h>
+#include <utils/Vector.h>
+#include <utils/StrongPointer.h>
+
+#include <string>
+#include <set>
+#include <map>
+#include <vector>
+
+namespace android {
+
+class MediaCodecsXmlParser {
+public:
+
+ // Treblized media codec list will be located in /odm/etc or /vendor/etc.
+ static constexpr char const* defaultSearchDirs[] =
+ {"/odm/etc", "/vendor/etc", "/etc", nullptr};
+ static constexpr char const* defaultMainXmlName =
+ "media_codecs.xml";
+ static constexpr char const* defaultPerformanceXmlName =
+ "media_codecs_performance.xml";
+ static constexpr char const* defaultProfilingResultsXmlPath =
+ "/data/misc/media/media_codecs_profiling_results.xml";
+
+ MediaCodecsXmlParser(
+ const char* const* searchDirs = defaultSearchDirs,
+ const char* mainXmlName = defaultMainXmlName,
+ const char* performanceXmlName = defaultPerformanceXmlName,
+ const char* profilingResultsXmlPath = defaultProfilingResultsXmlPath);
+ ~MediaCodecsXmlParser();
+
+ typedef std::pair<std::string, std::string> Attribute;
+ typedef std::map<std::string, std::string> AttributeMap;
+
+ typedef std::pair<std::string, AttributeMap> Type;
+ typedef std::map<std::string, AttributeMap> TypeMap;
+
+ typedef std::set<std::string> QuirkSet;
+
+ /**
+ * Properties of a codec (node)
+ */
+ struct CodecProperties {
+ bool isEncoder; ///< Whether this codec is an encoder or a decoder
+ size_t order; ///< Order of appearance in the file (starting from 0)
+ QuirkSet quirkSet; ///< Set of quirks requested by this codec
+ TypeMap typeMap; ///< Map of types supported by this codec
+ };
+
+ typedef std::pair<std::string, CodecProperties> Codec;
+ typedef std::map<std::string, CodecProperties> CodecMap;
+
+ /**
+ * Properties of a node (for IOmxStore)
+ */
+ struct NodeInfo {
+ std::string name;
+ std::vector<Attribute> attributeList;
+ };
+
+ /**
+ * Properties of a role (for IOmxStore)
+ */
+ struct RoleProperties {
+ std::string type;
+ bool isEncoder;
+ std::multimap<size_t, NodeInfo> nodeList;
+ };
+
+ typedef std::pair<std::string, RoleProperties> Role;
+ typedef std::map<std::string, RoleProperties> RoleMap;
+
+ /**
+ * Return a map for attributes that are service-specific.
+ */
+ const AttributeMap& getServiceAttributeMap() const;
+
+ /**
+ * Return a map for codecs and their properties.
+ */
+ const CodecMap& getCodecMap() const;
+
+ /**
+ * Return a map for roles and their properties.
+ * This map is generated from the CodecMap.
+ */
+ const RoleMap& getRoleMap() const;
+
+ /**
+ * Return a common prefix of all node names.
+ *
+ * The prefix is not provided in the xml, so it has to be computed by taking
+ * the longest common prefix of all node names.
+ */
+ const char* getCommonPrefix() const;
+
+ status_t getParsingStatus() const;
+
+private:
+ enum Section {
+ SECTION_TOPLEVEL,
+ SECTION_SETTINGS,
+ SECTION_DECODERS,
+ SECTION_DECODER,
+ SECTION_DECODER_TYPE,
+ SECTION_ENCODERS,
+ SECTION_ENCODER,
+ SECTION_ENCODER_TYPE,
+ SECTION_INCLUDE,
+ };
+
+ status_t mParsingStatus;
+ Section mCurrentSection;
+ bool mUpdate;
+ std::vector<Section> mSectionStack;
+ std::string mHrefBase;
+
+ // Service attributes
+ AttributeMap mServiceAttributeMap;
+
+ // Codec attributes
+ std::string mCurrentName;
+ std::set<std::string> mCodecSet;
+ Codec mCodecListTemp[2048];
+ CodecMap mCodecMap;
+ size_t mCodecCounter;
+ CodecMap::iterator mCurrentCodec;
+ TypeMap::iterator mCurrentType;
+
+ // Role map
+ mutable RoleMap mRoleMap;
+
+ // Computed longest common prefix
+ mutable std::string mCommonPrefix;
+
+ bool parseTopLevelXMLFile(const char *path, bool ignore_errors = false);
+
+ void parseXMLFile(const char *path);
+
+ static void StartElementHandlerWrapper(
+ void *me, const char *name, const char **attrs);
+
+ static void EndElementHandlerWrapper(void *me, const char *name);
+
+ void startElementHandler(const char *name, const char **attrs);
+ void endElementHandler(const char *name);
+
+ status_t includeXMLFile(const char **attrs);
+ status_t addSettingFromAttributes(const char **attrs);
+ status_t addMediaCodecFromAttributes(bool encoder, const char **attrs);
+ void addMediaCodec(bool encoder, const char *name,
+ const char *type = nullptr);
+
+ status_t addQuirk(const char **attrs);
+ status_t addTypeFromAttributes(const char **attrs, bool encoder);
+ status_t addLimit(const char **attrs);
+ status_t addFeature(const char **attrs);
+ void addType(const char *name);
+
+ void generateRoleMap() const;
+ void generateCommonPrefix() const;
+
+ MediaCodecsXmlParser(const MediaCodecsXmlParser&) = delete;
+ MediaCodecsXmlParser& operator=(const MediaCodecsXmlParser&) = delete;
+};
+
+} // namespace android
+
+#endif // MEDIA_STAGEFRIGHT_XMLPARSER_H_
+
diff --git a/media/mtp/MtpDatabase.h b/media/mtp/MtpDatabase.h
index 2395f4f..f3f9720 100644
--- a/media/mtp/MtpDatabase.h
+++ b/media/mtp/MtpDatabase.h
@@ -45,6 +45,8 @@
MtpObjectFormat format,
bool succeeded) = 0;
+ virtual void doScanDirectory(const char* path) = 0;
+
virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID,
MtpObjectFormat format,
MtpObjectHandle parent) = 0;
diff --git a/media/mtp/MtpDebug.cpp b/media/mtp/MtpDebug.cpp
index 1c04bcf..d2ede1c 100644
--- a/media/mtp/MtpDebug.cpp
+++ b/media/mtp/MtpDebug.cpp
@@ -102,6 +102,7 @@
{ "MTP_FORMAT_JP2", 0x380F },
{ "MTP_FORMAT_JPX", 0x3810 },
{ "MTP_FORMAT_DNG", 0x3811 },
+ { "MTP_FORMAT_HEIF", 0x3812 },
{ "MTP_FORMAT_UNDEFINED_FIRMWARE", 0xB802 },
{ "MTP_FORMAT_WINDOWS_IMAGE_FORMAT", 0xB881 },
{ "MTP_FORMAT_UNDEFINED_AUDIO", 0xB900 },
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp
index 6080868..bb0414d 100644
--- a/media/mtp/MtpServer.cpp
+++ b/media/mtp/MtpServer.cpp
@@ -1148,6 +1148,7 @@
ALOGV("Copying file from %s to %s", (const char*)fromPath, (const char*)path);
if (format == MTP_FORMAT_ASSOCIATION) {
int ret = makeFolder((const char *)path);
+ ret += copyRecursive(fromPath, path);
if (ret) {
result = MTP_RESPONSE_GENERAL_ERROR;
}
@@ -1158,6 +1159,8 @@
}
mDatabase->endSendObject(path, handle, format, result);
+ if (format == MTP_FORMAT_ASSOCIATION)
+ mDatabase->doScanDirectory(path);
mResponse.setParameter(1, handle);
return result;
}
diff --git a/media/mtp/mtp.h b/media/mtp/mtp.h
index 644780f..1c7829d 100644
--- a/media/mtp/mtp.h
+++ b/media/mtp/mtp.h
@@ -94,6 +94,7 @@
#define MTP_FORMAT_JP2 0x380F // JPEG2000 Baseline File Format
#define MTP_FORMAT_JPX 0x3810 // JPEG2000 Extended File Format
#define MTP_FORMAT_DNG 0x3811 // Digital Negative
+#define MTP_FORMAT_HEIF 0x3812 // HEIF images
#define MTP_FORMAT_UNDEFINED_FIRMWARE 0xB802
#define MTP_FORMAT_WINDOWS_IMAGE_FORMAT 0xB881
#define MTP_FORMAT_UNDEFINED_AUDIO 0xB900
diff --git a/media/ndk/NdkImage.cpp b/media/ndk/NdkImage.cpp
index 6d28d1b..87b649a 100644
--- a/media/ndk/NdkImage.cpp
+++ b/media/ndk/NdkImage.cpp
@@ -53,21 +53,25 @@
void
AImage::close(int releaseFenceFd) {
+ lockReader();
Mutex::Autolock _l(mLock);
if (mIsClosed) {
return;
}
sp<AImageReader> reader = mReader.promote();
- if (reader == nullptr) {
- LOG_ALWAYS_FATAL("Error: AImage not closed before AImageReader close!");
- return;
+ if (reader != nullptr) {
+ reader->releaseImageLocked(this, releaseFenceFd);
+ } else if (mBuffer != nullptr) {
+ LOG_ALWAYS_FATAL("%s: parent AImageReader closed without releasing image %p",
+ __FUNCTION__, this);
}
- reader->releaseImageLocked(this, releaseFenceFd);
+
// Should have been set to nullptr in releaseImageLocked
// Set to nullptr here for extra safety only
mBuffer = nullptr;
mLockedBuffer = nullptr;
mIsClosed = true;
+ unlockReader();
}
void
@@ -618,9 +622,7 @@
void AImage_deleteAsync(AImage* image, int releaseFenceFd) {
ALOGV("%s", __FUNCTION__);
if (image != nullptr) {
- image->lockReader();
image->close(releaseFenceFd);
- image->unlockReader();
if (!image->isClosed()) {
LOG_ALWAYS_FATAL("Image close failed!");
}
diff --git a/media/ndk/NdkImageReader.cpp b/media/ndk/NdkImageReader.cpp
index 5d1a20b..e90783d 100644
--- a/media/ndk/NdkImageReader.cpp
+++ b/media/ndk/NdkImageReader.cpp
@@ -44,7 +44,11 @@
const char* AImageReader::kGraphicBufferKey = "GraphicBuffer";
bool
-AImageReader::isSupportedFormat(int32_t format) {
+AImageReader::isSupportedFormatAndUsage(int32_t format, uint64_t usage) {
+ // Check whether usage has either CPU_READ_OFTEN or CPU_READ set. Note that check against
+ // AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN (0x6) is sufficient as it implies
+ // AHARDWAREBUFFER_USAGE_CPU_READ (0x2).
+ bool hasCpuUsage = usage & AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN;
switch (format) {
case AIMAGE_FORMAT_RGBA_8888:
case AIMAGE_FORMAT_RGBX_8888:
@@ -60,6 +64,9 @@
case AIMAGE_FORMAT_DEPTH16:
case AIMAGE_FORMAT_DEPTH_POINT_CLOUD:
return true;
+ case AIMAGE_FORMAT_PRIVATE:
+ // For private format, cpu usage is prohibited.
+ return !hasCpuUsage;
default:
return false;
}
@@ -83,6 +90,8 @@
case AIMAGE_FORMAT_DEPTH16:
case AIMAGE_FORMAT_DEPTH_POINT_CLOUD:
return 1;
+ case AIMAGE_FORMAT_PRIVATE:
+ return 0;
default:
return -1;
}
@@ -340,6 +349,7 @@
for (auto it = mAcquiredImages.begin();
it != mAcquiredImages.end(); it++) {
AImage* image = *it;
+ releaseImageLocked(image, /*releaseFenceFd*/-1);
image->close();
}
@@ -606,9 +616,9 @@
return AMEDIA_ERROR_INVALID_PARAMETER;
}
- if (!AImageReader::isSupportedFormat(format)) {
- ALOGE("%s: format %d is not supported by AImageReader",
- __FUNCTION__, format);
+ if (!AImageReader::isSupportedFormatAndUsage(format, usage)) {
+ ALOGE("%s: format %d is not supported with usage 0x%" PRIx64 " by AImageReader",
+ __FUNCTION__, format, usage);
return AMEDIA_ERROR_INVALID_PARAMETER;
}
diff --git a/media/ndk/NdkImageReaderPriv.h b/media/ndk/NdkImageReaderPriv.h
index 989c1fd..989b937 100644
--- a/media/ndk/NdkImageReaderPriv.h
+++ b/media/ndk/NdkImageReaderPriv.h
@@ -49,7 +49,7 @@
struct AImageReader : public RefBase {
public:
- static bool isSupportedFormat(int32_t format);
+ static bool isSupportedFormatAndUsage(int32_t format, uint64_t usage0);
static int getNumPlanesForFormat(int32_t format);
AImageReader(int32_t width,
diff --git a/media/ndk/NdkMediaDrm.cpp b/media/ndk/NdkMediaDrm.cpp
index 51143ac..eecc858 100644
--- a/media/ndk/NdkMediaDrm.cpp
+++ b/media/ndk/NdkMediaDrm.cpp
@@ -421,7 +421,7 @@
for (size_t i = 0; i < mObj->mQueryResults.size(); i++) {
keyValuePairs[i].mKey = mObj->mQueryResults.keyAt(i).string();
- keyValuePairs[i].mValue = mObj->mQueryResults.keyAt(i).string();
+ keyValuePairs[i].mValue = mObj->mQueryResults.valueAt(i).string();
}
*numPairs = mObj->mQueryResults.size();
return AMEDIA_OK;
diff --git a/media/ndk/include/media/NdkImage.h b/media/ndk/include/media/NdkImage.h
index d301d83..99cf5d5 100644
--- a/media/ndk/include/media/NdkImage.h
+++ b/media/ndk/include/media/NdkImage.h
@@ -491,7 +491,13 @@
/**
* Android private opaque image format.
*
- * <p>This format is not currently supported by {@link AImageReader}.</p>
+ * <p>The choices of the actual format and pixel data layout are entirely up to the
+ * device-specific and framework internal implementations, and may vary depending on use cases
+ * even for the same device. Also note that the contents of these buffers are not directly
+ * accessible to the application.</p>
+ *
+ * <p>When an {@link AImage} of this format is obtained from an {@link AImageReader} or
+ * {@link AImage_getNumberOfPlanes()} method will return zero.</p>
*/
AIMAGE_FORMAT_PRIVATE = 0x22
};
diff --git a/media/ndk/include/media/NdkImageReader.h b/media/ndk/include/media/NdkImageReader.h
index c9c7a6b..a8667c9 100644
--- a/media/ndk/include/media/NdkImageReader.h
+++ b/media/ndk/include/media/NdkImageReader.h
@@ -68,7 +68,9 @@
* @param height The default height in pixels of the Images that this reader will produce.
* @param format The format of the Image that this reader will produce. This must be one of the
* AIMAGE_FORMAT_* enum value defined in {@link AIMAGE_FORMATS}. Note that not all
- * formats are supported, like {@link AIMAGE_FORMAT_PRIVATE}.
+ * formats are supported. One example is {@link AIMAGE_FORMAT_PRIVATE}, as it is not
+ * intended to be read by applications directly. That format is supported by
+ * {@link AImageReader_newWithUsage} introduced in API 26.
* @param maxImages The maximum number of images the user will want to access simultaneously. This
* should be as small as possible to limit memory use. Once maxImages Images are obtained
* by the user, one of them has to be released before a new {@link AImage} will become
@@ -305,6 +307,28 @@
* for the consumer usage. All other parameters and the return values are identical to those passed
* to {@line AImageReader_new}.
*
+ * <p>If the {@code format} is {@link AIMAGE_FORMAT_PRIVATE}, the created {@link AImageReader}
+ * will produce images whose contents are not directly accessible by the application. The application can
+ * still acquire images from this {@link AImageReader} and access {@link AHardwareBuffer} via
+ * {@link AImage_getHardwareBuffer()}. The {@link AHardwareBuffer} gained this way can then
+ * be passed back to hardware (such as GPU or hardware encoder if supported) for future processing.
+ * For example, you can obtain an {@link EGLClientBuffer} from the {@link AHardwareBuffer} by using
+ * {@link eglGetNativeClientBufferANDROID} extension and pass that {@link EGLClientBuffer} to {@link
+ * eglCreateImageKHR} to create an {@link EGLImage} resource type, which may then be bound to a
+ * texture via {@link glEGLImageTargetTexture2DOES} on supported devices. This can be useful for
+ * transporting textures that may be shared cross-process.</p>
+ * <p>In general, when software access to image data is not necessary, an {@link AImageReader}
+ * created with {@link AIMAGE_FORMAT_PRIVATE} format is more efficient, compared with {@link
+ * AImageReader}s using other format such as {@link AIMAGE_FORMAT_YUV_420_888}.</p>
+ *
+ * <p>Note that not all format and usage flag combination is supported by the {@link AImageReader},
+ * especially if {@code format} is {@link AIMAGE_FORMAT_PRIVATE}, {@code usage} must not include either
+ * {@link AHARDWAREBUFFER_USAGE_READ_RARELY} or {@link AHARDWAREBUFFER_USAGE_READ_OFTEN}</p>
+ *
+ * @param width The default width in pixels of the Images that this reader will produce.
+ * @param height The default height in pixels of the Images that this reader will produce.
+ * @param format The format of the Image that this reader will produce. This must be one of the
+ * AIMAGE_FORMAT_* enum value defined in {@link AIMAGE_FORMATS}.
* @param usage specifies how the consumer will access the AImage, using combination of the
* AHARDWAREBUFFER_USAGE flags described in {@link hardware_buffer.h}.
* Passing {@link AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN} is equivalent to calling
@@ -329,6 +353,11 @@
* {@link AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE}, or combined</td>
* </tr>
* </table>
+ * @return <ul>
+ * <li>{@link AMEDIA_OK} if the method call succeeds.</li>
+ * <li>{@link AMEDIA_ERROR_INVALID_PARAMETER} if reader is NULL, or one or more of width,
+ * height, format, maxImages, or usage arguments is not supported.</li>
+ * <li>{@link AMEDIA_ERROR_UNKNOWN} if the method fails for some other reasons.</li></ul>
*
* @see AImage
* @see AImageReader_new
diff --git a/media/vndk/Android.bp b/media/vndk/Android.bp
deleted file mode 100644
index e93fd16..0000000
--- a/media/vndk/Android.bp
+++ /dev/null
@@ -1,4 +0,0 @@
-subdirs = [
- "xmlparser/1.0",
-]
-
diff --git a/media/vndk/xmlparser/1.0/Android.bp b/media/vndk/xmlparser/1.0/Android.bp
deleted file mode 100644
index 2f10cb1..0000000
--- a/media/vndk/xmlparser/1.0/Android.bp
+++ /dev/null
@@ -1,37 +0,0 @@
-cc_library_shared {
- name: "libstagefright_xmlparser@1.0",
- vendor_available: true,
-
- srcs: [
- "MediaCodecsXmlParser.cpp",
- ],
-
- include_dirs: [
- "frameworks/av/media/libstagefright",
- "frameworks/av/include",
- ],
-
- shared_libs: [
- "libexpat",
- "libutils",
- "liblog",
- "libcutils",
- "libstagefright_foundation",
- ],
-
- cflags: [
- "-Werror",
- "-Wall",
- ],
-
- clang: true,
-
- sanitize: {
- misc_undefined: [
- "unsigned-integer-overflow",
- "signed-integer-overflow",
- ],
- },
-
-}
-
diff --git a/media/vndk/xmlparser/1.0/MediaCodecsXmlParser.cpp b/media/vndk/xmlparser/1.0/MediaCodecsXmlParser.cpp
deleted file mode 100644
index 84e5514..0000000
--- a/media/vndk/xmlparser/1.0/MediaCodecsXmlParser.cpp
+++ /dev/null
@@ -1,862 +0,0 @@
-/*
- * Copyright 2017, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "MediaCodecsXmlParser"
-#include <utils/Log.h>
-
-#include <media/vndk/xmlparser/1.0/MediaCodecsXmlParser.h>
-
-#include <media/MediaCodecInfo.h>
-
-#include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/foundation/AMessage.h>
-#include <media/stagefright/foundation/AUtils.h>
-#include <media/stagefright/MediaErrors.h>
-
-#include <sys/stat.h>
-
-#include <expat.h>
-#include <string>
-
-#define MEDIA_CODECS_CONFIG_FILE_PATH_MAX_LENGTH 256
-
-namespace android {
-
-namespace { // Local variables and functions
-
-const char *kProfilingResults =
- "/data/misc/media/media_codecs_profiling_results.xml";
-
-// Treblized media codec list will be located in /odm/etc or /vendor/etc.
-const char *kConfigLocationList[] =
- {"/odm/etc", "/vendor/etc", "/etc"};
-constexpr int kConfigLocationListSize =
- (sizeof(kConfigLocationList) / sizeof(kConfigLocationList[0]));
-
-bool findMediaCodecListFileFullPath(
- const char *file_name, std::string *out_path) {
- for (int i = 0; i < kConfigLocationListSize; i++) {
- *out_path = std::string(kConfigLocationList[i]) + "/" + file_name;
- struct stat file_stat;
- if (stat(out_path->c_str(), &file_stat) == 0 &&
- S_ISREG(file_stat.st_mode)) {
- return true;
- }
- }
- return false;
-}
-
-// Find TypeInfo by name.
-std::vector<TypeInfo>::iterator findTypeInfo(
- CodecInfo &codecInfo, const AString &typeName) {
- return std::find_if(
- codecInfo.mTypes.begin(), codecInfo.mTypes.end(),
- [typeName](const auto &typeInfo) {
- return typeInfo.mName == typeName;
- });
-}
-
-// Convert a string into a boolean value.
-bool ParseBoolean(const char *s) {
- if (!strcasecmp(s, "true") || !strcasecmp(s, "yes") || !strcasecmp(s, "y")) {
- return true;
- }
- char *end;
- unsigned long res = strtoul(s, &end, 10);
- return *s != '\0' && *end == '\0' && res > 0;
-}
-
-} // unnamed namespace
-
-MediaCodecsXmlParser::MediaCodecsXmlParser() :
- mInitCheck(NO_INIT),
- mUpdate(false) {
- std::string config_file_path;
- if (findMediaCodecListFileFullPath(
- "media_codecs.xml", &config_file_path)) {
- parseTopLevelXMLFile(config_file_path.c_str(), false);
- } else {
- mInitCheck = NAME_NOT_FOUND;
- }
- if (findMediaCodecListFileFullPath(
- "media_codecs_performance.xml", &config_file_path)) {
- parseTopLevelXMLFile(config_file_path.c_str(), true);
- }
- parseTopLevelXMLFile(kProfilingResults, true);
-}
-
-void MediaCodecsXmlParser::parseTopLevelXMLFile(
- const char *codecs_xml, bool ignore_errors) {
- // get href_base
- const char *href_base_end = strrchr(codecs_xml, '/');
- if (href_base_end != NULL) {
- mHrefBase = AString(codecs_xml, href_base_end - codecs_xml + 1);
- }
-
- mInitCheck = OK; // keeping this here for safety
- mCurrentSection = SECTION_TOPLEVEL;
- mDepth = 0;
-
- parseXMLFile(codecs_xml);
-
- if (mInitCheck != OK) {
- if (ignore_errors) {
- mInitCheck = OK;
- return;
- }
- mCodecInfos.clear();
- return;
- }
-}
-
-MediaCodecsXmlParser::~MediaCodecsXmlParser() {
-}
-
-status_t MediaCodecsXmlParser::initCheck() const {
- return mInitCheck;
-}
-
-void MediaCodecsXmlParser::parseXMLFile(const char *path) {
- FILE *file = fopen(path, "r");
-
- if (file == NULL) {
- ALOGW("unable to open media codecs configuration xml file: %s", path);
- mInitCheck = NAME_NOT_FOUND;
- return;
- }
-
- ALOGV("Start parsing %s", path);
- XML_Parser parser = ::XML_ParserCreate(NULL);
- CHECK(parser != NULL);
-
- ::XML_SetUserData(parser, this);
- ::XML_SetElementHandler(
- parser, StartElementHandlerWrapper, EndElementHandlerWrapper);
-
- const int BUFF_SIZE = 512;
- while (mInitCheck == OK) {
- void *buff = ::XML_GetBuffer(parser, BUFF_SIZE);
- if (buff == NULL) {
- ALOGE("failed in call to XML_GetBuffer()");
- mInitCheck = UNKNOWN_ERROR;
- break;
- }
-
- int bytes_read = ::fread(buff, 1, BUFF_SIZE, file);
- if (bytes_read < 0) {
- ALOGE("failed in call to read");
- mInitCheck = ERROR_IO;
- break;
- }
-
- XML_Status status = ::XML_ParseBuffer(parser, bytes_read, bytes_read == 0);
- if (status != XML_STATUS_OK) {
- ALOGE("malformed (%s)", ::XML_ErrorString(::XML_GetErrorCode(parser)));
- mInitCheck = ERROR_MALFORMED;
- break;
- }
-
- if (bytes_read == 0) {
- break;
- }
- }
-
- ::XML_ParserFree(parser);
-
- fclose(file);
- file = NULL;
-}
-
-// static
-void MediaCodecsXmlParser::StartElementHandlerWrapper(
- void *me, const char *name, const char **attrs) {
- static_cast<MediaCodecsXmlParser *>(me)->startElementHandler(name, attrs);
-}
-
-// static
-void MediaCodecsXmlParser::EndElementHandlerWrapper(void *me, const char *name) {
- static_cast<MediaCodecsXmlParser *>(me)->endElementHandler(name);
-}
-
-status_t MediaCodecsXmlParser::includeXMLFile(const char **attrs) {
- const char *href = NULL;
- size_t i = 0;
- while (attrs[i] != NULL) {
- if (!strcmp(attrs[i], "href")) {
- if (attrs[i + 1] == NULL) {
- return -EINVAL;
- }
- href = attrs[i + 1];
- ++i;
- } else {
- ALOGE("includeXMLFile: unrecognized attribute: %s", attrs[i]);
- return -EINVAL;
- }
- ++i;
- }
-
- // For security reasons and for simplicity, file names can only contain
- // [a-zA-Z0-9_.] and must start with media_codecs_ and end with .xml
- for (i = 0; href[i] != '\0'; i++) {
- if (href[i] == '.' || href[i] == '_' ||
- (href[i] >= '0' && href[i] <= '9') ||
- (href[i] >= 'A' && href[i] <= 'Z') ||
- (href[i] >= 'a' && href[i] <= 'z')) {
- continue;
- }
- ALOGE("invalid include file name: %s", href);
- return -EINVAL;
- }
-
- AString filename = href;
- if (!filename.startsWith("media_codecs_") ||
- !filename.endsWith(".xml")) {
- ALOGE("invalid include file name: %s", href);
- return -EINVAL;
- }
- filename.insert(mHrefBase, 0);
-
- parseXMLFile(filename.c_str());
- return mInitCheck;
-}
-
-void MediaCodecsXmlParser::startElementHandler(
- const char *name, const char **attrs) {
- if (mInitCheck != OK) {
- return;
- }
-
- bool inType = true;
-
- if (!strcmp(name, "Include")) {
- mInitCheck = includeXMLFile(attrs);
- if (mInitCheck == OK) {
- mPastSections.push(mCurrentSection);
- mCurrentSection = SECTION_INCLUDE;
- }
- ++mDepth;
- return;
- }
-
- switch (mCurrentSection) {
- case SECTION_TOPLEVEL:
- {
- if (!strcmp(name, "Decoders")) {
- mCurrentSection = SECTION_DECODERS;
- } else if (!strcmp(name, "Encoders")) {
- mCurrentSection = SECTION_ENCODERS;
- } else if (!strcmp(name, "Settings")) {
- mCurrentSection = SECTION_SETTINGS;
- }
- break;
- }
-
- case SECTION_SETTINGS:
- {
- if (!strcmp(name, "Setting")) {
- mInitCheck = addSettingFromAttributes(attrs);
- }
- break;
- }
-
- case SECTION_DECODERS:
- {
- if (!strcmp(name, "MediaCodec")) {
- mInitCheck =
- addMediaCodecFromAttributes(false /* encoder */, attrs);
-
- mCurrentSection = SECTION_DECODER;
- }
- break;
- }
-
- case SECTION_ENCODERS:
- {
- if (!strcmp(name, "MediaCodec")) {
- mInitCheck =
- addMediaCodecFromAttributes(true /* encoder */, attrs);
-
- mCurrentSection = SECTION_ENCODER;
- }
- break;
- }
-
- case SECTION_DECODER:
- case SECTION_ENCODER:
- {
- if (!strcmp(name, "Quirk")) {
- mInitCheck = addQuirk(attrs);
- } else if (!strcmp(name, "Type")) {
- mInitCheck = addTypeFromAttributes(attrs, (mCurrentSection == SECTION_ENCODER));
- mCurrentSection =
- (mCurrentSection == SECTION_DECODER
- ? SECTION_DECODER_TYPE : SECTION_ENCODER_TYPE);
- }
- }
- inType = false;
- // fall through
-
- case SECTION_DECODER_TYPE:
- case SECTION_ENCODER_TYPE:
- {
- // ignore limits and features specified outside of type
- bool outside = !inType && mCurrentType == mCodecInfos[mCurrentName].mTypes.end();
- if (outside && (!strcmp(name, "Limit") || !strcmp(name, "Feature"))) {
- ALOGW("ignoring %s specified outside of a Type", name);
- } else if (!strcmp(name, "Limit")) {
- mInitCheck = addLimit(attrs);
- } else if (!strcmp(name, "Feature")) {
- mInitCheck = addFeature(attrs);
- }
- break;
- }
-
- default:
- break;
- }
-
- ++mDepth;
-}
-
-void MediaCodecsXmlParser::endElementHandler(const char *name) {
- if (mInitCheck != OK) {
- return;
- }
-
- switch (mCurrentSection) {
- case SECTION_SETTINGS:
- {
- if (!strcmp(name, "Settings")) {
- mCurrentSection = SECTION_TOPLEVEL;
- }
- break;
- }
-
- case SECTION_DECODERS:
- {
- if (!strcmp(name, "Decoders")) {
- mCurrentSection = SECTION_TOPLEVEL;
- }
- break;
- }
-
- case SECTION_ENCODERS:
- {
- if (!strcmp(name, "Encoders")) {
- mCurrentSection = SECTION_TOPLEVEL;
- }
- break;
- }
-
- case SECTION_DECODER_TYPE:
- case SECTION_ENCODER_TYPE:
- {
- if (!strcmp(name, "Type")) {
- mCurrentSection =
- (mCurrentSection == SECTION_DECODER_TYPE
- ? SECTION_DECODER : SECTION_ENCODER);
-
- mCurrentType = mCodecInfos[mCurrentName].mTypes.end();
- }
- break;
- }
-
- case SECTION_DECODER:
- {
- if (!strcmp(name, "MediaCodec")) {
- mCurrentSection = SECTION_DECODERS;
- mCurrentName.clear();
- }
- break;
- }
-
- case SECTION_ENCODER:
- {
- if (!strcmp(name, "MediaCodec")) {
- mCurrentSection = SECTION_ENCODERS;
- mCurrentName.clear();
- }
- break;
- }
-
- case SECTION_INCLUDE:
- {
- if (!strcmp(name, "Include") && mPastSections.size() > 0) {
- mCurrentSection = mPastSections.top();
- mPastSections.pop();
- }
- break;
- }
-
- default:
- break;
- }
-
- --mDepth;
-}
-
-status_t MediaCodecsXmlParser::addSettingFromAttributes(const char **attrs) {
- const char *name = NULL;
- const char *value = NULL;
- const char *update = NULL;
-
- size_t i = 0;
- while (attrs[i] != NULL) {
- if (!strcmp(attrs[i], "name")) {
- if (attrs[i + 1] == NULL) {
- ALOGE("addSettingFromAttributes: name is null");
- return -EINVAL;
- }
- name = attrs[i + 1];
- ++i;
- } else if (!strcmp(attrs[i], "value")) {
- if (attrs[i + 1] == NULL) {
- ALOGE("addSettingFromAttributes: value is null");
- return -EINVAL;
- }
- value = attrs[i + 1];
- ++i;
- } else if (!strcmp(attrs[i], "update")) {
- if (attrs[i + 1] == NULL) {
- ALOGE("addSettingFromAttributes: update is null");
- return -EINVAL;
- }
- update = attrs[i + 1];
- ++i;
- } else {
- ALOGE("addSettingFromAttributes: unrecognized attribute: %s", attrs[i]);
- return -EINVAL;
- }
-
- ++i;
- }
-
- if (name == NULL || value == NULL) {
- ALOGE("addSettingFromAttributes: name or value unspecified");
- return -EINVAL;
- }
-
- mUpdate = (update != NULL) && ParseBoolean(update);
- if (mUpdate != (mGlobalSettings.count(name) > 0)) {
- ALOGE("addSettingFromAttributes: updating non-existing setting");
- return -EINVAL;
- }
- mGlobalSettings[name] = value;
-
- return OK;
-}
-
-status_t MediaCodecsXmlParser::addMediaCodecFromAttributes(
- bool encoder, const char **attrs) {
- const char *name = NULL;
- const char *type = NULL;
- const char *update = NULL;
-
- size_t i = 0;
- while (attrs[i] != NULL) {
- if (!strcmp(attrs[i], "name")) {
- if (attrs[i + 1] == NULL) {
- ALOGE("addMediaCodecFromAttributes: name is null");
- return -EINVAL;
- }
- name = attrs[i + 1];
- ++i;
- } else if (!strcmp(attrs[i], "type")) {
- if (attrs[i + 1] == NULL) {
- ALOGE("addMediaCodecFromAttributes: type is null");
- return -EINVAL;
- }
- type = attrs[i + 1];
- ++i;
- } else if (!strcmp(attrs[i], "update")) {
- if (attrs[i + 1] == NULL) {
- ALOGE("addMediaCodecFromAttributes: update is null");
- return -EINVAL;
- }
- update = attrs[i + 1];
- ++i;
- } else {
- ALOGE("addMediaCodecFromAttributes: unrecognized attribute: %s", attrs[i]);
- return -EINVAL;
- }
-
- ++i;
- }
-
- if (name == NULL) {
- ALOGE("addMediaCodecFromAttributes: name not found");
- return -EINVAL;
- }
-
- mUpdate = (update != NULL) && ParseBoolean(update);
- if (mUpdate != (mCodecInfos.count(name) > 0)) {
- ALOGE("addMediaCodecFromAttributes: updating non-existing codec or vice versa");
- return -EINVAL;
- }
-
- CodecInfo *info = &mCodecInfos[name];
- if (mUpdate) {
- // existing codec
- mCurrentName = name;
- mCurrentType = info->mTypes.begin();
- if (type != NULL) {
- // existing type
- mCurrentType = findTypeInfo(*info, type);
- if (mCurrentType == info->mTypes.end()) {
- ALOGE("addMediaCodecFromAttributes: updating non-existing type");
- return -EINVAL;
- }
- }
- } else {
- // new codec
- mCurrentName = name;
- mQuirks[name].clear();
- info->mTypes.clear();
- info->mTypes.emplace_back();
- mCurrentType = --info->mTypes.end();
- mCurrentType->mName = type;
- info->mIsEncoder = encoder;
- }
-
- return OK;
-}
-
-status_t MediaCodecsXmlParser::addQuirk(const char **attrs) {
- const char *name = NULL;
-
- size_t i = 0;
- while (attrs[i] != NULL) {
- if (!strcmp(attrs[i], "name")) {
- if (attrs[i + 1] == NULL) {
- ALOGE("addQuirk: name is null");
- return -EINVAL;
- }
- name = attrs[i + 1];
- ++i;
- } else {
- ALOGE("addQuirk: unrecognized attribute: %s", attrs[i]);
- return -EINVAL;
- }
-
- ++i;
- }
-
- if (name == NULL) {
- ALOGE("addQuirk: name not found");
- return -EINVAL;
- }
-
- mQuirks[mCurrentName].emplace_back(name);
- return OK;
-}
-
-status_t MediaCodecsXmlParser::addTypeFromAttributes(const char **attrs, bool encoder) {
- const char *name = NULL;
- const char *update = NULL;
-
- size_t i = 0;
- while (attrs[i] != NULL) {
- if (!strcmp(attrs[i], "name")) {
- if (attrs[i + 1] == NULL) {
- ALOGE("addTypeFromAttributes: name is null");
- return -EINVAL;
- }
- name = attrs[i + 1];
- ++i;
- } else if (!strcmp(attrs[i], "update")) {
- if (attrs[i + 1] == NULL) {
- ALOGE("addTypeFromAttributes: update is null");
- return -EINVAL;
- }
- update = attrs[i + 1];
- ++i;
- } else {
- ALOGE("addTypeFromAttributes: unrecognized attribute: %s", attrs[i]);
- return -EINVAL;
- }
-
- ++i;
- }
-
- if (name == NULL) {
- return -EINVAL;
- }
-
- CodecInfo *info = &mCodecInfos[mCurrentName];
- info->mIsEncoder = encoder;
- mCurrentType = findTypeInfo(*info, name);
- if (!mUpdate) {
- if (mCurrentType != info->mTypes.end()) {
- ALOGE("addTypeFromAttributes: re-defining existing type without update");
- return -EINVAL;
- }
- info->mTypes.emplace_back();
- mCurrentType = --info->mTypes.end();
- } else if (mCurrentType == info->mTypes.end()) {
- ALOGE("addTypeFromAttributes: updating non-existing type");
- return -EINVAL;
- }
-
- return OK;
-}
-
-static status_t limitFoundMissingAttr(const AString &name, const char *attr, bool found = true) {
- ALOGE("limit '%s' with %s'%s' attribute", name.c_str(),
- (found ? "" : "no "), attr);
- return -EINVAL;
-}
-
-static status_t limitError(const AString &name, const char *msg) {
- ALOGE("limit '%s' %s", name.c_str(), msg);
- return -EINVAL;
-}
-
-static status_t limitInvalidAttr(const AString &name, const char *attr, const AString &value) {
- ALOGE("limit '%s' with invalid '%s' attribute (%s)", name.c_str(),
- attr, value.c_str());
- return -EINVAL;
-}
-
-status_t MediaCodecsXmlParser::addLimit(const char **attrs) {
- sp<AMessage> msg = new AMessage();
-
- size_t i = 0;
- while (attrs[i] != NULL) {
- if (attrs[i + 1] == NULL) {
- ALOGE("addLimit: limit is not given");
- return -EINVAL;
- }
-
- // attributes with values
- if (!strcmp(attrs[i], "name")
- || !strcmp(attrs[i], "default")
- || !strcmp(attrs[i], "in")
- || !strcmp(attrs[i], "max")
- || !strcmp(attrs[i], "min")
- || !strcmp(attrs[i], "range")
- || !strcmp(attrs[i], "ranges")
- || !strcmp(attrs[i], "scale")
- || !strcmp(attrs[i], "value")) {
- msg->setString(attrs[i], attrs[i + 1]);
- ++i;
- } else {
- ALOGE("addLimit: unrecognized limit: %s", attrs[i]);
- return -EINVAL;
- }
- ++i;
- }
-
- AString name;
- if (!msg->findString("name", &name)) {
- ALOGE("limit with no 'name' attribute");
- return -EINVAL;
- }
-
- // size, blocks, bitrate, frame-rate, blocks-per-second, aspect-ratio,
- // measured-frame-rate, measured-blocks-per-second: range
- // quality: range + default + [scale]
- // complexity: range + default
- bool found;
- if (mCurrentType == mCodecInfos[mCurrentName].mTypes.end()) {
- ALOGW("ignoring null type");
- return OK;
- }
-
- if (name == "aspect-ratio" || name == "bitrate" || name == "block-count"
- || name == "blocks-per-second" || name == "complexity"
- || name == "frame-rate" || name == "quality" || name == "size"
- || name == "measured-blocks-per-second" || name.startsWith("measured-frame-rate-")) {
- AString min, max;
- if (msg->findString("min", &min) && msg->findString("max", &max)) {
- min.append("-");
- min.append(max);
- if (msg->contains("range") || msg->contains("value")) {
- return limitError(name, "has 'min' and 'max' as well as 'range' or "
- "'value' attributes");
- }
- msg->setString("range", min);
- } else if (msg->contains("min") || msg->contains("max")) {
- return limitError(name, "has only 'min' or 'max' attribute");
- } else if (msg->findString("value", &max)) {
- min = max;
- min.append("-");
- min.append(max);
- if (msg->contains("range")) {
- return limitError(name, "has both 'range' and 'value' attributes");
- }
- msg->setString("range", min);
- }
-
- AString range, scale = "linear", def, in_;
- if (!msg->findString("range", &range)) {
- return limitError(name, "with no 'range', 'value' or 'min'/'max' attributes");
- }
-
- if ((name == "quality" || name == "complexity") ^
- (found = msg->findString("default", &def))) {
- return limitFoundMissingAttr(name, "default", found);
- }
- if (name != "quality" && msg->findString("scale", &scale)) {
- return limitFoundMissingAttr(name, "scale");
- }
- if ((name == "aspect-ratio") ^ (found = msg->findString("in", &in_))) {
- return limitFoundMissingAttr(name, "in", found);
- }
-
- if (name == "aspect-ratio") {
- if (!(in_ == "pixels") && !(in_ == "blocks")) {
- return limitInvalidAttr(name, "in", in_);
- }
- in_.erase(5, 1); // (pixel|block)-aspect-ratio
- in_.append("-");
- in_.append(name);
- name = in_;
- }
- if (name == "quality") {
- mCurrentType->mDetails["quality-scale"] = scale;
- }
- if (name == "quality" || name == "complexity") {
- AString tag = name;
- tag.append("-default");
- mCurrentType->mDetails[tag] = def;
- }
- AString tag = name;
- tag.append("-range");
- mCurrentType->mDetails[tag] = range;
- } else {
- AString max, value, ranges;
- if (msg->contains("default")) {
- return limitFoundMissingAttr(name, "default");
- } else if (msg->contains("in")) {
- return limitFoundMissingAttr(name, "in");
- } else if ((name == "channel-count" || name == "concurrent-instances") ^
- (found = msg->findString("max", &max))) {
- return limitFoundMissingAttr(name, "max", found);
- } else if (msg->contains("min")) {
- return limitFoundMissingAttr(name, "min");
- } else if (msg->contains("range")) {
- return limitFoundMissingAttr(name, "range");
- } else if ((name == "sample-rate") ^
- (found = msg->findString("ranges", &ranges))) {
- return limitFoundMissingAttr(name, "ranges", found);
- } else if (msg->contains("scale")) {
- return limitFoundMissingAttr(name, "scale");
- } else if ((name == "alignment" || name == "block-size") ^
- (found = msg->findString("value", &value))) {
- return limitFoundMissingAttr(name, "value", found);
- }
-
- if (max.size()) {
- AString tag = "max-";
- tag.append(name);
- mCurrentType->mDetails[tag] = max;
- } else if (value.size()) {
- mCurrentType->mDetails[name] = value;
- } else if (ranges.size()) {
- AString tag = name;
- tag.append("-ranges");
- mCurrentType->mDetails[tag] = ranges;
- } else {
- ALOGW("Ignoring unrecognized limit '%s'", name.c_str());
- }
- }
-
- return OK;
-}
-
-status_t MediaCodecsXmlParser::addFeature(const char **attrs) {
- size_t i = 0;
- const char *name = NULL;
- int32_t optional = -1;
- int32_t required = -1;
- const char *value = NULL;
-
- while (attrs[i] != NULL) {
- if (attrs[i + 1] == NULL) {
- ALOGE("addFeature: feature is not given");
- return -EINVAL;
- }
-
- // attributes with values
- if (!strcmp(attrs[i], "name")) {
- name = attrs[i + 1];
- ++i;
- } else if (!strcmp(attrs[i], "optional") || !strcmp(attrs[i], "required")) {
- int value = (int)ParseBoolean(attrs[i + 1]);
- if (!strcmp(attrs[i], "optional")) {
- optional = value;
- } else {
- required = value;
- }
- ++i;
- } else if (!strcmp(attrs[i], "value")) {
- value = attrs[i + 1];
- ++i;
- } else {
- ALOGE("addFeature: unrecognized attribute: %s", attrs[i]);
- return -EINVAL;
- }
- ++i;
- }
- if (name == NULL) {
- ALOGE("feature with no 'name' attribute");
- return -EINVAL;
- }
-
- if (optional == required && optional != -1) {
- ALOGE("feature '%s' is both/neither optional and required", name);
- return -EINVAL;
- }
-
- if (mCurrentType == mCodecInfos[mCurrentName].mTypes.end()) {
- ALOGW("ignoring null type");
- return OK;
- }
- if (value != NULL) {
- mCurrentType->mStringFeatures[name] = value;
- } else {
- mCurrentType->mBoolFeatures[name] = (required == 1) || (optional == 0);
- }
- return OK;
-}
-
-void MediaCodecsXmlParser::getGlobalSettings(
- std::map<AString, AString> *settings) const {
- settings->clear();
- settings->insert(mGlobalSettings.begin(), mGlobalSettings.end());
-}
-
-status_t MediaCodecsXmlParser::getCodecInfo(const char *name, CodecInfo *info) const {
- if (mCodecInfos.count(name) == 0) {
- ALOGE("Codec not found with name '%s'", name);
- return NAME_NOT_FOUND;
- }
- *info = mCodecInfos.at(name);
- return OK;
-}
-
-status_t MediaCodecsXmlParser::getQuirks(const char *name, std::vector<AString> *quirks) const {
- if (mQuirks.count(name) == 0) {
- ALOGE("Codec not found with name '%s'", name);
- return NAME_NOT_FOUND;
- }
- quirks->clear();
- quirks->insert(quirks->end(), mQuirks.at(name).begin(), mQuirks.at(name).end());
- return OK;
-}
-
-} // namespace android
diff --git a/radio/Android.bp b/radio/Android.bp
deleted file mode 100644
index 8e614f2..0000000
--- a/radio/Android.bp
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2014 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-cc_library_shared {
- name: "libradio",
-
- srcs: [
- "Radio.cpp",
- "IRadio.cpp",
- "IRadioClient.cpp",
- "IRadioService.cpp",
- ],
-
- shared_libs: [
- "libcutils",
- "libutils",
- "liblog",
- "libbinder",
- "libradio_metadata",
- ],
-
- cflags: [
- "-Werror",
- "-Wall",
- ],
-}
diff --git a/radio/IRadio.cpp b/radio/IRadio.cpp
deleted file mode 100644
index 72f3b68..0000000
--- a/radio/IRadio.cpp
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
-**
-** Copyright 2015, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
-
-#define LOG_TAG "IRadio"
-//#define LOG_NDEBUG 0
-#include <utils/Log.h>
-#include <utils/Errors.h>
-#include <binder/IMemory.h>
-#include <radio/IRadio.h>
-#include <radio/IRadioService.h>
-#include <radio/IRadioClient.h>
-#include <system/radio.h>
-#include <system/RadioMetadataWrapper.h>
-
-namespace android {
-
-enum {
- DETACH = IBinder::FIRST_CALL_TRANSACTION,
- SET_CONFIGURATION,
- GET_CONFIGURATION,
- SET_MUTE,
- GET_MUTE,
- SCAN,
- STEP,
- TUNE,
- CANCEL,
- GET_PROGRAM_INFORMATION,
- HAS_CONTROL
-};
-
-class BpRadio: public BpInterface<IRadio>
-{
-public:
- explicit BpRadio(const sp<IBinder>& impl)
- : BpInterface<IRadio>(impl)
- {
- }
-
- void detach()
- {
- ALOGV("detach");
- Parcel data, reply;
- data.writeInterfaceToken(IRadio::getInterfaceDescriptor());
- remote()->transact(DETACH, data, &reply);
- }
-
- virtual status_t setConfiguration(const struct radio_band_config *config)
- {
- Parcel data, reply;
- if (config == NULL) {
- return BAD_VALUE;
- }
- data.writeInterfaceToken(IRadio::getInterfaceDescriptor());
- data.write(config, sizeof(struct radio_band_config));
- status_t status = remote()->transact(SET_CONFIGURATION, data, &reply);
- if (status == NO_ERROR) {
- status = (status_t)reply.readInt32();
- }
- return status;
- }
-
- virtual status_t getConfiguration(struct radio_band_config *config)
- {
- Parcel data, reply;
- if (config == NULL) {
- return BAD_VALUE;
- }
- data.writeInterfaceToken(IRadio::getInterfaceDescriptor());
- status_t status = remote()->transact(GET_CONFIGURATION, data, &reply);
- if (status == NO_ERROR) {
- status = (status_t)reply.readInt32();
- if (status == NO_ERROR) {
- reply.read(config, sizeof(struct radio_band_config));
- }
- }
- return status;
- }
-
- virtual status_t setMute(bool mute)
- {
- Parcel data, reply;
- data.writeInterfaceToken(IRadio::getInterfaceDescriptor());
- data.writeInt32(mute ? 1 : 0);
- status_t status = remote()->transact(SET_MUTE, data, &reply);
- if (status == NO_ERROR) {
- status = (status_t)reply.readInt32();
- }
- return status;
- }
-
- virtual status_t getMute(bool *mute)
- {
- Parcel data, reply;
- if (mute == NULL) {
- return BAD_VALUE;
- }
- data.writeInterfaceToken(IRadio::getInterfaceDescriptor());
- status_t status = remote()->transact(GET_MUTE, data, &reply);
- if (status == NO_ERROR) {
- status = (status_t)reply.readInt32();
- if (status == NO_ERROR) {
- int32_t muteread = reply.readInt32();
- *mute = muteread != 0;
- }
- }
- return status;
- }
-
- virtual status_t scan(radio_direction_t direction, bool skipSubChannel)
- {
- Parcel data, reply;
- data.writeInterfaceToken(IRadio::getInterfaceDescriptor());
- data.writeInt32(direction);
- data.writeInt32(skipSubChannel ? 1 : 0);
- status_t status = remote()->transact(SCAN, data, &reply);
- if (status == NO_ERROR) {
- status = (status_t)reply.readInt32();
- }
- return status;
- }
-
- virtual status_t step(radio_direction_t direction, bool skipSubChannel)
- {
- Parcel data, reply;
- data.writeInterfaceToken(IRadio::getInterfaceDescriptor());
- data.writeInt32(direction);
- data.writeInt32(skipSubChannel ? 1 : 0);
- status_t status = remote()->transact(STEP, data, &reply);
- if (status == NO_ERROR) {
- status = (status_t)reply.readInt32();
- }
- return status;
- }
-
- virtual status_t tune(uint32_t channel, uint32_t subChannel)
- {
- Parcel data, reply;
- data.writeInterfaceToken(IRadio::getInterfaceDescriptor());
- data.writeUint32(channel);
- data.writeUint32(subChannel);
- status_t status = remote()->transact(TUNE, data, &reply);
- if (status == NO_ERROR) {
- status = (status_t)reply.readInt32();
- }
- return status;
- }
-
- virtual status_t cancel()
- {
- Parcel data, reply;
- data.writeInterfaceToken(IRadio::getInterfaceDescriptor());
- status_t status = remote()->transact(CANCEL, data, &reply);
- if (status == NO_ERROR) {
- status = (status_t)reply.readInt32();
- }
- return status;
- }
-
- virtual status_t getProgramInformation(struct radio_program_info *info)
- {
- Parcel data, reply;
- if (info == nullptr || info->metadata == nullptr) {
- return BAD_VALUE;
- }
- radio_metadata_t *metadata = info->metadata;
- data.writeInterfaceToken(IRadio::getInterfaceDescriptor());
- status_t status = remote()->transact(GET_PROGRAM_INFORMATION, data, &reply);
- if (status == NO_ERROR) {
- status = (status_t)reply.readInt32();
- if (status == NO_ERROR) {
- reply.read(info, sizeof(struct radio_program_info));
- // restore local metadata pointer
- info->metadata = metadata;
-
- uint32_t metadataSize = reply.readUint32();
- if (metadataSize != 0) {
- radio_metadata_t *newMetadata = (radio_metadata_t *)malloc(metadataSize);
- if (newMetadata == NULL) {
- return NO_MEMORY;
- }
- reply.read(newMetadata, metadataSize);
- status = radio_metadata_add_metadata(&info->metadata, newMetadata);
- free(newMetadata);
- }
- }
- }
- return status;
- }
-
- virtual status_t hasControl(bool *hasControl)
- {
- Parcel data, reply;
- if (hasControl == NULL) {
- return BAD_VALUE;
- }
- data.writeInterfaceToken(IRadio::getInterfaceDescriptor());
- status_t status = remote()->transact(HAS_CONTROL, data, &reply);
- if (status == NO_ERROR) {
- status = (status_t)reply.readInt32();
- if (status == NO_ERROR) {
- *hasControl = reply.readInt32() != 0;
- }
- }
- return status;
- }
-};
-
-IMPLEMENT_META_INTERFACE(Radio, "android.hardware.IRadio");
-
-// ----------------------------------------------------------------------
-
-status_t BnRadio::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- switch(code) {
- case DETACH: {
- ALOGV("DETACH");
- CHECK_INTERFACE(IRadio, data, reply);
- detach();
- return NO_ERROR;
- } break;
- case SET_CONFIGURATION: {
- CHECK_INTERFACE(IRadio, data, reply);
- struct radio_band_config config;
- data.read(&config, sizeof(struct radio_band_config));
- status_t status = setConfiguration(&config);
- reply->writeInt32(status);
- return NO_ERROR;
- }
- case GET_CONFIGURATION: {
- CHECK_INTERFACE(IRadio, data, reply);
- struct radio_band_config config;
- status_t status = getConfiguration(&config);
- reply->writeInt32(status);
- if (status == NO_ERROR) {
- reply->write(&config, sizeof(struct radio_band_config));
- }
- return NO_ERROR;
- }
- case SET_MUTE: {
- CHECK_INTERFACE(IRadio, data, reply);
- bool mute = data.readInt32() != 0;
- status_t status = setMute(mute);
- reply->writeInt32(status);
- return NO_ERROR;
- }
- case GET_MUTE: {
- CHECK_INTERFACE(IRadio, data, reply);
- bool mute;
- status_t status = getMute(&mute);
- reply->writeInt32(status);
- if (status == NO_ERROR) {
- reply->writeInt32(mute ? 1 : 0);
- }
- return NO_ERROR;
- }
- case SCAN: {
- CHECK_INTERFACE(IRadio, data, reply);
- radio_direction_t direction = (radio_direction_t)data.readInt32();
- bool skipSubChannel = data.readInt32() == 1;
- status_t status = scan(direction, skipSubChannel);
- reply->writeInt32(status);
- return NO_ERROR;
- }
- case STEP: {
- CHECK_INTERFACE(IRadio, data, reply);
- radio_direction_t direction = (radio_direction_t)data.readInt32();
- bool skipSubChannel = data.readInt32() == 1;
- status_t status = step(direction, skipSubChannel);
- reply->writeInt32(status);
- return NO_ERROR;
- }
- case TUNE: {
- CHECK_INTERFACE(IRadio, data, reply);
- uint32_t channel = data.readUint32();
- uint32_t subChannel = data.readUint32();
- status_t status = tune(channel, subChannel);
- reply->writeInt32(status);
- return NO_ERROR;
- }
- case CANCEL: {
- CHECK_INTERFACE(IRadio, data, reply);
- status_t status = cancel();
- reply->writeInt32(status);
- return NO_ERROR;
- }
- case GET_PROGRAM_INFORMATION: {
- CHECK_INTERFACE(IRadio, data, reply);
- struct radio_program_info info;
- RadioMetadataWrapper metadataWrapper(&info.metadata);
-
- status_t status = getProgramInformation(&info);
- reply->writeInt32(status);
- if (status == NO_ERROR) {
- reply->write(&info, sizeof(struct radio_program_info));
- if (radio_metadata_get_count(info.metadata) > 0) {
- size_t size = radio_metadata_get_size(info.metadata);
- reply->writeUint32((uint32_t)size);
- reply->write(info.metadata, size);
- } else {
- reply->writeUint32(0);
- }
- }
- return NO_ERROR;
- }
- case HAS_CONTROL: {
- CHECK_INTERFACE(IRadio, data, reply);
- bool control;
- status_t status = hasControl(&control);
- reply->writeInt32(status);
- if (status == NO_ERROR) {
- reply->writeInt32(control ? 1 : 0);
- }
- return NO_ERROR;
- }
- default:
- return BBinder::onTransact(code, data, reply, flags);
- }
-}
-
-// ----------------------------------------------------------------------------
-
-}; // namespace android
diff --git a/radio/IRadioClient.cpp b/radio/IRadioClient.cpp
deleted file mode 100644
index ca21949..0000000
--- a/radio/IRadioClient.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-**
-** Copyright 2015, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <binder/IMemory.h>
-#include <binder/Parcel.h>
-#include <binder/IPCThreadState.h>
-#include <binder/IServiceManager.h>
-#include <radio/IRadioClient.h>
-
-namespace android {
-
-enum {
- ON_EVENT = IBinder::FIRST_CALL_TRANSACTION,
-};
-
-class BpRadioClient: public BpInterface<IRadioClient>
-{
-
-public:
- explicit BpRadioClient(const sp<IBinder>& impl)
- : BpInterface<IRadioClient>(impl)
- {
- }
-
- virtual void onEvent(const sp<IMemory>& eventMemory)
- {
- Parcel data, reply;
- data.writeInterfaceToken(IRadioClient::getInterfaceDescriptor());
- data.writeStrongBinder(IInterface::asBinder(eventMemory));
- remote()->transact(ON_EVENT,
- data,
- &reply);
- }
-};
-
-IMPLEMENT_META_INTERFACE(RadioClient,
- "android.hardware.IRadioClient");
-
-// ----------------------------------------------------------------------
-
-status_t BnRadioClient::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- switch(code) {
- case ON_EVENT: {
- CHECK_INTERFACE(IRadioClient, data, reply);
- sp<IMemory> eventMemory = interface_cast<IMemory>(
- data.readStrongBinder());
- onEvent(eventMemory);
- return NO_ERROR;
- } break;
- default:
- return BBinder::onTransact(code, data, reply, flags);
- } return NO_ERROR;
-}
-
-// ----------------------------------------------------------------------------
-
-}; // namespace android
diff --git a/radio/IRadioService.cpp b/radio/IRadioService.cpp
deleted file mode 100644
index 72e3a61..0000000
--- a/radio/IRadioService.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
-**
-** Copyright 2015, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
-
-#define LOG_TAG "BpRadioService"
-//#define LOG_NDEBUG 0
-
-#include <utils/Log.h>
-#include <utils/Errors.h>
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <binder/IMemory.h>
-#include <binder/Parcel.h>
-#include <binder/IPCThreadState.h>
-#include <binder/IServiceManager.h>
-
-#include <radio/IRadioService.h>
-#include <radio/IRadio.h>
-#include <radio/IRadioClient.h>
-
-namespace android {
-
-enum {
- LIST_MODULES = IBinder::FIRST_CALL_TRANSACTION,
- ATTACH,
-};
-
-#define MAX_ITEMS_PER_LIST 1024
-
-class BpRadioService: public BpInterface<IRadioService>
-{
-public:
- explicit BpRadioService(const sp<IBinder>& impl)
- : BpInterface<IRadioService>(impl)
- {
- }
-
- virtual status_t listModules(struct radio_properties *properties,
- uint32_t *numModules)
- {
- if (numModules == NULL || (*numModules != 0 && properties == NULL)) {
- return BAD_VALUE;
- }
- Parcel data, reply;
- data.writeInterfaceToken(IRadioService::getInterfaceDescriptor());
- uint32_t numModulesReq = (properties == NULL) ? 0 : *numModules;
- data.writeInt32(numModulesReq);
- status_t status = remote()->transact(LIST_MODULES, data, &reply);
- if (status == NO_ERROR) {
- status = (status_t)reply.readInt32();
- *numModules = (uint32_t)reply.readInt32();
- }
- ALOGV("listModules() status %d got *numModules %d", status, *numModules);
- if (status == NO_ERROR) {
- if (numModulesReq > *numModules) {
- numModulesReq = *numModules;
- }
- if (numModulesReq > 0) {
- reply.read(properties, numModulesReq * sizeof(struct radio_properties));
- }
- }
- return status;
- }
-
- virtual status_t attach(radio_handle_t handle,
- const sp<IRadioClient>& client,
- const struct radio_band_config *config,
- bool withAudio,
- sp<IRadio>& radio)
- {
- Parcel data, reply;
- data.writeInterfaceToken(IRadioService::getInterfaceDescriptor());
- data.writeInt32(handle);
- data.writeStrongBinder(IInterface::asBinder(client));
- ALOGV("attach() config %p withAudio %d region %d type %d",
- config == NULL ? 0 : config, withAudio,
- config == NULL ? 0 : config->region,
- config == NULL ? 0 : config->band.type);
- if (config == NULL) {
- data.writeInt32(0);
- } else {
- data.writeInt32(1);
- data.write(config, sizeof(struct radio_band_config));
- }
- data.writeInt32(withAudio ? 1 : 0);
- status_t status = remote()->transact(ATTACH, data, &reply);
- if (status != NO_ERROR) {
- return status;
- }
- status = reply.readInt32();
- if (reply.readInt32() != 0) {
- radio = interface_cast<IRadio>(reply.readStrongBinder());
- }
- return status;
- }
-};
-
-IMPLEMENT_META_INTERFACE(RadioService, "android.hardware.IRadioService");
-
-// ----------------------------------------------------------------------
-
-status_t BnRadioService::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- switch(code) {
- case LIST_MODULES: {
- CHECK_INTERFACE(IRadioService, data, reply);
- uint32_t numModulesReq = data.readInt32();
- if (numModulesReq > MAX_ITEMS_PER_LIST) {
- numModulesReq = MAX_ITEMS_PER_LIST;
- }
- uint32_t numModules = numModulesReq;
- struct radio_properties *properties =
- (struct radio_properties *)calloc(numModulesReq,
- sizeof(struct radio_properties));
- if (properties == NULL) {
- reply->writeInt32(NO_MEMORY);
- reply->writeInt32(0);
- return NO_ERROR;
- }
-
- status_t status = listModules(properties, &numModules);
- reply->writeInt32(status);
- reply->writeInt32(numModules);
- ALOGV("LIST_MODULES status %d got numModules %d", status, numModules);
-
- if (status == NO_ERROR) {
- if (numModulesReq > numModules) {
- numModulesReq = numModules;
- }
- reply->write(properties,
- numModulesReq * sizeof(struct radio_properties));
- }
- free(properties);
- return NO_ERROR;
- } break;
-
- case ATTACH: {
- CHECK_INTERFACE(IRadioService, data, reply);
- radio_handle_t handle = data.readInt32();
- sp<IRadioClient> client =
- interface_cast<IRadioClient>(data.readStrongBinder());
- struct radio_band_config config;
- struct radio_band_config *configPtr = NULL;
- if (data.readInt32() != 0) {
- data.read(&config, sizeof(struct radio_band_config));
- configPtr = &config;
- }
- bool withAudio = data.readInt32() != 0;
- ALOGV("ATTACH configPtr %p withAudio %d", configPtr, withAudio);
- sp<IRadio> radio;
- status_t status = attach(handle, client, configPtr, withAudio, radio);
- reply->writeInt32(status);
- if (radio != 0) {
- reply->writeInt32(1);
- reply->writeStrongBinder(IInterface::asBinder(radio));
- } else {
- reply->writeInt32(0);
- }
- return NO_ERROR;
- } break;
- default:
- return BBinder::onTransact(code, data, reply, flags);
- }
-}
-
-// ----------------------------------------------------------------------------
-
-}; // namespace android
diff --git a/radio/OWNERS b/radio/OWNERS
deleted file mode 100644
index 4b38a35..0000000
--- a/radio/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-elaurent@google.com
-twasilczyk@google.com
diff --git a/radio/Radio.cpp b/radio/Radio.cpp
deleted file mode 100644
index 9ddd221..0000000
--- a/radio/Radio.cpp
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
-**
-** Copyright (C) 2015, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
-
-#define LOG_TAG "Radio"
-//#define LOG_NDEBUG 0
-
-#include <utils/Log.h>
-#include <utils/threads.h>
-#include <binder/IPCThreadState.h>
-#include <binder/IServiceManager.h>
-#include <binder/IMemory.h>
-
-#include <radio/Radio.h>
-#include <radio/IRadio.h>
-#include <radio/IRadioService.h>
-#include <radio/IRadioClient.h>
-#include <radio/RadioCallback.h>
-
-namespace android {
-
-namespace {
- sp<IRadioService> gRadioService;
- const int kRadioServicePollDelay = 500000; // 0.5s
- const char* kRadioServiceName = "media.radio";
- Mutex gLock;
-
- class DeathNotifier : public IBinder::DeathRecipient
- {
- public:
- DeathNotifier() {
- }
-
- virtual void binderDied(const wp<IBinder>& who __unused) {
- ALOGV("binderDied");
- Mutex::Autolock _l(gLock);
- gRadioService.clear();
- ALOGW("Radio service died!");
- }
- };
-
- sp<DeathNotifier> gDeathNotifier;
-}; // namespace anonymous
-
-const sp<IRadioService> Radio::getRadioService()
-{
- Mutex::Autolock _l(gLock);
- if (gRadioService.get() == 0) {
- sp<IServiceManager> sm = defaultServiceManager();
- sp<IBinder> binder;
- do {
- binder = sm->getService(String16(kRadioServiceName));
- if (binder != 0) {
- break;
- }
- ALOGW("RadioService not published, waiting...");
- usleep(kRadioServicePollDelay);
- } while(true);
- if (gDeathNotifier == NULL) {
- gDeathNotifier = new DeathNotifier();
- }
- binder->linkToDeath(gDeathNotifier);
- gRadioService = interface_cast<IRadioService>(binder);
- }
- ALOGE_IF(gRadioService == 0, "no RadioService!?");
- return gRadioService;
-}
-
-// Static methods
-status_t Radio::listModules(struct radio_properties *properties,
- uint32_t *numModules)
-{
- ALOGV("listModules()");
- const sp<IRadioService> service = getRadioService();
- if (service == 0) {
- return NO_INIT;
- }
- return service->listModules(properties, numModules);
-}
-
-sp<Radio> Radio::attach(radio_handle_t handle,
- const struct radio_band_config *config,
- bool withAudio,
- const sp<RadioCallback>& callback)
-{
- ALOGV("attach()");
- sp<Radio> radio;
- const sp<IRadioService> service = getRadioService();
- if (service == 0) {
- return radio;
- }
- radio = new Radio(handle, callback);
- status_t status = service->attach(handle, radio, config, withAudio, radio->mIRadio);
-
- if (status == NO_ERROR && radio->mIRadio != 0) {
- IInterface::asBinder(radio->mIRadio)->linkToDeath(radio);
- } else {
- ALOGW("Error %d connecting to radio service", status);
- radio.clear();
- }
- return radio;
-}
-
-
-
-// Radio
-Radio::Radio(radio_handle_t /*handle*/, const sp<RadioCallback>& callback)
- : mCallback(callback)
-{
-}
-
-Radio::~Radio()
-{
- if (mIRadio != 0) {
- mIRadio->detach();
- }
-}
-
-
-void Radio::detach() {
- ALOGV("detach()");
- Mutex::Autolock _l(mLock);
- mCallback.clear();
- if (mIRadio != 0) {
- mIRadio->detach();
- IInterface::asBinder(mIRadio)->unlinkToDeath(this);
- mIRadio = 0;
- }
-}
-
-status_t Radio::setConfiguration(const struct radio_band_config *config)
-{
- Mutex::Autolock _l(mLock);
- if (mIRadio == 0) {
- return NO_INIT;
- }
- return mIRadio->setConfiguration(config);
-}
-
-status_t Radio::getConfiguration(struct radio_band_config *config)
-{
- Mutex::Autolock _l(mLock);
- if (mIRadio == 0) {
- return NO_INIT;
- }
- return mIRadio->getConfiguration(config);
-}
-
-status_t Radio::setMute(bool mute)
-{
- Mutex::Autolock _l(mLock);
- if (mIRadio == 0) {
- return NO_INIT;
- }
- return mIRadio->setMute(mute);
-}
-
-status_t Radio::getMute(bool *mute)
-{
- Mutex::Autolock _l(mLock);
- if (mIRadio == 0) {
- return NO_INIT;
- }
- return mIRadio->getMute(mute);
-}
-
-status_t Radio::scan(radio_direction_t direction, bool skipSubchannel)
-{
- Mutex::Autolock _l(mLock);
- if (mIRadio == 0) {
- return NO_INIT;
- }
- return mIRadio->scan(direction, skipSubchannel);
-}
-
-status_t Radio::step(radio_direction_t direction, bool skipSubchannel)
-{
- Mutex::Autolock _l(mLock);
- if (mIRadio == 0) {
- return NO_INIT;
- }
- return mIRadio->step(direction, skipSubchannel);
-}
-
-status_t Radio::tune(unsigned int channel, unsigned int subChannel)
-{
- Mutex::Autolock _l(mLock);
- if (mIRadio == 0) {
- return NO_INIT;
- }
- return mIRadio->tune(channel, subChannel);
-}
-
-status_t Radio::cancel()
-{
- Mutex::Autolock _l(mLock);
- if (mIRadio == 0) {
- return NO_INIT;
- }
- return mIRadio->cancel();
-}
-
-status_t Radio::getProgramInformation(struct radio_program_info *info)
-{
- Mutex::Autolock _l(mLock);
- if (mIRadio == 0) {
- return NO_INIT;
- }
- return mIRadio->getProgramInformation(info);
-}
-
-status_t Radio::hasControl(bool *hasControl)
-{
- Mutex::Autolock _l(mLock);
- if (mIRadio == 0) {
- return NO_INIT;
- }
- return mIRadio->hasControl(hasControl);
-}
-
-
-// BpRadioClient
-void Radio::onEvent(const sp<IMemory>& eventMemory)
-{
- Mutex::Autolock _l(mLock);
- if (eventMemory == 0 || eventMemory->pointer() == NULL) {
- return;
- }
-
- // The event layout in shared memory is:
- // sizeof(struct radio_event) bytes : the event itself
- // 4 bytes : metadata size or 0
- // N bytes : metadata if present
- struct radio_event *event = (struct radio_event *)eventMemory->pointer();
- uint32_t metadataOffset = sizeof(struct radio_event) + sizeof(uint32_t);
- uint32_t metadataSize = *(uint32_t *)((uint8_t *)event + metadataOffset - sizeof(uint32_t));
-
- // restore local metadata pointer from offset
- switch (event->type) {
- case RADIO_EVENT_TUNED:
- case RADIO_EVENT_AF_SWITCH:
- if (metadataSize != 0) {
- event->info.metadata =
- (radio_metadata_t *)((uint8_t *)event + metadataOffset);
- } else {
- event->info.metadata = 0;
- }
- break;
- case RADIO_EVENT_METADATA:
- if (metadataSize != 0) {
- event->metadata =
- (radio_metadata_t *)((uint8_t *)event + metadataOffset);
- } else {
- event->metadata = 0;
- }
- break;
- default:
- break;
- }
-
- if (mCallback != 0) {
- mCallback->onEvent(event);
- }
-}
-
-
-//IBinder::DeathRecipient
-void Radio::binderDied(const wp<IBinder>& who __unused) {
- Mutex::Autolock _l(mLock);
- ALOGW("Radio server binder Died ");
- mIRadio = 0;
- struct radio_event event;
- memset(&event, 0, sizeof(struct radio_event));
- event.type = RADIO_EVENT_SERVER_DIED;
- event.status = DEAD_OBJECT;
- if (mCallback != 0) {
- mCallback->onEvent(&event);
- }
-}
-
-}; // namespace android
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 0df9a39..fbc17c8 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -39,8 +39,8 @@
#include <memunreachable/memunreachable.h>
#include <utils/String16.h>
#include <utils/threads.h>
-#include <utils/Atomic.h>
+#include <cutils/atomic.h>
#include <cutils/properties.h>
#include <system/audio.h>
@@ -326,9 +326,14 @@
sp<MmapThread> thread = mMmapThreads.valueFor(io);
if (thread != 0) {
interface = new MmapThreadHandle(thread);
- thread->configure(attr, streamType, sessionId, callback, portId);
+ thread->configure(attr, streamType, sessionId, callback, *deviceId, portId);
*handle = portId;
} else {
+ if (direction == MmapStreamInterface::DIRECTION_OUTPUT) {
+ AudioSystem::releaseOutput(io, streamType, sessionId);
+ } else {
+ AudioSystem::releaseInput(io, sessionId);
+ }
ret = NO_INIT;
}
@@ -1397,11 +1402,11 @@
// the config change is always sent from playback or record threads to avoid deadlock
// with AudioSystem::gLock
for (size_t i = 0; i < mPlaybackThreads.size(); i++) {
- mPlaybackThreads.valueAt(i)->sendIoConfigEvent(AUDIO_OUTPUT_OPENED, pid);
+ mPlaybackThreads.valueAt(i)->sendIoConfigEvent(AUDIO_OUTPUT_REGISTERED, pid);
}
for (size_t i = 0; i < mRecordThreads.size(); i++) {
- mRecordThreads.valueAt(i)->sendIoConfigEvent(AUDIO_INPUT_OPENED, pid);
+ mRecordThreads.valueAt(i)->sendIoConfigEvent(AUDIO_INPUT_REGISTERED, pid);
}
}
@@ -2564,6 +2569,7 @@
for (size_t i = 0; i < mPlaybackThreads.size(); i++) {
sp<PlaybackThread> t = mPlaybackThreads.valueAt(i);
+ Mutex::Autolock _l(t->mLock);
for (size_t j = 0; j < t->mEffectChains.size(); j++) {
sp<EffectChain> ec = t->mEffectChains[j];
if (ec->sessionId() > AUDIO_SESSION_OUTPUT_MIX) {
@@ -2573,6 +2579,7 @@
}
for (size_t i = 0; i < mRecordThreads.size(); i++) {
sp<RecordThread> t = mRecordThreads.valueAt(i);
+ Mutex::Autolock _l(t->mLock);
for (size_t j = 0; j < t->mEffectChains.size(); j++) {
sp<EffectChain> ec = t->mEffectChains[j];
chains.push(ec);
@@ -2603,7 +2610,7 @@
while (ec->mEffects.size()) {
sp<EffectModule> effect = ec->mEffects[0];
effect->unPin();
- t->removeEffect_l(effect);
+ t->removeEffect_l(effect, /*release*/ true);
if (effect->purgeHandles()) {
t->checkSuspendOnEffectEnabled_l(effect, false, effect->sessionId());
}
@@ -3034,16 +3041,21 @@
bool pinned = (sessionId > AUDIO_SESSION_OUTPUT_MIX) && isSessionAcquired_l(sessionId);
handle = thread->createEffect_l(client, effectClient, priority, sessionId,
&desc, enabled, &lStatus, pinned);
- if (handle != 0 && id != NULL) {
- *id = handle->id();
- }
- if (handle == 0) {
+ if (lStatus != NO_ERROR && lStatus != ALREADY_EXISTS) {
// remove local strong reference to Client with mClientLock held
Mutex::Autolock _cl(mClientLock);
client.clear();
+ } else {
+ // handle must be valid here, but check again to be safe.
+ if (handle.get() != nullptr && id != nullptr) *id = handle->id();
}
}
+ if (lStatus != NO_ERROR && lStatus != ALREADY_EXISTS) {
+ // handle must be cleared outside lock.
+ handle.clear();
+ }
+
Exit:
*status = lStatus;
return handle;
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 9023b2d..c64752f 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -27,6 +27,7 @@
#include <android-base/macros.h>
+#include <cutils/atomic.h>
#include <cutils/compiler.h>
#include <cutils/properties.h>
@@ -39,7 +40,6 @@
#include <media/MmapStreamInterface.h>
#include <media/MmapStreamCallback.h>
-#include <utils/Atomic.h>
#include <utils/Errors.h>
#include <utils/threads.h>
#include <utils/SortedVector.h>
@@ -604,7 +604,7 @@
virtual status_t standby();
private:
- sp<MmapThread> mThread;
+ const sp<MmapThread> mThread;
};
ThreadBase *checkThread_l(audio_io_handle_t ioHandle) const;
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp
index f2c1c4f..bd5f146 100644
--- a/services/audioflinger/Effects.cpp
+++ b/services/audioflinger/Effects.cpp
@@ -25,6 +25,7 @@
#include <system/audio_effects/effect_ns.h>
#include <system/audio_effects/effect_visualizer.h>
#include <audio_utils/primitives.h>
+#include <media/AudioEffect.h>
#include <media/audiohal/EffectHalInterface.h>
#include <media/audiohal/EffectsFactoryHalInterface.h>
@@ -109,7 +110,10 @@
{
ALOGV("Destructor %p", this);
if (mEffectInterface != 0) {
- ALOGW("EffectModule %p destructor called with unreleased interface", this);
+ char uuidStr[64];
+ AudioEffect::guidToString(&mDescriptor.uuid, uuidStr, sizeof(uuidStr));
+ ALOGW("EffectModule %p destructor called with unreleased interface, effect %s",
+ this, uuidStr);
release_l();
}
@@ -1081,18 +1085,12 @@
result.append(buffer);
result.append("\t\tDescriptor:\n");
- snprintf(buffer, SIZE, "\t\t- UUID: %08X-%04X-%04X-%04X-%02X%02X%02X%02X%02X%02X\n",
- mDescriptor.uuid.timeLow, mDescriptor.uuid.timeMid, mDescriptor.uuid.timeHiAndVersion,
- mDescriptor.uuid.clockSeq, mDescriptor.uuid.node[0], mDescriptor.uuid.node[1],
- mDescriptor.uuid.node[2],
- mDescriptor.uuid.node[3],mDescriptor.uuid.node[4],mDescriptor.uuid.node[5]);
+ char uuidStr[64];
+ AudioEffect::guidToString(&mDescriptor.uuid, uuidStr, sizeof(uuidStr));
+ snprintf(buffer, SIZE, "\t\t- UUID: %s\n", uuidStr);
result.append(buffer);
- snprintf(buffer, SIZE, "\t\t- TYPE: %08X-%04X-%04X-%04X-%02X%02X%02X%02X%02X%02X\n",
- mDescriptor.type.timeLow, mDescriptor.type.timeMid,
- mDescriptor.type.timeHiAndVersion,
- mDescriptor.type.clockSeq, mDescriptor.type.node[0], mDescriptor.type.node[1],
- mDescriptor.type.node[2],
- mDescriptor.type.node[3],mDescriptor.type.node[4],mDescriptor.type.node[5]);
+ AudioEffect::guidToString(&mDescriptor.type, uuidStr, sizeof(uuidStr));
+ snprintf(buffer, SIZE, "\t\t- TYPE: %s\n", uuidStr);
result.append(buffer);
snprintf(buffer, SIZE, "\t\t- apiVersion: %08X\n\t\t- flags: %08X (%s)\n",
mDescriptor.apiVersion,
@@ -1306,11 +1304,10 @@
if (thread != 0) {
thread->disconnectEffectHandle(this, unpinIfLast);
} else {
- ALOGW("%s Effect handle %p disconnected after thread destruction", __FUNCTION__, this);
// try to cleanup as much as we can
sp<EffectModule> effect = mEffect.promote();
- if (effect != 0) {
- effect->disconnectHandle(this, unpinIfLast);
+ if (effect != 0 && effect->disconnectHandle(this, unpinIfLast) > 0) {
+ ALOGW("%s Effect handle %p disconnected after thread destruction", __FUNCTION__, this);
}
}
diff --git a/services/audioflinger/FastMixer.cpp b/services/audioflinger/FastMixer.cpp
index c4f1af3..c10fa05 100644
--- a/services/audioflinger/FastMixer.cpp
+++ b/services/audioflinger/FastMixer.cpp
@@ -138,7 +138,8 @@
void FastMixer::onStateChange()
{
- LOG_HIST_FLUSH();
+ // log that audio was turned on/off
+ LOG_AUDIO_STATE();
const FastMixerState * const current = (const FastMixerState *) mCurrent;
const FastMixerState * const previous = (const FastMixerState *) mPrevious;
FastMixerDumpState * const dumpState = (FastMixerDumpState *) mDumpState;
diff --git a/services/audioflinger/FastMixerDumpState.cpp b/services/audioflinger/FastMixerDumpState.cpp
index 6475f22..2e4fb8c 100644
--- a/services/audioflinger/FastMixerDumpState.cpp
+++ b/services/audioflinger/FastMixerDumpState.cpp
@@ -78,7 +78,12 @@
uint32_t bounds = mBounds;
uint32_t newestOpen = bounds & 0xFFFF;
uint32_t oldestClosed = bounds >> 16;
- uint32_t n = (newestOpen - oldestClosed) & 0xFFFF;
+
+ //uint32_t n = (newestOpen - oldestClosed) & 0xFFFF;
+ uint32_t n;
+ __builtin_sub_overflow(newestOpen, oldestClosed, &n);
+ n = n & 0xFFFF;
+
if (n > mSamplingN) {
ALOGE("too many samples %u", n);
n = mSamplingN;
diff --git a/services/audioflinger/FastThread.cpp b/services/audioflinger/FastThread.cpp
index 85865b7..dc15487 100644
--- a/services/audioflinger/FastThread.cpp
+++ b/services/audioflinger/FastThread.cpp
@@ -297,7 +297,8 @@
size_t i = mBounds & (mDumpState->mSamplingN - 1);
mBounds = (mBounds & 0xFFFF0000) | ((mBounds + 1) & 0xFFFF);
if (mFull) {
- mBounds += 0x10000;
+ //mBounds += 0x10000;
+ __builtin_add_overflow(mBounds, 0x10000, &mBounds);
} else if (!(mBounds & (mDumpState->mSamplingN - 1))) {
mFull = true;
}
diff --git a/services/audioflinger/MmapTracks.h b/services/audioflinger/MmapTracks.h
index 2a27dfd..366a164 100644
--- a/services/audioflinger/MmapTracks.h
+++ b/services/audioflinger/MmapTracks.h
@@ -28,6 +28,7 @@
audio_channel_mask_t channelMask,
audio_session_t sessionId,
uid_t uid,
+ pid_t pid,
audio_port_handle_t portId = AUDIO_PORT_HANDLE_NONE);
virtual ~MmapTrack();
@@ -39,7 +40,7 @@
virtual bool isFastTrack() const { return false; }
static void appendDumpHeader(String8& result);
- void dump(char* buffer, size_t size);
+ void appendDump(String8& result, bool active);
private:
friend class MmapThread;
@@ -55,5 +56,6 @@
virtual int64_t framesReleased() const;
virtual void onTimestamp(const ExtendedTimestamp ×tamp);
+ pid_t mPid;
}; // end of Track
diff --git a/services/audioflinger/OWNERS b/services/audioflinger/OWNERS
new file mode 100644
index 0000000..703e4d2
--- /dev/null
+++ b/services/audioflinger/OWNERS
@@ -0,0 +1,3 @@
+hunga@google.com
+jmtrivi@google.com
+mnaganov@google.com
diff --git a/services/audioflinger/PatchPanel.cpp b/services/audioflinger/PatchPanel.cpp
index d7c0728..27c6d35 100644
--- a/services/audioflinger/PatchPanel.cpp
+++ b/services/audioflinger/PatchPanel.cpp
@@ -474,6 +474,7 @@
format,
frameCount,
NULL,
+ (size_t)0 /* bufferSize */,
AUDIO_INPUT_FLAG_NONE);
if (patch->mPatchRecord == 0) {
return NO_MEMORY;
@@ -494,6 +495,7 @@
format,
frameCount,
patch->mPatchRecord->buffer(),
+ patch->mPatchRecord->bufferSize(),
AUDIO_OUTPUT_FLAG_NONE);
if (patch->mPatchTrack == 0) {
return NO_MEMORY;
diff --git a/services/audioflinger/PlaybackTracks.h b/services/audioflinger/PlaybackTracks.h
index 3f1a0c0..1c1a989 100644
--- a/services/audioflinger/PlaybackTracks.h
+++ b/services/audioflinger/PlaybackTracks.h
@@ -30,6 +30,7 @@
audio_channel_mask_t channelMask,
size_t frameCount,
void *buffer,
+ size_t bufferSize,
const sp<IMemory>& sharedBuffer,
audio_session_t sessionId,
uid_t uid,
@@ -40,7 +41,7 @@
virtual status_t initCheck() const;
static void appendDumpHeader(String8& result);
- void dump(char* buffer, size_t size, bool active);
+ void appendDump(String8& result, bool active);
virtual status_t start(AudioSystem::sync_event_t event =
AudioSystem::SYNC_EVENT_NONE,
audio_session_t triggerSession = AUDIO_SESSION_NONE);
@@ -240,6 +241,7 @@
audio_format_t format,
size_t frameCount,
void *buffer,
+ size_t bufferSize,
audio_output_flags_t flags);
virtual ~PatchTrack();
diff --git a/services/audioflinger/RecordTracks.h b/services/audioflinger/RecordTracks.h
index 3f83ca8..f8da780 100644
--- a/services/audioflinger/RecordTracks.h
+++ b/services/audioflinger/RecordTracks.h
@@ -29,6 +29,7 @@
audio_channel_mask_t channelMask,
size_t frameCount,
void *buffer,
+ size_t bufferSize,
audio_session_t sessionId,
uid_t uid,
audio_input_flags_t flags,
@@ -50,7 +51,7 @@
return tmp; }
static void appendDumpHeader(String8& result);
- void dump(char* buffer, size_t size, bool active);
+ void appendDump(String8& result, bool active);
void handleSyncStartEvent(const sp<SyncEvent>& event);
void clearSyncStartEvent();
@@ -102,6 +103,7 @@
audio_format_t format,
size_t frameCount,
void *buffer,
+ size_t bufferSize,
audio_input_flags_t flags);
virtual ~PatchRecord();
diff --git a/services/audioflinger/ServiceUtilities.cpp b/services/audioflinger/ServiceUtilities.cpp
index 3c73543..c1044ef 100644
--- a/services/audioflinger/ServiceUtilities.cpp
+++ b/services/audioflinger/ServiceUtilities.cpp
@@ -113,10 +113,15 @@
return ok;
}
-bool captureHotwordAllowed() {
- static const String16 sCaptureHotwordAllowed("android.permission.CAPTURE_AUDIO_HOTWORD");
- // IMPORTANT: Use PermissionCache - not a runtime permission and may not change.
- bool ok = PermissionCache::checkCallingPermission(sCaptureHotwordAllowed);
+bool captureHotwordAllowed(pid_t pid, uid_t uid) {
+ // CAPTURE_AUDIO_HOTWORD permission implies RECORD_AUDIO permission
+ bool ok = recordingAllowed(String16(""), pid, uid);
+
+ if (ok) {
+ static const String16 sCaptureHotwordAllowed("android.permission.CAPTURE_AUDIO_HOTWORD");
+ // IMPORTANT: Use PermissionCache - not a runtime permission and may not change.
+ ok = PermissionCache::checkCallingPermission(sCaptureHotwordAllowed);
+ }
if (!ok) ALOGE("android.permission.CAPTURE_AUDIO_HOTWORD");
return ok;
}
diff --git a/services/audioflinger/ServiceUtilities.h b/services/audioflinger/ServiceUtilities.h
index 8b1bc00..04cb9cd 100644
--- a/services/audioflinger/ServiceUtilities.h
+++ b/services/audioflinger/ServiceUtilities.h
@@ -22,7 +22,7 @@
bool isTrustedCallingUid(uid_t uid);
bool recordingAllowed(const String16& opPackageName, pid_t pid, uid_t uid);
bool captureAudioOutputAllowed(pid_t pid, uid_t uid);
-bool captureHotwordAllowed();
+bool captureHotwordAllowed(pid_t pid, uid_t uid);
bool settingsAllowed();
bool modifyAudioRoutingAllowed();
bool dumpAllowed();
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 4b8e542..e78445e 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -1354,7 +1354,7 @@
if (chainCreated) {
removeEffectChain_l(chain);
}
- handle.clear();
+ // handle must be cleared by caller to avoid deadlock.
}
*status = lStatus;
@@ -1544,6 +1544,7 @@
ALOGW("ActiveTracks<T>::add track %p already there", track.get());
return index;
}
+ logTrack("add", track);
mActiveTracksGeneration++;
mLatestActiveTrack = track;
++mBatteryCounter[track->uid()].second;
@@ -1557,6 +1558,7 @@
ALOGW("ActiveTracks<T>::remove nonexistent track %p", track.get());
return index;
}
+ logTrack("remove", track);
mActiveTracksGeneration++;
--mBatteryCounter[track->uid()].second;
// mLatestActiveTrack is not cleared even if is the same as track.
@@ -1567,6 +1569,7 @@
void AudioFlinger::ThreadBase::ActiveTracks<T>::clear() {
for (const sp<T> &track : mActiveTracks) {
BatteryNotifier::getInstance().noteStopAudio(track->uid());
+ logTrack("clear", track);
}
mLastActiveTracksGeneration = mActiveTracksGeneration;
mActiveTracks.clear();
@@ -1605,6 +1608,16 @@
}
}
+template <typename T>
+void AudioFlinger::ThreadBase::ActiveTracks<T>::logTrack(
+ const char *funcName, const sp<T> &track) const {
+ if (mLocalLog != nullptr) {
+ String8 result;
+ track->appendDump(result, false /* active */);
+ mLocalLog->log("AT::%-10s(%p) %s", funcName, track.get(), result.string());
+ }
+}
+
void AudioFlinger::ThreadBase::broadcast_l()
{
// Thread could be blocked waiting for async
@@ -1640,6 +1653,7 @@
mSuspended(0), mBytesWritten(0),
mFramesWritten(0),
mSuspendedFrames(0),
+ mActiveTracks(&this->mLocalLog),
// mStreamTypes[] initialized in constructor body
mOutput(output),
mLastWriteTime(-1), mNumWrites(0), mNumDelayedWrites(0), mInWrite(false),
@@ -1654,7 +1668,8 @@
mScreenState(AudioFlinger::mScreenState),
// index 0 is reserved for normal mixer's submix
mFastTrackAvailMask(((1 << FastMixerState::sMaxFastTracks) - 1) & ~1),
- mHwSupportsPause(false), mHwPaused(false), mFlushPending(false)
+ mHwSupportsPause(false), mHwPaused(false), mFlushPending(false),
+ mLeftVolFloat(-1.0), mRightVolFloat(-1.0)
{
snprintf(mThreadName, kThreadNameLength, "AudioOut_%X", id);
mNBLogWriter = audioFlinger->newWriter_l(kLogSize, mThreadName);
@@ -1707,8 +1722,6 @@
void AudioFlinger::PlaybackThread::dumpTracks(int fd, const Vector<String16>& args __unused)
{
- const size_t SIZE = 256;
- char buffer[SIZE];
String8 result;
result.appendFormat(" Stream volumes in dB: ");
@@ -1735,8 +1748,10 @@
size_t numactive = mActiveTracks.size();
dprintf(fd, " %zu Tracks", numtracks);
size_t numactiveseen = 0;
+ const char *prefix = " ";
if (numtracks) {
dprintf(fd, " of which %zu are active\n", numactive);
+ result.append(prefix);
Track::appendDumpHeader(result);
for (size_t i = 0; i < numtracks; ++i) {
sp<Track> track = mTracks[i];
@@ -1745,8 +1760,8 @@
if (active) {
numactiveseen++;
}
- track->dump(buffer, SIZE, active);
- result.append(buffer);
+ result.append(prefix);
+ track->appendDump(result, active);
}
}
} else {
@@ -1754,15 +1769,15 @@
}
if (numactiveseen != numactive) {
// some tracks in the active list were not in the tracks list
- snprintf(buffer, SIZE, " The following tracks are in the active list but"
+ result.append(" The following tracks are in the active list but"
" not in the track list\n");
- result.append(buffer);
+ result.append(prefix);
Track::appendDumpHeader(result);
for (size_t i = 0; i < numactive; ++i) {
sp<Track> track = mActiveTracks[i];
if (mTracks.indexOf(track) < 0) {
- track->dump(buffer, SIZE, true);
- result.append(buffer);
+ result.append(prefix);
+ track->appendDump(result, true /* active */);
}
}
}
@@ -2013,7 +2028,8 @@
}
track = new Track(this, client, streamType, sampleRate, format,
- channelMask, frameCount, NULL, sharedBuffer,
+ channelMask, frameCount,
+ nullptr /* buffer */, (size_t)0 /* bufferSize */, sharedBuffer,
sessionId, uid, *flags, TrackBase::TYPE_DEFAULT, portId);
lStatus = track != 0 ? track->initCheck() : (status_t) NO_MEMORY;
@@ -2172,10 +2188,6 @@
chain->incActiveTrackCnt();
}
- char buffer[256];
- track->dump(buffer, arraysize(buffer), false /* active */);
- mLocalLog.log("addTrack_l (%p) %s", track.get(), buffer + 4); // log for analysis
-
status = NO_ERROR;
}
@@ -2202,9 +2214,9 @@
{
track->triggerEvents(AudioSystem::SYNC_EVENT_PRESENTATION_COMPLETE);
- char buffer[256];
- track->dump(buffer, arraysize(buffer), false /* active */);
- mLocalLog.log("removeTrack_l (%p) %s", track.get(), buffer + 4); // log for analysis
+ String8 result;
+ track->appendDump(result, false /* active */);
+ mLocalLog.log("removeTrack_l (%p) %s", track.get(), result.string());
mTracks.remove(track);
deleteTrackName_l(track->name());
@@ -2242,6 +2254,7 @@
switch (event) {
case AUDIO_OUTPUT_OPENED:
+ case AUDIO_OUTPUT_REGISTERED:
case AUDIO_OUTPUT_CONFIG_CHANGED:
desc->mPatch = mPatch;
desc->mChannelMask = mChannelMask;
@@ -3294,10 +3307,14 @@
// 2. threadLoop_mix (significant for heavy mixing, especially
// on low tier processors)
- // it's OK if deltaMs is an overestimate.
- const int32_t deltaMs =
- (lastWriteFinished - previousLastWriteFinished) / 1000000;
- const int32_t throttleMs = mHalfBufferMs - deltaMs;
+ // it's OK if deltaMs (and deltaNs) is an overestimate.
+ nsecs_t deltaNs;
+ // deltaNs = lastWriteFinished - previousLastWriteFinished;
+ __builtin_sub_overflow(
+ lastWriteFinished,previousLastWriteFinished, &deltaNs);
+ const int32_t deltaMs = deltaNs / 1000000;
+
+ const int32_t throttleMs = (int32_t)mHalfBufferMs - deltaMs;
if ((signed)mHalfBufferMs >= throttleMs && throttleMs > 0) {
usleep(throttleMs * 1000);
// notify of throttle start on verbose log
@@ -3404,10 +3421,6 @@
}
if (track->isTerminated()) {
removeTrack_l(track);
- } else { // inactive but not terminated
- char buffer[256];
- track->dump(buffer, arraysize(buffer), false /* active */);
- mLocalLog.log("removeTracks_l(%p) %s", track.get(), buffer + 4);
}
}
}
@@ -4287,6 +4300,7 @@
param = AudioMixer::RAMP_VOLUME;
}
mAudioMixer->setParameter(name, AudioMixer::RESAMPLE, AudioMixer::RESET, NULL);
+ mLeftVolFloat = -1.0;
// FIXME should not make a decision based on mServer
} else if (cblk->mServer != 0) {
// If the track is stopped before the first frame was mixed,
@@ -4297,6 +4311,10 @@
// compute volume for this track
uint32_t vl, vr; // in U8.24 integer format
float vlf, vrf, vaf; // in [0.0, 1.0] float format
+ // read original volumes with volume control
+ float typeVolume = mStreamTypes[track->streamType()].volume;
+ float v = masterVolume * typeVolume;
+
if (track->isPausing() || mStreamTypes[track->streamType()].mute) {
vl = vr = 0;
vlf = vrf = vaf = 0.;
@@ -4304,10 +4322,6 @@
track->setPaused();
}
} else {
-
- // read original volumes with volume control
- float typeVolume = mStreamTypes[track->streamType()].volume;
- float v = masterVolume * typeVolume;
sp<AudioTrackServerProxy> proxy = track->mAudioTrackServerProxy;
gain_minifloat_packed_t vlr = proxy->getVolumeLR();
vlf = float_from_gain(gain_minifloat_unpack_left(vlr));
@@ -4359,6 +4373,25 @@
track->mHasVolumeController = false;
}
+ // For dedicated VoIP outputs, let the HAL apply the stream volume. Track volume is
+ // still applied by the mixer.
+ if ((mOutput->flags & AUDIO_OUTPUT_FLAG_VOIP_RX) != 0) {
+ v = mStreamTypes[track->streamType()].mute ? 0.0f : v;
+ if (v != mLeftVolFloat) {
+ status_t result = mOutput->stream->setVolume(v, v);
+ ALOGE_IF(result != OK, "Error when setting output stream volume: %d", result);
+ if (result == OK) {
+ mLeftVolFloat = v;
+ }
+ }
+ // if stream volume was successfully sent to the HAL, mLeftVolFloat == v here and we
+ // remove stream volume contribution from software volume.
+ if (v != 0.0f && mLeftVolFloat == v) {
+ vlf = min(1.0f, vlf / v);
+ vrf = min(1.0f, vrf / v);
+ vaf = min(1.0f, vaf / v);
+ }
+ }
// XXX: these things DON'T need to be done each time
mAudioMixer->setBufferProvider(name, track);
mAudioMixer->enable(name);
@@ -4800,7 +4833,6 @@
AudioFlinger::DirectOutputThread::DirectOutputThread(const sp<AudioFlinger>& audioFlinger,
AudioStreamOut* output, audio_io_handle_t id, audio_devices_t device, bool systemReady)
: PlaybackThread(audioFlinger, output, id, device, DIRECT, systemReady)
- // mLeftVolFloat, mRightVolFloat
{
}
@@ -4808,7 +4840,6 @@
AudioStreamOut* output, audio_io_handle_t id, uint32_t device,
ThreadBase::type_t type, bool systemReady)
: PlaybackThread(audioFlinger, output, id, device, type, systemReady)
- // mLeftVolFloat, mRightVolFloat
, mVolumeShaperActive(false)
{
}
@@ -5925,7 +5956,9 @@
#endif
) :
ThreadBase(audioFlinger, id, outDevice, inDevice, RECORD, systemReady),
- mInput(input), mRsmpInBuffer(NULL),
+ mInput(input),
+ mActiveTracks(&this->mLocalLog),
+ mRsmpInBuffer(NULL),
// mRsmpInFrames, mRsmpInFramesP2, and mRsmpInFramesOA are set by readInputParameters_l()
mRsmpInRear(0)
#ifdef TEE_SINK
@@ -6696,7 +6729,8 @@
Mutex::Autolock _l(mLock);
track = new RecordTrack(this, client, sampleRate,
- format, channelMask, frameCount, NULL, sessionId, uid,
+ format, channelMask, frameCount,
+ nullptr /* buffer */, (size_t)0 /* bufferSize */, sessionId, uid,
*flags, TrackBase::TYPE_DEFAULT, portId);
lStatus = track->initCheck();
@@ -6744,7 +6778,7 @@
recordTrack->clearSyncStartEvent();
} else {
// do not wait for the event for more than AudioSystem::kSyncRecordStartTimeOutMs
- recordTrack->mFramesToDrop = -
+ recordTrack->mFramesToDrop = -(ssize_t)
((AudioSystem::kSyncRecordStartTimeOutMs * recordTrack->mSampleRate) / 1000);
}
}
@@ -6888,6 +6922,10 @@
void AudioFlinger::RecordThread::removeTrack_l(const sp<RecordTrack>& track)
{
+ String8 result;
+ track->appendDump(result, false /* active */);
+ mLocalLog.log("removeTrack_l (%p) %s", track.get(), result.string());
+
mTracks.remove(track);
// need anything related to effects here?
if (track->isFastTrack()) {
@@ -6901,6 +6939,8 @@
dumpInternals(fd, args);
dumpTracks(fd, args);
dumpEffectChains(fd, args);
+ dprintf(fd, " Local log:\n");
+ mLocalLog.dump(fd, " " /* prefix */, 40 /* lines */);
}
void AudioFlinger::RecordThread::dumpInternals(int fd, const Vector<String16>& args)
@@ -6914,6 +6954,12 @@
if (mActiveTracks.size() == 0) {
dprintf(fd, " No active record clients\n");
}
+
+ if (input != nullptr) {
+ dprintf(fd, " Hal stream dump:\n");
+ (void)input->stream->dump(fd);
+ }
+
dprintf(fd, " Fast capture thread: %s\n", hasFastCapture() ? "yes" : "no");
dprintf(fd, " Fast track available: %s\n", mFastTrackAvail ? "yes" : "no");
@@ -6928,16 +6974,15 @@
void AudioFlinger::RecordThread::dumpTracks(int fd, const Vector<String16>& args __unused)
{
- const size_t SIZE = 256;
- char buffer[SIZE];
String8 result;
-
size_t numtracks = mTracks.size();
size_t numactive = mActiveTracks.size();
size_t numactiveseen = 0;
dprintf(fd, " %zu Tracks", numtracks);
+ const char *prefix = " ";
if (numtracks) {
dprintf(fd, " of which %zu are active\n", numactive);
+ result.append(prefix);
RecordTrack::appendDumpHeader(result);
for (size_t i = 0; i < numtracks ; ++i) {
sp<RecordTrack> track = mTracks[i];
@@ -6946,8 +6991,8 @@
if (active) {
numactiveseen++;
}
- track->dump(buffer, SIZE, active);
- result.append(buffer);
+ result.append(prefix);
+ track->appendDump(result, active);
}
}
} else {
@@ -6955,15 +7000,15 @@
}
if (numactiveseen != numactive) {
- snprintf(buffer, SIZE, " The following tracks are in the active list but"
+ result.append(" The following tracks are in the active list but"
" not in the track list\n");
- result.append(buffer);
+ result.append(prefix);
RecordTrack::appendDumpHeader(result);
for (size_t i = 0; i < numactive; ++i) {
sp<RecordTrack> track = mActiveTracks[i];
if (mTracks.indexOf(track) < 0) {
- track->dump(buffer, SIZE, true);
- result.append(buffer);
+ result.append(prefix);
+ track->appendDump(result, true /* active */);
}
}
@@ -7221,6 +7266,7 @@
switch (event) {
case AUDIO_INPUT_OPENED:
+ case AUDIO_INPUT_REGISTERED:
case AUDIO_INPUT_CONFIG_CHANGED:
desc->mPatch = mPatch;
desc->mChannelMask = mChannelMask;
@@ -7482,34 +7528,22 @@
AudioFlinger::MmapThreadHandle::MmapThreadHandle(const sp<MmapThread>& thread)
: mThread(thread)
{
+ assert(thread != 0); // thread must start non-null and stay non-null
}
AudioFlinger::MmapThreadHandle::~MmapThreadHandle()
{
- MmapThread *thread = mThread.get();
- // clear our strong reference before disconnecting the thread: the last strong reference
- // will be removed when closeInput/closeOutput is executed upon call from audio policy manager
- // and the thread removed from mMMapThreads list causing the thread destruction.
- mThread.clear();
- if (thread != nullptr) {
- thread->disconnect();
- }
+ mThread->disconnect();
}
status_t AudioFlinger::MmapThreadHandle::createMmapBuffer(int32_t minSizeFrames,
struct audio_mmap_buffer_info *info)
{
- if (mThread == 0) {
- return NO_INIT;
- }
return mThread->createMmapBuffer(minSizeFrames, info);
}
status_t AudioFlinger::MmapThreadHandle::getMmapPosition(struct audio_mmap_position *position)
{
- if (mThread == 0) {
- return NO_INIT;
- }
return mThread->getMmapPosition(position);
}
@@ -7517,25 +7551,16 @@
audio_port_handle_t *handle)
{
- if (mThread == 0) {
- return NO_INIT;
- }
return mThread->start(client, handle);
}
status_t AudioFlinger::MmapThreadHandle::stop(audio_port_handle_t handle)
{
- if (mThread == 0) {
- return NO_INIT;
- }
return mThread->stop(handle);
}
status_t AudioFlinger::MmapThreadHandle::standby()
{
- if (mThread == 0) {
- return NO_INIT;
- }
return mThread->standby();
}
@@ -7545,7 +7570,10 @@
AudioHwDevice *hwDev, sp<StreamHalInterface> stream,
audio_devices_t outDevice, audio_devices_t inDevice, bool systemReady)
: ThreadBase(audioFlinger, id, outDevice, inDevice, MMAP, systemReady),
- mHalStream(stream), mHalDevice(hwDev->hwDevice()), mAudioHwDev(hwDev)
+ mSessionId(AUDIO_SESSION_NONE),
+ mDeviceId(AUDIO_PORT_HANDLE_NONE), mPortId(AUDIO_PORT_HANDLE_NONE),
+ mHalStream(stream), mHalDevice(hwDev->hwDevice()), mAudioHwDev(hwDev),
+ mActiveTracks(&this->mLocalLog)
{
mStandby = true;
readHalParameters_l();
@@ -7566,7 +7594,7 @@
for (const sp<MmapTrack> &t : mActiveTracks) {
stop(t->portId());
}
- // this will cause the destruction of this thread.
+ // This will decrement references and may cause the destruction of this thread.
if (isOutput()) {
AudioSystem::releaseOutput(mId, streamType(), mSessionId);
} else {
@@ -7579,11 +7607,13 @@
audio_stream_type_t streamType __unused,
audio_session_t sessionId,
const sp<MmapStreamCallback>& callback,
+ audio_port_handle_t deviceId,
audio_port_handle_t portId)
{
mAttr = *attr;
mSessionId = sessionId;
mCallback = callback;
+ mDeviceId = deviceId;
mPortId = portId;
}
@@ -7628,6 +7658,10 @@
return NO_ERROR;
}
+ if (!isOutput() && !recordingAllowed(client.packageName, client.clientPid, client.clientUid)) {
+ return PERMISSION_DENIED;
+ }
+
audio_port_handle_t portId = AUDIO_PORT_HANDLE_NONE;
audio_io_handle_t io = mId;
@@ -7639,7 +7673,7 @@
audio_stream_type_t stream = streamType();
audio_output_flags_t flags =
(audio_output_flags_t)(AUDIO_OUTPUT_FLAG_MMAP_NOIRQ | AUDIO_OUTPUT_FLAG_DIRECT);
- audio_port_handle_t deviceId = AUDIO_PORT_HANDLE_NONE;
+ audio_port_handle_t deviceId = mDeviceId;
ret = AudioSystem::getOutputForAttr(&mAttr, &io,
mSessionId,
&stream,
@@ -7653,7 +7687,7 @@
config.sample_rate = mSampleRate;
config.channel_mask = mChannelMask;
config.format = mFormat;
- audio_port_handle_t deviceId = AUDIO_PORT_HANDLE_NONE;
+ audio_port_handle_t deviceId = mDeviceId;
ret = AudioSystem::getInputForAttr(&mAttr, &io,
mSessionId,
client.clientPid,
@@ -7693,7 +7727,7 @@
}
sp<MmapTrack> track = new MmapTrack(this, mSampleRate, mFormat, mChannelMask, mSessionId,
- client.clientUid, portId);
+ client.clientUid, client.clientPid, portId);
mActiveTracks.add(track);
sp<EffectChain> chain = getEffectChain_l(mSessionId);
@@ -7904,8 +7938,10 @@
switch (event) {
case AUDIO_INPUT_OPENED:
+ case AUDIO_INPUT_REGISTERED:
case AUDIO_INPUT_CONFIG_CHANGED:
case AUDIO_OUTPUT_OPENED:
+ case AUDIO_OUTPUT_REGISTERED:
case AUDIO_OUTPUT_CONFIG_CHANGED:
desc->mPatch = mPatch;
desc->mChannelMask = mChannelMask;
@@ -7990,17 +8026,19 @@
mPrevOutDevice = type;
sendIoConfigEvent_l(AUDIO_OUTPUT_CONFIG_CHANGED);
sp<MmapStreamCallback> callback = mCallback.promote();
- if (callback != 0) {
+ if (mDeviceId != deviceId && callback != 0) {
callback->onRoutingChanged(deviceId);
}
+ mDeviceId = deviceId;
}
if (!isOutput() && mPrevInDevice != mInDevice) {
mPrevInDevice = type;
sendIoConfigEvent_l(AUDIO_INPUT_CONFIG_CHANGED);
sp<MmapStreamCallback> callback = mCallback.promote();
- if (callback != 0) {
+ if (mDeviceId != deviceId && callback != 0) {
callback->onRoutingChanged(deviceId);
}
+ mDeviceId = deviceId;
}
return status;
}
@@ -8114,10 +8152,8 @@
void AudioFlinger::MmapThread::threadLoop_exit()
{
- sp<MmapStreamCallback> callback = mCallback.promote();
- if (callback != 0) {
- callback->onTearDown();
- }
+ // Do not call callback->onTearDown() because it is redundant for thread exit
+ // and because it can cause a recursive mutex lock on stop().
}
status_t AudioFlinger::MmapThread::setSyncEvent(const sp<SyncEvent>& event __unused)
@@ -8178,6 +8214,8 @@
dumpInternals(fd, args);
dumpTracks(fd, args);
dumpEffectChains(fd, args);
+ dprintf(fd, " Local log:\n");
+ mLocalLog.dump(fd, " " /* prefix */, 40 /* lines */);
}
void AudioFlinger::MmapThread::dumpInternals(int fd, const Vector<String16>& args)
@@ -8194,18 +8232,17 @@
void AudioFlinger::MmapThread::dumpTracks(int fd, const Vector<String16>& args __unused)
{
- const size_t SIZE = 256;
- char buffer[SIZE];
String8 result;
-
size_t numtracks = mActiveTracks.size();
- dprintf(fd, " %zu Tracks", numtracks);
+ dprintf(fd, " %zu Tracks\n", numtracks);
+ const char *prefix = " ";
if (numtracks) {
+ result.append(prefix);
MmapTrack::appendDumpHeader(result);
for (size_t i = 0; i < numtracks ; ++i) {
sp<MmapTrack> track = mActiveTracks[i];
- track->dump(buffer, SIZE);
- result.append(buffer);
+ result.append(prefix);
+ track->appendDump(result, true /* active */);
}
} else {
dprintf(fd, "\n");
@@ -8240,9 +8277,10 @@
audio_stream_type_t streamType,
audio_session_t sessionId,
const sp<MmapStreamCallback>& callback,
+ audio_port_handle_t deviceId,
audio_port_handle_t portId)
{
- MmapThread::configure(attr, streamType, sessionId, callback, portId);
+ MmapThread::configure(attr, streamType, sessionId, callback, deviceId, portId);
mStreamType = streamType;
}
diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h
index 062bad6..dd2b89b 100644
--- a/services/audioflinger/Threads.h
+++ b/services/audioflinger/Threads.h
@@ -508,9 +508,10 @@
template <typename T>
class ActiveTracks {
public:
- ActiveTracks()
+ explicit ActiveTracks(SimpleLog *localLog = nullptr)
: mActiveTracksGeneration(0)
, mLastActiveTracksGeneration(0)
+ , mLocalLog(localLog)
{ }
~ActiveTracks() {
@@ -562,6 +563,8 @@
void updatePowerState(sp<ThreadBase> thread, bool force = false);
private:
+ void logTrack(const char *funcName, const sp<T> &track) const;
+
SortedVector<uid_t> getWakeLockUids() {
SortedVector<uid_t> wakeLockUids;
for (const sp<T> &track : mActiveTracks) {
@@ -576,6 +579,7 @@
int mActiveTracksGeneration;
int mLastActiveTracksGeneration;
wp<T> mLatestActiveTrack; // latest track added to ActiveTracks
+ SimpleLog * const mLocalLog;
};
SimpleLog mLocalLog;
@@ -995,6 +999,9 @@
bool mHwSupportsPause;
bool mHwPaused;
bool mFlushPending;
+ // volumes last sent to audio HAL with stream->setVolume()
+ float mLeftVolFloat;
+ float mRightVolFloat;
};
class MixerThread : public PlaybackThread {
@@ -1112,9 +1119,6 @@
virtual void onAddNewTrack_l();
- // volumes last sent to audio HAL with stream->set_volume()
- float mLeftVolFloat;
- float mRightVolFloat;
bool mVolumeShaperActive;
DirectOutputThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output,
@@ -1475,6 +1479,7 @@
audio_stream_type_t streamType,
audio_session_t sessionId,
const sp<MmapStreamCallback>& callback,
+ audio_port_handle_t deviceId,
audio_port_handle_t portId);
void disconnect();
@@ -1536,6 +1541,7 @@
audio_attributes_t mAttr;
audio_session_t mSessionId;
+ audio_port_handle_t mDeviceId;
audio_port_handle_t mPortId;
wp<MmapStreamCallback> mCallback;
@@ -1558,6 +1564,7 @@
audio_stream_type_t streamType,
audio_session_t sessionId,
const sp<MmapStreamCallback>& callback,
+ audio_port_handle_t deviceId,
audio_port_handle_t portId);
AudioStreamOut* clearOutput();
diff --git a/services/audioflinger/TrackBase.h b/services/audioflinger/TrackBase.h
index cb540ca..d4ce0b4 100644
--- a/services/audioflinger/TrackBase.h
+++ b/services/audioflinger/TrackBase.h
@@ -61,6 +61,7 @@
audio_channel_mask_t channelMask,
size_t frameCount,
void *buffer,
+ size_t bufferSize,
audio_session_t sessionId,
uid_t uid,
bool isOut,
@@ -82,6 +83,7 @@
sp<IMemory> getBuffers() const { return mBufferMemory; }
void* buffer() const { return mBuffer; }
+ size_t bufferSize() const { return mBufferSize; }
virtual bool isFastTrack() const = 0;
bool isOutputTrack() const { return (mType == TYPE_OUTPUT); }
bool isPatchTrack() const { return (mType == TYPE_PATCH); }
@@ -133,6 +135,40 @@
mTerminated = true;
}
+ // Upper case characters are final states.
+ // Lower case characters are transitory.
+ const char *getTrackStateString() const {
+ if (isTerminated()) {
+ return "T ";
+ }
+ switch (mState) {
+ case IDLE:
+ return "I ";
+ case STOPPING_1: // for Fast and Offload
+ return "s1";
+ case STOPPING_2: // for Fast and Offload
+ return "s2";
+ case STOPPED:
+ return "S ";
+ case RESUMING:
+ return "r ";
+ case ACTIVE:
+ return "A ";
+ case PAUSING:
+ return "p ";
+ case PAUSED:
+ return "P ";
+ case FLUSHED:
+ return "F ";
+ case STARTING_1: // for RecordTrack
+ return "r1";
+ case STARTING_2: // for RecordTrack
+ return "r2";
+ default:
+ return "? ";
+ }
+ }
+
bool isOut() const { return mIsOut; }
// true for Track, false for RecordTrack,
// this could be a track type if needed later
@@ -144,6 +180,7 @@
sp<IMemory> mBufferMemory; // currently non-0 for fast RecordTrack only
void* mBuffer; // start of track buffer, typically in shared memory
// except for OutputTrack when it is in local memory
+ size_t mBufferSize; // size of mBuffer in bytes
// we don't really need a lock for these
track_state mState;
const uint32_t mSampleRate; // initial sample rate only; for tracks which
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 9763bf2..fe93367 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -50,10 +50,6 @@
#define ALOGVV(a...) do { } while(0)
#endif
-// TODO move to a common header (Also shared with AudioTrack.cpp)
-#define NANOS_PER_SECOND 1000000000
-#define TIME_TO_NANOS(time) ((uint64_t)(time).tv_sec * NANOS_PER_SECOND + (time).tv_nsec)
-
namespace android {
// ----------------------------------------------------------------------------
@@ -71,6 +67,7 @@
audio_channel_mask_t channelMask,
size_t frameCount,
void *buffer,
+ size_t bufferSize,
audio_session_t sessionId,
uid_t clientUid,
bool isOut,
@@ -81,7 +78,7 @@
mThread(thread),
mClient(client),
mCblk(NULL),
- // mBuffer
+ // mBuffer, mBufferSize
mState(IDLE),
mSampleRate(sampleRate),
mFormat(format),
@@ -113,15 +110,22 @@
// ALOGD("Creating track with %d buffers @ %d bytes", bufferCount, bufferSize);
- size_t bufferSize = buffer == NULL ? roundup(frameCount) : frameCount;
+ size_t minBufferSize = buffer == NULL ? roundup(frameCount) : frameCount;
// check overflow when computing bufferSize due to multiplication by mFrameSize.
- if (bufferSize < frameCount // roundup rounds down for values above UINT_MAX / 2
+ if (minBufferSize < frameCount // roundup rounds down for values above UINT_MAX / 2
|| mFrameSize == 0 // format needs to be correct
- || bufferSize > SIZE_MAX / mFrameSize) {
+ || minBufferSize > SIZE_MAX / mFrameSize) {
android_errorWriteLog(0x534e4554, "34749571");
return;
}
- bufferSize *= mFrameSize;
+ minBufferSize *= mFrameSize;
+
+ if (buffer == nullptr) {
+ bufferSize = minBufferSize; // allocated here.
+ } else if (minBufferSize > bufferSize) {
+ android_errorWriteLog(0x534e4554, "38340117");
+ return;
+ }
size_t size = sizeof(audio_track_cblk_t);
if (buffer == NULL && alloc == ALLOC_CBLK) {
@@ -177,6 +181,7 @@
// It should references the buffer via the pipe.
// Therefore, to detect incorrect usage of the buffer, we set mBuffer to NULL.
mBuffer = NULL;
+ bufferSize = 0;
break;
case ALLOC_CBLK:
// clear all buffers
@@ -196,7 +201,10 @@
case ALLOC_NONE:
mBuffer = buffer;
break;
+ default:
+ LOG_ALWAYS_FATAL("invalid allocation type: %d", (int)alloc);
}
+ mBufferSize = bufferSize;
#ifdef TEE_SINK
if (mTeeSinkTrackEnabled) {
@@ -368,6 +376,7 @@
audio_channel_mask_t channelMask,
size_t frameCount,
void *buffer,
+ size_t bufferSize,
const sp<IMemory>& sharedBuffer,
audio_session_t sessionId,
uid_t uid,
@@ -376,6 +385,7 @@
audio_port_handle_t portId)
: TrackBase(thread, client, sampleRate, format, channelMask, frameCount,
(sharedBuffer != 0) ? sharedBuffer->pointer() : buffer,
+ (sharedBuffer != 0) ? sharedBuffer->size() : bufferSize,
sessionId, uid, true /*isOut*/,
(type == TYPE_PATCH) ? ( buffer == NULL ? ALLOC_LOCAL : ALLOC_NONE) : ALLOC_CBLK,
type, portId),
@@ -411,21 +421,6 @@
mAudioTrackServerProxy = new AudioTrackServerProxy(mCblk, mBuffer, frameCount,
mFrameSize, !isExternalTrack(), sampleRate);
} else {
- // Is the shared buffer of sufficient size?
- // (frameCount * mFrameSize) is <= SIZE_MAX, checked in TrackBase.
- if (sharedBuffer->size() < frameCount * mFrameSize) {
- // Workaround: clear out mCblk to indicate track hasn't been properly created.
- mCblk->~audio_track_cblk_t(); // destroy our shared-structure.
- if (mClient == 0) {
- free(mCblk);
- }
- mCblk = NULL;
-
- mSharedBuffer.clear(); // release shared buffer early
- android_errorWriteLog(0x534e4554, "38340117");
- return;
- }
-
mAudioTrackServerProxy = new StaticAudioTrackServerProxy(mCblk, mBuffer, frameCount,
mFrameSize);
}
@@ -503,58 +498,40 @@
/*static*/ void AudioFlinger::PlaybackThread::Track::appendDumpHeader(String8& result)
{
- result.append(" Name Active Client Type Fmt Chn mask Session fCount S F SRate "
- "L dB R dB VS dB Server Main buf Aux buf Flags UndFrmCnt Flushed\n");
+ result.append("T Name Active Client Session S Flags "
+ " Format Chn mask SRate "
+ "ST L dB R dB VS dB "
+ " Server FrmCnt FrmRdy F Underruns Flushed "
+ "Main Buf Aux Buf\n");
}
-void AudioFlinger::PlaybackThread::Track::dump(char* buffer, size_t size, bool active)
+void AudioFlinger::PlaybackThread::Track::appendDump(String8& result, bool active)
{
- gain_minifloat_packed_t vlr = mAudioTrackServerProxy->getVolumeLR();
- if (isFastTrack()) {
- sprintf(buffer, " F %2d", mFastIndex);
- } else if (mName >= AudioMixer::TRACK0) {
- sprintf(buffer, " %4d", mName - AudioMixer::TRACK0);
- } else {
- sprintf(buffer, " none");
- }
- track_state state = mState;
- char stateChar;
- if (isTerminated()) {
- stateChar = 'T';
- } else {
- switch (state) {
- case IDLE:
- stateChar = 'I';
- break;
- case STOPPING_1:
- stateChar = 's';
- break;
- case STOPPING_2:
- stateChar = '5';
- break;
- case STOPPED:
- stateChar = 'S';
- break;
- case RESUMING:
- stateChar = 'R';
- break;
- case ACTIVE:
- stateChar = 'A';
- break;
- case PAUSING:
- stateChar = 'p';
- break;
- case PAUSED:
- stateChar = 'P';
- break;
- case FLUSHED:
- stateChar = 'F';
- break;
- default:
- stateChar = '?';
- break;
+ char trackType;
+ switch (mType) {
+ case TYPE_DEFAULT:
+ case TYPE_OUTPUT:
+ if (mSharedBuffer.get() != nullptr) {
+ trackType = 'S'; // static
+ } else {
+ trackType = ' '; // normal
}
+ break;
+ case TYPE_PATCH:
+ trackType = 'P';
+ break;
+ default:
+ trackType = '?';
}
+
+ if (isFastTrack()) {
+ result.appendFormat("F%c %3d", trackType, mFastIndex);
+ } else if (mName >= AudioMixer::TRACK0) {
+ result.appendFormat("%c %4d", trackType, mName - AudioMixer::TRACK0);
+ } else {
+ result.appendFormat("%c none", trackType);
+ }
+
char nowInUnderrun;
switch (mObservedUnderruns.mBitFields.mMostRecent) {
case UNDERRUN_FULL:
@@ -571,31 +548,75 @@
break;
}
- std::pair<float /* volume */, bool /* active */> vsVolume = mVolumeHandler->getLastVolume();
- snprintf(&buffer[8], size - 8, " %6s %6u %4u %08X %08X %7u %6zu %1c %1d %5u "
- "%5.2g %5.2g %5.2g%c "
- "%08X %08zX %08zX 0x%03X %9u%c %7u\n",
+ char fillingStatus;
+ switch (mFillingUpStatus) {
+ case FS_INVALID:
+ fillingStatus = 'I';
+ break;
+ case FS_FILLING:
+ fillingStatus = 'f';
+ break;
+ case FS_FILLED:
+ fillingStatus = 'F';
+ break;
+ case FS_ACTIVE:
+ fillingStatus = 'A';
+ break;
+ default:
+ fillingStatus = '?';
+ break;
+ }
+
+ // clip framesReadySafe to max representation in dump
+ const size_t framesReadySafe =
+ std::min(mAudioTrackServerProxy->framesReadySafe(), (size_t)99999999);
+
+ // obtain volumes
+ const gain_minifloat_packed_t vlr = mAudioTrackServerProxy->getVolumeLR();
+ const std::pair<float /* volume */, bool /* active */> vsVolume =
+ mVolumeHandler->getLastVolume();
+
+ // Our effective frame count is obtained by ServerProxy::getBufferSizeInFrames()
+ // as it may be reduced by the application.
+ const size_t bufferSizeInFrames = (size_t)mAudioTrackServerProxy->getBufferSizeInFrames();
+ // Check whether the buffer size has been modified by the app.
+ const char modifiedBufferChar = bufferSizeInFrames < mFrameCount
+ ? 'r' /* buffer reduced */: bufferSizeInFrames > mFrameCount
+ ? 'e' /* error */ : ' ' /* identical */;
+
+ result.appendFormat("%7s %6u %7u %2s 0x%03X "
+ "%08X %08X %6u "
+ "%2u %5.2g %5.2g %5.2g%c "
+ "%08X %6zu%c %6zu %c %9u%c %7u "
+ "%08zX %08zX\n",
active ? "yes" : "no",
(mClient == 0) ? getpid_cached : mClient->pid(),
- mStreamType,
+ mSessionId,
+ getTrackStateString(),
+ mCblk->mFlags,
+
mFormat,
mChannelMask,
- mSessionId,
- mFrameCount,
- stateChar,
- mFillingUpStatus,
mAudioTrackServerProxy->getSampleRate(),
+
+ mStreamType,
20.0 * log10(float_from_gain(gain_minifloat_unpack_left(vlr))),
20.0 * log10(float_from_gain(gain_minifloat_unpack_right(vlr))),
20.0 * log10(vsVolume.first), // VolumeShaper(s) total volume
vsVolume.second ? 'A' : ' ', // if any VolumeShapers active
+
mCblk->mServer,
- (size_t)mMainBuffer, // use %zX as %p appends 0x
- (size_t)mAuxBuffer, // use %zX as %p appends 0x
- mCblk->mFlags,
+ bufferSizeInFrames,
+ modifiedBufferChar,
+ framesReadySafe,
+ fillingStatus,
mAudioTrackServerProxy->getUnderrunFrames(),
nowInUnderrun,
- (unsigned)mAudioTrackServerProxy->framesFlushed() % 10000000); // 7 digits
+ (unsigned)mAudioTrackServerProxy->framesFlushed() % 10000000,
+
+ (size_t)mMainBuffer, // use %zX as %p appends 0x
+ (size_t)mAuxBuffer // use %zX as %p appends 0x
+ );
}
uint32_t AudioFlinger::PlaybackThread::Track::sampleRate() const {
@@ -1080,11 +1101,12 @@
void AudioFlinger::PlaybackThread::Track::triggerEvents(AudioSystem::sync_event_t type)
{
- for (size_t i = 0; i < mSyncEvents.size(); i++) {
+ for (size_t i = 0; i < mSyncEvents.size();) {
if (mSyncEvents[i]->type() == type) {
mSyncEvents[i]->trigger();
mSyncEvents.removeAt(i);
- i--;
+ } else {
+ ++i;
}
}
}
@@ -1235,7 +1257,8 @@
uid_t uid)
: Track(playbackThread, NULL, AUDIO_STREAM_PATCH,
sampleRate, format, channelMask, frameCount,
- NULL, 0, AUDIO_SESSION_NONE, uid, AUDIO_OUTPUT_FLAG_NONE,
+ nullptr /* buffer */, (size_t)0 /* bufferSize */, nullptr /* sharedBuffer */,
+ AUDIO_SESSION_NONE, uid, AUDIO_OUTPUT_FLAG_NONE,
TYPE_OUTPUT),
mActive(false), mSourceThread(sourceThread)
{
@@ -1351,7 +1374,9 @@
if (mBufferQueue.size()) {
mBufferQueue.removeAt(0);
free(pInBuffer->mBuffer);
- delete pInBuffer;
+ if (pInBuffer != &inBuffer) {
+ delete pInBuffer;
+ }
ALOGV("OutputTrack::write() %p thread %p released overflow buffer %zu", this,
mThread.unsafe_get(), mBufferQueue.size());
} else {
@@ -1430,10 +1455,12 @@
audio_format_t format,
size_t frameCount,
void *buffer,
+ size_t bufferSize,
audio_output_flags_t flags)
: Track(playbackThread, NULL, streamType,
sampleRate, format, channelMask, frameCount,
- buffer, 0, AUDIO_SESSION_NONE, getuid(), flags, TYPE_PATCH),
+ buffer, bufferSize, nullptr /* sharedBuffer */,
+ AUDIO_SESSION_NONE, getuid(), flags, TYPE_PATCH),
mProxy(new ClientProxy(mCblk, mBuffer, frameCount, mFrameSize, true, true))
{
uint64_t mixBufferNs = ((uint64_t)2 * playbackThread->frameCount() * 1000000000) /
@@ -1567,13 +1594,14 @@
audio_channel_mask_t channelMask,
size_t frameCount,
void *buffer,
+ size_t bufferSize,
audio_session_t sessionId,
uid_t uid,
audio_input_flags_t flags,
track_type type,
audio_port_handle_t portId)
: TrackBase(thread, client, sampleRate, format,
- channelMask, frameCount, buffer, sessionId, uid, false /*isOut*/,
+ channelMask, frameCount, buffer, bufferSize, sessionId, uid, false /*isOut*/,
(type == TYPE_DEFAULT) ?
((flags & AUDIO_INPUT_FLAG_FAST) ? ALLOC_PIPE : ALLOC_CBLK) :
((buffer == NULL) ? ALLOC_LOCAL : ALLOC_NONE),
@@ -1701,22 +1729,28 @@
/*static*/ void AudioFlinger::RecordThread::RecordTrack::appendDumpHeader(String8& result)
{
- result.append(" Active Client Fmt Chn mask Session S Server fCount SRate\n");
+ result.append("Active Client Session S Flags Format Chn mask SRate Server FrmCnt\n");
}
-void AudioFlinger::RecordThread::RecordTrack::dump(char* buffer, size_t size, bool active)
+void AudioFlinger::RecordThread::RecordTrack::appendDump(String8& result, bool active)
{
- snprintf(buffer, size, " %6s %6u %3u %08X %7u %1d %08X %6zu %5u\n",
+ result.appendFormat("%c%5s %6u %7u %2s 0x%03X "
+ "%08X %08X %6u "
+ "%08X %6zu\n",
+ isFastTrack() ? 'F' : ' ',
active ? "yes" : "no",
(mClient == 0) ? getpid_cached : mClient->pid(),
+ mSessionId,
+ getTrackStateString(),
+ mCblk->mFlags,
+
mFormat,
mChannelMask,
- mSessionId,
- mState,
- mCblk->mServer,
- mFrameCount,
- mSampleRate);
+ mSampleRate,
+ mCblk->mServer,
+ mFrameCount
+ );
}
void AudioFlinger::RecordThread::RecordTrack::handleSyncStartEvent(const sp<SyncEvent>& event)
@@ -1767,9 +1801,10 @@
audio_format_t format,
size_t frameCount,
void *buffer,
+ size_t bufferSize,
audio_input_flags_t flags)
: RecordTrack(recordThread, NULL, sampleRate, format, channelMask, frameCount,
- buffer, AUDIO_SESSION_NONE, getuid(), flags, TYPE_PATCH),
+ buffer, bufferSize, AUDIO_SESSION_NONE, getuid(), flags, TYPE_PATCH),
mProxy(new ClientProxy(mCblk, mBuffer, frameCount, mFrameSize, false, true))
{
uint64_t mixBufferNs = ((uint64_t)2 * recordThread->frameCount() * 1000000000) /
@@ -1834,11 +1869,15 @@
audio_channel_mask_t channelMask,
audio_session_t sessionId,
uid_t uid,
+ pid_t pid,
audio_port_handle_t portId)
: TrackBase(thread, NULL, sampleRate, format,
- channelMask, 0, NULL, sessionId, uid, false,
+ channelMask, (size_t)0 /* frameCount */,
+ nullptr /* buffer */, (size_t)0 /* bufferSize */,
+ sessionId, uid, false /* isOut */,
ALLOC_NONE,
- TYPE_DEFAULT, portId)
+ TYPE_DEFAULT, portId),
+ mPid(pid)
{
}
@@ -1885,17 +1924,17 @@
/*static*/ void AudioFlinger::MmapThread::MmapTrack::appendDumpHeader(String8& result)
{
- result.append(" Client Fmt Chn mask SRate\n");
+ result.append("Client Session Format Chn mask SRate\n");
}
-void AudioFlinger::MmapThread::MmapTrack::dump(char* buffer, size_t size)
+void AudioFlinger::MmapThread::MmapTrack::appendDump(String8& result, bool active __unused)
{
- snprintf(buffer, size, " %6u %3u %08X %5u\n",
- mUid,
+ result.appendFormat("%6u %7u %08X %08X %6u\n",
+ mPid,
+ mSessionId,
mFormat,
mChannelMask,
mSampleRate);
-
}
} // namespace android
diff --git a/services/audioflinger/TypedLogger.h b/services/audioflinger/TypedLogger.h
index 2d84028..7e77e89 100644
--- a/services/audioflinger/TypedLogger.h
+++ b/services/audioflinger/TypedLogger.h
@@ -62,7 +62,8 @@
}
template <typename T, size_t n>
-constexpr T fnv1a(const char (&file)[n], int i = n - 1) {
+__attribute__((no_sanitize("unsigned-integer-overflow")))
+constexpr T fnv1a(const char (&file)[n], ssize_t i = (ssize_t)n - 1) {
return i == -1 ? offset_basis<T>() : (fnv1a<T>(file, i - 1) ^ file[i]) * FNV_prime<T>();
}
@@ -88,11 +89,11 @@
// Write histogram timestamp entry
#define LOG_HIST_TS() do { NBLog::Writer *x = tlNBLogWriter; if (x != nullptr) \
- x->logHistTS(hash(__FILE__, __LINE__)); } while(0)
+ x->logEventHistTs(NBLog::EVENT_HISTOGRAM_ENTRY_TS, hash(__FILE__, __LINE__)); } while(0)
-// flush all histogram
-#define LOG_HIST_FLUSH() do { NBLog::Writer *x = tlNBLogWriter; if (x != nullptr) \
- x->logHistFlush(hash(__FILE__, __LINE__)); } while(0)
+// Record that audio was turned on/off
+#define LOG_AUDIO_STATE() do { NBLog::Writer *x = tlNBLogWriter; if (x != nullptr) \
+ x->logEventHistTs(NBLog::EVENT_AUDIO_STATE, hash(__FILE__, __LINE__)); } while(0)
namespace android {
extern "C" {
diff --git a/services/audiopolicy/Android.mk b/services/audiopolicy/Android.mk
index ad340e5..65571f9 100644
--- a/services/audiopolicy/Android.mk
+++ b/services/audiopolicy/Android.mk
@@ -24,7 +24,8 @@
libhardware_legacy \
libserviceutility \
libaudiopolicymanager \
- libmedia_helper
+ libmedia_helper \
+ libeffectsconfig
LOCAL_STATIC_LIBRARIES := \
libaudiopolicycomponents
diff --git a/services/audiopolicy/AudioPolicyInterface.h b/services/audiopolicy/AudioPolicyInterface.h
index c868206..7b19f58 100644
--- a/services/audiopolicy/AudioPolicyInterface.h
+++ b/services/audiopolicy/AudioPolicyInterface.h
@@ -349,8 +349,8 @@
virtual void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state) = 0;
- virtual void onRecordingConfigurationUpdate(int event, audio_session_t session,
- audio_source_t source,
+ virtual void onRecordingConfigurationUpdate(int event,
+ const record_client_info_t *clientInfo,
const struct audio_config_base *clientConfig,
const struct audio_config_base *deviceConfig,
audio_patch_handle_t patchHandle) = 0;
diff --git a/services/audiopolicy/OWNERS b/services/audiopolicy/OWNERS
new file mode 100644
index 0000000..a8483fa
--- /dev/null
+++ b/services/audiopolicy/OWNERS
@@ -0,0 +1,3 @@
+jmtrivi@google.com
+krocard@google.com
+mnaganov@google.com
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioOutputDescriptor.h b/services/audiopolicy/common/managerdefinitions/include/AudioOutputDescriptor.h
index c09cb5a..3726c06 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioOutputDescriptor.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioOutputDescriptor.h
@@ -179,6 +179,16 @@
*/
audio_io_handle_t getA2dpOutput() const;
+ /**
+ * returns true if primary HAL supports A2DP Offload
+ */
+ bool isA2dpOffloadedOnPrimary() const;
+
+ /**
+ * returns true if A2DP is supported (either via hardware offload or software encoding)
+ */
+ bool isA2dpSupported() const;
+
sp<SwAudioOutputDescriptor> getOutputFromId(audio_port_handle_t id) const;
sp<SwAudioOutputDescriptor> getPrimaryOutput() const;
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioSession.h b/services/audiopolicy/common/managerdefinitions/include/AudioSession.h
index ca070cf..cedf22d 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioSession.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioSession.h
@@ -22,6 +22,7 @@
#include <utils/Errors.h>
#include <utils/KeyedVector.h>
#include <media/AudioPolicy.h>
+#include <media/IAudioPolicyServiceClient.h>
#include "AudioSessionInfoProvider.h"
namespace android {
@@ -44,14 +45,14 @@
status_t dump(int fd, int spaces, int index) const;
- audio_session_t session() const { return mSession; }
- audio_source_t inputSource()const { return mInputSource; }
+ audio_session_t session() const { return mRecordClientInfo.session; }
+ audio_source_t inputSource()const { return mRecordClientInfo.source; }
audio_format_t format() const { return mConfig.format; }
uint32_t sampleRate() const { return mConfig.sample_rate; }
audio_channel_mask_t channelMask() const { return mConfig.channel_mask; }
audio_input_flags_t flags() const { return mFlags; }
- uid_t uid() const { return mUid; }
- void setUid(uid_t uid) { mUid = uid; }
+ uid_t uid() const { return mRecordClientInfo.uid; }
+ void setUid(uid_t uid) { mRecordClientInfo.uid = uid; }
bool matches(const sp<AudioSession> &other) const;
bool isSoundTrigger() const { return mIsSoundTrigger; }
uint32_t openCount() const { return mOpenCount; } ;
@@ -65,11 +66,9 @@
virtual void onSessionInfoUpdate() const;
private:
- const audio_session_t mSession;
- const audio_source_t mInputSource;
+ record_client_info_t mRecordClientInfo;
const struct audio_config_base mConfig;
const audio_input_flags_t mFlags;
- uid_t mUid;
bool mIsSoundTrigger;
uint32_t mOpenCount;
uint32_t mActiveCount;
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
index 8593444..3819af8 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
@@ -486,6 +486,29 @@
return 0;
}
+bool SwAudioOutputCollection::isA2dpOffloadedOnPrimary() const
+{
+ sp<SwAudioOutputDescriptor> primaryOutput = getPrimaryOutput();
+
+ if ((primaryOutput != NULL) && (primaryOutput->mProfile != NULL)
+ && (primaryOutput->mProfile->mModule != NULL)) {
+ sp<HwModule> primaryHwModule = primaryOutput->mProfile->mModule;
+ Vector <sp<IOProfile>> primaryHwModuleOutputProfiles =
+ primaryHwModule->getOutputProfiles();
+ for (size_t i = 0; i < primaryHwModuleOutputProfiles.size(); i++) {
+ if (primaryHwModuleOutputProfiles[i]->supportDevice(AUDIO_DEVICE_OUT_ALL_A2DP)) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+bool SwAudioOutputCollection::isA2dpSupported() const
+{
+ return (isA2dpOffloadedOnPrimary() || (getA2dpOutput() != 0));
+}
+
sp<SwAudioOutputDescriptor> SwAudioOutputCollection::getPrimaryOutput() const
{
for (size_t i = 0; i < size(); i++) {
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioSession.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioSession.cpp
index bea9f4f..5b57d3d 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioSession.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioSession.cpp
@@ -38,9 +38,9 @@
bool isSoundTrigger,
AudioMix* policyMix,
AudioPolicyClientInterface *clientInterface) :
- mSession(session), mInputSource(inputSource),
+ mRecordClientInfo({ .uid = uid, .session = session, .source = inputSource}),
mConfig({ .format = format, .sample_rate = sampleRate, .channel_mask = channelMask}),
- mFlags(flags), mUid(uid), mIsSoundTrigger(isSoundTrigger),
+ mFlags(flags), mIsSoundTrigger(isSoundTrigger),
mOpenCount(1), mActiveCount(0), mPolicyMix(policyMix), mClientInterface(clientInterface),
mInfoProvider(NULL)
{
@@ -92,7 +92,7 @@
const audio_patch_handle_t patchHandle = (provider != NULL) ? provider->getPatchHandle() :
AUDIO_PATCH_HANDLE_NONE;
if (patchHandle != AUDIO_PATCH_HANDLE_NONE) {
- mClientInterface->onRecordingConfigurationUpdate(event, mSession, mInputSource,
+ mClientInterface->onRecordingConfigurationUpdate(event, &mRecordClientInfo,
&mConfig, &deviceConfig, patchHandle);
}
}
@@ -102,13 +102,13 @@
bool AudioSession::matches(const sp<AudioSession> &other) const
{
- if (other->session() == mSession &&
- other->inputSource() == mInputSource &&
+ if (other->session() == mRecordClientInfo.session &&
+ other->inputSource() == mRecordClientInfo.source &&
other->format() == mConfig.format &&
other->sampleRate() == mConfig.sample_rate &&
other->channelMask() == mConfig.channel_mask &&
other->flags() == mFlags &&
- other->uid() == mUid) {
+ other->uid() == mRecordClientInfo.uid) {
return true;
}
return false;
@@ -130,8 +130,7 @@
AUDIO_PATCH_HANDLE_NONE;
if (patchHandle != AUDIO_PATCH_HANDLE_NONE) {
mClientInterface->onRecordingConfigurationUpdate(RECORD_CONFIG_EVENT_START,
- mSession, mInputSource,
- &mConfig, &deviceConfig, patchHandle);
+ &mRecordClientInfo, &mConfig, &deviceConfig, patchHandle);
}
}
}
@@ -144,11 +143,11 @@
snprintf(buffer, SIZE, "%*sAudio session %d:\n", spaces, "", index+1);
result.append(buffer);
- snprintf(buffer, SIZE, "%*s- session: %2d\n", spaces, "", mSession);
+ snprintf(buffer, SIZE, "%*s- session: %2d\n", spaces, "", mRecordClientInfo.session);
result.append(buffer);
- snprintf(buffer, SIZE, "%*s- owner uid: %2d\n", spaces, "", mUid);
+ snprintf(buffer, SIZE, "%*s- owner uid: %2d\n", spaces, "", mRecordClientInfo.uid);
result.append(buffer);
- snprintf(buffer, SIZE, "%*s- input source: %d\n", spaces, "", mInputSource);
+ snprintf(buffer, SIZE, "%*s- input source: %d\n", spaces, "", mRecordClientInfo.source);
result.append(buffer);
snprintf(buffer, SIZE, "%*s- format: %08x\n", spaces, "", mConfig.format);
result.append(buffer);
diff --git a/services/audiopolicy/common/managerdefinitions/src/SoundTriggerSession.cpp b/services/audiopolicy/common/managerdefinitions/src/SoundTriggerSession.cpp
index 8ca3ae0..0383b0e 100644
--- a/services/audiopolicy/common/managerdefinitions/src/SoundTriggerSession.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/SoundTriggerSession.cpp
@@ -34,7 +34,7 @@
{
ssize_t index = indexOfKey(session);
if (index < 0) {
- ALOGW("acquireSoundTriggerSession() session %d not registered", session);
+ ALOGW("releaseSession() session %d not registered", session);
return BAD_VALUE;
}
diff --git a/services/audiopolicy/config/primary_audio_policy_configuration.xml b/services/audiopolicy/config/primary_audio_policy_configuration.xml
index bf508ac..5b7ae7f 100644
--- a/services/audiopolicy/config/primary_audio_policy_configuration.xml
+++ b/services/audiopolicy/config/primary_audio_policy_configuration.xml
@@ -13,7 +13,7 @@
</mixPort>
<mixPort name="primary input" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
- samplingRates="8000, 16000" channelMasks="AUDIO_CHANNEL_IN_MONO"/>
+ samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_IN_MONO"/>
</mixPort>
</mixPorts>
<devicePorts>
diff --git a/services/audiopolicy/enginedefault/src/Engine.cpp b/services/audiopolicy/enginedefault/src/Engine.cpp
index 9bdb98c..43205a2 100644
--- a/services/audiopolicy/enginedefault/src/Engine.cpp
+++ b/services/audiopolicy/enginedefault/src/Engine.cpp
@@ -347,7 +347,7 @@
// when not in a phone call, phone strategy should route STREAM_VOICE_CALL to A2DP
if (!isInCall() &&
(mForceUse[AUDIO_POLICY_FORCE_FOR_MEDIA] != AUDIO_POLICY_FORCE_NO_BT_A2DP) &&
- (outputs.getA2dpOutput() != 0)) {
+ outputs.isA2dpSupported()) {
device = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_A2DP;
if (device) break;
device = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES;
@@ -381,7 +381,7 @@
// A2DP speaker when forcing to speaker output
if (!isInCall() &&
(mForceUse[AUDIO_POLICY_FORCE_FOR_MEDIA] != AUDIO_POLICY_FORCE_NO_BT_A2DP) &&
- (outputs.getA2dpOutput() != 0)) {
+ outputs.isA2dpSupported()) {
device = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER;
if (device) break;
}
@@ -491,7 +491,7 @@
}
if ((device2 == AUDIO_DEVICE_NONE) &&
(mForceUse[AUDIO_POLICY_FORCE_FOR_MEDIA] != AUDIO_POLICY_FORCE_NO_BT_A2DP) &&
- (outputs.getA2dpOutput() != 0)) {
+ outputs.isA2dpSupported()) {
device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_A2DP;
if (device2 == AUDIO_DEVICE_NONE) {
device2 = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES;
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 737ca59..19df76b 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -26,6 +26,7 @@
#define AUDIO_POLICY_XML_CONFIG_FILE_PATH_MAX_LENGTH 128
#define AUDIO_POLICY_XML_CONFIG_FILE_NAME "audio_policy_configuration.xml"
+#define AUDIO_POLICY_A2DP_OFFLOAD_XML_CONFIG_FILE_NAME "audio_policy_a2dp_offload_configuration.xml"
#include <inttypes.h>
#include <math.h>
@@ -1320,9 +1321,9 @@
// apply volume rules for current stream and device if necessary
checkAndSetVolume(stream,
- mVolumeCurves->getVolumeIndex(stream, device),
+ mVolumeCurves->getVolumeIndex(stream, outputDesc->device()),
outputDesc,
- device);
+ outputDesc->device());
// update the outputs if starting an output with a stream that can affect notification
// routing
@@ -1510,62 +1511,13 @@
"session %d, flags %#x",
attr->source, config->sample_rate, config->format, config->channel_mask, session, flags);
- // special case for mmap capture: if an input IO handle is specified, we reuse this input if
- // possible
- if ((flags & AUDIO_INPUT_FLAG_MMAP_NOIRQ) == AUDIO_INPUT_FLAG_MMAP_NOIRQ &&
- *input != AUDIO_IO_HANDLE_NONE) {
- ssize_t index = mInputs.indexOfKey(*input);
- if (index < 0) {
- ALOGW("getInputForAttr() unknown MMAP input %d", *input);
- return BAD_VALUE;
- }
- sp<AudioInputDescriptor> inputDesc = mInputs.valueAt(index);
- sp<AudioSession> audioSession = inputDesc->getAudioSession(session);
- if (audioSession == 0) {
- ALOGW("getInputForAttr() unknown session %d on input %d", session, *input);
- return BAD_VALUE;
- }
- // For MMAP mode, the first call to getInputForAttr() is made on behalf of audioflinger.
- // The second call is for the first active client and sets the UID. Any further call
- // corresponds to a new client and is only permitted from the same UId.
- if (audioSession->openCount() == 1) {
- audioSession->setUid(uid);
- } else if (audioSession->uid() != uid) {
- ALOGW("getInputForAttr() bad uid %d for session %d uid %d",
- uid, session, audioSession->uid());
- return INVALID_OPERATION;
- }
- audioSession->changeOpenCount(1);
- *inputType = API_INPUT_LEGACY;
- if (*portId == AUDIO_PORT_HANDLE_NONE) {
- *portId = AudioPort::getNextUniqueId();
- }
- DeviceVector inputDevices = mAvailableInputDevices.getDevicesFromType(inputDesc->mDevice);
- *selectedDeviceId = inputDevices.size() > 0 ? inputDevices.itemAt(0)->getId()
- : AUDIO_PORT_HANDLE_NONE;
- ALOGI("%s reusing MMAP input %d for session %d", __FUNCTION__, *input, session);
- return NO_ERROR;
- }
-
- *input = AUDIO_IO_HANDLE_NONE;
- *inputType = API_INPUT_INVALID;
-
- audio_devices_t device;
+ status_t status = NO_ERROR;
// handle legacy remote submix case where the address was not always specified
String8 address = String8("");
- audio_source_t inputSource = attr->source;
audio_source_t halInputSource;
+ audio_source_t inputSource = attr->source;
AudioMix *policyMix = NULL;
-
- if (inputSource == AUDIO_SOURCE_DEFAULT) {
- inputSource = AUDIO_SOURCE_MIC;
- }
- halInputSource = inputSource;
-
- // TODO: check for existing client for this port ID
- if (*portId == AUDIO_PORT_HANDLE_NONE) {
- *portId = AudioPort::getNextUniqueId();
- }
+ DeviceVector inputDevices;
// Explicit routing?
sp<DeviceDescriptor> deviceDesc;
@@ -1579,11 +1531,67 @@
}
mInputRoutes.addRoute(session, SessionRoute::STREAM_TYPE_NA, inputSource, deviceDesc, uid);
+ // special case for mmap capture: if an input IO handle is specified, we reuse this input if
+ // possible
+ if ((flags & AUDIO_INPUT_FLAG_MMAP_NOIRQ) == AUDIO_INPUT_FLAG_MMAP_NOIRQ &&
+ *input != AUDIO_IO_HANDLE_NONE) {
+ ssize_t index = mInputs.indexOfKey(*input);
+ if (index < 0) {
+ ALOGW("getInputForAttr() unknown MMAP input %d", *input);
+ status = BAD_VALUE;
+ goto error;
+ }
+ sp<AudioInputDescriptor> inputDesc = mInputs.valueAt(index);
+ sp<AudioSession> audioSession = inputDesc->getAudioSession(session);
+ if (audioSession == 0) {
+ ALOGW("getInputForAttr() unknown session %d on input %d", session, *input);
+ status = BAD_VALUE;
+ goto error;
+ }
+ // For MMAP mode, the first call to getInputForAttr() is made on behalf of audioflinger.
+ // The second call is for the first active client and sets the UID. Any further call
+ // corresponds to a new client and is only permitted from the same UId.
+ if (audioSession->openCount() == 1) {
+ audioSession->setUid(uid);
+ } else if (audioSession->uid() != uid) {
+ ALOGW("getInputForAttr() bad uid %d for session %d uid %d",
+ uid, session, audioSession->uid());
+ status = INVALID_OPERATION;
+ goto error;
+ }
+ audioSession->changeOpenCount(1);
+ *inputType = API_INPUT_LEGACY;
+ if (*portId == AUDIO_PORT_HANDLE_NONE) {
+ *portId = AudioPort::getNextUniqueId();
+ }
+ inputDevices = mAvailableInputDevices.getDevicesFromType(inputDesc->mDevice);
+ *selectedDeviceId = inputDevices.size() > 0 ? inputDevices.itemAt(0)->getId()
+ : AUDIO_PORT_HANDLE_NONE;
+ ALOGI("%s reusing MMAP input %d for session %d", __FUNCTION__, *input, session);
+
+ return NO_ERROR;
+ }
+
+ *input = AUDIO_IO_HANDLE_NONE;
+ *inputType = API_INPUT_INVALID;
+
+ if (inputSource == AUDIO_SOURCE_DEFAULT) {
+ inputSource = AUDIO_SOURCE_MIC;
+ }
+ halInputSource = inputSource;
+
+ // TODO: check for existing client for this port ID
+ if (*portId == AUDIO_PORT_HANDLE_NONE) {
+ *portId = AudioPort::getNextUniqueId();
+ }
+
+ audio_devices_t device;
+
if (inputSource == AUDIO_SOURCE_REMOTE_SUBMIX &&
strncmp(attr->tags, "addr=", strlen("addr=")) == 0) {
- status_t ret = mPolicyMixes.getInputMixForAttr(*attr, &policyMix);
- if (ret != NO_ERROR) {
- return ret;
+ status = mPolicyMixes.getInputMixForAttr(*attr, &policyMix);
+ if (status != NO_ERROR) {
+ goto error;
}
*inputType = API_INPUT_MIX_EXT_POLICY_REROUTE;
device = AUDIO_DEVICE_IN_REMOTE_SUBMIX;
@@ -1592,7 +1600,8 @@
device = getDeviceAndMixForInputSource(inputSource, &policyMix);
if (device == AUDIO_DEVICE_NONE) {
ALOGW("getInputForAttr() could not find device for source %d", inputSource);
- return BAD_VALUE;
+ status = BAD_VALUE;
+ goto error;
}
if (policyMix != NULL) {
address = policyMix->mDeviceAddress;
@@ -1621,11 +1630,11 @@
config->sample_rate, config->format, config->channel_mask, flags,
policyMix);
if (*input == AUDIO_IO_HANDLE_NONE) {
- mInputRoutes.removeRoute(session);
- return INVALID_OPERATION;
+ status = INVALID_OPERATION;
+ goto error;
}
- DeviceVector inputDevices = mAvailableInputDevices.getDevicesFromType(device);
+ inputDevices = mAvailableInputDevices.getDevicesFromType(device);
*selectedDeviceId = inputDevices.size() > 0 ? inputDevices.itemAt(0)->getId()
: AUDIO_PORT_HANDLE_NONE;
@@ -1633,6 +1642,10 @@
*input, *inputType, *selectedDeviceId);
return NO_ERROR;
+
+error:
+ mInputRoutes.removeRoute(session);
+ return status;
}
@@ -3564,11 +3577,14 @@
for (int i = 0; i < kConfigLocationListSize; i++) {
PolicySerializer serializer;
+ bool use_a2dp_offload_config =
+ property_get_bool("persist.bluetooth.a2dp_offload.enable", false);
snprintf(audioPolicyXmlConfigFile,
sizeof(audioPolicyXmlConfigFile),
"%s/%s",
kConfigLocationList[i],
- AUDIO_POLICY_XML_CONFIG_FILE_NAME);
+ use_a2dp_offload_config ? AUDIO_POLICY_A2DP_OFFLOAD_XML_CONFIG_FILE_NAME :
+ AUDIO_POLICY_XML_CONFIG_FILE_NAME);
ret = serializer.deserialize(audioPolicyXmlConfigFile, config);
if (ret == NO_ERROR) {
break;
@@ -4665,7 +4681,7 @@
void AudioPolicyManager::checkA2dpSuspend()
{
audio_io_handle_t a2dpOutput = mOutputs.getA2dpOutput();
- if (a2dpOutput == 0) {
+ if (a2dpOutput == 0 || mOutputs.isA2dpOffloadedOnPrimary()) {
mA2dpSuspended = false;
return;
}
@@ -4732,10 +4748,10 @@
// use device for strategy enforced audible
// 2: we are in call or the strategy phone is active on the output:
// use device for strategy phone
- // 3: the strategy for enforced audible is active but not enforced on the output:
- // use the device for strategy enforced audible
- // 4: the strategy sonification is active on the output:
+ // 3: the strategy sonification is active on the output:
// use device for strategy sonification
+ // 4: the strategy for enforced audible is active but not enforced on the output:
+ // use the device for strategy enforced audible
// 5: the strategy accessibility is active on the output:
// use device for strategy accessibility
// 6: the strategy "respectful" sonification is active on the output:
@@ -4752,10 +4768,10 @@
} else if (isInCall() ||
isStrategyActive(outputDesc, STRATEGY_PHONE)) {
device = getDeviceForStrategy(STRATEGY_PHONE, fromCache);
- } else if (isStrategyActive(outputDesc, STRATEGY_ENFORCED_AUDIBLE)) {
- device = getDeviceForStrategy(STRATEGY_ENFORCED_AUDIBLE, fromCache);
} else if (isStrategyActive(outputDesc, STRATEGY_SONIFICATION)) {
device = getDeviceForStrategy(STRATEGY_SONIFICATION, fromCache);
+ } else if (isStrategyActive(outputDesc, STRATEGY_ENFORCED_AUDIBLE)) {
+ device = getDeviceForStrategy(STRATEGY_ENFORCED_AUDIBLE, fromCache);
} else if (isStrategyActive(outputDesc, STRATEGY_ACCESSIBILITY)) {
device = getDeviceForStrategy(STRATEGY_ACCESSIBILITY, fromCache);
} else if (isStrategyActive(outputDesc, STRATEGY_SONIFICATION_RESPECTFUL)) {
@@ -4937,12 +4953,13 @@
// scan the whole RouteMap, for each entry, convert the stream type to a strategy
// (getStrategy(stream)).
// if the strategy from the stream type in the RouteMap is the same as the argument above,
- // and activity count is non-zero
- // the device = the device from the descriptor in the RouteMap, and exit.
+ // and activity count is non-zero and the device in the route descriptor is available
+ // then select this device.
for (size_t routeIndex = 0; routeIndex < mOutputRoutes.size(); routeIndex++) {
sp<SessionRoute> route = mOutputRoutes.valueAt(routeIndex);
routing_strategy routeStrategy = getStrategy(route->mStreamType);
- if ((routeStrategy == strategy) && route->isActive()) {
+ if ((routeStrategy == strategy) && route->isActive() &&
+ (mAvailableOutputDevices.indexOf(route->mDeviceDescriptor) >= 0)) {
return route->mDeviceDescriptor->type();
}
}
@@ -5337,9 +5354,15 @@
audio_devices_t AudioPolicyManager::getDeviceForInputSource(audio_source_t inputSource)
{
+ // Routing
+ // Scan the whole RouteMap to see if we have an explicit route:
+ // if the input source in the RouteMap is the same as the argument above,
+ // and activity count is non-zero and the device in the route descriptor is available
+ // then select this device.
for (size_t routeIndex = 0; routeIndex < mInputRoutes.size(); routeIndex++) {
sp<SessionRoute> route = mInputRoutes.valueAt(routeIndex);
- if (inputSource == route->mSource && route->isActive()) {
+ if ((inputSource == route->mSource) && route->isActive() &&
+ (mAvailableInputDevices.indexOf(route->mDeviceDescriptor) >= 0)) {
return route->mDeviceDescriptor->type();
}
}
diff --git a/services/audiopolicy/service/AudioPolicyClientImpl.cpp b/services/audiopolicy/service/AudioPolicyClientImpl.cpp
index dbcc070..31c9575 100644
--- a/services/audiopolicy/service/AudioPolicyClientImpl.cpp
+++ b/services/audiopolicy/service/AudioPolicyClientImpl.cpp
@@ -220,11 +220,11 @@
}
void AudioPolicyService::AudioPolicyClient::onRecordingConfigurationUpdate(
- int event, audio_session_t session, audio_source_t source,
+ int event, const record_client_info_t *clientInfo,
const audio_config_base_t *clientConfig, const audio_config_base_t *deviceConfig,
audio_patch_handle_t patchHandle)
{
- mAudioPolicyService->onRecordingConfigurationUpdate(event, session, source,
+ mAudioPolicyService->onRecordingConfigurationUpdate(event, clientInfo,
clientConfig, deviceConfig, patchHandle);
}
diff --git a/services/audiopolicy/service/AudioPolicyEffects.cpp b/services/audiopolicy/service/AudioPolicyEffects.cpp
index 654465d..84b1073 100644
--- a/services/audiopolicy/service/AudioPolicyEffects.cpp
+++ b/services/audiopolicy/service/AudioPolicyEffects.cpp
@@ -20,8 +20,10 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <memory>
#include <cutils/misc.h>
#include <media/AudioEffect.h>
+#include <media/EffectsConfig.h>
#include <system/audio.h>
#include <system/audio_effects/audio_effects_conf.h>
#include <utils/Vector.h>
@@ -39,11 +41,17 @@
AudioPolicyEffects::AudioPolicyEffects()
{
- // load automatic audio effect modules
- if (access(AUDIO_EFFECT_VENDOR_CONFIG_FILE, R_OK) == 0) {
- loadAudioEffectConfig(AUDIO_EFFECT_VENDOR_CONFIG_FILE);
- } else if (access(AUDIO_EFFECT_DEFAULT_CONFIG_FILE, R_OK) == 0) {
- loadAudioEffectConfig(AUDIO_EFFECT_DEFAULT_CONFIG_FILE);
+ status_t loadResult = loadAudioEffectXmlConfig();
+ if (loadResult < 0) {
+ ALOGW("Failed to load XML effect configuration, fallback to .conf");
+ // load automatic audio effect modules
+ if (access(AUDIO_EFFECT_VENDOR_CONFIG_FILE, R_OK) == 0) {
+ loadAudioEffectConfig(AUDIO_EFFECT_VENDOR_CONFIG_FILE);
+ } else if (access(AUDIO_EFFECT_DEFAULT_CONFIG_FILE, R_OK) == 0) {
+ loadAudioEffectConfig(AUDIO_EFFECT_DEFAULT_CONFIG_FILE);
+ }
+ } else if (loadResult > 0) {
+ ALOGE("Effect config is partially invalid, skipped %d elements", loadResult);
}
}
@@ -685,6 +693,28 @@
return NO_ERROR;
}
+status_t AudioPolicyEffects::loadAudioEffectXmlConfig() {
+ auto result = effectsConfig::parse();
+ if (result.parsedConfig == nullptr) {
+ return -ENOENT;
+ }
+
+ auto loadProcessingChain = [](auto& processingChain, auto& streams) {
+ for (auto& stream : processingChain) {
+ auto effectDescs = std::make_unique<EffectDescVector>();
+ for (auto& effect : stream.effects) {
+ effectDescs->mEffects.add(
+ new EffectDesc{effect.get().name.c_str(), effect.get().uuid});
+ }
+ streams.add(stream.type, effectDescs.release());
+ }
+ };
+ loadProcessingChain(result.parsedConfig->preprocess, mInputSources);
+ loadProcessingChain(result.parsedConfig->postprocess, mOutputStreams);
+ // Casting from ssize_t to status_t is probably safe, there should not be more than 2^31 errors
+ return result.nbSkippedElement;
+}
+
status_t AudioPolicyEffects::loadAudioEffectConfig(const char *path)
{
cnode *root;
diff --git a/services/audiopolicy/service/AudioPolicyEffects.h b/services/audiopolicy/service/AudioPolicyEffects.h
index 0c74d87..59d5d14 100644
--- a/services/audiopolicy/service/AudioPolicyEffects.h
+++ b/services/audiopolicy/service/AudioPolicyEffects.h
@@ -155,7 +155,8 @@
audio_stream_type_t streamNameToEnum(const char *name);
// Parse audio_effects.conf
- status_t loadAudioEffectConfig(const char *path);
+ status_t loadAudioEffectConfig(const char *path); // TODO: add legacy in the name
+ status_t loadAudioEffectXmlConfig(); // TODO: remove "Xml" in the name
// Load all effects descriptors in configuration file
status_t loadEffects(cnode *root, Vector <EffectDesc *>& effects);
diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
index 7d7cd93..b7bce55 100644
--- a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
+++ b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
@@ -289,13 +289,6 @@
return BAD_VALUE;
}
- if ((attr->source == AUDIO_SOURCE_HOTWORD) && !captureHotwordAllowed()) {
- return BAD_VALUE;
- }
- sp<AudioPolicyEffects>audioPolicyEffects;
- status_t status;
- AudioPolicyInterface::input_type_t inputType;
-
bool updatePid = (pid == -1);
const uid_t callingUid = IPCThreadState::self()->getCallingUid();
if (!isTrustedCallingUid(callingUid)) {
@@ -313,7 +306,15 @@
pid = callingPid;
}
+ if ((attr->source == AUDIO_SOURCE_HOTWORD) && !captureHotwordAllowed(pid, uid)) {
+ return BAD_VALUE;
+ }
+
+ sp<AudioPolicyEffects>audioPolicyEffects;
{
+ status_t status;
+ AudioPolicyInterface::input_type_t inputType;
+
Mutex::Autolock _l(mLock);
// the audio_in_acoustics_t parameter is ignored by get_input()
status = mAudioPolicyManager->getInputForAttr(attr, input, session, uid,
@@ -693,6 +694,7 @@
audio_io_handle_t *ioHandle,
audio_devices_t *device)
{
+ Mutex::Autolock _l(mLock);
if (mAudioPolicyManager == NULL) {
return NO_INIT;
}
@@ -702,6 +704,7 @@
status_t AudioPolicyService::releaseSoundTriggerSession(audio_session_t session)
{
+ Mutex::Autolock _l(mLock);
if (mAudioPolicyManager == NULL) {
return NO_INIT;
}
diff --git a/services/audiopolicy/service/AudioPolicyService.cpp b/services/audiopolicy/service/AudioPolicyService.cpp
index c4f6367..7af2e74 100644
--- a/services/audiopolicy/service/AudioPolicyService.cpp
+++ b/services/audiopolicy/service/AudioPolicyService.cpp
@@ -185,21 +185,21 @@
}
}
-void AudioPolicyService::onRecordingConfigurationUpdate(int event, audio_session_t session,
- audio_source_t source, const audio_config_base_t *clientConfig,
+void AudioPolicyService::onRecordingConfigurationUpdate(int event,
+ const record_client_info_t *clientInfo, const audio_config_base_t *clientConfig,
const audio_config_base_t *deviceConfig, audio_patch_handle_t patchHandle)
{
- mOutputCommandThread->recordingConfigurationUpdateCommand(event, session, source,
+ mOutputCommandThread->recordingConfigurationUpdateCommand(event, clientInfo,
clientConfig, deviceConfig, patchHandle);
}
-void AudioPolicyService::doOnRecordingConfigurationUpdate(int event, audio_session_t session,
- audio_source_t source, const audio_config_base_t *clientConfig,
+void AudioPolicyService::doOnRecordingConfigurationUpdate(int event,
+ const record_client_info_t *clientInfo, const audio_config_base_t *clientConfig,
const audio_config_base_t *deviceConfig, audio_patch_handle_t patchHandle)
{
Mutex::Autolock _l(mNotificationClientsLock);
for (size_t i = 0; i < mNotificationClients.size(); i++) {
- mNotificationClients.valueAt(i)->onRecordingConfigurationUpdate(event, session, source,
+ mNotificationClients.valueAt(i)->onRecordingConfigurationUpdate(event, clientInfo,
clientConfig, deviceConfig, patchHandle);
}
}
@@ -267,12 +267,12 @@
}
void AudioPolicyService::NotificationClient::onRecordingConfigurationUpdate(
- int event, audio_session_t session, audio_source_t source,
+ int event, const record_client_info_t *clientInfo,
const audio_config_base_t *clientConfig, const audio_config_base_t *deviceConfig,
audio_patch_handle_t patchHandle)
{
if (mAudioPolicyServiceClient != 0) {
- mAudioPolicyServiceClient->onRecordingConfigurationUpdate(event, session, source,
+ mAudioPolicyServiceClient->onRecordingConfigurationUpdate(event, clientInfo,
clientConfig, deviceConfig, patchHandle);
}
}
@@ -544,8 +544,8 @@
break;
}
mLock.unlock();
- svc->doOnRecordingConfigurationUpdate(data->mEvent, data->mSession,
- data->mSource, &data->mClientConfig, &data->mDeviceConfig,
+ svc->doOnRecordingConfigurationUpdate(data->mEvent, &data->mClientInfo,
+ &data->mClientConfig, &data->mDeviceConfig,
data->mPatchHandle);
mLock.lock();
} break;
@@ -810,7 +810,7 @@
}
void AudioPolicyService::AudioCommandThread::recordingConfigurationUpdateCommand(
- int event, audio_session_t session, audio_source_t source,
+ int event, const record_client_info_t *clientInfo,
const audio_config_base_t *clientConfig, const audio_config_base_t *deviceConfig,
audio_patch_handle_t patchHandle)
{
@@ -818,14 +818,13 @@
command->mCommand = RECORDING_CONFIGURATION_UPDATE;
RecordingConfigurationUpdateData *data = new RecordingConfigurationUpdateData();
data->mEvent = event;
- data->mSession = session;
- data->mSource = source;
+ data->mClientInfo = *clientInfo;
data->mClientConfig = *clientConfig;
data->mDeviceConfig = *deviceConfig;
data->mPatchHandle = patchHandle;
command->mParam = data;
- ALOGV("AudioCommandThread() adding recording configuration update event %d, source %d",
- event, source);
+ ALOGV("AudioCommandThread() adding recording configuration update event %d, source %d uid %u",
+ event, clientInfo->source, clientInfo->uid);
sendCommand(command);
}
@@ -860,7 +859,7 @@
}
// check same pending commands with later time stamps and eliminate them
- for (i = mAudioCommands.size()-1; i >= 0; i--) {
+ for (i = (ssize_t)mAudioCommands.size()-1; i >= 0; i--) {
sp<AudioCommand> command2 = mAudioCommands[i];
// commands are sorted by increasing time stamp: no need to scan the rest of mAudioCommands
if (command2->mTime <= command->mTime) break;
diff --git a/services/audiopolicy/service/AudioPolicyService.h b/services/audiopolicy/service/AudioPolicyService.h
index 35542f1..38d4b17 100644
--- a/services/audiopolicy/service/AudioPolicyService.h
+++ b/services/audiopolicy/service/AudioPolicyService.h
@@ -228,11 +228,11 @@
void onDynamicPolicyMixStateUpdate(const String8& regId, int32_t state);
void doOnDynamicPolicyMixStateUpdate(const String8& regId, int32_t state);
- void onRecordingConfigurationUpdate(int event, audio_session_t session,
- audio_source_t source, const audio_config_base_t *clientConfig,
+ void onRecordingConfigurationUpdate(int event, const record_client_info_t *clientInfo,
+ const audio_config_base_t *clientConfig,
const audio_config_base_t *deviceConfig, audio_patch_handle_t patchHandle);
- void doOnRecordingConfigurationUpdate(int event, audio_session_t session,
- audio_source_t source, const audio_config_base_t *clientConfig,
+ void doOnRecordingConfigurationUpdate(int event, const record_client_info_t *clientInfo,
+ const audio_config_base_t *clientConfig,
const audio_config_base_t *deviceConfig, audio_patch_handle_t patchHandle);
private:
@@ -306,8 +306,8 @@
int delayMs);
void dynamicPolicyMixStateUpdateCommand(const String8& regId, int32_t state);
void recordingConfigurationUpdateCommand(
- int event, audio_session_t session,
- audio_source_t source,
+ int event,
+ const record_client_info_t *clientInfo,
const audio_config_base_t *clientConfig,
const audio_config_base_t *deviceConfig,
audio_patch_handle_t patchHandle);
@@ -404,8 +404,7 @@
class RecordingConfigurationUpdateData : public AudioCommandData {
public:
int mEvent;
- audio_session_t mSession;
- audio_source_t mSource;
+ record_client_info_t mClientInfo;
struct audio_config_base mClientConfig;
struct audio_config_base mDeviceConfig;
audio_patch_handle_t mPatchHandle;
@@ -518,7 +517,7 @@
virtual void onAudioPatchListUpdate();
virtual void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state);
virtual void onRecordingConfigurationUpdate(int event,
- audio_session_t session, audio_source_t source,
+ const record_client_info_t *clientInfo,
const audio_config_base_t *clientConfig,
const audio_config_base_t *deviceConfig, audio_patch_handle_t patchHandle);
@@ -540,8 +539,7 @@
void onAudioPatchListUpdate();
void onDynamicPolicyMixStateUpdate(const String8& regId, int32_t state);
void onRecordingConfigurationUpdate(
- int event, audio_session_t session,
- audio_source_t source,
+ int event, const record_client_info_t *clientInfo,
const audio_config_base_t *clientConfig,
const audio_config_base_t *deviceConfig,
audio_patch_handle_t patchHandle);
diff --git a/services/camera/libcameraservice/Android.mk b/services/camera/libcameraservice/Android.mk
index f1cdea3..cb415f5 100644
--- a/services/camera/libcameraservice/Android.mk
+++ b/services/camera/libcameraservice/Android.mk
@@ -60,6 +60,7 @@
LOCAL_SHARED_LIBRARIES:= \
libui \
liblog \
+ libutilscallstack \
libutils \
libbinder \
libcutils \
@@ -77,7 +78,8 @@
android.hardware.camera.common@1.0 \
android.hardware.camera.provider@2.4 \
android.hardware.camera.device@1.0 \
- android.hardware.camera.device@3.2
+ android.hardware.camera.device@3.2 \
+ android.hardware.camera.device@3.3
LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libbinder libcamera_client libfmq
@@ -90,9 +92,6 @@
LOCAL_CFLAGS += -Wall -Wextra -Werror
-# Workaround for invalid unused-lambda-capture warning http://b/38349491
-LOCAL_CLANG_CFLAGS += -Wno-error=unused-lambda-capture
-
LOCAL_MODULE:= libcameraservice
include $(BUILD_SHARED_LIBRARY)
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 20bd5e4..514d37a 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -243,29 +243,10 @@
}
if (!cameraFound) {
- hardware::camera::common::V1_0::CameraResourceCost cost;
- res = mCameraProviderManager->getResourceCost(cameraId, &cost);
- if (res != OK) {
- ALOGE("Failed to query device resource cost: %s (%d)", strerror(-res), res);
- continue;
- }
- std::set<String8> conflicting;
- for (size_t i = 0; i < cost.conflictingDevices.size(); i++) {
- conflicting.emplace(String8(cost.conflictingDevices[i].c_str()));
- }
-
- {
- Mutex::Autolock lock(mCameraStatesLock);
- mCameraStates.emplace(id8,
- std::make_shared<CameraState>(id8, cost.resourceCost, conflicting));
- }
+ addStates(id8);
}
onDeviceStatusChanged(id8, CameraDeviceStatus::PRESENT);
-
- if (mFlashlight->hasFlashUnit(id8)) {
- mTorchStatusMap.add(id8, TorchModeStatus::AVAILABLE_OFF);
- }
}
return OK;
@@ -300,6 +281,42 @@
enumerateProviders();
}
+void CameraService::addStates(const String8 id) {
+ std::string cameraId(id.c_str());
+ hardware::camera::common::V1_0::CameraResourceCost cost;
+ status_t res = mCameraProviderManager->getResourceCost(cameraId, &cost);
+ if (res != OK) {
+ ALOGE("Failed to query device resource cost: %s (%d)", strerror(-res), res);
+ return;
+ }
+ std::set<String8> conflicting;
+ for (size_t i = 0; i < cost.conflictingDevices.size(); i++) {
+ conflicting.emplace(String8(cost.conflictingDevices[i].c_str()));
+ }
+
+ {
+ Mutex::Autolock lock(mCameraStatesLock);
+ mCameraStates.emplace(id, std::make_shared<CameraState>(id, cost.resourceCost,
+ conflicting));
+ }
+
+ if (mFlashlight->hasFlashUnit(id)) {
+ mTorchStatusMap.add(id, TorchModeStatus::AVAILABLE_OFF);
+ }
+ logDeviceAdded(id, "Device added");
+}
+
+void CameraService::removeStates(const String8 id) {
+ if (mFlashlight->hasFlashUnit(id)) {
+ mTorchStatusMap.removeItem(id);
+ }
+
+ {
+ Mutex::Autolock lock(mCameraStatesLock);
+ mCameraStates.erase(id);
+ }
+}
+
void CameraService::onDeviceStatusChanged(const String8& id,
CameraDeviceStatus newHalStatus) {
ALOGI("%s: Status changed for cameraId=%s, newStatus=%d", __FUNCTION__,
@@ -311,8 +328,13 @@
if (state == nullptr) {
if (newStatus == StatusInternal::PRESENT) {
- ALOGW("%s: Unknown camera ID %s, probably newly registered?",
+ ALOGI("%s: Unknown camera ID %s, a new camera is added",
__FUNCTION__, id.string());
+
+ // First add as absent to make sure clients are notified below
+ addStates(id);
+
+ updateStatus(newStatus, id);
} else {
ALOGE("%s: Bad camera ID %s", __FUNCTION__, id.string());
}
@@ -359,6 +381,7 @@
clientToDisconnect->disconnect();
}
+ removeStates(id);
} else {
if (oldStatus == StatusInternal::NOT_PRESENT) {
logDeviceAdded(id, String8::format("Device status changed from %d to %d", oldStatus,
@@ -2229,8 +2252,11 @@
mClientPackageName);
mOpsActive = false;
+ // This function is called when a client disconnects. This should
+ // release the camera, but actually only if it was in a proper
+ // functional state, i.e. with status NOT_AVAILABLE
std::initializer_list<StatusInternal> rejected = {StatusInternal::PRESENT,
- StatusInternal::ENUMERATING};
+ StatusInternal::ENUMERATING, StatusInternal::NOT_PRESENT};
// Transition to PRESENT if the camera is not in either of the rejected states
sCameraService->updateStatus(StatusInternal::PRESENT,
@@ -2322,7 +2348,7 @@
CameraService::CameraState::CameraState(const String8& id, int cost,
const std::set<String8>& conflicting) : mId(id),
- mStatus(StatusInternal::PRESENT), mCost(cost), mConflicting(conflicting) {}
+ mStatus(StatusInternal::NOT_PRESENT), mCost(cost), mConflicting(conflicting) {}
CameraService::CameraState::~CameraState() {}
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index 6d5dde8..12ca372 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -512,6 +512,10 @@
// Eumerate all camera providers in the system
status_t enumerateProviders();
+ // Add a new camera to camera and torch state lists or remove an unplugged one
+ void addStates(const String8 id);
+ void removeStates(const String8 id);
+
// Check if we can connect, before we acquire the service lock.
// The returned originalClientPid is the PID of the original process that wants to connect to
// camera.
diff --git a/services/camera/libcameraservice/api1/Camera2Client.cpp b/services/camera/libcameraservice/api1/Camera2Client.cpp
index a28518e..2cf648f 100644
--- a/services/camera/libcameraservice/api1/Camera2Client.cpp
+++ b/services/camera/libcameraservice/api1/Camera2Client.cpp
@@ -72,6 +72,20 @@
return initializeImpl(manager);
}
+bool Camera2Client::isZslEnabledInStillTemplate() {
+ bool zslEnabled = false;
+ CameraMetadata stillTemplate;
+ status_t res = mDevice->createDefaultRequest(CAMERA2_TEMPLATE_STILL_CAPTURE, &stillTemplate);
+ if (res == OK) {
+ camera_metadata_entry_t enableZsl = stillTemplate.find(ANDROID_CONTROL_ENABLE_ZSL);
+ if (enableZsl.count == 1) {
+ zslEnabled = (enableZsl.data.u8[0] == ANDROID_CONTROL_ENABLE_ZSL_TRUE);
+ }
+ }
+
+ return zslEnabled;
+}
+
template<typename TProviderPtr>
status_t Camera2Client::initializeImpl(TProviderPtr providerPtr)
{
@@ -93,6 +107,8 @@
__FUNCTION__, mCameraId, strerror(-res), res);
return NO_INIT;
}
+
+ l.mParameters.isDeviceZslSupported = isZslEnabledInStillTemplate();
}
String8 threadName;
diff --git a/services/camera/libcameraservice/api1/Camera2Client.h b/services/camera/libcameraservice/api1/Camera2Client.h
index 72315d4..5af74eb 100644
--- a/services/camera/libcameraservice/api1/Camera2Client.h
+++ b/services/camera/libcameraservice/api1/Camera2Client.h
@@ -224,6 +224,8 @@
template<typename TProviderPtr>
status_t initializeImpl(TProviderPtr providerPtr);
+
+ bool isZslEnabledInStillTemplate();
};
}; // namespace android
diff --git a/services/camera/libcameraservice/api1/CameraClient.cpp b/services/camera/libcameraservice/api1/CameraClient.cpp
index a407d0b..e848a3f 100644
--- a/services/camera/libcameraservice/api1/CameraClient.cpp
+++ b/services/camera/libcameraservice/api1/CameraClient.cpp
@@ -136,7 +136,12 @@
const char *enddump = "\n\n";
write(fd, enddump, strlen(enddump));
- return mHardware->dump(fd, args);
+ sp<CameraHardwareInterface> hardware = mHardware;
+ if (hardware != nullptr) {
+ return hardware->dump(fd, args);
+ }
+ ALOGI("%s: camera device closed already, skip dumping", __FUNCTION__);
+ return OK;
}
// ----------------------------------------------------------------------------
@@ -503,7 +508,7 @@
void CameraClient::releaseRecordingFrameHandle(native_handle_t *handle) {
if (handle == nullptr) return;
-
+ Mutex::Autolock lock(mLock);
sp<IMemory> dataPtr;
{
Mutex::Autolock l(mAvailableCallbackBuffersLock);
@@ -527,17 +532,22 @@
return;
}
- VideoNativeHandleMetadata *metadata = (VideoNativeHandleMetadata*)(dataPtr->pointer());
- metadata->eType = kMetadataBufferTypeNativeHandleSource;
- metadata->pHandle = handle;
-
- mHardware->releaseRecordingFrame(dataPtr);
+ if (mHardware != nullptr) {
+ VideoNativeHandleMetadata *metadata = (VideoNativeHandleMetadata*)(dataPtr->pointer());
+ metadata->eType = kMetadataBufferTypeNativeHandleSource;
+ metadata->pHandle = handle;
+ mHardware->releaseRecordingFrame(dataPtr);
+ }
}
void CameraClient::releaseRecordingFrameHandleBatch(const std::vector<native_handle_t*>& handles) {
+ Mutex::Autolock lock(mLock);
+ bool disconnected = (mHardware == nullptr);
size_t n = handles.size();
std::vector<sp<IMemory>> frames;
- frames.reserve(n);
+ if (!disconnected) {
+ frames.reserve(n);
+ }
bool error = false;
for (auto& handle : handles) {
sp<IMemory> dataPtr;
@@ -561,10 +571,12 @@
break;
}
- VideoNativeHandleMetadata *metadata = (VideoNativeHandleMetadata*)(dataPtr->pointer());
- metadata->eType = kMetadataBufferTypeNativeHandleSource;
- metadata->pHandle = handle;
- frames.push_back(dataPtr);
+ if (!disconnected) {
+ VideoNativeHandleMetadata *metadata = (VideoNativeHandleMetadata*)(dataPtr->pointer());
+ metadata->eType = kMetadataBufferTypeNativeHandleSource;
+ metadata->pHandle = handle;
+ frames.push_back(dataPtr);
+ }
}
if (error) {
@@ -572,7 +584,7 @@
native_handle_close(handle);
native_handle_delete(handle);
}
- } else {
+ } else if (!disconnected) {
mHardware->releaseRecordingFrameBatch(frames);
}
return;
diff --git a/services/camera/libcameraservice/api1/client2/CallbackProcessor.cpp b/services/camera/libcameraservice/api1/client2/CallbackProcessor.cpp
index 3f4017f..0d2dba1 100644
--- a/services/camera/libcameraservice/api1/client2/CallbackProcessor.cpp
+++ b/services/camera/libcameraservice/api1/client2/CallbackProcessor.cpp
@@ -121,18 +121,17 @@
if (mCallbackStreamId != NO_STREAM) {
// Check if stream parameters have to change
- uint32_t currentWidth, currentHeight, currentFormat;
- res = device->getStreamInfo(mCallbackStreamId,
- ¤tWidth, ¤tHeight, ¤tFormat, 0);
+ CameraDeviceBase::StreamInfo streamInfo;
+ res = device->getStreamInfo(mCallbackStreamId, &streamInfo);
if (res != OK) {
ALOGE("%s: Camera %d: Error querying callback output stream info: "
"%s (%d)", __FUNCTION__, mId,
strerror(-res), res);
return res;
}
- if (currentWidth != (uint32_t)params.previewWidth ||
- currentHeight != (uint32_t)params.previewHeight ||
- currentFormat != (uint32_t)callbackFormat) {
+ if (streamInfo.width != (uint32_t)params.previewWidth ||
+ streamInfo.height != (uint32_t)params.previewHeight ||
+ !streamInfo.matchFormat((uint32_t)callbackFormat)) {
// Since size should only change while preview is not running,
// assuming that all existing use of old callback stream is
// completed.
diff --git a/services/camera/libcameraservice/api1/client2/JpegProcessor.cpp b/services/camera/libcameraservice/api1/client2/JpegProcessor.cpp
index d6d8dde..d8b7af2 100644
--- a/services/camera/libcameraservice/api1/client2/JpegProcessor.cpp
+++ b/services/camera/libcameraservice/api1/client2/JpegProcessor.cpp
@@ -136,17 +136,16 @@
if (mCaptureStreamId != NO_STREAM) {
// Check if stream parameters have to change
- uint32_t currentWidth, currentHeight;
- res = device->getStreamInfo(mCaptureStreamId,
- ¤tWidth, ¤tHeight, 0, 0);
+ CameraDeviceBase::StreamInfo streamInfo;
+ res = device->getStreamInfo(mCaptureStreamId, &streamInfo);
if (res != OK) {
ALOGE("%s: Camera %d: Error querying capture output stream info: "
"%s (%d)", __FUNCTION__,
mId, strerror(-res), res);
return res;
}
- if (currentWidth != (uint32_t)params.pictureWidth ||
- currentHeight != (uint32_t)params.pictureHeight) {
+ if (streamInfo.width != (uint32_t)params.pictureWidth ||
+ streamInfo.height != (uint32_t)params.pictureHeight) {
ALOGV("%s: Camera %d: Deleting stream %d since the buffer dimensions changed",
__FUNCTION__, mId, mCaptureStreamId);
res = device->deleteStream(mCaptureStreamId);
diff --git a/services/camera/libcameraservice/api1/client2/Parameters.cpp b/services/camera/libcameraservice/api1/client2/Parameters.cpp
index 1addcdd..050c3f7 100644
--- a/services/camera/libcameraservice/api1/client2/Parameters.cpp
+++ b/services/camera/libcameraservice/api1/client2/Parameters.cpp
@@ -954,7 +954,8 @@
}
}
- if (slowJpegMode || property_get_bool("camera.disable_zsl_mode", false)) {
+ if (isDeviceZslSupported || slowJpegMode ||
+ property_get_bool("camera.disable_zsl_mode", false)) {
ALOGI("Camera %d: Disabling ZSL mode", cameraId);
allowZslMode = false;
} else {
@@ -1323,8 +1324,8 @@
{
const char *fpsRange, *fpsSingle;
- fpsRange = newParams.get(CameraParameters::KEY_PREVIEW_FRAME_RATE);
- fpsSingle = newParams.get(CameraParameters::KEY_PREVIEW_FPS_RANGE);
+ fpsSingle = newParams.get(CameraParameters::KEY_PREVIEW_FRAME_RATE);
+ fpsRange = newParams.get(CameraParameters::KEY_PREVIEW_FPS_RANGE);
/**
* Pick either the range or the single key if only one was set.
@@ -1997,7 +1998,8 @@
if (previewFpsRange[1] > 1e9/minFrameDurationNs + FPS_MARGIN) {
slowJpegMode = true;
}
- if (slowJpegMode || property_get_bool("camera.disable_zsl_mode", false)) {
+ if (isDeviceZslSupported || slowJpegMode ||
+ property_get_bool("camera.disable_zsl_mode", false)) {
allowZslMode = false;
} else {
allowZslMode = isZslReprocessPresent;
diff --git a/services/camera/libcameraservice/api1/client2/Parameters.h b/services/camera/libcameraservice/api1/client2/Parameters.h
index bea867a..17e3d75 100644
--- a/services/camera/libcameraservice/api1/client2/Parameters.h
+++ b/services/camera/libcameraservice/api1/client2/Parameters.h
@@ -175,6 +175,8 @@
bool slowJpegMode;
// Whether ZSL reprocess is supported by the device.
bool isZslReprocessPresent;
+ // Whether the device supports enableZsl.
+ bool isDeviceZslSupported;
// Overall camera state
enum State {
diff --git a/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp b/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp
index d79e430..73dca73 100644
--- a/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp
+++ b/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp
@@ -161,18 +161,17 @@
if (mPreviewStreamId != NO_STREAM) {
// Check if stream parameters have to change
- uint32_t currentWidth, currentHeight;
- res = device->getStreamInfo(mPreviewStreamId,
- ¤tWidth, ¤tHeight, 0, 0);
+ CameraDeviceBase::StreamInfo streamInfo;
+ res = device->getStreamInfo(mPreviewStreamId, &streamInfo);
if (res != OK) {
ALOGE("%s: Camera %d: Error querying preview stream info: "
"%s (%d)", __FUNCTION__, mId, strerror(-res), res);
return res;
}
- if (currentWidth != (uint32_t)params.previewWidth ||
- currentHeight != (uint32_t)params.previewHeight) {
+ if (streamInfo.width != (uint32_t)params.previewWidth ||
+ streamInfo.height != (uint32_t)params.previewHeight) {
ALOGV("%s: Camera %d: Preview size switch: %d x %d -> %d x %d",
- __FUNCTION__, mId, currentWidth, currentHeight,
+ __FUNCTION__, mId, streamInfo.width, streamInfo.height,
params.previewWidth, params.previewHeight);
res = device->waitUntilDrained();
if (res != OK) {
@@ -312,10 +311,8 @@
return INVALID_OPERATION;
}
- uint32_t currentWidth, currentHeight, currentFormat;
- android_dataspace currentDataSpace;
- res = device->getStreamInfo(mRecordingStreamId,
- ¤tWidth, ¤tHeight, ¤tFormat, ¤tDataSpace);
+ CameraDeviceBase::StreamInfo streamInfo;
+ res = device->getStreamInfo(mRecordingStreamId, &streamInfo);
if (res != OK) {
ALOGE("%s: Camera %d: Error querying recording output stream info: "
"%s (%d)", __FUNCTION__, mId,
@@ -324,10 +321,10 @@
}
if (mRecordingWindow == nullptr ||
- currentWidth != (uint32_t)params.videoWidth ||
- currentHeight != (uint32_t)params.videoHeight ||
- currentFormat != (uint32_t)params.videoFormat ||
- currentDataSpace != params.videoDataSpace) {
+ streamInfo.width != (uint32_t)params.videoWidth ||
+ streamInfo.height != (uint32_t)params.videoHeight ||
+ !streamInfo.matchFormat((uint32_t)params.videoFormat) ||
+ !streamInfo.matchDataSpace(params.videoDataSpace)) {
*needsUpdate = true;
return res;
}
@@ -348,22 +345,18 @@
if (mRecordingStreamId != NO_STREAM) {
// Check if stream parameters have to change
- uint32_t currentWidth, currentHeight;
- uint32_t currentFormat;
- android_dataspace currentDataSpace;
- res = device->getStreamInfo(mRecordingStreamId,
- ¤tWidth, ¤tHeight,
- ¤tFormat, ¤tDataSpace);
+ CameraDeviceBase::StreamInfo streamInfo;
+ res = device->getStreamInfo(mRecordingStreamId, &streamInfo);
if (res != OK) {
ALOGE("%s: Camera %d: Error querying recording output stream info: "
"%s (%d)", __FUNCTION__, mId,
strerror(-res), res);
return res;
}
- if (currentWidth != (uint32_t)params.videoWidth ||
- currentHeight != (uint32_t)params.videoHeight ||
- currentFormat != (uint32_t)params.videoFormat ||
- currentDataSpace != params.videoDataSpace) {
+ if (streamInfo.width != (uint32_t)params.videoWidth ||
+ streamInfo.height != (uint32_t)params.videoHeight ||
+ !streamInfo.matchFormat((uint32_t)params.videoFormat) ||
+ !streamInfo.matchDataSpace(params.videoDataSpace)) {
// TODO: Should wait to be sure previous recording has finished
res = device->deleteStream(mRecordingStreamId);
diff --git a/services/camera/libcameraservice/api1/client2/ZslProcessor.cpp b/services/camera/libcameraservice/api1/client2/ZslProcessor.cpp
index 9bc31b9..b0607fb 100644
--- a/services/camera/libcameraservice/api1/client2/ZslProcessor.cpp
+++ b/services/camera/libcameraservice/api1/client2/ZslProcessor.cpp
@@ -233,17 +233,16 @@
if ((mZslStreamId != NO_STREAM) || (mInputStreamId != NO_STREAM)) {
// Check if stream parameters have to change
- uint32_t currentWidth, currentHeight;
- res = device->getStreamInfo(mZslStreamId,
- ¤tWidth, ¤tHeight, 0, 0);
+ CameraDeviceBase::StreamInfo streamInfo;
+ res = device->getStreamInfo(mZslStreamId, &streamInfo);
if (res != OK) {
ALOGE("%s: Camera %d: Error querying capture output stream info: "
"%s (%d)", __FUNCTION__,
client->getCameraId(), strerror(-res), res);
return res;
}
- if (currentWidth != (uint32_t)params.fastInfo.arrayWidth ||
- currentHeight != (uint32_t)params.fastInfo.arrayHeight) {
+ if (streamInfo.width != (uint32_t)params.fastInfo.arrayWidth ||
+ streamInfo.height != (uint32_t)params.fastInfo.arrayHeight) {
if (mZslStreamId != NO_STREAM) {
ALOGV("%s: Camera %d: Deleting stream %d since the buffer "
"dimensions changed",
diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
index 0429e7f..09c2d82 100644
--- a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
+++ b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
@@ -313,11 +313,13 @@
binder::Status CameraDeviceClient::beginConfigure() {
// TODO: Implement this.
+ ATRACE_CALL();
ALOGV("%s: Not implemented yet.", __FUNCTION__);
return binder::Status::ok();
}
binder::Status CameraDeviceClient::endConfigure(int operatingMode) {
+ ATRACE_CALL();
ALOGV("%s: ending configure (%d input stream, %zu output surfaces)",
__FUNCTION__, mInputStream.configured ? 1 : 0,
mStreamMap.size());
@@ -568,7 +570,7 @@
/*out*/
int* newStreamId) {
int width, height, format, surfaceType;
- int32_t consumerUsage;
+ uint64_t consumerUsage;
android_dataspace dataSpace;
status_t err;
binder::Status res;
@@ -666,7 +668,7 @@
if (mInputStream.configured) {
String8 msg = String8::format("Camera %s: Already has an input stream "
- "configured (ID %zd)", mCameraIdStr.string(), mInputStream.id);
+ "configured (ID %d)", mCameraIdStr.string(), mInputStream.id);
ALOGE("%s: %s", __FUNCTION__, msg.string() );
return STATUS_ERROR(CameraService::ERROR_ALREADY_EXISTS, msg.string());
}
@@ -764,24 +766,23 @@
// Query consumer usage bits to set async operation mode for
// GLConsumer using controlledByApp parameter.
bool useAsync = false;
- int32_t consumerUsage;
+ uint64_t consumerUsage = 0;
status_t err;
- if ((err = gbp->query(NATIVE_WINDOW_CONSUMER_USAGE_BITS,
- &consumerUsage)) != OK) {
+ if ((err = gbp->getConsumerUsage(&consumerUsage)) != OK) {
String8 msg = String8::format("Camera %s: Failed to query Surface consumer usage: %s (%d)",
mCameraIdStr.string(), strerror(-err), err);
ALOGE("%s: %s", __FUNCTION__, msg.string());
return STATUS_ERROR(CameraService::ERROR_INVALID_OPERATION, msg.string());
}
if (consumerUsage & GraphicBuffer::USAGE_HW_TEXTURE) {
- ALOGW("%s: Camera %s with consumer usage flag: 0x%x: Forcing asynchronous mode for stream",
+ ALOGW("%s: Camera %s with consumer usage flag: %" PRIu64 ": Forcing asynchronous mode for stream",
__FUNCTION__, mCameraIdStr.string(), consumerUsage);
useAsync = true;
}
- int32_t disallowedFlags = GraphicBuffer::USAGE_HW_VIDEO_ENCODER |
+ uint64_t disallowedFlags = GraphicBuffer::USAGE_HW_VIDEO_ENCODER |
GRALLOC_USAGE_RENDERSCRIPT;
- int32_t allowedFlags = GraphicBuffer::USAGE_SW_READ_MASK |
+ uint64_t allowedFlags = GraphicBuffer::USAGE_SW_READ_MASK |
GraphicBuffer::USAGE_HW_TEXTURE |
GraphicBuffer::USAGE_HW_COMPOSER;
bool flexibleConsumer = (consumerUsage & disallowedFlags) == 0 &&
@@ -874,7 +875,7 @@
//surface class type. Use usage flag to approximate the comparison.
if (consumerUsage != streamInfo.consumerUsage) {
String8 msg = String8::format(
- "Camera %s:Surface usage flag doesn't match 0x%x vs 0x%x",
+ "Camera %s:Surface usage flag doesn't match %" PRIu64 " vs %" PRIu64 "",
mCameraIdStr.string(), consumerUsage, streamInfo.consumerUsage);
ALOGE("%s: %s", __FUNCTION__, msg.string());
return STATUS_ERROR(CameraService::ERROR_ILLEGAL_ARGUMENT, msg.string());
@@ -1353,7 +1354,7 @@
sp<hardware::camera2::ICameraDeviceCallbacks> remoteCb = getRemoteCallback();
if (remoteCb != 0) {
- remoteCb->onRepeatingRequestError(lastFrameNumber);
+ remoteCb->onRepeatingRequestError(lastFrameNumber, mStreamingRequestId);
}
Mutex::Autolock idLock(mStreamingRequestIdLock);
diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.h b/services/camera/libcameraservice/api2/CameraDeviceClient.h
index e8fc080..50661cb 100644
--- a/services/camera/libcameraservice/api2/CameraDeviceClient.h
+++ b/services/camera/libcameraservice/api2/CameraDeviceClient.h
@@ -213,13 +213,13 @@
int height;
int format;
android_dataspace dataSpace;
- int32_t consumerUsage;
+ uint64_t consumerUsage;
bool finalized = false;
OutputStreamInfo() :
width(-1), height(-1), format(-1), dataSpace(HAL_DATASPACE_UNKNOWN),
consumerUsage(0) {}
OutputStreamInfo(int _width, int _height, int _format, android_dataspace _dataSpace,
- int32_t _consumerUsage) :
+ uint64_t _consumerUsage) :
width(_width), height(_height), format(_format),
dataSpace(_dataSpace), consumerUsage(_consumerUsage) {}
};
diff --git a/services/camera/libcameraservice/common/CameraDeviceBase.h b/services/camera/libcameraservice/common/CameraDeviceBase.h
index d9059f3..3919bfa 100644
--- a/services/camera/libcameraservice/common/CameraDeviceBase.h
+++ b/services/camera/libcameraservice/common/CameraDeviceBase.h
@@ -119,7 +119,7 @@
uint32_t width, uint32_t height, int format,
android_dataspace dataSpace, camera3_stream_rotation_t rotation, int *id,
int streamSetId = camera3::CAMERA3_STREAM_SET_ID_INVALID,
- bool isShared = false, uint32_t consumerUsage = 0) = 0;
+ bool isShared = false, uint64_t consumerUsage = 0) = 0;
/**
* Create an output stream of the requested size, format, rotation and
@@ -132,7 +132,7 @@
bool hasDeferredConsumer, uint32_t width, uint32_t height, int format,
android_dataspace dataSpace, camera3_stream_rotation_t rotation, int *id,
int streamSetId = camera3::CAMERA3_STREAM_SET_ID_INVALID,
- bool isShared = false, uint32_t consumerUsage = 0) = 0;
+ bool isShared = false, uint64_t consumerUsage = 0) = 0;
/**
* Create an input stream of width, height, and format.
@@ -142,12 +142,51 @@
virtual status_t createInputStream(uint32_t width, uint32_t height,
int32_t format, /*out*/ int32_t *id) = 0;
+ struct StreamInfo {
+ uint32_t width;
+ uint32_t height;
+
+ uint32_t format;
+ bool formatOverridden;
+ uint32_t originalFormat;
+
+ android_dataspace dataSpace;
+ bool dataSpaceOverridden;
+ android_dataspace originalDataSpace;
+
+ StreamInfo() : width(0), height(0), format(0), formatOverridden(false), originalFormat(0),
+ dataSpace(HAL_DATASPACE_UNKNOWN), dataSpaceOverridden(false),
+ originalDataSpace(HAL_DATASPACE_UNKNOWN) {}
+ /**
+ * Check whether the format matches the current or the original one in case
+ * it got overridden.
+ */
+ bool matchFormat(uint32_t clientFormat) const {
+ if ((formatOverridden && (originalFormat == clientFormat)) ||
+ (format == clientFormat)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Check whether the dataspace matches the current or the original one in case
+ * it got overridden.
+ */
+ bool matchDataSpace(android_dataspace clientDataSpace) const {
+ if ((dataSpaceOverridden && (originalDataSpace == clientDataSpace)) ||
+ (dataSpace == clientDataSpace)) {
+ return true;
+ }
+ return false;
+ }
+
+ };
+
/**
* Get information about a given stream.
*/
- virtual status_t getStreamInfo(int id,
- uint32_t *width, uint32_t *height,
- uint32_t *format, android_dataspace *dataSpace) = 0;
+ virtual status_t getStreamInfo(int id, StreamInfo *streamInfo) = 0;
/**
* Set stream gralloc buffer transform
diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp
index a02090b..b3d1132 100644
--- a/services/camera/libcameraservice/common/CameraProviderManager.cpp
+++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp
@@ -202,12 +202,17 @@
for (auto& provider : mProviders) {
auto deviceInfo = findDeviceInfoLocked(id);
if (deviceInfo != nullptr) {
- provider->mInterface->isSetTorchModeSupported(
+ auto ret = provider->mInterface->isSetTorchModeSupported(
[&support](auto status, bool supported) {
if (status == Status::OK) {
support = supported;
}
});
+ if (!ret.isOk()) {
+ ALOGE("%s: Transaction error checking torch mode support '%s': %s",
+ __FUNCTION__, provider->mProviderName.c_str(), ret.description().c_str());
+ }
+ break;
}
}
return support;
@@ -596,6 +601,15 @@
return OK;
}
+void CameraProviderManager::ProviderInfo::removeDevice(std::string id) {
+ for (auto it = mDevices.begin(); it != mDevices.end(); it++) {
+ if ((*it)->mId == id) {
+ mDevices.erase(it);
+ break;
+ }
+ }
+}
+
status_t CameraProviderManager::ProviderInfo::dump(int fd, const Vector<String16>&) const {
dprintf(fd, "== Camera Provider HAL %s (v2.4, %s) static info: %zu devices: ==\n",
mProviderName.c_str(), mInterface->isRemote() ? "remote" : "passthrough",
@@ -669,6 +683,8 @@
return hardware::Void();
}
addDevice(cameraDeviceName, newStatus, &id);
+ } else if (newStatus == CameraDeviceStatus::NOT_PRESENT) {
+ removeDevice(id);
}
listener = mManager->getStatusListener();
}
diff --git a/services/camera/libcameraservice/common/CameraProviderManager.h b/services/camera/libcameraservice/common/CameraProviderManager.h
index e82282f..b14a2c6 100644
--- a/services/camera/libcameraservice/common/CameraProviderManager.h
+++ b/services/camera/libcameraservice/common/CameraProviderManager.h
@@ -384,6 +384,8 @@
// Generate vendor tag id
static metadata_vendor_id_t generateVendorTagId(const std::string &name);
+
+ void removeDevice(std::string id);
};
// Utility to find a DeviceInfo by ID; pointer is only valid while mInterfaceMutex is held
diff --git a/services/camera/libcameraservice/device1/CameraHardwareInterface.cpp b/services/camera/libcameraservice/device1/CameraHardwareInterface.cpp
index 0fae598..522d521 100644
--- a/services/camera/libcameraservice/device1/CameraHardwareInterface.cpp
+++ b/services/camera/libcameraservice/device1/CameraHardwareInterface.cpp
@@ -29,11 +29,6 @@
CameraHardwareInterface::~CameraHardwareInterface()
{
ALOGI("Destroying camera %s", mName.string());
- if (mDevice) {
- int rc = mDevice->common.close(&mDevice->common);
- if (rc != OK)
- ALOGE("Could not close camera %s: %d", mName.string(), rc);
- }
if (mHidlDevice != nullptr) {
mHidlDevice->close();
mHidlDevice.clear();
@@ -42,12 +37,6 @@
}
status_t CameraHardwareInterface::initialize(sp<CameraProviderManager> manager) {
- if (mDevice) {
- ALOGE("%s: camera hardware interface has been initialized to libhardware path!",
- __FUNCTION__);
- return INVALID_OPERATION;
- }
-
ALOGI("Opening camera %s", mName.string());
status_t ret = manager->openSession(mName.string(), this, &mHidlDevice);
@@ -393,7 +382,7 @@
ALOGE("%s: preview window is null", __FUNCTION__);
return s;
}
- mPreviewUsage = (int) usage;
+ mPreviewUsage = static_cast<uint64_t> (usage);
int rc = native_window_set_usage(a, mPreviewUsage);
if (rc == OK) {
cleanupCirculatingBuffers();
@@ -465,23 +454,6 @@
}
return CameraProviderManager::mapToStatusT(
mHidlDevice->setPreviewWindow(buf.get() ? this : nullptr));
- } else if (mDevice) {
- if (mDevice->ops->set_preview_window) {
- mPreviewWindow = buf;
- if (buf != nullptr) {
- if (mPreviewScalingMode != NOT_SET) {
- setPreviewScalingMode(mPreviewScalingMode);
- }
- if (mPreviewTransform != NOT_SET) {
- setPreviewTransform(mPreviewTransform);
- }
- }
- mHalPreviewWindow.user = this;
- ALOGV("%s &mHalPreviewWindow %p mHalPreviewWindow.user %p",__FUNCTION__,
- &mHalPreviewWindow, mHalPreviewWindow.user);
- return mDevice->ops->set_preview_window(mDevice,
- buf.get() ? &mHalPreviewWindow.nw : 0);
- }
}
return INVALID_OPERATION;
}
@@ -499,15 +471,6 @@
mCbUser = user;
ALOGV("%s(%s)", __FUNCTION__, mName.string());
-
- if (mDevice && mDevice->ops->set_callbacks) {
- mDevice->ops->set_callbacks(mDevice,
- sNotifyCb,
- sDataCb,
- sDataCbTimestamp,
- sGetMemory,
- this);
- }
}
void CameraHardwareInterface::enableMsgType(int32_t msgType)
@@ -515,8 +478,6 @@
ALOGV("%s(%s)", __FUNCTION__, mName.string());
if (CC_LIKELY(mHidlDevice != nullptr)) {
mHidlDevice->enableMsgType(msgType);
- } else if (mDevice && mDevice->ops->enable_msg_type) {
- mDevice->ops->enable_msg_type(mDevice, msgType);
}
}
@@ -525,8 +486,6 @@
ALOGV("%s(%s)", __FUNCTION__, mName.string());
if (CC_LIKELY(mHidlDevice != nullptr)) {
mHidlDevice->disableMsgType(msgType);
- } else if (mDevice && mDevice->ops->disable_msg_type) {
- mDevice->ops->disable_msg_type(mDevice, msgType);
}
}
@@ -535,8 +494,6 @@
ALOGV("%s(%s)", __FUNCTION__, mName.string());
if (CC_LIKELY(mHidlDevice != nullptr)) {
return mHidlDevice->msgTypeEnabled(msgType);
- } else if (mDevice && mDevice->ops->msg_type_enabled) {
- return mDevice->ops->msg_type_enabled(mDevice, msgType);
}
return false;
}
@@ -547,8 +504,6 @@
if (CC_LIKELY(mHidlDevice != nullptr)) {
return CameraProviderManager::mapToStatusT(
mHidlDevice->startPreview());
- } else if (mDevice && mDevice->ops->start_preview) {
- return mDevice->ops->start_preview(mDevice);
}
return INVALID_OPERATION;
}
@@ -558,8 +513,6 @@
ALOGV("%s(%s)", __FUNCTION__, mName.string());
if (CC_LIKELY(mHidlDevice != nullptr)) {
mHidlDevice->stopPreview();
- } else if (mDevice && mDevice->ops->stop_preview) {
- mDevice->ops->stop_preview(mDevice);
}
}
@@ -568,8 +521,6 @@
ALOGV("%s(%s)", __FUNCTION__, mName.string());
if (CC_LIKELY(mHidlDevice != nullptr)) {
return mHidlDevice->previewEnabled();
- } else if (mDevice && mDevice->ops->preview_enabled) {
- return mDevice->ops->preview_enabled(mDevice);
}
return false;
}
@@ -580,8 +531,6 @@
if (CC_LIKELY(mHidlDevice != nullptr)) {
return CameraProviderManager::mapToStatusT(
mHidlDevice->storeMetaDataInBuffers(enable));
- } else if (mDevice && mDevice->ops->store_meta_data_in_buffers) {
- return mDevice->ops->store_meta_data_in_buffers(mDevice, enable);
}
return enable ? INVALID_OPERATION: OK;
}
@@ -592,8 +541,6 @@
if (CC_LIKELY(mHidlDevice != nullptr)) {
return CameraProviderManager::mapToStatusT(
mHidlDevice->startRecording());
- } else if (mDevice && mDevice->ops->start_recording) {
- return mDevice->ops->start_recording(mDevice);
}
return INVALID_OPERATION;
}
@@ -606,8 +553,6 @@
ALOGV("%s(%s)", __FUNCTION__, mName.string());
if (CC_LIKELY(mHidlDevice != nullptr)) {
mHidlDevice->stopRecording();
- } else if (mDevice && mDevice->ops->stop_recording) {
- mDevice->ops->stop_recording(mDevice);
}
}
@@ -619,8 +564,6 @@
ALOGV("%s(%s)", __FUNCTION__, mName.string());
if (CC_LIKELY(mHidlDevice != nullptr)) {
return mHidlDevice->recordingEnabled();
- } else if (mDevice && mDevice->ops->recording_enabled) {
- return mDevice->ops->recording_enabled(mDevice);
}
return false;
}
@@ -645,9 +588,6 @@
} else {
mHidlDevice->releaseRecordingFrame(heapId, bufferIndex);
}
- } else if (mDevice && mDevice->ops->release_recording_frame) {
- void *data = ((uint8_t *)heap->base()) + offset;
- return mDevice->ops->release_recording_frame(mDevice, data);
}
}
@@ -674,9 +614,6 @@
ALOGE("%s only supports VideoNativeHandleMetadata mode", __FUNCTION__);
return;
}
- } else {
- ALOGE("Non HIDL mode do not support %s", __FUNCTION__);
- return;
}
}
@@ -695,8 +632,6 @@
if (CC_LIKELY(mHidlDevice != nullptr)) {
return CameraProviderManager::mapToStatusT(
mHidlDevice->autoFocus());
- } else if (mDevice && mDevice->ops->auto_focus) {
- return mDevice->ops->auto_focus(mDevice);
}
return INVALID_OPERATION;
}
@@ -707,8 +642,6 @@
if (CC_LIKELY(mHidlDevice != nullptr)) {
return CameraProviderManager::mapToStatusT(
mHidlDevice->cancelAutoFocus());
- } else if (mDevice && mDevice->ops->cancel_auto_focus) {
- return mDevice->ops->cancel_auto_focus(mDevice);
}
return INVALID_OPERATION;
}
@@ -719,8 +652,6 @@
if (CC_LIKELY(mHidlDevice != nullptr)) {
return CameraProviderManager::mapToStatusT(
mHidlDevice->takePicture());
- } else if (mDevice && mDevice->ops->take_picture) {
- return mDevice->ops->take_picture(mDevice);
}
return INVALID_OPERATION;
}
@@ -731,8 +662,6 @@
if (CC_LIKELY(mHidlDevice != nullptr)) {
return CameraProviderManager::mapToStatusT(
mHidlDevice->cancelPicture());
- } else if (mDevice && mDevice->ops->cancel_picture) {
- return mDevice->ops->cancel_picture(mDevice);
}
return INVALID_OPERATION;
}
@@ -743,8 +672,6 @@
if (CC_LIKELY(mHidlDevice != nullptr)) {
return CameraProviderManager::mapToStatusT(
mHidlDevice->setParameters(params.flatten().string()));
- } else if (mDevice && mDevice->ops->set_parameters) {
- return mDevice->ops->set_parameters(mDevice, params.flatten().string());
}
return INVALID_OPERATION;
}
@@ -761,14 +688,6 @@
});
String8 tmp(outParam.c_str());
parms.unflatten(tmp);
- } else if (mDevice && mDevice->ops->get_parameters) {
- char *temp = mDevice->ops->get_parameters(mDevice);
- String8 str_parms(temp);
- if (mDevice->ops->put_parameters)
- mDevice->ops->put_parameters(mDevice, temp);
- else
- free(temp);
- parms.unflatten(str_parms);
}
return parms;
}
@@ -779,8 +698,6 @@
if (CC_LIKELY(mHidlDevice != nullptr)) {
return CameraProviderManager::mapToStatusT(
mHidlDevice->sendCommand((CommandType) cmd, arg1, arg2));
- } else if (mDevice && mDevice->ops->send_command) {
- return mDevice->ops->send_command(mDevice, cmd, arg1, arg2);
}
return INVALID_OPERATION;
}
@@ -794,8 +711,6 @@
if (CC_LIKELY(mHidlDevice != nullptr)) {
mHidlDevice->close();
mHidlDevice.clear();
- } else if (mDevice && mDevice->ops->release) {
- mDevice->ops->release(mDevice);
}
}
@@ -811,15 +726,10 @@
Status s = mHidlDevice->dumpState(handle);
native_handle_delete(handle);
return CameraProviderManager::mapToStatusT(s);
- } else if (mDevice && mDevice->ops->dump) {
- return mDevice->ops->dump(mDevice, fd);
}
return OK; // It's fine if the HAL doesn't implement dump()
}
-/**
- * Methods for legacy (non-HIDL) path follows
- */
void CameraHardwareInterface::sNotifyCb(int32_t msg_type, int32_t ext1,
int32_t ext2, void *user)
{
@@ -889,177 +799,4 @@
mem->decStrong(mem);
}
-ANativeWindow* CameraHardwareInterface::sToAnw(void *user)
-{
- CameraHardwareInterface *object =
- reinterpret_cast<CameraHardwareInterface *>(user);
- return object->mPreviewWindow.get();
-}
-#define anw(n) sToAnw(((struct camera_preview_window *)(n))->user)
-#define hwi(n) reinterpret_cast<CameraHardwareInterface *>(\
- ((struct camera_preview_window *)(n))->user)
-
-int CameraHardwareInterface::sDequeueBuffer(struct preview_stream_ops* w,
- buffer_handle_t** buffer, int *stride)
-{
- int rc;
- ANativeWindow *a = anw(w);
- ANativeWindowBuffer* anb;
- rc = native_window_dequeue_buffer_and_wait(a, &anb);
- if (rc == OK) {
- *buffer = &anb->handle;
- *stride = anb->stride;
- }
- return rc;
-}
-
-#ifndef container_of
-#define container_of(ptr, type, member) ({ \
- const __typeof__(((type *) 0)->member) *__mptr = (ptr); \
- (type *) ((char *) __mptr - (char *)(&((type *)0)->member)); })
-#endif
-
-int CameraHardwareInterface::sLockBuffer(struct preview_stream_ops* w,
- buffer_handle_t* /*buffer*/)
-{
- ANativeWindow *a = anw(w);
- (void)a;
- return 0;
-}
-
-int CameraHardwareInterface::sEnqueueBuffer(struct preview_stream_ops* w,
- buffer_handle_t* buffer)
-{
- ANativeWindow *a = anw(w);
- return a->queueBuffer(a,
- container_of(buffer, ANativeWindowBuffer, handle), -1);
-}
-
-int CameraHardwareInterface::sCancelBuffer(struct preview_stream_ops* w,
- buffer_handle_t* buffer)
-{
- ANativeWindow *a = anw(w);
- return a->cancelBuffer(a,
- container_of(buffer, ANativeWindowBuffer, handle), -1);
-}
-
-int CameraHardwareInterface::sSetBufferCount(struct preview_stream_ops* w, int count)
-{
- ANativeWindow *a = anw(w);
-
- if (a != nullptr) {
- // Workaround for b/27039775
- // Previously, setting the buffer count would reset the buffer
- // queue's flag that allows for all buffers to be dequeued on the
- // producer side, instead of just the producer's declared max count,
- // if no filled buffers have yet been queued by the producer. This
- // reset no longer happens, but some HALs depend on this behavior,
- // so it needs to be maintained for HAL backwards compatibility.
- // Simulate the prior behavior by disconnecting/reconnecting to the
- // window and setting the values again. This has the drawback of
- // actually causing memory reallocation, which may not have happened
- // in the past.
- CameraHardwareInterface *hw = hwi(w);
- native_window_api_disconnect(a, NATIVE_WINDOW_API_CAMERA);
- native_window_api_connect(a, NATIVE_WINDOW_API_CAMERA);
- if (hw->mPreviewScalingMode != NOT_SET) {
- native_window_set_scaling_mode(a, hw->mPreviewScalingMode);
- }
- if (hw->mPreviewTransform != NOT_SET) {
- native_window_set_buffers_transform(a, hw->mPreviewTransform);
- }
- if (hw->mPreviewWidth != NOT_SET) {
- native_window_set_buffers_dimensions(a,
- hw->mPreviewWidth, hw->mPreviewHeight);
- native_window_set_buffers_format(a, hw->mPreviewFormat);
- }
- if (hw->mPreviewUsage != 0) {
- native_window_set_usage(a, hw->mPreviewUsage);
- }
- if (hw->mPreviewSwapInterval != NOT_SET) {
- a->setSwapInterval(a, hw->mPreviewSwapInterval);
- }
- if (hw->mPreviewCrop.left != NOT_SET) {
- native_window_set_crop(a, &(hw->mPreviewCrop));
- }
- }
-
- return native_window_set_buffer_count(a, count);
-}
-
-int CameraHardwareInterface::sSetBuffersGeometry(struct preview_stream_ops* w,
- int width, int height, int format)
-{
- int rc;
- ANativeWindow *a = anw(w);
- CameraHardwareInterface *hw = hwi(w);
- hw->mPreviewWidth = width;
- hw->mPreviewHeight = height;
- hw->mPreviewFormat = format;
- rc = native_window_set_buffers_dimensions(a, width, height);
- if (rc == OK) {
- rc = native_window_set_buffers_format(a, format);
- }
- return rc;
-}
-
-int CameraHardwareInterface::sSetCrop(struct preview_stream_ops *w,
- int left, int top, int right, int bottom)
-{
- ANativeWindow *a = anw(w);
- CameraHardwareInterface *hw = hwi(w);
- hw->mPreviewCrop.left = left;
- hw->mPreviewCrop.top = top;
- hw->mPreviewCrop.right = right;
- hw->mPreviewCrop.bottom = bottom;
- return native_window_set_crop(a, &(hw->mPreviewCrop));
-}
-
-int CameraHardwareInterface::sSetTimestamp(struct preview_stream_ops *w,
- int64_t timestamp) {
- ANativeWindow *a = anw(w);
- return native_window_set_buffers_timestamp(a, timestamp);
-}
-
-int CameraHardwareInterface::sSetUsage(struct preview_stream_ops* w, int usage)
-{
- ANativeWindow *a = anw(w);
- CameraHardwareInterface *hw = hwi(w);
- hw->mPreviewUsage = usage;
- return native_window_set_usage(a, usage);
-}
-
-int CameraHardwareInterface::sSetSwapInterval(struct preview_stream_ops *w, int interval)
-{
- ANativeWindow *a = anw(w);
- CameraHardwareInterface *hw = hwi(w);
- hw->mPreviewSwapInterval = interval;
- return a->setSwapInterval(a, interval);
-}
-
-int CameraHardwareInterface::sGetMinUndequeuedBufferCount(
- const struct preview_stream_ops *w,
- int *count)
-{
- ANativeWindow *a = anw(w);
- return a->query(a, NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, count);
-}
-
-void CameraHardwareInterface::initHalPreviewWindow()
-{
- mHalPreviewWindow.nw.cancel_buffer = sCancelBuffer;
- mHalPreviewWindow.nw.lock_buffer = sLockBuffer;
- mHalPreviewWindow.nw.dequeue_buffer = sDequeueBuffer;
- mHalPreviewWindow.nw.enqueue_buffer = sEnqueueBuffer;
- mHalPreviewWindow.nw.set_buffer_count = sSetBufferCount;
- mHalPreviewWindow.nw.set_buffers_geometry = sSetBuffersGeometry;
- mHalPreviewWindow.nw.set_crop = sSetCrop;
- mHalPreviewWindow.nw.set_timestamp = sSetTimestamp;
- mHalPreviewWindow.nw.set_usage = sSetUsage;
- mHalPreviewWindow.nw.set_swap_interval = sSetSwapInterval;
-
- mHalPreviewWindow.nw.get_min_undequeued_buffer_count =
- sGetMinUndequeuedBufferCount;
-}
-
}; // namespace android
diff --git a/services/camera/libcameraservice/device1/CameraHardwareInterface.h b/services/camera/libcameraservice/device1/CameraHardwareInterface.h
index 2f1e2e9..e519b04 100644
--- a/services/camera/libcameraservice/device1/CameraHardwareInterface.h
+++ b/services/camera/libcameraservice/device1/CameraHardwareInterface.h
@@ -90,7 +90,6 @@
public:
explicit CameraHardwareInterface(const char *name):
- mDevice(nullptr),
mHidlDevice(nullptr),
mName(name),
mPreviewScalingMode(NOT_SET),
@@ -299,7 +298,6 @@
status_t dump(int fd, const Vector<String16>& /*args*/) const;
private:
- camera_device_t *mDevice;
sp<hardware::camera::device::V1_0::ICameraDevice> mHidlDevice;
String8 mName;
@@ -369,41 +367,6 @@
static void sPutMemory(camera_memory_t *data);
- static ANativeWindow *sToAnw(void *user);
-
- static int sDequeueBuffer(struct preview_stream_ops* w,
- buffer_handle_t** buffer, int *stride);
-
- static int sLockBuffer(struct preview_stream_ops* w,
- buffer_handle_t* /*buffer*/);
-
- static int sEnqueueBuffer(struct preview_stream_ops* w,
- buffer_handle_t* buffer);
-
- static int sCancelBuffer(struct preview_stream_ops* w,
- buffer_handle_t* buffer);
-
- static int sSetBufferCount(struct preview_stream_ops* w, int count);
-
- static int sSetBuffersGeometry(struct preview_stream_ops* w,
- int width, int height, int format);
-
- static int sSetCrop(struct preview_stream_ops *w,
- int left, int top, int right, int bottom);
-
- static int sSetTimestamp(struct preview_stream_ops *w,
- int64_t timestamp);
-
- static int sSetUsage(struct preview_stream_ops* w, int usage);
-
- static int sSetSwapInterval(struct preview_stream_ops *w, int interval);
-
- static int sGetMinUndequeuedBufferCount(
- const struct preview_stream_ops *w,
- int *count);
-
- void initHalPreviewWindow();
-
std::pair<bool, uint64_t> getBufferId(ANativeWindowBuffer* anb);
void cleanupCirculatingBuffers();
@@ -459,13 +422,6 @@
sp<ANativeWindow> mPreviewWindow;
- struct camera_preview_window {
- struct preview_stream_ops nw;
- void *user;
- };
-
- struct camera_preview_window mHalPreviewWindow;
-
notify_callback mNotifyCb;
data_callback mDataCb;
data_callback_timestamp mDataCbTimestamp;
@@ -479,7 +435,7 @@
int mPreviewWidth;
int mPreviewHeight;
int mPreviewFormat;
- int mPreviewUsage;
+ uint64_t mPreviewUsage;
int mPreviewSwapInterval;
android_native_rect_t mPreviewCrop;
diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp
index 69b1d7d..ced1d3a 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.cpp
+++ b/services/camera/libcameraservice/device3/Camera3Device.cpp
@@ -154,6 +154,15 @@
resultQueueRet.description().c_str());
return DEAD_OBJECT;
}
+ IF_ALOGV() {
+ session->interfaceChain([](
+ ::android::hardware::hidl_vec<::android::hardware::hidl_string> interfaceChain) {
+ ALOGV("Session interface chain:");
+ for (auto iface : interfaceChain) {
+ ALOGV(" %s", iface.c_str());
+ }
+ });
+ }
mInterface = new HalInterface(session, queue);
std::string providerType;
@@ -407,7 +416,7 @@
}
BufferUsageFlags Camera3Device::mapToConsumerUsage(
- uint32_t usage) {
+ uint64_t usage) {
return usage;
}
@@ -460,12 +469,17 @@
return static_cast<uint32_t>(pixelFormat);
}
-uint32_t Camera3Device::mapConsumerToFrameworkUsage(
+android_dataspace Camera3Device::mapToFrameworkDataspace(
+ DataspaceFlags dataSpace) {
+ return static_cast<android_dataspace>(dataSpace);
+}
+
+uint64_t Camera3Device::mapConsumerToFrameworkUsage(
BufferUsageFlags usage) {
return usage;
}
-uint32_t Camera3Device::mapProducerToFrameworkUsage(
+uint64_t Camera3Device::mapProducerToFrameworkUsage(
BufferUsageFlags usage) {
return usage;
}
@@ -1208,7 +1222,7 @@
status_t Camera3Device::createStream(sp<Surface> consumer,
uint32_t width, uint32_t height, int format,
android_dataspace dataSpace, camera3_stream_rotation_t rotation, int *id,
- int streamSetId, bool isShared, uint32_t consumerUsage) {
+ int streamSetId, bool isShared, uint64_t consumerUsage) {
ATRACE_CALL();
if (consumer == nullptr) {
@@ -1226,13 +1240,13 @@
status_t Camera3Device::createStream(const std::vector<sp<Surface>>& consumers,
bool hasDeferredConsumer, uint32_t width, uint32_t height, int format,
android_dataspace dataSpace, camera3_stream_rotation_t rotation, int *id,
- int streamSetId, bool isShared, uint32_t consumerUsage) {
+ int streamSetId, bool isShared, uint64_t consumerUsage) {
ATRACE_CALL();
Mutex::Autolock il(mInterfaceLock);
nsecs_t maxExpectedDuration = getExpectedInFlightDuration();
Mutex::Autolock l(mLock);
ALOGV("Camera %s: Creating new stream %d: %d x %d, format %d, dataspace %d rotation %d"
- " consumer usage 0x%x, isShared %d", mId.string(), mNextStreamId, width, height, format,
+ " consumer usage %" PRIu64 ", isShared %d", mId.string(), mNextStreamId, width, height, format,
dataSpace, rotation, consumerUsage, isShared);
status_t res;
@@ -1345,10 +1359,11 @@
return OK;
}
-status_t Camera3Device::getStreamInfo(int id,
- uint32_t *width, uint32_t *height,
- uint32_t *format, android_dataspace *dataSpace) {
+status_t Camera3Device::getStreamInfo(int id, StreamInfo *streamInfo) {
ATRACE_CALL();
+ if (nullptr == streamInfo) {
+ return BAD_VALUE;
+ }
Mutex::Autolock il(mInterfaceLock);
Mutex::Autolock l(mLock);
@@ -1375,10 +1390,14 @@
return idx;
}
- if (width) *width = mOutputStreams[idx]->getWidth();
- if (height) *height = mOutputStreams[idx]->getHeight();
- if (format) *format = mOutputStreams[idx]->getFormat();
- if (dataSpace) *dataSpace = mOutputStreams[idx]->getDataSpace();
+ streamInfo->width = mOutputStreams[idx]->getWidth();
+ streamInfo->height = mOutputStreams[idx]->getHeight();
+ streamInfo->format = mOutputStreams[idx]->getFormat();
+ streamInfo->dataSpace = mOutputStreams[idx]->getDataSpace();
+ streamInfo->formatOverridden = mOutputStreams[idx]->isFormatOverridden();
+ streamInfo->originalFormat = mOutputStreams[idx]->getOriginalFormat();
+ streamInfo->dataSpaceOverridden = mOutputStreams[idx]->isDataSpaceOverridden();
+ streamInfo->originalDataSpace = mOutputStreams[idx]->getOriginalDataSpace();
return OK;
}
@@ -1478,6 +1497,7 @@
status_t Camera3Device::getInputBufferProducer(
sp<IGraphicBufferProducer> *producer) {
+ ATRACE_CALL();
Mutex::Autolock il(mInterfaceLock);
Mutex::Autolock l(mLock);
@@ -1691,6 +1711,7 @@
}
status_t Camera3Device::waitForNextFrame(nsecs_t timeout) {
+ ATRACE_CALL();
status_t res;
Mutex::Autolock l(mOutputLock);
@@ -1884,6 +1905,7 @@
*/
void Camera3Device::notifyStatus(bool idle) {
+ ATRACE_CALL();
{
// Need mLock to safely update state and synchronize to current
// state of methods in flight.
@@ -2317,6 +2339,7 @@
}
void Camera3Device::setErrorState(const char *fmt, ...) {
+ ATRACE_CALL();
Mutex::Autolock l(mLock);
va_list args;
va_start(args, fmt);
@@ -2327,6 +2350,7 @@
}
void Camera3Device::setErrorStateV(const char *fmt, va_list args) {
+ ATRACE_CALL();
Mutex::Autolock l(mLock);
setErrorStateLockedV(fmt, args);
}
@@ -2411,6 +2435,7 @@
}
void Camera3Device::removeInFlightMapEntryLocked(int idx) {
+ ATRACE_CALL();
nsecs_t duration = mInFlightMap.valueAt(idx).maxExpectedDuration;
mInFlightMap.removeItemsAt(idx, 1);
@@ -2433,25 +2458,6 @@
nsecs_t sensorTimestamp = request.sensorTimestamp;
nsecs_t shutterTimestamp = request.shutterTimestamp;
- bool skipResultMetadata = false;
- if (request.requestStatus != OK) {
- switch (request.requestStatus) {
- case CAMERA3_MSG_ERROR_DEVICE:
- case CAMERA3_MSG_ERROR_REQUEST:
- case CAMERA3_MSG_ERROR_RESULT:
- skipResultMetadata = true;
- break;
- case CAMERA3_MSG_ERROR_BUFFER:
- //Result metadata should return in this case.
- skipResultMetadata = false;
- break;
- default:
- SET_ERR("Unknown error message: %d", request.requestStatus);
- skipResultMetadata = false;
- break;
- }
- }
-
// Check if it's okay to remove the request from InFlightMap:
// In the case of a successful request:
// all input and output buffers, all result metadata, shutter callback
@@ -2459,7 +2465,7 @@
// In the case of a unsuccessful request:
// all input and output buffers arrived.
if (request.numBuffersLeft == 0 &&
- (skipResultMetadata ||
+ (request.skipResultMetadata ||
(request.haveResultMetadata && shutterTimestamp != 0))) {
ATRACE_ASYNC_END("frame capture", frameNumber);
@@ -2495,6 +2501,7 @@
}
void Camera3Device::flushInflightRequests() {
+ ATRACE_CALL();
{ // First return buffers cached in mInFlightMap
Mutex::Autolock l(mInFlightLock);
for (size_t idx = 0; idx < mInFlightMap.size(); idx++) {
@@ -2621,6 +2628,7 @@
void Camera3Device::sendPartialCaptureResult(const camera_metadata_t * partialResult,
const CaptureResultExtras &resultExtras, uint32_t frameNumber) {
+ ATRACE_CALL();
Mutex::Autolock l(mOutputLock);
CaptureResult captureResult;
@@ -2636,6 +2644,7 @@
CameraMetadata &collectedPartialResult,
uint32_t frameNumber,
bool reprocess) {
+ ATRACE_CALL();
if (pendingMetadata.isEmpty())
return;
@@ -2884,7 +2893,7 @@
void Camera3Device::notifyError(const camera3_error_msg_t &msg,
sp<NotificationListener> listener) {
-
+ ATRACE_CALL();
// Map camera HAL error codes to ICameraDeviceCallback error codes
// Index into this with the HAL error code
static const int32_t halErrorMap[CAMERA3_MSG_NUM_ERRORS] = {
@@ -2932,6 +2941,11 @@
InFlightRequest &r = mInFlightMap.editValueAt(idx);
r.requestStatus = msg.error_code;
resultExtras = r.resultExtras;
+ if (hardware::camera2::ICameraDeviceCallbacks::ERROR_CAMERA_RESULT == errorCode
+ || hardware::camera2::ICameraDeviceCallbacks::ERROR_CAMERA_REQUEST ==
+ errorCode) {
+ r.skipResultMetadata = true;
+ }
if (hardware::camera2::ICameraDeviceCallbacks::ERROR_CAMERA_RESULT ==
errorCode) {
// In case of missing result check whether the buffers
@@ -2962,6 +2976,7 @@
void Camera3Device::notifyShutter(const camera3_shutter_msg_t &msg,
sp<NotificationListener> listener) {
+ ATRACE_CALL();
ssize_t idx;
// Set timestamp for the request in the in-flight tracking
@@ -3048,24 +3063,20 @@
Camera3Device::HalInterface::HalInterface(
sp<ICameraDeviceSession> &session,
std::shared_ptr<RequestMetadataQueue> queue) :
- mHal3Device(nullptr),
mHidlSession(session),
mRequestMetadataQueue(queue) {}
-Camera3Device::HalInterface::HalInterface() :
- mHal3Device(nullptr) {}
+Camera3Device::HalInterface::HalInterface() {}
Camera3Device::HalInterface::HalInterface(const HalInterface& other) :
- mHal3Device(other.mHal3Device),
mHidlSession(other.mHidlSession),
mRequestMetadataQueue(other.mRequestMetadataQueue) {}
bool Camera3Device::HalInterface::valid() {
- return (mHal3Device != nullptr) || (mHidlSession != nullptr);
+ return (mHidlSession != nullptr);
}
void Camera3Device::HalInterface::clear() {
- mHal3Device = nullptr;
mHidlSession.clear();
}
@@ -3080,72 +3091,60 @@
if (!valid()) return INVALID_OPERATION;
status_t res = OK;
- if (mHal3Device != nullptr) {
- const camera_metadata *r;
- r = mHal3Device->ops->construct_default_request_settings(
- mHal3Device, templateId);
- if (r == nullptr) return BAD_VALUE;
- *requestTemplate = clone_camera_metadata(r);
- if (requestTemplate == nullptr) {
- ALOGE("%s: Unable to clone camera metadata received from HAL",
- __FUNCTION__);
- return INVALID_OPERATION;
- }
- } else {
- common::V1_0::Status status;
- RequestTemplate id;
- switch (templateId) {
- case CAMERA3_TEMPLATE_PREVIEW:
- id = RequestTemplate::PREVIEW;
- break;
- case CAMERA3_TEMPLATE_STILL_CAPTURE:
- id = RequestTemplate::STILL_CAPTURE;
- break;
- case CAMERA3_TEMPLATE_VIDEO_RECORD:
- id = RequestTemplate::VIDEO_RECORD;
- break;
- case CAMERA3_TEMPLATE_VIDEO_SNAPSHOT:
- id = RequestTemplate::VIDEO_SNAPSHOT;
- break;
- case CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG:
- id = RequestTemplate::ZERO_SHUTTER_LAG;
- break;
- case CAMERA3_TEMPLATE_MANUAL:
- id = RequestTemplate::MANUAL;
- break;
- default:
- // Unknown template ID
- return BAD_VALUE;
- }
- auto err = mHidlSession->constructDefaultRequestSettings(id,
- [&status, &requestTemplate]
- (common::V1_0::Status s, const device::V3_2::CameraMetadata& request) {
- status = s;
- if (status == common::V1_0::Status::OK) {
- const camera_metadata *r =
- reinterpret_cast<const camera_metadata_t*>(request.data());
- size_t expectedSize = request.size();
- int ret = validate_camera_metadata_structure(r, &expectedSize);
- if (ret == OK || ret == CAMERA_METADATA_VALIDATION_SHIFTED) {
- *requestTemplate = clone_camera_metadata(r);
- if (*requestTemplate == nullptr) {
- ALOGE("%s: Unable to clone camera metadata received from HAL",
- __FUNCTION__);
- status = common::V1_0::Status::INTERNAL_ERROR;
- }
- } else {
- ALOGE("%s: Malformed camera metadata received from HAL", __FUNCTION__);
+ common::V1_0::Status status;
+ RequestTemplate id;
+ switch (templateId) {
+ case CAMERA3_TEMPLATE_PREVIEW:
+ id = RequestTemplate::PREVIEW;
+ break;
+ case CAMERA3_TEMPLATE_STILL_CAPTURE:
+ id = RequestTemplate::STILL_CAPTURE;
+ break;
+ case CAMERA3_TEMPLATE_VIDEO_RECORD:
+ id = RequestTemplate::VIDEO_RECORD;
+ break;
+ case CAMERA3_TEMPLATE_VIDEO_SNAPSHOT:
+ id = RequestTemplate::VIDEO_SNAPSHOT;
+ break;
+ case CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG:
+ id = RequestTemplate::ZERO_SHUTTER_LAG;
+ break;
+ case CAMERA3_TEMPLATE_MANUAL:
+ id = RequestTemplate::MANUAL;
+ break;
+ default:
+ // Unknown template ID
+ return BAD_VALUE;
+ }
+ auto err = mHidlSession->constructDefaultRequestSettings(id,
+ [&status, &requestTemplate]
+ (common::V1_0::Status s, const device::V3_2::CameraMetadata& request) {
+ status = s;
+ if (status == common::V1_0::Status::OK) {
+ const camera_metadata *r =
+ reinterpret_cast<const camera_metadata_t*>(request.data());
+ size_t expectedSize = request.size();
+ int ret = validate_camera_metadata_structure(r, &expectedSize);
+ if (ret == OK || ret == CAMERA_METADATA_VALIDATION_SHIFTED) {
+ *requestTemplate = clone_camera_metadata(r);
+ if (*requestTemplate == nullptr) {
+ ALOGE("%s: Unable to clone camera metadata received from HAL",
+ __FUNCTION__);
status = common::V1_0::Status::INTERNAL_ERROR;
}
+ } else {
+ ALOGE("%s: Malformed camera metadata received from HAL", __FUNCTION__);
+ status = common::V1_0::Status::INTERNAL_ERROR;
}
- });
- if (!err.isOk()) {
- ALOGE("%s: Transaction error: %s", __FUNCTION__, err.description().c_str());
- res = DEAD_OBJECT;
- } else {
- res = CameraProviderManager::mapToStatusT(status);
- }
+ }
+ });
+ if (!err.isOk()) {
+ ALOGE("%s: Transaction error: %s", __FUNCTION__, err.description().c_str());
+ res = DEAD_OBJECT;
+ } else {
+ res = CameraProviderManager::mapToStatusT(status);
}
+
return res;
}
@@ -3154,145 +3153,191 @@
if (!valid()) return INVALID_OPERATION;
status_t res = OK;
- if (mHal3Device != nullptr) {
- res = mHal3Device->ops->configure_streams(mHal3Device, config);
+ // Convert stream config to HIDL
+ std::set<int> activeStreams;
+ StreamConfiguration requestedConfiguration;
+ requestedConfiguration.streams.resize(config->num_streams);
+ for (size_t i = 0; i < config->num_streams; i++) {
+ Stream &dst = requestedConfiguration.streams[i];
+ camera3_stream_t *src = config->streams[i];
+
+ Camera3Stream* cam3stream = Camera3Stream::cast(src);
+ cam3stream->setBufferFreedListener(this);
+ int streamId = cam3stream->getId();
+ StreamType streamType;
+ switch (src->stream_type) {
+ case CAMERA3_STREAM_OUTPUT:
+ streamType = StreamType::OUTPUT;
+ break;
+ case CAMERA3_STREAM_INPUT:
+ streamType = StreamType::INPUT;
+ break;
+ default:
+ ALOGE("%s: Stream %d: Unsupported stream type %d",
+ __FUNCTION__, streamId, config->streams[i]->stream_type);
+ return BAD_VALUE;
+ }
+ dst.id = streamId;
+ dst.streamType = streamType;
+ dst.width = src->width;
+ dst.height = src->height;
+ dst.format = mapToPixelFormat(src->format);
+ dst.usage = mapToConsumerUsage(cam3stream->getUsage());
+ dst.dataSpace = mapToHidlDataspace(src->data_space);
+ dst.rotation = mapToStreamRotation((camera3_stream_rotation_t) src->rotation);
+
+ activeStreams.insert(streamId);
+ // Create Buffer ID map if necessary
+ if (mBufferIdMaps.count(streamId) == 0) {
+ mBufferIdMaps.emplace(streamId, BufferIdMap{});
+ }
+ }
+ // remove BufferIdMap for deleted streams
+ for(auto it = mBufferIdMaps.begin(); it != mBufferIdMaps.end();) {
+ int streamId = it->first;
+ bool active = activeStreams.count(streamId) > 0;
+ if (!active) {
+ it = mBufferIdMaps.erase(it);
+ } else {
+ ++it;
+ }
+ }
+
+ res = mapToStreamConfigurationMode(
+ (camera3_stream_configuration_mode_t) config->operation_mode,
+ /*out*/ &requestedConfiguration.operationMode);
+ if (res != OK) {
+ return res;
+ }
+
+ // Invoke configureStreams
+
+ device::V3_3::HalStreamConfiguration finalConfiguration;
+ common::V1_0::Status status;
+
+ // See if we have v3.3 HAL
+ sp<device::V3_3::ICameraDeviceSession> hidlSession_3_3;
+ auto castResult = device::V3_3::ICameraDeviceSession::castFrom(mHidlSession);
+ if (castResult.isOk()) {
+ hidlSession_3_3 = castResult;
} else {
- // Convert stream config to HIDL
- std::set<int> activeStreams;
- StreamConfiguration requestedConfiguration;
- requestedConfiguration.streams.resize(config->num_streams);
- for (size_t i = 0; i < config->num_streams; i++) {
- Stream &dst = requestedConfiguration.streams[i];
- camera3_stream_t *src = config->streams[i];
-
- Camera3Stream* cam3stream = Camera3Stream::cast(src);
- cam3stream->setBufferFreedListener(this);
- int streamId = cam3stream->getId();
- StreamType streamType;
- switch (src->stream_type) {
- case CAMERA3_STREAM_OUTPUT:
- streamType = StreamType::OUTPUT;
- break;
- case CAMERA3_STREAM_INPUT:
- streamType = StreamType::INPUT;
- break;
- default:
- ALOGE("%s: Stream %d: Unsupported stream type %d",
- __FUNCTION__, streamId, config->streams[i]->stream_type);
- return BAD_VALUE;
- }
- dst.id = streamId;
- dst.streamType = streamType;
- dst.width = src->width;
- dst.height = src->height;
- dst.format = mapToPixelFormat(src->format);
- dst.usage = mapToConsumerUsage(src->usage);
- dst.dataSpace = mapToHidlDataspace(src->data_space);
- dst.rotation = mapToStreamRotation((camera3_stream_rotation_t) src->rotation);
-
- activeStreams.insert(streamId);
- // Create Buffer ID map if necessary
- if (mBufferIdMaps.count(streamId) == 0) {
- mBufferIdMaps.emplace(streamId, BufferIdMap{});
- }
+ ALOGE("%s: Transaction error when casting ICameraDeviceSession: %s", __FUNCTION__,
+ castResult.description().c_str());
+ }
+ if (hidlSession_3_3 != nullptr) {
+ // We do; use v3.3 for the call
+ ALOGV("%s: v3.3 device found", __FUNCTION__);
+ auto err = hidlSession_3_3->configureStreams_3_3(requestedConfiguration,
+ [&status, &finalConfiguration]
+ (common::V1_0::Status s, const device::V3_3::HalStreamConfiguration& halConfiguration) {
+ finalConfiguration = halConfiguration;
+ status = s;
+ });
+ if (!err.isOk()) {
+ ALOGE("%s: Transaction error: %s", __FUNCTION__, err.description().c_str());
+ return DEAD_OBJECT;
}
- // remove BufferIdMap for deleted streams
- for(auto it = mBufferIdMaps.begin(); it != mBufferIdMaps.end();) {
- int streamId = it->first;
- bool active = activeStreams.count(streamId) > 0;
- if (!active) {
- it = mBufferIdMaps.erase(it);
- } else {
- ++it;
- }
- }
-
- res = mapToStreamConfigurationMode(
- (camera3_stream_configuration_mode_t) config->operation_mode,
- /*out*/ &requestedConfiguration.operationMode);
- if (res != OK) {
- return res;
- }
-
- // Invoke configureStreams
-
- HalStreamConfiguration finalConfiguration;
- common::V1_0::Status status;
+ } else {
+ // We don't; use v3.2 call and construct a v3.3 HalStreamConfiguration
+ ALOGV("%s: v3.2 device found", __FUNCTION__);
+ HalStreamConfiguration finalConfiguration_3_2;
auto err = mHidlSession->configureStreams(requestedConfiguration,
- [&status, &finalConfiguration]
+ [&status, &finalConfiguration_3_2]
(common::V1_0::Status s, const HalStreamConfiguration& halConfiguration) {
- finalConfiguration = halConfiguration;
+ finalConfiguration_3_2 = halConfiguration;
status = s;
});
if (!err.isOk()) {
ALOGE("%s: Transaction error: %s", __FUNCTION__, err.description().c_str());
return DEAD_OBJECT;
}
+ finalConfiguration.streams.resize(finalConfiguration_3_2.streams.size());
+ for (size_t i = 0; i < finalConfiguration_3_2.streams.size(); i++) {
+ finalConfiguration.streams[i].v3_2 = finalConfiguration_3_2.streams[i];
+ finalConfiguration.streams[i].overrideDataSpace =
+ requestedConfiguration.streams[i].dataSpace;
+ }
+ }
- if (status != common::V1_0::Status::OK ) {
- return CameraProviderManager::mapToStatusT(status);
+ if (status != common::V1_0::Status::OK ) {
+ return CameraProviderManager::mapToStatusT(status);
+ }
+
+ // And convert output stream configuration from HIDL
+
+ for (size_t i = 0; i < config->num_streams; i++) {
+ camera3_stream_t *dst = config->streams[i];
+ int streamId = Camera3Stream::cast(dst)->getId();
+
+ // Start scan at i, with the assumption that the stream order matches
+ size_t realIdx = i;
+ bool found = false;
+ for (size_t idx = 0; idx < finalConfiguration.streams.size(); idx++) {
+ if (finalConfiguration.streams[realIdx].v3_2.id == streamId) {
+ found = true;
+ break;
+ }
+ realIdx = (realIdx >= finalConfiguration.streams.size()) ? 0 : realIdx + 1;
+ }
+ if (!found) {
+ ALOGE("%s: Stream %d not found in stream configuration response from HAL",
+ __FUNCTION__, streamId);
+ return INVALID_OPERATION;
+ }
+ device::V3_3::HalStream &src = finalConfiguration.streams[realIdx];
+
+ Camera3Stream* dstStream = Camera3Stream::cast(dst);
+ dstStream->setFormatOverride(false);
+ dstStream->setDataSpaceOverride(false);
+ int overrideFormat = mapToFrameworkFormat(src.v3_2.overrideFormat);
+ android_dataspace overrideDataSpace = mapToFrameworkDataspace(src.overrideDataSpace);
+
+ if (dst->format != HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) {
+ if (dst->format != overrideFormat) {
+ ALOGE("%s: Stream %d: Format override not allowed for format 0x%x", __FUNCTION__,
+ streamId, dst->format);
+ }
+ if (dst->data_space != overrideDataSpace) {
+ ALOGE("%s: Stream %d: DataSpace override not allowed for format 0x%x", __FUNCTION__,
+ streamId, dst->format);
+ }
+ } else {
+ dstStream->setFormatOverride((dst->format != overrideFormat) ? true : false);
+ dstStream->setDataSpaceOverride((dst->data_space != overrideDataSpace) ? true : false);
+
+ // Override allowed with IMPLEMENTATION_DEFINED
+ dst->format = overrideFormat;
+ dst->data_space = overrideDataSpace;
}
- // And convert output stream configuration from HIDL
-
- for (size_t i = 0; i < config->num_streams; i++) {
- camera3_stream_t *dst = config->streams[i];
- int streamId = Camera3Stream::cast(dst)->getId();
-
- // Start scan at i, with the assumption that the stream order matches
- size_t realIdx = i;
- bool found = false;
- for (size_t idx = 0; idx < finalConfiguration.streams.size(); idx++) {
- if (finalConfiguration.streams[realIdx].id == streamId) {
- found = true;
- break;
- }
- realIdx = (realIdx >= finalConfiguration.streams.size()) ? 0 : realIdx + 1;
- }
- if (!found) {
- ALOGE("%s: Stream %d not found in stream configuration response from HAL",
+ if (dst->stream_type == CAMERA3_STREAM_INPUT) {
+ if (src.v3_2.producerUsage != 0) {
+ ALOGE("%s: Stream %d: INPUT streams must have 0 for producer usage",
__FUNCTION__, streamId);
return INVALID_OPERATION;
}
- HalStream &src = finalConfiguration.streams[realIdx];
-
- int overrideFormat = mapToFrameworkFormat(src.overrideFormat);
- if (dst->format != HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) {
- if (dst->format != overrideFormat) {
- ALOGE("%s: Stream %d: Format override not allowed for format 0x%x", __FUNCTION__,
- streamId, dst->format);
- }
- } else {
- // Override allowed with IMPLEMENTATION_DEFINED
- dst->format = overrideFormat;
+ dstStream->setUsage(
+ mapConsumerToFrameworkUsage(src.v3_2.consumerUsage));
+ } else {
+ // OUTPUT
+ if (src.v3_2.consumerUsage != 0) {
+ ALOGE("%s: Stream %d: OUTPUT streams must have 0 for consumer usage",
+ __FUNCTION__, streamId);
+ return INVALID_OPERATION;
}
-
- if (dst->stream_type == CAMERA3_STREAM_INPUT) {
- if (src.producerUsage != 0) {
- ALOGE("%s: Stream %d: INPUT streams must have 0 for producer usage",
- __FUNCTION__, streamId);
- return INVALID_OPERATION;
- }
- dst->usage = mapConsumerToFrameworkUsage(src.consumerUsage);
- } else {
- // OUTPUT
- if (src.consumerUsage != 0) {
- ALOGE("%s: Stream %d: OUTPUT streams must have 0 for consumer usage",
- __FUNCTION__, streamId);
- return INVALID_OPERATION;
- }
- dst->usage = mapProducerToFrameworkUsage(src.producerUsage);
- }
- dst->max_buffers = src.maxBuffers;
+ dstStream->setUsage(
+ mapProducerToFrameworkUsage(src.v3_2.producerUsage));
}
+ dst->max_buffers = src.v3_2.maxBuffers;
}
+
return res;
}
void Camera3Device::HalInterface::wrapAsHidlRequest(camera3_capture_request_t* request,
/*out*/device::V3_2::CaptureRequest* captureRequest,
/*out*/std::vector<native_handle_t*>* handlesCreated) {
-
+ ATRACE_CALL();
if (captureRequest == nullptr || handlesCreated == nullptr) {
ALOGE("%s: captureRequest (%p) and handlesCreated (%p) must not be null",
__FUNCTION__, captureRequest, handlesCreated);
@@ -3441,14 +3486,11 @@
if (!valid()) return INVALID_OPERATION;
status_t res = OK;
- if (mHal3Device != nullptr) {
- res = mHal3Device->ops->process_capture_request(mHal3Device, request);
- } else {
- uint32_t numRequestProcessed = 0;
- std::vector<camera3_capture_request_t*> requests(1);
- requests[0] = request;
- res = processBatchCaptureRequests(requests, &numRequestProcessed);
- }
+ uint32_t numRequestProcessed = 0;
+ std::vector<camera3_capture_request_t*> requests(1);
+ requests[0] = request;
+ res = processBatchCaptureRequests(requests, &numRequestProcessed);
+
return res;
}
@@ -3457,31 +3499,24 @@
if (!valid()) return INVALID_OPERATION;
status_t res = OK;
- if (mHal3Device != nullptr) {
- res = mHal3Device->ops->flush(mHal3Device);
+ auto err = mHidlSession->flush();
+ if (!err.isOk()) {
+ ALOGE("%s: Transaction error: %s", __FUNCTION__, err.description().c_str());
+ res = DEAD_OBJECT;
} else {
- auto err = mHidlSession->flush();
- if (!err.isOk()) {
- ALOGE("%s: Transaction error: %s", __FUNCTION__, err.description().c_str());
- res = DEAD_OBJECT;
- } else {
- res = CameraProviderManager::mapToStatusT(err);
- }
+ res = CameraProviderManager::mapToStatusT(err);
}
+
return res;
}
-status_t Camera3Device::HalInterface::dump(int fd) {
+status_t Camera3Device::HalInterface::dump(int /*fd*/) {
ATRACE_NAME("CameraHal::dump");
if (!valid()) return INVALID_OPERATION;
- status_t res = OK;
- if (mHal3Device != nullptr) {
- mHal3Device->ops->dump(mHal3Device, fd);
- } else {
- // Handled by CameraProviderManager::dump
- }
- return res;
+ // Handled by CameraProviderManager::dump
+
+ return OK;
}
status_t Camera3Device::HalInterface::close() {
@@ -3489,15 +3524,12 @@
if (!valid()) return INVALID_OPERATION;
status_t res = OK;
- if (mHal3Device != nullptr) {
- mHal3Device->common.close(&mHal3Device->common);
- } else {
- auto err = mHidlSession->close();
- // Interface will be dead shortly anyway, so don't log errors
- if (!err.isOk()) {
- res = DEAD_OBJECT;
- }
+ auto err = mHidlSession->close();
+ // Interface will be dead shortly anyway, so don't log errors
+ if (!err.isOk()) {
+ res = DEAD_OBJECT;
}
+
return res;
}
@@ -3614,11 +3646,13 @@
void Camera3Device::RequestThread::setNotificationListener(
wp<NotificationListener> listener) {
+ ATRACE_CALL();
Mutex::Autolock l(mRequestLock);
mListener = listener;
}
void Camera3Device::RequestThread::configurationComplete(bool isConstrainedHighSpeed) {
+ ATRACE_CALL();
Mutex::Autolock l(mRequestLock);
mReconfigured = true;
// Prepare video stream for high speed recording.
@@ -3629,6 +3663,7 @@
List<sp<CaptureRequest> > &requests,
/*out*/
int64_t *lastFrameNumber) {
+ ATRACE_CALL();
Mutex::Autolock l(mRequestLock);
for (List<sp<CaptureRequest> >::iterator it = requests.begin(); it != requests.end();
++it) {
@@ -3651,7 +3686,7 @@
status_t Camera3Device::RequestThread::queueTrigger(
RequestTrigger trigger[],
size_t count) {
-
+ ATRACE_CALL();
Mutex::Autolock l(mTriggerMutex);
status_t ret;
@@ -3708,6 +3743,7 @@
const RequestList &requests,
/*out*/
int64_t *lastFrameNumber) {
+ ATRACE_CALL();
Mutex::Autolock l(mRequestLock);
if (lastFrameNumber != NULL) {
*lastFrameNumber = mRepeatingLastFrameNumber;
@@ -3734,6 +3770,7 @@
}
status_t Camera3Device::RequestThread::clearRepeatingRequests(/*out*/int64_t *lastFrameNumber) {
+ ATRACE_CALL();
Mutex::Autolock l(mRequestLock);
return clearRepeatingRequestsLocked(lastFrameNumber);
@@ -3750,6 +3787,7 @@
status_t Camera3Device::RequestThread::clear(
/*out*/int64_t *lastFrameNumber) {
+ ATRACE_CALL();
Mutex::Autolock l(mRequestLock);
ALOGV("RequestThread::%s:", __FUNCTION__);
@@ -3805,6 +3843,7 @@
}
void Camera3Device::RequestThread::setPaused(bool paused) {
+ ATRACE_CALL();
Mutex::Autolock l(mPauseLock);
mDoPause = paused;
mDoPauseSignal.signal();
@@ -3812,6 +3851,7 @@
status_t Camera3Device::RequestThread::waitUntilRequestProcessed(
int32_t requestId, nsecs_t timeout) {
+ ATRACE_CALL();
Mutex::Autolock l(mLatestRequestMutex);
status_t res;
while (mLatestRequestId != requestId) {
@@ -3838,6 +3878,7 @@
}
void Camera3Device::RequestThread::checkAndStopRepeatingRequest() {
+ ATRACE_CALL();
bool surfaceAbandoned = false;
int64_t lastFrameNumber = 0;
sp<NotificationListener> listener;
@@ -3866,6 +3907,7 @@
}
bool Camera3Device::RequestThread::sendRequestsBatch() {
+ ATRACE_CALL();
status_t res;
size_t batchSize = mNextRequests.size();
std::vector<camera3_capture_request_t*> requests(batchSize);
@@ -4261,6 +4303,7 @@
}
CameraMetadata Camera3Device::RequestThread::getLatestRequest() const {
+ ATRACE_CALL();
Mutex::Autolock al(mLatestRequestMutex);
ALOGV("RequestThread::%s", __FUNCTION__);
@@ -4270,6 +4313,7 @@
bool Camera3Device::RequestThread::isStreamPending(
sp<Camera3StreamInterface>& stream) {
+ ATRACE_CALL();
Mutex::Autolock l(mRequestLock);
for (const auto& nextRequest : mNextRequests) {
@@ -4299,6 +4343,7 @@
}
nsecs_t Camera3Device::getExpectedInFlightDuration() {
+ ATRACE_CALL();
Mutex::Autolock al(mInFlightLock);
return mExpectedInflightDuration > kMinInflightDuration ?
mExpectedInflightDuration : kMinInflightDuration;
@@ -4370,6 +4415,7 @@
}
void Camera3Device::RequestThread::waitForNextRequestBatch() {
+ ATRACE_CALL();
// Optimized a bit for the simple steady-state case (single repeating
// request), to avoid putting that request in the queue temporarily.
Mutex::Autolock l(mRequestLock);
@@ -4519,6 +4565,7 @@
}
bool Camera3Device::RequestThread::waitIfPaused() {
+ ATRACE_CALL();
status_t res;
Mutex::Autolock l(mPauseLock);
while (mDoPause) {
@@ -4543,6 +4590,7 @@
}
void Camera3Device::RequestThread::unpauseForNewRequests() {
+ ATRACE_CALL();
// With work to do, mark thread as unpaused.
// If paused by request (setPaused), don't resume, to avoid
// extra signaling/waiting overhead to waitUntilPaused
@@ -4574,7 +4622,7 @@
status_t Camera3Device::RequestThread::insertTriggers(
const sp<CaptureRequest> &request) {
-
+ ATRACE_CALL();
Mutex::Autolock al(mTriggerMutex);
sp<Camera3Device> parent = mParent.promote();
@@ -4663,6 +4711,7 @@
status_t Camera3Device::RequestThread::removeTriggers(
const sp<CaptureRequest> &request) {
+ ATRACE_CALL();
Mutex::Autolock al(mTriggerMutex);
CameraMetadata &metadata = request->mSettings;
@@ -4779,6 +4828,7 @@
}
status_t Camera3Device::PreparerThread::prepare(int maxCount, sp<Camera3StreamInterface>& stream) {
+ ATRACE_CALL();
status_t res;
Mutex::Autolock l(mLock);
@@ -4822,6 +4872,7 @@
}
status_t Camera3Device::PreparerThread::clear() {
+ ATRACE_CALL();
Mutex::Autolock l(mLock);
for (const auto& stream : mPendingStreams) {
@@ -4834,6 +4885,7 @@
}
void Camera3Device::PreparerThread::setNotificationListener(wp<NotificationListener> listener) {
+ ATRACE_CALL();
Mutex::Autolock l(mLock);
mListener = listener;
}
diff --git a/services/camera/libcameraservice/device3/Camera3Device.h b/services/camera/libcameraservice/device3/Camera3Device.h
index d700e03..fbbbd08 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.h
+++ b/services/camera/libcameraservice/device3/Camera3Device.h
@@ -30,6 +30,7 @@
#include <android/hardware/camera/device/3.2/ICameraDevice.h>
#include <android/hardware/camera/device/3.2/ICameraDeviceSession.h>
+#include <android/hardware/camera/device/3.3/ICameraDeviceSession.h>
#include <android/hardware/camera/device/3.2/ICameraDeviceCallback.h>
#include <fmq/MessageQueue.h>
#include <hardware/camera3.h>
@@ -117,20 +118,18 @@
uint32_t width, uint32_t height, int format,
android_dataspace dataSpace, camera3_stream_rotation_t rotation, int *id,
int streamSetId = camera3::CAMERA3_STREAM_SET_ID_INVALID,
- bool isShared = false, uint32_t consumerUsage = 0) override;
+ bool isShared = false, uint64_t consumerUsage = 0) override;
status_t createStream(const std::vector<sp<Surface>>& consumers,
bool hasDeferredConsumer, uint32_t width, uint32_t height, int format,
android_dataspace dataSpace, camera3_stream_rotation_t rotation, int *id,
int streamSetId = camera3::CAMERA3_STREAM_SET_ID_INVALID,
- bool isShared = false, uint32_t consumerUsage = 0) override;
+ bool isShared = false, uint64_t consumerUsage = 0) override;
status_t createInputStream(
uint32_t width, uint32_t height, int format,
int *id) override;
- status_t getStreamInfo(int id,
- uint32_t *width, uint32_t *height,
- uint32_t *format, android_dataspace *dataSpace) override;
+ status_t getStreamInfo(int id, StreamInfo *streamInfo) override;
status_t setStreamTransform(int id, int transform) override;
status_t deleteStream(int id) override;
@@ -271,7 +270,6 @@
void getInflightBufferKeys(std::vector<std::pair<int32_t, int32_t>>* out);
private:
- camera3_device_t *mHal3Device;
sp<hardware::camera::device::V3_2::ICameraDeviceSession> mHidlSession;
std::shared_ptr<RequestMetadataQueue> mRequestMetadataQueue;
@@ -590,7 +588,7 @@
static hardware::graphics::common::V1_0::PixelFormat mapToPixelFormat(int frameworkFormat);
static hardware::camera::device::V3_2::DataspaceFlags mapToHidlDataspace(
android_dataspace dataSpace);
- static hardware::camera::device::V3_2::BufferUsageFlags mapToConsumerUsage(uint32_t usage);
+ static hardware::camera::device::V3_2::BufferUsageFlags mapToConsumerUsage(uint64_t usage);
static hardware::camera::device::V3_2::StreamRotation mapToStreamRotation(
camera3_stream_rotation_t rotation);
// Returns a negative error code if the passed-in operation mode is not valid.
@@ -598,9 +596,11 @@
/*out*/ hardware::camera::device::V3_2::StreamConfigurationMode *mode);
static camera3_buffer_status_t mapHidlBufferStatus(hardware::camera::device::V3_2::BufferStatus status);
static int mapToFrameworkFormat(hardware::graphics::common::V1_0::PixelFormat pixelFormat);
- static uint32_t mapConsumerToFrameworkUsage(
+ static android_dataspace mapToFrameworkDataspace(
+ hardware::camera::device::V3_2::DataspaceFlags);
+ static uint64_t mapConsumerToFrameworkUsage(
hardware::camera::device::V3_2::BufferUsageFlags usage);
- static uint32_t mapProducerToFrameworkUsage(
+ static uint64_t mapProducerToFrameworkUsage(
hardware::camera::device::V3_2::BufferUsageFlags usage);
struct RequestTrigger {
@@ -886,6 +886,11 @@
// For auto-exposure modes, equal to 1/(lower end of target FPS range)
nsecs_t maxExpectedDuration;
+ // Whether the result metadata for this request is to be skipped. The
+ // result metadata should be skipped in the case of
+ // REQUEST/RESULT error.
+ bool skipResultMetadata;
+
// Default constructor needed by KeyedVector
InFlightRequest() :
shutterTimestamp(0),
@@ -895,7 +900,8 @@
numBuffersLeft(0),
hasInputBuffer(false),
hasCallback(true),
- maxExpectedDuration(kDefaultExpectedDuration) {
+ maxExpectedDuration(kDefaultExpectedDuration),
+ skipResultMetadata(false) {
}
InFlightRequest(int numBuffers, CaptureResultExtras extras, bool hasInput,
@@ -908,7 +914,8 @@
resultExtras(extras),
hasInputBuffer(hasInput),
hasCallback(hasAppCallback),
- maxExpectedDuration(maxDuration) {
+ maxExpectedDuration(maxDuration),
+ skipResultMetadata(false) {
}
};
diff --git a/services/camera/libcameraservice/device3/Camera3DummyStream.cpp b/services/camera/libcameraservice/device3/Camera3DummyStream.cpp
index 9c951b7..6e2978f 100644
--- a/services/camera/libcameraservice/device3/Camera3DummyStream.cpp
+++ b/services/camera/libcameraservice/device3/Camera3DummyStream.cpp
@@ -95,7 +95,7 @@
return OK;
}
-status_t Camera3DummyStream::getEndpointUsage(uint32_t *usage) const {
+status_t Camera3DummyStream::getEndpointUsage(uint64_t *usage) const {
*usage = DUMMY_USAGE;
return OK;
}
diff --git a/services/camera/libcameraservice/device3/Camera3DummyStream.h b/services/camera/libcameraservice/device3/Camera3DummyStream.h
index 35a6a18..492fb49 100644
--- a/services/camera/libcameraservice/device3/Camera3DummyStream.h
+++ b/services/camera/libcameraservice/device3/Camera3DummyStream.h
@@ -94,7 +94,7 @@
static const int DUMMY_FORMAT = HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED;
static const android_dataspace DUMMY_DATASPACE = HAL_DATASPACE_UNKNOWN;
static const camera3_stream_rotation_t DUMMY_ROTATION = CAMERA3_STREAM_ROTATION_0;
- static const uint32_t DUMMY_USAGE = GRALLOC_USAGE_HW_COMPOSER;
+ static const uint64_t DUMMY_USAGE = GRALLOC_USAGE_HW_COMPOSER;
/**
* Internal Camera3Stream interface
@@ -107,7 +107,7 @@
virtual status_t configureQueueLocked();
- virtual status_t getEndpointUsage(uint32_t *usage) const;
+ virtual status_t getEndpointUsage(uint64_t *usage) const;
}; // class Camera3DummyStream
diff --git a/services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp b/services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp
index 7ad2300..a52422d 100644
--- a/services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp
+++ b/services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp
@@ -69,7 +69,7 @@
(void) args;
String8 lines;
- uint32_t consumerUsage = 0;
+ uint64_t consumerUsage = 0;
status_t res = getEndpointUsage(&consumerUsage);
if (res != OK) consumerUsage = 0;
@@ -78,8 +78,8 @@
camera3_stream::width, camera3_stream::height,
camera3_stream::format, camera3_stream::data_space);
lines.appendFormat(" Max size: %zu\n", mMaxSize);
- lines.appendFormat(" Combined usage: %d, max HAL buffers: %d\n",
- camera3_stream::usage | consumerUsage, camera3_stream::max_buffers);
+ lines.appendFormat(" Combined usage: %" PRIu64 ", max HAL buffers: %d\n",
+ mUsage | consumerUsage, camera3_stream::max_buffers);
lines.appendFormat(" Frames produced: %d, last timestamp: %" PRId64 " ns\n",
mFrameCount, mLastTimestamp);
lines.appendFormat(" Total buffers: %zu, currently dequeued: %zu\n",
diff --git a/services/camera/libcameraservice/device3/Camera3IOStreamBase.h b/services/camera/libcameraservice/device3/Camera3IOStreamBase.h
index 35dda39..2376058 100644
--- a/services/camera/libcameraservice/device3/Camera3IOStreamBase.h
+++ b/services/camera/libcameraservice/device3/Camera3IOStreamBase.h
@@ -85,7 +85,7 @@
virtual size_t getHandoutInputBufferCountLocked();
- virtual status_t getEndpointUsage(uint32_t *usage) const = 0;
+ virtual status_t getEndpointUsage(uint64_t *usage) const = 0;
status_t getBufferPreconditionCheckLocked() const;
status_t returnBufferPreconditionCheckLocked() const;
diff --git a/services/camera/libcameraservice/device3/Camera3InputStream.cpp b/services/camera/libcameraservice/device3/Camera3InputStream.cpp
index ff2dcef..2cb1ea7 100644
--- a/services/camera/libcameraservice/device3/Camera3InputStream.cpp
+++ b/services/camera/libcameraservice/device3/Camera3InputStream.cpp
@@ -258,7 +258,7 @@
camera3_stream::max_buffers : minBufs;
// TODO: somehow set the total buffer count when producer connects?
- mConsumer = new BufferItemConsumer(consumer, camera3_stream::usage,
+ mConsumer = new BufferItemConsumer(consumer, mUsage,
mTotalBufferCount);
mConsumer->setName(String8::format("Camera3-InputStream-%d", mId));
@@ -284,7 +284,7 @@
return OK;
}
-status_t Camera3InputStream::getEndpointUsage(uint32_t *usage) const {
+status_t Camera3InputStream::getEndpointUsage(uint64_t *usage) const {
// Per HAL3 spec, input streams have 0 for their initial usage field.
*usage = 0;
return OK;
diff --git a/services/camera/libcameraservice/device3/Camera3InputStream.h b/services/camera/libcameraservice/device3/Camera3InputStream.h
index 8f5b431..81226f8 100644
--- a/services/camera/libcameraservice/device3/Camera3InputStream.h
+++ b/services/camera/libcameraservice/device3/Camera3InputStream.h
@@ -76,7 +76,7 @@
virtual status_t configureQueueLocked();
- virtual status_t getEndpointUsage(uint32_t *usage) const;
+ virtual status_t getEndpointUsage(uint64_t *usage) const;
/**
* BufferItemConsumer::BufferFreedListener interface
diff --git a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
index b02cd6a..dcaefe3 100644
--- a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
+++ b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
@@ -90,7 +90,7 @@
Camera3OutputStream::Camera3OutputStream(int id,
uint32_t width, uint32_t height, int format,
- uint32_t consumerUsage, android_dataspace dataSpace,
+ uint64_t consumerUsage, android_dataspace dataSpace,
camera3_stream_rotation_t rotation, nsecs_t timestampOffset, int setId) :
Camera3IOStreamBase(id, CAMERA3_STREAM_OUTPUT, width, height,
/*maxSize*/0, format, dataSpace, rotation, setId),
@@ -111,7 +111,8 @@
// Sanity check for the consumer usage flag.
if ((consumerUsage & GraphicBuffer::USAGE_HW_TEXTURE) == 0 &&
(consumerUsage & GraphicBuffer::USAGE_HW_COMPOSER) == 0) {
- ALOGE("%s: Deferred consumer usage flag is illegal (0x%x)!", __FUNCTION__, consumerUsage);
+ ALOGE("%s: Deferred consumer usage flag is illegal %" PRIu64 "!",
+ __FUNCTION__, consumerUsage);
mState = STATE_ERROR;
}
@@ -127,7 +128,7 @@
int format,
android_dataspace dataSpace,
camera3_stream_rotation_t rotation,
- uint32_t consumerUsage, nsecs_t timestampOffset,
+ uint64_t consumerUsage, nsecs_t timestampOffset,
int setId) :
Camera3IOStreamBase(id, type, width, height,
/*maxSize*/0,
@@ -365,10 +366,10 @@
mConsumerName = mConsumer->getConsumerName();
- res = native_window_set_usage(mConsumer.get(), camera3_stream::usage);
+ res = native_window_set_usage(mConsumer.get(), mUsage);
if (res != OK) {
- ALOGE("%s: Unable to configure usage %08x for stream %d",
- __FUNCTION__, camera3_stream::usage, mId);
+ ALOGE("%s: Unable to configure usage %" PRIu64 " for stream %d",
+ __FUNCTION__, mUsage, mId);
return res;
}
@@ -461,11 +462,11 @@
* HAL3.2 devices may not support the dynamic buffer registeration.
*/
if (mBufferManager != 0 && mSetId > CAMERA3_STREAM_SET_ID_INVALID) {
- uint32_t consumerUsage = 0;
+ uint64_t consumerUsage = 0;
getEndpointUsage(&consumerUsage);
StreamInfo streamInfo(
getId(), getStreamSetId(), getWidth(), getHeight(), getFormat(), getDataSpace(),
- camera3_stream::usage | consumerUsage, mTotalBufferCount,
+ mUsage | consumerUsage, mTotalBufferCount,
/*isConfigured*/true);
wp<Camera3OutputStream> weakThis(this);
res = mBufferManager->registerStream(weakThis,
@@ -628,7 +629,7 @@
return OK;
}
-status_t Camera3OutputStream::getEndpointUsage(uint32_t *usage) const {
+status_t Camera3OutputStream::getEndpointUsage(uint64_t *usage) const {
status_t res;
@@ -643,14 +644,12 @@
return res;
}
-status_t Camera3OutputStream::getEndpointUsageForSurface(uint32_t *usage,
+status_t Camera3OutputStream::getEndpointUsageForSurface(uint64_t *usage,
const sp<Surface>& surface) const {
status_t res;
- int32_t u = 0;
+ uint64_t u = 0;
- res = static_cast<ANativeWindow*>(surface.get())->query(surface.get(),
- NATIVE_WINDOW_CONSUMER_USAGE_BITS, &u);
-
+ res = native_window_get_consumer_usage(static_cast<ANativeWindow*>(surface.get()), &u);
// If an opaque output stream's endpoint is ImageReader, add
// GRALLOC_USAGE_HW_CAMERA_ZSL to the usage so HAL knows it will be used
// for the ZSL use case.
@@ -670,7 +669,7 @@
}
bool Camera3OutputStream::isVideoStream() const {
- uint32_t usage = 0;
+ uint64_t usage = 0;
status_t res = getEndpointUsage(&usage);
if (res != OK) {
ALOGE("%s: getting end point usage failed: %s (%d).", __FUNCTION__, strerror(-res), res);
@@ -813,7 +812,7 @@
}
bool Camera3OutputStream::isConsumedByHWComposer() const {
- uint32_t usage = 0;
+ uint64_t usage = 0;
status_t res = getEndpointUsage(&usage);
if (res != OK) {
ALOGE("%s: getting end point usage failed: %s (%d).", __FUNCTION__, strerror(-res), res);
@@ -824,7 +823,7 @@
}
bool Camera3OutputStream::isConsumedByHWTexture() const {
- uint32_t usage = 0;
+ uint64_t usage = 0;
status_t res = getEndpointUsage(&usage);
if (res != OK) {
ALOGE("%s: getting end point usage failed: %s (%d).", __FUNCTION__, strerror(-res), res);
diff --git a/services/camera/libcameraservice/device3/Camera3OutputStream.h b/services/camera/libcameraservice/device3/Camera3OutputStream.h
index 97aa7d4..7023d5d 100644
--- a/services/camera/libcameraservice/device3/Camera3OutputStream.h
+++ b/services/camera/libcameraservice/device3/Camera3OutputStream.h
@@ -44,7 +44,7 @@
uint32_t height;
uint32_t format;
android_dataspace dataSpace;
- uint32_t combinedUsage;
+ uint64_t combinedUsage;
size_t totalBufferCount;
bool isConfigured;
explicit StreamInfo(int id = CAMERA3_STREAM_ID_INVALID,
@@ -53,7 +53,7 @@
uint32_t h = 0,
uint32_t fmt = 0,
android_dataspace ds = HAL_DATASPACE_UNKNOWN,
- uint32_t usage = 0,
+ uint64_t usage = 0,
size_t bufferCount = 0,
bool configured = false) :
streamId(id),
@@ -101,7 +101,7 @@
* stream set id needs to be set to support buffer sharing between multiple streams.
*/
Camera3OutputStream(int id, uint32_t width, uint32_t height, int format,
- uint32_t consumerUsage, android_dataspace dataSpace,
+ uint64_t consumerUsage, android_dataspace dataSpace,
camera3_stream_rotation_t rotation, nsecs_t timestampOffset,
int setId = CAMERA3_STREAM_SET_ID_INVALID);
@@ -176,7 +176,7 @@
Camera3OutputStream(int id, camera3_stream_type_t type,
uint32_t width, uint32_t height, int format,
android_dataspace dataSpace, camera3_stream_rotation_t rotation,
- uint32_t consumerUsage = 0, nsecs_t timestampOffset = 0,
+ uint64_t consumerUsage = 0, nsecs_t timestampOffset = 0,
int setId = CAMERA3_STREAM_SET_ID_INVALID);
/**
@@ -191,14 +191,14 @@
virtual status_t disconnectLocked();
- status_t getEndpointUsageForSurface(uint32_t *usage,
+ status_t getEndpointUsageForSurface(uint64_t *usage,
const sp<Surface>& surface) const;
status_t configureConsumerQueueLocked();
// Consumer as the output of camera HAL
sp<Surface> mConsumer;
- uint32_t getPresetConsumerUsage() const { return mConsumerUsage; }
+ uint64_t getPresetConsumerUsage() const { return mConsumerUsage; }
static const nsecs_t kDequeueBufferTimeout = 1000000000; // 1 sec
@@ -245,7 +245,7 @@
* Consumer end point usage flag set by the constructor for the deferred
* consumer case.
*/
- uint32_t mConsumerUsage;
+ uint64_t mConsumerUsage;
/**
* Internal Camera3Stream interface
@@ -262,7 +262,7 @@
virtual status_t configureQueueLocked();
- virtual status_t getEndpointUsage(uint32_t *usage) const;
+ virtual status_t getEndpointUsage(uint64_t *usage) const;
/**
* Private methods
diff --git a/services/camera/libcameraservice/device3/Camera3SharedOutputStream.cpp b/services/camera/libcameraservice/device3/Camera3SharedOutputStream.cpp
index 2ae5660..5051711 100644
--- a/services/camera/libcameraservice/device3/Camera3SharedOutputStream.cpp
+++ b/services/camera/libcameraservice/device3/Camera3SharedOutputStream.cpp
@@ -23,7 +23,7 @@
Camera3SharedOutputStream::Camera3SharedOutputStream(int id,
const std::vector<sp<Surface>>& surfaces,
uint32_t width, uint32_t height, int format,
- uint32_t consumerUsage, android_dataspace dataSpace,
+ uint64_t consumerUsage, android_dataspace dataSpace,
camera3_stream_rotation_t rotation,
nsecs_t timestampOffset, int setId) :
Camera3OutputStream(id, CAMERA3_STREAM_OUTPUT, width, height,
@@ -41,7 +41,7 @@
mStreamSplitter = new Camera3StreamSplitter();
- uint32_t usage;
+ uint64_t usage;
getEndpointUsage(&usage);
res = mStreamSplitter->connect(mSurfaces, usage, camera3_stream::max_buffers, &mConsumer);
@@ -191,10 +191,10 @@
return res;
}
-status_t Camera3SharedOutputStream::getEndpointUsage(uint32_t *usage) const {
+status_t Camera3SharedOutputStream::getEndpointUsage(uint64_t *usage) const {
status_t res = OK;
- uint32_t u = 0;
+ uint64_t u = 0;
if (mConsumer == nullptr) {
// Called before shared buffer queue is constructed.
diff --git a/services/camera/libcameraservice/device3/Camera3SharedOutputStream.h b/services/camera/libcameraservice/device3/Camera3SharedOutputStream.h
index 7be0940..22bb2fc 100644
--- a/services/camera/libcameraservice/device3/Camera3SharedOutputStream.h
+++ b/services/camera/libcameraservice/device3/Camera3SharedOutputStream.h
@@ -34,7 +34,7 @@
*/
Camera3SharedOutputStream(int id, const std::vector<sp<Surface>>& surfaces,
uint32_t width, uint32_t height, int format,
- uint32_t consumerUsage, android_dataspace dataSpace,
+ uint64_t consumerUsage, android_dataspace dataSpace,
camera3_stream_rotation_t rotation, nsecs_t timestampOffset,
int setId = CAMERA3_STREAM_SET_ID_INVALID);
@@ -74,7 +74,7 @@
virtual status_t disconnectLocked();
- virtual status_t getEndpointUsage(uint32_t *usage) const;
+ virtual status_t getEndpointUsage(uint64_t *usage) const;
}; // class Camera3SharedOutputStream
diff --git a/services/camera/libcameraservice/device3/Camera3Stream.cpp b/services/camera/libcameraservice/device3/Camera3Stream.cpp
index 9e6ac79..fbe8f4f 100644
--- a/services/camera/libcameraservice/device3/Camera3Stream.cpp
+++ b/services/camera/libcameraservice/device3/Camera3Stream.cpp
@@ -56,12 +56,15 @@
mState(STATE_CONSTRUCTED),
mStatusId(StatusTracker::NO_STATUS_ID),
mStreamUnpreparable(true),
+ mUsage(0),
mOldUsage(0),
mOldMaxBuffers(0),
mPrepared(false),
mPreparedBufferIdx(0),
mLastMaxCount(Camera3StreamInterface::ALLOCATE_PIPELINE_MAX),
- mBufferLimitLatency(kBufferLimitLatencyBinSize) {
+ mBufferLimitLatency(kBufferLimitLatencyBinSize),
+ mFormatOverridden(false),
+ mOriginalFormat(-1) {
camera3_stream::stream_type = type;
camera3_stream::width = width;
@@ -69,7 +72,6 @@
camera3_stream::format = format;
camera3_stream::data_space = dataSpace;
camera3_stream::rotation = rotation;
- camera3_stream::usage = 0;
camera3_stream::max_buffers = 0;
camera3_stream::priv = NULL;
@@ -104,6 +106,40 @@
return camera3_stream::data_space;
}
+uint64_t Camera3Stream::getUsage() const {
+ return mUsage;
+}
+
+void Camera3Stream::setUsage(uint64_t usage) {
+ mUsage = usage;
+}
+
+void Camera3Stream::setFormatOverride(bool formatOverridden) {
+ mFormatOverridden = formatOverridden;
+ if (formatOverridden) mOriginalFormat = camera3_stream::format;
+}
+
+bool Camera3Stream::isFormatOverridden() const {
+ return mFormatOverridden;
+}
+
+int Camera3Stream::getOriginalFormat() const {
+ return mOriginalFormat;
+}
+
+void Camera3Stream::setDataSpaceOverride(bool dataSpaceOverridden) {
+ mDataSpaceOverridden = dataSpaceOverridden;
+ if (dataSpaceOverridden) mOriginalDataSpace = camera3_stream::data_space;
+}
+
+bool Camera3Stream::isDataSpaceOverridden() const {
+ return mDataSpaceOverridden;
+}
+
+android_dataspace Camera3Stream::getOriginalDataSpace() const {
+ return mOriginalDataSpace;
+}
+
camera3_stream* Camera3Stream::startConfiguration() {
ATRACE_CALL();
Mutex::Autolock l(mLock);
@@ -133,10 +169,10 @@
return NULL;
}
- mOldUsage = camera3_stream::usage;
+ mOldUsage = mUsage;
mOldMaxBuffers = camera3_stream::max_buffers;
- res = getEndpointUsage(&(camera3_stream::usage));
+ res = getEndpointUsage(&mUsage);
if (res != OK) {
ALOGE("%s: Cannot query consumer endpoint usage!",
__FUNCTION__);
@@ -197,7 +233,7 @@
// Check if the stream configuration is unchanged, and skip reallocation if
// so. As documented in hardware/camera3.h:configure_streams().
if (mState == STATE_IN_RECONFIG &&
- mOldUsage == camera3_stream::usage &&
+ mOldUsage == mUsage &&
mOldMaxBuffers == camera3_stream::max_buffers) {
mState = STATE_CONFIGURED;
return OK;
@@ -243,7 +279,7 @@
return INVALID_OPERATION;
}
- camera3_stream::usage = mOldUsage;
+ mUsage = mOldUsage;
camera3_stream::max_buffers = mOldMaxBuffers;
mState = (mState == STATE_IN_RECONFIG) ? STATE_CONFIGURED : STATE_CONSTRUCTED;
diff --git a/services/camera/libcameraservice/device3/Camera3Stream.h b/services/camera/libcameraservice/device3/Camera3Stream.h
index 44fe6b6..6e7912e 100644
--- a/services/camera/libcameraservice/device3/Camera3Stream.h
+++ b/services/camera/libcameraservice/device3/Camera3Stream.h
@@ -144,6 +144,14 @@
uint32_t getHeight() const;
int getFormat() const;
android_dataspace getDataSpace() const;
+ uint64_t getUsage() const;
+ void setUsage(uint64_t usage);
+ void setFormatOverride(bool formatOverriden);
+ bool isFormatOverridden() const;
+ int getOriginalFormat() const;
+ void setDataSpaceOverride(bool dataSpaceOverriden);
+ bool isDataSpaceOverridden() const;
+ android_dataspace getOriginalDataSpace() const;
camera3_stream* asHalStream() override {
return this;
@@ -459,7 +467,7 @@
// Get the usage flags for the other endpoint, or return
// INVALID_OPERATION if they cannot be obtained.
- virtual status_t getEndpointUsage(uint32_t *usage) const = 0;
+ virtual status_t getEndpointUsage(uint64_t *usage) const = 0;
// Return whether the buffer is in the list of outstanding buffers.
bool isOutstandingBuffer(const camera3_stream_buffer& buffer) const;
@@ -473,8 +481,10 @@
// prepareNextBuffer called on it.
bool mStreamUnpreparable;
+ uint64_t mUsage;
+
private:
- uint32_t mOldUsage;
+ uint64_t mOldUsage;
uint32_t mOldMaxBuffers;
Condition mOutputBufferReturnedSignal;
Condition mInputBufferReturnedSignal;
@@ -510,6 +520,15 @@
// max_buffers.
static const int32_t kBufferLimitLatencyBinSize = 33; //in ms
CameraLatencyHistogram mBufferLimitLatency;
+
+ //Keep track of original format in case it gets overridden
+ bool mFormatOverridden;
+ int mOriginalFormat;
+
+ //Keep track of original dataSpace in case it gets overridden
+ bool mDataSpaceOverridden;
+ android_dataspace mOriginalDataSpace;
+
}; // class Camera3Stream
}; // namespace camera3
diff --git a/services/camera/libcameraservice/device3/Camera3StreamInterface.h b/services/camera/libcameraservice/device3/Camera3StreamInterface.h
index 0544a1b..cc9bf8e 100644
--- a/services/camera/libcameraservice/device3/Camera3StreamInterface.h
+++ b/services/camera/libcameraservice/device3/Camera3StreamInterface.h
@@ -71,6 +71,12 @@
virtual uint32_t getHeight() const = 0;
virtual int getFormat() const = 0;
virtual android_dataspace getDataSpace() const = 0;
+ virtual void setFormatOverride(bool formatOverriden) = 0;
+ virtual bool isFormatOverridden() const = 0;
+ virtual int getOriginalFormat() const = 0;
+ virtual void setDataSpaceOverride(bool dataSpaceOverriden) = 0;
+ virtual bool isDataSpaceOverridden() const = 0;
+ virtual android_dataspace getOriginalDataSpace() const = 0;
/**
* Get a HAL3 handle for the stream, without starting stream configuration.
diff --git a/services/camera/libcameraservice/device3/Camera3StreamSplitter.cpp b/services/camera/libcameraservice/device3/Camera3StreamSplitter.cpp
index 869e93a..a0a50c2 100644
--- a/services/camera/libcameraservice/device3/Camera3StreamSplitter.cpp
+++ b/services/camera/libcameraservice/device3/Camera3StreamSplitter.cpp
@@ -39,7 +39,7 @@
namespace android {
status_t Camera3StreamSplitter::connect(const std::vector<sp<Surface> >& surfaces,
- uint32_t consumerUsage, size_t halMaxBuffers, sp<Surface>* consumer) {
+ uint64_t consumerUsage, size_t halMaxBuffers, sp<Surface>* consumer) {
ATRACE_CALL();
if (consumer == nullptr) {
SP_LOGE("%s: consumer pointer is NULL", __FUNCTION__);
@@ -195,10 +195,8 @@
// Set dequeueBuffer/attachBuffer timeout if the consumer is not hw composer or hw texture.
// We need skip these cases as timeout will disable the non-blocking (async) mode.
- int32_t usage = 0;
- static_cast<ANativeWindow*>(outputQueue.get())->query(
- outputQueue.get(),
- NATIVE_WINDOW_CONSUMER_USAGE_BITS, &usage);
+ uint64_t usage = 0;
+ res = native_window_get_consumer_usage(static_cast<ANativeWindow*>(outputQueue.get()), &usage);
if (!(usage & (GRALLOC_USAGE_HW_COMPOSER | GRALLOC_USAGE_HW_TEXTURE))) {
outputQueue->setDequeueTimeout(kDequeueBufferTimeout);
}
diff --git a/services/camera/libcameraservice/device3/Camera3StreamSplitter.h b/services/camera/libcameraservice/device3/Camera3StreamSplitter.h
index cc623e0..3b8839e 100644
--- a/services/camera/libcameraservice/device3/Camera3StreamSplitter.h
+++ b/services/camera/libcameraservice/device3/Camera3StreamSplitter.h
@@ -52,7 +52,7 @@
// Connect to the stream splitter by creating buffer queue and connecting it
// with output surfaces.
status_t connect(const std::vector<sp<Surface> >& surfaces,
- uint32_t consumerUsage, size_t halMaxBuffers,
+ uint64_t consumerUsage, size_t halMaxBuffers,
sp<Surface>* consumer);
// addOutput adds an output BufferQueue to the splitter. The splitter
diff --git a/services/camera/libcameraservice/gui/RingBufferConsumer.cpp b/services/camera/libcameraservice/gui/RingBufferConsumer.cpp
index 3d54460..ee018c3 100644
--- a/services/camera/libcameraservice/gui/RingBufferConsumer.cpp
+++ b/services/camera/libcameraservice/gui/RingBufferConsumer.cpp
@@ -38,7 +38,7 @@
namespace android {
RingBufferConsumer::RingBufferConsumer(const sp<IGraphicBufferConsumer>& consumer,
- uint32_t consumerUsage,
+ uint64_t consumerUsage,
int bufferCount) :
ConsumerBase(consumer),
mBufferCount(bufferCount),
@@ -368,7 +368,7 @@
return mConsumer->setDefaultBufferFormat(defaultFormat);
}
-status_t RingBufferConsumer::setConsumerUsage(uint32_t usage) {
+status_t RingBufferConsumer::setConsumerUsage(uint64_t usage) {
Mutex::Autolock _l(mMutex);
return mConsumer->setConsumerUsageBits(usage);
}
diff --git a/services/camera/libcameraservice/gui/RingBufferConsumer.h b/services/camera/libcameraservice/gui/RingBufferConsumer.h
index 2bafe4a..b737469 100644
--- a/services/camera/libcameraservice/gui/RingBufferConsumer.h
+++ b/services/camera/libcameraservice/gui/RingBufferConsumer.h
@@ -60,7 +60,7 @@
// the consumer usage flags passed to the graphics allocator. The
// bufferCount parameter specifies how many buffers can be pinned for user
// access at the same time.
- RingBufferConsumer(const sp<IGraphicBufferConsumer>& consumer, uint32_t consumerUsage,
+ RingBufferConsumer(const sp<IGraphicBufferConsumer>& consumer, uint64_t consumerUsage,
int bufferCount);
virtual ~RingBufferConsumer();
@@ -80,7 +80,7 @@
// setConsumerUsage allows the BufferQueue consumer usage to be
// set at a later time after construction.
- status_t setConsumerUsage(uint32_t usage);
+ status_t setConsumerUsage(uint64_t usage);
// Buffer info, minus the graphics buffer/slot itself.
struct BufferInfo {
diff --git a/services/mediaanalytics/MediaAnalyticsService.cpp b/services/mediaanalytics/MediaAnalyticsService.cpp
index 876c685..c7f9270 100644
--- a/services/mediaanalytics/MediaAnalyticsService.cpp
+++ b/services/mediaanalytics/MediaAnalyticsService.cpp
@@ -29,12 +29,15 @@
#include <unistd.h>
#include <string.h>
+#include <pwd.h>
#include <cutils/atomic.h>
#include <cutils/properties.h> // for property_get
#include <utils/misc.h>
+#include <android/content/pm/IPackageManagerNative.h>
+
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
#include <binder/MemoryHeapBase.h>
@@ -80,27 +83,26 @@
namespace android {
+ using namespace android::base;
+ using namespace android::content::pm;
+
// summarized records
-// up to 48 sets, each covering an hour -- at least 2 days of coverage
+// up to 36 sets, each covering an hour -- so at least 1.5 days
// (will be longer if there are hours without any media action)
static const nsecs_t kNewSetIntervalNs = 3600*(1000*1000*1000ll);
-static const int kMaxRecordSets = 48;
-// individual records kept in memory
-static const int kMaxRecords = 100;
+static const int kMaxRecordSets = 36;
+// individual records kept in memory: age or count
+// age: <= 36 hours (1.5 days)
+// count: hard limit of # records
+// (0 for either of these disables that threshold)
+static const nsecs_t kMaxRecordAgeNs = 36 * 3600 * (1000*1000*1000ll);
+static const int kMaxRecords = 0;
static const char *kServiceName = "media.metrics";
-
-//using android::status_t;
-//using android::OK;
-//using android::BAD_VALUE;
-//using android::NOT_ENOUGH_DATA;
-//using android::Parcel;
-
-
void MediaAnalyticsService::instantiate() {
defaultServiceManager()->addService(
String16(kServiceName), new MediaAnalyticsService());
@@ -110,6 +112,7 @@
MediaAnalyticsService::SummarizerSet::SummarizerSet() {
mSummarizers = new List<MetricsSummarizer *>();
}
+
MediaAnalyticsService::SummarizerSet::~SummarizerSet() {
// empty the list
List<MetricsSummarizer *> *l = mSummarizers;
@@ -153,8 +156,10 @@
MediaAnalyticsService::MediaAnalyticsService()
: mMaxRecords(kMaxRecords),
+ mMaxRecordAgeNs(kMaxRecordAgeNs),
mMaxRecordSets(kMaxRecordSets),
- mNewSetInterval(kNewSetIntervalNs) {
+ mNewSetInterval(kNewSetIntervalNs),
+ mDumpProto(MediaAnalyticsItem::PROTO_V0) {
ALOGD("MediaAnalyticsService created");
// clear our queues
@@ -167,6 +172,8 @@
mItemsSubmitted = 0;
mItemsFinalized = 0;
mItemsDiscarded = 0;
+ mItemsDiscardedExpire = 0;
+ mItemsDiscardedCount = 0;
mLastSessionID = 0;
// recover any persistency we set up
@@ -177,8 +184,23 @@
ALOGD("MediaAnalyticsService destroyed");
// clean out mOpen and mFinalized
+ while (mOpen->size() > 0) {
+ MediaAnalyticsItem * oitem = *(mOpen->begin());
+ mOpen->erase(mOpen->begin());
+ delete oitem;
+ mItemsDiscarded++;
+ mItemsDiscardedCount++;
+ }
delete mOpen;
mOpen = NULL;
+
+ while (mFinalized->size() > 0) {
+ MediaAnalyticsItem * oitem = *(mFinalized->begin());
+ mFinalized->erase(mFinalized->begin());
+ delete oitem;
+ mItemsDiscarded++;
+ mItemsDiscardedCount++;
+ }
delete mFinalized;
mFinalized = NULL;
@@ -200,6 +222,8 @@
// we control these, generally not trusting user input
nsecs_t now = systemTime(SYSTEM_TIME_REALTIME);
+ // round nsecs to seconds
+ now = ((now + 500000000) / 1000000000) * 1000000000;
item->setTimestamp(now);
int pid = IPCThreadState::self()->getCallingPid();
int uid = IPCThreadState::self()->getCallingUid();
@@ -212,13 +236,15 @@
//
bool isTrusted = false;
+ ALOGV("caller has uid=%d, embedded uid=%d", uid, uid_given);
+
switch (uid) {
case AID_MEDIA:
case AID_MEDIA_CODEC:
case AID_MEDIA_EX:
case AID_MEDIA_DRM:
// trusted source, only override default values
- isTrusted = true;
+ isTrusted = true;
if (uid_given == (-1)) {
item->setUid(uid);
}
@@ -234,6 +260,22 @@
}
+ // Overwrite package name and version if the caller was untrusted.
+ if (!isTrusted) {
+ setPkgInfo(item, item->getUid(), true, true);
+ } else if (item->getPkgName().empty()) {
+ // empty, so fill out both parts
+ setPkgInfo(item, item->getUid(), true, true);
+ } else {
+ // trusted, provided a package, do nothing
+ }
+
+ ALOGV("given uid %d; sanitized uid: %d sanitized pkg: %s "
+ "sanitized pkg version: %d",
+ uid_given, item->getUid(),
+ item->getPkgName().c_str(),
+ item->getPkgVersionCode());
+
mItemsSubmitted++;
// validate the record; we discard if we don't like it
@@ -316,6 +358,7 @@
return id;
}
+
status_t MediaAnalyticsService::dump(int fd, const Vector<String16>& args)
{
const size_t SIZE = 512;
@@ -333,22 +376,41 @@
}
// crack any parameters
- bool clear = false;
- bool summary = false;
- nsecs_t ts_since = 0;
String16 summaryOption("-summary");
+ bool summary = false;
+ String16 protoOption("-proto");
String16 clearOption("-clear");
+ bool clear = false;
String16 sinceOption("-since");
+ nsecs_t ts_since = 0;
String16 helpOption("-help");
String16 onlyOption("-only");
- const char *only = NULL;
+ AString only;
int n = args.size();
+
for (int i = 0; i < n; i++) {
String8 myarg(args[i]);
if (args[i] == clearOption) {
clear = true;
} else if (args[i] == summaryOption) {
summary = true;
+ } else if (args[i] == protoOption) {
+ i++;
+ if (i < n) {
+ String8 value(args[i]);
+ int proto = MediaAnalyticsItem::PROTO_V0; // default to original
+ char *endp;
+ const char *p = value.string();
+ proto = strtol(p, &endp, 10);
+ if (endp != p || *endp == '\0') {
+ if (proto < MediaAnalyticsItem::PROTO_FIRST) {
+ proto = MediaAnalyticsItem::PROTO_FIRST;
+ } else if (proto > MediaAnalyticsItem::PROTO_LAST) {
+ proto = MediaAnalyticsItem::PROTO_LAST;
+ }
+ mDumpProto = proto;
+ }
+ }
} else if (args[i] == sinceOption) {
i++;
if (i < n) {
@@ -368,18 +430,12 @@
i++;
if (i < n) {
String8 value(args[i]);
- const char *p = value.string();
- char *q = strdup(p);
- if (q != NULL) {
- if (only != NULL) {
- free((void*)only);
- }
- only = q;
- }
+ only = value.string();
}
} else if (args[i] == helpOption) {
result.append("Recognized parameters:\n");
result.append("-help this help message\n");
+ result.append("-proto X dump using protocol X (defaults to 1)");
result.append("-summary show summary info\n");
result.append("-clear clears out saved records\n");
result.append("-only X process records for component X\n");
@@ -398,11 +454,11 @@
dumpHeaders(result, ts_since);
- // only want 1, to avoid confusing folks that parse the output
+ // want exactly 1, to avoid confusing folks that parse the output
if (summary) {
- dumpSummaries(result, ts_since, only);
+ dumpSummaries(result, ts_since, only.c_str());
} else {
- dumpRecent(result, ts_since, only);
+ dumpRecent(result, ts_since, only.c_str());
}
@@ -428,6 +484,9 @@
const size_t SIZE = 512;
char buffer[SIZE];
+ snprintf(buffer, SIZE, "Protocol Version: %d\n", mDumpProto);
+ result.append(buffer);
+
int enabled = MediaAnalyticsItem::isEnabled();
if (enabled) {
snprintf(buffer, SIZE, "Metrics gathering: enabled\n");
@@ -437,10 +496,14 @@
result.append(buffer);
snprintf(buffer, SIZE,
- "Since Boot: Submissions: %" PRId64
- " Finalizations: %" PRId64
- " Discarded: %" PRId64 "\n",
- mItemsSubmitted, mItemsFinalized, mItemsDiscarded);
+ "Since Boot: Submissions: %8" PRId64
+ " Finalizations: %8" PRId64 "\n",
+ mItemsSubmitted, mItemsFinalized);
+ result.append(buffer);
+ snprintf(buffer, SIZE,
+ "Records Discarded: %8" PRId64
+ " (by Count: %" PRId64 " by Expiration: %" PRId64 ")\n",
+ mItemsDiscarded, mItemsDiscardedCount, mItemsDiscardedExpire);
result.append(buffer);
snprintf(buffer, SIZE,
"Summary Sets Discarded: %" PRId64 "\n", mSetsDiscarded);
@@ -462,6 +525,10 @@
snprintf(buffer, SIZE, "\nSummarized Metrics:\n");
result.append(buffer);
+ if (only != NULL && *only == '\0') {
+ only = NULL;
+ }
+
// have each of the distillers dump records
if (mSummarizerSets != NULL) {
List<SummarizerSet *>::iterator itSet = mSummarizerSets->begin();
@@ -488,6 +555,10 @@
const size_t SIZE = 512;
char buffer[SIZE];
+ if (only != NULL && *only == '\0') {
+ only = NULL;
+ }
+
// show the recently recorded records
snprintf(buffer, sizeof(buffer), "\nFinalized Metrics (oldest first):\n");
result.append(buffer);
@@ -524,7 +595,7 @@
ALOGV("Omit '%s', it's not '%s'", (*it)->getKey().c_str(), only);
continue;
}
- AString entry = (*it)->toString();
+ AString entry = (*it)->toString(mDumpProto);
result.appendFormat("%5d: %s\n", slot, entry.c_str());
slot++;
}
@@ -549,13 +620,32 @@
l->push_back(item);
}
- // keep removing old records the front until we're in-bounds
+ // keep removing old records the front until we're in-bounds (count)
if (mMaxRecords > 0) {
while (l->size() > (size_t) mMaxRecords) {
MediaAnalyticsItem * oitem = *(l->begin());
l->erase(l->begin());
delete oitem;
mItemsDiscarded++;
+ mItemsDiscardedCount++;
+ }
+ }
+
+ // keep removing old records the front until we're in-bounds (count)
+ if (mMaxRecordAgeNs > 0) {
+ nsecs_t now = systemTime(SYSTEM_TIME_REALTIME);
+ while (l->size() > 0) {
+ MediaAnalyticsItem * oitem = *(l->begin());
+ nsecs_t when = oitem->getTimestamp();
+ // careful about timejumps too
+ if ((now > when) && (now-when) <= mMaxRecordAgeNs) {
+ // this (and the rest) are recent enough to keep
+ break;
+ }
+ l->erase(l->begin());
+ delete oitem;
+ mItemsDiscarded++;
+ mItemsDiscardedExpire++;
}
}
}
@@ -563,11 +653,6 @@
// are they alike enough that nitem can be folded into oitem?
static bool compatibleItems(MediaAnalyticsItem * oitem, MediaAnalyticsItem * nitem) {
- if (0) {
- ALOGD("Compare: o %s n %s",
- oitem->toString().c_str(), nitem->toString().c_str());
- }
-
// general safety
if (nitem->getUid() != oitem->getUid()) {
return false;
@@ -718,4 +803,155 @@
}
+// how long we hold package info before we re-fetch it
+#define PKG_EXPIRATION_NS (30*60*1000000000ll) // 30 minutes, in nsecs
+
+// give me the package name, perhaps going to find it
+void MediaAnalyticsService::setPkgInfo(MediaAnalyticsItem *item, uid_t uid, bool setName, bool setVersion) {
+ ALOGV("asking for packagename to go with uid=%d", uid);
+
+ if (!setName && !setVersion) {
+ // setting nothing? strange
+ return;
+ }
+
+ nsecs_t now = systemTime(SYSTEM_TIME_REALTIME);
+ struct UidToPkgMap mapping;
+ mapping.uid = (-1);
+
+ ssize_t i = mPkgMappings.indexOfKey(uid);
+ if (i >= 0) {
+ mapping = mPkgMappings.valueAt(i);
+ ALOGV("Expiration? uid %d expiration %" PRId64 " now %" PRId64,
+ uid, mapping.expiration, now);
+ if (mapping.expiration < now) {
+ // purge our current entry and re-query
+ ALOGV("entry for uid %d expired, now= %" PRId64 "", uid, now);
+ mPkgMappings.removeItemsAt(i, 1);
+ // could cheat and use a goto back to the top of the routine.
+ // a good compiler should recognize the local tail recursion...
+ return setPkgInfo(item, uid, setName, setVersion);
+ }
+ } else {
+ AString pkg;
+ std::string installer = "";
+ int32_t versionCode = 0;
+
+ struct passwd *pw = getpwuid(uid);
+ if (pw) {
+ pkg = pw->pw_name;
+ }
+
+ // find the proper value -- should we cache this binder??
+
+ sp<IBinder> binder = NULL;
+ sp<IServiceManager> sm = defaultServiceManager();
+ if (sm == NULL) {
+ ALOGE("defaultServiceManager failed");
+ } else {
+ binder = sm->getService(String16("package_native"));
+ if (binder == NULL) {
+ ALOGE("getService package_native failed");
+ }
+ }
+
+ if (binder != NULL) {
+ sp<IPackageManagerNative> package_mgr = interface_cast<IPackageManagerNative>(binder);
+ binder::Status status;
+
+ std::vector<int> uids;
+ std::vector<std::string> names;
+
+ uids.push_back(uid);
+
+ status = package_mgr->getNamesForUids(uids, &names);
+ if (!status.isOk()) {
+ ALOGE("package_native::getNamesForUids failed: %s",
+ status.exceptionMessage().c_str());
+ } else {
+ if (!names[0].empty()) {
+ pkg = names[0].c_str();
+ }
+ }
+
+ // strip any leading "shared:" strings that came back
+ if (pkg.startsWith("shared:")) {
+ pkg.erase(0, 7);
+ }
+
+ // determine how pkg was installed and the versionCode
+ //
+ if (pkg.empty()) {
+ // no name for us to manage
+ } else if (strchr(pkg.c_str(), '.') == NULL) {
+ // not of form 'com.whatever...'; assume internal and ok
+ } else if (strncmp(pkg.c_str(), "android.", 8) == 0) {
+ // android.* packages are assumed fine
+ } else {
+ String16 pkgName16(pkg.c_str());
+ status = package_mgr->getInstallerForPackage(pkgName16, &installer);
+ if (!status.isOk()) {
+ ALOGE("package_native::getInstallerForPackage failed: %s",
+ status.exceptionMessage().c_str());
+ }
+
+ // skip if we didn't get an installer
+ if (status.isOk()) {
+ status = package_mgr->getVersionCodeForPackage(pkgName16, &versionCode);
+ if (!status.isOk()) {
+ ALOGE("package_native::getVersionCodeForPackage failed: %s",
+ status.exceptionMessage().c_str());
+ }
+ }
+
+
+ ALOGV("package '%s' installed by '%s' versioncode %d / %08x",
+ pkg.c_str(), installer.c_str(), versionCode, versionCode);
+
+ if (strncmp(installer.c_str(), "com.android.", 12) == 0) {
+ // from play store, we keep info
+ } else if (strncmp(installer.c_str(), "com.google.", 11) == 0) {
+ // some google source, we keep info
+ } else if (strcmp(installer.c_str(), "preload") == 0) {
+ // preloads, we keep the info
+ } else if (installer.c_str()[0] == '\0') {
+ // sideload (no installer); do not report
+ pkg = "";
+ versionCode = 0;
+ } else {
+ // unknown installer; do not report
+ pkg = "";
+ versionCode = 0;
+ }
+ }
+ }
+
+ // add it to the map, to save a subsequent lookup
+ if (!pkg.empty()) {
+ Mutex::Autolock _l(mLock_mappings);
+ ALOGV("Adding uid %d pkg '%s'", uid, pkg.c_str());
+ ssize_t i = mPkgMappings.indexOfKey(uid);
+ if (i < 0) {
+ mapping.uid = uid;
+ mapping.pkg = pkg;
+ mapping.installer = installer.c_str();
+ mapping.versionCode = versionCode;
+ mapping.expiration = now + PKG_EXPIRATION_NS;
+ ALOGV("expiration for uid %d set to %" PRId64 "", uid, mapping.expiration);
+
+ mPkgMappings.add(uid, mapping);
+ }
+ }
+ }
+
+ if (mapping.uid != (uid_t)(-1)) {
+ if (setName) {
+ item->setPkgName(mapping.pkg);
+ }
+ if (setVersion) {
+ item->setPkgVersionCode(mapping.versionCode);
+ }
+ }
+}
+
} // namespace android
diff --git a/services/mediaanalytics/MediaAnalyticsService.h b/services/mediaanalytics/MediaAnalyticsService.h
index 6685967..52e4631 100644
--- a/services/mediaanalytics/MediaAnalyticsService.h
+++ b/services/mediaanalytics/MediaAnalyticsService.h
@@ -54,16 +54,22 @@
int64_t mItemsSubmitted;
int64_t mItemsFinalized;
int64_t mItemsDiscarded;
+ int64_t mItemsDiscardedExpire;
+ int64_t mItemsDiscardedCount;
int64_t mSetsDiscarded;
MediaAnalyticsItem::SessionID_t mLastSessionID;
// partitioned a bit so we don't over serialize
mutable Mutex mLock;
mutable Mutex mLock_ids;
+ mutable Mutex mLock_mappings;
- // the most we hold in memory
- // up to this many in each queue (open, finalized)
+ // limit how many records we'll retain
+ // by count (in each queue (open, finalized))
int32_t mMaxRecords;
+ // by time (none older than this long agan
+ nsecs_t mMaxRecordAgeNs;
+ //
// # of sets of summaries
int32_t mMaxRecordSets;
// nsecs until we start a new record set
@@ -118,6 +124,7 @@
void deleteItem(List<MediaAnalyticsItem *> *, MediaAnalyticsItem *);
// support for generating output
+ int mDumpProto;
String8 dumpQueue(List<MediaAnalyticsItem*> *);
String8 dumpQueue(List<MediaAnalyticsItem*> *, nsecs_t, const char *only);
@@ -125,6 +132,18 @@
void dumpSummaries(String8 &result, nsecs_t ts_since, const char * only);
void dumpRecent(String8 &result, nsecs_t ts_since, const char * only);
+ // mapping uids to package names
+ struct UidToPkgMap {
+ uid_t uid;
+ AString pkg;
+ AString installer;
+ int32_t versionCode;
+ nsecs_t expiration;
+ };
+
+ KeyedVector<uid_t,struct UidToPkgMap> mPkgMappings;
+ void setPkgInfo(MediaAnalyticsItem *item, uid_t uid, bool setName, bool setVersion);
+
};
// ----------------------------------------------------------------------------
diff --git a/services/mediaanalytics/MetricsSummarizer.cpp b/services/mediaanalytics/MetricsSummarizer.cpp
index 3477f1f..93fe0ec 100644
--- a/services/mediaanalytics/MetricsSummarizer.cpp
+++ b/services/mediaanalytics/MetricsSummarizer.cpp
@@ -141,23 +141,23 @@
List<MediaAnalyticsItem *>::iterator it = mSummaries->begin();
for (; it != mSummaries->end(); it++) {
bool good = sameAttributes((*it), item, getIgnorables());
- ALOGV("Match against %s says %d",
- (*it)->toString().c_str(), good);
+ ALOGV("Match against %s says %d", (*it)->toString().c_str(), good);
if (good)
break;
}
if (it == mSummaries->end()) {
ALOGV("save new record");
- item = item->dup();
- if (item == NULL) {
+ MediaAnalyticsItem *nitem = item->dup();
+ if (nitem == NULL) {
ALOGE("unable to save MediaMetrics record");
}
- sortProps(item);
- item->setInt32("count",1);
- mSummaries->push_back(item);
+ sortProps(nitem);
+ nitem->setInt32("aggregated",1);
+ mergeRecord(*nitem, *item);
+ mSummaries->push_back(nitem);
} else {
ALOGV("increment existing record");
- (*it)->addInt32("count",1);
+ (*it)->addInt32("aggregated",1);
mergeRecord(*(*it), *item);
}
}
@@ -168,6 +168,71 @@
return;
}
+// keep some stats for things: sums, counts, standard deviation
+// the integer version -- all of these pieces are in 64 bits
+void MetricsSummarizer::minMaxVar64(MediaAnalyticsItem &summation, const char *key, int64_t value) {
+ if (key == NULL)
+ return;
+ int len = strlen(key) + 32;
+ char *tmpKey = (char *)malloc(len);
+
+ if (tmpKey == NULL) {
+ return;
+ }
+
+ // N - count of samples
+ snprintf(tmpKey, len, "%s.n", key);
+ summation.addInt64(tmpKey, 1);
+
+ // zero - count of samples that are zero
+ if (value == 0) {
+ snprintf(tmpKey, len, "%s.zero", key);
+ int64_t zero = 0;
+ (void) summation.getInt64(tmpKey,&zero);
+ zero++;
+ summation.setInt64(tmpKey, zero);
+ }
+
+ // min
+ snprintf(tmpKey, len, "%s.min", key);
+ int64_t min = value;
+ if (summation.getInt64(tmpKey,&min)) {
+ if (min > value) {
+ summation.setInt64(tmpKey, value);
+ }
+ } else {
+ summation.setInt64(tmpKey, value);
+ }
+
+ // max
+ snprintf(tmpKey, len, "%s.max", key);
+ int64_t max = value;
+ if (summation.getInt64(tmpKey,&max)) {
+ if (max < value) {
+ summation.setInt64(tmpKey, value);
+ }
+ } else {
+ summation.setInt64(tmpKey, value);
+ }
+
+ // components for mean, stddev;
+ // stddev = sqrt(1/4*(sumx2 - (2*sumx*sumx/n) + ((sumx/n)^2)))
+ // sum x
+ snprintf(tmpKey, len, "%s.sumX", key);
+ summation.addInt64(tmpKey, value);
+ // sum x^2
+ snprintf(tmpKey, len, "%s.sumX2", key);
+ summation.addInt64(tmpKey, value*value);
+
+
+ // last thing we do -- remove the base key from the summation
+ // record so we won't get confused about it having both individual
+ // and summary information in there.
+ summation.removeProp(key);
+
+ free(tmpKey);
+}
+
//
// Comparators
@@ -186,20 +251,23 @@
ALOGV("MetricsSummarizer::sameAttributes(): summ %s", summ->toString().c_str());
ALOGV("MetricsSummarizer::sameAttributes(): single %s", single->toString().c_str());
+ // keep different sources/users separate
+ if (single->mUid != summ->mUid) {
+ return false;
+ }
+
// this can be made better.
for(size_t i=0;i<single->mPropCount;i++) {
MediaAnalyticsItem::Prop *prop1 = &(single->mProps[i]);
const char *attrName = prop1->mName;
- ALOGV("compare on attr '%s'", attrName);
// is it something we should ignore
if (ignorable != NULL) {
const char **ig = ignorable;
- while (*ig) {
+ for (;*ig; ig++) {
if (strcmp(*ig, attrName) == 0) {
break;
}
- ig++;
}
if (*ig) {
ALOGV("we don't mind that it has attr '%s'", attrName);
@@ -218,29 +286,42 @@
}
switch (prop1->mType) {
case MediaAnalyticsItem::kTypeInt32:
- if (prop1->u.int32Value != prop2->u.int32Value)
+ if (prop1->u.int32Value != prop2->u.int32Value) {
+ ALOGV("mismatch values");
return false;
+ }
break;
case MediaAnalyticsItem::kTypeInt64:
- if (prop1->u.int64Value != prop2->u.int64Value)
+ if (prop1->u.int64Value != prop2->u.int64Value) {
+ ALOGV("mismatch values");
return false;
+ }
break;
case MediaAnalyticsItem::kTypeDouble:
// XXX: watch out for floating point comparisons!
- if (prop1->u.doubleValue != prop2->u.doubleValue)
+ if (prop1->u.doubleValue != prop2->u.doubleValue) {
+ ALOGV("mismatch values");
return false;
+ }
break;
case MediaAnalyticsItem::kTypeCString:
- if (strcmp(prop1->u.CStringValue, prop2->u.CStringValue) != 0)
+ if (strcmp(prop1->u.CStringValue, prop2->u.CStringValue) != 0) {
+ ALOGV("mismatch values");
return false;
+ }
break;
case MediaAnalyticsItem::kTypeRate:
- if (prop1->u.rate.count != prop2->u.rate.count)
+ if (prop1->u.rate.count != prop2->u.rate.count) {
+ ALOGV("mismatch values");
return false;
- if (prop1->u.rate.duration != prop2->u.rate.duration)
+ }
+ if (prop1->u.rate.duration != prop2->u.rate.duration) {
+ ALOGV("mismatch values");
return false;
+ }
break;
default:
+ ALOGV("mismatch values in default type");
return false;
}
}
@@ -248,15 +329,6 @@
return true;
}
-bool MetricsSummarizer::sameAttributesId(MediaAnalyticsItem *summ, MediaAnalyticsItem *single, const char **ignorable) {
-
- // verify same user
- if (summ->mPid != single->mPid)
- return false;
-
- // and finally do the more expensive validation of the attributes
- return sameAttributes(summ, single, ignorable);
-}
int MetricsSummarizer::PropSorter(const void *a, const void *b) {
MediaAnalyticsItem::Prop *ai = (MediaAnalyticsItem::Prop *)a;
@@ -267,14 +339,8 @@
// we sort in the summaries so that it looks pretty in the dumpsys
void MetricsSummarizer::sortProps(MediaAnalyticsItem *item) {
if (item->mPropCount != 0) {
- if (DEBUG_SORT) {
- ALOGD("sortProps(pre): %s", item->toString().c_str());
- }
qsort(item->mProps, item->mPropCount,
sizeof(MediaAnalyticsItem::Prop), MetricsSummarizer::PropSorter);
- if (DEBUG_SORT) {
- ALOGD("sortProps(pst): %s", item->toString().c_str());
- }
}
}
diff --git a/services/mediaanalytics/MetricsSummarizer.h b/services/mediaanalytics/MetricsSummarizer.h
index 0b64eac..a9f0786 100644
--- a/services/mediaanalytics/MetricsSummarizer.h
+++ b/services/mediaanalytics/MetricsSummarizer.h
@@ -59,10 +59,9 @@
// various comparators
// "do these records have same attributes and values in those attrs"
- // ditto, but watch for "error" fields
bool sameAttributes(MediaAnalyticsItem *summ, MediaAnalyticsItem *single, const char **ignoreables);
- // attributes + from the same app/userid
- bool sameAttributesId(MediaAnalyticsItem *summ, MediaAnalyticsItem *single, const char **ignoreables);
+
+ void minMaxVar64(MediaAnalyticsItem &summ, const char *key, int64_t value);
static int PropSorter(const void *a, const void *b);
void sortProps(MediaAnalyticsItem *item);
diff --git a/services/mediaanalytics/MetricsSummarizerCodec.cpp b/services/mediaanalytics/MetricsSummarizerCodec.cpp
index 8c74782..6af3c9a 100644
--- a/services/mediaanalytics/MetricsSummarizerCodec.cpp
+++ b/services/mediaanalytics/MetricsSummarizerCodec.cpp
@@ -17,6 +17,8 @@
#define LOG_TAG "MetricsSummarizerCodec"
#include <utils/Log.h>
+#include <stdint.h>
+#include <inttypes.h>
#include <utils/threads.h>
#include <utils/Errors.h>
@@ -40,5 +42,4 @@
ALOGV("MetricsSummarizerCodec::MetricsSummarizerCodec");
}
-
} // namespace android
diff --git a/services/mediaanalytics/MetricsSummarizerPlayer.cpp b/services/mediaanalytics/MetricsSummarizerPlayer.cpp
index 5162059..f882cb9 100644
--- a/services/mediaanalytics/MetricsSummarizerPlayer.cpp
+++ b/services/mediaanalytics/MetricsSummarizerPlayer.cpp
@@ -51,37 +51,43 @@
setIgnorables(player_ignorable);
}
+// NB: this is also called for the first time -- so summation == item
+// Not sure if we need a flag for that or not.
+// In this particular mergeRecord() code -- we're' ok for this.
void MetricsSummarizerPlayer::mergeRecord(MediaAnalyticsItem &summation, MediaAnalyticsItem &item) {
ALOGV("MetricsSummarizerPlayer::mergeRecord()");
- //
- // we sum time & frames.
- // be careful about our special "-1" values that indicate 'unknown'
- // treat those as 0 [basically, not summing them into the totals].
+
int64_t duration = 0;
if (item.getInt64("android.media.mediaplayer.durationMs", &duration)) {
ALOGV("found durationMs of %" PRId64, duration);
- summation.addInt64("android.media.mediaplayer.durationMs",duration);
+ minMaxVar64(summation, "android.media.mediaplayer.durationMs", duration);
}
+
int64_t playing = 0;
- if (item.getInt64("android.media.mediaplayer.playingMs", &playing))
+ if (item.getInt64("android.media.mediaplayer.playingMs", &playing)) {
ALOGV("found playingMs of %" PRId64, playing);
- if (playing >= 0) {
- summation.addInt64("android.media.mediaplayer.playingMs",playing);
- }
+ }
+ if (playing >= 0) {
+ minMaxVar64(summation,"android.media.mediaplayer.playingMs",playing);
+ }
+
int64_t frames = 0;
- if (item.getInt64("android.media.mediaplayer.frames", &frames))
+ if (item.getInt64("android.media.mediaplayer.frames", &frames)) {
ALOGV("found framess of %" PRId64, frames);
- if (frames >= 0) {
- summation.addInt64("android.media.mediaplayer.frames",frames);
- }
+ }
+ if (frames >= 0) {
+ minMaxVar64(summation,"android.media.mediaplayer.frames",frames);
+ }
+
int64_t dropped = 0;
- if (item.getInt64("android.media.mediaplayer.dropped", &dropped))
+ if (item.getInt64("android.media.mediaplayer.dropped", &dropped)) {
ALOGV("found dropped of %" PRId64, dropped);
- if (dropped >= 0) {
- summation.addInt64("android.media.mediaplayer.dropped",dropped);
- }
+ }
+ if (dropped >= 0) {
+ minMaxVar64(summation,"android.media.mediaplayer.dropped",dropped);
+ }
}
} // namespace android
diff --git a/services/mediaanalytics/mediametrics.rc b/services/mediaanalytics/mediametrics.rc
index 3829f8c..1efde5e 100644
--- a/services/mediaanalytics/mediametrics.rc
+++ b/services/mediaanalytics/mediametrics.rc
@@ -1,5 +1,6 @@
service mediametrics /system/bin/mediametrics
class main
user media
+ group media
ioprio rt 4
writepid /dev/cpuset/foreground/tasks /dev/stune/foreground/tasks
diff --git a/services/mediacodec/Android.mk b/services/mediacodec/Android.mk
index 6997b5a..1ead944 100644
--- a/services/mediacodec/Android.mk
+++ b/services/mediacodec/Android.mk
@@ -9,13 +9,8 @@
libgui \
libutils \
liblog \
- libstagefright_omx
-LOCAL_C_INCLUDES := \
- frameworks/av/include \
- frameworks/av/media/libstagefright \
- frameworks/av/media/libstagefright/include \
- frameworks/native/include \
- frameworks/native/include/media/openmax
+ libstagefright_omx \
+ libstagefright_xmlparser
LOCAL_MODULE:= libmediacodecservice
LOCAL_VENDOR_MODULE := true
LOCAL_32_BIT_ONLY := true
@@ -23,14 +18,17 @@
# service executable
include $(CLEAR_VARS)
+# seccomp is not required for coverage build.
+ifneq ($(NATIVE_COVERAGE),true)
LOCAL_REQUIRED_MODULES_arm := mediacodec.policy
+LOCAL_REQUIRED_MODULES_x86 := mediacodec.policy
+endif
LOCAL_SRC_FILES := main_codecservice.cpp
LOCAL_SHARED_LIBRARIES := \
libmedia_omx \
libmediacodecservice \
libbinder \
libutils \
- libgui \
liblog \
libbase \
libavservices_minijail_vendor \
@@ -38,15 +36,10 @@
libhwbinder \
libhidltransport \
libstagefright_omx \
+ libstagefright_xmlparser \
android.hardware.media.omx@1.0 \
android.hidl.memory@1.0
-LOCAL_C_INCLUDES := \
- frameworks/av/include \
- frameworks/av/media/libstagefright \
- frameworks/av/media/libstagefright/include \
- frameworks/native/include \
- frameworks/native/include/media/openmax
LOCAL_MODULE := android.hardware.media.omx@1.0-service
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_VENDOR_MODULE := true
@@ -55,7 +48,7 @@
include $(BUILD_EXECUTABLE)
# service seccomp policy
-ifeq ($(TARGET_ARCH), $(filter $(TARGET_ARCH), arm arm64))
+ifeq ($(TARGET_ARCH), $(filter $(TARGET_ARCH), x86 x86_64 arm arm64))
include $(CLEAR_VARS)
LOCAL_MODULE := mediacodec.policy
LOCAL_MODULE_CLASS := ETC
diff --git a/services/mediacodec/MediaCodecService.cpp b/services/mediacodec/MediaCodecService.cpp
index fc1e5d9..6b510c6 100644
--- a/services/mediacodec/MediaCodecService.cpp
+++ b/services/mediacodec/MediaCodecService.cpp
@@ -24,15 +24,25 @@
sp<IOMX> MediaCodecService::getOMX() {
- Mutex::Autolock autoLock(mLock);
+ Mutex::Autolock autoLock(mOMXLock);
if (mOMX.get() == NULL) {
- mOMX = new OMX;
+ mOMX = new OMX();
}
return mOMX;
}
+sp<IOMXStore> MediaCodecService::getOMXStore() {
+
+ Mutex::Autolock autoLock(mOMXStoreLock);
+
+ if (mOMXStore.get() == NULL) {
+ mOMXStore = new OMXStore();
+ }
+
+ return mOMXStore;
+}
status_t MediaCodecService::onTransact(uint32_t code, const Parcel& data, Parcel* reply,
uint32_t flags)
diff --git a/services/mediacodec/MediaCodecService.h b/services/mediacodec/MediaCodecService.h
index d64debb..9301135 100644
--- a/services/mediacodec/MediaCodecService.h
+++ b/services/mediacodec/MediaCodecService.h
@@ -19,11 +19,13 @@
#include <binder/BinderService.h>
#include <media/IMediaCodecService.h>
-#include <include/OMX.h>
+#include <media/stagefright/omx/OMX.h>
+#include <media/stagefright/omx/OMXStore.h>
namespace android {
-class MediaCodecService : public BinderService<MediaCodecService>, public BnMediaCodecService
+class MediaCodecService : public BinderService<MediaCodecService>,
+ public BnMediaCodecService
{
friend class BinderService<MediaCodecService>; // for MediaCodecService()
public:
@@ -31,16 +33,20 @@
virtual ~MediaCodecService() { }
virtual void onFirstRef() { }
- static const char* getServiceName() { return "media.codec"; }
+ static const char* getServiceName() { return "media.codec"; }
- virtual sp<IOMX> getOMX();
+ virtual sp<IOMX> getOMX();
- virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply,
- uint32_t flags);
+ virtual sp<IOMXStore> getOMXStore();
+
+ virtual status_t onTransact(uint32_t code, const Parcel& data,
+ Parcel* reply, uint32_t flags);
private:
- Mutex mLock;
- sp<IOMX> mOMX;
+ Mutex mOMXLock;
+ sp<IOMX> mOMX;
+ Mutex mOMXStoreLock;
+ sp<IOMXStore> mOMXStore;
};
} // namespace android
diff --git a/services/mediacodec/main_codecservice.cpp b/services/mediacodec/main_codecservice.cpp
index c59944a..79d6da5 100644
--- a/services/mediacodec/main_codecservice.cpp
+++ b/services/mediacodec/main_codecservice.cpp
@@ -32,8 +32,8 @@
#include "minijail.h"
#include <hidl/HidlTransportSupport.h>
-#include <omx/1.0/Omx.h>
-#include <omx/1.0/OmxStore.h>
+#include <media/stagefright/omx/1.0/Omx.h>
+#include <media/stagefright/omx/1.0/OmxStore.h>
using namespace android;
diff --git a/services/mediacodec/seccomp_policy/mediacodec-x86.policy b/services/mediacodec/seccomp_policy/mediacodec-x86.policy
new file mode 100644
index 0000000..dc2c04f
--- /dev/null
+++ b/services/mediacodec/seccomp_policy/mediacodec-x86.policy
@@ -0,0 +1,69 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+read: 1
+mprotect: 1
+prctl: 1
+openat: 1
+getuid32: 1
+writev: 1
+ioctl: 1
+close: 1
+mmap2: 1
+fstat64: 1
+madvise: 1
+fstatat64: 1
+futex: 1
+munmap: 1
+faccessat: 1
+_llseek: 1
+lseek: 1
+clone: 1
+sigaltstack: 1
+setpriority: 1
+restart_syscall: 1
+exit: 1
+exit_group: 1
+rt_sigreturn: 1
+ugetrlimit: 1
+readlinkat: 1
+_llseek: 1
+fstatfs64: 1
+pread64: 1
+mremap: 1
+dup: 1
+set_tid_address: 1
+write: 1
+nanosleep: 1
+
+# for attaching to debuggerd on process crash
+socketcall: 1
+sigaction: 1
+tgkill: 1
+rt_sigprocmask: 1
+fcntl64: 1
+rt_tgsigqueueinfo: 1
+geteuid32: 1
+getgid32: 1
+getegid32: 1
+getgroups32: 1
+getdents64: 1
+pipe2: 1
+ppoll: 1
+
+# Required by AddressSanitizer
+gettid: 1
+sched_yield: 1
+getpid: 1
+gettid: 1
diff --git a/services/mediadrm/Android.mk b/services/mediadrm/Android.mk
index 6b30db6..2daa829 100644
--- a/services/mediadrm/Android.mk
+++ b/services/mediadrm/Android.mk
@@ -17,7 +17,6 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
- MediaCasService.cpp \
MediaDrmService.cpp \
main_mediadrmserver.cpp
diff --git a/services/mediadrm/FactoryLoader.h b/services/mediadrm/FactoryLoader.h
deleted file mode 100644
index d7f1118..0000000
--- a/services/mediadrm/FactoryLoader.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef MEDIA_CAS_LOADER_H_
-#define MEDIA_CAS_LOADER_H_
-
-#include <dirent.h>
-#include <dlfcn.h>
-#include <media/SharedLibrary.h>
-#include <utils/KeyedVector.h>
-#include <utils/Mutex.h>
-
-namespace android {
-using namespace std;
-using namespace media;
-using namespace MediaCas;
-
-template <class T>
-class FactoryLoader {
-public:
- FactoryLoader(const char *name) :
- mFactory(NULL), mCreateFactoryFuncName(name) {}
-
- virtual ~FactoryLoader() { closeFactory(); }
-
- bool findFactoryForScheme(
- int32_t CA_system_id,
- sp<SharedLibrary> *library = NULL,
- T** factory = NULL);
-
- bool enumeratePlugins(vector<ParcelableCasPluginDescriptor>* results);
-
-private:
- typedef T*(*CreateFactoryFunc)();
-
- Mutex mMapLock;
- T* mFactory;
- const char *mCreateFactoryFuncName;
- sp<SharedLibrary> mLibrary;
- KeyedVector<int32_t, String8> mCASystemIdToLibraryPathMap;
- KeyedVector<String8, wp<SharedLibrary> > mLibraryPathToOpenLibraryMap;
-
- bool loadFactoryForSchemeFromPath(
- const String8 &path,
- int32_t CA_system_id,
- sp<SharedLibrary> *library,
- T** factory);
-
- bool queryPluginsFromPath(
- const String8 &path,
- vector<ParcelableCasPluginDescriptor>* results);
-
- bool openFactory(const String8 &path);
- void closeFactory();
-};
-
-template <class T>
-bool FactoryLoader<T>::findFactoryForScheme(
- int32_t CA_system_id, sp<SharedLibrary> *library, T** factory) {
- if (library != NULL) {
- library->clear();
- }
- if (factory != NULL) {
- *factory = NULL;
- }
-
- Mutex::Autolock autoLock(mMapLock);
-
- // first check cache
- ssize_t index = mCASystemIdToLibraryPathMap.indexOfKey(CA_system_id);
- if (index >= 0) {
- return loadFactoryForSchemeFromPath(
- mCASystemIdToLibraryPathMap[index],
- CA_system_id, library, factory);
- }
-
- // no luck, have to search
- String8 dirPath("/system/lib/mediacas");
- DIR* pDir = opendir(dirPath.string());
-
- if (pDir == NULL) {
- ALOGE("Failed to open plugin directory %s", dirPath.string());
- return false;
- }
-
- struct dirent* pEntry;
- while ((pEntry = readdir(pDir))) {
- String8 pluginPath = dirPath + "/" + pEntry->d_name;
- if (pluginPath.getPathExtension() == ".so") {
- if (loadFactoryForSchemeFromPath(
- pluginPath, CA_system_id, library, factory)) {
- mCASystemIdToLibraryPathMap.add(CA_system_id, pluginPath);
- closedir(pDir);
-
- return true;
- }
- }
- }
-
- closedir(pDir);
-
- ALOGE("Failed to find plugin");
- return false;
-}
-
-template <class T>
-bool FactoryLoader<T>::enumeratePlugins(
- vector<ParcelableCasPluginDescriptor>* results) {
- ALOGI("enumeratePlugins");
-
- results->clear();
-
- String8 dirPath("/system/lib/mediacas");
- DIR* pDir = opendir(dirPath.string());
-
- if (pDir == NULL) {
- ALOGE("Failed to open plugin directory %s", dirPath.string());
- return false;
- }
-
- Mutex::Autolock autoLock(mMapLock);
-
- struct dirent* pEntry;
- while ((pEntry = readdir(pDir))) {
- String8 pluginPath = dirPath + "/" + pEntry->d_name;
- if (pluginPath.getPathExtension() == ".so") {
- queryPluginsFromPath(pluginPath, results);
- }
- }
- return true;
-}
-
-template <class T>
-bool FactoryLoader<T>::loadFactoryForSchemeFromPath(
- const String8 &path, int32_t CA_system_id,
- sp<SharedLibrary> *library, T** factory) {
- closeFactory();
-
- if (!openFactory(path) || !mFactory->isSystemIdSupported(CA_system_id)) {
- closeFactory();
- return false;
- }
-
- if (library != NULL) {
- *library = mLibrary;
- }
- if (factory != NULL) {
- *factory = mFactory;
- }
- return true;
-}
-
-template <class T>
-bool FactoryLoader<T>::queryPluginsFromPath(
- const String8 &path, vector<ParcelableCasPluginDescriptor>* results) {
- closeFactory();
-
- vector<CasPluginDescriptor> descriptors;
- if (!openFactory(path) || mFactory->queryPlugins(&descriptors) != OK) {
- closeFactory();
- return false;
- }
-
- for (auto it = descriptors.begin(); it != descriptors.end(); it++) {
- results->push_back(ParcelableCasPluginDescriptor(
- it->CA_system_id, it->name));
- }
- return true;
-}
-
-template <class T>
-bool FactoryLoader<T>::openFactory(const String8 &path) {
- // get strong pointer to open shared library
- ssize_t index = mLibraryPathToOpenLibraryMap.indexOfKey(path);
- if (index >= 0) {
- mLibrary = mLibraryPathToOpenLibraryMap[index].promote();
- } else {
- index = mLibraryPathToOpenLibraryMap.add(path, NULL);
- }
-
- if (!mLibrary.get()) {
- mLibrary = new SharedLibrary(path);
- if (!*mLibrary) {
- return false;
- }
-
- mLibraryPathToOpenLibraryMap.replaceValueAt(index, mLibrary);
- }
-
- CreateFactoryFunc createFactory =
- (CreateFactoryFunc)mLibrary->lookup(mCreateFactoryFuncName);
- if (createFactory == NULL || (mFactory = createFactory()) == NULL) {
- return false;
- }
- return true;
-}
-
-template <class T>
-void FactoryLoader<T>::closeFactory() {
- delete mFactory;
- mFactory = NULL;
- mLibrary.clear();
-}
-
-} // namespace android
-
-#endif // MEDIA_CAS_LOADER_H_
diff --git a/services/mediadrm/MediaCasService.cpp b/services/mediadrm/MediaCasService.cpp
deleted file mode 100644
index c111283..0000000
--- a/services/mediadrm/MediaCasService.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "MediaCasService"
-
-#include <binder/IServiceManager.h>
-#include <media/cas/CasAPI.h>
-#include <media/cas/DescramblerAPI.h>
-#include <media/CasImpl.h>
-#include <media/DescramblerImpl.h>
-#include <utils/Log.h>
-#include <utils/List.h>
-#include "MediaCasService.h"
-#include <android/media/ICasListener.h>
-
-namespace android {
-
-//static
-void MediaCasService::instantiate() {
- defaultServiceManager()->addService(
- String16("media.cas"), new MediaCasService());
-}
-
-MediaCasService::MediaCasService() :
- mCasLoader(new FactoryLoader<CasFactory>("createCasFactory")),
- mDescramblerLoader(new FactoryLoader<DescramblerFactory>(
- "createDescramblerFactory")) {
-}
-
-MediaCasService::~MediaCasService() {
- delete mCasLoader;
- delete mDescramblerLoader;
-}
-
-Status MediaCasService::enumeratePlugins(
- vector<ParcelableCasPluginDescriptor>* results) {
- ALOGV("enumeratePlugins");
-
- mCasLoader->enumeratePlugins(results);
-
- return Status::ok();
-}
-
-Status MediaCasService::isSystemIdSupported(
- int32_t CA_system_id, bool* result) {
- ALOGV("isSystemIdSupported: CA_system_id=%d", CA_system_id);
-
- *result = mCasLoader->findFactoryForScheme(CA_system_id);
-
- return Status::ok();
-}
-
-Status MediaCasService::createPlugin(
- int32_t CA_system_id,
- const sp<ICasListener> &listener,
- sp<ICas>* result) {
- ALOGV("createPlugin: CA_system_id=%d", CA_system_id);
-
- result->clear();
-
- CasFactory *factory;
- sp<SharedLibrary> library;
- if (mCasLoader->findFactoryForScheme(CA_system_id, &library, &factory)) {
- CasPlugin *plugin = NULL;
- sp<CasImpl> casImpl = new CasImpl(listener);
- if (factory->createPlugin(CA_system_id, (uint64_t)casImpl.get(),
- &CasImpl::OnEvent, &plugin) == OK && plugin != NULL) {
- casImpl->init(library, plugin);
- *result = casImpl;
- }
- }
-
- return Status::ok();
-}
-
-Status MediaCasService::isDescramblerSupported(
- int32_t CA_system_id, bool* result) {
- ALOGV("isDescramblerSupported: CA_system_id=%d", CA_system_id);
-
- *result = mDescramblerLoader->findFactoryForScheme(CA_system_id);
-
- return Status::ok();
-}
-
-Status MediaCasService::createDescrambler(
- int32_t CA_system_id, sp<IDescrambler>* result) {
- ALOGV("createDescrambler: CA_system_id=%d", CA_system_id);
-
- result->clear();
-
- DescramblerFactory *factory;
- sp<SharedLibrary> library;
- if (mDescramblerLoader->findFactoryForScheme(
- CA_system_id, &library, &factory)) {
- DescramblerPlugin *plugin = NULL;
- if (factory->createPlugin(CA_system_id, &plugin) == OK
- && plugin != NULL) {
- *result = new DescramblerImpl(library, plugin);
- }
- }
-
- return Status::ok();
-}
-
-} // namespace android
diff --git a/services/mediadrm/MediaCasService.h b/services/mediadrm/MediaCasService.h
deleted file mode 100644
index cb828f2..0000000
--- a/services/mediadrm/MediaCasService.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef MEDIA_CAS_SERVICE_H_
-#define MEDIA_CAS_SERVICE_H_
-
-#include <android/media/BnMediaCasService.h>
-
-#include "FactoryLoader.h"
-
-namespace android {
-using binder::Status;
-struct CasFactory;
-struct DescramblerFactory;
-
-class MediaCasService : public BnMediaCasService {
-public:
- static void instantiate();
-
- virtual Status enumeratePlugins(
- vector<ParcelableCasPluginDescriptor>* results) override;
-
- virtual Status isSystemIdSupported(
- int32_t CA_system_id, bool* result) override;
-
- virtual Status createPlugin(
- int32_t CA_system_id,
- const sp<ICasListener> &listener,
- sp<ICas>* result) override;
-
- virtual Status isDescramblerSupported(
- int32_t CA_system_id, bool* result) override;
-
- virtual Status createDescrambler(
- int32_t CA_system_id, sp<IDescrambler>* result) override;
-
-private:
- FactoryLoader<CasFactory> *mCasLoader;
- FactoryLoader<DescramblerFactory> *mDescramblerLoader;
-
- MediaCasService();
- virtual ~MediaCasService();
-};
-
-} // namespace android
-
-#endif // MEDIA_CAS_SERVICE_H_
diff --git a/services/mediadrm/main_mediadrmserver.cpp b/services/mediadrm/main_mediadrmserver.cpp
index b685ae0..b767b8c 100644
--- a/services/mediadrm/main_mediadrmserver.cpp
+++ b/services/mediadrm/main_mediadrmserver.cpp
@@ -27,7 +27,6 @@
#include <cutils/properties.h>
#include <utils/Log.h>
#include "MediaDrmService.h"
-#include "MediaCasService.h"
using namespace android;
@@ -39,7 +38,6 @@
sp<IServiceManager> sm = defaultServiceManager();
ALOGI("ServiceManager: %p", sm.get());
MediaDrmService::instantiate();
- MediaCasService::instantiate();
ProcessState::self()->startThreadPool();
IPCThreadState::self()->joinThreadPool();
}
diff --git a/services/mediaextractor/Android.mk b/services/mediaextractor/Android.mk
index 1ebb7ff..d41da39 100644
--- a/services/mediaextractor/Android.mk
+++ b/services/mediaextractor/Android.mk
@@ -3,6 +3,7 @@
# service library
include $(CLEAR_VARS)
LOCAL_SRC_FILES := MediaExtractorService.cpp
+LOCAL_CFLAGS := -Wall -Werror
LOCAL_SHARED_LIBRARIES := libmedia libstagefright libbinder libutils liblog
LOCAL_MODULE:= libmediaextractorservice
include $(BUILD_SHARED_LIBRARY)
@@ -21,6 +22,7 @@
LOCAL_MODULE:= mediaextractor
LOCAL_INIT_RC := mediaextractor.rc
LOCAL_C_INCLUDES := frameworks/av/media/libmedia
+LOCAL_CFLAGS := -Wall -Werror
include $(BUILD_EXECUTABLE)
# service seccomp filter
diff --git a/services/oboeservice/AAudioEndpointManager.cpp b/services/oboeservice/AAudioEndpointManager.cpp
index ec2f5b9..f996f74 100644
--- a/services/oboeservice/AAudioEndpointManager.cpp
+++ b/services/oboeservice/AAudioEndpointManager.cpp
@@ -26,6 +26,10 @@
#include <utility/AAudioUtilities.h>
#include "AAudioEndpointManager.h"
+#include "AAudioServiceEndpointShared.h"
+#include "AAudioServiceEndpointMMAP.h"
+#include "AAudioServiceEndpointCapture.h"
+#include "AAudioServiceEndpointPlay.h"
using namespace android;
using namespace aaudio;
@@ -34,159 +38,237 @@
AAudioEndpointManager::AAudioEndpointManager()
: Singleton<AAudioEndpointManager>()
- , mInputs()
- , mOutputs() {
+ , mSharedStreams()
+ , mExclusiveStreams() {
}
std::string AAudioEndpointManager::dump() const {
std::stringstream result;
- const bool isLocked = AAudio_tryUntilTrue(
- [this]()->bool { return mLock.try_lock(); } /* f */,
- 50 /* times */,
- 20 /* sleepMs */);
- if (!isLocked) {
- result << "EndpointManager may be deadlocked\n";
- }
+ int index = 0;
result << "AAudioEndpointManager:" << "\n";
- size_t inputs = mInputs.size();
- result << "Input Endpoints: " << inputs << "\n";
- for (const auto &input : mInputs) {
- result << " Input: " << input->dump() << "\n";
+
+ const bool isSharedLocked = AAudio_tryUntilTrue(
+ [this]()->bool { return mSharedLock.try_lock(); } /* f */,
+ 50 /* times */,
+ 20 /* sleepMs */);
+ if (!isSharedLocked) {
+ result << "AAudioEndpointManager Shared may be deadlocked\n";
}
- size_t outputs = mOutputs.size();
- result << "Output Endpoints: " << outputs << "\n";
- for (const auto &output : mOutputs) {
- result << " Output: " << output->dump() << "\n";
+ {
+ const bool isExclusiveLocked = AAudio_tryUntilTrue(
+ [this]() -> bool { return mExclusiveLock.try_lock(); } /* f */,
+ 50 /* times */,
+ 20 /* sleepMs */);
+ if (!isExclusiveLocked) {
+ result << "AAudioEndpointManager Exclusive may be deadlocked\n";
+ }
+
+ result << "Exclusive MMAP Endpoints: " << mExclusiveStreams.size() << "\n";
+ index = 0;
+ for (const auto &output : mExclusiveStreams) {
+ result << " #" << index++ << ":";
+ result << output->dump() << "\n";
+ }
+
+ if (isExclusiveLocked) {
+ mExclusiveLock.unlock();
+ }
}
- if (isLocked) {
- mLock.unlock();
+ result << "Shared Endpoints: " << mSharedStreams.size() << "\n";
+ index = 0;
+ for (const auto &input : mSharedStreams) {
+ result << " #" << index++ << ":";
+ result << input->dump() << "\n";
+ }
+
+ if (isSharedLocked) {
+ mSharedLock.unlock();
}
return result.str();
}
-AAudioServiceEndpoint *AAudioEndpointManager::openEndpoint(AAudioService &audioService,
- const AAudioStreamConfiguration& configuration, aaudio_direction_t direction) {
- AAudioServiceEndpoint *endpoint = nullptr;
- AAudioServiceEndpointCapture *capture = nullptr;
- AAudioServiceEndpointPlay *player = nullptr;
- std::lock_guard<std::mutex> lock(mLock);
+
+// Try to find an existing endpoint.
+sp<AAudioServiceEndpoint> AAudioEndpointManager::findExclusiveEndpoint_l(
+ const AAudioStreamConfiguration &configuration) {
+ sp<AAudioServiceEndpoint> endpoint;
+ for (const auto ep : mExclusiveStreams) {
+ if (ep->matches(configuration)) {
+ endpoint = ep;
+ break;
+ }
+ }
+
+ ALOGV("AAudioEndpointManager.findExclusiveEndpoint_l(), found %p for device = %d",
+ endpoint.get(), configuration.getDeviceId());
+ return endpoint;
+}
+
+// Try to find an existing endpoint.
+sp<AAudioServiceEndpointShared> AAudioEndpointManager::findSharedEndpoint_l(
+ const AAudioStreamConfiguration &configuration) {
+ sp<AAudioServiceEndpointShared> endpoint;
+ for (const auto ep : mSharedStreams) {
+ if (ep->matches(configuration)) {
+ endpoint = ep;
+ break;
+ }
+ }
+
+ ALOGV("AAudioEndpointManager.findSharedEndpoint_l(), found %p for device = %d",
+ endpoint.get(), configuration.getDeviceId());
+ return endpoint;
+}
+
+sp<AAudioServiceEndpoint> AAudioEndpointManager::openEndpoint(AAudioService &audioService,
+ const aaudio::AAudioStreamRequest &request,
+ aaudio_sharing_mode_t sharingMode) {
+ if (sharingMode == AAUDIO_SHARING_MODE_EXCLUSIVE) {
+ return openExclusiveEndpoint(audioService, request);
+ } else {
+ return openSharedEndpoint(audioService, request);
+ }
+}
+
+sp<AAudioServiceEndpoint> AAudioEndpointManager::openExclusiveEndpoint(
+ AAudioService &aaudioService __unused,
+ const aaudio::AAudioStreamRequest &request) {
+
+ std::lock_guard<std::mutex> lock(mExclusiveLock);
+
+ const AAudioStreamConfiguration &configuration = request.getConstantConfiguration();
// Try to find an existing endpoint.
+ sp<AAudioServiceEndpoint> endpoint = findExclusiveEndpoint_l(configuration);
+ // If we find an existing one then this one cannot be exclusive.
+ if (endpoint.get() != nullptr) {
+ ALOGE("AAudioEndpointManager.openExclusiveEndpoint() already in use");
+ // Already open so do not allow a second stream.
+ return nullptr;
+ } else {
+ sp<AAudioServiceEndpointMMAP> endpointMMap = new AAudioServiceEndpointMMAP();
+ ALOGE("AAudioEndpointManager.openEndpoint(),created MMAP %p", endpointMMap.get());
+ endpoint = endpointMMap;
-
- switch (direction) {
- case AAUDIO_DIRECTION_INPUT:
- for (AAudioServiceEndpoint *ep : mInputs) {
- if (ep->matches(configuration)) {
- endpoint = ep;
- break;
- }
- }
- break;
- case AAUDIO_DIRECTION_OUTPUT:
- for (AAudioServiceEndpoint *ep : mOutputs) {
- if (ep->matches(configuration)) {
- endpoint = ep;
- break;
- }
- }
- break;
- default:
- assert(false); // There are only two possible directions.
- break;
- }
- ALOGD("AAudioEndpointManager::openEndpoint(), found %p for device = %d, dir = %d",
- endpoint, configuration.getDeviceId(), (int)direction);
-
- // If we can't find an existing one then open a new one.
- if (endpoint == nullptr) {
- // we must call openStream with audioserver identity
- int64_t token = IPCThreadState::self()->clearCallingIdentity();
- switch(direction) {
- case AAUDIO_DIRECTION_INPUT:
- capture = new AAudioServiceEndpointCapture(audioService);
- endpoint = capture;
- break;
- case AAUDIO_DIRECTION_OUTPUT:
- player = new AAudioServiceEndpointPlay(audioService);
- endpoint = player;
- break;
- default:
- break;
+ aaudio_result_t result = endpoint->open(request);
+ if (result != AAUDIO_OK) {
+ ALOGE("AAudioEndpointManager.openEndpoint(), open failed");
+ endpoint.clear();
+ } else {
+ mExclusiveStreams.push_back(endpointMMap);
}
- if (endpoint != nullptr) {
- aaudio_result_t result = endpoint->open(configuration);
- if (result != AAUDIO_OK) {
- ALOGE("AAudioEndpointManager::findEndpoint(), open failed");
- delete endpoint;
- endpoint = nullptr;
- } else {
- switch(direction) {
- case AAUDIO_DIRECTION_INPUT:
- mInputs.push_back(capture);
- break;
- case AAUDIO_DIRECTION_OUTPUT:
- mOutputs.push_back(player);
- break;
- default:
- break;
- }
- }
- }
- ALOGD("AAudioEndpointManager::openEndpoint(), created %p for device = %d, dir = %d",
- endpoint, configuration.getDeviceId(), (int)direction);
- IPCThreadState::self()->restoreCallingIdentity(token);
+ ALOGD("AAudioEndpointManager.openEndpoint(), created %p for device = %d",
+ endpoint.get(), configuration.getDeviceId());
}
- if (endpoint != nullptr) {
- ALOGD("AAudioEndpointManager::openEndpoint(), sampleRate = %d, framesPerBurst = %d",
- endpoint->getSampleRate(), endpoint->getFramesPerBurst());
+ if (endpoint.get() != nullptr) {
// Increment the reference count under this lock.
- endpoint->setReferenceCount(endpoint->getReferenceCount() + 1);
+ endpoint->setOpenCount(endpoint->getOpenCount() + 1);
}
return endpoint;
}
-void AAudioEndpointManager::closeEndpoint(AAudioServiceEndpoint *serviceEndpoint) {
- std::lock_guard<std::mutex> lock(mLock);
- if (serviceEndpoint == nullptr) {
- return;
- }
+sp<AAudioServiceEndpoint> AAudioEndpointManager::openSharedEndpoint(
+ AAudioService &aaudioService,
+ const aaudio::AAudioStreamRequest &request) {
- // Decrement the reference count under this lock.
- int32_t newRefCount = serviceEndpoint->getReferenceCount() - 1;
- serviceEndpoint->setReferenceCount(newRefCount);
- ALOGD("AAudioEndpointManager::closeEndpoint(%p) newRefCount = %d",
- serviceEndpoint, newRefCount);
+ std::lock_guard<std::mutex> lock(mSharedLock);
- // If no longer in use then close and delete it.
- if (newRefCount <= 0) {
- aaudio_direction_t direction = serviceEndpoint->getDirection();
- // Track endpoints based on requested deviceId because UNSPECIFIED
- // can change to a specific device after opening.
- int32_t deviceId = serviceEndpoint->getRequestedDeviceId();
+ const AAudioStreamConfiguration &configuration = request.getConstantConfiguration();
+ aaudio_direction_t direction = configuration.getDirection();
+ // Try to find an existing endpoint.
+ sp<AAudioServiceEndpointShared> endpoint = findSharedEndpoint_l(configuration);
+
+ // If we can't find an existing one then open a new one.
+ if (endpoint.get() == nullptr) {
+ // we must call openStream with audioserver identity
+ int64_t token = IPCThreadState::self()->clearCallingIdentity();
switch (direction) {
case AAUDIO_DIRECTION_INPUT:
- mInputs.erase(
- std::remove(mInputs.begin(), mInputs.end(), serviceEndpoint), mInputs.end());
+ endpoint = new AAudioServiceEndpointCapture(aaudioService);
break;
case AAUDIO_DIRECTION_OUTPUT:
- mOutputs.erase(
- std::remove(mOutputs.begin(), mOutputs.end(), serviceEndpoint), mOutputs.end());
+ endpoint = new AAudioServiceEndpointPlay(aaudioService);
break;
default:
break;
}
+ if (endpoint.get() != nullptr) {
+ aaudio_result_t result = endpoint->open(request);
+ if (result != AAUDIO_OK) {
+ ALOGE("AAudioEndpointManager.openEndpoint(), open failed");
+ endpoint.clear();
+ } else {
+ mSharedStreams.push_back(endpoint);
+ }
+ }
+ ALOGD("AAudioEndpointManager.openSharedEndpoint(), created %p for device = %d, dir = %d",
+ endpoint.get(), configuration.getDeviceId(), (int)direction);
+ IPCThreadState::self()->restoreCallingIdentity(token);
+ }
+
+ if (endpoint.get() != nullptr) {
+ // Increment the reference count under this lock.
+ endpoint->setOpenCount(endpoint->getOpenCount() + 1);
+ }
+ return endpoint;
+}
+
+void AAudioEndpointManager::closeEndpoint(sp<AAudioServiceEndpoint>serviceEndpoint) {
+ if (serviceEndpoint->getSharingMode() == AAUDIO_SHARING_MODE_EXCLUSIVE) {
+ return closeExclusiveEndpoint(serviceEndpoint);
+ } else {
+ return closeSharedEndpoint(serviceEndpoint);
+ }
+}
+
+void AAudioEndpointManager::closeExclusiveEndpoint(sp<AAudioServiceEndpoint> serviceEndpoint) {
+ if (serviceEndpoint.get() == nullptr) {
+ return;
+ }
+
+ // Decrement the reference count under this lock.
+ std::lock_guard<std::mutex> lock(mExclusiveLock);
+ int32_t newRefCount = serviceEndpoint->getOpenCount() - 1;
+ serviceEndpoint->setOpenCount(newRefCount);
+
+ // If no longer in use then close and delete it.
+ if (newRefCount <= 0) {
+ mExclusiveStreams.erase(
+ std::remove(mExclusiveStreams.begin(), mExclusiveStreams.end(), serviceEndpoint),
+ mExclusiveStreams.end());
+
serviceEndpoint->close();
- ALOGD("AAudioEndpointManager::closeEndpoint() delete %p for device %d, dir = %d",
- serviceEndpoint, deviceId, (int)direction);
- delete serviceEndpoint;
+ ALOGD("AAudioEndpointManager::closeExclusiveEndpoint() %p for device %d",
+ serviceEndpoint.get(), serviceEndpoint->getDeviceId());
+ }
+}
+
+void AAudioEndpointManager::closeSharedEndpoint(sp<AAudioServiceEndpoint> serviceEndpoint) {
+ if (serviceEndpoint.get() == nullptr) {
+ return;
+ }
+
+ // Decrement the reference count under this lock.
+ std::lock_guard<std::mutex> lock(mSharedLock);
+ int32_t newRefCount = serviceEndpoint->getOpenCount() - 1;
+ serviceEndpoint->setOpenCount(newRefCount);
+
+ // If no longer in use then close and delete it.
+ if (newRefCount <= 0) {
+ mSharedStreams.erase(
+ std::remove(mSharedStreams.begin(), mSharedStreams.end(), serviceEndpoint),
+ mSharedStreams.end());
+
+ serviceEndpoint->close();
+ ALOGD("AAudioEndpointManager::closeSharedEndpoint() %p for device %d",
+ serviceEndpoint.get(), serviceEndpoint->getDeviceId());
}
}
diff --git a/services/oboeservice/AAudioEndpointManager.h b/services/oboeservice/AAudioEndpointManager.h
index 2511b2f..32c8454 100644
--- a/services/oboeservice/AAudioEndpointManager.h
+++ b/services/oboeservice/AAudioEndpointManager.h
@@ -24,11 +24,12 @@
#include "binding/AAudioServiceMessage.h"
#include "AAudioServiceEndpoint.h"
#include "AAudioServiceEndpointCapture.h"
+#include "AAudioServiceEndpointMMAP.h"
#include "AAudioServiceEndpointPlay.h"
namespace aaudio {
-class AAudioEndpointManager : public android::Singleton<AAudioEndpointManager>{
+class AAudioEndpointManager : public android::Singleton<AAudioEndpointManager> {
public:
AAudioEndpointManager();
~AAudioEndpointManager() = default;
@@ -49,22 +50,42 @@
* Find a service endpoint for the given deviceId and direction.
* If an endpoint does not already exist then try to create one.
*
- * @param deviceId
- * @param direction
- * @return endpoint or nullptr
+ * @param audioService
+ * @param request
+ * @param sharingMode
+ * @return endpoint or null
*/
- AAudioServiceEndpoint *openEndpoint(android::AAudioService &audioService,
- const AAudioStreamConfiguration& configuration,
- aaudio_direction_t direction);
+ android::sp<AAudioServiceEndpoint> openEndpoint(android::AAudioService &audioService,
+ const aaudio::AAudioStreamRequest &request,
+ aaudio_sharing_mode_t sharingMode);
- void closeEndpoint(AAudioServiceEndpoint *serviceEndpoint);
+ void closeEndpoint(android::sp<AAudioServiceEndpoint> serviceEndpoint);
private:
+ android::sp<AAudioServiceEndpoint> openExclusiveEndpoint(android::AAudioService &aaudioService,
+ const aaudio::AAudioStreamRequest &request);
- mutable std::mutex mLock;
+ android::sp<AAudioServiceEndpoint> openSharedEndpoint(android::AAudioService &aaudioService,
+ const aaudio::AAudioStreamRequest &request);
- std::vector<AAudioServiceEndpointCapture *> mInputs;
- std::vector<AAudioServiceEndpointPlay *> mOutputs;
+ android::sp<AAudioServiceEndpoint> findExclusiveEndpoint_l(
+ const AAudioStreamConfiguration& configuration);
+
+ android::sp<AAudioServiceEndpointShared> findSharedEndpoint_l(
+ const AAudioStreamConfiguration& configuration);
+
+ void closeExclusiveEndpoint(android::sp<AAudioServiceEndpoint> serviceEndpoint);
+ void closeSharedEndpoint(android::sp<AAudioServiceEndpoint> serviceEndpoint);
+
+ // Use separate locks because opening a Shared endpoint requires opening an Exclusive one.
+ // That could cause a recursive lock.
+ // Lock mSharedLock before mExclusiveLock.
+ // it is OK to only lock mExclusiveLock.
+ mutable std::mutex mSharedLock;
+ std::vector<android::sp<AAudioServiceEndpointShared>> mSharedStreams;
+
+ mutable std::mutex mExclusiveLock;
+ std::vector<android::sp<AAudioServiceEndpointMMAP>> mExclusiveStreams;
};
diff --git a/services/oboeservice/AAudioService.cpp b/services/oboeservice/AAudioService.cpp
index 3992719..5a3488d 100644
--- a/services/oboeservice/AAudioService.cpp
+++ b/services/oboeservice/AAudioService.cpp
@@ -18,9 +18,9 @@
//#define LOG_NDEBUG 0
#include <utils/Log.h>
+#include <iomanip>
+#include <iostream>
#include <sstream>
-//#include <time.h>
-//#include <pthread.h>
#include <aaudio/AAudio.h>
#include <mediautils/SchedulingPolicyService.h>
@@ -35,18 +35,13 @@
#include "AAudioServiceStreamMMAP.h"
#include "binding/IAAudioService.h"
#include "ServiceUtilities.h"
-#include "utility/HandleTracker.h"
using namespace android;
using namespace aaudio;
#define MAX_STREAMS_PER_PROCESS 8
-typedef enum
-{
- AAUDIO_HANDLE_TYPE_STREAM
-} aaudio_service_handle_type_t;
-static_assert(AAUDIO_HANDLE_TYPE_STREAM < HANDLE_TRACKER_MAX_TYPES, "Too many handle types.");
+using android::AAudioService;
android::AAudioService::AAudioService()
: BnAAudioService() {
@@ -70,7 +65,8 @@
result = ss.str();
ALOGW("%s", result.c_str());
} else {
- result = mHandleTracker.dump()
+ result = "------------ AAudio Service ------------\n"
+ + mStreamTracker.dump()
+ AAudioClientTracker::getInstance().dump()
+ AAudioEndpointManager::getInstance().dump();
}
@@ -114,23 +110,20 @@
mAudioClient.clientUid == IPCThreadState::self()->getCallingUid()) {
inService = request.isInService();
}
- serviceStream = new AAudioServiceStreamMMAP(mAudioClient, inService);
- result = serviceStream->open(request, configurationOutput);
+ serviceStream = new AAudioServiceStreamMMAP(*this, inService);
+ result = serviceStream->open(request);
if (result != AAUDIO_OK) {
- // fall back to using a shared stream
+ // Clear it so we can possibly fall back to using a shared stream.
ALOGW("AAudioService::openStream(), could not open in EXCLUSIVE mode");
serviceStream.clear();
- } else {
- configurationOutput.setSharingMode(AAUDIO_SHARING_MODE_EXCLUSIVE);
}
}
// if SHARED requested or if EXCLUSIVE failed
if (sharingMode == AAUDIO_SHARING_MODE_SHARED
- || (serviceStream == nullptr && !sharingModeMatchRequired)) {
+ || (serviceStream.get() == nullptr && !sharingModeMatchRequired)) {
serviceStream = new AAudioServiceStreamShared(*this);
- result = serviceStream->open(request, configurationOutput);
- configurationOutput.setSharingMode(AAUDIO_SHARING_MODE_SHARED);
+ result = serviceStream->open(request);
}
if (result != AAUDIO_OK) {
@@ -139,17 +132,12 @@
result, AAudio_convertResultToText(result));
return result;
} else {
- aaudio_handle_t handle = mHandleTracker.put(AAUDIO_HANDLE_TYPE_STREAM, serviceStream.get());
- if (handle < 0) {
- ALOGE("AAudioService::openStream(): handle table full");
- serviceStream->close();
- serviceStream.clear();
- } else {
- ALOGD("AAudioService::openStream(): handle = 0x%08X", handle);
- serviceStream->setHandle(handle);
- pid_t pid = request.getProcessId();
- AAudioClientTracker::getInstance().registerClientStream(pid, serviceStream);
- }
+ aaudio_handle_t handle = mStreamTracker.addStreamForHandle(serviceStream.get());
+ ALOGD("AAudioService::openStream(): handle = 0x%08X", handle);
+ serviceStream->setHandle(handle);
+ pid_t pid = request.getProcessId();
+ AAudioClientTracker::getInstance().registerClientStream(pid, serviceStream);
+ configurationOutput.copyFrom(*serviceStream);
return handle;
}
}
@@ -157,30 +145,32 @@
aaudio_result_t AAudioService::closeStream(aaudio_handle_t streamHandle) {
// Check permission and ownership first.
sp<AAudioServiceStreamBase> serviceStream = convertHandleToServiceStream(streamHandle);
- if (serviceStream == nullptr) {
- ALOGE("AAudioService::startStream(), illegal stream handle = 0x%0x", streamHandle);
+ if (serviceStream.get() == nullptr) {
+ ALOGE("AAudioService::closeStream(0x%0x), illegal stream handle", streamHandle);
return AAUDIO_ERROR_INVALID_HANDLE;
}
ALOGD("AAudioService.closeStream(0x%08X)", streamHandle);
// Remove handle from tracker so that we cannot look up the raw address any more.
- serviceStream = (AAudioServiceStreamBase *)
- mHandleTracker.remove(AAUDIO_HANDLE_TYPE_STREAM,
- streamHandle);
- if (serviceStream != nullptr) {
+ // removeStreamByHandle() uses a lock so that if there are two simultaneous closes
+ // then only one will get the pointer and do the close.
+ serviceStream = mStreamTracker.removeStreamByHandle(streamHandle);
+ if (serviceStream.get() != nullptr) {
serviceStream->close();
pid_t pid = serviceStream->getOwnerProcessId();
AAudioClientTracker::getInstance().unregisterClientStream(pid, serviceStream);
return AAUDIO_OK;
+ } else {
+ ALOGW("AAudioService::closeStream(0x%0x) being handled by another thread", streamHandle);
+ return AAUDIO_ERROR_INVALID_HANDLE;
}
- return AAUDIO_ERROR_INVALID_HANDLE;
}
-AAudioServiceStreamBase *AAudioService::convertHandleToServiceStream(
- aaudio_handle_t streamHandle) const {
- AAudioServiceStreamBase *serviceStream = (AAudioServiceStreamBase *)
- mHandleTracker.get(AAUDIO_HANDLE_TYPE_STREAM, (aaudio_handle_t)streamHandle);
- if (serviceStream != nullptr) {
+
+sp<AAudioServiceStreamBase> AAudioService::convertHandleToServiceStream(
+ aaudio_handle_t streamHandle) {
+ sp<AAudioServiceStreamBase> serviceStream = mStreamTracker.getStreamByHandle(streamHandle);
+ if (serviceStream.get() != nullptr) {
// Only allow owner or the aaudio service to access the stream.
const uid_t callingUserId = IPCThreadState::self()->getCallingUid();
const uid_t ownerUserId = serviceStream->getOwnerUserId();
@@ -200,30 +190,30 @@
aaudio_result_t AAudioService::getStreamDescription(
aaudio_handle_t streamHandle,
aaudio::AudioEndpointParcelable &parcelable) {
- AAudioServiceStreamBase *serviceStream = convertHandleToServiceStream(streamHandle);
- if (serviceStream == nullptr) {
+ sp<AAudioServiceStreamBase> serviceStream = convertHandleToServiceStream(streamHandle);
+ if (serviceStream.get() == nullptr) {
ALOGE("AAudioService::getStreamDescription(), illegal stream handle = 0x%0x", streamHandle);
return AAUDIO_ERROR_INVALID_HANDLE;
}
+
aaudio_result_t result = serviceStream->getDescription(parcelable);
// parcelable.dump();
return result;
}
aaudio_result_t AAudioService::startStream(aaudio_handle_t streamHandle) {
- AAudioServiceStreamBase *serviceStream = convertHandleToServiceStream(streamHandle);
- if (serviceStream == nullptr) {
+ sp<AAudioServiceStreamBase> serviceStream = convertHandleToServiceStream(streamHandle);
+ if (serviceStream.get() == nullptr) {
ALOGE("AAudioService::startStream(), illegal stream handle = 0x%0x", streamHandle);
return AAUDIO_ERROR_INVALID_HANDLE;
}
- aaudio_result_t result = serviceStream->start();
- return result;
+ return serviceStream->start();
}
aaudio_result_t AAudioService::pauseStream(aaudio_handle_t streamHandle) {
- AAudioServiceStreamBase *serviceStream = convertHandleToServiceStream(streamHandle);
- if (serviceStream == nullptr) {
+ sp<AAudioServiceStreamBase> serviceStream = convertHandleToServiceStream(streamHandle);
+ if (serviceStream.get() == nullptr) {
ALOGE("AAudioService::pauseStream(), illegal stream handle = 0x%0x", streamHandle);
return AAUDIO_ERROR_INVALID_HANDLE;
}
@@ -232,9 +222,9 @@
}
aaudio_result_t AAudioService::stopStream(aaudio_handle_t streamHandle) {
- AAudioServiceStreamBase *serviceStream = convertHandleToServiceStream(streamHandle);
- if (serviceStream == nullptr) {
- ALOGE("AAudioService::pauseStream(), illegal stream handle = 0x%0x", streamHandle);
+ sp<AAudioServiceStreamBase> serviceStream = convertHandleToServiceStream(streamHandle);
+ if (serviceStream.get() == nullptr) {
+ ALOGE("AAudioService::stopStream(), illegal stream handle = 0x%0x", streamHandle);
return AAUDIO_ERROR_INVALID_HANDLE;
}
aaudio_result_t result = serviceStream->stop();
@@ -242,8 +232,8 @@
}
aaudio_result_t AAudioService::flushStream(aaudio_handle_t streamHandle) {
- AAudioServiceStreamBase *serviceStream = convertHandleToServiceStream(streamHandle);
- if (serviceStream == nullptr) {
+ sp<AAudioServiceStreamBase> serviceStream = convertHandleToServiceStream(streamHandle);
+ if (serviceStream.get() == nullptr) {
ALOGE("AAudioService::flushStream(), illegal stream handle = 0x%0x", streamHandle);
return AAUDIO_ERROR_INVALID_HANDLE;
}
@@ -253,8 +243,8 @@
aaudio_result_t AAudioService::registerAudioThread(aaudio_handle_t streamHandle,
pid_t clientThreadId,
int64_t periodNanoseconds) {
- AAudioServiceStreamBase *serviceStream = convertHandleToServiceStream(streamHandle);
- if (serviceStream == nullptr) {
+ sp<AAudioServiceStreamBase> serviceStream = convertHandleToServiceStream(streamHandle);
+ if (serviceStream.get() == nullptr) {
ALOGE("AAudioService::registerAudioThread(), illegal stream handle = 0x%0x", streamHandle);
return AAUDIO_ERROR_INVALID_HANDLE;
}
@@ -278,8 +268,8 @@
aaudio_result_t AAudioService::unregisterAudioThread(aaudio_handle_t streamHandle,
pid_t clientThreadId) {
- AAudioServiceStreamBase *serviceStream = convertHandleToServiceStream(streamHandle);
- if (serviceStream == nullptr) {
+ sp<AAudioServiceStreamBase> serviceStream = convertHandleToServiceStream(streamHandle);
+ if (serviceStream.get() == nullptr) {
ALOGE("AAudioService::unregisterAudioThread(), illegal stream handle = 0x%0x",
streamHandle);
return AAUDIO_ERROR_INVALID_HANDLE;
@@ -295,8 +285,8 @@
aaudio_result_t AAudioService::startClient(aaudio_handle_t streamHandle,
const android::AudioClient& client,
audio_port_handle_t *clientHandle) {
- AAudioServiceStreamBase *serviceStream = convertHandleToServiceStream(streamHandle);
- if (serviceStream == nullptr) {
+ sp<AAudioServiceStreamBase> serviceStream = convertHandleToServiceStream(streamHandle);
+ if (serviceStream.get() == nullptr) {
ALOGE("AAudioService::startClient(), illegal stream handle = 0x%0x",
streamHandle);
return AAUDIO_ERROR_INVALID_HANDLE;
@@ -306,8 +296,8 @@
aaudio_result_t AAudioService::stopClient(aaudio_handle_t streamHandle,
audio_port_handle_t clientHandle) {
- AAudioServiceStreamBase *serviceStream = convertHandleToServiceStream(streamHandle);
- if (serviceStream == nullptr) {
+ sp<AAudioServiceStreamBase> serviceStream = convertHandleToServiceStream(streamHandle);
+ if (serviceStream.get() == nullptr) {
ALOGE("AAudioService::stopClient(), illegal stream handle = 0x%0x",
streamHandle);
return AAUDIO_ERROR_INVALID_HANDLE;
diff --git a/services/oboeservice/AAudioService.h b/services/oboeservice/AAudioService.h
index 8421efc..eef0824 100644
--- a/services/oboeservice/AAudioService.h
+++ b/services/oboeservice/AAudioService.h
@@ -24,11 +24,13 @@
#include <media/AudioClient.h>
#include <aaudio/AAudio.h>
-#include "utility/HandleTracker.h"
-#include "binding/IAAudioService.h"
+
+#include "binding/AAudioCommon.h"
#include "binding/AAudioServiceInterface.h"
+#include "binding/IAAudioService.h"
#include "AAudioServiceStreamBase.h"
+#include "AAudioStreamTracker.h"
namespace android {
@@ -49,45 +51,53 @@
virtual void registerClient(const sp<IAAudioClient>& client);
- virtual aaudio_handle_t openStream(const aaudio::AAudioStreamRequest &request,
- aaudio::AAudioStreamConfiguration &configurationOutput);
+ aaudio::aaudio_handle_t openStream(const aaudio::AAudioStreamRequest &request,
+ aaudio::AAudioStreamConfiguration &configurationOutput)
+ override;
- virtual aaudio_result_t closeStream(aaudio_handle_t streamHandle);
+ aaudio_result_t closeStream(aaudio::aaudio_handle_t streamHandle) override;
- virtual aaudio_result_t getStreamDescription(
- aaudio_handle_t streamHandle,
- aaudio::AudioEndpointParcelable &parcelable);
+ aaudio_result_t getStreamDescription(
+ aaudio::aaudio_handle_t streamHandle,
+ aaudio::AudioEndpointParcelable &parcelable) override;
- virtual aaudio_result_t startStream(aaudio_handle_t streamHandle);
+ aaudio_result_t startStream(aaudio::aaudio_handle_t streamHandle) override;
- virtual aaudio_result_t pauseStream(aaudio_handle_t streamHandle);
+ aaudio_result_t pauseStream(aaudio::aaudio_handle_t streamHandle) override;
- virtual aaudio_result_t stopStream(aaudio_handle_t streamHandle);
+ aaudio_result_t stopStream(aaudio::aaudio_handle_t streamHandle) override;
- virtual aaudio_result_t flushStream(aaudio_handle_t streamHandle);
+ aaudio_result_t flushStream(aaudio::aaudio_handle_t streamHandle) override;
- virtual aaudio_result_t registerAudioThread(aaudio_handle_t streamHandle,
+ aaudio_result_t registerAudioThread(aaudio::aaudio_handle_t streamHandle,
pid_t tid,
- int64_t periodNanoseconds) ;
+ int64_t periodNanoseconds) override;
- virtual aaudio_result_t unregisterAudioThread(aaudio_handle_t streamHandle,
- pid_t tid);
+ aaudio_result_t unregisterAudioThread(aaudio::aaudio_handle_t streamHandle,
+ pid_t tid) override;
- virtual aaudio_result_t startClient(aaudio_handle_t streamHandle,
+ aaudio_result_t startClient(aaudio::aaudio_handle_t streamHandle,
const android::AudioClient& client,
- audio_port_handle_t *clientHandle);
+ audio_port_handle_t *clientHandle) override;
- virtual aaudio_result_t stopClient(aaudio_handle_t streamHandle,
- audio_port_handle_t clientHandle);
+ aaudio_result_t stopClient(aaudio::aaudio_handle_t streamHandle,
+ audio_port_handle_t clientHandle) override;
private:
- aaudio::AAudioServiceStreamBase *convertHandleToServiceStream(aaudio_handle_t streamHandle) const;
+ /**
+ * Lookup stream and then validate access to the stream.
+ * @param streamHandle
+ * @return
+ */
+ sp<aaudio::AAudioServiceStreamBase> convertHandleToServiceStream(
+ aaudio::aaudio_handle_t streamHandle);
- HandleTracker mHandleTracker;
android::AudioClient mAudioClient;
+ aaudio::AAudioStreamTracker mStreamTracker;
+
enum constants {
DEFAULT_AUDIO_PRIORITY = 2
};
diff --git a/services/oboeservice/AAudioServiceEndpoint.cpp b/services/oboeservice/AAudioServiceEndpoint.cpp
index 0f863fe..3095bc9 100644
--- a/services/oboeservice/AAudioServiceEndpoint.cpp
+++ b/services/oboeservice/AAudioServiceEndpoint.cpp
@@ -33,17 +33,14 @@
#include "core/AudioStreamBuilder.h"
#include "AAudioServiceEndpoint.h"
#include "AAudioServiceStreamShared.h"
+#include "AAudioServiceEndpointShared.h"
using namespace android; // TODO just import names needed
using namespace aaudio; // TODO just import names needed
-#define MIN_TIMEOUT_NANOS (1000 * AAUDIO_NANOS_PER_MILLISECOND)
-
-// Wait at least this many times longer than the operation should take.
-#define MIN_TIMEOUT_OPERATIONS 4
-
-// This is the maximum size in frames. The effective size can be tuned smaller at runtime.
-#define DEFAULT_BUFFER_CAPACITY (48 * 8)
+AAudioServiceEndpoint::~AAudioServiceEndpoint() {
+ ALOGD("AAudioServiceEndpoint::~AAudioServiceEndpoint() destroying endpoint %p", this);
+}
std::string AAudioServiceEndpoint::dump() const {
std::stringstream result;
@@ -53,19 +50,20 @@
50 /* times */,
20 /* sleepMs */);
if (!isLocked) {
- result << "EndpointManager may be deadlocked\n";
+ result << "AAudioServiceEndpoint may be deadlocked\n";
}
- AudioStreamInternal *stream = mStreamInternal;
- if (stream == nullptr) {
- result << "null stream!" << "\n";
- } else {
- result << "mmap stream: rate = " << stream->getSampleRate() << "\n";
- }
-
+ result << " Direction: " << ((getDirection() == AAUDIO_DIRECTION_OUTPUT)
+ ? "OUTPUT" : "INPUT") << "\n";
+ result << " Sample Rate: " << getSampleRate() << "\n";
+ result << " Frames Per Burst: " << mFramesPerBurst << "\n";
+ result << " Reference Count: " << mOpenCount << "\n";
+ result << " Requested Device Id: " << mRequestedDeviceId << "\n";
+ result << " Device Id: " << getDeviceId() << "\n";
result << " Registered Streams:" << "\n";
- for (sp<AAudioServiceStreamShared> sharedStream : mRegisteredStreams) {
- result << sharedStream->dump();
+ result << AAudioServiceStreamShared::dumpHeader() << "\n";
+ for (const auto stream : mRegisteredStreams) {
+ result << stream->dump() << "\n";
}
if (isLocked) {
@@ -74,110 +72,44 @@
return result.str();
}
-// Set up an EXCLUSIVE MMAP stream that will be shared.
-aaudio_result_t AAudioServiceEndpoint::open(const AAudioStreamConfiguration& configuration) {
- mRequestedDeviceId = configuration.getDeviceId();
- mStreamInternal = getStreamInternal();
-
- AudioStreamBuilder builder;
- builder.setSharingMode(AAUDIO_SHARING_MODE_EXCLUSIVE);
- // Don't fall back to SHARED because that would cause recursion.
- builder.setSharingModeMatchRequired(true);
- builder.setDeviceId(mRequestedDeviceId);
- builder.setFormat(configuration.getFormat());
- builder.setSampleRate(configuration.getSampleRate());
- builder.setSamplesPerFrame(configuration.getSamplesPerFrame());
- builder.setDirection(getDirection());
- builder.setBufferCapacity(DEFAULT_BUFFER_CAPACITY);
-
- return getStreamInternal()->open(builder);
-}
-
-aaudio_result_t AAudioServiceEndpoint::close() {
- return getStreamInternal()->close();
-}
-
-// TODO, maybe use an interface to reduce exposure
-aaudio_result_t AAudioServiceEndpoint::registerStream(sp<AAudioServiceStreamShared>sharedStream) {
- std::lock_guard<std::mutex> lock(mLockStreams);
- mRegisteredStreams.push_back(sharedStream);
- return AAUDIO_OK;
-}
-
-aaudio_result_t AAudioServiceEndpoint::unregisterStream(sp<AAudioServiceStreamShared>sharedStream) {
- std::lock_guard<std::mutex> lock(mLockStreams);
- mRegisteredStreams.erase(std::remove(mRegisteredStreams.begin(), mRegisteredStreams.end(), sharedStream),
- mRegisteredStreams.end());
- return AAUDIO_OK;
-}
-
-aaudio_result_t AAudioServiceEndpoint::startStream(sp<AAudioServiceStreamShared> sharedStream) {
- aaudio_result_t result = AAUDIO_OK;
- if (++mRunningStreams == 1) {
- // TODO use real-time technique to avoid mutex, eg. atomic command FIFO
- std::lock_guard<std::mutex> lock(mLockStreams);
- result = getStreamInternal()->requestStart();
- startSharingThread_l();
- }
- return result;
-}
-
-aaudio_result_t AAudioServiceEndpoint::stopStream(sp<AAudioServiceStreamShared> sharedStream) {
- // Don't lock here because the disconnectRegisteredStreams also uses the lock.
- if (--mRunningStreams == 0) { // atomic
- stopSharingThread();
- getStreamInternal()->requestStop();
- }
- return AAUDIO_OK;
-}
-
-static void *aaudio_endpoint_thread_proc(void *context) {
- AAudioServiceEndpoint *endpoint = (AAudioServiceEndpoint *) context;
- if (endpoint != NULL) {
- return endpoint->callbackLoop();
- } else {
- return NULL;
- }
-}
-
-aaudio_result_t AAudioServiceEndpoint::startSharingThread_l() {
- // Launch the callback loop thread.
- int64_t periodNanos = getStreamInternal()->getFramesPerBurst()
- * AAUDIO_NANOS_PER_SECOND
- / getSampleRate();
- mCallbackEnabled.store(true);
- return getStreamInternal()->createThread(periodNanos, aaudio_endpoint_thread_proc, this);
-}
-
-aaudio_result_t AAudioServiceEndpoint::stopSharingThread() {
- mCallbackEnabled.store(false);
- aaudio_result_t result = getStreamInternal()->joinThread(NULL);
- return result;
-}
-
void AAudioServiceEndpoint::disconnectRegisteredStreams() {
std::lock_guard<std::mutex> lock(mLockStreams);
- for(auto sharedStream : mRegisteredStreams) {
- sharedStream->stop();
- sharedStream->disconnect();
+ for (const auto stream : mRegisteredStreams) {
+ stream->stop();
+ stream->disconnect();
}
mRegisteredStreams.clear();
}
+aaudio_result_t AAudioServiceEndpoint::registerStream(sp<AAudioServiceStreamBase>stream) {
+ std::lock_guard<std::mutex> lock(mLockStreams);
+ mRegisteredStreams.push_back(stream);
+ return AAUDIO_OK;
+}
+
+aaudio_result_t AAudioServiceEndpoint::unregisterStream(sp<AAudioServiceStreamBase>stream) {
+ std::lock_guard<std::mutex> lock(mLockStreams);
+ mRegisteredStreams.erase(std::remove(
+ mRegisteredStreams.begin(), mRegisteredStreams.end(), stream),
+ mRegisteredStreams.end());
+ return AAUDIO_OK;
+}
+
bool AAudioServiceEndpoint::matches(const AAudioStreamConfiguration& configuration) {
+ if (configuration.getDirection() != getDirection()) {
+ return false;
+ }
if (configuration.getDeviceId() != AAUDIO_UNSPECIFIED &&
- configuration.getDeviceId() != mStreamInternal->getDeviceId()) {
+ configuration.getDeviceId() != getDeviceId()) {
return false;
}
if (configuration.getSampleRate() != AAUDIO_UNSPECIFIED &&
- configuration.getSampleRate() != mStreamInternal->getSampleRate()) {
+ configuration.getSampleRate() != getSampleRate()) {
return false;
}
if (configuration.getSamplesPerFrame() != AAUDIO_UNSPECIFIED &&
- configuration.getSamplesPerFrame() != mStreamInternal->getSamplesPerFrame()) {
+ configuration.getSamplesPerFrame() != getSamplesPerFrame()) {
return false;
}
-
return true;
}
-
diff --git a/services/oboeservice/AAudioServiceEndpoint.h b/services/oboeservice/AAudioServiceEndpoint.h
index e40a670..2ef6234 100644
--- a/services/oboeservice/AAudioServiceEndpoint.h
+++ b/services/oboeservice/AAudioServiceEndpoint.h
@@ -24,70 +24,93 @@
#include "client/AudioStreamInternal.h"
#include "client/AudioStreamInternalPlay.h"
+#include "core/AAudioStreamParameters.h"
#include "binding/AAudioServiceMessage.h"
-#include "AAudioServiceStreamShared.h"
-#include "AAudioServiceStreamMMAP.h"
-#include "AAudioMixer.h"
-#include "AAudioService.h"
+#include "binding/AAudioStreamConfiguration.h"
+
+#include "AAudioServiceStreamBase.h"
namespace aaudio {
-class AAudioServiceEndpoint {
+/**
+ * AAudioServiceEndpoint is used by a subclass of AAudioServiceStreamBase
+ * to communicate with the underlying audio device or port.
+ */
+class AAudioServiceEndpoint
+ : public virtual android::RefBase
+ , public AAudioStreamParameters {
public:
- virtual ~AAudioServiceEndpoint() = default;
- std::string dump() const;
+ virtual ~AAudioServiceEndpoint();
- virtual aaudio_result_t open(const AAudioStreamConfiguration& configuration);
+ virtual std::string dump() const;
- int32_t getSampleRate() const { return mStreamInternal->getSampleRate(); }
- int32_t getSamplesPerFrame() const { return mStreamInternal->getSamplesPerFrame(); }
- int32_t getFramesPerBurst() const { return mStreamInternal->getFramesPerBurst(); }
+ virtual aaudio_result_t open(const aaudio::AAudioStreamRequest &request) = 0;
- aaudio_result_t registerStream(android::sp<AAudioServiceStreamShared> sharedStream);
- aaudio_result_t unregisterStream(android::sp<AAudioServiceStreamShared> sharedStream);
- aaudio_result_t startStream(android::sp<AAudioServiceStreamShared> sharedStream);
- aaudio_result_t stopStream(android::sp<AAudioServiceStreamShared> sharedStream);
- aaudio_result_t close();
+ virtual aaudio_result_t close() = 0;
+
+ virtual aaudio_result_t registerStream(android::sp<AAudioServiceStreamBase> stream);
+
+ virtual aaudio_result_t unregisterStream(android::sp<AAudioServiceStreamBase> stream);
+
+ virtual aaudio_result_t startStream(android::sp<AAudioServiceStreamBase> stream,
+ audio_port_handle_t *clientHandle) = 0;
+
+ virtual aaudio_result_t stopStream(android::sp<AAudioServiceStreamBase> stream,
+ audio_port_handle_t clientHandle) = 0;
+
+ virtual aaudio_result_t startClient(const android::AudioClient& client,
+ audio_port_handle_t *clientHandle) {
+ ALOGD("AAudioServiceEndpoint::startClient(%p, ...) AAUDIO_ERROR_UNAVAILABLE", &client);
+ return AAUDIO_ERROR_UNAVAILABLE;
+ }
+
+ virtual aaudio_result_t stopClient(audio_port_handle_t clientHandle) {
+ ALOGD("AAudioServiceEndpoint::stopClient(...) AAUDIO_ERROR_UNAVAILABLE");
+ return AAUDIO_ERROR_UNAVAILABLE;
+ }
+
+ /**
+ * @param positionFrames
+ * @param timeNanos
+ * @return AAUDIO_OK or AAUDIO_ERROR_UNAVAILABLE or other negative error
+ */
+ virtual aaudio_result_t getFreeRunningPosition(int64_t *positionFrames, int64_t *timeNanos) = 0;
+
+ virtual aaudio_result_t getTimestamp(int64_t *positionFrames, int64_t *timeNanos) = 0;
+
+ int32_t getFramesPerBurst() const {
+ return mFramesPerBurst;
+ }
int32_t getRequestedDeviceId() const { return mRequestedDeviceId; }
- int32_t getDeviceId() const { return mStreamInternal->getDeviceId(); }
-
- aaudio_direction_t getDirection() const { return mStreamInternal->getDirection(); }
-
- void disconnectRegisteredStreams();
-
- virtual void *callbackLoop() = 0;
-
- // This should only be called from the AAudioEndpointManager under a mutex.
- int32_t getReferenceCount() const {
- return mReferenceCount;
- }
-
- // This should only be called from the AAudioEndpointManager under a mutex.
- void setReferenceCount(int32_t count) {
- mReferenceCount = count;
- }
bool matches(const AAudioStreamConfiguration& configuration);
- virtual AudioStreamInternal *getStreamInternal() = 0;
+ // This should only be called from the AAudioEndpointManager under a mutex.
+ int32_t getOpenCount() const {
+ return mOpenCount;
+ }
- std::atomic<bool> mCallbackEnabled{false};
+ // This should only be called from the AAudioEndpointManager under a mutex.
+ void setOpenCount(int32_t count) {
+ mOpenCount = count;
+ }
+
+protected:
+ void disconnectRegisteredStreams();
mutable std::mutex mLockStreams;
+ std::vector<android::sp<AAudioServiceStreamBase>> mRegisteredStreams;
- std::vector<android::sp<AAudioServiceStreamShared>> mRegisteredStreams;
+ SimpleDoubleBuffer<Timestamp> mAtomicTimestamp;
- std::atomic<int> mRunningStreams{0};
+ android::AudioClient mMmapClient; // set in open, used in open and startStream
-private:
- aaudio_result_t startSharingThread_l();
- aaudio_result_t stopSharingThread();
-
- AudioStreamInternal *mStreamInternal = nullptr;
- int32_t mReferenceCount = 0;
+ int32_t mFramesPerBurst = 0;
+ int32_t mOpenCount = 0;
int32_t mRequestedDeviceId = 0;
+
};
} /* namespace aaudio */
diff --git a/services/oboeservice/AAudioServiceEndpointCapture.cpp b/services/oboeservice/AAudioServiceEndpointCapture.cpp
index 6a37330..c7d9b8e 100644
--- a/services/oboeservice/AAudioServiceEndpointCapture.cpp
+++ b/services/oboeservice/AAudioServiceEndpointCapture.cpp
@@ -30,20 +30,22 @@
#include "AAudioServiceEndpoint.h"
#include "AAudioServiceStreamShared.h"
#include "AAudioServiceEndpointCapture.h"
+#include "AAudioServiceEndpointShared.h"
using namespace android; // TODO just import names needed
using namespace aaudio; // TODO just import names needed
AAudioServiceEndpointCapture::AAudioServiceEndpointCapture(AAudioService &audioService)
: mStreamInternalCapture(audioService, true) {
+ mStreamInternal = &mStreamInternalCapture;
}
AAudioServiceEndpointCapture::~AAudioServiceEndpointCapture() {
delete mDistributionBuffer;
}
-aaudio_result_t AAudioServiceEndpointCapture::open(const AAudioStreamConfiguration& configuration) {
- aaudio_result_t result = AAudioServiceEndpoint::open(configuration);
+aaudio_result_t AAudioServiceEndpointCapture::open(const aaudio::AAudioStreamRequest &request) {
+ aaudio_result_t result = AAudioServiceEndpointShared::open(request);
if (result == AAUDIO_OK) {
delete mDistributionBuffer;
int distributionBufferSizeBytes = getStreamInternal()->getFramesPerBurst()
@@ -62,6 +64,9 @@
// result might be a frame count
while (mCallbackEnabled.load() && getStreamInternal()->isActive() && (result >= 0)) {
+
+ int64_t mmapFramesRead = getStreamInternal()->getFramesRead();
+
// Read audio data from stream using a blocking read.
result = getStreamInternal()->read(mDistributionBuffer, getFramesPerBurst(), timeoutNanos);
if (result == AAUDIO_ERROR_DISCONNECTED) {
@@ -74,18 +79,47 @@
}
// Distribute data to each active stream.
- { // use lock guard
+ { // brackets are for lock_guard
+
std::lock_guard <std::mutex> lock(mLockStreams);
- for (sp<AAudioServiceStreamShared> sharedStream : mRegisteredStreams) {
- if (sharedStream->isRunning()) {
- FifoBuffer *fifo = sharedStream->getDataFifoBuffer();
- if (fifo->getFifoControllerBase()->getEmptyFramesAvailable() <
- getFramesPerBurst()) {
- underflowCount++;
- } else {
- fifo->write(mDistributionBuffer, getFramesPerBurst());
+ for (const auto clientStream : mRegisteredStreams) {
+ if (clientStream->isRunning()) {
+ int64_t clientFramesWritten = 0;
+ sp<AAudioServiceStreamShared> streamShared =
+ static_cast<AAudioServiceStreamShared *>(clientStream.get());
+
+ {
+ // Lock the AudioFifo to protect against close.
+ std::lock_guard <std::mutex> lock(streamShared->getAudioDataQueueLock());
+
+ FifoBuffer *fifo = streamShared->getAudioDataFifoBuffer_l();
+ if (fifo != nullptr) {
+
+ // Determine offset between framePosition in client's stream
+ // vs the underlying MMAP stream.
+ clientFramesWritten = fifo->getWriteCounter();
+ // There are two indices that refer to the same frame.
+ int64_t positionOffset = mmapFramesRead - clientFramesWritten;
+ streamShared->setTimestampPositionOffset(positionOffset);
+
+ if (fifo->getFifoControllerBase()->getEmptyFramesAvailable() <
+ getFramesPerBurst()) {
+ underflowCount++;
+ } else {
+ fifo->write(mDistributionBuffer, getFramesPerBurst());
+ }
+ clientFramesWritten = fifo->getWriteCounter();
+ }
}
- sharedStream->markTransferTime(AudioClock::getNanoseconds());
+
+ if (clientFramesWritten > 0) {
+ // This timestamp represents the completion of data being written into the
+ // client buffer. It is sent to the client and used in the timing model
+ // to decide when data will be available to read.
+ Timestamp timestamp(clientFramesWritten, AudioClock::getNanoseconds());
+ streamShared->markTransferTime(timestamp);
+ }
+
}
}
}
diff --git a/services/oboeservice/AAudioServiceEndpointCapture.h b/services/oboeservice/AAudioServiceEndpointCapture.h
index 8a3d72f..971da9a 100644
--- a/services/oboeservice/AAudioServiceEndpointCapture.h
+++ b/services/oboeservice/AAudioServiceEndpointCapture.h
@@ -20,18 +20,18 @@
#include "client/AudioStreamInternal.h"
#include "client/AudioStreamInternalCapture.h"
+#include "AAudioServiceEndpointShared.h"
+#include "AAudioServiceStreamShared.h"
+
namespace aaudio {
-class AAudioServiceEndpointCapture : public AAudioServiceEndpoint {
+class AAudioServiceEndpointCapture : public AAudioServiceEndpointShared {
public:
explicit AAudioServiceEndpointCapture(android::AAudioService &audioService);
virtual ~AAudioServiceEndpointCapture();
- aaudio_result_t open(const AAudioStreamConfiguration& configuration) override;
+ aaudio_result_t open(const aaudio::AAudioStreamRequest &request) override;
- AudioStreamInternal *getStreamInternal() override {
- return &mStreamInternalCapture;
- }
void *callbackLoop() override;
diff --git a/services/oboeservice/AAudioServiceEndpointMMAP.cpp b/services/oboeservice/AAudioServiceEndpointMMAP.cpp
new file mode 100644
index 0000000..4be25c8
--- /dev/null
+++ b/services/oboeservice/AAudioServiceEndpointMMAP.cpp
@@ -0,0 +1,353 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "AAudioServiceEndpointMMAP"
+//#define LOG_NDEBUG 0
+#include <utils/Log.h>
+
+#include <algorithm>
+#include <assert.h>
+#include <map>
+#include <mutex>
+#include <sstream>
+#include <utils/Singleton.h>
+#include <vector>
+
+
+#include "AAudioEndpointManager.h"
+#include "AAudioServiceEndpoint.h"
+
+#include "core/AudioStreamBuilder.h"
+#include "AAudioServiceEndpoint.h"
+#include "AAudioServiceStreamShared.h"
+#include "AAudioServiceEndpointPlay.h"
+#include "AAudioServiceEndpointMMAP.h"
+
+
+#define AAUDIO_BUFFER_CAPACITY_MIN 4 * 512
+#define AAUDIO_SAMPLE_RATE_DEFAULT 48000
+
+// This is an estimate of the time difference between the HW and the MMAP time.
+// TODO Get presentation timestamps from the HAL instead of using these estimates.
+#define OUTPUT_ESTIMATED_HARDWARE_OFFSET_NANOS (3 * AAUDIO_NANOS_PER_MILLISECOND)
+#define INPUT_ESTIMATED_HARDWARE_OFFSET_NANOS (-1 * AAUDIO_NANOS_PER_MILLISECOND)
+
+using namespace android; // TODO just import names needed
+using namespace aaudio; // TODO just import names needed
+
+AAudioServiceEndpointMMAP::AAudioServiceEndpointMMAP()
+ : mMmapStream(nullptr) {}
+
+AAudioServiceEndpointMMAP::~AAudioServiceEndpointMMAP() {}
+
+std::string AAudioServiceEndpointMMAP::dump() const {
+ std::stringstream result;
+
+ result << " MMAP: framesTransferred = " << mFramesTransferred.get();
+ result << ", HW nanos = " << mHardwareTimeOffsetNanos;
+ result << ", port handle = " << mPortHandle;
+ result << ", audio data FD = " << mAudioDataFileDescriptor;
+ result << "\n";
+
+ result << " HW Offset Micros: " <<
+ (getHardwareTimeOffsetNanos()
+ / AAUDIO_NANOS_PER_MICROSECOND) << "\n";
+
+ result << AAudioServiceEndpoint::dump();
+ return result.str();
+}
+
+aaudio_result_t AAudioServiceEndpointMMAP::open(const aaudio::AAudioStreamRequest &request) {
+ aaudio_result_t result = AAUDIO_OK;
+ const audio_attributes_t attributes = {
+ .content_type = AUDIO_CONTENT_TYPE_MUSIC,
+ .usage = AUDIO_USAGE_MEDIA,
+ .source = AUDIO_SOURCE_VOICE_RECOGNITION,
+ .flags = AUDIO_FLAG_LOW_LATENCY,
+ .tags = ""
+ };
+ audio_config_base_t config;
+ audio_port_handle_t deviceId;
+
+ int32_t burstMinMicros = AAudioProperty_getHardwareBurstMinMicros();
+ int32_t burstMicros = 0;
+
+ copyFrom(request.getConstantConfiguration());
+
+ mMmapClient.clientUid = request.getUserId();
+ mMmapClient.clientPid = request.getProcessId();
+ mMmapClient.packageName.setTo(String16(""));
+
+ mRequestedDeviceId = deviceId = getDeviceId();
+
+ // Fill in config
+ aaudio_format_t aaudioFormat = getFormat();
+ if (aaudioFormat == AAUDIO_UNSPECIFIED || aaudioFormat == AAUDIO_FORMAT_PCM_FLOAT) {
+ aaudioFormat = AAUDIO_FORMAT_PCM_I16;
+ }
+ config.format = AAudioConvert_aaudioToAndroidDataFormat(aaudioFormat);
+
+ int32_t aaudioSampleRate = getSampleRate();
+ if (aaudioSampleRate == AAUDIO_UNSPECIFIED) {
+ aaudioSampleRate = AAUDIO_SAMPLE_RATE_DEFAULT;
+ }
+ config.sample_rate = aaudioSampleRate;
+
+ int32_t aaudioSamplesPerFrame = getSamplesPerFrame();
+
+ aaudio_direction_t direction = getDirection();
+ if (direction == AAUDIO_DIRECTION_OUTPUT) {
+ config.channel_mask = (aaudioSamplesPerFrame == AAUDIO_UNSPECIFIED)
+ ? AUDIO_CHANNEL_OUT_STEREO
+ : audio_channel_out_mask_from_count(aaudioSamplesPerFrame);
+ mHardwareTimeOffsetNanos = OUTPUT_ESTIMATED_HARDWARE_OFFSET_NANOS; // frames at DAC later
+
+ } else if (direction == AAUDIO_DIRECTION_INPUT) {
+ config.channel_mask = (aaudioSamplesPerFrame == AAUDIO_UNSPECIFIED)
+ ? AUDIO_CHANNEL_IN_STEREO
+ : audio_channel_in_mask_from_count(aaudioSamplesPerFrame);
+ mHardwareTimeOffsetNanos = INPUT_ESTIMATED_HARDWARE_OFFSET_NANOS; // frames at ADC earlier
+
+ } else {
+ ALOGE("openMmapStream - invalid direction = %d", direction);
+ return AAUDIO_ERROR_ILLEGAL_ARGUMENT;
+ }
+
+ MmapStreamInterface::stream_direction_t streamDirection =
+ (direction == AAUDIO_DIRECTION_OUTPUT)
+ ? MmapStreamInterface::DIRECTION_OUTPUT
+ : MmapStreamInterface::DIRECTION_INPUT;
+
+ // Open HAL stream. Set mMmapStream
+ status_t status = MmapStreamInterface::openMmapStream(streamDirection,
+ &attributes,
+ &config,
+ mMmapClient,
+ &deviceId,
+ this, // callback
+ mMmapStream,
+ &mPortHandle);
+ ALOGD("AAudioServiceEndpointMMAP::open() mMapClient.uid = %d, pid = %d => portHandle = %d\n",
+ mMmapClient.clientUid, mMmapClient.clientPid, mPortHandle);
+ if (status != OK) {
+ ALOGE("openMmapStream returned status %d", status);
+ return AAUDIO_ERROR_UNAVAILABLE;
+ }
+
+ if (deviceId == AAUDIO_UNSPECIFIED) {
+ ALOGW("AAudioServiceEndpointMMAP::open() - openMmapStream() failed to set deviceId");
+ }
+ setDeviceId(deviceId);
+
+ // Create MMAP/NOIRQ buffer.
+ int32_t minSizeFrames = getBufferCapacity();
+ if (minSizeFrames <= 0) { // zero will get rejected
+ minSizeFrames = AAUDIO_BUFFER_CAPACITY_MIN;
+ }
+ status = mMmapStream->createMmapBuffer(minSizeFrames, &mMmapBufferinfo);
+ if (status != OK) {
+ ALOGE("AAudioServiceEndpointMMAP::open() - createMmapBuffer() failed with status %d %s",
+ status, strerror(-status));
+ result = AAUDIO_ERROR_UNAVAILABLE;
+ goto error;
+ } else {
+ ALOGD("createMmapBuffer status = %d, buffer_size = %d, burst_size %d"
+ ", Sharable FD: %s",
+ status,
+ abs(mMmapBufferinfo.buffer_size_frames),
+ mMmapBufferinfo.burst_size_frames,
+ mMmapBufferinfo.buffer_size_frames < 0 ? "Yes" : "No");
+ }
+
+ setBufferCapacity(mMmapBufferinfo.buffer_size_frames);
+ // The audio HAL indicates if the shared memory fd can be shared outside of audioserver
+ // by returning a negative buffer size
+ if (getBufferCapacity() < 0) {
+ // Exclusive mode can be used by client or service.
+ setBufferCapacity(-getBufferCapacity());
+ } else {
+ // Exclusive mode can only be used by the service because the FD cannot be shared.
+ uid_t audioServiceUid = getuid();
+ if ((mMmapClient.clientUid != audioServiceUid) &&
+ getSharingMode() == AAUDIO_SHARING_MODE_EXCLUSIVE) {
+ // Fallback is handled by caller but indicate what is possible in case
+ // this is used in the future
+ setSharingMode(AAUDIO_SHARING_MODE_SHARED);
+ ALOGW("AAudioServiceEndpointMMAP::open() - exclusive FD cannot be used by client");
+ result = AAUDIO_ERROR_UNAVAILABLE;
+ goto error;
+ }
+ }
+
+ // Get information about the stream and pass it back to the caller.
+ setSamplesPerFrame((direction == AAUDIO_DIRECTION_OUTPUT)
+ ? audio_channel_count_from_out_mask(config.channel_mask)
+ : audio_channel_count_from_in_mask(config.channel_mask));
+
+ // AAudio creates a copy of this FD and retains ownership of the copy.
+ // Assume that AudioFlinger will close the original shared_memory_fd.
+ mAudioDataFileDescriptor.reset(dup(mMmapBufferinfo.shared_memory_fd));
+ if (mAudioDataFileDescriptor.get() == -1) {
+ ALOGE("AAudioServiceEndpointMMAP::open() - could not dup shared_memory_fd");
+ result = AAUDIO_ERROR_INTERNAL;
+ goto error;
+ }
+ mFramesPerBurst = mMmapBufferinfo.burst_size_frames;
+ setFormat(AAudioConvert_androidToAAudioDataFormat(config.format));
+ setSampleRate(config.sample_rate);
+
+ // Scale up the burst size to meet the minimum equivalent in microseconds.
+ // This is to avoid waking the CPU too often when the HW burst is very small
+ // or at high sample rates.
+ do {
+ if (burstMicros > 0) { // skip first loop
+ mFramesPerBurst *= 2;
+ }
+ burstMicros = mFramesPerBurst * static_cast<int64_t>(1000000) / getSampleRate();
+ } while (burstMicros < burstMinMicros);
+
+ ALOGD("AAudioServiceEndpointMMAP::open() original burst = %d, minMicros = %d, to burst = %d\n",
+ mMmapBufferinfo.burst_size_frames, burstMinMicros, mFramesPerBurst);
+
+ ALOGD("AAudioServiceEndpointMMAP::open() actual rate = %d, channels = %d"
+ ", deviceId = %d, capacity = %d\n",
+ getSampleRate(), getSamplesPerFrame(), deviceId, getBufferCapacity());
+
+ return result;
+
+error:
+ close();
+ return result;
+}
+
+aaudio_result_t AAudioServiceEndpointMMAP::close() {
+
+ if (mMmapStream != 0) {
+ ALOGD("AAudioServiceEndpointMMAP::close() clear() endpoint");
+ // Needs to be explicitly cleared or CTS will fail but it is not clear why.
+ mMmapStream.clear();
+ // Apparently the above close is asynchronous. An attempt to open a new device
+ // right after a close can fail. Also some callbacks may still be in flight!
+ // FIXME Make closing synchronous.
+ AudioClock::sleepForNanos(100 * AAUDIO_NANOS_PER_MILLISECOND);
+ }
+
+ return AAUDIO_OK;
+}
+
+aaudio_result_t AAudioServiceEndpointMMAP::startStream(sp<AAudioServiceStreamBase> stream,
+ audio_port_handle_t *clientHandle) {
+ // Start the client on behalf of the AAudio service.
+ // Use the port handle that was provided by openMmapStream().
+ return startClient(mMmapClient, &mPortHandle);
+}
+
+aaudio_result_t AAudioServiceEndpointMMAP::stopStream(sp<AAudioServiceStreamBase> stream,
+ audio_port_handle_t clientHandle) {
+ mFramesTransferred.reset32();
+ return stopClient(mPortHandle);
+}
+
+aaudio_result_t AAudioServiceEndpointMMAP::startClient(const android::AudioClient& client,
+ audio_port_handle_t *clientHandle) {
+ if (mMmapStream == nullptr) return AAUDIO_ERROR_NULL;
+ ALOGD("AAudioServiceEndpointMMAP::startClient(%p(uid=%d, pid=%d))",
+ &client, client.clientUid, client.clientPid);
+ audio_port_handle_t originalHandle = *clientHandle;
+ status_t status = mMmapStream->start(client, clientHandle);
+ aaudio_result_t result = AAudioConvert_androidToAAudioResult(status);
+ ALOGD("AAudioServiceEndpointMMAP::startClient() , %d => %d returns %d",
+ originalHandle, *clientHandle, result);
+ return result;
+}
+
+aaudio_result_t AAudioServiceEndpointMMAP::stopClient(audio_port_handle_t clientHandle) {
+ if (mMmapStream == nullptr) return AAUDIO_ERROR_NULL;
+ aaudio_result_t result = AAudioConvert_androidToAAudioResult(mMmapStream->stop(clientHandle));
+ ALOGD("AAudioServiceEndpointMMAP::stopClient(%d) returns %d", clientHandle, result);
+ return result;
+}
+
+// Get free-running DSP or DMA hardware position from the HAL.
+aaudio_result_t AAudioServiceEndpointMMAP::getFreeRunningPosition(int64_t *positionFrames,
+ int64_t *timeNanos) {
+ struct audio_mmap_position position;
+ if (mMmapStream == nullptr) {
+ return AAUDIO_ERROR_NULL;
+ }
+ status_t status = mMmapStream->getMmapPosition(&position);
+ ALOGV("AAudioServiceEndpointMMAP::getFreeRunningPosition() status= %d, pos = %d, nanos = %lld\n",
+ status, position.position_frames, (long long) position.time_nanoseconds);
+ aaudio_result_t result = AAudioConvert_androidToAAudioResult(status);
+ if (result == AAUDIO_ERROR_UNAVAILABLE) {
+ ALOGW("sendCurrentTimestamp(): getMmapPosition() has no position data available");
+ } else if (result != AAUDIO_OK) {
+ ALOGE("sendCurrentTimestamp(): getMmapPosition() returned status %d", status);
+ } else {
+ // Convert 32-bit position to 64-bit position.
+ mFramesTransferred.update32(position.position_frames);
+ *positionFrames = mFramesTransferred.get();
+ *timeNanos = position.time_nanoseconds;
+ }
+ return result;
+}
+
+aaudio_result_t AAudioServiceEndpointMMAP::getTimestamp(int64_t *positionFrames,
+ int64_t *timeNanos) {
+ return 0; // TODO
+}
+
+
+void AAudioServiceEndpointMMAP::onTearDown() {
+ ALOGD("AAudioServiceEndpointMMAP::onTearDown() called");
+ disconnectRegisteredStreams();
+};
+
+void AAudioServiceEndpointMMAP::onVolumeChanged(audio_channel_mask_t channels,
+ android::Vector<float> values) {
+ // TODO do we really need a different volume for each channel?
+ float volume = values[0];
+ ALOGD("AAudioServiceEndpointMMAP::onVolumeChanged() volume[0] = %f", volume);
+ std::lock_guard<std::mutex> lock(mLockStreams);
+ for(const auto stream : mRegisteredStreams) {
+ stream->onVolumeChanged(volume);
+ }
+};
+
+void AAudioServiceEndpointMMAP::onRoutingChanged(audio_port_handle_t deviceId) {
+ ALOGD("AAudioServiceEndpointMMAP::onRoutingChanged() called with %d, old = %d",
+ deviceId, getDeviceId());
+ if (getDeviceId() != AUDIO_PORT_HANDLE_NONE && getDeviceId() != deviceId) {
+ disconnectRegisteredStreams();
+ }
+ setDeviceId(deviceId);
+};
+
+/**
+ * Get an immutable description of the data queue from the HAL.
+ */
+aaudio_result_t AAudioServiceEndpointMMAP::getDownDataDescription(AudioEndpointParcelable &parcelable)
+{
+ // Gather information on the data queue based on HAL info.
+ int32_t bytesPerFrame = calculateBytesPerFrame();
+ int32_t capacityInBytes = getBufferCapacity() * bytesPerFrame;
+ int fdIndex = parcelable.addFileDescriptor(mAudioDataFileDescriptor, capacityInBytes);
+ parcelable.mDownDataQueueParcelable.setupMemory(fdIndex, 0, capacityInBytes);
+ parcelable.mDownDataQueueParcelable.setBytesPerFrame(bytesPerFrame);
+ parcelable.mDownDataQueueParcelable.setFramesPerBurst(mFramesPerBurst);
+ parcelable.mDownDataQueueParcelable.setCapacityInFrames(getBufferCapacity());
+ return AAUDIO_OK;
+}
diff --git a/services/oboeservice/AAudioServiceEndpointMMAP.h b/services/oboeservice/AAudioServiceEndpointMMAP.h
new file mode 100644
index 0000000..16b6269
--- /dev/null
+++ b/services/oboeservice/AAudioServiceEndpointMMAP.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AAUDIO_SERVICE_ENDPOINT_MMAP_H
+#define AAUDIO_SERVICE_ENDPOINT_MMAP_H
+
+#include <atomic>
+#include <functional>
+#include <mutex>
+#include <vector>
+
+#include "client/AudioStreamInternal.h"
+#include "client/AudioStreamInternalPlay.h"
+#include "binding/AAudioServiceMessage.h"
+#include "AAudioServiceEndpointShared.h"
+#include "AAudioServiceStreamShared.h"
+#include "AAudioServiceStreamMMAP.h"
+#include "AAudioMixer.h"
+#include "AAudioService.h"
+
+namespace aaudio {
+
+/**
+ * This is used by AAudioServiceStreamMMAP to access the MMAP devices
+ * through AudioFlinger.
+ */
+class AAudioServiceEndpointMMAP
+ : public AAudioServiceEndpoint
+ , public android::MmapStreamCallback {
+
+public:
+ AAudioServiceEndpointMMAP();
+
+ virtual ~AAudioServiceEndpointMMAP();
+
+ std::string dump() const override;
+
+ aaudio_result_t open(const aaudio::AAudioStreamRequest &request) override;
+
+ aaudio_result_t close() override;
+
+ aaudio_result_t startStream(android::sp<AAudioServiceStreamBase> stream,
+ audio_port_handle_t *clientHandle) override;
+
+ aaudio_result_t stopStream(android::sp<AAudioServiceStreamBase> stream,
+ audio_port_handle_t clientHandle) override;
+
+ aaudio_result_t startClient(const android::AudioClient& client,
+ audio_port_handle_t *clientHandle) override;
+
+ aaudio_result_t stopClient(audio_port_handle_t clientHandle) override;
+
+ aaudio_result_t getFreeRunningPosition(int64_t *positionFrames, int64_t *timeNanos) override;
+
+ aaudio_result_t getTimestamp(int64_t *positionFrames, int64_t *timeNanos) override;
+
+ // -------------- Callback functions for MmapStreamCallback ---------------------
+ void onTearDown() override;
+
+ void onVolumeChanged(audio_channel_mask_t channels,
+ android::Vector<float> values) override;
+
+ void onRoutingChanged(audio_port_handle_t deviceId) override;
+ // ------------------------------------------------------------------------------
+
+ aaudio_result_t getDownDataDescription(AudioEndpointParcelable &parcelable);
+
+ int64_t getHardwareTimeOffsetNanos() const {
+ return mHardwareTimeOffsetNanos;
+ }
+
+private:
+ MonotonicCounter mFramesTransferred;
+
+ // Interface to the AudioFlinger MMAP support.
+ android::sp<android::MmapStreamInterface> mMmapStream;
+ struct audio_mmap_buffer_info mMmapBufferinfo;
+ audio_port_handle_t mPortHandle = AUDIO_PORT_HANDLE_NONE;
+
+ android::base::unique_fd mAudioDataFileDescriptor;
+
+ int64_t mHardwareTimeOffsetNanos = 0; // TODO get from HAL
+
+};
+
+} /* namespace aaudio */
+
+#endif //AAUDIO_SERVICE_ENDPOINT_MMAP_H
+
diff --git a/services/oboeservice/AAudioServiceEndpointPlay.cpp b/services/oboeservice/AAudioServiceEndpointPlay.cpp
index b83b918..9b1833a 100644
--- a/services/oboeservice/AAudioServiceEndpointPlay.cpp
+++ b/services/oboeservice/AAudioServiceEndpointPlay.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define LOG_TAG "AAudioService"
+#define LOG_TAG "AAudioServiceEndpointPlay"
//#define LOG_NDEBUG 0
#include <utils/Log.h>
@@ -33,6 +33,7 @@
#include "AAudioServiceEndpoint.h"
#include "AAudioServiceStreamShared.h"
#include "AAudioServiceEndpointPlay.h"
+#include "AAudioServiceEndpointShared.h"
using namespace android; // TODO just import names needed
using namespace aaudio; // TODO just import names needed
@@ -41,13 +42,14 @@
AAudioServiceEndpointPlay::AAudioServiceEndpointPlay(AAudioService &audioService)
: mStreamInternalPlay(audioService, true) {
+ mStreamInternal = &mStreamInternalPlay;
}
AAudioServiceEndpointPlay::~AAudioServiceEndpointPlay() {
}
-aaudio_result_t AAudioServiceEndpointPlay::open(const AAudioStreamConfiguration& configuration) {
- aaudio_result_t result = AAudioServiceEndpoint::open(configuration);
+aaudio_result_t AAudioServiceEndpointPlay::open(const aaudio::AAudioStreamRequest &request) {
+ aaudio_result_t result = AAudioServiceEndpointShared::open(request);
if (result == AAUDIO_OK) {
mMixer.allocate(getStreamInternal()->getSamplesPerFrame(),
getStreamInternal()->getFramesPerBurst());
@@ -65,7 +67,6 @@
// Mix data from each application stream and write result to the shared MMAP stream.
void *AAudioServiceEndpointPlay::callbackLoop() {
- int32_t underflowCount = 0;
aaudio_result_t result = AAUDIO_OK;
int64_t timeoutNanos = getStreamInternal()->calculateReasonableTimeout();
@@ -73,19 +74,54 @@
while (mCallbackEnabled.load() && getStreamInternal()->isActive() && (result >= 0)) {
// Mix data from each active stream.
mMixer.clear();
- { // use lock guard
+
+ { // brackets are for lock_guard
int index = 0;
+ int64_t mmapFramesWritten = getStreamInternal()->getFramesWritten();
+
std::lock_guard <std::mutex> lock(mLockStreams);
- for (sp<AAudioServiceStreamShared> sharedStream : mRegisteredStreams) {
- if (sharedStream->isRunning()) {
- FifoBuffer *fifo = sharedStream->getDataFifoBuffer();
- float volume = 1.0; // to match legacy volume
- bool underflowed = mMixer.mix(index, fifo, volume);
- underflowCount += underflowed ? 1 : 0;
- // TODO log underflows in each stream
- sharedStream->markTransferTime(AudioClock::getNanoseconds());
+ for (const auto clientStream : mRegisteredStreams) {
+ int64_t clientFramesRead = 0;
+
+ if (!clientStream->isRunning()) {
+ continue;
}
- index++;
+
+ sp<AAudioServiceStreamShared> streamShared =
+ static_cast<AAudioServiceStreamShared *>(clientStream.get());
+
+ {
+ // Lock the AudioFifo to protect against close.
+ std::lock_guard <std::mutex> lock(streamShared->getAudioDataQueueLock());
+
+ FifoBuffer *fifo = streamShared->getAudioDataFifoBuffer_l();
+ if (fifo != nullptr) {
+
+ // Determine offset between framePosition in client's stream
+ // vs the underlying MMAP stream.
+ clientFramesRead = fifo->getReadCounter();
+ // These two indices refer to the same frame.
+ int64_t positionOffset = mmapFramesWritten - clientFramesRead;
+ streamShared->setTimestampPositionOffset(positionOffset);
+
+ float volume = 1.0; // to match legacy volume
+ bool underflowed = mMixer.mix(index, fifo, volume);
+ if (underflowed) {
+ streamShared->incrementXRunCount();
+ }
+ clientFramesRead = fifo->getReadCounter();
+ }
+ }
+
+ if (clientFramesRead > 0) {
+ // This timestamp represents the completion of data being read out of the
+ // client buffer. It is sent to the client and used in the timing model
+ // to decide when the client has room to write more data.
+ Timestamp timestamp(clientFramesRead, AudioClock::getNanoseconds());
+ streamShared->markTransferTime(timestamp);
+ }
+
+ index++; // just used for labelling tracks in systrace
}
}
@@ -93,7 +129,7 @@
result = getStreamInternal()->write(mMixer.getOutputBuffer(),
getFramesPerBurst(), timeoutNanos);
if (result == AAUDIO_ERROR_DISCONNECTED) {
- disconnectRegisteredStreams();
+ AAudioServiceEndpointShared::disconnectRegisteredStreams();
break;
} else if (result != getFramesPerBurst()) {
ALOGW("AAudioServiceEndpoint(): callbackLoop() wrote %d / %d",
@@ -102,8 +138,5 @@
}
}
- ALOGW_IF((underflowCount > 0),
- "AAudioServiceEndpointPlay(): callbackLoop() had %d underflows", underflowCount);
-
return NULL; // TODO review
}
diff --git a/services/oboeservice/AAudioServiceEndpointPlay.h b/services/oboeservice/AAudioServiceEndpointPlay.h
index c22f510..a0a383c 100644
--- a/services/oboeservice/AAudioServiceEndpointPlay.h
+++ b/services/oboeservice/AAudioServiceEndpointPlay.h
@@ -25,6 +25,7 @@
#include "client/AudioStreamInternal.h"
#include "client/AudioStreamInternalPlay.h"
#include "binding/AAudioServiceMessage.h"
+#include "AAudioServiceEndpointShared.h"
#include "AAudioServiceStreamShared.h"
#include "AAudioServiceStreamMMAP.h"
#include "AAudioMixer.h"
@@ -35,16 +36,12 @@
/**
* Contains a mixer and a stream for writing the result of the mix.
*/
-class AAudioServiceEndpointPlay : public AAudioServiceEndpoint {
+class AAudioServiceEndpointPlay : public AAudioServiceEndpointShared {
public:
explicit AAudioServiceEndpointPlay(android::AAudioService &audioService);
virtual ~AAudioServiceEndpointPlay();
- aaudio_result_t open(const AAudioStreamConfiguration& configuration) override;
-
- AudioStreamInternal *getStreamInternal() override {
- return &mStreamInternalPlay;
- }
+ aaudio_result_t open(const aaudio::AAudioStreamRequest &request) override;
void *callbackLoop() override;
diff --git a/services/oboeservice/AAudioServiceEndpointShared.cpp b/services/oboeservice/AAudioServiceEndpointShared.cpp
new file mode 100644
index 0000000..cd40066
--- /dev/null
+++ b/services/oboeservice/AAudioServiceEndpointShared.cpp
@@ -0,0 +1,178 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#define LOG_TAG "AAudioServiceEndpointShared"
+//#define LOG_NDEBUG 0
+#include <utils/Log.h>
+
+#include <iomanip>
+#include <iostream>
+#include <sstream>
+
+#include "binding/AAudioServiceMessage.h"
+#include "client/AudioStreamInternal.h"
+#include "client/AudioStreamInternalPlay.h"
+#include "core/AudioStreamBuilder.h"
+
+#include "AAudioServiceEndpointShared.h"
+#include "AAudioServiceStreamShared.h"
+#include "AAudioServiceStreamMMAP.h"
+#include "AAudioMixer.h"
+#include "AAudioService.h"
+
+using namespace android;
+using namespace aaudio;
+
+// This is the maximum size in frames. The effective size can be tuned smaller at runtime.
+#define DEFAULT_BUFFER_CAPACITY (48 * 8)
+
+std::string AAudioServiceEndpointShared::dump() const {
+ std::stringstream result;
+
+ result << " SHARED: sharing exclusive stream with handle = 0x"
+ << std::setfill('0') << std::setw(8)
+ << std::hex << mStreamInternal->getServiceHandle()
+ << std::dec << std::setfill(' ');
+ result << "\n";
+ result << " Running Stream Count: " << mRunningStreamCount << "\n";
+
+ result << AAudioServiceEndpoint::dump();
+ return result.str();
+}
+
+// Share an AudioStreamInternal.
+aaudio_result_t AAudioServiceEndpointShared::open(const aaudio::AAudioStreamRequest &request) {
+ aaudio_result_t result = AAUDIO_OK;
+ const AAudioStreamConfiguration &configuration = request.getConstantConfiguration();
+
+ mRequestedDeviceId = configuration.getDeviceId();
+ setDirection(configuration.getDirection());
+
+ AudioStreamBuilder builder;
+ builder.setSharingMode(AAUDIO_SHARING_MODE_EXCLUSIVE);
+ // Don't fall back to SHARED because that would cause recursion.
+ builder.setSharingModeMatchRequired(true);
+ builder.setDeviceId(mRequestedDeviceId);
+ builder.setFormat(configuration.getFormat());
+ builder.setSampleRate(configuration.getSampleRate());
+ builder.setSamplesPerFrame(configuration.getSamplesPerFrame());
+ builder.setDirection(configuration.getDirection());
+ builder.setBufferCapacity(DEFAULT_BUFFER_CAPACITY);
+
+ result = mStreamInternal->open(builder);
+
+ setSampleRate(mStreamInternal->getSampleRate());
+ setSamplesPerFrame(mStreamInternal->getSamplesPerFrame());
+ setDeviceId(mStreamInternal->getDeviceId());
+ mFramesPerBurst = mStreamInternal->getFramesPerBurst();
+
+ return result;
+}
+
+aaudio_result_t AAudioServiceEndpointShared::close() {
+ return getStreamInternal()->close();
+}
+
+// Glue between C and C++ callbacks.
+static void *aaudio_endpoint_thread_proc(void *context) {
+ AAudioServiceEndpointShared *endpoint = (AAudioServiceEndpointShared *) context;
+ if (endpoint != NULL) {
+ return endpoint->callbackLoop();
+ } else {
+ return NULL;
+ }
+}
+
+aaudio_result_t aaudio::AAudioServiceEndpointShared::startSharingThread_l() {
+ // Launch the callback loop thread.
+ int64_t periodNanos = getStreamInternal()->getFramesPerBurst()
+ * AAUDIO_NANOS_PER_SECOND
+ / getSampleRate();
+ mCallbackEnabled.store(true);
+ return getStreamInternal()->createThread(periodNanos, aaudio_endpoint_thread_proc, this);
+}
+
+aaudio_result_t aaudio::AAudioServiceEndpointShared::stopSharingThread() {
+ mCallbackEnabled.store(false);
+ aaudio_result_t result = getStreamInternal()->joinThread(NULL);
+ return result;
+}
+
+aaudio_result_t AAudioServiceEndpointShared::startStream(sp<AAudioServiceStreamBase> sharedStream,
+ audio_port_handle_t *clientHandle) {
+ aaudio_result_t result = AAUDIO_OK;
+
+ {
+ std::lock_guard<std::mutex> lock(mLockStreams);
+ if (++mRunningStreamCount == 1) { // atomic
+ result = getStreamInternal()->requestStart();
+ if (result != AAUDIO_OK) {
+ --mRunningStreamCount;
+ } else {
+ result = startSharingThread_l();
+ if (result != AAUDIO_OK) {
+ getStreamInternal()->requestStop();
+ --mRunningStreamCount;
+ }
+ }
+ }
+ }
+
+ if (result == AAUDIO_OK) {
+ result = getStreamInternal()->startClient(sharedStream->getAudioClient(), clientHandle);
+ if (result != AAUDIO_OK) {
+ if (--mRunningStreamCount == 0) { // atomic
+ stopSharingThread();
+ getStreamInternal()->requestStop();
+ }
+ }
+ }
+
+ return result;
+}
+
+aaudio_result_t AAudioServiceEndpointShared::stopStream(sp<AAudioServiceStreamBase> sharedStream,
+ audio_port_handle_t clientHandle) {
+ // Don't lock here because the disconnectRegisteredStreams also uses the lock.
+
+ // Ignore result.
+ (void) getStreamInternal()->stopClient(clientHandle);
+
+ if (--mRunningStreamCount == 0) { // atomic
+ stopSharingThread();
+ getStreamInternal()->requestStop();
+ }
+ return AAUDIO_OK;
+}
+
+// Get timestamp that was written by the real-time service thread, eg. mixer.
+aaudio_result_t AAudioServiceEndpointShared::getFreeRunningPosition(int64_t *positionFrames,
+ int64_t *timeNanos) {
+ if (mAtomicTimestamp.isValid()) {
+ Timestamp timestamp = mAtomicTimestamp.read();
+ *positionFrames = timestamp.getPosition();
+ *timeNanos = timestamp.getNanoseconds();
+ return AAUDIO_OK;
+ } else {
+ return AAUDIO_ERROR_UNAVAILABLE;
+ }
+}
+
+aaudio_result_t AAudioServiceEndpointShared::getTimestamp(int64_t *positionFrames,
+ int64_t *timeNanos) {
+ return mStreamInternal->getTimestamp(CLOCK_MONOTONIC, positionFrames, timeNanos);
+}
diff --git a/services/oboeservice/AAudioServiceEndpointShared.h b/services/oboeservice/AAudioServiceEndpointShared.h
new file mode 100644
index 0000000..e3bd2c1
--- /dev/null
+++ b/services/oboeservice/AAudioServiceEndpointShared.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AAUDIO_SERVICE_ENDPOINT_SHARED_H
+#define AAUDIO_SERVICE_ENDPOINT_SHARED_H
+
+#include <atomic>
+#include <mutex>
+
+#include "AAudioServiceEndpoint.h"
+#include "client/AudioStreamInternal.h"
+#include "client/AudioStreamInternalPlay.h"
+#include "AAudioServiceStreamShared.h"
+#include "AAudioServiceStreamMMAP.h"
+#include "AAudioService.h"
+
+namespace aaudio {
+
+/**
+ * This Service class corresponds to a Client stream that shares an MMAP device through a mixer
+ * or an input distributor.
+ */
+class AAudioServiceEndpointShared : public AAudioServiceEndpoint {
+
+public:
+
+ std::string dump() const override;
+
+ aaudio_result_t open(const aaudio::AAudioStreamRequest &request) override;
+
+ aaudio_result_t close() override;
+
+ aaudio_result_t startStream(android::sp<AAudioServiceStreamBase> stream,
+ audio_port_handle_t *clientHandle) override;
+
+ aaudio_result_t stopStream(android::sp<AAudioServiceStreamBase> stream,
+ audio_port_handle_t clientHandle) override;
+
+ aaudio_result_t getFreeRunningPosition(int64_t *positionFrames, int64_t *timeNanos) override;
+
+ aaudio_result_t getTimestamp(int64_t *positionFrames, int64_t *timeNanos) override;
+
+ virtual void *callbackLoop() = 0;
+
+ AudioStreamInternal *getStreamInternal() const {
+ return mStreamInternal;
+ };
+
+protected:
+
+ aaudio_result_t startSharingThread_l();
+
+ aaudio_result_t stopSharingThread();
+
+ // pointer to object statically allocated in subclasses
+ AudioStreamInternal *mStreamInternal = nullptr;
+
+ std::atomic<bool> mCallbackEnabled{false};
+
+ std::atomic<int> mRunningStreamCount{0};
+};
+
+}
+
+#endif //AAUDIO_SERVICE_ENDPOINT_SHARED_H
diff --git a/services/oboeservice/AAudioServiceStreamBase.cpp b/services/oboeservice/AAudioServiceStreamBase.cpp
index 5f7d179..e670129 100644
--- a/services/oboeservice/AAudioServiceStreamBase.cpp
+++ b/services/oboeservice/AAudioServiceStreamBase.cpp
@@ -18,12 +18,17 @@
//#define LOG_NDEBUG 0
#include <utils/Log.h>
+#include <iomanip>
+#include <iostream>
#include <mutex>
#include "binding/IAAudioService.h"
#include "binding/AAudioServiceMessage.h"
#include "utility/AudioClock.h"
+#include "AAudioEndpointManager.h"
+#include "AAudioService.h"
+#include "AAudioServiceEndpoint.h"
#include "AAudioServiceStreamBase.h"
#include "TimestampScheduler.h"
@@ -35,9 +40,11 @@
* @return
*/
-AAudioServiceStreamBase::AAudioServiceStreamBase()
+AAudioServiceStreamBase::AAudioServiceStreamBase(AAudioService &audioService)
: mUpMessageQueue(nullptr)
- , mAAudioThread() {
+ , mTimestampThread()
+ , mAtomicTimestamp()
+ , mAudioService(audioService) {
mMmapClient.clientUid = -1;
mMmapClient.clientPid = -1;
mMmapClient.packageName = String16("");
@@ -47,61 +54,143 @@
ALOGD("AAudioServiceStreamBase::~AAudioServiceStreamBase() destroying %p", this);
// If the stream is deleted when OPEN or in use then audio resources will leak.
// This would indicate an internal error. So we want to find this ASAP.
- LOG_ALWAYS_FATAL_IF(!(mState == AAUDIO_STREAM_STATE_CLOSED
- || mState == AAUDIO_STREAM_STATE_UNINITIALIZED
- || mState == AAUDIO_STREAM_STATE_DISCONNECTED),
- "service stream still open, state = %d", mState);
+ LOG_ALWAYS_FATAL_IF(!(getState() == AAUDIO_STREAM_STATE_CLOSED
+ || getState() == AAUDIO_STREAM_STATE_UNINITIALIZED
+ || getState() == AAUDIO_STREAM_STATE_DISCONNECTED),
+ "service stream still open, state = %d", getState());
+}
+
+std::string AAudioServiceStreamBase::dumpHeader() {
+ return std::string(" T Handle UId Run State Format Burst Chan Capacity");
}
std::string AAudioServiceStreamBase::dump() const {
std::stringstream result;
- result << " -------- handle = 0x" << std::hex << mHandle << std::dec << "\n";
- result << " state = " << AAudio_convertStreamStateToText(mState) << "\n";
- result << " format = " << mAudioFormat << "\n";
- result << " framesPerBurst = " << mFramesPerBurst << "\n";
- result << " channelCount = " << mSamplesPerFrame << "\n";
- result << " capacityFrames = " << mCapacityInFrames << "\n";
- result << " owner uid = " << mMmapClient.clientUid << "\n";
+ result << " 0x" << std::setfill('0') << std::setw(8) << std::hex << mHandle
+ << std::dec << std::setfill(' ') ;
+ result << std::setw(6) << mMmapClient.clientUid;
+ result << std::setw(4) << (isRunning() ? "yes" : " no");
+ result << std::setw(6) << getState();
+ result << std::setw(7) << getFormat();
+ result << std::setw(6) << mFramesPerBurst;
+ result << std::setw(5) << getSamplesPerFrame();
+ result << std::setw(9) << getBufferCapacity();
return result.str();
}
aaudio_result_t AAudioServiceStreamBase::open(const aaudio::AAudioStreamRequest &request,
- aaudio::AAudioStreamConfiguration &configurationOutput) {
+ aaudio_sharing_mode_t sharingMode) {
+ AAudioEndpointManager &mEndpointManager = AAudioEndpointManager::getInstance();
+ aaudio_result_t result = AAUDIO_OK;
mMmapClient.clientUid = request.getUserId();
mMmapClient.clientPid = request.getProcessId();
- mMmapClient.packageName.setTo(String16("")); // FIXME what should we do here?
+ mMmapClient.packageName.setTo(String16("")); // TODO What should we do here?
- std::lock_guard<std::mutex> lock(mLockUpMessageQueue);
- if (mUpMessageQueue != nullptr) {
- return AAUDIO_ERROR_INVALID_STATE;
- } else {
+ // Limit scope of lock to avoid recursive lock in close().
+ {
+ std::lock_guard<std::mutex> lock(mUpMessageQueueLock);
+ if (mUpMessageQueue != nullptr) {
+ ALOGE("AAudioServiceStreamBase::open() called twice");
+ return AAUDIO_ERROR_INVALID_STATE;
+ }
+
mUpMessageQueue = new SharedRingBuffer();
- return mUpMessageQueue->allocate(sizeof(AAudioServiceMessage), QUEUE_UP_CAPACITY_COMMANDS);
+ result = mUpMessageQueue->allocate(sizeof(AAudioServiceMessage),
+ QUEUE_UP_CAPACITY_COMMANDS);
+ if (result != AAUDIO_OK) {
+ goto error;
+ }
+
+ mServiceEndpoint = mEndpointManager.openEndpoint(mAudioService,
+ request,
+ sharingMode);
+ if (mServiceEndpoint == nullptr) {
+ ALOGE("AAudioServiceStreamBase::open() openEndpoint() failed");
+ result = AAUDIO_ERROR_UNAVAILABLE;
+ goto error;
+ }
+ mFramesPerBurst = mServiceEndpoint->getFramesPerBurst();
+ copyFrom(*mServiceEndpoint);
}
+ return result;
+
+error:
+ close();
+ return result;
}
aaudio_result_t AAudioServiceStreamBase::close() {
- if (mState != AAUDIO_STREAM_STATE_CLOSED) {
+ aaudio_result_t result = AAUDIO_OK;
+ if (getState() == AAUDIO_STREAM_STATE_CLOSED) {
+ return AAUDIO_OK;
+ }
+
+ stop();
+
+ if (mServiceEndpoint == nullptr) {
+ result = AAUDIO_ERROR_INVALID_STATE;
+ } else {
+ mServiceEndpoint->unregisterStream(this);
+ AAudioEndpointManager &mEndpointManager = AAudioEndpointManager::getInstance();
+ mEndpointManager.closeEndpoint(mServiceEndpoint);
+ mServiceEndpoint.clear();
+ }
+
+ {
+ std::lock_guard<std::mutex> lock(mUpMessageQueueLock);
stopTimestampThread();
- std::lock_guard<std::mutex> lock(mLockUpMessageQueue);
delete mUpMessageQueue;
mUpMessageQueue = nullptr;
- mState = AAUDIO_STREAM_STATE_CLOSED;
}
- return AAUDIO_OK;
+
+ setState(AAUDIO_STREAM_STATE_CLOSED);
+ return result;
}
+aaudio_result_t AAudioServiceStreamBase::startDevice() {
+ mClientHandle = AUDIO_PORT_HANDLE_NONE;
+ return mServiceEndpoint->startStream(this, &mClientHandle);
+}
+
+/**
+ * Start the flow of audio data.
+ *
+ * An AAUDIO_SERVICE_EVENT_STARTED will be sent to the client when complete.
+ */
aaudio_result_t AAudioServiceStreamBase::start() {
+ aaudio_result_t result = AAUDIO_OK;
if (isRunning()) {
return AAUDIO_OK;
}
+
+ if (mServiceEndpoint == nullptr) {
+ ALOGE("AAudioServiceStreamBase::start() missing endpoint");
+ result = AAUDIO_ERROR_INVALID_STATE;
+ goto error;
+ }
+
+ // Start with fresh presentation timestamps.
+ mAtomicTimestamp.clear();
+
+ mClientHandle = AUDIO_PORT_HANDLE_NONE;
+ result = startDevice();
+ if (result != AAUDIO_OK) goto error;
+
+ // This should happen at the end of the start.
sendServiceEvent(AAUDIO_SERVICE_EVENT_STARTED);
- mState = AAUDIO_STREAM_STATE_STARTED;
+ setState(AAUDIO_STREAM_STATE_STARTED);
mThreadEnabled.store(true);
- return mAAudioThread.start(this);
+ result = mTimestampThread.start(this);
+ if (result != AAUDIO_OK) goto error;
+
+ return result;
+
+error:
+ disconnect();
+ return result;
}
aaudio_result_t AAudioServiceStreamBase::pause() {
@@ -109,15 +198,25 @@
if (!isRunning()) {
return result;
}
+ if (mServiceEndpoint == nullptr) {
+ ALOGE("AAudioServiceStreamShared::pause() missing endpoint");
+ return AAUDIO_ERROR_INVALID_STATE;
+ }
+ result = mServiceEndpoint->stopStream(this, mClientHandle);
+ if (result != AAUDIO_OK) {
+ ALOGE("AAudioServiceStreamShared::pause() mServiceEndpoint returned %d", result);
+ disconnect(); // TODO should we return or pause Base first?
+ }
+
sendCurrentTimestamp();
mThreadEnabled.store(false);
- result = mAAudioThread.stop();
+ result = mTimestampThread.stop();
if (result != AAUDIO_OK) {
disconnect();
return result;
}
sendServiceEvent(AAUDIO_SERVICE_EVENT_PAUSED);
- mState = AAUDIO_STREAM_STATE_PAUSED;
+ setState(AAUDIO_STREAM_STATE_PAUSED);
return result;
}
@@ -126,15 +225,29 @@
if (!isRunning()) {
return result;
}
- // TODO wait for data to be played out
+
+ if (mServiceEndpoint == nullptr) {
+ ALOGE("AAudioServiceStreamShared::stop() missing endpoint");
+ return AAUDIO_ERROR_INVALID_STATE;
+ }
+
sendCurrentTimestamp(); // warning - this calls a virtual function
result = stopTimestampThread();
if (result != AAUDIO_OK) {
disconnect();
return result;
}
+
+ // TODO wait for data to be played out
+ result = mServiceEndpoint->stopStream(this, mClientHandle);
+ if (result != AAUDIO_OK) {
+ ALOGE("AAudioServiceStreamShared::stop() mServiceEndpoint returned %d", result);
+ disconnect();
+ // TODO what to do with result here?
+ }
+
sendServiceEvent(AAUDIO_SERVICE_EVENT_STOPPED);
- mState = AAUDIO_STREAM_STATE_STOPPED;
+ setState(AAUDIO_STREAM_STATE_STOPPED);
return result;
}
@@ -142,14 +255,20 @@
aaudio_result_t result = AAUDIO_OK;
// clear flag that tells thread to loop
if (mThreadEnabled.exchange(false)) {
- result = mAAudioThread.stop();
+ result = mTimestampThread.stop();
}
return result;
}
aaudio_result_t AAudioServiceStreamBase::flush() {
+ if (getState() != AAUDIO_STREAM_STATE_PAUSED) {
+ ALOGE("AAudioServiceStreamBase::flush() stream not paused, state = %s",
+ AAudio_convertStreamStateToText(mState));
+ return AAUDIO_ERROR_INVALID_STATE;
+ }
+ // Data will get flushed when the client receives the FLUSHED event.
sendServiceEvent(AAUDIO_SERVICE_EVENT_FLUSHED);
- mState = AAUDIO_STREAM_STATE_FLUSHED;
+ setState(AAUDIO_STREAM_STATE_FLUSHED);
return AAUDIO_OK;
}
@@ -157,7 +276,7 @@
void AAudioServiceStreamBase::run() {
ALOGD("AAudioServiceStreamBase::run() entering ----------------");
TimestampScheduler timestampScheduler;
- timestampScheduler.setBurstPeriod(mFramesPerBurst, mSampleRate);
+ timestampScheduler.setBurstPeriod(mFramesPerBurst, getSampleRate());
timestampScheduler.start(AudioClock::getNanoseconds());
int64_t nextTime = timestampScheduler.nextAbsoluteTime();
while(mThreadEnabled.load()) {
@@ -177,9 +296,9 @@
}
void AAudioServiceStreamBase::disconnect() {
- if (mState != AAUDIO_STREAM_STATE_DISCONNECTED) {
+ if (getState() != AAUDIO_STREAM_STATE_DISCONNECTED) {
sendServiceEvent(AAUDIO_SERVICE_EVENT_DISCONNECTED);
- mState = AAUDIO_STREAM_STATE_DISCONNECTED;
+ setState(AAUDIO_STREAM_STATE_DISCONNECTED);
}
}
@@ -195,7 +314,7 @@
}
aaudio_result_t AAudioServiceStreamBase::writeUpMessageQueue(AAudioServiceMessage *command) {
- std::lock_guard<std::mutex> lock(mLockUpMessageQueue);
+ std::lock_guard<std::mutex> lock(mUpMessageQueueLock);
if (mUpMessageQueue == nullptr) {
ALOGE("writeUpMessageQueue(): mUpMessageQueue null! - stream not open");
return AAUDIO_ERROR_NULL;
@@ -211,15 +330,31 @@
aaudio_result_t AAudioServiceStreamBase::sendCurrentTimestamp() {
AAudioServiceMessage command;
+ // Send a timestamp for the clock model.
aaudio_result_t result = getFreeRunningPosition(&command.timestamp.position,
&command.timestamp.timestamp);
if (result == AAUDIO_OK) {
- // ALOGD("sendCurrentTimestamp(): position = %lld, nanos = %lld",
- // (long long) command.timestamp.position,
- // (long long) command.timestamp.timestamp);
- command.what = AAudioServiceMessage::code::TIMESTAMP;
+ ALOGV("sendCurrentTimestamp() SERVICE %8lld at %lld",
+ (long long) command.timestamp.position,
+ (long long) command.timestamp.timestamp);
+ command.what = AAudioServiceMessage::code::TIMESTAMP_SERVICE;
result = writeUpMessageQueue(&command);
- } else if (result == AAUDIO_ERROR_UNAVAILABLE) {
+
+ if (result == AAUDIO_OK) {
+ // Send a hardware timestamp for presentation time.
+ result = getHardwareTimestamp(&command.timestamp.position,
+ &command.timestamp.timestamp);
+ if (result == AAUDIO_OK) {
+ ALOGV("sendCurrentTimestamp() HARDWARE %8lld at %lld",
+ (long long) command.timestamp.position,
+ (long long) command.timestamp.timestamp);
+ command.what = AAudioServiceMessage::code::TIMESTAMP_HARDWARE;
+ result = writeUpMessageQueue(&command);
+ }
+ }
+ }
+
+ if (result == AAUDIO_ERROR_UNAVAILABLE) { // TODO review best error code
result = AAUDIO_OK; // just not available yet, try again later
}
return result;
@@ -230,8 +365,19 @@
* used to communicate with the underlying HAL or Service.
*/
aaudio_result_t AAudioServiceStreamBase::getDescription(AudioEndpointParcelable &parcelable) {
- // Gather information on the message queue.
- mUpMessageQueue->fillParcelable(parcelable,
- parcelable.mUpMessageQueueParcelable);
- return getDownDataDescription(parcelable);
+ {
+ std::lock_guard<std::mutex> lock(mUpMessageQueueLock);
+ if (mUpMessageQueue == nullptr) {
+ ALOGE("getDescription(): mUpMessageQueue null! - stream not open");
+ return AAUDIO_ERROR_NULL;
+ }
+ // Gather information on the message queue.
+ mUpMessageQueue->fillParcelable(parcelable,
+ parcelable.mUpMessageQueueParcelable);
+ }
+ return getAudioDataDescription(parcelable);
+}
+
+void AAudioServiceStreamBase::onVolumeChanged(float volume) {
+ sendServiceEvent(AAUDIO_SERVICE_EVENT_VOLUME, volume);
}
diff --git a/services/oboeservice/AAudioServiceStreamBase.h b/services/oboeservice/AAudioServiceStreamBase.h
index cebefec..af435b4 100644
--- a/services/oboeservice/AAudioServiceStreamBase.h
+++ b/services/oboeservice/AAudioServiceStreamBase.h
@@ -20,6 +20,7 @@
#include <assert.h>
#include <mutex>
+#include <media/AudioClient.h>
#include <utils/RefBase.h>
#include "fifo/FifoBuffer.h"
@@ -27,71 +28,97 @@
#include "binding/AudioEndpointParcelable.h"
#include "binding/AAudioServiceMessage.h"
#include "utility/AAudioUtilities.h"
-#include <media/AudioClient.h>
+#include "utility/AudioClock.h"
#include "SharedRingBuffer.h"
#include "AAudioThread.h"
+namespace android {
+ class AAudioService;
+}
+
namespace aaudio {
+class AAudioServiceEndpoint;
+
// We expect the queue to only have a few commands.
// This should be way more than we need.
#define QUEUE_UP_CAPACITY_COMMANDS (128)
/**
- * Base class for a stream in the AAudio service.
+ * Each instance of AAudioServiceStreamBase corresponds to a client stream.
+ * It uses a subclass of AAudioServiceEndpoint to communicate with the underlying device or port.
*/
class AAudioServiceStreamBase
: public virtual android::RefBase
+ , public AAudioStreamParameters
, public Runnable {
public:
- AAudioServiceStreamBase();
+ AAudioServiceStreamBase(android::AAudioService &aAudioService);
+
virtual ~AAudioServiceStreamBase();
enum {
ILLEGAL_THREAD_ID = 0
};
- std::string dump() const;
+ static std::string dumpHeader();
+
+ // does not include EOL
+ virtual std::string dump() const;
// -------------------------------------------------------------------
/**
* Open the device.
*/
- virtual aaudio_result_t open(const aaudio::AAudioStreamRequest &request,
- aaudio::AAudioStreamConfiguration &configurationOutput) = 0;
+ virtual aaudio_result_t open(const aaudio::AAudioStreamRequest &request) = 0;
virtual aaudio_result_t close();
/**
- * Start the flow of data.
+ * Start the flow of audio data.
+ *
+ * This is not guaranteed to be synchronous but it currently is.
+ * An AAUDIO_SERVICE_EVENT_STARTED will be sent to the client when complete.
*/
virtual aaudio_result_t start();
/**
- * Stop the flow of data such that start() can resume with loss of data.
- */
+ * Stop the flow of data so that start() can resume without loss of data.
+ *
+ * This is not guaranteed to be synchronous but it currently is.
+ * An AAUDIO_SERVICE_EVENT_PAUSED will be sent to the client when complete.
+ */
virtual aaudio_result_t pause();
/**
- * Stop the flow of data after data in buffer has played.
+ * Stop the flow of data after the currently queued data has finished playing.
+ *
+ * This is not guaranteed to be synchronous but it currently is.
+ * An AAUDIO_SERVICE_EVENT_STOPPED will be sent to the client when complete.
+ *
*/
virtual aaudio_result_t stop();
aaudio_result_t stopTimestampThread();
/**
- * Discard any data held by the underlying HAL or Service.
+ * Discard any data held by the underlying HAL or Service.
+ *
+ * An AAUDIO_SERVICE_EVENT_FLUSHED will be sent to the client when complete.
*/
virtual aaudio_result_t flush();
+
virtual aaudio_result_t startClient(const android::AudioClient& client __unused,
audio_port_handle_t *clientHandle __unused) {
+ ALOGD("AAudioServiceStreamBase::startClient(%p, ...) AAUDIO_ERROR_UNAVAILABLE", &client);
return AAUDIO_ERROR_UNAVAILABLE;
}
virtual aaudio_result_t stopClient(audio_port_handle_t clientHandle __unused) {
+ ALOGD("AAudioServiceStreamBase::stopClient(%d) AAUDIO_ERROR_UNAVAILABLE", clientHandle);
return AAUDIO_ERROR_UNAVAILABLE;
}
@@ -126,14 +153,14 @@
return mFramesPerBurst;
}
- int32_t calculateBytesPerFrame() const {
- return mSamplesPerFrame * AAudioConvert_formatToSizeInBytes(mAudioFormat);
- }
-
void run() override; // to implement Runnable
void disconnect();
+ const android::AudioClient &getAudioClient() {
+ return mMmapClient;
+ }
+
uid_t getOwnerUserId() const {
return mMmapClient.clientUid;
}
@@ -153,12 +180,26 @@
return mState;
}
+ void onVolumeChanged(float volume);
+
protected:
+ /**
+ * Open the device.
+ */
+ aaudio_result_t open(const aaudio::AAudioStreamRequest &request,
+ aaudio_sharing_mode_t sharingMode);
+
void setState(aaudio_stream_state_t state) {
mState = state;
}
+ /**
+ * Device specific startup.
+ * @return AAUDIO_OK or negative error.
+ */
+ virtual aaudio_result_t startDevice();
+
aaudio_result_t writeUpMessageQueue(AAudioServiceMessage *command);
aaudio_result_t sendCurrentTimestamp();
@@ -170,27 +211,30 @@
*/
virtual aaudio_result_t getFreeRunningPosition(int64_t *positionFrames, int64_t *timeNanos) = 0;
- virtual aaudio_result_t getDownDataDescription(AudioEndpointParcelable &parcelable) = 0;
+ virtual aaudio_result_t getHardwareTimestamp(int64_t *positionFrames, int64_t *timeNanos) = 0;
+
+ virtual aaudio_result_t getAudioDataDescription(AudioEndpointParcelable &parcelable) = 0;
aaudio_stream_state_t mState = AAUDIO_STREAM_STATE_UNINITIALIZED;
pid_t mRegisteredClientThread = ILLEGAL_THREAD_ID;
SharedRingBuffer* mUpMessageQueue;
- std::mutex mLockUpMessageQueue;
+ std::mutex mUpMessageQueueLock;
- AAudioThread mAAudioThread;
+ AAudioThread mTimestampThread;
// This is used by one thread to tell another thread to exit. So it must be atomic.
- std::atomic<bool> mThreadEnabled;
+ std::atomic<bool> mThreadEnabled{false};
- aaudio_format_t mAudioFormat = AAUDIO_FORMAT_UNSPECIFIED;
int32_t mFramesPerBurst = 0;
- int32_t mSamplesPerFrame = AAUDIO_UNSPECIFIED;
- int32_t mSampleRate = AAUDIO_UNSPECIFIED;
- int32_t mCapacityInFrames = AAUDIO_UNSPECIFIED;
- android::AudioClient mMmapClient;
+ android::AudioClient mMmapClient; // set in open, used in MMAP start()
audio_port_handle_t mClientHandle = AUDIO_PORT_HANDLE_NONE;
+ SimpleDoubleBuffer<Timestamp> mAtomicTimestamp;
+
+ android::AAudioService &mAudioService;
+ android::sp<AAudioServiceEndpoint> mServiceEndpoint;
+
private:
aaudio_handle_t mHandle = -1;
};
diff --git a/services/oboeservice/AAudioServiceStreamMMAP.cpp b/services/oboeservice/AAudioServiceStreamMMAP.cpp
index 08dd680..44ba1ca 100644
--- a/services/oboeservice/AAudioServiceStreamMMAP.cpp
+++ b/services/oboeservice/AAudioServiceStreamMMAP.cpp
@@ -19,225 +19,76 @@
#include <utils/Log.h>
#include <atomic>
+#include <iomanip>
+#include <iostream>
#include <stdint.h>
#include <utils/String16.h>
#include <media/nbaio/AudioStreamOutSink.h>
#include <media/MmapStreamInterface.h>
+#include "binding/AudioEndpointParcelable.h"
+#include "utility/AAudioUtilities.h"
+
+#include "AAudioServiceEndpointMMAP.h"
#include "AAudioServiceStreamBase.h"
#include "AAudioServiceStreamMMAP.h"
-#include "binding/AudioEndpointParcelable.h"
#include "SharedMemoryProxy.h"
-#include "utility/AAudioUtilities.h"
using android::base::unique_fd;
using namespace android;
using namespace aaudio;
-#define AAUDIO_BUFFER_CAPACITY_MIN 4 * 512
-#define AAUDIO_SAMPLE_RATE_DEFAULT 48000
-
/**
* Service Stream that uses an MMAP buffer.
*/
-AAudioServiceStreamMMAP::AAudioServiceStreamMMAP(const android::AudioClient& serviceClient,
+AAudioServiceStreamMMAP::AAudioServiceStreamMMAP(android::AAudioService &aAudioService,
bool inService)
- : AAudioServiceStreamBase()
- , mMmapStreamCallback(new MyMmapStreamCallback(*this))
- , mPreviousFrameCounter(0)
- , mMmapStream(nullptr)
- , mServiceClient(serviceClient)
+ : AAudioServiceStreamBase(aAudioService)
, mInService(inService) {
}
aaudio_result_t AAudioServiceStreamMMAP::close() {
- if (mState == AAUDIO_STREAM_STATE_CLOSED) {
+ if (getState() == AAUDIO_STREAM_STATE_CLOSED) {
return AAUDIO_OK;
}
+
stop();
- if (mMmapStream != 0) {
- mMmapStream.clear(); // TODO review. Is that all we have to do?
- // Apparently the above close is asynchronous. An attempt to open a new device
- // right after a close can fail. Also some callbacks may still be in flight!
- // FIXME Make closing synchronous.
- AudioClock::sleepForNanos(100 * AAUDIO_NANOS_PER_MILLISECOND);
- }
return AAudioServiceStreamBase::close();
}
// Open stream on HAL and pass information about the shared memory buffer back to the client.
-aaudio_result_t AAudioServiceStreamMMAP::open(const aaudio::AAudioStreamRequest &request,
- aaudio::AAudioStreamConfiguration &configurationOutput) {
- const audio_attributes_t attributes = {
- .content_type = AUDIO_CONTENT_TYPE_MUSIC,
- .usage = AUDIO_USAGE_MEDIA,
- .source = AUDIO_SOURCE_VOICE_RECOGNITION,
- .flags = AUDIO_FLAG_LOW_LATENCY,
- .tags = ""
- };
- audio_config_base_t config;
+aaudio_result_t AAudioServiceStreamMMAP::open(const aaudio::AAudioStreamRequest &request) {
- aaudio_result_t result = AAudioServiceStreamBase::open(request, configurationOutput);
+ sp<AAudioServiceStreamMMAP> keep(this);
+
+ aaudio_result_t result = AAudioServiceStreamBase::open(request,
+ AAUDIO_SHARING_MODE_EXCLUSIVE);
if (result != AAUDIO_OK) {
- ALOGE("AAudioServiceStreamBase open returned %d", result);
return result;
}
- const AAudioStreamConfiguration &configurationInput = request.getConstantConfiguration();
- audio_port_handle_t deviceId = configurationInput.getDeviceId();
- aaudio_direction_t direction = request.getDirection();
-
- // Fill in config
- aaudio_format_t aaudioFormat = configurationInput.getFormat();
- if (aaudioFormat == AAUDIO_UNSPECIFIED || aaudioFormat == AAUDIO_FORMAT_PCM_FLOAT) {
- aaudioFormat = AAUDIO_FORMAT_PCM_I16;
+ result = mServiceEndpoint->registerStream(keep);
+ if (result != AAUDIO_OK) {
+ goto error;
}
- config.format = AAudioConvert_aaudioToAndroidDataFormat(aaudioFormat);
-
- int32_t aaudioSampleRate = configurationInput.getSampleRate();
- if (aaudioSampleRate == AAUDIO_UNSPECIFIED) {
- aaudioSampleRate = AAUDIO_SAMPLE_RATE_DEFAULT;
- }
- config.sample_rate = aaudioSampleRate;
-
- int32_t aaudioSamplesPerFrame = configurationInput.getSamplesPerFrame();
-
- if (direction == AAUDIO_DIRECTION_OUTPUT) {
- config.channel_mask = (aaudioSamplesPerFrame == AAUDIO_UNSPECIFIED)
- ? AUDIO_CHANNEL_OUT_STEREO
- : audio_channel_out_mask_from_count(aaudioSamplesPerFrame);
- } else if (direction == AAUDIO_DIRECTION_INPUT) {
- config.channel_mask = (aaudioSamplesPerFrame == AAUDIO_UNSPECIFIED)
- ? AUDIO_CHANNEL_IN_STEREO
- : audio_channel_in_mask_from_count(aaudioSamplesPerFrame);
- } else {
- ALOGE("openMmapStream - invalid direction = %d", direction);
- return AAUDIO_ERROR_ILLEGAL_ARGUMENT;
- }
-
- MmapStreamInterface::stream_direction_t streamDirection = (direction == AAUDIO_DIRECTION_OUTPUT)
- ? MmapStreamInterface::DIRECTION_OUTPUT : MmapStreamInterface::DIRECTION_INPUT;
-
- // Open HAL stream.
- status_t status = MmapStreamInterface::openMmapStream(streamDirection,
- &attributes,
- &config,
- mMmapClient,
- &deviceId,
- mMmapStreamCallback,
- mMmapStream,
- &mPortHandle);
- if (status != OK) {
- ALOGE("openMmapStream returned status %d", status);
- return AAUDIO_ERROR_UNAVAILABLE;
- }
-
- if (deviceId == AAUDIO_UNSPECIFIED) {
- ALOGW("AAudioServiceStreamMMAP::open() - openMmapStream() failed to set deviceId");
- }
-
- // Create MMAP/NOIRQ buffer.
- int32_t minSizeFrames = configurationInput.getBufferCapacity();
- if (minSizeFrames <= 0) { // zero will get rejected
- minSizeFrames = AAUDIO_BUFFER_CAPACITY_MIN;
- }
- status = mMmapStream->createMmapBuffer(minSizeFrames, &mMmapBufferinfo);
- if (status != OK) {
- ALOGE("AAudioServiceStreamMMAP::open() - createMmapBuffer() returned status %d",
- status);
- return AAUDIO_ERROR_UNAVAILABLE;
- } else {
- ALOGD("createMmapBuffer status = %d, buffer_size = %d, burst_size %d"
- ", Sharable FD: %s",
- status,
- abs(mMmapBufferinfo.buffer_size_frames),
- mMmapBufferinfo.burst_size_frames,
- mMmapBufferinfo.buffer_size_frames < 0 ? "Yes" : "No");
- }
-
- mCapacityInFrames = mMmapBufferinfo.buffer_size_frames;
- // FIXME: the audio HAL indicates if the shared memory fd can be shared outside of audioserver
- // by returning a negative buffer size
- if (mCapacityInFrames < 0) {
- // Exclusive mode is possible from any client
- mCapacityInFrames = -mCapacityInFrames;
- } else {
- // exclusive mode is only possible if the final fd destination is inside audioserver
- if ((mMmapClient.clientUid != mServiceClient.clientUid) &&
- configurationInput.getSharingMode() == AAUDIO_SHARING_MODE_EXCLUSIVE) {
- // Fallback is handled by caller but indicate what is possible in case
- // this is used in the future
- configurationOutput.setSharingMode(AAUDIO_SHARING_MODE_SHARED);
- return AAUDIO_ERROR_UNAVAILABLE;
- }
- }
-
- // Get information about the stream and pass it back to the caller.
- mSamplesPerFrame = (direction == AAUDIO_DIRECTION_OUTPUT)
- ? audio_channel_count_from_out_mask(config.channel_mask)
- : audio_channel_count_from_in_mask(config.channel_mask);
-
- // AAudio creates a copy of this FD and retains ownership of the copy.
- // Assume that AudioFlinger will close the original shared_memory_fd.
- mAudioDataFileDescriptor.reset(dup(mMmapBufferinfo.shared_memory_fd));
- if (mAudioDataFileDescriptor.get() == -1) {
- ALOGE("AAudioServiceStreamMMAP::open() - could not dup shared_memory_fd");
- return AAUDIO_ERROR_INTERNAL; // TODO review
- }
- mFramesPerBurst = mMmapBufferinfo.burst_size_frames;
- mAudioFormat = AAudioConvert_androidToAAudioDataFormat(config.format);
- mSampleRate = config.sample_rate;
-
- // Scale up the burst size to meet the minimum equivalent in microseconds.
- // This is to avoid waking the CPU too often when the HW burst is very small
- // or at high sample rates.
- int32_t burstMinMicros = AAudioProperty_getHardwareBurstMinMicros();
- int32_t burstMicros = 0;
- do {
- if (burstMicros > 0) { // skip first loop
- mFramesPerBurst *= 2;
- }
- burstMicros = mFramesPerBurst * static_cast<int64_t>(1000000) / mSampleRate;
- } while (burstMicros < burstMinMicros);
-
- ALOGD("AAudioServiceStreamMMAP::open() original burst = %d, minMicros = %d, final burst = %d\n",
- mMmapBufferinfo.burst_size_frames, burstMinMicros, mFramesPerBurst);
-
- ALOGD("AAudioServiceStreamMMAP::open() actual rate = %d, channels = %d, deviceId = %d\n",
- mSampleRate, mSamplesPerFrame, deviceId);
-
- // Fill in AAudioStreamConfiguration
- configurationOutput.setSampleRate(mSampleRate);
- configurationOutput.setSamplesPerFrame(mSamplesPerFrame);
- configurationOutput.setFormat(mAudioFormat);
- configurationOutput.setDeviceId(deviceId);
setState(AAUDIO_STREAM_STATE_OPEN);
+
+error:
return AAUDIO_OK;
}
/**
* Start the flow of data.
*/
-aaudio_result_t AAudioServiceStreamMMAP::start() {
- if (isRunning()) {
- return AAUDIO_OK;
- }
- if (mMmapStream == nullptr) return AAUDIO_ERROR_NULL;
- aaudio_result_t result;
- status_t status = mMmapStream->start(mServiceClient, &mPortHandle);
- if (status != OK) {
- ALOGE("AAudioServiceStreamMMAP::start() mMmapStream->start() returned %d", status);
- disconnect();
- result = AAudioConvert_androidToAAudioResult(status);
- } else {
- result = AAudioServiceStreamBase::start();
- if (!mInService && result == AAUDIO_OK) {
- startClient(mMmapClient, &mClientHandle);
- }
+aaudio_result_t AAudioServiceStreamMMAP::startDevice() {
+ aaudio_result_t result = AAudioServiceStreamBase::startDevice();
+ if (!mInService && result == AAUDIO_OK) {
+ // Note that this can sometimes take 200 to 300 msec for a cold start!
+ result = startClient(mMmapClient, &mClientHandle);
}
return result;
}
@@ -249,104 +100,78 @@
if (!isRunning()) {
return AAUDIO_OK;
}
- if (mMmapStream == nullptr) return AAUDIO_ERROR_NULL;
- aaudio_result_t result1 = AAudioServiceStreamBase::pause();
+ aaudio_result_t result = AAudioServiceStreamBase::pause();
+ // TODO put before base::pause()?
if (!mInService) {
- stopClient(mClientHandle);
+ (void) stopClient(mClientHandle);
}
- status_t status = mMmapStream->stop(mPortHandle);
- mFramesRead.reset32();
- return (result1 != AAUDIO_OK) ? result1 : AAudioConvert_androidToAAudioResult(status);
+ return result;
}
aaudio_result_t AAudioServiceStreamMMAP::stop() {
if (!isRunning()) {
return AAUDIO_OK;
}
- if (mMmapStream == nullptr) return AAUDIO_ERROR_NULL;
- aaudio_result_t result1 = AAudioServiceStreamBase::stop();
+ aaudio_result_t result = AAudioServiceStreamBase::stop();
+ // TODO put before base::stop()?
if (!mInService) {
- stopClient(mClientHandle);
- }
- aaudio_result_t status = mMmapStream->stop(mPortHandle);
- mFramesRead.reset32();
- return (result1 != AAUDIO_OK) ? result1 : AAudioConvert_androidToAAudioResult(status);
-}
-
-/**
- * Discard any data held by the underlying HAL or Service.
- */
-aaudio_result_t AAudioServiceStreamMMAP::flush() {
- if (mMmapStream == nullptr) return AAUDIO_ERROR_NULL;
- // TODO how do we flush an MMAP/NOIRQ buffer? sync pointers?
- return AAudioServiceStreamBase::flush();;
-}
-
-aaudio_result_t AAudioServiceStreamMMAP::startClient(const android::AudioClient& client,
- audio_port_handle_t *clientHandle) {
- return AAudioConvert_androidToAAudioResult(mMmapStream->start(client, clientHandle));
-}
-
-aaudio_result_t AAudioServiceStreamMMAP::stopClient(audio_port_handle_t clientHandle) {
- return AAudioConvert_androidToAAudioResult(mMmapStream->stop(clientHandle));
-}
-
-aaudio_result_t AAudioServiceStreamMMAP::getFreeRunningPosition(int64_t *positionFrames,
- int64_t *timeNanos) {
- struct audio_mmap_position position;
- if (mMmapStream == nullptr) {
- disconnect();
- return AAUDIO_ERROR_NULL;
- }
- status_t status = mMmapStream->getMmapPosition(&position);
- aaudio_result_t result = AAudioConvert_androidToAAudioResult(status);
- if (result == AAUDIO_ERROR_UNAVAILABLE) {
- ALOGW("sendCurrentTimestamp(): getMmapPosition() has no position data yet");
- } else if (result != AAUDIO_OK) {
- ALOGE("sendCurrentTimestamp(): getMmapPosition() returned status %d", status);
- disconnect();
- } else {
- mFramesRead.update32(position.position_frames);
- *positionFrames = mFramesRead.get();
- *timeNanos = position.time_nanoseconds;
+ (void) stopClient(mClientHandle);
}
return result;
}
-void AAudioServiceStreamMMAP::onTearDown() {
- ALOGD("AAudioServiceStreamMMAP::onTearDown() called");
- disconnect();
-};
+aaudio_result_t AAudioServiceStreamMMAP::startClient(const android::AudioClient& client,
+ audio_port_handle_t *clientHandle) {
+ // Start the client on behalf of the application. Generate a new porthandle.
+ aaudio_result_t result = mServiceEndpoint->startClient(client, clientHandle);
+ return result;
+}
-void AAudioServiceStreamMMAP::onVolumeChanged(audio_channel_mask_t channels,
- android::Vector<float> values) {
- // TODO do we really need a different volume for each channel?
- float volume = values[0];
- ALOGD("AAudioServiceStreamMMAP::onVolumeChanged() volume[0] = %f", volume);
- sendServiceEvent(AAUDIO_SERVICE_EVENT_VOLUME, volume);
-};
+aaudio_result_t AAudioServiceStreamMMAP::stopClient(audio_port_handle_t clientHandle) {
+ aaudio_result_t result = mServiceEndpoint->stopClient(clientHandle);
+ return result;
+}
-void AAudioServiceStreamMMAP::onRoutingChanged(audio_port_handle_t deviceId) {
- ALOGD("AAudioServiceStreamMMAP::onRoutingChanged() called with %d, old = %d",
- deviceId, mDeviceId);
- if (mDeviceId != AUDIO_PORT_HANDLE_NONE && mDeviceId != deviceId) {
+// Get free-running DSP or DMA hardware position from the HAL.
+aaudio_result_t AAudioServiceStreamMMAP::getFreeRunningPosition(int64_t *positionFrames,
+ int64_t *timeNanos) {
+ sp<AAudioServiceEndpointMMAP> serviceEndpointMMAP{
+ static_cast<AAudioServiceEndpointMMAP *>(mServiceEndpoint.get())};
+ aaudio_result_t result = serviceEndpointMMAP->getFreeRunningPosition(positionFrames, timeNanos);
+ if (result == AAUDIO_OK) {
+ Timestamp timestamp(*positionFrames, *timeNanos);
+ mAtomicTimestamp.write(timestamp);
+ *positionFrames = timestamp.getPosition();
+ *timeNanos = timestamp.getNanoseconds();
+ } else if (result != AAUDIO_ERROR_UNAVAILABLE) {
disconnect();
}
- mDeviceId = deviceId;
-};
+ return result;
+}
+
+// Get timestamp that was written by getFreeRunningPosition()
+aaudio_result_t AAudioServiceStreamMMAP::getHardwareTimestamp(int64_t *positionFrames,
+ int64_t *timeNanos) {
+ sp<AAudioServiceEndpointMMAP> serviceEndpointMMAP{
+ static_cast<AAudioServiceEndpointMMAP *>(mServiceEndpoint.get())};
+ // TODO Get presentation timestamp from the HAL
+ if (mAtomicTimestamp.isValid()) {
+ Timestamp timestamp = mAtomicTimestamp.read();
+ *positionFrames = timestamp.getPosition();
+ *timeNanos = timestamp.getNanoseconds() + serviceEndpointMMAP->getHardwareTimeOffsetNanos();
+ return AAUDIO_OK;
+ } else {
+ return AAUDIO_ERROR_UNAVAILABLE;
+ }
+}
/**
* Get an immutable description of the data queue from the HAL.
*/
-aaudio_result_t AAudioServiceStreamMMAP::getDownDataDescription(AudioEndpointParcelable &parcelable)
+aaudio_result_t AAudioServiceStreamMMAP::getAudioDataDescription(
+ AudioEndpointParcelable &parcelable)
{
- // Gather information on the data queue based on HAL info.
- int32_t bytesPerFrame = calculateBytesPerFrame();
- int32_t capacityInBytes = mCapacityInFrames * bytesPerFrame;
- int fdIndex = parcelable.addFileDescriptor(mAudioDataFileDescriptor, capacityInBytes);
- parcelable.mDownDataQueueParcelable.setupMemory(fdIndex, 0, capacityInBytes);
- parcelable.mDownDataQueueParcelable.setBytesPerFrame(bytesPerFrame);
- parcelable.mDownDataQueueParcelable.setFramesPerBurst(mFramesPerBurst);
- parcelable.mDownDataQueueParcelable.setCapacityInFrames(mCapacityInFrames);
- return AAUDIO_OK;
+ sp<AAudioServiceEndpointMMAP> serviceEndpointMMAP{
+ static_cast<AAudioServiceEndpointMMAP *>(mServiceEndpoint.get())};
+ return serviceEndpointMMAP->getDownDataDescription(parcelable);
}
diff --git a/services/oboeservice/AAudioServiceStreamMMAP.h b/services/oboeservice/AAudioServiceStreamMMAP.h
index b69dc46..e2415d0 100644
--- a/services/oboeservice/AAudioServiceStreamMMAP.h
+++ b/services/oboeservice/AAudioServiceStreamMMAP.h
@@ -37,27 +37,20 @@
namespace aaudio {
- /**
- * Manage one memory mapped buffer that originated from a HAL.
- */
-class AAudioServiceStreamMMAP
- : public AAudioServiceStreamBase
- , public android::MmapStreamCallback {
+
+/**
+ * These corresponds to an EXCLUSIVE mode MMAP client stream.
+ * It has exclusive use of one AAudioServiceEndpointMMAP to communicate with the underlying
+ * device or port.
+ */
+class AAudioServiceStreamMMAP : public AAudioServiceStreamBase {
public:
- AAudioServiceStreamMMAP(const android::AudioClient& serviceClient, bool inService);
+ AAudioServiceStreamMMAP(android::AAudioService &aAudioService,
+ bool inService);
virtual ~AAudioServiceStreamMMAP() = default;
- aaudio_result_t open(const aaudio::AAudioStreamRequest &request,
- aaudio::AAudioStreamConfiguration &configurationOutput) override;
-
- /**
- * Start the flow of audio data.
- *
- * This is not guaranteed to be synchronous but it currently is.
- * An AAUDIO_SERVICE_EVENT_STARTED will be sent to the client when complete.
- */
- aaudio_result_t start() override;
+ aaudio_result_t open(const aaudio::AAudioStreamRequest &request) override;
/**
* Stop the flow of data so that start() can resume without loss of data.
@@ -69,79 +62,34 @@
aaudio_result_t stop() override;
- /**
- * Discard any data held by the underlying HAL or Service.
- *
- * This is not guaranteed to be synchronous but it currently is.
- * An AAUDIO_SERVICE_EVENT_FLUSHED will be sent to the client when complete.
- */
- aaudio_result_t flush() override;
+ aaudio_result_t startClient(const android::AudioClient& client,
+ audio_port_handle_t *clientHandle) override;
+
+ aaudio_result_t stopClient(audio_port_handle_t clientHandle) override;
aaudio_result_t close() override;
- virtual aaudio_result_t startClient(const android::AudioClient& client,
- audio_port_handle_t *clientHandle);
-
- virtual aaudio_result_t stopClient(audio_port_handle_t clientHandle);
-
/**
* Send a MMAP/NOIRQ buffer timestamp to the client.
*/
- aaudio_result_t sendCurrentTimestamp();
-
- // -------------- Callback functions ---------------------
- void onTearDown() override;
-
- void onVolumeChanged(audio_channel_mask_t channels,
- android::Vector<float> values) override;
-
- void onRoutingChanged(audio_port_handle_t deviceId) override;
protected:
- aaudio_result_t getDownDataDescription(AudioEndpointParcelable &parcelable) override;
+ aaudio_result_t getAudioDataDescription(AudioEndpointParcelable &parcelable) override;
aaudio_result_t getFreeRunningPosition(int64_t *positionFrames, int64_t *timeNanos) override;
+ aaudio_result_t getHardwareTimestamp(int64_t *positionFrames, int64_t *timeNanos) override;
+
+ /**
+ * Device specific startup.
+ * @return AAUDIO_OK or negative error.
+ */
+ aaudio_result_t startDevice() override;
+
private:
- // This proxy class was needed to prevent a crash in AudioFlinger
- // when the stream was closed.
- class MyMmapStreamCallback : public android::MmapStreamCallback {
- public:
- explicit MyMmapStreamCallback(android::MmapStreamCallback &serviceCallback)
- : mServiceCallback(serviceCallback){}
- virtual ~MyMmapStreamCallback() = default;
- void onTearDown() override {
- mServiceCallback.onTearDown();
- };
-
- void onVolumeChanged(audio_channel_mask_t channels, android::Vector<float> values) override
- {
- mServiceCallback.onVolumeChanged(channels, values);
- };
-
- void onRoutingChanged(audio_port_handle_t deviceId) override {
- mServiceCallback.onRoutingChanged(deviceId);
- };
-
- private:
- android::MmapStreamCallback &mServiceCallback;
- };
-
- android::sp<MyMmapStreamCallback> mMmapStreamCallback;
- MonotonicCounter mFramesWritten;
- MonotonicCounter mFramesRead;
- int32_t mPreviousFrameCounter = 0; // from HAL
-
- // Interface to the AudioFlinger MMAP support.
- android::sp<android::MmapStreamInterface> mMmapStream;
- struct audio_mmap_buffer_info mMmapBufferinfo;
- audio_port_handle_t mPortHandle = AUDIO_PORT_HANDLE_NONE;
- audio_port_handle_t mDeviceId = AUDIO_PORT_HANDLE_NONE;
- android::AudioClient mServiceClient;
- bool mInService = false;
- android::base::unique_fd mAudioDataFileDescriptor;
+ bool mInService = false;
};
} // namespace aaudio
diff --git a/services/oboeservice/AAudioServiceStreamShared.cpp b/services/oboeservice/AAudioServiceStreamShared.cpp
index 5654113..084f996 100644
--- a/services/oboeservice/AAudioServiceStreamShared.cpp
+++ b/services/oboeservice/AAudioServiceStreamShared.cpp
@@ -18,6 +18,8 @@
//#define LOG_NDEBUG 0
#include <utils/Log.h>
+#include <iomanip>
+#include <iostream>
#include <mutex>
#include <aaudio/AAudio.h>
@@ -40,8 +42,32 @@
#define MAX_FRAMES_PER_BUFFER (32 * 1024)
AAudioServiceStreamShared::AAudioServiceStreamShared(AAudioService &audioService)
- : mAudioService(audioService)
- {
+ : AAudioServiceStreamBase(audioService)
+ , mTimestampPositionOffset(0)
+ , mXRunCount(0) {
+}
+
+std::string AAudioServiceStreamShared::dumpHeader() {
+ std::stringstream result;
+ result << AAudioServiceStreamBase::dumpHeader();
+ result << " Write# Read# Avail XRuns";
+ return result.str();
+}
+
+std::string AAudioServiceStreamShared::dump() const {
+ std::stringstream result;
+
+ result << AAudioServiceStreamBase::dump();
+
+ auto fifo = mAudioDataQueue->getFifoBuffer();
+ int32_t readCounter = fifo->getReadCounter();
+ int32_t writeCounter = fifo->getWriteCounter();
+ result << std::setw(10) << writeCounter;
+ result << std::setw(10) << readCounter;
+ result << std::setw(8) << (writeCounter - readCounter);
+ result << std::setw(8) << getXRunCount();
+
+ return result.str();
}
int32_t AAudioServiceStreamShared::calculateBufferCapacity(int32_t requestedCapacityFrames,
@@ -90,87 +116,72 @@
return capacityInFrames;
}
-aaudio_result_t AAudioServiceStreamShared::open(const aaudio::AAudioStreamRequest &request,
- aaudio::AAudioStreamConfiguration &configurationOutput) {
+aaudio_result_t AAudioServiceStreamShared::open(const aaudio::AAudioStreamRequest &request) {
sp<AAudioServiceStreamShared> keep(this);
- aaudio_result_t result = AAudioServiceStreamBase::open(request, configurationOutput);
+ aaudio_result_t result = AAudioServiceStreamBase::open(request, AAUDIO_SHARING_MODE_SHARED);
if (result != AAUDIO_OK) {
ALOGE("AAudioServiceStreamBase open() returned %d", result);
return result;
}
const AAudioStreamConfiguration &configurationInput = request.getConstantConfiguration();
- aaudio_direction_t direction = request.getDirection();
- AAudioEndpointManager &mEndpointManager = AAudioEndpointManager::getInstance();
- mServiceEndpoint = mEndpointManager.openEndpoint(mAudioService, configurationOutput, direction);
- if (mServiceEndpoint == nullptr) {
- ALOGE("AAudioServiceStreamShared::open() mServiceEndPoint = %p", mServiceEndpoint);
- return AAUDIO_ERROR_UNAVAILABLE;
- }
// Is the request compatible with the shared endpoint?
- mAudioFormat = configurationInput.getFormat();
- if (mAudioFormat == AAUDIO_FORMAT_UNSPECIFIED) {
- mAudioFormat = AAUDIO_FORMAT_PCM_FLOAT;
- } else if (mAudioFormat != AAUDIO_FORMAT_PCM_FLOAT) {
- ALOGE("AAudioServiceStreamShared::open() mAudioFormat = %d, need FLOAT", mAudioFormat);
+ setFormat(configurationInput.getFormat());
+ if (getFormat() == AAUDIO_FORMAT_UNSPECIFIED) {
+ setFormat(AAUDIO_FORMAT_PCM_FLOAT);
+ } else if (getFormat() != AAUDIO_FORMAT_PCM_FLOAT) {
+ ALOGE("AAudioServiceStreamShared::open() mAudioFormat = %d, need FLOAT", getFormat());
result = AAUDIO_ERROR_INVALID_FORMAT;
goto error;
}
- mSampleRate = configurationInput.getSampleRate();
- if (mSampleRate == AAUDIO_UNSPECIFIED) {
- mSampleRate = mServiceEndpoint->getSampleRate();
- } else if (mSampleRate != mServiceEndpoint->getSampleRate()) {
+ setSampleRate(configurationInput.getSampleRate());
+ if (getSampleRate() == AAUDIO_UNSPECIFIED) {
+ setSampleRate(mServiceEndpoint->getSampleRate());
+ } else if (getSampleRate() != mServiceEndpoint->getSampleRate()) {
ALOGE("AAudioServiceStreamShared::open() mSampleRate = %d, need %d",
- mSampleRate, mServiceEndpoint->getSampleRate());
+ getSampleRate(), mServiceEndpoint->getSampleRate());
result = AAUDIO_ERROR_INVALID_RATE;
goto error;
}
- mSamplesPerFrame = configurationInput.getSamplesPerFrame();
- if (mSamplesPerFrame == AAUDIO_UNSPECIFIED) {
- mSamplesPerFrame = mServiceEndpoint->getSamplesPerFrame();
- } else if (mSamplesPerFrame != mServiceEndpoint->getSamplesPerFrame()) {
+ setSamplesPerFrame(configurationInput.getSamplesPerFrame());
+ if (getSamplesPerFrame() == AAUDIO_UNSPECIFIED) {
+ setSamplesPerFrame(mServiceEndpoint->getSamplesPerFrame());
+ } else if (getSamplesPerFrame() != mServiceEndpoint->getSamplesPerFrame()) {
ALOGE("AAudioServiceStreamShared::open() mSamplesPerFrame = %d, need %d",
- mSamplesPerFrame, mServiceEndpoint->getSamplesPerFrame());
+ getSamplesPerFrame(), mServiceEndpoint->getSamplesPerFrame());
result = AAUDIO_ERROR_OUT_OF_RANGE;
goto error;
}
- mFramesPerBurst = mServiceEndpoint->getFramesPerBurst();
- ALOGD("AAudioServiceStreamShared::open() mSampleRate = %d, mFramesPerBurst = %d",
- mSampleRate, mFramesPerBurst);
-
- mCapacityInFrames = calculateBufferCapacity(configurationInput.getBufferCapacity(),
- mFramesPerBurst);
- if (mCapacityInFrames < 0) {
- result = mCapacityInFrames; // negative error code
- mCapacityInFrames = 0;
+ setBufferCapacity(calculateBufferCapacity(configurationInput.getBufferCapacity(),
+ mFramesPerBurst));
+ if (getBufferCapacity() < 0) {
+ result = getBufferCapacity(); // negative error code
+ setBufferCapacity(0);
goto error;
}
- // Create audio data shared memory buffer for client.
- mAudioDataQueue = new SharedRingBuffer();
- result = mAudioDataQueue->allocate(calculateBytesPerFrame(), mCapacityInFrames);
- if (result != AAUDIO_OK) {
- ALOGE("AAudioServiceStreamShared::open() could not allocate FIFO with %d frames",
- mCapacityInFrames);
- result = AAUDIO_ERROR_NO_MEMORY;
- goto error;
+ {
+ std::lock_guard<std::mutex> lock(mAudioDataQueueLock);
+ // Create audio data shared memory buffer for client.
+ mAudioDataQueue = new SharedRingBuffer();
+ result = mAudioDataQueue->allocate(calculateBytesPerFrame(), getBufferCapacity());
+ if (result != AAUDIO_OK) {
+ ALOGE("AAudioServiceStreamShared::open() could not allocate FIFO with %d frames",
+ getBufferCapacity());
+ result = AAUDIO_ERROR_NO_MEMORY;
+ goto error;
+ }
}
ALOGD("AAudioServiceStreamShared::open() actual rate = %d, channels = %d, deviceId = %d",
- mSampleRate, mSamplesPerFrame, mServiceEndpoint->getDeviceId());
-
- // Fill in configuration for client.
- configurationOutput.setSampleRate(mSampleRate);
- configurationOutput.setSamplesPerFrame(mSamplesPerFrame);
- configurationOutput.setFormat(mAudioFormat);
- configurationOutput.setDeviceId(mServiceEndpoint->getDeviceId());
+ getSampleRate(), getSamplesPerFrame(), mServiceEndpoint->getDeviceId());
result = mServiceEndpoint->registerStream(keep);
if (result != AAUDIO_OK) {
@@ -185,121 +196,30 @@
return result;
}
-/**
- * Start the flow of audio data.
- *
- * An AAUDIO_SERVICE_EVENT_STARTED will be sent to the client when complete.
- */
-aaudio_result_t AAudioServiceStreamShared::start() {
- if (isRunning()) {
- return AAUDIO_OK;
- }
- AAudioServiceEndpoint *endpoint = mServiceEndpoint;
- if (endpoint == nullptr) {
- return AAUDIO_ERROR_INVALID_STATE;
- }
- // For output streams, this will add the stream to the mixer.
- aaudio_result_t result = endpoint->startStream(this);
- if (result != AAUDIO_OK) {
- ALOGE("AAudioServiceStreamShared::start() mServiceEndpoint returned %d", result);
- disconnect();
- } else {
- result = endpoint->getStreamInternal()->startClient(mMmapClient, &mClientHandle);
- if (result == AAUDIO_OK) {
- result = AAudioServiceStreamBase::start();
- }
- }
- return result;
-}
-
-/**
- * Stop the flow of data so that start() can resume without loss of data.
- *
- * An AAUDIO_SERVICE_EVENT_PAUSED will be sent to the client when complete.
-*/
-aaudio_result_t AAudioServiceStreamShared::pause() {
- if (!isRunning()) {
- return AAUDIO_OK;
- }
- AAudioServiceEndpoint *endpoint = mServiceEndpoint;
- if (endpoint == nullptr) {
- return AAUDIO_ERROR_INVALID_STATE;
- }
- endpoint->getStreamInternal()->stopClient(mClientHandle);
- aaudio_result_t result = endpoint->stopStream(this);
- if (result != AAUDIO_OK) {
- ALOGE("AAudioServiceStreamShared::pause() mServiceEndpoint returned %d", result);
- disconnect(); // TODO should we return or pause Base first?
- }
- return AAudioServiceStreamBase::pause();
-}
-
-aaudio_result_t AAudioServiceStreamShared::stop() {
- if (!isRunning()) {
- return AAUDIO_OK;
- }
- AAudioServiceEndpoint *endpoint = mServiceEndpoint;
- if (endpoint == nullptr) {
- return AAUDIO_ERROR_INVALID_STATE;
- }
- endpoint->getStreamInternal()->stopClient(mClientHandle);
- aaudio_result_t result = endpoint->stopStream(this);
- if (result != AAUDIO_OK) {
- ALOGE("AAudioServiceStreamShared::stop() mServiceEndpoint returned %d", result);
- disconnect();
- }
- return AAudioServiceStreamBase::stop();
-}
-
-/**
- * Discard any data held by the underlying HAL or Service.
- *
- * An AAUDIO_SERVICE_EVENT_FLUSHED will be sent to the client when complete.
- */
-aaudio_result_t AAudioServiceStreamShared::flush() {
- AAudioServiceEndpoint *endpoint = mServiceEndpoint;
- if (endpoint == nullptr) {
- return AAUDIO_ERROR_INVALID_STATE;
- }
- if (mState != AAUDIO_STREAM_STATE_PAUSED) {
- ALOGE("AAudioServiceStreamShared::flush() stream not paused, state = %s",
- AAudio_convertStreamStateToText(mState));
- return AAUDIO_ERROR_INVALID_STATE;
- }
- // Data will get flushed when the client receives the FLUSHED event.
- return AAudioServiceStreamBase::flush();
-}
aaudio_result_t AAudioServiceStreamShared::close() {
- if (mState == AAUDIO_STREAM_STATE_CLOSED) {
- return AAUDIO_OK;
- }
+ aaudio_result_t result = AAudioServiceStreamBase::close();
- stop();
-
- AAudioServiceEndpoint *endpoint = mServiceEndpoint;
- if (endpoint == nullptr) {
- return AAUDIO_ERROR_INVALID_STATE;
- }
-
- endpoint->unregisterStream(this);
-
- AAudioEndpointManager &mEndpointManager = AAudioEndpointManager::getInstance();
- mEndpointManager.closeEndpoint(endpoint);
- mServiceEndpoint = nullptr;
-
- if (mAudioDataQueue != nullptr) {
+ {
+ std::lock_guard<std::mutex> lock(mAudioDataQueueLock);
delete mAudioDataQueue;
mAudioDataQueue = nullptr;
}
- return AAudioServiceStreamBase::close();
+
+ return result;
}
/**
* Get an immutable description of the data queue created by this service.
*/
-aaudio_result_t AAudioServiceStreamShared::getDownDataDescription(AudioEndpointParcelable &parcelable)
+aaudio_result_t AAudioServiceStreamShared::getAudioDataDescription(
+ AudioEndpointParcelable &parcelable)
{
+ std::lock_guard<std::mutex> lock(mAudioDataQueueLock);
+ if (mAudioDataQueue == nullptr) {
+ ALOGE("getAudioDataDescription(): mUpMessageQueue null! - stream not open");
+ return AAUDIO_ERROR_NULL;
+ }
// Gather information on the data queue.
mAudioDataQueue->fillParcelable(parcelable,
parcelable.mDownDataQueueParcelable);
@@ -307,15 +227,37 @@
return AAUDIO_OK;
}
-void AAudioServiceStreamShared::markTransferTime(int64_t nanoseconds) {
- mMarkedPosition = mAudioDataQueue->getFifoBuffer()->getReadCounter();
- mMarkedTime = nanoseconds;
+void AAudioServiceStreamShared::markTransferTime(Timestamp ×tamp) {
+ mAtomicTimestamp.write(timestamp);
}
+// Get timestamp that was written by mixer or distributor.
aaudio_result_t AAudioServiceStreamShared::getFreeRunningPosition(int64_t *positionFrames,
+ int64_t *timeNanos) {
+ // TODO Get presentation timestamp from the HAL
+ if (mAtomicTimestamp.isValid()) {
+ Timestamp timestamp = mAtomicTimestamp.read();
+ *positionFrames = timestamp.getPosition();
+ *timeNanos = timestamp.getNanoseconds();
+ return AAUDIO_OK;
+ } else {
+ return AAUDIO_ERROR_UNAVAILABLE;
+ }
+}
+
+// Get timestamp from lower level service.
+aaudio_result_t AAudioServiceStreamShared::getHardwareTimestamp(int64_t *positionFrames,
int64_t *timeNanos) {
- // TODO get these two numbers as an atomic pair
- *positionFrames = mMarkedPosition;
- *timeNanos = mMarkedTime;
- return AAUDIO_OK;
+
+ int64_t position = 0;
+ aaudio_result_t result = mServiceEndpoint->getTimestamp(&position, timeNanos);
+ if (result == AAUDIO_OK) {
+ int64_t offset = mTimestampPositionOffset.load();
+ // TODO, do not go below starting value
+ position -= offset; // Offset from shared MMAP stream
+ ALOGV("getHardwareTimestamp() %8lld = %8lld - %8lld",
+ (long long) position, (long long) (position + offset), (long long) offset);
+ }
+ *positionFrames = position;
+ return result;
}
diff --git a/services/oboeservice/AAudioServiceStreamShared.h b/services/oboeservice/AAudioServiceStreamShared.h
index 6b67337..8499ea5 100644
--- a/services/oboeservice/AAudioServiceStreamShared.h
+++ b/services/oboeservice/AAudioServiceStreamShared.h
@@ -46,53 +46,55 @@
AAudioServiceStreamShared(android::AAudioService &aAudioService);
virtual ~AAudioServiceStreamShared() = default;
- aaudio_result_t open(const aaudio::AAudioStreamRequest &request,
- aaudio::AAudioStreamConfiguration &configurationOutput) override;
+ static std::string dumpHeader();
- /**
- * Start the flow of audio data.
- *
- * This is not guaranteed to be synchronous but it currently is.
- * An AAUDIO_SERVICE_EVENT_STARTED will be sent to the client when complete.
- */
- aaudio_result_t start() override;
+ std::string dump() const override;
- /**
- * Stop the flow of data so that start() can resume without loss of data.
- *
- * This is not guaranteed to be synchronous but it currently is.
- * An AAUDIO_SERVICE_EVENT_PAUSED will be sent to the client when complete.
- */
- aaudio_result_t pause() override;
-
- /**
- * Stop the flow of data after data in buffer has played.
- */
- aaudio_result_t stop() override;
-
- /**
- * Discard any data held by the underlying HAL or Service.
- *
- * This is not guaranteed to be synchronous but it currently is.
- * An AAUDIO_SERVICE_EVENT_FLUSHED will be sent to the client when complete.
- */
- aaudio_result_t flush() override;
+ aaudio_result_t open(const aaudio::AAudioStreamRequest &request) override;
aaudio_result_t close() override;
- android::FifoBuffer *getDataFifoBuffer() { return mAudioDataQueue->getFifoBuffer(); }
+ /**
+ * This must be locked when calling getAudioDataFifoBuffer_l() and while
+ * using the FifoBuffer it returns.
+ */
+ std::mutex &getAudioDataQueueLock() {
+ return mAudioDataQueueLock;
+ }
+
+ /**
+ * This must only be call under getAudioDataQueueLock().
+ * @return
+ */
+ android::FifoBuffer *getAudioDataFifoBuffer_l() { return (mAudioDataQueue == nullptr)
+ ? nullptr
+ : mAudioDataQueue->getFifoBuffer(); }
/* Keep a record of when a buffer transfer completed.
* This allows for a more accurate timing model.
*/
- void markTransferTime(int64_t nanoseconds);
+ void markTransferTime(Timestamp ×tamp);
+
+ void setTimestampPositionOffset(int64_t deltaFrames) {
+ mTimestampPositionOffset.store(deltaFrames);
+ }
+
+ void incrementXRunCount() {
+ mXRunCount++;
+ }
+
+ int32_t getXRunCount() const {
+ return mXRunCount.load();
+ }
protected:
- aaudio_result_t getDownDataDescription(AudioEndpointParcelable &parcelable) override;
+ aaudio_result_t getAudioDataDescription(AudioEndpointParcelable &parcelable) override;
aaudio_result_t getFreeRunningPosition(int64_t *positionFrames, int64_t *timeNanos) override;
+ aaudio_result_t getHardwareTimestamp(int64_t *positionFrames, int64_t *timeNanos) override;
+
/**
* @param requestedCapacityFrames
* @param framesPerBurst
@@ -102,12 +104,12 @@
int32_t framesPerBurst);
private:
- android::AAudioService &mAudioService;
- AAudioServiceEndpoint *mServiceEndpoint = nullptr;
- SharedRingBuffer *mAudioDataQueue = nullptr;
+ SharedRingBuffer *mAudioDataQueue = nullptr; // protected by mAudioDataQueueLock
+ std::mutex mAudioDataQueueLock;
- int64_t mMarkedPosition = 0;
- int64_t mMarkedTime = 0;
+ std::atomic<int64_t> mTimestampPositionOffset;
+ std::atomic<int32_t> mXRunCount;
+
};
} /* namespace aaudio */
diff --git a/services/oboeservice/AAudioStreamTracker.cpp b/services/oboeservice/AAudioStreamTracker.cpp
new file mode 100644
index 0000000..ef88b34
--- /dev/null
+++ b/services/oboeservice/AAudioStreamTracker.cpp
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "AAudioStreamTracker"
+//#define LOG_NDEBUG 0
+#include <utils/Log.h>
+
+#include <iomanip>
+#include <iostream>
+#include <sstream>
+
+#include <aaudio/AAudio.h>
+#include <utils/String16.h>
+
+#include "AAudioStreamTracker.h"
+
+using namespace android;
+using namespace aaudio;
+
+sp<AAudioServiceStreamBase> AAudioStreamTracker::removeStreamByHandle(
+ aaudio_handle_t streamHandle) {
+ std::lock_guard<std::mutex> lock(mHandleLock);
+ sp<AAudioServiceStreamBase> serviceStream;
+ auto it = mStreamsByHandle.find(streamHandle);
+ if (it != mStreamsByHandle.end()) {
+ serviceStream = it->second;
+ mStreamsByHandle.erase(it);
+ }
+ return serviceStream;
+}
+
+sp<AAudioServiceStreamBase> AAudioStreamTracker::getStreamByHandle(
+ aaudio_handle_t streamHandle) {
+ std::lock_guard<std::mutex> lock(mHandleLock);
+ sp<AAudioServiceStreamBase> serviceStream;
+ auto it = mStreamsByHandle.find(streamHandle);
+ if (it != mStreamsByHandle.end()) {
+ serviceStream = it->second;
+ }
+ return serviceStream;
+}
+
+// advance to next legal handle value
+__attribute__((no_sanitize("integer")))
+aaudio_handle_t AAudioStreamTracker::bumpHandle(aaudio_handle_t handle) {
+ handle++;
+ // Only use positive integers.
+ if (handle <= 0) {
+ handle = 1;
+ }
+ return handle;
+}
+
+aaudio_handle_t AAudioStreamTracker::addStreamForHandle(sp<AAudioServiceStreamBase> serviceStream) {
+ std::lock_guard<std::mutex> lock(mHandleLock);
+ aaudio_handle_t handle = mPreviousHandle.load();
+ // Assign a unique handle.
+ while (true) {
+ handle = bumpHandle(handle);
+ sp<AAudioServiceStreamBase> oldServiceStream = mStreamsByHandle[handle];
+ // Is this an unused handle? It would be extremely unlikely to wrap
+ // around and collide with a very old handle. But just in case.
+ if (oldServiceStream.get() == nullptr) {
+ mStreamsByHandle[handle] = serviceStream;
+ break;
+ }
+ }
+ mPreviousHandle.store(handle);
+ return handle;
+}
+
+std::string AAudioStreamTracker::dump() const {
+ std::stringstream result;
+ const bool isLocked = AAudio_tryUntilTrue(
+ [this]()->bool { return mHandleLock.try_lock(); } /* f */,
+ 50 /* times */,
+ 20 /* sleepMs */);
+ if (!isLocked) {
+ result << "AAudioStreamTracker may be deadlocked\n";
+ } else {
+ result << "Stream Handles:\n";
+ for (const auto& it : mStreamsByHandle) {
+ aaudio_handle_t handle = it.second->getHandle();
+ result << " 0x" << std::setfill('0') << std::setw(8) << std::hex << handle
+ << std::dec << std::setfill(' ') << "\n";
+ }
+
+ mHandleLock.unlock();
+ }
+ return result.str();
+}
diff --git a/services/oboeservice/AAudioStreamTracker.h b/services/oboeservice/AAudioStreamTracker.h
new file mode 100644
index 0000000..70d440d
--- /dev/null
+++ b/services/oboeservice/AAudioStreamTracker.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AAUDIO_AAUDIO_STREAM_TRACKER_H
+#define AAUDIO_AAUDIO_STREAM_TRACKER_H
+
+#include <time.h>
+#include <pthread.h>
+
+#include <aaudio/AAudio.h>
+
+#include "binding/AAudioCommon.h"
+
+#include "AAudioServiceStreamBase.h"
+
+namespace aaudio {
+
+class AAudioStreamTracker {
+
+public:
+ /**
+ * Remove the stream associated with the handle.
+ * @param streamHandle
+ * @return strong pointer to the stream if found or to nullptr
+ */
+ android::sp<AAudioServiceStreamBase> removeStreamByHandle(aaudio_handle_t streamHandle);
+
+ /**
+ * Look up a stream based on the handle.
+ * @param streamHandle
+ * @return strong pointer to the stream if found or to nullptr
+ */
+ android::sp<aaudio::AAudioServiceStreamBase> getStreamByHandle(aaudio_handle_t streamHandle);
+
+ /**
+ * Store a strong pointer to the stream and return a unique handle for future reference.
+ * The handle is guaranteed not to collide with an existing stream.
+ * @param serviceStream
+ * @return handle for identifying the stream
+ */
+ aaudio_handle_t addStreamForHandle(android::sp<AAudioServiceStreamBase> serviceStream);
+
+ /**
+ * @return string that can be added to dumpsys
+ */
+ std::string dump() const;
+
+private:
+ static aaudio_handle_t bumpHandle(aaudio_handle_t handle);
+
+ // Track stream using a unique handle that wraps. Only use positive half.
+ mutable std::mutex mHandleLock;
+ std::atomic<aaudio_handle_t> mPreviousHandle{0};
+ std::map<aaudio_handle_t, android::sp<aaudio::AAudioServiceStreamBase>> mStreamsByHandle;
+};
+
+
+} /* namespace aaudio */
+
+#endif /* AAUDIO_AAUDIO_STREAM_TRACKER_H */
diff --git a/services/oboeservice/AAudioThread.cpp b/services/oboeservice/AAudioThread.cpp
index ebb50f8..c6fb57d 100644
--- a/services/oboeservice/AAudioThread.cpp
+++ b/services/oboeservice/AAudioThread.cpp
@@ -53,7 +53,7 @@
aaudio_result_t AAudioThread::start(Runnable *runnable) {
if (mHasThread) {
- ALOGE("AAudioThread::start() - mHasThread.load() already true");
+ ALOGE("AAudioThread::start() - mHasThread already true");
return AAUDIO_ERROR_INVALID_STATE;
}
// mRunnable will be read by the new thread when it starts.
@@ -71,6 +71,7 @@
aaudio_result_t AAudioThread::stop() {
if (!mHasThread) {
+ ALOGE("AAudioThread::stop() but no thread running");
return AAUDIO_ERROR_INVALID_STATE;
}
int err = pthread_join(mThread, nullptr);
diff --git a/services/oboeservice/Android.mk b/services/oboeservice/Android.mk
index a896a7a..584b2ef 100644
--- a/services/oboeservice/Android.mk
+++ b/services/oboeservice/Android.mk
@@ -22,7 +22,6 @@
$(TOP)/frameworks/av/media/libaaudio/src
LOCAL_SRC_FILES += \
- $(LIBAAUDIO_SRC_DIR)/utility/HandleTracker.cpp \
SharedMemoryProxy.cpp \
SharedRingBuffer.cpp \
AAudioClientTracker.cpp \
@@ -31,10 +30,13 @@
AAudioService.cpp \
AAudioServiceEndpoint.cpp \
AAudioServiceEndpointCapture.cpp \
+ AAudioServiceEndpointMMAP.cpp \
AAudioServiceEndpointPlay.cpp \
+ AAudioServiceEndpointShared.cpp \
AAudioServiceStreamBase.cpp \
AAudioServiceStreamMMAP.cpp \
AAudioServiceStreamShared.cpp \
+ AAudioStreamTracker.cpp \
TimestampScheduler.cpp \
AAudioThread.cpp
diff --git a/services/oboeservice/OWNERS b/services/oboeservice/OWNERS
new file mode 100644
index 0000000..f4d51f9
--- /dev/null
+++ b/services/oboeservice/OWNERS
@@ -0,0 +1 @@
+philburk@google.com
diff --git a/services/radio/Android.mk b/services/radio/Android.mk
deleted file mode 100644
index 1b50dc3..0000000
--- a/services/radio/Android.mk
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright 2014 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-
-LOCAL_SRC_FILES:= \
- RadioService.cpp
-
-LOCAL_SHARED_LIBRARIES:= \
- liblog \
- libutils \
- libbinder \
- libcutils \
- libaudioclient \
- libhardware \
- libradio \
- libradio_metadata
-
-ifeq ($(USE_LEGACY_LOCAL_AUDIO_HAL),true)
-# libhardware configuration
-LOCAL_SRC_FILES += \
- RadioHalLegacy.cpp
-else
-# Treble configuration
-
-LOCAL_SRC_FILES += \
- HidlUtils.cpp \
- RadioHalHidl.cpp
-
-LOCAL_SHARED_LIBRARIES += \
- libhwbinder \
- libhidlbase \
- libhidltransport \
- libbase \
- libaudiohal \
- android.hardware.broadcastradio@1.0
-endif
-
-LOCAL_CFLAGS += -Wall -Wextra -Werror
-
-LOCAL_MULTILIB := $(AUDIOSERVER_MULTILIB)
-
-LOCAL_MODULE:= libradioservice
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/services/radio/HidlUtils.cpp b/services/radio/HidlUtils.cpp
deleted file mode 100644
index 6895377..0000000
--- a/services/radio/HidlUtils.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#define LOG_TAG "HidlUtils"
-//#define LOG_NDEBUG 0
-
-#include <utils/Log.h>
-#include <utils/misc.h>
-#include <system/radio_metadata.h>
-
-#include "HidlUtils.h"
-
-namespace android {
-
-using android::hardware::broadcastradio::V1_0::MetadataType;
-using android::hardware::broadcastradio::V1_0::Band;
-using android::hardware::broadcastradio::V1_0::Deemphasis;
-using android::hardware::broadcastradio::V1_0::Rds;
-
-//static
-int HidlUtils::convertHalResult(Result result)
-{
- switch (result) {
- case Result::OK:
- return 0;
- case Result::INVALID_ARGUMENTS:
- return -EINVAL;
- case Result::INVALID_STATE:
- return -ENOSYS;
- case Result::TIMEOUT:
- return -ETIMEDOUT;
- case Result::NOT_INITIALIZED:
- default:
- return -ENODEV;
- }
-}
-
-
-//static
-void HidlUtils::convertBandConfigToHal(BandConfig *halConfig,
- const radio_hal_band_config_t *config)
-{
- halConfig->type = static_cast<Band>(config->type);
- halConfig->antennaConnected = config->antenna_connected;
- halConfig->lowerLimit = config->lower_limit;
- halConfig->upperLimit = config->upper_limit;
- halConfig->spacings.setToExternal(const_cast<unsigned int *>(&config->spacings[0]),
- config->num_spacings * sizeof(uint32_t));
- // FIXME: transfer buffer ownership. should have a method for that in hidl_vec
- halConfig->spacings.resize(config->num_spacings);
-
- if (halConfig->type == Band::FM) {
- halConfig->ext.fm.deemphasis = static_cast<Deemphasis>(config->fm.deemphasis);
- halConfig->ext.fm.stereo = config->fm.stereo;
- halConfig->ext.fm.rds = static_cast<Rds>(config->fm.rds);
- halConfig->ext.fm.ta = config->fm.ta;
- halConfig->ext.fm.af = config->fm.af;
- halConfig->ext.fm.ea = config->fm.ea;
- } else {
- halConfig->ext.am.stereo = config->am.stereo;
- }
-}
-
-//static
-void HidlUtils::convertPropertiesFromHal(radio_hal_properties_t *properties,
- const Properties *halProperties)
-{
- properties->class_id = static_cast<radio_class_t>(halProperties->classId);
- strlcpy(properties->implementor, halProperties->implementor.c_str(), RADIO_STRING_LEN_MAX);
- strlcpy(properties->product, halProperties->product.c_str(), RADIO_STRING_LEN_MAX);
- strlcpy(properties->version, halProperties->version.c_str(), RADIO_STRING_LEN_MAX);
- strlcpy(properties->serial, halProperties->serial.c_str(), RADIO_STRING_LEN_MAX);
- properties->num_tuners = halProperties->numTuners;
- properties->num_audio_sources = halProperties->numAudioSources;
- properties->supports_capture = halProperties->supportsCapture;
- properties->num_bands = halProperties->bands.size();
-
- for (size_t i = 0; i < halProperties->bands.size(); i++) {
- convertBandConfigFromHal(&properties->bands[i], &halProperties->bands[i]);
- }
-}
-
-//static
-void HidlUtils::convertBandConfigFromHal(radio_hal_band_config_t *config,
- const BandConfig *halConfig)
-{
- config->type = static_cast<radio_band_t>(halConfig->type);
- config->antenna_connected = halConfig->antennaConnected;
- config->lower_limit = halConfig->lowerLimit;
- config->upper_limit = halConfig->upperLimit;
- config->num_spacings = halConfig->spacings.size();
- if (config->num_spacings > RADIO_NUM_SPACINGS_MAX) {
- config->num_spacings = RADIO_NUM_SPACINGS_MAX;
- }
- memcpy(config->spacings, halConfig->spacings.data(),
- sizeof(uint32_t) * config->num_spacings);
-
- if (halConfig->type == Band::FM) {
- config->fm.deemphasis = static_cast<radio_deemphasis_t>(halConfig->ext.fm.deemphasis);
- config->fm.stereo = halConfig->ext.fm.stereo;
- config->fm.rds = static_cast<radio_rds_t>(halConfig->ext.fm.rds);
- config->fm.ta = halConfig->ext.fm.ta;
- config->fm.af = halConfig->ext.fm.af;
- config->fm.ea = halConfig->ext.fm.ea;
- } else {
- config->am.stereo = halConfig->ext.am.stereo;
- }
-}
-
-
-//static
-void HidlUtils::convertProgramInfoFromHal(radio_program_info_t *info,
- const ProgramInfo *halInfo)
-{
- info->channel = halInfo->channel;
- info->sub_channel = halInfo->subChannel;
- info->tuned = halInfo->tuned;
- info->stereo = halInfo->stereo;
- info->digital = halInfo->digital;
- info->signal_strength = halInfo->signalStrength;
- convertMetaDataFromHal(&info->metadata, halInfo->metadata,
- halInfo->channel, halInfo->subChannel);
-}
-
-// TODO(twasilczyk): drop unnecessary channel info
-//static
-void HidlUtils::convertMetaDataFromHal(radio_metadata_t **metadata,
- const hidl_vec<MetaData>& halMetadata,
- uint32_t channel __unused,
- uint32_t subChannel __unused)
-{
-
- if (metadata == nullptr || *metadata == nullptr) {
- ALOGE("destination metadata buffer is a nullptr");
- return;
- }
- for (size_t i = 0; i < halMetadata.size(); i++) {
- radio_metadata_key_t key = static_cast<radio_metadata_key_t>(halMetadata[i].key);
- radio_metadata_type_t type = static_cast<radio_metadata_key_t>(halMetadata[i].type);
- radio_metadata_clock_t clock;
-
- switch (type) {
- case RADIO_METADATA_TYPE_INT:
- radio_metadata_add_int(metadata, key, halMetadata[i].intValue);
- break;
- case RADIO_METADATA_TYPE_TEXT:
- radio_metadata_add_text(metadata, key, halMetadata[i].stringValue.c_str());
- break;
- case RADIO_METADATA_TYPE_RAW:
- radio_metadata_add_raw(metadata, key,
- halMetadata[i].rawValue.data(),
- halMetadata[i].rawValue.size());
- break;
- case RADIO_METADATA_TYPE_CLOCK:
- clock.utc_seconds_since_epoch =
- halMetadata[i].clockValue.utcSecondsSinceEpoch;
- clock.timezone_offset_in_minutes =
- halMetadata[i].clockValue.timezoneOffsetInMinutes;
- radio_metadata_add_clock(metadata, key, &clock);
- break;
- default:
- ALOGW("%s invalid metadata type %u",__FUNCTION__, halMetadata[i].type);
- break;
- }
- }
-}
-
-} // namespace android
diff --git a/services/radio/HidlUtils.h b/services/radio/HidlUtils.h
deleted file mode 100644
index c771060..0000000
--- a/services/radio/HidlUtils.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef ANDROID_HARDWARE_RADIO_HAL_HIDL_UTILS_H
-#define ANDROID_HARDWARE_RADIO_HAL_HIDL_UTILS_H
-
-#include <android/hardware/broadcastradio/1.0/types.h>
-#include <hardware/radio.h>
-
-namespace android {
-
-using android::hardware::hidl_vec;
-using android::hardware::broadcastradio::V1_0::Result;
-using android::hardware::broadcastradio::V1_0::Properties;
-using android::hardware::broadcastradio::V1_0::BandConfig;
-using android::hardware::broadcastradio::V1_0::ProgramInfo;
-using android::hardware::broadcastradio::V1_0::MetaData;
-
-class HidlUtils {
-public:
- static int convertHalResult(Result result);
- static void convertBandConfigFromHal(radio_hal_band_config_t *config,
- const BandConfig *halConfig);
- static void convertPropertiesFromHal(radio_hal_properties_t *properties,
- const Properties *halProperties);
- static void convertBandConfigToHal(BandConfig *halConfig,
- const radio_hal_band_config_t *config);
- static void convertProgramInfoFromHal(radio_program_info_t *info,
- const ProgramInfo *halInfo);
- static void convertMetaDataFromHal(radio_metadata_t **metadata,
- const hidl_vec<MetaData>& halMetadata,
- uint32_t channel,
- uint32_t subChannel);
-};
-
-} // namespace android
-
-#endif // ANDROID_HARDWARE_RADIO_HAL_HIDL_UTILS_H
diff --git a/services/radio/OWNERS b/services/radio/OWNERS
deleted file mode 100644
index eb9549a..0000000
--- a/services/radio/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-elaurent@google.com
-hunga@google.com
-twasilczyk@google.com
diff --git a/services/radio/RadioHalHidl.cpp b/services/radio/RadioHalHidl.cpp
deleted file mode 100644
index f637275..0000000
--- a/services/radio/RadioHalHidl.cpp
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define LOG_TAG "RadioHalHidl"
-//#define LOG_NDEBUG 0
-
-#include <media/audiohal/hidl/HalDeathHandler.h>
-#include <utils/Log.h>
-#include <utils/misc.h>
-#include <system/RadioMetadataWrapper.h>
-#include <android/hardware/broadcastradio/1.0/IBroadcastRadioFactory.h>
-
-#include "RadioHalHidl.h"
-#include "HidlUtils.h"
-
-namespace android {
-
-using android::hardware::broadcastradio::V1_0::IBroadcastRadioFactory;
-using android::hardware::broadcastradio::V1_0::Class;
-using android::hardware::broadcastradio::V1_0::Direction;
-using android::hardware::broadcastradio::V1_0::Properties;
-
-
-/* static */
-sp<RadioInterface> RadioInterface::connectModule(radio_class_t classId)
-{
- return new RadioHalHidl(classId);
-}
-
-int RadioHalHidl::getProperties(radio_hal_properties_t *properties)
-{
- ALOGV("%s IN", __FUNCTION__);
- sp<IBroadcastRadio> module = getService();
- if (module == 0) {
- return -ENODEV;
- }
- Properties halProperties;
- Result halResult = Result::NOT_INITIALIZED;
- Return<void> hidlReturn =
- module->getProperties([&](Result result, const Properties& properties) {
- halResult = result;
- if (result == Result::OK) {
- halProperties = properties;
- }
- });
-
- if (halResult == Result::OK) {
- HidlUtils::convertPropertiesFromHal(properties, &halProperties);
- }
- return HidlUtils::convertHalResult(halResult);
-}
-
-int RadioHalHidl::openTuner(const radio_hal_band_config_t *config,
- bool audio,
- sp<TunerCallbackInterface> callback,
- sp<TunerInterface>& tuner)
-{
- sp<IBroadcastRadio> module = getService();
- if (module == 0) {
- return -ENODEV;
- }
- sp<Tuner> tunerImpl = new Tuner(callback, this);
-
- BandConfig halConfig;
- Result halResult = Result::NOT_INITIALIZED;
- sp<ITuner> halTuner;
-
- HidlUtils::convertBandConfigToHal(&halConfig, config);
- Return<void> hidlReturn =
- module->openTuner(halConfig, audio, tunerImpl,
- [&](Result result, const sp<ITuner>& tuner) {
- halResult = result;
- if (result == Result::OK) {
- halTuner = tuner;
- }
- });
-
- if (halResult == Result::OK) {
- tunerImpl->setHalTuner(halTuner);
- tuner = tunerImpl;
- }
-
- return HidlUtils::convertHalResult(halResult);
-}
-
-int RadioHalHidl::closeTuner(sp<TunerInterface>& tuner)
-{
- sp<Tuner> tunerImpl = static_cast<Tuner *>(tuner.get());
- sp<ITuner> clearTuner;
- tunerImpl->setHalTuner(clearTuner);
- return 0;
-}
-
-RadioHalHidl::RadioHalHidl(radio_class_t classId)
- : mClassId(classId)
-{
-}
-
-RadioHalHidl::~RadioHalHidl()
-{
-}
-
-sp<IBroadcastRadio> RadioHalHidl::getService()
-{
- if (mHalModule == 0) {
- sp<IBroadcastRadioFactory> factory = IBroadcastRadioFactory::getService();
- if (factory != 0) {
- factory->connectModule(static_cast<Class>(mClassId),
- [&](Result retval, const ::android::sp<IBroadcastRadio>& result) {
- if (retval == Result::OK) {
- mHalModule = result;
- }
- });
- }
- }
- ALOGV("%s OUT module %p", __FUNCTION__, mHalModule.get());
- return mHalModule;
-}
-
-void RadioHalHidl::clearService()
-{
- ALOGV("%s IN module %p", __FUNCTION__, mHalModule.get());
- mHalModule.clear();
-}
-
-
-int RadioHalHidl::Tuner::setConfiguration(const radio_hal_band_config_t *config)
-{
- ALOGV("%s IN mHalTuner %p", __FUNCTION__, mHalTuner.get());
-
- if (mHalTuner == 0) {
- return -ENODEV;
- }
- BandConfig halConfig;
- HidlUtils::convertBandConfigToHal(&halConfig, config);
-
- Return<Result> hidlResult = mHalTuner->setConfiguration(halConfig);
- return HidlUtils::convertHalResult(hidlResult);
-}
-
-int RadioHalHidl::Tuner::getConfiguration(radio_hal_band_config_t *config)
-{
- ALOGV("%s IN mHalTuner %p", __FUNCTION__, mHalTuner.get());
- if (mHalTuner == 0) {
- return -ENODEV;
- }
- BandConfig halConfig;
- Result halResult;
- Return<void> hidlReturn =
- mHalTuner->getConfiguration([&](Result result, const BandConfig& config) {
- halResult = result;
- if (result == Result::OK) {
- halConfig = config;
- }
- });
- if (hidlReturn.isOk() && halResult == Result::OK) {
- HidlUtils::convertBandConfigFromHal(config, &halConfig);
- }
- return HidlUtils::convertHalResult(halResult);
-}
-
-int RadioHalHidl::Tuner::scan(radio_direction_t direction, bool skip_sub_channel)
-{
- ALOGV("%s IN mHalTuner %p", __FUNCTION__, mHalTuner.get());
- if (mHalTuner == 0) {
- return -ENODEV;
- }
- Return<Result> hidlResult =
- mHalTuner->scan(static_cast<Direction>(direction), skip_sub_channel);
- return HidlUtils::convertHalResult(hidlResult);
-}
-
-int RadioHalHidl::Tuner::step(radio_direction_t direction, bool skip_sub_channel)
-{
- ALOGV("%s IN mHalTuner %p", __FUNCTION__, mHalTuner.get());
- if (mHalTuner == 0) {
- return -ENODEV;
- }
- Return<Result> hidlResult =
- mHalTuner->step(static_cast<Direction>(direction), skip_sub_channel);
- return HidlUtils::convertHalResult(hidlResult);
-}
-
-int RadioHalHidl::Tuner::tune(unsigned int channel, unsigned int sub_channel)
-{
- ALOGV("%s IN mHalTuner %p", __FUNCTION__, mHalTuner.get());
- if (mHalTuner == 0) {
- return -ENODEV;
- }
- Return<Result> hidlResult =
- mHalTuner->tune(channel, sub_channel);
- return HidlUtils::convertHalResult(hidlResult);
-}
-
-int RadioHalHidl::Tuner::cancel()
-{
- ALOGV("%s IN mHalTuner %p", __FUNCTION__, mHalTuner.get());
- if (mHalTuner == 0) {
- return -ENODEV;
- }
- Return<Result> hidlResult = mHalTuner->cancel();
- return HidlUtils::convertHalResult(hidlResult);
-}
-
-int RadioHalHidl::Tuner::getProgramInformation(radio_program_info_t *info)
-{
- ALOGV("%s IN mHalTuner %p", __FUNCTION__, mHalTuner.get());
- if (mHalTuner == 0) {
- return -ENODEV;
- }
- if (info == nullptr || info->metadata == nullptr) {
- return BAD_VALUE;
- }
- ProgramInfo halInfo;
- Result halResult;
- Return<void> hidlReturn = mHalTuner->getProgramInformation(
- [&](Result result, const ProgramInfo& info) {
- halResult = result;
- if (result == Result::OK) {
- halInfo = info;
- }
- });
- if (hidlReturn.isOk() && halResult == Result::OK) {
- HidlUtils::convertProgramInfoFromHal(info, &halInfo);
- }
- return HidlUtils::convertHalResult(halResult);
-}
-
-Return<void> RadioHalHidl::Tuner::hardwareFailure()
-{
- ALOGV("%s IN", __FUNCTION__);
- handleHwFailure();
- return Return<void>();
-}
-
-Return<void> RadioHalHidl::Tuner::configChange(Result result, const BandConfig& config)
-{
- ALOGV("%s IN", __FUNCTION__);
- radio_hal_event_t event;
- memset(&event, 0, sizeof(radio_hal_event_t));
- event.type = RADIO_EVENT_CONFIG;
- event.status = HidlUtils::convertHalResult(result);
- HidlUtils::convertBandConfigFromHal(&event.config, &config);
- onCallback(&event);
- return Return<void>();
-}
-
-Return<void> RadioHalHidl::Tuner::tuneComplete(Result result, const ProgramInfo& info)
-{
- ALOGV("%s IN", __FUNCTION__);
- radio_hal_event_t event = {};
- RadioMetadataWrapper metadataWrapper(&event.info.metadata);
-
- event.type = RADIO_EVENT_TUNED;
- event.status = HidlUtils::convertHalResult(result);
- HidlUtils::convertProgramInfoFromHal(&event.info, &info);
- onCallback(&event);
- return Return<void>();
-}
-
-Return<void> RadioHalHidl::Tuner::afSwitch(const ProgramInfo& info)
-{
- ALOGV("%s IN", __FUNCTION__);
- radio_hal_event_t event = {};
- RadioMetadataWrapper metadataWrapper(&event.info.metadata);
-
- event.type = RADIO_EVENT_AF_SWITCH;
- HidlUtils::convertProgramInfoFromHal(&event.info, &info);
- onCallback(&event);
- return Return<void>();
-}
-
-Return<void> RadioHalHidl::Tuner::antennaStateChange(bool connected)
-{
- ALOGV("%s IN", __FUNCTION__);
- radio_hal_event_t event;
- memset(&event, 0, sizeof(radio_hal_event_t));
- event.type = RADIO_EVENT_ANTENNA;
- event.on = connected;
- onCallback(&event);
- return Return<void>();
-}
-Return<void> RadioHalHidl::Tuner::trafficAnnouncement(bool active)
-{
- ALOGV("%s IN", __FUNCTION__);
- radio_hal_event_t event;
- memset(&event, 0, sizeof(radio_hal_event_t));
- event.type = RADIO_EVENT_TA;
- event.on = active;
- onCallback(&event);
- return Return<void>();
-}
-Return<void> RadioHalHidl::Tuner::emergencyAnnouncement(bool active)
-{
- ALOGV("%s IN", __FUNCTION__);
- radio_hal_event_t event;
- memset(&event, 0, sizeof(radio_hal_event_t));
- event.type = RADIO_EVENT_EA;
- event.on = active;
- onCallback(&event);
- return Return<void>();
-}
-Return<void> RadioHalHidl::Tuner::newMetadata(uint32_t channel, uint32_t subChannel,
- const ::android::hardware::hidl_vec<MetaData>& metadata)
-{
- ALOGV("%s IN", __FUNCTION__);
- radio_hal_event_t event = {};
- RadioMetadataWrapper metadataWrapper(&event.metadata);
-
- event.type = RADIO_EVENT_METADATA;
- HidlUtils::convertMetaDataFromHal(&event.metadata, metadata, channel, subChannel);
- onCallback(&event);
- return Return<void>();
-}
-
-
-RadioHalHidl::Tuner::Tuner(sp<TunerCallbackInterface> callback, sp<RadioHalHidl> module)
- : TunerInterface(), mHalTuner(NULL), mCallback(callback), mParentModule(module)
-{
- // Make sure the handler we are passing in only deals with const members,
- // as it can be called on an arbitrary thread.
- const auto& self = this;
- HalDeathHandler::getInstance()->registerAtExitHandler(
- this, [&self]() { self->sendHwFailureEvent(); });
-}
-
-
-RadioHalHidl::Tuner::~Tuner()
-{
- HalDeathHandler::getInstance()->unregisterAtExitHandler(this);
-}
-
-void RadioHalHidl::Tuner::setHalTuner(sp<ITuner>& halTuner) {
- if (mHalTuner != 0) {
- mHalTuner->unlinkToDeath(HalDeathHandler::getInstance());
- }
- mHalTuner = halTuner;
- if (mHalTuner != 0) {
- mHalTuner->linkToDeath(HalDeathHandler::getInstance(), 0 /*cookie*/);
- }
-}
-
-void RadioHalHidl::Tuner::handleHwFailure()
-{
- ALOGV("%s IN", __FUNCTION__);
- sp<RadioHalHidl> parentModule = mParentModule.promote();
- if (parentModule != 0) {
- parentModule->clearService();
- }
- sendHwFailureEvent();
- mHalTuner.clear();
-}
-
-void RadioHalHidl::Tuner::sendHwFailureEvent() const
-{
- radio_hal_event_t event;
- memset(&event, 0, sizeof(radio_hal_event_t));
- event.type = RADIO_EVENT_HW_FAILURE;
- onCallback(&event);
-}
-
-void RadioHalHidl::Tuner::onCallback(radio_hal_event_t *halEvent) const
-{
- if (mCallback != 0) {
- mCallback->onEvent(halEvent);
- }
-}
-
-} // namespace android
diff --git a/services/radio/RadioHalHidl.h b/services/radio/RadioHalHidl.h
deleted file mode 100644
index f98420d..0000000
--- a/services/radio/RadioHalHidl.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_RADIO_HAL_HIDL_H
-#define ANDROID_HARDWARE_RADIO_HAL_HIDL_H
-
-#include <utils/RefBase.h>
-#include <utils/threads.h>
-#include "RadioInterface.h"
-#include "TunerInterface.h"
-#include "TunerCallbackInterface.h"
-#include <android/hardware/broadcastradio/1.0/types.h>
-#include <android/hardware/broadcastradio/1.0/IBroadcastRadio.h>
-#include <android/hardware/broadcastradio/1.0/ITuner.h>
-#include <android/hardware/broadcastradio/1.0/ITunerCallback.h>
-
-namespace android {
-
-using android::hardware::Return;
-using android::hardware::broadcastradio::V1_0::Result;
-using android::hardware::broadcastradio::V1_0::IBroadcastRadio;
-using android::hardware::broadcastradio::V1_0::ITuner;
-using android::hardware::broadcastradio::V1_0::ITunerCallback;
-
-using android::hardware::broadcastradio::V1_0::BandConfig;
-using android::hardware::broadcastradio::V1_0::ProgramInfo;
-using android::hardware::broadcastradio::V1_0::MetaData;
-
-class RadioHalHidl : public RadioInterface
-{
-public:
- RadioHalHidl(radio_class_t classId);
-
- // RadioInterface
- virtual int getProperties(radio_hal_properties_t *properties);
- virtual int openTuner(const radio_hal_band_config_t *config,
- bool audio,
- sp<TunerCallbackInterface> callback,
- sp<TunerInterface>& tuner);
- virtual int closeTuner(sp<TunerInterface>& tuner);
-
- class Tuner : public TunerInterface, public virtual ITunerCallback
- {
- public:
- Tuner(sp<TunerCallbackInterface> callback, sp<RadioHalHidl> module);
-
- // TunerInterface
- virtual int setConfiguration(const radio_hal_band_config_t *config);
- virtual int getConfiguration(radio_hal_band_config_t *config);
- virtual int scan(radio_direction_t direction, bool skip_sub_channel);
- virtual int step(radio_direction_t direction, bool skip_sub_channel);
- virtual int tune(unsigned int channel, unsigned int sub_channel);
- virtual int cancel();
- virtual int getProgramInformation(radio_program_info_t *info);
-
- // ITunerCallback
- virtual Return<void> hardwareFailure();
- virtual Return<void> configChange(Result result, const BandConfig& config);
- virtual Return<void> tuneComplete(Result result, const ProgramInfo& info);
- virtual Return<void> afSwitch(const ProgramInfo& info);
- virtual Return<void> antennaStateChange(bool connected);
- virtual Return<void> trafficAnnouncement(bool active);
- virtual Return<void> emergencyAnnouncement(bool active);
- virtual Return<void> newMetadata(uint32_t channel, uint32_t subChannel,
- const ::android::hardware::hidl_vec<MetaData>& metadata);
-
- void setHalTuner(sp<ITuner>& halTuner);
- sp<ITuner> getHalTuner() { return mHalTuner; }
-
- private:
- virtual ~Tuner();
-
- void onCallback(radio_hal_event_t *halEvent) const;
- void handleHwFailure();
- void sendHwFailureEvent() const;
-
- sp<ITuner> mHalTuner;
- const sp<TunerCallbackInterface> mCallback;
- wp<RadioHalHidl> mParentModule;
- };
-
- sp<IBroadcastRadio> getService();
- void clearService();
-
-private:
- virtual ~RadioHalHidl();
-
- radio_class_t mClassId;
- sp<IBroadcastRadio> mHalModule;
-};
-
-} // namespace android
-
-#endif // ANDROID_HARDWARE_RADIO_HAL_HIDL_H
diff --git a/services/radio/RadioHalLegacy.cpp b/services/radio/RadioHalLegacy.cpp
deleted file mode 100644
index d50ccd4..0000000
--- a/services/radio/RadioHalLegacy.cpp
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define LOG_TAG "RadioHalLegacy"
-//#define LOG_NDEBUG 0
-
-#include <utils/Log.h>
-#include <utils/misc.h>
-#include "RadioHalLegacy.h"
-
-namespace android {
-
-const char *RadioHalLegacy::sClassModuleNames[] = {
- RADIO_HARDWARE_MODULE_ID_FM, /* corresponds to RADIO_CLASS_AM_FM */
- RADIO_HARDWARE_MODULE_ID_SAT, /* corresponds to RADIO_CLASS_SAT */
- RADIO_HARDWARE_MODULE_ID_DT, /* corresponds to RADIO_CLASS_DT */
-};
-
-/* static */
-sp<RadioInterface> RadioInterface::connectModule(radio_class_t classId)
-{
- return new RadioHalLegacy(classId);
-}
-
-RadioHalLegacy::RadioHalLegacy(radio_class_t classId)
- : RadioInterface(), mClassId(classId), mHwDevice(NULL)
-{
-}
-
-void RadioHalLegacy::onFirstRef()
-{
- const hw_module_t *mod;
- int rc;
- ALOGI("%s mClassId %d", __FUNCTION__, mClassId);
-
- mHwDevice = NULL;
-
- if ((mClassId < 0) ||
- (mClassId >= NELEM(sClassModuleNames))) {
- ALOGE("invalid class ID %d", mClassId);
- return;
- }
-
- ALOGI("%s RADIO_HARDWARE_MODULE_ID %s %s",
- __FUNCTION__, RADIO_HARDWARE_MODULE_ID, sClassModuleNames[mClassId]);
-
- rc = hw_get_module_by_class(RADIO_HARDWARE_MODULE_ID, sClassModuleNames[mClassId], &mod);
- if (rc != 0) {
- ALOGE("couldn't load radio module %s.%s (%s)",
- RADIO_HARDWARE_MODULE_ID, sClassModuleNames[mClassId], strerror(-rc));
- return;
- }
- rc = radio_hw_device_open(mod, &mHwDevice);
- if (rc != 0) {
- ALOGE("couldn't open radio hw device in %s.%s (%s)",
- RADIO_HARDWARE_MODULE_ID, "primary", strerror(-rc));
- mHwDevice = NULL;
- return;
- }
- if (mHwDevice->common.version != RADIO_DEVICE_API_VERSION_CURRENT) {
- ALOGE("wrong radio hw device version %04x", mHwDevice->common.version);
- radio_hw_device_close(mHwDevice);
- mHwDevice = NULL;
- }
-}
-
-RadioHalLegacy::~RadioHalLegacy()
-{
- if (mHwDevice != NULL) {
- radio_hw_device_close(mHwDevice);
- }
-}
-
-int RadioHalLegacy::getProperties(radio_hal_properties_t *properties)
-{
- if (mHwDevice == NULL) {
- return -ENODEV;
- }
-
- int rc = mHwDevice->get_properties(mHwDevice, properties);
- if (rc != 0) {
- ALOGE("could not read implementation properties");
- }
-
- return rc;
-}
-
-int RadioHalLegacy::openTuner(const radio_hal_band_config_t *config,
- bool audio,
- sp<TunerCallbackInterface> callback,
- sp<TunerInterface>& tuner)
-{
- if (mHwDevice == NULL) {
- return -ENODEV;
- }
- sp<Tuner> tunerImpl = new Tuner(callback);
-
- const struct radio_tuner *halTuner;
- int rc = mHwDevice->open_tuner(mHwDevice, config, audio,
- RadioHalLegacy::Tuner::callback, tunerImpl.get(),
- &halTuner);
- if (rc == 0) {
- tunerImpl->setHalTuner(halTuner);
- tuner = tunerImpl;
- }
- return rc;
-}
-
-int RadioHalLegacy::closeTuner(sp<TunerInterface>& tuner)
-{
- if (mHwDevice == NULL) {
- return -ENODEV;
- }
- if (tuner == 0) {
- return -EINVAL;
- }
- sp<Tuner> tunerImpl = (Tuner *)tuner.get();
- return mHwDevice->close_tuner(mHwDevice, tunerImpl->getHalTuner());
-}
-
-int RadioHalLegacy::Tuner::setConfiguration(const radio_hal_band_config_t *config)
-{
- if (mHalTuner == NULL) {
- return -ENODEV;
- }
- return mHalTuner->set_configuration(mHalTuner, config);
-}
-
-int RadioHalLegacy::Tuner::getConfiguration(radio_hal_band_config_t *config)
-{
- if (mHalTuner == NULL) {
- return -ENODEV;
- }
- return mHalTuner->get_configuration(mHalTuner, config);
-}
-
-int RadioHalLegacy::Tuner::scan(radio_direction_t direction, bool skip_sub_channel)
-{
- if (mHalTuner == NULL) {
- return -ENODEV;
- }
- return mHalTuner->scan(mHalTuner, direction, skip_sub_channel);
-}
-
-int RadioHalLegacy::Tuner::step(radio_direction_t direction, bool skip_sub_channel)
-{
- if (mHalTuner == NULL) {
- return -ENODEV;
- }
- return mHalTuner->step(mHalTuner, direction, skip_sub_channel);
-}
-
-int RadioHalLegacy::Tuner::tune(unsigned int channel, unsigned int sub_channel)
-{
- if (mHalTuner == NULL) {
- return -ENODEV;
- }
- return mHalTuner->tune(mHalTuner, channel, sub_channel);
-}
-
-int RadioHalLegacy::Tuner::cancel()
-{
- if (mHalTuner == NULL) {
- return -ENODEV;
- }
- return mHalTuner->cancel(mHalTuner);
-}
-
-int RadioHalLegacy::Tuner::getProgramInformation(radio_program_info_t *info)
-{
- if (mHalTuner == NULL) {
- return -ENODEV;
- }
- return mHalTuner->get_program_information(mHalTuner, info);
-}
-
-void RadioHalLegacy::Tuner::onCallback(radio_hal_event_t *halEvent)
-{
- if (mCallback != 0) {
- mCallback->onEvent(halEvent);
- }
-}
-
-//static
-void RadioHalLegacy::Tuner::callback(radio_hal_event_t *halEvent, void *cookie)
-{
- wp<RadioHalLegacy::Tuner> weak = wp<RadioHalLegacy::Tuner>((RadioHalLegacy::Tuner *)cookie);
- sp<RadioHalLegacy::Tuner> tuner = weak.promote();
- if (tuner != 0) {
- tuner->onCallback(halEvent);
- }
-}
-
-RadioHalLegacy::Tuner::Tuner(sp<TunerCallbackInterface> callback)
- : TunerInterface(), mHalTuner(NULL), mCallback(callback)
-{
-}
-
-
-RadioHalLegacy::Tuner::~Tuner()
-{
-}
-
-
-} // namespace android
diff --git a/services/radio/RadioHalLegacy.h b/services/radio/RadioHalLegacy.h
deleted file mode 100644
index 7d4831b..0000000
--- a/services/radio/RadioHalLegacy.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_RADIO_HAL_LEGACY_H
-#define ANDROID_HARDWARE_RADIO_HAL_LEGACY_H
-
-#include <utils/RefBase.h>
-#include <hardware/radio.h>
-#include "RadioInterface.h"
-#include "TunerInterface.h"
-#include "TunerCallbackInterface.h"
-
-namespace android {
-
-class RadioHalLegacy : public RadioInterface
-{
-public:
- RadioHalLegacy(radio_class_t classId);
-
- // RadioInterface
- virtual int getProperties(radio_hal_properties_t *properties);
- virtual int openTuner(const radio_hal_band_config_t *config,
- bool audio,
- sp<TunerCallbackInterface> callback,
- sp<TunerInterface>& tuner);
- virtual int closeTuner(sp<TunerInterface>& tuner);
-
- // RefBase
- virtual void onFirstRef();
-
- class Tuner : public TunerInterface
- {
- public:
- Tuner(sp<TunerCallbackInterface> callback);
-
- virtual int setConfiguration(const radio_hal_band_config_t *config);
- virtual int getConfiguration(radio_hal_band_config_t *config);
- virtual int scan(radio_direction_t direction, bool skip_sub_channel);
- virtual int step(radio_direction_t direction, bool skip_sub_channel);
- virtual int tune(unsigned int channel, unsigned int sub_channel);
- virtual int cancel();
- virtual int getProgramInformation(radio_program_info_t *info);
-
- static void callback(radio_hal_event_t *halEvent, void *cookie);
- void onCallback(radio_hal_event_t *halEvent);
-
- void setHalTuner(const struct radio_tuner *halTuner) { mHalTuner = halTuner; }
- const struct radio_tuner *getHalTuner() { return mHalTuner; }
-
- private:
- virtual ~Tuner();
-
- const struct radio_tuner *mHalTuner;
- sp<TunerCallbackInterface> mCallback;
- };
-
-protected:
- virtual ~RadioHalLegacy();
-
-private:
- static const char * sClassModuleNames[];
-
- radio_class_t mClassId;
- struct radio_hw_device *mHwDevice;
-};
-
-} // namespace android
-
-#endif // ANDROID_HARDWARE_RADIO_HAL_LEGACY_H
diff --git a/services/radio/RadioInterface.h b/services/radio/RadioInterface.h
deleted file mode 100644
index fcfb4d5..0000000
--- a/services/radio/RadioInterface.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_RADIO_INTERFACE_H
-#define ANDROID_HARDWARE_RADIO_INTERFACE_H
-
-#include <utils/RefBase.h>
-#include <system/radio.h>
-#include "TunerInterface.h"
-#include "TunerCallbackInterface.h"
-
-namespace android {
-
-class RadioInterface : public virtual RefBase
-{
-public:
- /* get a sound trigger HAL instance */
- static sp<RadioInterface> connectModule(radio_class_t classId);
-
- /*
- * Retrieve implementation properties.
- *
- * arguments:
- * - properties: where to return the module properties
- *
- * returns:
- * 0 if no error
- * -EINVAL if invalid arguments are passed
- */
- virtual int getProperties(radio_hal_properties_t *properties) = 0;
-
- /*
- * Open a tuner interface for the requested configuration.
- * If no other tuner is opened, this will activate the radio module.
- *
- * arguments:
- * - config: the band configuration to apply
- * - audio: this tuner will be used for live radio listening and should be connected to
- * the radio audio source.
- * - callback: the event callback
- * - cookie: the cookie to pass when calling the callback
- * - tuner: where to return the tuner interface
- *
- * returns:
- * 0 if HW was powered up and configuration could be applied
- * -EINVAL if configuration requested is invalid
- * -ENOSYS if called out of sequence
- *
- * Callback function with event RADIO_EVENT_CONFIG MUST be called once the
- * configuration is applied or a failure occurs or after a time out.
- */
- virtual int openTuner(const radio_hal_band_config_t *config,
- bool audio,
- sp<TunerCallbackInterface> callback,
- sp<TunerInterface>& tuner) = 0;
-
- /*
- * Close a tuner interface.
- * If the last tuner is closed, the radio module is deactivated.
- *
- * arguments:
- * - tuner: the tuner interface to close
- *
- * returns:
- * 0 if powered down successfully.
- * -EINVAL if an invalid argument is passed
- * -ENOSYS if called out of sequence
- */
- virtual int closeTuner(sp<TunerInterface>& tuner) = 0;
-
-protected:
- RadioInterface() {}
- virtual ~RadioInterface() {}
-};
-
-} // namespace android
-
-#endif // ANDROID_HARDWARE_RADIO_INTERFACE_H
diff --git a/services/radio/RadioRegions.h b/services/radio/RadioRegions.h
deleted file mode 100644
index d40ee83..0000000
--- a/services/radio/RadioRegions.h
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_RADIO_REGIONS_H
-#define ANDROID_HARDWARE_RADIO_REGIONS_H
-
-namespace android {
-
-#define RADIO_BAND_LOWER_FM_ITU1 87500
-#define RADIO_BAND_UPPER_FM_ITU1 108000
-#define RADIO_BAND_SPACING_FM_ITU1 100
-
-#define RADIO_BAND_LOWER_FM_ITU2 87900
-#define RADIO_BAND_UPPER_FM_ITU2 107900
-#define RADIO_BAND_SPACING_FM_ITU2 200
-
-#define RADIO_BAND_LOWER_FM_JAPAN 76000
-#define RADIO_BAND_UPPER_FM_JAPAN 90000
-#define RADIO_BAND_SPACING_FM_JAPAN 100
-
-#define RADIO_BAND_LOWER_FM_OIRT 65800
-#define RADIO_BAND_UPPER_FM_OIRT 74000
-#define RADIO_BAND_SPACING_FM_OIRT 10
-
-#define RADIO_BAND_LOWER_LW 153
-#define RADIO_BAND_UPPER_LW 279
-#define RADIO_BAND_SPACING_LW 9
-
-#define RADIO_BAND_LOWER_MW_IUT1 531
-#define RADIO_BAND_UPPER_MW_ITU1 1611
-#define RADIO_BAND_SPACING_MW_ITU1 9
-
-#define RADIO_BAND_LOWER_MW_IUT2 540
-#define RADIO_BAND_UPPER_MW_ITU2 1610
-#define RADIO_BAND_SPACING_MW_ITU2 10
-
-#define RADIO_BAND_LOWER_SW 2300
-#define RADIO_BAND_UPPER_SW 26100
-#define RADIO_BAND_SPACING_SW 5
-
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
-#endif
-
-const radio_band_config_t sKnownRegionConfigs[] = {
- { // FM ITU 1
- RADIO_REGION_ITU_1,
- {
- RADIO_BAND_FM,
- false,
- RADIO_BAND_LOWER_FM_ITU1,
- RADIO_BAND_UPPER_FM_ITU1,
- 1,
- {RADIO_BAND_SPACING_FM_ITU1},
- {
- {
- RADIO_DEEMPHASIS_50,
- true,
- RADIO_RDS_WORLD,
- true,
- true,
- true,
- }
- }
- }
- },
- { // FM Americas
- RADIO_REGION_ITU_2,
- {
- RADIO_BAND_FM,
- false,
- RADIO_BAND_LOWER_FM_ITU2,
- RADIO_BAND_UPPER_FM_ITU2,
- 1,
- {RADIO_BAND_SPACING_FM_ITU2},
- {
- {
- RADIO_DEEMPHASIS_75,
- true,
- RADIO_RDS_US,
- true,
- true,
- true,
- }
- }
- }
- },
- { // FM Japan
- RADIO_REGION_JAPAN,
- {
- RADIO_BAND_FM,
- false,
- RADIO_BAND_LOWER_FM_JAPAN,
- RADIO_BAND_UPPER_FM_JAPAN,
- 1,
- {RADIO_BAND_SPACING_FM_JAPAN},
- {
- {
- RADIO_DEEMPHASIS_50,
- true,
- RADIO_RDS_WORLD,
- true,
- true,
- true,
- }
- }
- }
- },
- { // FM Korea
- RADIO_REGION_KOREA,
- {
- RADIO_BAND_FM,
- false,
- RADIO_BAND_LOWER_FM_ITU1,
- RADIO_BAND_UPPER_FM_ITU1,
- 1,
- {RADIO_BAND_SPACING_FM_ITU1},
- {
- {
- RADIO_DEEMPHASIS_75,
- true,
- RADIO_RDS_WORLD,
- true,
- true,
- true,
- }
- }
- }
- },
- { // FM OIRT
- RADIO_REGION_OIRT,
- {
- RADIO_BAND_FM,
- false,
- RADIO_BAND_LOWER_FM_OIRT,
- RADIO_BAND_UPPER_FM_OIRT,
- 1,
- {RADIO_BAND_SPACING_FM_OIRT},
- {
- {
- RADIO_DEEMPHASIS_50,
- true,
- RADIO_RDS_WORLD,
- true,
- true,
- true,
- }
- }
- }
- },
- { // FM US HD radio
- RADIO_REGION_ITU_2,
- {
- RADIO_BAND_FM_HD,
- false,
- RADIO_BAND_LOWER_FM_ITU2,
- RADIO_BAND_UPPER_FM_ITU2,
- 1,
- {RADIO_BAND_SPACING_FM_ITU2},
- {
- {
- RADIO_DEEMPHASIS_75,
- true,
- RADIO_RDS_US,
- true,
- true,
- true,
- }
- }
- }
- },
- { // AM LW
- RADIO_REGION_ITU_1,
- {
- RADIO_BAND_AM,
- false,
- RADIO_BAND_LOWER_LW,
- RADIO_BAND_UPPER_LW,
- 1,
- {RADIO_BAND_SPACING_LW},
- {
- }
- }
- },
- { // AM SW
- RADIO_REGION_ITU_1,
- {
- RADIO_BAND_AM,
- false,
- RADIO_BAND_LOWER_SW,
- RADIO_BAND_UPPER_SW,
- 1,
- {RADIO_BAND_SPACING_SW},
- {
- }
- }
- },
- { // AM MW ITU1
- RADIO_REGION_ITU_1,
- {
- RADIO_BAND_AM,
- false,
- RADIO_BAND_LOWER_MW_IUT1,
- RADIO_BAND_UPPER_MW_ITU1,
- 1,
- {RADIO_BAND_SPACING_MW_ITU1},
- {
- }
- }
- },
- { // AM MW ITU2
- RADIO_REGION_ITU_2,
- {
- RADIO_BAND_AM,
- false,
- RADIO_BAND_LOWER_MW_IUT2,
- RADIO_BAND_UPPER_MW_ITU2,
- 1,
- {RADIO_BAND_SPACING_MW_ITU2},
- {
- }
- }
- }
-};
-
-
-} // namespace android
-
-#endif // ANDROID_HARDWARE_RADIO_REGIONS_H
diff --git a/services/radio/RadioService.cpp b/services/radio/RadioService.cpp
deleted file mode 100644
index beb7c09..0000000
--- a/services/radio/RadioService.cpp
+++ /dev/null
@@ -1,936 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define LOG_TAG "RadioService"
-//#define LOG_NDEBUG 0
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <pthread.h>
-
-#include <system/audio.h>
-#include <system/audio_policy.h>
-#include <system/radio.h>
-#include <system/radio_metadata.h>
-#include <cutils/atomic.h>
-#include <cutils/properties.h>
-#include <hardware/hardware.h>
-#include <utils/Errors.h>
-#include <utils/Log.h>
-#include <binder/IServiceManager.h>
-#include <binder/MemoryBase.h>
-#include <binder/MemoryHeapBase.h>
-#include <binder/PermissionCache.h>
-#include <hardware/radio.h>
-#include <media/AudioSystem.h>
-#include "RadioService.h"
-#include "RadioRegions.h"
-
-namespace android {
-
-static const char kRadioTunerAudioDeviceName[] = "Radio tuner source";
-
-static const String16 RADIO_PERMISSION("android.permission.ACCESS_FM_RADIO");
-
-RadioService::RadioService()
- : BnRadioService(), mNextUniqueId(1)
-{
- ALOGI("%s", __FUNCTION__);
-}
-
-void RadioService::onFirstRef()
-{
- ALOGI("%s", __FUNCTION__);
-
- sp<RadioInterface> dev = RadioInterface::connectModule(RADIO_CLASS_AM_FM);
-
- if (dev == 0) {
- return;
- }
- struct radio_hal_properties halProperties;
- int rc = dev->getProperties(&halProperties);
- if (rc != 0) {
- ALOGE("could not read implementation properties");
- return;
- }
-
- radio_properties_t properties;
- properties.handle =
- (radio_handle_t)android_atomic_inc(&mNextUniqueId);
- convertProperties(&properties, &halProperties);
-
- ALOGI("loaded default module %s, ver %s, handle %d", properties.product,
- properties.version, properties.handle);
-
- sp<Module> module = new Module(dev, properties);
- mModules.add(properties.handle, module);
-}
-
-RadioService::~RadioService()
-{
-}
-
-status_t RadioService::listModules(struct radio_properties *properties,
- uint32_t *numModules)
-{
- if (!PermissionCache::checkCallingPermission(RADIO_PERMISSION)) {
- return PERMISSION_DENIED;
- }
- ALOGV("listModules");
-
- AutoMutex lock(mServiceLock);
- if (numModules == NULL || (*numModules != 0 && properties == NULL)) {
- return BAD_VALUE;
- }
- uint32_t maxModules = *numModules;
- *numModules = mModules.size();
- for (size_t i = 0; i < mModules.size() && i < maxModules; i++) {
- properties[i] = mModules.valueAt(i)->properties();
- }
- return NO_ERROR;
-}
-
-status_t RadioService::attach(radio_handle_t handle,
- const sp<IRadioClient>& client,
- const struct radio_band_config *config,
- bool withAudio,
- sp<IRadio>& radio)
-{
- if (!PermissionCache::checkCallingPermission(RADIO_PERMISSION)) {
- return PERMISSION_DENIED;
- }
- ALOGV("%s %d config %p withAudio %d", __FUNCTION__, handle, config, withAudio);
-
- AutoMutex lock(mServiceLock);
- radio.clear();
- if (client == 0) {
- return BAD_VALUE;
- }
- ssize_t index = mModules.indexOfKey(handle);
- if (index < 0) {
- return BAD_VALUE;
- }
- sp<Module> module = mModules.valueAt(index);
-
- if (config == NULL) {
- config = module->getDefaultConfig();
- if (config == NULL) {
- return INVALID_OPERATION;
- }
- }
- ALOGV("%s region %d type %d", __FUNCTION__, config->region, config->band.type);
-
- radio = module->addClient(client, config, withAudio);
-
- if (radio == 0) {
- return NO_INIT;
- }
- return NO_ERROR;
-}
-
-
-static const int kDumpLockRetries = 50;
-static const int kDumpLockSleep = 60000;
-
-static bool tryLock(Mutex& mutex)
-{
- bool locked = false;
- for (int i = 0; i < kDumpLockRetries; ++i) {
- if (mutex.tryLock() == NO_ERROR) {
- locked = true;
- break;
- }
- usleep(kDumpLockSleep);
- }
- return locked;
-}
-
-status_t RadioService::dump(int fd, const Vector<String16>& args __unused) {
- String8 result;
- if (checkCallingPermission(String16("android.permission.DUMP")) == false) {
- result.appendFormat("Permission Denial: can't dump RadioService");
- write(fd, result.string(), result.size());
- } else {
- bool locked = tryLock(mServiceLock);
- // failed to lock - RadioService is probably deadlocked
- if (!locked) {
- result.append("RadioService may be deadlocked\n");
- write(fd, result.string(), result.size());
- }
-
- if (locked) mServiceLock.unlock();
- }
- return NO_ERROR;
-}
-
-status_t RadioService::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) {
- return BnRadioService::onTransact(code, data, reply, flags);
-}
-
-
-/* static */
-void RadioService::convertProperties(radio_properties_t *properties,
- const radio_hal_properties_t *halProperties)
-{
- memset(properties, 0, sizeof(struct radio_properties));
- properties->class_id = halProperties->class_id;
- strlcpy(properties->implementor, halProperties->implementor,
- RADIO_STRING_LEN_MAX);
- strlcpy(properties->product, halProperties->product,
- RADIO_STRING_LEN_MAX);
- strlcpy(properties->version, halProperties->version,
- RADIO_STRING_LEN_MAX);
- strlcpy(properties->serial, halProperties->serial,
- RADIO_STRING_LEN_MAX);
- properties->num_tuners = halProperties->num_tuners;
- properties->num_audio_sources = halProperties->num_audio_sources;
- properties->supports_capture = halProperties->supports_capture;
-
- for (size_t i = 0; i < ARRAY_SIZE(sKnownRegionConfigs); i++) {
- const radio_hal_band_config_t *band = &sKnownRegionConfigs[i].band;
- size_t j;
- for (j = 0; j < halProperties->num_bands; j++) {
- const radio_hal_band_config_t *halBand = &halProperties->bands[j];
- size_t k;
- if (band->type != halBand->type) continue;
- if (band->lower_limit < halBand->lower_limit) continue;
- if (band->upper_limit > halBand->upper_limit) continue;
- for (k = 0; k < halBand->num_spacings; k++) {
- if (band->spacings[0] == halBand->spacings[k]) break;
- }
- if (k == halBand->num_spacings) continue;
- if (band->type == RADIO_BAND_AM) break;
- if ((band->fm.deemphasis & halBand->fm.deemphasis) == 0) continue;
- if (halBand->fm.rds == 0) break;
- if ((band->fm.rds & halBand->fm.rds) != 0) break;
- }
- if (j == halProperties->num_bands) continue;
-
- ALOGI("convertProperties() Adding band type %d region %d",
- sKnownRegionConfigs[i].band.type , sKnownRegionConfigs[i].region);
-
- memcpy(&properties->bands[properties->num_bands++],
- &sKnownRegionConfigs[i],
- sizeof(radio_band_config_t));
- }
-}
-
-#undef LOG_TAG
-#define LOG_TAG "RadioService::CallbackThread"
-
-RadioService::CallbackThread::CallbackThread(const wp<ModuleClient>& moduleClient)
- : mModuleClient(moduleClient), mMemoryDealer(new MemoryDealer(1024 * 1024, "RadioService"))
-{
-}
-
-RadioService::CallbackThread::~CallbackThread()
-{
- mEventQueue.clear();
-}
-
-void RadioService::CallbackThread::onFirstRef()
-{
- run("RadioService cbk", ANDROID_PRIORITY_URGENT_AUDIO);
-}
-
-bool RadioService::CallbackThread::threadLoop()
-{
- while (!exitPending()) {
- sp<IMemory> eventMemory;
- sp<ModuleClient> moduleClient;
- {
- Mutex::Autolock _l(mCallbackLock);
- while (mEventQueue.isEmpty() && !exitPending()) {
- ALOGV("CallbackThread::threadLoop() sleep");
- mCallbackCond.wait(mCallbackLock);
- ALOGV("CallbackThread::threadLoop() wake up");
- }
- if (exitPending()) {
- break;
- }
- eventMemory = mEventQueue[0];
- mEventQueue.removeAt(0);
- moduleClient = mModuleClient.promote();
- }
- if (moduleClient != 0) {
- moduleClient->onCallbackEvent(eventMemory);
- eventMemory.clear();
- }
- }
- return false;
-}
-
-void RadioService::CallbackThread::exit()
-{
- Mutex::Autolock _l(mCallbackLock);
- requestExit();
- mCallbackCond.broadcast();
-}
-
-sp<IMemory> RadioService::CallbackThread::prepareEvent(radio_hal_event_t *halEvent)
-{
- sp<IMemory> eventMemory;
-
- // The event layout in shared memory is:
- // sizeof(struct radio_event) bytes : the event itself
- // 4 bytes : metadata size or 0
- // N bytes : metadata if present
- uint32_t metadataOffset = sizeof(struct radio_event) + sizeof(uint32_t);
- uint32_t metadataSize = 0;
-
- switch (halEvent->type) {
- case RADIO_EVENT_TUNED:
- case RADIO_EVENT_AF_SWITCH:
- if (radio_metadata_check(halEvent->info.metadata) == 0) {
- metadataSize = (uint32_t)radio_metadata_get_size(halEvent->info.metadata);
- }
- break;
- case RADIO_EVENT_METADATA:
- if (radio_metadata_check(halEvent->metadata) != 0) {
- return eventMemory;
- }
- metadataSize = (uint32_t)radio_metadata_get_size(halEvent->metadata);
- break;
- default:
- break;
- }
-
- eventMemory = mMemoryDealer->allocate(metadataOffset + metadataSize);
- if (eventMemory == 0 || eventMemory->pointer() == NULL) {
- eventMemory.clear();
- return eventMemory;
- }
-
- struct radio_event *event = (struct radio_event *)eventMemory->pointer();
-
- *(uint32_t *)((uint8_t *)event + metadataOffset - sizeof(uint32_t)) = metadataSize;
-
- event->type = halEvent->type;
- event->status = halEvent->status;
-
- switch (event->type) {
- case RADIO_EVENT_CONFIG:
- event->config.band = halEvent->config;
- break;
- case RADIO_EVENT_TUNED:
- case RADIO_EVENT_AF_SWITCH:
- event->info = halEvent->info;
- if (metadataSize != 0) {
- memcpy((uint8_t *)event + metadataOffset, halEvent->info.metadata, metadataSize);
- }
- break;
- case RADIO_EVENT_TA:
- case RADIO_EVENT_EA:
- case RADIO_EVENT_ANTENNA:
- case RADIO_EVENT_CONTROL:
- event->on = halEvent->on;
- break;
- case RADIO_EVENT_METADATA:
- if (metadataSize != 0) {
- memcpy((uint8_t *)event + metadataOffset, halEvent->metadata, metadataSize);
- }
- break;
- case RADIO_EVENT_HW_FAILURE:
- default:
- break;
- }
-
- return eventMemory;
-}
-
-void RadioService::CallbackThread::sendEvent(radio_hal_event_t *event)
- {
- sp<IMemory> eventMemory = prepareEvent(event);
- if (eventMemory == 0) {
- return;
- }
-
- AutoMutex lock(mCallbackLock);
- mEventQueue.add(eventMemory);
- mCallbackCond.signal();
- ALOGV("%s DONE", __FUNCTION__);
-}
-
-
-#undef LOG_TAG
-#define LOG_TAG "RadioService::Module"
-
-RadioService::Module::Module(sp<RadioInterface> hwDevice, radio_properties properties)
- : mHwDevice(hwDevice), mProperties(properties), mMute(true)
-{
-}
-
-RadioService::Module::~Module() {
- mHwDevice.clear();
- mModuleClients.clear();
-}
-
-status_t RadioService::Module::dump(int fd __unused, const Vector<String16>& args __unused) {
- String8 result;
- return NO_ERROR;
-}
-
-sp<RadioService::ModuleClient> RadioService::Module::addClient(const sp<IRadioClient>& client,
- const struct radio_band_config *config,
- bool audio)
-{
- ALOGV("addClient() %p config %p product %s", this, config, mProperties.product);
-
- AutoMutex lock(mLock);
- sp<ModuleClient> moduleClient;
- int ret;
-
- if (mHwDevice == 0) {
- return moduleClient;
- }
-
- for (size_t i = 0; i < mModuleClients.size(); i++) {
- if (mModuleClients[i]->client() == client) {
- // client already connected: reject
- return moduleClient;
- }
- }
- moduleClient = new ModuleClient(this, client, config, audio);
-
- struct radio_hal_band_config halConfig;
- halConfig = config->band;
-
- // Tuner preemption logic:
- // There is a limited amount of tuners and a limited amount of radio audio sources per module.
- // The minimum is one tuner and one audio source.
- // The numbers of tuners and sources are indicated in the module properties.
- // NOTE: current framework implementation only supports one radio audio source.
- // It is possible to open more than one tuner at a time but only one tuner can be connected
- // to the radio audio source (AUDIO_DEVICE_IN_FM_TUNER).
- // The base rule is that a newly connected tuner always wins, i.e. always gets a tuner
- // and can use the audio source if requested.
- // If another client is preempted, it is notified by a callback with RADIO_EVENT_CONTROL
- // indicating loss of control.
- // - If the newly connected client requests the audio source (audio == true):
- // - if an audio source is available
- // no problem
- // - if not:
- // the oldest client in the list using audio is preempted.
- // - If the newly connected client does not request the audio source (audio == false):
- // - if a tuner is available
- // no problem
- // - if not:
- // The oldest client not using audio is preempted first and if none is found the
- // the oldest client using audio is preempted.
- // Each time a tuner using the audio source is opened or closed, the audio policy manager is
- // notified of the connection or disconnection of AUDIO_DEVICE_IN_FM_TUNER.
-
- sp<ModuleClient> oldestTuner;
- sp<ModuleClient> oldestAudio;
- size_t allocatedTuners = 0;
- size_t allocatedAudio = 0;
- for (size_t i = 0; i < mModuleClients.size(); i++) {
- if (mModuleClients[i]->getTuner() != NULL) {
- if (mModuleClients[i]->audio()) {
- if (oldestAudio == 0) {
- oldestAudio = mModuleClients[i];
- }
- allocatedAudio++;
- } else {
- if (oldestTuner == 0) {
- oldestTuner = mModuleClients[i];
- }
- allocatedTuners++;
- }
- }
- }
-
- sp<TunerInterface> halTuner;
- sp<ModuleClient> preemtedClient;
- if (audio) {
- if (allocatedAudio >= mProperties.num_audio_sources) {
- ALOG_ASSERT(oldestAudio != 0, "addClient() allocatedAudio/oldestAudio mismatch");
- preemtedClient = oldestAudio;
- }
- } else {
- if (allocatedAudio + allocatedTuners >= mProperties.num_tuners) {
- if (allocatedTuners != 0) {
- ALOG_ASSERT(oldestTuner != 0, "addClient() allocatedTuners/oldestTuner mismatch");
- preemtedClient = oldestTuner;
- } else {
- ALOG_ASSERT(oldestAudio != 0, "addClient() allocatedAudio/oldestAudio mismatch");
- preemtedClient = oldestAudio;
- }
- }
- }
- if (preemtedClient != 0) {
- halTuner = preemtedClient->getTuner();
- sp<TunerInterface> clear;
- preemtedClient->setTuner(clear);
- mHwDevice->closeTuner(halTuner);
- if (preemtedClient->audio()) {
- notifyDeviceConnection(false, "");
- }
- }
-
- ret = mHwDevice->openTuner(&halConfig, audio,
- moduleClient,
- halTuner);
- if (ret == 0) {
- ALOGV("addClient() setTuner %p", halTuner.get());
- moduleClient->setTuner(halTuner);
- mModuleClients.add(moduleClient);
- if (audio) {
- notifyDeviceConnection(true, "");
- }
- ALOGV("addClient() DONE moduleClient %p", moduleClient.get());
- } else {
- ALOGW("%s open_tuner failed with error %d", __FUNCTION__, ret);
- moduleClient.clear();
- }
-
- return moduleClient;
-}
-
-void RadioService::Module::removeClient(const sp<ModuleClient>& moduleClient) {
- ALOGV("removeClient()");
- AutoMutex lock(mLock);
- int ret;
- ssize_t index = -1;
-
- for (size_t i = 0; i < mModuleClients.size(); i++) {
- if (mModuleClients[i] == moduleClient) {
- index = i;
- break;
- }
- }
- if (index == -1) {
- return;
- }
-
- mModuleClients.removeAt(index);
- sp<TunerInterface> halTuner = moduleClient->getTuner();
- if (halTuner == NULL) {
- return;
- }
-
- if (mHwDevice != 0) {
- mHwDevice->closeTuner(halTuner);
- }
-
- if (moduleClient->audio()) {
- notifyDeviceConnection(false, "");
- }
-
- mMute = true;
-
- if (mModuleClients.isEmpty()) {
- return;
- }
-
- if (mHwDevice == 0) {
- return;
- }
-
- // Tuner reallocation logic:
- // When a client is removed and was controlling a tuner, this tuner will be allocated to a
- // previously preempted client. This client will be notified by a callback with
- // RADIO_EVENT_CONTROL indicating gain of control.
- // - If a preempted client is waiting for an audio source and one becomes available:
- // Allocate the tuner to the most recently added client waiting for an audio source
- // - If not:
- // Allocate the tuner to the most recently added client.
- // Each time a tuner using the audio source is opened or closed, the audio policy manager is
- // notified of the connection or disconnection of AUDIO_DEVICE_IN_FM_TUNER.
-
- sp<ModuleClient> youngestClient;
- sp<ModuleClient> youngestClientAudio;
- size_t allocatedTuners = 0;
- size_t allocatedAudio = 0;
- for (ssize_t i = mModuleClients.size() - 1; i >= 0; i--) {
- if (mModuleClients[i]->getTuner() == NULL) {
- if (mModuleClients[i]->audio()) {
- if (youngestClientAudio == 0) {
- youngestClientAudio = mModuleClients[i];
- }
- } else {
- if (youngestClient == 0) {
- youngestClient = mModuleClients[i];
- }
- }
- } else {
- if (mModuleClients[i]->audio()) {
- allocatedAudio++;
- } else {
- allocatedTuners++;
- }
- }
- }
-
- ALOG_ASSERT(allocatedTuners + allocatedAudio < mProperties.num_tuners,
- "removeClient() removed client but no tuner available");
-
- ALOG_ASSERT(!moduleClient->audio() || allocatedAudio < mProperties.num_audio_sources,
- "removeClient() removed audio client but no tuner with audio available");
-
- if (allocatedAudio < mProperties.num_audio_sources && youngestClientAudio != 0) {
- youngestClient = youngestClientAudio;
- }
-
- ALOG_ASSERT(youngestClient != 0, "removeClient() removed client no candidate found for tuner");
-
- struct radio_hal_band_config halConfig = youngestClient->halConfig();
- ret = mHwDevice->openTuner(&halConfig, youngestClient->audio(),
- moduleClient,
- halTuner);
-
- if (ret == 0) {
- youngestClient->setTuner(halTuner);
- if (youngestClient->audio()) {
- notifyDeviceConnection(true, "");
- }
- }
-}
-
-status_t RadioService::Module::setMute(bool mute)
-{
- Mutex::Autolock _l(mLock);
- if (mute != mMute) {
- mMute = mute;
- //TODO notifify audio policy manager of media activity on radio audio device
- }
- return NO_ERROR;
-}
-
-status_t RadioService::Module::getMute(bool *mute)
-{
- Mutex::Autolock _l(mLock);
- *mute = mMute;
- return NO_ERROR;
-}
-
-
-const struct radio_band_config *RadioService::Module::getDefaultConfig() const
-{
- if (mProperties.num_bands == 0) {
- return NULL;
- }
- return &mProperties.bands[0];
-}
-
-void RadioService::Module::notifyDeviceConnection(bool connected,
- const char *address) {
- int64_t token = IPCThreadState::self()->clearCallingIdentity();
- AudioSystem::setDeviceConnectionState(AUDIO_DEVICE_IN_FM_TUNER,
- connected ? AUDIO_POLICY_DEVICE_STATE_AVAILABLE :
- AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE,
- address, kRadioTunerAudioDeviceName);
- IPCThreadState::self()->restoreCallingIdentity(token);
-}
-
-#undef LOG_TAG
-#define LOG_TAG "RadioService::ModuleClient"
-
-RadioService::ModuleClient::ModuleClient(const sp<Module>& module,
- const sp<IRadioClient>& client,
- const struct radio_band_config *config,
- bool audio)
- : mModule(module), mClient(client), mConfig(*config), mAudio(audio), mTuner(0)
-{
-}
-
-void RadioService::ModuleClient::onFirstRef()
-{
- mCallbackThread = new CallbackThread(this);
- IInterface::asBinder(mClient)->linkToDeath(this);
-}
-
-RadioService::ModuleClient::~ModuleClient() {
- if (mClient != 0) {
- IInterface::asBinder(mClient)->unlinkToDeath(this);
- mClient.clear();
- }
- if (mCallbackThread != 0) {
- mCallbackThread->exit();
- }
-}
-
-void RadioService::ModuleClient::onEvent(radio_hal_event_t *halEvent)
-{
- mCallbackThread->sendEvent(halEvent);
-}
-
-status_t RadioService::ModuleClient::dump(int fd __unused,
- const Vector<String16>& args __unused) {
- String8 result;
- return NO_ERROR;
-}
-
-void RadioService::ModuleClient::detach() {
- ALOGV("%s", __FUNCTION__);
- sp<ModuleClient> strongMe = this;
- {
- AutoMutex lock(mLock);
- if (mClient != 0) {
- IInterface::asBinder(mClient)->unlinkToDeath(this);
- mClient.clear();
- }
- }
- sp<Module> module = mModule.promote();
- if (module == 0) {
- return;
- }
- module->removeClient(this);
-}
-
-radio_hal_band_config_t RadioService::ModuleClient::halConfig() const
-{
- AutoMutex lock(mLock);
- ALOGV("%s locked", __FUNCTION__);
- return mConfig.band;
-}
-
-sp<TunerInterface>& RadioService::ModuleClient::getTuner()
-{
- AutoMutex lock(mLock);
- ALOGV("%s locked", __FUNCTION__);
- return mTuner;
-}
-
-void RadioService::ModuleClient::setTuner(sp<TunerInterface>& tuner)
-{
- ALOGV("%s %p", __FUNCTION__, this);
-
- AutoMutex lock(mLock);
- mTuner = tuner;
- ALOGV("%s locked", __FUNCTION__);
-
- radio_hal_event_t event;
- event.type = RADIO_EVENT_CONTROL;
- event.status = 0;
- event.on = mTuner != 0;
- mCallbackThread->sendEvent(&event);
- ALOGV("%s DONE", __FUNCTION__);
-
-}
-
-status_t RadioService::ModuleClient::setConfiguration(const struct radio_band_config *config)
-{
- if (!PermissionCache::checkCallingPermission(RADIO_PERMISSION)) {
- return PERMISSION_DENIED;
- }
- AutoMutex lock(mLock);
- status_t status = NO_ERROR;
- ALOGV("%s locked", __FUNCTION__);
-
- if (mTuner != 0) {
- struct radio_hal_band_config halConfig;
- halConfig = config->band;
- status = (status_t)mTuner->setConfiguration(&halConfig);
- if (status == NO_ERROR) {
- mConfig = *config;
- }
- } else {
- mConfig = *config;
- status = INVALID_OPERATION;
- }
-
- return status;
-}
-
-status_t RadioService::ModuleClient::getConfiguration(struct radio_band_config *config)
-{
- if (!PermissionCache::checkCallingPermission(RADIO_PERMISSION)) {
- return PERMISSION_DENIED;
- }
- AutoMutex lock(mLock);
- status_t status = NO_ERROR;
- ALOGV("%s locked", __FUNCTION__);
-
- if (mTuner != 0) {
- struct radio_hal_band_config halConfig;
- status = (status_t)mTuner->getConfiguration(&halConfig);
- if (status == NO_ERROR) {
- mConfig.band = halConfig;
- }
- }
- *config = mConfig;
-
- return status;
-}
-
-status_t RadioService::ModuleClient::setMute(bool mute)
-{
- if (!PermissionCache::checkCallingPermission(RADIO_PERMISSION)) {
- return PERMISSION_DENIED;
- }
- sp<Module> module;
- {
- Mutex::Autolock _l(mLock);
- ALOGV("%s locked", __FUNCTION__);
- if (mTuner == 0 || !mAudio) {
- return INVALID_OPERATION;
- }
- module = mModule.promote();
- if (module == 0) {
- return NO_INIT;
- }
- }
- module->setMute(mute);
- return NO_ERROR;
-}
-
-status_t RadioService::ModuleClient::getMute(bool *mute)
-{
- if (!PermissionCache::checkCallingPermission(RADIO_PERMISSION)) {
- return PERMISSION_DENIED;
- }
- sp<Module> module;
- {
- Mutex::Autolock _l(mLock);
- ALOGV("%s locked", __FUNCTION__);
- module = mModule.promote();
- if (module == 0) {
- return NO_INIT;
- }
- }
- return module->getMute(mute);
-}
-
-status_t RadioService::ModuleClient::scan(radio_direction_t direction, bool skipSubChannel)
-{
- if (!PermissionCache::checkCallingPermission(RADIO_PERMISSION)) {
- return PERMISSION_DENIED;
- }
- AutoMutex lock(mLock);
- ALOGV("%s locked", __FUNCTION__);
- status_t status;
- if (mTuner != 0) {
- status = (status_t)mTuner->scan(direction, skipSubChannel);
- } else {
- status = INVALID_OPERATION;
- }
- return status;
-}
-
-status_t RadioService::ModuleClient::step(radio_direction_t direction, bool skipSubChannel)
-{
- if (!PermissionCache::checkCallingPermission(RADIO_PERMISSION)) {
- return PERMISSION_DENIED;
- }
- AutoMutex lock(mLock);
- ALOGV("%s locked", __FUNCTION__);
- status_t status;
- if (mTuner != 0) {
- status = (status_t)mTuner->step(direction, skipSubChannel);
- } else {
- status = INVALID_OPERATION;
- }
- return status;
-}
-
-status_t RadioService::ModuleClient::tune(uint32_t channel, uint32_t subChannel)
-{
- if (!PermissionCache::checkCallingPermission(RADIO_PERMISSION)) {
- return PERMISSION_DENIED;
- }
- AutoMutex lock(mLock);
- ALOGV("%s locked", __FUNCTION__);
- status_t status;
- if (mTuner != 0) {
- status = (status_t)mTuner->tune(channel, subChannel);
- } else {
- status = INVALID_OPERATION;
- }
- return status;
-}
-
-status_t RadioService::ModuleClient::cancel()
-{
- if (!PermissionCache::checkCallingPermission(RADIO_PERMISSION)) {
- return PERMISSION_DENIED;
- }
- AutoMutex lock(mLock);
- ALOGV("%s locked", __FUNCTION__);
- status_t status;
- if (mTuner != 0) {
- status = (status_t)mTuner->cancel();
- } else {
- status = INVALID_OPERATION;
- }
- return status;
-}
-
-status_t RadioService::ModuleClient::getProgramInformation(struct radio_program_info *info)
-{
- if (!PermissionCache::checkCallingPermission(RADIO_PERMISSION)) {
- return PERMISSION_DENIED;
- }
- AutoMutex lock(mLock);
- ALOGV("%s locked", __FUNCTION__);
- status_t status;
- if (mTuner != NULL) {
- status = (status_t)mTuner->getProgramInformation(info);
- } else {
- status = INVALID_OPERATION;
- }
-
- return status;
-}
-
-status_t RadioService::ModuleClient::hasControl(bool *hasControl)
-{
- if (!PermissionCache::checkCallingPermission(RADIO_PERMISSION)) {
- return PERMISSION_DENIED;
- }
- Mutex::Autolock lock(mLock);
- ALOGV("%s locked", __FUNCTION__);
- *hasControl = mTuner != 0;
- return NO_ERROR;
-}
-
-void RadioService::ModuleClient::onCallbackEvent(const sp<IMemory>& eventMemory)
-{
- if (eventMemory == 0 || eventMemory->pointer() == NULL) {
- return;
- }
-
- sp<IRadioClient> client;
- {
- AutoMutex lock(mLock);
- ALOGV("%s locked", __FUNCTION__);
- radio_event_t *event = (radio_event_t *)eventMemory->pointer();
- switch (event->type) {
- case RADIO_EVENT_CONFIG:
- mConfig.band = event->config.band;
- event->config.region = mConfig.region;
- break;
- default:
- break;
- }
-
- client = mClient;
- }
- if (client != 0) {
- client->onEvent(eventMemory);
- }
-}
-
-
-void RadioService::ModuleClient::binderDied(
- const wp<IBinder> &who __unused) {
- ALOGW("client binder died for client %p", this);
- detach();
-}
-
-}; // namespace android
diff --git a/services/radio/RadioService.h b/services/radio/RadioService.h
deleted file mode 100644
index 444eb7a..0000000
--- a/services/radio/RadioService.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_RADIO_SERVICE_H
-#define ANDROID_HARDWARE_RADIO_SERVICE_H
-
-#include <utils/Vector.h>
-//#include <binder/AppOpsManager.h>
-#include <binder/MemoryDealer.h>
-#include <binder/BinderService.h>
-#include <binder/IAppOpsCallback.h>
-#include <radio/IRadioService.h>
-#include <radio/IRadio.h>
-#include <radio/IRadioClient.h>
-#include <system/radio.h>
-#include <hardware/radio.h>
-#include "RadioInterface.h"
-#include "TunerInterface.h"
-#include "TunerCallbackInterface.h"
-
-namespace android {
-
-class MemoryHeapBase;
-
-class RadioService :
- public BinderService<RadioService>,
- public BnRadioService
-{
- friend class BinderService<RadioService>;
-
-public:
- class ModuleClient;
- class Module;
-
- static char const* getServiceName() { return "media.radio"; }
-
- RadioService();
- virtual ~RadioService();
-
- // IRadioService
- virtual status_t listModules(struct radio_properties *properties,
- uint32_t *numModules);
-
- virtual status_t attach(radio_handle_t handle,
- const sp<IRadioClient>& client,
- const struct radio_band_config *config,
- bool withAudio,
- sp<IRadio>& radio);
-
- virtual status_t onTransact(uint32_t code, const Parcel& data,
- Parcel* reply, uint32_t flags);
-
- virtual status_t dump(int fd, const Vector<String16>& args);
-
-
- class Module : public virtual RefBase {
- public:
-
- Module(sp<RadioInterface> hwDevice,
- struct radio_properties properties);
-
- virtual ~Module();
-
- sp<ModuleClient> addClient(const sp<IRadioClient>& client,
- const struct radio_band_config *config,
- bool audio);
-
- void removeClient(const sp<ModuleClient>& moduleClient);
-
- status_t setMute(bool mute);
-
- status_t getMute(bool *mute);
-
- virtual status_t dump(int fd, const Vector<String16>& args);
-
- sp<RadioInterface> hwDevice() const { return mHwDevice; }
- const struct radio_properties properties() const { return mProperties; }
- const struct radio_band_config *getDefaultConfig() const ;
-
- private:
-
- void notifyDeviceConnection(bool connected, const char *address);
-
- Mutex mLock; // protects mModuleClients
- sp<RadioInterface> mHwDevice; // HAL hardware device
- const struct radio_properties mProperties; // cached hardware module properties
- Vector< sp<ModuleClient> > mModuleClients; // list of attached clients
- bool mMute; // radio audio source state
- // when unmuted, audio is routed to the
- // output device selected for media use case.
- }; // class Module
-
- class CallbackThread : public Thread {
- public:
-
- explicit CallbackThread(const wp<ModuleClient>& moduleClient);
-
- virtual ~CallbackThread();
-
-
- // Thread virtuals
- virtual bool threadLoop();
-
- // RefBase
- virtual void onFirstRef();
-
- void exit();
-
- void sendEvent(radio_hal_event_t *halEvent);
- sp<IMemory> prepareEvent(radio_hal_event_t *halEvent);
-
- private:
- wp<ModuleClient> mModuleClient; // client module the thread belongs to
- Condition mCallbackCond; // condition signaled when a new event is posted
- Mutex mCallbackLock; // protects mEventQueue
- Vector< sp<IMemory> > mEventQueue; // pending callback events
- sp<MemoryDealer> mMemoryDealer; // shared memory for callback event
- }; // class CallbackThread
-
- class ModuleClient : public BnRadio,
- public IBinder::DeathRecipient,
- public TunerCallbackInterface {
- public:
-
- ModuleClient(const sp<Module>& module,
- const sp<IRadioClient>& client,
- const struct radio_band_config *config,
- bool audio);
-
- virtual ~ModuleClient();
-
- // IRadio
- virtual void detach();
-
- virtual status_t setConfiguration(const struct radio_band_config *config);
-
- virtual status_t getConfiguration(struct radio_band_config *config);
-
- virtual status_t setMute(bool mute);
-
- virtual status_t getMute(bool *mute);
-
- virtual status_t scan(radio_direction_t direction, bool skipSubChannel);
-
- virtual status_t step(radio_direction_t direction, bool skipSubChannel);
-
- virtual status_t tune(unsigned int channel, unsigned int subChannel);
-
- virtual status_t cancel();
-
- virtual status_t getProgramInformation(struct radio_program_info *info);
-
- virtual status_t hasControl(bool *hasControl);
-
- virtual status_t dump(int fd, const Vector<String16>& args);
-
- sp<IRadioClient> client() const { return mClient; }
- wp<Module> module() const { return mModule; }
- radio_hal_band_config_t halConfig() const;
- sp<CallbackThread> callbackThread() const { return mCallbackThread; }
- void setTuner(sp<TunerInterface>& tuner);
- sp<TunerInterface>& getTuner();
- bool audio() const { return mAudio; }
-
- void onCallbackEvent(const sp<IMemory>& event);
-
- virtual void onFirstRef();
-
-
- // IBinder::DeathRecipient implementation
- virtual void binderDied(const wp<IBinder> &who);
-
- // TunerCallbackInterface
- virtual void onEvent(radio_hal_event_t *event);
-
- private:
-
- mutable Mutex mLock; // protects mClient, mConfig and mTuner
- wp<Module> mModule; // The module this client is attached to
- sp<IRadioClient> mClient; // event callback binder interface
- radio_band_config_t mConfig; // current band configuration
- sp<CallbackThread> mCallbackThread; // event callback thread
- const bool mAudio;
- sp<TunerInterface> mTuner; // HAL tuner interface. NULL indicates that
- // this client does not have control on any
- // tuner
- }; // class ModuleClient
-
-
- static void callback(radio_hal_event_t *halEvent, void *cookie);
-
-private:
-
- virtual void onFirstRef();
-
- static void convertProperties(radio_properties_t *properties,
- const radio_hal_properties_t *halProperties);
- Mutex mServiceLock; // protects mModules
- volatile int32_t mNextUniqueId; // for module ID allocation
- DefaultKeyedVector< radio_handle_t, sp<Module> > mModules;
-};
-
-} // namespace android
-
-#endif // ANDROID_HARDWARE_RADIO_SERVICE_H
diff --git a/services/radio/TunerCallbackInterface.h b/services/radio/TunerCallbackInterface.h
deleted file mode 100644
index 4973cce..0000000
--- a/services/radio/TunerCallbackInterface.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_TUNER_CALLBACK_INTERFACE_H
-#define ANDROID_HARDWARE_TUNER_CALLBACK_INTERFACE_H
-
-#include <utils/RefBase.h>
-#include <system/radio.h>
-
-namespace android {
-
-class TunerCallbackInterface : public virtual RefBase
-{
-public:
- virtual void onEvent(radio_hal_event_t *event) = 0;
-
-protected:
- TunerCallbackInterface() {}
- virtual ~TunerCallbackInterface() {}
-
-};
-
-} // namespace android
-
-#endif // ANDROID_HARDWARE_TUNER_CALLBACK_INTERFACE_H
diff --git a/services/radio/TunerInterface.h b/services/radio/TunerInterface.h
deleted file mode 100644
index 4e657d3..0000000
--- a/services/radio/TunerInterface.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_TUNER_INTERFACE_H
-#define ANDROID_HARDWARE_TUNER_INTERFACE_H
-
-#include <utils/RefBase.h>
-#include <system/radio.h>
-
-namespace android {
-
-class TunerInterface : public virtual RefBase
-{
-public:
- /*
- * Apply current radio band configuration (band, range, channel spacing ...).
- *
- * arguments:
- * - config: the band configuration to apply
- *
- * returns:
- * 0 if configuration could be applied
- * -EINVAL if configuration requested is invalid
- *
- * Automatically cancels pending scan, step or tune.
- *
- * Callback function with event RADIO_EVENT_CONFIG MUST be called once the
- * configuration is applied or a failure occurs or after a time out.
- */
- virtual int setConfiguration(const radio_hal_band_config_t *config) = 0;
-
- /*
- * Retrieve current radio band configuration.
- *
- * arguments:
- * - config: where to return the band configuration
- *
- * returns:
- * 0 if valid configuration is returned
- * -EINVAL if invalid arguments are passed
- */
- virtual int getConfiguration(radio_hal_band_config_t *config) = 0;
-
- /*
- * Start scanning up to next valid station.
- * Must be called when a valid configuration has been applied.
- *
- * arguments:
- * - direction: RADIO_DIRECTION_UP or RADIO_DIRECTION_DOWN
- * - skip_sub_channel: valid for HD radio or digital radios only: ignore sub channels
- * (e.g SPS for HD radio).
- *
- * returns:
- * 0 if scan successfully started
- * -ENOSYS if called out of sequence
- * -ENODEV if another error occurs
- *
- * Automatically cancels pending scan, step or tune.
- *
- * Callback function with event RADIO_EVENT_TUNED MUST be called once
- * locked on a station or after a time out or full frequency scan if
- * no station found. The event status should indicate if a valid station
- * is tuned or not.
- */
- virtual int scan(radio_direction_t direction, bool skip_sub_channel) = 0;
-
- /*
- * Move one channel spacing up or down.
- * Must be called when a valid configuration has been applied.
- *
- * arguments:
- * - direction: RADIO_DIRECTION_UP or RADIO_DIRECTION_DOWN
- * - skip_sub_channel: valid for HD radio or digital radios only: ignore sub channels
- * (e.g SPS for HD radio).
- *
- * returns:
- * 0 if step successfully started
- * -ENOSYS if called out of sequence
- * -ENODEV if another error occurs
- *
- * Automatically cancels pending scan, step or tune.
- *
- * Callback function with event RADIO_EVENT_TUNED MUST be called once
- * step completed or after a time out. The event status should indicate
- * if a valid station is tuned or not.
- */
- virtual int step(radio_direction_t direction, bool skip_sub_channel) = 0;
-
- /*
- * Tune to specified frequency.
- * Must be called when a valid configuration has been applied.
- *
- * arguments:
- * - channel: channel to tune to. A frequency in kHz for AM/FM/HD Radio bands.
- * - sub_channel: valid for HD radio or digital radios only: (e.g SPS number for HD radio).
- *
- * returns:
- * 0 if tune successfully started
- * -ENOSYS if called out of sequence
- * -EINVAL if invalid arguments are passed
- * -ENODEV if another error occurs
- *
- * Automatically cancels pending scan, step or tune.
- *
- * Callback function with event RADIO_EVENT_TUNED MUST be called once
- * tuned or after a time out. The event status should indicate
- * if a valid station is tuned or not.
- */
- virtual int tune(unsigned int channel, unsigned int sub_channel) = 0;
-
- /*
- * Cancel a scan, step or tune operation.
- * Must be called while a scan, step or tune operation is pending
- * (callback not yet sent).
- *
- * returns:
- * 0 if successful
- * -ENOSYS if called out of sequence
- * -ENODEV if another error occurs
- *
- * The callback is not sent.
- */
- virtual int cancel() = 0;
-
- /*
- * Retrieve current station information.
- *
- * arguments:
- * - info: where to return the program info.
- * If info->metadata is NULL. no meta data should be returned.
- * If meta data must be returned, they should be added to or cloned to
- * info->metadata, not passed from a newly created meta data buffer.
- *
- * returns:
- * 0 if tuned and information available
- * -EINVAL if invalid arguments are passed
- * -ENODEV if another error occurs
- */
- virtual int getProgramInformation(radio_program_info_t *info) = 0;
-
-protected:
- TunerInterface() {}
- virtual ~TunerInterface() {}
-
-};
-
-} // namespace android
-
-#endif // ANDROID_HARDWARE_TUNER_INTERFACE_H
diff --git a/services/soundtrigger/SoundTriggerHwService.cpp b/services/soundtrigger/SoundTriggerHwService.cpp
index 5b8d990..22519a3 100644
--- a/services/soundtrigger/SoundTriggerHwService.cpp
+++ b/services/soundtrigger/SoundTriggerHwService.cpp
@@ -89,7 +89,8 @@
uint32_t *numModules)
{
ALOGV("listModules");
- if (!captureHotwordAllowed()) {
+ if (!captureHotwordAllowed(IPCThreadState::self()->getCallingPid(),
+ IPCThreadState::self()->getCallingUid())) {
return PERMISSION_DENIED;
}
@@ -110,7 +111,8 @@
sp<ISoundTrigger>& moduleInterface)
{
ALOGV("attach module %d", handle);
- if (!captureHotwordAllowed()) {
+ if (!captureHotwordAllowed(IPCThreadState::self()->getCallingPid(),
+ IPCThreadState::self()->getCallingUid())) {
return PERMISSION_DENIED;
}
@@ -528,37 +530,45 @@
void SoundTriggerHwService::Module::detach(const sp<ModuleClient>& moduleClient)
{
ALOGV("Module::detach()");
- AutoMutex lock(mLock);
- ssize_t index = -1;
+ Vector<audio_session_t> releasedSessions;
- for (size_t i = 0; i < mModuleClients.size(); i++) {
- if (mModuleClients[i] == moduleClient) {
- index = i;
- break;
- }
- }
- if (index == -1) {
- return;
- }
+ {
+ AutoMutex lock(mLock);
+ ssize_t index = -1;
- ALOGV("remove client %p", moduleClient.get());
- mModuleClients.removeAt(index);
-
- // Iterate in reverse order as models are removed from list inside the loop.
- for (size_t i = mModels.size(); i > 0; i--) {
- sp<Model> model = mModels.valueAt(i - 1);
- if (moduleClient == model->mModuleClient) {
- mModels.removeItemsAt(i - 1);
- ALOGV("detach() unloading model %d", model->mHandle);
- if (mHalInterface != 0) {
- if (model->mState == Model::STATE_ACTIVE) {
- mHalInterface->stopRecognition(model->mHandle);
- }
- mHalInterface->unloadSoundModel(model->mHandle);
+ for (size_t i = 0; i < mModuleClients.size(); i++) {
+ if (mModuleClients[i] == moduleClient) {
+ index = i;
+ break;
}
- AudioSystem::releaseSoundTriggerSession(model->mCaptureSession);
- mHalInterface->unloadSoundModel(model->mHandle);
}
+ if (index == -1) {
+ return;
+ }
+
+ ALOGV("remove client %p", moduleClient.get());
+ mModuleClients.removeAt(index);
+
+ // Iterate in reverse order as models are removed from list inside the loop.
+ for (size_t i = mModels.size(); i > 0; i--) {
+ sp<Model> model = mModels.valueAt(i - 1);
+ if (moduleClient == model->mModuleClient) {
+ mModels.removeItemsAt(i - 1);
+ ALOGV("detach() unloading model %d", model->mHandle);
+ if (mHalInterface != 0) {
+ if (model->mState == Model::STATE_ACTIVE) {
+ mHalInterface->stopRecognition(model->mHandle);
+ }
+ mHalInterface->unloadSoundModel(model->mHandle);
+ }
+ releasedSessions.add(model->mCaptureSession);
+ }
+ }
+ }
+
+ for (size_t i = 0; i < releasedSessions.size(); i++) {
+ // do not call AudioSystem methods with mLock held
+ AudioSystem::releaseSoundTriggerSession(releasedSessions[i]);
}
}
@@ -593,61 +603,71 @@
return BAD_VALUE;
}
- AutoMutex lock(mLock);
-
- if (mModels.size() >= mDescriptor.properties.max_sound_models) {
- ALOGW("loadSoundModel(): Not loading, max number of models (%d) would be exceeded",
- mDescriptor.properties.max_sound_models);
- return INVALID_OPERATION;
- }
-
- status_t status = mHalInterface->loadSoundModel(sound_model,
- SoundTriggerHwService::soundModelCallback,
- this, handle);
-
- if (status != NO_ERROR) {
- return status;
- }
audio_session_t session;
audio_io_handle_t ioHandle;
audio_devices_t device;
-
- status = AudioSystem::acquireSoundTriggerSession(&session, &ioHandle, &device);
+ // do not call AudioSystem methods with mLock held
+ status_t status = AudioSystem::acquireSoundTriggerSession(&session, &ioHandle, &device);
if (status != NO_ERROR) {
return status;
}
- sp<Model> model = new Model(*handle, session, ioHandle, device, sound_model->type,
- moduleClient);
- mModels.replaceValueFor(*handle, model);
+ {
+ AutoMutex lock(mLock);
+ if (mModels.size() >= mDescriptor.properties.max_sound_models) {
+ ALOGW("loadSoundModel(): Not loading, max number of models (%d) would be exceeded",
+ mDescriptor.properties.max_sound_models);
+ status = INVALID_OPERATION;
+ goto exit;
+ }
+
+ status = mHalInterface->loadSoundModel(sound_model,
+ SoundTriggerHwService::soundModelCallback,
+ this, handle);
+ if (status != NO_ERROR) {
+ goto exit;
+ }
+
+ sp<Model> model = new Model(*handle, session, ioHandle, device, sound_model->type,
+ moduleClient);
+ mModels.replaceValueFor(*handle, model);
+ }
+exit:
+ if (status != NO_ERROR) {
+ // do not call AudioSystem methods with mLock held
+ AudioSystem::releaseSoundTriggerSession(session);
+ }
return status;
}
status_t SoundTriggerHwService::Module::unloadSoundModel(sound_model_handle_t handle)
{
ALOGV("unloadSoundModel() model handle %d", handle);
- AutoMutex lock(mLock);
- return unloadSoundModel_l(handle);
-}
+ status_t status;
+ audio_session_t session;
-status_t SoundTriggerHwService::Module::unloadSoundModel_l(sound_model_handle_t handle)
-{
- if (mHalInterface == 0) {
- return NO_INIT;
+ {
+ AutoMutex lock(mLock);
+ if (mHalInterface == 0) {
+ return NO_INIT;
+ }
+ ssize_t index = mModels.indexOfKey(handle);
+ if (index < 0) {
+ return BAD_VALUE;
+ }
+ sp<Model> model = mModels.valueAt(index);
+ mModels.removeItem(handle);
+ if (model->mState == Model::STATE_ACTIVE) {
+ mHalInterface->stopRecognition(model->mHandle);
+ model->mState = Model::STATE_IDLE;
+ }
+ status = mHalInterface->unloadSoundModel(handle);
+ session = model->mCaptureSession;
}
- ssize_t index = mModels.indexOfKey(handle);
- if (index < 0) {
- return BAD_VALUE;
- }
- sp<Model> model = mModels.valueAt(index);
- mModels.removeItem(handle);
- if (model->mState == Model::STATE_ACTIVE) {
- mHalInterface->stopRecognition(model->mHandle);
- model->mState = Model::STATE_IDLE;
- }
- AudioSystem::releaseSoundTriggerSession(model->mCaptureSession);
- return mHalInterface->unloadSoundModel(handle);
+ // do not call AudioSystem methods with mLock held
+ AudioSystem::releaseSoundTriggerSession(session);
+ return status;
}
status_t SoundTriggerHwService::Module::startRecognition(sound_model_handle_t handle,
@@ -838,7 +858,7 @@
}
const bool supports_stop_all =
- (mHalInterface != 0) && (mHalInterface->stopAllRecognitions() == ENOSYS);
+ (mHalInterface != 0) && (mHalInterface->stopAllRecognitions() != -ENOSYS);
for (size_t i = 0; i < mModels.size(); i++) {
sp<Model> model = mModels.valueAt(i);
@@ -942,7 +962,8 @@
void SoundTriggerHwService::ModuleClient::detach() {
ALOGV("detach()");
- if (!captureHotwordAllowed()) {
+ if (!captureHotwordAllowed(IPCThreadState::self()->getCallingPid(),
+ IPCThreadState::self()->getCallingUid())) {
return;
}
@@ -965,7 +986,8 @@
sound_model_handle_t *handle)
{
ALOGV("loadSoundModel() handle");
- if (!captureHotwordAllowed()) {
+ if (!captureHotwordAllowed(IPCThreadState::self()->getCallingPid(),
+ IPCThreadState::self()->getCallingUid())) {
return PERMISSION_DENIED;
}
@@ -979,7 +1001,8 @@
status_t SoundTriggerHwService::ModuleClient::unloadSoundModel(sound_model_handle_t handle)
{
ALOGV("unloadSoundModel() model handle %d", handle);
- if (!captureHotwordAllowed()) {
+ if (!captureHotwordAllowed(IPCThreadState::self()->getCallingPid(),
+ IPCThreadState::self()->getCallingUid())) {
return PERMISSION_DENIED;
}
@@ -994,7 +1017,8 @@
const sp<IMemory>& dataMemory)
{
ALOGV("startRecognition() model handle %d", handle);
- if (!captureHotwordAllowed()) {
+ if (!captureHotwordAllowed(IPCThreadState::self()->getCallingPid(),
+ IPCThreadState::self()->getCallingUid())) {
return PERMISSION_DENIED;
}
@@ -1008,7 +1032,8 @@
status_t SoundTriggerHwService::ModuleClient::stopRecognition(sound_model_handle_t handle)
{
ALOGV("stopRecognition() model handle %d", handle);
- if (!captureHotwordAllowed()) {
+ if (!captureHotwordAllowed(IPCThreadState::self()->getCallingPid(),
+ IPCThreadState::self()->getCallingUid())) {
return PERMISSION_DENIED;
}
diff --git a/services/soundtrigger/SoundTriggerHwService.h b/services/soundtrigger/SoundTriggerHwService.h
index 60ebb35..95efc4b 100644
--- a/services/soundtrigger/SoundTriggerHwService.h
+++ b/services/soundtrigger/SoundTriggerHwService.h
@@ -140,8 +140,6 @@
private:
- status_t unloadSoundModel_l(sound_model_handle_t handle);
-
Mutex mLock;
wp<SoundTriggerHwService> mService;
sp<SoundTriggerHalInterface> mHalInterface;