예제 #1
0
파일: pack.cpp 프로젝트: Phil974m/protrekkr
void write_decorr_weights (WavpackStream *wps, WavpackMetadata *wpmd)
{
    struct decorr_pass *dpp = wps->decorr_passes;
    int tcount, i;
    char *byteptr;

    byteptr = (char *) wpmd->temp_data;
    wpmd->data = wpmd->temp_data;
    wpmd->id = ID_DECORR_WEIGHTS;

    for (i = wps->num_terms - 1; i >= 0; --i)
        if (store_weight (dpp [i].weight_A) 
            //||
           // (!(wps->wphdr.flags & MONO_DATA) && 
            //store_weight (dpp [i].weight_B))
           )
                break;

    tcount = i + 1;

    for (i = 0; i < wps->num_terms; ++i) {
        if (i < tcount) {
            dpp [i].weight_A = restore_weight (*byteptr++ = store_weight (dpp [i].weight_A));
        }
        else
            dpp [i].weight_A = dpp [i].weight_B = 0;
    }

    wpmd->byte_length = byteptr - (char *) wpmd->data;
}
예제 #2
0
static void write_decorr_weights (WavpackStream *wps, WavpackMetadata *wpmd)
{
    int tcount = wps->num_terms;
    struct decorr_pass *dpp;
    signed char *byteptr;

    byteptr = wpmd->data = wpmd->temp_data;
    wpmd->id = ID_DECORR_WEIGHTS;

    for (dpp = wps->decorr_passes; tcount--; ++dpp) {
        dpp->weight_A = restore_weight (*byteptr++ = store_weight (dpp->weight_A));

        if (!(wps->wphdr.flags & MONO_FLAG))
            dpp->weight_B = restore_weight (*byteptr++ = store_weight (dpp->weight_B));
    }

    wpmd->byte_length = byteptr - (signed char *) wpmd->data;
}
예제 #3
0
파일: extra1.c 프로젝트: sebastinas/WavPack
static void decorr_mono_pass (int32_t *in_samples, int32_t *out_samples, uint32_t num_samples, struct decorr_pass *dpp, int dir)
{
    int32_t cont_samples = 0;
    int m = 0, i;

#ifdef PACK_DECORR_MONO_PASS_CONT
    if (num_samples > 16 && dir > 0) {
        int32_t pre_samples = (dpp->term > MAX_TERM) ? 2 : dpp->term;
        cont_samples = num_samples - pre_samples;
        num_samples = pre_samples;
    }
#endif

    dpp->sum_A = 0;

    if (dir < 0) {
        out_samples += (num_samples + cont_samples - 1);
        in_samples += (num_samples + cont_samples - 1);
        dir = -1;
    }
    else
        dir = 1;

    dpp->weight_A = restore_weight (store_weight (dpp->weight_A));

    for (i = 0; i < 8; ++i)
        dpp->samples_A [i] = exp2s (log2s (dpp->samples_A [i]));

    if (dpp->term > MAX_TERM) {
        while (num_samples--) {
            int32_t left, sam_A;

            if (dpp->term & 1)
                sam_A = 2 * dpp->samples_A [0] - dpp->samples_A [1];
            else
                sam_A = (3 * dpp->samples_A [0] - dpp->samples_A [1]) >> 1;

            dpp->samples_A [1] = dpp->samples_A [0];
            dpp->samples_A [0] = left = in_samples [0];

            left -= apply_weight (dpp->weight_A, sam_A);
            update_weight (dpp->weight_A, dpp->delta, sam_A, left);
            dpp->sum_A += dpp->weight_A;
            out_samples [0] = left;
            in_samples += dir;
            out_samples += dir;
        }
    }
    else if (dpp->term > 0) {
예제 #4
0
파일: extra1.c 프로젝트: e9925248/WavPack
static void decorr_mono_pass (int32_t *in_samples, int32_t *out_samples, uint32_t num_samples, struct decorr_pass *dpp, int dir)
{
    int m = 0, i;

    dpp->sum_A = 0;

    if (dir < 0) {
        out_samples += (num_samples - 1);
        in_samples += (num_samples - 1);
        dir = -1;
    }
    else
        dir = 1;

    dpp->weight_A = restore_weight (store_weight (dpp->weight_A));

    for (i = 0; i < 8; ++i)
        dpp->samples_A [i] = exp2s (log2s (dpp->samples_A [i]));

    if (dpp->term > MAX_TERM) {
        while (num_samples--) {
            int32_t left, sam_A;

            if (dpp->term & 1)
                sam_A = 2 * dpp->samples_A [0] - dpp->samples_A [1];
            else
                sam_A = (3 * dpp->samples_A [0] - dpp->samples_A [1]) >> 1;

            dpp->samples_A [1] = dpp->samples_A [0];
            dpp->samples_A [0] = left = in_samples [0];

            left -= apply_weight (dpp->weight_A, sam_A);
            update_weight (dpp->weight_A, dpp->delta, sam_A, left);
            dpp->sum_A += dpp->weight_A;
            out_samples [0] = left;
            in_samples += dir;
            out_samples += dir;
        }
    }
    else if (dpp->term > 0) {