ffmpeg_the_third/codec/encoder/
motion_estimation.rs

1use libc::c_int;
2#[cfg(feature = "serialize")]
3use serde::{Deserialize, Serialize};
4
5#[derive(Eq, PartialEq, Clone, Copy, Debug)]
6#[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))]
7pub enum MotionEstimation {
8    Zero,
9    Full,
10    Log,
11    Phods,
12    Epzs,
13    X1,
14    Hex,
15    Umh,
16    Iter,
17    Tesa,
18}
19
20impl From<c_int> for MotionEstimation {
21    fn from(value: c_int) -> MotionEstimation {
22        match value {
23            1 => MotionEstimation::Zero,
24            2 => MotionEstimation::Full,
25            3 => MotionEstimation::Log,
26            4 => MotionEstimation::Phods,
27            5 => MotionEstimation::Epzs,
28            6 => MotionEstimation::X1,
29            7 => MotionEstimation::Hex,
30            8 => MotionEstimation::Umh,
31            9 => MotionEstimation::Iter,
32            10 => MotionEstimation::Tesa,
33
34            _ => MotionEstimation::Zero,
35        }
36    }
37}
38
39impl From<MotionEstimation> for c_int {
40    fn from(value: MotionEstimation) -> c_int {
41        match value {
42            MotionEstimation::Zero => 1,
43            MotionEstimation::Full => 2,
44            MotionEstimation::Log => 3,
45            MotionEstimation::Phods => 4,
46            MotionEstimation::Epzs => 5,
47            MotionEstimation::X1 => 6,
48            MotionEstimation::Hex => 7,
49            MotionEstimation::Umh => 8,
50            MotionEstimation::Iter => 9,
51            MotionEstimation::Tesa => 10,
52        }
53    }
54}