]> git.sesse.net Git - nageru/blobdiff - jpeg_frame_view.h
Subsample chroma on the GPU instead of the CPU.
[nageru] / jpeg_frame_view.h
index 1f7b2b7a67108a88e6baaaddcdbd436d0b746b4e..5d97b074b5d706164ce33542053d86448a97fac4 100644 (file)
 
 #include <memory>
 
+struct JPEGID {
+       unsigned stream_idx;
+       int64_t pts;
+};
 struct Frame {
        std::unique_ptr<uint8_t[]> y, cb, cr;
        unsigned width, height;
        unsigned chroma_subsampling_x, chroma_subsampling_y;
        unsigned pitch_y, pitch_chroma;
 };
+enum CacheMissBehavior {
+       DECODE_IF_NOT_IN_CACHE,
+       RETURN_NULLPTR_IF_NOT_IN_CACHE
+};
 
 std::string filename_for_frame(unsigned stream_idx, int64_t pts);
 std::shared_ptr<Frame> decode_jpeg(const std::string &filename);
+std::shared_ptr<Frame> decode_jpeg_with_cache(JPEGID id, CacheMissBehavior cache_miss_behavior, bool *did_decode);
 
 class JPEGFrameView : public QGLWidget {
        Q_OBJECT