On Mon, Jan 16, 2012 at 11:11:42PM +0200, Donald wrote:
> [...]
Looks mostly good. Send a fresh patch with the changes I request below.
I will queue it tomorrow. I'm OK with you getting your GCI points for
sending that updated patch.
> --- a/libavcodec/error_resilience.c
> +++ b/libavcodec/error_resilience.c
> @@ -152,81 +178,84 @@ static void filter181(int16_t *data, int width, int
> height, int stride){
>
> /* left block */
> - for(j=b_x-1; j>=0; j--){
> - int mb_index_j= (j>>is_luma) + (b_y>>is_luma)*s->mb_stride;
> - int error_j= s->error_status_table[mb_index_j];
> - int intra_j =
> IS_INTRA(s->current_picture.f.mb_type[mb_index_j]);
> - if(intra_j==0 || !(error_j&ER_DC_ERROR)){
> - color[1]= dc[j + b_y*stride];
> - distance[1]= b_x-j;
> + for (j = b_x - 1; j >= 0; j--) {
> + int mb_index_j = (j>>is_luma) + (b_y>>is_luma) *
> s->mb_stride;
> + int error_j = s->error_status_table[mb_index_j];
> + int intra_j =
> IS_INTRA(s->current_picture.f.mb_type[mb_index_j]);
> + if (intra_j == 0 || !(error_j & ER_DC_ERROR)) {
> + color[1] = dc[j + b_y * stride];
> + distance[1] = b_x - j;
space around >>
> /* bottom block */
> - for(j=b_y+1; j<h; j++){
> - int mb_index_j= (b_x>>is_luma) + (j>>is_luma)*s->mb_stride;
> - int error_j= s->error_status_table[mb_index_j];
> - int intra_j =
> IS_INTRA(s->current_picture.f.mb_type[mb_index_j]);
> - if(intra_j==0 || !(error_j&ER_DC_ERROR)){
> - color[2]= dc[b_x + j*stride];
> - distance[2]= j-b_y;
> + for (j = b_y + 1; j < h; j++) {
> + int mb_index_j = (b_x>>is_luma) + (j>>is_luma) *
> s->mb_stride;
> + int error_j = s->error_status_table[mb_index_j];
> + int intra_j =
> IS_INTRA(s->current_picture.f.mb_type[mb_index_j]);
> +
> + if (intra_j == 0 || !(error_j & ER_DC_ERROR)) {
> + color[2] = dc[b_x + j * stride];
> + distance[2] = j - b_y;
ditto
> @@ -236,58 +265,64 @@ static void guess_dc(MpegEncContext *s, int16_t *dc,
> int w, int h, int stride, i
> + d = FFABS(b) - ((FFABS(a) + FFABS(c) + 1) >> 1);
> + d = FFMAX(d, 0);
> + if (b < 0) d = -d;
Break the line.
> @@ -299,228 +334,275 @@ static void h_block_filter(MpegEncContext *s, uint8_t
> *dst, int w, int h, int st
> int x;
> - int top_status = s->error_status_table[(b_x>>is_luma) + ( b_y
> >>is_luma)*s->mb_stride];
> - int bottom_status= s->error_status_table[(b_x>>is_luma) +
> ((b_y+1)>>is_luma)*s->mb_stride];
> + int top_status = s->error_status_table[(b_x>>is_luma) + ( b_y
> >> is_luma) * s->mb_stride];
> + int bottom_status = s->error_status_table[(b_x>>is_luma) + ((b_y
> + 1 ) >> is_luma) * s->mb_stride];
space around >>
> - int16_t *top_mv =
> s->current_picture.f.motion_val[0][mvy_stride * b_y + mvx_stride * b_x];
> - int16_t *bottom_mv =
> s->current_picture.f.motion_val[0][mvy_stride * (b_y + 1) + mvx_stride * b_x];
> + int16_t *top_mv =
> s->current_picture.f.motion_val[0][mvy_stride * b_y + mvx_stride * b_x];
> + int16_t *bottom_mv =
> s->current_picture.f.motion_val[0][mvy_stride * (b_y + 1) + mvx_stride *
> b_x];
This was better before.
> + d = FFABS(b) - ((FFABS(a) + FFABS(c) + 1) >> 1);
> + d = FFMAX(d, 0);
> + if (b < 0) d = -d;
Break the line.
> + if (top_damage) {
> + dst[offset + x + 7 * stride] = cm[dst[offset + x + 7 *
> stride] +
> + ((d * 7) >> 4)];
> + dst[offset + x + 6 * stride] = cm[dst[offset + x + 6 *
> stride] +
> + ((d * 5) >> 4)];
> + dst[offset + x + 5 * stride] = cm[dst[offset + x + 5 *
> stride] +
> + ((d * 3) >> 4)];
> + dst[offset + x + 4 * stride] = cm[dst[offset + x + 4 *
> stride] +
> + ((d * 1) >> 4)];
> }
> + if (bottom_damage) {
> + dst[offset + x + 8 * stride] = cm[dst[offset + x + 8 *
> stride] -
> + ((d * 7) >> 4)];
> + dst[offset + x + 9 * stride] = cm[dst[offset + x + 9 *
> stride] -
> + ((d * 5) >> 4)];
> + dst[offset + x + 10 * stride] = cm[dst[offset + x + 10 *
> stride] -
> + ((d * 3) >> 4)];
> + dst[offset + x + 11 * stride] = cm[dst[offset + x + 11 *
> stride] -
> + ((d * 1) >> 4)];
The bottom_damage block is correctly indented, the top_damage block is not.
> - s->mv_dir = s->last_picture.f.data[0] ? MV_DIR_FORWARD :
> MV_DIR_BACKWARD;
> + s->mv_dir = s->last_picture.f.data[0] ? MV_DIR_FORWARD :
> + MV_DIR_BACKWARD;
vertically align the ? and the :
>
> - for(j=0; j<pred_count; j++){
> - sum_x+= mv_predictor[j][0];
> - sum_y+= mv_predictor[j][1];
> - sum_r+= ref[j];
> - if(j && ref[j] != ref[j-1])
> - goto skip_mean_and_median;
> + for (j = 0; j < pred_count; j++) {
> + sum_x += mv_predictor[j][0];
> + sum_y += mv_predictor[j][1];
> + sum_r += ref[j];
> + if (j && ref[j] != ref[j - 1])
> +goto skip_mean_and_median;
The goto statement was correctly indented before; only goto labels
are placed in the first column.
> @@ -536,151 +618,173 @@ skip_mean_and_median:
> }
> if (!s->last_picture.f.motion_val[0] ||
> !s->last_picture.f.ref_index[0])
> - goto skip_last_mv;
> +goto skip_last_mv;
same
> - for(k=0; k<16; k++)
> - score += FFABS(src[k*s->linesize-1
> ]-src[k*s->linesize ]);
> + for (k = 0; k < 16; k++)
> + score += FFABS(src[k * s->linesize - 1] -
> + src[k * s->linesize]);
FFABS is a macro, align the next line with the first char after (.
> - for(k=0; k<16; k++)
> - score +=
> FFABS(src[k*s->linesize+15]-src[k*s->linesize+16]);
> + for (k = 0; k < 16; k++)
> + score += FFABS(src[k * s->linesize + 15] -
> + src[k * s->linesize + 16]);
same
> - for(k=0; k<16; k++)
> - score += FFABS(src[k-s->linesize ]-src[k
> ]);
> + for (k = 0; k < 16; k++)
> + score += FFABS(src[k - s->linesize] -
> + src[k]);
no need to break the line
> @@ -698,117 +804,139 @@ static int is_intra_more_likely(MpegEncContext *s){
> +void ff_er_add_slice(MpegEncContext *s, int startx, int starty,
> + int endx, int endy, int status)
> +{
> + const int start_i = av_clip(startx + starty *
> + s->mb_width, 0, s->mb_num - 1);
> + const int end_i = av_clip(endx + endy *
> + s->mb_width, 0, s->mb_num);
Break the lines after comma.
> @@ -817,140 +945,146 @@ void ff_er_frame_end(MpegEncContext *s){
>
> - dc_error= ac_error= mv_error=0;
> - for(i=0; i<s->mb_num; i++){
> - const int mb_xy= s->mb_index2xy[i];
> - error= s->error_status_table[mb_xy];
> - if(error&ER_DC_ERROR) dc_error ++;
> - if(error&ER_AC_ERROR) ac_error ++;
> - if(error&ER_MV_ERROR) mv_error ++;
> + dc_error = ac_error = mv_error = 0;
> + for (i = 0; i < s->mb_num; i++) {
> + const int mb_xy = s->mb_index2xy[i];
> + error = s->error_status_table[mb_xy];
> + if (error & ER_DC_ERROR) dc_error++;
> + if (error & ER_AC_ERROR) ac_error++;
> + if (error & ER_MV_ERROR) mv_error++;
Break these lines.
> @@ -958,194 +1092,235 @@ void ff_er_frame_end(MpegEncContext *s){
>
> /* the filters below are not XvMC compatible, skip them */
> - if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
> - goto ec_clean;
> + if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
> +goto ec_clean;
goto misplaced again
> /* guess DC for damaged blocks */
> - guess_dc(s, s->dc_val[0], s->mb_width*2, s->mb_height*2, s->b8_stride,
> 1);
> - guess_dc(s, s->dc_val[1], s->mb_width , s->mb_height , s->mb_stride,
> 0);
> - guess_dc(s, s->dc_val[2], s->mb_width , s->mb_height , s->mb_stride,
> 0);
> + guess_dc(s, s->dc_val[0], s->mb_width * 2,
> + s->mb_height * 2, s->b8_stride, 1);
> + guess_dc(s, s->dc_val[1], s->mb_width,
> + s->mb_height, s->mb_stride, 0);
> + guess_dc(s, s->dc_val[2], s->mb_width,
> + s->mb_height, s->mb_stride, 0);
Remove the extra spaces.
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel