コード例 #1
0
ファイル: PARDISOSolver.cpp プロジェクト: jiawen/libcgt
bool PARDISOSolver< valueType, zeroBased >::analyzePattern( CompressedSparseMatrix< valueType >& A )
{
    return analyzePattern( A.numRows(), A.numCols(),
        reinterpret_cast< int* >( A.outerIndexPointers().data() ),
        reinterpret_cast< int* >( A.innerIndices().data() ),
        A.numNonZeros() );
}
コード例 #2
0
ファイル: rate.c プロジェクト: gguillotte/netpbm-code
/*===========================================================================*
 *
 * initRateControl
 *
 *	initialize the allocation parameters.
 *
 * RETURNS:	nothing
 *
 * SIDE EFFECTS:   many global variables
 *
 * NOTES:  Get rid of the redundant pattern stuff!!
 *===========================================================================*/
int
initRateControl(bool const wantUnderflowWarning,
                bool const wantOverflowWarning) {
    int result;
    const char * error;

    wantVbvUnderflowWarning = wantUnderflowWarning;
    wantVbvOverflowWarning  = wantOverflowWarning;

    DBG_PRINT(("Initializing Allocation Data\n"));

#ifdef RC_STATS_FILE
    RC_FILE = fopen("RC_STATS_FILE", "w");
    if ( RC_FILE  == NULL) {
        DBG_PRINT(("Open of RC file failed, using stderr\n"));
        RC_FILE = stderr;
        fprintf(RC_FILE, "Open of RC file failed, using stderr\n");
        fflush(RC_FILE);
    }
#endif

    VBV_remainingDelay = 0;

    analyzePattern(framePattern, framePatternLen,
                   &GOP_X, &GOP_I, &GOP_P, &GOP_B, &error);

    if (error) {
        pm_message("Unable to set up rate control.  Switching to variable.  "
                   "%s", error);
        pm_strfree(error);
        RateControlMode = VARIABLE_RATE;
        return -1;
    }


    /* Initializing GOP bit allocation */
    rc_R = 0;
    rc_G = (bit_rate * GOP_X/frameRateRounded);

    /*   Initialize the "global complexity measures" */
    Xi = (160 * bit_rate/115);
    Xp = (60 * bit_rate/115);
    Xb = (42 * bit_rate/115);

    /*   Initialize MB counters */
    rc_totalMBBits= rc_bitsThisMB= rc_totalFrameBits=rc_totalOverheadBits = 0;
    rc_numBlocks = rc_totalQuant = 0;

    /*   init virtual buffers  */
    reactionParameter = (2 * bit_rate / frameRateRounded);
    d0_i = (10 * reactionParameter / 31);
    d0_p = (Kp * d0_i);
    d0_b = (Kb * d0_i);

    lastFrameVirtBuf = d0_i;	/*  start with I Frame */
    rc_Q = lastFrameVirtBuf  * 31 / reactionParameter;

    /*   init spatial activity measures */
    avg_act = 400;		/* Suggested initial value */
    N_act = 1;

    mquant = rc_Q * N_act;

    frameDelayIncrement = (90000 / frameRateRounded);
    /* num of "delay" units per frame */
    bufferFillRate = bit_rate / frameRateRounded;
    /* VBV buf fills at constant rate */
    VBV_buffer = buffer_size;
    DBG_PRINT(("VBV- delay: %d, fill rate: %d, delay/Frame: %d units, "
               "buffer size: %d\n",
               VBV_remainginDelay, bufferFillRate, frameDelayIncrement,
               buffer_size));

    result = initGOPRateControl();

    return result;
}