comparison mjpegdec.c @ 5734:0590ad246eca libavcodec

Add variables to prepare to the AMV decoder patch. Patch by Vladimir Voroshilov (voroshil - gmail - com)
author vitor
date Sat, 29 Sep 2007 12:52:56 +0000
parents 41103dc22ad5
children 810067f2c33d
comparison
equal deleted inserted replaced
5733:c2f88af57c16 5734:0590ad246eca
658 } 658 }
659 659
660 static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int ss, int se, int Ah, int Al){ 660 static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int ss, int se, int Ah, int Al){
661 int i, mb_x, mb_y; 661 int i, mb_x, mb_y;
662 int EOBRUN = 0; 662 int EOBRUN = 0;
663 uint8_t* data[MAX_COMPONENTS];
664 int linesize[MAX_COMPONENTS];
663 665
664 if(Ah) return 0; /* TODO decode refinement planes too */ 666 if(Ah) return 0; /* TODO decode refinement planes too */
667
668 for(i=0; i < nb_components; i++) {
669 int c = s->comp_index[i];
670 data[c] = s->picture.data[c];
671 linesize[c]=s->linesize[c];
672 }
673
665 for(mb_y = 0; mb_y < s->mb_height; mb_y++) { 674 for(mb_y = 0; mb_y < s->mb_height; mb_y++) {
666 for(mb_x = 0; mb_x < s->mb_width; mb_x++) { 675 for(mb_x = 0; mb_x < s->mb_width; mb_x++) {
667 if (s->restart_interval && !s->restart_count) 676 if (s->restart_interval && !s->restart_count)
668 s->restart_count = s->restart_interval; 677 s->restart_count = s->restart_interval;
669 678
689 s->quant_matrixes[ s->quant_index[c] ], ss, se, Ah, Al, &EOBRUN) < 0) { 698 s->quant_matrixes[ s->quant_index[c] ], ss, se, Ah, Al, &EOBRUN) < 0) {
690 av_log(s->avctx, AV_LOG_ERROR, "error y=%d x=%d\n", mb_y, mb_x); 699 av_log(s->avctx, AV_LOG_ERROR, "error y=%d x=%d\n", mb_y, mb_x);
691 return -1; 700 return -1;
692 } 701 }
693 // av_log(s->avctx, AV_LOG_DEBUG, "mb: %d %d processed\n", mb_y, mb_x); 702 // av_log(s->avctx, AV_LOG_DEBUG, "mb: %d %d processed\n", mb_y, mb_x);
694 ptr = s->picture.data[c] + 703 ptr = data[c] +
695 (((s->linesize[c] * (v * mb_y + y) * 8) + 704 (((linesize[c] * (v * mb_y + y) * 8) +
696 (h * mb_x + x) * 8) >> s->avctx->lowres); 705 (h * mb_x + x) * 8) >> s->avctx->lowres);
697 if (s->interlaced && s->bottom_field) 706 if (s->interlaced && s->bottom_field)
698 ptr += s->linesize[c] >> 1; 707 ptr += linesize[c] >> 1;
699 //av_log(NULL, AV_LOG_DEBUG, "%d %d %d %d %d %d %d %d \n", mb_x, mb_y, x, y, c, s->bottom_field, (v * mb_y + y) * 8, (h * mb_x + x) * 8); 708 //av_log(NULL, AV_LOG_DEBUG, "%d %d %d %d %d %d %d %d \n", mb_x, mb_y, x, y, c, s->bottom_field, (v * mb_y + y) * 8, (h * mb_x + x) * 8);
700 if(!s->progressive) 709 if(!s->progressive)
701 s->dsp.idct_put(ptr, s->linesize[c], s->block); 710 s->dsp.idct_put(ptr, linesize[c], s->block);
702 else 711 else
703 s->dsp.idct_add(ptr, s->linesize[c], s->block); 712 s->dsp.idct_add(ptr, linesize[c], s->block);
704 if (++x == h) { 713 if (++x == h) {
705 x = 0; 714 x = 0;
706 y++; 715 y++;
707 } 716 }
708 } 717 }