shithub: libvpx

Download patch

ref: b6f02c85926b928f29b428e620b1c1ec70dd9d42
parent: eb87b56eab32116536cd33866592e6d23b888299
author: Paul Wilkins <paulwilkins@google.com>
date: Mon Feb 27 17:23:38 EST 2012

Code Simplification

Removal of code relating to token partitioning

Change-Id: Iaf3c88d6758639a55bd92c3be5c51e6bed407a3c

--- a/vp8/common/alloccommon.c
+++ b/vp8/common/alloccommon.c
@@ -218,7 +218,6 @@
     oci->filter_type = NORMAL_LOOPFILTER;
     oci->use_bilinear_mc_filter = 0;
     oci->full_pixel = 0;
-    oci->multi_token_partition = ONE_PARTITION;
     oci->clr_type = REG_YUV;
     oci->clamp_type = RECON_CLAMP_REQUIRED;
 
--- a/vp8/common/onyx.h
+++ b/vp8/common/onyx.h
@@ -166,8 +166,6 @@
         int play_alternate;
         int alt_freq;
 
-        int multi_threaded;   // how many threads to run the encoder on
-        int token_partitions; // how many token partitions to create for multi core decoding
         int encode_breakout;  // early breakout encode threshold : for video conf recommend 800
 
         int arnr_max_frames;
--- a/vp8/common/onyxc_int.h
+++ b/vp8/common/onyxc_int.h
@@ -64,14 +64,6 @@
 
 typedef enum
 {
-    ONE_PARTITION  = 0,
-    TWO_PARTITION  = 1,
-    FOUR_PARTITION = 2,
-    EIGHT_PARTITION = 3
-} TOKEN_PARTITION;
-
-typedef enum
-{
     RECON_CLAMP_REQUIRED        = 0,
     RECON_CLAMP_NOTREQUIRED     = 1
 } CLAMP_TYPE;
@@ -258,8 +250,6 @@
     unsigned int current_video_frame;
     int near_boffset[3];
     int version;
-
-    TOKEN_PARTITION multi_token_partition;
 
 #ifdef PACKET_TESTING
     VP8_HEADER oh;
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -692,43 +692,6 @@
     return size;
 }
 
-static void setup_token_decoder_partition_input(VP8D_COMP *pbi)
-{
-    vp8_reader *bool_decoder = &pbi->bc2;
-    int part_idx = 1;
-    int num_token_partitions;
-
-    TOKEN_PARTITION multi_token_partition =
-            (TOKEN_PARTITION)vp8_read_literal(&pbi->bc, 2);
-    if (!vp8dx_bool_error(&pbi->bc))
-        pbi->common.multi_token_partition = multi_token_partition;
-    num_token_partitions = 1 << pbi->common.multi_token_partition;
-    if (num_token_partitions + 1 > pbi->num_partitions)
-        vpx_internal_error(&pbi->common.error, VPX_CODEC_CORRUPT_FRAME,
-                           "Partitions missing");
-    assert(vp8dx_bool_error(&pbi->bc) ||
-           multi_token_partition == pbi->common.multi_token_partition);
-    if (pbi->num_partitions > 2)
-    {
-        CHECK_MEM_ERROR(pbi->mbc, vpx_malloc((pbi->num_partitions - 1) *
-                                             sizeof(vp8_reader)));
-        bool_decoder = pbi->mbc;
-    }
-
-    for (; part_idx < pbi->num_partitions; ++part_idx)
-    {
-        if (vp8dx_start_decode(bool_decoder,
-                               pbi->partitions[part_idx],
-                               pbi->partition_sizes[part_idx]))
-            vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,
-                               "Failed to allocate bool decoder %d",
-                               part_idx);
-
-        bool_decoder++;
-    }
-}
-
-
 static int read_is_valid(const unsigned char *start,
                          size_t               len,
                          const unsigned char *end)
@@ -740,90 +703,39 @@
 static void setup_token_decoder(VP8D_COMP *pbi,
                                 const unsigned char *cx_data)
 {
-    int num_part;
-    int i;
     VP8_COMMON          *pc = &pbi->common;
     const unsigned char *user_data_end = pbi->Source + pbi->source_sz;
     vp8_reader          *bool_decoder;
     const unsigned char *partition;
 
-    /* Parse number of token partitions to use */
-    const TOKEN_PARTITION multi_token_partition =
-            (TOKEN_PARTITION)vp8_read_literal(&pbi->bc, 2);
-    /* Only update the multi_token_partition field if we are sure the value
-     * is correct. */
-    if (!vp8dx_bool_error(&pbi->bc))
-        pc->multi_token_partition = multi_token_partition;
+    ptrdiff_t            partition_size;
+    ptrdiff_t            bytes_left;
 
-    num_part = 1 << pc->multi_token_partition;
+    // Dummy read for now
+    vp8_read_literal(&pbi->bc, 2);
 
-    /* Set up pointers to the first partition */
+    // Set up pointers to token partition
     partition = cx_data;
     bool_decoder = &pbi->bc2;
+    bytes_left = user_data_end - partition;
+    partition_size = bytes_left;
 
-    if (num_part > 1)
+    /* Validate the calculated partition length. If the buffer
+     * described by the partition can't be fully read, then restrict
+     * it to the portion that can be (for EC mode) or throw an error.
+     */
+    if (!read_is_valid(partition, partition_size, user_data_end))
     {
-        CHECK_MEM_ERROR(pbi->mbc, vpx_malloc(num_part * sizeof(vp8_reader)));
-        bool_decoder = pbi->mbc;
-        partition += 3 * (num_part - 1);
+        vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME,
+                           "Truncated packet or corrupt partition "
+                           "%d length", 1);
     }
 
-    for (i = 0; i < num_part; i++)
-    {
-        const unsigned char *partition_size_ptr = cx_data + i * 3;
-        ptrdiff_t            partition_size, bytes_left;
-
-        bytes_left = user_data_end - partition;
-
-        /* Calculate the length of this partition. The last partition
-         * size is implicit. If the partition size can't be read, then
-         * either use the remaining data in the buffer (for EC mode)
-         * or throw an error.
-         */
-        if (i < num_part - 1)
-        {
-            if (read_is_valid(partition_size_ptr, 3, user_data_end))
-                partition_size = read_partition_size(partition_size_ptr);
-            else
-                vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME,
-                                   "Truncated partition size data");
-        }
-        else
-            partition_size = bytes_left;
-
-        /* Validate the calculated partition length. If the buffer
-         * described by the partition can't be fully read, then restrict
-         * it to the portion that can be (for EC mode) or throw an error.
-         */
-        if (!read_is_valid(partition, partition_size, user_data_end))
-        {
-            vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME,
-                               "Truncated packet or corrupt partition "
-                               "%d length", i + 1);
-        }
-
-        if (vp8dx_start_decode(bool_decoder, partition, partition_size))
-            vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR,
-                               "Failed to allocate bool decoder %d", i + 1);
-
-        /* Advance to the next partition */
-        partition += partition_size;
-        bool_decoder++;
-    }
+    if (vp8dx_start_decode(bool_decoder, partition, partition_size))
+        vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR,
+                           "Failed to allocate bool decoder %d", 1);
 }
 
-
-static void stop_token_decoder(VP8D_COMP *pbi)
-{
-    VP8_COMMON *pc = &pbi->common;
-
-    if (pc->multi_token_partition != ONE_PARTITION)
-    {
-        vpx_free(pbi->mbc);
-        pbi->mbc = NULL;
-    }
-}
-
 static void init_frame(VP8D_COMP *pbi)
 {
     VP8_COMMON *const pc = & pbi->common;
@@ -925,12 +837,6 @@
     int corrupt_tokens = 0;
     int prev_independent_partitions = pbi->independent_partitions;
 
-    if (pbi->input_partition)
-    {
-        data = pbi->partitions[0];
-        data_end =  data + pbi->partition_sizes[0];
-    }
-
     /* start with no corruption of current frame */
     xd->corrupted = 0;
     pc->yv12_fb[pc->new_fb_idx].corrupted = 0;
@@ -1218,14 +1124,8 @@
         }
     }
 
-    if (pbi->input_partition)
-    {
-        setup_token_decoder_partition_input(pbi);
-    }
-    else
-    {
-        setup_token_decoder(pbi, data + first_partition_length_in_bytes);
-    }
+    setup_token_decoder(pbi, data + first_partition_length_in_bytes);
+
     xd->current_bc = &pbi->bc2;
 
     /* Read the default quantizers. */
@@ -1390,47 +1290,22 @@
     // Resset the macroblock mode info context to the start of the list
     xd->mode_info_context = pc->mi;
 
