summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
Diffstat (limited to 'media')
-rw-r--r--media/common_time/ICommonClock.cpp3
-rw-r--r--media/common_time/ICommonTimeConfig.cpp3
-rw-r--r--media/libmedia/Android.mk1
-rw-r--r--media/libmedia/MediaProfiles.cpp8
-rw-r--r--media/libstagefright/Android.mk1
-rw-r--r--media/libstagefright/MPEG2TSWriter.cpp102
-rwxr-xr-xmedia/libstagefright/MPEG4Writer.cpp21
-rw-r--r--media/libstagefright/MediaCodec.cpp3
-rw-r--r--media/libstagefright/MediaCodecList.cpp2
-rwxr-xr-xmedia/libstagefright/OMXCodec.cpp8
-rw-r--r--media/libstagefright/codecs/aacenc/Android.mk2
-rw-r--r--media/libstagefright/codecs/aacenc/SampleCode/Android.mk2
-rw-r--r--media/libstagefright/codecs/aacenc/basic_op/oper_32b.c4
-rw-r--r--media/libstagefright/codecs/aacenc/inc/aac_rom.h2
-rw-r--r--media/libstagefright/codecs/aacenc/src/aac_rom.c2
-rw-r--r--media/libstagefright/codecs/aacenc/src/aacenc.c4
-rw-r--r--media/libstagefright/codecs/aacenc/src/adj_thr.c5
-rw-r--r--media/libstagefright/codecs/aacenc/src/block_switch.c2
-rw-r--r--media/libstagefright/codecs/amrnb/common/include/frame_type_3gpp.h28
-rw-r--r--media/libstagefright/codecs/amrnb/common/include/pvgsmamr.h63
-rw-r--r--media/libstagefright/codecs/amrnb/common/pvgsmamrdecoderinterface.h183
-rw-r--r--media/libstagefright/codecs/amrnb/dec/Android.mk4
-rw-r--r--media/libstagefright/codecs/amrnb/dec/include/pvamrnbdecoder_api.h122
-rw-r--r--media/libstagefright/codecs/amrnb/dec/src/amrdecode.h1
-rw-r--r--media/libstagefright/codecs/amrnb/dec/src/gsmamr_dec.h1
-rw-r--r--media/libstagefright/codecs/amrnb/dec/src/post_pro.cpp2
-rw-r--r--media/libstagefright/codecs/amrnb/dec/src/pvgsmamrdecoder.cpp77
-rw-r--r--media/libstagefright/codecs/amrnb/enc/Android.mk3
-rw-r--r--media/libstagefright/codecs/amrnb/enc/src/g_pitch.cpp3
-rw-r--r--media/libstagefright/codecs/amrwbenc/Android.mk2
-rw-r--r--media/libstagefright/codecs/amrwbenc/SampleCode/Android.mk2
-rw-r--r--media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Filt_6k_7k_opt.s6
-rw-r--r--media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Filt_6k_7k_neon.s6
-rw-r--r--media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/pred_lt4_1_neon.s6
-rw-r--r--media/libstagefright/codecs/avc/common/include/avcapi_common.h8
-rw-r--r--media/libstagefright/codecs/avc/common/src/deblock.cpp7
-rw-r--r--media/libstagefright/codecs/avc/common/src/dpb.cpp8
-rw-r--r--media/libstagefright/codecs/avc/enc/Android.mk2
-rw-r--r--media/libstagefright/codecs/avc/enc/SoftAVCEncoder.cpp16
-rw-r--r--media/libstagefright/codecs/avc/enc/src/avcenc_api.cpp42
-rw-r--r--media/libstagefright/codecs/avc/enc/src/bitstream_io.cpp8
-rw-r--r--media/libstagefright/codecs/avc/enc/src/motion_comp.cpp110
-rw-r--r--media/libstagefright/codecs/avc/enc/src/motion_est.cpp2
-rw-r--r--media/libstagefright/codecs/avc/enc/src/rate_control.cpp10
-rw-r--r--media/libstagefright/codecs/avc/enc/src/sad_halfpel_inline.h20
-rw-r--r--media/libstagefright/codecs/avc/enc/src/sad_inline.h56
-rw-r--r--media/libstagefright/codecs/avc/enc/src/sad_mb_offset.h68
-rw-r--r--media/libstagefright/codecs/common/Android.mk13
-rw-r--r--media/libstagefright/codecs/common/Config.mk2
-rw-r--r--media/libstagefright/codecs/common/include/voType.h24
-rw-r--r--media/libstagefright/codecs/mp3dec/src/asm/pvmp3_dct_16_gcc.s6
-rw-r--r--media/libstagefright/codecs/mp3dec/src/asm/pvmp3_mdct_18_gcc.s4
-rw-r--r--media/libstagefright/codecs/mp3dec/src/asm/pvmp3_polyphase_filter_window_gcc.s6
-rw-r--r--media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_DecodeCoeffsToPair_s.S35
-rw-r--r--media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_Interpolate_Chroma_s.S23
-rw-r--r--media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_DequantTransformResidualFromPairAndAdd_s.S16
-rw-r--r--media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_PredictIntraChroma_8x8_s.S16
-rw-r--r--media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_PredictIntra_16x16_s.S15
-rw-r--r--media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_PredictIntra_4x4_s.S21
-rw-r--r--media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_TransformDequantChromaDCFromPair_s.S11
-rw-r--r--media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_TransformDequantLumaDCFromPair_s.S11
-rw-r--r--media/libstagefright/id3/ID3.cpp3
-rw-r--r--media/libstagefright/matroska/MatroskaExtractor.cpp10
-rw-r--r--media/libstagefright/rtsp/APacketSource.cpp21
-rw-r--r--media/libstagefright/rtsp/ARTPConnection.cpp1
-rw-r--r--media/mtp/Android.mk28
66 files changed, 518 insertions, 789 deletions
diff --git a/media/common_time/ICommonClock.cpp b/media/common_time/ICommonClock.cpp
index 28b43ac..25ae69e 100644
--- a/media/common_time/ICommonClock.cpp
+++ b/media/common_time/ICommonClock.cpp
@@ -13,7 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include <linux/socket.h>
+
+#include <sys/socket.h>
#include <common_time/ICommonClock.h>
#include <binder/Parcel.h>
diff --git a/media/common_time/ICommonTimeConfig.cpp b/media/common_time/ICommonTimeConfig.cpp
index 8eb37cb..67167b0 100644
--- a/media/common_time/ICommonTimeConfig.cpp
+++ b/media/common_time/ICommonTimeConfig.cpp
@@ -13,7 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include <linux/socket.h>
+
+#include <sys/socket.h>
#include <common_time/ICommonTimeConfig.h>
#include <binder/Parcel.h>
diff --git a/media/libmedia/Android.mk b/media/libmedia/Android.mk
index c8e1dc7..6afc505 100644
--- a/media/libmedia/Android.mk
+++ b/media/libmedia/Android.mk
@@ -61,7 +61,6 @@ LOCAL_C_INCLUDES := \
$(call include-path-for, graphics corecg) \
$(TOP)/frameworks/native/include/media/openmax \
external/icu4c/common \
- external/expat/lib \
$(call include-path-for, audio-effects) \
$(call include-path-for, audio-utils)
diff --git a/media/libmedia/MediaProfiles.cpp b/media/libmedia/MediaProfiles.cpp
index 6929efa..48bbf8f 100644
--- a/media/libmedia/MediaProfiles.cpp
+++ b/media/libmedia/MediaProfiles.cpp
@@ -23,7 +23,7 @@
#include <utils/Log.h>
#include <utils/Vector.h>
#include <cutils/properties.h>
-#include <expat.h>
+#include <libexpat/expat.h>
#include <media/MediaProfiles.h>
#include <media/stagefright/foundation/ADebug.h>
#include <OMX_Video.h>
@@ -516,16 +516,16 @@ void MediaProfiles::checkAndAddRequiredProfilesIfNecessary() {
// Check high and low from either camcorder profile or timelapse profile
// but not both. Default, check camcorder profile
size_t j = 0;
- size_t n = 2;
+ size_t o = 2;
if (isTimelapseProfile(quality)) {
// Check timelapse profile instead.
j = 2;
- n = kNumRequiredProfiles;
+ o = kNumRequiredProfiles;
} else {
// Must be camcorder profile.
CHECK(isCamcorderProfile(quality));
}
- for (; j < n; ++j) {
+ for (; j < o; ++j) {
info = &(mRequiredProfileRefs[refIndex].mRefs[j]);
if ((j % 2 == 0 && product > info->mResolutionProduct) || // low
(j % 2 != 0 && product < info->mResolutionProduct)) { // high
diff --git a/media/libstagefright/Android.mk b/media/libstagefright/Android.mk
index 8ad1cb9..ac50470 100644
--- a/media/libstagefright/Android.mk
+++ b/media/libstagefright/Android.mk
@@ -58,7 +58,6 @@ LOCAL_C_INCLUDES:= \
$(TOP)/frameworks/av/include/media/stagefright/timedtext \
$(TOP)/frameworks/native/include/media/hardware \
$(TOP)/frameworks/native/include/media/openmax \
- $(TOP)/external/expat/lib \
$(TOP)/external/flac/include \
$(TOP)/external/tremolo \
$(TOP)/external/openssl/include \
diff --git a/media/libstagefright/MPEG2TSWriter.cpp b/media/libstagefright/MPEG2TSWriter.cpp
index f702376..c9ed5bb 100644
--- a/media/libstagefright/MPEG2TSWriter.cpp
+++ b/media/libstagefright/MPEG2TSWriter.cpp
@@ -28,6 +28,7 @@
#include <media/stagefright/MediaSource.h>
#include <media/stagefright/MetaData.h>
#include <media/stagefright/Utils.h>
+#include <arpa/inet.h>
#include "include/ESDS.h"
@@ -418,6 +419,8 @@ void MPEG2TSWriter::SourceInfo::onMessageReceived(const sp<AMessage> &msg) {
} else {
postAVCFrame(buffer);
}
+ } else {
+ readMore();
}
buffer->release();
@@ -471,7 +474,9 @@ MPEG2TSWriter::MPEG2TSWriter(int fd)
mStarted(false),
mNumSourcesDone(0),
mNumTSPacketsWritten(0),
- mNumTSPacketsBeforeMeta(0) {
+ mNumTSPacketsBeforeMeta(0),
+ mPATContinuityCounter(0),
+ mPMTContinuityCounter(0) {
init();
}
@@ -482,7 +487,9 @@ MPEG2TSWriter::MPEG2TSWriter(const char *filename)
mStarted(false),
mNumSourcesDone(0),
mNumTSPacketsWritten(0),
- mNumTSPacketsBeforeMeta(0) {
+ mNumTSPacketsBeforeMeta(0),
+ mPATContinuityCounter(0),
+ mPMTContinuityCounter(0) {
init();
}
@@ -495,13 +502,17 @@ MPEG2TSWriter::MPEG2TSWriter(
mStarted(false),
mNumSourcesDone(0),
mNumTSPacketsWritten(0),
- mNumTSPacketsBeforeMeta(0) {
+ mNumTSPacketsBeforeMeta(0),
+ mPATContinuityCounter(0),
+ mPMTContinuityCounter(0) {
init();
}
void MPEG2TSWriter::init() {
CHECK(mFile != NULL || mWriteFunc != NULL);
+ initCrcTable();
+
mLooper = new ALooper;
mLooper->setName("MPEG2TSWriter");
@@ -729,11 +740,16 @@ void MPEG2TSWriter::writeProgramAssociationTable() {
};
sp<ABuffer> buffer = new ABuffer(188);
- memset(buffer->data(), 0, buffer->size());
+ memset(buffer->data(), 0xff, buffer->size());
memcpy(buffer->data(), kData, sizeof(kData));
- static const unsigned kContinuityCounter = 5;
- buffer->data()[3] |= kContinuityCounter;
+ if (++mPATContinuityCounter == 16) {
+ mPATContinuityCounter = 0;
+ }
+ buffer->data()[3] |= mPATContinuityCounter;
+
+ uint32_t crc = htonl(crc32(&buffer->data()[5], 12));
+ memcpy(&buffer->data()[17], &crc, sizeof(crc));
CHECK_EQ(internalWrite(buffer->data(), buffer->size()), buffer->size());
}
@@ -781,11 +797,13 @@ void MPEG2TSWriter::writeProgramMap() {
};
sp<ABuffer> buffer = new ABuffer(188);
- memset(buffer->data(), 0, buffer->size());
+ memset(buffer->data(), 0xff, buffer->size());
memcpy(buffer->data(), kData, sizeof(kData));
- static const unsigned kContinuityCounter = 5;
- buffer->data()[3] |= kContinuityCounter;
+ if (++mPMTContinuityCounter == 16) {
+ mPMTContinuityCounter = 0;
+ }
+ buffer->data()[3] |= mPMTContinuityCounter;
size_t section_length = 5 * mSources.size() + 4 + 9;
buffer->data()[6] |= section_length >> 8;
@@ -806,10 +824,8 @@ void MPEG2TSWriter::writeProgramMap() {
*ptr++ = 0x00;
}
- *ptr++ = 0x00;
- *ptr++ = 0x00;
- *ptr++ = 0x00;
- *ptr++ = 0x00;
+ uint32_t crc = htonl(crc32(&buffer->data()[5], 12+mSources.size()*5));
+ memcpy(&buffer->data()[17+mSources.size()*5], &crc, sizeof(crc));
CHECK_EQ(internalWrite(buffer->data(), buffer->size()), buffer->size());
}
@@ -822,7 +838,7 @@ void MPEG2TSWriter::writeAccessUnit(
// transport_priority = b0
// PID = b0 0001 1110 ???? (13 bits) [0x1e0 + 1 + sourceIndex]
// transport_scrambling_control = b00
- // adaptation_field_control = b01 (no adaptation field, payload only)
+ // adaptation_field_control = b??
// continuity_counter = b????
// -- payload follows
// packet_startcode_prefix = 0x000001
@@ -852,7 +868,7 @@ void MPEG2TSWriter::writeAccessUnit(
// the first fragment of "buffer" follows
sp<ABuffer> buffer = new ABuffer(188);
- memset(buffer->data(), 0, buffer->size());
+ memset(buffer->data(), 0xff, buffer->size());
const unsigned PID = 0x1e0 + sourceIndex + 1;
@@ -870,6 +886,7 @@ void MPEG2TSWriter::writeAccessUnit(
uint32_t PTS = (timeUs * 9ll) / 100ll;
size_t PES_packet_length = accessUnit->size() + 8;
+ bool padding = (accessUnit->size() < (188 - 18));
if (PES_packet_length >= 65536) {
// This really should only happen for video.
@@ -883,7 +900,15 @@ void MPEG2TSWriter::writeAccessUnit(
*ptr++ = 0x47;
*ptr++ = 0x40 | (PID >> 8);
*ptr++ = PID & 0xff;
- *ptr++ = 0x10 | continuity_counter;
+ *ptr++ = (padding ? 0x30 : 0x10) | continuity_counter;
+ if (padding) {
+ int paddingSize = 188 - accessUnit->size() - 18;
+ *ptr++ = paddingSize - 1;
+ if (paddingSize >= 2) {
+ *ptr++ = 0x00;
+ ptr += paddingSize - 2;
+ }
+ }
*ptr++ = 0x00;
*ptr++ = 0x00;
*ptr++ = 0x01;
@@ -911,6 +936,7 @@ void MPEG2TSWriter::writeAccessUnit(
size_t offset = copy;
while (offset < accessUnit->size()) {
+ bool lastAccessUnit = ((accessUnit->size() - offset) < 184);
// for subsequent fragments of "buffer":
// 0x47
// transport_error_indicator = b0
@@ -918,11 +944,11 @@ void MPEG2TSWriter::writeAccessUnit(
// transport_priority = b0
// PID = b0 0001 1110 ???? (13 bits) [0x1e0 + 1 + sourceIndex]
// transport_scrambling_control = b00
- // adaptation_field_control = b01 (no adaptation field, payload only)
+ // adaptation_field_control = b??
// continuity_counter = b????
// the fragment of "buffer" follows.
- memset(buffer->data(), 0, buffer->size());
+ memset(buffer->data(), 0xff, buffer->size());
const unsigned continuity_counter =
mSources.editItemAt(sourceIndex)->incrementContinuityCounter();
@@ -931,7 +957,18 @@ void MPEG2TSWriter::writeAccessUnit(
*ptr++ = 0x47;
*ptr++ = 0x00 | (PID >> 8);
*ptr++ = PID & 0xff;
- *ptr++ = 0x10 | continuity_counter;
+ *ptr++ = (lastAccessUnit ? 0x30 : 0x10) | continuity_counter;
+
+ if (lastAccessUnit) {
+ // Pad packet using an adaptation field
+ // Adaptation header all to 0 execpt size
+ uint8_t paddingSize = (uint8_t)184 - (accessUnit->size() - offset);
+ *ptr++ = paddingSize - 1;
+ if (paddingSize >= 2) {
+ *ptr++ = 0x00;
+ ptr += paddingSize - 2;
+ }
+ }
size_t sizeLeft = buffer->data() + buffer->size() - ptr;
size_t copy = accessUnit->size() - offset;
@@ -956,6 +993,33 @@ void MPEG2TSWriter::writeTS() {
}
}
+void MPEG2TSWriter::initCrcTable() {
+ uint32_t poly = 0x04C11DB7;
+
+ for (int i = 0; i < 256; i++) {
+ uint32_t crc = i << 24;
+ for (int j = 0; j < 8; j++) {
+ crc = (crc << 1) ^ ((crc & 0x80000000) ? (poly) : 0);
+ }
+ mCrcTable[i] = crc;
+ }
+}
+
+/**
+ * Compute CRC32 checksum for buffer starting at offset start and for length
+ * bytes.
+ */
+uint32_t MPEG2TSWriter::crc32(const uint8_t *p_start, size_t length) {
+ uint32_t crc = 0xFFFFFFFF;
+ const uint8_t *p;
+
+ for (p = p_start; p < p_start + length; p++) {
+ crc = (crc << 8) ^ mCrcTable[((crc >> 24) ^ *p) & 0xFF];
+ }
+
+ return crc;
+}
+
ssize_t MPEG2TSWriter::internalWrite(const void *data, size_t size) {
if (mFile != NULL) {
return fwrite(data, 1, size, mFile);
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index 755b502..6108298 100755
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -236,11 +236,11 @@ private:
void writeDrefBox();
void writeDinfBox();
void writeDamrBox();
- void writeMdhdBox(time_t now);
+ void writeMdhdBox(uint32_t now);
void writeSmhdBox();
void writeVmhdBox();
void writeHdlrBox();
- void writeTkhdBox(time_t now);
+ void writeTkhdBox(uint32_t now);
void writeMp4aEsdsBox();
void writeMp4vEsdsBox();
void writeAudioFourCCBox();
@@ -723,8 +723,17 @@ status_t MPEG4Writer::reset() {
return err;
}
-void MPEG4Writer::writeMvhdBox(int64_t durationUs) {
+uint32_t MPEG4Writer::getMpeg4Time() {
time_t now = time(NULL);
+ // MP4 file uses time counting seconds since midnight, Jan. 1, 1904
+ // while time function returns Unix epoch values which starts
+ // at 1970-01-01. Lets add the number of seconds between them
+ uint32_t mpeg4Time = now + (66 * 365 + 17) * (24 * 60 * 60);
+ return mpeg4Time;
+}
+
+void MPEG4Writer::writeMvhdBox(int64_t durationUs) {
+ uint32_t now = getMpeg4Time();
beginBox("mvhd");
writeInt32(0); // version=0, flags=0
writeInt32(now); // creation time
@@ -2357,7 +2366,7 @@ void MPEG4Writer::Track::writeTrackHeader(bool use32BitOffset) {
ALOGV("%s track time scale: %d",
mIsAudio? "Audio": "Video", mTimeScale);
- time_t now = time(NULL);
+ uint32_t now = getMpeg4Time();
mOwner->beginBox("trak");
writeTkhdBox(now);
mOwner->beginBox("mdia");
@@ -2570,7 +2579,7 @@ void MPEG4Writer::Track::writeMp4vEsdsBox() {
mOwner->endBox(); // esds
}
-void MPEG4Writer::Track::writeTkhdBox(time_t now) {
+void MPEG4Writer::Track::writeTkhdBox(uint32_t now) {
mOwner->beginBox("tkhd");
// Flags = 7 to indicate that the track is enabled, and
// part of the presentation
@@ -2639,7 +2648,7 @@ void MPEG4Writer::Track::writeHdlrBox() {
mOwner->endBox();
}
-void MPEG4Writer::Track::writeMdhdBox(time_t now) {
+void MPEG4Writer::Track::writeMdhdBox(uint32_t now) {
int64_t trakDurationUs = getDurationUs();
mOwner->beginBox("mdhd");
mOwner->writeInt32(0); // version=0, flags=0
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index 67f5a22..2060699 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -1118,7 +1118,8 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
CHECK(msg->senderAwaitsResponse(&replyID));
if ((mState != STARTED && mState != FLUSHING)
- || (mFlags & kFlagStickyError)) {
+ || (mFlags & kFlagStickyError)
+ || mOutputFormat == NULL) {
sp<AMessage> response = new AMessage;
response->setInt32("err", INVALID_OPERATION);
diff --git a/media/libstagefright/MediaCodecList.cpp b/media/libstagefright/MediaCodecList.cpp
index 9f6d4a3..d24337f 100644
--- a/media/libstagefright/MediaCodecList.cpp
+++ b/media/libstagefright/MediaCodecList.cpp
@@ -26,7 +26,7 @@
#include <media/stagefright/OMXCodec.h>
#include <utils/threads.h>
-#include <expat.h>
+#include <libexpat/expat.h>
namespace android {
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index fde7ebf..a6636a1 100755
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -2048,9 +2048,13 @@ int64_t OMXCodec::getDecodingTimeUs() {
}
void OMXCodec::on_message(const omx_message &msg) {
+ // even in error state, we still need to process EMPTY_BUFFER_DONE
+ // and FILL_BUFFER_DONE event, or we will run into mediaserver crash issue
if (mState == ERROR) {
- ALOGW("Dropping OMX message - we're in ERROR state.");
- return;
+ if (msg.type == omx_message::EVENT) {
+ ALOGW("Dropping OMX message - we're in ERROR state.");
+ return;
+ }
}
switch (msg.type) {
diff --git a/media/libstagefright/codecs/aacenc/Android.mk b/media/libstagefright/codecs/aacenc/Android.mk
index 1c342c8..820734d 100644
--- a/media/libstagefright/codecs/aacenc/Android.mk
+++ b/media/libstagefright/codecs/aacenc/Android.mk
@@ -71,8 +71,6 @@ LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/inc \
$(LOCAL_PATH)/basic_op
-LOCAL_CFLAGS := $(VO_CFLAGS)
-
ifeq ($(VOTT), v5)
LOCAL_CFLAGS += -DARMV5E -DARM_INASM -DARMV5_INASM
LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/asm/ARMV5E
diff --git a/media/libstagefright/codecs/aacenc/SampleCode/Android.mk b/media/libstagefright/codecs/aacenc/SampleCode/Android.mk
index ba3f4d2..01016e7 100644
--- a/media/libstagefright/codecs/aacenc/SampleCode/Android.mk
+++ b/media/libstagefright/codecs/aacenc/SampleCode/Android.mk
@@ -5,8 +5,6 @@ LOCAL_SRC_FILES := \
AAC_E_SAMPLES.c \
../../common/cmnMemory.c
-LOCAL_CFLAGS += $(VO_CFLAGS)
-
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE := AACEncTest
diff --git a/media/libstagefright/codecs/aacenc/basic_op/oper_32b.c b/media/libstagefright/codecs/aacenc/basic_op/oper_32b.c
index 982f4fd..cc01927 100644
--- a/media/libstagefright/codecs/aacenc/basic_op/oper_32b.c
+++ b/media/libstagefright/codecs/aacenc/basic_op/oper_32b.c
@@ -344,8 +344,8 @@ static const Word32 pow2Table[POW2_TABLE_SIZE] = {
*/
Word32 pow2_xy(Word32 x, Word32 y)
{
- Word32 iPart;
- Word32 fPart;
+ UWord32 iPart;
+ UWord32 fPart;
Word32 res;
Word32 tmp, tmp2;
Word32 shift, shift2;
diff --git a/media/libstagefright/codecs/aacenc/inc/aac_rom.h b/media/libstagefright/codecs/aacenc/inc/aac_rom.h
index 8e206b7..0b6f656 100644
--- a/media/libstagefright/codecs/aacenc/inc/aac_rom.h
+++ b/media/libstagefright/codecs/aacenc/inc/aac_rom.h
@@ -57,7 +57,7 @@ extern const Word32 mTab_4_3[512];
/*! $2^{-\frac{n}{16}}$ table */
extern const Word16 pow2tominusNover16[17] ;
-extern Word32 specExpMantTableComb_enc[4][14];
+extern const Word32 specExpMantTableComb_enc[4][14];
extern const UWord8 specExpTableComb_enc[4][14];
extern const Word16 quantBorders[4][4];
diff --git a/media/libstagefright/codecs/aacenc/src/aac_rom.c b/media/libstagefright/codecs/aacenc/src/aac_rom.c
index 127322d..f08f3a9 100644
--- a/media/libstagefright/codecs/aacenc/src/aac_rom.c
+++ b/media/libstagefright/codecs/aacenc/src/aac_rom.c
@@ -1367,7 +1367,7 @@ const Word16 sideInfoTabShort[MAX_SFB_SHORT + 1] = {
10, 10, 10, 10, 10, 13, 13
};
-Word32 specExpMantTableComb_enc[4][14] =
+const Word32 specExpMantTableComb_enc[4][14] =
{
{0x40000000, 0x50a28be6, 0x6597fa95, 0x40000000,
0x50a28be6, 0x6597fa95, 0x40000000, 0x50a28be6,
diff --git a/media/libstagefright/codecs/aacenc/src/aacenc.c b/media/libstagefright/codecs/aacenc/src/aacenc.c
index ad2f29a..d1c8621 100644
--- a/media/libstagefright/codecs/aacenc/src/aacenc.c
+++ b/media/libstagefright/codecs/aacenc/src/aacenc.c
@@ -357,9 +357,9 @@ VO_U32 VO_API voAACEncSetParam(VO_HANDLE hCodec, VO_S32 uParamID, VO_PTR pData)
if(config.sampleRate%8000 == 0)
tmp =480;
/* check the bitrate */
- if(config.bitRate!=0 && (config.bitRate/config.nChannelsOut < 4000) ||
+ if(config.bitRate!=0 && ((config.bitRate/config.nChannelsOut < 4000) ||
(config.bitRate/config.nChannelsOut > 160000) ||
- (config.bitRate > config.sampleRate*6*config.nChannelsOut))
+ (config.bitRate > config.sampleRate*6*config.nChannelsOut)))
{
config.bitRate = 640*config.sampleRate/tmp*config.nChannelsOut;
diff --git a/media/libstagefright/codecs/aacenc/src/adj_thr.c b/media/libstagefright/codecs/aacenc/src/adj_thr.c
index 07b33b7..ccfe883 100644
--- a/media/libstagefright/codecs/aacenc/src/adj_thr.c
+++ b/media/libstagefright/codecs/aacenc/src/adj_thr.c
@@ -20,13 +20,16 @@
*******************************************************************************/
+/* Include system headers before local headers - the local headers
+ * redefine __inline, which can mess up definitions in libc headers if
+ * they happen to use __inline. */
+#include <string.h>
#include "basic_op.h"
#include "oper_32b.h"
#include "adj_thr_data.h"
#include "adj_thr.h"
#include "qc_data.h"
#include "line_pe.h"
-#include <string.h>
#define minSnrLimit 0x6666 /* 1 dB */
diff --git a/media/libstagefright/codecs/aacenc/src/block_switch.c b/media/libstagefright/codecs/aacenc/src/block_switch.c
index 47fd15e..c80538f 100644
--- a/media/libstagefright/codecs/aacenc/src/block_switch.c
+++ b/media/libstagefright/codecs/aacenc/src/block_switch.c
@@ -51,7 +51,7 @@ CalcWindowEnergy(BLOCK_SWITCHING_CONTROL *blockSwitchingControl,
/*
IIR high pass coeffs
*/
-Word32 hiPassCoeff[BLOCK_SWITCHING_IIR_LEN] = {
+const Word32 hiPassCoeff[BLOCK_SWITCHING_IIR_LEN] = {
0xbec8b439, 0x609d4952 /* -0.5095f, 0.7548f */
};
diff --git a/media/libstagefright/codecs/amrnb/common/include/frame_type_3gpp.h b/media/libstagefright/codecs/amrnb/common/include/frame_type_3gpp.h
index 3ebd929..3d482be 100644
--- a/media/libstagefright/codecs/amrnb/common/include/frame_type_3gpp.h
+++ b/media/libstagefright/codecs/amrnb/common/include/frame_type_3gpp.h
@@ -105,6 +105,34 @@ extern "C"
AMR_NO_DATA /* No data */
};
+typedef enum
+{
+ /*
+ * One word (2-byte) to indicate type of frame type.
+ * One word (2-byte) to indicate frame type.
+ * One word (2-byte) to indicate mode.
+ * N words (2-byte) containing N bits (bit 0 = 0xff81, bit 1 = 0x007f).
+ */
+ ETS = 0, /* Both AMR-Narrowband and AMR-Wideband */
+
+ /*
+ * One word (2-byte) for sync word (good frames: 0x6b21, bad frames: 0x6b20)
+ * One word (2-byte) for frame length N.
+ * N words (2-byte) containing N bits (bit 0 = 0x007f, bit 1 = 0x0081).
+ */
+ ITU, /* AMR-Wideband */
+
+ /*
+ * AMR-WB MIME/storage format, see RFC 3267 (sections 5.1 and 5.3) for details
+ */
+ MIME_IETF,
+
+ WMF, /* AMR-Narrowband */
+
+ IF2 /* AMR-Narrowband */
+
+} bitstream_format;
+
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
diff --git a/media/libstagefright/codecs/amrnb/common/include/pvgsmamr.h b/media/libstagefright/codecs/amrnb/common/include/pvgsmamr.h
deleted file mode 100644
index b697524..0000000
--- a/media/libstagefright/codecs/amrnb/common/include/pvgsmamr.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-/****************************************************************************************
-Portions of this file are derived from the following 3GPP standard:
-
- 3GPP TS 26.073
- ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
- Available from http://www.3gpp.org
-
-(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
-Permission to distribute, modify and use this file under the standard license
-terms listed above has been obtained from the copyright holder.
-****************************************************************************************/
-#ifndef __PVGSMAMR_H
-#define __PVGSMAMR_H
-
-
-// includes
-#include <e32std.h>
-#include <e32base.h>
-
-#include "sp_dec.h"
-#include "pvglobals.h"
-
-
-// PVGsmDecoder AO
-class CPVGsmDecoder : public CBase
-{
- public:
- IMPORT_C static CPVGsmDecoder* NewL(void);
- IMPORT_C ~CPVGsmDecoder();
- IMPORT_C TInt StartL(void);
-
- // only port the API's used in PVPlayer 2.0
- IMPORT_C TInt DecodeFrame(enum Mode mode, unsigned char* compressedBlock, unsigned char* audioBuffer);
- IMPORT_C TInt InitDecoder(void);
- IMPORT_C void ExitDecoder(void);
-
- private:
- CPVGsmDecoder();
- void ConstructL(void);
-
- Speech_Decode_FrameState* decState;
- enum RXFrameType rx_type;
- struct globalDataStruct *gds;
-};
-
-#endif
diff --git a/media/libstagefright/codecs/amrnb/common/pvgsmamrdecoderinterface.h b/media/libstagefright/codecs/amrnb/common/pvgsmamrdecoderinterface.h
deleted file mode 100644
index ccbed44..0000000
--- a/media/libstagefright/codecs/amrnb/common/pvgsmamrdecoderinterface.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT 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: pvgsmamrdecoderinterface.h //
-// //
-//////////////////////////////////////////////////////////////////////////////////
-
-#ifndef _PVGSMAMR_DECODER_INTERFACE_H
-#define _PVGSMAMR_DECODER_INTERFACE_H
-
-/*----------------------------------------------------------------------------
-; ENUMERATED TYPEDEF'S
-----------------------------------------------------------------------------*/
-
-typedef enum
-{
- /*
- * One word (2-byte) to indicate type of frame type.
- * One word (2-byte) to indicate frame type.
- * One word (2-byte) to indicate mode.
- * N words (2-byte) containing N bits (bit 0 = 0xff81, bit 1 = 0x007f).
- */
- ETS = 0, /* Both AMR-Narrowband and AMR-Wideband */
-
- /*
- * One word (2-byte) for sync word (good frames: 0x6b21, bad frames: 0x6b20)
- * One word (2-byte) for frame length N.
- * N words (2-byte) containing N bits (bit 0 = 0x007f, bit 1 = 0x0081).
- */
- ITU, /* AMR-Wideband */
-
- /*
- * AMR-WB MIME/storage format, see RFC 3267 (sections 5.1 and 5.3) for details
- */
- MIME_IETF,
-
- WMF, /* AMR-Narrowband */
-
- IF2 /* AMR-Narrowband */
-
-} bitstream_format;
-
-
-
-/*----------------------------------------------------------------------------
-; STRUCTURES TYPEDEF'S
-----------------------------------------------------------------------------*/
-typedef struct
-{
- int16_t prev_ft;
- int16_t prev_mode;
-} RX_State;
-
-
-typedef struct tPVAmrDecoderExternal
-{
- /*
- * INPUT:
- * Pointer to the input buffer that contains the encoded bistream data.
- * The data is filled in such that the first bit transmitted is
- * the most-significant bit (MSB) of the first array element.
- * The buffer is accessed in a linear fashion for speed, and the number of
- * bytes consumed varies frame to frame. This is use for mime/ietf data
- */
- uint8_t *pInputBuffer;
-
- /*
- * INPUT:
- * Pointer to the input buffer that contains the encoded stream data.
- * The data is filled such that the first bit transmitted is
- * in the first int16_t element.
- * The buffer is accessed in a linear fashion for speed, and the number of
- * bytes consumed varies frame to frame.
- */
- int16_t *pInputSampleBuffer;
-
- /*
- * INPUT: (but what is pointed to is an output)
- * Pointer to the output buffer to hold the 16-bit PCM audio samples.
- */
- int16_t *pOutputBuffer;
-
- /*
- * INPUT:
- * Number of requested output audio channels. This relieves the calling
- * environment from having to perform stereo-to-mono or mono-to-stereo
- * conversions.
- */
- int32_t desiredChannels;
-
- /*
- * INPUT:
- * Format type of the encoded bitstream.
- */
- bitstream_format input_format;
-
- /*
- * OUTPUT:
- * The sampling rate decoded from the bitstream, in units of
- * samples/second. For this release of the library this value does
- * not change from frame to frame, but future versions will.
- */
- int32_t samplingRate;
-
- /*
- * OUTPUT:
- * This value is the bitrate in units of bits/second. IT
- * is calculated using the number of bits consumed for the current frame,
- * and then multiplying by the sampling_rate, divided by points in a frame.
- * This value can changes frame to frame.
- */
- int32_t bitRate;
-
- /*
- * OUTPUT:
- * The number of channels decoded from the bitstream. The output data
- * will have be the amount specified in the variable desiredChannels,
- * this output is informative only, and can be ignored.
- */
- int32_t encodedChannels;
-
- /*
- * OUTPUT:
- * This value is the number of output PCM samples per channel.
- * It is 320.
- */
- int16_t frameLength;
-
- /*
- * OUTPUT:
- * This value is the quality indicator. 1 (good) 0 (bad)
- */
- uint8_t quality;
-
-
- /*
- * OUTPUT:
- * GSM AMR NB and WB mode (i.e. bit-rate )
- */
- int16_t mode;
- int16_t mode_old;
-
- /*
- * OUTPUT:
- * GSM AMR NB and WB frame type ( speech_good, speech_bad, sid, etc.)
- */
- int16_t frame_type;
-
- int16_t reset_flag;
- int16_t reset_flag_old;
-
- /*
- * OUTPUT:
- * Decoder status
- */
- int32_t status;
-
- /*
- * OUTPUT:
- * Rx status state
- */
- RX_State rx_state;
-
-} tPVAmrDecoderExternal;
-
-#endif
-
diff --git a/media/libstagefright/codecs/amrnb/dec/Android.mk b/media/libstagefright/codecs/amrnb/dec/Android.mk
index 5dc5560..b48a459 100644
--- a/media/libstagefright/codecs/amrnb/dec/Android.mk
+++ b/media/libstagefright/codecs/amrnb/dec/Android.mk
@@ -42,8 +42,7 @@ LOCAL_C_INCLUDES := \
frameworks/av/media/libstagefright/include \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/include \
- $(LOCAL_PATH)/../common/include \
- $(LOCAL_PATH)/../common
+ $(LOCAL_PATH)/../common/include
LOCAL_CFLAGS := \
-DOSCL_UNUSED_ARG= -DOSCL_IMPORT_REF=
@@ -66,7 +65,6 @@ LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/../common/include \
- $(LOCAL_PATH)/../common
LOCAL_CFLAGS := -DOSCL_IMPORT_REF=
diff --git a/media/libstagefright/codecs/amrnb/dec/include/pvamrnbdecoder_api.h b/media/libstagefright/codecs/amrnb/dec/include/pvamrnbdecoder_api.h
deleted file mode 100644
index 7b94320..0000000
--- a/media/libstagefright/codecs/amrnb/dec/include/pvamrnbdecoder_api.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-/****************************************************************************************
-Portions of this file are derived from the following 3GPP standard:
-
- 3GPP TS 26.073
- ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
- Available from http://www.3gpp.org
-
-(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
-Permission to distribute, modify and use this file under the standard license
-terms listed above has been obtained from the copyright holder.
-****************************************************************************************/
-/*
- Name: pvamrnbdecoder_api.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Who: Date:
- Description:
-
-------------------------------------------------------------------------------
- INCLUDE DESCRIPTION
-
- Main header file for the Packet Video AMR Narrow Band decoder library. The
- constants, structures, and functions defined within this file, along with
- a basic data types header file, is all that is needed to use and communicate
- with the library. The internal data structures within the library are
- purposely hidden.
-
-------------------------------------------------------------------------------
- REFERENCES
-
-------------------------------------------------------------------------------
-*/
-
-/*----------------------------------------------------------------------------
-; CONTINUE ONLY IF NOT ALREADY DEFINED
-----------------------------------------------------------------------------*/
-#ifndef _PVAMRNBDECODER_API_H
-#define _PVAMRNBDECODER_API_H
-
-#include "pvgsmamrdecoderinterface.h"
-
-
-/*----------------------------------------------------------------------------
-; INCLUDES
-----------------------------------------------------------------------------*/
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
- /*----------------------------------------------------------------------------
- ; MACROS
- ; Define module specific macros here
- ----------------------------------------------------------------------------*/
-
- /*----------------------------------------------------------------------------
- ; DEFINES
- ; Include all pre-processor statements here.
- ----------------------------------------------------------------------------*/
-#define MAX_NUM_FRAMES_PER_PACKET 20 /* Max number of frames per packet */
-
-#define MAX_NUM_PACKED_INPUT_BYTES 32 /* Max number of packed input bytes */
-
-#define L_FRAME 160
-
- /*----------------------------------------------------------------------------
- ; EXTERNAL VARIABLES REFERENCES
- ; Declare variables used in this module but defined elsewhere
- ----------------------------------------------------------------------------*/
-
- /*----------------------------------------------------------------------------
- ; SIMPLE TYPEDEF'S
- ----------------------------------------------------------------------------*/
-
- /*----------------------------------------------------------------------------
- ; ENUMERATED TYPEDEF'S
- ----------------------------------------------------------------------------*/
-
- /*----------------------------------------------------------------------------
- ; STRUCTURES TYPEDEF'S
- ----------------------------------------------------------------------------*/
-
-
- /*----------------------------------------------------------------------------
- ; GLOBAL FUNCTION DEFINITIONS
- ; Function Prototype declaration
- ----------------------------------------------------------------------------*/
-
-
-
- /*----------------------------------------------------------------------------
- ; END
- ----------------------------------------------------------------------------*/
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* PVMP4AUDIODECODER_API_H */
-
-
diff --git a/media/libstagefright/codecs/amrnb/dec/src/amrdecode.h b/media/libstagefright/codecs/amrnb/dec/src/amrdecode.h
index db951b9..0988e17 100644
--- a/media/libstagefright/codecs/amrnb/dec/src/amrdecode.h
+++ b/media/libstagefright/codecs/amrnb/dec/src/amrdecode.h
@@ -106,7 +106,6 @@ terms listed above has been obtained from the copyright holder.
#include "typedef.h"
#include "mode.h"
#include "frame_type_3gpp.h"
-#include "pvamrnbdecoder_api.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
diff --git a/media/libstagefright/codecs/amrnb/dec/src/gsmamr_dec.h b/media/libstagefright/codecs/amrnb/dec/src/gsmamr_dec.h
index a9fdb1c..8f54ee8 100644
--- a/media/libstagefright/codecs/amrnb/dec/src/gsmamr_dec.h
+++ b/media/libstagefright/codecs/amrnb/dec/src/gsmamr_dec.h
@@ -86,7 +86,6 @@ terms listed above has been obtained from the copyright holder.
----------------------------------------------------------------------------*/
#include "gsm_amr_typedefs.h"
-#include "pvamrnbdecoder_api.h"
#include "frame_type_3gpp.h"
/*--------------------------------------------------------------------------*/
diff --git a/media/libstagefright/codecs/amrnb/dec/src/post_pro.cpp b/media/libstagefright/codecs/amrnb/dec/src/post_pro.cpp
index ce31793..8201e54 100644
--- a/media/libstagefright/codecs/amrnb/dec/src/post_pro.cpp
+++ b/media/libstagefright/codecs/amrnb/dec/src/post_pro.cpp
@@ -376,7 +376,7 @@ void Post_Process(
L_tmp += ((Word32) st->x0) * c_b0;
L_tmp += ((Word32) st->x1) * c_b1;
L_tmp += ((Word32) x2) * c_b2;
- L_tmp <<= 3;
+ L_tmp = L_shl(L_tmp, 3, pOverflow);
/* Multiplication by two of output speech with saturation. */
diff --git a/media/libstagefright/codecs/amrnb/dec/src/pvgsmamrdecoder.cpp b/media/libstagefright/codecs/amrnb/dec/src/pvgsmamrdecoder.cpp
deleted file mode 100644
index 95b0b47..0000000
--- a/media/libstagefright/codecs/amrnb/dec/src/pvgsmamrdecoder.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-/****************************************************************************************
-Portions of this file are derived from the following 3GPP standard:
-
- 3GPP TS 26.073
- ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
- Available from http://www.3gpp.org
-
-(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
-Permission to distribute, modify and use this file under the standard license
-terms listed above has been obtained from the copyright holder.
-****************************************************************************************/
-
-#include "PVGSMAMRDecoder.h"
-
-
-/////////////////////////////////////////////////////////////////////////////
-OSCL_EXPORT_REF CPVGSMAMRDecoder::CPVGSMAMRDecoder()
-{
-}
-
-
-/////////////////////////////////////////////////////////////////////////////
-OSCL_EXPORT_REF CPVGSMAMRDecoder::~CPVGSMAMRDecoder()
-{
- delete iDecState;
- iDecState = NULL;
-}
-
-
-/////////////////////////////////////////////////////////////////////////////
-OSCL_EXPORT_REF int32 CPVGSMAMRDecoder::InitDecoder(void)
-{
- return GSMInitDecode(&iDecState, (int8*)"Decoder");
-}
-
-
-/////////////////////////////////////////////////////////////////////////////
-OSCL_EXPORT_REF int32 CPVGSMAMRDecoder::DecodeFrame(Frame_Type_3GPP aType,
- uint8* aCompressedBlock,
- uint8* aAudioBuffer,
- int32 aFormat)
-{
- return AMRDecode(iDecState, aType, aCompressedBlock, (Word16*)aAudioBuffer, (Word16) aFormat);
-}
-
-
-/////////////////////////////////////////////////////////////////////////////
-OSCL_EXPORT_REF int32 CPVGSMAMRDecoder::ResetDecoder(void)
-{
- return Speech_Decode_Frame_reset(iDecState);
-}
-
-
-/////////////////////////////////////////////////////////////////////////////
-OSCL_EXPORT_REF void CPVGSMAMRDecoder::TerminateDecoder(void)
-{
- GSMDecodeFrameExit(&iDecState);
- iDecState = NULL;
-}
-
diff --git a/media/libstagefright/codecs/amrnb/enc/Android.mk b/media/libstagefright/codecs/amrnb/enc/Android.mk
index d6e8b66..457656a 100644
--- a/media/libstagefright/codecs/amrnb/enc/Android.mk
+++ b/media/libstagefright/codecs/amrnb/enc/Android.mk
@@ -64,8 +64,7 @@ LOCAL_C_INCLUDES := \
frameworks/av/media/libstagefright/include \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/include \
- $(LOCAL_PATH)/../common/include \
- $(LOCAL_PATH)/../common
+ $(LOCAL_PATH)/../common/include
LOCAL_CFLAGS := \
-DOSCL_UNUSED_ARG=
diff --git a/media/libstagefright/codecs/amrnb/enc/src/g_pitch.cpp b/media/libstagefright/codecs/amrnb/enc/src/g_pitch.cpp
index f6235ad..5b80e2a 100644
--- a/media/libstagefright/codecs/amrnb/enc/src/g_pitch.cpp
+++ b/media/libstagefright/codecs/amrnb/enc/src/g_pitch.cpp
@@ -400,8 +400,9 @@ Word16 G_pitch( /* o : Gain of pitch lag saturated to 1.2 */
}
else
{
- s = 0; /* Avoid case of all zeros */
+ s = 0; /* re-initialize calculations */
p_y1 = &y1[0];
+ p_xn = &xn[0];
for (i = (L_subfr >> 2); i != 0; i--)
{
L_temp = (Word32)(*(p_y1++) >> 2);
diff --git a/media/libstagefright/codecs/amrwbenc/Android.mk b/media/libstagefright/codecs/amrwbenc/Android.mk
index 71a60d3..edfd7b7 100644
--- a/media/libstagefright/codecs/amrwbenc/Android.mk
+++ b/media/libstagefright/codecs/amrwbenc/Android.mk
@@ -101,8 +101,6 @@ LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/inc
-LOCAL_CFLAGS := $(VO_CFLAGS)
-
ifeq ($(VOTT), v5)
LOCAL_CFLAGS += -DARM -DASM_OPT
LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/asm/ARMV5E
diff --git a/media/libstagefright/codecs/amrwbenc/SampleCode/Android.mk b/media/libstagefright/codecs/amrwbenc/SampleCode/Android.mk
index 85ddceb..db34d08 100644
--- a/media/libstagefright/codecs/amrwbenc/SampleCode/Android.mk
+++ b/media/libstagefright/codecs/amrwbenc/SampleCode/Android.mk
@@ -10,7 +10,7 @@ LOCAL_MODULE := AMRWBEncTest
LOCAL_ARM_MODE := arm
-LOCAL_CFLAGS := $(VO_CFLAGS)
+LOCAL_CFLAGS := -DLINUX
LOCAL_SHARED_LIBRARIES := \
libstagefright \
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Filt_6k_7k_opt.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Filt_6k_7k_opt.s
index 856ada8..8451195 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Filt_6k_7k_opt.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV5E/Filt_6k_7k_opt.s
@@ -43,7 +43,9 @@ Filt_6k_7k_asm:
MOV r2, #30 @ L_FIR - 1
BL voAWB_Copy @ memcpy(x, mem, (L_FIR - 1)<<1)
- LDR r10, Lable1 @ get fir_7k address
+ ADR r3, Lable1 @ get fir_7k address
+ LDR r10, [r3]
+ ADD r10, r3
MOV r14, #0
MOV r3, r8 @ change myMemCopy to Copy, due to Copy will change r3 content
@@ -178,7 +180,7 @@ Filt_6k_7k_end:
LDMFD r13!, {r4 - r12, r15}
Lable1:
- .word fir_6k_7k
+ .word fir_6k_7k-Lable1
@ENDFUNC
.END
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Filt_6k_7k_neon.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Filt_6k_7k_neon.s
index 14ba828..fc42a03 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Filt_6k_7k_neon.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Filt_6k_7k_neon.s
@@ -49,7 +49,9 @@ Filt_6k_7k_asm:
- LDR r10, Lable1 @ get fir_7k address
+ ADR r3, Lable1 @ get fir_7k address
+ LDR r10, [r3]
+ ADD r10, r3
MOV r3, r8 @ change myMemCopy to Copy, due to Copy will change r3 content
ADD r6, r13, #60 @ get x[L_FIR - 1] address
MOV r7, r3 @ get signal[i]
@@ -221,7 +223,7 @@ Filt_6k_7k_end:
LDMFD r13!, {r0 - r12, r15}
Lable1:
- .word fir_6k_7k
+ .word fir_6k_7k-Lable1
@ENDFUNC
.END
diff --git a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/pred_lt4_1_neon.s b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/pred_lt4_1_neon.s
index 6b782cb..8d2aaf2 100644
--- a/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/pred_lt4_1_neon.s
+++ b/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/pred_lt4_1_neon.s
@@ -40,7 +40,9 @@ pred_lt4_asm:
ADDLT r2, r2, #4 @ frac += UP_SAMP
SUBLT r4, r4, #2 @ x--
- LDR r11, Lable1
+ ADR r8, Lable1
+ LDR r11, [r8]
+ ADD r11, r8
RSB r2, r2, #3 @ k = UP_SAMP - 1 - frac
MOV r8, #0 @ j = 0
ADD r11, r11, r2, LSL #6 @ get inter4_2[k][]
@@ -94,7 +96,7 @@ pred_lt4_end:
LDMFD r13!, {r4 - r12, r15}
Lable1:
- .word inter4_2
+ .word inter4_2-Lable1
@ENDFUNC
.END
diff --git a/media/libstagefright/codecs/avc/common/include/avcapi_common.h b/media/libstagefright/codecs/avc/common/include/avcapi_common.h
index 3331689..abffe6e 100644
--- a/media/libstagefright/codecs/avc/common/include/avcapi_common.h
+++ b/media/libstagefright/codecs/avc/common/include/avcapi_common.h
@@ -213,15 +213,15 @@ typedef void (*FuctionType_FrameUnbind)(void *userData, int);
memory usage.
\param "size" "Size of requested memory in bytes."
\param "attribute" "Some value specifying types, priority, etc. of the memory."
-\return "The address of the allocated memory casted to int"
+\return "The address of the allocated, zero-initialized memory"
*/
-typedef int (*FunctionType_Malloc)(void *userData, int32 size, int attribute);
+typedef void* (*FunctionType_Malloc)(void *userData, int32 size, int attribute);
/** Function pointer to free
-\param "mem" "Pointer to the memory to be freed casted to int"
+\param "mem" "Pointer to the memory to be freed"
\return "void"
*/
-typedef void (*FunctionType_Free)(void *userData, int mem);
+typedef void (*FunctionType_Free)(void *userData, void *mem);
/** Debug logging information is returned to the application thru this function.
\param "type" "Type of logging message, see definition of AVCLogType."
diff --git a/media/libstagefright/codecs/avc/common/src/deblock.cpp b/media/libstagefright/codecs/avc/common/src/deblock.cpp
index 5ed4c82..de2d2b6 100644
--- a/media/libstagefright/codecs/avc/common/src/deblock.cpp
+++ b/media/libstagefright/codecs/avc/common/src/deblock.cpp
@@ -294,7 +294,8 @@ void DeblockMb(AVCCommonObj *video, int mb_x, int mb_y, uint8 *SrcY, uint8 *SrcU
int filterLeftMbEdgeFlag = (mb_x != 0);
int filterTopMbEdgeFlag = (mb_y != 0);
int pitch = video->currPic->pitch;
- int indexA, indexB, tmp;
+ int indexA, indexB;
+ int *tmp;
int Alpha, Beta, Alpha_c, Beta_c;
int mbNum = mb_y * video->PicWidthInMbs + mb_x;
int *clipTable, *clipTable_c, *qp_clip_tab;
@@ -386,7 +387,7 @@ void DeblockMb(AVCCommonObj *video, int mb_x, int mb_y, uint8 *SrcY, uint8 *SrcU
/* Save Alpha, Beta and clipTable for future use, with the obselete variables filterLeftMbEdgeFlag, mbNum amd tmp */
filterLeftMbEdgeFlag = Alpha;
mbNum = Beta;
- tmp = (int)clipTable;
+ tmp = clipTable;
indexA = MbQ->QPc + video->FilterOffsetA;
indexB = MbQ->QPc + video->FilterOffsetB;
@@ -486,7 +487,7 @@ void DeblockMb(AVCCommonObj *video, int mb_x, int mb_y, uint8 *SrcY, uint8 *SrcU
/* Note that Alpha_c, Beta_c and clipTable_c for chroma is already calculated */
Alpha = filterLeftMbEdgeFlag;
Beta = mbNum;
- clipTable = (int *)tmp;
+ clipTable = tmp;
GetStrength_HorizontalEdges(Strength + 4, MbQ); // Strength for 4 blks in 1 stripe, 0 => vertical edge
diff --git a/media/libstagefright/codecs/avc/common/src/dpb.cpp b/media/libstagefright/codecs/avc/common/src/dpb.cpp
index 2c4c7da..b5d0dfe 100644
--- a/media/libstagefright/codecs/avc/common/src/dpb.cpp
+++ b/media/libstagefright/codecs/avc/common/src/dpb.cpp
@@ -152,7 +152,7 @@ OSCL_EXPORT_REF AVCStatus AVCConfigureSequence(AVCHandle *avcHandle, AVCCommonOb
framesize = (FrameHeightInMbs * PicWidthInMbs);
if (video->mblock)
{
- avcHandle->CBAVC_Free(userData, (uint32)video->mblock);
+ avcHandle->CBAVC_Free(userData, video->mblock);
video->mblock = NULL;
}
video->mblock = (AVCMacroblock*) avcHandle->CBAVC_Malloc(userData, sizeof(AVCMacroblock) * framesize, DEFAULT_ATTR);
@@ -187,7 +187,7 @@ OSCL_EXPORT_REF AVCStatus AVCConfigureSequence(AVCHandle *avcHandle, AVCCommonOb
if (video->MbToSliceGroupMap)
{
- avcHandle->CBAVC_Free(userData, (uint32)video->MbToSliceGroupMap);
+ avcHandle->CBAVC_Free(userData, video->MbToSliceGroupMap);
video->MbToSliceGroupMap = NULL;
}
video->MbToSliceGroupMap = (int*) avcHandle->CBAVC_Malloc(userData, sizeof(uint) * PicSizeInMapUnits * 2, 7/*DEFAULT_ATTR*/);
@@ -212,14 +212,14 @@ OSCL_EXPORT_REF AVCStatus CleanUpDPB(AVCHandle *avcHandle, AVCCommonObj *video)
{
if (dpb->fs[ii] != NULL)
{
- avcHandle->CBAVC_Free(userData, (int)dpb->fs[ii]);
+ avcHandle->CBAVC_Free(userData, dpb->fs[ii]);
dpb->fs[ii] = NULL;
}
}
#ifndef PV_MEMORY_POOL
if (dpb->decoded_picture_buffer)
{
- avcHandle->CBAVC_Free(userData, (int)dpb->decoded_picture_buffer);
+ avcHandle->CBAVC_Free(userData, dpb->decoded_picture_buffer);
dpb->decoded_picture_buffer = NULL;
}
#endif
diff --git a/media/libstagefright/codecs/avc/enc/Android.mk b/media/libstagefright/codecs/avc/enc/Android.mk
index 48923cf..845d1d3 100644
--- a/media/libstagefright/codecs/avc/enc/Android.mk
+++ b/media/libstagefright/codecs/avc/enc/Android.mk
@@ -28,7 +28,6 @@ LOCAL_C_INCLUDES := \
$(TOP)/frameworks/native/include/media/openmax
LOCAL_CFLAGS := \
- -D__arm__ \
-DOSCL_IMPORT_REF= -DOSCL_UNUSED_ARG= -DOSCL_EXPORT_REF=
include $(BUILD_STATIC_LIBRARY)
@@ -49,7 +48,6 @@ LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../common
LOCAL_CFLAGS := \
- -D__arm__ \
-DOSCL_IMPORT_REF= -DOSCL_UNUSED_ARG= -DOSCL_EXPORT_REF=
diff --git a/media/libstagefright/codecs/avc/enc/SoftAVCEncoder.cpp b/media/libstagefright/codecs/avc/enc/SoftAVCEncoder.cpp
index c6f658d..4133bdf 100644
--- a/media/libstagefright/codecs/avc/enc/SoftAVCEncoder.cpp
+++ b/media/libstagefright/codecs/avc/enc/SoftAVCEncoder.cpp
@@ -131,13 +131,16 @@ inline static void ConvertYUV420SemiPlanarToYUV420Planar(
}
}
-static int32_t MallocWrapper(
+static void* MallocWrapper(
void *userData, int32_t size, int32_t attrs) {
- return reinterpret_cast<int32_t>(malloc(size));
+ void *ptr = malloc(size);
+ if (ptr)
+ memset(ptr, 0, size);
+ return ptr;
}
-static void FreeWrapper(void *userData, int32_t ptr) {
- free(reinterpret_cast<void *>(ptr));
+static void FreeWrapper(void *userData, void* ptr) {
+ free(ptr);
}
static int32_t DpbAllocWrapper(void *userData,
@@ -843,12 +846,15 @@ void SoftAVCEncoder::onQueueFilled(OMX_U32 portIndex) {
outQueue.erase(outQueue.begin());
CHECK(!mInputBufferInfoVec.empty());
InputBufferInfo *inputBufInfo = mInputBufferInfoVec.begin();
- mInputBufferInfoVec.erase(mInputBufferInfoVec.begin());
outHeader->nTimeStamp = inputBufInfo->mTimeUs;
outHeader->nFlags |= (inputBufInfo->mFlags | OMX_BUFFERFLAG_ENDOFFRAME);
+ if (mSawInputEOS) {
+ outHeader->nFlags |= OMX_BUFFERFLAG_EOS;
+ }
outHeader->nFilledLen = dataLength;
outInfo->mOwnedByUs = false;
notifyFillBufferDone(outHeader);
+ mInputBufferInfoVec.erase(mInputBufferInfoVec.begin());
}
}
diff --git a/media/libstagefright/codecs/avc/enc/src/avcenc_api.cpp b/media/libstagefright/codecs/avc/enc/src/avcenc_api.cpp
index d39885d..cf14e10 100644
--- a/media/libstagefright/codecs/avc/enc/src/avcenc_api.cpp
+++ b/media/libstagefright/codecs/avc/enc/src/avcenc_api.cpp
@@ -77,7 +77,6 @@ OSCL_EXPORT_REF AVCEnc_Status PVAVCEncInitialize(AVCHandle *avcHandle, AVCEncPar
}
encvid = (AVCEncObject*) avcHandle->AVCObject;
- memset(encvid, 0, sizeof(AVCEncObject)); /* reset everything */
encvid->enc_state = AVCEnc_Initializing;
@@ -90,7 +89,6 @@ OSCL_EXPORT_REF AVCEnc_Status PVAVCEncInitialize(AVCHandle *avcHandle, AVCEncPar
}
video = encvid->common;
- memset(video, 0, sizeof(AVCCommonObj));
/* allocate bitstream structure */
encvid->bitstream = (AVCEncBitstream*) avcHandle->CBAVC_Malloc(userData, sizeof(AVCEncBitstream), DEFAULT_ATTR);
@@ -106,7 +104,6 @@ OSCL_EXPORT_REF AVCEnc_Status PVAVCEncInitialize(AVCHandle *avcHandle, AVCEncPar
{
return AVCENC_MEMORY_FAIL;
}
- memset(video->currSeqParams, 0, sizeof(AVCSeqParamSet));
/* allocate picture parameter set structure */
video->currPicParams = (AVCPicParamSet*) avcHandle->CBAVC_Malloc(userData, sizeof(AVCPicParamSet), DEFAULT_ATTR);
@@ -114,7 +111,6 @@ OSCL_EXPORT_REF AVCEnc_Status PVAVCEncInitialize(AVCHandle *avcHandle, AVCEncPar
{
return AVCENC_MEMORY_FAIL;
}
- memset(video->currPicParams, 0, sizeof(AVCPicParamSet));
/* allocate slice header structure */
video->sliceHdr = (AVCSliceHeader*) avcHandle->CBAVC_Malloc(userData, sizeof(AVCSliceHeader), DEFAULT_ATTR);
@@ -122,7 +118,6 @@ OSCL_EXPORT_REF AVCEnc_Status PVAVCEncInitialize(AVCHandle *avcHandle, AVCEncPar
{
return AVCENC_MEMORY_FAIL;
}
- memset(video->sliceHdr, 0, sizeof(AVCSliceHeader));
/* allocate encoded picture buffer structure*/
video->decPicBuf = (AVCDecPicBuffer*) avcHandle->CBAVC_Malloc(userData, sizeof(AVCDecPicBuffer), DEFAULT_ATTR);
@@ -130,7 +125,6 @@ OSCL_EXPORT_REF AVCEnc_Status PVAVCEncInitialize(AVCHandle *avcHandle, AVCEncPar
{
return AVCENC_MEMORY_FAIL;
}
- memset(video->decPicBuf, 0, sizeof(AVCDecPicBuffer));
/* allocate rate control structure */
encvid->rateCtrl = (AVCRateControl*) avcHandle->CBAVC_Malloc(userData, sizeof(AVCRateControl), DEFAULT_ATTR);
@@ -138,7 +132,6 @@ OSCL_EXPORT_REF AVCEnc_Status PVAVCEncInitialize(AVCHandle *avcHandle, AVCEncPar
{
return AVCENC_MEMORY_FAIL;
}
- memset(encvid->rateCtrl, 0, sizeof(AVCRateControl));
/* reset frame list, not really needed */
video->currPic = NULL;
@@ -194,7 +187,6 @@ OSCL_EXPORT_REF AVCEnc_Status PVAVCEncInitialize(AVCHandle *avcHandle, AVCEncPar
{
return AVCENC_MEMORY_FAIL;
}
- memset(encvid->mot16x16, 0, sizeof(AVCMV)*framesize);
encvid->intraSearch = (uint8*) avcHandle->CBAVC_Malloc(userData, sizeof(uint8) * framesize, DEFAULT_ATTR);
if (encvid->intraSearch == NULL)
@@ -573,7 +565,7 @@ OSCL_EXPORT_REF AVCEnc_Status PVAVCEncGetRecon(AVCHandle *avcHandle, AVCFrameIO
recon->pitch = currFS->frame.pitch;
recon->disp_order = currFS->PicOrderCnt;
recon->coding_order = currFS->FrameNum;
- recon->id = (uint32) currFS->base_dpb; /* use the pointer as the id */
+ recon->id = (intptr_t) currFS->base_dpb; /* use the pointer as the id */
currFS->IsOutputted |= 1;
@@ -610,32 +602,32 @@ OSCL_EXPORT_REF void PVAVCCleanUpEncoder(AVCHandle *avcHandle)
if (encvid->functionPointer != NULL)
{
- avcHandle->CBAVC_Free(userData, (int)encvid->functionPointer);
+ avcHandle->CBAVC_Free(userData, encvid->functionPointer);
}
if (encvid->min_cost)
{
- avcHandle->CBAVC_Free(userData, (int)encvid->min_cost);
+ avcHandle->CBAVC_Free(userData, encvid->min_cost);
}
if (encvid->intraSearch)
{
- avcHandle->CBAVC_Free(userData, (int)encvid->intraSearch);
+ avcHandle->CBAVC_Free(userData, encvid->intraSearch);
}
if (encvid->mot16x16)
{
- avcHandle->CBAVC_Free(userData, (int)encvid->mot16x16);
+ avcHandle->CBAVC_Free(userData, encvid->mot16x16);
}
if (encvid->rateCtrl)
{
- avcHandle->CBAVC_Free(userData, (int)encvid->rateCtrl);
+ avcHandle->CBAVC_Free(userData, encvid->rateCtrl);
}
if (encvid->overrunBuffer)
{
- avcHandle->CBAVC_Free(userData, (int)encvid->overrunBuffer);
+ avcHandle->CBAVC_Free(userData, encvid->overrunBuffer);
}
video = encvid->common;
@@ -643,45 +635,45 @@ OSCL_EXPORT_REF void PVAVCCleanUpEncoder(AVCHandle *avcHandle)
{
if (video->MbToSliceGroupMap)
{
- avcHandle->CBAVC_Free(userData, (int)video->MbToSliceGroupMap);
+ avcHandle->CBAVC_Free(userData, video->MbToSliceGroupMap);
}
if (video->mblock != NULL)
{
- avcHandle->CBAVC_Free(userData, (int)video->mblock);
+ avcHandle->CBAVC_Free(userData, video->mblock);
}
if (video->decPicBuf != NULL)
{
CleanUpDPB(avcHandle, video);
- avcHandle->CBAVC_Free(userData, (int)video->decPicBuf);
+ avcHandle->CBAVC_Free(userData, video->decPicBuf);
}
if (video->sliceHdr != NULL)
{
- avcHandle->CBAVC_Free(userData, (int)video->sliceHdr);
+ avcHandle->CBAVC_Free(userData, video->sliceHdr);
}
if (video->currPicParams != NULL)
{
if (video->currPicParams->slice_group_id)
{
- avcHandle->CBAVC_Free(userData, (int)video->currPicParams->slice_group_id);
+ avcHandle->CBAVC_Free(userData, video->currPicParams->slice_group_id);
}
- avcHandle->CBAVC_Free(userData, (int)video->currPicParams);
+ avcHandle->CBAVC_Free(userData, video->currPicParams);
}
if (video->currSeqParams != NULL)
{
- avcHandle->CBAVC_Free(userData, (int)video->currSeqParams);
+ avcHandle->CBAVC_Free(userData, video->currSeqParams);
}
if (encvid->bitstream != NULL)
{
- avcHandle->CBAVC_Free(userData, (int)encvid->bitstream);
+ avcHandle->CBAVC_Free(userData, encvid->bitstream);
}
if (video != NULL)
{
- avcHandle->CBAVC_Free(userData, (int)video);
+ avcHandle->CBAVC_Free(userData, video);
}
}
- avcHandle->CBAVC_Free(userData, (int)encvid);
+ avcHandle->CBAVC_Free(userData, encvid);
avcHandle->AVCObject = NULL;
}
diff --git a/media/libstagefright/codecs/avc/enc/src/bitstream_io.cpp b/media/libstagefright/codecs/avc/enc/src/bitstream_io.cpp
index 75ab514..0e3037f 100644
--- a/media/libstagefright/codecs/avc/enc/src/bitstream_io.cpp
+++ b/media/libstagefright/codecs/avc/enc/src/bitstream_io.cpp
@@ -275,8 +275,8 @@ AVCEnc_Status AVCBitstreamUseOverrunBuffer(AVCEncBitstream* stream, int numExtra
// allocate new overrun Buffer
if (encvid->overrunBuffer)
{
- encvid->avcHandle->CBAVC_Free((uint32*)encvid->avcHandle->userData,
- (int)encvid->overrunBuffer);
+ encvid->avcHandle->CBAVC_Free(encvid->avcHandle->userData,
+ encvid->overrunBuffer);
}
encvid->oBSize = stream->oBSize;
@@ -314,8 +314,8 @@ AVCEnc_Status AVCBitstreamUseOverrunBuffer(AVCEncBitstream* stream, int numExtra
// copy from the old buffer to new buffer
memcpy(encvid->overrunBuffer, stream->overrunBuffer, stream->write_pos);
// free old buffer
- encvid->avcHandle->CBAVC_Free((uint32*)encvid->avcHandle->userData,
- (int)stream->overrunBuffer);
+ encvid->avcHandle->CBAVC_Free(encvid->avcHandle->userData,
+ stream->overrunBuffer);
// assign pointer to new buffer
stream->overrunBuffer = encvid->overrunBuffer;
diff --git a/media/libstagefright/codecs/avc/enc/src/motion_comp.cpp b/media/libstagefright/codecs/avc/enc/src/motion_comp.cpp
index ac62d78..a390f88 100644
--- a/media/libstagefright/codecs/avc/enc/src/motion_comp.cpp
+++ b/media/libstagefright/codecs/avc/enc/src/motion_comp.cpp
@@ -198,7 +198,7 @@ void eCreateAlign(uint8 *ref, int picpitch, int y_pos,
out_offset = 24 - blkwidth;
//switch(x_pos&0x3){
- switch (((uint32)ref)&0x3)
+ switch (((intptr_t)ref)&0x3)
{
case 1:
offset = picpitch - blkwidth - 3;
@@ -268,9 +268,9 @@ void eCreateAlign(uint8 *ref, int picpitch, int y_pos,
void eHorzInterp1MC(uint8 *in, int inpitch, uint8 *out, int outpitch,
int blkwidth, int blkheight, int dx)
{
- uint8 *p_ref;
+ uint8 *p_ref, *tmp;
uint32 *p_cur;
- uint32 tmp, pkres;
+ uint32 pkres;
int result, curr_offset, ref_offset;
int j;
int32 r0, r1, r2, r3, r4, r5;
@@ -288,14 +288,14 @@ void eHorzInterp1MC(uint8 *in, int inpitch, uint8 *out, int outpitch,
r13 = 0;
for (j = blkheight; j > 0; j--)
{
- tmp = (uint32)(p_ref + blkwidth);
+ tmp = p_ref + blkwidth;
r0 = p_ref[0];
r1 = p_ref[2];
r0 |= (r1 << 16); /* 0,c,0,a */
r1 = p_ref[1];
r2 = p_ref[3];
r1 |= (r2 << 16); /* 0,d,0,b */
- while ((uint32)p_ref < tmp)
+ while (p_ref < tmp)
{
r2 = *(p_ref += 4); /* move pointer to e */
r3 = p_ref[2];
@@ -360,8 +360,8 @@ void eHorzInterp1MC(uint8 *in, int inpitch, uint8 *out, int outpitch,
p_ref -= (ref_offset + blkwidth); /* input */
p_cur -= (outpitch >> 2);
- tmp = (uint32)(p_ref + blkwidth);
- for (; (uint32)p_ref < tmp;)
+ tmp = p_ref + blkwidth;
+ for (; p_ref < tmp;)
{
r0 = *p_ref++;
@@ -434,14 +434,14 @@ void eHorzInterp1MC(uint8 *in, int inpitch, uint8 *out, int outpitch,
r13 = 0;
for (j = blkheight; j > 0; j--)
{
- tmp = (uint32)(p_ref + blkwidth);
+ tmp = p_ref + blkwidth;
r0 = p_ref[0];
r1 = p_ref[2];
r0 |= (r1 << 16); /* 0,c,0,a */
r1 = p_ref[1];
r2 = p_ref[3];
r1 |= (r2 << 16); /* 0,d,0,b */
- while ((uint32)p_ref < tmp)
+ while (p_ref < tmp)
{
r2 = *(p_ref += 4); /* move pointer to e */
r3 = p_ref[2];
@@ -494,8 +494,8 @@ void eHorzInterp1MC(uint8 *in, int inpitch, uint8 *out, int outpitch,
p_ref -= (ref_offset + blkwidth); /* input */
p_cur -= (outpitch >> 2);
- tmp = (uint32)(p_ref + blkwidth);
- for (; (uint32)p_ref < tmp;)
+ tmp = p_ref + blkwidth;
+ for (; p_ref < tmp;)
{
r0 = *p_ref++;
@@ -558,9 +558,9 @@ void eHorzInterp1MC(uint8 *in, int inpitch, uint8 *out, int outpitch,
void eHorzInterp2MC(int *in, int inpitch, uint8 *out, int outpitch,
int blkwidth, int blkheight, int dx)
{
- int *p_ref;
+ int *p_ref, *tmp;
uint32 *p_cur;
- uint32 tmp, pkres;
+ uint32 pkres;
int result, result2, curr_offset, ref_offset;
int j, r0, r1, r2, r3, r4, r5;
@@ -575,8 +575,8 @@ void eHorzInterp2MC(int *in, int inpitch, uint8 *out, int outpitch,
for (j = blkheight; j > 0 ; j--)
{
- tmp = (uint32)(p_ref + blkwidth);
- for (; (uint32)p_ref < tmp;)
+ tmp = p_ref + blkwidth;
+ for (; p_ref < tmp;)
{
r0 = p_ref[-2];
@@ -654,8 +654,8 @@ void eHorzInterp2MC(int *in, int inpitch, uint8 *out, int outpitch,
{
for (j = blkheight; j > 0 ; j--)
{
- tmp = (uint32)(p_ref + blkwidth);
- for (; (uint32)p_ref < tmp;)
+ tmp = p_ref + blkwidth;
+ for (; p_ref < tmp;)
{
r0 = p_ref[-2];
@@ -717,9 +717,8 @@ void eHorzInterp2MC(int *in, int inpitch, uint8 *out, int outpitch,
void eHorzInterp3MC(uint8 *in, int inpitch, int *out, int outpitch,
int blkwidth, int blkheight)
{
- uint8 *p_ref;
+ uint8 *p_ref, *tmp;
int *p_cur;
- uint32 tmp;
int result, curr_offset, ref_offset;
int j, r0, r1, r2, r3, r4, r5;
@@ -730,8 +729,8 @@ void eHorzInterp3MC(uint8 *in, int inpitch, int *out, int outpitch,
for (j = blkheight; j > 0 ; j--)
{
- tmp = (uint32)(p_ref + blkwidth);
- for (; (uint32)p_ref < tmp;)
+ tmp = p_ref + blkwidth;
+ for (; p_ref < tmp;)
{
r0 = p_ref[-2];
@@ -782,15 +781,14 @@ void eHorzInterp3MC(uint8 *in, int inpitch, int *out, int outpitch,
void eVertInterp1MC(uint8 *in, int inpitch, uint8 *out, int outpitch,
int blkwidth, int blkheight, int dy)
{
- uint8 *p_cur, *p_ref;
- uint32 tmp;
+ uint8 *p_cur, *p_ref, *tmp;
int result, curr_offset, ref_offset;
int j, i;
int32 r0, r1, r2, r3, r4, r5, r6, r7, r8, r13;
uint8 tmp_in[24][24];
/* not word-aligned */
- if (((uint32)in)&0x3)
+ if (((intptr_t)in)&0x3)
{
eCreateAlign(in, inpitch, -2, &tmp_in[0][0], blkwidth, blkheight + 5);
in = &tmp_in[2][0];
@@ -811,8 +809,8 @@ void eVertInterp1MC(uint8 *in, int inpitch, uint8 *out, int outpitch,
r13 = 0;
p_ref = in;
p_cur -= outpitch; /* compensate for the first offset */
- tmp = (uint32)(p_ref + ref_offset); /* limit */
- while ((uint32)p_ref < tmp) /* the loop un-rolled */
+ tmp = p_ref + ref_offset; /* limit */
+ while (p_ref < tmp) /* the loop un-rolled */
{
r0 = *((uint32*)(p_ref - (inpitch << 1))); /* load 4 bytes */
p_ref += inpitch;
@@ -885,8 +883,8 @@ void eVertInterp1MC(uint8 *in, int inpitch, uint8 *out, int outpitch,
p_ref = in + i;
p_cur -= outpitch; /* compensate for the first offset */
- tmp = (uint32)(p_ref + ref_offset); /* limit */
- while ((uint32)p_ref < tmp)
+ tmp = p_ref + ref_offset; /* limit */
+ while (p_ref < tmp)
{ /* loop un-rolled */
r0 = *(p_ref - (inpitch << 1));
r1 = *(p_ref - inpitch);
@@ -959,8 +957,8 @@ void eVertInterp1MC(uint8 *in, int inpitch, uint8 *out, int outpitch,
r13 = 0;
p_ref = in;
p_cur -= outpitch; /* compensate for the first offset */
- tmp = (uint32)(p_ref + ref_offset); /* limit */
- while ((uint32)p_ref < tmp) /* the loop un-rolled */
+ tmp = p_ref + ref_offset; /* limit */
+ while (p_ref < tmp) /* the loop un-rolled */
{
r0 = *((uint32*)(p_ref - (inpitch << 1))); /* load 4 bytes */
p_ref += inpitch;
@@ -1023,8 +1021,8 @@ void eVertInterp1MC(uint8 *in, int inpitch, uint8 *out, int outpitch,
{
p_ref = in + i;
p_cur -= outpitch; /* compensate for the first offset */
- tmp = (uint32)(p_ref + ref_offset); /* limit */
- while ((uint32)p_ref < tmp)
+ tmp = p_ref + ref_offset; /* limit */
+ while (p_ref < tmp)
{ /* loop un-rolled */
r0 = *(p_ref - (inpitch << 1));
r1 = *(p_ref - inpitch);
@@ -1086,8 +1084,7 @@ void eVertInterp2MC(uint8 *in, int inpitch, int *out, int outpitch,
int blkwidth, int blkheight)
{
int *p_cur;
- uint8 *p_ref;
- uint32 tmp;
+ uint8 *p_ref, *tmp;
int result, curr_offset, ref_offset;
int j, r0, r1, r2, r3, r4, r5;
@@ -1100,8 +1097,8 @@ void eVertInterp2MC(uint8 *in, int inpitch, int *out, int outpitch,
p_cur -= outpitch; /* compensate for the first offset */
p_ref = in++;
- tmp = (uint32)(p_ref + ref_offset); /* limit */
- while ((uint32)p_ref < tmp)
+ tmp = p_ref + ref_offset; /* limit */
+ while (p_ref < tmp)
{ /* loop un-rolled */
r0 = *(p_ref - (inpitch << 1));
r1 = *(p_ref - inpitch);
@@ -1152,8 +1149,7 @@ void eVertInterp3MC(int *in, int inpitch, uint8 *out, int outpitch,
int blkwidth, int blkheight, int dy)
{
uint8 *p_cur;
- int *p_ref;
- uint32 tmp;
+ int *p_ref, *tmp;
int result, result2, curr_offset, ref_offset;
int j, r0, r1, r2, r3, r4, r5;
@@ -1170,8 +1166,8 @@ void eVertInterp3MC(int *in, int inpitch, uint8 *out, int outpitch,
p_cur -= outpitch; /* compensate for the first offset */
p_ref = in++;
- tmp = (uint32)(p_ref + ref_offset); /* limit */
- while ((uint32)p_ref < tmp)
+ tmp = p_ref + ref_offset; /* limit */
+ while (p_ref < tmp)
{ /* loop un-rolled */
r0 = *(p_ref - (inpitch << 1));
r1 = *(p_ref - inpitch);
@@ -1250,8 +1246,8 @@ void eVertInterp3MC(int *in, int inpitch, uint8 *out, int outpitch,
p_cur -= outpitch; /* compensate for the first offset */
p_ref = in++;
- tmp = (uint32)(p_ref + ref_offset); /* limit */
- while ((uint32)p_ref < tmp)
+ tmp = p_ref + ref_offset; /* limit */
+ while (p_ref < tmp)
{ /* loop un-rolled */
r0 = *(p_ref - (inpitch << 1));
r1 = *(p_ref - inpitch);
@@ -1313,11 +1309,11 @@ void eDiagonalInterpMC(uint8 *in1, uint8 *in2, int inpitch,
{
int j, i;
int result;
- uint8 *p_cur, *p_ref, *p_tmp8;
+ uint8 *p_cur, *p_ref, *p_tmp8, *tmp;
int curr_offset, ref_offset;
uint8 tmp_res[24][24], tmp_in[24][24];
uint32 *p_tmp;
- uint32 tmp, pkres, tmp_result;
+ uint32 pkres, tmp_result;
int32 r0, r1, r2, r3, r4, r5;
int32 r6, r7, r8, r9, r10, r13;
@@ -1337,7 +1333,7 @@ void eDiagonalInterpMC(uint8 *in1, uint8 *in2, int inpitch,
for (j = blkheight; j > 0; j--)
{
r13 = 0;
- tmp = (uint32)(p_ref + blkwidth);
+ tmp = p_ref + blkwidth;
//r0 = *((uint32*)p_ref); /* d,c,b,a */
//r1 = (r0>>8)&0xFF00FF; /* 0,d,0,b */
@@ -1350,7 +1346,7 @@ void eDiagonalInterpMC(uint8 *in1, uint8 *in2, int inpitch,
r2 = p_ref[3];
r1 |= (r2 << 16); /* 0,d,0,b */
- while ((uint32)p_ref < tmp)
+ while (p_ref < tmp)
{
//r2 = *((uint32*)(p_ref+=4));/* h,g,f,e */
//r3 = (r2>>8)&0xFF00FF; /* 0,h,0,f */
@@ -1406,8 +1402,8 @@ void eDiagonalInterpMC(uint8 *in1, uint8 *in2, int inpitch,
/* move back to the beginning of the line */
p_ref -= (ref_offset + blkwidth); /* input */
p_tmp -= 6; /* intermediate output */
- tmp = (uint32)(p_ref + blkwidth);
- while ((uint32)p_ref < tmp)
+ tmp = p_ref + blkwidth;
+ while (p_ref < tmp)
{
r0 = *p_ref++;
r1 = *p_ref++;
@@ -1465,7 +1461,7 @@ void eDiagonalInterpMC(uint8 *in1, uint8 *in2, int inpitch,
/* perform vertical interpolation */
/* not word-aligned */
- if (((uint32)in2)&0x3)
+ if (((intptr_t)in2)&0x3)
{
eCreateAlign(in2, inpitch, -2, &tmp_in[0][0], blkwidth, blkheight + 5);
in2 = &tmp_in[2][0];
@@ -1485,8 +1481,8 @@ void eDiagonalInterpMC(uint8 *in1, uint8 *in2, int inpitch,
p_tmp8 = &(tmp_res[0][j]); /* intermediate result */
p_tmp8 -= 24; /* compensate for the first offset */
p_cur -= outpitch; /* compensate for the first offset */
- tmp = (uint32)(p_ref + pkres); /* limit */
- while ((uint32)p_ref < tmp) /* the loop un-rolled */
+ tmp = p_ref + pkres; /* limit */
+ while (p_ref < tmp) /* the loop un-rolled */
{
/* Read 1 byte at a time is too slow, too many read and pack ops, need to call CreateAlign */
/*p_ref8 = p_ref-(inpitch<<1); r0 = p_ref8[0]; r1 = p_ref8[2];
@@ -1579,8 +1575,8 @@ void eDiagonalInterpMC(uint8 *in1, uint8 *in2, int inpitch,
p_tmp8 = &(tmp_res[0][j+i]); /* intermediate result */
p_tmp8 -= 24; /* compensate for the first offset */
p_cur -= outpitch; /* compensate for the first offset */
- tmp = (uint32)(p_ref + pkres); /* limit */
- while ((uint32)p_ref < tmp) /* the loop un-rolled */
+ tmp = p_ref + pkres; /* limit */
+ while (p_ref < tmp) /* the loop un-rolled */
{
r0 = *(p_ref - (inpitch << 1));
r1 = *(p_ref - inpitch);
@@ -1659,7 +1655,7 @@ void eFullPelMC(uint8 *in, int inpitch, uint8 *out, int outpitch,
uint32 temp;
uint8 byte;
- if (((uint32)in)&3)
+ if (((intptr_t)in)&3)
{
for (j = blkheight; j > 0; j--)
{
@@ -1720,7 +1716,7 @@ void ePadChroma(uint8 *ref, int picwidth, int picheight, int picpitch, int x_pos
else start = ref + x_pos;
/* word-align start */
- offset = (uint32)start & 0x3;
+ offset = (intptr_t)start & 0x3;
if (offset) start -= offset;
word1 = *((uint32*)start);
@@ -1746,7 +1742,7 @@ void ePadChroma(uint8 *ref, int picwidth, int picheight, int picpitch, int x_pos
else start = ref + picpitch * (picheight - 1) + x_pos;
/* word-align start */
- offset = (uint32)start & 0x3;
+ offset = (intptr_t)start & 0x3;
if (offset) start -= offset;
word1 = *((uint32*)start);
@@ -2121,7 +2117,7 @@ void eChromaFullMC_SIMD(uint8 *pRef, int srcPitch, int dx, int dy,
uint16 temp;
uint8 byte;
- if (((uint32)pRef)&1)
+ if (((intptr_t)pRef)&1)
{
for (j = blkheight; j > 0; j--)
{
diff --git a/media/libstagefright/codecs/avc/enc/src/motion_est.cpp b/media/libstagefright/codecs/avc/enc/src/motion_est.cpp
index f650ef9..00c56c8 100644
--- a/media/libstagefright/codecs/avc/enc/src/motion_est.cpp
+++ b/media/libstagefright/codecs/avc/enc/src/motion_est.cpp
@@ -176,7 +176,7 @@ void CleanMotionSearchModule(AVCHandle *avcHandle)
if (encvid->mvbits_array)
{
- avcHandle->CBAVC_Free(avcHandle->userData, (int)(encvid->mvbits_array));
+ avcHandle->CBAVC_Free(avcHandle->userData, encvid->mvbits_array);
encvid->mvbits = NULL;
}
diff --git a/media/libstagefright/codecs/avc/enc/src/rate_control.cpp b/media/libstagefright/codecs/avc/enc/src/rate_control.cpp
index 15b55fb..aa13873 100644
--- a/media/libstagefright/codecs/avc/enc/src/rate_control.cpp
+++ b/media/libstagefright/codecs/avc/enc/src/rate_control.cpp
@@ -190,7 +190,6 @@ AVCEnc_Status InitRateControlModule(AVCHandle *avcHandle)
{
goto CLEANUP_RC;
}
- memset(rateCtrl->pMP, 0, sizeof(MultiPass));
rateCtrl->pMP->encoded_frames = -1; /* forget about the very first I frame */
/* RDInfo **pRDSamples */
@@ -207,7 +206,6 @@ AVCEnc_Status InitRateControlModule(AVCHandle *avcHandle)
{
goto CLEANUP_RC;
}
- for (j = 0; j < 32; j++) memset(&(rateCtrl->pMP->pRDSamples[i][j]), 0, sizeof(RDInfo));
}
rateCtrl->pMP->frameRange = (int)(rateCtrl->frame_rate * 1.0); /* 1.0s time frame*/
rateCtrl->pMP->frameRange = AVC_MAX(rateCtrl->pMP->frameRange, 5);
@@ -300,7 +298,7 @@ void CleanupRateControlModule(AVCHandle *avcHandle)
if (rateCtrl->MADofMB)
{
- avcHandle->CBAVC_Free(avcHandle->userData, (int)(rateCtrl->MADofMB));
+ avcHandle->CBAVC_Free(avcHandle->userData, rateCtrl->MADofMB);
}
if (rateCtrl->pMP)
@@ -311,12 +309,12 @@ void CleanupRateControlModule(AVCHandle *avcHandle)
{
if (rateCtrl->pMP->pRDSamples[i])
{
- avcHandle->CBAVC_Free(avcHandle->userData, (int)rateCtrl->pMP->pRDSamples[i]);
+ avcHandle->CBAVC_Free(avcHandle->userData, rateCtrl->pMP->pRDSamples[i]);
}
}
- avcHandle->CBAVC_Free(avcHandle->userData, (int)rateCtrl->pMP->pRDSamples);
+ avcHandle->CBAVC_Free(avcHandle->userData, rateCtrl->pMP->pRDSamples);
}
- avcHandle->CBAVC_Free(avcHandle->userData, (int)(rateCtrl->pMP));
+ avcHandle->CBAVC_Free(avcHandle->userData, rateCtrl->pMP);
}
return ;
diff --git a/media/libstagefright/codecs/avc/enc/src/sad_halfpel_inline.h b/media/libstagefright/codecs/avc/enc/src/sad_halfpel_inline.h
index 3a21647..22f545a 100644
--- a/media/libstagefright/codecs/avc/enc/src/sad_halfpel_inline.h
+++ b/media/libstagefright/codecs/avc/enc/src/sad_halfpel_inline.h
@@ -24,7 +24,9 @@ extern "C"
{
#endif
-#if defined(__GNUC__) && defined(__arm__) /* ARM GNU COMPILER */
+/* Intentionally not using the gcc asm version, since it is
+ * slightly slower than the plain C version on modern GCC versions. */
+#if !defined(__CC_ARM) /* Generic C version */
__inline int32 INTERP1_SUB_SAD(int32 sad, int32 tmp, int32 tmp2)
{
@@ -74,14 +76,26 @@ extern "C"
__inline int32 INTERP1_SUB_SAD(int32 sad, int32 tmp, int32 tmp2)
{
-__asm__ volatile("rsbs %1, %1, %2, asr #1\n\trsbmi %1, %1, #0\n\tadd %0, %0, %1": "=r"(sad), "=r"(tmp): "r"(tmp2));
+ __asm__ volatile(
+ "rsbs %1, %1, %2, asr #1\n\t"
+ "rsbmi %1, %1, #0\n\t"
+ "add %0, %0, %1"
+ : "+r"(sad), "+r"(tmp)
+ : "r"(tmp2)
+ );
return sad;
}
__inline int32 INTERP2_SUB_SAD(int32 sad, int32 tmp, int32 tmp2)
{
-__asm__ volatile("rsbs %1, %2, %1, asr #2\n\trsbmi %1, %1, #0\n\tadd %0, %0, %1": "=r"(sad), "=r"(tmp): "r"(tmp2));
+ __asm__ volatile(
+ "rsbs %1, %2, %1, asr #2\n\t"
+ "rsbmi %1, %1, #0\n\t"
+ "add %0, %0, %1"
+ : "+r"(sad), "+r"(tmp)
+ : "r"(tmp2)
+ );
return sad;
}
diff --git a/media/libstagefright/codecs/avc/enc/src/sad_inline.h b/media/libstagefright/codecs/avc/enc/src/sad_inline.h
index f39794f..47abc65 100644
--- a/media/libstagefright/codecs/avc/enc/src/sad_inline.h
+++ b/media/libstagefright/codecs/avc/enc/src/sad_inline.h
@@ -23,7 +23,9 @@ extern "C"
{
#endif
-#if defined(__GNUC__) && defined(__arm__) /* ARM GNU COMPILER */
+/* Intentionally not using the gcc asm version, since it is
+ * slightly slower than the plain C version on modern GCC versions. */
+#if !defined(__CC_ARM) /* Generic C version */
__inline int32 SUB_SAD(int32 sad, int32 tmp, int32 tmp2)
{
@@ -80,7 +82,7 @@ extern "C"
x9 = 0x80808080; /* const. */
- x8 = (uint32)ref & 0x3;
+ x8 = (intptr_t)ref & 0x3;
if (x8 == 3)
goto SadMBOffset3;
if (x8 == 2)
@@ -340,7 +342,13 @@ SadMBOffset1:
__inline int32 SUB_SAD(int32 sad, int32 tmp, int32 tmp2)
{
-__asm__ volatile("rsbs %1, %1, %2\n\trsbmi %1, %1, #0\n\tadd %0, %0, %1": "=r"(sad): "r"(tmp), "r"(tmp2));
+ __asm__ volatile(
+ "rsbs %1, %1, %2\n\t"
+ "rsbmi %1, %1, #0\n\t"
+ "add %0, %0, %1"
+ : "+r"(sad), "+r"(tmp)
+ : "r"(tmp2)
+ );
return sad;
}
@@ -348,7 +356,18 @@ __asm__ volatile("rsbs %1, %1, %2\n\trsbmi %1, %1, #0\n\tadd %0, %0, %1": "=r"(s
{
int32 x7;
-__asm__ volatile("EOR %1, %2, %0\n\tSUBS %0, %2, %0\n\tEOR %1, %1, %0\n\tAND %1, %3, %1, lsr #1\n\tORRCC %1, %1, #0x80000000\n\tRSB %1, %1, %1, lsl #8\n\tADD %0, %0, %1, asr #7\n\tEOR %0, %0, %1, asr #7": "=r"(src1), "=&r"(x7): "r"(src2), "r"(mask));
+ __asm__ volatile(
+ "EOR %1, %2, %0\n\t"
+ "SUBS %0, %2, %0\n\t"
+ "EOR %1, %1, %0\n\t"
+ "AND %1, %3, %1, lsr #1\n\t"
+ "ORRCC %1, %1, #0x80000000\n\t"
+ "RSB %1, %1, %1, lsl #8\n\t"
+ "ADD %0, %0, %1, asr #7\n\t"
+ "EOR %0, %0, %1, asr #7"
+ : "+r"(src1), "=&r"(x7)
+ : "r"(src2), "r"(mask)
+ );
return src1;
}
@@ -357,12 +376,31 @@ __asm__ volatile("EOR %1, %2, %0\n\tSUBS %0, %2, %0\n\tEOR %1, %1, %0\n\tAND %
{
int32 x7;
-__asm__ volatile("EOR %1, %2, %0\n\tADDS %0, %2, %0\n\tEOR %1, %1, %0\n\tANDS %1, %3, %1, rrx\n\tRSB %1, %1, %1, lsl #8\n\tSUB %0, %0, %1, asr #7\n\tEOR %0, %0, %1, asr #7": "=r"(src1), "=&r"(x7): "r"(src2), "r"(mask));
+ __asm__ volatile(
+ "EOR %1, %2, %0\n\t"
+ "ADDS %0, %2, %0\n\t"
+ "EOR %1, %1, %0\n\t"
+ "ANDS %1, %3, %1, rrx\n\t"
+ "RSB %1, %1, %1, lsl #8\n\t"
+ "SUB %0, %0, %1, asr #7\n\t"
+ "EOR %0, %0, %1, asr #7"
+ : "+r"(src1), "=&r"(x7)
+ : "r"(src2), "r"(mask)
+ );
return src1;
}
-#define sum_accumulate __asm__ volatile("SBC %0, %0, %1\n\tBIC %1, %4, %1\n\tADD %2, %2, %1, lsr #8\n\tSBC %0, %0, %3\n\tBIC %3, %4, %3\n\tADD %2, %2, %3, lsr #8": "=&r" (x5), "=&r" (x10), "=&r" (x4), "=&r" (x11): "r" (x6));
+#define sum_accumulate __asm__ volatile( \
+ "SBC %0, %0, %1\n\t" \
+ "BIC %1, %4, %1\n\t" \
+ "ADD %2, %2, %1, lsr #8\n\t" \
+ "SBC %0, %0, %3\n\t" \
+ "BIC %3, %4, %3\n\t" \
+ "ADD %2, %2, %3, lsr #8" \
+ : "+r" (x5), "+r" (x10), "+r" (x4), "+r" (x11) \
+ : "r" (x6) \
+ );
#define NUMBER 3
#define SHIFT 24
@@ -404,7 +442,7 @@ __asm__ volatile("EOR %1, %2, %0\n\tADDS %0, %2, %0\n\tEOR %1, %1, %0\n\tANDS
x8 = 16;
///
-__asm__ volatile("MVN %0, #0xFF00": "=r"(x6));
+ __asm__ volatile("MVN %0, #0xFF00": "=r"(x6));
LOOP_SAD0:
/****** process 8 pixels ******/
@@ -428,10 +466,10 @@ LOOP_SAD0:
/****** process 8 pixels ******/
x11 = *((int32*)(ref + 4));
-__asm__ volatile("LDR %0, [%1], %2": "=&r"(x10), "=r"(ref): "r"(lx));
+ __asm__ volatile("LDR %0, [%1], %2": "=&r"(x10), "+r"(ref): "r"(lx));
//x10 = *((int32*)ref); ref+=lx;
x14 = *((int32*)(blk + 4));
-__asm__ volatile("LDR %0, [%1], #16": "=&r"(x12), "=r"(blk));
+ __asm__ volatile("LDR %0, [%1], #16": "=&r"(x12), "+r"(blk));
/* process x11 & x14 */
x11 = sad_4pixel(x11, x14, x9);
diff --git a/media/libstagefright/codecs/avc/enc/src/sad_mb_offset.h b/media/libstagefright/codecs/avc/enc/src/sad_mb_offset.h
index d5d4a42..20ca7eb 100644
--- a/media/libstagefright/codecs/avc/enc/src/sad_mb_offset.h
+++ b/media/libstagefright/codecs/avc/enc/src/sad_mb_offset.h
@@ -16,7 +16,9 @@
* -------------------------------------------------------------------
*/
-#if defined(__GNUC__) && defined(__arm__) /* ARM GNU COMPILER */
+/* Intentionally not using the gcc asm version, since it is
+ * slightly slower than the plain C version on modern GCC versions. */
+#if !defined(__CC_ARM) /* Generic C version */
#if (NUMBER==3)
__inline int32 sad_mb_offset3(uint8 *ref, uint8 *blk, int lx, int dmin)
@@ -227,7 +229,7 @@ __inline int32 sad_mb_offset1(uint8 *ref, uint8 *blk, int lx, int dmin)
x4 = x5 = 0;
x8 = 16; //<<===========*******
-__asm__ volatile("MVN %0, #0xFF0000": "=r"(x6));
+ __asm__ volatile("MVN %0, #0xFF0000": "=r"(x6));
#if (NUMBER==3)
LOOP_SAD3:
@@ -236,7 +238,7 @@ LOOP_SAD2:
#elif (NUMBER==1)
LOOP_SAD1:
#endif
-__asm__ volatile("BIC %0, %0, #3": "=r"(ref));
+ __asm__ volatile("BIC %0, %0, #3": "+r"(ref));
/****** process 8 pixels ******/
x11 = *((int32*)(ref + 12));
x12 = *((int32*)(ref + 16));
@@ -244,11 +246,32 @@ __asm__ volatile("BIC %0, %0, #3": "=r"(ref));
x14 = *((int32*)(blk + 12));
#if (SHIFT==8)
-__asm__ volatile("MVN %0, %0, lsr #8\n\tBIC %0, %0, %1,lsl #24\n\tMVN %1, %1,lsr #8\n\tBIC %1, %1, %2,lsl #24": "=&r"(x10), "=&r"(x11): "r"(x12));
+ __asm__ volatile(
+ "MVN %0, %0, lsr #8\n\t"
+ "BIC %0, %0, %1, lsl #24\n\t"
+ "MVN %1, %1, lsr #8\n\t"
+ "BIC %1, %1, %2, lsl #24"
+ : "+r"(x10), "+r"(x11)
+ : "r"(x12)
+ );
#elif (SHIFT==16)
-__asm__ volatile("MVN %0, %0, lsr #16\n\tBIC %0, %0, %1,lsl #16\n\tMVN %1, %1,lsr #16\n\tBIC %1, %1, %2,lsl #16": "=&r"(x10), "=&r"(x11): "r"(x12));
+ __asm__ volatile(
+ "MVN %0, %0, lsr #16\n\t"
+ "BIC %0, %0, %1, lsl #16\n\t"
+ "MVN %1, %1, lsr #16\n\t"
+ "BIC %1, %1, %2, lsl #16"
+ : "+r"(x10), "+r"(x11)
+ : "r"(x12)
+ );
#elif (SHIFT==24)
-__asm__ volatile("MVN %0, %0, lsr #24\n\tBIC %0, %0, %1,lsl #8\n\tMVN %1, %1,lsr #24\n\tBIC %1, %1, %2,lsl #8": "=&r"(x10), "=&r"(x11): "r"(x12));
+ __asm__ volatile(
+ "MVN %0, %0, lsr #24\n\t"
+ "BIC %0, %0, %1, lsl #8\n\t"
+ "MVN %1, %1, lsr #24\n\t"
+ "BIC %1, %1, %2, lsl #8"
+ : "+r"(x10), "+r"(x11)
+ : "r"(x12)
+ );
#endif
x12 = *((int32*)(blk + 8));
@@ -268,13 +291,34 @@ __asm__ volatile("MVN %0, %0, lsr #24\n\tBIC %0, %0, %1,lsl #8\n\tMVN %1,
x14 = *((int32*)(blk + 4));
#if (SHIFT==8)
-__asm__ volatile("MVN %0, %0, lsr #8\n\tBIC %0, %0, %1,lsl #24\n\tMVN %1, %1,lsr #8\n\tBIC %1, %1, %2,lsl #24": "=&r"(x10), "=&r"(x11): "r"(x12));
+ __asm__ volatile(
+ "MVN %0, %0, lsr #8\n\t"
+ "BIC %0, %0, %1, lsl #24\n\t"
+ "MVN %1, %1, lsr #8\n\t"
+ "BIC %1, %1, %2, lsl #24"
+ : "+r"(x10), "+r"(x11)
+ : "r"(x12)
+ );
#elif (SHIFT==16)
-__asm__ volatile("MVN %0, %0, lsr #16\n\tBIC %0, %0, %1,lsl #16\n\tMVN %1, %1,lsr #16\n\tBIC %1, %1, %2,lsl #16": "=&r"(x10), "=&r"(x11): "r"(x12));
+ __asm__ volatile(
+ "MVN %0, %0, lsr #16\n\t"
+ "BIC %0, %0, %1, lsl #16\n\t"
+ "MVN %1, %1, lsr #16\n\t"
+ "BIC %1, %1, %2, lsl #16"
+ : "+r"(x10), "+r"(x11)
+ : "r"(x12)
+ );
#elif (SHIFT==24)
-__asm__ volatile("MVN %0, %0, lsr #24\n\tBIC %0, %0, %1,lsl #8\n\tMVN %1, %1,lsr #24\n\tBIC %1, %1, %2,lsl #8": "=&r"(x10), "=&r"(x11): "r"(x12));
+ __asm__ volatile(
+ "MVN %0, %0, lsr #24\n\t"
+ "BIC %0, %0, %1, lsl #8\n\t"
+ "MVN %1, %1, lsr #24\n\t"
+ "BIC %1, %1, %2, lsl #8"
+ : "+r"(x10), "+r"(x11)
+ : "r"(x12)
+ );
#endif
-__asm__ volatile("LDR %0, [%1], #16": "=&r"(x12), "=r"(blk));
+ __asm__ volatile("LDR %0, [%1], #16": "=&r"(x12), "+r"(blk));
/* process x11 & x14 */
x11 = sad_4pixelN(x11, x14, x9);
@@ -296,9 +340,9 @@ __asm__ volatile("LDR %0, [%1], #16": "=&r"(x12), "=r"(blk));
#if (NUMBER==3)
goto LOOP_SAD3;
#elif (NUMBER==2)
-goto LOOP_SAD2;
+ goto LOOP_SAD2;
#elif (NUMBER==1)
-goto LOOP_SAD1;
+ goto LOOP_SAD1;
#endif
}
diff --git a/media/libstagefright/codecs/common/Android.mk b/media/libstagefright/codecs/common/Android.mk
index af8795a..a33cb92 100644
--- a/media/libstagefright/codecs/common/Android.mk
+++ b/media/libstagefright/codecs/common/Android.mk
@@ -14,19 +14,6 @@ LOCAL_STATIC_LIBRARIES :=
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include
-LOCAL_CFLAGS := $(VO_CFLAGS)
-
-ifeq ($(VOTT), v5)
-LOCAL_CFLAGS += -DARM -DASM_OPT
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/asm/ARMV5E
-endif
-
-ifeq ($(VOTT), v7)
-LOCAL_CFLAGS += -DARM -DARMV7 -DASM_OPT
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/asm/ARMV5E
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/asm/ARMV7
-endif
-
include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libstagefright/codecs/common/Config.mk b/media/libstagefright/codecs/common/Config.mk
index 187f25c..a6d4286 100644
--- a/media/libstagefright/codecs/common/Config.mk
+++ b/media/libstagefright/codecs/common/Config.mk
@@ -20,5 +20,3 @@ endif
VOTEST := 0
-VO_CFLAGS:=-DLINUX
-
diff --git a/media/libstagefright/codecs/common/include/voType.h b/media/libstagefright/codecs/common/include/voType.h
index 5f659ab..da208d4 100644
--- a/media/libstagefright/codecs/common/include/voType.h
+++ b/media/libstagefright/codecs/common/include/voType.h
@@ -76,15 +76,6 @@ typedef char VO_CHAR;
/** VO_U16 is a 16 bit unsigned quantity that is 16 bit word aligned */
typedef unsigned short VO_U16;
-/** VO_WCHAR is a 16 bit unsigned quantity that is 16 bit word aligned */
-#if defined _WIN32
-typedef unsigned short VO_WCHAR;
-typedef unsigned short* VO_PWCHAR;
-#elif defined LINUX
-typedef unsigned char VO_WCHAR;
-typedef unsigned char* VO_PWCHAR;
-#endif
-
/** VO_S16 is a 16 bit signed quantity that is 16 bit word aligned */
typedef signed short VO_S16;
@@ -150,21 +141,6 @@ typedef char* VO_PCHAR;
*/
typedef unsigned char* VO_PBYTE;
-/** The VO_PTCHAR type is intended to be used to pass arrays of wchar such as
- unicode char between the application and the component and core. The VO_PTCHAR
- type is a 32 bit pointer to a zero terminated string. The pointer is word
- aligned and the string is byte aligned.
- */
-/*
-#if !defined LINUX
-typedef unsigned short* VO_PTCHAR;
-typedef unsigned short* VO_TCHAR;
-#else
-typedef char* VO_PTCHAR;
-typedef char VO_TCHAR;
-#endif
-*/
-
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
diff --git a/media/libstagefright/codecs/mp3dec/src/asm/pvmp3_dct_16_gcc.s b/media/libstagefright/codecs/mp3dec/src/asm/pvmp3_dct_16_gcc.s
index f83732b..e61c8d3 100644
--- a/media/libstagefright/codecs/mp3dec/src/asm/pvmp3_dct_16_gcc.s
+++ b/media/libstagefright/codecs/mp3dec/src/asm/pvmp3_dct_16_gcc.s
@@ -369,7 +369,9 @@ pvmp3_merge_in_place_N32:
pvmp3_split:
stmfd sp!,{r4,r5,lr}
- ldr r2,constant16
+ adr r1,constant16
+ ldr r2,[r1]
+ add r2,r1
sub r1,r0,#4
mov r3,#3
loop1:
@@ -449,7 +451,7 @@ constant14:
constant15:
.word 0x5a827980
constant16:
- .word CosTable_dct32 + 60
+ .word (CosTable_dct32 + 60)-constant16
diff --git a/media/libstagefright/codecs/mp3dec/src/asm/pvmp3_mdct_18_gcc.s b/media/libstagefright/codecs/mp3dec/src/asm/pvmp3_mdct_18_gcc.s
index 96230c5..575acd6 100644
--- a/media/libstagefright/codecs/mp3dec/src/asm/pvmp3_mdct_18_gcc.s
+++ b/media/libstagefright/codecs/mp3dec/src/asm/pvmp3_mdct_18_gcc.s
@@ -43,7 +43,7 @@
pvmp3_mdct_18:
stmfd sp!,{r4-r11,lr}
mov r7,r2
- ldr r2,table
+ adr r2,constdata$1
mov r6,r1
add r3,r2,#0x24
add r12,r3,#0x44
@@ -321,8 +321,6 @@ Loop_2:
smull r2,r1,r0,r1
str r1,[r6,#0x3c]
ldmfd sp!,{r4-r11,pc}
-table:
- .word constdata$1
@------------------------------------------------------------------------------
diff --git a/media/libstagefright/codecs/mp3dec/src/asm/pvmp3_polyphase_filter_window_gcc.s b/media/libstagefright/codecs/mp3dec/src/asm/pvmp3_polyphase_filter_window_gcc.s
index 4f45737..b74c849 100644
--- a/media/libstagefright/codecs/mp3dec/src/asm/pvmp3_polyphase_filter_window_gcc.s
+++ b/media/libstagefright/codecs/mp3dec/src/asm/pvmp3_polyphase_filter_window_gcc.s
@@ -46,8 +46,10 @@ pvmp3_polyphase_filter_window:
stmfd sp!,{r0-r2,r4-r11,lr}
sub sp,sp,#4
+ adr r2,PolyPh_filter_coeff
+ ldr r1,[r2]
+ add r1,r2
ldr r2,[sp,#0xc]
- ldr r1,PolyPh_filter_coeff
sub r2,r2,#1
mov r10,#1
@@ -224,7 +226,7 @@ PolyPh_filter_loop2:
ldmfd sp!,{r4-r11,pc}
PolyPh_filter_coeff:
- .word pqmfSynthWin
+ .word pqmfSynthWin-PolyPh_filter_coeff
LOW_16BITS:
.word 0x00007fff
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
index e68bd8e..073dbba 100644
--- 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
@@ -17,7 +17,8 @@ armVCM4P10_DecodeCoeffsToPair:
SUB sp,sp,#0x40
LDR r10,[r0,#0]
LDR r12,[r1,#0]
- LDR r6, =armVCM4P10_CAVLCCoeffTokenTables
+ LDR r6, .LarmVCM4P10_CAVLCCoeffTokenTables
+P0: ADD r6, pc
LDR r4,[sp,#0x68]
LDRB r9,[r10,#2]
LDRB r8,[r10,#1]
@@ -131,7 +132,8 @@ L0x184:
LSRS r8,r7,#1
RSBCS r8,r8,#0
STRH r8,[r2],#2
- LDR r9, =armVCM4P10_SuffixToLevel
+ LDR r9, .LarmVCM4P10_SuffixToLevel
+P1: ADD r9, pc
LDRSB r8,[r9,r4]
TEQ r4,#0
MOVEQ r4,#1
@@ -148,8 +150,9 @@ L0x1b8:
SUB lr,lr,#1
BEQ L0x2b0
TEQ r8,#4
- LDREQ r6, =(armVCM4P10_CAVLCTotalZeros2x2Tables - 4)
- LDRNE r6, =(armVCM4P10_CAVLCTotalZeroTables - 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
@@ -175,7 +178,8 @@ L0x224:
BIC r7,r8,#0xf000
CMP r7,#0x10
BGE L0x33c
- LDR r3, =(armVCM4P10_CAVLCRunBeforeTables - 4)
+ LDR r3, .LarmVCM4P10_CAVLCRunBeforeTables
+P3: ADD r3, pc
ADD r4,sp,#0x2c
MOVS r1,r7
ADD lr,lr,r1
@@ -228,8 +232,9 @@ L0x2bc:
LDR r3,[sp,#8]
LDR r0,[r3,#0]
TEQ r8,#4
- LDREQ r6, =armVCM4P10_ZigZag_2x2
- LDRNE r6, =armVCM4P10_ZigZag_4x4
+ LDREQ r6, .LarmVCM4P10_ZigZag_2x2
+ LDRNE r6, .LarmVCM4P10_ZigZag_4x4
+P4: ADD r6, pc
L0x2ec:
LDRB r9,[r4],#1
LDRB r8,[r6,lr]
@@ -268,5 +273,19 @@ L0x35c:
POP {r4-r12,pc}
.endfunc
- .end
+.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_Interpolate_Chroma_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/armVCM4P10_Interpolate_Chroma_s.S
index 66520da..8599cab 100644
--- 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
@@ -9,20 +9,18 @@
.arm
.fpu neon
- .section .rodata
+ .text
.align 4
armVCM4P10_WidthBranchTableMVIsNotZero:
- .word WidthIs2MVIsNotZero, WidthIs2MVIsNotZero
- .word WidthIs4MVIsNotZero, WidthIs4MVIsNotZero
- .word WidthIs8MVIsNotZero
+ .word WidthIs2MVIsNotZero-(P0+8), WidthIs2MVIsNotZero-(P0+8)
+ .word WidthIs4MVIsNotZero-(P0+8), WidthIs4MVIsNotZero-(P0+8)
+ .word WidthIs8MVIsNotZero-(P0+8)
armVCM4P10_WidthBranchTableMVIsZero:
- .word WidthIs2MVIsZero, WidthIs2MVIsZero
- .word WidthIs4MVIsZero, WidthIs4MVIsZero
- .word WidthIs8MVIsZero
-
- .text
+ .word WidthIs2MVIsZero-(P0+8), WidthIs2MVIsZero-(P0+8)
+ .word WidthIs4MVIsZero-(P0+8), WidthIs4MVIsZero-(P0+8)
+ .word WidthIs8MVIsZero-(P0+8)
.global armVCM4P10_Interpolate_Chroma
.func armVCM4P10_Interpolate_Chroma
@@ -35,9 +33,9 @@ armVCM4P10_Interpolate_Chroma:
RSB r9,r7,#8
CMN r6,r7
MOV r10,#1
- LDREQ r11, =armVCM4P10_WidthBranchTableMVIsZero
+ ADREQ r11, armVCM4P10_WidthBranchTableMVIsZero
SUB lr,r1,r10
- LDRNE r11, =armVCM4P10_WidthBranchTableMVIsNotZero
+ ADRNE r11, armVCM4P10_WidthBranchTableMVIsNotZero
VLD1.8 {d0},[r0],r10
SMULBB r12,r8,r9
SMULBB r9,r6,r9
@@ -48,7 +46,8 @@ armVCM4P10_Interpolate_Chroma:
VDUP.8 d13,r9
VDUP.8 d14,r8
VDUP.8 d15,r6
- LDR pc,[r11,r4,LSL #1]
+ LDR r11,[r11, r4, lsl #1]
+P0: ADD pc,r11
WidthIs8MVIsNotZero:
VLD1.8 {d2},[r0],r10
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
index be21ee7..bc0f7fa 100644
--- 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
@@ -26,9 +26,12 @@ omxVCM4P10_DequantTransformResidualFromPairAndAdd:
MOV r1,r4
BL armVCM4P10_UnpackBlock4x4 ;//
LDR r1,[sp,#0x60]
- LDR r11, =armVCM4P10_QPModuloTable
- LDR r10, =armVCM4P10_QPDivTable
- LDR r2, =armVCM4P10_VMatrixU16
+ 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
@@ -115,5 +118,12 @@ L0x130:
POP {r4-r12,pc}
.endfunc
+.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_PredictIntraChroma_8x8_s.S b/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/m4p10/src_gcc/omxVCM4P10_PredictIntraChroma_8x8_s.S
index 0d49e4b..a896a3a 100644
--- 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
@@ -8,31 +8,31 @@
.arm
.fpu neon
- .section .rodata
+ .text
.align 4
armVCM4P10_pIndexTable8x8:
- .word OMX_VC_CHROMA_DC, OMX_VC_CHROMA_HOR
- .word OMX_VC_CHROMA_VERT, OMX_VC_CHROMA_PLANE
+ .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
-
- .text
.global omxVCM4P10_PredictIntraChroma_8x8
.func omxVCM4P10_PredictIntraChroma_8x8
omxVCM4P10_PredictIntraChroma_8x8:
PUSH {r4-r10,lr}
VPUSH {d8-d15}
- LDR r8, =armVCM4P10_pIndexTable8x8
+ ADR r8, armVCM4P10_pIndexTable8x8
LDR r6,[sp,#0x68]
LDR r4,[sp,#0x60]
LDR r5,[sp,#0x64]
LDR r7,[sp,#0x6c]
- LDR pc,[r8,r6,LSL #2]
+ LDR r8,[r8,r6,LSL #2]
+P0: ADD pc,r8
+
OMX_VC_CHROMA_DC:
TST r7,#2
BEQ L0xe8
@@ -151,7 +151,7 @@ OMX_VC_CHROMA_PLANE:
VSUBL.U8 q7,d3,d2
VSHR.U64 d3,d3,#8
VSUBL.U8 q6,d3,d1
- LDR r2, =armVCM4P10_MultiplierTableChroma8x8
+ ADR r2, armVCM4P10_MultiplierTableChroma8x8
VSHL.I64 d4,d4,#16
VEXT.8 d9,d4,d6,#2
VLD1.16 {d10},[r2]!
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
index 53268f6..3944f53 100644
--- 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
@@ -9,7 +9,7 @@
.arm
.fpu neon
- .section .rodata
+ .text
.align 4
;//-------------------------------------------------------
;// This table for implementing switch case of C in asm by
@@ -17,9 +17,8 @@
;//-------------------------------------------------------
armVCM4P10_pIndexTable16x16:
- .word OMX_VC_16X16_VERT, OMX_VC_16X16_HOR
- .word OMX_VC_16X16_DC, OMX_VC_16X16_PLANE
-
+ .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:
@@ -27,20 +26,20 @@ armVCM4P10_MultiplierTable16x16:
.hword 0, 1, 2, 3, 4, 5, 6, 7
.hword 8, 9, 10, 11, 12, 13, 14, 15
- .text
.global omxVCM4P10_PredictIntra_16x16
.func omxVCM4P10_PredictIntra_16x16
omxVCM4P10_PredictIntra_16x16:
PUSH {r4-r12,lr}
VPUSH {d8-d15}
- LDR r9, =armVCM4P10_pIndexTable16x16
+ ADR r9, armVCM4P10_pIndexTable16x16
LDR r6,[sp,#0x70]
LDR r4,[sp,#0x68]
LDR r5,[sp,#0x6c]
LDR r7,[sp,#0x74]
MOV r12,#0x10
- LDR pc,[r9,r6,LSL #2]
+ LDR r9,[r9,r6,LSL #2]
+P0: ADD pc,r9
OMX_VC_16X16_VERT:
VLD1.8 {d0,d1},[r1]
ADD r8,r3,r5
@@ -162,7 +161,7 @@ L0x198:
VPOP {d8-d15}
POP {r4-r12,pc}
OMX_VC_16X16_PLANE:
- LDR r9, =armVCM4P10_MultiplierTable16x16
+ ADR r9, armVCM4P10_MultiplierTable16x16
VLD1.8 {d0,d1},[r1]
VLD1.8 {d4[0]},[r2]
ADD r8,r0,r4
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
index aa6d7ef..6646b7f 100644
--- 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
@@ -9,27 +9,27 @@
.arm
.fpu neon
- .section .rodata
+ .text
.align 4
armVCM4P10_pSwitchTable4x4:
- .word OMX_VC_4x4_VERT, OMX_VC_4x4_HOR
- .word OMX_VC_4x4_DC, OMX_VC_4x4_DIAG_DL
- .word OMX_VC_4x4_DIAG_DR, OMX_VC_4x4_VR
- .word OMX_VC_4x4_HD, OMX_VC_4x4_VL
- .word OMX_VC_4x4_HU
-
- .text
+ .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
.func omxVCM4P10_PredictIntra_4x4
omxVCM4P10_PredictIntra_4x4:
PUSH {r4-r12,lr}
VPUSH {d8-d12}
- LDR r8, =armVCM4P10_pSwitchTable4x4
+ ADR r8, armVCM4P10_pSwitchTable4x4
LDRD r6,r7,[sp,#0x58]
LDRD r4,r5,[sp,#0x50]
- LDR pc,[r8,r6,LSL #2]
+ LDR r8,[r8,r6,LSL #2]
+P0: ADD pc, r8
+
OMX_VC_4x4_HOR:
ADD r9,r0,r4
ADD r10,r4,r4
@@ -258,4 +258,3 @@ L0x348:
.endfunc
.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
index 28a89cb..7ba3bd6 100644
--- 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
@@ -32,8 +32,10 @@ unpackLoop:
beq unpackLoop
ldmia r1, {r3, r4}
str r9, [r0, #0]
- ldr r5, =armVCM4P10_QPDivTable
- ldr r6, =armVCM4P10_VMatrixQPModTable
+ 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]
@@ -51,4 +53,9 @@ unpackLoop:
pop {r4-r10, pc}
.endfunc
+.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
index a3a0715..640f096 100644
--- 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
@@ -16,8 +16,10 @@ armVCM4P10_InvTransformDequantLumaDC4x4:
PUSH {r4-r6,lr}
VPUSH {d8-d13}
VLD4.16 {d0,d1,d2,d3},[r0]
- LDR r2, =armVCM4P10_QPDivTable
- LDR r3, =armVCM4P10_VMatrixQPModTable
+ 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
@@ -58,6 +60,11 @@ armVCM4P10_InvTransformDequantLumaDC4x4:
POP {r4-r6,pc}
.endfunc
+.LarmVCM4P10_QPDivTable:
+ .word armVCM4P10_QPDivTable-(P0+8)
+.LarmVCM4P10_VMatrixQPModTable:
+ .word armVCM4P10_VMatrixQPModTable-(P1+8)
+
.global omxVCM4P10_TransformDequantLumaDCFromPair
.func omxVCM4P10_TransformDequantLumaDCFromPair
omxVCM4P10_TransformDequantLumaDCFromPair:
diff --git a/media/libstagefright/id3/ID3.cpp b/media/libstagefright/id3/ID3.cpp
index ca14054..69274ca 100644
--- a/media/libstagefright/id3/ID3.cpp
+++ b/media/libstagefright/id3/ID3.cpp
@@ -743,7 +743,8 @@ static size_t StringSize(const uint8_t *start, uint8_t encoding) {
n += 2;
}
- return n;
+ // Add size of null termination.
+ return n + 2;
}
const void *
diff --git a/media/libstagefright/matroska/MatroskaExtractor.cpp b/media/libstagefright/matroska/MatroskaExtractor.cpp
index 8c63df9..8f7d12b 100644
--- a/media/libstagefright/matroska/MatroskaExtractor.cpp
+++ b/media/libstagefright/matroska/MatroskaExtractor.cpp
@@ -894,16 +894,16 @@ void MatroskaExtractor::findThumbnails() {
}
BlockIterator iter(this, info->mTrackNum);
- int32_t i = 0;
+ int32_t j = 0;
int64_t thumbnailTimeUs = 0;
size_t maxBlockSize = 0;
- while (!iter.eos() && i < 20) {
+ while (!iter.eos() && j < 20) {
if (iter.block()->IsKey()) {
- ++i;
+ ++j;
size_t blockSize = 0;
- for (int i = 0; i < iter.block()->GetFrameCount(); ++i) {
- blockSize += iter.block()->GetFrame(i).len;
+ for (int k = 0; k < iter.block()->GetFrameCount(); ++k) {
+ blockSize += iter.block()->GetFrame(k).len;
}
if (blockSize > maxBlockSize) {
diff --git a/media/libstagefright/rtsp/APacketSource.cpp b/media/libstagefright/rtsp/APacketSource.cpp
index fc177d2..ddd2f06 100644
--- a/media/libstagefright/rtsp/APacketSource.cpp
+++ b/media/libstagefright/rtsp/APacketSource.cpp
@@ -110,14 +110,12 @@ static sp<ABuffer> MakeAVCCodecSpecificData(
*height = 0;
AString val;
- if (!GetAttribute(params, "profile-level-id", &val)) {
- return NULL;
+ sp<ABuffer> profileLevelID = NULL;
+ if (GetAttribute(params, "profile-level-id", &val)) {
+ profileLevelID = decodeHex(val);
+ CHECK_EQ(profileLevelID->size(), 3u);
}
- sp<ABuffer> profileLevelID = decodeHex(val);
- CHECK(profileLevelID != NULL);
- CHECK_EQ(profileLevelID->size(), 3u);
-
Vector<sp<ABuffer> > paramSets;
size_t numSeqParameterSets = 0;
@@ -176,8 +174,15 @@ static sp<ABuffer> MakeAVCCodecSpecificData(
uint8_t *out = csd->data();
*out++ = 0x01; // configurationVersion
- memcpy(out, profileLevelID->data(), 3);
- out += 3;
+ if (profileLevelID != NULL) {
+ memcpy(out, profileLevelID->data(), 3);
+ out += 3;
+ } else {
+ *out++ = 0x42; // Baseline profile
+ *out++ = 0xE0; // Common subset for all profiles
+ *out++ = 0x0A; // Level 1
+ }
+
*out++ = (0x3f << 2) | 1; // lengthSize == 2 bytes
*out++ = 0xe0 | numSeqParameterSets;
diff --git a/media/libstagefright/rtsp/ARTPConnection.cpp b/media/libstagefright/rtsp/ARTPConnection.cpp
index 44988a3..501a970 100644
--- a/media/libstagefright/rtsp/ARTPConnection.cpp
+++ b/media/libstagefright/rtsp/ARTPConnection.cpp
@@ -18,6 +18,7 @@
#define LOG_TAG "ARTPConnection"
#include <utils/Log.h>
+#include "ARTPAssembler.h"
#include "ARTPConnection.h"
#include "ARTPSource.h"
diff --git a/media/mtp/Android.mk b/media/mtp/Android.mk
index fc7fc4f..bee28d4 100644
--- a/media/mtp/Android.mk
+++ b/media/mtp/Android.mk
@@ -45,31 +45,3 @@ LOCAL_C_INCLUDES := bionic/libc/private
LOCAL_SHARED_LIBRARIES := libutils libcutils libusbhost libbinder
include $(BUILD_SHARED_LIBRARY)
-
-ifeq ($(HOST_OS),linux)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- MtpDataPacket.cpp \
- MtpDebug.cpp \
- MtpDevice.cpp \
- MtpEventPacket.cpp \
- MtpDeviceInfo.cpp \
- MtpObjectInfo.cpp \
- MtpPacket.cpp \
- MtpProperty.cpp \
- MtpRequestPacket.cpp \
- MtpResponsePacket.cpp \
- MtpStorageInfo.cpp \
- MtpStringBuffer.cpp \
- MtpStorage.cpp \
- MtpUtils.cpp \
-
-LOCAL_MODULE:= libmtp
-
-LOCAL_CFLAGS := -DMTP_HOST
-
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-endif