void *VC_FaceThreadFnc(void* param)
{
	ImageThread_S *pFaceThread;
	PF_Rect_S viRect;
	Uapi_ExpWin_t expWin;
	HNY_AiFaceRectInfo_S *pAiFaceRectInfo = NULL;
	char threadName[64];
	char *pBuf = NULL;
	int i, id, faceRect, width, height, ret, cnt = 0;
	PF_Rect_S stRect = {0};

	sprintf(threadName, "FaceFnc");
	prctl(PR_SET_NAME, (unsigned long)threadName, 0, 0, 0);
	pBuf = (char *)malloc(sizeof(HNY_FrameHeader_S) + sizeof(HNY_AiFaceRectInfo_S));
	if(pBuf == NULL)
	{
		DEBUG_ERROR(MODULE_CODEC, "Call malloc func err!");
		return NULL;
	}

	memset(&viRect, 0x0, sizeof(PF_Rect_S));
	VC_GetViRect(0, &viRect);

	pFaceThread = (ImageThread_S *)param;
	while(pFaceThread->threadRun)
	{
		memset(pBuf, 0x00, sizeof(HNY_FrameHeader_S) + sizeof(HNY_AiFaceRectInfo_S));
		ret = SHB_ShareBufGetOneFrame(g_imageManager.metaDataBuf, sizeof(HNY_FrameHeader_S) + sizeof(HNY_AiFaceRectInfo_S), pBuf);
		if(ret <= 0)
		{
			usleep(50*1000);
			cnt ++;
			if(cnt < 3)
				continue;
		}

		if(cnt >= 3)
		{
			cnt = 0;
			expWin.h_offs = 0;
			expWin.v_offs = 0;
			expWin.h_size = 1920;
			expWin.v_size = 1080;
		}
		else
		{
			pAiFaceRectInfo = (HNY_AiFaceRectInfo_S *)(pBuf + sizeof(HNY_FrameHeader_S));

			if(pAiFaceRectInfo->faceCnt <= 0)
			{
				usleep(50*1000);
				continue;
			}

			//查找最大人脸
			id = -1;
			faceRect = 0;
			for(i=0; i<pAiFaceRectInfo->faceCnt; i++)
			{
				width = pAiFaceRectInfo->faceRect[i].faceRect.right - pAiFaceRectInfo->faceRect[i].faceRect.left;
				height = pAiFaceRectInfo->faceRect[i].faceRect.bottom - pAiFaceRectInfo->faceRect[i].faceRect.top;
				if(faceRect < width*height)
				{
					id = i;
					faceRect = width*height;
				}
			}
			
			if(id >= 0)
           {
            HNY_Rect_S curFaceRect = pAiFaceRectInfo->faceRect[id].faceRect;
           if(stRect.x == 0 && stRect.width == 0 && stRect.y == 0 && stRect.height == 0)
           {
           stRect.x = curFaceRect.left,stRect.y = curFaceRect.bottom,stRect.width =curFaceRect.right-curFaceRect.left,height =curFaceRect.bottom-curFaceRect.top;
            }
            else
            {
            int curWidth = curFaceRect.right - curFaceRect.left;;
            int curHeight =  curFaceRect.bottom - curFaceRect.top;
            int maxWidth = 1920;
            int maxHeight = 1080;
            if(curWidth < maxWidth * 0.03|| curHeight < maxHeight * 0.03) //新检测到人脸大小太小
            {
            if(cnt == 0)
            {
            cnt = 2; //直接使用上一次稳定的人脸框
            }
            continue;
            }
            else
            {
            
            stRect.x = (stRect.x + curFaceRect.left) / 2;
            stRect.width = (stRect.width + curFaceRect.right-curFaceRect.left)/ 2;
            stRect.y = (stRect.y + curFaceRect.bottom) / 2;
            stRect.height = (stRect.height + curFaceRect.bottom-curFaceRect.top) / 2;
           //限制人脸框的范围
            if(stRect.x < 0) 
				{stRect.x = 0;}
            if(stRect.y < 0) {stRect.y = 0;}
            if(stRect.width > viRect.width) {stRect.width = viRect.width;}
            if(stRect.height > viRect.height) {stRect.height = viRect.height;}
            }
            }
            //更新当前使用的人脸框+)
            
            }



				   
					expWin.h_offs      = pAiFaceRectInfo->faceRect[id].faceRect.left * viRect.width / 10000;
					expWin.v_offs     = pAiFaceRectInfo->faceRect[id].faceRect.top * viRect.height / 10000;
					expWin.h_size  = (pAiFaceRectInfo->faceRect[id].faceRect.right - pAiFaceRectInfo->faceRect[id].faceRect.left) * viRect.width / 10000;
					expWin.v_size = (pAiFaceRectInfo->faceRect[id].faceRect.bottom - pAiFaceRectInfo->faceRect[id].faceRect.top) * viRect.height / 10000;
					stRect.x	  = 1.25*expWin.h_offs;
				    stRect.y	  = 1.25*expWin.v_offs;
				    stRect.width  = expWin.h_size;
				    stRect.height = expWin.v_size;
					
					 ret = VC_SetFaceExp(stRect);


             

		}
		
		printf("id[%d] set face[%d,%d--%d,%d]\n", id, expWin.h_offs, expWin.v_offs, expWin.h_size, expWin.v_size);
//		ret = SAMPLE_COMM_ISP_SET_ExpWinAttr(0, expWin);
		if(ret < 0)
		{
			DEBUG_ERROR(MODULE_CODEC, "SAMPLE_COMM_ISP_SET_ExpWinAttr failed[%d]!", ret);
		}
	}

	DEBUG_ERROR(MODULE_CODEC, "thread[%s] exit!", threadName);
	free(pBuf);

	return NULL;
}增加每隔一秒更新一次窗口设置