OSDN Git Service

Fixed issue 3443078 overlay flicker on transition in exported video
authorDanny Fernandes <dannyfernandes@google.com>
Wed, 16 Feb 2011 02:08:46 +0000 (18:08 -0800)
committerDanny Fernandes <dannyfernandes@google.com>
Wed, 16 Feb 2011 19:18:29 +0000 (11:18 -0800)
Change-Id: I4c625a1f7c9897ee0d9aee3f521974456c97ad8c

libvideoeditor/vss/inc/M4VSS3GPP_InternalTypes.h
libvideoeditor/vss/src/M4VSS3GPP_Edit.c
libvideoeditor/vss/src/M4VSS3GPP_EditVideo.c
libvideoeditor/vss/src/M4xVSS_internal.c

index 069b84d..bc29b2a 100755 (executable)
@@ -610,6 +610,7 @@ typedef struct
     M4OSA_UInt8              nbActiveEffects1;  /**< Numbers of active effects RC */
     M4OSA_Bool               m_bClipExternalHasStarted;  /**< Flag to indicate that an
                                                               external effect is active */
+    M4OSA_Int32              iInOutTimeOffset;
 } M4VSS3GPP_InternalEditContext;
 
 
index d495186..acdbfdc 100755 (executable)
@@ -229,6 +229,8 @@ M4OSA_ERR M4VSS3GPP_editInit( M4VSS3GPP_EditContext *pContext,
 
     pC->bIsMMS = M4OSA_FALSE;
 
+    pC->iInOutTimeOffset = 0;
+
     /**
     * Return with no error */
     M4OSA_TRACE3_0("M4VSS3GPP_editInit(): returning M4NO_ERROR");
index 9870426..2dfd07b 100755 (executable)
@@ -93,12 +93,18 @@ M4OSA_ERR M4VSS3GPP_intEditStepVideo( M4VSS3GPP_InternalEditContext *pC )
     M4OSA_UInt16 offset;
 
     /**
-    * Check if we reached end cut */
-    // Decorrelate input and output encoding timestamp to handle encoder prefetch
-    if ( ((M4OSA_Int32)(pC->ewc.dInputVidCts) - pC->pC1->iVoffset) >= pC->pC1->iEndTime )
+     * Check if we reached end cut. Decorrelate input and output encoding
+     * timestamp to handle encoder prefetch
+     */
+    if ( ((M4OSA_Int32)(pC->ewc.dInputVidCts) - pC->pC1->iVoffset
+        + pC->iInOutTimeOffset) >= pC->pC1->iEndTime )
     {
         /* Re-adjust video to precise cut time */
-        // Decorrelate input and output encoding timestamp to handle encoder prefetch
+        pC->iInOutTimeOffset = ((M4OSA_Int32)(pC->ewc.dInputVidCts))
+            - pC->pC1->iVoffset + pC->iInOutTimeOffset - pC->pC1->iEndTime;
+        if ( pC->iInOutTimeOffset < 0 ) {
+            pC->iInOutTimeOffset = 0;
+        }
 
         /**
         * Video is done for this clip */
@@ -1974,9 +1980,11 @@ M4VSS3GPP_intCheckVideoEffects( M4VSS3GPP_InternalEditContext *pC,
 
              if(uiClipNumber ==1)
              {
-                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? */
-                {
+                /**< Are we after the start time of the effect?
+                 * or Are we into the effect duration?
+                 */
+                if ( (t >= (M4OSA_Int32)(pFx->uiStartTime)) &&
+                    (t <= (M4OSA_Int32)(pFx->uiStartTime + pFx->uiDuration)) ) {
                     /**
                      * Set the active effect(s) */
                     pC->pActiveEffectsList[i] = pC->nbEffects-1-uiFxIndex;
@@ -1993,17 +2001,19 @@ M4VSS3GPP_intCheckVideoEffects( M4VSS3GPP_InternalEditContext *pC,
                     }
 
                     /**
-                     * 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 */
-
+                     * 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.
+                     */
                 }
             }
             else
             {
-                if ((t + pC->pTransitionList[uiClipIndex].uiTransitionDuration >=
-                   (M4OSA_Int32)(pFx->uiStartTime)) && (t + pC->pTransitionList[uiClipIndex].uiTransitionDuration
-                    <  (M4OSA_Int32)(pFx->uiStartTime + pFx->uiDuration)) ) /**< Are we into the effect duration? */
-                 {
+                /**< Are we into the effect duration? */
+                if ( (t + pC->pTransitionList[uiClipIndex].uiTransitionDuration
+                    >= (M4OSA_Int32)(pFx->uiStartTime))
+                    && (t + pC->pTransitionList[uiClipIndex].uiTransitionDuration
+                    <= (M4OSA_Int32)(pFx->uiStartTime + pFx->uiDuration)) ) {
                     /**
                      * Set the active effect(s) */
                     pC->pActiveEffectsList1[i] = pC->nbEffects-1-uiFxIndex;
index 71a8929..b56d524 100755 (executable)
@@ -4135,11 +4135,15 @@ M4OSA_ERR M4VSS3GPP_externalVideoEffectFraming( M4OSA_Void *userData,
                     if(pProgress->uiProgress >= 0 && pProgress->uiProgress \
                     < (M4OSA_UInt32)(alphaBlendingStruct->m_fadeInTime*10))
                     {
-                        alphaBlending = ((M4OSA_Float)(alphaBlendingStruct->m_middle\
-                         - alphaBlendingStruct->m_start)\
-                            *pProgress->uiProgress/(alphaBlendingStruct->m_fadeInTime*10));
-                        alphaBlending += alphaBlendingStruct->m_start;
-                        alphaBlending /= 100;
+                        if(alphaBlendingStruct->m_fadeInTime == 0) {
+                            alphaBlending = alphaBlendingStruct->m_start / 100;
+                        } else {
+                            alphaBlending = ((M4OSA_Float)(alphaBlendingStruct->m_middle\
+                             - alphaBlendingStruct->m_start)\
+                                *pProgress->uiProgress/(alphaBlendingStruct->m_fadeInTime*10));
+                            alphaBlending += alphaBlendingStruct->m_start;
+                            alphaBlending /= 100;
+                        }
                     }
                     else if(pProgress->uiProgress >= (M4OSA_UInt32)(alphaBlendingStruct->\
                     m_fadeInTime*10) && pProgress->uiProgress < 1000\
@@ -4151,11 +4155,15 @@ M4OSA_ERR M4VSS3GPP_externalVideoEffectFraming( M4OSA_Void *userData,
                     else if(pProgress->uiProgress >= 1000 - (M4OSA_UInt32)\
                     (alphaBlendingStruct->m_fadeOutTime*10))
                     {
-                        alphaBlending = ((M4OSA_Float)(alphaBlendingStruct->m_middle \
-                        - alphaBlendingStruct->m_end))*(1000 - pProgress->uiProgress)\
-                        /(alphaBlendingStruct->m_fadeOutTime*10);
-                        alphaBlending += alphaBlendingStruct->m_end;
-                        alphaBlending /= 100;
+                        if(alphaBlendingStruct->m_fadeOutTime == 0) {
+                            alphaBlending = alphaBlendingStruct->m_end / 100;
+                        } else {
+                            alphaBlending = ((M4OSA_Float)(alphaBlendingStruct->m_middle \
+                            - alphaBlendingStruct->m_end))*(1000 - pProgress->uiProgress)\
+                            /(alphaBlendingStruct->m_fadeOutTime*10);
+                            alphaBlending += alphaBlendingStruct->m_end;
+                            alphaBlending /= 100;
+                        }
                     }
                 }
                 /**/