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

Michael Niedermayer michaelni at gmx.at
Tue Nov 6 00:59:04 CET 2012


On Mon, Nov 05, 2012 at 11:43:40PM +0000, Paul B Mahol wrote:
> 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.

extradata can be set by a demuxer as well though i do not know if
this was the usecase of the code.

I think it would be best if the author of this code could comment
(in CC)

Thanks

PS: commit was b4097b13d4f290664630df0c05acf4e62e64d5d3 (thanks ubitux)

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

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- 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/fdc23d7f/attachment.asc>


More information about the ffmpeg-devel mailing list