ESP32 motion
block_matching.c File Reference
#include "motion.h"
#include <stdbool.h>
#include <math.h>
#include <string.h>
#include "esp_timer.h"

Functions

int costFuncSAD (const uint8_t *currentImg, const uint8_t *refImg, int offset_curr, int offset_ref, size_t mbSize, size_t w)
 Computes the Sum of Absolute Difference (SAD) for the given two blocks
. More...
 
uint8_tmotionComp (const uint8_t *imgI, const MotionVector16_t *motionVect, size_t w, size_t h, size_t mbSize)
 Compute motion compensated image's PSNR
. More...
 
bool motionEstARPS (MotionEstContext *c)
 Perform Adaptive Rood Pattern Search algorithm. More...
 

Variables

const int SDSP [6][2]
 

Detailed Description

Block matching algo

Author
Thomas Pegot

Function Documentation

◆ costFuncSAD()

int costFuncSAD ( const uint8_t currentImg,
const uint8_t refImg,
int  offset_curr,
int  offset_ref,
size_t  mbSize,
size_t  w 
)

Computes the Sum of Absolute Difference (SAD) for the given two blocks
.

\[ SAD = \sum_{i=0}^{n-1}\sum_{j=0}^{n-1} |Cur_{ij}-Ref_{ij}| \]

Parameters
currentImg: img for which we are finding the SAD
refImg: img which the SAD is being computed
offset_curr: offset applied to img current
offset_ref: offset applied to ref img
mbSize: the side of the 2 square blcks
w: width of images
Returns
the SAD for the 2 blks *

Variable Documentation

◆ SDSP

const int SDSP[6][2]
Initial value:
= {{0, -1},
{-1, 0},
{0, 0},
{1, 0},
{0, 1},
{1, 1}}