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

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

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

  1 # sc-extract.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 ScExtractSubprogram -superclass DaliSubprogram
 35 
 36 ScExtractSubprogram instproc init {args} {
 37     eval $self next $args;
 38 
 39     # Set up inputs
 40 
 41     $self instvar input_id_list_;
 42     $self instvar input_info_;
 43 
 44     lappend input_id_list_ i1
 45 
 46     set input_info_(i1,spec) "";
 47     set input_info_(i1,trigger) 0;
 48     set input_info_(i1,buffertype) Semicompressed;
 49     set input_info_(i1,buffername) [new VidRep/Semicompressed];
 50     set input_info_(i1,decoder) "";
 51 
 52     # Set up outputs
 53 
 54     $self instvar output_id_list_;
 55     $self instvar output_info_;
 56 
 57     lappend output_id_list_ o1;
 58 
 59     set output_info_(o1,spec) "";
 60     set output_info_(o1,buffertype) Semicompressed;
 61     set output_info_(o1,buffername) [new VidRep/Semicompressed];
 62     set output_info_(o1,encoder) "";
 63     set output_info_(o1,format) SC;
 64     set output_info_(o1,vagent) "";
 65 
 66     # Set up parameters
 67 
 68     $self instvar parameter_id_list_;
 69     $self instvar parameter_info_;
 70 
 71     lappend parameter_id_list_ width
 72     set pobj [new IntParameter];
 73 
 74     set parameter_info_(width,oname) $pobj;
 75     $pobj from 1
 76     $pobj to 20
 77     $pobj set 10
 78 
 79     lappend parameter_id_list_ height
 80     set pobj [new IntParameter];
 81 
 82     set parameter_info_(height,oname) $pobj;
 83     $pobj from 1
 84     $pobj to 15
 85     $pobj set 7
 86 
 87     lappend parameter_id_list_ xpos
 88     set pobj [new IntParameter];
 89 
 90     set parameter_info_(xpos,oname) $pobj;
 91     $pobj from 0
 92     $pobj to 19
 93     $pobj set 5
 94 
 95     lappend parameter_id_list_ ypos
 96     set pobj [new IntParameter];
 97 
 98     set parameter_info_(ypos,oname) $pobj;
 99     $pobj from 0
100     $pobj to 14
101     $pobj set 4
102 }
103 
104 ScExtractSubprogram instproc trigger {} {
105     $self instvar parameter_info_;
106     $self instvar input_info_;
107     $self instvar output_info_;
108     $self instvar init_done_;
109     $self instvar old_w_;
110     $self instvar old_h_;
111     $self instvar old_x_;
112     $self instvar old_y_;
113 
114     set w_pobj $parameter_info_(width,oname);
115     set h_pobj $parameter_info_(height,oname);
116     set x_pobj $parameter_info_(xpos,oname);
117     set y_pobj $parameter_info_(ypos,oname);
118 
119     set w [$w_pobj get];
120     set h [$h_pobj get];
121     set x [$x_pobj get];
122     set y [$y_pobj get];
123 
124     set in_frame $input_info_(i1,buffername);
125     set out_frame $output_info_(o1,buffername);
126 
127     if {![info exists init_done_]} {
128         if {[$in_frame set w_] == 0} {
129             return;
130         }
131 
132         set old_w_ -1;
133         set old_h_ -1;
134         set old_x_ -1;
135         set old_y_ -1;
136 
137         set init_done_ 1;
138     }
139 
140     if {$w != $old_w_ || $h != $old_h_ ||  $x != $old_x_ ||  $y != $old_y_} {
141         $out_frame copy_geometry $in_frame;
142 
143         $out_frame set w_ [expr $w * 16];
144         $out_frame set h_ [expr $h * 16];
145         $out_frame set xoff_ [expr $x * 16];
146         $out_frame set yoff_ [expr $y * 16];
147 
148         $out_frame allocate;
149 
150         set old_w_ $w;
151         set old_h_ $h;
152         set old_x_ $x;
153         set old_y_ $y;
154     }
155 
156 
157 
158     set in_l [$in_frame get_lum_name];
159     set in_cr [$in_frame get_cr_name];
160     set in_cb [$in_frame get_cb_name];
161 
162     set out_l [$out_frame get_lum_name];
163     set out_cr [$out_frame get_cr_name];
164     set out_cb [$out_frame get_cb_name];
165 
166     set x [expr $x*2];
167     set y [expr $y*2];
168     set w [expr $w*2];
169     set h [expr $h*2];
170 
171     set clip_out [sc_clip $in_l $x $y $w $h];
172     sc_copy $clip_out $out_l;
173     sc_free $clip_out;
174 
175     set x [expr $x / [$out_frame set h_subsample_]];
176     set y [expr $y / [$out_frame set v_subsample_]];
177     set w [expr $w / [$out_frame set h_subsample_]];
178     set h [expr $h / [$out_frame set v_subsample_]];
179 
180     set clip_out [sc_clip $in_cr $x $y $w $h];
181     sc_copy $clip_out $out_cr;
182     sc_free $clip_out;
183 
184     set clip_out [sc_clip $in_cb $x $y $w $h];
185     sc_copy $clip_out $out_cb;
186     sc_free $clip_out;
187 
188     $out_frame set ts_ [$in_frame set ts_];
189 
190     set encoder $output_info_(o1,encoder);
191 
192 
193     if {$encoder != ""} {
194         $encoder recv $out_frame;
195     }
196    $self send_completion_token
197 }
198 
199 

~ [ 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.