diff options
23 files changed, 245 insertions, 84 deletions
diff --git a/drm/common/DrmEngineBase.cpp b/drm/common/DrmEngineBase.cpp index 1c345a2..a060f38 100644 --- a/drm/common/DrmEngineBase.cpp +++ b/drm/common/DrmEngineBase.cpp @@ -139,6 +139,11 @@ status_t DrmEngineBase::openDecryptSession( return onOpenDecryptSession(uniqueId, decryptHandle, uri, mime); } +status_t DrmEngineBase::openDecryptSession(int uniqueId, DecryptHandle* decryptHandle, + const DrmBuffer& buf, const String8& mimeType) { + return onOpenDecryptSession(uniqueId, decryptHandle, buf, mimeType); +} + status_t DrmEngineBase::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) { return onCloseDecryptSession(uniqueId, decryptHandle); } diff --git a/drm/common/IDrmManagerService.cpp b/drm/common/IDrmManagerService.cpp index 43f64f2..ccff257 100644 --- a/drm/common/IDrmManagerService.cpp +++ b/drm/common/IDrmManagerService.cpp @@ -652,6 +652,33 @@ DecryptHandle* BpDrmManagerService::openDecryptSession( return handle; } +DecryptHandle* BpDrmManagerService::openDecryptSession( + int uniqueId, const DrmBuffer& buf, const String8& mimeType) { + ALOGV("Entering BpDrmManagerService::openDecryptSession"); + Parcel data, reply; + + data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor()); + data.writeInt32(uniqueId); + if (buf.data != NULL && buf.length > 0) { + data.writeInt32(buf.length); + data.write(buf.data, buf.length); + } else { + data.writeInt32(0); + } + data.writeString8(mimeType); + + remote()->transact(OPEN_DECRYPT_SESSION_FOR_STREAMING, data, &reply); + + DecryptHandle* handle = NULL; + if (0 != reply.dataAvail()) { + handle = new DecryptHandle(); + readDecryptHandleFromParcelData(handle, reply); + } else { + ALOGV("no decryptHandle is generated in service side"); + } + return handle; +} + status_t BpDrmManagerService::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) { ALOGV("closeDecryptSession"); Parcel data, reply; @@ -1312,6 +1339,30 @@ status_t BnDrmManagerService::onTransact( return DRM_NO_ERROR; } + case OPEN_DECRYPT_SESSION_FOR_STREAMING: + { + ALOGV("BnDrmManagerService::onTransact :OPEN_DECRYPT_SESSION_FOR_STREAMING"); + CHECK_INTERFACE(IDrmManagerService, data, reply); + + const int uniqueId = data.readInt32(); + const int bufferSize = data.readInt32(); + DrmBuffer buf((bufferSize > 0) ? (char *)data.readInplace(bufferSize) : NULL, + bufferSize); + const String8 mimeType(data.readString8()); + + DecryptHandle* handle = openDecryptSession(uniqueId, buf, mimeType); + + if (handle != NULL) { + writeDecryptHandleToParcelData(handle, reply); + clearDecryptHandle(handle); + delete handle; + handle = NULL; + } else { + ALOGV("NULL decryptHandle is returned"); + } + return DRM_NO_ERROR; + } + case CLOSE_DECRYPT_SESSION: { ALOGV("BnDrmManagerService::onTransact :CLOSE_DECRYPT_SESSION"); diff --git a/drm/drmserver/DrmManager.cpp b/drm/drmserver/DrmManager.cpp index 999295a..737edab 100644 --- a/drm/drmserver/DrmManager.cpp +++ b/drm/drmserver/DrmManager.cpp @@ -484,6 +484,36 @@ DecryptHandle* DrmManager::openDecryptSession( return handle; } +DecryptHandle* DrmManager::openDecryptSession( + int uniqueId, const DrmBuffer& buf, const String8& mimeType) { + Mutex::Autolock _l(mDecryptLock); + status_t result = DRM_ERROR_CANNOT_HANDLE; + Vector<String8> plugInIdList = mPlugInManager.getPlugInIdList(); + + DecryptHandle* handle = new DecryptHandle(); + if (NULL != handle) { + handle->decryptId = mDecryptSessionId + 1; + + for (size_t index = 0; index < plugInIdList.size(); index++) { + String8 plugInId = plugInIdList.itemAt(index); + IDrmEngine& rDrmEngine = mPlugInManager.getPlugIn(plugInId); + result = rDrmEngine.openDecryptSession(uniqueId, handle, buf, mimeType); + + if (DRM_NO_ERROR == result) { + ++mDecryptSessionId; + mDecryptSessionMap.add(mDecryptSessionId, &rDrmEngine); + break; + } + } + } + if (DRM_NO_ERROR != result) { + delete handle; + handle = NULL; + ALOGV("DrmManager::openDecryptSession: no capable plug-in found"); + } + return handle; +} + status_t DrmManager::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) { Mutex::Autolock _l(mDecryptLock); status_t result = DRM_ERROR_UNKNOWN; diff --git a/drm/drmserver/DrmManagerService.cpp b/drm/drmserver/DrmManagerService.cpp index 746f506..25a4e7b 100644 --- a/drm/drmserver/DrmManagerService.cpp +++ b/drm/drmserver/DrmManagerService.cpp @@ -219,6 +219,16 @@ DecryptHandle* DrmManagerService::openDecryptSession( return NULL; } +DecryptHandle* DrmManagerService::openDecryptSession( + int uniqueId, const DrmBuffer& buf, const String8& mimeType) { + ALOGV("Entering DrmManagerService::openDecryptSession for streaming"); + if (isProtectedCallAllowed()) { + return mDrmManager->openDecryptSession(uniqueId, buf, mimeType); + } + + return NULL; +} + status_t DrmManagerService::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) { ALOGV("Entering closeDecryptSession"); if (!isProtectedCallAllowed()) { diff --git a/drm/libdrmframework/DrmManagerClient.cpp b/drm/libdrmframework/DrmManagerClient.cpp index 8768c08..d4db461 100644 --- a/drm/libdrmframework/DrmManagerClient.cpp +++ b/drm/libdrmframework/DrmManagerClient.cpp @@ -130,6 +130,11 @@ sp<DecryptHandle> DrmManagerClient::openDecryptSession( mUniqueId, uri, mime); } +sp<DecryptHandle> DrmManagerClient::openDecryptSession( + const DrmBuffer& buf, const String8& mimeType) { + return mDrmManagerClientImpl->openDecryptSession(mUniqueId, buf, mimeType); +} + status_t DrmManagerClient::closeDecryptSession(sp<DecryptHandle> &decryptHandle) { return mDrmManagerClientImpl->closeDecryptSession(mUniqueId, decryptHandle); } diff --git a/drm/libdrmframework/DrmManagerClientImpl.cpp b/drm/libdrmframework/DrmManagerClientImpl.cpp index fb0439e..b1228d4 100644 --- a/drm/libdrmframework/DrmManagerClientImpl.cpp +++ b/drm/libdrmframework/DrmManagerClientImpl.cpp @@ -272,6 +272,11 @@ sp<DecryptHandle> DrmManagerClientImpl::openDecryptSession( return handle; } +sp<DecryptHandle> DrmManagerClientImpl::openDecryptSession( + int uniqueId, const DrmBuffer& buf, const String8& mimeType) { + return getDrmManagerService()->openDecryptSession(uniqueId, buf, mimeType); +} + status_t DrmManagerClientImpl::closeDecryptSession( int uniqueId, sp<DecryptHandle> &decryptHandle) { status_t status = DRM_ERROR_UNKNOWN; diff --git a/drm/libdrmframework/include/DrmManager.h b/drm/libdrmframework/include/DrmManager.h index c9167d4..3942efe 100644 --- a/drm/libdrmframework/include/DrmManager.h +++ b/drm/libdrmframework/include/DrmManager.h @@ -116,6 +116,9 @@ public: DecryptHandle* openDecryptSession(int uniqueId, const char* uri, const char* mime); + DecryptHandle* openDecryptSession(int uniqueId, const DrmBuffer& buf, + const String8& mimeType); + status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle); status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, diff --git a/drm/libdrmframework/include/DrmManagerClientImpl.h b/drm/libdrmframework/include/DrmManagerClientImpl.h index 2aa493f..f3d9315 100644 --- a/drm/libdrmframework/include/DrmManagerClientImpl.h +++ b/drm/libdrmframework/include/DrmManagerClientImpl.h @@ -320,6 +320,18 @@ public: int uniqueId, const char* uri, const char* mime); /** + * Open the decrypt session to decrypt the given protected content + * + * @param[in] uniqueId Unique identifier for a session + * @param[in] buf Data to initiate decrypt session + * @param[in] mimeType Mime type of the protected content + * @return + * Handle for the decryption session + */ + sp<DecryptHandle> openDecryptSession(int uniqueId, const DrmBuffer& buf, + const String8& mimeType); + + /** * Close the decrypt session for the given handle * * @param[in] uniqueId Unique identifier for a session diff --git a/drm/libdrmframework/include/DrmManagerService.h b/drm/libdrmframework/include/DrmManagerService.h index 1a8c2ae..066fe4a 100644 --- a/drm/libdrmframework/include/DrmManagerService.h +++ b/drm/libdrmframework/include/DrmManagerService.h @@ -104,6 +104,9 @@ public: DecryptHandle* openDecryptSession( int uniqueId, const char* uri, const char* mime); + DecryptHandle* openDecryptSession(int uniqueId, const DrmBuffer& buf, + const String8& mimeType); + status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle); status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, diff --git a/drm/libdrmframework/include/IDrmManagerService.h b/drm/libdrmframework/include/IDrmManagerService.h index a7d21c5..5b89c91 100644 --- a/drm/libdrmframework/include/IDrmManagerService.h +++ b/drm/libdrmframework/include/IDrmManagerService.h @@ -70,6 +70,7 @@ public: GET_ALL_SUPPORT_INFO, OPEN_DECRYPT_SESSION, OPEN_DECRYPT_SESSION_FROM_URI, + OPEN_DECRYPT_SESSION_FOR_STREAMING, CLOSE_DECRYPT_SESSION, INITIALIZE_DECRYPT_UNIT, DECRYPT, @@ -146,6 +147,9 @@ public: virtual DecryptHandle* openDecryptSession( int uniqueId, const char* uri, const char* mime) = 0; + virtual DecryptHandle* openDecryptSession( + int uniqueId, const DrmBuffer& buf, const String8& mimeType) = 0; + virtual status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) = 0; virtual status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, @@ -232,6 +236,9 @@ public: virtual DecryptHandle* openDecryptSession( int uniqueId, const char* uri, const char* mime); + virtual DecryptHandle* openDecryptSession( + int uniqueId, const DrmBuffer& buf, const String8& mimeType); + virtual status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle); virtual status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, diff --git a/drm/libdrmframework/plugins/common/include/DrmEngineBase.h b/drm/libdrmframework/plugins/common/include/DrmEngineBase.h index 08f6e6d..6cebb97 100644 --- a/drm/libdrmframework/plugins/common/include/DrmEngineBase.h +++ b/drm/libdrmframework/plugins/common/include/DrmEngineBase.h @@ -87,6 +87,9 @@ public: int uniqueId, DecryptHandle* decryptHandle, const char* uri, const char* mime); + status_t openDecryptSession(int uniqueId, DecryptHandle* decryptHandle, + const DrmBuffer& buf, const String8& mimeType); + status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle); status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, @@ -433,6 +436,21 @@ protected: } /** + * Open the decrypt session to decrypt the given protected content + * + * @param[in] uniqueId Unique identifier for a session + * @param[in] decryptHandle Handle for the current decryption session + * @param[in] buf Data to initiate decrypt session + * @param[in] mimeType Mime type of the protected content + * @return + * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success + */ + virtual status_t onOpenDecryptSession(int uniqueId, DecryptHandle* decryptHandle, + const DrmBuffer& buf, const String8& mimeType) { + return DRM_ERROR_CANNOT_HANDLE; + } + + /** * Close the decrypt session for the given handle * * @param[in] uniqueId Unique identifier for a session diff --git a/drm/libdrmframework/plugins/common/include/IDrmEngine.h b/drm/libdrmframework/plugins/common/include/IDrmEngine.h index dcf5977..60f4c1b 100644 --- a/drm/libdrmframework/plugins/common/include/IDrmEngine.h +++ b/drm/libdrmframework/plugins/common/include/IDrmEngine.h @@ -345,6 +345,19 @@ public: const char* uri, const char* mime) = 0; /** + * Open the decrypt session to decrypt the given protected content + * + * @param[in] uniqueId Unique identifier for a session + * @param[in] decryptHandle Handle for the current decryption session + * @param[in] buf Data to initiate decrypt session + * @param[in] mimeType Mime type of the protected content + * @return + * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success + */ + virtual status_t openDecryptSession(int uniqueId, DecryptHandle* decryptHandle, + const DrmBuffer& buf, const String8& mimeType) = 0; + + /** * Close the decrypt session for the given handle * * @param[in] uniqueId Unique identifier for a session diff --git a/include/drm/DrmManagerClient.h b/include/drm/DrmManagerClient.h index c47bbfb..a5c6992 100644 --- a/include/drm/DrmManagerClient.h +++ b/include/drm/DrmManagerClient.h @@ -83,6 +83,16 @@ public: sp<DecryptHandle> openDecryptSession(const char* uri, const char* mime); /** + * Open the decrypt session to decrypt the given protected content + * + * @param[in] buf Data to initiate decrypt session + * @param[in] mimeType Mime type of the protected content + * @return + * Handle for the decryption session + */ + sp<DecryptHandle> openDecryptSession(const DrmBuffer& buf, const String8& mimeType); + + /** * Close the decrypt session for the given handle * * @param[in] decryptHandle Handle for the decryption session diff --git a/media/libmedia/MediaProfiles.cpp b/media/libmedia/MediaProfiles.cpp index 6929efa..84bc7a7 100644 --- a/media/libmedia/MediaProfiles.cpp +++ b/media/libmedia/MediaProfiles.cpp @@ -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/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/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/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/enc/src/avcenc_api.cpp b/media/libstagefright/codecs/avc/enc/src/avcenc_api.cpp index d39885d..6d43142 100644 --- a/media/libstagefright/codecs/avc/enc/src/avcenc_api.cpp +++ b/media/libstagefright/codecs/avc/enc/src/avcenc_api.cpp @@ -573,7 +573,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; 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/sad_inline.h b/media/libstagefright/codecs/avc/enc/src/sad_inline.h index f39794f..3f18483 100644 --- a/media/libstagefright/codecs/avc/enc/src/sad_inline.h +++ b/media/libstagefright/codecs/avc/enc/src/sad_inline.h @@ -80,7 +80,7 @@ extern "C" x9 = 0x80808080; /* const. */ - x8 = (uint32)ref & 0x3; + x8 = (intptr_t)ref & 0x3; if (x8 == 3) goto SadMBOffset3; if (x8 == 2) diff --git a/media/libstagefright/codecs/common/Android.mk b/media/libstagefright/codecs/common/Android.mk index af8795a..77fe934 100644 --- a/media/libstagefright/codecs/common/Android.mk +++ b/media/libstagefright/codecs/common/Android.mk @@ -16,17 +16,6 @@ LOCAL_C_INCLUDES := \ 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/matroska/MatroskaExtractor.cpp b/media/libstagefright/matroska/MatroskaExtractor.cpp index 8c63df9..feb8e40 100644 --- a/media/libstagefright/matroska/MatroskaExtractor.cpp +++ b/media/libstagefright/matroska/MatroskaExtractor.cpp @@ -894,12 +894,12 @@ 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) { |