Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void FUNC(put_unweighted_pred)(uint8_t *_dst, ptrdiff_t _dststride,
- int16_t *src, ptrdiff_t srcstride,
- int width, int height)
- {
- int x, y;
- pixel *dst = (pixel *)_dst;
- ptrdiff_t dststride = _dststride / sizeof(pixel);
- int shift = 14 - BIT_DEPTH;
- #if BIT_DEPTH < 14
- int offset = 1 << (shift - 1);
- #else
- int offset = 0;
- #endif
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++)
- dst[x] = av_clip_pixel((src[x] + offset) >> shift);
- dst += dststride;
- src += srcstride;
- }
- }
- static void FUNC(put_weighted_pred_avg)(uint8_t *_dst, ptrdiff_t _dststride,
- int16_t *src1, int16_t *src2,
- ptrdiff_t srcstride,
- int width, int height)
- {
- int x, y;
- pixel *dst = (pixel *)_dst;
- ptrdiff_t dststride = _dststride / sizeof(pixel);
- int shift = 14 + 1 - BIT_DEPTH;
- #if BIT_DEPTH < 14
- int offset = 1 << (shift - 1);
- #else
- int offset = 0;
- #endif
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++)
- dst[x] = av_clip_pixel((src1[x] + src2[x] + offset) >> shift);
- dst += dststride;
- src1 += srcstride;
- src2 += srcstride;
- }
- }
- static void FUNC(weighted_pred)(uint8_t denom, int16_t wlxFlag, int16_t olxFlag,
- uint8_t *_dst, ptrdiff_t _dststride,
- int16_t *src, ptrdiff_t srcstride,
- int width, int height)
- {
- int shift, wx, ox, x, y, offset;
- pixel *dst = (pixel *)_dst;
- ptrdiff_t dststride = _dststride / sizeof(pixel);
- shift = denom + 14 - BIT_DEPTH;
- if (shift >= 1) {
- offset = 1 << (shift - 1);
- } else {
- shift = 0;
- offset = 0;
- }
- wx = wlxFlag;
- ox = olxFlag * (1 << (BIT_DEPTH - 8));
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- dst[x] = av_clip_pixel(((src[x] * wx + offset) >> shift) + ox);
- }
- dst += dststride;
- src += srcstride;
- }
- }
- static void FUNC(weighted_pred_avg)(uint8_t denom,
- int16_t wl0Flag, int16_t wl1Flag,
- int16_t ol0Flag, int16_t ol1Flag,
- uint8_t *_dst, ptrdiff_t _dststride,
- int16_t *src1, int16_t *src2,
- ptrdiff_t srcstride,
- int width, int height)
- {
- int shift, log2Wd, w0, w1, o0, o1, x, y;
- pixel *dst = (pixel *)_dst;
- ptrdiff_t dststride = _dststride / sizeof(pixel);
- shift = 14 - BIT_DEPTH;
- log2Wd = denom + shift;
- w0 = wl0Flag;
- w1 = wl1Flag;
- o0 = ol0Flag * (1 << (BIT_DEPTH - 8));
- o1 = ol1Flag * (1 << (BIT_DEPTH - 8));
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++)
- dst[x] = av_clip_pixel((src1[x] * w0 + src2[x] * w1 +
- ((o0 + o1 + 1) << log2Wd)) >> (log2Wd + 1));
- dst += dststride;
- src1 += srcstride;
- src2 += srcstride;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement