[FFmpeg-devel] [PATCH] Add DPX decoder rev-19

Jimmy Christensen jimmy
Thu Jun 4 14:55:08 CEST 2009


On 2009-06-04 13:31, Michael Niedermayer wrote:
> On Thu, Jun 04, 2009 at 07:59:04AM +0200, Jimmy Christensen wrote:
> [...]
>> +static int decode_frame(AVCodecContext *avctx,
>> +                        void *data,
>> +                        int *data_size,
>> +                        AVPacket *avpkt)
>> +{
>> +    const uint8_t *buf          = avpkt->data;
>> +    int buf_size                = avpkt->size;
>> +    DPXContext *const s = avctx->priv_data;
>> +    AVFrame *picture  = data;
>> +    AVFrame *const p =&s->picture;
>> +    uint8_t *ptr;
>> +
>> +    int magic_num, offset;
>> +    int x, y;
>> +    int w, h, stride, bpc;
>> +
>> +    unsigned int rgbBuffer;
>
>> +    int endian = 0;
>
> redundant init
>

Removed.

>
>> +
>> +    magic_num = AV_RB32(buf);
>> +    buf += 4;
>> +
>> +    /* Check if the files "magic number" is "SDPX" which means it uses
>> +     * big-endian or XPDS which is for little-endian files */
>> +    if (magic_num == AV_RL32("SDPX"))
>> +        endian = 0;
>> +    else if (magic_num == AV_RB32("SDPX"))
>> +        endian = 1;
>> +    else {
>> +        av_log(avctx, AV_LOG_ERROR, "DPX marker not found");
>> +        return -1;
>> +    }
>> +
>> +    offset = read32(&buf, endian);
>> +    // Need to end in 0x304 offset from start of file
>> +    buf = avpkt->data + 0x304;
>> +    w = read32(&buf, endian);
>> +    h = read32(&buf, endian);
>> +
>> +    buf = avpkt->data + 0x322;
>
>> +    bpc = AV_RB16(buf);
>
> what is bpc? i think this is not a good name for a variable
>

Bits per color. Renamed it to bitsPerColor.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpegDPX-rev19.diff
Type: text/x-patch
Size: 8973 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090604/ffdf2cb4/attachment.bin>



More information about the ffmpeg-devel mailing list