From bb337b471658b7c2264c6ff1bb613739db851baa Mon Sep 17 00:00:00 2001 From: Santosh Madhava Date: Sun, 30 Jan 2011 23:47:13 -0800 Subject: [PATCH] Fix for issue 3404624 - The overlay in exported video is blurry Change-Id: I52bd474c85589bd75e58c675045a7c7fe058a228 --- libvideoeditor/vss/inc/M4VSS3GPP_InternalTypes.h | 2 + libvideoeditor/vss/src/M4VSS3GPP_Edit.c | 4 ++ libvideoeditor/vss/src/M4VSS3GPP_EditVideo.c | 56 ++++++++++++++++-------- libvideoeditor/vss/src/M4xVSS_API.c | 8 ++-- 4 files changed, 47 insertions(+), 23 deletions(-) diff --git a/libvideoeditor/vss/inc/M4VSS3GPP_InternalTypes.h b/libvideoeditor/vss/inc/M4VSS3GPP_InternalTypes.h index 55513bc178..069b84d960 100755 --- a/libvideoeditor/vss/inc/M4VSS3GPP_InternalTypes.h +++ b/libvideoeditor/vss/inc/M4VSS3GPP_InternalTypes.h @@ -608,6 +608,8 @@ typedef struct M4OSA_Bool bIssecondClip; M4OSA_UInt8 *pActiveEffectsList1; /**< List of the active effects settings. Array of nbEffects RC */ M4OSA_UInt8 nbActiveEffects1; /**< Numbers of active effects RC */ + M4OSA_Bool m_bClipExternalHasStarted; /**< Flag to indicate that an + external effect is active */ } M4VSS3GPP_InternalEditContext; diff --git a/libvideoeditor/vss/src/M4VSS3GPP_Edit.c b/libvideoeditor/vss/src/M4VSS3GPP_Edit.c index 722bfe92ab..d495186260 100755 --- a/libvideoeditor/vss/src/M4VSS3GPP_Edit.c +++ b/libvideoeditor/vss/src/M4VSS3GPP_Edit.c @@ -224,6 +224,8 @@ M4OSA_ERR M4VSS3GPP_editInit( M4VSS3GPP_EditContext *pContext, pC->State = M4VSS3GPP_kEditState_CREATED; pC->Vstate = M4VSS3GPP_kEditVideoState_READ_WRITE; pC->Astate = M4VSS3GPP_kEditAudioState_READ_WRITE; + /* The flag is set to false at the beginning of every clip */ + pC->m_bClipExternalHasStarted = M4OSA_FALSE; pC->bIsMMS = M4OSA_FALSE; @@ -3287,6 +3289,8 @@ static M4OSA_ERR M4VSS3GPP_intSwitchToNextClip( } } } + /* The flag is set to false at the beginning of every clip */ + pC->m_bClipExternalHasStarted = M4OSA_FALSE; /** * Return with no error */ diff --git a/libvideoeditor/vss/src/M4VSS3GPP_EditVideo.c b/libvideoeditor/vss/src/M4VSS3GPP_EditVideo.c index ff9f120789..f0a3a01224 100755 --- a/libvideoeditor/vss/src/M4VSS3GPP_EditVideo.c +++ b/libvideoeditor/vss/src/M4VSS3GPP_EditVideo.c @@ -770,8 +770,15 @@ static M4OSA_ERR M4VSS3GPP_intCheckVideoMode( pC->Vstate = M4VSS3GPP_kEditVideoState_READ_WRITE; } } - else + else if(!((pC->m_bClipExternalHasStarted == M4OSA_TRUE) && + (pC->Vstate == M4VSS3GPP_kEditVideoState_DECODE_ENCODE))) { + /** + * Test if we go into copy/paste mode or into decode/encode mode + * If an external effect has been applied on the current clip + * then continue to be in decode/encode mode till end of + * clip to avoid H.264 distortion. + */ pC->Vstate = M4VSS3GPP_kEditVideoState_READ_WRITE; } } @@ -1969,18 +1976,25 @@ M4VSS3GPP_intCheckVideoEffects( M4VSS3GPP_InternalEditContext *pC, { if ((t >= (M4OSA_Int32)(pFx->uiStartTime)) && /**< Are we after the start time of the effect? */ (t < (M4OSA_Int32)(pFx->uiStartTime + pFx->uiDuration)) ) /**< Are we into the effect duration? */ - { - /** - * Set the active effect(s) */ + { + /** + * Set the active effect(s) */ pC->pActiveEffectsList[i] = pC->nbEffects-1-uiFxIndex; - /** - * Update counter of active effects */ + /** + * Update counter of active effects */ i++; - /** - * The third effect has the highest priority, then the second one, then the first one. - * Hence, as soon as we found an active effect, we can get out of this loop */ + /** + * For all external effects set this flag to true. */ + if(pFx->VideoEffectType > M4VSS3GPP_kVideoEffectType_External) + { + pC->m_bClipExternalHasStarted = M4OSA_TRUE; + } + + /** + * The third effect has the highest priority, then the second one, then the first one. + * Hence, as soon as we found an active effect, we can get out of this loop */ } } @@ -1990,22 +2004,26 @@ M4VSS3GPP_intCheckVideoEffects( M4VSS3GPP_InternalEditContext *pC, (M4OSA_Int32)(pFx->uiStartTime)) && (t + pC->pTransitionList[uiClipIndex].uiTransitionDuration < (M4OSA_Int32)(pFx->uiStartTime + pFx->uiDuration)) ) /**< Are we into the effect duration? */ { - /** - * Set the active effect(s) */ + /** + * Set the active effect(s) */ pC->pActiveEffectsList1[i] = pC->nbEffects-1-uiFxIndex; - /** - * Update counter of active effects */ + /** + * Update counter of active effects */ i++; - /** - * The third effect has the highest priority, then the second one, then the first one. - * Hence, as soon as we found an active effect, we can get out of this loop */ - } - + /** + * For all external effects set this flag to true. */ + if(pFx->VideoEffectType > M4VSS3GPP_kVideoEffectType_External) + { + pC->m_bClipExternalHasStarted = M4OSA_TRUE; + } + /** + * The third effect has the highest priority, then the second one, then the first one. + * Hence, as soon as we found an active effect, we can get out of this loop */ + } } - } } diff --git a/libvideoeditor/vss/src/M4xVSS_API.c b/libvideoeditor/vss/src/M4xVSS_API.c index 67d168dff4..a5371e7c65 100755 --- a/libvideoeditor/vss/src/M4xVSS_API.c +++ b/libvideoeditor/vss/src/M4xVSS_API.c @@ -2248,8 +2248,8 @@ replaceJPG_3GP: i]->ClipProperties.uiStillPicHeight; //ARGB_Height; pParams->width = pSettings->pClipList[ i]->ClipProperties.uiStillPicWidth; //ARGB_Width; - M4OSA_TRACE1_1("CLIP M4xVSS_SendCommand is %d", pParams->height); - M4OSA_TRACE1_1("CLIP M4xVSS_SendCommand is %d", pParams->height); + M4OSA_TRACE3_1("CLIP M4xVSS_SendCommand ARGB8888 H = %d", pParams->height); + M4OSA_TRACE3_1("CLIP M4xVSS_SendCommand ARGB8888 W = %d", pParams->width); if( xVSS_context->pPTo3GPPparamsList == M4OSA_NULL ) /* Means it is the first element of the list */ @@ -3892,9 +3892,9 @@ replace3GP_3GP: xVSS_context, &(xVSS_context->pSettings->Effects[j]), framingCtx->aFramingCtx,xVSS_context->pSettings->xVSS.outputVideoSize); - M4OSA_TRACE1_1("FRAMMING AFTER M4xVSS_SendCommand %d", + M4OSA_TRACE3_1("FRAMING WIDTH BEFORE M4xVSS_SendCommand %d", framingCtx->aFramingCtx->width); - M4OSA_TRACE1_1("FRAMMING AFTER M4xVSS_SendCommand %d", + M4OSA_TRACE3_1("FRAMING HEIGHT BEFORE M4xVSS_SendCommand %d", framingCtx->aFramingCtx->height); if( err != M4NO_ERROR ) -- 2.11.0