Re: [libav-devel] [PATCH 03/14] cavs: Convert to the new bitstream reader

2017-01-26 Thread Vittorio Giovara
On Thu, Jan 26, 2017 at 11:10 AM, Diego Biurrun  wrote:
> From: Alexandra Hájková 
>
> ---
>  libavcodec/cavs.c|   8 +--
>  libavcodec/cavs.h|   4 +-
>  libavcodec/cavsdec.c | 178 
> +--
>  3 files changed, 95 insertions(+), 95 deletions(-)

probably ok
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH 03/14] cavs: Convert to the new bitstream reader

2017-01-26 Thread Diego Biurrun
From: Alexandra Hájková 

---
 libavcodec/cavs.c|   8 +--
 libavcodec/cavs.h|   4 +-
 libavcodec/cavsdec.c | 178 +--
 3 files changed, 95 insertions(+), 95 deletions(-)

diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c
index bf1a59a..6959f54 100644
--- a/libavcodec/cavs.c
+++ b/libavcodec/cavs.c
@@ -26,8 +26,8 @@
  */
 
 #include "avcodec.h"
-#include "get_bits.h"
-#include "golomb_legacy.h"
+#include "bitstream.h"
+#include "golomb.h"
 #include "h264chroma.h"
 #include "idctdsp.h"
 #include "internal.h"
@@ -603,8 +603,8 @@ void ff_cavs_mv(AVSContext *h, enum cavs_mv_loc nP, enum 
cavs_mv_loc nC,
 mv_pred_median(h, mvP, mvA, mvB, mvC);
 
 if (mode < MV_PRED_PSKIP) {
-mvP->x += get_se_golomb(>gb);
-mvP->y += get_se_golomb(>gb);
+mvP->x += get_se_golomb(>bc);
+mvP->y += get_se_golomb(>bc);
 }
 set_mvs(mvP, size);
 }
diff --git a/libavcodec/cavs.h b/libavcodec/cavs.h
index e8729d5..cb549f1 100644
--- a/libavcodec/cavs.h
+++ b/libavcodec/cavs.h
@@ -22,11 +22,11 @@
 #ifndef AVCODEC_CAVS_H
 #define AVCODEC_CAVS_H
 
+#include "bitstream.h"
 #include "cavsdsp.h"
 #include "blockdsp.h"
 #include "h264chroma.h"
 #include "idctdsp.h"
-#include "get_bits.h"
 #include "videodsp.h"
 
 #define SLICE_MAX_START_CODE0x01af
@@ -167,7 +167,7 @@ typedef struct AVSContext {
 IDCTDSPContext idsp;
 VideoDSPContext vdsp;
 CAVSDSPContext  cdsp;
-GetBitContext gb;
+BitstreamContext bc;
 AVSFrame cur; ///< currently decoded frame
 AVSFrame DPB[2];  ///< reference frames
 int dist[2]; ///< temporal distances from current frame to ref frames
diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c
index 5a28fc0..7f584ac 100644
--- a/libavcodec/cavsdec.c
+++ b/libavcodec/cavsdec.c
@@ -26,9 +26,9 @@
  */
 
 #include "avcodec.h"
-#include "get_bits.h"
-#include "golomb_legacy.h"
+#include "bitstream.h"
 #include "cavs.h"
+#include "golomb.h"
 #include "internal.h"
 #include "mpeg12data.h"
 
@@ -506,13 +506,13 @@ static inline void mv_pred_sym(AVSContext *h, cavs_vector 
*src,
  /
 
 /** kth-order exponential golomb code */
-static inline int get_ue_code(GetBitContext *gb, int order)
+static inline int get_ue_code(BitstreamContext *bc, int order)
 {
 if (order) {
-int ret = get_ue_golomb(gb) << order;
-return ret + get_bits(gb, order);
+int ret = get_ue_golomb(bc) << order;
+return ret + bitstream_read(bc, order);
 }
-return get_ue_golomb(gb);
+return get_ue_golomb(bc);
 }
 
 static inline int dequant(AVSContext *h, int16_t *level_buf, uint8_t *run_buf,
@@ -545,7 +545,7 @@ static inline int dequant(AVSContext *h, int16_t 
*level_buf, uint8_t *run_buf,
  * @param dst location of sample block
  * @param stride line stride in frame buffer
  */
-static int decode_residual_block(AVSContext *h, GetBitContext *gb,
+static int decode_residual_block(AVSContext *h, BitstreamContext *bc,
  const struct dec_2dvlc *r, int 
esc_golomb_order,
  int qp, uint8_t *dst, ptrdiff_t stride)
 {
@@ -555,10 +555,10 @@ static int decode_residual_block(AVSContext *h, 
GetBitContext *gb,
 int16_t *block = h->block;
 
 for (i = 0;i < 65; i++) {
-level_code = get_ue_code(gb, r->golomb_order);
+level_code = get_ue_code(bc, r->golomb_order);
 if (level_code >= ESCAPE_CODE) {
 run  = ((level_code - ESCAPE_CODE) >> 1) + 1;
-esc_code = get_ue_code(gb, esc_golomb_order);
+esc_code = get_ue_code(bc, esc_golomb_order);
 level= esc_code + (run > r->max_run ? 1 : r->level_add[run]);
 while (level > r->inc_limit)
 r++;
@@ -588,10 +588,10 @@ static int decode_residual_block(AVSContext *h, 
GetBitContext *gb,
 static inline void decode_residual_chroma(AVSContext *h)
 {
 if (h->cbp & (1 << 4))
-decode_residual_block(h, >gb, chroma_dec, 0,
+decode_residual_block(h, >bc, chroma_dec, 0,
   cavs_chroma_qp[h->qp], h->cu, h->c_stride);
 if (h->cbp & (1 << 5))
-decode_residual_block(h, >gb, chroma_dec, 0,
+decode_residual_block(h, >bc, chroma_dec, 0,
   cavs_chroma_qp[h->qp], h->cv, h->c_stride);
 }
 
@@ -600,7 +600,7 @@ static inline int decode_residual_inter(AVSContext *h)
 int block;
 
 /* get coded block pattern */
-int cbp = get_ue_golomb(>gb);
+int cbp = get_ue_golomb(>bc);
 if (cbp > 63 || cbp < 0) {
 av_log(h->avctx, AV_LOG_ERROR, "illegal inter cbp %d\n", cbp);
 return AVERROR_INVALIDDATA;
@@ -609,10 +609,10 @@ static inline int decode_residual_inter(AVSContext *h)
 
 /* get quantizer */
 if (h->cbp && !h->qp_fixed)
-h->qp = (h->qp + get_se_golomb(>gb)) & 63;