Cast between types

Hi
I am new to pixel bender. I am a CG artist with a very little developper background...
I understand pixel bender language is strongly typed. OK fine....
But i would like to understand the difference between
(for instance)
dst.a  = float(0.0);
and
dst.a = pixel1(0.0);
Am i free to write both syntaxes. Indeed both run without exceptions in my very simple sample script.
Regarding memory usage or efficiency, what is the true difference between theses two types
furthermore
i understand pixel4 is a kind of convention for output. Like image4 for input. Ok Fine.
But pixel4(0.0) == float4(0.0); returns true
so, i would like to understand the true meanings of theses types to build effectives pixel bender fragments
I am sorry but english is not my native bytecode
hope you understand what i mean
thanks for clues
MLK
++

Thanks Royi A
So i will use pixel values when it makes sense for anyone who read my code.
And i will use float values for arithmetics purposes.
Thanks for your reply. really ^^ I was not sure....
To describe the background, i am trying a PB to remap texture on CG render. It requires 2 inputs, the uv channel and the texture. The uv channel is a special map rendered with cg soft (maya, max, xsi, etc.) where uv space is mapped in the 32 bits u(0.0 , 1.0) v(0.0 , 1.0) space
where red channel stands for u
green channel stands for v
bleu channel stands for pixel coverage between geometry
alpha stands for cropping and acceleration structure.
To tell things speedy (frenchy syntax) : i query the uv map to retrieve the alpha, blue, red and green channels, then i sample the second input (the texture to remap) to write output accordingly. In fact i come from uv space to screen space mapping.
Because the result is very aliased, i use (actually) a graph to propagate output to a fragment for B-spline super sampling.
That is, the super sampling is done after transformations. It is a screen space super sampling. it is not ideal :/  but i don't know how to deal with super sampling before transformations with keeping "full pixel datas" ... :/  I don't know how to keep track of image4 pixels... because of paralellism of evaluatepixel()
I publish parameters to select nodeRenderID, offset and tile texture onto the geometry. Actually the filter needs to be applied several time to remap serveral geometry on a single picture (based on renderID)
In fact this filter is similar to autodesk combustion 3D-texmap operator with screen space mitchell-netravali sampling. If you see what i mean... ^^
I don't do it for fun, i do it because my customer needs to remap his customer's picture on CG product-render in real time with flash. I hope my PB will export to pbj regarding limitations ; graph not allowed :$  I will deal with it later. One thing at a time.
I will try 2 filters in pipeline.... well really i don't know if PB is my solution. lot of work to be done !! ^^ But i try it !! Hope it helps. I can't do it in ActionScript without heavy payload on customer's cpu. That's why i try PB
If i can achieve the result I will distribute it for free on adobe exchange when it's done : A texmap filter with screen space anti aliasing for flash and toshop as least
again, excuse me for my frenchy bytecode
MLK

