Skip to content

Decode with offset is broken #21

@ajbadaj

Description

@ajbadaj

In this section:

fixed (byte* P = &encoded[offset])
{
int success = native.DecodeAsYUV(decoder, ref P[offset], count, noDelay, ref state_, ref yuv);

There is both:
byte* P = &encoded[offset]

and then using that below:
native.DecodeAsYUV(decoder, ref P[offset], ...

Causing a sort of double offset.

This means if you have an array that is needs to offset, you're forced to do a copy to avoid using Decode with an offset. For instance if I have a byte array of size 800, and the first 8 bytes are some other part of the stream, I have to slice and copy from 8 to length - 8 to pass into decode to avoid this issue, because effectively decode will try to work with bytes 16 to length + 8 causing the encoder to fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions