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

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

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

  1 # sc-encode-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 ScTimingSubprogram -superclass DaliSubprogram
 35 
 36 ScTimingSubprogram 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) Uncompressed;
 47     set input_info_(i1,buffername) [new VidRep/Uncompressed];
 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_ width
 70     set pobj [new IntParameter];
 71 
 72     set parameter_info_(width,oname) $pobj;
 73     $pobj from 1
 74     $pobj to 20
 75     $pobj set 10
 76 
 77     lappend parameter_id_list_ height
 78     set pobj [new IntParameter];
 79 
 80     set parameter_info_(height,oname) $pobj;
 81     $pobj from 1
 82     $pobj to 15
 83     $pobj set 7
 84 
 85     lappend parameter_id_list_ quant
 86     set pobj [new IntParameter];
 87 
 88     set parameter_info_(quant,oname) $pobj;
 89     $pobj from 5
 90     $pobj to 95
 91     $pobj set 30
 92 
 93 }
 94 
 95 ScTimingSubprogram instproc trigger {} {
 96     $self instvar parameter_info_;
 97     $self instvar input_info_;
 98     $self instvar output_info_;
 99     $self instvar init_done_;
100     $self instvar old_w_;
101     $self instvar old_h_;
102     $self instvar old_q_;
103 
104     set w_pobj $parameter_info_(width,oname);
105     set h_pobj $parameter_info_(height,oname);
106     set q_pobj $parameter_info_(quant,oname);
107 
108     set w [$w_pobj get];
109     set h [$h_pobj get];
110     set q [$q_pobj get];
111 
112     set in_frame $input_info_(i1,buffername);
113     set out_frame $output_info_(o1,buffername);
114 
115     if {![info exists init_done_]} {
116         if {[$in_frame set w_] == 0} {
117             return;
118         }
119 
120         set old_w_ -1;
121         set old_h_ -1;
122         set old_q_ -1;
123 
124         set init_done_ 1;
125     }
126 
127     if {$w != $old_w_ || $h != $old_h_} {
128         $out_frame copy_geometry $in_frame;
129 
130         $out_frame set w_ [expr $w * 16];
131         $out_frame set h_ [expr $h * 16];
132 
133         $out_frame allocate;
134 
135         set old_w_ $w;
136         set old_h_ $h;
137     }
138 
139     if {$q != $old_q_} {
140         set encoder $output_info_(o1,encoder);
141         if {$encoder != ""} {
142             $encoder q $q;
143         }
144         set old_q_ $q;
145     }
146 
147     set encoder $output_info_(o1,encoder);
148     if {$encoder == ""} {
149         puts "No encoder"
150         return;
151     }
152 
153     set in_l [$in_frame get_lum_name];
154     set in_cr [$in_frame get_cr_name];
155     set in_cb [$in_frame get_cb_name];
156 
157     set out_l [$out_frame get_lum_name];
158     set out_cr [$out_frame get_cr_name];
159     set out_cb [$out_frame get_cb_name];
160 
161     $out_frame set ts_ [$in_frame set ts_];
162 
163     set start [clock clicks];
164 
165     byte_to_sc $in_l $out_l 0;
166     byte_to_sc $in_cr $out_cr 1;
167     byte_to_sc $in_cb $out_cb 1;
168 
169     $encoder recv $out_frame;
170 
171     set end [clock clicks];
172 
173     set w [$out_frame set w_];
174     set h [$out_frame set h_];
175     set size [$encoder set last_size_];
176     set ms [expr ($end - $start) / 1000.0];
177 
178     puts "[$out_frame set ts_] $w $h $q $size $ms [expr $ms / (($w * $h) / 64.0)] ";
179 
180     $self send_completion_token;
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.