diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-05-28 00:03:59 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-05-28 00:03:59 +0200 |
commit | 48a691630833d6b12905475b6bf39fef285872a9 (patch) | |
tree | aaeb0c4d73c6c0c72606aae3c4a1de62b17dc6e7 /libavcodec/huffyuvenc.c | |
parent | e2abc0d5cacc22aa900de8ac26160ea1b786a7b5 (diff) | |
parent | 512f3ffe9b4bb86767c2b1176554407c75fe1a5c (diff) | |
download | ffmpeg-48a691630833d6b12905475b6bf39fef285872a9.tar.gz |
Merge commit '512f3ffe9b4bb86767c2b1176554407c75fe1a5c'
* commit '512f3ffe9b4bb86767c2b1176554407c75fe1a5c':
dsputil: Split off HuffYUV encoding bits into their own context
Conflicts:
configure
libavcodec/dsputil.c
libavcodec/dsputil.h
libavcodec/huffyuv.h
libavcodec/huffyuvenc.c
libavcodec/pngenc.c
libavcodec/x86/dsputilenc_mmx.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/huffyuvenc.c')
-rw-r--r-- | libavcodec/huffyuvenc.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index 4a001b922c..653232f456 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -31,6 +31,7 @@ #include "avcodec.h" #include "huffyuv.h" #include "huffman.h" +#include "huffyuvencdsp.h" #include "internal.h" #include "put_bits.h" #include "libavutil/pixdesc.h" @@ -39,7 +40,7 @@ static inline void diff_bytes(HYuvContext *s, uint8_t *dst, const uint8_t *src0, const uint8_t *src1, int w) { if (s->bps <= 8) { - s->dsp.diff_bytes(dst, src0, src1, w); + s->hencdsp.diff_bytes(dst, src0, src1, w); } else { s->llviddsp.diff_int16((uint16_t *)dst, (const uint16_t *)src0, (const uint16_t *)src1, s->n - 1, w); } @@ -63,7 +64,7 @@ static inline int sub_left_prediction(HYuvContext *s, uint8_t *dst, dst[i] = temp - left; left = temp; } - s->dsp.diff_bytes(dst + 16, src + 16, src + 15, w - 16); + s->hencdsp.diff_bytes(dst + 16, src + 16, src + 15, w - 16); return src[w-1]; } } else { @@ -115,7 +116,7 @@ static inline void sub_left_prediction_bgr32(HYuvContext *s, uint8_t *dst, a = at; } - s->dsp.diff_bytes(dst + 16, src + 16, src + 12, w * 4 - 16); + s->hencdsp.diff_bytes(dst + 16, src + 16, src + 12, w * 4 - 16); *red = src[(w - 1) * 4 + R]; *green = src[(w - 1) * 4 + G]; @@ -144,7 +145,7 @@ static inline void sub_left_prediction_rgb24(HYuvContext *s, uint8_t *dst, b = bt; } - s->dsp.diff_bytes(dst + 48, src + 48, src + 48 - 3, w * 3 - 48); + s->hencdsp.diff_bytes(dst + 48, src + 48, src + 48 - 3, w * 3 - 48); *red = src[(w - 1) * 3 + 0]; *green = src[(w - 1) * 3 + 1]; @@ -154,7 +155,7 @@ static inline void sub_left_prediction_rgb24(HYuvContext *s, uint8_t *dst, static void sub_median_prediction(HYuvContext *s, uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int w, int *left, int *left_top) { if (s->bps <= 8) { - s->dsp.sub_hfyu_median_prediction(dst, src1, src2, w , left, left_top); + s->hencdsp.sub_hfyu_median_pred(dst, src1, src2, w , left, left_top); } else { s->llviddsp.sub_hfyu_median_prediction_int16((uint16_t *)dst, (const uint16_t *)src1, (const uint16_t *)src2, s->n - 1, w , left, left_top); } @@ -215,6 +216,7 @@ static av_cold int encode_init(AVCodecContext *avctx) const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); ff_huffyuv_common_init(avctx); + ff_huffyuvencdsp_init(&s->hencdsp); avctx->extradata = av_mallocz(3*MAX_N + 4); if (!avctx->extradata) @@ -754,9 +756,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, lefttopy = p->data[0][3]; lefttopu = p->data[1][1]; lefttopv = p->data[2][1]; - s->dsp.sub_hfyu_median_prediction(s->temp[0], p->data[0]+4, p->data[0] + fake_ystride + 4, width - 4 , &lefty, &lefttopy); - s->dsp.sub_hfyu_median_prediction(s->temp[1], p->data[1]+2, p->data[1] + fake_ustride + 2, width2 - 2, &leftu, &lefttopu); - s->dsp.sub_hfyu_median_prediction(s->temp[2], p->data[2]+2, p->data[2] + fake_vstride + 2, width2 - 2, &leftv, &lefttopv); + s->hencdsp.sub_hfyu_median_pred(s->temp[0], p->data[0] + 4, p->data[0] + fake_ystride + 4, width - 4, &lefty, &lefttopy); + s->hencdsp.sub_hfyu_median_pred(s->temp[1], p->data[1] + 2, p->data[1] + fake_ustride + 2, width2 - 2, &leftu, &lefttopu); + s->hencdsp.sub_hfyu_median_pred(s->temp[2], p->data[2] + 2, p->data[2] + fake_vstride + 2, width2 - 2, &leftv, &lefttopv); encode_422_bitstream(s, 0, width - 4); y++; cy++; @@ -766,7 +768,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, if (s->bitstream_bpp == 12) { while (2 * cy > y) { ydst = p->data[0] + p->linesize[0] * y; - s->dsp.sub_hfyu_median_prediction(s->temp[0], ydst - fake_ystride, ydst, width , &lefty, &lefttopy); + s->hencdsp.sub_hfyu_median_pred(s->temp[0], ydst - fake_ystride, ydst, width, &lefty, &lefttopy); encode_gray_bitstream(s, width); y++; } @@ -776,9 +778,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, udst = p->data[1] + p->linesize[1] * cy; vdst = p->data[2] + p->linesize[2] * cy; - s->dsp.sub_hfyu_median_prediction(s->temp[0], ydst - fake_ystride, ydst, width , &lefty, &lefttopy); - s->dsp.sub_hfyu_median_prediction(s->temp[1], udst - fake_ustride, udst, width2, &leftu, &lefttopu); - s->dsp.sub_hfyu_median_prediction(s->temp[2], vdst - fake_vstride, vdst, width2, &leftv, &lefttopv); + s->hencdsp.sub_hfyu_median_pred(s->temp[0], ydst - fake_ystride, ydst, width, &lefty, &lefttopy); + s->hencdsp.sub_hfyu_median_pred(s->temp[1], udst - fake_ustride, udst, width2, &leftu, &lefttopu); + s->hencdsp.sub_hfyu_median_pred(s->temp[2], vdst - fake_vstride, vdst, width2, &leftv, &lefttopv); encode_422_bitstream(s, 0, width); } @@ -791,7 +793,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, ydst = p->data[0] + p->linesize[0] * y; if (s->predictor == PLANE && s->interlaced < y) { - s->dsp.diff_bytes(s->temp[1], ydst, ydst - fake_ystride, width); + s->hencdsp.diff_bytes(s->temp[1], ydst, ydst - fake_ystride, width); lefty = sub_left_prediction(s, s->temp[0], s->temp[1], width , lefty); } else { @@ -807,9 +809,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, vdst = p->data[2] + p->linesize[2] * cy; if (s->predictor == PLANE && s->interlaced < cy) { - s->dsp.diff_bytes(s->temp[1], ydst, ydst - fake_ystride, width); - s->dsp.diff_bytes(s->temp[2], udst, udst - fake_ustride, width2); - s->dsp.diff_bytes(s->temp[2] + width2, vdst, vdst - fake_vstride, width2); + s->hencdsp.diff_bytes(s->temp[1], ydst, ydst - fake_ystride, width); + s->hencdsp.diff_bytes(s->temp[2], udst, udst - fake_ustride, width2); + s->hencdsp.diff_bytes(s->temp[2] + width2, vdst, vdst - fake_vstride, width2); lefty = sub_left_prediction(s, s->temp[0], s->temp[1], width , lefty); leftu = sub_left_prediction(s, s->temp[1], s->temp[2], width2, leftu); @@ -842,7 +844,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, for (y = 1; y < s->height; y++) { uint8_t *dst = data + y*stride; if (s->predictor == PLANE && s->interlaced < y) { - s->dsp.diff_bytes(s->temp[1], dst, dst - fake_stride, width * 4); + s->hencdsp.diff_bytes(s->temp[1], dst, dst - fake_stride, width * 4); sub_left_prediction_bgr32(s, s->temp[0], s->temp[1], width, &leftr, &leftg, &leftb, &lefta); } else { @@ -870,8 +872,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, for (y = 1; y < s->height; y++) { uint8_t *dst = data + y * stride; if (s->predictor == PLANE && s->interlaced < y) { - s->dsp.diff_bytes(s->temp[1], dst, dst - fake_stride, - width * 3); + s->hencdsp.diff_bytes(s->temp[1], dst, dst - fake_stride, + width * 3); sub_left_prediction_rgb24(s, s->temp[0], s->temp[1], width, &leftr, &leftg, &leftb); } else { |