On Mon, Dec 05, 2011 at 04:37:52PM +0200, KJT TOD wrote:
> --- a/libavcodec/mpegvideo.c
> +++ b/libavcodec/mpegvideo.c
> @@ -66,44 +66,66 @@ static void dct_unquantize_h263_inter_c(MpegEncContext *s,
>
>
> -static const uint8_t ff_default_chroma_qscale_table[32]={
> -// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
> 24 25 26 27 28 29 30 31
> - 0, 1, 2, 3, 4, 5, 6, 7, 8,
> 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
> +static const uint8_t ff_default_chroma_qscale_table[32] = {
> +// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
> +// 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
> + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,
> + 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
> };
space after comma
> @@ -123,34 +145,37 @@ const enum PixelFormat ff_hwaccel_pixfmt_list_420[] = {
>
> -const uint8_t *avpriv_mpv_find_start_code(const uint8_t * restrict p, const
> uint8_t *end, uint32_t * restrict state){
> +const uint8_t *avpriv_mpv_find_start_code(const uint8_t *restrict p,
> + const uint8_t *end,
> + uint32_t * restrict state)
> +{
inconsistent * placement
> - while(p<end){
> - if (p[-1] > 1 ) p+= 3;
> - else if(p[-2] ) p+= 2;
> - else if(p[-3]|(p[-1]-1)) p++;
> - else{
> + while (p < end) {
> + if (p[-1] > 1 ) p += 3;
> + else if (p[-2] ) p += 2;
> + else if (p[-3]|(p[-1]-1)) p++;
> + else {
I'd break lines here and add some spaces around operators.
> @@ -210,11 +236,12 @@ void ff_copy_picture(Picture *dst, Picture *src){
> static void free_frame_buffer(MpegEncContext *s, Picture *pic)
> {
> /* Windows Media Image codecs allocate internal buffers with different
> - dimensions; ignore user defined callbacks for these */
> + * dimensions; ignore user defined callbacks for these
> + */
This was - IMO - better before.
> @@ -291,49 +325,69 @@ int ff_alloc_picture(MpegEncContext *s, Picture *pic,
> int shared){
> - memmove(s->prev_pict_types+1, s->prev_pict_types,
> PREV_PICT_TYPES_BUFFER_SIZE-1);
> + memmove(s->prev_pict_types + 1, s->prev_pict_types,
> + PREV_PICT_TYPES_BUFFER_SIZE-1);
space around -
> - FF_ALLOCZ_OR_GOTO(s->avctx, s->edge_emu_buffer, (s->width+64)*2*21*2,
> fail); //(width + edge + align)*interlaced*MBsize*tolerance
> + FF_ALLOCZ_OR_GOTO(s->avctx, s->edge_emu_buffer,
> + (s->width + 64) * 2 * 21 * 2, fail); // (width +
> edge + align)*interlaced*MBsize*tolerance
space around operators
> @@ -500,46 +572,56 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
> const AVCodecContext *src
>
> memcpy(s->picture, s1->picture, s1->picture_count * sizeof(Picture));
> - memcpy(&s->last_picture, &s1->last_picture, (char*)&s1->last_picture_ptr
> - (char*)&s1->last_picture);
> + memcpy(&s->last_picture, &s1->last_picture,
> + (char *) &s1->last_picture_ptr - (char *) &s1->last_picture);
stray double space in the cast expression
> - //MPEG4 timing info
> - memcpy(&s->time_increment_bits, &s1->time_increment_bits,
> (char*)&s1->shape - (char*)&s1->time_increment_bits);
> + // MPEG4 timing info
> + memcpy(&s->time_increment_bits, &s1->time_increment_bits,
> + (char *) &s1->shape - (char *) &s1->time_increment_bits);
ditto
> - //MPEG2/interlacing info
> - memcpy(&s->progressive_sequence, &s1->progressive_sequence,
> (char*)&s1->rtp_mode - (char*)&s1->progressive_sequence);
> + // MPEG2/interlacing info
> + memcpy(&s->progressive_sequence, &s1->progressive_sequence,
> + (char *) &s1->rtp_mode - (char *) &s1->progressive_sequence);
again
> - for(y=0; y<s->mb_height; y++){
> - for(x=0; x<s->mb_width; x++){
> - s->mb_index2xy[ x + y*s->mb_width ] = x + y*s->mb_stride;
> + for (y = 0; y < s->mb_height; y++) {
> + for (x = 0; x < s->mb_width; x++) {
> + s->mb_index2xy[ x + y * s->mb_width ] = x + y * s->mb_stride;
> }
> }
please drop these unneeded {}
> - s->mb_index2xy[ s->mb_height*s->mb_width ] =
> (s->mb_height-1)*s->mb_stride + s->mb_width; //FIXME really needed?
> + s->mb_index2xy[s->mb_height * s->mb_width] = (s->mb_height-1) * s->
> + mb_stride + s->mb_width; // FIXME really needed?
space around -
> if (s->encoding) {
> /* Allocate MV tables */
> - FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base ,
> mv_table_size * 2 * sizeof(int16_t), fail)
> - FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base ,
> mv_table_size * 2 * sizeof(int16_t), fail)
> - FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base ,
> mv_table_size * 2 * sizeof(int16_t), fail)
> - FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base ,
> mv_table_size * 2 * sizeof(int16_t), fail)
> - FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base ,
> mv_table_size * 2 * sizeof(int16_t), fail)
> - FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base ,
> mv_table_size * 2 * sizeof(int16_t), fail)
> - s->p_mv_table = s->p_mv_table_base +
> s->mb_stride + 1;
> - s->b_forw_mv_table = s->b_forw_mv_table_base +
> s->mb_stride + 1;
> - s->b_back_mv_table = s->b_back_mv_table_base +
> s->mb_stride + 1;
> - s->b_bidir_forw_mv_table= s->b_bidir_forw_mv_table_base +
> s->mb_stride + 1;
> - s->b_bidir_back_mv_table= s->b_bidir_back_mv_table_base +
> s->mb_stride + 1;
> - s->b_direct_mv_table = s->b_direct_mv_table_base +
> s->mb_stride + 1;
> -
> - if(s->msmpeg4_version){
> - FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_stats,
> 2*2*(MAX_LEVEL+1)*(MAX_RUN+1)*2*sizeof(int), fail);
> + FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base ,
> + mv_table_size * 2 * sizeof(int16_t), fail)
> + FF_ALLOCZ_OR_GOTO(s->avctx, s->b_for w_mv_table_base ,
> + mv_table_size * 2 * sizeof(int16_t), fail)
> + FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base ,
> + mv_table_size * 2 * sizeof(int16_t), fail)
> + FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_for w_mv_table_base,
> + mv_table_size * 2 * sizeof(int16_t), fail)
> + FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base ,
> + mv_table_size * 2 * sizeof(int16_t), fail)
> + FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base ,
> + mv_table_size * 2 * sizeof(int16_t), fail)
> + s->p_mv_table = s->p_mv_table_base +
> + s->mb_stride + 1;
> + s->b_for w_mv_table = s->b_for w_mv_table_base +
> + s->mb_stride + 1;
> + s->b_back_mv_table = s->b_back_mv_table_base +
> + s->mb_stride + 1;
> + s->b_bidir_for w_mv_table = s->b_bidir_for w_mv_table_base +
> + s->mb_stride + 1;
> + s->b_bidir_back_mv_table = s->b_bidir_back_mv_table_base +
> + s->mb_stride + 1;
> + s->b_direct_mv_table = s->b_direct_mv_table_base +
> + s->mb_stride + 1;
> +
> + if (s->msmpeg4_version) {
> + FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_stats,
> + 2 * 2 * (MAX_LEVEL + 1) *
> + (MAX_RUN + 1) * 2 * sizeof(int), fail);
> }
Can you spot the subtle typo in here yourself?
Apparently you did not compile the code; you must do this, it's far too
easy to break everything with small typos.
Also, vertically align the two addition arguments in the assignments.
> @@ -750,39 +884,47 @@ av_cold int MPV_common_init(MpegEncContext *s)
>
> - if((s->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) ||
> (s->avctx->debug_mv)){
> + if ((s->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) ||
space around |
> - if (s->encoding || (HAVE_THREADS &&
> s->avctx->active_thread_type&FF_THREAD_SLICE)) {
> + if (s->encoding || (HAVE_THREADS &&
> + s->avctx->active_thread_type&FF_THREAD_SLICE)) {
Indentation is off.
> + s->thread_context[i]->start_mb_y = (s->mb_height * (i ) +
> + s->avctx->thread_count / 2) / s->avctx->thread_count;
> + s->thread_context[i]->end_mb_y = (s->mb_height * (i + 1) +
> + s->avctx->thread_count / 2) / s->avctx->thread_count;
same
> + } else {
> + if (init_duplicate_context(s, s) < 0) goto fail;
Break the line please.
> + s->start_mb_y = 0;
> + s->end_mb_y = s->mb_height;
align the =
> @@ -791,45 +933,46 @@ av_cold int MPV_common_init(MpegEncContext *s)
>
> -/* init common structure for both encoder and decoder */
> +/* init common structure for both encoder and decoder */
stray change
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel