• Jim Bankoski's avatar
    add a context tree structure to encoder · e890c257
    Jim Bankoski authored
    This patch sets up a quad_tree structure (pc_tree) for holding all of
    pick_mode_context data we use at any square block size during encoding
    or picking modes.  That includes contexts for 2 horizontal and 2 vertical
    splits, one none, and pointers to 4 sub pc_tree nodes corresponding
    to split.  It also includes a pointer to the current chosen partitioning.
    
    This replaces code that held an index for every level in the pick
    modes array including:  sb_index, mb_index,
    b_index, ab_index.
    
    These were used as stateful indexes that pointed to the current pick mode
    contexts you had at each level stored in the following arrays
    
    array ab4x4_context[][][],
    sb8x4_context[][][], sb4x8_context[][][], sb8x8_context[][][],
    sb8x16_context[][][], sb16x8_context[][][], mb_context[][], sb32x16[][],
    sb16x32[],  sb32_context[], sb32x64_context[], sb64x32_context[],
    sb64_context
    
    and the partitioning that had been stored in the following:
    b_partitioning, mb_partitioning, sb_partitioning, and sb64_partitioning.
    
    Prior to this patch before doing an encode you had to set the appropriate
    index for your block size ( switch statement),  update it ( up to 3
    lookups for the index array value) and then make your call into a recursive
    function at which point you'd have to call get_context which then
    had to do a switch statement based on the blocksize,  and then up to 3
    lookups based upon the block size to find the context to use.
    
    With the new code the context for the block size is passed around directly
    avoiding the extraneous switch statements and multi dimensional array
    look ups that were listed above.   At any level in the search all of the
    contexts are local to the pc_tree you are working on (in?).
    
    In addition in most places code that used to call sub functions and
    then check if the block size was 4x4 and index was > 0 and return
    now don't preferring instead to call the right none function on the inside.
    
    
    
    Change-Id: I06e39318269d9af2ce37961b3f95e181b57f5ed9
    e890c257