Commit 23c4116e authored by Geza Lore's avatar Geza Lore Committed by hui su
Browse files

Clear X87 register state before using double.

MMX and X87 floating point instructions cannot be mixed freely on
the 32 bit x86 architecture.

This fixes a lot of unit tests in the 32bit build with
--enable-ext-intra.

BUG=https://bugs.chromium.org/p/webm/issues/detail?id=1196

Change-Id: I0e1c3565f4b9cb4fc2d716e94d9c40e68b36fac8
parent 0aa6435c
......@@ -26,7 +26,6 @@ using libvpx_test::ACMRandom;
namespace {
void reference_dct_1d(const double *in, double *out, int size) {
const double PI = 3.141592653589793238462643383279502884;
const double kInvSqrt2 = 0.707106781186547524400844362104;
for (int k = 0; k < size; ++k) {
out[k] = 0;
......
......@@ -28,7 +28,6 @@
using libvpx_test::ACMRandom;
namespace {
const double PI = 3.141592653589793238462643383279502884;
const double kInvSqrt2 = 0.707106781186547524400844362104;
void reference_idct_1d(const double *in, double *out, int size) {
......
......@@ -9,6 +9,9 @@
*/
#include <math.h>
#include "vpx_ports/system_state.h"
#include "vp10/common/blockd.h"
PREDICTION_MODE vp10_left_block_mode(const MODE_INFO *cur_mi,
......@@ -137,7 +140,6 @@ void vp10_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y) {
}
#if CONFIG_EXT_INTRA
#define PI 3.14159265
// Returns whether filter selection is needed for a given
// intra prediction angle.
int pick_intra_filter(int angle) {
......@@ -146,8 +148,12 @@ int pick_intra_filter(int angle) {
if (angle > 90 && angle < 180) {
return 1;
} else {
double t = tan(angle * PI / 180.0);
double t;
double n;
vpx_clear_system_state();
t = tan(angle * PI / 180.0);
if (angle < 90)
t = 1 / t;
n = floor(t);
......
......@@ -25,6 +25,8 @@
extern "C" {
#endif
#define PI 3.141592653589793238462643383279502884
// Only need this for fixed-size arrays, for structs just assign.
#define vp10_copy(dest, src) { \
assert(sizeof(dest) == sizeof(src)); \
......
......@@ -12,6 +12,7 @@
#include "./vpx_config.h"
#include "./vpx_dsp_rtcd.h"
#include "vpx_ports/system_state.h"
#if CONFIG_VP9_HIGHBITDEPTH
#include "vpx_dsp/vpx_dsp_common.h"
......@@ -389,7 +390,6 @@ static void vp10_init_intra_predictors_internal(void) {
}
#if CONFIG_EXT_INTRA
#define PI 3.14159265
#define FILTER_INTRA_PREC_BITS 10
#define FILTER_INTRA_ROUND_VAL 511
......@@ -672,10 +672,12 @@ static void dr_prediction_z3(uint8_t *dst, ptrdiff_t stride, int bs,
static void dr_predictor(uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size,
const uint8_t *above, const uint8_t *left, int angle,
INTRA_FILTER filter_type) {
double t = 0;
double t;
int dx, dy;
int bs = 4 << tx_size;
vpx_clear_system_state();
t = 0;
if (angle != 90 && angle != 180)
t = tan(angle * PI / 180.0);
if (angle > 0 && angle < 90) {
......@@ -1008,9 +1010,11 @@ static INLINE void highbd_h_predictor(uint16_t *dst, ptrdiff_t stride,
static void highbd_dr_predictor(uint16_t *dst, ptrdiff_t stride, int bs,
const uint16_t *above, const uint16_t *left,
int angle, int bd, INTRA_FILTER filter) {
double t = 0;
double t;
int dx, dy;
vpx_clear_system_state();
t = 0;
if (angle != 90 && angle != 180)
t = tan(angle * PI / 180.0);
if (angle > 0 && angle < 90) {
......
......@@ -2523,10 +2523,11 @@ static INLINE int get_angle_index(double angle) {
static void angle_estimation(const uint8_t *src, int src_stride,
int rows, int cols, double *hist) {
int r, c, i, index;
const double pi = 3.1415;
double angle, dx, dy;
double temp, divisor = 0;
double temp, divisor;
vpx_clear_system_state();
divisor = 0;
for (i = 0; i < DIRECTIONAL_MODES; ++i)
hist[i] = 0;
......@@ -2539,7 +2540,7 @@ static void angle_estimation(const uint8_t *src, int src_stride,
if (dy == 0)
angle = 90;
else
angle = (atan((double)dx / (double)dy)) * 180 / pi;
angle = (atan((double)dx / (double)dy)) * 180 / PI;
assert(angle >= -90 && angle <= 90);
index = get_angle_index(angle + 180);
if (index < DIRECTIONAL_MODES) {
......@@ -2567,11 +2568,12 @@ static void angle_estimation(const uint8_t *src, int src_stride,
static void highbd_angle_estimation(const uint8_t *src8, int src_stride,
int rows, int cols, double *hist) {
int r, c, i, index;
const double pi = 3.1415;
double angle, dx, dy;
double temp, divisor = 0;
double temp, divisor;
uint16_t *src = CONVERT_TO_SHORTPTR(src8);
vpx_clear_system_state();
divisor = 0;
for (i = 0; i < DIRECTIONAL_MODES; ++i)
hist[i] = 0;
......@@ -2584,7 +2586,7 @@ static void highbd_angle_estimation(const uint8_t *src8, int src_stride,
if (dy == 0)
angle = 90;
else
angle = (atan((double)dx / (double)dy)) * 180 / pi;
angle = (atan((double)dx / (double)dy)) * 180 / PI;
assert(angle >= -90 && angle <= 90);
index = get_angle_index(angle + 180);
if (index < DIRECTIONAL_MODES) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment