00 00 00 01 67 … (SPS)
00 00 00 01 65 … (IDR, I-frame)
00 00 00 01 45 … (IDR, I-frame)
00 00 00 01 25 … (IDR, I-frame)
00 00 00 01 61 … (p-frame)
00 00 00 01 41 … (p-frame)
00 00 00 01 21 … (p-frame)
Road to my grill day ...
00 00 00 01 67 … (SPS)
00 00 00 01 65 … (IDR, I-frame)
00 00 00 01 45 … (IDR, I-frame)
00 00 00 01 25 … (IDR, I-frame)
00 00 00 01 61 … (p-frame)
00 00 00 01 41 … (p-frame)
00 00 00 01 21 … (p-frame)
int *dev_a, *dev_b, *dev_c; // allocate the memory on the GPU HANDLE_ERROR( cudaMalloc( (void**)&dev_a, N * sizeof(int) ) ); HANDLE_ERROR( cudaMalloc( (void**)&dev_b, N * sizeof(int) ) ); HANDLE_ERROR( cudaMalloc( (void**)&dev_c, N * sizeof(int) ) );
// copy the arrays 'a' and 'b' to the GPU HANDLE_ERROR( cudaMemcpy( dev_a, a, N * sizeof(int), cudaMemcpyHostToDevice ) ); HANDLE_ERROR( cudaMemcpy( dev_b, b, N * sizeof(int), cudaMemcpyHostToDevice ) );
add<<<N,1>>>( dev_a, dev_b, dev_c ); // copy the array 'c' back from the GPU to the CPU HANDLE_ERROR( cudaMemcpy( c, dev_c, N * sizeof(int), cudaMemcpyDeviceToHost ) ); // free the memory allocated on the GPU cudaFree( dev_a ); cudaFree( dev_b ); cudaFree( dev_c );
__global__ void add( int *a, int *b, int *c ) { int tid = blockIdx.x; // handle the data at this index if (tid < N) c[tid] = a[tid] + b[tid]; }
cudaEvent_t start, stop;
cudaEventCreate(&start);
cudaEventCreate(&stop);
cudaEventRecord( start, 0 );
// do some work on the GPU
cudaEventRecord( stop, 0 );
cudaEventSynchronize( stop );
if (max < TEdge) EdgeHist[0]++; // no edge else // different direction if (m_nd > T0) EdgeHist[1]++; if (m_h > T1) EdgeHist[2]++; if (m_v > T1) EdgeHist[3]++; if (m_45 > T2) EdgeHist[4]++; if (m_135> T2) EdgeHist[5]++;
Let “$” mark the end of a term such that “hello” –> “hello$”. The permuterm entry for term “hello” are:
hello$, ello$h, llo$he, lo$hel, o$hell, $hello
In a wildcard query “m*n”, rotate the query so that the “*”appears at the end of the string. So “m*n” changes to “n$m*”. The look up this string in the permuterm index. Seeking “n$m*” leads the rotations of the terms “man” and “moron”.
When query X, look up on X$, query X*, look up on $X*
*X –> X$*, *X* – > X*, X*Y –> Y$X*
That means: rotate wildcard query to the right and use B-tree to lookup.
permuterm index need a lot of space.
--
In a k-gram index, the dictionary contains all k-grams that occur in any term in the vocabulary. For example, the 3-gram “etr”would point to terms sucha as: retrieval, petrify, metric, beetroot.
Use “$”as a special word boundary symbol. The 2-grams in text “the month” are: $t, th, he e$, $m, mo, on, nt, th, h$”
In wildcard query “mon*”, run as: $m AND mo AND on
The list lengths are m and n. If we go through the two posting lists simultaneously, it takes O(m+n) operations. With skip pointers:
In following figure, when we reach “8” and move it to the result list, the next pointers are “16” and “41” in upper/lower list. Rather than simple advancing the upper pointer, we found the skip list pointer “28” is also less than “41”. Hence we can follow the skip list pointer and advance the upper pointer to “28”, thus avoid to “19,23”.
Now how many steps to skip? suggestion is sqrt(p), where p is the posting list length. The algorithm is:
while p1 != NULL && p2 != NULLIn general query (aaa AND bbb AND ccc), we should start with the smallest document frequency, then keep cutting further.
do if docID(p1) == docID(p2)
then add docID(p1) to answer
else if docID(p1) < docID(p2)
then p1 = next(p1); p2 = next(p2);
BMP -> YUV 420Y/U/V components of an image, which use fixed sampling factor 2x2 for Y (luminance), and 1x1 for U/V (chrominance). Using this sampling scheme, each pixel will only require 12 bit to record the color (2 pixels = (4Y + 1U + 1V)*4 = 24 bit, 1 pixel = 12 bit).
YUV420 sampling. Using one 16x16 mcu, and six 8x8 DU: Y0,Y1,Y2,Y3,U,V
DCT to every DU
Quantize DU using table, zigzag scan
Huffman coding and get bits
Write bits to file
for(i = 0; i <>
The offset between the two areas has 1/4 pixel resolution for the luma component, 1/8 pixel resolution for choma component. In following figure, A,B,C… are regular pixels and b,h,m… are half pixle. The half pixle can be calculated with 6 weighted filter, the weight is (1/32, –5/32, 5/8, 5/8, –5/32, 1/32). To get ‘b’:
b = round ((E – 5F + 20G + 20H –5I + J)/32).
We can get ‘h’ from A,C,G,M,R and T. Then ‘j’ can be calculated from cc, dd, h, m, ee, and ff.
After 1/2 subpixel is calculated, we can get 1/4 subpixle with interpolation. In following figure, a,c,i,k,d,f,n,q are from interpolation. For instance:
a = round((G + b) / 2)
The other 1/4 sub-pixel (p, r…) can be calculated from diagonal pixels. For instance, e is from b and h.
1/8 sub-pixel is required in choma motion vector component. It also uses linear interpolation.
a=round(( (8-dx)*(8-dy)*A + (8-dy)*B + (8-dx)*dy*C + dx*dy*D) / 64)