Download VIS Instruction Set User`s Manual
Transcript
4. Using VIS Example vis_d64 data1_4_16, data2_4_16, data1_2_32, data2_2_32; vis_d64 sum_4_16, difference_4_16, sum_2_32, difference_2_32; vis_f32 data1_2_16, data2_2_16, sum_2_16, difference_2_16; vis_f32 data1_1_32, data2_1_32, sum_1_32, difference_1_32; sum_4_16 = vis_fpadd16(data1_4_16, data2_4_16); difference_4_16 = vis_fpsub16(data1_4_16, data2_4_16); sum_2_32 = vis_fpsum32(data1_2_32, data2_2_32); difference_2_32 = vis_fpsub32(data1_2_32, data2_2_32); sum_2_16 = vis_fpadd16s(data1_2_16, data2_2_16); difference_2_16 = vis_fpsub16s(data1_2_16, data2_2_16); sum_1_32 = vis_fpadd32s(data1_1_32, data2_1_32); difference_1_32 = vis_fpsub32s(data1_1_32, data2_1_32); 4.6.2 vis_fmul8x16() Function: Multiply the elements of an 8 bit partitioned vis_f32 variable by the corresponding element of a 16 bit partitioned vis_d64 variable to produce a 16 bit partitioned vis_d64 result. Syntax: vis_d64 vis_fmul8x16(vis_f32 pixels, vis_d64 scale); Description vis_fmul8x16() multiplies each unsigned 8-bit component within pixels by the corresponding signed 16-bit fixed-point component within scale and returns the upper 16 bits of the 24 bit product (after rounding) as a signed 16-bit component in the 64 bit returned value. Or in other words: 16 bit result = (8 bit pixel element*16 bit scale element + 128)/256 The operation is illustrated in Figure 4-10. This instruction treats the pixels values as fixed-point with the binary point to the left of the most significant bit. For example, this operation is used with filter coefficients as the fixed-point scale value, and image data as the pixels value. Sun Microsystems, Inc. 57