Lines Matching refs:encParams
205 VideoEncParams *encParams;
229 video->encParams = (VideoEncParams *)M4VENC_MALLOC(sizeof(VideoEncParams));
230 if (video->encParams == NULL)
233 M4VENC_MEMSET(video->encParams, 0, sizeof(VideoEncParams));
235 encParams = video->encParams;
236 encParams->nLayers = encOption->numLayers;
243 if (encParams->nLayers != 1)
248 encParams->LayerMaxMbsPerSec[0] = profile_level_max_mbsPerSec[profile_table_index];
255 if (encParams->nLayers < 2)
259 for (i = 0; i < encParams->nLayers; i++)
261 encParams->LayerMaxMbsPerSec[i] = scalable_profile_level_max_mbsPerSec[profile_table_index];
297 encParams->SequenceStartCode = 1;
298 encParams->GOV_Enabled = 0;
299 encParams->RoundingType = 0;
300 encParams->IntraDCVlcThr = PV_MAX(PV_MIN(encOption->intraDCVlcTh, 7), 0);
301 encParams->ACDCPrediction = ((encOption->useACPred == PV_ON) ? TRUE : FALSE);
302 encParams->RC_Type = encOption->rcType;
303 encParams->Refresh = encOption->numIntraMB;
304 encParams->ResyncMarkerDisable = 0; /* Enable Resync Marker */
309 encParams->QuantType[i] = 0;
311 encParams->QuantType[i] = encOption->quantType[i]; /* H263 */
315 encParams->InitQuantPvop[i] = encOption->pQuant[i];
323 encParams->InitQuantIvop[i] = encOption->iQuant[i];
331 encParams->HalfPel_Enabled = 1;
332 encParams->SearchRange = encOption->searchRange; /* 4/16/2001 */
333 encParams->FullSearch_Enabled = 0;
335 encParams->MV8x8_Enabled = 0;
337 encParams->MV8x8_Enabled = 0;// comment out for now!! encOption->mv8x8Enable;
339 encParams->H263_Enabled = 0;
340 encParams->GOB_Header_Interval = 0; // need to be reset to 0
341 encParams->IntraPeriod = encOption->intraPeriod; /* Intra update period update default*/
342 encParams->SceneChange_Det = encOption->sceneDetect;
343 encParams->FineFrameSkip_Enabled = 0;
344 encParams->NoFrameSkip_Enabled = encOption->noFrameSkipped;
345 encParams->NoPreSkip_Enabled = encOption->noFrameSkipped;
346 encParams->GetVolHeader[0] = 0;
347 encParams->GetVolHeader[1] = 0;
348 encParams->ResyncPacketsize = encOption->packetSize << 3;
349 encParams->LayerMaxBitRate[0] = 0;
350 encParams->LayerMaxBitRate[1] = 0;
351 encParams->LayerMaxFrameRate[0] = (float)0.0;
352 encParams->LayerMaxFrameRate[1] = (float)0.0;
353 encParams->VBV_delay = encOption->vbvDelay; /* 2sec VBV buffer size */
362 encParams->nLayers = 1;
363 encParams->QuantType[0] = 0; /*H263 */
364 encParams->ResyncMarkerDisable = 1; /* Disable Resync Marker */
365 encParams->DataPartitioning = 0; /* Combined Mode */
366 encParams->ReversibleVLC = 0; /* Disable RVLC */
367 encParams->RoundingType = 0;
368 encParams->IntraDCVlcThr = 7; /* use_intra_dc_vlc = 0 */
369 encParams->MV8x8_Enabled = 0;
371 encParams->GOB_Header_Interval = encOption->gobHeaderInterval;
372 encParams->H263_Enabled = 2;
373 encParams->GOV_Enabled = 0;
374 encParams->TimeIncrementRes = 30000; /* timeIncrementRes for H263 */
381 encParams->nLayers = 1;
382 encParams->QuantType[0] = 0; /*H263 */
383 encParams->ResyncMarkerDisable = 1; /* Disable Resync Marker */
384 encParams->DataPartitioning = 0; /* Combined Mode */
385 encParams->ReversibleVLC = 0; /* Disable RVLC */
386 encParams->RoundingType = 0;
387 encParams->IntraDCVlcThr = 7; /* use_intra_dc_vlc = 0 */
388 encParams->MV8x8_Enabled = 0;
390 encParams->H263_Enabled = 1;
391 encParams->GOV_Enabled = 0;
392 encParams->TimeIncrementRes = 30000; /* timeIncrementRes for H263 */
398 encParams->DataPartitioning = 1; /* Base Layer Data Partitioning */
399 encParams->ResyncMarkerDisable = 0; /* Resync Marker */
401 encParams->ReversibleVLC = 0;
403 encParams->ReversibleVLC = (encOption->rvlcEnable == PV_ON); /* RVLC when Data Partitioning */
405 encParams->ResyncPacketsize = PacketSize;
410 encParams->DataPartitioning = 0; /* Combined Mode */
411 encParams->ResyncMarkerDisable = 0; /* Resync Marker */
412 encParams->ReversibleVLC = 0; /* No RVLC */
413 encParams->ResyncPacketsize = PacketSize;
418 encParams->DataPartitioning = 0; /* Combined Mode */
419 encParams->ResyncMarkerDisable = 1; /* Disable Resync Marker */
420 encParams->ReversibleVLC = 0; /* No RVLC */
430 encParams->profile_table_index = profile_table_index; /* Used to limit the profile and level in SetProfile_BufferSize() */
438 if (!encParams->H263_Enabled)
440 encParams->TimeIncrementRes = timeIncRes;
444 encParams->TimeIncrementRes = 30000;
455 if (encParams->H263_Enabled)
485 for (i = 0; i < encParams->nLayers; i++)
487 encParams->LayerHeight[i] = encOption->encHeight[i];
488 encParams->LayerWidth[i] = encOption->encWidth[i];
492 for (i = 0; i < encParams->nLayers; i++)
494 encParams->LayerFrameRate[i] = encOption->encFrameRate[i];
497 if (encParams->nLayers > 1)
504 for (i = 0; i < encParams->nLayers; i++)
508 nTotalMB = ((encParams->LayerWidth[i] + 15) / 16) * ((encParams->LayerHeight[i] + 15) / 16);
511 profile_max_framerate = (float)encParams->LayerMaxMbsPerSec[i] / (float)nTotalMB;
516 encParams->LayerMaxFrameRate[i] = PV_MIN(profile_max_framerate, encParams->LayerFrameRate[i]);
521 for (i = 0; i < encParams->nLayers; i++)
523 encParams->LayerBitRate[i] = encOption->bitRate[i];
524 encParams->LayerMaxBitRate[i] = encOption->bitRate[i];
526 if (encParams->nLayers > 1)
533 encParams->RC_Type = encOption->rcType;
541 encParams->VBV_delay = (float)2.0; /* default 2sec VBV buffer size */
545 encParams->VBV_delay = (float)0.5; /* default 0.5sec VBV buffer size */
550 encParams->VBV_delay = (float)10.0; /* default 10sec VBV buffer size */
558 encParams->VBV_delay = encOption->vbvDelay;
562 if (encParams->H263_Enabled && encOption->searchRange > 16)
564 encParams->SearchRange = 16; /* 4/16/2001 */
571 if (video->encParams->RC_Type == CBR_1 || video->encParams->RC_Type == CBR_2 || video->encParams->RC_Type == CBR_LOWDELAY) /* if CBR */
574 if (video->encParams->NoFrameSkip_Enabled == PV_ON ||
575 video->encParams->NoPreSkip_Enabled == PV_ON) /* don't allow frame skip*/
579 else if (video->encParams->RC_Type == CONSTANT_Q) /* constant_Q */
581 video->encParams->NoFrameSkip_Enabled = PV_ON; /* no frame skip */
582 video->encParams->NoPreSkip_Enabled = PV_ON; /* no frame skip */
588 if (video->encParams->NoFrameSkip_Enabled == PV_ON) /* if no frame skip */
590 video->encParams->FineFrameSkip_Enabled = PV_OFF;
600 nLayers = video->encParams->nLayers; /* Number of Layers to be encoded */
605 temp_w = video->encParams->LayerWidth[idx];
606 temp_h = video->encParams->LayerHeight[idx];
617 mbsPerSec = (Int)(nTotalMB * video->encParams->LayerFrameRate[idx]);
618 if (mbsPerSec > video->encParams->LayerMaxMbsPerSec[idx]) status = PV_FALSE;
624 if (video->encParams->RC_Type == CBR_LOWDELAY) video->encParams->VBV_delay = 0.5; /* For CBR_LOWDELAY, we set 0.5sec buffer */
625 status = SetProfile_BufferSize(video, video->encParams->VBV_delay, 1);
644 //video->frameRate = video->encParams->LayerFrameRate[0]; /* Set current layer frame rate */
682 if (!video->encParams->H263_Enabled)
714 video->oBSize = encParams->BufferSize[0] >> 3;
718 video->oBSize = PV_MAX((encParams->BufferSize[0] >> 3), (encParams->BufferSize[1] >> 3));
721 if (video->oBSize > DEFAULT_OVERRUN_BUFFER_SIZE || encParams->RC_Type == CONSTANT_Q) // set limit
733 if (video->encParams->H263_Enabled) /* make it conditional 11/28/05 */
834 video->pMP[idx]->frameRange = (Int)(video->encParams->LayerFrameRate[idx] * 1.0); /* 1.0s time frame*/
858 pEncParams = video->encParams;
865 pVol->timeIncrementResolution = video->encParams->TimeIncrementRes;
1016 if (video->encParams->RC_Type != CONSTANT_Q)
1092 video->encParams->rc[0]->totalFrameNumber);
1153 max_width = video->encParams->LayerWidth[0];
1155 if (video->encParams->H263_Enabled)
1204 for (idx = 0; idx < video->encParams->nLayers; idx++)
1226 for (idx = 0; idx < video->encParams->nLayers; idx++)
1243 if (video->encParams->RC_Type != CONSTANT_Q)
1245 RC_Cleanup(video->rc, video->encParams->nLayers);
1247 for (idx = 0; idx < video->encParams->nLayers; idx++)
1258 if (video->encParams)
1260 M4VENC_FREE(video->encParams);
1291 if (encData->encParams == NULL)
1299 encData->encParams->GetVolHeader[layer] = 1; /* Set usage flag: Needed to support old method*/
1359 VideoEncParams *encParams = video->encParams;
1370 //Int nLayers = encParams->nLayers;
1391 if ((currLayer < 0) || (currLayer > encParams->nLayers - 1))
1446 if (!video->encParams->GetVolHeader[currLayer])
1455 width = encParams->LayerWidth[currLayer]; /* Get input width */
1456 height = encParams->LayerHeight[currLayer]; /* Get input height */
1479 if (video->encParams->H263_Enabled) /* 11/28/05 */
1490 video->currVop->intraDCVlcThr = encParams->IntraDCVlcThr;
1525 video->currVop->quantizer = encParams->InitQuantIvop[currLayer];
1527 video->currVop->quantizer = encParams->InitQuantPvop[currLayer];
1560 if ((currLayer == 0) && (encParams->IntraPeriod > 0) && (video->currVop->predictionType == I_VOP))
1561 video->nextEncIVop = encParams->IntraPeriod;
1586 if (video->encParams->H263_Enabled)
1597 vid_out->timestamp = (ULong)(((video->prevFrameNum[currLayer] * 1000) / encParams->LayerFrameRate[currLayer]) + video->modTimeRef + 0.5);
1652 VideoEncParams *encParams = video->encParams;
1660 //Int nLayers = encParams->nLayers;
1725 width = encParams->LayerWidth[currLayer]; /* Get input width */
1726 height = encParams->LayerHeight[currLayer]; /* Get input height */
1749 if (video->encParams->H263_Enabled) /* 11/28/05 */
1760 video->currVop->intraDCVlcThr = encParams->IntraDCVlcThr;
1795 video->currVop->quantizer = encParams->InitQuantIvop[currLayer];
1797 video->currVop->quantizer = encParams->InitQuantPvop[currLayer];
1843 VideoEncParams *encParams = video->encParams;
1866 if (!video->encParams->GetVolHeader[currLayer])
1900 if ((currLayer == 0) && (encParams->IntraPeriod > 0) && (video->currVop->predictionType == I_VOP))
1901 video->nextEncIVop = encParams->IntraPeriod;
1909 if (video->encParams->H263_Enabled)
1920 vid_out->timestamp = (ULong)(((video->prevFrameNum[currLayer] * 1000) / encParams->LayerFrameRate[currLayer]) + video->modTimeRef + 0.5);
1991 if (encData->encParams == NULL)
1994 if (!encData->encParams->H263_Enabled) return PV_FALSE;
1998 width = encData->encParams->LayerWidth[0];
1999 height = encData->encParams->LayerHeight[0];
2000 bitrate_r = (float)(encData->encParams->LayerBitRate[0]) / (float)64000.0;
2001 framerate = encData->encParams->LayerFrameRate[0];
2057 if (video->encParams->ProfileLevel[0] == profile_level_code[i])
2068 if (video->encParams->ProfileLevel[0] == scalable_profile_level_code[i])
2100 if (encData->encParams == NULL)
2104 for (i = 0; i < encData->encParams->nLayers; i++)
2108 //nTotalMB = (((encData->encParams->LayerWidth[i]+15)/16)*16)*(((encData->encParams->LayerHeight[i]+15)/16)*16)/(16*16);
2110 //if(mbPerSec > encData->encParams->LayerMaxMbsPerSec[i]) return PV_FALSE;
2111 if (frameRate[i] > encData->encParams->LayerMaxFrameRate[i]) return PV_FALSE; /* set by users or profile */
2113 encData->encParams->LayerFrameRate[i] = frameRate[i];
2141 if (encData->encParams == NULL)
2145 for (i = 0; i < encData->encParams->nLayers; i++)
2147 if (bitRate[i] > encData->encParams->LayerMaxBitRate[i]) /* set by users or profile */
2151 encData->encParams->LayerBitRate[i] = bitRate[i];
2180 if (encData->encParams == NULL)
2184 encParams->nLayers == 1 ? encData->encParams->LayerBitRate[0] :
2185 encData->encParams->LayerBitRate[1]);
2186 index = encData->encParams->profile_table_index;
2187 max_buffer_size = (encData->encParams->nLayers == 1 ? profile_level_max_VBV_size[index] :
2193 encData->encParams->VBV_delay = delay;
2218 if (encData->encParams == NULL)
2221 encData->encParams->IntraPeriod = aIFramePeriod;
2244 encData->encParams->Refresh = numMB;
2268 if (encData->encParams == NULL)
2294 if (encData->encParams == NULL)
2296 return encData->encParams->MemoryUsage;
2318 if (encData->encParams == NULL)
2346 if (encData->encParams == NULL)
2351 *maxVideoFrameSize = encData->encParams->BufferSize[0];
2353 if (encData->encParams->nLayers == 2)
2354 if (*maxVideoFrameSize < encData->encParams->BufferSize[1])
2355 *maxVideoFrameSize = encData->encParams->BufferSize[1];
2382 if (encData->encParams == NULL)
2385 *VBVSize = encData->encParams->BufferSize[0];
2386 if (encData->encParams->nLayers == 2)
2387 *VBVSize += encData->encParams->BufferSize[1];
2426 status = BitstreamPutBits(stream, 8, video->encParams->ProfileLevel[video->currLayer]);
2594 VideoEncParams *encParams = video->encParams;
2595 Int numLayers = encParams->nLayers;
2597 float *LayerFrameRate = encParams->LayerFrameRate;
2649 frameTick = (UInt)((frameTick + (encParams->LayerFrameRate[i]/2))/encParams->LayerFrameRate[i]);*/
2682 if (encParams->RC_Type != CONSTANT_Q)
2707 (Int)((1000.0 * encParams->LayerFrameRate[numLayers-1]) / encParams->LayerFrameRate[i]);
2718 frameNum[i] = (UInt)((frameModTime - modTimeRef) * encParams->LayerFrameRate[i] + 500) / 1000;
2728 if (encParams->RC_Type != CONSTANT_Q)
2758 VideoEncParams *encParams = video->encParams;
2761 if (encParams->IntraPeriod == 0) /* I-VOPs only */
2772 else if (encParams->IntraPeriod == -1) /* IPPPPP... */
2776 if (encParams->RC_Type == CONSTANT_Q || video->rc[currLayer]->skip_next_frame != -1)
2798 if (encParams->RC_Type == CONSTANT_Q || video->rc[currLayer]->skip_next_frame != -1)
2805 video->nextEncIVop = encParams->IntraPeriod;
2830 VideoEncParams *encParams = video->encParams;
2831 Int numLayers = encParams->nLayers;
2839 if (encParams->RC_Type != CONSTANT_Q)
2868 /*if((encParams->IntraPeriod>0) && (video->currVop->predictionType == I_VOP))
2893 ((Int)((1000.0 * encParams->LayerFrameRate[numLayers-1]) / encParams->LayerFrameRate[i]));
2906 if (((encParams->IntraPeriod != 0) /*&& (video->currVop->predictionType==I_VOP)*/) ||
2907 ((encParams->IntraPeriod == 0) && (video->numVopsInGOP == 0)))
2923 temp = (UInt)(deltaModTime * encParams->LayerFrameRate[i]); /* 12/12/02 */
2933 video->prevFrameNum[i] -= (UInt)(deltaModTime * encParams->LayerFrameRate[i]) / 1000;
2967 Int nLayers = video->encParams->nLayers; /* Number of Layers to be encoded */
2986 index = video->encParams->profile_table_index;
2992 temp_w = video->encParams->LayerWidth[idx];
2993 temp_h = video->encParams->LayerHeight[idx];
3003 upper_bound_ratio = (video->encParams->RC_Type == CBR_LOWDELAY ? (float)5.0 : (float)UPPER_BOUND_RATIO);
3007 base_bitrate = video->encParams->LayerBitRate[0];
3008 if (video->encParams->LayerMaxBitRate[0] != 0) /* video->encParams->LayerMaxBitRate[0] == 0 means it has not been set */
3010 base_bitrate = PV_MAX(base_bitrate, video->encParams->LayerMaxBitRate[0]);
3014 video->encParams->LayerMaxBitRate[0] = profile_level_max_bitrate[index];
3017 base_framerate = video->encParams->LayerFrameRate[0];
3018 if (video->encParams->LayerMaxFrameRate[0] != 0)
3020 base_framerate = PV_MAX(base_framerate, video->encParams->LayerMaxFrameRate[0]);
3024 video->encParams->LayerMaxFrameRate[0] = (float)profile_level_max_mbsPerSec[index] / nTotalMB;
3027 base_packet_size = video->encParams->ResyncPacketsize;
3045 total_bitrate = video->encParams->LayerBitRate[1];
3046 if (video->encParams->LayerMaxBitRate[1] != 0)
3048 total_bitrate = PV_MIN(total_bitrate, video->encParams->LayerMaxBitRate[1]);
3052 video->encParams->LayerMaxBitRate[1] = scalable_profile_level_max_bitrate[index];
3055 total_framerate = video->encParams->LayerFrameRate[1];
3056 if (video->encParams->LayerMaxFrameRate[1] != 0)
3058 total_framerate = PV_MIN(total_framerate, video->encParams->LayerMaxFrameRate[1]);
3062 video->encParams->LayerMaxFrameRate[1] = (float)scalable_profile_level_max_mbsPerSec[index] / nTotalMB;
3065 total_packet_size = video->encParams->ResyncPacketsize;
3089 video->encParams->BufferSize[0] = base_VBV_size;
3091 video->encParams->BufferSize[1] = enhance_VBV_size;
3109 width16 = ((video->encParams->LayerWidth[0] + 15) >> 4) << 4;
3110 height16 = ((video->encParams->LayerHeight[0] + 15) >> 4) << 4;
3111 if (video->encParams->H263_Enabled)
3123 video->encParams->maxFrameSize = k * 16384;
3134 if (!video->encParams->H263_Enabled &&
3135 (video->encParams->IntraDCVlcThr != 0 || video->encParams->SearchRange > 16))
3150 base_VBV_size <= (video->encParams->H263_Enabled ? (Int)(k*16384 + 4*(float)profile_level_max_bitrate[i]*1001.0 / 30000.0) :
3164 video->encParams->ProfileLevel[0] = profile_level_code[i];
3165 video->encParams->BufferSize[0] = base_VBV_size;
3167 if (video->encParams->LayerMaxBitRate[0] == 0)
3168 video->encParams->LayerMaxBitRate[0] = profile_level_max_bitrate[i];
3170 if (video->encParams->LayerMaxFrameRate[0] == 0)
3171 video->encParams->LayerMaxFrameRate[0] = PV_MIN(30, (float)profile_level_max_mbsPerSec[i] / nTotalMB);
3174 if (video->encParams->H263_Enabled)
3175 video->encParams->BufferSize[0] = (Int)(k * 16384 + 4 * (float)profile_level_max_bitrate[i] * 1001.0 / 30000.0);
3244 video->encParams->ProfileLevel[0] = profile_level_code[j];
3245 video->encParams->ProfileLevel[1] = scalable_profile_level_code[i];
3246 video->encParams->BufferSize[0] = base_VBV_size;
3247 video->encParams->BufferSize[1] = enhance_VBV_size;
3249 if (video->encParams->LayerMaxBitRate[0] == 0)
3250 video->encParams->LayerMaxBitRate[0] = profile_level_max_bitrate[j];
3252 if (video->encParams->LayerMaxBitRate[1] == 0)
3253 video->encParams->LayerMaxBitRate[1] = scalable_profile_level_max_bitrate[i];
3255 if (video->encParams->LayerMaxFrameRate[0] == 0)
3256 video->encParams->LayerMaxFrameRate[0] = PV_MIN(30, (float)profile_level_max_mbsPerSec[j] / nTotalMB);
3258 if (video->encParams->LayerMaxFrameRate[1] == 0)
3259 video->encParams->LayerMaxFrameRate[1] = PV_MIN(30, (float)scalable_profile_level_max_mbsPerSec[i] / nTotalMB);
3265 if (!video->encParams->H263_Enabled && (video->encParams->ProfileLevel[0] == 0x08)) /* SPL0 restriction*/
3268 if(video->encParams->ACDCPrediction == TRUE && MB-based rate control)