vp8: use VPX(MIN|MAX) from vpx_dsp_common.h
remove MIN/MAX defines in vp8/common/common.h Change-Id: I41520f34af175e05b263ebd12198f4de29a967db
This commit is contained in:
parent
5c245a46d8
commit
820302a394
@ -22,9 +22,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
||||
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
||||
|
||||
/* Only need this for fixed-size arrays, for structs just assign. */
|
||||
|
||||
#define vp8_copy( Dest, Src) { \
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include "dboolhuff.h"
|
||||
#include "vp8/common/common.h"
|
||||
#include "vpx_dsp/vpx_dsp_common.h"
|
||||
|
||||
int vp8dx_start_decode(BOOL_DECODER *br,
|
||||
const unsigned char *source,
|
||||
@ -48,7 +49,7 @@ void vp8dx_bool_decoder_fill(BOOL_DECODER *br)
|
||||
unsigned char decrypted[sizeof(VP8_BD_VALUE) + 1];
|
||||
|
||||
if (br->decrypt_cb) {
|
||||
size_t n = MIN(sizeof(decrypted), bytes_left);
|
||||
size_t n = VPXMIN(sizeof(decrypted), bytes_left);
|
||||
br->decrypt_cb(br->decrypt_state, bufptr, decrypted, (int)n);
|
||||
bufptr = decrypted;
|
||||
}
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "vp8/common/threading.h"
|
||||
#include "decoderthreading.h"
|
||||
#include "dboolhuff.h"
|
||||
#include "vpx_dsp/vpx_dsp_common.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
@ -1021,7 +1022,7 @@ int vp8_decode_frame(VP8D_COMP *pbi)
|
||||
const unsigned char *clear = data;
|
||||
if (pbi->decrypt_cb)
|
||||
{
|
||||
int n = (int)MIN(sizeof(clear_buffer), data_end - data);
|
||||
int n = (int)VPXMIN(sizeof(clear_buffer), data_end - data);
|
||||
pbi->decrypt_cb(pbi->decrypt_state, data, clear_buffer, n);
|
||||
clear = clear_buffer;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
#include "vp8/common/findnearmv.h"
|
||||
#include "vp8/common/common.h"
|
||||
#include "vpx_dsp/vpx_dsp_common.h"
|
||||
|
||||
#define FLOOR(x,q) ((x) & -(1 << (q)))
|
||||
|
||||
@ -93,13 +94,13 @@ static void assign_overlap(OVERLAP_NODE* overlaps,
|
||||
*/
|
||||
static int block_overlap(int b1_row, int b1_col, int b2_row, int b2_col)
|
||||
{
|
||||
const int int_top = MAX(b1_row, b2_row); // top
|
||||
const int int_left = MAX(b1_col, b2_col); // left
|
||||
const int int_top = VPXMAX(b1_row, b2_row); // top
|
||||
const int int_left = VPXMAX(b1_col, b2_col); // left
|
||||
/* Since each block is 4x4 pixels, adding 4 (Q3) to the left/top edge
|
||||
* gives us the right/bottom edge.
|
||||
*/
|
||||
const int int_right = MIN(b1_col + (4<<3), b2_col + (4<<3)); // right
|
||||
const int int_bottom = MIN(b1_row + (4<<3), b2_row + (4<<3)); // bottom
|
||||
const int int_right = VPXMIN(b1_col + (4<<3), b2_col + (4<<3)); // right
|
||||
const int int_bottom = VPXMIN(b1_row + (4<<3), b2_row + (4<<3)); // bottom
|
||||
return (int_bottom - int_top) * (int_right - int_left);
|
||||
}
|
||||
|
||||
@ -124,7 +125,7 @@ static void calculate_overlaps_mb(B_OVERLAP *b_overlaps, union b_mode_info *bmi,
|
||||
/* If the block partly overlaps any previous MB, these coordinates
|
||||
* can be < 0. We don't want to access blocks in previous MBs.
|
||||
*/
|
||||
const int blk_idx = MAX(rel_ol_blk_row,0) * 4 + MAX(rel_ol_blk_col,0);
|
||||
const int blk_idx = VPXMAX(rel_ol_blk_row,0) * 4 + VPXMAX(rel_ol_blk_col,0);
|
||||
/* Upper left overlapping block */
|
||||
B_OVERLAP *b_ol_ul = &(b_overlaps[blk_idx]);
|
||||
|
||||
@ -132,8 +133,8 @@ static void calculate_overlaps_mb(B_OVERLAP *b_overlaps, union b_mode_info *bmi,
|
||||
* which the motion compensated block overlaps
|
||||
*/
|
||||
/* Avoid calculating overlaps for blocks in later MBs */
|
||||
int end_row = MIN(4 + mb_row * 4 - first_blk_row, 2);
|
||||
int end_col = MIN(4 + mb_col * 4 - first_blk_col, 2);
|
||||
int end_row = VPXMIN(4 + mb_row * 4 - first_blk_row, 2);
|
||||
int end_col = VPXMIN(4 + mb_col * 4 - first_blk_col, 2);
|
||||
int row, col;
|
||||
|
||||
/* Check if new_row and new_col are evenly divisible by 4 (Q3),
|
||||
@ -208,8 +209,8 @@ void vp8_calculate_overlaps(MB_OVERLAP *overlap_ul,
|
||||
overlap_mb_row = FLOOR((overlap_b_row << 3) / 4, 3) >> 3;
|
||||
overlap_mb_col = FLOOR((overlap_b_col << 3) / 4, 3) >> 3;
|
||||
|
||||
end_row = MIN(mb_rows - overlap_mb_row, 2);
|
||||
end_col = MIN(mb_cols - overlap_mb_col, 2);
|
||||
end_row = VPXMIN(mb_rows - overlap_mb_row, 2);
|
||||
end_col = VPXMIN(mb_cols - overlap_mb_col, 2);
|
||||
|
||||
/* Don't calculate overlap for MBs we don't overlap */
|
||||
/* Check if the new block row starts at the last block row of the MB */
|
||||
|
@ -223,14 +223,14 @@ int vp8_find_best_sub_pixel_step_iteratively(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
|
||||
unsigned int quarteriters = 4;
|
||||
int thismse;
|
||||
|
||||
int minc = MAX(x->mv_col_min * 4,
|
||||
(ref_mv->as_mv.col >> 1) - ((1 << mvlong_width) - 1));
|
||||
int maxc = MIN(x->mv_col_max * 4,
|
||||
(ref_mv->as_mv.col >> 1) + ((1 << mvlong_width) - 1));
|
||||
int minr = MAX(x->mv_row_min * 4,
|
||||
(ref_mv->as_mv.row >> 1) - ((1 << mvlong_width) - 1));
|
||||
int maxr = MIN(x->mv_row_max * 4,
|
||||
(ref_mv->as_mv.row >> 1) + ((1 << mvlong_width) - 1));
|
||||
int minc = VPXMAX(x->mv_col_min * 4,
|
||||
(ref_mv->as_mv.col >> 1) - ((1 << mvlong_width) - 1));
|
||||
int maxc = VPXMIN(x->mv_col_max * 4,
|
||||
(ref_mv->as_mv.col >> 1) + ((1 << mvlong_width) - 1));
|
||||
int minr = VPXMAX(x->mv_row_min * 4,
|
||||
(ref_mv->as_mv.row >> 1) - ((1 << mvlong_width) - 1));
|
||||
int maxr = VPXMIN(x->mv_row_max * 4,
|
||||
(ref_mv->as_mv.row >> 1) + ((1 << mvlong_width) - 1));
|
||||
|
||||
int y_stride;
|
||||
int offset;
|
||||
|
@ -192,11 +192,13 @@ void vp8_cal_dissimilarity(VP8_COMP *cpi)
|
||||
}
|
||||
}
|
||||
|
||||
mmvx = MAX(abs(min_mvx - here->mbmi.mv.as_mv.row),
|
||||
abs(max_mvx - here->mbmi.mv.as_mv.row));
|
||||
mmvy = MAX(abs(min_mvy - here->mbmi.mv.as_mv.col),
|
||||
abs(max_mvy - here->mbmi.mv.as_mv.col));
|
||||
dissim = MAX(mmvx, mmvy);
|
||||
mmvx = VPXMAX(
|
||||
abs(min_mvx - here->mbmi.mv.as_mv.row),
|
||||
abs(max_mvx - here->mbmi.mv.as_mv.row));
|
||||
mmvy = VPXMAX(
|
||||
abs(min_mvy - here->mbmi.mv.as_mv.col),
|
||||
abs(max_mvy - here->mbmi.mv.as_mv.col));
|
||||
dissim = VPXMAX(mmvx, mmvy);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ static int macroblock_corner_grad(unsigned char* signal, int stride,
|
||||
int y2 = signal[offsetx * stride + offsety + sgny];
|
||||
int y3 = signal[(offsetx + sgnx) * stride + offsety];
|
||||
int y4 = signal[(offsetx + sgnx) * stride + offsety + sgny];
|
||||
return MAX(MAX(abs(y1 - y2), abs(y1 - y3)), abs(y1 - y4));
|
||||
return VPXMAX(VPXMAX(abs(y1 - y2), abs(y1 - y3)), abs(y1 - y4));
|
||||
}
|
||||
|
||||
static int check_dot_artifact_candidate(VP8_COMP *cpi,
|
||||
@ -1136,8 +1136,9 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
|
||||
#if CONFIG_MULTI_RES_ENCODING
|
||||
if (parent_ref_valid && (parent_ref_frame == this_ref_frame) &&
|
||||
dissim <= 2 &&
|
||||
MAX(abs(best_ref_mv.as_mv.row - parent_ref_mv.as_mv.row),
|
||||
abs(best_ref_mv.as_mv.col - parent_ref_mv.as_mv.col)) <= 4)
|
||||
VPXMAX(abs(best_ref_mv.as_mv.row - parent_ref_mv.as_mv.row),
|
||||
abs(best_ref_mv.as_mv.col - parent_ref_mv.as_mv.col)) <=
|
||||
4)
|
||||
{
|
||||
d->bmi.mv.as_int = mvp_full.as_int;
|
||||
mode_mv[NEWMV].as_int = mvp_full.as_int;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
#include "vp8/common/systemdependent.h"
|
||||
#include "encodemv.h"
|
||||
#include "vpx_dsp/vpx_dsp_common.h"
|
||||
|
||||
|
||||
#define MIN_BPB_FACTOR 0.01
|
||||
@ -380,7 +381,8 @@ static void calc_iframe_target_size(VP8_COMP *cpi)
|
||||
int initial_boost = 32; /* |3.0 * per_frame_bandwidth| */
|
||||
/* Boost depends somewhat on frame rate: only used for 1 layer case. */
|
||||
if (cpi->oxcf.number_of_layers == 1) {
|
||||
kf_boost = MAX(initial_boost, (int)(2 * cpi->output_framerate - 16));
|
||||
kf_boost = VPXMAX(initial_boost,
|
||||
(int)(2 * cpi->output_framerate - 16));
|
||||
}
|
||||
else {
|
||||
/* Initial factor: set target size to: |3.0 * per_frame_bandwidth|. */
|
||||
|
@ -166,7 +166,7 @@ static vpx_codec_err_t vp8_peek_si_internal(const uint8_t *data,
|
||||
const uint8_t *clear = data;
|
||||
if (decrypt_cb)
|
||||
{
|
||||
int n = MIN(sizeof(clear_buffer), data_sz);
|
||||
int n = VPXMIN(sizeof(clear_buffer), data_sz);
|
||||
decrypt_cb(decrypt_state, data, clear_buffer, n);
|
||||
clear = clear_buffer;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user