-    {
-        int ibc = 0;
-        int num_part = 1 << pc->multi_token_partition;
-        pbi->frame_corrupt_residual = 0;
+    pbi->frame_corrupt_residual = 0;
 
 #if CONFIG_SUPERBLOCKS
-        /* Decode a row of super-blocks */
-        for (mb_row = 0; mb_row < pc->mb_rows; mb_row+=2)
-        {
-            if (num_part > 1)
-            {
-                xd->current_bc = & pbi->mbc[ibc];
-                ibc++;
-
-                if (ibc == num_part)
-                    ibc = 0;
-            }
-
-            decode_sb_row(pbi, pc, mb_row, xd);
-        }
+    /* Decode a row of super-blocks */
+    for (mb_row = 0; mb_row < pc->mb_rows; mb_row+=2)
+    {
+        decode_sb_row(pbi, pc, mb_row, xd);
+    }
 #else
-        /* Decode a row of macro blocks */
-        for (mb_row = 0; mb_row < pc->mb_rows; mb_row++)
-        {
-
-            if (num_part > 1)
-            {
-                xd->current_bc = & pbi->mbc[ibc];
-                ibc++;
-
-                if (ibc == num_part)
-                    ibc = 0;
-            }
-
-            decode_mb_row(pbi, pc, mb_row, xd);
-        }
-#endif /* CONFIG_SUPERBLOCKS */
-        corrupt_tokens |= xd->corrupted;
+    /* Decode a row of macro blocks */
+    for (mb_row = 0; mb_row < pc->mb_rows; mb_row++)
+    {
+        decode_mb_row(pbi, pc, mb_row, xd);
     }
-
-    stop_token_decoder(pbi);
+#endif /* CONFIG_SUPERBLOCKS */
+    corrupt_tokens |= xd->corrupted;
 
     /* Collect information about decoder corruption. */
     /* 1. Check first boolean decoder for errors. */
--- a/vp8/decoder/onyxd_if.c
+++ b/vp8/decoder/onyxd_if.c
@@ -161,7 +161,6 @@
 
     pbi->decoded_key_frame = 0;
 
-    pbi->input_partition = oxcf->input_partition;
 
     /* Independent partitions is activated when a frame updates the
      * token probability table to have equal probabilities over the
@@ -383,101 +382,55 @@
 
     pbi->common.error.error_code = VPX_CODEC_OK;
 
-    if (pbi->input_partition && !(source == NULL && size == 0))
+    pbi->Source = source;
+    pbi->source_sz = size;
+
+    if (pbi->source_sz == 0)
     {
-        /* Store a pointer to this partition and return. We haven't
-         * received the complete frame yet, so we will wait with decoding.
-         */
-        assert(pbi->num_partitions < MAX_PARTITIONS);
-        pbi->partitions[pbi->num_partitions] = source;
-        pbi->partition_sizes[pbi->num_partitions] = size;
-        pbi->source_sz += size;
-        pbi->num_partitions++;
-        if (pbi->num_partitions > (1 << EIGHT_PARTITION) + 1)
-        {
-            pbi->common.error.error_code = VPX_CODEC_UNSUP_BITSTREAM;
-            pbi->common.error.setjmp = 0;
-            pbi->num_partitions = 0;
-            return -1;
-        }
-        return 0;
+       /* This is used to signal that we are missing frames.
+        * We do not know if the missing frame(s) was supposed to update
+        * any of the reference buffers, but we act conservative and
+        * mark only the last buffer as corrupted.
+        */
+        cm->yv12_fb[cm->lst_fb_idx].corrupted = 1;
     }
