| 
    ESP32 motion
    
   | 
 
#include "motion.h"#include <math.h>#include <assert.h>#include <string.h>#include "esp_heap_caps.h"#include "esp_log.h"Functions | |
| void | uninit (MotionEstContext *ctx) | 
| bool | init_context (MotionEstContext *ctx) | 
| Init & allocate context ctx accordingly to the method used.  More... | |
| bool | motion_estimation (MotionEstContext *ctx, uint8_t *img_prev, uint8_t *img_cur) | 
| motion estimation wrapper  More... | |
| uint64_t | me_comp_sad (MotionEstContext *me_ctx, int x_mb, int y_mb, int x_mv, int y_mv) | 
| omputes the Sum of Absolute Difference (SAD) for the given two blocks  More... | |
 
motion header
| bool init_context | ( | MotionEstContext * | ctx | ) | 
Init & allocate context ctx accordingly to the method used.
| ctx | : motion estimation context object | 
| uint64_t me_comp_sad | ( | MotionEstContext * | me_ctx, | 
| int | x_mb, | ||
| int | y_mb, | ||
| int | x_mv, | ||
| int | y_mv | ||
| ) | 
omputes the Sum of Absolute Difference (SAD) for the given two blocks
\[ SAD = \sum_{i=0}^{mbSize}\sum_{j=0}^{mbSize} |Cur_{ij}-Ref_{ij}| \]
Used as cost function for EPZS algorithm.
| me_ctx | |
| x_mb | curr frame x located MB (MacroBlock) | 
| y_mb | curr frame y located MB | 
| x_mv | prev frame x located MB | 
| y_mv | prev frame y located MB | 
| bool motion_estimation | ( | MotionEstContext * | ctx, | 
| uint8_t * | img_prev, | ||
| uint8_t * | img_cur | ||
| ) | 
motion estimation wrapper
Example usage :
| ctx | Motion vectors will be saved in (MotionVector16_t) ctx->mv_table[0] | 
| void uninit | ( | MotionEstContext * | ctx | ) |