[FFmpeg-devel] [PATCH] avcodec/h264: Partially decode and display single fields try #2

Michael Niedermayer michaelni at gmx.at
Wed Jan 21 01:13:07 CET 2015


On Tue, Jan 20, 2015 at 09:51:25PM +0000, Kieran Kunhya wrote:
> > +                for(p=0; p<3; p++) {
> > +                    int h = f->height;
> > +                    int w = f->width;
> > +                    if (p) {
> > +                        w >>= h_chroma_shift;
> > +                        h >>= v_chroma_shift;
> > +                    }
> > +                    for(y=field; y<h && (y^1)<h; y+=2) {
> > +                        memcpy(&f->data[p][ (y^1)*f->linesize[p] ],
> > +                            &f->data[p][ y*f->linesize[p] ], w);
> > +                    }
> 
> Can this not be written with a standard function?

yes, its overall 3 lines shorter as well
ive locally changed it to this:

+                for (p = 0; p<4; p++) {
+                    dst_data[p] = f->data[p] + (field^1)*f->linesize[p];
+                    src_data[p] = f->data[p] +  field   *f->linesize[p];
+                    linesizes[p] = 2*f->linesize[p];
+                }
+
+                av_image_copy(dst_data, linesizes, src_data, linesizes,
+                              f->format, f->width, f->height>>1)

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150121/df8b6699/attachment.asc>


More information about the ffmpeg-devel mailing list