⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 image_wave_horz.c

📁 CCS中图象的小波变换编码. 在DSP6000系列的ccs环境中
💻 C
字号:
           void IMG_wave_horz                                               
           (                                                                
               const short *restrict in_data,  // Row of input pixels  //   
               const short *restrict qmf,      // Low-pass QMF filter  //   
               const short *restrict mqmf,     // High-pass QMF filter //   
               short       *restrict out_data, // Row of output data   //   
               int                   cols      // Length of input.     //   
           );                                                               
                                                                            
           {                                                                
               int    i, res, iters;                                        
               int    j, sum, prod;                                         
               short *xptr  = in_data;                                      
               short *yptr  = out_data;                                     
               short *x_end = &in_data[cols - 1];                           
               short  xdata, hdata;                                         
               short *xstart;                                               
               short *filt_ptr;                                             
               int    M = 8;                                                
                                                                            
               // ------------------------------------------------- //      
               //  Set our loop trip count and starting x posn.     //      
               //  'xstart' is used in the high-pass filter loop.   //      
               // ------------------------------------------------- //      
               iters  = cols;                                               
               xstart = in_data + (cols - M)  + 2;                          
                                                                            
               // ------------------------------------------------- //      
               //  Low pass filter.  Iterate for cols/2 iterations  //      
               //  generating cols/2 low pass sample points with    //      
               //  the low-pass quadrature mirror filter.           //      
               // ------------------------------------------------- //      
               for (i = 0; i < iters; i += 2)                               
               {                                                            
                   // --------------------------------------------- //      
                   //  Initialize our sum to the rounding value     //      
                   //  and reset our pointer.                       //      
                   // --------------------------------------------- //      
                   sum  = Qr;                                               
                   xptr = in_data + i;                                      
                                                                            
                   // --------------------------------------------- //      
                   //  Iterate over the taps in our QMF.            //      
                   // --------------------------------------------- //      
                   for (j = 0; j < M; j++)                                  
                   {                                                        
                       xdata = *xptr++;                                     
                       hdata =  qmf[j];                                     
                       prod  =  xdata * hdata;                              
                       sum  += prod;                                        
                       if (xptr > x_end) xptr = in_data;                    
                   }                                                        
                                                                            
                   // --------------------------------------------- //      
                   //  Adjust the Qpt of our sum and store result.  //      
                   // --------------------------------------------- //      
                   res    = (sum >> Qpt);                                   
                   *out_data++ = res;                                       
               }                                                            
                                                                            
                                                                            
               // ------------------------------------------------- //      
               //  High pass filter.  Iterate for cols/2 iters      //      
               //  generating cols/2 high pass sample points with   //      
               //  the high-pass quadrature mirror filter.          //      
               // ------------------------------------------------- //      
               for (i = 0; i < iters ; i+=2)                                
               {                                                            
                   // --------------------------------------------- //      
                   //  Initialize our sum and filter pointer.       //      
                   // --------------------------------------------- //      
                   sum  = Qr;                                               
                   filt_ptr  = mqmf + (M - 1);                              
                                                                            
                   // --------------------------------------------- //      
                   //  Set up our data pointer.  This is slightly   //      
                   //  more complicated due to how the data wraps   //      
                   //  around the edge of the buffer.               //      
                   // --------------------------------------------- //      
                   xptr = xstart;                                           
                   xstart += 2;                                             
                   if (xstart > x_end) xstart = in_data;                    
                                                                            
                   // --------------------------------------------- //      
                   //  Iterate over the taps in our QMF.            //      
                   // --------------------------------------------- //      
                   for ( j = 0; j < M; j++)                                 
                   {                                                        
                       xdata = *xptr++;                                     
                       hdata = *filt_ptr--;                                 
                       prod  = xdata * hdata;                               
                       if (xptr > x_end) xptr = in_data;                    
                       sum  += prod;                                        
                   }                                                        
                                                                            
                   // --------------------------------------------- //      
                   //  Adjust the Qpt of our sum and store result.  //      
                   // --------------------------------------------- //      
                   res = (sum >> Qpt);                                      
                   *out_data++ =  res;                                      
               }                                                            
           }                                                                

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -