3 Copyright (c) 2003-2015 HandBrake Team
4 This file is part of the HandBrake source code
5 Homepage: <http://handbrake.fr/>.
6 It may be used under the terms of the GNU General Public License v2.
7 For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html
10 // Used to order a sequeunce of metrics for median filtering
11 void eedi2_sort_metrics( int *order
, const int length
);
13 // Aping some Windows API funcctions AviSynth seems to like
14 // Taken from here: http://www.gidforums.com/t-8543.html
15 void *eedi2_aligned_malloc(size_t size
, size_t align_size
);
16 void eedi2_aligned_free(void *ptr
);
19 void eedi2_bit_blit( uint8_t * dstp
, int dst_pitch
, const uint8_t * srcp
, int src_pitch
,
20 int row_size
, int height
);
22 // Sets up the initial field-sized bitmap EEDI2 interpolates from
23 void eedi2_fill_half_height_buffer_plane( uint8_t * src
, uint8_t * dst
, int pitch
, int height
);
25 // Simple line doubler
26 void eedi2_upscale_by_2( uint8_t * srcp
, uint8_t * dstp
, int height
, int pitch
);
28 // Finds places where vertically adjacent pixels abruptly change intensity
29 void eedi2_build_edge_mask( uint8_t * dstp
, int dst_pitch
, uint8_t *srcp
, int src_pitch
,
30 int mthresh
, int lthresh
, int vthresh
, int height
, int width
);
32 // Expands and smooths out the edge mask by considering a pixel
33 // to be masked if >= dilation threshold adjacent pixels are masked.
34 void eedi2_dilate_edge_mask( uint8_t *mskp
, int msk_pitch
, uint8_t *dstp
, int dst_pitch
,
35 int dstr
, int height
, int width
);
37 // Contracts the edge mask by considering a pixel to be masked
38 // only if > erosion threshold adjacent pixels are masked
39 void eedi2_erode_edge_mask( uint8_t *mskp
, int msk_pitch
, uint8_t *dstp
, int dst_pitch
,
40 int estr
, int height
, int width
);
42 // Smooths out horizontally aligned holes in the mask
43 // If none of the 6 horizontally adjacent pixels are masked,
44 // don't consider the current pixel masked. If there are any
45 // masked on both sides, consider the current pixel masked.
46 void eedi2_remove_small_gaps( uint8_t * mskp
, int msk_pitch
, uint8_t * dstp
, int dst_pitch
,
47 int height
, int width
);
49 // Spatial vectors. Looks at maximum_search_distance surrounding pixels
50 // to guess which angle edges follow. This is EEDI2's timesink, and can be
51 // thought of as YADIF_CHECK on steroids. Both find edge directions.
52 void eedi2_calc_directions( const int plane
, uint8_t * mskp
, int msk_pitch
, uint8_t * srcp
, int src_pitch
,
53 uint8_t * dstp
, int dst_pitch
, int maxd
, int nt
, int height
, int width
);
55 void eedi2_filter_map( uint8_t *mskp
, int msk_pitch
, uint8_t *dmskp
, int dmsk_pitch
,
56 uint8_t * dstp
, int dst_pitch
, int height
, int width
);
58 void eedi2_filter_dir_map( uint8_t * mskp
, int msk_pitch
, uint8_t * dmskp
, int dmsk_pitch
, uint8_t * dstp
,
59 int dst_pitch
, int height
, int width
);
61 void eedi2_expand_dir_map( uint8_t * mskp
, int msk_pitch
, uint8_t *dmskp
, int dmsk_pitch
, uint8_t * dstp
,
62 int dst_pitch
, int height
, int width
);
64 void eedi2_mark_directions_2x( uint8_t * mskp
, int msk_pitch
, uint8_t * dmskp
, int dmsk_pitch
, uint8_t * dstp
,
65 int dst_pitch
, int tff
, int height
, int width
);
67 void eedi2_filter_dir_map_2x( uint8_t * mskp
, int msk_pitch
, uint8_t * dmskp
, int dmsk_pitch
, uint8_t * dstp
,
68 int dst_pitch
, int field
, int height
, int width
);
70 void eedi2_expand_dir_map_2x( uint8_t * mskp
, int msk_pitch
, uint8_t * dmskp
, int dmsk_pitch
, uint8_t * dstp
,
71 int dst_pitch
, int field
, int height
, int width
);
73 void eedi2_fill_gaps_2x( uint8_t *mskp
, int msk_pitch
, uint8_t * dmskp
, int dmsk_pitch
, uint8_t * dstp
,
74 int dst_pitch
, int field
, int height
, int width
);
76 void eedi2_interpolate_lattice( const int plane
, uint8_t * dmskp
, int dmsk_pitch
, uint8_t * dstp
,
77 int dst_pitch
, uint8_t * omskp
, int omsk_pitch
, int field
, int nt
,
78 int height
, int width
);
80 void eedi2_post_process( uint8_t * nmskp
, int nmsk_pitch
, uint8_t * omskp
, int omsk_pitch
, uint8_t * dstp
,
81 int src_pitch
, int field
, int height
, int width
);
83 void eedi2_gaussian_blur1( uint8_t * src
, int src_pitch
, uint8_t * tmp
, int tmp_pitch
, uint8_t * dst
,
84 int dst_pitch
, int height
, int width
);
86 void eedi2_gaussian_blur_sqrt2( int *src
, int *tmp
, int *dst
, const int pitch
,
87 const int height
, const int width
);
89 void eedi2_calc_derivatives( uint8_t *srcp
, int src_pitch
, int height
, int width
,
90 int *x2
, int *y2
, int *xy
);
92 void eedi2_post_process_corner( int *x2
, int *y2
, int *xy
, const int pitch
, uint8_t * mskp
, int msk_pitch
,
93 uint8_t * dstp
, int dst_pitch
, int height
, int width
, int field
);