| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 
| 3  * | 3  * | 
| 4  *  Use of this source code is governed by a BSD-style license | 4  *  Use of this source code is governed by a BSD-style license | 
| 5  *  that can be found in the LICENSE file in the root of the source | 5  *  that can be found in the LICENSE file in the root of the source | 
| 6  *  tree. An additional intellectual property rights grant can be found | 6  *  tree. An additional intellectual property rights grant can be found | 
| 7  *  in the file PATENTS.  All contributing project authors may | 7  *  in the file PATENTS.  All contributing project authors may | 
| 8  *  be found in the AUTHORS file in the root of the source tree. | 8  *  be found in the AUTHORS file in the root of the source tree. | 
| 9  */ | 9  */ | 
| 10 | 10 | 
| 11 | 11 | 
| 12 /*!\file | 12 /*!\file | 
| 13  * \brief Provides the high level interface to wrap encoder algorithms. | 13  * \brief Provides the high level interface to wrap encoder algorithms. | 
| 14  * | 14  * | 
| 15  */ | 15  */ | 
| 16 #include <limits.h> | 16 #include <limits.h> | 
| 17 #include <string.h> | 17 #include <string.h> | 
| 18 #include "vpx/internal/vpx_codec_internal.h" | 18 #include "vpx/internal/vpx_codec_internal.h" | 
|  | 19 #include "vpx_config.h" | 
| 19 | 20 | 
| 20 #define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var) | 21 #define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var) | 
| 21 | 22 | 
| 22 vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t      *ctx, | 23 vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t      *ctx, | 
| 23                                        vpx_codec_iface_t    *iface, | 24                                        vpx_codec_iface_t    *iface, | 
| 24                                        vpx_codec_enc_cfg_t  *cfg, | 25                                        vpx_codec_enc_cfg_t  *cfg, | 
| 25                                        vpx_codec_flags_t     flags, | 26                                        vpx_codec_flags_t     flags, | 
| 26                                        int                   ver) | 27                                        int                   ver) | 
| 27 { | 28 { | 
| 28     vpx_codec_err_t res; | 29     vpx_codec_err_t res; | 
| 29 | 30 | 
| 30     if (ver != VPX_ENCODER_ABI_VERSION) | 31     if (ver != VPX_ENCODER_ABI_VERSION) | 
| 31         res = VPX_CODEC_ABI_MISMATCH; | 32         res = VPX_CODEC_ABI_MISMATCH; | 
| 32     else if (!ctx || !iface || !cfg) | 33     else if (!ctx || !iface || !cfg) | 
| 33         res = VPX_CODEC_INVALID_PARAM; | 34         res = VPX_CODEC_INVALID_PARAM; | 
| 34     else if (iface->abi_version != VPX_CODEC_INTERNAL_ABI_VERSION) | 35     else if (iface->abi_version != VPX_CODEC_INTERNAL_ABI_VERSION) | 
| 35         res = VPX_CODEC_ABI_MISMATCH; | 36         res = VPX_CODEC_ABI_MISMATCH; | 
| 36     else if (!(iface->caps & VPX_CODEC_CAP_ENCODER)) | 37     else if (!(iface->caps & VPX_CODEC_CAP_ENCODER)) | 
| 37         res = VPX_CODEC_INCAPABLE; | 38         res = VPX_CODEC_INCAPABLE; | 
| 38     else if ((flags & VPX_CODEC_USE_XMA) && !(iface->caps & VPX_CODEC_CAP_XMA)) | 39     else if ((flags & VPX_CODEC_USE_XMA) && !(iface->caps & VPX_CODEC_CAP_XMA)) | 
| 39         res = VPX_CODEC_INCAPABLE; | 40         res = VPX_CODEC_INCAPABLE; | 
| 40     else if ((flags & VPX_CODEC_USE_PSNR) | 41     else if ((flags & VPX_CODEC_USE_PSNR) | 
| 41              && !(iface->caps & VPX_CODEC_CAP_PSNR)) | 42              && !(iface->caps & VPX_CODEC_CAP_PSNR)) | 
| 42         res = VPX_CODEC_INCAPABLE; | 43         res = VPX_CODEC_INCAPABLE; | 
|  | 44     else if ((flags & VPX_CODEC_USE_OUTPUT_PARTITION) | 
|  | 45              && !(iface->caps & VPX_CODEC_CAP_OUTPUT_PARTITION)) | 
|  | 46         res = VPX_CODEC_INCAPABLE; | 
| 43     else | 47     else | 
| 44     { | 48     { | 
| 45         ctx->iface = iface; | 49         ctx->iface = iface; | 
| 46         ctx->name = iface->name; | 50         ctx->name = iface->name; | 
| 47         ctx->priv = NULL; | 51         ctx->priv = NULL; | 
| 48         ctx->init_flags = flags; | 52         ctx->init_flags = flags; | 
| 49         ctx->config.enc = cfg; | 53         ctx->config.enc = cfg; | 
| 50         res = ctx->iface->init(ctx); | 54         res = ctx->iface->init(ctx); | 
| 51 | 55 | 
| 52         if (res) | 56         if (res) | 
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 303 | 307 | 
| 304     pkt = (const void *) * iter; | 308     pkt = (const void *) * iter; | 
| 305 | 309 | 
| 306     if ((size_t)(pkt - list->pkts) < list->cnt) | 310     if ((size_t)(pkt - list->pkts) < list->cnt) | 
| 307         *iter = pkt + 1; | 311         *iter = pkt + 1; | 
| 308     else | 312     else | 
| 309         pkt = NULL; | 313         pkt = NULL; | 
| 310 | 314 | 
| 311     return pkt; | 315     return pkt; | 
| 312 } | 316 } | 
| OLD | NEW | 
|---|