Ticket #6649: patch-dnxhdenc.diff

File patch-dnxhdenc.diff, 2.2 KB (added by Frederic Devernay, 9 years ago)

DNxHD 444 support for non-multiple-of-16 dimensions patch

  • libavcodec/dnxhdenc.c

     
    751751        ptr_y = &ctx->edge_buf_y[0];
    752752        ptr_u = &ctx->edge_buf_uv[0][0];
    753753        ptr_v = &ctx->edge_buf_uv[1][0];
    754     } else if (ctx->bit_depth == 10 && vdsp->emulated_edge_mc && ((mb_x << 3) + 8 > ctx->m.avctx->width ||
    755                                                                   (mb_y << 3) + 8 > ctx->m.avctx->height)) {
    756         int y_w = ctx->m.avctx->width  - (mb_x << 3);
    757         int y_h = ctx->m.avctx->height - (mb_y << 3);
     754    } else if (ctx->bit_depth == 10 && vdsp->emulated_edge_mc && ((mb_x << 4) + 16 > ctx->m.avctx->width ||
     755                                                                  (mb_y << 4) + 16 > ctx->m.avctx->height)) {
     756        int y_w = ctx->m.avctx->width  - (mb_x << 4);
     757        int y_h = ctx->m.avctx->height - (mb_y << 4);
    758758        int uv_w = ctx->is_444 ? y_w : (y_w + 1) / 2;
    759759        int uv_h = y_h;
    760         linesize = 16;
    761         uvlinesize = 8 + 8 * ctx->is_444;
     760        linesize = 32;
     761        uvlinesize = 16 + 16 * ctx->is_444;
    762762
    763763        vdsp->emulated_edge_mc(&ctx->edge_buf_y[0], ptr_y,
    764764                               linesize, ctx->m.linesize,
     
    773773                               uvlinesize / 2, 16,
    774774                               0, 0, uv_w, uv_h);
    775775
    776         dct_y_offset =  bw * linesize;
    777         dct_uv_offset = bw * uvlinesize;
     776        dct_y_offset =  bw * linesize / 2;
     777        dct_uv_offset = bw * uvlinesize / 2;
    778778        ptr_y = &ctx->edge_buf_y[0];
    779779        ptr_u = &ctx->edge_buf_uv[0][0];
    780780        ptr_v = &ctx->edge_buf_uv[1][0];
  • libavcodec/dnxhdenc.h

     
    7575    int intra_quant_bias;
    7676
    7777    DECLARE_ALIGNED(16, int16_t, blocks)[12][64];
    78     DECLARE_ALIGNED(16, uint8_t, edge_buf_y)[256];
    79     DECLARE_ALIGNED(16, uint8_t, edge_buf_uv)[2][256];
     78    DECLARE_ALIGNED(16, uint8_t, edge_buf_y)[512]; // has to hold 16x16 uint16 when depth=10
     79    DECLARE_ALIGNED(16, uint8_t, edge_buf_uv)[2][512]; // has to hold 16x16 uint16_t when depth=10
    8080
    8181    int      (*qmatrix_c)     [64];
    8282    int      (*qmatrix_l)     [64];