00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef _ME_UTILS_H_
00039 #define _ME_UTILS_H_
00040
00041 #include <algorithm>
00042 #include <libdirac_common/motion.h>
00043 #include <libdirac_common/common.h>
00044 namespace dirac
00045 {
00046
00048
00049
00051
00053 class BlockDiffParams
00054 {
00055
00056 public:
00058 BlockDiffParams(){}
00059
00061 BlockDiffParams( const int x_p , const int y_p , const int x_l , const int y_l):
00062 m_xp(x_p),
00063 m_yp(y_p),
00064 m_xl(x_l),
00065 m_yl(y_l)
00066 {}
00067
00069
00071
00072
00073
00074
00076
00077 void SetBlockLimits( const OLBParams& bparams ,
00078 const PicArray& pic_data ,
00079 const int xbpos , const int ybpos);
00080
00081
00082
00084 const int Xp() const {return m_xp;}
00085
00087 const int Yp() const {return m_yp;}
00088
00090 const int Xl() const {return m_xl;}
00091
00093 const int Yl() const {return m_yl;}
00094
00095 private:
00096
00097 int m_xp;
00098 int m_yp;
00099 int m_xl;
00100 int m_yl;
00101
00102 };
00103
00105
00106
00108
00110 class BlockDiff
00111 {
00112 public:
00114
00115
00116
00117
00118
00119 BlockDiff( const PicArray& ref , const PicArray& pic );
00120
00122 virtual ~BlockDiff(){}
00123
00125
00130 virtual float Diff( const BlockDiffParams& dparams , const MVector& mv )=0;
00131
00132 protected:
00133
00134 const PicArray& pic_data;
00135 const PicArray& ref_data;
00136
00137 private:
00139 BlockDiff( const BlockDiff& cpy );
00140
00142 BlockDiff& operator=( const BlockDiff& rhs );
00143 };
00144
00146 class SimpleBlockDiff: public BlockDiff
00147 {
00148 public:
00150
00151
00152
00153
00154
00155 SimpleBlockDiff( const PicArray& ref , const PicArray& pic );
00156
00158
00163 float Diff( const BlockDiffParams& dparams , const MVector& mv );
00164
00165 private:
00167 SimpleBlockDiff(const SimpleBlockDiff& cpy);
00168
00170 SimpleBlockDiff& operator=(const SimpleBlockDiff& rhs);
00171 };
00172
00174 class BChkBlockDiff: public BlockDiff
00175 {
00176 public:
00178
00179
00180
00181
00182
00183 BChkBlockDiff( const PicArray& ref , const PicArray& pic );
00184
00186
00191 float Diff( const BlockDiffParams& dparams , const MVector& mv );
00192
00193 private:
00195 BChkBlockDiff(const BChkBlockDiff& cpy);
00196
00198 BChkBlockDiff& operator=(const BChkBlockDiff& rhs);
00199 };
00200
00202 class IntraBlockDiff
00203 {
00204 public:
00206
00207
00208
00209
00210 IntraBlockDiff( const PicArray& pic );
00211
00213
00218 float Diff( const BlockDiffParams& dparams , ValueType& dc_val );
00219
00220 private:
00222 IntraBlockDiff(const IntraBlockDiff& cpy);
00223
00225 IntraBlockDiff& operator=(const IntraBlockDiff& rhs);
00226
00227 const PicArray& pic_data;
00228 };
00229
00231 class BiBlockDiff
00232 {
00233 public:
00235
00236
00237
00238
00239
00240
00241 BiBlockDiff( const PicArray& ref1 , const PicArray& ref2 , const PicArray& pic);
00242
00244
00250 virtual float Diff( const BlockDiffParams& dparams , const MVector& mv1 , const MVector& mv2 )=0;
00251
00252 protected:
00253 const PicArray& pic_data;
00254 const PicArray& ref_data1;
00255 const PicArray& ref_data2;
00256
00257 private:
00259 BiBlockDiff(const BiBlockDiff& cpy);
00260
00262 BiBlockDiff& operator=(const BiBlockDiff& rhs);
00263 };
00264
00265
00267 class BiSimpleBlockDiff: public BiBlockDiff
00268 {
00269 public:
00270
00272
00273
00274
00275
00276
00277
00278 BiSimpleBlockDiff( const PicArray& ref1 , const PicArray& ref2 , const PicArray& pic);
00279
00281
00287 float Diff( const BlockDiffParams& dparams , const MVector& mv1 , const MVector& mv2 );
00288
00289 private:
00291 BiSimpleBlockDiff(const BiSimpleBlockDiff& cpy);
00292
00294 BiSimpleBlockDiff& operator=(const BiSimpleBlockDiff& rhs);
00295
00296 };
00297
00299 class BiBChkBlockDiff: public BiBlockDiff
00300 {
00301 public:
00303 BiBChkBlockDiff( const PicArray& ref1 , const PicArray& ref2 , const PicArray& pic );
00304
00306
00312 float Diff( const BlockDiffParams& dparams , const MVector& mv1 , const MVector& mv2 );
00313
00314 private:
00316 BiBChkBlockDiff(const BiBChkBlockDiff& cpy);
00317
00319 BiBChkBlockDiff& operator=(const BiBChkBlockDiff& rhs);
00320
00321 };
00322
00323
00324
00326 class BlockDiffUp: public BlockDiff
00327 {
00328 public:
00330
00331
00332
00333
00334
00335 BlockDiffUp( const PicArray& ref , const PicArray& pic);
00336
00338 virtual ~BlockDiffUp(){}
00339
00341
00346 virtual float Diff( const BlockDiffParams& dparams , const MVector& mv )=0;
00347
00348 protected:
00350 int InterpLookup[9][4];
00351
00352 private:
00354 BlockDiffUp(const BlockDiffUp& cpy);
00355
00357 BlockDiffUp& operator=(const BlockDiffUp& rhs);
00358
00359 };
00360
00362 class SimpleBlockDiffUp: public BlockDiffUp
00363 {
00364 public:
00366
00367
00368
00369
00370
00371 SimpleBlockDiffUp( const PicArray& ref , const PicArray& pic );
00372
00374 ~SimpleBlockDiffUp(){}
00375
00377
00382 float Diff( const BlockDiffParams& dparams , const MVector& mv );
00383
00384 private:
00386 SimpleBlockDiffUp(const SimpleBlockDiffUp& cpy);
00387
00389 SimpleBlockDiffUp& operator=(const SimpleBlockDiffUp& rhs);
00390 };
00391
00393 class BChkBlockDiffUp: public BlockDiffUp{
00394
00395 public:
00397
00398
00399
00400
00401
00402 BChkBlockDiffUp(const PicArray& ref,const PicArray& pic);
00403
00405 ~BChkBlockDiffUp(){}
00406
00408
00413 float Diff( const BlockDiffParams& dparams , const MVector& mv );
00414 private:
00416 BChkBlockDiffUp(const BChkBlockDiffUp& cpy);
00417
00419 BChkBlockDiffUp& operator=(const BChkBlockDiffUp& rhs);
00420 };
00421
00423 class BiBlockDiffUp: public BiBlockDiff
00424 {
00425 public:
00427
00428
00429
00430
00431
00432
00433 BiBlockDiffUp( const PicArray& ref1 , const PicArray& ref2 , const PicArray& pic);
00434
00436 virtual ~BiBlockDiffUp(){}
00437
00439
00445 virtual float Diff( const BlockDiffParams& dparams , const MVector& mv1 , const MVector& mv2 )=0;
00446 protected:
00448 int InterpLookup[9][4];
00449
00450 private:
00452 BiBlockDiffUp(const BlockDiffUp& cpy);
00453
00455 BiBlockDiffUp& operator=(const BlockDiffUp& rhs);
00456
00457 };
00458
00460 class BiSimpleBlockDiffUp: public BiBlockDiffUp
00461 {
00462 public:
00464
00465
00466
00467
00468
00469
00470 BiSimpleBlockDiffUp( const PicArray& ref1 , const PicArray& ref2 , const PicArray& pic );
00471
00473
00479 float Diff( const BlockDiffParams& dparams , const MVector& mv1 , const MVector& mv2 );
00480 private:
00482 BiSimpleBlockDiffUp(const BiSimpleBlockDiffUp& cpy);
00483
00485 BiSimpleBlockDiffUp& operator=(const BiSimpleBlockDiffUp& rhs);
00486 };
00487
00489 class BiBChkBlockDiffUp: public BiBlockDiffUp
00490 {
00491 public:
00493
00494
00495
00496
00497
00498
00499 BiBChkBlockDiffUp( const PicArray& ref , const PicArray& ref2 , const PicArray& pic );
00500
00502
00508 float Diff( const BlockDiffParams& dparams , const MVector& mv1 , const MVector& mv2 );
00509 private:
00511 BiBChkBlockDiffUp(const BiBChkBlockDiffUp& cpy);
00512
00514 BiBChkBlockDiffUp& operator=(const BiBChkBlockDiffUp& rhs);
00515 };
00516
00517 }
00518 #endif