-    else
-    {
-        if (!pbi->input_partition)
-        {
-            pbi->Source = source;
-            pbi->source_sz = size;
-        }
-        else
-        {
-            assert(pbi->common.multi_token_partition <= EIGHT_PARTITION);
-            if (pbi->num_partitions == 0)
-            {
-                pbi->num_partitions = 1;
-                pbi->partitions[0] = NULL;
-                pbi->partition_sizes[0] = 0;
-            }
-            while (pbi->num_partitions < (1 << pbi->common.multi_token_partition) + 1)
-            {
-                // Reset all missing partitions
-                pbi->partitions[pbi->num_partitions] =
-                    pbi->partitions[pbi->num_partitions - 1] +
-                    pbi->partition_sizes[pbi->num_partitions - 1];
-                pbi->partition_sizes[pbi->num_partitions] = 0;
-                pbi->num_partitions++;
-            }
-        }
 
-        if (pbi->source_sz == 0)
-        {
-           /* This is used to signal that we are missing frames.
-            * We do not know if the missing frame(s) was supposed to update
-            * any of the reference buffers, but we act conservative and
-            * mark only the last buffer as corrupted.
-            */
-            cm->yv12_fb[cm->lst_fb_idx].corrupted = 1;
-        }
-
 #if HAVE_ARMV7
 #if CONFIG_RUNTIME_CPU_DETECT
-        if (cm->rtcd.flags & HAS_NEON)
+    if (cm->rtcd.flags & HAS_NEON)
 #endif
-        {
-            vp8_push_neon(dx_store_reg);
-        }
+    {
+        vp8_push_neon(dx_store_reg);
+    }
 #endif
 
-        cm->new_fb_idx = get_free_fb (cm);
+    cm->new_fb_idx = get_free_fb (cm);
 
-        if (setjmp(pbi->common.error.jmp))
-        {
+    if (setjmp(pbi->common.error.jmp))
+    {
 #if HAVE_ARMV7
 #if CONFIG_RUNTIME_CPU_DETECT
-            if (cm->rtcd.flags & HAS_NEON)
+        if (cm->rtcd.flags & HAS_NEON)
 #endif
-            {
-                vp8_pop_neon(dx_store_reg);
-            }
+        {
+            vp8_pop_neon(dx_store_reg);
+        }
 #endif
-            pbi->common.error.setjmp = 0;
+        pbi->common.error.setjmp = 0;
 
-            pbi->num_partitions = 0;
+       /* We do not know if the missing frame(s) was supposed to update
+        * any of the reference buffers, but we act conservative and
+        * mark only the last buffer as corrupted.
+        */
+        cm->yv12_fb[cm->lst_fb_idx].corrupted = 1;
 
-           /* We do not know if the missing frame(s) was supposed to update
-            * any of the reference buffers, but we act conservative and
-            * mark only the last buffer as corrupted.
-            */
-            cm->yv12_fb[cm->lst_fb_idx].corrupted = 1;
-
-            if (cm->fb_idx_ref_cnt[cm->new_fb_idx] > 0)
-              cm->fb_idx_ref_cnt[cm->new_fb_idx]--;
-            return -1;
-        }
-
-        pbi->common.error.setjmp = 1;
+        if (cm->fb_idx_ref_cnt[cm->new_fb_idx] > 0)
+          cm->fb_idx_ref_cnt[cm->new_fb_idx]--;
+        return -1;
     }
 
+    pbi->common.error.setjmp = 1;
+
     retcode = vp8_decode_frame(pbi);
 
     if (retcode < 0)
@@ -492,7 +445,6 @@
 #endif
         pbi->common.error.error_code = VPX_CODEC_ERROR;
         pbi->common.error.setjmp = 0;
-        pbi->num_partitions = 0;
         if (cm->fb_idx_ref_cnt[cm->new_fb_idx] > 0)
           cm->fb_idx_ref_cnt[cm->new_fb_idx]--;
         return retcode;
@@ -511,7 +463,6 @@
 #endif
             pbi->common.error.error_code = VPX_CODEC_ERROR;
             pbi->common.error.setjmp = 0;
-            pbi->num_partitions = 0;
             return -1;
         }
 
@@ -556,7 +507,6 @@
 
     pbi->ready_for_new_data = 0;
     pbi->last_time_stamp = time_stamp;
-    pbi->num_partitions = 0;
     pbi->source_sz = 0;
 
 #if 0
--- a/vp8/decoder/onyxd_int.h
+++ b/vp8/decoder/onyxd_int.h
@@ -100,7 +100,6 @@
 
     vp8_prob prob_skip_false;
 
-    int input_partition;
     int decoded_key_frame;
     int independent_partitions;
     int frame_corrupt_residual;
--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -353,415 +353,6 @@
 
 }
 
