Changeset 126 for CoolStreaming
- Timestamp:
- Jan 15, 2011, 10:03:27 PM (14 years ago)
- Location:
- CoolStreaming
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
CoolStreaming/Demo/DynNumber
- Property svn:ignore
-
old new 1 1 DynNumberDemo.exe 2 2 lib 3 heaptrclog.trc 4 DynNumberDemo
-
- Property svn:ignore
-
CoolStreaming/Demo/DynNumber/DynNumberDemo.lpi
r125 r126 28 28 <local> 29 29 <FormatVersion Value="1"/> 30 <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> 30 31 </local> 31 32 </RunParams> … … 38 39 </Item2> 39 40 </RequiredPackages> 40 <Units Count=" 4">41 <Units Count="14"> 41 42 <Unit0> 42 43 <Filename Value="DynNumberDemo.lpr"/> 43 44 <IsPartOfProject Value="True"/> 44 45 <UnitName Value="DynNumberDemo"/> 45 <UsageCount Value="20"/> 46 <EditorIndex Value="1"/> 47 <WindowIndex Value="0"/> 48 <TopLine Value="1"/> 49 <CursorPos X="41" Y="19"/> 50 <UsageCount Value="36"/> 51 <Loaded Value="True"/> 46 52 </Unit0> 47 53 <Unit1> … … 51 57 <ResourceBaseClass Value="Form"/> 52 58 <UnitName Value="UMainForm"/> 59 <IsVisibleTab Value="True"/> 53 60 <EditorIndex Value="0"/> 54 61 <WindowIndex Value="0"/> 55 <TopLine Value=" 42"/>56 <CursorPos X=" 12" Y="51"/>57 <UsageCount Value=" 20"/>62 <TopLine Value="67"/> 63 <CursorPos X="23" Y="89"/> 64 <UsageCount Value="36"/> 58 65 <Loaded Value="True"/> 59 66 <LoadedDesigner Value="True"/> … … 62 69 <Filename Value="..\..\UDynNumber.pas"/> 63 70 <UnitName Value="UDynNumber"/> 64 <IsVisibleTab Value="True"/> 65 <EditorIndex Value="1"/> 66 <WindowIndex Value="0"/> 67 <TopLine Value="26"/> 68 <CursorPos X="8" Y="32"/> 69 <UsageCount Value="10"/> 71 <EditorIndex Value="2"/> 72 <WindowIndex Value="0"/> 73 <TopLine Value="11"/> 74 <CursorPos X="49" Y="26"/> 75 <UsageCount Value="18"/> 70 76 <Loaded Value="True"/> 71 77 </Unit2> … … 73 79 <Filename Value="..\..\UBitStream.pas"/> 74 80 <UnitName Value="UBitStream"/> 75 <EditorIndex Value="2"/> 76 <WindowIndex Value="0"/> 77 <TopLine Value="119"/> 78 <CursorPos X="1" Y="131"/> 81 <EditorIndex Value="5"/> 82 <WindowIndex Value="0"/> 83 <TopLine Value="17"/> 84 <CursorPos X="49" Y="33"/> 85 <UsageCount Value="18"/> 86 <Loaded Value="True"/> 87 </Unit3> 88 <Unit4> 89 <Filename Value="..\..\UBufferedFileStream.pas"/> 90 <UnitName Value="UBufferedFileStream"/> 91 <EditorIndex Value="3"/> 92 <WindowIndex Value="0"/> 93 <TopLine Value="38"/> 94 <CursorPos X="30" Y="54"/> 95 <UsageCount Value="18"/> 96 <Loaded Value="True"/> 97 </Unit4> 98 <Unit5> 99 <Filename Value="..\..\..\..\..\..\..\..\usr\share\fpcsrc\2.4.0\rtl\objpas\classes\classesh.inc"/> 100 <EditorIndex Value="4"/> 101 <WindowIndex Value="0"/> 102 <TopLine Value="773"/> 103 <CursorPos X="17" Y="789"/> 104 <UsageCount Value="18"/> 105 <Loaded Value="True"/> 106 </Unit5> 107 <Unit6> 108 <Filename Value="..\..\..\..\..\..\..\..\usr\share\fpcsrc\2.4.0\rtl\objpas\classes\streams.inc"/> 109 <WindowIndex Value="0"/> 110 <TopLine Value="462"/> 111 <CursorPos X="19" Y="467"/> 112 <UsageCount Value="8"/> 113 </Unit6> 114 <Unit7> 115 <Filename Value="..\..\..\..\..\..\..\..\usr\share\fpcsrc\2.4.0\rtl\objpas\sysutils\filutilh.inc"/> 116 <WindowIndex Value="0"/> 117 <TopLine Value="60"/> 118 <CursorPos X="10" Y="75"/> 119 <UsageCount Value="8"/> 120 </Unit7> 121 <Unit8> 122 <Filename Value="..\..\..\..\..\..\..\..\usr\share\fpcsrc\2.4.0\rtl\unix\sysutils.pp"/> 123 <UnitName Value="sysutils"/> 124 <WindowIndex Value="0"/> 125 <TopLine Value="435"/> 126 <CursorPos X="49" Y="435"/> 127 <UsageCount Value="8"/> 128 </Unit8> 129 <Unit9> 130 <Filename Value="..\..\..\..\..\..\..\..\usr\share\fpcsrc\2.4.0\rtl\unix\bunxovlh.inc"/> 131 <WindowIndex Value="0"/> 132 <TopLine Value="16"/> 133 <CursorPos X="60" Y="32"/> 134 <UsageCount Value="8"/> 135 </Unit9> 136 <Unit10> 137 <Filename Value="..\..\..\..\..\..\..\..\usr\share\fpcsrc\2.4.0\rtl\unix\aliasptp.inc"/> 138 <WindowIndex Value="0"/> 139 <TopLine Value="16"/> 140 <CursorPos X="27" Y="32"/> 141 <UsageCount Value="8"/> 142 </Unit10> 143 <Unit11> 144 <Filename Value="..\..\..\..\..\..\..\..\usr\share\fpcsrc\2.4.0\rtl\linux\ptypes.inc"/> 145 <WindowIndex Value="0"/> 146 <TopLine Value="41"/> 147 <CursorPos X="22" Y="57"/> 148 <UsageCount Value="8"/> 149 </Unit11> 150 <Unit12> 151 <Filename Value="..\..\..\..\..\..\..\..\usr\share\fpcsrc\2.4.0\rtl\unix\ctypes.inc"/> 152 <WindowIndex Value="0"/> 153 <TopLine Value="21"/> 154 <CursorPos X="3" Y="37"/> 155 <UsageCount Value="8"/> 156 </Unit12> 157 <Unit13> 158 <Filename Value="..\..\..\..\..\..\..\..\usr\share\fpcsrc\2.4.0\rtl\objpas\math.pp"/> 159 <UnitName Value="math"/> 160 <WindowIndex Value="0"/> 161 <TopLine Value="308"/> 162 <CursorPos X="10" Y="324"/> 79 163 <UsageCount Value="10"/> 80 <Loaded Value="True"/> 81 </Unit3> 164 </Unit13> 82 165 </Units> 83 <JumpHistory Count=" 19" HistoryIndex="18">166 <JumpHistory Count="29" HistoryIndex="28"> 84 167 <Position1> 85 168 <Filename Value="UMainForm.pas"/> 86 <Caret Line=" 9" Column="32" TopLine="1"/>169 <Caret Line="101" Column="1" TopLine="87"/> 87 170 </Position1> 88 171 <Position2> 89 172 <Filename Value="UMainForm.pas"/> 90 <Caret Line=" 24" Column="5" TopLine="17"/>173 <Caret Line="102" Column="1" TopLine="87"/> 91 174 </Position2> 92 175 <Position3> 93 176 <Filename Value="UMainForm.pas"/> 94 <Caret Line=" 44" Column="16" TopLine="24"/>177 <Caret Line="103" Column="1" TopLine="87"/> 95 178 </Position3> 96 179 <Position4> 97 <Filename Value=" ..\..\UDynNumber.pas"/>98 <Caret Line="1 6" Column="25" TopLine="1"/>180 <Filename Value="UMainForm.pas"/> 181 <Caret Line="104" Column="1" TopLine="87"/> 99 182 </Position4> 100 183 <Position5> 101 <Filename Value=" ..\..\UDynNumber.pas"/>102 <Caret Line="1 7" Column="25" TopLine="5"/>184 <Filename Value="UMainForm.pas"/> 185 <Caret Line="105" Column="1" TopLine="87"/> 103 186 </Position5> 104 187 <Position6> 105 <Filename Value=" ..\..\UDynNumber.pas"/>106 <Caret Line=" 29" Column="3" TopLine="7"/>188 <Filename Value="UMainForm.pas"/> 189 <Caret Line="106" Column="1" TopLine="87"/> 107 190 </Position6> 108 191 <Position7> 109 192 <Filename Value="UMainForm.pas"/> 110 <Caret Line=" 46" Column="15" TopLine="36"/>193 <Caret Line="79" Column="1" TopLine="63"/> 111 194 </Position7> 112 195 <Position8> 113 196 <Filename Value="UMainForm.pas"/> 114 <Caret Line=" 52" Column="21" TopLine="36"/>197 <Caret Line="94" Column="1" TopLine="77"/> 115 198 </Position8> 116 199 <Position9> 117 200 <Filename Value="UMainForm.pas"/> 118 <Caret Line=" 50" Column="7" TopLine="36"/>201 <Caret Line="96" Column="1" TopLine="77"/> 119 202 </Position9> 120 203 <Position10> 121 204 <Filename Value="UMainForm.pas"/> 122 <Caret Line=" 43" Column="16" TopLine="31"/>205 <Caret Line="97" Column="1" TopLine="77"/> 123 206 </Position10> 124 207 <Position11> 125 <Filename Value=" ..\..\UDynNumber.pas"/>126 <Caret Line=" 19" Column="34" TopLine="2"/>208 <Filename Value="UMainForm.pas"/> 209 <Caret Line="99" Column="1" TopLine="87"/> 127 210 </Position11> 128 211 <Position12> 129 <Filename Value=" ..\..\UDynNumber.pas"/>130 <Caret Line=" 46" Column="10" TopLine="26"/>212 <Filename Value="UMainForm.pas"/> 213 <Caret Line="81" Column="15" TopLine="63"/> 131 214 </Position12> 132 215 <Position13> 133 216 <Filename Value="UMainForm.pas"/> 134 <Caret Line=" 54" Column="26" TopLine="37"/>217 <Caret Line="80" Column="15" TopLine="62"/> 135 218 </Position13> 136 219 <Position14> 137 220 <Filename Value="UMainForm.pas"/> 138 <Caret Line=" 55" Column="1" TopLine="42"/>221 <Caret Line="81" Column="15" TopLine="63"/> 139 222 </Position14> 140 223 <Position15> 141 224 <Filename Value="UMainForm.pas"/> 142 <Caret Line=" 57" Column="1" TopLine="42"/>225 <Caret Line="48" Column="15" TopLine="32"/> 143 226 </Position15> 144 227 <Position16> 145 228 <Filename Value="UMainForm.pas"/> 146 <Caret Line=" 54" Column="1" TopLine="42"/>229 <Caret Line="122" Column="17" TopLine="102"/> 147 230 </Position16> 148 231 <Position17> 149 <Filename Value=" ..\..\UBitStream.pas"/>150 <Caret Line=" 154" Column="1" TopLine="142"/>232 <Filename Value="UMainForm.pas"/> 233 <Caret Line="78" Column="33" TopLine="78"/> 151 234 </Position17> 152 235 <Position18> 153 <Filename Value=" ..\..\UDynNumber.pas"/>154 <Caret Line=" 41" Column="29" TopLine="27"/>236 <Filename Value="UMainForm.pas"/> 237 <Caret Line="93" Column="19" TopLine="77"/> 155 238 </Position18> 156 239 <Position19> 157 <Filename Value=" UMainForm.pas"/>158 <Caret Line=" 51" Column="12" TopLine="42"/>240 <Filename Value="..\..\UBitStream.pas"/> 241 <Caret Line="38" Column="51" TopLine="22"/> 159 242 </Position19> 243 <Position20> 244 <Filename Value="..\..\UBitStream.pas"/> 245 <Caret Line="162" Column="33" TopLine="142"/> 246 </Position20> 247 <Position21> 248 <Filename Value="..\..\UBitStream.pas"/> 249 <Caret Line="38" Column="41" TopLine="22"/> 250 </Position21> 251 <Position22> 252 <Filename Value="..\..\UBitStream.pas"/> 253 <Caret Line="157" Column="48" TopLine="141"/> 254 </Position22> 255 <Position23> 256 <Filename Value="UMainForm.pas"/> 257 <Caret Line="93" Column="19" TopLine="77"/> 258 </Position23> 259 <Position24> 260 <Filename Value="UMainForm.pas"/> 261 <Caret Line="105" Column="16" TopLine="75"/> 262 </Position24> 263 <Position25> 264 <Filename Value="UMainForm.pas"/> 265 <Caret Line="91" Column="24" TopLine="75"/> 266 </Position25> 267 <Position26> 268 <Filename Value="UMainForm.pas"/> 269 <Caret Line="99" Column="80" TopLine="84"/> 270 </Position26> 271 <Position27> 272 <Filename Value="UMainForm.pas"/> 273 <Caret Line="92" Column="14" TopLine="82"/> 274 </Position27> 275 <Position28> 276 <Filename Value="UMainForm.pas"/> 277 <Caret Line="105" Column="37" TopLine="89"/> 278 </Position28> 279 <Position29> 280 <Filename Value="UMainForm.pas"/> 281 <Caret Line="106" Column="61" TopLine="89"/> 282 </Position29> 160 283 </JumpHistory> 161 284 </ProjectOptions> … … 170 293 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> 171 294 </SearchPaths> 295 <CodeGeneration> 296 <Checks> 297 <IOChecks Value="True"/> 298 <RangeChecks Value="True"/> 299 <OverflowChecks Value="True"/> 300 <StackChecks Value="True"/> 301 </Checks> 302 </CodeGeneration> 172 303 <Linking> 304 <Debugging> 305 <UseHeaptrc Value="True"/> 306 </Debugging> 173 307 <Options> 174 308 <Win32> … … 178 312 </Linking> 179 313 <Other> 314 <CompilerMessages> 315 <UseMsgFile Value="True"/> 316 </CompilerMessages> 180 317 <CompilerPath Value="$(CompPath)"/> 181 318 </Other> -
CoolStreaming/Demo/DynNumber/DynNumberDemo.lpr
r125 r126 7 7 cthreads, 8 8 {$ENDIF}{$ENDIF} 9 Interfaces, // this includes the LCL widgetset9 Interfaces, SysUtils, // this includes the LCL widgetset 10 10 Forms, UMainForm, CoolStreaming 11 11 { you can add units after this }; … … 13 13 {$R *.res} 14 14 15 const 16 HeapTraceLog = 'heaptrclog.trc'; 15 17 begin 18 // Heap trace 19 DeleteFile(ExtractFilePath(ParamStr(0)) + HeapTraceLog); 20 SetHeapTraceOutput(ExtractFilePath(ParamStr(0)) + HeapTraceLog); 21 16 22 Application.Initialize; 17 23 Application.CreateForm(TMainForm, MainForm); -
CoolStreaming/Demo/DynNumber/UMainForm.lfm
r125 r126 10 10 OnDestroy = FormDestroy 11 11 LCLVersion = '0.9.31' 12 object Memo1: TMemo13 Left = 814 Height = 44815 Top = 4016 Width = 53617 Anchors = [akTop, akLeft, akRight, akBottom]18 Font.Name = 'Consolas'19 ParentFont = False20 TabOrder = 021 end22 12 object Edit1: TEdit 23 13 Left = 8 24 Height = 2 114 Height = 25 25 15 Top = 8 26 16 Width = 320 27 TabOrder = 117 TabOrder = 0 28 18 Text = '1' 29 19 end … … 35 25 Caption = 'Encode' 36 26 OnClick = Button1Click 27 TabOrder = 1 28 end 29 object Button2: TButton 30 Left = 416 31 Height = 25 32 Top = 7 33 Width = 75 34 Caption = 'Generate' 35 OnClick = Button2Click 37 36 TabOrder = 2 38 37 end 38 object ListView1: TListView 39 Left = 8 40 Height = 448 41 Top = 40 42 Width = 536 43 Anchors = [akTop, akLeft, akRight, akBottom] 44 Columns = < 45 item 46 Caption = 'Number' 47 Width = 70 48 end 49 item 50 Caption = 'Overhead' 51 Width = 70 52 end 53 item 54 Caption = 'Value' 55 Width = 375 56 end> 57 TabOrder = 3 58 ViewStyle = vsReport 59 end 39 60 end -
CoolStreaming/Demo/DynNumber/UMainForm.pas
r125 r126 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 UDynNumber;9 ComCtrls, UDynNumber, Math; 10 10 11 11 type … … 15 15 TMainForm = class(TForm) 16 16 Button1: TButton; 17 Button2: TButton; 17 18 Edit1: TEdit; 18 Memo1: TMemo;19 ListView1: TListView; 19 20 procedure Button1Click(Sender: TObject); 21 procedure Button2Click(Sender: TObject); 20 22 procedure FormCreate(Sender: TObject); 21 23 procedure FormDestroy(Sender: TObject); … … 43 45 N: TDynamicNumber; 44 46 Line: string; 47 NewItem: TListItem; 45 48 begin 46 Memo1.Clear;47 49 try 48 50 N := TDynamicNumber.Create; 51 ListView1.BeginUpdate; 52 ListView1.Clear; 49 53 for I := 0 to 16 do begin 50 54 N.Stream.Size := 0; … … 54 58 for J := 0 to N.Stream.Size - 1 do 55 59 Line := Line + IntToStr(Integer(N.Stream.ReadBit)); 56 Memo1.Lines.Add(Line); 60 NewItem := ListView1.Items.Add; 61 NewItem.Caption := IntToStr(I); 62 NewItem.SubItems.Add(''); 63 NewItem.SubItems.Add(Line); 57 64 end; 58 65 finally 66 ListView1.EndUpdate; 67 N.Free; 68 end; 69 end; 70 71 procedure TMainForm.Button2Click(Sender: TObject); 72 var 73 I: Integer; 74 Count: Integer; 75 Parts: array of Integer; 76 PartIndex: Integer; 77 MaxValue: Integer; 78 J: Integer; 79 Line: string; 80 NewItem: TListItem; 81 N: TDynamicNumber; 82 begin 83 Count := 1; 84 SetLength(Parts, Count); 85 try 86 N := TDynamicNumber.Create; 87 ListView1.BeginUpdate; 88 ListView1.Clear; 89 for I := 0 to 1000 do begin 90 91 // Write 92 N.Stream.Size := 0; 93 for J := 0 to Count - 2 do 94 N.Stream.WriteNumber(1, 1); 95 N.Stream.WriteNumber(0, 1); 96 for PartIndex := 0 to Count - 1 do begin 97 if PartIndex > 0 then MaxValue := Parts[PartIndex - 1] + 1 98 else MaxValue := 1; 99 for J := MaxValue - 1 downto 0 do 100 if ((Parts[PartIndex] shr J) and 1) = 1 then N.Stream.WriteNumber(1, 1) 101 else N.Stream.WriteNumber(0, 1); 102 end; 103 NewItem := ListView1.Items.Add; 104 NewItem.Caption := IntToStr(I); 105 J := Floor(Log2(I)) + 1; 106 NewItem.SubItems.Add(FloatToStr(1 - (J / N.Stream.Size))); 107 Line := ''; 108 N.Stream.Position := 0; 109 for J := 0 to N.Stream.Size - 1 do 110 Line := Line + IntToStr(Integer(N.Stream.ReadBit)); 111 NewItem.SubItems.Add(Line); 112 113 // Increment value 114 PartIndex := Count - 1; 115 repeat 116 Parts[PartIndex] := Parts[PartIndex] + 1; 117 if PartIndex > 0 then MaxValue := 1 shl (Parts[PartIndex - 1] + 1) 118 else MaxValue := 2; 119 if Parts[PartIndex] >= MaxValue then begin 120 Parts[PartIndex] := 0; 121 PartIndex := PartIndex - 1; 122 if PartIndex < 0 then begin 123 Count := Count + 1; 124 SetLength(Parts, Count); 125 for PartIndex := 0 to Count - 1 do 126 Parts[PartIndex] := 0; 127 Break; 128 end; 129 end else Break; 130 until False; 131 end; 132 finally 133 ListView1.EndUpdate; 59 134 N.Free; 60 135 end; -
CoolStreaming/UBitStream.pas
r125 r126 36 36 function ReadBit: Boolean; 37 37 procedure WriteBit(AValue: Boolean); 38 function Read Byte: Byte;39 procedure Write Byte(AValue: Byte);38 function ReadNumber(Count: Byte): QWord; 39 procedure WriteNumber(AValue: QWord; Count: Byte); 40 40 end; 41 41 … … 155 155 end; 156 156 157 function TBitStream.Read Byte:Byte;158 begin 159 Read(Result, 8);160 end; 161 162 procedure TBitStream.Write Byte(AValue:Byte);163 begin 164 Write(AValue, 8);157 function TBitStream.ReadNumber(Count: Byte): QWord; 158 begin 159 Read(Result, Count); 160 end; 161 162 procedure TBitStream.WriteNumber(AValue: QWord; Count: Byte); 163 begin 164 Write(AValue, Count); 165 165 end; 166 166 -
CoolStreaming/UBufferedFileStream.pas
r117 r126 4 4 5 5 uses 6 Classes ;6 Classes, SysUtils; 7 7 8 8 type … … 52 52 Create(AFilename, Mode, 0); 53 53 {$ELSE} 54 Create(AFilename, Mode, FileAccessRights);54 Create(AFilename, Mode, 0); 55 55 {$ENDIF} 56 56 end; -
CoolStreaming/UDynNumber.pas
r125 r126 27 27 var 28 28 C: Integer; 29 Parts: array of Integer; 29 30 begin 30 31 C := 0;
Note:
See TracChangeset
for help on using the changeset viewer.