# Dirac - A Video Codec

Created by the British Broadcasting Corporation.

common.h
Go to the documentation of this file.
1 /* ***** BEGIN LICENSE BLOCK *****
2 *
3 * $Id: common.h,v 1.79 2008/10/01 01:26:47 asuraparaju Exp $ $Name: Dirac_1_0_2 $
4 *
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 *
7 * The contents of this file are subject to the Mozilla Public License
8 * Version 1.1 (the "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 * http://www.mozilla.org/MPL/
11 *
12 * Software distributed under the License is distributed on an "AS IS" basis,
13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
14 * the specific language governing rights and limitations under the License.
15 *
16 * The Original Code is BBC Research and Development code.
17 *
18 * The Initial Developer of the Original Code is the British Broadcasting
19 * Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 2004.
21 * All Rights Reserved.
22 *
23 * Contributor(s): Thomas Davies (Original Author),
24 * Scott R Ladd,
25 * Tim Borer,
26 * Anuradha Suraparaju,
27 * Andrew Kennedy
28 * Myo Tun (Brunel University, myo.tun@brunel.ac.uk)
29 *
30 * Alternatively, the contents of this file may be used under the terms of
31 * the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
32 * Public License Version 2.1 (the "LGPL"), in which case the provisions of
33 * the GPL or the LGPL are applicable instead of those above. If you wish to
34 * allow use of your version of this file only under the terms of the either
35 * the GPL or LGPL and not to allow others to use your version of this file
36 * under the MPL, indicate your decision by deleting the provisions above
37 * and replace them with the notice and other provisions required by the GPL
38 * or LGPL. If you do not delete the provisions above, a recipient may use
39 * your version of this file under the terms of any one of the MPL, the GPL
40 * or the LGPL.
41 * ***** END LICENSE BLOCK ***** */
42
43 #ifndef _COMMON_H_
44 #define _COMMON_H_
45
46 #ifdef _MSC_VER
47 #define _CRT_SECURE_NO_DEPRECATE
48 #endif // _MSC_VER
49
50 #include <libdirac_common/arrays.h>
51 #include <libdirac_common/common_types.h>
52 #include <libdirac_common/dirac_assertions.h>
53 #include <vector>
54 #include <cmath>
55 namespace dirac
56 {
66 //Some basic types used throughout the codec ...//
68
70 typedef short ValueType;
71
72 #if !defined(HAVE_MMX)
73 typedef int CoeffType;
75 #else
76 typedef short CoeffType;
78 #endif
79
81 typedef int CalcValueType;
82
84 enum PredMode{ INTRA , REF1_ONLY , REF2_ONLY , REF1AND2, UNDEFINED };
85
87 enum CompSort{ Y_COMP , U_COMP , V_COMP };
88
90 enum AddOrSub{ ADD , SUBTRACT };
91
93 enum Direction { FORWARD , BACKWARD };
94
96 enum CtxAliases
97 {//used for residual coding
98 SIGN0_CTX, // -sign, previous symbol is 0
99 SIGN_POS_CTX, // -sign, previous symbol is +ve
100 SIGN_NEG_CTX, // -sign, previous symbol is -ve
101
102 // Follow bit contexts
103 Z_FBIN1z_CTX, // -bin 1, parent is zero, neighbours zero
104 Z_FBIN1nz_CTX, // -bin 1, parent is zero, neighbours non-zero
105 Z_FBIN2_CTX, // -bin 2, parent is zero
106 Z_FBIN3_CTX, // -bin 3, parent is zero
107 Z_FBIN4_CTX, // -bin 4, parent is zero
108 Z_FBIN5_CTX, // -bin 5, parent is zero
109 Z_FBIN6plus_CTX, // -bins 6 plus, parent is zero
110
111 NZ_FBIN1z_CTX, // -bin 1, parent is non-zero, neighbours zero
112 NZ_FBIN1nz_CTX, // -bin 1, parent is non-zero, neighbours non-zero
113 NZ_FBIN2_CTX, // -bin 2, parent is non-zero
114 NZ_FBIN3_CTX, // -bin 3, parent is non-zero
115 NZ_FBIN4_CTX, // -bin 4, parent is non-zero
116 NZ_FBIN5_CTX, // -bin 5, parent is non-zero
117 NZ_FBIN6plus_CTX, // -bins 6 plus, parent is non-zero
118
119 // Information bit contexts
120 INFO_CTX,
121
122 BLOCK_SKIP_CTX, // - blocks are skipped
123 Q_OFFSET_FOLLOW_CTX, // - code block quantiser offset magnitude
124 Q_OFFSET_INFO_CTX, // - code block quantiser offset info context
125 Q_OFFSET_SIGN_CTX, // - code block quantiser offset sign
126 TOTAL_COEFF_CTXS // The total number of coefficient contexts
127 };
128
130 enum MvCtxAliases
131 {
132 // DC value contexts //
134
135 DC_FBIN1_CTX,
136 DC_FBIN2plus_CTX,
137 DC_INFO_CTX,
138 DC_SIGN_CTX,
139
140 // Motion vector contexts //
142
143
144 MV_FBIN1_CTX,
145 MV_FBIN2_CTX,
146 MV_FBIN3_CTX,
147 MV_FBIN4_CTX,
148 MV_FBIN5plus_CTX,
149
150 MV_INFO_CTX,
151
152 MV_SIGN_CTX,
153
154
155 // Prediction mode contexts
156
157 PMODE_BIT0_CTX, // -bit 0, prediction mode value
158 PMODE_BIT1_CTX, // -bin 1, prediction mode value
159
160
161 // Macroblock contexts
162
163 SB_SPLIT_BIN1_CTX, // bin 1, SB split mode vals
164 SB_SPLIT_BIN2_CTX, // bin 2, SB split mode vals. Bin 3 not required
165
166 SB_SPLIT_INFO_CTX, // info context for SB split mode
167
168 TOTAL_MV_CTXS // The total number of motion vector contexts
169 };
170
171
177 VideoFormat IntToVideoFormat(int video_format);
178
184 ChromaFormat IntToChromaFormat(int chroma_format);
185
191 FrameRateType IntToFrameRateType(int frame_rate_idx);
192
198 PixelAspectRatioType IntToPixelAspectRatioType(int pix_asr_idx);
199
205 SignalRangeType IntToSignalRangeType(int signal_range_idx);
206
212 MVPrecisionType IntToMVPrecisionType(int mv_prec);
213
214 //Classes used throughout the codec//
216
218 class Rational
219 {
220 public:
222 unsigned int m_num;
224 unsigned int m_denom;
225 };
226
228 class PictureSort
229 {
230 public:
231 PictureSort() { fs = 0x00; } // default intra non-ref
232
233 void SetIntra() { fs &= 0xfe; }
234 void SetInter() { fs |= 0x01; }
235 void SetNonRef() { fs &= 0xfd; }
236 void SetRef() { fs |= 0x02; }
237
238 bool IsInter () const { return fs & 0x01; }
239 bool IsIntra () const { return !IsInter(); }
240 bool IsRef() const { return fs & 0x02; };
241 bool IsNonRef() const { return !IsRef(); }
242
243 void SetIntraNonRef() { SetIntra(); SetNonRef(); }
244 void SetIntraRef() { SetIntra(); SetRef(); }
245 void SetInterNonRef() { SetInter(); SetNonRef(); }
246 void SetInterRef() { SetInter(); SetRef(); }
247
248 bool IsIntraNonRef() const { return (fs & 0x03) == 0x00; }
249 bool IsIntraRef() const { return (fs & 0x03) == 0x02; }
250 bool IsInterNonRef() const { return (fs & 0x03) == 0x01; }
251 bool IsInterRef() const { return (fs & 0x03) == 0x03; }
252
253 void Clear() { fs=0x00; }
254
255 static PictureSort IntraRefPictureSort()
256 {
257 PictureSort fs;
258 fs.SetIntraRef();
259 return fs;
260 }
261
262 static PictureSort InterRefPictureSort()
263 {
264 PictureSort fs;
265 fs.SetInterRef();
266 return fs;
267 }
268
269 static PictureSort IntraNonRefPictureSort()
270 {
271 PictureSort fs;
272 fs.SetIntraNonRef();
273 return fs;
274 }
275
276 static PictureSort InterNonRefPictureSort()
277 {
278 PictureSort fs;
279 fs.SetInterNonRef();
280 return fs;
281 }
282
283 private:
284 unsigned char fs;
285 };
286
288 class SourceParams
289 {
290 public:
292 SourceParams (const VideoFormat &vf = VIDEO_FORMAT_CUSTOM,
293 bool set_defaults=true);
294
296 //NB: Assume default copy constructor, assignment = and destructor//
298
299 // Gets
301 VideoFormat GetVideoFormat() const { return m_video_format;}
302
304 unsigned int Xl() const {return m_xl;}
305
307 unsigned int Yl() const {return m_yl;}
308
310 ChromaFormat CFormat() const {return m_cformat;}
311
313 int ChromaWidth() const;
314
316 int ChromaHeight() const;
317
319 unsigned int SourceSampling() const { return m_source_sampling; }
320
322 bool TopFieldFirst() const { return m_topfieldfirst; }
323
325 Rational FrameRate() const { return m_framerate; }
326
328 FrameRateType FrameRateIndex() const { return m_fr_idx; }
329
331 Rational PixelAspectRatio() const { return m_pixel_aspect_ratio; }
332
334 PixelAspectRatioType PixelAspectRatioIndex() const { return m_pix_asr_idx; }
335
336 // Clean area parameters
338 unsigned int CleanWidth() const { return m_clean_width; }
340 unsigned int CleanHeight() const { return m_clean_height; }
342 unsigned int LeftOffset() const { return m_left_offset; }
344 unsigned int TopOffset() const { return m_top_offset; }
345
346 // Signal Range parameters
347
349 SignalRangeType SignalRangeIndex() const { return m_sr_idx; }
350
352 unsigned int LumaOffset() const { return m_luma_offset; }
354 unsigned int LumaExcursion() const { return m_luma_excursion; }
356 unsigned int ChromaOffset() const { return m_chroma_offset; }
358 unsigned int ChromaExcursion() const { return m_chroma_excursion; }
359
361 unsigned int ColourSpecificationIndex() const { return m_cs_idx; }
362
364 ColourPrimaries ColourPrimariesIndex() const { return m_col_primary; }
366 ColourMatrix ColourMatrixIndex() const { return m_col_matrix; }
368 TransferFunction TransferFunctionIndex() const { return m_transfer_func; }
369
370 // Sets
371
373 void SetXl(unsigned int xlen) {m_xl = xlen;}
374
376 void SetYl(unsigned int ylen) {m_yl = ylen;}
377
379 void SetCFormat(ChromaFormat cf) {m_cformat=cf;}
380
382 void SetSourceSampling(unsigned int source_sampling)
383 { m_source_sampling = source_sampling; }
384
386 void SetTopFieldFirst(bool tff) { m_topfieldfirst = tff; }
387
389 void SetVideoFormat(VideoFormat vf){ m_video_format=vf;}
390
392 void SetFrameRate(const Rational &frate )
393 {
394 m_fr_idx = FRAMERATE_CUSTOM; m_framerate = frate;
395 }
396
398 void SetFrameRate(unsigned int fr_num, unsigned int fr_denom )
399 {
400 m_fr_idx = FRAMERATE_CUSTOM;
401 m_framerate.m_num = fr_num;
402 m_framerate.m_denom = fr_denom;
403 }
404
406 void SetFrameRate(FrameRateType fr);
407
409 void SetPixelAspectRatio(const Rational &pix_asr)
410 {
411 m_pix_asr_idx = PIXEL_ASPECT_RATIO_CUSTOM;
412 m_pixel_aspect_ratio = pix_asr;
413 }
414
416 void SetPixelAspectRatio(unsigned int pix_as_num, unsigned int pix_as_denom )
417 {
418 m_pix_asr_idx = PIXEL_ASPECT_RATIO_CUSTOM;
419 m_pixel_aspect_ratio.m_num = pix_as_num;
420 m_pixel_aspect_ratio.m_denom = pix_as_denom;
421 }
422
424 void SetPixelAspectRatio(PixelAspectRatioType pixel_aspect_ratio);
425
426 // Clean area parameters
428 void SetCleanWidth(unsigned int clean_width) { m_clean_width = clean_width; }
430 void SetCleanHeight(unsigned int clean_height) { m_clean_height = clean_height; }
432 void SetLeftOffset(unsigned int left_offset) { m_left_offset = left_offset; }
434 void SetTopOffset(unsigned int top_offset) { m_top_offset = top_offset; }
435
436 // Signal Range parameters
438 void SetSignalRange(SignalRangeType sr);
439
441 void SetLumaOffset(unsigned int luma_offset) { m_sr_idx = SIGNAL_RANGE_CUSTOM; m_luma_offset = luma_offset; }
443 void SetLumaExcursion(unsigned int luma_exc) { m_sr_idx = SIGNAL_RANGE_CUSTOM; m_luma_excursion = luma_exc; }
445 void SetChromaOffset(unsigned int chroma_off) { m_sr_idx = SIGNAL_RANGE_CUSTOM; m_chroma_offset = chroma_off; }
447 void SetChromaExcursion(unsigned int chroma_exc) { m_sr_idx = SIGNAL_RANGE_CUSTOM; m_chroma_excursion = chroma_exc; }
448
450 void SetColourSpecification(unsigned int cs_idx);
452 void SetColourPrimariesIndex(unsigned int cp);
454 void SetColourMatrixIndex(unsigned int cm);
456 void SetTransferFunctionIndex(unsigned int tf);
457
458 private:
460 VideoFormat m_video_format;
461
463 unsigned int m_xl;
464
466 unsigned int m_yl;
467
469 ChromaFormat m_cformat;
470
472 unsigned int m_source_sampling;
473
475 bool m_topfieldfirst;
476
478 FrameRateType m_fr_idx;
479
481 Rational m_framerate;
482
484 PixelAspectRatioType m_pix_asr_idx;
485
487 Rational m_pixel_aspect_ratio;
488
489 // Clean area parameters
490
492 unsigned int m_clean_width;
493
495 unsigned int m_clean_height;
496
498 unsigned int m_left_offset;
499
501 unsigned int m_top_offset;
502
503 // signal range parameters
504
506 SignalRangeType m_sr_idx;
507
509 unsigned int m_luma_offset;
511 unsigned int m_luma_excursion;
513 unsigned int m_chroma_offset;
515 unsigned int m_chroma_excursion;
516
518 unsigned int m_cs_idx;
519
521 ColourPrimaries m_col_primary;
522
523 // Colour Matrix index
524 ColourMatrix m_col_matrix;
525
526 // Transfer function index
527 TransferFunction m_transfer_func;
528 };
529
530
532 class PictureParams
533 {
534
535 public:
537 PictureParams();
538
540
543 PictureParams(const ChromaFormat& cf, int xlen, int ylen,
544 unsigned int luma_depth, unsigned int chroma_depth);
545
547
550 PictureParams(const ChromaFormat& cf, const PictureSort& fs);
551
553
556 PictureParams(const SourceParams& sparams);
557
559 //NB: Assume default copy constructor, assignment = and destructor//
561
562 // Gets ...
563
565 const ChromaFormat& CFormat() const{return m_cformat;}
566
568 int Xl() const {return m_xl;}
569
571 int Yl() const {return m_yl;}
572
574 int ChromaXl() const{return m_cxl;}
575
577 int ChromaYl() const{return m_cyl;}
578
580 unsigned int LumaDepth() const { return m_luma_depth; }
581
583 unsigned int ChromaDepth() const { return m_chroma_depth; }
584
586 const PictureSort& PicSort() const {return m_psort;}
587
589 int PictureNum() const {return m_fnum;}
590
592 int RetiredPictureNum() const {return m_retd_fnum;}
593
595 bool IsBPicture() const;
596
598 int ExpiryTime() const {return m_expiry_time;}
599
601 bool Output() const {return m_output;}
602
604 const std::vector<int>& Refs() const {return m_refs;}
605
607 std::vector<int>& Refs(){return m_refs;}
608
610 unsigned int NumRefs()const {return m_refs.size();}
611
613 PictureType GetPictureType () const { return m_picture_type; }
614
616 ReferenceType GetReferenceType() const { return m_reference_type;}
617
619 bool UsingAC() const { return m_using_ac; }
620
621 // ... Sets
622
624 void SetPicSort( const PictureSort& ps );
625
627 void SetPictureType(const PictureType ftype);
628
630 void SetReferenceType(const ReferenceType rtype);
631
633 void SetPictureNum( const int fn ){ m_fnum=fn; }
634
636 void SetExpiryTime( const int expt ){ m_expiry_time=expt; }
637
639 void SetAsOutput(){m_output=true;}
640
642 void SetCFormat(ChromaFormat cf){ m_cformat = cf; }
643
645 void SetXl(int xlen);
646
648 void SetYl(int ylen);
649
651 void SetLumaDepth(unsigned int luma_depth) { m_luma_depth = luma_depth; }
652
654 void SetChromaDepth(unsigned int chroma_depth) { m_chroma_depth = chroma_depth; }
655
657 void SetRetiredPictureNum(int retd_fnum) {m_retd_fnum = retd_fnum;}
658
660 void SetUsingAC(bool using_ac) { m_using_ac = using_ac; }
661
662 private:
663
665 ChromaFormat m_cformat;
666
668 PictureSort m_psort;
669
671 std::vector<int> m_refs;
672
674 int m_expiry_time;
675
677 int m_fnum;
678
680 PictureType m_picture_type;
681
683 ReferenceType m_reference_type;
684
686 bool m_output;
687
689 mutable int m_retd_fnum;
690
692 int m_xl;
693
695 int m_yl;
696
698 int m_cxl;
699
701 int m_cyl;
702
704 unsigned int m_luma_depth;
705
707 unsigned int m_chroma_depth;
708
710 bool m_using_ac;
711 };
712
713
715
718 class PicArray: public TwoDArray<ValueType>
719 {
720 public:
722
725 PicArray(): TwoDArray<ValueType>(){}
726
728
732 PicArray(int height, int width, CompSort cs=Y_COMP):
733 TwoDArray<ValueType>(height, width), m_csort(cs){}
734
735 //copy constructor and assignment= derived by inheritance
736
738 ~PicArray(){}
739
741 const CompSort& CSort() const {return m_csort;}
742
744 void SetCSort(const CompSort cs){ m_csort = cs; }
745
746 private:
747
748 CompSort m_csort;
749 };
750
751
753 class CostType
754 {
755 public:
757 double Error;
758
760 double ENTROPY;
761
763 double TOTAL;
764 };
765
766
768
773 class EntropyCorrector
774 {
775 public:
777
781 EntropyCorrector(int depth);
782
784 //NB: Assume default copy constructor, assignment = and destructor//
786
788
792 float Factor(const int bandnum, const PictureParams& pp,
793 const CompSort c) const;
794
796
804 void Update(int bandnum, const PictureParams& pp,
805 CompSort c,int est_bits,int actual_bits);
806
807 private:
809 void Init();
810
811 TwoDArray<float> m_Yfctrs;
812 TwoDArray<float> m_Ufctrs;
813 TwoDArray<float> m_Vfctrs;
814 };
815
817 class OLBParams
818 {
819
820 public:
821
823 OLBParams(){}
824
826 /*
827 Constructor rationalises proposed parameters to allow suitable
828 overlap and fit in with chroma format
829 \param xblen the horizontal block length
830 \param yblen the vertical block length
831 \param xblen the horizontal block separation
832 \param yblen the vertical block separation
833
834 */
835 OLBParams(const int xblen, const int yblen,
836 const int xbsep, const int ybsep);
837
838 // Gets ...
839
841 int Xblen() const {return m_xblen;}
842
844 int Yblen() const {return m_yblen;}
845
847 int Xbsep() const {return m_xbsep;}
848
850 int Ybsep() const {return m_ybsep;}
851
853 int Xoffset() const {return m_xoffset;}
854
856 int Yoffset() const {return m_yoffset;}
857
858 // ... and sets
859
861 void SetXblen( int xblen ){ m_xblen = xblen; m_xoffset = (m_xblen-m_xbsep)/2;}
862
864 void SetYblen( int yblen ){ m_yblen = yblen; m_yoffset = (m_yblen-m_ybsep)/2;}
865
867 void SetXbsep( int xbsep ){ m_xbsep = xbsep; m_xoffset = (m_xblen-m_xbsep)/2;}
868
870 void SetYbsep( int ybsep ){ m_ybsep = ybsep; m_yoffset = (m_yblen-m_ybsep)/2;}
871
872 bool operator == (const OLBParams bparams) const;
873
874 // overloaded stream operators
875 friend std::ostream & operator<< (std::ostream &, OLBParams &);
876 friend std::istream & operator>> (std::istream &, OLBParams &);
877
878
879 private:
880
881 int m_xblen;
882 int m_yblen;
883 int m_xbsep;
884 int m_ybsep;
885 int m_xoffset;
886 int m_yoffset;
887 };
888
890 class ParseParams
891 {
892 public:
894 ParseParams();
895
896 // Gets
897
899 unsigned int MajorVersion() const { return m_major_ver; }
900
902 unsigned int MinorVersion() const { return m_minor_ver; }
903
905 unsigned int Profile() const { return m_profile; }
906
908 unsigned int Level() const { return m_level; }
909
910 // Sets
911
913 void SetMajorVersion(unsigned int major_ver) {m_major_ver = major_ver; }
914
916 void SetMinorVersion(unsigned int minor_ver) { m_minor_ver = minor_ver; }
917
919 void SetProfile(unsigned int profile) { m_profile = profile; }
920
922 void SetLevel(unsigned int level) { m_level = level; }
923
924 private:
926 unsigned int m_major_ver;
928 unsigned int m_minor_ver;
930 unsigned int m_profile;
932 unsigned int m_level;
933 };
934
936 class CodeBlocks
937 {
938 public:
940 CodeBlocks () : m_hblocks(1), m_vblocks(1)
941 {}
942
944 CodeBlocks (unsigned int hblocks, unsigned int vblocks) :
945 m_hblocks(hblocks),
946 m_vblocks(vblocks)
947 {}
948
949 // Gets
951 unsigned int HorizontalCodeBlocks() const { return m_hblocks; }
953 unsigned int VerticalCodeBlocks() const { return m_vblocks; }
954 // Sets
956 void SetHorizontalCodeBlocks(unsigned int hblocks) { m_hblocks = hblocks; }
958 void SetVerticalCodeBlocks(unsigned int vblocks) { m_vblocks = vblocks; }
959 private:
961 unsigned int m_hblocks;
963 unsigned int m_vblocks;
964 };
965
967 class PicturePredParams
968 {
969 public:
970 PicturePredParams():
971 m_lbparams(3),
972 m_cbparams(3) {}
973
975 bool UsingGlobalMotion() const { return m_use_global_motion; }
976
978 unsigned int PictureWeightsBits() const { return m_picture_weights_bits; }
979
981 int Ref1Weight() const { return m_ref1_weight; }
982
984 int Ref2Weight() const { return m_ref2_weight; }
985
986 bool CustomRefWeights()
987 {
988 return (m_picture_weights_bits != 1 ||
989 m_ref1_weight != 1 ||
990 m_ref2_weight != 1);
991 }
992
994 int XNumSB() const {return m_x_num_sb;}
995
997 int YNumSB() const {return m_y_num_sb;}
998
1000 int XNumBlocks() const {return m_x_num_blocks;}
1001
1003 int YNumBlocks() const {return m_y_num_blocks;}
1004
1006 const OLBParams& LumaBParams(int n) const {return m_lbparams[n];}
1007
1009 const OLBParams& ChromaBParams(int n) const {return m_cbparams[n];}
1010
1012 MVPrecisionType MVPrecision() const { return m_mv_precision; }
1013
1015 void SetXNumSB(const int xn){m_x_num_sb=xn;}
1016
1018 void SetYNumSB(const int yn){m_y_num_sb=yn;}
1019
1021 void SetXNumBlocks(const int xn){m_x_num_blocks=xn;}
1022
1024 void SetYNumBlocks(const int yn){m_y_num_blocks=yn;}
1025
1027 void SetBlockSizes(const OLBParams& olbparams , const ChromaFormat cformat);
1028
1030 void SetLumaBlockParams(const OLBParams& olbparams) {m_lbparams[2] = olbparams;}
1031
1033 void SetMVPrecision(const MVPrecisionType p)
1034 {
1035 // Assert in debug mode. Maybe we should throw an exception???
1036 TESTM((p >=0 && p <=3), "Motion precision value in range 0..3");
1037 m_mv_precision = p;
1038 }
1039
1040 void SetMVPrecision(const MVPrecisionType p) const
1041 {
1042 // Assert in debug mode. Maybe we should throw an exception???
1043 TESTM((p >=0 && p <=3), "Motion precision value in range 0..3");
1044 m_mv_precision = p;
1045 }
1046
1048 void SetUsingGlobalMotion(bool gm) { m_use_global_motion=gm; }
1049
1051 void SetPictureWeightsPrecision(unsigned int wt_prec) { m_picture_weights_bits=wt_prec; }
1052
1054 void SetRef1Weight(int wt) { m_ref1_weight=wt; }
1055
1057 void SetRef2Weight(int wt) { m_ref2_weight=wt; }
1058
1059 private:
1060
1062 int m_x_num_sb;
1063
1065 int m_y_num_sb;
1066
1068 int m_x_num_blocks;
1069
1071 int m_y_num_blocks;
1072
1073 OneDArray<OLBParams> m_lbparams;
1074
1075 OneDArray<OLBParams> m_cbparams;
1076
1078 mutable MVPrecisionType m_mv_precision;
1079
1081 unsigned int m_picture_weights_bits;
1082
1084 int m_ref1_weight;
1085
1087 int m_ref2_weight;
1088
1090 bool m_use_global_motion;
1091
1092 };
1093
1095
1098 class CodecParams
1099 {
1100 public:
1101
1103 CodecParams (const VideoFormat& video_format = VIDEO_FORMAT_CUSTOM,
1104 PictureType ftype = INTRA_PICTURE,
1105 unsigned int num_refs = 0,
1106 bool set_defaults=true);
1107
1109 //NB: Assume default copy constructor, assignment = and destructor//
1111
1112 // Gets ...
1113
1115
1119 int PictureCodingMode() const {return m_pic_coding_mode;}
1120
1122 bool FieldCoding() const { return (m_pic_coding_mode==1); }
1123
1125 bool TopFieldFirst() const {return m_topfieldfirst;}
1126
1128 int Xl() const {return m_xl;}
1129
1131 int Yl() const {return m_yl;}
1132
1134 int ChromaXl() const {return m_cxl;}
1135
1137 int ChromaYl() const {return m_cyl;}
1138
1140 unsigned int LumaDepth() const { return m_luma_depth; }
1141
1143 unsigned int ChromaDepth() const { return m_chroma_depth; }
1144
1146 bool ZeroTransform() const { return m_zero_transform; }
1147
1149 WltFilter TransformFilter() const { return m_wlt_filter; }
1150
1152 unsigned int TransformDepth() const { return m_wlt_depth; }
1153
1155 CodeBlockMode GetCodeBlockMode() const { return m_cb_mode; }
1156
1158 bool SpatialPartition() const { return m_spatial_partition; }
1159
1161 const CodeBlocks &GetCodeBlocks(unsigned int level) const;
1162
1164 VideoFormat GetVideoFormat() const { return m_video_format; }
1165
1167 PicturePredParams& GetPicPredParams(){return m_picpredparams;}
1168
1170 const PicturePredParams& GetPicPredParams() const {return m_picpredparams;}
1171
1172 // ... and Sets
1174 void SetPictureCodingMode(int pic_coding){m_pic_coding_mode=pic_coding;}
1175
1177 void SetTopFieldFirst(bool topf){m_topfieldfirst=topf;}
1178
1180 void SetXl(const int x){m_xl=x;}
1181
1183 void SetYl(const int y){m_yl=y;}
1184
1186 void SetChromaXl(const int x){m_cxl=x;}
1187
1189 void SetChromaYl(const int y){m_cyl=y;}
1190
1192 void SetLumaDepth(unsigned int luma_depth) { m_luma_depth = luma_depth; }
1193
1195 void SetChromaDepth(unsigned int chroma_depth) { m_chroma_depth = chroma_depth; }
1196
1198 void SetZeroTransform(bool zero_transform) { m_zero_transform = zero_transform; }
1199
1201 void SetTransformFilter(const WltFilter wf) { m_wlt_filter=wf; }
1202
1204 void SetTransformFilter(unsigned int wf_idx);
1205
1207 void SetTransformDepth(unsigned int wd);
1208
1210 void SetCodeBlockMode(unsigned int cb_mode);
1211
1213 void SetSpatialPartition(bool spatial_partition) { m_spatial_partition=spatial_partition; }
1214
1216 void SetCodeBlocks(unsigned int level, unsigned int hblocks, unsigned int vblocks);
1217
1219 void SetVideoFormat(const VideoFormat vd) { m_video_format=vd; }
1220
1221 protected:
1223 WltFilter TransformFilter (unsigned int wf_idx);
1224 private:
1225
1227 PicturePredParams m_picpredparams;
1228
1230 int m_pic_coding_mode;
1231
1233 bool m_topfieldfirst;
1234
1236 int m_xl;
1237
1239 int m_yl;
1240
1242 int m_cxl;
1243
1245 int m_cyl;
1246
1248 unsigned int m_luma_depth;
1249
1251 unsigned int m_chroma_depth;
1252
1254 VideoFormat m_video_format;
1255
1257 bool m_zero_transform;
1258
1260 WltFilter m_wlt_filter;
1261
1263 unsigned int m_wlt_depth;
1264
1266 CodeBlockMode m_cb_mode;
1267
1269 bool m_spatial_partition;
1270
1272 OneDArray<CodeBlocks> m_cb;
1273 };
1274
1276
1279 class EncoderParams: public CodecParams
1280 {
1281 //codec params plus parameters relating solely to the operation of the encoder
1282
1283 public:
1285 EncoderParams(const VideoFormat& video_format,
1286 PictureType ftype = INTER_PICTURE,
1287 unsigned int num_refs = 2,
1288 bool set_defaults=true);
1289
1291 //NB: Assume default copy constructor, assignment = and destructor//
1292 //This means pointers are copied, not the objects they point to.////
1294
1295 // Gets ...
1296
1297
1299 bool Verbose() const {return m_verbose;}
1300
1302 bool LocalDecode() const {return m_loc_decode;}
1303
1305 bool Lossless() const {return m_lossless;}
1306
1308 bool FullSearch() const {return m_full_search; }
1309
1311 int XRangeME() const {return m_x_range_me;}
1312
1314 int YRangeME() const {return m_y_range_me;}
1315
1317 bool CombinedME() const {return m_combined_me; }
1318
1320 float Qf() const {return m_qf;}
1321
1323
1328 int NumL1() const {return m_num_L1;}
1329
1331 int L1Sep() const {return m_L1_sep;}
1332
1334 float UFactor() const {return m_ufactor;}
1335
1337 float VFactor() const {return m_vfactor;}
1338
1340 float CPD() const {return m_cpd;}
1341
1343 PrefilterType Prefilter() const {return m_prefilter;}
1344
1346 int PrefilterStrength() const {return m_prefilter_strength;}
1347
1349 float ILambda() const {return m_I_lambda;}
1350
1352 float L1Lambda() const {return m_L1_lambda;}
1353
1355 float L2Lambda() const {return m_L2_lambda;}
1356
1358 float L1MELambda() const {return m_L1_me_lambda;}
1359
1361 float L2MELambda() const {return m_L2_me_lambda;}
1362
1364 int GOPLength() const;
1365
1367 char * OutputPath() const {return ( char* ) m_output_path.c_str();}
1368
1370 const EntropyCorrector& EntropyFactors() const {return *m_ent_correct;}
1371
1373 EntropyCorrector& EntropyFactors() {return *m_ent_correct;}
1374
1376 WltFilter IntraTransformFilter() { return m_intra_wltfilter; }
1377
1379 WltFilter InterTransformFilter() { return m_inter_wltfilter; }
1380
1382 int TargetRate() {return m_target_rate;}
1383
1385 bool UsingAC() const {return m_using_ac;}
1386
1387 // ... and Sets
1388
1390 void SetVerbose(bool v){m_verbose=v;}
1391
1393 void SetLocalDecode( const bool decode ){m_loc_decode=decode;}
1394
1396 void SetLossless(const bool l){m_lossless = l;}
1397
1399 void SetFullSearch(const bool fs){m_full_search = fs;}
1400
1402 void SetCombinedME(const bool cme){m_combined_me = cme;}
1403
1405 void SetXRangeME(const int xr){m_x_range_me = xr;}
1406
1408 void SetYRangeME(const int yr){m_y_range_me = yr;}
1409
1411 void SetQf(const float qfac){ m_qf=qfac; CalcLambdas(m_qf); }
1412
1414 void SetNumL1(const int nl){m_num_L1=nl;}
1415
1417 void SetL1Sep(const int lsep){m_L1_sep=lsep;}
1418
1420 void SetUFactor(const float uf){m_ufactor=uf;}
1421
1423 void SetVFactor(const float vf){m_vfactor=vf;}
1424
1426 void SetCPD(const float cpd){m_cpd=cpd;}
1427
1429 void SetPrefilter(const PrefilterType pf, const int str){m_prefilter=pf;
1430 m_prefilter_strength=str;}
1431
1433 void SetOutputPath(const char * op){ m_output_path = op; }
1434
1436 void SetEntropyFactors(EntropyCorrector* entcorrect){m_ent_correct=entcorrect;}
1438 void SetIntraTransformFilter(unsigned int wf_idx);
1439
1441 void SetInterTransformFilter(unsigned int wf_idx);
1442
1444 void SetIntraTransformFilter(WltFilter wf) { m_intra_wltfilter = wf; }
1445
1447 void SetUsualCodeBlocks(const PictureType& ftype);
1448
1450 void SetInterTransformFilter(WltFilter wf) { m_inter_wltfilter = wf; }
1451
1453 void SetTargetRate(const int rate){m_target_rate = rate;}
1454
1456 void SetUsingAC(bool using_ac) {m_using_ac = using_ac;}
1457 private:
1458
1460 void CalcLambdas(const float qf);
1461
1462 private:
1463
1465 bool m_verbose;
1466
1468 bool m_loc_decode;
1469
1471 bool m_lossless;
1472
1474 bool m_full_search;
1475
1477 bool m_combined_me;
1478
1480 int m_x_range_me;
1481
1483 int m_y_range_me;
1484
1486 float m_qf;
1487
1489 int m_num_L1;
1490
1492 int m_L1_sep;
1493
1495 float m_ufactor;
1496
1498 float m_vfactor;
1499
1501 float m_cpd;
1502
1504 PrefilterType m_prefilter;
1505
1507 int m_prefilter_strength;
1508
1510 float m_I_lambda;
1511
1513 float m_L1_lambda;
1514
1516 float m_L2_lambda;
1517
1519 float m_L1_me_lambda;
1520
1522 float m_L2_me_lambda;
1523
1525 EntropyCorrector* m_ent_correct;
1526
1528 std::string m_output_path;
1529
1531 WltFilter m_intra_wltfilter;
1532
1534 WltFilter m_inter_wltfilter;
1535
1537 int m_target_rate;
1538
1540 bool m_using_ac;
1541
1542 };
1543
1545
1548 class DecoderParams: public CodecParams
1549 {
1550 public:
1552 DecoderParams(const VideoFormat& video_format = VIDEO_FORMAT_CIF, PictureType ftype=INTRA_PICTURE, unsigned int num_refs = 0, bool set_defaults = false);
1553
1555 bool Verbose() const {return m_verbose;}
1556
1558 void SetVerbose(bool v){m_verbose=v;}
1559
1561 //NB: Assume default copy constructor, assignment = and destructor//
1562 //This means pointers are copied, not the objects they point to.////
1564
1565
1566 private:
1567
1569 bool m_verbose;
1570
1571 };
1572
1574 inline ValueType BChk(const ValueType &num, const ValueType &max)
1575 {
1576 if(num < 0) return 0;
1577 else if(num >= max) return max-1;
1578 else return num;
1579 }
1580
1582 class QuantiserLists
1583 {
1584 public:
1586 QuantiserLists();
1587
1589 inline int QuantFactor4( const int index ) const {return m_qflist4[index]; }
1590
1592 inline int IntraQuantOffset4( const int index ) const {return m_intra_offset4[index]; }
1594 inline int InterQuantOffset4( const int index ) const {return m_inter_offset4[index]; }
1595
1597 inline int MaxQuantIndex() const {return m_max_qindex; }
1598
1599
1600 private:
1601 unsigned int m_max_qindex;
1602 OneDArray<int> m_qflist4;
1603 OneDArray<int> m_intra_offset4;
1604 OneDArray<int> m_inter_offset4;
1605
1606 };
1607
1609 static const QuantiserLists dirac_quantiser_lists;
1610
1611 } // namespace dirac
1612
1613 #endif
dirac::SourceParams::SetPixelAspectRatio
void SetPixelAspectRatio(unsigned int pix_as_num, unsigned int pix_as_denom)
Set the pixel aspect ratio.
Definition: common.h:416
dirac::EncoderParams::EntropyFactors
const EntropyCorrector & EntropyFactors() const
Return a reference to the entropy factors.
Definition: common.h:1370
dirac::PredMode
PredMode
Prediction modes for blocks.
Definition: common.h:84
dirac::EncoderParams::SetVFactor
void SetVFactor(const float vf)
Set the amount to weight noise in the V component.
Definition: common.h:1423
dirac::MV_FBIN4_CTX
Definition: common.h:147
TransferFunction
TransferFunction
Definition: common_types.h:141
dirac::PictureParams::Refs
std::vector< int > & Refs()
Returns non-const C++ referece to the vector of reference pictures, to allow them to be set...
Definition: common.h:607
dirac::MV_FBIN3_CTX
Definition: common.h:146
dirac::CodecParams::TopFieldFirst
bool TopFieldFirst() const
Returns true if the topmost field comes first in time when coding.
Definition: common.h:1125
dirac::PictureParams::LumaDepth
unsigned int LumaDepth() const
Returns the luma depth.
Definition: common.h:580
dirac::EncoderParams::CPD
float CPD() const
Return the number of cycles per degree at the nominal viewing distance for the raster.
Definition: common.h:1340
dirac::SourceParams::SetSignalRange
void SetSignalRange(SignalRangeType sr)
Set the Signal Range parameters.
dirac::Direction
Direction
Forward or backward.
Definition: common.h:93
dirac::CodeBlocks::CodeBlocks
CodeBlocks()
Default Constructor.
Definition: common.h:940
dirac::EncoderParams::UFactor
float UFactor() const
Return the amount we're weighting noise in the U component.
Definition: common.h:1334
dirac::EncoderParams::FullSearch
bool FullSearch() const
Get whether we're doing full-search motion estimation.
Definition: common.h:1308
dirac::PictureParams::GetReferenceType
ReferenceType GetReferenceType() const
Returns reference picture type (see enum)
Definition: common.h:616
dirac::QuantiserLists::QuantFactor4
int QuantFactor4(const int index) const
Returns 4 times the quantisation factor.
Definition: common.h:1589
dirac::EntropyCorrector::Init
void Init()
Initialises the correction factors.
dirac::PictureSort::IsInterRef
bool IsInterRef() const
Definition: common.h:251
dirac::QuantiserLists::m_max_qindex
unsigned int m_max_qindex
Definition: common.h:1601
dirac::SourceParams::m_cs_idx
unsigned int m_cs_idx
Index into colour spec table.
Definition: common.h:518
dirac::EncoderParams::SetCPD
void SetCPD(const float cpd)
Set the number of cycles per degree at the nominal viewing distance.
Definition: common.h:1426
dirac::TOTAL_COEFF_CTXS
Definition: common.h:126
dirac::PicturePredParams::SetXNumBlocks
void SetXNumBlocks(const int xn)
Set how many blocks there are horizontally.
Definition: common.h:1021
dirac::SourceParams::SetColourMatrixIndex
void SetColourMatrixIndex(unsigned int cm)
Set the colour matrix index.
dirac::SourceParams::m_col_matrix
ColourMatrix m_col_matrix
Definition: common.h:524
dirac::EncoderParams::m_loc_decode
bool m_loc_decode
Flag indicating we're doing local decoding.
Definition: common.h:1468
dirac::SourceParams::m_yl
unsigned int m_yl
Height of video.
Definition: common.h:466
dirac::CodecParams::m_chroma_depth
unsigned int m_chroma_depth
chroma depth - number of bits required for luma
Definition: common.h:1251
dirac::PicturePredParams::SetPictureWeightsPrecision
void SetPictureWeightsPrecision(unsigned int wt_prec)
Set the picture weight precision bits used for (de)coding.
Definition: common.h:1051
dirac::OLBParams::Xblen
int Xblen() const
Returns the horizontal block length.
Definition: common.h:841
dirac::PicturePredParams::SetMVPrecision
void SetMVPrecision(const MVPrecisionType p)
Set the number of accuracy bits for motion vectors.
Definition: common.h:1033
dirac::OLBParams::m_yoffset
int m_yoffset
Definition: common.h:886
dirac::CodecParams::m_zero_transform
bool m_zero_transform
Zero transform flag.
Definition: common.h:1257
dirac::EncoderParams::m_verbose
bool m_verbose
Code/decode with commentary if true.
Definition: common.h:1465
dirac::SourceParams::SetLeftOffset
void SetLeftOffset(unsigned int left_offset)
Set the Clean area left offset.
Definition: common.h:432
VIDEO_FORMAT_CUSTOM
Definition: common_types.h:99
dirac::SIGN0_CTX
Definition: common.h:98
dirac::SourceParams::SetVideoFormat
void SetVideoFormat(VideoFormat vf)
Sets the video format.
Definition: common.h:389
dirac::EncoderParams::SetInterTransformFilter
void SetInterTransformFilter(WltFilter wf)
Set the Wavelet filter to be used for inter pictures.
Definition: common.h:1450
dirac::SourceParams::m_xl
unsigned int m_xl
Width of video.
Definition: common.h:463
dirac::PicturePredParams::SetLumaBlockParams
void SetLumaBlockParams(const OLBParams &olbparams)
Set block level luma params.
Definition: common.h:1030
dirac::NZ_FBIN5_CTX
Definition: common.h:116
dirac::CodecParams::GetCodeBlockMode
CodeBlockMode GetCodeBlockMode() const
Return multiple quantisers flag being used for picture (de)coding.
Definition: common.h:1155
dirac::PicturePredParams::XNumBlocks
int XNumBlocks() const
Return the number of blocks horizontally.
Definition: common.h:1000
dirac::CostType
A structure for recording costs, particularly in quantisation.
Definition: common.h:753
dirac::PicturePredParams::m_x_num_sb
int m_x_num_sb
The number of superblocks horizontally.
Definition: common.h:1062
dirac::CodeBlocks::CodeBlocks
CodeBlocks(unsigned int hblocks, unsigned int vblocks)
Constructor.
Definition: common.h:944
dirac::CodecParams::Xl
int Xl() const
Return the picture/field luma width.
Definition: common.h:1128
dirac::PictureSort::IsInter
bool IsInter() const
Definition: common.h:238
dirac::PictureParams::ExpiryTime
int ExpiryTime() const
Returns the number of pictures after the current picture number after which the picture can be discar...
Definition: common.h:598
dirac::SourceParams::SetColourSpecification
void SetColourSpecification(unsigned int cs_idx)
Set the Colour specification.
dirac::EncoderParams::OutputPath
char * OutputPath() const
Return the output path to be used for storing diagnositic data.
Definition: common.h:1367
dirac::SourceParams::ChromaWidth
int ChromaWidth() const
Returns the chroma width.
dirac::SourceParams::SetChromaOffset
void SetChromaOffset(unsigned int chroma_off)
Set the chroma offset.
Definition: common.h:445
dirac::PictureParams::SetAsOutput
void SetAsOutput()
Sets a flag to indicate that the picture has been output.
Definition: common.h:639
dirac::Z_FBIN4_CTX
Definition: common.h:107
dirac::PictureParams::NumRefs
unsigned int NumRefs() const
Return the number of reference pictures.
Definition: common.h:610
dirac::PictureSort::IsRef
bool IsRef() const
Definition: common.h:240
dirac::DecoderParams::Verbose
bool Verbose() const
Returns true if we're operating verbosely, false otherwise.
Definition: common.h:1555
dirac::EncoderParams::PrefilterStrength
int PrefilterStrength() const
Return the prefiltering strength.
Definition: common.h:1346
dirac::CodecParams::SetChromaDepth
void SetChromaDepth(unsigned int chroma_depth)
Set Chroma Depth.
Definition: common.h:1195
dirac::SourceParams::SetLumaExcursion
void SetLumaExcursion(unsigned int luma_exc)
Set the luma excursion.
Definition: common.h:443
dirac::SourceParams::m_cformat
ChromaFormat m_cformat
Presence of chroma and/or chroma sampling structure.
Definition: common.h:469
dirac::MV_SIGN_CTX
Definition: common.h:152
dirac::TwoDArray
A template class for two-dimensional arrays.
Definition: arrays.h:284
dirac::SourceParams::PixelAspectRatio
Rational PixelAspectRatio() const
Return the pixel aspect ratio.
Definition: common.h:331
dirac::CodecParams::CodecParams
CodecParams(const VideoFormat &video_format=VIDEO_FORMAT_CUSTOM, PictureType ftype=INTRA_PICTURE, unsigned int num_refs=0, bool set_defaults=true)
Default constructor.
dirac::SourceParams::SetPixelAspectRatio
void SetPixelAspectRatio(const Rational &pix_asr)
Set the pixel aspect ratio.
Definition: common.h:409
dirac::PicturePredParams::m_picture_weights_bits
unsigned int m_picture_weights_bits
picture predicion parameters - precision
Definition: common.h:1081
dirac::PictureParams::SetRetiredPictureNum
void SetRetiredPictureNum(int retd_fnum)
Sets the retired reference picture number.
Definition: common.h:657
dirac::PictureSort::IsInterNonRef
bool IsInterNonRef() const
Definition: common.h:250
dirac::CodecParams::SetCodeBlocks
void SetCodeBlocks(unsigned int level, unsigned int hblocks, unsigned int vblocks)
Set the number of code blocks for a particular level.
dirac::PicturePredParams::m_lbparams
OneDArray< OLBParams > m_lbparams
Definition: common.h:1073
dirac::CoeffType
int CoeffType
Type of wavelet coefficient data (should be larger than ValueType)
Definition: common.h:74
dirac::OLBParams::m_xbsep
int m_xbsep
Definition: common.h:883
dirac::PicturePredParams::YNumSB
int YNumSB() const
Return the number of superblocks vertically.
Definition: common.h:997
dirac::PictureParams::m_refs
std::vector< int > m_refs
The set of picture numbers of reference pictures.
Definition: common.h:671
dirac::PicturePredParams::PicturePredParams
PicturePredParams()
Definition: common.h:970
dirac::CtxAliases
CtxAliases
Contexts used for coefficient coding.
Definition: common.h:96
dirac::PicturePredParams::LumaBParams
const OLBParams & LumaBParams(int n) const
Return the Luma block parameters for each macroblock splitting level.
Definition: common.h:1006
dirac::CodecParams::m_cb
OneDArray< CodeBlocks > m_cb
Code block array. Number of entries is m_wlt_depth+1.
Definition: common.h:1272
dirac::SourceParams::SetXl
void SetXl(unsigned int xlen)
Sets the picture width.
Definition: common.h:373
dirac::SB_SPLIT_INFO_CTX
Definition: common.h:166
dirac::PicturePredParams::m_mv_precision
MVPrecisionType m_mv_precision
The precision of motion vectors (number of accuracy bits eg 1=half-pel accuracy)
Definition: common.h:1078
dirac::DecoderParams::m_verbose
bool m_verbose
Code/decode with commentary if true.
Definition: common.h:1569
dirac::PictureParams::PictureNum
int PictureNum() const
Returns the number of the picture (in time order)
Definition: common.h:589
dirac::REF1AND2
Definition: common.h:84
dirac::ParseParams::m_level
unsigned int m_level
Level.
Definition: common.h:932
dirac::CodecParams::GetVideoFormat
VideoFormat GetVideoFormat() const
Return the video format currently being used for picture (de)coding.
Definition: common.h:1164
dirac::V_COMP
Definition: common.h:87
dirac::SourceParams
Parameters relating to the source material being encoded/decoded.
Definition: common.h:288
dirac::EncoderParams::m_prefilter
PrefilterType m_prefilter
Indicator for prefiltering.
Definition: common.h:1504
dirac::CodecParams::SetChromaXl
void SetChromaXl(const int x)
Set the frame/field chroma width.
Definition: common.h:1186
SIGNAL_RANGE_CUSTOM
Definition: common_types.h:180
dirac::CodecParams::SetYl
void SetYl(const int y)
Set the picture/field luma height.
Definition: common.h:1183
dirac::OLBParams::OLBParams
OLBParams()
Default constructor does nothing.
Definition: common.h:823
dirac::OLBParams::Ybsep
int Ybsep() const
Returns the vertical block separation.
Definition: common.h:850
dirac::REF1_ONLY
Definition: common.h:84
dirac::PicturePredParams::SetXNumSB
void SetXNumSB(const int xn)
Set how many SBs there are horizontally.
Definition: common.h:1015
dirac::SUBTRACT
Definition: common.h:90
dirac::EncoderParams::SetTargetRate
void SetTargetRate(const int rate)
Set the target bit rate.
Definition: common.h:1453
PixelAspectRatioType
PixelAspectRatioType
Definition: common_types.h:166
dirac::SourceParams::TopFieldFirst
bool TopFieldFirst() const
Returns true if top field comes first in time.
Definition: common.h:322
dirac::EncoderParams::L2Lambda
float L2Lambda() const
Return the Lagrangian parameter to be used for L2 pictures.
Definition: common.h:1355
dirac::PMODE_BIT0_CTX
Definition: common.h:157
dirac::CodecParams::m_spatial_partition
bool m_spatial_partition
Spatial partitioning flag.
Definition: common.h:1269
dirac::PictureSort::fs
unsigned char fs
Definition: common.h:284
dirac::PictureSort::SetNonRef
void SetNonRef()
Definition: common.h:235
dirac::EncoderParams::SetOutputPath
void SetOutputPath(const char *op)
Set the output path to be used for diagnostic data.
Definition: common.h:1433
dirac::EncoderParams::m_vfactor
float m_vfactor
factor for weighting V component quantisation errors
Definition: common.h:1498
dirac::EncoderParams::m_I_lambda
float m_I_lambda
Lagrangian parameter for Intra picture coding.
Definition: common.h:1510
dirac::PictureSort::IsIntra
bool IsIntra() const
Definition: common.h:239
dirac::PicturePredParams::Ref1Weight
int Ref1Weight() const
Return the Ref1 weight.
Definition: common.h:981
dirac::Rational::m_denom
unsigned int m_denom
Denominator.
Definition: common.h:224
dirac::REF2_ONLY
Definition: common.h:84
dirac::EntropyCorrector::m_Yfctrs
TwoDArray< float > m_Yfctrs
Definition: common.h:811
dirac::SourceParams::SetTransferFunctionIndex
void SetTransferFunctionIndex(unsigned int tf)
Set the transfer function index.
CodeBlockMode
CodeBlockMode
Definition: common_types.h:198
dirac::EncoderParams::TargetRate
int TargetRate()
Return the Target Bit Rate in kbps.
Definition: common.h:1382
dirac::PictureParams::Output
bool Output() const
Returns an indication of whether the picture has been output yet.
Definition: common.h:601
dirac::PicturePredParams::SetRef2Weight
void SetRef2Weight(int wt)
Set the ref 2 picture weight.
Definition: common.h:1057
dirac::CodecParams::m_xl
int m_xl
The frame/field luma width.
Definition: common.h:1236
dirac::SourceParams::SetCleanHeight
void SetCleanHeight(unsigned int clean_height)
Set the Clean area height.
Definition: common.h:430
dirac::QuantiserLists
Class for encapsulating quantiser data.
Definition: common.h:1582
ColourPrimaries
ColourPrimaries
Definition: common_types.h:124
dirac::SourceParams::SetTopFieldFirst
void SetTopFieldFirst(bool tff)
Set Topfield first. True if top field comes first in time.
Definition: common.h:386
dirac::DecoderParams::DecoderParams
DecoderParams(const VideoFormat &video_format=VIDEO_FORMAT_CIF, PictureType ftype=INTRA_PICTURE, unsigned int num_refs=0, bool set_defaults=false)
Default constructor.
dirac::SourceParams::m_fr_idx
FrameRateType m_fr_idx
Index into frame rate table.
Definition: common.h:478
FRAMERATE_CUSTOM
Definition: common_types.h:151
dirac::DC_INFO_CTX
Definition: common.h:137
dirac::EncoderParams::m_using_ac
bool m_using_ac
Arithmetic coding flag.
Definition: common.h:1540
MVPrecisionType
MVPrecisionType
Definition: common_types.h:189
dirac::PicArray::PicArray
PicArray()
Default constructor.
Definition: common.h:725
dirac::CodecParams::LumaDepth
unsigned int LumaDepth() const
Returns the luma depth.
Definition: common.h:1140
dirac::SourceParams::SourceSampling
unsigned int SourceSampling() const
Returns the source sampling field of the source scan format.
Definition: common.h:319
dirac::NZ_FBIN1z_CTX
Definition: common.h:111
dirac::PictureParams::Yl
int Yl() const
Returns the picture height.
Definition: common.h:571
dirac::PictureParams::m_yl
int m_yl
Picture luma height.
Definition: common.h:695
dirac::EncoderParams::m_output_path
std::string m_output_path
Output file path.
Definition: common.h:1528
dirac::PictureSort::SetIntra
void SetIntra()
Definition: common.h:233
dirac::PicArray::CSort
const CompSort & CSort() const
Return which component is stored.
Definition: common.h:741
dirac::EncoderParams::UsingAC
bool UsingAC() const
Return true if using Arithmetic coding.
Definition: common.h:1385
dirac::EncoderParams::SetEntropyFactors
void SetEntropyFactors(EntropyCorrector *entcorrect)
Sets the entropy factors - TBD: set this up in a constructor and pass encoder params around entirely ...
Definition: common.h:1436
dirac::CodecParams::PictureCodingMode
int PictureCodingMode() const
Returns the picture coding mode (independent of source format)
Definition: common.h:1119
dirac::SIGN_NEG_CTX
Definition: common.h:100
dirac::OneDArray
A template class for one-dimensional arrays.
Definition: arrays.h:89
dirac::EncoderParams::LocalDecode
bool LocalDecode() const
Returns a flag indicating that we're doing local decoding.
Definition: common.h:1302
dirac::SourceParams::SetChromaExcursion
void SetChromaExcursion(unsigned int chroma_exc)
Set the chroma excursion.
Definition: common.h:447
dirac::EncoderParams::SetQf
void SetQf(const float qfac)
Set the quality factor.
Definition: common.h:1411
dirac::PictureParams::m_reference_type
ReferenceType m_reference_type
Reference type.
Definition: common.h:683
dirac::EntropyCorrector
A class used for correcting estimates of entropy.
Definition: common.h:773
dirac::PictureParams::m_luma_depth
unsigned int m_luma_depth
Luma depth - number of bits required for lumz.
Definition: common.h:704
dirac::CodecParams::SetZeroTransform
void SetZeroTransform(bool zero_transform)
Set the zero transform flag being used for picture (de)coding.
Definition: common.h:1198
dirac::PicturePredParams::SetUsingGlobalMotion
void SetUsingGlobalMotion(bool gm)
Set the wavelet filter used for picture (de)coding.
Definition: common.h:1048
dirac::PicArray::SetCSort
void SetCSort(const CompSort cs)
Set the type of component being stored.
Definition: common.h:744
dirac::PictureParams::UsingAC
bool UsingAC() const
Returns true is entropy coding using Arithmetic coding.
Definition: common.h:619
ReferenceType
ReferenceType
Definition: common_types.h:92
dirac::QuantiserLists::InterQuantOffset4
int InterQuantOffset4(const int index) const
Returns the inter Picture quantisation offset for non-zero values.
Definition: common.h:1594
dirac::SourceParams::m_chroma_excursion
unsigned int m_chroma_excursion
Chroma excursion.
Definition: common.h:515
dirac::CodecParams::SetChromaYl
void SetChromaYl(const int y)
Set the frame/field chroma height.
Definition: common.h:1189
dirac::EncoderParams::m_lossless
bool m_lossless
A flag indicating we're doing lossless coding.
Definition: common.h:1471
dirac::CodeBlocks::SetHorizontalCodeBlocks
void SetHorizontalCodeBlocks(unsigned int hblocks)
Set the number of horizontal code blocks.
Definition: common.h:956
dirac::PictureParams::m_output
bool m_output
True if the picture has been output, false if not.
Definition: common.h:686
dirac::ParseParams::SetMajorVersion
void SetMajorVersion(unsigned int major_ver)
Set the major version.
Definition: common.h:913
dirac::EncoderParams::m_prefilter_strength
int m_prefilter_strength
Prefiltering strength.
Definition: common.h:1507
dirac::QuantiserLists::m_intra_offset4
OneDArray< int > m_intra_offset4
Definition: common.h:1603
dirac::MV_FBIN5plus_CTX
Definition: common.h:148
dirac::PMODE_BIT1_CTX
Definition: common.h:158
dirac::EncoderParams::SetInterTransformFilter
void SetInterTransformFilter(unsigned int wf_idx)
Set the Wavelet filter to be used for inter pictures.
dirac::SourceParams::FrameRateIndex
FrameRateType FrameRateIndex() const
Return the type from the frame rate table.
Definition: common.h:328
dirac::PictureParams::SetYl
void SetYl(int ylen)
Sets the picture height.
dirac::PicturePredParams::XNumSB
int XNumSB() const
Return the number of superblocks horizontally.
Definition: common.h:994
TESTM
#define TESTM(exp, text)
Definition: dirac_assertions.h:66
dirac::CodeBlocks
Structure to hold code block sizes when spatial partitioning is used.
Definition: common.h:936
dirac::SourceParams::ColourMatrixIndex
ColourMatrix ColourMatrixIndex() const
Return the colour matrix index.
Definition: common.h:366
dirac::SourceParams::ChromaOffset
unsigned int ChromaOffset() const
Return the chroma offset.
Definition: common.h:356
dirac::PicturePredParams::m_ref1_weight
int m_ref1_weight
picture predicion parameters - reference picture 1 weight
Definition: common.h:1084
dirac::ParseParams::m_minor_ver
unsigned int m_minor_ver
Minor Version.
Definition: common.h:928
dirac::SourceParams::m_sr_idx
SignalRangeType m_sr_idx
Index into signal range table.
Definition: common.h:506
dirac::CodeBlocks::m_hblocks
unsigned int m_hblocks
Number of Horizontal code blocks.
Definition: common.h:961
dirac::PictureSort::IsIntraRef
bool IsIntraRef() const
Definition: common.h:249
dirac::PictureSort::IntraRefPictureSort
static PictureSort IntraRefPictureSort()
Definition: common.h:255
dirac::IntToPixelAspectRatioType
PixelAspectRatioType IntToPixelAspectRatioType(int pix_asr_idx)
Function to convert an integer to a valid PixelAspectRatio type.
dirac::SourceParams::ColourSpecificationIndex
unsigned int ColourSpecificationIndex() const
Return the index into the colour specification table.
Definition: common.h:361
dirac::PicturePredParams::SetYNumSB
void SetYNumSB(const int yn)
Set how many SBs there are vertically.
Definition: common.h:1018
dirac::QuantiserLists::m_inter_offset4
OneDArray< int > m_inter_offset4
Definition: common.h:1604
dirac::QuantiserLists::QuantiserLists
QuantiserLists()
Default constructor.
dirac::PictureSort::SetIntraNonRef
void SetIntraNonRef()
Definition: common.h:243
dirac::PicArray
A class for picture component data.
Definition: common.h:718
dirac::OLBParams::SetXbsep
void SetXbsep(int xbsep)
Sets the block horizontal separation.
Definition: common.h:867
dirac::EncoderParams::InterTransformFilter
WltFilter InterTransformFilter()
Return the Wavelet filter to be used for Inter pictures.
Definition: common.h:1379
dirac::OLBParams::SetYbsep
void SetYbsep(int ybsep)
Sets the block vertical separation.
Definition: common.h:870
dirac::UNDEFINED
Definition: common.h:84
dirac::CodecParams::ZeroTransform
bool ZeroTransform() const
Return zero transform flag being used for picture (de)coding.
Definition: common.h:1146
dirac::EncoderParams::XRangeME
int XRangeME() const
Get the horizontal search range for full-search motion estimation.
Definition: common.h:1311
dirac::PictureSort::SetIntraRef
void SetIntraRef()
Definition: common.h:244
dirac::PictureParams::PictureParams
PictureParams()
Default constructor.
dirac::PictureParams::Xl
int Xl() const
Returns the picture width.
Definition: common.h:568
VideoFormat
VideoFormat
Definition: common_types.h:98
dirac::SourceParams::m_topfieldfirst
bool m_topfieldfirst
If m_source_sampling=1, true if the top field is first in temporal order.
Definition: common.h:475
dirac::OLBParams::m_xblen
int m_xblen
Definition: common.h:881
dirac::OLBParams::m_yblen
int m_yblen
Definition: common.h:882
dirac::SB_SPLIT_BIN1_CTX
Definition: common.h:163
dirac::CodeBlocks::HorizontalCodeBlocks
unsigned int HorizontalCodeBlocks() const
Return the number of horizontal code blocks.
Definition: common.h:951
dirac::SourceParams::m_source_sampling
unsigned int m_source_sampling
Source sampling field : 0 - progressive, 1 - interlaced.
Definition: common.h:472
dirac::MV_FBIN2_CTX
Definition: common.h:145
dirac::CalcValueType
int CalcValueType
Type for performing calculations on ValueType and CoeffType. Should be >ValueType, >=CoeffType.
Definition: common.h:81
dirac::OLBParams::Xbsep
int Xbsep() const
Returns the horizontal block separation.
Definition: common.h:847
dirac::EncoderParams
Parameters for the encoding process.
Definition: common.h:1279
dirac::CodecParams::m_cb_mode
CodeBlockMode m_cb_mode
Code block mode.
Definition: common.h:1266
dirac::OLBParams::Yoffset
int Yoffset() const
The offset in the vertical start of the block caused by overlap,=(YBLEN-YBSEP)/2. ...
Definition: common.h:856
dirac::EncoderParams::L1Lambda
float L1Lambda() const
Return the Lagrangian parameter to be used for L1 pictures.
Definition: common.h:1352
dirac::SourceParams::m_clean_width
unsigned int m_clean_width
Clean area width.
Definition: common.h:492
dirac::SourceParams::ColourPrimariesIndex
ColourPrimaries ColourPrimariesIndex() const
Return the colour primaries index.
Definition: common.h:364
dirac::PictureParams::SetExpiryTime
void SetExpiryTime(const int expt)
Sets how long the picture will stay in the buffer (encoder only)
Definition: common.h:636
dirac::PictureParams::PicSort
const PictureSort & PicSort() const
Returns the type of the picture.
Definition: common.h:586
dirac::CodecParams::GetPicPredParams
const PicturePredParams & GetPicPredParams() const
Return the picture prediction params.
Definition: common.h:1170
dirac::PictureParams::m_retd_fnum
int m_retd_fnum
The picture number of the retired picture.
Definition: common.h:689
dirac::SourceParams::PixelAspectRatioIndex
PixelAspectRatioType PixelAspectRatioIndex() const
Return the type from the pixel aspect ratio table.
Definition: common.h:334
dirac::SourceParams::m_col_primary
ColourPrimaries m_col_primary
Colour Primaries Index.
Definition: common.h:521
dirac::EncoderParams::ILambda
float ILambda() const
Return the Lagrangian parameter to be used for I pictures.
Definition: common.h:1349
dirac::EncoderParams::EncoderParams
EncoderParams(const VideoFormat &video_format, PictureType ftype=INTER_PICTURE, unsigned int num_refs=2, bool set_defaults=true)
Default constructor.
dirac::PictureSort::SetRef
void SetRef()
Definition: common.h:236
dirac::SourceParams::SetCFormat
void SetCFormat(ChromaFormat cf)
Sets the chroma format (Y only, 420, 422 etc)
Definition: common.h:379
dirac::EncoderParams::EntropyFactors
EntropyCorrector & EntropyFactors()
Return a reference to the entropy factors - we need to be able to change the values of the entropy fa...
Definition: common.h:1373
dirac::EncoderParams::m_intra_wltfilter
WltFilter m_intra_wltfilter
Wavelet filter for Intra pictures.
Definition: common.h:1531
dirac::PictureParams::m_psort
PictureSort m_psort
The picture sort.
Definition: common.h:668
dirac::SourceParams::LumaExcursion
unsigned int LumaExcursion() const
Return the luma excursion.
Definition: common.h:354
dirac::PictureParams::IsBPicture
bool IsBPicture() const
Returns whether the picture is bi-directionally predicted by checking references. ...
dirac::PictureParams::Refs
const std::vector< int > & Refs() const
Returns a const C++ reference to the set of reference picture numbers (will be empty if the picture i...
Definition: common.h:604
arrays.h
dirac::MV_FBIN1_CTX
Definition: common.h:144
dirac::EncoderParams::m_inter_wltfilter
WltFilter m_inter_wltfilter
Wavelet filter for Inter pictures.
Definition: common.h:1534
dirac::PictureParams::m_expiry_time
int m_expiry_time
The number of pictures, after the current picture number, after the (de)coding of which the picture c...
Definition: common.h:674
dirac::SourceParams::SetTopOffset
void SetTopOffset(unsigned int top_offset)
Set the Clean area top offset.
Definition: common.h:434
dirac::SourceParams::m_chroma_offset
unsigned int m_chroma_offset
Chroma offset.
Definition: common.h:513
dirac::Rational
Class defining a rational number.
Definition: common.h:218
dirac::SourceParams::m_framerate
Rational m_framerate
Frame Rate i.e number of frames per second.
Definition: common.h:481
dirac::ParseParams::SetLevel
void SetLevel(unsigned int level)
Set the Level.
Definition: common.h:922
dirac::SourceParams::m_clean_height
unsigned int m_clean_height
Clean area height.
Definition: common.h:495
dirac::OLBParams::Xoffset
int Xoffset() const
The offset in the horizontal start of the block caused by overlap,=(XBLEN-XBSEP)/2.
Definition: common.h:853
ChromaFormat
ChromaFormat
Definition: common_types.h:58
dirac::PictureSort
Picture type Class.
Definition: common.h:228
dirac::SourceParams::SetColourPrimariesIndex
void SetColourPrimariesIndex(unsigned int cp)
Set the colour primaries index.
dirac::SourceParams::FrameRate
Rational FrameRate() const
Return the number for frames per second.
Definition: common.h:325
dirac::ParseParams::ParseParams
ParseParams()
Default constructor.
dirac::PictureSort::Clear
void Clear()
Definition: common.h:253
dirac::BACKWARD
Definition: common.h:93
dirac::SourceParams::m_luma_excursion
unsigned int m_luma_excursion
Luma excursion.
Definition: common.h:511
INTRA_PICTURE
Definition: common_types.h:87
dirac::EntropyCorrector::EntropyCorrector
EntropyCorrector(int depth)
Constructor.
dirac::EncoderParams::SetUsingAC
void SetUsingAC(bool using_ac)
Set the arithmetic coding flag.
Definition: common.h:1456
dirac::CodecParams::SetCodeBlockMode
void SetCodeBlockMode(unsigned int cb_mode)
Set the multiple quantisers flag usedto picture (de)coding.
dirac::PictureParams::SetCFormat
void SetCFormat(ChromaFormat cf)
Sets the chroma format.
Definition: common.h:642
dirac::ParseParams::MajorVersion
unsigned int MajorVersion() const
Get the major version.
Definition: common.h:899
dirac::OLBParams
Parameters for overlapped block motion compensation.
Definition: common.h:817
dirac::PictureParams
Parameters for initialising picture class objects.
Definition: common.h:532
dirac::IntToVideoFormat
VideoFormat IntToVideoFormat(int video_format)
Function to convert an integer to a valid VideoFormat.
dirac::EncoderParams::SetIntraTransformFilter
void SetIntraTransformFilter(WltFilter wf)
Set the Wavelet filter to be used for intra pictures.
Definition: common.h:1444
dirac::PictureSort::IsNonRef
bool IsNonRef() const
Definition: common.h:241
dirac::EncoderParams::m_L2_me_lambda
float m_L2_me_lambda
Lagrangian param for L2 motion estimation.
Definition: common.h:1522
dirac::CodecParams::m_yl
int m_yl
The frame/field luma height.
Definition: common.h:1239
dirac::PicArray::PicArray
PicArray(int height, int width, CompSort cs=Y_COMP)
Constructor.
Definition: common.h:732
dirac::SourceParams::m_top_offset
unsigned int m_top_offset
Clean area top offset.
Definition: common.h:501
dirac::EncoderParams::SetNumL1
void SetNumL1(const int nl)
Set the nominal number of L1 pictures between I pictures.
Definition: common.h:1414
dirac::CodecParams::SetSpatialPartition
void SetSpatialPartition(bool spatial_partition)
Set the spatial partition flag usedto picture (de)coding.
Definition: common.h:1213
dirac::SourceParams::m_pix_asr_idx
PixelAspectRatioType m_pix_asr_idx
Index into pixel aspect ratio table.
Definition: common.h:484
dirac::NZ_FBIN3_CTX
Definition: common.h:114
dirac::ParseParams::SetMinorVersion
void SetMinorVersion(unsigned int minor_ver)
Set the minor version.
Definition: common.h:916
dirac::SourceParams::LumaOffset
unsigned int LumaOffset() const
Return the luma offset.
Definition: common.h:352
dirac::DecoderParams
Parameters for the decoding process.
Definition: common.h:1548
dirac::EncoderParams::SetVerbose
void SetVerbose(bool v)
Sets verbosity on or off.
Definition: common.h:1390
dirac::CodecParams::m_topfieldfirst
bool m_topfieldfirst
True if interlaced and top field is first in temporal order.
Definition: common.h:1233
dirac::CodecParams::GetCodeBlocks
const CodeBlocks & GetCodeBlocks(unsigned int level) const
Return the code blocks for a particular level.
dirac::CodecParams::GetPicPredParams
PicturePredParams & GetPicPredParams()
Return the picture prediction params.
Definition: common.h:1167
dirac::MV_INFO_CTX
Definition: common.h:150
dirac::PictureSort::PictureSort
PictureSort()
Definition: common.h:231
dirac::PictureParams::CFormat
const ChromaFormat & CFormat() const
Returns the chroma format of the picture.
Definition: common.h:565
dirac::CodecParams::ChromaDepth
unsigned int ChromaDepth() const
Returns the chroma depth.
Definition: common.h:1143
dirac::DecoderParams::SetVerbose
void SetVerbose(bool v)
Sets verbosity on or off.
Definition: common.h:1558
dirac::OLBParams::SetXblen
void SetXblen(int xblen)
Sets the block width.
Definition: common.h:861
dirac::PictureParams::SetPictureType
void SetPictureType(const PictureType ftype)
Sets the picture to be Intra/Inter.
dirac::OLBParams::operator<<
friend std::ostream & operator<<(std::ostream &, OLBParams &)
dirac::INTRA
Definition: common.h:84
dirac::Z_FBIN2_CTX
Definition: common.h:105
dirac::SourceParams::ChromaExcursion
unsigned int ChromaExcursion() const
Return the chroma excursion.
Definition: common.h:358
dirac::EncoderParams::m_ent_correct
EntropyCorrector * m_ent_correct
Correction factors for quantiser selection.
Definition: common.h:1525
dirac::PicturePredParams::m_y_num_blocks
int m_y_num_blocks
The number of blocks vertically.
Definition: common.h:1071
dirac::EncoderParams::YRangeME
int YRangeME() const
Get the vertical search range for full-search motion estimation.
Definition: common.h:1314
dirac::EncoderParams::L1Sep
int L1Sep() const
Return the separation between L1 pictures (and between L1 and I pictures)
Definition: common.h:1331
dirac::Q_OFFSET_SIGN_CTX
Definition: common.h:125
dirac::SourceParams::m_left_offset
unsigned int m_left_offset
Clean area left offset.
Definition: common.h:498
dirac::SourceParams::GetVideoFormat
VideoFormat GetVideoFormat() const
Returns video-format.
Definition: common.h:301
dirac::EncoderParams::GOPLength
int GOPLength() const
Return the size of the GOP.
dirac::CodecParams::m_wlt_filter
WltFilter m_wlt_filter
The wavelet filter being used.
Definition: common.h:1260
dirac::SourceParams::m_pixel_aspect_ratio
Rational m_pixel_aspect_ratio
Pixel Aspect Ratio.
Definition: common.h:487
dirac::IntToMVPrecisionType
MVPrecisionType IntToMVPrecisionType(int mv_prec)
Function to convert an integer to a valid motion-vector precision type.
dirac::PictureParams::m_fnum
int m_fnum
The picture number, in temporal order.
Definition: common.h:677
dirac::QuantiserLists::m_qflist4
OneDArray< int > m_qflist4
Definition: common.h:1602
dirac::PicturePredParams::Ref2Weight
int Ref2Weight() const
Return the Ref2 weight.
Definition: common.h:984
dirac::PictureSort::SetInter
void SetInter()
Definition: common.h:234
dirac::EntropyCorrector::Factor
float Factor(const int bandnum, const PictureParams &pp, const CompSort c) const
Returns the correction factor.
dirac::CodecParams::m_luma_depth
unsigned int m_luma_depth
Luma depth - number of bits required for lumz.
Definition: common.h:1248
dirac::NZ_FBIN4_CTX
Definition: common.h:115
dirac::PictureParams::m_chroma_depth
unsigned int m_chroma_depth
chroma depth - number of bits required for luma
Definition: common.h:707
dirac::EncoderParams::SetLocalDecode
void SetLocalDecode(const bool decode)
Sets a flag indicating that we're producing a locally decoded o/p.
Definition: common.h:1393
dirac::Z_FBIN5_CTX
Definition: common.h:108
dirac::CodecParams::m_picpredparams
PicturePredParams m_picpredparams
The picture prediction parameters.
Definition: common.h:1227
dirac::EncoderParams::m_x_range_me
int m_x_range_me
The horizontal range for full-search block matching.
Definition: common.h:1480
dirac::SourceParams::CleanWidth
unsigned int CleanWidth() const
Return the Clean area width.
Definition: common.h:338
dirac::Z_FBIN6plus_CTX
Definition: common.h:109
dirac::CodecParams::m_wlt_depth
unsigned int m_wlt_depth
Wavelet depth.
Definition: common.h:1263
dirac::OLBParams::operator>>
friend std::istream & operator>>(std::istream &, OLBParams &)
dirac::PictureParams::ChromaXl
int ChromaXl() const
Returns the chroma width of the picture.
Definition: common.h:574
dirac::NZ_FBIN6plus_CTX
Definition: common.h:117
dirac::Rational::m_num
unsigned int m_num
Numerator.
Definition: common.h:222
dirac::CodecParams::SetLumaDepth
void SetLumaDepth(unsigned int luma_depth)
Set Luma Depth.
Definition: common.h:1192
dirac::PictureParams::GetPictureType
PictureType GetPictureType() const
Returns type of picture (see enum)
Definition: common.h:613
dirac::CostType::ENTROPY
double ENTROPY
The entropy in bits per symbol.
Definition: common.h:760
dirac::CostType::Error
double Error
The error (MSE or 4th power)
Definition: common.h:757
dirac::CodecParams::SetTransformFilter
void SetTransformFilter(const WltFilter wf)
Set the wavelet filter used for picture (de)coding.
Definition: common.h:1201
dirac::OLBParams::Yblen
int Yblen() const
Returns the vertical block length.
Definition: common.h:844
dirac::CodecParams::SetTransformDepth
void SetTransformDepth(unsigned int wd)
Set the transform depth used for picture (de)coding and allocate for the code blocks array...
dirac::ParseParams::m_major_ver
unsigned int m_major_ver
Major Version.
Definition: common.h:926
dirac::EntropyCorrector::m_Vfctrs
TwoDArray< float > m_Vfctrs
Definition: common.h:813
dirac::EncoderParams::m_combined_me
bool m_combined_me
A flag indicating whether we're doing combined component motion estimation.
Definition: common.h:1477
dirac::SB_SPLIT_BIN2_CTX
Definition: common.h:164
dirac::SourceParams::Yl
unsigned int Yl() const
Returns the picture height.
Definition: common.h:307
dirac::PicturePredParams::ChromaBParams
const OLBParams & ChromaBParams(int n) const
Return the Chroma block parameters for each macroblock splitting level.
Definition: common.h:1009
dirac::CodeBlocks::VerticalCodeBlocks
unsigned int VerticalCodeBlocks() const
Return the number of vertical code blocks.
Definition: common.h:953
INTER_PICTURE
Definition: common_types.h:88
dirac::SourceParams::SetSourceSampling
void SetSourceSampling(unsigned int source_sampling)
Set if the source sampling field of the scan format.
Definition: common.h:382
dirac::EncoderParams::NumL1
int NumL1() const
Return the nominal number of L1 pictures before the next I picture.
Definition: common.h:1328
dirac::MvCtxAliases
MvCtxAliases
Contexts used for MV data coding.
Definition: common.h:130
dirac::EncoderParams::m_ufactor
float m_ufactor
factor for weighting U component quantisation errors
Definition: common.h:1495
dirac::ParseParams::MinorVersion
unsigned int MinorVersion() const
Get the minor version.
Definition: common.h:902
dirac::CodecParams::m_cyl
int m_cyl
The frame/field chroma height.
Definition: common.h:1245
dirac::DC_SIGN_CTX
Definition: common.h:138
dirac::PictureParams::m_picture_type
PictureType m_picture_type
Picture type.
Definition: common.h:680
dirac::EncoderParams::m_qf
float m_qf
Quality factor.
Definition: common.h:1486
dirac::PictureParams::SetReferenceType
void SetReferenceType(const ReferenceType rtype)
Sets the picture to be a reference or not.
dirac::EncoderParams::m_num_L1
int m_num_L1
Number of L1 pictures before next I picture.
Definition: common.h:1489
dirac::EncoderParams::SetFullSearch
void SetFullSearch(const bool fs)
Set whether we're doing full-search motion estimation.
Definition: common.h:1399
dirac::CostType::TOTAL
double TOTAL
The Lagrangian combination of MSE+lambda*entropy.
Definition: common.h:763
dirac::PicturePredParams
Structure to hold motion parameters when motion comp is used.
Definition: common.h:967
dirac::INFO_CTX
Definition: common.h:120
dirac::SIGN_POS_CTX
Definition: common.h:99
dirac::CodecParams::SetXl
void SetXl(const int x)
Set the picture/field luma width.
Definition: common.h:1180
dirac::CodecParams::SpatialPartition
bool SpatialPartition() const
Return the spatial partitioning flag being used for picture (de)coding.
Definition: common.h:1158
dirac::EncoderParams::SetIntraTransformFilter
void SetIntraTransformFilter(unsigned int wf_idx)
Set the Wavelet filter to be used for intra pictures.
dirac::CodecParams::ChromaXl
int ChromaXl() const
Return the picture/field chroma width.
Definition: common.h:1134
dirac::PicturePredParams::m_x_num_blocks
int m_x_num_blocks
The number of blocks horizontally.
Definition: common.h:1068
dirac::EncoderParams::m_L1_lambda
float m_L1_lambda
Lagrangian parameter for L1 picture coding.
Definition: common.h:1513
dirac::CodecParams::SetTopFieldFirst
void SetTopFieldFirst(bool topf)
Sets whether the topmost field comes first in time [NB: TBD since this duplicates metadata in the seq...
Definition: common.h:1177
dirac::PicturePredParams::m_ref2_weight
int m_ref2_weight
picture predicion parameters - reference picture 2 weight
Definition: common.h:1087
dirac::TOTAL_MV_CTXS
Definition: common.h:168
dirac::EncoderParams::SetCombinedME
void SetCombinedME(const bool cme)
Set whether we're doing combined component motion estimation.
Definition: common.h:1402
dirac::CodecParams::TransformDepth
unsigned int TransformDepth() const
Return the transform depth being used for picture (de)coding.
Definition: common.h:1152
dirac::ValueType
short ValueType
Type of picture data (including motion compensated residuals)
Definition: common.h:70
dirac::CodeBlocks::SetVerticalCodeBlocks
void SetVerticalCodeBlocks(unsigned int vblocks)
Set the number of vertical code blocks.
Definition: common.h:958
dirac::EncoderParams::SetUFactor
void SetUFactor(const float uf)
Set the amount to weight noise in the U component.
Definition: common.h:1420
dirac::PicturePredParams::m_cbparams
OneDArray< OLBParams > m_cbparams
Definition: common.h:1075
dirac::SourceParams::TransferFunctionIndex
TransferFunction TransferFunctionIndex() const
Return the transfer function index.
Definition: common.h:368
dirac::EntropyCorrector::Update
void Update(int bandnum, const PictureParams &pp, CompSort c, int est_bits, int actual_bits)
Update the correction factors.
dirac::EncoderParams::m_target_rate
int m_target_rate
Target bit rate.
Definition: common.h:1537
dirac::EncoderParams::L2MELambda
float L2MELambda() const
Return the Lagrangian ME parameter to be used for L2 pictures.
Definition: common.h:1361
dirac::EncoderParams::m_full_search
bool m_full_search
A flag indicating whether we're doing full-search block matching.
Definition: common.h:1474
dirac::EncoderParams::VFactor
float VFactor() const
Return the amount we're weighting noise in the V component.
Definition: common.h:1337
dirac::PicturePredParams::UsingGlobalMotion
bool UsingGlobalMotion() const
Return the global motion flag used for encoding/decoding.
Definition: common.h:975
dirac::SourceParams::Xl
unsigned int Xl() const
Returns the picture width.
Definition: common.h:304
dirac::SourceParams::ChromaHeight
int ChromaHeight() const
Returns the chroma height.
dirac::EncoderParams::Verbose
bool Verbose() const
Returns true if we're operating verbosely, false otherwise.
Definition: common.h:1299
dirac::Z_FBIN3_CTX
Definition: common.h:106
dirac::OLBParams::m_xoffset
int m_xoffset
Definition: common.h:885
dirac::EncoderParams::m_y_range_me
int m_y_range_me
The vertical range for full-search block matching.
Definition: common.h:1483
dirac::PicturePredParams::PictureWeightsBits
unsigned int PictureWeightsBits() const
Return the number of picture weight precision bits.
Definition: common.h:978
dirac::ParseParams::Level
unsigned int Level() const
Get the Level.
Definition: common.h:908
dirac::BChk
ValueType BChk(const ValueType &num, const ValueType &max)
A simple bounds checking function, very useful in a number of places.
Definition: common.h:1574
dirac::EncoderParams::CalcLambdas
void CalcLambdas(const float qf)
Calculate the Lagrangian parameters from the quality factor.
dirac::PicArray::~PicArray
~PicArray()
Destructor.
Definition: common.h:738
dirac::EncoderParams::SetXRangeME
void SetXRangeME(const int xr)
Set the horizontal search range for full-search motion estimation.
Definition: common.h:1405
dirac::EncoderParams::m_cpd
float m_cpd
Cycles per degree assumed for viewing the video.
Definition: common.h:1501
dirac::DC_FBIN1_CTX
Definition: common.h:135
dirac::FORWARD
Definition: common.h:93
dirac::EntropyCorrector::m_Ufctrs
TwoDArray< float > m_Ufctrs
Definition: common.h:812
dirac::PictureParams::SetPicSort
void SetPicSort(const PictureSort &ps)
Sets the type of picture.
dirac::ParseParams::SetProfile
void SetProfile(unsigned int profile)
Set the Profile.
Definition: common.h:919
dirac::PicturePredParams::SetBlockSizes
void SetBlockSizes(const OLBParams &olbparams, const ChromaFormat cformat)
Set the block sizes for all SB splitting levels given these prototype block sizes for level=2...
dirac
Definition of class SequenceHeaderByteIO.
Definition: accessunit_byteio.h:51
dirac::CodecParams::TransformFilter
WltFilter TransformFilter() const
Return the wavelet filter currently being used for picture (de)coding.
Definition: common.h:1149
dirac::PictureParams::m_using_ac
bool m_using_ac
arithmetic coding flag
Definition: common.h:710
dirac::SourceParams::SetFrameRate
void SetFrameRate(const Rational &frate)
Set the frame rate.
Definition: common.h:392
dirac::PictureParams::SetUsingAC
void SetUsingAC(bool using_ac)
Sets the arithmetic coding flag.
Definition: common.h:660
dirac::NZ_FBIN1nz_CTX
Definition: common.h:112
dirac::PictureSort::InterRefPictureSort
static PictureSort InterRefPictureSort()
Definition: common.h:262
dirac::CodecParams::FieldCoding
bool FieldCoding() const
Returns true if the pictures are being coded as fields (mode 1 or 3)
Definition: common.h:1122
dirac::CodecParams::Yl
int Yl() const
Return the picture/field luma height.
Definition: common.h:1131
dirac::PictureParams::ChromaYl
int ChromaYl() const
Returns the chroma height of the picture.
Definition: common.h:577
dirac::PicturePredParams::SetMVPrecision
void SetMVPrecision(const MVPrecisionType p) const
Definition: common.h:1040
dirac::EncoderParams::SetL1Sep
void SetL1Sep(const int lsep)
Set the separation between L1 pictures.
Definition: common.h:1417
ColourMatrix
ColourMatrix
Definition: common_types.h:133
dirac::Z_FBIN1z_CTX
Definition: common.h:103
dirac::AddOrSub
AddOrSub
Addition or subtraction.
Definition: common.h:90
dirac::CodecParams::m_cxl
int m_cxl
The frame/field chroma width.
Definition: common.h:1242
dirac::CodecParams::m_pic_coding_mode
int m_pic_coding_mode
The picture coding mode.
Definition: common.h:1230
dirac::SourceParams::SetYl
void SetYl(unsigned int ylen)
Sets the picture height.
Definition: common.h:376
dirac::SourceParams::LeftOffset
unsigned int LeftOffset() const
Return the Clean area left offset.
Definition: common.h:342
dirac::BLOCK_SKIP_CTX
Definition: common.h:122
dirac::SourceParams::m_video_format
VideoFormat m_video_format
Video-format.
Definition: common.h:460
dirac::PictureParams::m_cxl
int m_cxl
Picture chroma width.
Definition: common.h:698
dirac::PicturePredParams::MVPrecision
MVPrecisionType MVPrecision() const
Return the number of accuracy bits used for motion vectors.
Definition: common.h:1012
dirac::NZ_FBIN2_CTX
Definition: common.h:113
dirac::EncoderParams::Qf
float Qf() const
Get the quality factor.
Definition: common.h:1320
dirac::PictureSort::InterNonRefPictureSort
static PictureSort InterNonRefPictureSort()
Definition: common.h:276
dirac::EncoderParams::Lossless
bool Lossless() const
Get whether we're doing lossless coding.
Definition: common.h:1305
dirac::SourceParams::SourceParams
SourceParams(const VideoFormat &vf=VIDEO_FORMAT_CUSTOM, bool set_defaults=true)
default constructor
dirac::IntToFrameRateType
FrameRateType IntToFrameRateType(int frame_rate_idx)
Function to convert an integer to a valid FrameRate type.
dirac_assertions.h
dirac::PictureSort::SetInterRef
void SetInterRef()
Definition: common.h:246
WltFilter
WltFilter
Definition: common_types.h:61
dirac::PictureParams::SetPictureNum
void SetPictureNum(const int fn)
Sets the picture number.
Definition: common.h:633
dirac::PictureParams::m_cformat
ChromaFormat m_cformat
The chroma format.
Definition: common.h:665
dirac::EncoderParams::SetPrefilter
void SetPrefilter(const PrefilterType pf, const int str)
Set denoising value - true or false.
Definition: common.h:1429
dirac::OLBParams::SetYblen
void SetYblen(int yblen)
Sets the block height.
Definition: common.h:864
dirac::PicturePredParams::m_y_num_sb
int m_y_num_sb
The number of superblocks verticaly.
Definition: common.h:1065
dirac::PictureParams::SetChromaDepth
void SetChromaDepth(unsigned int chroma_depth)
Set Chroma Depth.
Definition: common.h:654
dirac::SourceParams::TopOffset
unsigned int TopOffset() const
Return the Clean area top offset.
Definition: common.h:344
dirac::SourceParams::SignalRangeIndex
SignalRangeType SignalRangeIndex() const
Return the type from the signal range table.
Definition: common.h:349
dirac::PictureParams::SetXl
void SetXl(int xlen)
Sets the picture width.
dirac::SourceParams::CFormat
ChromaFormat CFormat() const
Returns the chroma format of the sequence (420, 422, 444)
Definition: common.h:310
dirac::PicArray::m_csort
CompSort m_csort
Definition: common.h:748
dirac::CompSort
CompSort
Types of picture component.
Definition: common.h:87
SignalRangeType
SignalRangeType
Definition: common_types.h:179
PrefilterType
PrefilterType
Definition: common_types.h:75
dirac::ADD
Definition: common.h:90
dirac::CodecParams::m_video_format
VideoFormat m_video_format
The video format being used.
Definition: common.h:1254
dirac::PicturePredParams::m_use_global_motion
bool m_use_global_motion
Global motion fields.
Definition: common.h:1090
dirac::SourceParams::SetLumaOffset
void SetLumaOffset(unsigned int luma_offset)
Set the luma offset.
Definition: common.h:441
dirac::Q_OFFSET_INFO_CTX
Definition: common.h:124
dirac::EncoderParams::SetLossless
void SetLossless(const bool l)
Set whether we're doing lossless coding.
Definition: common.h:1396
dirac::PictureParams::ChromaDepth
unsigned int ChromaDepth() const
Returns the chroma depth.
Definition: common.h:583
dirac::PicturePredParams::SetYNumBlocks
void SetYNumBlocks(const int yn)
Set how many blocks there are vertically.
Definition: common.h:1024
dirac::Y_COMP
Definition: common.h:87
dirac::PictureSort::IsIntraNonRef
bool IsIntraNonRef() const
Definition: common.h:248
dirac::U_COMP
Definition: common.h:87
dirac::SourceParams::m_transfer_func
TransferFunction m_transfer_func
Definition: common.h:527
dirac::PictureParams::SetLumaDepth
void SetLumaDepth(unsigned int luma_depth)
Set Luma Depth.
Definition: common.h:651
PictureType
PictureType
Definition: common_types.h:86
dirac::EncoderParams::m_L1_me_lambda
float m_L1_me_lambda
Lagrangian param for L1 motion estimation.
Definition: common.h:1519
dirac::EncoderParams::CombinedME
bool CombinedME() const
Get whether we're doing combined component motion estimation.
Definition: common.h:1317
dirac::QuantiserLists::IntraQuantOffset4
int IntraQuantOffset4(const int index) const
Returns the intra Picture quantisation offset for non-zero values.
Definition: common.h:1592
dirac::QuantiserLists::MaxQuantIndex
int MaxQuantIndex() const
Returns the maximum quantiser index supported.
Definition: common.h:1597
dirac::OLBParams::operator==
bool operator==(const OLBParams bparams) const
dirac::Q_OFFSET_FOLLOW_CTX
Definition: common.h:123
dirac::CodecParams::SetVideoFormat
void SetVideoFormat(const VideoFormat vd)
Set the video format used for picture (de)coding.
Definition: common.h:1219
dirac::EncoderParams::m_L1_sep
int m_L1_sep
Separation between L1 pictures.
Definition: common.h:1492
dirac::EncoderParams::m_L2_lambda
float m_L2_lambda
Lagrangian parameter for L2 picture coding.
Definition: common.h:1516
dirac::PictureParams::m_cyl
int m_cyl
Picture chroma height.
Definition: common.h:701
dirac::PicturePredParams::SetRef1Weight
void SetRef1Weight(int wt)
Set the ref 1 picture weight.
Definition: common.h:1054
dirac::PictureParams::RetiredPictureNum
int RetiredPictureNum() const
Returns the retired reference picture number.
Definition: common.h:592
PIXEL_ASPECT_RATIO_CUSTOM
Definition: common_types.h:167
dirac::PictureSort::SetInterNonRef
void SetInterNonRef()
Definition: common.h:245
dirac::PicturePredParams::YNumBlocks
int YNumBlocks() const
Returns the number of blocks vertically.
Definition: common.h:1003
dirac::SourceParams::m_luma_offset
unsigned int m_luma_offset
Luma offset.
Definition: common.h:509
dirac::IntToSignalRangeType
SignalRangeType IntToSignalRangeType(int signal_range_idx)
Function to convert an integer to a valid SignalRange type.
dirac::EncoderParams::SetUsualCodeBlocks
void SetUsualCodeBlocks(const PictureType &ftype)
Set the number of code blocks for all levels.
VIDEO_FORMAT_CIF
Definition: common_types.h:103
dirac::ParseParams
Parameters relating to the complexity of encoder/decoder.
Definition: common.h:890
dirac::SourceParams::CleanHeight
unsigned int CleanHeight() const
Return the Clean area height.
Definition: common.h:340
dirac::PicturePredParams::CustomRefWeights
bool CustomRefWeights()
Definition: common.h:986
dirac::OLBParams::m_ybsep
int m_ybsep
Definition: common.h:884
dirac::CodecParams
Parameters common to coder and decoder operation.
Definition: common.h:1098
dirac::CodecParams::SetPictureCodingMode
void SetPictureCodingMode(int pic_coding)
Sets whether input is coded as fields or quincunxially.
Definition: common.h:1174
dirac::ParseParams::m_profile
unsigned int m_profile
Profile.
Definition: common.h:930
dirac::DC_FBIN2plus_CTX
Definition: common.h:136
dirac::Z_FBIN1nz_CTX
Definition: common.h:104
FrameRateType
FrameRateType
Definition: common_types.h:150
dirac::CodeBlocks::m_vblocks
unsigned int m_vblocks
Number of Vertical code blocks.
Definition: common.h:963
dirac::PictureSort::IntraNonRefPictureSort
static PictureSort IntraNonRefPictureSort()
Definition: common.h:269
dirac::EncoderParams::Prefilter
PrefilterType Prefilter() const
Return what prefiltering is in place.
Definition: common.h:1343
dirac::IntToChromaFormat
ChromaFormat IntToChromaFormat(int chroma_format)
Function to convert an integer to a valid VideoFormat.
dirac::ParseParams::Profile
unsigned int Profile() const
Get the Profile.
Definition: common.h:905
dirac::CodecParams::ChromaYl
int ChromaYl() const
Return the picture/field chroma height.
Definition: common.h:1137
dirac::PictureParams::m_xl
int m_xl
Picture luma width.
Definition: common.h:692
dirac::EncoderParams::SetYRangeME
void SetYRangeME(const int yr)
Set the vertical search range for full-search motion estimation.
Definition: common.h:1408
common_types.h
dirac::EncoderParams::IntraTransformFilter
WltFilter IntraTransformFilter()
Return the Wavelet filter to be used for intra pictures.
Definition: common.h:1376
dirac::EncoderParams::L1MELambda
float L1MELambda() const
Return the Lagrangian ME parameter to be used for L1 pictures.
Definition: common.h:1358
dirac::SourceParams::SetFrameRate
void SetFrameRate(unsigned int fr_num, unsigned int fr_denom)
Set the frame rate.
Definition: common.h:398
dirac::SourceParams::SetCleanWidth
void SetCleanWidth(unsigned int clean_width)
Set the Clean area width.
Definition: common.h:428

© 2004 British Broadcasting Corporation. Dirac code licensed under the Mozilla Public License (MPL) Version 1.1.
HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.