unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n) {
    unsigned int ret=0, i, j;
    do {
        ++ret;
        for(i=0,j=ret;i<n-1;i++) j*=ret;
    } while (j<=x);
    return (ret-1);
}
['static void create_vorbis_context(venc_context_t * venc, AVCodecContext * avccontext) {\n    floor_t * fc;\n    residue_t * rc;\n    mapping_t * mc;\n    int i, book;\n    venc->channels = avccontext->channels;\n    venc->sample_rate = avccontext->sample_rate;\n    venc->log2_blocksize[0] = venc->log2_blocksize[1] = 11;\n    venc->ncodebooks = sizeof(cvectors)/sizeof(cvectors[0]);\n    venc->codebooks = av_malloc(sizeof(codebook_t) * venc->ncodebooks);\n    for (book = 0; book < venc->ncodebooks; book++) {\n        codebook_t * cb = &venc->codebooks[book];\n        int vals;\n        cb->ndimentions = cvectors[book].dim;\n        cb->nentries = cvectors[book].real_len;\n        cb->min = cvectors[book].min;\n        cb->delta = cvectors[book].delta;\n        cb->lookup = cvectors[book].lookup;\n        cb->seq_p = 0;\n        cb->lens = av_malloc(sizeof(uint8_t) * cb->nentries);\n        cb->codewords = av_malloc(sizeof(uint32_t) * cb->nentries);\n        memcpy(cb->lens, cvectors[book].clens, cvectors[book].len);\n        memset(cb->lens + cvectors[book].len, 0, cb->nentries - cvectors[book].len);\n        if (cb->lookup) {\n            vals = cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries);\n            cb->quantlist = av_malloc(sizeof(int) * vals);\n            for (i = 0; i < vals; i++)\n                cb->quantlist[i] = cvectors[book].quant[i];\n        } else {\n            cb->quantlist = NULL;\n        }\n        ready_codebook(cb);\n    }\n    venc->nfloors = 1;\n    venc->floors = av_malloc(sizeof(floor_t) * venc->nfloors);\n    fc = &venc->floors[0];\n    fc->partitions = 8;\n    fc->partition_to_class = av_malloc(sizeof(int) * fc->partitions);\n    fc->nclasses = 0;\n    for (i = 0; i < fc->partitions; i++) {\n        static const int a[] = {0,1,2,2,3,3,4,4};\n        fc->partition_to_class[i] = a[i];\n        fc->nclasses = FFMAX(fc->nclasses, fc->partition_to_class[i]);\n    }\n    fc->nclasses++;\n    fc->classes = av_malloc(sizeof(floor_class_t) * fc->nclasses);\n    for (i = 0; i < fc->nclasses; i++) {\n        floor_class_t * c = &fc->classes[i];\n        int j, books;\n        c->dim = floor_classes[i].dim;\n        c->subclass = floor_classes[i].subclass;\n        c->masterbook = floor_classes[i].masterbook;\n        books = (1 << c->subclass);\n        c->books = av_malloc(sizeof(int) * books);\n        for (j = 0; j < books; j++)\n            c->books[j] = floor_classes[i].nbooks[j];\n    }\n    fc->multiplier = 2;\n    fc->rangebits = venc->log2_blocksize[0] - 1;\n    fc->values = 2;\n    for (i = 0; i < fc->partitions; i++)\n        fc->values += fc->classes[fc->partition_to_class[i]].dim;\n    fc->list = av_malloc(sizeof(floor1_entry_t) * fc->values);\n    fc->list[0].x = 0;\n    fc->list[1].x = 1 << fc->rangebits;\n    for (i = 2; i < fc->values; i++) {\n        static const int a[] = {\n             93, 23,372,  6, 46,186,750, 14, 33, 65,\n            130,260,556,  3, 10, 18, 28, 39, 55, 79,\n            111,158,220,312,464,650,850\n        };\n        fc->list[i].x = a[i - 2];\n    }\n    ff_vorbis_ready_floor1_list(fc->list, fc->values);\n    venc->nresidues = 1;\n    venc->residues = av_malloc(sizeof(residue_t) * venc->nresidues);\n    rc = &venc->residues[0];\n    rc->type = 2;\n    rc->begin = 0;\n    rc->end = 1600;\n    rc->partition_size = 32;\n    rc->classifications = 10;\n    rc->classbook = 15;\n    rc->books = av_malloc(sizeof(*rc->books) * rc->classifications);\n    {\n        static const int8_t a[10][8] = {\n            { -1, -1, -1, -1, -1, -1, -1, -1, },\n            { -1, -1, 16, -1, -1, -1, -1, -1, },\n            { -1, -1, 17, -1, -1, -1, -1, -1, },\n            { -1, -1, 18, -1, -1, -1, -1, -1, },\n            { -1, -1, 19, -1, -1, -1, -1, -1, },\n            { -1, -1, 20, -1, -1, -1, -1, -1, },\n            { -1, -1, 21, -1, -1, -1, -1, -1, },\n            { 22, 23, -1, -1, -1, -1, -1, -1, },\n            { 24, 25, -1, -1, -1, -1, -1, -1, },\n            { 26, 27, 28, -1, -1, -1, -1, -1, },\n        };\n        memcpy(rc->books, a, sizeof a);\n    }\n    ready_residue(rc, venc);\n    venc->nmappings = 1;\n    venc->mappings = av_malloc(sizeof(mapping_t) * venc->nmappings);\n    mc = &venc->mappings[0];\n    mc->submaps = 1;\n    mc->mux = av_malloc(sizeof(int) * venc->channels);\n    for (i = 0; i < venc->channels; i++)\n        mc->mux[i] = 0;\n    mc->floor = av_malloc(sizeof(int) * mc->submaps);\n    mc->residue = av_malloc(sizeof(int) * mc->submaps);\n    for (i = 0; i < mc->submaps; i++) {\n        mc->floor[i] = 0;\n        mc->residue[i] = 0;\n    }\n    mc->coupling_steps = venc->channels == 2 ? 1 : 0;\n    mc->magnitude = av_malloc(sizeof(int) * mc->coupling_steps);\n    mc->angle = av_malloc(sizeof(int) * mc->coupling_steps);\n    if (mc->coupling_steps) {\n        mc->magnitude[0] = 0;\n        mc->angle[0] = 1;\n    }\n    venc->nmodes = 1;\n    venc->modes = av_malloc(sizeof(vorbis_mode_t) * venc->nmodes);\n    venc->modes[0].blockflag = 0;\n    venc->modes[0].mapping = 0;\n    venc->have_saved = 0;\n    venc->saved = av_malloc(sizeof(float) * venc->channels * (1 << venc->log2_blocksize[1]) / 2);\n    venc->samples = av_malloc(sizeof(float) * venc->channels * (1 << venc->log2_blocksize[1]));\n    venc->floor = av_malloc(sizeof(float) * venc->channels * (1 << venc->log2_blocksize[1]) / 2);\n    venc->coeffs = av_malloc(sizeof(float) * venc->channels * (1 << venc->log2_blocksize[1]) / 2);\n    venc->win[0] = ff_vorbis_vwin[venc->log2_blocksize[0] - 6];\n    venc->win[1] = ff_vorbis_vwin[venc->log2_blocksize[1] - 6];\n    ff_mdct_init(&venc->mdct[0], venc->log2_blocksize[0], 0);\n    ff_mdct_init(&venc->mdct[1], venc->log2_blocksize[1], 0);\n}', 'static int cb_lookup_vals(int lookup, int dimentions, int entries) {\n    if      (lookup == 1) return ff_vorbis_nth_root(entries, dimentions);\n    else if (lookup == 2) return dimentions * entries;\n    return 0;\n}', 'unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n) {\n    unsigned int ret=0, i, j;\n    do {\n        ++ret;\n        for(i=0,j=ret;i<n-1;i++) j*=ret;\n    } while (j<=x);\n    return (ret-1);\n}']