-static void pack_tokens_into_partitions_c(VP8_COMP *cpi, unsigned char *cx_data, int num_part, int *size)
-{
-
-    int i;
-    unsigned char *ptr = cx_data;
-    unsigned int shift;
-    vp8_writer *w = &cpi->bc2;
-    *size = 3 * (num_part - 1);
-    cpi->partition_sz[0] += *size;
-    ptr = cx_data + (*size);
-
-    for (i = 0; i < num_part; i++)
-    {
-        vp8_start_encode(w, ptr);
-        {
-            unsigned int split;
-            int count = w->count;
-            unsigned int range = w->range;
-            unsigned int lowvalue = w->lowvalue;
-            int mb_row;
-
-            for (mb_row = i; mb_row < cpi->common.mb_rows; mb_row += num_part)
-            {
-                TOKENEXTRA *p    = cpi->tplist[mb_row].start;
-                TOKENEXTRA *stop = cpi->tplist[mb_row].stop;
-
-                while (p < stop)
-                {
-                    const int t = p->Token;
-                    vp8_token *const a = vp8_coef_encodings + t;
-                    const vp8_extra_bit_struct *const b = vp8_extra_bits + t;
-                    int i = 0;
-                    const unsigned char *pp = p->context_tree;
-                    int v = a->value;
-                    int n = a->Len;
-
-                    if (p->skip_eob_node)
-                    {
-                        n--;
-                        i = 2;
-                    }
-
-                    do
-                    {
-                        const int bb = (v >> --n) & 1;
-                        split = 1 + (((range - 1) * pp[i>>1]) >> 8);
-                        i = vp8_coef_tree[i+bb];
-
-                        if (bb)
-                        {
-                            lowvalue += split;
-                            range = range - split;
-                        }
-                        else
-                        {
-                            range = split;
-                        }
-
-                        shift = vp8_norm[range];
-                        range <<= shift;
-                        count += shift;
-
-                        if (count >= 0)
-                        {
-                            int offset = shift - count;
-
-                            if ((lowvalue << (offset - 1)) & 0x80000000)
-                            {
-                                int x = w->pos - 1;
-
-                                while (x >= 0 && w->buffer[x] == 0xff)
-                                {
-                                    w->buffer[x] = (unsigned char)0;
-                                    x--;
-                                }
-
-                                w->buffer[x] += 1;
-                            }
-
-                            w->buffer[w->pos++] = (lowvalue >> (24 - offset));
-                            lowvalue <<= offset;
-                            shift = count;
-                            lowvalue &= 0xffffff;
-                            count -= 8 ;
-                        }
-
-                        lowvalue <<= shift;
-                    }
-                    while (n);
-
-
-                    if (b->base_val)
-                    {
-                        const int e = p->Extra, L = b->Len;
-
-                        if (L)
-                        {
-                            const unsigned char *pp = b->prob;
-                            int v = e >> 1;
-                            int n = L;              /* number of bits in v, assumed nonzero */
-                            int i = 0;
-
-                            do
-                            {
-                                const int bb = (v >> --n) & 1;
-                                split = 1 + (((range - 1) * pp[i>>1]) >> 8);
-                                i = b->tree[i+bb];
-
-                                if (bb)
-                                {
-                                    lowvalue += split;
-                                    range = range - split;
-                                }
-                                else
-                                {
-                                    range = split;
-                                }
-
-                                shift = vp8_norm[range];
-                                range <<= shift;
-                                count += shift;
-
-                                if (count >= 0)
-                                {
-                                    int offset = shift - count;
-
-                                    if ((lowvalue << (offset - 1)) & 0x80000000)
-                                    {
-                                        int x = w->pos - 1;
-
-                                        while (x >= 0 && w->buffer[x] == 0xff)
-                                        {
-                                            w->buffer[x] = (unsigned char)0;
-                                            x--;
-                                        }
-
-                                        w->buffer[x] += 1;
-                                    }
-
-                                    w->buffer[w->pos++] = (lowvalue >> (24 - offset));
-                                    lowvalue <<= offset;
-                                    shift = count;
-                                    lowvalue &= 0xffffff;
-                                    count -= 8 ;
-                                }
-
-                                lowvalue <<= shift;
-                            }
-                            while (n);
-                        }
-
-                        {
-                            split = (range + 1) >> 1;
-
-                            if (e & 1)
-                            {
-                                lowvalue += split;
-                                range = range - split;
-                            }
-                            else
-                            {
-                                range = split;
-                            }
-
-                            range <<= 1;
-
-                            if ((lowvalue & 0x80000000))
-                            {
-                                int x = w->pos - 1;
-
-                                while (x >= 0 && w->buffer[x] == 0xff)
-                                {
-                                    w->buffer[x] = (unsigned char)0;
-                                    x--;
-                                }
-
-                                w->buffer[x] += 1;
-
-                            }
-
-                            lowvalue  <<= 1;
-
-                            if (!++count)
-                            {
-                                count = -8;
-                                w->buffer[w->pos++] = (lowvalue >> 24);
-                                lowvalue &= 0xffffff;
-                            }
-                        }
-
-                    }
-
-                    ++p;
-                }
-            }
-
-            w->count    = count;
-            w->lowvalue = lowvalue;
-            w->range    = range;
-
-        }
-
-        vp8_stop_encode(w);
-        *size +=   w->pos;
-
-        /* The first partition size is set earlier */
-        cpi->partition_sz[i + 1] = w->pos;
-
-        if (i < (num_part - 1))
-        {
-            write_partition_size(cx_data, w->pos);
-            cx_data += 3;
-            ptr += w->pos;
-        }
-    }
-}
-
-
-static void pack_mb_row_tokens_c(VP8_COMP *cpi, vp8_writer *w)
-{
-
-    unsigned int split;
-    int count = w->count;
-    unsigned int range = w->range;
-    unsigned int lowvalue = w->lowvalue;
-    unsigned int shift;
-    int mb_row;
-
-    for (mb_row = 0; mb_row < cpi->common.mb_rows; mb_row++)
-    {
-        TOKENEXTRA *p    = cpi->tplist[mb_row].start;
-        TOKENEXTRA *stop = cpi->tplist[mb_row].stop;
-
-        while (p < stop)
-        {
-            const int t = p->Token;
-            vp8_token *const a = vp8_coef_encodings + t;
-            const vp8_extra_bit_struct *const b = vp8_extra_bits + t;
-            int i = 0;
-            const unsigned char *pp = p->context_tree;
-            int v = a->value;
-            int n = a->Len;
-
-            if (p->skip_eob_node)
-            {
-                n--;
-                i = 2;
-            }
-
-            do
-            {
-                const int bb = (v >> --n) & 1;
-                split = 1 + (((range - 1) * pp[i>>1]) >> 8);
-                i = vp8_coef_tree[i+bb];
-
-                if (bb)
-                {
-                    lowvalue += split;
-                    range = range - split;
-                }
-                else
-                {
-                    range = split;
-                }
-
-                shift = vp8_norm[range];
-                range <<= shift;
-                count += shift;
-
-                if (count >= 0)
-                {
-                    int offset = shift - count;
-
-                    if ((lowvalue << (offset - 1)) & 0x80000000)
-                    {
-                        int x = w->pos - 1;
-
-                        while (x >= 0 && w->buffer[x] == 0xff)
-                        {
-                            w->buffer[x] = (unsigned char)0;
-                            x--;
-                        }
-
-                        w->buffer[x] += 1;
-                    }
-
-                    w->buffer[w->pos++] = (lowvalue >> (24 - offset));
-                    lowvalue <<= offset;
-                    shift = count;
-                    lowvalue &= 0xffffff;
-                    count -= 8 ;
-                }
-
-                lowvalue <<= shift;
-            }
-            while (n);
-
-
-            if (b->base_val)
-            {
-                const int e = p->Extra, L = b->Len;
-
-                if (L)
-                {
-                    const unsigned char *pp = b->prob;
-                    int v = e >> 1;
-                    int n = L;              /* number of bits in v, assumed nonzero */
-                    int i = 0;
-
-                    do
-                    {
-                        const int bb = (v >> --n) & 1;
-                        split = 1 + (((range - 1) * pp[i>>1]) >> 8);
-                        i = b->tree[i+bb];
-
-                        if (bb)
-                        {
-                            lowvalue += split;
-                            range = range - split;
-                        }
-                        else
-                        {
-                            range = split;
-                        }
-
-                        shift = vp8_norm[range];
-                        range <<= shift;
-                        count += shift;
-
-                        if (count >= 0)
-                        {
-                            int offset = shift - count;
-
-                            if ((lowvalue << (offset - 1)) & 0x80000000)
-                            {
-                                int x = w->pos - 1;
-
-                                while (x >= 0 && w->buffer[x] == 0xff)
-                                {
-                                    w->buffer[x] = (unsigned char)0;
-                                    x--;
-                                }
-
-                                w->buffer[x] += 1;
-                            }
-
-                            w->buffer[w->pos++] = (lowvalue >> (24 - offset));
-                            lowvalue <<= offset;
-                            shift = count;
-                            lowvalue &= 0xffffff;
-                            count -= 8 ;
-                        }
-
-                        lowvalue <<= shift;
-                    }
-                    while (n);
-                }
-
-                {
-                    split = (range + 1) >> 1;
-
-                    if (e & 1)
-                    {
-                        lowvalue += split;
-                        range = range - split;
-                    }
-                    else
-                    {
-                        range = split;
-                    }
-
-                    range <<= 1;
-
-                    if ((lowvalue & 0x80000000))
-                    {
-                        int x = w->pos - 1;
-
-                        while (x >= 0 && w->buffer[x] == 0xff)
-                        {
-                            w->buffer[x] = (unsigned char)0;
-                            x--;
-                        }
-
-                        w->buffer[x] += 1;
-
-                    }
-
-                    lowvalue  <<= 1;
-
-                    if (!++count)
-                    {
-                        count = -8;
-                        w->buffer[w->pos++] = (lowvalue >> 24);
-                        lowvalue &= 0xffffff;
-                    }
-                }
-
-            }
-
-            ++p;
-        }
-    }
-
-    w->count = count;
-    w->lowvalue = lowvalue;
-    w->range = range;
-
-}
-
 static void write_mv_ref
 (
     vp8_writer *w, MB_PREDICTION_MODE m, const vp8_prob *p
@@ -2776,7 +2367,8 @@
     }
 
     //signal here is multi token partition is enabled
