* commit '458446acfa1441d283dacf9e6e545beb083b8bb0':
lavc: Edge emulation with dst/src linesize
Conflicts:
libavcodec/cavs.c
libavcodec/h264.c
libavcodec/hevc.c
libavcodec/mpegvideo_enc.c
libavcodec/mpegvideo_motion.c
libavcodec/rv34.c
libavcodec/svq3.c
libavcodec/vc1dec.c
libavcodec/videodsp.h
libavcodec/videodsp_template.c
libavcodec/vp3.c
libavcodec/vp8.c
libavcodec/wmv2.c
libavcodec/x86/videodsp.asm
libavcodec/x86/videodsp_init.c
Changes to the asm are not merged, they are left for volunteers or
in their absence for later.
The changes this merge introduces are reordering of the function
arguments
See: face578d56c2d1375e40d5e2a28acc122132bc55
Merged-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -407,8 +407,9 @@ static inline void mc_dir_part(AVSContext *h, AVFrame *pic, int chroma_height, |
407 | 407 |
full_my < 0 - extra_height || |
408 | 408 |
full_mx + 16 /* FIXME */ > pic_width + extra_width || |
409 | 409 |
full_my + 16 /* FIXME */ > pic_height + extra_height) { |
410 |
- h->vdsp.emulated_edge_mc(h->edge_emu_buffer, h->l_stride, |
|
411 |
- src_y - 2 - 2 * h->l_stride, h->l_stride, |
|
410 |
+ h->vdsp.emulated_edge_mc(h->edge_emu_buffer, |
|
411 |
+ src_y - 2 - 2 * h->l_stride, |
|
412 |
+ h->l_stride, h->l_stride, |
|
412 | 413 |
16 + 5, 16 + 5 /* FIXME */, |
413 | 414 |
full_mx - 2, full_my - 2, |
414 | 415 |
pic_width, pic_height); |
... | ... |
@@ -420,8 +421,8 @@ static inline void mc_dir_part(AVSContext *h, AVFrame *pic, int chroma_height, |
420 | 420 |
qpix_op[luma_xy](dest_y, src_y, h->l_stride); |
421 | 421 |
|
422 | 422 |
if (emu) { |
423 |
- h->vdsp.emulated_edge_mc(h->edge_emu_buffer, h->c_stride, src_cb, |
|
424 |
- h->c_stride, |
|
423 |
+ h->vdsp.emulated_edge_mc(h->edge_emu_buffer, src_cb, |
|
424 |
+ h->c_stride, h->c_stride, |
|
425 | 425 |
9, 9 /* FIXME */, |
426 | 426 |
mx >> 3, my >> 3, |
427 | 427 |
pic_width >> 1, pic_height >> 1); |
... | ... |
@@ -430,8 +431,8 @@ static inline void mc_dir_part(AVSContext *h, AVFrame *pic, int chroma_height, |
430 | 430 |
chroma_op(dest_cb, src_cb, h->c_stride, chroma_height, mx & 7, my & 7); |
431 | 431 |
|
432 | 432 |
if (emu) { |
433 |
- h->vdsp.emulated_edge_mc(h->edge_emu_buffer, h->c_stride, src_cr, |
|
434 |
- h->c_stride, |
|
433 |
+ h->vdsp.emulated_edge_mc(h->edge_emu_buffer, src_cr, |
|
434 |
+ h->c_stride, h->c_stride, |
|
435 | 435 |
9, 9 /* FIXME */, |
436 | 436 |
mx >> 3, my >> 3, |
437 | 437 |
pic_width >> 1, pic_height >> 1); |
... | ... |
@@ -1414,8 +1414,8 @@ static int mc_subpel(DiracContext *s, DiracBlock *block, const uint8_t *src[5], |
1414 | 1414 |
y + p->yblen > p->height+EDGE_WIDTH/2 || |
1415 | 1415 |
x < 0 || y < 0) { |
1416 | 1416 |
for (i = 0; i < nplanes; i++) { |
1417 |
- ff_emulated_edge_mc(s->edge_emu_buffer[i], p->stride, |
|
1418 |
- src[i], p->stride, |
|
1417 |
+ ff_emulated_edge_mc(s->edge_emu_buffer[i], src[i], |
|
1418 |
+ p->stride, p->stride, |
|
1419 | 1419 |
p->xblen, p->yblen, x, y, |
1420 | 1420 |
p->width+EDGE_WIDTH/2, p->height+EDGE_WIDTH/2); |
1421 | 1421 |
src[i] = s->edge_emu_buffer[i]; |
... | ... |
@@ -934,9 +934,9 @@ static av_always_inline void mc_dir_part(H264Context *h, Picture *pic, |
934 | 934 |
full_my < 0 - extra_height || |
935 | 935 |
full_mx + 16 /*FIXME*/ > pic_width + extra_width || |
936 | 936 |
full_my + 16 /*FIXME*/ > pic_height + extra_height) { |
937 |
- h->vdsp.emulated_edge_mc(h->edge_emu_buffer, h->mb_linesize, |
|
937 |
+ h->vdsp.emulated_edge_mc(h->edge_emu_buffer, |
|
938 | 938 |
src_y - (2 << pixel_shift) - 2 * h->mb_linesize, |
939 |
- h->mb_linesize, |
|
939 |
+ h->mb_linesize, h->mb_linesize, |
|
940 | 940 |
16 + 5, 16 + 5 /*FIXME*/, full_mx - 2, |
941 | 941 |
full_my - 2, pic_width, pic_height); |
942 | 942 |
src_y = h->edge_emu_buffer + (2 << pixel_shift) + 2 * h->mb_linesize; |
... | ... |
@@ -953,9 +953,9 @@ static av_always_inline void mc_dir_part(H264Context *h, Picture *pic, |
953 | 953 |
if (chroma_idc == 3 /* yuv444 */) { |
954 | 954 |
src_cb = pic->f.data[1] + offset; |
955 | 955 |
if (emu) { |
956 |
- h->vdsp.emulated_edge_mc(h->edge_emu_buffer, h->mb_linesize, |
|
956 |
+ h->vdsp.emulated_edge_mc(h->edge_emu_buffer, |
|
957 | 957 |
src_cb - (2 << pixel_shift) - 2 * h->mb_linesize, |
958 |
- h->mb_linesize, |
|
958 |
+ h->mb_linesize, h->mb_linesize, |
|
959 | 959 |
16 + 5, 16 + 5 /*FIXME*/, |
960 | 960 |
full_mx - 2, full_my - 2, |
961 | 961 |
pic_width, pic_height); |
... | ... |
@@ -967,9 +967,9 @@ static av_always_inline void mc_dir_part(H264Context *h, Picture *pic, |
967 | 967 |
|
968 | 968 |
src_cr = pic->f.data[2] + offset; |
969 | 969 |
if (emu) { |
970 |
- h->vdsp.emulated_edge_mc(h->edge_emu_buffer, h->mb_linesize, |
|
970 |
+ h->vdsp.emulated_edge_mc(h->edge_emu_buffer, |
|
971 | 971 |
src_cr - (2 << pixel_shift) - 2 * h->mb_linesize, |
972 |
- h->mb_linesize, |
|
972 |
+ h->mb_linesize, h->mb_linesize, |
|
973 | 973 |
16 + 5, 16 + 5 /*FIXME*/, |
974 | 974 |
full_mx - 2, full_my - 2, |
975 | 975 |
pic_width, pic_height); |
... | ... |
@@ -994,7 +994,8 @@ static av_always_inline void mc_dir_part(H264Context *h, Picture *pic, |
994 | 994 |
(my >> ysh) * h->mb_uvlinesize; |
995 | 995 |
|
996 | 996 |
if (emu) { |
997 |
- h->vdsp.emulated_edge_mc(h->edge_emu_buffer, h->mb_uvlinesize, src_cb, h->mb_uvlinesize, |
|
997 |
+ h->vdsp.emulated_edge_mc(h->edge_emu_buffer, src_cb, |
|
998 |
+ h->mb_uvlinesize, h->mb_uvlinesize, |
|
998 | 999 |
9, 8 * chroma_idc + 1, (mx >> 3), (my >> ysh), |
999 | 1000 |
pic_width >> 1, pic_height >> (chroma_idc == 1 /* yuv420 */)); |
1000 | 1001 |
src_cb = h->edge_emu_buffer; |
... | ... |
@@ -1004,7 +1005,8 @@ static av_always_inline void mc_dir_part(H264Context *h, Picture *pic, |
1004 | 1004 |
mx & 7, (my << (chroma_idc == 2 /* yuv422 */)) & 7); |
1005 | 1005 |
|
1006 | 1006 |
if (emu) { |
1007 |
- h->vdsp.emulated_edge_mc(h->edge_emu_buffer, h->mb_uvlinesize, src_cr, h->mb_uvlinesize, |
|
1007 |
+ h->vdsp.emulated_edge_mc(h->edge_emu_buffer, src_cr, |
|
1008 |
+ h->mb_uvlinesize, h->mb_uvlinesize, |
|
1008 | 1009 |
9, 8 * chroma_idc + 1, (mx >> 3), (my >> ysh), |
1009 | 1010 |
pic_width >> 1, pic_height >> (chroma_idc == 1 /* yuv420 */)); |
1010 | 1011 |
src_cr = h->edge_emu_buffer; |
... | ... |
@@ -1026,7 +1026,8 @@ static void luma_mc(HEVCContext *s, int16_t *dst, ptrdiff_t dststride, |
1026 | 1026 |
y_off >= pic_height - block_h - ff_hevc_qpel_extra_after[my]) { |
1027 | 1027 |
int offset = extra_top * srcstride + (extra_left << s->sps->pixel_shift); |
1028 | 1028 |
|
1029 |
- s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, srcstride, src - offset, srcstride, |
|
1029 |
+ s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src - offset, |
|
1030 |
+ srcstride, srcstride, |
|
1030 | 1031 |
block_w + ff_hevc_qpel_extra[mx], |
1031 | 1032 |
block_h + ff_hevc_qpel_extra[my], |
1032 | 1033 |
x_off - extra_left, y_off - extra_top, |
... | ... |
@@ -1077,7 +1078,8 @@ static void chroma_mc(HEVCContext *s, int16_t *dst1, int16_t *dst2, |
1077 | 1077 |
int offset1 = EPEL_EXTRA_BEFORE * (src1stride + (1 << s->sps->pixel_shift)); |
1078 | 1078 |
int offset2 = EPEL_EXTRA_BEFORE * (src2stride + (1 << s->sps->pixel_shift)); |
1079 | 1079 |
|
1080 |
- s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src1stride, src1 - offset1, src1stride, |
|
1080 |
+ s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src1 - offset1, |
|
1081 |
+ src1stride, src1stride, |
|
1081 | 1082 |
block_w + EPEL_EXTRA, block_h + EPEL_EXTRA, |
1082 | 1083 |
x_off - EPEL_EXTRA_BEFORE, |
1083 | 1084 |
y_off - EPEL_EXTRA_BEFORE, |
... | ... |
@@ -1087,7 +1089,8 @@ static void chroma_mc(HEVCContext *s, int16_t *dst1, int16_t *dst2, |
1087 | 1087 |
s->hevcdsp.put_hevc_epel[!!my][!!mx](dst1, dststride, src1, src1stride, |
1088 | 1088 |
block_w, block_h, mx, my, lc->mc_buffer); |
1089 | 1089 |
|
1090 |
- s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src2stride, src2 - offset2, src2stride, |
|
1090 |
+ s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src2 - offset2, |
|
1091 |
+ src2stride, src2stride, |
|
1091 | 1092 |
block_w + EPEL_EXTRA, block_h + EPEL_EXTRA, |
1092 | 1093 |
x_off - EPEL_EXTRA_BEFORE, |
1093 | 1094 |
y_off - EPEL_EXTRA_BEFORE, |
... | ... |
@@ -2227,12 +2227,11 @@ static inline int hpel_motion_lowres(MpegEncContext *s, |
2227 | 2227 |
|
2228 | 2228 |
if ((unsigned)src_x > FFMAX( h_edge_pos - (!!sx) - w, 0) || |
2229 | 2229 |
(unsigned)src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) { |
2230 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->linesize, |
|
2231 |
- src, s->linesize, w + 1, |
|
2232 |
- (h + 1) << field_based, src_x, |
|
2233 |
- src_y << field_based, |
|
2234 |
- h_edge_pos, |
|
2235 |
- v_edge_pos); |
|
2230 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src, |
|
2231 |
+ s->linesize, s->linesize, |
|
2232 |
+ w + 1, (h + 1) << field_based, |
|
2233 |
+ src_x, src_y << field_based, |
|
2234 |
+ h_edge_pos, v_edge_pos); |
|
2236 | 2235 |
src = s->edge_emu_buffer; |
2237 | 2236 |
emu = 1; |
2238 | 2237 |
} |
... | ... |
@@ -2330,21 +2329,22 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, |
2330 | 2330 |
|
2331 | 2331 |
if ((unsigned) src_x > FFMAX( h_edge_pos - (!!sx) - 2 * block_s, 0) || uvsrc_y<0 || |
2332 | 2332 |
(unsigned) src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) { |
2333 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, linesize >> field_based, ptr_y, |
|
2334 |
- linesize >> field_based, 17, 17 + field_based, |
|
2333 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, |
|
2334 |
+ linesize >> field_based, linesize >> field_based, |
|
2335 |
+ 17, 17 + field_based, |
|
2335 | 2336 |
src_x, src_y << field_based, h_edge_pos, |
2336 | 2337 |
v_edge_pos); |
2337 | 2338 |
ptr_y = s->edge_emu_buffer; |
2338 | 2339 |
if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { |
2339 | 2340 |
uint8_t *uvbuf = s->edge_emu_buffer + 18 * s->linesize; |
2340 |
- s->vdsp.emulated_edge_mc(uvbuf, uvlinesize >> field_based, |
|
2341 |
- ptr_cb, uvlinesize >> field_based, 9, |
|
2342 |
- 9 + field_based, |
|
2341 |
+ s->vdsp.emulated_edge_mc(uvbuf, ptr_cb, |
|
2342 |
+ uvlinesize >> field_based, uvlinesize >> field_based, |
|
2343 |
+ 9, 9 + field_based, |
|
2343 | 2344 |
uvsrc_x, uvsrc_y << field_based, |
2344 | 2345 |
h_edge_pos >> 1, v_edge_pos >> 1); |
2345 |
- s->vdsp.emulated_edge_mc(uvbuf + 16, uvlinesize >> field_based, |
|
2346 |
- ptr_cr, uvlinesize >> field_based, 9, |
|
2347 |
- 9 + field_based, |
|
2346 |
+ s->vdsp.emulated_edge_mc(uvbuf + 16, ptr_cr, |
|
2347 |
+ uvlinesize >> field_based,uvlinesize >> field_based, |
|
2348 |
+ 9, 9 + field_based, |
|
2348 | 2349 |
uvsrc_x, uvsrc_y << field_based, |
2349 | 2350 |
h_edge_pos >> 1, v_edge_pos >> 1); |
2350 | 2351 |
ptr_cb = uvbuf; |
... | ... |
@@ -2416,8 +2416,10 @@ static inline void chroma_4mv_motion_lowres(MpegEncContext *s, |
2416 | 2416 |
ptr = ref_picture[1] + offset; |
2417 | 2417 |
if ((unsigned) src_x > FFMAX(h_edge_pos - (!!sx) - block_s, 0) || |
2418 | 2418 |
(unsigned) src_y > FFMAX(v_edge_pos - (!!sy) - block_s, 0)) { |
2419 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->uvlinesize, ptr, s->uvlinesize, |
|
2420 |
- 9, 9, src_x, src_y, h_edge_pos, v_edge_pos); |
|
2419 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, |
|
2420 |
+ s->uvlinesize, s->uvlinesize, |
|
2421 |
+ 9, 9, |
|
2422 |
+ src_x, src_y, h_edge_pos, v_edge_pos); |
|
2421 | 2423 |
ptr = s->edge_emu_buffer; |
2422 | 2424 |
emu = 1; |
2423 | 2425 |
} |
... | ... |
@@ -2427,9 +2429,10 @@ static inline void chroma_4mv_motion_lowres(MpegEncContext *s, |
2427 | 2427 |
|
2428 | 2428 |
ptr = ref_picture[2] + offset; |
2429 | 2429 |
if (emu) { |
2430 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->uvlinesize, |
|
2431 |
- ptr, s->uvlinesize, 9, 9, |
|
2432 |
- src_x, src_y, h_edge_pos, v_edge_pos); |
|
2430 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, |
|
2431 |
+ s->uvlinesize, s->uvlinesize, |
|
2432 |
+ 9, 9, |
|
2433 |
+ src_x, src_y, h_edge_pos, v_edge_pos); |
|
2433 | 2434 |
ptr = s->edge_emu_buffer; |
2434 | 2435 |
} |
2435 | 2436 |
pix_op[op_index](dest_cr, ptr, s->uvlinesize, block_s, sx, sy); |
... | ... |
@@ -1837,15 +1837,21 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, |
1837 | 1837 |
uint8_t *ebuf = s->edge_emu_buffer + 32; |
1838 | 1838 |
int cw = (s->width + s->chroma_x_shift) >> s->chroma_x_shift; |
1839 | 1839 |
int ch = (s->height + s->chroma_y_shift) >> s->chroma_y_shift; |
1840 |
- s->vdsp.emulated_edge_mc(ebuf, wrap_y, ptr_y, wrap_y, 16, 16, mb_x * 16, |
|
1841 |
- mb_y * 16, s->width, s->height); |
|
1840 |
+ s->vdsp.emulated_edge_mc(ebuf, ptr_y, |
|
1841 |
+ wrap_y, wrap_y, |
|
1842 |
+ 16, 16, mb_x * 16, mb_y * 16, |
|
1843 |
+ s->width, s->height); |
|
1842 | 1844 |
ptr_y = ebuf; |
1843 |
- s->vdsp.emulated_edge_mc(ebuf + 18 * wrap_y, wrap_c, ptr_cb, wrap_c, mb_block_width, |
|
1844 |
- mb_block_height, mb_x * mb_block_width, mb_y * mb_block_height, |
|
1845 |
+ s->vdsp.emulated_edge_mc(ebuf + 18 * wrap_y, ptr_cb, |
|
1846 |
+ wrap_c, wrap_c, |
|
1847 |
+ mb_block_width, mb_block_height, |
|
1848 |
+ mb_x * mb_block_width, mb_y * mb_block_height, |
|
1845 | 1849 |
cw, ch); |
1846 | 1850 |
ptr_cb = ebuf + 18 * wrap_y; |
1847 |
- s->vdsp.emulated_edge_mc(ebuf + 18 * wrap_y + 16, wrap_c, ptr_cr, wrap_c, mb_block_width, |
|
1848 |
- mb_block_height, mb_x * mb_block_width, mb_y * mb_block_height, |
|
1851 |
+ s->vdsp.emulated_edge_mc(ebuf + 18 * wrap_y + 16, ptr_cr, |
|
1852 |
+ wrap_c, wrap_c, |
|
1853 |
+ mb_block_width, mb_block_height, |
|
1854 |
+ mb_x * mb_block_width, mb_y * mb_block_height, |
|
1849 | 1855 |
cw, ch); |
1850 | 1856 |
ptr_cr = ebuf + 18 * wrap_y + 16; |
1851 | 1857 |
} |
... | ... |
@@ -62,8 +62,8 @@ static void gmc1_motion(MpegEncContext *s, |
62 | 62 |
|
63 | 63 |
if ((unsigned)src_x >= FFMAX(s->h_edge_pos - 17, 0) || |
64 | 64 |
(unsigned)src_y >= FFMAX(s->v_edge_pos - 17, 0)) { |
65 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, linesize, ptr, |
|
66 |
- linesize, |
|
65 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, |
|
66 |
+ linesize, linesize, |
|
67 | 67 |
17, 17, |
68 | 68 |
src_x, src_y, |
69 | 69 |
s->h_edge_pos, s->v_edge_pos); |
... | ... |
@@ -106,8 +106,8 @@ static void gmc1_motion(MpegEncContext *s, |
106 | 106 |
ptr = ref_picture[1] + offset; |
107 | 107 |
if ((unsigned)src_x >= FFMAX((s->h_edge_pos >> 1) - 9, 0) || |
108 | 108 |
(unsigned)src_y >= FFMAX((s->v_edge_pos >> 1) - 9, 0)) { |
109 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, uvlinesize, |
|
110 |
- ptr, uvlinesize, |
|
109 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, |
|
110 |
+ uvlinesize, uvlinesize, |
|
111 | 111 |
9, 9, |
112 | 112 |
src_x, src_y, |
113 | 113 |
s->h_edge_pos >> 1, s->v_edge_pos >> 1); |
... | ... |
@@ -119,8 +119,8 @@ static void gmc1_motion(MpegEncContext *s, |
119 | 119 |
|
120 | 120 |
ptr = ref_picture[2] + offset; |
121 | 121 |
if (emu) { |
122 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, uvlinesize, |
|
123 |
- ptr, uvlinesize, |
|
122 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, |
|
123 |
+ uvlinesize, uvlinesize, |
|
124 | 124 |
9, 9, |
125 | 125 |
src_x, src_y, |
126 | 126 |
s->h_edge_pos >> 1, s->v_edge_pos >> 1); |
... | ... |
@@ -212,8 +212,8 @@ static inline int hpel_motion(MpegEncContext *s, |
212 | 212 |
if (s->flags & CODEC_FLAG_EMU_EDGE) { |
213 | 213 |
if ((unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x & 1) - 8, 0) || |
214 | 214 |
(unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y & 1) - 8, 0)) { |
215 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->linesize, src, |
|
216 |
- s->linesize, |
|
215 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src, |
|
216 |
+ s->linesize, s->linesize, |
|
217 | 217 |
9, 9, |
218 | 218 |
src_x, src_y, |
219 | 219 |
s->h_edge_pos, s->v_edge_pos); |
... | ... |
@@ -317,21 +317,21 @@ void mpeg_motion_internal(MpegEncContext *s, |
317 | 317 |
src_y); |
318 | 318 |
return; |
319 | 319 |
} |
320 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->linesize, ptr_y, |
|
321 |
- s->linesize, |
|
320 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, |
|
321 |
+ s->linesize, s->linesize, |
|
322 | 322 |
17, 17 + field_based, |
323 | 323 |
src_x, src_y << field_based, |
324 | 324 |
s->h_edge_pos, s->v_edge_pos); |
325 | 325 |
ptr_y = s->edge_emu_buffer; |
326 | 326 |
if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { |
327 | 327 |
uint8_t *uvbuf = s->edge_emu_buffer + 18 * s->linesize; |
328 |
- s->vdsp.emulated_edge_mc(uvbuf, s->uvlinesize, ptr_cb, |
|
329 |
- s->uvlinesize, |
|
328 |
+ s->vdsp.emulated_edge_mc(uvbuf, ptr_cb, |
|
329 |
+ s->uvlinesize, s->uvlinesize, |
|
330 | 330 |
9, 9 + field_based, |
331 | 331 |
uvsrc_x, uvsrc_y << field_based, |
332 | 332 |
s->h_edge_pos >> 1, s->v_edge_pos >> 1); |
333 |
- s->vdsp.emulated_edge_mc(uvbuf + 16, s->uvlinesize, ptr_cr, |
|
334 |
- s->uvlinesize, |
|
333 |
+ s->vdsp.emulated_edge_mc(uvbuf + 16, ptr_cr, |
|
334 |
+ s->uvlinesize, s->uvlinesize, |
|
335 | 335 |
9, 9 + field_based, |
336 | 336 |
uvsrc_x, uvsrc_y << field_based, |
337 | 337 |
s->h_edge_pos >> 1, s->v_edge_pos >> 1); |
... | ... |
@@ -538,24 +538,21 @@ static inline void qpel_motion(MpegEncContext *s, |
538 | 538 |
|
539 | 539 |
if ((unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x & 3) - 16, 0) || |
540 | 540 |
(unsigned)src_y > FFMAX( v_edge_pos - (motion_y & 3) - h, 0)) { |
541 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, |
|
542 |
- s->linesize, |
|
543 |
- ptr_y, s->linesize, |
|
541 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, |
|
542 |
+ s->linesize, s->linesize, |
|
544 | 543 |
17, 17 + field_based, |
545 | 544 |
src_x, src_y << field_based, |
546 | 545 |
s->h_edge_pos, s->v_edge_pos); |
547 | 546 |
ptr_y = s->edge_emu_buffer; |
548 | 547 |
if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { |
549 | 548 |
uint8_t *uvbuf = s->edge_emu_buffer + 18 * s->linesize; |
550 |
- s->vdsp.emulated_edge_mc(uvbuf, s->uvlinesize, |
|
551 |
- ptr_cb, |
|
552 |
- s->uvlinesize, |
|
549 |
+ s->vdsp.emulated_edge_mc(uvbuf, ptr_cb, |
|
550 |
+ s->uvlinesize, s->uvlinesize, |
|
553 | 551 |
9, 9 + field_based, |
554 | 552 |
uvsrc_x, uvsrc_y << field_based, |
555 | 553 |
s->h_edge_pos >> 1, s->v_edge_pos >> 1); |
556 |
- s->vdsp.emulated_edge_mc(uvbuf + 16, s->uvlinesize, |
|
557 |
- ptr_cr, |
|
558 |
- s->uvlinesize, |
|
554 |
+ s->vdsp.emulated_edge_mc(uvbuf + 16, ptr_cr, |
|
555 |
+ s->uvlinesize, s->uvlinesize, |
|
559 | 556 |
9, 9 + field_based, |
560 | 557 |
uvsrc_x, uvsrc_y << field_based, |
561 | 558 |
s->h_edge_pos >> 1, s->v_edge_pos >> 1); |
... | ... |
@@ -625,8 +622,8 @@ static void chroma_4mv_motion(MpegEncContext *s, |
625 | 625 |
if (s->flags & CODEC_FLAG_EMU_EDGE) { |
626 | 626 |
if ((unsigned)src_x > FFMAX((s->h_edge_pos >> 1) - (dxy & 1) - 8, 0) || |
627 | 627 |
(unsigned)src_y > FFMAX((s->v_edge_pos >> 1) - (dxy >> 1) - 8, 0)) { |
628 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->uvlinesize, |
|
629 |
- ptr, s->uvlinesize, |
|
628 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, |
|
629 |
+ s->uvlinesize, s->uvlinesize, |
|
630 | 630 |
9, 9, src_x, src_y, |
631 | 631 |
s->h_edge_pos >> 1, s->v_edge_pos >> 1); |
632 | 632 |
ptr = s->edge_emu_buffer; |
... | ... |
@@ -637,8 +634,8 @@ static void chroma_4mv_motion(MpegEncContext *s, |
637 | 637 |
|
638 | 638 |
ptr = ref_picture[2] + offset; |
639 | 639 |
if (emu) { |
640 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->uvlinesize, |
|
641 |
- ptr, s->uvlinesize, |
|
640 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, |
|
641 |
+ s->uvlinesize, s->uvlinesize, |
|
642 | 642 |
9, 9, src_x, src_y, |
643 | 643 |
s->h_edge_pos >> 1, s->v_edge_pos >> 1); |
644 | 644 |
ptr = s->edge_emu_buffer; |
... | ... |
@@ -785,9 +782,8 @@ static inline void apply_8x8(MpegEncContext *s, |
785 | 785 |
if (s->flags & CODEC_FLAG_EMU_EDGE) { |
786 | 786 |
if ((unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x & 3) - 8, 0) || |
787 | 787 |
(unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y & 3) - 8, 0)) { |
788 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, |
|
789 |
- s->linesize, ptr, |
|
790 |
- s->linesize, |
|
788 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, |
|
789 |
+ s->linesize, s->linesize, |
|
791 | 790 |
9, 9, |
792 | 791 |
src_x, src_y, |
793 | 792 |
s->h_edge_pos, |
... | ... |
@@ -724,15 +724,21 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type, |
724 | 724 |
uint8_t *uvbuf = s->edge_emu_buffer + 22 * s->linesize; |
725 | 725 |
|
726 | 726 |
srcY -= 2 + 2*s->linesize; |
727 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->linesize, srcY, s->linesize, |
|
728 |
- (width<<3)+6, (height<<3)+6, src_x - 2, src_y - 2, |
|
727 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, srcY, |
|
728 |
+ s->linesize, s->linesize, |
|
729 |
+ (width << 3) + 6, (height << 3) + 6, |
|
730 |
+ src_x - 2, src_y - 2, |
|
729 | 731 |
s->h_edge_pos, s->v_edge_pos); |
730 | 732 |
srcY = s->edge_emu_buffer + 2 + 2*s->linesize; |
731 |
- s->vdsp.emulated_edge_mc(uvbuf, s->uvlinesize, srcU, s->uvlinesize, |
|
732 |
- (width<<2)+1, (height<<2)+1, uvsrc_x, uvsrc_y, |
|
733 |
+ s->vdsp.emulated_edge_mc(uvbuf, srcU, |
|
734 |
+ s->uvlinesize, s->uvlinesize, |
|
735 |
+ (width << 2) + 1, (height << 2) + 1, |
|
736 |
+ uvsrc_x, uvsrc_y, |
|
733 | 737 |
s->h_edge_pos >> 1, s->v_edge_pos >> 1); |
734 |
- s->vdsp.emulated_edge_mc(uvbuf + 16, s->uvlinesize, srcV, s->uvlinesize, |
|
735 |
- (width<<2)+1, (height<<2)+1, uvsrc_x, uvsrc_y, |
|
738 |
+ s->vdsp.emulated_edge_mc(uvbuf + 16, srcV, |
|
739 |
+ s->uvlinesize, s->uvlinesize, |
|
740 |
+ (width << 2) + 1, (height << 2) + 1, |
|
741 |
+ uvsrc_x, uvsrc_y, |
|
736 | 742 |
s->h_edge_pos >> 1, s->v_edge_pos >> 1); |
737 | 743 |
srcU = uvbuf; |
738 | 744 |
srcV = uvbuf + 16; |
... | ... |
@@ -349,7 +349,8 @@ void ff_snow_pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, ptrdiff_t st |
349 | 349 |
src += sx + sy*stride; |
350 | 350 |
if( (unsigned)sx >= FFMAX(w - b_w - (HTAPS_MAX-2), 0) |
351 | 351 |
|| (unsigned)sy >= FFMAX(h - b_h - (HTAPS_MAX-2), 0)){ |
352 |
- s->vdsp.emulated_edge_mc(tmp + MB_SIZE, stride, src, stride, |
|
352 |
+ s->vdsp.emulated_edge_mc(tmp + MB_SIZE, src, |
|
353 |
+ stride, stride, |
|
353 | 354 |
b_w+HTAPS_MAX-1, b_h+HTAPS_MAX-1, |
354 | 355 |
sx, sy, w, h); |
355 | 356 |
src= tmp + MB_SIZE; |
... | ... |
@@ -317,8 +317,8 @@ static inline void svq3_mc_dir_part(SVQ3Context *s, |
317 | 317 |
src = pic->f.data[0] + mx + my * h->linesize; |
318 | 318 |
|
319 | 319 |
if (emu) { |
320 |
- h->vdsp.emulated_edge_mc(h->edge_emu_buffer, h->linesize, |
|
321 |
- src, h->linesize, |
|
320 |
+ h->vdsp.emulated_edge_mc(h->edge_emu_buffer, src, |
|
321 |
+ h->linesize, h->linesize, |
|
322 | 322 |
width + 1, height + 1, |
323 | 323 |
mx, my, s->h_edge_pos, s->v_edge_pos); |
324 | 324 |
src = h->edge_emu_buffer; |
... | ... |
@@ -344,8 +344,8 @@ static inline void svq3_mc_dir_part(SVQ3Context *s, |
344 | 344 |
src = pic->f.data[i] + mx + my * h->uvlinesize; |
345 | 345 |
|
346 | 346 |
if (emu) { |
347 |
- h->vdsp.emulated_edge_mc(h->edge_emu_buffer, h->uvlinesize, |
|
348 |
- src, h->uvlinesize, |
|
347 |
+ h->vdsp.emulated_edge_mc(h->edge_emu_buffer, src, |
|
348 |
+ h->uvlinesize, h->uvlinesize, |
|
349 | 349 |
width + 1, height + 1, |
350 | 350 |
mx, my, (s->h_edge_pos >> 1), |
351 | 351 |
s->v_edge_pos >> 1); |
... | ... |
@@ -454,17 +454,21 @@ static void vc1_mc_1mv(VC1Context *v, int dir) |
454 | 454 |
uint8_t *uvbuf = s->edge_emu_buffer + 19 * s->linesize; |
455 | 455 |
|
456 | 456 |
srcY -= s->mspel * (1 + s->linesize); |
457 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->linesize, |
|
458 |
- srcY, s->linesize, |
|
457 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, srcY, |
|
458 |
+ s->linesize, s->linesize, |
|
459 | 459 |
17 + s->mspel * 2, 17 + s->mspel * 2, |
460 | 460 |
src_x - s->mspel, src_y - s->mspel, |
461 | 461 |
s->h_edge_pos, v_edge_pos); |
462 | 462 |
srcY = s->edge_emu_buffer; |
463 |
- s->vdsp.emulated_edge_mc(uvbuf, s->uvlinesize, srcU, s->uvlinesize, |
|
464 |
- 8 + 1, 8 + 1, uvsrc_x, uvsrc_y, |
|
463 |
+ s->vdsp.emulated_edge_mc(uvbuf, srcU, |
|
464 |
+ s->uvlinesize, s->uvlinesize, |
|
465 |
+ 8 + 1, 8 + 1, |
|
466 |
+ uvsrc_x, uvsrc_y, |
|
465 | 467 |
s->h_edge_pos >> 1, v_edge_pos >> 1); |
466 |
- s->vdsp.emulated_edge_mc(uvbuf + 16, s->uvlinesize, srcV, s->uvlinesize, |
|
467 |
- 8 + 1, 8 + 1, uvsrc_x, uvsrc_y, |
|
468 |
+ s->vdsp.emulated_edge_mc(uvbuf + 16, srcV, |
|
469 |
+ s->uvlinesize, s->uvlinesize, |
|
470 |
+ 8 + 1, 8 + 1, |
|
471 |
+ uvsrc_x, uvsrc_y, |
|
468 | 472 |
s->h_edge_pos >> 1, v_edge_pos >> 1); |
469 | 473 |
srcU = uvbuf; |
470 | 474 |
srcV = uvbuf + 16; |
... | ... |
@@ -700,7 +704,8 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg) |
700 | 700 |
|| (unsigned)(src_y - (s->mspel << fieldmv)) > v_edge_pos - (my & 3) - ((8 + s->mspel * 2) << fieldmv)) { |
701 | 701 |
srcY -= s->mspel * (1 + (s->linesize << fieldmv)); |
702 | 702 |
/* check emulate edge stride and offset */ |
703 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->linesize, srcY, s->linesize, |
|
703 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, srcY, |
|
704 |
+ s->linesize, s->linesize, |
|
704 | 705 |
9 + s->mspel * 2, (9 + s->mspel * 2) << fieldmv, |
705 | 706 |
src_x - s->mspel, src_y - (s->mspel << fieldmv), |
706 | 707 |
s->h_edge_pos, v_edge_pos); |
... | ... |
@@ -915,11 +920,13 @@ static void vc1_mc_4mv_chroma(VC1Context *v, int dir) |
915 | 915 |
|| s->h_edge_pos < 18 || v_edge_pos < 18 |
916 | 916 |
|| (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 9 |
917 | 917 |
|| (unsigned)uvsrc_y > (v_edge_pos >> 1) - 9) { |
918 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->uvlinesize, srcU, |
|
919 |
- s->uvlinesize, 8 + 1, 8 + 1, uvsrc_x, uvsrc_y, |
|
918 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, srcU, |
|
919 |
+ s->uvlinesize, s->uvlinesize, |
|
920 |
+ 8 + 1, 8 + 1, uvsrc_x, uvsrc_y, |
|
920 | 921 |
s->h_edge_pos >> 1, v_edge_pos >> 1); |
921 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer + 16, s->uvlinesize, srcV, |
|
922 |
- s->uvlinesize, 8 + 1, 8 + 1, uvsrc_x, uvsrc_y, |
|
922 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer + 16, srcV, |
|
923 |
+ s->uvlinesize, s->uvlinesize, |
|
924 |
+ 8 + 1, 8 + 1, uvsrc_x, uvsrc_y, |
|
923 | 925 |
s->h_edge_pos >> 1, v_edge_pos >> 1); |
924 | 926 |
srcU = s->edge_emu_buffer; |
925 | 927 |
srcV = s->edge_emu_buffer + 16; |
... | ... |
@@ -1036,12 +1043,14 @@ static void vc1_mc_4mv_chroma4(VC1Context *v, int dir, int dir2, int avg) |
1036 | 1036 |
|| s->h_edge_pos < 10 || v_edge_pos < (5 << fieldmv) |
1037 | 1037 |
|| (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 5 |
1038 | 1038 |
|| (unsigned)uvsrc_y > v_edge_pos - (5 << fieldmv)) { |
1039 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->uvlinesize, srcU, |
|
1040 |
- s->uvlinesize, 5, (5 << fieldmv), uvsrc_x, |
|
1041 |
- uvsrc_y, s->h_edge_pos >> 1, v_edge_pos); |
|
1042 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer + 16, s->uvlinesize, srcV, |
|
1043 |
- s->uvlinesize, 5, (5 << fieldmv), uvsrc_x, |
|
1044 |
- uvsrc_y, s->h_edge_pos >> 1, v_edge_pos); |
|
1039 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, srcU, |
|
1040 |
+ s->uvlinesize, s->uvlinesize, |
|
1041 |
+ 5, (5 << fieldmv), uvsrc_x, uvsrc_y, |
|
1042 |
+ s->h_edge_pos >> 1, v_edge_pos); |
|
1043 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer + 16, srcV, |
|
1044 |
+ s->uvlinesize, s->uvlinesize, |
|
1045 |
+ 5, (5 << fieldmv), uvsrc_x, uvsrc_y, |
|
1046 |
+ s->h_edge_pos >> 1, v_edge_pos); |
|
1045 | 1047 |
srcU = s->edge_emu_buffer; |
1046 | 1048 |
srcV = s->edge_emu_buffer + 16; |
1047 | 1049 |
|
... | ... |
@@ -1968,16 +1977,21 @@ static void vc1_interp_mc(VC1Context *v) |
1968 | 1968 |
uint8_t *uvbuf = s->edge_emu_buffer + 19 * s->linesize; |
1969 | 1969 |
|
1970 | 1970 |
srcY -= s->mspel * (1 + s->linesize); |
1971 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->linesize, srcY, s->linesize, |
|
1971 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, srcY, |
|
1972 |
+ s->linesize, s->linesize, |
|
1972 | 1973 |
17 + s->mspel * 2, 17 + s->mspel * 2, |
1973 | 1974 |
src_x - s->mspel, src_y - s->mspel, |
1974 | 1975 |
s->h_edge_pos, v_edge_pos); |
1975 | 1976 |
srcY = s->edge_emu_buffer; |
1976 |
- s->vdsp.emulated_edge_mc(uvbuf, s->uvlinesize, srcU, s->uvlinesize, |
|
1977 |
- 8 + 1, 8 + 1, uvsrc_x, uvsrc_y, |
|
1977 |
+ s->vdsp.emulated_edge_mc(uvbuf, srcU, |
|
1978 |
+ s->uvlinesize, s->uvlinesize, |
|
1979 |
+ 8 + 1, 8 + 1, |
|
1980 |
+ uvsrc_x, uvsrc_y, |
|
1978 | 1981 |
s->h_edge_pos >> 1, v_edge_pos >> 1); |
1979 |
- s->vdsp.emulated_edge_mc(uvbuf + 16, s->uvlinesize, srcV, s->uvlinesize, |
|
1980 |
- 8 + 1, 8 + 1, uvsrc_x, uvsrc_y, |
|
1982 |
+ s->vdsp.emulated_edge_mc(uvbuf + 16, srcV, |
|
1983 |
+ s->uvlinesize, s->uvlinesize, |
|
1984 |
+ 8 + 1, 8 + 1, |
|
1985 |
+ uvsrc_x, uvsrc_y, |
|
1981 | 1986 |
s->h_edge_pos >> 1, v_edge_pos >> 1); |
1982 | 1987 |
srcU = uvbuf; |
1983 | 1988 |
srcV = uvbuf + 16; |
... | ... |
@@ -30,8 +30,8 @@ |
30 | 30 |
#include <stdint.h> |
31 | 31 |
|
32 | 32 |
#define EMULATED_EDGE(depth) \ |
33 |
-void ff_emulated_edge_mc_ ## depth(uint8_t *dst, ptrdiff_t dst_stride, \ |
|
34 |
- const uint8_t *src, ptrdiff_t src_stride, \ |
|
33 |
+void ff_emulated_edge_mc_ ## depth(uint8_t *dst, const uint8_t *src, \ |
|
34 |
+ ptrdiff_t dst_stride, ptrdiff_t src_stride, \ |
|
35 | 35 |
int block_w, int block_h,\ |
36 | 36 |
int src_x, int src_y, int w, int h); |
37 | 37 |
|
... | ... |
@@ -47,8 +47,10 @@ typedef struct VideoDSPContext { |
47 | 47 |
* @param dst_stride number of bytes between 2 vertically adjacent samples |
48 | 48 |
* in destination buffer |
49 | 49 |
* @param src source buffer |
50 |
- * @param src_stride number of bytes between 2 vertically adjacent samples |
|
51 |
- * in source buffer |
|
50 |
+ * @param dst_linesize number of bytes between 2 vertically adjacent |
|
51 |
+ * samples in the destination buffer |
|
52 |
+ * @param src_linesize number of bytes between 2 vertically adjacent |
|
53 |
+ * samples in both the source buffer |
|
52 | 54 |
* @param block_w width of block |
53 | 55 |
* @param block_h height of block |
54 | 56 |
* @param src_x x coordinate of the top left sample of the block in the |
... | ... |
@@ -58,8 +60,9 @@ typedef struct VideoDSPContext { |
58 | 58 |
* @param w width of the source buffer |
59 | 59 |
* @param h height of the source buffer |
60 | 60 |
*/ |
61 |
- void (*emulated_edge_mc)(uint8_t *dst, ptrdiff_t dst_stride, |
|
62 |
- const uint8_t *src, ptrdiff_t src_stride, |
|
61 |
+ void (*emulated_edge_mc)(uint8_t *dst, const uint8_t *src, |
|
62 |
+ ptrdiff_t dst_linesize, |
|
63 |
+ ptrdiff_t src_linesize, |
|
63 | 64 |
int block_w, int block_h, |
64 | 65 |
int src_x, int src_y, int w, int h); |
65 | 66 |
|
... | ... |
@@ -20,8 +20,9 @@ |
20 | 20 |
*/ |
21 | 21 |
|
22 | 22 |
#include "bit_depth_template.c" |
23 |
-void FUNC(ff_emulated_edge_mc)(uint8_t *buf, ptrdiff_t buf_stride, |
|
24 |
- const uint8_t *src, ptrdiff_t src_stride, |
|
23 |
+void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src, |
|
24 |
+ ptrdiff_t buf_linesize, |
|
25 |
+ ptrdiff_t src_linesize, |
|
25 | 26 |
int block_w, int block_h, |
26 | 27 |
int src_x, int src_y, int w, int h) |
27 | 28 |
{ |
... | ... |
@@ -32,12 +33,12 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, ptrdiff_t buf_stride, |
32 | 32 |
return; |
33 | 33 |
|
34 | 34 |
if (src_y >= h) { |
35 |
- src -= src_y * src_stride; |
|
36 |
- src += (h - 1) * src_stride; |
|
35 |
+ src -= src_y * src_linesize; |
|
36 |
+ src += (h - 1) * src_linesize; |
|
37 | 37 |
src_y = h - 1; |
38 | 38 |
} else if (src_y <= -block_h) { |
39 |
- src -= src_y * src_stride; |
|
40 |
- src += (1 - block_h) * src_stride; |
|
39 |
+ src -= src_y * src_linesize; |
|
40 |
+ src += (1 - block_h) * src_linesize; |
|
41 | 41 |
src_y = 1 - block_h; |
42 | 42 |
} |
43 | 43 |
if (src_x >= w) { |
... | ... |
@@ -56,30 +57,30 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, ptrdiff_t buf_stride, |
56 | 56 |
av_assert2(start_x < end_x && block_w); |
57 | 57 |
|
58 | 58 |
w = end_x - start_x; |
59 |
- src += start_y * src_stride + start_x * sizeof(pixel); |
|
59 |
+ src += start_y * src_linesize + start_x * sizeof(pixel); |
|
60 | 60 |
buf += start_x * sizeof(pixel); |
61 | 61 |
|
62 | 62 |
// top |
63 | 63 |
for (y = 0; y < start_y; y++) { |
64 | 64 |
memcpy(buf, src, w * sizeof(pixel)); |
65 |
- buf += buf_stride; |
|
65 |
+ buf += buf_linesize; |
|
66 | 66 |
} |
67 | 67 |
|
68 | 68 |
// copy existing part |
69 | 69 |
for (; y < end_y; y++) { |
70 | 70 |
memcpy(buf, src, w * sizeof(pixel)); |
71 |
- src += src_stride; |
|
72 |
- buf += buf_stride; |
|
71 |
+ src += src_linesize; |
|
72 |
+ buf += buf_linesize; |
|
73 | 73 |
} |
74 | 74 |
|
75 | 75 |
// bottom |
76 |
- src -= src_stride; |
|
76 |
+ src -= src_linesize; |
|
77 | 77 |
for (; y < block_h; y++) { |
78 | 78 |
memcpy(buf, src, w * sizeof(pixel)); |
79 |
- buf += buf_stride; |
|
79 |
+ buf += buf_linesize; |
|
80 | 80 |
} |
81 | 81 |
|
82 |
- buf -= block_h * buf_stride + start_x * sizeof(pixel); |
|
82 |
+ buf -= block_h * buf_linesize + start_x * sizeof(pixel); |
|
83 | 83 |
while (block_h--) { |
84 | 84 |
pixel *bufp = (pixel *) buf; |
85 | 85 |
|
... | ... |
@@ -92,6 +93,6 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, ptrdiff_t buf_stride, |
92 | 92 |
for (x = end_x; x < block_w; x++) { |
93 | 93 |
bufp[x] = bufp[end_x - 1]; |
94 | 94 |
} |
95 |
- buf += buf_stride; |
|
95 |
+ buf += buf_linesize; |
|
96 | 96 |
} |
97 | 97 |
} |
... | ... |
@@ -1549,10 +1549,11 @@ static void render_slice(Vp3DecodeContext *s, int slice) |
1549 | 1549 |
uint8_t *temp= s->edge_emu_buffer; |
1550 | 1550 |
if(stride<0) temp -= 8*stride; |
1551 | 1551 |
|
1552 |
- s->vdsp.emulated_edge_mc(temp, stride, |
|
1553 |
- motion_source, stride, |
|
1552 |
+ s->vdsp.emulated_edge_mc(temp, motion_source, |
|
1553 |
+ stride, stride, |
|
1554 | 1554 |
9, 9, src_x, src_y, |
1555 |
- plane_width, plane_height); |
|
1555 |
+ plane_width, |
|
1556 |
+ plane_height); |
|
1556 | 1557 |
motion_source= temp; |
1557 | 1558 |
} |
1558 | 1559 |
} |
... | ... |
@@ -339,11 +339,12 @@ static void vp56_mc(VP56Context *s, int b, int plane, uint8_t *src, |
339 | 339 |
|
340 | 340 |
if (x<0 || x+12>=s->plane_width[plane] || |
341 | 341 |
y<0 || y+12>=s->plane_height[plane]) { |
342 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, stride, |
|
343 |
- src + s->block_offset[b] + (dy-2)*stride + (dx-2), |
|
344 |
- stride, 12, 12, x, y, |
|
345 |
- s->plane_width[plane], |
|
346 |
- s->plane_height[plane]); |
|
342 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, |
|
343 |
+ src + s->block_offset[b] + (dy-2)*stride + (dx-2), |
|
344 |
+ stride, stride, |
|
345 |
+ 12, 12, x, y, |
|
346 |
+ s->plane_width[plane], |
|
347 |
+ s->plane_height[plane]); |
|
347 | 348 |
src_block = s->edge_emu_buffer; |
348 | 349 |
src_offset = 2 + 2*stride; |
349 | 350 |
} else if (deblock_filtering) { |
... | ... |
@@ -1196,8 +1196,9 @@ void vp8_mc_luma(VP8Context *s, VP8ThreadData *td, uint8_t *dst, |
1196 | 1196 |
src += y_off * linesize + x_off; |
1197 | 1197 |
if (x_off < mx_idx || x_off >= width - block_w - subpel_idx[2][mx] || |
1198 | 1198 |
y_off < my_idx || y_off >= height - block_h - subpel_idx[2][my]) { |
1199 |
- s->vdsp.emulated_edge_mc(td->edge_emu_buffer, 32, |
|
1200 |
- src - my_idx * linesize - mx_idx, linesize, |
|
1199 |
+ s->vdsp.emulated_edge_mc(td->edge_emu_buffer, |
|
1200 |
+ src - my_idx * linesize - mx_idx, |
|
1201 |
+ 32, linesize, |
|
1201 | 1202 |
block_w + subpel_idx[1][mx], |
1202 | 1203 |
block_h + subpel_idx[1][my], |
1203 | 1204 |
x_off - mx_idx, y_off - my_idx, width, height); |
... | ... |
@@ -1249,16 +1250,18 @@ void vp8_mc_chroma(VP8Context *s, VP8ThreadData *td, uint8_t *dst1, uint8_t *dst |
1249 | 1249 |
ff_thread_await_progress(ref, (3 + y_off + block_h + subpel_idx[2][my]) >> 3, 0); |
1250 | 1250 |
if (x_off < mx_idx || x_off >= width - block_w - subpel_idx[2][mx] || |
1251 | 1251 |
y_off < my_idx || y_off >= height - block_h - subpel_idx[2][my]) { |
1252 |
- s->vdsp.emulated_edge_mc(td->edge_emu_buffer, 32, |
|
1253 |
- src1 - my_idx * linesize - mx_idx, linesize, |
|
1252 |
+ s->vdsp.emulated_edge_mc(td->edge_emu_buffer, |
|
1253 |
+ src1 - my_idx * linesize - mx_idx, |
|
1254 |
+ 32, linesize, |
|
1254 | 1255 |
block_w + subpel_idx[1][mx], |
1255 | 1256 |
block_h + subpel_idx[1][my], |
1256 | 1257 |
x_off - mx_idx, y_off - my_idx, width, height); |
1257 | 1258 |
src1 = td->edge_emu_buffer + mx_idx + 32 * my_idx; |
1258 | 1259 |
mc_func[my_idx][mx_idx](dst1, linesize, src1, 32, block_h, mx, my); |
1259 | 1260 |
|
1260 |
- s->vdsp.emulated_edge_mc(td->edge_emu_buffer, 32, |
|
1261 |
- src2 - my_idx * linesize - mx_idx, linesize, |
|
1261 |
+ s->vdsp.emulated_edge_mc(td->edge_emu_buffer, |
|
1262 |
+ src2 - my_idx * linesize - mx_idx, |
|
1263 |
+ 32, linesize, |
|
1262 | 1264 |
block_w + subpel_idx[1][mx], |
1263 | 1265 |
block_h + subpel_idx[1][my], |
1264 | 1266 |
x_off - mx_idx, y_off - my_idx, width, height); |
... | ... |
@@ -2223,9 +2223,9 @@ static av_always_inline void mc_luma_dir(VP9Context *s, vp9_mc_func (*mc)[2], |
2223 | 2223 |
// FIXME bilinear filter only needs 0/1 pixels, not 3/4 |
2224 | 2224 |
if (x < !!mx * 3 || y < !!my * 3 || |
2225 | 2225 |
x + !!mx * 4 > w - bw || y + !!my * 4 > h - bh) { |
2226 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, 80, |
|
2226 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, |
|
2227 | 2227 |
ref - !!my * 3 * ref_stride - !!mx * 3, |
2228 |
- ref_stride, |
|
2228 |
+ 80, ref_stride, |
|
2229 | 2229 |
bw + !!mx * 7, bh + !!my * 7, |
2230 | 2230 |
x - !!mx * 3, y - !!my * 3, w, h); |
2231 | 2231 |
ref = s->edge_emu_buffer + !!my * 3 * 80 + !!mx * 3; |
... | ... |
@@ -2253,15 +2253,17 @@ static av_always_inline void mc_chroma_dir(VP9Context *s, vp9_mc_func (*mc)[2], |
2253 | 2253 |
// FIXME bilinear filter only needs 0/1 pixels, not 3/4 |
2254 | 2254 |
if (x < !!mx * 3 || y < !!my * 3 || |
2255 | 2255 |
x + !!mx * 4 > w - bw || y + !!my * 4 > h - bh) { |
2256 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, 80, |
|
2257 |
- ref_u - !!my * 3 * src_stride_u - !!mx * 3, src_stride_u, |
|
2256 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, |
|
2257 |
+ ref_u - !!my * 3 * src_stride_u - !!mx * 3, |
|
2258 |
+ 80, src_stride_u, |
|
2258 | 2259 |
bw + !!mx * 7, bh + !!my * 7, |
2259 | 2260 |
x - !!mx * 3, y - !!my * 3, w, h); |
2260 | 2261 |
ref_u = s->edge_emu_buffer + !!my * 3 * 80 + !!mx * 3; |
2261 | 2262 |
mc[!!mx][!!my](dst_u, dst_stride, ref_u, 80, bh, mx, my); |
2262 | 2263 |
|
2263 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, 80, |
|
2264 |
- ref_v - !!my * 3 * src_stride_v - !!mx * 3, src_stride_v, |
|
2264 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, |
|
2265 |
+ ref_v - !!my * 3 * src_stride_v - !!mx * 3, |
|
2266 |
+ 80, src_stride_v, |
|
2265 | 2267 |
bw + !!mx * 7, bh + !!my * 7, |
2266 | 2268 |
x - !!mx * 3, y - !!my * 3, w, h); |
2267 | 2269 |
ref_v = s->edge_emu_buffer + !!my * 3 * 80 + !!mx * 3; |
... | ... |
@@ -119,9 +119,11 @@ void ff_mspel_motion(MpegEncContext *s, |
119 | 119 |
|
120 | 120 |
if(src_x<1 || src_y<1 || src_x + 17 >= s->h_edge_pos |
121 | 121 |
|| src_y + h+1 >= v_edge_pos){ |
122 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->linesize, |
|
123 |
- ptr - 1 - s->linesize, s->linesize, 19, 19, |
|
124 |
- src_x-1, src_y-1, |
|
122 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, |
|
123 |
+ ptr - 1 - s->linesize, |
|
124 |
+ s->linesize, s->linesize, |
|
125 |
+ 19, 19, |
|
126 |
+ src_x - 1, src_y - 1, |
|
125 | 127 |
s->h_edge_pos, s->v_edge_pos); |
126 | 128 |
ptr= s->edge_emu_buffer + 1 + s->linesize; |
127 | 129 |
emu=1; |
... | ... |
@@ -161,18 +163,22 @@ void ff_mspel_motion(MpegEncContext *s, |
161 | 161 |
offset = (src_y * uvlinesize) + src_x; |
162 | 162 |
ptr = ref_picture[1] + offset; |
163 | 163 |
if(emu){ |
164 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->uvlinesize, |
|
165 |
- ptr, s->uvlinesize, 9, 9, src_x, src_y, |
|
166 |
- s->h_edge_pos>>1, s->v_edge_pos>>1); |
|
164 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, |
|
165 |
+ s->uvlinesize, s->uvlinesize, |
|
166 |
+ 9, 9, |
|
167 |
+ src_x, src_y, |
|
168 |
+ s->h_edge_pos >> 1, s->v_edge_pos >> 1); |
|
167 | 169 |
ptr= s->edge_emu_buffer; |
168 | 170 |
} |
169 | 171 |
pix_op[1][dxy](dest_cb, ptr, uvlinesize, h >> 1); |
170 | 172 |
|
171 | 173 |
ptr = ref_picture[2] + offset; |
172 | 174 |
if(emu){ |
173 |
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->uvlinesize, |
|
174 |
- ptr, s->uvlinesize, 9, 9, src_x, src_y, |
|
175 |
- s->h_edge_pos>>1, s->v_edge_pos>>1); |
|
175 |
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, |
|
176 |
+ s->uvlinesize, s->uvlinesize, |
|
177 |
+ 9, 9, |
|
178 |
+ src_x, src_y, |
|
179 |
+ s->h_edge_pos >> 1, s->v_edge_pos >> 1); |
|
176 | 180 |
ptr= s->edge_emu_buffer; |
177 | 181 |
} |
178 | 182 |
pix_op[1][dxy](dest_cr, ptr, uvlinesize, h >> 1); |
... | ... |
@@ -367,8 +367,9 @@ void ff_draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, |
367 | 367 |
} |
368 | 368 |
} |
369 | 369 |
|
370 |
-typedef void emulated_edge_mc_func(uint8_t *dst, ptrdiff_t dst_stride, |
|
371 |
- const uint8_t *src, ptrdiff_t src_linesize, |
|
370 |
+typedef void emulated_edge_mc_func(uint8_t *dst, const uint8_t *src, |
|
371 |
+ ptrdiff_t dst_stride, |
|
372 |
+ ptrdiff_t src_linesize, |
|
372 | 373 |
int block_w, int block_h, |
373 | 374 |
int src_x, int src_y, int w, int h); |
374 | 375 |
|
... | ... |
@@ -417,7 +418,7 @@ static av_always_inline void gmc(uint8_t *dst, uint8_t *src, |
417 | 417 |
|
418 | 418 |
src += ix + iy * stride; |
419 | 419 |
if (need_emu) { |
420 |
- emu_edge_fn(edge_buf, stride, src, stride, w + 1, h + 1, ix, iy, width, height); |
|
420 |
+ emu_edge_fn(edge_buf, src, stride, stride, w + 1, h + 1, ix, iy, width, height); |
|
421 | 421 |
src = edge_buf; |
422 | 422 |
} |
423 | 423 |
|
... | ... |
@@ -129,8 +129,9 @@ static emu_edge_hfix_func *hfixtbl_sse2[11] = { |
129 | 129 |
}; |
130 | 130 |
extern emu_edge_hvar_func ff_emu_edge_hvar_sse2; |
131 | 131 |
|
132 |
-static av_always_inline void emulated_edge_mc(uint8_t *dst, ptrdiff_t dst_stride, |
|
133 |
- const uint8_t *src, ptrdiff_t src_stride, |
|
132 |
+static av_always_inline void emulated_edge_mc(uint8_t *dst, const uint8_t *src, |
|
133 |
+ ptrdiff_t dst_stride, |
|
134 |
+ ptrdiff_t src_stride, |
|
134 | 135 |
x86_reg block_w, x86_reg block_h, |
135 | 136 |
x86_reg src_x, x86_reg src_y, |
136 | 137 |
x86_reg w, x86_reg h, |
... | ... |
@@ -141,7 +142,7 @@ static av_always_inline void emulated_edge_mc(uint8_t *dst, ptrdiff_t dst_stride |
141 | 141 |
{ |
142 | 142 |
x86_reg start_y, start_x, end_y, end_x, src_y_add = 0, p; |
143 | 143 |
|
144 |
- if(!w || !h) |
|
144 |
+ if (!w || !h) |
|
145 | 145 |
return; |
146 | 146 |
|
147 | 147 |
if (src_y >= h) { |
... | ... |
@@ -203,34 +204,37 @@ static av_always_inline void emulated_edge_mc(uint8_t *dst, ptrdiff_t dst_stride |
203 | 203 |
} |
204 | 204 |
|
205 | 205 |
#if ARCH_X86_32 |
206 |
-static av_noinline void emulated_edge_mc_mmx(uint8_t *buf, ptrdiff_t buf_stride, |
|
207 |
- const uint8_t *src, ptrdiff_t src_stride, |
|
206 |
+static av_noinline void emulated_edge_mc_mmx(uint8_t *buf, const uint8_t *src, |
|
207 |
+ ptrdiff_t buf_stride, |
|
208 |
+ ptrdiff_t src_stride, |
|
208 | 209 |
int block_w, int block_h, |
209 | 210 |
int src_x, int src_y, int w, int h) |
210 | 211 |
{ |
211 |
- emulated_edge_mc(buf, buf_stride, src, src_stride, block_w, block_h, |
|
212 |
+ emulated_edge_mc(buf, src, buf_stride, src_stride, block_w, block_h, |
|
212 | 213 |
src_x, src_y, w, h, vfixtbl_mmx, &ff_emu_edge_vvar_mmx, |
213 | 214 |
hfixtbl_mmx, &ff_emu_edge_hvar_mmx); |
214 | 215 |
} |
215 | 216 |
|
216 |
-static av_noinline void emulated_edge_mc_sse(uint8_t *buf, ptrdiff_t buf_stride, |
|
217 |
- const uint8_t *src, ptrdiff_t src_stride, |
|
217 |
+static av_noinline void emulated_edge_mc_sse(uint8_t *buf, const uint8_t *src, |
|
218 |
+ ptrdiff_t buf_stride, |
|
219 |
+ ptrdiff_t src_stride, |
|
218 | 220 |
int block_w, int block_h, |
219 | 221 |
int src_x, int src_y, int w, int h) |
220 | 222 |
{ |
221 |
- emulated_edge_mc(buf, buf_stride, src, src_stride, block_w, block_h, |
|
223 |
+ emulated_edge_mc(buf, src, buf_stride, src_stride, block_w, block_h, |
|
222 | 224 |
src_x, src_y, w, h, vfixtbl_sse, &ff_emu_edge_vvar_sse, |
223 | 225 |
hfixtbl_mmx, &ff_emu_edge_hvar_mmx); |
224 | 226 |
} |
225 | 227 |
#endif |
226 | 228 |
|
227 |
-static av_noinline void emulated_edge_mc_sse2(uint8_t *buf, ptrdiff_t buf_stride, |
|
228 |
- const uint8_t *src, ptrdiff_t src_stride, |
|
229 |
+static av_noinline void emulated_edge_mc_sse2(uint8_t *buf, const uint8_t *src, |
|
230 |
+ ptrdiff_t buf_stride, |
|
231 |
+ ptrdiff_t src_stride, |
|
229 | 232 |
int block_w, int block_h, |
230 | 233 |
int src_x, int src_y, int w, int h) |
231 | 234 |
{ |
232 |
- emulated_edge_mc(buf, buf_stride, src, src_stride, block_w, block_h, src_x, |
|
233 |
- src_y, w, h, vfixtbl_sse, &ff_emu_edge_vvar_sse, |
|
235 |
+ emulated_edge_mc(buf, src, buf_stride, src_stride, block_w, block_h, |
|
236 |
+ src_x, src_y, w, h, vfixtbl_sse, &ff_emu_edge_vvar_sse, |
|
234 | 237 |
hfixtbl_sse2, &ff_emu_edge_hvar_sse2); |
235 | 238 |
} |
236 | 239 |
#endif /* HAVE_YASM */ |