mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
ffmpeg: add HEVC improvements and simplify patches
This commit is contained in:
parent
85d02cc93b
commit
6fe28f5005
@ -1,49 +0,0 @@
|
||||
From 84e9a1784bbd3182b68cefa5e5feae8da8b9e184 Mon Sep 17 00:00:00 2001
|
||||
From: popcornmix <popcornmix@gmail.com>
|
||||
Date: Fri, 5 Jun 2015 22:48:33 +0100
|
||||
Subject: [PATCH] mpeg4video: Signal unsupported GMC with more than one warp
|
||||
point
|
||||
|
||||
---
|
||||
libavcodec/avcodec.h | 1 +
|
||||
libavcodec/mpeg4videodec.c | 4 ++++
|
||||
2 files changed, 5 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
|
||||
index 8c7c420..e63dc2d 100644
|
||||
--- a/libavcodec/avcodec.h
|
||||
+++ b/libavcodec/avcodec.h
|
||||
@@ -2527,6 +2527,7 @@ typedef struct AVCodecContext {
|
||||
#define FF_BUG_DC_CLIP 4096
|
||||
#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders.
|
||||
#define FF_BUG_TRUNCATED 16384
|
||||
+#define FF_BUG_GMC_UNSUPPORTED 32768
|
||||
|
||||
/**
|
||||
* strictly follow the standard (MPEG4, ...).
|
||||
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
|
||||
index 9bf33dd..0b5d3b9 100644
|
||||
--- a/libavcodec/mpeg4videodec.c
|
||||
+++ b/libavcodec/mpeg4videodec.c
|
||||
@@ -2179,6 +2179,9 @@ int ff_mpeg4_workaround_bugs(AVCodecContext *avctx)
|
||||
|
||||
if (ctx->divx_version >= 0)
|
||||
s->workaround_bugs |= FF_BUG_HPEL_CHROMA;
|
||||
+
|
||||
+ if (ctx->num_sprite_warping_points > 1)
|
||||
+ s->workaround_bugs |= FF_BUG_GMC_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if (s->workaround_bugs & FF_BUG_STD_QPEL) {
|
||||
@@ -2203,6 +2206,7 @@ int ff_mpeg4_workaround_bugs(AVCodecContext *avctx)
|
||||
s->workaround_bugs, ctx->lavc_build, ctx->xvid_build,
|
||||
ctx->divx_version, ctx->divx_build, s->divx_packed ? "p" : "");
|
||||
|
||||
+ avctx->workaround_bugs = s->workaround_bugs;
|
||||
if (CONFIG_MPEG4_DECODER && ctx->xvid_build >= 0 &&
|
||||
s->codec_id == AV_CODEC_ID_MPEG4 &&
|
||||
avctx->idct_algo == FF_IDCT_AUTO) {
|
||||
--
|
||||
1.9.1
|
||||
|
||||
|
@ -1,410 +0,0 @@
|
||||
From 29c3327a0d72a7e872ff170363cfe5ed13bca5d0 Mon Sep 17 00:00:00 2001
|
||||
From: Seppo Tomperi <seppo.tomperi@vtt.fi>
|
||||
Date: Tue, 22 Dec 2015 18:10:24 +0000
|
||||
Subject: [PATCH] hevcdsp: ARM NEON optimized epel functions
|
||||
|
||||
---
|
||||
libavcodec/arm/Makefile | 1 +
|
||||
libavcodec/arm/hevcdsp_epel_neon.S | 334 +++++++++++++++++++++++++++++++++++++
|
||||
libavcodec/arm/hevcdsp_init_neon.c | 23 +++
|
||||
3 files changed, 358 insertions(+)
|
||||
create mode 100644 libavcodec/arm/hevcdsp_epel_neon.S
|
||||
|
||||
diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile
|
||||
index cdd35b0..6051ec8 100644
|
||||
--- a/libavcodec/arm/Makefile
|
||||
+++ b/libavcodec/arm/Makefile
|
||||
@@ -131,6 +131,7 @@ NEON-OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_neon.o \
|
||||
arm/synth_filter_neon.o
|
||||
NEON-OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_neon.o \
|
||||
arm/hevcdsp_deblock_neon.o \
|
||||
+ arm/hevcdsp_epel_neon.o \
|
||||
arm/hevcdsp_idct_neon.o \
|
||||
arm/hevcdsp_qpel_neon.o
|
||||
NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_neon.o
|
||||
diff --git a/libavcodec/arm/hevcdsp_epel_neon.S b/libavcodec/arm/hevcdsp_epel_neon.S
|
||||
new file mode 100644
|
||||
index 0000000..516ae5b
|
||||
--- /dev/null
|
||||
+++ b/libavcodec/arm/hevcdsp_epel_neon.S
|
||||
@@ -0,0 +1,334 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2014 - 2015 Seppo Tomperi <seppo.tomperi@vtt.fi>
|
||||
+ *
|
||||
+ * 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/arm/asm.S"
|
||||
+#include "neon.S"
|
||||
+
|
||||
+#define MAX_PB_SIZE #64
|
||||
+
|
||||
+.macro vextin_d4
|
||||
+ vld1.8 {q10}, [r1], r2
|
||||
+ vmov d16, d20
|
||||
+ vext.8 d17, d20, d21, #1
|
||||
+ vext.8 d18, d20, d21, #2
|
||||
+ vext.8 d19, d20, d21, #3
|
||||
+.endm
|
||||
+
|
||||
+.macro vextin_d4_8
|
||||
+ vld1.8 d16, [r1], r2
|
||||
+ vext.8 d17, d16, d16, #1
|
||||
+ vext.8 d18, d16, d16, #2
|
||||
+ vext.8 d19, d16, d16, #3
|
||||
+.endm
|
||||
+
|
||||
+.macro load_coeffs_16b coeffs
|
||||
+ ldr \coeffs, [\coeffs]
|
||||
+ vdup.i8 d0, \coeffs
|
||||
+ lsr \coeffs, #8
|
||||
+ vdup.i8 d1, \coeffs
|
||||
+ lsr \coeffs, #8
|
||||
+ vdup.i8 d2, \coeffs
|
||||
+ lsr \coeffs, #8
|
||||
+ vdup.i8 d3, \coeffs
|
||||
+.endm
|
||||
+
|
||||
+.macro epel_filter_16b out=q12
|
||||
+ vmull.u8 q3, d16, d0
|
||||
+ vmull.u8 q11, d19, d3
|
||||
+ vmull.u8 \out, d17, d1
|
||||
+ vmull.u8 q10, d18, d2
|
||||
+ vadd.s16 q3, q11
|
||||
+ vadd.s16 \out, q10
|
||||
+ vsub.s16 \out, q3
|
||||
+.endm
|
||||
+
|
||||
+.macro load_coeffs_32b coeffs
|
||||
+ ldr \coeffs, [\coeffs]
|
||||
+ vmov.i64 d4, #0
|
||||
+ vmov.8 d4[0], \coeffs
|
||||
+ lsr \coeffs, #8
|
||||
+ vmov.8 d4[2], \coeffs
|
||||
+ lsr \coeffs, #8
|
||||
+ vmov.8 d4[4], \coeffs
|
||||
+ lsr \coeffs, #8
|
||||
+ vmov.8 d4[6], \coeffs
|
||||
+.endm
|
||||
+
|
||||
+.macro epel_filter_32b
|
||||
+ vmull.s16 q3, d24, d4[0] //q12
|
||||
+ vmull.s16 q4, d25, d4[0]
|
||||
+ vmull.s16 q5, d30, d4[3] //q15
|
||||
+ vmull.s16 q6, d31, d4[3]
|
||||
+
|
||||
+ vmull.s16 q7, d26, d4[1] // q13
|
||||
+ vmull.s16 q8, d27, d4[1]
|
||||
+ vmull.s16 q9, d28, d4[2] // q14
|
||||
+ vmull.s16 q10, d29, d4[2]
|
||||
+ vadd.s32 q3, q5
|
||||
+ vadd.s32 q4, q6
|
||||
+ vadd.s32 q7, q9
|
||||
+ vadd.s32 q8, q10
|
||||
+ vsub.s32 q7, q3
|
||||
+ vsub.s32 q8, q4
|
||||
+ vqshrn.s32 d6, q7, #6
|
||||
+ vqshrn.s32 d7, q8, #6
|
||||
+.endm
|
||||
+
|
||||
+.macro epel_filter_32b_4
|
||||
+ vmull.s16 q3, d24, d4[0] //q12
|
||||
+ vmull.s16 q5, d30, d4[3] //q15
|
||||
+ vmull.s16 q7, d26, d4[1] // q13
|
||||
+ vmull.s16 q9, d28, d4[2] // q14
|
||||
+ vadd.s32 q3, q5
|
||||
+ vadd.s32 q7, q9
|
||||
+ vsub.s32 q7, q3
|
||||
+ vqshrn.s32 d6, q7, #6
|
||||
+.endm
|
||||
+
|
||||
+function ff_hevc_put_epel_h_neon_8, export=1
|
||||
+ push {r4-r7}
|
||||
+ mov r4, MAX_PB_SIZE
|
||||
+ ldr r7, [sp, #16] // mx
|
||||
+ ldr r5, [sp, #24] // width
|
||||
+ sub r7, #1
|
||||
+ lsl r7, #2
|
||||
+ vpush {d8-d15}
|
||||
+ adrl r12, epel_coeffs
|
||||
+ add r7, r12
|
||||
+ sub r1, #1
|
||||
+ lsl r4, #1
|
||||
+ load_coeffs_16b r7
|
||||
+ mov r12, r3
|
||||
+ mov r6, r0
|
||||
+ mov r7, r1
|
||||
+ cmp r5, #6
|
||||
+ bgt 8f
|
||||
+ cmp r5, #4
|
||||
+ blt 2f
|
||||
+ b 4f
|
||||
+8: subs r3, #1
|
||||
+ pld [r1]
|
||||
+ vextin_d4
|
||||
+ epel_filter_16b
|
||||
+ vst1.16 {q12}, [r0], r4
|
||||
+ bne 8b
|
||||
+ subs r5, #8
|
||||
+ beq 99f
|
||||
+ mov r3, r12
|
||||
+ add r6, #16
|
||||
+ mov r0, r6
|
||||
+ add r7, #8
|
||||
+ mov r1, r7
|
||||
+ cmp r5, #4
|
||||
+ bgt 8b
|
||||
+4: subs r3, #1
|
||||
+ pld [r1]
|
||||
+ vextin_d4_8
|
||||
+ epel_filter_16b
|
||||
+ vst1.16 d24, [r0], r4
|
||||
+ bne 4b
|
||||
+ subs r5, #4
|
||||
+ beq 99f
|
||||
+ mov r3, r12
|
||||
+ add r6, #8
|
||||
+ mov r0, r6
|
||||
+ add r7, #4
|
||||
+ mov r1, r7
|
||||
+2: subs r3, #1
|
||||
+ pld [r1]
|
||||
+ vextin_d4_8
|
||||
+ epel_filter_16b
|
||||
+ vst1.32 d24[0], [r0], r4
|
||||
+ bne 2b
|
||||
+99: vpop {d8-d15}
|
||||
+ pop {r4-r7}
|
||||
+ bx lr
|
||||
+endfunc
|
||||
+
|
||||
+function ff_hevc_put_epel_v_neon_8, export=1
|
||||
+ push {r4-r7}
|
||||
+ mov r4, MAX_PB_SIZE
|
||||
+ ldr r7, [sp, #20] // my
|
||||
+ ldr r5, [sp, #24] // width
|
||||
+ sub r7, #1
|
||||
+ lsl r7, #2
|
||||
+ vpush {d8-d15}
|
||||
+ adrl r12, epel_coeffs
|
||||
+ add r7, r12
|
||||
+ load_coeffs_16b r7
|
||||
+ sub r1, r2
|
||||
+ lsl r4, #1
|
||||
+ mov r12, r3
|
||||
+ mov r6, r0
|
||||
+ mov r7, r1
|
||||
+0: pld [r1]
|
||||
+ vld1.8 {d16}, [r1], r2
|
||||
+ pld [r1]
|
||||
+ vld1.8 {d17}, [r1], r2
|
||||
+ pld [r1]
|
||||
+ vld1.8 {d18}, [r1], r2
|
||||
+ cmp r5, #6
|
||||
+ bgt 8f
|
||||
+ cmp r5, #4
|
||||
+ blt 2f
|
||||
+ b 4f
|
||||
+8: pld [r1]
|
||||
+ vld1.8 {d19}, [r1], r2
|
||||
+ subs r3, #1
|
||||
+ epel_filter_16b
|
||||
+ vst1.16 {q12}, [r0], r4
|
||||
+ vmov d16, d17
|
||||
+ vmov d17, d18
|
||||
+ vmov d18, d19
|
||||
+ bne 8b
|
||||
+ subs r5, #8
|
||||
+ beq 99f
|
||||
+ mov r3, r12
|
||||
+ add r6, #16
|
||||
+ mov r0, r6
|
||||
+ add r7, #8
|
||||
+ mov r1, r7
|
||||
+ b 0b
|
||||
+4: pld [r1]
|
||||
+ vld1.8 {d19}, [r1], r2
|
||||
+ subs r3, #1
|
||||
+ epel_filter_16b
|
||||
+ vst1.16 d24, [r0], r4
|
||||
+ vmov d16, d17
|
||||
+ vmov d17, d18
|
||||
+ vmov d18, d19
|
||||
+ bne 4b
|
||||
+ subs r5, #4
|
||||
+ beq 99f
|
||||
+ mov r3, r12
|
||||
+ add r6, #8
|
||||
+ mov r0, r6
|
||||
+ add r7, #4
|
||||
+ mov r1, r7
|
||||
+ b 0b
|
||||
+2: pld [r1]
|
||||
+ vld1.8 {d19}, [r1], r2
|
||||
+ subs r3, #1
|
||||
+ epel_filter_16b
|
||||
+ vst1.32 d24[0], [r0], r4
|
||||
+ vmov d16, d17
|
||||
+ vmov d17, d18
|
||||
+ vmov d18, d19
|
||||
+ bne 2b
|
||||
+99: vpop {d8-d15}
|
||||
+ pop {r4-r7}
|
||||
+ bx lr
|
||||
+endfunc
|
||||
+
|
||||
+function ff_hevc_put_epel_hv_neon_8, export=1
|
||||
+ push {r4-r7}
|
||||
+ mov r4, MAX_PB_SIZE
|
||||
+ ldr r6, [sp, #16] // mx
|
||||
+ ldr r7, [sp, #20] // my
|
||||
+ ldr r5, [sp, #24] // width
|
||||
+ sub r7, #1
|
||||
+ lsl r7, #2
|
||||
+ vpush {d8-d15}
|
||||
+ adrl r12, epel_coeffs
|
||||
+ sub r6, #1
|
||||
+ lsl r6, #2
|
||||
+ add r6, r12 // mx epel coeff offset
|
||||
+ add r7, r12
|
||||
+ sub r1, #1
|
||||
+ sub r1, r2
|
||||
+ lsl r4, #1
|
||||
+ load_coeffs_16b r6
|
||||
+ load_coeffs_32b r7
|
||||
+ mov r12, r3
|
||||
+ mov r6, r0
|
||||
+ mov r7, r1
|
||||
+0: pld [r1]
|
||||
+ vextin_d4
|
||||
+ epel_filter_16b q12
|
||||
+ pld [r1]
|
||||
+ vextin_d4
|
||||
+ epel_filter_16b q13
|
||||
+ pld [r1]
|
||||
+ vextin_d4
|
||||
+ epel_filter_16b q14
|
||||
+ cmp r5, #6
|
||||
+ bgt 8f
|
||||
+ cmp r5, #4
|
||||
+ blt 2f
|
||||
+ b 4f
|
||||
+8: pld [r1]
|
||||
+ vextin_d4
|
||||
+ epel_filter_16b q15
|
||||
+ subs r3, #1
|
||||
+ epel_filter_32b
|
||||
+ vst1.16 {q3}, [r0], r4
|
||||
+ vmov q12, q13
|
||||
+ vmov q13, q14
|
||||
+ vmov q14, q15
|
||||
+ bne 8b
|
||||
+ subs r5, #8
|
||||
+ beq 99f
|
||||
+ mov r3, r12
|
||||
+ add r6, #16
|
||||
+ mov r0, r6
|
||||
+ add r7, #8
|
||||
+ mov r1, r7
|
||||
+ b 0b
|
||||
+4: pld [r1]
|
||||
+ vextin_d4_8
|
||||
+ epel_filter_16b q15
|
||||
+ subs r3, #1
|
||||
+ epel_filter_32b_4
|
||||
+ vst1.16 d6, [r0], r4
|
||||
+ vmov q12, q13
|
||||
+ vmov q13, q14
|
||||
+ vmov q14, q15
|
||||
+ bne 4b
|
||||
+ subs r5, #4
|
||||
+ beq 99f
|
||||
+ mov r3, r12
|
||||
+ add r6, #8
|
||||
+ mov r0, r6
|
||||
+ add r7, #4
|
||||
+ mov r1, r7
|
||||
+ b 0b
|
||||
+2: pld [r1]
|
||||
+ vextin_d4_8
|
||||
+ epel_filter_16b q15
|
||||
+ subs r3, #1
|
||||
+ epel_filter_32b_4
|
||||
+ vst1.32 d6[0], [r0], r4
|
||||
+ vmov q12, q13
|
||||
+ vmov q13, q14
|
||||
+ vmov q14, q15
|
||||
+ bne 2b
|
||||
+99: vpop {d8-d15}
|
||||
+ pop {r4-r7}
|
||||
+ bx lr
|
||||
+endfunc
|
||||
+
|
||||
+epel_coeffs:
|
||||
+ .byte 2, 58, 10, 2
|
||||
+ .byte 4, 54, 16, 2
|
||||
+ .byte 6, 46, 28, 4
|
||||
+ .byte 4, 36, 36, 4
|
||||
+ .byte 4, 28, 46, 6
|
||||
+ .byte 2, 16, 54, 4
|
||||
+ .byte 2, 10, 58, 2
|
||||
diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c
|
||||
index 5591807..733ff08 100644
|
||||
--- a/libavcodec/arm/hevcdsp_init_neon.c
|
||||
+++ b/libavcodec/arm/hevcdsp_init_neon.c
|
||||
@@ -58,6 +58,15 @@ PUT_PIXELS(ff_hevc_put_pixels_w32_neon_8);
|
||||
PUT_PIXELS(ff_hevc_put_pixels_w48_neon_8);
|
||||
PUT_PIXELS(ff_hevc_put_pixels_w64_neon_8);
|
||||
#undef PUT_PIXELS
|
||||
+void ff_hevc_put_epel_h_neon_8(int16_t *dst, uint8_t *src,
|
||||
+ ptrdiff_t srcstride, int height,
|
||||
+ intptr_t mx, intptr_t my, int width);
|
||||
+void ff_hevc_put_epel_v_neon_8(int16_t *dst, uint8_t *src,
|
||||
+ ptrdiff_t srcstride, int height,
|
||||
+ intptr_t mx, intptr_t my, int width);
|
||||
+void ff_hevc_put_epel_hv_neon_8(int16_t *dst, uint8_t *src,
|
||||
+ ptrdiff_t srcstride, int height,
|
||||
+ intptr_t mx, intptr_t my, int width);
|
||||
|
||||
static void (*put_hevc_qpel_neon[4][4])(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride,
|
||||
int height, int width);
|
||||
@@ -201,7 +210,21 @@ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth)
|
||||
c->put_hevc_qpel_bi[x][1][0] = ff_hevc_put_qpel_bi_neon_wrapper;
|
||||
c->put_hevc_qpel_bi[x][0][1] = ff_hevc_put_qpel_bi_neon_wrapper;
|
||||
c->put_hevc_qpel_bi[x][1][1] = ff_hevc_put_qpel_bi_neon_wrapper;
|
||||
+ c->put_hevc_epel[x][1][0] = ff_hevc_put_epel_v_neon_8;
|
||||
+ c->put_hevc_epel[x][0][1] = ff_hevc_put_epel_h_neon_8;
|
||||
+ c->put_hevc_epel[x][1][1] = ff_hevc_put_epel_hv_neon_8;
|
||||
}
|
||||
+ c->put_hevc_epel[0][0][0] = ff_hevc_put_pixels_w2_neon_8;
|
||||
+ c->put_hevc_epel[1][0][0] = ff_hevc_put_pixels_w4_neon_8;
|
||||
+ c->put_hevc_epel[2][0][0] = ff_hevc_put_pixels_w6_neon_8;
|
||||
+ c->put_hevc_epel[3][0][0] = ff_hevc_put_pixels_w8_neon_8;
|
||||
+ c->put_hevc_epel[4][0][0] = ff_hevc_put_pixels_w12_neon_8;
|
||||
+ c->put_hevc_epel[5][0][0] = ff_hevc_put_pixels_w16_neon_8;
|
||||
+ c->put_hevc_epel[6][0][0] = ff_hevc_put_pixels_w24_neon_8;
|
||||
+ c->put_hevc_epel[7][0][0] = ff_hevc_put_pixels_w32_neon_8;
|
||||
+ c->put_hevc_epel[8][0][0] = ff_hevc_put_pixels_w48_neon_8;
|
||||
+ c->put_hevc_epel[9][0][0] = ff_hevc_put_pixels_w64_neon_8;
|
||||
+
|
||||
c->put_hevc_qpel[0][0][0] = ff_hevc_put_pixels_w2_neon_8;
|
||||
c->put_hevc_qpel[1][0][0] = ff_hevc_put_pixels_w4_neon_8;
|
||||
c->put_hevc_qpel[2][0][0] = ff_hevc_put_pixels_w6_neon_8;
|
||||
--
|
||||
2.5.0
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,69 +0,0 @@
|
||||
From 4060f15e2d29e268110032d4366382e370e088d0 Mon Sep 17 00:00:00 2001
|
||||
From: popcornmix <popcornmix@gmail.com>
|
||||
Date: Sun, 26 Jun 2016 20:09:18 +0100
|
||||
Subject: [PATCH] avcodec: add h264_mvc codec id and profiles
|
||||
|
||||
---
|
||||
libavcodec/avcodec.h | 5 +++++
|
||||
libavcodec/codec_desc.c | 7 +++++++
|
||||
libavformat/mpegts.c | 2 +-
|
||||
3 files changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
|
||||
index a1ba217..abd2e91 100644
|
||||
--- a/libavcodec/avcodec.h
|
||||
+++ b/libavcodec/avcodec.h
|
||||
@@ -410,6 +410,8 @@ enum AVCodecID {
|
||||
AV_CODEC_ID_SHEERVIDEO,
|
||||
AV_CODEC_ID_YLC,
|
||||
|
||||
+ AV_CODEC_ID_H264_MVC,
|
||||
+
|
||||
/* various PCM "codecs" */
|
||||
AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
|
||||
AV_CODEC_ID_PCM_S16LE = 0x10000,
|
||||
@@ -3195,6 +3197,9 @@ typedef struct AVCodecContext {
|
||||
#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244
|
||||
#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)
|
||||
#define FF_PROFILE_H264_CAVLC_444 44
|
||||
+#define FF_PROFILE_H264_MULTIVIEW_HIGH 118
|
||||
+#define FF_PROFILE_H264_STEREO_HIGH 128
|
||||
+#define FF_PROFILE_H264_MULTIVIEW_HIGH_DEPTH 138
|
||||
|
||||
#define FF_PROFILE_VC1_SIMPLE 0
|
||||
#define FF_PROFILE_VC1_MAIN 1
|
||||
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
|
||||
index 9d94b72..535ebf0 100644
|
||||
--- a/libavcodec/codec_desc.c
|
||||
+++ b/libavcodec/codec_desc.c
|
||||
@@ -1563,6 +1563,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
|
||||
.long_name = NULL_IF_CONFIG_SMALL("YUY2 Lossless Codec"),
|
||||
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
|
||||
},
|
||||
+ {
|
||||
+ .id = AV_CODEC_ID_H264_MVC,
|
||||
+ .type = AVMEDIA_TYPE_VIDEO,
|
||||
+ .name = "h264_mvc",
|
||||
+ .long_name = NULL_IF_CONFIG_SMALL("H264 MVC"),
|
||||
+ .props = AV_CODEC_PROP_LOSSY,
|
||||
+ },
|
||||
|
||||
/* various PCM "codecs" */
|
||||
{
|
||||
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
|
||||
index b31d233..2767306 100644
|
||||
--- a/libavformat/mpegts.c
|
||||
+++ b/libavformat/mpegts.c
|
||||
@@ -701,7 +701,7 @@ static const StreamType ISO_types[] = {
|
||||
#endif
|
||||
{ 0x1b, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264 },
|
||||
{ 0x1c, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AAC },
|
||||
- { 0x20, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264 },
|
||||
+ { 0x20, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264_MVC },
|
||||
{ 0x21, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_JPEG2000 },
|
||||
{ 0x24, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_HEVC },
|
||||
{ 0x42, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_CAVS },
|
||||
--
|
||||
2.7.4
|
||||
|
||||
|
@ -1,117 +0,0 @@
|
||||
From 23dd20678a05e1764e5d8d30481cb354a51b6c8b Mon Sep 17 00:00:00 2001
|
||||
From: popcornmix <popcornmix@gmail.com>
|
||||
Date: Sun, 26 Jun 2016 20:16:03 +0100
|
||||
Subject: [PATCH] h264_parser: add support for parsing h264 mvc NALUs
|
||||
|
||||
---
|
||||
libavcodec/allcodecs.c | 1 +
|
||||
libavcodec/h264.h | 2 ++
|
||||
libavcodec/h264_parser.c | 34 ++++++++++++++++++++++++++++++----
|
||||
3 files changed, 33 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
|
||||
index 54efaad..02a89c3 100644
|
||||
--- a/libavcodec/allcodecs.c
|
||||
+++ b/libavcodec/allcodecs.c
|
||||
@@ -667,6 +667,7 @@ void avcodec_register_all(void)
|
||||
REGISTER_PARSER(H261, h261);
|
||||
REGISTER_PARSER(H263, h263);
|
||||
REGISTER_PARSER(H264, h264);
|
||||
+ REGISTER_PARSER(H264_MVC, h264_mvc);
|
||||
REGISTER_PARSER(HEVC, hevc);
|
||||
REGISTER_PARSER(MJPEG, mjpeg);
|
||||
REGISTER_PARSER(MLP, mlp);
|
||||
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
|
||||
index efe3555..16358aa 100644
|
||||
--- a/libavcodec/h264.h
|
||||
+++ b/libavcodec/h264.h
|
||||
@@ -126,7 +126,9 @@ enum {
|
||||
NAL_END_STREAM = 11,
|
||||
NAL_FILLER_DATA = 12,
|
||||
NAL_SPS_EXT = 13,
|
||||
+ NAL_SPS_SUBSET = 15,
|
||||
NAL_AUXILIARY_SLICE = 19,
|
||||
+ NAL_SLICE_EXT = 20,
|
||||
NAL_FF_IGNORE = 0xff0f001,
|
||||
};
|
||||
|
||||
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
|
||||
index ce4bab2..082ac17 100644
|
||||
--- a/libavcodec/h264_parser.c
|
||||
+++ b/libavcodec/h264_parser.c
|
||||
@@ -58,6 +58,7 @@ typedef struct H264ParseContext {
|
||||
uint8_t parse_history[6];
|
||||
int parse_history_count;
|
||||
int parse_last_mb;
|
||||
+ int is_mvc;
|
||||
} H264ParseContext;
|
||||
|
||||
|
||||
@@ -105,14 +106,18 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf,
|
||||
} else if (state <= 5) {
|
||||
int nalu_type = buf[i] & 0x1F;
|
||||
if (nalu_type == NAL_SEI || nalu_type == NAL_SPS ||
|
||||
- nalu_type == NAL_PPS || nalu_type == NAL_AUD) {
|
||||
+ nalu_type == NAL_PPS || nalu_type == NAL_AUD ||
|
||||
+ nalu_type == NAL_SPS_SUBSET) {
|
||||
if (pc->frame_start_found) {
|
||||
i++;
|
||||
goto found;
|
||||
}
|
||||
} else if (nalu_type == NAL_SLICE || nalu_type == NAL_DPA ||
|
||||
- nalu_type == NAL_IDR_SLICE) {
|
||||
+ nalu_type == NAL_IDR_SLICE || (p->is_mvc && nalu_type == NAL_SLICE_EXT)) {
|
||||
state += 8;
|
||||
+
|
||||
+ if (nalu_type == NAL_SLICE_EXT)
|
||||
+ i += 3; // skip mvc extension
|
||||
continue;
|
||||
}
|
||||
state = 7;
|
||||
@@ -585,7 +590,8 @@ static int h264_parse(AVCodecParserContext *s,
|
||||
}
|
||||
}
|
||||
|
||||
- parse_nal_units(s, avctx, buf, buf_size);
|
||||
+ if (!p->is_mvc)
|
||||
+ parse_nal_units(s, avctx, buf, buf_size);
|
||||
|
||||
if (avctx->framerate.num)
|
||||
avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));
|
||||
@@ -622,7 +628,7 @@ static int h264_split(AVCodecContext *avctx,
|
||||
if ((state & 0xFFFFFF00) != 0x100)
|
||||
break;
|
||||
nalu_type = state & 0x1F;
|
||||
- if (nalu_type == NAL_SPS) {
|
||||
+ if (nalu_type == NAL_SPS || nalu_type == NAL_SPS_SUBSET) {
|
||||
has_sps = 1;
|
||||
} else if (nalu_type == NAL_PPS)
|
||||
has_pps = 1;
|
||||
@@ -672,3 +678,23 @@ AVCodecParser ff_h264_parser = {
|
||||
.parser_close = h264_close,
|
||||
.split = h264_split,
|
||||
};
|
||||
+
|
||||
+static av_cold int init_mvc(AVCodecParserContext *s)
|
||||
+{
|
||||
+ H264ParseContext *p = s->priv_data;
|
||||
+ int ret = init(s);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+
|
||||
+ p->is_mvc = 1;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+AVCodecParser ff_h264_mvc_parser = {
|
||||
+ .codec_ids = { AV_CODEC_ID_H264_MVC },
|
||||
+ .priv_data_size = sizeof(H264ParseContext),
|
||||
+ .parser_init = init_mvc,
|
||||
+ .parser_parse = h264_parse,
|
||||
+ .parser_close = h264_close,
|
||||
+ .split = h264_split,
|
||||
+};
|
||||
--
|
||||
2.7.4
|
||||
|
||||
|
@ -1,56 +0,0 @@
|
||||
From 12d99a92469e5916de3bc787dce4c13abfdd5e09 Mon Sep 17 00:00:00 2001
|
||||
From: popcornmix <popcornmix@gmail.com>
|
||||
Date: Sun, 26 Jun 2016 20:20:04 +0100
|
||||
Subject: [PATCH] h264_parser: fix parsing of mvc slices in some corner cases
|
||||
|
||||
---
|
||||
libavcodec/h264_parser.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
|
||||
index 082ac17..b9b0c78 100644
|
||||
--- a/libavcodec/h264_parser.c
|
||||
+++ b/libavcodec/h264_parser.c
|
||||
@@ -59,6 +59,7 @@ typedef struct H264ParseContext {
|
||||
int parse_history_count;
|
||||
int parse_last_mb;
|
||||
int is_mvc;
|
||||
+ int slice_ext;
|
||||
} H264ParseContext;
|
||||
|
||||
|
||||
@@ -116,18 +117,17 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf,
|
||||
nalu_type == NAL_IDR_SLICE || (p->is_mvc && nalu_type == NAL_SLICE_EXT)) {
|
||||
state += 8;
|
||||
|
||||
- if (nalu_type == NAL_SLICE_EXT)
|
||||
- i += 3; // skip mvc extension
|
||||
+ p->slice_ext = (nalu_type == NAL_SLICE_EXT);
|
||||
continue;
|
||||
}
|
||||
state = 7;
|
||||
} else {
|
||||
p->parse_history[p->parse_history_count++] = buf[i];
|
||||
- if (p->parse_history_count > 5) {
|
||||
+ if (p->parse_history_count > 8) {
|
||||
unsigned int mb, last_mb = p->parse_last_mb;
|
||||
GetBitContext gb;
|
||||
|
||||
- init_get_bits(&gb, p->parse_history, 8*p->parse_history_count);
|
||||
+ init_get_bits8(&gb, p->parse_history + 3*p->slice_ext, p->parse_history_count - 3*p->slice_ext);
|
||||
p->parse_history_count = 0;
|
||||
mb= get_ue_golomb_long(&gb);
|
||||
p->parse_last_mb = mb;
|
||||
@@ -150,7 +150,7 @@ found:
|
||||
pc->frame_start_found = 0;
|
||||
if (p->is_avc)
|
||||
return next_avc;
|
||||
- return i - (state & 5) - 5 * (state > 7);
|
||||
+ return i - (state & 5) - 8 * (state > 7);
|
||||
}
|
||||
|
||||
static int scan_mmco_reset(AVCodecParserContext *s, GetBitContext *gb,
|
||||
--
|
||||
2.7.4
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user