comparison mjpegdec.c @ 10438:710e226783f0 libavcodec

Flip (M)JPEG frames encoded by Intel JPEG library. Fixes issues 1464 and 1468.
author cehoyos
date Mon, 19 Oct 2009 15:41:28 +0000
parents 9d31db7bec63
children 3e404d2520a7
comparison
equal deleted inserted replaced
10437:00bd0c4c1489 10438:710e226783f0
103 if (avctx->extradata[9] == 6) { /* quicktime icefloe 019 */ 103 if (avctx->extradata[9] == 6) { /* quicktime icefloe 019 */
104 s->interlace_polarity = 1; /* bottom field first */ 104 s->interlace_polarity = 1; /* bottom field first */
105 av_log(avctx, AV_LOG_DEBUG, "mjpeg bottom field first\n"); 105 av_log(avctx, AV_LOG_DEBUG, "mjpeg bottom field first\n");
106 } 106 }
107 } 107 }
108 if (avctx->codec->id == CODEC_ID_AMV)
109 s->flipped = 1;
108 110
109 return 0; 111 return 0;
110 } 112 }
111 113
112 114
771 for(i=0; i < nb_components; i++) { 773 for(i=0; i < nb_components; i++) {
772 int c = s->comp_index[i]; 774 int c = s->comp_index[i];
773 data[c] = s->picture.data[c]; 775 data[c] = s->picture.data[c];
774 linesize[c]=s->linesize[c]; 776 linesize[c]=s->linesize[c];
775 s->coefs_finished[c] |= 1; 777 s->coefs_finished[c] |= 1;
776 if(s->avctx->codec->id==CODEC_ID_AMV) { 778 if(s->flipped) {
777 //picture should be flipped upside-down for this codec 779 //picture should be flipped upside-down for this codec
778 assert(!(s->avctx->flags & CODEC_FLAG_EMU_EDGE)); 780 assert(!(s->avctx->flags & CODEC_FLAG_EMU_EDGE));
779 data[c] += (linesize[c] * (s->v_scount[i] * (8 * s->mb_height -((s->height/s->v_max)&7)) - 1 )); 781 data[c] += (linesize[c] * (s->v_scount[i] * (8 * s->mb_height -((s->height/s->v_max)&7)) - 1 ));
780 linesize[c] *= -1; 782 linesize[c] *= -1;
781 } 783 }
1173 // if (s->first_picture) 1175 // if (s->first_picture)
1174 // printf("mjpeg: workarounding buggy AVID\n"); 1176 // printf("mjpeg: workarounding buggy AVID\n");
1175 } 1177 }
1176 else if(!strcmp(cbuf, "CS=ITU601")){ 1178 else if(!strcmp(cbuf, "CS=ITU601")){
1177 s->cs_itu601= 1; 1179 s->cs_itu601= 1;
1180 }
1181 else if(len > 20 && !strncmp(cbuf, "Intel(R) JPEG Library", 21)){
1182 s->flipped = 1;
1178 } 1183 }
1179 1184
1180 av_free(cbuf); 1185 av_free(cbuf);
1181 } 1186 }
1182 } 1187 }