- Timestamp:
- Dec 3, 2015, 4:40:49 PM (9 years ago)
- Location:
- soft/giet_vm/applications
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/coproc/coproc.c
r708 r736 1 ///////////////////////////////////////////////////////////////////////////////////// //1 ///////////////////////////////////////////////////////////////////////////////////// 2 2 // file : coproc.c 3 3 // date : avril 2015 4 4 // author : Alain Greiner 5 ///////////////////////////////////////////////////////////////////////////////////// //5 ///////////////////////////////////////////////////////////////////////////////////// 6 6 // This file describes the single thread "coproc" application. 7 7 // It uses the GCD (Greater Common Divider) hardware coprocessor 8 8 // to make the GCD computation between two vectors of 32 bits integers. 9 // It supports two coprocessor operating modes: MODE_DMA_IRQ or MODE_DMA_NO_IRQ. 9 10 // The vectors size is defined by the VECTOR_SIZE parameter. 10 ///////////////////////////////////////////////////////////////////////////////////// //11 ///////////////////////////////////////////////////////////////////////////////////// 11 12 12 13 … … 41 42 x, y, lpid, giet_proctime() ); 42 43 44 // check coprocessor operating mode 45 giet_pthread_assert( (DMA_MODE == MODE_DMA_IRQ) || (DMA_MODE == MODE_DMA_NO_IRQ), 46 "\n[COPROC ERROR] only MODE_DMA_IRQ and MODE_DMA_NO_IRQ modes are supported"); 47 43 48 // initializes opa & opb buffers 44 49 unsigned int word; … … 50 55 51 56 unsigned int coproc_info; 57 unsigned int cluster_xy = (x << 4) + y; 58 unsigned int coproc_type = MWR_SUBTYPE_GCD; 52 59 53 /////////////////////// request a GCD coprocessor 54 giet_coproc_alloc( MWR_SUBTYPE_GCD, &coproc_info ); 60 // get a GCD coprocessor in local cluster 61 giet_coproc_alloc( cluster_xy, 62 coproc_type, 63 &coproc_info ); 55 64 56 65 // check coprocessor ports … … 69 78 #endif 70 79 71 // ////////////////////// initializes channel for OPA80 // initializes OPA channel 72 81 giet_coproc_channel_t opa_desc; 73 82 opa_desc.channel_mode = DMA_MODE; 74 83 opa_desc.buffer_size = VECTOR_SIZE<<2; 75 84 opa_desc.buffer_vaddr = (unsigned int)opa; 76 giet_coproc_channel_init( 0 , &opa_desc ); 85 giet_coproc_channel_init( cluster_xy, 86 coproc_type, 87 0, 88 &opa_desc ); 77 89 78 // ////////////////////// initializes channel for OPB90 // initializes OPB channel 79 91 giet_coproc_channel_t opb_desc; 80 92 opb_desc.channel_mode = DMA_MODE; 81 93 opb_desc.buffer_size = VECTOR_SIZE<<2; 82 94 opb_desc.buffer_vaddr = (unsigned int)opb; 83 giet_coproc_channel_init( 1 , &opb_desc ); 95 giet_coproc_channel_init( cluster_xy, 96 coproc_type, 97 1, 98 &opb_desc ); 84 99 85 // ////////////////////// initializes channel for RES100 // initializes RES channel 86 101 giet_coproc_channel_t res_desc; 87 102 res_desc.channel_mode = DMA_MODE; 88 103 res_desc.buffer_size = VECTOR_SIZE<<2; 89 104 res_desc.buffer_vaddr = (unsigned int)res; 90 giet_coproc_channel_init( 2 , &res_desc ); 105 giet_coproc_channel_init( cluster_xy, 106 coproc_type, 107 2, 108 &res_desc ); 91 109 92 110 #if VERBOSE … … 94 112 #endif 95 113 96 /////////////////////// starts communication channels 97 giet_coproc_run( 0 ); 114 // starts coprocessor 115 giet_coproc_run( cluster_xy, 116 coproc_type ); 98 117 99 118 #if VERBOSE … … 101 120 #endif 102 121 103 // /////////////////////wait coprocessor completion122 // wait coprocessor completion 104 123 if ( DMA_MODE == MODE_DMA_NO_IRQ ) 105 124 { 106 giet_coproc_completed( ); 125 giet_coproc_completed( cluster_xy, 126 coproc_type ); 107 127 } 108 128 … … 118 138 } 119 139 120 ////////////////////// release GCD coprocessor 121 giet_coproc_release( 0 ); 140 // release GCD coprocessor 141 giet_coproc_release( cluster_xy, 142 coproc_type ); 122 143 123 144 giet_pthread_exit("completed"); -
soft/giet_vm/applications/coproc/coproc.py
r708 r736 33 33 x = 0 34 34 y = 0 35 p = 135 p = 0 36 36 37 37 assert( (x < x_size) and (y < y_size) ) … … 50 50 51 51 # create vspace 52 vspace = mapping.addVspace( name = 'coproc', startname = 'coproc_data', active = False )52 vspace = mapping.addVspace( name = 'coproc', startname = 'coproc_data', active = True ) 53 53 54 54 # data vseg in cluster[x,y] -
soft/giet_vm/applications/mjpeg/demux.c
r723 r736 86 86 // giet_tty_alloc( 0 ); 87 87 88 PRINTF("\n[MJPEG] thread DEMUX[%d] starts on P[%d,%d,%d]\n", index, x, y, p ) 88 PRINTF("\n[MJPEG] thread DEMUX[%d] starts on P[%d,%d,%d] / trdid = %x\n", 89 index , x , y , p, (uint32_t)trdid_demux[index] ) 89 90 90 91 // initialise BUFIO for MWMR channel <in> … … 95 96 96 97 #if (DEBUG_DEMUX > 1) 97 PRINTF("\nDEMUX[%d] <in> : &mwmr = %x / &bufio = %x\n", 98 index , mwmr_in , &bufio_in ) 98 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 99 { PRINTF("\nDEMUX[%d] <in> : &mwmr = %x / &bufio = %x\n", 100 index , mwmr_in , &bufio_in ) } 99 101 #endif 100 102 … … 106 108 107 109 #if (DEBUG_DEMUX > 1) 108 PRINTF("\nDEMUX[%d] : <out_quanti> : mwmr = %x / &bufio = %x\n", 109 index , mwmr_out_quanti , &bufio_out_quanti ) 110 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 111 { PRINTF("\nDEMUX[%d] : <out_quanti> : mwmr = %x / &bufio = %x\n", 112 index , mwmr_out_quanti , &bufio_out_quanti ) } 110 113 #endif 111 114 … … 117 120 118 121 #if (DEBUG_DEMUX > 1) 119 PRINTF("\nDEMUX[%d] : <out_huff> : mwmr = %x / &bufio = %x\n", 120 index , mwmr_out_huff , &bufio_out_huff ) 122 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 123 { PRINTF("\nDEMUX[%d] : <out_huff> : mwmr = %x / &bufio = %x\n", 124 index , mwmr_out_huff , &bufio_out_huff ) } 121 125 #endif 122 126 … … 128 132 129 133 #if (DEBUG_DEMUX > 1) 130 PRINTF("\nDEMUX[%d] : <out_data> : mwmr = %x / &bufio = %x\n", 131 index , mwmr_out_data , &bufio_out_data ) 134 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 135 { PRINTF("\nDEMUX[%d] : <out_data> : mwmr = %x / &bufio = %x\n", 136 index , mwmr_out_data , &bufio_out_data ) } 132 137 #endif 133 138 … … 150 155 marker = get_next_marker( &bufio_in ); 151 156 152 #if (DEBUG_DEMUX > 1)153 if ( marker == SOI_MK ) PRINTF("\nDEMUX[%x] found Start of Image marker\n", index )154 #endif155 157 } 156 158 while ( marker != SOI_MK ); 159 160 #if (DEBUG_DEMUX > 1) 161 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 162 { PRINTF("\nDEMUX[%x] found Start of Image marker\n", index ) } 163 #endif 157 164 158 165 found_marker = 0; … … 173 180 174 181 #if (DEBUG_DEMUX > 1) 175 PRINTF("\nDEMUX[%x] found Start of Frame marker\n", index ) 182 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 183 { PRINTF("\nDEMUX[%x] found Start of Frame marker\n", index ) } 176 184 #endif 177 185 // Only one component per image is supported … … 208 216 209 217 #if (DEBUG_DEMUX > 1) 210 PRINTF("\nDEMUX[%x] found Quantization Table marker\n", index ) 218 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 219 { PRINTF("\nDEMUX[%x] found Quantization Table marker\n", index ) } 211 220 #endif 212 221 // The quantisation table segment being fixed length, … … 235 244 236 245 #if (DEBUG_DEMUX > 1) 237 PRINTF("\nDEMUX[%x] found Huffman Table marker\n", index ) 246 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 247 { PRINTF("\nDEMUX[%x] found Huffman Table marker\n", index ) } 238 248 #endif 239 249 // The Huffman Table segment being variable length, … … 279 289 280 290 #if (DEBUG_DEMUX > 1) 281 PRINTF("\nDEMUX[%x] found Start of Scan marker\n", index ) 291 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 292 { PRINTF("\nDEMUX[%x] found Start of Scan marker\n", index ) } 282 293 #endif 283 294 // The scan segment has a variable length: … … 330 341 331 342 #if (DEBUG_DEMUX > 1) 332 PRINTF("\nDEMUX[%x] found End of Image marker\n", index ) 343 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 344 { PRINTF("\nDEMUX[%x] found End of Image marker\n", index ) } 333 345 #endif 334 346 mwmr_bufio_flush( &bufio_out_data ); … … 341 353 342 354 #if (DEBUG_DEMUX > 1) 343 PRINTF("\nDEMUX[%x] found Comment or Application marker\n", index ) 355 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 356 { PRINTF("\nDEMUX[%x] found Comment or Application marker\n", index ) } 344 357 #endif 345 358 // read segment length from bufio_in … … 367 380 368 381 #if DEBUG_DEMUX 369 PRINTF("\nDEMUX[%d] completes image %d at cycle %d\n", index , image , giet_proctime() ) 382 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 383 { PRINTF("\nDEMUX[%d] completes image %d at cycle %d\n", index , image , giet_proctime() ) } 370 384 #endif 371 385 image = image + x_size * y_size; … … 373 387 } // end while on images 374 388 375 giet_pthread_exit( " demuxcompleted" );389 giet_pthread_exit( "DEMUX completed" ); 376 390 377 391 } // end demux() -
soft/giet_vm/applications/mjpeg/idct.c
r723 r736 155 155 // giet_tty_alloc( 0 ); 156 156 157 PRINTF("\n[MJPEG] thread IDCT[%d] starts on P[%d,%d,%d]\n", index , x , y , p ) 157 PRINTF("\n[MJPEG] thread IDCT[%d] starts on P[%d,%d,%d] / trdid = %x\n", 158 index , x , y , p, (uint32_t)trdid_idct[index] ) 159 158 160 159 161 uint32_t image = index; … … 210 212 mwmr_write( output, (uint32_t*)bout , 16 ); 211 213 212 #if (DEBUG_IDCT > 1) 213 PRINTF("\nIDCT[%d] completes block %d/%d in image %d\n", 214 index , block , nblocks , image ) 215 PRINTF(" %x %x %x %x %x %x %x %x\n" 216 " %x %x %x %x %x %x %x %x\n" 217 " %x %x %x %x %x %x %x %x\n" 218 " %x %x %x %x %x %x %x %x\n" 219 " %x %x %x %x %x %x %x %x\n" 220 " %x %x %x %x %x %x %x %x\n" 221 " %x %x %x %x %x %x %x %x\n" 222 " %x %x %x %x %x %x %x %x\n", 223 bout[0] , bout[1] , bout[2] , bout[3] , bout[4] , bout[5] , bout[6] , bout[7] , 224 bout[8] , bout[9] , bout[10], bout[11], bout[12], bout[13], bout[14], bout[15], 225 bout[16], bout[17], bout[18], bout[19], bout[20], bout[21], bout[22], bout[23], 226 bout[24], bout[25], bout[26], bout[27], bout[28], bout[29], bout[30], bout[31], 227 bout[32], bout[33], bout[34], bout[35], bout[36], bout[37], bout[38], bout[39], 228 bout[40], bout[41], bout[42], bout[43], bout[44], bout[45], bout[46], bout[47], 229 bout[48], bout[49], bout[50], bout[51], bout[52], bout[53], bout[54], bout[55], 230 bout[56], bout[57], bout[58], bout[59], bout[60], bout[61], bout[62], bout[63]) 214 #if (DEBUG_IDCT > 1) 215 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 216 PRINTF("\nIDCT[%d] completes block %d/%d in image %d\n" 217 " %x %x %x %x %x %x %x %x\n" 218 " %x %x %x %x %x %x %x %x\n" 219 " %x %x %x %x %x %x %x %x\n" 220 " %x %x %x %x %x %x %x %x\n" 221 " %x %x %x %x %x %x %x %x\n" 222 " %x %x %x %x %x %x %x %x\n" 223 " %x %x %x %x %x %x %x %x\n" 224 " %x %x %x %x %x %x %x %x\n", 225 index , block , nblocks , image , 226 bout[0] , bout[1] , bout[2] , bout[3] , bout[4] , bout[5] , bout[6] , bout[7] , 227 bout[8] , bout[9] , bout[10], bout[11], bout[12], bout[13], bout[14], bout[15], 228 bout[16], bout[17], bout[18], bout[19], bout[20], bout[21], bout[22], bout[23], 229 bout[24], bout[25], bout[26], bout[27], bout[28], bout[29], bout[30], bout[31], 230 bout[32], bout[33], bout[34], bout[35], bout[36], bout[37], bout[38], bout[39], 231 bout[40], bout[41], bout[42], bout[43], bout[44], bout[45], bout[46], bout[47], 232 bout[48], bout[49], bout[50], bout[51], bout[52], bout[53], bout[54], bout[55], 233 bout[56], bout[57], bout[58], bout[59], bout[60], bout[61], bout[62], bout[63]) } 231 234 } 232 235 #endif … … 234 237 235 238 #if DEBUG_IDCT 236 PRINTF("IDCT[%d] completes image %d at cycle %d\n", index , image , giet_proctime() ) 239 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 240 { PRINTF("\nIDCT[%d] completes image %d at cycle %d\n", index , image , giet_proctime() ) } 237 241 #endif 238 242 … … 241 245 } // end while (1) on images 242 246 243 giet_pthread_exit( " idctcompleted" );247 giet_pthread_exit( "IDCT completed" ); 244 248 245 249 } // end idct() -
soft/giet_vm/applications/mjpeg/iqzz.c
r723 r736 39 39 uint32_t block; 40 40 uint32_t i; 41 uint8_t QT able[64];// Quantisation Table / 1 byte per pixel42 int16_t b ufin[64]; // Input data buffer / 2 bytes per pixel43 int32_t b ufout[64]; // Output data buffer / 4 bytes per pixel41 uint8_t QT[64]; // Quantisation Table / 1 byte per pixel 42 int16_t bin[64]; // Input data buffer / 2 bytes per pixel 43 int32_t bout[64]; // Output data buffer / 4 bytes per pixel 44 44 45 45 uint32_t nblocks = nblocks_w * nblocks_h; … … 55 55 giet_proc_xyp( &x , &y , &p ); 56 56 57 PRINTF("\n[MJPEG] thread IQZZ[%d] starts on P[%d,%d,%d]\n", index, x, y, p ) 57 PRINTF("\n[MJPEG] thread IQZZ[%d] starts on P[%d,%d,%d] / trdid = %x\n", 58 index , x , y , p, (uint32_t)trdid_iqzz[index] ) 59 58 60 59 61 uint32_t image = index; … … 62 64 { 63 65 // read the quantization coefs from mwmr_in_quanti (one byte per coef) 64 mwmr_read( mwmr_in_quanti , (uint32_t*)QT able, 16 );66 mwmr_read( mwmr_in_quanti , (uint32_t*)QT , 16 ); 65 67 66 68 #if (DEBUG_IQZZ > 1) 67 PRINTF("\nIQZZ[%d] get quantisation coefs for image %d\n", index , image ) 69 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 70 { PRINTF("\nIQZZ[%d] get quantisation coefs for image %d\n" 71 "%d %d %d %d %d %d %d %d\n" 72 "%d %d %d %d %d %d %d %d\n" 73 "%d %d %d %d %d %d %d %d\n" 74 "%d %d %d %d %d %d %d %d\n" 75 "%d %d %d %d %d %d %d %d\n" 76 "%d %d %d %d %d %d %d %d\n" 77 "%d %d %d %d %d %d %d %d\n" 78 "%d %d %d %d %d %d %d %d\n", 79 index , image , 80 QT[ 0],QT[ 1],QT[ 2],QT[ 3],QT[ 4],QT[ 5],QT[ 6],QT[ 7], 81 QT[ 8],QT[ 9],QT[10],QT[11],QT[12],QT[13],QT[14],QT[15], 82 QT[16],QT[17],QT[18],QT[19],QT[20],QT[21],QT[22],QT[23], 83 QT[24],QT[25],QT[26],QT[27],QT[28],QT[29],QT[30],QT[31], 84 QT[32],QT[33],QT[34],QT[35],QT[36],QT[37],QT[38],QT[39], 85 QT[40],QT[41],QT[42],QT[43],QT[44],QT[45],QT[46],QT[47], 86 QT[48],QT[49],QT[50],QT[51],QT[52],QT[53],QT[54],QT[55], 87 QT[56],QT[57],QT[58],QT[59],QT[60],QT[61],QT[62],QT[63] ) } 68 88 #endif 69 89 … … 71 91 { 72 92 // read one block from mwmr_in_data (2 bytes per pixel) 73 mwmr_read( mwmr_in_data , (uint32_t*)b ufin , 32 );93 mwmr_read( mwmr_in_data , (uint32_t*)bin , 32 ); 74 94 75 95 // unquantify & UnZZ each pixel 76 96 for ( i = 0 ; i < 64 ; ++i ) 77 97 { 78 b ufout[G_ZZ[i]] = bufin[i] * QTable[i];98 bout[G_ZZ[i]] = bin[i] * QT[i]; 79 99 } 80 100 81 101 // write one block to IDCT / 4 bytes per pixel 82 mwmr_write( mwmr_out_data , (uint32_t*)b ufout , 64 );102 mwmr_write( mwmr_out_data , (uint32_t*)bout , 64 ); 83 103 84 104 #if (DEBUG_IQZZ > 1) 85 PRINTF("\nIQZZ[%d] completes block %d/%d in image %d\n", 86 index , block , nblocks , image ) 87 PRINTF(" %d %d %d %d %d %d %d %d\n" 88 " %d %d %d %d %d %d %d %d\n" 89 " %d %d %d %d %d %d %d %d\n" 90 " %d %d %d %d %d %d %d %d\n" 91 " %d %d %d %d %d %d %d %d\n" 92 " %d %d %d %d %d %d %d %d\n" 93 " %d %d %d %d %d %d %d %d\n" 94 " %d %d %d %d %d %d %d %d\n", 95 bufout[0] , bufout[1] , bufout[2] , bufout[3] , bufout[4] , bufout[5] , bufout[6] , bufout[7] , 96 bufout[8] , bufout[9] , bufout[10], bufout[11], bufout[12], bufout[13], bufout[14], bufout[15], 97 bufout[16], bufout[17], bufout[18], bufout[19], bufout[20], bufout[21], bufout[22], bufout[23], 98 bufout[24], bufout[25], bufout[26], bufout[27], bufout[28], bufout[29], bufout[30], bufout[31], 99 bufout[32], bufout[33], bufout[34], bufout[35], bufout[36], bufout[37], bufout[38], bufout[39], 100 bufout[40], bufout[41], bufout[42], bufout[43], bufout[44], bufout[45], bufout[46], bufout[47], 101 bufout[48], bufout[49], bufout[50], bufout[51], bufout[52], bufout[53], bufout[54], bufout[55], 102 bufout[56], bufout[57], bufout[58], bufout[59], bufout[60], bufout[61], bufout[62], bufout[63]) 105 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 106 { PRINTF("\nIQZZ[%d] completes block %d/%d in image %d\n" 107 " %d %d %d %d %d %d %d %d\n" 108 " %d %d %d %d %d %d %d %d\n" 109 " %d %d %d %d %d %d %d %d\n" 110 " %d %d %d %d %d %d %d %d\n" 111 " %d %d %d %d %d %d %d %d\n" 112 " %d %d %d %d %d %d %d %d\n" 113 " %d %d %d %d %d %d %d %d\n" 114 " %d %d %d %d %d %d %d %d\n", 115 index , block , nblocks , image , 116 bout[0] , bout[1] , bout[2] , bout[3] , bout[4] , bout[5] , bout[6] , bout[7] , 117 bout[8] , bout[9] , bout[10], bout[11], bout[12], bout[13], bout[14], bout[15], 118 bout[16], bout[17], bout[18], bout[19], bout[20], bout[21], bout[22], bout[23], 119 bout[24], bout[25], bout[26], bout[27], bout[28], bout[29], bout[30], bout[31], 120 bout[32], bout[33], bout[34], bout[35], bout[36], bout[37], bout[38], bout[39], 121 bout[40], bout[41], bout[42], bout[43], bout[44], bout[45], bout[46], bout[47], 122 bout[48], bout[49], bout[50], bout[51], bout[52], bout[53], bout[54], bout[55], 123 bout[56], bout[57], bout[58], bout[59], bout[60], bout[61], bout[62], bout[63]) } 103 124 #endif 104 125 } // end for blocks 105 126 106 127 #if DEBUG_IQZZ 107 PRINTF("\nIQZZ[%d] completes image %d at cycle %d\n", index , image , giet_proctime() ) 128 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 129 { PRINTF("\nIQZZ[%d] completes image %d at cycle %d\n", index , image , giet_proctime() ) } 108 130 #endif 109 131 … … 112 134 } // end while(1) on images 113 135 114 giet_pthread_exit( " iqzzcompleted" );136 giet_pthread_exit( "IQZZ completed" ); 115 137 116 138 } // end iqzz() -
soft/giet_vm/applications/mjpeg/libu.c
r723 r736 52 52 // giet_tty_alloc( 0 ); 53 53 54 PRINTF("\n[MJPEG] thread LIBU[%d] starts on P[%d,%d,%d]\n", index , x , y , p ) 54 PRINTF("\n[MJPEG] thread LIBU[%d] starts on P[%d,%d,%d] / trdid = %x\n", 55 index , x , y , p, (uint32_t)trdid_libu[index] ) 55 56 56 57 uint32_t image = index; … … 83 84 84 85 #if (DEBUG_LIBU > 1) 85 PRINTF("\nLIBU[%d] copy block[%d] for image %d\n", 86 index, line * nblocks_w + column , image ) 86 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 87 { PRINTF("\nLIBU[%d] copy block[%d] for image %d\n", 88 index, line * nblocks_w + column , image ) } 87 89 #endif 88 90 } … … 97 99 98 100 #if DEBUG_LIBU 99 PRINTF("\nLIBU[%d] completes image %d at cycle %d\n", index , image , time ) 101 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 102 { PRINTF("\nLIBU[%d] completes image %d at cycle %d\n", index , image , time ) } 100 103 #endif 101 104 // register date of display for instrumentation … … 106 109 } // end while on images 107 110 108 giet_pthread_exit( " libucompleted" );111 giet_pthread_exit( "LIBU completed" ); 109 112 110 113 } // end libu() -
soft/giet_vm/applications/mjpeg/mjpeg.c
r723 r736 26 26 #include <stdlib.h> 27 27 #include "mjpeg.h" 28 #include <mapping_info.h> // for coprocessor types and modes 28 29 29 30 … … 39 40 uint32_t fd; // file descriptor for the file containing the MJPEG stream 40 41 42 // arrays of pointers on MWMR channels 41 43 mwmr_channel_t* tg_2_demux[256]; // one per cluster 42 44 mwmr_channel_t* demux_2_vld_data[256]; // one per cluster … … 46 48 mwmr_channel_t* iqzz_2_idct[256]; // one per cluster 47 49 mwmr_channel_t* idct_2_libu[256]; // one per cluster 50 51 // thread trdid ( for pthread_create() and pthread_join() ) 52 pthread_t trdid_tg; 53 pthread_t trdid_demux[256]; // one per cluster 54 pthread_t trdid_vld[256]; // one per cluster 55 pthread_t trdid_iqzz[256]; // one per cluster 56 pthread_t trdid_idct[256]; // one per cluster 57 pthread_t trdid_libu[256]; // one per cluster 48 58 49 59 user_lock_t tty_lock; // lock protecting shared TTY … … 113 123 uint32_t image_height; 114 124 115 PRINTF("\n[MJPEG] enter path for JPEG stream file\n> "); 116 giet_tty_gets( file_pathname , 256 ); 117 118 if ( file_pathname[0] == 0 ) 125 if ( INTERACTIVE_MODE ) 126 { 127 PRINTF("\n[MJPEG] enter path for JPEG stream file (default is plan_48.mjpg)\n> ") 128 giet_tty_gets( file_pathname , 256 ); 129 130 if ( file_pathname[0] == 0 ) 131 { 132 strcpy( file_pathname , "/misc/plan_48.mjpg" ); 133 image_width = 48; 134 image_height = 48; 135 } 136 else 137 { 138 PRINTF("\n[MJPEG] enter image width\n> ") 139 giet_tty_getw( &image_width ); 140 PRINTF("\n[MJPEG] enter image height\n> ") 141 giet_tty_getw( &image_height ); 142 PRINTF("\n") 143 } 144 } 145 else 119 146 { 120 147 strcpy( file_pathname , "/misc/plan_48.mjpg" ); 121 148 image_width = 48; 122 149 image_height = 48; 123 PRINTF("\n\n[MJPEG] use /misc/plan_48.mjpg\n" ); 124 } 125 else 126 { 127 PRINTF("\n[MJPEG] enter image width\n> "); 128 giet_tty_getw( &image_width ); 129 PRINTF("\n[MJPEG] enter image height\n> "); 130 giet_tty_getw( &image_height ); 131 PRINTF("\n"); 132 } 133 150 } 151 134 152 giet_pthread_assert( (image_width == fbf_width) && (image_height == fbf_height) , 135 153 "[MJPEG ERROR] image size doesn't fit frame buffer size"); 136 154 155 PRINTF("\n\n[MJPEG] starts for stream %s\n", file_pathname ) 156 137 157 // compute nblocks_h & nblocks_w 138 158 nblocks_w = fbf_width / 8; … … 201 221 202 222 // start CMA channel 203 giet_fbf_cma_start( 204 205 PRINTF("\n[MJPEG] main thread completes initialisation for %d cores\n", 223 giet_fbf_cma_start(); 224 225 PRINTF("\n[MJPEG] main thread completes initialisation for %d cores\n", 206 226 x_size * y_size * nprocs ) 207 227 208 // thread trdid for pthread_create() and pthread_join() 209 pthread_t trdid_tg; 210 pthread_t trdid_demux[256]; 211 pthread_t trdid_vld[256]; 212 pthread_t trdid_iqzz[256]; 213 pthread_t trdid_idct[256]; 214 pthread_t trdid_libu[256]; 215 228 mwmr_channel_t* ptr; 229 230 for ( n = 0 ; n < x_size*y_size ; n++ ) 231 { 232 ptr = tg_2_demux[n]; 233 PRINTF(" - tg_2_demux[%d] = %x / &lock = %x / &buf = %x / size = %d\n", 234 n, ptr, (uint32_t)&ptr->lock, (uint32_t)ptr->data, ptr->depth<<2 ) 235 236 ptr = demux_2_vld_data[n]; 237 PRINTF(" - demux_2_vld[%d] = %x / &lock = %x / &buf = %x / size = %d\n", 238 n, ptr, (uint32_t)&ptr->lock, (uint32_t)ptr->data, ptr->depth<<2 ) 239 240 ptr = vld_2_iqzz[n]; 241 PRINTF(" - vld_2_iqzz[%d] = %x / &lock = %x / &buf = %x / size = %d\n", 242 n, ptr, (uint32_t)&ptr->lock, (uint32_t)ptr->data, ptr->depth<<2 ) 243 244 ptr = iqzz_2_idct[n]; 245 PRINTF(" - iqzz_2_idct[%d] = %x / &lock = %x / &buf = %x / size = %d\n", 246 n, ptr, (uint32_t)&ptr->lock, (uint32_t)ptr->data, ptr->depth<<2 ) 247 248 ptr = idct_2_libu[n]; 249 PRINTF(" - idct_2_libu[%d] = %x / &lock = %x / &buf = %x / size = %d\n", 250 n, ptr, (uint32_t)&ptr->lock, (uint32_t)ptr->data, ptr->depth<<2 ) 251 } 252 253 // launch all threads : precise mapping is defined in the mjpeg.py file 216 254 uint32_t index; 217 218 // launch all threads : precise mapping is defined in the mjpeg.py file219 255 220 256 if ( giet_pthread_create( &trdid_tg, NULL, &tg , NULL ) ) 221 257 giet_pthread_exit( "error launching thread tg\n"); 222 258 223 for ( index = 0 ; index < (x_size * y_size) ; index++ ) 224 { 225 if ( giet_pthread_create( &trdid_demux[index], NULL, &demux , (void*)index ) ) 226 giet_pthread_exit( "error launching thread demux\n"); 227 228 if ( giet_pthread_create( &trdid_vld[index], NULL, &vld , (void*)index ) ) 229 giet_pthread_exit( "error launching thread vld\n"); 230 231 if ( giet_pthread_create( &trdid_iqzz[index], NULL, &iqzz , (void*)index ) ) 232 giet_pthread_exit( "error launching thread iqzz"); 233 234 if ( giet_pthread_create( &trdid_idct[index], NULL, &idct , (void*)index ) ) 235 giet_pthread_exit( "error launching thread idct\n"); 236 237 if ( giet_pthread_create( &trdid_libu[index], NULL, &libu , (void*)index ) ) 238 giet_pthread_exit( "error launching thread libu\n"); 259 for ( x = 0 ; x < x_size ; x++ ) 260 { 261 for ( y = 0 ; y < y_size ; y++ ) 262 { 263 index = x * y_size + y; 264 265 // DEMUX 266 if ( giet_pthread_create( &trdid_demux[index], NULL, &demux , (void*)index ) ) 267 giet_pthread_exit( "error launching thread demux\n"); 268 269 // VLD 270 if ( giet_pthread_create( &trdid_vld[index], NULL, &vld , (void*)index ) ) 271 giet_pthread_exit( "error launching thread vld\n"); 272 273 // IQZZ 274 if ( giet_pthread_create( &trdid_iqzz[index], NULL, &iqzz , (void*)index ) ) 275 giet_pthread_exit( "error launching thread iqzz"); 276 277 // IDCT 278 if ( USE_DCT_COPROC ) // allocate, initialise, and start hardware coprocessor 279 { 280 giet_coproc_channel_t in_channel; 281 giet_coproc_channel_t out_channel; 282 uint32_t cluster_xy = (x<<4) + y; 283 uint32_t coproc_type = 2; 284 uint32_t info; 285 286 // allocate DCT coprocessor 287 giet_coproc_alloc( cluster_xy , coproc_type , &info ); 288 289 // initialize channels 290 in_channel.channel_mode = MODE_MWMR; 291 in_channel.buffer_size = (iqzz_2_idct[index]->depth)<<2; 292 in_channel.buffer_vaddr = (uint32_t)(iqzz_2_idct[index]->data); 293 in_channel.status_vaddr = (uint32_t)(&iqzz_2_idct[index]->sts); 294 in_channel.lock_vaddr = (uint32_t)(&iqzz_2_idct[index]->lock); 295 296 giet_coproc_channel_init( cluster_xy , coproc_type , 0 , &in_channel ); 297 298 out_channel.channel_mode = MODE_MWMR; 299 out_channel.buffer_size = (idct_2_libu[index]->depth)<<2; 300 out_channel.buffer_vaddr = (uint32_t)(idct_2_libu[index]->data); 301 out_channel.status_vaddr = (uint32_t)(&idct_2_libu[index]->sts); 302 out_channel.lock_vaddr = (uint32_t)(&idct_2_libu[index]->lock); 303 304 giet_coproc_channel_init( cluster_xy , coproc_type , 1 , &out_channel ); 305 306 // start coprocessor 307 giet_coproc_run( cluster_xy , coproc_type ); 308 } 309 else // launches a software thread 310 { 311 if ( giet_pthread_create( &trdid_idct[index], NULL, &idct , (void*)index ) ) 312 giet_pthread_exit( "error launching thread idct\n"); 313 } 314 315 // LIBU 316 if ( giet_pthread_create( &trdid_libu[index], NULL, &libu , (void*)index ) ) 317 giet_pthread_exit( "error launching thread libu\n"); 318 } 239 319 } 240 320 … … 244 324 { PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for tg\n" ) } 245 325 246 for ( index = 0 ; index < (x_size * y_size) ; index++ ) 247 { 248 if ( giet_pthread_join( trdid_demux[index] , NULL ) ) 249 { PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for demux[%d]\n", index ) } 250 251 if ( giet_pthread_join( trdid_vld[index] , NULL ) ) 252 { PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for vld[%d]\n", index ) } 253 254 if ( giet_pthread_join( trdid_iqzz[index] , NULL ) ) 255 { PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for iqzz[%d]\n", index ) } 256 257 if ( giet_pthread_join( trdid_idct[index] , NULL ) ) 258 { PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for idct[%d]\n", index ) } 259 260 if ( giet_pthread_join( trdid_libu[index] , NULL ) ) 261 { PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for libu[%d]\n", index ) } 326 for ( x = 0 ; x < x_size ; x++ ) 327 { 328 for ( y = 0 ; y < y_size ; y++ ) 329 { 330 index = x * y_size + y; 331 332 if ( giet_pthread_join( trdid_demux[index] , NULL ) ) 333 { PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for demux[%d]\n", index ) } 334 335 if ( giet_pthread_join( trdid_vld[index] , NULL ) ) 336 { PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for vld[%d]\n", index ) } 337 338 if ( giet_pthread_join( trdid_iqzz[index] , NULL ) ) 339 { PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for iqzz[%d]\n", index ) } 340 341 if ( USE_DCT_COPROC == 0 ) 342 { 343 if ( giet_pthread_join( trdid_idct[index] , NULL ) ) 344 { PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for idct[%d]\n", index ) } 345 } 346 347 if ( giet_pthread_join( trdid_libu[index] , NULL ) ) 348 { PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for libu[%d]\n", index ) } 349 350 if ( USE_DCT_COPROC ) 351 { 352 uint32_t cluster_xy = (x<<4) + y; 353 uint32_t coproc_type = 2; 354 giet_coproc_release( cluster_xy , coproc_type ); 355 } 356 } 262 357 } 263 358 -
soft/giet_vm/applications/mjpeg/mjpeg.h
r723 r736 16 16 #include <user_lock.h> 17 17 18 #define MAX_IMAGES 64 18 //////////////////////////////////////////////////////////////////////////////////////// 19 // Configuration Variables 20 //////////////////////////////////////////////////////////////////////////////////////// 21 22 #define MAX_IMAGES 16 23 24 #define USE_DCT_COPROC 1 25 26 #define INTERACTIVE_MODE 0 19 27 20 28 //////////////////////////////////////////////////////////////////////////////////////// … … 22 30 //////////////////////////////////////////////////////////////////////////////////////// 23 31 24 #define TG_2_DEMUX_DEPTH 25625 #define DEMUX_2_VLD_DATA_DEPTH 25626 #define DEMUX_2_VLD_HUFF_DEPTH 25627 #define DEMUX_2_IQZZ_DEPTH 25628 #define VLD_2_IQZZ_DEPTH 25629 #define IQZZ_2_IDCT_DEPTH 25630 #define IDCT_2_LIBU_DEPTH 25632 #define TG_2_DEMUX_DEPTH 1024 33 #define DEMUX_2_VLD_DATA_DEPTH 1024 34 #define DEMUX_2_VLD_HUFF_DEPTH 1024 35 #define DEMUX_2_IQZZ_DEPTH 1024 36 #define VLD_2_IQZZ_DEPTH 1024 37 #define IQZZ_2_IDCT_DEPTH 1024 38 #define IDCT_2_LIBU_DEPTH 1024 31 39 32 40 //////////////////////////////////////////////////////////////////////////////////////// … … 37 45 //////////////////////////////////////////////////////////////////////////////////////// 38 46 39 #define DEBUG_TG 1 40 #define DEBUG_DEMUX 0 41 #define DEBUG_VLD 0 42 #define DEBUG_IQZZ 0 43 #define DEBUG_IDCT 0 44 #define DEBUG_LIBU 0 47 #define DEBUG_CLUSTER_INDEX 0xFFFFFFFF // use 0xFFFFFFFF for all clusters 48 49 #define DEBUG_TG 1 50 #define DEBUG_DEMUX 1 51 #define DEBUG_VLD 1 52 #define DEBUG_IQZZ 1 53 #define DEBUG_IDCT 1 54 #define DEBUG_LIBU 1 45 55 46 56 //////////////////////////////////////////////////////////////////////////////////////// 47 // Global variables 57 // Global variables (allocated in mjpeg.c) 48 58 //////////////////////////////////////////////////////////////////////////////////////// 49 59 … … 57 67 extern mwmr_channel_t* iqzz_2_idct[256]; // one per cluster 58 68 extern mwmr_channel_t* idct_2_libu[256]; // one per cluster 69 70 extern pthread_t trdid_tg; 71 extern pthread_t trdid_demux[256]; // one per cluster 72 extern pthread_t trdid_vld[256]; // one per cluster 73 extern pthread_t trdid_iqzz[256]; // one per cluster 74 extern pthread_t trdid_idct[256]; // one per cluster 75 extern pthread_t trdid_libu[256]; // one per cluster 59 76 60 77 extern user_lock_t tty_lock; // lock protecting shared TTY -
soft/giet_vm/applications/mjpeg/mjpeg.py
r723 r736 32 32 nprocs = mapping.nprocs 33 33 34 assert (nprocs >= 1) 34 assert (nprocs >= 1) and (nprocs <= 4) 35 35 36 36 # define vsegs base & size … … 42 42 43 43 heap_base = 0x30000000 44 heap_size = 0x00 100000 # 1Mbytes (per cluster)44 heap_size = 0x00200000 # 2 Mbytes (per cluster) 45 45 46 46 stack_base = 0x40000000 … … 49 49 # create vspace 50 50 vspace = mapping.addVspace( name = 'mjpeg', 51 startname = ' data',51 startname = 'mjpeg_data', 52 52 active = True ) 53 53 54 54 # data vseg : shared / cluster[0][0] 55 mapping.addVseg( vspace, ' data', data_base , data_size,55 mapping.addVseg( vspace, 'mjpeg_data', data_base , data_size, 56 56 'C_WU', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM', 57 57 binpath = 'bin/mjpeg/appli.elf', … … 66 66 base = heap_base + (cluster_id * size) 67 67 68 mapping.addVseg( vspace, ' heap_%d_%d' %(x,y), base , size,68 mapping.addVseg( vspace, 'mjpeg_heap_%d_%d' %(x,y), base , size, 69 69 'C_WU', vtype = 'HEAP', x = x, y = y, pseg = 'RAM', 70 70 local = False, big = True ) … … 76 76 if ( mapping.clusters[cluster_id].procs ): 77 77 78 mapping.addVseg( vspace, ' code_%d_%d' %(x,y),78 mapping.addVseg( vspace, 'mjpeg_code_%d_%d' %(x,y), 79 79 code_base , code_size, 80 80 'CXWU', vtype = 'ELF', x = x, y = y, pseg = 'RAM', … … 85 85 # ... plus main_stack and tg_stack in cluster[0][0] 86 86 base = stack_base 87 mapping.addVseg( vspace, 'm ain_stack',87 mapping.addVseg( vspace, 'mjpeg_main_stack', 88 88 base, stack_size, 'C_WU', vtype = 'BUFFER', 89 89 x = 0 , y = 0 , pseg = 'RAM', … … 92 92 base += stack_size 93 93 94 mapping.addVseg( vspace, ' tg_stack',94 mapping.addVseg( vspace, 'mjpeg_tg_stack', 95 95 base , stack_size, 'C_WU', vtype = 'BUFFER', 96 96 x = 0 , y = 0 , pseg = 'RAM', … … 103 103 if ( mapping.clusters[cluster_id].procs ): 104 104 105 mapping.addVseg( vspace, ' demux_stack_%d_%d' % (x,y),106 base, stack_size, 'C_WU', vtype = 'BUFFER', 107 x = x , y = y , pseg = 'RAM', 108 local = True ) 109 110 base += stack_size 111 112 mapping.addVseg( vspace, ' vld_stack_%d_%d' % (x,y),113 base, stack_size, 'C_WU', vtype = 'BUFFER', 114 x = x , y = y , pseg = 'RAM', 115 local = True ) 116 117 base += stack_size 118 119 mapping.addVseg( vspace, ' iqzz_stack_%d_%d' % (x,y),120 base, stack_size, 'C_WU', vtype = 'BUFFER', 121 x = x , y = y , pseg = 'RAM', 122 local = True ) 123 124 base += stack_size 125 126 mapping.addVseg( vspace, ' idct_stack_%d_%d' % (x,y),127 base, stack_size, 'C_WU', vtype = 'BUFFER', 128 x = x , y = y , pseg = 'RAM', 129 local = True ) 130 131 base += stack_size 132 133 mapping.addVseg( vspace, ' libu_stack_%d_%d' % (x,y),105 mapping.addVseg( vspace, 'mjpeg_demux_stack_%d_%d' % (x,y), 106 base, stack_size, 'C_WU', vtype = 'BUFFER', 107 x = x , y = y , pseg = 'RAM', 108 local = True ) 109 110 base += stack_size 111 112 mapping.addVseg( vspace, 'mjpeg_vld_stack_%d_%d' % (x,y), 113 base, stack_size, 'C_WU', vtype = 'BUFFER', 114 x = x , y = y , pseg = 'RAM', 115 local = True ) 116 117 base += stack_size 118 119 mapping.addVseg( vspace, 'mjpeg_iqzz_stack_%d_%d' % (x,y), 120 base, stack_size, 'C_WU', vtype = 'BUFFER', 121 x = x , y = y , pseg = 'RAM', 122 local = True ) 123 124 base += stack_size 125 126 mapping.addVseg( vspace, 'mjpeg_idct_stack_%d_%d' % (x,y), 127 base, stack_size, 'C_WU', vtype = 'BUFFER', 128 x = x , y = y , pseg = 'RAM', 129 local = True ) 130 131 base += stack_size 132 133 mapping.addVseg( vspace, 'mjpeg_libu_stack_%d_%d' % (x,y), 134 134 base, stack_size, 'C_WU', vtype = 'BUFFER', 135 135 x = x , y = y , pseg = 'RAM', … … 139 139 140 140 # threads mapping: demux, vld, iqzz, idct, libu replicated in all clusters 141 # ... plus main & tg on P[0,0,0]141 # main & tg are mapped in cluster[0,0] 142 142 mapping.addThread( vspace, 'main', True, 0, 0, 0, 143 'm ain_stack',144 ' heap_0_0',143 'mjpeg_main_stack', 144 'mjpeg_heap_0_0', 145 145 0 ) # index in start_vector 146 146 … … 162 162 p_tg = 0 163 163 p_demux = 1 164 p_vld = 1164 p_vld = 2 165 165 p_iqzz = 1 166 p_idct = 2166 p_idct = 1 167 167 p_libu = 1 168 168 elif ( nprocs == 4 ): 169 169 p_tg = 0 170 170 p_demux = 1 171 p_vld = 2171 p_vld = 3 172 172 p_iqzz = 2 173 173 p_idct = 3 174 174 p_libu = 2 175 elif ( nprocs == 5 ):176 p_tg = 0177 p_demux = 1178 p_vld = 2179 p_iqzz = 3180 p_idct = 4181 p_libu = 3182 else:183 p_tg = 0184 p_demux = 1185 p_vld = 2186 p_iqzz = 3187 p_idct = 4188 p_libu = 5189 175 190 176 mapping.addThread( vspace, 'tg', False, 0, 0, p_tg, 191 ' tg_stack',192 ' heap_0_0',177 'mjpeg_tg_stack', 178 'mjpeg_heap_0_0', 193 179 1 ) # index in start_vector 194 180 … … 198 184 199 185 mapping.addThread( vspace, 'demux_%d_%d' % (x,y), False , x, y, p_demux, 200 ' demux_stack_%d_%d' % (x,y),201 ' heap_%d_%d' % (x,y),186 'mjpeg_demux_stack_%d_%d' % (x,y), 187 'mjpeg_heap_%d_%d' % (x,y), 202 188 2 ) # start_index 203 189 204 190 mapping.addThread( vspace, 'vld_%d_%d' % (x,y), False , x, y, p_vld, 205 ' vld_stack_%d_%d' % (x,y),206 ' heap_%d_%d' % (x,y),191 'mjpeg_vld_stack_%d_%d' % (x,y), 192 'mjpeg_heap_%d_%d' % (x,y), 207 193 3 ) # start_index 208 194 209 195 mapping.addThread( vspace, 'iqzz_%d_%d' % (x,y), False , x, y, p_iqzz, 210 ' iqzz_stack_%d_%d' % (x,y),211 ' heap_%d_%d' % (x,y),196 'mjpeg_iqzz_stack_%d_%d' % (x,y), 197 'mjpeg_heap_%d_%d' % (x,y), 212 198 4 ) # start_index 213 199 214 200 mapping.addThread( vspace, 'idct_%d_%d' % (x,y), False , x, y, p_idct, 215 ' idct_stack_%d_%d' % (x,y),216 ' heap_%d_%d' % (x,y),201 'mjpeg_idct_stack_%d_%d' % (x,y), 202 'mjpeg_heap_%d_%d' % (x,y), 217 203 5 ) # start_index 218 204 219 205 mapping.addThread( vspace, 'libu_%d_%d' % (x,y), False , x, y, p_libu, 220 ' libu_stack_%d_%d' % (x,y),221 ' heap_%d_%d' % (x,y),206 'mjpeg_libu_stack_%d_%d' % (x,y), 207 'mjpeg_heap_%d_%d' % (x,y), 222 208 6 ) # start_index 223 209 -
soft/giet_vm/applications/mjpeg/tg.c
r723 r736 39 39 // giet_tty_alloc( 0 ); 40 40 41 PRINTF("\n[MJPEG] thread TG starts on P[%d,%d,%d]\n", x , y , p ) 41 PRINTF("\n[MJPEG] thread TG starts on P[%d,%d,%d] / trdid = %x\n", 42 x , y , p , (uint32_t)trdid_tg ) 42 43 43 44 // allocate input buffer : 1024 bytes -
soft/giet_vm/applications/mjpeg/vld.c
r723 r736 193 193 } 194 194 195 //////////////////////////////////////////// 196 void huff_tables_load( huff_tables_t* huff, 195 ///////////////////////////////////////////// 196 void huff_tables_load( uint32_t index, 197 huff_tables_t* huff, 197 198 mwmr_bufio_t* bufio ) 198 199 { … … 253 254 mwmr_bufio_align( bufio ); 254 255 255 #if (DEBUG_VLD > 2) 256 #if (DEBUG_VLD > 3) 257 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 256 258 huff_tables_dump( huff , is_ac ); 257 259 #endif … … 312 314 // unpack a 8*8 pixels block with 2 bytes per pixel 313 315 ////////////////////////////////////////////////////////// 314 static int16_t vld_unpack_block( bitreader_t* stream, 315 mwmr_channel_t* mwmr_out, 316 huff_tables_t* huff, 317 int16_t prev_dc ) 316 static int16_t vld_unpack_block( uint32_t index, // cluster index 317 uint32_t image, // image index 318 uint32_t block, // block index 319 bitreader_t* stream, // input bit stream 320 mwmr_channel_t* mwmr_out, // output channel 321 huff_tables_t* huff, // Huffman Tables 322 int16_t prev_dc ) // previous DC coef 318 323 { 319 324 uint32_t temp; … … 335 340 buf[0] = value + prev_dc; 336 341 337 #if (DEBUG_VLD > 1) 338 PRINTF("\nDC[0] = %d / reformat( %x , %d ) = %d\n", buf[0], temp , symbol , value ) 342 #if (DEBUG_VLD > 2) 343 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 344 { PRINTF("\nVLD[%d] : DC[0] = %d / reformat( %x , %d ) = %d\n", 345 index , buf[0], temp , symbol , value ) } 339 346 #endif 340 347 … … 348 355 { 349 356 350 #if (DEBUG_VLD > 1) 351 PRINTF("EOB found at i = %d\n", i ); 357 #if (DEBUG_VLD > 2) 358 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 359 { PRINTF("\nVLD[%d] : EOB found at i = %d\n", index , i ) } 352 360 #endif 353 361 break; … … 370 378 371 379 #if (DEBUG_VLD > 2) 372 PRINTF("AC[%d] = %d / reformat( %x , %d ) = %d\n", i , buf[i] , temp , cat , value ) 380 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 381 { PRINTF("\nVLD[%d] : AC[%d] = %d / reformat( %x , %d ) = %d\n", 382 index , i , buf[i] , temp , cat , value ) } 373 383 #endif 374 384 … … 379 389 380 390 #if (DEBUG_VLD > 1 ) 381 PRINTF(" %d %d %d %d %d %d %d %d\n" 382 " %d %d %d %d %d %d %d %d\n" 383 " %d %d %d %d %d %d %d %d\n" 384 " %d %d %d %d %d %d %d %d\n" 385 " %d %d %d %d %d %d %d %d\n" 386 " %d %d %d %d %d %d %d %d\n" 387 " %d %d %d %d %d %d %d %d\n" 388 " %d %d %d %d %d %d %d %d\n", 389 buf[0] , buf[1] , buf[2] , buf[3] , buf[4] , buf[5] , buf[6] , buf[7] , 390 buf[8] , buf[9] , buf[10], buf[11], buf[12], buf[13], buf[14], buf[15], 391 buf[16], buf[17], buf[18], buf[19], buf[20], buf[21], buf[22], buf[23], 392 buf[24], buf[25], buf[26], buf[27], buf[28], buf[29], buf[30], buf[31], 393 buf[32], buf[33], buf[34], buf[35], buf[36], buf[37], buf[38], buf[39], 394 buf[40], buf[41], buf[42], buf[43], buf[44], buf[45], buf[46], buf[47], 395 buf[48], buf[49], buf[50], buf[51], buf[52], buf[53], buf[54], buf[55], 396 buf[56], buf[57], buf[58], buf[59], buf[60], buf[61], buf[62], buf[63]) 391 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 392 { PRINTF("\nVLD[%d] completes block %d/%d in image %d\n" 393 " %d %d %d %d %d %d %d %d\n" 394 " %d %d %d %d %d %d %d %d\n" 395 " %d %d %d %d %d %d %d %d\n" 396 " %d %d %d %d %d %d %d %d\n" 397 " %d %d %d %d %d %d %d %d\n" 398 " %d %d %d %d %d %d %d %d\n" 399 " %d %d %d %d %d %d %d %d\n" 400 " %d %d %d %d %d %d %d %d\n", 401 index , block , nblocks_w*nblocks_h , image , 402 buf[0] , buf[1] , buf[2] , buf[3] , buf[4] , buf[5] , buf[6] , buf[7] , 403 buf[8] , buf[9] , buf[10], buf[11], buf[12], buf[13], buf[14], buf[15], 404 buf[16], buf[17], buf[18], buf[19], buf[20], buf[21], buf[22], buf[23], 405 buf[24], buf[25], buf[26], buf[27], buf[28], buf[29], buf[30], buf[31], 406 buf[32], buf[33], buf[34], buf[35], buf[36], buf[37], buf[38], buf[39], 407 buf[40], buf[41], buf[42], buf[43], buf[44], buf[45], buf[46], buf[47], 408 buf[48], buf[49], buf[50], buf[51], buf[52], buf[53], buf[54], buf[55], 409 buf[56], buf[57], buf[58], buf[59], buf[60], buf[61], buf[62], buf[63]) } 397 410 #endif 398 411 … … 428 441 // giet_tty_alloc( 0 ); 429 442 430 PRINTF("\n[MJPEG] thread VLD[%d] starts on P[%d,%d,%d]\n" , index, x, y ,p ) 443 PRINTF("\n[MJPEG] thread VLD[%d] starts on P[%d,%d,%d] / trdid = %x\n", 444 index , x , y , p, (uint32_t)trdid_vld[index] ) 445 431 446 432 447 // initialise BUFIO for MWMR channel <in_data> … … 436 451 437 452 #if (DEBUG_VLD > 1) 438 PRINTF("\nVLD[%d] <in_data> : &mwmr = %x / &bufio = %x\n", 439 index , mwmr_in_data , &bufio_in_data ) 453 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 454 { PRINTF("\nVLD[%d] <in_data> : &mwmr = %x / &bufio = %x\n", 455 index , mwmr_in_data , &bufio_in_data ) } 440 456 #endif 441 457 … … 446 462 447 463 #if (DEBUG_VLD > 1) 448 PRINTF("\nVLD[%d] <in_huff> : &mwmr = %x / &bufio = %x\n", 449 index , mwmr_in_huff , &bufio_in_huff ) 464 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 465 { PRINTF("\nVLD[%d] <in_huff> : &mwmr = %x / &bufio = %x\n", 466 index , mwmr_in_huff , &bufio_in_huff ) } 450 467 #endif 451 468 … … 459 476 { 460 477 // load first Huffman Table from bufio_in_huff 461 huff_tables_load( &huff , &bufio_in_huff );478 huff_tables_load( index, &huff , &bufio_in_huff ); 462 479 463 480 // load second Huffman Table from bufio_in_huff 464 huff_tables_load( &huff , &bufio_in_huff );481 huff_tables_load( index, &huff , &bufio_in_huff ); 465 482 466 483 #if (DEBUG_VLD > 1) 467 PRINTF("\nVLD[%d] load Huffman tables for image %d\n", index , image ) 484 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 485 { PRINTF("\nVLD[%d] load Huffman tables for image %d\n", index , image ) } 468 486 #endif 469 487 … … 482 500 483 501 #if (DEBUG_VLD > 1) 484 PRINTF("\nVLD[%d] uncompress block %d/%d in image %d\n", index, block, nblocks, image ) 485 #endif 486 prev_dc = vld_unpack_block( &stream , mwmr_out, &huff , prev_dc ); 502 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 503 { PRINTF("\nVLD[%d] uncompress block %d/%d in image %d\n", index, block, nblocks, image ) } 504 #endif 505 prev_dc = vld_unpack_block( index, 506 image, 507 block, 508 &stream, 509 mwmr_out, 510 &huff, 511 prev_dc ); 487 512 } // end for blocks 488 513 489 514 #if DEBUG_VLD 490 PRINTF("\nVLD[%d] completes image %d at cycle %d\n", index , image , giet_proctime() ) 515 if ( (index == DEBUG_CLUSTER_INDEX) || (DEBUG_CLUSTER_INDEX == 0XFFFFFFFF) ) 516 { PRINTF("\nVLD[%d] completes image %d at cycle %d\n", index , image , giet_proctime() ) } 491 517 #endif 492 518 image = image + x_size*y_size; … … 494 520 } // end while on images 495 521 496 giet_pthread_exit( " vldcompleted" );522 giet_pthread_exit( "VLD completed" ); 497 523 498 524 } // end vld()
Note: See TracChangeset
for help on using the changeset viewer.