[FFmpeg-devel] [PATCH] swscale: add unscaled copy from yuv420p10 to p010

Michael Niedermayer michael at niedermayer.cc
Thu Sep 1 21:01:31 EEST 2016


On Thu, Sep 01, 2016 at 06:44:56PM +0200, Timo Rothenpieler wrote:
> On 9/1/2016 6:20 PM, Michael Niedermayer wrote:
> > On Thu, Sep 01, 2016 at 05:23:04PM +0200, Timo Rothenpieler wrote:
> >> ---
> >>  libswscale/swscale_unscaled.c | 39 +++++++++++++++++++++++++++++++++++++++
> >>  1 file changed, 39 insertions(+)
> >>
> >> diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
> >> index b231abe..51768fa 100644
> >> --- a/libswscale/swscale_unscaled.c
> >> +++ b/libswscale/swscale_unscaled.c
> >> @@ -197,6 +197,40 @@ static int nv12ToPlanarWrapper(SwsContext *c, const uint8_t *src[],
> >>      return srcSliceH;
> >>  }
> >>  
> >> +static int planarToP010Wrapper(SwsContext *c, const uint8_t *src8[],
> >> +                               int srcStride[], int srcSliceY,
> >> +                               int srcSliceH, uint8_t *dstParam8[],
> >> +                               int dstStride[])
> >> +{
> >> +    uint16_t *src[] = {
> >> +        (uint16_t*)(src8[0] + srcStride[0] * srcSliceY),
> >> +        (uint16_t*)(src8[1] + srcStride[1] * srcSliceY),
> >> +        (uint16_t*)(src8[2] + srcStride[2] * srcSliceY)
> >> +    };
> >> +    uint16_t *dstY = (uint16_t*)(dstParam8[0] + dstStride[0] * srcSliceY);
> >> +    uint16_t *dstUV = (uint16_t*)(dstParam8[1] + dstStride[1] * srcSliceY / 2);
> >> +    int x, y;
> >> +
> >> +    for (y = srcSliceY; y < srcSliceY + srcSliceH; y++) {
> >> +        if (!(y & 1)) {
> >> +            for (x = 0; x < c->srcW / 2; x++) {
> >> +                dstUV[x*2  ] = src[1][x] << 6;
> >> +                dstUV[x*2+1] = src[2][x] << 6;
> >> +            }
> >> +            src[1] += srcStride[1] / 2;
> >> +            src[2] += srcStride[2] / 2;
> >> +            dstUV += dstStride[1] / 2;
> >> +        }
> >> +        for (x = 0; x < c->srcW; x++) {
> >> +            dstY[x] = src[0][x] << 6;
> >> +        }
> >> +        src[0] += srcStride[0] / 2;
> >> +        dstY += dstStride[0] / 2;
> >> +    }
> >> +
> >> +    return srcSliceH;
> >> +}
> > 
> > I think some check for strides to be a multiple of 2 should be added
> > unless thats already checked somewhere
> > LGTM otherwise
> 
> Is there really a way for them to not be a multiple of 2 with a 10bit
> format?

is there some code that stops a user from passing such linesizes ?


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160901/84b31bc9/attachment.sig>


More information about the ffmpeg-devel mailing list