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 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 * segments list because we want to define the requested segments list | 73 * segments list because we want to define the requested segments list |
74 * before defining the private type (so that the number of memory maps is | 74 * before defining the private type (so that the number of memory maps is |
75 * known) | 75 * known) |
76 */ | 76 */ |
77 (void)si; | 77 (void)si; |
78 return sizeof(vpx_codec_alg_priv_t); | 78 return sizeof(vpx_codec_alg_priv_t); |
79 } | 79 } |
80 | 80 |
81 static void vp8_init_ctx(vpx_codec_ctx_t *ctx) | 81 static void vp8_init_ctx(vpx_codec_ctx_t *ctx) |
82 { | 82 { |
83 ctx->priv = | 83 vpx_codec_alg_priv_t *priv = |
84 (vpx_codec_priv_t *)vpx_memalign(8, sizeof(vpx_codec_alg_priv_t)); | 84 (vpx_codec_alg_priv_t *)vpx_calloc(1, sizeof(*priv)); |
85 vpx_memset(ctx->priv, 0, sizeof(vpx_codec_alg_priv_t)); | 85 |
86 ctx->priv->sz = sizeof(*ctx->priv); | 86 ctx->priv = (vpx_codec_priv_t *)priv; |
87 ctx->priv->alg_priv = (vpx_codec_alg_priv_t *)ctx->priv; | |
88 ctx->priv->alg_priv->si.sz = sizeof(ctx->priv->alg_priv->si); | |
89 ctx->priv->alg_priv->decrypt_cb = NULL; | |
90 ctx->priv->alg_priv->decrypt_state = NULL; | |
91 ctx->priv->alg_priv->flushed = 0; | |
92 ctx->priv->init_flags = ctx->init_flags; | 87 ctx->priv->init_flags = ctx->init_flags; |
93 | 88 |
| 89 priv->si.sz = sizeof(priv->si); |
| 90 priv->decrypt_cb = NULL; |
| 91 priv->decrypt_state = NULL; |
| 92 priv->flushed = 0; |
| 93 |
94 if (ctx->config.dec) | 94 if (ctx->config.dec) |
95 { | 95 { |
96 /* Update the reference to the config structure to an internal copy. */ | 96 /* Update the reference to the config structure to an internal copy. */ |
97 ctx->priv->alg_priv->cfg = *ctx->config.dec; | 97 priv->cfg = *ctx->config.dec; |
98 ctx->config.dec = &ctx->priv->alg_priv->cfg; | 98 ctx->config.dec = &priv->cfg; |
99 } | 99 } |
100 } | 100 } |
101 | 101 |
102 static vpx_codec_err_t vp8_init(vpx_codec_ctx_t *ctx, | 102 static vpx_codec_err_t vp8_init(vpx_codec_ctx_t *ctx, |
103 vpx_codec_priv_enc_mr_cfg_t *data) | 103 vpx_codec_priv_enc_mr_cfg_t *data) |
104 { | 104 { |
105 vpx_codec_err_t res = VPX_CODEC_OK; | 105 vpx_codec_err_t res = VPX_CODEC_OK; |
| 106 vpx_codec_alg_priv_t *priv = NULL; |
106 (void) data; | 107 (void) data; |
107 | 108 |
108 vp8_rtcd(); | 109 vp8_rtcd(); |
109 | 110 |
110 /* This function only allocates space for the vpx_codec_alg_priv_t | 111 /* This function only allocates space for the vpx_codec_alg_priv_t |
111 * structure. More memory may be required at the time the stream | 112 * structure. More memory may be required at the time the stream |
112 * information becomes known. | 113 * information becomes known. |
113 */ | 114 */ |
114 if (!ctx->priv) | 115 if (!ctx->priv) |
115 { | 116 { |
116 vp8_init_ctx(ctx); | 117 vp8_init_ctx(ctx); |
| 118 priv = (vpx_codec_alg_priv_t *)ctx->priv; |
117 | 119 |
118 /* initialize number of fragments to zero */ | 120 /* initialize number of fragments to zero */ |
119 ctx->priv->alg_priv->fragments.count = 0; | 121 priv->fragments.count = 0; |
120 /* is input fragments enabled? */ | 122 /* is input fragments enabled? */ |
121 ctx->priv->alg_priv->fragments.enabled = | 123 priv->fragments.enabled = |
122 (ctx->priv->alg_priv->base.init_flags & | 124 (priv->base.init_flags & VPX_CODEC_USE_INPUT_FRAGMENTS); |
123 VPX_CODEC_USE_INPUT_FRAGMENTS); | |
124 | 125 |
125 /*post processing level initialized to do nothing */ | 126 /*post processing level initialized to do nothing */ |
126 } | 127 } |
| 128 else |
| 129 { |
| 130 priv = (vpx_codec_alg_priv_t *)ctx->priv; |
| 131 } |
127 | 132 |
128 ctx->priv->alg_priv->yv12_frame_buffers.use_frame_threads = | 133 priv->yv12_frame_buffers.use_frame_threads = |
129 (ctx->priv->alg_priv->base.init_flags & | 134 (ctx->priv->init_flags & VPX_CODEC_USE_FRAME_THREADING); |
130 VPX_CODEC_USE_FRAME_THREADING); | |
131 | 135 |
132 /* for now, disable frame threading */ | 136 /* for now, disable frame threading */ |
133 ctx->priv->alg_priv->yv12_frame_buffers.use_frame_threads = 0; | 137 priv->yv12_frame_buffers.use_frame_threads = 0; |
134 | 138 |
135 if(ctx->priv->alg_priv->yv12_frame_buffers.use_frame_threads && | 139 if (priv->yv12_frame_buffers.use_frame_threads && |
136 (( ctx->priv->alg_priv->base.init_flags & | 140 ((ctx->priv->init_flags & VPX_CODEC_USE_ERROR_CONCEALMENT) || |
137 VPX_CODEC_USE_ERROR_CONCEALMENT) | 141 (ctx->priv->init_flags & VPX_CODEC_USE_INPUT_FRAGMENTS))) |
138 || ( ctx->priv->alg_priv->base.init_flags & | |
139 VPX_CODEC_USE_INPUT_FRAGMENTS) ) ) | |
140 { | 142 { |
141 /* row-based threading, error concealment, and input fragments will | 143 /* row-based threading, error concealment, and input fragments will |
142 * not be supported when using frame-based threading */ | 144 * not be supported when using frame-based threading */ |
143 res = VPX_CODEC_INVALID_PARAM; | 145 res = VPX_CODEC_INVALID_PARAM; |
144 } | 146 } |
145 | 147 |
146 return res; | 148 return res; |
147 } | 149 } |
148 | 150 |
149 static vpx_codec_err_t vp8_destroy(vpx_codec_alg_priv_t *ctx) | 151 static vpx_codec_err_t vp8_destroy(vpx_codec_alg_priv_t *ctx) |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 VPX_CODEC_CAP_INPUT_FRAGMENTS, | 809 VPX_CODEC_CAP_INPUT_FRAGMENTS, |
808 /* vpx_codec_caps_t caps; */ | 810 /* vpx_codec_caps_t caps; */ |
809 vp8_init, /* vpx_codec_init_fn_t init; */ | 811 vp8_init, /* vpx_codec_init_fn_t init; */ |
810 vp8_destroy, /* vpx_codec_destroy_fn_t destroy; */ | 812 vp8_destroy, /* vpx_codec_destroy_fn_t destroy; */ |
811 vp8_ctf_maps, /* vpx_codec_ctrl_fn_map_t *ctrl_maps; */ | 813 vp8_ctf_maps, /* vpx_codec_ctrl_fn_map_t *ctrl_maps; */ |
812 { | 814 { |
813 vp8_peek_si, /* vpx_codec_peek_si_fn_t peek_si; */ | 815 vp8_peek_si, /* vpx_codec_peek_si_fn_t peek_si; */ |
814 vp8_get_si, /* vpx_codec_get_si_fn_t get_si; */ | 816 vp8_get_si, /* vpx_codec_get_si_fn_t get_si; */ |
815 vp8_decode, /* vpx_codec_decode_fn_t decode; */ | 817 vp8_decode, /* vpx_codec_decode_fn_t decode; */ |
816 vp8_get_frame, /* vpx_codec_frame_get_fn_t frame_get; */ | 818 vp8_get_frame, /* vpx_codec_frame_get_fn_t frame_get; */ |
817 NOT_IMPLEMENTED, | 819 NULL, |
818 }, | 820 }, |
819 { /* encoder functions */ | 821 { /* encoder functions */ |
820 0, | 822 0, |
821 NOT_IMPLEMENTED, | 823 NULL, |
822 NOT_IMPLEMENTED, | 824 NULL, |
823 NOT_IMPLEMENTED, | 825 NULL, |
824 NOT_IMPLEMENTED, | 826 NULL, |
825 NOT_IMPLEMENTED, | 827 NULL, |
826 NOT_IMPLEMENTED | 828 NULL |
827 } | 829 } |
828 }; | 830 }; |
OLD | NEW |