Blender  V3.3
libmv/autotrack/frame_accessor.h
Go to the documentation of this file.
1 // Copyright (c) 2014 libmv authors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to
5 // deal in the Software without restriction, including without limitation the
6 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 // sell copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19 // IN THE SOFTWARE.
20 //
21 // Author: mierle@gmail.com (Keir Mierle)
22 
23 #ifndef LIBMV_AUTOTRACK_FRAME_ACCESSOR_H_
24 #define LIBMV_AUTOTRACK_FRAME_ACCESSOR_H_
25 
26 #include <stdint.h>
27 
28 #include "libmv/image/image.h"
29 
30 namespace mv {
31 
32 struct Region;
33 
34 using libmv::FloatImage;
35 
36 // This is the abstraction to different sources of images that will be part of
37 // a reconstruction. These may come from disk or they may come from Blender. In
38 // most cases it's expected that the implementation provides some caching
39 // otherwise performance will be terrible. Sometimes the images need to get
40 // filtered, and this interface provides for that as well (and permits
41 // implementations to cache filtered image pieces).
42 struct FrameAccessor {
43  struct Transform {
44  virtual ~Transform() {}
45  // The key should depend on the transform arguments. Must be non-zero.
46  virtual int64_t key() const = 0;
47 
48  // Apply the expected transform. Output is sized correctly already.
49  // TODO(keir): What about blurs that need to access pixels outside the ROI?
50  virtual void run(const FloatImage& input, FloatImage* output) const = 0;
51  };
52 
53  enum InputMode { MONO, RGBA };
54 
55  typedef void* Key;
56 
57  // Get a possibly-filtered version of a frame of a video. Downscale will
58  // cause the input image to get downscaled by 2^downscale for pyramid access.
59  // Region is always in original-image coordinates, and describes the
60  // requested area. The transform describes an (optional) transform to apply
61  // to the image before it is returned.
62  //
63  // When done with an image, you must call ReleaseImage with the returned key.
64  virtual Key GetImage(int clip,
65  int frame,
67  int downscale, // Downscale by 2^downscale.
68  const Region* region, // Get full image if NULL.
69  const Transform* transform, // May be NULL.
70  FloatImage* destination) = 0;
71 
72  // Releases an image from the frame accessor. Non-caching implementations may
73  // free the image immediately; others may hold onto the image.
74  virtual void ReleaseImage(Key) = 0;
75 
76  // Get mask image for the given track.
77  //
78  // Implementation of this method should sample mask associated with the track
79  // within given region to the given destination.
80  //
81  // Result is supposed to be a single channel image.
82  //
83  // If region is NULL, it assumed to be full-frame.
84  virtual Key GetMaskForTrack(int clip,
85  int frame,
86  int track,
87  const Region* region,
88  FloatImage* destination) = 0;
89 
90  // Release a specified mask.
91  //
92  // Non-caching implementation may free used memory immediately.
93  virtual void ReleaseMask(Key key) = 0;
94 
95  virtual bool GetClipDimensions(int clip, int* width, int* height) = 0;
96  virtual int NumClips() = 0;
97  virtual int NumFrames(int clip) = 0;
98 };
99 
100 } // namespace mv
101 
102 #endif // LIBMV_AUTOTRACK_FRAME_ACCESSOR_H_
long input_mode
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
ccl_global KernelShaderEvalInput ccl_global float * output
ccl_global KernelShaderEvalInput * input
Array3Df FloatImage
__int64 int64_t
Definition: stdint.h:89
virtual void run(const FloatImage &input, FloatImage *output) const =0
virtual int64_t key() const =0
virtual bool GetClipDimensions(int clip, int *width, int *height)=0
virtual Key GetImage(int clip, int frame, InputMode input_mode, int downscale, const Region *region, const Transform *transform, FloatImage *destination)=0
virtual int NumClips()=0
virtual Key GetMaskForTrack(int clip, int frame, int track, const Region *region, FloatImage *destination)=0
virtual int NumFrames(int clip)=0
virtual void ReleaseMask(Key key)=0
virtual void ReleaseImage(Key)=0