Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-12-25 04:38:59 +0300
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-01-04 18:28:55 +0300
commitc037f3fc7ded735c054c6c3d003c16af0e94cf42 (patch)
tree6855cc5927df54e9eddaa198b9197e9700863432 /libavcodec/mpeg12enc.c
parentd91b5020ec4b9b8d356e0dd7b1bee2438c948b0e (diff)
avcodec/mpeg12enc: Partially inline whether codec is MPEG-1
MPEG-1 only supports 4:2:0, so one can optimize away the checks for whether one encodes MPEG-1 in codepaths that encode 4:2:2. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/mpeg12enc.c')
-rw-r--r--libavcodec/mpeg12enc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 1437ac421c..97d497d619 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -776,6 +776,8 @@ static av_always_inline void mpeg1_encode_mb_internal(MpegEncContext *s,
int mb_block_count,
int chroma_y_shift)
{
+/* MPEG-1 is always 420. */
+#define IS_MPEG1(s) (chroma_y_shift == 1 && (s)->codec_id == AV_CODEC_ID_MPEG1VIDEO)
int i, cbp;
const int mb_x = s->mb_x;
const int mb_y = s->mb_y;
@@ -789,7 +791,7 @@ static av_always_inline void mpeg1_encode_mb_internal(MpegEncContext *s,
if (cbp == 0 && !first_mb && s->mv_type == MV_TYPE_16X16 &&
(mb_x != s->mb_width - 1 ||
- (mb_y != s->end_mb_y - 1 && s->codec_id == AV_CODEC_ID_MPEG1VIDEO)) &&
+ (mb_y != s->end_mb_y - 1 && IS_MPEG1(s))) &&
((s->pict_type == AV_PICTURE_TYPE_P && (motion_x | motion_y) == 0) ||
(s->pict_type == AV_PICTURE_TYPE_B && s->mv_dir == s->last_mv_dir &&
(((s->mv_dir & MV_DIR_FORWARD)