From 4e66c2c012c06453ea53c543ab8c385e949cf208 Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin <jmvalin@jmvalin.ca> Date: Tue, 15 May 2012 16:13:18 -0400 Subject: [PATCH] Gen-art (bit allocation work). Also, make the archive work with older versions of tar --- doc/build_draft.sh | 2 +- doc/draft-ietf-codec-opus.xml | 54 +++++++++++++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/doc/build_draft.sh b/doc/build_draft.sh index 7809ee839..dabdf017a 100755 --- a/doc/build_draft.sh +++ b/doc/build_draft.sh @@ -35,7 +35,7 @@ cp -a "${toplevel}"/README.draft "${destdir}"/README cp -a "${toplevel}"/COPYING "${destdir}"/COPYING cp -a "${toplevel}"/tests/run_vectors.sh "${destdir}"/ -tar czf opus_source.tar.gz "${destdir}" +GZIP=-9 tar --owner=root --group=root --old-archive -czf opus_source.tar.gz "${destdir}" echo building base64 version cat opus_source.tar.gz| base64 | tr -d '\n' | fold -w 64 | \ sed -e 's/^/\<spanx style="vbare"\>###/' -e 's/$/\<\/spanx\>\<vspace\/\>/' > \ diff --git a/doc/draft-ietf-codec-opus.xml b/doc/draft-ietf-codec-opus.xml index 7b043c594..97e9ae377 100644 --- a/doc/draft-ietf-codec-opus.xml +++ b/doc/draft-ietf-codec-opus.xml @@ -5115,6 +5115,51 @@ controlling the use of remaining bits at the end of the frame, and a remaining balance of unallocated space, which is usually zero except at very high rates.</t> +<t> +The "static" bit allocation (in 1/8 bits) for a quality q, excluding the minimums, maximums, +tilt and boosts, is equal to channels*N*alloc[band][q]<<LM>>2, where +alloc[][] is given in <xref target="static_alloc"/> and LM=log2(frame_size/120). The allocation +is obtained by linearly interpolating between two values of q (in steps of 1/64) to find the +highest allocation that does not exceed the number of bits remaining. +</t> + +<texttable anchor="static_alloc" + title="CELT static allocation table"> + <preamble>Rows indicate the MDCT bands, columns are the different quality (q) parameters. The units are 1/32 bit per MDCT sample.</preamble> +<ttcol align="right">0</ttcol> +<ttcol align="right">1</ttcol> +<ttcol align="right">2</ttcol> +<ttcol align="right">3</ttcol> +<ttcol align="right">4</ttcol> +<ttcol align="right">5</ttcol> +<ttcol align="right">6</ttcol> +<ttcol align="right">7</ttcol> +<ttcol align="right">8</ttcol> +<ttcol align="right">9</ttcol> +<ttcol align="right">10</ttcol> +<c>0</c><c>90</c><c>110</c><c>118</c><c>126</c><c>134</c><c>144</c><c>152</c><c>162</c><c>172</c><c>200</c> +<c>0</c><c>80</c><c>100</c><c>110</c><c>119</c><c>127</c><c>137</c><c>145</c><c>155</c><c>165</c><c>200</c> +<c>0</c><c>75</c><c>90</c><c>103</c><c>112</c><c>120</c><c>130</c><c>138</c><c>148</c><c>158</c><c>200</c> +<c>0</c><c>69</c><c>84</c><c>93</c><c>104</c><c>114</c><c>124</c><c>132</c><c>142</c><c>152</c><c>200</c> +<c>0</c><c>63</c><c>78</c><c>86</c><c>95</c><c>103</c><c>113</c><c>123</c><c>133</c><c>143</c><c>200</c> +<c>0</c><c>56</c><c>71</c><c>80</c><c>89</c><c>97</c><c>107</c><c>117</c><c>127</c><c>137</c><c>200</c> +<c>0</c><c>49</c><c>65</c><c>75</c><c>83</c><c>91</c><c>101</c><c>111</c><c>121</c><c>131</c><c>200</c> +<c>0</c><c>40</c><c>58</c><c>70</c><c>78</c><c>85</c><c>95</c><c>105</c><c>115</c><c>125</c><c>200</c> +<c>0</c><c>34</c><c>51</c><c>65</c><c>72</c><c>78</c><c>88</c><c>98</c><c>108</c><c>118</c><c>198</c> +<c>0</c><c>29</c><c>45</c><c>59</c><c>66</c><c>72</c><c>82</c><c>92</c><c>102</c><c>112</c><c>193</c> +<c>0</c><c>20</c><c>39</c><c>53</c><c>60</c><c>66</c><c>76</c><c>86</c><c>96</c><c>106</c><c>188</c> +<c>0</c><c>18</c><c>32</c><c>47</c><c>54</c><c>60</c><c>70</c><c>80</c><c>90</c><c>100</c><c>183</c> +<c>0</c><c>10</c><c>26</c><c>40</c><c>47</c><c>54</c><c>64</c><c>74</c><c>84</c><c>94</c><c>178</c> +<c>0</c><c>0</c><c>20</c><c>31</c><c>39</c><c>47</c><c>57</c><c>67</c><c>77</c><c>87</c><c>173</c> +<c>0</c><c>0</c><c>12</c><c>23</c><c>32</c><c>41</c><c>51</c><c>61</c><c>71</c><c>81</c><c>168</c> +<c>0</c><c>0</c><c>0</c><c>15</c><c>25</c><c>35</c><c>45</c><c>55</c><c>65</c><c>75</c><c>163</c> +<c>0</c><c>0</c><c>0</c><c>4</c><c>17</c><c>29</c><c>39</c><c>49</c><c>59</c><c>69</c><c>158</c> +<c>0</c><c>0</c><c>0</c><c>0</c><c>12</c><c>23</c><c>33</c><c>43</c><c>53</c><c>63</c><c>153</c> +<c>0</c><c>0</c><c>0</c><c>0</c><c>1</c><c>16</c><c>26</c><c>36</c><c>46</c><c>56</c><c>148</c> +<c>0</c><c>0</c><c>0</c><c>0</c><c>0</c><c>10</c><c>15</c><c>20</c><c>30</c><c>45</c><c>129</c> +<c>0</c><c>0</c><c>0</c><c>0</c><c>0</c><c>1</c><c>1</c><c>1</c><c>1</c><c>20</c><c>104</c> +</texttable> + <t>The maximum allocation vector is an approximation of the maximum space that can be used by each band for a given mode. The value is approximate because the shape encoding is variable rate (due @@ -5123,8 +5168,11 @@ maximum achievable quality in a band while setting it too high may result in waste: bitstream capacity available at the end of the frame which can not be put to any use. The maximums specified by the codec reflect the average maximum. In the reference -implementation, the maximums are provided in partially computed form, in order to fit in less -memory as a static table (see cache_caps50[] in static_modes_float.h). Implementations are expected +implementation, the maximums in bit/sample are precomputed in a static table +(see cache_caps50[] in static_modes_float.h) for each band, +for each value of LM, and for both mono and stereo. + +Implementations are expected to simply use the same table data, but the procedure for generating this table is included in rate.c as part of compute_pulse_cache().</t> @@ -5132,7 +5180,7 @@ this table is included in rate.c as part of compute_pulse_cache().</t> set nbBands to the maximum number of bands for this mode, and stereo to zero if stereo is not in use and one otherwise. For each band set N to the number of MDCT bins covered by the band (for one channel), set LM -to the shift value for the frame size (log2(frame_size/120)), +to the shift value for the frame size, then set i to nbBands*(2*LM+stereo). Then set the maximum for the band to the i-th index of cache.caps + 64 and multiply by the number of channels in the current frame (one or two) and by N, then divide the result by 4 -- GitLab