~kris/hacks

sframe

sframe/src/diff.h -rw-r--r-- 709 bytes
0d0fb70a — Kris Yotam convert README.md to README.txt 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* See LICENSE file for copyright and license details. */

#ifndef DIFF_H
#define DIFF_H

#include <stdint.h>

#include <libavutil/frame.h>
#include <libswscale/swscale.h>

/*
 * 64-bit perceptual hash (8x8 average hash).
 * Two frames with hamming distance <= threshold are
 * considered duplicates.
 */
uint64_t diff_phash(AVFrame *frame, struct SwsContext *sws,
                    int src_w, int src_h);
int diff_hamming(uint64_t a, uint64_t b);

/*
 * Save an RGB frame to disk as PNG or JPEG.
 * fmt: "png" or "jpg"
 */
int diff_save_frame(AVFrame *frame, struct SwsContext *sws_rgb,
                    int src_w, int src_h,
                    const char *path, const char *fmt);

#endif /* DIFF_H */