Saturday, November 7, 2009

reading frame data into ppm

using http://web.me.com/dhoerl/Home/Tech_Blog/Entries/2009/1/22_Revised_avcodec_sample.c.html and some help from pv and http://facweb.iitkgp.ernet.in/~pds/notes/array.html#arrayandpointer got through to reading frame data and understanding how the AVFrame->data is to be traversed for pixel data.

for each frame
for(y=0; y<height; y++) {                                     
  for (zz=0;zz<width;++zz) {                                  
    red   = *(pFrame->data[0]+y*pFrame->linesize[0]+zz*3+0));
    green = *(pFrame->data[0]+y*pFrame->linesize[0]+zz*3+1));
    blue  = *(pFrame->data[0]+y*pFrame->linesize[0]+zz*3+2));
    alpha = *(pFrame->data[0]+y*pFrame->linesize[0]+zz*3+2));
  } 
} 

1 comment:

Unknown said...

makes obvious sense! i guess must've been the next combination u tried, right?

IEEE Transactions on Parallel and Distributed Systems : latest TOC