sframe

Simple Frame — extract unique frames from videos
git clone git clone https://git.krisyotam.com/krisyotam/sframe.git
Log | Files | Refs | README | LICENSE

diff.h (709B)


      1 /* See LICENSE file for copyright and license details. */
      2 
      3 #ifndef DIFF_H
      4 #define DIFF_H
      5 
      6 #include <stdint.h>
      7 
      8 #include <libavutil/frame.h>
      9 #include <libswscale/swscale.h>
     10 
     11 /*
     12  * 64-bit perceptual hash (8x8 average hash).
     13  * Two frames with hamming distance <= threshold are
     14  * considered duplicates.
     15  */
     16 uint64_t diff_phash(AVFrame *frame, struct SwsContext *sws,
     17                     int src_w, int src_h);
     18 int diff_hamming(uint64_t a, uint64_t b);
     19 
     20 /*
     21  * Save an RGB frame to disk as PNG or JPEG.
     22  * fmt: "png" or "jpg"
     23  */
     24 int diff_save_frame(AVFrame *frame, struct SwsContext *sws_rgb,
     25                     int src_w, int src_h,
     26                     const char *path, const char *fmt);
     27 
     28 #endif /* DIFF_H */