void image_draw_block(od_rgba16_image *_image,int _x,int _y, const unsigned char *_block,int _stride){ od_rgba16_pixel color; int i; int j; color[3]=(unsigned short)0xFFFFU; for(i=0;i<B_SZ;i++){ for(j=0;j<B_SZ;j++){ color[0]=color[1]=color[2]=_block[_stride*i+j]*0x101; od_rgba16_image_draw_point(_image,_x+j,_y+i,color); } } }
static void vp8_files_block(intra_stats_ctx *_ctx,const unsigned char *_data, int _stride,int _bi,int _bj,int _mode,const unsigned char *_pred){ int j; int i; unsigned char res[B_SZ*B_SZ]; image_draw_block(&_ctx->files_vp8.raw,B_SZ*_bi,B_SZ*_bj,_data,_stride); od_rgba16_image_draw_point(&_ctx->files_vp8.map,_bi,_bj,COLORS[_mode]); image_draw_block(&_ctx->files_vp8.pred,B_SZ*_bi,B_SZ*_bj,_pred,B_SZ); for(j=0;j<B_SZ;j++){ for(i=0;i<B_SZ;i++){ res[j*B_SZ+i]=abs(_data[_stride*i+j]-_pred[B_SZ*i+j]); } } image_draw_block(&_ctx->files_vp8.res,B_SZ*_bi,B_SZ*_bj,res,B_SZ); }
void image_data_files_block(image_data *_this,const unsigned char *_data, int _stride,int _bi,int _bj,image_files *_files){ int mode; od_coeff *p; int j; int i; od_coeff v; unsigned char buf[B_SZ*B_SZ]; mode=_this->mode[_bj*_this->nxblocks+_bi]; od_rgba16_image_draw_point(&_files->map,_bi,_bj,COLORS[mode]); p=&_this->pre[_this->pre_stride*(B_SZ*_bj+(3*B_SZ>>1))+B_SZ*_bi+(3*B_SZ>>1)]; for(j=0;j<B_SZ;j++){ for(i=0;i<B_SZ;i++){ v=(p[_this->pre_stride*j+i]+INPUT_SCALE*128+INPUT_SCALE/2)/INPUT_SCALE; buf[B_SZ*j+i]=OD_CLAMPI(0,v,255); } } image_draw_block(&_files->raw,B_SZ*_bi,B_SZ*_bj,buf,B_SZ); p=&_this->post[_this->post_stride*(B_SZ*_bj+(B_SZ>>1))+B_SZ*_bi+(B_SZ>>1)]; for(j=0;j<B_SZ;j++){ for(i=0;i<B_SZ;i++){ v=(p[_this->post_stride*j+i]+INPUT_SCALE*128+INPUT_SCALE/2)/INPUT_SCALE; buf[B_SZ*j+i]=OD_CLAMPI(0,v,255); } } image_draw_block(&_files->pred,B_SZ*_bi,B_SZ*_bj,buf,B_SZ); for(j=0;j<B_SZ;j++){ for(i=0;i<B_SZ;i++){ buf[B_SZ*j+i]=OD_CLAMPI(0,_data[_stride*j+i]-buf[B_SZ*j+i]+128,255); } } image_draw_block(&_files->res,B_SZ*_bi,B_SZ*_bj,buf,B_SZ); }