Similar Messages

  • Interfaces casts are type-checked differently to class casts?

    hi,
    this is a multipost of
    http://forum.java.sun.com/thread.jspa?threadID=677488&tstart=0
    as i'm hoping some compiler guys are hanging around in here :)
    I'm just wondering why interfaces are type-checked differently to class casts when casting between siblings in the inheritance hierarchy.
    e.g. casting a String to an Integer fails, but declaring
    interface IString {
       String toUpperCase();
    interface IInteger {
       int intValue();
    } and casting between IString and IInteger works fine?
    any help appreciated,
    thanks,
    asjf

    Unless you have specific memory usage requirements so that you must use arrays, just use a java.util.List:
    public abstract class Type<A extends Arg> {
        protected abstract List<A> method();
       // or if the only needs to read it can be more convenient to have
        protected abstract List<? extends A> method2();
    public class Sub extends Type<SubArgs> {
        protected List<SubArgs> method() { ... }
        // sub class can be more specific for method2 if it wants to
        protected List<SubArgs> method2() { ... }
    }

  • Rules for casting generics type

    I know that there is a section in jsr14 spec about rules of casting generic types, but it seems outdated with
    JLS3.
    It is obvious that e.g. Class<String> cannot be casted to Class<Integer>.
    However in
    <T,V> void foo (Class<T> ct) {
    Class<V> cv = (Class<V>)ct;
    The cast is permitted by the compiler though of course marked as unchecked (The cast should be rejected according to jsr14 spec since none of the types is a subtype of the other).
    So the question is: what are the rules, compiler uses to check casts?

    1. There is an (unsafe) explicit cast from l1 to l2.
    2. There is an implicit cast in the last line, because
    l2 is a List<String>, the line is compiled to the
    equivalent of
    System.out.println(" result:" + (String) l2.get(0));
    // ClassCastException: java.lang.String

  • Differnce between type f and type p?

    Hi All,
    What is the Differnce between type f and type p?
    Regard,
    Mike

    Hi Mike
    Differnce bw type F and type P:-
    Packed numbers - type P
    Type P data allows digits after the decimal point. The number of decimal places is generic, and is determined in the program. The value range of type P data depends on its size and the number of digits after the decimal point. The valid size can be any value from 1 to 16 bytes. Two decimal digits are packed into one byte, while the last byte contains one digit and the sign. Up to 14 digits are allowed after the decimal point. The initial value is zero. When working with type P data, it is a good idea to set the program attribute Fixed point arithmetic.Otherwise, type P numbers are treated as integers.
    You can use type P data for such values as distances, weights, amounts of money, and so on.
    Floating point numbers - type F
    The value range of type F numbers is 1x10*-307 to 1x10*308 for positive and negative numbers, including 0 (zero). The accuracy range is approximately 15 decimals, depending on the floating point arithmetic of the hardware platform. Since type F data is internally converted to a binary system, rounding errors can occur. Although the ABAP processor tries to minimize these effects, you should not use type F data if high accuracy is required. Instead, use type P data.
    You use type F fields when you need to cope with very large value ranges and rounding errors are not critical.
    Using I and F fields for calculations is quicker than using P fields. Arithmetic operations using I and F fields are very similar to the actual machine code operations, while P fields require more support from the software. Nevertheless, you have to use type P data to meet accuracy or value range requirements.
    C ---> character
    D ---> date
    P ---> packed
    T ---> time
    X ---> hexadecimal
    I ---> integer.
    N ---> Muneric.
    Reward pts if help.
    Regards
    Deepanker

  • Difference between type lvc_t_fcat and slis_t_fieldcat_alv

    Can you tell me the difference between type lvc_t_fcat and slis_t_fieldcat_alv?
    Both are used for field catalogue so which one is better to use?

    Hi,
    the field catalog using lvc_t_fcat  has some better and enhanced features over the old slis_t_fieldcat_alv.
    Ideally when displayed a normal ALV using these fieldcatalogs does not have any difference...
    You can more enhanced features of ALV using lvc_t_fcat but these cannot be done using slis_t_fieldcat_alv
    For using lvc_t_fcat, you require a screen and a container area...
    Based on the requirement, use the  fieldcatalogs.
    Also slis_t_fieldcat_alv does not have any classes or methods but the other has so..(objecct oriented)
    Regards
    Sk

  • How to cast object type to integer type?

    Hi,
    Object [] temp;
    Int [] value;
    How can I assign temp to value? (value = temp?)
    In other words how to cast array of type object to array of type integer?
    Thanks a lot.

    Hi,
    Object [] temp;
    Int [] value;
    How can I assign temp to value? (value = temp?)
    In other words how to cast array of type object to
    array of type integer?
    Thanks a lot.That my friend, is (sometimes) illegal. other times use
    value = (Integer[]) temp;
    Pray that temp is holding an Integer array so that you dont throw a runtime exception.
    I am assuming you know the diff between "int" and "Integer".

  • Arbitrary casting between interfaces is allowed?

    hi,
    i'm confused since i thought you could not do this
    interface ITreePlanter {
         public void plantTree();
    interface IMotorCycleRepairer {
         public void repairMotorCycle();
    class foo {
         void bar() {
              ITreePlanter a = null;
              IMotorCycleRepairer b = (IMotorCycleRepairer) a;
              a = (ITreePlanter) b;
    }but apparently you can!
    changing the interfaces to abstract classes, or classes produces compilation errors. Anyone have any insights into why this is?
    thanks,
    asjf

    JLS, 2nd ed, 5.5: The remaining cases involve conversion between reference types. The detailed rules
    for compile-time correctness checking of a casting conversion of a value of compile-time
    reference type S (source) to a compile-time reference type T (target) are as follows:
        * If S is a class type:
              o If T is a class type, then S and T must be related classes-that is, S and T must
                be the same class, or S a subclass of T, or T a subclass of S; otherwise a
                compile-time error occurs.
              o If T is an interface type:
                    + If S is not a final class (�8.1.1), then the cast is always correct at compile
                      time (because even if S does not implement T, a subclass of S might).
                    + If S is a final class (�8.1.1), then S must implement T, or a compile-time
                      error occurs.
              o If T is an array type, then S must be the class Object, or a compile-time error
                occurs.
        * If S is an interface type:
              o If T is an array type, then T must implement S, or a compile-time error occurs.
              o If T is a class type that is not final (�8.1.1), then the cast is always correct at
                compile time (because even if T does not implement S, a subclass of T might).
              o If T is an interface type and if T and S contain methods with the same signature
                (�8.4.2) but different return types, then a compile-time error occurs.
        * If S is an array type SC[], that is, an array of components of type SC:
              o If T is a class type, then if T is not Object, then a compile-time error occurs
                (because Object is the only class type to which arrays can be assigned).
              o If T is an interface type, then a compile-time error occurs unless T is the type
                java.io.Serializable or the type Cloneable, the only interfaces implemented by
                arrays.
              o If T is an array type TC[], that is, an array of components of type TC, then a
                compile-time error occurs unless one of the following is true:
                    + TC and SC are the same primitive type.
                    + TC and SC are reference types and type SC can be cast to TC by a
                      recursive application of these compile-time rules for casting. Your situation is that S and T are both interface types, so a compile-time error occurs only if T and S contain methods with the same signature but different return types.

  • Difference between type of Secondary Cost Element Category?

    Hi,
    I checked the system, and during the secondary cost element (CE) creation, I can select some of the CE category as follows:
    21 Internal settlement
    31 Order/project results analysis
    41 Overheads
    42 Assessment
    43 Internal activity allocation
    50 Project-related incoming orders: Sales
    51 Project-related incoming orders: Other
    52 Project-related incoming orders: Costs
    61 Earned value
    My question, what kind of report that I can read entries with these kind of CE?
    Reason: I want to check what has been posted to these secondary CE.
    Or
    Could anyone explain the use of above-mentioned CE category in brief?
    Thanks.

    Cost element that is used to allocate costs for internal activities.
    Most often used categories are
    21 Internal settlement
    (When ever an order is settled e.g internal order settling to cost center through this type of cost elements)
    31 Order/project results analysis
    (WIP in production orders are calculated and posted using this category)
    41 Overheads
    (Used in costing sheet to do an overhead allocation)
    42 Assessment
    (whenever cost is allocated between cost centers through allocation method - Assessment)
    43 Internal activity allocation
    (found in production orders when a routing activity is confimed the charge goes to the production order through this cost element)

  • Difference between types of plan data

    Hi Friends,
    BPS
    1. Cost Center Planning: Costs and Allocations
    2. Cost Center Planning: Activity Type Prices
    3. Cost Center Planning: Cost Center/Activity Type Prices
    4. Cost Center Planning: Cost Driver
    For the above types of data, I like to understand what is the difference them.
    For type 1, I understand it is for primary costs.
    For type 2 and 3 they are related / same type of data. So what is the difference between them?
    For type 3, seems like combo of types 1 and 2.
    For type 4, I am not sure what it is about.
    Questions I have:
    <b>1</b>. Why is it only primary costs. Where is secondary costs?
    <b>2</b>. Type 1 costs is identified by cost elements of costs centers. But type 2 is by activity, quantity and rates ( i think). And costs calculated. So, is this type of cost outside the cost calculation of type 1 such that to get wholistic cost picture, need to add types 1 and 2 at least? Thus, are they mutually exclusive.
    <b>3</b>. Now, how does the same apply to type 4?
    <b>4</b>. What is the purpose of type 3?
    Hope you could advise me friends
    Regards
    Michael

    Hello Michael,
    Different types of CO planning relate to how an organization is using SAP Controlling functionalities. Activity represent typically internal labor/machine provided by one department (cost center) to a production order, project network etc. depending on the type of organization (production activities or project-driven operation etc.). Activity price would set per cost center for time of periods (months), representing standard price for valuation of actitivities.
    More CO documentation attached:
    http://help.sap.com/saphelp_erp2005/helpdata/en/dd/4298375ae2f84ae10000009b38f8cf/content.htm
    Regards
    Auvo Ahola

  • Converting between types in Web Dynpro

    Is it possible to convert between data types in web dynpro?  I am trying to covert a string to another data type (int, BigDecimal, etc.)?  I have found no documentation on how to do this?
    Any help will be greatly appreciated.  Thanks

    Hi Eric,
    If You use Web dynpro for Java, It's same as datatype conversion in java.
    For ex: if you want to convert from double value to float pls follow like this.
    float floatvar;
    double doublevar;
    floatvar= (float)doublevar;
    For more Information on data type conversion pls refer this URL
    http://www.unf.edu/~rzucker/cop3540dir/jdtconvt.html
    Hope this help. pls award points if you satisfied
    Thanks
    Praveen

  • Casting jobject Types

    I am very new to JNI, so please go easy...
    I have a C function that uses parameter passing to return 3 values. The 3 parameters are of type long, short and char. The C function looks like:
    myCFn(long id, short session, char response);I want to pass the Objects of the primitive java types corresponding to the C types, to make use of java's passing by reference for objects so that the 3 parameters are modified. The java signature looks like:
    native myJavaFn(Long id, Short session, String response)Running javah on this results in the signature:
    Java_Klass_myJavaFn(JNIEnv, jobject, jobject, jobject, jobject);My question is am i able to cast the parameters of type jobject to the respective C primitive types by doing the following:
    const long cLongVar = (long) javaLongParam;
    const short cShortVar = (short) javaShortParam;
    const char *cCharVar = (*env)->GetStringUTFChars(env, (jstring)jObjectType, 0);Then call the c method with:
    myCFn(cLongVar, cShortV, cCharVar);And have the 3 parameters values changed upon the function returning?
    Thanks for any help, hope it makes sense
    toby

    My question is am i able to cast the parameters of type jobject to the respective C primitive types
    Nope. Java primitive types - byte, short, char, int, etc... correspond directly to C++ primitive types. Just take a look at the typedefs for jbyte, jshort, jchar, jint, etc... in the jni header files.
    Every other JNI type - jobject, jclass, jstring, jarray, jthrowable, etc... is an opaque type, and you must use methods to operate on those types - http://java.sun.com/j2se/1.4.1/docs/guide/jni/spec/types.doc.html
    Both the JNI specification and the JNI Programmer's Guide cover this information and are freely available from java.sun.com.
    God bless,
    -Toby Reyelts
    Check out the free, open-source, JNI toolkit, Jace - http://jace.reyelts.com/jace

  • CASTing Table Type to Cursor

    Hi,
    I have req. that A proc is calling B proc which in turn return me a set of records in table type. Then i manipulate the data in A proc and i want to return this set in cursor type.
    could you please help me. here i have pasted my example.
    CREATE OR REPLACE TYPE oemp AS OBJECT
         eno     number(4),
         enm     varchar2(10),
         sal     number(7,2)
    CREATE OR REPLACE TYPE temp AS TABLE OF oemp;
    Proc B:=
    procedure showemp( dno in number, disp out temp)
    is
    l_str varchar2(1000);
    begin
    l_str := 'select oemp(empno, ename, sal) from emp where deptno = :dno';
    execute immediate l_str
    bulk collect into disp
    using dno;
    exception
    when no_data_found then
    null;
    end;
    CREATE OR REPLACE TYPE odemp AS OBJECT
         eno     number(4),
         enm     varchar2(10),
         sal     number(7,2),
    com number(7,2)
    proc A:
    procedure showempdet_cur(idno in number, oshow out cursor_type)
    is
    ishow temp;
    type tde is table of odemp;
    o_emp tde := tde();
    begin
    --Call to Proc A
    showemp(idno, ishow);
    if ishow.count > 0 then
    for i in ishow.first..ishow.last loop
    o_emp.extend;
    o_emp(o_emp.last) := odemp(ishow(i).eno, ishow(i).enm, ishow(i).sal, ishow(i).sal * .1);
    end loop;
    end if;
    -- here I want to return this o_emp table outside as cursor type
    -- i want to use this proc in crystal report which does not accept table type
    --return type
    end;
    hope this will help..I was trying to use CAST with MULTISET option..but some where i am doing wrong..
    help will appreciated.
    Thanks
    RSD

    You can query only sql-collections.
    SQL> create or replace type table_of_odemp as table of odemp;
    SQL> /
    Type created.
    SQL>
    SQL> var c refcursor
    SQL>
    SQL> declare
    SQL>   o_emp table_of_odemp := table_of_odemp();
    SQL> begin
    SQL>   for i in 1..5 loop
    SQL>     o_emp.extend;
    SQL>     o_emp(o_emp.last) := odemp(i, 'Name'||i, i*1000, i*50);
    SQL>   end loop;
    SQL>   open :c for select * from table(cast(o_emp as table_of_odemp));
    SQL> end;
    SQL> /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> print c
              ENO ENM                  SAL           COM
                1 Name1               1000            50
                2 Name2               2000           100
                3 Name3               3000           150
                4 Name4               4000           200
                5 Name5               5000           250

  • ClassCast Exception while casting to type String

    Dear Java users
    While coding a parse routine in a session EJB , I created a vector and added some elements to it.
    Naturally these elements are of type object.
    Now, while extracting elements out of the vector I tried to cast them to the actual type that the elements are.
    Most of the elements are of type String and some of type Long and Double.Note that these are all Object wrappers not primitives.
    The code compiles fine, however at run time I get the following error:
    java.lang.ClassCastException : java.lang.String
    I tried to do the casting two ways: (String) object and object.toString(). In both cases I got the same error.
    Here is a snippet of my code where I get the error:
    RETAIL_TRANX retail_db = retail_home.create(columns.elementAt(0).toString(),
    columns.elementAt(1).toString(),................
    Any ideas on why this is happening and how best should I cast to String.
    Thank you for any help you can provide
    Best
    Naveen

    RETAIL_TRANX retail_db = retail_home.create(columns.elementAt(0).toString(),
    columns.elementAt(1).toString(),................
    I'd say that the code above calls the toString() implemented in the Object class because that's what elementAt() returns. If you want String objects as arguments to the create method, you want the toString() implemented in the subclasses String, Long, and Double. To achieve this, try the following:
    RETAIL_TRANX retail_db = retail_home.create(((String)columns.elementAt(0)).toString()...
    This code casts the Object class object returned by elementAt to a String first and then it calls the toString() method on the String object resulting from the cast. The toString() that executes should be the one in the String rather than Object class.
    This is going to fail if elementAt() doesn't return an object that can be cast to a String. In this case, what you might want to do first is test the type of object returned with the instanceof operator. Then cast to the appropriate type, in each case calling toString() after the cast has been made.
    Regards,
    Steve

  • Difference between "type"'s of laptop model's - X201

    I've got two X201 laptops, that seem identical, except for the processor (one is an i5 2.4. and the other is an i5 2.53).  Also, the computer "type" is different on them.  One is a 3249 and the other is a 3680.  The only reason I care is that I was moving a hard drive from one of the laptops to the other laptop and figured the hardware is identical (besides the processor type) and that it wouldn't have any issues.  When Windows tries to boot with the first hard drive in the second system, I constantly get the blue screen.  Windows can't seem to repair the windows install, and if I put the hard drive back in the original system, it boots just fine.  I can't believe that just a higher speed processor would cause this to blue screen.  I've swapped hard drives between "like" dell systems in the past with no problems (even when there were different processors, but the same model laptop).  Why do they have so many "type's" of this system and does anyone know where I can find the differences.  You would think the types and differences would be posted somewhere but I can't find it.

    Hi,
    What Windows version are you running?  What is the BSOD message?
    Any chance one OS was installed in AHCI mode and the other in compatibility mode?
    Z.
    The large print: please read the Community Participation Rules before posting. Include as much information as possible: model, machine type, operating system, and a descriptive subject line. Do not include personal information: serial number, telephone number, email address, etc.  The fine print: I do not work for, nor do I speak for Lenovo. Unsolicited private messages will be ignored. ... GeezBlog
    English Community   Deutsche Community   Comunidad en Español   Русскоязычное Сообщество

  • Difference between "Type Any" and "Type Data"

    <<Moderator message: don't post the same question in more than one forum - duplicates deleted>>
    Hello Everybody,
    Could anyone please tell me the difference between below two declarations:
    Field-symbols: <lv_first>      type any,
                          <lv_second> type data.
    Edited by: Matt on Nov 6, 2008 1:34 PM

    I will tell you where you can find the details;
    1) Goto Tcode ABAPHELP ,enter "TYPE DATA" in the keyword and press ok,
    2) In the Appearing list double click on the data, built-in generic type under sub-node ABAP Environment.
    If you cannot end up finding this, please close the thread and go home :).
    Regards
    Karthik D

Maybe you are looking for

  • Adobe Edge installation problem

    I downloaded Adobe Edge Animation installer in my PC with Windows 7 and, three times I tried install it, without success. All time this message appears: "Founded following problem: fail error on installation of creative cloud desktop. (Error 1)" Some

  • "Reader" function in Safari

    I lost the Reader function width the recent upgrade. Can @i get it back?

  • Do App Tabs and Tab Groups maintain an active connection with the websites they represent?

    I really like the concept behind App Tabs and Tab Groups. I have a few questions, though. 1. Will I use more memory opening a new window or creating a tab group with the same number of tabs? I am addicted to Alt+Tab and am frequently frustrated by ta

  • Offsite Backup for Physical Servers & Workstations

    Hi Spiceheads,Need some help with a solution design.OVERVIEW We have a client with a Head Office in one country and multiple branches+remote laptop users across the globe (approx 500 such devices that are remote). The HO is virtualized & has a good b

  • Trouble joining an Airport Express to an existing Time Capsule network

    I have been trying to add an Airport Express to my existing network. Apples to Apples, right? Easy! Nope!!! I have a 1TB Time Capsule connected to a cable modem. As well as wireless, I also have an 8-port gigabit switch connected to the Time Capsule