-    vp8_write_literal(bc, pc->multi_token_partition, 2);
+    //vp8_write_literal(bc, pc->multi_token_partition, 2);
+    vp8_write_literal(bc, 0, 2);
 
     // Frame Q baseline quantizer index
     vp8_write_literal(bc, pc->base_qindex, QINDEX_BITS);
@@ -2878,27 +2470,14 @@
     *size = VP8_HEADER_SIZE + extra_bytes_packed + cpi->bc.pos;
     cpi->partition_sz[0] = *size;
 
-    if (pc->multi_token_partition != ONE_PARTITION)
-    {
-        int num_part;
-        int asize;
-        num_part = 1 << pc->multi_token_partition;
+    vp8_start_encode(&cpi->bc2, cx_data + bc->pos);
 
-        pack_tokens_into_partitions(cpi, cx_data + bc->pos, num_part, &asize);
+    pack_tokens(&cpi->bc2, cpi->tok, cpi->tok_count);
 
-        *size += asize;
-    }
-    else
-    {
-        vp8_start_encode(&cpi->bc2, cx_data + bc->pos);
+    vp8_stop_encode(&cpi->bc2);
 
-        pack_tokens(&cpi->bc2, cpi->tok, cpi->tok_count);
-
-        vp8_stop_encode(&cpi->bc2);
-
-        *size += cpi->bc2.pos;
-        cpi->partition_sz[1] = cpi->bc2.pos;
-    }
+    *size += cpi->bc2.pos;
+    cpi->partition_sz[1] = cpi->bc2.pos;
 }
 
 #ifdef ENTROPY_STATS
