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

Paul B Mahol onemda at gmail.com
Tue Nov 6 00:43:40 CET 2012


On 11/5/12, Michael Niedermayer <michaelni at gmx.at> wrote:
> 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

No, it does not break jpeg2000 support, nothing sets extradata in j2k* or
libopenjpeg* and that should really and obviously be part of lavc and not lavf.
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Democracy is the form of government in which you can choose your dictator
>


.


More information about the ffmpeg-devel mailing list