#include "avifutil.h"
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include "avifjpeg.h"
#include "avifpng.h"
#include "y4m.h"
static int64_t calcGCD(int64_t a, int64_t b)
{ … }
static void printClapFraction(const char * name, int32_t n, int32_t d)
{ … }
static void avifImageDumpInternal(const avifImage * avif,
uint32_t gridCols,
uint32_t gridRows,
avifBool alphaPresent,
avifBool gainMapPresent,
avifProgressiveState progressiveState)
{ … }
void avifImageDump(const avifImage * avif, uint32_t gridCols, uint32_t gridRows, avifBool gainMapPresent, avifProgressiveState progressiveState)
{ … }
void avifContainerDump(const avifDecoder * decoder)
{ … }
void avifPrintVersions(void)
{ … }
avifAppFileFormat avifGuessFileFormat(const char * filename)
{ … }
avifAppFileFormat avifGuessBufferFileFormat(const uint8_t * data, size_t size)
{ … }
avifAppFileFormat avifReadImage(const char * filename,
avifPixelFormat requestedFormat,
int requestedDepth,
avifChromaDownsampling chromaDownsampling,
avifBool ignoreColorProfile,
avifBool ignoreExif,
avifBool ignoreXMP,
avifBool allowChangingCicp,
avifBool ignoreGainMap,
uint32_t imageSizeLimit,
avifImage * image,
uint32_t * outDepth,
avifAppSourceTiming * sourceTiming,
struct y4mFrameIterator ** frameIter)
{ … }
avifBool avifReadEntireFile(const char * filename, avifRWData * raw)
{ … }
void avifImageFixXMP(avifImage * image)
{ … }
void avifDumpDiagnostics(const avifDiagnostics * diag)
{ … }
#if defined(_WIN32)
#include <windows.h>
int avifQueryCPUCount(void)
{
int numCPU;
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
numCPU = sysinfo.dwNumberOfProcessors;
return numCPU;
}
#elif defined(__APPLE__)
#include <sys/sysctl.h>
int avifQueryCPUCount()
{
int mib[4];
int numCPU;
size_t len = sizeof(numCPU);
mib[0] = CTL_HW;
mib[1] = HW_AVAILCPU;
sysctl(mib, 2, &numCPU, &len, NULL, 0);
if (numCPU < 1) {
mib[1] = HW_NCPU;
sysctl(mib, 2, &numCPU, &len, NULL, 0);
if (numCPU < 1)
numCPU = 1;
}
return numCPU;
}
#elif defined(__EMSCRIPTEN__)
int avifQueryCPUCount()
{
return 1;
}
#else
#include <unistd.h>
int avifQueryCPUCount()
{ … }
#endif