2013-09-19 07:35:34 +00:00
|
|
|
#ifndef GLOBAL_H_
|
|
|
|
#define GLOBAL_H_
|
2012-05-30 12:10:23 +00:00
|
|
|
/**
|
2013-09-18 14:29:30 +00:00
|
|
|
* \file
|
|
|
|
* \brief Header that is included in every other header.
|
|
|
|
*
|
|
|
|
* \author Marko Viitanen ( fador@iki.fi ),
|
|
|
|
* Tampere University of Technology,
|
|
|
|
* Department of Pervasive Computing.
|
|
|
|
* \author Ari Koivula ( ari@koivu.la ),
|
|
|
|
* Tampere University of Technology,
|
|
|
|
* Department of Pervasive Computing.
|
|
|
|
*
|
|
|
|
* This file contains global constants that can be referred to from any header
|
|
|
|
* or source file. It also contains some helper macros and includes stdint.h
|
|
|
|
* so that any file can refer to integer types with exact widths.
|
2012-05-30 12:10:23 +00:00
|
|
|
*/
|
|
|
|
|
2013-09-19 07:35:34 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#include "../include/stdint.h"
|
|
|
|
#else
|
|
|
|
#include <stdint.h>
|
|
|
|
#endif
|
|
|
|
|
2013-09-23 13:48:34 +00:00
|
|
|
#if _MSC_VER && _M_AMD64
|
|
|
|
#define X86_64
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if __GNUC__ && __x86_64__
|
|
|
|
#define X86_64
|
|
|
|
#endif
|
|
|
|
|
2013-10-14 14:27:25 +00:00
|
|
|
#define BIT_DEPTH 8
|
|
|
|
#define PIXEL_MIN 0
|
|
|
|
#define PIXEL_MAX (1 << BIT_DEPTH)
|
|
|
|
|
|
|
|
#if BIT_DEPTH == 8
|
|
|
|
typedef uint8_t pixel;
|
|
|
|
#else
|
|
|
|
typedef uint16_t pixel;
|
|
|
|
#endif
|
|
|
|
typedef int16_t coefficient;
|
2012-05-30 12:10:23 +00:00
|
|
|
|
2012-06-11 12:39:18 +00:00
|
|
|
/* CONFIG VARIABLES */
|
2013-09-02 06:53:36 +00:00
|
|
|
#define LCU_WIDTH 64 /*!< Largest Coding Unit (IT'S 64x64, DO NOT TOUCH!) */
|
2013-04-17 14:08:52 +00:00
|
|
|
|
2013-09-30 15:01:21 +00:00
|
|
|
#define MAX_INTER_SEARCH_DEPTH 3
|
2013-09-18 09:26:51 +00:00
|
|
|
#define MIN_INTER_SEARCH_DEPTH 0
|
|
|
|
|
|
|
|
#define MAX_INTRA_SEARCH_DEPTH 3 /*!< Max search depth -> min block size (3 == 8x8) */
|
|
|
|
#define MIN_INTRA_SEARCH_DEPTH 1 /*!< Min search depth -> max block size (0 == 64x64) */
|
|
|
|
|
2013-04-17 14:08:52 +00:00
|
|
|
|
2013-03-11 10:06:08 +00:00
|
|
|
#define MAX_DEPTH 3 /*!< smallest CU is LCU_WIDTH>>MAX_DEPTH */
|
|
|
|
#define MIN_SIZE 3 /*!< log2_min_coding_block_size */
|
2013-09-09 15:32:16 +00:00
|
|
|
#define CU_MIN_SIZE_PIXELS 8 /*!< pow(2, MIN_SIZE) */
|
2012-06-11 12:39:18 +00:00
|
|
|
|
2013-03-20 15:27:47 +00:00
|
|
|
#define ENABLE_PCM 0 /*!< Setting to 1 will enable using PCM blocks (current intra-search does not consider PCM) */
|
2013-08-02 13:35:30 +00:00
|
|
|
#define ENABLE_SIGN_HIDING 0 /*!< DOES NOT WORK PROPERLY */
|
|
|
|
#define ENABLE_SCALING_LIST 1 /*!< Enable usage of (default) scaling list (BREAKS CHROMA WHEN 0!) */
|
2012-06-11 12:39:18 +00:00
|
|
|
|
2013-09-18 07:15:05 +00:00
|
|
|
#define ENABLE_TEMPORAL_MVP 0 /*!< Enable usage of temporal Motion Vector Prediction */
|
|
|
|
|
2013-10-10 13:31:00 +00:00
|
|
|
#define OPTIMIZATION_SKIP_RESIDUAL_ON_THRESHOLD 0 /*!< skip residual coding when it's under _some_ threshold */
|
|
|
|
|
2012-06-11 12:39:18 +00:00
|
|
|
/* END OF CONFIG VARIABLES */
|
|
|
|
|
2013-09-12 13:28:40 +00:00
|
|
|
#define MAX_REF_PIC_COUNT 5
|
|
|
|
|
2013-08-02 13:35:30 +00:00
|
|
|
#define AMVP_MAX_NUM_CANDS 2
|
|
|
|
#define AMVP_MAX_NUM_CANDS_MEM 3
|
|
|
|
#define MRG_MAX_NUM_CANDS 5
|
2012-06-11 12:39:18 +00:00
|
|
|
|
2013-03-08 09:42:22 +00:00
|
|
|
/* Some tools */
|
2012-06-07 14:38:28 +00:00
|
|
|
#define MAX(a,b) (((a)>(b))?(a):(b))
|
|
|
|
#define MIN(a,b) (((a)<(b))?(a):(b))
|
2013-03-08 09:42:22 +00:00
|
|
|
#define CLIP(low,high,value) MAX((low),MIN((high),(value)))
|
|
|
|
#define SWAP(a,b,swaptype) { swaptype tempval; tempval = a; a = b; b = tempval; }
|
2013-09-16 15:58:28 +00:00
|
|
|
#define CU_WIDTH_FROM_DEPTH(depth) (LCU_WIDTH >> depth)
|
2013-09-25 15:18:12 +00:00
|
|
|
#define NO_SCU_IN_LCU(no_lcu) ((no_lcu) << MAX_DEPTH)
|
2013-10-14 14:27:25 +00:00
|
|
|
#define WITHIN(val, min_val, max_val) ((min_val) <= (val) && (val) <= (max_val))
|
2012-06-04 10:47:12 +00:00
|
|
|
|
2013-03-11 10:06:08 +00:00
|
|
|
#define VERSION_STRING "0.2 "
|
|
|
|
#define VERSION 0.2
|
2012-05-30 12:10:23 +00:00
|
|
|
|
|
|
|
//#define VERBOSE 1
|
|
|
|
|
|
|
|
|
|
|
|
#define SIZE_2Nx2N 0
|
|
|
|
#define SIZE_2NxN 1
|
|
|
|
#define SIZE_Nx2N 2
|
|
|
|
#define SIZE_NxN 3
|
|
|
|
#define SIZE_NONE 15
|
|
|
|
|
2013-10-23 16:51:39 +00:00
|
|
|
// These are for marking incomplete implementations that break if slices or
|
|
|
|
// tiles are used with asserts. They should be set to 1 if they are ever
|
|
|
|
// implemented.
|
|
|
|
#define USE_SLICES 0
|
|
|
|
#define USE_TILES 0
|
|
|
|
|
2013-02-05 13:48:06 +00:00
|
|
|
/* Inlining functions */
|
|
|
|
#ifdef _MSC_VER /* Visual studio */
|
|
|
|
#define INLINE __forceinline
|
|
|
|
#pragma inline_recursion(on)
|
|
|
|
#else /* others */
|
|
|
|
#define INLINE inline
|
|
|
|
#endif
|
|
|
|
|
2013-10-15 12:27:32 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
// Buggy VS2010 throws intellisense warnings if void* is not casted.
|
|
|
|
#define MALLOC(type, num) (type *)malloc(sizeof(type) * num)
|
|
|
|
#else
|
|
|
|
#define MALLOC(type, num) malloc(sizeof(type) * num)
|
|
|
|
#endif
|
|
|
|
|
2013-09-18 11:50:43 +00:00
|
|
|
#define FREE_POINTER(pointer) { free(pointer); pointer = NULL; }
|
2013-02-21 14:45:22 +00:00
|
|
|
|
2012-05-30 12:10:23 +00:00
|
|
|
#endif
|