[FFmpeg-devel] GSoC VQA v3 vprz decoding algo and the CBFZ algo , please check

The Deep Explorer thedeepexplorer
Mon Apr 13 09:53:26 CEST 2009


Hi ,
    As per the document the vprz should be decoded as follows :

 As for the VPRZ chunks, these are just VPTR chunks compressed with
  the standard Format80 algorithm.

So , first step is decompress using format80 , now after decompressing
I need to store it into a temporary storage
which I will pass onto the vptr decoding for further decoding as per vptr codes.

The code is attached below :

   if(vprz_chunk != -1) {
        av_log(s->avctx,AV_LOG_ERROR," VPRZ chunk found \n");
        chunk_size = AV_RB32(&s->buf[vprz_chunk + 4]);
        vprz_chunk += CHUNK_PREAMBLE_SIZE;
        temp_buffer = av_malloc(s->decode_buffer_size);
        // assuming that the temp buffer cant be more than the decode buffer
        decode_format80(&s->buf[vprz_chunk], chunk_size,
             temp_buffer, s->decode_buffer_size, 1, 0);

      // since each vprz is a vptr will have to call the following
      // getting over the vptr tags...and this time sending the decode buffer
        chunk_size = AV_RB32(&temp_buffer[4]);
        vqa_decode_vptr(&temp_buffer[CHUNK_PREAMBLE_SIZE], chunk_size,
            s->decode_buffer, s->decode_buffer_size);

        av_free(temp_buffer);
    }

THE CBFZ algo ===>as per the V3

    /* decompress the full codebook chunk */
    if (cbfz_chunk != -1) {

        chunk_size = AV_RB32(&s->buf[cbfz_chunk + 4]);
        cbfz_chunk += CHUNK_PREAMBLE_SIZE;
        av_log(s->avctx, AV_LOG_ERROR, "  Chunk Size %d ",chunk_size);
        /*
          i) for v1,v2
         ii) chunk size is less than 64KB
         iii) the first byte is non null
             then we still use the old format80
        */
        if(s->vqa_version != 3 || chunk_size<64000 ||
AV_RB8(&s->buf[cbfz_chunk])){
        decode_format80(&s->buf[cbfz_chunk], chunk_size,
            s->codebook, s->codebook_size, 0, 0);
        }
        else{
            decode_format80(&s->buf[cbfz_chunk], chunk_size,
               s->codebook, s->codebook_size, 0, 1);
        }

    }


Please let me know if the above is correct or not ....

I still need the vector indexing algorithm for filling the frames
...then I think I will have the rough first cut
to start a little bit of testing....


Thanks
-tde



More information about the ffmpeg-devel mailing list