Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
c097a32e
Commit
c097a32e
authored
Nov 17, 2018
by
Martin Vignali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/proresdec : rename dsp part for 10b and check dspinit for supported bits per raw sample
based on patch by Kieran Kunhya
parent
a9709200
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
18 deletions
+28
-18
proresdec2.c
libavcodec/proresdec2.c
+7
-2
proresdsp.c
libavcodec/proresdsp.c
+15
-10
proresdsp.h
libavcodec/proresdsp.h
+1
-3
simple_idct.c
libavcodec/simple_idct.c
+1
-1
simple_idct.h
libavcodec/simple_idct.h
+1
-1
dct.c
libavcodec/tests/dct.c
+1
-1
proresdsp_init.c
libavcodec/x86/proresdsp_init.c
+2
-0
No files found.
libavcodec/proresdec2.c
View file @
c097a32e
...
...
@@ -48,6 +48,7 @@ static void permute(uint8_t *dst, const uint8_t *src, const uint8_t permutation[
static
av_cold
int
decode_init
(
AVCodecContext
*
avctx
)
{
int
ret
=
0
;
ProresContext
*
ctx
=
avctx
->
priv_data
;
uint8_t
idct_permutation
[
64
];
...
...
@@ -78,7 +79,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
}
ff_blockdsp_init
(
&
ctx
->
bdsp
,
avctx
);
ff_proresdsp_init
(
&
ctx
->
prodsp
,
avctx
);
ret
=
ff_proresdsp_init
(
&
ctx
->
prodsp
,
avctx
);
if
(
ret
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Fail to init proresdsp for bits per raw sample %d
\n
"
,
avctx
->
bits_per_raw_sample
);
return
ret
;
}
ff_init_scantable_permutation
(
idct_permutation
,
ctx
->
prodsp
.
idct_permutation_type
);
...
...
@@ -86,7 +91,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
permute
(
ctx
->
progressive_scan
,
ff_prores_progressive_scan
,
idct_permutation
);
permute
(
ctx
->
interlaced_scan
,
ff_prores_interlaced_scan
,
idct_permutation
);
return
0
;
return
ret
;
}
static
int
decode_frame_header
(
ProresContext
*
ctx
,
const
uint8_t
*
buf
,
...
...
libavcodec/proresdsp.c
View file @
c097a32e
...
...
@@ -27,15 +27,15 @@
#include "proresdsp.h"
#include "simple_idct.h"
#define CLIP_MIN (1 <<
(PRORES_BITS_PER_SAMPLE - 8))
///< minimum value for clipping resulting pixels
#define CLIP_MAX
(1 << PRORES_BITS_PER_SAMPLE
) - CLIP_MIN - 1 ///< maximum value for clipping resulting pixels
#define CLIP_MIN (1 <<
2)
///< minimum value for clipping resulting pixels
#define CLIP_MAX
_10 (1 << 10
) - CLIP_MIN - 1 ///< maximum value for clipping resulting pixels
#define CLIP
(x) (av_clip((x), CLIP_MIN, CLIP_MAX
))
#define CLIP
_10(x) (av_clip((x), CLIP_MIN, CLIP_MAX_10
))
/**
* Add bias value, clamp and output pixels of a slice
*/
static
void
put_pixels
(
uint16_t
*
dst
,
ptrdiff_t
linesize
,
const
int16_t
*
in
)
static
void
put_pixels
_10
(
uint16_t
*
dst
,
ptrdiff_t
linesize
,
const
int16_t
*
in
)
{
int
x
,
y
,
src_offset
,
dst_offset
;
...
...
@@ -43,25 +43,30 @@ static void put_pixels(uint16_t *dst, ptrdiff_t linesize, const int16_t *in)
for
(
x
=
0
;
x
<
8
;
x
++
)
{
src_offset
=
(
y
<<
3
)
+
x
;
dst
[
dst_offset
+
x
]
=
CLIP
(
in
[
src_offset
]);
dst
[
dst_offset
+
x
]
=
CLIP
_10
(
in
[
src_offset
]);
}
}
}
static
void
prores_idct_put_c
(
uint16_t
*
out
,
ptrdiff_t
linesize
,
int16_t
*
block
,
const
int16_t
*
qmat
)
static
void
prores_idct_put_
10_
c
(
uint16_t
*
out
,
ptrdiff_t
linesize
,
int16_t
*
block
,
const
int16_t
*
qmat
)
{
ff_prores_idct
(
block
,
qmat
);
put_pixels
(
out
,
linesize
>>
1
,
block
);
ff_prores_idct
_10
(
block
,
qmat
);
put_pixels
_10
(
out
,
linesize
>>
1
,
block
);
}
av_cold
void
ff_proresdsp_init
(
ProresDSPContext
*
dsp
,
AVCodecContext
*
avctx
)
av_cold
int
ff_proresdsp_init
(
ProresDSPContext
*
dsp
,
AVCodecContext
*
avctx
)
{
dsp
->
idct_put
=
prores_idct_put_c
;
if
(
avctx
->
bits_per_raw_sample
==
10
)
{
dsp
->
idct_put
=
prores_idct_put_10_c
;
dsp
->
idct_permutation_type
=
FF_IDCT_PERM_NONE
;
}
else
{
return
AVERROR_BUG
;
}
if
(
ARCH_X86
)
ff_proresdsp_init_x86
(
dsp
,
avctx
);
ff_init_scantable_permutation
(
dsp
->
idct_permutation
,
dsp
->
idct_permutation_type
);
return
0
;
}
libavcodec/proresdsp.h
View file @
c097a32e
...
...
@@ -27,15 +27,13 @@
#include <stdint.h>
#include "avcodec.h"
#define PRORES_BITS_PER_SAMPLE 10 ///< output precision of prores decoder
typedef
struct
ProresDSPContext
{
int
idct_permutation_type
;
uint8_t
idct_permutation
[
64
];
void
(
*
idct_put
)(
uint16_t
*
out
,
ptrdiff_t
linesize
,
int16_t
*
block
,
const
int16_t
*
qmat
);
}
ProresDSPContext
;
void
ff_proresdsp_init
(
ProresDSPContext
*
dsp
,
AVCodecContext
*
avctx
);
int
ff_proresdsp_init
(
ProresDSPContext
*
dsp
,
AVCodecContext
*
avctx
);
void
ff_proresdsp_init_x86
(
ProresDSPContext
*
dsp
,
AVCodecContext
*
avctx
);
...
...
libavcodec/simple_idct.c
View file @
c097a32e
...
...
@@ -236,7 +236,7 @@ void ff_simple_idct44_add(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
}
}
void
ff_prores_idct
(
int16_t
*
block
,
const
int16_t
*
qmat
)
void
ff_prores_idct
_10
(
int16_t
*
block
,
const
int16_t
*
qmat
)
{
int
i
;
...
...
libavcodec/simple_idct.h
View file @
c097a32e
...
...
@@ -52,7 +52,7 @@ void ff_simple_idct_int16_12bit(int16_t *block);
* and scales by a factor of 2 more between the two IDCTs to account
* for larger scale of input coefficients.
*/
void
ff_prores_idct
(
int16_t
*
block
,
const
int16_t
*
qmat
);
void
ff_prores_idct
_10
(
int16_t
*
block
,
const
int16_t
*
qmat
);
void
ff_simple_idct248_put
(
uint8_t
*
dest
,
ptrdiff_t
line_size
,
int16_t
*
block
);
...
...
libavcodec/tests/dct.c
View file @
c097a32e
...
...
@@ -73,7 +73,7 @@ static void ff_prores_idct_wrap(int16_t *dst){
for
(
i
=
0
;
i
<
64
;
i
++
){
qmat
[
i
]
=
4
;
}
ff_prores_idct
(
dst
,
qmat
);
ff_prores_idct
_10
(
dst
,
qmat
);
for
(
i
=
0
;
i
<
64
;
i
++
)
{
dst
[
i
]
-=
512
;
}
...
...
libavcodec/x86/proresdsp_init.c
View file @
c097a32e
...
...
@@ -35,6 +35,7 @@ av_cold void ff_proresdsp_init_x86(ProresDSPContext *dsp, AVCodecContext *avctx)
#if ARCH_X86_64
int
cpu_flags
=
av_get_cpu_flags
();
if
(
avctx
->
bits_per_raw_sample
==
10
){
if
(
EXTERNAL_SSE2
(
cpu_flags
))
{
dsp
->
idct_permutation_type
=
FF_IDCT_PERM_TRANSPOSE
;
dsp
->
idct_put
=
ff_prores_idct_put_10_sse2
;
...
...
@@ -44,5 +45,6 @@ av_cold void ff_proresdsp_init_x86(ProresDSPContext *dsp, AVCodecContext *avctx)
dsp
->
idct_permutation_type
=
FF_IDCT_PERM_TRANSPOSE
;
dsp
->
idct_put
=
ff_prores_idct_put_10_avx
;
}
}
#endif
/* ARCH_X86_64 */
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment