delta-debug.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright (C) STMicroelectronics SA 2015
  3. * Authors: Hugues Fruchet <hugues.fruchet@st.com>
  4. * Fabrice Lecoultre <fabrice.lecoultre@st.com>
  5. * for STMicroelectronics.
  6. * License terms: GNU General Public License (GPL), version 2
  7. */
  8. #include "delta.h"
  9. #include "delta-debug.h"
  10. char *delta_streaminfo_str(struct delta_streaminfo *s, char *str,
  11. unsigned int len)
  12. {
  13. if (!s)
  14. return NULL;
  15. snprintf(str, len,
  16. "%4.4s %dx%d %s %s dpb=%d %s %s %s%dx%d@(%d,%d) %s%d/%d",
  17. (char *)&s->streamformat, s->width, s->height,
  18. s->profile, s->level, s->dpb,
  19. (s->field == V4L2_FIELD_NONE) ? "progressive" : "interlaced",
  20. s->other,
  21. s->flags & DELTA_STREAMINFO_FLAG_CROP ? "crop=" : "",
  22. s->crop.width, s->crop.height,
  23. s->crop.left, s->crop.top,
  24. s->flags & DELTA_STREAMINFO_FLAG_PIXELASPECT ? "par=" : "",
  25. s->pixelaspect.numerator,
  26. s->pixelaspect.denominator);
  27. return str;
  28. }
  29. char *delta_frameinfo_str(struct delta_frameinfo *f, char *str,
  30. unsigned int len)
  31. {
  32. if (!f)
  33. return NULL;
  34. snprintf(str, len,
  35. "%4.4s %dx%d aligned %dx%d %s %s%dx%d@(%d,%d) %s%d/%d",
  36. (char *)&f->pixelformat, f->width, f->height,
  37. f->aligned_width, f->aligned_height,
  38. (f->field == V4L2_FIELD_NONE) ? "progressive" : "interlaced",
  39. f->flags & DELTA_STREAMINFO_FLAG_CROP ? "crop=" : "",
  40. f->crop.width, f->crop.height,
  41. f->crop.left, f->crop.top,
  42. f->flags & DELTA_STREAMINFO_FLAG_PIXELASPECT ? "par=" : "",
  43. f->pixelaspect.numerator,
  44. f->pixelaspect.denominator);
  45. return str;
  46. }
  47. void delta_trace_summary(struct delta_ctx *ctx)
  48. {
  49. struct delta_dev *delta = ctx->dev;
  50. struct delta_streaminfo *s = &ctx->streaminfo;
  51. unsigned char str[100] = "";
  52. if (!(ctx->flags & DELTA_FLAG_STREAMINFO))
  53. return;
  54. dev_dbg(delta->dev, "%s %s, %d frames decoded, %d frames output, %d frames dropped, %d stream errors, %d decode errors",
  55. ctx->name,
  56. delta_streaminfo_str(s, str, sizeof(str)),
  57. ctx->decoded_frames,
  58. ctx->output_frames,
  59. ctx->dropped_frames,
  60. ctx->stream_errors,
  61. ctx->decode_errors);
  62. }