c->clear_blocks = FUNCC(clear_blocks ## dct , depth);\
c->add_pixels8 = FUNCC(add_pixels8 ## dct , depth);\
c->add_pixels4 = FUNCC(add_pixels4 ## dct , depth);\
- c->put_no_rnd_pixels_l2 = FUNCC(put_no_rnd_pixels8_l2 , depth);\
\
c->put_h264_chroma_pixels_tab[0] = FUNCC(put_h264_chroma_mc8 , depth);\
c->put_h264_chroma_pixels_tab[1] = FUNCC(put_h264_chroma_mc4 , depth);\
*/
op_pixels_func avg_no_rnd_pixels_tab[4][4];
- void (*put_no_rnd_pixels_l2)(uint8_t *block/*align 8*/, const uint8_t *a/*align 1*/, const uint8_t *b/*align 1*/, int line_size, int h);
-
/**
* Thirdpel motion compensation with rounding (a+b+1)>>1.
* this is an array[12] of motion compensation functions for the 9 thirdpe
#define put_no_rnd_pixels8_c put_pixels8_c
#define put_no_rnd_pixels16_c put_pixels16_c
-static void FUNCC(put_no_rnd_pixels8_l2)(uint8_t *dst, const uint8_t *a, const uint8_t *b, int stride, int h){
- FUNC(put_no_rnd_pixels8_l2)(dst, a, b, stride, stride, stride, h);
-}
-
#define H264_CHROMA_MC(OPNAME, OP)\
static void FUNCC(OPNAME ## h264_chroma_mc2)(uint8_t *_dst/*align 8*/, uint8_t *_src/*align 1*/, int stride, int h, int x, int y){\
pixel *dst = (pixel*)_dst;\
motion_source, stride, 8);
}else{
int d= (motion_x ^ motion_y)>>31; // d is 0 if motion_x and _y have the same sign, else -1
- s->dsp.put_no_rnd_pixels_l2(
+ s->vp3dsp.put_no_rnd_pixels_l2(
output_plane + first_pixel,
motion_source - d,
motion_source + stride + 1 + d,
}
}
+static void put_no_rnd_pixels_l2(uint8_t *dst, const uint8_t *src1,
+ const uint8_t *src2, ptrdiff_t stride, int h)
+{
+ int i;
+
+ for (i = 0; i < h; i++) {
+ uint32_t a, b;
+
+ a = AV_RN32A(&src1[i * stride]);
+ b = AV_RN32A(&src2[i * stride]);
+ AV_WN32A(&dst[i * stride], no_rnd_avg32(a, b));
+ a = AV_RN32A(&src1[i * stride + 4]);
+ b = AV_RN32A(&src2[i * stride + 4]);
+ AV_WN32A(&dst[i * stride + 4], no_rnd_avg32(a, b));
+ }
+}
+
av_cold void ff_vp3dsp_init(VP3DSPContext *c, int flags)
{
+ c->put_no_rnd_pixels_l2 = put_no_rnd_pixels_l2;
+
c->idct_put = vp3_idct_put_c;
c->idct_add = vp3_idct_add_c;
c->idct_dc_add = vp3_idct_dc_add_c;
#ifndef AVCODEC_VP3DSP_H
#define AVCODEC_VP3DSP_H
+#include <stddef.h>
#include <stdint.h>
#include "dsputil.h"
typedef struct VP3DSPContext {
+ /**
+ * Copy 8xH pixels from source to destination buffer using a bilinear
+ * filter with no rounding (i.e. *dst = (*a + *b) >> 1).
+ *
+ * @param dst destination buffer, aligned by 8
+ * @param a first source buffer, no alignment
+ * @param b second source buffer, no alignment
+ * @param stride distance between two lines in source/dest buffers
+ * @param h height
+ */
+ void (*put_no_rnd_pixels_l2)(uint8_t *dst,
+ const uint8_t *a,
+ const uint8_t *b,
+ ptrdiff_t stride, int h);
+
void (*idct_put)(uint8_t *dest, int line_size, DCTELEM *block);
void (*idct_add)(uint8_t *dest, int line_size, DCTELEM *block);
void (*idct_dc_add)(uint8_t *dest, int line_size, DCTELEM *block);
s->filter(s, dst, src_block, src_offset, src_offset+overlap_offset,
stride, s->mv[b], mask, s->filter_selection, b<4);
else
- s->dsp.put_no_rnd_pixels_l2(dst, src_block+src_offset,
- src_block+src_offset+overlap_offset,
- stride, 8);
+ s->vp3dsp.put_no_rnd_pixels_l2(dst, src_block+src_offset,
+ src_block+src_offset+overlap_offset,
+ stride, 8);
} else {
s->dsp.put_pixels_tab[1][0](dst, src_block+src_offset, stride, 8);
}