Le mar. 9 avr. 2019 à 15:31, Simon Brown <[email protected]> a écrit :
> On Tue, 9 Apr 2019 at 14:20, NDJORE BORIS <[email protected]> wrote: > >> Hello guys, >> >> I try to find pixels value for a given macroblock in a frame. >> What I did is the following : >> >> //for all macroblock in this frame >> for(int mby=0; y<mb_height;y++) >> { >> for(int mbx=0; x<mb_width;x++) >> { >> int xy = mby*mb_stride+mbx; >> //Now for this 16x16 macroblock >> for(int y=0; y<16;y++) >> { >> for(int x=0; x<16;x++) >> { >> //All pixels YUV value for this macroblock >> y = data[0][linesize[0]*y+x]; >> u = data[1][linesize[1]*(y/2)+x/2] >> v = data[2][linesize[2]*(y/2)+x/2] >> } >> } >> //Let's in an other macroblock >> } >> } >> The problem is that for all macroblocks, I have the same Y, u and v >> value. That's is true because I only use the same width and height for >> every macroblock. >> >> My question is to know how can I put difference in the above code to find >> pixels yuv value for each macroblock in this frame. >> I need your help, please. >> >> Regards >> >> Without having understood your code fully, you have two loops around the > outside, one for mby and one for mbx, yet they use y<mb_height and y++, > x<mb_width and x++. You then inside these loops have a loop for x and y > also comparing x and y and incrementing x and y. That can't be right! > > Your inner assignments should probably be: > y = data[0][linesize[0]*(mby*16)*y+(mbx*16 +x)] > etc. > > Regards, > Simon > Thank you simon. You probably right. The first loop is to obten all macroblock in the frame and the second is to optain each pixel in the macroblock, I thinked. But in what you gave if I do this for two different block, I think that I will obtain the same value for "y". Can you explain me how can I do to obtain different "y" value for each macroblock if I'm wrong , please? Regards > _______________________________________________ > Libav-user mailing list > [email protected] > https://ffmpeg.org/mailman/listinfo/libav-user > > To unsubscribe, visit link above, or email > [email protected] with subject "unsubscribe".
_______________________________________________ Libav-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/libav-user To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
