On Thu, Jan 12, 2012 at 06:29:47AM +0100, Luca Barbato wrote:
> From: Chris Berov <[email protected]>
>
> Signed-off-by: Luca Barbato <[email protected]>
> ---
> libavcodec/asv1.c | 459
> +++++++++++++++++++++++++++++++----------------------
> 1 files changed, 269 insertions(+), 190 deletions(-)
Same as the other patch - did you check the resulting file?
This seems to have quite a number of issues still.
> --- a/libavcodec/asv1.c
> +++ b/libavcodec/asv1.c
> @@ -55,7 +55,7 @@ typedef struct ASV1Context{
> unsigned int bitstream_buffer_size;
> } ASV1Context;
>
> -static const uint8_t scantab[64]={
> +static const uint8_t scantab[64] = {
> 0x00,0x08,0x01,0x09,0x10,0x18,0x11,0x19,
> 0x02,0x0A,0x03,0x0B,0x12,0x1A,0x13,0x1B,
> 0x04,0x0C,0x05,0x0D,0x20,0x28,0x21,0x29,
This should have spaces after comma; same for the other tables.
> @@ -139,212 +140,279 @@ static av_cold void init_vlcs(ASV1Context *a){
>
> -static inline int asv2_get_level(GetBitContext *gb){
> - int code= get_vlc2(gb, asv2_level_vlc.table, ASV2_LEVEL_VLC_BITS, 1);
> +static inline int asv2_get_level(GetBitContext *gb)
> +{
> + int code = get_vlc2(gb, asv2_level_vlc.table, ASV2_LEVEL_VLC_BITS, 1);
>
> - if(code==31) return (int8_t)asv2_get_bits(gb, 8);
> - else return code - 31;
> + if (code == 31)
> + return (int8_t)asv2_get_bits(gb, 8);
This looks incorrect - why is the int return value cast to int8_t? The
function is supposed to return int ... - poor man's value clipping?
> - assert(i || ccp<8);
> - if(i) put_bits(&a->pb, ac_ccp_tab[ccp][1], ac_ccp_tab[ccp][0]);
> - else put_bits(&a->pb, dc_ccp_tab[ccp][1], dc_ccp_tab[ccp][0]);
> -
> + assert(i || ccp < 8);
> + if (i) put_bits(&a->pb, ac_ccp_tab[ccp][1], ac_ccp_tab[ccp][0]);
> + else put_bits(&a->pb, dc_ccp_tab[ccp][1], dc_ccp_tab[ccp][0]);
All the other lines were broken, so these should as well.
> - if(a->pb.buf_end - a->pb.buf - (put_bits_count(&a->pb)>>3) <
> 30*16*16*3/2/8){
> + if (a->pb.buf_end - a->pb.buf - (put_bits_count(&a->pb) >> 3) <
> + 30 * 16 * 16 * 3 / 2 / 8) {
Better to break before the < IMO.
> @@ -397,54 +466,56 @@ static int decode_frame(AVCodecContext *avctx,
> - av_fast_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size, buf_size
> + FF_INPUT_BUFFER_PADDING_SIZE);
> + av_fast_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size, buf_size
> +
> + FF_INPUT_BUFFER_PADDING_SIZE);
Break after the comma.
> - for(mb_y=0; mb_y<a->mb_height2; mb_y++){
> - for(mb_x=0; mb_x<a->mb_width2; mb_x++){
> - if( decode_mb(a, a->block) <0)
> + for (mb_y = 0; mb_y < a->mb_height2; mb_y++) {
> + for (mb_x = 0; mb_x < a->mb_width2; mb_x++) {
> + if ( decode_mb(a, a->block) < 0)
> return -1;
No space after (.
> - if(a->mb_width2 != a->mb_width){
> - mb_x= a->mb_width2;
> - for(mb_y=0; mb_y<a->mb_height2; mb_y++){
> - if( decode_mb(a, a->block) <0)
> + if (a->mb_width2 != a->mb_width) {
> + mb_x = a->mb_width2;
> + for (mb_y = 0; mb_y < a->mb_height2; mb_y++) {
> + if ( decode_mb(a, a->block) < 0)
> return -1;
ditto
> - for(mb_x=0; mb_x<a->mb_width; mb_x++){
> - if( decode_mb(a, a->block) <0)
> + for (mb_x =0; mb_x < a->mb_width; mb_x++) {
> + if( decode_mb(a, a->block) < 0)
> return -1;
again
> @@ -498,105 +571,111 @@ static int encode_frame(AVCodecContext *avctx,
> unsigned char *buf, int buf_size,
>
> a->mb_width = (avctx->width + 15) / 16;
> a->mb_height = (avctx->height + 15) / 16;
> - a->mb_width2 = (avctx->width + 0) / 16;
> - a->mb_height2 = (avctx->height + 0) / 16;
> + a->mb_width2 = (avctx->width + 0) / 16;
> + a->mb_height2 = (avctx->height + 0) / 16;
better right-align the numbers
> - a->intra_matrix[i]= 64*scale*ff_mpeg1_default_intra_matrix[index] /
> a->inv_qscale;
> + a->intra_matrix[i]= 64 * scale *
> ff_mpeg1_default_intra_matrix[index] /
> + a->inv_qscale;
space before =
> - p->qstride= a->mb_width;
> - p->qscale_table= av_malloc( p->qstride * a->mb_height);
> - p->quality= (32*scale + a->inv_qscale/2)/a->inv_qscale;
> + p->qstride = a->mb_width;
> + p->qscale_table = av_malloc( p->qstride * a->mb_height);
> + p->quality = (32 * scale + a->inv_qscale / 2) / a->inv_qscale;
align
no space after (
Better check the whole resulting file for spaces after (.
> - avctx->extradata= av_mallocz(8);
> - avctx->extradata_size=8;
> + avctx->extradata = av_mallocz(8);
> + avctx->extradata_size = 8;
align
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel