Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ffmpeg imf #105

Open
wants to merge 37 commits into
base: patch/htj2k
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2eac563
avcodec/jpeg2000dec: Move decoder structs to header files
etemesi254 Nov 21, 2022
8624b3b
avcodec/jpeg2000dec: Add support for HTJ2K decoding.
etemesi254 Nov 21, 2022
6f74866
avcodec/jpeg2000dec: Move decoder structs to header files
etemesi254 Nov 21, 2022
02f4c01
avcodec/jpeg2000dec: Add support for High Throughput HTJ2K decoding.
etemesi254 Dec 15, 2022
eab0bf3
changes v1.
etemesi254 Dec 28, 2022
d6af499
Merge branch 'remotev2' of https://github.com/etemesi254/FFmpeg into …
etemesi254 Dec 28, 2022
d93b920
changes v2.
etemesi254 Dec 28, 2022
55b0190
changes v3
etemesi254 Dec 28, 2022
db0f0cd
avcodec/jpeg2000dec: Move decoder structs to header files.
etemesi254 Dec 28, 2022
aabf5e3
avcodec/jpeg2000dec: Add support for HTJ2K decoding
etemesi254 Dec 28, 2022
4451315
avformat/matroskadec: support parsing more than one BlockMore element
jamrial Mar 12, 2023
6def862
avformat/matroskadec: set the default value for BlockAddIDType
jamrial Mar 19, 2023
c73cf41
avformat/matroskadec: export Dynamic HDR10+ packet side data
jamrial Mar 12, 2023
00fde80
avformat/matroska: add a few more Block Addition ID Type enum values
jamrial Mar 12, 2023
1c2a1e0
avformat/matroskaenc: write a MaxBlockAdditionID element
jamrial Mar 19, 2023
61b27b1
avutil/hdr_dynamic_metadata: allow av_dynamic_hdr_plus_to_t35() to ac…
jamrial Apr 1, 2023
8f53461
avformat/mxfdec: treat Random Index Pack as end of file
cus Mar 26, 2023
88da4b5
fate: split mxf test dependencies to DV and MPEG2
cus Mar 28, 2023
33ef877
avdevice/decklink_enc: Add support for output of Active Format Descri…
dheitmueller Mar 27, 2023
916be62
tests/fate/vcodec.mak: drop strict experimental from j2k tests
michaelni Apr 2, 2023
f0cd561
avcodec/ffv1dec: reject unsupported ffv1 versions
JeromeMartinez Apr 4, 2023
feeeefc
avformat/mxfenc: reject unsupported ffv1 versions
JeromeMartinez Apr 4, 2023
68c151c
checkasm: add hevc_deblock chroma test
jdek Mar 21, 2023
b564ad8
lavc/aarch64: add hevc deblock chroma 8-12bit
jdek Mar 29, 2023
88de01d
avformat/matroskadec: parse all BlockAdditionMapping elements and exp…
jamrial Apr 5, 2023
2133cad
avformat/matroskadec: reindent after the previous commit
jamrial Apr 7, 2023
6d31619
avformat/matroskadec: validate MaxBlockAdditionID in the presence of …
jamrial Apr 7, 2023
e1f691b
avformat/matroskadec: remove itu_t_t35 flag from MatroskaTrack
jamrial Apr 8, 2023
bda44f0
avformat/matroskaenc: support writing Dynamic HDR10+ packet side data
jamrial Mar 19, 2023
30f1f89
fate/matroska: add HDR10+ muxing tests
jamrial Mar 19, 2023
12d1f7c
avdevice/decklink_enc: Add support for compressed AC-3 output over SDI
dheitmueller Apr 7, 2023
05e3452
avcodec/dpx: fix check of minimal data size for unpadded content
JeromeMartinez Oct 19, 2022
82a14f3
avformat/matroskadec: also validate the mapping when BlockAddIDType is 0
jamrial Apr 8, 2023
d90d010
fixup! changes v2.
etemesi254 Apr 9, 2023
ef81446
Merge branch 'remotev2' of https://github.com/etemesi254/FFmpeg into …
etemesi254 Apr 9, 2023
a84c112
Merge branch 'master' of https://github.com/FFmpeg/FFmpeg into remotev2
etemesi254 Apr 9, 2023
a7b17e3
fixup! changes v3.
etemesi254 Apr 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/APIchanges
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ The last version increases of all libraries were on 2023-02-09

API changes, most recent first:

2023-04-04 - xxxxxxxxxx - lavu 58.6.100 - hdr_dynamic_metadata.h
Add AV_HDR_PLUS_MAX_PAYLOAD_SIZE.
av_dynamic_hdr_plus_create_side_data() now accepts a user provided
buffer.

2023-03-xx - xxxxxxxxxx - lavfi 9.5.100 - avfilter.h
Add AVFILTER_FLAG_HWDEVICE.

Expand Down
2 changes: 1 addition & 1 deletion libavcodec/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ OBJS-$(CONFIG_JACOSUB_DECODER) += jacosubdec.o ass.o
OBJS-$(CONFIG_JPEG2000_ENCODER) += j2kenc.o mqcenc.o mqc.o jpeg2000.o \
jpeg2000dwt.o
OBJS-$(CONFIG_JPEG2000_DECODER) += jpeg2000dec.o jpeg2000.o jpeg2000dsp.o \
jpeg2000dwt.o mqcdec.o mqc.o
jpeg2000dwt.o mqcdec.o mqc.o jpeg2000htdec.o
OBJS-$(CONFIG_JPEGLS_DECODER) += jpeglsdec.o jpegls.o
OBJS-$(CONFIG_JPEGLS_ENCODER) += jpeglsenc.o jpegls.o
OBJS-$(CONFIG_JV_DECODER) += jvdec.o
Expand Down
3 changes: 2 additions & 1 deletion libavcodec/aarch64/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ NEON-OBJS-$(CONFIG_VP9_DECODER) += aarch64/vp9itxfm_16bpp_neon.o \
aarch64/vp9lpf_neon.o \
aarch64/vp9mc_16bpp_neon.o \
aarch64/vp9mc_neon.o
NEON-OBJS-$(CONFIG_HEVC_DECODER) += aarch64/hevcdsp_idct_neon.o \
NEON-OBJS-$(CONFIG_HEVC_DECODER) += aarch64/hevcdsp_deblock_neon.o \
aarch64/hevcdsp_idct_neon.o \
aarch64/hevcdsp_init_aarch64.o \
aarch64/hevcdsp_qpel_neon.o \
aarch64/hevcdsp_sao_neon.o
183 changes: 183 additions & 0 deletions libavcodec/aarch64/hevcdsp_deblock_neon.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
/* -*-arm64-*-
* vim: syntax=arm64asm
*
* Copyright (c) 2014 Seppo Tomperi <[email protected]>
* Copyright (c) 2023 J. Dekker <[email protected]>
*
* 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/aarch64/asm.S"
#include "neon.S"

.macro hevc_loop_filter_chroma_start bitdepth
mov x4, x30
ldr w14, [x2]
ldr w15, [x2, #4]
.if \bitdepth > 8
lsl w14, w14, #(\bitdepth - 8)
lsl w15, w15, #(\bitdepth - 8)
.endif
adds w2, w14, w15
b.eq 1f
dup v16.4h, w14
dup v17.4h, w15
trn1 v16.2d, v16.2d, v17.2d
.if \bitdepth > 8
mvni v19.8h, #((0xff << (\bitdepth - 8)) & 0xff), lsl #8
movi v18.8h, #0
.endif
neg v17.8h, v16.8h
.endm

.macro hevc_loop_filter_chroma_body bitdepth
.if \bitdepth <= 8
uxtl v20.8h, v0.8b // p1
uxtl v1.8h, v1.8b // p0
uxtl v2.8h, v2.8b // q0
uxtl v23.8h, v3.8b // q1
va .req v20
vb .req v23
.else // required to specify both cases as we are unable to do: v0 .req v20
va .req v0
vb .req v3
.endif
sub v5.8h, v2.8h, v1.8h // q0 - p0
sub v6.8h, va.8h, vb.8h // p1 - q1
shl v5.8h, v5.8h, #2
add v5.8h, v6.8h, v5.8h
srshr v5.8h, v5.8h, #3
clip v17.8h, v16.8h, v5.8h
sqadd v1.8h, v1.8h, v5.8h // p0 + delta
sqsub v2.8h, v2.8h, v5.8h // q0 - delta
.if \bitdepth <= 8
sqxtun v1.8b, v1.8h
sqxtun v2.8b, v2.8h
.else
clip v18.8h, v19.8h, v1.8h, v2.8h
.endif
.unreq va
.unreq vb
.endm

function hevc_loop_filter_chroma_body_8_neon, export=0
hevc_loop_filter_chroma_body 8
ret
endfunc

function hevc_loop_filter_chroma_body_10_neon, export=0
hevc_loop_filter_chroma_body_12_neon:
hevc_loop_filter_chroma_body 10
ret
endfunc

// void ff_hevc_h_loop_filter_chroma_8_neon(uint8_t *_pix, ptrdiff_t _stride, int *_tc, uint8_t *_no_p, uint8_t *_no_q);

.macro hevc_h_loop_filter_chroma bitdepth
function ff_hevc_h_loop_filter_chroma_\bitdepth\()_neon, export=1
hevc_loop_filter_chroma_start \bitdepth
sub x0, x0, x1, lsl #1
.if \bitdepth > 8
ld1 {v0.8h}, [x0], x1
ld1 {v1.8h}, [x0], x1
ld1 {v2.8h}, [x0], x1
ld1 {v3.8h}, [x0]
.else
ld1 {v0.8b}, [x0], x1
ld1 {v1.8b}, [x0], x1
ld1 {v2.8b}, [x0], x1
ld1 {v3.8b}, [x0]
.endif
sub x0, x0, x1, lsl #1
bl hevc_loop_filter_chroma_body_\bitdepth\()_neon
.if \bitdepth > 8
st1 {v1.8h}, [x0], x1
st1 {v2.8h}, [x0]
.else
st1 {v1.8b}, [x0], x1
st1 {v2.8b}, [x0]
.endif
1: ret x4
endfunc
.endm

.macro hevc_v_loop_filter_chroma bitdepth
function ff_hevc_v_loop_filter_chroma_\bitdepth\()_neon, export=1
hevc_loop_filter_chroma_start \bitdepth
.if \bitdepth > 8
sub x0, x0, #4
add x3, x0, x1
lsl x1, x1, #1
ld1 {v0.d}[0], [x0], x1
ld1 {v1.d}[0], [x3], x1
ld1 {v2.d}[0], [x0], x1
ld1 {v3.d}[0], [x3], x1
ld1 {v0.d}[1], [x0], x1
ld1 {v1.d}[1], [x3], x1
ld1 {v2.d}[1], [x0], x1
ld1 {v3.d}[1], [x3], x1
transpose_4x8H v0, v1, v2, v3, v28, v29, v30, v31
.else
sub x0, x0, #2
add x3, x0, x1
lsl x1, x1, #1
ld1 {v0.s}[0], [x0], x1
ld1 {v1.s}[0], [x3], x1
ld1 {v2.s}[0], [x0], x1
ld1 {v3.s}[0], [x3], x1
ld1 {v0.s}[1], [x0], x1
ld1 {v1.s}[1], [x3], x1
ld1 {v2.s}[1], [x0], x1
ld1 {v3.s}[1], [x3], x1
transpose_4x8B v0, v1, v2, v3, v28, v29, v30, v31
.endif
sub x0, x0, x1, lsl #2
sub x3, x3, x1, lsl #2
bl hevc_loop_filter_chroma_body_\bitdepth\()_neon
.if \bitdepth > 8
transpose_4x8H v0, v1, v2, v3, v28, v29, v30, v31
st1 {v0.d}[0], [x0], x1
st1 {v1.d}[0], [x3], x1
st1 {v2.d}[0], [x0], x1
st1 {v3.d}[0], [x3], x1
st1 {v0.d}[1], [x0], x1
st1 {v1.d}[1], [x3], x1
st1 {v2.d}[1], [x0], x1
st1 {v3.d}[1], [x3]
.else
transpose_4x8B v0, v1, v2, v3, v28, v29, v30, v31
st1 {v0.s}[0], [x0], x1
st1 {v1.s}[0], [x3], x1
st1 {v2.s}[0], [x0], x1
st1 {v3.s}[0], [x3], x1
st1 {v0.s}[1], [x0], x1
st1 {v1.s}[1], [x3], x1
st1 {v2.s}[1], [x0], x1
st1 {v3.s}[1], [x3]
.endif
1: ret x4
endfunc
.endm

hevc_h_loop_filter_chroma 8
hevc_h_loop_filter_chroma 10
hevc_h_loop_filter_chroma 12

hevc_v_loop_filter_chroma 8
hevc_v_loop_filter_chroma 10
hevc_v_loop_filter_chroma 12
18 changes: 18 additions & 0 deletions libavcodec/aarch64/hevcdsp_init_aarch64.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@
#include "libavutil/aarch64/cpu.h"
#include "libavcodec/hevcdsp.h"

void ff_hevc_v_loop_filter_chroma_8_neon(uint8_t *_pix, ptrdiff_t _stride,
const int *_tc, const uint8_t *_no_p, const uint8_t *_no_q);
void ff_hevc_v_loop_filter_chroma_10_neon(uint8_t *_pix, ptrdiff_t _stride,
const int *_tc, const uint8_t *_no_p, const uint8_t *_no_q);
void ff_hevc_v_loop_filter_chroma_12_neon(uint8_t *_pix, ptrdiff_t _stride,
const int *_tc, const uint8_t *_no_p, const uint8_t *_no_q);
void ff_hevc_h_loop_filter_chroma_8_neon(uint8_t *_pix, ptrdiff_t _stride,
const int *_tc, const uint8_t *_no_p, const uint8_t *_no_q);
void ff_hevc_h_loop_filter_chroma_10_neon(uint8_t *_pix, ptrdiff_t _stride,
const int *_tc, const uint8_t *_no_p, const uint8_t *_no_q);
void ff_hevc_h_loop_filter_chroma_12_neon(uint8_t *_pix, ptrdiff_t _stride,
const int *_tc, const uint8_t *_no_p, const uint8_t *_no_q);
void ff_hevc_add_residual_4x4_8_neon(uint8_t *_dst, const int16_t *coeffs,
ptrdiff_t stride);
void ff_hevc_add_residual_4x4_10_neon(uint8_t *_dst, const int16_t *coeffs,
Expand Down Expand Up @@ -117,6 +129,8 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth)
if (!have_neon(av_get_cpu_flags())) return;

if (bit_depth == 8) {
c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_8_neon;
c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_8_neon;
c->add_residual[0] = ff_hevc_add_residual_4x4_8_neon;
c->add_residual[1] = ff_hevc_add_residual_8x8_8_neon;
c->add_residual[2] = ff_hevc_add_residual_16x16_8_neon;
Expand Down Expand Up @@ -167,6 +181,8 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth)
c->put_hevc_qpel_bi[9][0][1] = ff_hevc_put_hevc_qpel_bi_h16_8_neon;
}
if (bit_depth == 10) {
c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_10_neon;
c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_10_neon;
c->add_residual[0] = ff_hevc_add_residual_4x4_10_neon;
c->add_residual[1] = ff_hevc_add_residual_8x8_10_neon;
c->add_residual[2] = ff_hevc_add_residual_16x16_10_neon;
Expand All @@ -180,6 +196,8 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth)
c->idct_dc[3] = ff_hevc_idct_32x32_dc_10_neon;
}
if (bit_depth == 12) {
c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_12_neon;
c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_12_neon;
c->add_residual[0] = ff_hevc_add_residual_4x4_12_neon;
c->add_residual[1] = ff_hevc_add_residual_8x8_12_neon;
c->add_residual[2] = ff_hevc_add_residual_16x16_12_neon;
Expand Down
35 changes: 19 additions & 16 deletions libavcodec/dpx.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,14 +476,31 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
avctx->colorspace = AVCOL_SPC_RGB;
}

av_strlcpy(creator, avpkt->data + 160, 100);
creator[100] = '\0';
av_dict_set(&p->metadata, "Creator", creator, 0);

av_strlcpy(input_device, avpkt->data + 1556, 32);
input_device[32] = '\0';
av_dict_set(&p->metadata, "Input Device", input_device, 0);

// Some devices do not pad 10bit samples to whole 32bit words per row
if (!memcmp(input_device, "Scanity", 7) ||
!memcmp(creator, "Lasergraphics Inc.", 18)) {
if (bits_per_color == 10)
unpadded_10bit = 1;
}

// Table 3c: Runs will always break at scan line boundaries. Packing
// will always break to the next 32-bit word at scan-line boundaries.
// Unfortunately, the encoder produced invalid files, so attempt
// to detect it
// Also handle special case with unpadded content
need_align = FFALIGN(stride, 4);
if (need_align*avctx->height + (int64_t)offset > avpkt->size) {
if (need_align*avctx->height + (int64_t)offset > avpkt->size &&
(!unpadded_10bit || (avctx->width * avctx->height * elements + 2) / 3 * 4 + (int64_t)offset > avpkt->size)) {
// Alignment seems unappliable, try without
if (stride*avctx->height + (int64_t)offset > avpkt->size) {
if (stride*avctx->height + (int64_t)offset > avpkt->size || unpadded_10bit) {
av_log(avctx, AV_LOG_ERROR, "Overread buffer. Invalid header?\n");
return AVERROR_INVALIDDATA;
} else {
Expand Down Expand Up @@ -609,20 +626,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
return ret;

av_strlcpy(creator, avpkt->data + 160, 100);
creator[100] = '\0';
av_dict_set(&p->metadata, "Creator", creator, 0);

av_strlcpy(input_device, avpkt->data + 1556, 32);
input_device[32] = '\0';
av_dict_set(&p->metadata, "Input Device", input_device, 0);

// Some devices do not pad 10bit samples to whole 32bit words per row
if (!memcmp(input_device, "Scanity", 7) ||
!memcmp(creator, "Lasergraphics Inc.", 18)) {
unpadded_10bit = 1;
}

// Move pointer to offset from start of file
buf = avpkt->data + offset;

Expand Down
5 changes: 5 additions & 0 deletions libavcodec/ffv1dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,11 @@ static int read_extra_header(FFV1Context *f)
av_log(f->avctx, AV_LOG_ERROR, "Invalid version in global header\n");
return AVERROR_INVALIDDATA;
}
if (f->version > 4) {
av_log(f->avctx, AV_LOG_ERROR, "unsupported version %d\n",
f->version);
return AVERROR_PATCHWELCOME;
}
if (f->version > 2) {
c->bytestream_end -= 4;
f->micro_version = get_symbol(c, state, 0);
Expand Down
3 changes: 3 additions & 0 deletions libavcodec/jpeg2000.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ typedef struct Jpeg2000Cblk {
Jpeg2000Pass *passes;
Jpeg2000Layer *layers;
int coord[2][2]; // border coordinates {{x0, x1}, {y0, y1}}
/*HTJ2K settings */
int zbp;
int pass_lengths[2];
} Jpeg2000Cblk; // code block

typedef struct Jpeg2000Prec {
Expand Down
Loading