Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How to convert bitstream to packets and bitxor them

1 visualización (últimos 30 días)
Toan
Toan el 14 de Nov. de 2014
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
I have to convert a bit stream file such as name `BL.264` source file . Now I want to parse the file into packets with packet size is 50 bytes. After that, I want to implement bit XOR between first packet and second packet. To do it, I will use `fread` and `bitxor` functions. However, I have some issues:
  1. If size of file is not divisible by packet sizes, we must add some padding at the end of final packet, *Right?* If it is correct. How to do it by matlab?"Error using reshapeProduct of known dimensions, 50, not divisible into total number of elements, 594704."
  2. The bitxor supports xor bitwise that have limit length. In my case, packet size is 50 bytes, it is impossible to bitxor two packet. How to resolve that problem.
Let see my code. If have any problem, let me know
fid=fopen('BL.264','r');
bytelist=fread(fid,'*uint8')';
bitexpanded = dec2bin(bytelist(:), 8) - '0';
bitstream = reshape( bitexpanded.', [],50);
xorPacket=bitxor(bitstream(1,:),bitstream(2,:))
fclose(fid);

Respuestas (0)

La pregunta está cerrada.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by