Specialized Video 8 bit and Vector 16 bit
Specialized Video (8 -bit) and Vector (16 -bit) Instructions on the Blackfin Expand on these ideas for Q 9 question and answer on the final Video , Copyright M. Smith, ECE, University of Calgary, Canada
Problem to solve ¢ ¢ ¢ Using the video capability on Blackfin Specialized instruction Examine and explain examples in detail (working program) for Q 9 format for final. l 2 Take something we have done in a laboratory and vectorize it for example Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
Blackfin Evaluation Board 8 -bit values 3 Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
Getting video information in ¢ DMA activity l l l 4 Values coming in using PPI (Parallel Port Interface) which shares many of its pins with PF Stored in SDRAM BF 561 – 2 core Blackfin, handles both video in and out at the same time Possible Q 9 question – one whole chapter in Hardware book on this area Web pages to go up on ECE-ADI-Project pages soon Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
Special 8 bit ALUS 5 Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
Video image Blanking information Frame 1 - luminance + colour information Blanking information Frame 2 - luminance + colour information Blanking information Have ability to manipulate frame information with touching blanking information 6 Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
Frame information CB 1 G 1 CR 1 G 2 CB 3 G 3 CR 3 G 4 CB 5 G 5 CR 5 G 6 Pixel 1 uses G 1 + CB 1 + CR 1 ¢ Pixel 2 uses G 2 + CB 1 + CR 1 ¢ Pixel 3 uses G 3 + CB 3 + CR 3 ¢ Pixel 4 uses G 4 + CB 3 + CR 3 ¢ Image brightness decreasing 7 Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
Frame information CB 1 G 1 CR 1 G 2 ¢ CB 3 G 3 CR 3 G 4 R 0 = [P 0] brings in information on pixel 1 and 2 intensity and colour l One memory access, 2 pixel info G 1 G 2 G 3 G 4 l 8 CB 5 G 5 CR 5 G 6 G 7 G 8 One memory access, 4 pixel intensity information Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
BYTEOP 16 P (Quad 8 -bit ADD) ¢ 8 pixel values stored in R 1 and R 0 l l l ¢ I 0 register used to select which 4 pixel values used in operations – called “byte alignment” I 0 = 0; use all bytes in R 0 I 0 = 1; Lowest byte in R 1, top 3 in R 0 8 pixel value stored in R 3 and R 2 l I 1 used to select the 4 pixels used If I 0=1, I 1 = 1; and (R 4, R 6) = byteop 16 p(R 3: 2, R 1: 0) ; // sum then we got 4 16 -bit answers -- “my byte notation” R 4. H = R 3. B 0 + R 1. B 0; // Bottom byte R 4. L = R 2. B 3 + R 0. B 3; // Highest byte R 6. H = R 2. B 2 + R 0. B 2; // Next highest byte R 6. L = R 2. B 1 + R 0. B 1; // Next highest byte 9 Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
BYTEOP 1 P (Quad 8 -bit Average) ¢ ¢ 8 pixel values stored in R 1 and R 0 l I 0 register used to select which 4 pixel values used in operations – called “byte alignment” l I 0 = 0; use all bytes in R 0 l I 0 = 1; Lowest byte in R 1, top 3 in R 0 8 pixel value stored in R 3 and R 2 l I 1 used to select the 4 pixels used If I 0=1, I 1 = 1; and R 4 = byteop 1 p(R 3: 2, R 1: 0) ; // sum and average then we got 4 16 -bit answers R 4. B 3 = (R 3. B 0 + R 1. B 0) / 2; // Bottom byte R 4. B 2 = (R 2. B 3 + R 0. B 3) / 2; // Highest byte R 4. B 1 = (R 2. B 2 + R 0. B 2) / 2; // Next highest byte R 4. B 0 = (R 2. B 1 + R 0. B 1) / 2; // Next highest byte 10 Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
BYTEOP 2 P (Quad 8 -bit Average Half word) ¢ ¢ 8 pixel values stored in R 1 and R 0 l I 0 register used to select which 4 pixel values used in operations – called “byte alignment” l I 0 = 0; use all bytes in R 0 l I 0 = 1; Lowest byte in R 1, top 3 in R 0 8 pixel value stored in R 3 and R 2 l I 1 used to select the 4 pixels used If I 0=1, I 1 = 1; and R 4 = byteop 2 p(R 3: 2, R 1: 0) ; // sum and average then we got 4 16 -bit answers R 4. B 2 = (R 3. B 0 + R 1. B 0 + R 2. B 3 + R 0. B 3) / 4; // Highest 4 bytes R 4. B 0 = (R 2. B 2 + R 0. B 2 + R 2. B 1 + R 0. B 1) / 4; 11 Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
BYTEOP 16 M (Quad 8 -bit SUBTRACT) ¢ 8 pixel values stored in R 1 and R 0 l l l ¢ I 0 register used to select which 4 pixel values used in operations – called “byte alignment” I 0 = 0; use all bytes in R 0 I 0 = 1; Lowest byte in R 1, top 3 in R 0 8 pixel value stored in R 3 and R 2 l I 1 used to select the 4 pixels used If I 0=1, I 1 = 1; and (R 4, R 6) = byteop 16 M(R 3: 2, R 1: 0) ; // sum then we got 4 16 -bit answers -- “my byte notation” R 4. H = R 3. B 0 - R 1. B 0; // Bottom byte R 4. L = R 2. B 3 - R 0. B 3; // Highest byte R 6. H = R 2. B 2 - R 0. B 2; // Next highest byte R 6. L = R 2. B 1 - R 0. B 1; // Next highest byte 12 Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
SAA -- Quad 4 -bit Subtract, Absolute and Accumulate ¢ ¢ ¢ Take the differences between 2 images R 0 = [P 0++]; -- 4 pixels – image 1 R 1 = [I 1++]; -- 4 pixels -- image 2 R 2 = 0; sum of differences Loop N - 1 times l R 2 = SAA(R 1, R 0) || R 0 = [P 0++] || R 1 = [I 1++]; l R 2 = SAA(R 1, R 0); l l Now add the 4 bytes together from R 2 How to do efficiently – sounds like Q 9 question to me 13 Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
Worked Examples 14 Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
Vector operations ¢ ¢ Many of the operations give 16 bit results Example Quad 8 -bit Add l ¢ (R 4, R 6) = byteop 16 P(R 3: 2, R 1: 0) Now you want to add the results together l l R 5 = R 4 +|- R 6; R 4. H + R 6. H with R 4. L + R 6. L R 5. L = R 5. H + R 5. L (NS); 15 Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
Vector operations ¢ ¢ ¢ 16 R 0 = R 1 +|+ R 0; R 1. H + R 0. H, R 1. L + R 0. L R 0 = R 1 +|+ R 0 (co); R 1. H + R 0. L, R 1. L + R 0. H l co – word order “cross over” l Can be +|+, +|-, -|+ or -|-; R 3 = R 1 + R 0, R 4 = R 1 – R 0; l 32 bit add and subtract at same time l Must use same source registers R 3 = R 1 +|+ R 0, R 1 -|- R 0; l 2 16 -bit adds and 2 16 -bit subtracts at same time R 3 = R 1 +|+ R 0, R 1 -|- R 0 (asr); l 2 16 -bit adds and 2 16 -bit subtracts at same time – and then afterwards do an arithmetic shift right (add and average, subtract and average) Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
Vector operations ¢ Normal max instruction (32 -bit) R 0 = MAX(R 1, R 2); l R 0 is largest of R 1 and R 2 l Ditto MIN(R 1, R 2); l ¢ Vector max R 0 = MAX(R 1, R 2) (V) l R 0. H is largest of R 1. H and R 2. H l R 0. L is largest of R 0. L and R 2. L l 17 Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
VIT_MAX – Compare and Select ¢ R 0 = VIT_MAX(R 1, R 2); R 1 = 0 x 23000002 l R 2 = 0 x 70000001 l R 2. H and R 1. L are largest l R 0 = 0 x 70000002 l A 0. W = binary 10 indicating R 2. H and R 1. L was largest l 18 Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
Other neat vector operations ¢ Vector ABS R 2 = ABS R 1 (V); l absolute values of R 1. H and R 1. L stored in R 2 l ¢ Vector arithmetic shift l R 2 = R 1 >>> 3 (V) – 2 16 -bit shifts Vector multiply and accumulate ¢ Vector Negate -- etc ¢ 19 Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
Worked examples 20 Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
Problem to solve ¢ ¢ ¢ Using the video capability on Blackfin Specialized instruction Examine and explain examples in detail (working program) for Q 9 format for final. l 21 Take something we have done in a laboratory and vectorize it for example Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
¢ Information taken from Analog Devices On-line Manuals with permission http: //www. analog. com/processors/resources/technical. Library/manuals/ ¢ Information furnished by Analog Devices is believed to be accurate and reliable. However, Analog Devices assumes no responsibility for its use or for any infringement of any patent other rights of any third party which may result from its use. No license is granted by implication or otherwise under any patent or patent right of Analog Devices. Copyright Analog Devices, Inc. All rights reserved. 22 Video , Copyright M. Smith, ECE, University of Calgary, Canada 10/20/2021
- Slides: 22