Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
michael@0 | 3 | * |
michael@0 | 4 | * Use of this source code is governed by a BSD-style license |
michael@0 | 5 | * that can be found in the LICENSE file in the root of the source |
michael@0 | 6 | * tree. An additional intellectual property rights grant can be found |
michael@0 | 7 | * in the file PATENTS. All contributing project authors may |
michael@0 | 8 | * be found in the AUTHORS file in the root of the source tree. |
michael@0 | 9 | */ |
michael@0 | 10 | |
michael@0 | 11 | |
michael@0 | 12 | #ifndef __INC_RDOPT_H |
michael@0 | 13 | #define __INC_RDOPT_H |
michael@0 | 14 | |
michael@0 | 15 | #define RDCOST(RM,DM,R,D) ( ((128+(R)*(RM)) >> 8) + (DM)*(D) ) |
michael@0 | 16 | |
michael@0 | 17 | static void insertsortmv(int arr[], int len) |
michael@0 | 18 | { |
michael@0 | 19 | int i, j, k; |
michael@0 | 20 | |
michael@0 | 21 | for ( i = 1 ; i <= len-1 ; i++ ) |
michael@0 | 22 | { |
michael@0 | 23 | for ( j = 0 ; j < i ; j++ ) |
michael@0 | 24 | { |
michael@0 | 25 | if ( arr[j] > arr[i] ) |
michael@0 | 26 | { |
michael@0 | 27 | int temp; |
michael@0 | 28 | |
michael@0 | 29 | temp = arr[i]; |
michael@0 | 30 | |
michael@0 | 31 | for ( k = i; k >j; k--) |
michael@0 | 32 | arr[k] = arr[k - 1] ; |
michael@0 | 33 | |
michael@0 | 34 | arr[j] = temp ; |
michael@0 | 35 | } |
michael@0 | 36 | } |
michael@0 | 37 | } |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | static void insertsortsad(int arr[],int idx[], int len) |
michael@0 | 41 | { |
michael@0 | 42 | int i, j, k; |
michael@0 | 43 | |
michael@0 | 44 | for ( i = 1 ; i <= len-1 ; i++ ) |
michael@0 | 45 | { |
michael@0 | 46 | for ( j = 0 ; j < i ; j++ ) |
michael@0 | 47 | { |
michael@0 | 48 | if ( arr[j] > arr[i] ) |
michael@0 | 49 | { |
michael@0 | 50 | int temp, tempi; |
michael@0 | 51 | |
michael@0 | 52 | temp = arr[i]; |
michael@0 | 53 | tempi = idx[i]; |
michael@0 | 54 | |
michael@0 | 55 | for ( k = i; k >j; k--) |
michael@0 | 56 | { |
michael@0 | 57 | arr[k] = arr[k - 1] ; |
michael@0 | 58 | idx[k] = idx[k - 1]; |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | arr[j] = temp ; |
michael@0 | 62 | idx[j] = tempi; |
michael@0 | 63 | } |
michael@0 | 64 | } |
michael@0 | 65 | } |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | extern void vp8_initialize_rd_consts(VP8_COMP *cpi, MACROBLOCK *x, int Qvalue); |
michael@0 | 69 | extern void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int recon_uvoffset, int *returnrate, int *returndistortion, int *returnintra); |
michael@0 | 70 | extern void vp8_rd_pick_intra_mode(MACROBLOCK *x, int *rate); |
michael@0 | 71 | |
michael@0 | 72 | |
michael@0 | 73 | static void get_plane_pointers(const YV12_BUFFER_CONFIG *fb, |
michael@0 | 74 | unsigned char *plane[3], |
michael@0 | 75 | unsigned int recon_yoffset, |
michael@0 | 76 | unsigned int recon_uvoffset) |
michael@0 | 77 | { |
michael@0 | 78 | plane[0] = fb->y_buffer + recon_yoffset; |
michael@0 | 79 | plane[1] = fb->u_buffer + recon_uvoffset; |
michael@0 | 80 | plane[2] = fb->v_buffer + recon_uvoffset; |
michael@0 | 81 | } |
michael@0 | 82 | |
michael@0 | 83 | |
michael@0 | 84 | static void get_predictor_pointers(const VP8_COMP *cpi, |
michael@0 | 85 | unsigned char *plane[4][3], |
michael@0 | 86 | unsigned int recon_yoffset, |
michael@0 | 87 | unsigned int recon_uvoffset) |
michael@0 | 88 | { |
michael@0 | 89 | if (cpi->ref_frame_flags & VP8_LAST_FRAME) |
michael@0 | 90 | get_plane_pointers(&cpi->common.yv12_fb[cpi->common.lst_fb_idx], |
michael@0 | 91 | plane[LAST_FRAME], recon_yoffset, recon_uvoffset); |
michael@0 | 92 | |
michael@0 | 93 | if (cpi->ref_frame_flags & VP8_GOLD_FRAME) |
michael@0 | 94 | get_plane_pointers(&cpi->common.yv12_fb[cpi->common.gld_fb_idx], |
michael@0 | 95 | plane[GOLDEN_FRAME], recon_yoffset, recon_uvoffset); |
michael@0 | 96 | |
michael@0 | 97 | if (cpi->ref_frame_flags & VP8_ALTR_FRAME) |
michael@0 | 98 | get_plane_pointers(&cpi->common.yv12_fb[cpi->common.alt_fb_idx], |
michael@0 | 99 | plane[ALTREF_FRAME], recon_yoffset, recon_uvoffset); |
michael@0 | 100 | } |
michael@0 | 101 | |
michael@0 | 102 | |
michael@0 | 103 | static void get_reference_search_order(const VP8_COMP *cpi, |
michael@0 | 104 | int ref_frame_map[4]) |
michael@0 | 105 | { |
michael@0 | 106 | int i=0; |
michael@0 | 107 | |
michael@0 | 108 | ref_frame_map[i++] = INTRA_FRAME; |
michael@0 | 109 | if (cpi->ref_frame_flags & VP8_LAST_FRAME) |
michael@0 | 110 | ref_frame_map[i++] = LAST_FRAME; |
michael@0 | 111 | if (cpi->ref_frame_flags & VP8_GOLD_FRAME) |
michael@0 | 112 | ref_frame_map[i++] = GOLDEN_FRAME; |
michael@0 | 113 | if (cpi->ref_frame_flags & VP8_ALTR_FRAME) |
michael@0 | 114 | ref_frame_map[i++] = ALTREF_FRAME; |
michael@0 | 115 | for(; i<4; i++) |
michael@0 | 116 | ref_frame_map[i] = -1; |
michael@0 | 117 | } |
michael@0 | 118 | |
michael@0 | 119 | |
michael@0 | 120 | extern void vp8_mv_pred |
michael@0 | 121 | ( |
michael@0 | 122 | VP8_COMP *cpi, |
michael@0 | 123 | MACROBLOCKD *xd, |
michael@0 | 124 | const MODE_INFO *here, |
michael@0 | 125 | int_mv *mvp, |
michael@0 | 126 | int refframe, |
michael@0 | 127 | int *ref_frame_sign_bias, |
michael@0 | 128 | int *sr, |
michael@0 | 129 | int near_sadidx[] |
michael@0 | 130 | ); |
michael@0 | 131 | void vp8_cal_sad(VP8_COMP *cpi, MACROBLOCKD *xd, MACROBLOCK *x, int recon_yoffset, int near_sadidx[]); |
michael@0 | 132 | |
michael@0 | 133 | #endif |