[FFmpeg-devel] [PATCH 1/1] avdevice/decklink_dec: Autodetect the video input format
Please find the patch attached. Regards, Karthick 0001-avdevice-decklink_dec-Autodetect-the-video-input-for.patch Description: 0001-avdevice-decklink_dec-Autodetect-the-video-input-for.patch ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/mips: Improve avc avg mc 22, 11, 31, 13 and 33 msa functions
From: Kaustubh Raste Remove loops and unroll as block sizes are known. Load the specific destination bytes instead of MSA load and pack. Remove unused macro and functions. Signed-off-by: Kaustubh Raste --- libavcodec/mips/h264qpel_msa.c | 781 ++-- 1 file changed, 513 insertions(+), 268 deletions(-) diff --git a/libavcodec/mips/h264qpel_msa.c b/libavcodec/mips/h264qpel_msa.c index fcccb98..e3a8634 100644 --- a/libavcodec/mips/h264qpel_msa.c +++ b/libavcodec/mips/h264qpel_msa.c @@ -75,22 +75,6 @@ static const uint8_t luma_mask_arr[16 * 8] = { DPADD_SB2_SH(tmp0_m, tmp1_m, plus20b_m, plus20b_m, out1, out2); \ } -#define AVC_CALC_DPADD_B_6PIX_2COEFF_R_SH(vec0, vec1, vec2, vec3, vec4, vec5) \ -( { \ -v8i16 tmp1_m; \ -v16i8 tmp0_m, tmp2_m; \ -v16i8 minus5b_m = __msa_ldi_b(-5); \ -v16i8 plus20b_m = __msa_ldi_b(20); \ - \ -tmp1_m = (v8i16) __msa_ilvr_b((v16i8) vec5, (v16i8) vec0); \ -tmp1_m = __msa_hadd_s_h((v16i8) tmp1_m, (v16i8) tmp1_m); \ - \ -ILVR_B2_SB(vec4, vec1, vec3, vec2, tmp0_m, tmp2_m); \ -DPADD_SB2_SH(tmp0_m, tmp2_m, minus5b_m, plus20b_m, tmp1_m, tmp1_m); \ - \ -tmp1_m; \ -} ) - #define AVC_CALC_DPADD_H_6PIX_2COEFF_R_SH(vec0, vec1, vec2, vec3, vec4, vec5) \ ( { \ v4i32 tmp1_m; \ @@ -1157,128 +1141,6 @@ static void avc_luma_vt_qrt_and_aver_dst_16x16_msa(const uint8_t *src, } } -static void avc_luma_mid_and_aver_dst_4x4_msa(const uint8_t *src, - int32_t src_stride, - uint8_t *dst, int32_t dst_stride) -{ -v16i8 src0, src1, src2, src3, src4; -v16i8 mask0, mask1, mask2; -v8i16 hz_out0, hz_out1, hz_out2, hz_out3; -v8i16 hz_out4, hz_out5, hz_out6, hz_out7, hz_out8; -v8i16 res0, res1, res2, res3; -v16u8 dst0, dst1, dst2, dst3; -v16u8 tmp0, tmp1, tmp2, tmp3; - -LD_SB3(&luma_mask_arr[48], 16, mask0, mask1, mask2); -LD_SB5(src, src_stride, src0, src1, src2, src3, src4); -src += (5 * src_stride); - -XORI_B5_128_SB(src0, src1, src2, src3, src4); - -hz_out0 = AVC_XOR_VSHF_B_AND_APPLY_6TAP_HORIZ_FILT_SH(src0, src1, - mask0, mask1, mask2); -hz_out2 = AVC_XOR_VSHF_B_AND_APPLY_6TAP_HORIZ_FILT_SH(src2, src3, - mask0, mask1, mask2); - -PCKOD_D2_SH(hz_out0, hz_out0, hz_out2, hz_out2, hz_out1, hz_out3); - -hz_out4 = AVC_HORZ_FILTER_SH(src4, src4, mask0, mask1, mask2); - -LD_SB4(src, src_stride, src0, src1, src2, src3); -XORI_B4_128_SB(src0, src1, src2, src3); - -hz_out5 = AVC_XOR_VSHF_B_AND_APPLY_6TAP_HORIZ_FILT_SH(src0, src1, - mask0, mask1, mask2); -hz_out7 = AVC_XOR_VSHF_B_AND_APPLY_6TAP_HORIZ_FILT_SH(src2, src3, - mask0, mask1, mask2); - -PCKOD_D2_SH(hz_out5, hz_out5, hz_out7, hz_out7, hz_out6, hz_out8); - -res0 = AVC_CALC_DPADD_H_6PIX_2COEFF_R_SH(hz_out0, hz_out1, hz_out2, - hz_out3, hz_out4, hz_out5); -res1 = AVC_CALC_DPADD_H_6PIX_2COEFF_R_SH(hz_out1, hz_out2, hz_out3, - hz_out4, hz_out5, hz_out6); -res2 = AVC_CALC_DPADD_H_6PIX_2COEFF_R_SH(hz_out2, hz_out3, hz_out4, - hz_out5, hz_out6, hz_out7); -res3 = AVC_CALC_DPADD_H_6PIX_2COEFF_R_SH(hz_out3, hz_out4, hz_out5, - hz_out6, hz_out7, hz_out8); -LD_UB4(dst, dst_stride, dst0, dst1, dst2, dst3); -tmp0 = PCKEV_XORI128_UB(res0, res1); -tmp1 = PCKEV_XORI128_UB(res2, res3); -PCKEV_D2_UB(dst1, dst0, dst3, dst2, tmp2, tmp3); -AVER_UB2_UB(tmp0, tmp2, tmp1, tmp3, tmp0, tmp1); - -ST4x4_UB(tmp0, tmp1, 0, 2, 0, 2, dst, dst_stride); -} - -static void avc_luma_mid_and_aver_dst_8w_msa(const uint8_t *src, - int32_t src_stride, - uint8_t *dst, int32_t dst_stride, - int32_t
[FFmpeg-devel] [PATCH] avcodec/mips: Improve avc chroma avg hv mc msa functions
From: Kaustubh Raste Replace generic with block size specific function. Load the specific destination bytes instead of MSA load and pack. Signed-off-by: Kaustubh Raste --- libavcodec/mips/h264chroma_msa.c | 438 +- 1 file changed, 238 insertions(+), 200 deletions(-) diff --git a/libavcodec/mips/h264chroma_msa.c b/libavcodec/mips/h264chroma_msa.c index a5c3334..4c25761 100644 --- a/libavcodec/mips/h264chroma_msa.c +++ b/libavcodec/mips/h264chroma_msa.c @@ -1408,15 +1408,15 @@ static void avc_chroma_vt_and_aver_dst_8w_msa(uint8_t *src, uint8_t *dst, } } -static void avc_chroma_hv_and_aver_dst_2x2_msa(uint8_t *src, int32_t src_stride, - uint8_t *dst, int32_t dst_stride, +static void avc_chroma_hv_and_aver_dst_2x2_msa(uint8_t *src, uint8_t *dst, + int32_t stride, uint32_t coef_hor0, uint32_t coef_hor1, uint32_t coef_ver0, uint32_t coef_ver1) { uint16_t out0, out1; -v16u8 dst0, dst1; +v16u8 dst0 = { 0 }; v16u8 src0, src1, src2; v8u16 res_hz0, res_hz1, res_vt0, res_vt1; v16i8 res, mask; @@ -1428,8 +1428,11 @@ static void avc_chroma_hv_and_aver_dst_2x2_msa(uint8_t *src, int32_t src_stride, mask = LD_SB(&chroma_mask_arr[48]); -LD_UB3(src, src_stride, src0, src1, src2); -LD_UB2(dst, dst_stride, dst0, dst1); +LD_UB3(src, stride, src0, src1, src2); +out0 = LH(dst); +out1 = LH(dst + stride); +dst0 = (v16u8) __msa_insert_h((v8i16) dst0, 0, out0); +dst0 = (v16u8) __msa_insert_h((v8i16) dst0, 1, out1); VSHF_B2_UB(src0, src1, src1, src2, mask, mask, src0, src1); DOTP_UB2_UH(src0, src1, coeff_hz_vec, coeff_hz_vec, res_hz0, res_hz1); MUL2(res_hz0, coeff_vt_vec1, res_hz1, coeff_vt_vec0, res_vt0, res_vt1); @@ -1438,67 +1441,26 @@ static void avc_chroma_hv_and_aver_dst_2x2_msa(uint8_t *src, int32_t src_stride, res_vt0 = (v8u16) __msa_srari_h((v8i16) res_vt0, 6); res_vt0 = __msa_sat_u_h(res_vt0, 7); res = __msa_pckev_b((v16i8) res_vt0, (v16i8) res_vt0); -dst0 = (v16u8) __msa_insve_h((v8i16) dst0, 1, (v8i16) dst1); dst0 = __msa_aver_u_b((v16u8) res, dst0); out0 = __msa_copy_u_h((v8i16) dst0, 0); out1 = __msa_copy_u_h((v8i16) dst0, 1); SH(out0, dst); -dst += dst_stride; +dst += stride; SH(out1, dst); } -static void avc_chroma_hv_and_aver_dst_2x4_msa(uint8_t *src, int32_t src_stride, - uint8_t *dst, int32_t dst_stride, +static void avc_chroma_hv_and_aver_dst_2x4_msa(uint8_t *src, uint8_t *dst, + int32_t stride, uint32_t coef_hor0, uint32_t coef_hor1, uint32_t coef_ver0, uint32_t coef_ver1) { +uint16_t tp0, tp1, tp2, tp3; v16u8 src0, src1, src2, src3, src4; v16u8 tmp0, tmp1, tmp2, tmp3; -v16u8 dst0, dst1, dst2, dst3; -v8u16 res_hz0, res_hz1, res_vt0, res_vt1; -v16i8 res, mask; -v16i8 coeff_hz_vec0 = __msa_fill_b(coef_hor0); -v16i8 coeff_hz_vec1 = __msa_fill_b(coef_hor1); -v16u8 coeff_hz_vec = (v16u8) __msa_ilvr_b(coeff_hz_vec0, coeff_hz_vec1); -v8u16 coeff_vt_vec0 = (v8u16) __msa_fill_h(coef_ver0); -v8u16 coeff_vt_vec1 = (v8u16) __msa_fill_h(coef_ver1); - -mask = LD_SB(&chroma_mask_arr[48]); - -LD_UB5(src, src_stride, src0, src1, src2, src3, src4); -LD_UB4(dst, dst_stride, dst0, dst1, dst2, dst3); -VSHF_B2_UB(src0, src1, src2, src3, mask, mask, tmp0, tmp1); -VSHF_B2_UB(src1, src2, src3, src4, mask, mask, tmp2, tmp3); -ILVR_D2_UB(tmp1, tmp0, tmp3, tmp2, src0, src1); -DOTP_UB2_UH(src0, src1, coeff_hz_vec, coeff_hz_vec, res_hz0, res_hz1); -MUL2(res_hz0, coeff_vt_vec1, res_hz1, coeff_vt_vec0, res_vt0, res_vt1); - -res_vt0 += res_vt1; -res_vt0 = (v8u16) __msa_srari_h((v8i16) res_vt0, 6); -res_vt0 = __msa_sat_u_h(res_vt0, 7); -res = __msa_pckev_b((v16i8) res_vt0, (v16i8) res_vt0); - -dst0 = (v16u8) __msa_insve_h((v8i16) dst0, 1, (v8i16) dst1); -dst0 = (v16u8) __msa_insve_h((v8i16) dst0, 2, (v8i16) dst2); -dst0 = (v16u8) __msa_insve_h((v8i16) dst0, 3, (v8i16) dst3); -dst0 = __msa_aver_u_b((v16u8) res, dst0); - -ST2x4_UB(dst0, 0, dst, dst_stride); -} - -static void avc_chroma_hv_and_aver_dst_2x8_msa(uint8_t *src, int32_t src_stride, - uint8_t *dst, int32_t dst_stride, - uint32_t coef_hor0, - uint32_t coef_hor1, -
Re: [FFmpeg-devel] [PATCH] Properly store sampling rate for FLAC in mp4
On 26 October 2017 at 16:34, Carl Eugen Hoyos wrote: > Was this already mentioned somewhere? > Do other codecs with large sample rates in mp4 play with Firefox? not if the metadata reports a sampling rate of 0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/mips: Improve hevc bi hz and hv mc msa functions
From: Kaustubh Raste Align the mask buffer. Signed-off-by: Kaustubh Raste --- libavcodec/mips/hevc_mc_bi_msa.c | 940 -- 1 file changed, 595 insertions(+), 345 deletions(-) diff --git a/libavcodec/mips/hevc_mc_bi_msa.c b/libavcodec/mips/hevc_mc_bi_msa.c index ccc3f8a..9c03ef8 100644 --- a/libavcodec/mips/hevc_mc_bi_msa.c +++ b/libavcodec/mips/hevc_mc_bi_msa.c @@ -22,6 +22,12 @@ #include "libavcodec/mips/hevcdsp_mips.h" #include "libavcodec/mips/hevc_macros_msa.h" +static const uint8_t ff_hevc_mask_arr[16 * 2] __attribute__((aligned(0x40))) = { +/* 8 width cases */ +0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, +0, 1, 1, 2, 2, 3, 3, 4, 16, 17, 17, 18, 18, 19, 19, 20 +}; + #define HEVC_BI_RND_CLIP2(in0, in1, vec0, vec1, rnd_val, out0, out1) \ { \ ADDS_SH2_SH(vec0, in0, vec1, in1, out0, out1);\ @@ -531,7 +537,7 @@ static void hevc_hz_bi_8t_4w_msa(uint8_t *src0_ptr, v8i16 dst0, dst1, dst2, dst3; v8i16 in0, in1, in2, in3, in4, in5, in6, in7; v8i16 filter_vec, const_vec; -v16i8 mask0 = { 0, 1, 1, 2, 2, 3, 3, 4, 16, 17, 17, 18, 18, 19, 19, 20 }; +v16i8 mask0 = LD_SB(&ff_hevc_mask_arr[16]); src0_ptr -= 3; @@ -557,26 +563,26 @@ static void hevc_hz_bi_8t_4w_msa(uint8_t *src0_ptr, ILVR_D2_SH(in5, in4, in7, in6, in2, in3); XORI_B8_128_SB(src0, src1, src2, src3, src4, src5, src6, src7); -VSHF_B4_SB(src0, src1, mask0, mask1, mask2, mask3, - vec0, vec1, vec2, vec3); dst0 = const_vec; -DPADD_SB4_SH(vec0, vec1, vec2, vec3, filt0, filt1, filt2, filt3, - dst0, dst0, dst0, dst0); -VSHF_B4_SB(src2, src3, mask0, mask1, mask2, mask3, - vec0, vec1, vec2, vec3); dst1 = const_vec; -DPADD_SB4_SH(vec0, vec1, vec2, vec3, filt0, filt1, filt2, filt3, - dst1, dst1, dst1, dst1); -VSHF_B4_SB(src4, src5, mask0, mask1, mask2, mask3, - vec0, vec1, vec2, vec3); dst2 = const_vec; -DPADD_SB4_SH(vec0, vec1, vec2, vec3, filt0, filt1, filt2, filt3, - dst2, dst2, dst2, dst2); -VSHF_B4_SB(src6, src7, mask0, mask1, mask2, mask3, - vec0, vec1, vec2, vec3); dst3 = const_vec; -DPADD_SB4_SH(vec0, vec1, vec2, vec3, filt0, filt1, filt2, filt3, - dst3, dst3, dst3, dst3); +VSHF_B2_SB(src0, src1, src2, src3, mask0, mask0, vec0, vec1); +VSHF_B2_SB(src4, src5, src6, src7, mask0, mask0, vec2, vec3); +DPADD_SB4_SH(vec0, vec1, vec2, vec3, filt0, filt0, filt0, filt0, dst0, + dst1, dst2, dst3); +VSHF_B2_SB(src0, src1, src2, src3, mask1, mask1, vec0, vec1); +VSHF_B2_SB(src4, src5, src6, src7, mask1, mask1, vec2, vec3); +DPADD_SB4_SH(vec0, vec1, vec2, vec3, filt1, filt1, filt1, filt1, dst0, + dst1, dst2, dst3); +VSHF_B2_SB(src0, src1, src2, src3, mask2, mask2, vec0, vec1); +VSHF_B2_SB(src4, src5, src6, src7, mask2, mask2, vec2, vec3); +DPADD_SB4_SH(vec0, vec1, vec2, vec3, filt2, filt2, filt2, filt2, dst0, + dst1, dst2, dst3); +VSHF_B2_SB(src0, src1, src2, src3, mask3, mask3, vec0, vec1); +VSHF_B2_SB(src4, src5, src6, src7, mask3, mask3, vec2, vec3); +DPADD_SB4_SH(vec0, vec1, vec2, vec3, filt3, filt3, filt3, filt3, dst0, + dst1, dst2, dst3); HEVC_BI_RND_CLIP4(in0, in1, in2, in3, dst0, dst1, dst2, dst3, 7, dst0, dst1, dst2, dst3); @@ -604,7 +610,7 @@ static void hevc_hz_bi_8t_8w_msa(uint8_t *src0_ptr, v8i16 dst0, dst1, dst2, dst3; v8i16 in0, in1, in2, in3; v8i16 filter_vec, const_vec; -v16i8 mask0 = { 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8 }; +v16i8 mask0 = LD_SB(&ff_hevc_mask_arr[0]); src0_ptr -= 3; @@ -625,26 +631,26 @@ static void hevc_hz_bi_8t_8w_msa(uint8_t *src0_ptr, src1_ptr += (4 * src2_stride); XORI_B4_128_SB(src0, src1, src2, src3); -VSHF_B4_SB(src0, src0, mask0, mask1, mask2, mask3, - vec0, vec1, vec2, vec3); dst0 = const_vec; -DPADD_SB4_SH(vec0, vec1, vec2, vec3, filt0, filt1, filt2, filt3, - dst0, dst0, dst0, dst0); -VSHF_B4_SB(src1, src1, mask0, mask1, mask2, mask3, - vec0, vec1, vec2, vec3); dst1 = const_vec; -DPADD_SB4_SH(vec0, vec1, vec2, vec3, filt0, filt1, filt2, filt3, - dst1, dst1, dst1, dst1); -VSHF_B4_SB(src2, src2, mask0, mask1, mask2, mask3, - vec0, vec1, vec2, vec3); dst2 = const_vec; -DPADD_SB4_SH(vec0, vec1, vec2, vec3, filt0, filt1, filt2, filt3, - dst2, dst2, dst2, dst2); -VSHF_B4_SB(src3, src3, mask0, mask1, mask2, mask3, -
[FFmpeg-devel] [PATCH] avcodec/mips: Improve hevc uni vt and hv mc msa functions
From: Kaustubh Raste Remove unused macro. Signed-off-by: Kaustubh Raste --- libavcodec/mips/hevc_mc_uni_msa.c | 744 + 1 file changed, 499 insertions(+), 245 deletions(-) diff --git a/libavcodec/mips/hevc_mc_uni_msa.c b/libavcodec/mips/hevc_mc_uni_msa.c index 3a6c5b0..7d24858 100644 --- a/libavcodec/mips/hevc_mc_uni_msa.c +++ b/libavcodec/mips/hevc_mc_uni_msa.c @@ -292,20 +292,6 @@ static const uint8_t mc_filt_mask_arr[16 * 3] = { 8, 9, 9, 10, 10, 11, 11, 12, 24, 25, 25, 26, 26, 27, 27, 28 }; -#define FILT_8TAP_DPADD_S_H(vec0, vec1, vec2, vec3, \ -filt0, filt1, filt2, filt3) \ -( { \ -v8i16 tmp0, tmp1; \ -\ -tmp0 = __msa_dotp_s_h((v16i8) vec0, (v16i8) filt0); \ -tmp0 = __msa_dpadd_s_h(tmp0, (v16i8) vec1, (v16i8) filt1); \ -tmp1 = __msa_dotp_s_h((v16i8) vec2, (v16i8) filt2); \ -tmp1 = __msa_dpadd_s_h(tmp1, (v16i8) vec3, (v16i8) filt3); \ -tmp0 = __msa_adds_s_h(tmp0, tmp1); \ -\ -tmp0; \ -} ) - #define FILT_4TAP_DPADD_S_H(vec0, vec1, filt0, filt1) \ ( { \ v8i16 tmp0; \ @@ -944,12 +930,14 @@ static void common_vt_8t_4w_msa(uint8_t *src, int32_t src_stride, const int8_t *filter, int32_t height) { uint32_t loop_cnt; +v16u8 out0, out1; v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10; +v16i8 src11, src12, src13, src14; v16i8 src10_r, src32_r, src54_r, src76_r, src98_r, src21_r, src43_r; v16i8 src65_r, src87_r, src109_r, src2110, src4332, src6554, src8776; +v16i8 src1110_r, src1211_r, src1312_r, src1413_r, src1210, src14131312; v16i8 src10998, filt0, filt1, filt2, filt3; -v16u8 out; -v8i16 filt, out10, out32; +v8i16 filt, out10, out32, out54, out76; src -= (3 * src_stride); @@ -966,28 +954,45 @@ static void common_vt_8t_4w_msa(uint8_t *src, int32_t src_stride, src4332, src6554); XORI_B3_128_SB(src2110, src4332, src6554); -for (loop_cnt = (height >> 2); loop_cnt--;) { +for (loop_cnt = (height >> 3); loop_cnt--;) { LD_SB4(src, src_stride, src7, src8, src9, src10); src += (4 * src_stride); +LD_SB4(src, src_stride, src11, src12, src13, src14); +src += (4 * src_stride); ILVR_B4_SB(src7, src6, src8, src7, src9, src8, src10, src9, src76_r, src87_r, src98_r, src109_r); +ILVR_B4_SB(src11, src10, src12, src11, src13, src12, src14, src13, + src1110_r, src1211_r, src1312_r, src1413_r); ILVR_D2_SB(src87_r, src76_r, src109_r, src98_r, src8776, src10998); +ILVR_D2_SB(src1211_r, src1110_r, src1413_r, src1312_r, + src1210, src14131312); XORI_B2_128_SB(src8776, src10998); -out10 = FILT_8TAP_DPADD_S_H(src2110, src4332, src6554, src8776, filt0, -filt1, filt2, filt3); -out32 = FILT_8TAP_DPADD_S_H(src4332, src6554, src8776, src10998, filt0, -filt1, filt2, filt3); +XORI_B2_128_SB(src1210, src14131312); + +DOTP_SB2_SH(src2110, src4332, filt0, filt0, out10, out32); +DOTP_SB2_SH(src6554, src8776, filt0, filt0, out54, out76); +DPADD_SB2_SH(src4332, src6554, filt1, filt1, out10, out32); +DPADD_SB2_SH(src8776, src10998, filt1, filt1, out54, out76); +DPADD_SB2_SH(src6554, src8776, filt2, filt2, out10, out32); +DPADD_SB2_SH(src10998, src1210, filt2, filt2, out54, out76); +DPADD_SB2_SH(src8776, src10998, filt3, filt3, out10, out32); +DPADD_SB2_SH(src1210, src14131312, filt3, filt3, out54, out76); SRARI_H2_SH(out10, out32, 6); +SRARI_H2_SH(out54, out76, 6); SAT_SH2_SH(out10, out32, 7); -out = PCKEV_XORI128_UB(out10, out32); -ST4x4_UB(out, out, 0, 1, 2, 3, dst, dst_stride); +SAT_SH2_SH(out54, out76, 7); +out0 = PCKEV_XORI128_UB(out10, out32); +out1 = PCKEV_XORI128_UB(out54, out76); +ST4x4_UB(out0, out0, 0, 1, 2, 3, dst, dst_stride); +dst += (4 * dst_stride); +ST4x4_UB(out1, out1, 0, 1, 2, 3, dst, dst_stride); dst += (4 * dst_stride); -src2110 = src6554; -src4332 = src8776; -src6554 = src10998; -src6 = src10; +src2110 = src10998; +src4332 = src1210; +src6554 = src14131312; +src6 = src14; } } @@ -1021,14 +1026,14 @@ static void common_vt_8t_8w_msa(uint
[FFmpeg-devel] [PATCH 2/2] avfilter/af_join: switch to activate
Fixes #6780. Signed-off-by: Paul B Mahol --- libavfilter/af_join.c | 101 +++--- 1 file changed, 54 insertions(+), 47 deletions(-) diff --git a/libavfilter/af_join.c b/libavfilter/af_join.c index 33df685691..030bb8e549 100644 --- a/libavfilter/af_join.c +++ b/libavfilter/af_join.c @@ -32,6 +32,7 @@ #include "audio.h" #include "avfilter.h" #include "formats.h" +#include "filters.h" #include "internal.h" typedef struct ChannelMap { @@ -78,34 +79,6 @@ static const AVOption join_options[] = { AVFILTER_DEFINE_CLASS(join); -static int try_push_frame(AVFilterContext *ctx); - -static int filter_frame(AVFilterLink *link, AVFrame *frame) -{ -AVFilterContext *ctx = link->dst; -JoinContext *s = ctx->priv; -int i, j; - -for (i = 0; i < ctx->nb_inputs; i++) -if (link == ctx->inputs[i]) -break; -av_assert0(i < ctx->nb_inputs); -av_assert0(!s->input_frames[i]); -s->input_frames[i] = frame; - -/* request the same number of samples on all inputs */ -/* FIXME that means a frame arriving asynchronously on a different input - will not have the requested number of samples */ -if (i == 0) { -int nb_samples = s->input_frames[0]->nb_samples; - -for (j = 1; !i && j < ctx->nb_inputs; j++) -ctx->inputs[j]->request_samples = nb_samples; -} - -return try_push_frame(ctx); -} - static int parse_maps(AVFilterContext *ctx) { JoinContext *s = ctx->priv; @@ -220,9 +193,6 @@ static av_cold int join_init(AVFilterContext *ctx) pad.name = av_strdup(name); if (!pad.name) return AVERROR(ENOMEM); -pad.filter_frame = filter_frame; - -pad.needs_fifo = 1; if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { av_freep(&pad.name); @@ -390,21 +360,6 @@ fail: return ret; } -static int join_request_frame(AVFilterLink *outlink) -{ -AVFilterContext *ctx = outlink->src; -JoinContext *s = ctx->priv; -int i; - -/* get a frame on each input */ -for (i = 0; i < ctx->nb_inputs; i++) { -AVFilterLink *inlink = ctx->inputs[i]; -if (!s->input_frames[i]) -return ff_request_frame(inlink); -} -return 0; -} - static int try_push_frame(AVFilterContext *ctx) { AVFilterLink *outlink = ctx->outputs[0]; @@ -420,6 +375,8 @@ static int try_push_frame(AVFilterContext *ctx) return 0; nb_samples = FFMIN(nb_samples, s->input_frames[i]->nb_samples); } +if (!nb_samples) +return 0; /* setup the output frame */ frame = av_frame_alloc(); @@ -508,12 +465,61 @@ fail: return ret; } +static int activate(AVFilterContext *ctx) +{ +JoinContext *s = ctx->priv; +int i, ret, status; +int nb_samples = 0; +int64_t pts; + +if (!s->input_frames[0]) { +ret = ff_inlink_consume_frame(ctx->inputs[0], &s->input_frames[0]); +if (ret < 0) { +return ret; +} else if (ff_inlink_acknowledge_status(ctx->inputs[0], &status, &pts)) { +ff_outlink_set_status(ctx->outputs[0], status, pts); +return 0; +} else { +if (ff_outlink_frame_wanted(ctx->outputs[0]) && !s->input_frames[0]) { +ff_inlink_request_frame(ctx->inputs[0]); +return 0; +} +} +} + +nb_samples = s->input_frames[0]->nb_samples; + +for (i = 1; i < ctx->nb_inputs && nb_samples > 0; i++) { +if (s->input_frames[i]) +continue; + +if (ff_inlink_check_available_samples(ctx->inputs[i], nb_samples) > 0) { +ret = ff_inlink_consume_samples(ctx->inputs[i], nb_samples, nb_samples, &s->input_frames[i]); +if (ret < 0) { +return ret; +} else if (ff_inlink_acknowledge_status(ctx->inputs[i], &status, &pts)) { +ff_outlink_set_status(ctx->outputs[0], status, pts); +return 0; +} +} else { +if (ff_outlink_frame_wanted(ctx->outputs[0])) { +ff_inlink_request_frame(ctx->inputs[i]); +return 0; +} +} +} + +if (i == ctx->nb_inputs) +ret = try_push_frame(ctx); + +return ret; +} + static const AVFilterPad avfilter_af_join_outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_AUDIO, .config_props = join_config_output, -.request_frame = join_request_frame, }, { NULL } }; @@ -526,6 +532,7 @@ AVFilter ff_af_join = { .priv_class = &join_class, .init = join_init, .uninit = join_uninit, +.activate = activate, .query_formats = join_query_formats, .inputs = NULL, .outputs= avfilter_af_join_outputs, -- 2.11.0 ___ ffmpeg-devel mailing list ffmp
[FFmpeg-devel] [PATCH 1/2] avfilter: pass correct argument to helper function
Signed-off-by: Paul B Mahol --- libavfilter/avfilter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index bc9e60bb85..b98b32bacb 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -1532,7 +1532,7 @@ int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max, return 0; if (link->status_in) min = FFMIN(min, ff_framequeue_queued_samples(&link->fifo)); -ret = take_samples(link, min, link->max_samples, &frame); +ret = take_samples(link, min, max, &frame); if (ret < 0) return ret; consume_update(link, frame); -- 2.11.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avfilter/vf_tile: remove limit of max tile size
Signed-off-by: Paul B Mahol --- libavfilter/vf_tile.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/libavfilter/vf_tile.c b/libavfilter/vf_tile.c index 87e0b940cf..368e4f1a82 100644 --- a/libavfilter/vf_tile.c +++ b/libavfilter/vf_tile.c @@ -44,8 +44,6 @@ typedef struct TileContext { uint8_t rgba_color[4]; } TileContext; -#define REASONABLE_SIZE 1024 - #define OFFSET(x) offsetof(TileContext, x) #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM @@ -68,12 +66,6 @@ static av_cold int init(AVFilterContext *ctx) { TileContext *tile = ctx->priv; -if (tile->w > REASONABLE_SIZE || tile->h > REASONABLE_SIZE) { -av_log(ctx, AV_LOG_ERROR, "Tile size %ux%u is insane.\n", - tile->w, tile->h); -return AVERROR(EINVAL); -} - if (tile->nb_frames == 0) { tile->nb_frames = tile->w * tile->h; } else if (tile->nb_frames > tile->w * tile->h) { @@ -98,12 +90,12 @@ static int config_props(AVFilterLink *outlink) const unsigned total_margin_w = (tile->w - 1) * tile->padding + 2*tile->margin; const unsigned total_margin_h = (tile->h - 1) * tile->padding + 2*tile->margin; -if (inlink->w > (INT_MAX - total_margin_w) / tile->w) { +if (inlink->w > (INT16_MAX - total_margin_w) / tile->w) { av_log(ctx, AV_LOG_ERROR, "Total width %ux%u is too much.\n", tile->w, inlink->w); return AVERROR(EINVAL); } -if (inlink->h > (INT_MAX - total_margin_h) / tile->h) { +if (inlink->h > (INT16_MAX - total_margin_h) / tile->h) { av_log(ctx, AV_LOG_ERROR, "Total height %ux%u is too much.\n", tile->h, inlink->h); return AVERROR(EINVAL); -- 2.11.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/3] lavf/avio: temporarily accept 0 as EOF.
On Wed, Oct 25, 2017 at 11:22 AM, Nicolas George wrote: > Print a warning to let applicatios fix their use. > After a deprecation period, check with a low-level assert. > Also make the constraint explicit in the doxygen comment. > > Signed-off-by: Nicolas George Thanks for the patch. > --- > libavformat/avio.h| 2 ++ > libavformat/aviobuf.c | 30 +- > libavformat/version.h | 3 +++ > 3 files changed, 26 insertions(+), 9 deletions(-) > > diff --git a/libavformat/avio.h b/libavformat/avio.h > index 19ecd96eb7..76ff7cd81e 100644 > --- a/libavformat/avio.h > +++ b/libavformat/avio.h > @@ -452,6 +452,8 @@ void avio_free_directory_entry(AVIODirEntry **entry); > * @param write_flag Set to 1 if the buffer should be writable, 0 otherwise. > * @param opaque An opaque pointer to user-specific data. > * @param read_packet A function for refilling the buffer, may be NULL. > + * For stream protocols, must never return 0 but rather > + * a proper AVERROR code. Otherwise OK, but since this is the first mention of "stream protocol" in the repo and el goog gives me just "Internet Stream Protocol" so I would like an explanation of what this means and how it connects to "custom AVIO implementations/wrappers"? > * @param write_packet A function for writing the buffer contents, may be > NULL. > *The function may not change the input buffers content. > * @param seek A function for seeking to specified byte position, may be > NULL. > diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c > index 3e9d774a13..bb5bcf7a14 100644 > --- a/libavformat/aviobuf.c > +++ b/libavformat/aviobuf.c > @@ -524,6 +524,24 @@ void avio_write_marker(AVIOContext *s, int64_t time, > enum AVIODataMarkerType typ > s->last_time = time; > } > > +static int read_packet_wrapper(AVIOContext *s, uint8_t *buf, int size) > +{ > +int ret; > + > +if (!s->read_packet) > +return AVERROR_EOF; > +ret = s->read_packet(s->opaque, buf, size); > +#if FF_API_OLD_AVIO_EOF_0 > +if (!ret && !s->max_packet_size) { Can you explain how you can utilize max_packet_size as a note regarding if zero is EOF or not? Is it just a variable that happens to be set to zero with custom AVIO contexts, or is there some other logic behind this? > +av_log(s, AV_LOG_WARNING, "Invalid return value 0 for stream > protocol\n"); > +ret = AVERROR_EOF; > +} > +#else > +av_assert2(ret || s->max_packet_size); > +#endif > +return ret; > +} > + > /* Input stream */ > > static void fill_buffer(AVIOContext *s) > @@ -562,10 +580,7 @@ static void fill_buffer(AVIOContext *s) > len = s->orig_buffer_size; > } > > -if (s->read_packet) > -len = s->read_packet(s->opaque, dst, len); > -else > -len = AVERROR_EOF; > +len = read_packet_wrapper(s, dst, len); > if (len == AVERROR_EOF) { > /* do not modify buffer if EOF reached so that a seek back can > be done without rereading data */ > @@ -638,10 +653,7 @@ int avio_read(AVIOContext *s, unsigned char *buf, int > size) > if (len == 0 || s->write_flag) { > if((s->direct || size > s->buffer_size) && !s->update_checksum) { > // bypass the buffer and read data directly into buf > -if(s->read_packet) > -len = s->read_packet(s->opaque, buf, size); > -else > -len = AVERROR_EOF; > +len = read_packet_wrapper(s, buf, size); > if (len == AVERROR_EOF) { > /* do not modify buffer if EOF reached so that a seek > back can > be done without rereading data */ > @@ -708,7 +720,7 @@ int avio_read_partial(AVIOContext *s, unsigned char *buf, > int size) > return -1; > > if (s->read_packet && s->write_flag) { > -len = s->read_packet(s->opaque, buf, size); > +len = read_packet_wrapper(s, buf, size); > if (len > 0) > s->pos += len; > return len; > diff --git a/libavformat/version.h b/libavformat/version.h > index 0feb788c36..358ab91ab2 100644 > --- a/libavformat/version.h > +++ b/libavformat/version.h > @@ -79,6 +79,9 @@ > #ifndef FF_API_OLD_ROTATE_API > #define FF_API_OLD_ROTATE_API (LIBAVFORMAT_VERSION_MAJOR < 59) > #endif > +#ifndef FF_API_OLD_AVIO_EOF_0 > +#define FF_API_OLD_AVIO_EOF_0 (LIBAVFORMAT_VERSION_MAJOR < 59) > +#endif > > > #ifndef FF_API_R_FRAME_RATE > -- > 2.14.2 Otherwise LGTM. Will test in a moment. Jan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/5] Cuvid/videotoolbox preparations
On 10/13/2017 1:59 PM, wm4 wrote: > These commits are required to merge Libav's cuvid hwaccel, and to > fix videotoolbox operation if frame threading is enabled. > > Anton Khirnov (4): > decode: avoid leaks on failure in ff_get_buffer() > decode: add a method for attaching lavc-internal data to frames > decode: add a mechanism for performing delayed processing on the > decoded frames > decode: add a per-frame private data for hwaccel use > > wm4 (1): > lavc/avrndec: remove AV_CODEC_CAP_DR1, as it's broken > > libavcodec/avrndec.c | 1 - > libavcodec/decode.c | 113 > ++- > libavcodec/decode.h | 40 +++ > libavcodec/h264dec.c | 5 +- > libavcodec/huffyuvdec.c | 3 +- > libavcodec/mpegutils.c | 4 +- > libavcodec/vp3.c | 3 +- > libavcodec/wrapped_avframe.c | 7 +++ > 8 files changed, 167 insertions(+), 9 deletions(-) Can we please find a way to get this thing moving instead of keeping it blocked indefinitely? I'll eventually reach this point in the merge queue and i don't want to find myself stuck again because two devs can't find a common ground. We have dozens of devs, many knowledgeable enough in this subject to chime in and tip the scales. So far one dev is against it (Michael) and two in favor (wm4 and Thilo). This needs the attention of more people. If a vote is needed then so be it, but for fucks sake, we really need to find solutions for this kind of discussions in a more timely manner. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/3] lavf/avio: temporarily accept 0 as EOF.
On Wed, Oct 25, 2017 at 11:22 AM, Nicolas George wrote: > +static int read_packet_wrapper(AVIOContext *s, uint8_t *buf, int size) > +{ > +int ret; > + > +if (!s->read_packet) > +return AVERROR_EOF; > +ret = s->read_packet(s->opaque, buf, size); > +#if FF_API_OLD_AVIO_EOF_0 > +if (!ret && !s->max_packet_size) { > +av_log(s, AV_LOG_WARNING, "Invalid return value 0 for stream > protocol\n"); > +ret = AVERROR_EOF; > +} > +#else > +av_assert2(ret || s->max_packet_size); > +#endif > +return ret; > +} > + Built and tested locally and the effect seems to be the one wished, although it seems like it is complaining about the AVClass being nullptr? Is this something inherent to custom AVIO contexts and it's the client that's supposed to fix this? Log follows: > [ffmpeg] av_log callback called with bad parameters (NULL AVClass). > [ffmpeg] This is a bug in one of Libav/FFmpeg libraries used. > [ffmpeg] Invalid return value 0 for stream protocol Jan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/3] lavf/avio: temporarily accept 0 as EOF.
Le sextidi 6 brumaire, an CCXXVI, Jan Ekstrom a écrit : > Built and tested locally and the effect seems to be the one wished, > although it seems like it is complaining about the AVClass being > nullptr? Is this something inherent to custom AVIO contexts and it's > the client that's supposed to fix this? Log follows: > > > [ffmpeg] av_log callback called with bad parameters (NULL AVClass). > > [ffmpeg] This is a bug in one of Libav/FFmpeg libraries used. > > [ffmpeg] Invalid return value 0 for stream protocol Thanks. It seems custom AVIOContext are not real AVIOContext in the full meaning, and there are glitches in fixing that. I have locally changed the log line: av_log(NULL, AV_LOG_WARNING, "Invalid Not completely satisfactory, but enough for a library-to-application warning. Shall I send the whole series again? Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/3] lavf/avio: temporarily accept 0 as EOF.
Le sextidi 6 brumaire, an CCXXVI, Jan Ekstrom a écrit : > Otherwise OK, but since this is the first mention of "stream protocol" > in the repo and el goog gives me just "Internet Stream Protocol" so I > would like an explanation of what this means and how it connects to > "custom AVIO implementations/wrappers"? It is standard parlance in networking: stream protocols produce a stream of octets, without any additional structure, while packet protocols produce packets, which are delimited at protocol level and visible by the application, and can be empty. FFmpeg distinguishes packet protocols with the max_packet_size: if it is 0, it is a stream protocol, if not a packet protocol. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/3] lavf/avio: temporarily accept 0 as EOF.
On Fri, Oct 27, 2017 at 9:33 PM, Nicolas George wrote: > It is standard parlance in networking: stream protocols produce a stream > of octets, without any additional structure, while packet protocols > produce packets, which are delimited at protocol level and visible by > the application, and can be empty. > Gotcha. Seems like it's called "/* default: stream file */" in the current code base, which is why I couldn't find references to stream protocols. > FFmpeg distinguishes packet protocols with the max_packet_size: if it is > 0, it is a stream protocol, if not a packet protocol. Gotcha^2. Please send the patch-set v2 with the related fixes (the av_log in 2/3 and the correct ret in 3/3) as with that I think this all looks good to go :) . Jan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: remove limit of max tile size
Le sextidi 6 brumaire, an CCXXVI, Paul B Mahol a écrit : > Signed-off-by: Paul B Mahol > --- > libavfilter/vf_tile.c | 12 ++-- > 1 file changed, 2 insertions(+), 10 deletions(-) Nack. This: ./ffmpeg_g -lavfi testsrc2=s=1024x32,tile=layout=65x1 -f framecrc - used to work, and no longer does with: "Total width 65x1024 is too much." Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/3] lavf/aviobuf: return EINVAL when reading from a write-only context.
Signed-off-by: Nicolas George --- libavformat/aviobuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index bfd40f5097..3b4c8439d6 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -529,7 +529,7 @@ static int read_packet_wrapper(AVIOContext *s, uint8_t *buf, int size) int ret; if (!s->read_packet) -return AVERROR_EOF; +return AVERROR(EINVAL); ret = s->read_packet(s->opaque, buf, size); #if FF_API_OLD_AVIO_EOF_0 if (!ret && !s->max_packet_size) { -- 2.14.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/5] Cuvid/videotoolbox preparations
Am 27.10.17 um 19:00 schrieb James Almer: > On 10/13/2017 1:59 PM, wm4 wrote: >> These commits are required to merge Libav's cuvid hwaccel, and to >> fix videotoolbox operation if frame threading is enabled. >> >> Anton Khirnov (4): >> decode: avoid leaks on failure in ff_get_buffer() >> decode: add a method for attaching lavc-internal data to frames >> decode: add a mechanism for performing delayed processing on the >> decoded frames >> decode: add a per-frame private data for hwaccel use >> >> wm4 (1): >> lavc/avrndec: remove AV_CODEC_CAP_DR1, as it's broken >> >> libavcodec/avrndec.c | 1 - >> libavcodec/decode.c | 113 >> ++- >> libavcodec/decode.h | 40 +++ >> libavcodec/h264dec.c | 5 +- >> libavcodec/huffyuvdec.c | 3 +- >> libavcodec/mpegutils.c | 4 +- >> libavcodec/vp3.c | 3 +- >> libavcodec/wrapped_avframe.c | 7 +++ >> 8 files changed, 167 insertions(+), 9 deletions(-) > > Can we please find a way to get this thing moving instead of keeping it > blocked indefinitely? I'll eventually reach this point in the merge > queue and i don't want to find myself stuck again because two devs can't > find a common ground. > > We have dozens of devs, many knowledgeable enough in this subject to > chime in and tip the scales. So far one dev is against it (Michael) and > two in favor (wm4 and Thilo). This needs the attention of more people. I'm not in favor of anything and never claimed to do so. Instead, I already said that I am not as familiar with that part of the code to dive into the discussion. I just offered to do the codemonkey on whatever shall finally be implemented - for the case it actually stalls for nobody willing to do so. > If a vote is needed then so be it, but for fucks sake, we really need to > find solutions for this kind of discussions in a more timely manner. Yes. -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/3] examples/avio_reading: return AVERROR_EOF at EOF.
Signed-off-by: Nicolas George --- doc/examples/avio_reading.c | 2 ++ 1 file changed, 2 insertions(+) Unchanged. diff --git a/doc/examples/avio_reading.c b/doc/examples/avio_reading.c index 02474e907a..7860fd5e2f 100644 --- a/doc/examples/avio_reading.c +++ b/doc/examples/avio_reading.c @@ -44,6 +44,8 @@ static int read_packet(void *opaque, uint8_t *buf, int buf_size) struct buffer_data *bd = (struct buffer_data *)opaque; buf_size = FFMIN(buf_size, bd->size); +if (!buf_size) +return AVERROR_EOF; printf("ptr:%p size:%zu\n", bd->ptr, bd->size); /* copy internal buffer data to buf */ -- 2.14.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/3] lavf/avio: temporarily accept 0 as EOF.
Print a warning to let applicatios fix their use. After a deprecation period, check with a low-level assert. Also make the constraint explicit in the doxygen comment. Signed-off-by: Nicolas George --- libavformat/avio.h| 2 ++ libavformat/aviobuf.c | 30 +- libavformat/version.h | 3 +++ 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index 19ecd96eb7..76ff7cd81e 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -452,6 +452,8 @@ void avio_free_directory_entry(AVIODirEntry **entry); * @param write_flag Set to 1 if the buffer should be writable, 0 otherwise. * @param opaque An opaque pointer to user-specific data. * @param read_packet A function for refilling the buffer, may be NULL. + * For stream protocols, must never return 0 but rather + * a proper AVERROR code. * @param write_packet A function for writing the buffer contents, may be NULL. *The function may not change the input buffers content. * @param seek A function for seeking to specified byte position, may be NULL. diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 3e9d774a13..bfd40f5097 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -524,6 +524,24 @@ void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType typ s->last_time = time; } +static int read_packet_wrapper(AVIOContext *s, uint8_t *buf, int size) +{ +int ret; + +if (!s->read_packet) +return AVERROR_EOF; +ret = s->read_packet(s->opaque, buf, size); +#if FF_API_OLD_AVIO_EOF_0 +if (!ret && !s->max_packet_size) { +av_log(NULL, AV_LOG_WARNING, "Invalid return value 0 for stream protocol\n"); +ret = AVERROR_EOF; +} +#else +av_assert2(ret || s->max_packet_size); +#endif +return ret; +} + /* Input stream */ static void fill_buffer(AVIOContext *s) @@ -562,10 +580,7 @@ static void fill_buffer(AVIOContext *s) len = s->orig_buffer_size; } -if (s->read_packet) -len = s->read_packet(s->opaque, dst, len); -else -len = AVERROR_EOF; +len = read_packet_wrapper(s, dst, len); if (len == AVERROR_EOF) { /* do not modify buffer if EOF reached so that a seek back can be done without rereading data */ @@ -638,10 +653,7 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size) if (len == 0 || s->write_flag) { if((s->direct || size > s->buffer_size) && !s->update_checksum) { // bypass the buffer and read data directly into buf -if(s->read_packet) -len = s->read_packet(s->opaque, buf, size); -else -len = AVERROR_EOF; +len = read_packet_wrapper(s, buf, size); if (len == AVERROR_EOF) { /* do not modify buffer if EOF reached so that a seek back can be done without rereading data */ @@ -708,7 +720,7 @@ int avio_read_partial(AVIOContext *s, unsigned char *buf, int size) return -1; if (s->read_packet && s->write_flag) { -len = s->read_packet(s->opaque, buf, size); +len = read_packet_wrapper(s, buf, size); if (len > 0) s->pos += len; return len; diff --git a/libavformat/version.h b/libavformat/version.h index ac409dbad2..0552f0c62c 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -76,6 +76,9 @@ #ifndef FF_API_OLD_ROTATE_API #define FF_API_OLD_ROTATE_API (LIBAVFORMAT_VERSION_MAJOR < 59) #endif +#ifndef FF_API_OLD_AVIO_EOF_0 +#define FF_API_OLD_AVIO_EOF_0 (LIBAVFORMAT_VERSION_MAJOR < 59) +#endif #ifndef FF_API_R_FRAME_RATE -- 2.14.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/3] lavf/avio: temporarily accept 0 as EOF.
On Fri, Oct 27, 2017 at 9:46 PM, Nicolas George wrote: > Print a warning to let applicatios fix their use. > After a deprecation period, check with a low-level assert. > Also make the constraint explicit in the doxygen comment. Difference to the previous version: > -av_log(s, AV_LOG_WARNING, "Invalid return value 0 for stream > protocol\n"); > +av_log(NULL, AV_LOG_WARNING, "Invalid return value 0 for stream > protocol\n"); Thus LGTM. Jan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3] lavf/aviobuf: return EINVAL when reading from a write-only context.
On Fri, Oct 27, 2017 at 9:46 PM, Nicolas George wrote: > Signed-off-by: Nicolas George > --- LGTM Jan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] examples/avio_reading: return AVERROR_EOF at EOF.
On Fri, Oct 27, 2017 at 9:46 PM, Nicolas George wrote: > Signed-off-by: Nicolas George LGTM Jan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: remove limit of max tile size
On 10/27/17, Nicolas George wrote: > Le sextidi 6 brumaire, an CCXXVI, Paul B Mahol a ecrit : >> Signed-off-by: Paul B Mahol >> --- >> libavfilter/vf_tile.c | 12 ++-- >> 1 file changed, 2 insertions(+), 10 deletions(-) > > Nack. > > This: > > ./ffmpeg_g -lavfi testsrc2=s=1024x32,tile=layout=65x1 -f framecrc - > > used to work, and no longer does with: "Total width 65x1024 is too > much." That is insane. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Fate/utvideo : add test for decoding and encoding
2017-10-26 21:52 GMT+02:00 Martin Vignali : > Hello, > > Patch in attach add tests for utvideodec > gradient prediction for rgba and yuv444 (rec 709) (not cover by fate test > for now) > > compare decoder, with original sample > > > > and add tests for utvideoenc for the 3 modes of YUV444 encoding > (decoding the 3 generate files, i obtain the same crc) > > Sample can be found here : > > https://we.tl/gvH8EhwhJ0 > > And need to be put inside : ./fate-suite/utvideo > > > can be test with > make fate-utvideoenc for encoding > > and > make fate-utvideo SAMPLES=fate-suite/ > for decoding > > > tested on os x (x86_64) > > Martin > Forget this patch, i will send a new patch with more cases Martin ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/wmv2dec: Check end of bitstream in parse_mb_skip() and ff_wmv2_decode_mb()
On Thu, Oct 26, 2017 at 02:20:28PM +0100, Derek Buitenhuis wrote: > On 10/26/2017 11:47 AM, Michael Niedermayer wrote: > > +if (get_bits_left(&s->gb) < 0) { > > +return AVERROR_INVALIDDATA; > > +} > > Is this possible? I don't see where get_bits.h is include > in this (probably deep in some other header), so can't see > if it's using the unchecked reader. get_bits.h is included from libavcodec/mpegvideo.h as it needs it ill send a better patch thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Observe your enemies, for they first find out your faults. -- Antisthenes signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] DASH manifest conformance (was: Re: [PATCH 0/7] dashenc fixes)
On Thu, 26 Oct 2017 18:32:57 +0200 Carl Eugen Hoyos wrote: > 2017-10-26 18:28 GMT+02:00 Peter Große : > > On Thu, 26 Oct 2017 18:07:55 +0200 > > Carl Eugen Hoyos wrote: > > > >> Did you test our dash muxer lately with some validation tool? > >> Errors were reported in the past. > > > > No official validation tool, no. > > The following was mentioned in the past iirc: > http://www-itec.uni-klu.ac.at/dash/?page_id=605 With the attached patch and checking against the current conformance XSD [1] instead of their "Standard XSD", I get a "Your DASH-MPD is VALID" logo. Regards Peter [1] https://github.com/Dash-Industry-Forum/Conformance-and-reference-source/blob/master/conformance/MPDValidator/schemas/DASH-MPD.xsd >From 7a731e2d0d1fd9c771b0cc2730a812e84ae9981e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Gro=C3=9Fe?= Date: Fri, 27 Oct 2017 21:18:47 +0200 Subject: [PATCH 1/1] dashenc: move UTCTiming element to the end of the manifest To: ffmpeg-devel@ffmpeg.org Required by comformance XSD [1]. [1] https://github.com/Dash-Industry-Forum/Conformance-and-reference-source/blob/master/conformance/MPDValidator/schemas/DASH-MPD.xsd --- libavformat/dashenc.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index d3b0464d79..8c216a3af8 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -647,8 +647,6 @@ static int write_manifest(AVFormatContext *s, int final) av_free(escaped); } avio_printf(out, "\t\n"); -if (c->utc_timing_url) -avio_printf(out, "\t\n", c->utc_timing_url); if (c->window_size && s->nb_streams > 0 && c->streams[0].nb_segments > 0 && !c->use_template) { OutputStream *os = &c->streams[0]; @@ -666,6 +664,10 @@ static int write_manifest(AVFormatContext *s, int final) return ret; } avio_printf(out, "\t\n"); + +if (c->utc_timing_url) +avio_printf(out, "\t\n", c->utc_timing_url); + avio_printf(out, "\n"); avio_flush(out); ff_format_io_close(s, &out); -- 2.13.6 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/wmv2dec: Check end of bitstream in parse_mb_skip() and ff_wmv2_decode_mb()
Fixes: Timeout Fixes: 3200/clusterfuzz-testcase-5750022136135680 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/wmv2dec.c | 18 -- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c index 261d291c97..ea0e0594b5 100644 --- a/libavcodec/wmv2dec.c +++ b/libavcodec/wmv2dec.c @@ -30,7 +30,7 @@ #include "wmv2.h" -static void parse_mb_skip(Wmv2Context *w) +static int parse_mb_skip(Wmv2Context *w) { int mb_x, mb_y; MpegEncContext *const s = &w->s; @@ -45,6 +45,8 @@ static void parse_mb_skip(Wmv2Context *w) MB_TYPE_16x16 | MB_TYPE_L0; break; case SKIP_TYPE_MPEG: +if (get_bits_left(&s->gb) < s->mb_height * s->mb_width) +return AVERROR_INVALIDDATA; for (mb_y = 0; mb_y < s->mb_height; mb_y++) for (mb_x = 0; mb_x < s->mb_width; mb_x++) mb_type[mb_y * s->mb_stride + mb_x] = @@ -52,6 +54,8 @@ static void parse_mb_skip(Wmv2Context *w) break; case SKIP_TYPE_ROW: for (mb_y = 0; mb_y < s->mb_height; mb_y++) { +if (get_bits_left(&s->gb) < 1) +return AVERROR_INVALIDDATA; if (get_bits1(&s->gb)) { for (mb_x = 0; mb_x < s->mb_width; mb_x++) mb_type[mb_y * s->mb_stride + mb_x] = @@ -65,6 +69,8 @@ static void parse_mb_skip(Wmv2Context *w) break; case SKIP_TYPE_COL: for (mb_x = 0; mb_x < s->mb_width; mb_x++) { +if (get_bits_left(&s->gb) < 1) +return AVERROR_INVALIDDATA; if (get_bits1(&s->gb)) { for (mb_y = 0; mb_y < s->mb_height; mb_y++) mb_type[mb_y * s->mb_stride + mb_x] = @@ -77,6 +83,7 @@ static void parse_mb_skip(Wmv2Context *w) } break; } +return 0; } static int decode_ext_header(Wmv2Context *w) @@ -170,9 +177,12 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s) } } else { int cbp_index; +int ret; w->j_type = 0; -parse_mb_skip(w); +ret = parse_mb_skip(w); +if (ret < 0) +return ret; cbp_index = decode012(&s->gb); w->cbp_table_index = wmv2_get_cbp_table_index(s, cbp_index); @@ -359,6 +369,8 @@ int ff_wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64]) w->hshift = 0; return 0; } +if (get_bits_left(&s->gb) <= 0) +return AVERROR_INVALIDDATA; code = get_vlc2(&s->gb, ff_mb_non_intra_vlc[w->cbp_table_index].table, MB_NON_INTRA_VLC_BITS, 3); @@ -369,6 +381,8 @@ int ff_wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64]) cbp = code & 0x3f; } else { s->mb_intra = 1; +if (get_bits_left(&s->gb) <= 0) +return AVERROR_INVALIDDATA; code = get_vlc2(&s->gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2); if (code < 0) { av_log(s->avctx, AV_LOG_ERROR, -- 2.14.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avfilter: initial macroblock types export and visualization
Signed-off-by: Paul B Mahol --- libavcodec/mpegvideo.c | 10 + libavfilter/vf_codecview.c | 105 + libavutil/frame.h | 4 ++ 3 files changed, 119 insertions(+) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 2f5793b9a4..ce6108d094 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -1603,6 +1603,16 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_ } } +if (mb_height && mb_width) { +AVFrameSideData *sd; + +av_log(avctx, AV_LOG_DEBUG, "Adding %d MB types info to frame %d\n", mb_width * mb_height, avctx->frame_number); +sd = av_frame_new_side_data(pict, AV_FRAME_DATA_MACROBLOCK_TYPES, mb_width * mb_height * sizeof(uint32_t)); +if (!sd) +return; +memcpy(sd->data, mbtype_table, mb_width * mb_height * sizeof(uint32_t)); +} + #if FF_API_DEBUG_MV if ((avctx->debug & (FF_DEBUG_VIS_QP | FF_DEBUG_VIS_MB_TYPE)) || (avctx->debug_mv)) { diff --git a/libavfilter/vf_codecview.c b/libavfilter/vf_codecview.c index 331bfba777..40fb8dfb7a 100644 --- a/libavfilter/vf_codecview.c +++ b/libavfilter/vf_codecview.c @@ -29,6 +29,7 @@ * TODO: segmentation */ +#include "libavutil/avassert.h" #include "libavutil/imgutils.h" #include "libavutil/motion_vector.h" #include "libavutil/opt.h" @@ -44,9 +45,23 @@ #define FRAME_TYPE_P (1<<1) #define FRAME_TYPE_B (1<<2) +#define IS_PCM(a) ((a) & (1 << 2)) +#define IS_INTRA(a) ((a) & 7) +#define IS_ACPRED(a)((a) & (1 << 9)) +#define IS_INTRA16x16(a)((a) & (1 << 1)) +#define IS_INTRA4x4(a) ((a) & (1 << 0)) +#define IS_DIRECT(a)((a) & (1 << 8)) +#define IS_SKIP(a) ((a) & (1 << 11)) +#define IS_GMC(a) ((a) & (1 << 10)) +#define USES_LIST(a, list) ((a) & (((1 << 12) | (1 << 13)) << (2 * (list +#define IS_8X8(a) ((a) & ((1 << 6))) +#define IS_16X8(a) ((a) & ((1 << 4))) +#define IS_8X16(a) ((a) & ((1 << 5))) + typedef struct CodecViewContext { const AVClass *class; unsigned mv; +unsigned mbtypes; unsigned frame_type; unsigned mv_type; int hsub, vsub; @@ -72,6 +87,7 @@ static const AVOption codecview_options[] = { CONST("if", "I-frames", FRAME_TYPE_I, "frame_type"), CONST("pf", "P-frames", FRAME_TYPE_P, "frame_type"), CONST("bf", "B-frames", FRAME_TYPE_B, "frame_type"), +{ "mb", "visualize macroblock types", OFFSET(mbtypes), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS, }, { NULL } }; @@ -277,6 +293,95 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) } } +if (s->mbtypes) { +AVFrameSideData *sd = av_frame_get_side_data(frame, AV_FRAME_DATA_MACROBLOCK_TYPES); +if (sd) { +int mb_height = (frame->height + 31) / 32 * 2; +int mb_width = (frame->width + 15) / 16; +int block_height = 16 >> 1; +int mb_stride = mb_width + 1; +int mb_y, mb_x; +uint32_t *mbtype_table = (uint32_t *)sd->data; + +for (mb_y = 0; mb_y < mb_height; mb_y++) { +for (mb_x = 0; mb_x < mb_width; mb_x++) { +const int mb_index = mb_x + mb_y * mb_stride; + /*{ +uint64_t c = (qscale_table[mb_index] * 128 / 31) * + 0x0101010101010101ULL; +int y; +for (y = 0; y < block_height; y++) { +*(uint64_t *)(frame->data[1] + 8 * mb_x + + (block_height * mb_y + y) * + frame->linesize[1]) = c; +*(uint64_t *)(frame->data[2] + 8 * mb_x + + (block_height * mb_y + y) * + frame->linesize[2]) = c; +} +} */ +{ +int mb_type = mbtype_table[mb_index]; +uint64_t u,v; +int y; + +#define COLOR(theta, r) \ +u = (int)(128 + r * cos(theta * M_PI / 180)); \ +v = (int)(128 + r * sin(theta * M_PI / 180)); + +u = v = 128; +if (IS_PCM(mb_type)) { +COLOR(120, 48) +} else if ((IS_INTRA(mb_type) && IS_ACPRED(mb_type)) || + IS_INTRA16x16(mb_type)) { +COLOR(30, 48) +} else if (IS_INTRA4x4(mb_type)) { +COLOR(90, 48) +} else if (IS_DIRECT(mb_type) && IS_SKIP(mb_type)) { +COLOR(120, 48) +} else if (IS_DIRECT(mb_type)) { +COLOR(150, 4
[FFmpeg-devel] [PATCH] avfilter/vf_tile: remove limit of max tile size
Signed-off-by: Paul B Mahol --- libavfilter/vf_tile.c | 8 1 file changed, 8 deletions(-) diff --git a/libavfilter/vf_tile.c b/libavfilter/vf_tile.c index 87e0b940cf..a0bfb31338 100644 --- a/libavfilter/vf_tile.c +++ b/libavfilter/vf_tile.c @@ -44,8 +44,6 @@ typedef struct TileContext { uint8_t rgba_color[4]; } TileContext; -#define REASONABLE_SIZE 1024 - #define OFFSET(x) offsetof(TileContext, x) #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM @@ -68,12 +66,6 @@ static av_cold int init(AVFilterContext *ctx) { TileContext *tile = ctx->priv; -if (tile->w > REASONABLE_SIZE || tile->h > REASONABLE_SIZE) { -av_log(ctx, AV_LOG_ERROR, "Tile size %ux%u is insane.\n", - tile->w, tile->h); -return AVERROR(EINVAL); -} - if (tile->nb_frames == 0) { tile->nb_frames = tile->w * tile->h; } else if (tile->nb_frames > tile->w * tile->h) { -- 2.11.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: remove limit of max tile size
Le sextidi 6 brumaire, an CCXXVI, Paul B Mahol a écrit : > Signed-off-by: Paul B Mahol > --- > libavfilter/vf_tile.c | 8 > 1 file changed, 8 deletions(-) Nack. ./ffmpeg_g -lavfi testsrc2=s=2x2,tile=65536x65536,scale=1024x1024 -f framecrc - hangs instead of returning a proper error. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] fate: change fate-ffmpeg-attached_pics to encode to pcm_s16le
Previously alac encoder was used, from a first glance I thought it is bitexact, but it turns out it is using floating point arithmetic as well, so probably it is not. Fixes fate failures on mingw32/64. Signed-off-by: Marton Balint --- tests/fate/ffmpeg.mak | 4 +- tests/ref/fate/ffmpeg-attached_pics | 259 ++-- 2 files changed, 131 insertions(+), 132 deletions(-) diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak index a806c05d45..9a822f64bb 100644 --- a/tests/fate/ffmpeg.mak +++ b/tests/fate/ffmpeg.mak @@ -31,8 +31,8 @@ FATE_FFMPEG-$(call ALLYES, AEVALSRC_FILTER ASETNSAMPLES_FILTER AC3_FIXED_ENCODER fate-ffmpeg-filter_complex_audio: CMD = framecrc -filter_complex "aevalsrc=0:d=0.1,asetnsamples=1537" -c ac3_fixed # Ticket 6375 -FATE_SAMPLES_FFMPEG-$(call ALLYES, MOV_DEMUXER PNG_DECODER ALAC_DECODER ALAC_ENCODER) += fate-ffmpeg-attached_pics -fate-ffmpeg-attached_pics: CMD = threads=2 framecrc -i $(TARGET_SAMPLES)/lossless-audio/inside.m4a -acodec alac -max_muxing_queue_size 16 +FATE_SAMPLES_FFMPEG-$(call ALLYES, MOV_DEMUXER PNG_DECODER ALAC_DECODER PCM_S16LE_ENCODER RAWVIDEO_ENCODER) += fate-ffmpeg-attached_pics +fate-ffmpeg-attached_pics: CMD = threads=2 framecrc -i $(TARGET_SAMPLES)/lossless-audio/inside.m4a -acodec pcm_s16le -max_muxing_queue_size 16 FATE_SAMPLES_FFMPEG-$(CONFIG_COLORKEY_FILTER) += fate-ffmpeg-filter_colorkey fate-ffmpeg-filter_colorkey: tests/data/filtergraphs/colorkey diff --git a/tests/ref/fate/ffmpeg-attached_pics b/tests/ref/fate/ffmpeg-attached_pics index 3a0f151819..ee2f20638e 100644 --- a/tests/ref/fate/ffmpeg-attached_pics +++ b/tests/ref/fate/ffmpeg-attached_pics @@ -1,4 +1,3 @@ -#extradata 1: 36, 0x45f80468 #tb 0: 1/9 #media_type 0: video #codec_id 0: rawvideo @@ -6,136 +5,136 @@ #sar 0: 2834/2834 #tb 1: 1/44100 #media_type 1: audio -#codec_id 1: alac +#codec_id 1: pcm_s16le #sample_rate 1: 44100 #channel_layout 1: 3 #channel_layout_name 1: stereo 0, 0, 0,0, 12, 0x748cc771 -1, 0, 0, 4096, 32, 0x204b0676 -1, 4096, 4096, 4096, 5826, 0x56583236 -1, 8192, 8192, 4096, 5532, 0x5f047492 -1, 12288, 12288, 4096, 5245, 0xaa3f1897 -1, 16384, 16384, 4096, 4782, 0x392f3ac3 -1, 20480, 20480, 4096, 4602, 0x9bd6ffad -1, 24576, 24576, 4096, 4357, 0x5df6530b -1, 28672, 28672, 4096, 7443, 0x38ce542b -1, 32768, 32768, 4096, 5803, 0x196ae519 -1, 36864, 36864, 4096, 5619, 0xd436cd94 -1, 40960, 40960, 4096, 4896, 0x42df7109 -1, 45056, 45056, 4096, 4755, 0xfbfdfd5f -1, 49152, 49152, 4096, 4597, 0x93f3ce66 -1, 53248, 53248, 4096, , 0x56ffe620 -1, 57344, 57344, 4096, 5498, 0xa0865dc8 -1, 61440, 61440, 4096, 5343, 0x42134619 -1, 65536, 65536, 4096, 6261, 0xd60d1379 -1, 69632, 69632, 4096, 4496, 0x0eb49c68 -1, 73728, 73728, 4096, 4336, 0x21d541bd -1, 77824, 77824, 4096, 8395, 0x02030a38 -1, 81920, 81920, 4096, 8174, 0x47bdb71d -1, 86016, 86016, 4096, 7434, 0x2304318e -1, 90112, 90112, 4096, 7619, 0x80e6a037 -1, 94208, 94208, 4096, 6086, 0xd3438d2f -1, 98304, 98304, 4096, 6075, 0xd6019fbf -1, 102400, 102400, 4096, 9597, 0x28f46a38 -1, 106496, 106496, 4096,10287, 0x9dbf0938 -1, 110592, 110592, 4096,10537, 0xc417fb81 -1, 114688, 114688, 4096,10360, 0xc580caa3 -1, 118784, 118784, 4096, 9778, 0xb9c2d3e5 -1, 122880, 122880, 4096,10307, 0x05b1b271 -1, 126976, 126976, 4096,11289, 0x97f07c63 -1, 131072, 131072, 4096,11561, 0x8a45194a -1, 135168, 135168, 4096,11327, 0x86587829 -1, 139264, 139264, 4096,11347, 0x15659d6e -1, 143360, 143360, 4096,11006, 0x9a002c7f -1, 147456, 147456, 4096,11147, 0x853955e0 -1, 151552, 151552, 4096,11025, 0x7bdafbda -1, 155648, 155648, 4096,11561, 0x2ec43d86 -1, 159744, 159744, 4096,11329, 0x6eaba39a -1, 163840, 163840, 4096,10886, 0x5c31b777 -1, 167936, 167936, 4096,11505, 0xcd7f2b9a -1, 172032, 172032, 4096,11243, 0xa1cb6c83 -1, 176128, 176128, 4096,11718, 0x5b0d6e74 -1, 180224, 180224, 4096,11898, 0xa649ca9a -1, 184320, 184320, 4096,11358, 0x037bc2f4 -1, 188416, 188416, 4096,10864, 0x9239d22f -1, 192512, 192512, 4096,12181, 0xd5c24fba -1, 196608, 196608, 4096,11551, 0xa0d8c8d1 -1, 200704, 200704, 4096,1
Re: [FFmpeg-devel] [PATCH] fate: change fate-ffmpeg-attached_pics to encode to pcm_s16le
On 10/27/2017 5:54 PM, Marton Balint wrote: > Previously alac encoder was used, from a first glance I thought it is > bitexact, > but it turns out it is using floating point arithmetic as well, so probably it > is not. Fixes fate failures on mingw32/64. > > Signed-off-by: Marton Balint > --- > tests/fate/ffmpeg.mak | 4 +- > tests/ref/fate/ffmpeg-attached_pics | 259 > ++-- > 2 files changed, 131 insertions(+), 132 deletions(-) > > diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak > index a806c05d45..9a822f64bb 100644 > --- a/tests/fate/ffmpeg.mak > +++ b/tests/fate/ffmpeg.mak > @@ -31,8 +31,8 @@ FATE_FFMPEG-$(call ALLYES, AEVALSRC_FILTER > ASETNSAMPLES_FILTER AC3_FIXED_ENCODER > fate-ffmpeg-filter_complex_audio: CMD = framecrc -filter_complex > "aevalsrc=0:d=0.1,asetnsamples=1537" -c ac3_fixed > > # Ticket 6375 > -FATE_SAMPLES_FFMPEG-$(call ALLYES, MOV_DEMUXER PNG_DECODER ALAC_DECODER > ALAC_ENCODER) += fate-ffmpeg-attached_pics > -fate-ffmpeg-attached_pics: CMD = threads=2 framecrc -i > $(TARGET_SAMPLES)/lossless-audio/inside.m4a -acodec alac > -max_muxing_queue_size 16 > +FATE_SAMPLES_FFMPEG-$(call ALLYES, MOV_DEMUXER PNG_DECODER ALAC_DECODER > PCM_S16LE_ENCODER RAWVIDEO_ENCODER) += fate-ffmpeg-attached_pics > +fate-ffmpeg-attached_pics: CMD = threads=2 framecrc -i > $(TARGET_SAMPLES)/lossless-audio/inside.m4a -acodec pcm_s16le > -max_muxing_queue_size 16 Change -acodec to -c:a while at it. Why is the ticket #6375 still open? If this is a test for said regression, i assume it was fixed? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] fate: change fate-ffmpeg-attached_pics to encode to pcm_s16le
On Fri, 27 Oct 2017, James Almer wrote: On 10/27/2017 5:54 PM, Marton Balint wrote: Previously alac encoder was used, from a first glance I thought it is bitexact, but it turns out it is using floating point arithmetic as well, so probably it is not. Fixes fate failures on mingw32/64. Signed-off-by: Marton Balint --- tests/fate/ffmpeg.mak | 4 +- tests/ref/fate/ffmpeg-attached_pics | 259 ++-- 2 files changed, 131 insertions(+), 132 deletions(-) diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak index a806c05d45..9a822f64bb 100644 --- a/tests/fate/ffmpeg.mak +++ b/tests/fate/ffmpeg.mak @@ -31,8 +31,8 @@ FATE_FFMPEG-$(call ALLYES, AEVALSRC_FILTER ASETNSAMPLES_FILTER AC3_FIXED_ENCODER fate-ffmpeg-filter_complex_audio: CMD = framecrc -filter_complex "aevalsrc=0:d=0.1,asetnsamples=1537" -c ac3_fixed # Ticket 6375 -FATE_SAMPLES_FFMPEG-$(call ALLYES, MOV_DEMUXER PNG_DECODER ALAC_DECODER ALAC_ENCODER) += fate-ffmpeg-attached_pics -fate-ffmpeg-attached_pics: CMD = threads=2 framecrc -i $(TARGET_SAMPLES)/lossless-audio/inside.m4a -acodec alac -max_muxing_queue_size 16 +FATE_SAMPLES_FFMPEG-$(call ALLYES, MOV_DEMUXER PNG_DECODER ALAC_DECODER PCM_S16LE_ENCODER RAWVIDEO_ENCODER) += fate-ffmpeg-attached_pics +fate-ffmpeg-attached_pics: CMD = threads=2 framecrc -i $(TARGET_SAMPLES)/lossless-audio/inside.m4a -acodec pcm_s16le -max_muxing_queue_size 16 Change -acodec to -c:a while at it. Ok, will do. Why is the ticket #6375 still open? If this is a test for said regression, i assume it was fixed? The ticket contains reports from more than one user, only the use case of "NoX" is fixed. Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] compile errors on current master - libavcodec/audiotoolboxdec.c
Getting the following compile errors. I got this just now with current master when I tried to compile today's snapshot... 2 days ago, all was good. libavcodec/audiotoolboxdec.c:353:9: error: use of undeclared identifier 'AC3HeaderInfo' AC3HeaderInfo hdr; ^ libavcodec/audiotoolboxdec.c:354:9: error: unknown type name 'GetBitContext'; did you mean 'GetByteContext'? GetBitContext gbc; ^ GetByteContext libavcodec/bytestream.h:35:3: note: 'GetByteContext' declared here } GetByteContext; ^ libavcodec/audiotoolboxdec.c:355:9: error: implicit declaration of function 'init_get_bits' is invalid in C99 [-Werror,-Wimplicit-function-declaration] init_get_bits(&gbc, pkt->data, pkt->size); ^ libavcodec/audiotoolboxdec.c:356:13: error: implicit declaration of function 'ff_ac3_parse_header' is invalid in C99 [-Werror,-Wimplicit-function-declaration] if (ff_ac3_parse_header(&gbc, &hdr) < 0) ^ libavcodec/audiotoolboxdec.c:356:13: note: did you mean 'av_ac3_parse_header'? libavcodec/ac3_parser.h:32:5: note: 'av_ac3_parse_header' declared here int av_ac3_parse_header(const uint8_t *buf, size_t size, ^ libavcodec/audiotoolboxdec.c:356:40: error: use of undeclared identifier 'hdr' if (ff_ac3_parse_header(&gbc, &hdr) < 0) ^ libavcodec/audiotoolboxdec.c:358:33: error: use of undeclared identifier 'hdr' in_format.mSampleRate = hdr.sample_rate; ^ libavcodec/audiotoolboxdec.c:359:39: error: use of undeclared identifier 'hdr' in_format.mChannelsPerFrame = hdr.channels; ^ libavcodec/audiotoolboxdec.c:360:29: error: use of undeclared identifier 'hdr' avctx->frame_size = hdr.num_blocks * 256; ^ libavcodec/audiotoolboxdec.c:361:27: error: use of undeclared identifier 'hdr' avctx->bit_rate = hdr.bit_rate; ^ -- regards Helmut K. C. Tessarek KeyID 0xF7832007C11F128D Key fingerprint = 28A3 1666 4FE8 D72C CFD5 8B23 F783 2007 C11F 128D /* Thou shalt not follow the NULL pointer for chaos and madness await thee at its end. */ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] compile errors on current master - libavcodec/audiotoolboxdec.c
On 10/27/2017 7:38 PM, Helmut K. C. Tessarek wrote: > Getting the following compile errors. I got this just now with current > master when I tried to compile today's snapshot... > > 2 days ago, all was good. Should be fixed, sorry about that. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] compile errors on current master - libavcodec/audiotoolboxdec.c
On 2017-10-27 18:42, James Almer wrote: > Should be fixed, sorry about that. No worries, thanks for the fix. -- regards Helmut K. C. Tessarek KeyID 0xF7832007C11F128D Key fingerprint = 28A3 1666 4FE8 D72C CFD5 8B23 F783 2007 C11F 128D /* Thou shalt not follow the NULL pointer for chaos and madness await thee at its end. */ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/7] dashenc: fix bitrate estimation with correct scaling
On Thu, Oct 26, 2017 at 05:58:34PM +0200, Peter Große wrote: > From: Anton Schubert > > Signed-off-by: Anton Schubert > --- > libavformat/dashenc.c | 5 - > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c > index 240ff41380..a4b37403d6 100644 > --- a/libavformat/dashenc.c > +++ b/libavformat/dashenc.c > @@ -953,6 +953,7 @@ static int dash_flush(AVFormatContext *s, int final, int > stream) > > for (i = 0; i < s->nb_streams; i++) { > OutputStream *os = &c->streams[i]; > +AVStream *st = s->streams[i]; > char filename[1024] = "", full_path[1024], temp_path[1024]; > int range_length, index_length = 0; > > @@ -1007,7 +1008,9 @@ static int dash_flush(AVFormatContext *s, int final, > int stream) > > if (!os->bit_rate) { > // calculate average bitrate of first segment > -int64_t bitrate = (int64_t) range_length * 8 * AV_TIME_BASE / > (os->max_pts - os->start_pts); > +int64_t bitrate = (int64_t) range_length * 8 * AV_TIME_BASE / > av_rescale_q(os->max_pts - os->start_pts, > + > st->time_base, > + > AV_TIME_BASE_Q); this looks like it does scaling twice (AV_TIME_BASE) is that intended ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Avoid a single point of failure, be that a person or equipment. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/7] dashenc: use av_dict_set_int instead of static function
On Thu, Oct 26, 2017 at 05:58:35PM +0200, Peter Große wrote: > Signed-off-by: Peter Große > --- > libavformat/dashenc.c | 12 ++-- > 1 file changed, 2 insertions(+), 10 deletions(-) will apply thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The worst form of inequality is to try to make unequal things equal. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/7] dashenc fixes
On Thu, Oct 26, 2017 at 06:28:43PM +0200, Peter Große wrote: > On Thu, 26 Oct 2017 18:07:55 +0200 > Carl Eugen Hoyos wrote: > > > Did you test our dash muxer lately with some validation tool? > > Errors were reported in the past. > > No official validation tool, no. > > I tried to get remuxing working with a pre-encoded multi-bitrate mkv file, > but the official reference player [1] wasn't able to play the stream without > patch 1 and 7. > > Patch 3 is inspired by the ffmpeg webm_chunk muxer and fixes that all tracks > have the same track number. > > Patch 6 is a minor fix regarding section "3.2.4. Presence of Attributes and > Element" of the "Guidelines for Implementation: DASH-IF Interoperability > Points > V4.1" [2] these things could be added to the commit messages otherwise the patchset LGTM [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User questions about the command line tools should be sent to the ffmpeg-user ML. And questions about how to use libav* should be sent to the libav-user ML. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avutil/frame: deprecate getters and setters for AVFrame fields
On 10/23/2017 11:13 AM, James Almer wrote: > The fields can be accessed directly, so these are not needed anymore. > > Signed-off-by: James Almer > --- > libavutil/frame.c | 2 ++ > libavutil/frame.h | 26 ++ > libavutil/version.h | 3 +++ > 3 files changed, 31 insertions(+) > > diff --git a/libavutil/frame.c b/libavutil/frame.c > index 09dd98a6b5..982fbb5c81 100644 > --- a/libavutil/frame.c > +++ b/libavutil/frame.c > @@ -31,6 +31,7 @@ static AVFrameSideData *frame_new_side_data(AVFrame *frame, > enum AVFrameSideDataType type, > AVBufferRef *buf); > > +#if FF_API_FRAME_GET_SET > MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp) > MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration) > MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos) > @@ -42,6 +43,7 @@ MAKE_ACCESSORS(AVFrame, frame, int, decode_error_flags) > MAKE_ACCESSORS(AVFrame, frame, int, pkt_size) > MAKE_ACCESSORS(AVFrame, frame, enum AVColorSpace, colorspace) > MAKE_ACCESSORS(AVFrame, frame, enum AVColorRange, color_range) > +#endif > > #define CHECK_CHANNELS_CONSISTENCY(frame) \ > av_assert2(!(frame)->channel_layout || \ > diff --git a/libavutil/frame.h b/libavutil/frame.h > index fef558ea2f..0c6aab1c02 100644 > --- a/libavutil/frame.h > +++ b/libavutil/frame.h > @@ -565,36 +565,62 @@ typedef struct AVFrame { > */ > } AVFrame; > > +#if FF_API_FRAME_GET_SET > /** > * Accessors for some AVFrame fields. These used to be provided for ABI > * compatibility, and do not need to be used anymore. > */ > +attribute_deprecated > int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame); > +attribute_deprecated > voidav_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val); > +attribute_deprecated > int64_t av_frame_get_pkt_duration (const AVFrame *frame); > +attribute_deprecated > voidav_frame_set_pkt_duration (AVFrame *frame, int64_t val); > +attribute_deprecated > int64_t av_frame_get_pkt_pos (const AVFrame *frame); > +attribute_deprecated > voidav_frame_set_pkt_pos (AVFrame *frame, int64_t val); > +attribute_deprecated > int64_t av_frame_get_channel_layout (const AVFrame *frame); > +attribute_deprecated > voidav_frame_set_channel_layout (AVFrame *frame, int64_t val); > +attribute_deprecated > int av_frame_get_channels (const AVFrame *frame); > +attribute_deprecated > voidav_frame_set_channels (AVFrame *frame, int val); > +attribute_deprecated > int av_frame_get_sample_rate (const AVFrame *frame); > +attribute_deprecated > voidav_frame_set_sample_rate (AVFrame *frame, int val); > +attribute_deprecated > AVDictionary *av_frame_get_metadata (const AVFrame *frame); > +attribute_deprecated > void av_frame_set_metadata (AVFrame *frame, AVDictionary > *val); > +attribute_deprecated > int av_frame_get_decode_error_flags (const AVFrame *frame); > +attribute_deprecated > voidav_frame_set_decode_error_flags (AVFrame *frame, int val); > +attribute_deprecated > int av_frame_get_pkt_size(const AVFrame *frame); > +attribute_deprecated > voidav_frame_set_pkt_size(AVFrame *frame, int val); > #if FF_API_FRAME_QP > +attribute_deprecated > int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type); > +attribute_deprecated > int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int > type); > #endif > +attribute_deprecated > enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame); > +attribute_deprecated > voidav_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val); > +attribute_deprecated > enum AVColorRange av_frame_get_color_range(const AVFrame *frame); > +attribute_deprecated > voidav_frame_set_color_range(AVFrame *frame, enum AVColorRange val); > +#endif > > /** > * Get the name of a colorspace. > diff --git a/libavutil/version.h b/libavutil/version.h > index aa56ad2fbd..7b4ae9beab 100644 > --- a/libavutil/version.h > +++ b/libavutil/version.h > @@ -136,6 +136,9 @@ > #ifndef FF_API_CRYPTO_SIZE_T > #define FF_API_CRYPTO_SIZE_T(LIBAVUTIL_VERSION_MAJOR < 57) > #endif > +#ifndef FF_API_FRAME_GET_SET > +#define FF_API_FRAME_GET_SET(LIBAVUTIL_VERSION_MAJOR < 57) > +#endif > > > /** Ping. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] avformat: move public AVStream fields up in the struct
On 10/23/2017 1:08 PM, James Almer wrote: > Remove the silly second notice. > > Signed-off-by: James Almer > --- > libavformat/avformat.h | 65 > ++ > 1 file changed, 28 insertions(+), 37 deletions(-) > > diff --git a/libavformat/avformat.h b/libavformat/avformat.h > index ece1b179f3..7594277f06 100644 > --- a/libavformat/avformat.h > +++ b/libavformat/avformat.h > @@ -980,6 +980,34 @@ typedef struct AVStream { > int event_flags; > #define AVSTREAM_EVENT_FLAG_METADATA_UPDATED 0x0001 ///< The call resulted > in updated metadata. > > +/** > + * Real base framerate of the stream. > + * This is the lowest framerate with which all timestamps can be > + * represented accurately (it is the least common multiple of all > + * framerates in the stream). Note, this value is just a guess! > + * For example, if the time base is 1/9 and all frames have either > + * approximately 3600 or 1800 timer ticks, then r_frame_rate will be > 50/1. > + */ > +AVRational r_frame_rate; > + > +/** > + * String containing paris of key and values describing recommended > encoder configuration. > + * Paris are separated by ','. > + * Keys are separated from values by '='. > + */ > +char *recommended_encoder_configuration; > + > +/** > + * Codec parameters associated with this stream. Allocated and freed by > + * libavformat in avformat_new_stream() and avformat_free_context() > + * respectively. > + * > + * - demuxing: filled by libavformat on stream creation or in > + * avformat_find_stream_info() > + * - muxing: filled by the caller before avformat_write_header() > + */ > +AVCodecParameters *codecpar; > + > /* > * All fields below this line are not part of the public API. They > * may not be used outside of libavformat and can be changed and > @@ -1064,19 +1092,6 @@ typedef struct AVStream { > int nb_index_entries; > unsigned int index_entries_allocated_size; > > -/** > - * Real base framerate of the stream. > - * This is the lowest framerate with which all timestamps can be > - * represented accurately (it is the least common multiple of all > - * framerates in the stream). Note, this value is just a guess! > - * For example, if the time base is 1/9 and all frames have either > - * approximately 3600 or 1800 timer ticks, then r_frame_rate will be > 50/1. > - * > - * Code outside avformat should access this field using: > - * av_stream_get/set_r_frame_rate(stream) > - */ > -AVRational r_frame_rate; > - > /** > * Stream Identifier > * This is the MPEG-TS stream identifier +1 > @@ -1182,19 +1197,6 @@ typedef struct AVStream { > */ > int inject_global_side_data; > > -/* > - * All fields above this line are not part of the public API. > - * Fields below are part of the public API and ABI again. > - * > - */ > - > -/** > - * String containing paris of key and values describing recommended > encoder configuration. > - * Paris are separated by ','. > - * Keys are separated from values by '='. > - */ > -char *recommended_encoder_configuration; > - > /** > * display aspect ratio (0 if unknown) > * - encoding: unused > @@ -1209,17 +1211,6 @@ typedef struct AVStream { > * Must not be accessed in any way by callers. > */ > AVStreamInternal *internal; > - > -/* > - * Codec parameters associated with this stream. Allocated and freed by > - * libavformat in avformat_new_stream() and avformat_free_context() > - * respectively. > - * > - * - demuxing: filled by libavformat on stream creation or in > - * avformat_find_stream_info() > - * - muxing: filled by the caller before avformat_write_header() > - */ > -AVCodecParameters *codecpar; > } AVStream; > > AVRational av_stream_get_r_frame_rate(const AVStream *s); Ping. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v4 2/2 ] avformat/mpegts: opus demuxing for mapping family 255
From 07708cda56bf59606b143db65359de6c0a058ce8 Mon Sep 17 00:00:00 2001 From: pkviet Date: Sat, 28 Oct 2017 02:48:39 +0200 Subject: [PATCH 2/2] libavf/mpegts: opus demuxing for mapping family 255 Adds to mpegts muxer the capability to demux libopus with mapping family 255, following the provisional spec for opus in mepg-ts (https://people.xiph.org/~tterribe/opus/ETSI_TS_opus-v0.1.3-draft.doc). Signed-off-by: pkviet --- libavformat/mpegts.c | 84 +++- 1 file changed, 70 insertions(+), 14 deletions(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 53cbcfb..b6384a0 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -37,6 +37,7 @@ #include "avio_internal.h" #include "mpeg.h" #include "isom.h" +#include "math.h" /* maximum size in which we look for synchronization if * synchronization is lost */ @@ -1633,7 +1634,7 @@ static const uint8_t opus_stream_cnt[9] = { 1, 1, 1, 2, 2, 3, 4, 4, 5, }; -static const uint8_t opus_channel_map[8][8] = { +static const uint8_t opus_channel_map_a[8][8] = { { 0 }, { 0,1 }, { 0,2,1 }, @@ -1644,13 +1645,25 @@ static const uint8_t opus_channel_map[8][8] = { { 0,6,1,2,3,4,5,7 }, }; +static const uint8_t opus_channel_map_b[8][8] = { +{ 0 }, +{ 0,1 }, +{ 0,1,2 }, +{ 0,1,2,3 }, +{ 0,1,2,3,4 }, +{ 0,1,2,3,4,5 }, +{ 0,1,2,3,4,5,6 }, +{ 0,1,2,3,4,5,6,7 }, +}; + int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type, const uint8_t **pp, const uint8_t *desc_list_end, Mp4Descr *mp4_descr, int mp4_descr_count, int pid, MpegTSContext *ts) { const uint8_t *desc_end; -int desc_len, desc_tag, desc_es_id, ext_desc_tag, channels, channel_config_code; +int desc_len, desc_tag, desc_es_id, ext_desc_tag, channels, channel_config_code, channel_count, mapping_family, stream_count, coupled_stream_count; +GetBitContext gb; char language[252]; int i; @@ -1660,6 +1673,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type desc_len = get8(pp, desc_list_end); if (desc_len < 0) return AVERROR_INVALIDDATA; + desc_end = *pp + desc_len; if (desc_end > desc_list_end) return AVERROR_INVALIDDATA; @@ -1871,26 +1885,68 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type if (st->codecpar->codec_id == AV_CODEC_ID_OPUS && ext_desc_tag == 0x80) { /* User defined (provisional Opus) */ if (!st->codecpar->extradata) { -st->codecpar->extradata = av_mallocz(sizeof(opus_default_extradata) + - AV_INPUT_BUFFER_PADDING_SIZE); -if (!st->codecpar->extradata) -return AVERROR(ENOMEM); - -st->codecpar->extradata_size = sizeof(opus_default_extradata); -memcpy(st->codecpar->extradata, opus_default_extradata, sizeof(opus_default_extradata)); - channel_config_code = get8(pp, desc_end); if (channel_config_code < 0) return AVERROR_INVALIDDATA; + +if (channel_config_code != 0x81) { +st->codecpar->extradata = av_mallocz(sizeof(opus_default_extradata) + +AV_INPUT_BUFFER_PADDING_SIZE); +if (!st->codecpar->extradata) +return AVERROR(ENOMEM); +st->codecpar->extradata_size = sizeof(opus_default_extradata); +memcpy(st->codecpar->extradata, opus_default_extradata, sizeof(opus_default_extradata)); +} + if (channel_config_code <= 0x8) { st->codecpar->extradata[9] = channels = channel_config_code ? channel_config_code : 2; st->codecpar->extradata[18] = channel_config_code ? (channels > 2) : /* Dual Mono */ 255; st->codecpar->extradata[19] = opus_stream_cnt[channel_config_code]; st->codecpar->extradata[20] = opus_coupled_stream_cnt[channel_config_code]; -memcpy(&st->codecpar->extradata[21], opus_channel_map[channels - 1], channels); -} else { -avpriv_request_sample(fc, "Opus in MPEG-TS - channel_config_code > 0x8"); -} +memcpy(&st->codecpar->extradata[21], opus_channel_map_a[channels - 1], channels); +} else if (channel_config_code == 0x81) { +channel_count = get8(pp, desc_end); +mapping_family = get8(pp, desc_end); +if (channel_count < 0 || channel_count > 255) +return AVERROR_INVALIDDATA; +if (mapping_family < 0 || mapping_family > 255) +
[FFmpeg-devel] [PATCH v4 1/2 ] avformat/mpegts: opus muxing for mapping family 255
From 105f20b8af8ce5376165ca30a81276dae2e61e40 Mon Sep 17 00:00:00 2001 From: pkviet Date: Sat, 28 Oct 2017 02:48:08 +0200 Subject: [PATCH 1/2] libavf/mpegts: opus muxing for mapping family 255 Adds to mpegts muxer the capability to mux libopus with mapping family 255, following the provisional spec for opus in mepg-ts (https://people.xiph.org/~tterribe/opus/ETSI_TS_opus-v0.1.3-draft.doc). Signed-off-by: pkviet --- libavformat/mpegtsenc.c | 67 +++-- 1 file changed, 60 insertions(+), 7 deletions(-) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index fdfa544..a31663c 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -28,6 +28,7 @@ #include "libavutil/opt.h" #include "libavcodec/internal.h" +#include "libavcodec/put_bits.h" #include "avformat.h" #include "avio_internal.h" @@ -291,6 +292,9 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) MpegTSWrite *ts = s->priv_data; uint8_t data[SECTION_LENGTH], *q, *desc_length_ptr, *program_info_length_ptr; int val, stream_type, i, err = 0; +uint8_t channel_count, stream_count, coupled_stream_count, *buf; +PutBitContext pbc; +size_t buf_size; q = data; put16(&q, 0xe000 | service->pcr_pid); @@ -421,8 +425,8 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) *q++ = 'D'; } if (st->codecpar->codec_id==AV_CODEC_ID_OPUS) { -/* 6 bytes registration descriptor, 4 bytes Opus audio descriptor */ -if (q - data > SECTION_LENGTH - 6 - 4) { +/* 6 bytes registration descriptor, 6 bytes Opus audio descriptor */ +if (q - data > SECTION_LENGTH - 6 - 6) { err = 1; break; } @@ -435,8 +439,19 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) *q++ = 's'; *q++ = 0x7f; /* DVB extension descriptor */ -*q++ = 2; -*q++ = 0x80; +/* descriptor_length */ +if (st->codecpar->extradata[18] == 255) { +/* dual mono */ +if (st->codecpar->channels == 2) { +*q++ = 2; +} else { +/* channel_config_code 0x81 */ +*q++ = st->codecpar->channels + 6; +} +} else { +*q++ = 2; +} +*q++ = 0x80; /* descriptor_tag_extension */ if (st->codecpar->extradata && st->codecpar->extradata_size >= 19) { if (st->codecpar->extradata[18] == 0 && st->codecpar->channels <= 2) { @@ -483,9 +498,47 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) *q++ = 0xff; } } else { -/* Unsupported */ -av_log(s, AV_LOG_ERROR, "Unsupported Opus channel mapping for family %d", st->codecpar->extradata[18]); -*q++ = 0xff; +/* mapping family 255 , set channel_config_code to 0x81 except for dual-mono */ +if (st->codecpar->extradata[18] == 255) { +/* dual mono */ +if (st->codecpar->channels == 2 && st->codecpar->extradata[19] == 1) { +*q++ = 0x00; +} else if (st->codecpar->channels == 2 && st->codecpar->extradata[19] == 2) { +*q++ = 0x80; +} else { +/* application defined channel configuration */ +*q++ = 0x81; +*q++ = st->codecpar->channels; +*q++ = st->codecpar->extradata[18]; +channel_count = st->codecpar->channels; +stream_count = st->codecpar->extradata[19]; +coupled_stream_count = st->codecpar->extradata[20]; +buf = av_mallocz_array( st->codecpar->channels + 2 , sizeof(uint8_t)); +if (!buf) { +av_freep(buf); +return AVERROR(ENOMEM); +} +init_put_bits(&pbc, buf, (st->codecpar->channels + 2)); +put_bits(&pbc, av_ceil_log2_c(channel_count), st->codecpar->extradata[19] - 1); +put_bits(&pbc, av_ceil_log2_c(stream_count + 1), st->codecpar->extradata[20]); +for (i = 0; i < channel_count; i++) { +
[FFmpeg-devel] [PATCH v4 0/2 ] avformat/mpegts: opus muxing & demuxing for mapping family 255
int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type, const uint8_t **pp, const uint8_t *desc_list_end, Mp4Descr *mp4_descr, int mp4_descr_count, int pid, @@ -1887,9 +1898,56 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type st->codecpar->extradata[18] = channel_config_code ? (channels > 2) : /* Dual Mono */ 255; st->codecpar->extradata[19] = opus_stream_cnt[channel_config_code]; st->codecpar->extradata[20] = opus_coupled_stream_cnt[channel_config_code]; -memcpy(&st->codecpar->extradata[21], opus_channel_map[channels - 1], channels); +memcpy(&st->codecpar->extradata[21], opus_channel_map_a[channels - 1], channels); } else { -avpriv_request_sample(fc, "Opus in MPEG-TS - channel_config_code > 0x8"); +if (channel_config_code == 0x81) { +channels = get8(pp, desc_end); +st->codecpar->extradata_size = 22 + channels; +size_t extradata_size; +extradata_size = (22 + channels) * sizeof(uint8_t); +uint8_t *extradata; this produces warnings: libavformat/mpegts.c:1906:25: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] Thanks a lot Michael for your review. I have cleaned this warning and others issued by gcc. +extradata = av_malloc(extradata_size); +if (!extradata) +return AVERROR(ENOMEM); +for (i = 0; i <= (22+channels); i++) { the extradata_size expression is repeated 3 times, code duplication should be avoided removed +if (i < 9) { +extradata[i] = opus_default_extradata[i]; +} +else { +extradata[i] = 0; +} +} +memcpy(st->codecpar->extradata, extradata, sizeof(extradata)); this looks wrong right, fixed (removed) +av_free(extradata); +st->codecpar->extradata[9] = channels; +st->codecpar->extradata[18] = 255; +st->codecpar->extradata[19] = channels; +st->codecpar->extradata[20] = 0; +size_t channel_map_size = channels * sizeof(uint8_t); +uint8_t *opus_channel_map255; +opus_channel_map255 = av_malloc(channel_map_size); +if (!opus_channel_map255) +return AVERROR(ENOMEM); +uint8_t j; +for (j = 0; j < channels; j++) { +opus_channel_map255[j] = j; +} +memcpy(&st->codecpar->extradata[21], opus_channel_map255, channels); +av_free(opus_channel_map255); +} else { +if ((channel_config_code >= 0x82) && (channel_config_code <= 0x88)) { +channels = get8(pp, desc_end); +st->codecpar->extradata[9] = channels; +st->codecpar->extradata[18] = 1; +st->codecpar->extradata[19] = channels; +st->codecpar->extradata[20] = 0; +memcpy(&st->codecpar->extradata[21], opus_channel_map_b[channels - 1], channels); the channels value is not checked before use in memcpy fixed; I have added other checks for all the data read from header; +} +else { +avpriv_request_sample(fc, "Opus in MPEG-TS - channel_config_code %i", channel_config_code); +} + +} } st->need_parsing = AVSTREAM_PARSE_FULL; st->internal->need_context_update = 1; diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index fdfa544..af1dfc6 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c muxer and demuxer changes should be in seperate patches done; see next posts. My previous code was not following strictly the draft spec here: https://people.xiph.org/~tterribe/opus/ETSI_TS_opus-v0.1.3-draft.doc So I have rewritten it to have strict adherence regarding the bits allocated in header. I have also run fate + patcheck ; no issues (just some unused variables warnings for variables antedating this patch). Regards ___ ffmpeg-devel mailing list ffmpeg-devel@f
Re: [FFmpeg-devel] [PATCH 0/5] Cuvid/videotoolbox preparations
On 10/27/2017 3:46 PM, Thilo Borgmann wrote: > Am 27.10.17 um 19:00 schrieb James Almer: >> On 10/13/2017 1:59 PM, wm4 wrote: >>> These commits are required to merge Libav's cuvid hwaccel, and to >>> fix videotoolbox operation if frame threading is enabled. >>> >>> Anton Khirnov (4): >>> decode: avoid leaks on failure in ff_get_buffer() >>> decode: add a method for attaching lavc-internal data to frames >>> decode: add a mechanism for performing delayed processing on the >>> decoded frames >>> decode: add a per-frame private data for hwaccel use >>> >>> wm4 (1): >>> lavc/avrndec: remove AV_CODEC_CAP_DR1, as it's broken >>> >>> libavcodec/avrndec.c | 1 - >>> libavcodec/decode.c | 113 >>> ++- >>> libavcodec/decode.h | 40 +++ >>> libavcodec/h264dec.c | 5 +- >>> libavcodec/huffyuvdec.c | 3 +- >>> libavcodec/mpegutils.c | 4 +- >>> libavcodec/vp3.c | 3 +- >>> libavcodec/wrapped_avframe.c | 7 +++ >>> 8 files changed, 167 insertions(+), 9 deletions(-) >> >> Can we please find a way to get this thing moving instead of keeping it >> blocked indefinitely? I'll eventually reach this point in the merge >> queue and i don't want to find myself stuck again because two devs can't >> find a common ground. >> >> We have dozens of devs, many knowledgeable enough in this subject to >> chime in and tip the scales. So far one dev is against it (Michael) and >> two in favor (wm4 and Thilo). This needs the attention of more people. > > I'm not in favor of anything and never claimed to do so. Instead, I already > said > that I am not as familiar with that part of the code to dive into the > discussion. > I just offered to do the codemonkey on whatever shall finally be implemented - > for the case it actually stalls for nobody willing to do so. I recall you mentioned you were waiting for this to be committed (saying you didn't think it was an issue like Michael thinks it is) so you could go ahead with some hwaccel work you had queued. Guess i wrongly assumed that meant you agreed with the approach. Sorry about that. > > >> If a vote is needed then so be it, but for fucks sake, we really need to >> find solutions for this kind of discussions in a more timely manner. > > Yes. > > -Thilo > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: initial macroblock types export and visualization
On Fri, Oct 27, 2017 at 10:03:54PM +0200, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > libavcodec/mpegvideo.c | 10 + > libavfilter/vf_codecview.c | 105 > + > libavutil/frame.h | 4 ++ > 3 files changed, 119 insertions(+) First, thanks for working on this. [...] > diff --git a/libavutil/frame.h b/libavutil/frame.h > index fef558ea2f..8481dc080b 100644 > --- a/libavutil/frame.h > +++ b/libavutil/frame.h > @@ -141,6 +141,10 @@ enum AVFrameSideDataType { > * metadata key entry "name". > */ > AV_FRAME_DATA_ICC_PROFILE, > +/** > + * Macroblock types exported by some codecs. > + */ > +AV_FRAME_DATA_MACROBLOCK_TYPES, > }; > This makes the internal data of the decoder part of the ABI and API of libavcodec and libavfilter and its undocumented do people prefer to make the internal data part of the ABI, document it and ensure it does not change till the next bump or design a new interface, document it and convert to it? or is there some other option iam missing ? these ABI issues btw are why i said i dont have the time for doing the move. also it seems the patch breaks fate-mov-zombie [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you fake or manipulate statistics in a paper in physics you will never get a job again. If you fake or manipulate statistics in a paper in medicin you will get a job for life at the pharma industry. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avfilter/zscale: fix segfault on library error
Sent with [ProtonMail](https://protonmail.com) Secure Email. 0001-avfilter-zscale-fix-segfault-on-library-error.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel