diff options
author | Anton Khirnov <anton@khirnov.net> | 2015-11-14 13:12:50 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2015-11-14 13:12:50 +0100 |
commit | 55077af02d091c068d05741117cd28015c0f7fb5 (patch) | |
tree | 888e967695251404f5aebe1b27a2e5cc9af024b4 | |
parent | f64c66f5159f7027cc5ef0017649af41cb762d98 (diff) |
stuff
-rw-r--r-- | libavscale/Makefile | 4 | ||||
-rw-r--r-- | libavscale/avscale.c | 15 | ||||
-rw-r--r-- | libavscale/avscale.h | 29 | ||||
-rw-r--r-- | libavscale/internal.h | 3 | ||||
-rw-r--r-- | libavutil/Makefile | 4 | ||||
-rw-r--r-- | libavutil/frame.c | 2 | ||||
-rw-r--r-- | libavutil/frame.h | 2 | ||||
-rw-r--r-- | libavutil/pixformaton.c (renamed from libavutil/formaton.c) | 13 | ||||
-rw-r--r-- | libavutil/pixformaton.h (renamed from libavutil/formaton.h) | 21 |
9 files changed, 46 insertions, 47 deletions
diff --git a/libavscale/Makefile b/libavscale/Makefile index bae67043ab..9b6f095ec5 100644 --- a/libavscale/Makefile +++ b/libavscale/Makefile @@ -1,7 +1,7 @@ NAME = avscale -HEADERS = avscale.h +HEADERS = avscale.h \ + version.h \ OBJS = avscale.o \ utils.o \ - diff --git a/libavscale/avscale.c b/libavscale/avscale.c index 7cb5ced43f..4860b037c9 100644 --- a/libavscale/avscale.c +++ b/libavscale/avscale.c @@ -56,7 +56,6 @@ err: return ret; } - // FIXME: proof of a concept int avscale_build_chain(AVScaleContext *ctx, AVFrame *src, AVFrame *dst) { @@ -79,7 +78,7 @@ int avscale_build_chain(AVScaleContext *ctx, AVFrame *src, AVFrame *dst) !ctx->dst_fmt->component_desc[0].packed) { if ((ret = prepare_next_stage(ctx, &stage, "rgbunp")) < 0) return ret; - } else if (ctx->src_fmt->component_desc[0].step != ctx->dst_fmt->component_desc[0].step) { + } else if (ctx->src_fmt->component_desc[0].next != ctx->dst_fmt->component_desc[0].next) { if ((ret = prepare_next_stage(ctx, &stage, "rgbunp")) < 0) return ret; if (ctx->cur_w != ctx->dst_w || ctx->cur_h != ctx->dst_h) @@ -91,8 +90,8 @@ int avscale_build_chain(AVScaleContext *ctx, AVFrame *src, AVFrame *dst) if ((ret = prepare_next_stage(ctx, &stage, "murder")) < 0) return ret; } - } else if (ctx->src_fmt->space == AVS_RGB && - ctx->dst_fmt->space == AVS_YUV) { + } else if (ctx->src_fmt->model == AVCOL_MODEL_RGB && + ctx->dst_fmt->model == AVCOL_MODEL_YUV) { if ((ret = prepare_next_stage(ctx, &stage, "rgbunp")) < 0) return ret; if (ctx->cur_w != ctx->dst_w || ctx->cur_h != ctx->dst_h) { @@ -116,7 +115,7 @@ uint8_t *avscale_get_component_ptr(AVFrame *src, int component_id) if (!src->formaton->component_desc[component_id].packed) return src->data[src->formaton->component_desc[component_id].plane]; else - return src->data[0] + src->formaton->component_desc[component_id].off; + return src->data[0] + src->formaton->component_desc[component_id].offset; } int avscale_get_component_stride(AVFrame *src, int component_id) @@ -193,10 +192,12 @@ int avscale_process_frame(AVScaleContext *ctx, AVFrame *srcf, AVFrame *dstf) return 0; } -void avscale_free_context(AVScaleContext *ctx) +void avscale_free(AVScaleContext **pctx) { + AVScaleContext *ctx; AVScaleFilterStage *s, *next; + ctx = *pctx; if (!ctx) return; @@ -210,5 +211,7 @@ void avscale_free_context(AVScaleContext *ctx) s = next; } ctx->head = ctx->tail = 0; + + *pctx = NULL; } diff --git a/libavscale/avscale.h b/libavscale/avscale.h index 7de7d85339..deb66105e4 100644 --- a/libavscale/avscale.h +++ b/libavscale/avscale.h @@ -20,18 +20,11 @@ #ifndef AVSCALE_AVSCALE_H #define AVSCALE_AVSCALE_H -#include <stdint.h> - -#include "libavutil/formaton.h" #include "libavutil/frame.h" #include "libavutil/pixdesc.h" #include "version.h" -// XXX luzero is reading a comic book so this values are random -#define AVS_RGB 0 -#define AVS_YUV 1 - typedef struct AVScaleContext AVScaleContext; /** @@ -62,15 +55,15 @@ AVScaleContext *avscale_alloc_context(void); * @see avscale_build_chain * @see avscale_process_frame */ -int avscale_init_context(AVScaleContext *ctx); +int avscale_open(AVScaleContext *ctx); /** - * Free the avscaler context AVScaleContext. - * If AVScaleContext is NULL, then does nothing. + * Free scaling context and everything associated with it and write NULL + * to the supplied pointer. * - * @param ctx The context to free. + * @param ctx double pointer to the scaling context */ -void avscale_free_context(AVScaleContext *ctx); +void avscale_free(AVScaleContext **ctx); /** * Build a conversion chain using the information contained in the @@ -99,9 +92,19 @@ int avscale_build_chain(AVScaleContext *ctx, AVFrame *src, AVFrame *dst); */ int avscale_process_frame(AVScaleContext *c, AVFrame *dst, AVFrame *src); - +/** + * Return the LIBAVSCALE_VERSION_INT constant. + */ unsigned avscale_version(void); + +/** + * Return the libavscale build-time configuration. + */ const char *avscale_configuration(void); + +/** + * Return the libavscale license. + */ const char *avscale_license(void); #endif /* AVSCALE_AVSCALE_H */ diff --git a/libavscale/internal.h b/libavscale/internal.h index b8d12c0a0d..ed5eeec9da 100644 --- a/libavscale/internal.h +++ b/libavscale/internal.h @@ -22,9 +22,12 @@ #include "libavutil/dict.h" #include "libavutil/log.h" +#include "libavutil/pixformaton.h" #include "avscale.h" +#define AVSCALE_MAX_COMPONENTS AV_PIX_FORMATON_COMPONENTS + typedef struct AVScaleFilterStage { void (*deinit)(struct AVScaleFilterStage *stage); void (*do_common)(void *ctx, diff --git a/libavutil/Makefile b/libavutil/Makefile index 6433dccb90..79f08c8494 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -21,7 +21,6 @@ HEADERS = adler32.h \ eval.h \ fifo.h \ file.h \ - formaton.h \ frame.h \ hmac.h \ imgutils.h \ @@ -38,6 +37,7 @@ HEADERS = adler32.h \ parseutils.h \ pixdesc.h \ pixfmt.h \ + pixformaton.h \ random_seed.h \ replaygain.h \ rational.h \ @@ -77,7 +77,6 @@ OBJS = adler32.o \ file.o \ file_open.o \ float_dsp.o \ - formaton.o \ frame.o \ hmac.o \ imgutils.o \ @@ -93,6 +92,7 @@ OBJS = adler32.o \ opt.o \ parseutils.o \ pixdesc.o \ + pixformaton.o \ random_seed.o \ rational.o \ rc4.o \ diff --git a/libavutil/frame.c b/libavutil/frame.c index 135f6d2480..1b9c304bd2 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -25,7 +25,7 @@ #include "imgutils.h" #include "mem.h" #include "samplefmt.h" -#include "formaton.h" +#include "pixformaton.h" static void get_frame_defaults(AVFrame *frame) { diff --git a/libavutil/frame.h b/libavutil/frame.h index 260e5f58d8..ff707f358a 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -36,7 +36,7 @@ #include "pixfmt.h" #include "version.h" -#include "formaton.h" +#include "pixformaton.h" /** * @defgroup lavu_frame AVFrame diff --git a/libavutil/formaton.c b/libavutil/pixformaton.c index bcf358438b..5c6ab1cce5 100644 --- a/libavutil/formaton.c +++ b/libavutil/pixformaton.c @@ -18,7 +18,7 @@ #include <string.h> -#include "formaton.h" +#include "pixformaton.h" #include "mem.h" #include "pixdesc.h" #include "pixfmt.h" @@ -34,9 +34,6 @@ AVPixelFormaton *av_formaton_from_pixfmt(enum AVPixelFormat pix_fmt) if (!desc) goto fail; - formaton->name = strdup(desc->name); - if (!formaton->name) - goto fail; formaton->flags = desc->flags; // XXX luzero disapproves @@ -52,18 +49,17 @@ AVPixelFormaton *av_formaton_from_pixfmt(enum AVPixelFormat pix_fmt) formaton->nb_components = desc->nb_components; for (i = 0; i < formaton->nb_components; i++) { - AVChromaton *chromaton = &formaton->component_desc[i]; + AVPixelChromaton *chromaton = &formaton->component_desc[i]; const AVComponentDescriptor *comp = &desc->comp[i]; chromaton->plane = comp->plane; - chromaton->step = comp->step; + chromaton->next = comp->step; chromaton->h_sub_log = desc->log2_chroma_w; chromaton->v_sub_log = desc->log2_chroma_h; - chromaton->off = comp->offset; + chromaton->offset = comp->offset; chromaton->shift = comp->shift; chromaton->depth = comp->depth; chromaton->packed = 0; // XXX luzero does not remember - chromaton->next = 0; // XXX luzero does not remember } return formaton; @@ -78,6 +74,5 @@ void av_formaton_free(AVPixelFormaton **formaton) if (!formaton || !*formaton) return; - av_freep(&(*formaton)->name); av_freep(formaton); } diff --git a/libavutil/formaton.h b/libavutil/pixformaton.h index 9d4240017e..59958fead9 100644 --- a/libavutil/formaton.h +++ b/libavutil/pixformaton.h @@ -17,13 +17,15 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVUTIL_FORMATON_H -#define AVUTIL_FORMATON_H - -#include <stdint.h> +#ifndef AVUTIL_PIXFORMATON_H +#define AVUTIL_PIXFORMATON_H #include "pixdesc.h" +#define AV_PIX_FORMATON_FLAG_BE (1 << 0) +#define AV_PIX_FORMATON_FLAG_ALPHA (1 << 1) +#define AV_PIX_FORMATON_FLAG_PAL (1 << 2) + /** * Component description * @@ -98,15 +100,9 @@ typedef struct AVPixelChromaton { * For NV12 - 0,1,1 */ int packed; - -} AVChromaton; - - +} AVPixelChromaton; typedef struct AVPixelFormaton { -#define AV_PIX_FORMATON_FLAG_BE (1 << 0) -#define AV_PIX_FORMATON_FLAG_ALPHA (1 << 1) -#define AV_PIX_FORMATON_FLAG_PAL (1 << 2) /** * Or-ed AV_PIX_FORMATON_FLAG_ */ @@ -141,5 +137,4 @@ typedef struct AVPixelFormaton { AVPixelFormaton *av_formaton_from_pixfmt(enum AVPixelFormat pix_fmt); void av_formaton_free(AVPixelFormaton **formaton); - -#endif /* AVUTIL_FORMATON_H */ +#endif /* AVUTIL_PIXFORMATON_H */ |