~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Open Mash Cross Reference
mash/tcl/psvp/effects/sc-transcode-timing.tcl

Component: ~ [ mash ] ~ [ apps ] ~ [ gsm ] ~ [ lib ] ~ [ otcl ] ~ [ srm ] ~ [ tcl8.3 ] ~ [ tclcl ] ~ [ tk8.3 ] ~ [ tutorials ] ~

  1 # sc-transcode-timing.tcl --
  2 #
  3 #       FIXME: This file needs a description here.
  4 #
  5 # Copyright (c) 1998-2002 The Regents of the University of California.
  6 # All rights reserved.
  7 #
  8 # Redistribution and use in source and binary forms, with or without
  9 # modification, are permitted provided that the following conditions are met:
 10 #
 11 # A. Redistributions of source code must retain the above copyright notice,
 12 #    this list of conditions and the following disclaimer.
 13 # B. Redistributions in binary form must reproduce the above copyright notice,
 14 #    this list of conditions and the following disclaimer in the documentation
 15 #    and/or other materials provided with the distribution.
 16 # C. Neither the names of the copyright holders nor the names of its
 17 #    contributors may be used to endorse or promote products derived from this
 18 #    software without specific prior written permission.
 19 #
 20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
 21 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 23 # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
 24 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 25 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 26 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 27 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 28 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 30 
 31 import DaliSubprogram
 32 import IntParameter
 33 
 34 Class ScXCodeTimingSubprogram -superclass DaliSubprogram
 35 
 36 ScXCodeTimingSubprogram instproc init {args} {
 37     eval $self next $args;
 38 
 39     $self instvar input_id_list_;
 40     $self instvar input_info_;
 41 
 42     lappend input_id_list_ i1
 43 
 44     set input_info_(i1,spec) "";
 45     set input_info_(i1,trigger) 0;
 46     set input_info_(i1,buffertype) Semicompressed;
 47     set input_info_(i1,buffername) [new VidRep/Semicompressed];
 48     set input_info_(i1,decoder) "";
 49 
 50     # Set up outputs
 51 
 52     $self instvar output_id_list_;
 53     $self instvar output_info_;
 54 
 55     lappend output_id_list_ o1;
 56 
 57     set output_info_(o1,spec) "";
 58     set output_info_(o1,buffertype) Semicompressed;
 59     set output_info_(o1,buffername) [new VidRep/Semicompressed];
 60     set output_info_(o1,encoder) "";
 61     set output_info_(o1,format) SC;
 62     set output_info_(o1,vagent) "";
 63 
 64     # Set up parameters
 65 
 66     $self instvar parameter_id_list_;
 67     $self instvar parameter_info_;
 68 
 69     lappend parameter_id_list_ quant
 70     set pobj [new IntParameter];
 71 
 72     set parameter_info_(quant,oname) $pobj;
 73     $pobj from 5
 74     $pobj to 95
 75     $pobj set 5
 76 
 77 }
 78 
 79 ScXCodeTimingSubprogram instproc trigger {} {
 80     $self instvar parameter_info_;
 81     $self instvar input_info_;
 82     $self instvar output_info_;
 83     $self instvar init_done_;
 84     $self instvar init_part2_;
 85     $self instvar old_q_;
 86     $self instvar cntr_;
 87 
 88 
 89     set in_frame $input_info_(i1,buffername);
 90     set out_frame $output_info_(o1,buffername);
 91 
 92     if {![info exists init_done_]} {
 93         if {[$in_frame set w_] == 0} {
 94             return;
 95         }
 96 
 97         set old_q_ -1;
 98 
 99         set cntr_ 0;
100         set init_done_ 1;
101     }
102 
103     incr cntr_;
104 
105     set q_pobj $parameter_info_(quant,oname);
106     set q [$q_pobj get];
107 
108     if {$cntr_ > 100} {
109         $q_pobj set [expr $q + 5];
110     }
111     set q [$q_pobj get];
112 
113     if {$q != $old_q_} {
114         set encoder $output_info_(o1,encoder);
115         if {$encoder != ""} {
116             $encoder q $q;
117         }
118         set old_q_ $q;
119         set cntr_ 0;
120     }
121 
122     set encoder $output_info_(o1,encoder);
123     if {$encoder == ""} {
124         puts "No encoder"
125         return;
126     }
127     $self instvar pkt_q_ sc_2_semi_ semi_2_jpeg_ bp2_ va_ fb2_;
128 
129     if {![info exists init_part2_]} {
130 
131         set init_part2_ 1;
132 
133         set fb2_ [new VidRep/Semicompressed];
134 
135         set pkt_q_ [new Module/PacketQ]
136         set sc_2_semi [new Module/VideoDecoder/SCToSemicompressed]
137         set semi_2_jpeg_ [new Module/VideoEncoder/SemicompressedToJPEG];
138         set bp2_ [new BufferPool/RTP];
139 
140         set va_ [new VideoAgent $self 224.2.5.5/22334];
141         $va_ local_bandwidth 30000000
142 
143         $bp2_ srcid [$va_ get_local_srcid];
144 
145         $semi_2_jpeg_ buffer-pool $bp2_;
146         $semi_2_jpeg_ mtu [$self get_option mtu];
147         $semi_2_jpeg_ target [$va_ get_transmitter];
148 
149         $sc_2_semi set_frame_buffer $fb2_;
150         $sc_2_semi set_callback "$self back_trigger";
151 
152         $pkt_q_ target $sc_2_semi;
153 
154         $encoder target $pkt_q_;
155     }
156 
157     $encoder recv $in_frame;
158 
159     $self instvar start_time_ last_size_;
160 
161     set last_size_ [$encoder set last_size_];
162 
163     set start_time_ [clock clicks];
164 
165     $pkt_q_ dump;
166 }
167 
168 
169 ScXCodeTimingSubprogram instproc back_trigger {} {
170 
171     $self instvar semi_2_jpeg_ fb2_;
172 
173     $semi_2_jpeg_ recv $fb2_;
174 
175     set end_time [clock clicks];
176 
177     $self instvar start_time_ old_q_ last_size_;
178 
179     puts "[$fb2_ set ts_] $old_q_ $last_size_ [expr ($end_time - $start_time_) / 1000.0]";
180 }
181 
182 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.