OSDN Git Service

Fix for issue 3404624 - The overlay in exported video is blurry
authorSantosh Madhava <smadhava@google.com>
Mon, 31 Jan 2011 07:47:13 +0000 (23:47 -0800)
committerSantosh Madhava <smadhava@google.com>
Mon, 31 Jan 2011 19:50:58 +0000 (11:50 -0800)
Change-Id: I52bd474c85589bd75e58c675045a7c7fe058a228

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

index 55513bc..069b84d 100755 (executable)
@@ -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;
 
 
index 722bfe9..d495186 100755 (executable)
@@ -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 */
index ff9f120..f0a3a01 100755 (executable)
@@ -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 */
+                }
             }
-
         }
     }
 
index 67d168d..a5371e7 100755 (executable)
@@ -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 )