mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-22 18:40:29 +00:00
Make more fixes and improvements
- Remove PAGESIZE constant - Fix realloc() documentation - Fix ttyname_r() error reporting - Make forking more reliable on Windows - Make execvp() a few microseconds faster - Make system() a few microseconds faster - Tighten up the socket-related magic numbers - Loosen restrictions on mmap() offset alignment - Improve GetProgramExecutableName() with getenv("_") - Use mkstemp() as basis for mktemp(), tmpfile(), tmpfd() - Fix flakes in pthread_cancel_test, unix_test, fork_test - Fix recently introduced futex stack overflow regression - Let sockets be passed as stdio to subprocesses on Windows - Improve security of bind() on Windows w/ SO_EXCLUSIVEADDRUSE
This commit is contained in:
parent
140a8a52e5
commit
18bb5888e1
311 changed files with 1239 additions and 2622 deletions
|
@ -27,6 +27,7 @@
|
|||
#include "dsp/scale/scale.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/sigset.h"
|
||||
#include "libc/intrin/bsr.h"
|
||||
#include "libc/intrin/pmulhrsw.h"
|
||||
#include "libc/log/check.h"
|
||||
#include "libc/log/log.h"
|
||||
|
@ -80,6 +81,14 @@ struct YCbCr {
|
|||
} luma, chroma;
|
||||
};
|
||||
|
||||
static unsigned long roundup2pow(unsigned long x) {
|
||||
return x > 1 ? 2ul << _bsrl(x - 1) : x ? 1 : 0;
|
||||
}
|
||||
|
||||
static unsigned long rounddown2pow(unsigned long x) {
|
||||
return x ? 1ul << _bsrl(x) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes magnums for Y′CbCr decoding.
|
||||
*
|
||||
|
@ -95,8 +104,8 @@ void YCbCrComputeCoefficients(int swing, double gamma,
|
|||
double x;
|
||||
double f1[6][3];
|
||||
long longs[6][6];
|
||||
long bitlimit = _roundup2pow(swing);
|
||||
long wordoffset = _rounddown2pow((bitlimit - swing) / 2);
|
||||
long bitlimit = roundup2pow(swing);
|
||||
long wordoffset = rounddown2pow((bitlimit - swing) / 2);
|
||||
long chromaswing = swing + 2 * (bitlimit / 2. - swing / 2. - wordoffset);
|
||||
long lumamin = wordoffset;
|
||||
long lumamax = wordoffset + swing;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue