Fix encoder crashes for odd size input

(cherry picked from commit 98431cde070a33fe346f1316abd8437cd873dbfa)

Change-Id: Id5c30c419282369cc8c3280d9a70b34a859a71d8
2 files changed