mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-24 18:34:06 +00:00
5e2f22f447
- Adjust predictor list to take modes from PUs in addition to 2Nx2N CUs. - Change intra_get_dir_luma_predictor to take PU index instead of CU index. - Comment prediction encoding now that I've had to look it up.
137 lines
4 KiB
C
137 lines
4 KiB
C
#ifndef GLOBAL_H_
|
|
#define GLOBAL_H_
|
|
/**
|
|
* \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.
|
|
*/
|
|
|
|
#ifdef _MSC_VER
|
|
#include "../include/stdint.h"
|
|
#else
|
|
#include <stdint.h>
|
|
#endif
|
|
|
|
#if _MSC_VER && _M_AMD64
|
|
#define X86_64
|
|
#endif
|
|
|
|
#if __GNUC__ && __x86_64__
|
|
#define X86_64
|
|
#endif
|
|
|
|
#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;
|
|
|
|
//#define VERBOSE 1
|
|
|
|
/* CONFIG VARIABLES */
|
|
#define LCU_WIDTH 64 /*!< Largest Coding Unit (IT'S 64x64, DO NOT TOUCH!) */
|
|
|
|
#define MAX_INTER_SEARCH_DEPTH 3
|
|
#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) */
|
|
|
|
|
|
#define MAX_DEPTH 3 /*!< smallest CU is LCU_WIDTH>>MAX_DEPTH */
|
|
#define MAX_PU_DEPTH 4
|
|
#define MIN_SIZE 3 /*!< log2_min_coding_block_size */
|
|
#define CU_MIN_SIZE_PIXELS 8 /*!< pow(2, MIN_SIZE) */
|
|
|
|
#define TR_DEPTH_INTRA 2
|
|
#define TR_DEPTH_INTER 2
|
|
|
|
#define ENABLE_PCM 0 /*!< Setting to 1 will enable using PCM blocks (current intra-search does not consider PCM) */
|
|
#define ENABLE_SIGN_HIDING 1
|
|
#define ENABLE_SCALING_LIST 0 /*!< Enable usage of (default) scaling list */
|
|
|
|
#define ENABLE_TEMPORAL_MVP 0 /*!< Enable usage of temporal Motion Vector Prediction */
|
|
|
|
#define OPTIMIZATION_SKIP_RESIDUAL_ON_THRESHOLD 0 /*!< skip residual coding when it's under _some_ threshold */
|
|
|
|
/* END OF CONFIG VARIABLES */
|
|
|
|
#define LCU_LUMA_SIZE (LCU_WIDTH * LCU_WIDTH)
|
|
#define LCU_CHROMA_SIZE (LCU_WIDTH * LCU_WIDTH >> 2)
|
|
|
|
#define MAX_REF_PIC_COUNT 5
|
|
|
|
#define AMVP_MAX_NUM_CANDS 2
|
|
#define AMVP_MAX_NUM_CANDS_MEM 3
|
|
#define MRG_MAX_NUM_CANDS 5
|
|
|
|
/* Some tools */
|
|
#define MAX(a,b) (((a)>(b))?(a):(b))
|
|
#define MIN(a,b) (((a)<(b))?(a):(b))
|
|
#define CLIP(low,high,value) MAX((low),MIN((high),(value)))
|
|
#define SWAP(a,b,swaptype) { swaptype tempval; tempval = a; a = b; b = tempval; }
|
|
#define CU_WIDTH_FROM_DEPTH(depth) (LCU_WIDTH >> depth)
|
|
#define NO_SCU_IN_LCU(no_lcu) ((no_lcu) << MAX_DEPTH)
|
|
#define WITHIN(val, min_val, max_val) ((min_val) <= (val) && (val) <= (max_val))
|
|
|
|
#define LOG2_LCU_WIDTH 6
|
|
// CU_TO_PIXEL = y * lcu_width * pic_width + x * lcu_width
|
|
#define CU_TO_PIXEL(x, y, depth, width) (((y) << (LOG2_LCU_WIDTH - (depth))) * (width) \
|
|
+ ((x) << (LOG2_LCU_WIDTH - (depth))))
|
|
//#define SIGN3(x) ((x) > 0) ? +1 : ((x) == 0 ? 0 : -1)
|
|
#define SIGN3(x) (((x) > 0) - ((x) < 0))
|
|
|
|
#define VERSION_STRING "0.2 "
|
|
#define VERSION 0.2
|
|
|
|
//#define VERBOSE 1
|
|
|
|
#define SAO_ABS_OFFSET_MAX ((1 << (MIN(BIT_DEPTH, 10) - 5)) - 1)
|
|
|
|
|
|
#define SIZE_2Nx2N 0
|
|
#define SIZE_2NxN 1
|
|
#define SIZE_Nx2N 2
|
|
#define SIZE_NxN 3
|
|
#define SIZE_NONE 15
|
|
|
|
// 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
|
|
|
|
/* Inlining functions */
|
|
#ifdef _MSC_VER /* Visual studio */
|
|
#define INLINE __forceinline
|
|
#pragma inline_recursion(on)
|
|
#else /* others */
|
|
#define INLINE inline
|
|
#endif
|
|
|
|
#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
|
|
|
|
#define FREE_POINTER(pointer) { free(pointer); pointer = NULL; }
|
|
#define MOVE_POINTER(dst_pointer,src_pointer) { dst_pointer = src_pointer; src_pointer = NULL; }
|
|
|
|
#endif |