[FFmpeg-cvslog] Maintainers : remove myself
ffmpeg | branch: master | Martin Vignali | Thu Mar 21 01:36:48 2019 +0100| [6dc1da416e14ede6cf8018183f86aeec5cfae86b] | committer: Martin Vignali Maintainers : remove myself Too much hostility in this project Not enough respect for users and contributors I'm not interested to contribute anymore > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6dc1da416e14ede6cf8018183f86aeec5cfae86b --- MAINTAINERS | 1 - 1 file changed, 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 0df4d90121..0545b87e55 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -168,7 +168,6 @@ Codecs: eacmv*, eaidct*, eat* Peter Ross evrc* Paul B Mahol exif.c, exif.hThilo Borgmann - exr.c Martin Vignali ffv1* Michael Niedermayer ffwavesynth.c Nicolas George fifo.cJan Sebechlebsky ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/proresenc_aw : fix interlace encoding for unsafe height
ffmpeg | branch: master | Martin Vignali | Fri Mar 8 00:06:01 2019 +0100| [26cf50404d1a965e88c379b4c88a5c4d7fa9f6ed] | committer: Martin Vignali avcodec/proresenc_aw : fix interlace encoding for unsafe height fix the call of the unsafe version of slice encoding in interlace mode fix padding line count in sub image with fill in interlace mode > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=26cf50404d1a965e88c379b4c88a5c4d7fa9f6ed --- libavcodec/proresenc_anatoliy.c | 4 ++-- tests/ref/vsynth/vsynth3-prores_444_int | 8 tests/ref/vsynth/vsynth3-prores_int | 8 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index 5914445b52..0fc79fc1de 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -485,7 +485,7 @@ static inline void subimage_with_fill_template(uint16_t *src, unsigned x, unsign } else { src_stride = stride; /* 2 lines stride */ src += y * src_stride + x; -box_height = FFMIN(height - y * 2, dst_height); +box_height = FFMIN(height/2 - y, dst_height); if (!is_top_field) src += stride >> 1; } @@ -671,7 +671,7 @@ static int prores_encode_picture(AVCodecContext *avctx, const AVFrame *pic, picture_height = avctx->height / 2; } mb_height = (picture_height + 15) >> 4; -unsafe_mb_height_limit = mb_height * 2; +unsafe_mb_height_limit = mb_height; } for (i = av_log2(DEFAULT_SLICE_MB_WIDTH); i >= 0; --i) { diff --git a/tests/ref/vsynth/vsynth3-prores_444_int b/tests/ref/vsynth/vsynth3-prores_444_int index ec9dda8965..36760adf9a 100644 --- a/tests/ref/vsynth/vsynth3-prores_444_int +++ b/tests/ref/vsynth/vsynth3-prores_444_int @@ -1,4 +1,4 @@ -4928501bad7c46a277eab54440f2a794 *tests/data/fate/vsynth3-prores_444_int.mov -230539 tests/data/fate/vsynth3-prores_444_int.mov -7acff20947af998d5a6e6f85ff24a6d2 *tests/data/fate/vsynth3-prores_444_int.out.rawvideo -stddev:3.27 PSNR: 37.82 MAXDIFF: 42 bytes:86700/86700 +270045a731d4cb6ba253880021c87a63 *tests/data/fate/vsynth3-prores_444_int.mov +184397 tests/data/fate/vsynth3-prores_444_int.mov +a8852aa2841c2ce5f2aa86176ceda4ef *tests/data/fate/vsynth3-prores_444_int.out.rawvideo +stddev:3.24 PSNR: 37.91 MAXDIFF: 41 bytes:86700/86700 diff --git a/tests/ref/vsynth/vsynth3-prores_int b/tests/ref/vsynth/vsynth3-prores_int index 0208a2d15a..53dcfbd14d 100644 --- a/tests/ref/vsynth/vsynth3-prores_int +++ b/tests/ref/vsynth/vsynth3-prores_int @@ -1,4 +1,4 @@ -8bd60c3d149977dd25e21adcf57d76fa *tests/data/fate/vsynth3-prores_int.mov -148325 tests/data/fate/vsynth3-prores_int.mov -628a667a0de678239f05a6e5497c4601 *tests/data/fate/vsynth3-prores_int.out.rawvideo -stddev:3.06 PSNR: 38.40 MAXDIFF: 29 bytes:86700/86700 +ee1f14b23eb9dee4d59b021d4ec041bf *tests/data/fate/vsynth3-prores_int.mov +120484 tests/data/fate/vsynth3-prores_int.mov +e5859ba47a99f9e53c1ddcaa68a8f8f8 *tests/data/fate/vsynth3-prores_int.out.rawvideo +stddev:2.92 PSNR: 38.81 MAXDIFF: 29 bytes:86700/86700 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/qtrle : improve 24bbp decoding speed
ffmpeg | branch: master | Martin Vignali | Tue Feb 26 10:38:25 2019 +0100| [88d0be1c0eea482e160f90d931547803df2df8d6] | committer: Martin Vignali avcodec/qtrle : improve 24bbp decoding speed benchmark on x86_64 : mainly raw data : 20 -> 39 fps mainly rle data : 97 -> 119fps > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=88d0be1c0eea482e160f90d931547803df2df8d6 --- libavcodec/qtrle.c | 31 +++ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c index febfea3029..a744d7ba68 100644 --- a/libavcodec/qtrle.c +++ b/libavcodec/qtrle.c @@ -297,10 +297,11 @@ static void qtrle_decode_16bpp(QtrleContext *s, int row_ptr, int lines_to_change static void qtrle_decode_24bpp(QtrleContext *s, int row_ptr, int lines_to_change) { -int rle_code; +int rle_code, rle_code_half; int pixel_ptr; int row_inc = s->frame->linesize[0]; -uint8_t r, g, b; +uint8_t b; +uint16_t rg; uint8_t *rgb = s->frame->data[0]; int pixel_limit = s->frame->linesize[0] * s->avctx->height; @@ -318,25 +319,31 @@ static void qtrle_decode_24bpp(QtrleContext *s, int row_ptr, int lines_to_change } else if (rle_code < 0) { /* decode the run length code */ rle_code = -rle_code; -r = bytestream2_get_byte(&s->g); -g = bytestream2_get_byte(&s->g); +rg = bytestream2_get_ne16(&s->g); b = bytestream2_get_byte(&s->g); CHECK_PIXEL_PTR(rle_code * 3); while (rle_code--) { -rgb[pixel_ptr++] = r; -rgb[pixel_ptr++] = g; -rgb[pixel_ptr++] = b; +AV_WN16A(rgb + pixel_ptr, rg); +rgb[pixel_ptr + 2] = b; +pixel_ptr += 3; } } else { CHECK_PIXEL_PTR(rle_code * 3); -/* copy pixels directly to output */ -while (rle_code--) { -rgb[pixel_ptr++] = bytestream2_get_byte(&s->g); -rgb[pixel_ptr++] = bytestream2_get_byte(&s->g); -rgb[pixel_ptr++] = bytestream2_get_byte(&s->g); +rle_code_half = rle_code / 2; + +while (rle_code_half--) { /* copy 2 raw rgb value at the same time */ +AV_WN32A(rgb + pixel_ptr, bytestream2_get_ne32(&s->g)); /* rgbr */ +AV_WN16A(rgb + pixel_ptr + 4, bytestream2_get_ne16(&s->g)); /* rgbr */ +pixel_ptr += 6; +} + +if (rle_code % 2 != 0){ /* not even raw value */ +AV_WN16A(rgb + pixel_ptr, bytestream2_get_ne16(&s->g)); +rgb[pixel_ptr + 2] = bytestream2_get_byte(&s->g); +pixel_ptr += 3; } } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/qtrle : avoid swap in 32bpp decoding on little endian
ffmpeg | branch: master | Martin Vignali | Tue Feb 26 10:37:32 2019 +0100| [5496a734882cad54fda2c3528f16488dcac3b0a1] | committer: Martin Vignali avcodec/qtrle : avoid swap in 32bpp decoding on little endian improve speed on little endian benchmark on x86_64 : mainly raw : 33fps -> 38fps mainly rle : 128fps -> 153 fps > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5496a734882cad54fda2c3528f16488dcac3b0a1 --- libavcodec/qtrle.c | 6 +++--- libavcodec/version.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c index 6155b4f3e3..bb55ba8a86 100644 --- a/libavcodec/qtrle.c +++ b/libavcodec/qtrle.c @@ -367,7 +367,7 @@ static void qtrle_decode_32bpp(QtrleContext *s, int row_ptr, int lines_to_change } else if (rle_code < 0) { /* decode the run length code */ rle_code = -rle_code; -argb = bytestream2_get_be32(&s->g); +argb = bytestream2_get_ne32(&s->g); CHECK_PIXEL_PTR(rle_code * 4); @@ -380,7 +380,7 @@ static void qtrle_decode_32bpp(QtrleContext *s, int row_ptr, int lines_to_change /* copy pixels directly to output */ while (rle_code--) { -argb = bytestream2_get_be32(&s->g); +argb = bytestream2_get_ne32(&s->g); AV_WN32A(rgb + pixel_ptr, argb); pixel_ptr += 4; } @@ -416,7 +416,7 @@ static av_cold int qtrle_decode_init(AVCodecContext *avctx) break; case 32: -avctx->pix_fmt = AV_PIX_FMT_RGB32; +avctx->pix_fmt = AV_PIX_FMT_ARGB; break; default: diff --git a/libavcodec/version.h b/libavcodec/version.h index 7c3897e2d4..309e4111cb 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 58 #define LIBAVCODEC_VERSION_MINOR 47 -#define LIBAVCODEC_VERSION_MICRO 102 +#define LIBAVCODEC_VERSION_MICRO 103 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] fate/qtrle : change 32b test to output bgra instead of rgb24
ffmpeg | branch: master | Martin Vignali | Tue Feb 26 10:36:34 2019 +0100| [9cb576fc1e3d58df3afbe2b23cada466ad8297cb] | committer: Martin Vignali fate/qtrle : change 32b test to output bgra instead of rgb24 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9cb576fc1e3d58df3afbe2b23cada466ad8297cb --- tests/fate/qtrle.mak | 2 +- tests/ref/fate/qtrle-32bit | 52 +++--- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/tests/fate/qtrle.mak b/tests/fate/qtrle.mak index 774a81652b..1f26ffea7b 100644 --- a/tests/fate/qtrle.mak +++ b/tests/fate/qtrle.mak @@ -17,7 +17,7 @@ FATE_QTRLE += fate-qtrle-24bit fate-qtrle-24bit: CMD = framecrc -i $(TARGET_SAMPLES)/qtrle/aletrek-rle.mov FATE_QTRLE += fate-qtrle-32bit -fate-qtrle-32bit: CMD = framecrc -i $(TARGET_SAMPLES)/qtrle/ultra_demo_720_480_32bpp_rle.mov -pix_fmt rgb24 +fate-qtrle-32bit: CMD = framecrc -i $(TARGET_SAMPLES)/qtrle/ultra_demo_720_480_32bpp_rle.mov -pix_fmt bgra FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, QTRLE) += $(FATE_QTRLE) fate-qtrle: $(FATE_QTRLE) diff --git a/tests/ref/fate/qtrle-32bit b/tests/ref/fate/qtrle-32bit index aaaf8d6470..5e2b58dad4 100644 --- a/tests/ref/fate/qtrle-32bit +++ b/tests/ref/fate/qtrle-32bit @@ -3,29 +3,29 @@ #codec_id 0: rawvideo #dimensions 0: 720x480 #sar 0: 0/1 -0, 0, 0,1, 1036800, 0x2a90d062 -0, 1, 1,1, 1036800, 0x6565aded -0, 2, 2,1, 1036800, 0xf0b587d2 -0, 3, 3,1, 1036800, 0xf0b4e53f -0, 4, 4,1, 1036800, 0x5ba4b96a -0, 5, 5,1, 1036800, 0x501df9c1 -0, 6, 6,1, 1036800, 0xcf45b940 -0, 7, 7,1, 1036800, 0xa454df07 -0, 8, 8,1, 1036800, 0xc504d152 -0, 9, 9,1, 1036800, 0xd90ecac7 -0, 10, 10,1, 1036800, 0xe30368df -0, 11, 11,1, 1036800, 0x0ca35522 -0, 12, 12,1, 1036800, 0xe76b8d43 -0, 13, 13,1, 1036800, 0x7c85a447 -0, 14, 14,1, 1036800, 0x3e2d1b5f -0, 15, 15,1, 1036800, 0x230fa5a6 -0, 16, 16,1, 1036800, 0x4fad025e -0, 17, 17,1, 1036800, 0x7d3366ae -0, 18, 18,1, 1036800, 0xa83720f7 -0, 19, 19,1, 1036800, 0x5dbd13b1 -0, 20, 20,1, 1036800, 0xd0ebd56d -0, 21, 21,1, 1036800, 0x4d7c67f3 -0, 22, 22,1, 1036800, 0x226baa3f -0, 23, 23,1, 1036800, 0xc0e93acf -0, 24, 24,1, 1036800, 0x5a466c17 -0, 25, 25,1, 1036800, 0xfdb7d2ea +0, 0, 0,1, 1382400, 0xfe6e6fd3 +0, 1, 1,1, 1382400, 0x3c7809c8 +0, 2, 2,1, 1382400, 0x06901a04 +0, 3, 3,1, 1382400, 0xd7d7c910 +0, 4, 4,1, 1382400, 0x017e8fda +0, 5, 5,1, 1382400, 0xab9ee842 +0, 6, 6,1, 1382400, 0x08615b93 +0, 7, 7,1, 1382400, 0x105cb681 +0, 8, 8,1, 1382400, 0xd9dd224f +0, 9, 9,1, 1382400, 0x058cabbf +0, 10, 10,1, 1382400, 0x73424fc0 +0, 11, 11,1, 1382400, 0x39d0a78b +0, 12, 12,1, 1382400, 0x956d1393 +0, 13, 13,1, 1382400, 0xe4aff472 +0, 14, 14,1, 1382400, 0x83ff20ce +0, 15, 15,1, 1382400, 0xb53383df +0, 16, 16,1, 1382400, 0x181e55e8 +0, 17, 17,1, 1382400, 0x0716c90c +0, 18, 18,1, 1382400, 0x092aae25 +0, 19, 19,1, 1382400, 0x0a23b4cb +0, 20, 20,1, 1382400, 0xe72000b0 +0, 21, 21,1, 1382400, 0x0b8d02e8 +0, 22, 22,1, 1382400, 0xec2a3b0d +0, 23, 23,1, 1382400, 0x4ddc4e19 +0, 24, 24,1, 1382400, 0xc4656abb +0, 25, 25,1, 1382400, 0x60d78517 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/qtrle : 32bpp dec copy two raw argb value at the same time
ffmpeg | branch: master | Martin Vignali | Tue Feb 26 10:38:10 2019 +0100| [3278ea67c8f2a7c1aea8fd3114b35983791e6732] | committer: Martin Vignali avcodec/qtrle : 32bpp dec copy two raw argb value at the same time benchmark on x86_64 : 38 fps -> 40 fps > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3278ea67c8f2a7c1aea8fd3114b35983791e6732 --- libavcodec/qtrle.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c index bb55ba8a86..febfea3029 100644 --- a/libavcodec/qtrle.c +++ b/libavcodec/qtrle.c @@ -346,7 +346,7 @@ static void qtrle_decode_24bpp(QtrleContext *s, int row_ptr, int lines_to_change static void qtrle_decode_32bpp(QtrleContext *s, int row_ptr, int lines_to_change) { -int rle_code; +int rle_code, rle_code_half; int pixel_ptr; int row_inc = s->frame->linesize[0]; unsigned int argb; @@ -379,10 +379,15 @@ static void qtrle_decode_32bpp(QtrleContext *s, int row_ptr, int lines_to_change CHECK_PIXEL_PTR(rle_code * 4); /* copy pixels directly to output */ -while (rle_code--) { -argb = bytestream2_get_ne32(&s->g); -AV_WN32A(rgb + pixel_ptr, argb); -pixel_ptr += 4; +rle_code_half = rle_code / 2; +while (rle_code_half--) { /* copy 2 argb raw value at the same time */ +AV_WN64A(rgb + pixel_ptr, bytestream2_get_ne64(&s->g)); +pixel_ptr += 8; +} + +if (rle_code % 2 != 0){ /* not even raw value */ +AV_WN32A(rgb + pixel_ptr, bytestream2_get_ne32(&s->g)); +pixel_ptr += 4; } } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/proresenc_aw : fix sub_image_with_fill for interlaced encoding
ffmpeg | branch: master | Martin Vignali | Tue Feb 26 11:54:23 2019 +0100| [a3f65f5e9fedb1c58bba8d71382d71191edf6eff] | committer: Martin Vignali avcodec/proresenc_aw : fix sub_image_with_fill for interlaced encoding used when width and/or height, not multiple of sclice dim > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a3f65f5e9fedb1c58bba8d71382d71191edf6eff --- libavcodec/proresenc_anatoliy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index e287d176ad..5914445b52 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -484,10 +484,10 @@ static inline void subimage_with_fill_template(uint16_t *src, unsigned x, unsign box_height = FFMIN(height - y, dst_height); } else { src_stride = stride; /* 2 lines stride */ -src += y * src_stride * 2 + x; +src += y * src_stride + x; box_height = FFMIN(height - y * 2, dst_height); if (!is_top_field) -src += src_stride; +src += stride >> 1; } for (i = 0; i < box_height; ++i) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] fate/proresenc_aw : add test for interlace and 444 encoding
ffmpeg | branch: master | Martin Vignali | Tue Feb 26 11:58:00 2019 +0100| [b38dd2d219c6ca64259ce9d9deff00ad6afe] | committer: Martin Vignali fate/proresenc_aw : add test for interlace and 444 encoding > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b38dd2d219c6ca64259ce9d9deff00ad6afe --- tests/fate/vcodec.mak | 14 +- tests/ref/vsynth/vsynth1-prores_444 | 4 tests/ref/vsynth/vsynth1-prores_444_int | 4 tests/ref/vsynth/vsynth1-prores_int | 4 tests/ref/vsynth/vsynth2-prores_444 | 4 tests/ref/vsynth/vsynth2-prores_444_int | 4 tests/ref/vsynth/vsynth2-prores_int | 4 tests/ref/vsynth/vsynth3-prores_444 | 4 tests/ref/vsynth/vsynth3-prores_444_int | 4 tests/ref/vsynth/vsynth3-prores_int | 4 tests/ref/vsynth/vsynth_lena-prores_444 | 4 tests/ref/vsynth/vsynth_lena-prores_444_int | 4 tests/ref/vsynth/vsynth_lena-prores_int | 4 13 files changed, 61 insertions(+), 1 deletion(-) diff --git a/tests/fate/vcodec.mak b/tests/fate/vcodec.mak index da6da9e09b..2705d2227a 100644 --- a/tests/fate/vcodec.mak +++ b/tests/fate/vcodec.mak @@ -336,9 +336,21 @@ fate-vsynth%-mpng: CODEC = png FATE_VCODEC-$(call ENCDEC, MSVIDEO1, AVI) += msvideo1 -FATE_VCODEC-$(call ENCDEC, PRORES, MOV) += prores prores_ks +FATE_VCODEC-$(call ENCDEC, PRORES, MOV) += prores prores_int prores_444 prores_444_int prores_ks fate-vsynth%-prores: FMT = mov +fate-vsynth%-prores_int: CODEC = prores +fate-vsynth%-prores_int: ENCOPTS = -flags +ildct +fate-vsynth%-prores_int: FMT = mov + +fate-vsynth%-prores_444: CODEC = prores +fate-vsynth%-prores_444: ENCOPTS = -pix_fmt yuv444p10 +fate-vsynth%-prores_444: FMT = mov + +fate-vsynth%-prores_444_int: CODEC = prores +fate-vsynth%-prores_444_int: ENCOPTS = -pix_fmt yuv444p10 -flags +ildct +fate-vsynth%-prores_444_int: FMT = mov + fate-vsynth%-prores_ks: ENCOPTS = -profile hq fate-vsynth%-prores_ks: FMT = mov diff --git a/tests/ref/vsynth/vsynth1-prores_444 b/tests/ref/vsynth/vsynth1-prores_444 new file mode 100644 index 00..2f064d624d --- /dev/null +++ b/tests/ref/vsynth/vsynth1-prores_444 @@ -0,0 +1,4 @@ +48b30df581b35bf3ce1bc335327323a6 *tests/data/fate/vsynth1-prores_444.mov +7778954 tests/data/fate/vsynth1-prores_444.mov +e0da52b5d58171294d1b299539801ae0 *tests/data/fate/vsynth1-prores_444.out.rawvideo +stddev:2.80 PSNR: 39.17 MAXDIFF: 44 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth1-prores_444_int b/tests/ref/vsynth/vsynth1-prores_444_int new file mode 100644 index 00..db0d42f7cd --- /dev/null +++ b/tests/ref/vsynth/vsynth1-prores_444_int @@ -0,0 +1,4 @@ +4fc38d6a1c3171f23713c24b1342a592 *tests/data/fate/vsynth1-prores_444_int.mov +9940947 tests/data/fate/vsynth1-prores_444_int.mov +732ceeb6887524e0aee98762fe50578b *tests/data/fate/vsynth1-prores_444_int.out.rawvideo +stddev:2.83 PSNR: 39.08 MAXDIFF: 45 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth1-prores_int b/tests/ref/vsynth/vsynth1-prores_int new file mode 100644 index 00..470174559a --- /dev/null +++ b/tests/ref/vsynth/vsynth1-prores_int @@ -0,0 +1,4 @@ +c2e40555435e717dd24be0430b8c0cdf *tests/data/fate/vsynth1-prores_int.mov +6308688 tests/data/fate/vsynth1-prores_int.mov +164a4ca890695cf594293d1acec9463c *tests/data/fate/vsynth1-prores_int.out.rawvideo +stddev:2.66 PSNR: 39.62 MAXDIFF: 34 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-prores_444 b/tests/ref/vsynth/vsynth2-prores_444 new file mode 100644 index 00..513caaacc2 --- /dev/null +++ b/tests/ref/vsynth/vsynth2-prores_444 @@ -0,0 +1,4 @@ +cdea76066b82eed873462c2da908a8a0 *tests/data/fate/vsynth2-prores_444.mov +5219722 tests/data/fate/vsynth2-prores_444.mov +e425b6af7afa51b5e64fc529528b3691 *tests/data/fate/vsynth2-prores_444.out.rawvideo +stddev:0.88 PSNR: 49.18 MAXDIFF: 14 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-prores_444_int b/tests/ref/vsynth/vsynth2-prores_444_int new file mode 100644 index 00..bce8277b3c --- /dev/null +++ b/tests/ref/vsynth/vsynth2-prores_444_int @@ -0,0 +1,4 @@ +4043270721dafd28c1cfa176a1c6916a *tests/data/fate/vsynth2-prores_444_int.mov +6420787 tests/data/fate/vsynth2-prores_444_int.mov +33a5db4f0423168d4ae4f1db3610928e *tests/data/fate/vsynth2-prores_444_int.out.rawvideo +stddev:0.93 PSNR: 48.73 MAXDIFF: 14 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-prores_int b/tests/ref/vsynth/vsynth2-prores_int new file mode 100644 index 00..48a419b9bc --- /dev/null +++ b/tests/ref/vsynth/vsynth2-prores_int @@ -0,0 +1,4 @@ +9fef0da9e53a028e81545cf81ec2c3e7 *tests/data/fate/vsynth2-prores_int.mov +4070996 tests/data/fate/vsynth2-prores_int.
[FFmpeg-cvslog] avcodec/proresenc_aw : move scantable to prores context
ffmpeg | branch: master | Martin Vignali | Sat Feb 9 18:20:21 2019 +0100| [8a4a952e45e8f14babba2eece59329699ca29e42] | committer: Martin Vignali avcodec/proresenc_aw : move scantable to prores context > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8a4a952e45e8f14babba2eece59329699ca29e42 --- libavcodec/proresenc_anatoliy.c | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index 061621dae4..57d9d9ac34 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -186,6 +186,7 @@ typedef struct { int qmat_luma[16][64]; int qmat_chroma[16][64]; +const uint8_t *scantable; int is_422; int need_alpha; @@ -269,14 +270,14 @@ static const uint8_t lev_to_cb[10] = { 0x04, 0x0A, 0x05, 0x06, 0x04, 0x28, 0x28, 0x28, 0x28, 0x4C }; static void encode_ac_coeffs(PutBitContext *pb, -int16_t *in, int blocks_per_slice, int *qmat) +int16_t *in, int blocks_per_slice, int *qmat, const uint8_t ff_prores_scan[64]) { int prev_run = 4; int prev_level = 2; int run = 0, level, code, i, j; for (i = 1; i < 64; i++) { -int indp = ff_prores_progressive_scan[i]; +int indp = ff_prores_scan[i]; for (j = 0; j < blocks_per_slice; j++) { int val = QSCALE(qmat, indp, in[(j << 6) + indp]); if (val) { @@ -354,7 +355,8 @@ static void calc_plane_dct(FDCTDSPContext *fdsp, uint8_t *src, int16_t * blocks, } } -static int encode_slice_plane(int16_t *blocks, int mb_count, uint8_t *buf, unsigned buf_size, int *qmat, int sub_sample_chroma) +static int encode_slice_plane(int16_t *blocks, int mb_count, uint8_t *buf, unsigned buf_size, int *qmat, int sub_sample_chroma, + const uint8_t ff_prores_scan[64]) { int blocks_per_slice; PutBitContext pb; @@ -363,7 +365,7 @@ static int encode_slice_plane(int16_t *blocks, int mb_count, uint8_t *buf, unsig init_put_bits(&pb, buf, buf_size); encode_dc_coeffs(&pb, blocks, blocks_per_slice, qmat); -encode_ac_coeffs(&pb, blocks, blocks_per_slice, qmat); +encode_ac_coeffs(&pb, blocks, blocks_per_slice, qmat, ff_prores_scan); flush_put_bits(&pb); return put_bits_ptr(&pb) - pb.buf; @@ -378,15 +380,15 @@ static av_always_inline unsigned encode_slice_data(AVCodecContext *avctx, ProresContext* ctx = avctx->priv_data; *y_data_size = encode_slice_plane(blocks_y, mb_count, - buf, data_size, ctx->qmat_luma[qp - 1], 0); + buf, data_size, ctx->qmat_luma[qp - 1], 0, ctx->scantable); if (!(avctx->flags & AV_CODEC_FLAG_GRAY)) { *u_data_size = encode_slice_plane(blocks_u, mb_count, buf + *y_data_size, data_size - *y_data_size, - ctx->qmat_chroma[qp - 1], ctx->is_422); + ctx->qmat_chroma[qp - 1], ctx->is_422, ctx->scantable); *v_data_size = encode_slice_plane(blocks_v, mb_count, buf + *y_data_size + *u_data_size, data_size - *y_data_size - *u_data_size, - ctx->qmat_chroma[qp - 1], ctx->is_422); + ctx->qmat_chroma[qp - 1], ctx->is_422, ctx->scantable); } return *y_data_size + *u_data_size + *v_data_size; @@ -755,6 +757,7 @@ static av_cold int prores_encode_init(AVCodecContext *avctx) avctx->bits_per_raw_sample = 10; ctx->need_alpha = 0; +ctx->scantable = ff_prores_progressive_scan; if (avctx->width & 0x1) { av_log(avctx, AV_LOG_ERROR, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/proresenc_aw : indent after prev commit
ffmpeg | branch: master | Martin Vignali | Sat Feb 9 18:45:04 2019 +0100| [37e4c226c06c4ac6b8e3a0ccb2c0933397d6f96f] | committer: Martin Vignali avcodec/proresenc_aw : indent after prev commit > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=37e4c226c06c4ac6b8e3a0ccb2c0933397d6f96f --- libavcodec/proresenc_anatoliy.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index 28cb3ac6c9..e287d176ad 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -480,7 +480,7 @@ static inline void subimage_with_fill_template(uint16_t *src, unsigned x, unsign if (!is_interlaced) { src_stride = stride >> 1; -src += y * src_stride + x; +src += y * src_stride + x; box_height = FFMIN(height - y, dst_height); } else { src_stride = stride; /* 2 lines stride */ @@ -558,9 +558,9 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, int mb_x, alpha_stride = pic->linesize[3]; if (!is_interlaced) { -dest_y = pic->data[0] + (mb_y << 4) * luma_stride + (mb_x << 5); -dest_u = pic->data[1] + (mb_y << 4) * chroma_stride + (mb_x << (5 - ctx->is_422)); -dest_v = pic->data[2] + (mb_y << 4) * chroma_stride + (mb_x << (5 - ctx->is_422)); +dest_y = pic->data[0] + (mb_y << 4) * luma_stride + (mb_x << 5); +dest_u = pic->data[1] + (mb_y << 4) * chroma_stride + (mb_x << (5 - ctx->is_422)); +dest_v = pic->data[2] + (mb_y << 4) * chroma_stride + (mb_x << (5 - ctx->is_422)); } else { dest_y = pic->data[0] + (mb_y << 4) * luma_stride * 2 + (mb_x << 5); dest_u = pic->data[1] + (mb_y << 4) * chroma_stride * 2 + (mb_x << (5 - ctx->is_422)); @@ -594,9 +594,9 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, int mb_x, *qp); } else { if (!is_interlaced) { -calc_plane_dct(fdsp, dest_y, blocks_y, luma_stride, mb_count, 0, 0); -calc_plane_dct(fdsp, dest_u, blocks_u, chroma_stride, mb_count, 1, ctx->is_422); -calc_plane_dct(fdsp, dest_v, blocks_v, chroma_stride, mb_count, 1, ctx->is_422); +calc_plane_dct(fdsp, dest_y, blocks_y, luma_stride, mb_count, 0, 0); +calc_plane_dct(fdsp, dest_u, blocks_u, chroma_stride, mb_count, 1, ctx->is_422); +calc_plane_dct(fdsp, dest_v, blocks_v, chroma_stride, mb_count, 1, ctx->is_422); } else { calc_plane_dct(fdsp, dest_y, blocks_y, luma_stride * 2, mb_count, 0, 0); calc_plane_dct(fdsp, dest_u, blocks_u, chroma_stride * 2, mb_count, 1, ctx->is_422); @@ -817,7 +817,7 @@ static av_cold int prores_encode_init(AVCodecContext *avctx) if (ctx->is_interlaced) { ctx->scantable = ff_prores_interlaced_scan; } else { -ctx->scantable = ff_prores_progressive_scan; +ctx->scantable = ff_prores_progressive_scan; } if (avctx->width & 0x1) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/proresenc_aw : merge funcs subimage_with_fill and subimage_alpha_with_fill
ffmpeg | branch: master | Martin Vignali | Sat Feb 9 18:25:31 2019 +0100| [e7cbbb7374c63a4d67c3600b9de2dfae4a952007] | committer: Martin Vignali avcodec/proresenc_aw : merge funcs subimage_with_fill and subimage_alpha_with_fill > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e7cbbb7374c63a4d67c3600b9de2dfae4a952007 --- libavcodec/proresenc_anatoliy.c | 50 + 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index 57d9d9ac34..e72ec94bad 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -468,11 +468,10 @@ static av_always_inline int encode_alpha_slice_data(AVCodecContext *avctx, int8_ } } -static void subimage_with_fill(uint16_t *src, unsigned x, unsigned y, -unsigned stride, unsigned width, unsigned height, uint16_t *dst, -unsigned dst_width, unsigned dst_height) +static inline void subimage_with_fill_template(uint16_t *src, unsigned x, unsigned y, + unsigned stride, unsigned width, unsigned height, uint16_t *dst, + unsigned dst_width, unsigned dst_height, int is_alpha_plane) { - int box_width = FFMIN(width - x, dst_width); int box_height = FFMIN(height - y, dst_height); int i, j, src_stride = stride >> 1; @@ -481,9 +480,17 @@ static void subimage_with_fill(uint16_t *src, unsigned x, unsigned y, src += y * src_stride + x; for (i = 0; i < box_height; ++i) { for (j = 0; j < box_width; ++j) { -dst[j] = src[j]; +if (!is_alpha_plane) { +dst[j] = src[j]; +} else { +dst[j] = src[j] << 6; /* alpha 10b to 16b */ +} +} +if (!is_alpha_plane) { +last_pix = dst[j - 1]; +} else { +last_pix = dst[j - 1] << 6; /* alpha 10b to 16b */ } -last_pix = dst[j - 1]; for (; j < dst_width; j++) dst[j] = last_pix; src += src_stride; @@ -498,34 +505,19 @@ static void subimage_with_fill(uint16_t *src, unsigned x, unsigned y, } } +static void subimage_with_fill(uint16_t *src, unsigned x, unsigned y, +unsigned stride, unsigned width, unsigned height, uint16_t *dst, +unsigned dst_width, unsigned dst_height) +{ +subimage_with_fill_template(src, x, y, stride, width, height, dst, dst_width, dst_height, 0); +} + /* reorganize alpha data and convert 10b -> 16b */ static void subimage_alpha_with_fill(uint16_t *src, unsigned x, unsigned y, unsigned stride, unsigned width, unsigned height, uint16_t *dst, unsigned dst_width, unsigned dst_height) { -int box_width = FFMIN(width - x, dst_width); -int box_height = FFMIN(height - y, dst_height); -int i, j, src_stride = stride >> 1; -uint16_t last_pix, *last_line; - -src += y * src_stride + x; -for (i = 0; i < box_height; ++i) { -for (j = 0; j < box_width; ++j) { -dst[j] = src[j] << 6; /* 10b to 16b */ -} -last_pix = dst[j - 1] << 6; /* 10b to 16b */ -for (; j < dst_width; j++) -dst[j] = last_pix; -src += src_stride; -dst += dst_width; -} -last_line = dst - dst_width; -for (; i < dst_height; i++) { -for (j = 0; j < dst_width; ++j) { -dst[j] = last_line[j]; -} -dst += dst_width; -} +subimage_with_fill_template(src, x, y, stride, width, height, dst, dst_width, dst_height, 1); } static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, int mb_x, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/proresenc_aw : move picture encoding after frame header write
ffmpeg | branch: master | Martin Vignali | Sat Feb 9 18:16:50 2019 +0100| [2016f9c3bc23a65deb566a36d210328c90d6db33] | committer: Martin Vignali avcodec/proresenc_aw : move picture encoding after frame header write > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2016f9c3bc23a65deb566a36d210328c90d6db33 --- libavcodec/proresenc_anatoliy.c | 20 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index afd1fa6b13..061621dae4 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -683,7 +683,7 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt, ProresContext *ctx = avctx->priv_data; int header_size = 148; uint8_t *buf; -int pic_size, ret; +int compress_frame_size, pic_size, ret; uint8_t frame_flags; int frame_size = FFALIGN(avctx->width, 16) * FFALIGN(avctx->height, 16)*16 + 500 + AV_INPUT_BUFFER_MIN_SIZE; //FIXME choose tighter limit @@ -692,13 +692,9 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt, return ret; buf = pkt->data; -pic_size = prores_encode_picture(avctx, pict, buf + header_size + 8, -pkt->size - header_size - 8); -if (pic_size < 0) { -return pic_size; -} +compress_frame_size = 8 + header_size; -bytestream_put_be32(&buf, pic_size + 8 + header_size); +bytestream_put_be32(&buf, compress_frame_size);/* frame size will be update after picture(s) encoding */ bytestream_put_buffer(&buf, "icpf", 4); bytestream_put_be16(&buf, header_size); @@ -730,8 +726,16 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt, bytestream_put_buffer(&buf, QMAT_LUMA[avctx->profile], 64); bytestream_put_buffer(&buf, QMAT_CHROMA[avctx->profile], 64); +pic_size = prores_encode_picture(avctx, pict, buf, + pkt->size - compress_frame_size); +if (pic_size < 0) { +return pic_size; +} +compress_frame_size += pic_size; + +AV_WB32(pkt->data, compress_frame_size);/* update frame size */ pkt->flags |= AV_PKT_FLAG_KEY; -pkt->size = pic_size + 8 + header_size; +pkt->size = compress_frame_size; *got_packet = 1; return 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/proresenc_aw : simplify frame flags
ffmpeg | branch: master | Martin Vignali | Sat Feb 9 18:15:59 2019 +0100| [6cc8cfe30c09b1776b935988fcdedf0333602f8e] | committer: Martin Vignali avcodec/proresenc_aw : simplify frame flags > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6cc8cfe30c09b1776b935988fcdedf0333602f8e --- libavcodec/proresenc_anatoliy.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index 2bed58bdc1..afd1fa6b13 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -684,6 +684,7 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt, int header_size = 148; uint8_t *buf; int pic_size, ret; +uint8_t frame_flags; int frame_size = FFALIGN(avctx->width, 16) * FFALIGN(avctx->height, 16)*16 + 500 + AV_INPUT_BUFFER_MIN_SIZE; //FIXME choose tighter limit @@ -705,11 +706,10 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt, bytestream_put_buffer(&buf, ctx->vendor, 4); bytestream_put_be16(&buf, avctx->width); bytestream_put_be16(&buf, avctx->height); -if (avctx->profile >= FF_PROFILE_PRORES_) { /* or Xq */ -*buf++ = 0xC2; // 444, not interlaced -} else { -*buf++ = 0x82; // 422, not interlaced -} +frame_flags = 0x82; /* 422 not interlaced */ +if (avctx->profile >= FF_PROFILE_PRORES_) /* or Xq */ +frame_flags |= 0x40; /* 444 chroma */ +*buf++ = frame_flags; *buf++ = 0; /* reserved */ /* only write color properties, if valid value. set to unspecified otherwise */ *buf++ = ff_int_from_list_or_default(avctx, "frame color primaries", pict->color_primaries, valid_primaries, 0); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/proresenc_aw : add interlace encoding
ffmpeg | branch: master | Martin Vignali | Sat Feb 9 18:42:44 2019 +0100| [132ed206d6b84daf83921f809fd7a8970c356404] | committer: Martin Vignali avcodec/proresenc_aw : add interlace encoding > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=132ed206d6b84daf83921f809fd7a8970c356404 --- libavcodec/proresenc_anatoliy.c | 111 1 file changed, 90 insertions(+), 21 deletions(-) diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index e72ec94bad..28cb3ac6c9 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -190,6 +190,7 @@ typedef struct { int is_422; int need_alpha; +int is_interlaced; char *vendor; } ProresContext; @@ -470,14 +471,25 @@ static av_always_inline int encode_alpha_slice_data(AVCodecContext *avctx, int8_ static inline void subimage_with_fill_template(uint16_t *src, unsigned x, unsigned y, unsigned stride, unsigned width, unsigned height, uint16_t *dst, - unsigned dst_width, unsigned dst_height, int is_alpha_plane) + unsigned dst_width, unsigned dst_height, int is_alpha_plane, + int is_interlaced, int is_top_field) { int box_width = FFMIN(width - x, dst_width); -int box_height = FFMIN(height - y, dst_height); -int i, j, src_stride = stride >> 1; +int i, j, src_stride, box_height; uint16_t last_pix, *last_line; +if (!is_interlaced) { +src_stride = stride >> 1; src += y * src_stride + x; +box_height = FFMIN(height - y, dst_height); +} else { +src_stride = stride; /* 2 lines stride */ +src += y * src_stride * 2 + x; +box_height = FFMIN(height - y * 2, dst_height); +if (!is_top_field) +src += src_stride; +} + for (i = 0; i < box_height; ++i) { for (j = 0; j < box_width; ++j) { if (!is_alpha_plane) { @@ -507,22 +519,22 @@ static inline void subimage_with_fill_template(uint16_t *src, unsigned x, unsign static void subimage_with_fill(uint16_t *src, unsigned x, unsigned y, unsigned stride, unsigned width, unsigned height, uint16_t *dst, -unsigned dst_width, unsigned dst_height) +unsigned dst_width, unsigned dst_height, int is_interlaced, int is_top_field) { -subimage_with_fill_template(src, x, y, stride, width, height, dst, dst_width, dst_height, 0); +subimage_with_fill_template(src, x, y, stride, width, height, dst, dst_width, dst_height, 0, is_interlaced, is_top_field); } /* reorganize alpha data and convert 10b -> 16b */ static void subimage_alpha_with_fill(uint16_t *src, unsigned x, unsigned y, unsigned stride, unsigned width, unsigned height, uint16_t *dst, - unsigned dst_width, unsigned dst_height) + unsigned dst_width, unsigned dst_height, int is_interlaced, int is_top_field) { -subimage_with_fill_template(src, x, y, stride, width, height, dst, dst_width, dst_height, 1); +subimage_with_fill_template(src, x, y, stride, width, height, dst, dst_width, dst_height, 1, is_interlaced, is_top_field); } static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, int mb_x, int mb_y, unsigned mb_count, uint8_t *buf, unsigned data_size, -int unsafe, int *qp) +int unsafe, int *qp, int is_interlaced, int is_top_field) { int luma_stride, chroma_stride, alpha_stride = 0; ProresContext* ctx = avctx->priv_data; @@ -545,21 +557,33 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, int mb_x, if (ctx->need_alpha) alpha_stride = pic->linesize[3]; +if (!is_interlaced) { dest_y = pic->data[0] + (mb_y << 4) * luma_stride + (mb_x << 5); dest_u = pic->data[1] + (mb_y << 4) * chroma_stride + (mb_x << (5 - ctx->is_422)); dest_v = pic->data[2] + (mb_y << 4) * chroma_stride + (mb_x << (5 - ctx->is_422)); +} else { +dest_y = pic->data[0] + (mb_y << 4) * luma_stride * 2 + (mb_x << 5); +dest_u = pic->data[1] + (mb_y << 4) * chroma_stride * 2 + (mb_x << (5 - ctx->is_422)); +dest_v = pic->data[2] + (mb_y << 4) * chroma_stride * 2 + (mb_x << (5 - ctx->is_422)); +if (!is_top_field){ /* bottom field, offset dest */ +dest_y += luma_stride; +dest_u += chroma_stride; +dest_v += chroma_stride; +} +} if (unsafe) { subimage_with_fill((uint16_t *) pic->data[0], mb_x << 4, mb_y << 4, luma_stride, avctx->width, avctx->height, -(uint16_t
[FFmpeg-cvslog] avcodec/prores_aw : only set color prim, trc, space values if supported
ffmpeg | branch: master | Martin Vignali | Sun Dec 2 21:39:18 2018 +0100| [f237597e116f6af9094b57e979a7acc4afcb] | committer: Martin Vignali avcodec/prores_aw : only set color prim, trc, space values if supported set to unspecified if frame have another value > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f237597e116f6af9094b57e979a7acc4afcb --- libavcodec/proresenc_anatoliy.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index 8047f1c242..b9524b3d99 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -52,6 +52,12 @@ static const int qp_start_table[5] = { 8, 3, 2, 1, 1}; static const int qp_end_table[5] = { 13, 9, 6, 6, 5}; static const int bitrate_table[5] = { 1000, 2100, 3500, 5400, 7000}; +static const int valid_primaries[9] = { AVCOL_PRI_RESERVED0, AVCOL_PRI_BT709, AVCOL_PRI_UNSPECIFIED, AVCOL_PRI_BT470BG, + AVCOL_PRI_SMPTE170M, AVCOL_PRI_BT2020, AVCOL_PRI_SMPTE431, AVCOL_PRI_SMPTE432,INT_MAX }; +static const int valid_trc[4]= { AVCOL_TRC_RESERVED0, AVCOL_TRC_BT709, AVCOL_TRC_UNSPECIFIED, INT_MAX }; +static const int valid_colorspace[5] = { AVCOL_SPC_BT709, AVCOL_SPC_UNSPECIFIED, AVCOL_SPC_SMPTE170M, + AVCOL_SPC_BT2020_NCL, INT_MAX }; + static const uint8_t QMAT_LUMA[5][64] = { { 4, 7, 9, 11, 13, 14, 15, 63, @@ -686,9 +692,10 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt, *buf++ = 0x82; // 422, not interlaced } *buf++ = 0; /* reserved */ -*buf++ = pict->color_primaries; -*buf++ = pict->color_trc; -*buf++ = pict->colorspace; +/* only write color properties, if valid value. set to unspecified otherwise */ +*buf++ = ff_int_from_list_or_default(avctx, "frame color primaries", pict->color_primaries, valid_primaries, 0); +*buf++ = ff_int_from_list_or_default(avctx, "frame color trc", pict->color_trc, valid_trc, 0); +*buf++ = ff_int_from_list_or_default(avctx, "frame colorspace", pict->colorspace, valid_colorspace, 0); if (avctx->profile >= FF_PROFILE_PRORES_) { if (avctx->pix_fmt == AV_PIX_FMT_YUV444P10) { *buf++ = 0xA0;/* src b64a and no alpha */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/prores_aw : add 4444 xq support
ffmpeg | branch: master | Martin Vignali | Sun Dec 2 21:40:56 2018 +0100| [1edaf601f3a25b2c6d264d39078aa28ae9300615] | committer: Martin Vignali avcodec/prores_aw : add xq support > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1edaf601f3a25b2c6d264d39078aa28ae9300615 --- libavcodec/proresenc_anatoliy.c | 37 - 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index b9524b3d99..2bed58bdc1 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -45,12 +45,13 @@ static const AVProfile profiles[] = { { FF_PROFILE_PRORES_STANDARD, "apcn"}, { FF_PROFILE_PRORES_HQ, "apch"}, { FF_PROFILE_PRORES_, "ap4h"}, +{ FF_PROFILE_PRORES_XQ, "ap4x"}, { FF_PROFILE_UNKNOWN } }; -static const int qp_start_table[5] = { 8, 3, 2, 1, 1}; -static const int qp_end_table[5] = { 13, 9, 6, 6, 5}; -static const int bitrate_table[5] = { 1000, 2100, 3500, 5400, 7000}; +static const int qp_start_table[6] = { 8, 3, 2, 1, 1, 1}; +static const int qp_end_table[6] = { 13, 9, 6, 6, 5, 4}; +static const int bitrate_table[6] = { 1000, 2100, 3500, 5400, 7000, 1}; static const int valid_primaries[9] = { AVCOL_PRI_RESERVED0, AVCOL_PRI_BT709, AVCOL_PRI_UNSPECIFIED, AVCOL_PRI_BT470BG, AVCOL_PRI_SMPTE170M, AVCOL_PRI_BT2020, AVCOL_PRI_SMPTE431, AVCOL_PRI_SMPTE432,INT_MAX }; @@ -58,7 +59,7 @@ static const int valid_trc[4]= { AVCOL_TRC_RESERVED0, AVCOL_TRC_BT709, A static const int valid_colorspace[5] = { AVCOL_SPC_BT709, AVCOL_SPC_UNSPECIFIED, AVCOL_SPC_SMPTE170M, AVCOL_SPC_BT2020_NCL, INT_MAX }; -static const uint8_t QMAT_LUMA[5][64] = { +static const uint8_t QMAT_LUMA[6][64] = { { 4, 7, 9, 11, 13, 14, 15, 63, 7, 7, 11, 12, 14, 15, 63, 63, @@ -104,10 +105,19 @@ static const uint8_t QMAT_LUMA[5][64] = { 4, 4, 4, 4, 4, 5, 5, 6, 4, 4, 4, 4, 5, 5, 6, 7, 4, 4, 4, 4, 5, 6, 7, 7 +}, { /* 444 XQ */ +2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 3, +2, 2, 2, 2, 2, 2, 3, 3, +2, 2, 2, 2, 2, 3, 3, 3, +2, 2, 2, 2, 3, 3, 3, 4, +2, 2, 2, 2, 3, 3, 4, 4, } }; -static const uint8_t QMAT_CHROMA[5][64] = { +static const uint8_t QMAT_CHROMA[6][64] = { { 4, 7, 9, 11, 13, 14, 63, 63, 7, 7, 11, 12, 14, 63, 63, 63, @@ -153,6 +163,15 @@ static const uint8_t QMAT_CHROMA[5][64] = { 4, 4, 4, 4, 4, 5, 5, 6, 4, 4, 4, 4, 5, 5, 6, 7, 4, 4, 4, 4, 5, 6, 7, 7 +}, { /* 444 xq */ +4, 4, 4, 4, 4, 4, 4, 4, +4, 4, 4, 4, 4, 4, 4, 4, +4, 4, 4, 4, 4, 4, 4, 4, +4, 4, 4, 4, 4, 4, 4, 5, +4, 4, 4, 4, 4, 4, 5, 5, +4, 4, 4, 4, 4, 5, 5, 6, +4, 4, 4, 4, 5, 5, 6, 7, +4, 4, 4, 4, 5, 6, 7, 7 } }; @@ -686,7 +705,7 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt, bytestream_put_buffer(&buf, ctx->vendor, 4); bytestream_put_be16(&buf, avctx->width); bytestream_put_be16(&buf, avctx->height); -if (avctx->profile == FF_PROFILE_PRORES_) { +if (avctx->profile >= FF_PROFILE_PRORES_) { /* or Xq */ *buf++ = 0xC2; // 444, not interlaced } else { *buf++ = 0x82; // 422, not interlaced @@ -768,16 +787,16 @@ static av_cold int prores_encode_init(AVCodecContext *avctx) return AVERROR(EINVAL); } } else if (avctx->profile < FF_PROFILE_PRORES_PROXY -|| avctx->profile > FF_PROFILE_PRORES_) { +|| avctx->profile > FF_PROFILE_PRORES_XQ) { av_log( avctx, AV_LOG_ERROR, -"unknown profile %d, use [0 - apco, 1 - apcs, 2 - apcn (default), 3 - apch, 4 - ap4h]\n", +"unknown profile %d, use [0 - apco, 1 - apcs, 2 - apcn (default), 3 - apch, 4 - ap4h, 5 - ap4x]\n", avctx->profile); return AVERROR(EINVAL); } else if ((avctx->pix_fmt == AV_PIX_FMT_YUV422P10) && (avctx->profile > FF_PROFILE_PRORES_HQ)){ av_log(avctx, AV_LOG_ERROR, - "encoding with ProRes 444 (ap4h) profile, need YUV444P10 input\n"); + "encoding with ProRes 444/Xq (ap4h/ap4x) profile, need YUV444P10 input\n"); return AVERROR(EINVAL); } else if ((avctx->pix_fmt == AV_PIX_FMT_YUV444P10 || avctx->pix_fmt == AV_PIX_FMT_YUVA444P10)
[FFmpeg-cvslog] avcodec/utils : add ff_int_from_list_or_default func
ffmpeg | branch: master | Martin Vignali | Sun Dec 2 21:36:24 2018 +0100| [e53901ba5ec3284b8d5882df47cbd8d888279220] | committer: Martin Vignali avcodec/utils : add ff_int_from_list_or_default func to check valid value, or return default_value > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e53901ba5ec3284b8d5882df47cbd8d888279220 --- libavcodec/internal.h | 12 libavcodec/utils.c| 19 +++ 2 files changed, 31 insertions(+) diff --git a/libavcodec/internal.h b/libavcodec/internal.h index 0c2133f092..f2e6f00ace 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -404,6 +404,18 @@ int ff_alloc_a53_sei(const AVFrame *frame, size_t prefix_len, */ int64_t ff_guess_coded_bitrate(AVCodecContext *avctx); +/** + * Check if a value is in the list. If not, return the default value + * + * @param ctxContext for the log msg + * @param val_name Name of the checked value, for log msg + * @param array_valid_values Array of valid int, ended with INT_MAX + * @param default_value Value return if checked value is not in the array + * @return Value or default_value. + */ +int ff_int_from_list_or_default(void *ctx, const char * val_name, int val, +const int * array_valid_values, int default_value); + #if defined(_WIN32) && CONFIG_SHARED && !defined(BUILDING_avcodec) #define av_export_avcodec __declspec(dllimport) #else diff --git a/libavcodec/utils.c b/libavcodec/utils.c index c4c64a6ca4..2fa811d499 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -2209,3 +2209,22 @@ int64_t ff_guess_coded_bitrate(AVCodecContext *avctx) return bitrate; } + +int ff_int_from_list_or_default(void *ctx, const char * val_name, int val, +const int * array_valid_values, int default_value) +{ +int i = 0, ref_val; + +while (1) { +ref_val = array_valid_values[i]; +if (ref_val == INT_MAX) +break; +if (val == ref_val) +return val; +i++; +} +/* val is not a valid value */ +av_log(ctx, AV_LOG_DEBUG, + "%s %d are not supported. Set to default value : %d\n", val_name, val, default_value); +return default_value; +} ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/prores_aw : add vendor option
ffmpeg | branch: master | Martin Vignali | Sat Nov 24 22:46:59 2018 +0100| [4141d45ae385471b4afedd488bbfe53f7c4b89a3] | committer: Martin Vignali avcodec/prores_aw : add vendor option code come from prores_ks > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4141d45ae385471b4afedd488bbfe53f7c4b89a3 --- libavcodec/proresenc_anatoliy.c | 36 +++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index f2fe98dbd9..8047f1c242 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -27,6 +27,7 @@ * Known FOURCCs: 'ap4h' (444), 'apch' (HQ), 'apcn' (422), 'apcs' (LT), 'acpo' (Proxy) */ +#include "libavutil/opt.h" #include "avcodec.h" #include "dct.h" #include "internal.h" @@ -151,6 +152,7 @@ static const uint8_t QMAT_CHROMA[5][64] = { typedef struct { +AVClass *class; FDCTDSPContext fdsp; uint8_t* fill_y; uint8_t* fill_u; @@ -162,6 +164,8 @@ typedef struct { int is_422; int need_alpha; + +char *vendor; } ProresContext; static void encode_codeword(PutBitContext *pb, int val, int codebook) @@ -651,6 +655,7 @@ static int prores_encode_picture(AVCodecContext *avctx, const AVFrame *pic, static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet) { +ProresContext *ctx = avctx->priv_data; int header_size = 148; uint8_t *buf; int pic_size, ret; @@ -672,7 +677,7 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt, bytestream_put_be16(&buf, header_size); bytestream_put_be16(&buf, 0); /* version */ -bytestream_put_buffer(&buf, "fmpg", 4); +bytestream_put_buffer(&buf, ctx->vendor, 4); bytestream_put_be16(&buf, avctx->width); bytestream_put_be16(&buf, avctx->height); if (avctx->profile == FF_PROFILE_PRORES_) { @@ -733,6 +738,11 @@ static av_cold int prores_encode_init(AVCodecContext *avctx) return AVERROR(EINVAL); } +if (strlen(ctx->vendor) != 4) { +av_log(avctx, AV_LOG_ERROR, "vendor ID should be 4 bytes\n"); +return AVERROR(EINVAL); +} + if (avctx->profile == FF_PROFILE_UNKNOWN) { if (avctx->pix_fmt == AV_PIX_FMT_YUV422P10) { avctx->profile = FF_PROFILE_PRORES_STANDARD; @@ -816,6 +826,28 @@ static av_cold int prores_encode_close(AVCodecContext *avctx) return 0; } +#define OFFSET(x) offsetof(ProresContext, x) +#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM + +static const AVOption options[] = { +{ "vendor", "vendor ID", OFFSET(vendor), AV_OPT_TYPE_STRING, { .str = "fmpg" }, CHAR_MIN, CHAR_MAX, VE }, +{ NULL } +}; + +static const AVClass proresaw_enc_class = { +.class_name = "ProResAw encoder", +.item_name = av_default_item_name, +.option = options, +.version= LIBAVUTIL_VERSION_INT, +}; + +static const AVClass prores_enc_class = { +.class_name = "ProRes encoder", +.item_name = av_default_item_name, +.option = options, +.version= LIBAVUTIL_VERSION_INT, +}; + AVCodec ff_prores_aw_encoder = { .name = "prores_aw", .long_name = NULL_IF_CONFIG_SMALL("Apple ProRes"), @@ -827,6 +859,7 @@ AVCodec ff_prores_aw_encoder = { .encode2= prores_encode_frame, .pix_fmts = (const enum AVPixelFormat[]){AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_NONE}, .capabilities = AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_INTRA_ONLY, +.priv_class = &proresaw_enc_class, .profiles = NULL_IF_CONFIG_SMALL(ff_prores_profiles), }; @@ -841,5 +874,6 @@ AVCodec ff_prores_encoder = { .encode2= prores_encode_frame, .pix_fmts = (const enum AVPixelFormat[]){AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_NONE}, .capabilities = AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_INTRA_ONLY, +.priv_class = &prores_enc_class, .profiles = NULL_IF_CONFIG_SMALL(ff_prores_profiles), }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/proresdec : add unpack alpha 12 func
ffmpeg | branch: master | Martin Vignali | Sat Nov 17 23:37:23 2018 +0100| [fddc92d45479950e5a2a718563f6347e26bc3c11] | committer: Martin Vignali avcodec/proresdec : add unpack alpha 12 func > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fddc92d45479950e5a2a718563f6347e26bc3c11 --- libavcodec/proresdec2.c | 47 +-- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c index 40d15720ba..8a537eed1a 100644 --- a/libavcodec/proresdec2.c +++ b/libavcodec/proresdec2.c @@ -46,6 +46,11 @@ static void permute(uint8_t *dst, const uint8_t *src, const uint8_t permutation[ dst[i] = permutation[src[i]]; } +#define ALPHA_SHIFT_16_TO_10(alpha_val) (alpha_val >> 6) +#define ALPHA_SHIFT_8_TO_10(alpha_val) ((alpha_val << 2) | (alpha_val >> 6)) +#define ALPHA_SHIFT_16_TO_12(alpha_val) (alpha_val >> 4) +#define ALPHA_SHIFT_8_TO_12(alpha_val) ((alpha_val << 4) | (alpha_val >> 4)) + static void inline unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs, const int num_bits, const int decode_precision) { const int mask = (1 << num_bits) - 1; @@ -67,9 +72,17 @@ static void inline unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs } alpha_val = (alpha_val + val) & mask; if (num_bits == 16) { -dst[idx++] = alpha_val >> 6; +if (decode_precision == 10) { +dst[idx++] = ALPHA_SHIFT_16_TO_10(alpha_val); +} else { /* 12b */ +dst[idx++] = ALPHA_SHIFT_16_TO_12(alpha_val); +} } else { -dst[idx++] = (alpha_val << 2) | (alpha_val >> 6); +if (decode_precision == 10) { +dst[idx++] = ALPHA_SHIFT_8_TO_10(alpha_val); +} else { /* 12b */ +dst[idx++] = ALPHA_SHIFT_8_TO_12(alpha_val); +} } if (idx >= num_coeffs) break; @@ -80,11 +93,21 @@ static void inline unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs if (idx + val > num_coeffs) val = num_coeffs - idx; if (num_bits == 16) { -for (i = 0; i < val; i++) -dst[idx++] = alpha_val >> 6; +for (i = 0; i < val; i++) { +if (decode_precision == 10) { +dst[idx++] = ALPHA_SHIFT_16_TO_10(alpha_val); +} else { /* 12b */ +dst[idx++] = ALPHA_SHIFT_16_TO_12(alpha_val); +} +} } else { -for (i = 0; i < val; i++) -dst[idx++] = (alpha_val << 2) | (alpha_val >> 6); +for (i = 0; i < val; i++) { +if (decode_precision == 10) { +dst[idx++] = ALPHA_SHIFT_8_TO_10(alpha_val); +} else { /* 12b */ +dst[idx++] = ALPHA_SHIFT_8_TO_12(alpha_val); +} +} } } while (idx < num_coeffs); } @@ -99,6 +122,16 @@ static void unpack_alpha_10(GetBitContext *gb, uint16_t *dst, int num_coeffs, } } +static void unpack_alpha_12(GetBitContext *gb, uint16_t *dst, int num_coeffs, +const int num_bits) +{ +if (num_bits == 16) { +unpack_alpha(gb, dst, num_coeffs, 16, 12); +} else { /* 8 bits alpha */ +unpack_alpha(gb, dst, num_coeffs, 8, 12); +} +} + static av_cold int decode_init(AVCodecContext *avctx) { int ret = 0; @@ -146,6 +179,8 @@ static av_cold int decode_init(AVCodecContext *avctx) if (avctx->bits_per_raw_sample == 10){ ctx->unpack_alpha = unpack_alpha_10; +} else if (avctx->bits_per_raw_sample == 12){ +ctx->unpack_alpha = unpack_alpha_12; } else { av_log(avctx, AV_LOG_ERROR, "Fail to set unpack_alpha for bits per raw sample %d\n", avctx->bits_per_raw_sample); return AVERROR_BUG; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/proresdsp : remove unused value
ffmpeg | branch: master | Martin Vignali | Sat Nov 17 23:32:43 2018 +0100| [dae9b4b8a4d9aee62a9fbb944da40b08ff442365] | committer: Martin Vignali avcodec/proresdsp : remove unused value > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dae9b4b8a4d9aee62a9fbb944da40b08ff442365 --- libavcodec/proresdsp.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/proresdsp.c b/libavcodec/proresdsp.c index 5b5ada21fe..3c337dc433 100644 --- a/libavcodec/proresdsp.c +++ b/libavcodec/proresdsp.c @@ -27,7 +27,6 @@ #include "proresdsp.h" #include "simple_idct.h" -#define BIAS (1 << (PRORES_BITS_PER_SAMPLE - 1)) ///< bias value for converting signed pixels into unsigned ones #define CLIP_MIN (1 << (PRORES_BITS_PER_SAMPLE - 8)) ///< minimum value for clipping resulting pixels #define CLIP_MAX (1 << PRORES_BITS_PER_SAMPLE) - CLIP_MIN - 1 ///< maximum value for clipping resulting pixels ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/proresdec : make inline func for unpack alpha
ffmpeg | branch: master | Martin Vignali | Sat Nov 17 23:37:00 2018 +0100| [859604fe9d680fbd1abc4b78a528909904874d95] | committer: Martin Vignali avcodec/proresdec : make inline func for unpack alpha > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=859604fe9d680fbd1abc4b78a528909904874d95 --- libavcodec/proresdec2.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c index 94323df128..40d15720ba 100644 --- a/libavcodec/proresdec2.c +++ b/libavcodec/proresdec2.c @@ -46,9 +46,8 @@ static void permute(uint8_t *dst, const uint8_t *src, const uint8_t permutation[ dst[i] = permutation[src[i]]; } -static void unpack_alpha_10(GetBitContext *gb, uint16_t *dst, int num_coeffs, -const int num_bits) -{ +static void inline unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs, +const int num_bits, const int decode_precision) { const int mask = (1 << num_bits) - 1; int i, idx, val, alpha_val; @@ -86,11 +85,20 @@ static void unpack_alpha_10(GetBitContext *gb, uint16_t *dst, int num_coeffs, } else { for (i = 0; i < val; i++) dst[idx++] = (alpha_val << 2) | (alpha_val >> 6); - } } while (idx < num_coeffs); } +static void unpack_alpha_10(GetBitContext *gb, uint16_t *dst, int num_coeffs, +const int num_bits) +{ +if (num_bits == 16) { +unpack_alpha(gb, dst, num_coeffs, 16, 10); +} else { /* 8 bits alpha */ +unpack_alpha(gb, dst, num_coeffs, 8, 10); +} +} + static av_cold int decode_init(AVCodecContext *avctx) { int ret = 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/utils : add YUVA444P12 and YUVA422P12 to pixfmt who need height padding in avcodec_align_dimensions2
ffmpeg | branch: master | Martin Vignali | Tue Nov 27 22:21:47 2018 +0100| [a87ca4bbcab067baefadd7833f107912f4698a00] | committer: Martin Vignali avcodec/utils : add YUVA444P12 and YUVA422P12 to pixfmt who need height padding in avcodec_align_dimensions2 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a87ca4bbcab067baefadd7833f107912f4698a00 --- libavcodec/utils.c | 4 1 file changed, 4 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 1661d48b90..c4c64a6ca4 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -214,6 +214,8 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, case AV_PIX_FMT_YUVA422P9BE: case AV_PIX_FMT_YUVA422P10LE: case AV_PIX_FMT_YUVA422P10BE: +case AV_PIX_FMT_YUVA422P12LE: +case AV_PIX_FMT_YUVA422P12BE: case AV_PIX_FMT_YUVA422P16LE: case AV_PIX_FMT_YUVA422P16BE: case AV_PIX_FMT_YUV440P10LE: @@ -234,6 +236,8 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, case AV_PIX_FMT_YUVA444P9BE: case AV_PIX_FMT_YUVA444P10LE: case AV_PIX_FMT_YUVA444P10BE: +case AV_PIX_FMT_YUVA444P12LE: +case AV_PIX_FMT_YUVA444P12BE: case AV_PIX_FMT_YUVA444P16LE: case AV_PIX_FMT_YUVA444P16BE: case AV_PIX_FMT_GBRP9LE: ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/proresdec : rename dsp part for 10b and check dspinit for supported bits per raw sample
ffmpeg | branch: master | Martin Vignali | Sat Nov 17 23:35:35 2018 +0100| [c097a32e93b4b4d9cb576bf21014b19121806161] | committer: Martin Vignali avcodec/proresdec : rename dsp part for 10b and check dspinit for supported bits per raw sample based on patch by Kieran Kunhya > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c097a32e93b4b4d9cb576bf21014b19121806161 --- libavcodec/proresdec2.c | 9 +++-- libavcodec/proresdsp.c | 25 +++-- libavcodec/proresdsp.h | 4 +--- libavcodec/simple_idct.c| 2 +- libavcodec/simple_idct.h| 2 +- libavcodec/tests/dct.c | 2 +- libavcodec/x86/proresdsp_init.c | 2 ++ 7 files changed, 28 insertions(+), 18 deletions(-) diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c index 835df19418..12b2cba090 100644 --- a/libavcodec/proresdec2.c +++ b/libavcodec/proresdec2.c @@ -48,6 +48,7 @@ static void permute(uint8_t *dst, const uint8_t *src, const uint8_t permutation[ static av_cold int decode_init(AVCodecContext *avctx) { +int ret = 0; ProresContext *ctx = avctx->priv_data; uint8_t idct_permutation[64]; @@ -78,7 +79,11 @@ static av_cold int decode_init(AVCodecContext *avctx) } ff_blockdsp_init(&ctx->bdsp, avctx); -ff_proresdsp_init(&ctx->prodsp, avctx); +ret = ff_proresdsp_init(&ctx->prodsp, avctx); +if (ret < 0) { +av_log(avctx, AV_LOG_ERROR, "Fail to init proresdsp for bits per raw sample %d\n", avctx->bits_per_raw_sample); +return ret; +} ff_init_scantable_permutation(idct_permutation, ctx->prodsp.idct_permutation_type); @@ -86,7 +91,7 @@ static av_cold int decode_init(AVCodecContext *avctx) permute(ctx->progressive_scan, ff_prores_progressive_scan, idct_permutation); permute(ctx->interlaced_scan, ff_prores_interlaced_scan, idct_permutation); -return 0; +return ret; } static int decode_frame_header(ProresContext *ctx, const uint8_t *buf, diff --git a/libavcodec/proresdsp.c b/libavcodec/proresdsp.c index 3c337dc433..6b15ed3add 100644 --- a/libavcodec/proresdsp.c +++ b/libavcodec/proresdsp.c @@ -27,15 +27,15 @@ #include "proresdsp.h" #include "simple_idct.h" -#define CLIP_MIN (1 << (PRORES_BITS_PER_SAMPLE - 8)) ///< minimum value for clipping resulting pixels -#define CLIP_MAX (1 << PRORES_BITS_PER_SAMPLE) - CLIP_MIN - 1 ///< maximum value for clipping resulting pixels +#define CLIP_MIN (1 << 2) ///< minimum value for clipping resulting pixels +#define CLIP_MAX_10 (1 << 10) - CLIP_MIN - 1 ///< maximum value for clipping resulting pixels -#define CLIP(x) (av_clip((x), CLIP_MIN, CLIP_MAX)) +#define CLIP_10(x) (av_clip((x), CLIP_MIN, CLIP_MAX_10)) /** * Add bias value, clamp and output pixels of a slice */ -static void put_pixels(uint16_t *dst, ptrdiff_t linesize, const int16_t *in) +static void put_pixels_10(uint16_t *dst, ptrdiff_t linesize, const int16_t *in) { int x, y, src_offset, dst_offset; @@ -43,25 +43,30 @@ static void put_pixels(uint16_t *dst, ptrdiff_t linesize, const int16_t *in) for (x = 0; x < 8; x++) { src_offset = (y << 3) + x; -dst[dst_offset + x] = CLIP(in[src_offset]); +dst[dst_offset + x] = CLIP_10(in[src_offset]); } } } -static void prores_idct_put_c(uint16_t *out, ptrdiff_t linesize, int16_t *block, const int16_t *qmat) +static void prores_idct_put_10_c(uint16_t *out, ptrdiff_t linesize, int16_t *block, const int16_t *qmat) { -ff_prores_idct(block, qmat); -put_pixels(out, linesize >> 1, block); +ff_prores_idct_10(block, qmat); +put_pixels_10(out, linesize >> 1, block); } -av_cold void ff_proresdsp_init(ProresDSPContext *dsp, AVCodecContext *avctx) +av_cold int ff_proresdsp_init(ProresDSPContext *dsp, AVCodecContext *avctx) { -dsp->idct_put = prores_idct_put_c; +if (avctx->bits_per_raw_sample == 10) { +dsp->idct_put = prores_idct_put_10_c; dsp->idct_permutation_type = FF_IDCT_PERM_NONE; +} else { +return AVERROR_BUG; +} if (ARCH_X86) ff_proresdsp_init_x86(dsp, avctx); ff_init_scantable_permutation(dsp->idct_permutation, dsp->idct_permutation_type); +return 0; } diff --git a/libavcodec/proresdsp.h b/libavcodec/proresdsp.h index 558fae53bf..37ba76b8e4 100644 --- a/libavcodec/proresdsp.h +++ b/libavcodec/proresdsp.h @@ -27,15 +27,13 @@ #include #include "avcodec.h" -#define PRORES_BITS_PER_SAMPLE 10 ///< output precision of prores decoder - typedef struct ProresDSPContext { int idct_permutation_type; uint8_t idct_permutation[64]; void (*idct_put)(uint16_t *out, ptrdiff_t linesize, int16_t *block, c
[FFmpeg-cvslog] avcodec/proresdsp indent after prev commit
ffmpeg | branch: master | Martin Vignali | Sat Nov 17 23:35:52 2018 +0100| [9a22e6fa1dec29cc2f8bc3cd217d20573e19ebe7] | committer: Martin Vignali avcodec/proresdsp indent after prev commit > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9a22e6fa1dec29cc2f8bc3cd217d20573e19ebe7 --- libavcodec/proresdsp.c | 4 ++-- libavcodec/x86/proresdsp_init.c | 16 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libavcodec/proresdsp.c b/libavcodec/proresdsp.c index 6b15ed3add..7be7e68287 100644 --- a/libavcodec/proresdsp.c +++ b/libavcodec/proresdsp.c @@ -57,8 +57,8 @@ static void prores_idct_put_10_c(uint16_t *out, ptrdiff_t linesize, int16_t *blo av_cold int ff_proresdsp_init(ProresDSPContext *dsp, AVCodecContext *avctx) { if (avctx->bits_per_raw_sample == 10) { -dsp->idct_put = prores_idct_put_10_c; -dsp->idct_permutation_type = FF_IDCT_PERM_NONE; +dsp->idct_put = prores_idct_put_10_c; +dsp->idct_permutation_type = FF_IDCT_PERM_NONE; } else { return AVERROR_BUG; } diff --git a/libavcodec/x86/proresdsp_init.c b/libavcodec/x86/proresdsp_init.c index 747aeb826e..bde79ab8c0 100644 --- a/libavcodec/x86/proresdsp_init.c +++ b/libavcodec/x86/proresdsp_init.c @@ -36,15 +36,15 @@ av_cold void ff_proresdsp_init_x86(ProresDSPContext *dsp, AVCodecContext *avctx) int cpu_flags = av_get_cpu_flags(); if (avctx->bits_per_raw_sample == 10){ -if (EXTERNAL_SSE2(cpu_flags)) { -dsp->idct_permutation_type = FF_IDCT_PERM_TRANSPOSE; -dsp->idct_put = ff_prores_idct_put_10_sse2; -} +if (EXTERNAL_SSE2(cpu_flags)) { +dsp->idct_permutation_type = FF_IDCT_PERM_TRANSPOSE; +dsp->idct_put = ff_prores_idct_put_10_sse2; +} -if (EXTERNAL_AVX(cpu_flags)) { -dsp->idct_permutation_type = FF_IDCT_PERM_TRANSPOSE; -dsp->idct_put = ff_prores_idct_put_10_avx; -} +if (EXTERNAL_AVX(cpu_flags)) { +dsp->idct_permutation_type = FF_IDCT_PERM_TRANSPOSE; +dsp->idct_put = ff_prores_idct_put_10_avx; +} } #endif /* ARCH_X86_64 */ } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/proresdec : add 12b prores idct
ffmpeg | branch: master | Martin Vignali | Sat Nov 17 23:37:50 2018 +0100| [6a583261ea631e6da5593c4477e36fde9bc731ab] | committer: Martin Vignali avcodec/proresdec : add 12b prores idct based on patch by Kieran Kunhya > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6a583261ea631e6da5593c4477e36fde9bc731ab --- libavcodec/proresdsp.c | 31 --- libavcodec/simple_idct.c | 16 libavcodec/simple_idct.h | 1 + 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/libavcodec/proresdsp.c b/libavcodec/proresdsp.c index 7be7e68287..a3c618cdd1 100644 --- a/libavcodec/proresdsp.c +++ b/libavcodec/proresdsp.c @@ -29,36 +29,61 @@ #define CLIP_MIN (1 << 2) ///< minimum value for clipping resulting pixels #define CLIP_MAX_10 (1 << 10) - CLIP_MIN - 1 ///< maximum value for clipping resulting pixels +#define CLIP_MAX_12 (1 << 12) - CLIP_MIN - 1 ///< maximum value for clipping resulting pixels #define CLIP_10(x) (av_clip((x), CLIP_MIN, CLIP_MAX_10)) +#define CLIP_12(x) (av_clip((x), CLIP_MIN, CLIP_MAX_12)) /** * Add bias value, clamp and output pixels of a slice */ -static void put_pixels_10(uint16_t *dst, ptrdiff_t linesize, const int16_t *in) -{ + +static inline void put_pixel(uint16_t *dst, ptrdiff_t linesize, const int16_t *in, int bits_per_raw_sample) { int x, y, src_offset, dst_offset; for (y = 0, dst_offset = 0; y < 8; y++, dst_offset += linesize) { for (x = 0; x < 8; x++) { src_offset = (y << 3) + x; -dst[dst_offset + x] = CLIP_10(in[src_offset]); +if (bits_per_raw_sample == 10) { +dst[dst_offset + x] = CLIP_10(in[src_offset]); +} else {//12b +dst[dst_offset + x] = CLIP_12(in[src_offset]); +} } } } +static void put_pixels_10(uint16_t *dst, ptrdiff_t linesize, const int16_t *in) +{ +put_pixel(dst, linesize, in, 10); +} + +static void put_pixels_12(uint16_t *dst, ptrdiff_t linesize, const int16_t *in) +{ +put_pixel(dst, linesize, in, 12); +} + static void prores_idct_put_10_c(uint16_t *out, ptrdiff_t linesize, int16_t *block, const int16_t *qmat) { ff_prores_idct_10(block, qmat); put_pixels_10(out, linesize >> 1, block); } +static void prores_idct_put_12_c(uint16_t *out, ptrdiff_t linesize, int16_t *block, const int16_t *qmat) +{ +ff_prores_idct_12(block, qmat); +put_pixels_12(out, linesize >> 1, block); +} + av_cold int ff_proresdsp_init(ProresDSPContext *dsp, AVCodecContext *avctx) { if (avctx->bits_per_raw_sample == 10) { dsp->idct_put = prores_idct_put_10_c; dsp->idct_permutation_type = FF_IDCT_PERM_NONE; +} else if (avctx->bits_per_raw_sample == 12) { +dsp->idct_put = prores_idct_put_12_c; +dsp->idct_permutation_type = FF_IDCT_PERM_NONE; } else { return AVERROR_BUG; } diff --git a/libavcodec/simple_idct.c b/libavcodec/simple_idct.c index 2171d71d06..3b2e736538 100644 --- a/libavcodec/simple_idct.c +++ b/libavcodec/simple_idct.c @@ -251,3 +251,19 @@ void ff_prores_idct_10(int16_t *block, const int16_t *qmat) idctSparseCol_extrashift_10(block + i); } } + +void ff_prores_idct_12(int16_t *block, const int16_t *qmat) +{ +int i; + +for (i = 0; i < 64; i++) +block[i] *= qmat[i]; + +for (i = 0; i < 8; i++) +idctRowCondDC_int16_12bit(block + i*8, 0); + +for (i = 0; i < 8; i++) { +block[i] += 8192; +idctSparseCol_int16_12bit(block + i); +} +} diff --git a/libavcodec/simple_idct.h b/libavcodec/simple_idct.h index 634a78e59e..20578b3347 100644 --- a/libavcodec/simple_idct.h +++ b/libavcodec/simple_idct.h @@ -53,6 +53,7 @@ void ff_simple_idct_int16_12bit(int16_t *block); * for larger scale of input coefficients. */ void ff_prores_idct_10(int16_t *block, const int16_t *qmat); +void ff_prores_idct_12(int16_t *block, const int16_t *qmat); void ff_simple_idct248_put(uint8_t *dest, ptrdiff_t line_size, int16_t *block); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/proresdec : move dsp init after codec tag check
ffmpeg | branch: master | Martin Vignali | Sat Nov 17 23:33:12 2018 +0100| [a970920026010bd9e03f99017c305212b889d4a5] | committer: Martin Vignali avcodec/proresdec : move dsp init after codec tag check > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a970920026010bd9e03f99017c305212b889d4a5 --- libavcodec/proresdec2.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c index 130a4e3fe8..835df19418 100644 --- a/libavcodec/proresdec2.c +++ b/libavcodec/proresdec2.c @@ -53,15 +53,6 @@ static av_cold int decode_init(AVCodecContext *avctx) avctx->bits_per_raw_sample = 10; -ff_blockdsp_init(&ctx->bdsp, avctx); -ff_proresdsp_init(&ctx->prodsp, avctx); - -ff_init_scantable_permutation(idct_permutation, - ctx->prodsp.idct_permutation_type); - -permute(ctx->progressive_scan, ff_prores_progressive_scan, idct_permutation); -permute(ctx->interlaced_scan, ff_prores_interlaced_scan, idct_permutation); - switch (avctx->codec_tag) { case MKTAG('a','p','c','o'): avctx->profile = FF_PROFILE_PRORES_PROXY; @@ -86,6 +77,15 @@ static av_cold int decode_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_WARNING, "Unknown prores profile %d\n", avctx->codec_tag); } +ff_blockdsp_init(&ctx->bdsp, avctx); +ff_proresdsp_init(&ctx->prodsp, avctx); + +ff_init_scantable_permutation(idct_permutation, + ctx->prodsp.idct_permutation_type); + +permute(ctx->progressive_scan, ff_prores_progressive_scan, idct_permutation); +permute(ctx->interlaced_scan, ff_prores_interlaced_scan, idct_permutation); + return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/proresdec : add 12b decoding
ffmpeg | branch: master | Martin Vignali | Tue Nov 27 22:41:38 2018 +0100| [ffafa53dbf06c8967aada9b7c0fc7ef9cb374fc0] | committer: Martin Vignali avcodec/proresdec : add 12b decoding based on patch by Kieran Kunhya ticket 7163 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ffafa53dbf06c8967aada9b7c0fc7ef9cb374fc0 --- libavcodec/proresdec2.c | 35 - tests/fate/prores.mak | 8 tests/ref/fate/prores-alpha | 4 ++-- tests/ref/fate/prores-alpha_skip| 4 ++-- tests/ref/fate/prores-transparency | 2 +- tests/ref/fate/prores-transparency_skip | 2 +- 6 files changed, 40 insertions(+), 15 deletions(-) diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c index 8a537eed1a..8581d797fb 100644 --- a/libavcodec/proresdec2.c +++ b/libavcodec/proresdec2.c @@ -155,15 +155,23 @@ static av_cold int decode_init(AVCodecContext *avctx) break; case MKTAG('a','p','4','h'): avctx->profile = FF_PROFILE_PRORES_; +avctx->bits_per_raw_sample = 12; break; case MKTAG('a','p','4','x'): avctx->profile = FF_PROFILE_PRORES_XQ; +avctx->bits_per_raw_sample = 12; break; default: avctx->profile = FF_PROFILE_UNKNOWN; av_log(avctx, AV_LOG_WARNING, "Unknown prores profile %d\n", avctx->codec_tag); } +if (avctx->bits_per_raw_sample == 10) { +av_log(avctx, AV_LOG_DEBUG, "Auto bitdepth precision. Use 10b decoding based on codec tag"); +} else { /* 12b */ +av_log(avctx, AV_LOG_DEBUG, "Auto bitdepth precision. Use 12b decoding based on codec tag"); +} + ff_blockdsp_init(&ctx->bdsp, avctx); ret = ff_proresdsp_init(&ctx->prodsp, avctx); if (ret < 0) { @@ -211,6 +219,7 @@ static int decode_frame_header(ProresContext *ctx, const uint8_t *buf, width = AV_RB16(buf + 8); height = AV_RB16(buf + 10); + if (width != avctx->width || height != avctx->height) { av_log(avctx, AV_LOG_ERROR, "picture resolution change: %dx%d -> %dx%d\n", avctx->width, avctx->height, width, height); @@ -237,9 +246,17 @@ static int decode_frame_header(ProresContext *ctx, const uint8_t *buf, } if (ctx->alpha_info) { -avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUVA444P10 : AV_PIX_FMT_YUVA422P10; +if (avctx->bits_per_raw_sample == 10) { +avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUVA444P10 : AV_PIX_FMT_YUVA422P10; +} else { /* 12b */ +avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUVA444P12 : AV_PIX_FMT_YUVA422P12; +} } else { -avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P10 : AV_PIX_FMT_YUV422P10; +if (avctx->bits_per_raw_sample == 10) { +avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P10 : AV_PIX_FMT_YUV422P10; +} else { /* 12b */ +avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P12 : AV_PIX_FMT_YUV422P12; +} } avctx->color_primaries = buf[14]; @@ -585,6 +602,7 @@ static void decode_slice_alpha(ProresContext *ctx, } block = blocks; + for (i = 0; i < 16; i++) { memcpy(dst, block, 16 * blocks_per_slice * sizeof(*dst)); dst += dst_stride >> 1; @@ -606,6 +624,7 @@ static int decode_slice_thread(AVCodecContext *avctx, void *arg, int jobnr, int LOCAL_ALIGNED_16(int16_t, qmat_chroma_scaled,[64]); int mb_x_shift; int ret; +uint16_t val_no_chroma; slice->ret = -1; //av_log(avctx, AV_LOG_INFO, "slice %d mb width %d mb x %d y %d\n", @@ -643,7 +662,8 @@ static int decode_slice_thread(AVCodecContext *avctx, void *arg, int jobnr, int chroma_stride = pic->linesize[1] << 1; } -if (avctx->pix_fmt == AV_PIX_FMT_YUV444P10 || avctx->pix_fmt == AV_PIX_FMT_YUVA444P10) { +if (avctx->pix_fmt == AV_PIX_FMT_YUV444P10 || avctx->pix_fmt == AV_PIX_FMT_YUVA444P10 || +avctx->pix_fmt == AV_PIX_FMT_YUV444P12 || avctx->pix_fmt == AV_PIX_FMT_YUVA444P12) { mb_x_shift = 5; log2_chroma_blocks_per_mb = 2; } else { @@ -684,10 +704,15 @@ static int decode_slice_thread(AVCodecContext *avctx, void *arg, int jobnr, int else { size_t mb_max_x = slice->mb_count << (mb_x_shift - 1); size_t i, j; +if (avctx->bits_per_raw_sample == 10) { +val_no_chroma = 511; +} else { /* 12b */ +val_no_chroma = 511 * 4; +} for (i = 0; i < 16; ++i) for (j = 0; j < mb_max_x; ++j) { -
[FFmpeg-cvslog] avcodec/proresdec : put unpack alpha func in prores ctx
ffmpeg | branch: master | Martin Vignali | Sat Nov 17 23:36:23 2018 +0100| [1cccf9365df0351467eca13313ae989da5c2b0f3] | committer: Martin Vignali avcodec/proresdec : put unpack alpha func in prores ctx > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1cccf9365df0351467eca13313ae989da5c2b0f3 --- libavcodec/proresdec.h | 1 + libavcodec/proresdec2.c | 100 +--- 2 files changed, 54 insertions(+), 47 deletions(-) diff --git a/libavcodec/proresdec.h b/libavcodec/proresdec.h index 14ede5d16b..3d99eba078 100644 --- a/libavcodec/proresdec.h +++ b/libavcodec/proresdec.h @@ -50,6 +50,7 @@ typedef struct { const uint8_t *scan; int first_field; int alpha_info; +void (*unpack_alpha)(GetBitContext *gb, uint16_t *dst, int num_coeffs, const int num_bits); } ProresContext; #endif /* AVCODEC_PRORESDEC_H */ diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c index 12b2cba090..94323df128 100644 --- a/libavcodec/proresdec2.c +++ b/libavcodec/proresdec2.c @@ -46,6 +46,51 @@ static void permute(uint8_t *dst, const uint8_t *src, const uint8_t permutation[ dst[i] = permutation[src[i]]; } +static void unpack_alpha_10(GetBitContext *gb, uint16_t *dst, int num_coeffs, +const int num_bits) +{ +const int mask = (1 << num_bits) - 1; +int i, idx, val, alpha_val; + +idx = 0; +alpha_val = mask; +do { +do { +if (get_bits1(gb)) { +val = get_bits(gb, num_bits); +} else { +int sign; +val = get_bits(gb, num_bits == 16 ? 7 : 4); +sign = val & 1; +val = (val + 2) >> 1; +if (sign) +val = -val; +} +alpha_val = (alpha_val + val) & mask; +if (num_bits == 16) { +dst[idx++] = alpha_val >> 6; +} else { +dst[idx++] = (alpha_val << 2) | (alpha_val >> 6); +} +if (idx >= num_coeffs) +break; +} while (get_bits_left(gb)>0 && get_bits1(gb)); +val = get_bits(gb, 4); +if (!val) +val = get_bits(gb, 11); +if (idx + val > num_coeffs) +val = num_coeffs - idx; +if (num_bits == 16) { +for (i = 0; i < val; i++) +dst[idx++] = alpha_val >> 6; +} else { +for (i = 0; i < val; i++) +dst[idx++] = (alpha_val << 2) | (alpha_val >> 6); + +} +} while (idx < num_coeffs); +} + static av_cold int decode_init(AVCodecContext *avctx) { int ret = 0; @@ -91,6 +136,12 @@ static av_cold int decode_init(AVCodecContext *avctx) permute(ctx->progressive_scan, ff_prores_progressive_scan, idct_permutation); permute(ctx->interlaced_scan, ff_prores_interlaced_scan, idct_permutation); +if (avctx->bits_per_raw_sample == 10){ +ctx->unpack_alpha = unpack_alpha_10; +} else { +av_log(avctx, AV_LOG_ERROR, "Fail to set unpack_alpha for bits per raw sample %d\n", avctx->bits_per_raw_sample); +return AVERROR_BUG; +} return ret; } @@ -466,51 +517,6 @@ static int decode_slice_chroma(AVCodecContext *avctx, SliceContext *slice, return 0; } -static void unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs, - const int num_bits) -{ -const int mask = (1 << num_bits) - 1; -int i, idx, val, alpha_val; - -idx = 0; -alpha_val = mask; -do { -do { -if (get_bits1(gb)) { -val = get_bits(gb, num_bits); -} else { -int sign; -val = get_bits(gb, num_bits == 16 ? 7 : 4); -sign = val & 1; -val = (val + 2) >> 1; -if (sign) -val = -val; -} -alpha_val = (alpha_val + val) & mask; -if (num_bits == 16) { -dst[idx++] = alpha_val >> 6; -} else { -dst[idx++] = (alpha_val << 2) | (alpha_val >> 6); -} -if (idx >= num_coeffs) -break; -} while (get_bits_left(gb)>0 && get_bits1(gb)); -val = get_bits(gb, 4); -if (!val) -val = get_bits(gb, 11); -if (idx + val > num_coeffs) -val = num_coeffs - idx; -if (num_bits == 16) { -for (i = 0; i < val; i++) -dst[idx++] = alpha_val >> 6; -} else { -for (i = 0; i < val; i++) -dst[idx++] = (alpha_val << 2) | (alpha_val >> 6); - -} -} while (idx < num_coeffs); -} - /** * Decode alpha slice plane. */ @@ -530,9 +536
[FFmpeg-cvslog] fate/prores-metadata : make output bit exact
ffmpeg | branch: master | Martin Vignali | Sat Nov 24 18:43:12 2018 +0100| [e488d7b4f5075903fb1648ae012dff821d5781cd] | committer: Carl Eugen Hoyos fate/prores-metadata : make output bit exact > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e488d7b4f5075903fb1648ae012dff821d5781cd --- tests/fate/prores.mak | 2 +- tests/ref/fate/prores-metadata | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/fate/prores.mak b/tests/fate/prores.mak index dd52d68f70..2f3375f4fc 100644 --- a/tests/fate/prores.mak +++ b/tests/fate/prores.mak @@ -23,6 +23,6 @@ fate-prores-gray: CMD = framecrc -flags +bitexact -c:a aac_fixed -i $(TARGE #Test bsf prores-metadata FATE_PRORES_METADATA_BSF += fate-prores-metadata -fate-prores-metadata: CMD = md5 -i $(TARGET_SAMPLES)/prores/Sequence_1-Apple_ProRes_422_Proxy.mov -c:v copy -bsf:v prores_metadata=color_primaries=bt470bg:color_trc=bt709:colorspace=smpte170m -f mov +fate-prores-metadata: CMD = md5 -i $(TARGET_SAMPLES)/prores/Sequence_1-Apple_ProRes_422_Proxy.mov -c:v copy -bsf:v prores_metadata=color_primaries=bt470bg:color_trc=bt709:colorspace=smpte170m -bitexact -f mov FATE_SAMPLES_FFMPEG-$(call ALLYES, MOV_DEMUXER PRORES_METADATA_BSF) += $(FATE_PRORES_METADATA_BSF) diff --git a/tests/ref/fate/prores-metadata b/tests/ref/fate/prores-metadata index 7ca177489b..56153c3946 100644 --- a/tests/ref/fate/prores-metadata +++ b/tests/ref/fate/prores-metadata @@ -1 +1 @@ -b4e2c801d594b9614433b284b886be0d +3492734b4bd0dd097cd9f264457c8345 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale : add support for YUVA444P12 and YUVA422P12
ffmpeg | branch: master | Martin Vignali | Sat Nov 24 16:22:52 2018 +0100| [86e6f0dbc7fd31e4a071c9fc1fc94fb9e74e0624] | committer: Martin Vignali swscale : add support for YUVA444P12 and YUVA422P12 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=86e6f0dbc7fd31e4a071c9fc1fc94fb9e74e0624 --- libswscale/input.c | 8 libswscale/utils.c | 4 tests/ref/fate/filter-pixdesc-yuva422p12be | 1 + tests/ref/fate/filter-pixdesc-yuva422p12le | 1 + tests/ref/fate/filter-pixdesc-yuva444p12be | 1 + tests/ref/fate/filter-pixdesc-yuva444p12le | 1 + tests/ref/fate/filter-pixfmts-copy | 4 tests/ref/fate/filter-pixfmts-crop | 4 tests/ref/fate/filter-pixfmts-field| 4 tests/ref/fate/filter-pixfmts-fieldorder | 4 tests/ref/fate/filter-pixfmts-hflip| 4 tests/ref/fate/filter-pixfmts-il | 4 tests/ref/fate/filter-pixfmts-null | 4 tests/ref/fate/filter-pixfmts-pad | 2 ++ tests/ref/fate/filter-pixfmts-scale| 4 tests/ref/fate/filter-pixfmts-swapuv | 4 tests/ref/fate/filter-pixfmts-transpose| 2 ++ tests/ref/fate/filter-pixfmts-vflip| 4 18 files changed, 60 insertions(+) diff --git a/libswscale/input.c b/libswscale/input.c index 4099c19c2b..c2dc356b5d 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -1097,6 +1097,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YUVA420P10LE: case AV_PIX_FMT_YUVA422P10LE: case AV_PIX_FMT_YUVA444P10LE: +case AV_PIX_FMT_YUVA422P12LE: +case AV_PIX_FMT_YUVA444P12LE: case AV_PIX_FMT_YUVA420P16LE: case AV_PIX_FMT_YUVA422P16LE: case AV_PIX_FMT_YUVA444P16LE: @@ -1127,6 +1129,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YUVA420P10BE: case AV_PIX_FMT_YUVA422P10BE: case AV_PIX_FMT_YUVA444P10BE: +case AV_PIX_FMT_YUVA422P12BE: +case AV_PIX_FMT_YUVA444P12BE: case AV_PIX_FMT_YUVA420P16BE: case AV_PIX_FMT_YUVA422P16BE: case AV_PIX_FMT_YUVA444P16BE: @@ -1401,6 +1405,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YUVA420P10LE: case AV_PIX_FMT_YUVA422P10LE: case AV_PIX_FMT_YUVA444P10LE: +case AV_PIX_FMT_YUVA422P12LE: +case AV_PIX_FMT_YUVA444P12LE: case AV_PIX_FMT_YUVA420P16LE: case AV_PIX_FMT_YUVA422P16LE: case AV_PIX_FMT_YUVA444P16LE: @@ -1441,6 +1447,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YUVA420P10BE: case AV_PIX_FMT_YUVA422P10BE: case AV_PIX_FMT_YUVA444P10BE: +case AV_PIX_FMT_YUVA422P12BE: +case AV_PIX_FMT_YUVA444P12BE: case AV_PIX_FMT_YUVA420P16BE: case AV_PIX_FMT_YUVA422P16BE: case AV_PIX_FMT_YUVA444P16BE: diff --git a/libswscale/utils.c b/libswscale/utils.c index d5913ed733..df68bcc0d9 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -260,6 +260,10 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { [AV_PIX_FMT_P016BE] = { 1, 1 }, [AV_PIX_FMT_GRAYF32LE] = { 1, 1 }, [AV_PIX_FMT_GRAYF32BE] = { 1, 1 }, +[AV_PIX_FMT_YUVA422P12BE] = { 1, 1 }, +[AV_PIX_FMT_YUVA422P12LE] = { 1, 1 }, +[AV_PIX_FMT_YUVA444P12BE] = { 1, 1 }, +[AV_PIX_FMT_YUVA444P12LE] = { 1, 1 }, }; int sws_isSupportedInput(enum AVPixelFormat pix_fmt) diff --git a/tests/ref/fate/filter-pixdesc-yuva422p12be b/tests/ref/fate/filter-pixdesc-yuva422p12be new file mode 100644 index 00..6849910ebc --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-yuva422p12be @@ -0,0 +1 @@ +pixdesc-yuva422p12beb822920a4a148c62ea35d75e38ee39cf diff --git a/tests/ref/fate/filter-pixdesc-yuva422p12le b/tests/ref/fate/filter-pixdesc-yuva422p12le new file mode 100644 index 00..917709100f --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-yuva422p12le @@ -0,0 +1 @@ +pixdesc-yuva422p12le88c6e0db15868c513be817f3555e73cc diff --git a/tests/ref/fate/filter-pixdesc-yuva444p12be b/tests/ref/fate/filter-pixdesc-yuva444p12be new file mode 100644 index 00..b11385202c --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-yuva444p12be @@ -0,0 +1 @@ +pixdesc-yuva444p12bea6cf79e0128198b076e1e0763de8101f diff --git a/tests/ref/fate/filter-pixdesc-yuva444p12le b/tests/ref/fate/filter-pixdesc-yuva444p12le new file mode 100644 index 00..eb88fe7b8b --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-yuva444p12le @@ -0,0 +1 @@ +pixdesc-yuva444p12le67e55a290376dad40c4d99e54ab5b842 diff --git a/tests/ref/fate/filter-pixfmts-copy b/tests/ref/fate/filter-pixfmts-copy index d99374a9b1..0e1f9ee806 100644 --- a/tests/ref/fate/filter-pixfmts-copy +++ b/tests/ref/fate/filter-pixfmts-copy @@ -129,6 +129,8 @@ yuva420p9le 0e9c9803aaaddc9f38e419de587793c2 yuva422p8f6bb778647e5dee62f544d646321171 yuva422p10be2f7204c93a1e5bfb04538852f99e4074 yuva422p10lec8082548aca999edde77ef2749b1f
[FFmpeg-cvslog] avutil : add YUVA444P12 and YUVA422P12
ffmpeg | branch: master | Martin Vignali | Sat Nov 24 16:12:00 2018 +0100| [80b0624099da8f758928676aa848473182fd4b8c] | committer: Martin Vignali avutil : add YUVA444P12 and YUVA422P12 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=80b0624099da8f758928676aa848473182fd4b8c --- libavutil/pixdesc.c | 52 libavutil/pixfmt.h | 7 ++ libavutil/version.h | 2 +- tests/ref/fate/sws-pixdesc-query | 22 + 4 files changed, 82 insertions(+), 1 deletion(-) diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 1c36577289..fe38344d73 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2268,6 +2268,58 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { .flags = AV_PIX_FMT_FLAG_FLOAT, .alias = "yf32le", }, +[AV_PIX_FMT_YUVA422P12BE] = { +.name = "yuva422p12be", +.nb_components = 4, +.log2_chroma_w = 1, +.log2_chroma_h = 0, +.comp = { +{ 0, 2, 0, 0, 12, 1, 11, 1 },/* Y */ +{ 1, 2, 0, 0, 12, 1, 11, 1 },/* U */ +{ 2, 2, 0, 0, 12, 1, 11, 1 },/* V */ +{ 3, 2, 0, 0, 12, 1, 11, 1 },/* A */ +}, +.flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, +}, +[AV_PIX_FMT_YUVA422P12LE] = { +.name = "yuva422p12le", +.nb_components = 4, +.log2_chroma_w = 1, +.log2_chroma_h = 0, +.comp = { +{ 0, 2, 0, 0, 12, 1, 11, 1 },/* Y */ +{ 1, 2, 0, 0, 12, 1, 11, 1 },/* U */ +{ 2, 2, 0, 0, 12, 1, 11, 1 },/* V */ +{ 3, 2, 0, 0, 12, 1, 11, 1 },/* A */ +}, +.flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, +}, +[AV_PIX_FMT_YUVA444P12BE] = { +.name = "yuva444p12be", +.nb_components = 4, +.log2_chroma_w = 0, +.log2_chroma_h = 0, +.comp = { +{ 0, 2, 0, 0, 12, 1, 11, 1 },/* Y */ +{ 1, 2, 0, 0, 12, 1, 11, 1 },/* U */ +{ 2, 2, 0, 0, 12, 1, 11, 1 },/* V */ +{ 3, 2, 0, 0, 12, 1, 11, 1 },/* A */ +}, +.flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, +}, +[AV_PIX_FMT_YUVA444P12LE] = { +.name = "yuva444p12le", +.nb_components = 4, +.log2_chroma_w = 0, +.log2_chroma_h = 0, +.comp = { +{ 0, 2, 0, 0, 12, 1, 11, 1 },/* Y */ +{ 1, 2, 0, 0, 12, 1, 11, 1 },/* U */ +{ 2, 2, 0, 0, 12, 1, 11, 1 },/* V */ +{ 3, 2, 0, 0, 12, 1, 11, 1 },/* A */ +}, +.flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, +}, }; #if FF_API_PLUS1_MINUS1 FF_ENABLE_DEPRECATION_WARNINGS diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 6815f8dc7b..24d1b7e415 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -340,6 +340,11 @@ enum AVPixelFormat { AV_PIX_FMT_GRAYF32BE, ///< IEEE-754 single precision Y, 32bpp, big-endian AV_PIX_FMT_GRAYF32LE, ///< IEEE-754 single precision Y, 32bpp, little-endian +AV_PIX_FMT_YUVA422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, big-endian +AV_PIX_FMT_YUVA422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, little-endian +AV_PIX_FMT_YUVA444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, big-endian +AV_PIX_FMT_YUVA444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, little-endian + AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions }; @@ -416,6 +421,8 @@ enum AVPixelFormat { #define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE) #define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE) #define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE) +#define AV_PIX_FMT_YUVA422P12 AV_PIX_FMT_NE(YUVA422P12BE, YUVA422P12LE) +#define AV_PIX_FMT_YUVA444P12 AV_PIX_FMT_NE(YUVA444P12BE, YUVA444P12LE) #define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE) #define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE) #define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE) diff --git a/libavutil/version.h b/libavutil/version.h index adbf59639c..62112a6049 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 56 -#define LIBAVUTIL_VERSION_MINOR 23 +#define LIBAVUTIL_VERSION_MINOR 24 #define LIBAVUTIL_V
[FFmpeg-cvslog] avfilter: use av_clip_uintp2 instead of av_clip for 10b and 12b
ffmpeg | branch: master | Martin Vignali | Sat Nov 17 17:57:27 2018 +0100| [d3621b232142165d6641708de14c51b78bf2b2df] | committer: Paul B Mahol avfilter: use av_clip_uintp2 instead of av_clip for 10b and 12b > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d3621b232142165d6641708de14c51b78bf2b2df --- libavfilter/vf_blend.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c index c00773c924..80d3e24699 100644 --- a/libavfilter/vf_blend.c +++ b/libavfilter/vf_blend.c @@ -326,15 +326,15 @@ DEFINE_BLEND16(linearlight,av_clip_uint16((B < 32768) ? B + 2 * A - 65535 : B + #define DODGE(a, b) (((a) == 1023) ? (a) : FFMIN(1023, (((b) << 10) / (1023 - (a) DEFINE_BLEND16(addition, FFMIN(1023, A + B), 10) -DEFINE_BLEND16(grainmerge, av_clip(A + B - 512, 0, 1023), 10) +DEFINE_BLEND16(grainmerge, (int)av_clip_uintp2(A + B - 512, 10), 10) DEFINE_BLEND16(average,(A + B) / 2, 10) DEFINE_BLEND16(subtract, FFMAX(0, A - B), 10) DEFINE_BLEND16(multiply, MULTIPLY(1, A, B), 10) -DEFINE_BLEND16(multiply128, av_clip((A - 512) * B / 128. + 512, 0, 1023), 10) +DEFINE_BLEND16(multiply128, (int)av_clip_uintp2((A - 512) * B / 128. + 512, 10), 10) DEFINE_BLEND16(negation, 1023 - FFABS(1023 - A - B), 10) DEFINE_BLEND16(extremity, FFABS(1023 - A - B), 10) DEFINE_BLEND16(difference, FFABS(A - B), 10) -DEFINE_BLEND16(grainextract, av_clip(512 + A - B, 0, 1023), 10) +DEFINE_BLEND16(grainextract, (int)av_clip_uintp2(512 + A - B, 10), 10) DEFINE_BLEND16(screen, SCREEN(1, A, B), 10) DEFINE_BLEND16(overlay,(A < 512) ? MULTIPLY(2, A, B) : SCREEN(2, A, B), 10) DEFINE_BLEND16(hardlight, (B < 512) ? MULTIPLY(2, B, A) : SCREEN(2, B, A), 10) @@ -343,7 +343,7 @@ DEFINE_BLEND16(heat, (A == 0) ? 0 : 1023 - FFMIN(((1023 - B) * (1023 - B)) DEFINE_BLEND16(freeze, (B == 0) ? 0 : 1023 - FFMIN(((1023 - A) * (1023 - A)) / B, 1023), 10) DEFINE_BLEND16(darken, FFMIN(A, B), 10) DEFINE_BLEND16(lighten,FFMAX(A, B), 10) -DEFINE_BLEND16(divide, av_clip(B == 0 ? 1023 : 1023 * A / B, 0, 1023), 10) +DEFINE_BLEND16(divide, (int)av_clip_uintp2(B == 0 ? 1023 : 1023 * A / B, 10), 10) DEFINE_BLEND16(dodge, DODGE(A, B), 10) DEFINE_BLEND16(burn, BURN(A, B), 10) DEFINE_BLEND16(softlight, (A > 511) ? B + (1023 - B) * (A - 511.5) / 511.5 * (0.5 - fabs(B - 511.5) / 1023): B - B * ((511.5 - A) / 511.5) * (0.5 - fabs(B - 511.5)/1023), 10) @@ -356,7 +356,7 @@ DEFINE_BLEND16(and,A & B, 10) DEFINE_BLEND16(or, A | B, 10) DEFINE_BLEND16(xor,A ^ B, 10) DEFINE_BLEND16(vividlight, (A < 512) ? BURN(2 * A, B) : DODGE(2 * (A - 512), B), 10) -DEFINE_BLEND16(linearlight,av_clip((B < 512) ? B + 2 * A - 1023 : B + 2 * (A - 512), 0, 1023), 10) +DEFINE_BLEND16(linearlight,(int)av_clip_uintp2((B < 512) ? B + 2 * A - 1023 : B + 2 * (A - 512), 10), 10) #undef MULTIPLY #undef SCREEN @@ -369,15 +369,15 @@ DEFINE_BLEND16(linearlight,av_clip((B < 512) ? B + 2 * A - 1023 : B + 2 * (A - 5 #define DODGE(a, b) (((a) == 4095) ? (a) : FFMIN(4095, (((b) << 12) / (4095 - (a) DEFINE_BLEND16(addition, FFMIN(4095, A + B), 12) -DEFINE_BLEND16(grainmerge, av_clip(A + B - 2048, 0, 4095), 12) +DEFINE_BLEND16(grainmerge, (int)av_clip_uintp2(A + B - 2048, 12), 12) DEFINE_BLEND16(average,(A + B) / 2, 12) DEFINE_BLEND16(subtract, FFMAX(0, A - B), 12) DEFINE_BLEND16(multiply, MULTIPLY(1, A, B), 12) -DEFINE_BLEND16(multiply128, av_clip((A - 2048) * B / 512. + 2048, 0, 4095), 12) +DEFINE_BLEND16(multiply128, (int)av_clip_uintp2((A - 2048) * B / 512. + 2048, 12), 12) DEFINE_BLEND16(negation, 4095 - FFABS(4095 - A - B), 12) DEFINE_BLEND16(extremity, FFABS(4095 - A - B), 12) DEFINE_BLEND16(difference, FFABS(A - B), 12) -DEFINE_BLEND16(grainextract, av_clip(2048 + A - B, 0, 4095), 12) +DEFINE_BLEND16(grainextract, (int)av_clip_uintp2(2048 + A - B, 12), 12) DEFINE_BLEND16(screen, SCREEN(1, A, B), 12) DEFINE_BLEND16(overlay,(A < 2048) ? MULTIPLY(2, A, B) : SCREEN(2, A, B), 12) DEFINE_BLEND16(hardlight, (B < 2048) ? MULTIPLY(2, B, A) : SCREEN(2, B, A), 12) @@ -386,7 +386,7 @@ DEFINE_BLEND16(heat, (A == 0) ? 0 : 4095 - FFMIN(((4095 - B) * (4095 - B)) DEFINE_BLEND16(freeze, (B == 0) ? 0 : 4095 - FFMIN(((4095 - A) * (4095 - A)) / B, 4095), 12) DEFINE_BLEND16(darken, FFMIN(A, B), 12) DEFINE_BLEND16(lighten,FFMAX(A, B), 12) -DEFINE_BLEND16(divide, av_clip(B == 0 ? 4095 : 4095 * A / B, 0, 4095), 12) +DEFINE_BLEND16(divide, (int)av_clip_uintp2(B == 0 ? 4095 : 4095 * A / B, 12), 12) DEFINE_BLEND16(dodge, DODGE(A, B), 12) DEFINE_BLEND16(burn, BURN(A, B), 12) DEFINE_BLEND16(softlight, (A > 2047) ? B + (4095 - B) * (A - 2047.5) / 2047.5 * (0.5 - fabs(B - 2047.5) / 4095): B - B * ((2047.5 - A) / 2047.5) * (0.5 - fabs(B - 2047.5)/4095), 12) @@ -399,7 +399,7 @@ DEFI
[FFmpeg-cvslog] avcodec/prores_metadata_bsf : fix colorspace check
ffmpeg | branch: master | Martin Vignali | Tue Nov 13 10:52:52 2018 +0100| [13ee107afd3d5c3fb6888d754b715fef67fec543] | committer: Martin Vignali avcodec/prores_metadata_bsf : fix colorspace check Report by coverity CID 1441165 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=13ee107afd3d5c3fb6888d754b715fef67fec543 --- libavcodec/prores_metadata_bsf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/prores_metadata_bsf.c b/libavcodec/prores_metadata_bsf.c index cc7a2b89f4..0510d3520a 100644 --- a/libavcodec/prores_metadata_bsf.c +++ b/libavcodec/prores_metadata_bsf.c @@ -115,7 +115,7 @@ static int prores_metadata_init(AVBSFContext *bsf) switch (ctx->matrix_coefficients) { case -1: case 0: -case AVCOL_PRI_BT709: +case AVCOL_SPC_BT709: case AVCOL_SPC_SMPTE170M: case AVCOL_SPC_BT2020_NCL: break; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] fate/prores_metadata : fix md5 value
ffmpeg | branch: master | Martin Vignali | Sun Nov 11 21:40:08 2018 +0100| [752bf1f64c4c8b7fdfd15068151169578fe561aa] | committer: Martin Vignali fate/prores_metadata : fix md5 value > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=752bf1f64c4c8b7fdfd15068151169578fe561aa --- tests/ref/fate/prores-metadata | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ref/fate/prores-metadata b/tests/ref/fate/prores-metadata index e34b3bb1b7..7ca177489b 100644 --- a/tests/ref/fate/prores-metadata +++ b/tests/ref/fate/prores-metadata @@ -1 +1 @@ -84814393e25b673e8ebd6a94f3d07349 +b4e2c801d594b9614433b284b886be0d ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] fate/prores_metadata_bsf : add test for setting color property
ffmpeg | branch: master | Martin Vignali | Sun Oct 28 12:54:18 2018 +0100| [679ad3146972c7af7a996106c3cddcf58208b6fa] | committer: Martin Vignali fate/prores_metadata_bsf : add test for setting color property > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=679ad3146972c7af7a996106c3cddcf58208b6fa --- tests/fate/prores.mak | 6 ++ tests/ref/fate/prores-metadata | 1 + 2 files changed, 7 insertions(+) diff --git a/tests/fate/prores.mak b/tests/fate/prores.mak index f7f52ca7fc..dd52d68f70 100644 --- a/tests/fate/prores.mak +++ b/tests/fate/prores.mak @@ -20,3 +20,9 @@ fate-prores-alpha_skip: CMD = framecrc -flags +bitexact -skip_alpha 1 -i $(TARGE fate-prores-transparency: CMD = framecrc -flags +bitexact -i $(TARGET_SAMPLES)/prores/prores_with_transparency.mov -pix_fmt yuva444p10le fate-prores-transparency_skip: CMD = framecrc -flags +bitexact -skip_alpha 1 -i $(TARGET_SAMPLES)/prores/prores_with_transparency.mov -pix_fmt yuv444p10le fate-prores-gray: CMD = framecrc -flags +bitexact -c:a aac_fixed -i $(TARGET_SAMPLES)/prores/gray.mov -pix_fmt yuv422p10le + +#Test bsf prores-metadata +FATE_PRORES_METADATA_BSF += fate-prores-metadata +fate-prores-metadata: CMD = md5 -i $(TARGET_SAMPLES)/prores/Sequence_1-Apple_ProRes_422_Proxy.mov -c:v copy -bsf:v prores_metadata=color_primaries=bt470bg:color_trc=bt709:colorspace=smpte170m -f mov + +FATE_SAMPLES_FFMPEG-$(call ALLYES, MOV_DEMUXER PRORES_METADATA_BSF) += $(FATE_PRORES_METADATA_BSF) diff --git a/tests/ref/fate/prores-metadata b/tests/ref/fate/prores-metadata new file mode 100644 index 00..e34b3bb1b7 --- /dev/null +++ b/tests/ref/fate/prores-metadata @@ -0,0 +1 @@ +84814393e25b673e8ebd6a94f3d07349 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec : add prores_metadata bsf for set the color property of each prores frame
ffmpeg | branch: master | Martin Vignali | Sun Oct 28 12:53:25 2018 +0100| [0aba92d42d5194aee335f623bcb70831cd71b0af] | committer: Martin Vignali avcodec : add prores_metadata bsf for set the color property of each prores frame > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0aba92d42d5194aee335f623bcb70831cd71b0af --- doc/bitstream_filters.texi | 66 +++ libavcodec/Makefile | 1 + libavcodec/bitstream_filters.c | 1 + libavcodec/prores_metadata_bsf.c | 172 +++ 4 files changed, 240 insertions(+) diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi index 53470c01ec..655a2c1e63 100644 --- a/doc/bitstream_filters.texi +++ b/doc/bitstream_filters.texi @@ -530,6 +530,72 @@ ffmpeg -i INPUT -c copy -bsf noise[=1] output.mkv @section null This bitstream filter passes the packets through unchanged. +@section prores_metadata + +Modify color property metadata embedded in prores stream. + +@table @option +@item color_primaries +Set the color primaries. +Available values are: + +@table @samp +@item auto +Keep the same color primaries property (default). + +@item unknown +@item bt709 +@item bt470bg +BT601 625 + +@item smpte170m +BT601 525 + +@item bt2020 +@item smpte431 +DCI P3 + +@item smpte432 +P3 D65 + +@end table + +@item transfer_characteristics +Set the color transfert. +Available values are: + +@table @samp +@item auto +Keep the same transfer characteristics property (default). + +@item unknown +@item bt709 +BT 601, BT 709, BT 2020 +@end table + + +@item matrix_coefficients +Set the matrix coefficient. +Available values are: + +@table @samp +@item auto +Keep the same transfer characteristics property (default). + +@item unknown +@item bt709 +@item smpte170m +BT 601 + +@item bt2020nc +@end table +@end table + +Set Rec709 colorspace for each frame of the file +@example +ffmpeg -i INPUT -c copy -bsf:v prores_metadata=color_primaries=bt709:color_trc=bt709:colorspace=bt709 output.mov +@end example + @section remove_extra Remove extradata from packets. diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 8643da8f2b..05be02ec7d 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1081,6 +1081,7 @@ OBJS-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF) += mp3_header_decompress_bsf.o \ OBJS-$(CONFIG_MPEG2_METADATA_BSF) += mpeg2_metadata_bsf.o OBJS-$(CONFIG_NOISE_BSF) += noise_bsf.o OBJS-$(CONFIG_NULL_BSF) += null_bsf.o +OBJS-$(CONFIG_PRORES_METADATA_BSF)+= prores_metadata_bsf.o OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += remove_extradata_bsf.o OBJS-$(CONFIG_TEXT2MOVSUB_BSF)+= movsub_bsf.o OBJS-$(CONFIG_TRACE_HEADERS_BSF) += trace_headers_bsf.o diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c index 96b1746a75..2a8598bac2 100644 --- a/libavcodec/bitstream_filters.c +++ b/libavcodec/bitstream_filters.c @@ -47,6 +47,7 @@ extern const AVBitStreamFilter ff_mpeg4_unpack_bframes_bsf; extern const AVBitStreamFilter ff_mov2textsub_bsf; extern const AVBitStreamFilter ff_noise_bsf; extern const AVBitStreamFilter ff_null_bsf; +extern const AVBitStreamFilter ff_prores_metadata_bsf; extern const AVBitStreamFilter ff_remove_extradata_bsf; extern const AVBitStreamFilter ff_text2movsub_bsf; extern const AVBitStreamFilter ff_trace_headers_bsf; diff --git a/libavcodec/prores_metadata_bsf.c b/libavcodec/prores_metadata_bsf.c new file mode 100644 index 00..cc7a2b89f4 --- /dev/null +++ b/libavcodec/prores_metadata_bsf.c @@ -0,0 +1,172 @@ +/* + * Prores Metadata bitstream filter + * Copyright (c) 2018 Jokyo Images + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Prores Metadata bitstream filter + * set frame colorspace property + */ + +#include "libavutil/common.h" +#include "libavutil/intreadwrite.h" +#include "libavutil/opt.h" +#include "bsf.h" + +typedef struct ProresMetadataContext { +const AVClass *class; + +int color_primaries; +int transfer_characteristics; +int matrix_coefficients; +} ProresMetadataContext; + +static int prores_metadata(AVBSFContext *bsf, AVPacket *pkt) +{ +ProresMetadataCont
[FFmpeg-cvslog] avfilter/af_headphone : fix mem leak
ffmpeg | branch: master | Martin Vignali | Thu Nov 8 22:26:14 2018 +0100| [75625c555cbe3564eedd05721ace78d16f9f139a] | committer: Martin Vignali avfilter/af_headphone : fix mem leak report by coverity CID 1439934 CID 1439935 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=75625c555cbe3564eedd05721ace78d16f9f139a --- libavfilter/af_headphone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c index 760b97b733..0c7e4a2957 100644 --- a/libavfilter/af_headphone.c +++ b/libavfilter/af_headphone.c @@ -475,7 +475,7 @@ static int convert_coeffs(AVFilterContext *ctx, AVFilterLink *inlink) ret = ff_inlink_consume_samples(ctx->inputs[i + 1], len, len, &s->in[i + 1].frame); if (ret < 0) -return ret; +goto fail; ptr = (float *)s->in[i + 1].frame->extended_data[0]; if (s->hrir_fmt == HRIR_STEREO) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/prores_aw : add support for prores 444 with alpha
ffmpeg | branch: master | Martin Vignali | Thu Nov 8 22:10:29 2018 +0100| [ff3b4f91cd56896366a044f8e45a88956dd66d39] | committer: Martin Vignali avcodec/prores_aw : add support for prores 444 with alpha only 16b alpha is supported (not 8 bits) following official encoder, alpha data doesn't impact yuv plane quality. So the alpha data encoding is done after the yuv part. It's also avoid to loose quality in yuv part when alpha is not uniform. the alpha encoding funcs is mainly take from prores_ks encoder, except for the alpha data reorganization > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ff3b4f91cd56896366a044f8e45a88956dd66d39 --- libavcodec/proresenc_anatoliy.c | 165 +--- 1 file changed, 155 insertions(+), 10 deletions(-) diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index bbcb03294a..f2fe98dbd9 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -155,11 +155,13 @@ typedef struct { uint8_t* fill_y; uint8_t* fill_u; uint8_t* fill_v; +uint8_t* fill_a; int qmat_luma[16][64]; int qmat_chroma[16][64]; int is_422; +int need_alpha; } ProresContext; static void encode_codeword(PutBitContext *pb, int val, int codebook) @@ -361,6 +363,80 @@ static av_always_inline unsigned encode_slice_data(AVCodecContext *avctx, return *y_data_size + *u_data_size + *v_data_size; } +static void put_alpha_diff(PutBitContext *pb, int cur, int prev) +{ +const int abits = 16; +const int dbits = 7; +const int dsize = 1 << dbits - 1; +int diff = cur - prev; + +diff = av_mod_uintp2(diff, abits); +if (diff >= (1 << abits) - dsize) +diff -= 1 << abits; +if (diff < -dsize || diff > dsize || !diff) { +put_bits(pb, 1, 1); +put_bits(pb, abits, diff); +} else { +put_bits(pb, 1, 0); +put_bits(pb, dbits - 1, FFABS(diff) - 1); +put_bits(pb, 1, diff < 0); +} +} + +static inline void put_alpha_run(PutBitContext *pb, int run) +{ +if (run) { +put_bits(pb, 1, 0); +if (run < 0x10) +put_bits(pb, 4, run); +else +put_bits(pb, 15, run); +} else { +put_bits(pb, 1, 1); +} +} + +static av_always_inline int encode_alpha_slice_data(AVCodecContext *avctx, int8_t * src_a, + unsigned mb_count, uint8_t *buf, unsigned data_size, unsigned* a_data_size) +{ +const int abits = 16; +const int mask = (1 << abits) - 1; +const int num_coeffs = mb_count * 256; +int prev = mask, cur; +int idx = 0; +int run = 0; +int16_t * blocks = (int16_t *)src_a; +PutBitContext pb; +init_put_bits(&pb, buf, data_size); + +cur = blocks[idx++]; +put_alpha_diff(&pb, cur, prev); +prev = cur; +do { +cur = blocks[idx++]; +if (cur != prev) { +put_alpha_run (&pb, run); +put_alpha_diff(&pb, cur, prev); +prev = cur; +run = 0; +} else { +run++; +} +} while (idx < num_coeffs); +if (run) +put_alpha_run(&pb, run); +flush_put_bits(&pb); +*a_data_size = put_bits_count(&pb) >> 3; + +if (put_bits_left(&pb) < 0) { +av_log(avctx, AV_LOG_ERROR, + "Underestimated required buffer size.\n"); +return AVERROR_BUG; +} else { +return 0; +} +} + static void subimage_with_fill(uint16_t *src, unsigned x, unsigned y, unsigned stride, unsigned width, unsigned height, uint16_t *dst, unsigned dst_width, unsigned dst_height) @@ -391,15 +467,46 @@ static void subimage_with_fill(uint16_t *src, unsigned x, unsigned y, } } +/* reorganize alpha data and convert 10b -> 16b */ +static void subimage_alpha_with_fill(uint16_t *src, unsigned x, unsigned y, + unsigned stride, unsigned width, unsigned height, uint16_t *dst, + unsigned dst_width, unsigned dst_height) +{ +int box_width = FFMIN(width - x, dst_width); +int box_height = FFMIN(height - y, dst_height); +int i, j, src_stride = stride >> 1; +uint16_t last_pix, *last_line; + +src += y * src_stride + x; +for (i = 0; i < box_height; ++i) { +for (j = 0; j < box_width; ++j) { +dst[j] = src[j] << 6; /* 10b to 16b */ +} +last_pix = dst[j - 1] << 6; /* 10b to 16b */ +for (; j < dst_width; j++) +dst[j] = last_pix; +src += src_stride; +dst += dst_width; +} +last_line = dst - dst_width; +for (; i < dst_height; i++) { +for (j = 0; j < dst_width; ++j) { +dst[j] = last_line[j]; +} +dst += dst_width; +} +} + stati
[FFmpeg-cvslog] avcodec/prores_aw : change src pix_fmt and alpha description
ffmpeg | branch: master | Martin Vignali | Thu Nov 8 22:04:35 2018 +0100| [105891cd580b892d6025bf4eafb37c69f816f483] | committer: Martin Vignali avcodec/prores_aw : change src pix_fmt and alpha description use b64a as src pix fmt (doesn't seems to have an impact on decoding) but it's the value use by official encoder > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=105891cd580b892d6025bf4eafb37c69f816f483 --- libavcodec/proresenc_anatoliy.c | 8 1 file changed, 8 insertions(+) diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index f35f049a78..4117fc2845 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -554,7 +554,15 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt, *buf++ = pict->color_primaries; *buf++ = pict->color_trc; *buf++ = pict->colorspace; +if (avctx->profile >= FF_PROFILE_PRORES_) { +if (avctx->pix_fmt == AV_PIX_FMT_YUV444P10) { +*buf++ = 0xA0;/* src b64a and no alpha */ +} else { +*buf++ = 0xA2;/* src b64a and 16b alpha */ +} +} else { *buf++ = 32; +} *buf++ = 0; *buf++ = 3; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/prores_aw : cosmetic indent and add comment to describe frame header value
ffmpeg | branch: master | Martin Vignali | Thu Nov 8 22:05:18 2018 +0100| [4d32c2b4e0df79b38343600d658e4670f9e78c24] | committer: Martin Vignali avcodec/prores_aw : cosmetic indent and add comment to describe frame header value description are based on multimedia wiki documentation > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4d32c2b4e0df79b38343600d658e4670f9e78c24 --- libavcodec/proresenc_anatoliy.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index 4117fc2845..bbcb03294a 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -541,7 +541,7 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt, bytestream_put_buffer(&buf, "icpf", 4); bytestream_put_be16(&buf, header_size); -bytestream_put_be16(&buf, 0); +bytestream_put_be16(&buf, 0); /* version */ bytestream_put_buffer(&buf, "fmpg", 4); bytestream_put_be16(&buf, avctx->width); bytestream_put_be16(&buf, avctx->height); @@ -550,7 +550,7 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt, } else { *buf++ = 0x82; // 422, not interlaced } -*buf++ = 0; +*buf++ = 0; /* reserved */ *buf++ = pict->color_primaries; *buf++ = pict->color_trc; *buf++ = pict->colorspace; @@ -561,10 +561,10 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt, *buf++ = 0xA2;/* src b64a and 16b alpha */ } } else { -*buf++ = 32; +*buf++ = 32;/* src v210 and no alpha */ } -*buf++ = 0; -*buf++ = 3; +*buf++ = 0; /* reserved */ +*buf++ = 3; /* luma and chroma matrix present */ bytestream_put_buffer(&buf, QMAT_LUMA[avctx->profile], 64); bytestream_put_buffer(&buf, QMAT_CHROMA[avctx->profile], 64); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale/unscaled : add grayf32 le to be
ffmpeg | branch: master | Martin Vignali | Mon Oct 22 23:05:29 2018 +0200| [26bf4a40507dd8d313073c33c2696413eb63d2c5] | committer: Martin Vignali swscale/unscaled : add grayf32 le to be > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=26bf4a40507dd8d313073c33c2696413eb63d2c5 --- libswscale/swscale_unscaled.c | 8 1 file changed, 8 insertions(+) diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 4b3cd71e90..54f27e0ac2 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -1821,6 +1821,14 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[], srcPtr += srcStride[plane]; dstPtr += dstStride[plane]; } +} else if (isFloat(c->srcFormat) && isFloat(c->dstFormat) && + isBE(c->srcFormat) != isBE(c->dstFormat)) { /* swap float plane */ +for (i = 0; i < height; i++) { +for (j = 0; j < length; j++) +((uint32_t *) dstPtr)[j] = av_bswap32(((const uint32_t *) srcPtr)[j]); +srcPtr += srcStride[plane]; +dstPtr += dstStride[plane]; +} } else if (dstStride[plane] == srcStride[plane] && srcStride[plane] > 0 && srcStride[plane] == length) { memcpy(dst[plane] + dstStride[plane] * y, src[plane], ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/show_info : add print of color information (range, color_primaries, color_trc, colorspace)
ffmpeg | branch: master | Martin Vignali | Sat Oct 20 15:54:15 2018 +0200| [66974311b1da2e854aaa6320648e7f0bdbbb84ea] | committer: Martin Vignali avfilter/show_info : add print of color information (range, color_primaries, color_trc, colorspace) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=66974311b1da2e854aaa6320648e7f0bdbbb84ea --- libavfilter/vf_showinfo.c | 35 +++ 1 file changed, 35 insertions(+) diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c index 689b5399db..37e73b60aa 100644 --- a/libavfilter/vf_showinfo.c +++ b/libavfilter/vf_showinfo.c @@ -95,6 +95,39 @@ static void dump_stereo3d(AVFilterContext *ctx, AVFrameSideData *sd) av_log(ctx, AV_LOG_INFO, " (inverted)"); } +static void dump_color_property(AVFilterContext *ctx, AVFrame *frame) +{ +const char *color_range_str = av_color_range_name(frame->color_range); +const char *colorspace_str = av_color_space_name(frame->colorspace); +const char *color_primaries_str = av_color_primaries_name(frame->color_primaries); +const char *color_trc_str = av_color_transfer_name(frame->color_trc); + +if (!color_range_str || frame->color_range == AVCOL_RANGE_UNSPECIFIED) { +av_log(ctx, AV_LOG_INFO, "color_range:unknown"); +} else { +av_log(ctx, AV_LOG_INFO, "color_range:%s", color_range_str); +} + +if (!colorspace_str || frame->colorspace == AVCOL_SPC_UNSPECIFIED) { +av_log(ctx, AV_LOG_INFO, " color_space:unknown"); +} else { +av_log(ctx, AV_LOG_INFO, " color_space:%s", colorspace_str); +} + +if (!color_primaries_str || frame->color_primaries == AVCOL_PRI_UNSPECIFIED) { +av_log(ctx, AV_LOG_INFO, " color_primaries:unknown"); +} else { +av_log(ctx, AV_LOG_INFO, " color_primaries:%s", color_primaries_str); +} + +if (!color_trc_str || frame->color_trc == AVCOL_TRC_UNSPECIFIED) { +av_log(ctx, AV_LOG_INFO, " color_trc:unknown"); +} else { +av_log(ctx, AV_LOG_INFO, " color_trc:%s", color_trc_str); +} +av_log(ctx, AV_LOG_INFO, "\n"); +} + static void update_sample_stats(const uint8_t *src, int len, int64_t *sum, int64_t *sum2) { int i; @@ -200,6 +233,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) av_log(ctx, AV_LOG_INFO, "\n"); } +dump_color_property(ctx, frame); + return ff_filter_frame(inlink->dst->outputs[0], frame); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale/utils : simplify unscaled initial test for float pixfmt
ffmpeg | branch: master | Martin Vignali | Mon Oct 22 22:55:14 2018 +0200| [3db33b446f3cd1d3b7142b0ab0e4dcbbec968ee9] | committer: Martin Vignali swscale/utils : simplify unscaled initial test for float pixfmt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3db33b446f3cd1d3b7142b0ab0e4dcbbec968ee9 --- libswscale/utils.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libswscale/utils.c b/libswscale/utils.c index cb40164a95..d5913ed733 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1810,8 +1810,7 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, /* unscaled special cases */ if (unscaled && !usesHFilter && !usesVFilter && (c->srcRange == c->dstRange || isAnyRGB(dstFormat) || - srcFormat == AV_PIX_FMT_GRAYF32 && dstFormat == AV_PIX_FMT_GRAY8 || - srcFormat == AV_PIX_FMT_GRAY8 && dstFormat == AV_PIX_FMT_GRAYF32)) { + isFloat(srcFormat) || isFloat(dstFormat))){ ff_get_unscaled_swscale(c); if (c->swscale) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale/swscale_unscaled : rename packed_16bpc_bswap
ffmpeg | branch: master | Martin Vignali | Mon Oct 22 23:07:20 2018 +0200| [156120fcf8fa7326e7ade2c2478c8be6536e69ad] | committer: Martin Vignali swscale/swscale_unscaled : rename packed_16bpc_bswap is used for packed and planar format > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=156120fcf8fa7326e7ade2c2478c8be6536e69ad --- libswscale/swscale_unscaled.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 54f27e0ac2..058f2b94db 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -423,7 +423,7 @@ static void gray8aToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, } } -static int packed_16bpc_bswap(SwsContext *c, const uint8_t *src[], +static int bswap_16bpc(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) { @@ -2023,7 +2023,7 @@ void ff_get_unscaled_swscale(SwsContext *c) IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV444P12) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV444P14) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV444P16)) -c->swscale = packed_16bpc_bswap; +c->swscale = bswap_16bpc; if (usePal(srcFormat) && isByteRGB(dstFormat)) c->swscale = palToRgbWrapper; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/setfield, setrange : set color property to auto
ffmpeg | branch: master | Martin Vignali | Sun Oct 21 22:47:57 2018 +0200| [cfdbefdd90b0d5d88624decd25802ac99ea5d859] | committer: Martin Vignali avfilter/setfield, setrange : set color property to auto > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cfdbefdd90b0d5d88624decd25802ac99ea5d859 --- libavfilter/vf_setparams.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/libavfilter/vf_setparams.c b/libavfilter/vf_setparams.c index 6d8ab188c0..dfd7efc314 100644 --- a/libavfilter/vf_setparams.c +++ b/libavfilter/vf_setparams.c @@ -193,6 +193,9 @@ static av_cold int init_setrange(AVFilterContext *ctx) SetParamsContext *s = ctx->priv; s->field_mode = MODE_AUTO;/* set field mode to auto */ +s->color_primaries = -1; +s->color_trc = -1; +s->colorspace = -1; return 0; } @@ -224,6 +227,9 @@ static av_cold int init_setfield(AVFilterContext *ctx) SetParamsContext *s = ctx->priv; s->color_range = -1;/* set range mode to auto */ +s->color_primaries = -1; +s->color_trc = -1; +s->colorspace = -1; return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/setparams : update filter description
ffmpeg | branch: master | Martin Vignali | Sun Oct 21 22:43:14 2018 +0200| [997f03cd7eb92c03ea429d2ebe0a43c25d183599] | committer: Martin Vignali avfilter/setparams : update filter description > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=997f03cd7eb92c03ea429d2ebe0a43c25d183599 --- libavfilter/vf_setparams.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_setparams.c b/libavfilter/vf_setparams.c index 51f6d655b8..6d8ab188c0 100644 --- a/libavfilter/vf_setparams.c +++ b/libavfilter/vf_setparams.c @@ -163,7 +163,7 @@ static const AVFilterPad outputs[] = { AVFilter ff_vf_setparams = { .name= "setparams", -.description = NULL_IF_CONFIG_SMALL("Force field, or color range for the output video frame."), +.description = NULL_IF_CONFIG_SMALL("Force field, or color property for the output video frame."), .priv_size = sizeof(SetParamsContext), .priv_class = &setparams_class, .inputs = inputs, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/setparams : fix colorspace option
ffmpeg | branch: master | Martin Vignali | Sun Oct 21 22:48:43 2018 +0200| [6953ff714fb6377ef84b4cba08539f282945a629] | committer: Martin Vignali avfilter/setparams : fix colorspace option > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6953ff714fb6377ef84b4cba08539f282945a629 --- libavfilter/vf_setparams.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_setparams.c b/libavfilter/vf_setparams.c index dfd7efc314..fe298e5a06 100644 --- a/libavfilter/vf_setparams.c +++ b/libavfilter/vf_setparams.c @@ -96,7 +96,7 @@ static const AVOption setparams_options[] = { {"smpte428", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_SMPTE428}, INT_MIN, INT_MAX, FLAGS, "color_trc"}, {"arib-std-b67", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_ARIB_STD_B67}, INT_MIN, INT_MAX, FLAGS, "color_trc"}, -{"colorspace", "select colorspace", OFFSET(color_trc), AV_OPT_TYPE_INT, {.i64=-1}, -1, AVCOL_SPC_NB-1, FLAGS, "colorspace"}, +{"colorspace", "select colorspace", OFFSET(colorspace), AV_OPT_TYPE_INT, {.i64=-1}, -1, AVCOL_SPC_NB-1, FLAGS, "colorspace"}, {"auto", "keep the same colorspace", 0, AV_OPT_TYPE_CONST, {.i64=-1}, INT_MIN, INT_MAX, FLAGS, "colorspace"}, {"gbr",NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_RGB}, INT_MIN, INT_MAX, FLAGS, "colorspace"}, {"bt709", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_BT709}, INT_MIN, INT_MAX, FLAGS, "colorspace"}, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/setparam : add options to set color primaries, trc, space
ffmpeg | branch: master | Martin Vignali | Sun Oct 21 19:29:29 2018 +0200| [8d3f364630a8ca0072239a101a12f75fddbdad1b] | committer: Martin Vignali avfilter/setparam : add options to set color primaries, trc, space > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8d3f364630a8ca0072239a101a12f75fddbdad1b --- doc/filters.texi | 73 ++ libavfilter/vf_setparams.c | 63 +++ 2 files changed, 136 insertions(+) diff --git a/doc/filters.texi b/doc/filters.texi index 6f58303252..a2ef327688 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -15011,6 +15011,79 @@ Mark the frame as limited range. @item full, pc, jpeg Mark the frame as full range. @end table + +@item color_primaries +Set the color primaries. +Available values are: + +@table @samp +@item auto +Keep the same color primaries property (default). + +@item bt709 +@item unknown +@item bt470m +@item bt470bg +@item smpte170m +@item smpte240m +@item film +@item bt2020 +@item smpte428 +@item smpte431 +@item smpte432 +@item jedec-p22 +@end table + +@item color_trc +Set the color transfert. +Available values are: + +@table @samp +@item auto +Keep the same color trc property (default). + +@item bt709 +@item unknown +@item bt470m +@item bt470bg +@item smpte170m +@item smpte240m +@item linear +@item log100 +@item log316 +@item iec61966-2-4 +@item bt1361e +@item iec61966-2-1 +@item bt2020-10 +@item bt2020-12 +@item smpte2084 +@item smpte428 +@item arib-std-b67 +@end table + +@item colorspace +Set the colorspace. +Available values are: + +@table @samp +@item auto +Keep the same colorspace property (default). + +@item gbr +@item bt709 +@item unknown +@item fcc +@item bt470bg +@item smpte170m +@item smpte240m +@item ycgco +@item bt2020nc +@item bt2020c +@item smpte2085 +@item chroma-derived-nc +@item chroma-derived-c +@item ictcp +@end table @end table @section showinfo diff --git a/libavfilter/vf_setparams.c b/libavfilter/vf_setparams.c index 5426d88777..51f6d655b8 100644 --- a/libavfilter/vf_setparams.c +++ b/libavfilter/vf_setparams.c @@ -35,6 +35,9 @@ typedef struct SetParamsContext { const AVClass *class; int field_mode; int color_range; +int color_primaries; +int color_trc; +int colorspace; } SetParamsContext; #define OFFSET(x) offsetof(SetParamsContext, x) @@ -57,6 +60,58 @@ static const AVOption setparams_options[] = { {"full", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG}, 0, 0, FLAGS, "range"}, {"pc", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG}, 0, 0, FLAGS, "range"}, {"jpeg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG}, 0, 0, FLAGS, "range"}, + +{"color_primaries", "select color primaries", OFFSET(color_primaries), AV_OPT_TYPE_INT, {.i64=-1}, -1, AVCOL_PRI_NB-1, FLAGS, "color_primaries"}, +{"auto", "keep the same color primaries", 0, AV_OPT_TYPE_CONST, {.i64=-1}, INT_MIN, INT_MAX, FLAGS, "color_primaries"}, +{"bt709", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_BT709},INT_MIN, INT_MAX, FLAGS, "color_primaries"}, +{"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_UNSPECIFIED}, INT_MIN, INT_MAX, FLAGS, "color_primaries"}, +{"bt470m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_BT470M}, INT_MIN, INT_MAX, FLAGS, "color_primaries"}, +{"bt470bg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_BT470BG}, INT_MIN, INT_MAX, FLAGS, "color_primaries"}, +{"smpte170m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_SMPTE170M},INT_MIN, INT_MAX, FLAGS, "color_primaries"}, +{"smpte240m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_SMPTE240M},INT_MIN, INT_MAX, FLAGS, "color_primaries"}, +{"film",NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_FILM}, INT_MIN, INT_MAX, FLAGS, "color_primaries"}, +{"bt2020", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_BT2020}, INT_MIN, INT_MAX, FLAGS, "color_primaries"}, +{"smpte428",NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_SMPTE428}, INT_MIN, INT_MAX, FLAGS, "color_primaries"}, +{"smpte431",NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_SMPTE431}, INT_MIN, INT_MAX, FLAGS, "color_primaries"}, +{"smpte432",NULL, 0, AV_OPT
[FFmpeg-cvslog] avfilter/setparams : merge setfield and setrange filter to setparams filter
ffmpeg | branch: master | Martin Vignali | Sun Oct 21 19:28:03 2018 +0200| [02ad0416c06e4d6859d3d54bc039975b58661e75] | committer: Martin Vignali avfilter/setparams : merge setfield and setrange filter to setparams filter setfield and setrange filters are kept. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=02ad0416c06e4d6859d3d54bc039975b58661e75 --- Changelog | 1 + doc/filters.texi | 46 ++ libavfilter/Makefile | 3 +- libavfilter/allfilters.c | 1 + libavfilter/version.h | 2 +- libavfilter/vf_setfield.c | 94 libavfilter/vf_setparams.c | 97 +- 7 files changed, 146 insertions(+), 98 deletions(-) diff --git a/Changelog b/Changelog index 3b5131190c..ea54103278 100644 --- a/Changelog +++ b/Changelog @@ -36,6 +36,7 @@ version : - SER demuxer - sinc audio filter source - chromahold filter +- setparams filter version 4.0: diff --git a/doc/filters.texi b/doc/filters.texi index ad3e666253..6f58303252 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -14967,6 +14967,52 @@ Mark the frame as progressive. @end table @end table +@anchor{setparams} +@section setparams + +Force frame parameter for the output video frame. + +The @code{setparams} filter marks interlace and color range for the +output frames. It does not change the input frame, but only sets the +corresponding property, which affects how the frame is treated by +filters/encoders. + +@table @option +@item field_mode +Available values are: + +@table @samp +@item auto +Keep the same field property (default). + +@item bff +Mark the frame as bottom-field-first. + +@item tff +Mark the frame as top-field-first. + +@item prog +Mark the frame as progressive. +@end table + +@item range +Available values are: + +@table @samp +@item auto +Keep the same color range property (default). + +@item unspecified, unknown +Mark the frame as unspecified color range. + +@item limited, tv, mpeg +Mark the frame as limited range. + +@item full, pc, jpeg +Mark the frame as full range. +@end table +@end table + @section showinfo Show a line containing various information for each input video frame. diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 46c6023bcc..108a2f87d7 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -342,7 +342,8 @@ OBJS-$(CONFIG_SELECTIVECOLOR_FILTER) += vf_selectivecolor.o OBJS-$(CONFIG_SENDCMD_FILTER)+= f_sendcmd.o OBJS-$(CONFIG_SEPARATEFIELDS_FILTER) += vf_separatefields.o OBJS-$(CONFIG_SETDAR_FILTER) += vf_aspect.o -OBJS-$(CONFIG_SETFIELD_FILTER) += vf_setfield.o +OBJS-$(CONFIG_SETFIELD_FILTER) += vf_setparams.o +OBJS-$(CONFIG_SETPARAMS_FILTER) += vf_setparams.o OBJS-$(CONFIG_SETPTS_FILTER) += setpts.o OBJS-$(CONFIG_SETRANGE_FILTER) += vf_setparams.o OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 536765581b..557590850b 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -327,6 +327,7 @@ extern AVFilter ff_vf_sendcmd; extern AVFilter ff_vf_separatefields; extern AVFilter ff_vf_setdar; extern AVFilter ff_vf_setfield; +extern AVFilter ff_vf_setparams; extern AVFilter ff_vf_setpts; extern AVFilter ff_vf_setrange; extern AVFilter ff_vf_setsar; diff --git a/libavfilter/version.h b/libavfilter/version.h index 17a1a36142..4e7ec97b2f 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -30,7 +30,7 @@ #include "libavutil/version.h" #define LIBAVFILTER_VERSION_MAJOR 7 -#define LIBAVFILTER_VERSION_MINOR 35 +#define LIBAVFILTER_VERSION_MINOR 36 #define LIBAVFILTER_VERSION_MICRO 100 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/libavfilter/vf_setfield.c b/libavfilter/vf_setfield.c deleted file mode 100644 index f4dc33d7e5..00 --- a/libavfilter/vf_setfield.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2012 Stefano Sabatini - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * se
[FFmpeg-cvslog] swscale : add YA16 LE/BE output
ffmpeg | branch: master | Martin Vignali | Sun Oct 14 18:08:16 2018 +0200| [db4771af8196624317e0615e4310c40de39a6f8a] | committer: Martin Vignali swscale : add YA16 LE/BE output > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=db4771af8196624317e0615e4310c40de39a6f8a --- libswscale/output.c | 105 +++ libswscale/utils.c | 4 +- tests/ref/fate/filter-pixdesc-ya16be | 1 + tests/ref/fate/filter-pixdesc-ya16le | 1 + tests/ref/fate/filter-pixfmts-copy | 2 + tests/ref/fate/filter-pixfmts-crop | 2 + tests/ref/fate/filter-pixfmts-field | 2 + tests/ref/fate/filter-pixfmts-fieldorder | 2 + tests/ref/fate/filter-pixfmts-hflip | 2 + tests/ref/fate/filter-pixfmts-il | 2 + tests/ref/fate/filter-pixfmts-null | 2 + tests/ref/fate/filter-pixfmts-pad| 1 + tests/ref/fate/filter-pixfmts-scale | 2 + tests/ref/fate/filter-pixfmts-transpose | 2 + tests/ref/fate/filter-pixfmts-vflip | 2 + 15 files changed, 130 insertions(+), 2 deletions(-) diff --git a/libswscale/output.c b/libswscale/output.c index de8637aa3b..d7c53e60d9 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -901,6 +901,99 @@ YUV2PACKEDWRAPPER(yuv2, 422, uyvy422, AV_PIX_FMT_UYVY422) } static av_always_inline void +yuv2ya16_X_c_template(SwsContext *c, const int16_t *lumFilter, +const int32_t **lumSrc, int lumFilterSize, +const int16_t *chrFilter, const int32_t **unused_chrUSrc, +const int32_t **unused_chrVSrc, int unused_chrFilterSize, +const int32_t **alpSrc, uint16_t *dest, int dstW, +int y, enum AVPixelFormat target, int unused_hasAlpha, int unused_eightbytes) +{ +int hasAlpha = !!alpSrc; +int i; + +for (i = 0; i < dstW; i++) { +int j; +int Y = 1 << 18; +int64_t A = 0x<<14; + +for (j = 0; j < lumFilterSize; j++) +Y += lumSrc[j][i] * lumFilter[j]; + +Y >>= 15; +Y = av_clip_uint16(Y); + +if (hasAlpha) { +for (j = 0; j < lumFilterSize; j++) +A += alpSrc[j][i] * lumFilter[j]; + +A >>= 15; +A = av_clip_uint16(A); +} + +output_pixel(&dest[2 * i], Y); +output_pixel(&dest[2 * i + 1], hasAlpha ? A : 65535); +} +} + +static av_always_inline void +yuv2ya16_2_c_template(SwsContext *c, const int32_t *buf[2], +const int32_t *unused_ubuf[2], const int32_t *unused_vbuf[2], +const int32_t *abuf[2], uint16_t *dest, int dstW, +int yalpha, int unused_uvalpha, int y, +enum AVPixelFormat target, int unused_hasAlpha, int unused_eightbytes) +{ +int hasAlpha = abuf && abuf[0] && abuf[1]; +const int32_t *buf0 = buf[0], *buf1 = buf[1], +*abuf0 = hasAlpha ? abuf[0] : NULL, +*abuf1 = hasAlpha ? abuf[1] : NULL; +int yalpha1 = 4096 - yalpha; +int i; + +av_assert2(yalpha <= 4096U); + +for (i = 0; i < dstW; i++) { +int Y = (buf0[i] * yalpha1 + buf1[i] * yalpha) >> 15; +int A; + +Y = av_clip_uint16(Y); + +if (hasAlpha) { +A = (abuf0[i] * yalpha1 + abuf1[i] * yalpha) >> 15; +A = av_clip_uint16(A); +} + +output_pixel(&dest[2 * i], Y); +output_pixel(&dest[2 * i + 1], hasAlpha ? A : 65535); +} +} + +static av_always_inline void +yuv2ya16_1_c_template(SwsContext *c, const int32_t *buf0, +const int32_t *unused_ubuf[2], const int32_t *unused_vbuf[2], +const int32_t *abuf0, uint16_t *dest, int dstW, +int unused_uvalpha, int y, enum AVPixelFormat target, int unused_hasAlpha, int unused_eightbytes) +{ +int hasAlpha = !!abuf0; +int i; + +for (i = 0; i < dstW; i++) { +int Y = buf0[i] >> 3;/* 19 - 16 */ +int A; + +Y = av_clip_uint16(Y); + +if (hasAlpha) { +A = abuf0[i] >> 3; +if (A & 0x100) +A = av_clip_uint16(A); +} + +output_pixel(&dest[2 * i], Y); +output_pixel(&dest[2 * i + 1], hasAlpha ? A : 65535); +} +} + +static av_always_inline void yuv2rgba64_X_c_template(SwsContext *c, const int16_t *lumFilter, const int32_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int32_t **chrUSrc, @@ -1405,6 +1498,8 @@ YUV2PACKED16WRAPPER(yuv2, rgba64, bgra64be, AV_PIX_FMT_BGRA64BE, 1, 1) YUV2PACKED16WRAPPER(yuv2, rgba64, bgra64le, AV_PIX_FMT_BGRA64LE, 1, 1) YUV2PACKED16WRAPPER(yuv2, rgba64, bgrx64be, AV_PIX_FMT_BGRA64BE, 0, 1) YUV2PACKED16WRAPPER
[FFmpeg-cvslog] swscale/x86/rgb2rgb.asm : add Ivo Van Poorten name to the top of the file
ffmpeg | branch: master | Martin Vignali | Sat Oct 13 19:52:06 2018 +0200| [658bbc006002520d397ef2095847b30494a65f77] | committer: Martin Vignali swscale/x86/rgb2rgb.asm : add Ivo Van Poorten name to the top of the file suggested by Carl Eugen Hoyos > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=658bbc006002520d397ef2095847b30494a65f77 --- libswscale/x86/rgb_2_rgb.asm | 1 + 1 file changed, 1 insertion(+) diff --git a/libswscale/x86/rgb_2_rgb.asm b/libswscale/x86/rgb_2_rgb.asm index 5fb5d2ee61..29b856e281 100644 --- a/libswscale/x86/rgb_2_rgb.asm +++ b/libswscale/x86/rgb_2_rgb.asm @@ -2,6 +2,7 @@ ;* Copyright Nick Kurshev ;* Copyright Michael (michae...@gmx.at) ;* Copyright 2018 Jokyo Images +;* Copyright Ivo van Poorten ;* ;* This file is part of FFmpeg. ;* ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/proresenc_aw : use AVframe primaries, transfert, colorspace for frame header instead of default (unknown, unknown, Rec601)
ffmpeg | branch: master | Martin Vignali | Mon Oct 8 15:49:56 2018 +0200| [1a45b12cdc414794795c11db378d0be6113a22d3] | committer: Martin Vignali avcodec/proresenc_aw : use AVframe primaries, transfert, colorspace for frame header instead of default (unknown, unknown, Rec601) avoid color shift, on some decoding software > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1a45b12cdc414794795c11db378d0be6113a22d3 --- libavcodec/proresenc_anatoliy.c | 6 +++--- tests/ref/vsynth/vsynth1-prores | 2 +- tests/ref/vsynth/vsynth2-prores | 2 +- tests/ref/vsynth/vsynth3-prores | 2 +- tests/ref/vsynth/vsynth_lena-prores | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index dd6b1dcfb1..91b9a17947 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -501,9 +501,9 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt, bytestream_put_be16(&buf, avctx->height); *buf++ = 0x83; // {10}(422){00}{00}(frame){11} *buf++ = 0; -*buf++ = 2; -*buf++ = 2; -*buf++ = 6; +*buf++ = pict->color_primaries; +*buf++ = pict->color_trc; +*buf++ = pict->colorspace; *buf++ = 32; *buf++ = 0; *buf++ = 3; diff --git a/tests/ref/vsynth/vsynth1-prores b/tests/ref/vsynth/vsynth1-prores index 14de8b9cf3..ee9d1712f1 100644 --- a/tests/ref/vsynth/vsynth1-prores +++ b/tests/ref/vsynth/vsynth1-prores @@ -1,4 +1,4 @@ -7ca7d2f9f5d8ac2ead691b1b6a70d409 *tests/data/fate/vsynth1-prores.mov +27a1293adf92cc0330652e4e81a9328d *tests/data/fate/vsynth1-prores.mov 5022821 tests/data/fate/vsynth1-prores.mov fb4a9e025d12afc0dbbca8d82831858f *tests/data/fate/vsynth1-prores.out.rawvideo stddev:2.47 PSNR: 40.27 MAXDIFF: 31 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-prores b/tests/ref/vsynth/vsynth2-prores index a1b4bb748f..86b773dda4 100644 --- a/tests/ref/vsynth/vsynth2-prores +++ b/tests/ref/vsynth/vsynth2-prores @@ -1,4 +1,4 @@ -aa57fd1221b7eefaf1f34f9d57d6a7cb *tests/data/fate/vsynth2-prores.mov +dc972bd57cec42786abddb79552b2654 *tests/data/fate/vsynth2-prores.mov 3265056 tests/data/fate/vsynth2-prores.mov 537b0ff66d7c8c3c12faa89d042e6a49 *tests/data/fate/vsynth2-prores.out.rawvideo stddev:1.38 PSNR: 45.29 MAXDIFF: 12 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth3-prores b/tests/ref/vsynth/vsynth3-prores index f63a7a736f..47afc4f9df 100644 --- a/tests/ref/vsynth/vsynth3-prores +++ b/tests/ref/vsynth/vsynth3-prores @@ -1,4 +1,4 @@ -b060c59be88b4b089ece5ee8dc4f1c58 *tests/data/fate/vsynth3-prores.mov +f41aa3ce23eea73be3e207d5d0f18219 *tests/data/fate/vsynth3-prores.mov 105367 tests/data/fate/vsynth3-prores.mov fff5e7ad21d78501c8fa4749bf4bf289 *tests/data/fate/vsynth3-prores.out.rawvideo stddev:2.80 PSNR: 39.17 MAXDIFF: 27 bytes:86700/86700 diff --git a/tests/ref/vsynth/vsynth_lena-prores b/tests/ref/vsynth/vsynth_lena-prores index 5b8c3fe1b4..fb4035cd16 100644 --- a/tests/ref/vsynth/vsynth_lena-prores +++ b/tests/ref/vsynth/vsynth_lena-prores @@ -1,4 +1,4 @@ -637f34b5fd81f072f76a967595fa6af7 *tests/data/fate/vsynth_lena-prores.mov +09ef7f879fa65d6626dde9a88f1674c9 *tests/data/fate/vsynth_lena-prores.mov 2844076 tests/data/fate/vsynth_lena-prores.mov 03fd29e3963716a09d232b6f817ecb57 *tests/data/fate/vsynth_lena-prores.out.rawvideo stddev:1.31 PSNR: 45.77 MAXDIFF: 11 bytes: 7603200/ 7603200 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/proresenc_aw : use qp close to the official encoder
ffmpeg | branch: master | Martin Vignali | Mon Oct 8 15:50:23 2018 +0200| [cea5e90bde4a407d54aa365ca865468185f8b92b] | committer: Martin Vignali avcodec/proresenc_aw : use qp close to the official encoder > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cea5e90bde4a407d54aa365ca865468185f8b92b --- libavcodec/proresenc_anatoliy.c | 4 ++-- tests/ref/vsynth/vsynth2-prores | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index 91b9a17947..7ad69c670f 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -49,8 +49,8 @@ static const AVProfile profiles[] = { { FF_PROFILE_UNKNOWN } }; -static const int qp_start_table[4] = { 4, 1, 1, 1 }; -static const int qp_end_table[4] = { 8, 9, 6, 6 }; +static const int qp_start_table[4] = { 8, 3, 2, 1 }; +static const int qp_end_table[4] = { 13, 9, 6, 6 }; static const int bitrate_table[5] = { 1000, 2100, 3500, 5400 }; static const uint8_t QMAT_LUMA[4][64] = { diff --git a/tests/ref/vsynth/vsynth2-prores b/tests/ref/vsynth/vsynth2-prores index 86b773dda4..aed9e3e3f5 100644 --- a/tests/ref/vsynth/vsynth2-prores +++ b/tests/ref/vsynth/vsynth2-prores @@ -1,4 +1,4 @@ -dc972bd57cec42786abddb79552b2654 *tests/data/fate/vsynth2-prores.mov -3265056 tests/data/fate/vsynth2-prores.mov -537b0ff66d7c8c3c12faa89d042e6a49 *tests/data/fate/vsynth2-prores.out.rawvideo +71d83e64060c122f440b288a042f7c0b *tests/data/fate/vsynth2-prores.mov +3260123 tests/data/fate/vsynth2-prores.mov +416fa8773615889c70491452428d6710 *tests/data/fate/vsynth2-prores.out.rawvideo stddev:1.38 PSNR: 45.29 MAXDIFF: 12 bytes: 7603200/ 7603200 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/proresenc_aw : use scan table from prores_data file
ffmpeg | branch: master | Martin Vignali | Mon Oct 8 15:49:40 2018 +0200| [d7731ea9d43cf8e7df19d54ab657adbda90d5fd3] | committer: Martin Vignali avcodec/proresenc_aw : use scan table from prores_data file Doesn't seems to make speed loss > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d7731ea9d43cf8e7df19d54ab657adbda90d5fd3 --- libavcodec/Makefile | 4 ++-- libavcodec/proresenc_anatoliy.c | 14 ++ 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index ce766aa466..a97055ef3f 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -516,8 +516,8 @@ OBJS-$(CONFIG_PNG_ENCODER) += png.o pngenc.o OBJS-$(CONFIG_PPM_DECODER) += pnmdec.o pnm.o OBJS-$(CONFIG_PPM_ENCODER) += pnmenc.o OBJS-$(CONFIG_PRORES_DECODER) += proresdec2.o proresdsp.o proresdata.o -OBJS-$(CONFIG_PRORES_ENCODER) += proresenc_anatoliy.o -OBJS-$(CONFIG_PRORES_AW_ENCODER) += proresenc_anatoliy.o +OBJS-$(CONFIG_PRORES_ENCODER) += proresenc_anatoliy.o proresdata.o +OBJS-$(CONFIG_PRORES_AW_ENCODER) += proresenc_anatoliy.o proresdata.o OBJS-$(CONFIG_PRORES_KS_ENCODER) += proresenc_kostya.o proresdata.o OBJS-$(CONFIG_PROSUMER_DECODER)+= prosumer.o OBJS-$(CONFIG_PSD_DECODER) += psd.o diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index 0516066163..dd6b1dcfb1 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -29,6 +29,7 @@ #include "avcodec.h" #include "dct.h" #include "internal.h" +#include "proresdata.h" #include "put_bits.h" #include "bytestream.h" #include "fdctdsp.h" @@ -52,17 +53,6 @@ static const int qp_start_table[4] = { 4, 1, 1, 1 }; static const int qp_end_table[4] = { 8, 9, 6, 6 }; static const int bitrate_table[5] = { 1000, 2100, 3500, 5400 }; -static const uint8_t progressive_scan[64] = { - 0, 1, 8, 9, 2, 3, 10, 11, -16, 17, 24, 25, 18, 19, 26, 27, - 4, 5, 12, 20, 13, 6, 7, 14, -21, 28, 29, 22, 15, 23, 30, 31, -32, 33, 40, 48, 41, 34, 35, 42, -49, 56, 57, 50, 43, 36, 37, 44, -51, 58, 59, 52, 45, 38, 39, 46, -53, 60, 61, 54, 47, 55, 62, 63 -}; - static const uint8_t QMAT_LUMA[4][64] = { { 4, 7, 9, 11, 13, 14, 15, 63, @@ -237,7 +227,7 @@ static void encode_ac_coeffs(AVCodecContext *avctx, PutBitContext *pb, int run = 0, level, code, i, j; for (i = 1; i < 64; i++) { -int indp = progressive_scan[i]; +int indp = ff_prores_progressive_scan[i]; for (j = 0; j < blocks_per_slice; j++) { int val = QSCALE(qmat, indp, in[(j << 6) + indp]); if (val) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/proresenc_aw : add support for prores 444
ffmpeg | branch: master | Martin Vignali | Mon Oct 8 15:51:19 2018 +0200| [c51b36ec8f707b34a4ef4a8a470eb854742a99e5] | committer: Martin Vignali avcodec/proresenc_aw : add support for prores 444 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c51b36ec8f707b34a4ef4a8a470eb854742a99e5 --- libavcodec/proresenc_anatoliy.c | 168 1 file changed, 117 insertions(+), 51 deletions(-) diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index 833e8a2019..c723fbf540 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -2,6 +2,7 @@ * Apple ProRes encoder * * Copyright (c) 2011 Anatoliy Wasserman + * Copyright (c) 2012 Konstantin Shishkov * * This file is part of FFmpeg. * @@ -23,7 +24,7 @@ /** * @file * Apple ProRes encoder (Anatoliy Wasserman version) - * Known FOURCCs: 'apch' (HQ), 'apcn' (SD), 'apcs' (LT), 'acpo' (Proxy) + * Known FOURCCs: 'ap4h' (444), 'apch' (HQ), 'apcn' (422), 'apcs' (LT), 'acpo' (Proxy) */ #include "avcodec.h" @@ -40,20 +41,22 @@ #define FF_PROFILE_PRORES_LT1 #define FF_PROFILE_PRORES_STANDARD 2 #define FF_PROFILE_PRORES_HQ3 +#define FF_PROFILE_PRORES_444 4 static const AVProfile profiles[] = { { FF_PROFILE_PRORES_PROXY,"apco"}, { FF_PROFILE_PRORES_LT, "apcs"}, { FF_PROFILE_PRORES_STANDARD, "apcn"}, { FF_PROFILE_PRORES_HQ, "apch"}, +{ FF_PROFILE_PRORES_444, "ap4h"}, { FF_PROFILE_UNKNOWN } }; -static const int qp_start_table[4] = { 8, 3, 2, 1 }; -static const int qp_end_table[4] = { 13, 9, 6, 6 }; -static const int bitrate_table[5] = { 1000, 2100, 3500, 5400 }; +static const int qp_start_table[5] = { 8, 3, 2, 1, 1}; +static const int qp_end_table[5] = { 13, 9, 6, 6, 5}; +static const int bitrate_table[5] = { 1000, 2100, 3500, 5400, 7000}; -static const uint8_t QMAT_LUMA[4][64] = { +static const uint8_t QMAT_LUMA[5][64] = { { 4, 7, 9, 11, 13, 14, 15, 63, 7, 7, 11, 12, 14, 15, 63, 63, @@ -90,10 +93,19 @@ static const uint8_t QMAT_LUMA[4][64] = { 4, 4, 4, 4, 4, 5, 5, 6, 4, 4, 4, 4, 5, 5, 6, 7, 4, 4, 4, 4, 5, 6, 7, 7 +}, { /* 444 */ +4, 4, 4, 4, 4, 4, 4, 4, +4, 4, 4, 4, 4, 4, 4, 4, +4, 4, 4, 4, 4, 4, 4, 4, +4, 4, 4, 4, 4, 4, 4, 5, +4, 4, 4, 4, 4, 4, 5, 5, +4, 4, 4, 4, 4, 5, 5, 6, +4, 4, 4, 4, 5, 5, 6, 7, +4, 4, 4, 4, 5, 6, 7, 7 } }; -static const uint8_t QMAT_CHROMA[4][64] = { +static const uint8_t QMAT_CHROMA[5][64] = { { 4, 7, 9, 11, 13, 14, 63, 63, 7, 7, 11, 12, 14, 63, 63, 63, @@ -130,6 +142,15 @@ static const uint8_t QMAT_CHROMA[4][64] = { 4, 4, 4, 4, 4, 5, 5, 6, 4, 4, 4, 4, 5, 5, 6, 7, 4, 4, 4, 4, 5, 6, 7, 7 +}, { /* 444 */ +4, 4, 4, 4, 4, 4, 4, 4, +4, 4, 4, 4, 4, 4, 4, 4, +4, 4, 4, 4, 4, 4, 4, 4, +4, 4, 4, 4, 4, 4, 4, 5, +4, 4, 4, 4, 4, 4, 5, 5, +4, 4, 4, 4, 4, 5, 5, 6, +4, 4, 4, 4, 5, 5, 6, 7, +4, 4, 4, 4, 5, 6, 7, 7 } }; @@ -142,6 +163,8 @@ typedef struct { int qmat_luma[16][64]; int qmat_chroma[16][64]; + +int is_422; } ProresContext; static void encode_codeword(PutBitContext *pb, int val, int codebook) @@ -268,31 +291,49 @@ static void fdct_get(FDCTDSPContext *fdsp, uint8_t *pixels, int stride, int16_t* fdsp->fdct(block); } -static void calc_plane_dct(FDCTDSPContext *fdsp, uint8_t *src, int16_t * blocks, int src_stride, int mb_count, int chroma) +static void calc_plane_dct(FDCTDSPContext *fdsp, uint8_t *src, int16_t * blocks, int src_stride, int mb_count, int chroma, int is_422) { int16_t *block; int i; block = blocks; -for (i = 0; i < mb_count; i++) { -fdct_get(fdsp, src, src_stride, block + (0 << 6)); -fdct_get(fdsp, src + 8 * src_stride, src_stride, block + ((2 - chroma) << 6)); -if (!chroma) { + +if (!chroma) { /* Luma plane */ +for (i = 0; i < mb_count; i++) { +fdct_get(fdsp, src, src_stride, block + (0 << 6)); fdct_get(fdsp, src + 16, src_stride, block + (1 << 6)); +fdct_get(fdsp, src + 8 * src_stride, src_stride, block + (2 << 6)); fdct_get(fdsp, src + 16 + 8 * src_stride, src_stride, block + (3 << 6)); + +block += 256; +src += 32; } +} else if (chroma && is_422){ /* chroma plane 4
[FFmpeg-cvslog] avcodec/prores_enc : not calculate dct a each quantif search step
ffmpeg | branch: master | Martin Vignali | Mon Oct 8 15:50:52 2018 +0200| [98637be753dfc44c0b2ba54bb4086f281549a89f] | committer: Martin Vignali avcodec/prores_enc : not calculate dct a each quantif search step Improve encoding speed by 2% (using prores input) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=98637be753dfc44c0b2ba54bb4086f281549a89f --- libavcodec/proresenc_anatoliy.c | 91 +++-- 1 file changed, 51 insertions(+), 40 deletions(-) diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index 7ad69c670f..833e8a2019 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -219,7 +219,7 @@ static const uint8_t run_to_cb[16] = { 0x06, 0x06, 0x05, 0x05, 0x04, 0x29, static const uint8_t lev_to_cb[10] = { 0x04, 0x0A, 0x05, 0x06, 0x04, 0x28, 0x28, 0x28, 0x28, 0x4C }; -static void encode_ac_coeffs(AVCodecContext *avctx, PutBitContext *pb, +static void encode_ac_coeffs(PutBitContext *pb, int16_t *in, int blocks_per_slice, int *qmat) { int prev_run = 4; @@ -268,16 +268,10 @@ static void fdct_get(FDCTDSPContext *fdsp, uint8_t *pixels, int stride, int16_t* fdsp->fdct(block); } -static int encode_slice_plane(AVCodecContext *avctx, int mb_count, -uint8_t *src, int src_stride, uint8_t *buf, unsigned buf_size, -int *qmat, int chroma) +static void calc_plane_dct(FDCTDSPContext *fdsp, uint8_t *src, int16_t * blocks, int src_stride, int mb_count, int chroma) { -ProresContext* ctx = avctx->priv_data; -FDCTDSPContext *fdsp = &ctx->fdsp; -LOCAL_ALIGNED(16, int16_t, blocks, [DEFAULT_SLICE_MB_WIDTH << 8]); int16_t *block; -int i, blocks_per_slice; -PutBitContext pb; +int i; block = blocks; for (i = 0; i < mb_count; i++) { @@ -291,37 +285,41 @@ static int encode_slice_plane(AVCodecContext *avctx, int mb_count, block += (256 >> chroma); src += (32 >> chroma); } +} + +static int encode_slice_plane(int16_t *blocks, int mb_count, uint8_t *buf, unsigned buf_size, int *qmat, int chroma) +{ +int blocks_per_slice; +PutBitContext pb; blocks_per_slice = mb_count << (2 - chroma); init_put_bits(&pb, buf, buf_size); encode_dc_coeffs(&pb, blocks, blocks_per_slice, qmat); -encode_ac_coeffs(avctx, &pb, blocks, blocks_per_slice, qmat); +encode_ac_coeffs(&pb, blocks, blocks_per_slice, qmat); flush_put_bits(&pb); return put_bits_ptr(&pb) - pb.buf; } static av_always_inline unsigned encode_slice_data(AVCodecContext *avctx, -uint8_t *dest_y, uint8_t *dest_u, uint8_t *dest_v, int luma_stride, -int chroma_stride, unsigned mb_count, uint8_t *buf, unsigned data_size, -unsigned* y_data_size, unsigned* u_data_size, unsigned* v_data_size, -int qp) + int16_t * blocks_y, int16_t * blocks_u, int16_t * blocks_v, + unsigned mb_count, uint8_t *buf, unsigned data_size, + unsigned* y_data_size, unsigned* u_data_size, unsigned* v_data_size, + int qp) { ProresContext* ctx = avctx->priv_data; -*y_data_size = encode_slice_plane(avctx, mb_count, dest_y, luma_stride, -buf, data_size, ctx->qmat_luma[qp - 1], 0); +*y_data_size = encode_slice_plane(blocks_y, mb_count, + buf, data_size, ctx->qmat_luma[qp - 1], 0); if (!(avctx->flags & AV_CODEC_FLAG_GRAY)) { -*u_data_size = encode_slice_plane(avctx, mb_count, dest_u, -chroma_stride, buf + *y_data_size, data_size - *y_data_size, -ctx->qmat_chroma[qp - 1], 1); - -*v_data_size = encode_slice_plane(avctx, mb_count, dest_v, -chroma_stride, buf + *y_data_size + *u_data_size, -data_size - *y_data_size - *u_data_size, -ctx->qmat_chroma[qp - 1], 1); +*u_data_size = encode_slice_plane(blocks_u, mb_count, buf + *y_data_size, data_size - *y_data_size, + ctx->qmat_chroma[qp - 1], 1); + +*v_data_size = encode_slice_plane(blocks_v, mb_count, buf + *y_data_size + *u_data_size, + data_size - *y_data_size - *u_data_size, + ctx->qmat_chroma[qp - 1], 1); } return *y_data_size + *u_data_size + *v_data_size; @@ -366,10 +364,15 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, int mb_x, uint8_t *dest_y, *dest_u, *dest_v; unsigned y_data_size = 0, u_data_size = 0, v_data_size = 0; ProresContext* ctx = avctx->priv_data; +FDCTDSPContext *fdsp = &ctx->fdsp; int tgt_b
[FFmpeg-cvslog] avcodec/proresenc_aw : use for frame flag in the header the same value than the official encoder
ffmpeg | branch: master | Martin Vignali | Mon Oct 8 15:51:41 2018 +0200| [e832d769f46531a07e2e306c8e483661a757b1fc] | committer: Martin Vignali avcodec/proresenc_aw : use for frame flag in the header the same value than the official encoder > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e832d769f46531a07e2e306c8e483661a757b1fc --- libavcodec/proresenc_anatoliy.c | 2 +- tests/ref/vsynth/vsynth1-prores | 2 +- tests/ref/vsynth/vsynth2-prores | 2 +- tests/ref/vsynth/vsynth3-prores | 2 +- tests/ref/vsynth/vsynth_lena-prores | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index c723fbf540..6b9ce4a59a 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -553,7 +553,7 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt, if (avctx->profile == FF_PROFILE_PRORES_444) { *buf++ = 0xC2; // 444, not interlaced } else { -*buf++ = 0x83; // 422, not interlaced +*buf++ = 0x82; // 422, not interlaced } *buf++ = 0; *buf++ = pict->color_primaries; diff --git a/tests/ref/vsynth/vsynth1-prores b/tests/ref/vsynth/vsynth1-prores index ee9d1712f1..65686aeca1 100644 --- a/tests/ref/vsynth/vsynth1-prores +++ b/tests/ref/vsynth/vsynth1-prores @@ -1,4 +1,4 @@ -27a1293adf92cc0330652e4e81a9328d *tests/data/fate/vsynth1-prores.mov +ec1d32acb0f6035ca45ad7d395d4a586 *tests/data/fate/vsynth1-prores.mov 5022821 tests/data/fate/vsynth1-prores.mov fb4a9e025d12afc0dbbca8d82831858f *tests/data/fate/vsynth1-prores.out.rawvideo stddev:2.47 PSNR: 40.27 MAXDIFF: 31 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-prores b/tests/ref/vsynth/vsynth2-prores index aed9e3e3f5..63bc8a8f30 100644 --- a/tests/ref/vsynth/vsynth2-prores +++ b/tests/ref/vsynth/vsynth2-prores @@ -1,4 +1,4 @@ -71d83e64060c122f440b288a042f7c0b *tests/data/fate/vsynth2-prores.mov +27fa0f1ecb2dbe1510582ec6d01cc81d *tests/data/fate/vsynth2-prores.mov 3260123 tests/data/fate/vsynth2-prores.mov 416fa8773615889c70491452428d6710 *tests/data/fate/vsynth2-prores.out.rawvideo stddev:1.38 PSNR: 45.29 MAXDIFF: 12 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth3-prores b/tests/ref/vsynth/vsynth3-prores index 47afc4f9df..2998dc1d79 100644 --- a/tests/ref/vsynth/vsynth3-prores +++ b/tests/ref/vsynth/vsynth3-prores @@ -1,4 +1,4 @@ -f41aa3ce23eea73be3e207d5d0f18219 *tests/data/fate/vsynth3-prores.mov +6afd345a8f799d0459229349a30497cd *tests/data/fate/vsynth3-prores.mov 105367 tests/data/fate/vsynth3-prores.mov fff5e7ad21d78501c8fa4749bf4bf289 *tests/data/fate/vsynth3-prores.out.rawvideo stddev:2.80 PSNR: 39.17 MAXDIFF: 27 bytes:86700/86700 diff --git a/tests/ref/vsynth/vsynth_lena-prores b/tests/ref/vsynth/vsynth_lena-prores index fb4035cd16..41b8e16bf0 100644 --- a/tests/ref/vsynth/vsynth_lena-prores +++ b/tests/ref/vsynth/vsynth_lena-prores @@ -1,4 +1,4 @@ -09ef7f879fa65d6626dde9a88f1674c9 *tests/data/fate/vsynth_lena-prores.mov +952c0dfde2b3d238c2ef411782f309a6 *tests/data/fate/vsynth_lena-prores.mov 2844076 tests/data/fate/vsynth_lena-prores.mov 03fd29e3963716a09d232b6f817ecb57 *tests/data/fate/vsynth_lena-prores.out.rawvideo stddev:1.31 PSNR: 45.77 MAXDIFF: 11 bytes: 7603200/ 7603200 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale/x86/rgb2rgb : remove mmx version for shuffle2103
ffmpeg | branch: master | Martin Vignali | Thu Oct 11 21:31:18 2018 +0200| [04afdbb5605268e9edc7615cfd80b13a77243a95] | committer: Martin Vignali swscale/x86/rgb2rgb : remove mmx version for shuffle2103 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=04afdbb5605268e9edc7615cfd80b13a77243a95 --- libswscale/x86/rgb2rgb_template.c | 23 --- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/libswscale/x86/rgb2rgb_template.c b/libswscale/x86/rgb2rgb_template.c index d59bd5679e..287e1d3501 100644 --- a/libswscale/x86/rgb2rgb_template.c +++ b/libswscale/x86/rgb2rgb_template.c @@ -1034,6 +1034,7 @@ static inline void RENAME(rgb16to32)(const uint8_t *src, uint8_t *dst, int src_s } } +#if COMPILE_TEMPLATE_MMXEXT static inline void RENAME(shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int src_size) { x86_reg idx = 15 - src_size; @@ -1052,7 +1053,6 @@ static inline void RENAME(shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, PREFETCH" 32(%1, %0)\n\t" "movq (%1, %0), %%mm0 \n\t" "movq 8(%1, %0), %%mm1 \n\t" -# if COMPILE_TEMPLATE_MMXEXT "pshufw $177, %%mm0, %%mm3 \n\t" "pshufw $177, %%mm1, %%mm5 \n\t" "pand %%mm7, %%mm0\n\t" @@ -1061,24 +1061,6 @@ static inline void RENAME(shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, "pand %%mm6, %%mm5\n\t" "por%%mm3, %%mm0\n\t" "por%%mm5, %%mm1\n\t" -# else -"movq %%mm0, %%mm2\n\t" -"movq %%mm1, %%mm4\n\t" -"pand %%mm7, %%mm0\n\t" -"pand %%mm6, %%mm2\n\t" -"pand %%mm7, %%mm1\n\t" -"pand %%mm6, %%mm4\n\t" -"movq %%mm2, %%mm3\n\t" -"movq %%mm4, %%mm5\n\t" -"pslld$16, %%mm2\n\t" -"psrld$16, %%mm3\n\t" -"pslld$16, %%mm4\n\t" -"psrld$16, %%mm5\n\t" -"por%%mm2, %%mm0\n\t" -"por%%mm4, %%mm1\n\t" -"por%%mm3, %%mm0\n\t" -"por%%mm5, %%mm1\n\t" -# endif MOVNTQ" %%mm0, (%2, %0)\n\t" MOVNTQ" %%mm1, 8(%2, %0)\n\t" "add $16, %0 \n\t" @@ -1095,6 +1077,7 @@ static inline void RENAME(shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, *(uint32_t *)&d[idx] = (v>>16) + g + (v<<16); } } +#endif static inline void RENAME(rgb24tobgr24)(const uint8_t *src, uint8_t *dst, int src_size) { @@ -2572,7 +2555,9 @@ static av_cold void RENAME(rgb2rgb_init)(void) rgb24to15 = RENAME(rgb24to15); rgb24to16 = RENAME(rgb24to16); rgb24tobgr24 = RENAME(rgb24tobgr24); +#if COMPILE_TEMPLATE_MMXEXT shuffle_bytes_2103 = RENAME(shuffle_bytes_2103); +#endif rgb32tobgr16 = RENAME(rgb32tobgr16); rgb32tobgr15 = RENAME(rgb32tobgr15); yv12toyuy2 = RENAME(yv12toyuy2); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale/x86/rgb2rgb : port shuffle 2103 mmxext to external asm and remove inline asm version
ffmpeg | branch: master | Martin Vignali | Thu Oct 11 21:35:05 2018 +0200| [296609f859a587575b91fe9e9691f2707d6e8136] | committer: Martin Vignali swscale/x86/rgb2rgb : port shuffle 2103 mmxext to external asm and remove inline asm version > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=296609f859a587575b91fe9e9691f2707d6e8136 --- libswscale/x86/rgb2rgb.c | 4 +++ libswscale/x86/rgb2rgb_template.c | 48 - libswscale/x86/rgb_2_rgb.asm | 63 +++ 3 files changed, 67 insertions(+), 48 deletions(-) diff --git a/libswscale/x86/rgb2rgb.c b/libswscale/x86/rgb2rgb.c index 1191081440..2d6fc2ad26 100644 --- a/libswscale/x86/rgb2rgb.c +++ b/libswscale/x86/rgb2rgb.c @@ -144,6 +144,7 @@ DECLARE_ALIGNED(8, extern const uint64_t, ff_bgr2UVOffset); #endif /* HAVE_INLINE_ASM */ +void ff_shuffle_bytes_2103_mmxext(const uint8_t *src, uint8_t *dst, int src_size); void ff_shuffle_bytes_2103_ssse3(const uint8_t *src, uint8_t *dst, int src_size); void ff_shuffle_bytes_0321_ssse3(const uint8_t *src, uint8_t *dst, int src_size); void ff_shuffle_bytes_1230_ssse3(const uint8_t *src, uint8_t *dst, int src_size); @@ -176,6 +177,9 @@ av_cold void rgb2rgb_init_x86(void) rgb2rgb_init_avx(); #endif /* HAVE_INLINE_ASM */ +if (EXTERNAL_MMXEXT(cpu_flags)) { +shuffle_bytes_2103 = ff_shuffle_bytes_2103_mmxext; +} if (EXTERNAL_SSE2(cpu_flags)) { #if ARCH_X86_64 uyvytoyuv422 = ff_uyvytoyuv422_sse2; diff --git a/libswscale/x86/rgb2rgb_template.c b/libswscale/x86/rgb2rgb_template.c index 287e1d3501..ae2469e663 100644 --- a/libswscale/x86/rgb2rgb_template.c +++ b/libswscale/x86/rgb2rgb_template.c @@ -1034,51 +1034,6 @@ static inline void RENAME(rgb16to32)(const uint8_t *src, uint8_t *dst, int src_s } } -#if COMPILE_TEMPLATE_MMXEXT -static inline void RENAME(shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int src_size) -{ -x86_reg idx = 15 - src_size; -const uint8_t *s = src-idx; -uint8_t *d = dst-idx; -__asm__ volatile( -"test %0, %0 \n\t" -"jns 2f \n\t" -PREFETCH" (%1, %0)\n\t" -"movq %3, %%mm7\n\t" -"pxor %4, %%mm7\n\t" -"movq %%mm7, %%mm6\n\t" -"pxor %5, %%mm7\n\t" -".p2align 4 \n\t" -"1: \n\t" -PREFETCH" 32(%1, %0)\n\t" -"movq (%1, %0), %%mm0 \n\t" -"movq 8(%1, %0), %%mm1 \n\t" -"pshufw $177, %%mm0, %%mm3 \n\t" -"pshufw $177, %%mm1, %%mm5 \n\t" -"pand %%mm7, %%mm0\n\t" -"pand %%mm6, %%mm3\n\t" -"pand %%mm7, %%mm1\n\t" -"pand %%mm6, %%mm5\n\t" -"por%%mm3, %%mm0\n\t" -"por%%mm5, %%mm1\n\t" -MOVNTQ" %%mm0, (%2, %0)\n\t" -MOVNTQ" %%mm1, 8(%2, %0)\n\t" -"add $16, %0 \n\t" -"js1b \n\t" -SFENCE" \n\t" -EMMS" \n\t" -"2: \n\t" -: "+&r"(idx) -: "r" (s), "r" (d), "m" (mask32b), "m" (mask32r), "m" (mmx_one) -: "memory"); -for (; idx<15; idx+=4) { -register unsigned v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00; -v &= 0xff00ff; -*(uint32_t *)&d[idx] = (v>>16) + g + (v<<16); -} -} -#endif - static inline void RENAME(rgb24tobgr24)(const uint8_t *src, uint8_t *dst, int src_size) { unsigned i; @@ -2555,9 +2510,6 @@ static av_cold void RENAME(rgb2rgb_init)(void) rgb24to15 = RENAME(rgb24to15); rgb24to16 = RENAME(rgb24to16); rgb24tobgr24 = RENAME(rgb24tobgr24); -#if COMPILE_TEMPLATE_MMXEXT -shuffle_bytes_2103 = RENAME(shuffle_bytes_2103); -#endif rgb32tobgr16 = RENAME(rgb32tobgr16); rgb32tobgr15 = RENAME(rgb32tobgr15); yv12toyuy2 = RENAME(yv12toyuy2); diff --git a/libswscale/x86/rgb_2_rgb.asm b/libswscale/x86/rgb_2_rgb.asm index 156b4d2c74..5fb5d2ee61 100644 --- a/libswscale/x86/rgb_2_rgb.asm +++ b/libswscale/x86/rgb_2_rgb.asm @@ -24,6 +24,7 @@ SECTION_RODATA +pb_mask_shuffle2103_mmx times 8 dw 255 pb_shuffle2103: db 2, 1, 0, 3, 6, 5, 4, 7,
[FFmpeg-cvslog] fate/mov : use do_md5sum for mov-faststart-4gb-overflow test
ffmpeg | branch: master | Martin Vignali | Thu Sep 20 18:54:20 2018 +0200| [59256dea146d2b6c163f0e3205adda0cbc21c0c4] | committer: Martin Vignali fate/mov : use do_md5sum for mov-faststart-4gb-overflow test fix test on osx based on suggestion by Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=59256dea146d2b6c163f0e3205adda0cbc21c0c4 --- tests/fate/mov.mak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak index ecdd7f92b4..4df0fe6490 100644 --- a/tests/fate/mov.mak +++ b/tests/fate/mov.mak @@ -119,7 +119,7 @@ fate-mov-guess-delay-1: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stre fate-mov-guess-delay-2: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream=has_b_frames -select_streams v $(TARGET_SAMPLES)/h264/h264_3bf_pyramid_nobsrestriction.mp4 fate-mov-guess-delay-3: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream=has_b_frames -select_streams v $(TARGET_SAMPLES)/h264/h264_4bf_pyramid_nobsrestriction.mp4 -fate-mov-faststart-4gb-overflow: CMD = run tools/qt-faststart$(EXESUF) $(TARGET_SAMPLES)/mov/faststart-4gb-overflow.mov faststart-4gb-overflow-output.mov > /dev/null ; md5sum faststart-4gb-overflow-output.mov | cut -d " " -f1 ; rm faststart-4gb-overflow-output.mov +fate-mov-faststart-4gb-overflow: CMD = run tools/qt-faststart$(EXESUF) $(TARGET_SAMPLES)/mov/faststart-4gb-overflow.mov faststart-4gb-overflow-output.mov > /dev/null ; do_md5sum faststart-4gb-overflow-output.mov | cut -d " " -f1 ; rm faststart-4gb-overflow-output.mov fate-mov-faststart-4gb-overflow: CMP = oneline fate-mov-faststart-4gb-overflow: REF = bc875921f151871e787c4b4023269b29 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale : treat float input data as uint 16bpc
ffmpeg | branch: master | Martin Vignali | Mon Aug 20 15:28:00 2018 +0200| [3af1c4ea7d18c54738cd93f09b376d2228fdbce0] | committer: Martin Vignali swscale : treat float input data as uint 16bpc Currently float are converted to 16b uint in input part using src depth (32 bits) in hScale16To19 and hScale16to15, make an invalid shift for the data So shift the value when using float input like 16 bpc uint. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3af1c4ea7d18c54738cd93f09b376d2228fdbce0 --- libswscale/swscale.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 7f3e22355f..3ae16bef7d 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -74,8 +74,11 @@ static void hScale16To19_c(SwsContext *c, int16_t *_dst, int dstW, int bits= desc->comp[0].depth - 1; int sh = bits - 4; -if((isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8) && desc->comp[0].depth<16) +if ((isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8) && desc->comp[0].depth<16) { sh= 9; +} else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */ +sh = 16 - 1 - 4; +} for (i = 0; i < dstW; i++) { int j; @@ -99,8 +102,11 @@ static void hScale16To15_c(SwsContext *c, int16_t *dst, int dstW, const uint16_t *src = (const uint16_t *) _src; int sh = desc->comp[0].depth - 1; -if(sh<15) +if (sh<15) { sh= isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8 ? 13 : (desc->comp[0].depth - 1); +} else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */ +sh = 16 - 1; +} for (i = 0; i < dstW; i++) { int j; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/psd : add support for gray float
ffmpeg | branch: master | Martin Vignali | Mon Aug 20 15:26:07 2018 +0200| [9e64ee3936b1a49842add8dbd5e5d016f4f32103] | committer: Martin Vignali avcodec/psd : add support for gray float > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9e64ee3936b1a49842add8dbd5e5d016f4f32103 --- libavcodec/psd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/psd.c b/libavcodec/psd.c index 66f2ec28d7..43814471da 100644 --- a/libavcodec/psd.c +++ b/libavcodec/psd.c @@ -369,6 +369,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, avctx->pix_fmt = AV_PIX_FMT_GRAY8; } else if (s->channel_depth == 16) { avctx->pix_fmt = AV_PIX_FMT_GRAY16BE; +} else if (s->channel_depth == 32) { +avctx->pix_fmt = AV_PIX_FMT_GRAYF32BE; } else { avpriv_report_missing_feature(avctx, "channel depth %d for grayscale", s->channel_depth); return AVERROR_PATCHWELCOME; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale/swscale : small cosmetic
ffmpeg | branch: master | Martin Vignali | Mon Aug 20 15:31:01 2018 +0200| [bdd67546482bd3bdd67b4ae2d855fd1ff989d0d0] | committer: Martin Vignali swscale/swscale : small cosmetic > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bdd67546482bd3bdd67b4ae2d855fd1ff989d0d0 --- libswscale/swscale.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 3ae16bef7d..40695503ad 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -75,7 +75,7 @@ static void hScale16To19_c(SwsContext *c, int16_t *_dst, int dstW, int sh = bits - 4; if ((isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8) && desc->comp[0].depth<16) { -sh= 9; +sh = 9; } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */ sh = 16 - 1 - 4; } @@ -103,7 +103,7 @@ static void hScale16To15_c(SwsContext *c, int16_t *dst, int dstW, int sh = desc->comp[0].depth - 1; if (sh<15) { -sh= isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8 ? 13 : (desc->comp[0].depth - 1); +sh = isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8 ? 13 : (desc->comp[0].depth - 1); } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */ sh = 16 - 1; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avdevice/sdl2 : add option to define if the window quit action is available
ffmpeg | branch: master | Martin Vignali | Tue May 8 11:55:40 2018 +0200| [411f7141a3c328e73dea468cad59d42f087b5c1d] | committer: Martin Vignali avdevice/sdl2 : add option to define if the window quit action is available > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=411f7141a3c328e73dea468cad59d42f087b5c1d --- doc/outdevs.texi | 5 + libavdevice/sdl2.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/outdevs.texi b/doc/outdevs.texi index daf7b1ae62..c2906b9371 100644 --- a/doc/outdevs.texi +++ b/doc/outdevs.texi @@ -396,6 +396,11 @@ downscaled according to the aspect ratio. @item window_fullscreen Set fullscreen mode when non-zero value is provided. Default value is zero. + +@item window_enable_quit +Enable quit action (using window button or keyboard key) +when non-zero value is provided. +Default value is 1 (enable quit action) @end table @subsection Interactive commands diff --git a/libavdevice/sdl2.c b/libavdevice/sdl2.c index e363df398d..da5143078e 100644 --- a/libavdevice/sdl2.c +++ b/libavdevice/sdl2.c @@ -42,6 +42,7 @@ typedef struct { int window_width, window_height; /**< size of the window */ int window_fullscreen; int window_borderless; +int enable_quit_action; SDL_Texture *texture; int texture_fmt; @@ -277,7 +278,7 @@ static int sdl2_write_packet(AVFormatContext *s, AVPacket *pkt) } } -if (quit) { +if (quit && sdl->enable_quit_action) { sdl2_write_trailer(s); return AVERROR(EIO); } @@ -338,6 +339,7 @@ static const AVOption options[] = { { "window_size", "set SDL window forced size", OFFSET(window_width), AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, 0, AV_OPT_FLAG_ENCODING_PARAM }, { "window_fullscreen", "set SDL window fullscreen", OFFSET(window_fullscreen), AV_OPT_TYPE_BOOL, { .i64 = 0 },0, 1, AV_OPT_FLAG_ENCODING_PARAM }, { "window_borderless", "set SDL window border off", OFFSET(window_borderless), AV_OPT_TYPE_BOOL, { .i64 = 0 },0, 1, AV_OPT_FLAG_ENCODING_PARAM }, +{ "window_enable_quit", "set if quit action is available", OFFSET(enable_quit_action), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM }, { NULL }, }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avdevice/sdl2output : fix setting window_size
ffmpeg | branch: master | Martin Vignali | Tue May 8 11:47:13 2018 +0200| [644130bcaa22ed42718e1e0aabcb0e398b8414ff] | committer: Martin Vignali avdevice/sdl2output : fix setting window_size > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=644130bcaa22ed42718e1e0aabcb0e398b8414ff --- libavdevice/sdl2.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavdevice/sdl2.c b/libavdevice/sdl2.c index 48ed977beb..e363df398d 100644 --- a/libavdevice/sdl2.c +++ b/libavdevice/sdl2.c @@ -206,9 +206,7 @@ static int sdl2_write_header(AVFormatContext *s) } } -sdl->window_width = sdl->texture_rect.w = codecpar->width; -sdl->window_height = sdl->texture_rect.h = codecpar->height; -sdl->texture_rect.x = sdl->texture_rect.y = 0; +compute_texture_rect(s); if (SDL_CreateWindowAndRenderer(sdl->window_width, sdl->window_height, flags, &sdl->window, &sdl->renderer) != 0){ @@ -219,7 +217,7 @@ static int sdl2_write_header(AVFormatContext *s) SDL_SetWindowTitle(sdl->window, sdl->window_title); sdl->texture = SDL_CreateTexture(sdl->renderer, sdl->texture_fmt, SDL_TEXTUREACCESS_STREAMING, - sdl->window_width, sdl->window_height); + codecpar->width, codecpar->height); if (!sdl->texture) { av_log(sdl, AV_LOG_ERROR, "Unable to set create mode: %s\n", SDL_GetError()); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] fate/hapenc : remove tests due to inconsistent result
ffmpeg | branch: master | Martin Vignali | Tue May 8 11:41:52 2018 +0200| [6ebc71847e21a8abaf7ff3d902cb1cf63511e7b4] | committer: Martin Vignali fate/hapenc : remove tests due to inconsistent result > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6ebc71847e21a8abaf7ff3d902cb1cf63511e7b4 --- tests/fate/hap.mak | 17 - 1 file changed, 17 deletions(-) diff --git a/tests/fate/hap.mak b/tests/fate/hap.mak index 075a602e45..555bb6eba0 100644 --- a/tests/fate/hap.mak +++ b/tests/fate/hap.mak @@ -70,20 +70,3 @@ FATE_SAMPLES_FFMPEG-$(call ALLYES, MOV_DEMUXER HAPQA_EXTRACT_BSF MOV_MUXER) += $ FATE_SAMPLES_FFPROBE += $(FATE_HAPQA_EXTRACT_BSF_FFPROBE) fate-hapqa-extract-bsf: $(FATE_HAPQA_EXTRACT_BSF) $(FATE_HAPQA_EXTRACT_BSF_FFPROBE) - - -fate-hapenc%: CMD = framemd5 -f image2 -c:v pgmyuv -i $(TARGET_PATH)/tests/vsynth1/%02d.pgm -sws_flags +accurate_rnd+bitexact -vframes 5 -c:v hap ${OPTS} - -FATE_HAPENC += fate-hapenc-hap-none -fate-hapenc-hap-none: OPTS = -pix_fmt rgba -format hap -compressor none - -FATE_HAPENC += fate-hapenc-hapa-none -fate-hapenc-hapa-none: OPTS = -pix_fmt rgba -format hap_alpha -compressor none - -FATE_HAPENC += fate-hapenc-hapq-none -fate-hapenc-hapq-none: OPTS = -pix_fmt rgba -format hap_q -compressor none - -$(FATE_HAPENC): $(VREF) - -FATE_AVCONV-$(call ENCMUX, HAP, MOV) += $(FATE_HAPENC) -fate-hapenc: $(FATE_HAPENC) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale/swscale_unscaled : add X86_64 (SSE2 and AVX) for uyvyto422
ffmpeg | branch: master | Martin Vignali | Sun Apr 22 19:14:23 2018 +0200| [07a566e7d6fc4dbb4250da55d925b5591b3d03f9] | committer: Martin Vignali swscale/swscale_unscaled : add X86_64 (SSE2 and AVX) for uyvyto422 and checkasm test > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=07a566e7d6fc4dbb4250da55d925b5591b3d03f9 --- libswscale/x86/rgb2rgb.c | 19 ++ libswscale/x86/rgb_2_rgb.asm | 150 +++ tests/checkasm/sw_rgb.c | 50 +++ 3 files changed, 219 insertions(+) diff --git a/libswscale/x86/rgb2rgb.c b/libswscale/x86/rgb2rgb.c index e5f318a72c..1191081440 100644 --- a/libswscale/x86/rgb2rgb.c +++ b/libswscale/x86/rgb2rgb.c @@ -150,6 +150,15 @@ void ff_shuffle_bytes_1230_ssse3(const uint8_t *src, uint8_t *dst, int src_size) void ff_shuffle_bytes_3012_ssse3(const uint8_t *src, uint8_t *dst, int src_size); void ff_shuffle_bytes_3210_ssse3(const uint8_t *src, uint8_t *dst, int src_size); +#if ARCH_X86_64 +void ff_uyvytoyuv422_sse2(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, + const uint8_t *src, int width, int height, + int lumStride, int chromStride, int srcStride); +void ff_uyvytoyuv422_avx(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, + const uint8_t *src, int width, int height, + int lumStride, int chromStride, int srcStride); +#endif + av_cold void rgb2rgb_init_x86(void) { int cpu_flags = av_get_cpu_flags(); @@ -167,6 +176,11 @@ av_cold void rgb2rgb_init_x86(void) rgb2rgb_init_avx(); #endif /* HAVE_INLINE_ASM */ +if (EXTERNAL_SSE2(cpu_flags)) { +#if ARCH_X86_64 +uyvytoyuv422 = ff_uyvytoyuv422_sse2; +#endif +} if (EXTERNAL_SSSE3(cpu_flags)) { shuffle_bytes_0321 = ff_shuffle_bytes_0321_ssse3; shuffle_bytes_2103 = ff_shuffle_bytes_2103_ssse3; @@ -174,4 +188,9 @@ av_cold void rgb2rgb_init_x86(void) shuffle_bytes_3012 = ff_shuffle_bytes_3012_ssse3; shuffle_bytes_3210 = ff_shuffle_bytes_3210_ssse3; } +if (EXTERNAL_AVX(cpu_flags)) { +#if ARCH_X86_64 +uyvytoyuv422 = ff_uyvytoyuv422_avx; +#endif +} } diff --git a/libswscale/x86/rgb_2_rgb.asm b/libswscale/x86/rgb_2_rgb.asm index db45e313d8..156b4d2c74 100644 --- a/libswscale/x86/rgb_2_rgb.asm +++ b/libswscale/x86/rgb_2_rgb.asm @@ -32,6 +32,16 @@ pb_shuffle3210: db 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 SECTION .text +%macro RSHIFT_COPY 3 +; %1 dst ; %2 src ; %3 shift +%if cpuflag(avx) +psrldq %1, %2, %3 +%else +mova %1, %2 +RSHIFT %1, %3 +%endif +%endmacro + ;-- ; shuffle_bytes_## (const uint8_t *src, uint8_t *dst, int src_size) ;-- @@ -84,3 +94,143 @@ SHUFFLE_BYTES 0, 3, 2, 1 SHUFFLE_BYTES 1, 2, 3, 0 SHUFFLE_BYTES 3, 0, 1, 2 SHUFFLE_BYTES 3, 2, 1, 0 + +;--- +; uyvytoyuv422(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, +; const uint8_t *src, int width, int height, +; int lumStride, int chromStride, int srcStride) +;--- +%macro UYVY_TO_YUV422 0 +cglobal uyvytoyuv422, 9, 14, 8, ydst, udst, vdst, src, w, h, lum_stride, chrom_stride, src_stride, wtwo, whalf, tmp, x, back_w +pxor m0, m0 +pcmpeqw m1, m1 +psrlwm1, 8 + +movsxdifnidnwq, wd +movsxdifnidn lum_strideq, lum_strided +movsxdifnidn chrom_strideq, chrom_strided +movsxdifnidn src_strideq, src_strided + +mov back_wq, wq +mov whalfq, wq +shr whalfq, 1 ; whalf = width / 2 + +lea srcq, [srcq + wq * 2] +addydstq, wq +addudstq, whalfq +addvdstq, whalfq + +.loop_line: +mov xq, wq +mov wtwoq, wq +add wtwoq, wtwoq ; wtwo = width * 2 + +neg wq +negwtwoq +neg whalfq + +;calc scalar loop count +and xq, mmsize * 2 - 1 +je .loop_simd + +.loop_scalar: +mov tmpb, [srcq + wtwoq + 0] +mov [udstq + whalfq], tmpb + +mov tmpb, [srcq + wtwoq + 1] +mov [ydstq + wq], tmpb + +mov tmpb, [srcq + wtwoq + 2] +mov [vdstq + whalfq], tmpb + +mov tmpb, [srcq + wtwoq + 3] +mov [ydstq + wq + 1], tmpb + +add wq, 2 +add wtwoq, 4 +add whalfq, 1 +sub xq, 2 +jg .loop_scalar + +; check if simd loop is need +cmp wq, 0 +jge .end_line + +.loop_simd: +movum2, [srcq + wtwoq ] +movum3, [srcq + wtwoq + mmsize] +movum4, [s
[FFmpeg-cvslog] avcodec/prores_ks : use official quant_matrix (for proxy and xq codec luma and chroma quant matrix is not the same)
ffmpeg | branch: master | Martin Vignali | Fri Apr 13 20:50:18 2018 +0200| [e6e4625862818043f1cb50d947c014fc4b8fb064] | committer: Martin Vignali avcodec/prores_ks : use official quant_matrix (for proxy and xq codec luma and chroma quant matrix is not the same) disable the use of the official luma xq matrix for now (output appear to be desaturate) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e6e4625862818043f1cb50d947c014fc4b8fb064 --- libavcodec/proresenc_kostya.c | 99 --- 1 file changed, 83 insertions(+), 16 deletions(-) diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c index 06d5aa31e8..81f3865ea6 100644 --- a/libavcodec/proresenc_kostya.c +++ b/libavcodec/proresenc_kostya.c @@ -51,9 +51,11 @@ enum { enum { QUANT_MAT_PROXY = 0, +QUANT_MAT_PROXY_CHROMA, QUANT_MAT_LT, QUANT_MAT_STANDARD, QUANT_MAT_HQ, +QUANT_MAT_XQ_LUMA, QUANT_MAT_DEFAULT, }; @@ -68,6 +70,16 @@ static const uint8_t prores_quant_matrices[][64] = { 13, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, }, +{ // proxy chromas +4, 7, 9, 11, 13, 14, 63, 63, +7, 7, 11, 12, 14, 63, 63, 63, +9, 11, 13, 14, 63, 63, 63, 63, +11, 11, 13, 14, 63, 63, 63, 63, +11, 13, 14, 63, 63, 63, 63, 63, +13, 14, 63, 63, 63, 63, 63, 63, +13, 63, 63, 63, 63, 63, 63, 63, +63, 63, 63, 63, 63, 63, 63, 63 +}, { // LT 4, 5, 6, 7, 9, 11, 13, 15, 5, 5, 7, 8, 11, 13, 15, 17, @@ -98,6 +110,16 @@ static const uint8_t prores_quant_matrices[][64] = { 4, 4, 4, 4, 5, 5, 6, 7, 4, 4, 4, 4, 5, 6, 7, 7, }, +{ // XQ luma +2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 3, +2, 2, 2, 2, 2, 2, 3, 3, +2, 2, 2, 2, 2, 3, 3, 3, +2, 2, 2, 2, 3, 3, 3, 4, +2, 2, 2, 2, 3, 3, 4, 4, +}, { // codec default 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, @@ -125,6 +147,7 @@ static const struct prores_profile { int max_quant; int br_tab[NUM_MB_LIMITS]; int quant; +int quant_chroma; } prores_profile_info[6] = { { .full_name = "proxy", @@ -133,6 +156,7 @@ static const struct prores_profile { .max_quant = 8, .br_tab= { 300, 242, 220, 194 }, .quant = QUANT_MAT_PROXY, +.quant_chroma = QUANT_MAT_PROXY_CHROMA, }, { .full_name = "LT", @@ -141,6 +165,7 @@ static const struct prores_profile { .max_quant = 9, .br_tab= { 720, 560, 490, 440 }, .quant = QUANT_MAT_LT, +.quant_chroma = QUANT_MAT_LT, }, { .full_name = "standard", @@ -149,6 +174,7 @@ static const struct prores_profile { .max_quant = 6, .br_tab= { 1050, 808, 710, 632 }, .quant = QUANT_MAT_STANDARD, +.quant_chroma = QUANT_MAT_STANDARD, }, { .full_name = "high quality", @@ -157,6 +183,7 @@ static const struct prores_profile { .max_quant = 6, .br_tab= { 1566, 1216, 1070, 950 }, .quant = QUANT_MAT_HQ, +.quant_chroma = QUANT_MAT_HQ, }, { .full_name = "", @@ -165,6 +192,7 @@ static const struct prores_profile { .max_quant = 6, .br_tab= { 2350, 1828, 1600, 1425 }, .quant = QUANT_MAT_HQ, +.quant_chroma = QUANT_MAT_HQ, }, { .full_name = "XQ", @@ -172,7 +200,8 @@ static const struct prores_profile { .min_quant = 1, .max_quant = 6, .br_tab= { 3525, 2742, 2400, 2137 }, -.quant = QUANT_MAT_HQ, +.quant = QUANT_MAT_HQ, /* Fix me : use QUANT_MAT_XQ_LUMA */ +.quant_chroma = QUANT_MAT_HQ, } }; @@ -200,8 +229,10 @@ typedef struct ProresContext { DECLARE_ALIGNED(16, int16_t, blocks)[MAX_PLANES][64 * 4 * MAX_MBS_PER_SLICE]; DECLARE_ALIGNED(16, uint16_t, emu_buf)[16*16]; int16_t quants[MAX_STORED_Q][64]; +int16_t quants_chroma[MAX_STORED_Q][64]; int16_t custom_q[64]; const uint8_t *quant_mat; +const uint8_t *quant_chroma_mat; const uint8_t *scantable; void (*fdct)(FDCTDSPContext *fdsp, const uint16_t *src, @@ -527,6 +558,7 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, ptrdiff_t linesize; int plane_factor, is_chroma; uint16_t *qmat; +uint16_t *qmat_chroma; if (ctx->pictures_per_frame == 1) line_add = 0; @@ -535,12 +567,17 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, if (ctx->force_quant) { qmat = ctx-
[FFmpeg-cvslog] avfilter/showvolume : add display scale option
ffmpeg | branch: master | Martin Vignali | Mon Apr 16 11:31:43 2018 +0200| [cb2f52b6a70971c902ea2aaa989d141973472125] | committer: Martin Vignali avfilter/showvolume : add display scale option linear (current behaviour) or log display (more close to classic audio meter) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cb2f52b6a70971c902ea2aaa989d141973472125 --- doc/filters.texi | 4 libavfilter/avf_showvolume.c | 28 +--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 40083dd080..d95b377bd7 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -20014,6 +20014,10 @@ Set background opacity, allowed range is [0, 1]. Default is 0. @item m Set metering mode, can be peak: @code{p} or rms: @code{r}, default is @code{p}. + +@item ds +Set display scale, can be linear: @code{lin} or log: @code{log}, +default is @code{lin}. @end table @section showwaves diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c index 7fe3916855..da8b4088bd 100644 --- a/libavfilter/avf_showvolume.c +++ b/libavfilter/avf_showvolume.c @@ -33,6 +33,7 @@ static const char *const var_names[] = { "VOLUME", "CHANNEL", "PEAK", NULL }; enum { VAR_VOLUME, VAR_CHANNEL, VAR_PEAK, VAR_VARS_NB }; +enum DisplayScale { LINEAR, LOG, NB_DISPLAY_SCALE }; typedef struct ShowVolumeContext { const AVClass *class; @@ -54,6 +55,7 @@ typedef struct ShowVolumeContext { uint32_t *color_lut; float *max; float rms_factor; +int display_scale; void (*meter)(float *src, int nb_samples, float *max, float factor); } ShowVolumeContext; @@ -79,6 +81,9 @@ static const AVOption showvolume_options[] = { { "m", "set mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "mode" }, { "p", "peak", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "mode" }, { "r", "rms", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "mode" }, +{ "ds", "set display scale", OFFSET(display_scale), AV_OPT_TYPE_INT, {.i64=LINEAR}, LINEAR, NB_DISPLAY_SCALE - 1, FLAGS, "display_scale" }, +{ "lin", "linear", 0, AV_OPT_TYPE_CONST, {.i64=LINEAR}, 0, 0, FLAGS, "display_scale" }, +{ "log", "log", 0, AV_OPT_TYPE_CONST, {.i64=LOG}, 0, 0, FLAGS, "display_scale" }, { NULL } }; @@ -256,13 +261,28 @@ static void clear_picture(ShowVolumeContext *s, AVFilterLink *outlink) { } } +static inline int calc_max_draw(ShowVolumeContext *s, AVFilterLink *outlink, float max) +{ +float max_val; +if (s->display_scale == LINEAR) { +max_val = max; +} else { /* log */ +max_val = av_clipf(0.21 * log10(max) + 1, 0, 1); +} +if (s->orientation) { /* vertical */ +return outlink->h - outlink->h * max_val; +} else { /* horizontal */ +return s->w * max_val; +} +} + static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) { AVFilterContext *ctx = inlink->dst; AVFilterLink *outlink = ctx->outputs[0]; ShowVolumeContext *s = ctx->priv; const int step = s->step; -int c, j, k; +int c, j, k, max_draw; AVFrame *out; if (!s->out || s->out->width != outlink->w || @@ -304,8 +324,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) s->values[c * VAR_VARS_NB + VAR_VOLUME] = 20.0 * log10(max); max = av_clipf(max, 0, 1); +max_draw = calc_max_draw(s, outlink, max); -for (j = outlink->h - outlink->h * max; j < s->w; j++) { +for (j = max_draw; j < s->w; j++) { uint8_t *dst = s->out->data[0] + j * s->out->linesize[0] + c * (s->b + s->h) * 4; for (k = 0; k < s->h; k++) { AV_WN32A(&dst[k * 4], lut[s->w - j - 1]); @@ -332,11 +353,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) s->values[c * VAR_VARS_NB + VAR_VOLUME] = 20.0 * log10(max); max = av_clipf(max, 0, 1); +max_draw = calc_max_draw(s, outlink, max); for (j = 0; j < s->h; j++) { uint8_t *dst = s->out->data[0] + (c * s->h + c * s->b + j) * s->out->linesize[0]; -for (k = 0; k < s->w * max; k++) { +for (k = 0; k < max_draw; k++) { AV_WN32A(dst + k * 4, lut[k]); if (k & step) k += step; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/showvolume : add persistent max display
ffmpeg | branch: master | Martin Vignali | Mon Apr 16 11:32:48 2018 +0200| [fd10a6e2f21f9cadc44a0415e204ea82940cd089] | committer: Martin Vignali avfilter/showvolume : add persistent max display draw a color line for the max level in the given duration > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fd10a6e2f21f9cadc44a0415e204ea82940cd089 --- doc/filters.texi | 10 + libavfilter/avf_showvolume.c | 52 2 files changed, 62 insertions(+) diff --git a/doc/filters.texi b/doc/filters.texi index d95b377bd7..f267d26b9d 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -20018,6 +20018,16 @@ default is @code{p}. @item ds Set display scale, can be linear: @code{lin} or log: @code{log}, default is @code{lin}. + +@item dm +In second. +If set to > 0., display a line for the max level +in the previous seconds. +default is disabled: @code{0.} + +@item dmc +The color of the max line. Use when @code{dm} option is set to > 0. +default is: @code{orange} @end table @section showwaves diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c index da8b4088bd..fe8a95a07b 100644 --- a/libavfilter/avf_showvolume.c +++ b/libavfilter/avf_showvolume.c @@ -57,6 +57,12 @@ typedef struct ShowVolumeContext { float rms_factor; int display_scale; +double draw_persistent_duration; /* in second */ +uint8_t persistant_max_rgba[4]; +int persistent_max_frames; /* number of frames to check max value */ +float *max_persistent; /* max value for draw_persistent_max for each channel */ +int *nb_frames_max_display; /* number of frame for each channel, for displaying the max value */ + void (*meter)(float *src, int nb_samples, float *max, float factor); } ShowVolumeContext; @@ -73,6 +79,8 @@ static const AVOption showvolume_options[] = { { "c", "set volume color expression", OFFSET(color), AV_OPT_TYPE_STRING, {.str="PEAK*255+floor((1-PEAK)*255)*256+0xff00"}, 0, 0, FLAGS }, { "t", "display channel names", OFFSET(draw_text), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS }, { "v", "display volume value", OFFSET(draw_volume), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS }, +{ "dm", "duration for max value display", OFFSET(draw_persistent_duration), AV_OPT_TYPE_DOUBLE, {.dbl=0.}, 0, 9000, FLAGS}, +{ "dmc","set color of the max value line", OFFSET(persistant_max_rgba), AV_OPT_TYPE_COLOR, {.str = "orange"}, CHAR_MIN, CHAR_MAX, FLAGS }, { "o", "set orientation", OFFSET(orientation), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "orientation" }, { "h", "horizontal", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "orientation" }, { "v", "vertical", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "orientation" }, @@ -180,6 +188,11 @@ static int config_input(AVFilterLink *inlink) default: return AVERROR_BUG; } +if (s->draw_persistent_duration > 0.) { +s->persistent_max_frames = (int) FFMAX(av_q2d(s->frame_rate) * s->draw_persistent_duration, 1.); +s->max_persistent = av_calloc(inlink->channels * s->persistent_max_frames, sizeof(*s->max_persistent)); +s->nb_frames_max_display = av_calloc(inlink->channels * s->persistent_max_frames, sizeof(*s->nb_frames_max_display)); +} return 0; } @@ -276,6 +289,33 @@ static inline int calc_max_draw(ShowVolumeContext *s, AVFilterLink *outlink, flo } } +static inline void calc_persistent_max(ShowVolumeContext *s, float max, int channel) +{ +/* update max value for persistent max display */ +if ((max >= s->max_persistent[channel]) || (s->nb_frames_max_display[channel] >= s->persistent_max_frames)) { /* update max value for display */ +s->max_persistent[channel] = max; +s->nb_frames_max_display[channel] = 0; +} else { +s->nb_frames_max_display[channel] += 1; /* incremente display frame count */ +} +} + +static inline void draw_max_line(ShowVolumeContext *s, int max_draw, int channel) +{ +int k; +if (s->orientation) { /* vertical */ +uint8_t *dst = s->out->data[0] + max_draw * s->out->linesize[0] + channel * (s->b + s->h) * 4; +for (k = 0; k < s->h; k++) { +memcpy(dst + k * 4, s->persistant_max_rgba, sizeof(s->persistant_max_rgba)); +} +} else { /* horizontal */ +for (k = 0; k < s->h; k++) { +uint8_t *dst = s->out->data[0] + (channel * s->h + channel * s->b + k) * s->out->linesize[0]; +memcpy(dst + max_draw * 4, s->persistant_max_rgba, sizeof(s->persistant_max_rgba)); +} +} +} + static int filter_frame
[FFmpeg-cvslog] avfilter/showvolume : cosmetic move bracket after func declaration to a new line
ffmpeg | branch: master | Martin Vignali | Mon Apr 16 11:33:14 2018 +0200| [56315df32c489676c3add6c1305c53cfeaae6f2c] | committer: Martin Vignali avfilter/showvolume : cosmetic move bracket after func declaration to a new line > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=56315df32c489676c3add6c1305c53cfeaae6f2c --- libavfilter/avf_showvolume.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c index fe8a95a07b..6b553c4eba 100644 --- a/libavfilter/avf_showvolume.c +++ b/libavfilter/avf_showvolume.c @@ -263,7 +263,8 @@ static void drawtext(AVFrame *pic, int x, int y, const char *txt, int o) } } -static void clear_picture(ShowVolumeContext *s, AVFilterLink *outlink) { +static void clear_picture(ShowVolumeContext *s, AVFilterLink *outlink) +{ int i, j; const uint32_t bg = (uint32_t)(s->bgopacity * 255) << 24; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/prores_ks : do not call estimate_alpha at each quantification step
ffmpeg | branch: master | Martin Vignali | Thu Apr 5 22:04:35 2018 +0200| [1425114af24d8402758ca11f7177d19a7f98df4d] | committer: Martin Vignali avcodec/prores_ks : do not call estimate_alpha at each quantification step also remove unused arg in estimate_alpha_plane Improve quality of Prores encoding > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1425114af24d8402758ca11f7177d19a7f98df4d --- libavcodec/proresenc_kostya.c | 20 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c index 149dc81b3c..06d5aa31e8 100644 --- a/libavcodec/proresenc_kostya.c +++ b/libavcodec/proresenc_kostya.c @@ -712,10 +712,9 @@ static int est_alpha_diff(int cur, int prev, int abits) return dbits + 1; } -static int estimate_alpha_plane(ProresContext *ctx, int *error, +static int estimate_alpha_plane(ProresContext *ctx, const uint16_t *src, ptrdiff_t linesize, -int mbs_per_slice, int quant, -int16_t *blocks) +int mbs_per_slice, int16_t *blocks) { const int abits = ctx->alpha_bits; const int mask = (1 << abits) - 1; @@ -725,7 +724,6 @@ static int estimate_alpha_plane(ProresContext *ctx, int *error, int run = 0; int bits; -*error = 0; cur = blocks[idx++]; bits = est_alpha_diff(cur, prev, abits); prev = cur; @@ -774,6 +772,7 @@ static int find_slice_quant(AVCodecContext *avctx, int overquant; uint16_t *qmat; int linesize[4], line_add; +int alpha_bits = 0; if (ctx->pictures_per_frame == 1) line_add = 0; @@ -819,9 +818,12 @@ static int find_slice_quant(AVCodecContext *avctx, td->nodes[trellis_node + q].quant = q; } +if (ctx->alpha_bits) +alpha_bits = estimate_alpha_plane(ctx, src, linesize[3], + mbs_per_slice, td->blocks[3]); // todo: maybe perform coarser quantising to fit into frame size when needed for (q = min_quant; q <= max_quant; q++) { -bits = 0; +bits = alpha_bits; error = 0; for (i = 0; i < ctx->num_planes - !!ctx->alpha_bits; i++) { bits += estimate_slice_plane(ctx, &error, i, @@ -830,9 +832,6 @@ static int find_slice_quant(AVCodecContext *avctx, num_cblocks[i], plane_factor[i], ctx->quants[q], td); } -if (ctx->alpha_bits) -bits += estimate_alpha_plane(ctx, &error, src, linesize[3], - mbs_per_slice, q, td->blocks[3]); if (bits > 65000 * 8) error = SCORE_LIMIT; @@ -845,7 +844,7 @@ static int find_slice_quant(AVCodecContext *avctx, overquant = max_quant; } else { for (q = max_quant + 1; q < 128; q++) { -bits = 0; +bits = alpha_bits; error = 0; if (q < MAX_STORED_Q) { qmat = ctx->quants[q]; @@ -861,9 +860,6 @@ static int find_slice_quant(AVCodecContext *avctx, num_cblocks[i], plane_factor[i], qmat, td); } -if (ctx->alpha_bits) -bits += estimate_alpha_plane(ctx, &error, src, linesize[3], - mbs_per_slice, q, td->blocks[3]); if (bits <= ctx->bits_per_mb * mbs_per_slice) break; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/x86/vf_blend : reorganize DIFFERENCE macro to reduce line duplication between 8bit and 16 bit version
ffmpeg | branch: master | Martin Vignali | Sat Mar 17 19:24:49 2018 +0100| [8eb0bb11083320cc12bcc23104a384984c4a9d64] | committer: Martin Vignali avfilter/x86/vf_blend : reorganize DIFFERENCE macro to reduce line duplication between 8bit and 16 bit version > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8eb0bb11083320cc12bcc23104a384984c4a9d64 --- libavfilter/x86/vf_blend.asm | 38 -- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/libavfilter/x86/vf_blend.asm b/libavfilter/x86/vf_blend.asm index 5d9a909192..9cd5ee7acb 100644 --- a/libavfilter/x86/vf_blend.asm +++ b/libavfilter/x86/vf_blend.asm @@ -295,8 +295,9 @@ BLEND_INIT %1, 4, %3 BLEND_END %endmacro -%macro DIFFERENCE 1-2 -BLEND_INIT %1, 5, %2 +; %1 name , %2 src (b or w), %3 inter (w or d), %4 (1 if 16bit, not set if 8 bit) +%macro DIFFERENCE 3-4 +BLEND_INIT %1, 5, %4 pxor m2, m2 .nextrow: movxq, widthq @@ -304,26 +305,19 @@ BLEND_INIT %1, 5, %2 .loop: movum0, [topq + xq] movum1, [bottomq + xq] -%if %0 == 2 ; 16 bit -punpckhwd m3, m0, m2 -punpcklwd m0, m2 -punpckhwd m4, m1, m2 -punpcklwd m1, m2 -psubd m0, m1 -psubd m3, m4 +punpckh%2%3 m3, m0, m2 +punpckl%2%3 m0, m2 +punpckh%2%3 m4, m1, m2 +punpckl%2%3 m1, m2 +psub%3 m0, m1 +psub%3 m3, m4 +%if %0 == 4; 16 bit pabsd m0, m0 pabsd m3, m3 -packusdwm0, m3 %else -punpckhbw m3, m0, m2 -punpcklbw m0, m2 -punpckhbw m4, m1, m2 -punpcklbw m1, m2 -psubw m0, m1 -psubw m3, m4 ABS2m0, m3, m1, m4 -packuswbm0, m3 %endif +packus%3%2 m0, m3 mova [dstq + xq], m0 add xq, mmsize jl .loop @@ -397,7 +391,7 @@ AVERAGE GRAINMERGE HARDMIX PHOENIX phoenix, b -DIFFERENCE difference +DIFFERENCE difference, b, w DIVIDE BLEND_ABS @@ -411,7 +405,7 @@ BLEND_SIMPLE xor_16, xor,1 %endif INIT_XMM ssse3 -DIFFERENCE difference +DIFFERENCE difference, b, w BLEND_ABS INIT_XMM sse4 @@ -419,7 +413,7 @@ INIT_XMM sse4 BLEND_SIMPLE darken_16, minuw, 1 BLEND_SIMPLE lighten_16, maxuw, 1 PHOENIX phoenix_16, w, 1 -DIFFERENCE difference_16, 1 +DIFFERENCE difference_16, w, d, 1 %endif %if HAVE_AVX2_EXTERNAL @@ -439,7 +433,7 @@ GRAINMERGE HARDMIX PHOENIX phoenix, b -DIFFERENCE difference +DIFFERENCE difference, b, w BLEND_ABS %if ARCH_X86_64 @@ -451,6 +445,6 @@ BLEND_SIMPLE or_16, or, 1 BLEND_SIMPLE subtract_16, subusw, 1 BLEND_SIMPLE xor_16, xor,1 PHOENIX phoenix_16, w, 1 -DIFFERENCE difference_16, 1 +DIFFERENCE difference_16, w, d, 1 %endif %endif ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] checkasm/vf_blend : add test for 16 bit version of
ffmpeg | branch: master | Martin Vignali | Sat Mar 17 19:37:46 2018 +0100| [595505083a0211eab97528331125ad28718e8938] | committer: Martin Vignali checkasm/vf_blend : add test for 16 bit version of grainextract grainmerge average extremity negation > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=595505083a0211eab97528331125ad28718e8938 --- tests/checkasm/vf_blend.c | 5 + 1 file changed, 5 insertions(+) diff --git a/tests/checkasm/vf_blend.c b/tests/checkasm/vf_blend.c index 79bdf9f163..912f3a2c38 100644 --- a/tests/checkasm/vf_blend.c +++ b/tests/checkasm/vf_blend.c @@ -124,9 +124,14 @@ void checkasm_check_blend(void) report("8bit"); check_and_report(addition_16, BLEND_ADDITION, 2) +check_and_report(grainmerge_16, BLEND_GRAINMERGE, 2) check_and_report(and_16, BLEND_AND, 2) +check_and_report(average_16, BLEND_AVERAGE, 2) check_and_report(darken_16, BLEND_DARKEN, 2) +check_and_report(grainextract_16, BLEND_GRAINEXTRACT, 2) check_and_report(difference_16, BLEND_DIFFERENCE, 2) +check_and_report(extremity_16, BLEND_EXTREMITY, 2) +check_and_report(negation_16, BLEND_NEGATION, 2) check_and_report(lighten_16, BLEND_LIGHTEN, 2) check_and_report(or_16, BLEND_OR, 2) check_and_report(phoenix_16, BLEND_PHOENIX, 2) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/x86/vf_blend : add SIMD for 16 bit version of
ffmpeg | branch: master | Martin Vignali | Sat Mar 17 19:37:06 2018 +0100| [f3df42e81d367547756e7955e36c8af7c9c18db2] | committer: Martin Vignali avfilter/x86/vf_blend : add SIMD for 16 bit version of grainextract grainmerge average extremity negation > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f3df42e81d367547756e7955e36c8af7c9c18db2 --- libavfilter/x86/vf_blend.asm| 168 ++-- libavfilter/x86/vf_blend_init.c | 20 + 2 files changed, 128 insertions(+), 60 deletions(-) diff --git a/libavfilter/x86/vf_blend.asm b/libavfilter/x86/vf_blend.asm index 9cd5ee7acb..251bbb5a12 100644 --- a/libavfilter/x86/vf_blend.asm +++ b/libavfilter/x86/vf_blend.asm @@ -27,6 +27,8 @@ SECTION_RODATA ps_255: times 4 dd 255.0 +pd_32768 : times 4 dd 32768 +pd_65535 : times 4 dd 65535 pw_1: times 8 dw 1 pw_128: times 8 dw 128 pw_255: times 8 dw 255 @@ -79,26 +81,33 @@ BLEND_INIT %1, 2, %3 BLEND_END %endmacro -%macro GRAINEXTRACT 0 -BLEND_INIT grainextract, 6 +; %1 name , %2 src (b or w), %3 inter (w or d), %4 (1 if 16bit, not set if 8 bit) +%macro GRAINEXTRACT 3-4 +BLEND_INIT %1, 6, %4 pxor m4, m4 +%if %0 == 4 ; 16 bit +VBROADCASTI128 m5, [pd_32768] +%else VBROADCASTI128 m5, [pw_128] +%endif .nextrow: movxq, widthq .loop: movu m1, [topq + xq] movu m3, [bottomq + xq] -punpcklbw m0, m1, m4 -punpckhbw m1, m4 -punpcklbw m2, m3, m4 -punpckhbw m3, m4 -paddw m0, m5 -paddw m1, m5 -psubw m0, m2 -psubw m1, m3 +punpckl%2%3 m0, m1, m4 +punpckh%2%3 m1, m4 +punpckl%2%3 m2, m3, m4 +punpckh%2%3 m3, m4 + +padd%3 m0, m5 +padd%3 m1, m5 +psub%3 m0, m2 +psub%3 m1, m3 + +packus%3%2 m0, m1 -packuswb m0, m1 mova [dstq + xq], m0 addxq, mmsize jl .loop @@ -172,8 +181,9 @@ BLEND_INIT screen, 7 BLEND_END %endmacro -%macro AVERAGE 0 -BLEND_INIT average, 3 +;%1 name, %2 (b or w), %3 (set if 16 bit) +%macro AVERAGE 2-3 +BLEND_INIT %1, 3, %3 pcmpeqbm2, m2 .nextrow: @@ -184,7 +194,7 @@ BLEND_INIT average, 3 movu m1, [bottomq + xq] pxor m0, m2 pxor m1, m2 -pavgb m0, m1 +pavg%2 m0, m1 pxor m0, m2 mova [dstq + xq], m0 addxq, mmsize @@ -192,29 +202,34 @@ BLEND_INIT average, 3 BLEND_END %endmacro - -%macro GRAINMERGE 0 -BLEND_INIT grainmerge, 6 +; %1 name , %2 src (b or w), %3 inter (w or d), %4 (1 if 16bit, not set if 8 bit) +%macro GRAINMERGE 3-4 +BLEND_INIT %1, 6, %4 pxor m4, m4 - +%if %0 == 4 ; 16 bit +VBROADCASTI128 m5, [pd_32768] +%else VBROADCASTI128 m5, [pw_128] +%endif .nextrow: movxq, widthq .loop: movu m1, [topq + xq] movu m3, [bottomq + xq] -punpcklbw m0, m1, m4 -punpckhbw m1, m4 -punpcklbw m2, m3, m4 -punpckhbw m3, m4 -paddw m0, m2 -paddw m1, m3 -psubw m0, m5 -psubw m1, m5 +punpckl%2%3m0, m1, m4 +punpckh%2%3m1, m4 +punpckl%2%3m2, m3, m4 +punpckh%2%3m3, m4 + +padd%3 m0, m2 +padd%3 m1, m3 +psub%3 m0, m5 +psub%3 m1, m5 + +packus%3%2 m0, m1 -packuswb m0, m1 mova [dstq + xq], m0 addxq, mmsize jl .loop @@ -324,52 +339,73 @@ BLEND_INIT %1, 5, %4 BLEND_END %endmacro -%macro BLEND_ABS 0 -BLEND_INIT extremity, 8 +; %1 name , %2 src (b or w), %3 inter (w or d), %4 (1 if 16bit, not set if 8 bit) +%macro EXTREMITY 3-4 +BLEND_INIT %1, 8, %4 pxor m2, m2 +%if %0 == 4; 16 bit +VBROADCASTI128 m4, [pd_65535] +%else VBROADCASTI128 m4, [pw_255] +%endif .nextrow: movxq, widthq .loop: movum0, [topq + xq] movum1, [bottomq + xq] -punpckhbw m5, m0, m2 -punpcklbw m0, m2 -punpckhbw m6, m1, m2 -punpcklbw m1, m2 -psubw m3, m4, m0 -psubw m7, m4, m5 -psubw m3, m1 -psubw m7, m6 +punpckh%2%3 m5, m0, m2 +punpckl%2%3 m0, m2 +punpckh%2%3 m6, m1, m2 +punpckl%2%3 m1, m2 +psub%3 m3, m4, m0 +psub%3 m7, m4, m5 +psub%3 m3, m1 +psub%3 m7, m6 +%if %0 == 4; 16 bit +pabsd m3, m3 +pabsd m7, m7 +%else ABS2m3, m7, m1,
[FFmpeg-cvslog] avfilter/showvolume : move clear picture part to a func
ffmpeg | branch: master | Martin Vignali | Sat Mar 31 15:50:19 2018 +0200| [4152413dde1cf851c4556459e3e1b3a5669f3a5e] | committer: Paul B Mahol avfilter/showvolume : move clear picture part to a func and use it if fade == 0. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4152413dde1cf851c4556459e3e1b3a5669f3a5e --- libavfilter/avf_showvolume.c | 26 -- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c index 267020e163..92dfc24435 100644 --- a/libavfilter/avf_showvolume.c +++ b/libavfilter/avf_showvolume.c @@ -245,13 +245,24 @@ static void drawtext(AVFrame *pic, int x, int y, const char *txt, int o) } } +static void clear_picture(ShowVolumeContext *s, AVFilterLink *outlink) { +int i, j; +const uint32_t bg = (uint32_t)(s->bgopacity * 255) << 24; + +for (i = 0; i < outlink->h; i++) { +uint32_t *dst = (uint32_t *)(s->out->data[0] + i * s->out->linesize[0]); +for (j = 0; j < outlink->w; j++) +AV_WN32A(dst + j, bg); +} +} + static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) { AVFilterContext *ctx = inlink->dst; AVFilterLink *outlink = ctx->outputs[0]; ShowVolumeContext *s = ctx->priv; const int step = s->step; -int c, i, j, k; +int c, j, k; AVFrame *out; if (!s->out || s->out->width != outlink->w || @@ -262,18 +273,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) av_frame_free(&insamples); return AVERROR(ENOMEM); } - -for (i = 0; i < outlink->h; i++) { -uint32_t *dst = (uint32_t *)(s->out->data[0] + i * s->out->linesize[0]); -const uint32_t bg = (uint32_t)(s->bgopacity * 255) << 24; - -for (j = 0; j < outlink->w; j++) -AV_WN32A(dst + j, bg); -} +clear_picture(s, outlink); } s->out->pts = insamples->pts; -if (s->f < 1.) { +if ((s->f < 1.) && (s->f > 0.)) { for (j = 0; j < outlink->h; j++) { uint8_t *dst = s->out->data[0] + j * s->out->linesize[0]; const uint32_t alpha = s->bgopacity * 255; @@ -285,6 +289,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) dst[k * 4 + 3] = FFMAX(dst[k * 4 + 3] * s->f, alpha); } } +} else if (s->f == 0.) { +clear_picture(s, outlink); } if (s->orientation) { /* vertical */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/showvolume : indent after prev commit and add comment
ffmpeg | branch: master | Martin Vignali | Sat Mar 31 15:51:18 2018 +0200| [78b6887da3b926db7df64807ef6f3026136921fc] | committer: Paul B Mahol avfilter/showvolume : indent after prev commit and add comment > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=78b6887da3b926db7df64807ef6f3026136921fc --- libavfilter/avf_showvolume.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c index 4f31cebc7b..7fe3916855 100644 --- a/libavfilter/avf_showvolume.c +++ b/libavfilter/avf_showvolume.c @@ -358,15 +358,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) return AVERROR(ENOMEM); av_frame_make_writable(out); +/* draw volume level */ for (c = 0; c < inlink->channels && s->h >= 8 && s->draw_volume; c++) { char buf[16]; -if (s->orientation) { -snprintf(buf, sizeof(buf), "%.2f", s->values[c * VAR_VARS_NB + VAR_VOLUME]); -drawtext(out, c * (s->h + s->b) + (s->h - 8) / 2, 2, buf, 1); -} else { -snprintf(buf, sizeof(buf), "%.2f", s->values[c * VAR_VARS_NB + VAR_VOLUME]); -drawtext(out, FFMAX(0, s->w - 8 * (int)strlen(buf)), c * (s->h + s->b) + (s->h - 8) / 2, buf, 0); +if (s->orientation) { /* vertical */ +snprintf(buf, sizeof(buf), "%.2f", s->values[c * VAR_VARS_NB + VAR_VOLUME]); +drawtext(out, c * (s->h + s->b) + (s->h - 8) / 2, 2, buf, 1); +} else { /* horizontal */ +snprintf(buf, sizeof(buf), "%.2f", s->values[c * VAR_VARS_NB + VAR_VOLUME]); +drawtext(out, FFMAX(0, s->w - 8 * (int)strlen(buf)), c * (s->h + s->b) + (s->h - 8) / 2, buf, 0); } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/showvolume : move width test for draw volume to the start of the loop
ffmpeg | branch: master | Martin Vignali | Sat Mar 31 15:50:53 2018 +0200| [e4cfb2c669993f01011e940de30e5da11a191b01] | committer: Paul B Mahol avfilter/showvolume : move width test for draw volume to the start of the loop > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e4cfb2c669993f01011e940de30e5da11a191b01 --- libavfilter/avf_showvolume.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c index 92dfc24435..4f31cebc7b 100644 --- a/libavfilter/avf_showvolume.c +++ b/libavfilter/avf_showvolume.c @@ -358,18 +358,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) return AVERROR(ENOMEM); av_frame_make_writable(out); -for (c = 0; c < inlink->channels && s->draw_volume; c++) { +for (c = 0; c < inlink->channels && s->h >= 8 && s->draw_volume; c++) { char buf[16]; if (s->orientation) { -if (s->h >= 8) { snprintf(buf, sizeof(buf), "%.2f", s->values[c * VAR_VARS_NB + VAR_VOLUME]); drawtext(out, c * (s->h + s->b) + (s->h - 8) / 2, 2, buf, 1); -} } else { -if (s->h >= 8) { + snprintf(buf, sizeof(buf), "%.2f", s->values[c * VAR_VARS_NB + VAR_VOLUME]); drawtext(out, FFMAX(0, s->w - 8 * (int)strlen(buf)), c * (s->h + s->b) + (s->h - 8) / 2, buf, 0); -} } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] doc/avfilter/showvolume : fix doc for orientation param
ffmpeg | branch: master | Martin Vignali | Fri Mar 30 22:42:42 2018 +0200| [e8d785035320453b52f915bce083afd4109ab92c] | committer: Paul B Mahol doc/avfilter/showvolume : fix doc for orientation param possible value are h or v. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e8d785035320453b52f915bce083afd4109ab92c --- doc/filters.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 5c119c0151..c05b12849f 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -19961,8 +19961,8 @@ If set, displays channel names. Default is enabled. If set, displays volume values. Default is enabled. @item o -Set orientation, can be @code{horizontal} or @code{vertical}, -default is @code{horizontal}. +Set orientation, can be horizontal: @code{h} or vertical: @code{v}, +default is @code{h}. @item s Set step size, allowed range is [0, 5]. Default is 0, which means ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/showvolume : indent after prev commit
ffmpeg | branch: master | Martin Vignali | Fri Mar 30 21:16:47 2018 +0200| [328df2f71234aa817e2279ec9fdadb81dca0b149] | committer: Paul B Mahol avfilter/showvolume : indent after prev commit > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=328df2f71234aa817e2279ec9fdadb81dca0b149 --- libavfilter/avf_showvolume.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c index db16733202..6c47cce19f 100644 --- a/libavfilter/avf_showvolume.c +++ b/libavfilter/avf_showvolume.c @@ -274,18 +274,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) s->out->pts = insamples->pts; if (s->f < 1.) { -for (j = 0; j < outlink->h; j++) { -uint8_t *dst = s->out->data[0] + j * s->out->linesize[0]; -const uint32_t alpha = s->bgopacity * 255; - -for (k = 0; k < outlink->w; k++) { -dst[k * 4 + 0] = FFMAX(dst[k * 4 + 0] * s->f, 0); -dst[k * 4 + 1] = FFMAX(dst[k * 4 + 1] * s->f, 0); -dst[k * 4 + 2] = FFMAX(dst[k * 4 + 2] * s->f, 0); -dst[k * 4 + 3] = FFMAX(dst[k * 4 + 3] * s->f, alpha); +for (j = 0; j < outlink->h; j++) { +uint8_t *dst = s->out->data[0] + j * s->out->linesize[0]; +const uint32_t alpha = s->bgopacity * 255; + +for (k = 0; k < outlink->w; k++) { +dst[k * 4 + 0] = FFMAX(dst[k * 4 + 0] * s->f, 0); +dst[k * 4 + 1] = FFMAX(dst[k * 4 + 1] * s->f, 0); +dst[k * 4 + 2] = FFMAX(dst[k * 4 + 2] * s->f, 0); +dst[k * 4 + 3] = FFMAX(dst[k * 4 + 3] * s->f, alpha); +} } } -} if (s->orientation) { /* vertical */ for (c = 0; c < inlink->channels; c++) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/showvolume : calculate fade only if fade < 1.
ffmpeg | branch: master | Martin Vignali | Fri Mar 30 21:15:56 2018 +0200| [25b22666a3c05ae15a5d6cc3b0be5c8b034f00f6] | committer: Paul B Mahol avfilter/showvolume : calculate fade only if fade < 1. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=25b22666a3c05ae15a5d6cc3b0be5c8b034f00f6 --- libavfilter/avf_showvolume.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c index ab1fb619b9..db16733202 100644 --- a/libavfilter/avf_showvolume.c +++ b/libavfilter/avf_showvolume.c @@ -273,6 +273,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) } s->out->pts = insamples->pts; +if (s->f < 1.) { for (j = 0; j < outlink->h; j++) { uint8_t *dst = s->out->data[0] + j * s->out->linesize[0]; const uint32_t alpha = s->bgopacity * 255; @@ -284,6 +285,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) dst[k * 4 + 3] = FFMAX(dst[k * 4 + 3] * s->f, alpha); } } +} if (s->orientation) { /* vertical */ for (c = 0; c < inlink->channels; c++) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/showvolume : add comment for orientation condition
ffmpeg | branch: master | Martin Vignali | Fri Mar 30 21:13:27 2018 +0200| [34304677c05be782964b9fb704b13c01e19c9c80] | committer: Paul B Mahol avfilter/showvolume : add comment for orientation condition > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=34304677c05be782964b9fb704b13c01e19c9c80 --- libavfilter/avf_showvolume.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c index af8ac1da6c..ab1fb619b9 100644 --- a/libavfilter/avf_showvolume.c +++ b/libavfilter/avf_showvolume.c @@ -222,7 +222,7 @@ static void drawtext(AVFrame *pic, int x, int y, const char *txt, int o) for (i = 0; txt[i]; i++) { int char_y, mask; -if (o) { +if (o) { /* vertical orientation */ for (char_y = font_height - 1; char_y >= 0; char_y--) { uint8_t *p = pic->data[0] + (y + i * 10) * pic->linesize[0] + x * 4; for (mask = 0x80; mask; mask >>= 1) { @@ -231,7 +231,7 @@ static void drawtext(AVFrame *pic, int x, int y, const char *txt, int o) p += pic->linesize[0]; } } -} else { +} else { /* horizontal orientation */ uint8_t *p = pic->data[0] + y * pic->linesize[0] + (x + i * 8) * 4; for (char_y = 0; char_y < font_height; char_y++) { for (mask = 0x80; mask; mask >>= 1) { @@ -285,7 +285,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) } } -if (s->orientation) { +if (s->orientation) { /* vertical */ for (c = 0; c < inlink->channels; c++) { float *src = (float *)insamples->extended_data[c]; uint32_t *lut = s->color_lut + s->w * c; @@ -313,7 +313,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) drawtext(s->out, c * (s->h + s->b) + (s->h - 10) / 2, outlink->h - 35, channel_name, 1); } } -} else { +} else { /* horizontal */ for (c = 0; c < inlink->channels; c++) { float *src = (float *)insamples->extended_data[c]; uint32_t *lut = s->color_lut + s->w * c; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] checkasm/swscale : add test for rgb shuffle_bytes func
ffmpeg | branch: master | Martin Vignali | Sat Mar 24 20:19:00 2018 +0100| [a9a7ed4f27d036a7719a46f3020a8faac96d0ffb] | committer: Martin Vignali checkasm/swscale : add test for rgb shuffle_bytes func > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a9a7ed4f27d036a7719a46f3020a8faac96d0ffb --- tests/checkasm/Makefile | 6 tests/checkasm/checkasm.c | 3 ++ tests/checkasm/checkasm.h | 1 + tests/checkasm/sw_rgb.c | 85 +++ tests/fate/checkasm.mak | 1 + 5 files changed, 96 insertions(+) diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 0520e264e2..97fbf59636 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -38,6 +38,12 @@ AVFILTEROBJS-$(CONFIG_THRESHOLD_FILTER) += vf_threshold.o CHECKASMOBJS-$(CONFIG_AVFILTER) += $(AVFILTEROBJS-yes) +# swscale tests +SWSCALEOBJS += sw_rgb.o + +CHECKASMOBJS-$(CONFIG_SWSCALE) += $(SWSCALEOBJS) + +# libavutil tests AVUTILOBJS += fixed_dsp.o AVUTILOBJS += float_dsp.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index fe81d139c6..20ce56932f 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -163,6 +163,9 @@ static const struct { { "vf_threshold", checkasm_check_vf_threshold }, #endif #endif +#if CONFIG_SWSCALE +{ "sw_rgb", checkasm_check_sw_rgb }, +#endif #if CONFIG_AVUTIL { "fixed_dsp", checkasm_check_fixed_dsp }, { "float_dsp", checkasm_check_float_dsp }, diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index 8b9d96bc15..dcab74de06 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -65,6 +65,7 @@ void checkasm_check_llviddspenc(void); void checkasm_check_pixblockdsp(void); void checkasm_check_sbrdsp(void); void checkasm_check_synth_filter(void); +void checkasm_check_sw_rgb(void); void checkasm_check_utvideodsp(void); void checkasm_check_v210enc(void); void checkasm_check_vf_hflip(void); diff --git a/tests/checkasm/sw_rgb.c b/tests/checkasm/sw_rgb.c new file mode 100644 index 00..8fc2cfee9e --- /dev/null +++ b/tests/checkasm/sw_rgb.c @@ -0,0 +1,85 @@ +/* + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with FFmpeg; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include + +#include "libavutil/common.h" +#include "libavutil/intreadwrite.h" +#include "libavutil/mem.h" + +#include "libswscale/rgb2rgb.h" + +#include "checkasm.h" + +#define randomize_buffers(buf, size) \ +do { \ +int j;\ +for (j = 0; j < size; j+=4) \ +AV_WN32(buf + j, rnd()); \ +} while (0) + +static const uint8_t width[] = {12, 16, 20, 32, 36, 128}; + +#define MAX_STRIDE 128 + +static void check_shuffle_bytes(void * func, const char * report) +{ +int i; +LOCAL_ALIGNED_32(uint8_t, src0, [MAX_STRIDE]); +LOCAL_ALIGNED_32(uint8_t, src1, [MAX_STRIDE]); +LOCAL_ALIGNED_32(uint8_t, dst0, [MAX_STRIDE]); +LOCAL_ALIGNED_32(uint8_t, dst1, [MAX_STRIDE]); + +declare_func_emms(AV_CPU_FLAG_MMX, void, const uint8_t *src, uint8_t *dst, int src_size); + +memset(dst0, 0, MAX_STRIDE); +memset(dst1, 0, MAX_STRIDE); +randomize_buffers(src0, MAX_STRIDE); +memcpy(src1, src0, MAX_STRIDE); + +if (check_func(func, "%s", report)) { +for (i = 0; i < 6; i ++) { +call_ref(src0, dst0, width[i]); +call_new(src1, dst1, width[i]); +if (memcmp(dst0, dst1, MAX_STRIDE)) +fail(); +} +bench_new(src0, dst0, width[5]); +} +} + +void checkasm_check_sw_rgb(void) +{ +ff_sws_rgb2rgb_init(); + +check_shuffle_bytes(shuffle_bytes_2103, "shuffle_bytes_2103"); +report("shuffle_bytes_2103"); + +check_shuffle_bytes(shuffle_bytes_0321, "shuffle_bytes_0321"); +report("shuffle_bytes_0321"); + +check_shuffle_bytes(shuffle_bytes_1230, "shuffle_bytes_1230"); +report("shuffle_bytes_1230"); + +check_shuffle_bytes(shuffle_bytes_3012, "shuffle_bytes_
[FFmpeg-cvslog] swscale/rgb : add X86 SIMD (SSSE3) for shuffle_bytes_2103 and shuffle_bytes_0321
ffmpeg | branch: master | Martin Vignali | Sat Mar 24 20:16:11 2018 +0100| [923a324174c2d943b8d21d0b77fc0d0c847abca0] | committer: Martin Vignali swscale/rgb : add X86 SIMD (SSSE3) for shuffle_bytes_2103 and shuffle_bytes_0321 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=923a324174c2d943b8d21d0b77fc0d0c847abca0 --- libswscale/x86/Makefile | 1 + libswscale/x86/rgb2rgb.c | 10 +- libswscale/x86/rgb_2_rgb.asm | 80 3 files changed, 90 insertions(+), 1 deletion(-) diff --git a/libswscale/x86/Makefile b/libswscale/x86/Makefile index b50c7f265a..f317d5dd9b 100644 --- a/libswscale/x86/Makefile +++ b/libswscale/x86/Makefile @@ -11,3 +11,4 @@ OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o X86ASM-OBJS += x86/input.o \ x86/output.o \ x86/scale.o \ + x86/rgb_2_rgb.o \ diff --git a/libswscale/x86/rgb2rgb.c b/libswscale/x86/rgb2rgb.c index ffd12e1609..5caabf03ed 100644 --- a/libswscale/x86/rgb2rgb.c +++ b/libswscale/x86/rgb2rgb.c @@ -144,11 +144,14 @@ DECLARE_ALIGNED(8, extern const uint64_t, ff_bgr2UVOffset); #endif /* HAVE_INLINE_ASM */ +void ff_shuffle_bytes_2103_ssse3(const uint8_t *src, uint8_t *dst, int src_size); +void ff_shuffle_bytes_0321_ssse3(const uint8_t *src, uint8_t *dst, int src_size); + av_cold void rgb2rgb_init_x86(void) { -#if HAVE_INLINE_ASM int cpu_flags = av_get_cpu_flags(); +#if HAVE_INLINE_ASM if (INLINE_MMX(cpu_flags)) rgb2rgb_init_mmx(); if (INLINE_AMD3DNOW(cpu_flags)) @@ -160,4 +163,9 @@ av_cold void rgb2rgb_init_x86(void) if (INLINE_AVX(cpu_flags)) rgb2rgb_init_avx(); #endif /* HAVE_INLINE_ASM */ + +if (EXTERNAL_SSSE3(cpu_flags)) { +shuffle_bytes_0321 = ff_shuffle_bytes_0321_ssse3; +shuffle_bytes_2103 = ff_shuffle_bytes_2103_ssse3; +} } diff --git a/libswscale/x86/rgb_2_rgb.asm b/libswscale/x86/rgb_2_rgb.asm new file mode 100644 index 00..e4104d9be2 --- /dev/null +++ b/libswscale/x86/rgb_2_rgb.asm @@ -0,0 +1,80 @@ +;** +;* Copyright Nick Kurshev +;* Copyright Michael (michae...@gmx.at) +;* Copyright 2018 Jokyo Images +;* +;* This file is part of FFmpeg. +;* +;* FFmpeg is free software; you can redistribute it and/or +;* modify it under the terms of the GNU Lesser General Public +;* License as published by the Free Software Foundation; either +;* version 2.1 of the License, or (at your option) any later version. +;* +;* FFmpeg is distributed in the hope that it will be useful, +;* but WITHOUT ANY WARRANTY; without even the implied warranty of +;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;* Lesser General Public License for more details. +;* +;* You should have received a copy of the GNU Lesser General Public +;* License along with FFmpeg; if not, write to the Free Software +;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;** + +%include "libavutil/x86/x86util.asm" + +SECTION_RODATA + +pb_shuffle2103: db 2, 1, 0, 3, 6, 5, 4, 7, 10, 9, 8, 11, 14, 13, 12, 15 +pb_shuffle0321: db 0, 3, 2, 1, 4, 7, 6, 5, 8, 11, 10, 9, 12, 15, 14, 13 + +SECTION .text + +;-- +; shuffle_bytes_## (const uint8_t *src, uint8_t *dst, int src_size) +;-- +; %1-4 index shuffle +%macro SHUFFLE_BYTES 4 +cglobal shuffle_bytes_%1%2%3%4, 3, 5, 2, src, dst, w, tmp, x +VBROADCASTI128m0, [pb_shuffle%1%2%3%4] +movsxdifnidn wq, wd +mov xq, wq + +addsrcq, wq +adddstq, wq +neg wq + +;calc scalar loop +and xq, mmsize-4 +je .loop_simd + +.loop_scalar: + mov tmpb, [srcq + wq + %1] + mov [dstq+wq + 0], tmpb + mov tmpb, [srcq + wq + %2] + mov [dstq+wq + 1], tmpb + mov tmpb, [srcq + wq + %3] + mov [dstq+wq + 2], tmpb + mov tmpb, [srcq + wq + %4] + mov [dstq+wq + 3], tmpb + addwq, 4 + subxq, 4 + jg .loop_scalar + +;check if src_size < mmsize +cmp wq, 0 +jge .end + +.loop_simd: +movu m1, [srcq+wq] +pshufb m1, m0 +movu[dstq+wq], m1 +addwq, mmsize +jl .loop_simd + +.end: +RET +%endmacro + +INIT_XMM ssse3 +SHUFFLE_BYTES 2, 1, 0, 3 +SHUFFLE_BYTES 0, 3, 2, 1 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale/rgb : add X86 SIMD (SSSE3), for shuffle_bytes_1230, shuffle_bytes_3012, shuffle_bytes_3210
ffmpeg | branch: master | Martin Vignali | Sat Mar 24 20:18:05 2018 +0100| [1ba5ca2d721ebb8b80cd3c389854905e59fc7dfd] | committer: Martin Vignali swscale/rgb : add X86 SIMD (SSSE3), for shuffle_bytes_1230, shuffle_bytes_3012, shuffle_bytes_3210 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1ba5ca2d721ebb8b80cd3c389854905e59fc7dfd --- libswscale/x86/rgb2rgb.c | 6 ++ libswscale/x86/rgb_2_rgb.asm | 6 ++ 2 files changed, 12 insertions(+) diff --git a/libswscale/x86/rgb2rgb.c b/libswscale/x86/rgb2rgb.c index 5caabf03ed..e5f318a72c 100644 --- a/libswscale/x86/rgb2rgb.c +++ b/libswscale/x86/rgb2rgb.c @@ -146,6 +146,9 @@ DECLARE_ALIGNED(8, extern const uint64_t, ff_bgr2UVOffset); void ff_shuffle_bytes_2103_ssse3(const uint8_t *src, uint8_t *dst, int src_size); void ff_shuffle_bytes_0321_ssse3(const uint8_t *src, uint8_t *dst, int src_size); +void ff_shuffle_bytes_1230_ssse3(const uint8_t *src, uint8_t *dst, int src_size); +void ff_shuffle_bytes_3012_ssse3(const uint8_t *src, uint8_t *dst, int src_size); +void ff_shuffle_bytes_3210_ssse3(const uint8_t *src, uint8_t *dst, int src_size); av_cold void rgb2rgb_init_x86(void) { @@ -167,5 +170,8 @@ av_cold void rgb2rgb_init_x86(void) if (EXTERNAL_SSSE3(cpu_flags)) { shuffle_bytes_0321 = ff_shuffle_bytes_0321_ssse3; shuffle_bytes_2103 = ff_shuffle_bytes_2103_ssse3; +shuffle_bytes_1230 = ff_shuffle_bytes_1230_ssse3; +shuffle_bytes_3012 = ff_shuffle_bytes_3012_ssse3; +shuffle_bytes_3210 = ff_shuffle_bytes_3210_ssse3; } } diff --git a/libswscale/x86/rgb_2_rgb.asm b/libswscale/x86/rgb_2_rgb.asm index e4104d9be2..db45e313d8 100644 --- a/libswscale/x86/rgb_2_rgb.asm +++ b/libswscale/x86/rgb_2_rgb.asm @@ -26,6 +26,9 @@ SECTION_RODATA pb_shuffle2103: db 2, 1, 0, 3, 6, 5, 4, 7, 10, 9, 8, 11, 14, 13, 12, 15 pb_shuffle0321: db 0, 3, 2, 1, 4, 7, 6, 5, 8, 11, 10, 9, 12, 15, 14, 13 +pb_shuffle1230: db 1, 2, 3, 0, 5, 6, 7, 4, 9, 10, 11, 8, 13, 14, 15, 12 +pb_shuffle3012: db 3, 0, 1, 2, 7, 4, 5, 6, 11, 8, 9, 10, 15, 12, 13, 14 +pb_shuffle3210: db 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 SECTION .text @@ -78,3 +81,6 @@ jge .end INIT_XMM ssse3 SHUFFLE_BYTES 2, 1, 0, 3 SHUFFLE_BYTES 0, 3, 2, 1 +SHUFFLE_BYTES 1, 2, 3, 0 +SHUFFLE_BYTES 3, 0, 1, 2 +SHUFFLE_BYTES 3, 2, 1, 0 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale/rgb2rgb : cosmetic, move shuffle_bytes func declaration
ffmpeg | branch: master | Martin Vignali | Sat Mar 24 20:20:04 2018 +0100| [5f6126ea7f31db38a796ea5533a06b6526e13ecf] | committer: Martin Vignali swscale/rgb2rgb : cosmetic, move shuffle_bytes func declaration move shuffle_bytes_1230, 3012, 3210 with the other shuffle_byte declaration > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5f6126ea7f31db38a796ea5533a06b6526e13ecf --- libswscale/rgb2rgb.h | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libswscale/rgb2rgb.h b/libswscale/rgb2rgb.h index 08de546598..3569254df9 100644 --- a/libswscale/rgb2rgb.h +++ b/libswscale/rgb2rgb.h @@ -52,6 +52,9 @@ extern void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, int src_size); extern void (*shuffle_bytes_0321)(const uint8_t *src, uint8_t *dst, int src_size); extern void (*shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int src_size); +extern void (*shuffle_bytes_1230)(const uint8_t *src, uint8_t *dst, int src_size); +extern void (*shuffle_bytes_3012)(const uint8_t *src, uint8_t *dst, int src_size); +extern void (*shuffle_bytes_3210)(const uint8_t *src, uint8_t *dst, int src_size); void rgb64tobgr48_nobswap(const uint8_t *src, uint8_t *dst, int src_size); void rgb64tobgr48_bswap(const uint8_t *src, uint8_t *dst, int src_size); @@ -76,10 +79,6 @@ void rgb15tobgr15(const uint8_t *src, uint8_t *dst, int src_size); void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size); voidrgb12to15(const uint8_t *src, uint8_t *dst, int src_size); -extern void (*shuffle_bytes_1230)(const uint8_t *src, uint8_t *dst, int src_size); -extern void (*shuffle_bytes_3012)(const uint8_t *src, uint8_t *dst, int src_size); -extern void (*shuffle_bytes_3210)(const uint8_t *src, uint8_t *dst, int src_size); - void ff_rgb24toyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, int width, int height, int lumStride, int chromStride, int srcStride, int32_t *rgb2yuv); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale/rgb : move shuffle func shuffle_bytes_1230, shuffle_bytes_3012, shuffle_bytes_3210 in order to add SIMD
ffmpeg | branch: master | Martin Vignali | Sat Mar 24 20:17:32 2018 +0100| [d4f6640855faf57da1ccc3cade356975fcb00207] | committer: Martin Vignali swscale/rgb : move shuffle func shuffle_bytes_1230, shuffle_bytes_3012, shuffle_bytes_3210 in order to add SIMD > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d4f6640855faf57da1ccc3cade356975fcb00207 --- libswscale/rgb2rgb.c | 23 --- libswscale/rgb2rgb.h | 6 +++--- libswscale/rgb2rgb_template.c | 21 + 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c index 04b7908b5e..eab8e6aebb 100644 --- a/libswscale/rgb2rgb.c +++ b/libswscale/rgb2rgb.c @@ -53,6 +53,10 @@ void (*rgb15to32)(const uint8_t *src, uint8_t *dst, int src_size); void (*shuffle_bytes_0321)(const uint8_t *src, uint8_t *dst, int src_size); void (*shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int src_size); +void (*shuffle_bytes_1230)(const uint8_t *src, uint8_t *dst, int src_size); +void (*shuffle_bytes_3012)(const uint8_t *src, uint8_t *dst, int src_size); +void (*shuffle_bytes_3210)(const uint8_t *src, uint8_t *dst, int src_size); + void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, @@ -319,25 +323,6 @@ void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size) } } - -#define DEFINE_SHUFFLE_BYTES(a, b, c, d)\ -void shuffle_bytes_ ## a ## b ## c ## d(const uint8_t *src, \ -uint8_t *dst, int src_size) \ -{ \ -int i; \ -\ -for (i = 0; i < src_size; i += 4) { \ -dst[i + 0] = src[i + a];\ -dst[i + 1] = src[i + b];\ -dst[i + 2] = src[i + c];\ -dst[i + 3] = src[i + d];\ -} \ -} - -DEFINE_SHUFFLE_BYTES(1, 2, 3, 0) -DEFINE_SHUFFLE_BYTES(3, 0, 1, 2) -DEFINE_SHUFFLE_BYTES(3, 2, 1, 0) - #define DEFINE_RGB48TOBGR48(need_bswap, swap) \ void rgb48tobgr48_ ## need_bswap(const uint8_t *src,\ uint8_t *dst, int src_size)\ diff --git a/libswscale/rgb2rgb.h b/libswscale/rgb2rgb.h index 6994839299..08de546598 100644 --- a/libswscale/rgb2rgb.h +++ b/libswscale/rgb2rgb.h @@ -76,9 +76,9 @@ void rgb15tobgr15(const uint8_t *src, uint8_t *dst, int src_size); void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size); voidrgb12to15(const uint8_t *src, uint8_t *dst, int src_size); -void shuffle_bytes_1230(const uint8_t *src, uint8_t *dst, int src_size); -void shuffle_bytes_3012(const uint8_t *src, uint8_t *dst, int src_size); -void shuffle_bytes_3210(const uint8_t *src, uint8_t *dst, int src_size); +extern void (*shuffle_bytes_1230)(const uint8_t *src, uint8_t *dst, int src_size); +extern void (*shuffle_bytes_3012)(const uint8_t *src, uint8_t *dst, int src_size); +extern void (*shuffle_bytes_3210)(const uint8_t *src, uint8_t *dst, int src_size); void ff_rgb24toyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, int width, int height, int lumStride, diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c index 499d25b26d..fb7d663ccc 100644 --- a/libswscale/rgb2rgb_template.c +++ b/libswscale/rgb2rgb_template.c @@ -342,6 +342,24 @@ static inline void shuffle_bytes_0321_c(const uint8_t *src, uint8_t *dst, } } +#define DEFINE_SHUFFLE_BYTES(name, a, b, c, d) \ +static void shuffle_bytes_##name (const uint8_t *src, \ +uint8_t *dst, int src_size) \ +{ \ +int i; \ +\ +for (i = 0; i < src_size; i += 4) { \ +dst[i + 0] = src[i + a];\ +dst[i + 1] = src[i + b];\ +dst[i + 2] = src[i + c];\ +dst[i + 3] = src[i + d];\ +} \ +} + +DEFINE_SHUFFLE_BYTES(1230_c, 1, 2, 3, 0) +DEFINE_SHUFFLE_BYTES(3012_c, 3, 0, 1, 2) +DEFINE_SHUFFLE_BYTES(3210_c, 3, 2, 1, 0)
[FFmpeg-cvslog] avfilter/vf_premultiply : fix unpremultiply_offset for rgb input
ffmpeg | branch: master | Martin Vignali | Sat Mar 17 22:20:34 2018 +0100| [3e7fa34d3b688b9b4b5b22344e8fc27c4b53286d] | committer: Martin Vignali avfilter/vf_premultiply : fix unpremultiply_offset for rgb input > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3e7fa34d3b688b9b4b5b22344e8fc27c4b53286d --- libavfilter/vf_premultiply.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c index df4f26578d..4f250df3f4 100644 --- a/libavfilter/vf_premultiply.c +++ b/libavfilter/vf_premultiply.c @@ -272,7 +272,7 @@ static void unpremultiply8offset(const uint8_t *msrc, const uint8_t *asrc, for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { if (asrc[x] > 0 && asrc[x] < 255) -dst[x] = FFMIN((msrc[x] - offset) * 255 / asrc[x] + offset, 255); +dst[x] = FFMIN(FFMAX(msrc[x] - offset, 0) * 255 / asrc[x] + offset, 255); else dst[x] = msrc[x]; } @@ -350,7 +350,7 @@ static void unpremultiply16offset(const uint8_t *mmsrc, const uint8_t *aasrc, for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { if (asrc[x] > 0 && asrc[x] < max) -dst[x] = FFMAX(FFMIN((msrc[x] - offset) * (unsigned)max / asrc[x] + offset, max), 0); +dst[x] = FFMAX(FFMIN(FFMAX(msrc[x] - offset, 0) * (unsigned)max / asrc[x] + offset, max), 0); else dst[x] = msrc[x]; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] fate/hapqa_extract : add test for hapqa_extract bsf
ffmpeg | branch: master | Martin Vignali | Sat Mar 17 21:07:17 2018 +0100| [b2bb1cb68be2627f4873ae1203197e1fca768650] | committer: Martin Vignali fate/hapqa_extract : add test for hapqa_extract bsf test extract color and alpha with the three main kind of hap frame : - no snappy compression - snappy compression and one chunk - snappy compression and several chunks (16 here) like the bsf filter need to be used with vtag and encoder edition also test the information of the target mov for color and alpha > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b2bb1cb68be2627f4873ae1203197e1fca768650 --- tests/fate/hap.mak | 43 + .../hapqa-extract-nosnappy-to-hapalphaonly-mov | 73 ++ tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 73 ++ .../ref/fate/hapqa-extract-snappy1-to-hapalphaonly | 6 ++ tests/ref/fate/hapqa-extract-snappy1-to-hapq | 6 ++ .../fate/hapqa-extract-snappy16-to-hapalphaonly| 6 ++ tests/ref/fate/hapqa-extract-snappy16-to-hapq | 6 ++ 7 files changed, 213 insertions(+) diff --git a/tests/fate/hap.mak b/tests/fate/hap.mak index 51673366f2..075a602e45 100644 --- a/tests/fate/hap.mak +++ b/tests/fate/hap.mak @@ -29,6 +29,49 @@ FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, HAP) += $(FATE_HAP) fate-hap: $(FATE_HAP) +#Test bsf conversion +FATE_HAPQA_EXTRACT_BSF += fate-hapqa-extract-snappy1-to-hapq +fate-hapqa-extract-snappy1-to-hapq: CMD = framecrc -i $(TARGET_SAMPLES)/hap/HAPQA_Snappy_1chunk_127x1.mov -c:v copy -bsf:v hapqa_extract=texture=color -tag:v HapY -metadata:s:v:0 encoder="HAPQ" + +FATE_HAPQA_EXTRACT_BSF += fate-hapqa-extract-snappy16-to-hapq +fate-hapqa-extract-snappy16-to-hapq: CMD = framecrc -i $(TARGET_SAMPLES)/hap/HAPQA_Snappy_16chunk_127x1.mov -c:v copy -bsf:v hapqa_extract=texture=color -tag:v HapY -metadata:s:v:0 encoder="HAPQ" + +FATE_HAPQA_EXTRACT_BSF += fate-hapqa-extract-snappy1-to-hapalphaonly +fate-hapqa-extract-snappy1-to-hapalphaonly: CMD = framecrc -i $(TARGET_SAMPLES)/hap/HAPQA_Snappy_1chunk_127x1.mov -c:v copy -bsf:v hapqa_extract=texture=alpha -tag:v HapA -metadata:s:v:0 encoder="HAPAlphaOnly" + +FATE_HAPQA_EXTRACT_BSF += fate-hapqa-extract-snappy16-to-hapalphaonly +fate-hapqa-extract-snappy16-to-hapalphaonly: CMD = framecrc -i $(TARGET_SAMPLES)/hap/HAPQA_Snappy_16chunk_127x1.mov -c:v copy -bsf:v hapqa_extract=texture=alpha -tag:v HapA -metadata:s:v:0 encoder="HAPAlphaOnly" + + +#Test bsf conversion and mov +tests/data/hapq_nosnappy.mov: TAG = GEN +tests/data/hapq_nosnappy.mov: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data + $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \ + -i $(TARGET_SAMPLES)/hap/HAPQA_NoSnappy_127x1.mov -nostdin -c:v copy -bsf:v hapqa_extract=texture=color \ +-tag:v HapY -metadata:s:v:0 encoder="HAPQ" $(TARGET_PATH)/$@ -y 2>/dev/null + +tests/data/hapalphaonly_nosnappy.mov: TAG = GEN +tests/data/hapalphaonly_nosnappy.mov: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data + $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \ + -i $(TARGET_SAMPLES)/hap/HAPQA_NoSnappy_127x1.mov -nostdin -c:v copy -bsf:v hapqa_extract=texture=alpha \ +-tag:v HapA -metadata:s:v:0 encoder="HAPAlpha Only" $(TARGET_PATH)/$@ -y 2>/dev/null + + +FATE_HAPQA_EXTRACT_BSF_FFPROBE += fate-hapqa-extract-nosnappy-to-hapq-mov +fate-hapqa-extract-nosnappy-to-hapq-mov: tests/data/hapq_nosnappy.mov +fate-hapqa-extract-nosnappy-to-hapq-mov: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_packets -show_data_hash adler32 -show_streams -select_streams v -v 0 $(TARGET_PATH)/tests/data/hapq_nosnappy.mov + +FATE_HAPQA_EXTRACT_BSF_FFPROBE += fate-hapqa-extract-nosnappy-to-hapalphaonly-mov +fate-hapqa-extract-nosnappy-to-hapalphaonly-mov: tests/data/hapalphaonly_nosnappy.mov +fate-hapqa-extract-nosnappy-to-hapalphaonly-mov: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_packets -show_data_hash adler32 -show_streams -select_streams v -v 0 $(TARGET_PATH)/tests/data/hapalphaonly_nosnappy.mov + + +FATE_SAMPLES_FFMPEG-$(call ALLYES, MOV_DEMUXER HAPQA_EXTRACT_BSF MOV_MUXER) += $(FATE_HAPQA_EXTRACT_BSF) +FATE_SAMPLES_FFPROBE += $(FATE_HAPQA_EXTRACT_BSF_FFPROBE) + +fate-hapqa-extract-bsf: $(FATE_HAPQA_EXTRACT_BSF) $(FATE_HAPQA_EXTRACT_BSF_FFPROBE) + + fate-hapenc%: CMD = framemd5 -f image2 -c:v pgmyuv -i $(TARGET_PATH)/tests/vsynth1/%02d.pgm -sws_flags +accurate_rnd+bitexact -vframes 5 -c:v hap ${OPTS} FATE_HAPENC += fate-hapenc-hap-none diff --git a/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov b/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov new file mode 100644 index 00..f5ecdd4311 --- /dev/null +++ b/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov @@ -0,0 +1,73 @@ +[PACKET] +codec_type=video +stream_index=0 +pts=0 +pts_time=0.00 +dts=0 +dts_time=0.00 +duration=512 +duration_time=0.04 +convergence_duration=N/A +convergence
[FFmpeg-cvslog] fate/hapenc : remove test which use libsnappy
ffmpeg | branch: master | Martin Vignali | Wed Mar 14 07:26:43 2018 +0100| [32dbee4462a06a7c82fd1719d044dde2e9b013e7] | committer: Martin Vignali fate/hapenc : remove test which use libsnappy the test in none mode can be let (they don't use libsnappy) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=32dbee4462a06a7c82fd1719d044dde2e9b013e7 --- tests/fate/hap.mak | 21 - tests/ref/fate/hapenc-hap-snappy1 | 14 -- tests/ref/fate/hapenc-hap-snappy16 | 14 -- tests/ref/fate/hapenc-hapa-snappy1 | 14 -- tests/ref/fate/hapenc-hapa-snappy16 | 14 -- tests/ref/fate/hapenc-hapq-snappy1 | 14 -- tests/ref/fate/hapenc-hapq-snappy16 | 14 -- 7 files changed, 105 deletions(-) diff --git a/tests/fate/hap.mak b/tests/fate/hap.mak index 98a85806d7..51673366f2 100644 --- a/tests/fate/hap.mak +++ b/tests/fate/hap.mak @@ -34,33 +34,12 @@ fate-hapenc%: CMD = framemd5 -f image2 -c:v pgmyuv -i $(TARGET_PATH)/tests/vsynt FATE_HAPENC += fate-hapenc-hap-none fate-hapenc-hap-none: OPTS = -pix_fmt rgba -format hap -compressor none -FATE_HAPENC += fate-hapenc-hap-snappy1 -fate-hapenc-hap-snappy1: OPTS = -pix_fmt rgba -format hap -compressor snappy -chunks 1 - -FATE_HAPENC += fate-hapenc-hap-snappy16 -fate-hapenc-hap-snappy16: OPTS = -pix_fmt rgba -format hap -compressor snappy -chunks 16 - - FATE_HAPENC += fate-hapenc-hapa-none fate-hapenc-hapa-none: OPTS = -pix_fmt rgba -format hap_alpha -compressor none -FATE_HAPENC += fate-hapenc-hapa-snappy1 -fate-hapenc-hapa-snappy1: OPTS = -pix_fmt rgba -format hap_alpha -compressor snappy -chunks 1 - -FATE_HAPENC += fate-hapenc-hapa-snappy16 -fate-hapenc-hapa-snappy16: OPTS = -pix_fmt rgba -format hap_alpha -compressor snappy -chunks 16 - - FATE_HAPENC += fate-hapenc-hapq-none fate-hapenc-hapq-none: OPTS = -pix_fmt rgba -format hap_q -compressor none -FATE_HAPENC += fate-hapenc-hapq-snappy1 -fate-hapenc-hapq-snappy1: OPTS = -pix_fmt rgba -format hap_q -compressor snappy -chunks 1 - -FATE_HAPENC += fate-hapenc-hapq-snappy16 -fate-hapenc-hapq-snappy16: OPTS = -pix_fmt rgba -format hap_q -compressor snappy -chunks 16 - - $(FATE_HAPENC): $(VREF) FATE_AVCONV-$(call ENCMUX, HAP, MOV) += $(FATE_HAPENC) diff --git a/tests/ref/fate/hapenc-hap-snappy1 b/tests/ref/fate/hapenc-hap-snappy1 deleted file mode 100644 index 53b5c7d626..00 --- a/tests/ref/fate/hapenc-hap-snappy1 +++ /dev/null @@ -1,14 +0,0 @@ -#format: frame checksums -#version: 2 -#hash: MD5 -#tb 0: 1/25 -#media_type 0: video -#codec_id 0: hap -#dimensions 0: 352x288 -#sar 0: 0/1 -#stream#, dts,pts, duration, size, hash -0, 0, 0,1,38199, e9a458a776d7f32d5d01ba9d2a1e9242 -0, 1, 1,1,38475, 0f134741aaf9532629c6163c90e5d779 -0, 2, 2,1,39157, 39c2b6b8c308af8e5d6a9eef92e8e8dc -0, 3, 3,1,38674, 7cc1dfb3cb636181237a7ecd67d17614 -0, 4, 4,1,38360, 05d0bcfa66349e41db6e42134cc47121 diff --git a/tests/ref/fate/hapenc-hap-snappy16 b/tests/ref/fate/hapenc-hap-snappy16 deleted file mode 100644 index ab0771bf61..00 --- a/tests/ref/fate/hapenc-hap-snappy16 +++ /dev/null @@ -1,14 +0,0 @@ -#format: frame checksums -#version: 2 -#hash: MD5 -#tb 0: 1/25 -#media_type 0: video -#codec_id 0: hap -#dimensions 0: 352x288 -#sar 0: 0/1 -#stream#, dts,pts, duration, size, hash -0, 0, 0,1,42239, ad3bdee68ffa054fa2bdd3fbc083e39c -0, 1, 1,1,42268, 5b96644be5f424bc04e5695f58f6c238 -0, 2, 2,1,42703, 6d6ea64b8808625638bb5e3e065042c1 -0, 3, 3,1,42170, 307615782d52350c1379caefc79123ab -0, 4, 4,1,42005, 5dfcc935564600944eb7b8a3a82fb569 diff --git a/tests/ref/fate/hapenc-hapa-snappy1 b/tests/ref/fate/hapenc-hapa-snappy1 deleted file mode 100644 index add69139fa..00 --- a/tests/ref/fate/hapenc-hapa-snappy1 +++ /dev/null @@ -1,14 +0,0 @@ -#format: frame checksums -#version: 2 -#hash: MD5 -#tb 0: 1/25 -#media_type 0: video -#codec_id 0: hap -#dimensions 0: 352x288 -#sar 0: 0/1 -#stream#, dts,pts, duration, size, hash -0, 0, 0,1,47912, ac94f44194b154b15b7008ef38ae2343 -0, 1, 1,1,48244, 21bff8df4137fdde2c836ea4c5aa10e0 -0, 2, 2,1,49175, 4a6053f4f81259ad201d10ac83e47524 -0, 3, 3,1,48159, 90df8d03d9d7bc99a22e439e4d79e9fc -0, 4, 4,1,47932, 8e719e872130057df3d3580f62693733 diff --git a/tests/ref/fate/hapenc-hapa-snappy16 b/tests/ref/fate/hapenc-hapa-snappy16 deleted file mode 100644 index 08613c011a..00 --- a/tests/ref/fate/hapenc-hapa-snappy16 +++ /dev/null @@ -1,14 +0,0 @@ -#format: frame checksums -#version: 2 -#h
[FFmpeg-cvslog] fate/hap : move decoding test to a separate file
ffmpeg | branch: master | Martin Vignali | Sun Mar 11 19:22:54 2018 +0100| [414c0e27a981f0fdcb91cc4856fc0ce81d2da877] | committer: Martin Vignali fate/hap : move decoding test to a separate file > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=414c0e27a981f0fdcb91cc4856fc0ce81d2da877 --- tests/Makefile | 1 + tests/fate/hap.mak | 29 + tests/fate/video.mak | 30 -- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index f1ac610454..6074ac748e 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -129,6 +129,7 @@ include $(SRC_PATH)/tests/fate/flvenc.mak include $(SRC_PATH)/tests/fate/gapless.mak include $(SRC_PATH)/tests/fate/gif.mak include $(SRC_PATH)/tests/fate/h264.mak +include $(SRC_PATH)/tests/fate/hap.mak include $(SRC_PATH)/tests/fate/hevc.mak include $(SRC_PATH)/tests/fate/id3v2.mak include $(SRC_PATH)/tests/fate/image.mak diff --git a/tests/fate/hap.mak b/tests/fate/hap.mak new file mode 100644 index 00..b48123a3cd --- /dev/null +++ b/tests/fate/hap.mak @@ -0,0 +1,29 @@ +FATE_HAP += fate-hap1 +fate-hap1: CMD = framecrc -i $(TARGET_SAMPLES)/hap/hap1.mov + +FATE_HAP += fate-hap5 +fate-hap5: CMD = framecrc -i $(TARGET_SAMPLES)/hap/hap5.mov + +FATE_HAP += fate-hapy +fate-hapy: CMD = framecrc -i $(TARGET_SAMPLES)/hap/hapy.mov + +FATE_HAP += fate-hap-chunk +fate-hap-chunk: CMD = framecrc -i $(TARGET_SAMPLES)/hap/hapy-12-chunks.mov + +FATE_HAP += fate-hapqa-nosnappy-127x71 +fate-hapqa-nosnappy-127x71: CMD = framecrc -i $(TARGET_SAMPLES)/hap/HAPQA_NoSnappy_127x1.mov + +FATE_HAP += fate-hapqa-snappy1-127x71 +fate-hapqa-snappy1-127x71: CMD = framecrc -i $(TARGET_SAMPLES)/hap/HAPQA_Snappy_1chunk_127x1.mov + +FATE_HAP += fate-hapqa-snappy16-127x71 +fate-hapqa-snappy16-127x71: CMD = framecrc -i $(TARGET_SAMPLES)/hap/HAPQA_Snappy_16chunk_127x1.mov + +FATE_HAP += fate-hap-alpha-only-nosnappy-128x72 +fate-hap-alpha-only-nosnappy-128x72: CMD = framecrc -i $(TARGET_SAMPLES)/hap/HapAlphaOnly_NoSnappy_128x72.mov -pix_fmt gray8 + +FATE_HAP += fate-hap-alpha-only-snappy-127x71 +fate-hap-alpha-only-snappy-127x71: CMD = framecrc -i $(TARGET_SAMPLES)/hap/HapAlphaOnly_snappy1chunk_127x71.mov -pix_fmt gray8 + +FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, HAP) += $(FATE_HAP) +fate-hap: $(FATE_HAP) diff --git a/tests/fate/video.mak b/tests/fate/video.mak index e7817d3d13..43c3432c95 100644 --- a/tests/fate/video.mak +++ b/tests/fate/video.mak @@ -171,36 +171,6 @@ fate-id-cin-video: CMD = framecrc -i $(TARGET_SAMPLES)/idcin/idlog-2MB.cin -pix_ FATE_VIDEO-$(call ENCDEC, ROQ PGMYUV, ROQ IMAGE2) += fate-idroq-video-encode fate-idroq-video-encode: CMD = md5 -f image2 -c:v pgmyuv -i $(TARGET_SAMPLES)/ffmpeg-synthetic/vsynth1/%02d.pgm -r 30 -sws_flags +bitexact -vf pad=512:512:80:112 -f roq -t 0.2 -FATE_HAP += fate-hap1 -fate-hap1: CMD = framecrc -i $(TARGET_SAMPLES)/hap/hap1.mov - -FATE_HAP += fate-hap5 -fate-hap5: CMD = framecrc -i $(TARGET_SAMPLES)/hap/hap5.mov - -FATE_HAP += fate-hapy -fate-hapy: CMD = framecrc -i $(TARGET_SAMPLES)/hap/hapy.mov - -FATE_HAP += fate-hap-chunk -fate-hap-chunk: CMD = framecrc -i $(TARGET_SAMPLES)/hap/hapy-12-chunks.mov - -FATE_HAP += fate-hapqa-nosnappy-127x71 -fate-hapqa-nosnappy-127x71: CMD = framecrc -i $(TARGET_SAMPLES)/hap/HAPQA_NoSnappy_127x1.mov - -FATE_HAP += fate-hapqa-snappy1-127x71 -fate-hapqa-snappy1-127x71: CMD = framecrc -i $(TARGET_SAMPLES)/hap/HAPQA_Snappy_1chunk_127x1.mov - -FATE_HAP += fate-hapqa-snappy16-127x71 -fate-hapqa-snappy16-127x71: CMD = framecrc -i $(TARGET_SAMPLES)/hap/HAPQA_Snappy_16chunk_127x1.mov - -FATE_HAP += fate-hap-alpha-only-nosnappy-128x72 -fate-hap-alpha-only-nosnappy-128x72: CMD = framecrc -i $(TARGET_SAMPLES)/hap/HapAlphaOnly_NoSnappy_128x72.mov -pix_fmt gray8 - -FATE_HAP += fate-hap-alpha-only-snappy-127x71 -fate-hap-alpha-only-snappy-127x71: CMD = framecrc -i $(TARGET_SAMPLES)/hap/HapAlphaOnly_snappy1chunk_127x71.mov -pix_fmt gray8 - -FATE_VIDEO-$(call DEMDEC, MOV, HAP) += $(FATE_HAP) -fate-hap: $(FATE_HAP) - FATE_IFF-$(CONFIG_IFF_ILBM_DECODER) += fate-iff-byterun1 fate-iff-byterun1: CMD = framecrc -i $(TARGET_SAMPLES)/iff/ASH.LBM -pix_fmt rgb24 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] fate/hap : add test for hap encoding
ffmpeg | branch: master | Martin Vignali | Sun Mar 11 19:34:54 2018 +0100| [f56ee7403384a7aae0f5ee5aa76da0dedfdd7c35] | committer: Martin Vignali fate/hap : add test for hap encoding with and without snappy compression with chunk 1 or chunk 16 for hap, hapa, and hapq > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f56ee7403384a7aae0f5ee5aa76da0dedfdd7c35 --- tests/fate/hap.mak | 38 + tests/ref/fate/hapenc-hap-none | 14 ++ tests/ref/fate/hapenc-hap-snappy1 | 14 ++ tests/ref/fate/hapenc-hap-snappy16 | 14 ++ tests/ref/fate/hapenc-hapa-none | 14 ++ tests/ref/fate/hapenc-hapa-snappy1 | 14 ++ tests/ref/fate/hapenc-hapa-snappy16 | 14 ++ tests/ref/fate/hapenc-hapq-none | 14 ++ tests/ref/fate/hapenc-hapq-snappy1 | 14 ++ tests/ref/fate/hapenc-hapq-snappy16 | 14 ++ 10 files changed, 164 insertions(+) diff --git a/tests/fate/hap.mak b/tests/fate/hap.mak index b48123a3cd..98a85806d7 100644 --- a/tests/fate/hap.mak +++ b/tests/fate/hap.mak @@ -27,3 +27,41 @@ fate-hap-alpha-only-snappy-127x71: CMD = framecrc -i $(TARGET_SAMPLES)/hap/HapAl FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, HAP) += $(FATE_HAP) fate-hap: $(FATE_HAP) + + +fate-hapenc%: CMD = framemd5 -f image2 -c:v pgmyuv -i $(TARGET_PATH)/tests/vsynth1/%02d.pgm -sws_flags +accurate_rnd+bitexact -vframes 5 -c:v hap ${OPTS} + +FATE_HAPENC += fate-hapenc-hap-none +fate-hapenc-hap-none: OPTS = -pix_fmt rgba -format hap -compressor none + +FATE_HAPENC += fate-hapenc-hap-snappy1 +fate-hapenc-hap-snappy1: OPTS = -pix_fmt rgba -format hap -compressor snappy -chunks 1 + +FATE_HAPENC += fate-hapenc-hap-snappy16 +fate-hapenc-hap-snappy16: OPTS = -pix_fmt rgba -format hap -compressor snappy -chunks 16 + + +FATE_HAPENC += fate-hapenc-hapa-none +fate-hapenc-hapa-none: OPTS = -pix_fmt rgba -format hap_alpha -compressor none + +FATE_HAPENC += fate-hapenc-hapa-snappy1 +fate-hapenc-hapa-snappy1: OPTS = -pix_fmt rgba -format hap_alpha -compressor snappy -chunks 1 + +FATE_HAPENC += fate-hapenc-hapa-snappy16 +fate-hapenc-hapa-snappy16: OPTS = -pix_fmt rgba -format hap_alpha -compressor snappy -chunks 16 + + +FATE_HAPENC += fate-hapenc-hapq-none +fate-hapenc-hapq-none: OPTS = -pix_fmt rgba -format hap_q -compressor none + +FATE_HAPENC += fate-hapenc-hapq-snappy1 +fate-hapenc-hapq-snappy1: OPTS = -pix_fmt rgba -format hap_q -compressor snappy -chunks 1 + +FATE_HAPENC += fate-hapenc-hapq-snappy16 +fate-hapenc-hapq-snappy16: OPTS = -pix_fmt rgba -format hap_q -compressor snappy -chunks 16 + + +$(FATE_HAPENC): $(VREF) + +FATE_AVCONV-$(call ENCMUX, HAP, MOV) += $(FATE_HAPENC) +fate-hapenc: $(FATE_HAPENC) diff --git a/tests/ref/fate/hapenc-hap-none b/tests/ref/fate/hapenc-hap-none new file mode 100644 index 00..22c8b2c751 --- /dev/null +++ b/tests/ref/fate/hapenc-hap-none @@ -0,0 +1,14 @@ +#format: frame checksums +#version: 2 +#hash: MD5 +#tb 0: 1/25 +#media_type 0: video +#codec_id 0: hap +#dimensions 0: 352x288 +#sar 0: 0/1 +#stream#, dts,pts, duration, size, hash +0, 0, 0,1,50696, 7fd5bc08f7b96326953ba6926cb06109 +0, 1, 1,1,50696, 24d172f2ea03994add2596a48151fca8 +0, 2, 2,1,50696, e5f2bac02ad850eb769007694a2f7acc +0, 3, 3,1,50696, 26042fbce3868ad012b0b4557fd95d8a +0, 4, 4,1,50696, 80902dd47d1211f1cd388652d5e0a797 diff --git a/tests/ref/fate/hapenc-hap-snappy1 b/tests/ref/fate/hapenc-hap-snappy1 new file mode 100644 index 00..53b5c7d626 --- /dev/null +++ b/tests/ref/fate/hapenc-hap-snappy1 @@ -0,0 +1,14 @@ +#format: frame checksums +#version: 2 +#hash: MD5 +#tb 0: 1/25 +#media_type 0: video +#codec_id 0: hap +#dimensions 0: 352x288 +#sar 0: 0/1 +#stream#, dts,pts, duration, size, hash +0, 0, 0,1,38199, e9a458a776d7f32d5d01ba9d2a1e9242 +0, 1, 1,1,38475, 0f134741aaf9532629c6163c90e5d779 +0, 2, 2,1,39157, 39c2b6b8c308af8e5d6a9eef92e8e8dc +0, 3, 3,1,38674, 7cc1dfb3cb636181237a7ecd67d17614 +0, 4, 4,1,38360, 05d0bcfa66349e41db6e42134cc47121 diff --git a/tests/ref/fate/hapenc-hap-snappy16 b/tests/ref/fate/hapenc-hap-snappy16 new file mode 100644 index 00..ab0771bf61 --- /dev/null +++ b/tests/ref/fate/hapenc-hap-snappy16 @@ -0,0 +1,14 @@ +#format: frame checksums +#version: 2 +#hash: MD5 +#tb 0: 1/25 +#media_type 0: video +#codec_id 0: hap +#dimensions 0: 352x288 +#sar 0: 0/1 +#stream#, dts,pts, duration, size, hash +0, 0, 0,1,42239, ad3bdee68ffa054fa2bdd3fbc083e39c +0, 1, 1,1,42268, 5b96644be5f424bc04e5695f58f6c238 +0, 2, 2,1,42
[FFmpeg-cvslog] avcodec/hap : move parse_section_header to hap.c in order to be use by new bsf filter
ffmpeg | branch: master | Martin Vignali | Sun Mar 11 19:15:56 2018 +0100| [f869e54d228d43adb3b1e0026a48273befe443eb] | committer: Martin Vignali avcodec/hap : move parse_section_header to hap.c in order to be use by new bsf filter > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f869e54d228d43adb3b1e0026a48273befe443eb --- libavcodec/hap.c| 22 ++ libavcodec/hap.h| 6 ++ libavcodec/hapdec.c | 33 - 3 files changed, 32 insertions(+), 29 deletions(-) diff --git a/libavcodec/hap.c b/libavcodec/hap.c index 5b3af5e1d0..1a330c9c9b 100644 --- a/libavcodec/hap.c +++ b/libavcodec/hap.c @@ -53,3 +53,25 @@ av_cold void ff_hap_free_context(HapContext *ctx) av_freep(&ctx->chunks); av_freep(&ctx->chunk_results); } + +int ff_hap_parse_section_header(GetByteContext *gbc, int *section_size, +enum HapSectionType *section_type) +{ +if (bytestream2_get_bytes_left(gbc) < 4) +return AVERROR_INVALIDDATA; + +*section_size = bytestream2_get_le24(gbc); +*section_type = bytestream2_get_byte(gbc); + +if (*section_size == 0) { +if (bytestream2_get_bytes_left(gbc) < 4) +return AVERROR_INVALIDDATA; + +*section_size = bytestream2_get_le32(gbc); +} + +if (*section_size > bytestream2_get_bytes_left(gbc) || *section_size < 0) +return AVERROR_INVALIDDATA; +else +return 0; +} diff --git a/libavcodec/hap.h b/libavcodec/hap.h index 74455f3dd9..bbeed11e32 100644 --- a/libavcodec/hap.h +++ b/libavcodec/hap.h @@ -103,4 +103,10 @@ int ff_hap_set_chunk_count(HapContext *ctx, int count, int first_in_frame); */ av_cold void ff_hap_free_context(HapContext *ctx); +/* The first three bytes are the size of the section past the header, or zero + * if the length is stored in the next long word. The fourth byte in the first + * long word indicates the type of the current section. */ +int ff_hap_parse_section_header(GetByteContext *gbc, int *section_size, +enum HapSectionType *section_type); + #endif /* AVCODEC_HAP_H */ diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c index 8fd4aa962c..8c845770cf 100644 --- a/libavcodec/hapdec.c +++ b/libavcodec/hapdec.c @@ -43,31 +43,6 @@ #include "texturedsp.h" #include "thread.h" -/* The first three bytes are the size of the section past the header, or zero - * if the length is stored in the next long word. The fourth byte in the first - * long word indicates the type of the current section. */ -static int parse_section_header(GetByteContext *gbc, int *section_size, -enum HapSectionType *section_type) -{ -if (bytestream2_get_bytes_left(gbc) < 4) -return AVERROR_INVALIDDATA; - -*section_size = bytestream2_get_le24(gbc); -*section_type = bytestream2_get_byte(gbc); - -if (*section_size == 0) { -if (bytestream2_get_bytes_left(gbc) < 4) -return AVERROR_INVALIDDATA; - -*section_size = bytestream2_get_le32(gbc); -} - -if (*section_size > bytestream2_get_bytes_left(gbc) || *section_size < 0) -return AVERROR_INVALIDDATA; -else -return 0; -} - static int hap_parse_decode_instructions(HapContext *ctx, int size) { GetByteContext *gbc = &ctx->gbc; @@ -78,7 +53,7 @@ static int hap_parse_decode_instructions(HapContext *ctx, int size) while (size > 0) { int stream_remaining = bytestream2_get_bytes_left(gbc); -ret = parse_section_header(gbc, §ion_size, §ion_type); +ret = ff_hap_parse_section_header(gbc, §ion_size, §ion_type); if (ret != 0) return ret; @@ -159,7 +134,7 @@ static int hap_parse_frame_header(AVCodecContext *avctx) const char *compressorstr; int i, ret; -ret = parse_section_header(gbc, &ctx->texture_section_size, §ion_type); +ret = ff_hap_parse_section_header(gbc, &ctx->texture_section_size, §ion_type); if (ret != 0) return ret; @@ -190,7 +165,7 @@ static int hap_parse_frame_header(AVCodecContext *avctx) } break; case HAP_COMP_COMPLEX: -ret = parse_section_header(gbc, §ion_size, §ion_type); +ret = ff_hap_parse_section_header(gbc, §ion_size, §ion_type); if (ret == 0 && section_type != HAP_ST_DECODE_INSTRUCTIONS) ret = AVERROR_INVALIDDATA; if (ret == 0) @@ -342,7 +317,7 @@ static int hap_decode(AVCodecContext *avctx, void *data, /* check for multi texture header */ if (ctx->texture_count == 2) { -ret = parse_section_header(&ctx->gbc, §ion_size, §ion_type); +ret = ff_hap_parse_section_header(&ctx->gbc, §ion_size, §ion_type); if (ret != 0) return ret; if ((section_type & 0x0F) != 0x0D) { ___
[FFmpeg-cvslog] avcodec/hapqa_extract_bsf : add new bsf filter
ffmpeg | branch: master | Martin Vignali | Sun Mar 11 19:16:09 2018 +0100| [7b0cb2e032d38b914a98dedc82c5262c14eeccb7] | committer: Martin Vignali avcodec/hapqa_extract_bsf : add new bsf filter convert HapQA data to HAPQ or HAPAlphaOnly by copying the corresponding texture > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7b0cb2e032d38b914a98dedc82c5262c14eeccb7 --- Changelog | 1 + doc/bitstream_filters.texi | 25 libavcodec/Makefile| 1 + libavcodec/bitstream_filters.c | 1 + libavcodec/hapqa_extract_bsf.c | 135 + 5 files changed, 163 insertions(+) diff --git a/Changelog b/Changelog index c1b9df46bc..7969b414c4 100644 --- a/Changelog +++ b/Changelog @@ -46,6 +46,7 @@ version : They can be found at http://git.videolan.org/?p=ffmpeg/nv-codec-headers.git - native SBC encoder and decoder - drmeter audio filter +- hapqa_extract bitstream filter version 3.4: diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi index b7ea549322..aac4705be4 100644 --- a/doc/bitstream_filters.texi +++ b/doc/bitstream_filters.texi @@ -93,6 +93,31 @@ When this option is enabled, the long-term headers are removed from the bitstream after extraction. @end table +@section hapqa_extract + +Extract Rgb or Alpha part of an HAPQA file, without recompression, in order to create an HAPQ or an HAPAlphaOnly file. + +@table @option +@item texture +Specifies the texture to keep. + +@table @option +@item color +@item alpha +@end table + +@end table + +Convert HAPQA to HAPQ +@example +ffmpeg -i hapqa_inputfile.mov -c copy -bsf:v hapqa_extract=texture=color -tag:v HapY -metadata:s:v:0 encoder="HAPQ" hapq_file.mov +@end example + +Convert HAPQA to HAPAlphaOnly +@example +ffmpeg -i hapqa_inputfile.mov -c copy -bsf:v hapqa_extract=texture=alpha -tag:v HapA -metadata:s:v:0 encoder="HAPAlpha Only" hapalphaonly_file.mov +@end example + @section h264_metadata Modify metadata embedded in an H.264 stream. diff --git a/libavcodec/Makefile b/libavcodec/Makefile index ff6c9f8b2c..0984455ec4 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1043,6 +1043,7 @@ OBJS-$(CONFIG_EXTRACT_EXTRADATA_BSF) += extract_extradata_bsf.o\ OBJS-$(CONFIG_H264_METADATA_BSF) += h264_metadata_bsf.o OBJS-$(CONFIG_H264_MP4TOANNEXB_BSF) += h264_mp4toannexb_bsf.o OBJS-$(CONFIG_H264_REDUNDANT_PPS_BSF) += h264_redundant_pps_bsf.o +OBJS-$(CONFIG_HAPQA_EXTRACT_BSF) += hapqa_extract_bsf.o hap.o OBJS-$(CONFIG_HEVC_METADATA_BSF) += h265_metadata_bsf.o OBJS-$(CONFIG_HEVC_MP4TOANNEXB_BSF) += hevc_mp4toannexb_bsf.o OBJS-$(CONFIG_IMX_DUMP_HEADER_BSF)+= imx_dump_header_bsf.o diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c index 338ef8251b..68e652286d 100644 --- a/libavcodec/bitstream_filters.c +++ b/libavcodec/bitstream_filters.c @@ -32,6 +32,7 @@ extern const AVBitStreamFilter ff_extract_extradata_bsf; extern const AVBitStreamFilter ff_h264_metadata_bsf; extern const AVBitStreamFilter ff_h264_mp4toannexb_bsf; extern const AVBitStreamFilter ff_h264_redundant_pps_bsf; +extern const AVBitStreamFilter ff_hapqa_extract_bsf; extern const AVBitStreamFilter ff_hevc_metadata_bsf; extern const AVBitStreamFilter ff_hevc_mp4toannexb_bsf; extern const AVBitStreamFilter ff_imx_dump_header_bsf; diff --git a/libavcodec/hapqa_extract_bsf.c b/libavcodec/hapqa_extract_bsf.c new file mode 100644 index 00..45fe9fbe8f --- /dev/null +++ b/libavcodec/hapqa_extract_bsf.c @@ -0,0 +1,135 @@ +/* + * HAPQA extract bitstream filter + * Copyright (c) 2017 Jokyo Images + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * HAPQA extract bitstream filter + * extract one of the two textures of the HAQA + */ + +#include "avcodec.h" +#include "bsf.h" +#include "bytestream.h" +#include "hap.h" + +typedef struct HapqaExtractContext { +const AVClass *class; +int texture;/* index of the texture to keep (0 for rgb or 1 for alpha) */ +} HapqaExtractContext; + +static int check_texture(HapqaExtractContext *ctx, int section_type) { +if (((ctx->texture == 0)&
[FFmpeg-cvslog] avfilter/x86/vf_blend : indent
ffmpeg | branch: master | Martin Vignali | Sat Feb 17 20:49:32 2018 +0100| [6c6c9d14a841543166189dec79e33471c44dc863] | committer: Martin Vignali avfilter/x86/vf_blend : indent > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6c6c9d14a841543166189dec79e33471c44dc863 --- libavfilter/x86/vf_blend_init.c | 94 - 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/libavfilter/x86/vf_blend_init.c b/libavfilter/x86/vf_blend_init.c index b88ea7a7d2..c9c7a52ef9 100644 --- a/libavfilter/x86/vf_blend_init.c +++ b/libavfilter/x86/vf_blend_init.c @@ -74,56 +74,56 @@ av_cold void ff_blend_init_x86(FilterParams *param, int is_16bit) int cpu_flags = av_get_cpu_flags(); if (!is_16bit) { -if (EXTERNAL_SSE2(cpu_flags) && param->opacity == 1) { -switch (param->mode) { -case BLEND_ADDITION: param->blend = ff_blend_addition_sse2; break; -case BLEND_GRAINMERGE: param->blend = ff_blend_grainmerge_sse2; break; -case BLEND_AND: param->blend = ff_blend_and_sse2; break; -case BLEND_AVERAGE: param->blend = ff_blend_average_sse2; break; -case BLEND_DARKEN: param->blend = ff_blend_darken_sse2; break; -case BLEND_GRAINEXTRACT: param->blend = ff_blend_grainextract_sse2; break; -case BLEND_DIVIDE: param->blend = ff_blend_divide_sse2; break; -case BLEND_HARDMIX: param->blend = ff_blend_hardmix_sse2; break; -case BLEND_LIGHTEN: param->blend = ff_blend_lighten_sse2; break; -case BLEND_MULTIPLY: param->blend = ff_blend_multiply_sse2; break; -case BLEND_OR: param->blend = ff_blend_or_sse2; break; -case BLEND_PHOENIX: param->blend = ff_blend_phoenix_sse2; break; -case BLEND_SCREEN: param->blend = ff_blend_screen_sse2; break; -case BLEND_SUBTRACT: param->blend = ff_blend_subtract_sse2; break; -case BLEND_XOR: param->blend = ff_blend_xor_sse2; break; -case BLEND_DIFFERENCE: param->blend = ff_blend_difference_sse2; break; -case BLEND_EXTREMITY: param->blend = ff_blend_extremity_sse2; break; -case BLEND_NEGATION: param->blend = ff_blend_negation_sse2; break; +if (EXTERNAL_SSE2(cpu_flags) && param->opacity == 1) { +switch (param->mode) { +case BLEND_ADDITION: param->blend = ff_blend_addition_sse2; break; +case BLEND_GRAINMERGE: param->blend = ff_blend_grainmerge_sse2; break; +case BLEND_AND: param->blend = ff_blend_and_sse2; break; +case BLEND_AVERAGE: param->blend = ff_blend_average_sse2; break; +case BLEND_DARKEN: param->blend = ff_blend_darken_sse2; break; +case BLEND_GRAINEXTRACT: param->blend = ff_blend_grainextract_sse2; break; +case BLEND_DIVIDE: param->blend = ff_blend_divide_sse2; break; +case BLEND_HARDMIX: param->blend = ff_blend_hardmix_sse2; break; +case BLEND_LIGHTEN: param->blend = ff_blend_lighten_sse2; break; +case BLEND_MULTIPLY: param->blend = ff_blend_multiply_sse2; break; +case BLEND_OR: param->blend = ff_blend_or_sse2; break; +case BLEND_PHOENIX: param->blend = ff_blend_phoenix_sse2; break; +case BLEND_SCREEN: param->blend = ff_blend_screen_sse2; break; +case BLEND_SUBTRACT: param->blend = ff_blend_subtract_sse2; break; +case BLEND_XOR: param->blend = ff_blend_xor_sse2; break; +case BLEND_DIFFERENCE: param->blend = ff_blend_difference_sse2; break; +case BLEND_EXTREMITY:param->blend = ff_blend_extremity_sse2; break; +case BLEND_NEGATION: param->blend = ff_blend_negation_sse2; break; +} } -} -if (EXTERNAL_SSSE3(cpu_flags) && param->opacity == 1) { -switch (param->mode) { -case BLEND_DIFFERENCE: param->blend = ff_blend_difference_ssse3; break; -case BLEND_EXTREMITY: param->blend = ff_blend_extremity_ssse3; break; -case BLEND_NEGATION: param->blend = ff_blend_negation_ssse3; break; +if (EXTERNAL_SSSE3(cpu_flags) && param->opacity == 1) { +switch (param->mode) { +case BLEND_DIFFERENCE: param->blend = ff_blend_difference_ssse3; break; +case BLEND_EXTREMITY: param->blend = ff_blend_extremity_ssse3; break; +case BLEND_NEGATION: param->blend = ff_blend_negation_ssse3; break; +} } -} -if (EXTERNAL_AVX2_FAST(cpu_flags) && param->opacity == 1) { -switch (pa
[FFmpeg-cvslog] avfilter/x86/vf_blend : add 16 bit version for BLEND_SIMPLE, phoenix, difference for SSE and AVX2 (x86_64)
ffmpeg | branch: master | Martin Vignali | Sat Feb 17 21:01:34 2018 +0100| [53a03b5c8c7d355bd353727115efc9977aa76f28] | committer: Martin Vignali avfilter/x86/vf_blend : add 16 bit version for BLEND_SIMPLE, phoenix, difference for SSE and AVX2 (x86_64) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=53a03b5c8c7d355bd353727115efc9977aa76f28 --- libavfilter/x86/vf_blend.asm| 75 ++--- libavfilter/x86/vf_blend_init.c | 54 + 2 files changed, 116 insertions(+), 13 deletions(-) diff --git a/libavfilter/x86/vf_blend.asm b/libavfilter/x86/vf_blend.asm index 680e266348..5d9a909192 100644 --- a/libavfilter/x86/vf_blend.asm +++ b/libavfilter/x86/vf_blend.asm @@ -36,10 +36,13 @@ pb_255: times 16 db 255 SECTION .text -%macro BLEND_INIT 2 +%macro BLEND_INIT 2-3 %if ARCH_X86_64 cglobal blend_%1, 6, 9, %2, top, top_linesize, bottom, bottom_linesize, dst, dst_linesize, width, end, x movwidthd, dword widthm +%if %0 == 3; is 16 bit +addwidthq, widthq ; doesn't compile on x86_32 +%endif %else cglobal blend_%1, 5, 7, %2, top, top_linesize, bottom, bottom_linesize, dst, end, x %define dst_linesizeq r5mp @@ -61,8 +64,8 @@ cglobal blend_%1, 5, 7, %2, top, top_linesize, bottom, bottom_linesize, dst, end REP_RET %endmacro -%macro BLEND_SIMPLE 2 -BLEND_INIT %1, 2 +%macro BLEND_SIMPLE 2-3 +BLEND_INIT %1, 2, %3 .nextrow: movxq, widthq @@ -270,8 +273,9 @@ BLEND_INIT divide, 4 BLEND_END %endmacro -%macro PHOENIX 0 -BLEND_INIT phoenix, 4 +%macro PHOENIX 2-3 +; %1 name, %2 b or w, %3 (opt) 1 if 16 bit +BLEND_INIT %1, 4, %3 VBROADCASTI128 m3, [pb_255] .nextrow: movxq, widthq @@ -280,19 +284,19 @@ BLEND_INIT phoenix, 4 movum0, [topq + xq] movum1, [bottomq + xq] movam2, m0 -pminub m0, m1 -pmaxub m1, m2 +pminu%2 m0, m1 +pmaxu%2 m1, m2 movam2, m3 -psubusb m2, m1 -paddusb m2, m0 +psubus%2m2, m1 +paddus%2m2, m0 mova [dstq + xq], m2 add xq, mmsize jl .loop BLEND_END %endmacro -%macro BLEND_ABS 0 -BLEND_INIT difference, 5 +%macro DIFFERENCE 1-2 +BLEND_INIT %1, 5, %2 pxor m2, m2 .nextrow: movxq, widthq @@ -300,6 +304,17 @@ BLEND_INIT difference, 5 .loop: movum0, [topq + xq] movum1, [bottomq + xq] +%if %0 == 2 ; 16 bit +punpckhwd m3, m0, m2 +punpcklwd m0, m2 +punpckhwd m4, m1, m2 +punpcklwd m1, m2 +psubd m0, m1 +psubd m3, m4 +pabsd m0, m0 +pabsd m3, m3 +packusdwm0, m3 +%else punpckhbw m3, m0, m2 punpcklbw m0, m2 punpckhbw m4, m1, m2 @@ -308,11 +323,14 @@ BLEND_INIT difference, 5 psubw m3, m4 ABS2m0, m3, m1, m4 packuswbm0, m3 +%endif mova [dstq + xq], m0 add xq, mmsize jl .loop BLEND_END +%endmacro +%macro BLEND_ABS 0 BLEND_INIT extremity, 8 pxor m2, m2 VBROADCASTI128 m4, [pw_255] @@ -378,14 +396,32 @@ BLEND_SCREEN AVERAGE GRAINMERGE HARDMIX -PHOENIX +PHOENIX phoenix, b +DIFFERENCE difference DIVIDE BLEND_ABS +%if ARCH_X86_64 +BLEND_SIMPLE addition_16, addusw, 1 +BLEND_SIMPLE and_16, and,1 +BLEND_SIMPLE or_16, or, 1 +BLEND_SIMPLE subtract_16, subusw, 1 +BLEND_SIMPLE xor_16, xor,1 +%endif + INIT_XMM ssse3 +DIFFERENCE difference BLEND_ABS +INIT_XMM sse4 +%if ARCH_X86_64 +BLEND_SIMPLE darken_16, minuw, 1 +BLEND_SIMPLE lighten_16, maxuw, 1 +PHOENIX phoenix_16, w, 1 +DIFFERENCE difference_16, 1 +%endif + %if HAVE_AVX2_EXTERNAL INIT_YMM avx2 BLEND_SIMPLE xor, xor @@ -401,7 +437,20 @@ BLEND_SCREEN AVERAGE GRAINMERGE HARDMIX -PHOENIX +PHOENIX phoenix, b +DIFFERENCE difference BLEND_ABS + +%if ARCH_X86_64 +BLEND_SIMPLE addition_16, addusw, 1 +BLEND_SIMPLE and_16, and,1 +BLEND_SIMPLE darken_16, minuw, 1 +BLEND_SIMPLE lighten_16, maxuw, 1 +BLEND_SIMPLE or_16, or, 1 +BLEND_SIMPLE subtract_16, subusw, 1 +BLEND_SIMPLE xor_16, xor,1 +PHOENIX phoenix_16, w, 1 +DIFFERENCE difference_16, 1 +%endif %endif diff --git a/libavfilter/x86/vf_blend_init.c b/libavfilter/x86/vf_blend_init.c index c9c7a52ef9..0962f6d7fd 100644 --- a/libavfilter/x86/vf_blend_init.c +++ b/libavfilter/x86/vf_blend_init.c @@ -69,6 +69,27 @@ BLEND_FUNC(negation, sse2) BLEND_FUNC(negation, ssse3) BLEND_FUNC(negation, avx2) +#if ARCH_X86_64 +BLEND_FUNC(addition_16, sse2) +BLEND_FUNC(addition_16, avx2) +BLEND_FUNC(and_16, sse2) +BLEND_FUNC(and_16, avx2) +BL
[FFmpeg-cvslog] checkasm/vf_blend : add test for blend_simple_16, phoenix_16 and difference_16
ffmpeg | branch: master | Martin Vignali | Sat Feb 17 21:02:12 2018 +0100| [c0919c49855b4b7f6a476d2daf2b160d9c50407b] | committer: Martin Vignali checkasm/vf_blend : add test for blend_simple_16, phoenix_16 and difference_16 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c0919c49855b4b7f6a476d2daf2b160d9c50407b --- tests/checkasm/vf_blend.c | 12 1 file changed, 12 insertions(+) diff --git a/tests/checkasm/vf_blend.c b/tests/checkasm/vf_blend.c index 9933f0426e..79bdf9f163 100644 --- a/tests/checkasm/vf_blend.c +++ b/tests/checkasm/vf_blend.c @@ -123,6 +123,18 @@ void checkasm_check_blend(void) report("8bit"); +check_and_report(addition_16, BLEND_ADDITION, 2) +check_and_report(and_16, BLEND_AND, 2) +check_and_report(darken_16, BLEND_DARKEN, 2) +check_and_report(difference_16, BLEND_DIFFERENCE, 2) +check_and_report(lighten_16, BLEND_LIGHTEN, 2) +check_and_report(or_16, BLEND_OR, 2) +check_and_report(phoenix_16, BLEND_PHOENIX, 2) +check_and_report(subtract_16, BLEND_SUBTRACT, 2) +check_and_report(xor_16, BLEND_SUBTRACT, 2) + +report("16bit"); + av_freep(&top1); av_freep(&top2); av_freep(&bot1); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/x86/vf_blend : reorganize init in order to add 16 bit version
ffmpeg | branch: master | Martin Vignali | Sat Feb 17 20:49:12 2018 +0100| [7590d58b61462ef1f802fc75a092662758d4039a] | committer: Martin Vignali avfilter/x86/vf_blend : reorganize init in order to add 16 bit version > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7590d58b61462ef1f802fc75a092662758d4039a --- libavfilter/x86/vf_blend_init.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavfilter/x86/vf_blend_init.c b/libavfilter/x86/vf_blend_init.c index 6e782e4edb..b88ea7a7d2 100644 --- a/libavfilter/x86/vf_blend_init.c +++ b/libavfilter/x86/vf_blend_init.c @@ -73,7 +73,8 @@ av_cold void ff_blend_init_x86(FilterParams *param, int is_16bit) { int cpu_flags = av_get_cpu_flags(); -if (EXTERNAL_SSE2(cpu_flags) && param->opacity == 1 && !is_16bit) { +if (!is_16bit) { +if (EXTERNAL_SSE2(cpu_flags) && param->opacity == 1) { switch (param->mode) { case BLEND_ADDITION: param->blend = ff_blend_addition_sse2; break; case BLEND_GRAINMERGE: param->blend = ff_blend_grainmerge_sse2; break; @@ -95,7 +96,7 @@ av_cold void ff_blend_init_x86(FilterParams *param, int is_16bit) case BLEND_NEGATION: param->blend = ff_blend_negation_sse2; break; } } -if (EXTERNAL_SSSE3(cpu_flags) && param->opacity == 1 && !is_16bit) { +if (EXTERNAL_SSSE3(cpu_flags) && param->opacity == 1) { switch (param->mode) { case BLEND_DIFFERENCE: param->blend = ff_blend_difference_ssse3; break; case BLEND_EXTREMITY: param->blend = ff_blend_extremity_ssse3; break; @@ -103,7 +104,7 @@ av_cold void ff_blend_init_x86(FilterParams *param, int is_16bit) } } -if (EXTERNAL_AVX2_FAST(cpu_flags) && param->opacity == 1 && !is_16bit) { +if (EXTERNAL_AVX2_FAST(cpu_flags) && param->opacity == 1) { switch (param->mode) { case BLEND_ADDITION: param->blend = ff_blend_addition_avx2; break; case BLEND_GRAINMERGE: param->blend = ff_blend_grainmerge_avx2; break; @@ -124,4 +125,5 @@ av_cold void ff_blend_init_x86(FilterParams *param, int is_16bit) case BLEND_NEGATION: param->blend = ff_blend_negation_avx2; break; } } +} } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] checkasm/vf_blend : add depth param in order to add test for 16 bit version
ffmpeg | branch: master | Martin Vignali | Sat Feb 17 20:48:42 2018 +0100| [e3fc36a84c4335fcb347ed82911f98339279ec39] | committer: Martin Vignali checkasm/vf_blend : add depth param in order to add test for 16 bit version > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e3fc36a84c4335fcb347ed82911f98339279ec39 --- tests/checkasm/vf_blend.c | 57 --- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/tests/checkasm/vf_blend.c b/tests/checkasm/vf_blend.c index be65730452..9933f0426e 100644 --- a/tests/checkasm/vf_blend.c +++ b/tests/checkasm/vf_blend.c @@ -60,28 +60,29 @@ } \ } while (0) -#define check_blend_func() \ +#define check_blend_func(depth) \ do { \ -int i; \ +int i, w; \ declare_func(void, const uint8_t *top, ptrdiff_t top_linesize, \ const uint8_t *bottom, ptrdiff_t bottom_linesize, \ uint8_t *dst, ptrdiff_t dst_linesize, \ ptrdiff_t width, ptrdiff_t height, \ struct FilterParams *param, double *values); \ +w = WIDTH / depth; \ \ for (i = 0; i < BUF_UNITS - 1; i++) { \ int src_offset = i * SIZE_PER_UNIT + i; /* Test various alignments */ \ int dst_offset = i * SIZE_PER_UNIT; /* dst must be aligned */ \ randomize_buffers(); \ -call_ref(top1 + src_offset, WIDTH, bot1 + src_offset, WIDTH, \ - dst1 + dst_offset, WIDTH, WIDTH, HEIGHT, ¶m, NULL); \ -call_new(top2 + src_offset, WIDTH, bot2 + src_offset, WIDTH, \ - dst2 + dst_offset, WIDTH, WIDTH, HEIGHT, ¶m, NULL); \ +call_ref(top1 + src_offset, w, bot1 + src_offset, w, \ + dst1 + dst_offset, w, w, HEIGHT, ¶m, NULL); \ +call_new(top2 + src_offset, w, bot2 + src_offset, w, \ + dst2 + dst_offset, w, w, HEIGHT, ¶m, NULL); \ if (memcmp(top1, top2, BUF_SIZE) || memcmp(bot1, bot2, BUF_SIZE) || memcmp(dst1, dst2, BUF_SIZE)) \ fail(); \ } \ -bench_new(top2, WIDTH / 4, bot2, WIDTH / 4, dst2, WIDTH / 4, \ - WIDTH / 4, HEIGHT / 4, ¶m, NULL); \ +bench_new(top2, w / 4, bot2, w / 4, dst2, w / 4, \ + w / 4, HEIGHT / 4, ¶m, NULL); \ } while (0) void checkasm_check_blend(void) @@ -96,29 +97,29 @@ void checkasm_check_blend(void) .opacity = 1.0, }; -#define check_and_report(name, val) \ +#define check_and_report(name, val, depth)\ param.mode = val; \ -ff_blend_init(¶m, 0); \ +ff_blend_init(¶m, depth - 1); \ if (check_func(param.blend, #name)) \ -check_blend_func(); +check_blend_func(depth); -check_and_report(addition, BLEND_ADDITION) -check_and_report(grainmerge, BLEND_GRAINMERGE) -check_and_report(and, BLEND_AND) -check_and_report(average, BLEND_AVERAGE) -check_and_report(darken, BLEND_DARKEN) -check_and_report(grainextract, BLEND_GRAINEXTRACT) -check_and_report(hardmix, BLEND_HARDMIX) -check_and_report(lighten, BLEND_LIGHTEN) -check_and_report(multiply, BLEND_MULTIPLY) -check_and_report(or, BLEND_OR) -check_and_report(phoenix, BLEND_PHOENIX) -check_and_report(screen, BLEND_SCREEN) -check_and_report(subtract, BLEND_SUBTRACT) -check_and_report(xor, BLEND_XOR) -check_and_report(difference, BLEND_DIFFERENCE) -check_and_report(extremity, BLEND_EXTREMITY) -check_and_report(negation, BLEND_NEGATION) +check_and_report(ad
[FFmpeg-cvslog] avcodec/exr : add support for long name flag and be more explicit about unsupported flag
ffmpeg | branch: master | Martin Vignali | Sat Feb 17 20:44:12 2018 +0100| [ea03f295ec79ee72d3c7a6af4e4abcda70b9a423] | committer: Martin Vignali avcodec/exr : add support for long name flag and be more explicit about unsupported flag based-on patch by Carl Eugen Hoyos Fix ticket 6994 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ea03f295ec79ee72d3c7a6af4e4abcda70b9a423 --- libavcodec/exr.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 47f59bd638..444af17778 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -1350,12 +1350,14 @@ static int decode_header(EXRContext *s, AVFrame *frame) flags = bytestream2_get_le24(&s->gb); -if (flags == 0x00) -s->is_tile = 0; -else if (flags & 0x02) +if (flags & 0x02) s->is_tile = 1; -else{ -avpriv_report_missing_feature(s->avctx, "flags %d", flags); +if (flags & 0x08) { +avpriv_report_missing_feature(s->avctx, "deep data"); +return AVERROR_PATCHWELCOME; +} +if (flags & 0x10) { +avpriv_report_missing_feature(s->avctx, "multipart"); return AVERROR_PATCHWELCOME; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog