Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: source/libvpx/vpx/src/vpx_encoder.c

Issue 181493009: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vpx/src/svc_encodeframe.c ('k') | source/libvpx/vpx/src/vpx_psnr.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 ctx++; 248 ctx++;
249 } 249 }
250 250
251 FLOATING_POINT_RESTORE(); 251 FLOATING_POINT_RESTORE();
252 } 252 }
253 253
254 return SAVE_STATUS(ctx, res); 254 return SAVE_STATUS(ctx, res);
255 } 255 }
256 256
257 257
258 const vpx_codec_cx_pkt_t *vpx_codec_get_cx_data(vpx_codec_ctx_t *ctx, 258 const vpx_codec_cx_pkt_t *vpx_codec_get_cx_data(vpx_codec_ctx_t *ctx,
259 vpx_codec_iter_t *iter) { 259 vpx_codec_iter_t *iter) {
260 const vpx_codec_cx_pkt_t *pkt = NULL; 260 const vpx_codec_cx_pkt_t *pkt = NULL;
261 261
262 if (ctx) { 262 if (ctx) {
263 if (!iter) 263 if (!iter)
264 ctx->err = VPX_CODEC_INVALID_PARAM; 264 ctx->err = VPX_CODEC_INVALID_PARAM;
265 else if (!ctx->iface || !ctx->priv) 265 else if (!ctx->iface || !ctx->priv)
266 ctx->err = VPX_CODEC_ERROR; 266 ctx->err = VPX_CODEC_ERROR;
267 else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER)) 267 else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
268 ctx->err = VPX_CODEC_INCAPABLE; 268 ctx->err = VPX_CODEC_INCAPABLE;
269 else 269 else
270 pkt = ctx->iface->enc.get_cx_data(ctx->priv->alg_priv, iter); 270 pkt = ctx->iface->enc.get_cx_data(ctx->priv->alg_priv, iter);
271 } 271 }
272 272
273 if (pkt && pkt->kind == VPX_CODEC_CX_FRAME_PKT) { 273 if (pkt && pkt->kind == VPX_CODEC_CX_FRAME_PKT) {
274 /* If the application has specified a destination area for the 274 // If the application has specified a destination area for the
275 * compressed data, and the codec has not placed the data there, 275 // compressed data, and the codec has not placed the data there,
276 * and it fits, copy it. 276 // and it fits, copy it.
277 */ 277 vpx_codec_priv_t *const priv = ctx->priv;
278 char *dst_buf = ctx->priv->enc.cx_data_dst_buf.buf; 278 char *const dst_buf = (char *)priv->enc.cx_data_dst_buf.buf;
279 279
280 if (dst_buf 280 if (dst_buf &&
281 && pkt->data.raw.buf != dst_buf 281 pkt->data.raw.buf != dst_buf &&
282 && pkt->data.raw.sz 282 pkt->data.raw.sz + priv->enc.cx_data_pad_before +
283 + ctx->priv->enc.cx_data_pad_before 283 priv->enc.cx_data_pad_after <= priv->enc.cx_data_dst_buf.sz) {
284 + ctx->priv->enc.cx_data_pad_after 284 vpx_codec_cx_pkt_t *modified_pkt = &priv->enc.cx_data_pkt;
285 <= ctx->priv->enc.cx_data_dst_buf.sz) {
286 vpx_codec_cx_pkt_t *modified_pkt = &ctx->priv->enc.cx_data_pkt;
287 285
288 memcpy(dst_buf + ctx->priv->enc.cx_data_pad_before, 286 memcpy(dst_buf + priv->enc.cx_data_pad_before, pkt->data.raw.buf,
289 pkt->data.raw.buf, pkt->data.raw.sz); 287 pkt->data.raw.sz);
290 *modified_pkt = *pkt; 288 *modified_pkt = *pkt;
291 modified_pkt->data.raw.buf = dst_buf; 289 modified_pkt->data.raw.buf = dst_buf;
292 modified_pkt->data.raw.sz += ctx->priv->enc.cx_data_pad_before 290 modified_pkt->data.raw.sz += priv->enc.cx_data_pad_before +
293 + ctx->priv->enc.cx_data_pad_after; 291 priv->enc.cx_data_pad_after;
294 pkt = modified_pkt; 292 pkt = modified_pkt;
295 } 293 }
296 294
297 if (dst_buf == pkt->data.raw.buf) { 295 if (dst_buf == pkt->data.raw.buf) {
298 ctx->priv->enc.cx_data_dst_buf.buf = dst_buf + pkt->data.raw.sz; 296 priv->enc.cx_data_dst_buf.buf = dst_buf + pkt->data.raw.sz;
299 ctx->priv->enc.cx_data_dst_buf.sz -= pkt->data.raw.sz; 297 priv->enc.cx_data_dst_buf.sz -= pkt->data.raw.sz;
300 } 298 }
301 } 299 }
302 300
303 return pkt; 301 return pkt;
304 } 302 }
305 303
306 304
307 vpx_codec_err_t vpx_codec_set_cx_data_buf(vpx_codec_ctx_t *ctx, 305 vpx_codec_err_t vpx_codec_set_cx_data_buf(vpx_codec_ctx_t *ctx,
308 const vpx_fixed_buf_t *buf, 306 const vpx_fixed_buf_t *buf,
309 unsigned int pad_before, 307 unsigned int pad_before,
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 396
399 pkt = (const void *) * iter; 397 pkt = (const void *) * iter;
400 398
401 if ((size_t)(pkt - list->pkts) < list->cnt) 399 if ((size_t)(pkt - list->pkts) < list->cnt)
402 *iter = pkt + 1; 400 *iter = pkt + 1;
403 else 401 else
404 pkt = NULL; 402 pkt = NULL;
405 403
406 return pkt; 404 return pkt;
407 } 405 }
OLDNEW
« no previous file with comments | « source/libvpx/vpx/src/svc_encodeframe.c ('k') | source/libvpx/vpx/src/vpx_psnr.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698