--- a/vp8/encoder/bitstream.h
+++ b/vp8/encoder/bitstream.h
@@ -17,23 +17,9 @@
                              vp8_token *,
                              vp8_extra_bit_struct *,
                              const vp8_tree_index *);
-void vp8cx_pack_tokens_into_partitions_armv5(VP8_COMP *, unsigned char *, int , int *,
-        vp8_token *,
-        vp8_extra_bit_struct *,
-        const vp8_tree_index *);
-void vp8cx_pack_mb_row_tokens_armv5(VP8_COMP *cpi, vp8_writer *w,
-                                    vp8_token *,
-                                    vp8_extra_bit_struct *,
-                                    const vp8_tree_index *);
 # define pack_tokens(a,b,c)                  \
     vp8cx_pack_tokens_armv5(a,b,c,vp8_coef_encodings,vp8_extra_bits,vp8_coef_tree)
-# define pack_tokens_into_partitions(a,b,c,d)  \
-    vp8cx_pack_tokens_into_partitions_armv5(a,b,c,d,vp8_coef_encodings,vp8_extra_bits,vp8_coef_tree)
-# define pack_mb_row_tokens(a,b)               \
-    vp8cx_pack_mb_row_tokens_armv5(a,b,vp8_coef_encodings,vp8_extra_bits,vp8_coef_tree)
 #else
 # define pack_tokens(a,b,c)                  pack_tokens_c(a,b,c)
-# define pack_tokens_into_partitions(a,b,c,d)  pack_tokens_into_partitions_c(a,b,c,d)
-# define pack_mb_row_tokens(a,b)               pack_mb_row_tokens_c(a,b)
 #endif
 #endif
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -1332,10 +1332,6 @@
     cm->refresh_last_frame = 1;
     cm->refresh_entropy_probs = 1;
 
