Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2017-01-08 01:04:39 +0300
committerJames Almer <jamrial@gmail.com>2017-01-13 04:53:04 +0300
commit5ac1dd8e231987c022a860c6b1961b038a84b613 (patch)
tree594a5e75a7b36a95985fef7779071900a763266a /libavcodec/huffyuvdec.c
parent3222786c5ad9f6ca94ca4cd80a4329a276d65aaa (diff)
lossless_videodsp: move shared functions from huffyuvdsp
Several codecs other than huffyuv use them. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/huffyuvdec.c')
-rw-r--r--libavcodec/huffyuvdec.c63
1 files changed, 32 insertions, 31 deletions
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 7314519fca..1b4112ce2f 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -36,6 +36,7 @@
#include "get_bits.h"
#include "huffyuv.h"
#include "huffyuvdsp.h"
+#include "lossless_videodsp.h"
#include "thread.h"
#include "libavutil/imgutils.h"
#include "libavutil/pixdesc.h"
@@ -878,7 +879,7 @@ static void draw_slice(HYuvContext *s, AVFrame *frame, int y)
static int left_prediction(HYuvContext *s, uint8_t *dst, const uint8_t *src, int w, int acc)
{
if (s->bps <= 8) {
- return s->hdsp.add_hfyu_left_pred(dst, src, w, acc);
+ return s->llviddsp.add_left_pred(dst, src, w, acc);
} else {
return s->llviddsp.add_hfyu_left_pred_int16(( uint16_t *)dst, (const uint16_t *)src, s->n-1, w, acc);
}
@@ -887,7 +888,7 @@ static int left_prediction(HYuvContext *s, uint8_t *dst, const uint8_t *src, int
static void add_bytes(HYuvContext *s, uint8_t *dst, uint8_t *src, int w)
{
if (s->bps <= 8) {
- s->hdsp.add_bytes(dst, src, w);
+ s->llviddsp.add_bytes(dst, src, w);
} else {
s->llviddsp.add_int16((uint16_t*)dst, (const uint16_t*)src, s->n - 1, w);
}
@@ -896,7 +897,7 @@ static void add_bytes(HYuvContext *s, uint8_t *dst, uint8_t *src, int w)
static void add_median_prediction(HYuvContext *s, uint8_t *dst, const uint8_t *src, const uint8_t *diff, int w, int *left, int *left_top)
{
if (s->bps <= 8) {
- s->hdsp.add_hfyu_median_pred(dst, src, diff, w, left, left_top);
+ s->llviddsp.add_median_pred(dst, src, diff, w, left, left_top);
} else {
s->llviddsp.add_hfyu_median_pred_int16((uint16_t *)dst, (const uint16_t *)src, (const uint16_t *)diff, s->n-1, w, left, left_top);
}
@@ -1038,11 +1039,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
case LEFT:
case PLANE:
decode_422_bitstream(s, width - 2);
- lefty = s->hdsp.add_hfyu_left_pred(p->data[0] + 2, s->temp[0],
+ lefty = s->llviddsp.add_left_pred(p->data[0] + 2, s->temp[0],
width - 2, lefty);
if (!(s->flags & AV_CODEC_FLAG_GRAY)) {
- leftu = s->hdsp.add_hfyu_left_pred(p->data[1] + 1, s->temp[1], width2 - 1, leftu);
- leftv = s->hdsp.add_hfyu_left_pred(p->data[2] + 1, s->temp[2], width2 - 1, leftv);
+ leftu = s->llviddsp.add_left_pred(p->data[1] + 1, s->temp[1], width2 - 1, leftu);
+ leftv = s->llviddsp.add_left_pred(p->data[2] + 1, s->temp[2], width2 - 1, leftv);
}
for (cy = y = 1; y < s->height; y++, cy++) {
@@ -1053,11 +1054,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
ydst = p->data[0] + p->linesize[0] * y;
- lefty = s->hdsp.add_hfyu_left_pred(ydst, s->temp[0],
+ lefty = s->llviddsp.add_left_pred(ydst, s->temp[0],
width, lefty);
if (s->predictor == PLANE) {
if (y > s->interlaced)
- s->hdsp.add_bytes(ydst, ydst - fake_ystride, width);
+ s->llviddsp.add_bytes(ydst, ydst - fake_ystride, width);
}
y++;
if (y >= s->height)
@@ -1071,18 +1072,18 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
vdst = p->data[2] + p->linesize[2] * cy;
decode_422_bitstream(s, width);
- lefty = s->hdsp.add_hfyu_left_pred(ydst, s->temp[0],
+ lefty = s->llviddsp.add_left_pred(ydst, s->temp[0],
width, lefty);
if (!(s->flags & AV_CODEC_FLAG_GRAY)) {
- leftu = s->hdsp.add_hfyu_left_pred(udst, s->temp[1], width2, leftu);
- leftv = s->hdsp.add_hfyu_left_pred(vdst, s->temp[2], width2, leftv);
+ leftu = s->llviddsp.add_left_pred(udst, s->temp[1], width2, leftu);
+ leftv = s->llviddsp.add_left_pred(vdst, s->temp[2], width2, leftv);
}
if (s->predictor == PLANE) {
if (cy > s->interlaced) {
- s->hdsp.add_bytes(ydst, ydst - fake_ystride, width);
+ s->llviddsp.add_bytes(ydst, ydst - fake_ystride, width);
if (!(s->flags & AV_CODEC_FLAG_GRAY)) {
- s->hdsp.add_bytes(udst, udst - fake_ustride, width2);
- s->hdsp.add_bytes(vdst, vdst - fake_vstride, width2);
+ s->llviddsp.add_bytes(udst, udst - fake_ustride, width2);
+ s->llviddsp.add_bytes(vdst, vdst - fake_vstride, width2);
}
}
}
@@ -1093,11 +1094,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
case MEDIAN:
/* first line except first 2 pixels is left predicted */
decode_422_bitstream(s, width - 2);
- lefty = s->hdsp.add_hfyu_left_pred(p->data[0] + 2, s->temp[0],
+ lefty = s->llviddsp.add_left_pred(p->data[0] + 2, s->temp[0],
width - 2, lefty);
if (!(s->flags & AV_CODEC_FLAG_GRAY)) {
- leftu = s->hdsp.add_hfyu_left_pred(p->data[1] + 1, s->temp[1], width2 - 1, leftu);
- leftv = s->hdsp.add_hfyu_left_pred(p->data[2] + 1, s->temp[2], width2 - 1, leftv);
+ leftu = s->llviddsp.add_left_pred(p->data[1] + 1, s->temp[1], width2 - 1, leftu);
+ leftv = s->llviddsp.add_left_pred(p->data[2] + 1, s->temp[2], width2 - 1, leftv);
}
cy = y = 1;
@@ -1105,11 +1106,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
/* second line is left predicted for interlaced case */
if (s->interlaced) {
decode_422_bitstream(s, width);
- lefty = s->hdsp.add_hfyu_left_pred(p->data[0] + p->linesize[0],
+ lefty = s->llviddsp.add_left_pred(p->data[0] + p->linesize[0],
s->temp[0], width, lefty);
if (!(s->flags & AV_CODEC_FLAG_GRAY)) {
- leftu = s->hdsp.add_hfyu_left_pred(p->data[1] + p->linesize[2], s->temp[1], width2, leftu);
- leftv = s->hdsp.add_hfyu_left_pred(p->data[2] + p->linesize[1], s->temp[2], width2, leftv);
+ leftu = s->llviddsp.add_left_pred(p->data[1] + p->linesize[2], s->temp[1], width2, leftu);
+ leftv = s->llviddsp.add_left_pred(p->data[2] + p->linesize[1], s->temp[2], width2, leftv);
}
y++;
cy++;
@@ -1117,24 +1118,24 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
/* next 4 pixels are left predicted too */
decode_422_bitstream(s, 4);
- lefty = s->hdsp.add_hfyu_left_pred(p->data[0] + fake_ystride,
+ lefty = s->llviddsp.add_left_pred(p->data[0] + fake_ystride,
s->temp[0], 4, lefty);
if (!(s->flags & AV_CODEC_FLAG_GRAY)) {
- leftu = s->hdsp.add_hfyu_left_pred(p->data[1] + fake_ustride, s->temp[1], 2, leftu);
- leftv = s->hdsp.add_hfyu_left_pred(p->data[2] + fake_vstride, s->temp[2], 2, leftv);
+ leftu = s->llviddsp.add_left_pred(p->data[1] + fake_ustride, s->temp[1], 2, leftu);
+ leftv = s->llviddsp.add_left_pred(p->data[2] + fake_vstride, s->temp[2], 2, leftv);
}
/* next line except the first 4 pixels is median predicted */
lefttopy = p->data[0][3];
decode_422_bitstream(s, width - 4);
- s->hdsp.add_hfyu_median_pred(p->data[0] + fake_ystride + 4,
+ s->llviddsp.add_median_pred(p->data[0] + fake_ystride + 4,
p->data[0] + 4, s->temp[0],
width - 4, &lefty, &lefttopy);
if (!(s->flags & AV_CODEC_FLAG_GRAY)) {
lefttopu = p->data[1][1];
lefttopv = p->data[2][1];
- s->hdsp.add_hfyu_median_pred(p->data[1] + fake_ustride + 2, p->data[1] + 2, s->temp[1], width2 - 2, &leftu, &lefttopu);
- s->hdsp.add_hfyu_median_pred(p->data[2] + fake_vstride + 2, p->data[2] + 2, s->temp[2], width2 - 2, &leftv, &lefttopv);
+ s->llviddsp.add_median_pred(p->data[1] + fake_ustride + 2, p->data[1] + 2, s->temp[1], width2 - 2, &leftu, &lefttopu);
+ s->llviddsp.add_median_pred(p->data[2] + fake_vstride + 2, p->data[2] + 2, s->temp[2], width2 - 2, &leftv, &lefttopv);
}
y++;
cy++;
@@ -1146,7 +1147,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
while (2 * cy > y) {
decode_gray_bitstream(s, width);
ydst = p->data[0] + p->linesize[0] * y;
- s->hdsp.add_hfyu_median_pred(ydst, ydst - fake_ystride,
+ s->llviddsp.add_median_pred(ydst, ydst - fake_ystride,
s->temp[0], width,
&lefty, &lefttopy);
y++;
@@ -1162,12 +1163,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
udst = p->data[1] + p->linesize[1] * cy;
vdst = p->data[2] + p->linesize[2] * cy;
- s->hdsp.add_hfyu_median_pred(ydst, ydst - fake_ystride,
+ s->llviddsp.add_median_pred(ydst, ydst - fake_ystride,
s->temp[0], width,
&lefty, &lefttopy);
if (!(s->flags & AV_CODEC_FLAG_GRAY)) {
- s->hdsp.add_hfyu_median_pred(udst, udst - fake_ustride, s->temp[1], width2, &leftu, &lefttopu);
- s->hdsp.add_hfyu_median_pred(vdst, vdst - fake_vstride, s->temp[2], width2, &leftv, &lefttopv);
+ s->llviddsp.add_median_pred(udst, udst - fake_ustride, s->temp[1], width2, &leftu, &lefttopu);
+ s->llviddsp.add_median_pred(vdst, vdst - fake_vstride, s->temp[2], width2, &leftv, &lefttopv);
}
}
@@ -1210,7 +1211,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if (s->bitstream_bpp != 32)
left[A] = 0;
if (y < s->height - 1 - s->interlaced) {
- s->hdsp.add_bytes(p->data[0] + p->linesize[0] * y,
+ s->llviddsp.add_bytes(p->data[0] + p->linesize[0] * y,
p->data[0] + p->linesize[0] * y +
fake_ystride, 4 * width);
}