tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

optical_flow.h (2068B)


      1 /*
      2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
      3 *
      4 * This source code is subject to the terms of the BSD 2 Clause License and
      5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
      6 * was not distributed with this source code in the LICENSE file, you can
      7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
      8 * Media Patent License 1.0 was not distributed with this source code in the
      9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
     10 */
     11 
     12 #ifndef AOM_AV1_ENCODER_OPTICAL_FLOW_H_
     13 #define AOM_AV1_ENCODER_OPTICAL_FLOW_H_
     14 
     15 #include "aom_scale/yv12config.h"
     16 #include "av1/common/mv.h"
     17 #include "config/aom_config.h"
     18 
     19 #ifdef __cplusplus
     20 extern "C" {
     21 #endif
     22 
     23 #if CONFIG_OPTICAL_FLOW_API
     24 
     25 typedef enum { LUCAS_KANADE, HORN_SCHUNCK } OPTFLOW_METHOD;
     26 
     27 typedef enum {
     28  MV_FILTER_NONE,
     29  MV_FILTER_SMOOTH,
     30  MV_FILTER_MEDIAN
     31 } MV_FILTER_TYPE;
     32 
     33 typedef struct LOCALMV {
     34  double row;
     35  double col;
     36 } LOCALMV;
     37 
     38 #define MAX_PYRAMID_LEVELS 5
     39 // default options for optical flow
     40 #define OPFL_WINDOW_SIZE 15
     41 #define OPFL_PYRAMID_LEVELS 3  // total levels
     42 #define OPFL_WARPING_STEPS 3
     43 
     44 // parameters specific to Lucas-Kanade
     45 typedef struct lk_params {
     46  int window_size;
     47 } LK_PARAMS;
     48 
     49 // generic structure to contain parameters for all
     50 // optical flow algorithms
     51 typedef struct opfl_params {
     52  int pyramid_levels;
     53  int warping_steps;
     54  LK_PARAMS *lk_params;
     55  int flags;
     56 } OPFL_PARAMS;
     57 
     58 #define OPFL_FLAG_SPARSE 1
     59 
     60 void av1_init_opfl_params(OPFL_PARAMS *opfl_params);
     61 
     62 void av1_init_lk_params(LK_PARAMS *lk_params);
     63 
     64 void av1_optical_flow(const YV12_BUFFER_CONFIG *from_frame,
     65                      const YV12_BUFFER_CONFIG *to_frame,
     66                      const int from_frame_idx, const int to_frame_idx,
     67                      const int bit_depth, const OPFL_PARAMS *opfl_params,
     68                      const MV_FILTER_TYPE mv_filter,
     69                      const OPTFLOW_METHOD method, MV *mvs);
     70 #endif
     71 
     72 #ifdef __cplusplus
     73 }  // extern "C"
     74 #endif
     75 
     76 #endif  // AOM_AV1_ENCODER_OPTICAL_FLOW_H_