Unified · Split
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | 2 | ||
| 3 | LIB=libvpx.a | 3 | LIB=libvpx.a |
| 4 | 4 | ||
| 5 | CFLAGS=$CFLAGS -I. -Iplan9 -p -D__plan9__ -Dvolatile= -DNDEBUG | 5 | CFLAGS=$CFLAGS -I. -Iplan9 -p -D__plan9__ -D__${objtype}__ -Dvolatile= -DNDEBUG |
| 6 | 6 | ||
| 7 | OFILES=\ | 7 | OFILES=\ |
| 8 | args.$O\ | 8 | args.$O\ |
| @@ -17,15 +17,16 @@ nanosec(void) · 16 unmodified lines | |||
| 17 | return nsec() - xstart; | 17 | return nsec() - xstart; |
| 18 | 18 | ||
| 19 | if(fasthz == 0){ | 19 | if(fasthz == 0){ |
| 20 | if((fasthz = _tos->cyclefreq) == 0){ | 20 | fasthz = _tos->cyclefreq; |
| 21 | if(fasthz == 0){ | ||
| 21 | fasthz = ~0ULL; | 22 | fasthz = ~0ULL; |
| 22 | xstart = nsec(); | 23 | xstart = nsec(); |
| 23 | fprint(2, "cyclefreq not available, falling back to nsec()\n"); | 24 | fprint(2, "cyclefreq not available, falling back to nsec()\n"); |
| 24 | fprint(2, "you might want to disable aux/timesync\n"); | 25 | fprint(2, "you might want to disable aux/timesync\n"); |
| 25 | return 0; | ||
| 26 | }else{ | 26 | }else{ |
| 27 | cycles(&xstart); | 27 | cycles(&xstart); |
| 28 | } | 28 | } |
| 29 | return 0; | ||
| 29 | } | 30 | } |
| 30 | cycles(&x); | 31 | cycles(&x); |
| 31 | x -= xstart; | 32 | x -= xstart; |
| @@ -13,15 +13,18 @@ · 12 unmodified lines | |||
| 13 | #include <libc.h> | 13 | #include <libc.h> |
| 14 | #include <thread.h> | 14 | #include <thread.h> |
| 15 | #include </sys/include/stdio.h> | 15 | #include </sys/include/stdio.h> |
| 16 | |||
| 16 | typedef u8int uint8_t; | 17 | typedef u8int uint8_t; |
| 17 | typedef u16int uint16_t; | 18 | typedef u16int uint16_t; |
| 18 | typedef u32int uint32_t; | 19 | typedef u32int uint32_t; |
| 19 | typedef u64int uint64_t; | 20 | typedef u64int uint64_t; |
| 21 | |||
| 20 | typedef s8int int8_t; | 22 | typedef s8int int8_t; |
| 21 | typedef s16int int16_t; | 23 | typedef s16int int16_t; |
| 22 | typedef s32int int32_t; | 24 | typedef s32int int32_t; |
| 23 | typedef s64int int64_t; | 25 | typedef s64int int64_t; |
| 24 | typedef ulong size_t; | 26 | |
| 27 | typedef usize size_t; | ||
| 25 | typedef long off_t; | 28 | typedef long off_t; |
| 26 | typedef intptr ptrdiff_t; | 29 | typedef intptr ptrdiff_t; |
| 27 | typedef intptr intptr_t; | 30 | typedef intptr intptr_t; |
| @@ -4504,9 +4504,9 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, TileDataEnc *tile_data, · 4503 unmodified lines | |||
| 4504 | 4504 | ||
| 4505 | compmode_cost = vp9_cost_bit(comp_mode_p, comp_pred); | 4505 | compmode_cost = vp9_cost_bit(comp_mode_p, comp_pred); |
| 4506 | 4506 | ||
| 4507 | tmp_best_rdu = | 4507 | int64_t a = RDCOST(x->rdmult, x->rddiv, rate2, distortion2); |
| 4508 | best_rd - VPXMIN(RDCOST(x->rdmult, x->rddiv, rate2, distortion2), | 4508 | int64_t b = RDCOST(x->rdmult, x->rddiv, 0, total_sse); |
| 4509 | RDCOST(x->rdmult, x->rddiv, 0, total_sse)); | 4509 | tmp_best_rdu = best_rd - VPXMIN(a, b); |
| 4510 | 4510 | ||
| 4511 | if (tmp_best_rdu > 0) { | 4511 | if (tmp_best_rdu > 0) { |
| 4512 | // If even the 'Y' rd value of split is higher than best so far | 4512 | // If even the 'Y' rd value of split is higher than best so far |
| @@ -225,11 +225,11 @@ static double ssimv_similarity(const Ssimv *sv, int64_t n) { · 224 unmodified lines | |||
| 225 | 225 | ||
| 226 | // Since these variables are unsigned sums, convert to double so | 226 | // Since these variables are unsigned sums, convert to double so |
| 227 | // math is done in double arithmetic. | 227 | // math is done in double arithmetic. |
| 228 | const double v = (2.0 * n * sv->sum_sxr - 2 * sv->sum_s * sv->sum_r + c2) / | 228 | const double v = (2.0 * n * sv->sum_sxr - 2 * sv->sum_s * sv->sum_r + c2); |
| 229 | (n * sv->sum_sq_s - sv->sum_s * sv->sum_s + | 229 | double d = n * sv->sum_sq_s - sv->sum_s * sv->sum_s; |
| 230 | n * sv->sum_sq_r - sv->sum_r * sv->sum_r + c2); | 230 | d += n * sv->sum_sq_r - sv->sum_r * sv->sum_r + c2; |
| 231 | 231 | ||
| 232 | return l * v; | 232 | return l * (v / d); |
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | // The first term of the ssim metric is a luminance factor. | 235 | // The first term of the ssim metric is a luminance factor. |
| @@ -256,11 +256,11 @@ static double ssimv_similarity2(const Ssimv *sv, int64_t n) { · 20 unmodified lines | |||
| 256 | 256 | ||
| 257 | // Since these variables are unsigned, sums convert to double so | 257 | // Since these variables are unsigned, sums convert to double so |
| 258 | // math is done in double arithmetic. | 258 | // math is done in double arithmetic. |
| 259 | const double v = (2.0 * n * sv->sum_sxr - 2 * sv->sum_s * sv->sum_r + c2) / | 259 | const double v = (2.0 * n * sv->sum_sxr - 2 * sv->sum_s * sv->sum_r + c2); |
| 260 | (n * sv->sum_sq_s - sv->sum_s * sv->sum_s + | 260 | double d = n * sv->sum_sq_s - sv->sum_s * sv->sum_s; |
| 261 | n * sv->sum_sq_r - sv->sum_r * sv->sum_r + c2); | 261 | d += n * sv->sum_sq_r - sv->sum_r * sv->sum_r + c2; |
| 262 | 262 | ||
| 263 | return l * v; | 263 | return l * (v / d); |
| 264 | } | 264 | } |
| 265 | static void ssimv_parms(uint8_t *img1, int img1_pitch, uint8_t *img2, | 265 | static void ssimv_parms(uint8_t *img1, int img1_pitch, uint8_t *img2, |
| 266 | int img2_pitch, Ssimv *sv) { | 266 | int img2_pitch, Ssimv *sv) { |