c - how to assign the address pointed by a pointer to another local pointer -


i'm doing video processing project, , got struck in assigning block address sending dct function.

the following line not taking correct assignment address right hand variable pointing to.

temp = (unsigned short *)((unsigned short *)(p_vqi->luma + j) + l); 

so temp not contain correct address pointed p_vqi->luma variable, j , i incremented 16 times on each step maximum of 144 , 176 respectively.

the thing gets people pointer math doesn't add 1 byte @ time, adds 1 sizeof(thing pointed to) @ time, you're going skip on j lumas, big is, i unsigned shorts, big on architecture. usually, it's easier , more portable when working fixed formats work straight in bytes, like:

uint8_t* temp = (uint8_t*)p_vqi->luma; temp += j*16 + i; 

Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

c# - how to write client side events functions for the combobox items -

ssh client with paramiko (python) -