-    if (cpi->oxcf.token_partitions >= 0 && cpi->oxcf.token_partitions <= 3)
-        cm->multi_token_partition =
-            (TOKEN_PARTITION) cpi->oxcf.token_partitions;
-
     setup_features(cpi);
 #if CONFIG_HIGH_PRECISION_MV
     cpi->mb.e_mbd.allow_high_precision_mv = 1;   // Default mv precision adaptation
--- a/vp8/vp8_cx_iface.c
+++ b/vp8/vp8_cx_iface.c
@@ -229,7 +229,6 @@
                                        vpx_codec_enc_cfg_t cfg,
                                        struct vp8_extracfg vp8_cfg)
 {
-    oxcf->multi_threaded         = cfg.g_threads;
     oxcf->Version               = cfg.g_profile;    
     oxcf->Version              |= vp8_cfg.experimental? 0x4 : 0;
 
@@ -308,7 +307,6 @@
     oxcf->play_alternate         =  vp8_cfg.enable_auto_alt_ref;
     oxcf->noise_sensitivity      =  vp8_cfg.noise_sensitivity;
     oxcf->Sharpness             =  vp8_cfg.Sharpness;
-    oxcf->token_partitions       =  vp8_cfg.token_partitions;
 
     oxcf->two_pass_stats_in        =  cfg.rc_twopass_stats_in;
     oxcf->output_pkt_list         =  vp8_cfg.pkt_list;
@@ -345,7 +343,6 @@
         printf("lag_in_frames: %d\n", oxcf->lag_in_frames);
         printf("play_alternate: %d\n", oxcf->play_alternate);
         printf("Version: %d\n", oxcf->Version);
-        printf("multi_threaded: %d\n",   oxcf->multi_threaded);
         printf("encode_breakout: %d\n", oxcf->encode_breakout);
     */
     return VPX_CODEC_OK;
@@ -688,8 +685,8 @@
         if (ctx->base.init_flags & VPX_CODEC_USE_PSNR)
             ((VP8_COMP *)ctx->cpi)->b_calculate_psnr = 1;
 
-        if (ctx->base.init_flags & VPX_CODEC_USE_OUTPUT_PARTITION)
-            ((VP8_COMP *)ctx->cpi)->output_partition = 1;
+        //if (ctx->base.init_flags & VPX_CODEC_USE_OUTPUT_PARTITION)
+        //    ((VP8_COMP *)ctx->cpi)->output_partition = 1;
 
         /* Convert API flags to internal codec lib flags */
         lib_flags = (flags & VPX_EFLAG_FORCE_KF) ? FRAMEFLAGS_KEY : 0;
@@ -758,11 +755,10 @@
                 if (cpi->droppable)
                     pkt.data.frame.flags |= VPX_FRAME_IS_DROPPABLE;
 
-                if (cpi->output_partition)
+                /*if (cpi->output_partition)
                 {
                     int i;
-                    const int num_partitions =
-                            (1 << cpi->common.multi_token_partition) + 1;
+                    const int num_partitions = 1;
 
                     pkt.data.frame.flags |= VPX_FRAME_IS_FRAGMENT;
 
@@ -771,7 +767,7 @@
                         pkt.data.frame.buf = cx_data;
                         pkt.data.frame.sz = cpi->partition_sz[i];
                         pkt.data.frame.partition_id = i;
-                        /* don't set the fragment bit for the last partition */
+                        // don't set the fragment bit for the last partition
                         if (i == (num_partitions - 1))
                             pkt.data.frame.flags &= ~VPX_FRAME_IS_FRAGMENT;
                         vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt);
@@ -779,7 +775,7 @@
                         cx_data_sz -= cpi->partition_sz[i];
                     }
                 }
-                else
+                else*/
                 {
                     pkt.data.frame.buf = cx_data;
                     pkt.data.frame.sz  = size;
--- a/vp8/vp8_dx_iface.c
+++ b/vp8/vp8_dx_iface.c
@@ -393,9 +393,6 @@
             oxcf.Version = 9;
             oxcf.postprocess = 0;
             oxcf.max_threads = ctx->cfg.threads;
-            oxcf.input_partition =
-                    (ctx->base.init_flags & VPX_CODEC_USE_INPUT_PARTITION);
-
             optr = vp8dx_create_decompressor(&oxcf);
 
             /* If postprocessing was enabled by the application and a