fix the distortion issue in some 1080i interlace clips

BZ: 199433

1.ReferenceFrames have VA_PICTURE_H264_BOTTOM_FIELD set, which confuse
  VED to address top field.
2.H264 dpb is wrongly updated when libmix handle SEI recover_point.
3.Set the default poc as max of int32 to avoid reference frame missing
  issue when frame/field poc is -1.

Change-Id: Ib22c3fa8b2e8064b19b5f133a6dfa0b0c0ca3d3b
Signed-off-by: Gu, Wangyi <wangyi.gu@intel.com>
diff --git a/mixvbp/vbp_plugin/h264/h264parse_sei.c b/mixvbp/vbp_plugin/h264/h264parse_sei.c
index df18cc3..4769ef0 100755
--- a/mixvbp/vbp_plugin/h264/h264parse_sei.c
+++ b/mixvbp/vbp_plugin/h264/h264parse_sei.c
@@ -406,8 +406,12 @@
         pInfo->img.recovery_point_found |= 2;
 
         //// Enable the RP recovery if no IDR ---Cisco
+#if 0
+        // don't set this flag, in some corner case
+        // dpb is wrongly updated when recover point is received.
         if ((pInfo->img.recovery_point_found & 1)==0)
             pInfo->sei_rp_received = 1;
+#endif
     }
 
     return H264_STATUS_OK;
diff --git a/videodecoder/VideoDecoderAVC.cpp b/videodecoder/VideoDecoderAVC.cpp
index 296a0ca..912ebdf 100644
--- a/videodecoder/VideoDecoderAVC.cpp
+++ b/videodecoder/VideoDecoderAVC.cpp
@@ -31,6 +31,7 @@
 #define WIDI_CONSUMED   6
 #define HDMI_CONSUMED   2
 #define NW_CONSUMED     2
+#define POC_DEFAULT     0x7FFFFFFF
 
 VideoDecoderAVC::VideoDecoderAVC(const char *mimeType)
     : VideoDecoderBase(mimeType, VBP_H264),
@@ -571,6 +572,10 @@
                         }
                     }
                     dpb->flags = refList->flags;
+                    // if it's bottom field in dpb, there must have top field in DPB,
+                    // so clear the bottom flag, or will confuse VED to address top field
+                    if (dpb->flags & VA_PICTURE_H264_BOTTOM_FIELD)
+                        dpb->flags &= (~VA_PICTURE_H264_BOTTOM_FIELD);
                     dpb->frame_idx = refList->frame_idx;
                     dpb->TopFieldOrderCnt = refList->TopFieldOrderCnt;
                     dpb->BottomFieldOrderCnt = refList->BottomFieldOrderCnt;
@@ -588,10 +593,10 @@
     if ((picParam->CurrPic.flags & VA_PICTURE_H264_SHORT_TERM_REFERENCE) ||
         (picParam->CurrPic.flags & VA_PICTURE_H264_LONG_TERM_REFERENCE)) {
         DecodedPictureBuffer *dpb = mDPBs[mToggleDPB];
-        uint32_t poc = getPOC(&(picParam->CurrPic));
+        int32_t poc = getPOC(&(picParam->CurrPic));
         for (int32_t i = 0; i < DPB_SIZE; i++, dpb++) {
             if (poc == dpb->poc) {
-                dpb->poc = (uint32_t)-1;
+                dpb->poc = (int32_t)POC_DEFAULT;
                 if (dpb->surfaceBuffer) {
                     dpb->surfaceBuffer->asReferernce = false;
                 }
@@ -602,7 +607,7 @@
     }
 }
 
-uint32_t VideoDecoderAVC::getPOC(VAPictureH264 *pic) {
+int32_t VideoDecoderAVC::getPOC(VAPictureH264 *pic) {
     if (pic->flags & VA_PICTURE_H264_BOTTOM_FIELD) {
         return pic->BottomFieldOrderCnt;
     }
@@ -655,7 +660,7 @@
 void VideoDecoderAVC::invalidateDPB(int toggle) {
     DecodedPictureBuffer* p = mDPBs[toggle];
     for (int i = 0; i < DPB_SIZE; i++) {
-        p->poc = (uint32_t) -1;
+        p->poc = (int32_t) POC_DEFAULT;
         p->surfaceBuffer = NULL;
         p++;
     }
diff --git a/videodecoder/VideoDecoderAVC.h b/videodecoder/VideoDecoderAVC.h
index c5ce75b..47f250d 100755
--- a/videodecoder/VideoDecoderAVC.h
+++ b/videodecoder/VideoDecoderAVC.h
@@ -47,7 +47,7 @@
     Decode_Status updateDPB(VAPictureParameterBufferH264 *picParam);
     Decode_Status updateReferenceFrames(vbp_picture_data_h264 *picData);
     void removeReferenceFromDPB(VAPictureParameterBufferH264 *picParam);
-    uint32_t getPOC(VAPictureH264 *pic); // Picture Order Count
+    int32_t getPOC(VAPictureH264 *pic); // Picture Order Count
     inline VASurfaceID findSurface(VAPictureH264 *pic);
     inline VideoSurfaceBuffer* findSurfaceBuffer(VAPictureH264 *pic);
     inline VideoSurfaceBuffer* findRefSurfaceBuffer(VAPictureH264 *pic);
@@ -67,7 +67,7 @@
 private:
     struct DecodedPictureBuffer {
         VideoSurfaceBuffer *surfaceBuffer;
-        uint32_t poc; // Picture Order Count
+        int32_t poc; // Picture Order Count
     };
 
     enum {