chromium/third_party/libjpeg_turbo/tjbench.c

/*
 * Copyright (C)2009-2019, 2021-2023 D. R. Commander.  All Rights Reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * - Redistributions of source code must retain the above copyright notice,
 *   this list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright notice,
 *   this list of conditions and the following disclaimer in the documentation
 *   and/or other materials provided with the distribution.
 * - Neither the name of the libjpeg-turbo Project nor the names of its
 *   contributors may be used to endorse or promote products derived from this
 *   software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifdef _MSC_VER
#define _CRT_SECURE_NO_DEPRECATE
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <errno.h>
#include <limits.h>
#include <cdjpeg.h>
#include "./tjutil.h"
#include "./turbojpeg.h"


#define THROW(op, err)
#define THROW_UNIX(m)

static char tjErrorStr[JMSG_LENGTH_MAX] =,
            tjErrorMsg[JMSG_LENGTH_MAX] =;
static int tjErrorLine =, tjErrorCode =;

#define THROW_TJG(m)

#define THROW_TJ(m)

static int flags =, compOnly =, decompOnly =, doYUV =,
  quiet =, doTile =, pf =, yuvAlign =, doWrite =;
static char *ext =;
static const char *pixFormatStr[TJ_NUMPF] =;
static const char *subNameLong[TJ_NUMSAMP] =;
static const char *csName[TJ_NUMCS] =;
static const char *subName[TJ_NUMSAMP] =;
static tjscalingfactor *scalingFactors =, sf =;
static int nsf =, xformOp =, xformOpt =;
static int (*customFilter) (short *, tjregion, tjregion, int, int,
                            tjtransform *);
static double benchTime =, warmup =;


static char *formatName(int subsamp, int cs, char *buf)
{}


static char *sigfig(double val, int figs, char *buf, int len)
{}


/* Custom DCT filter which produces a negative of the image */
static int dummyDCTFilter(short *coeffs, tjregion arrayRegion,
                          tjregion planeRegion, int componentIndex,
                          int transformIndex, tjtransform *transform)
{}


/* Decompression test */
static int decomp(unsigned char *srcBuf, unsigned char **jpegBuf,
                  unsigned long *jpegSize, unsigned char *dstBuf, int w, int h,
                  int subsamp, int jpegQual, char *fileName, int tilew,
                  int tileh)
{}


static int fullTest(unsigned char *srcBuf, int w, int h, int subsamp,
                    int jpegQual, char *fileName)
{}


static int decompTest(char *fileName)
{}


static void usage(char *progName)
{}

#ifndef GTEST
int main(int argc, char *argv[])
#else
int tjbench(int argc, char *argv[])
#endif
{}