Commit f047da4e authored by Clément Bœsch's avatar Clément Bœsch

Merge commit '3cc3463f'

* commit '3cc3463f':
  avisynth: Support pix_fmts added to AviSynth+

This commit is mostly a noop, see
92916e85.

Cosmetics and a small fix are merged.
Merged-by: 's avatarClément Bœsch <u@pkh.me>
parents 2738b4ce 3cc3463f
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* Copyright (c) 2012 AvxSynth Team * Copyright (c) 2012 AvxSynth Team
* *
* This file is part of FFmpeg * This file is part of FFmpeg
*
* FFmpeg is free software; you can redistribute it and/or * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
...@@ -18,8 +19,11 @@ ...@@ -18,8 +19,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "libavutil/attributes.h"
#include "libavutil/internal.h" #include "libavutil/internal.h"
#include "libavcodec/internal.h" #include "libavcodec/internal.h"
#include "avformat.h" #include "avformat.h"
#include "internal.h" #include "internal.h"
#include "config.h" #include "config.h"
...@@ -245,7 +249,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) ...@@ -245,7 +249,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
switch (avs->vi->pixel_type) { switch (avs->vi->pixel_type) {
#ifdef USING_AVISYNTH #ifdef USING_AVISYNTH
/* 10~16-bit YUV pix_fmts (AviSynth+) */ /* 10~16-bit YUV pix_fmts (AviSynth+) */
case AVS_CS_YUV444P10: case AVS_CS_YUV444P10:
st->codecpar->format = AV_PIX_FMT_YUV444P10; st->codecpar->format = AV_PIX_FMT_YUV444P10;
planar = 1; planar = 1;
...@@ -294,7 +298,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) ...@@ -294,7 +298,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
st->codecpar->format = AV_PIX_FMT_YUV420P16; st->codecpar->format = AV_PIX_FMT_YUV420P16;
planar = 1; planar = 1;
break; break;
/* 8~16-bit YUV pix_fmts with Alpha (AviSynth+) */ /* 8~16-bit YUV pix_fmts with Alpha (AviSynth+) */
case AVS_CS_YUVA444: case AVS_CS_YUVA444:
st->codecpar->format = AV_PIX_FMT_YUVA444P; st->codecpar->format = AV_PIX_FMT_YUVA444P;
planar = 4; planar = 4;
...@@ -331,7 +335,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) ...@@ -331,7 +335,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
st->codecpar->format = AV_PIX_FMT_YUVA420P16; st->codecpar->format = AV_PIX_FMT_YUVA420P16;
planar = 4; planar = 4;
break; break;
/* Planar RGB pix_fmts (AviSynth+) */ /* Planar RGB pix_fmts (AviSynth+) */
case AVS_CS_RGBP: case AVS_CS_RGBP:
st->codecpar->format = AV_PIX_FMT_GBRP; st->codecpar->format = AV_PIX_FMT_GBRP;
planar = 3; planar = 3;
...@@ -352,7 +356,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) ...@@ -352,7 +356,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
st->codecpar->format = AV_PIX_FMT_GBRP16; st->codecpar->format = AV_PIX_FMT_GBRP16;
planar = 3; planar = 3;
break; break;
/* Planar RGB pix_fmts with Alpha (AviSynth+) */ /* Planar RGB pix_fmts with Alpha (AviSynth+) */
case AVS_CS_RGBAP: case AVS_CS_RGBAP:
st->codecpar->format = AV_PIX_FMT_GBRAP; st->codecpar->format = AV_PIX_FMT_GBRAP;
planar = 5; planar = 5;
...@@ -369,12 +373,12 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) ...@@ -369,12 +373,12 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
st->codecpar->format = AV_PIX_FMT_GBRAP16; st->codecpar->format = AV_PIX_FMT_GBRAP16;
planar = 5; planar = 5;
break; break;
/* GRAY16 (AviSynth+) */ /* GRAY16 (AviSynth+) */
case AVS_CS_Y16: case AVS_CS_Y16:
st->codecpar->format = AV_PIX_FMT_GRAY16; st->codecpar->format = AV_PIX_FMT_GRAY16;
planar = 2; planar = 2;
break; break;
/* pix_fmts added in AviSynth 2.6 */ /* pix_fmts added in AviSynth 2.6 */
case AVS_CS_YV24: case AVS_CS_YV24:
st->codecpar->format = AV_PIX_FMT_YUV444P; st->codecpar->format = AV_PIX_FMT_YUV444P;
planar = 1; planar = 1;
...@@ -391,7 +395,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) ...@@ -391,7 +395,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
st->codecpar->format = AV_PIX_FMT_GRAY8; st->codecpar->format = AV_PIX_FMT_GRAY8;
planar = 2; planar = 2;
break; break;
/* 16-bit packed RGB pix_fmts (AviSynth+) */ /* 16-bit packed RGB pix_fmts (AviSynth+) */
case AVS_CS_BGR48: case AVS_CS_BGR48:
st->codecpar->format = AV_PIX_FMT_BGR48; st->codecpar->format = AV_PIX_FMT_BGR48;
break; break;
...@@ -399,7 +403,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) ...@@ -399,7 +403,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
st->codecpar->format = AV_PIX_FMT_BGRA64; st->codecpar->format = AV_PIX_FMT_BGRA64;
break; break;
#endif #endif
/* AviSynth 2.5 and AvxSynth pix_fmts */ /* AviSynth 2.5 and AvxSynth pix_fmts */
case AVS_CS_BGR24: case AVS_CS_BGR24:
st->codecpar->format = AV_PIX_FMT_BGR24; st->codecpar->format = AV_PIX_FMT_BGR24;
break; break;
...@@ -606,6 +610,7 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, ...@@ -606,6 +610,7 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt,
const unsigned char *src_p; const unsigned char *src_p;
int n, i, plane, rowsize, planeheight, pitch, bits; int n, i, plane, rowsize, planeheight, pitch, bits;
const char *error; const char *error;
int avsplus av_unused;
if (avs->curr_frame >= avs->vi->num_frames) if (avs->curr_frame >= avs->vi->num_frames)
return AVERROR_EOF; return AVERROR_EOF;
...@@ -618,9 +623,6 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, ...@@ -618,9 +623,6 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt,
#ifdef USING_AVISYNTH #ifdef USING_AVISYNTH
/* Detect whether we're using AviSynth 2.6 or AviSynth+ by /* Detect whether we're using AviSynth 2.6 or AviSynth+ by
* looking for whether avs_is_planar_rgb exists. */ * looking for whether avs_is_planar_rgb exists. */
int avsplus;
if (GetProcAddress(avs_library.library, "avs_is_planar_rgb") == NULL) if (GetProcAddress(avs_library.library, "avs_is_planar_rgb") == NULL)
avsplus = 0; avsplus = 0;
else else
...@@ -683,7 +685,7 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, ...@@ -683,7 +685,7 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt,
} }
#ifdef USING_AVISYNTH #ifdef USING_AVISYNTH
/* Flip Planar RGB video. */ /* Flip Planar RGB video */
if (avsplus && (avs_library.avs_is_planar_rgb(avs->vi) || if (avsplus && (avs_library.avs_is_planar_rgb(avs->vi) ||
avs_library.avs_is_planar_rgba(avs->vi))) { avs_library.avs_is_planar_rgba(avs->vi))) {
src_p = src_p + (planeheight - 1) * pitch; src_p = src_p + (planeheight - 1) * pitch;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment