[FFmpeg-devel] [PATCH] img2enc: remove nonsense broken code

Michael Niedermayer michaelni at gmx.at
Tue Nov 6 00:38:18 CET 2012


On Mon, Nov 05, 2012 at 08:15:36PM +0000, Paul B Mahol wrote:
> split_planes: this is awfull hack and if it is ever triggered it can
> not work correctly for almost all image format and may cause invalid reads.
> 
> jp2 hack: nothing use this and this is not right place for it.
> It also does not work reliably (it use filename to guess codec).

[...]

>  
> -    if(img->split_planes){
> -        int ysize = codec->width * codec->height;
> -        avio_write(pb[0], pkt->data        , ysize);
> -        avio_write(pb[1], pkt->data + ysize, (pkt->size - ysize)/2);
> -        avio_write(pb[2], pkt->data + ysize +(pkt->size - ysize)/2, (pkt->size - ysize)/2);
> -        avio_close(pb[1]);
> -        avio_close(pb[2]);
> -    }else{
> -        if(ff_guess_image2_codec(s->filename) == AV_CODEC_ID_JPEG2000){
> -            AVStream *st = s->streams[0];
> -            if(st->codec->extradata_size > 8 &&
> -               AV_RL32(st->codec->extradata+4) == MKTAG('j','p','2','h')){
> -                if(pkt->size < 8 || AV_RL32(pkt->data+4) != MKTAG('j','p','2','c'))
> -                    goto error;
> -                avio_wb32(pb[0], 12);
> -                ffio_wfourcc(pb[0], "jP  ");
> -                avio_wb32(pb[0], 0x0D0A870A); // signature
> -                avio_wb32(pb[0], 20);
> -                ffio_wfourcc(pb[0], "ftyp");
> -                ffio_wfourcc(pb[0], "jp2 ");
> -                avio_wb32(pb[0], 0);
> -                ffio_wfourcc(pb[0], "jp2 ");
> -                avio_write(pb[0], st->codec->extradata, st->codec->extradata_size);
> -            }else if(pkt->size >= 8 && AV_RB32(pkt->data) == 0xFF4FFF51){
> -                //jpeg2000 codestream
> -            }else if(pkt->size < 8 ||
> -                     (!st->codec->extradata_size &&
> -                      AV_RL32(pkt->data+4) != MKTAG('j','P',' ',' '))){ // signature
> -            error:
> -                av_log(s, AV_LOG_ERROR, "malformed JPEG 2000 codestream %X\n", AV_RB32(pkt->data));
> -                return -1;

Removing this likely breaks jpeg2000 support

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121106/ece0f49b/attachment.asc>


More information about the ffmpeg-devel mailing list