TUT HEVC Encoder
Macros | Functions
image.c File Reference
#include "image.h"
#include <limits.h>
#include <stdlib.h>
#include "strategies/strategies-ipol.h"
#include "strategies/strategies-picture.h"
#include "threads.h"
Include dependency graph for image.c:

Macros

#define BLIT_PIXELS_CASE(n)
 BLock Image Transfer from one buffer to another. More...
 

Functions

kvz_picturekvz_image_alloc_420 (const int32_t width, const int32_t height)
 Allocate a new image with 420. More...
 
kvz_picturekvz_image_alloc (enum kvz_chroma_format chroma_format, const int32_t width, const int32_t height)
 Allocate a new image. More...
 
void kvz_image_free (kvz_picture *const im)
 Free an image. More...
 
kvz_picturekvz_image_copy_ref (kvz_picture *im)
 Get a new pointer to an image. More...
 
kvz_picturekvz_image_make_subimage (kvz_picture *const orig_image, const unsigned x_offset, const unsigned y_offset, const unsigned width, const unsigned height)
 
yuv_tkvz_yuv_t_alloc (int luma_size, int chroma_size)
 
void kvz_yuv_t_free (yuv_t *yuv)
 
static uint32_t reg_sad_maybe_optimized (const kvz_pixel *const data1, const kvz_pixel *const data2, const int32_t width, const int32_t height, const uint32_t stride1, const uint32_t stride2, optimized_sad_func_ptr_t optimized_sad)
 
static unsigned cor_sad (const kvz_pixel *pic_data, const kvz_pixel *ref_data, int block_width, int block_height, unsigned pic_stride)
 Diagonally interpolate SAD outside the frame. More...
 
static unsigned image_interpolated_sad (const kvz_picture *pic, const kvz_picture *ref, int pic_x, int pic_y, int ref_x, int ref_y, int block_width, int block_height, optimized_sad_func_ptr_t optimized_sad)
 Handle special cases of comparing blocks that are not completely inside the frame. More...
 
unsigned kvz_image_calc_sad (const kvz_picture *pic, const kvz_picture *ref, int pic_x, int pic_y, int ref_x, int ref_y, int block_width, int block_height, optimized_sad_func_ptr_t optimized_sad)
 Calculate interpolated SAD between two blocks. More...
 
unsigned kvz_image_calc_satd (const kvz_picture *pic, const kvz_picture *ref, int pic_x, int pic_y, int ref_x, int ref_y, int block_width, int block_height)
 Calculate interpolated SATD between two blocks. More...
 
void kvz_pixels_blit (const kvz_pixel *const orig, kvz_pixel *const dst, const unsigned width, const unsigned height, const unsigned orig_stride, const unsigned dst_stride)
 

Macro Definition Documentation

◆ BLIT_PIXELS_CASE

#define BLIT_PIXELS_CASE (   n)
Value:
case n:\
for (y = 0; y < n; ++y) {\
memcpy(&dst[y*dst_stride], &orig[y*orig_stride], n * sizeof(kvz_pixel));\
}\
break;
uint8_t kvz_pixel
Definition: kvazaar.h:95

It's a stupidly simple loop that copies pixels.

Parameters
origStart of the originating buffer.
dstStart of the destination buffer.
widthWidth of the copied region.
heightHeight of the copied region.
orig_strideWidth of a row in the originating buffer.
dst_strideWidth of a row in the destination buffer.

This should be inlined, but it's defined here for now to see if Visual Studios LTCG will inline it.

Function Documentation

◆ cor_sad()

static unsigned cor_sad ( const kvz_pixel pic_data,
const kvz_pixel ref_data,
int  block_width,
int  block_height,
unsigned  pic_stride 
)
static
Parameters
data1Starting point of the first picture.
data2Starting point of the second picture.
widthWidth of the region for which SAD is calculated.
heightHeight of the region for which SAD is calculated.
widthWidth of the pixel array.
Returns
Sum of Absolute Differences
Here is the caller graph for this function:

◆ image_interpolated_sad()

static unsigned image_interpolated_sad ( const kvz_picture pic,
const kvz_picture ref,
int  pic_x,
int  pic_y,
int  ref_x,
int  ref_y,
int  block_width,
int  block_height,
optimized_sad_func_ptr_t  optimized_sad 
)
static
Parameters
picFirst frame.
refSecond frame.
pic_xX coordinate of the first block.
pic_yY coordinate of the first block.
ref_xX coordinate of the second block.
ref_yY coordinate of the second block.
block_widthWidth of the blocks.
block_heightHeight of the blocks.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_image_alloc()

kvz_picture * kvz_image_alloc ( enum kvz_chroma_format  chroma_format,
const int32_t  width,
const int32_t  height 
)
Returns
image pointer or NULL on failure
Here is the caller graph for this function:

◆ kvz_image_alloc_420()

kvz_picture * kvz_image_alloc_420 ( const int32_t  width,
const int32_t  height 
)

This function signature is part of the libkvz API.

Returns
image pointer or NULL on failure
Here is the call graph for this function:

◆ kvz_image_calc_sad()

unsigned kvz_image_calc_sad ( const kvz_picture pic,
const kvz_picture ref,
int  pic_x,
int  pic_y,
int  ref_x,
int  ref_y,
int  block_width,
int  block_height,
optimized_sad_func_ptr_t  optimized_sad 
)
Parameters
picImage for the block we are trying to find.
refImage where we are trying to find the block.
Returns
Sum of absolute differences
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_image_calc_satd()

unsigned kvz_image_calc_satd ( const kvz_picture pic,
const kvz_picture ref,
int  pic_x,
int  pic_y,
int  ref_x,
int  ref_y,
int  block_width,
int  block_height 
)
Parameters
picImage for the block we are trying to find.
refImage where we are trying to find the block.
Here is the caller graph for this function:

◆ kvz_image_copy_ref()

kvz_picture * kvz_image_copy_ref ( kvz_picture im)

Increment reference count and return the image.

Here is the caller graph for this function:

◆ kvz_image_free()

void kvz_image_free ( kvz_picture *const  im)

Decrement reference count of the image and deallocate associated memory if no references exist any more.

Parameters
imimage to free
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_image_make_subimage()

kvz_picture * kvz_image_make_subimage ( kvz_picture *const  orig_image,
const unsigned  x_offset,
const unsigned  y_offset,
const unsigned  width,
const unsigned  height 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_pixels_blit()

void kvz_pixels_blit ( const kvz_pixel *const  orig,
kvz_pixel *const  dst,
const unsigned  width,
const unsigned  height,
const unsigned  orig_stride,
const unsigned  dst_stride 
)
Here is the caller graph for this function:

◆ kvz_yuv_t_alloc()

yuv_t * kvz_yuv_t_alloc ( int  luma_size,
int  chroma_size 
)
Here is the caller graph for this function:

◆ kvz_yuv_t_free()

void kvz_yuv_t_free ( yuv_t yuv)
Here is the caller graph for this function:

◆ reg_sad_maybe_optimized()

static uint32_t reg_sad_maybe_optimized ( const kvz_pixel *const  data1,
const kvz_pixel *const  data2,
const int32_t  width,
const int32_t  height,
const uint32_t  stride1,
const uint32_t  stride2,
optimized_sad_func_ptr_t  optimized_sad 
)
inlinestatic
Here is the caller graph for this function: