• Attila Nagy's avatar
    Shares one set of RD costs tables between all encoding threads · b41c17d6
    Attila Nagy authored
    RD costs were local to MACROBLOCK data and had to be copied all the
    time to each thread's MACROBLOCK data. Tables moved to a common place
    and only pointers are setup for each encoding thread.
    
    vp8_cost_tokens() generates 'int' costs so changed all types to be
    int (i.e. removed unsigned).
    
    NOTE: Could do some more cleaning in vp8cx_init_mbrthread_data().
    
    Change-Id: Ifa4de4c6286dffaca7ed3082041fe5af1345ddc0
    b41c17d6
modecosts.c 1.60 KiB
/*
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */
#include "vp8/common/blockd.h"
#include "onyx_int.h"
#include "treewriter.h"
#include "vp8/common/entropymode.h"
void vp8_init_mode_costs(VP8_COMP *c)
    VP8_COMMON *x = &c->common;
    struct rd_costs_struct *rd_costs = &c->rd_costs;
        const vp8_tree_p T = vp8_bmode_tree;
        int i = 0;
            int j = 0;
                vp8_cost_tokens(rd_costs->bmode_costs[i][j],
                                vp8_kf_bmode_prob[i][j], T);
            while (++j < VP8_BINTRAMODES);
        while (++i < VP8_BINTRAMODES);
        vp8_cost_tokens(rd_costs->inter_bmode_costs, x->fc.bmode_prob, T);
    vp8_cost_tokens(rd_costs->inter_bmode_costs, x->fc.sub_mv_ref_prob,
                    vp8_sub_mv_ref_tree);
    vp8_cost_tokens(rd_costs->mbmode_cost[1], x->fc.ymode_prob, vp8_ymode_tree);
    vp8_cost_tokens(rd_costs->mbmode_cost[0], vp8_kf_ymode_prob,
                    vp8_kf_ymode_tree);
    vp8_cost_tokens(rd_costs->intra_uv_mode_cost[1], x->fc.uv_mode_prob,
                    vp8_uv_mode_tree);
    vp8_cost_tokens(rd_costs->intra_uv_mode_cost[0], vp8_kf_uv_mode_prob,
                    vp8_uv_mode_tree);