libavcodec/g722.c:506: error: Uninitialized Value
  The value read from next[_] was never initialized.

libavcodec/g722.c:506:17: 
504.                 dec_diff = xhigh - decoded;
505. 
506.                 STORE_NODE(1, update_high_predictor(&node->state, dhigh, ihigh), ihigh);
                     ^
507.             }
508.         }

static int g722_encode_trellis(AVCodecContext *avctx,
                               uint8_t *dst, int buf_size, void *data)
{
    G722Context *c = avctx->priv_data;
    const int16_t *samples = data;
    int i, j, k;
    int frontier = 1 << avctx->trellis;
    struct TrellisNode **nodes[2];
    struct TrellisNode **nodes_next[2];
    int pathn[2] = {0, 0}, froze = -1;
    struct TrellisPath *p[2];
    for (i = 0; i < 2; i++) {
        nodes[i] = c->nodep_buf[i];
        nodes_next[i] = c->nodep_buf[i] + frontier;
        memset(c->nodep_buf[i], 0, 2 * frontier * sizeof(*c->nodep_buf));
        nodes[i][0] = c->node_buf[i] + frontier;
        nodes[i][0]->ssd = 0;
        nodes[i][0]->path = 0;
        nodes[i][0]->state = c->band[i];
    }
    for (i = 0; i < buf_size >> 1; i++) {
        int xlow, xhigh;
        struct TrellisNode *next[2];
        int heap_pos[2] = {0, 0};
        for (j = 0; j < 2; j++) {
            next[j] = c->node_buf[j] + frontier*(i & 1);
            memset(nodes_next[j], 0, frontier * sizeof(**nodes_next));
        }
        filter_samples(c, &samples[2*i], &xlow, &xhigh);
        for (j = 0; j < frontier && nodes[0][j]; j++) {
            int range = j < frontier/2 ? 4 : 0;
            struct TrellisNode *cur_node = nodes[0][j];
            int ilow = encode_low(&cur_node->state, xlow);
            for (k = ilow - range; k <= ilow + range && k <= 63; k += 4) {
                int decoded, dec_diff, pos;
                uint32_t ssd;
                struct TrellisNode* node;
                if (k < 0)
                    continue;
                decoded = av_clip((cur_node->state.scale_factor *
                                  low_inv_quant6[k] >> 10)
                                + cur_node->state.s_predictor, -16384, 16383);
                dec_diff = xlow - decoded;
#define STORE_NODE(index, UPDATE, VALUE)\
                ssd = cur_node->ssd + dec_diff*dec_diff;\
                 \
                if (ssd < cur_node->ssd)\
                    continue;\
                if (heap_pos[index] < frontier) {\
                    pos = heap_pos[index]++;\
                    assert(pathn[index] < FREEZE_INTERVAL * frontier);\
                    node = nodes_next[index][pos] = next[index]++;\
                    node->path = pathn[index]++;\
                } else {\
                     \
                    pos = (frontier>>1) + (heap_pos[index] & ((frontier>>1) - 1));\
                    if (ssd >= nodes_next[index][pos]->ssd)\
                        continue;\
                    heap_pos[index]++;\
                    node = nodes_next[index][pos];\
                }\
                node->ssd = ssd;\
                node->state = cur_node->state;\
                UPDATE;\
                c->paths[index][node->path].value = VALUE;\
                c->paths[index][node->path].prev = cur_node->path;\
                 \
                while (pos > 0) {\
                    int parent = (pos - 1) >> 1;\
                    if (nodes_next[index][parent]->ssd <= ssd)\
                        break;\
                    FFSWAP(struct TrellisNode*, nodes_next[index][parent],\
                                                nodes_next[index][pos]);\
                    pos = parent;\
                }
                STORE_NODE(0, update_low_predictor(&node->state, k >> 2), k);
            }
        }
        for (j = 0; j < frontier && nodes[1][j]; j++) {
            int ihigh;
            struct TrellisNode *cur_node = nodes[1][j];
            for (ihigh = 0; ihigh < 4; ihigh++) {
                int dhigh, decoded, dec_diff, pos;
                uint32_t ssd;
                struct TrellisNode* node;
                dhigh = cur_node->state.scale_factor *
                        high_inv_quant[ihigh] >> 10;
                decoded = av_clip(dhigh + cur_node->state.s_predictor,
                                  -16384, 16383);
                dec_diff = xhigh - decoded;
                STORE_NODE(1, update_high_predictor(&node->state, dhigh, ihigh), ihigh);
            }
        }
        for (j = 0; j < 2; j++) {
            FFSWAP(struct TrellisNode**, nodes[j], nodes_next[j]);
            if (nodes[j][0]->ssd > (1 << 16)) {
                for (k = 1; k < frontier && nodes[j][k]; k++)
                    nodes[j][k]->ssd -= nodes[j][0]->ssd;
                nodes[j][0]->ssd = 0;
            }
        }
        if (i == froze + FREEZE_INTERVAL) {
            p[0] = &c->paths[0][nodes[0][0]->path];
            p[1] = &c->paths[1][nodes[1][0]->path];
            for (j = i; j > froze; j--) {
                dst[j] = p[1]->value << 6 | p[0]->value;
                p[0] = &c->paths[0][p[0]->prev];
                p[1] = &c->paths[1][p[1]->prev];
            }
            froze = i;
            pathn[0] = pathn[1] = 0;
            memset(nodes[0] + 1, 0, (frontier - 1)*sizeof(**nodes));
            memset(nodes[1] + 1, 0, (frontier - 1)*sizeof(**nodes));
        }
    }
    p[0] = &c->paths[0][nodes[0][0]->path];
    p[1] = &c->paths[1][nodes[1][0]->path];
    for (j = i; j > froze; j--) {
        dst[j] = p[1]->value << 6 | p[0]->value;
        p[0] = &c->paths[0][p[0]->prev];
        p[1] = &c->paths[1][p[1]->prev];
    }
    c->band[0] = nodes[0][0]->state;
    c->band[1] = nodes[1][0]->state;
    return i;
}
['static int g722_encode_trellis(AVCodecContext *avctx,\n                               uint8_t *dst, int buf_size, void *data)\n{\n    G722Context *c = avctx->priv_data;\n    const int16_t *samples = data;\n    int i, j, k;\n    int frontier = 1 << avctx->trellis;\n    struct TrellisNode **nodes[2];\n    struct TrellisNode **nodes_next[2];\n    int pathn[2] = {0, 0}, froze = -1;\n    struct TrellisPath *p[2];\n    for (i = 0; i < 2; i++) {\n        nodes[i] = c->nodep_buf[i];\n        nodes_next[i] = c->nodep_buf[i] + frontier;\n        memset(c->nodep_buf[i], 0, 2 * frontier * sizeof(*c->nodep_buf));\n        nodes[i][0] = c->node_buf[i] + frontier;\n        nodes[i][0]->ssd = 0;\n        nodes[i][0]->path = 0;\n        nodes[i][0]->state = c->band[i];\n    }\n    for (i = 0; i < buf_size >> 1; i++) {\n        int xlow, xhigh;\n        struct TrellisNode *next[2];\n        int heap_pos[2] = {0, 0};\n        for (j = 0; j < 2; j++) {\n            next[j] = c->node_buf[j] + frontier*(i & 1);\n            memset(nodes_next[j], 0, frontier * sizeof(**nodes_next));\n        }\n        filter_samples(c, &samples[2*i], &xlow, &xhigh);\n        for (j = 0; j < frontier && nodes[0][j]; j++) {\n            int range = j < frontier/2 ? 4 : 0;\n            struct TrellisNode *cur_node = nodes[0][j];\n            int ilow = encode_low(&cur_node->state, xlow);\n            for (k = ilow - range; k <= ilow + range && k <= 63; k += 4) {\n                int decoded, dec_diff, pos;\n                uint32_t ssd;\n                struct TrellisNode* node;\n                if (k < 0)\n                    continue;\n                decoded = av_clip((cur_node->state.scale_factor *\n                                  low_inv_quant6[k] >> 10)\n                                + cur_node->state.s_predictor, -16384, 16383);\n                dec_diff = xlow - decoded;\n#define STORE_NODE(index, UPDATE, VALUE)\\\n                ssd = cur_node->ssd + dec_diff*dec_diff;\\\n                 \\\n                if (ssd < cur_node->ssd)\\\n                    continue;\\\n                if (heap_pos[index] < frontier) {\\\n                    pos = heap_pos[index]++;\\\n                    assert(pathn[index] < FREEZE_INTERVAL * frontier);\\\n                    node = nodes_next[index][pos] = next[index]++;\\\n                    node->path = pathn[index]++;\\\n                } else {\\\n                     \\\n                    pos = (frontier>>1) + (heap_pos[index] & ((frontier>>1) - 1));\\\n                    if (ssd >= nodes_next[index][pos]->ssd)\\\n                        continue;\\\n                    heap_pos[index]++;\\\n                    node = nodes_next[index][pos];\\\n                }\\\n                node->ssd = ssd;\\\n                node->state = cur_node->state;\\\n                UPDATE;\\\n                c->paths[index][node->path].value = VALUE;\\\n                c->paths[index][node->path].prev = cur_node->path;\\\n                 \\\n                while (pos > 0) {\\\n                    int parent = (pos - 1) >> 1;\\\n                    if (nodes_next[index][parent]->ssd <= ssd)\\\n                        break;\\\n                    FFSWAP(struct TrellisNode*, nodes_next[index][parent],\\\n                                                nodes_next[index][pos]);\\\n                    pos = parent;\\\n                }\n                STORE_NODE(0, update_low_predictor(&node->state, k >> 2), k);\n            }\n        }\n        for (j = 0; j < frontier && nodes[1][j]; j++) {\n            int ihigh;\n            struct TrellisNode *cur_node = nodes[1][j];\n            for (ihigh = 0; ihigh < 4; ihigh++) {\n                int dhigh, decoded, dec_diff, pos;\n                uint32_t ssd;\n                struct TrellisNode* node;\n                dhigh = cur_node->state.scale_factor *\n                        high_inv_quant[ihigh] >> 10;\n                decoded = av_clip(dhigh + cur_node->state.s_predictor,\n                                  -16384, 16383);\n                dec_diff = xhigh - decoded;\n                STORE_NODE(1, update_high_predictor(&node->state, dhigh, ihigh), ihigh);\n            }\n        }\n        for (j = 0; j < 2; j++) {\n            FFSWAP(struct TrellisNode**, nodes[j], nodes_next[j]);\n            if (nodes[j][0]->ssd > (1 << 16)) {\n                for (k = 1; k < frontier && nodes[j][k]; k++)\n                    nodes[j][k]->ssd -= nodes[j][0]->ssd;\n                nodes[j][0]->ssd = 0;\n            }\n        }\n        if (i == froze + FREEZE_INTERVAL) {\n            p[0] = &c->paths[0][nodes[0][0]->path];\n            p[1] = &c->paths[1][nodes[1][0]->path];\n            for (j = i; j > froze; j--) {\n                dst[j] = p[1]->value << 6 | p[0]->value;\n                p[0] = &c->paths[0][p[0]->prev];\n                p[1] = &c->paths[1][p[1]->prev];\n            }\n            froze = i;\n            pathn[0] = pathn[1] = 0;\n            memset(nodes[0] + 1, 0, (frontier - 1)*sizeof(**nodes));\n            memset(nodes[1] + 1, 0, (frontier - 1)*sizeof(**nodes));\n        }\n    }\n    p[0] = &c->paths[0][nodes[0][0]->path];\n    p[1] = &c->paths[1][nodes[1][0]->path];\n    for (j = i; j > froze; j--) {\n        dst[j] = p[1]->value << 6 | p[0]->value;\n        p[0] = &c->paths[0][p[0]->prev];\n        p[1] = &c->paths[1][p[1]->prev];\n    }\n    c->band[0] = nodes[0][0]->state;\n    c->band[1] = nodes[1][0]->state;\n    return i;\n}']