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
c1a02e88
Commit
c1a02e88
authored
Nov 12, 2012
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pixdesc: add av_pix_fmt_get_chroma_sub_sample
Deprecate avcodec_get_chroma_sub_sample.
parent
22a0827d
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
55 additions
and
17 deletions
+55
-17
cmdutils.c
cmdutils.c
+3
-1
avcodec.h
libavcodec/avcodec.h
+5
-1
ffv1enc.c
libavcodec/ffv1enc.c
+2
-2
libtheoraenc.c
libavcodec/libtheoraenc.c
+2
-1
mpegvideo.c
libavcodec/mpegvideo.c
+5
-4
mpegvideo_enc.c
libavcodec/mpegvideo_enc.c
+6
-4
tiffenc.c
libavcodec/tiffenc.c
+2
-2
utils.c
libavcodec/utils.c
+2
-1
vp3.c
libavcodec/vp3.c
+2
-1
pixdesc.c
libavutil/pixdesc.c
+12
-0
pixdesc.h
libavutil/pixdesc.h
+14
-0
No files found.
cmdutils.c
View file @
c1a02e88
...
...
@@ -1322,7 +1322,9 @@ static int alloc_buffer(FrameBuffer **pool, AVCodecContext *s, FrameBuffer **pbu
*/
memset
(
buf
->
base
[
0
],
128
,
ret
);
avcodec_get_chroma_sub_sample
(
s
->
pix_fmt
,
&
h_chroma_shift
,
&
v_chroma_shift
);
av_pix_fmt_get_chroma_sub_sample
(
s
->
pix_fmt
,
&
h_chroma_shift
,
&
v_chroma_shift
);
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
buf
->
data
);
i
++
)
{
const
int
h_shift
=
i
==
0
?
0
:
h_chroma_shift
;
const
int
v_shift
=
i
==
0
?
0
:
v_chroma_shift
;
...
...
libavcodec/avcodec.h
View file @
c1a02e88
...
...
@@ -4285,7 +4285,11 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width,
* @{
*/
void
avcodec_get_chroma_sub_sample
(
enum
AVPixelFormat
pix_fmt
,
int
*
h_shift
,
int
*
v_shift
);
/**
* @deprecated Use av_pix_fmt_get_chroma_sub_sample
*/
void
attribute_deprecated
avcodec_get_chroma_sub_sample
(
enum
AVPixelFormat
pix_fmt
,
int
*
h_shift
,
int
*
v_shift
);
/**
* Return a value representing the fourCC code associated to the
...
...
libavcodec/ffv1enc.c
View file @
c1a02e88
...
...
@@ -725,8 +725,8 @@ static av_cold int ffv1_encode_init(AVCodecContext *avctx)
if
(
!
s
->
transparency
)
s
->
plane_count
=
2
;
av
codec
_get_chroma_sub_sample
(
avctx
->
pix_fmt
,
&
s
->
chroma_h_shift
,
&
s
->
chroma_v_shift
);
av
_pix_fmt
_get_chroma_sub_sample
(
avctx
->
pix_fmt
,
&
s
->
chroma_h_shift
,
&
s
->
chroma_v_shift
);
s
->
picture_number
=
0
;
...
...
libavcodec/libtheoraenc.c
View file @
c1a02e88
...
...
@@ -197,7 +197,8 @@ static av_cold int encode_init(AVCodecContext* avc_context)
av_log
(
avc_context
,
AV_LOG_ERROR
,
"Unsupported pix_fmt
\n
"
);
return
-
1
;
}
avcodec_get_chroma_sub_sample
(
avc_context
->
pix_fmt
,
&
h
->
uv_hshift
,
&
h
->
uv_vshift
);
av_pix_fmt_get_chroma_sub_sample
(
avc_context
->
pix_fmt
,
&
h
->
uv_hshift
,
&
h
->
uv_vshift
);
if
(
avc_context
->
flags
&
CODEC_FLAG_QSCALE
)
{
/* to be constant with the libvorbis implementation, clip global_quality to 0 - 10
...
...
libavcodec/mpegvideo.c
View file @
c1a02e88
...
...
@@ -867,8 +867,9 @@ av_cold int ff_MPV_common_init(MpegEncContext *s)
if
(
s
->
width
&&
s
->
height
)
{
/* set chroma shifts */
avcodec_get_chroma_sub_sample
(
s
->
avctx
->
pix_fmt
,
&
s
->
chroma_x_shift
,
&
s
->
chroma_y_shift
);
av_pix_fmt_get_chroma_sub_sample
(
s
->
avctx
->
pix_fmt
,
&
s
->
chroma_x_shift
,
&
s
->
chroma_y_shift
);
/* convert fourcc to upper case */
s
->
codec_tag
=
avpriv_toupper4
(
s
->
avctx
->
codec_tag
);
...
...
@@ -1781,8 +1782,8 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict)
(
s
->
codec_id
==
AV_CODEC_ID_H264
?
0
:
1
);
s
->
low_delay
=
0
;
// needed to see the vectors without trashing the buffers
av
codec
_get_chroma_sub_sample
(
s
->
avctx
->
pix_fmt
,
&
h_chroma_shift
,
&
v_chroma_shift
);
av
_pix_fmt
_get_chroma_sub_sample
(
s
->
avctx
->
pix_fmt
,
&
h_chroma_shift
,
&
v_chroma_shift
);
for
(
i
=
0
;
i
<
3
;
i
++
)
{
memcpy
(
s
->
visualization_buffer
[
i
],
pict
->
data
[
i
],
(
i
==
0
)
?
pict
->
linesize
[
i
]
*
height
:
...
...
libavcodec/mpegvideo_enc.c
View file @
c1a02e88
...
...
@@ -29,6 +29,7 @@
#include "libavutil/intmath.h"
#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "dsputil.h"
...
...
@@ -601,8 +602,8 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
if
(
avctx
->
inter_quant_bias
!=
FF_DEFAULT_QUANT_BIAS
)
s
->
inter_quant_bias
=
avctx
->
inter_quant_bias
;
av
codec
_get_chroma_sub_sample
(
avctx
->
pix_fmt
,
&
chroma_h_shift
,
&
chroma_v_shift
);
av
_pix_fmt
_get_chroma_sub_sample
(
avctx
->
pix_fmt
,
&
chroma_h_shift
,
&
chroma_v_shift
);
if
(
avctx
->
codec_id
==
AV_CODEC_ID_MPEG4
&&
s
->
avctx
->
time_base
.
den
>
(
1
<<
16
)
-
1
)
{
...
...
@@ -994,8 +995,9 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg)
// empty
}
else
{
int
h_chroma_shift
,
v_chroma_shift
;
avcodec_get_chroma_sub_sample
(
s
->
avctx
->
pix_fmt
,
&
h_chroma_shift
,
&
v_chroma_shift
);
av_pix_fmt_get_chroma_sub_sample
(
s
->
avctx
->
pix_fmt
,
&
h_chroma_shift
,
&
v_chroma_shift
);
for
(
i
=
0
;
i
<
3
;
i
++
)
{
int
src_stride
=
pic_arg
->
linesize
[
i
];
...
...
libavcodec/tiffenc.c
View file @
c1a02e88
...
...
@@ -270,8 +270,8 @@ static int encode_frame(AVCodecContext * avctx, AVPacket *pkt,
case
AV_PIX_FMT_YUV410P
:
case
AV_PIX_FMT_YUV411P
:
s
->
photometric_interpretation
=
6
;
av
codec
_get_chroma_sub_sample
(
avctx
->
pix_fmt
,
&
shift_h
,
&
shift_v
);
av
_pix_fmt
_get_chroma_sub_sample
(
avctx
->
pix_fmt
,
&
shift_h
,
&
shift_v
);
s
->
bpp
=
8
+
(
16
>>
(
shift_h
+
shift_v
));
s
->
subsampling
[
0
]
=
1
<<
shift_h
;
s
->
subsampling
[
1
]
=
1
<<
shift_v
;
...
...
libavcodec/utils.c
View file @
c1a02e88
...
...
@@ -427,7 +427,8 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
s
->
pix_fmt
);
const
int
pixel_size
=
desc
->
comp
[
0
].
step_minus1
+
1
;
avcodec_get_chroma_sub_sample
(
s
->
pix_fmt
,
&
h_chroma_shift
,
&
v_chroma_shift
);
av_pix_fmt_get_chroma_sub_sample
(
s
->
pix_fmt
,
&
h_chroma_shift
,
&
v_chroma_shift
);
avcodec_align_dimensions2
(
s
,
&
w
,
&
h
,
stride_align
);
...
...
libavcodec/vp3.c
View file @
c1a02e88
...
...
@@ -1687,7 +1687,8 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
for
(
i
=
0
;
i
<
3
;
i
++
)
s
->
qps
[
i
]
=
-
1
;
avcodec_get_chroma_sub_sample
(
avctx
->
pix_fmt
,
&
s
->
chroma_x_shift
,
&
s
->
chroma_y_shift
);
av_pix_fmt_get_chroma_sub_sample
(
avctx
->
pix_fmt
,
&
s
->
chroma_x_shift
,
&
s
->
chroma_y_shift
);
s
->
y_superblock_width
=
(
s
->
width
+
31
)
/
32
;
s
->
y_superblock_height
=
(
s
->
height
+
31
)
/
32
;
...
...
libavutil/pixdesc.c
View file @
c1a02e88
...
...
@@ -1454,3 +1454,15 @@ enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
return
desc
-
av_pix_fmt_descriptors
;
}
int
av_pix_fmt_get_chroma_sub_sample
(
enum
AVPixelFormat
pix_fmt
,
int
*
h_shift
,
int
*
v_shift
)
{
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
pix_fmt
);
if
(
!
desc
)
return
AVERROR
(
ENOSYS
);
*
h_shift
=
desc
->
log2_chroma_w
;
*
v_shift
=
desc
->
log2_chroma_h
;
return
0
;
}
libavutil/pixdesc.h
View file @
c1a02e88
...
...
@@ -203,4 +203,18 @@ const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev);
*/
enum
AVPixelFormat
av_pix_fmt_desc_get_id
(
const
AVPixFmtDescriptor
*
desc
);
/**
* Utility function to access log2_chroma_w log2_chroma_h from
* the pixel format AVPixFmtDescriptor.
*
* @param[in] pix_fmt the pixel format
* @param[out] h_shift store log2_chroma_h
* @param[out] v_shift store log2_chroma_w
*
* @return 0 on success, AVERROR(ENOSYS) on invalid or unknown pixel format
*/
int
av_pix_fmt_get_chroma_sub_sample
(
enum
AVPixelFormat
pix_fmt
,
int
*
h_shift
,
int
*
v_shift
);
#endif
/* AVUTIL_PIXDESC_H */
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