comparison dv.c @ 7538:06c291f42d5f libavcodec

Fixing the units in DV50 tables (both coordinates are supposed to be in units of 8 pixels) and simplifying the calculations of y_ptr and c_offset.
author romansh
date Mon, 11 Aug 2008 10:14:46 +0000
parents 910087e97750
children 1afa1171b7b2
comparison
equal deleted inserted replaced
7537:4801922896e7 7538:06c291f42d5f
468 mb = mb_data; 468 mb = mb_data;
469 for(mb_index = 0; mb_index < 5; mb_index++) { 469 for(mb_index = 0; mb_index < 5; mb_index++) {
470 v = *mb_pos_ptr++; 470 v = *mb_pos_ptr++;
471 mb_x = v & 0xff; 471 mb_x = v & 0xff;
472 mb_y = v >> 8; 472 mb_y = v >> 8;
473 if (s->sys->pix_fmt == PIX_FMT_YUV422P) { 473 y_ptr = s->picture.data[0] + ((mb_y * s->picture.linesize[0] + mb_x)<<log2_blocksize);
474 y_ptr = s->picture.data[0] + ((mb_y * s->picture.linesize[0] + (mb_x>>1))<<log2_blocksize); 474 c_offset = (((mb_y>>(s->sys->pix_fmt == PIX_FMT_YUV420P)) * s->picture.linesize[1] +
475 c_offset = ((mb_y * s->picture.linesize[1] + (mb_x >> 2))<<log2_blocksize); 475 (mb_x>>((s->sys->pix_fmt == PIX_FMT_YUV411P)?2:1)))<<log2_blocksize);
476 } else { /* 4:1:1 or 4:2:0 */ 476
477 y_ptr = s->picture.data[0] + ((mb_y * s->picture.linesize[0] + mb_x)<<log2_blocksize);
478 if (s->sys->pix_fmt == PIX_FMT_YUV411P)
479 c_offset = ((mb_y * s->picture.linesize[1] + (mb_x >> 2))<<log2_blocksize);
480 else /* 4:2:0 */
481 c_offset = (((mb_y >> 1) * s->picture.linesize[1] + (mb_x >> 1))<<log2_blocksize);
482 }
483 for(j = 0;j < 6; j++) { 477 for(j = 0;j < 6; j++) {
484 idct_put = s->idct_put[mb->dct_mode && log2_blocksize==3]; 478 idct_put = s->idct_put[mb->dct_mode && log2_blocksize==3];
485 if (s->sys->pix_fmt == PIX_FMT_YUV422P) { /* 4:2:2 */ 479 if (s->sys->pix_fmt == PIX_FMT_YUV422P) { /* 4:2:2 */
486 if (j == 0 || j == 2) { 480 if (j == 0 || j == 2) {
487 /* Y0 Y1 */ 481 /* Y0 Y1 */
836 pb = &pbs[0]; 830 pb = &pbs[0];
837 for(mb_index = 0; mb_index < 5; mb_index++) { 831 for(mb_index = 0; mb_index < 5; mb_index++) {
838 v = *mb_pos_ptr++; 832 v = *mb_pos_ptr++;
839 mb_x = v & 0xff; 833 mb_x = v & 0xff;
840 mb_y = v >> 8; 834 mb_y = v >> 8;
841 if (s->sys->pix_fmt == PIX_FMT_YUV422P) { 835 y_ptr = s->picture.data[0] + ((mb_y * s->picture.linesize[0] + mb_x)<<3);
842 y_ptr = s->picture.data[0] + (mb_y * s->picture.linesize[0] * 8) + (mb_x * 4); 836 c_offset = (((mb_y>>(s->sys->pix_fmt == PIX_FMT_YUV420P)) * s->picture.linesize[1] +
843 } else { /* 4:1:1 */ 837 (mb_x>>((s->sys->pix_fmt == PIX_FMT_YUV411P)?2:1)))<<3);
844 y_ptr = s->picture.data[0] + (mb_y * s->picture.linesize[0] * 8) + (mb_x * 8);
845 }
846 if (s->sys->pix_fmt == PIX_FMT_YUV420P) {
847 c_offset = (((mb_y >> 1) * s->picture.linesize[1] * 8) + ((mb_x >> 1) * 8));
848 } else { /* 4:2:2 or 4:1:1 */
849 c_offset = ((mb_y * s->picture.linesize[1] * 8) + ((mb_x >> 2) * 8));
850 }
851 do_edge_wrap = 0; 838 do_edge_wrap = 0;
852 qnos[mb_index] = 15; /* No quantization */ 839 qnos[mb_index] = 15; /* No quantization */
853 ptr = dif + mb_index*80 + 4; 840 ptr = dif + mb_index*80 + 4;
854 for(j = 0;j < 6; j++) { 841 for(j = 0;j < 6; j++) {
855 int dummy = 0; 842 int dummy = 0;